updated plugin Menu Icons version 0.12.12

This commit is contained in:
KawaiiPunk 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

@ -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) ##### [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 Add font awesome 5 support

View File

@ -1,4 +1,5 @@
.menu-icon-dashboard-notice { .menu-icon-dashboard-notice {
position: relative;
background: #FFFFFF; background: #FFFFFF;
border: 1px solid #E1E1E1; border: 1px solid #E1E1E1;
box-sizing: border-box; box-sizing: border-box;
@ -38,3 +39,6 @@
font-size: 13px; font-size: 13px;
line-height: 1.5; line-height: 1.5;
} }
.menu-icon-dashboard-notice .notice-dismiss {
text-decoration: none;
}

View File

@ -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} .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}

View File

@ -141,9 +141,23 @@ final class Menu_Icons_Front_End {
* @link http://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts * @link http://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts
*/ */
public static function _enqueue_styles() { 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 ) { foreach ( self::$icon_types as $type ) {
if ( wp_style_is( $type->stylesheet_id, 'registered' ) ) { $stylesheet_id = $type->stylesheet_id;
wp_enqueue_style( $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 ) { public static function _add_menu_item_title_filter( $args ) {
add_filter( 'the_title', array( __CLASS__, '_add_icon' ), 999, 2 ); 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; return $args;
} }
@ -199,7 +215,8 @@ final class Menu_Icons_Front_End {
*/ */
public static function _remove_menu_item_title_filter( $nav_menu ) { public static function _remove_menu_item_title_filter( $nav_menu ) {
remove_filter( 'the_title', array( __CLASS__, '_add_icon' ), 999, 2 ); 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; return $nav_menu;
} }
@ -480,4 +497,17 @@ final class Menu_Icons_Front_End {
$style $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;
}
} }

View File

@ -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 ) {}
)
} );
} );

View File

@ -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){})})});

View File

@ -11,7 +11,7 @@
* Plugin name: Menu Icons * Plugin name: Menu Icons
* Plugin URI: https://github.com/Codeinwp/wp-menu-icons * Plugin URI: https://github.com/Codeinwp/wp-menu-icons
* Description: Spice up your navigation menus with pretty icons, easily. * Description: Spice up your navigation menus with pretty icons, easily.
* Version: 0.12.11 * Version: 0.12.12
* Author: ThemeIsle * Author: ThemeIsle
* Author URI: https://themeisle.com * Author URI: https://themeisle.com
* License: GPLv2 * License: GPLv2
@ -29,7 +29,7 @@ final class Menu_Icons {
const DISMISS_NOTICE = 'menu-icons-dismiss-notice'; const DISMISS_NOTICE = 'menu-icons-dismiss-notice';
const VERSION = '0.12.11'; const VERSION = '0.12.12';
/** /**
* Holds plugin data * Holds plugin data
@ -100,7 +100,7 @@ final class Menu_Icons {
add_action( 'admin_enqueue_scripts', array( __CLASS__, '_admin_enqueue_scripts' ) ); 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_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' ); $url = self::get( 'url' );
$suffix = kucrut_get_script_suffix(); $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( wp_register_style(
'menu-icons-dashboard', 'menu-icons-dashboard',
"{$url}css/dashboard-notice{$suffix}.css", "{$url}css/dashboard-notice{$suffix}.css",
false, false,
self::VERSION 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. * Ajax request handle for dissmiss dashboard notice.
*/ */
public static function wp_menu_icons_dismiss_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; if ( ! headers_sent() ) {
set_transient( self::DISMISS_NOTICE, $dismiss, 365 * DAY_IN_SECONDS ); wp_safe_redirect( admin_url() );
exit;
wp_send_json_success( }
array(
'status' => 0,
)
);
die();
} }
/** /**
@ -241,11 +216,20 @@ final class Menu_Icons {
), ),
admin_url( 'theme-install.php' ) 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> <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> <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( $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> </div>
<?php <?php
} }

View File

@ -2,7 +2,7 @@
Contributors: codeinwp, themeisle Contributors: codeinwp, themeisle
Tags: menu, nav-menu, icons, navigation Tags: menu, nav-menu, icons, navigation
Requires at least: 4.3 Requires at least: 4.3
Tested up to: 5.9 Tested up to: 6.0
Stable tag: trunk Stable tag: trunk
License: GPLv2 License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
@ -225,6 +225,15 @@ Read [this blog post](http://kucrut.org/add-custom-image-sizes-right-way/).
== Changelog == == Changelog ==
##### [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) ##### [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 Add font awesome 5 support

View File

@ -2,6 +2,11 @@
// autoload.php @generated by Composer // autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
}
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitf44550e036fbd5cdd6c5a1a84cf40e8f::getLoader(); return ComposerAutoloaderInite86229ff9ba735012afe266068a3adea::getLoader();

View File

@ -21,6 +21,8 @@ use Composer\Semver\VersionParser;
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
* *
* To require its presence, you can require `composer-runtime-api ^2.0` * To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/ */
class InstalledVersions class InstalledVersions
{ {

View File

@ -2,7 +2,7 @@
// autoload_classmap.php @generated by Composer // autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(

View File

@ -2,7 +2,7 @@
// autoload_files.php @generated by Composer // autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(

View File

@ -2,7 +2,7 @@
// autoload_namespaces.php @generated by Composer // autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(

View File

@ -2,7 +2,7 @@
// autoload_psr4.php @generated by Composer // autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__)); $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInitf44550e036fbd5cdd6c5a1a84cf40e8f class ComposerAutoloaderInite86229ff9ba735012afe266068a3adea
{ {
private static $loader; private static $loader;
@ -22,41 +22,18 @@ class ComposerAutoloaderInitf44550e036fbd5cdd6c5a1a84cf40e8f
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInitf44550e036fbd5cdd6c5a1a84cf40e8f', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInite86229ff9ba735012afe266068a3adea', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitf44550e036fbd5cdd6c5a1a84cf40e8f', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInite86229ff9ba735012afe266068a3adea', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInite86229ff9ba735012afe266068a3adea::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitf44550e036fbd5cdd6c5a1a84cf40e8f::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { $includeFiles = \Composer\Autoload\ComposerStaticInite86229ff9ba735012afe266068a3adea::$files;
$includeFiles = Composer\Autoload\ComposerStaticInitf44550e036fbd5cdd6c5a1a84cf40e8f::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequiref44550e036fbd5cdd6c5a1a84cf40e8f($fileIdentifier, $file); composerRequiree86229ff9ba735012afe266068a3adea($fileIdentifier, $file);
} }
return $loader; return $loader;
@ -68,7 +45,7 @@ class ComposerAutoloaderInitf44550e036fbd5cdd6c5a1a84cf40e8f
* @param string $file * @param string $file
* @return void * @return void
*/ */
function composerRequiref44550e036fbd5cdd6c5a1a84cf40e8f($fileIdentifier, $file) function composerRequiree86229ff9ba735012afe266068a3adea($fileIdentifier, $file)
{ {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInitf44550e036fbd5cdd6c5a1a84cf40e8f class ComposerStaticInite86229ff9ba735012afe266068a3adea
{ {
public static $files = array ( public static $files = array (
'2c2d2fe92db4cd03403dbb108ac263b7' => __DIR__ . '/..' . '/codeinwp/gutenberg-menu-icons/load.php', '2c2d2fe92db4cd03403dbb108ac263b7' => __DIR__ . '/..' . '/codeinwp/gutenberg-menu-icons/load.php',
@ -20,7 +20,7 @@ class ComposerStaticInitf44550e036fbd5cdd6c5a1a84cf40e8f
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->classMap = ComposerStaticInitf44550e036fbd5cdd6c5a1a84cf40e8f::$classMap; $loader->classMap = ComposerStaticInite86229ff9ba735012afe266068a3adea::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }

View File

@ -1,11 +1,11 @@
<?php return array( <?php return array(
'root' => array( 'root' => array(
'pretty_version' => 'v0.12.11', 'pretty_version' => 'v0.12.12',
'version' => '0.12.11.0', 'version' => '0.12.12.0',
'type' => 'wordpress-plugin', 'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '88a9597259304ca73ed04932f21235ff46753403', 'reference' => '67d06d108844f32ccddfddb7420e7de9ee47bdb9',
'name' => 'codeinwp/wp-menu-icons', 'name' => 'codeinwp/wp-menu-icons',
'dev' => false, 'dev' => false,
), ),
@ -53,12 +53,12 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'codeinwp/wp-menu-icons' => array( 'codeinwp/wp-menu-icons' => array(
'pretty_version' => 'v0.12.11', 'pretty_version' => 'v0.12.12',
'version' => '0.12.11.0', 'version' => '0.12.12.0',
'type' => 'wordpress-plugin', 'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '88a9597259304ca73ed04932f21235ff46753403', 'reference' => '67d06d108844f32ccddfddb7420e7de9ee47bdb9',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'composer/installers' => array( 'composer/installers' => array(