Version Description
- Improvement: Add megamenu_javascript_handle filter
- Improvement: Tidy up CSS for backwards compatibility with previous versions of Pro
- Improvement: Pave the way for removing JavaScript localisation by moving hover intent options to wrap attributes
- Improvement: Allow third level items to be distributed over 6 columns (previously 4) (requires clearing the Menu CSS Cache)
- Improvement: Increase number of available columns for "Mega Menu - Standard Layout" from 9 to 12 (requires clearing the Menu CSS Cache)
- Fix: Unquote font family CSS when Reset Widget Styling is enabled
- Fix: Edge case PHP warning when using widget
- Fix: Workaround for when wp_get_theme() fails to return name of active theme
- Fix: Correctly sanitise theme import data and escape output. Thanks to polyplanet.de for reporting this!
- Refactor: Decouple menu items lightbox options from nav-menus.php screen. When opening lightbox settings on nav-menus.php, use PHP to determine these values rather than JavaScript
- Refactor: Improve method to determine the depth of a menu item
Download this release
Release Info
Developer | megamenu |
Plugin | Max Mega Menu |
Version | 2.7.5 |
Comparing to | |
See all releases |
Code changes from version 2.7.4 to 2.7.5
- classes/menu-item-manager.class.php +83 -25
- classes/nav-menus.class.php +3 -41
- classes/settings.class.php +57 -29
- classes/style-manager.class.php +15 -2
- classes/widget-manager.class.php +2 -0
- classes/widget.class.php +4 -0
- css/admin/admin.css +94 -26
- css/admin/admin.scss +16 -165
- css/megamenu.scss +6 -42
- css/reset.scss +1 -1
- js/admin.js +9 -4
- js/maxmegamenu.js +7 -4
- megamenu.php +41 -22
- readme.txt +15 -1
classes/menu-item-manager.class.php
CHANGED
@@ -13,11 +13,10 @@ if ( ! class_exists('Mega_Menu_Menu_Item_Manager') ) :
|
|
13 |
class Mega_Menu_Menu_Item_Manager {
|
14 |
|
15 |
var $menu_id = 0;
|
16 |
-
|
17 |
var $menu_item_id = 0;
|
18 |
-
|
19 |
var $menu_item_depth = 0;
|
20 |
-
|
21 |
var $menu_item_meta = array();
|
22 |
|
23 |
|
@@ -27,17 +26,14 @@ class Mega_Menu_Menu_Item_Manager {
|
|
27 |
* @since 1.4
|
28 |
*/
|
29 |
public function __construct() {
|
30 |
-
|
31 |
add_action( 'wp_ajax_mm_get_lightbox_html', array( $this, 'ajax_get_lightbox_html' ) );
|
32 |
add_action( 'wp_ajax_mm_get_empty_grid_column', array( $this, 'ajax_get_empty_grid_column' ) );
|
33 |
add_action( 'wp_ajax_mm_get_empty_grid_row', array( $this, 'ajax_get_empty_grid_row' ) );
|
34 |
-
|
35 |
add_action( 'wp_ajax_mm_save_menu_item_settings', array( $this, 'ajax_save_menu_item_settings') );
|
36 |
|
37 |
add_filter( 'megamenu_tabs', array( $this, 'add_mega_menu_tab'), 10, 5 );
|
38 |
add_filter( 'megamenu_tabs', array( $this, 'add_general_settings_tab'), 10, 5 );
|
39 |
add_filter( 'megamenu_tabs', array( $this, 'add_icon_tab'), 10, 5 );
|
40 |
-
|
41 |
}
|
42 |
|
43 |
|
@@ -47,29 +43,24 @@ class Mega_Menu_Menu_Item_Manager {
|
|
47 |
* @since 1.4
|
48 |
*/
|
49 |
private function init() {
|
50 |
-
|
51 |
if ( isset( $_POST['menu_item_id'] ) ) {
|
52 |
-
|
53 |
$this->menu_item_id = absint( $_POST['menu_item_id'] );
|
|
|
|
|
|
|
|
|
54 |
|
55 |
$saved_settings = array_filter( (array) get_post_meta( $this->menu_item_id, '_megamenu', true ) );
|
56 |
-
|
57 |
$this->menu_item_meta = array_merge( Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings );
|
58 |
-
|
59 |
-
}
|
60 |
-
|
61 |
-
if ( isset( $_POST['menu_item_depth'] ) ) {
|
62 |
-
|
63 |
-
$this->menu_item_depth = absint( $_POST['menu_item_depth'] );
|
64 |
-
|
65 |
}
|
66 |
|
67 |
-
if ( isset( $_POST['
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
}
|
72 |
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
|
@@ -141,16 +132,81 @@ class Mega_Menu_Menu_Item_Manager {
|
|
141 |
|
142 |
$this->init();
|
143 |
|
144 |
-
$
|
|
|
|
|
145 |
|
146 |
-
$
|
147 |
|
148 |
if ( ob_get_contents() ) ob_clean(); // remove any warnings or output from other plugins which may corrupt the response
|
149 |
|
150 |
-
wp_send_json_success( json_encode( $
|
151 |
}
|
152 |
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
/**
|
155 |
* Return the HTML to display in the 'Mega Menu' tab
|
156 |
*
|
@@ -158,7 +214,6 @@ class Mega_Menu_Menu_Item_Manager {
|
|
158 |
* @return array
|
159 |
*/
|
160 |
public function add_mega_menu_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) {
|
161 |
-
|
162 |
if ( $menu_item_depth > 0 ) {
|
163 |
$tabs['mega_menu'] = array(
|
164 |
'title' => __('Sub Menu', 'megamenu'),
|
@@ -198,6 +253,9 @@ class Mega_Menu_Menu_Item_Manager {
|
|
198 |
$return .= " <option value='7' " . selected( $menu_item_meta['panel_columns'], 7, false ) . ">7 " . __("columns", "megamenu") . "</option>";
|
199 |
$return .= " <option value='8' " . selected( $menu_item_meta['panel_columns'], 8, false ) . ">8 " . __("columns", "megamenu") . "</option>";
|
200 |
$return .= " <option value='9' " . selected( $menu_item_meta['panel_columns'], 9, false ) . ">9 " . __("columns", "megamenu") . "</option>";
|
|
|
|
|
|
|
201 |
$return .= " </select>";
|
202 |
|
203 |
$return .= " <select id='mm_widget_selector'>";
|
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 |
|
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 |
|
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_depth_for_menu_item_id( $this->menu_item_id, $this->menu_item_objects );
|
52 |
|
53 |
$saved_settings = array_filter( (array) get_post_meta( $this->menu_item_id, '_megamenu', true ) );
|
|
|
54 |
$this->menu_item_meta = array_merge( Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
|
57 |
+
//if ( isset( $_POST['menu_item_depth'] ) ) {
|
58 |
+
// $this->menu_item_depth = absint( $_POST['menu_item_depth'] );
|
59 |
+
//}
|
|
|
|
|
60 |
|
61 |
+
//if ( isset( $_POST['menu_id'] ) ) {
|
62 |
+
// $this->menu_id = absint( $_POST['menu_id'] );
|
63 |
+
//}
|
64 |
}
|
65 |
|
66 |
|
132 |
|
133 |
$this->init();
|
134 |
|
135 |
+
$response = array();
|
136 |
+
|
137 |
+
$response['title'] = $this->menu_item_title;
|
138 |
|
139 |
+
$response = apply_filters( "megamenu_tabs", $response, $this->menu_item_id, $this->menu_id, $this->menu_item_depth, $this->menu_item_meta );
|
140 |
|
141 |
if ( ob_get_contents() ) ob_clean(); // remove any warnings or output from other plugins which may corrupt the response
|
142 |
|
143 |
+
wp_send_json_success( json_encode( $response ) );
|
144 |
}
|
145 |
|
146 |
|
147 |
+
/**
|
148 |
+
* Returns the menu ID for a specified menu item ID
|
149 |
+
*
|
150 |
+
* @since 2.7.5
|
151 |
+
* @param int $menu_item_id
|
152 |
+
* @return int $menu_id
|
153 |
+
*/
|
154 |
+
public function get_menu_id_for_menu_item_id( $menu_item_id ) {
|
155 |
+
$terms = get_the_terms( $menu_item_id, 'nav_menu' );
|
156 |
+
$menu_id = $terms[0]->term_id;
|
157 |
+
return $menu_id;
|
158 |
+
}
|
159 |
+
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Returns the depth of a given menu item ID
|
163 |
+
*
|
164 |
+
* @since 2.7.5
|
165 |
+
* @param int $menu_item_id
|
166 |
+
* @param array $menu_item_objects
|
167 |
+
* @return int $menu_id
|
168 |
+
*/
|
169 |
+
public function get_depth_for_menu_item_id( $menu_item_id, $menu_item_objects ) {
|
170 |
+
$level = 0;
|
171 |
+
$stack = array('0');
|
172 |
+
|
173 |
+
foreach( $menu_item_objects as $key => $item ) {
|
174 |
+
|
175 |
+
while( $item->menu_item_parent != array_pop( $stack ) ) {
|
176 |
+
$level--;
|
177 |
+
}
|
178 |
+
|
179 |
+
$level++;
|
180 |
+
$stack[] = $item->menu_item_parent;
|
181 |
+
$stack[] = $item->ID;
|
182 |
+
|
183 |
+
if ( $item->ID == $menu_item_id ) {
|
184 |
+
return $level - 1;
|
185 |
+
}
|
186 |
+
//$menu[$key]->depth = $level - 1;
|
187 |
+
}
|
188 |
+
|
189 |
+
return false;
|
190 |
+
}
|
191 |
+
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Returns the title of a given menu item ID
|
195 |
+
*
|
196 |
+
* @since 2.7.5
|
197 |
+
* @param int $menu_item_id
|
198 |
+
* @return int $menu_id
|
199 |
+
*/
|
200 |
+
public function get_title_for_menu_item_id( $menu_item_id, $menu_item_objects ) {
|
201 |
+
foreach( $menu_item_objects as $key => $item ) {
|
202 |
+
if ( $item->ID == $menu_item_id ) {
|
203 |
+
return $item->title;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
return false;
|
208 |
+
}
|
209 |
+
|
210 |
/**
|
211 |
* Return the HTML to display in the 'Mega Menu' tab
|
212 |
*
|
214 |
* @return array
|
215 |
*/
|
216 |
public function add_mega_menu_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) {
|
|
|
217 |
if ( $menu_item_depth > 0 ) {
|
218 |
$tabs['mega_menu'] = array(
|
219 |
'title' => __('Sub Menu', 'megamenu'),
|
253 |
$return .= " <option value='7' " . selected( $menu_item_meta['panel_columns'], 7, false ) . ">7 " . __("columns", "megamenu") . "</option>";
|
254 |
$return .= " <option value='8' " . selected( $menu_item_meta['panel_columns'], 8, false ) . ">8 " . __("columns", "megamenu") . "</option>";
|
255 |
$return .= " <option value='9' " . selected( $menu_item_meta['panel_columns'], 9, false ) . ">9 " . __("columns", "megamenu") . "</option>";
|
256 |
+
$return .= " <option value='10' " . selected( $menu_item_meta['panel_columns'], 10, false ) . ">10 " . __("columns", "megamenu") . "</option>";
|
257 |
+
$return .= " <option value='11' " . selected( $menu_item_meta['panel_columns'], 11, false ) . ">11 " . __("columns", "megamenu") . "</option>";
|
258 |
+
$return .= " <option value='12' " . selected( $menu_item_meta['panel_columns'], 12, false ) . ">12 " . __("columns", "megamenu") . "</option>";
|
259 |
$return .= " </select>";
|
260 |
|
261 |
$return .= " <select id='mm_widget_selector'>";
|
classes/nav-menus.class.php
CHANGED
@@ -237,11 +237,8 @@ class Mega_Menu_Nav_Menus {
|
|
237 |
* @since 1.0
|
238 |
*/
|
239 |
public function metabox_contents() {
|
240 |
-
|
241 |
$menu_id = $this->get_selected_menu_id();
|
242 |
-
|
243 |
$this->print_enable_megamenu_options( $menu_id );
|
244 |
-
|
245 |
}
|
246 |
|
247 |
|
@@ -251,27 +248,21 @@ class Mega_Menu_Nav_Menus {
|
|
251 |
* @since 1.0
|
252 |
*/
|
253 |
public function save() {
|
254 |
-
|
255 |
check_ajax_referer( 'megamenu_edit', 'nonce' );
|
256 |
|
257 |
if ( isset( $_POST['menu'] ) && $_POST['menu'] > 0 && is_nav_menu( $_POST['menu'] ) && isset( $_POST['megamenu_meta'] ) ) {
|
258 |
-
|
259 |
$raw_submitted_settings = $_POST['megamenu_meta'];
|
260 |
-
|
261 |
$parsed_submitted_settings = json_decode( stripslashes( $raw_submitted_settings ), true );
|
262 |
-
|
263 |
$submitted_settings = array();
|
264 |
|
265 |
foreach ( $parsed_submitted_settings as $index => $value ) {
|
266 |
$name = $value['name'];
|
267 |
|
268 |
-
// find values between square brackets
|
269 |
-
preg_match_all( "/\[(.*?)\]/", $name, $matches );
|
270 |
|
271 |
if ( isset( $matches[1][0] ) && isset( $matches[1][1] ) ) {
|
272 |
$location = $matches[1][0];
|
273 |
$setting = $matches[1][1];
|
274 |
-
|
275 |
$submitted_settings[$location][$setting] = $value['value'];
|
276 |
}
|
277 |
}
|
@@ -279,27 +270,19 @@ class Mega_Menu_Nav_Menus {
|
|
279 |
$submitted_settings = apply_filters("megamenu_submitted_settings_meta", $submitted_settings);
|
280 |
|
281 |
if ( ! get_option( 'megamenu_settings' ) ) {
|
282 |
-
|
283 |
update_option( 'megamenu_settings', $submitted_settings );
|
284 |
-
|
285 |
} else {
|
286 |
-
|
287 |
$existing_settings = get_option( 'megamenu_settings' );
|
288 |
-
|
289 |
$new_settings = array_merge( $existing_settings, $submitted_settings );
|
290 |
|
291 |
update_option( 'megamenu_settings', $new_settings );
|
292 |
-
|
293 |
}
|
294 |
|
295 |
do_action( "megamenu_after_save_settings" );
|
296 |
-
|
297 |
do_action( "megamenu_delete_cache" );
|
298 |
-
|
299 |
}
|
300 |
|
301 |
wp_die();
|
302 |
-
|
303 |
}
|
304 |
|
305 |
|
@@ -310,30 +293,22 @@ class Mega_Menu_Nav_Menus {
|
|
310 |
* @since 1.0
|
311 |
*/
|
312 |
public function print_enable_megamenu_options( $menu_id ) {
|
313 |
-
|
314 |
$tagged_menu_locations = $this->get_tagged_theme_locations_for_menu_id( $menu_id );
|
315 |
$theme_locations = get_registered_nav_menus();
|
316 |
-
|
317 |
$saved_settings = get_option( 'megamenu_settings' );
|
318 |
|
319 |
if ( ! count( $theme_locations ) ) {
|
320 |
-
|
321 |
$link = '<a href="https://www.megamenu.com/documentation/widget/?utm_source=free&utm_medium=link&utm_campaign=pro" target="_blank">' . __("here", "megamenu") . '</a>';
|
322 |
|
323 |
echo "<p>" . __("This theme does not register any menu locations.", "megamenu") . "</p>";
|
324 |
echo "<p>" . __("You will need to create a new menu location and use the Max Mega Menu widget or shortcode to display the menu on your site.", "megamenu") . "</p>";
|
325 |
echo "<p>" . str_replace( "{link}", $link, __("Click {link} for instructions.", "megamenu") ) . "</p>";
|
326 |
-
|
327 |
} else if ( ! count ( $tagged_menu_locations ) ) {
|
328 |
-
|
329 |
echo "<p>" . __("Please assign this menu to a theme location to enable the Mega Menu settings.", "megamenu") . "</p>";
|
330 |
-
|
331 |
echo "<p>" . __("To assign this menu to a theme location, scroll to the bottom of this page and tag the menu to a 'Display location'.", "megamenu") . "</p>";
|
332 |
-
|
333 |
} else { ?>
|
334 |
|
335 |
<?php if ( count( $tagged_menu_locations ) == 1 ) : ?>
|
336 |
-
|
337 |
<?php
|
338 |
|
339 |
$locations = array_keys( $tagged_menu_locations );
|
@@ -344,33 +319,20 @@ class Mega_Menu_Nav_Menus {
|
|
344 |
}
|
345 |
|
346 |
?>
|
347 |
-
|
348 |
<?php else: ?>
|
349 |
-
|
350 |
<div id='megamenu_accordion'>
|
351 |
-
|
352 |
<?php foreach ( $theme_locations as $location => $name ) : ?>
|
353 |
-
|
354 |
<?php if ( isset( $tagged_menu_locations[ $location ] ) ): ?>
|
355 |
-
|
356 |
<h3 class='theme_settings'><?php echo esc_html( $name ); ?></h3>
|
357 |
-
|
358 |
<div class='accordion_content' style='display: none;'>
|
359 |
<?php $this->settings_table( $location, $saved_settings ); ?>
|
360 |
</div>
|
361 |
-
|
362 |
<?php endif; ?>
|
363 |
-
|
364 |
<?php endforeach;?>
|
365 |
</div>
|
366 |
-
|
367 |
<?php endif; ?>
|
368 |
|
369 |
-
<?php
|
370 |
-
|
371 |
-
submit_button( __( 'Save' ), 'max-mega-menu-save button-primary alignright');
|
372 |
-
|
373 |
-
?>
|
374 |
|
375 |
<span class='spinner'></span>
|
376 |
|
@@ -529,7 +491,7 @@ class Mega_Menu_Nav_Menus {
|
|
529 |
$selected_theme = isset( $settings[$location]['theme'] ) ? $settings[$location]['theme'] : 'default';
|
530 |
|
531 |
foreach ( $themes as $key => $theme ) {
|
532 |
-
echo "<option value='{$key}' " . selected( $selected_theme, $key ) . ">
|
533 |
}
|
534 |
?>
|
535 |
</select>
|
237 |
* @since 1.0
|
238 |
*/
|
239 |
public function metabox_contents() {
|
|
|
240 |
$menu_id = $this->get_selected_menu_id();
|
|
|
241 |
$this->print_enable_megamenu_options( $menu_id );
|
|
|
242 |
}
|
243 |
|
244 |
|
248 |
* @since 1.0
|
249 |
*/
|
250 |
public function save() {
|
|
|
251 |
check_ajax_referer( 'megamenu_edit', 'nonce' );
|
252 |
|
253 |
if ( isset( $_POST['menu'] ) && $_POST['menu'] > 0 && is_nav_menu( $_POST['menu'] ) && isset( $_POST['megamenu_meta'] ) ) {
|
|
|
254 |
$raw_submitted_settings = $_POST['megamenu_meta'];
|
|
|
255 |
$parsed_submitted_settings = json_decode( stripslashes( $raw_submitted_settings ), true );
|
|
|
256 |
$submitted_settings = array();
|
257 |
|
258 |
foreach ( $parsed_submitted_settings as $index => $value ) {
|
259 |
$name = $value['name'];
|
260 |
|
261 |
+
preg_match_all( "/\[(.*?)\]/", $name, $matches ); // find values between square brackets
|
|
|
262 |
|
263 |
if ( isset( $matches[1][0] ) && isset( $matches[1][1] ) ) {
|
264 |
$location = $matches[1][0];
|
265 |
$setting = $matches[1][1];
|
|
|
266 |
$submitted_settings[$location][$setting] = $value['value'];
|
267 |
}
|
268 |
}
|
270 |
$submitted_settings = apply_filters("megamenu_submitted_settings_meta", $submitted_settings);
|
271 |
|
272 |
if ( ! get_option( 'megamenu_settings' ) ) {
|
|
|
273 |
update_option( 'megamenu_settings', $submitted_settings );
|
|
|
274 |
} else {
|
|
|
275 |
$existing_settings = get_option( 'megamenu_settings' );
|
|
|
276 |
$new_settings = array_merge( $existing_settings, $submitted_settings );
|
277 |
|
278 |
update_option( 'megamenu_settings', $new_settings );
|
|
|
279 |
}
|
280 |
|
281 |
do_action( "megamenu_after_save_settings" );
|
|
|
282 |
do_action( "megamenu_delete_cache" );
|
|
|
283 |
}
|
284 |
|
285 |
wp_die();
|
|
|
286 |
}
|
287 |
|
288 |
|
293 |
* @since 1.0
|
294 |
*/
|
295 |
public function print_enable_megamenu_options( $menu_id ) {
|
|
|
296 |
$tagged_menu_locations = $this->get_tagged_theme_locations_for_menu_id( $menu_id );
|
297 |
$theme_locations = get_registered_nav_menus();
|
|
|
298 |
$saved_settings = get_option( 'megamenu_settings' );
|
299 |
|
300 |
if ( ! count( $theme_locations ) ) {
|
|
|
301 |
$link = '<a href="https://www.megamenu.com/documentation/widget/?utm_source=free&utm_medium=link&utm_campaign=pro" target="_blank">' . __("here", "megamenu") . '</a>';
|
302 |
|
303 |
echo "<p>" . __("This theme does not register any menu locations.", "megamenu") . "</p>";
|
304 |
echo "<p>" . __("You will need to create a new menu location and use the Max Mega Menu widget or shortcode to display the menu on your site.", "megamenu") . "</p>";
|
305 |
echo "<p>" . str_replace( "{link}", $link, __("Click {link} for instructions.", "megamenu") ) . "</p>";
|
|
|
306 |
} else if ( ! count ( $tagged_menu_locations ) ) {
|
|
|
307 |
echo "<p>" . __("Please assign this menu to a theme location to enable the Mega Menu settings.", "megamenu") . "</p>";
|
|
|
308 |
echo "<p>" . __("To assign this menu to a theme location, scroll to the bottom of this page and tag the menu to a 'Display location'.", "megamenu") . "</p>";
|
|
|
309 |
} else { ?>
|
310 |
|
311 |
<?php if ( count( $tagged_menu_locations ) == 1 ) : ?>
|
|
|
312 |
<?php
|
313 |
|
314 |
$locations = array_keys( $tagged_menu_locations );
|
319 |
}
|
320 |
|
321 |
?>
|
|
|
322 |
<?php else: ?>
|
|
|
323 |
<div id='megamenu_accordion'>
|
|
|
324 |
<?php foreach ( $theme_locations as $location => $name ) : ?>
|
|
|
325 |
<?php if ( isset( $tagged_menu_locations[ $location ] ) ): ?>
|
|
|
326 |
<h3 class='theme_settings'><?php echo esc_html( $name ); ?></h3>
|
|
|
327 |
<div class='accordion_content' style='display: none;'>
|
328 |
<?php $this->settings_table( $location, $saved_settings ); ?>
|
329 |
</div>
|
|
|
330 |
<?php endif; ?>
|
|
|
331 |
<?php endforeach;?>
|
332 |
</div>
|
|
|
333 |
<?php endif; ?>
|
334 |
|
335 |
+
<?php submit_button( __( 'Save' ), 'max-mega-menu-save button-primary alignright'); ?>
|
|
|
|
|
|
|
|
|
336 |
|
337 |
<span class='spinner'></span>
|
338 |
|
491 |
$selected_theme = isset( $settings[$location]['theme'] ) ? $settings[$location]['theme'] : 'default';
|
492 |
|
493 |
foreach ( $themes as $key => $theme ) {
|
494 |
+
echo "<option value='{$key}' " . selected( $selected_theme, $key ) . ">" . esc_html( $theme['title'] ) . "</option>";
|
495 |
}
|
496 |
?>
|
497 |
</select>
|
classes/settings.class.php
CHANGED
@@ -300,18 +300,33 @@ class Mega_Menu_Settings {
|
|
300 |
|
301 |
}
|
302 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
/**
|
304 |
* Save menu general settings.
|
305 |
*
|
306 |
* @since 1.0
|
307 |
*/
|
308 |
public function save_settings() {
|
309 |
-
|
310 |
check_admin_referer( 'megamenu_save_settings' );
|
311 |
|
312 |
if ( isset( $_POST['settings'] ) && is_array( $_POST['settings'] ) ) {
|
313 |
-
|
314 |
-
$settings = $_POST['settings'];
|
315 |
|
316 |
if ( ! isset( $settings['descriptions'] ) ) {
|
317 |
$settings['descriptions'] = 'disabled';
|
@@ -327,19 +342,16 @@ class Mega_Menu_Settings {
|
|
327 |
|
328 |
$submitted_settings = apply_filters( "megamenu_submitted_settings", $settings );
|
329 |
$existing_settings = get_option( 'megamenu_settings' );
|
330 |
-
|
331 |
$new_settings = array_merge( (array)$existing_settings, $submitted_settings );
|
332 |
|
333 |
update_option( 'megamenu_settings', $new_settings );
|
334 |
-
|
335 |
}
|
336 |
|
337 |
// update location description
|
338 |
if ( isset( $_POST['location'] ) && is_array( $_POST['location'] ) ) {
|
339 |
-
|
340 |
$locations = get_option('megamenu_locations');
|
341 |
-
|
342 |
-
$new_locations = array_merge( (array)$locations, $_POST['location'] );
|
343 |
|
344 |
update_option( 'megamenu_locations', $new_locations );
|
345 |
}
|
@@ -347,14 +359,11 @@ class Mega_Menu_Settings {
|
|
347 |
delete_transient('megamenu_failed_to_write_css_to_filesystem');
|
348 |
|
349 |
do_action("megamenu_after_save_general_settings");
|
350 |
-
|
351 |
do_action("megamenu_delete_cache");
|
352 |
|
353 |
-
|
354 |
$url = isset( $_POST['_wp_http_referer'] ) ? $_POST['_wp_http_referer'] : admin_url( "admin.php?page=maxmegamenu&saved=true" );
|
355 |
|
356 |
$this->redirect( $url );
|
357 |
-
|
358 |
}
|
359 |
|
360 |
|
@@ -371,6 +380,18 @@ class Mega_Menu_Settings {
|
|
371 |
|
372 |
$import = json_decode( stripslashes( $_POST['data'] ), true );
|
373 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
if ( is_array( $import ) ) {
|
375 |
|
376 |
$saved_themes = max_mega_menu_get_themes();
|
@@ -657,7 +678,9 @@ class Mega_Menu_Settings {
|
|
657 |
|
658 |
$icon = "data:image/svg+xml;base64," . $svg;
|
659 |
|
660 |
-
$
|
|
|
|
|
661 |
|
662 |
$tabs = apply_filters("megamenu_menu_tabs", array(
|
663 |
'general_settings' => __("General Settings", "megamenu"),
|
@@ -668,9 +691,9 @@ class Mega_Menu_Settings {
|
|
668 |
|
669 |
foreach ( $tabs as $key => $title ) {
|
670 |
if ( $key == 'general_settings') {
|
671 |
-
add_submenu_page( 'maxmegamenu', __('Max Mega Menu', 'megamenu') . ' - ' . $title, $title,
|
672 |
} else {
|
673 |
-
add_submenu_page( 'maxmegamenu', __('Max Mega Menu', 'megamenu') . ' - ' . $title, $title,
|
674 |
}
|
675 |
}
|
676 |
|
@@ -966,7 +989,7 @@ class Mega_Menu_Settings {
|
|
966 |
<div class='mega-description'><?php _e("Change the name of the location.", "megamenu"); ?></div>
|
967 |
</td>
|
968 |
<td class='mega-value wide'>
|
969 |
-
<input type='text' name='location[<?php echo $location ?>]' value='<?php echo esc_attr( $description ); ?>' />
|
970 |
</td>
|
971 |
</tr>
|
972 |
<?php endif; ?>
|
@@ -985,7 +1008,7 @@ class Mega_Menu_Settings {
|
|
985 |
<div class='mega-description'><?php _e("For use in a theme template (usually header.php)", "megamenu"); ?></div>
|
986 |
</td>
|
987 |
<td class='mega-value'>
|
988 |
-
<textarea readonly="readonly"><?php wp_nav_menu( array( 'theme_location' => '<?php echo $location ?>' ) ); ?></textarea>
|
989 |
</td>
|
990 |
</tr>
|
991 |
<tr>
|
@@ -994,7 +1017,7 @@ class Mega_Menu_Settings {
|
|
994 |
<div class='mega-description'><?php _e("For use in a post or page.", "megamenu"); ?></div>
|
995 |
</td>
|
996 |
<td class='mega-value'>
|
997 |
-
<textarea readonly="readonly">[maxmegamenu location=<?php echo $location ?>]</textarea>
|
998 |
</td>
|
999 |
</tr>
|
1000 |
<tr>
|
@@ -1168,11 +1191,12 @@ class Mega_Menu_Settings {
|
|
1168 |
$diff[$key] = $theme_to_export[$key];
|
1169 |
}
|
1170 |
}
|
|
|
1171 |
if ( isset( $_POST['format'] ) && $_POST['format'] == 'json' ) {
|
1172 |
|
1173 |
echo "<p>" . __("Log into the site you wish to import the theme to. Go to Mega Menu > Tools and paste this into the 'Import Theme' text area:", "megamenu") . "</p>";
|
1174 |
|
1175 |
-
echo "<textarea>" . htmlentities( json_encode( $diff ) ) . "</textarea>";
|
1176 |
|
1177 |
} else {
|
1178 |
$key = strtolower( str_replace(" ", "_", $theme_to_export['title'] ) );
|
@@ -1202,7 +1226,7 @@ class Mega_Menu_Settings {
|
|
1202 |
|
1203 |
echo "<select name='theme_export'>";
|
1204 |
foreach ( $this->themes as $id => $theme ) {
|
1205 |
-
echo "<option value='{$id}'>
|
1206 |
}
|
1207 |
echo "</select>";
|
1208 |
|
@@ -1507,12 +1531,15 @@ class Mega_Menu_Settings {
|
|
1507 |
$selected = $id == $this->id ? 'selected=selected' : '';
|
1508 |
|
1509 |
$list_items .= "<option {$selected} value='" . admin_url("admin.php?page=maxmegamenu_theme_editor&theme={$id}") . "'>";
|
1510 |
-
|
|
|
1511 |
|
1512 |
if ( is_array( $locations ) ) {
|
1513 |
-
$
|
1514 |
}
|
1515 |
|
|
|
|
|
1516 |
$list_items .= "</option>";
|
1517 |
}
|
1518 |
|
@@ -1591,7 +1618,7 @@ class Mega_Menu_Settings {
|
|
1591 |
<a href='<?php echo $duplicate_url ?>'><?php _e("duplicate this theme", "megamenu"); ?></a>
|
1592 |
</div>
|
1593 |
|
1594 |
-
<h3 class='editing_theme'><?php echo __("Editing theme", "megamenu") . ": " . $this->active_theme['title']; ?></h3>
|
1595 |
|
1596 |
<?php
|
1597 |
|
@@ -3860,7 +3887,7 @@ class Mega_Menu_Settings {
|
|
3860 |
foreach ($arrow_icons as $code => $class) {
|
3861 |
$name = str_replace('dashicons-', '', $class);
|
3862 |
$name = ucwords(str_replace(array('-','arrow'), ' ', $name));
|
3863 |
-
echo "<option data-class='{$class}' value='{$code}' " . selected( $value, $code, false ) . ">" . $name . "</option>";
|
3864 |
}
|
3865 |
|
3866 |
?>
|
@@ -3893,8 +3920,8 @@ class Mega_Menu_Settings {
|
|
3893 |
}
|
3894 |
|
3895 |
echo "<div class='mm-picker-container'>";
|
3896 |
-
echo " <input type='text' class='mm_colorpicker' name='settings[$key]' value='
|
3897 |
-
echo " <div class='chosen-color'>
|
3898 |
echo "</div>";
|
3899 |
|
3900 |
}
|
@@ -3933,7 +3960,7 @@ class Mega_Menu_Settings {
|
|
3933 |
echo "<select name='settings[$key]'>";
|
3934 |
|
3935 |
foreach ( $options as $weight => $name ) {
|
3936 |
-
echo "<option value='
|
3937 |
}
|
3938 |
|
3939 |
echo "</select>";
|
@@ -3971,7 +3998,8 @@ class Mega_Menu_Settings {
|
|
3971 |
*/
|
3972 |
public function print_theme_textarea_option( $key ) {
|
3973 |
|
3974 |
-
$value = $this->active_theme[$key];
|
|
|
3975 |
?>
|
3976 |
|
3977 |
<textarea id='codemirror' name='settings[<?php echo $key ?>]'><?php echo stripslashes( $value ) ?></textarea>
|
@@ -4029,7 +4057,7 @@ class Mega_Menu_Settings {
|
|
4029 |
$font = esc_attr( stripslashes( $font ) );
|
4030 |
$parts = explode(",", $font);
|
4031 |
$font_name = trim($parts[0]);
|
4032 |
-
echo "<option value=\"{$font}\" " . selected( $orig_font, htmlspecialchars_decode($value) ) . ">
|
4033 |
}
|
4034 |
|
4035 |
echo "</select>";
|
@@ -4047,7 +4075,7 @@ class Mega_Menu_Settings {
|
|
4047 |
|
4048 |
$value = $this->active_theme[$key];
|
4049 |
|
4050 |
-
echo "<input class='mega-setting-{$key}' type='text' name='settings[$key]' value='
|
4051 |
|
4052 |
}
|
4053 |
|
300 |
|
301 |
}
|
302 |
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Sanitize multidimensional array
|
306 |
+
*
|
307 |
+
* @since 2.7.5
|
308 |
+
*/
|
309 |
+
public function sanitize_array( &$array ) {
|
310 |
+
foreach ( $array as &$value) {
|
311 |
+
if ( ! is_array( $value ) ) {
|
312 |
+
$value = sanitize_textarea_field( $value );
|
313 |
+
} else {
|
314 |
+
$this->sanitize_array( $value );
|
315 |
+
}
|
316 |
+
}
|
317 |
+
return $array;
|
318 |
+
}
|
319 |
+
|
320 |
/**
|
321 |
* Save menu general settings.
|
322 |
*
|
323 |
* @since 1.0
|
324 |
*/
|
325 |
public function save_settings() {
|
|
|
326 |
check_admin_referer( 'megamenu_save_settings' );
|
327 |
|
328 |
if ( isset( $_POST['settings'] ) && is_array( $_POST['settings'] ) ) {
|
329 |
+
$settings = $this->sanitize_array( $_POST['settings'] );
|
|
|
330 |
|
331 |
if ( ! isset( $settings['descriptions'] ) ) {
|
332 |
$settings['descriptions'] = 'disabled';
|
342 |
|
343 |
$submitted_settings = apply_filters( "megamenu_submitted_settings", $settings );
|
344 |
$existing_settings = get_option( 'megamenu_settings' );
|
|
|
345 |
$new_settings = array_merge( (array)$existing_settings, $submitted_settings );
|
346 |
|
347 |
update_option( 'megamenu_settings', $new_settings );
|
|
|
348 |
}
|
349 |
|
350 |
// update location description
|
351 |
if ( isset( $_POST['location'] ) && is_array( $_POST['location'] ) ) {
|
352 |
+
$location = array_map( 'sanitize_text_field', $_POST['location'] );
|
353 |
$locations = get_option('megamenu_locations');
|
354 |
+
$new_locations = array_merge( (array)$locations, $location );
|
|
|
355 |
|
356 |
update_option( 'megamenu_locations', $new_locations );
|
357 |
}
|
359 |
delete_transient('megamenu_failed_to_write_css_to_filesystem');
|
360 |
|
361 |
do_action("megamenu_after_save_general_settings");
|
|
|
362 |
do_action("megamenu_delete_cache");
|
363 |
|
|
|
364 |
$url = isset( $_POST['_wp_http_referer'] ) ? $_POST['_wp_http_referer'] : admin_url( "admin.php?page=maxmegamenu&saved=true" );
|
365 |
|
366 |
$this->redirect( $url );
|
|
|
367 |
}
|
368 |
|
369 |
|
380 |
|
381 |
$import = json_decode( stripslashes( $_POST['data'] ), true );
|
382 |
|
383 |
+
$sanitized = array();
|
384 |
+
|
385 |
+
foreach ( $import as $key => $value ) {
|
386 |
+
if ( $key == 'custom_css' ) {
|
387 |
+
$sanitized[$key] = sanitize_textarea_field( $value );
|
388 |
+
} else {
|
389 |
+
$sanitized[$key] = sanitize_text_field( $value );
|
390 |
+
}
|
391 |
+
}
|
392 |
+
|
393 |
+
$import = $sanitized;
|
394 |
+
|
395 |
if ( is_array( $import ) ) {
|
396 |
|
397 |
$saved_themes = max_mega_menu_get_themes();
|
678 |
|
679 |
$icon = "data:image/svg+xml;base64," . $svg;
|
680 |
|
681 |
+
$capability = apply_filters("megamenu_options_capability", "edit_theme_options");
|
682 |
+
|
683 |
+
$page = add_menu_page( __('Max Mega Menu', 'megamenu'), __('Mega Menu', 'megamenu'), $capability, 'maxmegamenu', array($this, 'page'), $icon );
|
684 |
|
685 |
$tabs = apply_filters("megamenu_menu_tabs", array(
|
686 |
'general_settings' => __("General Settings", "megamenu"),
|
691 |
|
692 |
foreach ( $tabs as $key => $title ) {
|
693 |
if ( $key == 'general_settings') {
|
694 |
+
add_submenu_page( 'maxmegamenu', __('Max Mega Menu', 'megamenu') . ' - ' . $title, $title, $capability, 'maxmegamenu', array($this, 'page') );
|
695 |
} else {
|
696 |
+
add_submenu_page( 'maxmegamenu', __('Max Mega Menu', 'megamenu') . ' - ' . $title, $title, $capability, 'maxmegamenu_' . $key, array($this, 'page') );
|
697 |
}
|
698 |
}
|
699 |
|
989 |
<div class='mega-description'><?php _e("Change the name of the location.", "megamenu"); ?></div>
|
990 |
</td>
|
991 |
<td class='mega-value wide'>
|
992 |
+
<input type='text' name='location[<?php echo esc_attr($location) ?>]' value='<?php echo esc_attr( $description ); ?>' />
|
993 |
</td>
|
994 |
</tr>
|
995 |
<?php endif; ?>
|
1008 |
<div class='mega-description'><?php _e("For use in a theme template (usually header.php)", "megamenu"); ?></div>
|
1009 |
</td>
|
1010 |
<td class='mega-value'>
|
1011 |
+
<textarea readonly="readonly"><?php wp_nav_menu( array( 'theme_location' => '<?php echo esc_attr( $location ) ?>' ) ); ?></textarea>
|
1012 |
</td>
|
1013 |
</tr>
|
1014 |
<tr>
|
1017 |
<div class='mega-description'><?php _e("For use in a post or page.", "megamenu"); ?></div>
|
1018 |
</td>
|
1019 |
<td class='mega-value'>
|
1020 |
+
<textarea readonly="readonly">[maxmegamenu location=<?php echo esc_attr( $location ) ?>]</textarea>
|
1021 |
</td>
|
1022 |
</tr>
|
1023 |
<tr>
|
1191 |
$diff[$key] = $theme_to_export[$key];
|
1192 |
}
|
1193 |
}
|
1194 |
+
|
1195 |
if ( isset( $_POST['format'] ) && $_POST['format'] == 'json' ) {
|
1196 |
|
1197 |
echo "<p>" . __("Log into the site you wish to import the theme to. Go to Mega Menu > Tools and paste this into the 'Import Theme' text area:", "megamenu") . "</p>";
|
1198 |
|
1199 |
+
echo "<textarea>" . sanitize_textarea_field( htmlentities( json_encode( $diff ) ) ) . "</textarea>";
|
1200 |
|
1201 |
} else {
|
1202 |
$key = strtolower( str_replace(" ", "_", $theme_to_export['title'] ) );
|
1226 |
|
1227 |
echo "<select name='theme_export'>";
|
1228 |
foreach ( $this->themes as $id => $theme ) {
|
1229 |
+
echo "<option value='{$id}'>" . esc_html( $theme['title'] ) . "</option>";
|
1230 |
}
|
1231 |
echo "</select>";
|
1232 |
|
1531 |
$selected = $id == $this->id ? 'selected=selected' : '';
|
1532 |
|
1533 |
$list_items .= "<option {$selected} value='" . admin_url("admin.php?page=maxmegamenu_theme_editor&theme={$id}") . "'>";
|
1534 |
+
|
1535 |
+
$title = $theme['title'];
|
1536 |
|
1537 |
if ( is_array( $locations ) ) {
|
1538 |
+
$title .= " (" . implode( ", ", $locations ) . ")";
|
1539 |
}
|
1540 |
|
1541 |
+
$list_items .= esc_html( $title );
|
1542 |
+
|
1543 |
$list_items .= "</option>";
|
1544 |
}
|
1545 |
|
1618 |
<a href='<?php echo $duplicate_url ?>'><?php _e("duplicate this theme", "megamenu"); ?></a>
|
1619 |
</div>
|
1620 |
|
1621 |
+
<h3 class='editing_theme'><?php echo __("Editing theme", "megamenu") . ": " . esc_html( $this->active_theme['title'] ); ?></h3>
|
1622 |
|
1623 |
<?php
|
1624 |
|
3887 |
foreach ($arrow_icons as $code => $class) {
|
3888 |
$name = str_replace('dashicons-', '', $class);
|
3889 |
$name = ucwords(str_replace(array('-','arrow'), ' ', $name));
|
3890 |
+
echo "<option data-class='{$class}' value='{$code}' " . selected( $value, $code, false ) . ">" . esc_html( $name ) . "</option>";
|
3891 |
}
|
3892 |
|
3893 |
?>
|
3920 |
}
|
3921 |
|
3922 |
echo "<div class='mm-picker-container'>";
|
3923 |
+
echo " <input type='text' class='mm_colorpicker' name='settings[$key]' value='" . esc_attr( $value ) . "' />";
|
3924 |
+
echo " <div class='chosen-color'>" . esc_html( $value_text ) . "</div>";
|
3925 |
echo "</div>";
|
3926 |
|
3927 |
}
|
3960 |
echo "<select name='settings[$key]'>";
|
3961 |
|
3962 |
foreach ( $options as $weight => $name ) {
|
3963 |
+
echo "<option value='" . esc_attr( $weight ) . "' " . selected( $value, $weight, false ) . ">" . esc_html( $name ) . "</option>";
|
3964 |
}
|
3965 |
|
3966 |
echo "</select>";
|
3998 |
*/
|
3999 |
public function print_theme_textarea_option( $key ) {
|
4000 |
|
4001 |
+
$value = sanitize_textarea_field( $this->active_theme[$key] );
|
4002 |
+
|
4003 |
?>
|
4004 |
|
4005 |
<textarea id='codemirror' name='settings[<?php echo $key ?>]'><?php echo stripslashes( $value ) ?></textarea>
|
4057 |
$font = esc_attr( stripslashes( $font ) );
|
4058 |
$parts = explode(",", $font);
|
4059 |
$font_name = trim($parts[0]);
|
4060 |
+
echo "<option value=\"{$font}\" " . selected( $orig_font, htmlspecialchars_decode( $value ) ) . ">" . esc_html( $font_name ) . "</option>";
|
4061 |
}
|
4062 |
|
4063 |
echo "</select>";
|
4075 |
|
4076 |
$value = $this->active_theme[$key];
|
4077 |
|
4078 |
+
echo "<input class='mega-setting-{$key}' type='text' name='settings[$key]' value='" . esc_attr( $value ) . "' />";
|
4079 |
|
4080 |
}
|
4081 |
|
classes/style-manager.class.php
CHANGED
@@ -710,6 +710,10 @@ final class Mega_Menu_Style_Manager {
|
|
710 |
|
711 |
$vars['wp_theme'] = strtolower( str_replace( array( ".", " " ), "_", $theme_id ) );
|
712 |
|
|
|
|
|
|
|
|
|
713 |
if ( ! function_exists( 'is_plugin_active' )) {
|
714 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
715 |
}
|
@@ -898,8 +902,17 @@ final class Mega_Menu_Style_Manager {
|
|
898 |
|
899 |
$scripts_in_footer = defined( 'MEGAMENU_SCRIPTS_IN_FOOTER' ) ? MEGAMENU_SCRIPTS_IN_FOOTER : true;
|
900 |
|
901 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
902 |
|
|
|
|
|
903 |
$params = apply_filters("megamenu_javascript_localisation",
|
904 |
array(
|
905 |
"timeout" => 300,
|
@@ -907,7 +920,7 @@ final class Mega_Menu_Style_Manager {
|
|
907 |
)
|
908 |
);
|
909 |
|
910 |
-
wp_localize_script(
|
911 |
}
|
912 |
|
913 |
/**
|
710 |
|
711 |
$vars['wp_theme'] = strtolower( str_replace( array( ".", " " ), "_", $theme_id ) );
|
712 |
|
713 |
+
if ( empty( $vars['wp_theme'] ) ) {
|
714 |
+
$vars['wp_theme'] = 'unknown';
|
715 |
+
}
|
716 |
+
|
717 |
if ( ! function_exists( 'is_plugin_active' )) {
|
718 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
719 |
}
|
902 |
|
903 |
$scripts_in_footer = defined( 'MEGAMENU_SCRIPTS_IN_FOOTER' ) ? MEGAMENU_SCRIPTS_IN_FOOTER : true;
|
904 |
|
905 |
+
///** change the script handle to prevent conflict with theme files */
|
906 |
+
//function megamenu_script_handle() {
|
907 |
+
// return "maxmegamenu";
|
908 |
+
//}
|
909 |
+
//add_filter("megamenu_javascript_handle", "megamenu_script_handle");*/
|
910 |
+
$handle = apply_filters("megamenu_javascript_handle", "megamenu");
|
911 |
+
|
912 |
+
wp_enqueue_script( $handle, $js_path, $dependencies, MEGAMENU_VERSION, $scripts_in_footer );
|
913 |
|
914 |
+
// @todo: remove the following code in future update. Only here to prevent JS errors for users with
|
915 |
+
// cached versions of maxmegamenu.js
|
916 |
$params = apply_filters("megamenu_javascript_localisation",
|
917 |
array(
|
918 |
"timeout" => 300,
|
920 |
)
|
921 |
);
|
922 |
|
923 |
+
wp_localize_script( $handle, 'megamenu', $params );
|
924 |
}
|
925 |
|
926 |
/**
|
classes/widget-manager.class.php
CHANGED
@@ -153,6 +153,8 @@ class Mega_Menu_Widget_Manager {
|
|
153 |
<option value='2' <?php selected( $menu_item_meta['submenu_columns'], 2, true ) ?> >2 <?php __("columns", "megamenu") ?></option>
|
154 |
<option value='3' <?php selected( $menu_item_meta['submenu_columns'], 3, true ) ?> >3 <?php __("columns", "megamenu") ?></option>
|
155 |
<option value='4' <?php selected( $menu_item_meta['submenu_columns'], 4, true ) ?> >4 <?php __("columns", "megamenu") ?></option>
|
|
|
|
|
156 |
</select>
|
157 |
</p>
|
158 |
<p>
|
153 |
<option value='2' <?php selected( $menu_item_meta['submenu_columns'], 2, true ) ?> >2 <?php __("columns", "megamenu") ?></option>
|
154 |
<option value='3' <?php selected( $menu_item_meta['submenu_columns'], 3, true ) ?> >3 <?php __("columns", "megamenu") ?></option>
|
155 |
<option value='4' <?php selected( $menu_item_meta['submenu_columns'], 4, true ) ?> >4 <?php __("columns", "megamenu") ?></option>
|
156 |
+
<option value='5' <?php selected( $menu_item_meta['submenu_columns'], 5, true ) ?> >5 <?php __("columns", "megamenu") ?></option>
|
157 |
+
<option value='6' <?php selected( $menu_item_meta['submenu_columns'], 6, true ) ?> >6 <?php __("columns", "megamenu") ?></option>
|
158 |
</select>
|
159 |
</p>
|
160 |
<p>
|
classes/widget.class.php
CHANGED
@@ -31,6 +31,10 @@ class Mega_Menu_Widget extends WP_Widget {
|
|
31 |
* @param array $instance Saved values from database.
|
32 |
*/
|
33 |
public function widget( $args, $instance ) {
|
|
|
|
|
|
|
|
|
34 |
extract( $args );
|
35 |
|
36 |
if ( isset( $instance['location'] ) ) {
|
31 |
* @param array $instance Saved values from database.
|
32 |
*/
|
33 |
public function widget( $args, $instance ) {
|
34 |
+
if ( ! is_array( $args ) ) {
|
35 |
+
$args = array( "before_widget" => "", "after_widget" => "");
|
36 |
+
}
|
37 |
+
|
38 |
extract( $args );
|
39 |
|
40 |
if ( isset( $instance['location'] ) ) {
|
css/admin/admin.css
CHANGED
@@ -247,13 +247,15 @@
|
|
247 |
margin-top: 20px; }
|
248 |
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid button.mega-add-row,
|
249 |
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid button.mega-add-column {
|
250 |
-
height:
|
251 |
-
|
|
|
252 |
font-size: 12px;
|
253 |
padding-left: 4px; }
|
254 |
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid button.mega-add-row .dashicons-plus,
|
255 |
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid button.mega-add-column .dashicons-plus {
|
256 |
-
margin-
|
|
|
257 |
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid > .drop-area {
|
258 |
margin-top: 20px;
|
259 |
border: 1px dashed #999;
|
@@ -834,9 +836,9 @@
|
|
834 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='2'] .widget[data-columns='2'] {
|
835 |
width: 100%; }
|
836 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='3'] .widget[data-columns='1'] {
|
837 |
-
width: 33.
|
838 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='3'] .widget[data-columns='2'] {
|
839 |
-
width: 66.
|
840 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='3'] .widget[data-columns='3'] {
|
841 |
width: 100%; }
|
842 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='4'] .widget[data-columns='1'] {
|
@@ -858,29 +860,29 @@
|
|
858 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='5'] .widget[data-columns='5'] {
|
859 |
width: 100%; }
|
860 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='6'] .widget[data-columns='1'] {
|
861 |
-
width: 16.
|
862 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='6'] .widget[data-columns='2'] {
|
863 |
-
width: 33.
|
864 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='6'] .widget[data-columns='3'] {
|
865 |
width: 50%; }
|
866 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='6'] .widget[data-columns='4'] {
|
867 |
-
width: 66.
|
868 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='6'] .widget[data-columns='5'] {
|
869 |
-
width: 83.
|
870 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='6'] .widget[data-columns='6'] {
|
871 |
width: 100%; }
|
872 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='1'] {
|
873 |
-
width: 14.
|
874 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='2'] {
|
875 |
-
width: 28.
|
876 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='3'] {
|
877 |
-
width: 42.
|
878 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='4'] {
|
879 |
-
width: 57.
|
880 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='5'] {
|
881 |
-
width: 71.
|
882 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='6'] {
|
883 |
-
width: 85.
|
884 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='7'] {
|
885 |
width: 100%; }
|
886 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='8'] .widget[data-columns='1'] {
|
@@ -900,23 +902,89 @@
|
|
900 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='8'] .widget[data-columns='8'] {
|
901 |
width: 100%; }
|
902 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='1'] {
|
903 |
-
width: 11.
|
904 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='2'] {
|
905 |
-
width: 22.
|
906 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='3'] {
|
907 |
-
width: 33.
|
908 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='4'] {
|
909 |
-
width: 44.
|
910 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='5'] {
|
911 |
-
width: 55.
|
912 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='6'] {
|
913 |
-
width: 66.
|
914 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='7'] {
|
915 |
-
width: 77.
|
916 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='8'] {
|
917 |
-
width: 88.
|
918 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='9'] {
|
919 |
width: 100%; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
920 |
.nav-menus-php #cboxContent label[for='mm_enable_mega_menu'] {
|
921 |
font-size: 12px; }
|
922 |
.nav-menus-php #cboxContent .menu_icon .icon_selector {
|
@@ -1080,7 +1148,7 @@
|
|
1080 |
|
1081 |
.nav-menus-php .mm_launch {
|
1082 |
margin-left: 10px;
|
1083 |
-
font-size:
|
1084 |
cursor: pointer;
|
1085 |
color: white;
|
1086 |
display: inline-block;
|
@@ -1104,9 +1172,9 @@
|
|
1104 |
font-family: dashicons;
|
1105 |
content: "\f111";
|
1106 |
font-size: 10px;
|
1107 |
-
margin-right:
|
1108 |
display: inline-block;
|
1109 |
-
vertical-align:
|
1110 |
|
1111 |
.nav-menus-php .menu-item-bar .menu-item-handle:hover .mm_launch {
|
1112 |
opacity: 1; }
|
247 |
margin-top: 20px; }
|
248 |
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid button.mega-add-row,
|
249 |
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid button.mega-add-column {
|
250 |
+
height: 23px;
|
251 |
+
min-height: 23px;
|
252 |
+
line-height: 22px;
|
253 |
font-size: 12px;
|
254 |
padding-left: 4px; }
|
255 |
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid button.mega-add-row .dashicons-plus,
|
256 |
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid button.mega-add-column .dashicons-plus {
|
257 |
+
margin-right: 4px;
|
258 |
+
line-height: 22px; }
|
259 |
.nav-menus-php #cboxContent .mm_content.mega_menu #megamenu-grid > .drop-area {
|
260 |
margin-top: 20px;
|
261 |
border: 1px dashed #999;
|
836 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='2'] .widget[data-columns='2'] {
|
837 |
width: 100%; }
|
838 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='3'] .widget[data-columns='1'] {
|
839 |
+
width: 33.33333%; }
|
840 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='3'] .widget[data-columns='2'] {
|
841 |
+
width: 66.66667%; }
|
842 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='3'] .widget[data-columns='3'] {
|
843 |
width: 100%; }
|
844 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='4'] .widget[data-columns='1'] {
|
860 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='5'] .widget[data-columns='5'] {
|
861 |
width: 100%; }
|
862 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='6'] .widget[data-columns='1'] {
|
863 |
+
width: 16.66667%; }
|
864 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='6'] .widget[data-columns='2'] {
|
865 |
+
width: 33.33333%; }
|
866 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='6'] .widget[data-columns='3'] {
|
867 |
width: 50%; }
|
868 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='6'] .widget[data-columns='4'] {
|
869 |
+
width: 66.66667%; }
|
870 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='6'] .widget[data-columns='5'] {
|
871 |
+
width: 83.33333%; }
|
872 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='6'] .widget[data-columns='6'] {
|
873 |
width: 100%; }
|
874 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='1'] {
|
875 |
+
width: 14.28571%; }
|
876 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='2'] {
|
877 |
+
width: 28.57143%; }
|
878 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='3'] {
|
879 |
+
width: 42.85714%; }
|
880 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='4'] {
|
881 |
+
width: 57.14286%; }
|
882 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='5'] {
|
883 |
+
width: 71.42857%; }
|
884 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='6'] {
|
885 |
+
width: 85.71429%; }
|
886 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='7'] .widget[data-columns='7'] {
|
887 |
width: 100%; }
|
888 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='8'] .widget[data-columns='1'] {
|
902 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='8'] .widget[data-columns='8'] {
|
903 |
width: 100%; }
|
904 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='1'] {
|
905 |
+
width: 11.11111%; }
|
906 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='2'] {
|
907 |
+
width: 22.22222%; }
|
908 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='3'] {
|
909 |
+
width: 33.33333%; }
|
910 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='4'] {
|
911 |
+
width: 44.44444%; }
|
912 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='5'] {
|
913 |
+
width: 55.55556%; }
|
914 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='6'] {
|
915 |
+
width: 66.66667%; }
|
916 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='7'] {
|
917 |
+
width: 77.77778%; }
|
918 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='8'] {
|
919 |
+
width: 88.88889%; }
|
920 |
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='9'] .widget[data-columns='9'] {
|
921 |
width: 100%; }
|
922 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='10'] .widget[data-columns='1'] {
|
923 |
+
width: 10%; }
|
924 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='10'] .widget[data-columns='2'] {
|
925 |
+
width: 20%; }
|
926 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='10'] .widget[data-columns='3'] {
|
927 |
+
width: 30%; }
|
928 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='10'] .widget[data-columns='4'] {
|
929 |
+
width: 40%; }
|
930 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='10'] .widget[data-columns='5'] {
|
931 |
+
width: 50%; }
|
932 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='10'] .widget[data-columns='6'] {
|
933 |
+
width: 60%; }
|
934 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='10'] .widget[data-columns='7'] {
|
935 |
+
width: 70%; }
|
936 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='10'] .widget[data-columns='8'] {
|
937 |
+
width: 80%; }
|
938 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='10'] .widget[data-columns='9'] {
|
939 |
+
width: 90%; }
|
940 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='10'] .widget[data-columns='10'] {
|
941 |
+
width: 100%; }
|
942 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='11'] .widget[data-columns='1'] {
|
943 |
+
width: 9.09091%; }
|
944 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='11'] .widget[data-columns='2'] {
|
945 |
+
width: 18.18182%; }
|
946 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='11'] .widget[data-columns='3'] {
|
947 |
+
width: 27.27273%; }
|
948 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='11'] .widget[data-columns='4'] {
|
949 |
+
width: 36.36364%; }
|
950 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='11'] .widget[data-columns='5'] {
|
951 |
+
width: 45.45455%; }
|
952 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='11'] .widget[data-columns='6'] {
|
953 |
+
width: 54.54545%; }
|
954 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='11'] .widget[data-columns='7'] {
|
955 |
+
width: 63.63636%; }
|
956 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='11'] .widget[data-columns='8'] {
|
957 |
+
width: 72.72727%; }
|
958 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='11'] .widget[data-columns='9'] {
|
959 |
+
width: 81.81818%; }
|
960 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='11'] .widget[data-columns='10'] {
|
961 |
+
width: 90.90909%; }
|
962 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='11'] .widget[data-columns='11'] {
|
963 |
+
width: 100%; }
|
964 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='12'] .widget[data-columns='1'] {
|
965 |
+
width: 8.33333%; }
|
966 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='12'] .widget[data-columns='2'] {
|
967 |
+
width: 16.66667%; }
|
968 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='12'] .widget[data-columns='3'] {
|
969 |
+
width: 25%; }
|
970 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='12'] .widget[data-columns='4'] {
|
971 |
+
width: 33.33333%; }
|
972 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='12'] .widget[data-columns='5'] {
|
973 |
+
width: 41.66667%; }
|
974 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='12'] .widget[data-columns='6'] {
|
975 |
+
width: 50%; }
|
976 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='12'] .widget[data-columns='7'] {
|
977 |
+
width: 58.33333%; }
|
978 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='12'] .widget[data-columns='8'] {
|
979 |
+
width: 66.66667%; }
|
980 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='12'] .widget[data-columns='9'] {
|
981 |
+
width: 75%; }
|
982 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='12'] .widget[data-columns='10'] {
|
983 |
+
width: 83.33333%; }
|
984 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='12'] .widget[data-columns='11'] {
|
985 |
+
width: 91.66667%; }
|
986 |
+
.nav-menus-php #cboxContent .mm_content.mega_menu #widgets[data-columns='12'] .widget[data-columns='12'] {
|
987 |
+
width: 100%; }
|
988 |
.nav-menus-php #cboxContent label[for='mm_enable_mega_menu'] {
|
989 |
font-size: 12px; }
|
990 |
.nav-menus-php #cboxContent .menu_icon .icon_selector {
|
1148 |
|
1149 |
.nav-menus-php .mm_launch {
|
1150 |
margin-left: 10px;
|
1151 |
+
font-size: 12px;
|
1152 |
cursor: pointer;
|
1153 |
color: white;
|
1154 |
display: inline-block;
|
1172 |
font-family: dashicons;
|
1173 |
content: "\f111";
|
1174 |
font-size: 10px;
|
1175 |
+
margin-right: 4px;
|
1176 |
display: inline-block;
|
1177 |
+
vertical-align: middle; }
|
1178 |
|
1179 |
.nav-menus-php .menu-item-bar .menu-item-handle:hover .mm_launch {
|
1180 |
opacity: 1; }
|
css/admin/admin.scss
CHANGED
@@ -364,13 +364,15 @@ $header_height: 75px;
|
|
364 |
|
365 |
button.mega-add-row,
|
366 |
button.mega-add-column {
|
367 |
-
height:
|
368 |
-
|
|
|
369 |
font-size: 12px;
|
370 |
padding-left: 4px;
|
371 |
|
372 |
.dashicons-plus {
|
373 |
-
margin-
|
|
|
374 |
}
|
375 |
}
|
376 |
|
@@ -1055,167 +1057,16 @@ $header_height: 75px;
|
|
1055 |
}
|
1056 |
}
|
1057 |
|
1058 |
-
#widgets
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
width: 50%;
|
1067 |
-
}
|
1068 |
-
.widget[data-columns='2'] {
|
1069 |
-
width: 100%;
|
1070 |
-
}
|
1071 |
-
}
|
1072 |
-
|
1073 |
-
#widgets[data-columns='3'] {
|
1074 |
-
.widget[data-columns='1'] {
|
1075 |
-
width: 33.3%;
|
1076 |
-
}
|
1077 |
-
.widget[data-columns='2'] {
|
1078 |
-
width: 66.6%;
|
1079 |
-
}
|
1080 |
-
.widget[data-columns='3'] {
|
1081 |
-
width: 100%;
|
1082 |
-
}
|
1083 |
-
}
|
1084 |
-
|
1085 |
-
#widgets[data-columns='4'] {
|
1086 |
-
.widget[data-columns='1'] {
|
1087 |
-
width: 25%;
|
1088 |
-
}
|
1089 |
-
.widget[data-columns='2'] {
|
1090 |
-
width: 50%;
|
1091 |
-
}
|
1092 |
-
.widget[data-columns='3'] {
|
1093 |
-
width: 75%;
|
1094 |
-
}
|
1095 |
-
.widget[data-columns='4'] {
|
1096 |
-
width: 100%;
|
1097 |
-
}
|
1098 |
-
}
|
1099 |
-
|
1100 |
-
#widgets[data-columns='5'] {
|
1101 |
-
.widget[data-columns='1'] {
|
1102 |
-
width: 20%;
|
1103 |
-
}
|
1104 |
-
.widget[data-columns='2'] {
|
1105 |
-
width: 40%;
|
1106 |
-
}
|
1107 |
-
.widget[data-columns='3'] {
|
1108 |
-
width: 60%;
|
1109 |
-
}
|
1110 |
-
.widget[data-columns='4'] {
|
1111 |
-
width: 80%;
|
1112 |
-
}
|
1113 |
-
.widget[data-columns='5'] {
|
1114 |
-
width: 100%;
|
1115 |
-
}
|
1116 |
-
}
|
1117 |
-
|
1118 |
-
#widgets[data-columns='6'] {
|
1119 |
-
.widget[data-columns='1'] {
|
1120 |
-
width: 16.6%;
|
1121 |
-
}
|
1122 |
-
.widget[data-columns='2'] {
|
1123 |
-
width: 33.3%;
|
1124 |
-
}
|
1125 |
-
.widget[data-columns='3'] {
|
1126 |
-
width: 50%;
|
1127 |
-
}
|
1128 |
-
.widget[data-columns='4'] {
|
1129 |
-
width: 66.6%;
|
1130 |
-
}
|
1131 |
-
.widget[data-columns='5'] {
|
1132 |
-
width: 83.3%;
|
1133 |
-
}
|
1134 |
-
.widget[data-columns='6'] {
|
1135 |
-
width: 100%;
|
1136 |
-
}
|
1137 |
-
}
|
1138 |
-
|
1139 |
-
#widgets[data-columns='7'] {
|
1140 |
-
.widget[data-columns='1'] {
|
1141 |
-
width: 14.28%;
|
1142 |
-
}
|
1143 |
-
.widget[data-columns='2'] {
|
1144 |
-
width: 28.57%;
|
1145 |
-
}
|
1146 |
-
.widget[data-columns='3'] {
|
1147 |
-
width: 42.85%;
|
1148 |
-
}
|
1149 |
-
.widget[data-columns='4'] {
|
1150 |
-
width: 57.14%;
|
1151 |
-
}
|
1152 |
-
.widget[data-columns='5'] {
|
1153 |
-
width: 71.42%;
|
1154 |
-
}
|
1155 |
-
.widget[data-columns='6'] {
|
1156 |
-
width: 85.71%;
|
1157 |
-
}
|
1158 |
-
.widget[data-columns='7'] {
|
1159 |
-
width: 100%;
|
1160 |
-
}
|
1161 |
-
}
|
1162 |
-
|
1163 |
-
#widgets[data-columns='8'] {
|
1164 |
-
.widget[data-columns='1'] {
|
1165 |
-
width: 12.5%;
|
1166 |
-
}
|
1167 |
-
.widget[data-columns='2'] {
|
1168 |
-
width: 25%;
|
1169 |
-
}
|
1170 |
-
.widget[data-columns='3'] {
|
1171 |
-
width: 37.5%;
|
1172 |
-
}
|
1173 |
-
.widget[data-columns='4'] {
|
1174 |
-
width: 50%;
|
1175 |
-
}
|
1176 |
-
.widget[data-columns='5'] {
|
1177 |
-
width: 62.5%;
|
1178 |
-
}
|
1179 |
-
.widget[data-columns='6'] {
|
1180 |
-
width: 75%;
|
1181 |
-
}
|
1182 |
-
.widget[data-columns='7'] {
|
1183 |
-
width: 87.5%;
|
1184 |
-
}
|
1185 |
-
.widget[data-columns='8'] {
|
1186 |
-
width: 100%;
|
1187 |
-
}
|
1188 |
}
|
1189 |
|
1190 |
-
#widgets[data-columns='9'] {
|
1191 |
-
.widget[data-columns='1'] {
|
1192 |
-
width: 11.11%;
|
1193 |
-
}
|
1194 |
-
.widget[data-columns='2'] {
|
1195 |
-
width: 22.22%;
|
1196 |
-
}
|
1197 |
-
.widget[data-columns='3'] {
|
1198 |
-
width: 33.33%;
|
1199 |
-
}
|
1200 |
-
.widget[data-columns='4'] {
|
1201 |
-
width: 44.44%;
|
1202 |
-
}
|
1203 |
-
.widget[data-columns='5'] {
|
1204 |
-
width: 55.55%;
|
1205 |
-
}
|
1206 |
-
.widget[data-columns='6'] {
|
1207 |
-
width: 66.66%;
|
1208 |
-
}
|
1209 |
-
.widget[data-columns='7'] {
|
1210 |
-
width: 77.77%;
|
1211 |
-
}
|
1212 |
-
.widget[data-columns='8'] {
|
1213 |
-
width: 88.88%;
|
1214 |
-
}
|
1215 |
-
.widget[data-columns='9'] {
|
1216 |
-
width: 100%;
|
1217 |
-
}
|
1218 |
-
}
|
1219 |
}
|
1220 |
|
1221 |
label[for='mm_enable_mega_menu'] {
|
@@ -1498,7 +1349,7 @@ $header_height: 75px;
|
|
1498 |
|
1499 |
.mm_launch {
|
1500 |
margin-left: 10px;
|
1501 |
-
font-size:
|
1502 |
cursor: pointer;
|
1503 |
color: white;
|
1504 |
display: inline-block;
|
@@ -1523,9 +1374,9 @@ $header_height: 75px;
|
|
1523 |
font-family: dashicons;
|
1524 |
content: "\f111";
|
1525 |
font-size: 10px;
|
1526 |
-
margin-right:
|
1527 |
display: inline-block;
|
1528 |
-
vertical-align:
|
1529 |
}
|
1530 |
}
|
1531 |
|
364 |
|
365 |
button.mega-add-row,
|
366 |
button.mega-add-column {
|
367 |
+
height: 23px;
|
368 |
+
min-height: 23px;
|
369 |
+
line-height: 22px;
|
370 |
font-size: 12px;
|
371 |
padding-left: 4px;
|
372 |
|
373 |
.dashicons-plus {
|
374 |
+
margin-right: 4px;
|
375 |
+
line-height: 22px;
|
376 |
}
|
377 |
}
|
378 |
|
1057 |
}
|
1058 |
}
|
1059 |
|
1060 |
+
#widgets {
|
1061 |
+
@for $of from 1 through 12 {
|
1062 |
+
@for $cols from 1 through $of {
|
1063 |
+
&[data-columns='#{$of}'] .widget[data-columns='#{$cols}'] {
|
1064 |
+
width: (100% / $of) * $cols;
|
1065 |
+
}
|
1066 |
+
}
|
1067 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1068 |
}
|
1069 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1070 |
}
|
1071 |
|
1072 |
label[for='mm_enable_mega_menu'] {
|
1349 |
|
1350 |
.mm_launch {
|
1351 |
margin-left: 10px;
|
1352 |
+
font-size: 12px;
|
1353 |
cursor: pointer;
|
1354 |
color: white;
|
1355 |
display: inline-block;
|
1374 |
font-family: dashicons;
|
1375 |
content: "\f111";
|
1376 |
font-size: 10px;
|
1377 |
+
margin-right: 4px;
|
1378 |
display: inline-block;
|
1379 |
+
vertical-align: middle;
|
1380 |
}
|
1381 |
}
|
1382 |
|
css/megamenu.scss
CHANGED
@@ -16,7 +16,8 @@
|
|
16 |
#{$wrap} #{$menu} li.mega-menu-item,
|
17 |
#{$wrap} #{$menu} li.mega-menu-row,
|
18 |
#{$wrap} #{$menu} li.mega-menu-column,
|
19 |
-
#{$wrap} #{$menu} a.mega-menu-link
|
|
|
20 |
transition: none;
|
21 |
@include border-radius(0, 0, 0, 0);
|
22 |
@include box-shadow(none);
|
@@ -300,7 +301,7 @@
|
|
300 |
display: block;
|
301 |
}
|
302 |
|
303 |
-
@for $cols from 1 through
|
304 |
li.mega-menu-item.mega-menu-megamenu ul.mega-sub-menu li.mega-#{$cols}-columns > ul.mega-sub-menu > li.mega-menu-item {
|
305 |
float: left;
|
306 |
width: (100% / $cols);
|
@@ -582,7 +583,7 @@
|
|
582 |
}
|
583 |
|
584 |
@include desktop {
|
585 |
-
@for $of from 1 through
|
586 |
@for $cols from 1 through $of {
|
587 |
li.mega-menu-columns-#{$cols}-of-#{$of} {
|
588 |
width: (100% / $of) * $cols;
|
@@ -982,45 +983,8 @@
|
|
982 |
|
983 |
// arrows
|
984 |
@include desktop {
|
985 |
-
&.mega-menu-
|
986 |
-
|
987 |
-
li.mega-align-bottom-right.mega-menu-flyout li.mega-menu-item-has-children {
|
988 |
-
> a.mega-menu-link > span.mega-indicator {
|
989 |
-
float: right;
|
990 |
-
|
991 |
-
&:after {
|
992 |
-
content: $arrow_right;
|
993 |
-
margin: 0;
|
994 |
-
}
|
995 |
-
}
|
996 |
-
}
|
997 |
-
|
998 |
-
li.mega-align-bottom-left.mega-menu-item-has-children,
|
999 |
-
li.mega-align-bottom-left.mega-menu-flyout li.mega-menu-item-has-children {
|
1000 |
-
> a.mega-menu-link > span.mega-indicator {
|
1001 |
-
float: left;
|
1002 |
-
|
1003 |
-
&:after {
|
1004 |
-
content: $arrow_left;
|
1005 |
-
margin: 0;
|
1006 |
-
}
|
1007 |
-
}
|
1008 |
-
}
|
1009 |
-
}
|
1010 |
-
|
1011 |
-
&.mega-menu-accordion {
|
1012 |
-
// Arrows
|
1013 |
-
> li.mega-menu-item-has-children > a.mega-menu-link > span.mega-indicator {
|
1014 |
-
float: right;
|
1015 |
-
}
|
1016 |
-
li.mega-menu-item-has-children.mega-toggle-on > a.mega-menu-link > span.mega-indicator:after {
|
1017 |
-
content: $arrow_up;
|
1018 |
-
}
|
1019 |
-
}
|
1020 |
-
|
1021 |
-
// Arrows
|
1022 |
-
li.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item.mega-menu-item-has-children > a.mega-menu-link > span.mega-indicator:after {
|
1023 |
-
content: $arrow_right;
|
1024 |
}
|
1025 |
}
|
1026 |
|
16 |
#{$wrap} #{$menu} li.mega-menu-item,
|
17 |
#{$wrap} #{$menu} li.mega-menu-row,
|
18 |
#{$wrap} #{$menu} li.mega-menu-column,
|
19 |
+
#{$wrap} #{$menu} a.mega-menu-link,
|
20 |
+
#{$wrap} #{$menu} span.mega-menu-badge {
|
21 |
transition: none;
|
22 |
@include border-radius(0, 0, 0, 0);
|
23 |
@include box-shadow(none);
|
301 |
display: block;
|
302 |
}
|
303 |
|
304 |
+
@for $cols from 1 through 6 {
|
305 |
li.mega-menu-item.mega-menu-megamenu ul.mega-sub-menu li.mega-#{$cols}-columns > ul.mega-sub-menu > li.mega-menu-item {
|
306 |
float: left;
|
307 |
width: (100% / $cols);
|
583 |
}
|
584 |
|
585 |
@include desktop {
|
586 |
+
@for $of from 1 through 12 {
|
587 |
@for $cols from 1 through $of {
|
588 |
li.mega-menu-columns-#{$cols}-of-#{$of} {
|
589 |
width: (100% / $of) * $cols;
|
983 |
|
984 |
// arrows
|
985 |
@include desktop {
|
986 |
+
&.mega-menu-accordion > li.mega-menu-item-has-children > a.mega-menu-link > span.mega-indicator {
|
987 |
+
float: right;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
988 |
}
|
989 |
}
|
990 |
|
css/reset.scss
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
#{$wrap} #{$menu} div,
|
7 |
#{$wrap} #{$menu} a {
|
8 |
color: $panel_font_color;
|
9 |
-
font-family: $panel_font_family;
|
10 |
font-size: $panel_font_size;
|
11 |
background: none;
|
12 |
border: 0;
|
6 |
#{$wrap} #{$menu} div,
|
7 |
#{$wrap} #{$menu} a {
|
8 |
color: $panel_font_color;
|
9 |
+
font-family: unquote($panel_font_family);
|
10 |
font-size: $panel_font_size;
|
11 |
background: none;
|
12 |
border: 0;
|
js/admin.js
CHANGED
@@ -89,7 +89,7 @@
|
|
89 |
|
90 |
var header_container = $("<div />").addClass("mm_header_container");
|
91 |
|
92 |
-
var title = $("<div />").addClass("mm_title")
|
93 |
|
94 |
var saving = $("<div class='mm_saving'>" + megamenu.saving + "</div>");
|
95 |
|
@@ -105,6 +105,11 @@
|
|
105 |
|
106 |
$.each(json, function(idx) {
|
107 |
|
|
|
|
|
|
|
|
|
|
|
108 |
var content = $("<div />").addClass("mm_content").addClass(idx).html(this.content).hide();
|
109 |
|
110 |
// bind save button action
|
@@ -1204,9 +1209,9 @@ jQuery(function($) {
|
|
1204 |
|
1205 |
$(this).megaMenu({
|
1206 |
menu_item_id: id,
|
1207 |
-
menu_item_title: title,
|
1208 |
-
menu_item_depth: depth,
|
1209 |
-
menu_id: menu_id
|
1210 |
});
|
1211 |
});
|
1212 |
|
89 |
|
90 |
var header_container = $("<div />").addClass("mm_header_container");
|
91 |
|
92 |
+
var title = $("<div />").addClass("mm_title");
|
93 |
|
94 |
var saving = $("<div class='mm_saving'>" + megamenu.saving + "</div>");
|
95 |
|
105 |
|
106 |
$.each(json, function(idx) {
|
107 |
|
108 |
+
if (idx === "title") {
|
109 |
+
title.html(this);
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
|
113 |
var content = $("<div />").addClass("mm_content").addClass(idx).html(this.content).hide();
|
114 |
|
115 |
// bind save button action
|
1209 |
|
1210 |
$(this).megaMenu({
|
1211 |
menu_item_id: id,
|
1212 |
+
menu_item_title: 0, // title, // 2.7.5: detect using PHP
|
1213 |
+
menu_item_depth: 0, // depth, // 2.7.5: detect using PHP
|
1214 |
+
menu_id: 0 ///menu_id // 2.7.5: detect using PHP
|
1215 |
});
|
1216 |
});
|
1217 |
|
js/maxmegamenu.js
CHANGED
@@ -25,7 +25,9 @@
|
|
25 |
vertical_behaviour: $menu.attr("data-vertical-behaviour"),
|
26 |
document_click: $menu.attr("data-document-click"),
|
27 |
breakpoint: $menu.attr("data-breakpoint"),
|
28 |
-
unbind_events: $menu.attr("data-unbind")
|
|
|
|
|
29 |
};
|
30 |
|
31 |
plugin.settings = {};
|
@@ -273,8 +275,8 @@
|
|
273 |
plugin.hidePanel($(this).children("a.mega-menu-link"), false);
|
274 |
}
|
275 |
},
|
276 |
-
timeout:
|
277 |
-
interval:
|
278 |
});
|
279 |
};
|
280 |
|
@@ -520,7 +522,8 @@
|
|
520 |
plugin.initToggleBar = function() {
|
521 |
// mobile menu
|
522 |
$toggle_bar.on("click", function(e) {
|
523 |
-
if ( $(e.target).is(".mega-menu-toggle, .mega-menu-toggle-block, .mega-menu-toggle-animated-block, .mega-menu-toggle-animated-block *, .mega-toggle-blocks-left, .mega-toggle-blocks-center, .mega-toggle-blocks-right, .mega-toggle-label, .mega-toggle-label span") ) {
|
|
|
524 |
plugin.hideMobileMenu();
|
525 |
} else {
|
526 |
plugin.showMobileMenu();
|
25 |
vertical_behaviour: $menu.attr("data-vertical-behaviour"),
|
26 |
document_click: $menu.attr("data-document-click"),
|
27 |
breakpoint: $menu.attr("data-breakpoint"),
|
28 |
+
unbind_events: $menu.attr("data-unbind"),
|
29 |
+
hover_intent_timeout: $menu.attr("data-hover-intent-timeout"),
|
30 |
+
hover_intent_interval: $menu.attr("data-hover-intent-interval")
|
31 |
};
|
32 |
|
33 |
plugin.settings = {};
|
275 |
plugin.hidePanel($(this).children("a.mega-menu-link"), false);
|
276 |
}
|
277 |
},
|
278 |
+
timeout: plugin.settings.hover_intent_timeout,
|
279 |
+
interval: plugin.settings.hover_intent_interval
|
280 |
});
|
281 |
};
|
282 |
|
522 |
plugin.initToggleBar = function() {
|
523 |
// mobile menu
|
524 |
$toggle_bar.on("click", function(e) {
|
525 |
+
if ( $(e.target).is(".mega-menu-toggle, .mega-menu-toggle-block, .mega-menu-toggle-animated-block, .mega-menu-toggle-animated-block *, .mega-toggle-blocks-left, .mega-toggle-blocks-center, .mega-toggle-blocks-right, .mega-toggle-label, .mega-toggle-label span") ) {
|
526 |
+
if ($(this).hasClass("mega-menu-open")) {
|
527 |
plugin.hideMobileMenu();
|
528 |
} else {
|
529 |
plugin.showMobileMenu();
|
megamenu.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Max Mega Menu
|
5 |
* Plugin URI: https://www.megamenu.com
|
6 |
* Description: An easy to use mega menu plugin. Written the WordPress way.
|
7 |
-
* Version: 2.7.
|
8 |
* Author: megamenu.com
|
9 |
* Author URI: https://www.megamenu.com
|
10 |
* License: GPL-2.0+
|
@@ -36,7 +36,7 @@ final class Mega_Menu {
|
|
36 |
/**
|
37 |
* @var string
|
38 |
*/
|
39 |
-
public $version = '2.7.
|
40 |
|
41 |
|
42 |
/**
|
@@ -78,6 +78,7 @@ final class Mega_Menu {
|
|
78 |
add_filter( 'wp_nav_menu', array( $this, 'add_responsive_toggle' ), 10, 2 );
|
79 |
|
80 |
add_filter( 'wp_nav_menu_objects', array( $this, 'add_widgets_to_menu' ), apply_filters("megamenu_wp_nav_menu_objects_priority", 10), 2 );
|
|
|
81 |
add_filter( 'megamenu_nav_menu_objects_before', array( $this, 'setup_menu_items' ), 5, 2 );
|
82 |
add_filter( 'megamenu_nav_menu_objects_after', array( $this, 'reorder_menu_items_within_megamenus' ), 6, 2 );
|
83 |
add_filter( 'megamenu_nav_menu_objects_after', array( $this, 'apply_classes_to_menu_items' ), 7, 2 );
|
@@ -290,7 +291,7 @@ final class Mega_Menu {
|
|
290 |
return wp_nav_menu( array( 'theme_location' => $atts['location'], 'echo' => false ) );
|
291 |
}
|
292 |
|
293 |
-
return "<!-- menu not found [maxmegamenu
|
294 |
|
295 |
}
|
296 |
|
@@ -381,6 +382,7 @@ final class Mega_Menu {
|
|
381 |
if ( is_readable( MEGAMENU_PATH . "integration/{$template}/functions.php" ) ) {
|
382 |
require_once( MEGAMENU_PATH . "integration/{$template}/functions.php" );
|
383 |
}
|
|
|
384 |
break;
|
385 |
}
|
386 |
|
@@ -458,7 +460,6 @@ final class Mega_Menu {
|
|
458 |
* @since 1.3
|
459 |
*/
|
460 |
public function add_responsive_toggle( $nav_menu, $args ) {
|
461 |
-
|
462 |
$args = (object) $args;
|
463 |
|
464 |
// make sure we're working with a Mega Menu
|
@@ -761,33 +762,41 @@ final class Mega_Menu {
|
|
761 |
|
762 |
|
763 |
/**
|
764 |
-
*
|
765 |
*
|
766 |
-
* @since 2.
|
767 |
* @param array $items - All menu item objects
|
768 |
* @param object $args
|
769 |
* @return array
|
770 |
*/
|
771 |
-
public function
|
772 |
-
|
773 |
-
|
774 |
-
$parents = array();
|
775 |
|
776 |
-
foreach
|
777 |
-
|
778 |
-
$
|
779 |
-
$item->depth = 0;
|
780 |
}
|
781 |
-
}
|
782 |
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
}
|
788 |
-
}
|
789 |
}
|
790 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
791 |
// apply saved metadata to each menu item
|
792 |
foreach ( $items as $item ) {
|
793 |
$saved_settings = array_filter( (array) get_post_meta( $item->ID, '_megamenu', true ) );
|
@@ -1104,6 +1113,13 @@ final class Mega_Menu {
|
|
1104 |
$effect_speed_mobile = 0;
|
1105 |
}
|
1106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1107 |
$wrap_attributes = apply_filters("megamenu_wrap_attributes", array(
|
1108 |
"id" => '%1$s',
|
1109 |
"class" => '%2$s mega-no-js',
|
@@ -1119,7 +1135,9 @@ final class Mega_Menu {
|
|
1119 |
"data-document-click" => 'collapse',
|
1120 |
"data-vertical-behaviour" => $vertical_behaviour,
|
1121 |
"data-breakpoint" => absint( $menu_theme['responsive_breakpoint'] ),
|
1122 |
-
"data-unbind" => $unbind === "disabled" ? "false" : "true"
|
|
|
|
|
1123 |
), $menu_id, $menu_settings, $settings, $current_theme_location );
|
1124 |
|
1125 |
$attributes = "";
|
@@ -1314,6 +1332,7 @@ if ( ! function_exists( 'mmm_get_theme_for_location' ) ) {
|
|
1314 |
}
|
1315 |
}
|
1316 |
|
|
|
1317 |
if ( ! function_exists( 'max_mega_menu_is_enabled' ) ) {
|
1318 |
|
1319 |
/**
|
4 |
* Plugin Name: Max Mega Menu
|
5 |
* Plugin URI: https://www.megamenu.com
|
6 |
* Description: An easy to use mega menu plugin. Written the WordPress way.
|
7 |
+
* Version: 2.7.5
|
8 |
* Author: megamenu.com
|
9 |
* Author URI: https://www.megamenu.com
|
10 |
* License: GPL-2.0+
|
36 |
/**
|
37 |
* @var string
|
38 |
*/
|
39 |
+
public $version = '2.7.5';
|
40 |
|
41 |
|
42 |
/**
|
78 |
add_filter( 'wp_nav_menu', array( $this, 'add_responsive_toggle' ), 10, 2 );
|
79 |
|
80 |
add_filter( 'wp_nav_menu_objects', array( $this, 'add_widgets_to_menu' ), apply_filters("megamenu_wp_nav_menu_objects_priority", 10), 2 );
|
81 |
+
add_filter( 'megamenu_nav_menu_objects_before', array( $this, 'apply_depth_to_menu_items' ), 5, 2 );
|
82 |
add_filter( 'megamenu_nav_menu_objects_before', array( $this, 'setup_menu_items' ), 5, 2 );
|
83 |
add_filter( 'megamenu_nav_menu_objects_after', array( $this, 'reorder_menu_items_within_megamenus' ), 6, 2 );
|
84 |
add_filter( 'megamenu_nav_menu_objects_after', array( $this, 'apply_classes_to_menu_items' ), 7, 2 );
|
291 |
return wp_nav_menu( array( 'theme_location' => $atts['location'], 'echo' => false ) );
|
292 |
}
|
293 |
|
294 |
+
return "<!-- menu not found [maxmegamenu] -->";
|
295 |
|
296 |
}
|
297 |
|
382 |
if ( is_readable( MEGAMENU_PATH . "integration/{$template}/functions.php" ) ) {
|
383 |
require_once( MEGAMENU_PATH . "integration/{$template}/functions.php" );
|
384 |
}
|
385 |
+
default:
|
386 |
break;
|
387 |
}
|
388 |
|
460 |
* @since 1.3
|
461 |
*/
|
462 |
public function add_responsive_toggle( $nav_menu, $args ) {
|
|
|
463 |
$args = (object) $args;
|
464 |
|
465 |
// make sure we're working with a Mega Menu
|
762 |
|
763 |
|
764 |
/**
|
765 |
+
* Apply depth to menu items
|
766 |
*
|
767 |
+
* @since 2.7.5
|
768 |
* @param array $items - All menu item objects
|
769 |
* @param object $args
|
770 |
* @return array
|
771 |
*/
|
772 |
+
public function apply_depth_to_menu_items( $items, $args ) {
|
773 |
+
$level = 0;
|
774 |
+
$stack = array('0');
|
|
|
775 |
|
776 |
+
foreach( $items as $key => $item ) {
|
777 |
+
while( $item->menu_item_parent != array_pop( $stack ) ) {
|
778 |
+
$level--;
|
|
|
779 |
}
|
|
|
780 |
|
781 |
+
$level++;
|
782 |
+
$stack[] = $item->menu_item_parent;
|
783 |
+
$stack[] = $item->ID;
|
784 |
+
$items[$key]->depth = $level - 1;
|
|
|
|
|
785 |
}
|
786 |
|
787 |
+
return $items;
|
788 |
+
}
|
789 |
+
|
790 |
+
|
791 |
+
/**
|
792 |
+
* Setup the mega menu settings for each menu item
|
793 |
+
*
|
794 |
+
* @since 2.0
|
795 |
+
* @param array $items - All menu item objects
|
796 |
+
* @param object $args
|
797 |
+
* @return array
|
798 |
+
*/
|
799 |
+
public function setup_menu_items( $items, $args ) {
|
800 |
// apply saved metadata to each menu item
|
801 |
foreach ( $items as $item ) {
|
802 |
$saved_settings = array_filter( (array) get_post_meta( $item->ID, '_megamenu', true ) );
|
1113 |
$effect_speed_mobile = 0;
|
1114 |
}
|
1115 |
|
1116 |
+
$hover_intent_params = apply_filters("megamenu_javascript_localisation", // backwards compatiblity
|
1117 |
+
array(
|
1118 |
+
"timeout" => 300,
|
1119 |
+
"interval" => 100
|
1120 |
+
)
|
1121 |
+
);
|
1122 |
+
|
1123 |
$wrap_attributes = apply_filters("megamenu_wrap_attributes", array(
|
1124 |
"id" => '%1$s',
|
1125 |
"class" => '%2$s mega-no-js',
|
1135 |
"data-document-click" => 'collapse',
|
1136 |
"data-vertical-behaviour" => $vertical_behaviour,
|
1137 |
"data-breakpoint" => absint( $menu_theme['responsive_breakpoint'] ),
|
1138 |
+
"data-unbind" => $unbind === "disabled" ? "false" : "true",
|
1139 |
+
"data-hover-intent-timeout" => absint($hover_intent_params['timeout']),
|
1140 |
+
"data-hover-intent-interval" => absint($hover_intent_params['interval'])
|
1141 |
), $menu_id, $menu_settings, $settings, $current_theme_location );
|
1142 |
|
1143 |
$attributes = "";
|
1332 |
}
|
1333 |
}
|
1334 |
|
1335 |
+
|
1336 |
if ( ! function_exists( 'max_mega_menu_is_enabled' ) ) {
|
1337 |
|
1338 |
/**
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: megamenu
|
|
3 |
Tags: menu, megamenu, mega menu, navigation, widget, dropdown menu, drag and drop, mobile, responsive, retina, theme editor, widget, shortcode, sidebar, icons, dashicons
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.4
|
6 |
-
Stable tag: 2.7.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -133,6 +133,20 @@ See https://www.megamenu.com for more screenshots
|
|
133 |
|
134 |
== Changelog ==
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
= 2.7.4 =
|
137 |
|
138 |
* Fix: Allow double quotes in custom font names
|
3 |
Tags: menu, megamenu, mega menu, navigation, widget, dropdown menu, drag and drop, mobile, responsive, retina, theme editor, widget, shortcode, sidebar, icons, dashicons
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.4
|
6 |
+
Stable tag: 2.7.4
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
133 |
|
134 |
== Changelog ==
|
135 |
|
136 |
+
= 2.7.5 =
|
137 |
+
|
138 |
+
* Improvement: Add megamenu_javascript_handle filter
|
139 |
+
* Improvement: Tidy up CSS for backwards compatibility with previous versions of Pro
|
140 |
+
* Improvement: Pave the way for removing JavaScript localisation by moving hover intent options to wrap attributes
|
141 |
+
* Improvement: Allow third level items to be distributed over 6 columns (previously 4) (requires clearing the Menu CSS Cache)
|
142 |
+
* Improvement: Increase number of available columns for "Mega Menu - Standard Layout" from 9 to 12 (requires clearing the Menu CSS Cache)
|
143 |
+
* Fix: Unquote font family CSS when Reset Widget Styling is enabled
|
144 |
+
* Fix: Edge case PHP warning when using widget
|
145 |
+
* Fix: Workaround for when wp_get_theme() fails to return name of active theme
|
146 |
+
* Fix: Correctly sanitise theme import data and escape output. Thanks to polyplanet.de for reporting this!
|
147 |
+
* Refactor: Decouple menu items lightbox options from nav-menus.php screen. When opening lightbox settings on nav-menus.php, use PHP to determine these values rather than JavaScript
|
148 |
+
* Refactor: Improve method to determine the depth of a menu item
|
149 |
+
|
150 |
= 2.7.4 =
|
151 |
|
152 |
* Fix: Allow double quotes in custom font names
|