| @@ -1,26 +1,22 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | /** |
| 3 | - * Polylang | |
| 4 | - * | |
| 5 | - * @package Polylang | |
| 6 | - * @author WP SYNTEX | |
| 7 | - * @license GPL-3.0-or-later | |
| 8 | - * | |
| 9 | - * @wordpress-plugin | |
| 10 | - * Plugin Name: Polylang | |
| 11 | - * Plugin URI: https://polylang.pro | |
| 12 | - * Description: Adds multilingual capability to WordPress | |
| 13 | - * Version: 2.8.1 | |
| 4 | + * Plugin Name: Polylang | |
| 5 | + * Plugin URI: https://polylang.pro | |
| 6 | + * Description: Adds multilingual capability to WordPress | |
| 7 | + * Version: 2.7.3 | |
| 14 | 8 | * Requires at least: 4.9 |
| 15 | - * Requires PHP: 5.6 | |
| 16 | - * Author: WP SYNTEX | |
| 17 | - * Author URI: https://polylang.pro | |
| 18 | - * Text Domain: polylang | |
| 19 | - * Domain Path: /languages | |
| 20 | - * License: GPL v3 or later | |
| 21 | - * License URI: https://www.gnu.org/licenses/gpl-3.0.txt | |
| 22 | - * | |
| 9 | + * Requires PHP: 5.6 | |
| 10 | + * Author: WP SYNTEX | |
| 11 | + * Author uri: https://polylang.pro | |
| 12 | + * License: GPL v3 or later | |
| 13 | + * License URI: https://www.gnu.org/licenses/gpl-3.0.html | |
| 14 | + * Text Domain: polylang | |
| 15 | + * Domain Path: /languages | |
| 16 | + */ | |
| 17 | + | |
| 18 | +/* | |
| 23 | 19 | * Copyright 2011-2019 Frédéric Demarle |
| 24 | 20 | * Copyright 2019-2020 WP SYNTEX |
| 25 | 21 | * |
| 26 | 22 | * This program is free software: you can redistribute it and/or modify |
| @@ -37,36 +33,49 @@ | ||
| 37 | 33 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 38 | 34 | */ |
| 39 | 35 | |
| 40 | 36 | if ( ! defined( 'ABSPATH' ) ) { |
| 41 | - exit; // Don't access directly. | |
| 37 | + exit; // don't access directly | |
| 42 | 38 | }; |
| 43 | 39 | |
| 44 | -if ( defined( 'POLYLANG_VERSION' ) ) { | |
| 45 | - // The user is attempting to activate a second plugin instance, typically Polylang and Polylang Pro. | |
| 40 | +if ( defined( 'POLYLANG_BASENAME' ) ) { | |
| 41 | + // The user is attempting to activate a second plugin instance, typically Polylang and Polylang Pro | |
| 46 | 42 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 47 | - require_once ABSPATH . 'wp-includes/pluggable.php'; | |
| 48 | - if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) { | |
| 49 | - deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate this plugin. | |
| 50 | - // WP does not allow us to send a custom meaningful message, so just tell the plugin has been deactivated. | |
| 51 | - wp_safe_redirect( add_query_arg( 'deactivate', 'true', remove_query_arg( 'activate' ) ) ); | |
| 52 | - exit; | |
| 43 | + if ( defined( 'POLYLANG_PRO' ) ) { | |
| 44 | + // Polylang Pro is already activated | |
| 45 | + if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) { | |
| 46 | + require_once ABSPATH . 'wp-includes/pluggable.php'; | |
| 47 | + deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate this plugin | |
| 48 | + // WP does not allow us to send a custom meaningful message, so just tell the plugin has been deactivated | |
| 49 | + wp_safe_redirect( add_query_arg( 'deactivate', 'true', remove_query_arg( 'activate' ) ) ); | |
| 50 | + exit; | |
| 51 | + } | |
| 52 | + } else { | |
| 53 | + // Polylang was activated, deactivate it to keep only what we expect to be Polylang Pro | |
| 54 | + deactivate_plugins( POLYLANG_BASENAME ); | |
| 53 | 55 | } |
| 54 | 56 | } else { |
| 55 | 57 | // Go on loading the plugin |
| 56 | - define( 'POLYLANG_VERSION', '2.8.1' ); | |
| 58 | + define( 'POLYLANG_VERSION', '2.7.3' ); | |
| 57 | 59 | define( 'PLL_MIN_WP_VERSION', '4.9' ); |
| 58 | 60 | define( 'PLL_MIN_PHP_VERSION', '5.6' ); |
| 59 | 61 | |
| 60 | - define( 'POLYLANG_FILE', __FILE__ ); | |
| 61 | - define( 'POLYLANG_DIR', __DIR__ ); | |
| 62 | + define( 'POLYLANG_FILE', __FILE__ ); // this file | |
| 63 | + define( 'POLYLANG_BASENAME', plugin_basename( POLYLANG_FILE ) ); // plugin name as known by WP | |
| 64 | + define( 'POLYLANG_DIR', dirname( POLYLANG_FILE ) ); // our directory | |
| 65 | + define( 'POLYLANG', ucwords( str_replace( '-', ' ', dirname( POLYLANG_BASENAME ) ) ) ); | |
| 62 | 66 | |
| 63 | - if ( ! defined( 'POLYLANG_BASENAME' ) ) { | |
| 64 | - define( 'POLYLANG_BASENAME', plugin_basename( __FILE__ ) ); // Plugin name as known by WP. | |
| 65 | - require __DIR__ . '/vendor/autoload.php'; | |
| 67 | + define( 'PLL_ADMIN_INC', POLYLANG_DIR . '/admin' ); | |
| 68 | + define( 'PLL_FRONT_INC', POLYLANG_DIR . '/frontend' ); | |
| 69 | + define( 'PLL_INC', POLYLANG_DIR . '/include' ); | |
| 70 | + define( 'PLL_INSTALL_INC', POLYLANG_DIR . '/install' ); | |
| 71 | + define( 'PLL_MODULES_INC', POLYLANG_DIR . '/modules' ); | |
| 72 | + define( 'PLL_SETTINGS_INC', POLYLANG_DIR . '/settings' ); | |
| 73 | + define( 'PLL_PREFIX', 'pll_' ); | |
| 74 | + | |
| 75 | + if ( file_exists( PLL_MODULES_INC . '/pro.php' ) ) { | |
| 76 | + define( 'POLYLANG_PRO', true ); | |
| 66 | 77 | } |
| 67 | 78 | |
| 68 | - define( 'POLYLANG', ucwords( str_replace( '-', ' ', dirname( POLYLANG_BASENAME ) ) ) ); | |
| 69 | - | |
| 70 | - require __DIR__ . '/include/class-polylang.php'; | |
| 79 | + require_once PLL_INC . '/class-polylang.php'; | |
| 71 | 80 | new Polylang(); |
| 72 | 81 | } |