PluginProbe
Polylang / 3.8.10
Polylang v3.8.10
3.8.10 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 All 234 releases
← All changes | polylang.php +68 -55 2.7.2 → 3.8.10 View file →
@@ -1,24 +1,27 @@
1 1 <?php
2 -
3 2 /**
4 - * Plugin Name: Polylang
5 - * Plugin URI: https://polylang.pro
6 - * Description: Adds multilingual capability to WordPress
7 - * Version: 2.7.2
8 - * Requires at least: 4.9
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 -/*
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.8.10
14 + * Requires at least: 6.5
15 + * Requires PHP: 7.4
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 + *
19 22 * Copyright 2011-2019 Frédéric Demarle
20 - * Copyright 2019-2020 WP SYNTEX
23 + * Copyright 2019-2026 WP SYNTEX
21 24 *
22 25 * This program is free software: you can redistribute it and/or modify
23 26 * it under the terms of the GNU General Public License as published by
24 27 * the Free Software Foundation, either version 3 of the License, or
@@ -32,50 +35,60 @@
32 35 * You should have received a copy of the GNU General Public License
33 36 * along with this program. If not, see <https://www.gnu.org/licenses/>.
34 37 */
35 38
36 -if ( ! defined( 'ABSPATH' ) ) {
37 - exit; // don't access directly
38 -};
39 +defined( 'ABSPATH' ) || exit;
39 40
40 -if ( defined( 'POLYLANG_BASENAME' ) ) {
41 - // The user is attempting to activate a second plugin instance, typically Polylang and Polylang Pro
41 +if ( defined( 'POLYLANG_VERSION' ) ) {
42 + // The user is attempting to activate a second plugin instance, typically Polylang and Polylang Pro.
42 43 require_once ABSPATH . 'wp-admin/includes/plugin.php';
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 );
44 + require_once ABSPATH . 'wp-includes/pluggable.php';
45 +
46 + if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) {
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;
55 51 }
56 -} else {
57 - // Go on loading the plugin
58 - define( 'POLYLANG_VERSION', '2.7.2' );
59 - define( 'PLL_MIN_WP_VERSION', '4.9' );
60 - define( 'PLL_MIN_PHP_VERSION', '5.6' );
52 + return;
53 +}
61 54
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 ) ) ) );
55 +// Go on loading the plugin.
56 +define( 'POLYLANG_VERSION', '3.8.10' );
57 +define( 'PLL_MIN_WP_VERSION', '6.5' );
58 +define( 'PLL_MIN_PHP_VERSION', '7.4' );
66 59
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_' );
60 +define( 'POLYLANG_FILE', __FILE__ );
61 +define( 'POLYLANG_DIR', __DIR__ );
74 62
75 - if ( file_exists( PLL_MODULES_INC . '/pro.php' ) ) {
76 - define( 'POLYLANG_PRO', true );
77 - }
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 +}
78 67
79 - require_once PLL_INC . '/class-polylang.php';
80 - new Polylang();
68 +if ( ! defined( 'POLYLANG_BASENAME' ) ) {
69 + define( 'POLYLANG_BASENAME', plugin_basename( __FILE__ ) ); // Plugin name as known by WP.
70 + require __DIR__ . '/vendor/autoload.php';
81 71 }
72 +
73 +define( 'POLYLANG', ucwords( str_replace( '-', ' ', dirname( POLYLANG_BASENAME ) ) ) );
74 +
75 +if ( ! empty( $_GET['deactivate-polylang'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
76 + return;
77 +}
78 +
79 +require POLYLANG_DIR . '/src/constant-functions.php';
80 +if ( ! PLL_Usable::can_activate() ) {
81 + // WP version or php version is too old.
82 + return;
83 +}
84 +
85 +define( 'POLYLANG_ACTIVE', true );
86 +
87 +if ( PLL_Deactivate::is_deactivation() ) {
88 + // Stopping here if we are going to deactivate the plugin (avoids breaking rewrite rules).
89 + PLL_Deactivate::add_hooks();
90 + return;
91 +}
92 +
93 +PLL_Activate::add_hooks();
94 +new Polylang();