Version Description
[14/03/2016] =
- Fix: PHP Warnings
- Fix: SCSS variable doesn't exist warning
- Change: Reverse right aligned menu items in the mobile menu on window resize instead of reload
- Change: Some updates to the mobile toggle designer to ease extending the functionality with filters
Download this release
Release Info
Developer | megamenu |
Plugin | Max Mega Menu |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.1 to 2.1.1
- classes/toggle-blocks.class.php +43 -14
- css/admin/settings.css +3 -0
- js/maxmegamenu.js +31 -4
- js/toggledesigner.js +3 -0
- megamenu.php +2 -2
- readme.txt +7 -0
classes/toggle-blocks.class.php
CHANGED
@@ -56,9 +56,11 @@ class Mega_Menu_Toggle_Blocks {
|
|
56 |
|
57 |
// backwards compatibility
|
58 |
// default to right aligned menu toggle using existing theme settings
|
59 |
-
$
|
|
|
|
|
60 |
|
61 |
-
return $
|
62 |
|
63 |
}
|
64 |
|
@@ -69,7 +71,7 @@ class Mega_Menu_Toggle_Blocks {
|
|
69 |
* @since 2.1
|
70 |
* @return array
|
71 |
*/
|
72 |
-
private function get_default_menu_toggle_block() {
|
73 |
|
74 |
$style_manager = new Mega_Menu_Style_Manager();
|
75 |
|
@@ -168,7 +170,7 @@ class Mega_Menu_Toggle_Blocks {
|
|
168 |
*/
|
169 |
public function revert_toggle_blocks() {
|
170 |
|
171 |
-
$theme = esc_attr( $
|
172 |
|
173 |
$saved_toggle_blocks = get_site_option( "megamenu_toggle_blocks" );
|
174 |
|
@@ -176,7 +178,7 @@ class Mega_Menu_Toggle_Blocks {
|
|
176 |
unset( $saved_toggle_blocks[$theme] );
|
177 |
}
|
178 |
|
179 |
-
update_site_option( "megamenu_toggle_blocks", $
|
180 |
}
|
181 |
|
182 |
|
@@ -264,13 +266,27 @@ class Mega_Menu_Toggle_Blocks {
|
|
264 |
|
265 |
if ( isset( $settings['type'] ) && $settings['type'] == 'menu_toggle' ) {
|
266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
$styles = array(
|
268 |
'id' => $index,
|
269 |
'align' => isset($settings['align']) ? "'" . $settings['align'] . "'" : "'right'",
|
270 |
'closed_text' => isset($settings['closed_text']) ? "'" . $settings['closed_text'] . "'" : "'MENU'",
|
271 |
'open_text' => isset($settings['open_text']) ? "'" . $settings['open_text'] . "'" : "''",
|
272 |
-
'closed_icon' =>
|
273 |
-
'open_icon' =>
|
274 |
'text_color' => isset($settings['text_color']) ? $settings['text_color'] : '#fff',
|
275 |
'icon_color' => isset($settings['icon_color']) ? $settings['icon_color'] : '#fff',
|
276 |
'icon_position' => isset($settings['icon_position']) ? "'" . $settings['icon_position'] . "'" : 'after'
|
@@ -324,7 +340,7 @@ class Mega_Menu_Toggle_Blocks {
|
|
324 |
|
325 |
$toggle_blocks = $this->get_toggle_blocks_for_theme( $theme_id );
|
326 |
|
327 |
-
$
|
328 |
|
329 |
if ( is_array( $toggle_blocks ) ) {
|
330 |
|
@@ -360,11 +376,11 @@ class Mega_Menu_Toggle_Blocks {
|
|
360 |
// Lists with a single item are not treated the same way by SASS
|
361 |
$list .= "());";
|
362 |
|
363 |
-
$vars['
|
364 |
|
365 |
} else {
|
366 |
|
367 |
-
$vars['
|
368 |
|
369 |
}
|
370 |
|
@@ -406,7 +422,9 @@ class Mega_Menu_Toggle_Blocks {
|
|
406 |
if ( is_array( $toggle_blocks ) ) {
|
407 |
foreach( $toggle_blocks as $block_id => $settings ) {
|
408 |
if ( is_int( $block_id ) && is_array( $settings ) && isset( $settings['align'] ) && $settings['align'] == 'left' || ! isset( $settings['align'] ) ) {
|
409 |
-
|
|
|
|
|
410 |
}
|
411 |
}
|
412 |
}
|
@@ -419,7 +437,9 @@ class Mega_Menu_Toggle_Blocks {
|
|
419 |
if ( is_array( $toggle_blocks ) ) {
|
420 |
foreach( $toggle_blocks as $block_id => $settings ) {
|
421 |
if ( is_int( $block_id ) && is_array( $settings ) && isset( $settings['align'] ) && $settings['align'] == 'center' ) {
|
422 |
-
|
|
|
|
|
423 |
}
|
424 |
}
|
425 |
}
|
@@ -432,7 +452,9 @@ class Mega_Menu_Toggle_Blocks {
|
|
432 |
if ( is_array( $toggle_blocks ) ) {
|
433 |
foreach( $toggle_blocks as $block_id => $settings ) {
|
434 |
if ( is_int( $block_id ) && is_array( $settings ) && isset( $settings['align'] ) && $settings['align'] == 'right' ) {
|
435 |
-
|
|
|
|
|
436 |
}
|
437 |
}
|
438 |
}
|
@@ -499,7 +521,14 @@ class Mega_Menu_Toggle_Blocks {
|
|
499 |
$block_id = "0";
|
500 |
}
|
501 |
|
502 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
503 |
|
504 |
$settings = array_merge( $defaults, $settings );
|
505 |
|
56 |
|
57 |
// backwards compatibility
|
58 |
// default to right aligned menu toggle using existing theme settings
|
59 |
+
$default_blocks = array(
|
60 |
+
1 => $this->get_default_menu_toggle_block( $theme_id )
|
61 |
+
);
|
62 |
|
63 |
+
return $default_blocks;
|
64 |
|
65 |
}
|
66 |
|
71 |
* @since 2.1
|
72 |
* @return array
|
73 |
*/
|
74 |
+
private function get_default_menu_toggle_block( $theme_id = 'default' ) {
|
75 |
|
76 |
$style_manager = new Mega_Menu_Style_Manager();
|
77 |
|
170 |
*/
|
171 |
public function revert_toggle_blocks() {
|
172 |
|
173 |
+
$theme = esc_attr( $_GET['theme_id'] );
|
174 |
|
175 |
$saved_toggle_blocks = get_site_option( "megamenu_toggle_blocks" );
|
176 |
|
178 |
unset( $saved_toggle_blocks[$theme] );
|
179 |
}
|
180 |
|
181 |
+
update_site_option( "megamenu_toggle_blocks", $saved_toggle_blocks );
|
182 |
}
|
183 |
|
184 |
|
266 |
|
267 |
if ( isset( $settings['type'] ) && $settings['type'] == 'menu_toggle' ) {
|
268 |
|
269 |
+
if ( isset( $settings['closed_icon'] ) ) {
|
270 |
+
$closed_icon_parts = explode( '-', $settings['closed_icon'] );
|
271 |
+
$closed_icon = end( $closed_icon_parts );
|
272 |
+
} else {
|
273 |
+
$closed_icon = 'disabled';
|
274 |
+
}
|
275 |
+
|
276 |
+
if ( isset( $settings['open_icon'] ) ) {
|
277 |
+
$open_icon_parts = explode( '-', $settings['open_icon'] );
|
278 |
+
$open_icon = end( $open_icon_parts );
|
279 |
+
} else {
|
280 |
+
$open_icon = 'disabled';
|
281 |
+
}
|
282 |
+
|
283 |
$styles = array(
|
284 |
'id' => $index,
|
285 |
'align' => isset($settings['align']) ? "'" . $settings['align'] . "'" : "'right'",
|
286 |
'closed_text' => isset($settings['closed_text']) ? "'" . $settings['closed_text'] . "'" : "'MENU'",
|
287 |
'open_text' => isset($settings['open_text']) ? "'" . $settings['open_text'] . "'" : "''",
|
288 |
+
'closed_icon' => $closed_icon != 'disabled' ? "'\\" . $closed_icon . "'" : "''",
|
289 |
+
'open_icon' => $open_icon != 'disabled' ? "'\\" . $open_icon . "'" : "''",
|
290 |
'text_color' => isset($settings['text_color']) ? $settings['text_color'] : '#fff',
|
291 |
'icon_color' => isset($settings['icon_color']) ? $settings['icon_color'] : '#fff',
|
292 |
'icon_position' => isset($settings['icon_position']) ? "'" . $settings['icon_position'] . "'" : 'after'
|
340 |
|
341 |
$toggle_blocks = $this->get_toggle_blocks_for_theme( $theme_id );
|
342 |
|
343 |
+
$spacer_blocks = array();
|
344 |
|
345 |
if ( is_array( $toggle_blocks ) ) {
|
346 |
|
376 |
// Lists with a single item are not treated the same way by SASS
|
377 |
$list .= "());";
|
378 |
|
379 |
+
$vars['spacer_toggle_blocks'] = $list;
|
380 |
|
381 |
} else {
|
382 |
|
383 |
+
$vars['spacer_toggle_blocks'] = "()";
|
384 |
|
385 |
}
|
386 |
|
422 |
if ( is_array( $toggle_blocks ) ) {
|
423 |
foreach( $toggle_blocks as $block_id => $settings ) {
|
424 |
if ( is_int( $block_id ) && is_array( $settings ) && isset( $settings['align'] ) && $settings['align'] == 'left' || ! isset( $settings['align'] ) ) {
|
425 |
+
if ( isset( $settings['type'] ) ) {
|
426 |
+
do_action( "megamenu_output_admin_toggle_block_{$settings['type']}", $block_id, $settings );
|
427 |
+
}
|
428 |
}
|
429 |
}
|
430 |
}
|
437 |
if ( is_array( $toggle_blocks ) ) {
|
438 |
foreach( $toggle_blocks as $block_id => $settings ) {
|
439 |
if ( is_int( $block_id ) && is_array( $settings ) && isset( $settings['align'] ) && $settings['align'] == 'center' ) {
|
440 |
+
if ( isset( $settings['type'] ) ) {
|
441 |
+
do_action( "megamenu_output_admin_toggle_block_{$settings['type']}", $block_id, $settings );
|
442 |
+
}
|
443 |
}
|
444 |
}
|
445 |
}
|
452 |
if ( is_array( $toggle_blocks ) ) {
|
453 |
foreach( $toggle_blocks as $block_id => $settings ) {
|
454 |
if ( is_int( $block_id ) && is_array( $settings ) && isset( $settings['align'] ) && $settings['align'] == 'right' ) {
|
455 |
+
if ( isset( $settings['type'] ) ) {
|
456 |
+
do_action( "megamenu_output_admin_toggle_block_{$settings['type']}", $block_id, $settings );
|
457 |
+
}
|
458 |
}
|
459 |
}
|
460 |
}
|
521 |
$block_id = "0";
|
522 |
}
|
523 |
|
524 |
+
$theme_id = 'default';
|
525 |
+
|
526 |
+
if ( isset( $_GET['theme'] ) ) {
|
527 |
+
$theme_id = esc_attr( $_GET['theme'] );
|
528 |
+
|
529 |
+
}
|
530 |
+
|
531 |
+
$defaults = $this->get_default_menu_toggle_block( $theme_id );
|
532 |
|
533 |
$settings = array_merge( $defaults, $settings );
|
534 |
|
css/admin/settings.css
CHANGED
@@ -287,6 +287,9 @@
|
|
287 |
cursor: auto;
|
288 |
}
|
289 |
|
|
|
|
|
|
|
290 |
|
291 |
.megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .block {
|
292 |
position: relative;
|
287 |
cursor: auto;
|
288 |
}
|
289 |
|
290 |
+
.megamenu_outer_wrap .megamenu_right .menu_settings table .block input[type=text] {
|
291 |
+
width: 50%;
|
292 |
+
}
|
293 |
|
294 |
.megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .block {
|
295 |
position: relative;
|
js/maxmegamenu.js
CHANGED
@@ -217,14 +217,33 @@
|
|
217 |
});
|
218 |
};
|
219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
plugin.init = function() {
|
222 |
plugin.settings = $.extend({}, defaults, options);
|
223 |
|
224 |
$menu.removeClass('mega-no-js');
|
225 |
|
226 |
-
$menu.siblings('.mega-menu-toggle').on('click', function() {
|
227 |
-
$(
|
|
|
|
|
228 |
});
|
229 |
|
230 |
$('li.mega-menu-item, ul.mega-sub-menu', menu).unbind();
|
@@ -235,10 +254,18 @@
|
|
235 |
openOnHover();
|
236 |
}
|
237 |
|
238 |
-
if (
|
239 |
-
$menu.
|
|
|
|
|
240 |
}
|
241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
};
|
243 |
|
244 |
plugin.init();
|
217 |
});
|
218 |
};
|
219 |
|
220 |
+
plugin.check_width = function() {
|
221 |
+
|
222 |
+
if ( plugin.settings.reverse_mobile_items == 'true' ) {
|
223 |
+
|
224 |
+
if ( $(window).width() <= plugin.settings.breakpoint && $menu.data('view') == 'desktop' ) {
|
225 |
+
$menu.data('view', 'mobile');
|
226 |
+
$menu.append($menu.children('li.mega-item-align-right').get().reverse());
|
227 |
+
}
|
228 |
+
|
229 |
+
if ( $(window).width() >= plugin.settings.breakpoint && $menu.data('view') == 'mobile' ) {
|
230 |
+
$menu.data('view', 'desktop');
|
231 |
+
$menu.append($menu.children('li.mega-item-align-right').get().reverse());
|
232 |
+
}
|
233 |
+
|
234 |
+
}
|
235 |
+
|
236 |
+
}
|
237 |
|
238 |
plugin.init = function() {
|
239 |
plugin.settings = $.extend({}, defaults, options);
|
240 |
|
241 |
$menu.removeClass('mega-no-js');
|
242 |
|
243 |
+
$menu.siblings('.mega-menu-toggle').on('click', function(e) {
|
244 |
+
if ( $(e.target).is('.mega-menu-toggle-block, .mega-menu-toggle') ) {
|
245 |
+
$(this).toggleClass('mega-menu-open');
|
246 |
+
}
|
247 |
});
|
248 |
|
249 |
$('li.mega-menu-item, ul.mega-sub-menu', menu).unbind();
|
254 |
openOnHover();
|
255 |
}
|
256 |
|
257 |
+
if ( plugin.isDesktopView() ) {
|
258 |
+
$menu.data('view', 'desktop');
|
259 |
+
} else {
|
260 |
+
$menu.data('view', 'mobile');
|
261 |
}
|
262 |
|
263 |
+
plugin.check_width();
|
264 |
+
|
265 |
+
$(window).resize(function() {
|
266 |
+
plugin.check_width();
|
267 |
+
});
|
268 |
+
|
269 |
};
|
270 |
|
271 |
plugin.init();
|
js/toggledesigner.js
CHANGED
@@ -147,6 +147,9 @@ jQuery(function($) {
|
|
147 |
|
148 |
// reset the select dropdown
|
149 |
$("#toggle-block-selector").val("title");
|
|
|
|
|
|
|
150 |
}
|
151 |
});
|
152 |
});
|
147 |
|
148 |
// reset the select dropdown
|
149 |
$("#toggle-block-selector").val("title");
|
150 |
+
|
151 |
+
$('body').trigger('toggle_block_content_loaded');
|
152 |
+
|
153 |
}
|
154 |
});
|
155 |
});
|
megamenu.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Max Mega Menu
|
5 |
* Plugin URI: https://www.maxmegamenu.com
|
6 |
* Description: Mega Menu for WordPress.
|
7 |
-
* Version: 2.1
|
8 |
* Author: Tom Hemsley
|
9 |
* Author URI: https://www.maxmegamenu.com
|
10 |
* License: GPL-2.0+
|
@@ -26,7 +26,7 @@ final class Mega_Menu {
|
|
26 |
/**
|
27 |
* @var string
|
28 |
*/
|
29 |
-
public $version = '2.1';
|
30 |
|
31 |
|
32 |
/**
|
4 |
* Plugin Name: Max Mega Menu
|
5 |
* Plugin URI: https://www.maxmegamenu.com
|
6 |
* Description: Mega Menu for WordPress.
|
7 |
+
* Version: 2.1.1
|
8 |
* Author: Tom Hemsley
|
9 |
* Author URI: https://www.maxmegamenu.com
|
10 |
* License: GPL-2.0+
|
26 |
/**
|
27 |
* @var string
|
28 |
*/
|
29 |
+
public $version = '2.1.1';
|
30 |
|
31 |
|
32 |
/**
|
readme.txt
CHANGED
@@ -92,6 +92,13 @@ See https://www.maxmegamenu.com for more screenshots
|
|
92 |
|
93 |
== Changelog ==
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
= 2.1 [14/03/2016] =
|
96 |
|
97 |
* New Feature: Drag and drop designer for the mobile toggle bar
|
92 |
|
93 |
== Changelog ==
|
94 |
|
95 |
+
= 2.1.1 [14/03/2016] =
|
96 |
+
|
97 |
+
* Fix: PHP Warnings
|
98 |
+
* Fix: SCSS variable doesn't exist warning
|
99 |
+
* Change: Reverse right aligned menu items in the mobile menu on window resize instead of reload
|
100 |
+
* Change: Some updates to the mobile toggle designer to ease extending the functionality with filters
|
101 |
+
|
102 |
= 2.1 [14/03/2016] =
|
103 |
|
104 |
* New Feature: Drag and drop designer for the mobile toggle bar
|