PluginProbe
Polylang / 2.5
Polylang v2.5
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 | install/install.php +20 -53 2.72.5 View file →
@@ -7,68 +7,35 @@
7 7 */
8 8 class PLL_Install extends PLL_Install_Base {
9 9
10 10 /**
11 - * Checks min PHP and WP version, displays a notice if a requirement is not met.
11 + * Plugin activation for multisite
12 12 *
13 - * @since 2.6.7
13 + * @since 0.1
14 + *
15 + * @param bool $networkwide
14 16 */
15 - public function can_activate() {
17 + public function activate( $networkwide ) {
16 18 global $wp_version;
17 19
18 - if ( version_compare( PHP_VERSION, PLL_MIN_PHP_VERSION, '<' ) ) {
19 - add_action( 'admin_notices', array( $this, 'php_version_notice' ) );
20 - return false;
21 - }
20 + Polylang::define_constants();
22 21
22 + load_plugin_textdomain( 'polylang', false, basename( POLYLANG_DIR ) . '/languages' ); // plugin i18n
23 +
23 24 if ( version_compare( $wp_version, PLL_MIN_WP_VERSION, '<' ) ) {
24 - add_action( 'admin_notices', array( $this, 'wp_version_notice' ) );
25 - return false;
25 + die(
26 + sprintf(
27 + '<p style = "font-family: sans-serif; font-size: 12px; color: #333; margin: -5px">%s</p>',
28 + sprintf(
29 + /* translators: %1$s and %2$s are WordPress version numbers */
30 + esc_html__( 'You are using WordPress %1$s. Polylang requires at least WordPress %2$s.', 'polylang' ),
31 + esc_html( $wp_version ),
32 + PLL_MIN_WP_VERSION
33 + )
34 + )
35 + );
26 36 }
27 -
28 - return true;
29 - }
30 -
31 - /**
32 - * Displays a notice if PHP min version is not met.
33 - *
34 - * @since 2.6.7
35 - */
36 - public function php_version_notice() {
37 - load_plugin_textdomain( 'polylang', false, basename( POLYLANG_DIR ) . '/languages' ); // Plugin i18n.
38 -
39 - printf(
40 - '<div class="error"><p>%s</p></div>',
41 - sprintf(
42 - /* translators: 1: Plugin name 2: Current PHP version 3: Required PHP version */
43 - esc_html__( '%1$s has deactivated itself because you are using an old version of PHP. You are using using PHP %2$s. %1$s requires PHP %3$s.', 'polylang' ),
44 - esc_html( POLYLANG ),
45 - PHP_VERSION,
46 - esc_html( PLL_MIN_PHP_VERSION )
47 - )
48 - );
49 - }
50 -
51 - /**
52 - * Displays a notice if WP min version is not met.
53 - *
54 - * @since 2.6.7
55 - */
56 - public function wp_version_notice() {
57 - global $wp_version;
58 -
59 - load_plugin_textdomain( 'polylang', false, basename( POLYLANG_DIR ) . '/languages' ); // Plugin i18n.
60 -
61 - printf(
62 - '<div class="error"><p>%s</p></div>',
63 - sprintf(
64 - /* translators: 1: Plugin name 2: Current WordPress version 3: Required WordPress version */
65 - esc_html__( '%1$s has deactivated itself because you are using an old version of WordPress. You are using using WordPress %2$s. %1$s requires at least WordPress %3$s.', 'polylang' ),
66 - esc_html( POLYLANG ),
67 - esc_html( $wp_version ),
68 - esc_html( PLL_MIN_WP_VERSION )
69 - )
70 - );
37 + $this->do_for_all_blogs( 'activate', $networkwide );
71 38 }
72 39
73 40 /**
74 41 * Get default Polylang options