| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | /* |
| 4 | 4 | Plugin Name: Responsive Menu |
| 5 | 5 | Plugin URI: https://expresstech.io |
| 6 | 6 | Description: Highly Customisable Responsive Menu Plugin for WordPress |
| 7 | -Version: 4.0.0 | |
| 7 | +Version: 4.7.4 | |
| 8 | 8 | Author: ExpressTech |
| 9 | 9 | Text Domain: responsive-menu |
| 10 | 10 | Author URI: https://responsive.menu |
| 11 | 11 | License: GPL2 |
| @@ -15,178 +15,186 @@ | ||
| 15 | 15 | /** |
| 16 | 16 | * Constant as plugin version. |
| 17 | 17 | */ |
| 18 | 18 | if ( ! defined( 'RMP_PLUGIN_VERSION' ) ) { |
| 19 | - define( 'RMP_PLUGIN_VERSION', '4.0.0' ); | |
| 19 | + define( 'RMP_PLUGIN_VERSION', '4.7.4' ); | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -add_action('admin_init', 'check_responsive_menu_php_version'); | |
| 22 | +define( 'RESPONSIVE_MENU_URL', plugin_dir_url( __FILE__ ) ); | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * Minimum PHP version. The bundled scssphp library uses nullable type | |
| 26 | + * declarations (`?Type $arg = null`), which are a parse error before PHP 7.1. | |
| 27 | + * Keep this in sync with `Requires PHP` in readme.txt. | |
| 28 | + */ | |
| 29 | +if ( ! defined( 'RMP_MINIMUM_PHP_VERSION' ) ) { | |
| 30 | + define( 'RMP_MINIMUM_PHP_VERSION', '7.1' ); | |
| 31 | +} | |
| 32 | + | |
| 33 | +add_action( 'admin_init', 'check_responsive_menu_php_version' ); | |
| 23 | 34 | function check_responsive_menu_php_version() { |
| 24 | - if(version_compare(PHP_VERSION, '5.4', '<')): | |
| 25 | - add_action('admin_notices', 'responsive_menu_deactivation_text'); | |
| 26 | - deactivate_plugins(plugin_basename(__FILE__)); | |
| 27 | - endif; | |
| 35 | + if ( version_compare( PHP_VERSION, RMP_MINIMUM_PHP_VERSION, '<' ) ) : | |
| 36 | + add_action( 'admin_notices', 'responsive_menu_deactivation_text' ); | |
| 37 | + deactivate_plugins( plugin_basename( __FILE__ ) ); | |
| 38 | + endif; | |
| 28 | 39 | } |
| 29 | 40 | |
| 30 | 41 | function responsive_menu_deactivation_text() { |
| 31 | - echo '<div class="error"><p>' . sprintf( | |
| 32 | - 'Responsive Menu requires PHP 5.4 or higher to function and has therefore been automatically disabled. | |
| 33 | - You are still on %s.%sPlease speak to your web host about upgrading your PHP version.', | |
| 34 | - PHP_VERSION, | |
| 35 | - '<br /><br />' | |
| 36 | - ) . '</p></div>'; | |
| 42 | + echo '<div class="' . esc_attr( 'error' ) . '"><p>' . sprintf( | |
| 43 | + 'Responsive Menu requires PHP %1$s or higher to function and has therefore been automatically disabled. | |
| 44 | + You are still on %2$s.%3$sPlease speak to your web host about upgrading your PHP version.', | |
| 45 | + esc_html( RMP_MINIMUM_PHP_VERSION ), | |
| 46 | + PHP_VERSION, | |
| 47 | + '<br /><br />' | |
| 48 | + ) . '</p></div>'; | |
| 37 | 49 | } |
| 38 | 50 | |
| 39 | -if(version_compare(PHP_VERSION, '5.4', '<')) | |
| 40 | - return; | |
| 51 | +if ( version_compare( PHP_VERSION, RMP_MINIMUM_PHP_VERSION, '<' ) ) { | |
| 52 | + return; | |
| 53 | +} | |
| 41 | 54 | |
| 42 | -if ( empty( get_option( 'is_rmp_new_version') ) && ! empty( get_option('responsive_menu_version') ) ) { | |
| 55 | +// If this file called directly then abort. | |
| 56 | +if ( ! defined( 'WPINC' ) ) { | |
| 57 | + die; | |
| 58 | +} | |
| 43 | 59 | |
| 44 | -add_action( 'admin_notices', 'og_pro_deactivate_pro_version_notice'); | |
| 60 | +/** | |
| 61 | + * Constant as plugin file. | |
| 62 | + */ | |
| 63 | +if ( ! defined( 'RMP_PLUGIN_FILE' ) ) { | |
| 64 | + define( 'RMP_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . 'responsive-menu.php' ); | |
| 65 | +} | |
| 45 | 66 | |
| 46 | -function og_pro_deactivate_pro_version_notice() { | |
| 47 | - if(get_transient('og-admin-notice-activation-pro')) { | |
| 48 | - ?> | |
| 49 | - <div class="notice notice-error is-dismissible"> | |
| 50 | - <p>Responsive Menu Pro has been deactivated<p/> | |
| 67 | +/** | |
| 68 | + * Constant as dir of plugin. | |
| 69 | + */ | |
| 70 | +if ( ! defined( 'RMP_PLUGIN_DIR_NAME' ) ) { | |
| 71 | + define( 'RMP_PLUGIN_DIR_NAME', untrailingslashit( dirname( plugin_basename( __FILE__ ) ) ) ); | |
| 72 | +} | |
| 51 | 73 | |
| 52 | - </div> | |
| 53 | - <?php | |
| 54 | - delete_transient('og-admin-notice-activation-pro'); | |
| 55 | - } | |
| 74 | +/** | |
| 75 | + * Constant as plugin path. | |
| 76 | + */ | |
| 77 | +if ( ! defined( 'RMP_PLUGIN_PATH' ) ) { | |
| 78 | + define( 'RMP_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); | |
| 56 | 79 | } |
| 57 | 80 | |
| 58 | -function og_deactivate_responsive_menu_pro() { | |
| 81 | +/** | |
| 82 | + * Constant as plugin URL. | |
| 83 | + */ | |
| 84 | +if ( ! defined( 'RMP_PLUGIN_URL' ) ) { | |
| 85 | + define( 'RMP_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) ); | |
| 86 | +} | |
| 59 | 87 | |
| 60 | - $plugin = 'responsive-menu-pro/responsive-menu-pro.php'; | |
| 61 | - | |
| 62 | - if( is_plugin_active($plugin) ){ | |
| 63 | - deactivate_plugins( 'responsive-menu-pro/responsive-menu-pro.php'); | |
| 64 | - set_transient( 'og-admin-notice-activation-pro', true, 5 ); | |
| 65 | - | |
| 66 | - return; | |
| 67 | - } | |
| 88 | +/** | |
| 89 | + * Constant as URI of assets build. | |
| 90 | + */ | |
| 91 | +if ( ! defined( 'RMP_PLUGIN_BUILD_URI' ) ) { | |
| 92 | + define( 'RMP_PLUGIN_BUILD_URI', untrailingslashit( plugin_dir_url( __FILE__ ) ) . '/assets/build' ); | |
| 68 | 93 | } |
| 69 | -//to check weather another plugin is acivated or not. | |
| 70 | -register_activation_hook( __FILE__, 'og_deactivate_responsive_menu_pro'); | |
| 71 | 94 | |
| 72 | -include dirname(__FILE__) . '/vendor/autoload.php'; | |
| 73 | -include dirname(__FILE__) . '/config/default_options.php'; | |
| 74 | -include dirname(__FILE__) . '/config/services.php'; | |
| 75 | -include dirname(__FILE__) . '/config/wp/scripts.php'; | |
| 76 | -include dirname(__FILE__) . '/config/routing.php'; | |
| 77 | -include dirname(__FILE__) . '/migration.php'; | |
| 78 | -include dirname(__FILE__) . '/config/polylang.php'; | |
| 95 | +/** | |
| 96 | + * Constant as dir of assets build. | |
| 97 | + */ | |
| 98 | +if ( ! defined( 'RMP_PLUGIN_BUILD_DIR' ) ) { | |
| 99 | + define( 'RMP_PLUGIN_BUILD_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/assets/build' ); | |
| 100 | +} | |
| 79 | 101 | |
| 80 | -} else { | |
| 102 | +/** | |
| 103 | + * Constant as path of template file. | |
| 104 | + */ | |
| 105 | +if ( ! defined( 'RMP_PLUGIN_TEMPLATE_PATH' ) ) { | |
| 106 | + define( 'RMP_PLUGIN_TEMPLATE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' ); | |
| 107 | +} | |
| 81 | 108 | |
| 82 | - // If this file called directly then abort. | |
| 83 | - if ( ! defined( 'WPINC' ) ) { | |
| 84 | - die; | |
| 85 | - } | |
| 109 | +if ( ! defined( 'RMP_PLUGIN_PATH_V4' ) ) { | |
| 110 | + define( 'RMP_PLUGIN_PATH_V4', RMP_PLUGIN_PATH . '/v4.0.0' ); | |
| 111 | +} | |
| 86 | 112 | |
| 87 | - /** | |
| 88 | - * Constant as plugin file. | |
| 89 | - */ | |
| 90 | - if ( ! defined( 'RMP_PLUGIN_FILE' ) ) { | |
| 91 | - define('RMP_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . 'responsive-menu.php'); | |
| 92 | - } | |
| 113 | +if ( ! defined( 'RMP_PLUGIN_URL_V4' ) ) { | |
| 114 | + define( 'RMP_PLUGIN_URL_V4', RMP_PLUGIN_URL . '/v4.0.0' ); | |
| 115 | +} | |
| 93 | 116 | |
| 94 | - /** | |
| 95 | - * Constant as dir of plugin. | |
| 96 | - */ | |
| 97 | - if ( ! defined( 'RMP_PLUGIN_DIR_NAME' ) ) { | |
| 98 | - define( 'RMP_PLUGIN_DIR_NAME', untrailingslashit ( dirname( plugin_basename( __FILE__ ) ) ) ); | |
| 99 | - } | |
| 117 | +/** Include the required files only*/ | |
| 118 | +require_once RMP_PLUGIN_PATH_V4 . '/inc/helpers/autoloader.php'; | |
| 119 | +require_once RMP_PLUGIN_PATH_V4 . '/inc/helpers/custom-functions.php'; | |
| 120 | +require_once RMP_PLUGIN_PATH_V4 . '/inc/helpers/default-options.php'; | |
| 121 | +require_once RMP_PLUGIN_PATH_V4 . '/libs/scssphp/vendor/autoload.php'; | |
| 122 | +require_once RMP_PLUGIN_PATH_V4 . '/templates/rmp-roadmap.php'; | |
| 100 | 123 | |
| 101 | - /** | |
| 102 | - * Constant as plugin path. | |
| 103 | - */ | |
| 104 | - if ( ! defined( 'RMP_PLUGIN_PATH' ) ) { | |
| 105 | - define( 'RMP_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); | |
| 106 | - } | |
| 124 | +/** | |
| 125 | + * To load plugin manifest class. | |
| 126 | + * | |
| 127 | + * @return void | |
| 128 | + */ | |
| 129 | +function responsive_menu_features_plugin_loader() { | |
| 130 | + \RMP\Features\Inc\Plugin::get_instance(); | |
| 131 | +} | |
| 107 | 132 | |
| 108 | - /** | |
| 109 | - * Constant as plugin URL. | |
| 110 | - */ | |
| 111 | - if ( ! defined( 'RMP_PLUGIN_URL' ) ) { | |
| 112 | - define( 'RMP_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) ); | |
| 113 | - } | |
| 133 | +responsive_menu_features_plugin_loader(); | |
| 114 | 134 | |
| 115 | - /** | |
| 116 | - * Constant as URI of assets build. | |
| 117 | - */ | |
| 118 | - if ( ! defined( 'RMP_PLUGIN_BUILD_URI' ) ) { | |
| 119 | - define( 'RMP_PLUGIN_BUILD_URI', untrailingslashit( plugin_dir_url( __FILE__ ) ) . '/assets/build' ); | |
| 120 | - } | |
| 135 | +// Active and de-active plugin hook. | |
| 136 | +register_activation_hook( __FILE__, 'responsive_menu_plugin_activation' ); | |
| 137 | +register_deactivation_hook( __FILE__, 'responsive_menu_plugin_deactivation' ); | |
| 121 | 138 | |
| 122 | - /** | |
| 123 | - * Constant as dir of assets build. | |
| 124 | - */ | |
| 125 | - if ( ! defined( 'RMP_PLUGIN_BUILD_DIR' ) ) { | |
| 126 | - define( 'RMP_PLUGIN_BUILD_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/assets/build' ); | |
| 127 | - } | |
| 139 | +/** | |
| 140 | + * Activation of plugin. | |
| 141 | + * | |
| 142 | + * @return void | |
| 143 | + */ | |
| 144 | +function responsive_menu_plugin_activation() { | |
| 145 | + $plugin = 'responsive-menu-pro/responsive-menu-pro.php'; | |
| 128 | 146 | |
| 129 | - /** | |
| 130 | - * Constant as path of template file. | |
| 131 | - */ | |
| 132 | - if ( ! defined( 'RMP_PLUGIN_TEMPLATE_PATH' ) ) { | |
| 133 | - define( 'RMP_PLUGIN_TEMPLATE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' ); | |
| 134 | - } | |
| 147 | + // Check if responsive menu (paid version) is activate then deactivate it. | |
| 148 | + if ( is_plugin_active( $plugin ) ) { | |
| 149 | + deactivate_plugins( $plugin ); | |
| 150 | + set_transient( 'og-admin-notice-activation-pro', true, 5 ); | |
| 151 | + } | |
| 135 | 152 | |
| 136 | - if ( ! defined( 'RMP_PLUGIN_PATH_V4' ) ) { | |
| 137 | - define ( 'RMP_PLUGIN_PATH_V4', RMP_PLUGIN_PATH . '/v4.0.0' ); | |
| 138 | - } | |
| 153 | + // Keep the plugin's uploads directory from serving anything executable. | |
| 154 | + \RMP\Features\Inc\Theme_Manager::get_instance()->protect_upload_dir(); | |
| 139 | 155 | |
| 140 | - if ( ! defined( 'RMP_PLUGIN_URL_V4' ) ) { | |
| 141 | - define ( 'RMP_PLUGIN_URL_V4', RMP_PLUGIN_URL . '/v4.0.0' ); | |
| 142 | - } | |
| 156 | + flush_rewrite_rules(); | |
| 157 | +} | |
| 143 | 158 | |
| 144 | - /** Include the required files only*/ | |
| 145 | - require_once RMP_PLUGIN_PATH_V4 . '/inc/helpers/autoloader.php'; | |
| 146 | - require_once RMP_PLUGIN_PATH_V4 . '/inc/helpers/custom-functions.php'; | |
| 147 | - require_once RMP_PLUGIN_PATH_V4 . '/inc/helpers/default-options.php'; | |
| 148 | - require_once RMP_PLUGIN_PATH_V4 . '/libs/scssphp/vendor/autoload.php'; | |
| 159 | +/** | |
| 160 | + * Deactivation of plugin. | |
| 161 | + * | |
| 162 | + * @return void | |
| 163 | + */ | |
| 164 | +function responsive_menu_plugin_deactivation() { | |
| 165 | + flush_rewrite_rules(); | |
| 166 | +} | |
| 149 | 167 | |
| 150 | - /** | |
| 151 | - * To load plugin manifest class. | |
| 152 | - * | |
| 153 | - * @return void | |
| 154 | - */ | |
| 155 | - function responsive_menu_features_plugin_loader() { | |
| 156 | - \RMP\Features\Inc\Plugin::get_instance(); | |
| 157 | - } | |
| 168 | +/** | |
| 169 | + * Function to include the menu themes templates. | |
| 170 | + * | |
| 171 | + * @since 4.0.5 | |
| 172 | + * | |
| 173 | + * @return void | |
| 174 | + */ | |
| 175 | +function rm_includes_menu_theme_template() { | |
| 176 | + $theme_manager = \RMP\Features\Inc\Theme_Manager::get_instance(); | |
| 158 | 177 | |
| 159 | - responsive_menu_features_plugin_loader(); | |
| 178 | + // Check class theme manager has this method or not. | |
| 179 | + if ( ! method_exists( $theme_manager, 'get_menu_active_themes' ) ) { | |
| 180 | + return; | |
| 181 | + } | |
| 160 | 182 | |
| 161 | - // Active and de-active plugin hook. | |
| 162 | - register_activation_hook( __FILE__, 'responsive_menu_plugin_activation' ); | |
| 163 | - register_deactivation_hook( __FILE__, 'responsive_menu_plugin_deactivation' ); | |
| 183 | + $active_themes = $theme_manager->get_menu_active_themes(); | |
| 184 | + if ( empty( $active_themes ) ) { | |
| 185 | + return; | |
| 186 | + } | |
| 164 | 187 | |
| 165 | - /** | |
| 166 | - * Activation of plugin. | |
| 167 | - * | |
| 168 | - * @return void | |
| 169 | - */ | |
| 170 | - function responsive_menu_plugin_activation() { | |
| 188 | + // Include the file from each theme which has php template. | |
| 189 | + foreach ( $active_themes as $key => $theme_name ) { | |
| 190 | + $theme_index = $theme_manager->get_theme_index_file( $theme_name ); | |
| 171 | 191 | |
| 172 | - $plugin = 'responsive-menu-pro/responsive-menu-pro.php'; | |
| 173 | - | |
| 174 | - // Check if responsive menu (paid version) is activate then deactivate it. | |
| 175 | - if( is_plugin_active( $plugin ) ) { | |
| 176 | - deactivate_plugins( $plugin ); | |
| 177 | - set_transient( 'og-admin-notice-activation-pro', true, 5 ); | |
| 192 | + if ( file_exists( $theme_index ) ) { | |
| 193 | + require_once $theme_index; | |
| 178 | 194 | } |
| 179 | - | |
| 180 | - flush_rewrite_rules(); | |
| 181 | 195 | } |
| 196 | +} | |
| 182 | 197 | |
| 183 | - /** | |
| 184 | - * Deactivation of plugin. | |
| 185 | - * | |
| 186 | - * @return void | |
| 187 | - */ | |
| 188 | - function responsive_menu_plugin_deactivation() { | |
| 189 | - flush_rewrite_rules(); | |
| 190 | - } | |
| 198 | +rm_includes_menu_theme_template(); | |
| 191 | 199 | |
| 192 | -} | |
| 200 | +require_once 'review-banner-class.php'; | |