Passed
Push — main ( ffd9e1...85931f )
by TARIQ
45:59 queued 03:57
created
brighty/wp-config.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
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
 block discarded – undo
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. */
Please login to merge, or discard this patch.
plugins/megamenu/classes/pages/tools.php 1 patch
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -1,116 +1,116 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
plugins/megamenu/classes/pages/themes.php 1 patch
Indentation   +2900 added lines, -2900 removed lines patch added patch discarded remove patch
@@ -1,604 +1,604 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
plugins/megamenu/classes/pages/general.php 1 patch
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -1,109 +1,109 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 &lt;head&gt;', '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
 block discarded – undo
164 164
 		</div>
165 165
 
166 166
 			<?php
167
-		}
167
+        }
168 168
 
169
-	}
169
+    }
170 170
 
171 171
 endif;
Please login to merge, or discard this patch.
plugins/megamenu/classes/pages/page.php 1 patch
Indentation   +241 added lines, -241 removed lines patch added patch discarded remove patch
@@ -1,133 +1,133 @@  discard block
 block discarded – undo
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&amp;utm_medium=settings&amp;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&amp;utm_medium=settings&amp;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&amp;utm_medium=settings&amp;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&amp;utm_medium=settings&amp;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&amp;utm_medium=settings&amp;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&amp;utm_medium=settings&amp;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&amp;utm_medium=settings&amp;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&amp;utm_medium=settings&amp;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&amp;utm_medium=settings&amp;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&amp;utm_medium=settings&amp;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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
plugins/megamenu/classes/pages/locations.php 1 patch
Indentation   +1431 added lines, -1431 removed lines patch added patch discarded remove patch
@@ -1,262 +1,262 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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' ); ?>>&lt;div&gt;</option>
1316 1316
 					<option value='nav' <?php echo selected( $container == 'nav' ); ?>>&lt;nav&gt;</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">&lt;?php wp_nav_menu( array( 'theme_location' => '<?php echo esc_attr( $value ); ?>' ) ); ?&gt;</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;
Please login to merge, or discard this patch.
plugins/megamenu/classes/walker.class.php 1 patch
Indentation   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -1,227 +1,227 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
plugins/megamenu/classes/menu-item-manager.class.php 1 patch
Indentation   +1177 added lines, -1177 removed lines patch added patch discarded remove patch
@@ -1,1275 +1,1275 @@
 block discarded – undo
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&amp;utm_medium=icon&amp;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&amp;utm_medium=icon&amp;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&amp;utm_medium=icon&amp;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&amp;utm_medium=icon&amp;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&amp;utm_medium=icon&amp;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&amp;utm_medium=icon&amp;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;
Please login to merge, or discard this patch.
plugins/megamenu/classes/widget-manager.class.php 1 patch
Indentation   +1001 added lines, -1001 removed lines patch added patch discarded remove patch
@@ -1,123 +1,123 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.