updated plugin Menu Icons version 0.12.12

This commit is contained in:
2022-08-19 16:16:06 +00:00
committed by Gitium
parent 8384403af1
commit 3ebf964f56
17 changed files with 104 additions and 100 deletions

View File

@ -11,7 +11,7 @@
* Plugin name: Menu Icons
* Plugin URI: https://github.com/Codeinwp/wp-menu-icons
* Description: Spice up your navigation menus with pretty icons, easily.
* Version: 0.12.11
* Version: 0.12.12
* Author: ThemeIsle
* Author URI: https://themeisle.com
* License: GPLv2
@ -29,7 +29,7 @@ final class Menu_Icons {
const DISMISS_NOTICE = 'menu-icons-dismiss-notice';
const VERSION = '0.12.11';
const VERSION = '0.12.12';
/**
* Holds plugin data
@ -100,7 +100,7 @@ final class Menu_Icons {
add_action( 'admin_enqueue_scripts', array( __CLASS__, '_admin_enqueue_scripts' ) );
add_action( 'wp_dashboard_setup', array( __CLASS__, '_wp_menu_icons_dashboard_notice' ) );
add_action( 'wp_ajax_wp_menu_icons_dismiss_dashboard_notice', array( __CLASS__, 'wp_menu_icons_dismiss_dashboard_notice' ) );
add_action( 'admin_action_menu_icon_hide_notice', array( __CLASS__, 'wp_menu_icons_dismiss_dashboard_notice' ) );
}
@ -172,35 +172,12 @@ final class Menu_Icons {
$url = self::get( 'url' );
$suffix = kucrut_get_script_suffix();
if ( defined( 'MENU_ICONS_SCRIPT_DEBUG' ) && MENU_ICONS_SCRIPT_DEBUG ) {
$script_url = '//localhost:8081/';
} else {
$script_url = $url;
}
wp_register_style(
'menu-icons-dashboard',
"{$url}css/dashboard-notice{$suffix}.css",
false,
self::VERSION
);
wp_register_script(
'menu-icons-dashboard',
"{$script_url}js/dashboard-notice{$suffix}.js",
array( 'jquery' ),
self::VERSION,
true
);
wp_localize_script(
'menu-icons-dashboard',
'menuIcons',
array(
'ajaxUrls' => admin_url( 'admin-ajax.php' ),
'_nonce' => wp_create_nonce( self::DISMISS_NOTICE ),
)
);
}
/**
@ -218,17 +195,15 @@ final class Menu_Icons {
* Ajax request handle for dissmiss dashboard notice.
*/
public static function wp_menu_icons_dismiss_dashboard_notice() {
check_ajax_referer( self::DISMISS_NOTICE, '_nonce' );
// Verify WP nonce and store hide notice flag.
if ( isset( $_GET['_wp_notice_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wp_notice_nonce'] ) ), self::DISMISS_NOTICE ) ) {
set_transient( self::DISMISS_NOTICE, 1, 365 * DAY_IN_SECONDS );
}
$dismiss = ! empty( $_POST['dismiss'] ) ? intval( $_POST['dismiss'] ) : 0;
set_transient( self::DISMISS_NOTICE, $dismiss, 365 * DAY_IN_SECONDS );
wp_send_json_success(
array(
'status' => 0,
)
);
die();
if ( ! headers_sent() ) {
wp_safe_redirect( admin_url() );
exit;
}
}
/**
@ -241,11 +216,20 @@ final class Menu_Icons {
),
admin_url( 'theme-install.php' )
);
$action_url = add_query_arg(
array(
'action' => 'menu_icon_hide_notice',
'_wp_notice_nonce' => wp_create_nonce( self::DISMISS_NOTICE ),
),
admin_url( 'index.php' )
);
?>
<div class="notice notice-info is-dismissible menu-icon-dashboard-notice">
<div class="notice notice-info menu-icon-dashboard-notice">
<h2><?php esc_html_e( 'Thank you for installing Menu Icons!', 'menu-icons' ); ?></h2>
<p><?php esc_html_e( 'Have you heard about our latest FREE theme - Neve? Using a mobile-first approach, compatibility with AMP and popular page-builders, Neve makes website building accessible for everyone.', 'menu-icons' ); ?></p>
<a href="<?php echo esc_url( $neve_theme_url ); ?>" class="button button-primary button-large"><?php esc_html_e( 'Preview Neve', 'menu-icons' ); ?></a>
<a href="<?php echo esc_url( $action_url ); ?>" class="notice-dismiss"></a>
</div>
<?php
}