Responsive Menu - Version 4.0.3

Version Description

(07th January 2021) = * Enhancement: Improved caching for API response * Bug: Improved multi language menu support with WPML * Bug: Fixed theme compatibility issues * Bug: Fixed some php notices and errors

Download this release

Release Info

Developer expresstech
Plugin Icon 128x128 Responsive Menu
Version 4.0.3
Comparing to
See all releases

Code changes from version 4.0.2 to 4.0.3

readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: expresstech,responsivemenu
3
  Tags: responsive, mega menu, navigation, mobile, hamburger
4
  Requires at least: 3.6
5
  Tested up to: 5.6
6
- Stable tag: 4.0.2
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -110,6 +110,12 @@ To view our FAQ, please go to [https://responsive.menu/faq/](https://responsive.
110
  15. Admin Desktop Menu Section
111
 
112
  == Changelog ==
 
 
 
 
 
 
113
  = 4.0.2 (29th Dec 2020) =
114
  * Feature: Added responsive menu elementor widget
115
  * Enhancement: Improved theme visibility in new menu wizard
3
  Tags: responsive, mega menu, navigation, mobile, hamburger
4
  Requires at least: 3.6
5
  Tested up to: 5.6
6
+ Stable tag: 4.0.3
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
110
  15. Admin Desktop Menu Section
111
 
112
  == Changelog ==
113
+ = 4.0.3 (07th January 2021) =
114
+ * Enhancement: Improved caching for API response
115
+ * Bug: Improved multi language menu support with WPML
116
+ * Bug: Fixed theme compatibility issues
117
+ * Bug: Fixed some php notices and errors
118
+
119
  = 4.0.2 (29th Dec 2020) =
120
  * Feature: Added responsive menu elementor widget
121
  * Enhancement: Improved theme visibility in new menu wizard
responsive-menu.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Responsive Menu
5
  Plugin URI: https://expresstech.io
6
  Description: Highly Customisable Responsive Menu Plugin for WordPress
7
- Version: 4.0.2
8
  Author: ExpressTech
9
  Text Domain: responsive-menu
10
  Author URI: https://responsive.menu
@@ -16,7 +16,7 @@ Tags: responsive, menu, responsive menu, mega menu, max mega menu, max menu
16
  * Constant as plugin version.
17
  */
18
  if ( ! defined( 'RMP_PLUGIN_VERSION' ) ) {
19
- define( 'RMP_PLUGIN_VERSION', '4.0.2' );
20
  }
21
 
22
  define('RESPONSIVE_MENU_URL', plugin_dir_url( __FILE__ ) );
4
  Plugin Name: Responsive Menu
5
  Plugin URI: https://expresstech.io
6
  Description: Highly Customisable Responsive Menu Plugin for WordPress
7
+ Version: 4.0.3
8
  Author: ExpressTech
9
  Text Domain: responsive-menu
10
  Author URI: https://responsive.menu
16
  * Constant as plugin version.
17
  */
18
  if ( ! defined( 'RMP_PLUGIN_VERSION' ) ) {
19
+ define( 'RMP_PLUGIN_VERSION', '4.0.3' );
20
  }
21
 
22
  define('RESPONSIVE_MENU_URL', plugin_dir_url( __FILE__ ) );
v4.0.0/inc/classes/class-plugin.php CHANGED
@@ -122,6 +122,12 @@ class Plugin {
122
  */
123
  public function has_support( $hook ) {
124
 
 
 
 
 
 
 
125
  // Check wp core support wp_body_open hook or not.
126
  if( ! has_action( $hook ) ) {
127
  return false;
122
  */
123
  public function has_support( $hook ) {
124
 
125
+ // Check wp footer option is enabled.
126
+ $option_manager = Option_Manager::get_instance();
127
+ if ( 'wp_body_open' == $hook && 'on' == $option_manager->get_global_option( 'rmp_wp_footer_hook' ) ) {
128
+ return false;
129
+ }
130
+
131
  // Check wp core support wp_body_open hook or not.
132
  if( ! has_action( $hook ) ) {
133
  return false;
v4.0.0/inc/classes/class-rmp-menu.php CHANGED
@@ -317,26 +317,17 @@ if ( ! class_exists( 'RMP_Menu' ) ) :
317
  public function rmp_nav_menu_args( $args = null ) {
318
 
319
  $menu = $this->get_wp_menu_to_use();
 
 
320
 
321
- // Check menu exist or not.
322
- $is_exist = false;
323
- foreach( get_terms('nav_menu') as $nav_menu ) {
324
- if ( $nav_menu->slug === $menu ) {
325
- $is_exist = true;
326
- break;
327
- }
328
- }
329
-
330
- if ( ! $is_exist ) {
331
  return $args;
332
  }
333
 
334
- $menu_location = $this->get_wp_menu_location();
335
- $menu_depth = $this->options['menu_depth'];
336
- $wp_menu_obj = wp_get_nav_menu_object( $menu );
337
-
338
- if ( empty( $menu_depth ) ) {
339
- $menu_depth = 0;
340
  }
341
 
342
  $menu_label = ! empty( $this->options['menu_name'] ) ? $this->options['menu_name'] : 'Default';
317
  public function rmp_nav_menu_args( $args = null ) {
318
 
319
  $menu = $this->get_wp_menu_to_use();
320
+ $menu_location = $this->get_wp_menu_location();
321
+ $wp_menu_obj = wp_get_nav_menu_object( $menu );
322
 
323
+ // Check menu object is not empty.
324
+ if ( empty( $wp_menu_obj ) ) {
 
 
 
 
 
 
 
 
325
  return $args;
326
  }
327
 
328
+ $menu_depth = 0;
329
+ if ( ! empty( $this->options['menu_depth'] ) ) {
330
+ $menu_depth = $this->options['menu_depth'];
 
 
 
331
  }
332
 
333
  $menu_label = ! empty( $this->options['menu_name'] ) ? $this->options['menu_name'] : 'Default';
v4.0.0/inc/classes/class-theme-manager.php CHANGED
@@ -56,15 +56,22 @@ class Theme_Manager {
56
  add_action('wp_ajax_rmp_theme_download', array( $this, 'rmp_theme_download' ) );
57
  }
58
 
59
-
60
  /**
61
  * Function to get the list of pro theme from store.
62
- *
63
- * @since 4.0.0
64
  *
 
 
 
65
  * @return array $pro_themes
66
  */
67
  public function get_themes_by_api() {
 
 
 
 
 
 
 
68
  $pro_themes = [];
69
 
70
  //These are older version theme which are not compatible with new version.
@@ -88,6 +95,9 @@ class Theme_Manager {
88
  }
89
  }
90
 
 
 
 
91
  return $pro_themes;
92
  }
93
 
@@ -521,6 +531,9 @@ class Theme_Manager {
521
  }
522
 
523
  $uploaded_themes = $this->get_uploaded_theme_dir();
 
 
 
524
 
525
  $html = '';
526
  foreach( $themes as $theme ) {
56
  add_action('wp_ajax_rmp_theme_download', array( $this, 'rmp_theme_download' ) );
57
  }
58
 
 
59
  /**
60
  * Function to get the list of pro theme from store.
 
 
61
  *
62
+ * @since 4.0.0 Added this function to call the menu theme API
63
+ * @since 4.0.3 Cached the API response
64
+ *
65
  * @return array $pro_themes
66
  */
67
  public function get_themes_by_api() {
68
+
69
+ // If theme list is cached then access it.
70
+ $pro_themes = get_transient( 'rmp_theme_api_response' );
71
+ if ( ! empty( $pro_themes ) ) {
72
+ return $pro_themes;
73
+ }
74
+
75
  $pro_themes = [];
76
 
77
  //These are older version theme which are not compatible with new version.
95
  }
96
  }
97
 
98
+ // Cache the theme response.
99
+ set_transient( 'rmp_theme_api_response', $pro_themes, DAY_IN_SECONDS );
100
+
101
  return $pro_themes;
102
  }
103
 
531
  }
532
 
533
  $uploaded_themes = $this->get_uploaded_theme_dir();
534
+ if ( empty( $uploaded_themes ) || ! is_array( $uploaded_themes ) ) {
535
+ $uploaded_themes = [];
536
+ }
537
 
538
  $html = '';
539
  foreach( $themes as $theme ) {
v4.0.0/inc/helpers/default-options.php CHANGED
@@ -27,6 +27,7 @@ function rmp_global_default_setting_options() {
27
  'rmp_remove_glyphicon' => 'off',
28
  'rmp_remove_dashicons' => 'off',
29
  'rmp_remove_material_icons' => 'off',
 
30
  ];
31
  }
32
 
27
  'rmp_remove_glyphicon' => 'off',
28
  'rmp_remove_dashicons' => 'off',
29
  'rmp_remove_material_icons' => 'off',
30
+ 'rmp_wp_footer_hook' => 'off'
31
  ];
32
  }
33
 
v4.0.0/templates/rmp-settings.php CHANGED
@@ -94,6 +94,20 @@ if ( ! empty( $global_settings['menu_adjust_for_wp_admin_bar'] ) ) {
94
  </td>
95
  </tr>
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  <tr>
98
  <th scope="row"> <?php esc_html_e( 'Use external files', 'responsive-menu-pro'); ?></th>
99
  <td>
94
  </td>
95
  </tr>
96
 
97
+ <tr>
98
+ <th scope="row"> <?php esc_html_e( 'Use wp_footer hook', 'responsive-menu-pro'); ?></th>
99
+ <td>
100
+ <fieldset>
101
+ <p>
102
+ <input type="checkbox" name="rmp_wp_footer_hook" value="on" id="rmp-wp-footer-hook" <?php echo is_rmp_option_checked( 'on', $global_settings, 'rmp_wp_footer_hook' );?> >
103
+ <label for="rmp-wp-footer-hook" class="description">
104
+ <?php esc_html_e( 'Enable this option if your theme does not support wp_body_open hook.', 'responsive-menu-pro'); ?>
105
+ </label>
106
+ </p>
107
+ </fieldset>
108
+ </td>
109
+ </tr>
110
+
111
  <tr>
112
  <th scope="row"> <?php esc_html_e( 'Use external files', 'responsive-menu-pro'); ?></th>
113
  <td>