| 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.6 |
| 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 |
if(is_admin()): |
| 45 |
/* |
| 46 |
* Initial Migration and Version Check synchronisation */ |
| 47 |
add_action('admin_init', function() use($container) { |
| 48 |
$migration = $container['migration']; |
| 49 |
$migration->setup(); |
| 50 |
$migration->synchronise(); |
| 51 |
}); |
| 52 |
|
| 53 |
/* |
| 54 |
Polylang Integration Section */ |
| 55 |
add_action('plugins_loaded', function() use($container) { |
| 56 |
if(function_exists('pll_register_string')): |
| 57 |
$service = $container['option_service']; |
| 58 |
$options = $service->all(); |
| 59 |
|
| 60 |
$menu_to_use = isset($options['menu_to_use']) ? $options['menu_to_use']->getValue() : ''; |
| 61 |
$button_title = isset($options['button_title']) ? $options['button_title']->getValue() : ''; |
| 62 |
$menu_title = isset($options['menu_title']) ? $options['menu_title']->getValue() : ''; |
| 63 |
$menu_title_link = isset($options['menu_title_link']) ? $options['menu_title_link']->getValue() : ''; |
| 64 |
|
| 65 |
pll_register_string('Menu Slug', $menu_to_use, 'Responsive Menu'); |
| 66 |
pll_register_string('Button Title', $button_title, 'Responsive Menu'); |
| 67 |
pll_register_string('Menu Title', $menu_title, 'Responsive Menu'); |
| 68 |
pll_register_string('Menu Title Link', $menu_title_link, 'Responsive Menu'); |
| 69 |
endif; |
| 70 |
}); |
| 71 |
endif; |
| 72 |
|