Max Mega Menu - Version 2.3.7

Version Description

[06/07/17]=

  • Compatibility with WordPress 4.8 Text and Media Widgets
  • Fix: Compatiblity with SiteOrigin Page Builder Layout builder
  • Improvement: Add support for MEGAMENU_SHARE_THEMES_MULTISITE constant
  • Improvement: Process shortcodes in mobile toggle block open and closed text
Download this release

Release Info

Developer megamenu
Plugin Icon 128x128 Max Mega Menu
Version 2.3.7
Comparing to
See all releases

Code changes from version 2.3.6 to 2.3.7

classes/menu-item-manager.class.php CHANGED
@@ -383,7 +383,7 @@ class Mega_Menu_Menu_Item_Manager {
383
  $return .= ' <h4>' . esc_html( $item['title'] ) . '</h4>';
384
  $return .= ' </div>';
385
  $return .= ' </div>';
386
- $return .= ' <div class="widget-inner"></div>';
387
  $return .= '</div>';
388
  }
389
 
383
  $return .= ' <h4>' . esc_html( $item['title'] ) . '</h4>';
384
  $return .= ' </div>';
385
  $return .= ' </div>';
386
+ $return .= ' <div class="widget-inner widget-inside"></div>';
387
  $return .= '</div>';
388
  }
389
 
classes/nav-menus.class.php CHANGED
@@ -51,6 +51,8 @@ class Mega_Menu_Nav_Menus {
51
  add_action( 'wp_ajax_mm_hide_nags', array($this, 'set_nag_transient') );
52
  add_filter( 'hidden_meta_boxes', array( $this, 'show_mega_menu_metabox' ) );
53
 
 
 
54
  if ( function_exists( 'siteorigin_panels_admin_enqueue_scripts' ) ) {
55
  add_action( 'admin_print_scripts-nav-menus.php', array( $this, 'siteorigin_panels_admin_enqueue_scripts') );
56
  }
@@ -62,6 +64,16 @@ class Mega_Menu_Nav_Menus {
62
  }
63
 
64
 
 
 
 
 
 
 
 
 
 
 
65
  /**
66
  * Enqueue Page Builder scripts (https://wordpress.org/plugins/siteorigin-panels/)
67
  * @since 1.9
51
  add_action( 'wp_ajax_mm_hide_nags', array($this, 'set_nag_transient') );
52
  add_filter( 'hidden_meta_boxes', array( $this, 'show_mega_menu_metabox' ) );
53
 
54
+ add_filter('siteorigin_panels_is_admin_page', array( $this, 'enable_site_origin_page_builder' ) );
55
+
56
  if ( function_exists( 'siteorigin_panels_admin_enqueue_scripts' ) ) {
57
  add_action( 'admin_print_scripts-nav-menus.php', array( $this, 'siteorigin_panels_admin_enqueue_scripts') );
58
  }
64
  }
65
 
66
 
67
+ /**
68
+ * Enqueue Site Origin Page Builder scripts on nav-menus page.
69
+ *
70
+ * @since 2.3.7
71
+ */
72
+ public function enable_site_origin_page_builder( $enabled ) {
73
+ $screen = get_current_screen();
74
+ return $screen->base == 'nav-menus';
75
+ }
76
+
77
  /**
78
  * Enqueue Page Builder scripts (https://wordpress.org/plugins/siteorigin-panels/)
79
  * @since 1.9
classes/settings.class.php CHANGED
@@ -73,7 +73,7 @@ class Mega_Menu_Settings {
73
  $style_manager = new Mega_Menu_Style_Manager();
74
  $this->themes = $style_manager->get_themes();
75
 
76
- $last_updated = get_option('megamenu_themes_last_updated');
77
 
78
  $preselected_theme = isset( $this->themes[ $last_updated ] ) ? $last_updated : 'default';
79
 
@@ -152,7 +152,7 @@ class Mega_Menu_Settings {
152
 
153
  $theme = esc_attr( $_POST['theme_id'] );
154
 
155
- $saved_themes = get_site_option( "megamenu_themes" );
156
 
157
  if ( isset( $saved_themes[ $theme ] ) ) {
158
  unset( $saved_themes[ $theme ] );
@@ -162,8 +162,8 @@ class Mega_Menu_Settings {
162
 
163
  $saved_themes[ $theme ] = $prepared_theme;
164
 
165
- update_site_option( "megamenu_themes", $saved_themes );
166
- update_site_option( "megamenu_themes_last_updated", $theme );
167
 
168
  do_action("megamenu_after_theme_save");
169
  do_action("megamenu_delete_cache");
@@ -289,7 +289,7 @@ class Mega_Menu_Settings {
289
  delete_transient( "megamenu_css" );
290
 
291
  // delete custom themes
292
- delete_site_option( "megamenu_themes" );
293
 
294
  $this->redirect( admin_url( "admin.php?page=maxmegamenu_tools&delete_data=true" ) );
295
 
@@ -351,7 +351,7 @@ class Mega_Menu_Settings {
351
 
352
  if ( is_array( $import ) ) {
353
 
354
- $saved_themes = get_site_option( "megamenu_themes" );
355
 
356
  $next_id = $this->get_next_theme_id();
357
 
@@ -361,7 +361,7 @@ class Mega_Menu_Settings {
361
 
362
  $saved_themes[ $new_theme_id ] = $import;
363
 
364
- update_site_option( "megamenu_themes", $saved_themes );
365
 
366
  do_action("megamenu_after_theme_import");
367
 
@@ -391,7 +391,7 @@ class Mega_Menu_Settings {
391
 
392
  $copy = $this->themes[$theme];
393
 
394
- $saved_themes = get_site_option( "megamenu_themes" );
395
 
396
  $next_id = $this->get_next_theme_id();
397
 
@@ -401,7 +401,7 @@ class Mega_Menu_Settings {
401
 
402
  $saved_themes[ $new_theme_id ] = $copy;
403
 
404
- update_site_option( "megamenu_themes", $saved_themes );
405
 
406
  do_action("megamenu_after_theme_duplicate");
407
 
@@ -427,13 +427,13 @@ class Mega_Menu_Settings {
427
  return;
428
  }
429
 
430
- $saved_themes = get_site_option( "megamenu_themes" );
431
 
432
  if ( isset( $saved_themes[$theme] ) ) {
433
  unset( $saved_themes[$theme] );
434
  }
435
 
436
- update_site_option( "megamenu_themes", $saved_themes );
437
 
438
  do_action("megamenu_after_theme_delete");
439
 
@@ -455,13 +455,13 @@ class Mega_Menu_Settings {
455
 
456
  $theme = esc_attr( $_GET['theme_id'] );
457
 
458
- $saved_themes = get_site_option( "megamenu_themes" );
459
 
460
  if ( isset( $saved_themes[$theme] ) ) {
461
  unset( $saved_themes[$theme] );
462
  }
463
 
464
- update_site_option( "megamenu_themes", $saved_themes );
465
 
466
  do_action("megamenu_after_theme_revert");
467
 
@@ -483,7 +483,7 @@ class Mega_Menu_Settings {
483
 
484
  $this->init();
485
 
486
- $saved_themes = get_site_option( "megamenu_themes" );
487
 
488
  $next_id = $this->get_next_theme_id();
489
 
@@ -496,7 +496,7 @@ class Mega_Menu_Settings {
496
 
497
  $saved_themes[$new_theme_id] = $new_theme;
498
 
499
- update_site_option( "megamenu_themes", $saved_themes );
500
 
501
  do_action("megamenu_after_theme_create");
502
 
@@ -560,7 +560,7 @@ class Mega_Menu_Settings {
560
 
561
  $last_id = 0;
562
 
563
- if ( $saved_themes = get_site_option( "megamenu_themes" ) ) {
564
 
565
  foreach ( $saved_themes as $key => $value ) {
566
 
73
  $style_manager = new Mega_Menu_Style_Manager();
74
  $this->themes = $style_manager->get_themes();
75
 
76
+ $last_updated = max_mega_menu_get_last_updated_theme();
77
 
78
  $preselected_theme = isset( $this->themes[ $last_updated ] ) ? $last_updated : 'default';
79
 
152
 
153
  $theme = esc_attr( $_POST['theme_id'] );
154
 
155
+ $saved_themes = max_mega_menu_get_themes();
156
 
157
  if ( isset( $saved_themes[ $theme ] ) ) {
158
  unset( $saved_themes[ $theme ] );
162
 
163
  $saved_themes[ $theme ] = $prepared_theme;
164
 
165
+ max_mega_menu_save_themes( $saved_themes );
166
+ max_mega_menu_save_last_updated_theme( $theme );
167
 
168
  do_action("megamenu_after_theme_save");
169
  do_action("megamenu_delete_cache");
289
  delete_transient( "megamenu_css" );
290
 
291
  // delete custom themes
292
+ max_mega_menu_delete_themes();
293
 
294
  $this->redirect( admin_url( "admin.php?page=maxmegamenu_tools&delete_data=true" ) );
295
 
351
 
352
  if ( is_array( $import ) ) {
353
 
354
+ $saved_themes = max_mega_menu_get_themes();
355
 
356
  $next_id = $this->get_next_theme_id();
357
 
361
 
362
  $saved_themes[ $new_theme_id ] = $import;
363
 
364
+ max_mega_menu_save_themes( $saved_themes );
365
 
366
  do_action("megamenu_after_theme_import");
367
 
391
 
392
  $copy = $this->themes[$theme];
393
 
394
+ $saved_themes = max_mega_menu_get_themes();
395
 
396
  $next_id = $this->get_next_theme_id();
397
 
401
 
402
  $saved_themes[ $new_theme_id ] = $copy;
403
 
404
+ max_mega_menu_save_themes( $saved_themes );
405
 
406
  do_action("megamenu_after_theme_duplicate");
407
 
427
  return;
428
  }
429
 
430
+ $saved_themes = max_mega_menu_get_themes();
431
 
432
  if ( isset( $saved_themes[$theme] ) ) {
433
  unset( $saved_themes[$theme] );
434
  }
435
 
436
+ max_mega_menu_save_themes( $saved_themes );
437
 
438
  do_action("megamenu_after_theme_delete");
439
 
455
 
456
  $theme = esc_attr( $_GET['theme_id'] );
457
 
458
+ $saved_themes = max_mega_menu_get_themes();
459
 
460
  if ( isset( $saved_themes[$theme] ) ) {
461
  unset( $saved_themes[$theme] );
462
  }
463
 
464
+ max_mega_menu_save_themes( $saved_themes );
465
 
466
  do_action("megamenu_after_theme_revert");
467
 
483
 
484
  $this->init();
485
 
486
+ $saved_themes = max_mega_menu_get_themes();
487
 
488
  $next_id = $this->get_next_theme_id();
489
 
496
 
497
  $saved_themes[$new_theme_id] = $new_theme;
498
 
499
+ max_mega_menu_save_themes( $saved_themes );
500
 
501
  do_action("megamenu_after_theme_create");
502
 
560
 
561
  $last_id = 0;
562
 
563
+ if ( $saved_themes = max_mega_menu_get_themes() ) {
564
 
565
  foreach ( $saved_themes as $key => $value ) {
566
 
classes/style-manager.class.php CHANGED
@@ -271,7 +271,6 @@ final class Mega_Menu_Style_Manager {
271
  return apply_filters( "megamenu_themes", $themes );
272
  }
273
 
274
-
275
  /**
276
  * Merge the saved themes (from options table) into array of complete themes
277
  *
@@ -279,7 +278,7 @@ final class Mega_Menu_Style_Manager {
279
  */
280
  private function merge_in_saved_themes( $all_themes ) {
281
 
282
- if ( $saved_themes = get_site_option( "megamenu_themes" ) ) {
283
 
284
  foreach ( $saved_themes as $key => $settings ) {
285
 
271
  return apply_filters( "megamenu_themes", $themes );
272
  }
273
 
 
274
  /**
275
  * Merge the saved themes (from options table) into array of complete themes
276
  *
278
  */
279
  private function merge_in_saved_themes( $all_themes ) {
280
 
281
+ if ( $saved_themes = max_mega_menu_get_themes() ) {
282
 
283
  foreach ( $saved_themes as $key => $settings ) {
284
 
classes/toggle-blocks.class.php CHANGED
@@ -48,7 +48,7 @@ class Mega_Menu_Toggle_Blocks {
48
  */
49
  private function get_toggle_blocks_for_theme( $theme_id ) {
50
 
51
- $blocks = get_site_option( "megamenu_toggle_blocks" );
52
 
53
  if ( isset( $blocks[ $theme_id ] ) ) {
54
  return $blocks[ $theme_id ];
@@ -174,7 +174,7 @@ class Mega_Menu_Toggle_Blocks {
174
 
175
  $theme = esc_attr( $_POST['theme_id'] );
176
 
177
- $saved_blocks = get_site_option( "megamenu_toggle_blocks" );
178
 
179
  if ( isset( $saved_blocks[ $theme ] ) ) {
180
  unset( $saved_blocks[ $theme ] );
@@ -184,7 +184,7 @@ class Mega_Menu_Toggle_Blocks {
184
 
185
  $saved_blocks[ $theme ] = $submitted_settings;
186
 
187
- update_site_option( "megamenu_toggle_blocks", $saved_blocks );
188
 
189
  }
190
 
@@ -198,13 +198,13 @@ class Mega_Menu_Toggle_Blocks {
198
 
199
  $theme = esc_attr( $_GET['theme_id'] );
200
 
201
- $saved_toggle_blocks = get_site_option( "megamenu_toggle_blocks" );
202
 
203
  if ( isset( $saved_toggle_blocks[$theme] ) ) {
204
  unset( $saved_toggle_blocks[$theme] );
205
  }
206
 
207
- update_site_option( "megamenu_toggle_blocks", $saved_toggle_blocks );
208
  }
209
 
210
 
@@ -305,12 +305,24 @@ class Mega_Menu_Toggle_Blocks {
305
  } else {
306
  $open_icon = 'disabled';
307
  }
 
 
 
 
 
 
308
 
 
 
 
 
 
 
309
  $styles = array(
310
  'id' => $index,
311
  'align' => isset($settings['align']) ? "'" . $settings['align'] . "'" : "'right'",
312
- 'closed_text' => isset($settings['closed_text']) ? "'" . $settings['closed_text'] . "'" : "'MENU'",
313
- 'open_text' => isset($settings['open_text']) ? "'" . $settings['open_text'] . "'" : "''",
314
  'closed_icon' => $closed_icon != 'disabled' ? "'\\" . $closed_icon . "'" : "''",
315
  'open_icon' => $open_icon != 'disabled' ? "'\\" . $open_icon . "'" : "''",
316
  'text_color' => isset($settings['text_color']) ? $settings['text_color'] : '#fff',
48
  */
49
  private function get_toggle_blocks_for_theme( $theme_id ) {
50
 
51
+ $blocks = max_mega_menu_get_toggle_blocks();
52
 
53
  if ( isset( $blocks[ $theme_id ] ) ) {
54
  return $blocks[ $theme_id ];
174
 
175
  $theme = esc_attr( $_POST['theme_id'] );
176
 
177
+ $saved_blocks = max_mega_menu_get_toggle_blocks();
178
 
179
  if ( isset( $saved_blocks[ $theme ] ) ) {
180
  unset( $saved_blocks[ $theme ] );
184
 
185
  $saved_blocks[ $theme ] = $submitted_settings;
186
 
187
+ max_mega_menu_save_toggle_blocks( $saved_blocks );
188
 
189
  }
190
 
198
 
199
  $theme = esc_attr( $_GET['theme_id'] );
200
 
201
+ $saved_toggle_blocks = max_mega_menu_get_toggle_blocks();
202
 
203
  if ( isset( $saved_toggle_blocks[$theme] ) ) {
204
  unset( $saved_toggle_blocks[$theme] );
205
  }
206
 
207
+ max_mega_menu_save_toggle_blocks( $saved_toggle_blocks );
208
  }
209
 
210
 
305
  } else {
306
  $open_icon = 'disabled';
307
  }
308
+
309
+ if ( isset( $settings['closed_text'] ) ) {
310
+ $closed_text = "'" . do_shortcode( stripslashes( html_entity_decode( $settings['closed_text'], ENT_QUOTES ) ) ) . "'";
311
+ } else {
312
+ $closed_text = "'MENU'";
313
+ }
314
 
315
+ if ( isset( $settings['open_text'] ) ) {
316
+ $open_text = "'" . do_shortcode( stripslashes( html_entity_decode( $settings['open_text'], ENT_QUOTES ) ) ) . "'";
317
+ } else {
318
+ $open_text = "''";
319
+ }
320
+
321
  $styles = array(
322
  'id' => $index,
323
  'align' => isset($settings['align']) ? "'" . $settings['align'] . "'" : "'right'",
324
+ 'closed_text' => $closed_text,
325
+ 'open_text' => $open_text,
326
  'closed_icon' => $closed_icon != 'disabled' ? "'\\" . $closed_icon . "'" : "''",
327
  'open_icon' => $open_icon != 'disabled' ? "'\\" . $open_icon . "'" : "''",
328
  'text_color' => isset($settings['text_color']) ? $settings['text_color'] : '#fff',
classes/widget-manager.class.php CHANGED
@@ -582,14 +582,13 @@ class Mega_Menu_Widget_Manager {
582
 
583
  ?>
584
 
585
- <div class='widget-content'>
586
- <form method='post'>
587
- <input type="hidden" name="widget-id" class="widget-id" value="<?php echo $widget_id ?>" />
588
- <input type='hidden' name='action' value='mm_save_widget' />
589
- <input type='hidden' name='id_base' value='<?php echo $id_base; ?>' />
590
- <input type='hidden' name='widget_id' value='<?php echo $widget_id ?>' />
591
- <input type='hidden' name='_wpnonce' value='<?php echo $nonce ?>' />
592
-
593
  <?php
594
  if ( is_callable( $control['callback'] ) ) {
595
  call_user_func_array( $control['callback'], $control['params'] );
@@ -604,8 +603,9 @@ class Mega_Menu_Widget_Manager {
604
  <?php
605
  submit_button( __( 'Save' ), 'button-primary alignright', 'savewidget', false );
606
  ?>
607
- </form>
608
- </div>
 
609
 
610
  <?php
611
  }
@@ -669,7 +669,7 @@ class Mega_Menu_Widget_Manager {
669
  $return .= ' <h4>' . esc_html( $title ) . '</h4>';
670
  $return .= ' </div>';
671
  $return .= ' </div>';
672
- $return .= ' <div class="widget-inner"></div>';
673
  $return .= '</div>';
674
 
675
  return $return;
582
 
583
  ?>
584
 
585
+ <form method='post'>
586
+ <input type="hidden" name="widget-id" class="widget-id" value="<?php echo $widget_id ?>" />
587
+ <input type='hidden' name='action' value='mm_save_widget' />
588
+ <input type='hidden' name='id_base' class="id_base" value='<?php echo $id_base; ?>' />
589
+ <input type='hidden' name='widget_id' value='<?php echo $widget_id ?>' />
590
+ <input type='hidden' name='_wpnonce' value='<?php echo $nonce ?>' />
591
+ <div class='widget-content'>
 
592
  <?php
593
  if ( is_callable( $control['callback'] ) ) {
594
  call_user_func_array( $control['callback'], $control['params'] );
603
  <?php
604
  submit_button( __( 'Save' ), 'button-primary alignright', 'savewidget', false );
605
  ?>
606
+ </div>
607
+ </form>
608
+
609
 
610
  <?php
611
  }
669
  $return .= ' <h4>' . esc_html( $title ) . '</h4>';
670
  $return .= ' </div>';
671
  $return .= ' </div>';
672
+ $return .= ' <div class="widget-inner widget-inside"></div>';
673
  $return .= '</div>';
674
 
675
  return $return;
js/admin.js CHANGED
@@ -307,6 +307,15 @@
307
  $('#cboxLoadedContent').addClass('depth-' + panel.settings.menu_item_depth).append(header_container).append(tabs_container).append(content_container);
308
  $('#cboxLoadedContent').css({'width': '100%', 'height': '100%', 'display':'block'});
309
  $('#cboxLoadedContent').trigger('megamenu_content_loaded');
 
 
 
 
 
 
 
 
 
310
  }
311
  });
312
 
@@ -443,7 +452,7 @@
443
  }, function (response) {
444
 
445
  var $response = $(response);
446
- var $form = $response.find('form');
447
 
448
  // bind delete button action
449
  $(".delete", $form).on("click", function (e) {
307
  $('#cboxLoadedContent').addClass('depth-' + panel.settings.menu_item_depth).append(header_container).append(tabs_container).append(content_container);
308
  $('#cboxLoadedContent').css({'width': '100%', 'height': '100%', 'display':'block'});
309
  $('#cboxLoadedContent').trigger('megamenu_content_loaded');
310
+
311
+ // fix for WordPress 4.8 widgets when lightbox is opened, closed and reopened
312
+ if (wp.textWidgets !== undefined) {
313
+ wp.textWidgets.widgetControls = {}; // WordPress 4.8 Text Widget
314
+ }
315
+
316
+ if (wp.mediaWidgets !== undefined) {
317
+ wp.mediaWidgets.widgetControls = {}; // WordPress 4.8 Media Widgets
318
+ }
319
  }
320
  });
321
 
452
  }, function (response) {
453
 
454
  var $response = $(response);
455
+ var $form = $response;
456
 
457
  // bind delete button action
458
  $(".delete", $form).on("click", function (e) {
js/maxmegamenu.js CHANGED
@@ -44,6 +44,11 @@
44
  });
45
  }
46
 
 
 
 
 
 
47
  anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel");
48
  plugin.addAnimatingClass(anchor.parent());
49
  };
44
  });
45
  }
46
 
47
+ // pause video widget videos
48
+ anchor.siblings(".mega-sub-menu").find('.widget_media_video video').each(function() {
49
+ this.player.pause();
50
+ });
51
+
52
  anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel");
53
  plugin.addAnimatingClass(anchor.parent());
54
  };
megamenu.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Max Mega Menu
5
  * Plugin URI: https://www.megamenu.com
6
  * Description: Easy to use drag & drop WordPress Mega Menu plugin. Create Mega Menus using Widgets. Responsive, retina & touch ready.
7
- * Version: 2.3.6
8
  * Author: Tom Hemsley
9
  * Author URI: https://www.megamenu.com
10
  * License: GPL-2.0+
@@ -26,7 +26,7 @@ final class Mega_Menu {
26
  /**
27
  * @var string
28
  */
29
- public $version = '2.3.6';
30
 
31
 
32
  /**
@@ -78,6 +78,10 @@ final class Mega_Menu {
78
 
79
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts'), 11 );
80
 
 
 
 
 
81
  add_shortcode( 'maxmenu', array( $this, 'register_shortcode' ) );
82
  add_shortcode( 'maxmegamenu', array( $this, 'register_shortcode' ) );
83
 
@@ -135,7 +139,6 @@ final class Mega_Menu {
135
  // load widget scripts and styles first to allow us to dequeue conflicting colorbox scripts from other plugins
136
  do_action( 'sidebar_admin_setup' );
137
  do_action( 'admin_enqueue_scripts', 'widgets.php' );
138
- do_action( 'admin_print_styles-widgets.php' );
139
  do_action( 'megamenu_nav_menus_scripts', $hook );
140
  }
141
 
@@ -148,6 +151,42 @@ final class Mega_Menu {
148
  }
149
 
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  /**
152
  * Register menu locations created within Max Mega Menu.
153
  *
@@ -1085,3 +1124,139 @@ if ( ! function_exists( 'max_mega_menu_is_enabled' ) ) {
1085
  return is_array( $settings ) && isset( $settings[ $location ]['enabled'] ) && $settings[ $location ]['enabled'] == true;
1086
  }
1087
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  * Plugin Name: Max Mega Menu
5
  * Plugin URI: https://www.megamenu.com
6
  * Description: Easy to use drag & drop WordPress Mega Menu plugin. Create Mega Menus using Widgets. Responsive, retina & touch ready.
7
+ * Version: 2.3.7
8
  * Author: Tom Hemsley
9
  * Author URI: https://www.megamenu.com
10
  * License: GPL-2.0+
26
  /**
27
  * @var string
28
  */
29
+ public $version = '2.3.7';
30
 
31
 
32
  /**
78
 
79
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts'), 11 );
80
 
81
+ add_action( 'admin_print_footer_scripts-nav-menus.php', array( $this, 'admin_print_footer_scripts' ) );
82
+ add_action( 'admin_print_scripts-nav-menus.php', array( $this, 'admin_print_scripts' ) );
83
+ add_action( 'admin_print_styles-nav-menus.php', array( $this, 'admin_print_styles' ) );
84
+
85
  add_shortcode( 'maxmenu', array( $this, 'register_shortcode' ) );
86
  add_shortcode( 'maxmegamenu', array( $this, 'register_shortcode' ) );
87
 
139
  // load widget scripts and styles first to allow us to dequeue conflicting colorbox scripts from other plugins
140
  do_action( 'sidebar_admin_setup' );
141
  do_action( 'admin_enqueue_scripts', 'widgets.php' );
 
142
  do_action( 'megamenu_nav_menus_scripts', $hook );
143
  }
144
 
151
  }
152
 
153
 
154
+ /**
155
+ * Print the widgets.php scripts on the nav-menus.php page. Required for 4.8 Core Media Widgets.
156
+ *
157
+ * @since 2.3.7
158
+ */
159
+ public function admin_print_footer_scripts( $hook ) {
160
+
161
+ do_action( 'admin_footer-widgets.php' );
162
+
163
+ }
164
+
165
+
166
+ /**
167
+ * Print the widgets.php scripts on the nav-menus.php page. Required for 4.8 Core Media Widgets.
168
+ *
169
+ * @since 2.3.7
170
+ */
171
+ public function admin_print_scripts( $hook ) {
172
+
173
+ do_action( 'admin_print_scripts-widgets.php' );
174
+
175
+ }
176
+
177
+
178
+ /**
179
+ * Print the widgets.php scripts on the nav-menus.php page. Required for 4.8 Core Media Widgets.
180
+ *
181
+ * @since 2.3.7
182
+ */
183
+ public function admin_print_styles( $hook ) {
184
+
185
+ do_action( 'admin_print_styles-widgets.php' );
186
+
187
+ }
188
+
189
+
190
  /**
191
  * Register menu locations created within Max Mega Menu.
192
  *
1124
  return is_array( $settings ) && isset( $settings[ $location ]['enabled'] ) && $settings[ $location ]['enabled'] == true;
1125
  }
1126
  }
1127
+
1128
+ if ( ! function_exists('max_mega_menu_share_themes_across_multisite') ) {
1129
+ /*
1130
+ * Return saved themes
1131
+ *
1132
+ * @since 2.3.7
1133
+ */
1134
+ function max_mega_menu_share_themes_across_multisite() {
1135
+
1136
+ if ( defined('MEGAMENU_SHARE_THEMES_MULTISITE') && MEGAMENU_SHARE_THEMES_MULTISITE === false ) {
1137
+ return false;
1138
+ }
1139
+
1140
+ return apply_filters( 'megamenu_share_themes_across_multisite', true );
1141
+
1142
+ }
1143
+ }
1144
+
1145
+ if ( ! function_exists('max_mega_menu_get_themes') ) {
1146
+ /*
1147
+ * Return saved themes
1148
+ *
1149
+ * @since 2.3.7
1150
+ */
1151
+ function max_mega_menu_get_themes() {
1152
+
1153
+ if ( ! max_mega_menu_share_themes_across_multisite() ) {
1154
+ return get_option( "megamenu_themes" );
1155
+ }
1156
+
1157
+ return get_site_option( "megamenu_themes" );
1158
+
1159
+ }
1160
+ }
1161
+
1162
+ if ( ! function_exists('max_mega_menu_save_themes') ) {
1163
+ /*
1164
+ * Save menu theme
1165
+ *
1166
+ * @since 2.3.7
1167
+ */
1168
+ function max_mega_menu_save_themes( $themes ) {
1169
+
1170
+ if ( ! max_mega_menu_share_themes_across_multisite() ) {
1171
+ return update_option( "megamenu_themes", $themes );
1172
+ }
1173
+
1174
+ return update_site_option( "megamenu_themes", $themes );
1175
+
1176
+ }
1177
+ }
1178
+
1179
+ if ( ! function_exists('max_mega_menu_save_last_updated_theme') ) {
1180
+ /*
1181
+ * Save last updated theme
1182
+ *
1183
+ * @since 2.3.7
1184
+ */
1185
+ function max_mega_menu_save_last_updated_theme( $theme ) {
1186
+
1187
+ if ( ! max_mega_menu_share_themes_across_multisite() ) {
1188
+ return update_option( "megamenu_themes_last_updated", $theme );
1189
+ }
1190
+
1191
+ return update_site_option( "megamenu_themes_last_updated", $theme );
1192
+
1193
+ }
1194
+ }
1195
+
1196
+ if ( ! function_exists('max_mega_menu_get_last_updated_theme') ) {
1197
+ /*
1198
+ * Return last updated theme
1199
+ *
1200
+ * @since 2.3.7
1201
+ */
1202
+ function max_mega_menu_get_last_updated_theme() {
1203
+
1204
+ if ( ! max_mega_menu_share_themes_across_multisite() ) {
1205
+ return get_option( "megamenu_themes_last_updated" );
1206
+ }
1207
+
1208
+ return get_site_option( "megamenu_themes_last_updated" );
1209
+
1210
+ }
1211
+ }
1212
+
1213
+ if ( ! function_exists('max_mega_menu_get_toggle_blocks') ) {
1214
+ /*
1215
+ * Return saved toggle blocks
1216
+ *
1217
+ * @since 2.3.7
1218
+ */
1219
+ function max_mega_menu_get_toggle_blocks() {
1220
+
1221
+ if ( ! max_mega_menu_share_themes_across_multisite() ) {
1222
+ return get_option( "megamenu_toggle_blocks" );
1223
+ }
1224
+
1225
+ return get_site_option( "megamenu_toggle_blocks" );
1226
+
1227
+ }
1228
+ }
1229
+
1230
+ if ( ! function_exists('max_mega_menu_save_toggle_blocks') ) {
1231
+ /*
1232
+ * Save toggle blocks
1233
+ *
1234
+ * @since 2.3.7
1235
+ */
1236
+ function max_mega_menu_save_toggle_blocks( $saved_blocks ) {
1237
+
1238
+ if ( ! max_mega_menu_share_themes_across_multisite() ) {
1239
+ return update_option( "megamenu_toggle_blocks", $saved_blocks );
1240
+ }
1241
+
1242
+ return update_site_option( "megamenu_toggle_blocks", $saved_blocks );
1243
+
1244
+ }
1245
+ }
1246
+
1247
+ if ( ! function_exists('max_mega_menu_delete_themes') ) {
1248
+ /*
1249
+ * Delete saved themes
1250
+ *
1251
+ * @since 2.3.7
1252
+ */
1253
+ function max_mega_menu_delete_themes() {
1254
+
1255
+ if ( ! max_mega_menu_share_themes_across_multisite() ) {
1256
+ return delete_option( "megamenu_themes" );
1257
+ }
1258
+
1259
+ return delete_site_option( "megamenu_themes" );
1260
+
1261
+ }
1262
+ }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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: 3.8
5
- Tested up to: 4.7
6
- Stable tag: 2.3.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -96,6 +96,13 @@ See https://www.megamenu.com for more screenshots
96
 
97
  == Changelog ==
98
 
 
 
 
 
 
 
 
99
  = 2.3.6 [09/05/17] =
100
 
101
  * Fix: Mobile breakpoint detection
2
  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: 3.8
5
+ Tested up to: 4.8
6
+ Stable tag: 2.3.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
96
 
97
  == Changelog ==
98
 
99
+ = 2.3.7 [06/07/17]=
100
+
101
+ * Compatibility with WordPress 4.8 Text and Media Widgets
102
+ * Fix: Compatiblity with SiteOrigin Page Builder Layout builder
103
+ * Improvement: Add support for MEGAMENU_SHARE_THEMES_MULTISITE constant
104
+ * Improvement: Process shortcodes in mobile toggle block open and closed text
105
+
106
  = 2.3.6 [09/05/17] =
107
 
108
  * Fix: Mobile breakpoint detection