| @@ -1,188 +1,72 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -/* | |
| 4 | -Plugin Name: Responsive Menu | |
| 5 | -Plugin URI: https://expresstech.io | |
| 6 | -Description: Highly Customisable Responsive Menu Plugin for WordPress | |
| 7 | -Version: 4.1.7 | |
| 8 | -Author: ExpressTech | |
| 9 | -Text Domain: responsive-menu | |
| 10 | -Author URI: https://responsive.menu | |
| 11 | -License: GPL2 | |
| 12 | -Tags: responsive, menu, responsive menu, mega menu, max mega menu, max menu | |
| 13 | -*/ | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * Constant as plugin version. | |
| 17 | - */ | |
| 18 | -if ( ! defined( 'RMP_PLUGIN_VERSION' ) ) { | |
| 19 | - define( 'RMP_PLUGIN_VERSION', '4.1.7' ); | |
| 20 | -} | |
| 21 | - | |
| 22 | -define( 'RESPONSIVE_MENU_URL', plugin_dir_url( __FILE__ ) ); | |
| 23 | - | |
| 24 | -add_action( 'admin_init', 'check_responsive_menu_php_version' ); | |
| 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; | |
| 30 | -} | |
| 31 | - | |
| 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. | |
| 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>'; | |
| 39 | -} | |
| 40 | - | |
| 41 | -if ( version_compare( PHP_VERSION, '5.4', '<' ) ) { | |
| 42 | - return; | |
| 43 | -} | |
| 44 | - | |
| 45 | -// If this file called directly then abort. | |
| 46 | -if ( ! defined( 'WPINC' ) ) { | |
| 47 | - die; | |
| 48 | -} | |
| 49 | - | |
| 50 | -/** | |
| 51 | - * Constant as plugin file. | |
| 52 | - */ | |
| 53 | -if ( ! defined( 'RMP_PLUGIN_FILE' ) ) { | |
| 54 | - define( 'RMP_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . 'responsive-menu.php' ); | |
| 55 | -} | |
| 56 | - | |
| 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__ ) ) ) ); | |
| 62 | -} | |
| 63 | - | |
| 64 | -/** | |
| 65 | - * Constant as plugin path. | |
| 66 | - */ | |
| 67 | -if ( ! defined( 'RMP_PLUGIN_PATH' ) ) { | |
| 68 | - define( 'RMP_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); | |
| 69 | -} | |
| 70 | - | |
| 71 | -/** | |
| 72 | - * Constant as plugin URL. | |
| 73 | - */ | |
| 74 | -if ( ! defined( 'RMP_PLUGIN_URL' ) ) { | |
| 75 | - define( 'RMP_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) ); | |
| 76 | -} | |
| 77 | - | |
| 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 | -} | |
| 84 | - | |
| 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 | -} | |
| 91 | - | |
| 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 | -} | |
| 98 | - | |
| 99 | -if ( ! defined( 'RMP_PLUGIN_PATH_V4' ) ) { | |
| 100 | - define( 'RMP_PLUGIN_PATH_V4', RMP_PLUGIN_PATH . '/v4.0.0' ); | |
| 101 | -} | |
| 102 | - | |
| 103 | -if ( ! defined( 'RMP_PLUGIN_URL_V4' ) ) { | |
| 104 | - define( 'RMP_PLUGIN_URL_V4', RMP_PLUGIN_URL . '/v4.0.0' ); | |
| 105 | -} | |
| 106 | - | |
| 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'; | |
| 113 | - | |
| 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 | -} | |
| 122 | - | |
| 123 | -responsive_menu_features_plugin_loader(); | |
| 124 | - | |
| 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' ); | |
| 128 | - | |
| 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'; | |
| 136 | - | |
| 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 | - } | |
| 142 | - | |
| 143 | - flush_rewrite_rules(); | |
| 144 | -} | |
| 145 | - | |
| 146 | -/** | |
| 147 | - * Deactivation of plugin. | |
| 148 | - * | |
| 149 | - * @return void | |
| 150 | - */ | |
| 151 | -function responsive_menu_plugin_deactivation() { | |
| 152 | - flush_rewrite_rules(); | |
| 153 | -} | |
| 154 | - | |
| 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(); | |
| 164 | - | |
| 165 | - // Check class theme manager has this method or not. | |
| 166 | - if ( ! method_exists( $theme_manager, 'get_menu_active_themes' ) ) { | |
| 167 | - return; | |
| 168 | - } | |
| 169 | - | |
| 170 | - $active_themes = $theme_manager->get_menu_active_themes(); | |
| 171 | - if ( empty( $active_themes ) ) { | |
| 172 | - return; | |
| 173 | - } | |
| 174 | - | |
| 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 ); | |
| 178 | - | |
| 179 | - if ( file_exists( $theme_index ) ) { | |
| 180 | - require_once $theme_index; | |
| 181 | - } | |
| 182 | - } | |
| 183 | -} | |
| 184 | - | |
| 185 | -rm_includes_menu_theme_template(); | |
| 186 | - | |
| 187 | - | |
| 188 | -require 'review-banner-class.php'; | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* | |
| 4 | +Plugin Name: Responsive Menu | |
| 5 | +Plugin URI: https://responsive.menu | |
| 6 | +Description: Highly Customisable Responsive Menu Plugin for WordPress | |
| 7 | +Version: 3.0.9 | |
| 8 | +Author: Responsive Menu | |
| 9 | +Text Domain: responsive-menu | |
| 10 | +Author URI: https://responsive.menu | |
| 11 | +License: GPL2 | |
| 12 | +Tags: responsive, menu, responsive menu | |
| 13 | +*/ | |
| 14 | + | |
| 15 | +/* Check correct PHP version first */ | |
| 16 | +add_action('admin_init', 'check_responsive_menu_php_version'); | |
| 17 | +function check_responsive_menu_php_version() { | |
| 18 | + if(version_compare(PHP_VERSION, '5.4', '<')): | |
| 19 | + add_action('admin_notices', 'responsive_menu_deactivation_text'); | |
| 20 | + deactivate_plugins(plugin_basename(__FILE__)); | |
| 21 | + endif; | |
| 22 | +} | |
| 23 | + | |
| 24 | +function responsive_menu_deactivation_text() { | |
| 25 | + echo '<div class="error"><p>' . sprintf(__('Responsive Menu requires PHP 5.4 or higher to function and has therefore been automatically disabled. You are still on %s.%sPlease speak to your webhost about upgrading your PHP version. For more information please visit %s', 'responsive-menu'), PHP_VERSION, '<br /><br />', '<a target="_blank" href="https://responsive.menu/why-php-5-4/">this page</a>.') . '</p></div>'; | |
| 26 | +} | |
| 27 | + | |
| 28 | +if(version_compare(PHP_VERSION, '5.4', '<')) | |
| 29 | + return; | |
| 30 | + | |
| 31 | +/* Required includes for plugin to function */ | |
| 32 | +include dirname(__FILE__) . '/autoload.php'; | |
| 33 | +include dirname(__FILE__) . '/src/config/route_dependencies.php'; | |
| 34 | + | |
| 35 | +/* Internationalise the plugin */ | |
| 36 | +add_action('plugins_loaded', function() { | |
| 37 | + load_plugin_textdomain('responsive-menu', false, basename(dirname(__FILE__)) . '/translations/'); | |
| 38 | +}); | |
| 39 | + | |
| 40 | +/* Route the plugin */ | |
| 41 | +$wp_router = new ResponsiveMenu\Routing\WpRouting($container); | |
| 42 | +$wp_router->route(); | |
| 43 | + | |
| 44 | +/* | |
| 45 | +* Initial Migration and Version Check synchronisation */ | |
| 46 | +add_action('init', function() use($container) { | |
| 47 | + $migration = $container['migration']; | |
| 48 | + $migration->setup(); | |
| 49 | + $migration->synchronise(); | |
| 50 | +}); | |
| 51 | + | |
| 52 | +if(is_admin()): | |
| 53 | + | |
| 54 | + /* | |
| 55 | + Polylang Integration Section */ | |
| 56 | + add_action('plugins_loaded', function() use($container) { | |
| 57 | + if(function_exists('pll_register_string')): | |
| 58 | + $service = $container['option_service']; | |
| 59 | + $options = $service->all(); | |
| 60 | + | |
| 61 | + $menu_to_use = isset($options['menu_to_use']) ? $options['menu_to_use']->getValue() : ''; | |
| 62 | + $button_title = isset($options['button_title']) ? $options['button_title']->getValue() : ''; | |
| 63 | + $menu_title = isset($options['menu_title']) ? $options['menu_title']->getValue() : ''; | |
| 64 | + $menu_title_link = isset($options['menu_title_link']) ? $options['menu_title_link']->getValue() : ''; | |
| 65 | + | |
| 66 | + pll_register_string('Menu Slug', $menu_to_use, 'Responsive Menu'); | |
| 67 | + pll_register_string('Button Title', $button_title, 'Responsive Menu'); | |
| 68 | + pll_register_string('Menu Title', $menu_title, 'Responsive Menu'); | |
| 69 | + pll_register_string('Menu Title Link', $menu_title_link, 'Responsive Menu'); | |
| 70 | + endif; | |
| 71 | + }); | |
| 72 | +endif; | |