forked from polylang/polylang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpolylang.php
78 lines (71 loc) · 2.76 KB
/
polylang.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Polylang
*
* @package Polylang
* @author WP SYNTEX
* @license GPL-3.0-or-later
*
* @wordpress-plugin
* Plugin Name: Polylang
* Plugin URI: https://polylang.pro
* Description: Adds multilingual capability to WordPress
* Version: 3.3-dev
* Requires at least: 5.7
* Requires PHP: 5.6
* Author: WP SYNTEX
* Author URI: https://polylang.pro
* Text Domain: polylang
* Domain Path: /languages
* License: GPL v3 or later
* License URI: https://www.gnu.org/licenses/gpl-3.0.txt
*
* Copyright 2011-2019 Frédéric Demarle
* Copyright 2019-2022 WP SYNTEX
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Don't access directly.
};
if ( defined( 'POLYLANG_VERSION' ) ) {
// The user is attempting to activate a second plugin instance, typically Polylang and Polylang Pro.
require_once ABSPATH . 'wp-admin/includes/plugin.php';
require_once ABSPATH . 'wp-includes/pluggable.php';
if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) {
deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate this plugin.
// WP does not allow us to send a custom meaningful message, so just tell the plugin has been deactivated.
wp_safe_redirect( add_query_arg( 'deactivate', 'true', remove_query_arg( 'activate' ) ) );
exit;
}
} else {
// Go on loading the plugin
define( 'POLYLANG_VERSION', '3.3-dev' );
define( 'PLL_MIN_WP_VERSION', '5.7' );
define( 'PLL_MIN_PHP_VERSION', '5.6' );
define( 'POLYLANG_FILE', __FILE__ );
define( 'POLYLANG_DIR', __DIR__ );
// Whether we are using Polylang or Polylang Pro, get the filename of the plugin in use.
if ( ! defined( 'POLYLANG_ROOT_FILE' ) ) {
define( 'POLYLANG_ROOT_FILE', __FILE__ );
}
if ( ! defined( 'POLYLANG_BASENAME' ) ) {
define( 'POLYLANG_BASENAME', plugin_basename( __FILE__ ) ); // Plugin name as known by WP.
require __DIR__ . '/vendor/autoload.php';
}
define( 'POLYLANG', ucwords( str_replace( '-', ' ', dirname( POLYLANG_BASENAME ) ) ) );
if ( empty( $_GET['deactivate-polylang'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
new Polylang();
}
}