PluginProbe
Polylang / trunk
Polylang vtrunk
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | polylang.php +60 -31 3.0.3 → trunk View file →
@@ -9,20 +9,19 @@
9 9 * @wordpress-plugin
10 10 * Plugin Name: Polylang
11 11 * Plugin URI: https://polylang.pro
12 12 * Description: Adds multilingual capability to WordPress
13 - * Version: 3.0.3
14 - * Requires at least: 5.1
15 - * Requires PHP: 5.6
13 + * Version: 3.9-beta2
14 + * Requires at least: 6.8
15 + * Requires PHP: 7.4
16 16 * Author: WP SYNTEX
17 17 * Author URI: https://polylang.pro
18 18 * Text Domain: polylang
19 - * Domain Path: /languages
20 19 * License: GPL v3 or later
21 20 * License URI: https://www.gnu.org/licenses/gpl-3.0.txt
22 21 *
23 22 * Copyright 2011-2019 Frédéric Demarle
24 - * Copyright 2019-2021 WP SYNTEX
23 + * Copyright 2019-2026 WP SYNTEX
25 24 *
26 25 * This program is free software: you can redistribute it and/or modify
27 26 * it under the terms of the GNU General Public License as published by
28 27 * the Free Software Foundation, either version 3 of the License, or
@@ -36,43 +35,73 @@
36 35 * You should have received a copy of the GNU General Public License
37 36 * along with this program. If not, see <https://www.gnu.org/licenses/>.
38 37 */
39 38
40 -if ( ! defined( 'ABSPATH' ) ) {
41 - exit; // Don't access directly.
42 -};
39 +defined( 'ABSPATH' ) || exit;
43 40
44 41 if ( defined( 'POLYLANG_VERSION' ) ) {
45 42 // The user is attempting to activate a second plugin instance, typically Polylang and Polylang Pro.
46 43 require_once ABSPATH . 'wp-admin/includes/plugin.php';
47 - require_once ABSPATH . 'wp-includes/pluggable.php';
44 +
48 45 if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) {
49 46 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;
47 +
48 + add_action(
49 + 'load-plugins.php',
50 + static function () {
51 + unset( $_GET['activate'] ); // Prevent WP to display its 'Plugin activated.' message.
52 + $updated_notice_args = array(
53 + 'type' => 'error',
54 + 'dismissible' => true,
55 + );
56 + wp_admin_notice( __( 'Polylang hasn\'t been activated: Polylang and Polylang Pro cannot be activated at the same time.', 'polylang' ), $updated_notice_args );
57 + }
58 + );
53 59 }
54 -} else {
55 - // Go on loading the plugin
56 - define( 'POLYLANG_VERSION', '3.0.3' );
57 - define( 'PLL_MIN_WP_VERSION', '5.1' );
58 - define( 'PLL_MIN_PHP_VERSION', '5.6' );
60 + return;
61 +}
59 62
60 - define( 'POLYLANG_FILE', __FILE__ );
61 - define( 'POLYLANG_DIR', __DIR__ );
63 +// Go on loading the plugin.
64 +define( 'POLYLANG_VERSION', '3.9-beta2' );
65 +define( 'PLL_MIN_WP_VERSION', '6.8' );
66 +define( 'PLL_MIN_PHP_VERSION', '7.4' );
62 67
63 - // Whether we are using Polylang or Polylang Pro, get the filename of the plugin in use.
64 - if ( ! defined( 'POLYLANG_ROOT_FILE' ) ) {
65 - define( 'POLYLANG_ROOT_FILE', __FILE__ );
66 - }
68 +define( 'POLYLANG_FILE', __FILE__ );
69 +define( 'POLYLANG_DIR', __DIR__ );
67 70
68 - if ( ! defined( 'POLYLANG_BASENAME' ) ) {
69 - define( 'POLYLANG_BASENAME', plugin_basename( __FILE__ ) ); // Plugin name as known by WP.
70 - require __DIR__ . '/vendor/autoload.php';
71 - }
71 +// The filename of the plugin in use, whether it is Polylang or Polylang Pro.
72 +if ( ! defined( 'POLYLANG_ROOT_FILE' ) ) {
73 + define( 'POLYLANG_ROOT_FILE', __FILE__ );
74 +}
72 75
73 - define( 'POLYLANG', ucwords( str_replace( '-', ' ', dirname( POLYLANG_BASENAME ) ) ) );
76 +// The root directory of the plugin in use, whether it is Polylang or Polylang Pro.
77 +if ( ! defined( 'POLYLANG_ROOT_DIR' ) ) {
78 + define( 'POLYLANG_ROOT_DIR', __DIR__ );
79 +}
74 80
75 - if ( empty( $_GET['deactivate-polylang'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
76 - new Polylang();
77 - }
81 +if ( ! defined( 'POLYLANG_BASENAME' ) ) {
82 + define( 'POLYLANG_BASENAME', plugin_basename( __FILE__ ) ); // Plugin name as known by WP.
83 + require __DIR__ . '/vendor/autoload.php';
78 84 }
85 +
86 +define( 'POLYLANG', ucwords( str_replace( '-', ' ', dirname( POLYLANG_BASENAME ) ) ) );
87 +
88 +if ( ! empty( $_GET['deactivate-polylang'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
89 + return;
90 +}
91 +
92 +require POLYLANG_DIR . '/src/constant-functions.php';
93 +if ( ! PLL_Usable::can_activate() ) {
94 + // WP version or php version is too old.
95 + return;
96 +}
97 +
98 +define( 'POLYLANG_ACTIVE', true );
99 +
100 +if ( PLL_Deactivate::is_deactivation() ) {
101 + // Stopping here if we are going to deactivate the plugin (avoids breaking rewrite rules).
102 + PLL_Deactivate::add_hooks();
103 + return;
104 +}
105 +
106 +PLL_Activate::add_hooks();
107 +new Polylang();