Version Description
(29th Dec 2020) = * Feature: Added responsive menu elementor widget * Enhancement: Improved theme visibility in new menu wizard
Download this release
Release Info
Developer | expresstech |
Plugin | Responsive Menu |
Version | 4.0.2 |
Comparing to | |
See all releases |
Code changes from version 4.0.1 to 4.0.2
- readme.txt +4 -1
- responsive-menu.php +2 -2
- v4.0.0/assets/admin/js/rmp-elementor.js +21 -0
- v4.0.0/assets/js/rmp-menu.js +1 -3
- v4.0.0/inc/classes/class-plugin.php +2 -0
- v4.0.0/inc/classes/class-theme-manager.php +60 -5
- v4.0.0/inc/classes/elementor/class-elementor-manager.php +220 -0
- v4.0.0/inc/classes/elementor/widgets/class-rmp-widget.php +157 -0
- v4.0.0/inc/helpers/autoloader.php +1 -0
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.
|
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,9 @@ To view our FAQ, please go to [https://responsive.menu/faq/](https://responsive.
|
|
110 |
15. Admin Desktop Menu Section
|
111 |
|
112 |
== Changelog ==
|
|
|
|
|
|
|
113 |
|
114 |
= 4.0.1 (15th Dec 2020) =
|
115 |
* Enhancement: Hide WordPress admin bar from menu preview
|
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 |
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
|
116 |
|
117 |
= 4.0.1 (15th Dec 2020) =
|
118 |
* Enhancement: Hide WordPress admin bar from menu preview
|
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.
|
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.
|
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.2
|
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.2' );
|
20 |
}
|
21 |
|
22 |
define('RESPONSIVE_MENU_URL', plugin_dir_url( __FILE__ ) );
|
v4.0.0/assets/admin/js/rmp-elementor.js
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* This file contain the scripts related to responsive menu and elementor based features.
|
3 |
+
*
|
4 |
+
* @since 4.0.2
|
5 |
+
*/
|
6 |
+
jQuery( document ).ready( function() {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Fires the event when change menu the responsive menu widget.
|
10 |
+
*
|
11 |
+
* @fires change
|
12 |
+
*/
|
13 |
+
jQuery(document).on( 'change', 'select[data-setting="rmp_menu"]', (e) => {
|
14 |
+
let menu_id = jQuery( e.target ).val();
|
15 |
+
const link = jQuery( e.target ).parents('.elementor-control-content').find('.rmp-menu-edit-link');
|
16 |
+
var href = new URL( link.attr( 'href' ) );
|
17 |
+
href.searchParams.set( 'post', menu_id );
|
18 |
+
link.attr( 'href', href.toString() );
|
19 |
+
} );
|
20 |
+
|
21 |
+
} );
|
v4.0.0/assets/js/rmp-menu.js
CHANGED
@@ -70,10 +70,8 @@ jQuery( document ).ready( function( jQuery ) {
|
|
70 |
self.triggerMenu();
|
71 |
} );
|
72 |
|
73 |
-
|
74 |
-
|
75 |
// Show/Hide sub menu item when click on item toggle.
|
76 |
-
jQuery( self.
|
77 |
e.preventDefault();
|
78 |
e.stopPropagation();
|
79 |
self.triggerSubArrow( this );
|
70 |
self.triggerMenu();
|
71 |
} );
|
72 |
|
|
|
|
|
73 |
// Show/Hide sub menu item when click on item toggle.
|
74 |
+
jQuery( self.menuWrap ).find( self.subMenuArrow ).on( 'click', function( e ) {
|
75 |
e.preventDefault();
|
76 |
e.stopPropagation();
|
77 |
self.triggerSubArrow( this );
|
v4.0.0/inc/classes/class-plugin.php
CHANGED
@@ -7,6 +7,7 @@
|
|
7 |
|
8 |
namespace RMP\Features\Inc;
|
9 |
|
|
|
10 |
use RMP\Features\Inc\Traits\Singleton;
|
11 |
|
12 |
/**
|
@@ -32,6 +33,7 @@ class Plugin {
|
|
32 |
Style_Manager::get_instance();
|
33 |
UI_Manager::get_instance();
|
34 |
RMP_Migration::get_instance();
|
|
|
35 |
|
36 |
$this->setup_hooks();
|
37 |
}
|
7 |
|
8 |
namespace RMP\Features\Inc;
|
9 |
|
10 |
+
use RMP\Features\Inc\Elementor\Elementor_Manager;
|
11 |
use RMP\Features\Inc\Traits\Singleton;
|
12 |
|
13 |
/**
|
33 |
Style_Manager::get_instance();
|
34 |
UI_Manager::get_instance();
|
35 |
RMP_Migration::get_instance();
|
36 |
+
Elementor_Manager::get_instance();
|
37 |
|
38 |
$this->setup_hooks();
|
39 |
}
|
v4.0.0/inc/classes/class-theme-manager.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* This file contain the Theme_Manager class and it's functionalities for menu.
|
4 |
-
*
|
5 |
-
* @
|
6 |
* @author Expresstech System
|
7 |
*
|
8 |
* @package responsive-menu-pro
|
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
22 |
* Class Theme_Manager
|
23 |
* This class is handling the menu themes and its functionalities.
|
24 |
*
|
25 |
-
* @
|
26 |
*/
|
27 |
class Theme_Manager {
|
28 |
|
@@ -44,7 +44,7 @@ class Theme_Manager {
|
|
44 |
/**
|
45 |
* To setup action/filter.
|
46 |
*
|
47 |
-
* @
|
48 |
*
|
49 |
* @return void
|
50 |
*/
|
@@ -79,6 +79,7 @@ class Theme_Manager {
|
|
79 |
if ( ! in_array( $product['info']['id'], $exclude_theme_ids ) ) {
|
80 |
$pro_themes[] = array(
|
81 |
'name' => $product['info']['title'],
|
|
|
82 |
'preview_url' => $product['info']['thumbnail'],
|
83 |
'buy_link' => $product['info']['link'],
|
84 |
'price' => $product['pricing']['amount']
|
@@ -317,7 +318,13 @@ class Theme_Manager {
|
|
317 |
return $status;
|
318 |
}
|
319 |
|
320 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
public function get_themes_from_uploads() {
|
322 |
|
323 |
$theme_url = wp_upload_dir()['baseurl'] . '/rmp-menu/themes';
|
@@ -340,6 +347,39 @@ class Theme_Manager {
|
|
340 |
return $themes;
|
341 |
}
|
342 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
public function rmp_save_theme() {
|
344 |
|
345 |
check_ajax_referer( 'rmp_nonce', 'ajax_nonce' );
|
@@ -465,16 +505,31 @@ class Theme_Manager {
|
|
465 |
return $html;
|
466 |
}
|
467 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
468 |
public function get_themes_from_theme_store( $in_wizard = false ) {
|
|
|
469 |
$themes = $this->get_themes_by_api();
|
470 |
|
471 |
if ( empty( $themes ) && $in_wizard ) {
|
472 |
return __( '<h2>Coming soon..</h2>', 'responsive-menu-pro' );
|
473 |
}
|
474 |
|
|
|
|
|
475 |
$html = '';
|
476 |
foreach( $themes as $theme ) {
|
477 |
|
|
|
|
|
|
|
|
|
|
|
478 |
$action_label = __( 'BUY NOW','responsive-menu-pro' );
|
479 |
$status = __( 'Pro','responsive-menu-pro' );
|
480 |
if ( 0 == $theme['price'] ) {
|
1 |
<?php
|
2 |
/**
|
3 |
* This file contain the Theme_Manager class and it's functionalities for menu.
|
4 |
+
*
|
5 |
+
* @since 4.0.0
|
6 |
* @author Expresstech System
|
7 |
*
|
8 |
* @package responsive-menu-pro
|
22 |
* Class Theme_Manager
|
23 |
* This class is handling the menu themes and its functionalities.
|
24 |
*
|
25 |
+
* @since 4.0.0
|
26 |
*/
|
27 |
class Theme_Manager {
|
28 |
|
44 |
/**
|
45 |
* To setup action/filter.
|
46 |
*
|
47 |
+
* @since 4.0.0
|
48 |
*
|
49 |
* @return void
|
50 |
*/
|
79 |
if ( ! in_array( $product['info']['id'], $exclude_theme_ids ) ) {
|
80 |
$pro_themes[] = array(
|
81 |
'name' => $product['info']['title'],
|
82 |
+
'slug' => $product['info']['slug'],
|
83 |
'preview_url' => $product['info']['thumbnail'],
|
84 |
'buy_link' => $product['info']['link'],
|
85 |
'price' => $product['pricing']['amount']
|
318 |
return $status;
|
319 |
}
|
320 |
|
321 |
+
/**
|
322 |
+
* Returns the theme list with meta info.
|
323 |
+
*
|
324 |
+
* @since 4.0.0
|
325 |
+
*
|
326 |
+
* @return array $theme
|
327 |
+
*/
|
328 |
public function get_themes_from_uploads() {
|
329 |
|
330 |
$theme_url = wp_upload_dir()['baseurl'] . '/rmp-menu/themes';
|
347 |
return $themes;
|
348 |
}
|
349 |
|
350 |
+
/**
|
351 |
+
* Returns the theme dir list to supress the theme which are in downloaded list.
|
352 |
+
*
|
353 |
+
* @since 4.0.2
|
354 |
+
*
|
355 |
+
* @return array $theme_dirs
|
356 |
+
*/
|
357 |
+
public function get_uploaded_theme_dir() {
|
358 |
+
|
359 |
+
$themes = $this->get_themes_from_uploads();
|
360 |
+
|
361 |
+
if ( empty( $themes ) ) {
|
362 |
+
return;
|
363 |
+
}
|
364 |
+
|
365 |
+
$theme_dirs = [];
|
366 |
+
foreach( $themes as $theme => $theme_meta ) {
|
367 |
+
|
368 |
+
// Replace the these older themes dir name as slug.
|
369 |
+
if ( 'electric blue theme' == $theme ) {
|
370 |
+
$theme_dirs[] = 'electric-blue-free';
|
371 |
+
} else if( 'full-width-theme' == $theme ) {
|
372 |
+
$theme_dirs[] = 'full-width-free';
|
373 |
+
} else if( 'simple-red-theme' == $theme ) {
|
374 |
+
$theme_dirs[] = 'simple-red-free';
|
375 |
+
} else {
|
376 |
+
$theme_dirs[] = strtolower( $theme );
|
377 |
+
}
|
378 |
+
}
|
379 |
+
|
380 |
+
return $theme_dirs;
|
381 |
+
}
|
382 |
+
|
383 |
public function rmp_save_theme() {
|
384 |
|
385 |
check_ajax_referer( 'rmp_nonce', 'ajax_nonce' );
|
505 |
return $html;
|
506 |
}
|
507 |
|
508 |
+
/**
|
509 |
+
* Design the theme list which are from stored.
|
510 |
+
*
|
511 |
+
* @since 4.0.0
|
512 |
+
*
|
513 |
+
* @return HTML|string $html
|
514 |
+
*/
|
515 |
public function get_themes_from_theme_store( $in_wizard = false ) {
|
516 |
+
|
517 |
$themes = $this->get_themes_by_api();
|
518 |
|
519 |
if ( empty( $themes ) && $in_wizard ) {
|
520 |
return __( '<h2>Coming soon..</h2>', 'responsive-menu-pro' );
|
521 |
}
|
522 |
|
523 |
+
$uploaded_themes = $this->get_uploaded_theme_dir();
|
524 |
+
|
525 |
$html = '';
|
526 |
foreach( $themes as $theme ) {
|
527 |
|
528 |
+
// Avoid the themes which are already uploaded.
|
529 |
+
if ( in_array( strtolower( $theme['slug'] ), $uploaded_themes ) ) {
|
530 |
+
continue;
|
531 |
+
}
|
532 |
+
|
533 |
$action_label = __( 'BUY NOW','responsive-menu-pro' );
|
534 |
$status = __( 'Pro','responsive-menu-pro' );
|
535 |
if ( 0 == $theme['price'] ) {
|
v4.0.0/inc/classes/elementor/class-elementor-manager.php
ADDED
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Elementor Manager class will handle the elementor related features of responsive menu.
|
4 |
+
*
|
5 |
+
* @category Class
|
6 |
+
* @package ElementorAwesomesauce
|
7 |
+
* @author Expresstech System
|
8 |
+
* @since 4.0.2
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace RMP\Features\Inc\Elementor;
|
12 |
+
use RMP\Features\Inc\Traits\Singleton;
|
13 |
+
use RMP\Features\Inc\Elementor\Widgets\RMP_Widget;
|
14 |
+
|
15 |
+
// Security Note: Blocks direct access to the plugin PHP files.
|
16 |
+
defined( 'ABSPATH' ) || die();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Class Elementor_Manager
|
20 |
+
*
|
21 |
+
* @since 4.0.2
|
22 |
+
*/
|
23 |
+
class Elementor_Manager {
|
24 |
+
|
25 |
+
use Singleton;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Minimum Elementor Version
|
29 |
+
*
|
30 |
+
* @since 4.0.2
|
31 |
+
* @var string Minimum Elementor version required to run the plugin.
|
32 |
+
*/
|
33 |
+
const MINIMUM_ELEMENTOR_VERSION = '2.0.0';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Minimum PHP Version
|
37 |
+
*
|
38 |
+
* @since 4.0.2
|
39 |
+
* @var string Minimum PHP version required to run the plugin.
|
40 |
+
*/
|
41 |
+
const MINIMUM_PHP_VERSION = '7.0';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Construct method.
|
45 |
+
*/
|
46 |
+
protected function __construct() {
|
47 |
+
$this->setup_hooks();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* To setup action/filter.
|
52 |
+
*
|
53 |
+
* @return void
|
54 |
+
*/
|
55 |
+
protected function setup_hooks() {
|
56 |
+
add_action( 'plugins_loaded', array( $this, 'elementor_init' ) );
|
57 |
+
add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'elementor_enqueue_scripts' ] );
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* To enqueue scripts and styles in elementor admin.
|
62 |
+
*
|
63 |
+
* @param string $hook_suffix Admin page name.
|
64 |
+
*
|
65 |
+
* @return void
|
66 |
+
*/
|
67 |
+
public function elementor_enqueue_scripts( $hook_suffix ) {
|
68 |
+
|
69 |
+
wp_enqueue_script(
|
70 |
+
'rmp_elementor_scripts',
|
71 |
+
RMP_PLUGIN_URL_V4 . '/assets/admin/js/rmp-elementor.js',
|
72 |
+
array( 'jquery' ),
|
73 |
+
RMP_PLUGIN_VERSION,
|
74 |
+
true
|
75 |
+
);
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Initialize the plugin
|
80 |
+
*
|
81 |
+
* Validates that Elementor is already loaded.
|
82 |
+
* Checks for basic plugin requirements, if one check fail don't continue,
|
83 |
+
* if all check have passed include the plugin class.
|
84 |
+
*
|
85 |
+
* Fired by `plugins_loaded` action hook.
|
86 |
+
*
|
87 |
+
* @since 4.0.2
|
88 |
+
* @access public
|
89 |
+
*/
|
90 |
+
public function elementor_init() {
|
91 |
+
|
92 |
+
// Check if Elementor installed and activated.
|
93 |
+
if ( ! did_action( 'elementor/loaded' ) ) {
|
94 |
+
add_action( 'admin_notices', array( $this, 'admin_notice_missing_main_plugin' ) );
|
95 |
+
return;
|
96 |
+
}
|
97 |
+
|
98 |
+
// Check for required Elementor version.
|
99 |
+
if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) {
|
100 |
+
add_action( 'admin_notices', array( $this, 'admin_notice_minimum_elementor_version' ) );
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
|
104 |
+
// Check for required PHP version.
|
105 |
+
if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
|
106 |
+
add_action( 'admin_notices', array( $this, 'admin_notice_minimum_php_version' ) );
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
add_action( 'elementor/widgets/widgets_registered', array( $this, 'register_widgets' ) );
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Admin notice
|
115 |
+
*
|
116 |
+
* Warning when the site doesn't have Elementor installed or activated.
|
117 |
+
*
|
118 |
+
* @since 4.0.2
|
119 |
+
* @access public
|
120 |
+
*/
|
121 |
+
public function admin_notice_missing_main_plugin() {
|
122 |
+
|
123 |
+
return sprintf(
|
124 |
+
wp_kses(
|
125 |
+
'<div class="notice notice-warning is-dismissible"><p><strong>"%1$s"</strong> requires <strong>"%2$s"</strong> to be installed and activated.</p></div>',
|
126 |
+
array(
|
127 |
+
'div' => array(
|
128 |
+
'class' => array(),
|
129 |
+
'p' => array(),
|
130 |
+
'strong' => array(),
|
131 |
+
),
|
132 |
+
)
|
133 |
+
),
|
134 |
+
'Responsive menu elementor widget',
|
135 |
+
'Elementor'
|
136 |
+
);
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Admin notice
|
141 |
+
*
|
142 |
+
* Warning when the site doesn't have a minimum required Elementor version.
|
143 |
+
*
|
144 |
+
* @since 4.0.2
|
145 |
+
* @access public
|
146 |
+
*/
|
147 |
+
public function admin_notice_minimum_elementor_version() {
|
148 |
+
|
149 |
+
return sprintf(
|
150 |
+
wp_kses(
|
151 |
+
'<div class="notice notice-warning is-dismissible"><p><strong>"%1$s"</strong> requires <strong>"%2$s"</strong> version %3$s or greater.</p></div>',
|
152 |
+
array(
|
153 |
+
'div' => array(
|
154 |
+
'class' => array(),
|
155 |
+
'p' => array(),
|
156 |
+
'strong' => array(),
|
157 |
+
),
|
158 |
+
)
|
159 |
+
),
|
160 |
+
'Responsive menu elementor widget',
|
161 |
+
'Elementor',
|
162 |
+
self::MINIMUM_ELEMENTOR_VERSION
|
163 |
+
);
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Admin notice
|
168 |
+
*
|
169 |
+
* Warning when the site doesn't have a minimum required PHP version.
|
170 |
+
*
|
171 |
+
* @since 4.0.2
|
172 |
+
* @access public
|
173 |
+
*/
|
174 |
+
public function admin_notice_minimum_php_version() {
|
175 |
+
|
176 |
+
return sprintf(
|
177 |
+
wp_kses(
|
178 |
+
'<div class="notice notice-warning is-dismissible"><p><strong>"%1$s"</strong> requires <strong>"%2$s"</strong> version %3$s or greater.</p></div>',
|
179 |
+
array(
|
180 |
+
'div' => array(
|
181 |
+
'class' => array(),
|
182 |
+
'p' => array(),
|
183 |
+
'strong' => array(),
|
184 |
+
),
|
185 |
+
)
|
186 |
+
),
|
187 |
+
'Responsive menu elementor widget',
|
188 |
+
'Elementor',
|
189 |
+
self::MINIMUM_ELEMENTOR_VERSION
|
190 |
+
);
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Include Widgets files
|
195 |
+
*
|
196 |
+
* Load widgets files
|
197 |
+
*
|
198 |
+
* @since 4.0.2
|
199 |
+
* @access private
|
200 |
+
*/
|
201 |
+
private function include_widgets_files() {
|
202 |
+
require_once 'widgets/class-rmp-widget.php';
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Register Widgets
|
207 |
+
*
|
208 |
+
* Register new Elementor widgets.
|
209 |
+
*
|
210 |
+
* @since 4.0.2
|
211 |
+
* @access public
|
212 |
+
*/
|
213 |
+
public function register_widgets() {
|
214 |
+
|
215 |
+
// It's now safe to include Widgets files.
|
216 |
+
$this->include_widgets_files();
|
217 |
+
|
218 |
+
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new RMP_Widget() );
|
219 |
+
}
|
220 |
+
}
|
v4.0.0/inc/classes/elementor/widgets/class-rmp-widget.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* RMP Widget class that hold the responsive menu elementor widget.
|
4 |
+
*
|
5 |
+
* @category Class
|
6 |
+
* @package responsive-menu-pro
|
7 |
+
* @author Expresstech System
|
8 |
+
* @since 4.0.2
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace RMP\Features\Inc\Elementor\Widgets;
|
12 |
+
|
13 |
+
use Elementor\Controls_Manager;
|
14 |
+
use Elementor\Widget_Base;
|
15 |
+
use RMP\Features\Inc\RMP_Menu;
|
16 |
+
|
17 |
+
// Exit if accessed directly.
|
18 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
19 |
+
exit;
|
20 |
+
}
|
21 |
+
|
22 |
+
class RMP_Widget extends Widget_Base {
|
23 |
+
/**
|
24 |
+
* Class constructor.
|
25 |
+
*
|
26 |
+
* @param array $data Widget data.
|
27 |
+
* @param array $args Widget arguments.
|
28 |
+
*/
|
29 |
+
public function __construct( $data = array(), $args = null ) {
|
30 |
+
parent::__construct( $data, $args );
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Function to return the widget name.
|
35 |
+
*
|
36 |
+
* @since 4.0.2
|
37 |
+
*
|
38 |
+
* @return string
|
39 |
+
*/
|
40 |
+
public function get_name() {
|
41 |
+
return 'RMP_Widget';
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Function to return the widget title.
|
46 |
+
*
|
47 |
+
* @since 4.0.2
|
48 |
+
*
|
49 |
+
* @return string
|
50 |
+
*/
|
51 |
+
public function get_title() {
|
52 |
+
return __( 'Responsive Menu', 'responsive-menu-pro' );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Function to return the widget icon.
|
57 |
+
*
|
58 |
+
* @since 4.0.2
|
59 |
+
*
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
public function get_icon() {
|
63 |
+
return 'eicon-menu-bar';
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Function to add the widget in the category list.
|
68 |
+
*
|
69 |
+
* @since 4.0.2
|
70 |
+
*
|
71 |
+
* @return array
|
72 |
+
*/
|
73 |
+
public function get_categories() {
|
74 |
+
return [ 'general'];
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Add keywords to search the widget in elementor.
|
79 |
+
*
|
80 |
+
* @since 4.0.2
|
81 |
+
*
|
82 |
+
* @return array
|
83 |
+
*/
|
84 |
+
public function get_keywords() {
|
85 |
+
return [ 'menu', 'nav', 'button', 'responsive' ];
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Function to registered the input controls.
|
90 |
+
*
|
91 |
+
* @since 4.0.2
|
92 |
+
*/
|
93 |
+
protected function _register_controls() {
|
94 |
+
|
95 |
+
$this->start_controls_section(
|
96 |
+
'section_layout',
|
97 |
+
[
|
98 |
+
'label' => __( 'Menu Setting', 'responsive-menu-pro' ),
|
99 |
+
]
|
100 |
+
);
|
101 |
+
|
102 |
+
$menus = rmp_get_all_menus();
|
103 |
+
|
104 |
+
if ( ! empty( $menus ) ) {
|
105 |
+
|
106 |
+
$menu_id = array_key_first( $menus );
|
107 |
+
$this->add_control(
|
108 |
+
'rmp_menu',
|
109 |
+
[
|
110 |
+
'label' => __( 'Responsive Menu', 'responsive-menu-pro' ),
|
111 |
+
'type' => Controls_Manager::SELECT,
|
112 |
+
'options' => $menus,
|
113 |
+
'default' => array_keys( $menus )[0],
|
114 |
+
'save_default' => true,
|
115 |
+
'separator' => 'after',
|
116 |
+
'description' => sprintf(
|
117 |
+
__( 'Go to the <a class="rmp-menu-edit-link" href="%s" target="_blank">Responsive menu customizer</a> to style your menu.', 'responsive-menu-pro' ),
|
118 |
+
admin_url( 'post.php?post=' . $menu_id . '&action=edit&editor=true' )
|
119 |
+
),
|
120 |
+
]
|
121 |
+
);
|
122 |
+
|
123 |
+
} else {
|
124 |
+
$this->add_control(
|
125 |
+
'rmp_menu',
|
126 |
+
[
|
127 |
+
'type' => Controls_Manager::RAW_HTML,
|
128 |
+
'raw' => '<strong>' . __( 'There are no menus in your site.', 'responsive-menu-pro' ) . '</strong><br>' . sprintf( __( 'Go to the <a href="%s" target="_blank">Menus screen</a> to create one.', 'responsive-menu-pro' ), admin_url( 'edit.php?post_type=rmp_menu' ) ),
|
129 |
+
'separator' => 'after',
|
130 |
+
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
|
131 |
+
]
|
132 |
+
);
|
133 |
+
}
|
134 |
+
|
135 |
+
$this->end_controls_section();
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Function to update the contents in preview and render the menu.
|
140 |
+
*
|
141 |
+
* @since 4.0.2
|
142 |
+
*/
|
143 |
+
protected function render() {
|
144 |
+
|
145 |
+
$available_menus = rmp_get_all_menus();
|
146 |
+
|
147 |
+
if ( ! $available_menus ) {
|
148 |
+
return;
|
149 |
+
}
|
150 |
+
|
151 |
+
$settings = $this->get_settings_for_display();
|
152 |
+
$menu_id = $settings['rmp_menu'];
|
153 |
+
|
154 |
+
$menu = new RMP_Menu( $menu_id );
|
155 |
+
echo $menu->mobile_menu();
|
156 |
+
}
|
157 |
+
}
|
v4.0.0/inc/helpers/autoloader.php
CHANGED
@@ -56,6 +56,7 @@ function autoloader( $resource = '' ) {
|
|
56 |
case 'taxonomies':
|
57 |
case 'blocks':
|
58 |
case 'meta-boxes':
|
|
|
59 |
case 'widgets':
|
60 |
case 'plugin-configs':
|
61 |
/**
|
56 |
case 'taxonomies':
|
57 |
case 'blocks':
|
58 |
case 'meta-boxes':
|
59 |
+
case 'elementor':
|
60 |
case 'widgets':
|
61 |
case 'plugin-configs':
|
62 |
/**
|