first commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
jQuery( document ).ready(function() {
|
||||
jQuery('.wpdesk-notice-gutenberg').each(function( index ) {
|
||||
var classList = jQuery(this).attr('class').split(/\s+/);
|
||||
var type = '';
|
||||
jQuery.each(classList, function(index, item) {
|
||||
if (item.startsWith('notice-')) {
|
||||
type = item.replace('notice-','');
|
||||
}
|
||||
});
|
||||
content = this.innerText;
|
||||
actions = [];
|
||||
jQuery.each(jQuery(this).find('a'), function(index, item) {
|
||||
text = item.innerText;
|
||||
actions.push({
|
||||
url: item.href,
|
||||
label: text.charAt(0).toUpperCase() + text.slice(1),
|
||||
});
|
||||
});
|
||||
isDismiss = jQuery(this).hasClass('is-dismissible');
|
||||
window.wp.data.dispatch( 'core/notices' ).createNotice(
|
||||
type,
|
||||
content,
|
||||
{
|
||||
isDismissible: isDismiss,
|
||||
actions: actions
|
||||
}
|
||||
);
|
||||
});
|
||||
} );
|
||||
@@ -0,0 +1,22 @@
|
||||
jQuery( document ).on( 'click', '.notice-dismiss', function() {
|
||||
var notice_name = jQuery(this).closest('div.notice').data('notice-name');
|
||||
var source = jQuery(this).closest('div.notice').data('source');
|
||||
if ('' !== notice_name) {
|
||||
jQuery.ajax({
|
||||
url: ajaxurl,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'wpdesk_notice_dismiss',
|
||||
notice_name: notice_name,
|
||||
source: source,
|
||||
},
|
||||
success: function (response) {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
jQuery( document ).on( 'click', '.notice-dismiss-link', function() {
|
||||
jQuery(this).closest('div.notice').data('source',jQuery(this).data('source'));
|
||||
jQuery(this).closest('div.notice').find('.notice-dismiss').click();
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
jQuery(document).on("click",".notice-dismiss",function(){var a=jQuery(this).closest("div.notice").data("notice-name");var b=jQuery(this).closest("div.notice").data("source");if(""!==a){jQuery.ajax({url:ajaxurl,type:"post",data:{action:"wpdesk_notice_dismiss",notice_name:a,source:b},success:function(c){}})}});jQuery(document).on("click",".notice-dismiss-link",function(){jQuery(this).closest("div.notice").data("source",jQuery(this).data("source"));jQuery(this).closest("div.notice").find(".notice-dismiss").click()});
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "wpdesk\/wp-notice",
|
||||
"description": "Library for displaying Wordpress notices.",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"wordpress",
|
||||
"notice",
|
||||
"admin"
|
||||
],
|
||||
"homepage": "https:\/\/gitlab.com\/wpdesk\/wp-notice",
|
||||
"minimum-stability": "stable",
|
||||
"authors": [
|
||||
{
|
||||
"name": "grola",
|
||||
"email": "grola@wpdesk.net"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.0"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5",
|
||||
"wpdesk\/wp-builder": "^1.0|^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "<7",
|
||||
"wp-coding-standards\/wpcs": "^0.14.1",
|
||||
"squizlabs\/php_codesniffer": "^3.0.2",
|
||||
"mockery\/mockery": "*",
|
||||
"10up\/wp_mock": "*",
|
||||
"wimg\/php-compatibility": "^8"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"FcfVendor\\WPDesk\\Notice\\": "src\/WPDesk\/Notice\/"
|
||||
},
|
||||
"files": [
|
||||
"src\/WPDesk\/notice-functions.php"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {},
|
||||
"scripts": {
|
||||
"phpcs": "phpcs",
|
||||
"phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never",
|
||||
"phpunit-unit-fast": "phpunit --configuration phpunit-unit.xml --no-coverage",
|
||||
"phpunit-integration": "phpunit --configuration phpunit-integration.xml --coverage-text --colors=never",
|
||||
"phpunit-integration-fast": "phpunit --configuration phpunit-integration.xml --no-coverage"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace FcfVendor;
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
if (!\class_exists('FcfVendor\\WPDesk\\Notice\\AjaxHandler')) {
|
||||
require_once __DIR__ . '/src/WPDesk/Notice/AjaxHandler.php';
|
||||
}
|
||||
if (!\class_exists('FcfVendor\\WPDesk\\Notice\\Notice')) {
|
||||
require_once __DIR__ . 'src/WPDesk/Notice/Notice.php';
|
||||
}
|
||||
if (!\class_exists('FcfVendor\\WPDesk\\Notice\\PermanentDismissibleNotice')) {
|
||||
require_once __DIR__ . '/src/WPDesk/Notice/PermanentDismissibleNotice.php';
|
||||
}
|
||||
if (!\class_exists('FcfVendor\\WPDesk\\Notice\\Factory')) {
|
||||
require_once __DIR__ . '/src/WPDesk/Notice/Factory.php';
|
||||
}
|
||||
require_once __DIR__ . '/src/WPDesk/notice-functions.php';
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace FcfVendor\WPDesk\Notice;
|
||||
|
||||
use FcfVendor\WPDesk\PluginBuilder\Plugin\HookablePluginDependant;
|
||||
use FcfVendor\WPDesk\PluginBuilder\Plugin\PluginAccess;
|
||||
/**
|
||||
* Class AjaxHandler
|
||||
*
|
||||
* AjaxHandler for dismissible notices.
|
||||
*
|
||||
* @package WPDesk\Notice
|
||||
*/
|
||||
class AjaxHandler implements \FcfVendor\WPDesk\PluginBuilder\Plugin\HookablePluginDependant
|
||||
{
|
||||
use PluginAccess;
|
||||
const POST_FIELD_NOTICE_NAME = 'notice_name';
|
||||
const POST_FIELD_SOURCE = 'source';
|
||||
const SCRIPTS_VERSION = '4';
|
||||
const SCRIPT_HANDLE = 'wpdesk_notice';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $assetsURL;
|
||||
/**
|
||||
* AjaxHandler constructor.
|
||||
*
|
||||
* @param string|null $assetsURL Assets URL.
|
||||
*/
|
||||
public function __construct($assetsURL = null)
|
||||
{
|
||||
$this->assetsURL = $assetsURL;
|
||||
}
|
||||
/**
|
||||
* Hooks.
|
||||
*/
|
||||
public function hooks()
|
||||
{
|
||||
if ($this->assetsURL) {
|
||||
\add_action('admin_enqueue_scripts', [$this, 'enqueueAdminScripts']);
|
||||
} else {
|
||||
\add_action('admin_head', [$this, 'addScriptToAdminHead']);
|
||||
}
|
||||
\add_action('wp_ajax_wpdesk_notice_dismiss', [$this, 'processAjaxNoticeDismiss']);
|
||||
}
|
||||
/**
|
||||
* Enqueue admin scripts.
|
||||
*/
|
||||
public function enqueueAdminScripts()
|
||||
{
|
||||
$suffix = \defined('SCRIPT_DEBUG') && \SCRIPT_DEBUG ? '' : '.min';
|
||||
\wp_register_script(self::SCRIPT_HANDLE, \trailingslashit($this->assetsURL) . 'js/notice' . $suffix . '.js', array('jquery'), self::SCRIPTS_VERSION);
|
||||
\wp_enqueue_script(self::SCRIPT_HANDLE);
|
||||
}
|
||||
/**
|
||||
* Add Java Script to admin header.
|
||||
*/
|
||||
public function addScriptToAdminHead()
|
||||
{
|
||||
include __DIR__ . '/views/admin-head-js.php';
|
||||
}
|
||||
/**
|
||||
* Process AJAX notice dismiss.
|
||||
*
|
||||
* Updates corresponded WordPress option and fires wpdesk_notice_dismissed_notice action with notice name.
|
||||
*/
|
||||
public function processAjaxNoticeDismiss()
|
||||
{
|
||||
if (isset($_POST[self::POST_FIELD_NOTICE_NAME])) {
|
||||
$noticeName = \sanitize_text_field($_POST[self::POST_FIELD_NOTICE_NAME]);
|
||||
if (isset($_POST[self::POST_FIELD_SOURCE])) {
|
||||
$source = \sanitize_text_field($_POST[self::POST_FIELD_SOURCE]);
|
||||
} else {
|
||||
$source = null;
|
||||
}
|
||||
\update_option(\FcfVendor\WPDesk\Notice\PermanentDismissibleNotice::OPTION_NAME_PREFIX . $noticeName, \FcfVendor\WPDesk\Notice\PermanentDismissibleNotice::OPTION_VALUE_DISMISSED);
|
||||
\do_action('wpdesk_notice_dismissed_notice', $noticeName, $source);
|
||||
}
|
||||
if (\defined('DOING_AJAX') && \DOING_AJAX) {
|
||||
die;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace FcfVendor\WPDesk\Notice;
|
||||
|
||||
/**
|
||||
* Class Factory
|
||||
*
|
||||
* Factory for notices.
|
||||
* @package WPDesk\Notice
|
||||
*/
|
||||
class Factory
|
||||
{
|
||||
/**
|
||||
* Creates Notice object.
|
||||
*
|
||||
* @param string $noticeType Notice type.
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param bool $isDismissible Is dismissible.
|
||||
* @param int $priority Priority.
|
||||
*
|
||||
* @return Notice
|
||||
*/
|
||||
public static function notice($noticeContent = '', $noticeType = 'info', $isDismissible = \false, $priority = 10)
|
||||
{
|
||||
return new \FcfVendor\WPDesk\Notice\Notice($noticeContent, $noticeType, $isDismissible, $priority);
|
||||
}
|
||||
/**
|
||||
* Creates PermanentDismissibleNotice object.
|
||||
*
|
||||
* @param string $noticeContent
|
||||
* @param string $noticeType
|
||||
* @param string $noticeName
|
||||
* @param int $priority
|
||||
*
|
||||
* @return PermanentDismissibleNotice
|
||||
*/
|
||||
public static function permanentDismissibleNotice($noticeContent = '', $noticeName = '', $noticeType = '', $priority = 10)
|
||||
{
|
||||
return new \FcfVendor\WPDesk\Notice\PermanentDismissibleNotice($noticeContent, $noticeName, $noticeType, $priority);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
|
||||
namespace FcfVendor\WPDesk\Notice;
|
||||
|
||||
/**
|
||||
* Class Notice
|
||||
*
|
||||
* WordPress admin notice.
|
||||
* @package WPDesk\Notice
|
||||
*/
|
||||
class Notice
|
||||
{
|
||||
const NOTICE_TYPE_ERROR = 'error';
|
||||
const NOTICE_TYPE_WARNING = 'warning';
|
||||
const NOTICE_TYPE_SUCCESS = 'success';
|
||||
const NOTICE_TYPE_INFO = 'info';
|
||||
const ADMIN_FOOTER_BASE_PRIORITY = 9999999;
|
||||
/**
|
||||
* Notice type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $noticeType;
|
||||
/**
|
||||
* Notice content.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $noticeContent;
|
||||
/**
|
||||
* Is dismissible.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $dismissible;
|
||||
/**
|
||||
* Notice hook priority.
|
||||
* @var int;
|
||||
*/
|
||||
protected $priority;
|
||||
/**
|
||||
* Is action added?
|
||||
* @var bool
|
||||
*/
|
||||
private $actionAdded = \false;
|
||||
/**
|
||||
* Attributes.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $attributes = array();
|
||||
/**
|
||||
* Show notice in gutenberg editor.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $showInGutenberg = \false;
|
||||
/**
|
||||
* WPDesk_Flexible_Shipping_Notice constructor.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param string $noticeType Notice type.
|
||||
* @param bool $dismissible Is dismissible.
|
||||
* @param int $priority Notice priority.
|
||||
* @param array $attributes Attributes.
|
||||
* @param bool $showInGutenberg Show notice in gutenberg editor.
|
||||
*/
|
||||
public function __construct($noticeContent, $noticeType = 'info', $dismissible = \false, $priority = 10, $attributes = array(), $showInGutenberg = \false)
|
||||
{
|
||||
$this->noticeContent = $noticeContent;
|
||||
$this->noticeType = $noticeType;
|
||||
$this->dismissible = $dismissible;
|
||||
$this->priority = $priority;
|
||||
$this->attributes = $attributes;
|
||||
$this->showInGutenberg = $showInGutenberg;
|
||||
$this->addAction();
|
||||
}
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isBlockEditor()
|
||||
{
|
||||
if (!\function_exists('get_current_screen')) {
|
||||
require_once \ABSPATH . '/wp-admin/includes/screen.php';
|
||||
}
|
||||
return \get_current_screen()->is_block_editor();
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNoticeContent()
|
||||
{
|
||||
return $this->noticeContent;
|
||||
}
|
||||
/**
|
||||
* @param string $noticeContent
|
||||
*/
|
||||
public function setNoticeContent($noticeContent)
|
||||
{
|
||||
$this->noticeContent = $noticeContent;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNoticeType()
|
||||
{
|
||||
return $this->noticeType;
|
||||
}
|
||||
/**
|
||||
* @param string $noticeType
|
||||
*/
|
||||
public function setNoticeType($noticeType)
|
||||
{
|
||||
$this->noticeType = $noticeType;
|
||||
}
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDismissible()
|
||||
{
|
||||
return $this->dismissible;
|
||||
}
|
||||
/**
|
||||
* @param bool $dismissible
|
||||
*/
|
||||
public function setDismissible($dismissible)
|
||||
{
|
||||
$this->dismissible = $dismissible;
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPriority()
|
||||
{
|
||||
return $this->priority;
|
||||
}
|
||||
/**
|
||||
* @param int $priority
|
||||
*/
|
||||
public function setPriority($priority)
|
||||
{
|
||||
$this->priority = $priority;
|
||||
if ($this->actionAdded) {
|
||||
$this->removeAction();
|
||||
$this->addAction();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add notice action.
|
||||
*/
|
||||
protected function addAction()
|
||||
{
|
||||
if (!$this->actionAdded) {
|
||||
\add_action('admin_notices', [$this, 'showNotice'], $this->priority);
|
||||
\add_action('admin_footer', [$this, 'showNotice'], self::ADMIN_FOOTER_BASE_PRIORITY + \intval($this->priority));
|
||||
\add_action('admin_head', [$this, 'addGutenbergScript']);
|
||||
$this->actionAdded = \true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Remove action.
|
||||
*/
|
||||
protected function removeAction()
|
||||
{
|
||||
if ($this->actionAdded) {
|
||||
\remove_action('admin_notices', [$this, 'showNotice'], $this->priority);
|
||||
\remove_action('admin_footer', [$this, 'showNotice'], self::ADMIN_FOOTER_BASE_PRIORITY + \intval($this->priority));
|
||||
$this->actionAdded = \false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Enqueue admin scripts.
|
||||
*/
|
||||
public function addGutenbergScript()
|
||||
{
|
||||
if ($this->isBlockEditor()) {
|
||||
include_once __DIR__ . '/views/admin-head-js-gutenberg.php';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add attribute.
|
||||
*
|
||||
* @param string $name Name
|
||||
* @param string $value Value.
|
||||
*/
|
||||
public function addAttribute($name, $value)
|
||||
{
|
||||
$this->attributes[$name] = $value;
|
||||
}
|
||||
/**
|
||||
* Get notice class.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getNoticeClass()
|
||||
{
|
||||
$notice_classes = ['notice'];
|
||||
if ('updated' === $this->noticeType) {
|
||||
$notice_classes[] = $this->noticeType;
|
||||
} else {
|
||||
$notice_classes[] = 'notice-' . $this->noticeType;
|
||||
}
|
||||
if ($this->dismissible) {
|
||||
$notice_classes[] = 'is-dismissible';
|
||||
}
|
||||
if (isset($this->attributes['class'])) {
|
||||
$notice_classes[] = $this->attributes['class'];
|
||||
}
|
||||
if ($this->showInGutenberg) {
|
||||
$notice_classes[] = 'wpdesk-notice-gutenberg';
|
||||
}
|
||||
return \implode(' ', $notice_classes);
|
||||
}
|
||||
/**
|
||||
* Get attributes as string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getAttributesAsString()
|
||||
{
|
||||
$attribute_string = \sprintf('class="%1$s"', \esc_attr($this->getNoticeClass()));
|
||||
foreach ($this->attributes as $attribute_name => $attribute_value) {
|
||||
if ('class' !== $attribute_name) {
|
||||
$attribute_string .= \sprintf(' %1$s="%2$s"', \esc_html($attribute_name), \esc_attr($attribute_value));
|
||||
}
|
||||
}
|
||||
return $attribute_string;
|
||||
}
|
||||
private function addParagraphToContent()
|
||||
{
|
||||
if (0 === \strpos($this->noticeContent, '<p>')) {
|
||||
return \false;
|
||||
}
|
||||
if (0 === \strpos($this->noticeContent, '<div>') || 0 === \strpos($this->noticeContent, '<div ')) {
|
||||
return \false;
|
||||
}
|
||||
return \true;
|
||||
}
|
||||
/**
|
||||
* Show notice;
|
||||
*/
|
||||
public function showNotice()
|
||||
{
|
||||
$this->removeAction();
|
||||
$noticeFormat = '<div %1$s>%2$s</div>';
|
||||
if ($this->addParagraphToContent()) {
|
||||
$noticeFormat = '<div %1$s><p>%2$s</p></div>';
|
||||
}
|
||||
echo \sprintf($noticeFormat, $this->getAttributesAsString(), $this->noticeContent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace FcfVendor\WPDesk\Notice;
|
||||
|
||||
/**
|
||||
* Class PermanentDismissibleNotice
|
||||
*
|
||||
* WordPress admin dismissible notice.
|
||||
* @package WPDesk\Notice
|
||||
*/
|
||||
class PermanentDismissibleNotice extends \FcfVendor\WPDesk\Notice\Notice
|
||||
{
|
||||
const OPTION_NAME_PREFIX = 'wpdesk_notice_dismiss_';
|
||||
const OPTION_VALUE_DISMISSED = '1';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $noticeName;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $noticeDismissOptionName;
|
||||
/**
|
||||
* WPDesk_Flexible_Shipping_Notice constructor.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param string $noticeName Notice dismiss option name.
|
||||
* @param string $noticeType Notice type.
|
||||
* @param int $priority Priority
|
||||
* @param array $attributes Attributes.
|
||||
* @param bool $showInGutenberg Show notice in gutenberg editor.
|
||||
*/
|
||||
public function __construct($noticeContent, $noticeName, $noticeType = 'info', $priority = 10, $attributes = array(), $showInGutenberg = \false)
|
||||
{
|
||||
parent::__construct($noticeContent, $noticeType, \true, $priority, $attributes, $showInGutenberg);
|
||||
$this->noticeName = $noticeName;
|
||||
$this->noticeDismissOptionName = static::OPTION_NAME_PREFIX . $noticeName;
|
||||
if (self::OPTION_VALUE_DISMISSED === \get_option($this->noticeDismissOptionName, '')) {
|
||||
$this->removeAction();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Undo dismiss notice.
|
||||
*/
|
||||
public function undoDismiss()
|
||||
{
|
||||
\delete_option($this->noticeDismissOptionName);
|
||||
$this->addAction();
|
||||
}
|
||||
/**
|
||||
* Get attributes as string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getAttributesAsString()
|
||||
{
|
||||
$attributesAsString = parent::getAttributesAsString();
|
||||
$attributesAsString .= \sprintf(' data-notice-name="%1$s"', \esc_attr($this->noticeName));
|
||||
$attributesAsString .= \sprintf(' id="wpdesk-notice-%1$s"', \esc_attr($this->noticeName));
|
||||
return $attributesAsString;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace FcfVendor;
|
||||
|
||||
if (!\defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
// Exit if accessed directly
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
include \dirname(__FILE__) . '/../../../../assets/js/gutenberg.js';
|
||||
?>
|
||||
</script>
|
||||
<?php
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace FcfVendor;
|
||||
|
||||
if (!\defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
// Exit if accessed directly
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
include \dirname(__FILE__) . '/../../../../assets/js/notice.min.js';
|
||||
?>
|
||||
</script>
|
||||
<?php
|
||||
@@ -0,0 +1,228 @@
|
||||
<?php
|
||||
|
||||
namespace FcfVendor;
|
||||
|
||||
if (!\function_exists('FcfVendor\\WPDeskInitWpNoticeAjaxHandler')) {
|
||||
/**
|
||||
* Init notices AJAX Handler.
|
||||
*
|
||||
* @param string|null $assetsUrl
|
||||
*
|
||||
* @return \WPDesk\Notice\AjaxHandler
|
||||
*/
|
||||
function WPDeskInitWpNoticeAjaxHandler($assetsUrl = null)
|
||||
{
|
||||
$ajax_handler = new \FcfVendor\WPDesk\Notice\AjaxHandler($assetsUrl);
|
||||
$ajax_handler->hooks();
|
||||
return $ajax_handler;
|
||||
}
|
||||
}
|
||||
if (!\function_exists('FcfVendor\\wpdesk_init_wp_notice_ajax_handler')) {
|
||||
/**
|
||||
* Alias for {@see WPDeskInitNoticeAjaxHandler()} function.
|
||||
*
|
||||
* @param null $assetsUrl
|
||||
*
|
||||
* @return \WPDesk\Notice\AjaxHandler
|
||||
*/
|
||||
function wpdesk_init_wp_notice_ajax_handler($assetsUrl = null)
|
||||
{
|
||||
return \FcfVendor\WPDeskInitWpNoticeAjaxHandler($assetsUrl);
|
||||
}
|
||||
}
|
||||
if (!\function_exists('FcfVendor\\WPDeskWpNotice')) {
|
||||
/**
|
||||
* Creates Notice.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param string $noticeType Notice type.
|
||||
* @param bool $dismissible Dismissible notice.
|
||||
* @param int $priority Notice priority,
|
||||
*
|
||||
* @return \WPDesk\Notice\Notice
|
||||
*/
|
||||
function WPDeskWpNotice($noticeContent, $noticeType = 'info', $dismissible = \false, $priority = 10)
|
||||
{
|
||||
return \FcfVendor\WPDesk\Notice\Factory::notice($noticeContent, $noticeType, $dismissible, $priority);
|
||||
}
|
||||
}
|
||||
if (!\function_exists('FcfVendor\\wpdesk_wp_notice')) {
|
||||
/**
|
||||
* Creates Notice.
|
||||
*
|
||||
* Alias for {@see WPDeskNotice()} function.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param string $noticeType Notice type.
|
||||
* @param bool $dismissible Dismissible notice.
|
||||
* @param int $priority Notice priority,
|
||||
*
|
||||
* @return \WPDesk\Notice\Notice
|
||||
*/
|
||||
function wpdesk_wp_notice($noticeContent, $noticeType = 'info', $dismissible = \false, $priority = 10)
|
||||
{
|
||||
return \FcfVendor\WPDeskWpNotice($noticeContent, $noticeType, $dismissible, $priority);
|
||||
}
|
||||
}
|
||||
if (!\function_exists('FcfVendor\\WPDeskWpNoticeInfo')) {
|
||||
/**
|
||||
* Creates Notice Info.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param bool $dismissible Dismissible notice.
|
||||
* @param int $priority Notice priority,
|
||||
*
|
||||
* @return \WPDesk\Notice\Notice
|
||||
*/
|
||||
function WPDeskWpNoticeInfo($noticeContent, $dismissible = \false, $priority = 10)
|
||||
{
|
||||
return \FcfVendor\WPDesk\Notice\Factory::notice($noticeContent, \FcfVendor\WPDesk\Notice\Notice::NOTICE_TYPE_INFO, $dismissible, $priority);
|
||||
}
|
||||
}
|
||||
if (!\function_exists('FcfVendor\\wpdesk_wp_notice_info')) {
|
||||
/**
|
||||
* Creates Notice Info.
|
||||
*
|
||||
* Alias for {@see WPDeskNoticeInfo()} function.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param bool $dismissible Dismissible notice.
|
||||
* @param int $priority Notice priority,
|
||||
*
|
||||
* @return \WPDesk\Notice\Notice
|
||||
*/
|
||||
function wpdesk_wp_notice_info($noticeContent, $dismissible = \false, $priority = 10)
|
||||
{
|
||||
return \FcfVendor\WPDeskWpNoticeInfo($noticeContent, $dismissible, $priority);
|
||||
}
|
||||
}
|
||||
if (!\function_exists('FcfVendor\\WPDeskWpNoticeError')) {
|
||||
/**
|
||||
* Creates Notice Error.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param bool $dismissible Dismissible notice.
|
||||
* @param int $priority Notice priority,
|
||||
*
|
||||
* @return \WPDesk\Notice\Notice
|
||||
*/
|
||||
function WPDeskWpNoticeError($noticeContent, $dismissible = \false, $priority = 10)
|
||||
{
|
||||
return \FcfVendor\WPDesk\Notice\Factory::notice($noticeContent, \FcfVendor\WPDesk\Notice\Notice::NOTICE_TYPE_ERROR, $dismissible, $priority);
|
||||
}
|
||||
}
|
||||
if (!\function_exists('FcfVendor\\wpdesk_wp_notice_error')) {
|
||||
/**
|
||||
* Creates Notice Error.
|
||||
*
|
||||
* Alias for {@see WPDeskNoticeError()} function.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param bool $dismissible Dismissible notice.
|
||||
* @param int $priority Notice priority,
|
||||
*
|
||||
* @return \WPDesk\Notice\Notice
|
||||
*/
|
||||
function wpdesk_wp_notice_error($noticeContent, $dismissible = \false, $priority = 10)
|
||||
{
|
||||
return \FcfVendor\WPDeskWpNoticeError($noticeContent, $dismissible, $priority);
|
||||
}
|
||||
}
|
||||
if (!\function_exists('FcfVendor\\WPDeskWpNoticeWarning')) {
|
||||
/**
|
||||
* Creates Notice Warning.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param bool $dismissible Dismissible notice.
|
||||
* @param int $priority Notice priority,
|
||||
*
|
||||
* @return \WPDesk\Notice\Notice
|
||||
*/
|
||||
function WPDeskWpNoticeWarning($noticeContent, $dismissible = \false, $priority = 10)
|
||||
{
|
||||
return \FcfVendor\WPDesk\Notice\Factory::notice($noticeContent, \FcfVendor\WPDesk\Notice\Notice::NOTICE_TYPE_WARNING, $dismissible, $priority);
|
||||
}
|
||||
}
|
||||
if (!\function_exists('FcfVendor\\wpdesk_wp_notice_warning')) {
|
||||
/**
|
||||
* Creates Notice Warning.
|
||||
*
|
||||
* Alias for {@see WPDeskNoticeWarning()} function.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param bool $dismissible Dismissible notice.
|
||||
* @param int $priority Notice priority,
|
||||
*
|
||||
* @return \WPDesk\Notice\Notice
|
||||
*/
|
||||
function wpdesk_wp_notice_warning($noticeContent, $dismissible = \false, $priority = 10)
|
||||
{
|
||||
return \FcfVendor\WPDeskWpNoticeWarning($noticeContent, $dismissible, $priority);
|
||||
}
|
||||
}
|
||||
if (!\function_exists('FcfVendor\\WPDeskWpNoticeSuccess')) {
|
||||
/**
|
||||
* Creates Notice Success.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param bool $dismissible Dismissible notice.
|
||||
* @param int $priority Notice priority,
|
||||
*
|
||||
* @return \WPDesk\Notice\Notice
|
||||
*/
|
||||
function WPDeskWpNoticeSuccess($noticeContent, $dismissible = \false, $priority = 10)
|
||||
{
|
||||
return \FcfVendor\WPDesk\Notice\Factory::notice($noticeContent, \FcfVendor\WPDesk\Notice\Notice::NOTICE_TYPE_SUCCESS, $dismissible, $priority);
|
||||
}
|
||||
}
|
||||
if (!\function_exists('FcfVendor\\wpdesk_wp_notice_success')) {
|
||||
/**
|
||||
* Creates Notice Success.
|
||||
*
|
||||
* Alias for {@see WPDeskNoticeSuccess()} function.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param bool $dismissible Dismissible notice.
|
||||
* @param int $priority Notice priority,
|
||||
*
|
||||
* @return \WPDesk\Notice\Notice
|
||||
*/
|
||||
function wpdesk_wp_notice_success($noticeContent, $dismissible = \false, $priority = 10)
|
||||
{
|
||||
return \FcfVendor\WPDeskWpNoticeSuccess($noticeContent, $dismissible, $priority);
|
||||
}
|
||||
}
|
||||
if (!\function_exists('FcfVendor\\WPDeskPermanentDismissibleWpNotice')) {
|
||||
/**
|
||||
* Creates Permanent Dismissible Notice.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param string $noticeType Notice type.
|
||||
* @param string $noticeName Notice name.
|
||||
* @param int $priority Notice priority.
|
||||
*
|
||||
* @return \WPDesk\Notice\Notice
|
||||
*/
|
||||
function WPDeskPermanentDismissibleWpNotice($noticeContent, $noticeName, $noticeType = 'info', $priority = 10)
|
||||
{
|
||||
return \FcfVendor\WPDesk\Notice\Factory::permanentDismissibleNotice($noticeContent, $noticeName, $noticeType, $priority);
|
||||
}
|
||||
}
|
||||
if (!\function_exists('FcfVendor\\wpdesk_permanent_dismissible_wp_notice')) {
|
||||
/**
|
||||
* Creates Permanent Dismissible Notice.
|
||||
*
|
||||
* Alias for {@see WPDeskPermanentDismissibleNotice()} function.
|
||||
*
|
||||
* @param string $noticeContent Notice content.
|
||||
* @param string $noticeName Notice name.
|
||||
* @param string $noticeType Notice type.
|
||||
* @param int $priority Notice priority.
|
||||
*
|
||||
* @return \WPDesk\Notice\Notice
|
||||
*/
|
||||
function wpdesk_permanent_dismissible_wp_notice($noticeContent, $noticeName, $noticeType = 'info', $priority = 10)
|
||||
{
|
||||
return \FcfVendor\WPDeskPermanentDismissibleWpNotice($noticeContent, $noticeName, $noticeType, $priority);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user