| @@ -1,33 +1,24 @@ | ||
| 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.9 | |
| 14 | - * Requires at least: 5.1 | |
| 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 | - * | |
| 4 | +Plugin Name: Polylang | |
| 5 | +Plugin URI: https://polylang.pro | |
| 6 | +Version: 2.5.2 | |
| 7 | +Author: Frédéric Demarle | |
| 8 | +Author uri: https://polylang.pro | |
| 9 | +Description: Adds multilingual capability to WordPress | |
| 10 | +Text Domain: polylang | |
| 11 | +Domain Path: /languages | |
| 12 | + */ | |
| 13 | + | |
| 14 | +/* | |
| 23 | 15 | * Copyright 2011-2019 Frédéric Demarle |
| 24 | - * Copyright 2019-2020 WP SYNTEX | |
| 25 | 16 | * |
| 26 | - * This program is free software: you can redistribute it and/or modify | |
| 17 | + * This program is free software; you can redistribute it and/or modify | |
| 27 | 18 | * it under the terms of the GNU General Public License as published by |
| 28 | - * the Free Software Foundation, either version 3 of the License, or | |
| 29 | - * (at your option) any later version. | |
| 19 | + * the Free Software Foundation; either version 2 of the License, or | |
| 20 | + * ( at your option ) any later version. | |
| 30 | 21 | * |
| 31 | 22 | * This program is distributed in the hope that it will be useful, |
| 32 | 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 33 | 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| @@ -33,41 +24,54 @@ | ||
| 33 | 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 34 | 25 | * GNU General Public License for more details. |
| 35 | 26 | * |
| 36 | 27 | * You should have received a copy of the GNU General Public License |
| 37 | - * along with this program. If not, see <https://www.gnu.org/licenses/>. | |
| 28 | + * along with this program; if not, write to the Free Software | |
| 29 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
| 30 | + * MA 02110-1301, USA. | |
| 31 | + * | |
| 38 | 32 | */ |
| 39 | 33 | |
| 40 | 34 | if ( ! defined( 'ABSPATH' ) ) { |
| 41 | - exit; // Don't access directly. | |
| 35 | + exit; // don't access directly | |
| 42 | 36 | }; |
| 43 | 37 | |
| 44 | -if ( defined( 'POLYLANG_VERSION' ) ) { | |
| 45 | - // The user is attempting to activate a second plugin instance, typically Polylang and Polylang Pro. | |
| 38 | +if ( defined( 'POLYLANG_BASENAME' ) ) { | |
| 39 | + // The user is attempting to activate a second plugin instance, typically Polylang and Polylang Pro | |
| 46 | 40 | 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; | |
| 41 | + if ( defined( 'POLYLANG_PRO' ) ) { | |
| 42 | + // Polylang Pro is already activated | |
| 43 | + if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) { | |
| 44 | + require_once ABSPATH . 'wp-includes/pluggable.php'; | |
| 45 | + deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate this plugin | |
| 46 | + // WP does not allow us to send a custom meaningful message, so just tell the plugin has been deactivated | |
| 47 | + wp_safe_redirect( add_query_arg( 'deactivate', 'true', remove_query_arg( 'activate' ) ) ); | |
| 48 | + exit; | |
| 49 | + } | |
| 50 | + } else { | |
| 51 | + // Polylang was activated, deactivate it to keep only what we expect to be Polylang Pro | |
| 52 | + deactivate_plugins( POLYLANG_BASENAME ); | |
| 53 | 53 | } |
| 54 | 54 | } else { |
| 55 | 55 | // Go on loading the plugin |
| 56 | - define( 'POLYLANG_VERSION', '2.9' ); | |
| 57 | - define( 'PLL_MIN_WP_VERSION', '5.1' ); | |
| 58 | - define( 'PLL_MIN_PHP_VERSION', '5.6' ); | |
| 56 | + define( 'POLYLANG_VERSION', '2.5.2' ); | |
| 57 | + define( 'PLL_MIN_WP_VERSION', '4.7' ); | |
| 59 | 58 | |
| 60 | - define( 'POLYLANG_FILE', __FILE__ ); | |
| 61 | - define( 'POLYLANG_DIR', __DIR__ ); | |
| 59 | + define( 'POLYLANG_FILE', __FILE__ ); // this file | |
| 60 | + define( 'POLYLANG_BASENAME', plugin_basename( POLYLANG_FILE ) ); // plugin name as known by WP | |
| 61 | + define( 'POLYLANG_DIR', dirname( POLYLANG_FILE ) ); // our directory | |
| 62 | + define( 'POLYLANG', ucwords( str_replace( '-', ' ', dirname( POLYLANG_BASENAME ) ) ) ); | |
| 62 | 63 | |
| 63 | - if ( ! defined( 'POLYLANG_BASENAME' ) ) { | |
| 64 | - define( 'POLYLANG_BASENAME', plugin_basename( __FILE__ ) ); // Plugin name as known by WP. | |
| 65 | - require __DIR__ . '/vendor/autoload.php'; | |
| 66 | - } | |
| 64 | + define( 'PLL_ADMIN_INC', POLYLANG_DIR . '/admin' ); | |
| 65 | + define( 'PLL_FRONT_INC', POLYLANG_DIR . '/frontend' ); | |
| 66 | + define( 'PLL_INC', POLYLANG_DIR . '/include' ); | |
| 67 | + define( 'PLL_INSTALL_INC', POLYLANG_DIR . '/install' ); | |
| 68 | + define( 'PLL_MODULES_INC', POLYLANG_DIR . '/modules' ); | |
| 69 | + define( 'PLL_SETTINGS_INC', POLYLANG_DIR . '/settings' ); | |
| 67 | 70 | |
| 68 | - define( 'POLYLANG', ucwords( str_replace( '-', ' ', dirname( POLYLANG_BASENAME ) ) ) ); | |
| 71 | + require_once PLL_INC . '/class-polylang.php'; | |
| 69 | 72 | |
| 70 | - if ( empty( $_GET['deactivate-polylang'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification | |
| 71 | - new Polylang(); | |
| 73 | + if ( file_exists( PLL_INC . '/class-polylang-pro.php' ) ) { | |
| 74 | + define( 'POLYLANG_PRO', true ); | |
| 75 | + require_once PLL_INC . '/class-polylang-pro.php'; | |
| 72 | 76 | } |
| 73 | 77 | } |