| @@ -9,10 +9,10 @@ | ||
| 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.8.9 | |
| 14 | - * Requires at least: 6.5 | |
| 13 | + * Version: 3.9-beta2 | |
| 14 | + * Requires at least: 6.8 | |
| 15 | 15 | * Requires PHP: 7.4 |
| 16 | 16 | * Author: WP SYNTEX |
| 17 | 17 | * Author URI: https://polylang.pro |
| 18 | 18 | * Text Domain: polylang |
| @@ -40,30 +40,43 @@ | ||
| 40 | 40 | |
| 41 | 41 | if ( defined( 'POLYLANG_VERSION' ) ) { |
| 42 | 42 | // The user is attempting to activate a second plugin instance, typically Polylang and Polylang Pro. |
| 43 | 43 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 44 | - require_once ABSPATH . 'wp-includes/pluggable.php'; | |
| 45 | 44 | |
| 46 | 45 | if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) { |
| 47 | 46 | 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; | |
| 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 | + ); | |
| 51 | 59 | } |
| 52 | 60 | return; |
| 53 | 61 | } |
| 54 | 62 | |
| 55 | 63 | // Go on loading the plugin. |
| 56 | -define( 'POLYLANG_VERSION', '3.8.9' ); | |
| 57 | -define( 'PLL_MIN_WP_VERSION', '6.5' ); | |
| 64 | +define( 'POLYLANG_VERSION', '3.9-beta2' ); | |
| 65 | +define( 'PLL_MIN_WP_VERSION', '6.8' ); | |
| 58 | 66 | define( 'PLL_MIN_PHP_VERSION', '7.4' ); |
| 59 | 67 | |
| 60 | 68 | define( 'POLYLANG_FILE', __FILE__ ); |
| 61 | 69 | define( 'POLYLANG_DIR', __DIR__ ); |
| 62 | 70 | |
| 63 | -// Whether we are using Polylang or Polylang Pro, get the filename of the plugin in use. | |
| 71 | +// The filename of the plugin in use, whether it is Polylang or Polylang Pro. | |
| 64 | 72 | if ( ! defined( 'POLYLANG_ROOT_FILE' ) ) { |
| 65 | 73 | define( 'POLYLANG_ROOT_FILE', __FILE__ ); |
| 74 | +} | |
| 75 | + | |
| 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__ ); | |
| 66 | 79 | } |
| 67 | 80 | |
| 68 | 81 | if ( ! defined( 'POLYLANG_BASENAME' ) ) { |
| 69 | 82 | define( 'POLYLANG_BASENAME', plugin_basename( __FILE__ ) ); // Plugin name as known by WP. |