| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
Plugin Name: Polylang |
| 5 |
Plugin URI: https://polylang.pro |
| 6 |
Version: 2.5 |
| 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 |
/* |
| 15 |
* Copyright 2011-2018 Frédéric Demarle |
| 16 |
* |
| 17 |
* This program is free software; you can redistribute it and/or modify |
| 18 |
* it under the terms of the GNU General Public License as published by |
| 19 |
* the Free Software Foundation; either version 2 of the License, or |
| 20 |
* ( at your option ) any later version. |
| 21 |
* |
| 22 |
* This program is distributed in the hope that it will be useful, |
| 23 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 25 |
* GNU General Public License for more details. |
| 26 |
* |
| 27 |
* You should have received a copy of the GNU General Public License |
| 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 |
* |
| 32 |
*/ |
| 33 |
|
| 34 |
if ( ! defined( 'ABSPATH' ) ) { |
| 35 |
exit; // don't access directly |
| 36 |
}; |
| 37 |
|
| 38 |
if ( defined( 'POLYLANG_BASENAME' ) ) { |
| 39 |
// The user is attempting to activate a second plugin instance, typically Polylang and Polylang Pro |
| 40 |
require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 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 |
} |
| 54 |
} else { |
| 55 |
// Go on loading the plugin |
| 56 |
define( 'POLYLANG_VERSION', '2.5' ); |
| 57 |
define( 'PLL_MIN_WP_VERSION', '4.7' ); |
| 58 |
|
| 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 ) ) ) ); |
| 63 |
|
| 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' ); |
| 70 |
|
| 71 |
require_once PLL_INC . '/class-polylang.php'; |
| 72 |
|
| 73 |
if ( file_exists( PLL_INC . '/class-polylang-pro.php' ) ) { |
| 74 |
define( 'POLYLANG_PRO', true ); |
| 75 |
require_once PLL_INC . '/class-polylang-pro.php'; |
| 76 |
} |
| 77 |
} |
| 78 |
|