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