Max Mega Menu - Version 2.1.5

Version Description

[13/04/2016] =

  • Change: Allow "Hide Text" option to be used on second level menu items
Download this release

Release Info

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

Code changes from version 2.1.3 to 2.1.5

classes/menu-item-manager.class.php CHANGED
@@ -291,13 +291,7 @@ class Mega_Menu_Menu_Item_Manager {
291
  $return .= __("Hide Text", "megamenu");
292
  $return .= ' </td>';
293
  $return .= ' <td class="mega-value">';
294
-
295
- if ( $this->menu_item_depth == 0 ) {
296
- $return .= '<input type="checkbox" name="settings[hide_text]" value="true" ' . checked( $menu_item_meta['hide_text'], 'true', false ) . ' />';
297
- } else {
298
- $return .= '<em>' . __("Option only available for top level menu items", "megamenu") . '</em>';
299
- }
300
-
301
  $return .= ' </td>';
302
  $return .= ' </tr>';
303
  $return .= ' <tr>';
291
  $return .= __("Hide Text", "megamenu");
292
  $return .= ' </td>';
293
  $return .= ' <td class="mega-value">';
294
+ $return .= ' <input type="checkbox" name="settings[hide_text]" value="true" ' . checked( $menu_item_meta['hide_text'], 'true', false ) . ' />';
 
 
 
 
 
 
295
  $return .= ' </td>';
296
  $return .= ' </tr>';
297
  $return .= ' <tr>';
classes/nav-menus.class.php CHANGED
@@ -46,7 +46,7 @@ class Mega_Menu_Nav_Menus {
46
 
47
  add_action( 'admin_init', array( $this, 'register_nav_meta_box' ), 9 );
48
  add_action( 'megamenu_nav_menus_scripts', array( $this, 'enqueue_menu_page_scripts' ), 9 );
49
- add_action( 'megamenu_save_settings', array($this, 'save') );
50
  add_filter( 'hidden_meta_boxes', array( $this, 'show_mega_menu_metabox' ) );
51
 
52
  if ( function_exists( 'siteorigin_panels_admin_enqueue_scripts' ) ) {
@@ -194,8 +194,6 @@ class Mega_Menu_Nav_Menus {
194
 
195
  $menu_id = $this->get_selected_menu_id();
196
 
197
- do_action("megamenu_save_settings");
198
-
199
  $this->print_enable_megamenu_options( $menu_id );
200
 
201
  }
@@ -208,13 +206,33 @@ class Mega_Menu_Nav_Menus {
208
  */
209
  public function save() {
210
 
 
 
211
  if ( isset( $_POST['menu'] ) && $_POST['menu'] > 0 && is_nav_menu( $_POST['menu'] ) && isset( $_POST['megamenu_meta'] ) ) {
212
 
213
- $submitted_settings = $_POST['megamenu_meta'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
 
215
  if ( ! get_option( 'megamenu_settings' ) ) {
216
 
217
- add_option( 'megamenu_settings', $submitted_settings );
218
 
219
  } else {
220
 
@@ -232,6 +250,8 @@ class Mega_Menu_Nav_Menus {
232
 
233
  }
234
 
 
 
235
  }
236
 
237
 
@@ -300,6 +320,12 @@ class Mega_Menu_Nav_Menus {
300
 
301
  submit_button( __( 'Save' ), 'max-mega-menu-save button-primary alignright');
302
 
 
 
 
 
 
 
303
  }
304
 
305
  }
46
 
47
  add_action( 'admin_init', array( $this, 'register_nav_meta_box' ), 9 );
48
  add_action( 'megamenu_nav_menus_scripts', array( $this, 'enqueue_menu_page_scripts' ), 9 );
49
+ add_action( 'wp_ajax_mm_save_settings', array($this, 'save') );
50
  add_filter( 'hidden_meta_boxes', array( $this, 'show_mega_menu_metabox' ) );
51
 
52
  if ( function_exists( 'siteorigin_panels_admin_enqueue_scripts' ) ) {
194
 
195
  $menu_id = $this->get_selected_menu_id();
196
 
 
 
197
  $this->print_enable_megamenu_options( $menu_id );
198
 
199
  }
206
  */
207
  public function save() {
208
 
209
+ check_ajax_referer( 'megamenu_edit', 'nonce' );
210
+
211
  if ( isset( $_POST['menu'] ) && $_POST['menu'] > 0 && is_nav_menu( $_POST['menu'] ) && isset( $_POST['megamenu_meta'] ) ) {
212
 
213
+ $raw_submitted_settings = $_POST['megamenu_meta'];
214
+
215
+ $parsed_submitted_settings = json_decode( stripslashes( $raw_submitted_settings ), true );
216
+
217
+ $submitted_settings = array();
218
+
219
+ foreach ( $parsed_submitted_settings as $index => $value ) {
220
+ $name = $value['name'];
221
+
222
+ // find values between square brackets
223
+ preg_match_all( "/\[(.*?)\]/", $name, $matches );
224
+
225
+ if ( isset( $matches[1][0] ) && isset( $matches[1][1] ) ) {
226
+ $location = $matches[1][0];
227
+ $setting = $matches[1][1];
228
+
229
+ $submitted_settings[$location][$setting] = $value['value'];
230
+ }
231
+ }
232
 
233
  if ( ! get_option( 'megamenu_settings' ) ) {
234
 
235
+ update_option( 'megamenu_settings', $submitted_settings );
236
 
237
  } else {
238
 
250
 
251
  }
252
 
253
+ wp_die();
254
+
255
  }
256
 
257
 
320
 
321
  submit_button( __( 'Save' ), 'max-mega-menu-save button-primary alignright');
322
 
323
+ ?>
324
+
325
+ <span class='spinner'></span>
326
+
327
+ <?php
328
+
329
  }
330
 
331
  }
classes/walker.class.php CHANGED
@@ -129,7 +129,7 @@ class Mega_Menu_Walker extends Walker_Nav_Menu {
129
  $item_output = $args->before;
130
  $item_output .= '<a'. $attributes .'>';
131
 
132
- if ( $settings['hide_text'] == 'true' && $depth == 0 ) {
133
  /** This filter is documented in wp-includes/post-template.php */
134
  } else {
135
  $item_output .= $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after;
129
  $item_output = $args->before;
130
  $item_output .= '<a'. $attributes .'>';
131
 
132
+ if ( $settings['hide_text'] == 'true' ) {
133
  /** This filter is documented in wp-includes/post-template.php */
134
  } else {
135
  $item_output .= $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after;
css/admin/menus.css CHANGED
@@ -933,12 +933,15 @@
933
  }
934
 
935
  .mega_menu_meta_box p.submit {
936
- float: left;
937
  text-align: right;
938
- width: 100%;
939
  margin: 0 0 15px 0;
940
  padding: 0;
941
  }
 
 
 
942
 
943
  #nav-menu-meta .mega_menu_meta_box .accordion-section-content {
944
  padding: 0 10px;
933
  }
934
 
935
  .mega_menu_meta_box p.submit {
936
+ float: right;
937
  text-align: right;
938
+ width: auto;
939
  margin: 0 0 15px 0;
940
  padding: 0;
941
  }
942
+ .mega_menu_meta_box .spinner {
943
+ float: right;
944
+ }
945
 
946
  #nav-menu-meta .mega_menu_meta_box .accordion-section-content {
947
  padding: 0 10px;
css/toggle-blocks.scss CHANGED
@@ -54,6 +54,7 @@
54
 
55
  #mega-toggle-block-#{$id} {
56
  width: $width;
 
57
  }
58
 
59
  }
54
 
55
  #mega-toggle-block-#{$id} {
56
  width: $width;
57
+ margin: 0;
58
  }
59
 
60
  }
js/admin.js CHANGED
@@ -591,8 +591,22 @@ jQuery(function ($) {
591
  tab.parent().siblings("." + tab_id).show();
592
  });
593
 
594
- // Polylang Fix - stop Language Switcher item being added every time the MMM settings are saved
595
- $(".max-mega-menu-save").on('click', function() {
596
- $(".nav-menu-meta").find('input[value="#pll_switcher"]').val("");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  });
598
  });
591
  tab.parent().siblings("." + tab_id).show();
592
  });
593
 
594
+ // AJAX Save MMM Settings
595
+ $(".max-mega-menu-save").on('click', function(e) {
596
+ e.preventDefault();
597
+
598
+ $(".mega_menu_meta_box .spinner").css('visibility', 'visible');
599
+
600
+ var settings = JSON.stringify($( "[name^='megamenu_meta']" ).serializeArray());
601
+
602
+ // retrieve the widget settings form
603
+ $.post(ajaxurl, {
604
+ action: "mm_save_settings",
605
+ menu: $('#menu').val(),
606
+ megamenu_meta: settings,
607
+ nonce: megamenu.nonce
608
+ }, function (response) {
609
+ $(".mega_menu_meta_box .spinner").css('visibility', 'hidden');
610
+ });
611
  });
612
  });
js/maxmegamenu.js CHANGED
@@ -28,10 +28,9 @@
28
  plugin.settings = {};
29
 
30
  var isTouchDevice = function() {
31
- return (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch);
32
  };
33
 
34
-
35
  plugin.hidePanel = function(anchor, immediate) {
36
 
37
  anchor.siblings('.mega-sub-menu').children('.mega-toggle-on').removeClass('mega-toggle-on');
28
  plugin.settings = {};
29
 
30
  var isTouchDevice = function() {
31
+ return ('ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0 || (window.DocumentTouch && document instanceof DocumentTouch));
32
  };
33
 
 
34
  plugin.hidePanel = function(anchor, immediate) {
35
 
36
  anchor.siblings('.mega-sub-menu').children('.mega-toggle-on').removeClass('mega-toggle-on');
js/toggledesigner.js CHANGED
@@ -44,7 +44,7 @@ jQuery(function($) {
44
 
45
  var block = $(this);
46
 
47
- block.find('input, select').each(function() {
48
  // account for inputs created by select2
49
  if (typeof $(this).attr('name') !== 'undefined') {
50
  $(this).attr('name', $(this).attr('name').replace(/\[\d+\]/g, "[" + i + "]"));
44
 
45
  var block = $(this);
46
 
47
+ block.find('input, select, textarea').each(function() {
48
  // account for inputs created by select2
49
  if (typeof $(this).attr('name') !== 'undefined') {
50
  $(this).attr('name', $(this).attr('name').replace(/\[\d+\]/g, "[" + i + "]"));
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.3
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.3';
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.5
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.5';
30
 
31
 
32
  /**
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
- === Plugin Name ===
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.4
6
- Stable tag: 2.1.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -92,6 +92,17 @@ See https://www.maxmegamenu.com for more screenshots
92
 
93
  == Changelog ==
94
 
 
 
 
 
 
 
 
 
 
 
 
95
  = 2.1.3 [21/03/2016] =
96
 
97
  * Fix: JSON Theme Export
1
+ === Max Mega Menu ===
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.5
6
+ Stable tag: 2.1.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
92
 
93
  == Changelog ==
94
 
95
+ = 2.1.5 [13/04/2016] =
96
+
97
+ * Change: Allow "Hide Text" option to be used on second level menu items
98
+
99
+ = 2.1.4 [11/04/2016] =
100
+
101
+ * Fix for WordPress v4.5: Unable to save mega menu settings on Appearance > Menus page
102
+ (Works around this change to core: https://core.trac.wordpress.org/changeset/36426)
103
+ * Change: Allow textarea fields in toggle blocks
104
+ * Change: Remove margin from Spacer toggle blocks
105
+
106
  = 2.1.3 [21/03/2016] =
107
 
108
  * Fix: JSON Theme Export