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