| @@ -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.2.0 | |
| 7 | +Version: 4.0.4 | |
| 8 | 8 | Author: ExpressTech |
| 9 | 9 | Text Domain: responsive-menu |
| 10 | 10 | Author URI: https://responsive.menu |
| 11 | 11 | License: GPL2 |
| @@ -15,174 +15,210 @@ | ||
| 15 | 15 | /** |
| 16 | 16 | * Constant as plugin version. |
| 17 | 17 | */ |
| 18 | 18 | if ( ! defined( 'RMP_PLUGIN_VERSION' ) ) { |
| 19 | - define( 'RMP_PLUGIN_VERSION', '4.2.0' ); | |
| 19 | + define( 'RMP_PLUGIN_VERSION', '4.0.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 | +add_action('admin_init', 'check_responsive_menu_php_version'); | |
| 25 | 25 | 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; | |
| 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; | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | 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. | |
| 33 | + echo '<div class="error"><p>' . sprintf( | |
| 34 | + 'Responsive Menu requires PHP 5.4 or higher to function and has therefore been automatically disabled. | |
| 35 | 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>'; | |
| 36 | + PHP_VERSION, | |
| 37 | + '<br /><br />' | |
| 38 | + ) . '</p></div>'; | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -if ( version_compare( PHP_VERSION, '5.4', '<' ) ) { | |
| 42 | - return; | |
| 43 | -} | |
| 41 | +if(version_compare(PHP_VERSION, '5.4', '<')) | |
| 42 | + return; | |
| 44 | 43 | |
| 45 | -// If this file called directly then abort. | |
| 46 | -if ( ! defined( 'WPINC' ) ) { | |
| 47 | - die; | |
| 48 | -} | |
| 44 | +if ( empty( get_option( 'is_rmp_new_version') ) && ! empty( get_option('responsive_menu_version') ) ) { | |
| 49 | 45 | |
| 50 | 46 | /** |
| 51 | - * Constant as plugin file. | |
| 47 | + * Add admin notice to upgrade the plugin license. | |
| 52 | 48 | */ |
| 53 | -if ( ! defined( 'RMP_PLUGIN_FILE' ) ) { | |
| 54 | - define( 'RMP_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . 'responsive-menu.php' ); | |
| 49 | +add_action( 'admin_notices', 'rmp_move_new_version_admin_notice' ); | |
| 50 | +function rmp_move_new_version_admin_notice() { | |
| 51 | + | |
| 52 | + if ( ! empty( get_option( 'rm_upgrade_admin_notice' ) ) ) { | |
| 53 | + return; | |
| 54 | + } | |
| 55 | + | |
| 56 | + if ( empty( $_GET['page'] ) || 'responsive-menu' !== $_GET['page'] ) { | |
| 57 | + return; | |
| 58 | + } | |
| 59 | +?> | |
| 60 | + | |
| 61 | + <div class="notice-responsive-menu notice error is-dismissible rmp-version-upgrade-notice"> | |
| 62 | + <div class="notice-responsive-menu-logo"> | |
| 63 | + <img src="<?php echo RESPONSIVE_MENU_URL;?>/imgs/responsive-menu-logo.png" width="60" height="60" alt="logo" /> | |
| 64 | + </div> | |
| 65 | + <div class="notice-responsive-menu-message"> | |
| 66 | + <h4 style="font-weight: 700;"><?php _e('Responsive Menu', 'responsive-menu-pro'); ?></h4> | |
| 67 | + <p><?php _e( 'Try out our new version with improved layout, live preview and many more.', 'responsive-menu-pro' ); ?></p> | |
| 68 | + </div> | |
| 69 | + <div class="notice-responsive-menu-action"> | |
| 70 | + <a href="javascript:void(0)" class="rmp-upgrade-version" > <?php _e('Try, New version', 'responsive-menu-pro'); ?> </a> | |
| 71 | + </div> | |
| 72 | + </div> | |
| 73 | +<?php | |
| 55 | 74 | } |
| 56 | 75 | |
| 57 | -/** | |
| 58 | - * Constant as dir of plugin. | |
| 59 | - */ | |
| 60 | -if ( ! defined( 'RMP_PLUGIN_DIR_NAME' ) ) { | |
| 61 | - define( 'RMP_PLUGIN_DIR_NAME', untrailingslashit( dirname( plugin_basename( __FILE__ ) ) ) ); | |
| 76 | +add_action( 'admin_notices', 'og_pro_deactivate_pro_version_notice'); | |
| 77 | + | |
| 78 | +function og_pro_deactivate_pro_version_notice() { | |
| 79 | + if(get_transient('og-admin-notice-activation-pro')) { | |
| 80 | + ?> | |
| 81 | + <div class="notice notice-error is-dismissible"> | |
| 82 | + <p>Responsive Menu Pro has been deactivated<p/> | |
| 83 | + | |
| 84 | + </div> | |
| 85 | + <?php | |
| 86 | + delete_transient('og-admin-notice-activation-pro'); | |
| 87 | + } | |
| 62 | 88 | } |
| 63 | 89 | |
| 64 | -/** | |
| 65 | - * Constant as plugin path. | |
| 66 | - */ | |
| 67 | -if ( ! defined( 'RMP_PLUGIN_PATH' ) ) { | |
| 68 | - define( 'RMP_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); | |
| 90 | +function og_deactivate_responsive_menu_pro() { | |
| 91 | + | |
| 92 | + $plugin = 'responsive-menu-pro/responsive-menu-pro.php'; | |
| 93 | + | |
| 94 | + if( is_plugin_active($plugin) ){ | |
| 95 | + deactivate_plugins( 'responsive-menu-pro/responsive-menu-pro.php'); | |
| 96 | + set_transient( 'og-admin-notice-activation-pro', true, 5 ); | |
| 97 | + | |
| 98 | + return; | |
| 99 | + } | |
| 69 | 100 | } |
| 101 | +//to check weather another plugin is acivated or not. | |
| 102 | +register_activation_hook( __FILE__, 'og_deactivate_responsive_menu_pro'); | |
| 70 | 103 | |
| 71 | -/** | |
| 72 | - * Constant as plugin URL. | |
| 73 | - */ | |
| 74 | -if ( ! defined( 'RMP_PLUGIN_URL' ) ) { | |
| 75 | - define( 'RMP_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) ); | |
| 76 | -} | |
| 104 | +include dirname(__FILE__) . '/vendor/autoload.php'; | |
| 105 | +include dirname(__FILE__) . '/config/default_options.php'; | |
| 106 | +include dirname(__FILE__) . '/config/services.php'; | |
| 107 | +include dirname(__FILE__) . '/config/wp/scripts.php'; | |
| 108 | +include dirname(__FILE__) . '/config/routing.php'; | |
| 109 | +include dirname(__FILE__) . '/migration.php'; | |
| 110 | +include dirname(__FILE__) . '/config/polylang.php'; | |
| 77 | 111 | |
| 78 | -/** | |
| 79 | - * Constant as URI of assets build. | |
| 80 | - */ | |
| 81 | -if ( ! defined( 'RMP_PLUGIN_BUILD_URI' ) ) { | |
| 82 | - define( 'RMP_PLUGIN_BUILD_URI', untrailingslashit( plugin_dir_url( __FILE__ ) ) . '/assets/build' ); | |
| 83 | -} | |
| 112 | +} else { | |
| 84 | 113 | |
| 85 | -/** | |
| 86 | - * Constant as dir of assets build. | |
| 87 | - */ | |
| 88 | -if ( ! defined( 'RMP_PLUGIN_BUILD_DIR' ) ) { | |
| 89 | - define( 'RMP_PLUGIN_BUILD_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/assets/build' ); | |
| 90 | -} | |
| 114 | + // If this file called directly then abort. | |
| 115 | + if ( ! defined( 'WPINC' ) ) { | |
| 116 | + die; | |
| 117 | + } | |
| 91 | 118 | |
| 92 | -/** | |
| 93 | - * Constant as path of template file. | |
| 94 | - */ | |
| 95 | -if ( ! defined( 'RMP_PLUGIN_TEMPLATE_PATH' ) ) { | |
| 96 | - define( 'RMP_PLUGIN_TEMPLATE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' ); | |
| 97 | -} | |
| 119 | + /** | |
| 120 | + * Constant as plugin file. | |
| 121 | + */ | |
| 122 | + if ( ! defined( 'RMP_PLUGIN_FILE' ) ) { | |
| 123 | + define('RMP_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . 'responsive-menu.php'); | |
| 124 | + } | |
| 98 | 125 | |
| 99 | -if ( ! defined( 'RMP_PLUGIN_PATH_V4' ) ) { | |
| 100 | - define( 'RMP_PLUGIN_PATH_V4', RMP_PLUGIN_PATH . '/v4.0.0' ); | |
| 101 | -} | |
| 126 | + /** | |
| 127 | + * Constant as dir of plugin. | |
| 128 | + */ | |
| 129 | + if ( ! defined( 'RMP_PLUGIN_DIR_NAME' ) ) { | |
| 130 | + define( 'RMP_PLUGIN_DIR_NAME', untrailingslashit ( dirname( plugin_basename( __FILE__ ) ) ) ); | |
| 131 | + } | |
| 102 | 132 | |
| 103 | -if ( ! defined( 'RMP_PLUGIN_URL_V4' ) ) { | |
| 104 | - define( 'RMP_PLUGIN_URL_V4', RMP_PLUGIN_URL . '/v4.0.0' ); | |
| 105 | -} | |
| 133 | + /** | |
| 134 | + * Constant as plugin path. | |
| 135 | + */ | |
| 136 | + if ( ! defined( 'RMP_PLUGIN_PATH' ) ) { | |
| 137 | + define( 'RMP_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); | |
| 138 | + } | |
| 106 | 139 | |
| 107 | -/** Include the required files only*/ | |
| 108 | -require_once RMP_PLUGIN_PATH_V4 . '/inc/helpers/autoloader.php'; | |
| 109 | -require_once RMP_PLUGIN_PATH_V4 . '/inc/helpers/custom-functions.php'; | |
| 110 | -require_once RMP_PLUGIN_PATH_V4 . '/inc/helpers/default-options.php'; | |
| 111 | -require_once RMP_PLUGIN_PATH_V4 . '/libs/scssphp/vendor/autoload.php'; | |
| 112 | -require_once RMP_PLUGIN_PATH_V4 . '/templates/rmp-roadmap.php'; | |
| 140 | + /** | |
| 141 | + * Constant as plugin URL. | |
| 142 | + */ | |
| 143 | + if ( ! defined( 'RMP_PLUGIN_URL' ) ) { | |
| 144 | + define( 'RMP_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) ); | |
| 145 | + } | |
| 113 | 146 | |
| 114 | -/** | |
| 115 | - * To load plugin manifest class. | |
| 116 | - * | |
| 117 | - * @return void | |
| 118 | - */ | |
| 119 | -function responsive_menu_features_plugin_loader() { | |
| 120 | - \RMP\Features\Inc\Plugin::get_instance(); | |
| 121 | -} | |
| 147 | + /** | |
| 148 | + * Constant as URI of assets build. | |
| 149 | + */ | |
| 150 | + if ( ! defined( 'RMP_PLUGIN_BUILD_URI' ) ) { | |
| 151 | + define( 'RMP_PLUGIN_BUILD_URI', untrailingslashit( plugin_dir_url( __FILE__ ) ) . '/assets/build' ); | |
| 152 | + } | |
| 122 | 153 | |
| 123 | -responsive_menu_features_plugin_loader(); | |
| 154 | + /** | |
| 155 | + * Constant as dir of assets build. | |
| 156 | + */ | |
| 157 | + if ( ! defined( 'RMP_PLUGIN_BUILD_DIR' ) ) { | |
| 158 | + define( 'RMP_PLUGIN_BUILD_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/assets/build' ); | |
| 159 | + } | |
| 124 | 160 | |
| 125 | -// Active and de-active plugin hook. | |
| 126 | -register_activation_hook( __FILE__, 'responsive_menu_plugin_activation' ); | |
| 127 | -register_deactivation_hook( __FILE__, 'responsive_menu_plugin_deactivation' ); | |
| 161 | + /** | |
| 162 | + * Constant as path of template file. | |
| 163 | + */ | |
| 164 | + if ( ! defined( 'RMP_PLUGIN_TEMPLATE_PATH' ) ) { | |
| 165 | + define( 'RMP_PLUGIN_TEMPLATE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/' ); | |
| 166 | + } | |
| 128 | 167 | |
| 129 | -/** | |
| 130 | - * Activation of plugin. | |
| 131 | - * | |
| 132 | - * @return void | |
| 133 | - */ | |
| 134 | -function responsive_menu_plugin_activation() { | |
| 135 | - $plugin = 'responsive-menu-pro/responsive-menu-pro.php'; | |
| 168 | + if ( ! defined( 'RMP_PLUGIN_PATH_V4' ) ) { | |
| 169 | + define ( 'RMP_PLUGIN_PATH_V4', RMP_PLUGIN_PATH . '/v4.0.0' ); | |
| 170 | + } | |
| 136 | 171 | |
| 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 | - } | |
| 172 | + if ( ! defined( 'RMP_PLUGIN_URL_V4' ) ) { | |
| 173 | + define ( 'RMP_PLUGIN_URL_V4', RMP_PLUGIN_URL . '/v4.0.0' ); | |
| 174 | + } | |
| 142 | 175 | |
| 143 | - flush_rewrite_rules(); | |
| 144 | -} | |
| 176 | + /** Include the required files only*/ | |
| 177 | + require_once RMP_PLUGIN_PATH_V4 . '/inc/helpers/autoloader.php'; | |
| 178 | + require_once RMP_PLUGIN_PATH_V4 . '/inc/helpers/custom-functions.php'; | |
| 179 | + require_once RMP_PLUGIN_PATH_V4 . '/inc/helpers/default-options.php'; | |
| 180 | + require_once RMP_PLUGIN_PATH_V4 . '/libs/scssphp/vendor/autoload.php'; | |
| 145 | 181 | |
| 146 | -/** | |
| 147 | - * Deactivation of plugin. | |
| 148 | - * | |
| 149 | - * @return void | |
| 150 | - */ | |
| 151 | -function responsive_menu_plugin_deactivation() { | |
| 152 | - flush_rewrite_rules(); | |
| 153 | -} | |
| 182 | + /** | |
| 183 | + * To load plugin manifest class. | |
| 184 | + * | |
| 185 | + * @return void | |
| 186 | + */ | |
| 187 | + function responsive_menu_features_plugin_loader() { | |
| 188 | + \RMP\Features\Inc\Plugin::get_instance(); | |
| 189 | + } | |
| 154 | 190 | |
| 155 | -/** | |
| 156 | - * Function to include the menu themes templates. | |
| 157 | - * | |
| 158 | - * @since 4.0.5 | |
| 159 | - * | |
| 160 | - * @return void | |
| 161 | - */ | |
| 162 | -function rm_includes_menu_theme_template() { | |
| 163 | - $theme_manager = \RMP\Features\Inc\Theme_Manager::get_instance(); | |
| 191 | + responsive_menu_features_plugin_loader(); | |
| 164 | 192 | |
| 165 | - // Check class theme manager has this method or not. | |
| 166 | - if ( ! method_exists( $theme_manager, 'get_menu_active_themes' ) ) { | |
| 167 | - return; | |
| 168 | - } | |
| 193 | + // Active and de-active plugin hook. | |
| 194 | + register_activation_hook( __FILE__, 'responsive_menu_plugin_activation' ); | |
| 195 | + register_deactivation_hook( __FILE__, 'responsive_menu_plugin_deactivation' ); | |
| 169 | 196 | |
| 170 | - $active_themes = $theme_manager->get_menu_active_themes(); | |
| 171 | - if ( empty( $active_themes ) ) { | |
| 172 | - return; | |
| 173 | - } | |
| 197 | + /** | |
| 198 | + * Activation of plugin. | |
| 199 | + * | |
| 200 | + * @return void | |
| 201 | + */ | |
| 202 | + function responsive_menu_plugin_activation() { | |
| 174 | 203 | |
| 175 | - // Include the file from each theme which has php template. | |
| 176 | - foreach ( $active_themes as $key => $theme_name ) { | |
| 177 | - $theme_index = $theme_manager->get_theme_index_file( $theme_name ); | |
| 204 | + $plugin = 'responsive-menu-pro/responsive-menu-pro.php'; | |
| 178 | 205 | |
| 179 | - if ( file_exists( $theme_index ) ) { | |
| 180 | - require_once $theme_index; | |
| 206 | + // Check if responsive menu (paid version) is activate then deactivate it. | |
| 207 | + if( is_plugin_active( $plugin ) ) { | |
| 208 | + deactivate_plugins( $plugin ); | |
| 209 | + set_transient( 'og-admin-notice-activation-pro', true, 5 ); | |
| 181 | 210 | } |
| 211 | + | |
| 212 | + flush_rewrite_rules(); | |
| 182 | 213 | } |
| 183 | -} | |
| 184 | 214 | |
| 185 | -rm_includes_menu_theme_template(); | |
| 215 | + /** | |
| 216 | + * Deactivation of plugin. | |
| 217 | + * | |
| 218 | + * @return void | |
| 219 | + */ | |
| 220 | + function responsive_menu_plugin_deactivation() { | |
| 221 | + flush_rewrite_rules(); | |
| 222 | + } | |
| 186 | 223 | |
| 187 | - | |
| 188 | -require 'review-banner-class.php'; | |
| 224 | +} | |