| 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.3 |
| 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 |
register_activation_hook(__FILE__, 'activate_responsive_menu'); |
| 17 |
function activate_responsive_menu() { |
| 18 |
if(version_compare(PHP_VERSION, '5,4', '<')): |
| 19 |
deactivate_plugins(plugin_basename(__FILE__ )); |
| 20 |
wp_die(sprintf('Responsive Menu requires PHP 5.4 or higher. You are still on %s', PHP_VERSION)); |
| 21 |
endif; |
| 22 |
} |
| 23 |
|
| 24 |
/* Required includes for plugin to function */ |
| 25 |
include dirname(__FILE__) . '/autoload.php'; |
| 26 |
include dirname(__FILE__) . '/src/config/route_dependencies.php'; |
| 27 |
|
| 28 |
/* Internationalise the plugin */ |
| 29 |
add_action('plugins_loaded', function() { |
| 30 |
load_plugin_textdomain('responsive-menu', false, basename(dirname(__FILE__)) . '/translations/'); |
| 31 |
}); |
| 32 |
|
| 33 |
/* Route the plugin */ |
| 34 |
$wp_router = new ResponsiveMenu\Routing\WpRouting($container); |
| 35 |
$wp_router->route(); |
| 36 |
|
| 37 |
if(is_admin()): |
| 38 |
/* |
| 39 |
* Initial Migration and Version Check synchronisation */ |
| 40 |
add_action('admin_init', function() use($container) { |
| 41 |
include dirname(__FILE__) . '/src/config/default_options.php'; |
| 42 |
$migration = new ResponsiveMenu\Database\Migration($container['database'], $default_options); |
| 43 |
$migration->setup(); |
| 44 |
$migration->synchronise(); |
| 45 |
}); |
| 46 |
|
| 47 |
/* |
| 48 |
Polylang Integration Section */ |
| 49 |
add_action('plugins_loaded', function() use($container) { |
| 50 |
if(function_exists('pll_register_string')): |
| 51 |
$repo = $container['option_repository']; |
| 52 |
$options = $repo->all(); |
| 53 |
|
| 54 |
$menu_to_use = isset($options['menu_to_use']) ? $options['menu_to_use']->getValue() : ''; |
| 55 |
$button_title = isset($options['button_title']) ? $options['button_title']->getValue() : ''; |
| 56 |
$menu_title = isset($options['menu_title']) ? $options['menu_title']->getValue() : ''; |
| 57 |
$menu_title_link = isset($options['menu_title_link']) ? $options['menu_title_link']->getValue() : ''; |
| 58 |
|
| 59 |
pll_register_string('Menu Slug', $menu_to_use, 'Responsive Menu'); |
| 60 |
pll_register_string('Button Title', $button_title, 'Responsive Menu'); |
| 61 |
pll_register_string('Menu Title', $menu_title, 'Responsive Menu'); |
| 62 |
pll_register_string('Menu Title Link', $menu_title_link, 'Responsive Menu'); |
| 63 |
endif; |
| 64 |
}); |
| 65 |
endif; |
| 66 |
|