From 3ebf964f56fc8144f1cdf828f7aa273cfe6d5a7d Mon Sep 17 00:00:00 2001 From: Lai Power Date: Fri, 19 Aug 2022 16:16:06 +0000 Subject: [PATCH] updated plugin `Menu Icons` version 0.12.12 --- wp-content/plugins/menu-icons/CHANGELOG.md | 6 ++ .../menu-icons/css/dashboard-notice.css | 4 ++ .../menu-icons/css/dashboard-notice.min.css | 2 +- .../plugins/menu-icons/includes/front.php | 36 +++++++++++- .../plugins/menu-icons/js/dashboard-notice.js | 12 ---- .../menu-icons/js/dashboard-notice.min.js | 1 - wp-content/plugins/menu-icons/menu-icons.php | 58 +++++++------------ wp-content/plugins/menu-icons/readme.txt | 11 +++- .../plugins/menu-icons/vendor/autoload.php | 7 ++- .../vendor/composer/InstalledVersions.php | 2 + .../vendor/composer/autoload_classmap.php | 2 +- .../vendor/composer/autoload_files.php | 2 +- .../vendor/composer/autoload_namespaces.php | 2 +- .../vendor/composer/autoload_psr4.php | 2 +- .../vendor/composer/autoload_real.php | 41 +++---------- .../vendor/composer/autoload_static.php | 4 +- .../menu-icons/vendor/composer/installed.php | 12 ++-- 17 files changed, 104 insertions(+), 100 deletions(-) delete mode 100644 wp-content/plugins/menu-icons/js/dashboard-notice.js delete mode 100644 wp-content/plugins/menu-icons/js/dashboard-notice.min.js diff --git a/wp-content/plugins/menu-icons/CHANGELOG.md b/wp-content/plugins/menu-icons/CHANGELOG.md index a3d9dc53..9cb33726 100644 --- a/wp-content/plugins/menu-icons/CHANGELOG.md +++ b/wp-content/plugins/menu-icons/CHANGELOG.md @@ -1,3 +1,9 @@ +##### [Version 0.12.12](https://github.com/codeinwp/wp-menu-icons/compare/v0.12.11...v0.12.12) (2022-05-27) + +- Fix the style handler conflict issue which breaks the arrow icon of the submenus on some themes +- Fix dismiss dashboard notice issue on some edge cases +- Fix compatibility with the Max Mega Menu plugin + ##### [Version 0.12.11](https://github.com/codeinwp/wp-menu-icons/compare/v0.12.10...v0.12.11) (2022-03-16) Add font awesome 5 support diff --git a/wp-content/plugins/menu-icons/css/dashboard-notice.css b/wp-content/plugins/menu-icons/css/dashboard-notice.css index 3217bfed..da1c6c2b 100644 --- a/wp-content/plugins/menu-icons/css/dashboard-notice.css +++ b/wp-content/plugins/menu-icons/css/dashboard-notice.css @@ -1,4 +1,5 @@ .menu-icon-dashboard-notice { + position: relative; background: #FFFFFF; border: 1px solid #E1E1E1; box-sizing: border-box; @@ -38,3 +39,6 @@ font-size: 13px; line-height: 1.5; } +.menu-icon-dashboard-notice .notice-dismiss { + text-decoration: none; +} \ No newline at end of file diff --git a/wp-content/plugins/menu-icons/css/dashboard-notice.min.css b/wp-content/plugins/menu-icons/css/dashboard-notice.min.css index 386af28b..cc3d61b8 100644 --- a/wp-content/plugins/menu-icons/css/dashboard-notice.min.css +++ b/wp-content/plugins/menu-icons/css/dashboard-notice.min.css @@ -1 +1 @@ -.menu-icon-dashboard-notice{background:#fff;border:1px solid #e1e1e1;box-sizing:border-box;padding:24px;border-left:4px solid #72aee6;margin:0 0 30px}.menu-icon-dashboard-notice h2{padding:0;margin:0 0 8px;font-weight:700;font-size:18px;line-height:1.2;color:#000}.menu-icon-dashboard-notice p{font-size:12px;line-height:1.2;color:#000;display:block;margin-bottom:16px}.menu-icon-dashboard-notice .button{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:5px 12px;background:#0071ae;border-radius:4px;width:105px;height:30px;color:#fff;font-size:13px;line-height:1.5} \ No newline at end of file +.menu-icon-dashboard-notice{position:relative;background:#fff;border:1px solid #e1e1e1;box-sizing:border-box;padding:24px;border-left:4px solid #72aee6;margin:0 0 30px}.menu-icon-dashboard-notice h2{padding:0;margin:0 0 8px;font-weight:700;font-size:18px;line-height:1.2;color:#000}.menu-icon-dashboard-notice p{font-size:12px;line-height:1.2;color:#000;display:block;margin-bottom:16px}.menu-icon-dashboard-notice .button{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:5px 12px;background:#0071ae;border-radius:4px;width:105px;height:30px;color:#fff;font-size:13px;line-height:1.5}.menu-icon-dashboard-notice .notice-dismiss{text-decoration:none} \ No newline at end of file diff --git a/wp-content/plugins/menu-icons/includes/front.php b/wp-content/plugins/menu-icons/includes/front.php index 24218dd8..64bcc71a 100644 --- a/wp-content/plugins/menu-icons/includes/front.php +++ b/wp-content/plugins/menu-icons/includes/front.php @@ -141,9 +141,23 @@ final class Menu_Icons_Front_End { * @link http://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts */ public static function _enqueue_styles() { + // Deregister icon picker plugin font-awesome style and re-register with the new handler to avoid other plugin/theme style handler conflict. + $wp_styles = wp_styles(); + if ( $wp_styles && isset( $wp_styles->registered['font-awesome'] ) ) { + $registered = $wp_styles->registered['font-awesome']; + if ( strpos( $registered->src, Menu_Icons::get( 'url' ) ) !== false ) { + $wp_styles->remove( 'font-awesome' ); + $wp_styles->add( 'menu-icon-' . $registered->handle, $registered->src, $registered->deps, $registered->ver, $registered->args ); + } + } + foreach ( self::$icon_types as $type ) { - if ( wp_style_is( $type->stylesheet_id, 'registered' ) ) { - wp_enqueue_style( $type->stylesheet_id ); + $stylesheet_id = $type->stylesheet_id; + if ( 'font-awesome' === $stylesheet_id ) { + $stylesheet_id = 'menu-icon-' . $stylesheet_id; + } + if ( wp_style_is( $stylesheet_id, 'registered' ) ) { + wp_enqueue_style( $stylesheet_id ); } } @@ -181,6 +195,8 @@ final class Menu_Icons_Front_End { */ public static function _add_menu_item_title_filter( $args ) { add_filter( 'the_title', array( __CLASS__, '_add_icon' ), 999, 2 ); + add_filter( 'megamenu_the_title', array( __CLASS__, '_add_icon' ), 999, 2 ); + add_filter( 'megamenu_nav_menu_css_class', array( __CLASS__, '_add_menu_item_class' ), 10, 3 ); return $args; } @@ -199,7 +215,8 @@ final class Menu_Icons_Front_End { */ public static function _remove_menu_item_title_filter( $nav_menu ) { remove_filter( 'the_title', array( __CLASS__, '_add_icon' ), 999, 2 ); - + remove_filter( 'megamenu_the_title', array( __CLASS__, '_add_icon' ), 999, 2 ); + remove_filter( 'megamenu_nav_menu_css_class', array( __CLASS__, '_add_menu_item_class' ), 10, 3 ); return $nav_menu; } @@ -480,4 +497,17 @@ final class Menu_Icons_Front_End { $style ); } + + /** + * Add menu item class in `Max Mega Menu` item. + * + * @param array $classes Item classes. + * @param array $item WP menu item. + * @param object $args Menu object. + * @return array + */ + public static function _add_menu_item_class( $classes, $item, $args ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore + $classes[] = 'menu-item'; + return $classes; + } } diff --git a/wp-content/plugins/menu-icons/js/dashboard-notice.js b/wp-content/plugins/menu-icons/js/dashboard-notice.js deleted file mode 100644 index 1f3badd5..00000000 --- a/wp-content/plugins/menu-icons/js/dashboard-notice.js +++ /dev/null @@ -1,12 +0,0 @@ -jQuery( document ).ready( function( $ ) { - $( '.menu-icon-dashboard-notice' ).on( 'click', 'button.notice-dismiss', function() { - $.post( window.menuIcons.ajaxUrls, - { - action: 'wp_menu_icons_dismiss_dashboard_notice', - _nonce: window.menuIcons._nonce, - dismiss: 1, - }, - function( res ) {} - ) - } ); -} ); \ No newline at end of file diff --git a/wp-content/plugins/menu-icons/js/dashboard-notice.min.js b/wp-content/plugins/menu-icons/js/dashboard-notice.min.js deleted file mode 100644 index 43e013b9..00000000 --- a/wp-content/plugins/menu-icons/js/dashboard-notice.min.js +++ /dev/null @@ -1 +0,0 @@ -jQuery(document).ready(function(n){n(".menu-icon-dashboard-notice").on("click","button.notice-dismiss",function(){n.post(window.menuIcons.ajaxUrls,{action:"wp_menu_icons_dismiss_dashboard_notice",_nonce:window.menuIcons._nonce,dismiss:1},function(n){})})}); \ No newline at end of file diff --git a/wp-content/plugins/menu-icons/menu-icons.php b/wp-content/plugins/menu-icons/menu-icons.php index 086d61c7..3f806ba6 100644 --- a/wp-content/plugins/menu-icons/menu-icons.php +++ b/wp-content/plugins/menu-icons/menu-icons.php @@ -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' ) + ); ?> -