@@ -25,18 +25,18 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | // a helper function to lookup "env_FILE", "env", then fallback |
| 27 | 27 | if (!function_exists('getenv_docker')) {
|
| 28 | - // https://github.com/docker-library/wordpress/issues/588 (WP-CLI will load this file 2x) |
|
| 29 | - function getenv_docker($env, $default) {
|
|
| 30 | - if ($fileEnv = getenv($env . '_FILE')) {
|
|
| 31 | - return rtrim(file_get_contents($fileEnv), "\r\n"); |
|
| 32 | - } |
|
| 33 | - else if (($val = getenv($env)) !== false) {
|
|
| 34 | - return $val; |
|
| 35 | - } |
|
| 36 | - else {
|
|
| 37 | - return $default; |
|
| 38 | - } |
|
| 39 | - } |
|
| 28 | + // https://github.com/docker-library/wordpress/issues/588 (WP-CLI will load this file 2x) |
|
| 29 | + function getenv_docker($env, $default) {
|
|
| 30 | + if ($fileEnv = getenv($env . '_FILE')) {
|
|
| 31 | + return rtrim(file_get_contents($fileEnv), "\r\n"); |
|
| 32 | + } |
|
| 33 | + else if (($val = getenv($env)) !== false) {
|
|
| 34 | + return $val; |
|
| 35 | + } |
|
| 36 | + else {
|
|
| 37 | + return $default; |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // ** Database settings - You can get this info from your web host ** // |
@@ -114,19 +114,19 @@ discard block |
||
| 114 | 114 | // If we're behind a proxy server and using HTTPS, we need to alert WordPress of that fact |
| 115 | 115 | // see also https://wordpress.org/support/article/administration-over-ssl/#using-a-reverse-proxy |
| 116 | 116 | if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
|
| 117 | - $_SERVER['HTTPS'] = 'on'; |
|
| 117 | + $_SERVER['HTTPS'] = 'on'; |
|
| 118 | 118 | } |
| 119 | 119 | // (we include this by default because reverse proxying is extremely common in container environments) |
| 120 | 120 | |
| 121 | 121 | if ($configExtra = getenv_docker('WORDPRESS_CONFIG_EXTRA', '')) {
|
| 122 | - eval($configExtra); |
|
| 122 | + eval($configExtra); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /* That's all, stop editing! Happy publishing. */ |
| 126 | 126 | |
| 127 | 127 | /** Absolute path to the WordPress directory. */ |
| 128 | 128 | if ( ! defined( 'ABSPATH' ) ) {
|
| 129 | - define( 'ABSPATH', __DIR__ . '/' ); |
|
| 129 | + define( 'ABSPATH', __DIR__ . '/' ); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** Sets up WordPress vars and included files. */ |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // ** Database settings - You can get this info from your web host ** // |
| 43 | 43 | /** The name of the database for WordPress */ |
| 44 | -define( 'DB_NAME', getenv_docker('WORDPRESS_DB_NAME', 'wordpress') );
|
|
| 44 | +define('DB_NAME', getenv_docker('WORDPRESS_DB_NAME', 'wordpress'));
|
|
| 45 | 45 | |
| 46 | 46 | /** Database username */ |
| 47 | -define( 'DB_USER', getenv_docker('WORDPRESS_DB_USER', 'example username') );
|
|
| 47 | +define('DB_USER', getenv_docker('WORDPRESS_DB_USER', 'example username'));
|
|
| 48 | 48 | |
| 49 | 49 | /** Database password */ |
| 50 | -define( 'DB_PASSWORD', getenv_docker('WORDPRESS_DB_PASSWORD', 'example password') );
|
|
| 50 | +define('DB_PASSWORD', getenv_docker('WORDPRESS_DB_PASSWORD', 'example password'));
|
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Docker image fallback values above are sourced from the official WordPress installation wizard: |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | |
| 58 | 58 | /** Database hostname */ |
| 59 | -define( 'DB_HOST', getenv_docker('WORDPRESS_DB_HOST', 'mysql') );
|
|
| 59 | +define('DB_HOST', getenv_docker('WORDPRESS_DB_HOST', 'mysql'));
|
|
| 60 | 60 | |
| 61 | 61 | /** Database charset to use in creating database tables. */ |
| 62 | -define( 'DB_CHARSET', getenv_docker('WORDPRESS_DB_CHARSET', 'utf8') );
|
|
| 62 | +define('DB_CHARSET', getenv_docker('WORDPRESS_DB_CHARSET', 'utf8'));
|
|
| 63 | 63 | |
| 64 | 64 | /** The database collate type. Don't change this if in doubt. */ |
| 65 | -define( 'DB_COLLATE', getenv_docker('WORDPRESS_DB_COLLATE', '') );
|
|
| 65 | +define('DB_COLLATE', getenv_docker('WORDPRESS_DB_COLLATE', ''));
|
|
| 66 | 66 | |
| 67 | 67 | /**#@+ |
| 68 | 68 | * Authentication unique keys and salts. |
@@ -75,14 +75,14 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @since 2.6.0 |
| 77 | 77 | */ |
| 78 | -define( 'AUTH_KEY', getenv_docker('WORDPRESS_AUTH_KEY', 'eeea12a6cfd4373476a78bb31b8e058c2abc0c80') );
|
|
| 79 | -define( 'SECURE_AUTH_KEY', getenv_docker('WORDPRESS_SECURE_AUTH_KEY', '5f0c5b5c2aa7402950810ad887ee29ebc34ab9be') );
|
|
| 80 | -define( 'LOGGED_IN_KEY', getenv_docker('WORDPRESS_LOGGED_IN_KEY', '5b230d18674226be79df75ac512639ddccef8b6f') );
|
|
| 81 | -define( 'NONCE_KEY', getenv_docker('WORDPRESS_NONCE_KEY', '12f495cf82bc22810128a60819cbc3d5ac696df6') );
|
|
| 82 | -define( 'AUTH_SALT', getenv_docker('WORDPRESS_AUTH_SALT', '560279d8689ea9b9b3c9b7ec1114095899295f8c') );
|
|
| 83 | -define( 'SECURE_AUTH_SALT', getenv_docker('WORDPRESS_SECURE_AUTH_SALT', 'db7f0e3a98248dac329461bce9e223efec703e95') );
|
|
| 84 | -define( 'LOGGED_IN_SALT', getenv_docker('WORDPRESS_LOGGED_IN_SALT', '21206bcdcd338de4bd9d44c55aef027d15dbd53b') );
|
|
| 85 | -define( 'NONCE_SALT', getenv_docker('WORDPRESS_NONCE_SALT', '28e4b83cc335c8f3e4d53712f2060c052fa38336') );
|
|
| 78 | +define('AUTH_KEY', getenv_docker('WORDPRESS_AUTH_KEY', 'eeea12a6cfd4373476a78bb31b8e058c2abc0c80'));
|
|
| 79 | +define('SECURE_AUTH_KEY', getenv_docker('WORDPRESS_SECURE_AUTH_KEY', '5f0c5b5c2aa7402950810ad887ee29ebc34ab9be'));
|
|
| 80 | +define('LOGGED_IN_KEY', getenv_docker('WORDPRESS_LOGGED_IN_KEY', '5b230d18674226be79df75ac512639ddccef8b6f'));
|
|
| 81 | +define('NONCE_KEY', getenv_docker('WORDPRESS_NONCE_KEY', '12f495cf82bc22810128a60819cbc3d5ac696df6'));
|
|
| 82 | +define('AUTH_SALT', getenv_docker('WORDPRESS_AUTH_SALT', '560279d8689ea9b9b3c9b7ec1114095899295f8c'));
|
|
| 83 | +define('SECURE_AUTH_SALT', getenv_docker('WORDPRESS_SECURE_AUTH_SALT', 'db7f0e3a98248dac329461bce9e223efec703e95'));
|
|
| 84 | +define('LOGGED_IN_SALT', getenv_docker('WORDPRESS_LOGGED_IN_SALT', '21206bcdcd338de4bd9d44c55aef027d15dbd53b'));
|
|
| 85 | +define('NONCE_SALT', getenv_docker('WORDPRESS_NONCE_SALT', '28e4b83cc335c8f3e4d53712f2060c052fa38336'));
|
|
| 86 | 86 | // (See also https://wordpress.stackexchange.com/a/152905/199287) |
| 87 | 87 | |
| 88 | 88 | /**#@-*/ |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @link https://wordpress.org/support/article/debugging-in-wordpress/ |
| 109 | 109 | */ |
| 110 | -define( 'WP_DEBUG', !!getenv_docker('WORDPRESS_DEBUG', '') );
|
|
| 111 | -define( 'WP_DEBUG', false ); |
|
| 110 | +define('WP_DEBUG', !!getenv_docker('WORDPRESS_DEBUG', ''));
|
|
| 111 | +define('WP_DEBUG', false);
|
|
| 112 | 112 | |
| 113 | 113 | /* Add any custom values between this line and the "stop editing" line. */ |
| 114 | 114 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | /* That's all, stop editing! Happy publishing. */ |
| 127 | 127 | |
| 128 | 128 | /** Absolute path to the WordPress directory. */ |
| 129 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 130 | - define( 'ABSPATH', __DIR__ . '/' ); |
|
| 129 | +if (!defined('ABSPATH')) {
|
|
| 130 | + define('ABSPATH', __DIR__ . '/');
|
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** Sets up WordPress vars and included files. */ |
@@ -29,11 +29,9 @@ |
||
| 29 | 29 | function getenv_docker($env, $default) {
|
| 30 | 30 | if ($fileEnv = getenv($env . '_FILE')) {
|
| 31 | 31 | return rtrim(file_get_contents($fileEnv), "\r\n"); |
| 32 | - } |
|
| 33 | - else if (($val = getenv($env)) !== false) {
|
|
| 32 | + } else if (($val = getenv($env)) !== false) {
|
|
| 34 | 33 | return $val; |
| 35 | - } |
|
| 36 | - else {
|
|
| 34 | + } else {
|
|
| 37 | 35 | return $default; |
| 38 | 36 | } |
| 39 | 37 | } |
@@ -1,116 +1,116 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | - exit; // disable direct access |
|
| 4 | + exit; // disable direct access |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | if ( ! class_exists( 'Mega_Menu_Tools' ) ) : |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * Handles all admin related functionality. |
|
| 11 | - */ |
|
| 12 | - class Mega_Menu_Tools { |
|
| 13 | - |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * Constructor |
|
| 17 | - * |
|
| 18 | - * @since 1.0 |
|
| 19 | - */ |
|
| 20 | - public function __construct() { |
|
| 21 | - add_action( 'admin_post_megamenu_clear_css_cache', array( $this, 'tools_clear_css_cache' ) ); |
|
| 22 | - add_action( 'admin_post_megamenu_delete_data', array( $this, 'delete_data' ) ); |
|
| 23 | - |
|
| 24 | - add_filter( 'megamenu_menu_tabs', array( $this, 'add_tools_tab' ), 4 ); |
|
| 25 | - add_action( 'megamenu_page_tools', array( $this, 'tools_page' ) ); |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Add the Menu Locations tab to our available tabs |
|
| 30 | - * |
|
| 31 | - * @param array $tabs |
|
| 32 | - * @since 2.8 |
|
| 33 | - */ |
|
| 34 | - public function add_tools_tab( $tabs ) { |
|
| 35 | - $tabs['tools'] = __( 'Tools', 'megamenu' ); |
|
| 36 | - return $tabs; |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * Clear the CSS cache. |
|
| 42 | - * |
|
| 43 | - * @since 1.5 |
|
| 44 | - */ |
|
| 45 | - public function tools_clear_css_cache() { |
|
| 46 | - check_admin_referer( 'megamenu_clear_css_cache' ); |
|
| 47 | - do_action( 'megamenu_delete_cache' ); |
|
| 48 | - $this->redirect( admin_url( 'admin.php?page=maxmegamenu_tools&clear_css_cache=true' ) ); |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * Deletes all Max Mega Menu data from the database |
|
| 54 | - * |
|
| 55 | - * @since 1.5 |
|
| 56 | - */ |
|
| 57 | - public function delete_data() { |
|
| 58 | - |
|
| 59 | - check_admin_referer( 'megamenu_delete_data' ); |
|
| 60 | - |
|
| 61 | - do_action( 'megamenu_delete_cache' ); |
|
| 62 | - |
|
| 63 | - // delete options |
|
| 64 | - delete_option( 'megamenu_settings' ); |
|
| 65 | - delete_option( 'megamenu_locations' ); |
|
| 66 | - delete_option( 'megamenu_toggle_blocks' ); |
|
| 67 | - delete_option( 'megamenu_version' ); |
|
| 68 | - delete_option( 'megamenu_initial_version' ); |
|
| 69 | - delete_option( 'megamenu_themes_last_updated' ); |
|
| 70 | - delete_option( 'megamenu_multisite_share_themes' ); |
|
| 71 | - |
|
| 72 | - // delete all widgets assigned to menus |
|
| 73 | - $widget_manager = new Mega_Menu_Widget_Manager(); |
|
| 74 | - |
|
| 75 | - if ( $mega_menu_widgets = $widget_manager->get_mega_menu_sidebar_widgets() ) { |
|
| 76 | - foreach ( $mega_menu_widgets as $widget_id ) { |
|
| 77 | - $widget_manager->delete_widget( $widget_id ); |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - // delete all mega menu metadata stored against menu items |
|
| 82 | - delete_metadata( 'post', 0, '_megamenu', '', true ); |
|
| 83 | - |
|
| 84 | - // clear cache |
|
| 85 | - delete_transient( 'megamenu_css' ); |
|
| 86 | - |
|
| 87 | - // delete custom themes |
|
| 88 | - max_mega_menu_delete_themes(); |
|
| 89 | - |
|
| 90 | - $this->redirect( admin_url( 'admin.php?page=maxmegamenu_tools&delete_data=true' ) ); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * Redirect and exit |
|
| 96 | - * |
|
| 97 | - * @since 1.8 |
|
| 98 | - */ |
|
| 99 | - public function redirect( $url ) { |
|
| 100 | - wp_redirect( $url ); |
|
| 101 | - exit; |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * Content for 'Tools' tab |
|
| 107 | - * |
|
| 108 | - * @since 1.4 |
|
| 109 | - */ |
|
| 110 | - public function tools_page( $saved_settings ) { |
|
| 111 | - $this->print_messages(); |
|
| 112 | - |
|
| 113 | - ?> |
|
| 9 | + /** |
|
| 10 | + * Handles all admin related functionality. |
|
| 11 | + */ |
|
| 12 | + class Mega_Menu_Tools { |
|
| 13 | + |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * Constructor |
|
| 17 | + * |
|
| 18 | + * @since 1.0 |
|
| 19 | + */ |
|
| 20 | + public function __construct() { |
|
| 21 | + add_action( 'admin_post_megamenu_clear_css_cache', array( $this, 'tools_clear_css_cache' ) ); |
|
| 22 | + add_action( 'admin_post_megamenu_delete_data', array( $this, 'delete_data' ) ); |
|
| 23 | + |
|
| 24 | + add_filter( 'megamenu_menu_tabs', array( $this, 'add_tools_tab' ), 4 ); |
|
| 25 | + add_action( 'megamenu_page_tools', array( $this, 'tools_page' ) ); |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Add the Menu Locations tab to our available tabs |
|
| 30 | + * |
|
| 31 | + * @param array $tabs |
|
| 32 | + * @since 2.8 |
|
| 33 | + */ |
|
| 34 | + public function add_tools_tab( $tabs ) { |
|
| 35 | + $tabs['tools'] = __( 'Tools', 'megamenu' ); |
|
| 36 | + return $tabs; |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * Clear the CSS cache. |
|
| 42 | + * |
|
| 43 | + * @since 1.5 |
|
| 44 | + */ |
|
| 45 | + public function tools_clear_css_cache() { |
|
| 46 | + check_admin_referer( 'megamenu_clear_css_cache' ); |
|
| 47 | + do_action( 'megamenu_delete_cache' ); |
|
| 48 | + $this->redirect( admin_url( 'admin.php?page=maxmegamenu_tools&clear_css_cache=true' ) ); |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * Deletes all Max Mega Menu data from the database |
|
| 54 | + * |
|
| 55 | + * @since 1.5 |
|
| 56 | + */ |
|
| 57 | + public function delete_data() { |
|
| 58 | + |
|
| 59 | + check_admin_referer( 'megamenu_delete_data' ); |
|
| 60 | + |
|
| 61 | + do_action( 'megamenu_delete_cache' ); |
|
| 62 | + |
|
| 63 | + // delete options |
|
| 64 | + delete_option( 'megamenu_settings' ); |
|
| 65 | + delete_option( 'megamenu_locations' ); |
|
| 66 | + delete_option( 'megamenu_toggle_blocks' ); |
|
| 67 | + delete_option( 'megamenu_version' ); |
|
| 68 | + delete_option( 'megamenu_initial_version' ); |
|
| 69 | + delete_option( 'megamenu_themes_last_updated' ); |
|
| 70 | + delete_option( 'megamenu_multisite_share_themes' ); |
|
| 71 | + |
|
| 72 | + // delete all widgets assigned to menus |
|
| 73 | + $widget_manager = new Mega_Menu_Widget_Manager(); |
|
| 74 | + |
|
| 75 | + if ( $mega_menu_widgets = $widget_manager->get_mega_menu_sidebar_widgets() ) { |
|
| 76 | + foreach ( $mega_menu_widgets as $widget_id ) { |
|
| 77 | + $widget_manager->delete_widget( $widget_id ); |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + // delete all mega menu metadata stored against menu items |
|
| 82 | + delete_metadata( 'post', 0, '_megamenu', '', true ); |
|
| 83 | + |
|
| 84 | + // clear cache |
|
| 85 | + delete_transient( 'megamenu_css' ); |
|
| 86 | + |
|
| 87 | + // delete custom themes |
|
| 88 | + max_mega_menu_delete_themes(); |
|
| 89 | + |
|
| 90 | + $this->redirect( admin_url( 'admin.php?page=maxmegamenu_tools&delete_data=true' ) ); |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * Redirect and exit |
|
| 96 | + * |
|
| 97 | + * @since 1.8 |
|
| 98 | + */ |
|
| 99 | + public function redirect( $url ) { |
|
| 100 | + wp_redirect( $url ); |
|
| 101 | + exit; |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * Content for 'Tools' tab |
|
| 107 | + * |
|
| 108 | + * @since 1.4 |
|
| 109 | + */ |
|
| 110 | + public function tools_page( $saved_settings ) { |
|
| 111 | + $this->print_messages(); |
|
| 112 | + |
|
| 113 | + ?> |
|
| 114 | 114 | |
| 115 | 115 | <div class='menu_settings menu_settings_tools'> |
| 116 | 116 | <h3 class='first'><?php _e( 'Tools', 'megamenu' ); ?></h3> |
@@ -151,37 +151,37 @@ discard block |
||
| 151 | 151 | </div> |
| 152 | 152 | |
| 153 | 153 | <?php |
| 154 | - } |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | 156 | |
| 157 | - /** |
|
| 158 | - * Display messages to the user |
|
| 159 | - * |
|
| 160 | - * @since 1.0 |
|
| 161 | - */ |
|
| 162 | - public function print_messages() { |
|
| 163 | - if ( isset( $_GET['clear_css_cache'] ) && $_GET['clear_css_cache'] == 'true' ) { |
|
| 164 | - ?> |
|
| 157 | + /** |
|
| 158 | + * Display messages to the user |
|
| 159 | + * |
|
| 160 | + * @since 1.0 |
|
| 161 | + */ |
|
| 162 | + public function print_messages() { |
|
| 163 | + if ( isset( $_GET['clear_css_cache'] ) && $_GET['clear_css_cache'] == 'true' ) { |
|
| 164 | + ?> |
|
| 165 | 165 | <div class="notice notice-success is-dismissible"> |
| 166 | 166 | <p><?php esc_html_e( 'The cache has been cleared and the menu CSS has been regenerated.', 'megamenu' ) ?></p> |
| 167 | 167 | |
| 168 | 168 | <?php |
| 169 | - $theme_class = new Mega_Menu_Themes(); |
|
| 169 | + $theme_class = new Mega_Menu_Themes(); |
|
| 170 | 170 | |
| 171 | - $theme_class->show_cache_warning(); |
|
| 172 | - ?> |
|
| 171 | + $theme_class->show_cache_warning(); |
|
| 172 | + ?> |
|
| 173 | 173 | </div> |
| 174 | 174 | <?php |
| 175 | - } |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | - if ( isset( $_GET['delete_data'] ) && $_GET['delete_data'] == 'true' ) { |
|
| 178 | - ?> |
|
| 177 | + if ( isset( $_GET['delete_data'] ) && $_GET['delete_data'] == 'true' ) { |
|
| 178 | + ?> |
|
| 179 | 179 | <div class="notice notice-success is-dismissible"> |
| 180 | 180 | <p><?php _e( 'All plugin data removed', 'megamenu' ) ?></p> |
| 181 | 181 | </div> |
| 182 | 182 | <?php |
| 183 | - } |
|
| 184 | - } |
|
| 185 | - } |
|
| 183 | + } |
|
| 184 | + } |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | 187 | endif; |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | 4 | exit; // disable direct access |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if ( ! class_exists( 'Mega_Menu_Tools' ) ) : |
|
| 7 | +if (!class_exists('Mega_Menu_Tools')) : |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Handles all admin related functionality. |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | * @since 1.0 |
| 19 | 19 | */ |
| 20 | 20 | public function __construct() { |
| 21 | - add_action( 'admin_post_megamenu_clear_css_cache', array( $this, 'tools_clear_css_cache' ) ); |
|
| 22 | - add_action( 'admin_post_megamenu_delete_data', array( $this, 'delete_data' ) ); |
|
| 21 | + add_action('admin_post_megamenu_clear_css_cache', array($this, 'tools_clear_css_cache')); |
|
| 22 | + add_action('admin_post_megamenu_delete_data', array($this, 'delete_data')); |
|
| 23 | 23 | |
| 24 | - add_filter( 'megamenu_menu_tabs', array( $this, 'add_tools_tab' ), 4 ); |
|
| 25 | - add_action( 'megamenu_page_tools', array( $this, 'tools_page' ) ); |
|
| 24 | + add_filter('megamenu_menu_tabs', array($this, 'add_tools_tab'), 4); |
|
| 25 | + add_action('megamenu_page_tools', array($this, 'tools_page')); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | * @param array $tabs |
| 32 | 32 | * @since 2.8 |
| 33 | 33 | */ |
| 34 | - public function add_tools_tab( $tabs ) { |
|
| 35 | - $tabs['tools'] = __( 'Tools', 'megamenu' ); |
|
| 34 | + public function add_tools_tab($tabs) { |
|
| 35 | + $tabs['tools'] = __('Tools', 'megamenu'); |
|
| 36 | 36 | return $tabs; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | * @since 1.5 |
| 44 | 44 | */ |
| 45 | 45 | public function tools_clear_css_cache() { |
| 46 | - check_admin_referer( 'megamenu_clear_css_cache' ); |
|
| 47 | - do_action( 'megamenu_delete_cache' ); |
|
| 48 | - $this->redirect( admin_url( 'admin.php?page=maxmegamenu_tools&clear_css_cache=true' ) ); |
|
| 46 | + check_admin_referer('megamenu_clear_css_cache'); |
|
| 47 | + do_action('megamenu_delete_cache'); |
|
| 48 | + $this->redirect(admin_url('admin.php?page=maxmegamenu_tools&clear_css_cache=true')); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
@@ -56,38 +56,38 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function delete_data() { |
| 58 | 58 | |
| 59 | - check_admin_referer( 'megamenu_delete_data' ); |
|
| 59 | + check_admin_referer('megamenu_delete_data'); |
|
| 60 | 60 | |
| 61 | - do_action( 'megamenu_delete_cache' ); |
|
| 61 | + do_action('megamenu_delete_cache'); |
|
| 62 | 62 | |
| 63 | 63 | // delete options |
| 64 | - delete_option( 'megamenu_settings' ); |
|
| 65 | - delete_option( 'megamenu_locations' ); |
|
| 66 | - delete_option( 'megamenu_toggle_blocks' ); |
|
| 67 | - delete_option( 'megamenu_version' ); |
|
| 68 | - delete_option( 'megamenu_initial_version' ); |
|
| 69 | - delete_option( 'megamenu_themes_last_updated' ); |
|
| 70 | - delete_option( 'megamenu_multisite_share_themes' ); |
|
| 64 | + delete_option('megamenu_settings'); |
|
| 65 | + delete_option('megamenu_locations'); |
|
| 66 | + delete_option('megamenu_toggle_blocks'); |
|
| 67 | + delete_option('megamenu_version'); |
|
| 68 | + delete_option('megamenu_initial_version'); |
|
| 69 | + delete_option('megamenu_themes_last_updated'); |
|
| 70 | + delete_option('megamenu_multisite_share_themes'); |
|
| 71 | 71 | |
| 72 | 72 | // delete all widgets assigned to menus |
| 73 | 73 | $widget_manager = new Mega_Menu_Widget_Manager(); |
| 74 | 74 | |
| 75 | - if ( $mega_menu_widgets = $widget_manager->get_mega_menu_sidebar_widgets() ) { |
|
| 76 | - foreach ( $mega_menu_widgets as $widget_id ) { |
|
| 77 | - $widget_manager->delete_widget( $widget_id ); |
|
| 75 | + if ($mega_menu_widgets = $widget_manager->get_mega_menu_sidebar_widgets()) { |
|
| 76 | + foreach ($mega_menu_widgets as $widget_id) { |
|
| 77 | + $widget_manager->delete_widget($widget_id); |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // delete all mega menu metadata stored against menu items |
| 82 | - delete_metadata( 'post', 0, '_megamenu', '', true ); |
|
| 82 | + delete_metadata('post', 0, '_megamenu', '', true); |
|
| 83 | 83 | |
| 84 | 84 | // clear cache |
| 85 | - delete_transient( 'megamenu_css' ); |
|
| 85 | + delete_transient('megamenu_css'); |
|
| 86 | 86 | |
| 87 | 87 | // delete custom themes |
| 88 | 88 | max_mega_menu_delete_themes(); |
| 89 | 89 | |
| 90 | - $this->redirect( admin_url( 'admin.php?page=maxmegamenu_tools&delete_data=true' ) ); |
|
| 90 | + $this->redirect(admin_url('admin.php?page=maxmegamenu_tools&delete_data=true')); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @since 1.8 |
| 98 | 98 | */ |
| 99 | - public function redirect( $url ) { |
|
| 100 | - wp_redirect( $url ); |
|
| 99 | + public function redirect($url) { |
|
| 100 | + wp_redirect($url); |
|
| 101 | 101 | exit; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -107,43 +107,43 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @since 1.4 |
| 109 | 109 | */ |
| 110 | - public function tools_page( $saved_settings ) { |
|
| 110 | + public function tools_page($saved_settings) { |
|
| 111 | 111 | $this->print_messages(); |
| 112 | 112 | |
| 113 | 113 | ?> |
| 114 | 114 | |
| 115 | 115 | <div class='menu_settings menu_settings_tools'> |
| 116 | - <h3 class='first'><?php _e( 'Tools', 'megamenu' ); ?></h3> |
|
| 116 | + <h3 class='first'><?php _e('Tools', 'megamenu'); ?></h3> |
|
| 117 | 117 | <table> |
| 118 | 118 | <tr> |
| 119 | 119 | <td class='mega-name'> |
| 120 | - <?php _e( 'Cache', 'megamenu' ); ?> |
|
| 121 | - <div class='mega-description'><?php _e( 'The CSS for your menu is updated each time a menu or a menu theme is changed. You can force the menu CSS to be updated using this tool.', 'megamenu' ); ?></div> |
|
| 120 | + <?php _e('Cache', 'megamenu'); ?> |
|
| 121 | + <div class='mega-description'><?php _e('The CSS for your menu is updated each time a menu or a menu theme is changed. You can force the menu CSS to be updated using this tool.', 'megamenu'); ?></div> |
|
| 122 | 122 | </td> |
| 123 | 123 | <td class='mega-value'> |
| 124 | - <form action="<?php echo admin_url( 'admin-post.php' ); ?>" method="post"> |
|
| 125 | - <?php wp_nonce_field( 'megamenu_clear_css_cache' ); ?> |
|
| 124 | + <form action="<?php echo admin_url('admin-post.php'); ?>" method="post"> |
|
| 125 | + <?php wp_nonce_field('megamenu_clear_css_cache'); ?> |
|
| 126 | 126 | <input type="hidden" name="action" value="megamenu_clear_css_cache" /> |
| 127 | 127 | |
| 128 | - <input type='submit' class='button button-primary' value='<?php _e( 'Clear CSS Cache', 'megamenu' ); ?>' /> |
|
| 128 | + <input type='submit' class='button button-primary' value='<?php _e('Clear CSS Cache', 'megamenu'); ?>' /> |
|
| 129 | 129 | |
| 130 | - <?php if ( get_transient( 'megamenu_css_last_updated' ) ) : ?> |
|
| 131 | - <p><em><small><?php echo sprintf( __( 'The menu CSS was last updated on %s', 'megamenu' ), date( 'l jS F Y H:i:s', get_transient( 'megamenu_css_last_updated' ) ) ); ?><small><em></p> |
|
| 130 | + <?php if (get_transient('megamenu_css_last_updated')) : ?> |
|
| 131 | + <p><em><small><?php echo sprintf(__('The menu CSS was last updated on %s', 'megamenu'), date('l jS F Y H:i:s', get_transient('megamenu_css_last_updated'))); ?><small><em></p> |
|
| 132 | 132 | <?php endif; ?> |
| 133 | 133 | </form> |
| 134 | 134 | </td> |
| 135 | 135 | </tr> |
| 136 | 136 | <tr> |
| 137 | 137 | <td class='mega-name'> |
| 138 | - <?php _e( 'Plugin Data', 'megamenu' ); ?> |
|
| 139 | - <div class='mega-description'><?php _e( 'Delete all saved Max Mega Menu plugin data from the database. Use with caution!', 'megamenu' ); ?></div> |
|
| 138 | + <?php _e('Plugin Data', 'megamenu'); ?> |
|
| 139 | + <div class='mega-description'><?php _e('Delete all saved Max Mega Menu plugin data from the database. Use with caution!', 'megamenu'); ?></div> |
|
| 140 | 140 | </td> |
| 141 | 141 | <td class='mega-value'> |
| 142 | - <form action="<?php echo admin_url( 'admin-post.php' ); ?>" method="post"> |
|
| 143 | - <?php wp_nonce_field( 'megamenu_delete_data' ); ?> |
|
| 142 | + <form action="<?php echo admin_url('admin-post.php'); ?>" method="post"> |
|
| 143 | + <?php wp_nonce_field('megamenu_delete_data'); ?> |
|
| 144 | 144 | <input type="hidden" name="action" value="megamenu_delete_data" /> |
| 145 | 145 | |
| 146 | - <input type='submit' class='button button-secondary confirm' value='<?php _e( 'Delete Data', 'megamenu' ); ?>' /> |
|
| 146 | + <input type='submit' class='button button-secondary confirm' value='<?php _e('Delete Data', 'megamenu'); ?>' /> |
|
| 147 | 147 | </form> |
| 148 | 148 | </td> |
| 149 | 149 | </tr> |
@@ -160,10 +160,10 @@ discard block |
||
| 160 | 160 | * @since 1.0 |
| 161 | 161 | */ |
| 162 | 162 | public function print_messages() { |
| 163 | - if ( isset( $_GET['clear_css_cache'] ) && $_GET['clear_css_cache'] == 'true' ) { |
|
| 163 | + if (isset($_GET['clear_css_cache']) && $_GET['clear_css_cache'] == 'true') { |
|
| 164 | 164 | ?> |
| 165 | 165 | <div class="notice notice-success is-dismissible"> |
| 166 | - <p><?php esc_html_e( 'The cache has been cleared and the menu CSS has been regenerated.', 'megamenu' ) ?></p> |
|
| 166 | + <p><?php esc_html_e('The cache has been cleared and the menu CSS has been regenerated.', 'megamenu') ?></p> |
|
| 167 | 167 | |
| 168 | 168 | <?php |
| 169 | 169 | $theme_class = new Mega_Menu_Themes(); |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | <?php |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - if ( isset( $_GET['delete_data'] ) && $_GET['delete_data'] == 'true' ) { |
|
| 177 | + if (isset($_GET['delete_data']) && $_GET['delete_data'] == 'true') { |
|
| 178 | 178 | ?> |
| 179 | 179 | <div class="notice notice-success is-dismissible"> |
| 180 | - <p><?php _e( 'All plugin data removed', 'megamenu' ) ?></p> |
|
| 180 | + <p><?php _e('All plugin data removed', 'megamenu') ?></p> |
|
| 181 | 181 | </div> |
| 182 | 182 | <?php |
| 183 | 183 | } |
@@ -1,604 +1,604 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | - exit; // disable direct access |
|
| 4 | + exit; // disable direct access |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | if ( ! class_exists( 'Mega_Menu_Themes' ) ) : |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * Handles all admin related functionality. |
|
| 11 | - */ |
|
| 12 | - class Mega_Menu_Themes { |
|
| 13 | - |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * All themes (default and custom) |
|
| 17 | - */ |
|
| 18 | - var $themes = array(); |
|
| 19 | - |
|
| 20 | - |
|
| 21 | - /** |
|
| 22 | - * Active theme |
|
| 23 | - */ |
|
| 24 | - var $active_theme = array(); |
|
| 25 | - |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Active theme ID |
|
| 29 | - */ |
|
| 30 | - var $id = ''; |
|
| 31 | - |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Constructor |
|
| 35 | - * |
|
| 36 | - * @since 1.0 |
|
| 37 | - */ |
|
| 38 | - public function __construct() { |
|
| 39 | - |
|
| 40 | - add_action( 'wp_ajax_megamenu_save_theme', array( $this, 'ajax_save_theme' ) ); |
|
| 41 | - add_action( 'admin_post_megamenu_save_theme', array( $this, 'save_theme' ) ); |
|
| 42 | - add_action( 'admin_post_megamenu_add_theme', array( $this, 'create_theme' ) ); |
|
| 43 | - add_action( 'admin_post_megamenu_delete_theme', array( $this, 'delete_theme' ) ); |
|
| 44 | - add_action( 'admin_post_megamenu_revert_theme', array( $this, 'revert_theme' ) ); |
|
| 45 | - add_action( 'admin_post_megamenu_duplicate_theme', array( $this, 'duplicate_theme' ) ); |
|
| 46 | - add_action( 'admin_post_megamenu_import_theme', array( $this, 'import_theme' ) ); |
|
| 47 | - |
|
| 48 | - add_filter( 'megamenu_menu_tabs', array( $this, 'add_themes_tab' ), 2 ); |
|
| 49 | - add_action( 'megamenu_page_theme_editor', array( $this, 'theme_editor_page' ) ); |
|
| 50 | - |
|
| 51 | - add_filter( 'wp_code_editor_settings', array( $this, 'codemirror_disable_lint' ), 99 ); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Divi turns on code linting. This turns it off. |
|
| 56 | - * |
|
| 57 | - * @since 2.8 |
|
| 58 | - */ |
|
| 59 | - public function codemirror_disable_lint( $settings ) { |
|
| 60 | - if ( isset( $_GET['page'] ) && 'maxmegamenu_theme_editor' === $_GET['page'] ) { // @codingStandardsIgnoreLine |
|
| 61 | - $settings['codemirror']['lint'] = false; |
|
| 62 | - $settings['codemirror']['gutters'] = array(); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - return $settings; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * Add the Menu Locations tab to our available tabs |
|
| 70 | - * |
|
| 71 | - * @param array $tabs |
|
| 72 | - * @since 2.8 |
|
| 73 | - */ |
|
| 74 | - public function add_themes_tab( $tabs ) { |
|
| 75 | - $tabs['theme_editor'] = __( 'Menu Themes', 'megamenu' ); |
|
| 76 | - return $tabs; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * |
|
| 81 | - * @since 1.4 |
|
| 82 | - */ |
|
| 83 | - public function init() { |
|
| 84 | - if ( class_exists( 'Mega_Menu_Style_Manager' ) ) { |
|
| 85 | - $style_manager = new Mega_Menu_Style_Manager(); |
|
| 86 | - $this->themes = $style_manager->get_themes(); |
|
| 87 | - |
|
| 88 | - $last_updated = max_mega_menu_get_last_updated_theme(); |
|
| 89 | - $preselected_theme = isset( $this->themes[ $last_updated ] ) ? $last_updated : 'default'; |
|
| 90 | - $theme_id = isset( $_GET['theme'] ) ? sanitize_text_field( $_GET['theme'] ) : $preselected_theme; // @codingStandardsIgnoreLine |
|
| 91 | - |
|
| 92 | - if ( isset( $this->themes[ $theme_id ] ) ) { |
|
| 93 | - $this->id = $theme_id; |
|
| 94 | - } else { |
|
| 95 | - $this->id = $preselected_theme; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - $this->active_theme = $this->themes[ $this->id ]; |
|
| 99 | - |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * Returns the next available custom theme ID |
|
| 105 | - * |
|
| 106 | - * @since 1.0 |
|
| 107 | - */ |
|
| 108 | - public function get_next_theme_id() { |
|
| 109 | - $last_id = 0; |
|
| 110 | - |
|
| 111 | - if ( $saved_themes = max_mega_menu_get_themes() ) { |
|
| 112 | - foreach ( $saved_themes as $key => $value ) { |
|
| 113 | - if ( strpos( $key, 'custom_theme' ) !== false ) { |
|
| 114 | - $parts = explode( '_', $key ); |
|
| 115 | - $theme_id = end( $parts ); |
|
| 116 | - |
|
| 117 | - if ( $theme_id > $last_id ) { |
|
| 118 | - $last_id = $theme_id; |
|
| 119 | - } |
|
| 120 | - } |
|
| 121 | - } |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - $next_id = $last_id + 1; |
|
| 125 | - |
|
| 126 | - return $next_id; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * |
|
| 132 | - * @since 2.4.1 |
|
| 133 | - */ |
|
| 134 | - public function ajax_save_theme() { |
|
| 135 | - check_ajax_referer( 'megamenu_save_theme' ); |
|
| 136 | - |
|
| 137 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 138 | - |
|
| 139 | - if ( ! current_user_can( $capability ) ) { |
|
| 140 | - return; |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - $style_manager = new Mega_Menu_Style_Manager(); |
|
| 9 | + /** |
|
| 10 | + * Handles all admin related functionality. |
|
| 11 | + */ |
|
| 12 | + class Mega_Menu_Themes { |
|
| 13 | + |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * All themes (default and custom) |
|
| 17 | + */ |
|
| 18 | + var $themes = array(); |
|
| 19 | + |
|
| 20 | + |
|
| 21 | + /** |
|
| 22 | + * Active theme |
|
| 23 | + */ |
|
| 24 | + var $active_theme = array(); |
|
| 25 | + |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Active theme ID |
|
| 29 | + */ |
|
| 30 | + var $id = ''; |
|
| 31 | + |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Constructor |
|
| 35 | + * |
|
| 36 | + * @since 1.0 |
|
| 37 | + */ |
|
| 38 | + public function __construct() { |
|
| 39 | + |
|
| 40 | + add_action( 'wp_ajax_megamenu_save_theme', array( $this, 'ajax_save_theme' ) ); |
|
| 41 | + add_action( 'admin_post_megamenu_save_theme', array( $this, 'save_theme' ) ); |
|
| 42 | + add_action( 'admin_post_megamenu_add_theme', array( $this, 'create_theme' ) ); |
|
| 43 | + add_action( 'admin_post_megamenu_delete_theme', array( $this, 'delete_theme' ) ); |
|
| 44 | + add_action( 'admin_post_megamenu_revert_theme', array( $this, 'revert_theme' ) ); |
|
| 45 | + add_action( 'admin_post_megamenu_duplicate_theme', array( $this, 'duplicate_theme' ) ); |
|
| 46 | + add_action( 'admin_post_megamenu_import_theme', array( $this, 'import_theme' ) ); |
|
| 47 | + |
|
| 48 | + add_filter( 'megamenu_menu_tabs', array( $this, 'add_themes_tab' ), 2 ); |
|
| 49 | + add_action( 'megamenu_page_theme_editor', array( $this, 'theme_editor_page' ) ); |
|
| 50 | + |
|
| 51 | + add_filter( 'wp_code_editor_settings', array( $this, 'codemirror_disable_lint' ), 99 ); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Divi turns on code linting. This turns it off. |
|
| 56 | + * |
|
| 57 | + * @since 2.8 |
|
| 58 | + */ |
|
| 59 | + public function codemirror_disable_lint( $settings ) { |
|
| 60 | + if ( isset( $_GET['page'] ) && 'maxmegamenu_theme_editor' === $_GET['page'] ) { // @codingStandardsIgnoreLine |
|
| 61 | + $settings['codemirror']['lint'] = false; |
|
| 62 | + $settings['codemirror']['gutters'] = array(); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + return $settings; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * Add the Menu Locations tab to our available tabs |
|
| 70 | + * |
|
| 71 | + * @param array $tabs |
|
| 72 | + * @since 2.8 |
|
| 73 | + */ |
|
| 74 | + public function add_themes_tab( $tabs ) { |
|
| 75 | + $tabs['theme_editor'] = __( 'Menu Themes', 'megamenu' ); |
|
| 76 | + return $tabs; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * |
|
| 81 | + * @since 1.4 |
|
| 82 | + */ |
|
| 83 | + public function init() { |
|
| 84 | + if ( class_exists( 'Mega_Menu_Style_Manager' ) ) { |
|
| 85 | + $style_manager = new Mega_Menu_Style_Manager(); |
|
| 86 | + $this->themes = $style_manager->get_themes(); |
|
| 87 | + |
|
| 88 | + $last_updated = max_mega_menu_get_last_updated_theme(); |
|
| 89 | + $preselected_theme = isset( $this->themes[ $last_updated ] ) ? $last_updated : 'default'; |
|
| 90 | + $theme_id = isset( $_GET['theme'] ) ? sanitize_text_field( $_GET['theme'] ) : $preselected_theme; // @codingStandardsIgnoreLine |
|
| 91 | + |
|
| 92 | + if ( isset( $this->themes[ $theme_id ] ) ) { |
|
| 93 | + $this->id = $theme_id; |
|
| 94 | + } else { |
|
| 95 | + $this->id = $preselected_theme; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + $this->active_theme = $this->themes[ $this->id ]; |
|
| 99 | + |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * Returns the next available custom theme ID |
|
| 105 | + * |
|
| 106 | + * @since 1.0 |
|
| 107 | + */ |
|
| 108 | + public function get_next_theme_id() { |
|
| 109 | + $last_id = 0; |
|
| 110 | + |
|
| 111 | + if ( $saved_themes = max_mega_menu_get_themes() ) { |
|
| 112 | + foreach ( $saved_themes as $key => $value ) { |
|
| 113 | + if ( strpos( $key, 'custom_theme' ) !== false ) { |
|
| 114 | + $parts = explode( '_', $key ); |
|
| 115 | + $theme_id = end( $parts ); |
|
| 116 | + |
|
| 117 | + if ( $theme_id > $last_id ) { |
|
| 118 | + $last_id = $theme_id; |
|
| 119 | + } |
|
| 120 | + } |
|
| 121 | + } |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + $next_id = $last_id + 1; |
|
| 125 | + |
|
| 126 | + return $next_id; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * |
|
| 132 | + * @since 2.4.1 |
|
| 133 | + */ |
|
| 134 | + public function ajax_save_theme() { |
|
| 135 | + check_ajax_referer( 'megamenu_save_theme' ); |
|
| 136 | + |
|
| 137 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 138 | + |
|
| 139 | + if ( ! current_user_can( $capability ) ) { |
|
| 140 | + return; |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + $style_manager = new Mega_Menu_Style_Manager(); |
|
| 144 | 144 | |
| 145 | - $test = $style_manager->test_theme_compilation( $this->get_prepared_theme_for_saving() ); |
|
| 145 | + $test = $style_manager->test_theme_compilation( $this->get_prepared_theme_for_saving() ); |
|
| 146 | 146 | |
| 147 | - if ( is_wp_error( $test ) ) { |
|
| 148 | - wp_send_json_error( $test->get_error_message() ); |
|
| 149 | - } else { |
|
| 150 | - $this->save_theme( true ); |
|
| 151 | - wp_send_json_success( 'Saved' ); |
|
| 152 | - } |
|
| 147 | + if ( is_wp_error( $test ) ) { |
|
| 148 | + wp_send_json_error( $test->get_error_message() ); |
|
| 149 | + } else { |
|
| 150 | + $this->save_theme( true ); |
|
| 151 | + wp_send_json_success( 'Saved' ); |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - wp_die(); |
|
| 155 | - } |
|
| 154 | + wp_die(); |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | 157 | |
| 158 | - /** |
|
| 159 | - * |
|
| 160 | - * @since 2.4.1 |
|
| 161 | - */ |
|
| 162 | - public function get_prepared_theme_for_saving() { |
|
| 158 | + /** |
|
| 159 | + * |
|
| 160 | + * @since 2.4.1 |
|
| 161 | + */ |
|
| 162 | + public function get_prepared_theme_for_saving() { |
|
| 163 | 163 | |
| 164 | - $submitted_settings = $_POST['settings']; |
|
| 164 | + $submitted_settings = $_POST['settings']; |
|
| 165 | 165 | |
| 166 | - if ( isset( $_POST['checkboxes'] ) ) { |
|
| 167 | - foreach ( $_POST['checkboxes'] as $checkbox => $value ) { |
|
| 168 | - if ( isset( $submitted_settings[ $checkbox ] ) ) { |
|
| 169 | - $submitted_settings[ $checkbox ] = 'on'; |
|
| 170 | - } else { |
|
| 171 | - $submitted_settings[ $checkbox ] = 'off'; |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - } |
|
| 166 | + if ( isset( $_POST['checkboxes'] ) ) { |
|
| 167 | + foreach ( $_POST['checkboxes'] as $checkbox => $value ) { |
|
| 168 | + if ( isset( $submitted_settings[ $checkbox ] ) ) { |
|
| 169 | + $submitted_settings[ $checkbox ] = 'on'; |
|
| 170 | + } else { |
|
| 171 | + $submitted_settings[ $checkbox ] = 'off'; |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - if ( is_numeric( $submitted_settings['responsive_breakpoint'] ) ) { |
|
| 177 | - $submitted_settings['responsive_breakpoint'] = $submitted_settings['responsive_breakpoint'] . 'px'; |
|
| 178 | - } |
|
| 176 | + if ( is_numeric( $submitted_settings['responsive_breakpoint'] ) ) { |
|
| 177 | + $submitted_settings['responsive_breakpoint'] = $submitted_settings['responsive_breakpoint'] . 'px'; |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - if ( isset( $submitted_settings['toggle_blocks'] ) ) { |
|
| 181 | - unset( $submitted_settings['toggle_blocks'] ); |
|
| 182 | - } |
|
| 180 | + if ( isset( $submitted_settings['toggle_blocks'] ) ) { |
|
| 181 | + unset( $submitted_settings['toggle_blocks'] ); |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - if ( isset( $submitted_settings['panel_width'] ) ) { |
|
| 185 | - $submitted_settings['panel_width'] = trim( $submitted_settings['panel_width'] ); |
|
| 186 | - } |
|
| 184 | + if ( isset( $submitted_settings['panel_width'] ) ) { |
|
| 185 | + $submitted_settings['panel_width'] = trim( $submitted_settings['panel_width'] ); |
|
| 186 | + } |
|
| 187 | 187 | |
| 188 | - if ( isset( $submitted_settings['panel_inner_width'] ) ) { |
|
| 189 | - $submitted_settings['panel_inner_width'] = trim( $submitted_settings['panel_inner_width'] ); |
|
| 190 | - } |
|
| 188 | + if ( isset( $submitted_settings['panel_inner_width'] ) ) { |
|
| 189 | + $submitted_settings['panel_inner_width'] = trim( $submitted_settings['panel_inner_width'] ); |
|
| 190 | + } |
|
| 191 | 191 | |
| 192 | - $theme = array_map( 'esc_attr', $submitted_settings ); |
|
| 192 | + $theme = array_map( 'esc_attr', $submitted_settings ); |
|
| 193 | 193 | |
| 194 | - return $theme; |
|
| 195 | - } |
|
| 194 | + return $theme; |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | 197 | |
| 198 | - /** |
|
| 199 | - * Save changes to an exiting theme. |
|
| 200 | - * |
|
| 201 | - * @since 1.0 |
|
| 202 | - */ |
|
| 203 | - public function save_theme( $is_ajax = false ) { |
|
| 198 | + /** |
|
| 199 | + * Save changes to an exiting theme. |
|
| 200 | + * |
|
| 201 | + * @since 1.0 |
|
| 202 | + */ |
|
| 203 | + public function save_theme( $is_ajax = false ) { |
|
| 204 | 204 | |
| 205 | - check_admin_referer( 'megamenu_save_theme' ); |
|
| 205 | + check_admin_referer( 'megamenu_save_theme' ); |
|
| 206 | 206 | |
| 207 | - $theme = esc_attr( $_POST['theme_id'] ); |
|
| 207 | + $theme = esc_attr( $_POST['theme_id'] ); |
|
| 208 | 208 | |
| 209 | - $saved_themes = max_mega_menu_get_themes(); |
|
| 209 | + $saved_themes = max_mega_menu_get_themes(); |
|
| 210 | 210 | |
| 211 | - if ( isset( $saved_themes[ $theme ] ) ) { |
|
| 212 | - unset( $saved_themes[ $theme ] ); |
|
| 213 | - } |
|
| 211 | + if ( isset( $saved_themes[ $theme ] ) ) { |
|
| 212 | + unset( $saved_themes[ $theme ] ); |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | - $prepared_theme = $this->get_prepared_theme_for_saving(); |
|
| 215 | + $prepared_theme = $this->get_prepared_theme_for_saving(); |
|
| 216 | 216 | |
| 217 | - $saved_themes[ $theme ] = $prepared_theme; |
|
| 217 | + $saved_themes[ $theme ] = $prepared_theme; |
|
| 218 | 218 | |
| 219 | - max_mega_menu_save_themes( $saved_themes ); |
|
| 220 | - max_mega_menu_save_last_updated_theme( $theme ); |
|
| 219 | + max_mega_menu_save_themes( $saved_themes ); |
|
| 220 | + max_mega_menu_save_last_updated_theme( $theme ); |
|
| 221 | 221 | |
| 222 | - do_action( 'megamenu_after_theme_save' ); |
|
| 223 | - do_action( 'megamenu_delete_cache' ); |
|
| 222 | + do_action( 'megamenu_after_theme_save' ); |
|
| 223 | + do_action( 'megamenu_delete_cache' ); |
|
| 224 | 224 | |
| 225 | - if ( ! $is_ajax ) { |
|
| 226 | - $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$theme}&saved=true" ) ); |
|
| 227 | - return; |
|
| 228 | - } |
|
| 225 | + if ( ! $is_ajax ) { |
|
| 226 | + $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$theme}&saved=true" ) ); |
|
| 227 | + return; |
|
| 228 | + } |
|
| 229 | 229 | |
| 230 | - return $prepared_theme; |
|
| 231 | - } |
|
| 230 | + return $prepared_theme; |
|
| 231 | + } |
|
| 232 | 232 | |
| 233 | 233 | |
| 234 | - /** |
|
| 235 | - * Duplicate an existing theme. |
|
| 236 | - * |
|
| 237 | - * @since 1.0 |
|
| 238 | - */ |
|
| 239 | - public function duplicate_theme() { |
|
| 234 | + /** |
|
| 235 | + * Duplicate an existing theme. |
|
| 236 | + * |
|
| 237 | + * @since 1.0 |
|
| 238 | + */ |
|
| 239 | + public function duplicate_theme() { |
|
| 240 | 240 | |
| 241 | - check_admin_referer( 'megamenu_duplicate_theme' ); |
|
| 241 | + check_admin_referer( 'megamenu_duplicate_theme' ); |
|
| 242 | 242 | |
| 243 | - $this->init(); |
|
| 243 | + $this->init(); |
|
| 244 | 244 | |
| 245 | - $theme = esc_attr( $_GET['theme_id'] ); |
|
| 245 | + $theme = esc_attr( $_GET['theme_id'] ); |
|
| 246 | 246 | |
| 247 | - $copy = $this->themes[ $theme ]; |
|
| 247 | + $copy = $this->themes[ $theme ]; |
|
| 248 | 248 | |
| 249 | - $saved_themes = max_mega_menu_get_themes(); |
|
| 249 | + $saved_themes = max_mega_menu_get_themes(); |
|
| 250 | 250 | |
| 251 | - $next_id = $this->get_next_theme_id(); |
|
| 251 | + $next_id = $this->get_next_theme_id(); |
|
| 252 | 252 | |
| 253 | - $copy['title'] = $copy['title'] . ' ' . __( 'Copy', 'megamenu' ); |
|
| 253 | + $copy['title'] = $copy['title'] . ' ' . __( 'Copy', 'megamenu' ); |
|
| 254 | 254 | |
| 255 | - $new_theme_id = 'custom_theme_' . $next_id; |
|
| 255 | + $new_theme_id = 'custom_theme_' . $next_id; |
|
| 256 | 256 | |
| 257 | - $saved_themes[ $new_theme_id ] = $copy; |
|
| 257 | + $saved_themes[ $new_theme_id ] = $copy; |
|
| 258 | 258 | |
| 259 | - max_mega_menu_save_themes( $saved_themes ); |
|
| 259 | + max_mega_menu_save_themes( $saved_themes ); |
|
| 260 | 260 | |
| 261 | - do_action( 'megamenu_after_theme_duplicate' ); |
|
| 261 | + do_action( 'megamenu_after_theme_duplicate' ); |
|
| 262 | 262 | |
| 263 | - $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$new_theme_id}&duplicated=true" ) ); |
|
| 263 | + $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$new_theme_id}&duplicated=true" ) ); |
|
| 264 | 264 | |
| 265 | - } |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | 267 | |
| 268 | - /** |
|
| 269 | - * Delete a theme |
|
| 270 | - * |
|
| 271 | - * @since 1.0 |
|
| 272 | - */ |
|
| 273 | - public function delete_theme() { |
|
| 268 | + /** |
|
| 269 | + * Delete a theme |
|
| 270 | + * |
|
| 271 | + * @since 1.0 |
|
| 272 | + */ |
|
| 273 | + public function delete_theme() { |
|
| 274 | 274 | |
| 275 | - check_admin_referer( 'megamenu_delete_theme' ); |
|
| 275 | + check_admin_referer( 'megamenu_delete_theme' ); |
|
| 276 | 276 | |
| 277 | - $theme = esc_attr( $_GET['theme_id'] ); |
|
| 277 | + $theme = esc_attr( $_GET['theme_id'] ); |
|
| 278 | 278 | |
| 279 | - if ( $this->theme_is_being_used_by_location( $theme ) ) { |
|
| 279 | + if ( $this->theme_is_being_used_by_location( $theme ) ) { |
|
| 280 | 280 | |
| 281 | - $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$theme}&deleted=false" ) ); |
|
| 282 | - return; |
|
| 283 | - } |
|
| 281 | + $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$theme}&deleted=false" ) ); |
|
| 282 | + return; |
|
| 283 | + } |
|
| 284 | 284 | |
| 285 | - $saved_themes = max_mega_menu_get_themes(); |
|
| 285 | + $saved_themes = max_mega_menu_get_themes(); |
|
| 286 | 286 | |
| 287 | - if ( isset( $saved_themes[ $theme ] ) ) { |
|
| 288 | - unset( $saved_themes[ $theme ] ); |
|
| 289 | - } |
|
| 287 | + if ( isset( $saved_themes[ $theme ] ) ) { |
|
| 288 | + unset( $saved_themes[ $theme ] ); |
|
| 289 | + } |
|
| 290 | 290 | |
| 291 | - max_mega_menu_save_themes( $saved_themes ); |
|
| 291 | + max_mega_menu_save_themes( $saved_themes ); |
|
| 292 | 292 | |
| 293 | - do_action( 'megamenu_after_theme_delete' ); |
|
| 293 | + do_action( 'megamenu_after_theme_delete' ); |
|
| 294 | 294 | |
| 295 | - do_action( 'megamenu_delete_cache' ); |
|
| 295 | + do_action( 'megamenu_delete_cache' ); |
|
| 296 | 296 | |
| 297 | - $this->redirect( admin_url( 'admin.php?page=maxmegamenu_theme_editor&theme=default&deleted=true' ) ); |
|
| 297 | + $this->redirect( admin_url( 'admin.php?page=maxmegamenu_theme_editor&theme=default&deleted=true' ) ); |
|
| 298 | 298 | |
| 299 | - } |
|
| 299 | + } |
|
| 300 | 300 | |
| 301 | 301 | |
| 302 | - /** |
|
| 303 | - * Revert a theme (only available for default themes, you can't revert a custom theme) |
|
| 304 | - * |
|
| 305 | - * @since 1.0 |
|
| 306 | - */ |
|
| 307 | - public function revert_theme() { |
|
| 302 | + /** |
|
| 303 | + * Revert a theme (only available for default themes, you can't revert a custom theme) |
|
| 304 | + * |
|
| 305 | + * @since 1.0 |
|
| 306 | + */ |
|
| 307 | + public function revert_theme() { |
|
| 308 | 308 | |
| 309 | - check_admin_referer( 'megamenu_revert_theme' ); |
|
| 309 | + check_admin_referer( 'megamenu_revert_theme' ); |
|
| 310 | 310 | |
| 311 | - $theme = esc_attr( $_GET['theme_id'] ); |
|
| 311 | + $theme = esc_attr( $_GET['theme_id'] ); |
|
| 312 | 312 | |
| 313 | - $saved_themes = max_mega_menu_get_themes(); |
|
| 313 | + $saved_themes = max_mega_menu_get_themes(); |
|
| 314 | 314 | |
| 315 | - if ( isset( $saved_themes[ $theme ] ) ) { |
|
| 316 | - unset( $saved_themes[ $theme ] ); |
|
| 317 | - } |
|
| 315 | + if ( isset( $saved_themes[ $theme ] ) ) { |
|
| 316 | + unset( $saved_themes[ $theme ] ); |
|
| 317 | + } |
|
| 318 | 318 | |
| 319 | - max_mega_menu_save_themes( $saved_themes ); |
|
| 319 | + max_mega_menu_save_themes( $saved_themes ); |
|
| 320 | 320 | |
| 321 | - do_action( 'megamenu_after_theme_revert' ); |
|
| 321 | + do_action( 'megamenu_after_theme_revert' ); |
|
| 322 | 322 | |
| 323 | - do_action( 'megamenu_delete_cache' ); |
|
| 323 | + do_action( 'megamenu_delete_cache' ); |
|
| 324 | 324 | |
| 325 | - $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$theme}&reverted=true" ) ); |
|
| 325 | + $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$theme}&reverted=true" ) ); |
|
| 326 | 326 | |
| 327 | - } |
|
| 327 | + } |
|
| 328 | 328 | |
| 329 | 329 | |
| 330 | - /** |
|
| 331 | - * Create a new custom theme |
|
| 332 | - * |
|
| 333 | - * @since 1.0 |
|
| 334 | - */ |
|
| 335 | - public function create_theme() { |
|
| 330 | + /** |
|
| 331 | + * Create a new custom theme |
|
| 332 | + * |
|
| 333 | + * @since 1.0 |
|
| 334 | + */ |
|
| 335 | + public function create_theme() { |
|
| 336 | 336 | |
| 337 | - check_admin_referer( 'megamenu_create_theme' ); |
|
| 337 | + check_admin_referer( 'megamenu_create_theme' ); |
|
| 338 | 338 | |
| 339 | - $this->init(); |
|
| 339 | + $this->init(); |
|
| 340 | 340 | |
| 341 | - $saved_themes = max_mega_menu_get_themes(); |
|
| 341 | + $saved_themes = max_mega_menu_get_themes(); |
|
| 342 | 342 | |
| 343 | - $next_id = $this->get_next_theme_id(); |
|
| 343 | + $next_id = $this->get_next_theme_id(); |
|
| 344 | 344 | |
| 345 | - $new_theme_id = 'custom_theme_' . $next_id; |
|
| 345 | + $new_theme_id = 'custom_theme_' . $next_id; |
|
| 346 | 346 | |
| 347 | - $style_manager = new Mega_Menu_Style_Manager(); |
|
| 348 | - $new_theme = $style_manager->get_default_theme(); |
|
| 347 | + $style_manager = new Mega_Menu_Style_Manager(); |
|
| 348 | + $new_theme = $style_manager->get_default_theme(); |
|
| 349 | 349 | |
| 350 | - $new_theme['title'] = "Custom {$next_id}"; |
|
| 350 | + $new_theme['title'] = "Custom {$next_id}"; |
|
| 351 | 351 | |
| 352 | - $saved_themes[ $new_theme_id ] = $new_theme; |
|
| 352 | + $saved_themes[ $new_theme_id ] = $new_theme; |
|
| 353 | 353 | |
| 354 | - max_mega_menu_save_themes( $saved_themes ); |
|
| 354 | + max_mega_menu_save_themes( $saved_themes ); |
|
| 355 | 355 | |
| 356 | - do_action( 'megamenu_after_theme_create' ); |
|
| 356 | + do_action( 'megamenu_after_theme_create' ); |
|
| 357 | 357 | |
| 358 | - $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$new_theme_id}&created=true" ) ); |
|
| 358 | + $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$new_theme_id}&created=true" ) ); |
|
| 359 | 359 | |
| 360 | - } |
|
| 360 | + } |
|
| 361 | 361 | |
| 362 | - /** |
|
| 363 | - * Duplicate an existing theme. |
|
| 364 | - * |
|
| 365 | - * @since 1.8 |
|
| 366 | - */ |
|
| 367 | - public function import_theme() { |
|
| 368 | - check_admin_referer( 'megamenu_import_theme' ); |
|
| 362 | + /** |
|
| 363 | + * Duplicate an existing theme. |
|
| 364 | + * |
|
| 365 | + * @since 1.8 |
|
| 366 | + */ |
|
| 367 | + public function import_theme() { |
|
| 368 | + check_admin_referer( 'megamenu_import_theme' ); |
|
| 369 | 369 | |
| 370 | - $import = json_decode( stripslashes( $_POST['data'] ), true ); |
|
| 370 | + $import = json_decode( stripslashes( $_POST['data'] ), true ); |
|
| 371 | 371 | |
| 372 | - $sanitized = array(); |
|
| 372 | + $sanitized = array(); |
|
| 373 | 373 | |
| 374 | - foreach ( $import as $key => $value ) { |
|
| 375 | - if ( $key == 'custom_css' ) { |
|
| 376 | - $sanitized[ $key ] = sanitize_textarea_field( $value ); |
|
| 377 | - } else { |
|
| 378 | - $sanitized[ $key ] = sanitize_text_field( $value ); |
|
| 379 | - } |
|
| 380 | - } |
|
| 374 | + foreach ( $import as $key => $value ) { |
|
| 375 | + if ( $key == 'custom_css' ) { |
|
| 376 | + $sanitized[ $key ] = sanitize_textarea_field( $value ); |
|
| 377 | + } else { |
|
| 378 | + $sanitized[ $key ] = sanitize_text_field( $value ); |
|
| 379 | + } |
|
| 380 | + } |
|
| 381 | 381 | |
| 382 | - $import = $sanitized; |
|
| 382 | + $import = $sanitized; |
|
| 383 | 383 | |
| 384 | - if ( is_array( $import ) ) { |
|
| 385 | - $saved_themes = max_mega_menu_get_themes(); |
|
| 386 | - $next_id = $this->get_next_theme_id(); |
|
| 387 | - $import['title'] = $import['title'] . ' ' . __( ' - Imported', 'megamenu' ); |
|
| 388 | - $new_theme_id = 'custom_theme_' . $next_id; |
|
| 389 | - $saved_themes[ $new_theme_id ] = $import; |
|
| 390 | - max_mega_menu_save_themes( $saved_themes ); |
|
| 391 | - do_action( 'megamenu_after_theme_import' ); |
|
| 384 | + if ( is_array( $import ) ) { |
|
| 385 | + $saved_themes = max_mega_menu_get_themes(); |
|
| 386 | + $next_id = $this->get_next_theme_id(); |
|
| 387 | + $import['title'] = $import['title'] . ' ' . __( ' - Imported', 'megamenu' ); |
|
| 388 | + $new_theme_id = 'custom_theme_' . $next_id; |
|
| 389 | + $saved_themes[ $new_theme_id ] = $import; |
|
| 390 | + max_mega_menu_save_themes( $saved_themes ); |
|
| 391 | + do_action( 'megamenu_after_theme_import' ); |
|
| 392 | 392 | |
| 393 | - $url = add_query_arg( |
|
| 394 | - array( |
|
| 395 | - 'page' => 'maxmegamenu_theme_editor', |
|
| 396 | - 'theme' => $new_theme_id, |
|
| 397 | - 'imported' => 'true', |
|
| 398 | - ), |
|
| 399 | - admin_url( 'admin.php' ) |
|
| 400 | - ); |
|
| 393 | + $url = add_query_arg( |
|
| 394 | + array( |
|
| 395 | + 'page' => 'maxmegamenu_theme_editor', |
|
| 396 | + 'theme' => $new_theme_id, |
|
| 397 | + 'imported' => 'true', |
|
| 398 | + ), |
|
| 399 | + admin_url( 'admin.php' ) |
|
| 400 | + ); |
|
| 401 | 401 | |
| 402 | - } else { |
|
| 403 | - $url = add_query_arg( |
|
| 404 | - array( |
|
| 405 | - 'page' => 'maxmegamenu_theme_editor', |
|
| 406 | - 'imported' => 'false', |
|
| 407 | - ), |
|
| 408 | - admin_url( 'admin.php' ) |
|
| 409 | - ); |
|
| 410 | - } |
|
| 402 | + } else { |
|
| 403 | + $url = add_query_arg( |
|
| 404 | + array( |
|
| 405 | + 'page' => 'maxmegamenu_theme_editor', |
|
| 406 | + 'imported' => 'false', |
|
| 407 | + ), |
|
| 408 | + admin_url( 'admin.php' ) |
|
| 409 | + ); |
|
| 410 | + } |
|
| 411 | 411 | |
| 412 | - $this->redirect( $url ); |
|
| 413 | - } |
|
| 412 | + $this->redirect( $url ); |
|
| 413 | + } |
|
| 414 | 414 | |
| 415 | 415 | |
| 416 | - /** |
|
| 417 | - * Redirect and exit |
|
| 418 | - * |
|
| 419 | - * @since 1.8 |
|
| 420 | - */ |
|
| 421 | - public function redirect( $url ) { |
|
| 422 | - wp_redirect( $url ); |
|
| 423 | - exit; |
|
| 424 | - } |
|
| 416 | + /** |
|
| 417 | + * Redirect and exit |
|
| 418 | + * |
|
| 419 | + * @since 1.8 |
|
| 420 | + */ |
|
| 421 | + public function redirect( $url ) { |
|
| 422 | + wp_redirect( $url ); |
|
| 423 | + exit; |
|
| 424 | + } |
|
| 425 | 425 | |
| 426 | 426 | |
| 427 | - /** |
|
| 428 | - * Checks to see if a certain theme is in use. |
|
| 429 | - * |
|
| 430 | - * @since 1.0 |
|
| 431 | - * @param string $theme |
|
| 432 | - */ |
|
| 433 | - public function theme_is_being_used_by_location( $theme ) { |
|
| 434 | - $settings = get_option( 'megamenu_settings' ); |
|
| 427 | + /** |
|
| 428 | + * Checks to see if a certain theme is in use. |
|
| 429 | + * |
|
| 430 | + * @since 1.0 |
|
| 431 | + * @param string $theme |
|
| 432 | + */ |
|
| 433 | + public function theme_is_being_used_by_location( $theme ) { |
|
| 434 | + $settings = get_option( 'megamenu_settings' ); |
|
| 435 | 435 | |
| 436 | - if ( ! $settings ) { |
|
| 437 | - return false; |
|
| 438 | - } |
|
| 436 | + if ( ! $settings ) { |
|
| 437 | + return false; |
|
| 438 | + } |
|
| 439 | 439 | |
| 440 | - $locations = get_nav_menu_locations(); |
|
| 440 | + $locations = get_nav_menu_locations(); |
|
| 441 | 441 | |
| 442 | - $menus = get_registered_nav_menus(); |
|
| 442 | + $menus = get_registered_nav_menus(); |
|
| 443 | 443 | |
| 444 | - $theme_in_use_locations = array(); |
|
| 444 | + $theme_in_use_locations = array(); |
|
| 445 | 445 | |
| 446 | - if ( count( $locations ) ) { |
|
| 446 | + if ( count( $locations ) ) { |
|
| 447 | 447 | |
| 448 | - foreach ( $locations as $location => $menu_id ) { |
|
| 448 | + foreach ( $locations as $location => $menu_id ) { |
|
| 449 | 449 | |
| 450 | - if ( has_nav_menu( $location ) && max_mega_menu_is_enabled( $location ) && isset( $settings[ $location ]['theme'] ) && $settings[ $location ]['theme'] == $theme ) { |
|
| 451 | - $theme_in_use_locations[] = isset( $menus[ $location ] ) ? $menus[ $location ] : $location; |
|
| 452 | - } |
|
| 453 | - } |
|
| 450 | + if ( has_nav_menu( $location ) && max_mega_menu_is_enabled( $location ) && isset( $settings[ $location ]['theme'] ) && $settings[ $location ]['theme'] == $theme ) { |
|
| 451 | + $theme_in_use_locations[] = isset( $menus[ $location ] ) ? $menus[ $location ] : $location; |
|
| 452 | + } |
|
| 453 | + } |
|
| 454 | 454 | |
| 455 | - if ( count( $theme_in_use_locations ) ) { |
|
| 456 | - return $theme_in_use_locations; |
|
| 457 | - } |
|
| 458 | - } |
|
| 459 | - |
|
| 460 | - return false; |
|
| 461 | - } |
|
| 462 | - |
|
| 463 | - |
|
| 464 | - /** |
|
| 465 | - * Display messages to the user |
|
| 466 | - * |
|
| 467 | - * @since 1.0 |
|
| 468 | - */ |
|
| 469 | - public function print_messages() { |
|
| 470 | - |
|
| 471 | - $this->init(); |
|
| 472 | - |
|
| 473 | - $style_manager = new Mega_Menu_Style_Manager(); |
|
| 474 | - |
|
| 475 | - $test = $style_manager->test_theme_compilation( $this->active_theme ); |
|
| 476 | - |
|
| 477 | - if ( is_wp_error( $test ) ) { |
|
| 478 | - ?> |
|
| 455 | + if ( count( $theme_in_use_locations ) ) { |
|
| 456 | + return $theme_in_use_locations; |
|
| 457 | + } |
|
| 458 | + } |
|
| 459 | + |
|
| 460 | + return false; |
|
| 461 | + } |
|
| 462 | + |
|
| 463 | + |
|
| 464 | + /** |
|
| 465 | + * Display messages to the user |
|
| 466 | + * |
|
| 467 | + * @since 1.0 |
|
| 468 | + */ |
|
| 469 | + public function print_messages() { |
|
| 470 | + |
|
| 471 | + $this->init(); |
|
| 472 | + |
|
| 473 | + $style_manager = new Mega_Menu_Style_Manager(); |
|
| 474 | + |
|
| 475 | + $test = $style_manager->test_theme_compilation( $this->active_theme ); |
|
| 476 | + |
|
| 477 | + if ( is_wp_error( $test ) ) { |
|
| 478 | + ?> |
|
| 479 | 479 | <div class="notice notice-error is-dismissible"> |
| 480 | 480 | <p><?php echo $test->get_error_message(); ?></p> |
| 481 | 481 | </div> |
| 482 | 482 | <?php |
| 483 | - } |
|
| 483 | + } |
|
| 484 | 484 | |
| 485 | - if ( isset( $_GET['deleted'] ) && $_GET['deleted'] == 'false' ) { |
|
| 486 | - ?> |
|
| 485 | + if ( isset( $_GET['deleted'] ) && $_GET['deleted'] == 'false' ) { |
|
| 486 | + ?> |
|
| 487 | 487 | <div class="notice notice-error is-dismissible"> |
| 488 | 488 | <p><?php _e( 'Failed to delete theme. The theme is in use by a menu.', 'megamenu' ) ?></p> |
| 489 | 489 | </div> |
| 490 | 490 | <?php |
| 491 | - } |
|
| 491 | + } |
|
| 492 | 492 | |
| 493 | - if ( isset( $_GET['deleted'] ) && $_GET['deleted'] == 'true' ) { |
|
| 494 | - ?> |
|
| 493 | + if ( isset( $_GET['deleted'] ) && $_GET['deleted'] == 'true' ) { |
|
| 494 | + ?> |
|
| 495 | 495 | <div class="notice notice-success is-dismissible"> |
| 496 | 496 | <p><?php _e( 'Theme Deleted', 'megamenu' ) ?></p> |
| 497 | 497 | </div> |
| 498 | 498 | <?php |
| 499 | - } |
|
| 499 | + } |
|
| 500 | 500 | |
| 501 | - if ( isset( $_GET['duplicated'] ) ) { |
|
| 502 | - ?> |
|
| 501 | + if ( isset( $_GET['duplicated'] ) ) { |
|
| 502 | + ?> |
|
| 503 | 503 | <div class="notice notice-success is-dismissible"> |
| 504 | 504 | <p><?php _e( 'Theme Duplicated', 'megamenu' ) ?></p> |
| 505 | 505 | </div> |
| 506 | 506 | <?php |
| 507 | - } |
|
| 507 | + } |
|
| 508 | 508 | |
| 509 | - if ( isset( $_GET['reverted'] ) ) { |
|
| 510 | - ?> |
|
| 509 | + if ( isset( $_GET['reverted'] ) ) { |
|
| 510 | + ?> |
|
| 511 | 511 | <div class="notice notice-success is-dismissible"> |
| 512 | 512 | <p><?php _e( 'Theme Reverted', 'megamenu' ) ?></p> |
| 513 | 513 | </div> |
| 514 | 514 | <?php |
| 515 | - } |
|
| 515 | + } |
|
| 516 | 516 | |
| 517 | - if ( isset( $_GET['created'] ) ) { |
|
| 518 | - ?> |
|
| 517 | + if ( isset( $_GET['created'] ) ) { |
|
| 518 | + ?> |
|
| 519 | 519 | <div class="notice notice-success is-dismissible"> |
| 520 | 520 | <p><?php _e( "New Theme Created. To apply this theme to a menu location, go to <i>Mega Menu > Menu Locations</i> and select this theme from the 'Theme' dropdown.", 'megamenu' ) ?></p> |
| 521 | 521 | </div> |
| 522 | 522 | <?php |
| 523 | - } |
|
| 523 | + } |
|
| 524 | 524 | |
| 525 | - do_action( 'megamenu_print_messages' ); |
|
| 525 | + do_action( 'megamenu_print_messages' ); |
|
| 526 | 526 | |
| 527 | - } |
|
| 527 | + } |
|
| 528 | 528 | |
| 529 | 529 | |
| 530 | - /** |
|
| 531 | - * Lists the available themes |
|
| 532 | - * |
|
| 533 | - * @since 1.0 |
|
| 534 | - */ |
|
| 535 | - public function theme_selector() { |
|
| 530 | + /** |
|
| 531 | + * Lists the available themes |
|
| 532 | + * |
|
| 533 | + * @since 1.0 |
|
| 534 | + */ |
|
| 535 | + public function theme_selector() { |
|
| 536 | 536 | |
| 537 | - $list_items = "<select id='theme_selector'>"; |
|
| 537 | + $list_items = "<select id='theme_selector'>"; |
|
| 538 | 538 | |
| 539 | - foreach ( $this->themes as $id => $theme ) { |
|
| 539 | + foreach ( $this->themes as $id => $theme ) { |
|
| 540 | 540 | |
| 541 | - $locations = $this->theme_is_being_used_by_location( $id ); |
|
| 541 | + $locations = $this->theme_is_being_used_by_location( $id ); |
|
| 542 | 542 | |
| 543 | - $selected = $id == $this->id ? 'selected=selected' : ''; |
|
| 543 | + $selected = $id == $this->id ? 'selected=selected' : ''; |
|
| 544 | 544 | |
| 545 | - $list_items .= "<option {$selected} value='" . admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$id}" ) . "'>"; |
|
| 545 | + $list_items .= "<option {$selected} value='" . admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$id}" ) . "'>"; |
|
| 546 | 546 | |
| 547 | - $title = $theme['title']; |
|
| 547 | + $title = $theme['title']; |
|
| 548 | 548 | |
| 549 | - if ( is_array( $locations ) ) { |
|
| 550 | - $title .= ' (' . implode( ', ', $locations ) . ')'; |
|
| 551 | - } |
|
| 549 | + if ( is_array( $locations ) ) { |
|
| 550 | + $title .= ' (' . implode( ', ', $locations ) . ')'; |
|
| 551 | + } |
|
| 552 | 552 | |
| 553 | - $list_items .= esc_html( $title ); |
|
| 553 | + $list_items .= esc_html( $title ); |
|
| 554 | 554 | |
| 555 | - $list_items .= '</option>'; |
|
| 556 | - } |
|
| 555 | + $list_items .= '</option>'; |
|
| 556 | + } |
|
| 557 | 557 | |
| 558 | - return $list_items .= '</select>'; |
|
| 558 | + return $list_items .= '</select>'; |
|
| 559 | 559 | |
| 560 | - } |
|
| 560 | + } |
|
| 561 | 561 | |
| 562 | - /** |
|
| 563 | - * Checks to see if a given string contains any of the provided search terms |
|
| 564 | - * |
|
| 565 | - * @param srgin $key |
|
| 566 | - * @param array $needles |
|
| 567 | - * @since 1.0 |
|
| 568 | - */ |
|
| 569 | - private function string_contains( $key, $needles ) { |
|
| 562 | + /** |
|
| 563 | + * Checks to see if a given string contains any of the provided search terms |
|
| 564 | + * |
|
| 565 | + * @param srgin $key |
|
| 566 | + * @param array $needles |
|
| 567 | + * @since 1.0 |
|
| 568 | + */ |
|
| 569 | + private function string_contains( $key, $needles ) { |
|
| 570 | 570 | |
| 571 | - foreach ( $needles as $needle ) { |
|
| 571 | + foreach ( $needles as $needle ) { |
|
| 572 | 572 | |
| 573 | - if ( strpos( $key, $needle ) !== false ) { |
|
| 574 | - return true; |
|
| 575 | - } |
|
| 576 | - } |
|
| 573 | + if ( strpos( $key, $needle ) !== false ) { |
|
| 574 | + return true; |
|
| 575 | + } |
|
| 576 | + } |
|
| 577 | 577 | |
| 578 | - return false; |
|
| 578 | + return false; |
|
| 579 | 579 | |
| 580 | - } |
|
| 580 | + } |
|
| 581 | 581 | |
| 582 | 582 | |
| 583 | - /** |
|
| 584 | - * |
|
| 585 | - * @since 2.9 |
|
| 586 | - */ |
|
| 587 | - public function export_theme() { |
|
| 588 | - $style_manager = new Mega_Menu_Style_Manager(); |
|
| 589 | - $default_theme = $style_manager->get_default_theme(); |
|
| 583 | + /** |
|
| 584 | + * |
|
| 585 | + * @since 2.9 |
|
| 586 | + */ |
|
| 587 | + public function export_theme() { |
|
| 588 | + $style_manager = new Mega_Menu_Style_Manager(); |
|
| 589 | + $default_theme = $style_manager->get_default_theme(); |
|
| 590 | 590 | |
| 591 | - $theme_to_export = $this->active_theme; |
|
| 591 | + $theme_to_export = $this->active_theme; |
|
| 592 | 592 | |
| 593 | - $diff = array(); |
|
| 593 | + $diff = array(); |
|
| 594 | 594 | |
| 595 | - foreach ( $default_theme as $key => $value ) { |
|
| 596 | - if ( isset( $theme_to_export[ $key ] ) && $theme_to_export[ $key ] != $value || $key == 'title' ) { |
|
| 597 | - $diff[ $key ] = $theme_to_export[ $key ]; |
|
| 598 | - } |
|
| 599 | - } |
|
| 595 | + foreach ( $default_theme as $key => $value ) { |
|
| 596 | + if ( isset( $theme_to_export[ $key ] ) && $theme_to_export[ $key ] != $value || $key == 'title' ) { |
|
| 597 | + $diff[ $key ] = $theme_to_export[ $key ]; |
|
| 598 | + } |
|
| 599 | + } |
|
| 600 | 600 | |
| 601 | - ?> |
|
| 601 | + ?> |
|
| 602 | 602 | |
| 603 | 603 | <div class='menu_settings menu_settings_menu_themes'> |
| 604 | 604 | <h3 class='first'><?php _e( 'Export Theme', 'megamenu' ); ?></h3> |
@@ -619,33 +619,33 @@ discard block |
||
| 619 | 619 | </td> |
| 620 | 620 | <td class='mega-value'> |
| 621 | 621 | <?php |
| 622 | - $key = strtolower( str_replace( ' ', '_', $theme_to_export['title'] ) ); |
|
| 623 | - $key .= '_' . time(); |
|
| 624 | - echo "<textarea class='mega-export'>"; |
|
| 625 | - echo 'function megamenu_add_theme_' . $key . '($themes) {'; |
|
| 626 | - echo "\n" . ' $themes["' . $key . '"] = array('; |
|
| 627 | - |
|
| 628 | - foreach ( $diff as $theme_key => $value ) { |
|
| 629 | - echo "\n '" . $theme_key . "' => '" . $value . "',"; |
|
| 630 | - } |
|
| 631 | - |
|
| 632 | - echo "\n" . ' );'; |
|
| 633 | - echo "\n" . ' return $themes;'; |
|
| 634 | - echo "\n" . '}'; |
|
| 635 | - echo "\n" . 'add_filter("megamenu_themes", "megamenu_add_theme_' . $key . '");'; |
|
| 636 | - echo '</textarea>'; |
|
| 637 | - ?> |
|
| 622 | + $key = strtolower( str_replace( ' ', '_', $theme_to_export['title'] ) ); |
|
| 623 | + $key .= '_' . time(); |
|
| 624 | + echo "<textarea class='mega-export'>"; |
|
| 625 | + echo 'function megamenu_add_theme_' . $key . '($themes) {'; |
|
| 626 | + echo "\n" . ' $themes["' . $key . '"] = array('; |
|
| 627 | + |
|
| 628 | + foreach ( $diff as $theme_key => $value ) { |
|
| 629 | + echo "\n '" . $theme_key . "' => '" . $value . "',"; |
|
| 630 | + } |
|
| 631 | + |
|
| 632 | + echo "\n" . ' );'; |
|
| 633 | + echo "\n" . ' return $themes;'; |
|
| 634 | + echo "\n" . '}'; |
|
| 635 | + echo "\n" . 'add_filter("megamenu_themes", "megamenu_add_theme_' . $key . '");'; |
|
| 636 | + echo '</textarea>'; |
|
| 637 | + ?> |
|
| 638 | 638 | </td> |
| 639 | 639 | </tr> |
| 640 | 640 | </table> |
| 641 | 641 | </div> |
| 642 | 642 | |
| 643 | 643 | <?php |
| 644 | - } |
|
| 644 | + } |
|
| 645 | 645 | |
| 646 | - public function import_theme_page() { |
|
| 646 | + public function import_theme_page() { |
|
| 647 | 647 | |
| 648 | - ?> |
|
| 648 | + ?> |
|
| 649 | 649 | |
| 650 | 650 | <div class='menu_settings menu_settings_menu_themes'> |
| 651 | 651 | <h3 class='first'><?php _e( 'Import Theme', 'megamenu' ); ?></h3> |
@@ -668,89 +668,89 @@ discard block |
||
| 668 | 668 | </div> |
| 669 | 669 | |
| 670 | 670 | <?php |
| 671 | - } |
|
| 672 | - |
|
| 673 | - |
|
| 674 | - /** |
|
| 675 | - * Displays the theme editor form. |
|
| 676 | - * |
|
| 677 | - * @since 1.0 |
|
| 678 | - */ |
|
| 679 | - public function theme_editor_page( $saved_settings ) { |
|
| 680 | - |
|
| 681 | - $this->init(); |
|
| 682 | - |
|
| 683 | - if ( isset( $_GET['export'] ) ) { |
|
| 684 | - $this->export_theme(); |
|
| 685 | - return; |
|
| 686 | - } |
|
| 687 | - |
|
| 688 | - if ( isset( $_GET['import'] ) ) { |
|
| 689 | - $this->import_theme_page(); |
|
| 690 | - return; |
|
| 691 | - } |
|
| 692 | - |
|
| 693 | - $create_url = esc_url( |
|
| 694 | - add_query_arg( |
|
| 695 | - array( |
|
| 696 | - 'action' => 'megamenu_add_theme', |
|
| 697 | - ), |
|
| 698 | - wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_create_theme' ) |
|
| 699 | - ) |
|
| 700 | - ); |
|
| 701 | - |
|
| 702 | - $duplicate_url = esc_url( |
|
| 703 | - add_query_arg( |
|
| 704 | - array( |
|
| 705 | - 'action' => 'megamenu_duplicate_theme', |
|
| 706 | - 'theme_id' => $this->id, |
|
| 707 | - ), |
|
| 708 | - wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_duplicate_theme' ) |
|
| 709 | - ) |
|
| 710 | - ); |
|
| 711 | - |
|
| 712 | - $delete_url = esc_url( |
|
| 713 | - add_query_arg( |
|
| 714 | - array( |
|
| 715 | - 'action' => 'megamenu_delete_theme', |
|
| 716 | - 'theme_id' => $this->id, |
|
| 717 | - ), |
|
| 718 | - wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_delete_theme' ) |
|
| 719 | - ) |
|
| 720 | - ); |
|
| 721 | - |
|
| 722 | - $revert_url = esc_url( |
|
| 723 | - add_query_arg( |
|
| 724 | - array( |
|
| 725 | - 'action' => 'megamenu_revert_theme', |
|
| 726 | - 'theme_id' => $this->id, |
|
| 727 | - ), |
|
| 728 | - wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_revert_theme' ) |
|
| 729 | - ) |
|
| 730 | - ); |
|
| 731 | - |
|
| 732 | - $export_url = esc_url( |
|
| 733 | - add_query_arg( |
|
| 734 | - array( |
|
| 735 | - 'page' => 'maxmegamenu_theme_editor', |
|
| 736 | - 'theme' => $this->id, |
|
| 737 | - 'export' => 'true', |
|
| 738 | - ), |
|
| 739 | - admin_url( 'admin.php' ) |
|
| 740 | - ) |
|
| 741 | - ); |
|
| 742 | - |
|
| 743 | - $import_url = esc_url( |
|
| 744 | - add_query_arg( |
|
| 745 | - array( |
|
| 746 | - 'page' => 'maxmegamenu_theme_editor', |
|
| 747 | - 'import' => 'true', |
|
| 748 | - ), |
|
| 749 | - admin_url( 'admin.php' ) |
|
| 750 | - ) |
|
| 751 | - ); |
|
| 752 | - |
|
| 753 | - ?> |
|
| 671 | + } |
|
| 672 | + |
|
| 673 | + |
|
| 674 | + /** |
|
| 675 | + * Displays the theme editor form. |
|
| 676 | + * |
|
| 677 | + * @since 1.0 |
|
| 678 | + */ |
|
| 679 | + public function theme_editor_page( $saved_settings ) { |
|
| 680 | + |
|
| 681 | + $this->init(); |
|
| 682 | + |
|
| 683 | + if ( isset( $_GET['export'] ) ) { |
|
| 684 | + $this->export_theme(); |
|
| 685 | + return; |
|
| 686 | + } |
|
| 687 | + |
|
| 688 | + if ( isset( $_GET['import'] ) ) { |
|
| 689 | + $this->import_theme_page(); |
|
| 690 | + return; |
|
| 691 | + } |
|
| 692 | + |
|
| 693 | + $create_url = esc_url( |
|
| 694 | + add_query_arg( |
|
| 695 | + array( |
|
| 696 | + 'action' => 'megamenu_add_theme', |
|
| 697 | + ), |
|
| 698 | + wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_create_theme' ) |
|
| 699 | + ) |
|
| 700 | + ); |
|
| 701 | + |
|
| 702 | + $duplicate_url = esc_url( |
|
| 703 | + add_query_arg( |
|
| 704 | + array( |
|
| 705 | + 'action' => 'megamenu_duplicate_theme', |
|
| 706 | + 'theme_id' => $this->id, |
|
| 707 | + ), |
|
| 708 | + wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_duplicate_theme' ) |
|
| 709 | + ) |
|
| 710 | + ); |
|
| 711 | + |
|
| 712 | + $delete_url = esc_url( |
|
| 713 | + add_query_arg( |
|
| 714 | + array( |
|
| 715 | + 'action' => 'megamenu_delete_theme', |
|
| 716 | + 'theme_id' => $this->id, |
|
| 717 | + ), |
|
| 718 | + wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_delete_theme' ) |
|
| 719 | + ) |
|
| 720 | + ); |
|
| 721 | + |
|
| 722 | + $revert_url = esc_url( |
|
| 723 | + add_query_arg( |
|
| 724 | + array( |
|
| 725 | + 'action' => 'megamenu_revert_theme', |
|
| 726 | + 'theme_id' => $this->id, |
|
| 727 | + ), |
|
| 728 | + wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_revert_theme' ) |
|
| 729 | + ) |
|
| 730 | + ); |
|
| 731 | + |
|
| 732 | + $export_url = esc_url( |
|
| 733 | + add_query_arg( |
|
| 734 | + array( |
|
| 735 | + 'page' => 'maxmegamenu_theme_editor', |
|
| 736 | + 'theme' => $this->id, |
|
| 737 | + 'export' => 'true', |
|
| 738 | + ), |
|
| 739 | + admin_url( 'admin.php' ) |
|
| 740 | + ) |
|
| 741 | + ); |
|
| 742 | + |
|
| 743 | + $import_url = esc_url( |
|
| 744 | + add_query_arg( |
|
| 745 | + array( |
|
| 746 | + 'page' => 'maxmegamenu_theme_editor', |
|
| 747 | + 'import' => 'true', |
|
| 748 | + ), |
|
| 749 | + admin_url( 'admin.php' ) |
|
| 750 | + ) |
|
| 751 | + ); |
|
| 752 | + |
|
| 753 | + ?> |
|
| 754 | 754 | |
| 755 | 755 | <?php $this->print_messages(); ?> |
| 756 | 756 | |
@@ -783,23 +783,23 @@ discard block |
||
| 783 | 783 | |
| 784 | 784 | <?php |
| 785 | 785 | |
| 786 | - $saved_settings = get_option( 'megamenu_settings' ); |
|
| 786 | + $saved_settings = get_option( 'megamenu_settings' ); |
|
| 787 | 787 | |
| 788 | - if ( isset( $saved_settings['css'] ) && $saved_settings['css'] == 'disabled' ) { |
|
| 789 | - ?> |
|
| 788 | + if ( isset( $saved_settings['css'] ) && $saved_settings['css'] == 'disabled' ) { |
|
| 789 | + ?> |
|
| 790 | 790 | <div class='fail'><?php _e( 'CSS Output (under Mega Menu > General Settings) has been disabled. Therefore, changes made within the theme editor will not be applied to your menu.', 'megamenu' ); ?></div> |
| 791 | 791 | <?php |
| 792 | - } |
|
| 792 | + } |
|
| 793 | 793 | |
| 794 | - $locations = $this->theme_is_being_used_by_location( $this->id ); |
|
| 794 | + $locations = $this->theme_is_being_used_by_location( $this->id ); |
|
| 795 | 795 | |
| 796 | - if ( ! $locations && ! isset( $_GET['created'] ) ) { |
|
| 797 | - ?> |
|
| 796 | + if ( ! $locations && ! isset( $_GET['created'] ) ) { |
|
| 797 | + ?> |
|
| 798 | 798 | <div class='warning'><?php _e( "This menu theme is not currently active as it has not been applied to any menu locations. You may wish to check you are editing the correct menu theme - you can choose a different theme to edit using the 'Select theme to edit' selector above. Alternatively, to apply this theme to a menu go to <i>Appearance > Menus > Max Mega Menu Settings</i> and select this theme from the 'Theme' dropdown.", 'megamenu' ); ?></div> |
| 799 | 799 | <?php |
| 800 | - } |
|
| 800 | + } |
|
| 801 | 801 | |
| 802 | - ?> |
|
| 802 | + ?> |
|
| 803 | 803 | |
| 804 | 804 | <form action="<?php echo admin_url( 'admin-post.php' ); ?>" method="post" class="theme_editor"> |
| 805 | 805 | <input type="hidden" name="theme_id" value="<?php echo esc_attr( $this->id ); ?>" /> |
@@ -808,2047 +808,2047 @@ discard block |
||
| 808 | 808 | |
| 809 | 809 | <?php |
| 810 | 810 | |
| 811 | - $settings = apply_filters( |
|
| 812 | - 'megamenu_theme_editor_settings', |
|
| 813 | - array( |
|
| 814 | - |
|
| 815 | - 'general' => array( |
|
| 816 | - 'title' => __( 'General Settings', 'megamenu' ), |
|
| 817 | - 'settings' => array( |
|
| 818 | - 'title' => array( |
|
| 819 | - 'priority' => 10, |
|
| 820 | - 'title' => __( 'Theme Title', 'megamenu' ), |
|
| 821 | - 'description' => '', |
|
| 822 | - 'settings' => array( |
|
| 823 | - array( |
|
| 824 | - 'title' => '', |
|
| 825 | - 'type' => 'freetext', |
|
| 826 | - 'key' => 'title', |
|
| 827 | - ), |
|
| 828 | - ), |
|
| 829 | - ), |
|
| 830 | - 'arrow' => array( |
|
| 831 | - 'priority' => 20, |
|
| 832 | - 'title' => __( 'Arrow', 'megamenu' ), |
|
| 833 | - 'description' => __( 'Select the arrow styles.', 'megamenu' ), |
|
| 834 | - 'settings' => array( |
|
| 835 | - array( |
|
| 836 | - 'title' => __( 'Up', 'megamenu' ), |
|
| 837 | - 'type' => 'arrow', |
|
| 838 | - 'key' => 'arrow_up', |
|
| 839 | - ), |
|
| 840 | - array( |
|
| 841 | - 'title' => __( 'Down', 'megamenu' ), |
|
| 842 | - 'type' => 'arrow', |
|
| 843 | - 'key' => 'arrow_down', |
|
| 844 | - ), |
|
| 845 | - array( |
|
| 846 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 847 | - 'type' => 'arrow', |
|
| 848 | - 'key' => 'arrow_left', |
|
| 849 | - ), |
|
| 850 | - array( |
|
| 851 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 852 | - 'type' => 'arrow', |
|
| 853 | - 'key' => 'arrow_right', |
|
| 854 | - ), |
|
| 855 | - ), |
|
| 856 | - ), |
|
| 857 | - 'line_height' => array( |
|
| 858 | - 'priority' => 30, |
|
| 859 | - 'title' => __( 'Line Height', 'megamenu' ), |
|
| 860 | - 'description' => __( 'Set the general line height to use in the sub menu contents.', 'megamenu' ), |
|
| 861 | - 'settings' => array( |
|
| 862 | - array( |
|
| 863 | - 'title' => '', |
|
| 864 | - 'type' => 'freetext', |
|
| 865 | - 'key' => 'line_height', |
|
| 866 | - ), |
|
| 867 | - ), |
|
| 868 | - ), |
|
| 869 | - 'z_index' => array( |
|
| 870 | - 'priority' => 40, |
|
| 871 | - 'title' => __( 'Z Index', 'megamenu' ), |
|
| 872 | - 'description' => __( 'Set the z-index to ensure the sub menus appear ontop of other content.', 'megamenu' ), |
|
| 873 | - 'settings' => array( |
|
| 874 | - array( |
|
| 875 | - 'title' => '', |
|
| 876 | - 'type' => 'freetext', |
|
| 877 | - 'key' => 'z_index', |
|
| 878 | - 'validation' => 'int', |
|
| 879 | - ), |
|
| 880 | - ), |
|
| 881 | - ), |
|
| 882 | - 'shadow' => array( |
|
| 883 | - 'priority' => 50, |
|
| 884 | - 'title' => __( 'Shadow', 'megamenu' ), |
|
| 885 | - 'description' => __( 'Apply a shadow to mega and flyout menus.', 'megamenu' ), |
|
| 886 | - 'settings' => array( |
|
| 887 | - array( |
|
| 888 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 889 | - 'type' => 'checkbox', |
|
| 890 | - 'key' => 'shadow', |
|
| 891 | - ), |
|
| 892 | - array( |
|
| 893 | - 'title' => __( 'Horizontal', 'megamenu' ), |
|
| 894 | - 'type' => 'freetext', |
|
| 895 | - 'key' => 'shadow_horizontal', |
|
| 896 | - 'validation' => 'px', |
|
| 897 | - ), |
|
| 898 | - array( |
|
| 899 | - 'title' => __( 'Vertical', 'megamenu' ), |
|
| 900 | - 'type' => 'freetext', |
|
| 901 | - 'key' => 'shadow_vertical', |
|
| 902 | - 'validation' => 'px', |
|
| 903 | - ), |
|
| 904 | - array( |
|
| 905 | - 'title' => __( 'Blur', 'megamenu' ), |
|
| 906 | - 'type' => 'freetext', |
|
| 907 | - 'key' => 'shadow_blur', |
|
| 908 | - 'validation' => 'px', |
|
| 909 | - ), |
|
| 910 | - array( |
|
| 911 | - 'title' => __( 'Spread', 'megamenu' ), |
|
| 912 | - 'type' => 'freetext', |
|
| 913 | - 'key' => 'shadow_spread', |
|
| 914 | - 'validation' => 'px', |
|
| 915 | - ), |
|
| 916 | - array( |
|
| 917 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 918 | - 'type' => 'color', |
|
| 919 | - 'key' => 'shadow_color', |
|
| 920 | - ), |
|
| 921 | - ), |
|
| 922 | - ), |
|
| 923 | - 'transitions' => array( |
|
| 924 | - 'priority' => 60, |
|
| 925 | - 'title' => __( 'Hover Transitions', 'megamenu' ), |
|
| 926 | - 'description' => __( 'Apply hover transitions to menu items. Note: Transitions will not apply to gradient backgrounds.', 'megamenu' ), |
|
| 927 | - 'settings' => array( |
|
| 928 | - array( |
|
| 929 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 930 | - 'type' => 'checkbox', |
|
| 931 | - 'key' => 'transitions', |
|
| 932 | - ), |
|
| 933 | - ), |
|
| 934 | - ), |
|
| 935 | - 'resets' => array( |
|
| 936 | - 'priority' => 70, |
|
| 937 | - 'title' => __( 'Reset Widget Styling', 'megamenu' ), |
|
| 938 | - 'description' => __( 'Caution: Reset the styling of widgets within the mega menu? This may break the styling of widgets that you have added to your sub menus. Default: Disabled.', 'megamenu' ), |
|
| 939 | - 'settings' => array( |
|
| 940 | - array( |
|
| 941 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 942 | - 'type' => 'checkbox', |
|
| 943 | - 'key' => 'resets', |
|
| 944 | - ), |
|
| 945 | - ), |
|
| 946 | - ), |
|
| 947 | - ), |
|
| 948 | - ), |
|
| 949 | - 'menu_bar' => array( |
|
| 950 | - 'title' => __( 'Menu Bar', 'megamenu' ), |
|
| 951 | - 'settings' => array( |
|
| 952 | - 'menu_item_height' => array( |
|
| 953 | - 'priority' => 05, |
|
| 954 | - 'title' => __( 'Menu Height', 'megamenu' ), |
|
| 955 | - 'description' => __( 'Define the height of each top level menu item link. This value plus the Menu Padding (top and bottom) settings define the overall height of the menu bar.', 'megamenu' ), |
|
| 956 | - 'settings' => array( |
|
| 957 | - array( |
|
| 958 | - 'title' => '', |
|
| 959 | - 'type' => 'freetext', |
|
| 960 | - 'key' => 'menu_item_link_height', |
|
| 961 | - 'validation' => 'px', |
|
| 962 | - ), |
|
| 963 | - ), |
|
| 964 | - ), |
|
| 965 | - 'menu_background' => array( |
|
| 966 | - 'priority' => 10, |
|
| 967 | - 'title' => __( 'Menu Background', 'megamenu' ), |
|
| 968 | - 'description' => __( "The background color for the main menu bar. Set each value to transparent for a 'button' style menu.", 'megamenu' ), |
|
| 969 | - 'settings' => array( |
|
| 970 | - array( |
|
| 971 | - 'title' => __( 'From', 'megamenu' ), |
|
| 972 | - 'type' => 'color', |
|
| 973 | - 'key' => 'container_background_from', |
|
| 974 | - ), |
|
| 975 | - array( |
|
| 976 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 977 | - 'type' => 'copy_color', |
|
| 978 | - 'key' => 'copy_color', |
|
| 979 | - ), |
|
| 980 | - array( |
|
| 981 | - 'title' => __( 'To', 'megamenu' ), |
|
| 982 | - 'type' => 'color', |
|
| 983 | - 'key' => 'container_background_to', |
|
| 984 | - ), |
|
| 985 | - ), |
|
| 986 | - ), |
|
| 987 | - 'menu_padding' => array( |
|
| 988 | - 'priority' => 20, |
|
| 989 | - 'title' => __( 'Menu Padding', 'megamenu' ), |
|
| 990 | - 'description' => __( 'Padding for the main menu bar.', 'megamenu' ), |
|
| 991 | - 'settings' => array( |
|
| 992 | - array( |
|
| 993 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 994 | - 'type' => 'freetext', |
|
| 995 | - 'key' => 'container_padding_top', |
|
| 996 | - 'validation' => 'px', |
|
| 997 | - ), |
|
| 998 | - array( |
|
| 999 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1000 | - 'type' => 'freetext', |
|
| 1001 | - 'key' => 'container_padding_right', |
|
| 1002 | - 'validation' => 'px', |
|
| 1003 | - ), |
|
| 1004 | - array( |
|
| 1005 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1006 | - 'type' => 'freetext', |
|
| 1007 | - 'key' => 'container_padding_bottom', |
|
| 1008 | - 'validation' => 'px', |
|
| 1009 | - ), |
|
| 1010 | - array( |
|
| 1011 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1012 | - 'type' => 'freetext', |
|
| 1013 | - 'key' => 'container_padding_left', |
|
| 1014 | - 'validation' => 'px', |
|
| 1015 | - ), |
|
| 1016 | - ), |
|
| 1017 | - ), |
|
| 1018 | - 'menu_border_radius' => array( |
|
| 1019 | - 'priority' => 30, |
|
| 1020 | - 'title' => __( 'Menu Border Radius', 'megamenu' ), |
|
| 1021 | - 'description' => __( 'Set a border radius on the main menu bar.', 'megamenu' ), |
|
| 1022 | - 'settings' => array( |
|
| 1023 | - array( |
|
| 1024 | - 'title' => __( 'Top Left', 'megamenu' ), |
|
| 1025 | - 'type' => 'freetext', |
|
| 1026 | - 'key' => 'container_border_radius_top_left', |
|
| 1027 | - 'validation' => 'px', |
|
| 1028 | - ), |
|
| 1029 | - array( |
|
| 1030 | - 'title' => __( 'Top Right', 'megamenu' ), |
|
| 1031 | - 'type' => 'freetext', |
|
| 1032 | - 'key' => 'container_border_radius_top_right', |
|
| 1033 | - 'validation' => 'px', |
|
| 1034 | - ), |
|
| 1035 | - array( |
|
| 1036 | - 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 1037 | - 'type' => 'freetext', |
|
| 1038 | - 'key' => 'container_border_radius_bottom_right', |
|
| 1039 | - 'validation' => 'px', |
|
| 1040 | - ), |
|
| 1041 | - array( |
|
| 1042 | - 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 1043 | - 'type' => 'freetext', |
|
| 1044 | - 'key' => 'container_border_radius_bottom_left', |
|
| 1045 | - 'validation' => 'px', |
|
| 1046 | - ), |
|
| 1047 | - ), |
|
| 1048 | - ), |
|
| 1049 | - 'top_level_menu_items' => array( |
|
| 1050 | - 'priority' => 50, |
|
| 1051 | - 'title' => __( 'Top Level Menu Items', 'megamenu' ), |
|
| 1052 | - 'description' => '', |
|
| 1053 | - ), |
|
| 1054 | - 'menu_item_align' => array( |
|
| 1055 | - 'priority' => 55, |
|
| 1056 | - 'title' => __( 'Menu Items Align', 'megamenu' ), |
|
| 1057 | - 'description' => __( 'Align <i>all</i> menu items to the left (default), centrally or to the right.', 'megamenu' ), |
|
| 1058 | - 'info' => array( __( "This option will apply to all menu items. To align an individual menu item to the right, edit the menu item itself and set 'Menu Item Align' to 'Right'.", 'megamenu' ) ), |
|
| 1059 | - 'settings' => array( |
|
| 1060 | - array( |
|
| 1061 | - 'title' => '', |
|
| 1062 | - 'type' => 'align', |
|
| 1063 | - 'key' => 'menu_item_align', |
|
| 1064 | - ), |
|
| 1065 | - ), |
|
| 1066 | - ), |
|
| 1067 | - 'menu_item_font' => array( |
|
| 1068 | - 'priority' => 60, |
|
| 1069 | - 'title' => __( 'Item Font', 'megamenu' ), |
|
| 1070 | - 'description' => __( 'The font to use for each top level menu item.', 'megamenu' ), |
|
| 1071 | - 'settings' => array( |
|
| 1072 | - array( |
|
| 1073 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1074 | - 'type' => 'color', |
|
| 1075 | - 'key' => 'menu_item_link_color', |
|
| 1076 | - ), |
|
| 1077 | - array( |
|
| 1078 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 1079 | - 'type' => 'freetext', |
|
| 1080 | - 'key' => 'menu_item_link_font_size', |
|
| 1081 | - 'validation' => 'px', |
|
| 1082 | - ), |
|
| 1083 | - array( |
|
| 1084 | - 'title' => __( 'Family', 'megamenu' ), |
|
| 1085 | - 'type' => 'font', |
|
| 1086 | - 'key' => 'menu_item_link_font', |
|
| 1087 | - ), |
|
| 1088 | - array( |
|
| 1089 | - 'title' => __( 'Transform', 'megamenu' ), |
|
| 1090 | - 'type' => 'transform', |
|
| 1091 | - 'key' => 'menu_item_link_text_transform', |
|
| 1092 | - ), |
|
| 1093 | - array( |
|
| 1094 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1095 | - 'type' => 'weight', |
|
| 1096 | - 'key' => 'menu_item_link_weight', |
|
| 1097 | - ), |
|
| 1098 | - array( |
|
| 1099 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1100 | - 'type' => 'decoration', |
|
| 1101 | - 'key' => 'menu_item_link_text_decoration', |
|
| 1102 | - ), |
|
| 1103 | - array( |
|
| 1104 | - 'title' => __( 'Align', 'megamenu' ), |
|
| 1105 | - 'type' => 'align', |
|
| 1106 | - 'key' => 'menu_item_link_text_align', |
|
| 1107 | - ), |
|
| 1108 | - ), |
|
| 1109 | - ), |
|
| 1110 | - 'menu_item_font_hover' => array( |
|
| 1111 | - 'priority' => 65, |
|
| 1112 | - 'title' => __( 'Item Font (Hover)', 'megamenu' ), |
|
| 1113 | - 'description' => __( 'Set the font to use for each top level menu item (on hover).', 'megamenu' ), |
|
| 1114 | - 'settings' => array( |
|
| 1115 | - array( |
|
| 1116 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1117 | - 'type' => 'color', |
|
| 1118 | - 'key' => 'menu_item_link_color_hover', |
|
| 1119 | - ), |
|
| 1120 | - array( |
|
| 1121 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1122 | - 'type' => 'weight', |
|
| 1123 | - 'key' => 'menu_item_link_weight_hover', |
|
| 1124 | - ), |
|
| 1125 | - array( |
|
| 1126 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1127 | - 'type' => 'decoration', |
|
| 1128 | - 'key' => 'menu_item_link_text_decoration_hover', |
|
| 1129 | - ), |
|
| 1130 | - ), |
|
| 1131 | - ), |
|
| 1132 | - 'menu_item_background' => array( |
|
| 1133 | - 'priority' => 70, |
|
| 1134 | - 'title' => __( 'Item Background', 'megamenu' ), |
|
| 1135 | - 'description' => __( "The background color for each top level menu item. Tip: Set these values to transparent if you've already set a background color on the menu bar.", 'megamenu' ), |
|
| 1136 | - 'settings' => array( |
|
| 1137 | - array( |
|
| 1138 | - 'title' => __( 'From', 'megamenu' ), |
|
| 1139 | - 'type' => 'color', |
|
| 1140 | - 'key' => 'menu_item_background_from', |
|
| 1141 | - ), |
|
| 1142 | - array( |
|
| 1143 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 1144 | - 'type' => 'copy_color', |
|
| 1145 | - 'key' => 'copy_color', |
|
| 1146 | - ), |
|
| 1147 | - array( |
|
| 1148 | - 'title' => __( 'To', 'megamenu' ), |
|
| 1149 | - 'type' => 'color', |
|
| 1150 | - 'key' => 'menu_item_background_to', |
|
| 1151 | - ), |
|
| 1152 | - ), |
|
| 1153 | - ), |
|
| 1154 | - 'menu_item_background_hover' => array( |
|
| 1155 | - 'priority' => 75, |
|
| 1156 | - 'title' => __( 'Item Background (Hover)', 'megamenu' ), |
|
| 1157 | - 'description' => __( 'The background color for a top level menu item (on hover).', 'megamenu' ), |
|
| 1158 | - 'settings' => array( |
|
| 1159 | - array( |
|
| 1160 | - 'title' => __( 'From', 'megamenu' ), |
|
| 1161 | - 'type' => 'color', |
|
| 1162 | - 'key' => 'menu_item_background_hover_from', |
|
| 1163 | - ), |
|
| 1164 | - array( |
|
| 1165 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 1166 | - 'type' => 'copy_color', |
|
| 1167 | - 'key' => 'copy_color', |
|
| 1168 | - ), |
|
| 1169 | - array( |
|
| 1170 | - 'title' => __( 'To', 'megamenu' ), |
|
| 1171 | - 'type' => 'color', |
|
| 1172 | - 'key' => 'menu_item_background_hover_to', |
|
| 1173 | - ), |
|
| 1174 | - ), |
|
| 1175 | - ), |
|
| 1176 | - 'menu_item_spacing' => array( |
|
| 1177 | - 'priority' => 80, |
|
| 1178 | - 'title' => __( 'Item Spacing', 'megamenu' ), |
|
| 1179 | - 'description' => __( 'Define the size of the gap between each top level menu item.', 'megamenu' ), |
|
| 1180 | - 'settings' => array( |
|
| 1181 | - array( |
|
| 1182 | - 'title' => '', |
|
| 1183 | - 'type' => 'freetext', |
|
| 1184 | - 'key' => 'menu_item_spacing', |
|
| 1185 | - 'validation' => 'px', |
|
| 1186 | - ), |
|
| 1187 | - ), |
|
| 1188 | - ), |
|
| 1189 | - |
|
| 1190 | - 'menu_item_padding' => array( |
|
| 1191 | - 'priority' => 85, |
|
| 1192 | - 'title' => __( 'Item Padding', 'megamenu' ), |
|
| 1193 | - 'description' => __( 'Set the padding for each top level menu item.', 'megamenu' ), |
|
| 1194 | - 'info' => array( __( "Generally we advise against using the Top and Bottom options here. Use the 'Menu Height' setting to determine the height of your top level menu items.", 'megamenu' ) ), |
|
| 1195 | - 'settings' => array( |
|
| 1196 | - array( |
|
| 1197 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1198 | - 'type' => 'freetext', |
|
| 1199 | - 'key' => 'menu_item_link_padding_top', |
|
| 1200 | - 'validation' => 'px', |
|
| 1201 | - ), |
|
| 1202 | - array( |
|
| 1203 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1204 | - 'type' => 'freetext', |
|
| 1205 | - 'key' => 'menu_item_link_padding_right', |
|
| 1206 | - 'validation' => 'px', |
|
| 1207 | - ), |
|
| 1208 | - array( |
|
| 1209 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1210 | - 'type' => 'freetext', |
|
| 1211 | - 'key' => 'menu_item_link_padding_bottom', |
|
| 1212 | - 'validation' => 'px', |
|
| 1213 | - ), |
|
| 1214 | - array( |
|
| 1215 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1216 | - 'type' => 'freetext', |
|
| 1217 | - 'key' => 'menu_item_link_padding_left', |
|
| 1218 | - 'validation' => 'px', |
|
| 1219 | - ), |
|
| 1220 | - ), |
|
| 1221 | - ), |
|
| 1222 | - 'menu_item_border' => array( |
|
| 1223 | - 'priority' => 90, |
|
| 1224 | - 'title' => __( 'Item Border', 'megamenu' ), |
|
| 1225 | - 'description' => __( 'Set the border to display on each top level menu item.', 'megamenu' ), |
|
| 1226 | - 'settings' => array( |
|
| 1227 | - array( |
|
| 1228 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1229 | - 'type' => 'color', |
|
| 1230 | - 'key' => 'menu_item_border_color', |
|
| 1231 | - ), |
|
| 1232 | - array( |
|
| 1233 | - 'title' => __( 'Color (Hover)', 'megamenu' ), |
|
| 1234 | - 'type' => 'color', |
|
| 1235 | - 'key' => 'menu_item_border_color_hover', |
|
| 1236 | - ), |
|
| 1237 | - array( |
|
| 1238 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1239 | - 'type' => 'freetext', |
|
| 1240 | - 'key' => 'menu_item_border_top', |
|
| 1241 | - 'validation' => 'px', |
|
| 1242 | - ), |
|
| 1243 | - array( |
|
| 1244 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1245 | - 'type' => 'freetext', |
|
| 1246 | - 'key' => 'menu_item_border_right', |
|
| 1247 | - 'validation' => 'px', |
|
| 1248 | - ), |
|
| 1249 | - array( |
|
| 1250 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1251 | - 'type' => 'freetext', |
|
| 1252 | - 'key' => 'menu_item_border_bottom', |
|
| 1253 | - 'validation' => 'px', |
|
| 1254 | - ), |
|
| 1255 | - array( |
|
| 1256 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1257 | - 'type' => 'freetext', |
|
| 1258 | - 'key' => 'menu_item_border_left', |
|
| 1259 | - 'validation' => 'px', |
|
| 1260 | - ), |
|
| 1261 | - ), |
|
| 1262 | - ), |
|
| 1263 | - 'menu_item_border_radius' => array( |
|
| 1264 | - 'priority' => 95, |
|
| 1265 | - 'title' => __( 'Item Border Radius', 'megamenu' ), |
|
| 1266 | - 'description' => __( 'Set rounded corners for each top level menu item.', 'megamenu' ), |
|
| 1267 | - 'settings' => array( |
|
| 1268 | - array( |
|
| 1269 | - 'title' => __( 'Top Left', 'megamenu' ), |
|
| 1270 | - 'type' => 'freetext', |
|
| 1271 | - 'key' => 'menu_item_link_border_radius_top_left', |
|
| 1272 | - 'validation' => 'px', |
|
| 1273 | - ), |
|
| 1274 | - array( |
|
| 1275 | - 'title' => __( 'Top Right', 'megamenu' ), |
|
| 1276 | - 'type' => 'freetext', |
|
| 1277 | - 'key' => 'menu_item_link_border_radius_top_right', |
|
| 1278 | - 'validation' => 'px', |
|
| 1279 | - ), |
|
| 1280 | - array( |
|
| 1281 | - 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 1282 | - 'type' => 'freetext', |
|
| 1283 | - 'key' => 'menu_item_link_border_radius_bottom_right', |
|
| 1284 | - 'validation' => 'px', |
|
| 1285 | - ), |
|
| 1286 | - array( |
|
| 1287 | - 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 1288 | - 'type' => 'freetext', |
|
| 1289 | - 'key' => 'menu_item_link_border_radius_bottom_left', |
|
| 1290 | - 'validation' => 'px', |
|
| 1291 | - ), |
|
| 1292 | - ), |
|
| 1293 | - ), |
|
| 1294 | - 'menu_item_divider' => array( |
|
| 1295 | - 'priority' => 160, |
|
| 1296 | - 'title' => __( 'Item Divider', 'megamenu' ), |
|
| 1297 | - 'description' => __( 'Show a small divider bar between each menu item.', 'megamenu' ), |
|
| 1298 | - 'settings' => array( |
|
| 1299 | - array( |
|
| 1300 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 1301 | - 'type' => 'checkbox', |
|
| 1302 | - 'key' => 'menu_item_divider', |
|
| 1303 | - ), |
|
| 1304 | - array( |
|
| 1305 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1306 | - 'type' => 'color', |
|
| 1307 | - 'key' => 'menu_item_divider_color', |
|
| 1308 | - ), |
|
| 1309 | - array( |
|
| 1310 | - 'title' => __( 'Glow Opacity', 'megamenu' ), |
|
| 1311 | - 'type' => 'freetext', |
|
| 1312 | - 'key' => 'menu_item_divider_glow_opacity', |
|
| 1313 | - 'validation' => 'float', |
|
| 1314 | - ), |
|
| 1315 | - ), |
|
| 1316 | - ), |
|
| 1317 | - 'menu_item_highlight' => array( |
|
| 1318 | - 'priority' => 170, |
|
| 1319 | - 'title' => __( 'Highlight Current Item', 'megamenu' ), |
|
| 1320 | - 'description' => __( "Apply the 'hover' styling to current menu items. Applies to top level menu items only.", 'megamenu' ), |
|
| 1321 | - 'settings' => array( |
|
| 1322 | - array( |
|
| 1323 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 1324 | - 'type' => 'checkbox', |
|
| 1325 | - 'key' => 'menu_item_highlight_current', |
|
| 1326 | - ), |
|
| 1327 | - ), |
|
| 1328 | - 'info' => array( |
|
| 1329 | - "<a href='https://www.megamenu.com/documentation/highlight-active-menu-items/' target='blank'>" . __( 'Documentation: Highlighting Menu Items', 'megamenu' ) . '</a>', |
|
| 1330 | - ), |
|
| 1331 | - ), |
|
| 1332 | - ), |
|
| 1333 | - ), |
|
| 1334 | - 'mega_panels' => array( |
|
| 1335 | - 'title' => __( 'Mega Menus', 'megamenu' ), |
|
| 1336 | - 'settings' => array( |
|
| 1337 | - 'panel_background' => array( |
|
| 1338 | - 'priority' => 10, |
|
| 1339 | - 'title' => __( 'Panel Background', 'megamenu' ), |
|
| 1340 | - 'description' => __( 'Set a background color for a whole sub menu.', 'megamenu' ), |
|
| 1341 | - 'settings' => array( |
|
| 1342 | - array( |
|
| 1343 | - 'title' => __( 'From', 'megamenu' ), |
|
| 1344 | - 'type' => 'color', |
|
| 1345 | - 'key' => 'panel_background_from', |
|
| 1346 | - ), |
|
| 1347 | - array( |
|
| 1348 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 1349 | - 'type' => 'copy_color', |
|
| 1350 | - 'key' => 'copy_color', |
|
| 1351 | - ), |
|
| 1352 | - array( |
|
| 1353 | - 'title' => __( 'To', 'megamenu' ), |
|
| 1354 | - 'type' => 'color', |
|
| 1355 | - 'key' => 'panel_background_to', |
|
| 1356 | - ), |
|
| 1357 | - ), |
|
| 1358 | - ), |
|
| 1359 | - 'panel_width' => array( |
|
| 1360 | - 'priority' => 20, |
|
| 1361 | - 'title' => __( 'Panel Width', 'megamenu' ), |
|
| 1362 | - 'description' => __( 'Mega Panel width.', 'megamenu' ), |
|
| 1363 | - 'info' => array( |
|
| 1364 | - __( 'A 100% wide panel will only ever be as wide as the menu itself. For a fixed sub menu width set this to a pixel value.', 'megamenu' ), |
|
| 1365 | - __( 'Advanced: Enter a jQuery selector to synchronize the width and position of the sub menu with existing page element (e.g. body, #container, .page).', 'megamenu' ), |
|
| 1366 | - "<a href='https://www.megamenu.com/documentation/adjust-sub-menu-width/' target='blank'>" . __( 'Documentation: Configuring the sub menu width', 'megamenu' ) . '</a>', |
|
| 1367 | - ), |
|
| 1368 | - 'settings' => array( |
|
| 1369 | - array( |
|
| 1370 | - 'title' => __( 'Outer Width', 'megamenu' ), |
|
| 1371 | - 'type' => 'freetext', |
|
| 1372 | - 'key' => 'panel_width', |
|
| 1373 | - ), |
|
| 1374 | - array( |
|
| 1375 | - 'title' => __( 'Inner Width', 'megamenu' ), |
|
| 1376 | - 'type' => 'freetext', |
|
| 1377 | - 'key' => 'panel_inner_width', |
|
| 1378 | - ), |
|
| 1379 | - ), |
|
| 1380 | - ), |
|
| 1381 | - 'panel_padding' => array( |
|
| 1382 | - 'priority' => 30, |
|
| 1383 | - 'title' => __( 'Panel Padding', 'megamenu' ), |
|
| 1384 | - 'description' => __( 'Set the padding for the whole sub menu. Set these values 0px if you wish your sub menu content to go edge-to-edge.', 'megamenu' ), |
|
| 1385 | - 'settings' => array( |
|
| 1386 | - array( |
|
| 1387 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1388 | - 'type' => 'freetext', |
|
| 1389 | - 'key' => 'panel_padding_top', |
|
| 1390 | - 'validation' => 'px', |
|
| 1391 | - ), |
|
| 1392 | - array( |
|
| 1393 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1394 | - 'type' => 'freetext', |
|
| 1395 | - 'key' => 'panel_padding_right', |
|
| 1396 | - 'validation' => 'px', |
|
| 1397 | - ), |
|
| 1398 | - array( |
|
| 1399 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1400 | - 'type' => 'freetext', |
|
| 1401 | - 'key' => 'panel_padding_bottom', |
|
| 1402 | - 'validation' => 'px', |
|
| 1403 | - ), |
|
| 1404 | - array( |
|
| 1405 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1406 | - 'type' => 'freetext', |
|
| 1407 | - 'key' => 'panel_padding_left', |
|
| 1408 | - 'validation' => 'px', |
|
| 1409 | - ), |
|
| 1410 | - ), |
|
| 1411 | - ), |
|
| 1412 | - 'panel_border' => array( |
|
| 1413 | - 'priority' => 40, |
|
| 1414 | - 'title' => __( 'Panel Border', 'megamenu' ), |
|
| 1415 | - 'description' => __( 'Set the border to display on the sub menu.', 'megamenu' ), |
|
| 1416 | - 'settings' => array( |
|
| 1417 | - array( |
|
| 1418 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1419 | - 'type' => 'color', |
|
| 1420 | - 'key' => 'panel_border_color', |
|
| 1421 | - ), |
|
| 1422 | - array( |
|
| 1423 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1424 | - 'type' => 'freetext', |
|
| 1425 | - 'key' => 'panel_border_top', |
|
| 1426 | - 'validation' => 'px', |
|
| 1427 | - ), |
|
| 1428 | - array( |
|
| 1429 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1430 | - 'type' => 'freetext', |
|
| 1431 | - 'key' => 'panel_border_right', |
|
| 1432 | - 'validation' => 'px', |
|
| 1433 | - ), |
|
| 1434 | - array( |
|
| 1435 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1436 | - 'type' => 'freetext', |
|
| 1437 | - 'key' => 'panel_border_bottom', |
|
| 1438 | - 'validation' => 'px', |
|
| 1439 | - ), |
|
| 1440 | - array( |
|
| 1441 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1442 | - 'type' => 'freetext', |
|
| 1443 | - 'key' => 'panel_border_left', |
|
| 1444 | - 'validation' => 'px', |
|
| 1445 | - ), |
|
| 1446 | - ), |
|
| 1447 | - ), |
|
| 1448 | - 'panel_border_radius' => array( |
|
| 1449 | - 'priority' => 50, |
|
| 1450 | - 'title' => __( 'Panel Border Radius', 'megamenu' ), |
|
| 1451 | - 'description' => __( 'Set rounded corners for the sub menu.', 'megamenu' ), |
|
| 1452 | - 'settings' => array( |
|
| 1453 | - array( |
|
| 1454 | - 'title' => __( 'Top Left', 'megamenu' ), |
|
| 1455 | - 'type' => 'freetext', |
|
| 1456 | - 'key' => 'panel_border_radius_top_left', |
|
| 1457 | - 'validation' => 'px', |
|
| 1458 | - ), |
|
| 1459 | - array( |
|
| 1460 | - 'title' => __( 'Top Right', 'megamenu' ), |
|
| 1461 | - 'type' => 'freetext', |
|
| 1462 | - 'key' => 'panel_border_radius_top_right', |
|
| 1463 | - 'validation' => 'px', |
|
| 1464 | - ), |
|
| 1465 | - array( |
|
| 1466 | - 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 1467 | - 'type' => 'freetext', |
|
| 1468 | - 'key' => 'panel_border_radius_bottom_right', |
|
| 1469 | - 'validation' => 'px', |
|
| 1470 | - ), |
|
| 1471 | - array( |
|
| 1472 | - 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 1473 | - 'type' => 'freetext', |
|
| 1474 | - 'key' => 'panel_border_radius_bottom_left', |
|
| 1475 | - 'validation' => 'px', |
|
| 1476 | - ), |
|
| 1477 | - ), |
|
| 1478 | - ), |
|
| 1479 | - 'widget_padding' => array( |
|
| 1480 | - 'priority' => 60, |
|
| 1481 | - 'title' => __( 'Column Padding', 'megamenu' ), |
|
| 1482 | - 'description' => __( 'Use this to define the amount of space around each widget / set of menu items within the sub menu.', 'megamenu' ), |
|
| 1483 | - 'settings' => array( |
|
| 1484 | - array( |
|
| 1485 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1486 | - 'type' => 'freetext', |
|
| 1487 | - 'key' => 'panel_widget_padding_top', |
|
| 1488 | - 'validation' => 'px', |
|
| 1489 | - ), |
|
| 1490 | - array( |
|
| 1491 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1492 | - 'type' => 'freetext', |
|
| 1493 | - 'key' => 'panel_widget_padding_right', |
|
| 1494 | - 'validation' => 'px', |
|
| 1495 | - ), |
|
| 1496 | - array( |
|
| 1497 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1498 | - 'type' => 'freetext', |
|
| 1499 | - 'key' => 'panel_widget_padding_bottom', |
|
| 1500 | - 'validation' => 'px', |
|
| 1501 | - ), |
|
| 1502 | - array( |
|
| 1503 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1504 | - 'type' => 'freetext', |
|
| 1505 | - 'key' => 'panel_widget_padding_left', |
|
| 1506 | - 'validation' => 'px', |
|
| 1507 | - ), |
|
| 1508 | - ), |
|
| 1509 | - ), |
|
| 1510 | - 'mega_menu_widgets' => array( |
|
| 1511 | - 'priority' => 65, |
|
| 1512 | - 'title' => __( 'Widgets', 'megamenu' ), |
|
| 1513 | - 'description' => '', |
|
| 1514 | - ), |
|
| 1515 | - 'widget_heading_font' => array( |
|
| 1516 | - 'priority' => 70, |
|
| 1517 | - 'title' => __( 'Title Font', 'megamenu' ), |
|
| 1518 | - 'description' => __( 'Set the font to use Widget headers in the mega menu. Tip: set this to the same style as the Second Level Menu Item Font to keep your styling consistent.', 'megamenu' ), |
|
| 1519 | - 'settings' => array( |
|
| 1520 | - array( |
|
| 1521 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1522 | - 'type' => 'color', |
|
| 1523 | - 'key' => 'panel_header_color', |
|
| 1524 | - ), |
|
| 1525 | - array( |
|
| 1526 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 1527 | - 'type' => 'freetext', |
|
| 1528 | - 'key' => 'panel_header_font_size', |
|
| 1529 | - 'validation' => 'px', |
|
| 1530 | - ), |
|
| 1531 | - array( |
|
| 1532 | - 'title' => __( 'Family', 'megamenu' ), |
|
| 1533 | - 'type' => 'font', |
|
| 1534 | - 'key' => 'panel_header_font', |
|
| 1535 | - ), |
|
| 1536 | - array( |
|
| 1537 | - 'title' => __( 'Transform', 'megamenu' ), |
|
| 1538 | - 'type' => 'transform', |
|
| 1539 | - 'key' => 'panel_header_text_transform', |
|
| 1540 | - ), |
|
| 1541 | - array( |
|
| 1542 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1543 | - 'type' => 'weight', |
|
| 1544 | - 'key' => 'panel_header_font_weight', |
|
| 1545 | - ), |
|
| 1546 | - array( |
|
| 1547 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1548 | - 'type' => 'decoration', |
|
| 1549 | - 'key' => 'panel_header_text_decoration', |
|
| 1550 | - ), |
|
| 1551 | - array( |
|
| 1552 | - 'title' => __( 'Align', 'megamenu' ), |
|
| 1553 | - 'type' => 'align', |
|
| 1554 | - 'key' => 'panel_header_text_align', |
|
| 1555 | - ), |
|
| 1556 | - ), |
|
| 1557 | - ), |
|
| 1558 | - 'widget_heading_padding' => array( |
|
| 1559 | - 'priority' => 90, |
|
| 1560 | - 'title' => __( 'Title Padding', 'megamenu' ), |
|
| 1561 | - 'description' => __( 'Set the padding for the widget headings.', 'megamenu' ), |
|
| 1562 | - 'settings' => array( |
|
| 1563 | - array( |
|
| 1564 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1565 | - 'type' => 'freetext', |
|
| 1566 | - 'key' => 'panel_header_padding_top', |
|
| 1567 | - 'validation' => 'px', |
|
| 1568 | - ), |
|
| 1569 | - array( |
|
| 1570 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1571 | - 'type' => 'freetext', |
|
| 1572 | - 'key' => 'panel_header_padding_right', |
|
| 1573 | - 'validation' => 'px', |
|
| 1574 | - ), |
|
| 1575 | - array( |
|
| 1576 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1577 | - 'type' => 'freetext', |
|
| 1578 | - 'key' => 'panel_header_padding_bottom', |
|
| 1579 | - 'validation' => 'px', |
|
| 1580 | - ), |
|
| 1581 | - array( |
|
| 1582 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1583 | - 'type' => 'freetext', |
|
| 1584 | - 'key' => 'panel_header_padding_left', |
|
| 1585 | - 'validation' => 'px', |
|
| 1586 | - ), |
|
| 1587 | - ), |
|
| 1588 | - ), |
|
| 1589 | - 'widget_heading_margin' => array( |
|
| 1590 | - 'priority' => 100, |
|
| 1591 | - 'title' => __( 'Title Margin', 'megamenu' ), |
|
| 1592 | - 'description' => __( 'Set the margin for the widget headings.', 'megamenu' ), |
|
| 1593 | - 'settings' => array( |
|
| 1594 | - array( |
|
| 1595 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1596 | - 'type' => 'freetext', |
|
| 1597 | - 'key' => 'panel_header_margin_top', |
|
| 1598 | - 'validation' => 'px', |
|
| 1599 | - ), |
|
| 1600 | - array( |
|
| 1601 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1602 | - 'type' => 'freetext', |
|
| 1603 | - 'key' => 'panel_header_margin_right', |
|
| 1604 | - 'validation' => 'px', |
|
| 1605 | - ), |
|
| 1606 | - array( |
|
| 1607 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1608 | - 'type' => 'freetext', |
|
| 1609 | - 'key' => 'panel_header_margin_bottom', |
|
| 1610 | - 'validation' => 'px', |
|
| 1611 | - ), |
|
| 1612 | - array( |
|
| 1613 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1614 | - 'type' => 'freetext', |
|
| 1615 | - 'key' => 'panel_header_margin_left', |
|
| 1616 | - 'validation' => 'px', |
|
| 1617 | - ), |
|
| 1618 | - ), |
|
| 1619 | - ), |
|
| 1620 | - 'widget_header_border' => array( |
|
| 1621 | - 'priority' => 110, |
|
| 1622 | - 'title' => __( 'Title Border', 'megamenu' ), |
|
| 1623 | - 'description' => __( 'Set the border for the widget headings.', 'megamenu' ), |
|
| 1624 | - 'settings' => array( |
|
| 1625 | - array( |
|
| 1626 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1627 | - 'type' => 'color', |
|
| 1628 | - 'key' => 'panel_header_border_color', |
|
| 1629 | - ), |
|
| 1630 | - array( |
|
| 1631 | - 'title' => __( 'Color (Hover)', 'megamenu' ), |
|
| 1632 | - 'type' => 'color', |
|
| 1633 | - 'key' => 'panel_header_border_color_hover', |
|
| 1634 | - ), |
|
| 1635 | - array( |
|
| 1636 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1637 | - 'type' => 'freetext', |
|
| 1638 | - 'key' => 'panel_header_border_top', |
|
| 1639 | - 'validation' => 'px', |
|
| 1640 | - ), |
|
| 1641 | - array( |
|
| 1642 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1643 | - 'type' => 'freetext', |
|
| 1644 | - 'key' => 'panel_header_border_right', |
|
| 1645 | - 'validation' => 'px', |
|
| 1646 | - ), |
|
| 1647 | - array( |
|
| 1648 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1649 | - 'type' => 'freetext', |
|
| 1650 | - 'key' => 'panel_header_border_bottom', |
|
| 1651 | - 'validation' => 'px', |
|
| 1652 | - ), |
|
| 1653 | - array( |
|
| 1654 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1655 | - 'type' => 'freetext', |
|
| 1656 | - 'key' => 'panel_header_border_left', |
|
| 1657 | - 'validation' => 'px', |
|
| 1658 | - ), |
|
| 1659 | - ), |
|
| 1660 | - ), |
|
| 1661 | - 'widget_content_font' => array( |
|
| 1662 | - 'priority' => 115, |
|
| 1663 | - 'title' => __( 'Content Font', 'megamenu' ), |
|
| 1664 | - 'description' => __( 'Set the font to use for panel contents.', 'megamenu' ), |
|
| 1665 | - 'settings' => array( |
|
| 1666 | - array( |
|
| 1667 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1668 | - 'type' => 'color', |
|
| 1669 | - 'key' => 'panel_font_color', |
|
| 1670 | - ), |
|
| 1671 | - array( |
|
| 1672 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 1673 | - 'type' => 'freetext', |
|
| 1674 | - 'key' => 'panel_font_size', |
|
| 1675 | - 'validation' => 'px', |
|
| 1676 | - ), |
|
| 1677 | - array( |
|
| 1678 | - 'title' => __( 'Family', 'megamenu' ), |
|
| 1679 | - 'type' => 'font', |
|
| 1680 | - 'key' => 'panel_font_family', |
|
| 1681 | - ), |
|
| 1682 | - ), |
|
| 1683 | - ), |
|
| 1684 | - 'second_level_menu_items' => array( |
|
| 1685 | - 'priority' => 120, |
|
| 1686 | - 'title' => __( 'Second Level Menu Items', 'megamenu' ), |
|
| 1687 | - 'description' => '', |
|
| 1688 | - ), |
|
| 1689 | - 'second_level_font' => array( |
|
| 1690 | - 'priority' => 130, |
|
| 1691 | - 'title' => __( 'Item Font', 'megamenu' ), |
|
| 1692 | - 'description' => __( "Set the font for second level menu items when they're displayed in a Mega Menu.", 'megamenu' ), |
|
| 1693 | - 'settings' => array( |
|
| 1694 | - array( |
|
| 1695 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1696 | - 'type' => 'color', |
|
| 1697 | - 'key' => 'panel_second_level_font_color', |
|
| 1698 | - ), |
|
| 1699 | - array( |
|
| 1700 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 1701 | - 'type' => 'freetext', |
|
| 1702 | - 'key' => 'panel_second_level_font_size', |
|
| 1703 | - 'validation' => 'px', |
|
| 1704 | - ), |
|
| 1705 | - array( |
|
| 1706 | - 'title' => __( 'Family', 'megamenu' ), |
|
| 1707 | - 'type' => 'font', |
|
| 1708 | - 'key' => 'panel_second_level_font', |
|
| 1709 | - ), |
|
| 1710 | - array( |
|
| 1711 | - 'title' => __( 'Transform', 'megamenu' ), |
|
| 1712 | - 'type' => 'transform', |
|
| 1713 | - 'key' => 'panel_second_level_text_transform', |
|
| 1714 | - ), |
|
| 1715 | - array( |
|
| 1716 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1717 | - 'type' => 'weight', |
|
| 1718 | - 'key' => 'panel_second_level_font_weight', |
|
| 1719 | - ), |
|
| 1720 | - array( |
|
| 1721 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1722 | - 'type' => 'decoration', |
|
| 1723 | - 'key' => 'panel_second_level_text_decoration', |
|
| 1724 | - ), |
|
| 1725 | - array( |
|
| 1726 | - 'title' => __( 'Align', 'megamenu' ), |
|
| 1727 | - 'type' => 'align', |
|
| 1728 | - 'key' => 'panel_second_level_text_align', |
|
| 1729 | - ), |
|
| 1730 | - ), |
|
| 1731 | - ), |
|
| 1732 | - 'second_level_font_hover' => array( |
|
| 1733 | - 'priority' => 140, |
|
| 1734 | - 'title' => __( 'Item Font (Hover)', 'megamenu' ), |
|
| 1735 | - 'description' => __( 'Set the font style on hover.', 'megamenu' ), |
|
| 1736 | - 'settings' => array( |
|
| 1737 | - array( |
|
| 1738 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1739 | - 'type' => 'color', |
|
| 1740 | - 'key' => 'panel_second_level_font_color_hover', |
|
| 1741 | - ), |
|
| 1742 | - array( |
|
| 1743 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1744 | - 'type' => 'weight', |
|
| 1745 | - 'key' => 'panel_second_level_font_weight_hover', |
|
| 1746 | - ), |
|
| 1747 | - array( |
|
| 1748 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1749 | - 'type' => 'decoration', |
|
| 1750 | - 'key' => 'panel_second_level_text_decoration_hover', |
|
| 1751 | - ), |
|
| 1752 | - ), |
|
| 1753 | - ), |
|
| 1754 | - 'second_level_background_hover' => array( |
|
| 1755 | - 'priority' => 150, |
|
| 1756 | - 'title' => __( 'Item Background (Hover)', 'megamenu' ), |
|
| 1757 | - 'description' => __( 'Set the background hover color for second level menu items.', 'megamenu' ), |
|
| 1758 | - 'settings' => array( |
|
| 1759 | - array( |
|
| 1760 | - 'title' => __( 'From', 'megamenu' ), |
|
| 1761 | - 'type' => 'color', |
|
| 1762 | - 'key' => 'panel_second_level_background_hover_from', |
|
| 1763 | - ), |
|
| 1764 | - array( |
|
| 1765 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 1766 | - 'type' => 'copy_color', |
|
| 1767 | - 'key' => 'copy_color', |
|
| 1768 | - ), |
|
| 1769 | - array( |
|
| 1770 | - 'title' => __( 'To', 'megamenu' ), |
|
| 1771 | - 'type' => 'color', |
|
| 1772 | - 'key' => 'panel_second_level_background_hover_to', |
|
| 1773 | - ), |
|
| 1774 | - ), |
|
| 1775 | - ), |
|
| 1776 | - 'second_level_padding' => array( |
|
| 1777 | - 'priority' => 160, |
|
| 1778 | - 'title' => __( 'Item Padding', 'megamenu' ), |
|
| 1779 | - 'description' => __( 'Set the padding for the second level menu items.', 'megamenu' ), |
|
| 1780 | - 'settings' => array( |
|
| 1781 | - array( |
|
| 1782 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1783 | - 'type' => 'freetext', |
|
| 1784 | - 'key' => 'panel_second_level_padding_top', |
|
| 1785 | - 'validation' => 'px', |
|
| 1786 | - ), |
|
| 1787 | - array( |
|
| 1788 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1789 | - 'type' => 'freetext', |
|
| 1790 | - 'key' => 'panel_second_level_padding_right', |
|
| 1791 | - 'validation' => 'px', |
|
| 1792 | - ), |
|
| 1793 | - array( |
|
| 1794 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1795 | - 'type' => 'freetext', |
|
| 1796 | - 'key' => 'panel_second_level_padding_bottom', |
|
| 1797 | - 'validation' => 'px', |
|
| 1798 | - ), |
|
| 1799 | - array( |
|
| 1800 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1801 | - 'type' => 'freetext', |
|
| 1802 | - 'key' => 'panel_second_level_padding_left', |
|
| 1803 | - 'validation' => 'px', |
|
| 1804 | - ), |
|
| 1805 | - ), |
|
| 1806 | - ), |
|
| 1807 | - 'second_level_margin' => array( |
|
| 1808 | - 'priority' => 170, |
|
| 1809 | - 'title' => __( 'Item Margin', 'megamenu' ), |
|
| 1810 | - 'description' => __( 'Set the margin for the second level menu items.', 'megamenu' ), |
|
| 1811 | - 'settings' => array( |
|
| 1812 | - array( |
|
| 1813 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1814 | - 'type' => 'freetext', |
|
| 1815 | - 'key' => 'panel_second_level_margin_top', |
|
| 1816 | - 'validation' => 'px', |
|
| 1817 | - ), |
|
| 1818 | - array( |
|
| 1819 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1820 | - 'type' => 'freetext', |
|
| 1821 | - 'key' => 'panel_second_level_margin_right', |
|
| 1822 | - 'validation' => 'px', |
|
| 1823 | - ), |
|
| 1824 | - array( |
|
| 1825 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1826 | - 'type' => 'freetext', |
|
| 1827 | - 'key' => 'panel_second_level_margin_bottom', |
|
| 1828 | - 'validation' => 'px', |
|
| 1829 | - ), |
|
| 1830 | - array( |
|
| 1831 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1832 | - 'type' => 'freetext', |
|
| 1833 | - 'key' => 'panel_second_level_margin_left', |
|
| 1834 | - 'validation' => 'px', |
|
| 1835 | - ), |
|
| 1836 | - ), |
|
| 1837 | - ), |
|
| 1838 | - 'second_level_border' => array( |
|
| 1839 | - 'priority' => 180, |
|
| 1840 | - 'title' => __( 'Item Border', 'megamenu' ), |
|
| 1841 | - 'description' => __( 'Set the border for the second level menu items.', 'megamenu' ), |
|
| 1842 | - 'settings' => array( |
|
| 1843 | - array( |
|
| 1844 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1845 | - 'type' => 'color', |
|
| 1846 | - 'key' => 'panel_second_level_border_color', |
|
| 1847 | - ), |
|
| 1848 | - array( |
|
| 1849 | - 'title' => __( 'Color (Hover)', 'megamenu' ), |
|
| 1850 | - 'type' => 'color', |
|
| 1851 | - 'key' => 'panel_second_level_border_color_hover', |
|
| 1852 | - ), |
|
| 1853 | - array( |
|
| 1854 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1855 | - 'type' => 'freetext', |
|
| 1856 | - 'key' => 'panel_second_level_border_top', |
|
| 1857 | - 'validation' => 'px', |
|
| 1858 | - ), |
|
| 1859 | - array( |
|
| 1860 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1861 | - 'type' => 'freetext', |
|
| 1862 | - 'key' => 'panel_second_level_border_right', |
|
| 1863 | - 'validation' => 'px', |
|
| 1864 | - ), |
|
| 1865 | - array( |
|
| 1866 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1867 | - 'type' => 'freetext', |
|
| 1868 | - 'key' => 'panel_second_level_border_bottom', |
|
| 1869 | - 'validation' => 'px', |
|
| 1870 | - ), |
|
| 1871 | - array( |
|
| 1872 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1873 | - 'type' => 'freetext', |
|
| 1874 | - 'key' => 'panel_second_level_border_left', |
|
| 1875 | - 'validation' => 'px', |
|
| 1876 | - ), |
|
| 1877 | - ), |
|
| 1878 | - ), |
|
| 1879 | - 'third_level_menu_items' => array( |
|
| 1880 | - 'priority' => 190, |
|
| 1881 | - 'title' => __( 'Third Level Menu Items', 'megamenu' ), |
|
| 1882 | - 'description' => '', |
|
| 1883 | - ), |
|
| 1884 | - 'third_level_font' => array( |
|
| 1885 | - 'priority' => 200, |
|
| 1886 | - 'title' => __( 'Item Font', 'megamenu' ), |
|
| 1887 | - 'description' => __( "Set the font for third level menu items when they're displayed in a Mega Menu.", 'megamenu' ), |
|
| 1888 | - 'settings' => array( |
|
| 1889 | - array( |
|
| 1890 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1891 | - 'type' => 'color', |
|
| 1892 | - 'key' => 'panel_third_level_font_color', |
|
| 1893 | - ), |
|
| 1894 | - array( |
|
| 1895 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 1896 | - 'type' => 'freetext', |
|
| 1897 | - 'key' => 'panel_third_level_font_size', |
|
| 1898 | - 'validation' => 'px', |
|
| 1899 | - ), |
|
| 1900 | - array( |
|
| 1901 | - 'title' => __( 'Family', 'megamenu' ), |
|
| 1902 | - 'type' => 'font', |
|
| 1903 | - 'key' => 'panel_third_level_font', |
|
| 1904 | - ), |
|
| 1905 | - array( |
|
| 1906 | - 'title' => __( 'Transform', 'megamenu' ), |
|
| 1907 | - 'type' => 'transform', |
|
| 1908 | - 'key' => 'panel_third_level_text_transform', |
|
| 1909 | - ), |
|
| 1910 | - array( |
|
| 1911 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1912 | - 'type' => 'weight', |
|
| 1913 | - 'key' => 'panel_third_level_font_weight', |
|
| 1914 | - ), |
|
| 1915 | - array( |
|
| 1916 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1917 | - 'type' => 'decoration', |
|
| 1918 | - 'key' => 'panel_third_level_text_decoration', |
|
| 1919 | - ), |
|
| 1920 | - array( |
|
| 1921 | - 'title' => __( 'Align', 'megamenu' ), |
|
| 1922 | - 'type' => 'align', |
|
| 1923 | - 'key' => 'panel_third_level_text_align', |
|
| 1924 | - ), |
|
| 1925 | - ), |
|
| 1926 | - ), |
|
| 1927 | - 'third_level_font_hover' => array( |
|
| 1928 | - 'priority' => 210, |
|
| 1929 | - 'title' => __( 'Item Font (Hover)', 'megamenu' ), |
|
| 1930 | - 'description' => __( 'Set the font style on hover.', 'megamenu' ), |
|
| 1931 | - 'settings' => array( |
|
| 1932 | - array( |
|
| 1933 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1934 | - 'type' => 'color', |
|
| 1935 | - 'key' => 'panel_third_level_font_color_hover', |
|
| 1936 | - ), |
|
| 1937 | - array( |
|
| 1938 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1939 | - 'type' => 'weight', |
|
| 1940 | - 'key' => 'panel_third_level_font_weight_hover', |
|
| 1941 | - ), |
|
| 1942 | - array( |
|
| 1943 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1944 | - 'type' => 'decoration', |
|
| 1945 | - 'key' => 'panel_third_level_text_decoration_hover', |
|
| 1946 | - ), |
|
| 1947 | - ), |
|
| 1948 | - ), |
|
| 1949 | - 'third_level_background_hover' => array( |
|
| 1950 | - 'priority' => 220, |
|
| 1951 | - 'title' => __( 'Item Background (Hover)', 'megamenu' ), |
|
| 1952 | - 'description' => __( 'Set the background hover color for third level menu items.', 'megamenu' ), |
|
| 1953 | - 'settings' => array( |
|
| 1954 | - array( |
|
| 1955 | - 'title' => __( 'From', 'megamenu' ), |
|
| 1956 | - 'type' => 'color', |
|
| 1957 | - 'key' => 'panel_third_level_background_hover_from', |
|
| 1958 | - ), |
|
| 1959 | - array( |
|
| 1960 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 1961 | - 'type' => 'copy_color', |
|
| 1962 | - 'key' => 'copy_color', |
|
| 1963 | - ), |
|
| 1964 | - array( |
|
| 1965 | - 'title' => __( 'To', 'megamenu' ), |
|
| 1966 | - 'type' => 'color', |
|
| 1967 | - 'key' => 'panel_third_level_background_hover_to', |
|
| 1968 | - ), |
|
| 1969 | - ), |
|
| 1970 | - ), |
|
| 1971 | - 'third_level_padding' => array( |
|
| 1972 | - 'priority' => 230, |
|
| 1973 | - 'title' => __( 'Item Padding', 'megamenu' ), |
|
| 1974 | - 'description' => __( 'Set the padding for the third level menu items.', 'megamenu' ), |
|
| 1975 | - 'settings' => array( |
|
| 1976 | - array( |
|
| 1977 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1978 | - 'type' => 'freetext', |
|
| 1979 | - 'key' => 'panel_third_level_padding_top', |
|
| 1980 | - 'validation' => 'px', |
|
| 1981 | - ), |
|
| 1982 | - array( |
|
| 1983 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1984 | - 'type' => 'freetext', |
|
| 1985 | - 'key' => 'panel_third_level_padding_right', |
|
| 1986 | - 'validation' => 'px', |
|
| 1987 | - ), |
|
| 1988 | - array( |
|
| 1989 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1990 | - 'type' => 'freetext', |
|
| 1991 | - 'key' => 'panel_third_level_padding_bottom', |
|
| 1992 | - 'validation' => 'px', |
|
| 1993 | - ), |
|
| 1994 | - array( |
|
| 1995 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1996 | - 'type' => 'freetext', |
|
| 1997 | - 'key' => 'panel_third_level_padding_left', |
|
| 1998 | - 'validation' => 'px', |
|
| 1999 | - ), |
|
| 2000 | - ), |
|
| 2001 | - ), |
|
| 2002 | - |
|
| 2003 | - 'third_level_margin' => array( |
|
| 2004 | - 'priority' => 235, |
|
| 2005 | - 'title' => __( 'Item Margin', 'megamenu' ), |
|
| 2006 | - 'description' => __( 'Set the margin for the third level menu items.', 'megamenu' ), |
|
| 2007 | - 'settings' => array( |
|
| 2008 | - array( |
|
| 2009 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 2010 | - 'type' => 'freetext', |
|
| 2011 | - 'key' => 'panel_third_level_margin_top', |
|
| 2012 | - 'validation' => 'px', |
|
| 2013 | - ), |
|
| 2014 | - array( |
|
| 2015 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 2016 | - 'type' => 'freetext', |
|
| 2017 | - 'key' => 'panel_third_level_margin_right', |
|
| 2018 | - 'validation' => 'px', |
|
| 2019 | - ), |
|
| 2020 | - array( |
|
| 2021 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2022 | - 'type' => 'freetext', |
|
| 2023 | - 'key' => 'panel_third_level_margin_bottom', |
|
| 2024 | - 'validation' => 'px', |
|
| 2025 | - ), |
|
| 2026 | - array( |
|
| 2027 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 2028 | - 'type' => 'freetext', |
|
| 2029 | - 'key' => 'panel_third_level_margin_left', |
|
| 2030 | - 'validation' => 'px', |
|
| 2031 | - ), |
|
| 2032 | - ), |
|
| 2033 | - ), |
|
| 2034 | - 'third_level_border' => array( |
|
| 2035 | - 'priority' => 237, |
|
| 2036 | - 'title' => __( 'Item Border', 'megamenu' ), |
|
| 2037 | - 'description' => __( 'Set the border for the third level menu items.', 'megamenu' ), |
|
| 2038 | - 'settings' => array( |
|
| 2039 | - array( |
|
| 2040 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2041 | - 'type' => 'color', |
|
| 2042 | - 'key' => 'panel_third_level_border_color', |
|
| 2043 | - ), |
|
| 2044 | - array( |
|
| 2045 | - 'title' => __( 'Color (Hover)', 'megamenu' ), |
|
| 2046 | - 'type' => 'color', |
|
| 2047 | - 'key' => 'panel_third_level_border_color_hover', |
|
| 2048 | - ), |
|
| 2049 | - array( |
|
| 2050 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 2051 | - 'type' => 'freetext', |
|
| 2052 | - 'key' => 'panel_third_level_border_top', |
|
| 2053 | - 'validation' => 'px', |
|
| 2054 | - ), |
|
| 2055 | - array( |
|
| 2056 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 2057 | - 'type' => 'freetext', |
|
| 2058 | - 'key' => 'panel_third_level_border_right', |
|
| 2059 | - 'validation' => 'px', |
|
| 2060 | - ), |
|
| 2061 | - array( |
|
| 2062 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2063 | - 'type' => 'freetext', |
|
| 2064 | - 'key' => 'panel_third_level_border_bottom', |
|
| 2065 | - 'validation' => 'px', |
|
| 2066 | - ), |
|
| 2067 | - array( |
|
| 2068 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 2069 | - 'type' => 'freetext', |
|
| 2070 | - 'key' => 'panel_third_level_border_left', |
|
| 2071 | - 'validation' => 'px', |
|
| 2072 | - ), |
|
| 2073 | - ), |
|
| 2074 | - ), |
|
| 2075 | - ), |
|
| 2076 | - ), |
|
| 2077 | - 'flyout_menus' => array( |
|
| 2078 | - 'title' => __( 'Flyout Menus', 'megamenu' ), |
|
| 2079 | - 'settings' => array( |
|
| 2080 | - 'flyout_menu_background' => array( |
|
| 2081 | - 'priority' => 10, |
|
| 2082 | - 'title' => __( 'Sub Menu Background', 'megamenu' ), |
|
| 2083 | - 'description' => __( 'Set the background color for the flyout menu.', 'megamenu' ), |
|
| 2084 | - 'settings' => array( |
|
| 2085 | - array( |
|
| 2086 | - 'title' => __( 'From', 'megamenu' ), |
|
| 2087 | - 'type' => 'color', |
|
| 2088 | - 'key' => 'flyout_menu_background_from', |
|
| 2089 | - ), |
|
| 2090 | - array( |
|
| 2091 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 2092 | - 'type' => 'copy_color', |
|
| 2093 | - 'key' => 'copy_color', |
|
| 2094 | - ), |
|
| 2095 | - array( |
|
| 2096 | - 'title' => __( 'To', 'megamenu' ), |
|
| 2097 | - 'type' => 'color', |
|
| 2098 | - 'key' => 'flyout_menu_background_to', |
|
| 2099 | - ), |
|
| 2100 | - ), |
|
| 2101 | - ), |
|
| 2102 | - 'flyout_menu_width' => array( |
|
| 2103 | - 'priority' => 20, |
|
| 2104 | - 'title' => __( 'Sub Menu Width', 'megamenu' ), |
|
| 2105 | - 'description' => __( 'The width of each flyout menu. This must be a fixed pixel value.', 'megamenu' ), |
|
| 2106 | - 'info' => array( |
|
| 2107 | - __( 'Set this value to the width of your longest menu item title to stop menu items wrapping onto 2 lines.', 'megamenu' ), |
|
| 2108 | - __( "Experimental: Set this value to 'auto' to use a flexible width.", 'megamenu' ), |
|
| 2109 | - ), |
|
| 2110 | - 'settings' => array( |
|
| 2111 | - array( |
|
| 2112 | - 'title' => '', |
|
| 2113 | - 'type' => 'freetext', |
|
| 2114 | - 'key' => 'flyout_width', |
|
| 2115 | - 'validation' => 'px', |
|
| 2116 | - ), |
|
| 2117 | - ), |
|
| 2118 | - ), |
|
| 2119 | - 'flyout_menu_padding' => array( |
|
| 2120 | - 'priority' => 30, |
|
| 2121 | - 'title' => __( 'Sub Menu Padding', 'megamenu' ), |
|
| 2122 | - 'description' => __( 'Set the padding for the whole flyout menu.', 'megamenu' ), |
|
| 2123 | - 'info' => array( __( "Only suitable for single level flyout menus. If you're using multi level flyout menus set these values to 0px.", 'megamenu' ) ), |
|
| 2124 | - 'settings' => array( |
|
| 2125 | - array( |
|
| 2126 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 2127 | - 'type' => 'freetext', |
|
| 2128 | - 'key' => 'flyout_padding_top', |
|
| 2129 | - 'validation' => 'px', |
|
| 2130 | - ), |
|
| 2131 | - array( |
|
| 2132 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 2133 | - 'type' => 'freetext', |
|
| 2134 | - 'key' => 'flyout_padding_right', |
|
| 2135 | - 'validation' => 'px', |
|
| 2136 | - ), |
|
| 2137 | - array( |
|
| 2138 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2139 | - 'type' => 'freetext', |
|
| 2140 | - 'key' => 'flyout_padding_bottom', |
|
| 2141 | - 'validation' => 'px', |
|
| 2142 | - ), |
|
| 2143 | - array( |
|
| 2144 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 2145 | - 'type' => 'freetext', |
|
| 2146 | - 'key' => 'flyout_padding_left', |
|
| 2147 | - 'validation' => 'px', |
|
| 2148 | - ), |
|
| 2149 | - ), |
|
| 2150 | - ), |
|
| 2151 | - 'flyout_menu_border' => array( |
|
| 2152 | - 'priority' => 40, |
|
| 2153 | - 'title' => __( 'Sub Menu Border', 'megamenu' ), |
|
| 2154 | - 'description' => __( 'Set the border for the flyout menu.', 'megamenu' ), |
|
| 2155 | - 'settings' => array( |
|
| 2156 | - array( |
|
| 2157 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2158 | - 'type' => 'color', |
|
| 2159 | - 'key' => 'flyout_border_color', |
|
| 2160 | - ), |
|
| 2161 | - array( |
|
| 2162 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 2163 | - 'type' => 'freetext', |
|
| 2164 | - 'key' => 'flyout_border_top', |
|
| 2165 | - 'validation' => 'px', |
|
| 2166 | - ), |
|
| 2167 | - array( |
|
| 2168 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 2169 | - 'type' => 'freetext', |
|
| 2170 | - 'key' => 'flyout_border_right', |
|
| 2171 | - 'validation' => 'px', |
|
| 2172 | - ), |
|
| 2173 | - array( |
|
| 2174 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2175 | - 'type' => 'freetext', |
|
| 2176 | - 'key' => 'flyout_border_bottom', |
|
| 2177 | - 'validation' => 'px', |
|
| 2178 | - ), |
|
| 2179 | - array( |
|
| 2180 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 2181 | - 'type' => 'freetext', |
|
| 2182 | - 'key' => 'flyout_border_left', |
|
| 2183 | - 'validation' => 'px', |
|
| 2184 | - ), |
|
| 2185 | - ), |
|
| 2186 | - ), |
|
| 2187 | - 'flyout_menu_border_radius' => array( |
|
| 2188 | - 'priority' => 50, |
|
| 2189 | - 'title' => __( 'Sub Menu Border Radius', 'megamenu' ), |
|
| 2190 | - 'description' => __( 'Set rounded corners for flyout menus. Rounded corners will be applied to all flyout menu levels.', 'megamenu' ), |
|
| 2191 | - 'settings' => array( |
|
| 2192 | - array( |
|
| 2193 | - 'title' => __( 'Top Left', 'megamenu' ), |
|
| 2194 | - 'type' => 'freetext', |
|
| 2195 | - 'key' => 'flyout_border_radius_top_left', |
|
| 2196 | - 'validation' => 'px', |
|
| 2197 | - ), |
|
| 2198 | - array( |
|
| 2199 | - 'title' => __( 'Top Right', 'megamenu' ), |
|
| 2200 | - 'type' => 'freetext', |
|
| 2201 | - 'key' => 'flyout_border_radius_top_right', |
|
| 2202 | - 'validation' => 'px', |
|
| 2203 | - ), |
|
| 2204 | - array( |
|
| 2205 | - 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 2206 | - 'type' => 'freetext', |
|
| 2207 | - 'key' => 'flyout_border_radius_bottom_right', |
|
| 2208 | - 'validation' => 'px', |
|
| 2209 | - ), |
|
| 2210 | - array( |
|
| 2211 | - 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 2212 | - 'type' => 'freetext', |
|
| 2213 | - 'key' => 'flyout_border_radius_bottom_left', |
|
| 2214 | - 'validation' => 'px', |
|
| 2215 | - ), |
|
| 2216 | - ), |
|
| 2217 | - ), |
|
| 2218 | - 'flyout_menu_item_background' => array( |
|
| 2219 | - 'priority' => 60, |
|
| 2220 | - 'title' => __( 'Menu Item Background', 'megamenu' ), |
|
| 2221 | - 'description' => __( 'Set the background color for a flyout menu item.', 'megamenu' ), |
|
| 2222 | - 'settings' => array( |
|
| 2223 | - array( |
|
| 2224 | - 'title' => __( 'From', 'megamenu' ), |
|
| 2225 | - 'type' => 'color', |
|
| 2226 | - 'key' => 'flyout_background_from', |
|
| 2227 | - ), |
|
| 2228 | - array( |
|
| 2229 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 2230 | - 'type' => 'copy_color', |
|
| 2231 | - 'key' => 'copy_color', |
|
| 2232 | - ), |
|
| 2233 | - array( |
|
| 2234 | - 'title' => __( 'To', 'megamenu' ), |
|
| 2235 | - 'type' => 'color', |
|
| 2236 | - 'key' => 'flyout_background_to', |
|
| 2237 | - ), |
|
| 2238 | - ), |
|
| 2239 | - ), |
|
| 2240 | - 'flyout_menu_item_background_hover' => array( |
|
| 2241 | - 'priority' => 70, |
|
| 2242 | - 'title' => __( 'Menu Item Background (Hover)', 'megamenu' ), |
|
| 2243 | - 'description' => __( 'Set the background color for a flyout menu item (on hover).', 'megamenu' ), |
|
| 2244 | - 'settings' => array( |
|
| 2245 | - array( |
|
| 2246 | - 'title' => __( 'From', 'megamenu' ), |
|
| 2247 | - 'type' => 'color', |
|
| 2248 | - 'key' => 'flyout_background_hover_from', |
|
| 2249 | - ), |
|
| 2250 | - array( |
|
| 2251 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 2252 | - 'type' => 'copy_color', |
|
| 2253 | - 'key' => 'copy_color', |
|
| 2254 | - ), |
|
| 2255 | - array( |
|
| 2256 | - 'title' => __( 'To', 'megamenu' ), |
|
| 2257 | - 'type' => 'color', |
|
| 2258 | - 'key' => 'flyout_background_hover_to', |
|
| 2259 | - ), |
|
| 2260 | - ), |
|
| 2261 | - ), |
|
| 2262 | - 'flyout_menu_item_height' => array( |
|
| 2263 | - 'priority' => 80, |
|
| 2264 | - 'title' => __( 'Menu Item Height', 'megamenu' ), |
|
| 2265 | - 'description' => __( 'The height of each flyout menu item.', 'megamenu' ), |
|
| 2266 | - 'settings' => array( |
|
| 2267 | - array( |
|
| 2268 | - 'title' => '', |
|
| 2269 | - 'type' => 'freetext', |
|
| 2270 | - 'key' => 'flyout_link_height', |
|
| 2271 | - 'validation' => 'px', |
|
| 2272 | - ), |
|
| 2273 | - ), |
|
| 2274 | - ), |
|
| 2275 | - 'flyout_menu_item_padding' => array( |
|
| 2276 | - 'priority' => 90, |
|
| 2277 | - 'title' => __( 'Menu Item Padding', 'megamenu' ), |
|
| 2278 | - 'description' => __( 'Set the padding for each flyout menu item.', 'megamenu' ), |
|
| 2279 | - 'settings' => array( |
|
| 2280 | - array( |
|
| 2281 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 2282 | - 'type' => 'freetext', |
|
| 2283 | - 'key' => 'flyout_link_padding_top', |
|
| 2284 | - 'validation' => 'px', |
|
| 2285 | - ), |
|
| 2286 | - array( |
|
| 2287 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 2288 | - 'type' => 'freetext', |
|
| 2289 | - 'key' => 'flyout_link_padding_right', |
|
| 2290 | - 'validation' => 'px', |
|
| 2291 | - ), |
|
| 2292 | - array( |
|
| 2293 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2294 | - 'type' => 'freetext', |
|
| 2295 | - 'key' => 'flyout_link_padding_bottom', |
|
| 2296 | - 'validation' => 'px', |
|
| 2297 | - ), |
|
| 2298 | - array( |
|
| 2299 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 2300 | - 'type' => 'freetext', |
|
| 2301 | - 'key' => 'flyout_link_padding_left', |
|
| 2302 | - 'validation' => 'px', |
|
| 2303 | - ), |
|
| 2304 | - ), |
|
| 2305 | - ), |
|
| 2306 | - 'flyout_menu_item_font' => array( |
|
| 2307 | - 'priority' => 100, |
|
| 2308 | - 'title' => __( 'Menu Item Font', 'megamenu' ), |
|
| 2309 | - 'description' => __( 'Set the font for the flyout menu items.', 'megamenu' ), |
|
| 2310 | - 'settings' => array( |
|
| 2311 | - array( |
|
| 2312 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2313 | - 'type' => 'color', |
|
| 2314 | - 'key' => 'flyout_link_color', |
|
| 2315 | - ), |
|
| 2316 | - array( |
|
| 2317 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 2318 | - 'type' => 'freetext', |
|
| 2319 | - 'key' => 'flyout_link_size', |
|
| 2320 | - 'validation' => 'px', |
|
| 2321 | - ), |
|
| 2322 | - array( |
|
| 2323 | - 'title' => __( 'Family', 'megamenu' ), |
|
| 2324 | - 'type' => 'font', |
|
| 2325 | - 'key' => 'flyout_link_family', |
|
| 2326 | - ), |
|
| 2327 | - array( |
|
| 2328 | - 'title' => __( 'Transform', 'megamenu' ), |
|
| 2329 | - 'type' => 'transform', |
|
| 2330 | - 'key' => 'flyout_link_text_transform', |
|
| 2331 | - ), |
|
| 2332 | - array( |
|
| 2333 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 2334 | - 'type' => 'weight', |
|
| 2335 | - 'key' => 'flyout_link_weight', |
|
| 2336 | - ), |
|
| 2337 | - array( |
|
| 2338 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 2339 | - 'type' => 'decoration', |
|
| 2340 | - 'key' => 'flyout_link_text_decoration', |
|
| 2341 | - ), |
|
| 2342 | - ), |
|
| 2343 | - ), |
|
| 2344 | - 'flyout_menu_item_font_hover' => array( |
|
| 2345 | - 'priority' => 110, |
|
| 2346 | - 'title' => __( 'Menu Item Font (Hover)', 'megamenu' ), |
|
| 2347 | - 'description' => __( 'Set the font for the flyout menu items.', 'megamenu' ), |
|
| 2348 | - 'settings' => array( |
|
| 2349 | - array( |
|
| 2350 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2351 | - 'type' => 'color', |
|
| 2352 | - 'key' => 'flyout_link_color_hover', |
|
| 2353 | - ), |
|
| 2354 | - array( |
|
| 2355 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 2356 | - 'type' => 'weight', |
|
| 2357 | - 'key' => 'flyout_link_weight_hover', |
|
| 2358 | - ), |
|
| 2359 | - array( |
|
| 2360 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 2361 | - 'type' => 'decoration', |
|
| 2362 | - 'key' => 'flyout_link_text_decoration_hover', |
|
| 2363 | - ), |
|
| 2364 | - ), |
|
| 2365 | - ), |
|
| 2366 | - 'flyout_menu_item_divider' => array( |
|
| 2367 | - 'priority' => 120, |
|
| 2368 | - 'title' => __( 'Menu Item Divider', 'megamenu' ), |
|
| 2369 | - 'description' => __( 'Show a line divider below each menu item.', 'megamenu' ), |
|
| 2370 | - 'settings' => array( |
|
| 2371 | - array( |
|
| 2372 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 2373 | - 'type' => 'checkbox', |
|
| 2374 | - 'key' => 'flyout_menu_item_divider', |
|
| 2375 | - ), |
|
| 2376 | - array( |
|
| 2377 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2378 | - 'type' => 'color', |
|
| 2379 | - 'key' => 'flyout_menu_item_divider_color', |
|
| 2380 | - ), |
|
| 2381 | - ), |
|
| 2382 | - ), |
|
| 2383 | - ), |
|
| 2384 | - ), |
|
| 2385 | - 'mobile_menu' => array( |
|
| 2386 | - 'title' => __( 'Mobile Menu', 'megamenu' ), |
|
| 2387 | - 'settings' => array( |
|
| 2388 | - 'responsive_breakpoint' => array( |
|
| 2389 | - 'priority' => 2, |
|
| 2390 | - 'title' => __( 'Responsive Breakpoint', 'megamenu' ), |
|
| 2391 | - 'description' => __( 'The menu will be converted to a mobile menu when the browser width is below this value.', 'megamenu' ), |
|
| 2392 | - 'settings' => array( |
|
| 2393 | - array( |
|
| 2394 | - 'title' => '', |
|
| 2395 | - 'type' => 'freetext', |
|
| 2396 | - 'key' => 'responsive_breakpoint', |
|
| 2397 | - 'validation' => 'px', |
|
| 2398 | - ), |
|
| 2399 | - ), |
|
| 2400 | - ), |
|
| 2401 | - 'responsive_breakpoint_disabled' => array( |
|
| 2402 | - 'priority' => 3, |
|
| 2403 | - 'title' => __( "The 'Responsive Breakpoint' option has been set to 0px. The desktop version of the menu will be displayed for all browsers (regardless of the browser width), so the following options are disabled.", 'megamenu' ), |
|
| 2404 | - 'description' => '', |
|
| 2405 | - ), |
|
| 2406 | - 'mobile_toggle_bar' => array( |
|
| 2407 | - 'priority' => 4, |
|
| 2408 | - 'title' => __( 'Mobile Toggle Bar', 'megamenu' ), |
|
| 2409 | - 'description' => '', |
|
| 2410 | - ), |
|
| 2411 | - 'mobile_toggle_disabled' => array( |
|
| 2412 | - 'priority' => 5, |
|
| 2413 | - 'title' => __( "The 'Disable Mobile Toggle Bar' option has been enabled. The following options are disabled as the mobile toggle bar will not be displayed.", 'megamenu' ), |
|
| 2414 | - 'description' => '', |
|
| 2415 | - ), |
|
| 2416 | - 'toggle_bar_background' => array( |
|
| 2417 | - 'priority' => 20, |
|
| 2418 | - 'title' => __( 'Toggle Bar Background', 'megamenu' ), |
|
| 2419 | - 'description' => __( 'Set the background color for the mobile menu toggle bar.', 'megamenu' ), |
|
| 2420 | - 'info' => array( |
|
| 2421 | - __( "Don't forget to update the Menu toggle block text and icon color in the Toggle Bar Designer above!", 'megamenu' ), |
|
| 2422 | - ), |
|
| 2423 | - 'settings' => array( |
|
| 2424 | - array( |
|
| 2425 | - 'title' => __( 'From', 'megamenu' ), |
|
| 2426 | - 'type' => 'color', |
|
| 2427 | - 'key' => 'toggle_background_from', |
|
| 2428 | - ), |
|
| 2429 | - array( |
|
| 2430 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 2431 | - 'type' => 'copy_color', |
|
| 2432 | - 'key' => 'copy_color', |
|
| 2433 | - ), |
|
| 2434 | - array( |
|
| 2435 | - 'title' => __( 'To', 'megamenu' ), |
|
| 2436 | - 'type' => 'color', |
|
| 2437 | - 'key' => 'toggle_background_to', |
|
| 2438 | - ), |
|
| 2439 | - ), |
|
| 2440 | - ), |
|
| 2441 | - 'toggle_bar_height' => array( |
|
| 2442 | - 'priority' => 25, |
|
| 2443 | - 'title' => __( 'Toggle Bar Height', 'megamenu' ), |
|
| 2444 | - 'description' => __( 'Set the height of the mobile menu toggle bar.', 'megamenu' ), |
|
| 2445 | - 'settings' => array( |
|
| 2446 | - array( |
|
| 2447 | - 'title' => '', |
|
| 2448 | - 'type' => 'freetext', |
|
| 2449 | - 'key' => 'toggle_bar_height', |
|
| 2450 | - ), |
|
| 2451 | - ), |
|
| 2452 | - ), |
|
| 2453 | - 'toggle_bar_border_radius' => array( |
|
| 2454 | - 'priority' => 26, |
|
| 2455 | - 'title' => __( 'Toggle Bar Border Radius', 'megamenu' ), |
|
| 2456 | - 'description' => __( 'Set a border radius on the mobile toggle bar.', 'megamenu' ), |
|
| 2457 | - 'settings' => array( |
|
| 2458 | - array( |
|
| 2459 | - 'title' => __( 'Top Left', 'megamenu' ), |
|
| 2460 | - 'type' => 'freetext', |
|
| 2461 | - 'key' => 'toggle_bar_border_radius_top_left', |
|
| 2462 | - 'validation' => 'px', |
|
| 2463 | - ), |
|
| 2464 | - array( |
|
| 2465 | - 'title' => __( 'Top Right', 'megamenu' ), |
|
| 2466 | - 'type' => 'freetext', |
|
| 2467 | - 'key' => 'toggle_bar_border_radius_top_right', |
|
| 2468 | - 'validation' => 'px', |
|
| 2469 | - ), |
|
| 2470 | - array( |
|
| 2471 | - 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 2472 | - 'type' => 'freetext', |
|
| 2473 | - 'key' => 'toggle_bar_border_radius_bottom_right', |
|
| 2474 | - 'validation' => 'px', |
|
| 2475 | - ), |
|
| 2476 | - array( |
|
| 2477 | - 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 2478 | - 'type' => 'freetext', |
|
| 2479 | - 'key' => 'toggle_bar_border_radius_bottom_left', |
|
| 2480 | - 'validation' => 'px', |
|
| 2481 | - ), |
|
| 2482 | - ), |
|
| 2483 | - ), |
|
| 2484 | - 'disable_mobile_toggle' => array( |
|
| 2485 | - 'priority' => 28, |
|
| 2486 | - 'title' => __( 'Disable Mobile Toggle Bar', 'megamenu' ), |
|
| 2487 | - 'description' => __( "Hide the toggle bar and display the menu in it's open state by default.", 'megamenu' ), |
|
| 2488 | - 'settings' => array( |
|
| 2489 | - array( |
|
| 2490 | - 'title' => '', |
|
| 2491 | - 'type' => 'checkbox', |
|
| 2492 | - 'key' => 'disable_mobile_toggle', |
|
| 2493 | - ), |
|
| 2494 | - ), |
|
| 2495 | - ), |
|
| 2496 | - |
|
| 2497 | - 'mobile_top_level_menu_items' => array( |
|
| 2498 | - 'priority' => 33, |
|
| 2499 | - 'title' => __( 'Mobile Sub Menu', 'megamenu' ), |
|
| 2500 | - 'description' => '', |
|
| 2501 | - ), |
|
| 2502 | - 'mobile_menu_overlay' => array( |
|
| 2503 | - 'priority' => 34, |
|
| 2504 | - 'title' => __( 'Overlay Content', 'megamenu' ), |
|
| 2505 | - 'description' => __( 'If enabled, the mobile sub menu will overlay the page content (instead of pushing the page content down)', 'megamenu' ), |
|
| 2506 | - 'settings' => array( |
|
| 2507 | - array( |
|
| 2508 | - 'title' => '', |
|
| 2509 | - 'type' => 'checkbox', |
|
| 2510 | - 'key' => 'mobile_menu_overlay', |
|
| 2511 | - ), |
|
| 2512 | - ), |
|
| 2513 | - ), |
|
| 2514 | - 'mobile_menu_force_width' => array( |
|
| 2515 | - 'priority' => 35, |
|
| 2516 | - 'title' => __( 'Force Full Width', 'megamenu' ), |
|
| 2517 | - 'description' => __( "If enabled, the mobile sub menu will match the width and position on the given page element (rather than being limited to the width of the toggle bar). For a full width sub menu, leave the 'Selector' value set to 'body'.", 'megamenu' ), |
|
| 2518 | - 'settings' => array( |
|
| 2519 | - array( |
|
| 2520 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 2521 | - 'type' => 'checkbox', |
|
| 2522 | - 'key' => 'mobile_menu_force_width', |
|
| 2523 | - ), |
|
| 2524 | - array( |
|
| 2525 | - 'title' => __( 'Selector', 'megamenu' ), |
|
| 2526 | - 'type' => 'freetext', |
|
| 2527 | - 'key' => 'mobile_menu_force_width_selector', |
|
| 2528 | - ), |
|
| 2529 | - ), |
|
| 2530 | - ), |
|
| 2531 | - 'mobile_menu_off_canvas_width' => array( |
|
| 2532 | - 'priority' => 36, |
|
| 2533 | - 'title' => __( 'Off Canvas Width', 'megamenu' ), |
|
| 2534 | - 'description' => __( "The width of the sub menu if the Mobile Effect is set to 'Slide Left' or 'Slide Right'. Must be specified in px.", 'megamenu' ), |
|
| 2535 | - 'settings' => array( |
|
| 2536 | - array( |
|
| 2537 | - 'title' => '', |
|
| 2538 | - 'type' => 'freetext', |
|
| 2539 | - 'key' => 'mobile_menu_off_canvas_width', |
|
| 2540 | - 'validation' => 'px', |
|
| 2541 | - ), |
|
| 2542 | - ), |
|
| 2543 | - ), |
|
| 2544 | - 'mobile_menu_item_height' => array( |
|
| 2545 | - 'priority' => 38, |
|
| 2546 | - 'title' => __( 'Menu Item Height', 'megamenu' ), |
|
| 2547 | - 'description' => __( 'Height of each top level item in the mobile menu.', 'megamenu' ), |
|
| 2548 | - 'settings' => array( |
|
| 2549 | - array( |
|
| 2550 | - 'title' => '', |
|
| 2551 | - 'type' => 'freetext', |
|
| 2552 | - 'key' => 'mobile_menu_item_height', |
|
| 2553 | - ), |
|
| 2554 | - ), |
|
| 2555 | - ), |
|
| 2556 | - 'mobile_menu_padding' => array( |
|
| 2557 | - 'priority' => 39, |
|
| 2558 | - 'title' => __( 'Menu Padding', 'megamenu' ), |
|
| 2559 | - 'description' => __( 'Padding for the mobile sub menu.', 'megamenu' ), |
|
| 2560 | - 'settings' => array( |
|
| 2561 | - array( |
|
| 2562 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 2563 | - 'type' => 'freetext', |
|
| 2564 | - 'key' => 'mobile_menu_padding_top', |
|
| 2565 | - 'validation' => 'px', |
|
| 2566 | - ), |
|
| 2567 | - array( |
|
| 2568 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 2569 | - 'type' => 'freetext', |
|
| 2570 | - 'key' => 'mobile_menu_padding_right', |
|
| 2571 | - 'validation' => 'px', |
|
| 2572 | - ), |
|
| 2573 | - array( |
|
| 2574 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2575 | - 'type' => 'freetext', |
|
| 2576 | - 'key' => 'mobile_menu_padding_bottom', |
|
| 2577 | - 'validation' => 'px', |
|
| 2578 | - ), |
|
| 2579 | - array( |
|
| 2580 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 2581 | - 'type' => 'freetext', |
|
| 2582 | - 'key' => 'mobile_menu_padding_left', |
|
| 2583 | - 'validation' => 'px', |
|
| 2584 | - ), |
|
| 2585 | - ), |
|
| 2586 | - ), |
|
| 2587 | - 'mobile_background' => array( |
|
| 2588 | - 'priority' => 40, |
|
| 2589 | - 'title' => __( 'Menu Background', 'megamenu' ), |
|
| 2590 | - 'description' => __( 'The background color for the mobile menu.', 'megamenu' ), |
|
| 2591 | - 'settings' => array( |
|
| 2592 | - array( |
|
| 2593 | - 'title' => __( 'From', 'megamenu' ), |
|
| 2594 | - 'type' => 'color', |
|
| 2595 | - 'key' => 'mobile_background_from', |
|
| 2596 | - ), |
|
| 2597 | - array( |
|
| 2598 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 2599 | - 'type' => 'copy_color', |
|
| 2600 | - 'key' => 'copy_color', |
|
| 2601 | - ), |
|
| 2602 | - array( |
|
| 2603 | - 'title' => __( 'To', 'megamenu' ), |
|
| 2604 | - 'type' => 'color', |
|
| 2605 | - 'key' => 'mobile_background_to', |
|
| 2606 | - ), |
|
| 2607 | - ), |
|
| 2608 | - ), |
|
| 2609 | - 'mobile_background_hover' => array( |
|
| 2610 | - 'priority' => 45, |
|
| 2611 | - 'title' => __( 'Menu Item Background (Active)', 'megamenu' ), |
|
| 2612 | - 'description' => __( 'The background color for each top level menu item in the mobile menu when the sub menu is open.', 'megamenu' ), |
|
| 2613 | - 'settings' => array( |
|
| 2614 | - array( |
|
| 2615 | - 'title' => __( 'From', 'megamenu' ), |
|
| 2616 | - 'type' => 'color', |
|
| 2617 | - 'key' => 'mobile_menu_item_background_hover_from', |
|
| 2618 | - ), |
|
| 2619 | - array( |
|
| 2620 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 2621 | - 'type' => 'copy_color', |
|
| 2622 | - 'key' => 'copy_color', |
|
| 2623 | - ), |
|
| 2624 | - array( |
|
| 2625 | - 'title' => __( 'To', 'megamenu' ), |
|
| 2626 | - 'type' => 'color', |
|
| 2627 | - 'key' => 'mobile_menu_item_background_hover_to', |
|
| 2628 | - ), |
|
| 2629 | - ), |
|
| 2630 | - ), |
|
| 2631 | - 'mobile_menu_item_font' => array( |
|
| 2632 | - 'priority' => 50, |
|
| 2633 | - 'title' => __( 'Font', 'megamenu' ), |
|
| 2634 | - 'description' => __( 'The font to use for each top level menu item in the mobile menu.', 'megamenu' ), |
|
| 2635 | - 'settings' => array( |
|
| 2636 | - array( |
|
| 2637 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2638 | - 'type' => 'color', |
|
| 2639 | - 'key' => 'mobile_menu_item_link_color', |
|
| 2640 | - ), |
|
| 2641 | - array( |
|
| 2642 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 2643 | - 'type' => 'freetext', |
|
| 2644 | - 'key' => 'mobile_menu_item_link_font_size', |
|
| 2645 | - 'validation' => 'px', |
|
| 2646 | - ), |
|
| 2647 | - array( |
|
| 2648 | - 'title' => __( 'Align', 'megamenu' ), |
|
| 2649 | - 'type' => 'align', |
|
| 2650 | - 'key' => 'mobile_menu_item_link_text_align', |
|
| 2651 | - ), |
|
| 2652 | - ), |
|
| 2653 | - ), |
|
| 2654 | - 'mobile_menu_item_font_hover' => array( |
|
| 2655 | - 'priority' => 55, |
|
| 2656 | - 'title' => __( 'Font (Active)', 'megamenu' ), |
|
| 2657 | - 'description' => __( 'The font color for each top level menu item in the mobile menu when the sub menu is open.', 'megamenu' ), |
|
| 2658 | - 'settings' => array( |
|
| 2659 | - array( |
|
| 2660 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2661 | - 'type' => 'color', |
|
| 2662 | - 'key' => 'mobile_menu_item_link_color_hover', |
|
| 2663 | - ), |
|
| 2664 | - ), |
|
| 2665 | - ), |
|
| 2666 | - 'mobile_mega_menus' => array( |
|
| 2667 | - 'priority' => 60, |
|
| 2668 | - 'title' => __( 'Mega Menus', 'megamenu' ), |
|
| 2669 | - 'description' => '', |
|
| 2670 | - ), |
|
| 2671 | - 'mobile_columns' => array( |
|
| 2672 | - 'priority' => 65, |
|
| 2673 | - 'title' => __( 'Mega Menu Columns', 'megamenu' ), |
|
| 2674 | - 'description' => __( 'Collapse mega menu content into this many columns on mobile.', 'megamenu' ), |
|
| 2675 | - 'settings' => array( |
|
| 2676 | - array( |
|
| 2677 | - 'title' => '', |
|
| 2678 | - 'type' => 'mobile_columns', |
|
| 2679 | - 'key' => 'mobile_columns', |
|
| 2680 | - ), |
|
| 2681 | - ), |
|
| 2682 | - ), |
|
| 2683 | - ), |
|
| 2684 | - ), |
|
| 2685 | - 'custom_styling' => array( |
|
| 2686 | - 'title' => __( 'Custom Styling', 'megamenu' ), |
|
| 2687 | - 'settings' => array( |
|
| 2688 | - 'custom_styling' => array( |
|
| 2689 | - 'priority' => 40, |
|
| 2690 | - 'title' => __( 'CSS Editor', 'megamenu' ), |
|
| 2691 | - 'description' => __( 'Define any custom CSS you wish to add to menus using this theme. You can use standard CSS or SCSS.', 'megamenu' ), |
|
| 2692 | - 'settings' => array( |
|
| 2693 | - array( |
|
| 2694 | - 'title' => '', |
|
| 2695 | - 'type' => 'textarea', |
|
| 2696 | - 'key' => 'custom_css', |
|
| 2697 | - ), |
|
| 2698 | - ), |
|
| 2699 | - ), |
|
| 2700 | - ), |
|
| 2701 | - ), |
|
| 2702 | - ) |
|
| 2703 | - ); |
|
| 2704 | - |
|
| 2705 | - echo "<h2 class='nav-tab-wrapper'>"; |
|
| 2706 | - |
|
| 2707 | - $is_first = true; |
|
| 2708 | - |
|
| 2709 | - foreach ( $settings as $section_id => $section ) { |
|
| 2710 | - |
|
| 2711 | - if ( $is_first ) { |
|
| 2712 | - $active = 'nav-tab-active '; |
|
| 2713 | - $is_first = false; |
|
| 2714 | - } else { |
|
| 2715 | - $active = ''; |
|
| 2716 | - } |
|
| 2717 | - |
|
| 2718 | - echo "<a class='mega-tab nav-tab {$active}' data-tab='mega-tab-content-{$section_id}'>" . $section['title'] . '</a>'; |
|
| 2719 | - |
|
| 2720 | - } |
|
| 2721 | - |
|
| 2722 | - echo '</h2>'; |
|
| 2723 | - |
|
| 2724 | - $is_first = true; |
|
| 2725 | - |
|
| 2726 | - foreach ( $settings as $section_id => $section ) { |
|
| 2727 | - |
|
| 2728 | - if ( $is_first ) { |
|
| 2729 | - $display = 'block'; |
|
| 2730 | - $is_first = false; |
|
| 2731 | - } else { |
|
| 2732 | - $display = 'none'; |
|
| 2733 | - } |
|
| 2734 | - |
|
| 2735 | - echo " <div class='mega-tab-content mega-tab-content-{$section_id}' style='display: {$display}'>"; |
|
| 2736 | - echo " <table class='{$section_id}'>"; |
|
| 2737 | - |
|
| 2738 | - // order the fields by priority |
|
| 2739 | - uasort( $section['settings'], array( $this, 'compare_elems' ) ); |
|
| 2740 | - |
|
| 2741 | - foreach ( $section['settings'] as $group_id => $group ) { |
|
| 2742 | - |
|
| 2743 | - echo "<tr class='mega-{$group_id}'>"; |
|
| 2744 | - |
|
| 2745 | - if ( isset( $group['settings'] ) ) { |
|
| 2746 | - |
|
| 2747 | - echo "<td class='mega-name'>" . $group['title'] . "<div class='mega-description'>" . $group['description'] . '</div></td>'; |
|
| 2748 | - echo "<td class='mega-value'>"; |
|
| 2749 | - |
|
| 2750 | - foreach ( $group['settings'] as $setting_id => $setting ) { |
|
| 2751 | - |
|
| 2752 | - if ( isset( $setting['validation'] ) ) { |
|
| 2753 | - echo "<label class='mega-{$setting['key']}' data-validation='{$setting['validation']}'>"; |
|
| 2754 | - } else { |
|
| 2755 | - echo "<label class='mega-{$setting['key']}'>"; |
|
| 2756 | - } |
|
| 2757 | - echo "<span class='mega-short-desc'>{$setting['title']}</span>"; |
|
| 2758 | - |
|
| 2759 | - switch ( $setting['type'] ) { |
|
| 2760 | - case 'freetext': |
|
| 2761 | - $this->print_theme_freetext_option( $setting['key'] ); |
|
| 2762 | - break; |
|
| 2763 | - case 'textarea': |
|
| 2764 | - $this->print_theme_textarea_option( $setting['key'] ); |
|
| 2765 | - break; |
|
| 2766 | - case 'align': |
|
| 2767 | - $this->print_theme_align_option( $setting['key'] ); |
|
| 2768 | - break; |
|
| 2769 | - case 'checkbox': |
|
| 2770 | - $this->print_theme_checkbox_option( $setting['key'] ); |
|
| 2771 | - break; |
|
| 2772 | - case 'arrow': |
|
| 2773 | - $this->print_theme_arrow_option( $setting['key'] ); |
|
| 2774 | - break; |
|
| 2775 | - case 'color': |
|
| 2776 | - $this->print_theme_color_option( $setting['key'] ); |
|
| 2777 | - break; |
|
| 2778 | - case 'weight': |
|
| 2779 | - $this->print_theme_weight_option( $setting['key'] ); |
|
| 2780 | - break; |
|
| 2781 | - case 'font': |
|
| 2782 | - $this->print_theme_font_option( $setting['key'] ); |
|
| 2783 | - break; |
|
| 2784 | - case 'transform': |
|
| 2785 | - $this->print_theme_transform_option( $setting['key'] ); |
|
| 2786 | - break; |
|
| 2787 | - case 'decoration': |
|
| 2788 | - $this->print_theme_text_decoration_option( $setting['key'] ); |
|
| 2789 | - break; |
|
| 2790 | - case 'mobile_columns': |
|
| 2791 | - $this->print_theme_mobile_columns_option( $setting['key'] ); |
|
| 2792 | - break; |
|
| 2793 | - case 'copy_color': |
|
| 2794 | - $this->print_theme_copy_color_option( $setting['key'] ); |
|
| 2795 | - break; |
|
| 2796 | - default: |
|
| 2797 | - do_action( "megamenu_print_theme_option_{$setting['type']}", $setting['key'], $this->id ); |
|
| 2798 | - break; |
|
| 2799 | - } |
|
| 2800 | - |
|
| 2801 | - echo '</label>'; |
|
| 2802 | - |
|
| 2803 | - } |
|
| 2804 | - |
|
| 2805 | - if ( isset( $group['info'] ) ) { |
|
| 2806 | - foreach ( $group['info'] as $paragraph ) { |
|
| 2807 | - echo "<div class='mega-info'>{$paragraph}</div>"; |
|
| 2808 | - } |
|
| 2809 | - } |
|
| 2810 | - |
|
| 2811 | - foreach ( $group['settings'] as $setting_id => $setting ) { |
|
| 2812 | - if ( isset( $setting['validation'] ) ) { |
|
| 2813 | - |
|
| 2814 | - echo "<div class='mega-validation-message mega-validation-message-mega-{$setting['key']}'>"; |
|
| 2815 | - |
|
| 2816 | - if ( $setting['validation'] == 'int' ) { |
|
| 2817 | - $message = __( 'Enter a whole number (e.g. 1, 5, 100, 999)' ); |
|
| 2818 | - } |
|
| 2819 | - |
|
| 2820 | - if ( $setting['validation'] == 'px' ) { |
|
| 2821 | - $message = __( 'Enter a value including a unit (e.g. 10px, 10rem, 10%)' ); |
|
| 2822 | - } |
|
| 2823 | - |
|
| 2824 | - if ( $setting['validation'] == 'float' ) { |
|
| 2825 | - $message = __( 'Enter a valid number (e.g. 0.1, 1, 10, 999)' ); |
|
| 2826 | - } |
|
| 2827 | - |
|
| 2828 | - if ( strlen( $setting['title'] ) ) { |
|
| 2829 | - echo $setting['title'] . ': ' . $message; |
|
| 2830 | - } else { |
|
| 2831 | - echo $message; |
|
| 2832 | - } |
|
| 2833 | - |
|
| 2834 | - echo '</div>'; |
|
| 2835 | - } |
|
| 2836 | - } |
|
| 2837 | - |
|
| 2838 | - echo '</td>'; |
|
| 2839 | - } else { |
|
| 2840 | - echo "<td colspan='2'><h5>{$group['title']}</h5></td>"; |
|
| 2841 | - } |
|
| 2842 | - |
|
| 2843 | - echo '</tr>'; |
|
| 2844 | - |
|
| 2845 | - } |
|
| 2846 | - |
|
| 2847 | - echo '</table>'; |
|
| 2848 | - echo '</div>'; |
|
| 2849 | - } |
|
| 2850 | - |
|
| 2851 | - ?> |
|
| 811 | + $settings = apply_filters( |
|
| 812 | + 'megamenu_theme_editor_settings', |
|
| 813 | + array( |
|
| 814 | + |
|
| 815 | + 'general' => array( |
|
| 816 | + 'title' => __( 'General Settings', 'megamenu' ), |
|
| 817 | + 'settings' => array( |
|
| 818 | + 'title' => array( |
|
| 819 | + 'priority' => 10, |
|
| 820 | + 'title' => __( 'Theme Title', 'megamenu' ), |
|
| 821 | + 'description' => '', |
|
| 822 | + 'settings' => array( |
|
| 823 | + array( |
|
| 824 | + 'title' => '', |
|
| 825 | + 'type' => 'freetext', |
|
| 826 | + 'key' => 'title', |
|
| 827 | + ), |
|
| 828 | + ), |
|
| 829 | + ), |
|
| 830 | + 'arrow' => array( |
|
| 831 | + 'priority' => 20, |
|
| 832 | + 'title' => __( 'Arrow', 'megamenu' ), |
|
| 833 | + 'description' => __( 'Select the arrow styles.', 'megamenu' ), |
|
| 834 | + 'settings' => array( |
|
| 835 | + array( |
|
| 836 | + 'title' => __( 'Up', 'megamenu' ), |
|
| 837 | + 'type' => 'arrow', |
|
| 838 | + 'key' => 'arrow_up', |
|
| 839 | + ), |
|
| 840 | + array( |
|
| 841 | + 'title' => __( 'Down', 'megamenu' ), |
|
| 842 | + 'type' => 'arrow', |
|
| 843 | + 'key' => 'arrow_down', |
|
| 844 | + ), |
|
| 845 | + array( |
|
| 846 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 847 | + 'type' => 'arrow', |
|
| 848 | + 'key' => 'arrow_left', |
|
| 849 | + ), |
|
| 850 | + array( |
|
| 851 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 852 | + 'type' => 'arrow', |
|
| 853 | + 'key' => 'arrow_right', |
|
| 854 | + ), |
|
| 855 | + ), |
|
| 856 | + ), |
|
| 857 | + 'line_height' => array( |
|
| 858 | + 'priority' => 30, |
|
| 859 | + 'title' => __( 'Line Height', 'megamenu' ), |
|
| 860 | + 'description' => __( 'Set the general line height to use in the sub menu contents.', 'megamenu' ), |
|
| 861 | + 'settings' => array( |
|
| 862 | + array( |
|
| 863 | + 'title' => '', |
|
| 864 | + 'type' => 'freetext', |
|
| 865 | + 'key' => 'line_height', |
|
| 866 | + ), |
|
| 867 | + ), |
|
| 868 | + ), |
|
| 869 | + 'z_index' => array( |
|
| 870 | + 'priority' => 40, |
|
| 871 | + 'title' => __( 'Z Index', 'megamenu' ), |
|
| 872 | + 'description' => __( 'Set the z-index to ensure the sub menus appear ontop of other content.', 'megamenu' ), |
|
| 873 | + 'settings' => array( |
|
| 874 | + array( |
|
| 875 | + 'title' => '', |
|
| 876 | + 'type' => 'freetext', |
|
| 877 | + 'key' => 'z_index', |
|
| 878 | + 'validation' => 'int', |
|
| 879 | + ), |
|
| 880 | + ), |
|
| 881 | + ), |
|
| 882 | + 'shadow' => array( |
|
| 883 | + 'priority' => 50, |
|
| 884 | + 'title' => __( 'Shadow', 'megamenu' ), |
|
| 885 | + 'description' => __( 'Apply a shadow to mega and flyout menus.', 'megamenu' ), |
|
| 886 | + 'settings' => array( |
|
| 887 | + array( |
|
| 888 | + 'title' => __( 'Enabled', 'megamenu' ), |
|
| 889 | + 'type' => 'checkbox', |
|
| 890 | + 'key' => 'shadow', |
|
| 891 | + ), |
|
| 892 | + array( |
|
| 893 | + 'title' => __( 'Horizontal', 'megamenu' ), |
|
| 894 | + 'type' => 'freetext', |
|
| 895 | + 'key' => 'shadow_horizontal', |
|
| 896 | + 'validation' => 'px', |
|
| 897 | + ), |
|
| 898 | + array( |
|
| 899 | + 'title' => __( 'Vertical', 'megamenu' ), |
|
| 900 | + 'type' => 'freetext', |
|
| 901 | + 'key' => 'shadow_vertical', |
|
| 902 | + 'validation' => 'px', |
|
| 903 | + ), |
|
| 904 | + array( |
|
| 905 | + 'title' => __( 'Blur', 'megamenu' ), |
|
| 906 | + 'type' => 'freetext', |
|
| 907 | + 'key' => 'shadow_blur', |
|
| 908 | + 'validation' => 'px', |
|
| 909 | + ), |
|
| 910 | + array( |
|
| 911 | + 'title' => __( 'Spread', 'megamenu' ), |
|
| 912 | + 'type' => 'freetext', |
|
| 913 | + 'key' => 'shadow_spread', |
|
| 914 | + 'validation' => 'px', |
|
| 915 | + ), |
|
| 916 | + array( |
|
| 917 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 918 | + 'type' => 'color', |
|
| 919 | + 'key' => 'shadow_color', |
|
| 920 | + ), |
|
| 921 | + ), |
|
| 922 | + ), |
|
| 923 | + 'transitions' => array( |
|
| 924 | + 'priority' => 60, |
|
| 925 | + 'title' => __( 'Hover Transitions', 'megamenu' ), |
|
| 926 | + 'description' => __( 'Apply hover transitions to menu items. Note: Transitions will not apply to gradient backgrounds.', 'megamenu' ), |
|
| 927 | + 'settings' => array( |
|
| 928 | + array( |
|
| 929 | + 'title' => __( 'Enabled', 'megamenu' ), |
|
| 930 | + 'type' => 'checkbox', |
|
| 931 | + 'key' => 'transitions', |
|
| 932 | + ), |
|
| 933 | + ), |
|
| 934 | + ), |
|
| 935 | + 'resets' => array( |
|
| 936 | + 'priority' => 70, |
|
| 937 | + 'title' => __( 'Reset Widget Styling', 'megamenu' ), |
|
| 938 | + 'description' => __( 'Caution: Reset the styling of widgets within the mega menu? This may break the styling of widgets that you have added to your sub menus. Default: Disabled.', 'megamenu' ), |
|
| 939 | + 'settings' => array( |
|
| 940 | + array( |
|
| 941 | + 'title' => __( 'Enabled', 'megamenu' ), |
|
| 942 | + 'type' => 'checkbox', |
|
| 943 | + 'key' => 'resets', |
|
| 944 | + ), |
|
| 945 | + ), |
|
| 946 | + ), |
|
| 947 | + ), |
|
| 948 | + ), |
|
| 949 | + 'menu_bar' => array( |
|
| 950 | + 'title' => __( 'Menu Bar', 'megamenu' ), |
|
| 951 | + 'settings' => array( |
|
| 952 | + 'menu_item_height' => array( |
|
| 953 | + 'priority' => 05, |
|
| 954 | + 'title' => __( 'Menu Height', 'megamenu' ), |
|
| 955 | + 'description' => __( 'Define the height of each top level menu item link. This value plus the Menu Padding (top and bottom) settings define the overall height of the menu bar.', 'megamenu' ), |
|
| 956 | + 'settings' => array( |
|
| 957 | + array( |
|
| 958 | + 'title' => '', |
|
| 959 | + 'type' => 'freetext', |
|
| 960 | + 'key' => 'menu_item_link_height', |
|
| 961 | + 'validation' => 'px', |
|
| 962 | + ), |
|
| 963 | + ), |
|
| 964 | + ), |
|
| 965 | + 'menu_background' => array( |
|
| 966 | + 'priority' => 10, |
|
| 967 | + 'title' => __( 'Menu Background', 'megamenu' ), |
|
| 968 | + 'description' => __( "The background color for the main menu bar. Set each value to transparent for a 'button' style menu.", 'megamenu' ), |
|
| 969 | + 'settings' => array( |
|
| 970 | + array( |
|
| 971 | + 'title' => __( 'From', 'megamenu' ), |
|
| 972 | + 'type' => 'color', |
|
| 973 | + 'key' => 'container_background_from', |
|
| 974 | + ), |
|
| 975 | + array( |
|
| 976 | + 'title' => __( 'Copy', 'megamenu' ), |
|
| 977 | + 'type' => 'copy_color', |
|
| 978 | + 'key' => 'copy_color', |
|
| 979 | + ), |
|
| 980 | + array( |
|
| 981 | + 'title' => __( 'To', 'megamenu' ), |
|
| 982 | + 'type' => 'color', |
|
| 983 | + 'key' => 'container_background_to', |
|
| 984 | + ), |
|
| 985 | + ), |
|
| 986 | + ), |
|
| 987 | + 'menu_padding' => array( |
|
| 988 | + 'priority' => 20, |
|
| 989 | + 'title' => __( 'Menu Padding', 'megamenu' ), |
|
| 990 | + 'description' => __( 'Padding for the main menu bar.', 'megamenu' ), |
|
| 991 | + 'settings' => array( |
|
| 992 | + array( |
|
| 993 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 994 | + 'type' => 'freetext', |
|
| 995 | + 'key' => 'container_padding_top', |
|
| 996 | + 'validation' => 'px', |
|
| 997 | + ), |
|
| 998 | + array( |
|
| 999 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 1000 | + 'type' => 'freetext', |
|
| 1001 | + 'key' => 'container_padding_right', |
|
| 1002 | + 'validation' => 'px', |
|
| 1003 | + ), |
|
| 1004 | + array( |
|
| 1005 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1006 | + 'type' => 'freetext', |
|
| 1007 | + 'key' => 'container_padding_bottom', |
|
| 1008 | + 'validation' => 'px', |
|
| 1009 | + ), |
|
| 1010 | + array( |
|
| 1011 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 1012 | + 'type' => 'freetext', |
|
| 1013 | + 'key' => 'container_padding_left', |
|
| 1014 | + 'validation' => 'px', |
|
| 1015 | + ), |
|
| 1016 | + ), |
|
| 1017 | + ), |
|
| 1018 | + 'menu_border_radius' => array( |
|
| 1019 | + 'priority' => 30, |
|
| 1020 | + 'title' => __( 'Menu Border Radius', 'megamenu' ), |
|
| 1021 | + 'description' => __( 'Set a border radius on the main menu bar.', 'megamenu' ), |
|
| 1022 | + 'settings' => array( |
|
| 1023 | + array( |
|
| 1024 | + 'title' => __( 'Top Left', 'megamenu' ), |
|
| 1025 | + 'type' => 'freetext', |
|
| 1026 | + 'key' => 'container_border_radius_top_left', |
|
| 1027 | + 'validation' => 'px', |
|
| 1028 | + ), |
|
| 1029 | + array( |
|
| 1030 | + 'title' => __( 'Top Right', 'megamenu' ), |
|
| 1031 | + 'type' => 'freetext', |
|
| 1032 | + 'key' => 'container_border_radius_top_right', |
|
| 1033 | + 'validation' => 'px', |
|
| 1034 | + ), |
|
| 1035 | + array( |
|
| 1036 | + 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 1037 | + 'type' => 'freetext', |
|
| 1038 | + 'key' => 'container_border_radius_bottom_right', |
|
| 1039 | + 'validation' => 'px', |
|
| 1040 | + ), |
|
| 1041 | + array( |
|
| 1042 | + 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 1043 | + 'type' => 'freetext', |
|
| 1044 | + 'key' => 'container_border_radius_bottom_left', |
|
| 1045 | + 'validation' => 'px', |
|
| 1046 | + ), |
|
| 1047 | + ), |
|
| 1048 | + ), |
|
| 1049 | + 'top_level_menu_items' => array( |
|
| 1050 | + 'priority' => 50, |
|
| 1051 | + 'title' => __( 'Top Level Menu Items', 'megamenu' ), |
|
| 1052 | + 'description' => '', |
|
| 1053 | + ), |
|
| 1054 | + 'menu_item_align' => array( |
|
| 1055 | + 'priority' => 55, |
|
| 1056 | + 'title' => __( 'Menu Items Align', 'megamenu' ), |
|
| 1057 | + 'description' => __( 'Align <i>all</i> menu items to the left (default), centrally or to the right.', 'megamenu' ), |
|
| 1058 | + 'info' => array( __( "This option will apply to all menu items. To align an individual menu item to the right, edit the menu item itself and set 'Menu Item Align' to 'Right'.", 'megamenu' ) ), |
|
| 1059 | + 'settings' => array( |
|
| 1060 | + array( |
|
| 1061 | + 'title' => '', |
|
| 1062 | + 'type' => 'align', |
|
| 1063 | + 'key' => 'menu_item_align', |
|
| 1064 | + ), |
|
| 1065 | + ), |
|
| 1066 | + ), |
|
| 1067 | + 'menu_item_font' => array( |
|
| 1068 | + 'priority' => 60, |
|
| 1069 | + 'title' => __( 'Item Font', 'megamenu' ), |
|
| 1070 | + 'description' => __( 'The font to use for each top level menu item.', 'megamenu' ), |
|
| 1071 | + 'settings' => array( |
|
| 1072 | + array( |
|
| 1073 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 1074 | + 'type' => 'color', |
|
| 1075 | + 'key' => 'menu_item_link_color', |
|
| 1076 | + ), |
|
| 1077 | + array( |
|
| 1078 | + 'title' => __( 'Size', 'megamenu' ), |
|
| 1079 | + 'type' => 'freetext', |
|
| 1080 | + 'key' => 'menu_item_link_font_size', |
|
| 1081 | + 'validation' => 'px', |
|
| 1082 | + ), |
|
| 1083 | + array( |
|
| 1084 | + 'title' => __( 'Family', 'megamenu' ), |
|
| 1085 | + 'type' => 'font', |
|
| 1086 | + 'key' => 'menu_item_link_font', |
|
| 1087 | + ), |
|
| 1088 | + array( |
|
| 1089 | + 'title' => __( 'Transform', 'megamenu' ), |
|
| 1090 | + 'type' => 'transform', |
|
| 1091 | + 'key' => 'menu_item_link_text_transform', |
|
| 1092 | + ), |
|
| 1093 | + array( |
|
| 1094 | + 'title' => __( 'Weight', 'megamenu' ), |
|
| 1095 | + 'type' => 'weight', |
|
| 1096 | + 'key' => 'menu_item_link_weight', |
|
| 1097 | + ), |
|
| 1098 | + array( |
|
| 1099 | + 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1100 | + 'type' => 'decoration', |
|
| 1101 | + 'key' => 'menu_item_link_text_decoration', |
|
| 1102 | + ), |
|
| 1103 | + array( |
|
| 1104 | + 'title' => __( 'Align', 'megamenu' ), |
|
| 1105 | + 'type' => 'align', |
|
| 1106 | + 'key' => 'menu_item_link_text_align', |
|
| 1107 | + ), |
|
| 1108 | + ), |
|
| 1109 | + ), |
|
| 1110 | + 'menu_item_font_hover' => array( |
|
| 1111 | + 'priority' => 65, |
|
| 1112 | + 'title' => __( 'Item Font (Hover)', 'megamenu' ), |
|
| 1113 | + 'description' => __( 'Set the font to use for each top level menu item (on hover).', 'megamenu' ), |
|
| 1114 | + 'settings' => array( |
|
| 1115 | + array( |
|
| 1116 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 1117 | + 'type' => 'color', |
|
| 1118 | + 'key' => 'menu_item_link_color_hover', |
|
| 1119 | + ), |
|
| 1120 | + array( |
|
| 1121 | + 'title' => __( 'Weight', 'megamenu' ), |
|
| 1122 | + 'type' => 'weight', |
|
| 1123 | + 'key' => 'menu_item_link_weight_hover', |
|
| 1124 | + ), |
|
| 1125 | + array( |
|
| 1126 | + 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1127 | + 'type' => 'decoration', |
|
| 1128 | + 'key' => 'menu_item_link_text_decoration_hover', |
|
| 1129 | + ), |
|
| 1130 | + ), |
|
| 1131 | + ), |
|
| 1132 | + 'menu_item_background' => array( |
|
| 1133 | + 'priority' => 70, |
|
| 1134 | + 'title' => __( 'Item Background', 'megamenu' ), |
|
| 1135 | + 'description' => __( "The background color for each top level menu item. Tip: Set these values to transparent if you've already set a background color on the menu bar.", 'megamenu' ), |
|
| 1136 | + 'settings' => array( |
|
| 1137 | + array( |
|
| 1138 | + 'title' => __( 'From', 'megamenu' ), |
|
| 1139 | + 'type' => 'color', |
|
| 1140 | + 'key' => 'menu_item_background_from', |
|
| 1141 | + ), |
|
| 1142 | + array( |
|
| 1143 | + 'title' => __( 'Copy', 'megamenu' ), |
|
| 1144 | + 'type' => 'copy_color', |
|
| 1145 | + 'key' => 'copy_color', |
|
| 1146 | + ), |
|
| 1147 | + array( |
|
| 1148 | + 'title' => __( 'To', 'megamenu' ), |
|
| 1149 | + 'type' => 'color', |
|
| 1150 | + 'key' => 'menu_item_background_to', |
|
| 1151 | + ), |
|
| 1152 | + ), |
|
| 1153 | + ), |
|
| 1154 | + 'menu_item_background_hover' => array( |
|
| 1155 | + 'priority' => 75, |
|
| 1156 | + 'title' => __( 'Item Background (Hover)', 'megamenu' ), |
|
| 1157 | + 'description' => __( 'The background color for a top level menu item (on hover).', 'megamenu' ), |
|
| 1158 | + 'settings' => array( |
|
| 1159 | + array( |
|
| 1160 | + 'title' => __( 'From', 'megamenu' ), |
|
| 1161 | + 'type' => 'color', |
|
| 1162 | + 'key' => 'menu_item_background_hover_from', |
|
| 1163 | + ), |
|
| 1164 | + array( |
|
| 1165 | + 'title' => __( 'Copy', 'megamenu' ), |
|
| 1166 | + 'type' => 'copy_color', |
|
| 1167 | + 'key' => 'copy_color', |
|
| 1168 | + ), |
|
| 1169 | + array( |
|
| 1170 | + 'title' => __( 'To', 'megamenu' ), |
|
| 1171 | + 'type' => 'color', |
|
| 1172 | + 'key' => 'menu_item_background_hover_to', |
|
| 1173 | + ), |
|
| 1174 | + ), |
|
| 1175 | + ), |
|
| 1176 | + 'menu_item_spacing' => array( |
|
| 1177 | + 'priority' => 80, |
|
| 1178 | + 'title' => __( 'Item Spacing', 'megamenu' ), |
|
| 1179 | + 'description' => __( 'Define the size of the gap between each top level menu item.', 'megamenu' ), |
|
| 1180 | + 'settings' => array( |
|
| 1181 | + array( |
|
| 1182 | + 'title' => '', |
|
| 1183 | + 'type' => 'freetext', |
|
| 1184 | + 'key' => 'menu_item_spacing', |
|
| 1185 | + 'validation' => 'px', |
|
| 1186 | + ), |
|
| 1187 | + ), |
|
| 1188 | + ), |
|
| 1189 | + |
|
| 1190 | + 'menu_item_padding' => array( |
|
| 1191 | + 'priority' => 85, |
|
| 1192 | + 'title' => __( 'Item Padding', 'megamenu' ), |
|
| 1193 | + 'description' => __( 'Set the padding for each top level menu item.', 'megamenu' ), |
|
| 1194 | + 'info' => array( __( "Generally we advise against using the Top and Bottom options here. Use the 'Menu Height' setting to determine the height of your top level menu items.", 'megamenu' ) ), |
|
| 1195 | + 'settings' => array( |
|
| 1196 | + array( |
|
| 1197 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 1198 | + 'type' => 'freetext', |
|
| 1199 | + 'key' => 'menu_item_link_padding_top', |
|
| 1200 | + 'validation' => 'px', |
|
| 1201 | + ), |
|
| 1202 | + array( |
|
| 1203 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 1204 | + 'type' => 'freetext', |
|
| 1205 | + 'key' => 'menu_item_link_padding_right', |
|
| 1206 | + 'validation' => 'px', |
|
| 1207 | + ), |
|
| 1208 | + array( |
|
| 1209 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1210 | + 'type' => 'freetext', |
|
| 1211 | + 'key' => 'menu_item_link_padding_bottom', |
|
| 1212 | + 'validation' => 'px', |
|
| 1213 | + ), |
|
| 1214 | + array( |
|
| 1215 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 1216 | + 'type' => 'freetext', |
|
| 1217 | + 'key' => 'menu_item_link_padding_left', |
|
| 1218 | + 'validation' => 'px', |
|
| 1219 | + ), |
|
| 1220 | + ), |
|
| 1221 | + ), |
|
| 1222 | + 'menu_item_border' => array( |
|
| 1223 | + 'priority' => 90, |
|
| 1224 | + 'title' => __( 'Item Border', 'megamenu' ), |
|
| 1225 | + 'description' => __( 'Set the border to display on each top level menu item.', 'megamenu' ), |
|
| 1226 | + 'settings' => array( |
|
| 1227 | + array( |
|
| 1228 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 1229 | + 'type' => 'color', |
|
| 1230 | + 'key' => 'menu_item_border_color', |
|
| 1231 | + ), |
|
| 1232 | + array( |
|
| 1233 | + 'title' => __( 'Color (Hover)', 'megamenu' ), |
|
| 1234 | + 'type' => 'color', |
|
| 1235 | + 'key' => 'menu_item_border_color_hover', |
|
| 1236 | + ), |
|
| 1237 | + array( |
|
| 1238 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 1239 | + 'type' => 'freetext', |
|
| 1240 | + 'key' => 'menu_item_border_top', |
|
| 1241 | + 'validation' => 'px', |
|
| 1242 | + ), |
|
| 1243 | + array( |
|
| 1244 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 1245 | + 'type' => 'freetext', |
|
| 1246 | + 'key' => 'menu_item_border_right', |
|
| 1247 | + 'validation' => 'px', |
|
| 1248 | + ), |
|
| 1249 | + array( |
|
| 1250 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1251 | + 'type' => 'freetext', |
|
| 1252 | + 'key' => 'menu_item_border_bottom', |
|
| 1253 | + 'validation' => 'px', |
|
| 1254 | + ), |
|
| 1255 | + array( |
|
| 1256 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 1257 | + 'type' => 'freetext', |
|
| 1258 | + 'key' => 'menu_item_border_left', |
|
| 1259 | + 'validation' => 'px', |
|
| 1260 | + ), |
|
| 1261 | + ), |
|
| 1262 | + ), |
|
| 1263 | + 'menu_item_border_radius' => array( |
|
| 1264 | + 'priority' => 95, |
|
| 1265 | + 'title' => __( 'Item Border Radius', 'megamenu' ), |
|
| 1266 | + 'description' => __( 'Set rounded corners for each top level menu item.', 'megamenu' ), |
|
| 1267 | + 'settings' => array( |
|
| 1268 | + array( |
|
| 1269 | + 'title' => __( 'Top Left', 'megamenu' ), |
|
| 1270 | + 'type' => 'freetext', |
|
| 1271 | + 'key' => 'menu_item_link_border_radius_top_left', |
|
| 1272 | + 'validation' => 'px', |
|
| 1273 | + ), |
|
| 1274 | + array( |
|
| 1275 | + 'title' => __( 'Top Right', 'megamenu' ), |
|
| 1276 | + 'type' => 'freetext', |
|
| 1277 | + 'key' => 'menu_item_link_border_radius_top_right', |
|
| 1278 | + 'validation' => 'px', |
|
| 1279 | + ), |
|
| 1280 | + array( |
|
| 1281 | + 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 1282 | + 'type' => 'freetext', |
|
| 1283 | + 'key' => 'menu_item_link_border_radius_bottom_right', |
|
| 1284 | + 'validation' => 'px', |
|
| 1285 | + ), |
|
| 1286 | + array( |
|
| 1287 | + 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 1288 | + 'type' => 'freetext', |
|
| 1289 | + 'key' => 'menu_item_link_border_radius_bottom_left', |
|
| 1290 | + 'validation' => 'px', |
|
| 1291 | + ), |
|
| 1292 | + ), |
|
| 1293 | + ), |
|
| 1294 | + 'menu_item_divider' => array( |
|
| 1295 | + 'priority' => 160, |
|
| 1296 | + 'title' => __( 'Item Divider', 'megamenu' ), |
|
| 1297 | + 'description' => __( 'Show a small divider bar between each menu item.', 'megamenu' ), |
|
| 1298 | + 'settings' => array( |
|
| 1299 | + array( |
|
| 1300 | + 'title' => __( 'Enabled', 'megamenu' ), |
|
| 1301 | + 'type' => 'checkbox', |
|
| 1302 | + 'key' => 'menu_item_divider', |
|
| 1303 | + ), |
|
| 1304 | + array( |
|
| 1305 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 1306 | + 'type' => 'color', |
|
| 1307 | + 'key' => 'menu_item_divider_color', |
|
| 1308 | + ), |
|
| 1309 | + array( |
|
| 1310 | + 'title' => __( 'Glow Opacity', 'megamenu' ), |
|
| 1311 | + 'type' => 'freetext', |
|
| 1312 | + 'key' => 'menu_item_divider_glow_opacity', |
|
| 1313 | + 'validation' => 'float', |
|
| 1314 | + ), |
|
| 1315 | + ), |
|
| 1316 | + ), |
|
| 1317 | + 'menu_item_highlight' => array( |
|
| 1318 | + 'priority' => 170, |
|
| 1319 | + 'title' => __( 'Highlight Current Item', 'megamenu' ), |
|
| 1320 | + 'description' => __( "Apply the 'hover' styling to current menu items. Applies to top level menu items only.", 'megamenu' ), |
|
| 1321 | + 'settings' => array( |
|
| 1322 | + array( |
|
| 1323 | + 'title' => __( 'Enabled', 'megamenu' ), |
|
| 1324 | + 'type' => 'checkbox', |
|
| 1325 | + 'key' => 'menu_item_highlight_current', |
|
| 1326 | + ), |
|
| 1327 | + ), |
|
| 1328 | + 'info' => array( |
|
| 1329 | + "<a href='https://www.megamenu.com/documentation/highlight-active-menu-items/' target='blank'>" . __( 'Documentation: Highlighting Menu Items', 'megamenu' ) . '</a>', |
|
| 1330 | + ), |
|
| 1331 | + ), |
|
| 1332 | + ), |
|
| 1333 | + ), |
|
| 1334 | + 'mega_panels' => array( |
|
| 1335 | + 'title' => __( 'Mega Menus', 'megamenu' ), |
|
| 1336 | + 'settings' => array( |
|
| 1337 | + 'panel_background' => array( |
|
| 1338 | + 'priority' => 10, |
|
| 1339 | + 'title' => __( 'Panel Background', 'megamenu' ), |
|
| 1340 | + 'description' => __( 'Set a background color for a whole sub menu.', 'megamenu' ), |
|
| 1341 | + 'settings' => array( |
|
| 1342 | + array( |
|
| 1343 | + 'title' => __( 'From', 'megamenu' ), |
|
| 1344 | + 'type' => 'color', |
|
| 1345 | + 'key' => 'panel_background_from', |
|
| 1346 | + ), |
|
| 1347 | + array( |
|
| 1348 | + 'title' => __( 'Copy', 'megamenu' ), |
|
| 1349 | + 'type' => 'copy_color', |
|
| 1350 | + 'key' => 'copy_color', |
|
| 1351 | + ), |
|
| 1352 | + array( |
|
| 1353 | + 'title' => __( 'To', 'megamenu' ), |
|
| 1354 | + 'type' => 'color', |
|
| 1355 | + 'key' => 'panel_background_to', |
|
| 1356 | + ), |
|
| 1357 | + ), |
|
| 1358 | + ), |
|
| 1359 | + 'panel_width' => array( |
|
| 1360 | + 'priority' => 20, |
|
| 1361 | + 'title' => __( 'Panel Width', 'megamenu' ), |
|
| 1362 | + 'description' => __( 'Mega Panel width.', 'megamenu' ), |
|
| 1363 | + 'info' => array( |
|
| 1364 | + __( 'A 100% wide panel will only ever be as wide as the menu itself. For a fixed sub menu width set this to a pixel value.', 'megamenu' ), |
|
| 1365 | + __( 'Advanced: Enter a jQuery selector to synchronize the width and position of the sub menu with existing page element (e.g. body, #container, .page).', 'megamenu' ), |
|
| 1366 | + "<a href='https://www.megamenu.com/documentation/adjust-sub-menu-width/' target='blank'>" . __( 'Documentation: Configuring the sub menu width', 'megamenu' ) . '</a>', |
|
| 1367 | + ), |
|
| 1368 | + 'settings' => array( |
|
| 1369 | + array( |
|
| 1370 | + 'title' => __( 'Outer Width', 'megamenu' ), |
|
| 1371 | + 'type' => 'freetext', |
|
| 1372 | + 'key' => 'panel_width', |
|
| 1373 | + ), |
|
| 1374 | + array( |
|
| 1375 | + 'title' => __( 'Inner Width', 'megamenu' ), |
|
| 1376 | + 'type' => 'freetext', |
|
| 1377 | + 'key' => 'panel_inner_width', |
|
| 1378 | + ), |
|
| 1379 | + ), |
|
| 1380 | + ), |
|
| 1381 | + 'panel_padding' => array( |
|
| 1382 | + 'priority' => 30, |
|
| 1383 | + 'title' => __( 'Panel Padding', 'megamenu' ), |
|
| 1384 | + 'description' => __( 'Set the padding for the whole sub menu. Set these values 0px if you wish your sub menu content to go edge-to-edge.', 'megamenu' ), |
|
| 1385 | + 'settings' => array( |
|
| 1386 | + array( |
|
| 1387 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 1388 | + 'type' => 'freetext', |
|
| 1389 | + 'key' => 'panel_padding_top', |
|
| 1390 | + 'validation' => 'px', |
|
| 1391 | + ), |
|
| 1392 | + array( |
|
| 1393 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 1394 | + 'type' => 'freetext', |
|
| 1395 | + 'key' => 'panel_padding_right', |
|
| 1396 | + 'validation' => 'px', |
|
| 1397 | + ), |
|
| 1398 | + array( |
|
| 1399 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1400 | + 'type' => 'freetext', |
|
| 1401 | + 'key' => 'panel_padding_bottom', |
|
| 1402 | + 'validation' => 'px', |
|
| 1403 | + ), |
|
| 1404 | + array( |
|
| 1405 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 1406 | + 'type' => 'freetext', |
|
| 1407 | + 'key' => 'panel_padding_left', |
|
| 1408 | + 'validation' => 'px', |
|
| 1409 | + ), |
|
| 1410 | + ), |
|
| 1411 | + ), |
|
| 1412 | + 'panel_border' => array( |
|
| 1413 | + 'priority' => 40, |
|
| 1414 | + 'title' => __( 'Panel Border', 'megamenu' ), |
|
| 1415 | + 'description' => __( 'Set the border to display on the sub menu.', 'megamenu' ), |
|
| 1416 | + 'settings' => array( |
|
| 1417 | + array( |
|
| 1418 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 1419 | + 'type' => 'color', |
|
| 1420 | + 'key' => 'panel_border_color', |
|
| 1421 | + ), |
|
| 1422 | + array( |
|
| 1423 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 1424 | + 'type' => 'freetext', |
|
| 1425 | + 'key' => 'panel_border_top', |
|
| 1426 | + 'validation' => 'px', |
|
| 1427 | + ), |
|
| 1428 | + array( |
|
| 1429 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 1430 | + 'type' => 'freetext', |
|
| 1431 | + 'key' => 'panel_border_right', |
|
| 1432 | + 'validation' => 'px', |
|
| 1433 | + ), |
|
| 1434 | + array( |
|
| 1435 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1436 | + 'type' => 'freetext', |
|
| 1437 | + 'key' => 'panel_border_bottom', |
|
| 1438 | + 'validation' => 'px', |
|
| 1439 | + ), |
|
| 1440 | + array( |
|
| 1441 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 1442 | + 'type' => 'freetext', |
|
| 1443 | + 'key' => 'panel_border_left', |
|
| 1444 | + 'validation' => 'px', |
|
| 1445 | + ), |
|
| 1446 | + ), |
|
| 1447 | + ), |
|
| 1448 | + 'panel_border_radius' => array( |
|
| 1449 | + 'priority' => 50, |
|
| 1450 | + 'title' => __( 'Panel Border Radius', 'megamenu' ), |
|
| 1451 | + 'description' => __( 'Set rounded corners for the sub menu.', 'megamenu' ), |
|
| 1452 | + 'settings' => array( |
|
| 1453 | + array( |
|
| 1454 | + 'title' => __( 'Top Left', 'megamenu' ), |
|
| 1455 | + 'type' => 'freetext', |
|
| 1456 | + 'key' => 'panel_border_radius_top_left', |
|
| 1457 | + 'validation' => 'px', |
|
| 1458 | + ), |
|
| 1459 | + array( |
|
| 1460 | + 'title' => __( 'Top Right', 'megamenu' ), |
|
| 1461 | + 'type' => 'freetext', |
|
| 1462 | + 'key' => 'panel_border_radius_top_right', |
|
| 1463 | + 'validation' => 'px', |
|
| 1464 | + ), |
|
| 1465 | + array( |
|
| 1466 | + 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 1467 | + 'type' => 'freetext', |
|
| 1468 | + 'key' => 'panel_border_radius_bottom_right', |
|
| 1469 | + 'validation' => 'px', |
|
| 1470 | + ), |
|
| 1471 | + array( |
|
| 1472 | + 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 1473 | + 'type' => 'freetext', |
|
| 1474 | + 'key' => 'panel_border_radius_bottom_left', |
|
| 1475 | + 'validation' => 'px', |
|
| 1476 | + ), |
|
| 1477 | + ), |
|
| 1478 | + ), |
|
| 1479 | + 'widget_padding' => array( |
|
| 1480 | + 'priority' => 60, |
|
| 1481 | + 'title' => __( 'Column Padding', 'megamenu' ), |
|
| 1482 | + 'description' => __( 'Use this to define the amount of space around each widget / set of menu items within the sub menu.', 'megamenu' ), |
|
| 1483 | + 'settings' => array( |
|
| 1484 | + array( |
|
| 1485 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 1486 | + 'type' => 'freetext', |
|
| 1487 | + 'key' => 'panel_widget_padding_top', |
|
| 1488 | + 'validation' => 'px', |
|
| 1489 | + ), |
|
| 1490 | + array( |
|
| 1491 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 1492 | + 'type' => 'freetext', |
|
| 1493 | + 'key' => 'panel_widget_padding_right', |
|
| 1494 | + 'validation' => 'px', |
|
| 1495 | + ), |
|
| 1496 | + array( |
|
| 1497 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1498 | + 'type' => 'freetext', |
|
| 1499 | + 'key' => 'panel_widget_padding_bottom', |
|
| 1500 | + 'validation' => 'px', |
|
| 1501 | + ), |
|
| 1502 | + array( |
|
| 1503 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 1504 | + 'type' => 'freetext', |
|
| 1505 | + 'key' => 'panel_widget_padding_left', |
|
| 1506 | + 'validation' => 'px', |
|
| 1507 | + ), |
|
| 1508 | + ), |
|
| 1509 | + ), |
|
| 1510 | + 'mega_menu_widgets' => array( |
|
| 1511 | + 'priority' => 65, |
|
| 1512 | + 'title' => __( 'Widgets', 'megamenu' ), |
|
| 1513 | + 'description' => '', |
|
| 1514 | + ), |
|
| 1515 | + 'widget_heading_font' => array( |
|
| 1516 | + 'priority' => 70, |
|
| 1517 | + 'title' => __( 'Title Font', 'megamenu' ), |
|
| 1518 | + 'description' => __( 'Set the font to use Widget headers in the mega menu. Tip: set this to the same style as the Second Level Menu Item Font to keep your styling consistent.', 'megamenu' ), |
|
| 1519 | + 'settings' => array( |
|
| 1520 | + array( |
|
| 1521 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 1522 | + 'type' => 'color', |
|
| 1523 | + 'key' => 'panel_header_color', |
|
| 1524 | + ), |
|
| 1525 | + array( |
|
| 1526 | + 'title' => __( 'Size', 'megamenu' ), |
|
| 1527 | + 'type' => 'freetext', |
|
| 1528 | + 'key' => 'panel_header_font_size', |
|
| 1529 | + 'validation' => 'px', |
|
| 1530 | + ), |
|
| 1531 | + array( |
|
| 1532 | + 'title' => __( 'Family', 'megamenu' ), |
|
| 1533 | + 'type' => 'font', |
|
| 1534 | + 'key' => 'panel_header_font', |
|
| 1535 | + ), |
|
| 1536 | + array( |
|
| 1537 | + 'title' => __( 'Transform', 'megamenu' ), |
|
| 1538 | + 'type' => 'transform', |
|
| 1539 | + 'key' => 'panel_header_text_transform', |
|
| 1540 | + ), |
|
| 1541 | + array( |
|
| 1542 | + 'title' => __( 'Weight', 'megamenu' ), |
|
| 1543 | + 'type' => 'weight', |
|
| 1544 | + 'key' => 'panel_header_font_weight', |
|
| 1545 | + ), |
|
| 1546 | + array( |
|
| 1547 | + 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1548 | + 'type' => 'decoration', |
|
| 1549 | + 'key' => 'panel_header_text_decoration', |
|
| 1550 | + ), |
|
| 1551 | + array( |
|
| 1552 | + 'title' => __( 'Align', 'megamenu' ), |
|
| 1553 | + 'type' => 'align', |
|
| 1554 | + 'key' => 'panel_header_text_align', |
|
| 1555 | + ), |
|
| 1556 | + ), |
|
| 1557 | + ), |
|
| 1558 | + 'widget_heading_padding' => array( |
|
| 1559 | + 'priority' => 90, |
|
| 1560 | + 'title' => __( 'Title Padding', 'megamenu' ), |
|
| 1561 | + 'description' => __( 'Set the padding for the widget headings.', 'megamenu' ), |
|
| 1562 | + 'settings' => array( |
|
| 1563 | + array( |
|
| 1564 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 1565 | + 'type' => 'freetext', |
|
| 1566 | + 'key' => 'panel_header_padding_top', |
|
| 1567 | + 'validation' => 'px', |
|
| 1568 | + ), |
|
| 1569 | + array( |
|
| 1570 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 1571 | + 'type' => 'freetext', |
|
| 1572 | + 'key' => 'panel_header_padding_right', |
|
| 1573 | + 'validation' => 'px', |
|
| 1574 | + ), |
|
| 1575 | + array( |
|
| 1576 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1577 | + 'type' => 'freetext', |
|
| 1578 | + 'key' => 'panel_header_padding_bottom', |
|
| 1579 | + 'validation' => 'px', |
|
| 1580 | + ), |
|
| 1581 | + array( |
|
| 1582 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 1583 | + 'type' => 'freetext', |
|
| 1584 | + 'key' => 'panel_header_padding_left', |
|
| 1585 | + 'validation' => 'px', |
|
| 1586 | + ), |
|
| 1587 | + ), |
|
| 1588 | + ), |
|
| 1589 | + 'widget_heading_margin' => array( |
|
| 1590 | + 'priority' => 100, |
|
| 1591 | + 'title' => __( 'Title Margin', 'megamenu' ), |
|
| 1592 | + 'description' => __( 'Set the margin for the widget headings.', 'megamenu' ), |
|
| 1593 | + 'settings' => array( |
|
| 1594 | + array( |
|
| 1595 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 1596 | + 'type' => 'freetext', |
|
| 1597 | + 'key' => 'panel_header_margin_top', |
|
| 1598 | + 'validation' => 'px', |
|
| 1599 | + ), |
|
| 1600 | + array( |
|
| 1601 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 1602 | + 'type' => 'freetext', |
|
| 1603 | + 'key' => 'panel_header_margin_right', |
|
| 1604 | + 'validation' => 'px', |
|
| 1605 | + ), |
|
| 1606 | + array( |
|
| 1607 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1608 | + 'type' => 'freetext', |
|
| 1609 | + 'key' => 'panel_header_margin_bottom', |
|
| 1610 | + 'validation' => 'px', |
|
| 1611 | + ), |
|
| 1612 | + array( |
|
| 1613 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 1614 | + 'type' => 'freetext', |
|
| 1615 | + 'key' => 'panel_header_margin_left', |
|
| 1616 | + 'validation' => 'px', |
|
| 1617 | + ), |
|
| 1618 | + ), |
|
| 1619 | + ), |
|
| 1620 | + 'widget_header_border' => array( |
|
| 1621 | + 'priority' => 110, |
|
| 1622 | + 'title' => __( 'Title Border', 'megamenu' ), |
|
| 1623 | + 'description' => __( 'Set the border for the widget headings.', 'megamenu' ), |
|
| 1624 | + 'settings' => array( |
|
| 1625 | + array( |
|
| 1626 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 1627 | + 'type' => 'color', |
|
| 1628 | + 'key' => 'panel_header_border_color', |
|
| 1629 | + ), |
|
| 1630 | + array( |
|
| 1631 | + 'title' => __( 'Color (Hover)', 'megamenu' ), |
|
| 1632 | + 'type' => 'color', |
|
| 1633 | + 'key' => 'panel_header_border_color_hover', |
|
| 1634 | + ), |
|
| 1635 | + array( |
|
| 1636 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 1637 | + 'type' => 'freetext', |
|
| 1638 | + 'key' => 'panel_header_border_top', |
|
| 1639 | + 'validation' => 'px', |
|
| 1640 | + ), |
|
| 1641 | + array( |
|
| 1642 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 1643 | + 'type' => 'freetext', |
|
| 1644 | + 'key' => 'panel_header_border_right', |
|
| 1645 | + 'validation' => 'px', |
|
| 1646 | + ), |
|
| 1647 | + array( |
|
| 1648 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1649 | + 'type' => 'freetext', |
|
| 1650 | + 'key' => 'panel_header_border_bottom', |
|
| 1651 | + 'validation' => 'px', |
|
| 1652 | + ), |
|
| 1653 | + array( |
|
| 1654 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 1655 | + 'type' => 'freetext', |
|
| 1656 | + 'key' => 'panel_header_border_left', |
|
| 1657 | + 'validation' => 'px', |
|
| 1658 | + ), |
|
| 1659 | + ), |
|
| 1660 | + ), |
|
| 1661 | + 'widget_content_font' => array( |
|
| 1662 | + 'priority' => 115, |
|
| 1663 | + 'title' => __( 'Content Font', 'megamenu' ), |
|
| 1664 | + 'description' => __( 'Set the font to use for panel contents.', 'megamenu' ), |
|
| 1665 | + 'settings' => array( |
|
| 1666 | + array( |
|
| 1667 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 1668 | + 'type' => 'color', |
|
| 1669 | + 'key' => 'panel_font_color', |
|
| 1670 | + ), |
|
| 1671 | + array( |
|
| 1672 | + 'title' => __( 'Size', 'megamenu' ), |
|
| 1673 | + 'type' => 'freetext', |
|
| 1674 | + 'key' => 'panel_font_size', |
|
| 1675 | + 'validation' => 'px', |
|
| 1676 | + ), |
|
| 1677 | + array( |
|
| 1678 | + 'title' => __( 'Family', 'megamenu' ), |
|
| 1679 | + 'type' => 'font', |
|
| 1680 | + 'key' => 'panel_font_family', |
|
| 1681 | + ), |
|
| 1682 | + ), |
|
| 1683 | + ), |
|
| 1684 | + 'second_level_menu_items' => array( |
|
| 1685 | + 'priority' => 120, |
|
| 1686 | + 'title' => __( 'Second Level Menu Items', 'megamenu' ), |
|
| 1687 | + 'description' => '', |
|
| 1688 | + ), |
|
| 1689 | + 'second_level_font' => array( |
|
| 1690 | + 'priority' => 130, |
|
| 1691 | + 'title' => __( 'Item Font', 'megamenu' ), |
|
| 1692 | + 'description' => __( "Set the font for second level menu items when they're displayed in a Mega Menu.", 'megamenu' ), |
|
| 1693 | + 'settings' => array( |
|
| 1694 | + array( |
|
| 1695 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 1696 | + 'type' => 'color', |
|
| 1697 | + 'key' => 'panel_second_level_font_color', |
|
| 1698 | + ), |
|
| 1699 | + array( |
|
| 1700 | + 'title' => __( 'Size', 'megamenu' ), |
|
| 1701 | + 'type' => 'freetext', |
|
| 1702 | + 'key' => 'panel_second_level_font_size', |
|
| 1703 | + 'validation' => 'px', |
|
| 1704 | + ), |
|
| 1705 | + array( |
|
| 1706 | + 'title' => __( 'Family', 'megamenu' ), |
|
| 1707 | + 'type' => 'font', |
|
| 1708 | + 'key' => 'panel_second_level_font', |
|
| 1709 | + ), |
|
| 1710 | + array( |
|
| 1711 | + 'title' => __( 'Transform', 'megamenu' ), |
|
| 1712 | + 'type' => 'transform', |
|
| 1713 | + 'key' => 'panel_second_level_text_transform', |
|
| 1714 | + ), |
|
| 1715 | + array( |
|
| 1716 | + 'title' => __( 'Weight', 'megamenu' ), |
|
| 1717 | + 'type' => 'weight', |
|
| 1718 | + 'key' => 'panel_second_level_font_weight', |
|
| 1719 | + ), |
|
| 1720 | + array( |
|
| 1721 | + 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1722 | + 'type' => 'decoration', |
|
| 1723 | + 'key' => 'panel_second_level_text_decoration', |
|
| 1724 | + ), |
|
| 1725 | + array( |
|
| 1726 | + 'title' => __( 'Align', 'megamenu' ), |
|
| 1727 | + 'type' => 'align', |
|
| 1728 | + 'key' => 'panel_second_level_text_align', |
|
| 1729 | + ), |
|
| 1730 | + ), |
|
| 1731 | + ), |
|
| 1732 | + 'second_level_font_hover' => array( |
|
| 1733 | + 'priority' => 140, |
|
| 1734 | + 'title' => __( 'Item Font (Hover)', 'megamenu' ), |
|
| 1735 | + 'description' => __( 'Set the font style on hover.', 'megamenu' ), |
|
| 1736 | + 'settings' => array( |
|
| 1737 | + array( |
|
| 1738 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 1739 | + 'type' => 'color', |
|
| 1740 | + 'key' => 'panel_second_level_font_color_hover', |
|
| 1741 | + ), |
|
| 1742 | + array( |
|
| 1743 | + 'title' => __( 'Weight', 'megamenu' ), |
|
| 1744 | + 'type' => 'weight', |
|
| 1745 | + 'key' => 'panel_second_level_font_weight_hover', |
|
| 1746 | + ), |
|
| 1747 | + array( |
|
| 1748 | + 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1749 | + 'type' => 'decoration', |
|
| 1750 | + 'key' => 'panel_second_level_text_decoration_hover', |
|
| 1751 | + ), |
|
| 1752 | + ), |
|
| 1753 | + ), |
|
| 1754 | + 'second_level_background_hover' => array( |
|
| 1755 | + 'priority' => 150, |
|
| 1756 | + 'title' => __( 'Item Background (Hover)', 'megamenu' ), |
|
| 1757 | + 'description' => __( 'Set the background hover color for second level menu items.', 'megamenu' ), |
|
| 1758 | + 'settings' => array( |
|
| 1759 | + array( |
|
| 1760 | + 'title' => __( 'From', 'megamenu' ), |
|
| 1761 | + 'type' => 'color', |
|
| 1762 | + 'key' => 'panel_second_level_background_hover_from', |
|
| 1763 | + ), |
|
| 1764 | + array( |
|
| 1765 | + 'title' => __( 'Copy', 'megamenu' ), |
|
| 1766 | + 'type' => 'copy_color', |
|
| 1767 | + 'key' => 'copy_color', |
|
| 1768 | + ), |
|
| 1769 | + array( |
|
| 1770 | + 'title' => __( 'To', 'megamenu' ), |
|
| 1771 | + 'type' => 'color', |
|
| 1772 | + 'key' => 'panel_second_level_background_hover_to', |
|
| 1773 | + ), |
|
| 1774 | + ), |
|
| 1775 | + ), |
|
| 1776 | + 'second_level_padding' => array( |
|
| 1777 | + 'priority' => 160, |
|
| 1778 | + 'title' => __( 'Item Padding', 'megamenu' ), |
|
| 1779 | + 'description' => __( 'Set the padding for the second level menu items.', 'megamenu' ), |
|
| 1780 | + 'settings' => array( |
|
| 1781 | + array( |
|
| 1782 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 1783 | + 'type' => 'freetext', |
|
| 1784 | + 'key' => 'panel_second_level_padding_top', |
|
| 1785 | + 'validation' => 'px', |
|
| 1786 | + ), |
|
| 1787 | + array( |
|
| 1788 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 1789 | + 'type' => 'freetext', |
|
| 1790 | + 'key' => 'panel_second_level_padding_right', |
|
| 1791 | + 'validation' => 'px', |
|
| 1792 | + ), |
|
| 1793 | + array( |
|
| 1794 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1795 | + 'type' => 'freetext', |
|
| 1796 | + 'key' => 'panel_second_level_padding_bottom', |
|
| 1797 | + 'validation' => 'px', |
|
| 1798 | + ), |
|
| 1799 | + array( |
|
| 1800 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 1801 | + 'type' => 'freetext', |
|
| 1802 | + 'key' => 'panel_second_level_padding_left', |
|
| 1803 | + 'validation' => 'px', |
|
| 1804 | + ), |
|
| 1805 | + ), |
|
| 1806 | + ), |
|
| 1807 | + 'second_level_margin' => array( |
|
| 1808 | + 'priority' => 170, |
|
| 1809 | + 'title' => __( 'Item Margin', 'megamenu' ), |
|
| 1810 | + 'description' => __( 'Set the margin for the second level menu items.', 'megamenu' ), |
|
| 1811 | + 'settings' => array( |
|
| 1812 | + array( |
|
| 1813 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 1814 | + 'type' => 'freetext', |
|
| 1815 | + 'key' => 'panel_second_level_margin_top', |
|
| 1816 | + 'validation' => 'px', |
|
| 1817 | + ), |
|
| 1818 | + array( |
|
| 1819 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 1820 | + 'type' => 'freetext', |
|
| 1821 | + 'key' => 'panel_second_level_margin_right', |
|
| 1822 | + 'validation' => 'px', |
|
| 1823 | + ), |
|
| 1824 | + array( |
|
| 1825 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1826 | + 'type' => 'freetext', |
|
| 1827 | + 'key' => 'panel_second_level_margin_bottom', |
|
| 1828 | + 'validation' => 'px', |
|
| 1829 | + ), |
|
| 1830 | + array( |
|
| 1831 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 1832 | + 'type' => 'freetext', |
|
| 1833 | + 'key' => 'panel_second_level_margin_left', |
|
| 1834 | + 'validation' => 'px', |
|
| 1835 | + ), |
|
| 1836 | + ), |
|
| 1837 | + ), |
|
| 1838 | + 'second_level_border' => array( |
|
| 1839 | + 'priority' => 180, |
|
| 1840 | + 'title' => __( 'Item Border', 'megamenu' ), |
|
| 1841 | + 'description' => __( 'Set the border for the second level menu items.', 'megamenu' ), |
|
| 1842 | + 'settings' => array( |
|
| 1843 | + array( |
|
| 1844 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 1845 | + 'type' => 'color', |
|
| 1846 | + 'key' => 'panel_second_level_border_color', |
|
| 1847 | + ), |
|
| 1848 | + array( |
|
| 1849 | + 'title' => __( 'Color (Hover)', 'megamenu' ), |
|
| 1850 | + 'type' => 'color', |
|
| 1851 | + 'key' => 'panel_second_level_border_color_hover', |
|
| 1852 | + ), |
|
| 1853 | + array( |
|
| 1854 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 1855 | + 'type' => 'freetext', |
|
| 1856 | + 'key' => 'panel_second_level_border_top', |
|
| 1857 | + 'validation' => 'px', |
|
| 1858 | + ), |
|
| 1859 | + array( |
|
| 1860 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 1861 | + 'type' => 'freetext', |
|
| 1862 | + 'key' => 'panel_second_level_border_right', |
|
| 1863 | + 'validation' => 'px', |
|
| 1864 | + ), |
|
| 1865 | + array( |
|
| 1866 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1867 | + 'type' => 'freetext', |
|
| 1868 | + 'key' => 'panel_second_level_border_bottom', |
|
| 1869 | + 'validation' => 'px', |
|
| 1870 | + ), |
|
| 1871 | + array( |
|
| 1872 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 1873 | + 'type' => 'freetext', |
|
| 1874 | + 'key' => 'panel_second_level_border_left', |
|
| 1875 | + 'validation' => 'px', |
|
| 1876 | + ), |
|
| 1877 | + ), |
|
| 1878 | + ), |
|
| 1879 | + 'third_level_menu_items' => array( |
|
| 1880 | + 'priority' => 190, |
|
| 1881 | + 'title' => __( 'Third Level Menu Items', 'megamenu' ), |
|
| 1882 | + 'description' => '', |
|
| 1883 | + ), |
|
| 1884 | + 'third_level_font' => array( |
|
| 1885 | + 'priority' => 200, |
|
| 1886 | + 'title' => __( 'Item Font', 'megamenu' ), |
|
| 1887 | + 'description' => __( "Set the font for third level menu items when they're displayed in a Mega Menu.", 'megamenu' ), |
|
| 1888 | + 'settings' => array( |
|
| 1889 | + array( |
|
| 1890 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 1891 | + 'type' => 'color', |
|
| 1892 | + 'key' => 'panel_third_level_font_color', |
|
| 1893 | + ), |
|
| 1894 | + array( |
|
| 1895 | + 'title' => __( 'Size', 'megamenu' ), |
|
| 1896 | + 'type' => 'freetext', |
|
| 1897 | + 'key' => 'panel_third_level_font_size', |
|
| 1898 | + 'validation' => 'px', |
|
| 1899 | + ), |
|
| 1900 | + array( |
|
| 1901 | + 'title' => __( 'Family', 'megamenu' ), |
|
| 1902 | + 'type' => 'font', |
|
| 1903 | + 'key' => 'panel_third_level_font', |
|
| 1904 | + ), |
|
| 1905 | + array( |
|
| 1906 | + 'title' => __( 'Transform', 'megamenu' ), |
|
| 1907 | + 'type' => 'transform', |
|
| 1908 | + 'key' => 'panel_third_level_text_transform', |
|
| 1909 | + ), |
|
| 1910 | + array( |
|
| 1911 | + 'title' => __( 'Weight', 'megamenu' ), |
|
| 1912 | + 'type' => 'weight', |
|
| 1913 | + 'key' => 'panel_third_level_font_weight', |
|
| 1914 | + ), |
|
| 1915 | + array( |
|
| 1916 | + 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1917 | + 'type' => 'decoration', |
|
| 1918 | + 'key' => 'panel_third_level_text_decoration', |
|
| 1919 | + ), |
|
| 1920 | + array( |
|
| 1921 | + 'title' => __( 'Align', 'megamenu' ), |
|
| 1922 | + 'type' => 'align', |
|
| 1923 | + 'key' => 'panel_third_level_text_align', |
|
| 1924 | + ), |
|
| 1925 | + ), |
|
| 1926 | + ), |
|
| 1927 | + 'third_level_font_hover' => array( |
|
| 1928 | + 'priority' => 210, |
|
| 1929 | + 'title' => __( 'Item Font (Hover)', 'megamenu' ), |
|
| 1930 | + 'description' => __( 'Set the font style on hover.', 'megamenu' ), |
|
| 1931 | + 'settings' => array( |
|
| 1932 | + array( |
|
| 1933 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 1934 | + 'type' => 'color', |
|
| 1935 | + 'key' => 'panel_third_level_font_color_hover', |
|
| 1936 | + ), |
|
| 1937 | + array( |
|
| 1938 | + 'title' => __( 'Weight', 'megamenu' ), |
|
| 1939 | + 'type' => 'weight', |
|
| 1940 | + 'key' => 'panel_third_level_font_weight_hover', |
|
| 1941 | + ), |
|
| 1942 | + array( |
|
| 1943 | + 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1944 | + 'type' => 'decoration', |
|
| 1945 | + 'key' => 'panel_third_level_text_decoration_hover', |
|
| 1946 | + ), |
|
| 1947 | + ), |
|
| 1948 | + ), |
|
| 1949 | + 'third_level_background_hover' => array( |
|
| 1950 | + 'priority' => 220, |
|
| 1951 | + 'title' => __( 'Item Background (Hover)', 'megamenu' ), |
|
| 1952 | + 'description' => __( 'Set the background hover color for third level menu items.', 'megamenu' ), |
|
| 1953 | + 'settings' => array( |
|
| 1954 | + array( |
|
| 1955 | + 'title' => __( 'From', 'megamenu' ), |
|
| 1956 | + 'type' => 'color', |
|
| 1957 | + 'key' => 'panel_third_level_background_hover_from', |
|
| 1958 | + ), |
|
| 1959 | + array( |
|
| 1960 | + 'title' => __( 'Copy', 'megamenu' ), |
|
| 1961 | + 'type' => 'copy_color', |
|
| 1962 | + 'key' => 'copy_color', |
|
| 1963 | + ), |
|
| 1964 | + array( |
|
| 1965 | + 'title' => __( 'To', 'megamenu' ), |
|
| 1966 | + 'type' => 'color', |
|
| 1967 | + 'key' => 'panel_third_level_background_hover_to', |
|
| 1968 | + ), |
|
| 1969 | + ), |
|
| 1970 | + ), |
|
| 1971 | + 'third_level_padding' => array( |
|
| 1972 | + 'priority' => 230, |
|
| 1973 | + 'title' => __( 'Item Padding', 'megamenu' ), |
|
| 1974 | + 'description' => __( 'Set the padding for the third level menu items.', 'megamenu' ), |
|
| 1975 | + 'settings' => array( |
|
| 1976 | + array( |
|
| 1977 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 1978 | + 'type' => 'freetext', |
|
| 1979 | + 'key' => 'panel_third_level_padding_top', |
|
| 1980 | + 'validation' => 'px', |
|
| 1981 | + ), |
|
| 1982 | + array( |
|
| 1983 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 1984 | + 'type' => 'freetext', |
|
| 1985 | + 'key' => 'panel_third_level_padding_right', |
|
| 1986 | + 'validation' => 'px', |
|
| 1987 | + ), |
|
| 1988 | + array( |
|
| 1989 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1990 | + 'type' => 'freetext', |
|
| 1991 | + 'key' => 'panel_third_level_padding_bottom', |
|
| 1992 | + 'validation' => 'px', |
|
| 1993 | + ), |
|
| 1994 | + array( |
|
| 1995 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 1996 | + 'type' => 'freetext', |
|
| 1997 | + 'key' => 'panel_third_level_padding_left', |
|
| 1998 | + 'validation' => 'px', |
|
| 1999 | + ), |
|
| 2000 | + ), |
|
| 2001 | + ), |
|
| 2002 | + |
|
| 2003 | + 'third_level_margin' => array( |
|
| 2004 | + 'priority' => 235, |
|
| 2005 | + 'title' => __( 'Item Margin', 'megamenu' ), |
|
| 2006 | + 'description' => __( 'Set the margin for the third level menu items.', 'megamenu' ), |
|
| 2007 | + 'settings' => array( |
|
| 2008 | + array( |
|
| 2009 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 2010 | + 'type' => 'freetext', |
|
| 2011 | + 'key' => 'panel_third_level_margin_top', |
|
| 2012 | + 'validation' => 'px', |
|
| 2013 | + ), |
|
| 2014 | + array( |
|
| 2015 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 2016 | + 'type' => 'freetext', |
|
| 2017 | + 'key' => 'panel_third_level_margin_right', |
|
| 2018 | + 'validation' => 'px', |
|
| 2019 | + ), |
|
| 2020 | + array( |
|
| 2021 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2022 | + 'type' => 'freetext', |
|
| 2023 | + 'key' => 'panel_third_level_margin_bottom', |
|
| 2024 | + 'validation' => 'px', |
|
| 2025 | + ), |
|
| 2026 | + array( |
|
| 2027 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 2028 | + 'type' => 'freetext', |
|
| 2029 | + 'key' => 'panel_third_level_margin_left', |
|
| 2030 | + 'validation' => 'px', |
|
| 2031 | + ), |
|
| 2032 | + ), |
|
| 2033 | + ), |
|
| 2034 | + 'third_level_border' => array( |
|
| 2035 | + 'priority' => 237, |
|
| 2036 | + 'title' => __( 'Item Border', 'megamenu' ), |
|
| 2037 | + 'description' => __( 'Set the border for the third level menu items.', 'megamenu' ), |
|
| 2038 | + 'settings' => array( |
|
| 2039 | + array( |
|
| 2040 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 2041 | + 'type' => 'color', |
|
| 2042 | + 'key' => 'panel_third_level_border_color', |
|
| 2043 | + ), |
|
| 2044 | + array( |
|
| 2045 | + 'title' => __( 'Color (Hover)', 'megamenu' ), |
|
| 2046 | + 'type' => 'color', |
|
| 2047 | + 'key' => 'panel_third_level_border_color_hover', |
|
| 2048 | + ), |
|
| 2049 | + array( |
|
| 2050 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 2051 | + 'type' => 'freetext', |
|
| 2052 | + 'key' => 'panel_third_level_border_top', |
|
| 2053 | + 'validation' => 'px', |
|
| 2054 | + ), |
|
| 2055 | + array( |
|
| 2056 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 2057 | + 'type' => 'freetext', |
|
| 2058 | + 'key' => 'panel_third_level_border_right', |
|
| 2059 | + 'validation' => 'px', |
|
| 2060 | + ), |
|
| 2061 | + array( |
|
| 2062 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2063 | + 'type' => 'freetext', |
|
| 2064 | + 'key' => 'panel_third_level_border_bottom', |
|
| 2065 | + 'validation' => 'px', |
|
| 2066 | + ), |
|
| 2067 | + array( |
|
| 2068 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 2069 | + 'type' => 'freetext', |
|
| 2070 | + 'key' => 'panel_third_level_border_left', |
|
| 2071 | + 'validation' => 'px', |
|
| 2072 | + ), |
|
| 2073 | + ), |
|
| 2074 | + ), |
|
| 2075 | + ), |
|
| 2076 | + ), |
|
| 2077 | + 'flyout_menus' => array( |
|
| 2078 | + 'title' => __( 'Flyout Menus', 'megamenu' ), |
|
| 2079 | + 'settings' => array( |
|
| 2080 | + 'flyout_menu_background' => array( |
|
| 2081 | + 'priority' => 10, |
|
| 2082 | + 'title' => __( 'Sub Menu Background', 'megamenu' ), |
|
| 2083 | + 'description' => __( 'Set the background color for the flyout menu.', 'megamenu' ), |
|
| 2084 | + 'settings' => array( |
|
| 2085 | + array( |
|
| 2086 | + 'title' => __( 'From', 'megamenu' ), |
|
| 2087 | + 'type' => 'color', |
|
| 2088 | + 'key' => 'flyout_menu_background_from', |
|
| 2089 | + ), |
|
| 2090 | + array( |
|
| 2091 | + 'title' => __( 'Copy', 'megamenu' ), |
|
| 2092 | + 'type' => 'copy_color', |
|
| 2093 | + 'key' => 'copy_color', |
|
| 2094 | + ), |
|
| 2095 | + array( |
|
| 2096 | + 'title' => __( 'To', 'megamenu' ), |
|
| 2097 | + 'type' => 'color', |
|
| 2098 | + 'key' => 'flyout_menu_background_to', |
|
| 2099 | + ), |
|
| 2100 | + ), |
|
| 2101 | + ), |
|
| 2102 | + 'flyout_menu_width' => array( |
|
| 2103 | + 'priority' => 20, |
|
| 2104 | + 'title' => __( 'Sub Menu Width', 'megamenu' ), |
|
| 2105 | + 'description' => __( 'The width of each flyout menu. This must be a fixed pixel value.', 'megamenu' ), |
|
| 2106 | + 'info' => array( |
|
| 2107 | + __( 'Set this value to the width of your longest menu item title to stop menu items wrapping onto 2 lines.', 'megamenu' ), |
|
| 2108 | + __( "Experimental: Set this value to 'auto' to use a flexible width.", 'megamenu' ), |
|
| 2109 | + ), |
|
| 2110 | + 'settings' => array( |
|
| 2111 | + array( |
|
| 2112 | + 'title' => '', |
|
| 2113 | + 'type' => 'freetext', |
|
| 2114 | + 'key' => 'flyout_width', |
|
| 2115 | + 'validation' => 'px', |
|
| 2116 | + ), |
|
| 2117 | + ), |
|
| 2118 | + ), |
|
| 2119 | + 'flyout_menu_padding' => array( |
|
| 2120 | + 'priority' => 30, |
|
| 2121 | + 'title' => __( 'Sub Menu Padding', 'megamenu' ), |
|
| 2122 | + 'description' => __( 'Set the padding for the whole flyout menu.', 'megamenu' ), |
|
| 2123 | + 'info' => array( __( "Only suitable for single level flyout menus. If you're using multi level flyout menus set these values to 0px.", 'megamenu' ) ), |
|
| 2124 | + 'settings' => array( |
|
| 2125 | + array( |
|
| 2126 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 2127 | + 'type' => 'freetext', |
|
| 2128 | + 'key' => 'flyout_padding_top', |
|
| 2129 | + 'validation' => 'px', |
|
| 2130 | + ), |
|
| 2131 | + array( |
|
| 2132 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 2133 | + 'type' => 'freetext', |
|
| 2134 | + 'key' => 'flyout_padding_right', |
|
| 2135 | + 'validation' => 'px', |
|
| 2136 | + ), |
|
| 2137 | + array( |
|
| 2138 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2139 | + 'type' => 'freetext', |
|
| 2140 | + 'key' => 'flyout_padding_bottom', |
|
| 2141 | + 'validation' => 'px', |
|
| 2142 | + ), |
|
| 2143 | + array( |
|
| 2144 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 2145 | + 'type' => 'freetext', |
|
| 2146 | + 'key' => 'flyout_padding_left', |
|
| 2147 | + 'validation' => 'px', |
|
| 2148 | + ), |
|
| 2149 | + ), |
|
| 2150 | + ), |
|
| 2151 | + 'flyout_menu_border' => array( |
|
| 2152 | + 'priority' => 40, |
|
| 2153 | + 'title' => __( 'Sub Menu Border', 'megamenu' ), |
|
| 2154 | + 'description' => __( 'Set the border for the flyout menu.', 'megamenu' ), |
|
| 2155 | + 'settings' => array( |
|
| 2156 | + array( |
|
| 2157 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 2158 | + 'type' => 'color', |
|
| 2159 | + 'key' => 'flyout_border_color', |
|
| 2160 | + ), |
|
| 2161 | + array( |
|
| 2162 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 2163 | + 'type' => 'freetext', |
|
| 2164 | + 'key' => 'flyout_border_top', |
|
| 2165 | + 'validation' => 'px', |
|
| 2166 | + ), |
|
| 2167 | + array( |
|
| 2168 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 2169 | + 'type' => 'freetext', |
|
| 2170 | + 'key' => 'flyout_border_right', |
|
| 2171 | + 'validation' => 'px', |
|
| 2172 | + ), |
|
| 2173 | + array( |
|
| 2174 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2175 | + 'type' => 'freetext', |
|
| 2176 | + 'key' => 'flyout_border_bottom', |
|
| 2177 | + 'validation' => 'px', |
|
| 2178 | + ), |
|
| 2179 | + array( |
|
| 2180 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 2181 | + 'type' => 'freetext', |
|
| 2182 | + 'key' => 'flyout_border_left', |
|
| 2183 | + 'validation' => 'px', |
|
| 2184 | + ), |
|
| 2185 | + ), |
|
| 2186 | + ), |
|
| 2187 | + 'flyout_menu_border_radius' => array( |
|
| 2188 | + 'priority' => 50, |
|
| 2189 | + 'title' => __( 'Sub Menu Border Radius', 'megamenu' ), |
|
| 2190 | + 'description' => __( 'Set rounded corners for flyout menus. Rounded corners will be applied to all flyout menu levels.', 'megamenu' ), |
|
| 2191 | + 'settings' => array( |
|
| 2192 | + array( |
|
| 2193 | + 'title' => __( 'Top Left', 'megamenu' ), |
|
| 2194 | + 'type' => 'freetext', |
|
| 2195 | + 'key' => 'flyout_border_radius_top_left', |
|
| 2196 | + 'validation' => 'px', |
|
| 2197 | + ), |
|
| 2198 | + array( |
|
| 2199 | + 'title' => __( 'Top Right', 'megamenu' ), |
|
| 2200 | + 'type' => 'freetext', |
|
| 2201 | + 'key' => 'flyout_border_radius_top_right', |
|
| 2202 | + 'validation' => 'px', |
|
| 2203 | + ), |
|
| 2204 | + array( |
|
| 2205 | + 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 2206 | + 'type' => 'freetext', |
|
| 2207 | + 'key' => 'flyout_border_radius_bottom_right', |
|
| 2208 | + 'validation' => 'px', |
|
| 2209 | + ), |
|
| 2210 | + array( |
|
| 2211 | + 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 2212 | + 'type' => 'freetext', |
|
| 2213 | + 'key' => 'flyout_border_radius_bottom_left', |
|
| 2214 | + 'validation' => 'px', |
|
| 2215 | + ), |
|
| 2216 | + ), |
|
| 2217 | + ), |
|
| 2218 | + 'flyout_menu_item_background' => array( |
|
| 2219 | + 'priority' => 60, |
|
| 2220 | + 'title' => __( 'Menu Item Background', 'megamenu' ), |
|
| 2221 | + 'description' => __( 'Set the background color for a flyout menu item.', 'megamenu' ), |
|
| 2222 | + 'settings' => array( |
|
| 2223 | + array( |
|
| 2224 | + 'title' => __( 'From', 'megamenu' ), |
|
| 2225 | + 'type' => 'color', |
|
| 2226 | + 'key' => 'flyout_background_from', |
|
| 2227 | + ), |
|
| 2228 | + array( |
|
| 2229 | + 'title' => __( 'Copy', 'megamenu' ), |
|
| 2230 | + 'type' => 'copy_color', |
|
| 2231 | + 'key' => 'copy_color', |
|
| 2232 | + ), |
|
| 2233 | + array( |
|
| 2234 | + 'title' => __( 'To', 'megamenu' ), |
|
| 2235 | + 'type' => 'color', |
|
| 2236 | + 'key' => 'flyout_background_to', |
|
| 2237 | + ), |
|
| 2238 | + ), |
|
| 2239 | + ), |
|
| 2240 | + 'flyout_menu_item_background_hover' => array( |
|
| 2241 | + 'priority' => 70, |
|
| 2242 | + 'title' => __( 'Menu Item Background (Hover)', 'megamenu' ), |
|
| 2243 | + 'description' => __( 'Set the background color for a flyout menu item (on hover).', 'megamenu' ), |
|
| 2244 | + 'settings' => array( |
|
| 2245 | + array( |
|
| 2246 | + 'title' => __( 'From', 'megamenu' ), |
|
| 2247 | + 'type' => 'color', |
|
| 2248 | + 'key' => 'flyout_background_hover_from', |
|
| 2249 | + ), |
|
| 2250 | + array( |
|
| 2251 | + 'title' => __( 'Copy', 'megamenu' ), |
|
| 2252 | + 'type' => 'copy_color', |
|
| 2253 | + 'key' => 'copy_color', |
|
| 2254 | + ), |
|
| 2255 | + array( |
|
| 2256 | + 'title' => __( 'To', 'megamenu' ), |
|
| 2257 | + 'type' => 'color', |
|
| 2258 | + 'key' => 'flyout_background_hover_to', |
|
| 2259 | + ), |
|
| 2260 | + ), |
|
| 2261 | + ), |
|
| 2262 | + 'flyout_menu_item_height' => array( |
|
| 2263 | + 'priority' => 80, |
|
| 2264 | + 'title' => __( 'Menu Item Height', 'megamenu' ), |
|
| 2265 | + 'description' => __( 'The height of each flyout menu item.', 'megamenu' ), |
|
| 2266 | + 'settings' => array( |
|
| 2267 | + array( |
|
| 2268 | + 'title' => '', |
|
| 2269 | + 'type' => 'freetext', |
|
| 2270 | + 'key' => 'flyout_link_height', |
|
| 2271 | + 'validation' => 'px', |
|
| 2272 | + ), |
|
| 2273 | + ), |
|
| 2274 | + ), |
|
| 2275 | + 'flyout_menu_item_padding' => array( |
|
| 2276 | + 'priority' => 90, |
|
| 2277 | + 'title' => __( 'Menu Item Padding', 'megamenu' ), |
|
| 2278 | + 'description' => __( 'Set the padding for each flyout menu item.', 'megamenu' ), |
|
| 2279 | + 'settings' => array( |
|
| 2280 | + array( |
|
| 2281 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 2282 | + 'type' => 'freetext', |
|
| 2283 | + 'key' => 'flyout_link_padding_top', |
|
| 2284 | + 'validation' => 'px', |
|
| 2285 | + ), |
|
| 2286 | + array( |
|
| 2287 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 2288 | + 'type' => 'freetext', |
|
| 2289 | + 'key' => 'flyout_link_padding_right', |
|
| 2290 | + 'validation' => 'px', |
|
| 2291 | + ), |
|
| 2292 | + array( |
|
| 2293 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2294 | + 'type' => 'freetext', |
|
| 2295 | + 'key' => 'flyout_link_padding_bottom', |
|
| 2296 | + 'validation' => 'px', |
|
| 2297 | + ), |
|
| 2298 | + array( |
|
| 2299 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 2300 | + 'type' => 'freetext', |
|
| 2301 | + 'key' => 'flyout_link_padding_left', |
|
| 2302 | + 'validation' => 'px', |
|
| 2303 | + ), |
|
| 2304 | + ), |
|
| 2305 | + ), |
|
| 2306 | + 'flyout_menu_item_font' => array( |
|
| 2307 | + 'priority' => 100, |
|
| 2308 | + 'title' => __( 'Menu Item Font', 'megamenu' ), |
|
| 2309 | + 'description' => __( 'Set the font for the flyout menu items.', 'megamenu' ), |
|
| 2310 | + 'settings' => array( |
|
| 2311 | + array( |
|
| 2312 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 2313 | + 'type' => 'color', |
|
| 2314 | + 'key' => 'flyout_link_color', |
|
| 2315 | + ), |
|
| 2316 | + array( |
|
| 2317 | + 'title' => __( 'Size', 'megamenu' ), |
|
| 2318 | + 'type' => 'freetext', |
|
| 2319 | + 'key' => 'flyout_link_size', |
|
| 2320 | + 'validation' => 'px', |
|
| 2321 | + ), |
|
| 2322 | + array( |
|
| 2323 | + 'title' => __( 'Family', 'megamenu' ), |
|
| 2324 | + 'type' => 'font', |
|
| 2325 | + 'key' => 'flyout_link_family', |
|
| 2326 | + ), |
|
| 2327 | + array( |
|
| 2328 | + 'title' => __( 'Transform', 'megamenu' ), |
|
| 2329 | + 'type' => 'transform', |
|
| 2330 | + 'key' => 'flyout_link_text_transform', |
|
| 2331 | + ), |
|
| 2332 | + array( |
|
| 2333 | + 'title' => __( 'Weight', 'megamenu' ), |
|
| 2334 | + 'type' => 'weight', |
|
| 2335 | + 'key' => 'flyout_link_weight', |
|
| 2336 | + ), |
|
| 2337 | + array( |
|
| 2338 | + 'title' => __( 'Decoration', 'megamenu' ), |
|
| 2339 | + 'type' => 'decoration', |
|
| 2340 | + 'key' => 'flyout_link_text_decoration', |
|
| 2341 | + ), |
|
| 2342 | + ), |
|
| 2343 | + ), |
|
| 2344 | + 'flyout_menu_item_font_hover' => array( |
|
| 2345 | + 'priority' => 110, |
|
| 2346 | + 'title' => __( 'Menu Item Font (Hover)', 'megamenu' ), |
|
| 2347 | + 'description' => __( 'Set the font for the flyout menu items.', 'megamenu' ), |
|
| 2348 | + 'settings' => array( |
|
| 2349 | + array( |
|
| 2350 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 2351 | + 'type' => 'color', |
|
| 2352 | + 'key' => 'flyout_link_color_hover', |
|
| 2353 | + ), |
|
| 2354 | + array( |
|
| 2355 | + 'title' => __( 'Weight', 'megamenu' ), |
|
| 2356 | + 'type' => 'weight', |
|
| 2357 | + 'key' => 'flyout_link_weight_hover', |
|
| 2358 | + ), |
|
| 2359 | + array( |
|
| 2360 | + 'title' => __( 'Decoration', 'megamenu' ), |
|
| 2361 | + 'type' => 'decoration', |
|
| 2362 | + 'key' => 'flyout_link_text_decoration_hover', |
|
| 2363 | + ), |
|
| 2364 | + ), |
|
| 2365 | + ), |
|
| 2366 | + 'flyout_menu_item_divider' => array( |
|
| 2367 | + 'priority' => 120, |
|
| 2368 | + 'title' => __( 'Menu Item Divider', 'megamenu' ), |
|
| 2369 | + 'description' => __( 'Show a line divider below each menu item.', 'megamenu' ), |
|
| 2370 | + 'settings' => array( |
|
| 2371 | + array( |
|
| 2372 | + 'title' => __( 'Enabled', 'megamenu' ), |
|
| 2373 | + 'type' => 'checkbox', |
|
| 2374 | + 'key' => 'flyout_menu_item_divider', |
|
| 2375 | + ), |
|
| 2376 | + array( |
|
| 2377 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 2378 | + 'type' => 'color', |
|
| 2379 | + 'key' => 'flyout_menu_item_divider_color', |
|
| 2380 | + ), |
|
| 2381 | + ), |
|
| 2382 | + ), |
|
| 2383 | + ), |
|
| 2384 | + ), |
|
| 2385 | + 'mobile_menu' => array( |
|
| 2386 | + 'title' => __( 'Mobile Menu', 'megamenu' ), |
|
| 2387 | + 'settings' => array( |
|
| 2388 | + 'responsive_breakpoint' => array( |
|
| 2389 | + 'priority' => 2, |
|
| 2390 | + 'title' => __( 'Responsive Breakpoint', 'megamenu' ), |
|
| 2391 | + 'description' => __( 'The menu will be converted to a mobile menu when the browser width is below this value.', 'megamenu' ), |
|
| 2392 | + 'settings' => array( |
|
| 2393 | + array( |
|
| 2394 | + 'title' => '', |
|
| 2395 | + 'type' => 'freetext', |
|
| 2396 | + 'key' => 'responsive_breakpoint', |
|
| 2397 | + 'validation' => 'px', |
|
| 2398 | + ), |
|
| 2399 | + ), |
|
| 2400 | + ), |
|
| 2401 | + 'responsive_breakpoint_disabled' => array( |
|
| 2402 | + 'priority' => 3, |
|
| 2403 | + 'title' => __( "The 'Responsive Breakpoint' option has been set to 0px. The desktop version of the menu will be displayed for all browsers (regardless of the browser width), so the following options are disabled.", 'megamenu' ), |
|
| 2404 | + 'description' => '', |
|
| 2405 | + ), |
|
| 2406 | + 'mobile_toggle_bar' => array( |
|
| 2407 | + 'priority' => 4, |
|
| 2408 | + 'title' => __( 'Mobile Toggle Bar', 'megamenu' ), |
|
| 2409 | + 'description' => '', |
|
| 2410 | + ), |
|
| 2411 | + 'mobile_toggle_disabled' => array( |
|
| 2412 | + 'priority' => 5, |
|
| 2413 | + 'title' => __( "The 'Disable Mobile Toggle Bar' option has been enabled. The following options are disabled as the mobile toggle bar will not be displayed.", 'megamenu' ), |
|
| 2414 | + 'description' => '', |
|
| 2415 | + ), |
|
| 2416 | + 'toggle_bar_background' => array( |
|
| 2417 | + 'priority' => 20, |
|
| 2418 | + 'title' => __( 'Toggle Bar Background', 'megamenu' ), |
|
| 2419 | + 'description' => __( 'Set the background color for the mobile menu toggle bar.', 'megamenu' ), |
|
| 2420 | + 'info' => array( |
|
| 2421 | + __( "Don't forget to update the Menu toggle block text and icon color in the Toggle Bar Designer above!", 'megamenu' ), |
|
| 2422 | + ), |
|
| 2423 | + 'settings' => array( |
|
| 2424 | + array( |
|
| 2425 | + 'title' => __( 'From', 'megamenu' ), |
|
| 2426 | + 'type' => 'color', |
|
| 2427 | + 'key' => 'toggle_background_from', |
|
| 2428 | + ), |
|
| 2429 | + array( |
|
| 2430 | + 'title' => __( 'Copy', 'megamenu' ), |
|
| 2431 | + 'type' => 'copy_color', |
|
| 2432 | + 'key' => 'copy_color', |
|
| 2433 | + ), |
|
| 2434 | + array( |
|
| 2435 | + 'title' => __( 'To', 'megamenu' ), |
|
| 2436 | + 'type' => 'color', |
|
| 2437 | + 'key' => 'toggle_background_to', |
|
| 2438 | + ), |
|
| 2439 | + ), |
|
| 2440 | + ), |
|
| 2441 | + 'toggle_bar_height' => array( |
|
| 2442 | + 'priority' => 25, |
|
| 2443 | + 'title' => __( 'Toggle Bar Height', 'megamenu' ), |
|
| 2444 | + 'description' => __( 'Set the height of the mobile menu toggle bar.', 'megamenu' ), |
|
| 2445 | + 'settings' => array( |
|
| 2446 | + array( |
|
| 2447 | + 'title' => '', |
|
| 2448 | + 'type' => 'freetext', |
|
| 2449 | + 'key' => 'toggle_bar_height', |
|
| 2450 | + ), |
|
| 2451 | + ), |
|
| 2452 | + ), |
|
| 2453 | + 'toggle_bar_border_radius' => array( |
|
| 2454 | + 'priority' => 26, |
|
| 2455 | + 'title' => __( 'Toggle Bar Border Radius', 'megamenu' ), |
|
| 2456 | + 'description' => __( 'Set a border radius on the mobile toggle bar.', 'megamenu' ), |
|
| 2457 | + 'settings' => array( |
|
| 2458 | + array( |
|
| 2459 | + 'title' => __( 'Top Left', 'megamenu' ), |
|
| 2460 | + 'type' => 'freetext', |
|
| 2461 | + 'key' => 'toggle_bar_border_radius_top_left', |
|
| 2462 | + 'validation' => 'px', |
|
| 2463 | + ), |
|
| 2464 | + array( |
|
| 2465 | + 'title' => __( 'Top Right', 'megamenu' ), |
|
| 2466 | + 'type' => 'freetext', |
|
| 2467 | + 'key' => 'toggle_bar_border_radius_top_right', |
|
| 2468 | + 'validation' => 'px', |
|
| 2469 | + ), |
|
| 2470 | + array( |
|
| 2471 | + 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 2472 | + 'type' => 'freetext', |
|
| 2473 | + 'key' => 'toggle_bar_border_radius_bottom_right', |
|
| 2474 | + 'validation' => 'px', |
|
| 2475 | + ), |
|
| 2476 | + array( |
|
| 2477 | + 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 2478 | + 'type' => 'freetext', |
|
| 2479 | + 'key' => 'toggle_bar_border_radius_bottom_left', |
|
| 2480 | + 'validation' => 'px', |
|
| 2481 | + ), |
|
| 2482 | + ), |
|
| 2483 | + ), |
|
| 2484 | + 'disable_mobile_toggle' => array( |
|
| 2485 | + 'priority' => 28, |
|
| 2486 | + 'title' => __( 'Disable Mobile Toggle Bar', 'megamenu' ), |
|
| 2487 | + 'description' => __( "Hide the toggle bar and display the menu in it's open state by default.", 'megamenu' ), |
|
| 2488 | + 'settings' => array( |
|
| 2489 | + array( |
|
| 2490 | + 'title' => '', |
|
| 2491 | + 'type' => 'checkbox', |
|
| 2492 | + 'key' => 'disable_mobile_toggle', |
|
| 2493 | + ), |
|
| 2494 | + ), |
|
| 2495 | + ), |
|
| 2496 | + |
|
| 2497 | + 'mobile_top_level_menu_items' => array( |
|
| 2498 | + 'priority' => 33, |
|
| 2499 | + 'title' => __( 'Mobile Sub Menu', 'megamenu' ), |
|
| 2500 | + 'description' => '', |
|
| 2501 | + ), |
|
| 2502 | + 'mobile_menu_overlay' => array( |
|
| 2503 | + 'priority' => 34, |
|
| 2504 | + 'title' => __( 'Overlay Content', 'megamenu' ), |
|
| 2505 | + 'description' => __( 'If enabled, the mobile sub menu will overlay the page content (instead of pushing the page content down)', 'megamenu' ), |
|
| 2506 | + 'settings' => array( |
|
| 2507 | + array( |
|
| 2508 | + 'title' => '', |
|
| 2509 | + 'type' => 'checkbox', |
|
| 2510 | + 'key' => 'mobile_menu_overlay', |
|
| 2511 | + ), |
|
| 2512 | + ), |
|
| 2513 | + ), |
|
| 2514 | + 'mobile_menu_force_width' => array( |
|
| 2515 | + 'priority' => 35, |
|
| 2516 | + 'title' => __( 'Force Full Width', 'megamenu' ), |
|
| 2517 | + 'description' => __( "If enabled, the mobile sub menu will match the width and position on the given page element (rather than being limited to the width of the toggle bar). For a full width sub menu, leave the 'Selector' value set to 'body'.", 'megamenu' ), |
|
| 2518 | + 'settings' => array( |
|
| 2519 | + array( |
|
| 2520 | + 'title' => __( 'Enabled', 'megamenu' ), |
|
| 2521 | + 'type' => 'checkbox', |
|
| 2522 | + 'key' => 'mobile_menu_force_width', |
|
| 2523 | + ), |
|
| 2524 | + array( |
|
| 2525 | + 'title' => __( 'Selector', 'megamenu' ), |
|
| 2526 | + 'type' => 'freetext', |
|
| 2527 | + 'key' => 'mobile_menu_force_width_selector', |
|
| 2528 | + ), |
|
| 2529 | + ), |
|
| 2530 | + ), |
|
| 2531 | + 'mobile_menu_off_canvas_width' => array( |
|
| 2532 | + 'priority' => 36, |
|
| 2533 | + 'title' => __( 'Off Canvas Width', 'megamenu' ), |
|
| 2534 | + 'description' => __( "The width of the sub menu if the Mobile Effect is set to 'Slide Left' or 'Slide Right'. Must be specified in px.", 'megamenu' ), |
|
| 2535 | + 'settings' => array( |
|
| 2536 | + array( |
|
| 2537 | + 'title' => '', |
|
| 2538 | + 'type' => 'freetext', |
|
| 2539 | + 'key' => 'mobile_menu_off_canvas_width', |
|
| 2540 | + 'validation' => 'px', |
|
| 2541 | + ), |
|
| 2542 | + ), |
|
| 2543 | + ), |
|
| 2544 | + 'mobile_menu_item_height' => array( |
|
| 2545 | + 'priority' => 38, |
|
| 2546 | + 'title' => __( 'Menu Item Height', 'megamenu' ), |
|
| 2547 | + 'description' => __( 'Height of each top level item in the mobile menu.', 'megamenu' ), |
|
| 2548 | + 'settings' => array( |
|
| 2549 | + array( |
|
| 2550 | + 'title' => '', |
|
| 2551 | + 'type' => 'freetext', |
|
| 2552 | + 'key' => 'mobile_menu_item_height', |
|
| 2553 | + ), |
|
| 2554 | + ), |
|
| 2555 | + ), |
|
| 2556 | + 'mobile_menu_padding' => array( |
|
| 2557 | + 'priority' => 39, |
|
| 2558 | + 'title' => __( 'Menu Padding', 'megamenu' ), |
|
| 2559 | + 'description' => __( 'Padding for the mobile sub menu.', 'megamenu' ), |
|
| 2560 | + 'settings' => array( |
|
| 2561 | + array( |
|
| 2562 | + 'title' => __( 'Top', 'megamenu' ), |
|
| 2563 | + 'type' => 'freetext', |
|
| 2564 | + 'key' => 'mobile_menu_padding_top', |
|
| 2565 | + 'validation' => 'px', |
|
| 2566 | + ), |
|
| 2567 | + array( |
|
| 2568 | + 'title' => __( 'Right', 'megamenu' ), |
|
| 2569 | + 'type' => 'freetext', |
|
| 2570 | + 'key' => 'mobile_menu_padding_right', |
|
| 2571 | + 'validation' => 'px', |
|
| 2572 | + ), |
|
| 2573 | + array( |
|
| 2574 | + 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2575 | + 'type' => 'freetext', |
|
| 2576 | + 'key' => 'mobile_menu_padding_bottom', |
|
| 2577 | + 'validation' => 'px', |
|
| 2578 | + ), |
|
| 2579 | + array( |
|
| 2580 | + 'title' => __( 'Left', 'megamenu' ), |
|
| 2581 | + 'type' => 'freetext', |
|
| 2582 | + 'key' => 'mobile_menu_padding_left', |
|
| 2583 | + 'validation' => 'px', |
|
| 2584 | + ), |
|
| 2585 | + ), |
|
| 2586 | + ), |
|
| 2587 | + 'mobile_background' => array( |
|
| 2588 | + 'priority' => 40, |
|
| 2589 | + 'title' => __( 'Menu Background', 'megamenu' ), |
|
| 2590 | + 'description' => __( 'The background color for the mobile menu.', 'megamenu' ), |
|
| 2591 | + 'settings' => array( |
|
| 2592 | + array( |
|
| 2593 | + 'title' => __( 'From', 'megamenu' ), |
|
| 2594 | + 'type' => 'color', |
|
| 2595 | + 'key' => 'mobile_background_from', |
|
| 2596 | + ), |
|
| 2597 | + array( |
|
| 2598 | + 'title' => __( 'Copy', 'megamenu' ), |
|
| 2599 | + 'type' => 'copy_color', |
|
| 2600 | + 'key' => 'copy_color', |
|
| 2601 | + ), |
|
| 2602 | + array( |
|
| 2603 | + 'title' => __( 'To', 'megamenu' ), |
|
| 2604 | + 'type' => 'color', |
|
| 2605 | + 'key' => 'mobile_background_to', |
|
| 2606 | + ), |
|
| 2607 | + ), |
|
| 2608 | + ), |
|
| 2609 | + 'mobile_background_hover' => array( |
|
| 2610 | + 'priority' => 45, |
|
| 2611 | + 'title' => __( 'Menu Item Background (Active)', 'megamenu' ), |
|
| 2612 | + 'description' => __( 'The background color for each top level menu item in the mobile menu when the sub menu is open.', 'megamenu' ), |
|
| 2613 | + 'settings' => array( |
|
| 2614 | + array( |
|
| 2615 | + 'title' => __( 'From', 'megamenu' ), |
|
| 2616 | + 'type' => 'color', |
|
| 2617 | + 'key' => 'mobile_menu_item_background_hover_from', |
|
| 2618 | + ), |
|
| 2619 | + array( |
|
| 2620 | + 'title' => __( 'Copy', 'megamenu' ), |
|
| 2621 | + 'type' => 'copy_color', |
|
| 2622 | + 'key' => 'copy_color', |
|
| 2623 | + ), |
|
| 2624 | + array( |
|
| 2625 | + 'title' => __( 'To', 'megamenu' ), |
|
| 2626 | + 'type' => 'color', |
|
| 2627 | + 'key' => 'mobile_menu_item_background_hover_to', |
|
| 2628 | + ), |
|
| 2629 | + ), |
|
| 2630 | + ), |
|
| 2631 | + 'mobile_menu_item_font' => array( |
|
| 2632 | + 'priority' => 50, |
|
| 2633 | + 'title' => __( 'Font', 'megamenu' ), |
|
| 2634 | + 'description' => __( 'The font to use for each top level menu item in the mobile menu.', 'megamenu' ), |
|
| 2635 | + 'settings' => array( |
|
| 2636 | + array( |
|
| 2637 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 2638 | + 'type' => 'color', |
|
| 2639 | + 'key' => 'mobile_menu_item_link_color', |
|
| 2640 | + ), |
|
| 2641 | + array( |
|
| 2642 | + 'title' => __( 'Size', 'megamenu' ), |
|
| 2643 | + 'type' => 'freetext', |
|
| 2644 | + 'key' => 'mobile_menu_item_link_font_size', |
|
| 2645 | + 'validation' => 'px', |
|
| 2646 | + ), |
|
| 2647 | + array( |
|
| 2648 | + 'title' => __( 'Align', 'megamenu' ), |
|
| 2649 | + 'type' => 'align', |
|
| 2650 | + 'key' => 'mobile_menu_item_link_text_align', |
|
| 2651 | + ), |
|
| 2652 | + ), |
|
| 2653 | + ), |
|
| 2654 | + 'mobile_menu_item_font_hover' => array( |
|
| 2655 | + 'priority' => 55, |
|
| 2656 | + 'title' => __( 'Font (Active)', 'megamenu' ), |
|
| 2657 | + 'description' => __( 'The font color for each top level menu item in the mobile menu when the sub menu is open.', 'megamenu' ), |
|
| 2658 | + 'settings' => array( |
|
| 2659 | + array( |
|
| 2660 | + 'title' => __( 'Color', 'megamenu' ), |
|
| 2661 | + 'type' => 'color', |
|
| 2662 | + 'key' => 'mobile_menu_item_link_color_hover', |
|
| 2663 | + ), |
|
| 2664 | + ), |
|
| 2665 | + ), |
|
| 2666 | + 'mobile_mega_menus' => array( |
|
| 2667 | + 'priority' => 60, |
|
| 2668 | + 'title' => __( 'Mega Menus', 'megamenu' ), |
|
| 2669 | + 'description' => '', |
|
| 2670 | + ), |
|
| 2671 | + 'mobile_columns' => array( |
|
| 2672 | + 'priority' => 65, |
|
| 2673 | + 'title' => __( 'Mega Menu Columns', 'megamenu' ), |
|
| 2674 | + 'description' => __( 'Collapse mega menu content into this many columns on mobile.', 'megamenu' ), |
|
| 2675 | + 'settings' => array( |
|
| 2676 | + array( |
|
| 2677 | + 'title' => '', |
|
| 2678 | + 'type' => 'mobile_columns', |
|
| 2679 | + 'key' => 'mobile_columns', |
|
| 2680 | + ), |
|
| 2681 | + ), |
|
| 2682 | + ), |
|
| 2683 | + ), |
|
| 2684 | + ), |
|
| 2685 | + 'custom_styling' => array( |
|
| 2686 | + 'title' => __( 'Custom Styling', 'megamenu' ), |
|
| 2687 | + 'settings' => array( |
|
| 2688 | + 'custom_styling' => array( |
|
| 2689 | + 'priority' => 40, |
|
| 2690 | + 'title' => __( 'CSS Editor', 'megamenu' ), |
|
| 2691 | + 'description' => __( 'Define any custom CSS you wish to add to menus using this theme. You can use standard CSS or SCSS.', 'megamenu' ), |
|
| 2692 | + 'settings' => array( |
|
| 2693 | + array( |
|
| 2694 | + 'title' => '', |
|
| 2695 | + 'type' => 'textarea', |
|
| 2696 | + 'key' => 'custom_css', |
|
| 2697 | + ), |
|
| 2698 | + ), |
|
| 2699 | + ), |
|
| 2700 | + ), |
|
| 2701 | + ), |
|
| 2702 | + ) |
|
| 2703 | + ); |
|
| 2704 | + |
|
| 2705 | + echo "<h2 class='nav-tab-wrapper'>"; |
|
| 2706 | + |
|
| 2707 | + $is_first = true; |
|
| 2708 | + |
|
| 2709 | + foreach ( $settings as $section_id => $section ) { |
|
| 2710 | + |
|
| 2711 | + if ( $is_first ) { |
|
| 2712 | + $active = 'nav-tab-active '; |
|
| 2713 | + $is_first = false; |
|
| 2714 | + } else { |
|
| 2715 | + $active = ''; |
|
| 2716 | + } |
|
| 2717 | + |
|
| 2718 | + echo "<a class='mega-tab nav-tab {$active}' data-tab='mega-tab-content-{$section_id}'>" . $section['title'] . '</a>'; |
|
| 2719 | + |
|
| 2720 | + } |
|
| 2721 | + |
|
| 2722 | + echo '</h2>'; |
|
| 2723 | + |
|
| 2724 | + $is_first = true; |
|
| 2725 | + |
|
| 2726 | + foreach ( $settings as $section_id => $section ) { |
|
| 2727 | + |
|
| 2728 | + if ( $is_first ) { |
|
| 2729 | + $display = 'block'; |
|
| 2730 | + $is_first = false; |
|
| 2731 | + } else { |
|
| 2732 | + $display = 'none'; |
|
| 2733 | + } |
|
| 2734 | + |
|
| 2735 | + echo " <div class='mega-tab-content mega-tab-content-{$section_id}' style='display: {$display}'>"; |
|
| 2736 | + echo " <table class='{$section_id}'>"; |
|
| 2737 | + |
|
| 2738 | + // order the fields by priority |
|
| 2739 | + uasort( $section['settings'], array( $this, 'compare_elems' ) ); |
|
| 2740 | + |
|
| 2741 | + foreach ( $section['settings'] as $group_id => $group ) { |
|
| 2742 | + |
|
| 2743 | + echo "<tr class='mega-{$group_id}'>"; |
|
| 2744 | + |
|
| 2745 | + if ( isset( $group['settings'] ) ) { |
|
| 2746 | + |
|
| 2747 | + echo "<td class='mega-name'>" . $group['title'] . "<div class='mega-description'>" . $group['description'] . '</div></td>'; |
|
| 2748 | + echo "<td class='mega-value'>"; |
|
| 2749 | + |
|
| 2750 | + foreach ( $group['settings'] as $setting_id => $setting ) { |
|
| 2751 | + |
|
| 2752 | + if ( isset( $setting['validation'] ) ) { |
|
| 2753 | + echo "<label class='mega-{$setting['key']}' data-validation='{$setting['validation']}'>"; |
|
| 2754 | + } else { |
|
| 2755 | + echo "<label class='mega-{$setting['key']}'>"; |
|
| 2756 | + } |
|
| 2757 | + echo "<span class='mega-short-desc'>{$setting['title']}</span>"; |
|
| 2758 | + |
|
| 2759 | + switch ( $setting['type'] ) { |
|
| 2760 | + case 'freetext': |
|
| 2761 | + $this->print_theme_freetext_option( $setting['key'] ); |
|
| 2762 | + break; |
|
| 2763 | + case 'textarea': |
|
| 2764 | + $this->print_theme_textarea_option( $setting['key'] ); |
|
| 2765 | + break; |
|
| 2766 | + case 'align': |
|
| 2767 | + $this->print_theme_align_option( $setting['key'] ); |
|
| 2768 | + break; |
|
| 2769 | + case 'checkbox': |
|
| 2770 | + $this->print_theme_checkbox_option( $setting['key'] ); |
|
| 2771 | + break; |
|
| 2772 | + case 'arrow': |
|
| 2773 | + $this->print_theme_arrow_option( $setting['key'] ); |
|
| 2774 | + break; |
|
| 2775 | + case 'color': |
|
| 2776 | + $this->print_theme_color_option( $setting['key'] ); |
|
| 2777 | + break; |
|
| 2778 | + case 'weight': |
|
| 2779 | + $this->print_theme_weight_option( $setting['key'] ); |
|
| 2780 | + break; |
|
| 2781 | + case 'font': |
|
| 2782 | + $this->print_theme_font_option( $setting['key'] ); |
|
| 2783 | + break; |
|
| 2784 | + case 'transform': |
|
| 2785 | + $this->print_theme_transform_option( $setting['key'] ); |
|
| 2786 | + break; |
|
| 2787 | + case 'decoration': |
|
| 2788 | + $this->print_theme_text_decoration_option( $setting['key'] ); |
|
| 2789 | + break; |
|
| 2790 | + case 'mobile_columns': |
|
| 2791 | + $this->print_theme_mobile_columns_option( $setting['key'] ); |
|
| 2792 | + break; |
|
| 2793 | + case 'copy_color': |
|
| 2794 | + $this->print_theme_copy_color_option( $setting['key'] ); |
|
| 2795 | + break; |
|
| 2796 | + default: |
|
| 2797 | + do_action( "megamenu_print_theme_option_{$setting['type']}", $setting['key'], $this->id ); |
|
| 2798 | + break; |
|
| 2799 | + } |
|
| 2800 | + |
|
| 2801 | + echo '</label>'; |
|
| 2802 | + |
|
| 2803 | + } |
|
| 2804 | + |
|
| 2805 | + if ( isset( $group['info'] ) ) { |
|
| 2806 | + foreach ( $group['info'] as $paragraph ) { |
|
| 2807 | + echo "<div class='mega-info'>{$paragraph}</div>"; |
|
| 2808 | + } |
|
| 2809 | + } |
|
| 2810 | + |
|
| 2811 | + foreach ( $group['settings'] as $setting_id => $setting ) { |
|
| 2812 | + if ( isset( $setting['validation'] ) ) { |
|
| 2813 | + |
|
| 2814 | + echo "<div class='mega-validation-message mega-validation-message-mega-{$setting['key']}'>"; |
|
| 2815 | + |
|
| 2816 | + if ( $setting['validation'] == 'int' ) { |
|
| 2817 | + $message = __( 'Enter a whole number (e.g. 1, 5, 100, 999)' ); |
|
| 2818 | + } |
|
| 2819 | + |
|
| 2820 | + if ( $setting['validation'] == 'px' ) { |
|
| 2821 | + $message = __( 'Enter a value including a unit (e.g. 10px, 10rem, 10%)' ); |
|
| 2822 | + } |
|
| 2823 | + |
|
| 2824 | + if ( $setting['validation'] == 'float' ) { |
|
| 2825 | + $message = __( 'Enter a valid number (e.g. 0.1, 1, 10, 999)' ); |
|
| 2826 | + } |
|
| 2827 | + |
|
| 2828 | + if ( strlen( $setting['title'] ) ) { |
|
| 2829 | + echo $setting['title'] . ': ' . $message; |
|
| 2830 | + } else { |
|
| 2831 | + echo $message; |
|
| 2832 | + } |
|
| 2833 | + |
|
| 2834 | + echo '</div>'; |
|
| 2835 | + } |
|
| 2836 | + } |
|
| 2837 | + |
|
| 2838 | + echo '</td>'; |
|
| 2839 | + } else { |
|
| 2840 | + echo "<td colspan='2'><h5>{$group['title']}</h5></td>"; |
|
| 2841 | + } |
|
| 2842 | + |
|
| 2843 | + echo '</tr>'; |
|
| 2844 | + |
|
| 2845 | + } |
|
| 2846 | + |
|
| 2847 | + echo '</table>'; |
|
| 2848 | + echo '</div>'; |
|
| 2849 | + } |
|
| 2850 | + |
|
| 2851 | + ?> |
|
| 2852 | 2852 | |
| 2853 | 2853 | |
| 2854 | 2854 | <div class='megamenu_submit'> |
@@ -2865,20 +2865,20 @@ discard block |
||
| 2865 | 2865 | |
| 2866 | 2866 | <?php |
| 2867 | 2867 | |
| 2868 | - } |
|
| 2868 | + } |
|
| 2869 | 2869 | |
| 2870 | 2870 | |
| 2871 | - /** |
|
| 2872 | - * Check for installed caching/minification/CDN plugins and output a warning if one is found to be |
|
| 2873 | - * installed and activated |
|
| 2874 | - */ |
|
| 2875 | - public function show_cache_warning() { |
|
| 2871 | + /** |
|
| 2872 | + * Check for installed caching/minification/CDN plugins and output a warning if one is found to be |
|
| 2873 | + * installed and activated |
|
| 2874 | + */ |
|
| 2875 | + public function show_cache_warning() { |
|
| 2876 | 2876 | |
| 2877 | - $active_plugins = max_mega_menu_get_active_caching_plugins(); |
|
| 2877 | + $active_plugins = max_mega_menu_get_active_caching_plugins(); |
|
| 2878 | 2878 | |
| 2879 | - if ( count( $active_plugins ) ) : |
|
| 2879 | + if ( count( $active_plugins ) ) : |
|
| 2880 | 2880 | |
| 2881 | - ?> |
|
| 2881 | + ?> |
|
| 2882 | 2882 | |
| 2883 | 2883 | <div> |
| 2884 | 2884 | |
@@ -2888,10 +2888,10 @@ discard block |
||
| 2888 | 2888 | |
| 2889 | 2889 | <ul class='ul-disc'> |
| 2890 | 2890 | <?php |
| 2891 | - foreach ( $active_plugins as $name ) { |
|
| 2892 | - echo '<li>' . $name . '</li>'; |
|
| 2893 | - } |
|
| 2894 | - ?> |
|
| 2891 | + foreach ( $active_plugins as $name ) { |
|
| 2892 | + echo '<li>' . $name . '</li>'; |
|
| 2893 | + } |
|
| 2894 | + ?> |
|
| 2895 | 2895 | </ul> |
| 2896 | 2896 | |
| 2897 | 2897 | <p><?php echo _n( 'Try clearing the cache of the above plugin if your changes are not being applied to the menu.', 'Try clearing the caches of the above plugins if your changes are not being applied to the menu.', count( $active_plugins ), 'megamenu' ); ?></p> |
@@ -2900,43 +2900,43 @@ discard block |
||
| 2900 | 2900 | |
| 2901 | 2901 | <?php |
| 2902 | 2902 | |
| 2903 | - endif; |
|
| 2904 | - } |
|
| 2903 | + endif; |
|
| 2904 | + } |
|
| 2905 | 2905 | |
| 2906 | 2906 | |
| 2907 | - /** |
|
| 2908 | - * Compare array values |
|
| 2909 | - * |
|
| 2910 | - * @param array $elem1 |
|
| 2911 | - * @param array $elem2 |
|
| 2912 | - * @return bool |
|
| 2913 | - * @since 2.1 |
|
| 2914 | - */ |
|
| 2915 | - private function compare_elems( $elem1, $elem2 ) { |
|
| 2916 | - if ( $elem1['priority'] > $elem2['priority'] ) { |
|
| 2917 | - return 1; |
|
| 2918 | - } |
|
| 2907 | + /** |
|
| 2908 | + * Compare array values |
|
| 2909 | + * |
|
| 2910 | + * @param array $elem1 |
|
| 2911 | + * @param array $elem2 |
|
| 2912 | + * @return bool |
|
| 2913 | + * @since 2.1 |
|
| 2914 | + */ |
|
| 2915 | + private function compare_elems( $elem1, $elem2 ) { |
|
| 2916 | + if ( $elem1['priority'] > $elem2['priority'] ) { |
|
| 2917 | + return 1; |
|
| 2918 | + } |
|
| 2919 | 2919 | |
| 2920 | - if ( $elem1['priority'] == $elem2['priority'] ) { |
|
| 2921 | - return 0; |
|
| 2922 | - } |
|
| 2920 | + if ( $elem1['priority'] == $elem2['priority'] ) { |
|
| 2921 | + return 0; |
|
| 2922 | + } |
|
| 2923 | 2923 | |
| 2924 | - return -1; |
|
| 2925 | - } |
|
| 2924 | + return -1; |
|
| 2925 | + } |
|
| 2926 | 2926 | |
| 2927 | 2927 | |
| 2928 | - /** |
|
| 2929 | - * Print a select dropdown with left, center and right options |
|
| 2930 | - * |
|
| 2931 | - * @since 1.6.1 |
|
| 2932 | - * @param string $key |
|
| 2933 | - * @param string $value |
|
| 2934 | - */ |
|
| 2935 | - public function print_theme_align_option( $key ) { |
|
| 2928 | + /** |
|
| 2929 | + * Print a select dropdown with left, center and right options |
|
| 2930 | + * |
|
| 2931 | + * @since 1.6.1 |
|
| 2932 | + * @param string $key |
|
| 2933 | + * @param string $value |
|
| 2934 | + */ |
|
| 2935 | + public function print_theme_align_option( $key ) { |
|
| 2936 | 2936 | |
| 2937 | - $value = $this->active_theme[ $key ]; |
|
| 2937 | + $value = $this->active_theme[ $key ]; |
|
| 2938 | 2938 | |
| 2939 | - ?> |
|
| 2939 | + ?> |
|
| 2940 | 2940 | |
| 2941 | 2941 | <select name='settings[<?php echo $key; ?>]'> |
| 2942 | 2942 | <option value='left' <?php selected( $value, 'left' ); ?>><?php _e( 'Left', 'megamenu' ); ?></option> |
@@ -2945,38 +2945,38 @@ discard block |
||
| 2945 | 2945 | </select> |
| 2946 | 2946 | |
| 2947 | 2947 | <?php |
| 2948 | - } |
|
| 2948 | + } |
|
| 2949 | 2949 | |
| 2950 | 2950 | |
| 2951 | - /** |
|
| 2952 | - * Print a copy icon |
|
| 2953 | - * |
|
| 2954 | - * @since 2.2.3 |
|
| 2955 | - * @param string $key |
|
| 2956 | - * @param string $value |
|
| 2957 | - */ |
|
| 2958 | - public function print_theme_copy_color_option( $key ) { |
|
| 2951 | + /** |
|
| 2952 | + * Print a copy icon |
|
| 2953 | + * |
|
| 2954 | + * @since 2.2.3 |
|
| 2955 | + * @param string $key |
|
| 2956 | + * @param string $value |
|
| 2957 | + */ |
|
| 2958 | + public function print_theme_copy_color_option( $key ) { |
|
| 2959 | 2959 | |
| 2960 | - ?> |
|
| 2960 | + ?> |
|
| 2961 | 2961 | |
| 2962 | 2962 | <span class='dashicons dashicons-arrow-right-alt'></span> |
| 2963 | 2963 | |
| 2964 | 2964 | <?php |
| 2965 | - } |
|
| 2965 | + } |
|
| 2966 | 2966 | |
| 2967 | 2967 | |
| 2968 | - /** |
|
| 2969 | - * Print a select dropdown with 1 and 2 options |
|
| 2970 | - * |
|
| 2971 | - * @since 1.2.0 |
|
| 2972 | - * @param string $key |
|
| 2973 | - * @param string $value |
|
| 2974 | - */ |
|
| 2975 | - public function print_theme_mobile_columns_option( $key ) { |
|
| 2968 | + /** |
|
| 2969 | + * Print a select dropdown with 1 and 2 options |
|
| 2970 | + * |
|
| 2971 | + * @since 1.2.0 |
|
| 2972 | + * @param string $key |
|
| 2973 | + * @param string $value |
|
| 2974 | + */ |
|
| 2975 | + public function print_theme_mobile_columns_option( $key ) { |
|
| 2976 | 2976 | |
| 2977 | - $value = $this->active_theme[ $key ]; |
|
| 2977 | + $value = $this->active_theme[ $key ]; |
|
| 2978 | 2978 | |
| 2979 | - ?> |
|
| 2979 | + ?> |
|
| 2980 | 2980 | |
| 2981 | 2981 | <select name='settings[<?php echo $key; ?>]'> |
| 2982 | 2982 | <option value='1' <?php selected( $value, '1' ); ?>><?php _e( '1 Column', 'megamenu' ); ?></option> |
@@ -2984,21 +2984,21 @@ discard block |
||
| 2984 | 2984 | </select> |
| 2985 | 2985 | |
| 2986 | 2986 | <?php |
| 2987 | - } |
|
| 2987 | + } |
|
| 2988 | 2988 | |
| 2989 | 2989 | |
| 2990 | - /** |
|
| 2991 | - * Print a select dropdown with text decoration options |
|
| 2992 | - * |
|
| 2993 | - * @since 1.6.1 |
|
| 2994 | - * @param string $key |
|
| 2995 | - * @param string $value |
|
| 2996 | - */ |
|
| 2997 | - public function print_theme_text_decoration_option( $key ) { |
|
| 2990 | + /** |
|
| 2991 | + * Print a select dropdown with text decoration options |
|
| 2992 | + * |
|
| 2993 | + * @since 1.6.1 |
|
| 2994 | + * @param string $key |
|
| 2995 | + * @param string $value |
|
| 2996 | + */ |
|
| 2997 | + public function print_theme_text_decoration_option( $key ) { |
|
| 2998 | 2998 | |
| 2999 | - $value = $this->active_theme[ $key ]; |
|
| 2999 | + $value = $this->active_theme[ $key ]; |
|
| 3000 | 3000 | |
| 3001 | - ?> |
|
| 3001 | + ?> |
|
| 3002 | 3002 | |
| 3003 | 3003 | <select name='settings[<?php echo $key; ?>]'> |
| 3004 | 3004 | <option value='none' <?php selected( $value, 'none' ); ?>><?php _e( 'None', 'megamenu' ); ?></option> |
@@ -3006,168 +3006,168 @@ discard block |
||
| 3006 | 3006 | </select> |
| 3007 | 3007 | |
| 3008 | 3008 | <?php |
| 3009 | - } |
|
| 3009 | + } |
|
| 3010 | 3010 | |
| 3011 | 3011 | |
| 3012 | - /** |
|
| 3013 | - * Print a checkbox option |
|
| 3014 | - * |
|
| 3015 | - * @since 1.6.1 |
|
| 3016 | - * @param string $key |
|
| 3017 | - * @param string $value |
|
| 3018 | - */ |
|
| 3019 | - public function print_theme_checkbox_option( $key ) { |
|
| 3012 | + /** |
|
| 3013 | + * Print a checkbox option |
|
| 3014 | + * |
|
| 3015 | + * @since 1.6.1 |
|
| 3016 | + * @param string $key |
|
| 3017 | + * @param string $value |
|
| 3018 | + */ |
|
| 3019 | + public function print_theme_checkbox_option( $key ) { |
|
| 3020 | 3020 | |
| 3021 | - $value = $this->active_theme[ $key ]; |
|
| 3021 | + $value = $this->active_theme[ $key ]; |
|
| 3022 | 3022 | |
| 3023 | - ?> |
|
| 3023 | + ?> |
|
| 3024 | 3024 | |
| 3025 | 3025 | <input type='hidden' name='checkboxes[<?php echo $key; ?>]' /> |
| 3026 | 3026 | <input type='checkbox' name='settings[<?php echo $key; ?>]' <?php checked( $value, 'on' ); ?> /> |
| 3027 | 3027 | |
| 3028 | 3028 | <?php |
| 3029 | - } |
|
| 3029 | + } |
|
| 3030 | 3030 | |
| 3031 | 3031 | |
| 3032 | - /** |
|
| 3033 | - * Print an arrow dropdown selection box |
|
| 3034 | - * |
|
| 3035 | - * @since 1.0 |
|
| 3036 | - * @param string $key |
|
| 3037 | - * @param string $value |
|
| 3038 | - */ |
|
| 3039 | - public function print_theme_arrow_option( $key ) { |
|
| 3032 | + /** |
|
| 3033 | + * Print an arrow dropdown selection box |
|
| 3034 | + * |
|
| 3035 | + * @since 1.0 |
|
| 3036 | + * @param string $key |
|
| 3037 | + * @param string $value |
|
| 3038 | + */ |
|
| 3039 | + public function print_theme_arrow_option( $key ) { |
|
| 3040 | 3040 | |
| 3041 | - $value = $this->active_theme[ $key ]; |
|
| 3041 | + $value = $this->active_theme[ $key ]; |
|
| 3042 | 3042 | |
| 3043 | - $arrow_icons = $this->arrow_icons(); |
|
| 3043 | + $arrow_icons = $this->arrow_icons(); |
|
| 3044 | 3044 | |
| 3045 | - ?> |
|
| 3045 | + ?> |
|
| 3046 | 3046 | <select class='icon_dropdown' name='settings[<?php echo $key; ?>]'> |
| 3047 | 3047 | <?php |
| 3048 | 3048 | |
| 3049 | - echo "<option value='disabled'>" . __( 'Disabled', 'megamenu' ) . '</option>'; |
|
| 3049 | + echo "<option value='disabled'>" . __( 'Disabled', 'megamenu' ) . '</option>'; |
|
| 3050 | 3050 | |
| 3051 | - foreach ( $arrow_icons as $code => $class ) { |
|
| 3052 | - $name = str_replace( 'dashicons-', '', $class ); |
|
| 3053 | - $name = ucwords( str_replace( array( '-', 'arrow' ), ' ', $name ) ); |
|
| 3054 | - echo "<option data-class='{$class}' value='{$code}' " . selected( $value, $code, false ) . '>' . esc_html( $name ) . '</option>'; |
|
| 3055 | - } |
|
| 3051 | + foreach ( $arrow_icons as $code => $class ) { |
|
| 3052 | + $name = str_replace( 'dashicons-', '', $class ); |
|
| 3053 | + $name = ucwords( str_replace( array( '-', 'arrow' ), ' ', $name ) ); |
|
| 3054 | + echo "<option data-class='{$class}' value='{$code}' " . selected( $value, $code, false ) . '>' . esc_html( $name ) . '</option>'; |
|
| 3055 | + } |
|
| 3056 | 3056 | |
| 3057 | - ?> |
|
| 3057 | + ?> |
|
| 3058 | 3058 | </select> |
| 3059 | 3059 | |
| 3060 | 3060 | <?php |
| 3061 | - } |
|
| 3062 | - |
|
| 3063 | - |
|
| 3064 | - |
|
| 3065 | - /** |
|
| 3066 | - * Print a colorpicker |
|
| 3067 | - * |
|
| 3068 | - * @since 1.0 |
|
| 3069 | - * @param string $key |
|
| 3070 | - * @param string $value |
|
| 3071 | - */ |
|
| 3072 | - public function print_theme_color_option( $key ) { |
|
| 3061 | + } |
|
| 3062 | + |
|
| 3063 | + |
|
| 3064 | + |
|
| 3065 | + /** |
|
| 3066 | + * Print a colorpicker |
|
| 3067 | + * |
|
| 3068 | + * @since 1.0 |
|
| 3069 | + * @param string $key |
|
| 3070 | + * @param string $value |
|
| 3071 | + */ |
|
| 3072 | + public function print_theme_color_option( $key ) { |
|
| 3073 | 3073 | |
| 3074 | - $value = $this->active_theme[ $key ]; |
|
| 3074 | + $value = $this->active_theme[ $key ]; |
|
| 3075 | 3075 | |
| 3076 | - if ( $value == 'transparent' ) { |
|
| 3077 | - $value = 'rgba(0,0,0,0)'; |
|
| 3078 | - } |
|
| 3076 | + if ( $value == 'transparent' ) { |
|
| 3077 | + $value = 'rgba(0,0,0,0)'; |
|
| 3078 | + } |
|
| 3079 | 3079 | |
| 3080 | - if ( $value == 'rgba(0,0,0,0)' ) { |
|
| 3081 | - $value_text = 'transparent'; |
|
| 3082 | - } else { |
|
| 3083 | - $value_text = $value; |
|
| 3084 | - } |
|
| 3080 | + if ( $value == 'rgba(0,0,0,0)' ) { |
|
| 3081 | + $value_text = 'transparent'; |
|
| 3082 | + } else { |
|
| 3083 | + $value_text = $value; |
|
| 3084 | + } |
|
| 3085 | 3085 | |
| 3086 | - echo "<div class='mm-picker-container'>"; |
|
| 3087 | - echo " <input type='text' class='mm_colorpicker' name='settings[$key]' value='" . esc_attr( $value ) . "' />"; |
|
| 3088 | - echo " <div class='chosen-color'>" . esc_html( $value_text ) . '</div>'; |
|
| 3089 | - echo '</div>'; |
|
| 3086 | + echo "<div class='mm-picker-container'>"; |
|
| 3087 | + echo " <input type='text' class='mm_colorpicker' name='settings[$key]' value='" . esc_attr( $value ) . "' />"; |
|
| 3088 | + echo " <div class='chosen-color'>" . esc_html( $value_text ) . '</div>'; |
|
| 3089 | + echo '</div>'; |
|
| 3090 | 3090 | |
| 3091 | - } |
|
| 3091 | + } |
|
| 3092 | 3092 | |
| 3093 | 3093 | |
| 3094 | - /** |
|
| 3095 | - * Print a font weight selector |
|
| 3096 | - * |
|
| 3097 | - * @since 1.0 |
|
| 3098 | - * @param string $key |
|
| 3099 | - * @param string $value |
|
| 3100 | - */ |
|
| 3101 | - public function print_theme_weight_option( $key ) { |
|
| 3094 | + /** |
|
| 3095 | + * Print a font weight selector |
|
| 3096 | + * |
|
| 3097 | + * @since 1.0 |
|
| 3098 | + * @param string $key |
|
| 3099 | + * @param string $value |
|
| 3100 | + */ |
|
| 3101 | + public function print_theme_weight_option( $key ) { |
|
| 3102 | 3102 | |
| 3103 | - $value = $this->active_theme[ $key ]; |
|
| 3103 | + $value = $this->active_theme[ $key ]; |
|
| 3104 | 3104 | |
| 3105 | - $options = apply_filters( |
|
| 3106 | - 'megamenu_font_weights', |
|
| 3107 | - array( |
|
| 3108 | - 'inherit' => __( 'Theme Default', 'megamenu' ), |
|
| 3109 | - '300' => __( 'Light (300)', 'megamenu' ), |
|
| 3110 | - 'normal' => __( 'Normal (400)', 'megamenu' ), |
|
| 3111 | - 'bold' => __( 'Bold (700)', 'megamenu' ), |
|
| 3112 | - ) |
|
| 3113 | - ); |
|
| 3105 | + $options = apply_filters( |
|
| 3106 | + 'megamenu_font_weights', |
|
| 3107 | + array( |
|
| 3108 | + 'inherit' => __( 'Theme Default', 'megamenu' ), |
|
| 3109 | + '300' => __( 'Light (300)', 'megamenu' ), |
|
| 3110 | + 'normal' => __( 'Normal (400)', 'megamenu' ), |
|
| 3111 | + 'bold' => __( 'Bold (700)', 'megamenu' ), |
|
| 3112 | + ) |
|
| 3113 | + ); |
|
| 3114 | 3114 | |
| 3115 | - /** |
|
| 3116 | - * '100' => __("Thin (100)", "megamenu"), |
|
| 3117 | - * '200' => __("Extra Light (200)", "megamenu"), |
|
| 3118 | - * '300' => __("Light (300)", "megamenu"), |
|
| 3119 | - * 'normal' => __("Normal (400)", "megamenu"), |
|
| 3120 | - * '500' => __("Medium (500)", "megamenu"), |
|
| 3121 | - * '600' => __("Semi Bold (600)", "megamenu"), |
|
| 3122 | - * 'bold' => __("Bold (700)", "megamenu"), |
|
| 3123 | - * '800' => __("Extra Bold (800)", "megamenu"), |
|
| 3124 | - * '900' => __("Black (900)", "megamenu") |
|
| 3125 | - */ |
|
| 3115 | + /** |
|
| 3116 | + * '100' => __("Thin (100)", "megamenu"), |
|
| 3117 | + * '200' => __("Extra Light (200)", "megamenu"), |
|
| 3118 | + * '300' => __("Light (300)", "megamenu"), |
|
| 3119 | + * 'normal' => __("Normal (400)", "megamenu"), |
|
| 3120 | + * '500' => __("Medium (500)", "megamenu"), |
|
| 3121 | + * '600' => __("Semi Bold (600)", "megamenu"), |
|
| 3122 | + * 'bold' => __("Bold (700)", "megamenu"), |
|
| 3123 | + * '800' => __("Extra Bold (800)", "megamenu"), |
|
| 3124 | + * '900' => __("Black (900)", "megamenu") |
|
| 3125 | + */ |
|
| 3126 | 3126 | |
| 3127 | - echo "<select name='settings[$key]'>"; |
|
| 3127 | + echo "<select name='settings[$key]'>"; |
|
| 3128 | 3128 | |
| 3129 | - foreach ( $options as $weight => $name ) { |
|
| 3130 | - echo "<option value='" . esc_attr( $weight ) . "' " . selected( $value, $weight, false ) . '>' . esc_html( $name ) . '</option>'; |
|
| 3131 | - } |
|
| 3129 | + foreach ( $options as $weight => $name ) { |
|
| 3130 | + echo "<option value='" . esc_attr( $weight ) . "' " . selected( $value, $weight, false ) . '>' . esc_html( $name ) . '</option>'; |
|
| 3131 | + } |
|
| 3132 | 3132 | |
| 3133 | - echo '</select>'; |
|
| 3133 | + echo '</select>'; |
|
| 3134 | 3134 | |
| 3135 | - } |
|
| 3135 | + } |
|
| 3136 | 3136 | |
| 3137 | 3137 | |
| 3138 | - /** |
|
| 3139 | - * Print a font transform selector |
|
| 3140 | - * |
|
| 3141 | - * @since 1.0 |
|
| 3142 | - * @param string $key |
|
| 3143 | - * @param string $value |
|
| 3144 | - */ |
|
| 3145 | - public function print_theme_transform_option( $key ) { |
|
| 3138 | + /** |
|
| 3139 | + * Print a font transform selector |
|
| 3140 | + * |
|
| 3141 | + * @since 1.0 |
|
| 3142 | + * @param string $key |
|
| 3143 | + * @param string $value |
|
| 3144 | + */ |
|
| 3145 | + public function print_theme_transform_option( $key ) { |
|
| 3146 | 3146 | |
| 3147 | - $value = $this->active_theme[ $key ]; |
|
| 3147 | + $value = $this->active_theme[ $key ]; |
|
| 3148 | 3148 | |
| 3149 | - echo "<select name='settings[$key]'>"; |
|
| 3150 | - echo " <option value='none' " . selected( $value, 'none', false ) . '>' . __( 'Normal', 'megamenu' ) . '</option>'; |
|
| 3151 | - echo " <option value='capitalize'" . selected( $value, 'capitalize', false ) . '>' . __( 'Capitalize', 'megamenu' ) . '</option>'; |
|
| 3152 | - echo " <option value='uppercase'" . selected( $value, 'uppercase', false ) . '>' . __( 'UPPERCASE', 'megamenu' ) . '</option>'; |
|
| 3153 | - echo " <option value='lowercase'" . selected( $value, 'lowercase', false ) . '>' . __( 'lowercase', 'megamenu' ) . '</option>'; |
|
| 3154 | - echo '</select>'; |
|
| 3149 | + echo "<select name='settings[$key]'>"; |
|
| 3150 | + echo " <option value='none' " . selected( $value, 'none', false ) . '>' . __( 'Normal', 'megamenu' ) . '</option>'; |
|
| 3151 | + echo " <option value='capitalize'" . selected( $value, 'capitalize', false ) . '>' . __( 'Capitalize', 'megamenu' ) . '</option>'; |
|
| 3152 | + echo " <option value='uppercase'" . selected( $value, 'uppercase', false ) . '>' . __( 'UPPERCASE', 'megamenu' ) . '</option>'; |
|
| 3153 | + echo " <option value='lowercase'" . selected( $value, 'lowercase', false ) . '>' . __( 'lowercase', 'megamenu' ) . '</option>'; |
|
| 3154 | + echo '</select>'; |
|
| 3155 | 3155 | |
| 3156 | - } |
|
| 3156 | + } |
|
| 3157 | 3157 | |
| 3158 | 3158 | |
| 3159 | - /** |
|
| 3160 | - * Print a textarea |
|
| 3161 | - * |
|
| 3162 | - * @since 1.0 |
|
| 3163 | - * @param string $key |
|
| 3164 | - * @param string $value |
|
| 3165 | - */ |
|
| 3166 | - public function print_theme_textarea_option( $key ) { |
|
| 3167 | - |
|
| 3168 | - $value = sanitize_textarea_field( $this->active_theme[ $key ] ); |
|
| 3169 | - |
|
| 3170 | - ?> |
|
| 3159 | + /** |
|
| 3160 | + * Print a textarea |
|
| 3161 | + * |
|
| 3162 | + * @since 1.0 |
|
| 3163 | + * @param string $key |
|
| 3164 | + * @param string $value |
|
| 3165 | + */ |
|
| 3166 | + public function print_theme_textarea_option( $key ) { |
|
| 3167 | + |
|
| 3168 | + $value = sanitize_textarea_field( $this->active_theme[ $key ] ); |
|
| 3169 | + |
|
| 3170 | + ?> |
|
| 3171 | 3171 | |
| 3172 | 3172 | <textarea id='codemirror' name='settings[<?php echo $key; ?>]'><?php echo stripslashes( $value ); ?></textarea> |
| 3173 | 3173 | |
@@ -3179,10 +3179,10 @@ discard block |
||
| 3179 | 3179 | <li><code>#{$menu}</code> <?php _e( 'converts to the ID selector of the menu, e.g. ul#mega-menu-primary', 'megamenu' ); ?></li> |
| 3180 | 3180 | <li><code>@include mobile|desktop { .. }</code> <?php _e( 'wraps the CSS within a media query based on the configured Responsive Breakpoint (see example CSS)', 'megamenu' ); ?></li> |
| 3181 | 3181 | <?php |
| 3182 | - $string = __( 'Using the %wrap% and %menu% variables makes your theme portable (allowing you to apply the same theme to multiple menu locations)', 'megamenu' ); |
|
| 3183 | - $string = str_replace( '%wrap%', '<code>#{$wrap}</code>', $string ); |
|
| 3184 | - $string = str_replace( '%menu%', '<code>#{$menu}</code>', $string ); |
|
| 3185 | - ?> |
|
| 3182 | + $string = __( 'Using the %wrap% and %menu% variables makes your theme portable (allowing you to apply the same theme to multiple menu locations)', 'megamenu' ); |
|
| 3183 | + $string = str_replace( '%wrap%', '<code>#{$wrap}</code>', $string ); |
|
| 3184 | + $string = str_replace( '%menu%', '<code>#{$menu}</code>', $string ); |
|
| 3185 | + ?> |
|
| 3186 | 3186 | <li><?php echo $string; ?></li> |
| 3187 | 3187 | <li><?php _e( 'Example CSS', 'megamenu' ); ?>:</li> |
| 3188 | 3188 | <code>/** <?php _e( 'Add text shadow to top level menu items on desktop AND mobile', 'megamenu' ); ?> **/ |
@@ -3202,116 +3202,116 @@ discard block |
||
| 3202 | 3202 | |
| 3203 | 3203 | <?php |
| 3204 | 3204 | |
| 3205 | - } |
|
| 3206 | - |
|
| 3207 | - |
|
| 3208 | - /** |
|
| 3209 | - * Print a font selector |
|
| 3210 | - * |
|
| 3211 | - * @since 1.0 |
|
| 3212 | - * @param string $key |
|
| 3213 | - * @param string $value |
|
| 3214 | - */ |
|
| 3215 | - public function print_theme_font_option( $key ) { |
|
| 3216 | - |
|
| 3217 | - $value = $this->active_theme[ $key ]; |
|
| 3218 | - |
|
| 3219 | - echo "<select name='settings[$key]'>"; |
|
| 3220 | - |
|
| 3221 | - echo "<option value='inherit'>" . __( 'Theme Default', 'megamenu' ) . '</option>'; |
|
| 3222 | - |
|
| 3223 | - foreach ( $this->fonts() as $font ) { |
|
| 3224 | - $orig_font = $font; |
|
| 3225 | - $font = esc_attr( stripslashes( $font ) ); |
|
| 3226 | - $parts = explode( ',', $font ); |
|
| 3227 | - $font_name = trim( $parts[0] ); |
|
| 3228 | - echo "<option value=\"{$font}\" " . selected( $orig_font, htmlspecialchars_decode( $value ) ) . '>' . esc_html( $font_name ) . '</option>'; |
|
| 3229 | - } |
|
| 3230 | - |
|
| 3231 | - echo '</select>'; |
|
| 3232 | - } |
|
| 3233 | - |
|
| 3234 | - |
|
| 3235 | - /** |
|
| 3236 | - * Print a text input |
|
| 3237 | - * |
|
| 3238 | - * @since 1.0 |
|
| 3239 | - * @param string $key |
|
| 3240 | - * @param string $value |
|
| 3241 | - */ |
|
| 3242 | - public function print_theme_freetext_option( $key ) { |
|
| 3243 | - |
|
| 3244 | - $value = $this->active_theme[ $key ]; |
|
| 3245 | - |
|
| 3246 | - echo "<input class='mega-setting-{$key}' type='text' name='settings[$key]' value='" . esc_attr( $value ) . "' />"; |
|
| 3247 | - |
|
| 3248 | - } |
|
| 3249 | - |
|
| 3250 | - |
|
| 3251 | - /** |
|
| 3252 | - * Returns a list of available fonts. |
|
| 3253 | - * |
|
| 3254 | - * @since 1.0 |
|
| 3255 | - */ |
|
| 3256 | - public function fonts() { |
|
| 3257 | - |
|
| 3258 | - $fonts = array( |
|
| 3259 | - 'Georgia, serif', |
|
| 3260 | - 'Palatino Linotype, Book Antiqua, Palatino, serif', |
|
| 3261 | - 'Times New Roman, Times, serif', |
|
| 3262 | - 'Arial, Helvetica, sans-serif', |
|
| 3263 | - 'Arial Black, Gadget, sans-serif', |
|
| 3264 | - 'Comic Sans MS, cursive, sans-serif', |
|
| 3265 | - 'Impact, Charcoal, sans-serif', |
|
| 3266 | - 'Lucida Sans Unicode, Lucida Grande, sans-serif', |
|
| 3267 | - 'Tahoma, Geneva, sans-serif', |
|
| 3268 | - 'Trebuchet MS, Helvetica, sans-serif', |
|
| 3269 | - 'Verdana, Geneva, sans-serif', |
|
| 3270 | - 'Courier New, Courier, monospace', |
|
| 3271 | - 'Lucida Console, Monaco, monospace', |
|
| 3272 | - ); |
|
| 3273 | - |
|
| 3274 | - $fonts = apply_filters( 'megamenu_fonts', $fonts ); |
|
| 3275 | - |
|
| 3276 | - return $fonts; |
|
| 3277 | - |
|
| 3278 | - } |
|
| 3279 | - |
|
| 3280 | - |
|
| 3281 | - /** |
|
| 3282 | - * List of all available arrow DashIcon classes. |
|
| 3283 | - * |
|
| 3284 | - * @since 1.0 |
|
| 3285 | - * @return array - Sorted list of icon classes |
|
| 3286 | - */ |
|
| 3287 | - private function arrow_icons() { |
|
| 3288 | - |
|
| 3289 | - $icons = array( |
|
| 3290 | - 'dash-f142' => 'dashicons-arrow-up', |
|
| 3291 | - 'dash-f140' => 'dashicons-arrow-down', |
|
| 3292 | - 'dash-f141' => 'dashicons-arrow-left', |
|
| 3293 | - 'dash-f139' => 'dashicons-arrow-right', |
|
| 3294 | - 'dash-f342' => 'dashicons-arrow-up-alt', |
|
| 3295 | - 'dash-f346' => 'dashicons-arrow-down-alt', |
|
| 3296 | - 'dash-f340' => 'dashicons-arrow-left-alt', |
|
| 3297 | - 'dash-f344' => 'dashicons-arrow-right-alt', |
|
| 3298 | - 'dash-f343' => 'dashicons-arrow-up-alt2', |
|
| 3299 | - 'dash-f347' => 'dashicons-arrow-down-alt2', |
|
| 3300 | - 'dash-f341' => 'dashicons-arrow-left-alt2', |
|
| 3301 | - 'dash-f345' => 'dashicons-arrow-right-alt2', |
|
| 3302 | - 'dash-f132' => 'dashicons-plus', |
|
| 3303 | - 'dash-f460' => 'dashicons-minus', |
|
| 3304 | - 'dash-f158' => 'dashicons-no', |
|
| 3305 | - 'dash-f335' => 'dashicons-no-alt', |
|
| 3306 | - |
|
| 3307 | - ); |
|
| 3308 | - |
|
| 3309 | - $icons = apply_filters( 'megamenu_arrow_icons', $icons ); |
|
| 3310 | - |
|
| 3311 | - return $icons; |
|
| 3312 | - |
|
| 3313 | - } |
|
| 3314 | - |
|
| 3315 | - } |
|
| 3205 | + } |
|
| 3206 | + |
|
| 3207 | + |
|
| 3208 | + /** |
|
| 3209 | + * Print a font selector |
|
| 3210 | + * |
|
| 3211 | + * @since 1.0 |
|
| 3212 | + * @param string $key |
|
| 3213 | + * @param string $value |
|
| 3214 | + */ |
|
| 3215 | + public function print_theme_font_option( $key ) { |
|
| 3216 | + |
|
| 3217 | + $value = $this->active_theme[ $key ]; |
|
| 3218 | + |
|
| 3219 | + echo "<select name='settings[$key]'>"; |
|
| 3220 | + |
|
| 3221 | + echo "<option value='inherit'>" . __( 'Theme Default', 'megamenu' ) . '</option>'; |
|
| 3222 | + |
|
| 3223 | + foreach ( $this->fonts() as $font ) { |
|
| 3224 | + $orig_font = $font; |
|
| 3225 | + $font = esc_attr( stripslashes( $font ) ); |
|
| 3226 | + $parts = explode( ',', $font ); |
|
| 3227 | + $font_name = trim( $parts[0] ); |
|
| 3228 | + echo "<option value=\"{$font}\" " . selected( $orig_font, htmlspecialchars_decode( $value ) ) . '>' . esc_html( $font_name ) . '</option>'; |
|
| 3229 | + } |
|
| 3230 | + |
|
| 3231 | + echo '</select>'; |
|
| 3232 | + } |
|
| 3233 | + |
|
| 3234 | + |
|
| 3235 | + /** |
|
| 3236 | + * Print a text input |
|
| 3237 | + * |
|
| 3238 | + * @since 1.0 |
|
| 3239 | + * @param string $key |
|
| 3240 | + * @param string $value |
|
| 3241 | + */ |
|
| 3242 | + public function print_theme_freetext_option( $key ) { |
|
| 3243 | + |
|
| 3244 | + $value = $this->active_theme[ $key ]; |
|
| 3245 | + |
|
| 3246 | + echo "<input class='mega-setting-{$key}' type='text' name='settings[$key]' value='" . esc_attr( $value ) . "' />"; |
|
| 3247 | + |
|
| 3248 | + } |
|
| 3249 | + |
|
| 3250 | + |
|
| 3251 | + /** |
|
| 3252 | + * Returns a list of available fonts. |
|
| 3253 | + * |
|
| 3254 | + * @since 1.0 |
|
| 3255 | + */ |
|
| 3256 | + public function fonts() { |
|
| 3257 | + |
|
| 3258 | + $fonts = array( |
|
| 3259 | + 'Georgia, serif', |
|
| 3260 | + 'Palatino Linotype, Book Antiqua, Palatino, serif', |
|
| 3261 | + 'Times New Roman, Times, serif', |
|
| 3262 | + 'Arial, Helvetica, sans-serif', |
|
| 3263 | + 'Arial Black, Gadget, sans-serif', |
|
| 3264 | + 'Comic Sans MS, cursive, sans-serif', |
|
| 3265 | + 'Impact, Charcoal, sans-serif', |
|
| 3266 | + 'Lucida Sans Unicode, Lucida Grande, sans-serif', |
|
| 3267 | + 'Tahoma, Geneva, sans-serif', |
|
| 3268 | + 'Trebuchet MS, Helvetica, sans-serif', |
|
| 3269 | + 'Verdana, Geneva, sans-serif', |
|
| 3270 | + 'Courier New, Courier, monospace', |
|
| 3271 | + 'Lucida Console, Monaco, monospace', |
|
| 3272 | + ); |
|
| 3273 | + |
|
| 3274 | + $fonts = apply_filters( 'megamenu_fonts', $fonts ); |
|
| 3275 | + |
|
| 3276 | + return $fonts; |
|
| 3277 | + |
|
| 3278 | + } |
|
| 3279 | + |
|
| 3280 | + |
|
| 3281 | + /** |
|
| 3282 | + * List of all available arrow DashIcon classes. |
|
| 3283 | + * |
|
| 3284 | + * @since 1.0 |
|
| 3285 | + * @return array - Sorted list of icon classes |
|
| 3286 | + */ |
|
| 3287 | + private function arrow_icons() { |
|
| 3288 | + |
|
| 3289 | + $icons = array( |
|
| 3290 | + 'dash-f142' => 'dashicons-arrow-up', |
|
| 3291 | + 'dash-f140' => 'dashicons-arrow-down', |
|
| 3292 | + 'dash-f141' => 'dashicons-arrow-left', |
|
| 3293 | + 'dash-f139' => 'dashicons-arrow-right', |
|
| 3294 | + 'dash-f342' => 'dashicons-arrow-up-alt', |
|
| 3295 | + 'dash-f346' => 'dashicons-arrow-down-alt', |
|
| 3296 | + 'dash-f340' => 'dashicons-arrow-left-alt', |
|
| 3297 | + 'dash-f344' => 'dashicons-arrow-right-alt', |
|
| 3298 | + 'dash-f343' => 'dashicons-arrow-up-alt2', |
|
| 3299 | + 'dash-f347' => 'dashicons-arrow-down-alt2', |
|
| 3300 | + 'dash-f341' => 'dashicons-arrow-left-alt2', |
|
| 3301 | + 'dash-f345' => 'dashicons-arrow-right-alt2', |
|
| 3302 | + 'dash-f132' => 'dashicons-plus', |
|
| 3303 | + 'dash-f460' => 'dashicons-minus', |
|
| 3304 | + 'dash-f158' => 'dashicons-no', |
|
| 3305 | + 'dash-f335' => 'dashicons-no-alt', |
|
| 3306 | + |
|
| 3307 | + ); |
|
| 3308 | + |
|
| 3309 | + $icons = apply_filters( 'megamenu_arrow_icons', $icons ); |
|
| 3310 | + |
|
| 3311 | + return $icons; |
|
| 3312 | + |
|
| 3313 | + } |
|
| 3314 | + |
|
| 3315 | + } |
|
| 3316 | 3316 | |
| 3317 | 3317 | endif; |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | 4 | exit; // disable direct access |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if ( ! class_exists( 'Mega_Menu_Themes' ) ) : |
|
| 7 | +if (!class_exists('Mega_Menu_Themes')) : |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Handles all admin related functionality. |
@@ -37,18 +37,18 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function __construct() { |
| 39 | 39 | |
| 40 | - add_action( 'wp_ajax_megamenu_save_theme', array( $this, 'ajax_save_theme' ) ); |
|
| 41 | - add_action( 'admin_post_megamenu_save_theme', array( $this, 'save_theme' ) ); |
|
| 42 | - add_action( 'admin_post_megamenu_add_theme', array( $this, 'create_theme' ) ); |
|
| 43 | - add_action( 'admin_post_megamenu_delete_theme', array( $this, 'delete_theme' ) ); |
|
| 44 | - add_action( 'admin_post_megamenu_revert_theme', array( $this, 'revert_theme' ) ); |
|
| 45 | - add_action( 'admin_post_megamenu_duplicate_theme', array( $this, 'duplicate_theme' ) ); |
|
| 46 | - add_action( 'admin_post_megamenu_import_theme', array( $this, 'import_theme' ) ); |
|
| 40 | + add_action('wp_ajax_megamenu_save_theme', array($this, 'ajax_save_theme')); |
|
| 41 | + add_action('admin_post_megamenu_save_theme', array($this, 'save_theme')); |
|
| 42 | + add_action('admin_post_megamenu_add_theme', array($this, 'create_theme')); |
|
| 43 | + add_action('admin_post_megamenu_delete_theme', array($this, 'delete_theme')); |
|
| 44 | + add_action('admin_post_megamenu_revert_theme', array($this, 'revert_theme')); |
|
| 45 | + add_action('admin_post_megamenu_duplicate_theme', array($this, 'duplicate_theme')); |
|
| 46 | + add_action('admin_post_megamenu_import_theme', array($this, 'import_theme')); |
|
| 47 | 47 | |
| 48 | - add_filter( 'megamenu_menu_tabs', array( $this, 'add_themes_tab' ), 2 ); |
|
| 49 | - add_action( 'megamenu_page_theme_editor', array( $this, 'theme_editor_page' ) ); |
|
| 48 | + add_filter('megamenu_menu_tabs', array($this, 'add_themes_tab'), 2); |
|
| 49 | + add_action('megamenu_page_theme_editor', array($this, 'theme_editor_page')); |
|
| 50 | 50 | |
| 51 | - add_filter( 'wp_code_editor_settings', array( $this, 'codemirror_disable_lint' ), 99 ); |
|
| 51 | + add_filter('wp_code_editor_settings', array($this, 'codemirror_disable_lint'), 99); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @since 2.8 |
| 58 | 58 | */ |
| 59 | - public function codemirror_disable_lint( $settings ) { |
|
| 60 | - if ( isset( $_GET['page'] ) && 'maxmegamenu_theme_editor' === $_GET['page'] ) { // @codingStandardsIgnoreLine |
|
| 59 | + public function codemirror_disable_lint($settings) { |
|
| 60 | + if (isset($_GET['page']) && 'maxmegamenu_theme_editor' === $_GET['page']) { // @codingStandardsIgnoreLine |
|
| 61 | 61 | $settings['codemirror']['lint'] = false; |
| 62 | 62 | $settings['codemirror']['gutters'] = array(); |
| 63 | 63 | } |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | * @param array $tabs |
| 72 | 72 | * @since 2.8 |
| 73 | 73 | */ |
| 74 | - public function add_themes_tab( $tabs ) { |
|
| 75 | - $tabs['theme_editor'] = __( 'Menu Themes', 'megamenu' ); |
|
| 74 | + public function add_themes_tab($tabs) { |
|
| 75 | + $tabs['theme_editor'] = __('Menu Themes', 'megamenu'); |
|
| 76 | 76 | return $tabs; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -81,21 +81,21 @@ discard block |
||
| 81 | 81 | * @since 1.4 |
| 82 | 82 | */ |
| 83 | 83 | public function init() { |
| 84 | - if ( class_exists( 'Mega_Menu_Style_Manager' ) ) { |
|
| 84 | + if (class_exists('Mega_Menu_Style_Manager')) { |
|
| 85 | 85 | $style_manager = new Mega_Menu_Style_Manager(); |
| 86 | 86 | $this->themes = $style_manager->get_themes(); |
| 87 | 87 | |
| 88 | 88 | $last_updated = max_mega_menu_get_last_updated_theme(); |
| 89 | - $preselected_theme = isset( $this->themes[ $last_updated ] ) ? $last_updated : 'default'; |
|
| 90 | - $theme_id = isset( $_GET['theme'] ) ? sanitize_text_field( $_GET['theme'] ) : $preselected_theme; // @codingStandardsIgnoreLine |
|
| 89 | + $preselected_theme = isset($this->themes[$last_updated]) ? $last_updated : 'default'; |
|
| 90 | + $theme_id = isset($_GET['theme']) ? sanitize_text_field($_GET['theme']) : $preselected_theme; // @codingStandardsIgnoreLine |
|
| 91 | 91 | |
| 92 | - if ( isset( $this->themes[ $theme_id ] ) ) { |
|
| 92 | + if (isset($this->themes[$theme_id])) { |
|
| 93 | 93 | $this->id = $theme_id; |
| 94 | 94 | } else { |
| 95 | 95 | $this->id = $preselected_theme; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - $this->active_theme = $this->themes[ $this->id ]; |
|
| 98 | + $this->active_theme = $this->themes[$this->id]; |
|
| 99 | 99 | |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -108,13 +108,13 @@ discard block |
||
| 108 | 108 | public function get_next_theme_id() { |
| 109 | 109 | $last_id = 0; |
| 110 | 110 | |
| 111 | - if ( $saved_themes = max_mega_menu_get_themes() ) { |
|
| 112 | - foreach ( $saved_themes as $key => $value ) { |
|
| 113 | - if ( strpos( $key, 'custom_theme' ) !== false ) { |
|
| 114 | - $parts = explode( '_', $key ); |
|
| 115 | - $theme_id = end( $parts ); |
|
| 111 | + if ($saved_themes = max_mega_menu_get_themes()) { |
|
| 112 | + foreach ($saved_themes as $key => $value) { |
|
| 113 | + if (strpos($key, 'custom_theme') !== false) { |
|
| 114 | + $parts = explode('_', $key); |
|
| 115 | + $theme_id = end($parts); |
|
| 116 | 116 | |
| 117 | - if ( $theme_id > $last_id ) { |
|
| 117 | + if ($theme_id > $last_id) { |
|
| 118 | 118 | $last_id = $theme_id; |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -132,23 +132,23 @@ discard block |
||
| 132 | 132 | * @since 2.4.1 |
| 133 | 133 | */ |
| 134 | 134 | public function ajax_save_theme() { |
| 135 | - check_ajax_referer( 'megamenu_save_theme' ); |
|
| 135 | + check_ajax_referer('megamenu_save_theme'); |
|
| 136 | 136 | |
| 137 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 137 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 138 | 138 | |
| 139 | - if ( ! current_user_can( $capability ) ) { |
|
| 139 | + if (!current_user_can($capability)) { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | $style_manager = new Mega_Menu_Style_Manager(); |
| 144 | 144 | |
| 145 | - $test = $style_manager->test_theme_compilation( $this->get_prepared_theme_for_saving() ); |
|
| 145 | + $test = $style_manager->test_theme_compilation($this->get_prepared_theme_for_saving()); |
|
| 146 | 146 | |
| 147 | - if ( is_wp_error( $test ) ) { |
|
| 148 | - wp_send_json_error( $test->get_error_message() ); |
|
| 147 | + if (is_wp_error($test)) { |
|
| 148 | + wp_send_json_error($test->get_error_message()); |
|
| 149 | 149 | } else { |
| 150 | - $this->save_theme( true ); |
|
| 151 | - wp_send_json_success( 'Saved' ); |
|
| 150 | + $this->save_theme(true); |
|
| 151 | + wp_send_json_success('Saved'); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | wp_die(); |
@@ -163,33 +163,33 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | $submitted_settings = $_POST['settings']; |
| 165 | 165 | |
| 166 | - if ( isset( $_POST['checkboxes'] ) ) { |
|
| 167 | - foreach ( $_POST['checkboxes'] as $checkbox => $value ) { |
|
| 168 | - if ( isset( $submitted_settings[ $checkbox ] ) ) { |
|
| 169 | - $submitted_settings[ $checkbox ] = 'on'; |
|
| 166 | + if (isset($_POST['checkboxes'])) { |
|
| 167 | + foreach ($_POST['checkboxes'] as $checkbox => $value) { |
|
| 168 | + if (isset($submitted_settings[$checkbox])) { |
|
| 169 | + $submitted_settings[$checkbox] = 'on'; |
|
| 170 | 170 | } else { |
| 171 | - $submitted_settings[ $checkbox ] = 'off'; |
|
| 171 | + $submitted_settings[$checkbox] = 'off'; |
|
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - if ( is_numeric( $submitted_settings['responsive_breakpoint'] ) ) { |
|
| 176 | + if (is_numeric($submitted_settings['responsive_breakpoint'])) { |
|
| 177 | 177 | $submitted_settings['responsive_breakpoint'] = $submitted_settings['responsive_breakpoint'] . 'px'; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if ( isset( $submitted_settings['toggle_blocks'] ) ) { |
|
| 181 | - unset( $submitted_settings['toggle_blocks'] ); |
|
| 180 | + if (isset($submitted_settings['toggle_blocks'])) { |
|
| 181 | + unset($submitted_settings['toggle_blocks']); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - if ( isset( $submitted_settings['panel_width'] ) ) { |
|
| 185 | - $submitted_settings['panel_width'] = trim( $submitted_settings['panel_width'] ); |
|
| 184 | + if (isset($submitted_settings['panel_width'])) { |
|
| 185 | + $submitted_settings['panel_width'] = trim($submitted_settings['panel_width']); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - if ( isset( $submitted_settings['panel_inner_width'] ) ) { |
|
| 189 | - $submitted_settings['panel_inner_width'] = trim( $submitted_settings['panel_inner_width'] ); |
|
| 188 | + if (isset($submitted_settings['panel_inner_width'])) { |
|
| 189 | + $submitted_settings['panel_inner_width'] = trim($submitted_settings['panel_inner_width']); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $theme = array_map( 'esc_attr', $submitted_settings ); |
|
| 192 | + $theme = array_map('esc_attr', $submitted_settings); |
|
| 193 | 193 | |
| 194 | 194 | return $theme; |
| 195 | 195 | } |
@@ -200,30 +200,30 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @since 1.0 |
| 202 | 202 | */ |
| 203 | - public function save_theme( $is_ajax = false ) { |
|
| 203 | + public function save_theme($is_ajax = false) { |
|
| 204 | 204 | |
| 205 | - check_admin_referer( 'megamenu_save_theme' ); |
|
| 205 | + check_admin_referer('megamenu_save_theme'); |
|
| 206 | 206 | |
| 207 | - $theme = esc_attr( $_POST['theme_id'] ); |
|
| 207 | + $theme = esc_attr($_POST['theme_id']); |
|
| 208 | 208 | |
| 209 | 209 | $saved_themes = max_mega_menu_get_themes(); |
| 210 | 210 | |
| 211 | - if ( isset( $saved_themes[ $theme ] ) ) { |
|
| 212 | - unset( $saved_themes[ $theme ] ); |
|
| 211 | + if (isset($saved_themes[$theme])) { |
|
| 212 | + unset($saved_themes[$theme]); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $prepared_theme = $this->get_prepared_theme_for_saving(); |
| 216 | 216 | |
| 217 | - $saved_themes[ $theme ] = $prepared_theme; |
|
| 217 | + $saved_themes[$theme] = $prepared_theme; |
|
| 218 | 218 | |
| 219 | - max_mega_menu_save_themes( $saved_themes ); |
|
| 220 | - max_mega_menu_save_last_updated_theme( $theme ); |
|
| 219 | + max_mega_menu_save_themes($saved_themes); |
|
| 220 | + max_mega_menu_save_last_updated_theme($theme); |
|
| 221 | 221 | |
| 222 | - do_action( 'megamenu_after_theme_save' ); |
|
| 223 | - do_action( 'megamenu_delete_cache' ); |
|
| 222 | + do_action('megamenu_after_theme_save'); |
|
| 223 | + do_action('megamenu_delete_cache'); |
|
| 224 | 224 | |
| 225 | - if ( ! $is_ajax ) { |
|
| 226 | - $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$theme}&saved=true" ) ); |
|
| 225 | + if (!$is_ajax) { |
|
| 226 | + $this->redirect(admin_url("admin.php?page=maxmegamenu_theme_editor&theme={$theme}&saved=true")); |
|
| 227 | 227 | return; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -238,29 +238,29 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public function duplicate_theme() { |
| 240 | 240 | |
| 241 | - check_admin_referer( 'megamenu_duplicate_theme' ); |
|
| 241 | + check_admin_referer('megamenu_duplicate_theme'); |
|
| 242 | 242 | |
| 243 | 243 | $this->init(); |
| 244 | 244 | |
| 245 | - $theme = esc_attr( $_GET['theme_id'] ); |
|
| 245 | + $theme = esc_attr($_GET['theme_id']); |
|
| 246 | 246 | |
| 247 | - $copy = $this->themes[ $theme ]; |
|
| 247 | + $copy = $this->themes[$theme]; |
|
| 248 | 248 | |
| 249 | 249 | $saved_themes = max_mega_menu_get_themes(); |
| 250 | 250 | |
| 251 | 251 | $next_id = $this->get_next_theme_id(); |
| 252 | 252 | |
| 253 | - $copy['title'] = $copy['title'] . ' ' . __( 'Copy', 'megamenu' ); |
|
| 253 | + $copy['title'] = $copy['title'] . ' ' . __('Copy', 'megamenu'); |
|
| 254 | 254 | |
| 255 | 255 | $new_theme_id = 'custom_theme_' . $next_id; |
| 256 | 256 | |
| 257 | - $saved_themes[ $new_theme_id ] = $copy; |
|
| 257 | + $saved_themes[$new_theme_id] = $copy; |
|
| 258 | 258 | |
| 259 | - max_mega_menu_save_themes( $saved_themes ); |
|
| 259 | + max_mega_menu_save_themes($saved_themes); |
|
| 260 | 260 | |
| 261 | - do_action( 'megamenu_after_theme_duplicate' ); |
|
| 261 | + do_action('megamenu_after_theme_duplicate'); |
|
| 262 | 262 | |
| 263 | - $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$new_theme_id}&duplicated=true" ) ); |
|
| 263 | + $this->redirect(admin_url("admin.php?page=maxmegamenu_theme_editor&theme={$new_theme_id}&duplicated=true")); |
|
| 264 | 264 | |
| 265 | 265 | } |
| 266 | 266 | |
@@ -272,29 +272,29 @@ discard block |
||
| 272 | 272 | */ |
| 273 | 273 | public function delete_theme() { |
| 274 | 274 | |
| 275 | - check_admin_referer( 'megamenu_delete_theme' ); |
|
| 275 | + check_admin_referer('megamenu_delete_theme'); |
|
| 276 | 276 | |
| 277 | - $theme = esc_attr( $_GET['theme_id'] ); |
|
| 277 | + $theme = esc_attr($_GET['theme_id']); |
|
| 278 | 278 | |
| 279 | - if ( $this->theme_is_being_used_by_location( $theme ) ) { |
|
| 279 | + if ($this->theme_is_being_used_by_location($theme)) { |
|
| 280 | 280 | |
| 281 | - $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$theme}&deleted=false" ) ); |
|
| 281 | + $this->redirect(admin_url("admin.php?page=maxmegamenu_theme_editor&theme={$theme}&deleted=false")); |
|
| 282 | 282 | return; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | $saved_themes = max_mega_menu_get_themes(); |
| 286 | 286 | |
| 287 | - if ( isset( $saved_themes[ $theme ] ) ) { |
|
| 288 | - unset( $saved_themes[ $theme ] ); |
|
| 287 | + if (isset($saved_themes[$theme])) { |
|
| 288 | + unset($saved_themes[$theme]); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - max_mega_menu_save_themes( $saved_themes ); |
|
| 291 | + max_mega_menu_save_themes($saved_themes); |
|
| 292 | 292 | |
| 293 | - do_action( 'megamenu_after_theme_delete' ); |
|
| 293 | + do_action('megamenu_after_theme_delete'); |
|
| 294 | 294 | |
| 295 | - do_action( 'megamenu_delete_cache' ); |
|
| 295 | + do_action('megamenu_delete_cache'); |
|
| 296 | 296 | |
| 297 | - $this->redirect( admin_url( 'admin.php?page=maxmegamenu_theme_editor&theme=default&deleted=true' ) ); |
|
| 297 | + $this->redirect(admin_url('admin.php?page=maxmegamenu_theme_editor&theme=default&deleted=true')); |
|
| 298 | 298 | |
| 299 | 299 | } |
| 300 | 300 | |
@@ -306,23 +306,23 @@ discard block |
||
| 306 | 306 | */ |
| 307 | 307 | public function revert_theme() { |
| 308 | 308 | |
| 309 | - check_admin_referer( 'megamenu_revert_theme' ); |
|
| 309 | + check_admin_referer('megamenu_revert_theme'); |
|
| 310 | 310 | |
| 311 | - $theme = esc_attr( $_GET['theme_id'] ); |
|
| 311 | + $theme = esc_attr($_GET['theme_id']); |
|
| 312 | 312 | |
| 313 | 313 | $saved_themes = max_mega_menu_get_themes(); |
| 314 | 314 | |
| 315 | - if ( isset( $saved_themes[ $theme ] ) ) { |
|
| 316 | - unset( $saved_themes[ $theme ] ); |
|
| 315 | + if (isset($saved_themes[$theme])) { |
|
| 316 | + unset($saved_themes[$theme]); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - max_mega_menu_save_themes( $saved_themes ); |
|
| 319 | + max_mega_menu_save_themes($saved_themes); |
|
| 320 | 320 | |
| 321 | - do_action( 'megamenu_after_theme_revert' ); |
|
| 321 | + do_action('megamenu_after_theme_revert'); |
|
| 322 | 322 | |
| 323 | - do_action( 'megamenu_delete_cache' ); |
|
| 323 | + do_action('megamenu_delete_cache'); |
|
| 324 | 324 | |
| 325 | - $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$theme}&reverted=true" ) ); |
|
| 325 | + $this->redirect(admin_url("admin.php?page=maxmegamenu_theme_editor&theme={$theme}&reverted=true")); |
|
| 326 | 326 | |
| 327 | 327 | } |
| 328 | 328 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | public function create_theme() { |
| 336 | 336 | |
| 337 | - check_admin_referer( 'megamenu_create_theme' ); |
|
| 337 | + check_admin_referer('megamenu_create_theme'); |
|
| 338 | 338 | |
| 339 | 339 | $this->init(); |
| 340 | 340 | |
@@ -349,13 +349,13 @@ discard block |
||
| 349 | 349 | |
| 350 | 350 | $new_theme['title'] = "Custom {$next_id}"; |
| 351 | 351 | |
| 352 | - $saved_themes[ $new_theme_id ] = $new_theme; |
|
| 352 | + $saved_themes[$new_theme_id] = $new_theme; |
|
| 353 | 353 | |
| 354 | - max_mega_menu_save_themes( $saved_themes ); |
|
| 354 | + max_mega_menu_save_themes($saved_themes); |
|
| 355 | 355 | |
| 356 | - do_action( 'megamenu_after_theme_create' ); |
|
| 356 | + do_action('megamenu_after_theme_create'); |
|
| 357 | 357 | |
| 358 | - $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$new_theme_id}&created=true" ) ); |
|
| 358 | + $this->redirect(admin_url("admin.php?page=maxmegamenu_theme_editor&theme={$new_theme_id}&created=true")); |
|
| 359 | 359 | |
| 360 | 360 | } |
| 361 | 361 | |
@@ -365,30 +365,30 @@ discard block |
||
| 365 | 365 | * @since 1.8 |
| 366 | 366 | */ |
| 367 | 367 | public function import_theme() { |
| 368 | - check_admin_referer( 'megamenu_import_theme' ); |
|
| 368 | + check_admin_referer('megamenu_import_theme'); |
|
| 369 | 369 | |
| 370 | - $import = json_decode( stripslashes( $_POST['data'] ), true ); |
|
| 370 | + $import = json_decode(stripslashes($_POST['data']), true); |
|
| 371 | 371 | |
| 372 | 372 | $sanitized = array(); |
| 373 | 373 | |
| 374 | - foreach ( $import as $key => $value ) { |
|
| 375 | - if ( $key == 'custom_css' ) { |
|
| 376 | - $sanitized[ $key ] = sanitize_textarea_field( $value ); |
|
| 374 | + foreach ($import as $key => $value) { |
|
| 375 | + if ($key == 'custom_css') { |
|
| 376 | + $sanitized[$key] = sanitize_textarea_field($value); |
|
| 377 | 377 | } else { |
| 378 | - $sanitized[ $key ] = sanitize_text_field( $value ); |
|
| 378 | + $sanitized[$key] = sanitize_text_field($value); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | $import = $sanitized; |
| 383 | 383 | |
| 384 | - if ( is_array( $import ) ) { |
|
| 384 | + if (is_array($import)) { |
|
| 385 | 385 | $saved_themes = max_mega_menu_get_themes(); |
| 386 | 386 | $next_id = $this->get_next_theme_id(); |
| 387 | - $import['title'] = $import['title'] . ' ' . __( ' - Imported', 'megamenu' ); |
|
| 387 | + $import['title'] = $import['title'] . ' ' . __(' - Imported', 'megamenu'); |
|
| 388 | 388 | $new_theme_id = 'custom_theme_' . $next_id; |
| 389 | - $saved_themes[ $new_theme_id ] = $import; |
|
| 390 | - max_mega_menu_save_themes( $saved_themes ); |
|
| 391 | - do_action( 'megamenu_after_theme_import' ); |
|
| 389 | + $saved_themes[$new_theme_id] = $import; |
|
| 390 | + max_mega_menu_save_themes($saved_themes); |
|
| 391 | + do_action('megamenu_after_theme_import'); |
|
| 392 | 392 | |
| 393 | 393 | $url = add_query_arg( |
| 394 | 394 | array( |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | 'theme' => $new_theme_id, |
| 397 | 397 | 'imported' => 'true', |
| 398 | 398 | ), |
| 399 | - admin_url( 'admin.php' ) |
|
| 399 | + admin_url('admin.php') |
|
| 400 | 400 | ); |
| 401 | 401 | |
| 402 | 402 | } else { |
@@ -405,11 +405,11 @@ discard block |
||
| 405 | 405 | 'page' => 'maxmegamenu_theme_editor', |
| 406 | 406 | 'imported' => 'false', |
| 407 | 407 | ), |
| 408 | - admin_url( 'admin.php' ) |
|
| 408 | + admin_url('admin.php') |
|
| 409 | 409 | ); |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | - $this->redirect( $url ); |
|
| 412 | + $this->redirect($url); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | |
@@ -418,8 +418,8 @@ discard block |
||
| 418 | 418 | * |
| 419 | 419 | * @since 1.8 |
| 420 | 420 | */ |
| 421 | - public function redirect( $url ) { |
|
| 422 | - wp_redirect( $url ); |
|
| 421 | + public function redirect($url) { |
|
| 422 | + wp_redirect($url); |
|
| 423 | 423 | exit; |
| 424 | 424 | } |
| 425 | 425 | |
@@ -430,10 +430,10 @@ discard block |
||
| 430 | 430 | * @since 1.0 |
| 431 | 431 | * @param string $theme |
| 432 | 432 | */ |
| 433 | - public function theme_is_being_used_by_location( $theme ) { |
|
| 434 | - $settings = get_option( 'megamenu_settings' ); |
|
| 433 | + public function theme_is_being_used_by_location($theme) { |
|
| 434 | + $settings = get_option('megamenu_settings'); |
|
| 435 | 435 | |
| 436 | - if ( ! $settings ) { |
|
| 436 | + if (!$settings) { |
|
| 437 | 437 | return false; |
| 438 | 438 | } |
| 439 | 439 | |
@@ -443,16 +443,16 @@ discard block |
||
| 443 | 443 | |
| 444 | 444 | $theme_in_use_locations = array(); |
| 445 | 445 | |
| 446 | - if ( count( $locations ) ) { |
|
| 446 | + if (count($locations)) { |
|
| 447 | 447 | |
| 448 | - foreach ( $locations as $location => $menu_id ) { |
|
| 448 | + foreach ($locations as $location => $menu_id) { |
|
| 449 | 449 | |
| 450 | - if ( has_nav_menu( $location ) && max_mega_menu_is_enabled( $location ) && isset( $settings[ $location ]['theme'] ) && $settings[ $location ]['theme'] == $theme ) { |
|
| 451 | - $theme_in_use_locations[] = isset( $menus[ $location ] ) ? $menus[ $location ] : $location; |
|
| 450 | + if (has_nav_menu($location) && max_mega_menu_is_enabled($location) && isset($settings[$location]['theme']) && $settings[$location]['theme'] == $theme) { |
|
| 451 | + $theme_in_use_locations[] = isset($menus[$location]) ? $menus[$location] : $location; |
|
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - if ( count( $theme_in_use_locations ) ) { |
|
| 455 | + if (count($theme_in_use_locations)) { |
|
| 456 | 456 | return $theme_in_use_locations; |
| 457 | 457 | } |
| 458 | 458 | } |
@@ -472,9 +472,9 @@ discard block |
||
| 472 | 472 | |
| 473 | 473 | $style_manager = new Mega_Menu_Style_Manager(); |
| 474 | 474 | |
| 475 | - $test = $style_manager->test_theme_compilation( $this->active_theme ); |
|
| 475 | + $test = $style_manager->test_theme_compilation($this->active_theme); |
|
| 476 | 476 | |
| 477 | - if ( is_wp_error( $test ) ) { |
|
| 477 | + if (is_wp_error($test)) { |
|
| 478 | 478 | ?> |
| 479 | 479 | <div class="notice notice-error is-dismissible"> |
| 480 | 480 | <p><?php echo $test->get_error_message(); ?></p> |
@@ -482,47 +482,47 @@ discard block |
||
| 482 | 482 | <?php |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - if ( isset( $_GET['deleted'] ) && $_GET['deleted'] == 'false' ) { |
|
| 485 | + if (isset($_GET['deleted']) && $_GET['deleted'] == 'false') { |
|
| 486 | 486 | ?> |
| 487 | 487 | <div class="notice notice-error is-dismissible"> |
| 488 | - <p><?php _e( 'Failed to delete theme. The theme is in use by a menu.', 'megamenu' ) ?></p> |
|
| 488 | + <p><?php _e('Failed to delete theme. The theme is in use by a menu.', 'megamenu') ?></p> |
|
| 489 | 489 | </div> |
| 490 | 490 | <?php |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | - if ( isset( $_GET['deleted'] ) && $_GET['deleted'] == 'true' ) { |
|
| 493 | + if (isset($_GET['deleted']) && $_GET['deleted'] == 'true') { |
|
| 494 | 494 | ?> |
| 495 | 495 | <div class="notice notice-success is-dismissible"> |
| 496 | - <p><?php _e( 'Theme Deleted', 'megamenu' ) ?></p> |
|
| 496 | + <p><?php _e('Theme Deleted', 'megamenu') ?></p> |
|
| 497 | 497 | </div> |
| 498 | 498 | <?php |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | - if ( isset( $_GET['duplicated'] ) ) { |
|
| 501 | + if (isset($_GET['duplicated'])) { |
|
| 502 | 502 | ?> |
| 503 | 503 | <div class="notice notice-success is-dismissible"> |
| 504 | - <p><?php _e( 'Theme Duplicated', 'megamenu' ) ?></p> |
|
| 504 | + <p><?php _e('Theme Duplicated', 'megamenu') ?></p> |
|
| 505 | 505 | </div> |
| 506 | 506 | <?php |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | - if ( isset( $_GET['reverted'] ) ) { |
|
| 509 | + if (isset($_GET['reverted'])) { |
|
| 510 | 510 | ?> |
| 511 | 511 | <div class="notice notice-success is-dismissible"> |
| 512 | - <p><?php _e( 'Theme Reverted', 'megamenu' ) ?></p> |
|
| 512 | + <p><?php _e('Theme Reverted', 'megamenu') ?></p> |
|
| 513 | 513 | </div> |
| 514 | 514 | <?php |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - if ( isset( $_GET['created'] ) ) { |
|
| 517 | + if (isset($_GET['created'])) { |
|
| 518 | 518 | ?> |
| 519 | 519 | <div class="notice notice-success is-dismissible"> |
| 520 | - <p><?php _e( "New Theme Created. To apply this theme to a menu location, go to <i>Mega Menu > Menu Locations</i> and select this theme from the 'Theme' dropdown.", 'megamenu' ) ?></p> |
|
| 520 | + <p><?php _e("New Theme Created. To apply this theme to a menu location, go to <i>Mega Menu > Menu Locations</i> and select this theme from the 'Theme' dropdown.", 'megamenu') ?></p> |
|
| 521 | 521 | </div> |
| 522 | 522 | <?php |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | - do_action( 'megamenu_print_messages' ); |
|
| 525 | + do_action('megamenu_print_messages'); |
|
| 526 | 526 | |
| 527 | 527 | } |
| 528 | 528 | |
@@ -536,21 +536,21 @@ discard block |
||
| 536 | 536 | |
| 537 | 537 | $list_items = "<select id='theme_selector'>"; |
| 538 | 538 | |
| 539 | - foreach ( $this->themes as $id => $theme ) { |
|
| 539 | + foreach ($this->themes as $id => $theme) { |
|
| 540 | 540 | |
| 541 | - $locations = $this->theme_is_being_used_by_location( $id ); |
|
| 541 | + $locations = $this->theme_is_being_used_by_location($id); |
|
| 542 | 542 | |
| 543 | 543 | $selected = $id == $this->id ? 'selected=selected' : ''; |
| 544 | 544 | |
| 545 | - $list_items .= "<option {$selected} value='" . admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$id}" ) . "'>"; |
|
| 545 | + $list_items .= "<option {$selected} value='" . admin_url("admin.php?page=maxmegamenu_theme_editor&theme={$id}") . "'>"; |
|
| 546 | 546 | |
| 547 | 547 | $title = $theme['title']; |
| 548 | 548 | |
| 549 | - if ( is_array( $locations ) ) { |
|
| 550 | - $title .= ' (' . implode( ', ', $locations ) . ')'; |
|
| 549 | + if (is_array($locations)) { |
|
| 550 | + $title .= ' (' . implode(', ', $locations) . ')'; |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | - $list_items .= esc_html( $title ); |
|
| 553 | + $list_items .= esc_html($title); |
|
| 554 | 554 | |
| 555 | 555 | $list_items .= '</option>'; |
| 556 | 556 | } |
@@ -566,11 +566,11 @@ discard block |
||
| 566 | 566 | * @param array $needles |
| 567 | 567 | * @since 1.0 |
| 568 | 568 | */ |
| 569 | - private function string_contains( $key, $needles ) { |
|
| 569 | + private function string_contains($key, $needles) { |
|
| 570 | 570 | |
| 571 | - foreach ( $needles as $needle ) { |
|
| 571 | + foreach ($needles as $needle) { |
|
| 572 | 572 | |
| 573 | - if ( strpos( $key, $needle ) !== false ) { |
|
| 573 | + if (strpos($key, $needle) !== false) { |
|
| 574 | 574 | return true; |
| 575 | 575 | } |
| 576 | 576 | } |
@@ -592,40 +592,40 @@ discard block |
||
| 592 | 592 | |
| 593 | 593 | $diff = array(); |
| 594 | 594 | |
| 595 | - foreach ( $default_theme as $key => $value ) { |
|
| 596 | - if ( isset( $theme_to_export[ $key ] ) && $theme_to_export[ $key ] != $value || $key == 'title' ) { |
|
| 597 | - $diff[ $key ] = $theme_to_export[ $key ]; |
|
| 595 | + foreach ($default_theme as $key => $value) { |
|
| 596 | + if (isset($theme_to_export[$key]) && $theme_to_export[$key] != $value || $key == 'title') { |
|
| 597 | + $diff[$key] = $theme_to_export[$key]; |
|
| 598 | 598 | } |
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | ?> |
| 602 | 602 | |
| 603 | 603 | <div class='menu_settings menu_settings_menu_themes'> |
| 604 | - <h3 class='first'><?php _e( 'Export Theme', 'megamenu' ); ?></h3> |
|
| 604 | + <h3 class='first'><?php _e('Export Theme', 'megamenu'); ?></h3> |
|
| 605 | 605 | <table> |
| 606 | 606 | <tr> |
| 607 | 607 | <td class='mega-name'> |
| 608 | - <?php _e( 'JSON Format', 'megamenu' ); ?> |
|
| 609 | - <div class='mega-description'><?php _e( "Log into the site you wish to import the theme to. Go to Mega Menu > Tools and paste this into the 'Import Theme' text area:", 'megamenu' ); ?></div> |
|
| 608 | + <?php _e('JSON Format', 'megamenu'); ?> |
|
| 609 | + <div class='mega-description'><?php _e("Log into the site you wish to import the theme to. Go to Mega Menu > Tools and paste this into the 'Import Theme' text area:", 'megamenu'); ?></div> |
|
| 610 | 610 | </td> |
| 611 | 611 | <td class='mega-value'> |
| 612 | - <?php echo "<textarea class='mega-export'>" . sanitize_textarea_field( htmlentities( json_encode( $diff ) ) ) . '</textarea>'; ?> |
|
| 612 | + <?php echo "<textarea class='mega-export'>" . sanitize_textarea_field(htmlentities(json_encode($diff))) . '</textarea>'; ?> |
|
| 613 | 613 | </td> |
| 614 | 614 | </tr> |
| 615 | 615 | <tr> |
| 616 | 616 | <td class='mega-name'> |
| 617 | - <?php _e( 'PHP Format', 'megamenu' ); ?> |
|
| 618 | - <div class='mega-description'><?php _e( 'Paste this code into your themes functions.php file:', 'megamenu' ); ?></div> |
|
| 617 | + <?php _e('PHP Format', 'megamenu'); ?> |
|
| 618 | + <div class='mega-description'><?php _e('Paste this code into your themes functions.php file:', 'megamenu'); ?></div> |
|
| 619 | 619 | </td> |
| 620 | 620 | <td class='mega-value'> |
| 621 | 621 | <?php |
| 622 | - $key = strtolower( str_replace( ' ', '_', $theme_to_export['title'] ) ); |
|
| 622 | + $key = strtolower(str_replace(' ', '_', $theme_to_export['title'])); |
|
| 623 | 623 | $key .= '_' . time(); |
| 624 | 624 | echo "<textarea class='mega-export'>"; |
| 625 | 625 | echo 'function megamenu_add_theme_' . $key . '($themes) {'; |
| 626 | 626 | echo "\n" . ' $themes["' . $key . '"] = array('; |
| 627 | 627 | |
| 628 | - foreach ( $diff as $theme_key => $value ) { |
|
| 628 | + foreach ($diff as $theme_key => $value) { |
|
| 629 | 629 | echo "\n '" . $theme_key . "' => '" . $value . "',"; |
| 630 | 630 | } |
| 631 | 631 | |
@@ -648,19 +648,19 @@ discard block |
||
| 648 | 648 | ?> |
| 649 | 649 | |
| 650 | 650 | <div class='menu_settings menu_settings_menu_themes'> |
| 651 | - <h3 class='first'><?php _e( 'Import Theme', 'megamenu' ); ?></h3> |
|
| 651 | + <h3 class='first'><?php _e('Import Theme', 'megamenu'); ?></h3> |
|
| 652 | 652 | <table> |
| 653 | 653 | <tr> |
| 654 | 654 | <td class='mega-name'> |
| 655 | - <?php _e( 'Import Theme', 'megamenu' ); ?> |
|
| 656 | - <div class='mega-description'><?php _e( 'Import a menu theme in JSON format', 'megamenu' ); ?></div> |
|
| 655 | + <?php _e('Import Theme', 'megamenu'); ?> |
|
| 656 | + <div class='mega-description'><?php _e('Import a menu theme in JSON format', 'megamenu'); ?></div> |
|
| 657 | 657 | </td> |
| 658 | 658 | <td class='mega-value'> |
| 659 | - <form action="<?php echo admin_url( 'admin-post.php' ); ?>" method="post"> |
|
| 660 | - <?php wp_nonce_field( 'megamenu_import_theme' ); ?> |
|
| 659 | + <form action="<?php echo admin_url('admin-post.php'); ?>" method="post"> |
|
| 660 | + <?php wp_nonce_field('megamenu_import_theme'); ?> |
|
| 661 | 661 | <input type="hidden" name="action" value="megamenu_import_theme" /> |
| 662 | 662 | <textarea name='data'></textarea> |
| 663 | - <input type='submit' class='button button-primary' value='<?php _e( 'Import Theme', 'megamenu' ); ?>' /> |
|
| 663 | + <input type='submit' class='button button-primary' value='<?php _e('Import Theme', 'megamenu'); ?>' /> |
|
| 664 | 664 | </form> |
| 665 | 665 | </td> |
| 666 | 666 | </tr> |
@@ -676,16 +676,16 @@ discard block |
||
| 676 | 676 | * |
| 677 | 677 | * @since 1.0 |
| 678 | 678 | */ |
| 679 | - public function theme_editor_page( $saved_settings ) { |
|
| 679 | + public function theme_editor_page($saved_settings) { |
|
| 680 | 680 | |
| 681 | 681 | $this->init(); |
| 682 | 682 | |
| 683 | - if ( isset( $_GET['export'] ) ) { |
|
| 683 | + if (isset($_GET['export'])) { |
|
| 684 | 684 | $this->export_theme(); |
| 685 | 685 | return; |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - if ( isset( $_GET['import'] ) ) { |
|
| 688 | + if (isset($_GET['import'])) { |
|
| 689 | 689 | $this->import_theme_page(); |
| 690 | 690 | return; |
| 691 | 691 | } |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | array( |
| 696 | 696 | 'action' => 'megamenu_add_theme', |
| 697 | 697 | ), |
| 698 | - wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_create_theme' ) |
|
| 698 | + wp_nonce_url(admin_url('admin-post.php'), 'megamenu_create_theme') |
|
| 699 | 699 | ) |
| 700 | 700 | ); |
| 701 | 701 | |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | 'action' => 'megamenu_duplicate_theme', |
| 706 | 706 | 'theme_id' => $this->id, |
| 707 | 707 | ), |
| 708 | - wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_duplicate_theme' ) |
|
| 708 | + wp_nonce_url(admin_url('admin-post.php'), 'megamenu_duplicate_theme') |
|
| 709 | 709 | ) |
| 710 | 710 | ); |
| 711 | 711 | |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | 'action' => 'megamenu_delete_theme', |
| 716 | 716 | 'theme_id' => $this->id, |
| 717 | 717 | ), |
| 718 | - wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_delete_theme' ) |
|
| 718 | + wp_nonce_url(admin_url('admin-post.php'), 'megamenu_delete_theme') |
|
| 719 | 719 | ) |
| 720 | 720 | ); |
| 721 | 721 | |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | 'action' => 'megamenu_revert_theme', |
| 726 | 726 | 'theme_id' => $this->id, |
| 727 | 727 | ), |
| 728 | - wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_revert_theme' ) |
|
| 728 | + wp_nonce_url(admin_url('admin-post.php'), 'megamenu_revert_theme') |
|
| 729 | 729 | ) |
| 730 | 730 | ); |
| 731 | 731 | |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | 'theme' => $this->id, |
| 737 | 737 | 'export' => 'true', |
| 738 | 738 | ), |
| 739 | - admin_url( 'admin.php' ) |
|
| 739 | + admin_url('admin.php') |
|
| 740 | 740 | ) |
| 741 | 741 | ); |
| 742 | 742 | |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | 'page' => 'maxmegamenu_theme_editor', |
| 747 | 747 | 'import' => 'true', |
| 748 | 748 | ), |
| 749 | - admin_url( 'admin.php' ) |
|
| 749 | + admin_url('admin.php') |
|
| 750 | 750 | ) |
| 751 | 751 | ); |
| 752 | 752 | |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | <div class='menu_settings menu_settings_menu_themes'> |
| 758 | 758 | |
| 759 | 759 | <div class='theme_selector'> |
| 760 | - <?php _e( 'Select theme to edit', 'megamenu' ); ?> <?php echo $this->theme_selector(); ?> |
|
| 760 | + <?php _e('Select theme to edit', 'megamenu'); ?> <?php echo $this->theme_selector(); ?> |
|
| 761 | 761 | </div> |
| 762 | 762 | |
| 763 | 763 | <div class='mega-ellipsis'> |
@@ -765,46 +765,46 @@ discard block |
||
| 765 | 765 | <path d="M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"></path> |
| 766 | 766 | </svg> |
| 767 | 767 | <ul class='mega-ellipsis-content'> |
| 768 | - <li class='mega-create-theme'><a href='<?php echo $create_url; ?>'><span class='dashicons dashicons-welcome-add-page'></span><?php _e( 'Add new theme', 'megamenu' ); ?></a></li> |
|
| 769 | - <li class='mega-duplicate-theme'><a href='<?php echo $duplicate_url; ?>'><span class='dashicons dashicons-images-alt2'></span><?php _e( 'Duplicate theme', 'megamenu' ); ?></a></li> |
|
| 770 | - <li class='mega-export-theme'><a href='<?php echo $export_url; ?>'><span class='dashicons dashicons-upload'></span><?php _e( 'Export theme', 'megamenu' ); ?></a></li> |
|
| 771 | - <li class='mega-import-theme'><a href='<?php echo $import_url; ?>'><span class='dashicons dashicons-download'></span><?php _e( 'Import a theme', 'megamenu' ); ?></a></li> |
|
| 772 | - <?php if ( $this->string_contains( $this->id, array( 'custom' ) ) ) : ?> |
|
| 773 | - <li class='mega-delete-theme'><a class='delete confirm' href='<?php echo $delete_url; ?>'><span class='dashicons dashicons-trash'></span><?php _e( 'Delete theme', 'megamenu' ); ?></a></li> |
|
| 768 | + <li class='mega-create-theme'><a href='<?php echo $create_url; ?>'><span class='dashicons dashicons-welcome-add-page'></span><?php _e('Add new theme', 'megamenu'); ?></a></li> |
|
| 769 | + <li class='mega-duplicate-theme'><a href='<?php echo $duplicate_url; ?>'><span class='dashicons dashicons-images-alt2'></span><?php _e('Duplicate theme', 'megamenu'); ?></a></li> |
|
| 770 | + <li class='mega-export-theme'><a href='<?php echo $export_url; ?>'><span class='dashicons dashicons-upload'></span><?php _e('Export theme', 'megamenu'); ?></a></li> |
|
| 771 | + <li class='mega-import-theme'><a href='<?php echo $import_url; ?>'><span class='dashicons dashicons-download'></span><?php _e('Import a theme', 'megamenu'); ?></a></li> |
|
| 772 | + <?php if ($this->string_contains($this->id, array('custom'))) : ?> |
|
| 773 | + <li class='mega-delete-theme'><a class='delete confirm' href='<?php echo $delete_url; ?>'><span class='dashicons dashicons-trash'></span><?php _e('Delete theme', 'megamenu'); ?></a></li> |
|
| 774 | 774 | <?php else : ?> |
| 775 | - <li class='mega-revert-theme'><a class='confirm' href='<?php echo $revert_url; ?>'><span class='dashicons dashicons-update-alt'></span><?php _e( 'Revert theme', 'megamenu' ); ?></a></li> |
|
| 775 | + <li class='mega-revert-theme'><a class='confirm' href='<?php echo $revert_url; ?>'><span class='dashicons dashicons-update-alt'></span><?php _e('Revert theme', 'megamenu'); ?></a></li> |
|
| 776 | 776 | <?php endif; ?> |
| 777 | 777 | </ul> |
| 778 | 778 | </div> |
| 779 | 779 | |
| 780 | - <h3 class='editing_theme'><?php echo __( 'Editing theme', 'megamenu' ) . ': ' . esc_html( $this->active_theme['title'] ); ?></h3> |
|
| 780 | + <h3 class='editing_theme'><?php echo __('Editing theme', 'megamenu') . ': ' . esc_html($this->active_theme['title']); ?></h3> |
|
| 781 | 781 | |
| 782 | 782 | |
| 783 | 783 | |
| 784 | 784 | <?php |
| 785 | 785 | |
| 786 | - $saved_settings = get_option( 'megamenu_settings' ); |
|
| 786 | + $saved_settings = get_option('megamenu_settings'); |
|
| 787 | 787 | |
| 788 | - if ( isset( $saved_settings['css'] ) && $saved_settings['css'] == 'disabled' ) { |
|
| 788 | + if (isset($saved_settings['css']) && $saved_settings['css'] == 'disabled') { |
|
| 789 | 789 | ?> |
| 790 | - <div class='fail'><?php _e( 'CSS Output (under Mega Menu > General Settings) has been disabled. Therefore, changes made within the theme editor will not be applied to your menu.', 'megamenu' ); ?></div> |
|
| 790 | + <div class='fail'><?php _e('CSS Output (under Mega Menu > General Settings) has been disabled. Therefore, changes made within the theme editor will not be applied to your menu.', 'megamenu'); ?></div> |
|
| 791 | 791 | <?php |
| 792 | 792 | } |
| 793 | 793 | |
| 794 | - $locations = $this->theme_is_being_used_by_location( $this->id ); |
|
| 794 | + $locations = $this->theme_is_being_used_by_location($this->id); |
|
| 795 | 795 | |
| 796 | - if ( ! $locations && ! isset( $_GET['created'] ) ) { |
|
| 796 | + if (!$locations && !isset($_GET['created'])) { |
|
| 797 | 797 | ?> |
| 798 | - <div class='warning'><?php _e( "This menu theme is not currently active as it has not been applied to any menu locations. You may wish to check you are editing the correct menu theme - you can choose a different theme to edit using the 'Select theme to edit' selector above. Alternatively, to apply this theme to a menu go to <i>Appearance > Menus > Max Mega Menu Settings</i> and select this theme from the 'Theme' dropdown.", 'megamenu' ); ?></div> |
|
| 798 | + <div class='warning'><?php _e("This menu theme is not currently active as it has not been applied to any menu locations. You may wish to check you are editing the correct menu theme - you can choose a different theme to edit using the 'Select theme to edit' selector above. Alternatively, to apply this theme to a menu go to <i>Appearance > Menus > Max Mega Menu Settings</i> and select this theme from the 'Theme' dropdown.", 'megamenu'); ?></div> |
|
| 799 | 799 | <?php |
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | ?> |
| 803 | 803 | |
| 804 | - <form action="<?php echo admin_url( 'admin-post.php' ); ?>" method="post" class="theme_editor"> |
|
| 805 | - <input type="hidden" name="theme_id" value="<?php echo esc_attr( $this->id ); ?>" /> |
|
| 804 | + <form action="<?php echo admin_url('admin-post.php'); ?>" method="post" class="theme_editor"> |
|
| 805 | + <input type="hidden" name="theme_id" value="<?php echo esc_attr($this->id); ?>" /> |
|
| 806 | 806 | <input type="hidden" name="action" value="megamenu_save_theme" /> |
| 807 | - <?php wp_nonce_field( 'megamenu_save_theme' ); ?> |
|
| 807 | + <?php wp_nonce_field('megamenu_save_theme'); ?> |
|
| 808 | 808 | |
| 809 | 809 | <?php |
| 810 | 810 | |
@@ -813,11 +813,11 @@ discard block |
||
| 813 | 813 | array( |
| 814 | 814 | |
| 815 | 815 | 'general' => array( |
| 816 | - 'title' => __( 'General Settings', 'megamenu' ), |
|
| 816 | + 'title' => __('General Settings', 'megamenu'), |
|
| 817 | 817 | 'settings' => array( |
| 818 | 818 | 'title' => array( |
| 819 | 819 | 'priority' => 10, |
| 820 | - 'title' => __( 'Theme Title', 'megamenu' ), |
|
| 820 | + 'title' => __('Theme Title', 'megamenu'), |
|
| 821 | 821 | 'description' => '', |
| 822 | 822 | 'settings' => array( |
| 823 | 823 | array( |
@@ -829,26 +829,26 @@ discard block |
||
| 829 | 829 | ), |
| 830 | 830 | 'arrow' => array( |
| 831 | 831 | 'priority' => 20, |
| 832 | - 'title' => __( 'Arrow', 'megamenu' ), |
|
| 833 | - 'description' => __( 'Select the arrow styles.', 'megamenu' ), |
|
| 832 | + 'title' => __('Arrow', 'megamenu'), |
|
| 833 | + 'description' => __('Select the arrow styles.', 'megamenu'), |
|
| 834 | 834 | 'settings' => array( |
| 835 | 835 | array( |
| 836 | - 'title' => __( 'Up', 'megamenu' ), |
|
| 836 | + 'title' => __('Up', 'megamenu'), |
|
| 837 | 837 | 'type' => 'arrow', |
| 838 | 838 | 'key' => 'arrow_up', |
| 839 | 839 | ), |
| 840 | 840 | array( |
| 841 | - 'title' => __( 'Down', 'megamenu' ), |
|
| 841 | + 'title' => __('Down', 'megamenu'), |
|
| 842 | 842 | 'type' => 'arrow', |
| 843 | 843 | 'key' => 'arrow_down', |
| 844 | 844 | ), |
| 845 | 845 | array( |
| 846 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 846 | + 'title' => __('Left', 'megamenu'), |
|
| 847 | 847 | 'type' => 'arrow', |
| 848 | 848 | 'key' => 'arrow_left', |
| 849 | 849 | ), |
| 850 | 850 | array( |
| 851 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 851 | + 'title' => __('Right', 'megamenu'), |
|
| 852 | 852 | 'type' => 'arrow', |
| 853 | 853 | 'key' => 'arrow_right', |
| 854 | 854 | ), |
@@ -856,8 +856,8 @@ discard block |
||
| 856 | 856 | ), |
| 857 | 857 | 'line_height' => array( |
| 858 | 858 | 'priority' => 30, |
| 859 | - 'title' => __( 'Line Height', 'megamenu' ), |
|
| 860 | - 'description' => __( 'Set the general line height to use in the sub menu contents.', 'megamenu' ), |
|
| 859 | + 'title' => __('Line Height', 'megamenu'), |
|
| 860 | + 'description' => __('Set the general line height to use in the sub menu contents.', 'megamenu'), |
|
| 861 | 861 | 'settings' => array( |
| 862 | 862 | array( |
| 863 | 863 | 'title' => '', |
@@ -868,8 +868,8 @@ discard block |
||
| 868 | 868 | ), |
| 869 | 869 | 'z_index' => array( |
| 870 | 870 | 'priority' => 40, |
| 871 | - 'title' => __( 'Z Index', 'megamenu' ), |
|
| 872 | - 'description' => __( 'Set the z-index to ensure the sub menus appear ontop of other content.', 'megamenu' ), |
|
| 871 | + 'title' => __('Z Index', 'megamenu'), |
|
| 872 | + 'description' => __('Set the z-index to ensure the sub menus appear ontop of other content.', 'megamenu'), |
|
| 873 | 873 | 'settings' => array( |
| 874 | 874 | array( |
| 875 | 875 | 'title' => '', |
@@ -881,40 +881,40 @@ discard block |
||
| 881 | 881 | ), |
| 882 | 882 | 'shadow' => array( |
| 883 | 883 | 'priority' => 50, |
| 884 | - 'title' => __( 'Shadow', 'megamenu' ), |
|
| 885 | - 'description' => __( 'Apply a shadow to mega and flyout menus.', 'megamenu' ), |
|
| 884 | + 'title' => __('Shadow', 'megamenu'), |
|
| 885 | + 'description' => __('Apply a shadow to mega and flyout menus.', 'megamenu'), |
|
| 886 | 886 | 'settings' => array( |
| 887 | 887 | array( |
| 888 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 888 | + 'title' => __('Enabled', 'megamenu'), |
|
| 889 | 889 | 'type' => 'checkbox', |
| 890 | 890 | 'key' => 'shadow', |
| 891 | 891 | ), |
| 892 | 892 | array( |
| 893 | - 'title' => __( 'Horizontal', 'megamenu' ), |
|
| 893 | + 'title' => __('Horizontal', 'megamenu'), |
|
| 894 | 894 | 'type' => 'freetext', |
| 895 | 895 | 'key' => 'shadow_horizontal', |
| 896 | 896 | 'validation' => 'px', |
| 897 | 897 | ), |
| 898 | 898 | array( |
| 899 | - 'title' => __( 'Vertical', 'megamenu' ), |
|
| 899 | + 'title' => __('Vertical', 'megamenu'), |
|
| 900 | 900 | 'type' => 'freetext', |
| 901 | 901 | 'key' => 'shadow_vertical', |
| 902 | 902 | 'validation' => 'px', |
| 903 | 903 | ), |
| 904 | 904 | array( |
| 905 | - 'title' => __( 'Blur', 'megamenu' ), |
|
| 905 | + 'title' => __('Blur', 'megamenu'), |
|
| 906 | 906 | 'type' => 'freetext', |
| 907 | 907 | 'key' => 'shadow_blur', |
| 908 | 908 | 'validation' => 'px', |
| 909 | 909 | ), |
| 910 | 910 | array( |
| 911 | - 'title' => __( 'Spread', 'megamenu' ), |
|
| 911 | + 'title' => __('Spread', 'megamenu'), |
|
| 912 | 912 | 'type' => 'freetext', |
| 913 | 913 | 'key' => 'shadow_spread', |
| 914 | 914 | 'validation' => 'px', |
| 915 | 915 | ), |
| 916 | 916 | array( |
| 917 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 917 | + 'title' => __('Color', 'megamenu'), |
|
| 918 | 918 | 'type' => 'color', |
| 919 | 919 | 'key' => 'shadow_color', |
| 920 | 920 | ), |
@@ -922,11 +922,11 @@ discard block |
||
| 922 | 922 | ), |
| 923 | 923 | 'transitions' => array( |
| 924 | 924 | 'priority' => 60, |
| 925 | - 'title' => __( 'Hover Transitions', 'megamenu' ), |
|
| 926 | - 'description' => __( 'Apply hover transitions to menu items. Note: Transitions will not apply to gradient backgrounds.', 'megamenu' ), |
|
| 925 | + 'title' => __('Hover Transitions', 'megamenu'), |
|
| 926 | + 'description' => __('Apply hover transitions to menu items. Note: Transitions will not apply to gradient backgrounds.', 'megamenu'), |
|
| 927 | 927 | 'settings' => array( |
| 928 | 928 | array( |
| 929 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 929 | + 'title' => __('Enabled', 'megamenu'), |
|
| 930 | 930 | 'type' => 'checkbox', |
| 931 | 931 | 'key' => 'transitions', |
| 932 | 932 | ), |
@@ -934,11 +934,11 @@ discard block |
||
| 934 | 934 | ), |
| 935 | 935 | 'resets' => array( |
| 936 | 936 | 'priority' => 70, |
| 937 | - 'title' => __( 'Reset Widget Styling', 'megamenu' ), |
|
| 938 | - 'description' => __( 'Caution: Reset the styling of widgets within the mega menu? This may break the styling of widgets that you have added to your sub menus. Default: Disabled.', 'megamenu' ), |
|
| 937 | + 'title' => __('Reset Widget Styling', 'megamenu'), |
|
| 938 | + 'description' => __('Caution: Reset the styling of widgets within the mega menu? This may break the styling of widgets that you have added to your sub menus. Default: Disabled.', 'megamenu'), |
|
| 939 | 939 | 'settings' => array( |
| 940 | 940 | array( |
| 941 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 941 | + 'title' => __('Enabled', 'megamenu'), |
|
| 942 | 942 | 'type' => 'checkbox', |
| 943 | 943 | 'key' => 'resets', |
| 944 | 944 | ), |
@@ -947,12 +947,12 @@ discard block |
||
| 947 | 947 | ), |
| 948 | 948 | ), |
| 949 | 949 | 'menu_bar' => array( |
| 950 | - 'title' => __( 'Menu Bar', 'megamenu' ), |
|
| 950 | + 'title' => __('Menu Bar', 'megamenu'), |
|
| 951 | 951 | 'settings' => array( |
| 952 | 952 | 'menu_item_height' => array( |
| 953 | 953 | 'priority' => 05, |
| 954 | - 'title' => __( 'Menu Height', 'megamenu' ), |
|
| 955 | - 'description' => __( 'Define the height of each top level menu item link. This value plus the Menu Padding (top and bottom) settings define the overall height of the menu bar.', 'megamenu' ), |
|
| 954 | + 'title' => __('Menu Height', 'megamenu'), |
|
| 955 | + 'description' => __('Define the height of each top level menu item link. This value plus the Menu Padding (top and bottom) settings define the overall height of the menu bar.', 'megamenu'), |
|
| 956 | 956 | 'settings' => array( |
| 957 | 957 | array( |
| 958 | 958 | 'title' => '', |
@@ -964,21 +964,21 @@ discard block |
||
| 964 | 964 | ), |
| 965 | 965 | 'menu_background' => array( |
| 966 | 966 | 'priority' => 10, |
| 967 | - 'title' => __( 'Menu Background', 'megamenu' ), |
|
| 968 | - 'description' => __( "The background color for the main menu bar. Set each value to transparent for a 'button' style menu.", 'megamenu' ), |
|
| 967 | + 'title' => __('Menu Background', 'megamenu'), |
|
| 968 | + 'description' => __("The background color for the main menu bar. Set each value to transparent for a 'button' style menu.", 'megamenu'), |
|
| 969 | 969 | 'settings' => array( |
| 970 | 970 | array( |
| 971 | - 'title' => __( 'From', 'megamenu' ), |
|
| 971 | + 'title' => __('From', 'megamenu'), |
|
| 972 | 972 | 'type' => 'color', |
| 973 | 973 | 'key' => 'container_background_from', |
| 974 | 974 | ), |
| 975 | 975 | array( |
| 976 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 976 | + 'title' => __('Copy', 'megamenu'), |
|
| 977 | 977 | 'type' => 'copy_color', |
| 978 | 978 | 'key' => 'copy_color', |
| 979 | 979 | ), |
| 980 | 980 | array( |
| 981 | - 'title' => __( 'To', 'megamenu' ), |
|
| 981 | + 'title' => __('To', 'megamenu'), |
|
| 982 | 982 | 'type' => 'color', |
| 983 | 983 | 'key' => 'container_background_to', |
| 984 | 984 | ), |
@@ -986,29 +986,29 @@ discard block |
||
| 986 | 986 | ), |
| 987 | 987 | 'menu_padding' => array( |
| 988 | 988 | 'priority' => 20, |
| 989 | - 'title' => __( 'Menu Padding', 'megamenu' ), |
|
| 990 | - 'description' => __( 'Padding for the main menu bar.', 'megamenu' ), |
|
| 989 | + 'title' => __('Menu Padding', 'megamenu'), |
|
| 990 | + 'description' => __('Padding for the main menu bar.', 'megamenu'), |
|
| 991 | 991 | 'settings' => array( |
| 992 | 992 | array( |
| 993 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 993 | + 'title' => __('Top', 'megamenu'), |
|
| 994 | 994 | 'type' => 'freetext', |
| 995 | 995 | 'key' => 'container_padding_top', |
| 996 | 996 | 'validation' => 'px', |
| 997 | 997 | ), |
| 998 | 998 | array( |
| 999 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 999 | + 'title' => __('Right', 'megamenu'), |
|
| 1000 | 1000 | 'type' => 'freetext', |
| 1001 | 1001 | 'key' => 'container_padding_right', |
| 1002 | 1002 | 'validation' => 'px', |
| 1003 | 1003 | ), |
| 1004 | 1004 | array( |
| 1005 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1005 | + 'title' => __('Bottom', 'megamenu'), |
|
| 1006 | 1006 | 'type' => 'freetext', |
| 1007 | 1007 | 'key' => 'container_padding_bottom', |
| 1008 | 1008 | 'validation' => 'px', |
| 1009 | 1009 | ), |
| 1010 | 1010 | array( |
| 1011 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1011 | + 'title' => __('Left', 'megamenu'), |
|
| 1012 | 1012 | 'type' => 'freetext', |
| 1013 | 1013 | 'key' => 'container_padding_left', |
| 1014 | 1014 | 'validation' => 'px', |
@@ -1017,29 +1017,29 @@ discard block |
||
| 1017 | 1017 | ), |
| 1018 | 1018 | 'menu_border_radius' => array( |
| 1019 | 1019 | 'priority' => 30, |
| 1020 | - 'title' => __( 'Menu Border Radius', 'megamenu' ), |
|
| 1021 | - 'description' => __( 'Set a border radius on the main menu bar.', 'megamenu' ), |
|
| 1020 | + 'title' => __('Menu Border Radius', 'megamenu'), |
|
| 1021 | + 'description' => __('Set a border radius on the main menu bar.', 'megamenu'), |
|
| 1022 | 1022 | 'settings' => array( |
| 1023 | 1023 | array( |
| 1024 | - 'title' => __( 'Top Left', 'megamenu' ), |
|
| 1024 | + 'title' => __('Top Left', 'megamenu'), |
|
| 1025 | 1025 | 'type' => 'freetext', |
| 1026 | 1026 | 'key' => 'container_border_radius_top_left', |
| 1027 | 1027 | 'validation' => 'px', |
| 1028 | 1028 | ), |
| 1029 | 1029 | array( |
| 1030 | - 'title' => __( 'Top Right', 'megamenu' ), |
|
| 1030 | + 'title' => __('Top Right', 'megamenu'), |
|
| 1031 | 1031 | 'type' => 'freetext', |
| 1032 | 1032 | 'key' => 'container_border_radius_top_right', |
| 1033 | 1033 | 'validation' => 'px', |
| 1034 | 1034 | ), |
| 1035 | 1035 | array( |
| 1036 | - 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 1036 | + 'title' => __('Bottom Right', 'megamenu'), |
|
| 1037 | 1037 | 'type' => 'freetext', |
| 1038 | 1038 | 'key' => 'container_border_radius_bottom_right', |
| 1039 | 1039 | 'validation' => 'px', |
| 1040 | 1040 | ), |
| 1041 | 1041 | array( |
| 1042 | - 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 1042 | + 'title' => __('Bottom Left', 'megamenu'), |
|
| 1043 | 1043 | 'type' => 'freetext', |
| 1044 | 1044 | 'key' => 'container_border_radius_bottom_left', |
| 1045 | 1045 | 'validation' => 'px', |
@@ -1048,14 +1048,14 @@ discard block |
||
| 1048 | 1048 | ), |
| 1049 | 1049 | 'top_level_menu_items' => array( |
| 1050 | 1050 | 'priority' => 50, |
| 1051 | - 'title' => __( 'Top Level Menu Items', 'megamenu' ), |
|
| 1051 | + 'title' => __('Top Level Menu Items', 'megamenu'), |
|
| 1052 | 1052 | 'description' => '', |
| 1053 | 1053 | ), |
| 1054 | 1054 | 'menu_item_align' => array( |
| 1055 | 1055 | 'priority' => 55, |
| 1056 | - 'title' => __( 'Menu Items Align', 'megamenu' ), |
|
| 1057 | - 'description' => __( 'Align <i>all</i> menu items to the left (default), centrally or to the right.', 'megamenu' ), |
|
| 1058 | - 'info' => array( __( "This option will apply to all menu items. To align an individual menu item to the right, edit the menu item itself and set 'Menu Item Align' to 'Right'.", 'megamenu' ) ), |
|
| 1056 | + 'title' => __('Menu Items Align', 'megamenu'), |
|
| 1057 | + 'description' => __('Align <i>all</i> menu items to the left (default), centrally or to the right.', 'megamenu'), |
|
| 1058 | + 'info' => array(__("This option will apply to all menu items. To align an individual menu item to the right, edit the menu item itself and set 'Menu Item Align' to 'Right'.", 'megamenu')), |
|
| 1059 | 1059 | 'settings' => array( |
| 1060 | 1060 | array( |
| 1061 | 1061 | 'title' => '', |
@@ -1066,42 +1066,42 @@ discard block |
||
| 1066 | 1066 | ), |
| 1067 | 1067 | 'menu_item_font' => array( |
| 1068 | 1068 | 'priority' => 60, |
| 1069 | - 'title' => __( 'Item Font', 'megamenu' ), |
|
| 1070 | - 'description' => __( 'The font to use for each top level menu item.', 'megamenu' ), |
|
| 1069 | + 'title' => __('Item Font', 'megamenu'), |
|
| 1070 | + 'description' => __('The font to use for each top level menu item.', 'megamenu'), |
|
| 1071 | 1071 | 'settings' => array( |
| 1072 | 1072 | array( |
| 1073 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1073 | + 'title' => __('Color', 'megamenu'), |
|
| 1074 | 1074 | 'type' => 'color', |
| 1075 | 1075 | 'key' => 'menu_item_link_color', |
| 1076 | 1076 | ), |
| 1077 | 1077 | array( |
| 1078 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 1078 | + 'title' => __('Size', 'megamenu'), |
|
| 1079 | 1079 | 'type' => 'freetext', |
| 1080 | 1080 | 'key' => 'menu_item_link_font_size', |
| 1081 | 1081 | 'validation' => 'px', |
| 1082 | 1082 | ), |
| 1083 | 1083 | array( |
| 1084 | - 'title' => __( 'Family', 'megamenu' ), |
|
| 1084 | + 'title' => __('Family', 'megamenu'), |
|
| 1085 | 1085 | 'type' => 'font', |
| 1086 | 1086 | 'key' => 'menu_item_link_font', |
| 1087 | 1087 | ), |
| 1088 | 1088 | array( |
| 1089 | - 'title' => __( 'Transform', 'megamenu' ), |
|
| 1089 | + 'title' => __('Transform', 'megamenu'), |
|
| 1090 | 1090 | 'type' => 'transform', |
| 1091 | 1091 | 'key' => 'menu_item_link_text_transform', |
| 1092 | 1092 | ), |
| 1093 | 1093 | array( |
| 1094 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1094 | + 'title' => __('Weight', 'megamenu'), |
|
| 1095 | 1095 | 'type' => 'weight', |
| 1096 | 1096 | 'key' => 'menu_item_link_weight', |
| 1097 | 1097 | ), |
| 1098 | 1098 | array( |
| 1099 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1099 | + 'title' => __('Decoration', 'megamenu'), |
|
| 1100 | 1100 | 'type' => 'decoration', |
| 1101 | 1101 | 'key' => 'menu_item_link_text_decoration', |
| 1102 | 1102 | ), |
| 1103 | 1103 | array( |
| 1104 | - 'title' => __( 'Align', 'megamenu' ), |
|
| 1104 | + 'title' => __('Align', 'megamenu'), |
|
| 1105 | 1105 | 'type' => 'align', |
| 1106 | 1106 | 'key' => 'menu_item_link_text_align', |
| 1107 | 1107 | ), |
@@ -1109,21 +1109,21 @@ discard block |
||
| 1109 | 1109 | ), |
| 1110 | 1110 | 'menu_item_font_hover' => array( |
| 1111 | 1111 | 'priority' => 65, |
| 1112 | - 'title' => __( 'Item Font (Hover)', 'megamenu' ), |
|
| 1113 | - 'description' => __( 'Set the font to use for each top level menu item (on hover).', 'megamenu' ), |
|
| 1112 | + 'title' => __('Item Font (Hover)', 'megamenu'), |
|
| 1113 | + 'description' => __('Set the font to use for each top level menu item (on hover).', 'megamenu'), |
|
| 1114 | 1114 | 'settings' => array( |
| 1115 | 1115 | array( |
| 1116 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1116 | + 'title' => __('Color', 'megamenu'), |
|
| 1117 | 1117 | 'type' => 'color', |
| 1118 | 1118 | 'key' => 'menu_item_link_color_hover', |
| 1119 | 1119 | ), |
| 1120 | 1120 | array( |
| 1121 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1121 | + 'title' => __('Weight', 'megamenu'), |
|
| 1122 | 1122 | 'type' => 'weight', |
| 1123 | 1123 | 'key' => 'menu_item_link_weight_hover', |
| 1124 | 1124 | ), |
| 1125 | 1125 | array( |
| 1126 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1126 | + 'title' => __('Decoration', 'megamenu'), |
|
| 1127 | 1127 | 'type' => 'decoration', |
| 1128 | 1128 | 'key' => 'menu_item_link_text_decoration_hover', |
| 1129 | 1129 | ), |
@@ -1131,21 +1131,21 @@ discard block |
||
| 1131 | 1131 | ), |
| 1132 | 1132 | 'menu_item_background' => array( |
| 1133 | 1133 | 'priority' => 70, |
| 1134 | - 'title' => __( 'Item Background', 'megamenu' ), |
|
| 1135 | - 'description' => __( "The background color for each top level menu item. Tip: Set these values to transparent if you've already set a background color on the menu bar.", 'megamenu' ), |
|
| 1134 | + 'title' => __('Item Background', 'megamenu'), |
|
| 1135 | + 'description' => __("The background color for each top level menu item. Tip: Set these values to transparent if you've already set a background color on the menu bar.", 'megamenu'), |
|
| 1136 | 1136 | 'settings' => array( |
| 1137 | 1137 | array( |
| 1138 | - 'title' => __( 'From', 'megamenu' ), |
|
| 1138 | + 'title' => __('From', 'megamenu'), |
|
| 1139 | 1139 | 'type' => 'color', |
| 1140 | 1140 | 'key' => 'menu_item_background_from', |
| 1141 | 1141 | ), |
| 1142 | 1142 | array( |
| 1143 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 1143 | + 'title' => __('Copy', 'megamenu'), |
|
| 1144 | 1144 | 'type' => 'copy_color', |
| 1145 | 1145 | 'key' => 'copy_color', |
| 1146 | 1146 | ), |
| 1147 | 1147 | array( |
| 1148 | - 'title' => __( 'To', 'megamenu' ), |
|
| 1148 | + 'title' => __('To', 'megamenu'), |
|
| 1149 | 1149 | 'type' => 'color', |
| 1150 | 1150 | 'key' => 'menu_item_background_to', |
| 1151 | 1151 | ), |
@@ -1153,21 +1153,21 @@ discard block |
||
| 1153 | 1153 | ), |
| 1154 | 1154 | 'menu_item_background_hover' => array( |
| 1155 | 1155 | 'priority' => 75, |
| 1156 | - 'title' => __( 'Item Background (Hover)', 'megamenu' ), |
|
| 1157 | - 'description' => __( 'The background color for a top level menu item (on hover).', 'megamenu' ), |
|
| 1156 | + 'title' => __('Item Background (Hover)', 'megamenu'), |
|
| 1157 | + 'description' => __('The background color for a top level menu item (on hover).', 'megamenu'), |
|
| 1158 | 1158 | 'settings' => array( |
| 1159 | 1159 | array( |
| 1160 | - 'title' => __( 'From', 'megamenu' ), |
|
| 1160 | + 'title' => __('From', 'megamenu'), |
|
| 1161 | 1161 | 'type' => 'color', |
| 1162 | 1162 | 'key' => 'menu_item_background_hover_from', |
| 1163 | 1163 | ), |
| 1164 | 1164 | array( |
| 1165 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 1165 | + 'title' => __('Copy', 'megamenu'), |
|
| 1166 | 1166 | 'type' => 'copy_color', |
| 1167 | 1167 | 'key' => 'copy_color', |
| 1168 | 1168 | ), |
| 1169 | 1169 | array( |
| 1170 | - 'title' => __( 'To', 'megamenu' ), |
|
| 1170 | + 'title' => __('To', 'megamenu'), |
|
| 1171 | 1171 | 'type' => 'color', |
| 1172 | 1172 | 'key' => 'menu_item_background_hover_to', |
| 1173 | 1173 | ), |
@@ -1175,8 +1175,8 @@ discard block |
||
| 1175 | 1175 | ), |
| 1176 | 1176 | 'menu_item_spacing' => array( |
| 1177 | 1177 | 'priority' => 80, |
| 1178 | - 'title' => __( 'Item Spacing', 'megamenu' ), |
|
| 1179 | - 'description' => __( 'Define the size of the gap between each top level menu item.', 'megamenu' ), |
|
| 1178 | + 'title' => __('Item Spacing', 'megamenu'), |
|
| 1179 | + 'description' => __('Define the size of the gap between each top level menu item.', 'megamenu'), |
|
| 1180 | 1180 | 'settings' => array( |
| 1181 | 1181 | array( |
| 1182 | 1182 | 'title' => '', |
@@ -1189,30 +1189,30 @@ discard block |
||
| 1189 | 1189 | |
| 1190 | 1190 | 'menu_item_padding' => array( |
| 1191 | 1191 | 'priority' => 85, |
| 1192 | - 'title' => __( 'Item Padding', 'megamenu' ), |
|
| 1193 | - 'description' => __( 'Set the padding for each top level menu item.', 'megamenu' ), |
|
| 1194 | - 'info' => array( __( "Generally we advise against using the Top and Bottom options here. Use the 'Menu Height' setting to determine the height of your top level menu items.", 'megamenu' ) ), |
|
| 1192 | + 'title' => __('Item Padding', 'megamenu'), |
|
| 1193 | + 'description' => __('Set the padding for each top level menu item.', 'megamenu'), |
|
| 1194 | + 'info' => array(__("Generally we advise against using the Top and Bottom options here. Use the 'Menu Height' setting to determine the height of your top level menu items.", 'megamenu')), |
|
| 1195 | 1195 | 'settings' => array( |
| 1196 | 1196 | array( |
| 1197 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1197 | + 'title' => __('Top', 'megamenu'), |
|
| 1198 | 1198 | 'type' => 'freetext', |
| 1199 | 1199 | 'key' => 'menu_item_link_padding_top', |
| 1200 | 1200 | 'validation' => 'px', |
| 1201 | 1201 | ), |
| 1202 | 1202 | array( |
| 1203 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1203 | + 'title' => __('Right', 'megamenu'), |
|
| 1204 | 1204 | 'type' => 'freetext', |
| 1205 | 1205 | 'key' => 'menu_item_link_padding_right', |
| 1206 | 1206 | 'validation' => 'px', |
| 1207 | 1207 | ), |
| 1208 | 1208 | array( |
| 1209 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1209 | + 'title' => __('Bottom', 'megamenu'), |
|
| 1210 | 1210 | 'type' => 'freetext', |
| 1211 | 1211 | 'key' => 'menu_item_link_padding_bottom', |
| 1212 | 1212 | 'validation' => 'px', |
| 1213 | 1213 | ), |
| 1214 | 1214 | array( |
| 1215 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1215 | + 'title' => __('Left', 'megamenu'), |
|
| 1216 | 1216 | 'type' => 'freetext', |
| 1217 | 1217 | 'key' => 'menu_item_link_padding_left', |
| 1218 | 1218 | 'validation' => 'px', |
@@ -1221,39 +1221,39 @@ discard block |
||
| 1221 | 1221 | ), |
| 1222 | 1222 | 'menu_item_border' => array( |
| 1223 | 1223 | 'priority' => 90, |
| 1224 | - 'title' => __( 'Item Border', 'megamenu' ), |
|
| 1225 | - 'description' => __( 'Set the border to display on each top level menu item.', 'megamenu' ), |
|
| 1224 | + 'title' => __('Item Border', 'megamenu'), |
|
| 1225 | + 'description' => __('Set the border to display on each top level menu item.', 'megamenu'), |
|
| 1226 | 1226 | 'settings' => array( |
| 1227 | 1227 | array( |
| 1228 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1228 | + 'title' => __('Color', 'megamenu'), |
|
| 1229 | 1229 | 'type' => 'color', |
| 1230 | 1230 | 'key' => 'menu_item_border_color', |
| 1231 | 1231 | ), |
| 1232 | 1232 | array( |
| 1233 | - 'title' => __( 'Color (Hover)', 'megamenu' ), |
|
| 1233 | + 'title' => __('Color (Hover)', 'megamenu'), |
|
| 1234 | 1234 | 'type' => 'color', |
| 1235 | 1235 | 'key' => 'menu_item_border_color_hover', |
| 1236 | 1236 | ), |
| 1237 | 1237 | array( |
| 1238 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1238 | + 'title' => __('Top', 'megamenu'), |
|
| 1239 | 1239 | 'type' => 'freetext', |
| 1240 | 1240 | 'key' => 'menu_item_border_top', |
| 1241 | 1241 | 'validation' => 'px', |
| 1242 | 1242 | ), |
| 1243 | 1243 | array( |
| 1244 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1244 | + 'title' => __('Right', 'megamenu'), |
|
| 1245 | 1245 | 'type' => 'freetext', |
| 1246 | 1246 | 'key' => 'menu_item_border_right', |
| 1247 | 1247 | 'validation' => 'px', |
| 1248 | 1248 | ), |
| 1249 | 1249 | array( |
| 1250 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1250 | + 'title' => __('Bottom', 'megamenu'), |
|
| 1251 | 1251 | 'type' => 'freetext', |
| 1252 | 1252 | 'key' => 'menu_item_border_bottom', |
| 1253 | 1253 | 'validation' => 'px', |
| 1254 | 1254 | ), |
| 1255 | 1255 | array( |
| 1256 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1256 | + 'title' => __('Left', 'megamenu'), |
|
| 1257 | 1257 | 'type' => 'freetext', |
| 1258 | 1258 | 'key' => 'menu_item_border_left', |
| 1259 | 1259 | 'validation' => 'px', |
@@ -1262,29 +1262,29 @@ discard block |
||
| 1262 | 1262 | ), |
| 1263 | 1263 | 'menu_item_border_radius' => array( |
| 1264 | 1264 | 'priority' => 95, |
| 1265 | - 'title' => __( 'Item Border Radius', 'megamenu' ), |
|
| 1266 | - 'description' => __( 'Set rounded corners for each top level menu item.', 'megamenu' ), |
|
| 1265 | + 'title' => __('Item Border Radius', 'megamenu'), |
|
| 1266 | + 'description' => __('Set rounded corners for each top level menu item.', 'megamenu'), |
|
| 1267 | 1267 | 'settings' => array( |
| 1268 | 1268 | array( |
| 1269 | - 'title' => __( 'Top Left', 'megamenu' ), |
|
| 1269 | + 'title' => __('Top Left', 'megamenu'), |
|
| 1270 | 1270 | 'type' => 'freetext', |
| 1271 | 1271 | 'key' => 'menu_item_link_border_radius_top_left', |
| 1272 | 1272 | 'validation' => 'px', |
| 1273 | 1273 | ), |
| 1274 | 1274 | array( |
| 1275 | - 'title' => __( 'Top Right', 'megamenu' ), |
|
| 1275 | + 'title' => __('Top Right', 'megamenu'), |
|
| 1276 | 1276 | 'type' => 'freetext', |
| 1277 | 1277 | 'key' => 'menu_item_link_border_radius_top_right', |
| 1278 | 1278 | 'validation' => 'px', |
| 1279 | 1279 | ), |
| 1280 | 1280 | array( |
| 1281 | - 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 1281 | + 'title' => __('Bottom Right', 'megamenu'), |
|
| 1282 | 1282 | 'type' => 'freetext', |
| 1283 | 1283 | 'key' => 'menu_item_link_border_radius_bottom_right', |
| 1284 | 1284 | 'validation' => 'px', |
| 1285 | 1285 | ), |
| 1286 | 1286 | array( |
| 1287 | - 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 1287 | + 'title' => __('Bottom Left', 'megamenu'), |
|
| 1288 | 1288 | 'type' => 'freetext', |
| 1289 | 1289 | 'key' => 'menu_item_link_border_radius_bottom_left', |
| 1290 | 1290 | 'validation' => 'px', |
@@ -1293,21 +1293,21 @@ discard block |
||
| 1293 | 1293 | ), |
| 1294 | 1294 | 'menu_item_divider' => array( |
| 1295 | 1295 | 'priority' => 160, |
| 1296 | - 'title' => __( 'Item Divider', 'megamenu' ), |
|
| 1297 | - 'description' => __( 'Show a small divider bar between each menu item.', 'megamenu' ), |
|
| 1296 | + 'title' => __('Item Divider', 'megamenu'), |
|
| 1297 | + 'description' => __('Show a small divider bar between each menu item.', 'megamenu'), |
|
| 1298 | 1298 | 'settings' => array( |
| 1299 | 1299 | array( |
| 1300 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 1300 | + 'title' => __('Enabled', 'megamenu'), |
|
| 1301 | 1301 | 'type' => 'checkbox', |
| 1302 | 1302 | 'key' => 'menu_item_divider', |
| 1303 | 1303 | ), |
| 1304 | 1304 | array( |
| 1305 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1305 | + 'title' => __('Color', 'megamenu'), |
|
| 1306 | 1306 | 'type' => 'color', |
| 1307 | 1307 | 'key' => 'menu_item_divider_color', |
| 1308 | 1308 | ), |
| 1309 | 1309 | array( |
| 1310 | - 'title' => __( 'Glow Opacity', 'megamenu' ), |
|
| 1310 | + 'title' => __('Glow Opacity', 'megamenu'), |
|
| 1311 | 1311 | 'type' => 'freetext', |
| 1312 | 1312 | 'key' => 'menu_item_divider_glow_opacity', |
| 1313 | 1313 | 'validation' => 'float', |
@@ -1316,41 +1316,41 @@ discard block |
||
| 1316 | 1316 | ), |
| 1317 | 1317 | 'menu_item_highlight' => array( |
| 1318 | 1318 | 'priority' => 170, |
| 1319 | - 'title' => __( 'Highlight Current Item', 'megamenu' ), |
|
| 1320 | - 'description' => __( "Apply the 'hover' styling to current menu items. Applies to top level menu items only.", 'megamenu' ), |
|
| 1319 | + 'title' => __('Highlight Current Item', 'megamenu'), |
|
| 1320 | + 'description' => __("Apply the 'hover' styling to current menu items. Applies to top level menu items only.", 'megamenu'), |
|
| 1321 | 1321 | 'settings' => array( |
| 1322 | 1322 | array( |
| 1323 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 1323 | + 'title' => __('Enabled', 'megamenu'), |
|
| 1324 | 1324 | 'type' => 'checkbox', |
| 1325 | 1325 | 'key' => 'menu_item_highlight_current', |
| 1326 | 1326 | ), |
| 1327 | 1327 | ), |
| 1328 | 1328 | 'info' => array( |
| 1329 | - "<a href='https://www.megamenu.com/documentation/highlight-active-menu-items/' target='blank'>" . __( 'Documentation: Highlighting Menu Items', 'megamenu' ) . '</a>', |
|
| 1329 | + "<a href='https://www.megamenu.com/documentation/highlight-active-menu-items/' target='blank'>" . __('Documentation: Highlighting Menu Items', 'megamenu') . '</a>', |
|
| 1330 | 1330 | ), |
| 1331 | 1331 | ), |
| 1332 | 1332 | ), |
| 1333 | 1333 | ), |
| 1334 | 1334 | 'mega_panels' => array( |
| 1335 | - 'title' => __( 'Mega Menus', 'megamenu' ), |
|
| 1335 | + 'title' => __('Mega Menus', 'megamenu'), |
|
| 1336 | 1336 | 'settings' => array( |
| 1337 | 1337 | 'panel_background' => array( |
| 1338 | 1338 | 'priority' => 10, |
| 1339 | - 'title' => __( 'Panel Background', 'megamenu' ), |
|
| 1340 | - 'description' => __( 'Set a background color for a whole sub menu.', 'megamenu' ), |
|
| 1339 | + 'title' => __('Panel Background', 'megamenu'), |
|
| 1340 | + 'description' => __('Set a background color for a whole sub menu.', 'megamenu'), |
|
| 1341 | 1341 | 'settings' => array( |
| 1342 | 1342 | array( |
| 1343 | - 'title' => __( 'From', 'megamenu' ), |
|
| 1343 | + 'title' => __('From', 'megamenu'), |
|
| 1344 | 1344 | 'type' => 'color', |
| 1345 | 1345 | 'key' => 'panel_background_from', |
| 1346 | 1346 | ), |
| 1347 | 1347 | array( |
| 1348 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 1348 | + 'title' => __('Copy', 'megamenu'), |
|
| 1349 | 1349 | 'type' => 'copy_color', |
| 1350 | 1350 | 'key' => 'copy_color', |
| 1351 | 1351 | ), |
| 1352 | 1352 | array( |
| 1353 | - 'title' => __( 'To', 'megamenu' ), |
|
| 1353 | + 'title' => __('To', 'megamenu'), |
|
| 1354 | 1354 | 'type' => 'color', |
| 1355 | 1355 | 'key' => 'panel_background_to', |
| 1356 | 1356 | ), |
@@ -1358,21 +1358,21 @@ discard block |
||
| 1358 | 1358 | ), |
| 1359 | 1359 | 'panel_width' => array( |
| 1360 | 1360 | 'priority' => 20, |
| 1361 | - 'title' => __( 'Panel Width', 'megamenu' ), |
|
| 1362 | - 'description' => __( 'Mega Panel width.', 'megamenu' ), |
|
| 1361 | + 'title' => __('Panel Width', 'megamenu'), |
|
| 1362 | + 'description' => __('Mega Panel width.', 'megamenu'), |
|
| 1363 | 1363 | 'info' => array( |
| 1364 | - __( 'A 100% wide panel will only ever be as wide as the menu itself. For a fixed sub menu width set this to a pixel value.', 'megamenu' ), |
|
| 1365 | - __( 'Advanced: Enter a jQuery selector to synchronize the width and position of the sub menu with existing page element (e.g. body, #container, .page).', 'megamenu' ), |
|
| 1366 | - "<a href='https://www.megamenu.com/documentation/adjust-sub-menu-width/' target='blank'>" . __( 'Documentation: Configuring the sub menu width', 'megamenu' ) . '</a>', |
|
| 1364 | + __('A 100% wide panel will only ever be as wide as the menu itself. For a fixed sub menu width set this to a pixel value.', 'megamenu'), |
|
| 1365 | + __('Advanced: Enter a jQuery selector to synchronize the width and position of the sub menu with existing page element (e.g. body, #container, .page).', 'megamenu'), |
|
| 1366 | + "<a href='https://www.megamenu.com/documentation/adjust-sub-menu-width/' target='blank'>" . __('Documentation: Configuring the sub menu width', 'megamenu') . '</a>', |
|
| 1367 | 1367 | ), |
| 1368 | 1368 | 'settings' => array( |
| 1369 | 1369 | array( |
| 1370 | - 'title' => __( 'Outer Width', 'megamenu' ), |
|
| 1370 | + 'title' => __('Outer Width', 'megamenu'), |
|
| 1371 | 1371 | 'type' => 'freetext', |
| 1372 | 1372 | 'key' => 'panel_width', |
| 1373 | 1373 | ), |
| 1374 | 1374 | array( |
| 1375 | - 'title' => __( 'Inner Width', 'megamenu' ), |
|
| 1375 | + 'title' => __('Inner Width', 'megamenu'), |
|
| 1376 | 1376 | 'type' => 'freetext', |
| 1377 | 1377 | 'key' => 'panel_inner_width', |
| 1378 | 1378 | ), |
@@ -1380,29 +1380,29 @@ discard block |
||
| 1380 | 1380 | ), |
| 1381 | 1381 | 'panel_padding' => array( |
| 1382 | 1382 | 'priority' => 30, |
| 1383 | - 'title' => __( 'Panel Padding', 'megamenu' ), |
|
| 1384 | - 'description' => __( 'Set the padding for the whole sub menu. Set these values 0px if you wish your sub menu content to go edge-to-edge.', 'megamenu' ), |
|
| 1383 | + 'title' => __('Panel Padding', 'megamenu'), |
|
| 1384 | + 'description' => __('Set the padding for the whole sub menu. Set these values 0px if you wish your sub menu content to go edge-to-edge.', 'megamenu'), |
|
| 1385 | 1385 | 'settings' => array( |
| 1386 | 1386 | array( |
| 1387 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1387 | + 'title' => __('Top', 'megamenu'), |
|
| 1388 | 1388 | 'type' => 'freetext', |
| 1389 | 1389 | 'key' => 'panel_padding_top', |
| 1390 | 1390 | 'validation' => 'px', |
| 1391 | 1391 | ), |
| 1392 | 1392 | array( |
| 1393 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1393 | + 'title' => __('Right', 'megamenu'), |
|
| 1394 | 1394 | 'type' => 'freetext', |
| 1395 | 1395 | 'key' => 'panel_padding_right', |
| 1396 | 1396 | 'validation' => 'px', |
| 1397 | 1397 | ), |
| 1398 | 1398 | array( |
| 1399 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1399 | + 'title' => __('Bottom', 'megamenu'), |
|
| 1400 | 1400 | 'type' => 'freetext', |
| 1401 | 1401 | 'key' => 'panel_padding_bottom', |
| 1402 | 1402 | 'validation' => 'px', |
| 1403 | 1403 | ), |
| 1404 | 1404 | array( |
| 1405 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1405 | + 'title' => __('Left', 'megamenu'), |
|
| 1406 | 1406 | 'type' => 'freetext', |
| 1407 | 1407 | 'key' => 'panel_padding_left', |
| 1408 | 1408 | 'validation' => 'px', |
@@ -1411,34 +1411,34 @@ discard block |
||
| 1411 | 1411 | ), |
| 1412 | 1412 | 'panel_border' => array( |
| 1413 | 1413 | 'priority' => 40, |
| 1414 | - 'title' => __( 'Panel Border', 'megamenu' ), |
|
| 1415 | - 'description' => __( 'Set the border to display on the sub menu.', 'megamenu' ), |
|
| 1414 | + 'title' => __('Panel Border', 'megamenu'), |
|
| 1415 | + 'description' => __('Set the border to display on the sub menu.', 'megamenu'), |
|
| 1416 | 1416 | 'settings' => array( |
| 1417 | 1417 | array( |
| 1418 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1418 | + 'title' => __('Color', 'megamenu'), |
|
| 1419 | 1419 | 'type' => 'color', |
| 1420 | 1420 | 'key' => 'panel_border_color', |
| 1421 | 1421 | ), |
| 1422 | 1422 | array( |
| 1423 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1423 | + 'title' => __('Top', 'megamenu'), |
|
| 1424 | 1424 | 'type' => 'freetext', |
| 1425 | 1425 | 'key' => 'panel_border_top', |
| 1426 | 1426 | 'validation' => 'px', |
| 1427 | 1427 | ), |
| 1428 | 1428 | array( |
| 1429 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1429 | + 'title' => __('Right', 'megamenu'), |
|
| 1430 | 1430 | 'type' => 'freetext', |
| 1431 | 1431 | 'key' => 'panel_border_right', |
| 1432 | 1432 | 'validation' => 'px', |
| 1433 | 1433 | ), |
| 1434 | 1434 | array( |
| 1435 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1435 | + 'title' => __('Bottom', 'megamenu'), |
|
| 1436 | 1436 | 'type' => 'freetext', |
| 1437 | 1437 | 'key' => 'panel_border_bottom', |
| 1438 | 1438 | 'validation' => 'px', |
| 1439 | 1439 | ), |
| 1440 | 1440 | array( |
| 1441 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1441 | + 'title' => __('Left', 'megamenu'), |
|
| 1442 | 1442 | 'type' => 'freetext', |
| 1443 | 1443 | 'key' => 'panel_border_left', |
| 1444 | 1444 | 'validation' => 'px', |
@@ -1447,29 +1447,29 @@ discard block |
||
| 1447 | 1447 | ), |
| 1448 | 1448 | 'panel_border_radius' => array( |
| 1449 | 1449 | 'priority' => 50, |
| 1450 | - 'title' => __( 'Panel Border Radius', 'megamenu' ), |
|
| 1451 | - 'description' => __( 'Set rounded corners for the sub menu.', 'megamenu' ), |
|
| 1450 | + 'title' => __('Panel Border Radius', 'megamenu'), |
|
| 1451 | + 'description' => __('Set rounded corners for the sub menu.', 'megamenu'), |
|
| 1452 | 1452 | 'settings' => array( |
| 1453 | 1453 | array( |
| 1454 | - 'title' => __( 'Top Left', 'megamenu' ), |
|
| 1454 | + 'title' => __('Top Left', 'megamenu'), |
|
| 1455 | 1455 | 'type' => 'freetext', |
| 1456 | 1456 | 'key' => 'panel_border_radius_top_left', |
| 1457 | 1457 | 'validation' => 'px', |
| 1458 | 1458 | ), |
| 1459 | 1459 | array( |
| 1460 | - 'title' => __( 'Top Right', 'megamenu' ), |
|
| 1460 | + 'title' => __('Top Right', 'megamenu'), |
|
| 1461 | 1461 | 'type' => 'freetext', |
| 1462 | 1462 | 'key' => 'panel_border_radius_top_right', |
| 1463 | 1463 | 'validation' => 'px', |
| 1464 | 1464 | ), |
| 1465 | 1465 | array( |
| 1466 | - 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 1466 | + 'title' => __('Bottom Right', 'megamenu'), |
|
| 1467 | 1467 | 'type' => 'freetext', |
| 1468 | 1468 | 'key' => 'panel_border_radius_bottom_right', |
| 1469 | 1469 | 'validation' => 'px', |
| 1470 | 1470 | ), |
| 1471 | 1471 | array( |
| 1472 | - 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 1472 | + 'title' => __('Bottom Left', 'megamenu'), |
|
| 1473 | 1473 | 'type' => 'freetext', |
| 1474 | 1474 | 'key' => 'panel_border_radius_bottom_left', |
| 1475 | 1475 | 'validation' => 'px', |
@@ -1478,29 +1478,29 @@ discard block |
||
| 1478 | 1478 | ), |
| 1479 | 1479 | 'widget_padding' => array( |
| 1480 | 1480 | 'priority' => 60, |
| 1481 | - 'title' => __( 'Column Padding', 'megamenu' ), |
|
| 1482 | - 'description' => __( 'Use this to define the amount of space around each widget / set of menu items within the sub menu.', 'megamenu' ), |
|
| 1481 | + 'title' => __('Column Padding', 'megamenu'), |
|
| 1482 | + 'description' => __('Use this to define the amount of space around each widget / set of menu items within the sub menu.', 'megamenu'), |
|
| 1483 | 1483 | 'settings' => array( |
| 1484 | 1484 | array( |
| 1485 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1485 | + 'title' => __('Top', 'megamenu'), |
|
| 1486 | 1486 | 'type' => 'freetext', |
| 1487 | 1487 | 'key' => 'panel_widget_padding_top', |
| 1488 | 1488 | 'validation' => 'px', |
| 1489 | 1489 | ), |
| 1490 | 1490 | array( |
| 1491 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1491 | + 'title' => __('Right', 'megamenu'), |
|
| 1492 | 1492 | 'type' => 'freetext', |
| 1493 | 1493 | 'key' => 'panel_widget_padding_right', |
| 1494 | 1494 | 'validation' => 'px', |
| 1495 | 1495 | ), |
| 1496 | 1496 | array( |
| 1497 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1497 | + 'title' => __('Bottom', 'megamenu'), |
|
| 1498 | 1498 | 'type' => 'freetext', |
| 1499 | 1499 | 'key' => 'panel_widget_padding_bottom', |
| 1500 | 1500 | 'validation' => 'px', |
| 1501 | 1501 | ), |
| 1502 | 1502 | array( |
| 1503 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1503 | + 'title' => __('Left', 'megamenu'), |
|
| 1504 | 1504 | 'type' => 'freetext', |
| 1505 | 1505 | 'key' => 'panel_widget_padding_left', |
| 1506 | 1506 | 'validation' => 'px', |
@@ -1509,47 +1509,47 @@ discard block |
||
| 1509 | 1509 | ), |
| 1510 | 1510 | 'mega_menu_widgets' => array( |
| 1511 | 1511 | 'priority' => 65, |
| 1512 | - 'title' => __( 'Widgets', 'megamenu' ), |
|
| 1512 | + 'title' => __('Widgets', 'megamenu'), |
|
| 1513 | 1513 | 'description' => '', |
| 1514 | 1514 | ), |
| 1515 | 1515 | 'widget_heading_font' => array( |
| 1516 | 1516 | 'priority' => 70, |
| 1517 | - 'title' => __( 'Title Font', 'megamenu' ), |
|
| 1518 | - 'description' => __( 'Set the font to use Widget headers in the mega menu. Tip: set this to the same style as the Second Level Menu Item Font to keep your styling consistent.', 'megamenu' ), |
|
| 1517 | + 'title' => __('Title Font', 'megamenu'), |
|
| 1518 | + 'description' => __('Set the font to use Widget headers in the mega menu. Tip: set this to the same style as the Second Level Menu Item Font to keep your styling consistent.', 'megamenu'), |
|
| 1519 | 1519 | 'settings' => array( |
| 1520 | 1520 | array( |
| 1521 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1521 | + 'title' => __('Color', 'megamenu'), |
|
| 1522 | 1522 | 'type' => 'color', |
| 1523 | 1523 | 'key' => 'panel_header_color', |
| 1524 | 1524 | ), |
| 1525 | 1525 | array( |
| 1526 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 1526 | + 'title' => __('Size', 'megamenu'), |
|
| 1527 | 1527 | 'type' => 'freetext', |
| 1528 | 1528 | 'key' => 'panel_header_font_size', |
| 1529 | 1529 | 'validation' => 'px', |
| 1530 | 1530 | ), |
| 1531 | 1531 | array( |
| 1532 | - 'title' => __( 'Family', 'megamenu' ), |
|
| 1532 | + 'title' => __('Family', 'megamenu'), |
|
| 1533 | 1533 | 'type' => 'font', |
| 1534 | 1534 | 'key' => 'panel_header_font', |
| 1535 | 1535 | ), |
| 1536 | 1536 | array( |
| 1537 | - 'title' => __( 'Transform', 'megamenu' ), |
|
| 1537 | + 'title' => __('Transform', 'megamenu'), |
|
| 1538 | 1538 | 'type' => 'transform', |
| 1539 | 1539 | 'key' => 'panel_header_text_transform', |
| 1540 | 1540 | ), |
| 1541 | 1541 | array( |
| 1542 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1542 | + 'title' => __('Weight', 'megamenu'), |
|
| 1543 | 1543 | 'type' => 'weight', |
| 1544 | 1544 | 'key' => 'panel_header_font_weight', |
| 1545 | 1545 | ), |
| 1546 | 1546 | array( |
| 1547 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1547 | + 'title' => __('Decoration', 'megamenu'), |
|
| 1548 | 1548 | 'type' => 'decoration', |
| 1549 | 1549 | 'key' => 'panel_header_text_decoration', |
| 1550 | 1550 | ), |
| 1551 | 1551 | array( |
| 1552 | - 'title' => __( 'Align', 'megamenu' ), |
|
| 1552 | + 'title' => __('Align', 'megamenu'), |
|
| 1553 | 1553 | 'type' => 'align', |
| 1554 | 1554 | 'key' => 'panel_header_text_align', |
| 1555 | 1555 | ), |
@@ -1557,29 +1557,29 @@ discard block |
||
| 1557 | 1557 | ), |
| 1558 | 1558 | 'widget_heading_padding' => array( |
| 1559 | 1559 | 'priority' => 90, |
| 1560 | - 'title' => __( 'Title Padding', 'megamenu' ), |
|
| 1561 | - 'description' => __( 'Set the padding for the widget headings.', 'megamenu' ), |
|
| 1560 | + 'title' => __('Title Padding', 'megamenu'), |
|
| 1561 | + 'description' => __('Set the padding for the widget headings.', 'megamenu'), |
|
| 1562 | 1562 | 'settings' => array( |
| 1563 | 1563 | array( |
| 1564 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1564 | + 'title' => __('Top', 'megamenu'), |
|
| 1565 | 1565 | 'type' => 'freetext', |
| 1566 | 1566 | 'key' => 'panel_header_padding_top', |
| 1567 | 1567 | 'validation' => 'px', |
| 1568 | 1568 | ), |
| 1569 | 1569 | array( |
| 1570 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1570 | + 'title' => __('Right', 'megamenu'), |
|
| 1571 | 1571 | 'type' => 'freetext', |
| 1572 | 1572 | 'key' => 'panel_header_padding_right', |
| 1573 | 1573 | 'validation' => 'px', |
| 1574 | 1574 | ), |
| 1575 | 1575 | array( |
| 1576 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1576 | + 'title' => __('Bottom', 'megamenu'), |
|
| 1577 | 1577 | 'type' => 'freetext', |
| 1578 | 1578 | 'key' => 'panel_header_padding_bottom', |
| 1579 | 1579 | 'validation' => 'px', |
| 1580 | 1580 | ), |
| 1581 | 1581 | array( |
| 1582 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1582 | + 'title' => __('Left', 'megamenu'), |
|
| 1583 | 1583 | 'type' => 'freetext', |
| 1584 | 1584 | 'key' => 'panel_header_padding_left', |
| 1585 | 1585 | 'validation' => 'px', |
@@ -1588,29 +1588,29 @@ discard block |
||
| 1588 | 1588 | ), |
| 1589 | 1589 | 'widget_heading_margin' => array( |
| 1590 | 1590 | 'priority' => 100, |
| 1591 | - 'title' => __( 'Title Margin', 'megamenu' ), |
|
| 1592 | - 'description' => __( 'Set the margin for the widget headings.', 'megamenu' ), |
|
| 1591 | + 'title' => __('Title Margin', 'megamenu'), |
|
| 1592 | + 'description' => __('Set the margin for the widget headings.', 'megamenu'), |
|
| 1593 | 1593 | 'settings' => array( |
| 1594 | 1594 | array( |
| 1595 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1595 | + 'title' => __('Top', 'megamenu'), |
|
| 1596 | 1596 | 'type' => 'freetext', |
| 1597 | 1597 | 'key' => 'panel_header_margin_top', |
| 1598 | 1598 | 'validation' => 'px', |
| 1599 | 1599 | ), |
| 1600 | 1600 | array( |
| 1601 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1601 | + 'title' => __('Right', 'megamenu'), |
|
| 1602 | 1602 | 'type' => 'freetext', |
| 1603 | 1603 | 'key' => 'panel_header_margin_right', |
| 1604 | 1604 | 'validation' => 'px', |
| 1605 | 1605 | ), |
| 1606 | 1606 | array( |
| 1607 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1607 | + 'title' => __('Bottom', 'megamenu'), |
|
| 1608 | 1608 | 'type' => 'freetext', |
| 1609 | 1609 | 'key' => 'panel_header_margin_bottom', |
| 1610 | 1610 | 'validation' => 'px', |
| 1611 | 1611 | ), |
| 1612 | 1612 | array( |
| 1613 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1613 | + 'title' => __('Left', 'megamenu'), |
|
| 1614 | 1614 | 'type' => 'freetext', |
| 1615 | 1615 | 'key' => 'panel_header_margin_left', |
| 1616 | 1616 | 'validation' => 'px', |
@@ -1619,39 +1619,39 @@ discard block |
||
| 1619 | 1619 | ), |
| 1620 | 1620 | 'widget_header_border' => array( |
| 1621 | 1621 | 'priority' => 110, |
| 1622 | - 'title' => __( 'Title Border', 'megamenu' ), |
|
| 1623 | - 'description' => __( 'Set the border for the widget headings.', 'megamenu' ), |
|
| 1622 | + 'title' => __('Title Border', 'megamenu'), |
|
| 1623 | + 'description' => __('Set the border for the widget headings.', 'megamenu'), |
|
| 1624 | 1624 | 'settings' => array( |
| 1625 | 1625 | array( |
| 1626 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1626 | + 'title' => __('Color', 'megamenu'), |
|
| 1627 | 1627 | 'type' => 'color', |
| 1628 | 1628 | 'key' => 'panel_header_border_color', |
| 1629 | 1629 | ), |
| 1630 | 1630 | array( |
| 1631 | - 'title' => __( 'Color (Hover)', 'megamenu' ), |
|
| 1631 | + 'title' => __('Color (Hover)', 'megamenu'), |
|
| 1632 | 1632 | 'type' => 'color', |
| 1633 | 1633 | 'key' => 'panel_header_border_color_hover', |
| 1634 | 1634 | ), |
| 1635 | 1635 | array( |
| 1636 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1636 | + 'title' => __('Top', 'megamenu'), |
|
| 1637 | 1637 | 'type' => 'freetext', |
| 1638 | 1638 | 'key' => 'panel_header_border_top', |
| 1639 | 1639 | 'validation' => 'px', |
| 1640 | 1640 | ), |
| 1641 | 1641 | array( |
| 1642 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1642 | + 'title' => __('Right', 'megamenu'), |
|
| 1643 | 1643 | 'type' => 'freetext', |
| 1644 | 1644 | 'key' => 'panel_header_border_right', |
| 1645 | 1645 | 'validation' => 'px', |
| 1646 | 1646 | ), |
| 1647 | 1647 | array( |
| 1648 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1648 | + 'title' => __('Bottom', 'megamenu'), |
|
| 1649 | 1649 | 'type' => 'freetext', |
| 1650 | 1650 | 'key' => 'panel_header_border_bottom', |
| 1651 | 1651 | 'validation' => 'px', |
| 1652 | 1652 | ), |
| 1653 | 1653 | array( |
| 1654 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1654 | + 'title' => __('Left', 'megamenu'), |
|
| 1655 | 1655 | 'type' => 'freetext', |
| 1656 | 1656 | 'key' => 'panel_header_border_left', |
| 1657 | 1657 | 'validation' => 'px', |
@@ -1660,22 +1660,22 @@ discard block |
||
| 1660 | 1660 | ), |
| 1661 | 1661 | 'widget_content_font' => array( |
| 1662 | 1662 | 'priority' => 115, |
| 1663 | - 'title' => __( 'Content Font', 'megamenu' ), |
|
| 1664 | - 'description' => __( 'Set the font to use for panel contents.', 'megamenu' ), |
|
| 1663 | + 'title' => __('Content Font', 'megamenu'), |
|
| 1664 | + 'description' => __('Set the font to use for panel contents.', 'megamenu'), |
|
| 1665 | 1665 | 'settings' => array( |
| 1666 | 1666 | array( |
| 1667 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1667 | + 'title' => __('Color', 'megamenu'), |
|
| 1668 | 1668 | 'type' => 'color', |
| 1669 | 1669 | 'key' => 'panel_font_color', |
| 1670 | 1670 | ), |
| 1671 | 1671 | array( |
| 1672 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 1672 | + 'title' => __('Size', 'megamenu'), |
|
| 1673 | 1673 | 'type' => 'freetext', |
| 1674 | 1674 | 'key' => 'panel_font_size', |
| 1675 | 1675 | 'validation' => 'px', |
| 1676 | 1676 | ), |
| 1677 | 1677 | array( |
| 1678 | - 'title' => __( 'Family', 'megamenu' ), |
|
| 1678 | + 'title' => __('Family', 'megamenu'), |
|
| 1679 | 1679 | 'type' => 'font', |
| 1680 | 1680 | 'key' => 'panel_font_family', |
| 1681 | 1681 | ), |
@@ -1683,47 +1683,47 @@ discard block |
||
| 1683 | 1683 | ), |
| 1684 | 1684 | 'second_level_menu_items' => array( |
| 1685 | 1685 | 'priority' => 120, |
| 1686 | - 'title' => __( 'Second Level Menu Items', 'megamenu' ), |
|
| 1686 | + 'title' => __('Second Level Menu Items', 'megamenu'), |
|
| 1687 | 1687 | 'description' => '', |
| 1688 | 1688 | ), |
| 1689 | 1689 | 'second_level_font' => array( |
| 1690 | 1690 | 'priority' => 130, |
| 1691 | - 'title' => __( 'Item Font', 'megamenu' ), |
|
| 1692 | - 'description' => __( "Set the font for second level menu items when they're displayed in a Mega Menu.", 'megamenu' ), |
|
| 1691 | + 'title' => __('Item Font', 'megamenu'), |
|
| 1692 | + 'description' => __("Set the font for second level menu items when they're displayed in a Mega Menu.", 'megamenu'), |
|
| 1693 | 1693 | 'settings' => array( |
| 1694 | 1694 | array( |
| 1695 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1695 | + 'title' => __('Color', 'megamenu'), |
|
| 1696 | 1696 | 'type' => 'color', |
| 1697 | 1697 | 'key' => 'panel_second_level_font_color', |
| 1698 | 1698 | ), |
| 1699 | 1699 | array( |
| 1700 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 1700 | + 'title' => __('Size', 'megamenu'), |
|
| 1701 | 1701 | 'type' => 'freetext', |
| 1702 | 1702 | 'key' => 'panel_second_level_font_size', |
| 1703 | 1703 | 'validation' => 'px', |
| 1704 | 1704 | ), |
| 1705 | 1705 | array( |
| 1706 | - 'title' => __( 'Family', 'megamenu' ), |
|
| 1706 | + 'title' => __('Family', 'megamenu'), |
|
| 1707 | 1707 | 'type' => 'font', |
| 1708 | 1708 | 'key' => 'panel_second_level_font', |
| 1709 | 1709 | ), |
| 1710 | 1710 | array( |
| 1711 | - 'title' => __( 'Transform', 'megamenu' ), |
|
| 1711 | + 'title' => __('Transform', 'megamenu'), |
|
| 1712 | 1712 | 'type' => 'transform', |
| 1713 | 1713 | 'key' => 'panel_second_level_text_transform', |
| 1714 | 1714 | ), |
| 1715 | 1715 | array( |
| 1716 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1716 | + 'title' => __('Weight', 'megamenu'), |
|
| 1717 | 1717 | 'type' => 'weight', |
| 1718 | 1718 | 'key' => 'panel_second_level_font_weight', |
| 1719 | 1719 | ), |
| 1720 | 1720 | array( |
| 1721 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1721 | + 'title' => __('Decoration', 'megamenu'), |
|
| 1722 | 1722 | 'type' => 'decoration', |
| 1723 | 1723 | 'key' => 'panel_second_level_text_decoration', |
| 1724 | 1724 | ), |
| 1725 | 1725 | array( |
| 1726 | - 'title' => __( 'Align', 'megamenu' ), |
|
| 1726 | + 'title' => __('Align', 'megamenu'), |
|
| 1727 | 1727 | 'type' => 'align', |
| 1728 | 1728 | 'key' => 'panel_second_level_text_align', |
| 1729 | 1729 | ), |
@@ -1731,21 +1731,21 @@ discard block |
||
| 1731 | 1731 | ), |
| 1732 | 1732 | 'second_level_font_hover' => array( |
| 1733 | 1733 | 'priority' => 140, |
| 1734 | - 'title' => __( 'Item Font (Hover)', 'megamenu' ), |
|
| 1735 | - 'description' => __( 'Set the font style on hover.', 'megamenu' ), |
|
| 1734 | + 'title' => __('Item Font (Hover)', 'megamenu'), |
|
| 1735 | + 'description' => __('Set the font style on hover.', 'megamenu'), |
|
| 1736 | 1736 | 'settings' => array( |
| 1737 | 1737 | array( |
| 1738 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1738 | + 'title' => __('Color', 'megamenu'), |
|
| 1739 | 1739 | 'type' => 'color', |
| 1740 | 1740 | 'key' => 'panel_second_level_font_color_hover', |
| 1741 | 1741 | ), |
| 1742 | 1742 | array( |
| 1743 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1743 | + 'title' => __('Weight', 'megamenu'), |
|
| 1744 | 1744 | 'type' => 'weight', |
| 1745 | 1745 | 'key' => 'panel_second_level_font_weight_hover', |
| 1746 | 1746 | ), |
| 1747 | 1747 | array( |
| 1748 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1748 | + 'title' => __('Decoration', 'megamenu'), |
|
| 1749 | 1749 | 'type' => 'decoration', |
| 1750 | 1750 | 'key' => 'panel_second_level_text_decoration_hover', |
| 1751 | 1751 | ), |
@@ -1753,21 +1753,21 @@ discard block |
||
| 1753 | 1753 | ), |
| 1754 | 1754 | 'second_level_background_hover' => array( |
| 1755 | 1755 | 'priority' => 150, |
| 1756 | - 'title' => __( 'Item Background (Hover)', 'megamenu' ), |
|
| 1757 | - 'description' => __( 'Set the background hover color for second level menu items.', 'megamenu' ), |
|
| 1756 | + 'title' => __('Item Background (Hover)', 'megamenu'), |
|
| 1757 | + 'description' => __('Set the background hover color for second level menu items.', 'megamenu'), |
|
| 1758 | 1758 | 'settings' => array( |
| 1759 | 1759 | array( |
| 1760 | - 'title' => __( 'From', 'megamenu' ), |
|
| 1760 | + 'title' => __('From', 'megamenu'), |
|
| 1761 | 1761 | 'type' => 'color', |
| 1762 | 1762 | 'key' => 'panel_second_level_background_hover_from', |
| 1763 | 1763 | ), |
| 1764 | 1764 | array( |
| 1765 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 1765 | + 'title' => __('Copy', 'megamenu'), |
|
| 1766 | 1766 | 'type' => 'copy_color', |
| 1767 | 1767 | 'key' => 'copy_color', |
| 1768 | 1768 | ), |
| 1769 | 1769 | array( |
| 1770 | - 'title' => __( 'To', 'megamenu' ), |
|
| 1770 | + 'title' => __('To', 'megamenu'), |
|
| 1771 | 1771 | 'type' => 'color', |
| 1772 | 1772 | 'key' => 'panel_second_level_background_hover_to', |
| 1773 | 1773 | ), |
@@ -1775,29 +1775,29 @@ discard block |
||
| 1775 | 1775 | ), |
| 1776 | 1776 | 'second_level_padding' => array( |
| 1777 | 1777 | 'priority' => 160, |
| 1778 | - 'title' => __( 'Item Padding', 'megamenu' ), |
|
| 1779 | - 'description' => __( 'Set the padding for the second level menu items.', 'megamenu' ), |
|
| 1778 | + 'title' => __('Item Padding', 'megamenu'), |
|
| 1779 | + 'description' => __('Set the padding for the second level menu items.', 'megamenu'), |
|
| 1780 | 1780 | 'settings' => array( |
| 1781 | 1781 | array( |
| 1782 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1782 | + 'title' => __('Top', 'megamenu'), |
|
| 1783 | 1783 | 'type' => 'freetext', |
| 1784 | 1784 | 'key' => 'panel_second_level_padding_top', |
| 1785 | 1785 | 'validation' => 'px', |
| 1786 | 1786 | ), |
| 1787 | 1787 | array( |
| 1788 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1788 | + 'title' => __('Right', 'megamenu'), |
|
| 1789 | 1789 | 'type' => 'freetext', |
| 1790 | 1790 | 'key' => 'panel_second_level_padding_right', |
| 1791 | 1791 | 'validation' => 'px', |
| 1792 | 1792 | ), |
| 1793 | 1793 | array( |
| 1794 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1794 | + 'title' => __('Bottom', 'megamenu'), |
|
| 1795 | 1795 | 'type' => 'freetext', |
| 1796 | 1796 | 'key' => 'panel_second_level_padding_bottom', |
| 1797 | 1797 | 'validation' => 'px', |
| 1798 | 1798 | ), |
| 1799 | 1799 | array( |
| 1800 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1800 | + 'title' => __('Left', 'megamenu'), |
|
| 1801 | 1801 | 'type' => 'freetext', |
| 1802 | 1802 | 'key' => 'panel_second_level_padding_left', |
| 1803 | 1803 | 'validation' => 'px', |
@@ -1806,29 +1806,29 @@ discard block |
||
| 1806 | 1806 | ), |
| 1807 | 1807 | 'second_level_margin' => array( |
| 1808 | 1808 | 'priority' => 170, |
| 1809 | - 'title' => __( 'Item Margin', 'megamenu' ), |
|
| 1810 | - 'description' => __( 'Set the margin for the second level menu items.', 'megamenu' ), |
|
| 1809 | + 'title' => __('Item Margin', 'megamenu'), |
|
| 1810 | + 'description' => __('Set the margin for the second level menu items.', 'megamenu'), |
|
| 1811 | 1811 | 'settings' => array( |
| 1812 | 1812 | array( |
| 1813 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1813 | + 'title' => __('Top', 'megamenu'), |
|
| 1814 | 1814 | 'type' => 'freetext', |
| 1815 | 1815 | 'key' => 'panel_second_level_margin_top', |
| 1816 | 1816 | 'validation' => 'px', |
| 1817 | 1817 | ), |
| 1818 | 1818 | array( |
| 1819 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1819 | + 'title' => __('Right', 'megamenu'), |
|
| 1820 | 1820 | 'type' => 'freetext', |
| 1821 | 1821 | 'key' => 'panel_second_level_margin_right', |
| 1822 | 1822 | 'validation' => 'px', |
| 1823 | 1823 | ), |
| 1824 | 1824 | array( |
| 1825 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1825 | + 'title' => __('Bottom', 'megamenu'), |
|
| 1826 | 1826 | 'type' => 'freetext', |
| 1827 | 1827 | 'key' => 'panel_second_level_margin_bottom', |
| 1828 | 1828 | 'validation' => 'px', |
| 1829 | 1829 | ), |
| 1830 | 1830 | array( |
| 1831 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1831 | + 'title' => __('Left', 'megamenu'), |
|
| 1832 | 1832 | 'type' => 'freetext', |
| 1833 | 1833 | 'key' => 'panel_second_level_margin_left', |
| 1834 | 1834 | 'validation' => 'px', |
@@ -1837,39 +1837,39 @@ discard block |
||
| 1837 | 1837 | ), |
| 1838 | 1838 | 'second_level_border' => array( |
| 1839 | 1839 | 'priority' => 180, |
| 1840 | - 'title' => __( 'Item Border', 'megamenu' ), |
|
| 1841 | - 'description' => __( 'Set the border for the second level menu items.', 'megamenu' ), |
|
| 1840 | + 'title' => __('Item Border', 'megamenu'), |
|
| 1841 | + 'description' => __('Set the border for the second level menu items.', 'megamenu'), |
|
| 1842 | 1842 | 'settings' => array( |
| 1843 | 1843 | array( |
| 1844 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1844 | + 'title' => __('Color', 'megamenu'), |
|
| 1845 | 1845 | 'type' => 'color', |
| 1846 | 1846 | 'key' => 'panel_second_level_border_color', |
| 1847 | 1847 | ), |
| 1848 | 1848 | array( |
| 1849 | - 'title' => __( 'Color (Hover)', 'megamenu' ), |
|
| 1849 | + 'title' => __('Color (Hover)', 'megamenu'), |
|
| 1850 | 1850 | 'type' => 'color', |
| 1851 | 1851 | 'key' => 'panel_second_level_border_color_hover', |
| 1852 | 1852 | ), |
| 1853 | 1853 | array( |
| 1854 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1854 | + 'title' => __('Top', 'megamenu'), |
|
| 1855 | 1855 | 'type' => 'freetext', |
| 1856 | 1856 | 'key' => 'panel_second_level_border_top', |
| 1857 | 1857 | 'validation' => 'px', |
| 1858 | 1858 | ), |
| 1859 | 1859 | array( |
| 1860 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1860 | + 'title' => __('Right', 'megamenu'), |
|
| 1861 | 1861 | 'type' => 'freetext', |
| 1862 | 1862 | 'key' => 'panel_second_level_border_right', |
| 1863 | 1863 | 'validation' => 'px', |
| 1864 | 1864 | ), |
| 1865 | 1865 | array( |
| 1866 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1866 | + 'title' => __('Bottom', 'megamenu'), |
|
| 1867 | 1867 | 'type' => 'freetext', |
| 1868 | 1868 | 'key' => 'panel_second_level_border_bottom', |
| 1869 | 1869 | 'validation' => 'px', |
| 1870 | 1870 | ), |
| 1871 | 1871 | array( |
| 1872 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1872 | + 'title' => __('Left', 'megamenu'), |
|
| 1873 | 1873 | 'type' => 'freetext', |
| 1874 | 1874 | 'key' => 'panel_second_level_border_left', |
| 1875 | 1875 | 'validation' => 'px', |
@@ -1878,47 +1878,47 @@ discard block |
||
| 1878 | 1878 | ), |
| 1879 | 1879 | 'third_level_menu_items' => array( |
| 1880 | 1880 | 'priority' => 190, |
| 1881 | - 'title' => __( 'Third Level Menu Items', 'megamenu' ), |
|
| 1881 | + 'title' => __('Third Level Menu Items', 'megamenu'), |
|
| 1882 | 1882 | 'description' => '', |
| 1883 | 1883 | ), |
| 1884 | 1884 | 'third_level_font' => array( |
| 1885 | 1885 | 'priority' => 200, |
| 1886 | - 'title' => __( 'Item Font', 'megamenu' ), |
|
| 1887 | - 'description' => __( "Set the font for third level menu items when they're displayed in a Mega Menu.", 'megamenu' ), |
|
| 1886 | + 'title' => __('Item Font', 'megamenu'), |
|
| 1887 | + 'description' => __("Set the font for third level menu items when they're displayed in a Mega Menu.", 'megamenu'), |
|
| 1888 | 1888 | 'settings' => array( |
| 1889 | 1889 | array( |
| 1890 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1890 | + 'title' => __('Color', 'megamenu'), |
|
| 1891 | 1891 | 'type' => 'color', |
| 1892 | 1892 | 'key' => 'panel_third_level_font_color', |
| 1893 | 1893 | ), |
| 1894 | 1894 | array( |
| 1895 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 1895 | + 'title' => __('Size', 'megamenu'), |
|
| 1896 | 1896 | 'type' => 'freetext', |
| 1897 | 1897 | 'key' => 'panel_third_level_font_size', |
| 1898 | 1898 | 'validation' => 'px', |
| 1899 | 1899 | ), |
| 1900 | 1900 | array( |
| 1901 | - 'title' => __( 'Family', 'megamenu' ), |
|
| 1901 | + 'title' => __('Family', 'megamenu'), |
|
| 1902 | 1902 | 'type' => 'font', |
| 1903 | 1903 | 'key' => 'panel_third_level_font', |
| 1904 | 1904 | ), |
| 1905 | 1905 | array( |
| 1906 | - 'title' => __( 'Transform', 'megamenu' ), |
|
| 1906 | + 'title' => __('Transform', 'megamenu'), |
|
| 1907 | 1907 | 'type' => 'transform', |
| 1908 | 1908 | 'key' => 'panel_third_level_text_transform', |
| 1909 | 1909 | ), |
| 1910 | 1910 | array( |
| 1911 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1911 | + 'title' => __('Weight', 'megamenu'), |
|
| 1912 | 1912 | 'type' => 'weight', |
| 1913 | 1913 | 'key' => 'panel_third_level_font_weight', |
| 1914 | 1914 | ), |
| 1915 | 1915 | array( |
| 1916 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1916 | + 'title' => __('Decoration', 'megamenu'), |
|
| 1917 | 1917 | 'type' => 'decoration', |
| 1918 | 1918 | 'key' => 'panel_third_level_text_decoration', |
| 1919 | 1919 | ), |
| 1920 | 1920 | array( |
| 1921 | - 'title' => __( 'Align', 'megamenu' ), |
|
| 1921 | + 'title' => __('Align', 'megamenu'), |
|
| 1922 | 1922 | 'type' => 'align', |
| 1923 | 1923 | 'key' => 'panel_third_level_text_align', |
| 1924 | 1924 | ), |
@@ -1926,21 +1926,21 @@ discard block |
||
| 1926 | 1926 | ), |
| 1927 | 1927 | 'third_level_font_hover' => array( |
| 1928 | 1928 | 'priority' => 210, |
| 1929 | - 'title' => __( 'Item Font (Hover)', 'megamenu' ), |
|
| 1930 | - 'description' => __( 'Set the font style on hover.', 'megamenu' ), |
|
| 1929 | + 'title' => __('Item Font (Hover)', 'megamenu'), |
|
| 1930 | + 'description' => __('Set the font style on hover.', 'megamenu'), |
|
| 1931 | 1931 | 'settings' => array( |
| 1932 | 1932 | array( |
| 1933 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 1933 | + 'title' => __('Color', 'megamenu'), |
|
| 1934 | 1934 | 'type' => 'color', |
| 1935 | 1935 | 'key' => 'panel_third_level_font_color_hover', |
| 1936 | 1936 | ), |
| 1937 | 1937 | array( |
| 1938 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 1938 | + 'title' => __('Weight', 'megamenu'), |
|
| 1939 | 1939 | 'type' => 'weight', |
| 1940 | 1940 | 'key' => 'panel_third_level_font_weight_hover', |
| 1941 | 1941 | ), |
| 1942 | 1942 | array( |
| 1943 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 1943 | + 'title' => __('Decoration', 'megamenu'), |
|
| 1944 | 1944 | 'type' => 'decoration', |
| 1945 | 1945 | 'key' => 'panel_third_level_text_decoration_hover', |
| 1946 | 1946 | ), |
@@ -1948,21 +1948,21 @@ discard block |
||
| 1948 | 1948 | ), |
| 1949 | 1949 | 'third_level_background_hover' => array( |
| 1950 | 1950 | 'priority' => 220, |
| 1951 | - 'title' => __( 'Item Background (Hover)', 'megamenu' ), |
|
| 1952 | - 'description' => __( 'Set the background hover color for third level menu items.', 'megamenu' ), |
|
| 1951 | + 'title' => __('Item Background (Hover)', 'megamenu'), |
|
| 1952 | + 'description' => __('Set the background hover color for third level menu items.', 'megamenu'), |
|
| 1953 | 1953 | 'settings' => array( |
| 1954 | 1954 | array( |
| 1955 | - 'title' => __( 'From', 'megamenu' ), |
|
| 1955 | + 'title' => __('From', 'megamenu'), |
|
| 1956 | 1956 | 'type' => 'color', |
| 1957 | 1957 | 'key' => 'panel_third_level_background_hover_from', |
| 1958 | 1958 | ), |
| 1959 | 1959 | array( |
| 1960 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 1960 | + 'title' => __('Copy', 'megamenu'), |
|
| 1961 | 1961 | 'type' => 'copy_color', |
| 1962 | 1962 | 'key' => 'copy_color', |
| 1963 | 1963 | ), |
| 1964 | 1964 | array( |
| 1965 | - 'title' => __( 'To', 'megamenu' ), |
|
| 1965 | + 'title' => __('To', 'megamenu'), |
|
| 1966 | 1966 | 'type' => 'color', |
| 1967 | 1967 | 'key' => 'panel_third_level_background_hover_to', |
| 1968 | 1968 | ), |
@@ -1970,29 +1970,29 @@ discard block |
||
| 1970 | 1970 | ), |
| 1971 | 1971 | 'third_level_padding' => array( |
| 1972 | 1972 | 'priority' => 230, |
| 1973 | - 'title' => __( 'Item Padding', 'megamenu' ), |
|
| 1974 | - 'description' => __( 'Set the padding for the third level menu items.', 'megamenu' ), |
|
| 1973 | + 'title' => __('Item Padding', 'megamenu'), |
|
| 1974 | + 'description' => __('Set the padding for the third level menu items.', 'megamenu'), |
|
| 1975 | 1975 | 'settings' => array( |
| 1976 | 1976 | array( |
| 1977 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 1977 | + 'title' => __('Top', 'megamenu'), |
|
| 1978 | 1978 | 'type' => 'freetext', |
| 1979 | 1979 | 'key' => 'panel_third_level_padding_top', |
| 1980 | 1980 | 'validation' => 'px', |
| 1981 | 1981 | ), |
| 1982 | 1982 | array( |
| 1983 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 1983 | + 'title' => __('Right', 'megamenu'), |
|
| 1984 | 1984 | 'type' => 'freetext', |
| 1985 | 1985 | 'key' => 'panel_third_level_padding_right', |
| 1986 | 1986 | 'validation' => 'px', |
| 1987 | 1987 | ), |
| 1988 | 1988 | array( |
| 1989 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 1989 | + 'title' => __('Bottom', 'megamenu'), |
|
| 1990 | 1990 | 'type' => 'freetext', |
| 1991 | 1991 | 'key' => 'panel_third_level_padding_bottom', |
| 1992 | 1992 | 'validation' => 'px', |
| 1993 | 1993 | ), |
| 1994 | 1994 | array( |
| 1995 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 1995 | + 'title' => __('Left', 'megamenu'), |
|
| 1996 | 1996 | 'type' => 'freetext', |
| 1997 | 1997 | 'key' => 'panel_third_level_padding_left', |
| 1998 | 1998 | 'validation' => 'px', |
@@ -2002,29 +2002,29 @@ discard block |
||
| 2002 | 2002 | |
| 2003 | 2003 | 'third_level_margin' => array( |
| 2004 | 2004 | 'priority' => 235, |
| 2005 | - 'title' => __( 'Item Margin', 'megamenu' ), |
|
| 2006 | - 'description' => __( 'Set the margin for the third level menu items.', 'megamenu' ), |
|
| 2005 | + 'title' => __('Item Margin', 'megamenu'), |
|
| 2006 | + 'description' => __('Set the margin for the third level menu items.', 'megamenu'), |
|
| 2007 | 2007 | 'settings' => array( |
| 2008 | 2008 | array( |
| 2009 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 2009 | + 'title' => __('Top', 'megamenu'), |
|
| 2010 | 2010 | 'type' => 'freetext', |
| 2011 | 2011 | 'key' => 'panel_third_level_margin_top', |
| 2012 | 2012 | 'validation' => 'px', |
| 2013 | 2013 | ), |
| 2014 | 2014 | array( |
| 2015 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 2015 | + 'title' => __('Right', 'megamenu'), |
|
| 2016 | 2016 | 'type' => 'freetext', |
| 2017 | 2017 | 'key' => 'panel_third_level_margin_right', |
| 2018 | 2018 | 'validation' => 'px', |
| 2019 | 2019 | ), |
| 2020 | 2020 | array( |
| 2021 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2021 | + 'title' => __('Bottom', 'megamenu'), |
|
| 2022 | 2022 | 'type' => 'freetext', |
| 2023 | 2023 | 'key' => 'panel_third_level_margin_bottom', |
| 2024 | 2024 | 'validation' => 'px', |
| 2025 | 2025 | ), |
| 2026 | 2026 | array( |
| 2027 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 2027 | + 'title' => __('Left', 'megamenu'), |
|
| 2028 | 2028 | 'type' => 'freetext', |
| 2029 | 2029 | 'key' => 'panel_third_level_margin_left', |
| 2030 | 2030 | 'validation' => 'px', |
@@ -2033,39 +2033,39 @@ discard block |
||
| 2033 | 2033 | ), |
| 2034 | 2034 | 'third_level_border' => array( |
| 2035 | 2035 | 'priority' => 237, |
| 2036 | - 'title' => __( 'Item Border', 'megamenu' ), |
|
| 2037 | - 'description' => __( 'Set the border for the third level menu items.', 'megamenu' ), |
|
| 2036 | + 'title' => __('Item Border', 'megamenu'), |
|
| 2037 | + 'description' => __('Set the border for the third level menu items.', 'megamenu'), |
|
| 2038 | 2038 | 'settings' => array( |
| 2039 | 2039 | array( |
| 2040 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2040 | + 'title' => __('Color', 'megamenu'), |
|
| 2041 | 2041 | 'type' => 'color', |
| 2042 | 2042 | 'key' => 'panel_third_level_border_color', |
| 2043 | 2043 | ), |
| 2044 | 2044 | array( |
| 2045 | - 'title' => __( 'Color (Hover)', 'megamenu' ), |
|
| 2045 | + 'title' => __('Color (Hover)', 'megamenu'), |
|
| 2046 | 2046 | 'type' => 'color', |
| 2047 | 2047 | 'key' => 'panel_third_level_border_color_hover', |
| 2048 | 2048 | ), |
| 2049 | 2049 | array( |
| 2050 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 2050 | + 'title' => __('Top', 'megamenu'), |
|
| 2051 | 2051 | 'type' => 'freetext', |
| 2052 | 2052 | 'key' => 'panel_third_level_border_top', |
| 2053 | 2053 | 'validation' => 'px', |
| 2054 | 2054 | ), |
| 2055 | 2055 | array( |
| 2056 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 2056 | + 'title' => __('Right', 'megamenu'), |
|
| 2057 | 2057 | 'type' => 'freetext', |
| 2058 | 2058 | 'key' => 'panel_third_level_border_right', |
| 2059 | 2059 | 'validation' => 'px', |
| 2060 | 2060 | ), |
| 2061 | 2061 | array( |
| 2062 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2062 | + 'title' => __('Bottom', 'megamenu'), |
|
| 2063 | 2063 | 'type' => 'freetext', |
| 2064 | 2064 | 'key' => 'panel_third_level_border_bottom', |
| 2065 | 2065 | 'validation' => 'px', |
| 2066 | 2066 | ), |
| 2067 | 2067 | array( |
| 2068 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 2068 | + 'title' => __('Left', 'megamenu'), |
|
| 2069 | 2069 | 'type' => 'freetext', |
| 2070 | 2070 | 'key' => 'panel_third_level_border_left', |
| 2071 | 2071 | 'validation' => 'px', |
@@ -2075,25 +2075,25 @@ discard block |
||
| 2075 | 2075 | ), |
| 2076 | 2076 | ), |
| 2077 | 2077 | 'flyout_menus' => array( |
| 2078 | - 'title' => __( 'Flyout Menus', 'megamenu' ), |
|
| 2078 | + 'title' => __('Flyout Menus', 'megamenu'), |
|
| 2079 | 2079 | 'settings' => array( |
| 2080 | 2080 | 'flyout_menu_background' => array( |
| 2081 | 2081 | 'priority' => 10, |
| 2082 | - 'title' => __( 'Sub Menu Background', 'megamenu' ), |
|
| 2083 | - 'description' => __( 'Set the background color for the flyout menu.', 'megamenu' ), |
|
| 2082 | + 'title' => __('Sub Menu Background', 'megamenu'), |
|
| 2083 | + 'description' => __('Set the background color for the flyout menu.', 'megamenu'), |
|
| 2084 | 2084 | 'settings' => array( |
| 2085 | 2085 | array( |
| 2086 | - 'title' => __( 'From', 'megamenu' ), |
|
| 2086 | + 'title' => __('From', 'megamenu'), |
|
| 2087 | 2087 | 'type' => 'color', |
| 2088 | 2088 | 'key' => 'flyout_menu_background_from', |
| 2089 | 2089 | ), |
| 2090 | 2090 | array( |
| 2091 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 2091 | + 'title' => __('Copy', 'megamenu'), |
|
| 2092 | 2092 | 'type' => 'copy_color', |
| 2093 | 2093 | 'key' => 'copy_color', |
| 2094 | 2094 | ), |
| 2095 | 2095 | array( |
| 2096 | - 'title' => __( 'To', 'megamenu' ), |
|
| 2096 | + 'title' => __('To', 'megamenu'), |
|
| 2097 | 2097 | 'type' => 'color', |
| 2098 | 2098 | 'key' => 'flyout_menu_background_to', |
| 2099 | 2099 | ), |
@@ -2101,11 +2101,11 @@ discard block |
||
| 2101 | 2101 | ), |
| 2102 | 2102 | 'flyout_menu_width' => array( |
| 2103 | 2103 | 'priority' => 20, |
| 2104 | - 'title' => __( 'Sub Menu Width', 'megamenu' ), |
|
| 2105 | - 'description' => __( 'The width of each flyout menu. This must be a fixed pixel value.', 'megamenu' ), |
|
| 2104 | + 'title' => __('Sub Menu Width', 'megamenu'), |
|
| 2105 | + 'description' => __('The width of each flyout menu. This must be a fixed pixel value.', 'megamenu'), |
|
| 2106 | 2106 | 'info' => array( |
| 2107 | - __( 'Set this value to the width of your longest menu item title to stop menu items wrapping onto 2 lines.', 'megamenu' ), |
|
| 2108 | - __( "Experimental: Set this value to 'auto' to use a flexible width.", 'megamenu' ), |
|
| 2107 | + __('Set this value to the width of your longest menu item title to stop menu items wrapping onto 2 lines.', 'megamenu'), |
|
| 2108 | + __("Experimental: Set this value to 'auto' to use a flexible width.", 'megamenu'), |
|
| 2109 | 2109 | ), |
| 2110 | 2110 | 'settings' => array( |
| 2111 | 2111 | array( |
@@ -2118,30 +2118,30 @@ discard block |
||
| 2118 | 2118 | ), |
| 2119 | 2119 | 'flyout_menu_padding' => array( |
| 2120 | 2120 | 'priority' => 30, |
| 2121 | - 'title' => __( 'Sub Menu Padding', 'megamenu' ), |
|
| 2122 | - 'description' => __( 'Set the padding for the whole flyout menu.', 'megamenu' ), |
|
| 2123 | - 'info' => array( __( "Only suitable for single level flyout menus. If you're using multi level flyout menus set these values to 0px.", 'megamenu' ) ), |
|
| 2121 | + 'title' => __('Sub Menu Padding', 'megamenu'), |
|
| 2122 | + 'description' => __('Set the padding for the whole flyout menu.', 'megamenu'), |
|
| 2123 | + 'info' => array(__("Only suitable for single level flyout menus. If you're using multi level flyout menus set these values to 0px.", 'megamenu')), |
|
| 2124 | 2124 | 'settings' => array( |
| 2125 | 2125 | array( |
| 2126 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 2126 | + 'title' => __('Top', 'megamenu'), |
|
| 2127 | 2127 | 'type' => 'freetext', |
| 2128 | 2128 | 'key' => 'flyout_padding_top', |
| 2129 | 2129 | 'validation' => 'px', |
| 2130 | 2130 | ), |
| 2131 | 2131 | array( |
| 2132 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 2132 | + 'title' => __('Right', 'megamenu'), |
|
| 2133 | 2133 | 'type' => 'freetext', |
| 2134 | 2134 | 'key' => 'flyout_padding_right', |
| 2135 | 2135 | 'validation' => 'px', |
| 2136 | 2136 | ), |
| 2137 | 2137 | array( |
| 2138 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2138 | + 'title' => __('Bottom', 'megamenu'), |
|
| 2139 | 2139 | 'type' => 'freetext', |
| 2140 | 2140 | 'key' => 'flyout_padding_bottom', |
| 2141 | 2141 | 'validation' => 'px', |
| 2142 | 2142 | ), |
| 2143 | 2143 | array( |
| 2144 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 2144 | + 'title' => __('Left', 'megamenu'), |
|
| 2145 | 2145 | 'type' => 'freetext', |
| 2146 | 2146 | 'key' => 'flyout_padding_left', |
| 2147 | 2147 | 'validation' => 'px', |
@@ -2150,34 +2150,34 @@ discard block |
||
| 2150 | 2150 | ), |
| 2151 | 2151 | 'flyout_menu_border' => array( |
| 2152 | 2152 | 'priority' => 40, |
| 2153 | - 'title' => __( 'Sub Menu Border', 'megamenu' ), |
|
| 2154 | - 'description' => __( 'Set the border for the flyout menu.', 'megamenu' ), |
|
| 2153 | + 'title' => __('Sub Menu Border', 'megamenu'), |
|
| 2154 | + 'description' => __('Set the border for the flyout menu.', 'megamenu'), |
|
| 2155 | 2155 | 'settings' => array( |
| 2156 | 2156 | array( |
| 2157 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2157 | + 'title' => __('Color', 'megamenu'), |
|
| 2158 | 2158 | 'type' => 'color', |
| 2159 | 2159 | 'key' => 'flyout_border_color', |
| 2160 | 2160 | ), |
| 2161 | 2161 | array( |
| 2162 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 2162 | + 'title' => __('Top', 'megamenu'), |
|
| 2163 | 2163 | 'type' => 'freetext', |
| 2164 | 2164 | 'key' => 'flyout_border_top', |
| 2165 | 2165 | 'validation' => 'px', |
| 2166 | 2166 | ), |
| 2167 | 2167 | array( |
| 2168 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 2168 | + 'title' => __('Right', 'megamenu'), |
|
| 2169 | 2169 | 'type' => 'freetext', |
| 2170 | 2170 | 'key' => 'flyout_border_right', |
| 2171 | 2171 | 'validation' => 'px', |
| 2172 | 2172 | ), |
| 2173 | 2173 | array( |
| 2174 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2174 | + 'title' => __('Bottom', 'megamenu'), |
|
| 2175 | 2175 | 'type' => 'freetext', |
| 2176 | 2176 | 'key' => 'flyout_border_bottom', |
| 2177 | 2177 | 'validation' => 'px', |
| 2178 | 2178 | ), |
| 2179 | 2179 | array( |
| 2180 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 2180 | + 'title' => __('Left', 'megamenu'), |
|
| 2181 | 2181 | 'type' => 'freetext', |
| 2182 | 2182 | 'key' => 'flyout_border_left', |
| 2183 | 2183 | 'validation' => 'px', |
@@ -2186,29 +2186,29 @@ discard block |
||
| 2186 | 2186 | ), |
| 2187 | 2187 | 'flyout_menu_border_radius' => array( |
| 2188 | 2188 | 'priority' => 50, |
| 2189 | - 'title' => __( 'Sub Menu Border Radius', 'megamenu' ), |
|
| 2190 | - 'description' => __( 'Set rounded corners for flyout menus. Rounded corners will be applied to all flyout menu levels.', 'megamenu' ), |
|
| 2189 | + 'title' => __('Sub Menu Border Radius', 'megamenu'), |
|
| 2190 | + 'description' => __('Set rounded corners for flyout menus. Rounded corners will be applied to all flyout menu levels.', 'megamenu'), |
|
| 2191 | 2191 | 'settings' => array( |
| 2192 | 2192 | array( |
| 2193 | - 'title' => __( 'Top Left', 'megamenu' ), |
|
| 2193 | + 'title' => __('Top Left', 'megamenu'), |
|
| 2194 | 2194 | 'type' => 'freetext', |
| 2195 | 2195 | 'key' => 'flyout_border_radius_top_left', |
| 2196 | 2196 | 'validation' => 'px', |
| 2197 | 2197 | ), |
| 2198 | 2198 | array( |
| 2199 | - 'title' => __( 'Top Right', 'megamenu' ), |
|
| 2199 | + 'title' => __('Top Right', 'megamenu'), |
|
| 2200 | 2200 | 'type' => 'freetext', |
| 2201 | 2201 | 'key' => 'flyout_border_radius_top_right', |
| 2202 | 2202 | 'validation' => 'px', |
| 2203 | 2203 | ), |
| 2204 | 2204 | array( |
| 2205 | - 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 2205 | + 'title' => __('Bottom Right', 'megamenu'), |
|
| 2206 | 2206 | 'type' => 'freetext', |
| 2207 | 2207 | 'key' => 'flyout_border_radius_bottom_right', |
| 2208 | 2208 | 'validation' => 'px', |
| 2209 | 2209 | ), |
| 2210 | 2210 | array( |
| 2211 | - 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 2211 | + 'title' => __('Bottom Left', 'megamenu'), |
|
| 2212 | 2212 | 'type' => 'freetext', |
| 2213 | 2213 | 'key' => 'flyout_border_radius_bottom_left', |
| 2214 | 2214 | 'validation' => 'px', |
@@ -2217,21 +2217,21 @@ discard block |
||
| 2217 | 2217 | ), |
| 2218 | 2218 | 'flyout_menu_item_background' => array( |
| 2219 | 2219 | 'priority' => 60, |
| 2220 | - 'title' => __( 'Menu Item Background', 'megamenu' ), |
|
| 2221 | - 'description' => __( 'Set the background color for a flyout menu item.', 'megamenu' ), |
|
| 2220 | + 'title' => __('Menu Item Background', 'megamenu'), |
|
| 2221 | + 'description' => __('Set the background color for a flyout menu item.', 'megamenu'), |
|
| 2222 | 2222 | 'settings' => array( |
| 2223 | 2223 | array( |
| 2224 | - 'title' => __( 'From', 'megamenu' ), |
|
| 2224 | + 'title' => __('From', 'megamenu'), |
|
| 2225 | 2225 | 'type' => 'color', |
| 2226 | 2226 | 'key' => 'flyout_background_from', |
| 2227 | 2227 | ), |
| 2228 | 2228 | array( |
| 2229 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 2229 | + 'title' => __('Copy', 'megamenu'), |
|
| 2230 | 2230 | 'type' => 'copy_color', |
| 2231 | 2231 | 'key' => 'copy_color', |
| 2232 | 2232 | ), |
| 2233 | 2233 | array( |
| 2234 | - 'title' => __( 'To', 'megamenu' ), |
|
| 2234 | + 'title' => __('To', 'megamenu'), |
|
| 2235 | 2235 | 'type' => 'color', |
| 2236 | 2236 | 'key' => 'flyout_background_to', |
| 2237 | 2237 | ), |
@@ -2239,21 +2239,21 @@ discard block |
||
| 2239 | 2239 | ), |
| 2240 | 2240 | 'flyout_menu_item_background_hover' => array( |
| 2241 | 2241 | 'priority' => 70, |
| 2242 | - 'title' => __( 'Menu Item Background (Hover)', 'megamenu' ), |
|
| 2243 | - 'description' => __( 'Set the background color for a flyout menu item (on hover).', 'megamenu' ), |
|
| 2242 | + 'title' => __('Menu Item Background (Hover)', 'megamenu'), |
|
| 2243 | + 'description' => __('Set the background color for a flyout menu item (on hover).', 'megamenu'), |
|
| 2244 | 2244 | 'settings' => array( |
| 2245 | 2245 | array( |
| 2246 | - 'title' => __( 'From', 'megamenu' ), |
|
| 2246 | + 'title' => __('From', 'megamenu'), |
|
| 2247 | 2247 | 'type' => 'color', |
| 2248 | 2248 | 'key' => 'flyout_background_hover_from', |
| 2249 | 2249 | ), |
| 2250 | 2250 | array( |
| 2251 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 2251 | + 'title' => __('Copy', 'megamenu'), |
|
| 2252 | 2252 | 'type' => 'copy_color', |
| 2253 | 2253 | 'key' => 'copy_color', |
| 2254 | 2254 | ), |
| 2255 | 2255 | array( |
| 2256 | - 'title' => __( 'To', 'megamenu' ), |
|
| 2256 | + 'title' => __('To', 'megamenu'), |
|
| 2257 | 2257 | 'type' => 'color', |
| 2258 | 2258 | 'key' => 'flyout_background_hover_to', |
| 2259 | 2259 | ), |
@@ -2261,8 +2261,8 @@ discard block |
||
| 2261 | 2261 | ), |
| 2262 | 2262 | 'flyout_menu_item_height' => array( |
| 2263 | 2263 | 'priority' => 80, |
| 2264 | - 'title' => __( 'Menu Item Height', 'megamenu' ), |
|
| 2265 | - 'description' => __( 'The height of each flyout menu item.', 'megamenu' ), |
|
| 2264 | + 'title' => __('Menu Item Height', 'megamenu'), |
|
| 2265 | + 'description' => __('The height of each flyout menu item.', 'megamenu'), |
|
| 2266 | 2266 | 'settings' => array( |
| 2267 | 2267 | array( |
| 2268 | 2268 | 'title' => '', |
@@ -2274,29 +2274,29 @@ discard block |
||
| 2274 | 2274 | ), |
| 2275 | 2275 | 'flyout_menu_item_padding' => array( |
| 2276 | 2276 | 'priority' => 90, |
| 2277 | - 'title' => __( 'Menu Item Padding', 'megamenu' ), |
|
| 2278 | - 'description' => __( 'Set the padding for each flyout menu item.', 'megamenu' ), |
|
| 2277 | + 'title' => __('Menu Item Padding', 'megamenu'), |
|
| 2278 | + 'description' => __('Set the padding for each flyout menu item.', 'megamenu'), |
|
| 2279 | 2279 | 'settings' => array( |
| 2280 | 2280 | array( |
| 2281 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 2281 | + 'title' => __('Top', 'megamenu'), |
|
| 2282 | 2282 | 'type' => 'freetext', |
| 2283 | 2283 | 'key' => 'flyout_link_padding_top', |
| 2284 | 2284 | 'validation' => 'px', |
| 2285 | 2285 | ), |
| 2286 | 2286 | array( |
| 2287 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 2287 | + 'title' => __('Right', 'megamenu'), |
|
| 2288 | 2288 | 'type' => 'freetext', |
| 2289 | 2289 | 'key' => 'flyout_link_padding_right', |
| 2290 | 2290 | 'validation' => 'px', |
| 2291 | 2291 | ), |
| 2292 | 2292 | array( |
| 2293 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2293 | + 'title' => __('Bottom', 'megamenu'), |
|
| 2294 | 2294 | 'type' => 'freetext', |
| 2295 | 2295 | 'key' => 'flyout_link_padding_bottom', |
| 2296 | 2296 | 'validation' => 'px', |
| 2297 | 2297 | ), |
| 2298 | 2298 | array( |
| 2299 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 2299 | + 'title' => __('Left', 'megamenu'), |
|
| 2300 | 2300 | 'type' => 'freetext', |
| 2301 | 2301 | 'key' => 'flyout_link_padding_left', |
| 2302 | 2302 | 'validation' => 'px', |
@@ -2305,37 +2305,37 @@ discard block |
||
| 2305 | 2305 | ), |
| 2306 | 2306 | 'flyout_menu_item_font' => array( |
| 2307 | 2307 | 'priority' => 100, |
| 2308 | - 'title' => __( 'Menu Item Font', 'megamenu' ), |
|
| 2309 | - 'description' => __( 'Set the font for the flyout menu items.', 'megamenu' ), |
|
| 2308 | + 'title' => __('Menu Item Font', 'megamenu'), |
|
| 2309 | + 'description' => __('Set the font for the flyout menu items.', 'megamenu'), |
|
| 2310 | 2310 | 'settings' => array( |
| 2311 | 2311 | array( |
| 2312 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2312 | + 'title' => __('Color', 'megamenu'), |
|
| 2313 | 2313 | 'type' => 'color', |
| 2314 | 2314 | 'key' => 'flyout_link_color', |
| 2315 | 2315 | ), |
| 2316 | 2316 | array( |
| 2317 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 2317 | + 'title' => __('Size', 'megamenu'), |
|
| 2318 | 2318 | 'type' => 'freetext', |
| 2319 | 2319 | 'key' => 'flyout_link_size', |
| 2320 | 2320 | 'validation' => 'px', |
| 2321 | 2321 | ), |
| 2322 | 2322 | array( |
| 2323 | - 'title' => __( 'Family', 'megamenu' ), |
|
| 2323 | + 'title' => __('Family', 'megamenu'), |
|
| 2324 | 2324 | 'type' => 'font', |
| 2325 | 2325 | 'key' => 'flyout_link_family', |
| 2326 | 2326 | ), |
| 2327 | 2327 | array( |
| 2328 | - 'title' => __( 'Transform', 'megamenu' ), |
|
| 2328 | + 'title' => __('Transform', 'megamenu'), |
|
| 2329 | 2329 | 'type' => 'transform', |
| 2330 | 2330 | 'key' => 'flyout_link_text_transform', |
| 2331 | 2331 | ), |
| 2332 | 2332 | array( |
| 2333 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 2333 | + 'title' => __('Weight', 'megamenu'), |
|
| 2334 | 2334 | 'type' => 'weight', |
| 2335 | 2335 | 'key' => 'flyout_link_weight', |
| 2336 | 2336 | ), |
| 2337 | 2337 | array( |
| 2338 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 2338 | + 'title' => __('Decoration', 'megamenu'), |
|
| 2339 | 2339 | 'type' => 'decoration', |
| 2340 | 2340 | 'key' => 'flyout_link_text_decoration', |
| 2341 | 2341 | ), |
@@ -2343,21 +2343,21 @@ discard block |
||
| 2343 | 2343 | ), |
| 2344 | 2344 | 'flyout_menu_item_font_hover' => array( |
| 2345 | 2345 | 'priority' => 110, |
| 2346 | - 'title' => __( 'Menu Item Font (Hover)', 'megamenu' ), |
|
| 2347 | - 'description' => __( 'Set the font for the flyout menu items.', 'megamenu' ), |
|
| 2346 | + 'title' => __('Menu Item Font (Hover)', 'megamenu'), |
|
| 2347 | + 'description' => __('Set the font for the flyout menu items.', 'megamenu'), |
|
| 2348 | 2348 | 'settings' => array( |
| 2349 | 2349 | array( |
| 2350 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2350 | + 'title' => __('Color', 'megamenu'), |
|
| 2351 | 2351 | 'type' => 'color', |
| 2352 | 2352 | 'key' => 'flyout_link_color_hover', |
| 2353 | 2353 | ), |
| 2354 | 2354 | array( |
| 2355 | - 'title' => __( 'Weight', 'megamenu' ), |
|
| 2355 | + 'title' => __('Weight', 'megamenu'), |
|
| 2356 | 2356 | 'type' => 'weight', |
| 2357 | 2357 | 'key' => 'flyout_link_weight_hover', |
| 2358 | 2358 | ), |
| 2359 | 2359 | array( |
| 2360 | - 'title' => __( 'Decoration', 'megamenu' ), |
|
| 2360 | + 'title' => __('Decoration', 'megamenu'), |
|
| 2361 | 2361 | 'type' => 'decoration', |
| 2362 | 2362 | 'key' => 'flyout_link_text_decoration_hover', |
| 2363 | 2363 | ), |
@@ -2365,16 +2365,16 @@ discard block |
||
| 2365 | 2365 | ), |
| 2366 | 2366 | 'flyout_menu_item_divider' => array( |
| 2367 | 2367 | 'priority' => 120, |
| 2368 | - 'title' => __( 'Menu Item Divider', 'megamenu' ), |
|
| 2369 | - 'description' => __( 'Show a line divider below each menu item.', 'megamenu' ), |
|
| 2368 | + 'title' => __('Menu Item Divider', 'megamenu'), |
|
| 2369 | + 'description' => __('Show a line divider below each menu item.', 'megamenu'), |
|
| 2370 | 2370 | 'settings' => array( |
| 2371 | 2371 | array( |
| 2372 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 2372 | + 'title' => __('Enabled', 'megamenu'), |
|
| 2373 | 2373 | 'type' => 'checkbox', |
| 2374 | 2374 | 'key' => 'flyout_menu_item_divider', |
| 2375 | 2375 | ), |
| 2376 | 2376 | array( |
| 2377 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2377 | + 'title' => __('Color', 'megamenu'), |
|
| 2378 | 2378 | 'type' => 'color', |
| 2379 | 2379 | 'key' => 'flyout_menu_item_divider_color', |
| 2380 | 2380 | ), |
@@ -2383,12 +2383,12 @@ discard block |
||
| 2383 | 2383 | ), |
| 2384 | 2384 | ), |
| 2385 | 2385 | 'mobile_menu' => array( |
| 2386 | - 'title' => __( 'Mobile Menu', 'megamenu' ), |
|
| 2386 | + 'title' => __('Mobile Menu', 'megamenu'), |
|
| 2387 | 2387 | 'settings' => array( |
| 2388 | 2388 | 'responsive_breakpoint' => array( |
| 2389 | 2389 | 'priority' => 2, |
| 2390 | - 'title' => __( 'Responsive Breakpoint', 'megamenu' ), |
|
| 2391 | - 'description' => __( 'The menu will be converted to a mobile menu when the browser width is below this value.', 'megamenu' ), |
|
| 2390 | + 'title' => __('Responsive Breakpoint', 'megamenu'), |
|
| 2391 | + 'description' => __('The menu will be converted to a mobile menu when the browser width is below this value.', 'megamenu'), |
|
| 2392 | 2392 | 'settings' => array( |
| 2393 | 2393 | array( |
| 2394 | 2394 | 'title' => '', |
@@ -2400,39 +2400,39 @@ discard block |
||
| 2400 | 2400 | ), |
| 2401 | 2401 | 'responsive_breakpoint_disabled' => array( |
| 2402 | 2402 | 'priority' => 3, |
| 2403 | - 'title' => __( "The 'Responsive Breakpoint' option has been set to 0px. The desktop version of the menu will be displayed for all browsers (regardless of the browser width), so the following options are disabled.", 'megamenu' ), |
|
| 2403 | + 'title' => __("The 'Responsive Breakpoint' option has been set to 0px. The desktop version of the menu will be displayed for all browsers (regardless of the browser width), so the following options are disabled.", 'megamenu'), |
|
| 2404 | 2404 | 'description' => '', |
| 2405 | 2405 | ), |
| 2406 | 2406 | 'mobile_toggle_bar' => array( |
| 2407 | 2407 | 'priority' => 4, |
| 2408 | - 'title' => __( 'Mobile Toggle Bar', 'megamenu' ), |
|
| 2408 | + 'title' => __('Mobile Toggle Bar', 'megamenu'), |
|
| 2409 | 2409 | 'description' => '', |
| 2410 | 2410 | ), |
| 2411 | 2411 | 'mobile_toggle_disabled' => array( |
| 2412 | 2412 | 'priority' => 5, |
| 2413 | - 'title' => __( "The 'Disable Mobile Toggle Bar' option has been enabled. The following options are disabled as the mobile toggle bar will not be displayed.", 'megamenu' ), |
|
| 2413 | + 'title' => __("The 'Disable Mobile Toggle Bar' option has been enabled. The following options are disabled as the mobile toggle bar will not be displayed.", 'megamenu'), |
|
| 2414 | 2414 | 'description' => '', |
| 2415 | 2415 | ), |
| 2416 | 2416 | 'toggle_bar_background' => array( |
| 2417 | 2417 | 'priority' => 20, |
| 2418 | - 'title' => __( 'Toggle Bar Background', 'megamenu' ), |
|
| 2419 | - 'description' => __( 'Set the background color for the mobile menu toggle bar.', 'megamenu' ), |
|
| 2418 | + 'title' => __('Toggle Bar Background', 'megamenu'), |
|
| 2419 | + 'description' => __('Set the background color for the mobile menu toggle bar.', 'megamenu'), |
|
| 2420 | 2420 | 'info' => array( |
| 2421 | - __( "Don't forget to update the Menu toggle block text and icon color in the Toggle Bar Designer above!", 'megamenu' ), |
|
| 2421 | + __("Don't forget to update the Menu toggle block text and icon color in the Toggle Bar Designer above!", 'megamenu'), |
|
| 2422 | 2422 | ), |
| 2423 | 2423 | 'settings' => array( |
| 2424 | 2424 | array( |
| 2425 | - 'title' => __( 'From', 'megamenu' ), |
|
| 2425 | + 'title' => __('From', 'megamenu'), |
|
| 2426 | 2426 | 'type' => 'color', |
| 2427 | 2427 | 'key' => 'toggle_background_from', |
| 2428 | 2428 | ), |
| 2429 | 2429 | array( |
| 2430 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 2430 | + 'title' => __('Copy', 'megamenu'), |
|
| 2431 | 2431 | 'type' => 'copy_color', |
| 2432 | 2432 | 'key' => 'copy_color', |
| 2433 | 2433 | ), |
| 2434 | 2434 | array( |
| 2435 | - 'title' => __( 'To', 'megamenu' ), |
|
| 2435 | + 'title' => __('To', 'megamenu'), |
|
| 2436 | 2436 | 'type' => 'color', |
| 2437 | 2437 | 'key' => 'toggle_background_to', |
| 2438 | 2438 | ), |
@@ -2440,8 +2440,8 @@ discard block |
||
| 2440 | 2440 | ), |
| 2441 | 2441 | 'toggle_bar_height' => array( |
| 2442 | 2442 | 'priority' => 25, |
| 2443 | - 'title' => __( 'Toggle Bar Height', 'megamenu' ), |
|
| 2444 | - 'description' => __( 'Set the height of the mobile menu toggle bar.', 'megamenu' ), |
|
| 2443 | + 'title' => __('Toggle Bar Height', 'megamenu'), |
|
| 2444 | + 'description' => __('Set the height of the mobile menu toggle bar.', 'megamenu'), |
|
| 2445 | 2445 | 'settings' => array( |
| 2446 | 2446 | array( |
| 2447 | 2447 | 'title' => '', |
@@ -2452,29 +2452,29 @@ discard block |
||
| 2452 | 2452 | ), |
| 2453 | 2453 | 'toggle_bar_border_radius' => array( |
| 2454 | 2454 | 'priority' => 26, |
| 2455 | - 'title' => __( 'Toggle Bar Border Radius', 'megamenu' ), |
|
| 2456 | - 'description' => __( 'Set a border radius on the mobile toggle bar.', 'megamenu' ), |
|
| 2455 | + 'title' => __('Toggle Bar Border Radius', 'megamenu'), |
|
| 2456 | + 'description' => __('Set a border radius on the mobile toggle bar.', 'megamenu'), |
|
| 2457 | 2457 | 'settings' => array( |
| 2458 | 2458 | array( |
| 2459 | - 'title' => __( 'Top Left', 'megamenu' ), |
|
| 2459 | + 'title' => __('Top Left', 'megamenu'), |
|
| 2460 | 2460 | 'type' => 'freetext', |
| 2461 | 2461 | 'key' => 'toggle_bar_border_radius_top_left', |
| 2462 | 2462 | 'validation' => 'px', |
| 2463 | 2463 | ), |
| 2464 | 2464 | array( |
| 2465 | - 'title' => __( 'Top Right', 'megamenu' ), |
|
| 2465 | + 'title' => __('Top Right', 'megamenu'), |
|
| 2466 | 2466 | 'type' => 'freetext', |
| 2467 | 2467 | 'key' => 'toggle_bar_border_radius_top_right', |
| 2468 | 2468 | 'validation' => 'px', |
| 2469 | 2469 | ), |
| 2470 | 2470 | array( |
| 2471 | - 'title' => __( 'Bottom Right', 'megamenu' ), |
|
| 2471 | + 'title' => __('Bottom Right', 'megamenu'), |
|
| 2472 | 2472 | 'type' => 'freetext', |
| 2473 | 2473 | 'key' => 'toggle_bar_border_radius_bottom_right', |
| 2474 | 2474 | 'validation' => 'px', |
| 2475 | 2475 | ), |
| 2476 | 2476 | array( |
| 2477 | - 'title' => __( 'Bottom Left', 'megamenu' ), |
|
| 2477 | + 'title' => __('Bottom Left', 'megamenu'), |
|
| 2478 | 2478 | 'type' => 'freetext', |
| 2479 | 2479 | 'key' => 'toggle_bar_border_radius_bottom_left', |
| 2480 | 2480 | 'validation' => 'px', |
@@ -2483,8 +2483,8 @@ discard block |
||
| 2483 | 2483 | ), |
| 2484 | 2484 | 'disable_mobile_toggle' => array( |
| 2485 | 2485 | 'priority' => 28, |
| 2486 | - 'title' => __( 'Disable Mobile Toggle Bar', 'megamenu' ), |
|
| 2487 | - 'description' => __( "Hide the toggle bar and display the menu in it's open state by default.", 'megamenu' ), |
|
| 2486 | + 'title' => __('Disable Mobile Toggle Bar', 'megamenu'), |
|
| 2487 | + 'description' => __("Hide the toggle bar and display the menu in it's open state by default.", 'megamenu'), |
|
| 2488 | 2488 | 'settings' => array( |
| 2489 | 2489 | array( |
| 2490 | 2490 | 'title' => '', |
@@ -2496,13 +2496,13 @@ discard block |
||
| 2496 | 2496 | |
| 2497 | 2497 | 'mobile_top_level_menu_items' => array( |
| 2498 | 2498 | 'priority' => 33, |
| 2499 | - 'title' => __( 'Mobile Sub Menu', 'megamenu' ), |
|
| 2499 | + 'title' => __('Mobile Sub Menu', 'megamenu'), |
|
| 2500 | 2500 | 'description' => '', |
| 2501 | 2501 | ), |
| 2502 | 2502 | 'mobile_menu_overlay' => array( |
| 2503 | 2503 | 'priority' => 34, |
| 2504 | - 'title' => __( 'Overlay Content', 'megamenu' ), |
|
| 2505 | - 'description' => __( 'If enabled, the mobile sub menu will overlay the page content (instead of pushing the page content down)', 'megamenu' ), |
|
| 2504 | + 'title' => __('Overlay Content', 'megamenu'), |
|
| 2505 | + 'description' => __('If enabled, the mobile sub menu will overlay the page content (instead of pushing the page content down)', 'megamenu'), |
|
| 2506 | 2506 | 'settings' => array( |
| 2507 | 2507 | array( |
| 2508 | 2508 | 'title' => '', |
@@ -2513,16 +2513,16 @@ discard block |
||
| 2513 | 2513 | ), |
| 2514 | 2514 | 'mobile_menu_force_width' => array( |
| 2515 | 2515 | 'priority' => 35, |
| 2516 | - 'title' => __( 'Force Full Width', 'megamenu' ), |
|
| 2517 | - 'description' => __( "If enabled, the mobile sub menu will match the width and position on the given page element (rather than being limited to the width of the toggle bar). For a full width sub menu, leave the 'Selector' value set to 'body'.", 'megamenu' ), |
|
| 2516 | + 'title' => __('Force Full Width', 'megamenu'), |
|
| 2517 | + 'description' => __("If enabled, the mobile sub menu will match the width and position on the given page element (rather than being limited to the width of the toggle bar). For a full width sub menu, leave the 'Selector' value set to 'body'.", 'megamenu'), |
|
| 2518 | 2518 | 'settings' => array( |
| 2519 | 2519 | array( |
| 2520 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 2520 | + 'title' => __('Enabled', 'megamenu'), |
|
| 2521 | 2521 | 'type' => 'checkbox', |
| 2522 | 2522 | 'key' => 'mobile_menu_force_width', |
| 2523 | 2523 | ), |
| 2524 | 2524 | array( |
| 2525 | - 'title' => __( 'Selector', 'megamenu' ), |
|
| 2525 | + 'title' => __('Selector', 'megamenu'), |
|
| 2526 | 2526 | 'type' => 'freetext', |
| 2527 | 2527 | 'key' => 'mobile_menu_force_width_selector', |
| 2528 | 2528 | ), |
@@ -2530,8 +2530,8 @@ discard block |
||
| 2530 | 2530 | ), |
| 2531 | 2531 | 'mobile_menu_off_canvas_width' => array( |
| 2532 | 2532 | 'priority' => 36, |
| 2533 | - 'title' => __( 'Off Canvas Width', 'megamenu' ), |
|
| 2534 | - 'description' => __( "The width of the sub menu if the Mobile Effect is set to 'Slide Left' or 'Slide Right'. Must be specified in px.", 'megamenu' ), |
|
| 2533 | + 'title' => __('Off Canvas Width', 'megamenu'), |
|
| 2534 | + 'description' => __("The width of the sub menu if the Mobile Effect is set to 'Slide Left' or 'Slide Right'. Must be specified in px.", 'megamenu'), |
|
| 2535 | 2535 | 'settings' => array( |
| 2536 | 2536 | array( |
| 2537 | 2537 | 'title' => '', |
@@ -2543,8 +2543,8 @@ discard block |
||
| 2543 | 2543 | ), |
| 2544 | 2544 | 'mobile_menu_item_height' => array( |
| 2545 | 2545 | 'priority' => 38, |
| 2546 | - 'title' => __( 'Menu Item Height', 'megamenu' ), |
|
| 2547 | - 'description' => __( 'Height of each top level item in the mobile menu.', 'megamenu' ), |
|
| 2546 | + 'title' => __('Menu Item Height', 'megamenu'), |
|
| 2547 | + 'description' => __('Height of each top level item in the mobile menu.', 'megamenu'), |
|
| 2548 | 2548 | 'settings' => array( |
| 2549 | 2549 | array( |
| 2550 | 2550 | 'title' => '', |
@@ -2555,29 +2555,29 @@ discard block |
||
| 2555 | 2555 | ), |
| 2556 | 2556 | 'mobile_menu_padding' => array( |
| 2557 | 2557 | 'priority' => 39, |
| 2558 | - 'title' => __( 'Menu Padding', 'megamenu' ), |
|
| 2559 | - 'description' => __( 'Padding for the mobile sub menu.', 'megamenu' ), |
|
| 2558 | + 'title' => __('Menu Padding', 'megamenu'), |
|
| 2559 | + 'description' => __('Padding for the mobile sub menu.', 'megamenu'), |
|
| 2560 | 2560 | 'settings' => array( |
| 2561 | 2561 | array( |
| 2562 | - 'title' => __( 'Top', 'megamenu' ), |
|
| 2562 | + 'title' => __('Top', 'megamenu'), |
|
| 2563 | 2563 | 'type' => 'freetext', |
| 2564 | 2564 | 'key' => 'mobile_menu_padding_top', |
| 2565 | 2565 | 'validation' => 'px', |
| 2566 | 2566 | ), |
| 2567 | 2567 | array( |
| 2568 | - 'title' => __( 'Right', 'megamenu' ), |
|
| 2568 | + 'title' => __('Right', 'megamenu'), |
|
| 2569 | 2569 | 'type' => 'freetext', |
| 2570 | 2570 | 'key' => 'mobile_menu_padding_right', |
| 2571 | 2571 | 'validation' => 'px', |
| 2572 | 2572 | ), |
| 2573 | 2573 | array( |
| 2574 | - 'title' => __( 'Bottom', 'megamenu' ), |
|
| 2574 | + 'title' => __('Bottom', 'megamenu'), |
|
| 2575 | 2575 | 'type' => 'freetext', |
| 2576 | 2576 | 'key' => 'mobile_menu_padding_bottom', |
| 2577 | 2577 | 'validation' => 'px', |
| 2578 | 2578 | ), |
| 2579 | 2579 | array( |
| 2580 | - 'title' => __( 'Left', 'megamenu' ), |
|
| 2580 | + 'title' => __('Left', 'megamenu'), |
|
| 2581 | 2581 | 'type' => 'freetext', |
| 2582 | 2582 | 'key' => 'mobile_menu_padding_left', |
| 2583 | 2583 | 'validation' => 'px', |
@@ -2586,21 +2586,21 @@ discard block |
||
| 2586 | 2586 | ), |
| 2587 | 2587 | 'mobile_background' => array( |
| 2588 | 2588 | 'priority' => 40, |
| 2589 | - 'title' => __( 'Menu Background', 'megamenu' ), |
|
| 2590 | - 'description' => __( 'The background color for the mobile menu.', 'megamenu' ), |
|
| 2589 | + 'title' => __('Menu Background', 'megamenu'), |
|
| 2590 | + 'description' => __('The background color for the mobile menu.', 'megamenu'), |
|
| 2591 | 2591 | 'settings' => array( |
| 2592 | 2592 | array( |
| 2593 | - 'title' => __( 'From', 'megamenu' ), |
|
| 2593 | + 'title' => __('From', 'megamenu'), |
|
| 2594 | 2594 | 'type' => 'color', |
| 2595 | 2595 | 'key' => 'mobile_background_from', |
| 2596 | 2596 | ), |
| 2597 | 2597 | array( |
| 2598 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 2598 | + 'title' => __('Copy', 'megamenu'), |
|
| 2599 | 2599 | 'type' => 'copy_color', |
| 2600 | 2600 | 'key' => 'copy_color', |
| 2601 | 2601 | ), |
| 2602 | 2602 | array( |
| 2603 | - 'title' => __( 'To', 'megamenu' ), |
|
| 2603 | + 'title' => __('To', 'megamenu'), |
|
| 2604 | 2604 | 'type' => 'color', |
| 2605 | 2605 | 'key' => 'mobile_background_to', |
| 2606 | 2606 | ), |
@@ -2608,21 +2608,21 @@ discard block |
||
| 2608 | 2608 | ), |
| 2609 | 2609 | 'mobile_background_hover' => array( |
| 2610 | 2610 | 'priority' => 45, |
| 2611 | - 'title' => __( 'Menu Item Background (Active)', 'megamenu' ), |
|
| 2612 | - 'description' => __( 'The background color for each top level menu item in the mobile menu when the sub menu is open.', 'megamenu' ), |
|
| 2611 | + 'title' => __('Menu Item Background (Active)', 'megamenu'), |
|
| 2612 | + 'description' => __('The background color for each top level menu item in the mobile menu when the sub menu is open.', 'megamenu'), |
|
| 2613 | 2613 | 'settings' => array( |
| 2614 | 2614 | array( |
| 2615 | - 'title' => __( 'From', 'megamenu' ), |
|
| 2615 | + 'title' => __('From', 'megamenu'), |
|
| 2616 | 2616 | 'type' => 'color', |
| 2617 | 2617 | 'key' => 'mobile_menu_item_background_hover_from', |
| 2618 | 2618 | ), |
| 2619 | 2619 | array( |
| 2620 | - 'title' => __( 'Copy', 'megamenu' ), |
|
| 2620 | + 'title' => __('Copy', 'megamenu'), |
|
| 2621 | 2621 | 'type' => 'copy_color', |
| 2622 | 2622 | 'key' => 'copy_color', |
| 2623 | 2623 | ), |
| 2624 | 2624 | array( |
| 2625 | - 'title' => __( 'To', 'megamenu' ), |
|
| 2625 | + 'title' => __('To', 'megamenu'), |
|
| 2626 | 2626 | 'type' => 'color', |
| 2627 | 2627 | 'key' => 'mobile_menu_item_background_hover_to', |
| 2628 | 2628 | ), |
@@ -2630,22 +2630,22 @@ discard block |
||
| 2630 | 2630 | ), |
| 2631 | 2631 | 'mobile_menu_item_font' => array( |
| 2632 | 2632 | 'priority' => 50, |
| 2633 | - 'title' => __( 'Font', 'megamenu' ), |
|
| 2634 | - 'description' => __( 'The font to use for each top level menu item in the mobile menu.', 'megamenu' ), |
|
| 2633 | + 'title' => __('Font', 'megamenu'), |
|
| 2634 | + 'description' => __('The font to use for each top level menu item in the mobile menu.', 'megamenu'), |
|
| 2635 | 2635 | 'settings' => array( |
| 2636 | 2636 | array( |
| 2637 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2637 | + 'title' => __('Color', 'megamenu'), |
|
| 2638 | 2638 | 'type' => 'color', |
| 2639 | 2639 | 'key' => 'mobile_menu_item_link_color', |
| 2640 | 2640 | ), |
| 2641 | 2641 | array( |
| 2642 | - 'title' => __( 'Size', 'megamenu' ), |
|
| 2642 | + 'title' => __('Size', 'megamenu'), |
|
| 2643 | 2643 | 'type' => 'freetext', |
| 2644 | 2644 | 'key' => 'mobile_menu_item_link_font_size', |
| 2645 | 2645 | 'validation' => 'px', |
| 2646 | 2646 | ), |
| 2647 | 2647 | array( |
| 2648 | - 'title' => __( 'Align', 'megamenu' ), |
|
| 2648 | + 'title' => __('Align', 'megamenu'), |
|
| 2649 | 2649 | 'type' => 'align', |
| 2650 | 2650 | 'key' => 'mobile_menu_item_link_text_align', |
| 2651 | 2651 | ), |
@@ -2653,11 +2653,11 @@ discard block |
||
| 2653 | 2653 | ), |
| 2654 | 2654 | 'mobile_menu_item_font_hover' => array( |
| 2655 | 2655 | 'priority' => 55, |
| 2656 | - 'title' => __( 'Font (Active)', 'megamenu' ), |
|
| 2657 | - 'description' => __( 'The font color for each top level menu item in the mobile menu when the sub menu is open.', 'megamenu' ), |
|
| 2656 | + 'title' => __('Font (Active)', 'megamenu'), |
|
| 2657 | + 'description' => __('The font color for each top level menu item in the mobile menu when the sub menu is open.', 'megamenu'), |
|
| 2658 | 2658 | 'settings' => array( |
| 2659 | 2659 | array( |
| 2660 | - 'title' => __( 'Color', 'megamenu' ), |
|
| 2660 | + 'title' => __('Color', 'megamenu'), |
|
| 2661 | 2661 | 'type' => 'color', |
| 2662 | 2662 | 'key' => 'mobile_menu_item_link_color_hover', |
| 2663 | 2663 | ), |
@@ -2665,13 +2665,13 @@ discard block |
||
| 2665 | 2665 | ), |
| 2666 | 2666 | 'mobile_mega_menus' => array( |
| 2667 | 2667 | 'priority' => 60, |
| 2668 | - 'title' => __( 'Mega Menus', 'megamenu' ), |
|
| 2668 | + 'title' => __('Mega Menus', 'megamenu'), |
|
| 2669 | 2669 | 'description' => '', |
| 2670 | 2670 | ), |
| 2671 | 2671 | 'mobile_columns' => array( |
| 2672 | 2672 | 'priority' => 65, |
| 2673 | - 'title' => __( 'Mega Menu Columns', 'megamenu' ), |
|
| 2674 | - 'description' => __( 'Collapse mega menu content into this many columns on mobile.', 'megamenu' ), |
|
| 2673 | + 'title' => __('Mega Menu Columns', 'megamenu'), |
|
| 2674 | + 'description' => __('Collapse mega menu content into this many columns on mobile.', 'megamenu'), |
|
| 2675 | 2675 | 'settings' => array( |
| 2676 | 2676 | array( |
| 2677 | 2677 | 'title' => '', |
@@ -2683,12 +2683,12 @@ discard block |
||
| 2683 | 2683 | ), |
| 2684 | 2684 | ), |
| 2685 | 2685 | 'custom_styling' => array( |
| 2686 | - 'title' => __( 'Custom Styling', 'megamenu' ), |
|
| 2686 | + 'title' => __('Custom Styling', 'megamenu'), |
|
| 2687 | 2687 | 'settings' => array( |
| 2688 | 2688 | 'custom_styling' => array( |
| 2689 | 2689 | 'priority' => 40, |
| 2690 | - 'title' => __( 'CSS Editor', 'megamenu' ), |
|
| 2691 | - 'description' => __( 'Define any custom CSS you wish to add to menus using this theme. You can use standard CSS or SCSS.', 'megamenu' ), |
|
| 2690 | + 'title' => __('CSS Editor', 'megamenu'), |
|
| 2691 | + 'description' => __('Define any custom CSS you wish to add to menus using this theme. You can use standard CSS or SCSS.', 'megamenu'), |
|
| 2692 | 2692 | 'settings' => array( |
| 2693 | 2693 | array( |
| 2694 | 2694 | 'title' => '', |
@@ -2706,9 +2706,9 @@ discard block |
||
| 2706 | 2706 | |
| 2707 | 2707 | $is_first = true; |
| 2708 | 2708 | |
| 2709 | - foreach ( $settings as $section_id => $section ) { |
|
| 2709 | + foreach ($settings as $section_id => $section) { |
|
| 2710 | 2710 | |
| 2711 | - if ( $is_first ) { |
|
| 2711 | + if ($is_first) { |
|
| 2712 | 2712 | $active = 'nav-tab-active '; |
| 2713 | 2713 | $is_first = false; |
| 2714 | 2714 | } else { |
@@ -2723,9 +2723,9 @@ discard block |
||
| 2723 | 2723 | |
| 2724 | 2724 | $is_first = true; |
| 2725 | 2725 | |
| 2726 | - foreach ( $settings as $section_id => $section ) { |
|
| 2726 | + foreach ($settings as $section_id => $section) { |
|
| 2727 | 2727 | |
| 2728 | - if ( $is_first ) { |
|
| 2728 | + if ($is_first) { |
|
| 2729 | 2729 | $display = 'block'; |
| 2730 | 2730 | $is_first = false; |
| 2731 | 2731 | } else { |
@@ -2736,65 +2736,65 @@ discard block |
||
| 2736 | 2736 | echo " <table class='{$section_id}'>"; |
| 2737 | 2737 | |
| 2738 | 2738 | // order the fields by priority |
| 2739 | - uasort( $section['settings'], array( $this, 'compare_elems' ) ); |
|
| 2739 | + uasort($section['settings'], array($this, 'compare_elems')); |
|
| 2740 | 2740 | |
| 2741 | - foreach ( $section['settings'] as $group_id => $group ) { |
|
| 2741 | + foreach ($section['settings'] as $group_id => $group) { |
|
| 2742 | 2742 | |
| 2743 | 2743 | echo "<tr class='mega-{$group_id}'>"; |
| 2744 | 2744 | |
| 2745 | - if ( isset( $group['settings'] ) ) { |
|
| 2745 | + if (isset($group['settings'])) { |
|
| 2746 | 2746 | |
| 2747 | 2747 | echo "<td class='mega-name'>" . $group['title'] . "<div class='mega-description'>" . $group['description'] . '</div></td>'; |
| 2748 | 2748 | echo "<td class='mega-value'>"; |
| 2749 | 2749 | |
| 2750 | - foreach ( $group['settings'] as $setting_id => $setting ) { |
|
| 2750 | + foreach ($group['settings'] as $setting_id => $setting) { |
|
| 2751 | 2751 | |
| 2752 | - if ( isset( $setting['validation'] ) ) { |
|
| 2752 | + if (isset($setting['validation'])) { |
|
| 2753 | 2753 | echo "<label class='mega-{$setting['key']}' data-validation='{$setting['validation']}'>"; |
| 2754 | 2754 | } else { |
| 2755 | 2755 | echo "<label class='mega-{$setting['key']}'>"; |
| 2756 | 2756 | } |
| 2757 | 2757 | echo "<span class='mega-short-desc'>{$setting['title']}</span>"; |
| 2758 | 2758 | |
| 2759 | - switch ( $setting['type'] ) { |
|
| 2759 | + switch ($setting['type']) { |
|
| 2760 | 2760 | case 'freetext': |
| 2761 | - $this->print_theme_freetext_option( $setting['key'] ); |
|
| 2761 | + $this->print_theme_freetext_option($setting['key']); |
|
| 2762 | 2762 | break; |
| 2763 | 2763 | case 'textarea': |
| 2764 | - $this->print_theme_textarea_option( $setting['key'] ); |
|
| 2764 | + $this->print_theme_textarea_option($setting['key']); |
|
| 2765 | 2765 | break; |
| 2766 | 2766 | case 'align': |
| 2767 | - $this->print_theme_align_option( $setting['key'] ); |
|
| 2767 | + $this->print_theme_align_option($setting['key']); |
|
| 2768 | 2768 | break; |
| 2769 | 2769 | case 'checkbox': |
| 2770 | - $this->print_theme_checkbox_option( $setting['key'] ); |
|
| 2770 | + $this->print_theme_checkbox_option($setting['key']); |
|
| 2771 | 2771 | break; |
| 2772 | 2772 | case 'arrow': |
| 2773 | - $this->print_theme_arrow_option( $setting['key'] ); |
|
| 2773 | + $this->print_theme_arrow_option($setting['key']); |
|
| 2774 | 2774 | break; |
| 2775 | 2775 | case 'color': |
| 2776 | - $this->print_theme_color_option( $setting['key'] ); |
|
| 2776 | + $this->print_theme_color_option($setting['key']); |
|
| 2777 | 2777 | break; |
| 2778 | 2778 | case 'weight': |
| 2779 | - $this->print_theme_weight_option( $setting['key'] ); |
|
| 2779 | + $this->print_theme_weight_option($setting['key']); |
|
| 2780 | 2780 | break; |
| 2781 | 2781 | case 'font': |
| 2782 | - $this->print_theme_font_option( $setting['key'] ); |
|
| 2782 | + $this->print_theme_font_option($setting['key']); |
|
| 2783 | 2783 | break; |
| 2784 | 2784 | case 'transform': |
| 2785 | - $this->print_theme_transform_option( $setting['key'] ); |
|
| 2785 | + $this->print_theme_transform_option($setting['key']); |
|
| 2786 | 2786 | break; |
| 2787 | 2787 | case 'decoration': |
| 2788 | - $this->print_theme_text_decoration_option( $setting['key'] ); |
|
| 2788 | + $this->print_theme_text_decoration_option($setting['key']); |
|
| 2789 | 2789 | break; |
| 2790 | 2790 | case 'mobile_columns': |
| 2791 | - $this->print_theme_mobile_columns_option( $setting['key'] ); |
|
| 2791 | + $this->print_theme_mobile_columns_option($setting['key']); |
|
| 2792 | 2792 | break; |
| 2793 | 2793 | case 'copy_color': |
| 2794 | - $this->print_theme_copy_color_option( $setting['key'] ); |
|
| 2794 | + $this->print_theme_copy_color_option($setting['key']); |
|
| 2795 | 2795 | break; |
| 2796 | 2796 | default: |
| 2797 | - do_action( "megamenu_print_theme_option_{$setting['type']}", $setting['key'], $this->id ); |
|
| 2797 | + do_action("megamenu_print_theme_option_{$setting['type']}", $setting['key'], $this->id); |
|
| 2798 | 2798 | break; |
| 2799 | 2799 | } |
| 2800 | 2800 | |
@@ -2802,30 +2802,30 @@ discard block |
||
| 2802 | 2802 | |
| 2803 | 2803 | } |
| 2804 | 2804 | |
| 2805 | - if ( isset( $group['info'] ) ) { |
|
| 2806 | - foreach ( $group['info'] as $paragraph ) { |
|
| 2805 | + if (isset($group['info'])) { |
|
| 2806 | + foreach ($group['info'] as $paragraph) { |
|
| 2807 | 2807 | echo "<div class='mega-info'>{$paragraph}</div>"; |
| 2808 | 2808 | } |
| 2809 | 2809 | } |
| 2810 | 2810 | |
| 2811 | - foreach ( $group['settings'] as $setting_id => $setting ) { |
|
| 2812 | - if ( isset( $setting['validation'] ) ) { |
|
| 2811 | + foreach ($group['settings'] as $setting_id => $setting) { |
|
| 2812 | + if (isset($setting['validation'])) { |
|
| 2813 | 2813 | |
| 2814 | 2814 | echo "<div class='mega-validation-message mega-validation-message-mega-{$setting['key']}'>"; |
| 2815 | 2815 | |
| 2816 | - if ( $setting['validation'] == 'int' ) { |
|
| 2817 | - $message = __( 'Enter a whole number (e.g. 1, 5, 100, 999)' ); |
|
| 2816 | + if ($setting['validation'] == 'int') { |
|
| 2817 | + $message = __('Enter a whole number (e.g. 1, 5, 100, 999)'); |
|
| 2818 | 2818 | } |
| 2819 | 2819 | |
| 2820 | - if ( $setting['validation'] == 'px' ) { |
|
| 2821 | - $message = __( 'Enter a value including a unit (e.g. 10px, 10rem, 10%)' ); |
|
| 2820 | + if ($setting['validation'] == 'px') { |
|
| 2821 | + $message = __('Enter a value including a unit (e.g. 10px, 10rem, 10%)'); |
|
| 2822 | 2822 | } |
| 2823 | 2823 | |
| 2824 | - if ( $setting['validation'] == 'float' ) { |
|
| 2825 | - $message = __( 'Enter a valid number (e.g. 0.1, 1, 10, 999)' ); |
|
| 2824 | + if ($setting['validation'] == 'float') { |
|
| 2825 | + $message = __('Enter a valid number (e.g. 0.1, 1, 10, 999)'); |
|
| 2826 | 2826 | } |
| 2827 | 2827 | |
| 2828 | - if ( strlen( $setting['title'] ) ) { |
|
| 2828 | + if (strlen($setting['title'])) { |
|
| 2829 | 2829 | echo $setting['title'] . ': ' . $message; |
| 2830 | 2830 | } else { |
| 2831 | 2831 | echo $message; |
@@ -2876,25 +2876,25 @@ discard block |
||
| 2876 | 2876 | |
| 2877 | 2877 | $active_plugins = max_mega_menu_get_active_caching_plugins(); |
| 2878 | 2878 | |
| 2879 | - if ( count( $active_plugins ) ) : |
|
| 2879 | + if (count($active_plugins)) : |
|
| 2880 | 2880 | |
| 2881 | 2881 | ?> |
| 2882 | 2882 | |
| 2883 | 2883 | <div> |
| 2884 | 2884 | |
| 2885 | - <h3><?php _e( 'Changes not showing up?', 'megamenu' ); ?></h3> |
|
| 2885 | + <h3><?php _e('Changes not showing up?', 'megamenu'); ?></h3> |
|
| 2886 | 2886 | |
| 2887 | - <p><?php echo _n( 'We have detected the following plugin that may prevent changes made within the theme editor from being applied to the menu.', 'We have detected the following plugins that may prevent changes made within the theme editor from being applied to the menu.', count( $active_plugins ), 'megamenu' ); ?></p> |
|
| 2887 | + <p><?php echo _n('We have detected the following plugin that may prevent changes made within the theme editor from being applied to the menu.', 'We have detected the following plugins that may prevent changes made within the theme editor from being applied to the menu.', count($active_plugins), 'megamenu'); ?></p> |
|
| 2888 | 2888 | |
| 2889 | 2889 | <ul class='ul-disc'> |
| 2890 | 2890 | <?php |
| 2891 | - foreach ( $active_plugins as $name ) { |
|
| 2891 | + foreach ($active_plugins as $name) { |
|
| 2892 | 2892 | echo '<li>' . $name . '</li>'; |
| 2893 | 2893 | } |
| 2894 | 2894 | ?> |
| 2895 | 2895 | </ul> |
| 2896 | 2896 | |
| 2897 | - <p><?php echo _n( 'Try clearing the cache of the above plugin if your changes are not being applied to the menu.', 'Try clearing the caches of the above plugins if your changes are not being applied to the menu.', count( $active_plugins ), 'megamenu' ); ?></p> |
|
| 2897 | + <p><?php echo _n('Try clearing the cache of the above plugin if your changes are not being applied to the menu.', 'Try clearing the caches of the above plugins if your changes are not being applied to the menu.', count($active_plugins), 'megamenu'); ?></p> |
|
| 2898 | 2898 | |
| 2899 | 2899 | </div> |
| 2900 | 2900 | |
@@ -2912,12 +2912,12 @@ discard block |
||
| 2912 | 2912 | * @return bool |
| 2913 | 2913 | * @since 2.1 |
| 2914 | 2914 | */ |
| 2915 | - private function compare_elems( $elem1, $elem2 ) { |
|
| 2916 | - if ( $elem1['priority'] > $elem2['priority'] ) { |
|
| 2915 | + private function compare_elems($elem1, $elem2) { |
|
| 2916 | + if ($elem1['priority'] > $elem2['priority']) { |
|
| 2917 | 2917 | return 1; |
| 2918 | 2918 | } |
| 2919 | 2919 | |
| 2920 | - if ( $elem1['priority'] == $elem2['priority'] ) { |
|
| 2920 | + if ($elem1['priority'] == $elem2['priority']) { |
|
| 2921 | 2921 | return 0; |
| 2922 | 2922 | } |
| 2923 | 2923 | |
@@ -2932,16 +2932,16 @@ discard block |
||
| 2932 | 2932 | * @param string $key |
| 2933 | 2933 | * @param string $value |
| 2934 | 2934 | */ |
| 2935 | - public function print_theme_align_option( $key ) { |
|
| 2935 | + public function print_theme_align_option($key) { |
|
| 2936 | 2936 | |
| 2937 | - $value = $this->active_theme[ $key ]; |
|
| 2937 | + $value = $this->active_theme[$key]; |
|
| 2938 | 2938 | |
| 2939 | 2939 | ?> |
| 2940 | 2940 | |
| 2941 | 2941 | <select name='settings[<?php echo $key; ?>]'> |
| 2942 | - <option value='left' <?php selected( $value, 'left' ); ?>><?php _e( 'Left', 'megamenu' ); ?></option> |
|
| 2943 | - <option value='center' <?php selected( $value, 'center' ); ?>><?php _e( 'Center', 'megamenu' ); ?></option> |
|
| 2944 | - <option value='right' <?php selected( $value, 'right' ); ?>><?php _e( 'Right', 'megamenu' ); ?></option> |
|
| 2942 | + <option value='left' <?php selected($value, 'left'); ?>><?php _e('Left', 'megamenu'); ?></option> |
|
| 2943 | + <option value='center' <?php selected($value, 'center'); ?>><?php _e('Center', 'megamenu'); ?></option> |
|
| 2944 | + <option value='right' <?php selected($value, 'right'); ?>><?php _e('Right', 'megamenu'); ?></option> |
|
| 2945 | 2945 | </select> |
| 2946 | 2946 | |
| 2947 | 2947 | <?php |
@@ -2955,7 +2955,7 @@ discard block |
||
| 2955 | 2955 | * @param string $key |
| 2956 | 2956 | * @param string $value |
| 2957 | 2957 | */ |
| 2958 | - public function print_theme_copy_color_option( $key ) { |
|
| 2958 | + public function print_theme_copy_color_option($key) { |
|
| 2959 | 2959 | |
| 2960 | 2960 | ?> |
| 2961 | 2961 | |
@@ -2972,15 +2972,15 @@ discard block |
||
| 2972 | 2972 | * @param string $key |
| 2973 | 2973 | * @param string $value |
| 2974 | 2974 | */ |
| 2975 | - public function print_theme_mobile_columns_option( $key ) { |
|
| 2975 | + public function print_theme_mobile_columns_option($key) { |
|
| 2976 | 2976 | |
| 2977 | - $value = $this->active_theme[ $key ]; |
|
| 2977 | + $value = $this->active_theme[$key]; |
|
| 2978 | 2978 | |
| 2979 | 2979 | ?> |
| 2980 | 2980 | |
| 2981 | 2981 | <select name='settings[<?php echo $key; ?>]'> |
| 2982 | - <option value='1' <?php selected( $value, '1' ); ?>><?php _e( '1 Column', 'megamenu' ); ?></option> |
|
| 2983 | - <option value='2' <?php selected( $value, '2' ); ?>><?php _e( '2 Columns', 'megamenu' ); ?></option> |
|
| 2982 | + <option value='1' <?php selected($value, '1'); ?>><?php _e('1 Column', 'megamenu'); ?></option> |
|
| 2983 | + <option value='2' <?php selected($value, '2'); ?>><?php _e('2 Columns', 'megamenu'); ?></option> |
|
| 2984 | 2984 | </select> |
| 2985 | 2985 | |
| 2986 | 2986 | <?php |
@@ -2994,15 +2994,15 @@ discard block |
||
| 2994 | 2994 | * @param string $key |
| 2995 | 2995 | * @param string $value |
| 2996 | 2996 | */ |
| 2997 | - public function print_theme_text_decoration_option( $key ) { |
|
| 2997 | + public function print_theme_text_decoration_option($key) { |
|
| 2998 | 2998 | |
| 2999 | - $value = $this->active_theme[ $key ]; |
|
| 2999 | + $value = $this->active_theme[$key]; |
|
| 3000 | 3000 | |
| 3001 | 3001 | ?> |
| 3002 | 3002 | |
| 3003 | 3003 | <select name='settings[<?php echo $key; ?>]'> |
| 3004 | - <option value='none' <?php selected( $value, 'none' ); ?>><?php _e( 'None', 'megamenu' ); ?></option> |
|
| 3005 | - <option value='underline' <?php selected( $value, 'underline' ); ?>><?php _e( 'Underline', 'megamenu' ); ?></option> |
|
| 3004 | + <option value='none' <?php selected($value, 'none'); ?>><?php _e('None', 'megamenu'); ?></option> |
|
| 3005 | + <option value='underline' <?php selected($value, 'underline'); ?>><?php _e('Underline', 'megamenu'); ?></option> |
|
| 3006 | 3006 | </select> |
| 3007 | 3007 | |
| 3008 | 3008 | <?php |
@@ -3016,14 +3016,14 @@ discard block |
||
| 3016 | 3016 | * @param string $key |
| 3017 | 3017 | * @param string $value |
| 3018 | 3018 | */ |
| 3019 | - public function print_theme_checkbox_option( $key ) { |
|
| 3019 | + public function print_theme_checkbox_option($key) { |
|
| 3020 | 3020 | |
| 3021 | - $value = $this->active_theme[ $key ]; |
|
| 3021 | + $value = $this->active_theme[$key]; |
|
| 3022 | 3022 | |
| 3023 | 3023 | ?> |
| 3024 | 3024 | |
| 3025 | 3025 | <input type='hidden' name='checkboxes[<?php echo $key; ?>]' /> |
| 3026 | - <input type='checkbox' name='settings[<?php echo $key; ?>]' <?php checked( $value, 'on' ); ?> /> |
|
| 3026 | + <input type='checkbox' name='settings[<?php echo $key; ?>]' <?php checked($value, 'on'); ?> /> |
|
| 3027 | 3027 | |
| 3028 | 3028 | <?php |
| 3029 | 3029 | } |
@@ -3036,9 +3036,9 @@ discard block |
||
| 3036 | 3036 | * @param string $key |
| 3037 | 3037 | * @param string $value |
| 3038 | 3038 | */ |
| 3039 | - public function print_theme_arrow_option( $key ) { |
|
| 3039 | + public function print_theme_arrow_option($key) { |
|
| 3040 | 3040 | |
| 3041 | - $value = $this->active_theme[ $key ]; |
|
| 3041 | + $value = $this->active_theme[$key]; |
|
| 3042 | 3042 | |
| 3043 | 3043 | $arrow_icons = $this->arrow_icons(); |
| 3044 | 3044 | |
@@ -3046,12 +3046,12 @@ discard block |
||
| 3046 | 3046 | <select class='icon_dropdown' name='settings[<?php echo $key; ?>]'> |
| 3047 | 3047 | <?php |
| 3048 | 3048 | |
| 3049 | - echo "<option value='disabled'>" . __( 'Disabled', 'megamenu' ) . '</option>'; |
|
| 3049 | + echo "<option value='disabled'>" . __('Disabled', 'megamenu') . '</option>'; |
|
| 3050 | 3050 | |
| 3051 | - foreach ( $arrow_icons as $code => $class ) { |
|
| 3052 | - $name = str_replace( 'dashicons-', '', $class ); |
|
| 3053 | - $name = ucwords( str_replace( array( '-', 'arrow' ), ' ', $name ) ); |
|
| 3054 | - echo "<option data-class='{$class}' value='{$code}' " . selected( $value, $code, false ) . '>' . esc_html( $name ) . '</option>'; |
|
| 3051 | + foreach ($arrow_icons as $code => $class) { |
|
| 3052 | + $name = str_replace('dashicons-', '', $class); |
|
| 3053 | + $name = ucwords(str_replace(array('-', 'arrow'), ' ', $name)); |
|
| 3054 | + echo "<option data-class='{$class}' value='{$code}' " . selected($value, $code, false) . '>' . esc_html($name) . '</option>'; |
|
| 3055 | 3055 | } |
| 3056 | 3056 | |
| 3057 | 3057 | ?> |
@@ -3069,23 +3069,23 @@ discard block |
||
| 3069 | 3069 | * @param string $key |
| 3070 | 3070 | * @param string $value |
| 3071 | 3071 | */ |
| 3072 | - public function print_theme_color_option( $key ) { |
|
| 3072 | + public function print_theme_color_option($key) { |
|
| 3073 | 3073 | |
| 3074 | - $value = $this->active_theme[ $key ]; |
|
| 3074 | + $value = $this->active_theme[$key]; |
|
| 3075 | 3075 | |
| 3076 | - if ( $value == 'transparent' ) { |
|
| 3076 | + if ($value == 'transparent') { |
|
| 3077 | 3077 | $value = 'rgba(0,0,0,0)'; |
| 3078 | 3078 | } |
| 3079 | 3079 | |
| 3080 | - if ( $value == 'rgba(0,0,0,0)' ) { |
|
| 3080 | + if ($value == 'rgba(0,0,0,0)') { |
|
| 3081 | 3081 | $value_text = 'transparent'; |
| 3082 | 3082 | } else { |
| 3083 | 3083 | $value_text = $value; |
| 3084 | 3084 | } |
| 3085 | 3085 | |
| 3086 | 3086 | echo "<div class='mm-picker-container'>"; |
| 3087 | - echo " <input type='text' class='mm_colorpicker' name='settings[$key]' value='" . esc_attr( $value ) . "' />"; |
|
| 3088 | - echo " <div class='chosen-color'>" . esc_html( $value_text ) . '</div>'; |
|
| 3087 | + echo " <input type='text' class='mm_colorpicker' name='settings[$key]' value='" . esc_attr($value) . "' />"; |
|
| 3088 | + echo " <div class='chosen-color'>" . esc_html($value_text) . '</div>'; |
|
| 3089 | 3089 | echo '</div>'; |
| 3090 | 3090 | |
| 3091 | 3091 | } |
@@ -3098,17 +3098,17 @@ discard block |
||
| 3098 | 3098 | * @param string $key |
| 3099 | 3099 | * @param string $value |
| 3100 | 3100 | */ |
| 3101 | - public function print_theme_weight_option( $key ) { |
|
| 3101 | + public function print_theme_weight_option($key) { |
|
| 3102 | 3102 | |
| 3103 | - $value = $this->active_theme[ $key ]; |
|
| 3103 | + $value = $this->active_theme[$key]; |
|
| 3104 | 3104 | |
| 3105 | 3105 | $options = apply_filters( |
| 3106 | 3106 | 'megamenu_font_weights', |
| 3107 | 3107 | array( |
| 3108 | - 'inherit' => __( 'Theme Default', 'megamenu' ), |
|
| 3109 | - '300' => __( 'Light (300)', 'megamenu' ), |
|
| 3110 | - 'normal' => __( 'Normal (400)', 'megamenu' ), |
|
| 3111 | - 'bold' => __( 'Bold (700)', 'megamenu' ), |
|
| 3108 | + 'inherit' => __('Theme Default', 'megamenu'), |
|
| 3109 | + '300' => __('Light (300)', 'megamenu'), |
|
| 3110 | + 'normal' => __('Normal (400)', 'megamenu'), |
|
| 3111 | + 'bold' => __('Bold (700)', 'megamenu'), |
|
| 3112 | 3112 | ) |
| 3113 | 3113 | ); |
| 3114 | 3114 | |
@@ -3126,8 +3126,8 @@ discard block |
||
| 3126 | 3126 | |
| 3127 | 3127 | echo "<select name='settings[$key]'>"; |
| 3128 | 3128 | |
| 3129 | - foreach ( $options as $weight => $name ) { |
|
| 3130 | - echo "<option value='" . esc_attr( $weight ) . "' " . selected( $value, $weight, false ) . '>' . esc_html( $name ) . '</option>'; |
|
| 3129 | + foreach ($options as $weight => $name) { |
|
| 3130 | + echo "<option value='" . esc_attr($weight) . "' " . selected($value, $weight, false) . '>' . esc_html($name) . '</option>'; |
|
| 3131 | 3131 | } |
| 3132 | 3132 | |
| 3133 | 3133 | echo '</select>'; |
@@ -3142,15 +3142,15 @@ discard block |
||
| 3142 | 3142 | * @param string $key |
| 3143 | 3143 | * @param string $value |
| 3144 | 3144 | */ |
| 3145 | - public function print_theme_transform_option( $key ) { |
|
| 3145 | + public function print_theme_transform_option($key) { |
|
| 3146 | 3146 | |
| 3147 | - $value = $this->active_theme[ $key ]; |
|
| 3147 | + $value = $this->active_theme[$key]; |
|
| 3148 | 3148 | |
| 3149 | 3149 | echo "<select name='settings[$key]'>"; |
| 3150 | - echo " <option value='none' " . selected( $value, 'none', false ) . '>' . __( 'Normal', 'megamenu' ) . '</option>'; |
|
| 3151 | - echo " <option value='capitalize'" . selected( $value, 'capitalize', false ) . '>' . __( 'Capitalize', 'megamenu' ) . '</option>'; |
|
| 3152 | - echo " <option value='uppercase'" . selected( $value, 'uppercase', false ) . '>' . __( 'UPPERCASE', 'megamenu' ) . '</option>'; |
|
| 3153 | - echo " <option value='lowercase'" . selected( $value, 'lowercase', false ) . '>' . __( 'lowercase', 'megamenu' ) . '</option>'; |
|
| 3150 | + echo " <option value='none' " . selected($value, 'none', false) . '>' . __('Normal', 'megamenu') . '</option>'; |
|
| 3151 | + echo " <option value='capitalize'" . selected($value, 'capitalize', false) . '>' . __('Capitalize', 'megamenu') . '</option>'; |
|
| 3152 | + echo " <option value='uppercase'" . selected($value, 'uppercase', false) . '>' . __('UPPERCASE', 'megamenu') . '</option>'; |
|
| 3153 | + echo " <option value='lowercase'" . selected($value, 'lowercase', false) . '>' . __('lowercase', 'megamenu') . '</option>'; |
|
| 3154 | 3154 | echo '</select>'; |
| 3155 | 3155 | |
| 3156 | 3156 | } |
@@ -3163,35 +3163,35 @@ discard block |
||
| 3163 | 3163 | * @param string $key |
| 3164 | 3164 | * @param string $value |
| 3165 | 3165 | */ |
| 3166 | - public function print_theme_textarea_option( $key ) { |
|
| 3166 | + public function print_theme_textarea_option($key) { |
|
| 3167 | 3167 | |
| 3168 | - $value = sanitize_textarea_field( $this->active_theme[ $key ] ); |
|
| 3168 | + $value = sanitize_textarea_field($this->active_theme[$key]); |
|
| 3169 | 3169 | |
| 3170 | 3170 | ?> |
| 3171 | 3171 | |
| 3172 | - <textarea id='codemirror' name='settings[<?php echo $key; ?>]'><?php echo stripslashes( $value ); ?></textarea> |
|
| 3172 | + <textarea id='codemirror' name='settings[<?php echo $key; ?>]'><?php echo stripslashes($value); ?></textarea> |
|
| 3173 | 3173 | |
| 3174 | - <p><b><?php _e( 'Custom Styling Tips', 'megamenu' ); ?></b></p> |
|
| 3175 | - <p><?php _e( "You can enter standard CSS or <a href='https://sass-lang.com/guide' target='_blank'>SCSS</a> into the custom styling area. If using SCSS there are some variables and mixins you can use:", 'megamenu'); ?></p> |
|
| 3174 | + <p><b><?php _e('Custom Styling Tips', 'megamenu'); ?></b></p> |
|
| 3175 | + <p><?php _e("You can enter standard CSS or <a href='https://sass-lang.com/guide' target='_blank'>SCSS</a> into the custom styling area. If using SCSS there are some variables and mixins you can use:", 'megamenu'); ?></p> |
|
| 3176 | 3176 | |
| 3177 | 3177 | <ul class='custom_styling_tips'> |
| 3178 | - <li><code>#{$wrap}</code> <?php _e( 'converts to the ID selector of the menu wrapper, e.g. div#mega-menu-wrap-primary', 'megamenu' ); ?></li> |
|
| 3179 | - <li><code>#{$menu}</code> <?php _e( 'converts to the ID selector of the menu, e.g. ul#mega-menu-primary', 'megamenu' ); ?></li> |
|
| 3180 | - <li><code>@include mobile|desktop { .. }</code> <?php _e( 'wraps the CSS within a media query based on the configured Responsive Breakpoint (see example CSS)', 'megamenu' ); ?></li> |
|
| 3178 | + <li><code>#{$wrap}</code> <?php _e('converts to the ID selector of the menu wrapper, e.g. div#mega-menu-wrap-primary', 'megamenu'); ?></li> |
|
| 3179 | + <li><code>#{$menu}</code> <?php _e('converts to the ID selector of the menu, e.g. ul#mega-menu-primary', 'megamenu'); ?></li> |
|
| 3180 | + <li><code>@include mobile|desktop { .. }</code> <?php _e('wraps the CSS within a media query based on the configured Responsive Breakpoint (see example CSS)', 'megamenu'); ?></li> |
|
| 3181 | 3181 | <?php |
| 3182 | - $string = __( 'Using the %wrap% and %menu% variables makes your theme portable (allowing you to apply the same theme to multiple menu locations)', 'megamenu' ); |
|
| 3183 | - $string = str_replace( '%wrap%', '<code>#{$wrap}</code>', $string ); |
|
| 3184 | - $string = str_replace( '%menu%', '<code>#{$menu}</code>', $string ); |
|
| 3182 | + $string = __('Using the %wrap% and %menu% variables makes your theme portable (allowing you to apply the same theme to multiple menu locations)', 'megamenu'); |
|
| 3183 | + $string = str_replace('%wrap%', '<code>#{$wrap}</code>', $string); |
|
| 3184 | + $string = str_replace('%menu%', '<code>#{$menu}</code>', $string); |
|
| 3185 | 3185 | ?> |
| 3186 | 3186 | <li><?php echo $string; ?></li> |
| 3187 | - <li><?php _e( 'Example CSS', 'megamenu' ); ?>:</li> |
|
| 3188 | - <code>/** <?php _e( 'Add text shadow to top level menu items on desktop AND mobile', 'megamenu' ); ?> **/ |
|
| 3187 | + <li><?php _e('Example CSS', 'megamenu'); ?>:</li> |
|
| 3188 | + <code>/** <?php _e('Add text shadow to top level menu items on desktop AND mobile', 'megamenu'); ?> **/ |
|
| 3189 | 3189 | <br />#{$wrap} #{$menu} > li.mega-menu-item > a.mega-menu-link { |
| 3190 | 3190 | <br /> text-shadow: 1px 1px #000000; |
| 3191 | 3191 | <br />} |
| 3192 | 3192 | </code> |
| 3193 | 3193 | <br /><br /> |
| 3194 | - <code>/** <?php _e( 'Add text shadow to top level menu items on desktop only', 'megamenu' ); ?> **/ |
|
| 3194 | + <code>/** <?php _e('Add text shadow to top level menu items on desktop only', 'megamenu'); ?> **/ |
|
| 3195 | 3195 | <br />@include desktop { |
| 3196 | 3196 | <br /> #{$wrap} #{$menu} > li.mega-menu-item > a.mega-menu-link { |
| 3197 | 3197 | <br /> text-shadow: 1px 1px #000000; |
@@ -3212,20 +3212,20 @@ discard block |
||
| 3212 | 3212 | * @param string $key |
| 3213 | 3213 | * @param string $value |
| 3214 | 3214 | */ |
| 3215 | - public function print_theme_font_option( $key ) { |
|
| 3215 | + public function print_theme_font_option($key) { |
|
| 3216 | 3216 | |
| 3217 | - $value = $this->active_theme[ $key ]; |
|
| 3217 | + $value = $this->active_theme[$key]; |
|
| 3218 | 3218 | |
| 3219 | 3219 | echo "<select name='settings[$key]'>"; |
| 3220 | 3220 | |
| 3221 | - echo "<option value='inherit'>" . __( 'Theme Default', 'megamenu' ) . '</option>'; |
|
| 3221 | + echo "<option value='inherit'>" . __('Theme Default', 'megamenu') . '</option>'; |
|
| 3222 | 3222 | |
| 3223 | - foreach ( $this->fonts() as $font ) { |
|
| 3223 | + foreach ($this->fonts() as $font) { |
|
| 3224 | 3224 | $orig_font = $font; |
| 3225 | - $font = esc_attr( stripslashes( $font ) ); |
|
| 3226 | - $parts = explode( ',', $font ); |
|
| 3227 | - $font_name = trim( $parts[0] ); |
|
| 3228 | - echo "<option value=\"{$font}\" " . selected( $orig_font, htmlspecialchars_decode( $value ) ) . '>' . esc_html( $font_name ) . '</option>'; |
|
| 3225 | + $font = esc_attr(stripslashes($font)); |
|
| 3226 | + $parts = explode(',', $font); |
|
| 3227 | + $font_name = trim($parts[0]); |
|
| 3228 | + echo "<option value=\"{$font}\" " . selected($orig_font, htmlspecialchars_decode($value)) . '>' . esc_html($font_name) . '</option>'; |
|
| 3229 | 3229 | } |
| 3230 | 3230 | |
| 3231 | 3231 | echo '</select>'; |
@@ -3239,11 +3239,11 @@ discard block |
||
| 3239 | 3239 | * @param string $key |
| 3240 | 3240 | * @param string $value |
| 3241 | 3241 | */ |
| 3242 | - public function print_theme_freetext_option( $key ) { |
|
| 3242 | + public function print_theme_freetext_option($key) { |
|
| 3243 | 3243 | |
| 3244 | - $value = $this->active_theme[ $key ]; |
|
| 3244 | + $value = $this->active_theme[$key]; |
|
| 3245 | 3245 | |
| 3246 | - echo "<input class='mega-setting-{$key}' type='text' name='settings[$key]' value='" . esc_attr( $value ) . "' />"; |
|
| 3246 | + echo "<input class='mega-setting-{$key}' type='text' name='settings[$key]' value='" . esc_attr($value) . "' />"; |
|
| 3247 | 3247 | |
| 3248 | 3248 | } |
| 3249 | 3249 | |
@@ -3271,7 +3271,7 @@ discard block |
||
| 3271 | 3271 | 'Lucida Console, Monaco, monospace', |
| 3272 | 3272 | ); |
| 3273 | 3273 | |
| 3274 | - $fonts = apply_filters( 'megamenu_fonts', $fonts ); |
|
| 3274 | + $fonts = apply_filters('megamenu_fonts', $fonts); |
|
| 3275 | 3275 | |
| 3276 | 3276 | return $fonts; |
| 3277 | 3277 | |
@@ -3306,7 +3306,7 @@ discard block |
||
| 3306 | 3306 | |
| 3307 | 3307 | ); |
| 3308 | 3308 | |
| 3309 | - $icons = apply_filters( 'megamenu_arrow_icons', $icons ); |
|
| 3309 | + $icons = apply_filters('megamenu_arrow_icons', $icons); |
|
| 3310 | 3310 | |
| 3311 | 3311 | return $icons; |
| 3312 | 3312 | |
@@ -771,8 +771,11 @@ |
||
| 771 | 771 | <li class='mega-import-theme'><a href='<?php echo $import_url; ?>'><span class='dashicons dashicons-download'></span><?php _e( 'Import a theme', 'megamenu' ); ?></a></li> |
| 772 | 772 | <?php if ( $this->string_contains( $this->id, array( 'custom' ) ) ) : ?> |
| 773 | 773 | <li class='mega-delete-theme'><a class='delete confirm' href='<?php echo $delete_url; ?>'><span class='dashicons dashicons-trash'></span><?php _e( 'Delete theme', 'megamenu' ); ?></a></li> |
| 774 | - <?php else : ?> |
|
| 775 | - <li class='mega-revert-theme'><a class='confirm' href='<?php echo $revert_url; ?>'><span class='dashicons dashicons-update-alt'></span><?php _e( 'Revert theme', 'megamenu' ); ?></a></li> |
|
| 774 | + <?php else { |
|
| 775 | + : ?> |
|
| 776 | + <li class='mega-revert-theme'><a class='confirm' href='<?php echo $revert_url; |
|
| 777 | +} |
|
| 778 | +?>'><span class='dashicons dashicons-update-alt'></span><?php _e( 'Revert theme', 'megamenu' ); ?></a></li> |
|
| 776 | 779 | <?php endif; ?> |
| 777 | 780 | </ul> |
| 778 | 781 | </div> |
@@ -1,109 +1,109 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | - exit; // disable direct access. |
|
| 4 | + exit; // disable direct access. |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | if ( ! class_exists( 'Mega_Menu_General' ) ) : |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * Handles the Mega Menu > Menu Settings page |
|
| 11 | - */ |
|
| 12 | - class Mega_Menu_General { |
|
| 13 | - |
|
| 14 | - /** |
|
| 15 | - * Constructor |
|
| 16 | - * |
|
| 17 | - * @since 1.0 |
|
| 18 | - */ |
|
| 19 | - public function __construct() { |
|
| 20 | - add_action( 'admin_post_megamenu_save_settings', array( $this, 'save_settings' ) ); |
|
| 21 | - |
|
| 22 | - add_filter( 'megamenu_menu_tabs', array( $this, 'add_general_tab' ), 4 ); |
|
| 23 | - add_action( 'megamenu_page_general_settings', array( $this, 'general_settings_page' ) ); |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Add the Menu Locations tab to our available tabs |
|
| 29 | - * |
|
| 30 | - * @param array $tabs |
|
| 31 | - * @since 2.8 |
|
| 32 | - */ |
|
| 33 | - public function add_general_tab( $tabs ) { |
|
| 34 | - $tabs['general_settings'] = __( 'General Settings', 'megamenu' ); |
|
| 35 | - return $tabs; |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Sanitize multidimensional array |
|
| 40 | - * |
|
| 41 | - * @since 2.7.5 |
|
| 42 | - */ |
|
| 43 | - public function sanitize_array( &$array ) { |
|
| 44 | - foreach ( $array as &$value ) { |
|
| 45 | - if ( ! is_array( $value ) ) { |
|
| 46 | - $value = sanitize_textarea_field( $value ); |
|
| 47 | - } else { |
|
| 48 | - $this->sanitize_array( $value ); |
|
| 49 | - } |
|
| 50 | - } |
|
| 51 | - return $array; |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Save menu general settings. |
|
| 57 | - * |
|
| 58 | - * @since 1.0 |
|
| 59 | - */ |
|
| 60 | - public function save_settings() { |
|
| 61 | - check_admin_referer( 'megamenu_save_settings' ); |
|
| 62 | - |
|
| 63 | - if ( isset( $_POST['settings'] ) && is_array( $_POST['settings'] ) ) { |
|
| 64 | - $settings = $this->sanitize_array( $_POST['settings'] ); |
|
| 65 | - $submitted_settings = apply_filters( 'megamenu_submitted_settings', $settings ); |
|
| 66 | - $existing_settings = get_option( 'megamenu_settings' ); |
|
| 67 | - $new_settings = array_merge( (array) $existing_settings, $submitted_settings ); |
|
| 68 | - |
|
| 69 | - update_option( 'megamenu_settings', $new_settings ); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - delete_transient( 'megamenu_failed_to_write_css_to_filesystem' ); |
|
| 73 | - |
|
| 74 | - do_action( 'megamenu_after_save_general_settings' ); |
|
| 75 | - do_action( 'megamenu_delete_cache' ); |
|
| 76 | - |
|
| 77 | - $url = isset( $_POST['_wp_http_referer'] ) ? $_POST['_wp_http_referer'] : admin_url( 'admin.php?page=maxmegamenu&saved=true' ); |
|
| 78 | - |
|
| 79 | - $this->redirect( $url ); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * Redirect and exit |
|
| 85 | - * |
|
| 86 | - * @since 1.8 |
|
| 87 | - */ |
|
| 88 | - public function redirect( $url ) { |
|
| 89 | - wp_redirect( $url ); |
|
| 90 | - exit; |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * Content for 'Settings' tab |
|
| 96 | - * |
|
| 97 | - * @since 1.4 |
|
| 98 | - */ |
|
| 99 | - public function general_settings_page( $saved_settings ) { |
|
| 100 | - |
|
| 101 | - $css = isset( $saved_settings['css'] ) ? $saved_settings['css'] : 'fs'; |
|
| 102 | - $js = isset( $saved_settings['js'] ) ? $saved_settings['js'] : 'footer'; |
|
| 103 | - |
|
| 104 | - $locations = get_registered_nav_menus(); |
|
| 105 | - |
|
| 106 | - ?> |
|
| 9 | + /** |
|
| 10 | + * Handles the Mega Menu > Menu Settings page |
|
| 11 | + */ |
|
| 12 | + class Mega_Menu_General { |
|
| 13 | + |
|
| 14 | + /** |
|
| 15 | + * Constructor |
|
| 16 | + * |
|
| 17 | + * @since 1.0 |
|
| 18 | + */ |
|
| 19 | + public function __construct() { |
|
| 20 | + add_action( 'admin_post_megamenu_save_settings', array( $this, 'save_settings' ) ); |
|
| 21 | + |
|
| 22 | + add_filter( 'megamenu_menu_tabs', array( $this, 'add_general_tab' ), 4 ); |
|
| 23 | + add_action( 'megamenu_page_general_settings', array( $this, 'general_settings_page' ) ); |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Add the Menu Locations tab to our available tabs |
|
| 29 | + * |
|
| 30 | + * @param array $tabs |
|
| 31 | + * @since 2.8 |
|
| 32 | + */ |
|
| 33 | + public function add_general_tab( $tabs ) { |
|
| 34 | + $tabs['general_settings'] = __( 'General Settings', 'megamenu' ); |
|
| 35 | + return $tabs; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Sanitize multidimensional array |
|
| 40 | + * |
|
| 41 | + * @since 2.7.5 |
|
| 42 | + */ |
|
| 43 | + public function sanitize_array( &$array ) { |
|
| 44 | + foreach ( $array as &$value ) { |
|
| 45 | + if ( ! is_array( $value ) ) { |
|
| 46 | + $value = sanitize_textarea_field( $value ); |
|
| 47 | + } else { |
|
| 48 | + $this->sanitize_array( $value ); |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | + return $array; |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Save menu general settings. |
|
| 57 | + * |
|
| 58 | + * @since 1.0 |
|
| 59 | + */ |
|
| 60 | + public function save_settings() { |
|
| 61 | + check_admin_referer( 'megamenu_save_settings' ); |
|
| 62 | + |
|
| 63 | + if ( isset( $_POST['settings'] ) && is_array( $_POST['settings'] ) ) { |
|
| 64 | + $settings = $this->sanitize_array( $_POST['settings'] ); |
|
| 65 | + $submitted_settings = apply_filters( 'megamenu_submitted_settings', $settings ); |
|
| 66 | + $existing_settings = get_option( 'megamenu_settings' ); |
|
| 67 | + $new_settings = array_merge( (array) $existing_settings, $submitted_settings ); |
|
| 68 | + |
|
| 69 | + update_option( 'megamenu_settings', $new_settings ); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + delete_transient( 'megamenu_failed_to_write_css_to_filesystem' ); |
|
| 73 | + |
|
| 74 | + do_action( 'megamenu_after_save_general_settings' ); |
|
| 75 | + do_action( 'megamenu_delete_cache' ); |
|
| 76 | + |
|
| 77 | + $url = isset( $_POST['_wp_http_referer'] ) ? $_POST['_wp_http_referer'] : admin_url( 'admin.php?page=maxmegamenu&saved=true' ); |
|
| 78 | + |
|
| 79 | + $this->redirect( $url ); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * Redirect and exit |
|
| 85 | + * |
|
| 86 | + * @since 1.8 |
|
| 87 | + */ |
|
| 88 | + public function redirect( $url ) { |
|
| 89 | + wp_redirect( $url ); |
|
| 90 | + exit; |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * Content for 'Settings' tab |
|
| 96 | + * |
|
| 97 | + * @since 1.4 |
|
| 98 | + */ |
|
| 99 | + public function general_settings_page( $saved_settings ) { |
|
| 100 | + |
|
| 101 | + $css = isset( $saved_settings['css'] ) ? $saved_settings['css'] : 'fs'; |
|
| 102 | + $js = isset( $saved_settings['js'] ) ? $saved_settings['js'] : 'footer'; |
|
| 103 | + |
|
| 104 | + $locations = get_registered_nav_menus(); |
|
| 105 | + |
|
| 106 | + ?> |
|
| 107 | 107 | |
| 108 | 108 | <div class='menu_settings menu_settings_general_settings'> |
| 109 | 109 | |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | <select name='settings[css]' id='mega_css'> |
| 125 | 125 | <option value='fs' <?php echo selected( 'fs' === $css ); ?>><?php esc_html_e( 'Save to filesystem', 'megamenu' ); ?> |
| 126 | 126 | <?php |
| 127 | - if ( get_transient( 'megamenu_failed_to_write_css_to_filesystem' ) ) { |
|
| 128 | - echo ' ' . esc_html( '(Action required: Check upload folder permissions)', 'megamenu' ); |
|
| 129 | - } |
|
| 130 | - ?> |
|
| 127 | + if ( get_transient( 'megamenu_failed_to_write_css_to_filesystem' ) ) { |
|
| 128 | + echo ' ' . esc_html( '(Action required: Check upload folder permissions)', 'megamenu' ); |
|
| 129 | + } |
|
| 130 | + ?> |
|
| 131 | 131 | </option> |
| 132 | 132 | <option value='head' <?php echo selected( 'head' === $css ); ?>><?php esc_html_e( 'Output in <head>', 'megamenu' ); ?></option> |
| 133 | 133 | <option value='disabled' <?php echo selected( 'disabled' === $css ); ?>><?php esc_html_e( "Don't output CSS", 'megamenu' ); ?></option> |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | </div> |
| 165 | 165 | |
| 166 | 166 | <?php |
| 167 | - } |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - } |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | 171 | endif; |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | 4 | exit; // disable direct access. |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if ( ! class_exists( 'Mega_Menu_General' ) ) : |
|
| 7 | +if (!class_exists('Mega_Menu_General')) : |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Handles the Mega Menu > Menu Settings page |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | * @since 1.0 |
| 18 | 18 | */ |
| 19 | 19 | public function __construct() { |
| 20 | - add_action( 'admin_post_megamenu_save_settings', array( $this, 'save_settings' ) ); |
|
| 20 | + add_action('admin_post_megamenu_save_settings', array($this, 'save_settings')); |
|
| 21 | 21 | |
| 22 | - add_filter( 'megamenu_menu_tabs', array( $this, 'add_general_tab' ), 4 ); |
|
| 23 | - add_action( 'megamenu_page_general_settings', array( $this, 'general_settings_page' ) ); |
|
| 22 | + add_filter('megamenu_menu_tabs', array($this, 'add_general_tab'), 4); |
|
| 23 | + add_action('megamenu_page_general_settings', array($this, 'general_settings_page')); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | * @param array $tabs |
| 31 | 31 | * @since 2.8 |
| 32 | 32 | */ |
| 33 | - public function add_general_tab( $tabs ) { |
|
| 34 | - $tabs['general_settings'] = __( 'General Settings', 'megamenu' ); |
|
| 33 | + public function add_general_tab($tabs) { |
|
| 34 | + $tabs['general_settings'] = __('General Settings', 'megamenu'); |
|
| 35 | 35 | return $tabs; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @since 2.7.5 |
| 42 | 42 | */ |
| 43 | - public function sanitize_array( &$array ) { |
|
| 44 | - foreach ( $array as &$value ) { |
|
| 45 | - if ( ! is_array( $value ) ) { |
|
| 46 | - $value = sanitize_textarea_field( $value ); |
|
| 43 | + public function sanitize_array(&$array) { |
|
| 44 | + foreach ($array as &$value) { |
|
| 45 | + if (!is_array($value)) { |
|
| 46 | + $value = sanitize_textarea_field($value); |
|
| 47 | 47 | } else { |
| 48 | - $this->sanitize_array( $value ); |
|
| 48 | + $this->sanitize_array($value); |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | return $array; |
@@ -58,25 +58,25 @@ discard block |
||
| 58 | 58 | * @since 1.0 |
| 59 | 59 | */ |
| 60 | 60 | public function save_settings() { |
| 61 | - check_admin_referer( 'megamenu_save_settings' ); |
|
| 61 | + check_admin_referer('megamenu_save_settings'); |
|
| 62 | 62 | |
| 63 | - if ( isset( $_POST['settings'] ) && is_array( $_POST['settings'] ) ) { |
|
| 64 | - $settings = $this->sanitize_array( $_POST['settings'] ); |
|
| 65 | - $submitted_settings = apply_filters( 'megamenu_submitted_settings', $settings ); |
|
| 66 | - $existing_settings = get_option( 'megamenu_settings' ); |
|
| 67 | - $new_settings = array_merge( (array) $existing_settings, $submitted_settings ); |
|
| 63 | + if (isset($_POST['settings']) && is_array($_POST['settings'])) { |
|
| 64 | + $settings = $this->sanitize_array($_POST['settings']); |
|
| 65 | + $submitted_settings = apply_filters('megamenu_submitted_settings', $settings); |
|
| 66 | + $existing_settings = get_option('megamenu_settings'); |
|
| 67 | + $new_settings = array_merge((array) $existing_settings, $submitted_settings); |
|
| 68 | 68 | |
| 69 | - update_option( 'megamenu_settings', $new_settings ); |
|
| 69 | + update_option('megamenu_settings', $new_settings); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - delete_transient( 'megamenu_failed_to_write_css_to_filesystem' ); |
|
| 72 | + delete_transient('megamenu_failed_to_write_css_to_filesystem'); |
|
| 73 | 73 | |
| 74 | - do_action( 'megamenu_after_save_general_settings' ); |
|
| 75 | - do_action( 'megamenu_delete_cache' ); |
|
| 74 | + do_action('megamenu_after_save_general_settings'); |
|
| 75 | + do_action('megamenu_delete_cache'); |
|
| 76 | 76 | |
| 77 | - $url = isset( $_POST['_wp_http_referer'] ) ? $_POST['_wp_http_referer'] : admin_url( 'admin.php?page=maxmegamenu&saved=true' ); |
|
| 77 | + $url = isset($_POST['_wp_http_referer']) ? $_POST['_wp_http_referer'] : admin_url('admin.php?page=maxmegamenu&saved=true'); |
|
| 78 | 78 | |
| 79 | - $this->redirect( $url ); |
|
| 79 | + $this->redirect($url); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @since 1.8 |
| 87 | 87 | */ |
| 88 | - public function redirect( $url ) { |
|
| 89 | - wp_redirect( $url ); |
|
| 88 | + public function redirect($url) { |
|
| 89 | + wp_redirect($url); |
|
| 90 | 90 | exit; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @since 1.4 |
| 98 | 98 | */ |
| 99 | - public function general_settings_page( $saved_settings ) { |
|
| 99 | + public function general_settings_page($saved_settings) { |
|
| 100 | 100 | |
| 101 | - $css = isset( $saved_settings['css'] ) ? $saved_settings['css'] : 'fs'; |
|
| 102 | - $js = isset( $saved_settings['js'] ) ? $saved_settings['js'] : 'footer'; |
|
| 101 | + $css = isset($saved_settings['css']) ? $saved_settings['css'] : 'fs'; |
|
| 102 | + $js = isset($saved_settings['js']) ? $saved_settings['js'] : 'footer'; |
|
| 103 | 103 | |
| 104 | 104 | $locations = get_registered_nav_menus(); |
| 105 | 105 | |
@@ -107,57 +107,57 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | <div class='menu_settings menu_settings_general_settings'> |
| 109 | 109 | |
| 110 | - <form action="<?php echo esc_attr( admin_url( 'admin-post.php' ) ); ?>" method="post"> |
|
| 110 | + <form action="<?php echo esc_attr(admin_url('admin-post.php')); ?>" method="post"> |
|
| 111 | 111 | <input type="hidden" name="action" value="megamenu_save_settings" /> |
| 112 | - <?php wp_nonce_field( 'megamenu_save_settings' ); ?> |
|
| 112 | + <?php wp_nonce_field('megamenu_save_settings'); ?> |
|
| 113 | 113 | |
| 114 | - <h3 class='first'><?php esc_html_e( 'General Settings', 'megamenu' ); ?></h3> |
|
| 114 | + <h3 class='first'><?php esc_html_e('General Settings', 'megamenu'); ?></h3> |
|
| 115 | 115 | |
| 116 | 116 | <table> |
| 117 | 117 | <tr> |
| 118 | 118 | <td class='mega-name'> |
| 119 | - <?php esc_html_e( 'CSS Output', 'megamenu' ); ?> |
|
| 119 | + <?php esc_html_e('CSS Output', 'megamenu'); ?> |
|
| 120 | 120 | <div class='mega-description'> |
| 121 | 121 | </div> |
| 122 | 122 | </td> |
| 123 | 123 | <td class='mega-value'> |
| 124 | 124 | <select name='settings[css]' id='mega_css'> |
| 125 | - <option value='fs' <?php echo selected( 'fs' === $css ); ?>><?php esc_html_e( 'Save to filesystem', 'megamenu' ); ?> |
|
| 125 | + <option value='fs' <?php echo selected('fs' === $css); ?>><?php esc_html_e('Save to filesystem', 'megamenu'); ?> |
|
| 126 | 126 | <?php |
| 127 | - if ( get_transient( 'megamenu_failed_to_write_css_to_filesystem' ) ) { |
|
| 128 | - echo ' ' . esc_html( '(Action required: Check upload folder permissions)', 'megamenu' ); |
|
| 127 | + if (get_transient('megamenu_failed_to_write_css_to_filesystem')) { |
|
| 128 | + echo ' ' . esc_html('(Action required: Check upload folder permissions)', 'megamenu'); |
|
| 129 | 129 | } |
| 130 | 130 | ?> |
| 131 | 131 | </option> |
| 132 | - <option value='head' <?php echo selected( 'head' === $css ); ?>><?php esc_html_e( 'Output in <head>', 'megamenu' ); ?></option> |
|
| 133 | - <option value='disabled' <?php echo selected( 'disabled' === $css ); ?>><?php esc_html_e( "Don't output CSS", 'megamenu' ); ?></option> |
|
| 132 | + <option value='head' <?php echo selected('head' === $css); ?>><?php esc_html_e('Output in <head>', 'megamenu'); ?></option> |
|
| 133 | + <option value='disabled' <?php echo selected('disabled' === $css); ?>><?php esc_html_e("Don't output CSS", 'megamenu'); ?></option> |
|
| 134 | 134 | <select> |
| 135 | 135 | <div class='mega-description'> |
| 136 | - <div class='fs' style='display: <?php echo 'fs' === $css ? 'block' : 'none'; ?>'><?php esc_html_e( 'CSS will be saved to wp-content/uploads/maxmegamenu/style.css and enqueued from there.', 'megamenu' ); ?></div> |
|
| 137 | - <div class='head' style='display: <?php echo 'head' === $css ? 'block' : 'none'; ?>'><?php esc_html_e( 'CSS will be loaded from the cache in a <style> tag in the <head> of the page.', 'megamenu' ); ?></div> |
|
| 136 | + <div class='fs' style='display: <?php echo 'fs' === $css ? 'block' : 'none'; ?>'><?php esc_html_e('CSS will be saved to wp-content/uploads/maxmegamenu/style.css and enqueued from there.', 'megamenu'); ?></div> |
|
| 137 | + <div class='head' style='display: <?php echo 'head' === $css ? 'block' : 'none'; ?>'><?php esc_html_e('CSS will be loaded from the cache in a <style> tag in the <head> of the page.', 'megamenu'); ?></div> |
|
| 138 | 138 | <div class='disabled' style='display: <?php echo 'disabled' === $css ? 'block' : 'none'; ?>'> |
| 139 | - <?php esc_html_e( 'CSS will not be output, you must enqueue the CSS for the menu manually.', 'megamenu' ); ?> |
|
| 140 | - <div class='fail'><?php esc_html_e( 'Selecting this option will effectively disable the theme editor and many of the features available in Max Mega Menu and Max Mega Menu Pro. Only enable this option if you fully understand the consequences.', 'megamenu' ); ?> |
|
| 139 | + <?php esc_html_e('CSS will not be output, you must enqueue the CSS for the menu manually.', 'megamenu'); ?> |
|
| 140 | + <div class='fail'><?php esc_html_e('Selecting this option will effectively disable the theme editor and many of the features available in Max Mega Menu and Max Mega Menu Pro. Only enable this option if you fully understand the consequences.', 'megamenu'); ?> |
|
| 141 | 141 | </div> |
| 142 | 142 | </div> |
| 143 | 143 | </td> |
| 144 | 144 | </tr> |
| 145 | 145 | <!--tr> |
| 146 | 146 | <td class='mega-name'> |
| 147 | - <?php esc_html_e( 'JavaScript Output', 'megamenu' ); ?> |
|
| 147 | + <?php esc_html_e('JavaScript Output', 'megamenu'); ?> |
|
| 148 | 148 | <div class='mega-description'> |
| 149 | 149 | </div> |
| 150 | 150 | </td> |
| 151 | 151 | <td class='mega-value'> |
| 152 | 152 | <select name='settings[js]' id='mega_css'> |
| 153 | - <option value='footer' <?php echo selected( 'footer' === $js ); ?>><?php esc_html_e( 'Footer (default)', 'megamenu' ); ?></option> |
|
| 154 | - <option value='head' <?php echo selected( 'head' === $js ); ?>><?php esc_html_e( 'Output in <head>', 'megamenu' ); ?></option> |
|
| 153 | + <option value='footer' <?php echo selected('footer' === $js); ?>><?php esc_html_e('Footer (default)', 'megamenu'); ?></option> |
|
| 154 | + <option value='head' <?php echo selected('head' === $js); ?>><?php esc_html_e('Output in <head>', 'megamenu'); ?></option> |
|
| 155 | 155 | <select> |
| 156 | 156 | </td> |
| 157 | 157 | </tr--> |
| 158 | 158 | </table> |
| 159 | 159 | |
| 160 | - <?php do_action( 'megamenu_general_settings', $saved_settings ); ?> |
|
| 160 | + <?php do_action('megamenu_general_settings', $saved_settings); ?> |
|
| 161 | 161 | |
| 162 | 162 | <?php submit_button(); ?> |
| 163 | 163 | </form> |
@@ -1,133 +1,133 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | - exit; // disable direct access |
|
| 4 | + exit; // disable direct access |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | if ( ! class_exists( 'Mega_Menu_Page' ) ) : |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * Handles all admin related functionality. |
|
| 11 | - */ |
|
| 12 | - class Mega_Menu_Page { |
|
| 13 | - |
|
| 14 | - /** |
|
| 15 | - * Constructor |
|
| 16 | - * |
|
| 17 | - * @since 1.0 |
|
| 18 | - */ |
|
| 19 | - public function __construct() { |
|
| 20 | - add_action( 'admin_menu', array( $this, 'megamenu_settings_page' ) ); |
|
| 21 | - add_action( 'megamenu_admin_scripts', array( $this, 'enqueue_scripts' ) ); |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * Adds the "Menu Themes" menu item and page. |
|
| 27 | - * |
|
| 28 | - * @since 1.0 |
|
| 29 | - */ |
|
| 30 | - public function megamenu_settings_page() { |
|
| 31 | - |
|
| 32 | - $svg = 'PHN2ZyB2ZXJzaW9uPSIxLjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEyNy4wMDAwMDBwdCIgaGVpZ2h0PSIxMjcuMDAwMDAwcHQiIHZpZXdCb3g9IjAgMCAxMjcuMDAwMDAwIDEyNy4wMDAwMDAiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIG1lZXQiPgogICAgICAgICAgICAgICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAuMDAwMDAwLDEyNy4wMDAwMDApIHNjYWxlKDAuMTAwMDAwLC0wLjEwMDAwMCkiIGZpbGw9IiMwMDAwMDAiIHN0cm9rZT0ibm9uZSI+CiAgICAgICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0zMzAgMTEyNyBsLTI0NSAtMTQzIC03IC0xODAgYy01IC05OCAtNyAtMjUzIC01IC0zNDQgbDIgLTE2NSAxMzAKICAgICAgICAgICAgICAgICAgICAgICAgLTc2IGMyOTUgLTE3MyAzNDUgLTIwNCAzNDUgLTIxMSAwIC00IDI0IC04IDU0IC04IDQ4IDAgNjUgNyAxNjcgNjYgMjIzIDEyOQogICAgICAgICAgICAgICAgICAgICAgICAzNzYgMjI0IDM5MCAyNDAgMTggMjEgMjYgNTkzIDEwIDYzNyAtMTIgMzAgLTczIDcyIC0yNzYgMTkwIC03MSA0MiAtMTUyIDkwCiAgICAgICAgICAgICAgICAgICAgICAgIC0xNzkgMTA2IC0zNiAyMyAtNjAgMzEgLTk1IDMxIC00MSAwIC03MiAtMTYgLTI5MSAtMTQzeiBtNDEwIC03NyBjMTMxIC03NgogICAgICAgICAgICAgICAgICAgICAgICAxNDEgLTg1IDExNSAtMTA1IC00MyAtMzEgLTIyMSAtMTI1IC0yMzkgLTEyNSAtMjEgMCAtMjE3IDExMiAtMjM1IDEzNCAtOCAxMAogICAgICAgICAgICAgICAgICAgICAgICAtNiAxNyA3IDI4IDM3IDMyIDIwNyAxMjggMjI2IDEyOCAxMiAwIDY4IC0yNyAxMjYgLTYweiBtLTM2MSAtMjc5IGM4OCAtNTAKICAgICAgICAgICAgICAgICAgICAgICAgMTgxIC05OSAyMDcgLTExMCBsNDcgLTIxIDEyMSA2OSBjMTY4IDk2IDI1NSAxNDEgMjcyIDE0MSAxMiAwIDE0IC0zOCAxNCAtMjI4CiAgICAgICAgICAgICAgICAgICAgICAgIGwwIC0yMjggLTc3IC00NyAtNzggLTQ3IC03IDE0NiBjLTMgODAgLTggMTQ3IC0xMCAxNDkgLTIgMiAtNTMgLTI1IC0xMTMgLTYwCiAgICAgICAgICAgICAgICAgICAgICAgIC02MSAtMzUgLTExOSAtNjQgLTEyOSAtNjUgLTExIDAgLTcwIDI3IC0xMzIgNjAgLTYyIDMzIC0xMTUgNjAgLTExNyA2MCAtMyAwCiAgICAgICAgICAgICAgICAgICAgICAgIC04IC02MyAtMTIgLTE0MCAtNCAtNzcgLTExIC0xNDAgLTE2IC0xNDAgLTQgMCAtMzkgMTkgLTc4IDQyIGwtNzAgNDIgLTMgMTI2CiAgICAgICAgICAgICAgICAgICAgICAgIGMtNCAxODIgMSAzNDAgMTIgMzQwIDUgMCA4MSAtNDAgMTY5IC04OXogbTE5NSAtNDU4IGw1NSAtMjcgNDEgMjggYzIzIDE1IDQ4CiAgICAgICAgICAgICAgICAgICAgICAgIDI1IDU2IDIyIDE1IC02IDIwIC03OSA4IC0xMTEgLTcgLTE4IC05NCAtNjUgLTEyMSAtNjUgLTIyIDAgLTgzIDM1IC0xMDAgNTgKICAgICAgICAgICAgICAgICAgICAgICAgLTE4IDIyIC0xNSAxMjIgMyAxMjIgMiAwIDI4IC0xMiA1OCAtMjd6Ii8+CiAgICAgICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPC9zdmc+'; |
|
| 33 | - |
|
| 34 | - $icon = 'data:image/svg+xml;base64,' . $svg; |
|
| 35 | - |
|
| 36 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 37 | - |
|
| 38 | - $page = add_menu_page( __( 'Max Mega Menu', 'megamenu' ), __( 'Mega Menu', 'megamenu' ), $capability, 'maxmegamenu', array( $this, 'page' ), $icon ); |
|
| 39 | - |
|
| 40 | - $tabs = apply_filters( 'megamenu_menu_tabs', array() ); |
|
| 41 | - |
|
| 42 | - foreach ( $tabs as $key => $title ) { |
|
| 43 | - if ( $key == 'menu_locations' ) { |
|
| 44 | - add_submenu_page( 'maxmegamenu', __( 'Max Mega Menu', 'megamenu' ) . ' - ' . $title, $title, $capability, 'maxmegamenu', array( $this, 'page' ) ); |
|
| 45 | - } else { |
|
| 46 | - add_submenu_page( 'maxmegamenu', __( 'Max Mega Menu', 'megamenu' ) . ' - ' . $title, $title, $capability, 'maxmegamenu_' . $key, array( $this, 'page' ) ); |
|
| 47 | - } |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Main settings page wrapper. |
|
| 56 | - * |
|
| 57 | - * @since 1.4 |
|
| 58 | - */ |
|
| 59 | - public function page() { |
|
| 60 | - |
|
| 61 | - $tab = isset( $_GET['page'] ) ? substr( $_GET['page'], 12 ) : false; |
|
| 62 | - |
|
| 63 | - // backwards compatibility |
|
| 64 | - if ( isset( $_GET['tab'] ) ) { |
|
| 65 | - $tab = $_GET['tab']; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - if ( ! $tab ) { |
|
| 69 | - $tab = 'menu_locations'; |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - $header_links = apply_filters( |
|
| 73 | - 'megamenu_header_links', |
|
| 74 | - array( |
|
| 75 | - 'homepage' => array( |
|
| 76 | - 'url' => 'https://www.megamenu.com/?utm_source=free&utm_medium=settings&utm_campaign=pro', |
|
| 77 | - 'target' => '_mmmpro', |
|
| 78 | - 'text' => __( 'Homepage', 'megamenu' ), |
|
| 79 | - 'class' => '', |
|
| 80 | - ), |
|
| 81 | - 'documentation' => array( |
|
| 82 | - 'url' => 'https://www.megamenu.com/documentation/installation/?utm_source=free&utm_medium=settings&utm_campaign=pro', |
|
| 83 | - 'text' => __( 'Documentation', 'megamenu' ), |
|
| 84 | - 'target' => '_mmmpro', |
|
| 85 | - 'class' => '', |
|
| 86 | - ), |
|
| 87 | - 'troubleshooting' => array( |
|
| 88 | - 'url' => 'https://www.megamenu.com/articles/troubleshooting/?utm_source=free&utm_medium=settings&utm_campaign=pro', |
|
| 89 | - 'text' => __( 'Troubleshooting', 'megamenu' ), |
|
| 90 | - 'target' => '_mmmpro', |
|
| 91 | - 'class' => '', |
|
| 92 | - ), |
|
| 93 | - ) |
|
| 94 | - ); |
|
| 95 | - |
|
| 96 | - if ( ! is_plugin_active( 'megamenu-pro/megamenu-pro.php' ) ) { |
|
| 97 | - $header_links['pro'] = array( |
|
| 98 | - 'url' => 'https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=settings&utm_campaign=pro', |
|
| 99 | - 'target' => '_mmmpro', |
|
| 100 | - 'text' => __( 'Upgrade to Pro', 'megamenu' ), |
|
| 101 | - 'class' => 'mega-highlight', |
|
| 102 | - ); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - $versions = apply_filters( |
|
| 106 | - 'megamenu_versions', |
|
| 107 | - array( |
|
| 108 | - 'core' => array( |
|
| 109 | - 'version' => MEGAMENU_VERSION, |
|
| 110 | - 'text' => __( 'Core version', 'megamenu' ), |
|
| 111 | - ), |
|
| 112 | - 'pro' => array( |
|
| 113 | - 'version' => "<a href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=settings&utm_campaign=pro' target='_mmmpro'>not installed</a>", |
|
| 114 | - 'text' => __( 'Pro extension', 'megamenu' ), |
|
| 115 | - ), |
|
| 116 | - ) |
|
| 117 | - ); |
|
| 118 | - |
|
| 119 | - ?> |
|
| 9 | + /** |
|
| 10 | + * Handles all admin related functionality. |
|
| 11 | + */ |
|
| 12 | + class Mega_Menu_Page { |
|
| 13 | + |
|
| 14 | + /** |
|
| 15 | + * Constructor |
|
| 16 | + * |
|
| 17 | + * @since 1.0 |
|
| 18 | + */ |
|
| 19 | + public function __construct() { |
|
| 20 | + add_action( 'admin_menu', array( $this, 'megamenu_settings_page' ) ); |
|
| 21 | + add_action( 'megamenu_admin_scripts', array( $this, 'enqueue_scripts' ) ); |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * Adds the "Menu Themes" menu item and page. |
|
| 27 | + * |
|
| 28 | + * @since 1.0 |
|
| 29 | + */ |
|
| 30 | + public function megamenu_settings_page() { |
|
| 31 | + |
|
| 32 | + $svg = 'PHN2ZyB2ZXJzaW9uPSIxLjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEyNy4wMDAwMDBwdCIgaGVpZ2h0PSIxMjcuMDAwMDAwcHQiIHZpZXdCb3g9IjAgMCAxMjcuMDAwMDAwIDEyNy4wMDAwMDAiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIG1lZXQiPgogICAgICAgICAgICAgICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAuMDAwMDAwLDEyNy4wMDAwMDApIHNjYWxlKDAuMTAwMDAwLC0wLjEwMDAwMCkiIGZpbGw9IiMwMDAwMDAiIHN0cm9rZT0ibm9uZSI+CiAgICAgICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0zMzAgMTEyNyBsLTI0NSAtMTQzIC03IC0xODAgYy01IC05OCAtNyAtMjUzIC01IC0zNDQgbDIgLTE2NSAxMzAKICAgICAgICAgICAgICAgICAgICAgICAgLTc2IGMyOTUgLTE3MyAzNDUgLTIwNCAzNDUgLTIxMSAwIC00IDI0IC04IDU0IC04IDQ4IDAgNjUgNyAxNjcgNjYgMjIzIDEyOQogICAgICAgICAgICAgICAgICAgICAgICAzNzYgMjI0IDM5MCAyNDAgMTggMjEgMjYgNTkzIDEwIDYzNyAtMTIgMzAgLTczIDcyIC0yNzYgMTkwIC03MSA0MiAtMTUyIDkwCiAgICAgICAgICAgICAgICAgICAgICAgIC0xNzkgMTA2IC0zNiAyMyAtNjAgMzEgLTk1IDMxIC00MSAwIC03MiAtMTYgLTI5MSAtMTQzeiBtNDEwIC03NyBjMTMxIC03NgogICAgICAgICAgICAgICAgICAgICAgICAxNDEgLTg1IDExNSAtMTA1IC00MyAtMzEgLTIyMSAtMTI1IC0yMzkgLTEyNSAtMjEgMCAtMjE3IDExMiAtMjM1IDEzNCAtOCAxMAogICAgICAgICAgICAgICAgICAgICAgICAtNiAxNyA3IDI4IDM3IDMyIDIwNyAxMjggMjI2IDEyOCAxMiAwIDY4IC0yNyAxMjYgLTYweiBtLTM2MSAtMjc5IGM4OCAtNTAKICAgICAgICAgICAgICAgICAgICAgICAgMTgxIC05OSAyMDcgLTExMCBsNDcgLTIxIDEyMSA2OSBjMTY4IDk2IDI1NSAxNDEgMjcyIDE0MSAxMiAwIDE0IC0zOCAxNCAtMjI4CiAgICAgICAgICAgICAgICAgICAgICAgIGwwIC0yMjggLTc3IC00NyAtNzggLTQ3IC03IDE0NiBjLTMgODAgLTggMTQ3IC0xMCAxNDkgLTIgMiAtNTMgLTI1IC0xMTMgLTYwCiAgICAgICAgICAgICAgICAgICAgICAgIC02MSAtMzUgLTExOSAtNjQgLTEyOSAtNjUgLTExIDAgLTcwIDI3IC0xMzIgNjAgLTYyIDMzIC0xMTUgNjAgLTExNyA2MCAtMyAwCiAgICAgICAgICAgICAgICAgICAgICAgIC04IC02MyAtMTIgLTE0MCAtNCAtNzcgLTExIC0xNDAgLTE2IC0xNDAgLTQgMCAtMzkgMTkgLTc4IDQyIGwtNzAgNDIgLTMgMTI2CiAgICAgICAgICAgICAgICAgICAgICAgIGMtNCAxODIgMSAzNDAgMTIgMzQwIDUgMCA4MSAtNDAgMTY5IC04OXogbTE5NSAtNDU4IGw1NSAtMjcgNDEgMjggYzIzIDE1IDQ4CiAgICAgICAgICAgICAgICAgICAgICAgIDI1IDU2IDIyIDE1IC02IDIwIC03OSA4IC0xMTEgLTcgLTE4IC05NCAtNjUgLTEyMSAtNjUgLTIyIDAgLTgzIDM1IC0xMDAgNTgKICAgICAgICAgICAgICAgICAgICAgICAgLTE4IDIyIC0xNSAxMjIgMyAxMjIgMiAwIDI4IC0xMiA1OCAtMjd6Ii8+CiAgICAgICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICAgICAgPC9zdmc+'; |
|
| 33 | + |
|
| 34 | + $icon = 'data:image/svg+xml;base64,' . $svg; |
|
| 35 | + |
|
| 36 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 37 | + |
|
| 38 | + $page = add_menu_page( __( 'Max Mega Menu', 'megamenu' ), __( 'Mega Menu', 'megamenu' ), $capability, 'maxmegamenu', array( $this, 'page' ), $icon ); |
|
| 39 | + |
|
| 40 | + $tabs = apply_filters( 'megamenu_menu_tabs', array() ); |
|
| 41 | + |
|
| 42 | + foreach ( $tabs as $key => $title ) { |
|
| 43 | + if ( $key == 'menu_locations' ) { |
|
| 44 | + add_submenu_page( 'maxmegamenu', __( 'Max Mega Menu', 'megamenu' ) . ' - ' . $title, $title, $capability, 'maxmegamenu', array( $this, 'page' ) ); |
|
| 45 | + } else { |
|
| 46 | + add_submenu_page( 'maxmegamenu', __( 'Max Mega Menu', 'megamenu' ) . ' - ' . $title, $title, $capability, 'maxmegamenu_' . $key, array( $this, 'page' ) ); |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Main settings page wrapper. |
|
| 56 | + * |
|
| 57 | + * @since 1.4 |
|
| 58 | + */ |
|
| 59 | + public function page() { |
|
| 60 | + |
|
| 61 | + $tab = isset( $_GET['page'] ) ? substr( $_GET['page'], 12 ) : false; |
|
| 62 | + |
|
| 63 | + // backwards compatibility |
|
| 64 | + if ( isset( $_GET['tab'] ) ) { |
|
| 65 | + $tab = $_GET['tab']; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + if ( ! $tab ) { |
|
| 69 | + $tab = 'menu_locations'; |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + $header_links = apply_filters( |
|
| 73 | + 'megamenu_header_links', |
|
| 74 | + array( |
|
| 75 | + 'homepage' => array( |
|
| 76 | + 'url' => 'https://www.megamenu.com/?utm_source=free&utm_medium=settings&utm_campaign=pro', |
|
| 77 | + 'target' => '_mmmpro', |
|
| 78 | + 'text' => __( 'Homepage', 'megamenu' ), |
|
| 79 | + 'class' => '', |
|
| 80 | + ), |
|
| 81 | + 'documentation' => array( |
|
| 82 | + 'url' => 'https://www.megamenu.com/documentation/installation/?utm_source=free&utm_medium=settings&utm_campaign=pro', |
|
| 83 | + 'text' => __( 'Documentation', 'megamenu' ), |
|
| 84 | + 'target' => '_mmmpro', |
|
| 85 | + 'class' => '', |
|
| 86 | + ), |
|
| 87 | + 'troubleshooting' => array( |
|
| 88 | + 'url' => 'https://www.megamenu.com/articles/troubleshooting/?utm_source=free&utm_medium=settings&utm_campaign=pro', |
|
| 89 | + 'text' => __( 'Troubleshooting', 'megamenu' ), |
|
| 90 | + 'target' => '_mmmpro', |
|
| 91 | + 'class' => '', |
|
| 92 | + ), |
|
| 93 | + ) |
|
| 94 | + ); |
|
| 95 | + |
|
| 96 | + if ( ! is_plugin_active( 'megamenu-pro/megamenu-pro.php' ) ) { |
|
| 97 | + $header_links['pro'] = array( |
|
| 98 | + 'url' => 'https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=settings&utm_campaign=pro', |
|
| 99 | + 'target' => '_mmmpro', |
|
| 100 | + 'text' => __( 'Upgrade to Pro', 'megamenu' ), |
|
| 101 | + 'class' => 'mega-highlight', |
|
| 102 | + ); |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + $versions = apply_filters( |
|
| 106 | + 'megamenu_versions', |
|
| 107 | + array( |
|
| 108 | + 'core' => array( |
|
| 109 | + 'version' => MEGAMENU_VERSION, |
|
| 110 | + 'text' => __( 'Core version', 'megamenu' ), |
|
| 111 | + ), |
|
| 112 | + 'pro' => array( |
|
| 113 | + 'version' => "<a href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=settings&utm_campaign=pro' target='_mmmpro'>not installed</a>", |
|
| 114 | + 'text' => __( 'Pro extension', 'megamenu' ), |
|
| 115 | + ), |
|
| 116 | + ) |
|
| 117 | + ); |
|
| 118 | + |
|
| 119 | + ?> |
|
| 120 | 120 | |
| 121 | 121 | <div class='megamenu_outer_wrap'> |
| 122 | 122 | <div class='megamenu_header_top'> |
| 123 | 123 | <ul> |
| 124 | 124 | <?php |
| 125 | - foreach ( $header_links as $id => $data ) { |
|
| 126 | - echo "<li class='{$data['class']}'><a href='{$data['url']}' target='{$data['target']}'>{$data['text']}"; |
|
| 127 | - echo '</a>'; |
|
| 128 | - echo '</li>'; |
|
| 129 | - } |
|
| 130 | - ?> |
|
| 125 | + foreach ( $header_links as $id => $data ) { |
|
| 126 | + echo "<li class='{$data['class']}'><a href='{$data['url']}' target='{$data['target']}'>{$data['text']}"; |
|
| 127 | + echo '</a>'; |
|
| 128 | + echo '</li>'; |
|
| 129 | + } |
|
| 130 | + ?> |
|
| 131 | 131 | </ul> |
| 132 | 132 | </div> |
| 133 | 133 | <div class='megamenu_header'> |
@@ -136,52 +136,52 @@ discard block |
||
| 136 | 136 | <div class='version'> |
| 137 | 137 | <?php |
| 138 | 138 | |
| 139 | - $total = count( $versions ); |
|
| 140 | - $count = 0; |
|
| 141 | - $separator = ' - '; |
|
| 139 | + $total = count( $versions ); |
|
| 140 | + $count = 0; |
|
| 141 | + $separator = ' - '; |
|
| 142 | 142 | |
| 143 | - foreach ( $versions as $id => $data ) { |
|
| 144 | - echo $data['text'] . ': <b>' . $data['version'] . '</b>'; |
|
| 143 | + foreach ( $versions as $id => $data ) { |
|
| 144 | + echo $data['text'] . ': <b>' . $data['version'] . '</b>'; |
|
| 145 | 145 | |
| 146 | - $count = $count + 1; |
|
| 146 | + $count = $count + 1; |
|
| 147 | 147 | |
| 148 | - if ( $total > 0 && $count != $total ) { |
|
| 149 | - echo $separator; |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - ?> |
|
| 148 | + if ( $total > 0 && $count != $total ) { |
|
| 149 | + echo $separator; |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + ?> |
|
| 153 | 153 | </div> |
| 154 | 154 | </div> |
| 155 | 155 | |
| 156 | 156 | <?php |
| 157 | - if ( isset( $_GET['debug'] ) ) { |
|
| 158 | - echo "<textarea style='width: 100%; height: 400px;'>"; |
|
| 159 | - var_dump( get_option("megamenu_settings") ); |
|
| 160 | - echo "</textarea>"; |
|
| 161 | - } |
|
| 162 | - ?> |
|
| 157 | + if ( isset( $_GET['debug'] ) ) { |
|
| 158 | + echo "<textarea style='width: 100%; height: 400px;'>"; |
|
| 159 | + var_dump( get_option("megamenu_settings") ); |
|
| 160 | + echo "</textarea>"; |
|
| 161 | + } |
|
| 162 | + ?> |
|
| 163 | 163 | </div> |
| 164 | 164 | |
| 165 | 165 | <div class='megamenu_wrap'> |
| 166 | 166 | <div class='megamenu_left'> |
| 167 | 167 | <ul class='mega-page-navigation'> |
| 168 | 168 | <?php |
| 169 | - $tabs = apply_filters( 'megamenu_menu_tabs', array() ); |
|
| 169 | + $tabs = apply_filters( 'megamenu_menu_tabs', array() ); |
|
| 170 | 170 | |
| 171 | - foreach ( $tabs as $key => $title ) { |
|
| 172 | - $class = $tab == $key ? 'active' : ''; |
|
| 171 | + foreach ( $tabs as $key => $title ) { |
|
| 172 | + $class = $tab == $key ? 'active' : ''; |
|
| 173 | 173 | |
| 174 | - if ( $key == 'menu_locations' ) { |
|
| 175 | - $args = array( 'page' => 'maxmegamenu' ); |
|
| 176 | - } else { |
|
| 177 | - $args = array( 'page' => 'maxmegamenu_' . $key ); |
|
| 178 | - } |
|
| 174 | + if ( $key == 'menu_locations' ) { |
|
| 175 | + $args = array( 'page' => 'maxmegamenu' ); |
|
| 176 | + } else { |
|
| 177 | + $args = array( 'page' => 'maxmegamenu_' . $key ); |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - $url = esc_url( add_query_arg( $args, admin_url( 'admin.php' ) ) ); |
|
| 180 | + $url = esc_url( add_query_arg( $args, admin_url( 'admin.php' ) ) ); |
|
| 181 | 181 | |
| 182 | - echo "<li class='{$key}'><a class='{$class}' href='{$url}'>{$title}</a></li>"; |
|
| 183 | - } |
|
| 184 | - ?> |
|
| 182 | + echo "<li class='{$key}'><a class='{$class}' href='{$url}'>{$title}</a></li>"; |
|
| 183 | + } |
|
| 184 | + ?> |
|
| 185 | 185 | </ul> |
| 186 | 186 | </div> |
| 187 | 187 | <div class='megamenu_right'> |
@@ -189,15 +189,15 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | <?php |
| 191 | 191 | |
| 192 | - $saved_settings = get_option( 'megamenu_settings' ); |
|
| 192 | + $saved_settings = get_option( 'megamenu_settings' ); |
|
| 193 | 193 | |
| 194 | - if ( has_action( "megamenu_page_{$tab}" ) ) { |
|
| 195 | - do_action( "megamenu_page_{$tab}", $saved_settings ); |
|
| 196 | - } else { |
|
| 197 | - do_action( 'megamenu_page_menu_locations', $saved_settings ); |
|
| 198 | - } |
|
| 194 | + if ( has_action( "megamenu_page_{$tab}" ) ) { |
|
| 195 | + do_action( "megamenu_page_{$tab}", $saved_settings ); |
|
| 196 | + } else { |
|
| 197 | + do_action( 'megamenu_page_menu_locations', $saved_settings ); |
|
| 198 | + } |
|
| 199 | 199 | |
| 200 | - ?> |
|
| 200 | + ?> |
|
| 201 | 201 | </div> |
| 202 | 202 | </div> |
| 203 | 203 | |
@@ -206,92 +206,92 @@ discard block |
||
| 206 | 206 | </div> |
| 207 | 207 | |
| 208 | 208 | <?php |
| 209 | - } |
|
| 210 | - |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * Redirect and exit |
|
| 214 | - * |
|
| 215 | - * @since 1.8 |
|
| 216 | - */ |
|
| 217 | - public function redirect( $url ) { |
|
| 218 | - wp_redirect( $url ); |
|
| 219 | - exit; |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - |
|
| 223 | - /** |
|
| 224 | - * Display messages to the user |
|
| 225 | - * |
|
| 226 | - * @since 1.0 |
|
| 227 | - */ |
|
| 228 | - public function print_messages() { |
|
| 229 | - |
|
| 230 | - if ( is_plugin_active( 'clearfy/clearfy.php' ) ) { |
|
| 231 | - if ( $clearfy_options = get_option( 'wbcr_clearfy_cache_options' ) ) { |
|
| 232 | - if ( $clearfy_options['disable_dashicons'] == true ) { |
|
| 233 | - echo "<p class='fail'>" . __( 'Please enable Dashicons in the Clearfy plugin options. Max Mega Menu requires Dashicons.', 'megamenu' ) . '</p>'; |
|
| 234 | - } |
|
| 235 | - } |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - do_action( 'megamenu_print_messages' ); |
|
| 239 | - |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * Enqueue admin scripts |
|
| 245 | - * |
|
| 246 | - * @since 1.8.3 |
|
| 247 | - */ |
|
| 248 | - public function enqueue_scripts( $hook ) { |
|
| 249 | - |
|
| 250 | - wp_deregister_style( 'select2' ); |
|
| 251 | - wp_deregister_script( 'select2' ); |
|
| 252 | - |
|
| 253 | - wp_enqueue_style( 'select2', MEGAMENU_BASE_URL . 'js/select2/select2.css', false, MEGAMENU_VERSION ); |
|
| 254 | - wp_enqueue_script( 'mega-menu-select2', MEGAMENU_BASE_URL . 'js/select2/select2.min.js', array(), MEGAMENU_VERSION ); |
|
| 255 | - |
|
| 256 | - wp_enqueue_style( 'mega-menu-settings', MEGAMENU_BASE_URL . 'css/admin/admin.css', false, MEGAMENU_VERSION ); |
|
| 257 | - |
|
| 258 | - wp_enqueue_style( 'spectrum', MEGAMENU_BASE_URL . 'js/spectrum/spectrum.css', false, "1.8.1" ); |
|
| 259 | - wp_enqueue_script( 'spectrum', MEGAMENU_BASE_URL . 'js/spectrum/spectrum.js', array( 'jquery' ), "1.8.1" ); |
|
| 260 | - |
|
| 261 | - wp_localize_script( |
|
| 262 | - 'spectrum', |
|
| 263 | - 'megamenu_spectrum_settings', |
|
| 264 | - apply_filters( 'megamenu_spectrum_localisation', array() ) |
|
| 265 | - ); |
|
| 266 | - |
|
| 267 | - wp_enqueue_script( 'mega-menu-theme-editor', MEGAMENU_BASE_URL . 'js/settings.js', array( 'jquery', 'spectrum', 'code-editor' ), MEGAMENU_VERSION ); |
|
| 268 | - |
|
| 269 | - wp_localize_script( |
|
| 270 | - 'mega-menu-theme-editor', |
|
| 271 | - 'megamenu_settings', |
|
| 272 | - array( |
|
| 273 | - 'saving' => __( 'Saving', 'megamenu' ), |
|
| 274 | - 'confirm' => __( 'Are you sure?', 'megamenu' ), |
|
| 275 | - 'theme_save_error' => __( 'Error saving theme.', 'megamenu' ), |
|
| 276 | - 'theme_save_error_refresh' => __( 'Please try refreshing the page.', 'megamenu' ), |
|
| 277 | - 'theme_save_error_exhausted' => __( 'The server ran out of memory whilst trying to regenerate the menu CSS.', 'megamenu' ), |
|
| 278 | - 'theme_save_error_memory_limit' => __( 'Try disabling unusued plugins to increase the available memory. Alternatively, for details on how to increase your server memory limit see:', 'megamenu' ), |
|
| 279 | - 'theme_save_error_500' => __( 'The server returned a 500 error. The server did not provide an error message (you should find details of the error in your server error log), but this is usually due to your server memory limit being reached.', 'megamenu' ), |
|
| 280 | - 'increase_memory_limit_url' => 'http://www.wpbeginner.com/wp-tutorials/fix-wordpress-memory-exhausted-error-increase-php-memory/', |
|
| 281 | - 'increase_memory_limit_anchor_text' => 'How to increase the WordPress memory limit', |
|
| 282 | - ) |
|
| 283 | - ); |
|
| 284 | - |
|
| 285 | - if ( function_exists( 'wp_enqueue_code_editor' ) ) { |
|
| 286 | - wp_deregister_style( 'codemirror' ); |
|
| 287 | - wp_deregister_script( 'codemirror' ); |
|
| 288 | - |
|
| 289 | - $cm_settings['codeEditor'] = wp_enqueue_code_editor( array( 'type' => 'text/x-scss' ) ); |
|
| 290 | - wp_localize_script( 'mega-menu-theme-editor', 'cm_settings', $cm_settings ); |
|
| 291 | - wp_enqueue_style( 'wp-codemirror' ); |
|
| 292 | - } |
|
| 293 | - } |
|
| 294 | - |
|
| 295 | - } |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * Redirect and exit |
|
| 214 | + * |
|
| 215 | + * @since 1.8 |
|
| 216 | + */ |
|
| 217 | + public function redirect( $url ) { |
|
| 218 | + wp_redirect( $url ); |
|
| 219 | + exit; |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + |
|
| 223 | + /** |
|
| 224 | + * Display messages to the user |
|
| 225 | + * |
|
| 226 | + * @since 1.0 |
|
| 227 | + */ |
|
| 228 | + public function print_messages() { |
|
| 229 | + |
|
| 230 | + if ( is_plugin_active( 'clearfy/clearfy.php' ) ) { |
|
| 231 | + if ( $clearfy_options = get_option( 'wbcr_clearfy_cache_options' ) ) { |
|
| 232 | + if ( $clearfy_options['disable_dashicons'] == true ) { |
|
| 233 | + echo "<p class='fail'>" . __( 'Please enable Dashicons in the Clearfy plugin options. Max Mega Menu requires Dashicons.', 'megamenu' ) . '</p>'; |
|
| 234 | + } |
|
| 235 | + } |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + do_action( 'megamenu_print_messages' ); |
|
| 239 | + |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * Enqueue admin scripts |
|
| 245 | + * |
|
| 246 | + * @since 1.8.3 |
|
| 247 | + */ |
|
| 248 | + public function enqueue_scripts( $hook ) { |
|
| 249 | + |
|
| 250 | + wp_deregister_style( 'select2' ); |
|
| 251 | + wp_deregister_script( 'select2' ); |
|
| 252 | + |
|
| 253 | + wp_enqueue_style( 'select2', MEGAMENU_BASE_URL . 'js/select2/select2.css', false, MEGAMENU_VERSION ); |
|
| 254 | + wp_enqueue_script( 'mega-menu-select2', MEGAMENU_BASE_URL . 'js/select2/select2.min.js', array(), MEGAMENU_VERSION ); |
|
| 255 | + |
|
| 256 | + wp_enqueue_style( 'mega-menu-settings', MEGAMENU_BASE_URL . 'css/admin/admin.css', false, MEGAMENU_VERSION ); |
|
| 257 | + |
|
| 258 | + wp_enqueue_style( 'spectrum', MEGAMENU_BASE_URL . 'js/spectrum/spectrum.css', false, "1.8.1" ); |
|
| 259 | + wp_enqueue_script( 'spectrum', MEGAMENU_BASE_URL . 'js/spectrum/spectrum.js', array( 'jquery' ), "1.8.1" ); |
|
| 260 | + |
|
| 261 | + wp_localize_script( |
|
| 262 | + 'spectrum', |
|
| 263 | + 'megamenu_spectrum_settings', |
|
| 264 | + apply_filters( 'megamenu_spectrum_localisation', array() ) |
|
| 265 | + ); |
|
| 266 | + |
|
| 267 | + wp_enqueue_script( 'mega-menu-theme-editor', MEGAMENU_BASE_URL . 'js/settings.js', array( 'jquery', 'spectrum', 'code-editor' ), MEGAMENU_VERSION ); |
|
| 268 | + |
|
| 269 | + wp_localize_script( |
|
| 270 | + 'mega-menu-theme-editor', |
|
| 271 | + 'megamenu_settings', |
|
| 272 | + array( |
|
| 273 | + 'saving' => __( 'Saving', 'megamenu' ), |
|
| 274 | + 'confirm' => __( 'Are you sure?', 'megamenu' ), |
|
| 275 | + 'theme_save_error' => __( 'Error saving theme.', 'megamenu' ), |
|
| 276 | + 'theme_save_error_refresh' => __( 'Please try refreshing the page.', 'megamenu' ), |
|
| 277 | + 'theme_save_error_exhausted' => __( 'The server ran out of memory whilst trying to regenerate the menu CSS.', 'megamenu' ), |
|
| 278 | + 'theme_save_error_memory_limit' => __( 'Try disabling unusued plugins to increase the available memory. Alternatively, for details on how to increase your server memory limit see:', 'megamenu' ), |
|
| 279 | + 'theme_save_error_500' => __( 'The server returned a 500 error. The server did not provide an error message (you should find details of the error in your server error log), but this is usually due to your server memory limit being reached.', 'megamenu' ), |
|
| 280 | + 'increase_memory_limit_url' => 'http://www.wpbeginner.com/wp-tutorials/fix-wordpress-memory-exhausted-error-increase-php-memory/', |
|
| 281 | + 'increase_memory_limit_anchor_text' => 'How to increase the WordPress memory limit', |
|
| 282 | + ) |
|
| 283 | + ); |
|
| 284 | + |
|
| 285 | + if ( function_exists( 'wp_enqueue_code_editor' ) ) { |
|
| 286 | + wp_deregister_style( 'codemirror' ); |
|
| 287 | + wp_deregister_script( 'codemirror' ); |
|
| 288 | + |
|
| 289 | + $cm_settings['codeEditor'] = wp_enqueue_code_editor( array( 'type' => 'text/x-scss' ) ); |
|
| 290 | + wp_localize_script( 'mega-menu-theme-editor', 'cm_settings', $cm_settings ); |
|
| 291 | + wp_enqueue_style( 'wp-codemirror' ); |
|
| 292 | + } |
|
| 293 | + } |
|
| 294 | + |
|
| 295 | + } |
|
| 296 | 296 | |
| 297 | 297 | endif; |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | 4 | exit; // disable direct access |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if ( ! class_exists( 'Mega_Menu_Page' ) ) : |
|
| 7 | +if (!class_exists('Mega_Menu_Page')) : |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Handles all admin related functionality. |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | * @since 1.0 |
| 18 | 18 | */ |
| 19 | 19 | public function __construct() { |
| 20 | - add_action( 'admin_menu', array( $this, 'megamenu_settings_page' ) ); |
|
| 21 | - add_action( 'megamenu_admin_scripts', array( $this, 'enqueue_scripts' ) ); |
|
| 20 | + add_action('admin_menu', array($this, 'megamenu_settings_page')); |
|
| 21 | + add_action('megamenu_admin_scripts', array($this, 'enqueue_scripts')); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -33,17 +33,17 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $icon = 'data:image/svg+xml;base64,' . $svg; |
| 35 | 35 | |
| 36 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 36 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 37 | 37 | |
| 38 | - $page = add_menu_page( __( 'Max Mega Menu', 'megamenu' ), __( 'Mega Menu', 'megamenu' ), $capability, 'maxmegamenu', array( $this, 'page' ), $icon ); |
|
| 38 | + $page = add_menu_page(__('Max Mega Menu', 'megamenu'), __('Mega Menu', 'megamenu'), $capability, 'maxmegamenu', array($this, 'page'), $icon); |
|
| 39 | 39 | |
| 40 | - $tabs = apply_filters( 'megamenu_menu_tabs', array() ); |
|
| 40 | + $tabs = apply_filters('megamenu_menu_tabs', array()); |
|
| 41 | 41 | |
| 42 | - foreach ( $tabs as $key => $title ) { |
|
| 43 | - if ( $key == 'menu_locations' ) { |
|
| 44 | - add_submenu_page( 'maxmegamenu', __( 'Max Mega Menu', 'megamenu' ) . ' - ' . $title, $title, $capability, 'maxmegamenu', array( $this, 'page' ) ); |
|
| 42 | + foreach ($tabs as $key => $title) { |
|
| 43 | + if ($key == 'menu_locations') { |
|
| 44 | + add_submenu_page('maxmegamenu', __('Max Mega Menu', 'megamenu') . ' - ' . $title, $title, $capability, 'maxmegamenu', array($this, 'page')); |
|
| 45 | 45 | } else { |
| 46 | - add_submenu_page( 'maxmegamenu', __( 'Max Mega Menu', 'megamenu' ) . ' - ' . $title, $title, $capability, 'maxmegamenu_' . $key, array( $this, 'page' ) ); |
|
| 46 | + add_submenu_page('maxmegamenu', __('Max Mega Menu', 'megamenu') . ' - ' . $title, $title, $capability, 'maxmegamenu_' . $key, array($this, 'page')); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -58,14 +58,14 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function page() { |
| 60 | 60 | |
| 61 | - $tab = isset( $_GET['page'] ) ? substr( $_GET['page'], 12 ) : false; |
|
| 61 | + $tab = isset($_GET['page']) ? substr($_GET['page'], 12) : false; |
|
| 62 | 62 | |
| 63 | 63 | // backwards compatibility |
| 64 | - if ( isset( $_GET['tab'] ) ) { |
|
| 64 | + if (isset($_GET['tab'])) { |
|
| 65 | 65 | $tab = $_GET['tab']; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if ( ! $tab ) { |
|
| 68 | + if (!$tab) { |
|
| 69 | 69 | $tab = 'menu_locations'; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -75,29 +75,29 @@ discard block |
||
| 75 | 75 | 'homepage' => array( |
| 76 | 76 | 'url' => 'https://www.megamenu.com/?utm_source=free&utm_medium=settings&utm_campaign=pro', |
| 77 | 77 | 'target' => '_mmmpro', |
| 78 | - 'text' => __( 'Homepage', 'megamenu' ), |
|
| 78 | + 'text' => __('Homepage', 'megamenu'), |
|
| 79 | 79 | 'class' => '', |
| 80 | 80 | ), |
| 81 | 81 | 'documentation' => array( |
| 82 | 82 | 'url' => 'https://www.megamenu.com/documentation/installation/?utm_source=free&utm_medium=settings&utm_campaign=pro', |
| 83 | - 'text' => __( 'Documentation', 'megamenu' ), |
|
| 83 | + 'text' => __('Documentation', 'megamenu'), |
|
| 84 | 84 | 'target' => '_mmmpro', |
| 85 | 85 | 'class' => '', |
| 86 | 86 | ), |
| 87 | 87 | 'troubleshooting' => array( |
| 88 | 88 | 'url' => 'https://www.megamenu.com/articles/troubleshooting/?utm_source=free&utm_medium=settings&utm_campaign=pro', |
| 89 | - 'text' => __( 'Troubleshooting', 'megamenu' ), |
|
| 89 | + 'text' => __('Troubleshooting', 'megamenu'), |
|
| 90 | 90 | 'target' => '_mmmpro', |
| 91 | 91 | 'class' => '', |
| 92 | 92 | ), |
| 93 | 93 | ) |
| 94 | 94 | ); |
| 95 | 95 | |
| 96 | - if ( ! is_plugin_active( 'megamenu-pro/megamenu-pro.php' ) ) { |
|
| 96 | + if (!is_plugin_active('megamenu-pro/megamenu-pro.php')) { |
|
| 97 | 97 | $header_links['pro'] = array( |
| 98 | 98 | 'url' => 'https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=settings&utm_campaign=pro', |
| 99 | 99 | 'target' => '_mmmpro', |
| 100 | - 'text' => __( 'Upgrade to Pro', 'megamenu' ), |
|
| 100 | + 'text' => __('Upgrade to Pro', 'megamenu'), |
|
| 101 | 101 | 'class' => 'mega-highlight', |
| 102 | 102 | ); |
| 103 | 103 | } |
@@ -107,11 +107,11 @@ discard block |
||
| 107 | 107 | array( |
| 108 | 108 | 'core' => array( |
| 109 | 109 | 'version' => MEGAMENU_VERSION, |
| 110 | - 'text' => __( 'Core version', 'megamenu' ), |
|
| 110 | + 'text' => __('Core version', 'megamenu'), |
|
| 111 | 111 | ), |
| 112 | 112 | 'pro' => array( |
| 113 | 113 | 'version' => "<a href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=settings&utm_campaign=pro' target='_mmmpro'>not installed</a>", |
| 114 | - 'text' => __( 'Pro extension', 'megamenu' ), |
|
| 114 | + 'text' => __('Pro extension', 'megamenu'), |
|
| 115 | 115 | ), |
| 116 | 116 | ) |
| 117 | 117 | ); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | <div class='megamenu_header_top'> |
| 123 | 123 | <ul> |
| 124 | 124 | <?php |
| 125 | - foreach ( $header_links as $id => $data ) { |
|
| 125 | + foreach ($header_links as $id => $data) { |
|
| 126 | 126 | echo "<li class='{$data['class']}'><a href='{$data['url']}' target='{$data['target']}'>{$data['text']}"; |
| 127 | 127 | echo '</a>'; |
| 128 | 128 | echo '</li>'; |
@@ -132,20 +132,20 @@ discard block |
||
| 132 | 132 | </div> |
| 133 | 133 | <div class='megamenu_header'> |
| 134 | 134 | <div class='megamenu_header_left'> |
| 135 | - <h2><?php _e( 'Max Mega Menu', 'megamenu' ); ?></h2> |
|
| 135 | + <h2><?php _e('Max Mega Menu', 'megamenu'); ?></h2> |
|
| 136 | 136 | <div class='version'> |
| 137 | 137 | <?php |
| 138 | 138 | |
| 139 | - $total = count( $versions ); |
|
| 139 | + $total = count($versions); |
|
| 140 | 140 | $count = 0; |
| 141 | 141 | $separator = ' - '; |
| 142 | 142 | |
| 143 | - foreach ( $versions as $id => $data ) { |
|
| 143 | + foreach ($versions as $id => $data) { |
|
| 144 | 144 | echo $data['text'] . ': <b>' . $data['version'] . '</b>'; |
| 145 | 145 | |
| 146 | 146 | $count = $count + 1; |
| 147 | 147 | |
| 148 | - if ( $total > 0 && $count != $total ) { |
|
| 148 | + if ($total > 0 && $count != $total) { |
|
| 149 | 149 | echo $separator; |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | </div> |
| 155 | 155 | |
| 156 | 156 | <?php |
| 157 | - if ( isset( $_GET['debug'] ) ) { |
|
| 157 | + if (isset($_GET['debug'])) { |
|
| 158 | 158 | echo "<textarea style='width: 100%; height: 400px;'>"; |
| 159 | - var_dump( get_option("megamenu_settings") ); |
|
| 159 | + var_dump(get_option("megamenu_settings")); |
|
| 160 | 160 | echo "</textarea>"; |
| 161 | 161 | } |
| 162 | 162 | ?> |
@@ -166,18 +166,18 @@ discard block |
||
| 166 | 166 | <div class='megamenu_left'> |
| 167 | 167 | <ul class='mega-page-navigation'> |
| 168 | 168 | <?php |
| 169 | - $tabs = apply_filters( 'megamenu_menu_tabs', array() ); |
|
| 169 | + $tabs = apply_filters('megamenu_menu_tabs', array()); |
|
| 170 | 170 | |
| 171 | - foreach ( $tabs as $key => $title ) { |
|
| 171 | + foreach ($tabs as $key => $title) { |
|
| 172 | 172 | $class = $tab == $key ? 'active' : ''; |
| 173 | 173 | |
| 174 | - if ( $key == 'menu_locations' ) { |
|
| 175 | - $args = array( 'page' => 'maxmegamenu' ); |
|
| 174 | + if ($key == 'menu_locations') { |
|
| 175 | + $args = array('page' => 'maxmegamenu'); |
|
| 176 | 176 | } else { |
| 177 | - $args = array( 'page' => 'maxmegamenu_' . $key ); |
|
| 177 | + $args = array('page' => 'maxmegamenu_' . $key); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $url = esc_url( add_query_arg( $args, admin_url( 'admin.php' ) ) ); |
|
| 180 | + $url = esc_url(add_query_arg($args, admin_url('admin.php'))); |
|
| 181 | 181 | |
| 182 | 182 | echo "<li class='{$key}'><a class='{$class}' href='{$url}'>{$title}</a></li>"; |
| 183 | 183 | } |
@@ -189,12 +189,12 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | <?php |
| 191 | 191 | |
| 192 | - $saved_settings = get_option( 'megamenu_settings' ); |
|
| 192 | + $saved_settings = get_option('megamenu_settings'); |
|
| 193 | 193 | |
| 194 | - if ( has_action( "megamenu_page_{$tab}" ) ) { |
|
| 195 | - do_action( "megamenu_page_{$tab}", $saved_settings ); |
|
| 194 | + if (has_action("megamenu_page_{$tab}")) { |
|
| 195 | + do_action("megamenu_page_{$tab}", $saved_settings); |
|
| 196 | 196 | } else { |
| 197 | - do_action( 'megamenu_page_menu_locations', $saved_settings ); |
|
| 197 | + do_action('megamenu_page_menu_locations', $saved_settings); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | ?> |
@@ -214,8 +214,8 @@ discard block |
||
| 214 | 214 | * |
| 215 | 215 | * @since 1.8 |
| 216 | 216 | */ |
| 217 | - public function redirect( $url ) { |
|
| 218 | - wp_redirect( $url ); |
|
| 217 | + public function redirect($url) { |
|
| 218 | + wp_redirect($url); |
|
| 219 | 219 | exit; |
| 220 | 220 | } |
| 221 | 221 | |
@@ -227,15 +227,15 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | public function print_messages() { |
| 229 | 229 | |
| 230 | - if ( is_plugin_active( 'clearfy/clearfy.php' ) ) { |
|
| 231 | - if ( $clearfy_options = get_option( 'wbcr_clearfy_cache_options' ) ) { |
|
| 232 | - if ( $clearfy_options['disable_dashicons'] == true ) { |
|
| 233 | - echo "<p class='fail'>" . __( 'Please enable Dashicons in the Clearfy plugin options. Max Mega Menu requires Dashicons.', 'megamenu' ) . '</p>'; |
|
| 230 | + if (is_plugin_active('clearfy/clearfy.php')) { |
|
| 231 | + if ($clearfy_options = get_option('wbcr_clearfy_cache_options')) { |
|
| 232 | + if ($clearfy_options['disable_dashicons'] == true) { |
|
| 233 | + echo "<p class='fail'>" . __('Please enable Dashicons in the Clearfy plugin options. Max Mega Menu requires Dashicons.', 'megamenu') . '</p>'; |
|
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - do_action( 'megamenu_print_messages' ); |
|
| 238 | + do_action('megamenu_print_messages'); |
|
| 239 | 239 | |
| 240 | 240 | } |
| 241 | 241 | |
@@ -245,50 +245,50 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | * @since 1.8.3 |
| 247 | 247 | */ |
| 248 | - public function enqueue_scripts( $hook ) { |
|
| 248 | + public function enqueue_scripts($hook) { |
|
| 249 | 249 | |
| 250 | - wp_deregister_style( 'select2' ); |
|
| 251 | - wp_deregister_script( 'select2' ); |
|
| 250 | + wp_deregister_style('select2'); |
|
| 251 | + wp_deregister_script('select2'); |
|
| 252 | 252 | |
| 253 | - wp_enqueue_style( 'select2', MEGAMENU_BASE_URL . 'js/select2/select2.css', false, MEGAMENU_VERSION ); |
|
| 254 | - wp_enqueue_script( 'mega-menu-select2', MEGAMENU_BASE_URL . 'js/select2/select2.min.js', array(), MEGAMENU_VERSION ); |
|
| 253 | + wp_enqueue_style('select2', MEGAMENU_BASE_URL . 'js/select2/select2.css', false, MEGAMENU_VERSION); |
|
| 254 | + wp_enqueue_script('mega-menu-select2', MEGAMENU_BASE_URL . 'js/select2/select2.min.js', array(), MEGAMENU_VERSION); |
|
| 255 | 255 | |
| 256 | - wp_enqueue_style( 'mega-menu-settings', MEGAMENU_BASE_URL . 'css/admin/admin.css', false, MEGAMENU_VERSION ); |
|
| 256 | + wp_enqueue_style('mega-menu-settings', MEGAMENU_BASE_URL . 'css/admin/admin.css', false, MEGAMENU_VERSION); |
|
| 257 | 257 | |
| 258 | - wp_enqueue_style( 'spectrum', MEGAMENU_BASE_URL . 'js/spectrum/spectrum.css', false, "1.8.1" ); |
|
| 259 | - wp_enqueue_script( 'spectrum', MEGAMENU_BASE_URL . 'js/spectrum/spectrum.js', array( 'jquery' ), "1.8.1" ); |
|
| 258 | + wp_enqueue_style('spectrum', MEGAMENU_BASE_URL . 'js/spectrum/spectrum.css', false, "1.8.1"); |
|
| 259 | + wp_enqueue_script('spectrum', MEGAMENU_BASE_URL . 'js/spectrum/spectrum.js', array('jquery'), "1.8.1"); |
|
| 260 | 260 | |
| 261 | 261 | wp_localize_script( |
| 262 | 262 | 'spectrum', |
| 263 | 263 | 'megamenu_spectrum_settings', |
| 264 | - apply_filters( 'megamenu_spectrum_localisation', array() ) |
|
| 264 | + apply_filters('megamenu_spectrum_localisation', array()) |
|
| 265 | 265 | ); |
| 266 | 266 | |
| 267 | - wp_enqueue_script( 'mega-menu-theme-editor', MEGAMENU_BASE_URL . 'js/settings.js', array( 'jquery', 'spectrum', 'code-editor' ), MEGAMENU_VERSION ); |
|
| 267 | + wp_enqueue_script('mega-menu-theme-editor', MEGAMENU_BASE_URL . 'js/settings.js', array('jquery', 'spectrum', 'code-editor'), MEGAMENU_VERSION); |
|
| 268 | 268 | |
| 269 | 269 | wp_localize_script( |
| 270 | 270 | 'mega-menu-theme-editor', |
| 271 | 271 | 'megamenu_settings', |
| 272 | 272 | array( |
| 273 | - 'saving' => __( 'Saving', 'megamenu' ), |
|
| 274 | - 'confirm' => __( 'Are you sure?', 'megamenu' ), |
|
| 275 | - 'theme_save_error' => __( 'Error saving theme.', 'megamenu' ), |
|
| 276 | - 'theme_save_error_refresh' => __( 'Please try refreshing the page.', 'megamenu' ), |
|
| 277 | - 'theme_save_error_exhausted' => __( 'The server ran out of memory whilst trying to regenerate the menu CSS.', 'megamenu' ), |
|
| 278 | - 'theme_save_error_memory_limit' => __( 'Try disabling unusued plugins to increase the available memory. Alternatively, for details on how to increase your server memory limit see:', 'megamenu' ), |
|
| 279 | - 'theme_save_error_500' => __( 'The server returned a 500 error. The server did not provide an error message (you should find details of the error in your server error log), but this is usually due to your server memory limit being reached.', 'megamenu' ), |
|
| 273 | + 'saving' => __('Saving', 'megamenu'), |
|
| 274 | + 'confirm' => __('Are you sure?', 'megamenu'), |
|
| 275 | + 'theme_save_error' => __('Error saving theme.', 'megamenu'), |
|
| 276 | + 'theme_save_error_refresh' => __('Please try refreshing the page.', 'megamenu'), |
|
| 277 | + 'theme_save_error_exhausted' => __('The server ran out of memory whilst trying to regenerate the menu CSS.', 'megamenu'), |
|
| 278 | + 'theme_save_error_memory_limit' => __('Try disabling unusued plugins to increase the available memory. Alternatively, for details on how to increase your server memory limit see:', 'megamenu'), |
|
| 279 | + 'theme_save_error_500' => __('The server returned a 500 error. The server did not provide an error message (you should find details of the error in your server error log), but this is usually due to your server memory limit being reached.', 'megamenu'), |
|
| 280 | 280 | 'increase_memory_limit_url' => 'http://www.wpbeginner.com/wp-tutorials/fix-wordpress-memory-exhausted-error-increase-php-memory/', |
| 281 | 281 | 'increase_memory_limit_anchor_text' => 'How to increase the WordPress memory limit', |
| 282 | 282 | ) |
| 283 | 283 | ); |
| 284 | 284 | |
| 285 | - if ( function_exists( 'wp_enqueue_code_editor' ) ) { |
|
| 286 | - wp_deregister_style( 'codemirror' ); |
|
| 287 | - wp_deregister_script( 'codemirror' ); |
|
| 285 | + if (function_exists('wp_enqueue_code_editor')) { |
|
| 286 | + wp_deregister_style('codemirror'); |
|
| 287 | + wp_deregister_script('codemirror'); |
|
| 288 | 288 | |
| 289 | - $cm_settings['codeEditor'] = wp_enqueue_code_editor( array( 'type' => 'text/x-scss' ) ); |
|
| 290 | - wp_localize_script( 'mega-menu-theme-editor', 'cm_settings', $cm_settings ); |
|
| 291 | - wp_enqueue_style( 'wp-codemirror' ); |
|
| 289 | + $cm_settings['codeEditor'] = wp_enqueue_code_editor(array('type' => 'text/x-scss')); |
|
| 290 | + wp_localize_script('mega-menu-theme-editor', 'cm_settings', $cm_settings); |
|
| 291 | + wp_enqueue_style('wp-codemirror'); |
|
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | |
@@ -1,262 +1,262 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | - exit; // disable direct access. |
|
| 4 | + exit; // disable direct access. |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | if ( ! class_exists( 'Mega_Menu_Locations' ) ) : |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * Handles the Mega Menu > Menu Settings page |
|
| 11 | - */ |
|
| 12 | - class Mega_Menu_Locations { |
|
| 9 | + /** |
|
| 10 | + * Handles the Mega Menu > Menu Settings page |
|
| 11 | + */ |
|
| 12 | + class Mega_Menu_Locations { |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Constructor |
|
| 16 | - * |
|
| 17 | - * @since 2.8 |
|
| 18 | - */ |
|
| 19 | - public function __construct() { |
|
| 20 | - add_action( 'admin_post_megamenu_add_menu_location', array( $this, 'add_menu_location' ) ); |
|
| 21 | - add_action( 'admin_post_megamenu_delete_menu_location', array( $this, 'delete_menu_location' ) ); |
|
| 22 | - add_action( 'admin_post_megamenu_save_menu_location', array( $this, 'save_menu_location' ) ); |
|
| 23 | - |
|
| 24 | - add_action( 'admin_post_megamenu_sandbox', array( $this, 'sandbox' ) ); |
|
| 25 | - add_action( 'wp_print_scripts', array( $this, 'sandbox_remove_unnecessary_scripts' ) ); |
|
| 26 | - add_action( 'wp_print_styles', array( $this, 'sandbox_remove_unnecessary_styles' ) ); |
|
| 27 | - |
|
| 28 | - add_filter( 'megamenu_menu_tabs', array( $this, 'add_locations_tab' ), 1 ); |
|
| 29 | - add_action( 'megamenu_page_menu_locations', array( $this, 'menu_locations_page' ) ); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Add the Menu Locations tab to our available tabs |
|
| 35 | - * |
|
| 36 | - * @param array $tabs array of available tabs. |
|
| 37 | - * @since 2.8 |
|
| 38 | - */ |
|
| 39 | - public function add_locations_tab( $tabs ) { |
|
| 40 | - $tabs['menu_locations'] = __( 'Menu Locations', 'megamenu' ); |
|
| 41 | - return $tabs; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Add a new menu location. |
|
| 47 | - * |
|
| 48 | - * @since 2.8 |
|
| 49 | - */ |
|
| 50 | - public function add_menu_location() { |
|
| 51 | - check_admin_referer( 'megamenu_add_menu_location' ); |
|
| 52 | - |
|
| 53 | - $locations = get_option( 'megamenu_locations' ); |
|
| 54 | - $next_id = $this->get_next_menu_location_id(); |
|
| 55 | - $new_menu_location_id = 'max_mega_menu_' . $next_id; |
|
| 56 | - |
|
| 57 | - $title = 'Max Mega Menu Location ' . $next_id; |
|
| 14 | + /** |
|
| 15 | + * Constructor |
|
| 16 | + * |
|
| 17 | + * @since 2.8 |
|
| 18 | + */ |
|
| 19 | + public function __construct() { |
|
| 20 | + add_action( 'admin_post_megamenu_add_menu_location', array( $this, 'add_menu_location' ) ); |
|
| 21 | + add_action( 'admin_post_megamenu_delete_menu_location', array( $this, 'delete_menu_location' ) ); |
|
| 22 | + add_action( 'admin_post_megamenu_save_menu_location', array( $this, 'save_menu_location' ) ); |
|
| 23 | + |
|
| 24 | + add_action( 'admin_post_megamenu_sandbox', array( $this, 'sandbox' ) ); |
|
| 25 | + add_action( 'wp_print_scripts', array( $this, 'sandbox_remove_unnecessary_scripts' ) ); |
|
| 26 | + add_action( 'wp_print_styles', array( $this, 'sandbox_remove_unnecessary_styles' ) ); |
|
| 27 | + |
|
| 28 | + add_filter( 'megamenu_menu_tabs', array( $this, 'add_locations_tab' ), 1 ); |
|
| 29 | + add_action( 'megamenu_page_menu_locations', array( $this, 'menu_locations_page' ) ); |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Add the Menu Locations tab to our available tabs |
|
| 35 | + * |
|
| 36 | + * @param array $tabs array of available tabs. |
|
| 37 | + * @since 2.8 |
|
| 38 | + */ |
|
| 39 | + public function add_locations_tab( $tabs ) { |
|
| 40 | + $tabs['menu_locations'] = __( 'Menu Locations', 'megamenu' ); |
|
| 41 | + return $tabs; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Add a new menu location. |
|
| 47 | + * |
|
| 48 | + * @since 2.8 |
|
| 49 | + */ |
|
| 50 | + public function add_menu_location() { |
|
| 51 | + check_admin_referer( 'megamenu_add_menu_location' ); |
|
| 52 | + |
|
| 53 | + $locations = get_option( 'megamenu_locations' ); |
|
| 54 | + $next_id = $this->get_next_menu_location_id(); |
|
| 55 | + $new_menu_location_id = 'max_mega_menu_' . $next_id; |
|
| 56 | + |
|
| 57 | + $title = 'Max Mega Menu Location ' . $next_id; |
|
| 58 | 58 | |
| 59 | - if ( isset( $_POST['title'] ) ) { |
|
| 60 | - $title = esc_attr( wp_unslash( $_POST['title'] ) ); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - $locations[ $new_menu_location_id ] = esc_attr( $title ); |
|
| 64 | - |
|
| 65 | - update_option( 'megamenu_locations', $locations ); |
|
| 66 | - |
|
| 67 | - $menu_id = 0; |
|
| 68 | - |
|
| 69 | - if ( isset( $_POST['menu_id'] ) ) { |
|
| 70 | - $menu_id = absint( $_POST['menu_id'] ); |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - if ( $menu_id > 0 ) { |
|
| 74 | - $locations = get_theme_mod( 'nav_menu_locations' ); |
|
| 75 | - |
|
| 76 | - $locations[ $new_menu_location_id ] = $menu_id; |
|
| 77 | - set_theme_mod( 'nav_menu_locations', $locations ); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - do_action( 'megamenu_after_add_menu_location' ); |
|
| 81 | - |
|
| 82 | - $redirect_url = add_query_arg( |
|
| 83 | - array( |
|
| 84 | - 'page' => 'maxmegamenu', |
|
| 85 | - 'location_added' => 'true', |
|
| 86 | - 'location' => $new_menu_location_id, |
|
| 87 | - ), |
|
| 88 | - admin_url( 'admin.php' ) |
|
| 89 | - ); |
|
| 90 | - |
|
| 91 | - $this->redirect( $redirect_url ); |
|
| 92 | - |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * Delete a menu location. |
|
| 98 | - * |
|
| 99 | - * @since 2.8 |
|
| 100 | - */ |
|
| 101 | - public function delete_menu_location() { |
|
| 102 | - check_admin_referer( 'megamenu_delete_menu_location' ); |
|
| 103 | - |
|
| 104 | - $locations = get_option( 'megamenu_locations' ); |
|
| 105 | - $location_to_delete = esc_attr( $_GET['location'] ); |
|
| 106 | - |
|
| 107 | - if ( isset( $locations[ $location_to_delete ] ) ) { |
|
| 108 | - unset( $locations[ $location_to_delete ] ); |
|
| 109 | - update_option( 'megamenu_locations', $locations ); |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - do_action( 'megamenu_after_delete_menu_location' ); |
|
| 113 | - do_action( 'megamenu_delete_cache' ); |
|
| 114 | - |
|
| 115 | - $redirect_url = add_query_arg( |
|
| 116 | - array( |
|
| 117 | - 'page' => 'maxmegamenu', |
|
| 118 | - 'delete_location' => 'true', |
|
| 119 | - ), |
|
| 120 | - admin_url( 'admin.php' ) |
|
| 121 | - ); |
|
| 122 | - |
|
| 123 | - $this->redirect( $redirect_url ); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Save a menu location |
|
| 128 | - * |
|
| 129 | - * @since 2.0 |
|
| 130 | - */ |
|
| 131 | - public function save_menu_location() { |
|
| 132 | - check_admin_referer( 'megamenu_save_menu_location' ); |
|
| 133 | - |
|
| 134 | - $location = false; |
|
| 135 | - |
|
| 136 | - if ( isset( $_POST['location'] ) ) { |
|
| 137 | - $location = esc_attr( $_POST['location'] ); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - if ( $location ) { |
|
| 141 | - $submitted_settings = apply_filters( 'megamenu_submitted_settings_meta', $_POST['megamenu_meta'] ); |
|
| 142 | - |
|
| 143 | - if ( isset( $submitted_settings[ $location ]['enabled'] ) ) { |
|
| 144 | - $submitted_settings[ $location ]['enabled'] = '1'; |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - if ( ! isset( $submitted_settings[ $location ]['unbind'] ) ) { |
|
| 148 | - $submitted_settings[ $location ]['unbind'] = 'disabled'; |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - if ( ! isset( $submitted_settings[ $location ]['descriptions'] ) ) { |
|
| 152 | - $submitted_settings[ $location ]['descriptions'] = 'disabled'; |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - if ( ! isset( $submitted_settings[ $location ]['prefix'] ) ) { |
|
| 156 | - $submitted_settings[ $location ]['prefix'] = 'disabled'; |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - if ( ! get_option( 'megamenu_settings' ) ) { |
|
| 160 | - update_option( 'megamenu_settings', $submitted_settings ); |
|
| 161 | - } else { |
|
| 162 | - $existing_settings = get_option( 'megamenu_settings' ); |
|
| 163 | - $new_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 164 | - |
|
| 165 | - update_option( 'megamenu_settings', $new_settings ); |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - do_action( 'megamenu_after_save_settings' ); |
|
| 169 | - do_action( 'megamenu_delete_cache' ); |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - /* Save custom location description **/ |
|
| 173 | - if ( isset( $_POST['custom_location'] ) && is_array( $_POST['custom_location'] ) ) { |
|
| 174 | - $custom_location = array_map( 'sanitize_text_field', $_POST['custom_location'] ); |
|
| 175 | - $locations = get_option( 'megamenu_locations' ); |
|
| 176 | - $new_locations = array_merge( (array) $locations, $custom_location ); |
|
| 177 | - |
|
| 178 | - update_option( 'megamenu_locations', $new_locations ); |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - $args = array( |
|
| 182 | - 'page' => 'maxmegamenu', |
|
| 183 | - 'location' => urlencode( $location ), |
|
| 184 | - 'save_location' => 'true', |
|
| 185 | - ); |
|
| 186 | - |
|
| 187 | - if ( ! isset( $submitted_settings[ $location ]['enabled'] ) ) { |
|
| 188 | - unset( $args['location'] ); |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - $redirect_url = add_query_arg( |
|
| 192 | - $args, |
|
| 193 | - admin_url( 'admin.php' ) |
|
| 194 | - ); |
|
| 195 | - |
|
| 196 | - $this->redirect( $redirect_url ); |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - /** |
|
| 200 | - * Redirect and exit |
|
| 201 | - * |
|
| 202 | - * @since 2.8 |
|
| 203 | - */ |
|
| 204 | - public function redirect( $url ) { |
|
| 205 | - wp_redirect( $url ); |
|
| 206 | - exit; |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - |
|
| 210 | - /** |
|
| 211 | - * Returns the next available menu location ID |
|
| 212 | - * |
|
| 213 | - * @since 2.8 |
|
| 214 | - */ |
|
| 215 | - public function get_next_menu_location_id() { |
|
| 216 | - $last_id = 0; |
|
| 217 | - |
|
| 218 | - if ( $locations = get_option( 'megamenu_locations' ) ) { |
|
| 219 | - foreach ( $locations as $key => $value ) { |
|
| 220 | - if ( strpos( $key, 'max_mega_menu_' ) !== false ) { |
|
| 221 | - $parts = explode( '_', $key ); |
|
| 222 | - $menu_id = end( $parts ); |
|
| 223 | - |
|
| 224 | - if ( $menu_id > $last_id ) { |
|
| 225 | - $last_id = $menu_id; |
|
| 226 | - } |
|
| 227 | - } |
|
| 228 | - } |
|
| 229 | - } |
|
| 230 | - |
|
| 231 | - $next_id = $last_id + 1; |
|
| 232 | - |
|
| 233 | - return $next_id; |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - |
|
| 237 | - /** |
|
| 238 | - * Content for Menu Locations page |
|
| 239 | - * |
|
| 240 | - * @since 2.8 |
|
| 241 | - */ |
|
| 242 | - public function menu_locations_page( $saved_settings ) { |
|
| 243 | - if ( isset( $_GET['add_location'] ) ) { |
|
| 244 | - $this->add_location_page(); |
|
| 245 | - return; |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - $all_locations = $this->get_registered_locations(); |
|
| 249 | - $enabled_locations = array(); |
|
| 250 | - $disabled_locations = array(); |
|
| 251 | - |
|
| 252 | - foreach ( $all_locations as $id => $description ) { |
|
| 253 | - if ( max_mega_menu_is_enabled( $id ) ) { |
|
| 254 | - $enabled_locations[ $id ] = $description; |
|
| 255 | - } else { |
|
| 256 | - $disabled_locations[ $id ] = $description; |
|
| 257 | - } |
|
| 258 | - } |
|
| 259 | - ?> |
|
| 59 | + if ( isset( $_POST['title'] ) ) { |
|
| 60 | + $title = esc_attr( wp_unslash( $_POST['title'] ) ); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + $locations[ $new_menu_location_id ] = esc_attr( $title ); |
|
| 64 | + |
|
| 65 | + update_option( 'megamenu_locations', $locations ); |
|
| 66 | + |
|
| 67 | + $menu_id = 0; |
|
| 68 | + |
|
| 69 | + if ( isset( $_POST['menu_id'] ) ) { |
|
| 70 | + $menu_id = absint( $_POST['menu_id'] ); |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + if ( $menu_id > 0 ) { |
|
| 74 | + $locations = get_theme_mod( 'nav_menu_locations' ); |
|
| 75 | + |
|
| 76 | + $locations[ $new_menu_location_id ] = $menu_id; |
|
| 77 | + set_theme_mod( 'nav_menu_locations', $locations ); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + do_action( 'megamenu_after_add_menu_location' ); |
|
| 81 | + |
|
| 82 | + $redirect_url = add_query_arg( |
|
| 83 | + array( |
|
| 84 | + 'page' => 'maxmegamenu', |
|
| 85 | + 'location_added' => 'true', |
|
| 86 | + 'location' => $new_menu_location_id, |
|
| 87 | + ), |
|
| 88 | + admin_url( 'admin.php' ) |
|
| 89 | + ); |
|
| 90 | + |
|
| 91 | + $this->redirect( $redirect_url ); |
|
| 92 | + |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * Delete a menu location. |
|
| 98 | + * |
|
| 99 | + * @since 2.8 |
|
| 100 | + */ |
|
| 101 | + public function delete_menu_location() { |
|
| 102 | + check_admin_referer( 'megamenu_delete_menu_location' ); |
|
| 103 | + |
|
| 104 | + $locations = get_option( 'megamenu_locations' ); |
|
| 105 | + $location_to_delete = esc_attr( $_GET['location'] ); |
|
| 106 | + |
|
| 107 | + if ( isset( $locations[ $location_to_delete ] ) ) { |
|
| 108 | + unset( $locations[ $location_to_delete ] ); |
|
| 109 | + update_option( 'megamenu_locations', $locations ); |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + do_action( 'megamenu_after_delete_menu_location' ); |
|
| 113 | + do_action( 'megamenu_delete_cache' ); |
|
| 114 | + |
|
| 115 | + $redirect_url = add_query_arg( |
|
| 116 | + array( |
|
| 117 | + 'page' => 'maxmegamenu', |
|
| 118 | + 'delete_location' => 'true', |
|
| 119 | + ), |
|
| 120 | + admin_url( 'admin.php' ) |
|
| 121 | + ); |
|
| 122 | + |
|
| 123 | + $this->redirect( $redirect_url ); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Save a menu location |
|
| 128 | + * |
|
| 129 | + * @since 2.0 |
|
| 130 | + */ |
|
| 131 | + public function save_menu_location() { |
|
| 132 | + check_admin_referer( 'megamenu_save_menu_location' ); |
|
| 133 | + |
|
| 134 | + $location = false; |
|
| 135 | + |
|
| 136 | + if ( isset( $_POST['location'] ) ) { |
|
| 137 | + $location = esc_attr( $_POST['location'] ); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + if ( $location ) { |
|
| 141 | + $submitted_settings = apply_filters( 'megamenu_submitted_settings_meta', $_POST['megamenu_meta'] ); |
|
| 142 | + |
|
| 143 | + if ( isset( $submitted_settings[ $location ]['enabled'] ) ) { |
|
| 144 | + $submitted_settings[ $location ]['enabled'] = '1'; |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + if ( ! isset( $submitted_settings[ $location ]['unbind'] ) ) { |
|
| 148 | + $submitted_settings[ $location ]['unbind'] = 'disabled'; |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + if ( ! isset( $submitted_settings[ $location ]['descriptions'] ) ) { |
|
| 152 | + $submitted_settings[ $location ]['descriptions'] = 'disabled'; |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + if ( ! isset( $submitted_settings[ $location ]['prefix'] ) ) { |
|
| 156 | + $submitted_settings[ $location ]['prefix'] = 'disabled'; |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + if ( ! get_option( 'megamenu_settings' ) ) { |
|
| 160 | + update_option( 'megamenu_settings', $submitted_settings ); |
|
| 161 | + } else { |
|
| 162 | + $existing_settings = get_option( 'megamenu_settings' ); |
|
| 163 | + $new_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 164 | + |
|
| 165 | + update_option( 'megamenu_settings', $new_settings ); |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + do_action( 'megamenu_after_save_settings' ); |
|
| 169 | + do_action( 'megamenu_delete_cache' ); |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + /* Save custom location description **/ |
|
| 173 | + if ( isset( $_POST['custom_location'] ) && is_array( $_POST['custom_location'] ) ) { |
|
| 174 | + $custom_location = array_map( 'sanitize_text_field', $_POST['custom_location'] ); |
|
| 175 | + $locations = get_option( 'megamenu_locations' ); |
|
| 176 | + $new_locations = array_merge( (array) $locations, $custom_location ); |
|
| 177 | + |
|
| 178 | + update_option( 'megamenu_locations', $new_locations ); |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + $args = array( |
|
| 182 | + 'page' => 'maxmegamenu', |
|
| 183 | + 'location' => urlencode( $location ), |
|
| 184 | + 'save_location' => 'true', |
|
| 185 | + ); |
|
| 186 | + |
|
| 187 | + if ( ! isset( $submitted_settings[ $location ]['enabled'] ) ) { |
|
| 188 | + unset( $args['location'] ); |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + $redirect_url = add_query_arg( |
|
| 192 | + $args, |
|
| 193 | + admin_url( 'admin.php' ) |
|
| 194 | + ); |
|
| 195 | + |
|
| 196 | + $this->redirect( $redirect_url ); |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + /** |
|
| 200 | + * Redirect and exit |
|
| 201 | + * |
|
| 202 | + * @since 2.8 |
|
| 203 | + */ |
|
| 204 | + public function redirect( $url ) { |
|
| 205 | + wp_redirect( $url ); |
|
| 206 | + exit; |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + |
|
| 210 | + /** |
|
| 211 | + * Returns the next available menu location ID |
|
| 212 | + * |
|
| 213 | + * @since 2.8 |
|
| 214 | + */ |
|
| 215 | + public function get_next_menu_location_id() { |
|
| 216 | + $last_id = 0; |
|
| 217 | + |
|
| 218 | + if ( $locations = get_option( 'megamenu_locations' ) ) { |
|
| 219 | + foreach ( $locations as $key => $value ) { |
|
| 220 | + if ( strpos( $key, 'max_mega_menu_' ) !== false ) { |
|
| 221 | + $parts = explode( '_', $key ); |
|
| 222 | + $menu_id = end( $parts ); |
|
| 223 | + |
|
| 224 | + if ( $menu_id > $last_id ) { |
|
| 225 | + $last_id = $menu_id; |
|
| 226 | + } |
|
| 227 | + } |
|
| 228 | + } |
|
| 229 | + } |
|
| 230 | + |
|
| 231 | + $next_id = $last_id + 1; |
|
| 232 | + |
|
| 233 | + return $next_id; |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + |
|
| 237 | + /** |
|
| 238 | + * Content for Menu Locations page |
|
| 239 | + * |
|
| 240 | + * @since 2.8 |
|
| 241 | + */ |
|
| 242 | + public function menu_locations_page( $saved_settings ) { |
|
| 243 | + if ( isset( $_GET['add_location'] ) ) { |
|
| 244 | + $this->add_location_page(); |
|
| 245 | + return; |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + $all_locations = $this->get_registered_locations(); |
|
| 249 | + $enabled_locations = array(); |
|
| 250 | + $disabled_locations = array(); |
|
| 251 | + |
|
| 252 | + foreach ( $all_locations as $id => $description ) { |
|
| 253 | + if ( max_mega_menu_is_enabled( $id ) ) { |
|
| 254 | + $enabled_locations[ $id ] = $description; |
|
| 255 | + } else { |
|
| 256 | + $disabled_locations[ $id ] = $description; |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | + ?> |
|
| 260 | 260 | |
| 261 | 261 | <div class='menu_settings menu_settings_menu_locations'> |
| 262 | 262 | |
@@ -276,41 +276,41 @@ discard block |
||
| 276 | 276 | <td class='mega-value mega-vartical-align-top'> |
| 277 | 277 | <?php |
| 278 | 278 | |
| 279 | - if ( ! count( $enabled_locations + $disabled_locations ) ) { |
|
| 280 | - echo '<p>'; |
|
| 281 | - esc_html_e( 'Your theme does not natively support menus, but you can add a new menu location using Max Mega Menu and display the menu using the Max Mega Menu widget or shortcode.', 'megamenu' ); |
|
| 282 | - echo '</p>'; |
|
| 283 | - } |
|
| 284 | - |
|
| 285 | - echo "<div class='mega-enabled-locations'>"; |
|
| 286 | - if ( count( $enabled_locations ) ) { |
|
| 287 | - foreach ( $enabled_locations as $location => $description ) { |
|
| 288 | - $this->show_location_accordion_header( $all_locations, $location, $description, $saved_settings ); |
|
| 289 | - } |
|
| 290 | - } |
|
| 291 | - echo "</div>"; |
|
| 292 | - |
|
| 293 | - echo "<div class='mega-disabled-locations'>"; |
|
| 294 | - if ( count( $disabled_locations ) ) { |
|
| 295 | - foreach ( $disabled_locations as $location => $description ) { |
|
| 296 | - $this->show_location_accordion_header( $all_locations, $location, $description, $saved_settings ); |
|
| 297 | - } |
|
| 298 | - } |
|
| 299 | - echo "</div>"; |
|
| 300 | - |
|
| 301 | - $add_location_url = esc_url( |
|
| 302 | - add_query_arg( |
|
| 303 | - array( |
|
| 304 | - 'page' => 'maxmegamenu', |
|
| 305 | - 'add_location' => 'true', |
|
| 306 | - ), |
|
| 307 | - admin_url( 'admin.php' ) |
|
| 308 | - ) |
|
| 309 | - ); |
|
| 310 | - |
|
| 311 | - echo "<p><a class='button button-secondary mega-add-location' href='{$add_location_url}'>" . esc_html__( 'Add another menu location', 'megamenu' ) . '</a></p>'; |
|
| 312 | - |
|
| 313 | - ?> |
|
| 279 | + if ( ! count( $enabled_locations + $disabled_locations ) ) { |
|
| 280 | + echo '<p>'; |
|
| 281 | + esc_html_e( 'Your theme does not natively support menus, but you can add a new menu location using Max Mega Menu and display the menu using the Max Mega Menu widget or shortcode.', 'megamenu' ); |
|
| 282 | + echo '</p>'; |
|
| 283 | + } |
|
| 284 | + |
|
| 285 | + echo "<div class='mega-enabled-locations'>"; |
|
| 286 | + if ( count( $enabled_locations ) ) { |
|
| 287 | + foreach ( $enabled_locations as $location => $description ) { |
|
| 288 | + $this->show_location_accordion_header( $all_locations, $location, $description, $saved_settings ); |
|
| 289 | + } |
|
| 290 | + } |
|
| 291 | + echo "</div>"; |
|
| 292 | + |
|
| 293 | + echo "<div class='mega-disabled-locations'>"; |
|
| 294 | + if ( count( $disabled_locations ) ) { |
|
| 295 | + foreach ( $disabled_locations as $location => $description ) { |
|
| 296 | + $this->show_location_accordion_header( $all_locations, $location, $description, $saved_settings ); |
|
| 297 | + } |
|
| 298 | + } |
|
| 299 | + echo "</div>"; |
|
| 300 | + |
|
| 301 | + $add_location_url = esc_url( |
|
| 302 | + add_query_arg( |
|
| 303 | + array( |
|
| 304 | + 'page' => 'maxmegamenu', |
|
| 305 | + 'add_location' => 'true', |
|
| 306 | + ), |
|
| 307 | + admin_url( 'admin.php' ) |
|
| 308 | + ) |
|
| 309 | + ); |
|
| 310 | + |
|
| 311 | + echo "<p><a class='button button-secondary mega-add-location' href='{$add_location_url}'>" . esc_html__( 'Add another menu location', 'megamenu' ) . '</a></p>'; |
|
| 312 | + |
|
| 313 | + ?> |
|
| 314 | 314 | |
| 315 | 315 | </td> |
| 316 | 316 | </tr> |
@@ -321,54 +321,54 @@ discard block |
||
| 321 | 321 | </div> |
| 322 | 322 | |
| 323 | 323 | <?php |
| 324 | - } |
|
| 325 | - |
|
| 326 | - /** |
|
| 327 | - * Output the HTML for a location accordion header |
|
| 328 | - * |
|
| 329 | - * @param array $locations All available locations |
|
| 330 | - * @param array $location the current location |
|
| 331 | - * @param string $description the location description |
|
| 332 | - */ |
|
| 333 | - private function show_location_accordion_header( $locations, $location, $description, $saved_settings ) { |
|
| 334 | - $open_class = ( isset( $_GET['location'] ) && $_GET['location'] === $location ) ? ' mega-accordion-open' : ''; |
|
| 335 | - $is_enabled_class = 'mega-location-disabled'; |
|
| 336 | - $tooltip = ''; |
|
| 337 | - |
|
| 338 | - if ( max_mega_menu_is_enabled( $location ) ) { |
|
| 339 | - $is_enabled_class = 'mega-location-enabled'; |
|
| 340 | - } elseif ( ! has_nav_menu( $location ) ) { |
|
| 341 | - $is_enabled_class .= ' mega-location-disabled-assign-menu'; |
|
| 342 | - } |
|
| 343 | - |
|
| 344 | - $has_active_location_class = ''; |
|
| 345 | - |
|
| 346 | - $active_instance = 0; |
|
| 347 | - |
|
| 348 | - if ( isset( $saved_settings[ $location ]['active_instance'] ) ) { |
|
| 349 | - $active_instance = $saved_settings[ $location ]['active_instance']; |
|
| 350 | - } elseif ( isset( $saved_settings['instances'][ $location ] ) ) { |
|
| 351 | - $active_instance = $saved_settings['instances'][ $location ]; |
|
| 352 | - } |
|
| 353 | - |
|
| 354 | - if ( $active_instance > 0 ) { |
|
| 355 | - $has_active_location_class = ' mega-has-active-location'; |
|
| 356 | - $tooltip = __( 'Active for Instance' ) . ' ' . esc_attr( $active_instance ); |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - ?> |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + /** |
|
| 327 | + * Output the HTML for a location accordion header |
|
| 328 | + * |
|
| 329 | + * @param array $locations All available locations |
|
| 330 | + * @param array $location the current location |
|
| 331 | + * @param string $description the location description |
|
| 332 | + */ |
|
| 333 | + private function show_location_accordion_header( $locations, $location, $description, $saved_settings ) { |
|
| 334 | + $open_class = ( isset( $_GET['location'] ) && $_GET['location'] === $location ) ? ' mega-accordion-open' : ''; |
|
| 335 | + $is_enabled_class = 'mega-location-disabled'; |
|
| 336 | + $tooltip = ''; |
|
| 337 | + |
|
| 338 | + if ( max_mega_menu_is_enabled( $location ) ) { |
|
| 339 | + $is_enabled_class = 'mega-location-enabled'; |
|
| 340 | + } elseif ( ! has_nav_menu( $location ) ) { |
|
| 341 | + $is_enabled_class .= ' mega-location-disabled-assign-menu'; |
|
| 342 | + } |
|
| 343 | + |
|
| 344 | + $has_active_location_class = ''; |
|
| 345 | + |
|
| 346 | + $active_instance = 0; |
|
| 347 | + |
|
| 348 | + if ( isset( $saved_settings[ $location ]['active_instance'] ) ) { |
|
| 349 | + $active_instance = $saved_settings[ $location ]['active_instance']; |
|
| 350 | + } elseif ( isset( $saved_settings['instances'][ $location ] ) ) { |
|
| 351 | + $active_instance = $saved_settings['instances'][ $location ]; |
|
| 352 | + } |
|
| 353 | + |
|
| 354 | + if ( $active_instance > 0 ) { |
|
| 355 | + $has_active_location_class = ' mega-has-active-location'; |
|
| 356 | + $tooltip = __( 'Active for Instance' ) . ' ' . esc_attr( $active_instance ); |
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + ?> |
|
| 360 | 360 | |
| 361 | 361 | <div class='mega-location <?php echo esc_attr( $is_enabled_class ); ?><?php echo esc_attr( $has_active_location_class ); ?>'> |
| 362 | 362 | <div class='mega-accordion-title<?php echo esc_attr( $open_class ); ?>'> |
| 363 | 363 | <h4><?php echo esc_html( $description ); ?></h4> |
| 364 | 364 | <?php |
| 365 | 365 | |
| 366 | - $tooltip_attr = ''; |
|
| 366 | + $tooltip_attr = ''; |
|
| 367 | 367 | |
| 368 | - if ( strlen( $tooltip ) > 0 ) { |
|
| 369 | - $tooltip_attr = " data-tooltip='{$tooltip}'"; |
|
| 370 | - } |
|
| 371 | - ?> |
|
| 368 | + if ( strlen( $tooltip ) > 0 ) { |
|
| 369 | + $tooltip_attr = " data-tooltip='{$tooltip}'"; |
|
| 370 | + } |
|
| 371 | + ?> |
|
| 372 | 372 | <span class='mega-tooltip'<?php echo $tooltip_attr; ?>> |
| 373 | 373 | <span class='dashicons dashicons-yes'></span> |
| 374 | 374 | </span> |
@@ -381,37 +381,37 @@ discard block |
||
| 381 | 381 | <li><?php echo $this->assigned_menu_link( $location ); ?></li> |
| 382 | 382 | <li><?php echo $this->sandbox_link( $location ); ?></li> |
| 383 | 383 | <?php |
| 384 | - if ( strpos( $location, 'max_mega_menu_' ) !== false ) { |
|
| 385 | - echo '<li>' . $this->delete_location_link( $location ) . '</li>'; |
|
| 386 | - } |
|
| 387 | - ?> |
|
| 384 | + if ( strpos( $location, 'max_mega_menu_' ) !== false ) { |
|
| 385 | + echo '<li>' . $this->delete_location_link( $location ) . '</li>'; |
|
| 386 | + } |
|
| 387 | + ?> |
|
| 388 | 388 | </ul> |
| 389 | 389 | </div> |
| 390 | 390 | </div> |
| 391 | 391 | <div class='mega-accordion-content'> |
| 392 | 392 | <?php |
| 393 | - // if no menu has been assigned to the location |
|
| 394 | - if ( ! has_nav_menu( $location ) ) { |
|
| 395 | - echo "<p class='mega-warning'><span class='dashicons dashicons-warning'></span>"; |
|
| 396 | - echo " <a href='" . admin_url( 'nav-menus.php?action=locations' ) . "'>" . esc_html__( 'Assign a menu', 'megamenu' ) . '</a> '; |
|
| 397 | - echo __( 'to this location to enable these options.', 'megamenu' ); |
|
| 398 | - echo '</p>'; |
|
| 399 | - } else { |
|
| 400 | - $this->show_menu_locations_options( $locations, $location, $description ); |
|
| 401 | - } |
|
| 402 | - ?> |
|
| 393 | + // if no menu has been assigned to the location |
|
| 394 | + if ( ! has_nav_menu( $location ) ) { |
|
| 395 | + echo "<p class='mega-warning'><span class='dashicons dashicons-warning'></span>"; |
|
| 396 | + echo " <a href='" . admin_url( 'nav-menus.php?action=locations' ) . "'>" . esc_html__( 'Assign a menu', 'megamenu' ) . '</a> '; |
|
| 397 | + echo __( 'to this location to enable these options.', 'megamenu' ); |
|
| 398 | + echo '</p>'; |
|
| 399 | + } else { |
|
| 400 | + $this->show_menu_locations_options( $locations, $location, $description ); |
|
| 401 | + } |
|
| 402 | + ?> |
|
| 403 | 403 | </div> |
| 404 | 404 | </div> |
| 405 | 405 | <?php |
| 406 | - } |
|
| 406 | + } |
|
| 407 | 407 | |
| 408 | - /** |
|
| 409 | - * Content for Menu Locations page |
|
| 410 | - * |
|
| 411 | - * @since 2.8 |
|
| 412 | - */ |
|
| 413 | - public function add_location_page() { |
|
| 414 | - ?> |
|
| 408 | + /** |
|
| 409 | + * Content for Menu Locations page |
|
| 410 | + * |
|
| 411 | + * @since 2.8 |
|
| 412 | + */ |
|
| 413 | + public function add_location_page() { |
|
| 414 | + ?> |
|
| 415 | 415 | |
| 416 | 416 | <div class='menu_settings menu_settings_add_location'> |
| 417 | 417 | |
@@ -443,16 +443,16 @@ discard block |
||
| 443 | 443 | <td class='mega-value mega-vartical-align-top'> |
| 444 | 444 | <?php |
| 445 | 445 | |
| 446 | - $menus = wp_get_nav_menus(); |
|
| 446 | + $menus = wp_get_nav_menus(); |
|
| 447 | 447 | |
| 448 | - if ( count( $menus ) ) { |
|
| 449 | - foreach ( $menus as $menu ) { |
|
| 450 | - echo '<div class="mega-radio-row"><input type="radio" id="' . esc_attr( $menu->slug ) . '" name="menu_id" value="' . esc_attr( $menu->term_id ) . '" /><label for="' . esc_attr( $menu->slug ) . '">' . esc_attr( $menu->name ) . '</label></div>'; |
|
| 451 | - } |
|
| 452 | - } |
|
| 448 | + if ( count( $menus ) ) { |
|
| 449 | + foreach ( $menus as $menu ) { |
|
| 450 | + echo '<div class="mega-radio-row"><input type="radio" id="' . esc_attr( $menu->slug ) . '" name="menu_id" value="' . esc_attr( $menu->term_id ) . '" /><label for="' . esc_attr( $menu->slug ) . '">' . esc_attr( $menu->name ) . '</label></div>'; |
|
| 451 | + } |
|
| 452 | + } |
|
| 453 | 453 | |
| 454 | - echo '<div class="mega-radio-row"><input checked="checked" type="radio" id="0" name="menu_id" value="0" /><label for="0">' . esc_html__( "Skip - I'll assign a menu later", 'megamenu' ) . '</label></div>'; |
|
| 455 | - ?> |
|
| 454 | + echo '<div class="mega-radio-row"><input checked="checked" type="radio" id="0" name="menu_id" value="0" /><label for="0">' . esc_html__( "Skip - I'll assign a menu later", 'megamenu' ) . '</label></div>'; |
|
| 455 | + ?> |
|
| 456 | 456 | </td> |
| 457 | 457 | </tr> |
| 458 | 458 | </table> |
@@ -461,102 +461,102 @@ discard block |
||
| 461 | 461 | </div> |
| 462 | 462 | |
| 463 | 463 | <?php |
| 464 | - } |
|
| 465 | - |
|
| 466 | - |
|
| 467 | - /** |
|
| 468 | - * Display a link showing the menu assigned to the specified location |
|
| 469 | - * |
|
| 470 | - * @param string $location |
|
| 471 | - * @since 2.8 |
|
| 472 | - */ |
|
| 473 | - public function assigned_menu_link( $location ) { |
|
| 474 | - $menu_id = $this->get_menu_id_for_location( $location ); |
|
| 475 | - |
|
| 476 | - if ( $menu_id ) { |
|
| 477 | - return "<a href='" . admin_url( "nav-menus.php?action=edit&menu={$menu_id}" ) . "'><span class='dashicons dashicons-menu-alt2'></span>" . esc_html( $this->get_menu_name_for_location( $location ) ) . '</a>'; |
|
| 478 | - } else { |
|
| 479 | - return "<a href='" . admin_url( 'nav-menus.php?action=locations' ) . "'><span class='dashicons dashicons-menu-alt2'></span>" . esc_html__( 'Assign a menu', 'megamenu' ) . '</a>'; |
|
| 480 | - } |
|
| 481 | - } |
|
| 482 | - |
|
| 483 | - /** |
|
| 484 | - * Display a link showing the menu assigned to the specified location |
|
| 485 | - * |
|
| 486 | - * @param string $location |
|
| 487 | - * @since 2.8 |
|
| 488 | - */ |
|
| 489 | - public function sandbox_link( $location ) { |
|
| 490 | - return "<a target='megamenu_sandbox' href='" . admin_url( "admin-post.php?action=megamenu_sandbox&location={$location}" ) . "'><span class='dashicons dashicons-external'></span>" . esc_html__( 'View in Sandbox', 'megamenu' ) . '</a>'; |
|
| 491 | - } |
|
| 492 | - |
|
| 493 | - |
|
| 494 | - /** |
|
| 495 | - * Display a link showing the menu assigned to the specified location |
|
| 496 | - * |
|
| 497 | - * @param string $location |
|
| 498 | - * @since 2.8 |
|
| 499 | - */ |
|
| 500 | - public function delete_location_link( $location ) { |
|
| 501 | - $delete_location_url = esc_url( |
|
| 502 | - add_query_arg( |
|
| 503 | - array( |
|
| 504 | - 'action' => 'megamenu_delete_menu_location', |
|
| 505 | - 'location' => $location, |
|
| 506 | - ), |
|
| 507 | - wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_delete_menu_location' ) |
|
| 508 | - ) |
|
| 509 | - ); |
|
| 510 | - |
|
| 511 | - return "<a class='confirm' href='{$delete_location_url}'><span class='dashicons dashicons-trash'></span>" . esc_html__( 'Delete location', 'megamenu' ) . '</a>'; |
|
| 512 | - } |
|
| 513 | - |
|
| 514 | - /** |
|
| 515 | - * Remove unnecessary scripts from the sandbox page |
|
| 516 | - * |
|
| 517 | - * @since 2.9 |
|
| 518 | - */ |
|
| 519 | - public function sandbox_remove_unnecessary_scripts() { |
|
| 520 | - if ( isset( $_GET['action'] ) && $_GET['action'] === 'megamenu_sandbox' ) { |
|
| 521 | - global $wp_scripts; |
|
| 522 | - |
|
| 523 | - $queue_items = $wp_scripts->queue; |
|
| 524 | - $wp_scripts->queue = array(); |
|
| 525 | - |
|
| 526 | - do_action( 'megamenu_enqueue_scripts' ); |
|
| 527 | - } |
|
| 528 | - } |
|
| 529 | - |
|
| 530 | - /** |
|
| 531 | - * Remove unnecessary styles from the sandbox page |
|
| 532 | - * |
|
| 533 | - * @since 2.9 |
|
| 534 | - */ |
|
| 535 | - public function sandbox_remove_unnecessary_styles() { |
|
| 536 | - if ( isset( $_GET['action'] ) && $_GET['action'] === 'megamenu_sandbox' ) { |
|
| 537 | - global $wp_styles; |
|
| 538 | - |
|
| 539 | - $queue_items = $wp_styles->queue; |
|
| 540 | - $wp_styles->queue = array(); |
|
| 541 | - |
|
| 542 | - do_action( 'megamenu_enqueue_styles' ); |
|
| 543 | - } |
|
| 544 | - } |
|
| 545 | - |
|
| 546 | - |
|
| 547 | - /** |
|
| 548 | - * Content for Sandbox page |
|
| 549 | - * |
|
| 550 | - * @since 2.9 |
|
| 551 | - */ |
|
| 552 | - public function sandbox() { |
|
| 553 | - remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); |
|
| 554 | - remove_action( 'wp_head', '_admin_bar_bump_cb' ); |
|
| 555 | - |
|
| 556 | - if ( isset( $_GET['location'] ) ) { |
|
| 557 | - $location = esc_attr( $_GET['location'] ); |
|
| 558 | - |
|
| 559 | - ?> |
|
| 464 | + } |
|
| 465 | + |
|
| 466 | + |
|
| 467 | + /** |
|
| 468 | + * Display a link showing the menu assigned to the specified location |
|
| 469 | + * |
|
| 470 | + * @param string $location |
|
| 471 | + * @since 2.8 |
|
| 472 | + */ |
|
| 473 | + public function assigned_menu_link( $location ) { |
|
| 474 | + $menu_id = $this->get_menu_id_for_location( $location ); |
|
| 475 | + |
|
| 476 | + if ( $menu_id ) { |
|
| 477 | + return "<a href='" . admin_url( "nav-menus.php?action=edit&menu={$menu_id}" ) . "'><span class='dashicons dashicons-menu-alt2'></span>" . esc_html( $this->get_menu_name_for_location( $location ) ) . '</a>'; |
|
| 478 | + } else { |
|
| 479 | + return "<a href='" . admin_url( 'nav-menus.php?action=locations' ) . "'><span class='dashicons dashicons-menu-alt2'></span>" . esc_html__( 'Assign a menu', 'megamenu' ) . '</a>'; |
|
| 480 | + } |
|
| 481 | + } |
|
| 482 | + |
|
| 483 | + /** |
|
| 484 | + * Display a link showing the menu assigned to the specified location |
|
| 485 | + * |
|
| 486 | + * @param string $location |
|
| 487 | + * @since 2.8 |
|
| 488 | + */ |
|
| 489 | + public function sandbox_link( $location ) { |
|
| 490 | + return "<a target='megamenu_sandbox' href='" . admin_url( "admin-post.php?action=megamenu_sandbox&location={$location}" ) . "'><span class='dashicons dashicons-external'></span>" . esc_html__( 'View in Sandbox', 'megamenu' ) . '</a>'; |
|
| 491 | + } |
|
| 492 | + |
|
| 493 | + |
|
| 494 | + /** |
|
| 495 | + * Display a link showing the menu assigned to the specified location |
|
| 496 | + * |
|
| 497 | + * @param string $location |
|
| 498 | + * @since 2.8 |
|
| 499 | + */ |
|
| 500 | + public function delete_location_link( $location ) { |
|
| 501 | + $delete_location_url = esc_url( |
|
| 502 | + add_query_arg( |
|
| 503 | + array( |
|
| 504 | + 'action' => 'megamenu_delete_menu_location', |
|
| 505 | + 'location' => $location, |
|
| 506 | + ), |
|
| 507 | + wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_delete_menu_location' ) |
|
| 508 | + ) |
|
| 509 | + ); |
|
| 510 | + |
|
| 511 | + return "<a class='confirm' href='{$delete_location_url}'><span class='dashicons dashicons-trash'></span>" . esc_html__( 'Delete location', 'megamenu' ) . '</a>'; |
|
| 512 | + } |
|
| 513 | + |
|
| 514 | + /** |
|
| 515 | + * Remove unnecessary scripts from the sandbox page |
|
| 516 | + * |
|
| 517 | + * @since 2.9 |
|
| 518 | + */ |
|
| 519 | + public function sandbox_remove_unnecessary_scripts() { |
|
| 520 | + if ( isset( $_GET['action'] ) && $_GET['action'] === 'megamenu_sandbox' ) { |
|
| 521 | + global $wp_scripts; |
|
| 522 | + |
|
| 523 | + $queue_items = $wp_scripts->queue; |
|
| 524 | + $wp_scripts->queue = array(); |
|
| 525 | + |
|
| 526 | + do_action( 'megamenu_enqueue_scripts' ); |
|
| 527 | + } |
|
| 528 | + } |
|
| 529 | + |
|
| 530 | + /** |
|
| 531 | + * Remove unnecessary styles from the sandbox page |
|
| 532 | + * |
|
| 533 | + * @since 2.9 |
|
| 534 | + */ |
|
| 535 | + public function sandbox_remove_unnecessary_styles() { |
|
| 536 | + if ( isset( $_GET['action'] ) && $_GET['action'] === 'megamenu_sandbox' ) { |
|
| 537 | + global $wp_styles; |
|
| 538 | + |
|
| 539 | + $queue_items = $wp_styles->queue; |
|
| 540 | + $wp_styles->queue = array(); |
|
| 541 | + |
|
| 542 | + do_action( 'megamenu_enqueue_styles' ); |
|
| 543 | + } |
|
| 544 | + } |
|
| 545 | + |
|
| 546 | + |
|
| 547 | + /** |
|
| 548 | + * Content for Sandbox page |
|
| 549 | + * |
|
| 550 | + * @since 2.9 |
|
| 551 | + */ |
|
| 552 | + public function sandbox() { |
|
| 553 | + remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); |
|
| 554 | + remove_action( 'wp_head', '_admin_bar_bump_cb' ); |
|
| 555 | + |
|
| 556 | + if ( isset( $_GET['location'] ) ) { |
|
| 557 | + $location = esc_attr( $_GET['location'] ); |
|
| 558 | + |
|
| 559 | + ?> |
|
| 560 | 560 | <!DOCTYPE html> |
| 561 | 561 | <html> |
| 562 | 562 | <head> |
@@ -596,24 +596,24 @@ discard block |
||
| 596 | 596 | </body> |
| 597 | 597 | </html> |
| 598 | 598 | <?php |
| 599 | - } |
|
| 599 | + } |
|
| 600 | 600 | |
| 601 | - die(); |
|
| 602 | - } |
|
| 601 | + die(); |
|
| 602 | + } |
|
| 603 | 603 | |
| 604 | - /** |
|
| 605 | - * Content for Menu Location options |
|
| 606 | - * |
|
| 607 | - * @since 2.8 |
|
| 608 | - */ |
|
| 609 | - public function show_menu_locations_options( $all_locations, $location, $description ) { |
|
| 604 | + /** |
|
| 605 | + * Content for Menu Location options |
|
| 606 | + * |
|
| 607 | + * @since 2.8 |
|
| 608 | + */ |
|
| 609 | + public function show_menu_locations_options( $all_locations, $location, $description ) { |
|
| 610 | 610 | |
| 611 | - $menu_id = $this->get_menu_id_for_location( $location ); |
|
| 612 | - $is_custom_location = strpos( $location, 'max_mega_menu_' ) !== false; |
|
| 613 | - $plugin_settings = get_option( 'megamenu_settings' ); |
|
| 614 | - $location_settings = isset( $plugin_settings[ $location ] ) ? $plugin_settings[ $location ] : array(); |
|
| 611 | + $menu_id = $this->get_menu_id_for_location( $location ); |
|
| 612 | + $is_custom_location = strpos( $location, 'max_mega_menu_' ) !== false; |
|
| 613 | + $plugin_settings = get_option( 'megamenu_settings' ); |
|
| 614 | + $location_settings = isset( $plugin_settings[ $location ] ) ? $plugin_settings[ $location ] : array(); |
|
| 615 | 615 | |
| 616 | - ?> |
|
| 616 | + ?> |
|
| 617 | 617 | |
| 618 | 618 | <form action="<?php echo admin_url( 'admin-post.php' ); ?>" method="post"> |
| 619 | 619 | <input type="hidden" name="action" value="megamenu_save_menu_location" /> |
@@ -621,429 +621,429 @@ discard block |
||
| 621 | 621 | <?php wp_nonce_field( 'megamenu_save_menu_location' ); ?> |
| 622 | 622 | <?php |
| 623 | 623 | |
| 624 | - $settings = apply_filters( |
|
| 625 | - 'megamenu_location_settings', |
|
| 626 | - array( |
|
| 627 | - |
|
| 628 | - 'general' => array( |
|
| 629 | - 'priority' => 10, |
|
| 630 | - 'title' => __( 'General Settings', 'megamenu' ), |
|
| 631 | - 'settings' => array( |
|
| 632 | - 'enabled' => array( |
|
| 633 | - 'priority' => 10, |
|
| 634 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 635 | - 'description' => __( 'Enable Max Mega Menu for this menu location?', 'megamenu' ), |
|
| 636 | - 'settings' => array( |
|
| 637 | - array( |
|
| 638 | - 'type' => 'checkbox_enabled', |
|
| 639 | - 'key' => 'enabled', |
|
| 640 | - 'value' => isset( $location_settings['enabled'] ) ? $location_settings['enabled'] : 0, |
|
| 641 | - ), |
|
| 642 | - ), |
|
| 643 | - ), |
|
| 644 | - 'event' => array( |
|
| 645 | - 'priority' => 20, |
|
| 646 | - 'title' => __( 'Event', 'megamenu' ), |
|
| 647 | - 'description' => __( 'Select the event to trigger sub menus', 'megamenu' ), |
|
| 648 | - 'settings' => array( |
|
| 649 | - array( |
|
| 650 | - 'type' => 'event', |
|
| 651 | - 'key' => 'event', |
|
| 652 | - 'value' => isset( $location_settings['event'] ) ? $location_settings['event'] : 'hover', |
|
| 653 | - ), |
|
| 654 | - ), |
|
| 655 | - ), |
|
| 656 | - 'effect' => array( |
|
| 657 | - 'priority' => 30, |
|
| 658 | - 'title' => __( 'Effect', 'megamenu' ), |
|
| 659 | - 'description' => __( 'Select the sub menu animation type', 'megamenu' ), |
|
| 660 | - 'settings' => array( |
|
| 661 | - array( |
|
| 662 | - 'type' => 'effect', |
|
| 663 | - 'key' => 'effect', |
|
| 664 | - 'value' => isset( $location_settings['effect'] ) ? $location_settings['effect'] : 'fade_up', |
|
| 665 | - 'title' => __( 'Animation', 'megamenu' ), |
|
| 666 | - ), |
|
| 667 | - array( |
|
| 668 | - 'type' => 'effect_speed', |
|
| 669 | - 'key' => 'effect_speed', |
|
| 670 | - 'value' => isset( $location_settings['effect_speed'] ) ? $location_settings['effect_speed'] : '200', |
|
| 671 | - 'title' => __( 'Speed', 'megamenu' ), |
|
| 672 | - ), |
|
| 673 | - ), |
|
| 674 | - ), |
|
| 675 | - 'effect_mobile' => array( |
|
| 676 | - 'priority' => 40, |
|
| 677 | - 'title' => __( 'Effect (Mobile)', 'megamenu' ), |
|
| 678 | - 'description' => __( 'Choose a style for your mobile menu', 'megamenu' ), |
|
| 679 | - 'settings' => array( |
|
| 680 | - array( |
|
| 681 | - 'type' => 'effect_mobile', |
|
| 682 | - 'key' => 'effect_mobile', |
|
| 683 | - 'value' => isset( $location_settings['effect_mobile'] ) ? $location_settings['effect_mobile'] : 'none', |
|
| 684 | - 'title' => __( 'Style', 'megamenu' ), |
|
| 685 | - ), |
|
| 686 | - array( |
|
| 687 | - 'type' => 'effect_speed_mobile', |
|
| 688 | - 'key' => 'effect_speed_mobile', |
|
| 689 | - 'value' => isset( $location_settings['effect_speed_mobile'] ) ? $location_settings['effect_speed_mobile'] : '200', |
|
| 690 | - 'title' => __( 'Speed', 'megamenu' ), |
|
| 691 | - ), |
|
| 692 | - ), |
|
| 693 | - ), |
|
| 694 | - 'theme' => array( |
|
| 695 | - 'priority' => 50, |
|
| 696 | - 'title' => __( 'Theme', 'megamenu' ), |
|
| 697 | - 'description' => __( 'Select a theme to be applied to the menu', 'megamenu' ), |
|
| 698 | - 'settings' => array( |
|
| 699 | - array( |
|
| 700 | - 'type' => 'theme_selector', |
|
| 701 | - 'key' => 'theme', |
|
| 702 | - 'value' => isset( $location_settings['theme'] ) ? $location_settings['theme'] : 'default', |
|
| 703 | - ), |
|
| 704 | - ), |
|
| 705 | - ), |
|
| 706 | - ), |
|
| 707 | - ), |
|
| 708 | - 'advanced' => array( |
|
| 709 | - 'priority' => 25, |
|
| 710 | - 'title' => __( 'Advanced', 'megamenu' ), |
|
| 711 | - 'settings' => array( |
|
| 712 | - 'click_behaviour' => array( |
|
| 713 | - 'priority' => 10, |
|
| 714 | - 'title' => __( 'Click Event Behaviour', 'megamenu' ), |
|
| 715 | - 'description' => __( "Define what should happen when the event is set to 'click'. This also applies to mobiles.", 'megamenu' ), |
|
| 716 | - 'settings' => array( |
|
| 717 | - array( |
|
| 718 | - 'type' => 'click_behaviour', |
|
| 719 | - 'key' => 'click_behaviour', |
|
| 720 | - 'value' => $plugin_settings, |
|
| 721 | - ), |
|
| 722 | - ), |
|
| 723 | - ), |
|
| 724 | - 'mobile_behaviour' => array( |
|
| 725 | - 'priority' => 20, |
|
| 726 | - 'title' => __( 'Mobile Sub Menu Behaviour', 'megamenu' ), |
|
| 727 | - 'description' => __( 'Define the sub menu toggle behaviour for the mobile menu.', 'megamenu' ), |
|
| 728 | - 'settings' => array( |
|
| 729 | - array( |
|
| 730 | - 'type' => 'mobile_behaviour', |
|
| 731 | - 'key' => 'mobile_behaviour', |
|
| 732 | - 'value' => $plugin_settings, |
|
| 733 | - ), |
|
| 734 | - ), |
|
| 735 | - ), |
|
| 736 | - 'mobile_state' => array( |
|
| 737 | - 'priority' => 20, |
|
| 738 | - 'title' => __( 'Mobile Sub Menu Default State', 'megamenu' ), |
|
| 739 | - 'description' => __( 'Define the default state of the sub menus when the mobile menu is visible.', 'megamenu' ), |
|
| 740 | - 'settings' => array( |
|
| 741 | - array( |
|
| 742 | - 'type' => 'mobile_state', |
|
| 743 | - 'key' => 'mobile_state', |
|
| 744 | - 'value' => $plugin_settings, |
|
| 745 | - ), |
|
| 746 | - ), |
|
| 747 | - ), |
|
| 748 | - 'descriptions' => array( |
|
| 749 | - 'priority' => 20, |
|
| 750 | - 'title' => __( 'Menu Item Descriptions', 'megamenu' ), |
|
| 751 | - 'description' => __( 'Enable output of menu item descriptions.', 'megamenu' ), |
|
| 752 | - 'settings' => array( |
|
| 753 | - array( |
|
| 754 | - 'type' => 'descriptions', |
|
| 755 | - 'key' => 'descriptions', |
|
| 756 | - 'value' => $plugin_settings, |
|
| 757 | - ), |
|
| 758 | - ), |
|
| 759 | - ), |
|
| 760 | - 'unbind' => array( |
|
| 761 | - 'priority' => 20, |
|
| 762 | - 'title' => __( 'Unbind JavaScript Events', 'megamenu' ), |
|
| 763 | - 'description' => __( 'To avoid conflicts with theme menu systems, JavaScript events which have been added to menu items will be removed by default.', 'megamenu' ), |
|
| 764 | - 'settings' => array( |
|
| 765 | - array( |
|
| 766 | - 'type' => 'unbind', |
|
| 767 | - 'key' => 'unbind', |
|
| 768 | - 'value' => $plugin_settings, |
|
| 769 | - ), |
|
| 770 | - ), |
|
| 771 | - ), |
|
| 772 | - 'prefix' => array( |
|
| 773 | - 'priority' => 20, |
|
| 774 | - 'title' => __( 'Prefix Menu Item Classes', 'megamenu' ), |
|
| 775 | - 'description' => __( "Prefix custom menu item classes with 'mega-'?", 'megamenu' ), |
|
| 776 | - 'settings' => array( |
|
| 777 | - array( |
|
| 778 | - 'type' => 'prefix', |
|
| 779 | - 'key' => 'prefix', |
|
| 780 | - 'value' => $plugin_settings, |
|
| 781 | - ), |
|
| 782 | - ), |
|
| 783 | - ), |
|
| 784 | - 'container' => array( |
|
| 785 | - 'priority' => 20, |
|
| 786 | - 'title' => __( 'Container', 'megamenu' ), |
|
| 787 | - 'description' => __( 'Use nav or div element for menu wrapper?', 'megamenu' ), |
|
| 788 | - 'settings' => array( |
|
| 789 | - array( |
|
| 790 | - 'type' => 'container', |
|
| 791 | - 'key' => 'container', |
|
| 792 | - 'value' => $plugin_settings, |
|
| 793 | - ), |
|
| 794 | - ), |
|
| 795 | - ), |
|
| 796 | - 'active_instance' => array( |
|
| 797 | - 'priority' => 30, |
|
| 798 | - 'title' => __( 'Active Menu Instance', 'megamenu' ), |
|
| 799 | - 'info' => array( __( '0: Apply to all instances. 1: Apply to first instance. 2: Apply to second instance', 'megamenu' ) . '…' ), |
|
| 800 | - 'description' => __( 'Some themes will output this menu location multiple times on the same page. For example, it may be output once for the main menu, then again for the mobile menu. This setting can be used to make sure Max Mega Menu is only applied to one of those instances.', 'megamenu' ), |
|
| 801 | - 'settings' => array( |
|
| 802 | - array( |
|
| 803 | - 'type' => 'active_instance', |
|
| 804 | - 'key' => 'active_instance', |
|
| 805 | - 'value' => $plugin_settings, |
|
| 806 | - ), |
|
| 807 | - ), |
|
| 808 | - ), |
|
| 809 | - ), |
|
| 810 | - ), |
|
| 811 | - 'output_options' => array( |
|
| 812 | - 'priority' => 30, |
|
| 813 | - 'title' => __( 'Display Options', 'megamenu' ), |
|
| 814 | - 'settings' => array( |
|
| 815 | - 'location_php_function' => array( |
|
| 816 | - 'priority' => 10, |
|
| 817 | - 'title' => __( 'PHP Function', 'megamenu' ), |
|
| 818 | - 'description' => __( 'For use in a theme template (usually header.php)', 'megamenu' ), |
|
| 819 | - 'settings' => array( |
|
| 820 | - array( |
|
| 821 | - 'type' => 'location_php_function', |
|
| 822 | - 'key' => 'location_php_function', |
|
| 823 | - 'value' => $location, |
|
| 824 | - ), |
|
| 825 | - ), |
|
| 826 | - ), |
|
| 827 | - 'location_shortcode' => array( |
|
| 828 | - 'priority' => 20, |
|
| 829 | - 'title' => __( 'Shortcode', 'megamenu' ), |
|
| 830 | - 'description' => __( 'For use in a post or page.', 'megamenu' ), |
|
| 831 | - 'settings' => array( |
|
| 832 | - array( |
|
| 833 | - 'type' => 'location_shortcode', |
|
| 834 | - 'key' => 'location_shortcode', |
|
| 835 | - 'value' => $location, |
|
| 836 | - ), |
|
| 837 | - ), |
|
| 838 | - ), |
|
| 839 | - 'location_widget' => array( |
|
| 840 | - 'priority' => 30, |
|
| 841 | - 'title' => __( 'Widget', 'megamenu' ), |
|
| 842 | - 'description' => __( 'For use in a widget area.', 'megamenu' ), |
|
| 843 | - 'settings' => array( |
|
| 844 | - array( |
|
| 845 | - 'type' => 'location_widget', |
|
| 846 | - 'key' => 'location_widget', |
|
| 847 | - 'value' => $location, |
|
| 848 | - ), |
|
| 849 | - ), |
|
| 850 | - ), |
|
| 851 | - ), |
|
| 852 | - ), |
|
| 853 | - ), |
|
| 854 | - $location, |
|
| 855 | - $plugin_settings |
|
| 856 | - ); |
|
| 857 | - |
|
| 858 | - if ( $is_custom_location ) { |
|
| 859 | - |
|
| 860 | - $settings['general']['settings']['location_description'] = array( |
|
| 861 | - 'priority' => 15, |
|
| 862 | - 'title' => __( 'Location Description', 'megamenu' ), |
|
| 863 | - 'description' => __( 'Update the custom location description', 'megamenu' ), |
|
| 864 | - 'settings' => array( |
|
| 865 | - array( |
|
| 866 | - 'type' => 'location_description', |
|
| 867 | - 'key' => 'location_description', |
|
| 868 | - 'value' => $description, |
|
| 869 | - ), |
|
| 870 | - ), |
|
| 871 | - ); |
|
| 872 | - } |
|
| 873 | - |
|
| 874 | - $initial_version = get_option( 'megamenu_initial_version' ); |
|
| 875 | - |
|
| 876 | - if ( $initial_version && version_compare( $initial_version, '2.8', '>' ) ) { |
|
| 877 | - //unset( $settings['advanced']['settings']['prefix'] ); // users who started out with 2.8.1+ will not see this option. |
|
| 878 | - } |
|
| 879 | - |
|
| 880 | - echo "<div class='mega-accordion-content-wrapper'>"; |
|
| 881 | - |
|
| 882 | - echo "<h2 class='nav-tab-wrapper'>"; |
|
| 883 | - |
|
| 884 | - $is_first = true; |
|
| 885 | - |
|
| 886 | - uasort( $settings, array( $this, 'compare_elems' ) ); |
|
| 887 | - |
|
| 888 | - foreach ( $settings as $section_id => $section ) { |
|
| 889 | - |
|
| 890 | - if ( $is_first ) { |
|
| 891 | - $active = 'nav-tab-active'; |
|
| 892 | - $is_first = false; |
|
| 893 | - } else { |
|
| 894 | - $active = ''; |
|
| 895 | - } |
|
| 896 | - |
|
| 897 | - echo "<a class='mega-tab nav-tab {$active}' data-tab='mega-tab-content-{$section_id}'>" . esc_html( $section['title'] ) . '</a>'; |
|
| 898 | - |
|
| 899 | - } |
|
| 900 | - |
|
| 901 | - echo '</h2>'; |
|
| 902 | - |
|
| 903 | - $is_first = true; |
|
| 904 | - |
|
| 905 | - foreach ( $settings as $section_id => $section ) { |
|
| 906 | - |
|
| 907 | - if ( $is_first ) { |
|
| 908 | - $display = 'block'; |
|
| 909 | - $is_first = false; |
|
| 910 | - } else { |
|
| 911 | - $display = 'none'; |
|
| 912 | - } |
|
| 913 | - |
|
| 914 | - echo "<div class='mega-tab-content mega-tab-content-{$section_id}' style='display: {$display}'>"; |
|
| 915 | - |
|
| 916 | - if ( $section_id == 'output_options' && ! $is_custom_location ) { |
|
| 917 | - echo "<p class='mega-warning '><span class='dashicons dashicons-warning'></span>" . __( 'This menu location is registered by your theme. Your theme should already include the code required to display this menu location on your site.', 'megamenu' ) . '</p>'; |
|
| 918 | - } |
|
| 919 | - |
|
| 920 | - echo "<table class='{$section_id}'>"; |
|
| 921 | - |
|
| 922 | - // order the fields by priority |
|
| 923 | - uasort( $section['settings'], array( $this, 'compare_elems' ) ); |
|
| 924 | - |
|
| 925 | - foreach ( $section['settings'] as $group_id => $group ) { |
|
| 926 | - |
|
| 927 | - echo "<tr class='" . esc_attr( 'mega-' . $group_id ) . "'>"; |
|
| 928 | - |
|
| 929 | - if ( isset( $group['settings'] ) ) { |
|
| 930 | - |
|
| 931 | - echo "<td class='mega-name'>"; |
|
| 932 | - if ( isset( $group['icon'] ) ) { |
|
| 933 | - echo "<span class='dashicons dashicons-" . esc_html( $group['icon'] ) . "'></span>"; |
|
| 934 | - } |
|
| 935 | - echo esc_html( $group['title'] ); |
|
| 936 | - echo "<div class='mega-description'>" . esc_html( $group['description'] ) . '</div>'; |
|
| 937 | - echo '</td>'; |
|
| 938 | - echo "<td class='mega-value'>"; |
|
| 939 | - |
|
| 940 | - foreach ( $group['settings'] as $setting_id => $setting ) { |
|
| 941 | - |
|
| 942 | - echo "<label class='" . esc_attr( 'mega-' . $setting['key'] ) . "'>"; |
|
| 943 | - |
|
| 944 | - if ( isset( $setting['title'] ) ) { |
|
| 945 | - echo "<span class='mega-short-desc'>" . esc_html( $setting['title'] ) . '</span>'; |
|
| 946 | - } |
|
| 947 | - |
|
| 948 | - switch ( $setting['type'] ) { |
|
| 949 | - case 'freetext': |
|
| 950 | - $this->print_location_freetext_option( $location, $setting['key'], $setting['value'] ); |
|
| 951 | - break; |
|
| 952 | - case 'textarea': |
|
| 953 | - $this->print_location_textarea_option( $location, $setting['key'] ); |
|
| 954 | - break; |
|
| 955 | - case 'checkbox_enabled': |
|
| 956 | - $this->print_location_enabled_option( $location, $setting['key'], $setting['value'] ); |
|
| 957 | - break; |
|
| 958 | - case 'event': |
|
| 959 | - $this->print_location_event_option( $location, $setting['key'], $setting['value'] ); |
|
| 960 | - break; |
|
| 961 | - case 'effect': |
|
| 962 | - $this->print_location_effect_option( $location, $setting['key'], $setting['value'] ); |
|
| 963 | - break; |
|
| 964 | - case 'effect_speed': |
|
| 965 | - $this->print_location_effect_speed_option( $location, $setting['key'], $setting['value'] ); |
|
| 966 | - break; |
|
| 967 | - case 'effect_mobile': |
|
| 968 | - $this->print_location_effect_mobile_option( $location, $setting['key'], $setting['value'] ); |
|
| 969 | - break; |
|
| 970 | - case 'effect_speed_mobile': |
|
| 971 | - $this->print_location_effect_speed_mobile_option( $location, $setting['key'], $setting['value'] ); |
|
| 972 | - break; |
|
| 973 | - case 'theme_selector': |
|
| 974 | - $this->print_location_theme_selector_option( $location, $setting['key'], $setting['value'] ); |
|
| 975 | - break; |
|
| 976 | - case 'location_description': |
|
| 977 | - $this->print_location_description_option( $location, $setting['key'], $setting['value'] ); |
|
| 978 | - break; |
|
| 979 | - case 'checkbox': |
|
| 980 | - $this->print_location_checkbox_option( $location, $setting['key'], $setting['value'] ); |
|
| 981 | - break; |
|
| 982 | - case 'location_php_function': |
|
| 983 | - $this->print_location_php_function_option( $location, $setting['value'] ); |
|
| 984 | - break; |
|
| 985 | - case 'location_shortcode': |
|
| 986 | - $this->print_location_shortcode_option( $location, $setting['value'] ); |
|
| 987 | - break; |
|
| 988 | - case 'location_widget': |
|
| 989 | - $this->print_location_widget_option( $location, $setting['key'], $setting['value'] ); |
|
| 990 | - break; |
|
| 991 | - case 'active_instance': |
|
| 992 | - $this->print_active_instance_option( $location, $setting['value'] ); |
|
| 993 | - break; |
|
| 994 | - case 'click_behaviour': |
|
| 995 | - $this->print_click_behaviour_option( $location, $setting['value'] ); |
|
| 996 | - break; |
|
| 997 | - case 'mobile_behaviour': |
|
| 998 | - $this->print_mobile_behaviour_option( $location, $setting['value'] ); |
|
| 999 | - break; |
|
| 1000 | - case 'mobile_state': |
|
| 1001 | - $this->print_mobile_state_option( $location, $setting['value'] ); |
|
| 1002 | - break; |
|
| 1003 | - case 'container': |
|
| 1004 | - $this->print_container_option( $location, $setting['value'] ); |
|
| 1005 | - break; |
|
| 1006 | - case 'descriptions': |
|
| 1007 | - $this->print_descriptions_option( $location, $setting['value'] ); |
|
| 1008 | - break; |
|
| 1009 | - case 'unbind': |
|
| 1010 | - $this->print_unbind_option( $location, $setting['value'] ); |
|
| 1011 | - break; |
|
| 1012 | - case 'prefix': |
|
| 1013 | - $this->print_prefix_option( $location, $setting['value'] ); |
|
| 1014 | - break; |
|
| 1015 | - default: |
|
| 1016 | - do_action( "megamenu_print_location_option_{$setting['type']}", $setting['key'], $this->id ); |
|
| 1017 | - break; |
|
| 1018 | - } |
|
| 1019 | - |
|
| 1020 | - echo '</label>'; |
|
| 1021 | - |
|
| 1022 | - } |
|
| 1023 | - |
|
| 1024 | - if ( isset( $group['info'] ) ) { |
|
| 1025 | - foreach ( $group['info'] as $paragraph ) { |
|
| 1026 | - echo "<div class='mega-info'>{$paragraph}</div>"; |
|
| 1027 | - } |
|
| 1028 | - } |
|
| 1029 | - |
|
| 1030 | - echo '</td>'; |
|
| 1031 | - } else { |
|
| 1032 | - echo "<td colspan='2'><h5>{$group['title']}</h5></td>"; |
|
| 1033 | - } |
|
| 1034 | - echo '</tr>'; |
|
| 1035 | - |
|
| 1036 | - } |
|
| 1037 | - |
|
| 1038 | - if ( $section_id == 'general' ) { |
|
| 1039 | - do_action( 'megamenu_settings_table', $location, $plugin_settings ); |
|
| 1040 | - } |
|
| 1041 | - |
|
| 1042 | - echo '</table>'; |
|
| 1043 | - echo '</div>'; |
|
| 1044 | - } |
|
| 1045 | - |
|
| 1046 | - ?> |
|
| 624 | + $settings = apply_filters( |
|
| 625 | + 'megamenu_location_settings', |
|
| 626 | + array( |
|
| 627 | + |
|
| 628 | + 'general' => array( |
|
| 629 | + 'priority' => 10, |
|
| 630 | + 'title' => __( 'General Settings', 'megamenu' ), |
|
| 631 | + 'settings' => array( |
|
| 632 | + 'enabled' => array( |
|
| 633 | + 'priority' => 10, |
|
| 634 | + 'title' => __( 'Enabled', 'megamenu' ), |
|
| 635 | + 'description' => __( 'Enable Max Mega Menu for this menu location?', 'megamenu' ), |
|
| 636 | + 'settings' => array( |
|
| 637 | + array( |
|
| 638 | + 'type' => 'checkbox_enabled', |
|
| 639 | + 'key' => 'enabled', |
|
| 640 | + 'value' => isset( $location_settings['enabled'] ) ? $location_settings['enabled'] : 0, |
|
| 641 | + ), |
|
| 642 | + ), |
|
| 643 | + ), |
|
| 644 | + 'event' => array( |
|
| 645 | + 'priority' => 20, |
|
| 646 | + 'title' => __( 'Event', 'megamenu' ), |
|
| 647 | + 'description' => __( 'Select the event to trigger sub menus', 'megamenu' ), |
|
| 648 | + 'settings' => array( |
|
| 649 | + array( |
|
| 650 | + 'type' => 'event', |
|
| 651 | + 'key' => 'event', |
|
| 652 | + 'value' => isset( $location_settings['event'] ) ? $location_settings['event'] : 'hover', |
|
| 653 | + ), |
|
| 654 | + ), |
|
| 655 | + ), |
|
| 656 | + 'effect' => array( |
|
| 657 | + 'priority' => 30, |
|
| 658 | + 'title' => __( 'Effect', 'megamenu' ), |
|
| 659 | + 'description' => __( 'Select the sub menu animation type', 'megamenu' ), |
|
| 660 | + 'settings' => array( |
|
| 661 | + array( |
|
| 662 | + 'type' => 'effect', |
|
| 663 | + 'key' => 'effect', |
|
| 664 | + 'value' => isset( $location_settings['effect'] ) ? $location_settings['effect'] : 'fade_up', |
|
| 665 | + 'title' => __( 'Animation', 'megamenu' ), |
|
| 666 | + ), |
|
| 667 | + array( |
|
| 668 | + 'type' => 'effect_speed', |
|
| 669 | + 'key' => 'effect_speed', |
|
| 670 | + 'value' => isset( $location_settings['effect_speed'] ) ? $location_settings['effect_speed'] : '200', |
|
| 671 | + 'title' => __( 'Speed', 'megamenu' ), |
|
| 672 | + ), |
|
| 673 | + ), |
|
| 674 | + ), |
|
| 675 | + 'effect_mobile' => array( |
|
| 676 | + 'priority' => 40, |
|
| 677 | + 'title' => __( 'Effect (Mobile)', 'megamenu' ), |
|
| 678 | + 'description' => __( 'Choose a style for your mobile menu', 'megamenu' ), |
|
| 679 | + 'settings' => array( |
|
| 680 | + array( |
|
| 681 | + 'type' => 'effect_mobile', |
|
| 682 | + 'key' => 'effect_mobile', |
|
| 683 | + 'value' => isset( $location_settings['effect_mobile'] ) ? $location_settings['effect_mobile'] : 'none', |
|
| 684 | + 'title' => __( 'Style', 'megamenu' ), |
|
| 685 | + ), |
|
| 686 | + array( |
|
| 687 | + 'type' => 'effect_speed_mobile', |
|
| 688 | + 'key' => 'effect_speed_mobile', |
|
| 689 | + 'value' => isset( $location_settings['effect_speed_mobile'] ) ? $location_settings['effect_speed_mobile'] : '200', |
|
| 690 | + 'title' => __( 'Speed', 'megamenu' ), |
|
| 691 | + ), |
|
| 692 | + ), |
|
| 693 | + ), |
|
| 694 | + 'theme' => array( |
|
| 695 | + 'priority' => 50, |
|
| 696 | + 'title' => __( 'Theme', 'megamenu' ), |
|
| 697 | + 'description' => __( 'Select a theme to be applied to the menu', 'megamenu' ), |
|
| 698 | + 'settings' => array( |
|
| 699 | + array( |
|
| 700 | + 'type' => 'theme_selector', |
|
| 701 | + 'key' => 'theme', |
|
| 702 | + 'value' => isset( $location_settings['theme'] ) ? $location_settings['theme'] : 'default', |
|
| 703 | + ), |
|
| 704 | + ), |
|
| 705 | + ), |
|
| 706 | + ), |
|
| 707 | + ), |
|
| 708 | + 'advanced' => array( |
|
| 709 | + 'priority' => 25, |
|
| 710 | + 'title' => __( 'Advanced', 'megamenu' ), |
|
| 711 | + 'settings' => array( |
|
| 712 | + 'click_behaviour' => array( |
|
| 713 | + 'priority' => 10, |
|
| 714 | + 'title' => __( 'Click Event Behaviour', 'megamenu' ), |
|
| 715 | + 'description' => __( "Define what should happen when the event is set to 'click'. This also applies to mobiles.", 'megamenu' ), |
|
| 716 | + 'settings' => array( |
|
| 717 | + array( |
|
| 718 | + 'type' => 'click_behaviour', |
|
| 719 | + 'key' => 'click_behaviour', |
|
| 720 | + 'value' => $plugin_settings, |
|
| 721 | + ), |
|
| 722 | + ), |
|
| 723 | + ), |
|
| 724 | + 'mobile_behaviour' => array( |
|
| 725 | + 'priority' => 20, |
|
| 726 | + 'title' => __( 'Mobile Sub Menu Behaviour', 'megamenu' ), |
|
| 727 | + 'description' => __( 'Define the sub menu toggle behaviour for the mobile menu.', 'megamenu' ), |
|
| 728 | + 'settings' => array( |
|
| 729 | + array( |
|
| 730 | + 'type' => 'mobile_behaviour', |
|
| 731 | + 'key' => 'mobile_behaviour', |
|
| 732 | + 'value' => $plugin_settings, |
|
| 733 | + ), |
|
| 734 | + ), |
|
| 735 | + ), |
|
| 736 | + 'mobile_state' => array( |
|
| 737 | + 'priority' => 20, |
|
| 738 | + 'title' => __( 'Mobile Sub Menu Default State', 'megamenu' ), |
|
| 739 | + 'description' => __( 'Define the default state of the sub menus when the mobile menu is visible.', 'megamenu' ), |
|
| 740 | + 'settings' => array( |
|
| 741 | + array( |
|
| 742 | + 'type' => 'mobile_state', |
|
| 743 | + 'key' => 'mobile_state', |
|
| 744 | + 'value' => $plugin_settings, |
|
| 745 | + ), |
|
| 746 | + ), |
|
| 747 | + ), |
|
| 748 | + 'descriptions' => array( |
|
| 749 | + 'priority' => 20, |
|
| 750 | + 'title' => __( 'Menu Item Descriptions', 'megamenu' ), |
|
| 751 | + 'description' => __( 'Enable output of menu item descriptions.', 'megamenu' ), |
|
| 752 | + 'settings' => array( |
|
| 753 | + array( |
|
| 754 | + 'type' => 'descriptions', |
|
| 755 | + 'key' => 'descriptions', |
|
| 756 | + 'value' => $plugin_settings, |
|
| 757 | + ), |
|
| 758 | + ), |
|
| 759 | + ), |
|
| 760 | + 'unbind' => array( |
|
| 761 | + 'priority' => 20, |
|
| 762 | + 'title' => __( 'Unbind JavaScript Events', 'megamenu' ), |
|
| 763 | + 'description' => __( 'To avoid conflicts with theme menu systems, JavaScript events which have been added to menu items will be removed by default.', 'megamenu' ), |
|
| 764 | + 'settings' => array( |
|
| 765 | + array( |
|
| 766 | + 'type' => 'unbind', |
|
| 767 | + 'key' => 'unbind', |
|
| 768 | + 'value' => $plugin_settings, |
|
| 769 | + ), |
|
| 770 | + ), |
|
| 771 | + ), |
|
| 772 | + 'prefix' => array( |
|
| 773 | + 'priority' => 20, |
|
| 774 | + 'title' => __( 'Prefix Menu Item Classes', 'megamenu' ), |
|
| 775 | + 'description' => __( "Prefix custom menu item classes with 'mega-'?", 'megamenu' ), |
|
| 776 | + 'settings' => array( |
|
| 777 | + array( |
|
| 778 | + 'type' => 'prefix', |
|
| 779 | + 'key' => 'prefix', |
|
| 780 | + 'value' => $plugin_settings, |
|
| 781 | + ), |
|
| 782 | + ), |
|
| 783 | + ), |
|
| 784 | + 'container' => array( |
|
| 785 | + 'priority' => 20, |
|
| 786 | + 'title' => __( 'Container', 'megamenu' ), |
|
| 787 | + 'description' => __( 'Use nav or div element for menu wrapper?', 'megamenu' ), |
|
| 788 | + 'settings' => array( |
|
| 789 | + array( |
|
| 790 | + 'type' => 'container', |
|
| 791 | + 'key' => 'container', |
|
| 792 | + 'value' => $plugin_settings, |
|
| 793 | + ), |
|
| 794 | + ), |
|
| 795 | + ), |
|
| 796 | + 'active_instance' => array( |
|
| 797 | + 'priority' => 30, |
|
| 798 | + 'title' => __( 'Active Menu Instance', 'megamenu' ), |
|
| 799 | + 'info' => array( __( '0: Apply to all instances. 1: Apply to first instance. 2: Apply to second instance', 'megamenu' ) . '…' ), |
|
| 800 | + 'description' => __( 'Some themes will output this menu location multiple times on the same page. For example, it may be output once for the main menu, then again for the mobile menu. This setting can be used to make sure Max Mega Menu is only applied to one of those instances.', 'megamenu' ), |
|
| 801 | + 'settings' => array( |
|
| 802 | + array( |
|
| 803 | + 'type' => 'active_instance', |
|
| 804 | + 'key' => 'active_instance', |
|
| 805 | + 'value' => $plugin_settings, |
|
| 806 | + ), |
|
| 807 | + ), |
|
| 808 | + ), |
|
| 809 | + ), |
|
| 810 | + ), |
|
| 811 | + 'output_options' => array( |
|
| 812 | + 'priority' => 30, |
|
| 813 | + 'title' => __( 'Display Options', 'megamenu' ), |
|
| 814 | + 'settings' => array( |
|
| 815 | + 'location_php_function' => array( |
|
| 816 | + 'priority' => 10, |
|
| 817 | + 'title' => __( 'PHP Function', 'megamenu' ), |
|
| 818 | + 'description' => __( 'For use in a theme template (usually header.php)', 'megamenu' ), |
|
| 819 | + 'settings' => array( |
|
| 820 | + array( |
|
| 821 | + 'type' => 'location_php_function', |
|
| 822 | + 'key' => 'location_php_function', |
|
| 823 | + 'value' => $location, |
|
| 824 | + ), |
|
| 825 | + ), |
|
| 826 | + ), |
|
| 827 | + 'location_shortcode' => array( |
|
| 828 | + 'priority' => 20, |
|
| 829 | + 'title' => __( 'Shortcode', 'megamenu' ), |
|
| 830 | + 'description' => __( 'For use in a post or page.', 'megamenu' ), |
|
| 831 | + 'settings' => array( |
|
| 832 | + array( |
|
| 833 | + 'type' => 'location_shortcode', |
|
| 834 | + 'key' => 'location_shortcode', |
|
| 835 | + 'value' => $location, |
|
| 836 | + ), |
|
| 837 | + ), |
|
| 838 | + ), |
|
| 839 | + 'location_widget' => array( |
|
| 840 | + 'priority' => 30, |
|
| 841 | + 'title' => __( 'Widget', 'megamenu' ), |
|
| 842 | + 'description' => __( 'For use in a widget area.', 'megamenu' ), |
|
| 843 | + 'settings' => array( |
|
| 844 | + array( |
|
| 845 | + 'type' => 'location_widget', |
|
| 846 | + 'key' => 'location_widget', |
|
| 847 | + 'value' => $location, |
|
| 848 | + ), |
|
| 849 | + ), |
|
| 850 | + ), |
|
| 851 | + ), |
|
| 852 | + ), |
|
| 853 | + ), |
|
| 854 | + $location, |
|
| 855 | + $plugin_settings |
|
| 856 | + ); |
|
| 857 | + |
|
| 858 | + if ( $is_custom_location ) { |
|
| 859 | + |
|
| 860 | + $settings['general']['settings']['location_description'] = array( |
|
| 861 | + 'priority' => 15, |
|
| 862 | + 'title' => __( 'Location Description', 'megamenu' ), |
|
| 863 | + 'description' => __( 'Update the custom location description', 'megamenu' ), |
|
| 864 | + 'settings' => array( |
|
| 865 | + array( |
|
| 866 | + 'type' => 'location_description', |
|
| 867 | + 'key' => 'location_description', |
|
| 868 | + 'value' => $description, |
|
| 869 | + ), |
|
| 870 | + ), |
|
| 871 | + ); |
|
| 872 | + } |
|
| 873 | + |
|
| 874 | + $initial_version = get_option( 'megamenu_initial_version' ); |
|
| 875 | + |
|
| 876 | + if ( $initial_version && version_compare( $initial_version, '2.8', '>' ) ) { |
|
| 877 | + //unset( $settings['advanced']['settings']['prefix'] ); // users who started out with 2.8.1+ will not see this option. |
|
| 878 | + } |
|
| 879 | + |
|
| 880 | + echo "<div class='mega-accordion-content-wrapper'>"; |
|
| 881 | + |
|
| 882 | + echo "<h2 class='nav-tab-wrapper'>"; |
|
| 883 | + |
|
| 884 | + $is_first = true; |
|
| 885 | + |
|
| 886 | + uasort( $settings, array( $this, 'compare_elems' ) ); |
|
| 887 | + |
|
| 888 | + foreach ( $settings as $section_id => $section ) { |
|
| 889 | + |
|
| 890 | + if ( $is_first ) { |
|
| 891 | + $active = 'nav-tab-active'; |
|
| 892 | + $is_first = false; |
|
| 893 | + } else { |
|
| 894 | + $active = ''; |
|
| 895 | + } |
|
| 896 | + |
|
| 897 | + echo "<a class='mega-tab nav-tab {$active}' data-tab='mega-tab-content-{$section_id}'>" . esc_html( $section['title'] ) . '</a>'; |
|
| 898 | + |
|
| 899 | + } |
|
| 900 | + |
|
| 901 | + echo '</h2>'; |
|
| 902 | + |
|
| 903 | + $is_first = true; |
|
| 904 | + |
|
| 905 | + foreach ( $settings as $section_id => $section ) { |
|
| 906 | + |
|
| 907 | + if ( $is_first ) { |
|
| 908 | + $display = 'block'; |
|
| 909 | + $is_first = false; |
|
| 910 | + } else { |
|
| 911 | + $display = 'none'; |
|
| 912 | + } |
|
| 913 | + |
|
| 914 | + echo "<div class='mega-tab-content mega-tab-content-{$section_id}' style='display: {$display}'>"; |
|
| 915 | + |
|
| 916 | + if ( $section_id == 'output_options' && ! $is_custom_location ) { |
|
| 917 | + echo "<p class='mega-warning '><span class='dashicons dashicons-warning'></span>" . __( 'This menu location is registered by your theme. Your theme should already include the code required to display this menu location on your site.', 'megamenu' ) . '</p>'; |
|
| 918 | + } |
|
| 919 | + |
|
| 920 | + echo "<table class='{$section_id}'>"; |
|
| 921 | + |
|
| 922 | + // order the fields by priority |
|
| 923 | + uasort( $section['settings'], array( $this, 'compare_elems' ) ); |
|
| 924 | + |
|
| 925 | + foreach ( $section['settings'] as $group_id => $group ) { |
|
| 926 | + |
|
| 927 | + echo "<tr class='" . esc_attr( 'mega-' . $group_id ) . "'>"; |
|
| 928 | + |
|
| 929 | + if ( isset( $group['settings'] ) ) { |
|
| 930 | + |
|
| 931 | + echo "<td class='mega-name'>"; |
|
| 932 | + if ( isset( $group['icon'] ) ) { |
|
| 933 | + echo "<span class='dashicons dashicons-" . esc_html( $group['icon'] ) . "'></span>"; |
|
| 934 | + } |
|
| 935 | + echo esc_html( $group['title'] ); |
|
| 936 | + echo "<div class='mega-description'>" . esc_html( $group['description'] ) . '</div>'; |
|
| 937 | + echo '</td>'; |
|
| 938 | + echo "<td class='mega-value'>"; |
|
| 939 | + |
|
| 940 | + foreach ( $group['settings'] as $setting_id => $setting ) { |
|
| 941 | + |
|
| 942 | + echo "<label class='" . esc_attr( 'mega-' . $setting['key'] ) . "'>"; |
|
| 943 | + |
|
| 944 | + if ( isset( $setting['title'] ) ) { |
|
| 945 | + echo "<span class='mega-short-desc'>" . esc_html( $setting['title'] ) . '</span>'; |
|
| 946 | + } |
|
| 947 | + |
|
| 948 | + switch ( $setting['type'] ) { |
|
| 949 | + case 'freetext': |
|
| 950 | + $this->print_location_freetext_option( $location, $setting['key'], $setting['value'] ); |
|
| 951 | + break; |
|
| 952 | + case 'textarea': |
|
| 953 | + $this->print_location_textarea_option( $location, $setting['key'] ); |
|
| 954 | + break; |
|
| 955 | + case 'checkbox_enabled': |
|
| 956 | + $this->print_location_enabled_option( $location, $setting['key'], $setting['value'] ); |
|
| 957 | + break; |
|
| 958 | + case 'event': |
|
| 959 | + $this->print_location_event_option( $location, $setting['key'], $setting['value'] ); |
|
| 960 | + break; |
|
| 961 | + case 'effect': |
|
| 962 | + $this->print_location_effect_option( $location, $setting['key'], $setting['value'] ); |
|
| 963 | + break; |
|
| 964 | + case 'effect_speed': |
|
| 965 | + $this->print_location_effect_speed_option( $location, $setting['key'], $setting['value'] ); |
|
| 966 | + break; |
|
| 967 | + case 'effect_mobile': |
|
| 968 | + $this->print_location_effect_mobile_option( $location, $setting['key'], $setting['value'] ); |
|
| 969 | + break; |
|
| 970 | + case 'effect_speed_mobile': |
|
| 971 | + $this->print_location_effect_speed_mobile_option( $location, $setting['key'], $setting['value'] ); |
|
| 972 | + break; |
|
| 973 | + case 'theme_selector': |
|
| 974 | + $this->print_location_theme_selector_option( $location, $setting['key'], $setting['value'] ); |
|
| 975 | + break; |
|
| 976 | + case 'location_description': |
|
| 977 | + $this->print_location_description_option( $location, $setting['key'], $setting['value'] ); |
|
| 978 | + break; |
|
| 979 | + case 'checkbox': |
|
| 980 | + $this->print_location_checkbox_option( $location, $setting['key'], $setting['value'] ); |
|
| 981 | + break; |
|
| 982 | + case 'location_php_function': |
|
| 983 | + $this->print_location_php_function_option( $location, $setting['value'] ); |
|
| 984 | + break; |
|
| 985 | + case 'location_shortcode': |
|
| 986 | + $this->print_location_shortcode_option( $location, $setting['value'] ); |
|
| 987 | + break; |
|
| 988 | + case 'location_widget': |
|
| 989 | + $this->print_location_widget_option( $location, $setting['key'], $setting['value'] ); |
|
| 990 | + break; |
|
| 991 | + case 'active_instance': |
|
| 992 | + $this->print_active_instance_option( $location, $setting['value'] ); |
|
| 993 | + break; |
|
| 994 | + case 'click_behaviour': |
|
| 995 | + $this->print_click_behaviour_option( $location, $setting['value'] ); |
|
| 996 | + break; |
|
| 997 | + case 'mobile_behaviour': |
|
| 998 | + $this->print_mobile_behaviour_option( $location, $setting['value'] ); |
|
| 999 | + break; |
|
| 1000 | + case 'mobile_state': |
|
| 1001 | + $this->print_mobile_state_option( $location, $setting['value'] ); |
|
| 1002 | + break; |
|
| 1003 | + case 'container': |
|
| 1004 | + $this->print_container_option( $location, $setting['value'] ); |
|
| 1005 | + break; |
|
| 1006 | + case 'descriptions': |
|
| 1007 | + $this->print_descriptions_option( $location, $setting['value'] ); |
|
| 1008 | + break; |
|
| 1009 | + case 'unbind': |
|
| 1010 | + $this->print_unbind_option( $location, $setting['value'] ); |
|
| 1011 | + break; |
|
| 1012 | + case 'prefix': |
|
| 1013 | + $this->print_prefix_option( $location, $setting['value'] ); |
|
| 1014 | + break; |
|
| 1015 | + default: |
|
| 1016 | + do_action( "megamenu_print_location_option_{$setting['type']}", $setting['key'], $this->id ); |
|
| 1017 | + break; |
|
| 1018 | + } |
|
| 1019 | + |
|
| 1020 | + echo '</label>'; |
|
| 1021 | + |
|
| 1022 | + } |
|
| 1023 | + |
|
| 1024 | + if ( isset( $group['info'] ) ) { |
|
| 1025 | + foreach ( $group['info'] as $paragraph ) { |
|
| 1026 | + echo "<div class='mega-info'>{$paragraph}</div>"; |
|
| 1027 | + } |
|
| 1028 | + } |
|
| 1029 | + |
|
| 1030 | + echo '</td>'; |
|
| 1031 | + } else { |
|
| 1032 | + echo "<td colspan='2'><h5>{$group['title']}</h5></td>"; |
|
| 1033 | + } |
|
| 1034 | + echo '</tr>'; |
|
| 1035 | + |
|
| 1036 | + } |
|
| 1037 | + |
|
| 1038 | + if ( $section_id == 'general' ) { |
|
| 1039 | + do_action( 'megamenu_settings_table', $location, $plugin_settings ); |
|
| 1040 | + } |
|
| 1041 | + |
|
| 1042 | + echo '</table>'; |
|
| 1043 | + echo '</div>'; |
|
| 1044 | + } |
|
| 1045 | + |
|
| 1046 | + ?> |
|
| 1047 | 1047 | |
| 1048 | 1048 | </div> |
| 1049 | 1049 | <div class='megamenu_submit'> |
@@ -1052,659 +1052,659 @@ discard block |
||
| 1052 | 1052 | </form> |
| 1053 | 1053 | |
| 1054 | 1054 | <?php |
| 1055 | - } |
|
| 1056 | - |
|
| 1057 | - |
|
| 1058 | - /** |
|
| 1059 | - * Return a list of all registed menu locations |
|
| 1060 | - * |
|
| 1061 | - * @since 2.8 |
|
| 1062 | - * @return array |
|
| 1063 | - */ |
|
| 1064 | - public function get_registered_locations() { |
|
| 1065 | - $all_locations = get_registered_nav_menus(); |
|
| 1066 | - |
|
| 1067 | - // PolyLang - remove auto created/translated menu locations |
|
| 1068 | - if ( function_exists( 'pll_default_language' ) ) { |
|
| 1069 | - $default_lang = pll_default_language( 'name' ); |
|
| 1070 | - |
|
| 1071 | - foreach ( $all_locations as $loc => $description ) { |
|
| 1072 | - if ( false !== strpos( $loc, '___' ) ) { |
|
| 1073 | - // Remove locations created by Polylang |
|
| 1074 | - unregister_nav_menu( $loc ); |
|
| 1075 | - } else { |
|
| 1076 | - // Remove the language name appended to the original locations |
|
| 1077 | - register_nav_menu( $loc, str_replace( ' ' . $default_lang, '', $description ) ); |
|
| 1078 | - } |
|
| 1079 | - } |
|
| 1080 | - |
|
| 1081 | - $all_locations = get_registered_nav_menus(); |
|
| 1082 | - } |
|
| 1083 | - |
|
| 1084 | - $locations = array(); |
|
| 1085 | - $custom_locations = get_option( 'megamenu_locations' ); |
|
| 1086 | - |
|
| 1087 | - if ( is_array( $custom_locations ) ) { |
|
| 1088 | - $all_locations = array_merge( $custom_locations, $all_locations ); |
|
| 1089 | - } |
|
| 1090 | - |
|
| 1091 | - if ( count( $all_locations ) ) { |
|
| 1092 | - $megamenu_locations = array(); |
|
| 1093 | - |
|
| 1094 | - // reorder locations so custom MMM locations are listed at the bottom |
|
| 1095 | - foreach ( $all_locations as $location => $val ) { |
|
| 1096 | - if ( strpos( $location, 'max_mega_menu_' ) === false ) { |
|
| 1097 | - $locations[ $location ] = $val; |
|
| 1098 | - } else { |
|
| 1099 | - $megamenu_locations[ $location ] = $val; |
|
| 1100 | - } |
|
| 1101 | - } |
|
| 1102 | - |
|
| 1103 | - $locations = array_merge( $locations, $megamenu_locations ); |
|
| 1104 | - } |
|
| 1105 | - |
|
| 1106 | - return $locations; |
|
| 1107 | - } |
|
| 1108 | - |
|
| 1109 | - |
|
| 1110 | - /** |
|
| 1111 | - * Returns the menu ID for a specified menu location, defaults to 0 |
|
| 1112 | - * |
|
| 1113 | - * @since 2.8 |
|
| 1114 | - * @param string $location |
|
| 1115 | - */ |
|
| 1116 | - private function get_menu_id_for_location( $location ) { |
|
| 1117 | - $locations = get_nav_menu_locations(); |
|
| 1118 | - $id = isset( $locations[ $location ] ) ? $locations[ $location ] : 0; |
|
| 1119 | - return $id; |
|
| 1120 | - } |
|
| 1121 | - |
|
| 1122 | - |
|
| 1123 | - /** |
|
| 1124 | - * Returns the menu name for a specified menu location |
|
| 1125 | - * |
|
| 1126 | - * @since 2.8 |
|
| 1127 | - * @param string $location |
|
| 1128 | - */ |
|
| 1129 | - private function get_menu_name_for_location( $location ) { |
|
| 1130 | - $id = $this->get_menu_id_for_location( $location ); |
|
| 1131 | - |
|
| 1132 | - $menus = wp_get_nav_menus(); |
|
| 1133 | - |
|
| 1134 | - foreach ( $menus as $menu ) { |
|
| 1135 | - if ( $menu->term_id == $id ) { |
|
| 1136 | - return $menu->name; |
|
| 1137 | - } |
|
| 1138 | - } |
|
| 1139 | - |
|
| 1140 | - return false; |
|
| 1141 | - } |
|
| 1142 | - |
|
| 1143 | - |
|
| 1144 | - /** |
|
| 1145 | - * Display messages to the user |
|
| 1146 | - * |
|
| 1147 | - * @since 2.0 |
|
| 1148 | - */ |
|
| 1149 | - public function print_messages() { |
|
| 1150 | - if ( isset( $_GET['location_added'] ) ) { |
|
| 1151 | - ?> |
|
| 1055 | + } |
|
| 1056 | + |
|
| 1057 | + |
|
| 1058 | + /** |
|
| 1059 | + * Return a list of all registed menu locations |
|
| 1060 | + * |
|
| 1061 | + * @since 2.8 |
|
| 1062 | + * @return array |
|
| 1063 | + */ |
|
| 1064 | + public function get_registered_locations() { |
|
| 1065 | + $all_locations = get_registered_nav_menus(); |
|
| 1066 | + |
|
| 1067 | + // PolyLang - remove auto created/translated menu locations |
|
| 1068 | + if ( function_exists( 'pll_default_language' ) ) { |
|
| 1069 | + $default_lang = pll_default_language( 'name' ); |
|
| 1070 | + |
|
| 1071 | + foreach ( $all_locations as $loc => $description ) { |
|
| 1072 | + if ( false !== strpos( $loc, '___' ) ) { |
|
| 1073 | + // Remove locations created by Polylang |
|
| 1074 | + unregister_nav_menu( $loc ); |
|
| 1075 | + } else { |
|
| 1076 | + // Remove the language name appended to the original locations |
|
| 1077 | + register_nav_menu( $loc, str_replace( ' ' . $default_lang, '', $description ) ); |
|
| 1078 | + } |
|
| 1079 | + } |
|
| 1080 | + |
|
| 1081 | + $all_locations = get_registered_nav_menus(); |
|
| 1082 | + } |
|
| 1083 | + |
|
| 1084 | + $locations = array(); |
|
| 1085 | + $custom_locations = get_option( 'megamenu_locations' ); |
|
| 1086 | + |
|
| 1087 | + if ( is_array( $custom_locations ) ) { |
|
| 1088 | + $all_locations = array_merge( $custom_locations, $all_locations ); |
|
| 1089 | + } |
|
| 1090 | + |
|
| 1091 | + if ( count( $all_locations ) ) { |
|
| 1092 | + $megamenu_locations = array(); |
|
| 1093 | + |
|
| 1094 | + // reorder locations so custom MMM locations are listed at the bottom |
|
| 1095 | + foreach ( $all_locations as $location => $val ) { |
|
| 1096 | + if ( strpos( $location, 'max_mega_menu_' ) === false ) { |
|
| 1097 | + $locations[ $location ] = $val; |
|
| 1098 | + } else { |
|
| 1099 | + $megamenu_locations[ $location ] = $val; |
|
| 1100 | + } |
|
| 1101 | + } |
|
| 1102 | + |
|
| 1103 | + $locations = array_merge( $locations, $megamenu_locations ); |
|
| 1104 | + } |
|
| 1105 | + |
|
| 1106 | + return $locations; |
|
| 1107 | + } |
|
| 1108 | + |
|
| 1109 | + |
|
| 1110 | + /** |
|
| 1111 | + * Returns the menu ID for a specified menu location, defaults to 0 |
|
| 1112 | + * |
|
| 1113 | + * @since 2.8 |
|
| 1114 | + * @param string $location |
|
| 1115 | + */ |
|
| 1116 | + private function get_menu_id_for_location( $location ) { |
|
| 1117 | + $locations = get_nav_menu_locations(); |
|
| 1118 | + $id = isset( $locations[ $location ] ) ? $locations[ $location ] : 0; |
|
| 1119 | + return $id; |
|
| 1120 | + } |
|
| 1121 | + |
|
| 1122 | + |
|
| 1123 | + /** |
|
| 1124 | + * Returns the menu name for a specified menu location |
|
| 1125 | + * |
|
| 1126 | + * @since 2.8 |
|
| 1127 | + * @param string $location |
|
| 1128 | + */ |
|
| 1129 | + private function get_menu_name_for_location( $location ) { |
|
| 1130 | + $id = $this->get_menu_id_for_location( $location ); |
|
| 1131 | + |
|
| 1132 | + $menus = wp_get_nav_menus(); |
|
| 1133 | + |
|
| 1134 | + foreach ( $menus as $menu ) { |
|
| 1135 | + if ( $menu->term_id == $id ) { |
|
| 1136 | + return $menu->name; |
|
| 1137 | + } |
|
| 1138 | + } |
|
| 1139 | + |
|
| 1140 | + return false; |
|
| 1141 | + } |
|
| 1142 | + |
|
| 1143 | + |
|
| 1144 | + /** |
|
| 1145 | + * Display messages to the user |
|
| 1146 | + * |
|
| 1147 | + * @since 2.0 |
|
| 1148 | + */ |
|
| 1149 | + public function print_messages() { |
|
| 1150 | + if ( isset( $_GET['location_added'] ) ) { |
|
| 1151 | + ?> |
|
| 1152 | 1152 | <div class="notice notice-success is-dismissible"> |
| 1153 | 1153 | <p><?php _e( 'New Menu Location Created', 'megamenu' ) ?></p> |
| 1154 | 1154 | </div> |
| 1155 | 1155 | <?php |
| 1156 | - } |
|
| 1156 | + } |
|
| 1157 | 1157 | |
| 1158 | - if ( isset( $_GET['delete_location'] ) ) { |
|
| 1159 | - ?> |
|
| 1158 | + if ( isset( $_GET['delete_location'] ) ) { |
|
| 1159 | + ?> |
|
| 1160 | 1160 | <div class="notice notice-success is-dismissible"> |
| 1161 | 1161 | <p><?php _e( 'Menu Location Deleted', 'megamenu' ) ?></p> |
| 1162 | 1162 | </div> |
| 1163 | 1163 | <?php |
| 1164 | - } |
|
| 1164 | + } |
|
| 1165 | 1165 | |
| 1166 | - if ( isset( $_GET['save_location'] ) ) { |
|
| 1167 | - ?> |
|
| 1166 | + if ( isset( $_GET['save_location'] ) ) { |
|
| 1167 | + ?> |
|
| 1168 | 1168 | <div class="notice notice-success is-dismissible"> |
| 1169 | 1169 | <p><?php _e( 'Menu Location Saved', 'megamenu' ) ?></p> |
| 1170 | 1170 | </div> |
| 1171 | 1171 | <?php |
| 1172 | - } |
|
| 1173 | - } |
|
| 1174 | - |
|
| 1175 | - |
|
| 1176 | - /** |
|
| 1177 | - * Print a checkbox option for enabling/disabling MMM for a specific location |
|
| 1178 | - * |
|
| 1179 | - * @since 2.8 |
|
| 1180 | - * @param string $key |
|
| 1181 | - * @param string $value |
|
| 1182 | - */ |
|
| 1183 | - public function print_location_enabled_option( $location, $key, $value ) { |
|
| 1184 | - ?> |
|
| 1172 | + } |
|
| 1173 | + } |
|
| 1174 | + |
|
| 1175 | + |
|
| 1176 | + /** |
|
| 1177 | + * Print a checkbox option for enabling/disabling MMM for a specific location |
|
| 1178 | + * |
|
| 1179 | + * @since 2.8 |
|
| 1180 | + * @param string $key |
|
| 1181 | + * @param string $value |
|
| 1182 | + */ |
|
| 1183 | + public function print_location_enabled_option( $location, $key, $value ) { |
|
| 1184 | + ?> |
|
| 1185 | 1185 | <input type='checkbox' name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]' <?php checked( $value, '1' ); ?> /> |
| 1186 | 1186 | <?php |
| 1187 | - } |
|
| 1188 | - |
|
| 1189 | - |
|
| 1190 | - /** |
|
| 1191 | - * Print a generic checkbox option |
|
| 1192 | - * |
|
| 1193 | - * @since 2.8 |
|
| 1194 | - * @param string $key |
|
| 1195 | - * @param string $value |
|
| 1196 | - */ |
|
| 1197 | - public function print_location_checkbox_option( $location, $key, $value ) { |
|
| 1198 | - ?> |
|
| 1187 | + } |
|
| 1188 | + |
|
| 1189 | + |
|
| 1190 | + /** |
|
| 1191 | + * Print a generic checkbox option |
|
| 1192 | + * |
|
| 1193 | + * @since 2.8 |
|
| 1194 | + * @param string $key |
|
| 1195 | + * @param string $value |
|
| 1196 | + */ |
|
| 1197 | + public function print_location_checkbox_option( $location, $key, $value ) { |
|
| 1198 | + ?> |
|
| 1199 | 1199 | <input type='checkbox' value='true' name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]' <?php checked( $value, 'true' ); ?> /> |
| 1200 | 1200 | <?php |
| 1201 | - } |
|
| 1202 | - |
|
| 1203 | - |
|
| 1204 | - /** |
|
| 1205 | - * Print the active instance option |
|
| 1206 | - * |
|
| 1207 | - * @since 2.8 |
|
| 1208 | - * @param string $key |
|
| 1209 | - * @param string $value |
|
| 1210 | - */ |
|
| 1211 | - public function print_active_instance_option( $location, $plugin_settings ) { |
|
| 1212 | - $active_instance = 0; |
|
| 1213 | - |
|
| 1214 | - if ( isset( $plugin_settings[ $location ]['active_instance'] ) ) { |
|
| 1215 | - $active_instance = $plugin_settings[ $location ]['active_instance']; |
|
| 1216 | - } elseif ( isset( $plugin_settings['instances'][ $location ] ) ) { |
|
| 1217 | - $active_instance = $plugin_settings['instances'][ $location ]; |
|
| 1218 | - } |
|
| 1219 | - |
|
| 1220 | - ?> |
|
| 1201 | + } |
|
| 1202 | + |
|
| 1203 | + |
|
| 1204 | + /** |
|
| 1205 | + * Print the active instance option |
|
| 1206 | + * |
|
| 1207 | + * @since 2.8 |
|
| 1208 | + * @param string $key |
|
| 1209 | + * @param string $value |
|
| 1210 | + */ |
|
| 1211 | + public function print_active_instance_option( $location, $plugin_settings ) { |
|
| 1212 | + $active_instance = 0; |
|
| 1213 | + |
|
| 1214 | + if ( isset( $plugin_settings[ $location ]['active_instance'] ) ) { |
|
| 1215 | + $active_instance = $plugin_settings[ $location ]['active_instance']; |
|
| 1216 | + } elseif ( isset( $plugin_settings['instances'][ $location ] ) ) { |
|
| 1217 | + $active_instance = $plugin_settings['instances'][ $location ]; |
|
| 1218 | + } |
|
| 1219 | + |
|
| 1220 | + ?> |
|
| 1221 | 1221 | <input type='text' name='megamenu_meta[<?php echo esc_attr( $location ); ?>][active_instance]' value='<?php echo esc_attr( $active_instance ); ?>' /> |
| 1222 | 1222 | <?php |
| 1223 | - } |
|
| 1224 | - |
|
| 1225 | - /** |
|
| 1226 | - * Print the click behaviour option |
|
| 1227 | - * |
|
| 1228 | - * @since 2.8 |
|
| 1229 | - * @param string $key |
|
| 1230 | - * @param string $value |
|
| 1231 | - */ |
|
| 1232 | - public function print_click_behaviour_option( $location, $plugin_settings ) { |
|
| 1233 | - $second_click = 'go'; |
|
| 1234 | - |
|
| 1235 | - if ( isset( $plugin_settings[ $location ]['second_click'] ) ) { |
|
| 1236 | - $second_click = $plugin_settings[ $location ]['second_click']; |
|
| 1237 | - } elseif ( isset( $plugin_settings['second_click'] ) ) { |
|
| 1238 | - $second_click = $plugin_settings['second_click']; |
|
| 1239 | - } |
|
| 1240 | - |
|
| 1241 | - ?> |
|
| 1223 | + } |
|
| 1224 | + |
|
| 1225 | + /** |
|
| 1226 | + * Print the click behaviour option |
|
| 1227 | + * |
|
| 1228 | + * @since 2.8 |
|
| 1229 | + * @param string $key |
|
| 1230 | + * @param string $value |
|
| 1231 | + */ |
|
| 1232 | + public function print_click_behaviour_option( $location, $plugin_settings ) { |
|
| 1233 | + $second_click = 'go'; |
|
| 1234 | + |
|
| 1235 | + if ( isset( $plugin_settings[ $location ]['second_click'] ) ) { |
|
| 1236 | + $second_click = $plugin_settings[ $location ]['second_click']; |
|
| 1237 | + } elseif ( isset( $plugin_settings['second_click'] ) ) { |
|
| 1238 | + $second_click = $plugin_settings['second_click']; |
|
| 1239 | + } |
|
| 1240 | + |
|
| 1241 | + ?> |
|
| 1242 | 1242 | <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][second_click]'> |
| 1243 | 1243 | <option value='close' <?php echo selected( $second_click == 'close' ); ?>><?php _e( 'First click will open the sub menu, second click will close the sub menu.', 'megamenu' ); ?></option> |
| 1244 | 1244 | <option value='go' <?php echo selected( $second_click == 'go' ); ?>><?php _e( 'First click will open the sub menu, second click will follow the link.', 'megamenu' ); ?></option> |
| 1245 | 1245 | <option value='disabled' <?php echo selected( $second_click == 'disabled' ); ?>><?php _e( 'First click will follow the link (the arrow must be used to toggle sub menu visiblity).', 'megamenu' ); ?></option> |
| 1246 | 1246 | <select> |
| 1247 | 1247 | <?php |
| 1248 | - } |
|
| 1249 | - |
|
| 1250 | - |
|
| 1251 | - /** |
|
| 1252 | - * Print the mobile menu behaviour option |
|
| 1253 | - * |
|
| 1254 | - * @since 2.8 |
|
| 1255 | - * @param string $key |
|
| 1256 | - * @param string $value |
|
| 1257 | - */ |
|
| 1258 | - public function print_mobile_behaviour_option( $location, $plugin_settings ) { |
|
| 1259 | - $mobile_behaviour = 'standard'; |
|
| 1260 | - |
|
| 1261 | - if ( isset( $plugin_settings[ $location ]['mobile_behaviour'] ) ) { |
|
| 1262 | - $mobile_behaviour = $plugin_settings[ $location ]['mobile_behaviour']; |
|
| 1263 | - } elseif ( isset( $plugin_settings['mobile_behaviour'] ) ) { |
|
| 1264 | - $mobile_behaviour = $plugin_settings['mobile_behaviour']; |
|
| 1265 | - } |
|
| 1266 | - |
|
| 1267 | - ?> |
|
| 1248 | + } |
|
| 1249 | + |
|
| 1250 | + |
|
| 1251 | + /** |
|
| 1252 | + * Print the mobile menu behaviour option |
|
| 1253 | + * |
|
| 1254 | + * @since 2.8 |
|
| 1255 | + * @param string $key |
|
| 1256 | + * @param string $value |
|
| 1257 | + */ |
|
| 1258 | + public function print_mobile_behaviour_option( $location, $plugin_settings ) { |
|
| 1259 | + $mobile_behaviour = 'standard'; |
|
| 1260 | + |
|
| 1261 | + if ( isset( $plugin_settings[ $location ]['mobile_behaviour'] ) ) { |
|
| 1262 | + $mobile_behaviour = $plugin_settings[ $location ]['mobile_behaviour']; |
|
| 1263 | + } elseif ( isset( $plugin_settings['mobile_behaviour'] ) ) { |
|
| 1264 | + $mobile_behaviour = $plugin_settings['mobile_behaviour']; |
|
| 1265 | + } |
|
| 1266 | + |
|
| 1267 | + ?> |
|
| 1268 | 1268 | <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][mobile_behaviour]'> |
| 1269 | 1269 | <option value='standard' <?php echo selected( $mobile_behaviour == 'standard' ); ?>><?php _e( 'Standard - Open sub menus will remain open until closed by the user.', 'megamenu' ); ?></option> |
| 1270 | 1270 | <option value='accordion' <?php echo selected( $mobile_behaviour == 'accordion' ); ?>><?php _e( 'Accordion - Open sub menus will automatically close when another one is opened.', 'megamenu' ); ?></option> |
| 1271 | 1271 | <select> |
| 1272 | 1272 | <?php |
| 1273 | - } |
|
| 1274 | - |
|
| 1275 | - /** |
|
| 1276 | - * Print the mobile menu behaviour option |
|
| 1277 | - * |
|
| 1278 | - * @since 2.8 |
|
| 1279 | - * @param string $key |
|
| 1280 | - * @param string $value |
|
| 1281 | - */ |
|
| 1282 | - public function print_mobile_state_option( $location, $plugin_settings ) { |
|
| 1283 | - $mobile_state = 'collapse_all'; |
|
| 1284 | - |
|
| 1285 | - if ( isset( $plugin_settings[ $location ]['mobile_state'] ) ) { |
|
| 1286 | - $mobile_state = $plugin_settings[ $location ]['mobile_state']; |
|
| 1287 | - } |
|
| 1288 | - |
|
| 1289 | - ?> |
|
| 1273 | + } |
|
| 1274 | + |
|
| 1275 | + /** |
|
| 1276 | + * Print the mobile menu behaviour option |
|
| 1277 | + * |
|
| 1278 | + * @since 2.8 |
|
| 1279 | + * @param string $key |
|
| 1280 | + * @param string $value |
|
| 1281 | + */ |
|
| 1282 | + public function print_mobile_state_option( $location, $plugin_settings ) { |
|
| 1283 | + $mobile_state = 'collapse_all'; |
|
| 1284 | + |
|
| 1285 | + if ( isset( $plugin_settings[ $location ]['mobile_state'] ) ) { |
|
| 1286 | + $mobile_state = $plugin_settings[ $location ]['mobile_state']; |
|
| 1287 | + } |
|
| 1288 | + |
|
| 1289 | + ?> |
|
| 1290 | 1290 | <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][mobile_state]'> |
| 1291 | 1291 | <option value='collapse_all' <?php echo selected( $mobile_state == 'collapse_all' ); ?>><?php _e( 'Collapse all', 'megamenu' ); ?></option> |
| 1292 | 1292 | <option value='expand_all' <?php echo selected( $mobile_state == 'expand_all' ); ?>><?php _e( 'Expand all', 'megamenu' ); ?></option> |
| 1293 | 1293 | <option value='expand_active' <?php echo selected( $mobile_state == 'expand_active' ); ?>><?php _e( 'Expand active parents', 'megamenu' ); ?></option> |
| 1294 | 1294 | <select> |
| 1295 | 1295 | <?php |
| 1296 | - } |
|
| 1296 | + } |
|
| 1297 | 1297 | |
| 1298 | 1298 | |
| 1299 | - /** |
|
| 1300 | - * Print the container option select box |
|
| 1301 | - * |
|
| 1302 | - * @since 2.9 |
|
| 1303 | - * @param string $key |
|
| 1304 | - * @param string $value |
|
| 1305 | - */ |
|
| 1306 | - public function print_container_option( $location, $plugin_settings ) { |
|
| 1307 | - $container = 'div'; |
|
| 1299 | + /** |
|
| 1300 | + * Print the container option select box |
|
| 1301 | + * |
|
| 1302 | + * @since 2.9 |
|
| 1303 | + * @param string $key |
|
| 1304 | + * @param string $value |
|
| 1305 | + */ |
|
| 1306 | + public function print_container_option( $location, $plugin_settings ) { |
|
| 1307 | + $container = 'div'; |
|
| 1308 | 1308 | |
| 1309 | - if ( isset( $plugin_settings[ $location ]['container'] ) ) { |
|
| 1310 | - $container = $plugin_settings[ $location ]['container']; |
|
| 1311 | - } |
|
| 1309 | + if ( isset( $plugin_settings[ $location ]['container'] ) ) { |
|
| 1310 | + $container = $plugin_settings[ $location ]['container']; |
|
| 1311 | + } |
|
| 1312 | 1312 | |
| 1313 | - ?> |
|
| 1313 | + ?> |
|
| 1314 | 1314 | <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][container]'> |
| 1315 | 1315 | <option value='div' <?php echo selected( $container == 'div' ); ?>><div></option> |
| 1316 | 1316 | <option value='nav' <?php echo selected( $container == 'nav' ); ?>><nav></option> |
| 1317 | 1317 | <select> |
| 1318 | 1318 | <?php |
| 1319 | - } |
|
| 1319 | + } |
|
| 1320 | 1320 | |
| 1321 | 1321 | |
| 1322 | - /** |
|
| 1323 | - * Print the checkbox option for enabling menu item descriptions |
|
| 1324 | - * |
|
| 1325 | - * @since 2.8 |
|
| 1326 | - * @param string $key |
|
| 1327 | - * @param string $value |
|
| 1328 | - */ |
|
| 1329 | - public function print_descriptions_option( $location, $plugin_settings ) { |
|
| 1330 | - $descriptions = 'disabled'; |
|
| 1322 | + /** |
|
| 1323 | + * Print the checkbox option for enabling menu item descriptions |
|
| 1324 | + * |
|
| 1325 | + * @since 2.8 |
|
| 1326 | + * @param string $key |
|
| 1327 | + * @param string $value |
|
| 1328 | + */ |
|
| 1329 | + public function print_descriptions_option( $location, $plugin_settings ) { |
|
| 1330 | + $descriptions = 'disabled'; |
|
| 1331 | 1331 | |
| 1332 | - if ( isset( $plugin_settings[ $location ]['descriptions'] ) ) { |
|
| 1333 | - $descriptions = $plugin_settings[ $location ]['descriptions']; |
|
| 1334 | - } elseif ( isset( $plugin_settings['descriptions'] ) ) { |
|
| 1335 | - $descriptions = $plugin_settings['descriptions']; |
|
| 1336 | - } |
|
| 1332 | + if ( isset( $plugin_settings[ $location ]['descriptions'] ) ) { |
|
| 1333 | + $descriptions = $plugin_settings[ $location ]['descriptions']; |
|
| 1334 | + } elseif ( isset( $plugin_settings['descriptions'] ) ) { |
|
| 1335 | + $descriptions = $plugin_settings['descriptions']; |
|
| 1336 | + } |
|
| 1337 | 1337 | |
| 1338 | - ?> |
|
| 1338 | + ?> |
|
| 1339 | 1339 | |
| 1340 | 1340 | <input type='checkbox' value='enabled' name='megamenu_meta[<?php echo esc_attr( $location ); ?>][descriptions]' <?php checked( $descriptions, 'enabled' ); ?> /> |
| 1341 | 1341 | |
| 1342 | 1342 | <?php |
| 1343 | - } |
|
| 1343 | + } |
|
| 1344 | 1344 | |
| 1345 | 1345 | |
| 1346 | - /** |
|
| 1347 | - * Print the checkbox option for prefixing menu items with 'mega-' |
|
| 1348 | - * |
|
| 1349 | - * @since 2.8 |
|
| 1350 | - * @param string $key |
|
| 1351 | - * @param string $value |
|
| 1352 | - */ |
|
| 1353 | - public function print_prefix_option( $location, $plugin_settings ) { |
|
| 1354 | - $prefix = 'disabled'; |
|
| 1346 | + /** |
|
| 1347 | + * Print the checkbox option for prefixing menu items with 'mega-' |
|
| 1348 | + * |
|
| 1349 | + * @since 2.8 |
|
| 1350 | + * @param string $key |
|
| 1351 | + * @param string $value |
|
| 1352 | + */ |
|
| 1353 | + public function print_prefix_option( $location, $plugin_settings ) { |
|
| 1354 | + $prefix = 'disabled'; |
|
| 1355 | 1355 | |
| 1356 | - if ( isset( $plugin_settings[ $location ]['prefix'] ) ) { |
|
| 1357 | - $prefix = $plugin_settings[ $location ]['prefix']; |
|
| 1358 | - } elseif ( isset( $plugin_settings['prefix'] ) ) { |
|
| 1359 | - $prefix = $plugin_settings['prefix']; |
|
| 1360 | - } |
|
| 1356 | + if ( isset( $plugin_settings[ $location ]['prefix'] ) ) { |
|
| 1357 | + $prefix = $plugin_settings[ $location ]['prefix']; |
|
| 1358 | + } elseif ( isset( $plugin_settings['prefix'] ) ) { |
|
| 1359 | + $prefix = $plugin_settings['prefix']; |
|
| 1360 | + } |
|
| 1361 | 1361 | |
| 1362 | - ?> |
|
| 1362 | + ?> |
|
| 1363 | 1363 | |
| 1364 | 1364 | <input type='checkbox' value='enabled' name='megamenu_meta[<?php echo esc_attr( $location ); ?>][prefix]' <?php checked( $prefix, 'enabled' ); ?> /> |
| 1365 | 1365 | |
| 1366 | 1366 | <?php |
| 1367 | - } |
|
| 1367 | + } |
|
| 1368 | 1368 | |
| 1369 | 1369 | |
| 1370 | - /** |
|
| 1371 | - * Print the checkbox option for the Unbind JavaScript Events option |
|
| 1372 | - * |
|
| 1373 | - * @since 2.8 |
|
| 1374 | - * @param string $key |
|
| 1375 | - * @param string $value |
|
| 1376 | - */ |
|
| 1377 | - public function print_unbind_option( $location, $plugin_settings ) { |
|
| 1370 | + /** |
|
| 1371 | + * Print the checkbox option for the Unbind JavaScript Events option |
|
| 1372 | + * |
|
| 1373 | + * @since 2.8 |
|
| 1374 | + * @param string $key |
|
| 1375 | + * @param string $value |
|
| 1376 | + */ |
|
| 1377 | + public function print_unbind_option( $location, $plugin_settings ) { |
|
| 1378 | 1378 | |
| 1379 | - $unbind = 'enabled'; |
|
| 1379 | + $unbind = 'enabled'; |
|
| 1380 | 1380 | |
| 1381 | - if ( isset( $plugin_settings[ $location ]['unbind'] ) ) { |
|
| 1382 | - $unbind = $plugin_settings[ $location ]['unbind']; |
|
| 1383 | - } elseif ( isset( $plugin_settings['unbind'] ) ) { |
|
| 1384 | - $unbind = $plugin_settings['unbind']; |
|
| 1385 | - } |
|
| 1381 | + if ( isset( $plugin_settings[ $location ]['unbind'] ) ) { |
|
| 1382 | + $unbind = $plugin_settings[ $location ]['unbind']; |
|
| 1383 | + } elseif ( isset( $plugin_settings['unbind'] ) ) { |
|
| 1384 | + $unbind = $plugin_settings['unbind']; |
|
| 1385 | + } |
|
| 1386 | 1386 | |
| 1387 | - ?> |
|
| 1387 | + ?> |
|
| 1388 | 1388 | |
| 1389 | 1389 | <input type='checkbox' value='enabled' name='megamenu_meta[<?php echo esc_attr( $location ); ?>][unbind]' <?php checked( $unbind, 'enabled' ); ?> /> |
| 1390 | 1390 | |
| 1391 | 1391 | <?php |
| 1392 | - } |
|
| 1393 | - |
|
| 1394 | - |
|
| 1395 | - /** |
|
| 1396 | - * Print a select box containing all available sub menu trigger events |
|
| 1397 | - * |
|
| 1398 | - * @since 2.8 |
|
| 1399 | - * @param string $key |
|
| 1400 | - * @param string $value |
|
| 1401 | - */ |
|
| 1402 | - public function print_location_event_option( $location, $key, $value ) { |
|
| 1403 | - |
|
| 1404 | - $options = apply_filters( |
|
| 1405 | - 'megamenu_event_options', |
|
| 1406 | - array( |
|
| 1407 | - 'hover' => __( 'Hover Intent', 'megamenu' ), |
|
| 1408 | - 'hover_' => __( 'Hover', 'megamenu' ), |
|
| 1409 | - 'click' => __( 'Click', 'megamenu' ), |
|
| 1410 | - ) |
|
| 1411 | - ); |
|
| 1412 | - |
|
| 1413 | - ?> |
|
| 1392 | + } |
|
| 1393 | + |
|
| 1394 | + |
|
| 1395 | + /** |
|
| 1396 | + * Print a select box containing all available sub menu trigger events |
|
| 1397 | + * |
|
| 1398 | + * @since 2.8 |
|
| 1399 | + * @param string $key |
|
| 1400 | + * @param string $value |
|
| 1401 | + */ |
|
| 1402 | + public function print_location_event_option( $location, $key, $value ) { |
|
| 1403 | + |
|
| 1404 | + $options = apply_filters( |
|
| 1405 | + 'megamenu_event_options', |
|
| 1406 | + array( |
|
| 1407 | + 'hover' => __( 'Hover Intent', 'megamenu' ), |
|
| 1408 | + 'hover_' => __( 'Hover', 'megamenu' ), |
|
| 1409 | + 'click' => __( 'Click', 'megamenu' ), |
|
| 1410 | + ) |
|
| 1411 | + ); |
|
| 1412 | + |
|
| 1413 | + ?> |
|
| 1414 | 1414 | <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]'> |
| 1415 | 1415 | <?php |
| 1416 | 1416 | |
| 1417 | - foreach ( $options as $type => $name ) { |
|
| 1418 | - echo "<option value='" . esc_attr( $type ) . "' " . selected( $value, $type, false ) . '>' . esc_html( $name ) . '</option>'; |
|
| 1419 | - } |
|
| 1417 | + foreach ( $options as $type => $name ) { |
|
| 1418 | + echo "<option value='" . esc_attr( $type ) . "' " . selected( $value, $type, false ) . '>' . esc_html( $name ) . '</option>'; |
|
| 1419 | + } |
|
| 1420 | 1420 | |
| 1421 | - echo '</select>'; |
|
| 1421 | + echo '</select>'; |
|
| 1422 | 1422 | |
| 1423 | - } |
|
| 1423 | + } |
|
| 1424 | 1424 | |
| 1425 | - /** |
|
| 1426 | - * Print a select box containing all available sub menu animation options |
|
| 1427 | - * |
|
| 1428 | - * @since 2.8 |
|
| 1429 | - * @param string $key |
|
| 1430 | - * @param string $value |
|
| 1431 | - */ |
|
| 1432 | - public function print_location_effect_option( $location, $key, $value ) { |
|
| 1433 | - ?> |
|
| 1425 | + /** |
|
| 1426 | + * Print a select box containing all available sub menu animation options |
|
| 1427 | + * |
|
| 1428 | + * @since 2.8 |
|
| 1429 | + * @param string $key |
|
| 1430 | + * @param string $value |
|
| 1431 | + */ |
|
| 1432 | + public function print_location_effect_option( $location, $key, $value ) { |
|
| 1433 | + ?> |
|
| 1434 | 1434 | <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]'> |
| 1435 | 1435 | <?php |
| 1436 | 1436 | |
| 1437 | - $selected = strlen( $value ) ? $value : 'fade_up'; |
|
| 1438 | - |
|
| 1439 | - $options = apply_filters( |
|
| 1440 | - 'megamenu_transition_effects', |
|
| 1441 | - array( |
|
| 1442 | - 'disabled' => array( |
|
| 1443 | - 'label' => __( 'None', 'megamenu' ), |
|
| 1444 | - 'selected' => $selected == 'disabled', |
|
| 1445 | - ), |
|
| 1446 | - 'fade' => array( |
|
| 1447 | - 'label' => __( 'Fade', 'megamenu' ), |
|
| 1448 | - 'selected' => $selected == 'fade', |
|
| 1449 | - ), |
|
| 1450 | - 'fade_up' => array( |
|
| 1451 | - 'label' => __( 'Fade Up', 'megamenu' ), |
|
| 1452 | - 'selected' => $selected == 'fade_up' || $selected == 'fadeUp', |
|
| 1453 | - ), |
|
| 1454 | - 'slide' => array( |
|
| 1455 | - 'label' => __( 'Slide', 'megamenu' ), |
|
| 1456 | - 'selected' => $selected == 'slide', |
|
| 1457 | - ), |
|
| 1458 | - 'slide_up' => array( |
|
| 1459 | - 'label' => __( 'Slide Up', 'megamenu' ), |
|
| 1460 | - 'selected' => $selected == 'slide_up', |
|
| 1461 | - ), |
|
| 1462 | - ), |
|
| 1463 | - $selected |
|
| 1464 | - ); |
|
| 1465 | - |
|
| 1466 | - foreach ( $options as $key => $value ) { |
|
| 1467 | - echo "<option value='" . esc_attr( $key ) . "' " . selected( $value['selected'] ) . '>' . esc_html( $value['label'] ) . '</option>'; |
|
| 1468 | - } |
|
| 1469 | - |
|
| 1470 | - echo '</select>'; |
|
| 1471 | - |
|
| 1472 | - } |
|
| 1473 | - |
|
| 1474 | - |
|
| 1475 | - /** |
|
| 1476 | - * Print a select box containing all available effect speeds (desktop) |
|
| 1477 | - * |
|
| 1478 | - * @since 2.8 |
|
| 1479 | - * @param string $key |
|
| 1480 | - * @param string $value |
|
| 1481 | - */ |
|
| 1482 | - public function print_location_effect_speed_option( $location, $key, $value ) { |
|
| 1483 | - ?> |
|
| 1437 | + $selected = strlen( $value ) ? $value : 'fade_up'; |
|
| 1438 | + |
|
| 1439 | + $options = apply_filters( |
|
| 1440 | + 'megamenu_transition_effects', |
|
| 1441 | + array( |
|
| 1442 | + 'disabled' => array( |
|
| 1443 | + 'label' => __( 'None', 'megamenu' ), |
|
| 1444 | + 'selected' => $selected == 'disabled', |
|
| 1445 | + ), |
|
| 1446 | + 'fade' => array( |
|
| 1447 | + 'label' => __( 'Fade', 'megamenu' ), |
|
| 1448 | + 'selected' => $selected == 'fade', |
|
| 1449 | + ), |
|
| 1450 | + 'fade_up' => array( |
|
| 1451 | + 'label' => __( 'Fade Up', 'megamenu' ), |
|
| 1452 | + 'selected' => $selected == 'fade_up' || $selected == 'fadeUp', |
|
| 1453 | + ), |
|
| 1454 | + 'slide' => array( |
|
| 1455 | + 'label' => __( 'Slide', 'megamenu' ), |
|
| 1456 | + 'selected' => $selected == 'slide', |
|
| 1457 | + ), |
|
| 1458 | + 'slide_up' => array( |
|
| 1459 | + 'label' => __( 'Slide Up', 'megamenu' ), |
|
| 1460 | + 'selected' => $selected == 'slide_up', |
|
| 1461 | + ), |
|
| 1462 | + ), |
|
| 1463 | + $selected |
|
| 1464 | + ); |
|
| 1465 | + |
|
| 1466 | + foreach ( $options as $key => $value ) { |
|
| 1467 | + echo "<option value='" . esc_attr( $key ) . "' " . selected( $value['selected'] ) . '>' . esc_html( $value['label'] ) . '</option>'; |
|
| 1468 | + } |
|
| 1469 | + |
|
| 1470 | + echo '</select>'; |
|
| 1471 | + |
|
| 1472 | + } |
|
| 1473 | + |
|
| 1474 | + |
|
| 1475 | + /** |
|
| 1476 | + * Print a select box containing all available effect speeds (desktop) |
|
| 1477 | + * |
|
| 1478 | + * @since 2.8 |
|
| 1479 | + * @param string $key |
|
| 1480 | + * @param string $value |
|
| 1481 | + */ |
|
| 1482 | + public function print_location_effect_speed_option( $location, $key, $value ) { |
|
| 1483 | + ?> |
|
| 1484 | 1484 | <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]'> |
| 1485 | 1485 | <?php |
| 1486 | 1486 | |
| 1487 | - $selected = strlen( $value ) ? $value : '200'; |
|
| 1487 | + $selected = strlen( $value ) ? $value : '200'; |
|
| 1488 | 1488 | |
| 1489 | - $options = apply_filters( |
|
| 1490 | - 'megamenu_effect_speed', |
|
| 1491 | - array( |
|
| 1492 | - '600' => __( 'Slow', 'megamenu' ), |
|
| 1493 | - '400' => __( 'Med', 'megamenu' ), |
|
| 1494 | - '200' => __( 'Fast', 'megamenu' ), |
|
| 1495 | - ), |
|
| 1496 | - $selected |
|
| 1497 | - ); |
|
| 1489 | + $options = apply_filters( |
|
| 1490 | + 'megamenu_effect_speed', |
|
| 1491 | + array( |
|
| 1492 | + '600' => __( 'Slow', 'megamenu' ), |
|
| 1493 | + '400' => __( 'Med', 'megamenu' ), |
|
| 1494 | + '200' => __( 'Fast', 'megamenu' ), |
|
| 1495 | + ), |
|
| 1496 | + $selected |
|
| 1497 | + ); |
|
| 1498 | 1498 | |
| 1499 | - ksort( $options ); |
|
| 1499 | + ksort( $options ); |
|
| 1500 | 1500 | |
| 1501 | - foreach ( $options as $key => $value ) { |
|
| 1502 | - echo "<option value='" . esc_attr( $key ) . "' " . selected( $selected, $key ) . '>' . esc_html( $value ) . '</option>'; |
|
| 1503 | - } |
|
| 1501 | + foreach ( $options as $key => $value ) { |
|
| 1502 | + echo "<option value='" . esc_attr( $key ) . "' " . selected( $selected, $key ) . '>' . esc_html( $value ) . '</option>'; |
|
| 1503 | + } |
|
| 1504 | 1504 | |
| 1505 | - echo '</select>'; |
|
| 1505 | + echo '</select>'; |
|
| 1506 | 1506 | |
| 1507 | - } |
|
| 1507 | + } |
|
| 1508 | 1508 | |
| 1509 | 1509 | |
| 1510 | - /** |
|
| 1511 | - * Print the textbox containing the various mobile menu options |
|
| 1512 | - * |
|
| 1513 | - * @since 2.8 |
|
| 1514 | - * @param string $key |
|
| 1515 | - * @param string $value |
|
| 1516 | - */ |
|
| 1517 | - public function print_location_effect_mobile_option( $location, $key, $value ) { |
|
| 1518 | - ?> |
|
| 1510 | + /** |
|
| 1511 | + * Print the textbox containing the various mobile menu options |
|
| 1512 | + * |
|
| 1513 | + * @since 2.8 |
|
| 1514 | + * @param string $key |
|
| 1515 | + * @param string $value |
|
| 1516 | + */ |
|
| 1517 | + public function print_location_effect_mobile_option( $location, $key, $value ) { |
|
| 1518 | + ?> |
|
| 1519 | 1519 | <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]'> |
| 1520 | 1520 | <?php |
| 1521 | 1521 | |
| 1522 | - $selected = strlen( $value ) ? $value : 'disabled'; |
|
| 1523 | - |
|
| 1524 | - $options = apply_filters( |
|
| 1525 | - 'megamenu_transition_effects_mobile', |
|
| 1526 | - array( |
|
| 1527 | - 'disabled' => array( |
|
| 1528 | - 'label' => __( 'None', 'megamenu' ), |
|
| 1529 | - 'selected' => $selected == 'disabled', |
|
| 1530 | - ), |
|
| 1531 | - 'slide' => array( |
|
| 1532 | - 'label' => __( 'Slide Down', 'megamenu' ), |
|
| 1533 | - 'selected' => $selected == 'slide', |
|
| 1534 | - ), |
|
| 1535 | - 'slide_left' => array( |
|
| 1536 | - 'label' => __( 'Slide Left (Off Canvas)', 'megamenu' ), |
|
| 1537 | - 'selected' => $selected == 'slide_left', |
|
| 1538 | - ), |
|
| 1539 | - 'slide_right' => array( |
|
| 1540 | - 'label' => __( 'Slide Right (Off Canvas)', 'megamenu' ), |
|
| 1541 | - 'selected' => $selected == 'slide_right', |
|
| 1542 | - ), |
|
| 1543 | - ), |
|
| 1544 | - $selected |
|
| 1545 | - ); |
|
| 1546 | - |
|
| 1547 | - foreach ( $options as $key => $value ) { |
|
| 1548 | - echo "<option value='" . esc_attr( $key ) . "' " . selected( $value['selected'] ) . '>' . esc_html( $value['label'] ) . '</option>'; |
|
| 1549 | - } |
|
| 1550 | - |
|
| 1551 | - echo '</select>'; |
|
| 1552 | - |
|
| 1553 | - } |
|
| 1554 | - |
|
| 1555 | - |
|
| 1556 | - /** |
|
| 1557 | - * Print a select box containing all available effect speeds (mobile) |
|
| 1558 | - * |
|
| 1559 | - * @since 2.8 |
|
| 1560 | - * @param string $key |
|
| 1561 | - * @param string $value |
|
| 1562 | - */ |
|
| 1563 | - public function print_location_effect_speed_mobile_option( $location, $key, $value ) { |
|
| 1564 | - ?> |
|
| 1522 | + $selected = strlen( $value ) ? $value : 'disabled'; |
|
| 1523 | + |
|
| 1524 | + $options = apply_filters( |
|
| 1525 | + 'megamenu_transition_effects_mobile', |
|
| 1526 | + array( |
|
| 1527 | + 'disabled' => array( |
|
| 1528 | + 'label' => __( 'None', 'megamenu' ), |
|
| 1529 | + 'selected' => $selected == 'disabled', |
|
| 1530 | + ), |
|
| 1531 | + 'slide' => array( |
|
| 1532 | + 'label' => __( 'Slide Down', 'megamenu' ), |
|
| 1533 | + 'selected' => $selected == 'slide', |
|
| 1534 | + ), |
|
| 1535 | + 'slide_left' => array( |
|
| 1536 | + 'label' => __( 'Slide Left (Off Canvas)', 'megamenu' ), |
|
| 1537 | + 'selected' => $selected == 'slide_left', |
|
| 1538 | + ), |
|
| 1539 | + 'slide_right' => array( |
|
| 1540 | + 'label' => __( 'Slide Right (Off Canvas)', 'megamenu' ), |
|
| 1541 | + 'selected' => $selected == 'slide_right', |
|
| 1542 | + ), |
|
| 1543 | + ), |
|
| 1544 | + $selected |
|
| 1545 | + ); |
|
| 1546 | + |
|
| 1547 | + foreach ( $options as $key => $value ) { |
|
| 1548 | + echo "<option value='" . esc_attr( $key ) . "' " . selected( $value['selected'] ) . '>' . esc_html( $value['label'] ) . '</option>'; |
|
| 1549 | + } |
|
| 1550 | + |
|
| 1551 | + echo '</select>'; |
|
| 1552 | + |
|
| 1553 | + } |
|
| 1554 | + |
|
| 1555 | + |
|
| 1556 | + /** |
|
| 1557 | + * Print a select box containing all available effect speeds (mobile) |
|
| 1558 | + * |
|
| 1559 | + * @since 2.8 |
|
| 1560 | + * @param string $key |
|
| 1561 | + * @param string $value |
|
| 1562 | + */ |
|
| 1563 | + public function print_location_effect_speed_mobile_option( $location, $key, $value ) { |
|
| 1564 | + ?> |
|
| 1565 | 1565 | <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]'> |
| 1566 | 1566 | <?php |
| 1567 | 1567 | |
| 1568 | - $selected = strlen( $value ) ? $value : '200'; |
|
| 1568 | + $selected = strlen( $value ) ? $value : '200'; |
|
| 1569 | 1569 | |
| 1570 | - $options = apply_filters( |
|
| 1571 | - 'megamenu_effect_speed_mobile', |
|
| 1572 | - array( |
|
| 1573 | - '600' => __( 'Slow', 'megamenu' ), |
|
| 1574 | - '400' => __( 'Med', 'megamenu' ), |
|
| 1575 | - '200' => __( 'Fast', 'megamenu' ), |
|
| 1576 | - ), |
|
| 1577 | - $selected |
|
| 1578 | - ); |
|
| 1570 | + $options = apply_filters( |
|
| 1571 | + 'megamenu_effect_speed_mobile', |
|
| 1572 | + array( |
|
| 1573 | + '600' => __( 'Slow', 'megamenu' ), |
|
| 1574 | + '400' => __( 'Med', 'megamenu' ), |
|
| 1575 | + '200' => __( 'Fast', 'megamenu' ), |
|
| 1576 | + ), |
|
| 1577 | + $selected |
|
| 1578 | + ); |
|
| 1579 | 1579 | |
| 1580 | - ksort( $options ); |
|
| 1580 | + ksort( $options ); |
|
| 1581 | 1581 | |
| 1582 | - foreach ( $options as $key => $value ) { |
|
| 1583 | - echo "<option value='" . esc_attr( $key ) . "' " . selected( $selected, $key ) . '>' . esc_html( $value ) . '</option>'; |
|
| 1584 | - } |
|
| 1582 | + foreach ( $options as $key => $value ) { |
|
| 1583 | + echo "<option value='" . esc_attr( $key ) . "' " . selected( $selected, $key ) . '>' . esc_html( $value ) . '</option>'; |
|
| 1584 | + } |
|
| 1585 | 1585 | |
| 1586 | - echo '</select>'; |
|
| 1586 | + echo '</select>'; |
|
| 1587 | 1587 | |
| 1588 | - } |
|
| 1588 | + } |
|
| 1589 | 1589 | |
| 1590 | 1590 | |
| 1591 | - /** |
|
| 1592 | - * Print a select box containing all available menu themes |
|
| 1593 | - * |
|
| 1594 | - * @since 2.8 |
|
| 1595 | - * @param string $key |
|
| 1596 | - * @param string $value |
|
| 1597 | - */ |
|
| 1598 | - public function print_location_theme_selector_option( $location, $key, $value ) { |
|
| 1599 | - ?> |
|
| 1591 | + /** |
|
| 1592 | + * Print a select box containing all available menu themes |
|
| 1593 | + * |
|
| 1594 | + * @since 2.8 |
|
| 1595 | + * @param string $key |
|
| 1596 | + * @param string $value |
|
| 1597 | + */ |
|
| 1598 | + public function print_location_theme_selector_option( $location, $key, $value ) { |
|
| 1599 | + ?> |
|
| 1600 | 1600 | <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]'> |
| 1601 | 1601 | <?php |
| 1602 | 1602 | |
| 1603 | - $style_manager = new Mega_Menu_Style_Manager(); |
|
| 1604 | - $themes = $style_manager->get_themes(); |
|
| 1605 | - $selected_theme = strlen( $value ) ? $value : 'default'; |
|
| 1606 | - |
|
| 1607 | - foreach ( $themes as $key => $theme ) { |
|
| 1608 | - $edit_theme_url = esc_url( |
|
| 1609 | - add_query_arg( |
|
| 1610 | - array( |
|
| 1611 | - 'page' => 'maxmegamenu_theme_editor', |
|
| 1612 | - 'theme' => $key, |
|
| 1613 | - ), |
|
| 1614 | - admin_url( 'admin.php' ) |
|
| 1615 | - ) |
|
| 1616 | - ); |
|
| 1617 | - |
|
| 1618 | - echo "<option data-url='" . esc_attr($edit_theme_url) . "' value='" . esc_attr( $key ) . "' " . selected( $selected_theme, $key ) . '>' . esc_html( $theme['title'] ) . '</option>'; |
|
| 1619 | - } |
|
| 1620 | - |
|
| 1621 | - echo '</select>'; |
|
| 1622 | - echo "<span class='dashicons dashicons-edit megamenu-edit-theme'>"; |
|
| 1623 | - |
|
| 1624 | - } |
|
| 1625 | - |
|
| 1626 | - |
|
| 1627 | - /** |
|
| 1628 | - * Print the textbox containing the sample PHP code to output a menu location |
|
| 1629 | - * |
|
| 1630 | - * @since 2.8 |
|
| 1631 | - * @param string $key |
|
| 1632 | - * @param string $value |
|
| 1633 | - */ |
|
| 1634 | - public function print_location_php_function_option( $location, $value ) { |
|
| 1635 | - ?> |
|
| 1603 | + $style_manager = new Mega_Menu_Style_Manager(); |
|
| 1604 | + $themes = $style_manager->get_themes(); |
|
| 1605 | + $selected_theme = strlen( $value ) ? $value : 'default'; |
|
| 1606 | + |
|
| 1607 | + foreach ( $themes as $key => $theme ) { |
|
| 1608 | + $edit_theme_url = esc_url( |
|
| 1609 | + add_query_arg( |
|
| 1610 | + array( |
|
| 1611 | + 'page' => 'maxmegamenu_theme_editor', |
|
| 1612 | + 'theme' => $key, |
|
| 1613 | + ), |
|
| 1614 | + admin_url( 'admin.php' ) |
|
| 1615 | + ) |
|
| 1616 | + ); |
|
| 1617 | + |
|
| 1618 | + echo "<option data-url='" . esc_attr($edit_theme_url) . "' value='" . esc_attr( $key ) . "' " . selected( $selected_theme, $key ) . '>' . esc_html( $theme['title'] ) . '</option>'; |
|
| 1619 | + } |
|
| 1620 | + |
|
| 1621 | + echo '</select>'; |
|
| 1622 | + echo "<span class='dashicons dashicons-edit megamenu-edit-theme'>"; |
|
| 1623 | + |
|
| 1624 | + } |
|
| 1625 | + |
|
| 1626 | + |
|
| 1627 | + /** |
|
| 1628 | + * Print the textbox containing the sample PHP code to output a menu location |
|
| 1629 | + * |
|
| 1630 | + * @since 2.8 |
|
| 1631 | + * @param string $key |
|
| 1632 | + * @param string $value |
|
| 1633 | + */ |
|
| 1634 | + public function print_location_php_function_option( $location, $value ) { |
|
| 1635 | + ?> |
|
| 1636 | 1636 | <textarea readonly="readonly"><?php wp_nav_menu( array( 'theme_location' => '<?php echo esc_attr( $value ); ?>' ) ); ?></textarea> |
| 1637 | 1637 | <?php |
| 1638 | - } |
|
| 1639 | - |
|
| 1640 | - |
|
| 1641 | - /** |
|
| 1642 | - * Print the textbox containing the sample shortcode to output a menu location |
|
| 1643 | - * |
|
| 1644 | - * @since 2.8 |
|
| 1645 | - * @param string $key |
|
| 1646 | - * @param string $value |
|
| 1647 | - */ |
|
| 1648 | - public function print_location_shortcode_option( $location, $value ) { |
|
| 1649 | - ?> |
|
| 1638 | + } |
|
| 1639 | + |
|
| 1640 | + |
|
| 1641 | + /** |
|
| 1642 | + * Print the textbox containing the sample shortcode to output a menu location |
|
| 1643 | + * |
|
| 1644 | + * @since 2.8 |
|
| 1645 | + * @param string $key |
|
| 1646 | + * @param string $value |
|
| 1647 | + */ |
|
| 1648 | + public function print_location_shortcode_option( $location, $value ) { |
|
| 1649 | + ?> |
|
| 1650 | 1650 | <textarea readonly="readonly">[maxmegamenu location=<?php echo esc_attr( $value ); ?>]</textarea> |
| 1651 | 1651 | <?php |
| 1652 | - } |
|
| 1653 | - |
|
| 1654 | - |
|
| 1655 | - /** |
|
| 1656 | - * Print the textbox containing instructions on how to display this menu location using a widget |
|
| 1657 | - * |
|
| 1658 | - * @since 2.8 |
|
| 1659 | - * @param string $key |
|
| 1660 | - * @param string $value |
|
| 1661 | - */ |
|
| 1662 | - public function print_location_widget_option( $location, $value ) { |
|
| 1663 | - ?> |
|
| 1652 | + } |
|
| 1653 | + |
|
| 1654 | + |
|
| 1655 | + /** |
|
| 1656 | + * Print the textbox containing instructions on how to display this menu location using a widget |
|
| 1657 | + * |
|
| 1658 | + * @since 2.8 |
|
| 1659 | + * @param string $key |
|
| 1660 | + * @param string $value |
|
| 1661 | + */ |
|
| 1662 | + public function print_location_widget_option( $location, $value ) { |
|
| 1663 | + ?> |
|
| 1664 | 1664 | <textarea readonly="readonly"><?php _e( "Add the 'Max Mega Menu' widget to a widget area.", 'megamenu' ); ?></textarea> |
| 1665 | 1665 | <?php |
| 1666 | - } |
|
| 1667 | - |
|
| 1668 | - |
|
| 1669 | - /** |
|
| 1670 | - * Print a standard text input box |
|
| 1671 | - * |
|
| 1672 | - * @since 2.8 |
|
| 1673 | - * @param string $key |
|
| 1674 | - * @param string $value |
|
| 1675 | - */ |
|
| 1676 | - public function print_location_freetext_option( $location, $key, $value ) { |
|
| 1677 | - echo "<input class='" . esc_attr( 'mega-setting-' . $key ) . "' type='text' name='megamenu_meta[$location][$key]' value='" . esc_attr( $value ) . "' />"; |
|
| 1678 | - } |
|
| 1679 | - |
|
| 1680 | - |
|
| 1681 | - /** |
|
| 1682 | - * Print a text input box allowing the user to change the name of a custom menu location |
|
| 1683 | - * |
|
| 1684 | - * @since 2.8 |
|
| 1685 | - * @param string $key |
|
| 1686 | - * @param string $value |
|
| 1687 | - */ |
|
| 1688 | - public function print_location_description_option( $location, $key, $value ) { |
|
| 1689 | - echo "<input class='" . esc_attr( 'mega-setting-' . $key ) . " wide' type='text' name='custom_location[$location]' value='" . esc_attr( $value ) . "' />"; |
|
| 1690 | - } |
|
| 1691 | - |
|
| 1692 | - |
|
| 1693 | - /** |
|
| 1694 | - * Compare array values |
|
| 1695 | - * |
|
| 1696 | - * @since 2.8 |
|
| 1697 | - * @param array $elem1 |
|
| 1698 | - * @param array $elem2 |
|
| 1699 | - * @return bool |
|
| 1700 | - */ |
|
| 1701 | - private function compare_elems( $elem1, $elem2 ) { |
|
| 1702 | - if ( $elem1['priority'] > $elem2['priority'] ) { |
|
| 1703 | - return 1; |
|
| 1704 | - } |
|
| 1705 | - |
|
| 1706 | - return 0; |
|
| 1707 | - } |
|
| 1708 | - } |
|
| 1666 | + } |
|
| 1667 | + |
|
| 1668 | + |
|
| 1669 | + /** |
|
| 1670 | + * Print a standard text input box |
|
| 1671 | + * |
|
| 1672 | + * @since 2.8 |
|
| 1673 | + * @param string $key |
|
| 1674 | + * @param string $value |
|
| 1675 | + */ |
|
| 1676 | + public function print_location_freetext_option( $location, $key, $value ) { |
|
| 1677 | + echo "<input class='" . esc_attr( 'mega-setting-' . $key ) . "' type='text' name='megamenu_meta[$location][$key]' value='" . esc_attr( $value ) . "' />"; |
|
| 1678 | + } |
|
| 1679 | + |
|
| 1680 | + |
|
| 1681 | + /** |
|
| 1682 | + * Print a text input box allowing the user to change the name of a custom menu location |
|
| 1683 | + * |
|
| 1684 | + * @since 2.8 |
|
| 1685 | + * @param string $key |
|
| 1686 | + * @param string $value |
|
| 1687 | + */ |
|
| 1688 | + public function print_location_description_option( $location, $key, $value ) { |
|
| 1689 | + echo "<input class='" . esc_attr( 'mega-setting-' . $key ) . " wide' type='text' name='custom_location[$location]' value='" . esc_attr( $value ) . "' />"; |
|
| 1690 | + } |
|
| 1691 | + |
|
| 1692 | + |
|
| 1693 | + /** |
|
| 1694 | + * Compare array values |
|
| 1695 | + * |
|
| 1696 | + * @since 2.8 |
|
| 1697 | + * @param array $elem1 |
|
| 1698 | + * @param array $elem2 |
|
| 1699 | + * @return bool |
|
| 1700 | + */ |
|
| 1701 | + private function compare_elems( $elem1, $elem2 ) { |
|
| 1702 | + if ( $elem1['priority'] > $elem2['priority'] ) { |
|
| 1703 | + return 1; |
|
| 1704 | + } |
|
| 1705 | + |
|
| 1706 | + return 0; |
|
| 1707 | + } |
|
| 1708 | + } |
|
| 1709 | 1709 | |
| 1710 | 1710 | endif; |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | 4 | exit; // disable direct access. |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if ( ! class_exists( 'Mega_Menu_Locations' ) ) : |
|
| 7 | +if (!class_exists('Mega_Menu_Locations')) : |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Handles the Mega Menu > Menu Settings page |
@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | * @since 2.8 |
| 18 | 18 | */ |
| 19 | 19 | public function __construct() { |
| 20 | - add_action( 'admin_post_megamenu_add_menu_location', array( $this, 'add_menu_location' ) ); |
|
| 21 | - add_action( 'admin_post_megamenu_delete_menu_location', array( $this, 'delete_menu_location' ) ); |
|
| 22 | - add_action( 'admin_post_megamenu_save_menu_location', array( $this, 'save_menu_location' ) ); |
|
| 20 | + add_action('admin_post_megamenu_add_menu_location', array($this, 'add_menu_location')); |
|
| 21 | + add_action('admin_post_megamenu_delete_menu_location', array($this, 'delete_menu_location')); |
|
| 22 | + add_action('admin_post_megamenu_save_menu_location', array($this, 'save_menu_location')); |
|
| 23 | 23 | |
| 24 | - add_action( 'admin_post_megamenu_sandbox', array( $this, 'sandbox' ) ); |
|
| 25 | - add_action( 'wp_print_scripts', array( $this, 'sandbox_remove_unnecessary_scripts' ) ); |
|
| 26 | - add_action( 'wp_print_styles', array( $this, 'sandbox_remove_unnecessary_styles' ) ); |
|
| 24 | + add_action('admin_post_megamenu_sandbox', array($this, 'sandbox')); |
|
| 25 | + add_action('wp_print_scripts', array($this, 'sandbox_remove_unnecessary_scripts')); |
|
| 26 | + add_action('wp_print_styles', array($this, 'sandbox_remove_unnecessary_styles')); |
|
| 27 | 27 | |
| 28 | - add_filter( 'megamenu_menu_tabs', array( $this, 'add_locations_tab' ), 1 ); |
|
| 29 | - add_action( 'megamenu_page_menu_locations', array( $this, 'menu_locations_page' ) ); |
|
| 28 | + add_filter('megamenu_menu_tabs', array($this, 'add_locations_tab'), 1); |
|
| 29 | + add_action('megamenu_page_menu_locations', array($this, 'menu_locations_page')); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | * @param array $tabs array of available tabs. |
| 37 | 37 | * @since 2.8 |
| 38 | 38 | */ |
| 39 | - public function add_locations_tab( $tabs ) { |
|
| 40 | - $tabs['menu_locations'] = __( 'Menu Locations', 'megamenu' ); |
|
| 39 | + public function add_locations_tab($tabs) { |
|
| 40 | + $tabs['menu_locations'] = __('Menu Locations', 'megamenu'); |
|
| 41 | 41 | return $tabs; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -48,36 +48,36 @@ discard block |
||
| 48 | 48 | * @since 2.8 |
| 49 | 49 | */ |
| 50 | 50 | public function add_menu_location() { |
| 51 | - check_admin_referer( 'megamenu_add_menu_location' ); |
|
| 51 | + check_admin_referer('megamenu_add_menu_location'); |
|
| 52 | 52 | |
| 53 | - $locations = get_option( 'megamenu_locations' ); |
|
| 53 | + $locations = get_option('megamenu_locations'); |
|
| 54 | 54 | $next_id = $this->get_next_menu_location_id(); |
| 55 | 55 | $new_menu_location_id = 'max_mega_menu_' . $next_id; |
| 56 | 56 | |
| 57 | 57 | $title = 'Max Mega Menu Location ' . $next_id; |
| 58 | 58 | |
| 59 | - if ( isset( $_POST['title'] ) ) { |
|
| 60 | - $title = esc_attr( wp_unslash( $_POST['title'] ) ); |
|
| 59 | + if (isset($_POST['title'])) { |
|
| 60 | + $title = esc_attr(wp_unslash($_POST['title'])); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - $locations[ $new_menu_location_id ] = esc_attr( $title ); |
|
| 63 | + $locations[$new_menu_location_id] = esc_attr($title); |
|
| 64 | 64 | |
| 65 | - update_option( 'megamenu_locations', $locations ); |
|
| 65 | + update_option('megamenu_locations', $locations); |
|
| 66 | 66 | |
| 67 | 67 | $menu_id = 0; |
| 68 | 68 | |
| 69 | - if ( isset( $_POST['menu_id'] ) ) { |
|
| 70 | - $menu_id = absint( $_POST['menu_id'] ); |
|
| 69 | + if (isset($_POST['menu_id'])) { |
|
| 70 | + $menu_id = absint($_POST['menu_id']); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if ( $menu_id > 0 ) { |
|
| 74 | - $locations = get_theme_mod( 'nav_menu_locations' ); |
|
| 73 | + if ($menu_id > 0) { |
|
| 74 | + $locations = get_theme_mod('nav_menu_locations'); |
|
| 75 | 75 | |
| 76 | - $locations[ $new_menu_location_id ] = $menu_id; |
|
| 77 | - set_theme_mod( 'nav_menu_locations', $locations ); |
|
| 76 | + $locations[$new_menu_location_id] = $menu_id; |
|
| 77 | + set_theme_mod('nav_menu_locations', $locations); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - do_action( 'megamenu_after_add_menu_location' ); |
|
| 80 | + do_action('megamenu_after_add_menu_location'); |
|
| 81 | 81 | |
| 82 | 82 | $redirect_url = add_query_arg( |
| 83 | 83 | array( |
@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | 'location_added' => 'true', |
| 86 | 86 | 'location' => $new_menu_location_id, |
| 87 | 87 | ), |
| 88 | - admin_url( 'admin.php' ) |
|
| 88 | + admin_url('admin.php') |
|
| 89 | 89 | ); |
| 90 | 90 | |
| 91 | - $this->redirect( $redirect_url ); |
|
| 91 | + $this->redirect($redirect_url); |
|
| 92 | 92 | |
| 93 | 93 | } |
| 94 | 94 | |
@@ -99,28 +99,28 @@ discard block |
||
| 99 | 99 | * @since 2.8 |
| 100 | 100 | */ |
| 101 | 101 | public function delete_menu_location() { |
| 102 | - check_admin_referer( 'megamenu_delete_menu_location' ); |
|
| 102 | + check_admin_referer('megamenu_delete_menu_location'); |
|
| 103 | 103 | |
| 104 | - $locations = get_option( 'megamenu_locations' ); |
|
| 105 | - $location_to_delete = esc_attr( $_GET['location'] ); |
|
| 104 | + $locations = get_option('megamenu_locations'); |
|
| 105 | + $location_to_delete = esc_attr($_GET['location']); |
|
| 106 | 106 | |
| 107 | - if ( isset( $locations[ $location_to_delete ] ) ) { |
|
| 108 | - unset( $locations[ $location_to_delete ] ); |
|
| 109 | - update_option( 'megamenu_locations', $locations ); |
|
| 107 | + if (isset($locations[$location_to_delete])) { |
|
| 108 | + unset($locations[$location_to_delete]); |
|
| 109 | + update_option('megamenu_locations', $locations); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - do_action( 'megamenu_after_delete_menu_location' ); |
|
| 113 | - do_action( 'megamenu_delete_cache' ); |
|
| 112 | + do_action('megamenu_after_delete_menu_location'); |
|
| 113 | + do_action('megamenu_delete_cache'); |
|
| 114 | 114 | |
| 115 | 115 | $redirect_url = add_query_arg( |
| 116 | 116 | array( |
| 117 | 117 | 'page' => 'maxmegamenu', |
| 118 | 118 | 'delete_location' => 'true', |
| 119 | 119 | ), |
| 120 | - admin_url( 'admin.php' ) |
|
| 120 | + admin_url('admin.php') |
|
| 121 | 121 | ); |
| 122 | 122 | |
| 123 | - $this->redirect( $redirect_url ); |
|
| 123 | + $this->redirect($redirect_url); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -129,71 +129,71 @@ discard block |
||
| 129 | 129 | * @since 2.0 |
| 130 | 130 | */ |
| 131 | 131 | public function save_menu_location() { |
| 132 | - check_admin_referer( 'megamenu_save_menu_location' ); |
|
| 132 | + check_admin_referer('megamenu_save_menu_location'); |
|
| 133 | 133 | |
| 134 | 134 | $location = false; |
| 135 | 135 | |
| 136 | - if ( isset( $_POST['location'] ) ) { |
|
| 137 | - $location = esc_attr( $_POST['location'] ); |
|
| 136 | + if (isset($_POST['location'])) { |
|
| 137 | + $location = esc_attr($_POST['location']); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - if ( $location ) { |
|
| 141 | - $submitted_settings = apply_filters( 'megamenu_submitted_settings_meta', $_POST['megamenu_meta'] ); |
|
| 140 | + if ($location) { |
|
| 141 | + $submitted_settings = apply_filters('megamenu_submitted_settings_meta', $_POST['megamenu_meta']); |
|
| 142 | 142 | |
| 143 | - if ( isset( $submitted_settings[ $location ]['enabled'] ) ) { |
|
| 144 | - $submitted_settings[ $location ]['enabled'] = '1'; |
|
| 143 | + if (isset($submitted_settings[$location]['enabled'])) { |
|
| 144 | + $submitted_settings[$location]['enabled'] = '1'; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if ( ! isset( $submitted_settings[ $location ]['unbind'] ) ) { |
|
| 148 | - $submitted_settings[ $location ]['unbind'] = 'disabled'; |
|
| 147 | + if (!isset($submitted_settings[$location]['unbind'])) { |
|
| 148 | + $submitted_settings[$location]['unbind'] = 'disabled'; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - if ( ! isset( $submitted_settings[ $location ]['descriptions'] ) ) { |
|
| 152 | - $submitted_settings[ $location ]['descriptions'] = 'disabled'; |
|
| 151 | + if (!isset($submitted_settings[$location]['descriptions'])) { |
|
| 152 | + $submitted_settings[$location]['descriptions'] = 'disabled'; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if ( ! isset( $submitted_settings[ $location ]['prefix'] ) ) { |
|
| 156 | - $submitted_settings[ $location ]['prefix'] = 'disabled'; |
|
| 155 | + if (!isset($submitted_settings[$location]['prefix'])) { |
|
| 156 | + $submitted_settings[$location]['prefix'] = 'disabled'; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if ( ! get_option( 'megamenu_settings' ) ) { |
|
| 160 | - update_option( 'megamenu_settings', $submitted_settings ); |
|
| 159 | + if (!get_option('megamenu_settings')) { |
|
| 160 | + update_option('megamenu_settings', $submitted_settings); |
|
| 161 | 161 | } else { |
| 162 | - $existing_settings = get_option( 'megamenu_settings' ); |
|
| 163 | - $new_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 162 | + $existing_settings = get_option('megamenu_settings'); |
|
| 163 | + $new_settings = array_merge($existing_settings, $submitted_settings); |
|
| 164 | 164 | |
| 165 | - update_option( 'megamenu_settings', $new_settings ); |
|
| 165 | + update_option('megamenu_settings', $new_settings); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - do_action( 'megamenu_after_save_settings' ); |
|
| 169 | - do_action( 'megamenu_delete_cache' ); |
|
| 168 | + do_action('megamenu_after_save_settings'); |
|
| 169 | + do_action('megamenu_delete_cache'); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /* Save custom location description **/ |
| 173 | - if ( isset( $_POST['custom_location'] ) && is_array( $_POST['custom_location'] ) ) { |
|
| 174 | - $custom_location = array_map( 'sanitize_text_field', $_POST['custom_location'] ); |
|
| 175 | - $locations = get_option( 'megamenu_locations' ); |
|
| 176 | - $new_locations = array_merge( (array) $locations, $custom_location ); |
|
| 173 | + if (isset($_POST['custom_location']) && is_array($_POST['custom_location'])) { |
|
| 174 | + $custom_location = array_map('sanitize_text_field', $_POST['custom_location']); |
|
| 175 | + $locations = get_option('megamenu_locations'); |
|
| 176 | + $new_locations = array_merge((array) $locations, $custom_location); |
|
| 177 | 177 | |
| 178 | - update_option( 'megamenu_locations', $new_locations ); |
|
| 178 | + update_option('megamenu_locations', $new_locations); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - $args = array( |
|
| 181 | + $args = array( |
|
| 182 | 182 | 'page' => 'maxmegamenu', |
| 183 | - 'location' => urlencode( $location ), |
|
| 183 | + 'location' => urlencode($location), |
|
| 184 | 184 | 'save_location' => 'true', |
| 185 | 185 | ); |
| 186 | 186 | |
| 187 | - if ( ! isset( $submitted_settings[ $location ]['enabled'] ) ) { |
|
| 188 | - unset( $args['location'] ); |
|
| 187 | + if (!isset($submitted_settings[$location]['enabled'])) { |
|
| 188 | + unset($args['location']); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $redirect_url = add_query_arg( |
| 192 | 192 | $args, |
| 193 | - admin_url( 'admin.php' ) |
|
| 193 | + admin_url('admin.php') |
|
| 194 | 194 | ); |
| 195 | 195 | |
| 196 | - $this->redirect( $redirect_url ); |
|
| 196 | + $this->redirect($redirect_url); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | * |
| 202 | 202 | * @since 2.8 |
| 203 | 203 | */ |
| 204 | - public function redirect( $url ) { |
|
| 205 | - wp_redirect( $url ); |
|
| 204 | + public function redirect($url) { |
|
| 205 | + wp_redirect($url); |
|
| 206 | 206 | exit; |
| 207 | 207 | } |
| 208 | 208 | |
@@ -215,13 +215,13 @@ discard block |
||
| 215 | 215 | public function get_next_menu_location_id() { |
| 216 | 216 | $last_id = 0; |
| 217 | 217 | |
| 218 | - if ( $locations = get_option( 'megamenu_locations' ) ) { |
|
| 219 | - foreach ( $locations as $key => $value ) { |
|
| 220 | - if ( strpos( $key, 'max_mega_menu_' ) !== false ) { |
|
| 221 | - $parts = explode( '_', $key ); |
|
| 222 | - $menu_id = end( $parts ); |
|
| 218 | + if ($locations = get_option('megamenu_locations')) { |
|
| 219 | + foreach ($locations as $key => $value) { |
|
| 220 | + if (strpos($key, 'max_mega_menu_') !== false) { |
|
| 221 | + $parts = explode('_', $key); |
|
| 222 | + $menu_id = end($parts); |
|
| 223 | 223 | |
| 224 | - if ( $menu_id > $last_id ) { |
|
| 224 | + if ($menu_id > $last_id) { |
|
| 225 | 225 | $last_id = $menu_id; |
| 226 | 226 | } |
| 227 | 227 | } |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | * |
| 240 | 240 | * @since 2.8 |
| 241 | 241 | */ |
| 242 | - public function menu_locations_page( $saved_settings ) { |
|
| 243 | - if ( isset( $_GET['add_location'] ) ) { |
|
| 242 | + public function menu_locations_page($saved_settings) { |
|
| 243 | + if (isset($_GET['add_location'])) { |
|
| 244 | 244 | $this->add_location_page(); |
| 245 | 245 | return; |
| 246 | 246 | } |
@@ -249,11 +249,11 @@ discard block |
||
| 249 | 249 | $enabled_locations = array(); |
| 250 | 250 | $disabled_locations = array(); |
| 251 | 251 | |
| 252 | - foreach ( $all_locations as $id => $description ) { |
|
| 253 | - if ( max_mega_menu_is_enabled( $id ) ) { |
|
| 254 | - $enabled_locations[ $id ] = $description; |
|
| 252 | + foreach ($all_locations as $id => $description) { |
|
| 253 | + if (max_mega_menu_is_enabled($id)) { |
|
| 254 | + $enabled_locations[$id] = $description; |
|
| 255 | 255 | } else { |
| 256 | - $disabled_locations[ $id ] = $description; |
|
| 256 | + $disabled_locations[$id] = $description; |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | ?> |
@@ -262,38 +262,38 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | <?php $this->print_messages(); ?> |
| 264 | 264 | |
| 265 | - <h3 class='first'><span class='dashicons dashicons-location'></span><?php esc_html_e( 'Menu Locations', 'megamenu' ); ?></h3> |
|
| 265 | + <h3 class='first'><span class='dashicons dashicons-location'></span><?php esc_html_e('Menu Locations', 'megamenu'); ?></h3> |
|
| 266 | 266 | |
| 267 | 267 | <table> |
| 268 | 268 | <tr> |
| 269 | 269 | <td class='mega-name'> |
| 270 | - <?php esc_html_e( 'Menu Location Settings', 'megamenu' ); ?> |
|
| 270 | + <?php esc_html_e('Menu Location Settings', 'megamenu'); ?> |
|
| 271 | 271 | <div class='mega-description'> |
| 272 | - <p><?php esc_html_e( 'This is an overview of the menu locations supported by your theme.', 'megamenu' ); ?></p> |
|
| 273 | - <p><?php esc_html_e( 'Use these options to enable Max Mega Menu and define the behaviour of each menu location.', 'megamenu' ); ?></p> |
|
| 272 | + <p><?php esc_html_e('This is an overview of the menu locations supported by your theme.', 'megamenu'); ?></p> |
|
| 273 | + <p><?php esc_html_e('Use these options to enable Max Mega Menu and define the behaviour of each menu location.', 'megamenu'); ?></p> |
|
| 274 | 274 | </div> |
| 275 | 275 | </td> |
| 276 | 276 | <td class='mega-value mega-vartical-align-top'> |
| 277 | 277 | <?php |
| 278 | 278 | |
| 279 | - if ( ! count( $enabled_locations + $disabled_locations ) ) { |
|
| 279 | + if (!count($enabled_locations + $disabled_locations)) { |
|
| 280 | 280 | echo '<p>'; |
| 281 | - esc_html_e( 'Your theme does not natively support menus, but you can add a new menu location using Max Mega Menu and display the menu using the Max Mega Menu widget or shortcode.', 'megamenu' ); |
|
| 281 | + esc_html_e('Your theme does not natively support menus, but you can add a new menu location using Max Mega Menu and display the menu using the Max Mega Menu widget or shortcode.', 'megamenu'); |
|
| 282 | 282 | echo '</p>'; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | echo "<div class='mega-enabled-locations'>"; |
| 286 | - if ( count( $enabled_locations ) ) { |
|
| 287 | - foreach ( $enabled_locations as $location => $description ) { |
|
| 288 | - $this->show_location_accordion_header( $all_locations, $location, $description, $saved_settings ); |
|
| 286 | + if (count($enabled_locations)) { |
|
| 287 | + foreach ($enabled_locations as $location => $description) { |
|
| 288 | + $this->show_location_accordion_header($all_locations, $location, $description, $saved_settings); |
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | echo "</div>"; |
| 292 | 292 | |
| 293 | 293 | echo "<div class='mega-disabled-locations'>"; |
| 294 | - if ( count( $disabled_locations ) ) { |
|
| 295 | - foreach ( $disabled_locations as $location => $description ) { |
|
| 296 | - $this->show_location_accordion_header( $all_locations, $location, $description, $saved_settings ); |
|
| 294 | + if (count($disabled_locations)) { |
|
| 295 | + foreach ($disabled_locations as $location => $description) { |
|
| 296 | + $this->show_location_accordion_header($all_locations, $location, $description, $saved_settings); |
|
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | echo "</div>"; |
@@ -304,11 +304,11 @@ discard block |
||
| 304 | 304 | 'page' => 'maxmegamenu', |
| 305 | 305 | 'add_location' => 'true', |
| 306 | 306 | ), |
| 307 | - admin_url( 'admin.php' ) |
|
| 307 | + admin_url('admin.php') |
|
| 308 | 308 | ) |
| 309 | 309 | ); |
| 310 | 310 | |
| 311 | - echo "<p><a class='button button-secondary mega-add-location' href='{$add_location_url}'>" . esc_html__( 'Add another menu location', 'megamenu' ) . '</a></p>'; |
|
| 311 | + echo "<p><a class='button button-secondary mega-add-location' href='{$add_location_url}'>" . esc_html__('Add another menu location', 'megamenu') . '</a></p>'; |
|
| 312 | 312 | |
| 313 | 313 | ?> |
| 314 | 314 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | </tr> |
| 317 | 317 | </table> |
| 318 | 318 | |
| 319 | - <?php do_action( 'megamenu_menu_locations', $saved_settings ); ?> |
|
| 319 | + <?php do_action('megamenu_menu_locations', $saved_settings); ?> |
|
| 320 | 320 | |
| 321 | 321 | </div> |
| 322 | 322 | |
@@ -330,14 +330,14 @@ discard block |
||
| 330 | 330 | * @param array $location the current location |
| 331 | 331 | * @param string $description the location description |
| 332 | 332 | */ |
| 333 | - private function show_location_accordion_header( $locations, $location, $description, $saved_settings ) { |
|
| 334 | - $open_class = ( isset( $_GET['location'] ) && $_GET['location'] === $location ) ? ' mega-accordion-open' : ''; |
|
| 333 | + private function show_location_accordion_header($locations, $location, $description, $saved_settings) { |
|
| 334 | + $open_class = (isset($_GET['location']) && $_GET['location'] === $location) ? ' mega-accordion-open' : ''; |
|
| 335 | 335 | $is_enabled_class = 'mega-location-disabled'; |
| 336 | 336 | $tooltip = ''; |
| 337 | 337 | |
| 338 | - if ( max_mega_menu_is_enabled( $location ) ) { |
|
| 338 | + if (max_mega_menu_is_enabled($location)) { |
|
| 339 | 339 | $is_enabled_class = 'mega-location-enabled'; |
| 340 | - } elseif ( ! has_nav_menu( $location ) ) { |
|
| 340 | + } elseif (!has_nav_menu($location)) { |
|
| 341 | 341 | $is_enabled_class .= ' mega-location-disabled-assign-menu'; |
| 342 | 342 | } |
| 343 | 343 | |
@@ -345,27 +345,27 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | $active_instance = 0; |
| 347 | 347 | |
| 348 | - if ( isset( $saved_settings[ $location ]['active_instance'] ) ) { |
|
| 349 | - $active_instance = $saved_settings[ $location ]['active_instance']; |
|
| 350 | - } elseif ( isset( $saved_settings['instances'][ $location ] ) ) { |
|
| 351 | - $active_instance = $saved_settings['instances'][ $location ]; |
|
| 348 | + if (isset($saved_settings[$location]['active_instance'])) { |
|
| 349 | + $active_instance = $saved_settings[$location]['active_instance']; |
|
| 350 | + } elseif (isset($saved_settings['instances'][$location])) { |
|
| 351 | + $active_instance = $saved_settings['instances'][$location]; |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - if ( $active_instance > 0 ) { |
|
| 354 | + if ($active_instance > 0) { |
|
| 355 | 355 | $has_active_location_class = ' mega-has-active-location'; |
| 356 | - $tooltip = __( 'Active for Instance' ) . ' ' . esc_attr( $active_instance ); |
|
| 356 | + $tooltip = __('Active for Instance') . ' ' . esc_attr($active_instance); |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | ?> |
| 360 | 360 | |
| 361 | - <div class='mega-location <?php echo esc_attr( $is_enabled_class ); ?><?php echo esc_attr( $has_active_location_class ); ?>'> |
|
| 362 | - <div class='mega-accordion-title<?php echo esc_attr( $open_class ); ?>'> |
|
| 363 | - <h4><?php echo esc_html( $description ); ?></h4> |
|
| 361 | + <div class='mega-location <?php echo esc_attr($is_enabled_class); ?><?php echo esc_attr($has_active_location_class); ?>'> |
|
| 362 | + <div class='mega-accordion-title<?php echo esc_attr($open_class); ?>'> |
|
| 363 | + <h4><?php echo esc_html($description); ?></h4> |
|
| 364 | 364 | <?php |
| 365 | 365 | |
| 366 | 366 | $tooltip_attr = ''; |
| 367 | 367 | |
| 368 | - if ( strlen( $tooltip ) > 0 ) { |
|
| 368 | + if (strlen($tooltip) > 0) { |
|
| 369 | 369 | $tooltip_attr = " data-tooltip='{$tooltip}'"; |
| 370 | 370 | } |
| 371 | 371 | ?> |
@@ -378,11 +378,11 @@ discard block |
||
| 378 | 378 | <path d="M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"></path> |
| 379 | 379 | </svg> |
| 380 | 380 | <ul class='mega-ellipsis-content'> |
| 381 | - <li><?php echo $this->assigned_menu_link( $location ); ?></li> |
|
| 382 | - <li><?php echo $this->sandbox_link( $location ); ?></li> |
|
| 381 | + <li><?php echo $this->assigned_menu_link($location); ?></li> |
|
| 382 | + <li><?php echo $this->sandbox_link($location); ?></li> |
|
| 383 | 383 | <?php |
| 384 | - if ( strpos( $location, 'max_mega_menu_' ) !== false ) { |
|
| 385 | - echo '<li>' . $this->delete_location_link( $location ) . '</li>'; |
|
| 384 | + if (strpos($location, 'max_mega_menu_') !== false) { |
|
| 385 | + echo '<li>' . $this->delete_location_link($location) . '</li>'; |
|
| 386 | 386 | } |
| 387 | 387 | ?> |
| 388 | 388 | </ul> |
@@ -391,13 +391,13 @@ discard block |
||
| 391 | 391 | <div class='mega-accordion-content'> |
| 392 | 392 | <?php |
| 393 | 393 | // if no menu has been assigned to the location |
| 394 | - if ( ! has_nav_menu( $location ) ) { |
|
| 394 | + if (!has_nav_menu($location)) { |
|
| 395 | 395 | echo "<p class='mega-warning'><span class='dashicons dashicons-warning'></span>"; |
| 396 | - echo " <a href='" . admin_url( 'nav-menus.php?action=locations' ) . "'>" . esc_html__( 'Assign a menu', 'megamenu' ) . '</a> '; |
|
| 397 | - echo __( 'to this location to enable these options.', 'megamenu' ); |
|
| 396 | + echo " <a href='" . admin_url('nav-menus.php?action=locations') . "'>" . esc_html__('Assign a menu', 'megamenu') . '</a> '; |
|
| 397 | + echo __('to this location to enable these options.', 'megamenu'); |
|
| 398 | 398 | echo '</p>'; |
| 399 | 399 | } else { |
| 400 | - $this->show_menu_locations_options( $locations, $location, $description ); |
|
| 400 | + $this->show_menu_locations_options($locations, $location, $description); |
|
| 401 | 401 | } |
| 402 | 402 | ?> |
| 403 | 403 | </div> |
@@ -415,29 +415,29 @@ discard block |
||
| 415 | 415 | |
| 416 | 416 | <div class='menu_settings menu_settings_add_location'> |
| 417 | 417 | |
| 418 | - <h3 class='first'><?php esc_html_e( 'Add Menu Location', 'megamenu' ); ?></h3> |
|
| 418 | + <h3 class='first'><?php esc_html_e('Add Menu Location', 'megamenu'); ?></h3> |
|
| 419 | 419 | |
| 420 | - <form action="<?php echo esc_attr( admin_url( 'admin-post.php' ) ); ?>" method="post"> |
|
| 420 | + <form action="<?php echo esc_attr(admin_url('admin-post.php')); ?>" method="post"> |
|
| 421 | 421 | <input type="hidden" name="action" value="megamenu_add_menu_location" /> |
| 422 | - <?php wp_nonce_field( 'megamenu_add_menu_location' ); ?> |
|
| 422 | + <?php wp_nonce_field('megamenu_add_menu_location'); ?> |
|
| 423 | 423 | |
| 424 | 424 | <table> |
| 425 | 425 | <tr> |
| 426 | 426 | <td class='mega-name'> |
| 427 | - <?php esc_html_e( 'Location Name', 'megamenu' ); ?> |
|
| 427 | + <?php esc_html_e('Location Name', 'megamenu'); ?> |
|
| 428 | 428 | <div class='mega-description'> |
| 429 | - <p><?php esc_html_e( 'Give the location a name that describes where the menu will be displayed on your site.', 'megamenu' ); ?></p> |
|
| 429 | + <p><?php esc_html_e('Give the location a name that describes where the menu will be displayed on your site.', 'megamenu'); ?></p> |
|
| 430 | 430 | </div> |
| 431 | 431 | </td> |
| 432 | 432 | <td class='mega-value mega-vartical-align-top'> |
| 433 | - <input class='wide' type='text' name='title' required='required' placeholder='<?php esc_attr_e( 'E.g. Footer, Blog Sidebar, Header', 'megamenu' ); ?>' /> |
|
| 433 | + <input class='wide' type='text' name='title' required='required' placeholder='<?php esc_attr_e('E.g. Footer, Blog Sidebar, Header', 'megamenu'); ?>' /> |
|
| 434 | 434 | </td> |
| 435 | 435 | </tr> |
| 436 | 436 | <tr> |
| 437 | 437 | <td class='mega-name'> |
| 438 | - <?php esc_html_e( 'Assign a menu', 'megamenu' ); ?> |
|
| 438 | + <?php esc_html_e('Assign a menu', 'megamenu'); ?> |
|
| 439 | 439 | <div class='mega-description'> |
| 440 | - <p><?php esc_html_e( 'Select a menu to be assigned to this location. This can be changed later using the Appearance > Menus > Manage Location page.', 'megamenu' ); ?></p> |
|
| 440 | + <p><?php esc_html_e('Select a menu to be assigned to this location. This can be changed later using the Appearance > Menus > Manage Location page.', 'megamenu'); ?></p> |
|
| 441 | 441 | </div> |
| 442 | 442 | </td> |
| 443 | 443 | <td class='mega-value mega-vartical-align-top'> |
@@ -445,18 +445,18 @@ discard block |
||
| 445 | 445 | |
| 446 | 446 | $menus = wp_get_nav_menus(); |
| 447 | 447 | |
| 448 | - if ( count( $menus ) ) { |
|
| 449 | - foreach ( $menus as $menu ) { |
|
| 450 | - echo '<div class="mega-radio-row"><input type="radio" id="' . esc_attr( $menu->slug ) . '" name="menu_id" value="' . esc_attr( $menu->term_id ) . '" /><label for="' . esc_attr( $menu->slug ) . '">' . esc_attr( $menu->name ) . '</label></div>'; |
|
| 448 | + if (count($menus)) { |
|
| 449 | + foreach ($menus as $menu) { |
|
| 450 | + echo '<div class="mega-radio-row"><input type="radio" id="' . esc_attr($menu->slug) . '" name="menu_id" value="' . esc_attr($menu->term_id) . '" /><label for="' . esc_attr($menu->slug) . '">' . esc_attr($menu->name) . '</label></div>'; |
|
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - echo '<div class="mega-radio-row"><input checked="checked" type="radio" id="0" name="menu_id" value="0" /><label for="0">' . esc_html__( "Skip - I'll assign a menu later", 'megamenu' ) . '</label></div>'; |
|
| 454 | + echo '<div class="mega-radio-row"><input checked="checked" type="radio" id="0" name="menu_id" value="0" /><label for="0">' . esc_html__("Skip - I'll assign a menu later", 'megamenu') . '</label></div>'; |
|
| 455 | 455 | ?> |
| 456 | 456 | </td> |
| 457 | 457 | </tr> |
| 458 | 458 | </table> |
| 459 | - <?php submit_button( __( 'Add menu location', 'megamenu' ) ); ?> |
|
| 459 | + <?php submit_button(__('Add menu location', 'megamenu')); ?> |
|
| 460 | 460 | </form> |
| 461 | 461 | </div> |
| 462 | 462 | |
@@ -470,13 +470,13 @@ discard block |
||
| 470 | 470 | * @param string $location |
| 471 | 471 | * @since 2.8 |
| 472 | 472 | */ |
| 473 | - public function assigned_menu_link( $location ) { |
|
| 474 | - $menu_id = $this->get_menu_id_for_location( $location ); |
|
| 473 | + public function assigned_menu_link($location) { |
|
| 474 | + $menu_id = $this->get_menu_id_for_location($location); |
|
| 475 | 475 | |
| 476 | - if ( $menu_id ) { |
|
| 477 | - return "<a href='" . admin_url( "nav-menus.php?action=edit&menu={$menu_id}" ) . "'><span class='dashicons dashicons-menu-alt2'></span>" . esc_html( $this->get_menu_name_for_location( $location ) ) . '</a>'; |
|
| 476 | + if ($menu_id) { |
|
| 477 | + return "<a href='" . admin_url("nav-menus.php?action=edit&menu={$menu_id}") . "'><span class='dashicons dashicons-menu-alt2'></span>" . esc_html($this->get_menu_name_for_location($location)) . '</a>'; |
|
| 478 | 478 | } else { |
| 479 | - return "<a href='" . admin_url( 'nav-menus.php?action=locations' ) . "'><span class='dashicons dashicons-menu-alt2'></span>" . esc_html__( 'Assign a menu', 'megamenu' ) . '</a>'; |
|
| 479 | + return "<a href='" . admin_url('nav-menus.php?action=locations') . "'><span class='dashicons dashicons-menu-alt2'></span>" . esc_html__('Assign a menu', 'megamenu') . '</a>'; |
|
| 480 | 480 | } |
| 481 | 481 | } |
| 482 | 482 | |
@@ -486,8 +486,8 @@ discard block |
||
| 486 | 486 | * @param string $location |
| 487 | 487 | * @since 2.8 |
| 488 | 488 | */ |
| 489 | - public function sandbox_link( $location ) { |
|
| 490 | - return "<a target='megamenu_sandbox' href='" . admin_url( "admin-post.php?action=megamenu_sandbox&location={$location}" ) . "'><span class='dashicons dashicons-external'></span>" . esc_html__( 'View in Sandbox', 'megamenu' ) . '</a>'; |
|
| 489 | + public function sandbox_link($location) { |
|
| 490 | + return "<a target='megamenu_sandbox' href='" . admin_url("admin-post.php?action=megamenu_sandbox&location={$location}") . "'><span class='dashicons dashicons-external'></span>" . esc_html__('View in Sandbox', 'megamenu') . '</a>'; |
|
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | |
@@ -497,18 +497,18 @@ discard block |
||
| 497 | 497 | * @param string $location |
| 498 | 498 | * @since 2.8 |
| 499 | 499 | */ |
| 500 | - public function delete_location_link( $location ) { |
|
| 500 | + public function delete_location_link($location) { |
|
| 501 | 501 | $delete_location_url = esc_url( |
| 502 | 502 | add_query_arg( |
| 503 | 503 | array( |
| 504 | 504 | 'action' => 'megamenu_delete_menu_location', |
| 505 | 505 | 'location' => $location, |
| 506 | 506 | ), |
| 507 | - wp_nonce_url( admin_url( 'admin-post.php' ), 'megamenu_delete_menu_location' ) |
|
| 507 | + wp_nonce_url(admin_url('admin-post.php'), 'megamenu_delete_menu_location') |
|
| 508 | 508 | ) |
| 509 | 509 | ); |
| 510 | 510 | |
| 511 | - return "<a class='confirm' href='{$delete_location_url}'><span class='dashicons dashicons-trash'></span>" . esc_html__( 'Delete location', 'megamenu' ) . '</a>'; |
|
| 511 | + return "<a class='confirm' href='{$delete_location_url}'><span class='dashicons dashicons-trash'></span>" . esc_html__('Delete location', 'megamenu') . '</a>'; |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | /** |
@@ -517,13 +517,13 @@ discard block |
||
| 517 | 517 | * @since 2.9 |
| 518 | 518 | */ |
| 519 | 519 | public function sandbox_remove_unnecessary_scripts() { |
| 520 | - if ( isset( $_GET['action'] ) && $_GET['action'] === 'megamenu_sandbox' ) { |
|
| 520 | + if (isset($_GET['action']) && $_GET['action'] === 'megamenu_sandbox') { |
|
| 521 | 521 | global $wp_scripts; |
| 522 | 522 | |
| 523 | 523 | $queue_items = $wp_scripts->queue; |
| 524 | 524 | $wp_scripts->queue = array(); |
| 525 | 525 | |
| 526 | - do_action( 'megamenu_enqueue_scripts' ); |
|
| 526 | + do_action('megamenu_enqueue_scripts'); |
|
| 527 | 527 | } |
| 528 | 528 | } |
| 529 | 529 | |
@@ -533,13 +533,13 @@ discard block |
||
| 533 | 533 | * @since 2.9 |
| 534 | 534 | */ |
| 535 | 535 | public function sandbox_remove_unnecessary_styles() { |
| 536 | - if ( isset( $_GET['action'] ) && $_GET['action'] === 'megamenu_sandbox' ) { |
|
| 536 | + if (isset($_GET['action']) && $_GET['action'] === 'megamenu_sandbox') { |
|
| 537 | 537 | global $wp_styles; |
| 538 | 538 | |
| 539 | 539 | $queue_items = $wp_styles->queue; |
| 540 | 540 | $wp_styles->queue = array(); |
| 541 | 541 | |
| 542 | - do_action( 'megamenu_enqueue_styles' ); |
|
| 542 | + do_action('megamenu_enqueue_styles'); |
|
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | 545 | |
@@ -550,11 +550,11 @@ discard block |
||
| 550 | 550 | * @since 2.9 |
| 551 | 551 | */ |
| 552 | 552 | public function sandbox() { |
| 553 | - remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); |
|
| 554 | - remove_action( 'wp_head', '_admin_bar_bump_cb' ); |
|
| 553 | + remove_action('wp_footer', 'wp_admin_bar_render', 1000); |
|
| 554 | + remove_action('wp_head', '_admin_bar_bump_cb'); |
|
| 555 | 555 | |
| 556 | - if ( isset( $_GET['location'] ) ) { |
|
| 557 | - $location = esc_attr( $_GET['location'] ); |
|
| 556 | + if (isset($_GET['location'])) { |
|
| 557 | + $location = esc_attr($_GET['location']); |
|
| 558 | 558 | |
| 559 | 559 | ?> |
| 560 | 560 | <!DOCTYPE html> |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | </head> |
| 591 | 591 | <body> |
| 592 | 592 | <div class='menu_wrapper'> |
| 593 | - <?php echo do_shortcode( "[maxmegamenu location={$location}]" ); ?> |
|
| 593 | + <?php echo do_shortcode("[maxmegamenu location={$location}]"); ?> |
|
| 594 | 594 | </div> |
| 595 | 595 | <?php wp_footer(); ?> |
| 596 | 596 | </body> |
@@ -606,19 +606,19 @@ discard block |
||
| 606 | 606 | * |
| 607 | 607 | * @since 2.8 |
| 608 | 608 | */ |
| 609 | - public function show_menu_locations_options( $all_locations, $location, $description ) { |
|
| 609 | + public function show_menu_locations_options($all_locations, $location, $description) { |
|
| 610 | 610 | |
| 611 | - $menu_id = $this->get_menu_id_for_location( $location ); |
|
| 612 | - $is_custom_location = strpos( $location, 'max_mega_menu_' ) !== false; |
|
| 613 | - $plugin_settings = get_option( 'megamenu_settings' ); |
|
| 614 | - $location_settings = isset( $plugin_settings[ $location ] ) ? $plugin_settings[ $location ] : array(); |
|
| 611 | + $menu_id = $this->get_menu_id_for_location($location); |
|
| 612 | + $is_custom_location = strpos($location, 'max_mega_menu_') !== false; |
|
| 613 | + $plugin_settings = get_option('megamenu_settings'); |
|
| 614 | + $location_settings = isset($plugin_settings[$location]) ? $plugin_settings[$location] : array(); |
|
| 615 | 615 | |
| 616 | 616 | ?> |
| 617 | 617 | |
| 618 | - <form action="<?php echo admin_url( 'admin-post.php' ); ?>" method="post"> |
|
| 618 | + <form action="<?php echo admin_url('admin-post.php'); ?>" method="post"> |
|
| 619 | 619 | <input type="hidden" name="action" value="megamenu_save_menu_location" /> |
| 620 | - <input type="hidden" name="location" value="<?php echo esc_attr( $location ); ?>" /> |
|
| 621 | - <?php wp_nonce_field( 'megamenu_save_menu_location' ); ?> |
|
| 620 | + <input type="hidden" name="location" value="<?php echo esc_attr($location); ?>" /> |
|
| 621 | + <?php wp_nonce_field('megamenu_save_menu_location'); ?> |
|
| 622 | 622 | <?php |
| 623 | 623 | |
| 624 | 624 | $settings = apply_filters( |
@@ -627,79 +627,79 @@ discard block |
||
| 627 | 627 | |
| 628 | 628 | 'general' => array( |
| 629 | 629 | 'priority' => 10, |
| 630 | - 'title' => __( 'General Settings', 'megamenu' ), |
|
| 630 | + 'title' => __('General Settings', 'megamenu'), |
|
| 631 | 631 | 'settings' => array( |
| 632 | 632 | 'enabled' => array( |
| 633 | 633 | 'priority' => 10, |
| 634 | - 'title' => __( 'Enabled', 'megamenu' ), |
|
| 635 | - 'description' => __( 'Enable Max Mega Menu for this menu location?', 'megamenu' ), |
|
| 634 | + 'title' => __('Enabled', 'megamenu'), |
|
| 635 | + 'description' => __('Enable Max Mega Menu for this menu location?', 'megamenu'), |
|
| 636 | 636 | 'settings' => array( |
| 637 | 637 | array( |
| 638 | 638 | 'type' => 'checkbox_enabled', |
| 639 | 639 | 'key' => 'enabled', |
| 640 | - 'value' => isset( $location_settings['enabled'] ) ? $location_settings['enabled'] : 0, |
|
| 640 | + 'value' => isset($location_settings['enabled']) ? $location_settings['enabled'] : 0, |
|
| 641 | 641 | ), |
| 642 | 642 | ), |
| 643 | 643 | ), |
| 644 | 644 | 'event' => array( |
| 645 | 645 | 'priority' => 20, |
| 646 | - 'title' => __( 'Event', 'megamenu' ), |
|
| 647 | - 'description' => __( 'Select the event to trigger sub menus', 'megamenu' ), |
|
| 646 | + 'title' => __('Event', 'megamenu'), |
|
| 647 | + 'description' => __('Select the event to trigger sub menus', 'megamenu'), |
|
| 648 | 648 | 'settings' => array( |
| 649 | 649 | array( |
| 650 | 650 | 'type' => 'event', |
| 651 | 651 | 'key' => 'event', |
| 652 | - 'value' => isset( $location_settings['event'] ) ? $location_settings['event'] : 'hover', |
|
| 652 | + 'value' => isset($location_settings['event']) ? $location_settings['event'] : 'hover', |
|
| 653 | 653 | ), |
| 654 | 654 | ), |
| 655 | 655 | ), |
| 656 | 656 | 'effect' => array( |
| 657 | 657 | 'priority' => 30, |
| 658 | - 'title' => __( 'Effect', 'megamenu' ), |
|
| 659 | - 'description' => __( 'Select the sub menu animation type', 'megamenu' ), |
|
| 658 | + 'title' => __('Effect', 'megamenu'), |
|
| 659 | + 'description' => __('Select the sub menu animation type', 'megamenu'), |
|
| 660 | 660 | 'settings' => array( |
| 661 | 661 | array( |
| 662 | 662 | 'type' => 'effect', |
| 663 | 663 | 'key' => 'effect', |
| 664 | - 'value' => isset( $location_settings['effect'] ) ? $location_settings['effect'] : 'fade_up', |
|
| 665 | - 'title' => __( 'Animation', 'megamenu' ), |
|
| 664 | + 'value' => isset($location_settings['effect']) ? $location_settings['effect'] : 'fade_up', |
|
| 665 | + 'title' => __('Animation', 'megamenu'), |
|
| 666 | 666 | ), |
| 667 | 667 | array( |
| 668 | 668 | 'type' => 'effect_speed', |
| 669 | 669 | 'key' => 'effect_speed', |
| 670 | - 'value' => isset( $location_settings['effect_speed'] ) ? $location_settings['effect_speed'] : '200', |
|
| 671 | - 'title' => __( 'Speed', 'megamenu' ), |
|
| 670 | + 'value' => isset($location_settings['effect_speed']) ? $location_settings['effect_speed'] : '200', |
|
| 671 | + 'title' => __('Speed', 'megamenu'), |
|
| 672 | 672 | ), |
| 673 | 673 | ), |
| 674 | 674 | ), |
| 675 | 675 | 'effect_mobile' => array( |
| 676 | 676 | 'priority' => 40, |
| 677 | - 'title' => __( 'Effect (Mobile)', 'megamenu' ), |
|
| 678 | - 'description' => __( 'Choose a style for your mobile menu', 'megamenu' ), |
|
| 677 | + 'title' => __('Effect (Mobile)', 'megamenu'), |
|
| 678 | + 'description' => __('Choose a style for your mobile menu', 'megamenu'), |
|
| 679 | 679 | 'settings' => array( |
| 680 | 680 | array( |
| 681 | 681 | 'type' => 'effect_mobile', |
| 682 | 682 | 'key' => 'effect_mobile', |
| 683 | - 'value' => isset( $location_settings['effect_mobile'] ) ? $location_settings['effect_mobile'] : 'none', |
|
| 684 | - 'title' => __( 'Style', 'megamenu' ), |
|
| 683 | + 'value' => isset($location_settings['effect_mobile']) ? $location_settings['effect_mobile'] : 'none', |
|
| 684 | + 'title' => __('Style', 'megamenu'), |
|
| 685 | 685 | ), |
| 686 | 686 | array( |
| 687 | 687 | 'type' => 'effect_speed_mobile', |
| 688 | 688 | 'key' => 'effect_speed_mobile', |
| 689 | - 'value' => isset( $location_settings['effect_speed_mobile'] ) ? $location_settings['effect_speed_mobile'] : '200', |
|
| 690 | - 'title' => __( 'Speed', 'megamenu' ), |
|
| 689 | + 'value' => isset($location_settings['effect_speed_mobile']) ? $location_settings['effect_speed_mobile'] : '200', |
|
| 690 | + 'title' => __('Speed', 'megamenu'), |
|
| 691 | 691 | ), |
| 692 | 692 | ), |
| 693 | 693 | ), |
| 694 | 694 | 'theme' => array( |
| 695 | 695 | 'priority' => 50, |
| 696 | - 'title' => __( 'Theme', 'megamenu' ), |
|
| 697 | - 'description' => __( 'Select a theme to be applied to the menu', 'megamenu' ), |
|
| 696 | + 'title' => __('Theme', 'megamenu'), |
|
| 697 | + 'description' => __('Select a theme to be applied to the menu', 'megamenu'), |
|
| 698 | 698 | 'settings' => array( |
| 699 | 699 | array( |
| 700 | 700 | 'type' => 'theme_selector', |
| 701 | 701 | 'key' => 'theme', |
| 702 | - 'value' => isset( $location_settings['theme'] ) ? $location_settings['theme'] : 'default', |
|
| 702 | + 'value' => isset($location_settings['theme']) ? $location_settings['theme'] : 'default', |
|
| 703 | 703 | ), |
| 704 | 704 | ), |
| 705 | 705 | ), |
@@ -707,12 +707,12 @@ discard block |
||
| 707 | 707 | ), |
| 708 | 708 | 'advanced' => array( |
| 709 | 709 | 'priority' => 25, |
| 710 | - 'title' => __( 'Advanced', 'megamenu' ), |
|
| 710 | + 'title' => __('Advanced', 'megamenu'), |
|
| 711 | 711 | 'settings' => array( |
| 712 | 712 | 'click_behaviour' => array( |
| 713 | 713 | 'priority' => 10, |
| 714 | - 'title' => __( 'Click Event Behaviour', 'megamenu' ), |
|
| 715 | - 'description' => __( "Define what should happen when the event is set to 'click'. This also applies to mobiles.", 'megamenu' ), |
|
| 714 | + 'title' => __('Click Event Behaviour', 'megamenu'), |
|
| 715 | + 'description' => __("Define what should happen when the event is set to 'click'. This also applies to mobiles.", 'megamenu'), |
|
| 716 | 716 | 'settings' => array( |
| 717 | 717 | array( |
| 718 | 718 | 'type' => 'click_behaviour', |
@@ -723,8 +723,8 @@ discard block |
||
| 723 | 723 | ), |
| 724 | 724 | 'mobile_behaviour' => array( |
| 725 | 725 | 'priority' => 20, |
| 726 | - 'title' => __( 'Mobile Sub Menu Behaviour', 'megamenu' ), |
|
| 727 | - 'description' => __( 'Define the sub menu toggle behaviour for the mobile menu.', 'megamenu' ), |
|
| 726 | + 'title' => __('Mobile Sub Menu Behaviour', 'megamenu'), |
|
| 727 | + 'description' => __('Define the sub menu toggle behaviour for the mobile menu.', 'megamenu'), |
|
| 728 | 728 | 'settings' => array( |
| 729 | 729 | array( |
| 730 | 730 | 'type' => 'mobile_behaviour', |
@@ -735,8 +735,8 @@ discard block |
||
| 735 | 735 | ), |
| 736 | 736 | 'mobile_state' => array( |
| 737 | 737 | 'priority' => 20, |
| 738 | - 'title' => __( 'Mobile Sub Menu Default State', 'megamenu' ), |
|
| 739 | - 'description' => __( 'Define the default state of the sub menus when the mobile menu is visible.', 'megamenu' ), |
|
| 738 | + 'title' => __('Mobile Sub Menu Default State', 'megamenu'), |
|
| 739 | + 'description' => __('Define the default state of the sub menus when the mobile menu is visible.', 'megamenu'), |
|
| 740 | 740 | 'settings' => array( |
| 741 | 741 | array( |
| 742 | 742 | 'type' => 'mobile_state', |
@@ -747,8 +747,8 @@ discard block |
||
| 747 | 747 | ), |
| 748 | 748 | 'descriptions' => array( |
| 749 | 749 | 'priority' => 20, |
| 750 | - 'title' => __( 'Menu Item Descriptions', 'megamenu' ), |
|
| 751 | - 'description' => __( 'Enable output of menu item descriptions.', 'megamenu' ), |
|
| 750 | + 'title' => __('Menu Item Descriptions', 'megamenu'), |
|
| 751 | + 'description' => __('Enable output of menu item descriptions.', 'megamenu'), |
|
| 752 | 752 | 'settings' => array( |
| 753 | 753 | array( |
| 754 | 754 | 'type' => 'descriptions', |
@@ -759,8 +759,8 @@ discard block |
||
| 759 | 759 | ), |
| 760 | 760 | 'unbind' => array( |
| 761 | 761 | 'priority' => 20, |
| 762 | - 'title' => __( 'Unbind JavaScript Events', 'megamenu' ), |
|
| 763 | - 'description' => __( 'To avoid conflicts with theme menu systems, JavaScript events which have been added to menu items will be removed by default.', 'megamenu' ), |
|
| 762 | + 'title' => __('Unbind JavaScript Events', 'megamenu'), |
|
| 763 | + 'description' => __('To avoid conflicts with theme menu systems, JavaScript events which have been added to menu items will be removed by default.', 'megamenu'), |
|
| 764 | 764 | 'settings' => array( |
| 765 | 765 | array( |
| 766 | 766 | 'type' => 'unbind', |
@@ -771,8 +771,8 @@ discard block |
||
| 771 | 771 | ), |
| 772 | 772 | 'prefix' => array( |
| 773 | 773 | 'priority' => 20, |
| 774 | - 'title' => __( 'Prefix Menu Item Classes', 'megamenu' ), |
|
| 775 | - 'description' => __( "Prefix custom menu item classes with 'mega-'?", 'megamenu' ), |
|
| 774 | + 'title' => __('Prefix Menu Item Classes', 'megamenu'), |
|
| 775 | + 'description' => __("Prefix custom menu item classes with 'mega-'?", 'megamenu'), |
|
| 776 | 776 | 'settings' => array( |
| 777 | 777 | array( |
| 778 | 778 | 'type' => 'prefix', |
@@ -783,8 +783,8 @@ discard block |
||
| 783 | 783 | ), |
| 784 | 784 | 'container' => array( |
| 785 | 785 | 'priority' => 20, |
| 786 | - 'title' => __( 'Container', 'megamenu' ), |
|
| 787 | - 'description' => __( 'Use nav or div element for menu wrapper?', 'megamenu' ), |
|
| 786 | + 'title' => __('Container', 'megamenu'), |
|
| 787 | + 'description' => __('Use nav or div element for menu wrapper?', 'megamenu'), |
|
| 788 | 788 | 'settings' => array( |
| 789 | 789 | array( |
| 790 | 790 | 'type' => 'container', |
@@ -795,9 +795,9 @@ discard block |
||
| 795 | 795 | ), |
| 796 | 796 | 'active_instance' => array( |
| 797 | 797 | 'priority' => 30, |
| 798 | - 'title' => __( 'Active Menu Instance', 'megamenu' ), |
|
| 799 | - 'info' => array( __( '0: Apply to all instances. 1: Apply to first instance. 2: Apply to second instance', 'megamenu' ) . '…' ), |
|
| 800 | - 'description' => __( 'Some themes will output this menu location multiple times on the same page. For example, it may be output once for the main menu, then again for the mobile menu. This setting can be used to make sure Max Mega Menu is only applied to one of those instances.', 'megamenu' ), |
|
| 798 | + 'title' => __('Active Menu Instance', 'megamenu'), |
|
| 799 | + 'info' => array(__('0: Apply to all instances. 1: Apply to first instance. 2: Apply to second instance', 'megamenu') . '…'), |
|
| 800 | + 'description' => __('Some themes will output this menu location multiple times on the same page. For example, it may be output once for the main menu, then again for the mobile menu. This setting can be used to make sure Max Mega Menu is only applied to one of those instances.', 'megamenu'), |
|
| 801 | 801 | 'settings' => array( |
| 802 | 802 | array( |
| 803 | 803 | 'type' => 'active_instance', |
@@ -810,12 +810,12 @@ discard block |
||
| 810 | 810 | ), |
| 811 | 811 | 'output_options' => array( |
| 812 | 812 | 'priority' => 30, |
| 813 | - 'title' => __( 'Display Options', 'megamenu' ), |
|
| 813 | + 'title' => __('Display Options', 'megamenu'), |
|
| 814 | 814 | 'settings' => array( |
| 815 | 815 | 'location_php_function' => array( |
| 816 | 816 | 'priority' => 10, |
| 817 | - 'title' => __( 'PHP Function', 'megamenu' ), |
|
| 818 | - 'description' => __( 'For use in a theme template (usually header.php)', 'megamenu' ), |
|
| 817 | + 'title' => __('PHP Function', 'megamenu'), |
|
| 818 | + 'description' => __('For use in a theme template (usually header.php)', 'megamenu'), |
|
| 819 | 819 | 'settings' => array( |
| 820 | 820 | array( |
| 821 | 821 | 'type' => 'location_php_function', |
@@ -826,8 +826,8 @@ discard block |
||
| 826 | 826 | ), |
| 827 | 827 | 'location_shortcode' => array( |
| 828 | 828 | 'priority' => 20, |
| 829 | - 'title' => __( 'Shortcode', 'megamenu' ), |
|
| 830 | - 'description' => __( 'For use in a post or page.', 'megamenu' ), |
|
| 829 | + 'title' => __('Shortcode', 'megamenu'), |
|
| 830 | + 'description' => __('For use in a post or page.', 'megamenu'), |
|
| 831 | 831 | 'settings' => array( |
| 832 | 832 | array( |
| 833 | 833 | 'type' => 'location_shortcode', |
@@ -838,8 +838,8 @@ discard block |
||
| 838 | 838 | ), |
| 839 | 839 | 'location_widget' => array( |
| 840 | 840 | 'priority' => 30, |
| 841 | - 'title' => __( 'Widget', 'megamenu' ), |
|
| 842 | - 'description' => __( 'For use in a widget area.', 'megamenu' ), |
|
| 841 | + 'title' => __('Widget', 'megamenu'), |
|
| 842 | + 'description' => __('For use in a widget area.', 'megamenu'), |
|
| 843 | 843 | 'settings' => array( |
| 844 | 844 | array( |
| 845 | 845 | 'type' => 'location_widget', |
@@ -855,12 +855,12 @@ discard block |
||
| 855 | 855 | $plugin_settings |
| 856 | 856 | ); |
| 857 | 857 | |
| 858 | - if ( $is_custom_location ) { |
|
| 858 | + if ($is_custom_location) { |
|
| 859 | 859 | |
| 860 | 860 | $settings['general']['settings']['location_description'] = array( |
| 861 | 861 | 'priority' => 15, |
| 862 | - 'title' => __( 'Location Description', 'megamenu' ), |
|
| 863 | - 'description' => __( 'Update the custom location description', 'megamenu' ), |
|
| 862 | + 'title' => __('Location Description', 'megamenu'), |
|
| 863 | + 'description' => __('Update the custom location description', 'megamenu'), |
|
| 864 | 864 | 'settings' => array( |
| 865 | 865 | array( |
| 866 | 866 | 'type' => 'location_description', |
@@ -871,9 +871,9 @@ discard block |
||
| 871 | 871 | ); |
| 872 | 872 | } |
| 873 | 873 | |
| 874 | - $initial_version = get_option( 'megamenu_initial_version' ); |
|
| 874 | + $initial_version = get_option('megamenu_initial_version'); |
|
| 875 | 875 | |
| 876 | - if ( $initial_version && version_compare( $initial_version, '2.8', '>' ) ) { |
|
| 876 | + if ($initial_version && version_compare($initial_version, '2.8', '>')) { |
|
| 877 | 877 | //unset( $settings['advanced']['settings']['prefix'] ); // users who started out with 2.8.1+ will not see this option. |
| 878 | 878 | } |
| 879 | 879 | |
@@ -883,18 +883,18 @@ discard block |
||
| 883 | 883 | |
| 884 | 884 | $is_first = true; |
| 885 | 885 | |
| 886 | - uasort( $settings, array( $this, 'compare_elems' ) ); |
|
| 886 | + uasort($settings, array($this, 'compare_elems')); |
|
| 887 | 887 | |
| 888 | - foreach ( $settings as $section_id => $section ) { |
|
| 888 | + foreach ($settings as $section_id => $section) { |
|
| 889 | 889 | |
| 890 | - if ( $is_first ) { |
|
| 890 | + if ($is_first) { |
|
| 891 | 891 | $active = 'nav-tab-active'; |
| 892 | 892 | $is_first = false; |
| 893 | 893 | } else { |
| 894 | 894 | $active = ''; |
| 895 | 895 | } |
| 896 | 896 | |
| 897 | - echo "<a class='mega-tab nav-tab {$active}' data-tab='mega-tab-content-{$section_id}'>" . esc_html( $section['title'] ) . '</a>'; |
|
| 897 | + echo "<a class='mega-tab nav-tab {$active}' data-tab='mega-tab-content-{$section_id}'>" . esc_html($section['title']) . '</a>'; |
|
| 898 | 898 | |
| 899 | 899 | } |
| 900 | 900 | |
@@ -902,9 +902,9 @@ discard block |
||
| 902 | 902 | |
| 903 | 903 | $is_first = true; |
| 904 | 904 | |
| 905 | - foreach ( $settings as $section_id => $section ) { |
|
| 905 | + foreach ($settings as $section_id => $section) { |
|
| 906 | 906 | |
| 907 | - if ( $is_first ) { |
|
| 907 | + if ($is_first) { |
|
| 908 | 908 | $display = 'block'; |
| 909 | 909 | $is_first = false; |
| 910 | 910 | } else { |
@@ -913,107 +913,107 @@ discard block |
||
| 913 | 913 | |
| 914 | 914 | echo "<div class='mega-tab-content mega-tab-content-{$section_id}' style='display: {$display}'>"; |
| 915 | 915 | |
| 916 | - if ( $section_id == 'output_options' && ! $is_custom_location ) { |
|
| 917 | - echo "<p class='mega-warning '><span class='dashicons dashicons-warning'></span>" . __( 'This menu location is registered by your theme. Your theme should already include the code required to display this menu location on your site.', 'megamenu' ) . '</p>'; |
|
| 916 | + if ($section_id == 'output_options' && !$is_custom_location) { |
|
| 917 | + echo "<p class='mega-warning '><span class='dashicons dashicons-warning'></span>" . __('This menu location is registered by your theme. Your theme should already include the code required to display this menu location on your site.', 'megamenu') . '</p>'; |
|
| 918 | 918 | } |
| 919 | 919 | |
| 920 | 920 | echo "<table class='{$section_id}'>"; |
| 921 | 921 | |
| 922 | 922 | // order the fields by priority |
| 923 | - uasort( $section['settings'], array( $this, 'compare_elems' ) ); |
|
| 923 | + uasort($section['settings'], array($this, 'compare_elems')); |
|
| 924 | 924 | |
| 925 | - foreach ( $section['settings'] as $group_id => $group ) { |
|
| 925 | + foreach ($section['settings'] as $group_id => $group) { |
|
| 926 | 926 | |
| 927 | - echo "<tr class='" . esc_attr( 'mega-' . $group_id ) . "'>"; |
|
| 927 | + echo "<tr class='" . esc_attr('mega-' . $group_id) . "'>"; |
|
| 928 | 928 | |
| 929 | - if ( isset( $group['settings'] ) ) { |
|
| 929 | + if (isset($group['settings'])) { |
|
| 930 | 930 | |
| 931 | 931 | echo "<td class='mega-name'>"; |
| 932 | - if ( isset( $group['icon'] ) ) { |
|
| 933 | - echo "<span class='dashicons dashicons-" . esc_html( $group['icon'] ) . "'></span>"; |
|
| 932 | + if (isset($group['icon'])) { |
|
| 933 | + echo "<span class='dashicons dashicons-" . esc_html($group['icon']) . "'></span>"; |
|
| 934 | 934 | } |
| 935 | - echo esc_html( $group['title'] ); |
|
| 936 | - echo "<div class='mega-description'>" . esc_html( $group['description'] ) . '</div>'; |
|
| 935 | + echo esc_html($group['title']); |
|
| 936 | + echo "<div class='mega-description'>" . esc_html($group['description']) . '</div>'; |
|
| 937 | 937 | echo '</td>'; |
| 938 | 938 | echo "<td class='mega-value'>"; |
| 939 | 939 | |
| 940 | - foreach ( $group['settings'] as $setting_id => $setting ) { |
|
| 940 | + foreach ($group['settings'] as $setting_id => $setting) { |
|
| 941 | 941 | |
| 942 | - echo "<label class='" . esc_attr( 'mega-' . $setting['key'] ) . "'>"; |
|
| 942 | + echo "<label class='" . esc_attr('mega-' . $setting['key']) . "'>"; |
|
| 943 | 943 | |
| 944 | - if ( isset( $setting['title'] ) ) { |
|
| 945 | - echo "<span class='mega-short-desc'>" . esc_html( $setting['title'] ) . '</span>'; |
|
| 944 | + if (isset($setting['title'])) { |
|
| 945 | + echo "<span class='mega-short-desc'>" . esc_html($setting['title']) . '</span>'; |
|
| 946 | 946 | } |
| 947 | 947 | |
| 948 | - switch ( $setting['type'] ) { |
|
| 948 | + switch ($setting['type']) { |
|
| 949 | 949 | case 'freetext': |
| 950 | - $this->print_location_freetext_option( $location, $setting['key'], $setting['value'] ); |
|
| 950 | + $this->print_location_freetext_option($location, $setting['key'], $setting['value']); |
|
| 951 | 951 | break; |
| 952 | 952 | case 'textarea': |
| 953 | - $this->print_location_textarea_option( $location, $setting['key'] ); |
|
| 953 | + $this->print_location_textarea_option($location, $setting['key']); |
|
| 954 | 954 | break; |
| 955 | 955 | case 'checkbox_enabled': |
| 956 | - $this->print_location_enabled_option( $location, $setting['key'], $setting['value'] ); |
|
| 956 | + $this->print_location_enabled_option($location, $setting['key'], $setting['value']); |
|
| 957 | 957 | break; |
| 958 | 958 | case 'event': |
| 959 | - $this->print_location_event_option( $location, $setting['key'], $setting['value'] ); |
|
| 959 | + $this->print_location_event_option($location, $setting['key'], $setting['value']); |
|
| 960 | 960 | break; |
| 961 | 961 | case 'effect': |
| 962 | - $this->print_location_effect_option( $location, $setting['key'], $setting['value'] ); |
|
| 962 | + $this->print_location_effect_option($location, $setting['key'], $setting['value']); |
|
| 963 | 963 | break; |
| 964 | 964 | case 'effect_speed': |
| 965 | - $this->print_location_effect_speed_option( $location, $setting['key'], $setting['value'] ); |
|
| 965 | + $this->print_location_effect_speed_option($location, $setting['key'], $setting['value']); |
|
| 966 | 966 | break; |
| 967 | 967 | case 'effect_mobile': |
| 968 | - $this->print_location_effect_mobile_option( $location, $setting['key'], $setting['value'] ); |
|
| 968 | + $this->print_location_effect_mobile_option($location, $setting['key'], $setting['value']); |
|
| 969 | 969 | break; |
| 970 | 970 | case 'effect_speed_mobile': |
| 971 | - $this->print_location_effect_speed_mobile_option( $location, $setting['key'], $setting['value'] ); |
|
| 971 | + $this->print_location_effect_speed_mobile_option($location, $setting['key'], $setting['value']); |
|
| 972 | 972 | break; |
| 973 | 973 | case 'theme_selector': |
| 974 | - $this->print_location_theme_selector_option( $location, $setting['key'], $setting['value'] ); |
|
| 974 | + $this->print_location_theme_selector_option($location, $setting['key'], $setting['value']); |
|
| 975 | 975 | break; |
| 976 | 976 | case 'location_description': |
| 977 | - $this->print_location_description_option( $location, $setting['key'], $setting['value'] ); |
|
| 977 | + $this->print_location_description_option($location, $setting['key'], $setting['value']); |
|
| 978 | 978 | break; |
| 979 | 979 | case 'checkbox': |
| 980 | - $this->print_location_checkbox_option( $location, $setting['key'], $setting['value'] ); |
|
| 980 | + $this->print_location_checkbox_option($location, $setting['key'], $setting['value']); |
|
| 981 | 981 | break; |
| 982 | 982 | case 'location_php_function': |
| 983 | - $this->print_location_php_function_option( $location, $setting['value'] ); |
|
| 983 | + $this->print_location_php_function_option($location, $setting['value']); |
|
| 984 | 984 | break; |
| 985 | 985 | case 'location_shortcode': |
| 986 | - $this->print_location_shortcode_option( $location, $setting['value'] ); |
|
| 986 | + $this->print_location_shortcode_option($location, $setting['value']); |
|
| 987 | 987 | break; |
| 988 | 988 | case 'location_widget': |
| 989 | - $this->print_location_widget_option( $location, $setting['key'], $setting['value'] ); |
|
| 989 | + $this->print_location_widget_option($location, $setting['key'], $setting['value']); |
|
| 990 | 990 | break; |
| 991 | 991 | case 'active_instance': |
| 992 | - $this->print_active_instance_option( $location, $setting['value'] ); |
|
| 992 | + $this->print_active_instance_option($location, $setting['value']); |
|
| 993 | 993 | break; |
| 994 | 994 | case 'click_behaviour': |
| 995 | - $this->print_click_behaviour_option( $location, $setting['value'] ); |
|
| 995 | + $this->print_click_behaviour_option($location, $setting['value']); |
|
| 996 | 996 | break; |
| 997 | 997 | case 'mobile_behaviour': |
| 998 | - $this->print_mobile_behaviour_option( $location, $setting['value'] ); |
|
| 998 | + $this->print_mobile_behaviour_option($location, $setting['value']); |
|
| 999 | 999 | break; |
| 1000 | 1000 | case 'mobile_state': |
| 1001 | - $this->print_mobile_state_option( $location, $setting['value'] ); |
|
| 1001 | + $this->print_mobile_state_option($location, $setting['value']); |
|
| 1002 | 1002 | break; |
| 1003 | 1003 | case 'container': |
| 1004 | - $this->print_container_option( $location, $setting['value'] ); |
|
| 1004 | + $this->print_container_option($location, $setting['value']); |
|
| 1005 | 1005 | break; |
| 1006 | 1006 | case 'descriptions': |
| 1007 | - $this->print_descriptions_option( $location, $setting['value'] ); |
|
| 1007 | + $this->print_descriptions_option($location, $setting['value']); |
|
| 1008 | 1008 | break; |
| 1009 | 1009 | case 'unbind': |
| 1010 | - $this->print_unbind_option( $location, $setting['value'] ); |
|
| 1010 | + $this->print_unbind_option($location, $setting['value']); |
|
| 1011 | 1011 | break; |
| 1012 | 1012 | case 'prefix': |
| 1013 | - $this->print_prefix_option( $location, $setting['value'] ); |
|
| 1013 | + $this->print_prefix_option($location, $setting['value']); |
|
| 1014 | 1014 | break; |
| 1015 | 1015 | default: |
| 1016 | - do_action( "megamenu_print_location_option_{$setting['type']}", $setting['key'], $this->id ); |
|
| 1016 | + do_action("megamenu_print_location_option_{$setting['type']}", $setting['key'], $this->id); |
|
| 1017 | 1017 | break; |
| 1018 | 1018 | } |
| 1019 | 1019 | |
@@ -1021,8 +1021,8 @@ discard block |
||
| 1021 | 1021 | |
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | - if ( isset( $group['info'] ) ) { |
|
| 1025 | - foreach ( $group['info'] as $paragraph ) { |
|
| 1024 | + if (isset($group['info'])) { |
|
| 1025 | + foreach ($group['info'] as $paragraph) { |
|
| 1026 | 1026 | echo "<div class='mega-info'>{$paragraph}</div>"; |
| 1027 | 1027 | } |
| 1028 | 1028 | } |
@@ -1035,8 +1035,8 @@ discard block |
||
| 1035 | 1035 | |
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | - if ( $section_id == 'general' ) { |
|
| 1039 | - do_action( 'megamenu_settings_table', $location, $plugin_settings ); |
|
| 1038 | + if ($section_id == 'general') { |
|
| 1039 | + do_action('megamenu_settings_table', $location, $plugin_settings); |
|
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | echo '</table>'; |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | |
| 1048 | 1048 | </div> |
| 1049 | 1049 | <div class='megamenu_submit'> |
| 1050 | - <?php submit_button( $text = null ); ?> |
|
| 1050 | + <?php submit_button($text = null); ?> |
|
| 1051 | 1051 | </div> |
| 1052 | 1052 | </form> |
| 1053 | 1053 | |
@@ -1065,16 +1065,16 @@ discard block |
||
| 1065 | 1065 | $all_locations = get_registered_nav_menus(); |
| 1066 | 1066 | |
| 1067 | 1067 | // PolyLang - remove auto created/translated menu locations |
| 1068 | - if ( function_exists( 'pll_default_language' ) ) { |
|
| 1069 | - $default_lang = pll_default_language( 'name' ); |
|
| 1068 | + if (function_exists('pll_default_language')) { |
|
| 1069 | + $default_lang = pll_default_language('name'); |
|
| 1070 | 1070 | |
| 1071 | - foreach ( $all_locations as $loc => $description ) { |
|
| 1072 | - if ( false !== strpos( $loc, '___' ) ) { |
|
| 1071 | + foreach ($all_locations as $loc => $description) { |
|
| 1072 | + if (false !== strpos($loc, '___')) { |
|
| 1073 | 1073 | // Remove locations created by Polylang |
| 1074 | - unregister_nav_menu( $loc ); |
|
| 1074 | + unregister_nav_menu($loc); |
|
| 1075 | 1075 | } else { |
| 1076 | 1076 | // Remove the language name appended to the original locations |
| 1077 | - register_nav_menu( $loc, str_replace( ' ' . $default_lang, '', $description ) ); |
|
| 1077 | + register_nav_menu($loc, str_replace(' ' . $default_lang, '', $description)); |
|
| 1078 | 1078 | } |
| 1079 | 1079 | } |
| 1080 | 1080 | |
@@ -1082,25 +1082,25 @@ discard block |
||
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | 1084 | $locations = array(); |
| 1085 | - $custom_locations = get_option( 'megamenu_locations' ); |
|
| 1085 | + $custom_locations = get_option('megamenu_locations'); |
|
| 1086 | 1086 | |
| 1087 | - if ( is_array( $custom_locations ) ) { |
|
| 1088 | - $all_locations = array_merge( $custom_locations, $all_locations ); |
|
| 1087 | + if (is_array($custom_locations)) { |
|
| 1088 | + $all_locations = array_merge($custom_locations, $all_locations); |
|
| 1089 | 1089 | } |
| 1090 | 1090 | |
| 1091 | - if ( count( $all_locations ) ) { |
|
| 1091 | + if (count($all_locations)) { |
|
| 1092 | 1092 | $megamenu_locations = array(); |
| 1093 | 1093 | |
| 1094 | 1094 | // reorder locations so custom MMM locations are listed at the bottom |
| 1095 | - foreach ( $all_locations as $location => $val ) { |
|
| 1096 | - if ( strpos( $location, 'max_mega_menu_' ) === false ) { |
|
| 1097 | - $locations[ $location ] = $val; |
|
| 1095 | + foreach ($all_locations as $location => $val) { |
|
| 1096 | + if (strpos($location, 'max_mega_menu_') === false) { |
|
| 1097 | + $locations[$location] = $val; |
|
| 1098 | 1098 | } else { |
| 1099 | - $megamenu_locations[ $location ] = $val; |
|
| 1099 | + $megamenu_locations[$location] = $val; |
|
| 1100 | 1100 | } |
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | - $locations = array_merge( $locations, $megamenu_locations ); |
|
| 1103 | + $locations = array_merge($locations, $megamenu_locations); |
|
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | 1106 | return $locations; |
@@ -1113,9 +1113,9 @@ discard block |
||
| 1113 | 1113 | * @since 2.8 |
| 1114 | 1114 | * @param string $location |
| 1115 | 1115 | */ |
| 1116 | - private function get_menu_id_for_location( $location ) { |
|
| 1116 | + private function get_menu_id_for_location($location) { |
|
| 1117 | 1117 | $locations = get_nav_menu_locations(); |
| 1118 | - $id = isset( $locations[ $location ] ) ? $locations[ $location ] : 0; |
|
| 1118 | + $id = isset($locations[$location]) ? $locations[$location] : 0; |
|
| 1119 | 1119 | return $id; |
| 1120 | 1120 | } |
| 1121 | 1121 | |
@@ -1126,13 +1126,13 @@ discard block |
||
| 1126 | 1126 | * @since 2.8 |
| 1127 | 1127 | * @param string $location |
| 1128 | 1128 | */ |
| 1129 | - private function get_menu_name_for_location( $location ) { |
|
| 1130 | - $id = $this->get_menu_id_for_location( $location ); |
|
| 1129 | + private function get_menu_name_for_location($location) { |
|
| 1130 | + $id = $this->get_menu_id_for_location($location); |
|
| 1131 | 1131 | |
| 1132 | 1132 | $menus = wp_get_nav_menus(); |
| 1133 | 1133 | |
| 1134 | - foreach ( $menus as $menu ) { |
|
| 1135 | - if ( $menu->term_id == $id ) { |
|
| 1134 | + foreach ($menus as $menu) { |
|
| 1135 | + if ($menu->term_id == $id) { |
|
| 1136 | 1136 | return $menu->name; |
| 1137 | 1137 | } |
| 1138 | 1138 | } |
@@ -1147,26 +1147,26 @@ discard block |
||
| 1147 | 1147 | * @since 2.0 |
| 1148 | 1148 | */ |
| 1149 | 1149 | public function print_messages() { |
| 1150 | - if ( isset( $_GET['location_added'] ) ) { |
|
| 1150 | + if (isset($_GET['location_added'])) { |
|
| 1151 | 1151 | ?> |
| 1152 | 1152 | <div class="notice notice-success is-dismissible"> |
| 1153 | - <p><?php _e( 'New Menu Location Created', 'megamenu' ) ?></p> |
|
| 1153 | + <p><?php _e('New Menu Location Created', 'megamenu') ?></p> |
|
| 1154 | 1154 | </div> |
| 1155 | 1155 | <?php |
| 1156 | 1156 | } |
| 1157 | 1157 | |
| 1158 | - if ( isset( $_GET['delete_location'] ) ) { |
|
| 1158 | + if (isset($_GET['delete_location'])) { |
|
| 1159 | 1159 | ?> |
| 1160 | 1160 | <div class="notice notice-success is-dismissible"> |
| 1161 | - <p><?php _e( 'Menu Location Deleted', 'megamenu' ) ?></p> |
|
| 1161 | + <p><?php _e('Menu Location Deleted', 'megamenu') ?></p> |
|
| 1162 | 1162 | </div> |
| 1163 | 1163 | <?php |
| 1164 | 1164 | } |
| 1165 | 1165 | |
| 1166 | - if ( isset( $_GET['save_location'] ) ) { |
|
| 1166 | + if (isset($_GET['save_location'])) { |
|
| 1167 | 1167 | ?> |
| 1168 | 1168 | <div class="notice notice-success is-dismissible"> |
| 1169 | - <p><?php _e( 'Menu Location Saved', 'megamenu' ) ?></p> |
|
| 1169 | + <p><?php _e('Menu Location Saved', 'megamenu') ?></p> |
|
| 1170 | 1170 | </div> |
| 1171 | 1171 | <?php |
| 1172 | 1172 | } |
@@ -1180,9 +1180,9 @@ discard block |
||
| 1180 | 1180 | * @param string $key |
| 1181 | 1181 | * @param string $value |
| 1182 | 1182 | */ |
| 1183 | - public function print_location_enabled_option( $location, $key, $value ) { |
|
| 1183 | + public function print_location_enabled_option($location, $key, $value) { |
|
| 1184 | 1184 | ?> |
| 1185 | - <input type='checkbox' name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]' <?php checked( $value, '1' ); ?> /> |
|
| 1185 | + <input type='checkbox' name='megamenu_meta[<?php echo esc_attr($location); ?>][<?php echo esc_attr($key); ?>]' <?php checked($value, '1'); ?> /> |
|
| 1186 | 1186 | <?php |
| 1187 | 1187 | } |
| 1188 | 1188 | |
@@ -1194,9 +1194,9 @@ discard block |
||
| 1194 | 1194 | * @param string $key |
| 1195 | 1195 | * @param string $value |
| 1196 | 1196 | */ |
| 1197 | - public function print_location_checkbox_option( $location, $key, $value ) { |
|
| 1197 | + public function print_location_checkbox_option($location, $key, $value) { |
|
| 1198 | 1198 | ?> |
| 1199 | - <input type='checkbox' value='true' name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]' <?php checked( $value, 'true' ); ?> /> |
|
| 1199 | + <input type='checkbox' value='true' name='megamenu_meta[<?php echo esc_attr($location); ?>][<?php echo esc_attr($key); ?>]' <?php checked($value, 'true'); ?> /> |
|
| 1200 | 1200 | <?php |
| 1201 | 1201 | } |
| 1202 | 1202 | |
@@ -1208,17 +1208,17 @@ discard block |
||
| 1208 | 1208 | * @param string $key |
| 1209 | 1209 | * @param string $value |
| 1210 | 1210 | */ |
| 1211 | - public function print_active_instance_option( $location, $plugin_settings ) { |
|
| 1211 | + public function print_active_instance_option($location, $plugin_settings) { |
|
| 1212 | 1212 | $active_instance = 0; |
| 1213 | 1213 | |
| 1214 | - if ( isset( $plugin_settings[ $location ]['active_instance'] ) ) { |
|
| 1215 | - $active_instance = $plugin_settings[ $location ]['active_instance']; |
|
| 1216 | - } elseif ( isset( $plugin_settings['instances'][ $location ] ) ) { |
|
| 1217 | - $active_instance = $plugin_settings['instances'][ $location ]; |
|
| 1214 | + if (isset($plugin_settings[$location]['active_instance'])) { |
|
| 1215 | + $active_instance = $plugin_settings[$location]['active_instance']; |
|
| 1216 | + } elseif (isset($plugin_settings['instances'][$location])) { |
|
| 1217 | + $active_instance = $plugin_settings['instances'][$location]; |
|
| 1218 | 1218 | } |
| 1219 | 1219 | |
| 1220 | 1220 | ?> |
| 1221 | - <input type='text' name='megamenu_meta[<?php echo esc_attr( $location ); ?>][active_instance]' value='<?php echo esc_attr( $active_instance ); ?>' /> |
|
| 1221 | + <input type='text' name='megamenu_meta[<?php echo esc_attr($location); ?>][active_instance]' value='<?php echo esc_attr($active_instance); ?>' /> |
|
| 1222 | 1222 | <?php |
| 1223 | 1223 | } |
| 1224 | 1224 | |
@@ -1229,20 +1229,20 @@ discard block |
||
| 1229 | 1229 | * @param string $key |
| 1230 | 1230 | * @param string $value |
| 1231 | 1231 | */ |
| 1232 | - public function print_click_behaviour_option( $location, $plugin_settings ) { |
|
| 1232 | + public function print_click_behaviour_option($location, $plugin_settings) { |
|
| 1233 | 1233 | $second_click = 'go'; |
| 1234 | 1234 | |
| 1235 | - if ( isset( $plugin_settings[ $location ]['second_click'] ) ) { |
|
| 1236 | - $second_click = $plugin_settings[ $location ]['second_click']; |
|
| 1237 | - } elseif ( isset( $plugin_settings['second_click'] ) ) { |
|
| 1235 | + if (isset($plugin_settings[$location]['second_click'])) { |
|
| 1236 | + $second_click = $plugin_settings[$location]['second_click']; |
|
| 1237 | + } elseif (isset($plugin_settings['second_click'])) { |
|
| 1238 | 1238 | $second_click = $plugin_settings['second_click']; |
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | 1241 | ?> |
| 1242 | - <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][second_click]'> |
|
| 1243 | - <option value='close' <?php echo selected( $second_click == 'close' ); ?>><?php _e( 'First click will open the sub menu, second click will close the sub menu.', 'megamenu' ); ?></option> |
|
| 1244 | - <option value='go' <?php echo selected( $second_click == 'go' ); ?>><?php _e( 'First click will open the sub menu, second click will follow the link.', 'megamenu' ); ?></option> |
|
| 1245 | - <option value='disabled' <?php echo selected( $second_click == 'disabled' ); ?>><?php _e( 'First click will follow the link (the arrow must be used to toggle sub menu visiblity).', 'megamenu' ); ?></option> |
|
| 1242 | + <select name='megamenu_meta[<?php echo esc_attr($location); ?>][second_click]'> |
|
| 1243 | + <option value='close' <?php echo selected($second_click == 'close'); ?>><?php _e('First click will open the sub menu, second click will close the sub menu.', 'megamenu'); ?></option> |
|
| 1244 | + <option value='go' <?php echo selected($second_click == 'go'); ?>><?php _e('First click will open the sub menu, second click will follow the link.', 'megamenu'); ?></option> |
|
| 1245 | + <option value='disabled' <?php echo selected($second_click == 'disabled'); ?>><?php _e('First click will follow the link (the arrow must be used to toggle sub menu visiblity).', 'megamenu'); ?></option> |
|
| 1246 | 1246 | <select> |
| 1247 | 1247 | <?php |
| 1248 | 1248 | } |
@@ -1255,19 +1255,19 @@ discard block |
||
| 1255 | 1255 | * @param string $key |
| 1256 | 1256 | * @param string $value |
| 1257 | 1257 | */ |
| 1258 | - public function print_mobile_behaviour_option( $location, $plugin_settings ) { |
|
| 1258 | + public function print_mobile_behaviour_option($location, $plugin_settings) { |
|
| 1259 | 1259 | $mobile_behaviour = 'standard'; |
| 1260 | 1260 | |
| 1261 | - if ( isset( $plugin_settings[ $location ]['mobile_behaviour'] ) ) { |
|
| 1262 | - $mobile_behaviour = $plugin_settings[ $location ]['mobile_behaviour']; |
|
| 1263 | - } elseif ( isset( $plugin_settings['mobile_behaviour'] ) ) { |
|
| 1261 | + if (isset($plugin_settings[$location]['mobile_behaviour'])) { |
|
| 1262 | + $mobile_behaviour = $plugin_settings[$location]['mobile_behaviour']; |
|
| 1263 | + } elseif (isset($plugin_settings['mobile_behaviour'])) { |
|
| 1264 | 1264 | $mobile_behaviour = $plugin_settings['mobile_behaviour']; |
| 1265 | 1265 | } |
| 1266 | 1266 | |
| 1267 | 1267 | ?> |
| 1268 | - <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][mobile_behaviour]'> |
|
| 1269 | - <option value='standard' <?php echo selected( $mobile_behaviour == 'standard' ); ?>><?php _e( 'Standard - Open sub menus will remain open until closed by the user.', 'megamenu' ); ?></option> |
|
| 1270 | - <option value='accordion' <?php echo selected( $mobile_behaviour == 'accordion' ); ?>><?php _e( 'Accordion - Open sub menus will automatically close when another one is opened.', 'megamenu' ); ?></option> |
|
| 1268 | + <select name='megamenu_meta[<?php echo esc_attr($location); ?>][mobile_behaviour]'> |
|
| 1269 | + <option value='standard' <?php echo selected($mobile_behaviour == 'standard'); ?>><?php _e('Standard - Open sub menus will remain open until closed by the user.', 'megamenu'); ?></option> |
|
| 1270 | + <option value='accordion' <?php echo selected($mobile_behaviour == 'accordion'); ?>><?php _e('Accordion - Open sub menus will automatically close when another one is opened.', 'megamenu'); ?></option> |
|
| 1271 | 1271 | <select> |
| 1272 | 1272 | <?php |
| 1273 | 1273 | } |
@@ -1279,18 +1279,18 @@ discard block |
||
| 1279 | 1279 | * @param string $key |
| 1280 | 1280 | * @param string $value |
| 1281 | 1281 | */ |
| 1282 | - public function print_mobile_state_option( $location, $plugin_settings ) { |
|
| 1282 | + public function print_mobile_state_option($location, $plugin_settings) { |
|
| 1283 | 1283 | $mobile_state = 'collapse_all'; |
| 1284 | 1284 | |
| 1285 | - if ( isset( $plugin_settings[ $location ]['mobile_state'] ) ) { |
|
| 1286 | - $mobile_state = $plugin_settings[ $location ]['mobile_state']; |
|
| 1285 | + if (isset($plugin_settings[$location]['mobile_state'])) { |
|
| 1286 | + $mobile_state = $plugin_settings[$location]['mobile_state']; |
|
| 1287 | 1287 | } |
| 1288 | 1288 | |
| 1289 | 1289 | ?> |
| 1290 | - <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][mobile_state]'> |
|
| 1291 | - <option value='collapse_all' <?php echo selected( $mobile_state == 'collapse_all' ); ?>><?php _e( 'Collapse all', 'megamenu' ); ?></option> |
|
| 1292 | - <option value='expand_all' <?php echo selected( $mobile_state == 'expand_all' ); ?>><?php _e( 'Expand all', 'megamenu' ); ?></option> |
|
| 1293 | - <option value='expand_active' <?php echo selected( $mobile_state == 'expand_active' ); ?>><?php _e( 'Expand active parents', 'megamenu' ); ?></option> |
|
| 1290 | + <select name='megamenu_meta[<?php echo esc_attr($location); ?>][mobile_state]'> |
|
| 1291 | + <option value='collapse_all' <?php echo selected($mobile_state == 'collapse_all'); ?>><?php _e('Collapse all', 'megamenu'); ?></option> |
|
| 1292 | + <option value='expand_all' <?php echo selected($mobile_state == 'expand_all'); ?>><?php _e('Expand all', 'megamenu'); ?></option> |
|
| 1293 | + <option value='expand_active' <?php echo selected($mobile_state == 'expand_active'); ?>><?php _e('Expand active parents', 'megamenu'); ?></option> |
|
| 1294 | 1294 | <select> |
| 1295 | 1295 | <?php |
| 1296 | 1296 | } |
@@ -1303,17 +1303,17 @@ discard block |
||
| 1303 | 1303 | * @param string $key |
| 1304 | 1304 | * @param string $value |
| 1305 | 1305 | */ |
| 1306 | - public function print_container_option( $location, $plugin_settings ) { |
|
| 1306 | + public function print_container_option($location, $plugin_settings) { |
|
| 1307 | 1307 | $container = 'div'; |
| 1308 | 1308 | |
| 1309 | - if ( isset( $plugin_settings[ $location ]['container'] ) ) { |
|
| 1310 | - $container = $plugin_settings[ $location ]['container']; |
|
| 1309 | + if (isset($plugin_settings[$location]['container'])) { |
|
| 1310 | + $container = $plugin_settings[$location]['container']; |
|
| 1311 | 1311 | } |
| 1312 | 1312 | |
| 1313 | 1313 | ?> |
| 1314 | - <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][container]'> |
|
| 1315 | - <option value='div' <?php echo selected( $container == 'div' ); ?>><div></option> |
|
| 1316 | - <option value='nav' <?php echo selected( $container == 'nav' ); ?>><nav></option> |
|
| 1314 | + <select name='megamenu_meta[<?php echo esc_attr($location); ?>][container]'> |
|
| 1315 | + <option value='div' <?php echo selected($container == 'div'); ?>><div></option> |
|
| 1316 | + <option value='nav' <?php echo selected($container == 'nav'); ?>><nav></option> |
|
| 1317 | 1317 | <select> |
| 1318 | 1318 | <?php |
| 1319 | 1319 | } |
@@ -1326,18 +1326,18 @@ discard block |
||
| 1326 | 1326 | * @param string $key |
| 1327 | 1327 | * @param string $value |
| 1328 | 1328 | */ |
| 1329 | - public function print_descriptions_option( $location, $plugin_settings ) { |
|
| 1329 | + public function print_descriptions_option($location, $plugin_settings) { |
|
| 1330 | 1330 | $descriptions = 'disabled'; |
| 1331 | 1331 | |
| 1332 | - if ( isset( $plugin_settings[ $location ]['descriptions'] ) ) { |
|
| 1333 | - $descriptions = $plugin_settings[ $location ]['descriptions']; |
|
| 1334 | - } elseif ( isset( $plugin_settings['descriptions'] ) ) { |
|
| 1332 | + if (isset($plugin_settings[$location]['descriptions'])) { |
|
| 1333 | + $descriptions = $plugin_settings[$location]['descriptions']; |
|
| 1334 | + } elseif (isset($plugin_settings['descriptions'])) { |
|
| 1335 | 1335 | $descriptions = $plugin_settings['descriptions']; |
| 1336 | 1336 | } |
| 1337 | 1337 | |
| 1338 | 1338 | ?> |
| 1339 | 1339 | |
| 1340 | - <input type='checkbox' value='enabled' name='megamenu_meta[<?php echo esc_attr( $location ); ?>][descriptions]' <?php checked( $descriptions, 'enabled' ); ?> /> |
|
| 1340 | + <input type='checkbox' value='enabled' name='megamenu_meta[<?php echo esc_attr($location); ?>][descriptions]' <?php checked($descriptions, 'enabled'); ?> /> |
|
| 1341 | 1341 | |
| 1342 | 1342 | <?php |
| 1343 | 1343 | } |
@@ -1350,18 +1350,18 @@ discard block |
||
| 1350 | 1350 | * @param string $key |
| 1351 | 1351 | * @param string $value |
| 1352 | 1352 | */ |
| 1353 | - public function print_prefix_option( $location, $plugin_settings ) { |
|
| 1353 | + public function print_prefix_option($location, $plugin_settings) { |
|
| 1354 | 1354 | $prefix = 'disabled'; |
| 1355 | 1355 | |
| 1356 | - if ( isset( $plugin_settings[ $location ]['prefix'] ) ) { |
|
| 1357 | - $prefix = $plugin_settings[ $location ]['prefix']; |
|
| 1358 | - } elseif ( isset( $plugin_settings['prefix'] ) ) { |
|
| 1356 | + if (isset($plugin_settings[$location]['prefix'])) { |
|
| 1357 | + $prefix = $plugin_settings[$location]['prefix']; |
|
| 1358 | + } elseif (isset($plugin_settings['prefix'])) { |
|
| 1359 | 1359 | $prefix = $plugin_settings['prefix']; |
| 1360 | 1360 | } |
| 1361 | 1361 | |
| 1362 | 1362 | ?> |
| 1363 | 1363 | |
| 1364 | - <input type='checkbox' value='enabled' name='megamenu_meta[<?php echo esc_attr( $location ); ?>][prefix]' <?php checked( $prefix, 'enabled' ); ?> /> |
|
| 1364 | + <input type='checkbox' value='enabled' name='megamenu_meta[<?php echo esc_attr($location); ?>][prefix]' <?php checked($prefix, 'enabled'); ?> /> |
|
| 1365 | 1365 | |
| 1366 | 1366 | <?php |
| 1367 | 1367 | } |
@@ -1374,19 +1374,19 @@ discard block |
||
| 1374 | 1374 | * @param string $key |
| 1375 | 1375 | * @param string $value |
| 1376 | 1376 | */ |
| 1377 | - public function print_unbind_option( $location, $plugin_settings ) { |
|
| 1377 | + public function print_unbind_option($location, $plugin_settings) { |
|
| 1378 | 1378 | |
| 1379 | 1379 | $unbind = 'enabled'; |
| 1380 | 1380 | |
| 1381 | - if ( isset( $plugin_settings[ $location ]['unbind'] ) ) { |
|
| 1382 | - $unbind = $plugin_settings[ $location ]['unbind']; |
|
| 1383 | - } elseif ( isset( $plugin_settings['unbind'] ) ) { |
|
| 1381 | + if (isset($plugin_settings[$location]['unbind'])) { |
|
| 1382 | + $unbind = $plugin_settings[$location]['unbind']; |
|
| 1383 | + } elseif (isset($plugin_settings['unbind'])) { |
|
| 1384 | 1384 | $unbind = $plugin_settings['unbind']; |
| 1385 | 1385 | } |
| 1386 | 1386 | |
| 1387 | 1387 | ?> |
| 1388 | 1388 | |
| 1389 | - <input type='checkbox' value='enabled' name='megamenu_meta[<?php echo esc_attr( $location ); ?>][unbind]' <?php checked( $unbind, 'enabled' ); ?> /> |
|
| 1389 | + <input type='checkbox' value='enabled' name='megamenu_meta[<?php echo esc_attr($location); ?>][unbind]' <?php checked($unbind, 'enabled'); ?> /> |
|
| 1390 | 1390 | |
| 1391 | 1391 | <?php |
| 1392 | 1392 | } |
@@ -1399,23 +1399,23 @@ discard block |
||
| 1399 | 1399 | * @param string $key |
| 1400 | 1400 | * @param string $value |
| 1401 | 1401 | */ |
| 1402 | - public function print_location_event_option( $location, $key, $value ) { |
|
| 1402 | + public function print_location_event_option($location, $key, $value) { |
|
| 1403 | 1403 | |
| 1404 | 1404 | $options = apply_filters( |
| 1405 | 1405 | 'megamenu_event_options', |
| 1406 | 1406 | array( |
| 1407 | - 'hover' => __( 'Hover Intent', 'megamenu' ), |
|
| 1408 | - 'hover_' => __( 'Hover', 'megamenu' ), |
|
| 1409 | - 'click' => __( 'Click', 'megamenu' ), |
|
| 1407 | + 'hover' => __('Hover Intent', 'megamenu'), |
|
| 1408 | + 'hover_' => __('Hover', 'megamenu'), |
|
| 1409 | + 'click' => __('Click', 'megamenu'), |
|
| 1410 | 1410 | ) |
| 1411 | 1411 | ); |
| 1412 | 1412 | |
| 1413 | 1413 | ?> |
| 1414 | - <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]'> |
|
| 1414 | + <select name='megamenu_meta[<?php echo esc_attr($location); ?>][<?php echo esc_attr($key); ?>]'> |
|
| 1415 | 1415 | <?php |
| 1416 | 1416 | |
| 1417 | - foreach ( $options as $type => $name ) { |
|
| 1418 | - echo "<option value='" . esc_attr( $type ) . "' " . selected( $value, $type, false ) . '>' . esc_html( $name ) . '</option>'; |
|
| 1417 | + foreach ($options as $type => $name) { |
|
| 1418 | + echo "<option value='" . esc_attr($type) . "' " . selected($value, $type, false) . '>' . esc_html($name) . '</option>'; |
|
| 1419 | 1419 | } |
| 1420 | 1420 | |
| 1421 | 1421 | echo '</select>'; |
@@ -1429,42 +1429,42 @@ discard block |
||
| 1429 | 1429 | * @param string $key |
| 1430 | 1430 | * @param string $value |
| 1431 | 1431 | */ |
| 1432 | - public function print_location_effect_option( $location, $key, $value ) { |
|
| 1432 | + public function print_location_effect_option($location, $key, $value) { |
|
| 1433 | 1433 | ?> |
| 1434 | - <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]'> |
|
| 1434 | + <select name='megamenu_meta[<?php echo esc_attr($location); ?>][<?php echo esc_attr($key); ?>]'> |
|
| 1435 | 1435 | <?php |
| 1436 | 1436 | |
| 1437 | - $selected = strlen( $value ) ? $value : 'fade_up'; |
|
| 1437 | + $selected = strlen($value) ? $value : 'fade_up'; |
|
| 1438 | 1438 | |
| 1439 | 1439 | $options = apply_filters( |
| 1440 | 1440 | 'megamenu_transition_effects', |
| 1441 | 1441 | array( |
| 1442 | 1442 | 'disabled' => array( |
| 1443 | - 'label' => __( 'None', 'megamenu' ), |
|
| 1443 | + 'label' => __('None', 'megamenu'), |
|
| 1444 | 1444 | 'selected' => $selected == 'disabled', |
| 1445 | 1445 | ), |
| 1446 | 1446 | 'fade' => array( |
| 1447 | - 'label' => __( 'Fade', 'megamenu' ), |
|
| 1447 | + 'label' => __('Fade', 'megamenu'), |
|
| 1448 | 1448 | 'selected' => $selected == 'fade', |
| 1449 | 1449 | ), |
| 1450 | 1450 | 'fade_up' => array( |
| 1451 | - 'label' => __( 'Fade Up', 'megamenu' ), |
|
| 1451 | + 'label' => __('Fade Up', 'megamenu'), |
|
| 1452 | 1452 | 'selected' => $selected == 'fade_up' || $selected == 'fadeUp', |
| 1453 | 1453 | ), |
| 1454 | 1454 | 'slide' => array( |
| 1455 | - 'label' => __( 'Slide', 'megamenu' ), |
|
| 1455 | + 'label' => __('Slide', 'megamenu'), |
|
| 1456 | 1456 | 'selected' => $selected == 'slide', |
| 1457 | 1457 | ), |
| 1458 | 1458 | 'slide_up' => array( |
| 1459 | - 'label' => __( 'Slide Up', 'megamenu' ), |
|
| 1459 | + 'label' => __('Slide Up', 'megamenu'), |
|
| 1460 | 1460 | 'selected' => $selected == 'slide_up', |
| 1461 | 1461 | ), |
| 1462 | 1462 | ), |
| 1463 | 1463 | $selected |
| 1464 | 1464 | ); |
| 1465 | 1465 | |
| 1466 | - foreach ( $options as $key => $value ) { |
|
| 1467 | - echo "<option value='" . esc_attr( $key ) . "' " . selected( $value['selected'] ) . '>' . esc_html( $value['label'] ) . '</option>'; |
|
| 1466 | + foreach ($options as $key => $value) { |
|
| 1467 | + echo "<option value='" . esc_attr($key) . "' " . selected($value['selected']) . '>' . esc_html($value['label']) . '</option>'; |
|
| 1468 | 1468 | } |
| 1469 | 1469 | |
| 1470 | 1470 | echo '</select>'; |
@@ -1479,27 +1479,27 @@ discard block |
||
| 1479 | 1479 | * @param string $key |
| 1480 | 1480 | * @param string $value |
| 1481 | 1481 | */ |
| 1482 | - public function print_location_effect_speed_option( $location, $key, $value ) { |
|
| 1482 | + public function print_location_effect_speed_option($location, $key, $value) { |
|
| 1483 | 1483 | ?> |
| 1484 | - <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]'> |
|
| 1484 | + <select name='megamenu_meta[<?php echo esc_attr($location); ?>][<?php echo esc_attr($key); ?>]'> |
|
| 1485 | 1485 | <?php |
| 1486 | 1486 | |
| 1487 | - $selected = strlen( $value ) ? $value : '200'; |
|
| 1487 | + $selected = strlen($value) ? $value : '200'; |
|
| 1488 | 1488 | |
| 1489 | 1489 | $options = apply_filters( |
| 1490 | 1490 | 'megamenu_effect_speed', |
| 1491 | 1491 | array( |
| 1492 | - '600' => __( 'Slow', 'megamenu' ), |
|
| 1493 | - '400' => __( 'Med', 'megamenu' ), |
|
| 1494 | - '200' => __( 'Fast', 'megamenu' ), |
|
| 1492 | + '600' => __('Slow', 'megamenu'), |
|
| 1493 | + '400' => __('Med', 'megamenu'), |
|
| 1494 | + '200' => __('Fast', 'megamenu'), |
|
| 1495 | 1495 | ), |
| 1496 | 1496 | $selected |
| 1497 | 1497 | ); |
| 1498 | 1498 | |
| 1499 | - ksort( $options ); |
|
| 1499 | + ksort($options); |
|
| 1500 | 1500 | |
| 1501 | - foreach ( $options as $key => $value ) { |
|
| 1502 | - echo "<option value='" . esc_attr( $key ) . "' " . selected( $selected, $key ) . '>' . esc_html( $value ) . '</option>'; |
|
| 1501 | + foreach ($options as $key => $value) { |
|
| 1502 | + echo "<option value='" . esc_attr($key) . "' " . selected($selected, $key) . '>' . esc_html($value) . '</option>'; |
|
| 1503 | 1503 | } |
| 1504 | 1504 | |
| 1505 | 1505 | echo '</select>'; |
@@ -1514,38 +1514,38 @@ discard block |
||
| 1514 | 1514 | * @param string $key |
| 1515 | 1515 | * @param string $value |
| 1516 | 1516 | */ |
| 1517 | - public function print_location_effect_mobile_option( $location, $key, $value ) { |
|
| 1517 | + public function print_location_effect_mobile_option($location, $key, $value) { |
|
| 1518 | 1518 | ?> |
| 1519 | - <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]'> |
|
| 1519 | + <select name='megamenu_meta[<?php echo esc_attr($location); ?>][<?php echo esc_attr($key); ?>]'> |
|
| 1520 | 1520 | <?php |
| 1521 | 1521 | |
| 1522 | - $selected = strlen( $value ) ? $value : 'disabled'; |
|
| 1522 | + $selected = strlen($value) ? $value : 'disabled'; |
|
| 1523 | 1523 | |
| 1524 | 1524 | $options = apply_filters( |
| 1525 | 1525 | 'megamenu_transition_effects_mobile', |
| 1526 | 1526 | array( |
| 1527 | 1527 | 'disabled' => array( |
| 1528 | - 'label' => __( 'None', 'megamenu' ), |
|
| 1528 | + 'label' => __('None', 'megamenu'), |
|
| 1529 | 1529 | 'selected' => $selected == 'disabled', |
| 1530 | 1530 | ), |
| 1531 | 1531 | 'slide' => array( |
| 1532 | - 'label' => __( 'Slide Down', 'megamenu' ), |
|
| 1532 | + 'label' => __('Slide Down', 'megamenu'), |
|
| 1533 | 1533 | 'selected' => $selected == 'slide', |
| 1534 | 1534 | ), |
| 1535 | 1535 | 'slide_left' => array( |
| 1536 | - 'label' => __( 'Slide Left (Off Canvas)', 'megamenu' ), |
|
| 1536 | + 'label' => __('Slide Left (Off Canvas)', 'megamenu'), |
|
| 1537 | 1537 | 'selected' => $selected == 'slide_left', |
| 1538 | 1538 | ), |
| 1539 | 1539 | 'slide_right' => array( |
| 1540 | - 'label' => __( 'Slide Right (Off Canvas)', 'megamenu' ), |
|
| 1540 | + 'label' => __('Slide Right (Off Canvas)', 'megamenu'), |
|
| 1541 | 1541 | 'selected' => $selected == 'slide_right', |
| 1542 | 1542 | ), |
| 1543 | 1543 | ), |
| 1544 | 1544 | $selected |
| 1545 | 1545 | ); |
| 1546 | 1546 | |
| 1547 | - foreach ( $options as $key => $value ) { |
|
| 1548 | - echo "<option value='" . esc_attr( $key ) . "' " . selected( $value['selected'] ) . '>' . esc_html( $value['label'] ) . '</option>'; |
|
| 1547 | + foreach ($options as $key => $value) { |
|
| 1548 | + echo "<option value='" . esc_attr($key) . "' " . selected($value['selected']) . '>' . esc_html($value['label']) . '</option>'; |
|
| 1549 | 1549 | } |
| 1550 | 1550 | |
| 1551 | 1551 | echo '</select>'; |
@@ -1560,27 +1560,27 @@ discard block |
||
| 1560 | 1560 | * @param string $key |
| 1561 | 1561 | * @param string $value |
| 1562 | 1562 | */ |
| 1563 | - public function print_location_effect_speed_mobile_option( $location, $key, $value ) { |
|
| 1563 | + public function print_location_effect_speed_mobile_option($location, $key, $value) { |
|
| 1564 | 1564 | ?> |
| 1565 | - <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]'> |
|
| 1565 | + <select name='megamenu_meta[<?php echo esc_attr($location); ?>][<?php echo esc_attr($key); ?>]'> |
|
| 1566 | 1566 | <?php |
| 1567 | 1567 | |
| 1568 | - $selected = strlen( $value ) ? $value : '200'; |
|
| 1568 | + $selected = strlen($value) ? $value : '200'; |
|
| 1569 | 1569 | |
| 1570 | 1570 | $options = apply_filters( |
| 1571 | 1571 | 'megamenu_effect_speed_mobile', |
| 1572 | 1572 | array( |
| 1573 | - '600' => __( 'Slow', 'megamenu' ), |
|
| 1574 | - '400' => __( 'Med', 'megamenu' ), |
|
| 1575 | - '200' => __( 'Fast', 'megamenu' ), |
|
| 1573 | + '600' => __('Slow', 'megamenu'), |
|
| 1574 | + '400' => __('Med', 'megamenu'), |
|
| 1575 | + '200' => __('Fast', 'megamenu'), |
|
| 1576 | 1576 | ), |
| 1577 | 1577 | $selected |
| 1578 | 1578 | ); |
| 1579 | 1579 | |
| 1580 | - ksort( $options ); |
|
| 1580 | + ksort($options); |
|
| 1581 | 1581 | |
| 1582 | - foreach ( $options as $key => $value ) { |
|
| 1583 | - echo "<option value='" . esc_attr( $key ) . "' " . selected( $selected, $key ) . '>' . esc_html( $value ) . '</option>'; |
|
| 1582 | + foreach ($options as $key => $value) { |
|
| 1583 | + echo "<option value='" . esc_attr($key) . "' " . selected($selected, $key) . '>' . esc_html($value) . '</option>'; |
|
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | 1586 | echo '</select>'; |
@@ -1595,27 +1595,27 @@ discard block |
||
| 1595 | 1595 | * @param string $key |
| 1596 | 1596 | * @param string $value |
| 1597 | 1597 | */ |
| 1598 | - public function print_location_theme_selector_option( $location, $key, $value ) { |
|
| 1598 | + public function print_location_theme_selector_option($location, $key, $value) { |
|
| 1599 | 1599 | ?> |
| 1600 | - <select name='megamenu_meta[<?php echo esc_attr( $location ); ?>][<?php echo esc_attr( $key ); ?>]'> |
|
| 1600 | + <select name='megamenu_meta[<?php echo esc_attr($location); ?>][<?php echo esc_attr($key); ?>]'> |
|
| 1601 | 1601 | <?php |
| 1602 | 1602 | |
| 1603 | 1603 | $style_manager = new Mega_Menu_Style_Manager(); |
| 1604 | 1604 | $themes = $style_manager->get_themes(); |
| 1605 | - $selected_theme = strlen( $value ) ? $value : 'default'; |
|
| 1605 | + $selected_theme = strlen($value) ? $value : 'default'; |
|
| 1606 | 1606 | |
| 1607 | - foreach ( $themes as $key => $theme ) { |
|
| 1607 | + foreach ($themes as $key => $theme) { |
|
| 1608 | 1608 | $edit_theme_url = esc_url( |
| 1609 | 1609 | add_query_arg( |
| 1610 | 1610 | array( |
| 1611 | 1611 | 'page' => 'maxmegamenu_theme_editor', |
| 1612 | 1612 | 'theme' => $key, |
| 1613 | 1613 | ), |
| 1614 | - admin_url( 'admin.php' ) |
|
| 1614 | + admin_url('admin.php') |
|
| 1615 | 1615 | ) |
| 1616 | 1616 | ); |
| 1617 | 1617 | |
| 1618 | - echo "<option data-url='" . esc_attr($edit_theme_url) . "' value='" . esc_attr( $key ) . "' " . selected( $selected_theme, $key ) . '>' . esc_html( $theme['title'] ) . '</option>'; |
|
| 1618 | + echo "<option data-url='" . esc_attr($edit_theme_url) . "' value='" . esc_attr($key) . "' " . selected($selected_theme, $key) . '>' . esc_html($theme['title']) . '</option>'; |
|
| 1619 | 1619 | } |
| 1620 | 1620 | |
| 1621 | 1621 | echo '</select>'; |
@@ -1631,9 +1631,9 @@ discard block |
||
| 1631 | 1631 | * @param string $key |
| 1632 | 1632 | * @param string $value |
| 1633 | 1633 | */ |
| 1634 | - public function print_location_php_function_option( $location, $value ) { |
|
| 1634 | + public function print_location_php_function_option($location, $value) { |
|
| 1635 | 1635 | ?> |
| 1636 | - <textarea readonly="readonly"><?php wp_nav_menu( array( 'theme_location' => '<?php echo esc_attr( $value ); ?>' ) ); ?></textarea> |
|
| 1636 | + <textarea readonly="readonly"><?php wp_nav_menu( array( 'theme_location' => '<?php echo esc_attr($value); ?>' ) ); ?></textarea> |
|
| 1637 | 1637 | <?php |
| 1638 | 1638 | } |
| 1639 | 1639 | |
@@ -1645,9 +1645,9 @@ discard block |
||
| 1645 | 1645 | * @param string $key |
| 1646 | 1646 | * @param string $value |
| 1647 | 1647 | */ |
| 1648 | - public function print_location_shortcode_option( $location, $value ) { |
|
| 1648 | + public function print_location_shortcode_option($location, $value) { |
|
| 1649 | 1649 | ?> |
| 1650 | - <textarea readonly="readonly">[maxmegamenu location=<?php echo esc_attr( $value ); ?>]</textarea> |
|
| 1650 | + <textarea readonly="readonly">[maxmegamenu location=<?php echo esc_attr($value); ?>]</textarea> |
|
| 1651 | 1651 | <?php |
| 1652 | 1652 | } |
| 1653 | 1653 | |
@@ -1659,9 +1659,9 @@ discard block |
||
| 1659 | 1659 | * @param string $key |
| 1660 | 1660 | * @param string $value |
| 1661 | 1661 | */ |
| 1662 | - public function print_location_widget_option( $location, $value ) { |
|
| 1662 | + public function print_location_widget_option($location, $value) { |
|
| 1663 | 1663 | ?> |
| 1664 | - <textarea readonly="readonly"><?php _e( "Add the 'Max Mega Menu' widget to a widget area.", 'megamenu' ); ?></textarea> |
|
| 1664 | + <textarea readonly="readonly"><?php _e("Add the 'Max Mega Menu' widget to a widget area.", 'megamenu'); ?></textarea> |
|
| 1665 | 1665 | <?php |
| 1666 | 1666 | } |
| 1667 | 1667 | |
@@ -1673,8 +1673,8 @@ discard block |
||
| 1673 | 1673 | * @param string $key |
| 1674 | 1674 | * @param string $value |
| 1675 | 1675 | */ |
| 1676 | - public function print_location_freetext_option( $location, $key, $value ) { |
|
| 1677 | - echo "<input class='" . esc_attr( 'mega-setting-' . $key ) . "' type='text' name='megamenu_meta[$location][$key]' value='" . esc_attr( $value ) . "' />"; |
|
| 1676 | + public function print_location_freetext_option($location, $key, $value) { |
|
| 1677 | + echo "<input class='" . esc_attr('mega-setting-' . $key) . "' type='text' name='megamenu_meta[$location][$key]' value='" . esc_attr($value) . "' />"; |
|
| 1678 | 1678 | } |
| 1679 | 1679 | |
| 1680 | 1680 | |
@@ -1685,8 +1685,8 @@ discard block |
||
| 1685 | 1685 | * @param string $key |
| 1686 | 1686 | * @param string $value |
| 1687 | 1687 | */ |
| 1688 | - public function print_location_description_option( $location, $key, $value ) { |
|
| 1689 | - echo "<input class='" . esc_attr( 'mega-setting-' . $key ) . " wide' type='text' name='custom_location[$location]' value='" . esc_attr( $value ) . "' />"; |
|
| 1688 | + public function print_location_description_option($location, $key, $value) { |
|
| 1689 | + echo "<input class='" . esc_attr('mega-setting-' . $key) . " wide' type='text' name='custom_location[$location]' value='" . esc_attr($value) . "' />"; |
|
| 1690 | 1690 | } |
| 1691 | 1691 | |
| 1692 | 1692 | |
@@ -1698,8 +1698,8 @@ discard block |
||
| 1698 | 1698 | * @param array $elem2 |
| 1699 | 1699 | * @return bool |
| 1700 | 1700 | */ |
| 1701 | - private function compare_elems( $elem1, $elem2 ) { |
|
| 1702 | - if ( $elem1['priority'] > $elem2['priority'] ) { |
|
| 1701 | + private function compare_elems($elem1, $elem2) { |
|
| 1702 | + if ($elem1['priority'] > $elem2['priority']) { |
|
| 1703 | 1703 | return 1; |
| 1704 | 1704 | } |
| 1705 | 1705 | |
@@ -1,227 +1,227 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | - exit; // disable direct access |
|
| 4 | + exit; // disable direct access |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | if ( ! class_exists( 'Mega_Menu_Walker' ) ) : |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * @package WordPress |
|
| 11 | - * @since 1.0.0 |
|
| 12 | - * @uses Walker |
|
| 13 | - */ |
|
| 14 | - class Mega_Menu_Walker extends Walker_Nav_Menu { |
|
| 15 | - |
|
| 16 | - |
|
| 17 | - /** |
|
| 18 | - * Starts the list before the elements are added. |
|
| 19 | - * |
|
| 20 | - * @see Walker::start_lvl() |
|
| 21 | - * |
|
| 22 | - * @since 1.0 |
|
| 23 | - * |
|
| 24 | - * @param string $output Passed by reference. Used to append additional content. |
|
| 25 | - * @param int $depth Depth of menu item. Used for padding. |
|
| 26 | - * @param array $args An array of arguments. @see wp_nav_menu() |
|
| 27 | - */ |
|
| 28 | - function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
| 29 | - |
|
| 30 | - $indent = str_repeat( "\t", $depth ); |
|
| 31 | - |
|
| 32 | - $output .= "\n$indent<ul class=\"mega-sub-menu\">\n"; |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * Ends the list of after the elements are added. |
|
| 37 | - * |
|
| 38 | - * @see Walker::end_lvl() |
|
| 39 | - * |
|
| 40 | - * @since 1.0 |
|
| 41 | - * |
|
| 42 | - * @param string $output Passed by reference. Used to append additional content. |
|
| 43 | - * @param int $depth Depth of menu item. Used for padding. |
|
| 44 | - * @param array $args An array of arguments. @see wp_nav_menu() |
|
| 45 | - */ |
|
| 46 | - function end_lvl( &$output, $depth = 0, $args = array() ) { |
|
| 47 | - $indent = str_repeat( "\t", $depth ); |
|
| 48 | - $output .= "$indent</ul>\n"; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * Custom walker. Add the widgets into the menu. |
|
| 53 | - * |
|
| 54 | - * @see Walker::start_el() |
|
| 55 | - * |
|
| 56 | - * @since 1.0 |
|
| 57 | - * |
|
| 58 | - * @param string $output Passed by reference. Used to append additional content. |
|
| 59 | - * @param object $item Menu item data object. |
|
| 60 | - * @param int $depth Depth of menu item. Used for padding. |
|
| 61 | - * @param array $args An array of arguments. @see wp_nav_menu() |
|
| 62 | - * @param int $id Current item ID. |
|
| 63 | - */ |
|
| 64 | - function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
| 65 | - |
|
| 66 | - $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; |
|
| 67 | - |
|
| 68 | - if ( property_exists( $item, 'megamenu_settings' ) ) { |
|
| 69 | - $settings = $item->megamenu_settings; |
|
| 70 | - } else { |
|
| 71 | - $settings = Mega_Menu_Nav_Menus::get_menu_item_defaults(); |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - // Item Class |
|
| 75 | - $classes = empty( $item->classes ) ? array() : (array) $item->classes; |
|
| 76 | - |
|
| 77 | - if ( is_array( $classes ) && ! in_array( 'menu-column', $classes ) && ! in_array( 'menu-row', $classes ) ) { |
|
| 78 | - $classes[] = 'menu-item-' . $item->ID; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - $class = join( ' ', apply_filters( 'megamenu_nav_menu_css_class', array_filter( $classes ), $item, $args ) ); |
|
| 82 | - |
|
| 83 | - // these classes are prepended with 'mega-' |
|
| 84 | - $mega_classes = explode( ' ', $class ); |
|
| 85 | - |
|
| 86 | - // strip widget classes back to how they're intended to be output |
|
| 87 | - $class = str_replace( 'mega-menu-widget-class-', '', $class ); |
|
| 88 | - |
|
| 89 | - // Item ID |
|
| 90 | - if ( is_array( $classes ) && ! in_array( 'menu-column', $classes ) && ! in_array( 'menu-row', $classes ) ) { |
|
| 91 | - $id = "mega-menu-item-{$item->ID}"; |
|
| 92 | - } else { |
|
| 93 | - $id = "mega-menu-{$item->ID}"; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - $id = esc_attr( apply_filters( 'megamenu_nav_menu_item_id', $id, $item, $args ) ); |
|
| 97 | - |
|
| 98 | - $output .= "<li class='{$class}' id='{$id}'>"; |
|
| 99 | - |
|
| 100 | - // output the widgets |
|
| 101 | - if ( $item->type == 'widget' ) { |
|
| 102 | - |
|
| 103 | - if ( $item->content ) { |
|
| 104 | - $item_output = $item->content; |
|
| 105 | - } else { |
|
| 106 | - $item_output = "<!-- widget is empty -->"; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - //} else if ( 'block' === $item->type ) { |
|
| 110 | - // /** This filter is documented in wp-includes/post-template.php */ |
|
| 111 | - // $item_output = apply_filters( 'the_content', $item->content ); |
|
| 112 | - } else { |
|
| 113 | - |
|
| 114 | - $atts = array(); |
|
| 115 | - |
|
| 116 | - $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : ''; |
|
| 117 | - $atts['target'] = ! empty( $item->target ) ? $item->target : ''; |
|
| 118 | - $atts['class'] = ''; |
|
| 119 | - $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; |
|
| 120 | - |
|
| 121 | - if ( isset( $settings['disable_link'] ) && $settings['disable_link'] != 'true' ) { |
|
| 122 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 123 | - } else { |
|
| 124 | - $atts['tabindex'] = 0; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - if ( isset( $settings['icon'] ) && $settings['icon'] != 'disabled' && $settings['icon'] != 'custom' ) { |
|
| 128 | - $atts['class'] = $settings['icon']; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - if ( isset( $settings['icon'] ) && $settings['icon'] == 'custom' ) { |
|
| 132 | - $atts['class'] = 'mega-custom-icon'; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - if ( is_array( $classes ) && in_array( 'menu-item-has-children', $classes ) && $item->parent_submenu_type == 'flyout' ) { |
|
| 136 | - |
|
| 137 | - $atts['aria-haspopup'] = 'true'; // required for Surface/Win10/Edge |
|
| 138 | - $atts['aria-expanded'] = 'false'; |
|
| 139 | - |
|
| 140 | - if ( is_array( $mega_classes ) && in_array( 'mega-toggle-on', $mega_classes ) ) { |
|
| 141 | - $atts['aria-expanded'] = 'true'; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - if ( isset( $settings['disable_link'] ) && $settings['disable_link'] == 'true' ) { |
|
| 145 | - $atts['role'] = 'button'; |
|
| 146 | - } |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - if ( $depth == 0 ) { |
|
| 150 | - $atts['tabindex'] = '0'; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - if ( isset( $settings['hide_text'] ) && $settings['hide_text'] == 'true' ) { |
|
| 154 | - $atts['aria-label'] = $item->title; |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - $atts = apply_filters( 'megamenu_nav_menu_link_attributes', $atts, $item, $args ); |
|
| 9 | + /** |
|
| 10 | + * @package WordPress |
|
| 11 | + * @since 1.0.0 |
|
| 12 | + * @uses Walker |
|
| 13 | + */ |
|
| 14 | + class Mega_Menu_Walker extends Walker_Nav_Menu { |
|
| 15 | + |
|
| 16 | + |
|
| 17 | + /** |
|
| 18 | + * Starts the list before the elements are added. |
|
| 19 | + * |
|
| 20 | + * @see Walker::start_lvl() |
|
| 21 | + * |
|
| 22 | + * @since 1.0 |
|
| 23 | + * |
|
| 24 | + * @param string $output Passed by reference. Used to append additional content. |
|
| 25 | + * @param int $depth Depth of menu item. Used for padding. |
|
| 26 | + * @param array $args An array of arguments. @see wp_nav_menu() |
|
| 27 | + */ |
|
| 28 | + function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
| 29 | + |
|
| 30 | + $indent = str_repeat( "\t", $depth ); |
|
| 31 | + |
|
| 32 | + $output .= "\n$indent<ul class=\"mega-sub-menu\">\n"; |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * Ends the list of after the elements are added. |
|
| 37 | + * |
|
| 38 | + * @see Walker::end_lvl() |
|
| 39 | + * |
|
| 40 | + * @since 1.0 |
|
| 41 | + * |
|
| 42 | + * @param string $output Passed by reference. Used to append additional content. |
|
| 43 | + * @param int $depth Depth of menu item. Used for padding. |
|
| 44 | + * @param array $args An array of arguments. @see wp_nav_menu() |
|
| 45 | + */ |
|
| 46 | + function end_lvl( &$output, $depth = 0, $args = array() ) { |
|
| 47 | + $indent = str_repeat( "\t", $depth ); |
|
| 48 | + $output .= "$indent</ul>\n"; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * Custom walker. Add the widgets into the menu. |
|
| 53 | + * |
|
| 54 | + * @see Walker::start_el() |
|
| 55 | + * |
|
| 56 | + * @since 1.0 |
|
| 57 | + * |
|
| 58 | + * @param string $output Passed by reference. Used to append additional content. |
|
| 59 | + * @param object $item Menu item data object. |
|
| 60 | + * @param int $depth Depth of menu item. Used for padding. |
|
| 61 | + * @param array $args An array of arguments. @see wp_nav_menu() |
|
| 62 | + * @param int $id Current item ID. |
|
| 63 | + */ |
|
| 64 | + function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
| 65 | + |
|
| 66 | + $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; |
|
| 67 | + |
|
| 68 | + if ( property_exists( $item, 'megamenu_settings' ) ) { |
|
| 69 | + $settings = $item->megamenu_settings; |
|
| 70 | + } else { |
|
| 71 | + $settings = Mega_Menu_Nav_Menus::get_menu_item_defaults(); |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + // Item Class |
|
| 75 | + $classes = empty( $item->classes ) ? array() : (array) $item->classes; |
|
| 76 | + |
|
| 77 | + if ( is_array( $classes ) && ! in_array( 'menu-column', $classes ) && ! in_array( 'menu-row', $classes ) ) { |
|
| 78 | + $classes[] = 'menu-item-' . $item->ID; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + $class = join( ' ', apply_filters( 'megamenu_nav_menu_css_class', array_filter( $classes ), $item, $args ) ); |
|
| 82 | + |
|
| 83 | + // these classes are prepended with 'mega-' |
|
| 84 | + $mega_classes = explode( ' ', $class ); |
|
| 85 | + |
|
| 86 | + // strip widget classes back to how they're intended to be output |
|
| 87 | + $class = str_replace( 'mega-menu-widget-class-', '', $class ); |
|
| 88 | + |
|
| 89 | + // Item ID |
|
| 90 | + if ( is_array( $classes ) && ! in_array( 'menu-column', $classes ) && ! in_array( 'menu-row', $classes ) ) { |
|
| 91 | + $id = "mega-menu-item-{$item->ID}"; |
|
| 92 | + } else { |
|
| 93 | + $id = "mega-menu-{$item->ID}"; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + $id = esc_attr( apply_filters( 'megamenu_nav_menu_item_id', $id, $item, $args ) ); |
|
| 97 | + |
|
| 98 | + $output .= "<li class='{$class}' id='{$id}'>"; |
|
| 99 | + |
|
| 100 | + // output the widgets |
|
| 101 | + if ( $item->type == 'widget' ) { |
|
| 102 | + |
|
| 103 | + if ( $item->content ) { |
|
| 104 | + $item_output = $item->content; |
|
| 105 | + } else { |
|
| 106 | + $item_output = "<!-- widget is empty -->"; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + //} else if ( 'block' === $item->type ) { |
|
| 110 | + // /** This filter is documented in wp-includes/post-template.php */ |
|
| 111 | + // $item_output = apply_filters( 'the_content', $item->content ); |
|
| 112 | + } else { |
|
| 113 | + |
|
| 114 | + $atts = array(); |
|
| 115 | + |
|
| 116 | + $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : ''; |
|
| 117 | + $atts['target'] = ! empty( $item->target ) ? $item->target : ''; |
|
| 118 | + $atts['class'] = ''; |
|
| 119 | + $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; |
|
| 120 | + |
|
| 121 | + if ( isset( $settings['disable_link'] ) && $settings['disable_link'] != 'true' ) { |
|
| 122 | + $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 123 | + } else { |
|
| 124 | + $atts['tabindex'] = 0; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + if ( isset( $settings['icon'] ) && $settings['icon'] != 'disabled' && $settings['icon'] != 'custom' ) { |
|
| 128 | + $atts['class'] = $settings['icon']; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + if ( isset( $settings['icon'] ) && $settings['icon'] == 'custom' ) { |
|
| 132 | + $atts['class'] = 'mega-custom-icon'; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + if ( is_array( $classes ) && in_array( 'menu-item-has-children', $classes ) && $item->parent_submenu_type == 'flyout' ) { |
|
| 136 | + |
|
| 137 | + $atts['aria-haspopup'] = 'true'; // required for Surface/Win10/Edge |
|
| 138 | + $atts['aria-expanded'] = 'false'; |
|
| 139 | + |
|
| 140 | + if ( is_array( $mega_classes ) && in_array( 'mega-toggle-on', $mega_classes ) ) { |
|
| 141 | + $atts['aria-expanded'] = 'true'; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + if ( isset( $settings['disable_link'] ) && $settings['disable_link'] == 'true' ) { |
|
| 145 | + $atts['role'] = 'button'; |
|
| 146 | + } |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + if ( $depth == 0 ) { |
|
| 150 | + $atts['tabindex'] = '0'; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + if ( isset( $settings['hide_text'] ) && $settings['hide_text'] == 'true' ) { |
|
| 154 | + $atts['aria-label'] = $item->title; |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + $atts = apply_filters( 'megamenu_nav_menu_link_attributes', $atts, $item, $args ); |
|
| 158 | 158 | |
| 159 | - if ( isset( $atts['class'] ) && strlen( $atts['class'] ) ) { |
|
| 160 | - $atts['class'] = $atts['class'] . ' mega-menu-link'; |
|
| 161 | - } else { |
|
| 162 | - $atts['class'] = 'mega-menu-link'; |
|
| 163 | - } |
|
| 159 | + if ( isset( $atts['class'] ) && strlen( $atts['class'] ) ) { |
|
| 160 | + $atts['class'] = $atts['class'] . ' mega-menu-link'; |
|
| 161 | + } else { |
|
| 162 | + $atts['class'] = 'mega-menu-link'; |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - $attributes = ''; |
|
| 165 | + $attributes = ''; |
|
| 166 | 166 | |
| 167 | - foreach ( $atts as $attr => $value ) { |
|
| 168 | - if ( strlen( $value ) ) { |
|
| 169 | - $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
|
| 170 | - $attributes .= ' ' . $attr . '="' . $value . '"'; |
|
| 171 | - } |
|
| 172 | - } |
|
| 167 | + foreach ( $atts as $attr => $value ) { |
|
| 168 | + if ( strlen( $value ) ) { |
|
| 169 | + $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
|
| 170 | + $attributes .= ' ' . $attr . '="' . $value . '"'; |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | - $item_output = $args->before; |
|
| 175 | - $item_output .= '<a' . $attributes . '>'; |
|
| 174 | + $item_output = $args->before; |
|
| 175 | + $item_output .= '<a' . $attributes . '>'; |
|
| 176 | 176 | |
| 177 | - if ( is_array( $classes ) && in_array( 'icon-top', $classes ) ) { |
|
| 178 | - $item_output .= "<span class='mega-title-below'>"; |
|
| 179 | - } |
|
| 177 | + if ( is_array( $classes ) && in_array( 'icon-top', $classes ) ) { |
|
| 178 | + $item_output .= "<span class='mega-title-below'>"; |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - if ( isset( $settings['hide_text'] ) && $settings['hide_text'] == 'true' ) { |
|
| 182 | - /** |
|
| 183 | - * This filter is documented in wp-includes/post-template.php |
|
| 181 | + if ( isset( $settings['hide_text'] ) && $settings['hide_text'] == 'true' ) { |
|
| 182 | + /** |
|
| 183 | + * This filter is documented in wp-includes/post-template.php |
|
| 184 | 184 | */ |
| 185 | - } elseif ( property_exists( $item, 'mega_description' ) && strlen( $item->mega_description ) ) { |
|
| 186 | - $item_output .= '<span class="mega-description-group"><span class="mega-menu-title">' . $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after . '</span><span class="mega-menu-description">' . $item->description . '</span></span>'; |
|
| 187 | - } else { |
|
| 188 | - $item_output .= $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after; |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - if ( is_array( $classes ) && in_array( 'icon-top', $classes ) ) { |
|
| 192 | - $item_output .= '</span>'; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - if ( is_array( $classes ) && in_array( 'menu-item-has-children', $classes ) ) { |
|
| 196 | - $item_output .= '<span class="mega-indicator"></span>'; |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - $item_output .= '</a>'; |
|
| 200 | - $item_output .= $args->after; |
|
| 201 | - |
|
| 202 | - if ( is_array( $classes ) && ( in_array( 'menu-column', $classes ) || in_array( 'menu-row', $classes ) ) ) { |
|
| 203 | - $item_output = ''; |
|
| 204 | - } |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - $output .= apply_filters( 'megamenu_walker_nav_menu_start_el', $item_output, $item, $depth, $args ); |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - /** |
|
| 211 | - * Ends the element output, if needed. |
|
| 212 | - * |
|
| 213 | - * @see Walker::end_el() |
|
| 214 | - * |
|
| 215 | - * @since 1.7 |
|
| 216 | - * |
|
| 217 | - * @param string $output Passed by reference. Used to append additional content. |
|
| 218 | - * @param object $item Page data object. Not used. |
|
| 219 | - * @param int $depth Depth of page. Not Used. |
|
| 220 | - * @param array $args An array of arguments. @see wp_nav_menu() |
|
| 221 | - */ |
|
| 222 | - public function end_el( &$output, $item, $depth = 0, $args = array() ) { |
|
| 223 | - $output .= '</li>'; // remove new line to remove the 4px gap between menu items |
|
| 224 | - } |
|
| 225 | - } |
|
| 185 | + } elseif ( property_exists( $item, 'mega_description' ) && strlen( $item->mega_description ) ) { |
|
| 186 | + $item_output .= '<span class="mega-description-group"><span class="mega-menu-title">' . $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after . '</span><span class="mega-menu-description">' . $item->description . '</span></span>'; |
|
| 187 | + } else { |
|
| 188 | + $item_output .= $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after; |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + if ( is_array( $classes ) && in_array( 'icon-top', $classes ) ) { |
|
| 192 | + $item_output .= '</span>'; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + if ( is_array( $classes ) && in_array( 'menu-item-has-children', $classes ) ) { |
|
| 196 | + $item_output .= '<span class="mega-indicator"></span>'; |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + $item_output .= '</a>'; |
|
| 200 | + $item_output .= $args->after; |
|
| 201 | + |
|
| 202 | + if ( is_array( $classes ) && ( in_array( 'menu-column', $classes ) || in_array( 'menu-row', $classes ) ) ) { |
|
| 203 | + $item_output = ''; |
|
| 204 | + } |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + $output .= apply_filters( 'megamenu_walker_nav_menu_start_el', $item_output, $item, $depth, $args ); |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + /** |
|
| 211 | + * Ends the element output, if needed. |
|
| 212 | + * |
|
| 213 | + * @see Walker::end_el() |
|
| 214 | + * |
|
| 215 | + * @since 1.7 |
|
| 216 | + * |
|
| 217 | + * @param string $output Passed by reference. Used to append additional content. |
|
| 218 | + * @param object $item Page data object. Not used. |
|
| 219 | + * @param int $depth Depth of page. Not Used. |
|
| 220 | + * @param array $args An array of arguments. @see wp_nav_menu() |
|
| 221 | + */ |
|
| 222 | + public function end_el( &$output, $item, $depth = 0, $args = array() ) { |
|
| 223 | + $output .= '</li>'; // remove new line to remove the 4px gap between menu items |
|
| 224 | + } |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | 227 | endif; |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | 4 | exit; // disable direct access |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if ( ! class_exists( 'Mega_Menu_Walker' ) ) : |
|
| 7 | +if (!class_exists('Mega_Menu_Walker')) : |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * @package WordPress |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | * @param int $depth Depth of menu item. Used for padding. |
| 26 | 26 | * @param array $args An array of arguments. @see wp_nav_menu() |
| 27 | 27 | */ |
| 28 | - function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
| 28 | + function start_lvl(&$output, $depth = 0, $args = array()) { |
|
| 29 | 29 | |
| 30 | - $indent = str_repeat( "\t", $depth ); |
|
| 30 | + $indent = str_repeat("\t", $depth); |
|
| 31 | 31 | |
| 32 | 32 | $output .= "\n$indent<ul class=\"mega-sub-menu\">\n"; |
| 33 | 33 | } |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | * @param int $depth Depth of menu item. Used for padding. |
| 44 | 44 | * @param array $args An array of arguments. @see wp_nav_menu() |
| 45 | 45 | */ |
| 46 | - function end_lvl( &$output, $depth = 0, $args = array() ) { |
|
| 47 | - $indent = str_repeat( "\t", $depth ); |
|
| 46 | + function end_lvl(&$output, $depth = 0, $args = array()) { |
|
| 47 | + $indent = str_repeat("\t", $depth); |
|
| 48 | 48 | $output .= "$indent</ul>\n"; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -61,46 +61,46 @@ discard block |
||
| 61 | 61 | * @param array $args An array of arguments. @see wp_nav_menu() |
| 62 | 62 | * @param int $id Current item ID. |
| 63 | 63 | */ |
| 64 | - function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
| 64 | + function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { |
|
| 65 | 65 | |
| 66 | - $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; |
|
| 66 | + $indent = ($depth) ? str_repeat("\t", $depth) : ''; |
|
| 67 | 67 | |
| 68 | - if ( property_exists( $item, 'megamenu_settings' ) ) { |
|
| 68 | + if (property_exists($item, 'megamenu_settings')) { |
|
| 69 | 69 | $settings = $item->megamenu_settings; |
| 70 | 70 | } else { |
| 71 | 71 | $settings = Mega_Menu_Nav_Menus::get_menu_item_defaults(); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Item Class |
| 75 | - $classes = empty( $item->classes ) ? array() : (array) $item->classes; |
|
| 75 | + $classes = empty($item->classes) ? array() : (array) $item->classes; |
|
| 76 | 76 | |
| 77 | - if ( is_array( $classes ) && ! in_array( 'menu-column', $classes ) && ! in_array( 'menu-row', $classes ) ) { |
|
| 77 | + if (is_array($classes) && !in_array('menu-column', $classes) && !in_array('menu-row', $classes)) { |
|
| 78 | 78 | $classes[] = 'menu-item-' . $item->ID; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $class = join( ' ', apply_filters( 'megamenu_nav_menu_css_class', array_filter( $classes ), $item, $args ) ); |
|
| 81 | + $class = join(' ', apply_filters('megamenu_nav_menu_css_class', array_filter($classes), $item, $args)); |
|
| 82 | 82 | |
| 83 | 83 | // these classes are prepended with 'mega-' |
| 84 | - $mega_classes = explode( ' ', $class ); |
|
| 84 | + $mega_classes = explode(' ', $class); |
|
| 85 | 85 | |
| 86 | 86 | // strip widget classes back to how they're intended to be output |
| 87 | - $class = str_replace( 'mega-menu-widget-class-', '', $class ); |
|
| 87 | + $class = str_replace('mega-menu-widget-class-', '', $class); |
|
| 88 | 88 | |
| 89 | 89 | // Item ID |
| 90 | - if ( is_array( $classes ) && ! in_array( 'menu-column', $classes ) && ! in_array( 'menu-row', $classes ) ) { |
|
| 90 | + if (is_array($classes) && !in_array('menu-column', $classes) && !in_array('menu-row', $classes)) { |
|
| 91 | 91 | $id = "mega-menu-item-{$item->ID}"; |
| 92 | 92 | } else { |
| 93 | 93 | $id = "mega-menu-{$item->ID}"; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $id = esc_attr( apply_filters( 'megamenu_nav_menu_item_id', $id, $item, $args ) ); |
|
| 96 | + $id = esc_attr(apply_filters('megamenu_nav_menu_item_id', $id, $item, $args)); |
|
| 97 | 97 | |
| 98 | 98 | $output .= "<li class='{$class}' id='{$id}'>"; |
| 99 | 99 | |
| 100 | 100 | // output the widgets |
| 101 | - if ( $item->type == 'widget' ) { |
|
| 101 | + if ($item->type == 'widget') { |
|
| 102 | 102 | |
| 103 | - if ( $item->content ) { |
|
| 103 | + if ($item->content) { |
|
| 104 | 104 | $item_output = $item->content; |
| 105 | 105 | } else { |
| 106 | 106 | $item_output = "<!-- widget is empty -->"; |
@@ -113,50 +113,50 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $atts = array(); |
| 115 | 115 | |
| 116 | - $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : ''; |
|
| 117 | - $atts['target'] = ! empty( $item->target ) ? $item->target : ''; |
|
| 116 | + $atts['title'] = !empty($item->attr_title) ? $item->attr_title : ''; |
|
| 117 | + $atts['target'] = !empty($item->target) ? $item->target : ''; |
|
| 118 | 118 | $atts['class'] = ''; |
| 119 | - $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; |
|
| 119 | + $atts['rel'] = !empty($item->xfn) ? $item->xfn : ''; |
|
| 120 | 120 | |
| 121 | - if ( isset( $settings['disable_link'] ) && $settings['disable_link'] != 'true' ) { |
|
| 122 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 121 | + if (isset($settings['disable_link']) && $settings['disable_link'] != 'true') { |
|
| 122 | + $atts['href'] = !empty($item->url) ? $item->url : ''; |
|
| 123 | 123 | } else { |
| 124 | 124 | $atts['tabindex'] = 0; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if ( isset( $settings['icon'] ) && $settings['icon'] != 'disabled' && $settings['icon'] != 'custom' ) { |
|
| 127 | + if (isset($settings['icon']) && $settings['icon'] != 'disabled' && $settings['icon'] != 'custom') { |
|
| 128 | 128 | $atts['class'] = $settings['icon']; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - if ( isset( $settings['icon'] ) && $settings['icon'] == 'custom' ) { |
|
| 131 | + if (isset($settings['icon']) && $settings['icon'] == 'custom') { |
|
| 132 | 132 | $atts['class'] = 'mega-custom-icon'; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if ( is_array( $classes ) && in_array( 'menu-item-has-children', $classes ) && $item->parent_submenu_type == 'flyout' ) { |
|
| 135 | + if (is_array($classes) && in_array('menu-item-has-children', $classes) && $item->parent_submenu_type == 'flyout') { |
|
| 136 | 136 | |
| 137 | 137 | $atts['aria-haspopup'] = 'true'; // required for Surface/Win10/Edge |
| 138 | 138 | $atts['aria-expanded'] = 'false'; |
| 139 | 139 | |
| 140 | - if ( is_array( $mega_classes ) && in_array( 'mega-toggle-on', $mega_classes ) ) { |
|
| 140 | + if (is_array($mega_classes) && in_array('mega-toggle-on', $mega_classes)) { |
|
| 141 | 141 | $atts['aria-expanded'] = 'true'; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - if ( isset( $settings['disable_link'] ) && $settings['disable_link'] == 'true' ) { |
|
| 144 | + if (isset($settings['disable_link']) && $settings['disable_link'] == 'true') { |
|
| 145 | 145 | $atts['role'] = 'button'; |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - if ( $depth == 0 ) { |
|
| 149 | + if ($depth == 0) { |
|
| 150 | 150 | $atts['tabindex'] = '0'; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if ( isset( $settings['hide_text'] ) && $settings['hide_text'] == 'true' ) { |
|
| 153 | + if (isset($settings['hide_text']) && $settings['hide_text'] == 'true') { |
|
| 154 | 154 | $atts['aria-label'] = $item->title; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - $atts = apply_filters( 'megamenu_nav_menu_link_attributes', $atts, $item, $args ); |
|
| 157 | + $atts = apply_filters('megamenu_nav_menu_link_attributes', $atts, $item, $args); |
|
| 158 | 158 | |
| 159 | - if ( isset( $atts['class'] ) && strlen( $atts['class'] ) ) { |
|
| 159 | + if (isset($atts['class']) && strlen($atts['class'])) { |
|
| 160 | 160 | $atts['class'] = $atts['class'] . ' mega-menu-link'; |
| 161 | 161 | } else { |
| 162 | 162 | $atts['class'] = 'mega-menu-link'; |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | $attributes = ''; |
| 166 | 166 | |
| 167 | - foreach ( $atts as $attr => $value ) { |
|
| 168 | - if ( strlen( $value ) ) { |
|
| 169 | - $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
|
| 167 | + foreach ($atts as $attr => $value) { |
|
| 168 | + if (strlen($value)) { |
|
| 169 | + $value = ('href' === $attr) ? esc_url($value) : esc_attr($value); |
|
| 170 | 170 | $attributes .= ' ' . $attr . '="' . $value . '"'; |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -174,37 +174,37 @@ discard block |
||
| 174 | 174 | $item_output = $args->before; |
| 175 | 175 | $item_output .= '<a' . $attributes . '>'; |
| 176 | 176 | |
| 177 | - if ( is_array( $classes ) && in_array( 'icon-top', $classes ) ) { |
|
| 177 | + if (is_array($classes) && in_array('icon-top', $classes)) { |
|
| 178 | 178 | $item_output .= "<span class='mega-title-below'>"; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if ( isset( $settings['hide_text'] ) && $settings['hide_text'] == 'true' ) { |
|
| 181 | + if (isset($settings['hide_text']) && $settings['hide_text'] == 'true') { |
|
| 182 | 182 | /** |
| 183 | 183 | * This filter is documented in wp-includes/post-template.php |
| 184 | 184 | */ |
| 185 | - } elseif ( property_exists( $item, 'mega_description' ) && strlen( $item->mega_description ) ) { |
|
| 186 | - $item_output .= '<span class="mega-description-group"><span class="mega-menu-title">' . $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after . '</span><span class="mega-menu-description">' . $item->description . '</span></span>'; |
|
| 185 | + } elseif (property_exists($item, 'mega_description') && strlen($item->mega_description)) { |
|
| 186 | + $item_output .= '<span class="mega-description-group"><span class="mega-menu-title">' . $args->link_before . apply_filters('megamenu_the_title', $item->title, $item->ID) . $args->link_after . '</span><span class="mega-menu-description">' . $item->description . '</span></span>'; |
|
| 187 | 187 | } else { |
| 188 | - $item_output .= $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after; |
|
| 188 | + $item_output .= $args->link_before . apply_filters('megamenu_the_title', $item->title, $item->ID) . $args->link_after; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - if ( is_array( $classes ) && in_array( 'icon-top', $classes ) ) { |
|
| 191 | + if (is_array($classes) && in_array('icon-top', $classes)) { |
|
| 192 | 192 | $item_output .= '</span>'; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if ( is_array( $classes ) && in_array( 'menu-item-has-children', $classes ) ) { |
|
| 195 | + if (is_array($classes) && in_array('menu-item-has-children', $classes)) { |
|
| 196 | 196 | $item_output .= '<span class="mega-indicator"></span>'; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | $item_output .= '</a>'; |
| 200 | 200 | $item_output .= $args->after; |
| 201 | 201 | |
| 202 | - if ( is_array( $classes ) && ( in_array( 'menu-column', $classes ) || in_array( 'menu-row', $classes ) ) ) { |
|
| 202 | + if (is_array($classes) && (in_array('menu-column', $classes) || in_array('menu-row', $classes))) { |
|
| 203 | 203 | $item_output = ''; |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - $output .= apply_filters( 'megamenu_walker_nav_menu_start_el', $item_output, $item, $depth, $args ); |
|
| 207 | + $output .= apply_filters('megamenu_walker_nav_menu_start_el', $item_output, $item, $depth, $args); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * @param int $depth Depth of page. Not Used. |
| 220 | 220 | * @param array $args An array of arguments. @see wp_nav_menu() |
| 221 | 221 | */ |
| 222 | - public function end_el( &$output, $item, $depth = 0, $args = array() ) { |
|
| 222 | + public function end_el(&$output, $item, $depth = 0, $args = array()) { |
|
| 223 | 223 | $output .= '</li>'; // remove new line to remove the 4px gap between menu items |
| 224 | 224 | } |
| 225 | 225 | } |
@@ -1,1275 +1,1275 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | - exit; // disable direct access |
|
| 4 | + exit; // disable direct access |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | if ( ! class_exists( 'Mega_Menu_Menu_Item_Manager' ) ) : |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * |
|
| 11 | - * @since 1.4 |
|
| 12 | - */ |
|
| 13 | - class Mega_Menu_Menu_Item_Manager { |
|
| 14 | - |
|
| 15 | - var $menu_id = 0; |
|
| 16 | - var $menu_item_id = 0; |
|
| 17 | - var $menu_item_title = ''; |
|
| 18 | - var $menu_item_depth = 0; |
|
| 19 | - var $menu_item_objects = array(); |
|
| 20 | - var $menu_item_meta = array(); |
|
| 21 | - |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * Constructor |
|
| 25 | - * |
|
| 26 | - * @since 1.4 |
|
| 27 | - */ |
|
| 28 | - public function __construct() { |
|
| 29 | - add_action( 'wp_ajax_mm_get_lightbox_html', array( $this, 'ajax_get_lightbox_html' ) ); |
|
| 30 | - add_action( 'wp_ajax_mm_get_empty_grid_column', array( $this, 'ajax_get_empty_grid_column' ) ); |
|
| 31 | - add_action( 'wp_ajax_mm_get_empty_grid_row', array( $this, 'ajax_get_empty_grid_row' ) ); |
|
| 32 | - add_action( 'wp_ajax_mm_save_menu_item_settings', array( $this, 'ajax_save_menu_item_settings' ) ); |
|
| 33 | - |
|
| 34 | - add_filter( 'megamenu_tabs', array( $this, 'add_mega_menu_tab' ), 10, 5 ); |
|
| 35 | - add_filter( 'megamenu_tabs', array( $this, 'add_general_settings_tab' ), 10, 5 ); |
|
| 36 | - add_filter( 'megamenu_tabs', array( $this, 'add_icon_tab' ), 10, 5 ); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * Set up the class |
|
| 42 | - * |
|
| 43 | - * @since 1.4 |
|
| 44 | - */ |
|
| 45 | - private function init() { |
|
| 46 | - if ( isset( $_POST['menu_item_id'] ) ) { |
|
| 47 | - $this->menu_item_id = absint( $_POST['menu_item_id'] ); |
|
| 48 | - $this->menu_id = $this->get_menu_id_for_menu_item_id( $this->menu_item_id ); |
|
| 49 | - $this->menu_item_objects = wp_get_nav_menu_items( $this->menu_id ); |
|
| 50 | - $this->menu_item_title = $this->get_title_for_menu_item_id( $this->menu_item_id, $this->menu_item_objects ); |
|
| 51 | - $this->menu_item_depth = $this->get_menu_item_depth( $this->menu_item_id, $this->menu_item_objects ); |
|
| 52 | - $saved_settings = array_filter( (array) get_post_meta( $this->menu_item_id, '_megamenu', true ) ); |
|
| 53 | - $this->menu_item_meta = array_merge( Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings ); |
|
| 54 | - } |
|
| 55 | - } |
|
| 9 | + /** |
|
| 10 | + * |
|
| 11 | + * @since 1.4 |
|
| 12 | + */ |
|
| 13 | + class Mega_Menu_Menu_Item_Manager { |
|
| 14 | + |
|
| 15 | + var $menu_id = 0; |
|
| 16 | + var $menu_item_id = 0; |
|
| 17 | + var $menu_item_title = ''; |
|
| 18 | + var $menu_item_depth = 0; |
|
| 19 | + var $menu_item_objects = array(); |
|
| 20 | + var $menu_item_meta = array(); |
|
| 21 | + |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * Constructor |
|
| 25 | + * |
|
| 26 | + * @since 1.4 |
|
| 27 | + */ |
|
| 28 | + public function __construct() { |
|
| 29 | + add_action( 'wp_ajax_mm_get_lightbox_html', array( $this, 'ajax_get_lightbox_html' ) ); |
|
| 30 | + add_action( 'wp_ajax_mm_get_empty_grid_column', array( $this, 'ajax_get_empty_grid_column' ) ); |
|
| 31 | + add_action( 'wp_ajax_mm_get_empty_grid_row', array( $this, 'ajax_get_empty_grid_row' ) ); |
|
| 32 | + add_action( 'wp_ajax_mm_save_menu_item_settings', array( $this, 'ajax_save_menu_item_settings' ) ); |
|
| 33 | + |
|
| 34 | + add_filter( 'megamenu_tabs', array( $this, 'add_mega_menu_tab' ), 10, 5 ); |
|
| 35 | + add_filter( 'megamenu_tabs', array( $this, 'add_general_settings_tab' ), 10, 5 ); |
|
| 36 | + add_filter( 'megamenu_tabs', array( $this, 'add_icon_tab' ), 10, 5 ); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * Set up the class |
|
| 42 | + * |
|
| 43 | + * @since 1.4 |
|
| 44 | + */ |
|
| 45 | + private function init() { |
|
| 46 | + if ( isset( $_POST['menu_item_id'] ) ) { |
|
| 47 | + $this->menu_item_id = absint( $_POST['menu_item_id'] ); |
|
| 48 | + $this->menu_id = $this->get_menu_id_for_menu_item_id( $this->menu_item_id ); |
|
| 49 | + $this->menu_item_objects = wp_get_nav_menu_items( $this->menu_id ); |
|
| 50 | + $this->menu_item_title = $this->get_title_for_menu_item_id( $this->menu_item_id, $this->menu_item_objects ); |
|
| 51 | + $this->menu_item_depth = $this->get_menu_item_depth( $this->menu_item_id, $this->menu_item_objects ); |
|
| 52 | + $saved_settings = array_filter( (array) get_post_meta( $this->menu_item_id, '_megamenu', true ) ); |
|
| 53 | + $this->menu_item_meta = array_merge( Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings ); |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Get the depth for a menu item ID |
|
| 59 | - * |
|
| 60 | - * @since 2.7.7 |
|
| 61 | - * @param int $menu_item_id |
|
| 62 | - * @param array $menu_item_objects |
|
| 63 | - * @return int |
|
| 64 | - */ |
|
| 65 | - public function get_menu_item_depth( $menu_item_id, $menu_item_objects ) { |
|
| 66 | - $parents = array(); |
|
| 57 | + /** |
|
| 58 | + * Get the depth for a menu item ID |
|
| 59 | + * |
|
| 60 | + * @since 2.7.7 |
|
| 61 | + * @param int $menu_item_id |
|
| 62 | + * @param array $menu_item_objects |
|
| 63 | + * @return int |
|
| 64 | + */ |
|
| 65 | + public function get_menu_item_depth( $menu_item_id, $menu_item_objects ) { |
|
| 66 | + $parents = array(); |
|
| 67 | 67 | |
| 68 | - foreach ( $menu_item_objects as $key => $item ) { |
|
| 69 | - if ( $item->menu_item_parent == 0 ) { |
|
| 68 | + foreach ( $menu_item_objects as $key => $item ) { |
|
| 69 | + if ( $item->menu_item_parent == 0 ) { |
|
| 70 | 70 | |
| 71 | - if ( $item->ID == $menu_item_id ) { |
|
| 72 | - return 0; // top level item |
|
| 73 | - } |
|
| 71 | + if ( $item->ID == $menu_item_id ) { |
|
| 72 | + return 0; // top level item |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - $parents[] = $item->ID; |
|
| 76 | - } |
|
| 77 | - } |
|
| 75 | + $parents[] = $item->ID; |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - if ( count( $parents ) ) { |
|
| 80 | - foreach ( $menu_item_objects as $key => $item ) { |
|
| 81 | - if ( in_array( $item->menu_item_parent, $parents ) ) { |
|
| 82 | - if ( $item->ID == $menu_item_id ) { |
|
| 83 | - return 1; // second level item |
|
| 84 | - } |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - } |
|
| 79 | + if ( count( $parents ) ) { |
|
| 80 | + foreach ( $menu_item_objects as $key => $item ) { |
|
| 81 | + if ( in_array( $item->menu_item_parent, $parents ) ) { |
|
| 82 | + if ( $item->ID == $menu_item_id ) { |
|
| 83 | + return 1; // second level item |
|
| 84 | + } |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - return 2; // third level item or above |
|
| 90 | - } |
|
| 89 | + return 2; // third level item or above |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * Save custom menu item fields. |
|
| 95 | - * |
|
| 96 | - * @since 1.4 |
|
| 97 | - */ |
|
| 98 | - public static function ajax_save_menu_item_settings() { |
|
| 93 | + /** |
|
| 94 | + * Save custom menu item fields. |
|
| 95 | + * |
|
| 96 | + * @since 1.4 |
|
| 97 | + */ |
|
| 98 | + public static function ajax_save_menu_item_settings() { |
|
| 99 | 99 | |
| 100 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 100 | + check_ajax_referer( 'megamenu_edit' ); |
|
| 101 | 101 | |
| 102 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 102 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 103 | 103 | |
| 104 | - if ( ! current_user_can( $capability ) ) { |
|
| 105 | - return; |
|
| 106 | - } |
|
| 104 | + if ( ! current_user_can( $capability ) ) { |
|
| 105 | + return; |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - $submitted_settings = isset( $_POST['settings'] ) ? $_POST['settings'] : array(); |
|
| 108 | + $submitted_settings = isset( $_POST['settings'] ) ? $_POST['settings'] : array(); |
|
| 109 | 109 | |
| 110 | - $menu_item_id = absint( $_POST['menu_item_id'] ); |
|
| 110 | + $menu_item_id = absint( $_POST['menu_item_id'] ); |
|
| 111 | 111 | |
| 112 | - if ( $menu_item_id > 0 && is_array( $submitted_settings ) ) { |
|
| 112 | + if ( $menu_item_id > 0 && is_array( $submitted_settings ) ) { |
|
| 113 | 113 | |
| 114 | - // only check the checkbox values if the general settings form was submitted |
|
| 115 | - if ( isset( $_POST['tab'] ) && $_POST['tab'] == 'general_settings' ) { |
|
| 114 | + // only check the checkbox values if the general settings form was submitted |
|
| 115 | + if ( isset( $_POST['tab'] ) && $_POST['tab'] == 'general_settings' ) { |
|
| 116 | 116 | |
| 117 | - $checkboxes = array( 'hide_text', 'disable_link', 'hide_arrow', 'hide_on_mobile', 'hide_on_desktop', 'close_after_click', 'hide_sub_menu_on_mobile', 'collapse_children' ); |
|
| 117 | + $checkboxes = array( 'hide_text', 'disable_link', 'hide_arrow', 'hide_on_mobile', 'hide_on_desktop', 'close_after_click', 'hide_sub_menu_on_mobile', 'collapse_children' ); |
|
| 118 | 118 | |
| 119 | - foreach ( $checkboxes as $checkbox ) { |
|
| 120 | - if ( ! isset( $submitted_settings[ $checkbox ] ) ) { |
|
| 121 | - $submitted_settings[ $checkbox ] = 'false'; |
|
| 122 | - } |
|
| 123 | - } |
|
| 124 | - } |
|
| 119 | + foreach ( $checkboxes as $checkbox ) { |
|
| 120 | + if ( ! isset( $submitted_settings[ $checkbox ] ) ) { |
|
| 121 | + $submitted_settings[ $checkbox ] = 'false'; |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - $submitted_settings = apply_filters( 'megamenu_menu_item_submitted_settings', $submitted_settings, $menu_item_id ); |
|
| 126 | + $submitted_settings = apply_filters( 'megamenu_menu_item_submitted_settings', $submitted_settings, $menu_item_id ); |
|
| 127 | 127 | |
| 128 | - $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true ); |
|
| 128 | + $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true ); |
|
| 129 | 129 | |
| 130 | - if ( is_array( $existing_settings ) ) { |
|
| 130 | + if ( is_array( $existing_settings ) ) { |
|
| 131 | 131 | |
| 132 | - $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 132 | + $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 133 | 133 | |
| 134 | - } |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - update_post_meta( $menu_item_id, '_megamenu', $submitted_settings ); |
|
| 136 | + update_post_meta( $menu_item_id, '_megamenu', $submitted_settings ); |
|
| 137 | 137 | |
| 138 | - do_action( 'megamenu_save_menu_item_settings', $menu_item_id ); |
|
| 138 | + do_action( 'megamenu_save_menu_item_settings', $menu_item_id ); |
|
| 139 | 139 | |
| 140 | - } |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - if ( isset( $_POST['clear_cache'] ) ) { |
|
| 142 | + if ( isset( $_POST['clear_cache'] ) ) { |
|
| 143 | 143 | |
| 144 | - do_action( 'megamenu_delete_cache' ); |
|
| 144 | + do_action( 'megamenu_delete_cache' ); |
|
| 145 | 145 | |
| 146 | - } |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - if ( ob_get_contents() ) { |
|
| 149 | - ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
|
| 150 | - } |
|
| 148 | + if ( ob_get_contents() ) { |
|
| 149 | + ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - wp_send_json_success(); |
|
| 152 | + wp_send_json_success(); |
|
| 153 | 153 | |
| 154 | - } |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | 156 | |
| 157 | - /** |
|
| 158 | - * Return the HTML to display in the Lightbox |
|
| 159 | - * |
|
| 160 | - * @since 1.4 |
|
| 161 | - * @return string |
|
| 162 | - */ |
|
| 163 | - public function ajax_get_lightbox_html() { |
|
| 157 | + /** |
|
| 158 | + * Return the HTML to display in the Lightbox |
|
| 159 | + * |
|
| 160 | + * @since 1.4 |
|
| 161 | + * @return string |
|
| 162 | + */ |
|
| 163 | + public function ajax_get_lightbox_html() { |
|
| 164 | 164 | |
| 165 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 165 | + check_ajax_referer( 'megamenu_edit' ); |
|
| 166 | 166 | |
| 167 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 167 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 168 | 168 | |
| 169 | - if ( ! current_user_can( $capability ) ) { |
|
| 170 | - return; |
|
| 171 | - } |
|
| 169 | + if ( ! current_user_can( $capability ) ) { |
|
| 170 | + return; |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - $this->init(); |
|
| 173 | + $this->init(); |
|
| 174 | 174 | |
| 175 | - $response = array(); |
|
| 175 | + $response = array(); |
|
| 176 | 176 | |
| 177 | - $response['title'] = $this->menu_item_title; |
|
| 177 | + $response['title'] = $this->menu_item_title; |
|
| 178 | 178 | |
| 179 | - $response['active_tab'] = 'mega_menu'; |
|
| 179 | + $response['active_tab'] = 'mega_menu'; |
|
| 180 | 180 | |
| 181 | - if ( $this->menu_item_depth > 0 ) { |
|
| 182 | - $response['active_tab'] = 'general_settings'; |
|
| 183 | - } |
|
| 181 | + if ( $this->menu_item_depth > 0 ) { |
|
| 182 | + $response['active_tab'] = 'general_settings'; |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - $response = apply_filters( 'megamenu_tabs', $response, $this->menu_item_id, $this->menu_id, $this->menu_item_depth, $this->menu_item_meta ); |
|
| 185 | + $response = apply_filters( 'megamenu_tabs', $response, $this->menu_item_id, $this->menu_id, $this->menu_item_depth, $this->menu_item_meta ); |
|
| 186 | 186 | |
| 187 | - if ( ob_get_contents() ) { |
|
| 188 | - ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
|
| 189 | - } |
|
| 187 | + if ( ob_get_contents() ) { |
|
| 188 | + ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
|
| 189 | + } |
|
| 190 | 190 | |
| 191 | - wp_send_json_success( json_encode( $response ) ); |
|
| 192 | - } |
|
| 191 | + wp_send_json_success( json_encode( $response ) ); |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | 194 | |
| 195 | - /** |
|
| 196 | - * Returns the menu ID for a specified menu item ID |
|
| 197 | - * |
|
| 198 | - * @since 2.7.5 |
|
| 199 | - * @param int $menu_item_id |
|
| 200 | - * @return int $menu_id |
|
| 201 | - */ |
|
| 202 | - public function get_menu_id_for_menu_item_id( $menu_item_id ) { |
|
| 203 | - $terms = get_the_terms( $menu_item_id, 'nav_menu' ); |
|
| 204 | - $menu_id = $terms[0]->term_id; |
|
| 205 | - return $menu_id; |
|
| 206 | - } |
|
| 195 | + /** |
|
| 196 | + * Returns the menu ID for a specified menu item ID |
|
| 197 | + * |
|
| 198 | + * @since 2.7.5 |
|
| 199 | + * @param int $menu_item_id |
|
| 200 | + * @return int $menu_id |
|
| 201 | + */ |
|
| 202 | + public function get_menu_id_for_menu_item_id( $menu_item_id ) { |
|
| 203 | + $terms = get_the_terms( $menu_item_id, 'nav_menu' ); |
|
| 204 | + $menu_id = $terms[0]->term_id; |
|
| 205 | + return $menu_id; |
|
| 206 | + } |
|
| 207 | 207 | |
| 208 | 208 | |
| 209 | - /** |
|
| 210 | - * Returns the title of a given menu item ID |
|
| 211 | - * |
|
| 212 | - * @since 2.7.5 |
|
| 213 | - * @param int $menu_item_id |
|
| 214 | - * @return int $menu_id |
|
| 215 | - */ |
|
| 216 | - public function get_title_for_menu_item_id( $menu_item_id, $menu_item_objects ) { |
|
| 217 | - foreach ( $menu_item_objects as $key => $item ) { |
|
| 218 | - if ( $item->ID == $menu_item_id ) { |
|
| 219 | - return $item->title; |
|
| 220 | - } |
|
| 221 | - } |
|
| 209 | + /** |
|
| 210 | + * Returns the title of a given menu item ID |
|
| 211 | + * |
|
| 212 | + * @since 2.7.5 |
|
| 213 | + * @param int $menu_item_id |
|
| 214 | + * @return int $menu_id |
|
| 215 | + */ |
|
| 216 | + public function get_title_for_menu_item_id( $menu_item_id, $menu_item_objects ) { |
|
| 217 | + foreach ( $menu_item_objects as $key => $item ) { |
|
| 218 | + if ( $item->ID == $menu_item_id ) { |
|
| 219 | + return $item->title; |
|
| 220 | + } |
|
| 221 | + } |
|
| 222 | 222 | |
| 223 | - return false; |
|
| 224 | - } |
|
| 223 | + return false; |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | - /** |
|
| 227 | - * Return the HTML to display in the 'Mega Menu' tab |
|
| 228 | - * |
|
| 229 | - * @since 1.7 |
|
| 230 | - * @return array |
|
| 231 | - */ |
|
| 232 | - public function add_mega_menu_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 233 | - if ( $menu_item_depth > 0 ) { |
|
| 234 | - $tabs['mega_menu'] = array( |
|
| 235 | - 'title' => __( 'Sub Menu', 'megamenu' ), |
|
| 236 | - 'content' => '<em>' . __( 'Mega Menus can only be created on top level menu items.', 'megamenu' ) . '</em>', |
|
| 237 | - ); |
|
| 226 | + /** |
|
| 227 | + * Return the HTML to display in the 'Mega Menu' tab |
|
| 228 | + * |
|
| 229 | + * @since 1.7 |
|
| 230 | + * @return array |
|
| 231 | + */ |
|
| 232 | + public function add_mega_menu_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 233 | + if ( $menu_item_depth > 0 ) { |
|
| 234 | + $tabs['mega_menu'] = array( |
|
| 235 | + 'title' => __( 'Sub Menu', 'megamenu' ), |
|
| 236 | + 'content' => '<em>' . __( 'Mega Menus can only be created on top level menu items.', 'megamenu' ) . '</em>', |
|
| 237 | + ); |
|
| 238 | 238 | |
| 239 | - return $tabs; |
|
| 240 | - } |
|
| 239 | + return $tabs; |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | - $submenu_options = apply_filters( |
|
| 243 | - 'megamenu_submenu_options', |
|
| 244 | - array( |
|
| 245 | - 'flyout' => __( 'Flyout Menu', 'megamenu' ), |
|
| 246 | - 'grid' => __( 'Mega Menu - Grid Layout', 'megamenu' ), |
|
| 247 | - 'megamenu' => __( 'Mega Menu - Standard Layout', 'megamenu' ), |
|
| 248 | - ), |
|
| 249 | - $menu_item_meta |
|
| 250 | - ); |
|
| 242 | + $submenu_options = apply_filters( |
|
| 243 | + 'megamenu_submenu_options', |
|
| 244 | + array( |
|
| 245 | + 'flyout' => __( 'Flyout Menu', 'megamenu' ), |
|
| 246 | + 'grid' => __( 'Mega Menu - Grid Layout', 'megamenu' ), |
|
| 247 | + 'megamenu' => __( 'Mega Menu - Standard Layout', 'megamenu' ), |
|
| 248 | + ), |
|
| 249 | + $menu_item_meta |
|
| 250 | + ); |
|
| 251 | 251 | |
| 252 | - $return = "<label for='mm_enable_mega_menu'>" . __( 'Sub menu display mode', 'megamenu' ) . '</label>'; |
|
| 252 | + $return = "<label for='mm_enable_mega_menu'>" . __( 'Sub menu display mode', 'megamenu' ) . '</label>'; |
|
| 253 | 253 | |
| 254 | - $return .= "<select id='mm_enable_mega_menu' name='settings[type]'>"; |
|
| 254 | + $return .= "<select id='mm_enable_mega_menu' name='settings[type]'>"; |
|
| 255 | 255 | |
| 256 | - foreach ( $submenu_options as $type => $label ) { |
|
| 257 | - $return .= "<option id='{$type}' value='{$type}' " . selected( $menu_item_meta['type'], $type, false ) . ">{$label}</option>"; |
|
| 258 | - } |
|
| 259 | - $return .= '</select>'; |
|
| 256 | + foreach ( $submenu_options as $type => $label ) { |
|
| 257 | + $return .= "<option id='{$type}' value='{$type}' " . selected( $menu_item_meta['type'], $type, false ) . ">{$label}</option>"; |
|
| 258 | + } |
|
| 259 | + $return .= '</select>'; |
|
| 260 | 260 | |
| 261 | - $widget_manager = new Mega_Menu_Widget_Manager(); |
|
| 261 | + $widget_manager = new Mega_Menu_Widget_Manager(); |
|
| 262 | 262 | |
| 263 | - $all_widgets = $widget_manager->get_available_widgets(); |
|
| 263 | + $all_widgets = $widget_manager->get_available_widgets(); |
|
| 264 | 264 | |
| 265 | - $return .= "<div class='mm_panel_options'>"; |
|
| 266 | - $return .= " <select id='mm_number_of_columns' name='settings[panel_columns]'>"; |
|
| 267 | - $return .= " <option value='1' " . selected( $menu_item_meta['panel_columns'], 1, false ) . '>1 ' . __( 'column', 'megamenu' ) . '</option>'; |
|
| 268 | - $return .= " <option value='2' " . selected( $menu_item_meta['panel_columns'], 2, false ) . '>2 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 269 | - $return .= " <option value='3' " . selected( $menu_item_meta['panel_columns'], 3, false ) . '>3 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 270 | - $return .= " <option value='4' " . selected( $menu_item_meta['panel_columns'], 4, false ) . '>4 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 271 | - $return .= " <option value='5' " . selected( $menu_item_meta['panel_columns'], 5, false ) . '>5 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 272 | - $return .= " <option value='6' " . selected( $menu_item_meta['panel_columns'], 6, false ) . '>6 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 273 | - $return .= " <option value='7' " . selected( $menu_item_meta['panel_columns'], 7, false ) . '>7 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 274 | - $return .= " <option value='8' " . selected( $menu_item_meta['panel_columns'], 8, false ) . '>8 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 275 | - $return .= " <option value='9' " . selected( $menu_item_meta['panel_columns'], 9, false ) . '>9 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 276 | - $return .= " <option value='10' " . selected( $menu_item_meta['panel_columns'], 10, false ) . '>10 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 277 | - $return .= " <option value='11' " . selected( $menu_item_meta['panel_columns'], 11, false ) . '>11 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 278 | - $return .= " <option value='12' " . selected( $menu_item_meta['panel_columns'], 12, false ) . '>12 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 279 | - $return .= ' </select>'; |
|
| 265 | + $return .= "<div class='mm_panel_options'>"; |
|
| 266 | + $return .= " <select id='mm_number_of_columns' name='settings[panel_columns]'>"; |
|
| 267 | + $return .= " <option value='1' " . selected( $menu_item_meta['panel_columns'], 1, false ) . '>1 ' . __( 'column', 'megamenu' ) . '</option>'; |
|
| 268 | + $return .= " <option value='2' " . selected( $menu_item_meta['panel_columns'], 2, false ) . '>2 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 269 | + $return .= " <option value='3' " . selected( $menu_item_meta['panel_columns'], 3, false ) . '>3 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 270 | + $return .= " <option value='4' " . selected( $menu_item_meta['panel_columns'], 4, false ) . '>4 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 271 | + $return .= " <option value='5' " . selected( $menu_item_meta['panel_columns'], 5, false ) . '>5 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 272 | + $return .= " <option value='6' " . selected( $menu_item_meta['panel_columns'], 6, false ) . '>6 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 273 | + $return .= " <option value='7' " . selected( $menu_item_meta['panel_columns'], 7, false ) . '>7 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 274 | + $return .= " <option value='8' " . selected( $menu_item_meta['panel_columns'], 8, false ) . '>8 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 275 | + $return .= " <option value='9' " . selected( $menu_item_meta['panel_columns'], 9, false ) . '>9 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 276 | + $return .= " <option value='10' " . selected( $menu_item_meta['panel_columns'], 10, false ) . '>10 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 277 | + $return .= " <option value='11' " . selected( $menu_item_meta['panel_columns'], 11, false ) . '>11 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 278 | + $return .= " <option value='12' " . selected( $menu_item_meta['panel_columns'], 12, false ) . '>12 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 279 | + $return .= ' </select>'; |
|
| 280 | 280 | |
| 281 | - $return .= " <select id='mm_widget_selector'>"; |
|
| 282 | - $return .= " <option value='disabled'>" . __( 'Select a Widget to add to the panel', 'megamenu' ) . '</option>'; |
|
| 281 | + $return .= " <select id='mm_widget_selector'>"; |
|
| 282 | + $return .= " <option value='disabled'>" . __( 'Select a Widget to add to the panel', 'megamenu' ) . '</option>'; |
|
| 283 | 283 | |
| 284 | - foreach ( $all_widgets as $widget ) { |
|
| 285 | - $return .= " <option value='" . $widget['value'] . "'>" . $widget['text'] . '</option>'; |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - $return .= ' </select>'; |
|
| 289 | - $return .= '</div>'; |
|
| 284 | + foreach ( $all_widgets as $widget ) { |
|
| 285 | + $return .= " <option value='" . $widget['value'] . "'>" . $widget['text'] . '</option>'; |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + $return .= ' </select>'; |
|
| 289 | + $return .= '</div>'; |
|
| 290 | 290 | |
| 291 | - $return .= $this->get_megamenu_html( $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 291 | + $return .= $this->get_megamenu_html( $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 292 | 292 | |
| 293 | - $return .= $this->get_megamenu_grid_html( $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 294 | - |
|
| 295 | - $tabs['mega_menu'] = array( |
|
| 296 | - 'title' => __( 'Mega Menu', 'megamenu' ), |
|
| 297 | - 'content' => $return, |
|
| 298 | - ); |
|
| 293 | + $return .= $this->get_megamenu_grid_html( $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 294 | + |
|
| 295 | + $tabs['mega_menu'] = array( |
|
| 296 | + 'title' => __( 'Mega Menu', 'megamenu' ), |
|
| 297 | + 'content' => $return, |
|
| 298 | + ); |
|
| 299 | 299 | |
| 300 | - return $tabs; |
|
| 301 | - } |
|
| 300 | + return $tabs; |
|
| 301 | + } |
|
| 302 | 302 | |
| 303 | 303 | |
| 304 | - /** |
|
| 305 | - * Return the HTML for the grid layout |
|
| 306 | - * |
|
| 307 | - * @since 2.4 |
|
| 308 | - * @return string |
|
| 309 | - */ |
|
| 310 | - public function get_megamenu_grid_html( $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 304 | + /** |
|
| 305 | + * Return the HTML for the grid layout |
|
| 306 | + * |
|
| 307 | + * @since 2.4 |
|
| 308 | + * @return string |
|
| 309 | + */ |
|
| 310 | + public function get_megamenu_grid_html( $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 311 | 311 | |
| 312 | - $css_version = get_transient( 'megamenu_css_version' ); |
|
| 312 | + $css_version = get_transient( 'megamenu_css_version' ); |
|
| 313 | 313 | |
| 314 | - $return = "<div id='megamenu-grid'>"; |
|
| 314 | + $return = "<div id='megamenu-grid'>"; |
|
| 315 | 315 | |
| 316 | - if ( $css_version && version_compare( $css_version, '2.3.9', '<=' ) ) { |
|
| 317 | - $link = "<a href='" . esc_attr( admin_url( 'admin.php?page=maxmegamenu_tools' ) ) . "'>" . __( 'Mega Menu' ) . ' > ' . __( 'Tools' ) . '</a>'; |
|
| 318 | - $return .= "<div class='notice notice-success'><p>"; |
|
| 319 | - $return .= sprintf( __( 'Your menu CSS needs to be updated first. Please go to %s and Clear the CSS Cache (you will only need to do this once).', 'megamenu' ), $link ); |
|
| 320 | - $return .= '</p></div>'; |
|
| 321 | - $return .= '</div>'; |
|
| 316 | + if ( $css_version && version_compare( $css_version, '2.3.9', '<=' ) ) { |
|
| 317 | + $link = "<a href='" . esc_attr( admin_url( 'admin.php?page=maxmegamenu_tools' ) ) . "'>" . __( 'Mega Menu' ) . ' > ' . __( 'Tools' ) . '</a>'; |
|
| 318 | + $return .= "<div class='notice notice-success'><p>"; |
|
| 319 | + $return .= sprintf( __( 'Your menu CSS needs to be updated first. Please go to %s and Clear the CSS Cache (you will only need to do this once).', 'megamenu' ), $link ); |
|
| 320 | + $return .= '</p></div>'; |
|
| 321 | + $return .= '</div>'; |
|
| 322 | 322 | |
| 323 | - return $return; |
|
| 324 | - } |
|
| 323 | + return $return; |
|
| 324 | + } |
|
| 325 | 325 | |
| 326 | - $widget_manager = new Mega_Menu_Widget_Manager(); |
|
| 326 | + $widget_manager = new Mega_Menu_Widget_Manager(); |
|
| 327 | 327 | |
| 328 | - $grid = $widget_manager->get_grid_widgets_and_menu_items_for_menu_id( $menu_item_id, $menu_id ); |
|
| 328 | + $grid = $widget_manager->get_grid_widgets_and_menu_items_for_menu_id( $menu_item_id, $menu_id ); |
|
| 329 | 329 | |
| 330 | - if ( count( $grid ) ) { |
|
| 330 | + if ( count( $grid ) ) { |
|
| 331 | 331 | |
| 332 | - foreach ( $grid as $row => $row_data ) { |
|
| 332 | + foreach ( $grid as $row => $row_data ) { |
|
| 333 | 333 | |
| 334 | - $column_html = ''; |
|
| 334 | + $column_html = ''; |
|
| 335 | 335 | |
| 336 | - if ( isset( $row_data['columns'] ) && count( $row_data['columns'] ) ) { |
|
| 336 | + if ( isset( $row_data['columns'] ) && count( $row_data['columns'] ) ) { |
|
| 337 | 337 | |
| 338 | - foreach ( $row_data['columns'] as $col => $col_data ) { |
|
| 339 | - $column_html .= $this->get_grid_column( $row_data, $col_data ); |
|
| 340 | - } |
|
| 341 | - } |
|
| 338 | + foreach ( $row_data['columns'] as $col => $col_data ) { |
|
| 339 | + $column_html .= $this->get_grid_column( $row_data, $col_data ); |
|
| 340 | + } |
|
| 341 | + } |
|
| 342 | 342 | |
| 343 | - $return .= $this->get_grid_row( $row_data, $column_html ); |
|
| 343 | + $return .= $this->get_grid_row( $row_data, $column_html ); |
|
| 344 | 344 | |
| 345 | - } |
|
| 346 | - } |
|
| 345 | + } |
|
| 346 | + } |
|
| 347 | 347 | |
| 348 | - $return .= " <button class='button button-primary mega-add-row'><span class='dashicons dashicons-plus'></span>" . __( 'Row', 'megamenu' ) . '</button>'; |
|
| 349 | - $return .= '</div>'; |
|
| 348 | + $return .= " <button class='button button-primary mega-add-row'><span class='dashicons dashicons-plus'></span>" . __( 'Row', 'megamenu' ) . '</button>'; |
|
| 349 | + $return .= '</div>'; |
|
| 350 | 350 | |
| 351 | - return $return; |
|
| 351 | + return $return; |
|
| 352 | 352 | |
| 353 | - } |
|
| 353 | + } |
|
| 354 | 354 | |
| 355 | - /** |
|
| 356 | - * Return the HTML to display in the Lightbox |
|
| 357 | - * |
|
| 358 | - * @since 2.4 |
|
| 359 | - * @return string |
|
| 360 | - */ |
|
| 361 | - public function ajax_get_empty_grid_column() { |
|
| 355 | + /** |
|
| 356 | + * Return the HTML to display in the Lightbox |
|
| 357 | + * |
|
| 358 | + * @since 2.4 |
|
| 359 | + * @return string |
|
| 360 | + */ |
|
| 361 | + public function ajax_get_empty_grid_column() { |
|
| 362 | 362 | |
| 363 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 363 | + check_ajax_referer( 'megamenu_edit' ); |
|
| 364 | 364 | |
| 365 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 365 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 366 | 366 | |
| 367 | - if ( ! current_user_can( $capability ) ) { |
|
| 368 | - return; |
|
| 369 | - } |
|
| 367 | + if ( ! current_user_can( $capability ) ) { |
|
| 368 | + return; |
|
| 369 | + } |
|
| 370 | 370 | |
| 371 | - $return = $this->get_grid_column(); |
|
| 371 | + $return = $this->get_grid_column(); |
|
| 372 | 372 | |
| 373 | - if ( ob_get_contents() ) { |
|
| 374 | - ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
|
| 375 | - } |
|
| 373 | + if ( ob_get_contents() ) { |
|
| 374 | + ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
|
| 375 | + } |
|
| 376 | 376 | |
| 377 | - wp_send_json_success( $return ); |
|
| 378 | - } |
|
| 377 | + wp_send_json_success( $return ); |
|
| 378 | + } |
|
| 379 | 379 | |
| 380 | - /** |
|
| 381 | - * Return the HTML to display in the Lightbox |
|
| 382 | - * |
|
| 383 | - * @since 2.4 |
|
| 384 | - * @return string |
|
| 385 | - */ |
|
| 386 | - public function ajax_get_empty_grid_row() { |
|
| 387 | - |
|
| 388 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 389 | - |
|
| 390 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 391 | - |
|
| 392 | - if ( ! current_user_can( $capability ) ) { |
|
| 393 | - return; |
|
| 394 | - } |
|
| 395 | - |
|
| 396 | - $column_html = $this->get_grid_column(); |
|
| 397 | - |
|
| 398 | - $return = $this->get_grid_row( false, $column_html ); |
|
| 399 | - |
|
| 400 | - if ( ob_get_contents() ) { |
|
| 401 | - ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
|
| 402 | - } |
|
| 403 | - |
|
| 404 | - wp_send_json_success( $return ); |
|
| 405 | - } |
|
| 406 | - |
|
| 407 | - /** |
|
| 408 | - * Return the HTML for a single row |
|
| 409 | - * |
|
| 410 | - * @param array $row_data |
|
| 411 | - * @param string $column_html |
|
| 412 | - * @since 2.4 |
|
| 413 | - * @return string |
|
| 414 | - */ |
|
| 415 | - public function get_grid_row( $row_data = false, $column_html = false ) { |
|
| 416 | - |
|
| 417 | - $hide_on_desktop_checked = 'false'; |
|
| 418 | - $hide_on_desktop = 'mega-enabled'; |
|
| 419 | - |
|
| 420 | - if ( isset( $row_data['meta']['hide-on-desktop'] ) && $row_data['meta']['hide-on-desktop'] == 'true' ) { |
|
| 421 | - $hide_on_desktop = 'mega-disabled'; |
|
| 422 | - $hide_on_desktop_checked = 'true'; |
|
| 423 | - } |
|
| 424 | - |
|
| 425 | - $hide_on_mobile_checked = 'false'; |
|
| 426 | - $hide_on_mobile = 'mega-enabled'; |
|
| 427 | - |
|
| 428 | - if ( isset( $row_data['meta']['hide-on-mobile'] ) && $row_data['meta']['hide-on-mobile'] == 'true' ) { |
|
| 429 | - $hide_on_mobile = 'mega-disabled'; |
|
| 430 | - $hide_on_mobile_checked = 'true'; |
|
| 431 | - } |
|
| 432 | - |
|
| 433 | - $row_columns = 12; |
|
| 434 | - |
|
| 435 | - if ( isset( $row_data['meta']['columns'] ) ) { |
|
| 436 | - $row_columns = intval( $row_data['meta']['columns'] ); |
|
| 437 | - } |
|
| 438 | - |
|
| 439 | - $desktop_tooltip_visible = __( 'Row', 'megamenu' ) . ': ' . __( 'Visible on desktop', 'megamenu' ); |
|
| 440 | - $desktop_tooltip_hidden = __( 'Row', 'megamenu' ) . ': ' . __( 'Hidden on desktop', 'megamenu' ); |
|
| 441 | - $mobile_tooltip_visible = __( 'Row', 'megamenu' ) . ': ' . __( 'Visible on mobile', 'megamenu' ); |
|
| 442 | - $mobile_tooltip_hidden = __( 'Row', 'megamenu' ) . ': ' . __( 'Hidden on mobile', 'megamenu' ); |
|
| 443 | - |
|
| 444 | - $row_class = isset( $row_data['meta']['class'] ) ? $row_data['meta']['class'] : ''; |
|
| 445 | - |
|
| 446 | - $return = "<div class='mega-row' data-available-cols='{$row_columns}'>"; |
|
| 447 | - $return .= " <div class='mega-row-header'>"; |
|
| 448 | - $return .= " <div class='mega-row-actions'>"; |
|
| 449 | - $return .= " <span class='dashicons dashicons-sort'></span>"; |
|
| 450 | - $return .= " <span class='dashicons dashicons-admin-generic'></span>"; |
|
| 451 | - $return .= " <span class='mega-tooltip {$hide_on_desktop}' data-tooltip-enabled='{$desktop_tooltip_visible}' data-tooltip-disabled='{$desktop_tooltip_hidden}'><span class='dashicons dashicons-desktop'></span></span>"; |
|
| 452 | - $return .= " <span class='mega-tooltip {$hide_on_mobile}' data-tooltip-enabled='{$mobile_tooltip_visible}' data-tooltip-disabled='{$mobile_tooltip_hidden}'><span class='dashicons dashicons-smartphone'></span></span>"; |
|
| 453 | - $return .= " <span class='dashicons dashicons-trash'></span>"; |
|
| 454 | - $return .= ' </div>'; |
|
| 455 | - $return .= " <div class='mega-row-settings'>"; |
|
| 456 | - $return .= " <input name='mega-hide-on-mobile' type='hidden' value='{$hide_on_mobile_checked}' />"; |
|
| 457 | - $return .= " <input name='mega-hide-on-desktop' type='hidden' value='{$hide_on_desktop_checked}'/>"; |
|
| 458 | - $return .= " <div class='mega-settings-row'>"; |
|
| 459 | - $return .= ' <label>' . __( 'Row class', 'megamenu' ) . '</label>'; |
|
| 460 | - $return .= " <input class='mega-row-class' type='text' value='{$row_class}' />"; |
|
| 461 | - $return .= ' </div>'; |
|
| 462 | - $return .= " <div class='mega-settings-row'>"; |
|
| 463 | - $return .= ' <label>' . __( 'Row columns', 'megamenu' ) . '</label>'; |
|
| 464 | - $return .= " <select class='mega-row-columns'>"; |
|
| 465 | - $return .= " <option value='1' " . selected( $row_columns, 1, false ) . '>1 ' . __( 'column', 'megamenu' ) . '</option>'; |
|
| 466 | - $return .= " <option value='2' " . selected( $row_columns, 2, false ) . '>2 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 467 | - $return .= " <option value='3' " . selected( $row_columns, 3, false ) . '>3 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 468 | - $return .= " <option value='4' " . selected( $row_columns, 4, false ) . '>4 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 469 | - $return .= " <option value='5' " . selected( $row_columns, 5, false ) . '>5 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 470 | - $return .= " <option value='6' " . selected( $row_columns, 6, false ) . '>6 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 471 | - $return .= " <option value='7' " . selected( $row_columns, 7, false ) . '>7 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 472 | - $return .= " <option value='8' " . selected( $row_columns, 8, false ) . '>8 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 473 | - $return .= " <option value='9' " . selected( $row_columns, 9, false ) . '>9 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 474 | - $return .= " <option value='10' " . selected( $row_columns, 10, false ) . '>10 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 475 | - $return .= " <option value='11' " . selected( $row_columns, 11, false ) . '>11 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 476 | - $return .= " <option value='12' " . selected( $row_columns, 12, false ) . '>12 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 477 | - $return .= ' </select>'; |
|
| 478 | - $return .= ' </div>'; |
|
| 479 | - $return .= " <button class='button button-primary mega-save-row-settings' type='submit'>" . __( 'Save', 'megamenu' ) . '</button>'; |
|
| 480 | - $return .= ' </div>'; |
|
| 481 | - $return .= " <button class='button button-primary mega-add-column'><span class='dashicons dashicons-plus'></span>" . __( 'Column', 'megamenu' ) . '</button>'; |
|
| 482 | - $return .= ' </div>'; |
|
| 483 | - $return .= " <div class='error notice is-dismissible mega-too-many-cols'>"; |
|
| 484 | - $return .= ' <p>' . __( 'You should rearrange the content of this row so that all columns fit onto a single line.', 'megamenu' ) . '</p>'; |
|
| 485 | - $return .= ' </div>'; |
|
| 486 | - $return .= " <div class='error notice is-dismissible mega-row-is-full'>"; |
|
| 487 | - $return .= ' <p>' . __( 'There is not enough space on this row to add a new column.', 'megamenu' ) . '</p>'; |
|
| 488 | - $return .= ' </div>'; |
|
| 489 | - |
|
| 490 | - $return .= $column_html; |
|
| 491 | - |
|
| 492 | - $return .= '</div>'; |
|
| 493 | - |
|
| 494 | - return $return; |
|
| 495 | - } |
|
| 496 | - |
|
| 497 | - /** |
|
| 498 | - * Return the HTML for an individual grid column |
|
| 499 | - * |
|
| 500 | - * @param array $col_data |
|
| 501 | - * @since 2.4 |
|
| 502 | - * @return string |
|
| 503 | - */ |
|
| 504 | - public function get_grid_column( $row_data = false, $col_data = false ) { |
|
| 505 | - |
|
| 506 | - $col_span = 3; |
|
| 507 | - $row_columns = 12; |
|
| 508 | - |
|
| 509 | - if ( isset( $row_data['meta']['columns'] ) ) { |
|
| 510 | - $row_columns = intval( $row_data['meta']['columns'] ); |
|
| 511 | - } |
|
| 512 | - |
|
| 513 | - if ( isset( $col_data['meta']['span'] ) ) { |
|
| 514 | - $col_span = $col_data['meta']['span']; |
|
| 515 | - } |
|
| 516 | - |
|
| 517 | - $hide_on_desktop_checked = 'false'; |
|
| 518 | - $hide_on_desktop = 'mega-enabled'; |
|
| 519 | - |
|
| 520 | - if ( isset( $col_data['meta']['hide-on-desktop'] ) && $col_data['meta']['hide-on-desktop'] == 'true' ) { |
|
| 521 | - $hide_on_desktop = 'mega-disabled'; |
|
| 522 | - $hide_on_desktop_checked = 'true'; |
|
| 523 | - } |
|
| 524 | - |
|
| 525 | - $hide_on_mobile_checked = 'false'; |
|
| 526 | - $hide_on_mobile = 'mega-enabled'; |
|
| 527 | - |
|
| 528 | - if ( isset( $col_data['meta']['hide-on-mobile'] ) && $col_data['meta']['hide-on-mobile'] == 'true' ) { |
|
| 529 | - $hide_on_mobile = 'mega-disabled'; |
|
| 530 | - $hide_on_mobile_checked = 'true'; |
|
| 531 | - } |
|
| 532 | - |
|
| 533 | - $desktop_tooltip_visible = __( 'Column', 'megamenu' ) . ': ' . __( 'Visible on desktop', 'megamenu' ); |
|
| 534 | - $desktop_tooltip_hidden = __( 'Column', 'megamenu' ) . ': ' . __( 'Hidden on desktop', 'megamenu' ); |
|
| 535 | - $mobile_tooltip_visible = __( 'Column', 'megamenu' ) . ': ' . __( 'Visible on mobile', 'megamenu' ); |
|
| 536 | - $mobile_tooltip_hidden = __( 'Column', 'megamenu' ) . ': ' . __( 'Hidden on mobile', 'megamenu' ); |
|
| 537 | - |
|
| 538 | - $col_class = isset( $col_data['meta']['class'] ) ? $col_data['meta']['class'] : ''; |
|
| 539 | - |
|
| 540 | - $return = "<div class='mega-col' data-span='{$col_span}'>"; |
|
| 541 | - $return .= " <div class='mega-col-wrap'>"; |
|
| 542 | - $return .= " <div class='mega-col-header'>"; |
|
| 543 | - $return .= " <div class='mega-col-description'>"; |
|
| 544 | - $return .= " <span class='dashicons dashicons-move'></span>"; |
|
| 545 | - $return .= " <span class='dashicons dashicons-admin-generic'></span>"; |
|
| 546 | - $return .= " <span class='mega-tooltip {$hide_on_desktop}' data-tooltip-enabled='{$desktop_tooltip_visible}' data-tooltip-disabled='{$desktop_tooltip_hidden}'><span class='dashicons dashicons-desktop'></span></span>"; |
|
| 547 | - $return .= " <span class='mega-tooltip {$hide_on_mobile}' data-tooltip-enabled='{$mobile_tooltip_visible}' data-tooltip-disabled='{$mobile_tooltip_hidden}'><span class='dashicons dashicons-smartphone'></span></span>"; |
|
| 548 | - $return .= " <span class='dashicons dashicons-trash'></span>"; |
|
| 549 | - $return .= ' </div>'; |
|
| 550 | - $return .= ' <div class="mega-col-actions">'; |
|
| 551 | - $return .= ' <a class="mega-col-option mega-col-contract" title="' . esc_attr( __( 'Contract', 'megamenu' ) ) . '"><span class="dashicons dashicons-arrow-left-alt2"></span></a>'; |
|
| 552 | - $return .= " <span class='mega-col-cols'><span class='mega-num-cols'>{$col_span}</span><span class='mega-of'>/</span><span class='mega-num-total-cols'>" . $row_columns . '</span></span>'; |
|
| 553 | - $return .= ' <a class="mega-col-options mega-col-expand" title="' . esc_attr( __( 'Expand', 'megamenu' ) ) . '"><span class="dashicons dashicons-arrow-right-alt2"></span></a>'; |
|
| 554 | - $return .= ' </div>'; |
|
| 555 | - $return .= ' </div>'; |
|
| 556 | - $return .= " <div class='mega-col-settings'>"; |
|
| 557 | - $return .= " <input name='mega-hide-on-mobile' type='hidden' value='{$hide_on_mobile_checked}' />"; |
|
| 558 | - $return .= " <input name='mega-hide-on-desktop' type='hidden' value='{$hide_on_desktop_checked}'/>"; |
|
| 559 | - $return .= ' <label>' . __( 'Column class', 'megamenu' ) . '</label>'; |
|
| 560 | - $return .= " <input class='mega-column-class' type='text' value='{$col_class}' />"; |
|
| 561 | - $return .= " <button class='button button-primary mega-save-column-settings' type='submit'>" . __( 'Save', 'megamenu' ) . '</button>'; |
|
| 562 | - $return .= ' </div>'; |
|
| 563 | - $return .= " <div class='mega-col-widgets'>"; |
|
| 564 | - |
|
| 565 | - if ( isset( $col_data['items'] ) && count( $col_data['items'] ) ) { |
|
| 566 | - foreach ( $col_data['items'] as $item ) { |
|
| 567 | - $return .= '<div class="widget" title="' . esc_attr( $item['title'] ) . '" id="' . esc_attr( $item['id'] ) . '" data-type="' . esc_attr( $item['type'] ) . '" data-id="' . esc_attr( $item['id'] ) . '">'; |
|
| 568 | - $return .= ' <div class="widget-top">'; |
|
| 569 | - $return .= ' <div class="widget-title">'; |
|
| 570 | - $return .= ' <h4>' . esc_html( $item['title'] ) . '</h4>'; |
|
| 571 | - $return .= ' <span class="widget-desc">' . esc_html( $item['description'] ) . '</span>'; |
|
| 572 | - $return .= ' </div>'; |
|
| 573 | - $return .= ' <div class="widget-title-action">'; |
|
| 574 | - $return .= ' <a class="widget-option widget-action" title="' . esc_attr( __( 'Edit', 'megamenu' ) ) . '"></a>'; |
|
| 575 | - $return .= ' </div>'; |
|
| 576 | - $return .= ' </div>'; |
|
| 577 | - $return .= ' <div class="widget-inner widget-inside"></div>'; |
|
| 578 | - $return .= '</div>'; |
|
| 579 | - } |
|
| 580 | - } |
|
| 581 | - |
|
| 582 | - $return .= ' </div>'; |
|
| 583 | - $return .= ' </div>'; |
|
| 584 | - $return .= '</div>'; |
|
| 585 | - |
|
| 586 | - return $return; |
|
| 587 | - } |
|
| 588 | - |
|
| 589 | - |
|
| 590 | - /** |
|
| 591 | - * Return the HTML for the standard (non grid) mega menu builder |
|
| 592 | - * |
|
| 593 | - * @return string |
|
| 594 | - */ |
|
| 595 | - public function get_megamenu_html( $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 596 | - |
|
| 597 | - $widget_manager = new Mega_Menu_Widget_Manager(); |
|
| 598 | - |
|
| 599 | - $return = "<div id='widgets' data-columns='{$menu_item_meta['panel_columns']}'>"; |
|
| 600 | - |
|
| 601 | - $items = $widget_manager->get_widgets_and_menu_items_for_menu_id( $menu_item_id, $menu_id ); |
|
| 602 | - |
|
| 603 | - if ( count( $items ) ) { |
|
| 604 | - |
|
| 605 | - foreach ( $items as $item ) { |
|
| 606 | - $return .= '<div class="widget" title="' . esc_attr( $item['title'] ) . '" id="' . esc_attr( $item['id'] ) . '" data-columns="' . esc_attr( $item['columns'] ) . '" data-type="' . esc_attr( $item['type'] ) . '" data-id="' . esc_attr( $item['id'] ) . '">'; |
|
| 607 | - $return .= ' <div class="widget-top">'; |
|
| 608 | - $return .= ' <div class="widget-title-action">'; |
|
| 609 | - $return .= ' <a class="widget-option widget-contract" title="' . esc_attr( __( 'Contract', 'megamenu' ) ) . '"></a>'; |
|
| 610 | - $return .= ' <span class="widget-cols"><span class="widget-num-cols">' . $item['columns'] . '</span><span class="widget-of">/</span><span class="widget-total-cols">' . $menu_item_meta['panel_columns'] . '</span></span>'; |
|
| 611 | - $return .= ' <a class="widget-option widget-expand" title="' . esc_attr( __( 'Expand', 'megamenu' ) ) . '"></a>'; |
|
| 612 | - $return .= ' <a class="widget-option widget-action" title="' . esc_attr( __( 'Edit', 'megamenu' ) ) . '"></a>'; |
|
| 613 | - $return .= ' </div>'; |
|
| 614 | - $return .= ' <div class="widget-title">'; |
|
| 615 | - $return .= ' <h4>' . esc_html( $item['title'] ) . '</h4>'; |
|
| 616 | - $return .= ' </div>'; |
|
| 617 | - $return .= ' </div>'; |
|
| 618 | - $return .= ' <div class="widget-inner widget-inside"></div>'; |
|
| 619 | - $return .= '</div>'; |
|
| 620 | - } |
|
| 621 | - } else { |
|
| 622 | - $return .= "<p class='no_widgets'>" . __( 'No widgets found. Add a widget to this area using the Widget Selector (top right)', 'megamenu' ) . '</p>'; |
|
| 623 | - } |
|
| 624 | - |
|
| 625 | - $return .= '</div>'; |
|
| 626 | - |
|
| 627 | - return $return; |
|
| 628 | - } |
|
| 629 | - |
|
| 630 | - /** |
|
| 631 | - * Return the HTML to display in the 'General Settings' tab |
|
| 632 | - * |
|
| 633 | - * @since 1.7 |
|
| 634 | - * @return array |
|
| 635 | - */ |
|
| 636 | - public function add_general_settings_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 637 | - |
|
| 638 | - $return = '<form>'; |
|
| 639 | - $return .= ' <input type="hidden" name="menu_item_id" value="' . esc_attr( $menu_item_id ) . '" />'; |
|
| 640 | - $return .= ' <input type="hidden" name="action" value="mm_save_menu_item_settings" />'; |
|
| 641 | - $return .= ' <input type="hidden" name="_wpnonce" value="' . wp_create_nonce( 'megamenu_edit' ) . '" />'; |
|
| 642 | - $return .= ' <input type="hidden" name="tab" value="general_settings" />'; |
|
| 643 | - $return .= ' <h4 class="first">' . __( 'Menu Item Settings', 'megamenu' ) . '</h4>'; |
|
| 644 | - $return .= ' <table>'; |
|
| 645 | - $return .= ' <tr>'; |
|
| 646 | - $return .= ' <td class="mega-name">'; |
|
| 647 | - $return .= __( 'Hide text', 'megamenu' ); |
|
| 648 | - $return .= ' </td>'; |
|
| 649 | - $return .= ' <td class="mega-value">'; |
|
| 650 | - $return .= ' <input type="checkbox" name="settings[hide_text]" value="true" ' . checked( $menu_item_meta['hide_text'], 'true', false ) . ' />'; |
|
| 651 | - $return .= ' </td>'; |
|
| 652 | - $return .= ' </tr>'; |
|
| 653 | - $return .= ' <tr>'; |
|
| 654 | - $return .= ' <td class="mega-name">'; |
|
| 655 | - $return .= __( 'Hide arrow', 'megamenu' ); |
|
| 656 | - $return .= ' </td>'; |
|
| 657 | - $return .= ' <td class="mega-value">'; |
|
| 658 | - $return .= ' <input type="checkbox" name="settings[hide_arrow]" value="true" ' . checked( $menu_item_meta['hide_arrow'], 'true', false ) . ' />'; |
|
| 659 | - $return .= ' </td>'; |
|
| 660 | - $return .= ' </tr>'; |
|
| 661 | - $return .= ' <tr>'; |
|
| 662 | - $return .= ' <td class="mega-name">'; |
|
| 663 | - $return .= __( 'Disable link', 'megamenu' ); |
|
| 664 | - $return .= ' </td>'; |
|
| 665 | - $return .= ' <td class="mega-value">'; |
|
| 666 | - $return .= ' <input type="checkbox" name="settings[disable_link]" value="true" ' . checked( $menu_item_meta['disable_link'], 'true', false ) . ' />'; |
|
| 667 | - $return .= ' </td>'; |
|
| 668 | - $return .= ' </tr>'; |
|
| 669 | - $return .= ' <tr>'; |
|
| 670 | - $return .= ' <td class="mega-name">'; |
|
| 671 | - $return .= __( 'Hide item on mobile', 'megamenu' ); |
|
| 672 | - $return .= ' </td>'; |
|
| 673 | - $return .= ' <td class="mega-value">'; |
|
| 674 | - $return .= ' <input type="checkbox" name="settings[hide_on_mobile]" value="true" ' . checked( $menu_item_meta['hide_on_mobile'], 'true', false ) . ' />'; |
|
| 675 | - $return .= ' </td>'; |
|
| 676 | - $return .= ' </tr>'; |
|
| 677 | - $return .= ' <tr>'; |
|
| 678 | - $return .= ' <td class="mega-name">'; |
|
| 679 | - $return .= __( 'Hide item on desktop', 'megamenu' ); |
|
| 680 | - $return .= ' </td>'; |
|
| 681 | - $return .= ' <td class="mega-value">'; |
|
| 682 | - $return .= ' <input type="checkbox" name="settings[hide_on_desktop]" value="true" ' . checked( $menu_item_meta['hide_on_desktop'], 'true', false ) . ' />'; |
|
| 683 | - $return .= ' </td>'; |
|
| 684 | - $return .= ' </tr>'; |
|
| 685 | - $return .= ' <td class="mega-name">'; |
|
| 686 | - $return .= __( 'Close sub menu when clicked', 'megamenu' ); |
|
| 687 | - $return .= ' </td>'; |
|
| 688 | - $return .= ' <td class="mega-value">'; |
|
| 689 | - $return .= ' <input type="checkbox" name="settings[close_after_click]" value="true" ' . checked( $menu_item_meta['close_after_click'], 'true', false ) . ' />'; |
|
| 690 | - $return .= ' <div class="mega-description">'; |
|
| 691 | - $return .= __( 'Intended for use on anchor links (e.g. #about)', 'megamenu' ); |
|
| 692 | - $return .= ' </div>'; $return .= ' </td>'; |
|
| 693 | - $return .= ' </tr>'; |
|
| 694 | - $return .= ' <tr class="mega-menu-item-align">'; |
|
| 695 | - $return .= ' <td class="mega-name">'; |
|
| 696 | - $return .= __( 'Menu item align', 'megamenu' ); |
|
| 697 | - $return .= ' </td>'; |
|
| 698 | - $return .= ' <td class="mega-value">'; |
|
| 699 | - |
|
| 700 | - if ( $menu_item_depth == 0 ) { |
|
| 701 | - |
|
| 702 | - $item_align = $menu_item_meta['item_align']; |
|
| 703 | - |
|
| 704 | - $float_left_display = $item_align == 'float-left' ? 'block' : 'none'; |
|
| 705 | - $left_display = $item_align == 'left' ? 'block' : 'none'; |
|
| 706 | - $right_display = $item_align == 'right' ? 'block' : 'none'; |
|
| 707 | - |
|
| 708 | - $return .= ' <select id="mega-item-align" name="settings[item_align]">'; |
|
| 709 | - $return .= ' <option value="float-left" ' . selected( $menu_item_meta['item_align'], 'float-left', false ) . '>' . __( 'Left', 'megamenu' ) . '</option>'; |
|
| 710 | - $return .= ' <option value="left" ' . selected( $menu_item_meta['item_align'], 'left', false ) . '>' . __( 'Default', 'megamenu' ) . '</option>'; |
|
| 711 | - $return .= ' <option value="right" ' . selected( $menu_item_meta['item_align'], 'right', false ) . '>' . __( 'Right', 'megamenu' ) . '</option>'; |
|
| 712 | - $return .= ' </select>'; |
|
| 713 | - $return .= ' <div class="mega-description">'; |
|
| 714 | - $return .= " <div class='float-left' style='display:{$float_left_display}'></div>"; |
|
| 715 | - $return .= " <div class='left' style='display:{$left_display}'>" . __( "Item will be aligned based on the 'Menu Items Align' option set in the Theme Editor", 'megamenu' ) . '</div>'; |
|
| 716 | - $return .= " <div class='right' style='display:{$right_display}'>" . __( 'Right aligned items will appear in reverse order on the right hand side of the menu bar', 'megamenu' ) . '</div>'; |
|
| 717 | - $return .= ' </div>'; |
|
| 718 | - } else { |
|
| 719 | - $return .= '<em>' . __( 'Option only available for top level menu items', 'megamenu' ) . '</em>'; |
|
| 720 | - } |
|
| 721 | - |
|
| 722 | - $return .= ' </td>'; |
|
| 723 | - $return .= ' </tr>'; |
|
| 724 | - $return .= ' <tr class="mega-menu-icon-position">'; |
|
| 725 | - $return .= ' <td class="mega-name">'; |
|
| 726 | - $return .= __( 'Icon position', 'megamenu' ); |
|
| 727 | - $return .= ' </td>'; |
|
| 728 | - $return .= ' <td class="mega-value">'; |
|
| 729 | - $return .= ' <select name="settings[icon_position]">'; |
|
| 730 | - $return .= ' <option value="left" ' . selected( $menu_item_meta['icon_position'], 'left', false ) . '>' . __( 'Left', 'megamenu' ) . '</option>'; |
|
| 731 | - $return .= ' <option value="top" ' . selected( $menu_item_meta['icon_position'], 'top', false ) . '>' . __( 'Top', 'megamenu' ) . '</option>'; |
|
| 732 | - $return .= ' <option value="right" ' . selected( $menu_item_meta['icon_position'], 'right', false ) . '>' . __( 'Right', 'megamenu' ) . '</option>'; |
|
| 733 | - $return .= ' </select>'; |
|
| 734 | - |
|
| 735 | - $return .= ' </td>'; |
|
| 736 | - $return .= ' </tr>'; |
|
| 737 | - |
|
| 738 | - $return .= apply_filters( 'megamenu_after_menu_item_settings', '', $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 739 | - |
|
| 740 | - $return .= ' </table>'; |
|
| 741 | - |
|
| 742 | - $return .= ' <h4>' . __( 'Sub Menu Settings', 'megamenu' ) . '</h4>'; |
|
| 743 | - |
|
| 744 | - $return .= ' <table>'; |
|
| 745 | - $return .= ' <tr class="mega-sub-menu-align">'; |
|
| 746 | - $return .= ' <td class="mega-name">'; |
|
| 747 | - $return .= __( 'Sub menu align', 'megamenu' ); |
|
| 748 | - $return .= ' </td>'; |
|
| 749 | - $return .= ' <td class="mega-value">'; |
|
| 750 | - |
|
| 751 | - if ( $menu_item_depth == 0 ) { |
|
| 752 | - $return .= ' <select name="settings[align]">'; |
|
| 753 | - $return .= ' <option value="bottom-left" ' . selected( $menu_item_meta['align'], 'bottom-left', false ) . '>' . __( 'Left edge of Parent', 'megamenu' ) . '</option>'; |
|
| 754 | - $return .= ' <option value="bottom-right" ' . selected( $menu_item_meta['align'], 'bottom-right', false ) . '>' . __( 'Right edge of Parent', 'megamenu' ) . '</option>'; |
|
| 755 | - $return .= ' </select>'; |
|
| 756 | - $return .= ' <div class="mega-description">'; |
|
| 757 | - $return .= __( 'Right aligned flyout menus will expand to the left', 'megamenu' ); |
|
| 758 | - $return .= ' </div>'; |
|
| 759 | - } else { |
|
| 760 | - $return .= '<em>' . __( 'Option only available for top level menu items', 'megamenu' ) . '</em>'; |
|
| 761 | - } |
|
| 762 | - |
|
| 763 | - $return .= ' </td>'; |
|
| 764 | - $return .= ' </tr>'; |
|
| 765 | - $return .= ' <tr>'; |
|
| 766 | - $return .= ' <td class="mega-name">'; |
|
| 767 | - $return .= __( 'Hide sub menu on mobile', 'megamenu' ); |
|
| 768 | - $return .= ' </td>'; |
|
| 769 | - $return .= ' <td class="mega-value">'; |
|
| 770 | - $return .= ' <input type="checkbox" name="settings[hide_sub_menu_on_mobile]" value="true" ' . checked( $menu_item_meta['hide_sub_menu_on_mobile'], 'true', false ) . ' />'; |
|
| 771 | - $return .= ' </td>'; |
|
| 772 | - $return .= ' </tr>'; |
|
| 773 | - |
|
| 774 | - if ( $menu_item_depth > 0 ) { |
|
| 775 | - $css_version = get_transient( 'megamenu_css_version' ); |
|
| 776 | - $notice = ''; |
|
| 777 | - |
|
| 778 | - if ( $css_version && version_compare( $css_version, '2.6.1', '<' ) ) { |
|
| 779 | - $link = "<a href='" . esc_attr( admin_url( 'admin.php?page=maxmegamenu_tools' ) ) . "'>" . __( 'Mega Menu' ) . ' > ' . __( 'Tools' ) . '</a>'; |
|
| 780 | - $notice = "<div class='notice notice-success'><p>"; |
|
| 781 | - $notice .= sprintf( __( 'Your menu CSS needs to be updated before you can use the following setting. Please go to %s and Clear the CSS Cache (you will only need to do this once).', 'megamenu' ), $link ); |
|
| 782 | - $notice .= '</p></div>'; |
|
| 783 | - $notice .= '</div><br />'; |
|
| 784 | - } |
|
| 785 | - |
|
| 786 | - $return .= ' <tr>'; |
|
| 787 | - $return .= ' <td class="mega-name">'; |
|
| 788 | - $return .= __( 'Collapse sub menu', 'megamenu' ); |
|
| 789 | - $return .= ' </td>'; |
|
| 790 | - $return .= ' <td class="mega-value">'; |
|
| 791 | - $return .= $notice; |
|
| 792 | - $return .= ' <input type="checkbox" name="settings[collapse_children]" value="true" ' . checked( $menu_item_meta['collapse_children'], 'true', false ) . ' />'; |
|
| 793 | - $return .= ' <em>' . __( 'Only applies to menu items displayed within mega sub menus.', 'megamenu' ) . '</em>'; |
|
| 794 | - $return .= ' </td>'; |
|
| 795 | - $return .= ' </tr>'; |
|
| 796 | - } |
|
| 797 | - |
|
| 798 | - $return .= apply_filters( 'megamenu_after_menu_item_submenu_settings', '', $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 799 | - |
|
| 800 | - $return .= ' </table>'; |
|
| 801 | - |
|
| 802 | - $return .= get_submit_button(); |
|
| 803 | - $return .= '</form>'; |
|
| 804 | - |
|
| 805 | - $tabs['general_settings'] = array( |
|
| 806 | - 'title' => __( 'Settings', 'megamenu' ), |
|
| 807 | - 'content' => $return, |
|
| 808 | - ); |
|
| 809 | - |
|
| 810 | - return $tabs; |
|
| 811 | - |
|
| 812 | - } |
|
| 813 | - |
|
| 814 | - |
|
| 815 | - /** |
|
| 816 | - * Return the HTML to display in the 'menu icon' tab |
|
| 817 | - * |
|
| 818 | - * @since 1.7 |
|
| 819 | - * @return array |
|
| 820 | - */ |
|
| 821 | - public function add_icon_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 822 | - |
|
| 823 | - $icon_tabs = array( |
|
| 824 | - 'dashicons' => array( |
|
| 825 | - 'title' => __( 'Dashicons', 'megamenu' ), |
|
| 826 | - 'active' => ! isset( $menu_item_meta['icon'] ) || ( isset( $menu_item_meta['icon'] ) && substr( $menu_item_meta['icon'], 0, strlen( 'dash' ) ) === 'dash' || $menu_item_meta['icon'] == 'disabled' ), |
|
| 827 | - 'content' => $this->dashicon_selector(), |
|
| 828 | - ), |
|
| 829 | - 'fontawesome' => array( |
|
| 830 | - 'title' => __( 'Font Awesome', 'megamenu' ), |
|
| 831 | - 'active' => false, |
|
| 832 | - 'content' => str_replace( '{link}', "<a target='_blank' href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __( 'Max Mega Menu Pro', 'megamenu' ) . '</a>', __( 'Get access to over 400 Font Awesome Icons with {link}', 'megamenu' ) ), |
|
| 833 | - ), |
|
| 834 | - 'genericons' => array( |
|
| 835 | - 'title' => __( 'Genericons', 'megamenu' ), |
|
| 836 | - 'active' => false, |
|
| 837 | - 'content' => str_replace( '{link}', "<a target='_blank' href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __( 'Max Mega Menu Pro', 'megamenu' ) . '</a>', __( 'Choose from over 100 genericons with {link}', 'megamenu' ) ), |
|
| 838 | - ), |
|
| 839 | - 'custom' => array( |
|
| 840 | - 'title' => __( 'Custom Icon', 'megamenu' ), |
|
| 841 | - 'active' => false, |
|
| 842 | - 'content' => str_replace( '{link}', "<a target='_blank' href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __( 'Max Mega Menu Pro', 'megamenu' ) . '</a>', __( 'Select icons from your media library with {link}', 'megamenu' ) ), |
|
| 843 | - ), |
|
| 844 | - ); |
|
| 845 | - |
|
| 846 | - $icon_tabs = apply_filters( 'megamenu_icon_tabs', $icon_tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 847 | - |
|
| 848 | - $return = "<h4 class='first'>" . __( 'Menu Item Icon', 'megamenu' ) . '</h4>'; |
|
| 849 | - $return .= "<ul class='mm_tabs horizontal'>"; |
|
| 850 | - |
|
| 851 | - foreach ( $icon_tabs as $id => $icon_tab ) { |
|
| 852 | - |
|
| 853 | - $active = $icon_tab['active'] || count( $icon_tabs ) === 1 ? 'active' : ''; |
|
| 854 | - |
|
| 855 | - $return .= "<li rel='mm_tab_{$id}' class='mm_tab_horizontal {$active}'>"; |
|
| 856 | - $return .= esc_html( $icon_tab['title'] ); |
|
| 857 | - $return .= '</li>'; |
|
| 858 | - |
|
| 859 | - } |
|
| 860 | - |
|
| 861 | - $return .= '</ul>'; |
|
| 862 | - |
|
| 863 | - $return .= "<input type='text' class='filter_icons' placeholder='" . __( 'Search', 'megamenu' ) . "' /><div class='clear'></div>"; |
|
| 864 | - |
|
| 865 | - foreach ( $icon_tabs as $id => $icon_tab ) { |
|
| 866 | - |
|
| 867 | - $display = $icon_tab['active'] ? 'block' : 'none'; |
|
| 868 | - |
|
| 869 | - $return .= "<div class='mm_tab_{$id}' style='display: {$display}'>"; |
|
| 870 | - $return .= " <form class='icon_selector icon_selector_{$id}'>"; |
|
| 871 | - $return .= " <input type='hidden' name='_wpnonce' value='" . wp_create_nonce( 'megamenu_edit' ) . "' />"; |
|
| 872 | - $return .= " <input type='hidden' name='menu_item_id' value='" . esc_attr( $menu_item_id ) . "' />"; |
|
| 873 | - $return .= " <input type='hidden' name='action' value='mm_save_menu_item_settings' />"; |
|
| 874 | - $return .= $icon_tab['content']; |
|
| 875 | - $return .= ' </form>'; |
|
| 876 | - $return .= '</div>'; |
|
| 877 | - |
|
| 878 | - } |
|
| 879 | - |
|
| 880 | - $tabs['menu_icon'] = array( |
|
| 881 | - 'title' => __( 'Icon', 'megamenu' ), |
|
| 882 | - 'content' => $return, |
|
| 883 | - ); |
|
| 884 | - |
|
| 885 | - return $tabs; |
|
| 886 | - |
|
| 887 | - } |
|
| 888 | - |
|
| 889 | - /** |
|
| 890 | - * Return the form to select a dashicon |
|
| 891 | - * |
|
| 892 | - * @since 1.5.2 |
|
| 893 | - * @return string |
|
| 894 | - */ |
|
| 895 | - private function dashicon_selector() { |
|
| 896 | - |
|
| 897 | - $return = "<div class='disabled'><input id='disabled' class='radio' type='radio' rel='disabled' name='settings[icon]' value='disabled' " . checked( $this->menu_item_meta['icon'], 'disabled', false ) . ' />'; |
|
| 898 | - $return .= "<label for='disabled'></label></div>"; |
|
| 899 | - |
|
| 900 | - foreach ( $this->all_icons() as $code => $class ) { |
|
| 901 | - |
|
| 902 | - $bits = explode( '-', $code ); |
|
| 903 | - $code = '&#x' . $bits[1] . ''; |
|
| 904 | - $type = $bits[0]; |
|
| 905 | - |
|
| 906 | - $return .= "<div class='{$type}'>"; |
|
| 907 | - $return .= " <input class='radio' id='{$class}' type='radio' rel='{$code}' name='settings[icon]' value='{$class}' " . checked( $this->menu_item_meta['icon'], $class, false ) . ' />'; |
|
| 908 | - $return .= " <label rel='{$code}' for='{$class}' title='{$class}'></label>"; |
|
| 909 | - $return .= '</div>'; |
|
| 910 | - |
|
| 911 | - } |
|
| 912 | - |
|
| 913 | - return $return; |
|
| 914 | - } |
|
| 915 | - |
|
| 916 | - |
|
| 917 | - /** |
|
| 918 | - * List of all available DashIcon classes. |
|
| 919 | - * |
|
| 920 | - * @since 1.0 |
|
| 921 | - * @return array - Sorted list of icon classes |
|
| 922 | - */ |
|
| 923 | - public function all_icons() { |
|
| 924 | - |
|
| 925 | - $icons = array( |
|
| 926 | - 'dash-f333' => 'dashicons-menu', |
|
| 927 | - 'dash-f228' => 'dashicons-menu-alt', |
|
| 928 | - 'dash-f329' => 'dashicons-menu-alt2', |
|
| 929 | - 'dash-f349' => 'dashicons-menu-alt3', |
|
| 930 | - 'dash-f319' => 'dashicons-admin-site', |
|
| 931 | - 'dash-f11d' => 'dashicons-admin-site-alt', |
|
| 932 | - 'dash-f11e' => 'dashicons-admin-site-alt2', |
|
| 933 | - 'dash-f11f' => 'dashicons-admin-site-alt3', |
|
| 934 | - 'dash-f226' => 'dashicons-dashboard', |
|
| 935 | - 'dash-f109' => 'dashicons-admin-post', |
|
| 936 | - 'dash-f104' => 'dashicons-admin-media', |
|
| 937 | - 'dash-f103' => 'dashicons-admin-links', |
|
| 938 | - 'dash-f105' => 'dashicons-admin-page', |
|
| 939 | - 'dash-f101' => 'dashicons-admin-comments', |
|
| 940 | - 'dash-f100' => 'dashicons-admin-appearance', |
|
| 941 | - 'dash-f106' => 'dashicons-admin-plugins', |
|
| 942 | - 'dash-f485' => 'dashicons-plugins-checked', |
|
| 943 | - 'dash-f110' => 'dashicons-admin-users', |
|
| 944 | - 'dash-f107' => 'dashicons-admin-tools', |
|
| 945 | - 'dash-f108' => 'dashicons-admin-settings', |
|
| 946 | - 'dash-f112' => 'dashicons-admin-network', |
|
| 947 | - 'dash-f102' => 'dashicons-admin-home', |
|
| 948 | - 'dash-f111' => 'dashicons-admin-generic', |
|
| 949 | - 'dash-f148' => 'dashicons-admin-collapse', |
|
| 950 | - 'dash-f536' => 'dashicons-filter', |
|
| 951 | - 'dash-f540' => 'dashicons-admin-customizer', |
|
| 952 | - 'dash-f541' => 'dashicons-admin-multisite', |
|
| 953 | - 'dash-f119' => 'dashicons-welcome-write-blog', |
|
| 954 | - 'dash-f133' => 'dashicons-welcome-add-page', |
|
| 955 | - 'dash-f115' => 'dashicons-welcome-view-site', |
|
| 956 | - 'dash-f116' => 'dashicons-welcome-widgets-menus', |
|
| 957 | - 'dash-f117' => 'dashicons-welcome-comments', |
|
| 958 | - 'dash-f118' => 'dashicons-welcome-learn-more', |
|
| 959 | - 'dash-f123' => 'dashicons-format-aside', |
|
| 960 | - 'dash-f128' => 'dashicons-format-image', |
|
| 961 | - 'dash-f161' => 'dashicons-format-gallery', |
|
| 962 | - 'dash-f126' => 'dashicons-format-video', |
|
| 963 | - 'dash-f130' => 'dashicons-format-status', |
|
| 964 | - 'dash-f122' => 'dashicons-format-quote', |
|
| 965 | - 'dash-f125' => 'dashicons-format-chat', |
|
| 966 | - 'dash-f127' => 'dashicons-format-audio', |
|
| 967 | - 'dash-f306' => 'dashicons-camera', |
|
| 968 | - 'dash-f129' => 'dashicons-camera-alt', |
|
| 969 | - 'dash-f232' => 'dashicons-images-alt', |
|
| 970 | - 'dash-f233' => 'dashicons-images-alt2', |
|
| 971 | - 'dash-f234' => 'dashicons-video-alt', |
|
| 972 | - 'dash-f235' => 'dashicons-video-alt2', |
|
| 973 | - 'dash-f236' => 'dashicons-video-alt3', |
|
| 974 | - 'dash-f501' => 'dashicons-media-archive', |
|
| 975 | - 'dash-f500' => 'dashicons-media-audio', |
|
| 976 | - 'dash-f499' => 'dashicons-media-code', |
|
| 977 | - 'dash-f498' => 'dashicons-media-default', |
|
| 978 | - 'dash-f497' => 'dashicons-media-document', |
|
| 979 | - 'dash-f496' => 'dashicons-media-interactive', |
|
| 980 | - 'dash-f495' => 'dashicons-media-spreadsheet', |
|
| 981 | - 'dash-f491' => 'dashicons-media-text', |
|
| 982 | - 'dash-f490' => 'dashicons-media-video', |
|
| 983 | - 'dash-f492' => 'dashicons-playlist-audio', |
|
| 984 | - 'dash-f493' => 'dashicons-playlist-video', |
|
| 985 | - 'dash-f522' => 'dashicons-controls-play', |
|
| 986 | - 'dash-f523' => 'dashicons-controls-pause', |
|
| 987 | - 'dash-f519' => 'dashicons-controls-forward', |
|
| 988 | - 'dash-f517' => 'dashicons-controls-skipforward', |
|
| 989 | - 'dash-f518' => 'dashicons-controls-back', |
|
| 990 | - 'dash-f516' => 'dashicons-controls-skipback', |
|
| 991 | - 'dash-f515' => 'dashicons-controls-repeat', |
|
| 992 | - 'dash-f521' => 'dashicons-controls-volumeon', |
|
| 993 | - 'dash-f520' => 'dashicons-controls-volumeoff', |
|
| 994 | - 'dash-f165' => 'dashicons-image-crop', |
|
| 995 | - 'dash-f531' => 'dashicons-image-rotate', |
|
| 996 | - 'dash-f166' => 'dashicons-image-rotate-left', |
|
| 997 | - 'dash-f167' => 'dashicons-image-rotate-right', |
|
| 998 | - 'dash-f168' => 'dashicons-image-flip-vertical', |
|
| 999 | - 'dash-f169' => 'dashicons-image-flip-horizontal', |
|
| 1000 | - 'dash-f533' => 'dashicons-image-filter', |
|
| 1001 | - 'dash-f171' => 'dashicons-undo', |
|
| 1002 | - 'dash-f172' => 'dashicons-redo', |
|
| 1003 | - 'dash-f170' => 'dashicons-database-add', |
|
| 1004 | - 'dash-f17e' => 'dashicons-database', |
|
| 1005 | - 'dash-f17a' => 'dashicons-database-export', |
|
| 1006 | - 'dash-f17b' => 'dashicons-database-import', |
|
| 1007 | - 'dash-f17c' => 'dashicons-database-remove', |
|
| 1008 | - 'dash-f17d' => 'dashicons-database-view', |
|
| 1009 | - 'dash-f134' => 'dashicons-align-full-width', |
|
| 1010 | - 'dash-f10a' => 'dashicons-align-pull-left', |
|
| 1011 | - 'dash-f10b' => 'dashicons-align-pull-right', |
|
| 1012 | - 'dash-f11b' => 'dashicons-align-wide', |
|
| 1013 | - 'dash-f12b' => 'dashicons-block-default', |
|
| 1014 | - 'dash-f11a' => 'dashicons-button', |
|
| 1015 | - 'dash-f137' => 'dashicons-cloud-saved', |
|
| 1016 | - 'dash-f13b' => 'dashicons-cloud-upload', |
|
| 1017 | - 'dash-f13c' => 'dashicons-columns', |
|
| 1018 | - 'dash-f13d' => 'dashicons-cover-image', |
|
| 1019 | - 'dash-f11c' => 'dashicons-ellipsis', |
|
| 1020 | - 'dash-f13e' => 'dashicons-embed-audio', |
|
| 1021 | - 'dash-f13f' => 'dashicons-embed-generic', |
|
| 1022 | - 'dash-f144' => 'dashicons-embed-photo', |
|
| 1023 | - 'dash-f146' => 'dashicons-embed-post', |
|
| 1024 | - 'dash-f149' => 'dashicons-embed-video', |
|
| 1025 | - 'dash-f14a' => 'dashicons-exit', |
|
| 1026 | - 'dash-f10e' => 'dashicons-heading', |
|
| 1027 | - 'dash-f14b' => 'dashicons-html', |
|
| 1028 | - 'dash-f14c' => 'dashicons-info-outline', |
|
| 1029 | - 'dash-f10f' => 'dashicons-insert', |
|
| 1030 | - 'dash-f14d' => 'dashicons-insert-after', |
|
| 1031 | - 'dash-f14e' => 'dashicons-insert-before', |
|
| 1032 | - 'dash-f14f' => 'dashicons-remove', |
|
| 1033 | - 'dash-f15e' => 'dashicons-saved', |
|
| 1034 | - 'dash-f150' => 'dashicons-shortcode', |
|
| 1035 | - 'dash-f151' => 'dashicons-table-col-after', |
|
| 1036 | - 'dash-f152' => 'dashicons-table-col-before', |
|
| 1037 | - 'dash-f15a' => 'dashicons-table-col-delete', |
|
| 1038 | - 'dash-f15b' => 'dashicons-table-row-after', |
|
| 1039 | - 'dash-f15c' => 'dashicons-table-row-before', |
|
| 1040 | - 'dash-f15d' => 'dashicons-table-row-delete', |
|
| 1041 | - 'dash-f200' => 'dashicons-editor-bold', |
|
| 1042 | - 'dash-f201' => 'dashicons-editor-italic', |
|
| 1043 | - 'dash-f203' => 'dashicons-editor-ul', |
|
| 1044 | - 'dash-f204' => 'dashicons-editor-ol', |
|
| 1045 | - 'dash-f12c' => 'dashicons-editor-ol-rtl', |
|
| 1046 | - 'dash-f205' => 'dashicons-editor-quote', |
|
| 1047 | - 'dash-f206' => 'dashicons-editor-alignleft', |
|
| 1048 | - 'dash-f207' => 'dashicons-editor-aligncenter', |
|
| 1049 | - 'dash-f208' => 'dashicons-editor-alignright', |
|
| 1050 | - 'dash-f209' => 'dashicons-editor-insertmore', |
|
| 1051 | - 'dash-f210' => 'dashicons-editor-spellcheck', |
|
| 1052 | - 'dash-f211' => 'dashicons-editor-expand', |
|
| 1053 | - 'dash-f506' => 'dashicons-editor-contract', |
|
| 1054 | - 'dash-f212' => 'dashicons-editor-kitchensink', |
|
| 1055 | - 'dash-f213' => 'dashicons-editor-underline', |
|
| 1056 | - 'dash-f214' => 'dashicons-editor-justify', |
|
| 1057 | - 'dash-f215' => 'dashicons-editor-textcolor', |
|
| 1058 | - 'dash-f216' => 'dashicons-editor-paste-word', |
|
| 1059 | - 'dash-f217' => 'dashicons-editor-paste-text', |
|
| 1060 | - 'dash-f218' => 'dashicons-editor-removeformatting', |
|
| 1061 | - 'dash-f219' => 'dashicons-editor-video', |
|
| 1062 | - 'dash-f220' => 'dashicons-editor-customchar', |
|
| 1063 | - 'dash-f221' => 'dashicons-editor-outdent', |
|
| 1064 | - 'dash-f222' => 'dashicons-editor-indent', |
|
| 1065 | - 'dash-f223' => 'dashicons-editor-help', |
|
| 1066 | - 'dash-f224' => 'dashicons-editor-strikethrough', |
|
| 1067 | - 'dash-f225' => 'dashicons-editor-unlink', |
|
| 1068 | - 'dash-f320' => 'dashicons-editor-rtl', |
|
| 1069 | - 'dash-f10c' => 'dashicons-editor-ltr', |
|
| 1070 | - 'dash-f474' => 'dashicons-editor-break', |
|
| 1071 | - 'dash-f475' => 'dashicons-editor-code', |
|
| 1072 | - 'dash-f476' => 'dashicons-editor-paragraph', |
|
| 1073 | - 'dash-f535' => 'dashicons-editor-table', |
|
| 1074 | - 'dash-f135' => 'dashicons-align-left', |
|
| 1075 | - 'dash-f136' => 'dashicons-align-right', |
|
| 1076 | - 'dash-f134' => 'dashicons-align-center', |
|
| 1077 | - 'dash-f138' => 'dashicons-align-none', |
|
| 1078 | - 'dash-f160' => 'dashicons-lock', |
|
| 1079 | - 'dash-f528' => 'dashicons-unlock', |
|
| 1080 | - 'dash-f145' => 'dashicons-calendar', |
|
| 1081 | - 'dash-f508' => 'dashicons-calendar-alt', |
|
| 1082 | - 'dash-f177' => 'dashicons-visibility', |
|
| 1083 | - 'dash-f530' => 'dashicons-hidden', |
|
| 1084 | - 'dash-f173' => 'dashicons-post-status', |
|
| 1085 | - 'dash-f464' => 'dashicons-edit', |
|
| 1086 | - 'dash-f182' => 'dashicons-trash', |
|
| 1087 | - 'dash-f537' => 'dashicons-sticky', |
|
| 1088 | - 'dash-f504' => 'dashicons-external', |
|
| 1089 | - 'dash-f142' => 'dashicons-arrow-up', |
|
| 1090 | - 'dash-f140' => 'dashicons-arrow-down', |
|
| 1091 | - 'dash-f139' => 'dashicons-arrow-right', |
|
| 1092 | - 'dash-f141' => 'dashicons-arrow-left', |
|
| 1093 | - 'dash-f342' => 'dashicons-arrow-up-alt', |
|
| 1094 | - 'dash-f346' => 'dashicons-arrow-down-alt', |
|
| 1095 | - 'dash-f344' => 'dashicons-arrow-right-alt', |
|
| 1096 | - 'dash-f340' => 'dashicons-arrow-left-alt', |
|
| 1097 | - 'dash-f343' => 'dashicons-arrow-up-alt2', |
|
| 1098 | - 'dash-f347' => 'dashicons-arrow-down-alt2', |
|
| 1099 | - 'dash-f345' => 'dashicons-arrow-right-alt2', |
|
| 1100 | - 'dash-f341' => 'dashicons-arrow-left-alt2', |
|
| 1101 | - 'dash-f156' => 'dashicons-sort', |
|
| 1102 | - 'dash-f229' => 'dashicons-leftright', |
|
| 1103 | - 'dash-f503' => 'dashicons-randomize', |
|
| 1104 | - 'dash-f163' => 'dashicons-list-view', |
|
| 1105 | - 'dash-f164' => 'dashicons-excerpt-view', |
|
| 1106 | - 'dash-f509' => 'dashicons-grid-view', |
|
| 1107 | - 'dash-f545' => 'dashicons-move', |
|
| 1108 | - 'dash-f237' => 'dashicons-share', |
|
| 1109 | - 'dash-f240' => 'dashicons-share-alt', |
|
| 1110 | - 'dash-f242' => 'dashicons-share-alt2', |
|
| 1111 | - 'dash-f303' => 'dashicons-rss', |
|
| 1112 | - 'dash-f465' => 'dashicons-email', |
|
| 1113 | - 'dash-f466' => 'dashicons-email-alt', |
|
| 1114 | - 'dash-f467' => 'dashicons-email-alt2', |
|
| 1115 | - 'dash-f325' => 'dashicons-networking', |
|
| 1116 | - 'dash-f162' => 'dashicons-amazon', |
|
| 1117 | - 'dash-f304' => 'dashicons-facebook', |
|
| 1118 | - 'dash-f305' => 'dashicons-facebook-alt', |
|
| 1119 | - 'dash-f18b' => 'dashicons-google', |
|
| 1120 | - 'dash-f462' => 'dashicons-googleplus', |
|
| 1121 | - 'dash-f12d' => 'dashicons-instagram', |
|
| 1122 | - 'dash-f18d' => 'dashicons-linkedin', |
|
| 1123 | - 'dash-f192' => 'dashicons-pinterest', |
|
| 1124 | - 'dash-f19c' => 'dashicons-podio', |
|
| 1125 | - 'dash-f195' => 'dashicons-reddit', |
|
| 1126 | - 'dash-f196' => 'dashicons-spotify', |
|
| 1127 | - 'dash-f199' => 'dashicons-twitch', |
|
| 1128 | - 'dash-f301' => 'dashicons-twitter', |
|
| 1129 | - 'dash-f302' => 'dashicons-twitter-alt', |
|
| 1130 | - 'dash-f19a' => 'dashicons-whatsapp', |
|
| 1131 | - 'dash-f19d' => 'dashicons-xing', |
|
| 1132 | - 'dash-f19b' => 'dashicons-youtube', |
|
| 1133 | - 'dash-f308' => 'dashicons-hammer', |
|
| 1134 | - 'dash-f309' => 'dashicons-art', |
|
| 1135 | - 'dash-f310' => 'dashicons-migrate', |
|
| 1136 | - 'dash-f311' => 'dashicons-performance', |
|
| 1137 | - 'dash-f483' => 'dashicons-universal-access', |
|
| 1138 | - 'dash-f507' => 'dashicons-universal-access-alt', |
|
| 1139 | - 'dash-f486' => 'dashicons-tickets', |
|
| 1140 | - 'dash-f484' => 'dashicons-nametag', |
|
| 1141 | - 'dash-f481' => 'dashicons-clipboard', |
|
| 1142 | - 'dash-f487' => 'dashicons-heart', |
|
| 1143 | - 'dash-f488' => 'dashicons-megaphone', |
|
| 1144 | - 'dash-f489' => 'dashicons-schedule', |
|
| 1145 | - 'dash-f10d' => 'dashicons-tide', |
|
| 1146 | - 'dash-f124' => 'dashicons-rest-api', |
|
| 1147 | - 'dash-f13a' => 'dashicons-code-standards', |
|
| 1148 | - 'dash-f452' => 'dashicons-buddicons-activity', |
|
| 1149 | - 'dash-f477' => 'dashicons-buddicons-bbpress-logo', |
|
| 1150 | - 'dash-f448' => 'dashicons-buddicons-buddypress-logo', |
|
| 1151 | - 'dash-f453' => 'dashicons-buddicons-community', |
|
| 1152 | - 'dash-f449' => 'dashicons-buddicons-forums', |
|
| 1153 | - 'dash-f454' => 'dashicons-buddicons-friends', |
|
| 1154 | - 'dash-f456' => 'dashicons-buddicons-groups', |
|
| 1155 | - 'dash-f457' => 'dashicons-buddicons-pm', |
|
| 1156 | - 'dash-f451' => 'dashicons-buddicons-replies', |
|
| 1157 | - 'dash-f450' => 'dashicons-buddicons-topics', |
|
| 1158 | - 'dash-f455' => 'dashicons-buddicons-tracking', |
|
| 1159 | - 'dash-f120' => 'dashicons-wordpress', |
|
| 1160 | - 'dash-f324' => 'dashicons-wordpress-alt', |
|
| 1161 | - 'dash-f157' => 'dashicons-pressthis', |
|
| 1162 | - 'dash-f463' => 'dashicons-update', |
|
| 1163 | - 'dash-f113' => 'dashicons-update-alt', |
|
| 1164 | - 'dash-f180' => 'dashicons-screenoptions', |
|
| 1165 | - 'dash-f348' => 'dashicons-info', |
|
| 1166 | - 'dash-f174' => 'dashicons-cart', |
|
| 1167 | - 'dash-f175' => 'dashicons-feedback', |
|
| 1168 | - 'dash-f176' => 'dashicons-cloud', |
|
| 1169 | - 'dash-f326' => 'dashicons-translation', |
|
| 1170 | - 'dash-f323' => 'dashicons-tag', |
|
| 1171 | - 'dash-f318' => 'dashicons-category', |
|
| 1172 | - 'dash-f480' => 'dashicons-archive', |
|
| 1173 | - 'dash-f479' => 'dashicons-tagcloud', |
|
| 1174 | - 'dash-f478' => 'dashicons-text', |
|
| 1175 | - 'dash-f16d' => 'dashicons-bell', |
|
| 1176 | - 'dash-f147' => 'dashicons-yes', |
|
| 1177 | - 'dash-f12a' => 'dashicons-yes-alt', |
|
| 1178 | - 'dash-f158' => 'dashicons-no', |
|
| 1179 | - 'dash-f335' => 'dashicons-no-alt', |
|
| 1180 | - 'dash-f132' => 'dashicons-plus', |
|
| 1181 | - 'dash-f502' => 'dashicons-plus-alt', |
|
| 1182 | - 'dash-f543' => 'dashicons-plus-alt2', |
|
| 1183 | - 'dash-f460' => 'dashicons-minus', |
|
| 1184 | - 'dash-f153' => 'dashicons-dismiss', |
|
| 1185 | - 'dash-f159' => 'dashicons-marker', |
|
| 1186 | - 'dash-f155' => 'dashicons-star-filled', |
|
| 1187 | - 'dash-f459' => 'dashicons-star-half', |
|
| 1188 | - 'dash-f154' => 'dashicons-star-empty', |
|
| 1189 | - 'dash-f227' => 'dashicons-flag', |
|
| 1190 | - 'dash-f534' => 'dashicons-warning', |
|
| 1191 | - 'dash-f230' => 'dashicons-location', |
|
| 1192 | - 'dash-f231' => 'dashicons-location-alt', |
|
| 1193 | - 'dash-f178' => 'dashicons-vault', |
|
| 1194 | - 'dash-f332' => 'dashicons-shield', |
|
| 1195 | - 'dash-f334' => 'dashicons-shield-alt', |
|
| 1196 | - 'dash-f468' => 'dashicons-sos', |
|
| 1197 | - 'dash-f179' => 'dashicons-search', |
|
| 1198 | - 'dash-f181' => 'dashicons-slides', |
|
| 1199 | - 'dash-f121' => 'dashicons-text-page', |
|
| 1200 | - 'dash-f183' => 'dashicons-analytics', |
|
| 1201 | - 'dash-f184' => 'dashicons-chart-pie', |
|
| 1202 | - 'dash-f185' => 'dashicons-chart-bar', |
|
| 1203 | - 'dash-f238' => 'dashicons-chart-line', |
|
| 1204 | - 'dash-f239' => 'dashicons-chart-area', |
|
| 1205 | - 'dash-f307' => 'dashicons-groups', |
|
| 1206 | - 'dash-f338' => 'dashicons-businessman', |
|
| 1207 | - 'dash-f12f' => 'dashicons-businesswoman', |
|
| 1208 | - 'dash-f12e' => 'dashicons-businessperson', |
|
| 1209 | - 'dash-f336' => 'dashicons-id', |
|
| 1210 | - 'dash-f337' => 'dashicons-id-alt', |
|
| 1211 | - 'dash-f312' => 'dashicons-products', |
|
| 1212 | - 'dash-f313' => 'dashicons-awards', |
|
| 1213 | - 'dash-f314' => 'dashicons-forms', |
|
| 1214 | - 'dash-f473' => 'dashicons-testimonial', |
|
| 1215 | - 'dash-f322' => 'dashicons-portfolio', |
|
| 1216 | - 'dash-f330' => 'dashicons-book', |
|
| 1217 | - 'dash-f331' => 'dashicons-book-alt', |
|
| 1218 | - 'dash-f316' => 'dashicons-download', |
|
| 1219 | - 'dash-f317' => 'dashicons-upload', |
|
| 1220 | - 'dash-f321' => 'dashicons-backup', |
|
| 1221 | - 'dash-f469' => 'dashicons-clock', |
|
| 1222 | - 'dash-f339' => 'dashicons-lightbulb', |
|
| 1223 | - 'dash-f482' => 'dashicons-microphone', |
|
| 1224 | - 'dash-f472' => 'dashicons-desktop', |
|
| 1225 | - 'dash-f547' => 'dashicons-laptop', |
|
| 1226 | - 'dash-f471' => 'dashicons-tablet', |
|
| 1227 | - 'dash-f470' => 'dashicons-smartphone', |
|
| 1228 | - 'dash-f525' => 'dashicons-phone', |
|
| 1229 | - 'dash-f510' => 'dashicons-index-card', |
|
| 1230 | - 'dash-f511' => 'dashicons-carrot', |
|
| 1231 | - 'dash-f512' => 'dashicons-building', |
|
| 1232 | - 'dash-f513' => 'dashicons-store', |
|
| 1233 | - 'dash-f514' => 'dashicons-album', |
|
| 1234 | - 'dash-f527' => 'dashicons-palmtree', |
|
| 1235 | - 'dash-f524' => 'dashicons-tickets-alt', |
|
| 1236 | - 'dash-f526' => 'dashicons-money', |
|
| 1237 | - 'dash-f18e' => 'dashicons-money-alt', |
|
| 1238 | - 'dash-f328' => 'dashicons-smiley', |
|
| 1239 | - 'dash-f529' => 'dashicons-thumbs-up', |
|
| 1240 | - 'dash-f542' => 'dashicons-thumbs-down', |
|
| 1241 | - 'dash-f538' => 'dashicons-layout', |
|
| 1242 | - 'dash-f546' => 'dashicons-paperclip', |
|
| 1243 | - 'dash-f131' => 'dashicons-color-picker', |
|
| 1244 | - 'dash-f327' => 'dashicons-edit-large', |
|
| 1245 | - 'dash-f186' => 'dashicons-edit-page', |
|
| 1246 | - 'dash-f15f' => 'dashicons-airplane', |
|
| 1247 | - 'dash-f16a' => 'dashicons-bank', |
|
| 1248 | - 'dash-f16c' => 'dashicons-beer', |
|
| 1249 | - 'dash-f16e' => 'dashicons-calculator', |
|
| 1250 | - 'dash-f16b' => 'dashicons-car', |
|
| 1251 | - 'dash-f16f' => 'dashicons-coffee', |
|
| 1252 | - 'dash-f17f' => 'dashicons-drumstick', |
|
| 1253 | - 'dash-f187' => 'dashicons-food', |
|
| 1254 | - 'dash-f188' => 'dashicons-fullscreen-alt', |
|
| 1255 | - 'dash-f189' => 'dashicons-fullscreen-exit-alt', |
|
| 1256 | - 'dash-f18a' => 'dashicons-games', |
|
| 1257 | - 'dash-f18c' => 'dashicons-hourglass', |
|
| 1258 | - 'dash-f18f' => 'dashicons-open-folder', |
|
| 1259 | - 'dash-f190' => 'dashicons-pdf', |
|
| 1260 | - 'dash-f191' => 'dashicons-pets', |
|
| 1261 | - 'dash-f193' => 'dashicons-printer', |
|
| 1262 | - 'dash-f194' => 'dashicons-privacy', |
|
| 1263 | - 'dash-f198' => 'dashicons-superhero', |
|
| 1264 | - 'dash-f197' => 'dashicons-superhero-alt', |
|
| 1265 | - ); |
|
| 1266 | - |
|
| 1267 | - $icons = apply_filters( 'megamenu_dashicons', $icons ); |
|
| 1268 | - |
|
| 1269 | - ksort( $icons ); |
|
| 1270 | - |
|
| 1271 | - return $icons; |
|
| 1272 | - } |
|
| 1273 | - } |
|
| 380 | + /** |
|
| 381 | + * Return the HTML to display in the Lightbox |
|
| 382 | + * |
|
| 383 | + * @since 2.4 |
|
| 384 | + * @return string |
|
| 385 | + */ |
|
| 386 | + public function ajax_get_empty_grid_row() { |
|
| 387 | + |
|
| 388 | + check_ajax_referer( 'megamenu_edit' ); |
|
| 389 | + |
|
| 390 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 391 | + |
|
| 392 | + if ( ! current_user_can( $capability ) ) { |
|
| 393 | + return; |
|
| 394 | + } |
|
| 395 | + |
|
| 396 | + $column_html = $this->get_grid_column(); |
|
| 397 | + |
|
| 398 | + $return = $this->get_grid_row( false, $column_html ); |
|
| 399 | + |
|
| 400 | + if ( ob_get_contents() ) { |
|
| 401 | + ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
|
| 402 | + } |
|
| 403 | + |
|
| 404 | + wp_send_json_success( $return ); |
|
| 405 | + } |
|
| 406 | + |
|
| 407 | + /** |
|
| 408 | + * Return the HTML for a single row |
|
| 409 | + * |
|
| 410 | + * @param array $row_data |
|
| 411 | + * @param string $column_html |
|
| 412 | + * @since 2.4 |
|
| 413 | + * @return string |
|
| 414 | + */ |
|
| 415 | + public function get_grid_row( $row_data = false, $column_html = false ) { |
|
| 416 | + |
|
| 417 | + $hide_on_desktop_checked = 'false'; |
|
| 418 | + $hide_on_desktop = 'mega-enabled'; |
|
| 419 | + |
|
| 420 | + if ( isset( $row_data['meta']['hide-on-desktop'] ) && $row_data['meta']['hide-on-desktop'] == 'true' ) { |
|
| 421 | + $hide_on_desktop = 'mega-disabled'; |
|
| 422 | + $hide_on_desktop_checked = 'true'; |
|
| 423 | + } |
|
| 424 | + |
|
| 425 | + $hide_on_mobile_checked = 'false'; |
|
| 426 | + $hide_on_mobile = 'mega-enabled'; |
|
| 427 | + |
|
| 428 | + if ( isset( $row_data['meta']['hide-on-mobile'] ) && $row_data['meta']['hide-on-mobile'] == 'true' ) { |
|
| 429 | + $hide_on_mobile = 'mega-disabled'; |
|
| 430 | + $hide_on_mobile_checked = 'true'; |
|
| 431 | + } |
|
| 432 | + |
|
| 433 | + $row_columns = 12; |
|
| 434 | + |
|
| 435 | + if ( isset( $row_data['meta']['columns'] ) ) { |
|
| 436 | + $row_columns = intval( $row_data['meta']['columns'] ); |
|
| 437 | + } |
|
| 438 | + |
|
| 439 | + $desktop_tooltip_visible = __( 'Row', 'megamenu' ) . ': ' . __( 'Visible on desktop', 'megamenu' ); |
|
| 440 | + $desktop_tooltip_hidden = __( 'Row', 'megamenu' ) . ': ' . __( 'Hidden on desktop', 'megamenu' ); |
|
| 441 | + $mobile_tooltip_visible = __( 'Row', 'megamenu' ) . ': ' . __( 'Visible on mobile', 'megamenu' ); |
|
| 442 | + $mobile_tooltip_hidden = __( 'Row', 'megamenu' ) . ': ' . __( 'Hidden on mobile', 'megamenu' ); |
|
| 443 | + |
|
| 444 | + $row_class = isset( $row_data['meta']['class'] ) ? $row_data['meta']['class'] : ''; |
|
| 445 | + |
|
| 446 | + $return = "<div class='mega-row' data-available-cols='{$row_columns}'>"; |
|
| 447 | + $return .= " <div class='mega-row-header'>"; |
|
| 448 | + $return .= " <div class='mega-row-actions'>"; |
|
| 449 | + $return .= " <span class='dashicons dashicons-sort'></span>"; |
|
| 450 | + $return .= " <span class='dashicons dashicons-admin-generic'></span>"; |
|
| 451 | + $return .= " <span class='mega-tooltip {$hide_on_desktop}' data-tooltip-enabled='{$desktop_tooltip_visible}' data-tooltip-disabled='{$desktop_tooltip_hidden}'><span class='dashicons dashicons-desktop'></span></span>"; |
|
| 452 | + $return .= " <span class='mega-tooltip {$hide_on_mobile}' data-tooltip-enabled='{$mobile_tooltip_visible}' data-tooltip-disabled='{$mobile_tooltip_hidden}'><span class='dashicons dashicons-smartphone'></span></span>"; |
|
| 453 | + $return .= " <span class='dashicons dashicons-trash'></span>"; |
|
| 454 | + $return .= ' </div>'; |
|
| 455 | + $return .= " <div class='mega-row-settings'>"; |
|
| 456 | + $return .= " <input name='mega-hide-on-mobile' type='hidden' value='{$hide_on_mobile_checked}' />"; |
|
| 457 | + $return .= " <input name='mega-hide-on-desktop' type='hidden' value='{$hide_on_desktop_checked}'/>"; |
|
| 458 | + $return .= " <div class='mega-settings-row'>"; |
|
| 459 | + $return .= ' <label>' . __( 'Row class', 'megamenu' ) . '</label>'; |
|
| 460 | + $return .= " <input class='mega-row-class' type='text' value='{$row_class}' />"; |
|
| 461 | + $return .= ' </div>'; |
|
| 462 | + $return .= " <div class='mega-settings-row'>"; |
|
| 463 | + $return .= ' <label>' . __( 'Row columns', 'megamenu' ) . '</label>'; |
|
| 464 | + $return .= " <select class='mega-row-columns'>"; |
|
| 465 | + $return .= " <option value='1' " . selected( $row_columns, 1, false ) . '>1 ' . __( 'column', 'megamenu' ) . '</option>'; |
|
| 466 | + $return .= " <option value='2' " . selected( $row_columns, 2, false ) . '>2 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 467 | + $return .= " <option value='3' " . selected( $row_columns, 3, false ) . '>3 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 468 | + $return .= " <option value='4' " . selected( $row_columns, 4, false ) . '>4 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 469 | + $return .= " <option value='5' " . selected( $row_columns, 5, false ) . '>5 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 470 | + $return .= " <option value='6' " . selected( $row_columns, 6, false ) . '>6 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 471 | + $return .= " <option value='7' " . selected( $row_columns, 7, false ) . '>7 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 472 | + $return .= " <option value='8' " . selected( $row_columns, 8, false ) . '>8 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 473 | + $return .= " <option value='9' " . selected( $row_columns, 9, false ) . '>9 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 474 | + $return .= " <option value='10' " . selected( $row_columns, 10, false ) . '>10 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 475 | + $return .= " <option value='11' " . selected( $row_columns, 11, false ) . '>11 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 476 | + $return .= " <option value='12' " . selected( $row_columns, 12, false ) . '>12 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 477 | + $return .= ' </select>'; |
|
| 478 | + $return .= ' </div>'; |
|
| 479 | + $return .= " <button class='button button-primary mega-save-row-settings' type='submit'>" . __( 'Save', 'megamenu' ) . '</button>'; |
|
| 480 | + $return .= ' </div>'; |
|
| 481 | + $return .= " <button class='button button-primary mega-add-column'><span class='dashicons dashicons-plus'></span>" . __( 'Column', 'megamenu' ) . '</button>'; |
|
| 482 | + $return .= ' </div>'; |
|
| 483 | + $return .= " <div class='error notice is-dismissible mega-too-many-cols'>"; |
|
| 484 | + $return .= ' <p>' . __( 'You should rearrange the content of this row so that all columns fit onto a single line.', 'megamenu' ) . '</p>'; |
|
| 485 | + $return .= ' </div>'; |
|
| 486 | + $return .= " <div class='error notice is-dismissible mega-row-is-full'>"; |
|
| 487 | + $return .= ' <p>' . __( 'There is not enough space on this row to add a new column.', 'megamenu' ) . '</p>'; |
|
| 488 | + $return .= ' </div>'; |
|
| 489 | + |
|
| 490 | + $return .= $column_html; |
|
| 491 | + |
|
| 492 | + $return .= '</div>'; |
|
| 493 | + |
|
| 494 | + return $return; |
|
| 495 | + } |
|
| 496 | + |
|
| 497 | + /** |
|
| 498 | + * Return the HTML for an individual grid column |
|
| 499 | + * |
|
| 500 | + * @param array $col_data |
|
| 501 | + * @since 2.4 |
|
| 502 | + * @return string |
|
| 503 | + */ |
|
| 504 | + public function get_grid_column( $row_data = false, $col_data = false ) { |
|
| 505 | + |
|
| 506 | + $col_span = 3; |
|
| 507 | + $row_columns = 12; |
|
| 508 | + |
|
| 509 | + if ( isset( $row_data['meta']['columns'] ) ) { |
|
| 510 | + $row_columns = intval( $row_data['meta']['columns'] ); |
|
| 511 | + } |
|
| 512 | + |
|
| 513 | + if ( isset( $col_data['meta']['span'] ) ) { |
|
| 514 | + $col_span = $col_data['meta']['span']; |
|
| 515 | + } |
|
| 516 | + |
|
| 517 | + $hide_on_desktop_checked = 'false'; |
|
| 518 | + $hide_on_desktop = 'mega-enabled'; |
|
| 519 | + |
|
| 520 | + if ( isset( $col_data['meta']['hide-on-desktop'] ) && $col_data['meta']['hide-on-desktop'] == 'true' ) { |
|
| 521 | + $hide_on_desktop = 'mega-disabled'; |
|
| 522 | + $hide_on_desktop_checked = 'true'; |
|
| 523 | + } |
|
| 524 | + |
|
| 525 | + $hide_on_mobile_checked = 'false'; |
|
| 526 | + $hide_on_mobile = 'mega-enabled'; |
|
| 527 | + |
|
| 528 | + if ( isset( $col_data['meta']['hide-on-mobile'] ) && $col_data['meta']['hide-on-mobile'] == 'true' ) { |
|
| 529 | + $hide_on_mobile = 'mega-disabled'; |
|
| 530 | + $hide_on_mobile_checked = 'true'; |
|
| 531 | + } |
|
| 532 | + |
|
| 533 | + $desktop_tooltip_visible = __( 'Column', 'megamenu' ) . ': ' . __( 'Visible on desktop', 'megamenu' ); |
|
| 534 | + $desktop_tooltip_hidden = __( 'Column', 'megamenu' ) . ': ' . __( 'Hidden on desktop', 'megamenu' ); |
|
| 535 | + $mobile_tooltip_visible = __( 'Column', 'megamenu' ) . ': ' . __( 'Visible on mobile', 'megamenu' ); |
|
| 536 | + $mobile_tooltip_hidden = __( 'Column', 'megamenu' ) . ': ' . __( 'Hidden on mobile', 'megamenu' ); |
|
| 537 | + |
|
| 538 | + $col_class = isset( $col_data['meta']['class'] ) ? $col_data['meta']['class'] : ''; |
|
| 539 | + |
|
| 540 | + $return = "<div class='mega-col' data-span='{$col_span}'>"; |
|
| 541 | + $return .= " <div class='mega-col-wrap'>"; |
|
| 542 | + $return .= " <div class='mega-col-header'>"; |
|
| 543 | + $return .= " <div class='mega-col-description'>"; |
|
| 544 | + $return .= " <span class='dashicons dashicons-move'></span>"; |
|
| 545 | + $return .= " <span class='dashicons dashicons-admin-generic'></span>"; |
|
| 546 | + $return .= " <span class='mega-tooltip {$hide_on_desktop}' data-tooltip-enabled='{$desktop_tooltip_visible}' data-tooltip-disabled='{$desktop_tooltip_hidden}'><span class='dashicons dashicons-desktop'></span></span>"; |
|
| 547 | + $return .= " <span class='mega-tooltip {$hide_on_mobile}' data-tooltip-enabled='{$mobile_tooltip_visible}' data-tooltip-disabled='{$mobile_tooltip_hidden}'><span class='dashicons dashicons-smartphone'></span></span>"; |
|
| 548 | + $return .= " <span class='dashicons dashicons-trash'></span>"; |
|
| 549 | + $return .= ' </div>'; |
|
| 550 | + $return .= ' <div class="mega-col-actions">'; |
|
| 551 | + $return .= ' <a class="mega-col-option mega-col-contract" title="' . esc_attr( __( 'Contract', 'megamenu' ) ) . '"><span class="dashicons dashicons-arrow-left-alt2"></span></a>'; |
|
| 552 | + $return .= " <span class='mega-col-cols'><span class='mega-num-cols'>{$col_span}</span><span class='mega-of'>/</span><span class='mega-num-total-cols'>" . $row_columns . '</span></span>'; |
|
| 553 | + $return .= ' <a class="mega-col-options mega-col-expand" title="' . esc_attr( __( 'Expand', 'megamenu' ) ) . '"><span class="dashicons dashicons-arrow-right-alt2"></span></a>'; |
|
| 554 | + $return .= ' </div>'; |
|
| 555 | + $return .= ' </div>'; |
|
| 556 | + $return .= " <div class='mega-col-settings'>"; |
|
| 557 | + $return .= " <input name='mega-hide-on-mobile' type='hidden' value='{$hide_on_mobile_checked}' />"; |
|
| 558 | + $return .= " <input name='mega-hide-on-desktop' type='hidden' value='{$hide_on_desktop_checked}'/>"; |
|
| 559 | + $return .= ' <label>' . __( 'Column class', 'megamenu' ) . '</label>'; |
|
| 560 | + $return .= " <input class='mega-column-class' type='text' value='{$col_class}' />"; |
|
| 561 | + $return .= " <button class='button button-primary mega-save-column-settings' type='submit'>" . __( 'Save', 'megamenu' ) . '</button>'; |
|
| 562 | + $return .= ' </div>'; |
|
| 563 | + $return .= " <div class='mega-col-widgets'>"; |
|
| 564 | + |
|
| 565 | + if ( isset( $col_data['items'] ) && count( $col_data['items'] ) ) { |
|
| 566 | + foreach ( $col_data['items'] as $item ) { |
|
| 567 | + $return .= '<div class="widget" title="' . esc_attr( $item['title'] ) . '" id="' . esc_attr( $item['id'] ) . '" data-type="' . esc_attr( $item['type'] ) . '" data-id="' . esc_attr( $item['id'] ) . '">'; |
|
| 568 | + $return .= ' <div class="widget-top">'; |
|
| 569 | + $return .= ' <div class="widget-title">'; |
|
| 570 | + $return .= ' <h4>' . esc_html( $item['title'] ) . '</h4>'; |
|
| 571 | + $return .= ' <span class="widget-desc">' . esc_html( $item['description'] ) . '</span>'; |
|
| 572 | + $return .= ' </div>'; |
|
| 573 | + $return .= ' <div class="widget-title-action">'; |
|
| 574 | + $return .= ' <a class="widget-option widget-action" title="' . esc_attr( __( 'Edit', 'megamenu' ) ) . '"></a>'; |
|
| 575 | + $return .= ' </div>'; |
|
| 576 | + $return .= ' </div>'; |
|
| 577 | + $return .= ' <div class="widget-inner widget-inside"></div>'; |
|
| 578 | + $return .= '</div>'; |
|
| 579 | + } |
|
| 580 | + } |
|
| 581 | + |
|
| 582 | + $return .= ' </div>'; |
|
| 583 | + $return .= ' </div>'; |
|
| 584 | + $return .= '</div>'; |
|
| 585 | + |
|
| 586 | + return $return; |
|
| 587 | + } |
|
| 588 | + |
|
| 589 | + |
|
| 590 | + /** |
|
| 591 | + * Return the HTML for the standard (non grid) mega menu builder |
|
| 592 | + * |
|
| 593 | + * @return string |
|
| 594 | + */ |
|
| 595 | + public function get_megamenu_html( $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 596 | + |
|
| 597 | + $widget_manager = new Mega_Menu_Widget_Manager(); |
|
| 598 | + |
|
| 599 | + $return = "<div id='widgets' data-columns='{$menu_item_meta['panel_columns']}'>"; |
|
| 600 | + |
|
| 601 | + $items = $widget_manager->get_widgets_and_menu_items_for_menu_id( $menu_item_id, $menu_id ); |
|
| 602 | + |
|
| 603 | + if ( count( $items ) ) { |
|
| 604 | + |
|
| 605 | + foreach ( $items as $item ) { |
|
| 606 | + $return .= '<div class="widget" title="' . esc_attr( $item['title'] ) . '" id="' . esc_attr( $item['id'] ) . '" data-columns="' . esc_attr( $item['columns'] ) . '" data-type="' . esc_attr( $item['type'] ) . '" data-id="' . esc_attr( $item['id'] ) . '">'; |
|
| 607 | + $return .= ' <div class="widget-top">'; |
|
| 608 | + $return .= ' <div class="widget-title-action">'; |
|
| 609 | + $return .= ' <a class="widget-option widget-contract" title="' . esc_attr( __( 'Contract', 'megamenu' ) ) . '"></a>'; |
|
| 610 | + $return .= ' <span class="widget-cols"><span class="widget-num-cols">' . $item['columns'] . '</span><span class="widget-of">/</span><span class="widget-total-cols">' . $menu_item_meta['panel_columns'] . '</span></span>'; |
|
| 611 | + $return .= ' <a class="widget-option widget-expand" title="' . esc_attr( __( 'Expand', 'megamenu' ) ) . '"></a>'; |
|
| 612 | + $return .= ' <a class="widget-option widget-action" title="' . esc_attr( __( 'Edit', 'megamenu' ) ) . '"></a>'; |
|
| 613 | + $return .= ' </div>'; |
|
| 614 | + $return .= ' <div class="widget-title">'; |
|
| 615 | + $return .= ' <h4>' . esc_html( $item['title'] ) . '</h4>'; |
|
| 616 | + $return .= ' </div>'; |
|
| 617 | + $return .= ' </div>'; |
|
| 618 | + $return .= ' <div class="widget-inner widget-inside"></div>'; |
|
| 619 | + $return .= '</div>'; |
|
| 620 | + } |
|
| 621 | + } else { |
|
| 622 | + $return .= "<p class='no_widgets'>" . __( 'No widgets found. Add a widget to this area using the Widget Selector (top right)', 'megamenu' ) . '</p>'; |
|
| 623 | + } |
|
| 624 | + |
|
| 625 | + $return .= '</div>'; |
|
| 626 | + |
|
| 627 | + return $return; |
|
| 628 | + } |
|
| 629 | + |
|
| 630 | + /** |
|
| 631 | + * Return the HTML to display in the 'General Settings' tab |
|
| 632 | + * |
|
| 633 | + * @since 1.7 |
|
| 634 | + * @return array |
|
| 635 | + */ |
|
| 636 | + public function add_general_settings_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 637 | + |
|
| 638 | + $return = '<form>'; |
|
| 639 | + $return .= ' <input type="hidden" name="menu_item_id" value="' . esc_attr( $menu_item_id ) . '" />'; |
|
| 640 | + $return .= ' <input type="hidden" name="action" value="mm_save_menu_item_settings" />'; |
|
| 641 | + $return .= ' <input type="hidden" name="_wpnonce" value="' . wp_create_nonce( 'megamenu_edit' ) . '" />'; |
|
| 642 | + $return .= ' <input type="hidden" name="tab" value="general_settings" />'; |
|
| 643 | + $return .= ' <h4 class="first">' . __( 'Menu Item Settings', 'megamenu' ) . '</h4>'; |
|
| 644 | + $return .= ' <table>'; |
|
| 645 | + $return .= ' <tr>'; |
|
| 646 | + $return .= ' <td class="mega-name">'; |
|
| 647 | + $return .= __( 'Hide text', 'megamenu' ); |
|
| 648 | + $return .= ' </td>'; |
|
| 649 | + $return .= ' <td class="mega-value">'; |
|
| 650 | + $return .= ' <input type="checkbox" name="settings[hide_text]" value="true" ' . checked( $menu_item_meta['hide_text'], 'true', false ) . ' />'; |
|
| 651 | + $return .= ' </td>'; |
|
| 652 | + $return .= ' </tr>'; |
|
| 653 | + $return .= ' <tr>'; |
|
| 654 | + $return .= ' <td class="mega-name">'; |
|
| 655 | + $return .= __( 'Hide arrow', 'megamenu' ); |
|
| 656 | + $return .= ' </td>'; |
|
| 657 | + $return .= ' <td class="mega-value">'; |
|
| 658 | + $return .= ' <input type="checkbox" name="settings[hide_arrow]" value="true" ' . checked( $menu_item_meta['hide_arrow'], 'true', false ) . ' />'; |
|
| 659 | + $return .= ' </td>'; |
|
| 660 | + $return .= ' </tr>'; |
|
| 661 | + $return .= ' <tr>'; |
|
| 662 | + $return .= ' <td class="mega-name">'; |
|
| 663 | + $return .= __( 'Disable link', 'megamenu' ); |
|
| 664 | + $return .= ' </td>'; |
|
| 665 | + $return .= ' <td class="mega-value">'; |
|
| 666 | + $return .= ' <input type="checkbox" name="settings[disable_link]" value="true" ' . checked( $menu_item_meta['disable_link'], 'true', false ) . ' />'; |
|
| 667 | + $return .= ' </td>'; |
|
| 668 | + $return .= ' </tr>'; |
|
| 669 | + $return .= ' <tr>'; |
|
| 670 | + $return .= ' <td class="mega-name">'; |
|
| 671 | + $return .= __( 'Hide item on mobile', 'megamenu' ); |
|
| 672 | + $return .= ' </td>'; |
|
| 673 | + $return .= ' <td class="mega-value">'; |
|
| 674 | + $return .= ' <input type="checkbox" name="settings[hide_on_mobile]" value="true" ' . checked( $menu_item_meta['hide_on_mobile'], 'true', false ) . ' />'; |
|
| 675 | + $return .= ' </td>'; |
|
| 676 | + $return .= ' </tr>'; |
|
| 677 | + $return .= ' <tr>'; |
|
| 678 | + $return .= ' <td class="mega-name">'; |
|
| 679 | + $return .= __( 'Hide item on desktop', 'megamenu' ); |
|
| 680 | + $return .= ' </td>'; |
|
| 681 | + $return .= ' <td class="mega-value">'; |
|
| 682 | + $return .= ' <input type="checkbox" name="settings[hide_on_desktop]" value="true" ' . checked( $menu_item_meta['hide_on_desktop'], 'true', false ) . ' />'; |
|
| 683 | + $return .= ' </td>'; |
|
| 684 | + $return .= ' </tr>'; |
|
| 685 | + $return .= ' <td class="mega-name">'; |
|
| 686 | + $return .= __( 'Close sub menu when clicked', 'megamenu' ); |
|
| 687 | + $return .= ' </td>'; |
|
| 688 | + $return .= ' <td class="mega-value">'; |
|
| 689 | + $return .= ' <input type="checkbox" name="settings[close_after_click]" value="true" ' . checked( $menu_item_meta['close_after_click'], 'true', false ) . ' />'; |
|
| 690 | + $return .= ' <div class="mega-description">'; |
|
| 691 | + $return .= __( 'Intended for use on anchor links (e.g. #about)', 'megamenu' ); |
|
| 692 | + $return .= ' </div>'; $return .= ' </td>'; |
|
| 693 | + $return .= ' </tr>'; |
|
| 694 | + $return .= ' <tr class="mega-menu-item-align">'; |
|
| 695 | + $return .= ' <td class="mega-name">'; |
|
| 696 | + $return .= __( 'Menu item align', 'megamenu' ); |
|
| 697 | + $return .= ' </td>'; |
|
| 698 | + $return .= ' <td class="mega-value">'; |
|
| 699 | + |
|
| 700 | + if ( $menu_item_depth == 0 ) { |
|
| 701 | + |
|
| 702 | + $item_align = $menu_item_meta['item_align']; |
|
| 703 | + |
|
| 704 | + $float_left_display = $item_align == 'float-left' ? 'block' : 'none'; |
|
| 705 | + $left_display = $item_align == 'left' ? 'block' : 'none'; |
|
| 706 | + $right_display = $item_align == 'right' ? 'block' : 'none'; |
|
| 707 | + |
|
| 708 | + $return .= ' <select id="mega-item-align" name="settings[item_align]">'; |
|
| 709 | + $return .= ' <option value="float-left" ' . selected( $menu_item_meta['item_align'], 'float-left', false ) . '>' . __( 'Left', 'megamenu' ) . '</option>'; |
|
| 710 | + $return .= ' <option value="left" ' . selected( $menu_item_meta['item_align'], 'left', false ) . '>' . __( 'Default', 'megamenu' ) . '</option>'; |
|
| 711 | + $return .= ' <option value="right" ' . selected( $menu_item_meta['item_align'], 'right', false ) . '>' . __( 'Right', 'megamenu' ) . '</option>'; |
|
| 712 | + $return .= ' </select>'; |
|
| 713 | + $return .= ' <div class="mega-description">'; |
|
| 714 | + $return .= " <div class='float-left' style='display:{$float_left_display}'></div>"; |
|
| 715 | + $return .= " <div class='left' style='display:{$left_display}'>" . __( "Item will be aligned based on the 'Menu Items Align' option set in the Theme Editor", 'megamenu' ) . '</div>'; |
|
| 716 | + $return .= " <div class='right' style='display:{$right_display}'>" . __( 'Right aligned items will appear in reverse order on the right hand side of the menu bar', 'megamenu' ) . '</div>'; |
|
| 717 | + $return .= ' </div>'; |
|
| 718 | + } else { |
|
| 719 | + $return .= '<em>' . __( 'Option only available for top level menu items', 'megamenu' ) . '</em>'; |
|
| 720 | + } |
|
| 721 | + |
|
| 722 | + $return .= ' </td>'; |
|
| 723 | + $return .= ' </tr>'; |
|
| 724 | + $return .= ' <tr class="mega-menu-icon-position">'; |
|
| 725 | + $return .= ' <td class="mega-name">'; |
|
| 726 | + $return .= __( 'Icon position', 'megamenu' ); |
|
| 727 | + $return .= ' </td>'; |
|
| 728 | + $return .= ' <td class="mega-value">'; |
|
| 729 | + $return .= ' <select name="settings[icon_position]">'; |
|
| 730 | + $return .= ' <option value="left" ' . selected( $menu_item_meta['icon_position'], 'left', false ) . '>' . __( 'Left', 'megamenu' ) . '</option>'; |
|
| 731 | + $return .= ' <option value="top" ' . selected( $menu_item_meta['icon_position'], 'top', false ) . '>' . __( 'Top', 'megamenu' ) . '</option>'; |
|
| 732 | + $return .= ' <option value="right" ' . selected( $menu_item_meta['icon_position'], 'right', false ) . '>' . __( 'Right', 'megamenu' ) . '</option>'; |
|
| 733 | + $return .= ' </select>'; |
|
| 734 | + |
|
| 735 | + $return .= ' </td>'; |
|
| 736 | + $return .= ' </tr>'; |
|
| 737 | + |
|
| 738 | + $return .= apply_filters( 'megamenu_after_menu_item_settings', '', $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 739 | + |
|
| 740 | + $return .= ' </table>'; |
|
| 741 | + |
|
| 742 | + $return .= ' <h4>' . __( 'Sub Menu Settings', 'megamenu' ) . '</h4>'; |
|
| 743 | + |
|
| 744 | + $return .= ' <table>'; |
|
| 745 | + $return .= ' <tr class="mega-sub-menu-align">'; |
|
| 746 | + $return .= ' <td class="mega-name">'; |
|
| 747 | + $return .= __( 'Sub menu align', 'megamenu' ); |
|
| 748 | + $return .= ' </td>'; |
|
| 749 | + $return .= ' <td class="mega-value">'; |
|
| 750 | + |
|
| 751 | + if ( $menu_item_depth == 0 ) { |
|
| 752 | + $return .= ' <select name="settings[align]">'; |
|
| 753 | + $return .= ' <option value="bottom-left" ' . selected( $menu_item_meta['align'], 'bottom-left', false ) . '>' . __( 'Left edge of Parent', 'megamenu' ) . '</option>'; |
|
| 754 | + $return .= ' <option value="bottom-right" ' . selected( $menu_item_meta['align'], 'bottom-right', false ) . '>' . __( 'Right edge of Parent', 'megamenu' ) . '</option>'; |
|
| 755 | + $return .= ' </select>'; |
|
| 756 | + $return .= ' <div class="mega-description">'; |
|
| 757 | + $return .= __( 'Right aligned flyout menus will expand to the left', 'megamenu' ); |
|
| 758 | + $return .= ' </div>'; |
|
| 759 | + } else { |
|
| 760 | + $return .= '<em>' . __( 'Option only available for top level menu items', 'megamenu' ) . '</em>'; |
|
| 761 | + } |
|
| 762 | + |
|
| 763 | + $return .= ' </td>'; |
|
| 764 | + $return .= ' </tr>'; |
|
| 765 | + $return .= ' <tr>'; |
|
| 766 | + $return .= ' <td class="mega-name">'; |
|
| 767 | + $return .= __( 'Hide sub menu on mobile', 'megamenu' ); |
|
| 768 | + $return .= ' </td>'; |
|
| 769 | + $return .= ' <td class="mega-value">'; |
|
| 770 | + $return .= ' <input type="checkbox" name="settings[hide_sub_menu_on_mobile]" value="true" ' . checked( $menu_item_meta['hide_sub_menu_on_mobile'], 'true', false ) . ' />'; |
|
| 771 | + $return .= ' </td>'; |
|
| 772 | + $return .= ' </tr>'; |
|
| 773 | + |
|
| 774 | + if ( $menu_item_depth > 0 ) { |
|
| 775 | + $css_version = get_transient( 'megamenu_css_version' ); |
|
| 776 | + $notice = ''; |
|
| 777 | + |
|
| 778 | + if ( $css_version && version_compare( $css_version, '2.6.1', '<' ) ) { |
|
| 779 | + $link = "<a href='" . esc_attr( admin_url( 'admin.php?page=maxmegamenu_tools' ) ) . "'>" . __( 'Mega Menu' ) . ' > ' . __( 'Tools' ) . '</a>'; |
|
| 780 | + $notice = "<div class='notice notice-success'><p>"; |
|
| 781 | + $notice .= sprintf( __( 'Your menu CSS needs to be updated before you can use the following setting. Please go to %s and Clear the CSS Cache (you will only need to do this once).', 'megamenu' ), $link ); |
|
| 782 | + $notice .= '</p></div>'; |
|
| 783 | + $notice .= '</div><br />'; |
|
| 784 | + } |
|
| 785 | + |
|
| 786 | + $return .= ' <tr>'; |
|
| 787 | + $return .= ' <td class="mega-name">'; |
|
| 788 | + $return .= __( 'Collapse sub menu', 'megamenu' ); |
|
| 789 | + $return .= ' </td>'; |
|
| 790 | + $return .= ' <td class="mega-value">'; |
|
| 791 | + $return .= $notice; |
|
| 792 | + $return .= ' <input type="checkbox" name="settings[collapse_children]" value="true" ' . checked( $menu_item_meta['collapse_children'], 'true', false ) . ' />'; |
|
| 793 | + $return .= ' <em>' . __( 'Only applies to menu items displayed within mega sub menus.', 'megamenu' ) . '</em>'; |
|
| 794 | + $return .= ' </td>'; |
|
| 795 | + $return .= ' </tr>'; |
|
| 796 | + } |
|
| 797 | + |
|
| 798 | + $return .= apply_filters( 'megamenu_after_menu_item_submenu_settings', '', $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 799 | + |
|
| 800 | + $return .= ' </table>'; |
|
| 801 | + |
|
| 802 | + $return .= get_submit_button(); |
|
| 803 | + $return .= '</form>'; |
|
| 804 | + |
|
| 805 | + $tabs['general_settings'] = array( |
|
| 806 | + 'title' => __( 'Settings', 'megamenu' ), |
|
| 807 | + 'content' => $return, |
|
| 808 | + ); |
|
| 809 | + |
|
| 810 | + return $tabs; |
|
| 811 | + |
|
| 812 | + } |
|
| 813 | + |
|
| 814 | + |
|
| 815 | + /** |
|
| 816 | + * Return the HTML to display in the 'menu icon' tab |
|
| 817 | + * |
|
| 818 | + * @since 1.7 |
|
| 819 | + * @return array |
|
| 820 | + */ |
|
| 821 | + public function add_icon_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 822 | + |
|
| 823 | + $icon_tabs = array( |
|
| 824 | + 'dashicons' => array( |
|
| 825 | + 'title' => __( 'Dashicons', 'megamenu' ), |
|
| 826 | + 'active' => ! isset( $menu_item_meta['icon'] ) || ( isset( $menu_item_meta['icon'] ) && substr( $menu_item_meta['icon'], 0, strlen( 'dash' ) ) === 'dash' || $menu_item_meta['icon'] == 'disabled' ), |
|
| 827 | + 'content' => $this->dashicon_selector(), |
|
| 828 | + ), |
|
| 829 | + 'fontawesome' => array( |
|
| 830 | + 'title' => __( 'Font Awesome', 'megamenu' ), |
|
| 831 | + 'active' => false, |
|
| 832 | + 'content' => str_replace( '{link}', "<a target='_blank' href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __( 'Max Mega Menu Pro', 'megamenu' ) . '</a>', __( 'Get access to over 400 Font Awesome Icons with {link}', 'megamenu' ) ), |
|
| 833 | + ), |
|
| 834 | + 'genericons' => array( |
|
| 835 | + 'title' => __( 'Genericons', 'megamenu' ), |
|
| 836 | + 'active' => false, |
|
| 837 | + 'content' => str_replace( '{link}', "<a target='_blank' href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __( 'Max Mega Menu Pro', 'megamenu' ) . '</a>', __( 'Choose from over 100 genericons with {link}', 'megamenu' ) ), |
|
| 838 | + ), |
|
| 839 | + 'custom' => array( |
|
| 840 | + 'title' => __( 'Custom Icon', 'megamenu' ), |
|
| 841 | + 'active' => false, |
|
| 842 | + 'content' => str_replace( '{link}', "<a target='_blank' href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __( 'Max Mega Menu Pro', 'megamenu' ) . '</a>', __( 'Select icons from your media library with {link}', 'megamenu' ) ), |
|
| 843 | + ), |
|
| 844 | + ); |
|
| 845 | + |
|
| 846 | + $icon_tabs = apply_filters( 'megamenu_icon_tabs', $icon_tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 847 | + |
|
| 848 | + $return = "<h4 class='first'>" . __( 'Menu Item Icon', 'megamenu' ) . '</h4>'; |
|
| 849 | + $return .= "<ul class='mm_tabs horizontal'>"; |
|
| 850 | + |
|
| 851 | + foreach ( $icon_tabs as $id => $icon_tab ) { |
|
| 852 | + |
|
| 853 | + $active = $icon_tab['active'] || count( $icon_tabs ) === 1 ? 'active' : ''; |
|
| 854 | + |
|
| 855 | + $return .= "<li rel='mm_tab_{$id}' class='mm_tab_horizontal {$active}'>"; |
|
| 856 | + $return .= esc_html( $icon_tab['title'] ); |
|
| 857 | + $return .= '</li>'; |
|
| 858 | + |
|
| 859 | + } |
|
| 860 | + |
|
| 861 | + $return .= '</ul>'; |
|
| 862 | + |
|
| 863 | + $return .= "<input type='text' class='filter_icons' placeholder='" . __( 'Search', 'megamenu' ) . "' /><div class='clear'></div>"; |
|
| 864 | + |
|
| 865 | + foreach ( $icon_tabs as $id => $icon_tab ) { |
|
| 866 | + |
|
| 867 | + $display = $icon_tab['active'] ? 'block' : 'none'; |
|
| 868 | + |
|
| 869 | + $return .= "<div class='mm_tab_{$id}' style='display: {$display}'>"; |
|
| 870 | + $return .= " <form class='icon_selector icon_selector_{$id}'>"; |
|
| 871 | + $return .= " <input type='hidden' name='_wpnonce' value='" . wp_create_nonce( 'megamenu_edit' ) . "' />"; |
|
| 872 | + $return .= " <input type='hidden' name='menu_item_id' value='" . esc_attr( $menu_item_id ) . "' />"; |
|
| 873 | + $return .= " <input type='hidden' name='action' value='mm_save_menu_item_settings' />"; |
|
| 874 | + $return .= $icon_tab['content']; |
|
| 875 | + $return .= ' </form>'; |
|
| 876 | + $return .= '</div>'; |
|
| 877 | + |
|
| 878 | + } |
|
| 879 | + |
|
| 880 | + $tabs['menu_icon'] = array( |
|
| 881 | + 'title' => __( 'Icon', 'megamenu' ), |
|
| 882 | + 'content' => $return, |
|
| 883 | + ); |
|
| 884 | + |
|
| 885 | + return $tabs; |
|
| 886 | + |
|
| 887 | + } |
|
| 888 | + |
|
| 889 | + /** |
|
| 890 | + * Return the form to select a dashicon |
|
| 891 | + * |
|
| 892 | + * @since 1.5.2 |
|
| 893 | + * @return string |
|
| 894 | + */ |
|
| 895 | + private function dashicon_selector() { |
|
| 896 | + |
|
| 897 | + $return = "<div class='disabled'><input id='disabled' class='radio' type='radio' rel='disabled' name='settings[icon]' value='disabled' " . checked( $this->menu_item_meta['icon'], 'disabled', false ) . ' />'; |
|
| 898 | + $return .= "<label for='disabled'></label></div>"; |
|
| 899 | + |
|
| 900 | + foreach ( $this->all_icons() as $code => $class ) { |
|
| 901 | + |
|
| 902 | + $bits = explode( '-', $code ); |
|
| 903 | + $code = '&#x' . $bits[1] . ''; |
|
| 904 | + $type = $bits[0]; |
|
| 905 | + |
|
| 906 | + $return .= "<div class='{$type}'>"; |
|
| 907 | + $return .= " <input class='radio' id='{$class}' type='radio' rel='{$code}' name='settings[icon]' value='{$class}' " . checked( $this->menu_item_meta['icon'], $class, false ) . ' />'; |
|
| 908 | + $return .= " <label rel='{$code}' for='{$class}' title='{$class}'></label>"; |
|
| 909 | + $return .= '</div>'; |
|
| 910 | + |
|
| 911 | + } |
|
| 912 | + |
|
| 913 | + return $return; |
|
| 914 | + } |
|
| 915 | + |
|
| 916 | + |
|
| 917 | + /** |
|
| 918 | + * List of all available DashIcon classes. |
|
| 919 | + * |
|
| 920 | + * @since 1.0 |
|
| 921 | + * @return array - Sorted list of icon classes |
|
| 922 | + */ |
|
| 923 | + public function all_icons() { |
|
| 924 | + |
|
| 925 | + $icons = array( |
|
| 926 | + 'dash-f333' => 'dashicons-menu', |
|
| 927 | + 'dash-f228' => 'dashicons-menu-alt', |
|
| 928 | + 'dash-f329' => 'dashicons-menu-alt2', |
|
| 929 | + 'dash-f349' => 'dashicons-menu-alt3', |
|
| 930 | + 'dash-f319' => 'dashicons-admin-site', |
|
| 931 | + 'dash-f11d' => 'dashicons-admin-site-alt', |
|
| 932 | + 'dash-f11e' => 'dashicons-admin-site-alt2', |
|
| 933 | + 'dash-f11f' => 'dashicons-admin-site-alt3', |
|
| 934 | + 'dash-f226' => 'dashicons-dashboard', |
|
| 935 | + 'dash-f109' => 'dashicons-admin-post', |
|
| 936 | + 'dash-f104' => 'dashicons-admin-media', |
|
| 937 | + 'dash-f103' => 'dashicons-admin-links', |
|
| 938 | + 'dash-f105' => 'dashicons-admin-page', |
|
| 939 | + 'dash-f101' => 'dashicons-admin-comments', |
|
| 940 | + 'dash-f100' => 'dashicons-admin-appearance', |
|
| 941 | + 'dash-f106' => 'dashicons-admin-plugins', |
|
| 942 | + 'dash-f485' => 'dashicons-plugins-checked', |
|
| 943 | + 'dash-f110' => 'dashicons-admin-users', |
|
| 944 | + 'dash-f107' => 'dashicons-admin-tools', |
|
| 945 | + 'dash-f108' => 'dashicons-admin-settings', |
|
| 946 | + 'dash-f112' => 'dashicons-admin-network', |
|
| 947 | + 'dash-f102' => 'dashicons-admin-home', |
|
| 948 | + 'dash-f111' => 'dashicons-admin-generic', |
|
| 949 | + 'dash-f148' => 'dashicons-admin-collapse', |
|
| 950 | + 'dash-f536' => 'dashicons-filter', |
|
| 951 | + 'dash-f540' => 'dashicons-admin-customizer', |
|
| 952 | + 'dash-f541' => 'dashicons-admin-multisite', |
|
| 953 | + 'dash-f119' => 'dashicons-welcome-write-blog', |
|
| 954 | + 'dash-f133' => 'dashicons-welcome-add-page', |
|
| 955 | + 'dash-f115' => 'dashicons-welcome-view-site', |
|
| 956 | + 'dash-f116' => 'dashicons-welcome-widgets-menus', |
|
| 957 | + 'dash-f117' => 'dashicons-welcome-comments', |
|
| 958 | + 'dash-f118' => 'dashicons-welcome-learn-more', |
|
| 959 | + 'dash-f123' => 'dashicons-format-aside', |
|
| 960 | + 'dash-f128' => 'dashicons-format-image', |
|
| 961 | + 'dash-f161' => 'dashicons-format-gallery', |
|
| 962 | + 'dash-f126' => 'dashicons-format-video', |
|
| 963 | + 'dash-f130' => 'dashicons-format-status', |
|
| 964 | + 'dash-f122' => 'dashicons-format-quote', |
|
| 965 | + 'dash-f125' => 'dashicons-format-chat', |
|
| 966 | + 'dash-f127' => 'dashicons-format-audio', |
|
| 967 | + 'dash-f306' => 'dashicons-camera', |
|
| 968 | + 'dash-f129' => 'dashicons-camera-alt', |
|
| 969 | + 'dash-f232' => 'dashicons-images-alt', |
|
| 970 | + 'dash-f233' => 'dashicons-images-alt2', |
|
| 971 | + 'dash-f234' => 'dashicons-video-alt', |
|
| 972 | + 'dash-f235' => 'dashicons-video-alt2', |
|
| 973 | + 'dash-f236' => 'dashicons-video-alt3', |
|
| 974 | + 'dash-f501' => 'dashicons-media-archive', |
|
| 975 | + 'dash-f500' => 'dashicons-media-audio', |
|
| 976 | + 'dash-f499' => 'dashicons-media-code', |
|
| 977 | + 'dash-f498' => 'dashicons-media-default', |
|
| 978 | + 'dash-f497' => 'dashicons-media-document', |
|
| 979 | + 'dash-f496' => 'dashicons-media-interactive', |
|
| 980 | + 'dash-f495' => 'dashicons-media-spreadsheet', |
|
| 981 | + 'dash-f491' => 'dashicons-media-text', |
|
| 982 | + 'dash-f490' => 'dashicons-media-video', |
|
| 983 | + 'dash-f492' => 'dashicons-playlist-audio', |
|
| 984 | + 'dash-f493' => 'dashicons-playlist-video', |
|
| 985 | + 'dash-f522' => 'dashicons-controls-play', |
|
| 986 | + 'dash-f523' => 'dashicons-controls-pause', |
|
| 987 | + 'dash-f519' => 'dashicons-controls-forward', |
|
| 988 | + 'dash-f517' => 'dashicons-controls-skipforward', |
|
| 989 | + 'dash-f518' => 'dashicons-controls-back', |
|
| 990 | + 'dash-f516' => 'dashicons-controls-skipback', |
|
| 991 | + 'dash-f515' => 'dashicons-controls-repeat', |
|
| 992 | + 'dash-f521' => 'dashicons-controls-volumeon', |
|
| 993 | + 'dash-f520' => 'dashicons-controls-volumeoff', |
|
| 994 | + 'dash-f165' => 'dashicons-image-crop', |
|
| 995 | + 'dash-f531' => 'dashicons-image-rotate', |
|
| 996 | + 'dash-f166' => 'dashicons-image-rotate-left', |
|
| 997 | + 'dash-f167' => 'dashicons-image-rotate-right', |
|
| 998 | + 'dash-f168' => 'dashicons-image-flip-vertical', |
|
| 999 | + 'dash-f169' => 'dashicons-image-flip-horizontal', |
|
| 1000 | + 'dash-f533' => 'dashicons-image-filter', |
|
| 1001 | + 'dash-f171' => 'dashicons-undo', |
|
| 1002 | + 'dash-f172' => 'dashicons-redo', |
|
| 1003 | + 'dash-f170' => 'dashicons-database-add', |
|
| 1004 | + 'dash-f17e' => 'dashicons-database', |
|
| 1005 | + 'dash-f17a' => 'dashicons-database-export', |
|
| 1006 | + 'dash-f17b' => 'dashicons-database-import', |
|
| 1007 | + 'dash-f17c' => 'dashicons-database-remove', |
|
| 1008 | + 'dash-f17d' => 'dashicons-database-view', |
|
| 1009 | + 'dash-f134' => 'dashicons-align-full-width', |
|
| 1010 | + 'dash-f10a' => 'dashicons-align-pull-left', |
|
| 1011 | + 'dash-f10b' => 'dashicons-align-pull-right', |
|
| 1012 | + 'dash-f11b' => 'dashicons-align-wide', |
|
| 1013 | + 'dash-f12b' => 'dashicons-block-default', |
|
| 1014 | + 'dash-f11a' => 'dashicons-button', |
|
| 1015 | + 'dash-f137' => 'dashicons-cloud-saved', |
|
| 1016 | + 'dash-f13b' => 'dashicons-cloud-upload', |
|
| 1017 | + 'dash-f13c' => 'dashicons-columns', |
|
| 1018 | + 'dash-f13d' => 'dashicons-cover-image', |
|
| 1019 | + 'dash-f11c' => 'dashicons-ellipsis', |
|
| 1020 | + 'dash-f13e' => 'dashicons-embed-audio', |
|
| 1021 | + 'dash-f13f' => 'dashicons-embed-generic', |
|
| 1022 | + 'dash-f144' => 'dashicons-embed-photo', |
|
| 1023 | + 'dash-f146' => 'dashicons-embed-post', |
|
| 1024 | + 'dash-f149' => 'dashicons-embed-video', |
|
| 1025 | + 'dash-f14a' => 'dashicons-exit', |
|
| 1026 | + 'dash-f10e' => 'dashicons-heading', |
|
| 1027 | + 'dash-f14b' => 'dashicons-html', |
|
| 1028 | + 'dash-f14c' => 'dashicons-info-outline', |
|
| 1029 | + 'dash-f10f' => 'dashicons-insert', |
|
| 1030 | + 'dash-f14d' => 'dashicons-insert-after', |
|
| 1031 | + 'dash-f14e' => 'dashicons-insert-before', |
|
| 1032 | + 'dash-f14f' => 'dashicons-remove', |
|
| 1033 | + 'dash-f15e' => 'dashicons-saved', |
|
| 1034 | + 'dash-f150' => 'dashicons-shortcode', |
|
| 1035 | + 'dash-f151' => 'dashicons-table-col-after', |
|
| 1036 | + 'dash-f152' => 'dashicons-table-col-before', |
|
| 1037 | + 'dash-f15a' => 'dashicons-table-col-delete', |
|
| 1038 | + 'dash-f15b' => 'dashicons-table-row-after', |
|
| 1039 | + 'dash-f15c' => 'dashicons-table-row-before', |
|
| 1040 | + 'dash-f15d' => 'dashicons-table-row-delete', |
|
| 1041 | + 'dash-f200' => 'dashicons-editor-bold', |
|
| 1042 | + 'dash-f201' => 'dashicons-editor-italic', |
|
| 1043 | + 'dash-f203' => 'dashicons-editor-ul', |
|
| 1044 | + 'dash-f204' => 'dashicons-editor-ol', |
|
| 1045 | + 'dash-f12c' => 'dashicons-editor-ol-rtl', |
|
| 1046 | + 'dash-f205' => 'dashicons-editor-quote', |
|
| 1047 | + 'dash-f206' => 'dashicons-editor-alignleft', |
|
| 1048 | + 'dash-f207' => 'dashicons-editor-aligncenter', |
|
| 1049 | + 'dash-f208' => 'dashicons-editor-alignright', |
|
| 1050 | + 'dash-f209' => 'dashicons-editor-insertmore', |
|
| 1051 | + 'dash-f210' => 'dashicons-editor-spellcheck', |
|
| 1052 | + 'dash-f211' => 'dashicons-editor-expand', |
|
| 1053 | + 'dash-f506' => 'dashicons-editor-contract', |
|
| 1054 | + 'dash-f212' => 'dashicons-editor-kitchensink', |
|
| 1055 | + 'dash-f213' => 'dashicons-editor-underline', |
|
| 1056 | + 'dash-f214' => 'dashicons-editor-justify', |
|
| 1057 | + 'dash-f215' => 'dashicons-editor-textcolor', |
|
| 1058 | + 'dash-f216' => 'dashicons-editor-paste-word', |
|
| 1059 | + 'dash-f217' => 'dashicons-editor-paste-text', |
|
| 1060 | + 'dash-f218' => 'dashicons-editor-removeformatting', |
|
| 1061 | + 'dash-f219' => 'dashicons-editor-video', |
|
| 1062 | + 'dash-f220' => 'dashicons-editor-customchar', |
|
| 1063 | + 'dash-f221' => 'dashicons-editor-outdent', |
|
| 1064 | + 'dash-f222' => 'dashicons-editor-indent', |
|
| 1065 | + 'dash-f223' => 'dashicons-editor-help', |
|
| 1066 | + 'dash-f224' => 'dashicons-editor-strikethrough', |
|
| 1067 | + 'dash-f225' => 'dashicons-editor-unlink', |
|
| 1068 | + 'dash-f320' => 'dashicons-editor-rtl', |
|
| 1069 | + 'dash-f10c' => 'dashicons-editor-ltr', |
|
| 1070 | + 'dash-f474' => 'dashicons-editor-break', |
|
| 1071 | + 'dash-f475' => 'dashicons-editor-code', |
|
| 1072 | + 'dash-f476' => 'dashicons-editor-paragraph', |
|
| 1073 | + 'dash-f535' => 'dashicons-editor-table', |
|
| 1074 | + 'dash-f135' => 'dashicons-align-left', |
|
| 1075 | + 'dash-f136' => 'dashicons-align-right', |
|
| 1076 | + 'dash-f134' => 'dashicons-align-center', |
|
| 1077 | + 'dash-f138' => 'dashicons-align-none', |
|
| 1078 | + 'dash-f160' => 'dashicons-lock', |
|
| 1079 | + 'dash-f528' => 'dashicons-unlock', |
|
| 1080 | + 'dash-f145' => 'dashicons-calendar', |
|
| 1081 | + 'dash-f508' => 'dashicons-calendar-alt', |
|
| 1082 | + 'dash-f177' => 'dashicons-visibility', |
|
| 1083 | + 'dash-f530' => 'dashicons-hidden', |
|
| 1084 | + 'dash-f173' => 'dashicons-post-status', |
|
| 1085 | + 'dash-f464' => 'dashicons-edit', |
|
| 1086 | + 'dash-f182' => 'dashicons-trash', |
|
| 1087 | + 'dash-f537' => 'dashicons-sticky', |
|
| 1088 | + 'dash-f504' => 'dashicons-external', |
|
| 1089 | + 'dash-f142' => 'dashicons-arrow-up', |
|
| 1090 | + 'dash-f140' => 'dashicons-arrow-down', |
|
| 1091 | + 'dash-f139' => 'dashicons-arrow-right', |
|
| 1092 | + 'dash-f141' => 'dashicons-arrow-left', |
|
| 1093 | + 'dash-f342' => 'dashicons-arrow-up-alt', |
|
| 1094 | + 'dash-f346' => 'dashicons-arrow-down-alt', |
|
| 1095 | + 'dash-f344' => 'dashicons-arrow-right-alt', |
|
| 1096 | + 'dash-f340' => 'dashicons-arrow-left-alt', |
|
| 1097 | + 'dash-f343' => 'dashicons-arrow-up-alt2', |
|
| 1098 | + 'dash-f347' => 'dashicons-arrow-down-alt2', |
|
| 1099 | + 'dash-f345' => 'dashicons-arrow-right-alt2', |
|
| 1100 | + 'dash-f341' => 'dashicons-arrow-left-alt2', |
|
| 1101 | + 'dash-f156' => 'dashicons-sort', |
|
| 1102 | + 'dash-f229' => 'dashicons-leftright', |
|
| 1103 | + 'dash-f503' => 'dashicons-randomize', |
|
| 1104 | + 'dash-f163' => 'dashicons-list-view', |
|
| 1105 | + 'dash-f164' => 'dashicons-excerpt-view', |
|
| 1106 | + 'dash-f509' => 'dashicons-grid-view', |
|
| 1107 | + 'dash-f545' => 'dashicons-move', |
|
| 1108 | + 'dash-f237' => 'dashicons-share', |
|
| 1109 | + 'dash-f240' => 'dashicons-share-alt', |
|
| 1110 | + 'dash-f242' => 'dashicons-share-alt2', |
|
| 1111 | + 'dash-f303' => 'dashicons-rss', |
|
| 1112 | + 'dash-f465' => 'dashicons-email', |
|
| 1113 | + 'dash-f466' => 'dashicons-email-alt', |
|
| 1114 | + 'dash-f467' => 'dashicons-email-alt2', |
|
| 1115 | + 'dash-f325' => 'dashicons-networking', |
|
| 1116 | + 'dash-f162' => 'dashicons-amazon', |
|
| 1117 | + 'dash-f304' => 'dashicons-facebook', |
|
| 1118 | + 'dash-f305' => 'dashicons-facebook-alt', |
|
| 1119 | + 'dash-f18b' => 'dashicons-google', |
|
| 1120 | + 'dash-f462' => 'dashicons-googleplus', |
|
| 1121 | + 'dash-f12d' => 'dashicons-instagram', |
|
| 1122 | + 'dash-f18d' => 'dashicons-linkedin', |
|
| 1123 | + 'dash-f192' => 'dashicons-pinterest', |
|
| 1124 | + 'dash-f19c' => 'dashicons-podio', |
|
| 1125 | + 'dash-f195' => 'dashicons-reddit', |
|
| 1126 | + 'dash-f196' => 'dashicons-spotify', |
|
| 1127 | + 'dash-f199' => 'dashicons-twitch', |
|
| 1128 | + 'dash-f301' => 'dashicons-twitter', |
|
| 1129 | + 'dash-f302' => 'dashicons-twitter-alt', |
|
| 1130 | + 'dash-f19a' => 'dashicons-whatsapp', |
|
| 1131 | + 'dash-f19d' => 'dashicons-xing', |
|
| 1132 | + 'dash-f19b' => 'dashicons-youtube', |
|
| 1133 | + 'dash-f308' => 'dashicons-hammer', |
|
| 1134 | + 'dash-f309' => 'dashicons-art', |
|
| 1135 | + 'dash-f310' => 'dashicons-migrate', |
|
| 1136 | + 'dash-f311' => 'dashicons-performance', |
|
| 1137 | + 'dash-f483' => 'dashicons-universal-access', |
|
| 1138 | + 'dash-f507' => 'dashicons-universal-access-alt', |
|
| 1139 | + 'dash-f486' => 'dashicons-tickets', |
|
| 1140 | + 'dash-f484' => 'dashicons-nametag', |
|
| 1141 | + 'dash-f481' => 'dashicons-clipboard', |
|
| 1142 | + 'dash-f487' => 'dashicons-heart', |
|
| 1143 | + 'dash-f488' => 'dashicons-megaphone', |
|
| 1144 | + 'dash-f489' => 'dashicons-schedule', |
|
| 1145 | + 'dash-f10d' => 'dashicons-tide', |
|
| 1146 | + 'dash-f124' => 'dashicons-rest-api', |
|
| 1147 | + 'dash-f13a' => 'dashicons-code-standards', |
|
| 1148 | + 'dash-f452' => 'dashicons-buddicons-activity', |
|
| 1149 | + 'dash-f477' => 'dashicons-buddicons-bbpress-logo', |
|
| 1150 | + 'dash-f448' => 'dashicons-buddicons-buddypress-logo', |
|
| 1151 | + 'dash-f453' => 'dashicons-buddicons-community', |
|
| 1152 | + 'dash-f449' => 'dashicons-buddicons-forums', |
|
| 1153 | + 'dash-f454' => 'dashicons-buddicons-friends', |
|
| 1154 | + 'dash-f456' => 'dashicons-buddicons-groups', |
|
| 1155 | + 'dash-f457' => 'dashicons-buddicons-pm', |
|
| 1156 | + 'dash-f451' => 'dashicons-buddicons-replies', |
|
| 1157 | + 'dash-f450' => 'dashicons-buddicons-topics', |
|
| 1158 | + 'dash-f455' => 'dashicons-buddicons-tracking', |
|
| 1159 | + 'dash-f120' => 'dashicons-wordpress', |
|
| 1160 | + 'dash-f324' => 'dashicons-wordpress-alt', |
|
| 1161 | + 'dash-f157' => 'dashicons-pressthis', |
|
| 1162 | + 'dash-f463' => 'dashicons-update', |
|
| 1163 | + 'dash-f113' => 'dashicons-update-alt', |
|
| 1164 | + 'dash-f180' => 'dashicons-screenoptions', |
|
| 1165 | + 'dash-f348' => 'dashicons-info', |
|
| 1166 | + 'dash-f174' => 'dashicons-cart', |
|
| 1167 | + 'dash-f175' => 'dashicons-feedback', |
|
| 1168 | + 'dash-f176' => 'dashicons-cloud', |
|
| 1169 | + 'dash-f326' => 'dashicons-translation', |
|
| 1170 | + 'dash-f323' => 'dashicons-tag', |
|
| 1171 | + 'dash-f318' => 'dashicons-category', |
|
| 1172 | + 'dash-f480' => 'dashicons-archive', |
|
| 1173 | + 'dash-f479' => 'dashicons-tagcloud', |
|
| 1174 | + 'dash-f478' => 'dashicons-text', |
|
| 1175 | + 'dash-f16d' => 'dashicons-bell', |
|
| 1176 | + 'dash-f147' => 'dashicons-yes', |
|
| 1177 | + 'dash-f12a' => 'dashicons-yes-alt', |
|
| 1178 | + 'dash-f158' => 'dashicons-no', |
|
| 1179 | + 'dash-f335' => 'dashicons-no-alt', |
|
| 1180 | + 'dash-f132' => 'dashicons-plus', |
|
| 1181 | + 'dash-f502' => 'dashicons-plus-alt', |
|
| 1182 | + 'dash-f543' => 'dashicons-plus-alt2', |
|
| 1183 | + 'dash-f460' => 'dashicons-minus', |
|
| 1184 | + 'dash-f153' => 'dashicons-dismiss', |
|
| 1185 | + 'dash-f159' => 'dashicons-marker', |
|
| 1186 | + 'dash-f155' => 'dashicons-star-filled', |
|
| 1187 | + 'dash-f459' => 'dashicons-star-half', |
|
| 1188 | + 'dash-f154' => 'dashicons-star-empty', |
|
| 1189 | + 'dash-f227' => 'dashicons-flag', |
|
| 1190 | + 'dash-f534' => 'dashicons-warning', |
|
| 1191 | + 'dash-f230' => 'dashicons-location', |
|
| 1192 | + 'dash-f231' => 'dashicons-location-alt', |
|
| 1193 | + 'dash-f178' => 'dashicons-vault', |
|
| 1194 | + 'dash-f332' => 'dashicons-shield', |
|
| 1195 | + 'dash-f334' => 'dashicons-shield-alt', |
|
| 1196 | + 'dash-f468' => 'dashicons-sos', |
|
| 1197 | + 'dash-f179' => 'dashicons-search', |
|
| 1198 | + 'dash-f181' => 'dashicons-slides', |
|
| 1199 | + 'dash-f121' => 'dashicons-text-page', |
|
| 1200 | + 'dash-f183' => 'dashicons-analytics', |
|
| 1201 | + 'dash-f184' => 'dashicons-chart-pie', |
|
| 1202 | + 'dash-f185' => 'dashicons-chart-bar', |
|
| 1203 | + 'dash-f238' => 'dashicons-chart-line', |
|
| 1204 | + 'dash-f239' => 'dashicons-chart-area', |
|
| 1205 | + 'dash-f307' => 'dashicons-groups', |
|
| 1206 | + 'dash-f338' => 'dashicons-businessman', |
|
| 1207 | + 'dash-f12f' => 'dashicons-businesswoman', |
|
| 1208 | + 'dash-f12e' => 'dashicons-businessperson', |
|
| 1209 | + 'dash-f336' => 'dashicons-id', |
|
| 1210 | + 'dash-f337' => 'dashicons-id-alt', |
|
| 1211 | + 'dash-f312' => 'dashicons-products', |
|
| 1212 | + 'dash-f313' => 'dashicons-awards', |
|
| 1213 | + 'dash-f314' => 'dashicons-forms', |
|
| 1214 | + 'dash-f473' => 'dashicons-testimonial', |
|
| 1215 | + 'dash-f322' => 'dashicons-portfolio', |
|
| 1216 | + 'dash-f330' => 'dashicons-book', |
|
| 1217 | + 'dash-f331' => 'dashicons-book-alt', |
|
| 1218 | + 'dash-f316' => 'dashicons-download', |
|
| 1219 | + 'dash-f317' => 'dashicons-upload', |
|
| 1220 | + 'dash-f321' => 'dashicons-backup', |
|
| 1221 | + 'dash-f469' => 'dashicons-clock', |
|
| 1222 | + 'dash-f339' => 'dashicons-lightbulb', |
|
| 1223 | + 'dash-f482' => 'dashicons-microphone', |
|
| 1224 | + 'dash-f472' => 'dashicons-desktop', |
|
| 1225 | + 'dash-f547' => 'dashicons-laptop', |
|
| 1226 | + 'dash-f471' => 'dashicons-tablet', |
|
| 1227 | + 'dash-f470' => 'dashicons-smartphone', |
|
| 1228 | + 'dash-f525' => 'dashicons-phone', |
|
| 1229 | + 'dash-f510' => 'dashicons-index-card', |
|
| 1230 | + 'dash-f511' => 'dashicons-carrot', |
|
| 1231 | + 'dash-f512' => 'dashicons-building', |
|
| 1232 | + 'dash-f513' => 'dashicons-store', |
|
| 1233 | + 'dash-f514' => 'dashicons-album', |
|
| 1234 | + 'dash-f527' => 'dashicons-palmtree', |
|
| 1235 | + 'dash-f524' => 'dashicons-tickets-alt', |
|
| 1236 | + 'dash-f526' => 'dashicons-money', |
|
| 1237 | + 'dash-f18e' => 'dashicons-money-alt', |
|
| 1238 | + 'dash-f328' => 'dashicons-smiley', |
|
| 1239 | + 'dash-f529' => 'dashicons-thumbs-up', |
|
| 1240 | + 'dash-f542' => 'dashicons-thumbs-down', |
|
| 1241 | + 'dash-f538' => 'dashicons-layout', |
|
| 1242 | + 'dash-f546' => 'dashicons-paperclip', |
|
| 1243 | + 'dash-f131' => 'dashicons-color-picker', |
|
| 1244 | + 'dash-f327' => 'dashicons-edit-large', |
|
| 1245 | + 'dash-f186' => 'dashicons-edit-page', |
|
| 1246 | + 'dash-f15f' => 'dashicons-airplane', |
|
| 1247 | + 'dash-f16a' => 'dashicons-bank', |
|
| 1248 | + 'dash-f16c' => 'dashicons-beer', |
|
| 1249 | + 'dash-f16e' => 'dashicons-calculator', |
|
| 1250 | + 'dash-f16b' => 'dashicons-car', |
|
| 1251 | + 'dash-f16f' => 'dashicons-coffee', |
|
| 1252 | + 'dash-f17f' => 'dashicons-drumstick', |
|
| 1253 | + 'dash-f187' => 'dashicons-food', |
|
| 1254 | + 'dash-f188' => 'dashicons-fullscreen-alt', |
|
| 1255 | + 'dash-f189' => 'dashicons-fullscreen-exit-alt', |
|
| 1256 | + 'dash-f18a' => 'dashicons-games', |
|
| 1257 | + 'dash-f18c' => 'dashicons-hourglass', |
|
| 1258 | + 'dash-f18f' => 'dashicons-open-folder', |
|
| 1259 | + 'dash-f190' => 'dashicons-pdf', |
|
| 1260 | + 'dash-f191' => 'dashicons-pets', |
|
| 1261 | + 'dash-f193' => 'dashicons-printer', |
|
| 1262 | + 'dash-f194' => 'dashicons-privacy', |
|
| 1263 | + 'dash-f198' => 'dashicons-superhero', |
|
| 1264 | + 'dash-f197' => 'dashicons-superhero-alt', |
|
| 1265 | + ); |
|
| 1266 | + |
|
| 1267 | + $icons = apply_filters( 'megamenu_dashicons', $icons ); |
|
| 1268 | + |
|
| 1269 | + ksort( $icons ); |
|
| 1270 | + |
|
| 1271 | + return $icons; |
|
| 1272 | + } |
|
| 1273 | + } |
|
| 1274 | 1274 | |
| 1275 | 1275 | endif; |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | 4 | exit; // disable direct access |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if ( ! class_exists( 'Mega_Menu_Menu_Item_Manager' ) ) : |
|
| 7 | +if (!class_exists('Mega_Menu_Menu_Item_Manager')) : |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * |
@@ -26,14 +26,14 @@ discard block |
||
| 26 | 26 | * @since 1.4 |
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | - add_action( 'wp_ajax_mm_get_lightbox_html', array( $this, 'ajax_get_lightbox_html' ) ); |
|
| 30 | - add_action( 'wp_ajax_mm_get_empty_grid_column', array( $this, 'ajax_get_empty_grid_column' ) ); |
|
| 31 | - add_action( 'wp_ajax_mm_get_empty_grid_row', array( $this, 'ajax_get_empty_grid_row' ) ); |
|
| 32 | - add_action( 'wp_ajax_mm_save_menu_item_settings', array( $this, 'ajax_save_menu_item_settings' ) ); |
|
| 33 | - |
|
| 34 | - add_filter( 'megamenu_tabs', array( $this, 'add_mega_menu_tab' ), 10, 5 ); |
|
| 35 | - add_filter( 'megamenu_tabs', array( $this, 'add_general_settings_tab' ), 10, 5 ); |
|
| 36 | - add_filter( 'megamenu_tabs', array( $this, 'add_icon_tab' ), 10, 5 ); |
|
| 29 | + add_action('wp_ajax_mm_get_lightbox_html', array($this, 'ajax_get_lightbox_html')); |
|
| 30 | + add_action('wp_ajax_mm_get_empty_grid_column', array($this, 'ajax_get_empty_grid_column')); |
|
| 31 | + add_action('wp_ajax_mm_get_empty_grid_row', array($this, 'ajax_get_empty_grid_row')); |
|
| 32 | + add_action('wp_ajax_mm_save_menu_item_settings', array($this, 'ajax_save_menu_item_settings')); |
|
| 33 | + |
|
| 34 | + add_filter('megamenu_tabs', array($this, 'add_mega_menu_tab'), 10, 5); |
|
| 35 | + add_filter('megamenu_tabs', array($this, 'add_general_settings_tab'), 10, 5); |
|
| 36 | + add_filter('megamenu_tabs', array($this, 'add_icon_tab'), 10, 5); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | * @since 1.4 |
| 44 | 44 | */ |
| 45 | 45 | private function init() { |
| 46 | - if ( isset( $_POST['menu_item_id'] ) ) { |
|
| 47 | - $this->menu_item_id = absint( $_POST['menu_item_id'] ); |
|
| 48 | - $this->menu_id = $this->get_menu_id_for_menu_item_id( $this->menu_item_id ); |
|
| 49 | - $this->menu_item_objects = wp_get_nav_menu_items( $this->menu_id ); |
|
| 50 | - $this->menu_item_title = $this->get_title_for_menu_item_id( $this->menu_item_id, $this->menu_item_objects ); |
|
| 51 | - $this->menu_item_depth = $this->get_menu_item_depth( $this->menu_item_id, $this->menu_item_objects ); |
|
| 52 | - $saved_settings = array_filter( (array) get_post_meta( $this->menu_item_id, '_megamenu', true ) ); |
|
| 53 | - $this->menu_item_meta = array_merge( Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings ); |
|
| 46 | + if (isset($_POST['menu_item_id'])) { |
|
| 47 | + $this->menu_item_id = absint($_POST['menu_item_id']); |
|
| 48 | + $this->menu_id = $this->get_menu_id_for_menu_item_id($this->menu_item_id); |
|
| 49 | + $this->menu_item_objects = wp_get_nav_menu_items($this->menu_id); |
|
| 50 | + $this->menu_item_title = $this->get_title_for_menu_item_id($this->menu_item_id, $this->menu_item_objects); |
|
| 51 | + $this->menu_item_depth = $this->get_menu_item_depth($this->menu_item_id, $this->menu_item_objects); |
|
| 52 | + $saved_settings = array_filter((array) get_post_meta($this->menu_item_id, '_megamenu', true)); |
|
| 53 | + $this->menu_item_meta = array_merge(Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | * @param array $menu_item_objects |
| 63 | 63 | * @return int |
| 64 | 64 | */ |
| 65 | - public function get_menu_item_depth( $menu_item_id, $menu_item_objects ) { |
|
| 65 | + public function get_menu_item_depth($menu_item_id, $menu_item_objects) { |
|
| 66 | 66 | $parents = array(); |
| 67 | 67 | |
| 68 | - foreach ( $menu_item_objects as $key => $item ) { |
|
| 69 | - if ( $item->menu_item_parent == 0 ) { |
|
| 68 | + foreach ($menu_item_objects as $key => $item) { |
|
| 69 | + if ($item->menu_item_parent == 0) { |
|
| 70 | 70 | |
| 71 | - if ( $item->ID == $menu_item_id ) { |
|
| 71 | + if ($item->ID == $menu_item_id) { |
|
| 72 | 72 | return 0; // top level item |
| 73 | 73 | } |
| 74 | 74 | |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - if ( count( $parents ) ) { |
|
| 80 | - foreach ( $menu_item_objects as $key => $item ) { |
|
| 81 | - if ( in_array( $item->menu_item_parent, $parents ) ) { |
|
| 82 | - if ( $item->ID == $menu_item_id ) { |
|
| 79 | + if (count($parents)) { |
|
| 80 | + foreach ($menu_item_objects as $key => $item) { |
|
| 81 | + if (in_array($item->menu_item_parent, $parents)) { |
|
| 82 | + if ($item->ID == $menu_item_id) { |
|
| 83 | 83 | return 1; // second level item |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -97,55 +97,55 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public static function ajax_save_menu_item_settings() { |
| 99 | 99 | |
| 100 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 100 | + check_ajax_referer('megamenu_edit'); |
|
| 101 | 101 | |
| 102 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 102 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 103 | 103 | |
| 104 | - if ( ! current_user_can( $capability ) ) { |
|
| 104 | + if (!current_user_can($capability)) { |
|
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - $submitted_settings = isset( $_POST['settings'] ) ? $_POST['settings'] : array(); |
|
| 108 | + $submitted_settings = isset($_POST['settings']) ? $_POST['settings'] : array(); |
|
| 109 | 109 | |
| 110 | - $menu_item_id = absint( $_POST['menu_item_id'] ); |
|
| 110 | + $menu_item_id = absint($_POST['menu_item_id']); |
|
| 111 | 111 | |
| 112 | - if ( $menu_item_id > 0 && is_array( $submitted_settings ) ) { |
|
| 112 | + if ($menu_item_id > 0 && is_array($submitted_settings)) { |
|
| 113 | 113 | |
| 114 | 114 | // only check the checkbox values if the general settings form was submitted |
| 115 | - if ( isset( $_POST['tab'] ) && $_POST['tab'] == 'general_settings' ) { |
|
| 115 | + if (isset($_POST['tab']) && $_POST['tab'] == 'general_settings') { |
|
| 116 | 116 | |
| 117 | - $checkboxes = array( 'hide_text', 'disable_link', 'hide_arrow', 'hide_on_mobile', 'hide_on_desktop', 'close_after_click', 'hide_sub_menu_on_mobile', 'collapse_children' ); |
|
| 117 | + $checkboxes = array('hide_text', 'disable_link', 'hide_arrow', 'hide_on_mobile', 'hide_on_desktop', 'close_after_click', 'hide_sub_menu_on_mobile', 'collapse_children'); |
|
| 118 | 118 | |
| 119 | - foreach ( $checkboxes as $checkbox ) { |
|
| 120 | - if ( ! isset( $submitted_settings[ $checkbox ] ) ) { |
|
| 121 | - $submitted_settings[ $checkbox ] = 'false'; |
|
| 119 | + foreach ($checkboxes as $checkbox) { |
|
| 120 | + if (!isset($submitted_settings[$checkbox])) { |
|
| 121 | + $submitted_settings[$checkbox] = 'false'; |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - $submitted_settings = apply_filters( 'megamenu_menu_item_submitted_settings', $submitted_settings, $menu_item_id ); |
|
| 126 | + $submitted_settings = apply_filters('megamenu_menu_item_submitted_settings', $submitted_settings, $menu_item_id); |
|
| 127 | 127 | |
| 128 | - $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true ); |
|
| 128 | + $existing_settings = get_post_meta($menu_item_id, '_megamenu', true); |
|
| 129 | 129 | |
| 130 | - if ( is_array( $existing_settings ) ) { |
|
| 130 | + if (is_array($existing_settings)) { |
|
| 131 | 131 | |
| 132 | - $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 132 | + $submitted_settings = array_merge($existing_settings, $submitted_settings); |
|
| 133 | 133 | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - update_post_meta( $menu_item_id, '_megamenu', $submitted_settings ); |
|
| 136 | + update_post_meta($menu_item_id, '_megamenu', $submitted_settings); |
|
| 137 | 137 | |
| 138 | - do_action( 'megamenu_save_menu_item_settings', $menu_item_id ); |
|
| 138 | + do_action('megamenu_save_menu_item_settings', $menu_item_id); |
|
| 139 | 139 | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if ( isset( $_POST['clear_cache'] ) ) { |
|
| 142 | + if (isset($_POST['clear_cache'])) { |
|
| 143 | 143 | |
| 144 | - do_action( 'megamenu_delete_cache' ); |
|
| 144 | + do_action('megamenu_delete_cache'); |
|
| 145 | 145 | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if ( ob_get_contents() ) { |
|
| 148 | + if (ob_get_contents()) { |
|
| 149 | 149 | ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
| 150 | 150 | } |
| 151 | 151 | |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function ajax_get_lightbox_html() { |
| 164 | 164 | |
| 165 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 165 | + check_ajax_referer('megamenu_edit'); |
|
| 166 | 166 | |
| 167 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 167 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 168 | 168 | |
| 169 | - if ( ! current_user_can( $capability ) ) { |
|
| 169 | + if (!current_user_can($capability)) { |
|
| 170 | 170 | return; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -178,17 +178,17 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | $response['active_tab'] = 'mega_menu'; |
| 180 | 180 | |
| 181 | - if ( $this->menu_item_depth > 0 ) { |
|
| 181 | + if ($this->menu_item_depth > 0) { |
|
| 182 | 182 | $response['active_tab'] = 'general_settings'; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - $response = apply_filters( 'megamenu_tabs', $response, $this->menu_item_id, $this->menu_id, $this->menu_item_depth, $this->menu_item_meta ); |
|
| 185 | + $response = apply_filters('megamenu_tabs', $response, $this->menu_item_id, $this->menu_id, $this->menu_item_depth, $this->menu_item_meta); |
|
| 186 | 186 | |
| 187 | - if ( ob_get_contents() ) { |
|
| 187 | + if (ob_get_contents()) { |
|
| 188 | 188 | ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - wp_send_json_success( json_encode( $response ) ); |
|
| 191 | + wp_send_json_success(json_encode($response)); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | * @param int $menu_item_id |
| 200 | 200 | * @return int $menu_id |
| 201 | 201 | */ |
| 202 | - public function get_menu_id_for_menu_item_id( $menu_item_id ) { |
|
| 203 | - $terms = get_the_terms( $menu_item_id, 'nav_menu' ); |
|
| 202 | + public function get_menu_id_for_menu_item_id($menu_item_id) { |
|
| 203 | + $terms = get_the_terms($menu_item_id, 'nav_menu'); |
|
| 204 | 204 | $menu_id = $terms[0]->term_id; |
| 205 | 205 | return $menu_id; |
| 206 | 206 | } |
@@ -213,9 +213,9 @@ discard block |
||
| 213 | 213 | * @param int $menu_item_id |
| 214 | 214 | * @return int $menu_id |
| 215 | 215 | */ |
| 216 | - public function get_title_for_menu_item_id( $menu_item_id, $menu_item_objects ) { |
|
| 217 | - foreach ( $menu_item_objects as $key => $item ) { |
|
| 218 | - if ( $item->ID == $menu_item_id ) { |
|
| 216 | + public function get_title_for_menu_item_id($menu_item_id, $menu_item_objects) { |
|
| 217 | + foreach ($menu_item_objects as $key => $item) { |
|
| 218 | + if ($item->ID == $menu_item_id) { |
|
| 219 | 219 | return $item->title; |
| 220 | 220 | } |
| 221 | 221 | } |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | * @since 1.7 |
| 230 | 230 | * @return array |
| 231 | 231 | */ |
| 232 | - public function add_mega_menu_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 233 | - if ( $menu_item_depth > 0 ) { |
|
| 232 | + public function add_mega_menu_tab($tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta) { |
|
| 233 | + if ($menu_item_depth > 0) { |
|
| 234 | 234 | $tabs['mega_menu'] = array( |
| 235 | - 'title' => __( 'Sub Menu', 'megamenu' ), |
|
| 236 | - 'content' => '<em>' . __( 'Mega Menus can only be created on top level menu items.', 'megamenu' ) . '</em>', |
|
| 235 | + 'title' => __('Sub Menu', 'megamenu'), |
|
| 236 | + 'content' => '<em>' . __('Mega Menus can only be created on top level menu items.', 'megamenu') . '</em>', |
|
| 237 | 237 | ); |
| 238 | 238 | |
| 239 | 239 | return $tabs; |
@@ -242,19 +242,19 @@ discard block |
||
| 242 | 242 | $submenu_options = apply_filters( |
| 243 | 243 | 'megamenu_submenu_options', |
| 244 | 244 | array( |
| 245 | - 'flyout' => __( 'Flyout Menu', 'megamenu' ), |
|
| 246 | - 'grid' => __( 'Mega Menu - Grid Layout', 'megamenu' ), |
|
| 247 | - 'megamenu' => __( 'Mega Menu - Standard Layout', 'megamenu' ), |
|
| 245 | + 'flyout' => __('Flyout Menu', 'megamenu'), |
|
| 246 | + 'grid' => __('Mega Menu - Grid Layout', 'megamenu'), |
|
| 247 | + 'megamenu' => __('Mega Menu - Standard Layout', 'megamenu'), |
|
| 248 | 248 | ), |
| 249 | 249 | $menu_item_meta |
| 250 | 250 | ); |
| 251 | 251 | |
| 252 | - $return = "<label for='mm_enable_mega_menu'>" . __( 'Sub menu display mode', 'megamenu' ) . '</label>'; |
|
| 252 | + $return = "<label for='mm_enable_mega_menu'>" . __('Sub menu display mode', 'megamenu') . '</label>'; |
|
| 253 | 253 | |
| 254 | 254 | $return .= "<select id='mm_enable_mega_menu' name='settings[type]'>"; |
| 255 | 255 | |
| 256 | - foreach ( $submenu_options as $type => $label ) { |
|
| 257 | - $return .= "<option id='{$type}' value='{$type}' " . selected( $menu_item_meta['type'], $type, false ) . ">{$label}</option>"; |
|
| 256 | + foreach ($submenu_options as $type => $label) { |
|
| 257 | + $return .= "<option id='{$type}' value='{$type}' " . selected($menu_item_meta['type'], $type, false) . ">{$label}</option>"; |
|
| 258 | 258 | } |
| 259 | 259 | $return .= '</select>'; |
| 260 | 260 | |
@@ -264,36 +264,36 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | $return .= "<div class='mm_panel_options'>"; |
| 266 | 266 | $return .= " <select id='mm_number_of_columns' name='settings[panel_columns]'>"; |
| 267 | - $return .= " <option value='1' " . selected( $menu_item_meta['panel_columns'], 1, false ) . '>1 ' . __( 'column', 'megamenu' ) . '</option>'; |
|
| 268 | - $return .= " <option value='2' " . selected( $menu_item_meta['panel_columns'], 2, false ) . '>2 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 269 | - $return .= " <option value='3' " . selected( $menu_item_meta['panel_columns'], 3, false ) . '>3 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 270 | - $return .= " <option value='4' " . selected( $menu_item_meta['panel_columns'], 4, false ) . '>4 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 271 | - $return .= " <option value='5' " . selected( $menu_item_meta['panel_columns'], 5, false ) . '>5 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 272 | - $return .= " <option value='6' " . selected( $menu_item_meta['panel_columns'], 6, false ) . '>6 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 273 | - $return .= " <option value='7' " . selected( $menu_item_meta['panel_columns'], 7, false ) . '>7 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 274 | - $return .= " <option value='8' " . selected( $menu_item_meta['panel_columns'], 8, false ) . '>8 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 275 | - $return .= " <option value='9' " . selected( $menu_item_meta['panel_columns'], 9, false ) . '>9 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 276 | - $return .= " <option value='10' " . selected( $menu_item_meta['panel_columns'], 10, false ) . '>10 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 277 | - $return .= " <option value='11' " . selected( $menu_item_meta['panel_columns'], 11, false ) . '>11 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 278 | - $return .= " <option value='12' " . selected( $menu_item_meta['panel_columns'], 12, false ) . '>12 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 267 | + $return .= " <option value='1' " . selected($menu_item_meta['panel_columns'], 1, false) . '>1 ' . __('column', 'megamenu') . '</option>'; |
|
| 268 | + $return .= " <option value='2' " . selected($menu_item_meta['panel_columns'], 2, false) . '>2 ' . __('columns', 'megamenu') . '</option>'; |
|
| 269 | + $return .= " <option value='3' " . selected($menu_item_meta['panel_columns'], 3, false) . '>3 ' . __('columns', 'megamenu') . '</option>'; |
|
| 270 | + $return .= " <option value='4' " . selected($menu_item_meta['panel_columns'], 4, false) . '>4 ' . __('columns', 'megamenu') . '</option>'; |
|
| 271 | + $return .= " <option value='5' " . selected($menu_item_meta['panel_columns'], 5, false) . '>5 ' . __('columns', 'megamenu') . '</option>'; |
|
| 272 | + $return .= " <option value='6' " . selected($menu_item_meta['panel_columns'], 6, false) . '>6 ' . __('columns', 'megamenu') . '</option>'; |
|
| 273 | + $return .= " <option value='7' " . selected($menu_item_meta['panel_columns'], 7, false) . '>7 ' . __('columns', 'megamenu') . '</option>'; |
|
| 274 | + $return .= " <option value='8' " . selected($menu_item_meta['panel_columns'], 8, false) . '>8 ' . __('columns', 'megamenu') . '</option>'; |
|
| 275 | + $return .= " <option value='9' " . selected($menu_item_meta['panel_columns'], 9, false) . '>9 ' . __('columns', 'megamenu') . '</option>'; |
|
| 276 | + $return .= " <option value='10' " . selected($menu_item_meta['panel_columns'], 10, false) . '>10 ' . __('columns', 'megamenu') . '</option>'; |
|
| 277 | + $return .= " <option value='11' " . selected($menu_item_meta['panel_columns'], 11, false) . '>11 ' . __('columns', 'megamenu') . '</option>'; |
|
| 278 | + $return .= " <option value='12' " . selected($menu_item_meta['panel_columns'], 12, false) . '>12 ' . __('columns', 'megamenu') . '</option>'; |
|
| 279 | 279 | $return .= ' </select>'; |
| 280 | 280 | |
| 281 | 281 | $return .= " <select id='mm_widget_selector'>"; |
| 282 | - $return .= " <option value='disabled'>" . __( 'Select a Widget to add to the panel', 'megamenu' ) . '</option>'; |
|
| 282 | + $return .= " <option value='disabled'>" . __('Select a Widget to add to the panel', 'megamenu') . '</option>'; |
|
| 283 | 283 | |
| 284 | - foreach ( $all_widgets as $widget ) { |
|
| 284 | + foreach ($all_widgets as $widget) { |
|
| 285 | 285 | $return .= " <option value='" . $widget['value'] . "'>" . $widget['text'] . '</option>'; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | $return .= ' </select>'; |
| 289 | 289 | $return .= '</div>'; |
| 290 | 290 | |
| 291 | - $return .= $this->get_megamenu_html( $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 291 | + $return .= $this->get_megamenu_html($menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta); |
|
| 292 | 292 | |
| 293 | - $return .= $this->get_megamenu_grid_html( $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 293 | + $return .= $this->get_megamenu_grid_html($menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta); |
|
| 294 | 294 | |
| 295 | 295 | $tabs['mega_menu'] = array( |
| 296 | - 'title' => __( 'Mega Menu', 'megamenu' ), |
|
| 296 | + 'title' => __('Mega Menu', 'megamenu'), |
|
| 297 | 297 | 'content' => $return, |
| 298 | 298 | ); |
| 299 | 299 | |
@@ -307,16 +307,16 @@ discard block |
||
| 307 | 307 | * @since 2.4 |
| 308 | 308 | * @return string |
| 309 | 309 | */ |
| 310 | - public function get_megamenu_grid_html( $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 310 | + public function get_megamenu_grid_html($menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta) { |
|
| 311 | 311 | |
| 312 | - $css_version = get_transient( 'megamenu_css_version' ); |
|
| 312 | + $css_version = get_transient('megamenu_css_version'); |
|
| 313 | 313 | |
| 314 | 314 | $return = "<div id='megamenu-grid'>"; |
| 315 | 315 | |
| 316 | - if ( $css_version && version_compare( $css_version, '2.3.9', '<=' ) ) { |
|
| 317 | - $link = "<a href='" . esc_attr( admin_url( 'admin.php?page=maxmegamenu_tools' ) ) . "'>" . __( 'Mega Menu' ) . ' > ' . __( 'Tools' ) . '</a>'; |
|
| 316 | + if ($css_version && version_compare($css_version, '2.3.9', '<=')) { |
|
| 317 | + $link = "<a href='" . esc_attr(admin_url('admin.php?page=maxmegamenu_tools')) . "'>" . __('Mega Menu') . ' > ' . __('Tools') . '</a>'; |
|
| 318 | 318 | $return .= "<div class='notice notice-success'><p>"; |
| 319 | - $return .= sprintf( __( 'Your menu CSS needs to be updated first. Please go to %s and Clear the CSS Cache (you will only need to do this once).', 'megamenu' ), $link ); |
|
| 319 | + $return .= sprintf(__('Your menu CSS needs to be updated first. Please go to %s and Clear the CSS Cache (you will only need to do this once).', 'megamenu'), $link); |
|
| 320 | 320 | $return .= '</p></div>'; |
| 321 | 321 | $return .= '</div>'; |
| 322 | 322 | |
@@ -325,27 +325,27 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | $widget_manager = new Mega_Menu_Widget_Manager(); |
| 327 | 327 | |
| 328 | - $grid = $widget_manager->get_grid_widgets_and_menu_items_for_menu_id( $menu_item_id, $menu_id ); |
|
| 328 | + $grid = $widget_manager->get_grid_widgets_and_menu_items_for_menu_id($menu_item_id, $menu_id); |
|
| 329 | 329 | |
| 330 | - if ( count( $grid ) ) { |
|
| 330 | + if (count($grid)) { |
|
| 331 | 331 | |
| 332 | - foreach ( $grid as $row => $row_data ) { |
|
| 332 | + foreach ($grid as $row => $row_data) { |
|
| 333 | 333 | |
| 334 | 334 | $column_html = ''; |
| 335 | 335 | |
| 336 | - if ( isset( $row_data['columns'] ) && count( $row_data['columns'] ) ) { |
|
| 336 | + if (isset($row_data['columns']) && count($row_data['columns'])) { |
|
| 337 | 337 | |
| 338 | - foreach ( $row_data['columns'] as $col => $col_data ) { |
|
| 339 | - $column_html .= $this->get_grid_column( $row_data, $col_data ); |
|
| 338 | + foreach ($row_data['columns'] as $col => $col_data) { |
|
| 339 | + $column_html .= $this->get_grid_column($row_data, $col_data); |
|
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - $return .= $this->get_grid_row( $row_data, $column_html ); |
|
| 343 | + $return .= $this->get_grid_row($row_data, $column_html); |
|
| 344 | 344 | |
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - $return .= " <button class='button button-primary mega-add-row'><span class='dashicons dashicons-plus'></span>" . __( 'Row', 'megamenu' ) . '</button>'; |
|
| 348 | + $return .= " <button class='button button-primary mega-add-row'><span class='dashicons dashicons-plus'></span>" . __('Row', 'megamenu') . '</button>'; |
|
| 349 | 349 | $return .= '</div>'; |
| 350 | 350 | |
| 351 | 351 | return $return; |
@@ -360,21 +360,21 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | public function ajax_get_empty_grid_column() { |
| 362 | 362 | |
| 363 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 363 | + check_ajax_referer('megamenu_edit'); |
|
| 364 | 364 | |
| 365 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 365 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 366 | 366 | |
| 367 | - if ( ! current_user_can( $capability ) ) { |
|
| 367 | + if (!current_user_can($capability)) { |
|
| 368 | 368 | return; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | $return = $this->get_grid_column(); |
| 372 | 372 | |
| 373 | - if ( ob_get_contents() ) { |
|
| 373 | + if (ob_get_contents()) { |
|
| 374 | 374 | ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - wp_send_json_success( $return ); |
|
| 377 | + wp_send_json_success($return); |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | /** |
@@ -385,23 +385,23 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | public function ajax_get_empty_grid_row() { |
| 387 | 387 | |
| 388 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 388 | + check_ajax_referer('megamenu_edit'); |
|
| 389 | 389 | |
| 390 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 390 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 391 | 391 | |
| 392 | - if ( ! current_user_can( $capability ) ) { |
|
| 392 | + if (!current_user_can($capability)) { |
|
| 393 | 393 | return; |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | $column_html = $this->get_grid_column(); |
| 397 | 397 | |
| 398 | - $return = $this->get_grid_row( false, $column_html ); |
|
| 398 | + $return = $this->get_grid_row(false, $column_html); |
|
| 399 | 399 | |
| 400 | - if ( ob_get_contents() ) { |
|
| 400 | + if (ob_get_contents()) { |
|
| 401 | 401 | ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - wp_send_json_success( $return ); |
|
| 404 | + wp_send_json_success($return); |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | /** |
@@ -412,12 +412,12 @@ discard block |
||
| 412 | 412 | * @since 2.4 |
| 413 | 413 | * @return string |
| 414 | 414 | */ |
| 415 | - public function get_grid_row( $row_data = false, $column_html = false ) { |
|
| 415 | + public function get_grid_row($row_data = false, $column_html = false) { |
|
| 416 | 416 | |
| 417 | 417 | $hide_on_desktop_checked = 'false'; |
| 418 | 418 | $hide_on_desktop = 'mega-enabled'; |
| 419 | 419 | |
| 420 | - if ( isset( $row_data['meta']['hide-on-desktop'] ) && $row_data['meta']['hide-on-desktop'] == 'true' ) { |
|
| 420 | + if (isset($row_data['meta']['hide-on-desktop']) && $row_data['meta']['hide-on-desktop'] == 'true') { |
|
| 421 | 421 | $hide_on_desktop = 'mega-disabled'; |
| 422 | 422 | $hide_on_desktop_checked = 'true'; |
| 423 | 423 | } |
@@ -425,23 +425,23 @@ discard block |
||
| 425 | 425 | $hide_on_mobile_checked = 'false'; |
| 426 | 426 | $hide_on_mobile = 'mega-enabled'; |
| 427 | 427 | |
| 428 | - if ( isset( $row_data['meta']['hide-on-mobile'] ) && $row_data['meta']['hide-on-mobile'] == 'true' ) { |
|
| 428 | + if (isset($row_data['meta']['hide-on-mobile']) && $row_data['meta']['hide-on-mobile'] == 'true') { |
|
| 429 | 429 | $hide_on_mobile = 'mega-disabled'; |
| 430 | 430 | $hide_on_mobile_checked = 'true'; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | $row_columns = 12; |
| 434 | 434 | |
| 435 | - if ( isset( $row_data['meta']['columns'] ) ) { |
|
| 436 | - $row_columns = intval( $row_data['meta']['columns'] ); |
|
| 435 | + if (isset($row_data['meta']['columns'])) { |
|
| 436 | + $row_columns = intval($row_data['meta']['columns']); |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | - $desktop_tooltip_visible = __( 'Row', 'megamenu' ) . ': ' . __( 'Visible on desktop', 'megamenu' ); |
|
| 440 | - $desktop_tooltip_hidden = __( 'Row', 'megamenu' ) . ': ' . __( 'Hidden on desktop', 'megamenu' ); |
|
| 441 | - $mobile_tooltip_visible = __( 'Row', 'megamenu' ) . ': ' . __( 'Visible on mobile', 'megamenu' ); |
|
| 442 | - $mobile_tooltip_hidden = __( 'Row', 'megamenu' ) . ': ' . __( 'Hidden on mobile', 'megamenu' ); |
|
| 439 | + $desktop_tooltip_visible = __('Row', 'megamenu') . ': ' . __('Visible on desktop', 'megamenu'); |
|
| 440 | + $desktop_tooltip_hidden = __('Row', 'megamenu') . ': ' . __('Hidden on desktop', 'megamenu'); |
|
| 441 | + $mobile_tooltip_visible = __('Row', 'megamenu') . ': ' . __('Visible on mobile', 'megamenu'); |
|
| 442 | + $mobile_tooltip_hidden = __('Row', 'megamenu') . ': ' . __('Hidden on mobile', 'megamenu'); |
|
| 443 | 443 | |
| 444 | - $row_class = isset( $row_data['meta']['class'] ) ? $row_data['meta']['class'] : ''; |
|
| 444 | + $row_class = isset($row_data['meta']['class']) ? $row_data['meta']['class'] : ''; |
|
| 445 | 445 | |
| 446 | 446 | $return = "<div class='mega-row' data-available-cols='{$row_columns}'>"; |
| 447 | 447 | $return .= " <div class='mega-row-header'>"; |
@@ -456,35 +456,35 @@ discard block |
||
| 456 | 456 | $return .= " <input name='mega-hide-on-mobile' type='hidden' value='{$hide_on_mobile_checked}' />"; |
| 457 | 457 | $return .= " <input name='mega-hide-on-desktop' type='hidden' value='{$hide_on_desktop_checked}'/>"; |
| 458 | 458 | $return .= " <div class='mega-settings-row'>"; |
| 459 | - $return .= ' <label>' . __( 'Row class', 'megamenu' ) . '</label>'; |
|
| 459 | + $return .= ' <label>' . __('Row class', 'megamenu') . '</label>'; |
|
| 460 | 460 | $return .= " <input class='mega-row-class' type='text' value='{$row_class}' />"; |
| 461 | 461 | $return .= ' </div>'; |
| 462 | 462 | $return .= " <div class='mega-settings-row'>"; |
| 463 | - $return .= ' <label>' . __( 'Row columns', 'megamenu' ) . '</label>'; |
|
| 463 | + $return .= ' <label>' . __('Row columns', 'megamenu') . '</label>'; |
|
| 464 | 464 | $return .= " <select class='mega-row-columns'>"; |
| 465 | - $return .= " <option value='1' " . selected( $row_columns, 1, false ) . '>1 ' . __( 'column', 'megamenu' ) . '</option>'; |
|
| 466 | - $return .= " <option value='2' " . selected( $row_columns, 2, false ) . '>2 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 467 | - $return .= " <option value='3' " . selected( $row_columns, 3, false ) . '>3 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 468 | - $return .= " <option value='4' " . selected( $row_columns, 4, false ) . '>4 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 469 | - $return .= " <option value='5' " . selected( $row_columns, 5, false ) . '>5 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 470 | - $return .= " <option value='6' " . selected( $row_columns, 6, false ) . '>6 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 471 | - $return .= " <option value='7' " . selected( $row_columns, 7, false ) . '>7 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 472 | - $return .= " <option value='8' " . selected( $row_columns, 8, false ) . '>8 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 473 | - $return .= " <option value='9' " . selected( $row_columns, 9, false ) . '>9 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 474 | - $return .= " <option value='10' " . selected( $row_columns, 10, false ) . '>10 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 475 | - $return .= " <option value='11' " . selected( $row_columns, 11, false ) . '>11 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 476 | - $return .= " <option value='12' " . selected( $row_columns, 12, false ) . '>12 ' . __( 'columns', 'megamenu' ) . '</option>'; |
|
| 465 | + $return .= " <option value='1' " . selected($row_columns, 1, false) . '>1 ' . __('column', 'megamenu') . '</option>'; |
|
| 466 | + $return .= " <option value='2' " . selected($row_columns, 2, false) . '>2 ' . __('columns', 'megamenu') . '</option>'; |
|
| 467 | + $return .= " <option value='3' " . selected($row_columns, 3, false) . '>3 ' . __('columns', 'megamenu') . '</option>'; |
|
| 468 | + $return .= " <option value='4' " . selected($row_columns, 4, false) . '>4 ' . __('columns', 'megamenu') . '</option>'; |
|
| 469 | + $return .= " <option value='5' " . selected($row_columns, 5, false) . '>5 ' . __('columns', 'megamenu') . '</option>'; |
|
| 470 | + $return .= " <option value='6' " . selected($row_columns, 6, false) . '>6 ' . __('columns', 'megamenu') . '</option>'; |
|
| 471 | + $return .= " <option value='7' " . selected($row_columns, 7, false) . '>7 ' . __('columns', 'megamenu') . '</option>'; |
|
| 472 | + $return .= " <option value='8' " . selected($row_columns, 8, false) . '>8 ' . __('columns', 'megamenu') . '</option>'; |
|
| 473 | + $return .= " <option value='9' " . selected($row_columns, 9, false) . '>9 ' . __('columns', 'megamenu') . '</option>'; |
|
| 474 | + $return .= " <option value='10' " . selected($row_columns, 10, false) . '>10 ' . __('columns', 'megamenu') . '</option>'; |
|
| 475 | + $return .= " <option value='11' " . selected($row_columns, 11, false) . '>11 ' . __('columns', 'megamenu') . '</option>'; |
|
| 476 | + $return .= " <option value='12' " . selected($row_columns, 12, false) . '>12 ' . __('columns', 'megamenu') . '</option>'; |
|
| 477 | 477 | $return .= ' </select>'; |
| 478 | 478 | $return .= ' </div>'; |
| 479 | - $return .= " <button class='button button-primary mega-save-row-settings' type='submit'>" . __( 'Save', 'megamenu' ) . '</button>'; |
|
| 479 | + $return .= " <button class='button button-primary mega-save-row-settings' type='submit'>" . __('Save', 'megamenu') . '</button>'; |
|
| 480 | 480 | $return .= ' </div>'; |
| 481 | - $return .= " <button class='button button-primary mega-add-column'><span class='dashicons dashicons-plus'></span>" . __( 'Column', 'megamenu' ) . '</button>'; |
|
| 481 | + $return .= " <button class='button button-primary mega-add-column'><span class='dashicons dashicons-plus'></span>" . __('Column', 'megamenu') . '</button>'; |
|
| 482 | 482 | $return .= ' </div>'; |
| 483 | 483 | $return .= " <div class='error notice is-dismissible mega-too-many-cols'>"; |
| 484 | - $return .= ' <p>' . __( 'You should rearrange the content of this row so that all columns fit onto a single line.', 'megamenu' ) . '</p>'; |
|
| 484 | + $return .= ' <p>' . __('You should rearrange the content of this row so that all columns fit onto a single line.', 'megamenu') . '</p>'; |
|
| 485 | 485 | $return .= ' </div>'; |
| 486 | 486 | $return .= " <div class='error notice is-dismissible mega-row-is-full'>"; |
| 487 | - $return .= ' <p>' . __( 'There is not enough space on this row to add a new column.', 'megamenu' ) . '</p>'; |
|
| 487 | + $return .= ' <p>' . __('There is not enough space on this row to add a new column.', 'megamenu') . '</p>'; |
|
| 488 | 488 | $return .= ' </div>'; |
| 489 | 489 | |
| 490 | 490 | $return .= $column_html; |
@@ -501,23 +501,23 @@ discard block |
||
| 501 | 501 | * @since 2.4 |
| 502 | 502 | * @return string |
| 503 | 503 | */ |
| 504 | - public function get_grid_column( $row_data = false, $col_data = false ) { |
|
| 504 | + public function get_grid_column($row_data = false, $col_data = false) { |
|
| 505 | 505 | |
| 506 | 506 | $col_span = 3; |
| 507 | 507 | $row_columns = 12; |
| 508 | 508 | |
| 509 | - if ( isset( $row_data['meta']['columns'] ) ) { |
|
| 510 | - $row_columns = intval( $row_data['meta']['columns'] ); |
|
| 509 | + if (isset($row_data['meta']['columns'])) { |
|
| 510 | + $row_columns = intval($row_data['meta']['columns']); |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - if ( isset( $col_data['meta']['span'] ) ) { |
|
| 513 | + if (isset($col_data['meta']['span'])) { |
|
| 514 | 514 | $col_span = $col_data['meta']['span']; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | $hide_on_desktop_checked = 'false'; |
| 518 | 518 | $hide_on_desktop = 'mega-enabled'; |
| 519 | 519 | |
| 520 | - if ( isset( $col_data['meta']['hide-on-desktop'] ) && $col_data['meta']['hide-on-desktop'] == 'true' ) { |
|
| 520 | + if (isset($col_data['meta']['hide-on-desktop']) && $col_data['meta']['hide-on-desktop'] == 'true') { |
|
| 521 | 521 | $hide_on_desktop = 'mega-disabled'; |
| 522 | 522 | $hide_on_desktop_checked = 'true'; |
| 523 | 523 | } |
@@ -525,17 +525,17 @@ discard block |
||
| 525 | 525 | $hide_on_mobile_checked = 'false'; |
| 526 | 526 | $hide_on_mobile = 'mega-enabled'; |
| 527 | 527 | |
| 528 | - if ( isset( $col_data['meta']['hide-on-mobile'] ) && $col_data['meta']['hide-on-mobile'] == 'true' ) { |
|
| 528 | + if (isset($col_data['meta']['hide-on-mobile']) && $col_data['meta']['hide-on-mobile'] == 'true') { |
|
| 529 | 529 | $hide_on_mobile = 'mega-disabled'; |
| 530 | 530 | $hide_on_mobile_checked = 'true'; |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | - $desktop_tooltip_visible = __( 'Column', 'megamenu' ) . ': ' . __( 'Visible on desktop', 'megamenu' ); |
|
| 534 | - $desktop_tooltip_hidden = __( 'Column', 'megamenu' ) . ': ' . __( 'Hidden on desktop', 'megamenu' ); |
|
| 535 | - $mobile_tooltip_visible = __( 'Column', 'megamenu' ) . ': ' . __( 'Visible on mobile', 'megamenu' ); |
|
| 536 | - $mobile_tooltip_hidden = __( 'Column', 'megamenu' ) . ': ' . __( 'Hidden on mobile', 'megamenu' ); |
|
| 533 | + $desktop_tooltip_visible = __('Column', 'megamenu') . ': ' . __('Visible on desktop', 'megamenu'); |
|
| 534 | + $desktop_tooltip_hidden = __('Column', 'megamenu') . ': ' . __('Hidden on desktop', 'megamenu'); |
|
| 535 | + $mobile_tooltip_visible = __('Column', 'megamenu') . ': ' . __('Visible on mobile', 'megamenu'); |
|
| 536 | + $mobile_tooltip_hidden = __('Column', 'megamenu') . ': ' . __('Hidden on mobile', 'megamenu'); |
|
| 537 | 537 | |
| 538 | - $col_class = isset( $col_data['meta']['class'] ) ? $col_data['meta']['class'] : ''; |
|
| 538 | + $col_class = isset($col_data['meta']['class']) ? $col_data['meta']['class'] : ''; |
|
| 539 | 539 | |
| 540 | 540 | $return = "<div class='mega-col' data-span='{$col_span}'>"; |
| 541 | 541 | $return .= " <div class='mega-col-wrap'>"; |
@@ -548,30 +548,30 @@ discard block |
||
| 548 | 548 | $return .= " <span class='dashicons dashicons-trash'></span>"; |
| 549 | 549 | $return .= ' </div>'; |
| 550 | 550 | $return .= ' <div class="mega-col-actions">'; |
| 551 | - $return .= ' <a class="mega-col-option mega-col-contract" title="' . esc_attr( __( 'Contract', 'megamenu' ) ) . '"><span class="dashicons dashicons-arrow-left-alt2"></span></a>'; |
|
| 551 | + $return .= ' <a class="mega-col-option mega-col-contract" title="' . esc_attr(__('Contract', 'megamenu')) . '"><span class="dashicons dashicons-arrow-left-alt2"></span></a>'; |
|
| 552 | 552 | $return .= " <span class='mega-col-cols'><span class='mega-num-cols'>{$col_span}</span><span class='mega-of'>/</span><span class='mega-num-total-cols'>" . $row_columns . '</span></span>'; |
| 553 | - $return .= ' <a class="mega-col-options mega-col-expand" title="' . esc_attr( __( 'Expand', 'megamenu' ) ) . '"><span class="dashicons dashicons-arrow-right-alt2"></span></a>'; |
|
| 553 | + $return .= ' <a class="mega-col-options mega-col-expand" title="' . esc_attr(__('Expand', 'megamenu')) . '"><span class="dashicons dashicons-arrow-right-alt2"></span></a>'; |
|
| 554 | 554 | $return .= ' </div>'; |
| 555 | 555 | $return .= ' </div>'; |
| 556 | 556 | $return .= " <div class='mega-col-settings'>"; |
| 557 | 557 | $return .= " <input name='mega-hide-on-mobile' type='hidden' value='{$hide_on_mobile_checked}' />"; |
| 558 | 558 | $return .= " <input name='mega-hide-on-desktop' type='hidden' value='{$hide_on_desktop_checked}'/>"; |
| 559 | - $return .= ' <label>' . __( 'Column class', 'megamenu' ) . '</label>'; |
|
| 559 | + $return .= ' <label>' . __('Column class', 'megamenu') . '</label>'; |
|
| 560 | 560 | $return .= " <input class='mega-column-class' type='text' value='{$col_class}' />"; |
| 561 | - $return .= " <button class='button button-primary mega-save-column-settings' type='submit'>" . __( 'Save', 'megamenu' ) . '</button>'; |
|
| 561 | + $return .= " <button class='button button-primary mega-save-column-settings' type='submit'>" . __('Save', 'megamenu') . '</button>'; |
|
| 562 | 562 | $return .= ' </div>'; |
| 563 | 563 | $return .= " <div class='mega-col-widgets'>"; |
| 564 | 564 | |
| 565 | - if ( isset( $col_data['items'] ) && count( $col_data['items'] ) ) { |
|
| 566 | - foreach ( $col_data['items'] as $item ) { |
|
| 567 | - $return .= '<div class="widget" title="' . esc_attr( $item['title'] ) . '" id="' . esc_attr( $item['id'] ) . '" data-type="' . esc_attr( $item['type'] ) . '" data-id="' . esc_attr( $item['id'] ) . '">'; |
|
| 565 | + if (isset($col_data['items']) && count($col_data['items'])) { |
|
| 566 | + foreach ($col_data['items'] as $item) { |
|
| 567 | + $return .= '<div class="widget" title="' . esc_attr($item['title']) . '" id="' . esc_attr($item['id']) . '" data-type="' . esc_attr($item['type']) . '" data-id="' . esc_attr($item['id']) . '">'; |
|
| 568 | 568 | $return .= ' <div class="widget-top">'; |
| 569 | 569 | $return .= ' <div class="widget-title">'; |
| 570 | - $return .= ' <h4>' . esc_html( $item['title'] ) . '</h4>'; |
|
| 571 | - $return .= ' <span class="widget-desc">' . esc_html( $item['description'] ) . '</span>'; |
|
| 570 | + $return .= ' <h4>' . esc_html($item['title']) . '</h4>'; |
|
| 571 | + $return .= ' <span class="widget-desc">' . esc_html($item['description']) . '</span>'; |
|
| 572 | 572 | $return .= ' </div>'; |
| 573 | 573 | $return .= ' <div class="widget-title-action">'; |
| 574 | - $return .= ' <a class="widget-option widget-action" title="' . esc_attr( __( 'Edit', 'megamenu' ) ) . '"></a>'; |
|
| 574 | + $return .= ' <a class="widget-option widget-action" title="' . esc_attr(__('Edit', 'megamenu')) . '"></a>'; |
|
| 575 | 575 | $return .= ' </div>'; |
| 576 | 576 | $return .= ' </div>'; |
| 577 | 577 | $return .= ' <div class="widget-inner widget-inside"></div>'; |
@@ -592,34 +592,34 @@ discard block |
||
| 592 | 592 | * |
| 593 | 593 | * @return string |
| 594 | 594 | */ |
| 595 | - public function get_megamenu_html( $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 595 | + public function get_megamenu_html($menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta) { |
|
| 596 | 596 | |
| 597 | 597 | $widget_manager = new Mega_Menu_Widget_Manager(); |
| 598 | 598 | |
| 599 | 599 | $return = "<div id='widgets' data-columns='{$menu_item_meta['panel_columns']}'>"; |
| 600 | 600 | |
| 601 | - $items = $widget_manager->get_widgets_and_menu_items_for_menu_id( $menu_item_id, $menu_id ); |
|
| 601 | + $items = $widget_manager->get_widgets_and_menu_items_for_menu_id($menu_item_id, $menu_id); |
|
| 602 | 602 | |
| 603 | - if ( count( $items ) ) { |
|
| 603 | + if (count($items)) { |
|
| 604 | 604 | |
| 605 | - foreach ( $items as $item ) { |
|
| 606 | - $return .= '<div class="widget" title="' . esc_attr( $item['title'] ) . '" id="' . esc_attr( $item['id'] ) . '" data-columns="' . esc_attr( $item['columns'] ) . '" data-type="' . esc_attr( $item['type'] ) . '" data-id="' . esc_attr( $item['id'] ) . '">'; |
|
| 605 | + foreach ($items as $item) { |
|
| 606 | + $return .= '<div class="widget" title="' . esc_attr($item['title']) . '" id="' . esc_attr($item['id']) . '" data-columns="' . esc_attr($item['columns']) . '" data-type="' . esc_attr($item['type']) . '" data-id="' . esc_attr($item['id']) . '">'; |
|
| 607 | 607 | $return .= ' <div class="widget-top">'; |
| 608 | 608 | $return .= ' <div class="widget-title-action">'; |
| 609 | - $return .= ' <a class="widget-option widget-contract" title="' . esc_attr( __( 'Contract', 'megamenu' ) ) . '"></a>'; |
|
| 609 | + $return .= ' <a class="widget-option widget-contract" title="' . esc_attr(__('Contract', 'megamenu')) . '"></a>'; |
|
| 610 | 610 | $return .= ' <span class="widget-cols"><span class="widget-num-cols">' . $item['columns'] . '</span><span class="widget-of">/</span><span class="widget-total-cols">' . $menu_item_meta['panel_columns'] . '</span></span>'; |
| 611 | - $return .= ' <a class="widget-option widget-expand" title="' . esc_attr( __( 'Expand', 'megamenu' ) ) . '"></a>'; |
|
| 612 | - $return .= ' <a class="widget-option widget-action" title="' . esc_attr( __( 'Edit', 'megamenu' ) ) . '"></a>'; |
|
| 611 | + $return .= ' <a class="widget-option widget-expand" title="' . esc_attr(__('Expand', 'megamenu')) . '"></a>'; |
|
| 612 | + $return .= ' <a class="widget-option widget-action" title="' . esc_attr(__('Edit', 'megamenu')) . '"></a>'; |
|
| 613 | 613 | $return .= ' </div>'; |
| 614 | 614 | $return .= ' <div class="widget-title">'; |
| 615 | - $return .= ' <h4>' . esc_html( $item['title'] ) . '</h4>'; |
|
| 615 | + $return .= ' <h4>' . esc_html($item['title']) . '</h4>'; |
|
| 616 | 616 | $return .= ' </div>'; |
| 617 | 617 | $return .= ' </div>'; |
| 618 | 618 | $return .= ' <div class="widget-inner widget-inside"></div>'; |
| 619 | 619 | $return .= '</div>'; |
| 620 | 620 | } |
| 621 | 621 | } else { |
| 622 | - $return .= "<p class='no_widgets'>" . __( 'No widgets found. Add a widget to this area using the Widget Selector (top right)', 'megamenu' ) . '</p>'; |
|
| 622 | + $return .= "<p class='no_widgets'>" . __('No widgets found. Add a widget to this area using the Widget Selector (top right)', 'megamenu') . '</p>'; |
|
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | $return .= '</div>'; |
@@ -633,71 +633,71 @@ discard block |
||
| 633 | 633 | * @since 1.7 |
| 634 | 634 | * @return array |
| 635 | 635 | */ |
| 636 | - public function add_general_settings_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 636 | + public function add_general_settings_tab($tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta) { |
|
| 637 | 637 | |
| 638 | 638 | $return = '<form>'; |
| 639 | - $return .= ' <input type="hidden" name="menu_item_id" value="' . esc_attr( $menu_item_id ) . '" />'; |
|
| 639 | + $return .= ' <input type="hidden" name="menu_item_id" value="' . esc_attr($menu_item_id) . '" />'; |
|
| 640 | 640 | $return .= ' <input type="hidden" name="action" value="mm_save_menu_item_settings" />'; |
| 641 | - $return .= ' <input type="hidden" name="_wpnonce" value="' . wp_create_nonce( 'megamenu_edit' ) . '" />'; |
|
| 641 | + $return .= ' <input type="hidden" name="_wpnonce" value="' . wp_create_nonce('megamenu_edit') . '" />'; |
|
| 642 | 642 | $return .= ' <input type="hidden" name="tab" value="general_settings" />'; |
| 643 | - $return .= ' <h4 class="first">' . __( 'Menu Item Settings', 'megamenu' ) . '</h4>'; |
|
| 643 | + $return .= ' <h4 class="first">' . __('Menu Item Settings', 'megamenu') . '</h4>'; |
|
| 644 | 644 | $return .= ' <table>'; |
| 645 | 645 | $return .= ' <tr>'; |
| 646 | 646 | $return .= ' <td class="mega-name">'; |
| 647 | - $return .= __( 'Hide text', 'megamenu' ); |
|
| 647 | + $return .= __('Hide text', 'megamenu'); |
|
| 648 | 648 | $return .= ' </td>'; |
| 649 | 649 | $return .= ' <td class="mega-value">'; |
| 650 | - $return .= ' <input type="checkbox" name="settings[hide_text]" value="true" ' . checked( $menu_item_meta['hide_text'], 'true', false ) . ' />'; |
|
| 650 | + $return .= ' <input type="checkbox" name="settings[hide_text]" value="true" ' . checked($menu_item_meta['hide_text'], 'true', false) . ' />'; |
|
| 651 | 651 | $return .= ' </td>'; |
| 652 | 652 | $return .= ' </tr>'; |
| 653 | 653 | $return .= ' <tr>'; |
| 654 | 654 | $return .= ' <td class="mega-name">'; |
| 655 | - $return .= __( 'Hide arrow', 'megamenu' ); |
|
| 655 | + $return .= __('Hide arrow', 'megamenu'); |
|
| 656 | 656 | $return .= ' </td>'; |
| 657 | 657 | $return .= ' <td class="mega-value">'; |
| 658 | - $return .= ' <input type="checkbox" name="settings[hide_arrow]" value="true" ' . checked( $menu_item_meta['hide_arrow'], 'true', false ) . ' />'; |
|
| 658 | + $return .= ' <input type="checkbox" name="settings[hide_arrow]" value="true" ' . checked($menu_item_meta['hide_arrow'], 'true', false) . ' />'; |
|
| 659 | 659 | $return .= ' </td>'; |
| 660 | 660 | $return .= ' </tr>'; |
| 661 | 661 | $return .= ' <tr>'; |
| 662 | 662 | $return .= ' <td class="mega-name">'; |
| 663 | - $return .= __( 'Disable link', 'megamenu' ); |
|
| 663 | + $return .= __('Disable link', 'megamenu'); |
|
| 664 | 664 | $return .= ' </td>'; |
| 665 | 665 | $return .= ' <td class="mega-value">'; |
| 666 | - $return .= ' <input type="checkbox" name="settings[disable_link]" value="true" ' . checked( $menu_item_meta['disable_link'], 'true', false ) . ' />'; |
|
| 666 | + $return .= ' <input type="checkbox" name="settings[disable_link]" value="true" ' . checked($menu_item_meta['disable_link'], 'true', false) . ' />'; |
|
| 667 | 667 | $return .= ' </td>'; |
| 668 | 668 | $return .= ' </tr>'; |
| 669 | 669 | $return .= ' <tr>'; |
| 670 | 670 | $return .= ' <td class="mega-name">'; |
| 671 | - $return .= __( 'Hide item on mobile', 'megamenu' ); |
|
| 671 | + $return .= __('Hide item on mobile', 'megamenu'); |
|
| 672 | 672 | $return .= ' </td>'; |
| 673 | 673 | $return .= ' <td class="mega-value">'; |
| 674 | - $return .= ' <input type="checkbox" name="settings[hide_on_mobile]" value="true" ' . checked( $menu_item_meta['hide_on_mobile'], 'true', false ) . ' />'; |
|
| 674 | + $return .= ' <input type="checkbox" name="settings[hide_on_mobile]" value="true" ' . checked($menu_item_meta['hide_on_mobile'], 'true', false) . ' />'; |
|
| 675 | 675 | $return .= ' </td>'; |
| 676 | 676 | $return .= ' </tr>'; |
| 677 | 677 | $return .= ' <tr>'; |
| 678 | 678 | $return .= ' <td class="mega-name">'; |
| 679 | - $return .= __( 'Hide item on desktop', 'megamenu' ); |
|
| 679 | + $return .= __('Hide item on desktop', 'megamenu'); |
|
| 680 | 680 | $return .= ' </td>'; |
| 681 | 681 | $return .= ' <td class="mega-value">'; |
| 682 | - $return .= ' <input type="checkbox" name="settings[hide_on_desktop]" value="true" ' . checked( $menu_item_meta['hide_on_desktop'], 'true', false ) . ' />'; |
|
| 682 | + $return .= ' <input type="checkbox" name="settings[hide_on_desktop]" value="true" ' . checked($menu_item_meta['hide_on_desktop'], 'true', false) . ' />'; |
|
| 683 | 683 | $return .= ' </td>'; |
| 684 | 684 | $return .= ' </tr>'; |
| 685 | 685 | $return .= ' <td class="mega-name">'; |
| 686 | - $return .= __( 'Close sub menu when clicked', 'megamenu' ); |
|
| 686 | + $return .= __('Close sub menu when clicked', 'megamenu'); |
|
| 687 | 687 | $return .= ' </td>'; |
| 688 | 688 | $return .= ' <td class="mega-value">'; |
| 689 | - $return .= ' <input type="checkbox" name="settings[close_after_click]" value="true" ' . checked( $menu_item_meta['close_after_click'], 'true', false ) . ' />'; |
|
| 689 | + $return .= ' <input type="checkbox" name="settings[close_after_click]" value="true" ' . checked($menu_item_meta['close_after_click'], 'true', false) . ' />'; |
|
| 690 | 690 | $return .= ' <div class="mega-description">'; |
| 691 | - $return .= __( 'Intended for use on anchor links (e.g. #about)', 'megamenu' ); |
|
| 692 | - $return .= ' </div>'; $return .= ' </td>'; |
|
| 691 | + $return .= __('Intended for use on anchor links (e.g. #about)', 'megamenu'); |
|
| 692 | + $return .= ' </div>'; $return .= ' </td>'; |
|
| 693 | 693 | $return .= ' </tr>'; |
| 694 | 694 | $return .= ' <tr class="mega-menu-item-align">'; |
| 695 | 695 | $return .= ' <td class="mega-name">'; |
| 696 | - $return .= __( 'Menu item align', 'megamenu' ); |
|
| 696 | + $return .= __('Menu item align', 'megamenu'); |
|
| 697 | 697 | $return .= ' </td>'; |
| 698 | 698 | $return .= ' <td class="mega-value">'; |
| 699 | 699 | |
| 700 | - if ( $menu_item_depth == 0 ) { |
|
| 700 | + if ($menu_item_depth == 0) { |
|
| 701 | 701 | |
| 702 | 702 | $item_align = $menu_item_meta['item_align']; |
| 703 | 703 | |
@@ -706,96 +706,96 @@ discard block |
||
| 706 | 706 | $right_display = $item_align == 'right' ? 'block' : 'none'; |
| 707 | 707 | |
| 708 | 708 | $return .= ' <select id="mega-item-align" name="settings[item_align]">'; |
| 709 | - $return .= ' <option value="float-left" ' . selected( $menu_item_meta['item_align'], 'float-left', false ) . '>' . __( 'Left', 'megamenu' ) . '</option>'; |
|
| 710 | - $return .= ' <option value="left" ' . selected( $menu_item_meta['item_align'], 'left', false ) . '>' . __( 'Default', 'megamenu' ) . '</option>'; |
|
| 711 | - $return .= ' <option value="right" ' . selected( $menu_item_meta['item_align'], 'right', false ) . '>' . __( 'Right', 'megamenu' ) . '</option>'; |
|
| 709 | + $return .= ' <option value="float-left" ' . selected($menu_item_meta['item_align'], 'float-left', false) . '>' . __('Left', 'megamenu') . '</option>'; |
|
| 710 | + $return .= ' <option value="left" ' . selected($menu_item_meta['item_align'], 'left', false) . '>' . __('Default', 'megamenu') . '</option>'; |
|
| 711 | + $return .= ' <option value="right" ' . selected($menu_item_meta['item_align'], 'right', false) . '>' . __('Right', 'megamenu') . '</option>'; |
|
| 712 | 712 | $return .= ' </select>'; |
| 713 | 713 | $return .= ' <div class="mega-description">'; |
| 714 | 714 | $return .= " <div class='float-left' style='display:{$float_left_display}'></div>"; |
| 715 | - $return .= " <div class='left' style='display:{$left_display}'>" . __( "Item will be aligned based on the 'Menu Items Align' option set in the Theme Editor", 'megamenu' ) . '</div>'; |
|
| 716 | - $return .= " <div class='right' style='display:{$right_display}'>" . __( 'Right aligned items will appear in reverse order on the right hand side of the menu bar', 'megamenu' ) . '</div>'; |
|
| 715 | + $return .= " <div class='left' style='display:{$left_display}'>" . __("Item will be aligned based on the 'Menu Items Align' option set in the Theme Editor", 'megamenu') . '</div>'; |
|
| 716 | + $return .= " <div class='right' style='display:{$right_display}'>" . __('Right aligned items will appear in reverse order on the right hand side of the menu bar', 'megamenu') . '</div>'; |
|
| 717 | 717 | $return .= ' </div>'; |
| 718 | 718 | } else { |
| 719 | - $return .= '<em>' . __( 'Option only available for top level menu items', 'megamenu' ) . '</em>'; |
|
| 719 | + $return .= '<em>' . __('Option only available for top level menu items', 'megamenu') . '</em>'; |
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | $return .= ' </td>'; |
| 723 | 723 | $return .= ' </tr>'; |
| 724 | 724 | $return .= ' <tr class="mega-menu-icon-position">'; |
| 725 | 725 | $return .= ' <td class="mega-name">'; |
| 726 | - $return .= __( 'Icon position', 'megamenu' ); |
|
| 726 | + $return .= __('Icon position', 'megamenu'); |
|
| 727 | 727 | $return .= ' </td>'; |
| 728 | 728 | $return .= ' <td class="mega-value">'; |
| 729 | 729 | $return .= ' <select name="settings[icon_position]">'; |
| 730 | - $return .= ' <option value="left" ' . selected( $menu_item_meta['icon_position'], 'left', false ) . '>' . __( 'Left', 'megamenu' ) . '</option>'; |
|
| 731 | - $return .= ' <option value="top" ' . selected( $menu_item_meta['icon_position'], 'top', false ) . '>' . __( 'Top', 'megamenu' ) . '</option>'; |
|
| 732 | - $return .= ' <option value="right" ' . selected( $menu_item_meta['icon_position'], 'right', false ) . '>' . __( 'Right', 'megamenu' ) . '</option>'; |
|
| 730 | + $return .= ' <option value="left" ' . selected($menu_item_meta['icon_position'], 'left', false) . '>' . __('Left', 'megamenu') . '</option>'; |
|
| 731 | + $return .= ' <option value="top" ' . selected($menu_item_meta['icon_position'], 'top', false) . '>' . __('Top', 'megamenu') . '</option>'; |
|
| 732 | + $return .= ' <option value="right" ' . selected($menu_item_meta['icon_position'], 'right', false) . '>' . __('Right', 'megamenu') . '</option>'; |
|
| 733 | 733 | $return .= ' </select>'; |
| 734 | 734 | |
| 735 | 735 | $return .= ' </td>'; |
| 736 | 736 | $return .= ' </tr>'; |
| 737 | 737 | |
| 738 | - $return .= apply_filters( 'megamenu_after_menu_item_settings', '', $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 738 | + $return .= apply_filters('megamenu_after_menu_item_settings', '', $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta); |
|
| 739 | 739 | |
| 740 | 740 | $return .= ' </table>'; |
| 741 | 741 | |
| 742 | - $return .= ' <h4>' . __( 'Sub Menu Settings', 'megamenu' ) . '</h4>'; |
|
| 742 | + $return .= ' <h4>' . __('Sub Menu Settings', 'megamenu') . '</h4>'; |
|
| 743 | 743 | |
| 744 | 744 | $return .= ' <table>'; |
| 745 | 745 | $return .= ' <tr class="mega-sub-menu-align">'; |
| 746 | 746 | $return .= ' <td class="mega-name">'; |
| 747 | - $return .= __( 'Sub menu align', 'megamenu' ); |
|
| 747 | + $return .= __('Sub menu align', 'megamenu'); |
|
| 748 | 748 | $return .= ' </td>'; |
| 749 | 749 | $return .= ' <td class="mega-value">'; |
| 750 | 750 | |
| 751 | - if ( $menu_item_depth == 0 ) { |
|
| 751 | + if ($menu_item_depth == 0) { |
|
| 752 | 752 | $return .= ' <select name="settings[align]">'; |
| 753 | - $return .= ' <option value="bottom-left" ' . selected( $menu_item_meta['align'], 'bottom-left', false ) . '>' . __( 'Left edge of Parent', 'megamenu' ) . '</option>'; |
|
| 754 | - $return .= ' <option value="bottom-right" ' . selected( $menu_item_meta['align'], 'bottom-right', false ) . '>' . __( 'Right edge of Parent', 'megamenu' ) . '</option>'; |
|
| 753 | + $return .= ' <option value="bottom-left" ' . selected($menu_item_meta['align'], 'bottom-left', false) . '>' . __('Left edge of Parent', 'megamenu') . '</option>'; |
|
| 754 | + $return .= ' <option value="bottom-right" ' . selected($menu_item_meta['align'], 'bottom-right', false) . '>' . __('Right edge of Parent', 'megamenu') . '</option>'; |
|
| 755 | 755 | $return .= ' </select>'; |
| 756 | 756 | $return .= ' <div class="mega-description">'; |
| 757 | - $return .= __( 'Right aligned flyout menus will expand to the left', 'megamenu' ); |
|
| 757 | + $return .= __('Right aligned flyout menus will expand to the left', 'megamenu'); |
|
| 758 | 758 | $return .= ' </div>'; |
| 759 | 759 | } else { |
| 760 | - $return .= '<em>' . __( 'Option only available for top level menu items', 'megamenu' ) . '</em>'; |
|
| 760 | + $return .= '<em>' . __('Option only available for top level menu items', 'megamenu') . '</em>'; |
|
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | $return .= ' </td>'; |
| 764 | 764 | $return .= ' </tr>'; |
| 765 | 765 | $return .= ' <tr>'; |
| 766 | 766 | $return .= ' <td class="mega-name">'; |
| 767 | - $return .= __( 'Hide sub menu on mobile', 'megamenu' ); |
|
| 767 | + $return .= __('Hide sub menu on mobile', 'megamenu'); |
|
| 768 | 768 | $return .= ' </td>'; |
| 769 | 769 | $return .= ' <td class="mega-value">'; |
| 770 | - $return .= ' <input type="checkbox" name="settings[hide_sub_menu_on_mobile]" value="true" ' . checked( $menu_item_meta['hide_sub_menu_on_mobile'], 'true', false ) . ' />'; |
|
| 770 | + $return .= ' <input type="checkbox" name="settings[hide_sub_menu_on_mobile]" value="true" ' . checked($menu_item_meta['hide_sub_menu_on_mobile'], 'true', false) . ' />'; |
|
| 771 | 771 | $return .= ' </td>'; |
| 772 | 772 | $return .= ' </tr>'; |
| 773 | 773 | |
| 774 | - if ( $menu_item_depth > 0 ) { |
|
| 775 | - $css_version = get_transient( 'megamenu_css_version' ); |
|
| 774 | + if ($menu_item_depth > 0) { |
|
| 775 | + $css_version = get_transient('megamenu_css_version'); |
|
| 776 | 776 | $notice = ''; |
| 777 | 777 | |
| 778 | - if ( $css_version && version_compare( $css_version, '2.6.1', '<' ) ) { |
|
| 779 | - $link = "<a href='" . esc_attr( admin_url( 'admin.php?page=maxmegamenu_tools' ) ) . "'>" . __( 'Mega Menu' ) . ' > ' . __( 'Tools' ) . '</a>'; |
|
| 778 | + if ($css_version && version_compare($css_version, '2.6.1', '<')) { |
|
| 779 | + $link = "<a href='" . esc_attr(admin_url('admin.php?page=maxmegamenu_tools')) . "'>" . __('Mega Menu') . ' > ' . __('Tools') . '</a>'; |
|
| 780 | 780 | $notice = "<div class='notice notice-success'><p>"; |
| 781 | - $notice .= sprintf( __( 'Your menu CSS needs to be updated before you can use the following setting. Please go to %s and Clear the CSS Cache (you will only need to do this once).', 'megamenu' ), $link ); |
|
| 781 | + $notice .= sprintf(__('Your menu CSS needs to be updated before you can use the following setting. Please go to %s and Clear the CSS Cache (you will only need to do this once).', 'megamenu'), $link); |
|
| 782 | 782 | $notice .= '</p></div>'; |
| 783 | 783 | $notice .= '</div><br />'; |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | $return .= ' <tr>'; |
| 787 | 787 | $return .= ' <td class="mega-name">'; |
| 788 | - $return .= __( 'Collapse sub menu', 'megamenu' ); |
|
| 788 | + $return .= __('Collapse sub menu', 'megamenu'); |
|
| 789 | 789 | $return .= ' </td>'; |
| 790 | 790 | $return .= ' <td class="mega-value">'; |
| 791 | 791 | $return .= $notice; |
| 792 | - $return .= ' <input type="checkbox" name="settings[collapse_children]" value="true" ' . checked( $menu_item_meta['collapse_children'], 'true', false ) . ' />'; |
|
| 793 | - $return .= ' <em>' . __( 'Only applies to menu items displayed within mega sub menus.', 'megamenu' ) . '</em>'; |
|
| 792 | + $return .= ' <input type="checkbox" name="settings[collapse_children]" value="true" ' . checked($menu_item_meta['collapse_children'], 'true', false) . ' />'; |
|
| 793 | + $return .= ' <em>' . __('Only applies to menu items displayed within mega sub menus.', 'megamenu') . '</em>'; |
|
| 794 | 794 | $return .= ' </td>'; |
| 795 | 795 | $return .= ' </tr>'; |
| 796 | 796 | } |
| 797 | 797 | |
| 798 | - $return .= apply_filters( 'megamenu_after_menu_item_submenu_settings', '', $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 798 | + $return .= apply_filters('megamenu_after_menu_item_submenu_settings', '', $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta); |
|
| 799 | 799 | |
| 800 | 800 | $return .= ' </table>'; |
| 801 | 801 | |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | $return .= '</form>'; |
| 804 | 804 | |
| 805 | 805 | $tabs['general_settings'] = array( |
| 806 | - 'title' => __( 'Settings', 'megamenu' ), |
|
| 806 | + 'title' => __('Settings', 'megamenu'), |
|
| 807 | 807 | 'content' => $return, |
| 808 | 808 | ); |
| 809 | 809 | |
@@ -818,58 +818,58 @@ discard block |
||
| 818 | 818 | * @since 1.7 |
| 819 | 819 | * @return array |
| 820 | 820 | */ |
| 821 | - public function add_icon_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) { |
|
| 821 | + public function add_icon_tab($tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta) { |
|
| 822 | 822 | |
| 823 | 823 | $icon_tabs = array( |
| 824 | 824 | 'dashicons' => array( |
| 825 | - 'title' => __( 'Dashicons', 'megamenu' ), |
|
| 826 | - 'active' => ! isset( $menu_item_meta['icon'] ) || ( isset( $menu_item_meta['icon'] ) && substr( $menu_item_meta['icon'], 0, strlen( 'dash' ) ) === 'dash' || $menu_item_meta['icon'] == 'disabled' ), |
|
| 825 | + 'title' => __('Dashicons', 'megamenu'), |
|
| 826 | + 'active' => !isset($menu_item_meta['icon']) || (isset($menu_item_meta['icon']) && substr($menu_item_meta['icon'], 0, strlen('dash')) === 'dash' || $menu_item_meta['icon'] == 'disabled'), |
|
| 827 | 827 | 'content' => $this->dashicon_selector(), |
| 828 | 828 | ), |
| 829 | 829 | 'fontawesome' => array( |
| 830 | - 'title' => __( 'Font Awesome', 'megamenu' ), |
|
| 830 | + 'title' => __('Font Awesome', 'megamenu'), |
|
| 831 | 831 | 'active' => false, |
| 832 | - 'content' => str_replace( '{link}', "<a target='_blank' href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __( 'Max Mega Menu Pro', 'megamenu' ) . '</a>', __( 'Get access to over 400 Font Awesome Icons with {link}', 'megamenu' ) ), |
|
| 832 | + 'content' => str_replace('{link}', "<a target='_blank' href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __('Max Mega Menu Pro', 'megamenu') . '</a>', __('Get access to over 400 Font Awesome Icons with {link}', 'megamenu')), |
|
| 833 | 833 | ), |
| 834 | 834 | 'genericons' => array( |
| 835 | - 'title' => __( 'Genericons', 'megamenu' ), |
|
| 835 | + 'title' => __('Genericons', 'megamenu'), |
|
| 836 | 836 | 'active' => false, |
| 837 | - 'content' => str_replace( '{link}', "<a target='_blank' href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __( 'Max Mega Menu Pro', 'megamenu' ) . '</a>', __( 'Choose from over 100 genericons with {link}', 'megamenu' ) ), |
|
| 837 | + 'content' => str_replace('{link}', "<a target='_blank' href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __('Max Mega Menu Pro', 'megamenu') . '</a>', __('Choose from over 100 genericons with {link}', 'megamenu')), |
|
| 838 | 838 | ), |
| 839 | 839 | 'custom' => array( |
| 840 | - 'title' => __( 'Custom Icon', 'megamenu' ), |
|
| 840 | + 'title' => __('Custom Icon', 'megamenu'), |
|
| 841 | 841 | 'active' => false, |
| 842 | - 'content' => str_replace( '{link}', "<a target='_blank' href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __( 'Max Mega Menu Pro', 'megamenu' ) . '</a>', __( 'Select icons from your media library with {link}', 'megamenu' ) ), |
|
| 842 | + 'content' => str_replace('{link}', "<a target='_blank' href='https://www.megamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __('Max Mega Menu Pro', 'megamenu') . '</a>', __('Select icons from your media library with {link}', 'megamenu')), |
|
| 843 | 843 | ), |
| 844 | 844 | ); |
| 845 | 845 | |
| 846 | - $icon_tabs = apply_filters( 'megamenu_icon_tabs', $icon_tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ); |
|
| 846 | + $icon_tabs = apply_filters('megamenu_icon_tabs', $icon_tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta); |
|
| 847 | 847 | |
| 848 | - $return = "<h4 class='first'>" . __( 'Menu Item Icon', 'megamenu' ) . '</h4>'; |
|
| 848 | + $return = "<h4 class='first'>" . __('Menu Item Icon', 'megamenu') . '</h4>'; |
|
| 849 | 849 | $return .= "<ul class='mm_tabs horizontal'>"; |
| 850 | 850 | |
| 851 | - foreach ( $icon_tabs as $id => $icon_tab ) { |
|
| 851 | + foreach ($icon_tabs as $id => $icon_tab) { |
|
| 852 | 852 | |
| 853 | - $active = $icon_tab['active'] || count( $icon_tabs ) === 1 ? 'active' : ''; |
|
| 853 | + $active = $icon_tab['active'] || count($icon_tabs) === 1 ? 'active' : ''; |
|
| 854 | 854 | |
| 855 | 855 | $return .= "<li rel='mm_tab_{$id}' class='mm_tab_horizontal {$active}'>"; |
| 856 | - $return .= esc_html( $icon_tab['title'] ); |
|
| 856 | + $return .= esc_html($icon_tab['title']); |
|
| 857 | 857 | $return .= '</li>'; |
| 858 | 858 | |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | $return .= '</ul>'; |
| 862 | 862 | |
| 863 | - $return .= "<input type='text' class='filter_icons' placeholder='" . __( 'Search', 'megamenu' ) . "' /><div class='clear'></div>"; |
|
| 863 | + $return .= "<input type='text' class='filter_icons' placeholder='" . __('Search', 'megamenu') . "' /><div class='clear'></div>"; |
|
| 864 | 864 | |
| 865 | - foreach ( $icon_tabs as $id => $icon_tab ) { |
|
| 865 | + foreach ($icon_tabs as $id => $icon_tab) { |
|
| 866 | 866 | |
| 867 | 867 | $display = $icon_tab['active'] ? 'block' : 'none'; |
| 868 | 868 | |
| 869 | 869 | $return .= "<div class='mm_tab_{$id}' style='display: {$display}'>"; |
| 870 | 870 | $return .= " <form class='icon_selector icon_selector_{$id}'>"; |
| 871 | - $return .= " <input type='hidden' name='_wpnonce' value='" . wp_create_nonce( 'megamenu_edit' ) . "' />"; |
|
| 872 | - $return .= " <input type='hidden' name='menu_item_id' value='" . esc_attr( $menu_item_id ) . "' />"; |
|
| 871 | + $return .= " <input type='hidden' name='_wpnonce' value='" . wp_create_nonce('megamenu_edit') . "' />"; |
|
| 872 | + $return .= " <input type='hidden' name='menu_item_id' value='" . esc_attr($menu_item_id) . "' />"; |
|
| 873 | 873 | $return .= " <input type='hidden' name='action' value='mm_save_menu_item_settings' />"; |
| 874 | 874 | $return .= $icon_tab['content']; |
| 875 | 875 | $return .= ' </form>'; |
@@ -878,7 +878,7 @@ discard block |
||
| 878 | 878 | } |
| 879 | 879 | |
| 880 | 880 | $tabs['menu_icon'] = array( |
| 881 | - 'title' => __( 'Icon', 'megamenu' ), |
|
| 881 | + 'title' => __('Icon', 'megamenu'), |
|
| 882 | 882 | 'content' => $return, |
| 883 | 883 | ); |
| 884 | 884 | |
@@ -894,17 +894,17 @@ discard block |
||
| 894 | 894 | */ |
| 895 | 895 | private function dashicon_selector() { |
| 896 | 896 | |
| 897 | - $return = "<div class='disabled'><input id='disabled' class='radio' type='radio' rel='disabled' name='settings[icon]' value='disabled' " . checked( $this->menu_item_meta['icon'], 'disabled', false ) . ' />'; |
|
| 897 | + $return = "<div class='disabled'><input id='disabled' class='radio' type='radio' rel='disabled' name='settings[icon]' value='disabled' " . checked($this->menu_item_meta['icon'], 'disabled', false) . ' />'; |
|
| 898 | 898 | $return .= "<label for='disabled'></label></div>"; |
| 899 | 899 | |
| 900 | - foreach ( $this->all_icons() as $code => $class ) { |
|
| 900 | + foreach ($this->all_icons() as $code => $class) { |
|
| 901 | 901 | |
| 902 | - $bits = explode( '-', $code ); |
|
| 902 | + $bits = explode('-', $code); |
|
| 903 | 903 | $code = '&#x' . $bits[1] . ''; |
| 904 | 904 | $type = $bits[0]; |
| 905 | 905 | |
| 906 | 906 | $return .= "<div class='{$type}'>"; |
| 907 | - $return .= " <input class='radio' id='{$class}' type='radio' rel='{$code}' name='settings[icon]' value='{$class}' " . checked( $this->menu_item_meta['icon'], $class, false ) . ' />'; |
|
| 907 | + $return .= " <input class='radio' id='{$class}' type='radio' rel='{$code}' name='settings[icon]' value='{$class}' " . checked($this->menu_item_meta['icon'], $class, false) . ' />'; |
|
| 908 | 908 | $return .= " <label rel='{$code}' for='{$class}' title='{$class}'></label>"; |
| 909 | 909 | $return .= '</div>'; |
| 910 | 910 | |
@@ -1264,9 +1264,9 @@ discard block |
||
| 1264 | 1264 | 'dash-f197' => 'dashicons-superhero-alt', |
| 1265 | 1265 | ); |
| 1266 | 1266 | |
| 1267 | - $icons = apply_filters( 'megamenu_dashicons', $icons ); |
|
| 1267 | + $icons = apply_filters('megamenu_dashicons', $icons); |
|
| 1268 | 1268 | |
| 1269 | - ksort( $icons ); |
|
| 1269 | + ksort($icons); |
|
| 1270 | 1270 | |
| 1271 | 1271 | return $icons; |
| 1272 | 1272 | } |
@@ -1,123 +1,123 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | - exit; // disable direct access |
|
| 4 | + exit; // disable direct access |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | if ( ! class_exists( 'Mega_Menu_Widget_Manager' ) ) : |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * Processes AJAX requests from the Mega Menu panel editor. |
|
| 11 | - * Also registers our widget sidebar. |
|
| 12 | - * |
|
| 13 | - * There is very little in WordPress core to help with listing, editing, saving, |
|
| 14 | - * deleting widgets etc so this class implements that functionality. |
|
| 15 | - */ |
|
| 16 | - class Mega_Menu_Widget_Manager { |
|
| 9 | + /** |
|
| 10 | + * Processes AJAX requests from the Mega Menu panel editor. |
|
| 11 | + * Also registers our widget sidebar. |
|
| 12 | + * |
|
| 13 | + * There is very little in WordPress core to help with listing, editing, saving, |
|
| 14 | + * deleting widgets etc so this class implements that functionality. |
|
| 15 | + */ |
|
| 16 | + class Mega_Menu_Widget_Manager { |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Constructor |
|
| 20 | - * |
|
| 21 | - * @since 1.0 |
|
| 22 | - */ |
|
| 23 | - public function __construct() { |
|
| 18 | + /** |
|
| 19 | + * Constructor |
|
| 20 | + * |
|
| 21 | + * @since 1.0 |
|
| 22 | + */ |
|
| 23 | + public function __construct() { |
|
| 24 | 24 | |
| 25 | - add_action( 'wp_ajax_mm_edit_widget', array( $this, 'ajax_show_widget_form' ) ); |
|
| 26 | - add_action( 'wp_ajax_mm_edit_menu_item', array( $this, 'ajax_show_menu_item_form' ) ); |
|
| 27 | - add_action( 'wp_ajax_mm_save_widget', array( $this, 'ajax_save_widget' ) ); |
|
| 28 | - add_action( 'wp_ajax_mm_save_menu_item', array( $this, 'ajax_save_menu_item' ) ); |
|
| 29 | - add_action( 'wp_ajax_mm_update_widget_columns', array( $this, 'ajax_update_widget_columns' ) ); |
|
| 30 | - add_action( 'wp_ajax_mm_update_menu_item_columns', array( $this, 'ajax_update_menu_item_columns' ) ); |
|
| 31 | - add_action( 'wp_ajax_mm_delete_widget', array( $this, 'ajax_delete_widget' ) ); |
|
| 32 | - add_action( 'wp_ajax_mm_add_widget', array( $this, 'ajax_add_widget' ) ); |
|
| 33 | - add_action( 'wp_ajax_mm_reorder_items', array( $this, 'ajax_reorder_items' ) ); |
|
| 34 | - add_action( 'wp_ajax_mm_save_grid_data', array( $this, 'ajax_save_grid_data' ) ); |
|
| 25 | + add_action( 'wp_ajax_mm_edit_widget', array( $this, 'ajax_show_widget_form' ) ); |
|
| 26 | + add_action( 'wp_ajax_mm_edit_menu_item', array( $this, 'ajax_show_menu_item_form' ) ); |
|
| 27 | + add_action( 'wp_ajax_mm_save_widget', array( $this, 'ajax_save_widget' ) ); |
|
| 28 | + add_action( 'wp_ajax_mm_save_menu_item', array( $this, 'ajax_save_menu_item' ) ); |
|
| 29 | + add_action( 'wp_ajax_mm_update_widget_columns', array( $this, 'ajax_update_widget_columns' ) ); |
|
| 30 | + add_action( 'wp_ajax_mm_update_menu_item_columns', array( $this, 'ajax_update_menu_item_columns' ) ); |
|
| 31 | + add_action( 'wp_ajax_mm_delete_widget', array( $this, 'ajax_delete_widget' ) ); |
|
| 32 | + add_action( 'wp_ajax_mm_add_widget', array( $this, 'ajax_add_widget' ) ); |
|
| 33 | + add_action( 'wp_ajax_mm_reorder_items', array( $this, 'ajax_reorder_items' ) ); |
|
| 34 | + add_action( 'wp_ajax_mm_save_grid_data', array( $this, 'ajax_save_grid_data' ) ); |
|
| 35 | 35 | |
| 36 | - add_filter( 'widget_update_callback', array( $this, 'persist_mega_menu_widget_settings' ), 10, 4 ); |
|
| 36 | + add_filter( 'widget_update_callback', array( $this, 'persist_mega_menu_widget_settings' ), 10, 4 ); |
|
| 37 | 37 | |
| 38 | - add_action( 'megamenu_after_widget_add', array( $this, 'clear_caches' ) ); |
|
| 39 | - add_action( 'megamenu_after_widget_save', array( $this, 'clear_caches' ) ); |
|
| 40 | - add_action( 'megamenu_after_widget_delete', array( $this, 'clear_caches' ) ); |
|
| 38 | + add_action( 'megamenu_after_widget_add', array( $this, 'clear_caches' ) ); |
|
| 39 | + add_action( 'megamenu_after_widget_save', array( $this, 'clear_caches' ) ); |
|
| 40 | + add_action( 'megamenu_after_widget_delete', array( $this, 'clear_caches' ) ); |
|
| 41 | 41 | |
| 42 | - } |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Depending on how a widget has been written, it may not necessarily base the new widget settings on |
|
| 47 | - * a copy the old settings. If this is the case, the mega menu data will be lost. This function |
|
| 48 | - * checks to make sure widgets persist the mega menu data when they're saved. |
|
| 49 | - * |
|
| 50 | - * @since 1.0 |
|
| 51 | - */ |
|
| 52 | - public function persist_mega_menu_widget_settings( $instance, $new_instance, $old_instance, $that ) { |
|
| 45 | + /** |
|
| 46 | + * Depending on how a widget has been written, it may not necessarily base the new widget settings on |
|
| 47 | + * a copy the old settings. If this is the case, the mega menu data will be lost. This function |
|
| 48 | + * checks to make sure widgets persist the mega menu data when they're saved. |
|
| 49 | + * |
|
| 50 | + * @since 1.0 |
|
| 51 | + */ |
|
| 52 | + public function persist_mega_menu_widget_settings( $instance, $new_instance, $old_instance, $that ) { |
|
| 53 | 53 | |
| 54 | - if ( isset( $old_instance['mega_menu_columns'] ) && ! isset( $new_instance['mega_menu_columns'] ) ) { |
|
| 55 | - $instance['mega_menu_columns'] = $old_instance['mega_menu_columns']; |
|
| 56 | - } |
|
| 54 | + if ( isset( $old_instance['mega_menu_columns'] ) && ! isset( $new_instance['mega_menu_columns'] ) ) { |
|
| 55 | + $instance['mega_menu_columns'] = $old_instance['mega_menu_columns']; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - if ( isset( $old_instance['mega_menu_order'] ) && ! isset( $new_instance['mega_menu_order'] ) ) { |
|
| 59 | - $instance['mega_menu_order'] = $old_instance['mega_menu_order']; |
|
| 60 | - } |
|
| 58 | + if ( isset( $old_instance['mega_menu_order'] ) && ! isset( $new_instance['mega_menu_order'] ) ) { |
|
| 59 | + $instance['mega_menu_order'] = $old_instance['mega_menu_order']; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - if ( isset( $old_instance['mega_menu_parent_menu_id'] ) && ! isset( $new_instance['mega_menu_parent_menu_id'] ) ) { |
|
| 63 | - $instance['mega_menu_parent_menu_id'] = $old_instance['mega_menu_parent_menu_id']; |
|
| 64 | - } |
|
| 62 | + if ( isset( $old_instance['mega_menu_parent_menu_id'] ) && ! isset( $new_instance['mega_menu_parent_menu_id'] ) ) { |
|
| 63 | + $instance['mega_menu_parent_menu_id'] = $old_instance['mega_menu_parent_menu_id']; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - return $instance; |
|
| 67 | - } |
|
| 66 | + return $instance; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Display a widget settings form |
|
| 72 | - * |
|
| 73 | - * @since 1.0 |
|
| 74 | - */ |
|
| 75 | - public function ajax_show_widget_form() { |
|
| 70 | + /** |
|
| 71 | + * Display a widget settings form |
|
| 72 | + * |
|
| 73 | + * @since 1.0 |
|
| 74 | + */ |
|
| 75 | + public function ajax_show_widget_form() { |
|
| 76 | 76 | |
| 77 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 77 | + check_ajax_referer( 'megamenu_edit' ); |
|
| 78 | 78 | |
| 79 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 79 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 80 | 80 | |
| 81 | - if ( ! current_user_can( $capability ) ) { |
|
| 82 | - return; |
|
| 83 | - } |
|
| 81 | + if ( ! current_user_can( $capability ) ) { |
|
| 82 | + return; |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - $widget_id = sanitize_text_field( $_POST['widget_id'] ); |
|
| 85 | + $widget_id = sanitize_text_field( $_POST['widget_id'] ); |
|
| 86 | 86 | |
| 87 | - if ( ob_get_contents() ) { |
|
| 88 | - ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
|
| 89 | - } |
|
| 87 | + if ( ob_get_contents() ) { |
|
| 88 | + ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - wp_die( trim( $this->show_widget_form( $widget_id ) ) ); |
|
| 91 | + wp_die( trim( $this->show_widget_form( $widget_id ) ) ); |
|
| 92 | 92 | |
| 93 | - } |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * Display a menu item settings form |
|
| 97 | - * |
|
| 98 | - * @since 2.7 |
|
| 99 | - */ |
|
| 100 | - public function ajax_show_menu_item_form() { |
|
| 95 | + /** |
|
| 96 | + * Display a menu item settings form |
|
| 97 | + * |
|
| 98 | + * @since 2.7 |
|
| 99 | + */ |
|
| 100 | + public function ajax_show_menu_item_form() { |
|
| 101 | 101 | |
| 102 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 102 | + check_ajax_referer( 'megamenu_edit' ); |
|
| 103 | 103 | |
| 104 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 104 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 105 | 105 | |
| 106 | - if ( ! current_user_can( $capability ) ) { |
|
| 107 | - return; |
|
| 108 | - } |
|
| 106 | + if ( ! current_user_can( $capability ) ) { |
|
| 107 | + return; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - $menu_item_id = sanitize_text_field( $_POST['widget_id'] ); |
|
| 110 | + $menu_item_id = sanitize_text_field( $_POST['widget_id'] ); |
|
| 111 | 111 | |
| 112 | - $nonce = wp_create_nonce( 'megamenu_save_menu_item_' . $menu_item_id ); |
|
| 112 | + $nonce = wp_create_nonce( 'megamenu_save_menu_item_' . $menu_item_id ); |
|
| 113 | 113 | |
| 114 | - $saved_settings = array_filter( (array) get_post_meta( $menu_item_id, '_megamenu', true ) ); |
|
| 115 | - $menu_item_meta = array_merge( Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings ); |
|
| 114 | + $saved_settings = array_filter( (array) get_post_meta( $menu_item_id, '_megamenu', true ) ); |
|
| 115 | + $menu_item_meta = array_merge( Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings ); |
|
| 116 | 116 | |
| 117 | - if ( ob_get_contents() ) { |
|
| 118 | - ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
|
| 119 | - } |
|
| 120 | - ?> |
|
| 117 | + if ( ob_get_contents() ) { |
|
| 118 | + ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
|
| 119 | + } |
|
| 120 | + ?> |
|
| 121 | 121 | |
| 122 | 122 | <form method='post'> |
| 123 | 123 | <input type='hidden' name='action' value='mm_save_menu_item' /> |
@@ -126,19 +126,19 @@ discard block |
||
| 126 | 126 | <div class='widget-content'> |
| 127 | 127 | <?php |
| 128 | 128 | |
| 129 | - $css_version = get_transient( 'megamenu_css_version' ); |
|
| 129 | + $css_version = get_transient( 'megamenu_css_version' ); |
|
| 130 | 130 | |
| 131 | - if ( $css_version && version_compare( $css_version, '2.6.1', '<' ) ) { |
|
| 132 | - $link = "<a href='" . esc_attr( admin_url( 'admin.php?page=maxmegamenu_tools' ) ) . "'>" . __( 'Mega Menu' ) . ' > ' . __( 'Tools' ) . '</a>'; |
|
| 133 | - $notice = "<div class='notice notice-success'><p>"; |
|
| 134 | - $notice .= sprintf( __( 'Your menu CSS needs to be updated before you can use the following setting. Please go to %s and Clear the CSS Cache (you will only need to do this once).', 'megamenu' ), $link ); |
|
| 135 | - $notice .= '</p></div>'; |
|
| 136 | - $notice .= '</div>'; |
|
| 131 | + if ( $css_version && version_compare( $css_version, '2.6.1', '<' ) ) { |
|
| 132 | + $link = "<a href='" . esc_attr( admin_url( 'admin.php?page=maxmegamenu_tools' ) ) . "'>" . __( 'Mega Menu' ) . ' > ' . __( 'Tools' ) . '</a>'; |
|
| 133 | + $notice = "<div class='notice notice-success'><p>"; |
|
| 134 | + $notice .= sprintf( __( 'Your menu CSS needs to be updated before you can use the following setting. Please go to %s and Clear the CSS Cache (you will only need to do this once).', 'megamenu' ), $link ); |
|
| 135 | + $notice .= '</p></div>'; |
|
| 136 | + $notice .= '</div>'; |
|
| 137 | 137 | |
| 138 | - echo $notice; |
|
| 139 | - } |
|
| 138 | + echo $notice; |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - ?> |
|
| 141 | + ?> |
|
| 142 | 142 | |
| 143 | 143 | <p> |
| 144 | 144 | <label><?php _e( 'Sub menu columns', 'megamenu' ); ?></label> |
@@ -158,778 +158,778 @@ discard block |
||
| 158 | 158 | </div> |
| 159 | 159 | |
| 160 | 160 | <?php |
| 161 | - submit_button( __( 'Save' ), 'button-primary alignright', 'savewidget', false ); |
|
| 162 | - ?> |
|
| 161 | + submit_button( __( 'Save' ), 'button-primary alignright', 'savewidget', false ); |
|
| 162 | + ?> |
|
| 163 | 163 | </p> |
| 164 | 164 | </div> |
| 165 | 165 | </form> |
| 166 | 166 | |
| 167 | 167 | <?php |
| 168 | 168 | |
| 169 | - } |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - /** |
|
| 172 | - * Save a menu item |
|
| 173 | - * |
|
| 174 | - * @since 2.7 |
|
| 175 | - */ |
|
| 176 | - public function ajax_save_menu_item() { |
|
| 171 | + /** |
|
| 172 | + * Save a menu item |
|
| 173 | + * |
|
| 174 | + * @since 2.7 |
|
| 175 | + */ |
|
| 176 | + public function ajax_save_menu_item() { |
|
| 177 | 177 | |
| 178 | - $menu_item_id = absint( sanitize_text_field( $_POST['menu_item_id'] ) ); |
|
| 178 | + $menu_item_id = absint( sanitize_text_field( $_POST['menu_item_id'] ) ); |
|
| 179 | 179 | |
| 180 | - check_ajax_referer( 'megamenu_save_menu_item_' . $menu_item_id ); |
|
| 180 | + check_ajax_referer( 'megamenu_save_menu_item_' . $menu_item_id ); |
|
| 181 | 181 | |
| 182 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 182 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 183 | 183 | |
| 184 | - if ( ! current_user_can( $capability ) ) { |
|
| 185 | - return; |
|
| 186 | - } |
|
| 184 | + if ( ! current_user_can( $capability ) ) { |
|
| 185 | + return; |
|
| 186 | + } |
|
| 187 | 187 | |
| 188 | - $submitted_settings = isset( $_POST['settings'] ) ? $_POST['settings'] : array(); |
|
| 188 | + $submitted_settings = isset( $_POST['settings'] ) ? $_POST['settings'] : array(); |
|
| 189 | 189 | |
| 190 | - if ( $menu_item_id > 0 && is_array( $submitted_settings ) ) { |
|
| 190 | + if ( $menu_item_id > 0 && is_array( $submitted_settings ) ) { |
|
| 191 | 191 | |
| 192 | - $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true ); |
|
| 192 | + $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true ); |
|
| 193 | 193 | |
| 194 | - if ( is_array( $existing_settings ) ) { |
|
| 195 | - $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 196 | - } |
|
| 194 | + if ( is_array( $existing_settings ) ) { |
|
| 195 | + $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | - update_post_meta( $menu_item_id, '_megamenu', $submitted_settings ); |
|
| 199 | - } |
|
| 198 | + update_post_meta( $menu_item_id, '_megamenu', $submitted_settings ); |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | - $this->send_json_success( sprintf( __( 'Saved %s', 'megamenu' ), $id_base ) ); |
|
| 201 | + $this->send_json_success( sprintf( __( 'Saved %s', 'megamenu' ), $id_base ) ); |
|
| 202 | 202 | |
| 203 | - } |
|
| 203 | + } |
|
| 204 | 204 | |
| 205 | 205 | |
| 206 | - /** |
|
| 207 | - * Save a widget |
|
| 208 | - * |
|
| 209 | - * @since 1.0 |
|
| 210 | - */ |
|
| 211 | - public function ajax_save_widget() { |
|
| 206 | + /** |
|
| 207 | + * Save a widget |
|
| 208 | + * |
|
| 209 | + * @since 1.0 |
|
| 210 | + */ |
|
| 211 | + public function ajax_save_widget() { |
|
| 212 | 212 | |
| 213 | - $widget_id = sanitize_text_field( $_POST['widget_id'] ); |
|
| 214 | - $id_base = sanitize_text_field( $_POST['id_base'] ); |
|
| 213 | + $widget_id = sanitize_text_field( $_POST['widget_id'] ); |
|
| 214 | + $id_base = sanitize_text_field( $_POST['id_base'] ); |
|
| 215 | 215 | |
| 216 | - check_ajax_referer( 'megamenu_save_widget_' . $widget_id ); |
|
| 216 | + check_ajax_referer( 'megamenu_save_widget_' . $widget_id ); |
|
| 217 | 217 | |
| 218 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 218 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 219 | 219 | |
| 220 | - if ( ! current_user_can( $capability ) ) { |
|
| 221 | - return; |
|
| 222 | - } |
|
| 220 | + if ( ! current_user_can( $capability ) ) { |
|
| 221 | + return; |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | - $saved = $this->save_widget( $id_base ); |
|
| 224 | + $saved = $this->save_widget( $id_base ); |
|
| 225 | 225 | |
| 226 | - if ( $saved ) { |
|
| 227 | - $this->send_json_success( sprintf( __( 'Saved %s', 'megamenu' ), $id_base ) ); |
|
| 228 | - } else { |
|
| 229 | - $this->send_json_error( sprintf( __( 'Failed to save %s', 'megamenu' ), $id_base ) ); |
|
| 230 | - } |
|
| 226 | + if ( $saved ) { |
|
| 227 | + $this->send_json_success( sprintf( __( 'Saved %s', 'megamenu' ), $id_base ) ); |
|
| 228 | + } else { |
|
| 229 | + $this->send_json_error( sprintf( __( 'Failed to save %s', 'megamenu' ), $id_base ) ); |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | - } |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | 234 | |
| 235 | - /** |
|
| 236 | - * Update the number of mega columns for a widget |
|
| 237 | - * |
|
| 238 | - * @since 1.0 |
|
| 239 | - */ |
|
| 240 | - public function ajax_update_widget_columns() { |
|
| 235 | + /** |
|
| 236 | + * Update the number of mega columns for a widget |
|
| 237 | + * |
|
| 238 | + * @since 1.0 |
|
| 239 | + */ |
|
| 240 | + public function ajax_update_widget_columns() { |
|
| 241 | 241 | |
| 242 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 242 | + check_ajax_referer( 'megamenu_edit' ); |
|
| 243 | 243 | |
| 244 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 244 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 245 | 245 | |
| 246 | - if ( ! current_user_can( $capability ) ) { |
|
| 247 | - return; |
|
| 248 | - } |
|
| 246 | + if ( ! current_user_can( $capability ) ) { |
|
| 247 | + return; |
|
| 248 | + } |
|
| 249 | 249 | |
| 250 | - $widget_id = sanitize_text_field( $_POST['id'] ); |
|
| 251 | - $columns = absint( $_POST['columns'] ); |
|
| 250 | + $widget_id = sanitize_text_field( $_POST['id'] ); |
|
| 251 | + $columns = absint( $_POST['columns'] ); |
|
| 252 | 252 | |
| 253 | - $updated = $this->update_widget_columns( $widget_id, $columns ); |
|
| 253 | + $updated = $this->update_widget_columns( $widget_id, $columns ); |
|
| 254 | 254 | |
| 255 | - if ( $updated ) { |
|
| 256 | - $this->send_json_success( sprintf( __( 'Updated %1$s (new columns: %2$d)', 'megamenu' ), $widget_id, $columns ) ); |
|
| 257 | - } else { |
|
| 258 | - $this->send_json_error( sprintf( __( 'Failed to update %s', 'megamenu' ), $widget_id ) ); |
|
| 259 | - } |
|
| 255 | + if ( $updated ) { |
|
| 256 | + $this->send_json_success( sprintf( __( 'Updated %1$s (new columns: %2$d)', 'megamenu' ), $widget_id, $columns ) ); |
|
| 257 | + } else { |
|
| 258 | + $this->send_json_error( sprintf( __( 'Failed to update %s', 'megamenu' ), $widget_id ) ); |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | - } |
|
| 261 | + } |
|
| 262 | 262 | |
| 263 | 263 | |
| 264 | - /** |
|
| 265 | - * Update the number of mega columns for a widget |
|
| 266 | - * |
|
| 267 | - * @since 1.0 |
|
| 268 | - */ |
|
| 269 | - public function ajax_update_menu_item_columns() { |
|
| 264 | + /** |
|
| 265 | + * Update the number of mega columns for a widget |
|
| 266 | + * |
|
| 267 | + * @since 1.0 |
|
| 268 | + */ |
|
| 269 | + public function ajax_update_menu_item_columns() { |
|
| 270 | 270 | |
| 271 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 271 | + check_ajax_referer( 'megamenu_edit' ); |
|
| 272 | 272 | |
| 273 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 273 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 274 | 274 | |
| 275 | - if ( ! current_user_can( $capability ) ) { |
|
| 276 | - return; |
|
| 277 | - } |
|
| 275 | + if ( ! current_user_can( $capability ) ) { |
|
| 276 | + return; |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | - $id = absint( $_POST['id'] ); |
|
| 280 | - $columns = absint( $_POST['columns'] ); |
|
| 279 | + $id = absint( $_POST['id'] ); |
|
| 280 | + $columns = absint( $_POST['columns'] ); |
|
| 281 | 281 | |
| 282 | - $updated = $this->update_menu_item_columns( $id, $columns ); |
|
| 282 | + $updated = $this->update_menu_item_columns( $id, $columns ); |
|
| 283 | 283 | |
| 284 | - if ( $updated ) { |
|
| 285 | - $this->send_json_success( sprintf( __( 'Updated %1$s (new columns: %2$d)', 'megamenu' ), $id, $columns ) ); |
|
| 286 | - } else { |
|
| 287 | - $this->send_json_error( sprintf( __( 'Failed to update %s', 'megamenu' ), $id ) ); |
|
| 288 | - } |
|
| 284 | + if ( $updated ) { |
|
| 285 | + $this->send_json_success( sprintf( __( 'Updated %1$s (new columns: %2$d)', 'megamenu' ), $id, $columns ) ); |
|
| 286 | + } else { |
|
| 287 | + $this->send_json_error( sprintf( __( 'Failed to update %s', 'megamenu' ), $id ) ); |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | - } |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | 292 | |
| 293 | - /** |
|
| 294 | - * Add a widget to the panel |
|
| 295 | - * |
|
| 296 | - * @since 1.0 |
|
| 297 | - */ |
|
| 298 | - public function ajax_add_widget() { |
|
| 293 | + /** |
|
| 294 | + * Add a widget to the panel |
|
| 295 | + * |
|
| 296 | + * @since 1.0 |
|
| 297 | + */ |
|
| 298 | + public function ajax_add_widget() { |
|
| 299 | 299 | |
| 300 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 300 | + check_ajax_referer( 'megamenu_edit' ); |
|
| 301 | 301 | |
| 302 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 302 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 303 | 303 | |
| 304 | - if ( ! current_user_can( $capability ) ) { |
|
| 305 | - return; |
|
| 306 | - } |
|
| 304 | + if ( ! current_user_can( $capability ) ) { |
|
| 305 | + return; |
|
| 306 | + } |
|
| 307 | 307 | |
| 308 | - $id_base = sanitize_text_field( $_POST['id_base'] ); |
|
| 309 | - $menu_item_id = absint( $_POST['menu_item_id'] ); |
|
| 310 | - $title = sanitize_text_field( $_POST['title'] ); |
|
| 311 | - $is_grid_widget = isset( $_POST['is_grid_widget'] ) && $_POST['is_grid_widget'] == 'true'; |
|
| 308 | + $id_base = sanitize_text_field( $_POST['id_base'] ); |
|
| 309 | + $menu_item_id = absint( $_POST['menu_item_id'] ); |
|
| 310 | + $title = sanitize_text_field( $_POST['title'] ); |
|
| 311 | + $is_grid_widget = isset( $_POST['is_grid_widget'] ) && $_POST['is_grid_widget'] == 'true'; |
|
| 312 | 312 | |
| 313 | - $added = $this->add_widget( $id_base, $menu_item_id, $title, $is_grid_widget ); |
|
| 313 | + $added = $this->add_widget( $id_base, $menu_item_id, $title, $is_grid_widget ); |
|
| 314 | 314 | |
| 315 | - if ( $added ) { |
|
| 316 | - $this->send_json_success( $added ); |
|
| 317 | - } else { |
|
| 318 | - $this->send_json_error( sprintf( __( 'Failed to add %1$s to %2$d', 'megamenu' ), $id_base, $menu_item_id ) ); |
|
| 319 | - } |
|
| 315 | + if ( $added ) { |
|
| 316 | + $this->send_json_success( $added ); |
|
| 317 | + } else { |
|
| 318 | + $this->send_json_error( sprintf( __( 'Failed to add %1$s to %2$d', 'megamenu' ), $id_base, $menu_item_id ) ); |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - } |
|
| 321 | + } |
|
| 322 | 322 | |
| 323 | 323 | |
| 324 | - /** |
|
| 325 | - * Deletes a widget |
|
| 326 | - * |
|
| 327 | - * @since 1.0 |
|
| 328 | - */ |
|
| 329 | - public function ajax_delete_widget() { |
|
| 324 | + /** |
|
| 325 | + * Deletes a widget |
|
| 326 | + * |
|
| 327 | + * @since 1.0 |
|
| 328 | + */ |
|
| 329 | + public function ajax_delete_widget() { |
|
| 330 | 330 | |
| 331 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 331 | + check_ajax_referer( 'megamenu_edit' ); |
|
| 332 | 332 | |
| 333 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 333 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 334 | 334 | |
| 335 | - if ( ! current_user_can( $capability ) ) { |
|
| 336 | - return; |
|
| 337 | - } |
|
| 335 | + if ( ! current_user_can( $capability ) ) { |
|
| 336 | + return; |
|
| 337 | + } |
|
| 338 | 338 | |
| 339 | - $widget_id = sanitize_text_field( $_POST['widget_id'] ); |
|
| 339 | + $widget_id = sanitize_text_field( $_POST['widget_id'] ); |
|
| 340 | 340 | |
| 341 | - $deleted = $this->delete_widget( $widget_id ); |
|
| 341 | + $deleted = $this->delete_widget( $widget_id ); |
|
| 342 | 342 | |
| 343 | - if ( $deleted ) { |
|
| 344 | - $this->send_json_success( sprintf( __( 'Deleted %s', 'megamenu' ), $widget_id ) ); |
|
| 345 | - } else { |
|
| 346 | - $this->send_json_error( sprintf( __( 'Failed to delete %s', 'megamenu' ), $widget_id ) ); |
|
| 347 | - } |
|
| 343 | + if ( $deleted ) { |
|
| 344 | + $this->send_json_success( sprintf( __( 'Deleted %s', 'megamenu' ), $widget_id ) ); |
|
| 345 | + } else { |
|
| 346 | + $this->send_json_error( sprintf( __( 'Failed to delete %s', 'megamenu' ), $widget_id ) ); |
|
| 347 | + } |
|
| 348 | 348 | |
| 349 | - } |
|
| 349 | + } |
|
| 350 | 350 | |
| 351 | 351 | |
| 352 | - /** |
|
| 353 | - * Moves a widget to a new position |
|
| 354 | - * |
|
| 355 | - * @since 1.0 |
|
| 356 | - */ |
|
| 357 | - public function ajax_reorder_items() { |
|
| 352 | + /** |
|
| 353 | + * Moves a widget to a new position |
|
| 354 | + * |
|
| 355 | + * @since 1.0 |
|
| 356 | + */ |
|
| 357 | + public function ajax_reorder_items() { |
|
| 358 | 358 | |
| 359 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 359 | + check_ajax_referer( 'megamenu_edit' ); |
|
| 360 | 360 | |
| 361 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 361 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 362 | 362 | |
| 363 | - if ( ! current_user_can( $capability ) ) { |
|
| 364 | - return; |
|
| 365 | - } |
|
| 363 | + if ( ! current_user_can( $capability ) ) { |
|
| 364 | + return; |
|
| 365 | + } |
|
| 366 | 366 | |
| 367 | - $items = isset( $_POST['items'] ) ? $_POST['items'] : false; |
|
| 367 | + $items = isset( $_POST['items'] ) ? $_POST['items'] : false; |
|
| 368 | 368 | |
| 369 | - $saved = false; |
|
| 369 | + $saved = false; |
|
| 370 | 370 | |
| 371 | - if ( $items ) { |
|
| 372 | - $moved = $this->reorder_items( $items ); |
|
| 373 | - } |
|
| 371 | + if ( $items ) { |
|
| 372 | + $moved = $this->reorder_items( $items ); |
|
| 373 | + } |
|
| 374 | 374 | |
| 375 | - if ( $moved ) { |
|
| 376 | - $this->send_json_success( sprintf( __( 'Moved (%s)', 'megamenu' ), json_encode( $items ) ) ); |
|
| 377 | - } else { |
|
| 378 | - $this->send_json_error( sprintf( __( "Didn't move items", 'megamenu' ), json_encode( $items ) ) ); |
|
| 379 | - } |
|
| 375 | + if ( $moved ) { |
|
| 376 | + $this->send_json_success( sprintf( __( 'Moved (%s)', 'megamenu' ), json_encode( $items ) ) ); |
|
| 377 | + } else { |
|
| 378 | + $this->send_json_error( sprintf( __( "Didn't move items", 'megamenu' ), json_encode( $items ) ) ); |
|
| 379 | + } |
|
| 380 | 380 | |
| 381 | - } |
|
| 381 | + } |
|
| 382 | 382 | |
| 383 | - /** |
|
| 384 | - * Moves a widget to a new position |
|
| 385 | - * |
|
| 386 | - * @since 2.4 |
|
| 387 | - */ |
|
| 388 | - public function ajax_save_grid_data() { |
|
| 383 | + /** |
|
| 384 | + * Moves a widget to a new position |
|
| 385 | + * |
|
| 386 | + * @since 2.4 |
|
| 387 | + */ |
|
| 388 | + public function ajax_save_grid_data() { |
|
| 389 | 389 | |
| 390 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 390 | + check_ajax_referer( 'megamenu_edit' ); |
|
| 391 | 391 | |
| 392 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 392 | + $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 393 | 393 | |
| 394 | - if ( ! current_user_can( $capability ) ) { |
|
| 395 | - return; |
|
| 396 | - } |
|
| 394 | + if ( ! current_user_can( $capability ) ) { |
|
| 395 | + return; |
|
| 396 | + } |
|
| 397 | 397 | |
| 398 | - $grid = isset( $_POST['grid'] ) ? $_POST['grid'] : false; |
|
| 399 | - $parent_menu_item_id = absint( $_POST['parent_menu_item'] ); |
|
| 398 | + $grid = isset( $_POST['grid'] ) ? $_POST['grid'] : false; |
|
| 399 | + $parent_menu_item_id = absint( $_POST['parent_menu_item'] ); |
|
| 400 | 400 | |
| 401 | - $saved = true; |
|
| 401 | + $saved = true; |
|
| 402 | 402 | |
| 403 | - $existing_settings = get_post_meta( $parent_menu_item_id, '_megamenu', true ); |
|
| 403 | + $existing_settings = get_post_meta( $parent_menu_item_id, '_megamenu', true ); |
|
| 404 | 404 | |
| 405 | - if ( is_array( $grid ) ) { |
|
| 405 | + if ( is_array( $grid ) ) { |
|
| 406 | 406 | |
| 407 | - $submitted_settings = array_merge( $existing_settings, array( 'grid' => $grid ) ); |
|
| 407 | + $submitted_settings = array_merge( $existing_settings, array( 'grid' => $grid ) ); |
|
| 408 | 408 | |
| 409 | - } |
|
| 409 | + } |
|
| 410 | 410 | |
| 411 | - update_post_meta( $parent_menu_item_id, '_megamenu', $submitted_settings ); |
|
| 411 | + update_post_meta( $parent_menu_item_id, '_megamenu', $submitted_settings ); |
|
| 412 | 412 | |
| 413 | - if ( $saved ) { |
|
| 414 | - $this->send_json_success( sprintf( __( 'Saved (%s)', 'megamenu' ), json_encode( $grid ) ) ); |
|
| 415 | - } else { |
|
| 416 | - $this->send_json_error( sprintf( __( "Didn't save", 'megamenu' ), json_encode( $grid ) ) ); |
|
| 417 | - } |
|
| 413 | + if ( $saved ) { |
|
| 414 | + $this->send_json_success( sprintf( __( 'Saved (%s)', 'megamenu' ), json_encode( $grid ) ) ); |
|
| 415 | + } else { |
|
| 416 | + $this->send_json_error( sprintf( __( "Didn't save", 'megamenu' ), json_encode( $grid ) ) ); |
|
| 417 | + } |
|
| 418 | 418 | |
| 419 | - } |
|
| 419 | + } |
|
| 420 | 420 | |
| 421 | 421 | |
| 422 | - /** |
|
| 423 | - * Returns an object representing all widgets registered in WordPress |
|
| 424 | - * |
|
| 425 | - * @since 1.0 |
|
| 426 | - */ |
|
| 427 | - public function get_available_widgets() { |
|
| 428 | - global $wp_widget_factory; |
|
| 422 | + /** |
|
| 423 | + * Returns an object representing all widgets registered in WordPress |
|
| 424 | + * |
|
| 425 | + * @since 1.0 |
|
| 426 | + */ |
|
| 427 | + public function get_available_widgets() { |
|
| 428 | + global $wp_widget_factory; |
|
| 429 | 429 | |
| 430 | - $widgets = array(); |
|
| 430 | + $widgets = array(); |
|
| 431 | 431 | |
| 432 | - foreach ( $wp_widget_factory->widgets as $widget ) { |
|
| 432 | + foreach ( $wp_widget_factory->widgets as $widget ) { |
|
| 433 | 433 | |
| 434 | - $disabled_widgets = array( 'maxmegamenu' ); |
|
| 434 | + $disabled_widgets = array( 'maxmegamenu' ); |
|
| 435 | 435 | |
| 436 | - $disabled_widgets = apply_filters( 'megamenu_incompatible_widgets', $disabled_widgets ); |
|
| 436 | + $disabled_widgets = apply_filters( 'megamenu_incompatible_widgets', $disabled_widgets ); |
|
| 437 | 437 | |
| 438 | - if ( ! in_array( $widget->id_base, $disabled_widgets ) ) { |
|
| 438 | + if ( ! in_array( $widget->id_base, $disabled_widgets ) ) { |
|
| 439 | 439 | |
| 440 | - $widgets[] = array( |
|
| 441 | - 'text' => $widget->name, |
|
| 442 | - 'value' => $widget->id_base, |
|
| 443 | - ); |
|
| 440 | + $widgets[] = array( |
|
| 441 | + 'text' => $widget->name, |
|
| 442 | + 'value' => $widget->id_base, |
|
| 443 | + ); |
|
| 444 | 444 | |
| 445 | - } |
|
| 446 | - } |
|
| 445 | + } |
|
| 446 | + } |
|
| 447 | 447 | |
| 448 | - uasort( $widgets, array( $this, 'sort_by_text' ) ); |
|
| 448 | + uasort( $widgets, array( $this, 'sort_by_text' ) ); |
|
| 449 | 449 | |
| 450 | - return $widgets; |
|
| 450 | + return $widgets; |
|
| 451 | 451 | |
| 452 | - } |
|
| 452 | + } |
|
| 453 | 453 | |
| 454 | 454 | |
| 455 | - /** |
|
| 456 | - * Sorts a 2d array by the 'text' key |
|
| 457 | - * |
|
| 458 | - * @since 1.2 |
|
| 459 | - * @param array $a |
|
| 460 | - * @param array $b |
|
| 461 | - */ |
|
| 462 | - function sort_by_text( $a, $b ) { |
|
| 463 | - return strcmp( $a['text'], $b['text'] ); |
|
| 464 | - } |
|
| 455 | + /** |
|
| 456 | + * Sorts a 2d array by the 'text' key |
|
| 457 | + * |
|
| 458 | + * @since 1.2 |
|
| 459 | + * @param array $a |
|
| 460 | + * @param array $b |
|
| 461 | + */ |
|
| 462 | + function sort_by_text( $a, $b ) { |
|
| 463 | + return strcmp( $a['text'], $b['text'] ); |
|
| 464 | + } |
|
| 465 | 465 | |
| 466 | 466 | |
| 467 | - /** |
|
| 468 | - * Sorts a 2d array by the 'order' key |
|
| 469 | - * |
|
| 470 | - * @since 2.0 |
|
| 471 | - * @param array $a |
|
| 472 | - * @param array $b |
|
| 473 | - */ |
|
| 474 | - function sort_by_order( $a, $b ) { |
|
| 475 | - if ( $a['order'] == $b['order'] ) { |
|
| 476 | - return 1; |
|
| 477 | - } |
|
| 467 | + /** |
|
| 468 | + * Sorts a 2d array by the 'order' key |
|
| 469 | + * |
|
| 470 | + * @since 2.0 |
|
| 471 | + * @param array $a |
|
| 472 | + * @param array $b |
|
| 473 | + */ |
|
| 474 | + function sort_by_order( $a, $b ) { |
|
| 475 | + if ( $a['order'] == $b['order'] ) { |
|
| 476 | + return 1; |
|
| 477 | + } |
|
| 478 | 478 | |
| 479 | - return ( $a['order'] < $b['order'] ) ? -1 : 1; |
|
| 480 | - } |
|
| 479 | + return ( $a['order'] < $b['order'] ) ? -1 : 1; |
|
| 480 | + } |
|
| 481 | 481 | |
| 482 | 482 | |
| 483 | - /** |
|
| 484 | - * Returns an array of immediate child menu items for the current item |
|
| 485 | - * |
|
| 486 | - * @since 1.5 |
|
| 487 | - * @return array |
|
| 488 | - */ |
|
| 489 | - private function get_second_level_menu_items( $parent_menu_item_id, $menu_id, $menu_items = false ) { |
|
| 483 | + /** |
|
| 484 | + * Returns an array of immediate child menu items for the current item |
|
| 485 | + * |
|
| 486 | + * @since 1.5 |
|
| 487 | + * @return array |
|
| 488 | + */ |
|
| 489 | + private function get_second_level_menu_items( $parent_menu_item_id, $menu_id, $menu_items = false ) { |
|
| 490 | 490 | |
| 491 | - $second_level_items = array(); |
|
| 491 | + $second_level_items = array(); |
|
| 492 | 492 | |
| 493 | - // check we're using a valid menu ID |
|
| 494 | - if ( ! is_nav_menu( $menu_id ) ) { |
|
| 495 | - return $second_level_items; |
|
| 496 | - } |
|
| 493 | + // check we're using a valid menu ID |
|
| 494 | + if ( ! is_nav_menu( $menu_id ) ) { |
|
| 495 | + return $second_level_items; |
|
| 496 | + } |
|
| 497 | 497 | |
| 498 | - if ( ! $menu_items ) { |
|
| 499 | - $menu_items = wp_get_nav_menu_items( $menu_id ); |
|
| 500 | - } |
|
| 498 | + if ( ! $menu_items ) { |
|
| 499 | + $menu_items = wp_get_nav_menu_items( $menu_id ); |
|
| 500 | + } |
|
| 501 | 501 | |
| 502 | - if ( count( $menu_items ) ) { |
|
| 502 | + if ( count( $menu_items ) ) { |
|
| 503 | 503 | |
| 504 | - foreach ( $menu_items as $item ) { |
|
| 504 | + foreach ( $menu_items as $item ) { |
|
| 505 | 505 | |
| 506 | - // find the child menu items |
|
| 507 | - if ( $item->menu_item_parent == $parent_menu_item_id ) { |
|
| 506 | + // find the child menu items |
|
| 507 | + if ( $item->menu_item_parent == $parent_menu_item_id ) { |
|
| 508 | 508 | |
| 509 | - $saved_settings = array_filter( (array) get_post_meta( $item->ID, '_megamenu', true ) ); |
|
| 509 | + $saved_settings = array_filter( (array) get_post_meta( $item->ID, '_megamenu', true ) ); |
|
| 510 | 510 | |
| 511 | - $settings = array_merge( Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings ); |
|
| 511 | + $settings = array_merge( Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings ); |
|
| 512 | 512 | |
| 513 | - $second_level_items[ $item->ID ] = array( |
|
| 514 | - 'id' => $item->ID, |
|
| 515 | - 'type' => 'menu_item', |
|
| 516 | - 'title' => $item->title, |
|
| 517 | - 'columns' => $settings['mega_menu_columns'], |
|
| 518 | - 'order' => isset( $settings['mega_menu_order'][ $parent_menu_item_id ] ) ? $settings['mega_menu_order'][ $parent_menu_item_id ] : 0, |
|
| 519 | - ); |
|
| 513 | + $second_level_items[ $item->ID ] = array( |
|
| 514 | + 'id' => $item->ID, |
|
| 515 | + 'type' => 'menu_item', |
|
| 516 | + 'title' => $item->title, |
|
| 517 | + 'columns' => $settings['mega_menu_columns'], |
|
| 518 | + 'order' => isset( $settings['mega_menu_order'][ $parent_menu_item_id ] ) ? $settings['mega_menu_order'][ $parent_menu_item_id ] : 0, |
|
| 519 | + ); |
|
| 520 | 520 | |
| 521 | - } |
|
| 522 | - } |
|
| 523 | - } |
|
| 521 | + } |
|
| 522 | + } |
|
| 523 | + } |
|
| 524 | 524 | |
| 525 | - return $second_level_items; |
|
| 526 | - } |
|
| 525 | + return $second_level_items; |
|
| 526 | + } |
|
| 527 | 527 | |
| 528 | - /** |
|
| 529 | - * Returns an array of all widgets belonging to a specified menu item ID. |
|
| 530 | - * |
|
| 531 | - * @since 1.0 |
|
| 532 | - * @param int $menu_item_id |
|
| 533 | - */ |
|
| 534 | - public function get_widgets_for_menu_id( $parent_menu_item_id, $menu_id ) { |
|
| 528 | + /** |
|
| 529 | + * Returns an array of all widgets belonging to a specified menu item ID. |
|
| 530 | + * |
|
| 531 | + * @since 1.0 |
|
| 532 | + * @param int $menu_item_id |
|
| 533 | + */ |
|
| 534 | + public function get_widgets_for_menu_id( $parent_menu_item_id, $menu_id ) { |
|
| 535 | 535 | |
| 536 | - $widgets = array(); |
|
| 536 | + $widgets = array(); |
|
| 537 | 537 | |
| 538 | - if ( $mega_menu_widgets = $this->get_mega_menu_sidebar_widgets() ) { |
|
| 538 | + if ( $mega_menu_widgets = $this->get_mega_menu_sidebar_widgets() ) { |
|
| 539 | 539 | |
| 540 | - foreach ( $mega_menu_widgets as $widget_id ) { |
|
| 540 | + foreach ( $mega_menu_widgets as $widget_id ) { |
|
| 541 | 541 | |
| 542 | - $settings = $this->get_settings_for_widget_id( $widget_id ); |
|
| 542 | + $settings = $this->get_settings_for_widget_id( $widget_id ); |
|
| 543 | 543 | |
| 544 | - if ( ! isset( $settings['mega_menu_is_grid_widget'] ) && isset( $settings['mega_menu_parent_menu_id'] ) && $settings['mega_menu_parent_menu_id'] == $parent_menu_item_id ) { |
|
| 544 | + if ( ! isset( $settings['mega_menu_is_grid_widget'] ) && isset( $settings['mega_menu_parent_menu_id'] ) && $settings['mega_menu_parent_menu_id'] == $parent_menu_item_id ) { |
|
| 545 | 545 | |
| 546 | - $name = $this->get_name_for_widget_id( $widget_id ); |
|
| 546 | + $name = $this->get_name_for_widget_id( $widget_id ); |
|
| 547 | 547 | |
| 548 | - $widgets[ $widget_id ] = array( |
|
| 549 | - 'id' => $widget_id, |
|
| 550 | - 'type' => 'widget', |
|
| 551 | - 'title' => $name, |
|
| 552 | - 'columns' => $settings['mega_menu_columns'], |
|
| 553 | - 'order' => isset( $settings['mega_menu_order'][ $parent_menu_item_id ] ) ? $settings['mega_menu_order'][ $parent_menu_item_id ] : 0, |
|
| 554 | - ); |
|
| 548 | + $widgets[ $widget_id ] = array( |
|
| 549 | + 'id' => $widget_id, |
|
| 550 | + 'type' => 'widget', |
|
| 551 | + 'title' => $name, |
|
| 552 | + 'columns' => $settings['mega_menu_columns'], |
|
| 553 | + 'order' => isset( $settings['mega_menu_order'][ $parent_menu_item_id ] ) ? $settings['mega_menu_order'][ $parent_menu_item_id ] : 0, |
|
| 554 | + ); |
|
| 555 | 555 | |
| 556 | - } |
|
| 557 | - } |
|
| 558 | - } |
|
| 556 | + } |
|
| 557 | + } |
|
| 558 | + } |
|
| 559 | 559 | |
| 560 | - return $widgets; |
|
| 560 | + return $widgets; |
|
| 561 | 561 | |
| 562 | - } |
|
| 562 | + } |
|
| 563 | 563 | |
| 564 | 564 | |
| 565 | - /** |
|
| 566 | - * Returns an array of widgets and second level menu items for a specified parent menu item. |
|
| 567 | - * Used to display the widgets/menu items in the mega menu builder. |
|
| 568 | - * |
|
| 569 | - * @since 2.0 |
|
| 570 | - * @param int $parent_menu_item_id |
|
| 571 | - * @param int $menu_id |
|
| 572 | - * @return array |
|
| 573 | - */ |
|
| 574 | - public function get_widgets_and_menu_items_for_menu_id( $parent_menu_item_id, $menu_id ) { |
|
| 565 | + /** |
|
| 566 | + * Returns an array of widgets and second level menu items for a specified parent menu item. |
|
| 567 | + * Used to display the widgets/menu items in the mega menu builder. |
|
| 568 | + * |
|
| 569 | + * @since 2.0 |
|
| 570 | + * @param int $parent_menu_item_id |
|
| 571 | + * @param int $menu_id |
|
| 572 | + * @return array |
|
| 573 | + */ |
|
| 574 | + public function get_widgets_and_menu_items_for_menu_id( $parent_menu_item_id, $menu_id ) { |
|
| 575 | 575 | |
| 576 | - $menu_items = $this->get_second_level_menu_items( $parent_menu_item_id, $menu_id ); |
|
| 576 | + $menu_items = $this->get_second_level_menu_items( $parent_menu_item_id, $menu_id ); |
|
| 577 | 577 | |
| 578 | - $widgets = $this->get_widgets_for_menu_id( $parent_menu_item_id, $menu_id ); |
|
| 578 | + $widgets = $this->get_widgets_for_menu_id( $parent_menu_item_id, $menu_id ); |
|
| 579 | 579 | |
| 580 | - $items = array_merge( $menu_items, $widgets ); |
|
| 580 | + $items = array_merge( $menu_items, $widgets ); |
|
| 581 | 581 | |
| 582 | - $parent_settings = get_post_meta( $parent_menu_item_id, '_megamenu', true ); |
|
| 582 | + $parent_settings = get_post_meta( $parent_menu_item_id, '_megamenu', true ); |
|
| 583 | 583 | |
| 584 | - $ordering = isset( $parent_settings['submenu_ordering'] ) ? $parent_settings['submenu_ordering'] : 'natural'; |
|
| 584 | + $ordering = isset( $parent_settings['submenu_ordering'] ) ? $parent_settings['submenu_ordering'] : 'natural'; |
|
| 585 | 585 | |
| 586 | - if ( $ordering == 'forced' ) { |
|
| 586 | + if ( $ordering == 'forced' ) { |
|
| 587 | 587 | |
| 588 | - uasort( $items, array( $this, 'sort_by_order' ) ); |
|
| 588 | + uasort( $items, array( $this, 'sort_by_order' ) ); |
|
| 589 | 589 | |
| 590 | - $new_items = $items; |
|
| 591 | - $end_items = array(); |
|
| 590 | + $new_items = $items; |
|
| 591 | + $end_items = array(); |
|
| 592 | 592 | |
| 593 | - foreach ( $items as $key => $value ) { |
|
| 594 | - if ( $value['order'] == 0 ) { |
|
| 595 | - unset( $new_items[ $key ] ); |
|
| 596 | - $end_items[] = $value; |
|
| 597 | - } |
|
| 598 | - } |
|
| 593 | + foreach ( $items as $key => $value ) { |
|
| 594 | + if ( $value['order'] == 0 ) { |
|
| 595 | + unset( $new_items[ $key ] ); |
|
| 596 | + $end_items[] = $value; |
|
| 597 | + } |
|
| 598 | + } |
|
| 599 | 599 | |
| 600 | - $items = array_merge( $new_items, $end_items ); |
|
| 600 | + $items = array_merge( $new_items, $end_items ); |
|
| 601 | 601 | |
| 602 | - } |
|
| 602 | + } |
|
| 603 | 603 | |
| 604 | - return $items; |
|
| 605 | - } |
|
| 606 | - |
|
| 607 | - /** |
|
| 608 | - * Return a sorted array of grid data representing rows, columns and items within each column. |
|
| 609 | - * |
|
| 610 | - * @param int $parent_menu_item_id |
|
| 611 | - * @param int $menu_id |
|
| 612 | - * @since 2.4 |
|
| 613 | - * @return array |
|
| 614 | - */ |
|
| 615 | - public function get_grid_widgets_and_menu_items_for_menu_id( $parent_menu_item_id, $menu_id, $menu_items = false ) { |
|
| 616 | - |
|
| 617 | - $meta = get_post_meta( $parent_menu_item_id, '_megamenu', true ); |
|
| 618 | - |
|
| 619 | - $saved_grid = array(); |
|
| 620 | - |
|
| 621 | - if ( isset( $meta['grid'] ) ) { |
|
| 622 | - $saved_grid = $this->populate_saved_grid_data( $parent_menu_item_id, $menu_id, $meta['grid'], $menu_items ); |
|
| 623 | - } else { |
|
| 624 | - // return empty row |
|
| 625 | - $saved_grid[0]['columns'][0]['meta']['span'] = 3; |
|
| 626 | - $saved_grid = $this->populate_saved_grid_data( $parent_menu_item_id, $menu_id, $saved_grid, $menu_items ); |
|
| 627 | - |
|
| 628 | - } |
|
| 629 | - |
|
| 630 | - return $saved_grid; |
|
| 631 | - } |
|
| 632 | - |
|
| 633 | - |
|
| 634 | - /** |
|
| 635 | - * Ensure the widgets that are within the grid data still exist and have not been deleted (through the Widgets screen) |
|
| 636 | - * Ensure second level menu items saved within the grid data are still actually second level menu itms within the menu structure |
|
| 637 | - * |
|
| 638 | - * @param $saved_grid - array representing rows, columns and widgets/menu items within each column |
|
| 639 | - * @param $second_level_menu_items - array of second level menu items beneath the current menu item |
|
| 640 | - * @since 2.4 |
|
| 641 | - * @return array |
|
| 642 | - */ |
|
| 643 | - public function populate_saved_grid_data( $parent_menu_item_id, $menu_id, $saved_grid, $menu_items ) { |
|
| 644 | - |
|
| 645 | - $second_level_menu_items = $this->get_second_level_menu_items( $parent_menu_item_id, $menu_id, $menu_items ); |
|
| 646 | - |
|
| 647 | - $menu_items_included = array(); |
|
| 648 | - |
|
| 649 | - foreach ( $saved_grid as $row => $row_data ) { |
|
| 650 | - if ( isset( $row_data['columns'] ) ) { |
|
| 651 | - foreach ( $row_data['columns'] as $col => $col_data ) { |
|
| 652 | - if ( isset( $col_data['items'] ) ) { |
|
| 653 | - foreach ( $col_data['items'] as $key => $item ) { |
|
| 654 | - if ( $item['type'] == 'item' ) { |
|
| 655 | - $menu_items_included[] = $item['id']; |
|
| 656 | - $is_child_of_parent = false; |
|
| 657 | - |
|
| 658 | - foreach ( $second_level_menu_items as $menu_item ) { |
|
| 659 | - if ( $menu_item['id'] == $item['id'] ) { |
|
| 660 | - $is_child_of_parent = true; |
|
| 661 | - } |
|
| 662 | - } |
|
| 663 | - |
|
| 664 | - if ( ! $is_child_of_parent ) { |
|
| 665 | - unset( $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ] ); // menu item has been deleted or moved |
|
| 666 | - } |
|
| 667 | - } else { |
|
| 668 | - if ( ! $this->get_name_for_widget_id( $item['id'] ) ) { |
|
| 669 | - unset( $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ] ); // widget no longer exists |
|
| 670 | - } |
|
| 671 | - } |
|
| 672 | - } |
|
| 673 | - } |
|
| 674 | - } |
|
| 675 | - } |
|
| 676 | - } |
|
| 677 | - |
|
| 678 | - // Find any second level menu items that have been added to the menu but are not yet within the grid data |
|
| 679 | - $orphaned_items = array(); |
|
| 680 | - |
|
| 681 | - foreach ( $second_level_menu_items as $menu_item ) { |
|
| 682 | - if ( ! in_array( $menu_item['id'], $menu_items_included ) ) { |
|
| 683 | - $orphaned_items[] = $menu_item; |
|
| 684 | - } |
|
| 685 | - } |
|
| 686 | - |
|
| 687 | - if ( ! isset( $saved_grid[0]['columns'][0]['items'][0] ) ) { |
|
| 688 | - $index = 0; // grid is empty |
|
| 689 | - } else { |
|
| 690 | - $index = 999; // create new row |
|
| 691 | - } |
|
| 692 | - |
|
| 693 | - foreach ( $orphaned_items as $key => $menu_item ) { |
|
| 694 | - $saved_grid[ $index ]['columns'][0]['meta']['span'] = 3; |
|
| 695 | - $saved_grid[ $index ]['columns'][0]['items'][ $key ] = array( |
|
| 696 | - 'id' => $menu_item['id'], |
|
| 697 | - 'type' => 'item', |
|
| 698 | - 'title' => $menu_item['title'], |
|
| 699 | - 'description' => __( 'Menu Item', 'megamenu' ), |
|
| 700 | - ); |
|
| 701 | - } |
|
| 702 | - |
|
| 703 | - if ( is_admin() ) { |
|
| 704 | - $saved_grid = $this->populate_grid_menu_item_titles( $saved_grid, $menu_id ); |
|
| 705 | - } |
|
| 706 | - |
|
| 707 | - return $saved_grid; |
|
| 708 | - } |
|
| 709 | - |
|
| 710 | - |
|
| 711 | - /** |
|
| 712 | - * Loop through the grid data and apply titles and labels to each menu item and widget. |
|
| 713 | - * |
|
| 714 | - * @param array $saved_grid |
|
| 715 | - * @param int $menu_id |
|
| 716 | - * @since 2.4 |
|
| 717 | - * @return array |
|
| 718 | - */ |
|
| 719 | - public function populate_grid_menu_item_titles( $saved_grid, $menu_id ) { |
|
| 720 | - |
|
| 721 | - $menu_items = wp_get_nav_menu_items( $menu_id ); |
|
| 722 | - |
|
| 723 | - $menu_item_title_map = array(); |
|
| 724 | - |
|
| 725 | - foreach ( $menu_items as $item ) { |
|
| 726 | - $menu_item_title_map[ $item->ID ] = $item->title; |
|
| 727 | - } |
|
| 728 | - |
|
| 729 | - foreach ( $saved_grid as $row => $row_data ) { |
|
| 730 | - if ( isset( $row_data['columns'] ) ) { |
|
| 731 | - foreach ( $row_data['columns'] as $col => $col_data ) { |
|
| 732 | - if ( isset( $col_data['items'] ) ) { |
|
| 733 | - foreach ( $col_data['items'] as $key => $item ) { |
|
| 734 | - if ( $item['type'] == 'item' ) { |
|
| 735 | - |
|
| 736 | - if ( isset( $menu_item_title_map[ $item['id'] ] ) ) { |
|
| 737 | - $title = $menu_item_title_map[ $item['id'] ]; |
|
| 738 | - } else { |
|
| 739 | - $title = __( '(no label)' ); |
|
| 740 | - } |
|
| 741 | - |
|
| 742 | - $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ]['title'] = $title; |
|
| 743 | - $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ]['description'] = __( 'Menu Item', 'megamenu' ); |
|
| 744 | - } else { |
|
| 745 | - $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ]['title'] = $this->get_title_for_widget_id( $item['id'] ); |
|
| 746 | - $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ]['description'] = $this->get_name_for_widget_id( $item['id'] ); |
|
| 747 | - } |
|
| 748 | - } |
|
| 749 | - } |
|
| 750 | - } |
|
| 751 | - } |
|
| 752 | - } |
|
| 753 | - |
|
| 754 | - return $saved_grid; |
|
| 755 | - } |
|
| 756 | - |
|
| 757 | - |
|
| 758 | - /** |
|
| 759 | - * Returns the widget data as stored in the options table |
|
| 760 | - * |
|
| 761 | - * @since 1.8.1 |
|
| 762 | - * @param string $widget_id |
|
| 763 | - */ |
|
| 764 | - public function get_settings_for_widget_id( $widget_id ) { |
|
| 765 | - |
|
| 766 | - $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 767 | - |
|
| 768 | - if ( ! $id_base ) { |
|
| 769 | - return false; |
|
| 770 | - } |
|
| 771 | - |
|
| 772 | - $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 773 | - |
|
| 774 | - $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 775 | - |
|
| 776 | - return $current_widgets[ $widget_number ]; |
|
| 777 | - |
|
| 778 | - } |
|
| 779 | - |
|
| 780 | - /** |
|
| 781 | - * Returns the widget ID (number) |
|
| 782 | - * |
|
| 783 | - * @since 1.0 |
|
| 784 | - * @param string $widget_id - id_base-ID (eg meta-3) |
|
| 785 | - * @return int |
|
| 786 | - */ |
|
| 787 | - public function get_widget_number_for_widget_id( $widget_id ) { |
|
| 788 | - |
|
| 789 | - $parts = explode( '-', $widget_id ); |
|
| 790 | - |
|
| 791 | - return absint( end( $parts ) ); |
|
| 792 | - |
|
| 793 | - } |
|
| 794 | - |
|
| 795 | - /** |
|
| 796 | - * Returns the name/title of a Widget |
|
| 797 | - * |
|
| 798 | - * @since 1.0 |
|
| 799 | - * @param $widget_id - id_base-ID (eg meta-3) |
|
| 800 | - * @return string e.g. "Custom HTML" or "Text" |
|
| 801 | - */ |
|
| 802 | - public function get_name_for_widget_id( $widget_id ) { |
|
| 803 | - global $wp_registered_widgets; |
|
| 804 | - |
|
| 805 | - if ( ! isset( $wp_registered_widgets[ $widget_id ] ) ) { |
|
| 806 | - return false; |
|
| 807 | - } |
|
| 808 | - |
|
| 809 | - $registered_widget = $wp_registered_widgets[ $widget_id ]; |
|
| 810 | - |
|
| 811 | - return $registered_widget['name']; |
|
| 812 | - |
|
| 813 | - } |
|
| 814 | - |
|
| 815 | - |
|
| 816 | - /** |
|
| 817 | - * Returns the title of a Widget |
|
| 818 | - * |
|
| 819 | - * @since 2.4 |
|
| 820 | - * @param $widget_id - id_base-ID (eg meta-3) |
|
| 821 | - */ |
|
| 822 | - public function get_title_for_widget_id( $widget_id ) { |
|
| 823 | - $instance = $this->get_settings_for_widget_id( $widget_id ); |
|
| 824 | - |
|
| 825 | - if ( isset( $instance['title'] ) && strlen( $instance['title'] ) ) { |
|
| 826 | - return $instance['title']; |
|
| 827 | - } |
|
| 828 | - |
|
| 829 | - return $this->get_name_for_widget_id( $widget_id ); |
|
| 830 | - |
|
| 831 | - } |
|
| 604 | + return $items; |
|
| 605 | + } |
|
| 606 | + |
|
| 607 | + /** |
|
| 608 | + * Return a sorted array of grid data representing rows, columns and items within each column. |
|
| 609 | + * |
|
| 610 | + * @param int $parent_menu_item_id |
|
| 611 | + * @param int $menu_id |
|
| 612 | + * @since 2.4 |
|
| 613 | + * @return array |
|
| 614 | + */ |
|
| 615 | + public function get_grid_widgets_and_menu_items_for_menu_id( $parent_menu_item_id, $menu_id, $menu_items = false ) { |
|
| 616 | + |
|
| 617 | + $meta = get_post_meta( $parent_menu_item_id, '_megamenu', true ); |
|
| 618 | + |
|
| 619 | + $saved_grid = array(); |
|
| 620 | + |
|
| 621 | + if ( isset( $meta['grid'] ) ) { |
|
| 622 | + $saved_grid = $this->populate_saved_grid_data( $parent_menu_item_id, $menu_id, $meta['grid'], $menu_items ); |
|
| 623 | + } else { |
|
| 624 | + // return empty row |
|
| 625 | + $saved_grid[0]['columns'][0]['meta']['span'] = 3; |
|
| 626 | + $saved_grid = $this->populate_saved_grid_data( $parent_menu_item_id, $menu_id, $saved_grid, $menu_items ); |
|
| 627 | + |
|
| 628 | + } |
|
| 629 | + |
|
| 630 | + return $saved_grid; |
|
| 631 | + } |
|
| 632 | + |
|
| 633 | + |
|
| 634 | + /** |
|
| 635 | + * Ensure the widgets that are within the grid data still exist and have not been deleted (through the Widgets screen) |
|
| 636 | + * Ensure second level menu items saved within the grid data are still actually second level menu itms within the menu structure |
|
| 637 | + * |
|
| 638 | + * @param $saved_grid - array representing rows, columns and widgets/menu items within each column |
|
| 639 | + * @param $second_level_menu_items - array of second level menu items beneath the current menu item |
|
| 640 | + * @since 2.4 |
|
| 641 | + * @return array |
|
| 642 | + */ |
|
| 643 | + public function populate_saved_grid_data( $parent_menu_item_id, $menu_id, $saved_grid, $menu_items ) { |
|
| 644 | + |
|
| 645 | + $second_level_menu_items = $this->get_second_level_menu_items( $parent_menu_item_id, $menu_id, $menu_items ); |
|
| 646 | + |
|
| 647 | + $menu_items_included = array(); |
|
| 648 | + |
|
| 649 | + foreach ( $saved_grid as $row => $row_data ) { |
|
| 650 | + if ( isset( $row_data['columns'] ) ) { |
|
| 651 | + foreach ( $row_data['columns'] as $col => $col_data ) { |
|
| 652 | + if ( isset( $col_data['items'] ) ) { |
|
| 653 | + foreach ( $col_data['items'] as $key => $item ) { |
|
| 654 | + if ( $item['type'] == 'item' ) { |
|
| 655 | + $menu_items_included[] = $item['id']; |
|
| 656 | + $is_child_of_parent = false; |
|
| 657 | + |
|
| 658 | + foreach ( $second_level_menu_items as $menu_item ) { |
|
| 659 | + if ( $menu_item['id'] == $item['id'] ) { |
|
| 660 | + $is_child_of_parent = true; |
|
| 661 | + } |
|
| 662 | + } |
|
| 663 | + |
|
| 664 | + if ( ! $is_child_of_parent ) { |
|
| 665 | + unset( $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ] ); // menu item has been deleted or moved |
|
| 666 | + } |
|
| 667 | + } else { |
|
| 668 | + if ( ! $this->get_name_for_widget_id( $item['id'] ) ) { |
|
| 669 | + unset( $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ] ); // widget no longer exists |
|
| 670 | + } |
|
| 671 | + } |
|
| 672 | + } |
|
| 673 | + } |
|
| 674 | + } |
|
| 675 | + } |
|
| 676 | + } |
|
| 677 | + |
|
| 678 | + // Find any second level menu items that have been added to the menu but are not yet within the grid data |
|
| 679 | + $orphaned_items = array(); |
|
| 680 | + |
|
| 681 | + foreach ( $second_level_menu_items as $menu_item ) { |
|
| 682 | + if ( ! in_array( $menu_item['id'], $menu_items_included ) ) { |
|
| 683 | + $orphaned_items[] = $menu_item; |
|
| 684 | + } |
|
| 685 | + } |
|
| 686 | + |
|
| 687 | + if ( ! isset( $saved_grid[0]['columns'][0]['items'][0] ) ) { |
|
| 688 | + $index = 0; // grid is empty |
|
| 689 | + } else { |
|
| 690 | + $index = 999; // create new row |
|
| 691 | + } |
|
| 692 | + |
|
| 693 | + foreach ( $orphaned_items as $key => $menu_item ) { |
|
| 694 | + $saved_grid[ $index ]['columns'][0]['meta']['span'] = 3; |
|
| 695 | + $saved_grid[ $index ]['columns'][0]['items'][ $key ] = array( |
|
| 696 | + 'id' => $menu_item['id'], |
|
| 697 | + 'type' => 'item', |
|
| 698 | + 'title' => $menu_item['title'], |
|
| 699 | + 'description' => __( 'Menu Item', 'megamenu' ), |
|
| 700 | + ); |
|
| 701 | + } |
|
| 702 | + |
|
| 703 | + if ( is_admin() ) { |
|
| 704 | + $saved_grid = $this->populate_grid_menu_item_titles( $saved_grid, $menu_id ); |
|
| 705 | + } |
|
| 706 | + |
|
| 707 | + return $saved_grid; |
|
| 708 | + } |
|
| 709 | + |
|
| 710 | + |
|
| 711 | + /** |
|
| 712 | + * Loop through the grid data and apply titles and labels to each menu item and widget. |
|
| 713 | + * |
|
| 714 | + * @param array $saved_grid |
|
| 715 | + * @param int $menu_id |
|
| 716 | + * @since 2.4 |
|
| 717 | + * @return array |
|
| 718 | + */ |
|
| 719 | + public function populate_grid_menu_item_titles( $saved_grid, $menu_id ) { |
|
| 720 | + |
|
| 721 | + $menu_items = wp_get_nav_menu_items( $menu_id ); |
|
| 722 | + |
|
| 723 | + $menu_item_title_map = array(); |
|
| 724 | + |
|
| 725 | + foreach ( $menu_items as $item ) { |
|
| 726 | + $menu_item_title_map[ $item->ID ] = $item->title; |
|
| 727 | + } |
|
| 728 | + |
|
| 729 | + foreach ( $saved_grid as $row => $row_data ) { |
|
| 730 | + if ( isset( $row_data['columns'] ) ) { |
|
| 731 | + foreach ( $row_data['columns'] as $col => $col_data ) { |
|
| 732 | + if ( isset( $col_data['items'] ) ) { |
|
| 733 | + foreach ( $col_data['items'] as $key => $item ) { |
|
| 734 | + if ( $item['type'] == 'item' ) { |
|
| 735 | + |
|
| 736 | + if ( isset( $menu_item_title_map[ $item['id'] ] ) ) { |
|
| 737 | + $title = $menu_item_title_map[ $item['id'] ]; |
|
| 738 | + } else { |
|
| 739 | + $title = __( '(no label)' ); |
|
| 740 | + } |
|
| 741 | + |
|
| 742 | + $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ]['title'] = $title; |
|
| 743 | + $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ]['description'] = __( 'Menu Item', 'megamenu' ); |
|
| 744 | + } else { |
|
| 745 | + $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ]['title'] = $this->get_title_for_widget_id( $item['id'] ); |
|
| 746 | + $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ]['description'] = $this->get_name_for_widget_id( $item['id'] ); |
|
| 747 | + } |
|
| 748 | + } |
|
| 749 | + } |
|
| 750 | + } |
|
| 751 | + } |
|
| 752 | + } |
|
| 753 | + |
|
| 754 | + return $saved_grid; |
|
| 755 | + } |
|
| 756 | + |
|
| 757 | + |
|
| 758 | + /** |
|
| 759 | + * Returns the widget data as stored in the options table |
|
| 760 | + * |
|
| 761 | + * @since 1.8.1 |
|
| 762 | + * @param string $widget_id |
|
| 763 | + */ |
|
| 764 | + public function get_settings_for_widget_id( $widget_id ) { |
|
| 765 | + |
|
| 766 | + $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 767 | + |
|
| 768 | + if ( ! $id_base ) { |
|
| 769 | + return false; |
|
| 770 | + } |
|
| 771 | + |
|
| 772 | + $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 773 | + |
|
| 774 | + $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 775 | + |
|
| 776 | + return $current_widgets[ $widget_number ]; |
|
| 777 | + |
|
| 778 | + } |
|
| 779 | + |
|
| 780 | + /** |
|
| 781 | + * Returns the widget ID (number) |
|
| 782 | + * |
|
| 783 | + * @since 1.0 |
|
| 784 | + * @param string $widget_id - id_base-ID (eg meta-3) |
|
| 785 | + * @return int |
|
| 786 | + */ |
|
| 787 | + public function get_widget_number_for_widget_id( $widget_id ) { |
|
| 788 | + |
|
| 789 | + $parts = explode( '-', $widget_id ); |
|
| 790 | + |
|
| 791 | + return absint( end( $parts ) ); |
|
| 792 | + |
|
| 793 | + } |
|
| 794 | + |
|
| 795 | + /** |
|
| 796 | + * Returns the name/title of a Widget |
|
| 797 | + * |
|
| 798 | + * @since 1.0 |
|
| 799 | + * @param $widget_id - id_base-ID (eg meta-3) |
|
| 800 | + * @return string e.g. "Custom HTML" or "Text" |
|
| 801 | + */ |
|
| 802 | + public function get_name_for_widget_id( $widget_id ) { |
|
| 803 | + global $wp_registered_widgets; |
|
| 804 | + |
|
| 805 | + if ( ! isset( $wp_registered_widgets[ $widget_id ] ) ) { |
|
| 806 | + return false; |
|
| 807 | + } |
|
| 808 | + |
|
| 809 | + $registered_widget = $wp_registered_widgets[ $widget_id ]; |
|
| 810 | + |
|
| 811 | + return $registered_widget['name']; |
|
| 812 | + |
|
| 813 | + } |
|
| 814 | + |
|
| 815 | + |
|
| 816 | + /** |
|
| 817 | + * Returns the title of a Widget |
|
| 818 | + * |
|
| 819 | + * @since 2.4 |
|
| 820 | + * @param $widget_id - id_base-ID (eg meta-3) |
|
| 821 | + */ |
|
| 822 | + public function get_title_for_widget_id( $widget_id ) { |
|
| 823 | + $instance = $this->get_settings_for_widget_id( $widget_id ); |
|
| 824 | + |
|
| 825 | + if ( isset( $instance['title'] ) && strlen( $instance['title'] ) ) { |
|
| 826 | + return $instance['title']; |
|
| 827 | + } |
|
| 828 | + |
|
| 829 | + return $this->get_name_for_widget_id( $widget_id ); |
|
| 830 | + |
|
| 831 | + } |
|
| 832 | 832 | |
| 833 | - /** |
|
| 834 | - * Returns the id_base value for a Widget ID |
|
| 835 | - * |
|
| 836 | - * @since 1.0 |
|
| 837 | - */ |
|
| 838 | - public function get_id_base_for_widget_id( $widget_id ) { |
|
| 839 | - global $wp_registered_widget_controls; |
|
| 833 | + /** |
|
| 834 | + * Returns the id_base value for a Widget ID |
|
| 835 | + * |
|
| 836 | + * @since 1.0 |
|
| 837 | + */ |
|
| 838 | + public function get_id_base_for_widget_id( $widget_id ) { |
|
| 839 | + global $wp_registered_widget_controls; |
|
| 840 | 840 | |
| 841 | - if ( ! isset( $wp_registered_widget_controls[ $widget_id ] ) ) { |
|
| 842 | - return false; |
|
| 843 | - } |
|
| 841 | + if ( ! isset( $wp_registered_widget_controls[ $widget_id ] ) ) { |
|
| 842 | + return false; |
|
| 843 | + } |
|
| 844 | 844 | |
| 845 | - $control = $wp_registered_widget_controls[ $widget_id ]; |
|
| 845 | + $control = $wp_registered_widget_controls[ $widget_id ]; |
|
| 846 | 846 | |
| 847 | - $id_base = isset( $control['id_base'] ) ? $control['id_base'] : $control['id']; |
|
| 847 | + $id_base = isset( $control['id_base'] ) ? $control['id_base'] : $control['id']; |
|
| 848 | 848 | |
| 849 | - return $id_base; |
|
| 849 | + return $id_base; |
|
| 850 | 850 | |
| 851 | - } |
|
| 851 | + } |
|
| 852 | 852 | |
| 853 | - /** |
|
| 854 | - * Returns the HTML for a single widget instance. |
|
| 855 | - * |
|
| 856 | - * @since 1.0 |
|
| 857 | - * @param string widget_id Something like meta-3 |
|
| 858 | - */ |
|
| 859 | - public function show_widget( $id ) { |
|
| 860 | - global $wp_registered_widgets; |
|
| 853 | + /** |
|
| 854 | + * Returns the HTML for a single widget instance. |
|
| 855 | + * |
|
| 856 | + * @since 1.0 |
|
| 857 | + * @param string widget_id Something like meta-3 |
|
| 858 | + */ |
|
| 859 | + public function show_widget( $id ) { |
|
| 860 | + global $wp_registered_widgets; |
|
| 861 | 861 | |
| 862 | - $params = array_merge( |
|
| 863 | - array( |
|
| 864 | - array_merge( |
|
| 865 | - array( |
|
| 866 | - 'widget_id' => $id, |
|
| 867 | - 'widget_name' => $wp_registered_widgets[ $id ]['name'], |
|
| 868 | - ) |
|
| 869 | - ), |
|
| 870 | - ), |
|
| 871 | - (array) $wp_registered_widgets[ $id ]['params'] |
|
| 872 | - ); |
|
| 862 | + $params = array_merge( |
|
| 863 | + array( |
|
| 864 | + array_merge( |
|
| 865 | + array( |
|
| 866 | + 'widget_id' => $id, |
|
| 867 | + 'widget_name' => $wp_registered_widgets[ $id ]['name'], |
|
| 868 | + ) |
|
| 869 | + ), |
|
| 870 | + ), |
|
| 871 | + (array) $wp_registered_widgets[ $id ]['params'] |
|
| 872 | + ); |
|
| 873 | 873 | |
| 874 | - $params[0]['id'] = 'mega-menu'; |
|
| 875 | - $params[0]['before_title'] = apply_filters( 'megamenu_before_widget_title', '<h4 class="mega-block-title">', $wp_registered_widgets[ $id ] ); |
|
| 876 | - $params[0]['after_title'] = apply_filters( 'megamenu_after_widget_title', '</h4>', $wp_registered_widgets[ $id ] ); |
|
| 877 | - $params[0]['before_widget'] = apply_filters( 'megamenu_before_widget', '', $wp_registered_widgets[ $id ] ); |
|
| 878 | - $params[0]['after_widget'] = apply_filters( 'megamenu_after_widget', '', $wp_registered_widgets[ $id ] ); |
|
| 874 | + $params[0]['id'] = 'mega-menu'; |
|
| 875 | + $params[0]['before_title'] = apply_filters( 'megamenu_before_widget_title', '<h4 class="mega-block-title">', $wp_registered_widgets[ $id ] ); |
|
| 876 | + $params[0]['after_title'] = apply_filters( 'megamenu_after_widget_title', '</h4>', $wp_registered_widgets[ $id ] ); |
|
| 877 | + $params[0]['before_widget'] = apply_filters( 'megamenu_before_widget', '', $wp_registered_widgets[ $id ] ); |
|
| 878 | + $params[0]['after_widget'] = apply_filters( 'megamenu_after_widget', '', $wp_registered_widgets[ $id ] ); |
|
| 879 | 879 | |
| 880 | - if ( defined( 'MEGAMENU_DYNAMIC_SIDEBAR_PARAMS' ) && MEGAMENU_DYNAMIC_SIDEBAR_PARAMS ) { |
|
| 881 | - $params[0]['before_widget'] = apply_filters( 'megamenu_before_widget', '<div id="" class="">', $wp_registered_widgets[ $id ] ); |
|
| 882 | - $params[0]['after_widget'] = apply_filters( 'megamenu_after_widget', '</div>', $wp_registered_widgets[ $id ] ); |
|
| 880 | + if ( defined( 'MEGAMENU_DYNAMIC_SIDEBAR_PARAMS' ) && MEGAMENU_DYNAMIC_SIDEBAR_PARAMS ) { |
|
| 881 | + $params[0]['before_widget'] = apply_filters( 'megamenu_before_widget', '<div id="" class="">', $wp_registered_widgets[ $id ] ); |
|
| 882 | + $params[0]['after_widget'] = apply_filters( 'megamenu_after_widget', '</div>', $wp_registered_widgets[ $id ] ); |
|
| 883 | 883 | |
| 884 | - $params = apply_filters( 'dynamic_sidebar_params', $params ); |
|
| 885 | - } |
|
| 884 | + $params = apply_filters( 'dynamic_sidebar_params', $params ); |
|
| 885 | + } |
|
| 886 | 886 | |
| 887 | - $callback = $wp_registered_widgets[ $id ]['callback']; |
|
| 887 | + $callback = $wp_registered_widgets[ $id ]['callback']; |
|
| 888 | 888 | |
| 889 | - if ( is_callable( $callback ) ) { |
|
| 890 | - ob_start(); |
|
| 891 | - call_user_func_array( $callback, $params ); |
|
| 892 | - return ob_get_clean(); |
|
| 893 | - } |
|
| 889 | + if ( is_callable( $callback ) ) { |
|
| 890 | + ob_start(); |
|
| 891 | + call_user_func_array( $callback, $params ); |
|
| 892 | + return ob_get_clean(); |
|
| 893 | + } |
|
| 894 | 894 | |
| 895 | - } |
|
| 895 | + } |
|
| 896 | 896 | |
| 897 | 897 | |
| 898 | - /** |
|
| 899 | - * Returns the class name for a widget instance. |
|
| 900 | - * |
|
| 901 | - * @since 1.8.1 |
|
| 902 | - * @param string widget_id Something like meta-3 |
|
| 903 | - */ |
|
| 904 | - public function get_widget_class( $id ) { |
|
| 905 | - global $wp_registered_widgets; |
|
| 898 | + /** |
|
| 899 | + * Returns the class name for a widget instance. |
|
| 900 | + * |
|
| 901 | + * @since 1.8.1 |
|
| 902 | + * @param string widget_id Something like meta-3 |
|
| 903 | + */ |
|
| 904 | + public function get_widget_class( $id ) { |
|
| 905 | + global $wp_registered_widgets; |
|
| 906 | 906 | |
| 907 | - if ( isset( $wp_registered_widgets[ $id ]['classname'] ) ) { |
|
| 908 | - return $wp_registered_widgets[ $id ]['classname']; |
|
| 909 | - } |
|
| 907 | + if ( isset( $wp_registered_widgets[ $id ]['classname'] ) ) { |
|
| 908 | + return $wp_registered_widgets[ $id ]['classname']; |
|
| 909 | + } |
|
| 910 | 910 | |
| 911 | - return ''; |
|
| 912 | - } |
|
| 911 | + return ''; |
|
| 912 | + } |
|
| 913 | 913 | |
| 914 | 914 | |
| 915 | - /** |
|
| 916 | - * Shows the widget edit form for the specified widget. |
|
| 917 | - * |
|
| 918 | - * @since 1.0 |
|
| 919 | - * @param $widget_id - id_base-ID (eg meta-3) |
|
| 920 | - */ |
|
| 921 | - public function show_widget_form( $widget_id ) { |
|
| 922 | - global $wp_registered_widget_controls; |
|
| 915 | + /** |
|
| 916 | + * Shows the widget edit form for the specified widget. |
|
| 917 | + * |
|
| 918 | + * @since 1.0 |
|
| 919 | + * @param $widget_id - id_base-ID (eg meta-3) |
|
| 920 | + */ |
|
| 921 | + public function show_widget_form( $widget_id ) { |
|
| 922 | + global $wp_registered_widget_controls; |
|
| 923 | 923 | |
| 924 | - $control = $wp_registered_widget_controls[ $widget_id ]; |
|
| 924 | + $control = $wp_registered_widget_controls[ $widget_id ]; |
|
| 925 | 925 | |
| 926 | - $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 926 | + $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 927 | 927 | |
| 928 | - $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 928 | + $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 929 | 929 | |
| 930 | - $nonce = wp_create_nonce( 'megamenu_save_widget_' . $widget_id ); |
|
| 930 | + $nonce = wp_create_nonce( 'megamenu_save_widget_' . $widget_id ); |
|
| 931 | 931 | |
| 932 | - ?> |
|
| 932 | + ?> |
|
| 933 | 933 | |
| 934 | 934 | <form method='post'> |
| 935 | 935 | <input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr( $widget_id ); ?>" /> |
@@ -939,10 +939,10 @@ discard block |
||
| 939 | 939 | <input type='hidden' name='_wpnonce' value='<?php echo esc_attr( $nonce ); ?>' /> |
| 940 | 940 | <div class='widget-content'> |
| 941 | 941 | <?php |
| 942 | - if ( is_callable( $control['callback'] ) ) { |
|
| 943 | - call_user_func_array( $control['callback'], $control['params'] ); |
|
| 944 | - } |
|
| 945 | - ?> |
|
| 942 | + if ( is_callable( $control['callback'] ) ) { |
|
| 943 | + call_user_func_array( $control['callback'], $control['params'] ); |
|
| 944 | + } |
|
| 945 | + ?> |
|
| 946 | 946 | |
| 947 | 947 | <div class='widget-controls'> |
| 948 | 948 | <a class='delete' href='#delete'><?php _e( 'Delete', 'megamenu' ); ?></a> | |
@@ -950,448 +950,448 @@ discard block |
||
| 950 | 950 | </div> |
| 951 | 951 | |
| 952 | 952 | <?php |
| 953 | - submit_button( __( 'Save' ), 'button-primary alignright', 'savewidget', false ); |
|
| 954 | - ?> |
|
| 953 | + submit_button( __( 'Save' ), 'button-primary alignright', 'savewidget', false ); |
|
| 954 | + ?> |
|
| 955 | 955 | </div> |
| 956 | 956 | </form> |
| 957 | 957 | |
| 958 | 958 | |
| 959 | 959 | <?php |
| 960 | - } |
|
| 960 | + } |
|
| 961 | 961 | |
| 962 | 962 | |
| 963 | - /** |
|
| 964 | - * Saves a widget. Calls the update callback on the widget. |
|
| 965 | - * The callback inspects the post values and updates all widget instances which match the base ID. |
|
| 966 | - * |
|
| 967 | - * @since 1.0 |
|
| 968 | - * @param string $id_base - e.g. 'meta' |
|
| 969 | - * @return bool |
|
| 970 | - */ |
|
| 971 | - public function save_widget( $id_base ) { |
|
| 972 | - global $wp_registered_widget_updates; |
|
| 963 | + /** |
|
| 964 | + * Saves a widget. Calls the update callback on the widget. |
|
| 965 | + * The callback inspects the post values and updates all widget instances which match the base ID. |
|
| 966 | + * |
|
| 967 | + * @since 1.0 |
|
| 968 | + * @param string $id_base - e.g. 'meta' |
|
| 969 | + * @return bool |
|
| 970 | + */ |
|
| 971 | + public function save_widget( $id_base ) { |
|
| 972 | + global $wp_registered_widget_updates; |
|
| 973 | 973 | |
| 974 | - $control = $wp_registered_widget_updates[ $id_base ]; |
|
| 974 | + $control = $wp_registered_widget_updates[ $id_base ]; |
|
| 975 | 975 | |
| 976 | - if ( is_callable( $control['callback'] ) ) { |
|
| 976 | + if ( is_callable( $control['callback'] ) ) { |
|
| 977 | 977 | |
| 978 | - call_user_func_array( $control['callback'], $control['params'] ); |
|
| 978 | + call_user_func_array( $control['callback'], $control['params'] ); |
|
| 979 | 979 | |
| 980 | - do_action( 'megamenu_after_widget_save' ); |
|
| 980 | + do_action( 'megamenu_after_widget_save' ); |
|
| 981 | 981 | |
| 982 | - return true; |
|
| 983 | - } |
|
| 982 | + return true; |
|
| 983 | + } |
|
| 984 | 984 | |
| 985 | - return false; |
|
| 985 | + return false; |
|
| 986 | 986 | |
| 987 | - } |
|
| 987 | + } |
|
| 988 | 988 | |
| 989 | 989 | |
| 990 | - /** |
|
| 991 | - * Adds a widget to WordPress. First creates a new widget instance, then |
|
| 992 | - * adds the widget instance to the mega menu widget sidebar area. |
|
| 993 | - * |
|
| 994 | - * @since 1.0 |
|
| 995 | - * @param string $id_base |
|
| 996 | - * @param int $menu_item_id |
|
| 997 | - * @param string $title |
|
| 998 | - */ |
|
| 999 | - public function add_widget( $id_base, $menu_item_id, $title, $is_grid_widget ) { |
|
| 990 | + /** |
|
| 991 | + * Adds a widget to WordPress. First creates a new widget instance, then |
|
| 992 | + * adds the widget instance to the mega menu widget sidebar area. |
|
| 993 | + * |
|
| 994 | + * @since 1.0 |
|
| 995 | + * @param string $id_base |
|
| 996 | + * @param int $menu_item_id |
|
| 997 | + * @param string $title |
|
| 998 | + */ |
|
| 999 | + public function add_widget( $id_base, $menu_item_id, $title, $is_grid_widget ) { |
|
| 1000 | 1000 | |
| 1001 | - require_once( ABSPATH . 'wp-admin/includes/widgets.php' ); |
|
| 1001 | + require_once( ABSPATH . 'wp-admin/includes/widgets.php' ); |
|
| 1002 | 1002 | |
| 1003 | - $next_id = next_widget_id_number( $id_base ); |
|
| 1003 | + $next_id = next_widget_id_number( $id_base ); |
|
| 1004 | 1004 | |
| 1005 | - $this->add_widget_instance( $id_base, $next_id, $menu_item_id, $is_grid_widget ); |
|
| 1005 | + $this->add_widget_instance( $id_base, $next_id, $menu_item_id, $is_grid_widget ); |
|
| 1006 | 1006 | |
| 1007 | - $widget_id = $this->add_widget_to_sidebar( $id_base, $next_id ); |
|
| 1007 | + $widget_id = $this->add_widget_to_sidebar( $id_base, $next_id ); |
|
| 1008 | 1008 | |
| 1009 | - $return = '<div class="widget" title="' . esc_attr( $title ) . '" data-columns="2" id="' . $widget_id . '" data-type="widget" data-id="' . $widget_id . '">'; |
|
| 1010 | - $return .= ' <div class="widget-top">'; |
|
| 1011 | - $return .= ' <div class="widget-title-action">'; |
|
| 1009 | + $return = '<div class="widget" title="' . esc_attr( $title ) . '" data-columns="2" id="' . $widget_id . '" data-type="widget" data-id="' . $widget_id . '">'; |
|
| 1010 | + $return .= ' <div class="widget-top">'; |
|
| 1011 | + $return .= ' <div class="widget-title-action">'; |
|
| 1012 | 1012 | |
| 1013 | - if ( ! $is_grid_widget ) { |
|
| 1014 | - $return .= ' <a class="widget-option widget-contract" title="' . esc_attr( __( 'Contract', 'megamenu' ) ) . '"></a>'; |
|
| 1015 | - $return .= ' <span class="widget-cols"><span class="widget-num-cols">2</span><span class="widget-of">/</span><span class="widget-total-cols">X</span></span>'; |
|
| 1016 | - $return .= ' <a class="widget-option widget-expand" title="' . esc_attr( __( 'Expand', 'megamenu' ) ) . '"></a>'; |
|
| 1017 | - } |
|
| 1013 | + if ( ! $is_grid_widget ) { |
|
| 1014 | + $return .= ' <a class="widget-option widget-contract" title="' . esc_attr( __( 'Contract', 'megamenu' ) ) . '"></a>'; |
|
| 1015 | + $return .= ' <span class="widget-cols"><span class="widget-num-cols">2</span><span class="widget-of">/</span><span class="widget-total-cols">X</span></span>'; |
|
| 1016 | + $return .= ' <a class="widget-option widget-expand" title="' . esc_attr( __( 'Expand', 'megamenu' ) ) . '"></a>'; |
|
| 1017 | + } |
|
| 1018 | 1018 | |
| 1019 | - $return .= ' <a class="widget-option widget-action" title="' . esc_attr( __( 'Edit', 'megamenu' ) ) . '"></a>'; |
|
| 1020 | - $return .= ' </div>'; |
|
| 1021 | - $return .= ' <div class="widget-title">'; |
|
| 1022 | - $return .= ' <h4>' . esc_html( $title ) . '</h4>'; |
|
| 1019 | + $return .= ' <a class="widget-option widget-action" title="' . esc_attr( __( 'Edit', 'megamenu' ) ) . '"></a>'; |
|
| 1020 | + $return .= ' </div>'; |
|
| 1021 | + $return .= ' <div class="widget-title">'; |
|
| 1022 | + $return .= ' <h4>' . esc_html( $title ) . '</h4>'; |
|
| 1023 | 1023 | |
| 1024 | - if ( $is_grid_widget ) { |
|
| 1025 | - $return .= ' <span class="widget-desc">' . esc_html( $title ) . '</span>'; |
|
| 1026 | - } |
|
| 1024 | + if ( $is_grid_widget ) { |
|
| 1025 | + $return .= ' <span class="widget-desc">' . esc_html( $title ) . '</span>'; |
|
| 1026 | + } |
|
| 1027 | 1027 | |
| 1028 | - $return .= ' </div>'; |
|
| 1029 | - $return .= ' </div>'; |
|
| 1030 | - $return .= ' <div class="widget-inner widget-inside"></div>'; |
|
| 1031 | - $return .= '</div>'; |
|
| 1028 | + $return .= ' </div>'; |
|
| 1029 | + $return .= ' </div>'; |
|
| 1030 | + $return .= ' <div class="widget-inner widget-inside"></div>'; |
|
| 1031 | + $return .= '</div>'; |
|
| 1032 | 1032 | |
| 1033 | - return $return; |
|
| 1033 | + return $return; |
|
| 1034 | 1034 | |
| 1035 | - } |
|
| 1035 | + } |
|
| 1036 | 1036 | |
| 1037 | 1037 | |
| 1038 | - /** |
|
| 1039 | - * Adds a new widget instance of the specified base ID to the database. |
|
| 1040 | - * |
|
| 1041 | - * @since 1.0 |
|
| 1042 | - * @param string $id_base |
|
| 1043 | - * @param int $next_id |
|
| 1044 | - * @param int $menu_item_id |
|
| 1045 | - */ |
|
| 1046 | - private function add_widget_instance( $id_base, $next_id, $menu_item_id, $is_grid_widget ) { |
|
| 1038 | + /** |
|
| 1039 | + * Adds a new widget instance of the specified base ID to the database. |
|
| 1040 | + * |
|
| 1041 | + * @since 1.0 |
|
| 1042 | + * @param string $id_base |
|
| 1043 | + * @param int $next_id |
|
| 1044 | + * @param int $menu_item_id |
|
| 1045 | + */ |
|
| 1046 | + private function add_widget_instance( $id_base, $next_id, $menu_item_id, $is_grid_widget ) { |
|
| 1047 | 1047 | |
| 1048 | - $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 1048 | + $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 1049 | 1049 | |
| 1050 | - $current_widgets[ $next_id ] = array( |
|
| 1051 | - 'mega_menu_columns' => 2, |
|
| 1052 | - 'mega_menu_parent_menu_id' => $menu_item_id, |
|
| 1053 | - ); |
|
| 1050 | + $current_widgets[ $next_id ] = array( |
|
| 1051 | + 'mega_menu_columns' => 2, |
|
| 1052 | + 'mega_menu_parent_menu_id' => $menu_item_id, |
|
| 1053 | + ); |
|
| 1054 | 1054 | |
| 1055 | - if ( $is_grid_widget ) { |
|
| 1056 | - $current_widgets[ $next_id ] = array( |
|
| 1057 | - 'mega_menu_is_grid_widget' => 'true', |
|
| 1058 | - ); |
|
| 1059 | - } |
|
| 1055 | + if ( $is_grid_widget ) { |
|
| 1056 | + $current_widgets[ $next_id ] = array( |
|
| 1057 | + 'mega_menu_is_grid_widget' => 'true', |
|
| 1058 | + ); |
|
| 1059 | + } |
|
| 1060 | 1060 | |
| 1061 | - update_option( 'widget_' . $id_base, $current_widgets ); |
|
| 1061 | + update_option( 'widget_' . $id_base, $current_widgets ); |
|
| 1062 | 1062 | |
| 1063 | - } |
|
| 1063 | + } |
|
| 1064 | 1064 | |
| 1065 | - /** |
|
| 1066 | - * Removes a widget instance from the database |
|
| 1067 | - * |
|
| 1068 | - * @since 1.0 |
|
| 1069 | - * @param string $widget_id e.g. meta-3 |
|
| 1070 | - * @return bool. True if widget has been deleted. |
|
| 1071 | - */ |
|
| 1072 | - private function remove_widget_instance( $widget_id ) { |
|
| 1065 | + /** |
|
| 1066 | + * Removes a widget instance from the database |
|
| 1067 | + * |
|
| 1068 | + * @since 1.0 |
|
| 1069 | + * @param string $widget_id e.g. meta-3 |
|
| 1070 | + * @return bool. True if widget has been deleted. |
|
| 1071 | + */ |
|
| 1072 | + private function remove_widget_instance( $widget_id ) { |
|
| 1073 | 1073 | |
| 1074 | - $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 1075 | - $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 1074 | + $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 1075 | + $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 1076 | 1076 | |
| 1077 | - // add blank widget |
|
| 1078 | - $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 1077 | + // add blank widget |
|
| 1078 | + $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 1079 | 1079 | |
| 1080 | - if ( isset( $current_widgets[ $widget_number ] ) ) { |
|
| 1080 | + if ( isset( $current_widgets[ $widget_number ] ) ) { |
|
| 1081 | 1081 | |
| 1082 | - unset( $current_widgets[ $widget_number ] ); |
|
| 1082 | + unset( $current_widgets[ $widget_number ] ); |
|
| 1083 | 1083 | |
| 1084 | - update_option( 'widget_' . $id_base, $current_widgets ); |
|
| 1084 | + update_option( 'widget_' . $id_base, $current_widgets ); |
|
| 1085 | 1085 | |
| 1086 | - return true; |
|
| 1086 | + return true; |
|
| 1087 | 1087 | |
| 1088 | - } |
|
| 1088 | + } |
|
| 1089 | 1089 | |
| 1090 | - return false; |
|
| 1090 | + return false; |
|
| 1091 | 1091 | |
| 1092 | - } |
|
| 1092 | + } |
|
| 1093 | 1093 | |
| 1094 | 1094 | |
| 1095 | - /** |
|
| 1096 | - * Updates the number of mega columns for a specified widget. |
|
| 1097 | - * |
|
| 1098 | - * @since 1.0 |
|
| 1099 | - * @param string $widget_id |
|
| 1100 | - * @param int $columns |
|
| 1101 | - */ |
|
| 1102 | - public function update_widget_columns( $widget_id, $columns ) { |
|
| 1095 | + /** |
|
| 1096 | + * Updates the number of mega columns for a specified widget. |
|
| 1097 | + * |
|
| 1098 | + * @since 1.0 |
|
| 1099 | + * @param string $widget_id |
|
| 1100 | + * @param int $columns |
|
| 1101 | + */ |
|
| 1102 | + public function update_widget_columns( $widget_id, $columns ) { |
|
| 1103 | 1103 | |
| 1104 | - $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 1104 | + $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 1105 | 1105 | |
| 1106 | - $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 1106 | + $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 1107 | 1107 | |
| 1108 | - $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 1108 | + $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 1109 | 1109 | |
| 1110 | - $current_widgets[ $widget_number ]['mega_menu_columns'] = absint( $columns ); |
|
| 1110 | + $current_widgets[ $widget_number ]['mega_menu_columns'] = absint( $columns ); |
|
| 1111 | 1111 | |
| 1112 | - update_option( 'widget_' . $id_base, $current_widgets ); |
|
| 1112 | + update_option( 'widget_' . $id_base, $current_widgets ); |
|
| 1113 | 1113 | |
| 1114 | - do_action( 'megamenu_after_widget_save' ); |
|
| 1114 | + do_action( 'megamenu_after_widget_save' ); |
|
| 1115 | 1115 | |
| 1116 | - return true; |
|
| 1116 | + return true; |
|
| 1117 | 1117 | |
| 1118 | - } |
|
| 1118 | + } |
|
| 1119 | 1119 | |
| 1120 | 1120 | |
| 1121 | - /** |
|
| 1122 | - * Updates the number of mega columns for a specified widget. |
|
| 1123 | - * |
|
| 1124 | - * @since 1.10 |
|
| 1125 | - * @param string $menu_item_id |
|
| 1126 | - * @param int $columns |
|
| 1127 | - */ |
|
| 1128 | - public function update_menu_item_columns( $menu_item_id, $columns ) { |
|
| 1121 | + /** |
|
| 1122 | + * Updates the number of mega columns for a specified widget. |
|
| 1123 | + * |
|
| 1124 | + * @since 1.10 |
|
| 1125 | + * @param string $menu_item_id |
|
| 1126 | + * @param int $columns |
|
| 1127 | + */ |
|
| 1128 | + public function update_menu_item_columns( $menu_item_id, $columns ) { |
|
| 1129 | 1129 | |
| 1130 | - $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true ); |
|
| 1130 | + $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true ); |
|
| 1131 | 1131 | |
| 1132 | - $submitted_settings = array( |
|
| 1133 | - 'mega_menu_columns' => absint( $columns ), |
|
| 1134 | - ); |
|
| 1132 | + $submitted_settings = array( |
|
| 1133 | + 'mega_menu_columns' => absint( $columns ), |
|
| 1134 | + ); |
|
| 1135 | 1135 | |
| 1136 | - if ( is_array( $existing_settings ) ) { |
|
| 1137 | - $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 1138 | - } |
|
| 1136 | + if ( is_array( $existing_settings ) ) { |
|
| 1137 | + $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 1138 | + } |
|
| 1139 | 1139 | |
| 1140 | - update_post_meta( $menu_item_id, '_megamenu', $submitted_settings ); |
|
| 1140 | + update_post_meta( $menu_item_id, '_megamenu', $submitted_settings ); |
|
| 1141 | 1141 | |
| 1142 | - return true; |
|
| 1142 | + return true; |
|
| 1143 | 1143 | |
| 1144 | - } |
|
| 1144 | + } |
|
| 1145 | 1145 | |
| 1146 | 1146 | |
| 1147 | - /** |
|
| 1148 | - * Updates the order of a specified widget. |
|
| 1149 | - * |
|
| 1150 | - * @since 1.10 |
|
| 1151 | - * @param string $widget_id |
|
| 1152 | - * @param int $columns |
|
| 1153 | - */ |
|
| 1154 | - public function update_widget_order( $widget_id, $order, $parent_menu_item_id ) { |
|
| 1147 | + /** |
|
| 1148 | + * Updates the order of a specified widget. |
|
| 1149 | + * |
|
| 1150 | + * @since 1.10 |
|
| 1151 | + * @param string $widget_id |
|
| 1152 | + * @param int $columns |
|
| 1153 | + */ |
|
| 1154 | + public function update_widget_order( $widget_id, $order, $parent_menu_item_id ) { |
|
| 1155 | 1155 | |
| 1156 | - $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 1156 | + $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 1157 | 1157 | |
| 1158 | - $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 1158 | + $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 1159 | 1159 | |
| 1160 | - $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 1160 | + $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 1161 | 1161 | |
| 1162 | - $current_widgets[ $widget_number ]['mega_menu_order'] = array( $parent_menu_item_id => absint( $order ) ); |
|
| 1162 | + $current_widgets[ $widget_number ]['mega_menu_order'] = array( $parent_menu_item_id => absint( $order ) ); |
|
| 1163 | 1163 | |
| 1164 | - update_option( 'widget_' . $id_base, $current_widgets ); |
|
| 1164 | + update_option( 'widget_' . $id_base, $current_widgets ); |
|
| 1165 | 1165 | |
| 1166 | - return true; |
|
| 1166 | + return true; |
|
| 1167 | 1167 | |
| 1168 | - } |
|
| 1168 | + } |
|
| 1169 | 1169 | |
| 1170 | 1170 | |
| 1171 | - /** |
|
| 1172 | - * Updates the order of a specified menu item. |
|
| 1173 | - * |
|
| 1174 | - * @since 1.10 |
|
| 1175 | - * @param string $menu_item_id |
|
| 1176 | - * @param int $order |
|
| 1177 | - */ |
|
| 1178 | - public function update_menu_item_order( $menu_item_id, $order, $parent_menu_item_id ) { |
|
| 1171 | + /** |
|
| 1172 | + * Updates the order of a specified menu item. |
|
| 1173 | + * |
|
| 1174 | + * @since 1.10 |
|
| 1175 | + * @param string $menu_item_id |
|
| 1176 | + * @param int $order |
|
| 1177 | + */ |
|
| 1178 | + public function update_menu_item_order( $menu_item_id, $order, $parent_menu_item_id ) { |
|
| 1179 | 1179 | |
| 1180 | - $submitted_settings['mega_menu_order'] = array( $parent_menu_item_id => absint( $order ) ); |
|
| 1180 | + $submitted_settings['mega_menu_order'] = array( $parent_menu_item_id => absint( $order ) ); |
|
| 1181 | 1181 | |
| 1182 | - $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true ); |
|
| 1182 | + $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true ); |
|
| 1183 | 1183 | |
| 1184 | - if ( is_array( $existing_settings ) ) { |
|
| 1184 | + if ( is_array( $existing_settings ) ) { |
|
| 1185 | 1185 | |
| 1186 | - $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 1186 | + $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 1187 | 1187 | |
| 1188 | - } |
|
| 1188 | + } |
|
| 1189 | 1189 | |
| 1190 | - update_post_meta( $menu_item_id, '_megamenu', $submitted_settings ); |
|
| 1190 | + update_post_meta( $menu_item_id, '_megamenu', $submitted_settings ); |
|
| 1191 | 1191 | |
| 1192 | - return true; |
|
| 1192 | + return true; |
|
| 1193 | 1193 | |
| 1194 | - } |
|
| 1194 | + } |
|
| 1195 | 1195 | |
| 1196 | 1196 | |
| 1197 | - /** |
|
| 1198 | - * Deletes a widget from WordPress |
|
| 1199 | - * |
|
| 1200 | - * @since 1.0 |
|
| 1201 | - * @param string $widget_id e.g. meta-3 |
|
| 1202 | - */ |
|
| 1203 | - public function delete_widget( $widget_id ) { |
|
| 1197 | + /** |
|
| 1198 | + * Deletes a widget from WordPress |
|
| 1199 | + * |
|
| 1200 | + * @since 1.0 |
|
| 1201 | + * @param string $widget_id e.g. meta-3 |
|
| 1202 | + */ |
|
| 1203 | + public function delete_widget( $widget_id ) { |
|
| 1204 | 1204 | |
| 1205 | - $this->remove_widget_from_sidebar( $widget_id ); |
|
| 1206 | - $this->remove_widget_instance( $widget_id ); |
|
| 1205 | + $this->remove_widget_from_sidebar( $widget_id ); |
|
| 1206 | + $this->remove_widget_instance( $widget_id ); |
|
| 1207 | 1207 | |
| 1208 | - do_action( 'megamenu_after_widget_delete' ); |
|
| 1208 | + do_action( 'megamenu_after_widget_delete' ); |
|
| 1209 | 1209 | |
| 1210 | - return true; |
|
| 1210 | + return true; |
|
| 1211 | 1211 | |
| 1212 | - } |
|
| 1212 | + } |
|
| 1213 | 1213 | |
| 1214 | 1214 | |
| 1215 | - /** |
|
| 1216 | - * Moves a widget from one position to another. |
|
| 1217 | - * |
|
| 1218 | - * @since 1.10 |
|
| 1219 | - * @param array $items |
|
| 1220 | - * @return string $widget_id. The widget that has been moved. |
|
| 1221 | - */ |
|
| 1222 | - public function reorder_items( $items ) { |
|
| 1215 | + /** |
|
| 1216 | + * Moves a widget from one position to another. |
|
| 1217 | + * |
|
| 1218 | + * @since 1.10 |
|
| 1219 | + * @param array $items |
|
| 1220 | + * @return string $widget_id. The widget that has been moved. |
|
| 1221 | + */ |
|
| 1222 | + public function reorder_items( $items ) { |
|
| 1223 | 1223 | |
| 1224 | - foreach ( $items as $item ) { |
|
| 1224 | + foreach ( $items as $item ) { |
|
| 1225 | 1225 | |
| 1226 | - if ( $item['parent_menu_item'] ) { |
|
| 1226 | + if ( $item['parent_menu_item'] ) { |
|
| 1227 | 1227 | |
| 1228 | - $submitted_settings = array( 'submenu_ordering' => 'forced' ); |
|
| 1228 | + $submitted_settings = array( 'submenu_ordering' => 'forced' ); |
|
| 1229 | 1229 | |
| 1230 | - $existing_settings = get_post_meta( $item['parent_menu_item'], '_megamenu', true ); |
|
| 1230 | + $existing_settings = get_post_meta( $item['parent_menu_item'], '_megamenu', true ); |
|
| 1231 | 1231 | |
| 1232 | - if ( is_array( $existing_settings ) ) { |
|
| 1232 | + if ( is_array( $existing_settings ) ) { |
|
| 1233 | 1233 | |
| 1234 | - $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 1234 | + $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 1235 | 1235 | |
| 1236 | - } |
|
| 1236 | + } |
|
| 1237 | 1237 | |
| 1238 | - update_post_meta( $item['parent_menu_item'], '_megamenu', $submitted_settings ); |
|
| 1239 | - } |
|
| 1238 | + update_post_meta( $item['parent_menu_item'], '_megamenu', $submitted_settings ); |
|
| 1239 | + } |
|
| 1240 | 1240 | |
| 1241 | - if ( $item['type'] == 'widget' ) { |
|
| 1241 | + if ( $item['type'] == 'widget' ) { |
|
| 1242 | 1242 | |
| 1243 | - $this->update_widget_order( $item['id'], $item['order'], $item['parent_menu_item'] ); |
|
| 1243 | + $this->update_widget_order( $item['id'], $item['order'], $item['parent_menu_item'] ); |
|
| 1244 | 1244 | |
| 1245 | - } |
|
| 1245 | + } |
|
| 1246 | 1246 | |
| 1247 | - if ( $item['type'] == 'menu_item' ) { |
|
| 1247 | + if ( $item['type'] == 'menu_item' ) { |
|
| 1248 | 1248 | |
| 1249 | - $this->update_menu_item_order( $item['id'], $item['order'], $item['parent_menu_item'] ); |
|
| 1249 | + $this->update_menu_item_order( $item['id'], $item['order'], $item['parent_menu_item'] ); |
|
| 1250 | 1250 | |
| 1251 | - } |
|
| 1252 | - } |
|
| 1251 | + } |
|
| 1252 | + } |
|
| 1253 | 1253 | |
| 1254 | - return true; |
|
| 1254 | + return true; |
|
| 1255 | 1255 | |
| 1256 | - } |
|
| 1256 | + } |
|
| 1257 | 1257 | |
| 1258 | 1258 | |
| 1259 | - /** |
|
| 1260 | - * Adds a widget to the Mega Menu widget sidebar |
|
| 1261 | - * |
|
| 1262 | - * @since 1.0 |
|
| 1263 | - */ |
|
| 1264 | - private function add_widget_to_sidebar( $id_base, $next_id ) { |
|
| 1259 | + /** |
|
| 1260 | + * Adds a widget to the Mega Menu widget sidebar |
|
| 1261 | + * |
|
| 1262 | + * @since 1.0 |
|
| 1263 | + */ |
|
| 1264 | + private function add_widget_to_sidebar( $id_base, $next_id ) { |
|
| 1265 | 1265 | |
| 1266 | - $widget_id = $id_base . '-' . $next_id; |
|
| 1266 | + $widget_id = $id_base . '-' . $next_id; |
|
| 1267 | 1267 | |
| 1268 | - $sidebar_widgets = $this->get_mega_menu_sidebar_widgets(); |
|
| 1268 | + $sidebar_widgets = $this->get_mega_menu_sidebar_widgets(); |
|
| 1269 | 1269 | |
| 1270 | - $sidebar_widgets[] = $widget_id; |
|
| 1270 | + $sidebar_widgets[] = $widget_id; |
|
| 1271 | 1271 | |
| 1272 | - $this->set_mega_menu_sidebar_widgets( $sidebar_widgets ); |
|
| 1272 | + $this->set_mega_menu_sidebar_widgets( $sidebar_widgets ); |
|
| 1273 | 1273 | |
| 1274 | - do_action( 'megamenu_after_widget_add' ); |
|
| 1274 | + do_action( 'megamenu_after_widget_add' ); |
|
| 1275 | 1275 | |
| 1276 | - return $widget_id; |
|
| 1276 | + return $widget_id; |
|
| 1277 | 1277 | |
| 1278 | - } |
|
| 1278 | + } |
|
| 1279 | 1279 | |
| 1280 | 1280 | |
| 1281 | - /** |
|
| 1282 | - * Removes a widget from the Mega Menu widget sidebar |
|
| 1283 | - * |
|
| 1284 | - * @since 1.0 |
|
| 1285 | - * @return string The widget that was removed |
|
| 1286 | - */ |
|
| 1287 | - private function remove_widget_from_sidebar( $widget_id ) { |
|
| 1281 | + /** |
|
| 1282 | + * Removes a widget from the Mega Menu widget sidebar |
|
| 1283 | + * |
|
| 1284 | + * @since 1.0 |
|
| 1285 | + * @return string The widget that was removed |
|
| 1286 | + */ |
|
| 1287 | + private function remove_widget_from_sidebar( $widget_id ) { |
|
| 1288 | 1288 | |
| 1289 | - $widgets = $this->get_mega_menu_sidebar_widgets(); |
|
| 1289 | + $widgets = $this->get_mega_menu_sidebar_widgets(); |
|
| 1290 | 1290 | |
| 1291 | - $new_mega_menu_widgets = array(); |
|
| 1291 | + $new_mega_menu_widgets = array(); |
|
| 1292 | 1292 | |
| 1293 | - foreach ( $widgets as $widget ) { |
|
| 1293 | + foreach ( $widgets as $widget ) { |
|
| 1294 | 1294 | |
| 1295 | - if ( $widget != $widget_id ) { |
|
| 1296 | - $new_mega_menu_widgets[] = $widget; |
|
| 1297 | - } |
|
| 1298 | - } |
|
| 1295 | + if ( $widget != $widget_id ) { |
|
| 1296 | + $new_mega_menu_widgets[] = $widget; |
|
| 1297 | + } |
|
| 1298 | + } |
|
| 1299 | 1299 | |
| 1300 | - $this->set_mega_menu_sidebar_widgets( $new_mega_menu_widgets ); |
|
| 1300 | + $this->set_mega_menu_sidebar_widgets( $new_mega_menu_widgets ); |
|
| 1301 | 1301 | |
| 1302 | - return $widget_id; |
|
| 1302 | + return $widget_id; |
|
| 1303 | 1303 | |
| 1304 | - } |
|
| 1304 | + } |
|
| 1305 | 1305 | |
| 1306 | 1306 | |
| 1307 | - /** |
|
| 1308 | - * Returns an unfiltered array of all widgets in our sidebar |
|
| 1309 | - * |
|
| 1310 | - * @since 1.0 |
|
| 1311 | - * @return array |
|
| 1312 | - */ |
|
| 1313 | - public function get_mega_menu_sidebar_widgets() { |
|
| 1307 | + /** |
|
| 1308 | + * Returns an unfiltered array of all widgets in our sidebar |
|
| 1309 | + * |
|
| 1310 | + * @since 1.0 |
|
| 1311 | + * @return array |
|
| 1312 | + */ |
|
| 1313 | + public function get_mega_menu_sidebar_widgets() { |
|
| 1314 | 1314 | |
| 1315 | - $sidebar_widgets = wp_get_sidebars_widgets(); |
|
| 1315 | + $sidebar_widgets = wp_get_sidebars_widgets(); |
|
| 1316 | 1316 | |
| 1317 | - if ( ! isset( $sidebar_widgets['mega-menu'] ) ) { |
|
| 1318 | - return false; |
|
| 1319 | - } |
|
| 1317 | + if ( ! isset( $sidebar_widgets['mega-menu'] ) ) { |
|
| 1318 | + return false; |
|
| 1319 | + } |
|
| 1320 | 1320 | |
| 1321 | - return $sidebar_widgets['mega-menu']; |
|
| 1321 | + return $sidebar_widgets['mega-menu']; |
|
| 1322 | 1322 | |
| 1323 | - } |
|
| 1323 | + } |
|
| 1324 | 1324 | |
| 1325 | 1325 | |
| 1326 | - /** |
|
| 1327 | - * Sets the sidebar widgets |
|
| 1328 | - * |
|
| 1329 | - * @since 1.0 |
|
| 1330 | - */ |
|
| 1331 | - private function set_mega_menu_sidebar_widgets( $widgets ) { |
|
| 1326 | + /** |
|
| 1327 | + * Sets the sidebar widgets |
|
| 1328 | + * |
|
| 1329 | + * @since 1.0 |
|
| 1330 | + */ |
|
| 1331 | + private function set_mega_menu_sidebar_widgets( $widgets ) { |
|
| 1332 | 1332 | |
| 1333 | - $sidebar_widgets = wp_get_sidebars_widgets(); |
|
| 1333 | + $sidebar_widgets = wp_get_sidebars_widgets(); |
|
| 1334 | 1334 | |
| 1335 | - $sidebar_widgets['mega-menu'] = $widgets; |
|
| 1335 | + $sidebar_widgets['mega-menu'] = $widgets; |
|
| 1336 | 1336 | |
| 1337 | - wp_set_sidebars_widgets( $sidebar_widgets ); |
|
| 1337 | + wp_set_sidebars_widgets( $sidebar_widgets ); |
|
| 1338 | 1338 | |
| 1339 | - } |
|
| 1339 | + } |
|
| 1340 | 1340 | |
| 1341 | 1341 | |
| 1342 | - /** |
|
| 1343 | - * Clear the cache when the Mega Menu is updated. |
|
| 1344 | - * |
|
| 1345 | - * @since 1.0 |
|
| 1346 | - */ |
|
| 1347 | - public function clear_caches() { |
|
| 1342 | + /** |
|
| 1343 | + * Clear the cache when the Mega Menu is updated. |
|
| 1344 | + * |
|
| 1345 | + * @since 1.0 |
|
| 1346 | + */ |
|
| 1347 | + public function clear_caches() { |
|
| 1348 | 1348 | |
| 1349 | - // https://wordpress.org/plugins/widget-output-cache/ |
|
| 1350 | - if ( function_exists( 'menu_output_cache_bump' ) ) { |
|
| 1351 | - menu_output_cache_bump(); |
|
| 1352 | - } |
|
| 1349 | + // https://wordpress.org/plugins/widget-output-cache/ |
|
| 1350 | + if ( function_exists( 'menu_output_cache_bump' ) ) { |
|
| 1351 | + menu_output_cache_bump(); |
|
| 1352 | + } |
|
| 1353 | 1353 | |
| 1354 | - // https://wordpress.org/plugins/widget-output-cache/ |
|
| 1355 | - if ( function_exists( 'widget_output_cache_bump' ) ) { |
|
| 1356 | - widget_output_cache_bump(); |
|
| 1357 | - } |
|
| 1354 | + // https://wordpress.org/plugins/widget-output-cache/ |
|
| 1355 | + if ( function_exists( 'widget_output_cache_bump' ) ) { |
|
| 1356 | + widget_output_cache_bump(); |
|
| 1357 | + } |
|
| 1358 | 1358 | |
| 1359 | - } |
|
| 1359 | + } |
|
| 1360 | 1360 | |
| 1361 | 1361 | |
| 1362 | - /** |
|
| 1363 | - * Send JSON response. |
|
| 1364 | - * |
|
| 1365 | - * Remove any warnings or output from other plugins which may corrupt the response |
|
| 1366 | - * |
|
| 1367 | - * @param string $json |
|
| 1368 | - * @since 1.8 |
|
| 1369 | - */ |
|
| 1370 | - public function send_json_success( $json ) { |
|
| 1371 | - if ( ob_get_contents() ) { |
|
| 1372 | - ob_clean(); |
|
| 1373 | - } |
|
| 1362 | + /** |
|
| 1363 | + * Send JSON response. |
|
| 1364 | + * |
|
| 1365 | + * Remove any warnings or output from other plugins which may corrupt the response |
|
| 1366 | + * |
|
| 1367 | + * @param string $json |
|
| 1368 | + * @since 1.8 |
|
| 1369 | + */ |
|
| 1370 | + public function send_json_success( $json ) { |
|
| 1371 | + if ( ob_get_contents() ) { |
|
| 1372 | + ob_clean(); |
|
| 1373 | + } |
|
| 1374 | 1374 | |
| 1375 | - wp_send_json_success( $json ); |
|
| 1376 | - } |
|
| 1375 | + wp_send_json_success( $json ); |
|
| 1376 | + } |
|
| 1377 | 1377 | |
| 1378 | 1378 | |
| 1379 | - /** |
|
| 1380 | - * Send JSON response. |
|
| 1381 | - * |
|
| 1382 | - * Remove any warnings or output from other plugins which may corrupt the response |
|
| 1383 | - * |
|
| 1384 | - * @param string $json |
|
| 1385 | - * @since 1.8 |
|
| 1386 | - */ |
|
| 1387 | - public function send_json_error( $json ) { |
|
| 1388 | - if ( ob_get_contents() ) { |
|
| 1389 | - ob_clean(); |
|
| 1390 | - } |
|
| 1379 | + /** |
|
| 1380 | + * Send JSON response. |
|
| 1381 | + * |
|
| 1382 | + * Remove any warnings or output from other plugins which may corrupt the response |
|
| 1383 | + * |
|
| 1384 | + * @param string $json |
|
| 1385 | + * @since 1.8 |
|
| 1386 | + */ |
|
| 1387 | + public function send_json_error( $json ) { |
|
| 1388 | + if ( ob_get_contents() ) { |
|
| 1389 | + ob_clean(); |
|
| 1390 | + } |
|
| 1391 | 1391 | |
| 1392 | - wp_send_json_error( $json ); |
|
| 1393 | - } |
|
| 1392 | + wp_send_json_error( $json ); |
|
| 1393 | + } |
|
| 1394 | 1394 | |
| 1395 | - } |
|
| 1395 | + } |
|
| 1396 | 1396 | |
| 1397 | 1397 | endif; |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | 4 | exit; // disable direct access |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if ( ! class_exists( 'Mega_Menu_Widget_Manager' ) ) : |
|
| 7 | +if (!class_exists('Mega_Menu_Widget_Manager')) : |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Processes AJAX requests from the Mega Menu panel editor. |
@@ -22,22 +22,22 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function __construct() { |
| 24 | 24 | |
| 25 | - add_action( 'wp_ajax_mm_edit_widget', array( $this, 'ajax_show_widget_form' ) ); |
|
| 26 | - add_action( 'wp_ajax_mm_edit_menu_item', array( $this, 'ajax_show_menu_item_form' ) ); |
|
| 27 | - add_action( 'wp_ajax_mm_save_widget', array( $this, 'ajax_save_widget' ) ); |
|
| 28 | - add_action( 'wp_ajax_mm_save_menu_item', array( $this, 'ajax_save_menu_item' ) ); |
|
| 29 | - add_action( 'wp_ajax_mm_update_widget_columns', array( $this, 'ajax_update_widget_columns' ) ); |
|
| 30 | - add_action( 'wp_ajax_mm_update_menu_item_columns', array( $this, 'ajax_update_menu_item_columns' ) ); |
|
| 31 | - add_action( 'wp_ajax_mm_delete_widget', array( $this, 'ajax_delete_widget' ) ); |
|
| 32 | - add_action( 'wp_ajax_mm_add_widget', array( $this, 'ajax_add_widget' ) ); |
|
| 33 | - add_action( 'wp_ajax_mm_reorder_items', array( $this, 'ajax_reorder_items' ) ); |
|
| 34 | - add_action( 'wp_ajax_mm_save_grid_data', array( $this, 'ajax_save_grid_data' ) ); |
|
| 25 | + add_action('wp_ajax_mm_edit_widget', array($this, 'ajax_show_widget_form')); |
|
| 26 | + add_action('wp_ajax_mm_edit_menu_item', array($this, 'ajax_show_menu_item_form')); |
|
| 27 | + add_action('wp_ajax_mm_save_widget', array($this, 'ajax_save_widget')); |
|
| 28 | + add_action('wp_ajax_mm_save_menu_item', array($this, 'ajax_save_menu_item')); |
|
| 29 | + add_action('wp_ajax_mm_update_widget_columns', array($this, 'ajax_update_widget_columns')); |
|
| 30 | + add_action('wp_ajax_mm_update_menu_item_columns', array($this, 'ajax_update_menu_item_columns')); |
|
| 31 | + add_action('wp_ajax_mm_delete_widget', array($this, 'ajax_delete_widget')); |
|
| 32 | + add_action('wp_ajax_mm_add_widget', array($this, 'ajax_add_widget')); |
|
| 33 | + add_action('wp_ajax_mm_reorder_items', array($this, 'ajax_reorder_items')); |
|
| 34 | + add_action('wp_ajax_mm_save_grid_data', array($this, 'ajax_save_grid_data')); |
|
| 35 | 35 | |
| 36 | - add_filter( 'widget_update_callback', array( $this, 'persist_mega_menu_widget_settings' ), 10, 4 ); |
|
| 36 | + add_filter('widget_update_callback', array($this, 'persist_mega_menu_widget_settings'), 10, 4); |
|
| 37 | 37 | |
| 38 | - add_action( 'megamenu_after_widget_add', array( $this, 'clear_caches' ) ); |
|
| 39 | - add_action( 'megamenu_after_widget_save', array( $this, 'clear_caches' ) ); |
|
| 40 | - add_action( 'megamenu_after_widget_delete', array( $this, 'clear_caches' ) ); |
|
| 38 | + add_action('megamenu_after_widget_add', array($this, 'clear_caches')); |
|
| 39 | + add_action('megamenu_after_widget_save', array($this, 'clear_caches')); |
|
| 40 | + add_action('megamenu_after_widget_delete', array($this, 'clear_caches')); |
|
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | |
@@ -49,17 +49,17 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @since 1.0 |
| 51 | 51 | */ |
| 52 | - public function persist_mega_menu_widget_settings( $instance, $new_instance, $old_instance, $that ) { |
|
| 52 | + public function persist_mega_menu_widget_settings($instance, $new_instance, $old_instance, $that) { |
|
| 53 | 53 | |
| 54 | - if ( isset( $old_instance['mega_menu_columns'] ) && ! isset( $new_instance['mega_menu_columns'] ) ) { |
|
| 54 | + if (isset($old_instance['mega_menu_columns']) && !isset($new_instance['mega_menu_columns'])) { |
|
| 55 | 55 | $instance['mega_menu_columns'] = $old_instance['mega_menu_columns']; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if ( isset( $old_instance['mega_menu_order'] ) && ! isset( $new_instance['mega_menu_order'] ) ) { |
|
| 58 | + if (isset($old_instance['mega_menu_order']) && !isset($new_instance['mega_menu_order'])) { |
|
| 59 | 59 | $instance['mega_menu_order'] = $old_instance['mega_menu_order']; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if ( isset( $old_instance['mega_menu_parent_menu_id'] ) && ! isset( $new_instance['mega_menu_parent_menu_id'] ) ) { |
|
| 62 | + if (isset($old_instance['mega_menu_parent_menu_id']) && !isset($new_instance['mega_menu_parent_menu_id'])) { |
|
| 63 | 63 | $instance['mega_menu_parent_menu_id'] = $old_instance['mega_menu_parent_menu_id']; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -74,21 +74,21 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function ajax_show_widget_form() { |
| 76 | 76 | |
| 77 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 77 | + check_ajax_referer('megamenu_edit'); |
|
| 78 | 78 | |
| 79 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 79 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 80 | 80 | |
| 81 | - if ( ! current_user_can( $capability ) ) { |
|
| 81 | + if (!current_user_can($capability)) { |
|
| 82 | 82 | return; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $widget_id = sanitize_text_field( $_POST['widget_id'] ); |
|
| 85 | + $widget_id = sanitize_text_field($_POST['widget_id']); |
|
| 86 | 86 | |
| 87 | - if ( ob_get_contents() ) { |
|
| 87 | + if (ob_get_contents()) { |
|
| 88 | 88 | ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - wp_die( trim( $this->show_widget_form( $widget_id ) ) ); |
|
| 91 | + wp_die(trim($this->show_widget_form($widget_id))); |
|
| 92 | 92 | |
| 93 | 93 | } |
| 94 | 94 | |
@@ -99,39 +99,39 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function ajax_show_menu_item_form() { |
| 101 | 101 | |
| 102 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 102 | + check_ajax_referer('megamenu_edit'); |
|
| 103 | 103 | |
| 104 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 104 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 105 | 105 | |
| 106 | - if ( ! current_user_can( $capability ) ) { |
|
| 106 | + if (!current_user_can($capability)) { |
|
| 107 | 107 | return; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $menu_item_id = sanitize_text_field( $_POST['widget_id'] ); |
|
| 110 | + $menu_item_id = sanitize_text_field($_POST['widget_id']); |
|
| 111 | 111 | |
| 112 | - $nonce = wp_create_nonce( 'megamenu_save_menu_item_' . $menu_item_id ); |
|
| 112 | + $nonce = wp_create_nonce('megamenu_save_menu_item_' . $menu_item_id); |
|
| 113 | 113 | |
| 114 | - $saved_settings = array_filter( (array) get_post_meta( $menu_item_id, '_megamenu', true ) ); |
|
| 115 | - $menu_item_meta = array_merge( Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings ); |
|
| 114 | + $saved_settings = array_filter((array) get_post_meta($menu_item_id, '_megamenu', true)); |
|
| 115 | + $menu_item_meta = array_merge(Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings); |
|
| 116 | 116 | |
| 117 | - if ( ob_get_contents() ) { |
|
| 117 | + if (ob_get_contents()) { |
|
| 118 | 118 | ob_clean(); // remove any warnings or output from other plugins which may corrupt the response |
| 119 | 119 | } |
| 120 | 120 | ?> |
| 121 | 121 | |
| 122 | 122 | <form method='post'> |
| 123 | 123 | <input type='hidden' name='action' value='mm_save_menu_item' /> |
| 124 | - <input type='hidden' name='menu_item_id' value='<?php echo esc_attr( $menu_item_id ); ?>' /> |
|
| 125 | - <input type='hidden' name='_wpnonce' value='<?php echo esc_attr( $nonce ); ?>' /> |
|
| 124 | + <input type='hidden' name='menu_item_id' value='<?php echo esc_attr($menu_item_id); ?>' /> |
|
| 125 | + <input type='hidden' name='_wpnonce' value='<?php echo esc_attr($nonce); ?>' /> |
|
| 126 | 126 | <div class='widget-content'> |
| 127 | 127 | <?php |
| 128 | 128 | |
| 129 | - $css_version = get_transient( 'megamenu_css_version' ); |
|
| 129 | + $css_version = get_transient('megamenu_css_version'); |
|
| 130 | 130 | |
| 131 | - if ( $css_version && version_compare( $css_version, '2.6.1', '<' ) ) { |
|
| 132 | - $link = "<a href='" . esc_attr( admin_url( 'admin.php?page=maxmegamenu_tools' ) ) . "'>" . __( 'Mega Menu' ) . ' > ' . __( 'Tools' ) . '</a>'; |
|
| 131 | + if ($css_version && version_compare($css_version, '2.6.1', '<')) { |
|
| 132 | + $link = "<a href='" . esc_attr(admin_url('admin.php?page=maxmegamenu_tools')) . "'>" . __('Mega Menu') . ' > ' . __('Tools') . '</a>'; |
|
| 133 | 133 | $notice = "<div class='notice notice-success'><p>"; |
| 134 | - $notice .= sprintf( __( 'Your menu CSS needs to be updated before you can use the following setting. Please go to %s and Clear the CSS Cache (you will only need to do this once).', 'megamenu' ), $link ); |
|
| 134 | + $notice .= sprintf(__('Your menu CSS needs to be updated before you can use the following setting. Please go to %s and Clear the CSS Cache (you will only need to do this once).', 'megamenu'), $link); |
|
| 135 | 135 | $notice .= '</p></div>'; |
| 136 | 136 | $notice .= '</div>'; |
| 137 | 137 | |
@@ -141,24 +141,24 @@ discard block |
||
| 141 | 141 | ?> |
| 142 | 142 | |
| 143 | 143 | <p> |
| 144 | - <label><?php _e( 'Sub menu columns', 'megamenu' ); ?></label> |
|
| 144 | + <label><?php _e('Sub menu columns', 'megamenu'); ?></label> |
|
| 145 | 145 | |
| 146 | 146 | <select name="settings[submenu_columns]"> |
| 147 | - <option value='1' <?php selected( $menu_item_meta['submenu_columns'], 1, true ); ?> >1 <?php __( 'column', 'megamenu' ); ?></option> |
|
| 148 | - <option value='2' <?php selected( $menu_item_meta['submenu_columns'], 2, true ); ?> >2 <?php __( 'columns', 'megamenu' ); ?></option> |
|
| 149 | - <option value='3' <?php selected( $menu_item_meta['submenu_columns'], 3, true ); ?> >3 <?php __( 'columns', 'megamenu' ); ?></option> |
|
| 150 | - <option value='4' <?php selected( $menu_item_meta['submenu_columns'], 4, true ); ?> >4 <?php __( 'columns', 'megamenu' ); ?></option> |
|
| 151 | - <option value='5' <?php selected( $menu_item_meta['submenu_columns'], 5, true ); ?> >5 <?php __( 'columns', 'megamenu' ); ?></option> |
|
| 152 | - <option value='6' <?php selected( $menu_item_meta['submenu_columns'], 6, true ); ?> >6 <?php __( 'columns', 'megamenu' ); ?></option> |
|
| 147 | + <option value='1' <?php selected($menu_item_meta['submenu_columns'], 1, true); ?> >1 <?php __('column', 'megamenu'); ?></option> |
|
| 148 | + <option value='2' <?php selected($menu_item_meta['submenu_columns'], 2, true); ?> >2 <?php __('columns', 'megamenu'); ?></option> |
|
| 149 | + <option value='3' <?php selected($menu_item_meta['submenu_columns'], 3, true); ?> >3 <?php __('columns', 'megamenu'); ?></option> |
|
| 150 | + <option value='4' <?php selected($menu_item_meta['submenu_columns'], 4, true); ?> >4 <?php __('columns', 'megamenu'); ?></option> |
|
| 151 | + <option value='5' <?php selected($menu_item_meta['submenu_columns'], 5, true); ?> >5 <?php __('columns', 'megamenu'); ?></option> |
|
| 152 | + <option value='6' <?php selected($menu_item_meta['submenu_columns'], 6, true); ?> >6 <?php __('columns', 'megamenu'); ?></option> |
|
| 153 | 153 | </select> |
| 154 | 154 | </p> |
| 155 | 155 | <p> |
| 156 | 156 | <div class='widget-controls'> |
| 157 | - <a class='close' href='#close'><?php _e( 'Close', 'megamenu' ); ?></a> |
|
| 157 | + <a class='close' href='#close'><?php _e('Close', 'megamenu'); ?></a> |
|
| 158 | 158 | </div> |
| 159 | 159 | |
| 160 | 160 | <?php |
| 161 | - submit_button( __( 'Save' ), 'button-primary alignright', 'savewidget', false ); |
|
| 161 | + submit_button(__('Save'), 'button-primary alignright', 'savewidget', false); |
|
| 162 | 162 | ?> |
| 163 | 163 | </p> |
| 164 | 164 | </div> |
@@ -175,30 +175,30 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function ajax_save_menu_item() { |
| 177 | 177 | |
| 178 | - $menu_item_id = absint( sanitize_text_field( $_POST['menu_item_id'] ) ); |
|
| 178 | + $menu_item_id = absint(sanitize_text_field($_POST['menu_item_id'])); |
|
| 179 | 179 | |
| 180 | - check_ajax_referer( 'megamenu_save_menu_item_' . $menu_item_id ); |
|
| 180 | + check_ajax_referer('megamenu_save_menu_item_' . $menu_item_id); |
|
| 181 | 181 | |
| 182 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 182 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 183 | 183 | |
| 184 | - if ( ! current_user_can( $capability ) ) { |
|
| 184 | + if (!current_user_can($capability)) { |
|
| 185 | 185 | return; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - $submitted_settings = isset( $_POST['settings'] ) ? $_POST['settings'] : array(); |
|
| 188 | + $submitted_settings = isset($_POST['settings']) ? $_POST['settings'] : array(); |
|
| 189 | 189 | |
| 190 | - if ( $menu_item_id > 0 && is_array( $submitted_settings ) ) { |
|
| 190 | + if ($menu_item_id > 0 && is_array($submitted_settings)) { |
|
| 191 | 191 | |
| 192 | - $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true ); |
|
| 192 | + $existing_settings = get_post_meta($menu_item_id, '_megamenu', true); |
|
| 193 | 193 | |
| 194 | - if ( is_array( $existing_settings ) ) { |
|
| 195 | - $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 194 | + if (is_array($existing_settings)) { |
|
| 195 | + $submitted_settings = array_merge($existing_settings, $submitted_settings); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - update_post_meta( $menu_item_id, '_megamenu', $submitted_settings ); |
|
| 198 | + update_post_meta($menu_item_id, '_megamenu', $submitted_settings); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - $this->send_json_success( sprintf( __( 'Saved %s', 'megamenu' ), $id_base ) ); |
|
| 201 | + $this->send_json_success(sprintf(__('Saved %s', 'megamenu'), $id_base)); |
|
| 202 | 202 | |
| 203 | 203 | } |
| 204 | 204 | |
@@ -210,23 +210,23 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public function ajax_save_widget() { |
| 212 | 212 | |
| 213 | - $widget_id = sanitize_text_field( $_POST['widget_id'] ); |
|
| 214 | - $id_base = sanitize_text_field( $_POST['id_base'] ); |
|
| 213 | + $widget_id = sanitize_text_field($_POST['widget_id']); |
|
| 214 | + $id_base = sanitize_text_field($_POST['id_base']); |
|
| 215 | 215 | |
| 216 | - check_ajax_referer( 'megamenu_save_widget_' . $widget_id ); |
|
| 216 | + check_ajax_referer('megamenu_save_widget_' . $widget_id); |
|
| 217 | 217 | |
| 218 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 218 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 219 | 219 | |
| 220 | - if ( ! current_user_can( $capability ) ) { |
|
| 220 | + if (!current_user_can($capability)) { |
|
| 221 | 221 | return; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - $saved = $this->save_widget( $id_base ); |
|
| 224 | + $saved = $this->save_widget($id_base); |
|
| 225 | 225 | |
| 226 | - if ( $saved ) { |
|
| 227 | - $this->send_json_success( sprintf( __( 'Saved %s', 'megamenu' ), $id_base ) ); |
|
| 226 | + if ($saved) { |
|
| 227 | + $this->send_json_success(sprintf(__('Saved %s', 'megamenu'), $id_base)); |
|
| 228 | 228 | } else { |
| 229 | - $this->send_json_error( sprintf( __( 'Failed to save %s', 'megamenu' ), $id_base ) ); |
|
| 229 | + $this->send_json_error(sprintf(__('Failed to save %s', 'megamenu'), $id_base)); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | } |
@@ -239,23 +239,23 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | public function ajax_update_widget_columns() { |
| 241 | 241 | |
| 242 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 242 | + check_ajax_referer('megamenu_edit'); |
|
| 243 | 243 | |
| 244 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 244 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 245 | 245 | |
| 246 | - if ( ! current_user_can( $capability ) ) { |
|
| 246 | + if (!current_user_can($capability)) { |
|
| 247 | 247 | return; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - $widget_id = sanitize_text_field( $_POST['id'] ); |
|
| 251 | - $columns = absint( $_POST['columns'] ); |
|
| 250 | + $widget_id = sanitize_text_field($_POST['id']); |
|
| 251 | + $columns = absint($_POST['columns']); |
|
| 252 | 252 | |
| 253 | - $updated = $this->update_widget_columns( $widget_id, $columns ); |
|
| 253 | + $updated = $this->update_widget_columns($widget_id, $columns); |
|
| 254 | 254 | |
| 255 | - if ( $updated ) { |
|
| 256 | - $this->send_json_success( sprintf( __( 'Updated %1$s (new columns: %2$d)', 'megamenu' ), $widget_id, $columns ) ); |
|
| 255 | + if ($updated) { |
|
| 256 | + $this->send_json_success(sprintf(__('Updated %1$s (new columns: %2$d)', 'megamenu'), $widget_id, $columns)); |
|
| 257 | 257 | } else { |
| 258 | - $this->send_json_error( sprintf( __( 'Failed to update %s', 'megamenu' ), $widget_id ) ); |
|
| 258 | + $this->send_json_error(sprintf(__('Failed to update %s', 'megamenu'), $widget_id)); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | } |
@@ -268,23 +268,23 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | public function ajax_update_menu_item_columns() { |
| 270 | 270 | |
| 271 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 271 | + check_ajax_referer('megamenu_edit'); |
|
| 272 | 272 | |
| 273 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 273 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 274 | 274 | |
| 275 | - if ( ! current_user_can( $capability ) ) { |
|
| 275 | + if (!current_user_can($capability)) { |
|
| 276 | 276 | return; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - $id = absint( $_POST['id'] ); |
|
| 280 | - $columns = absint( $_POST['columns'] ); |
|
| 279 | + $id = absint($_POST['id']); |
|
| 280 | + $columns = absint($_POST['columns']); |
|
| 281 | 281 | |
| 282 | - $updated = $this->update_menu_item_columns( $id, $columns ); |
|
| 282 | + $updated = $this->update_menu_item_columns($id, $columns); |
|
| 283 | 283 | |
| 284 | - if ( $updated ) { |
|
| 285 | - $this->send_json_success( sprintf( __( 'Updated %1$s (new columns: %2$d)', 'megamenu' ), $id, $columns ) ); |
|
| 284 | + if ($updated) { |
|
| 285 | + $this->send_json_success(sprintf(__('Updated %1$s (new columns: %2$d)', 'megamenu'), $id, $columns)); |
|
| 286 | 286 | } else { |
| 287 | - $this->send_json_error( sprintf( __( 'Failed to update %s', 'megamenu' ), $id ) ); |
|
| 287 | + $this->send_json_error(sprintf(__('Failed to update %s', 'megamenu'), $id)); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | } |
@@ -297,25 +297,25 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | public function ajax_add_widget() { |
| 299 | 299 | |
| 300 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 300 | + check_ajax_referer('megamenu_edit'); |
|
| 301 | 301 | |
| 302 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 302 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 303 | 303 | |
| 304 | - if ( ! current_user_can( $capability ) ) { |
|
| 304 | + if (!current_user_can($capability)) { |
|
| 305 | 305 | return; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - $id_base = sanitize_text_field( $_POST['id_base'] ); |
|
| 309 | - $menu_item_id = absint( $_POST['menu_item_id'] ); |
|
| 310 | - $title = sanitize_text_field( $_POST['title'] ); |
|
| 311 | - $is_grid_widget = isset( $_POST['is_grid_widget'] ) && $_POST['is_grid_widget'] == 'true'; |
|
| 308 | + $id_base = sanitize_text_field($_POST['id_base']); |
|
| 309 | + $menu_item_id = absint($_POST['menu_item_id']); |
|
| 310 | + $title = sanitize_text_field($_POST['title']); |
|
| 311 | + $is_grid_widget = isset($_POST['is_grid_widget']) && $_POST['is_grid_widget'] == 'true'; |
|
| 312 | 312 | |
| 313 | - $added = $this->add_widget( $id_base, $menu_item_id, $title, $is_grid_widget ); |
|
| 313 | + $added = $this->add_widget($id_base, $menu_item_id, $title, $is_grid_widget); |
|
| 314 | 314 | |
| 315 | - if ( $added ) { |
|
| 316 | - $this->send_json_success( $added ); |
|
| 315 | + if ($added) { |
|
| 316 | + $this->send_json_success($added); |
|
| 317 | 317 | } else { |
| 318 | - $this->send_json_error( sprintf( __( 'Failed to add %1$s to %2$d', 'megamenu' ), $id_base, $menu_item_id ) ); |
|
| 318 | + $this->send_json_error(sprintf(__('Failed to add %1$s to %2$d', 'megamenu'), $id_base, $menu_item_id)); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | } |
@@ -328,22 +328,22 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function ajax_delete_widget() { |
| 330 | 330 | |
| 331 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 331 | + check_ajax_referer('megamenu_edit'); |
|
| 332 | 332 | |
| 333 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 333 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 334 | 334 | |
| 335 | - if ( ! current_user_can( $capability ) ) { |
|
| 335 | + if (!current_user_can($capability)) { |
|
| 336 | 336 | return; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - $widget_id = sanitize_text_field( $_POST['widget_id'] ); |
|
| 339 | + $widget_id = sanitize_text_field($_POST['widget_id']); |
|
| 340 | 340 | |
| 341 | - $deleted = $this->delete_widget( $widget_id ); |
|
| 341 | + $deleted = $this->delete_widget($widget_id); |
|
| 342 | 342 | |
| 343 | - if ( $deleted ) { |
|
| 344 | - $this->send_json_success( sprintf( __( 'Deleted %s', 'megamenu' ), $widget_id ) ); |
|
| 343 | + if ($deleted) { |
|
| 344 | + $this->send_json_success(sprintf(__('Deleted %s', 'megamenu'), $widget_id)); |
|
| 345 | 345 | } else { |
| 346 | - $this->send_json_error( sprintf( __( 'Failed to delete %s', 'megamenu' ), $widget_id ) ); |
|
| 346 | + $this->send_json_error(sprintf(__('Failed to delete %s', 'megamenu'), $widget_id)); |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | } |
@@ -356,26 +356,26 @@ discard block |
||
| 356 | 356 | */ |
| 357 | 357 | public function ajax_reorder_items() { |
| 358 | 358 | |
| 359 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 359 | + check_ajax_referer('megamenu_edit'); |
|
| 360 | 360 | |
| 361 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 361 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 362 | 362 | |
| 363 | - if ( ! current_user_can( $capability ) ) { |
|
| 363 | + if (!current_user_can($capability)) { |
|
| 364 | 364 | return; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - $items = isset( $_POST['items'] ) ? $_POST['items'] : false; |
|
| 367 | + $items = isset($_POST['items']) ? $_POST['items'] : false; |
|
| 368 | 368 | |
| 369 | 369 | $saved = false; |
| 370 | 370 | |
| 371 | - if ( $items ) { |
|
| 372 | - $moved = $this->reorder_items( $items ); |
|
| 371 | + if ($items) { |
|
| 372 | + $moved = $this->reorder_items($items); |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - if ( $moved ) { |
|
| 376 | - $this->send_json_success( sprintf( __( 'Moved (%s)', 'megamenu' ), json_encode( $items ) ) ); |
|
| 375 | + if ($moved) { |
|
| 376 | + $this->send_json_success(sprintf(__('Moved (%s)', 'megamenu'), json_encode($items))); |
|
| 377 | 377 | } else { |
| 378 | - $this->send_json_error( sprintf( __( "Didn't move items", 'megamenu' ), json_encode( $items ) ) ); |
|
| 378 | + $this->send_json_error(sprintf(__("Didn't move items", 'megamenu'), json_encode($items))); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | } |
@@ -387,33 +387,33 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | public function ajax_save_grid_data() { |
| 389 | 389 | |
| 390 | - check_ajax_referer( 'megamenu_edit' ); |
|
| 390 | + check_ajax_referer('megamenu_edit'); |
|
| 391 | 391 | |
| 392 | - $capability = apply_filters( 'megamenu_options_capability', 'edit_theme_options' ); |
|
| 392 | + $capability = apply_filters('megamenu_options_capability', 'edit_theme_options'); |
|
| 393 | 393 | |
| 394 | - if ( ! current_user_can( $capability ) ) { |
|
| 394 | + if (!current_user_can($capability)) { |
|
| 395 | 395 | return; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - $grid = isset( $_POST['grid'] ) ? $_POST['grid'] : false; |
|
| 399 | - $parent_menu_item_id = absint( $_POST['parent_menu_item'] ); |
|
| 398 | + $grid = isset($_POST['grid']) ? $_POST['grid'] : false; |
|
| 399 | + $parent_menu_item_id = absint($_POST['parent_menu_item']); |
|
| 400 | 400 | |
| 401 | 401 | $saved = true; |
| 402 | 402 | |
| 403 | - $existing_settings = get_post_meta( $parent_menu_item_id, '_megamenu', true ); |
|
| 403 | + $existing_settings = get_post_meta($parent_menu_item_id, '_megamenu', true); |
|
| 404 | 404 | |
| 405 | - if ( is_array( $grid ) ) { |
|
| 405 | + if (is_array($grid)) { |
|
| 406 | 406 | |
| 407 | - $submitted_settings = array_merge( $existing_settings, array( 'grid' => $grid ) ); |
|
| 407 | + $submitted_settings = array_merge($existing_settings, array('grid' => $grid)); |
|
| 408 | 408 | |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - update_post_meta( $parent_menu_item_id, '_megamenu', $submitted_settings ); |
|
| 411 | + update_post_meta($parent_menu_item_id, '_megamenu', $submitted_settings); |
|
| 412 | 412 | |
| 413 | - if ( $saved ) { |
|
| 414 | - $this->send_json_success( sprintf( __( 'Saved (%s)', 'megamenu' ), json_encode( $grid ) ) ); |
|
| 413 | + if ($saved) { |
|
| 414 | + $this->send_json_success(sprintf(__('Saved (%s)', 'megamenu'), json_encode($grid))); |
|
| 415 | 415 | } else { |
| 416 | - $this->send_json_error( sprintf( __( "Didn't save", 'megamenu' ), json_encode( $grid ) ) ); |
|
| 416 | + $this->send_json_error(sprintf(__("Didn't save", 'megamenu'), json_encode($grid))); |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | } |
@@ -429,13 +429,13 @@ discard block |
||
| 429 | 429 | |
| 430 | 430 | $widgets = array(); |
| 431 | 431 | |
| 432 | - foreach ( $wp_widget_factory->widgets as $widget ) { |
|
| 432 | + foreach ($wp_widget_factory->widgets as $widget) { |
|
| 433 | 433 | |
| 434 | - $disabled_widgets = array( 'maxmegamenu' ); |
|
| 434 | + $disabled_widgets = array('maxmegamenu'); |
|
| 435 | 435 | |
| 436 | - $disabled_widgets = apply_filters( 'megamenu_incompatible_widgets', $disabled_widgets ); |
|
| 436 | + $disabled_widgets = apply_filters('megamenu_incompatible_widgets', $disabled_widgets); |
|
| 437 | 437 | |
| 438 | - if ( ! in_array( $widget->id_base, $disabled_widgets ) ) { |
|
| 438 | + if (!in_array($widget->id_base, $disabled_widgets)) { |
|
| 439 | 439 | |
| 440 | 440 | $widgets[] = array( |
| 441 | 441 | 'text' => $widget->name, |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - uasort( $widgets, array( $this, 'sort_by_text' ) ); |
|
| 448 | + uasort($widgets, array($this, 'sort_by_text')); |
|
| 449 | 449 | |
| 450 | 450 | return $widgets; |
| 451 | 451 | |
@@ -459,8 +459,8 @@ discard block |
||
| 459 | 459 | * @param array $a |
| 460 | 460 | * @param array $b |
| 461 | 461 | */ |
| 462 | - function sort_by_text( $a, $b ) { |
|
| 463 | - return strcmp( $a['text'], $b['text'] ); |
|
| 462 | + function sort_by_text($a, $b) { |
|
| 463 | + return strcmp($a['text'], $b['text']); |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | |
@@ -471,12 +471,12 @@ discard block |
||
| 471 | 471 | * @param array $a |
| 472 | 472 | * @param array $b |
| 473 | 473 | */ |
| 474 | - function sort_by_order( $a, $b ) { |
|
| 475 | - if ( $a['order'] == $b['order'] ) { |
|
| 474 | + function sort_by_order($a, $b) { |
|
| 475 | + if ($a['order'] == $b['order']) { |
|
| 476 | 476 | return 1; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | - return ( $a['order'] < $b['order'] ) ? -1 : 1; |
|
| 479 | + return ($a['order'] < $b['order']) ? -1 : 1; |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | |
@@ -486,36 +486,36 @@ discard block |
||
| 486 | 486 | * @since 1.5 |
| 487 | 487 | * @return array |
| 488 | 488 | */ |
| 489 | - private function get_second_level_menu_items( $parent_menu_item_id, $menu_id, $menu_items = false ) { |
|
| 489 | + private function get_second_level_menu_items($parent_menu_item_id, $menu_id, $menu_items = false) { |
|
| 490 | 490 | |
| 491 | 491 | $second_level_items = array(); |
| 492 | 492 | |
| 493 | 493 | // check we're using a valid menu ID |
| 494 | - if ( ! is_nav_menu( $menu_id ) ) { |
|
| 494 | + if (!is_nav_menu($menu_id)) { |
|
| 495 | 495 | return $second_level_items; |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | - if ( ! $menu_items ) { |
|
| 499 | - $menu_items = wp_get_nav_menu_items( $menu_id ); |
|
| 498 | + if (!$menu_items) { |
|
| 499 | + $menu_items = wp_get_nav_menu_items($menu_id); |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - if ( count( $menu_items ) ) { |
|
| 502 | + if (count($menu_items)) { |
|
| 503 | 503 | |
| 504 | - foreach ( $menu_items as $item ) { |
|
| 504 | + foreach ($menu_items as $item) { |
|
| 505 | 505 | |
| 506 | 506 | // find the child menu items |
| 507 | - if ( $item->menu_item_parent == $parent_menu_item_id ) { |
|
| 507 | + if ($item->menu_item_parent == $parent_menu_item_id) { |
|
| 508 | 508 | |
| 509 | - $saved_settings = array_filter( (array) get_post_meta( $item->ID, '_megamenu', true ) ); |
|
| 509 | + $saved_settings = array_filter((array) get_post_meta($item->ID, '_megamenu', true)); |
|
| 510 | 510 | |
| 511 | - $settings = array_merge( Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings ); |
|
| 511 | + $settings = array_merge(Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings); |
|
| 512 | 512 | |
| 513 | - $second_level_items[ $item->ID ] = array( |
|
| 513 | + $second_level_items[$item->ID] = array( |
|
| 514 | 514 | 'id' => $item->ID, |
| 515 | 515 | 'type' => 'menu_item', |
| 516 | 516 | 'title' => $item->title, |
| 517 | 517 | 'columns' => $settings['mega_menu_columns'], |
| 518 | - 'order' => isset( $settings['mega_menu_order'][ $parent_menu_item_id ] ) ? $settings['mega_menu_order'][ $parent_menu_item_id ] : 0, |
|
| 518 | + 'order' => isset($settings['mega_menu_order'][$parent_menu_item_id]) ? $settings['mega_menu_order'][$parent_menu_item_id] : 0, |
|
| 519 | 519 | ); |
| 520 | 520 | |
| 521 | 521 | } |
@@ -531,26 +531,26 @@ discard block |
||
| 531 | 531 | * @since 1.0 |
| 532 | 532 | * @param int $menu_item_id |
| 533 | 533 | */ |
| 534 | - public function get_widgets_for_menu_id( $parent_menu_item_id, $menu_id ) { |
|
| 534 | + public function get_widgets_for_menu_id($parent_menu_item_id, $menu_id) { |
|
| 535 | 535 | |
| 536 | 536 | $widgets = array(); |
| 537 | 537 | |
| 538 | - if ( $mega_menu_widgets = $this->get_mega_menu_sidebar_widgets() ) { |
|
| 538 | + if ($mega_menu_widgets = $this->get_mega_menu_sidebar_widgets()) { |
|
| 539 | 539 | |
| 540 | - foreach ( $mega_menu_widgets as $widget_id ) { |
|
| 540 | + foreach ($mega_menu_widgets as $widget_id) { |
|
| 541 | 541 | |
| 542 | - $settings = $this->get_settings_for_widget_id( $widget_id ); |
|
| 542 | + $settings = $this->get_settings_for_widget_id($widget_id); |
|
| 543 | 543 | |
| 544 | - if ( ! isset( $settings['mega_menu_is_grid_widget'] ) && isset( $settings['mega_menu_parent_menu_id'] ) && $settings['mega_menu_parent_menu_id'] == $parent_menu_item_id ) { |
|
| 544 | + if (!isset($settings['mega_menu_is_grid_widget']) && isset($settings['mega_menu_parent_menu_id']) && $settings['mega_menu_parent_menu_id'] == $parent_menu_item_id) { |
|
| 545 | 545 | |
| 546 | - $name = $this->get_name_for_widget_id( $widget_id ); |
|
| 546 | + $name = $this->get_name_for_widget_id($widget_id); |
|
| 547 | 547 | |
| 548 | - $widgets[ $widget_id ] = array( |
|
| 548 | + $widgets[$widget_id] = array( |
|
| 549 | 549 | 'id' => $widget_id, |
| 550 | 550 | 'type' => 'widget', |
| 551 | 551 | 'title' => $name, |
| 552 | 552 | 'columns' => $settings['mega_menu_columns'], |
| 553 | - 'order' => isset( $settings['mega_menu_order'][ $parent_menu_item_id ] ) ? $settings['mega_menu_order'][ $parent_menu_item_id ] : 0, |
|
| 553 | + 'order' => isset($settings['mega_menu_order'][$parent_menu_item_id]) ? $settings['mega_menu_order'][$parent_menu_item_id] : 0, |
|
| 554 | 554 | ); |
| 555 | 555 | |
| 556 | 556 | } |
@@ -571,33 +571,33 @@ discard block |
||
| 571 | 571 | * @param int $menu_id |
| 572 | 572 | * @return array |
| 573 | 573 | */ |
| 574 | - public function get_widgets_and_menu_items_for_menu_id( $parent_menu_item_id, $menu_id ) { |
|
| 574 | + public function get_widgets_and_menu_items_for_menu_id($parent_menu_item_id, $menu_id) { |
|
| 575 | 575 | |
| 576 | - $menu_items = $this->get_second_level_menu_items( $parent_menu_item_id, $menu_id ); |
|
| 576 | + $menu_items = $this->get_second_level_menu_items($parent_menu_item_id, $menu_id); |
|
| 577 | 577 | |
| 578 | - $widgets = $this->get_widgets_for_menu_id( $parent_menu_item_id, $menu_id ); |
|
| 578 | + $widgets = $this->get_widgets_for_menu_id($parent_menu_item_id, $menu_id); |
|
| 579 | 579 | |
| 580 | - $items = array_merge( $menu_items, $widgets ); |
|
| 580 | + $items = array_merge($menu_items, $widgets); |
|
| 581 | 581 | |
| 582 | - $parent_settings = get_post_meta( $parent_menu_item_id, '_megamenu', true ); |
|
| 582 | + $parent_settings = get_post_meta($parent_menu_item_id, '_megamenu', true); |
|
| 583 | 583 | |
| 584 | - $ordering = isset( $parent_settings['submenu_ordering'] ) ? $parent_settings['submenu_ordering'] : 'natural'; |
|
| 584 | + $ordering = isset($parent_settings['submenu_ordering']) ? $parent_settings['submenu_ordering'] : 'natural'; |
|
| 585 | 585 | |
| 586 | - if ( $ordering == 'forced' ) { |
|
| 586 | + if ($ordering == 'forced') { |
|
| 587 | 587 | |
| 588 | - uasort( $items, array( $this, 'sort_by_order' ) ); |
|
| 588 | + uasort($items, array($this, 'sort_by_order')); |
|
| 589 | 589 | |
| 590 | 590 | $new_items = $items; |
| 591 | 591 | $end_items = array(); |
| 592 | 592 | |
| 593 | - foreach ( $items as $key => $value ) { |
|
| 594 | - if ( $value['order'] == 0 ) { |
|
| 595 | - unset( $new_items[ $key ] ); |
|
| 593 | + foreach ($items as $key => $value) { |
|
| 594 | + if ($value['order'] == 0) { |
|
| 595 | + unset($new_items[$key]); |
|
| 596 | 596 | $end_items[] = $value; |
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - $items = array_merge( $new_items, $end_items ); |
|
| 600 | + $items = array_merge($new_items, $end_items); |
|
| 601 | 601 | |
| 602 | 602 | } |
| 603 | 603 | |
@@ -612,18 +612,18 @@ discard block |
||
| 612 | 612 | * @since 2.4 |
| 613 | 613 | * @return array |
| 614 | 614 | */ |
| 615 | - public function get_grid_widgets_and_menu_items_for_menu_id( $parent_menu_item_id, $menu_id, $menu_items = false ) { |
|
| 615 | + public function get_grid_widgets_and_menu_items_for_menu_id($parent_menu_item_id, $menu_id, $menu_items = false) { |
|
| 616 | 616 | |
| 617 | - $meta = get_post_meta( $parent_menu_item_id, '_megamenu', true ); |
|
| 617 | + $meta = get_post_meta($parent_menu_item_id, '_megamenu', true); |
|
| 618 | 618 | |
| 619 | 619 | $saved_grid = array(); |
| 620 | 620 | |
| 621 | - if ( isset( $meta['grid'] ) ) { |
|
| 622 | - $saved_grid = $this->populate_saved_grid_data( $parent_menu_item_id, $menu_id, $meta['grid'], $menu_items ); |
|
| 621 | + if (isset($meta['grid'])) { |
|
| 622 | + $saved_grid = $this->populate_saved_grid_data($parent_menu_item_id, $menu_id, $meta['grid'], $menu_items); |
|
| 623 | 623 | } else { |
| 624 | 624 | // return empty row |
| 625 | 625 | $saved_grid[0]['columns'][0]['meta']['span'] = 3; |
| 626 | - $saved_grid = $this->populate_saved_grid_data( $parent_menu_item_id, $menu_id, $saved_grid, $menu_items ); |
|
| 626 | + $saved_grid = $this->populate_saved_grid_data($parent_menu_item_id, $menu_id, $saved_grid, $menu_items); |
|
| 627 | 627 | |
| 628 | 628 | } |
| 629 | 629 | |
@@ -640,33 +640,33 @@ discard block |
||
| 640 | 640 | * @since 2.4 |
| 641 | 641 | * @return array |
| 642 | 642 | */ |
| 643 | - public function populate_saved_grid_data( $parent_menu_item_id, $menu_id, $saved_grid, $menu_items ) { |
|
| 643 | + public function populate_saved_grid_data($parent_menu_item_id, $menu_id, $saved_grid, $menu_items) { |
|
| 644 | 644 | |
| 645 | - $second_level_menu_items = $this->get_second_level_menu_items( $parent_menu_item_id, $menu_id, $menu_items ); |
|
| 645 | + $second_level_menu_items = $this->get_second_level_menu_items($parent_menu_item_id, $menu_id, $menu_items); |
|
| 646 | 646 | |
| 647 | 647 | $menu_items_included = array(); |
| 648 | 648 | |
| 649 | - foreach ( $saved_grid as $row => $row_data ) { |
|
| 650 | - if ( isset( $row_data['columns'] ) ) { |
|
| 651 | - foreach ( $row_data['columns'] as $col => $col_data ) { |
|
| 652 | - if ( isset( $col_data['items'] ) ) { |
|
| 653 | - foreach ( $col_data['items'] as $key => $item ) { |
|
| 654 | - if ( $item['type'] == 'item' ) { |
|
| 649 | + foreach ($saved_grid as $row => $row_data) { |
|
| 650 | + if (isset($row_data['columns'])) { |
|
| 651 | + foreach ($row_data['columns'] as $col => $col_data) { |
|
| 652 | + if (isset($col_data['items'])) { |
|
| 653 | + foreach ($col_data['items'] as $key => $item) { |
|
| 654 | + if ($item['type'] == 'item') { |
|
| 655 | 655 | $menu_items_included[] = $item['id']; |
| 656 | 656 | $is_child_of_parent = false; |
| 657 | 657 | |
| 658 | - foreach ( $second_level_menu_items as $menu_item ) { |
|
| 659 | - if ( $menu_item['id'] == $item['id'] ) { |
|
| 658 | + foreach ($second_level_menu_items as $menu_item) { |
|
| 659 | + if ($menu_item['id'] == $item['id']) { |
|
| 660 | 660 | $is_child_of_parent = true; |
| 661 | 661 | } |
| 662 | 662 | } |
| 663 | 663 | |
| 664 | - if ( ! $is_child_of_parent ) { |
|
| 665 | - unset( $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ] ); // menu item has been deleted or moved |
|
| 664 | + if (!$is_child_of_parent) { |
|
| 665 | + unset($saved_grid[$row]['columns'][$col]['items'][$key]); // menu item has been deleted or moved |
|
| 666 | 666 | } |
| 667 | 667 | } else { |
| 668 | - if ( ! $this->get_name_for_widget_id( $item['id'] ) ) { |
|
| 669 | - unset( $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ] ); // widget no longer exists |
|
| 668 | + if (!$this->get_name_for_widget_id($item['id'])) { |
|
| 669 | + unset($saved_grid[$row]['columns'][$col]['items'][$key]); // widget no longer exists |
|
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | 672 | } |
@@ -678,30 +678,30 @@ discard block |
||
| 678 | 678 | // Find any second level menu items that have been added to the menu but are not yet within the grid data |
| 679 | 679 | $orphaned_items = array(); |
| 680 | 680 | |
| 681 | - foreach ( $second_level_menu_items as $menu_item ) { |
|
| 682 | - if ( ! in_array( $menu_item['id'], $menu_items_included ) ) { |
|
| 681 | + foreach ($second_level_menu_items as $menu_item) { |
|
| 682 | + if (!in_array($menu_item['id'], $menu_items_included)) { |
|
| 683 | 683 | $orphaned_items[] = $menu_item; |
| 684 | 684 | } |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | - if ( ! isset( $saved_grid[0]['columns'][0]['items'][0] ) ) { |
|
| 687 | + if (!isset($saved_grid[0]['columns'][0]['items'][0])) { |
|
| 688 | 688 | $index = 0; // grid is empty |
| 689 | 689 | } else { |
| 690 | 690 | $index = 999; // create new row |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | - foreach ( $orphaned_items as $key => $menu_item ) { |
|
| 694 | - $saved_grid[ $index ]['columns'][0]['meta']['span'] = 3; |
|
| 695 | - $saved_grid[ $index ]['columns'][0]['items'][ $key ] = array( |
|
| 693 | + foreach ($orphaned_items as $key => $menu_item) { |
|
| 694 | + $saved_grid[$index]['columns'][0]['meta']['span'] = 3; |
|
| 695 | + $saved_grid[$index]['columns'][0]['items'][$key] = array( |
|
| 696 | 696 | 'id' => $menu_item['id'], |
| 697 | 697 | 'type' => 'item', |
| 698 | 698 | 'title' => $menu_item['title'], |
| 699 | - 'description' => __( 'Menu Item', 'megamenu' ), |
|
| 699 | + 'description' => __('Menu Item', 'megamenu'), |
|
| 700 | 700 | ); |
| 701 | 701 | } |
| 702 | 702 | |
| 703 | - if ( is_admin() ) { |
|
| 704 | - $saved_grid = $this->populate_grid_menu_item_titles( $saved_grid, $menu_id ); |
|
| 703 | + if (is_admin()) { |
|
| 704 | + $saved_grid = $this->populate_grid_menu_item_titles($saved_grid, $menu_id); |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | return $saved_grid; |
@@ -716,34 +716,34 @@ discard block |
||
| 716 | 716 | * @since 2.4 |
| 717 | 717 | * @return array |
| 718 | 718 | */ |
| 719 | - public function populate_grid_menu_item_titles( $saved_grid, $menu_id ) { |
|
| 719 | + public function populate_grid_menu_item_titles($saved_grid, $menu_id) { |
|
| 720 | 720 | |
| 721 | - $menu_items = wp_get_nav_menu_items( $menu_id ); |
|
| 721 | + $menu_items = wp_get_nav_menu_items($menu_id); |
|
| 722 | 722 | |
| 723 | 723 | $menu_item_title_map = array(); |
| 724 | 724 | |
| 725 | - foreach ( $menu_items as $item ) { |
|
| 726 | - $menu_item_title_map[ $item->ID ] = $item->title; |
|
| 725 | + foreach ($menu_items as $item) { |
|
| 726 | + $menu_item_title_map[$item->ID] = $item->title; |
|
| 727 | 727 | } |
| 728 | 728 | |
| 729 | - foreach ( $saved_grid as $row => $row_data ) { |
|
| 730 | - if ( isset( $row_data['columns'] ) ) { |
|
| 731 | - foreach ( $row_data['columns'] as $col => $col_data ) { |
|
| 732 | - if ( isset( $col_data['items'] ) ) { |
|
| 733 | - foreach ( $col_data['items'] as $key => $item ) { |
|
| 734 | - if ( $item['type'] == 'item' ) { |
|
| 729 | + foreach ($saved_grid as $row => $row_data) { |
|
| 730 | + if (isset($row_data['columns'])) { |
|
| 731 | + foreach ($row_data['columns'] as $col => $col_data) { |
|
| 732 | + if (isset($col_data['items'])) { |
|
| 733 | + foreach ($col_data['items'] as $key => $item) { |
|
| 734 | + if ($item['type'] == 'item') { |
|
| 735 | 735 | |
| 736 | - if ( isset( $menu_item_title_map[ $item['id'] ] ) ) { |
|
| 737 | - $title = $menu_item_title_map[ $item['id'] ]; |
|
| 736 | + if (isset($menu_item_title_map[$item['id']])) { |
|
| 737 | + $title = $menu_item_title_map[$item['id']]; |
|
| 738 | 738 | } else { |
| 739 | - $title = __( '(no label)' ); |
|
| 739 | + $title = __('(no label)'); |
|
| 740 | 740 | } |
| 741 | 741 | |
| 742 | - $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ]['title'] = $title; |
|
| 743 | - $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ]['description'] = __( 'Menu Item', 'megamenu' ); |
|
| 742 | + $saved_grid[$row]['columns'][$col]['items'][$key]['title'] = $title; |
|
| 743 | + $saved_grid[$row]['columns'][$col]['items'][$key]['description'] = __('Menu Item', 'megamenu'); |
|
| 744 | 744 | } else { |
| 745 | - $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ]['title'] = $this->get_title_for_widget_id( $item['id'] ); |
|
| 746 | - $saved_grid[ $row ]['columns'][ $col ]['items'][ $key ]['description'] = $this->get_name_for_widget_id( $item['id'] ); |
|
| 745 | + $saved_grid[$row]['columns'][$col]['items'][$key]['title'] = $this->get_title_for_widget_id($item['id']); |
|
| 746 | + $saved_grid[$row]['columns'][$col]['items'][$key]['description'] = $this->get_name_for_widget_id($item['id']); |
|
| 747 | 747 | } |
| 748 | 748 | } |
| 749 | 749 | } |
@@ -761,19 +761,19 @@ discard block |
||
| 761 | 761 | * @since 1.8.1 |
| 762 | 762 | * @param string $widget_id |
| 763 | 763 | */ |
| 764 | - public function get_settings_for_widget_id( $widget_id ) { |
|
| 764 | + public function get_settings_for_widget_id($widget_id) { |
|
| 765 | 765 | |
| 766 | - $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 766 | + $id_base = $this->get_id_base_for_widget_id($widget_id); |
|
| 767 | 767 | |
| 768 | - if ( ! $id_base ) { |
|
| 768 | + if (!$id_base) { |
|
| 769 | 769 | return false; |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | - $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 772 | + $widget_number = $this->get_widget_number_for_widget_id($widget_id); |
|
| 773 | 773 | |
| 774 | - $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 774 | + $current_widgets = get_option('widget_' . $id_base); |
|
| 775 | 775 | |
| 776 | - return $current_widgets[ $widget_number ]; |
|
| 776 | + return $current_widgets[$widget_number]; |
|
| 777 | 777 | |
| 778 | 778 | } |
| 779 | 779 | |
@@ -784,11 +784,11 @@ discard block |
||
| 784 | 784 | * @param string $widget_id - id_base-ID (eg meta-3) |
| 785 | 785 | * @return int |
| 786 | 786 | */ |
| 787 | - public function get_widget_number_for_widget_id( $widget_id ) { |
|
| 787 | + public function get_widget_number_for_widget_id($widget_id) { |
|
| 788 | 788 | |
| 789 | - $parts = explode( '-', $widget_id ); |
|
| 789 | + $parts = explode('-', $widget_id); |
|
| 790 | 790 | |
| 791 | - return absint( end( $parts ) ); |
|
| 791 | + return absint(end($parts)); |
|
| 792 | 792 | |
| 793 | 793 | } |
| 794 | 794 | |
@@ -799,14 +799,14 @@ discard block |
||
| 799 | 799 | * @param $widget_id - id_base-ID (eg meta-3) |
| 800 | 800 | * @return string e.g. "Custom HTML" or "Text" |
| 801 | 801 | */ |
| 802 | - public function get_name_for_widget_id( $widget_id ) { |
|
| 802 | + public function get_name_for_widget_id($widget_id) { |
|
| 803 | 803 | global $wp_registered_widgets; |
| 804 | 804 | |
| 805 | - if ( ! isset( $wp_registered_widgets[ $widget_id ] ) ) { |
|
| 805 | + if (!isset($wp_registered_widgets[$widget_id])) { |
|
| 806 | 806 | return false; |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | - $registered_widget = $wp_registered_widgets[ $widget_id ]; |
|
| 809 | + $registered_widget = $wp_registered_widgets[$widget_id]; |
|
| 810 | 810 | |
| 811 | 811 | return $registered_widget['name']; |
| 812 | 812 | |
@@ -819,14 +819,14 @@ discard block |
||
| 819 | 819 | * @since 2.4 |
| 820 | 820 | * @param $widget_id - id_base-ID (eg meta-3) |
| 821 | 821 | */ |
| 822 | - public function get_title_for_widget_id( $widget_id ) { |
|
| 823 | - $instance = $this->get_settings_for_widget_id( $widget_id ); |
|
| 822 | + public function get_title_for_widget_id($widget_id) { |
|
| 823 | + $instance = $this->get_settings_for_widget_id($widget_id); |
|
| 824 | 824 | |
| 825 | - if ( isset( $instance['title'] ) && strlen( $instance['title'] ) ) { |
|
| 825 | + if (isset($instance['title']) && strlen($instance['title'])) { |
|
| 826 | 826 | return $instance['title']; |
| 827 | 827 | } |
| 828 | 828 | |
| 829 | - return $this->get_name_for_widget_id( $widget_id ); |
|
| 829 | + return $this->get_name_for_widget_id($widget_id); |
|
| 830 | 830 | |
| 831 | 831 | } |
| 832 | 832 | |
@@ -835,16 +835,16 @@ discard block |
||
| 835 | 835 | * |
| 836 | 836 | * @since 1.0 |
| 837 | 837 | */ |
| 838 | - public function get_id_base_for_widget_id( $widget_id ) { |
|
| 838 | + public function get_id_base_for_widget_id($widget_id) { |
|
| 839 | 839 | global $wp_registered_widget_controls; |
| 840 | 840 | |
| 841 | - if ( ! isset( $wp_registered_widget_controls[ $widget_id ] ) ) { |
|
| 841 | + if (!isset($wp_registered_widget_controls[$widget_id])) { |
|
| 842 | 842 | return false; |
| 843 | 843 | } |
| 844 | 844 | |
| 845 | - $control = $wp_registered_widget_controls[ $widget_id ]; |
|
| 845 | + $control = $wp_registered_widget_controls[$widget_id]; |
|
| 846 | 846 | |
| 847 | - $id_base = isset( $control['id_base'] ) ? $control['id_base'] : $control['id']; |
|
| 847 | + $id_base = isset($control['id_base']) ? $control['id_base'] : $control['id']; |
|
| 848 | 848 | |
| 849 | 849 | return $id_base; |
| 850 | 850 | |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | * @since 1.0 |
| 857 | 857 | * @param string widget_id Something like meta-3 |
| 858 | 858 | */ |
| 859 | - public function show_widget( $id ) { |
|
| 859 | + public function show_widget($id) { |
|
| 860 | 860 | global $wp_registered_widgets; |
| 861 | 861 | |
| 862 | 862 | $params = array_merge( |
@@ -864,31 +864,31 @@ discard block |
||
| 864 | 864 | array_merge( |
| 865 | 865 | array( |
| 866 | 866 | 'widget_id' => $id, |
| 867 | - 'widget_name' => $wp_registered_widgets[ $id ]['name'], |
|
| 867 | + 'widget_name' => $wp_registered_widgets[$id]['name'], |
|
| 868 | 868 | ) |
| 869 | 869 | ), |
| 870 | 870 | ), |
| 871 | - (array) $wp_registered_widgets[ $id ]['params'] |
|
| 871 | + (array) $wp_registered_widgets[$id]['params'] |
|
| 872 | 872 | ); |
| 873 | 873 | |
| 874 | 874 | $params[0]['id'] = 'mega-menu'; |
| 875 | - $params[0]['before_title'] = apply_filters( 'megamenu_before_widget_title', '<h4 class="mega-block-title">', $wp_registered_widgets[ $id ] ); |
|
| 876 | - $params[0]['after_title'] = apply_filters( 'megamenu_after_widget_title', '</h4>', $wp_registered_widgets[ $id ] ); |
|
| 877 | - $params[0]['before_widget'] = apply_filters( 'megamenu_before_widget', '', $wp_registered_widgets[ $id ] ); |
|
| 878 | - $params[0]['after_widget'] = apply_filters( 'megamenu_after_widget', '', $wp_registered_widgets[ $id ] ); |
|
| 875 | + $params[0]['before_title'] = apply_filters('megamenu_before_widget_title', '<h4 class="mega-block-title">', $wp_registered_widgets[$id]); |
|
| 876 | + $params[0]['after_title'] = apply_filters('megamenu_after_widget_title', '</h4>', $wp_registered_widgets[$id]); |
|
| 877 | + $params[0]['before_widget'] = apply_filters('megamenu_before_widget', '', $wp_registered_widgets[$id]); |
|
| 878 | + $params[0]['after_widget'] = apply_filters('megamenu_after_widget', '', $wp_registered_widgets[$id]); |
|
| 879 | 879 | |
| 880 | - if ( defined( 'MEGAMENU_DYNAMIC_SIDEBAR_PARAMS' ) && MEGAMENU_DYNAMIC_SIDEBAR_PARAMS ) { |
|
| 881 | - $params[0]['before_widget'] = apply_filters( 'megamenu_before_widget', '<div id="" class="">', $wp_registered_widgets[ $id ] ); |
|
| 882 | - $params[0]['after_widget'] = apply_filters( 'megamenu_after_widget', '</div>', $wp_registered_widgets[ $id ] ); |
|
| 880 | + if (defined('MEGAMENU_DYNAMIC_SIDEBAR_PARAMS') && MEGAMENU_DYNAMIC_SIDEBAR_PARAMS) { |
|
| 881 | + $params[0]['before_widget'] = apply_filters('megamenu_before_widget', '<div id="" class="">', $wp_registered_widgets[$id]); |
|
| 882 | + $params[0]['after_widget'] = apply_filters('megamenu_after_widget', '</div>', $wp_registered_widgets[$id]); |
|
| 883 | 883 | |
| 884 | - $params = apply_filters( 'dynamic_sidebar_params', $params ); |
|
| 884 | + $params = apply_filters('dynamic_sidebar_params', $params); |
|
| 885 | 885 | } |
| 886 | 886 | |
| 887 | - $callback = $wp_registered_widgets[ $id ]['callback']; |
|
| 887 | + $callback = $wp_registered_widgets[$id]['callback']; |
|
| 888 | 888 | |
| 889 | - if ( is_callable( $callback ) ) { |
|
| 889 | + if (is_callable($callback)) { |
|
| 890 | 890 | ob_start(); |
| 891 | - call_user_func_array( $callback, $params ); |
|
| 891 | + call_user_func_array($callback, $params); |
|
| 892 | 892 | return ob_get_clean(); |
| 893 | 893 | } |
| 894 | 894 | |
@@ -901,11 +901,11 @@ discard block |
||
| 901 | 901 | * @since 1.8.1 |
| 902 | 902 | * @param string widget_id Something like meta-3 |
| 903 | 903 | */ |
| 904 | - public function get_widget_class( $id ) { |
|
| 904 | + public function get_widget_class($id) { |
|
| 905 | 905 | global $wp_registered_widgets; |
| 906 | 906 | |
| 907 | - if ( isset( $wp_registered_widgets[ $id ]['classname'] ) ) { |
|
| 908 | - return $wp_registered_widgets[ $id ]['classname']; |
|
| 907 | + if (isset($wp_registered_widgets[$id]['classname'])) { |
|
| 908 | + return $wp_registered_widgets[$id]['classname']; |
|
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | return ''; |
@@ -918,39 +918,39 @@ discard block |
||
| 918 | 918 | * @since 1.0 |
| 919 | 919 | * @param $widget_id - id_base-ID (eg meta-3) |
| 920 | 920 | */ |
| 921 | - public function show_widget_form( $widget_id ) { |
|
| 921 | + public function show_widget_form($widget_id) { |
|
| 922 | 922 | global $wp_registered_widget_controls; |
| 923 | 923 | |
| 924 | - $control = $wp_registered_widget_controls[ $widget_id ]; |
|
| 924 | + $control = $wp_registered_widget_controls[$widget_id]; |
|
| 925 | 925 | |
| 926 | - $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 926 | + $id_base = $this->get_id_base_for_widget_id($widget_id); |
|
| 927 | 927 | |
| 928 | - $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 928 | + $widget_number = $this->get_widget_number_for_widget_id($widget_id); |
|
| 929 | 929 | |
| 930 | - $nonce = wp_create_nonce( 'megamenu_save_widget_' . $widget_id ); |
|
| 930 | + $nonce = wp_create_nonce('megamenu_save_widget_' . $widget_id); |
|
| 931 | 931 | |
| 932 | 932 | ?> |
| 933 | 933 | |
| 934 | 934 | <form method='post'> |
| 935 | - <input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr( $widget_id ); ?>" /> |
|
| 935 | + <input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($widget_id); ?>" /> |
|
| 936 | 936 | <input type='hidden' name='action' value='mm_save_widget' /> |
| 937 | - <input type='hidden' name='id_base' class="id_base" value='<?php echo esc_attr( $id_base ); ?>' /> |
|
| 938 | - <input type='hidden' name='widget_id' value='<?php echo esc_attr( $widget_id ); ?>' /> |
|
| 939 | - <input type='hidden' name='_wpnonce' value='<?php echo esc_attr( $nonce ); ?>' /> |
|
| 937 | + <input type='hidden' name='id_base' class="id_base" value='<?php echo esc_attr($id_base); ?>' /> |
|
| 938 | + <input type='hidden' name='widget_id' value='<?php echo esc_attr($widget_id); ?>' /> |
|
| 939 | + <input type='hidden' name='_wpnonce' value='<?php echo esc_attr($nonce); ?>' /> |
|
| 940 | 940 | <div class='widget-content'> |
| 941 | 941 | <?php |
| 942 | - if ( is_callable( $control['callback'] ) ) { |
|
| 943 | - call_user_func_array( $control['callback'], $control['params'] ); |
|
| 942 | + if (is_callable($control['callback'])) { |
|
| 943 | + call_user_func_array($control['callback'], $control['params']); |
|
| 944 | 944 | } |
| 945 | 945 | ?> |
| 946 | 946 | |
| 947 | 947 | <div class='widget-controls'> |
| 948 | - <a class='delete' href='#delete'><?php _e( 'Delete', 'megamenu' ); ?></a> | |
|
| 949 | - <a class='close' href='#close'><?php _e( 'Close', 'megamenu' ); ?></a> |
|
| 948 | + <a class='delete' href='#delete'><?php _e('Delete', 'megamenu'); ?></a> | |
|
| 949 | + <a class='close' href='#close'><?php _e('Close', 'megamenu'); ?></a> |
|
| 950 | 950 | </div> |
| 951 | 951 | |
| 952 | 952 | <?php |
| 953 | - submit_button( __( 'Save' ), 'button-primary alignright', 'savewidget', false ); |
|
| 953 | + submit_button(__('Save'), 'button-primary alignright', 'savewidget', false); |
|
| 954 | 954 | ?> |
| 955 | 955 | </div> |
| 956 | 956 | </form> |
@@ -968,16 +968,16 @@ discard block |
||
| 968 | 968 | * @param string $id_base - e.g. 'meta' |
| 969 | 969 | * @return bool |
| 970 | 970 | */ |
| 971 | - public function save_widget( $id_base ) { |
|
| 971 | + public function save_widget($id_base) { |
|
| 972 | 972 | global $wp_registered_widget_updates; |
| 973 | 973 | |
| 974 | - $control = $wp_registered_widget_updates[ $id_base ]; |
|
| 974 | + $control = $wp_registered_widget_updates[$id_base]; |
|
| 975 | 975 | |
| 976 | - if ( is_callable( $control['callback'] ) ) { |
|
| 976 | + if (is_callable($control['callback'])) { |
|
| 977 | 977 | |
| 978 | - call_user_func_array( $control['callback'], $control['params'] ); |
|
| 978 | + call_user_func_array($control['callback'], $control['params']); |
|
| 979 | 979 | |
| 980 | - do_action( 'megamenu_after_widget_save' ); |
|
| 980 | + do_action('megamenu_after_widget_save'); |
|
| 981 | 981 | |
| 982 | 982 | return true; |
| 983 | 983 | } |
@@ -996,33 +996,33 @@ discard block |
||
| 996 | 996 | * @param int $menu_item_id |
| 997 | 997 | * @param string $title |
| 998 | 998 | */ |
| 999 | - public function add_widget( $id_base, $menu_item_id, $title, $is_grid_widget ) { |
|
| 999 | + public function add_widget($id_base, $menu_item_id, $title, $is_grid_widget) { |
|
| 1000 | 1000 | |
| 1001 | - require_once( ABSPATH . 'wp-admin/includes/widgets.php' ); |
|
| 1001 | + require_once(ABSPATH . 'wp-admin/includes/widgets.php'); |
|
| 1002 | 1002 | |
| 1003 | - $next_id = next_widget_id_number( $id_base ); |
|
| 1003 | + $next_id = next_widget_id_number($id_base); |
|
| 1004 | 1004 | |
| 1005 | - $this->add_widget_instance( $id_base, $next_id, $menu_item_id, $is_grid_widget ); |
|
| 1005 | + $this->add_widget_instance($id_base, $next_id, $menu_item_id, $is_grid_widget); |
|
| 1006 | 1006 | |
| 1007 | - $widget_id = $this->add_widget_to_sidebar( $id_base, $next_id ); |
|
| 1007 | + $widget_id = $this->add_widget_to_sidebar($id_base, $next_id); |
|
| 1008 | 1008 | |
| 1009 | - $return = '<div class="widget" title="' . esc_attr( $title ) . '" data-columns="2" id="' . $widget_id . '" data-type="widget" data-id="' . $widget_id . '">'; |
|
| 1009 | + $return = '<div class="widget" title="' . esc_attr($title) . '" data-columns="2" id="' . $widget_id . '" data-type="widget" data-id="' . $widget_id . '">'; |
|
| 1010 | 1010 | $return .= ' <div class="widget-top">'; |
| 1011 | 1011 | $return .= ' <div class="widget-title-action">'; |
| 1012 | 1012 | |
| 1013 | - if ( ! $is_grid_widget ) { |
|
| 1014 | - $return .= ' <a class="widget-option widget-contract" title="' . esc_attr( __( 'Contract', 'megamenu' ) ) . '"></a>'; |
|
| 1013 | + if (!$is_grid_widget) { |
|
| 1014 | + $return .= ' <a class="widget-option widget-contract" title="' . esc_attr(__('Contract', 'megamenu')) . '"></a>'; |
|
| 1015 | 1015 | $return .= ' <span class="widget-cols"><span class="widget-num-cols">2</span><span class="widget-of">/</span><span class="widget-total-cols">X</span></span>'; |
| 1016 | - $return .= ' <a class="widget-option widget-expand" title="' . esc_attr( __( 'Expand', 'megamenu' ) ) . '"></a>'; |
|
| 1016 | + $return .= ' <a class="widget-option widget-expand" title="' . esc_attr(__('Expand', 'megamenu')) . '"></a>'; |
|
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | - $return .= ' <a class="widget-option widget-action" title="' . esc_attr( __( 'Edit', 'megamenu' ) ) . '"></a>'; |
|
| 1019 | + $return .= ' <a class="widget-option widget-action" title="' . esc_attr(__('Edit', 'megamenu')) . '"></a>'; |
|
| 1020 | 1020 | $return .= ' </div>'; |
| 1021 | 1021 | $return .= ' <div class="widget-title">'; |
| 1022 | - $return .= ' <h4>' . esc_html( $title ) . '</h4>'; |
|
| 1022 | + $return .= ' <h4>' . esc_html($title) . '</h4>'; |
|
| 1023 | 1023 | |
| 1024 | - if ( $is_grid_widget ) { |
|
| 1025 | - $return .= ' <span class="widget-desc">' . esc_html( $title ) . '</span>'; |
|
| 1024 | + if ($is_grid_widget) { |
|
| 1025 | + $return .= ' <span class="widget-desc">' . esc_html($title) . '</span>'; |
|
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | $return .= ' </div>'; |
@@ -1043,22 +1043,22 @@ discard block |
||
| 1043 | 1043 | * @param int $next_id |
| 1044 | 1044 | * @param int $menu_item_id |
| 1045 | 1045 | */ |
| 1046 | - private function add_widget_instance( $id_base, $next_id, $menu_item_id, $is_grid_widget ) { |
|
| 1046 | + private function add_widget_instance($id_base, $next_id, $menu_item_id, $is_grid_widget) { |
|
| 1047 | 1047 | |
| 1048 | - $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 1048 | + $current_widgets = get_option('widget_' . $id_base); |
|
| 1049 | 1049 | |
| 1050 | - $current_widgets[ $next_id ] = array( |
|
| 1050 | + $current_widgets[$next_id] = array( |
|
| 1051 | 1051 | 'mega_menu_columns' => 2, |
| 1052 | 1052 | 'mega_menu_parent_menu_id' => $menu_item_id, |
| 1053 | 1053 | ); |
| 1054 | 1054 | |
| 1055 | - if ( $is_grid_widget ) { |
|
| 1056 | - $current_widgets[ $next_id ] = array( |
|
| 1055 | + if ($is_grid_widget) { |
|
| 1056 | + $current_widgets[$next_id] = array( |
|
| 1057 | 1057 | 'mega_menu_is_grid_widget' => 'true', |
| 1058 | 1058 | ); |
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | - update_option( 'widget_' . $id_base, $current_widgets ); |
|
| 1061 | + update_option('widget_' . $id_base, $current_widgets); |
|
| 1062 | 1062 | |
| 1063 | 1063 | } |
| 1064 | 1064 | |
@@ -1069,19 +1069,19 @@ discard block |
||
| 1069 | 1069 | * @param string $widget_id e.g. meta-3 |
| 1070 | 1070 | * @return bool. True if widget has been deleted. |
| 1071 | 1071 | */ |
| 1072 | - private function remove_widget_instance( $widget_id ) { |
|
| 1072 | + private function remove_widget_instance($widget_id) { |
|
| 1073 | 1073 | |
| 1074 | - $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 1075 | - $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 1074 | + $id_base = $this->get_id_base_for_widget_id($widget_id); |
|
| 1075 | + $widget_number = $this->get_widget_number_for_widget_id($widget_id); |
|
| 1076 | 1076 | |
| 1077 | 1077 | // add blank widget |
| 1078 | - $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 1078 | + $current_widgets = get_option('widget_' . $id_base); |
|
| 1079 | 1079 | |
| 1080 | - if ( isset( $current_widgets[ $widget_number ] ) ) { |
|
| 1080 | + if (isset($current_widgets[$widget_number])) { |
|
| 1081 | 1081 | |
| 1082 | - unset( $current_widgets[ $widget_number ] ); |
|
| 1082 | + unset($current_widgets[$widget_number]); |
|
| 1083 | 1083 | |
| 1084 | - update_option( 'widget_' . $id_base, $current_widgets ); |
|
| 1084 | + update_option('widget_' . $id_base, $current_widgets); |
|
| 1085 | 1085 | |
| 1086 | 1086 | return true; |
| 1087 | 1087 | |
@@ -1099,19 +1099,19 @@ discard block |
||
| 1099 | 1099 | * @param string $widget_id |
| 1100 | 1100 | * @param int $columns |
| 1101 | 1101 | */ |
| 1102 | - public function update_widget_columns( $widget_id, $columns ) { |
|
| 1102 | + public function update_widget_columns($widget_id, $columns) { |
|
| 1103 | 1103 | |
| 1104 | - $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 1104 | + $id_base = $this->get_id_base_for_widget_id($widget_id); |
|
| 1105 | 1105 | |
| 1106 | - $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 1106 | + $widget_number = $this->get_widget_number_for_widget_id($widget_id); |
|
| 1107 | 1107 | |
| 1108 | - $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 1108 | + $current_widgets = get_option('widget_' . $id_base); |
|
| 1109 | 1109 | |
| 1110 | - $current_widgets[ $widget_number ]['mega_menu_columns'] = absint( $columns ); |
|
| 1110 | + $current_widgets[$widget_number]['mega_menu_columns'] = absint($columns); |
|
| 1111 | 1111 | |
| 1112 | - update_option( 'widget_' . $id_base, $current_widgets ); |
|
| 1112 | + update_option('widget_' . $id_base, $current_widgets); |
|
| 1113 | 1113 | |
| 1114 | - do_action( 'megamenu_after_widget_save' ); |
|
| 1114 | + do_action('megamenu_after_widget_save'); |
|
| 1115 | 1115 | |
| 1116 | 1116 | return true; |
| 1117 | 1117 | |
@@ -1125,19 +1125,19 @@ discard block |
||
| 1125 | 1125 | * @param string $menu_item_id |
| 1126 | 1126 | * @param int $columns |
| 1127 | 1127 | */ |
| 1128 | - public function update_menu_item_columns( $menu_item_id, $columns ) { |
|
| 1128 | + public function update_menu_item_columns($menu_item_id, $columns) { |
|
| 1129 | 1129 | |
| 1130 | - $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true ); |
|
| 1130 | + $existing_settings = get_post_meta($menu_item_id, '_megamenu', true); |
|
| 1131 | 1131 | |
| 1132 | 1132 | $submitted_settings = array( |
| 1133 | - 'mega_menu_columns' => absint( $columns ), |
|
| 1133 | + 'mega_menu_columns' => absint($columns), |
|
| 1134 | 1134 | ); |
| 1135 | 1135 | |
| 1136 | - if ( is_array( $existing_settings ) ) { |
|
| 1137 | - $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 1136 | + if (is_array($existing_settings)) { |
|
| 1137 | + $submitted_settings = array_merge($existing_settings, $submitted_settings); |
|
| 1138 | 1138 | } |
| 1139 | 1139 | |
| 1140 | - update_post_meta( $menu_item_id, '_megamenu', $submitted_settings ); |
|
| 1140 | + update_post_meta($menu_item_id, '_megamenu', $submitted_settings); |
|
| 1141 | 1141 | |
| 1142 | 1142 | return true; |
| 1143 | 1143 | |
@@ -1151,17 +1151,17 @@ discard block |
||
| 1151 | 1151 | * @param string $widget_id |
| 1152 | 1152 | * @param int $columns |
| 1153 | 1153 | */ |
| 1154 | - public function update_widget_order( $widget_id, $order, $parent_menu_item_id ) { |
|
| 1154 | + public function update_widget_order($widget_id, $order, $parent_menu_item_id) { |
|
| 1155 | 1155 | |
| 1156 | - $id_base = $this->get_id_base_for_widget_id( $widget_id ); |
|
| 1156 | + $id_base = $this->get_id_base_for_widget_id($widget_id); |
|
| 1157 | 1157 | |
| 1158 | - $widget_number = $this->get_widget_number_for_widget_id( $widget_id ); |
|
| 1158 | + $widget_number = $this->get_widget_number_for_widget_id($widget_id); |
|
| 1159 | 1159 | |
| 1160 | - $current_widgets = get_option( 'widget_' . $id_base ); |
|
| 1160 | + $current_widgets = get_option('widget_' . $id_base); |
|
| 1161 | 1161 | |
| 1162 | - $current_widgets[ $widget_number ]['mega_menu_order'] = array( $parent_menu_item_id => absint( $order ) ); |
|
| 1162 | + $current_widgets[$widget_number]['mega_menu_order'] = array($parent_menu_item_id => absint($order)); |
|
| 1163 | 1163 | |
| 1164 | - update_option( 'widget_' . $id_base, $current_widgets ); |
|
| 1164 | + update_option('widget_' . $id_base, $current_widgets); |
|
| 1165 | 1165 | |
| 1166 | 1166 | return true; |
| 1167 | 1167 | |
@@ -1175,19 +1175,19 @@ discard block |
||
| 1175 | 1175 | * @param string $menu_item_id |
| 1176 | 1176 | * @param int $order |
| 1177 | 1177 | */ |
| 1178 | - public function update_menu_item_order( $menu_item_id, $order, $parent_menu_item_id ) { |
|
| 1178 | + public function update_menu_item_order($menu_item_id, $order, $parent_menu_item_id) { |
|
| 1179 | 1179 | |
| 1180 | - $submitted_settings['mega_menu_order'] = array( $parent_menu_item_id => absint( $order ) ); |
|
| 1180 | + $submitted_settings['mega_menu_order'] = array($parent_menu_item_id => absint($order)); |
|
| 1181 | 1181 | |
| 1182 | - $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true ); |
|
| 1182 | + $existing_settings = get_post_meta($menu_item_id, '_megamenu', true); |
|
| 1183 | 1183 | |
| 1184 | - if ( is_array( $existing_settings ) ) { |
|
| 1184 | + if (is_array($existing_settings)) { |
|
| 1185 | 1185 | |
| 1186 | - $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 1186 | + $submitted_settings = array_merge($existing_settings, $submitted_settings); |
|
| 1187 | 1187 | |
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | - update_post_meta( $menu_item_id, '_megamenu', $submitted_settings ); |
|
| 1190 | + update_post_meta($menu_item_id, '_megamenu', $submitted_settings); |
|
| 1191 | 1191 | |
| 1192 | 1192 | return true; |
| 1193 | 1193 | |
@@ -1200,12 +1200,12 @@ discard block |
||
| 1200 | 1200 | * @since 1.0 |
| 1201 | 1201 | * @param string $widget_id e.g. meta-3 |
| 1202 | 1202 | */ |
| 1203 | - public function delete_widget( $widget_id ) { |
|
| 1203 | + public function delete_widget($widget_id) { |
|
| 1204 | 1204 | |
| 1205 | - $this->remove_widget_from_sidebar( $widget_id ); |
|
| 1206 | - $this->remove_widget_instance( $widget_id ); |
|
| 1205 | + $this->remove_widget_from_sidebar($widget_id); |
|
| 1206 | + $this->remove_widget_instance($widget_id); |
|
| 1207 | 1207 | |
| 1208 | - do_action( 'megamenu_after_widget_delete' ); |
|
| 1208 | + do_action('megamenu_after_widget_delete'); |
|
| 1209 | 1209 | |
| 1210 | 1210 | return true; |
| 1211 | 1211 | |
@@ -1219,34 +1219,34 @@ discard block |
||
| 1219 | 1219 | * @param array $items |
| 1220 | 1220 | * @return string $widget_id. The widget that has been moved. |
| 1221 | 1221 | */ |
| 1222 | - public function reorder_items( $items ) { |
|
| 1222 | + public function reorder_items($items) { |
|
| 1223 | 1223 | |
| 1224 | - foreach ( $items as $item ) { |
|
| 1224 | + foreach ($items as $item) { |
|
| 1225 | 1225 | |
| 1226 | - if ( $item['parent_menu_item'] ) { |
|
| 1226 | + if ($item['parent_menu_item']) { |
|
| 1227 | 1227 | |
| 1228 | - $submitted_settings = array( 'submenu_ordering' => 'forced' ); |
|
| 1228 | + $submitted_settings = array('submenu_ordering' => 'forced'); |
|
| 1229 | 1229 | |
| 1230 | - $existing_settings = get_post_meta( $item['parent_menu_item'], '_megamenu', true ); |
|
| 1230 | + $existing_settings = get_post_meta($item['parent_menu_item'], '_megamenu', true); |
|
| 1231 | 1231 | |
| 1232 | - if ( is_array( $existing_settings ) ) { |
|
| 1232 | + if (is_array($existing_settings)) { |
|
| 1233 | 1233 | |
| 1234 | - $submitted_settings = array_merge( $existing_settings, $submitted_settings ); |
|
| 1234 | + $submitted_settings = array_merge($existing_settings, $submitted_settings); |
|
| 1235 | 1235 | |
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | - update_post_meta( $item['parent_menu_item'], '_megamenu', $submitted_settings ); |
|
| 1238 | + update_post_meta($item['parent_menu_item'], '_megamenu', $submitted_settings); |
|
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | - if ( $item['type'] == 'widget' ) { |
|
| 1241 | + if ($item['type'] == 'widget') { |
|
| 1242 | 1242 | |
| 1243 | - $this->update_widget_order( $item['id'], $item['order'], $item['parent_menu_item'] ); |
|
| 1243 | + $this->update_widget_order($item['id'], $item['order'], $item['parent_menu_item']); |
|
| 1244 | 1244 | |
| 1245 | 1245 | } |
| 1246 | 1246 | |
| 1247 | - if ( $item['type'] == 'menu_item' ) { |
|
| 1247 | + if ($item['type'] == 'menu_item') { |
|
| 1248 | 1248 | |
| 1249 | - $this->update_menu_item_order( $item['id'], $item['order'], $item['parent_menu_item'] ); |
|
| 1249 | + $this->update_menu_item_order($item['id'], $item['order'], $item['parent_menu_item']); |
|
| 1250 | 1250 | |
| 1251 | 1251 | } |
| 1252 | 1252 | } |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | * |
| 1262 | 1262 | * @since 1.0 |
| 1263 | 1263 | */ |
| 1264 | - private function add_widget_to_sidebar( $id_base, $next_id ) { |
|
| 1264 | + private function add_widget_to_sidebar($id_base, $next_id) { |
|
| 1265 | 1265 | |
| 1266 | 1266 | $widget_id = $id_base . '-' . $next_id; |
| 1267 | 1267 | |
@@ -1269,9 +1269,9 @@ discard block |
||
| 1269 | 1269 | |
| 1270 | 1270 | $sidebar_widgets[] = $widget_id; |
| 1271 | 1271 | |
| 1272 | - $this->set_mega_menu_sidebar_widgets( $sidebar_widgets ); |
|
| 1272 | + $this->set_mega_menu_sidebar_widgets($sidebar_widgets); |
|
| 1273 | 1273 | |
| 1274 | - do_action( 'megamenu_after_widget_add' ); |
|
| 1274 | + do_action('megamenu_after_widget_add'); |
|
| 1275 | 1275 | |
| 1276 | 1276 | return $widget_id; |
| 1277 | 1277 | |
@@ -1284,20 +1284,20 @@ discard block |
||
| 1284 | 1284 | * @since 1.0 |
| 1285 | 1285 | * @return string The widget that was removed |
| 1286 | 1286 | */ |
| 1287 | - private function remove_widget_from_sidebar( $widget_id ) { |
|
| 1287 | + private function remove_widget_from_sidebar($widget_id) { |
|
| 1288 | 1288 | |
| 1289 | 1289 | $widgets = $this->get_mega_menu_sidebar_widgets(); |
| 1290 | 1290 | |
| 1291 | 1291 | $new_mega_menu_widgets = array(); |
| 1292 | 1292 | |
| 1293 | - foreach ( $widgets as $widget ) { |
|
| 1293 | + foreach ($widgets as $widget) { |
|
| 1294 | 1294 | |
| 1295 | - if ( $widget != $widget_id ) { |
|
| 1295 | + if ($widget != $widget_id) { |
|
| 1296 | 1296 | $new_mega_menu_widgets[] = $widget; |
| 1297 | 1297 | } |
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | - $this->set_mega_menu_sidebar_widgets( $new_mega_menu_widgets ); |
|
| 1300 | + $this->set_mega_menu_sidebar_widgets($new_mega_menu_widgets); |
|
| 1301 | 1301 | |
| 1302 | 1302 | return $widget_id; |
| 1303 | 1303 | |
@@ -1314,7 +1314,7 @@ discard block |
||
| 1314 | 1314 | |
| 1315 | 1315 | $sidebar_widgets = wp_get_sidebars_widgets(); |
| 1316 | 1316 | |
| 1317 | - if ( ! isset( $sidebar_widgets['mega-menu'] ) ) { |
|
| 1317 | + if (!isset($sidebar_widgets['mega-menu'])) { |
|
| 1318 | 1318 | return false; |
| 1319 | 1319 | } |
| 1320 | 1320 | |
@@ -1328,13 +1328,13 @@ discard block |
||
| 1328 | 1328 | * |
| 1329 | 1329 | * @since 1.0 |
| 1330 | 1330 | */ |
| 1331 | - private function set_mega_menu_sidebar_widgets( $widgets ) { |
|
| 1331 | + private function set_mega_menu_sidebar_widgets($widgets) { |
|
| 1332 | 1332 | |
| 1333 | 1333 | $sidebar_widgets = wp_get_sidebars_widgets(); |
| 1334 | 1334 | |
| 1335 | 1335 | $sidebar_widgets['mega-menu'] = $widgets; |
| 1336 | 1336 | |
| 1337 | - wp_set_sidebars_widgets( $sidebar_widgets ); |
|
| 1337 | + wp_set_sidebars_widgets($sidebar_widgets); |
|
| 1338 | 1338 | |
| 1339 | 1339 | } |
| 1340 | 1340 | |
@@ -1347,12 +1347,12 @@ discard block |
||
| 1347 | 1347 | public function clear_caches() { |
| 1348 | 1348 | |
| 1349 | 1349 | // https://wordpress.org/plugins/widget-output-cache/ |
| 1350 | - if ( function_exists( 'menu_output_cache_bump' ) ) { |
|
| 1350 | + if (function_exists('menu_output_cache_bump')) { |
|
| 1351 | 1351 | menu_output_cache_bump(); |
| 1352 | 1352 | } |
| 1353 | 1353 | |
| 1354 | 1354 | // https://wordpress.org/plugins/widget-output-cache/ |
| 1355 | - if ( function_exists( 'widget_output_cache_bump' ) ) { |
|
| 1355 | + if (function_exists('widget_output_cache_bump')) { |
|
| 1356 | 1356 | widget_output_cache_bump(); |
| 1357 | 1357 | } |
| 1358 | 1358 | |
@@ -1367,12 +1367,12 @@ discard block |
||
| 1367 | 1367 | * @param string $json |
| 1368 | 1368 | * @since 1.8 |
| 1369 | 1369 | */ |
| 1370 | - public function send_json_success( $json ) { |
|
| 1371 | - if ( ob_get_contents() ) { |
|
| 1370 | + public function send_json_success($json) { |
|
| 1371 | + if (ob_get_contents()) { |
|
| 1372 | 1372 | ob_clean(); |
| 1373 | 1373 | } |
| 1374 | 1374 | |
| 1375 | - wp_send_json_success( $json ); |
|
| 1375 | + wp_send_json_success($json); |
|
| 1376 | 1376 | } |
| 1377 | 1377 | |
| 1378 | 1378 | |
@@ -1384,12 +1384,12 @@ discard block |
||
| 1384 | 1384 | * @param string $json |
| 1385 | 1385 | * @since 1.8 |
| 1386 | 1386 | */ |
| 1387 | - public function send_json_error( $json ) { |
|
| 1388 | - if ( ob_get_contents() ) { |
|
| 1387 | + public function send_json_error($json) { |
|
| 1388 | + if (ob_get_contents()) { |
|
| 1389 | 1389 | ob_clean(); |
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | - wp_send_json_error( $json ); |
|
| 1392 | + wp_send_json_error($json); |
|
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | 1395 | } |