PluginProbe
Polylang / 2.3.6
Polylang v2.3.6
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 +29 -67 2.72.3.6 View file →
@@ -7,71 +7,34 @@
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( sprintf( '<p style = "font-family: sans-serif; font-size: 12px; color: #333; margin: -5px">%s</p>',
26 + /* translators: %1$s and %2$s are WordPress version numbers */
27 + sprintf( esc_html__( 'You are using WordPress %1$s. Polylang requires at least WordPress %2$s.', 'polylang' ),
28 + esc_html( $wp_version ),
29 + PLL_MIN_WP_VERSION
30 + )
31 + ) );
26 32 }
27 -
28 - return true;
33 + $this->do_for_all_blogs( 'activate', $networkwide );
29 34 }
30 35
31 36 /**
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 - );
71 - }
72 -
73 - /**
74 37 * Get default Polylang options
75 38 *
76 39 * @since 1.8
77 40 *
@@ -76,23 +39,22 @@
76 39 * @since 1.8
77 40 *
78 41 * return array
79 42 */
80 - public static function get_default_options() {
43 + static public function get_default_options() {
81 44 return array(
82 - 'browser' => 1, // Default language for the front page is set by browser preference
83 - 'rewrite' => 1, // Remove /language/ in permalinks ( was the opposite before 0.7.2 )
84 - 'hide_default' => 1, // Remove URL language information for default language ( was the opposite before 2.1.5 )
85 - 'force_lang' => 1, // Add URL language information ( was 0 before 1.7 )
86 - 'redirect_lang' => 0, // Do not redirect the language page to the homepage
87 - 'media_support' => 1, // Support languages and translation for media by default
88 - 'uninstall' => 0, // Do not remove data when uninstalling Polylang
89 - 'sync' => array(), // Synchronisation is disabled by default ( was the opposite before 1.2 )
90 - 'post_types' => array(),
91 - 'taxonomies' => array(),
92 - 'domains' => array(),
93 - 'version' => POLYLANG_VERSION,
94 - 'first_activation' => time(),
45 + 'browser' => 1, // Default language for the front page is set by browser preference
46 + 'rewrite' => 1, // Remove /language/ in permalinks ( was the opposite before 0.7.2 )
47 + 'hide_default' => 1, // Remove URL language information for default language ( was the opposite before 2.1.5 )
48 + 'force_lang' => 1, // Add URL language information ( was 0 before 1.7 )
49 + 'redirect_lang' => 0, // Do not redirect the language page to the homepage
50 + 'media_support' => 1, // Support languages and translation for media by default
51 + 'uninstall' => 0, // Do not remove data when uninstalling Polylang
52 + 'sync' => array(), // Synchronisation is disabled by default ( was the opposite before 1.2 )
53 + 'post_types' => array(),
54 + 'taxonomies' => array(),
55 + 'domains' => array(),
56 + 'version' => POLYLANG_VERSION,
95 57 );
96 58 }
97 59
98 60 /**