PluginProbe
Polylang / 3.1.4
Polylang v3.1.4
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-base.php +15 -21 2.83.1.4 View file →
@@ -8,8 +8,13 @@
8 8 *
9 9 * @since 1.7
10 10 */
11 11 class PLL_Install_Base {
12 + /**
13 + * The plugin basename.
14 + *
15 + * @var string
16 + */
12 17 protected $plugin_basename;
13 18
14 19 /**
15 20 * Constructor
@@ -24,15 +29,10 @@
24 29 // Manages plugin activation and deactivation
25 30 register_activation_hook( $plugin_basename, array( $this, 'activate' ) );
26 31 register_deactivation_hook( $plugin_basename, array( $this, 'deactivate' ) );
27 32
28 - // Blog creation on multisite.
29 - if ( version_compare( $GLOBALS['wp_version'], '5.1', '<' ) ) {
30 - // FIXME: Backward compatibility with WP < 5.1.
31 - add_action( 'wpmu_new_blog', array( $this, 'wpmu_new_blog' ), 5 ); // Before WP attempts to send mails which can break on some PHP versions
32 - } else {
33 - add_action( 'wp_insert_site', array( $this, 'new_site' ) );
34 - }
33 + // Site creation on multisite.
34 + add_action( 'wp_insert_site', array( $this, 'new_site' ) );
35 35 }
36 36
37 37 /**
38 38 * Allows to detect plugin deactivation
@@ -51,8 +51,9 @@
51 51 * @since 1.2
52 52 *
53 53 * @param string $what Either 'activate' or 'deactivate'
54 54 * @param bool $networkwide
55 + * @return void
55 56 */
56 57 protected function do_for_all_blogs( $what, $networkwide ) {
57 58 // Network
58 59 if ( is_multisite() && $networkwide ) {
@@ -76,8 +77,9 @@
76 77 *
77 78 * @since 1.7
78 79 *
79 80 * @param bool $networkwide
81 + * @return void
80 82 */
81 83 public function activate( $networkwide ) {
82 84 $this->do_for_all_blogs( 'activate', $networkwide );
83 85 }
@@ -85,8 +87,10 @@
85 87 /**
86 88 * Plugin activation
87 89 *
88 90 * @since 0.5
91 + *
92 + * @return void
89 93 */
90 94 protected function _activate() {
91 95 // Can be overriden in child class
92 96 }
@@ -96,8 +100,9 @@
96 100 *
97 101 * @since 0.1
98 102 *
99 103 * @param bool $networkwide
104 + * @return void
100 105 */
101 106 public function deactivate( $networkwide ) {
102 107 $this->do_for_all_blogs( 'deactivate', $networkwide );
103 108 }
@@ -105,8 +110,10 @@
105 110 /**
106 111 * Plugin deactivation
107 112 *
108 113 * @since 0.5
114 + *
115 + * @return void
109 116 */
110 117 protected function _deactivate() {
111 118 // Can be overriden in child class
112 119 }
@@ -116,25 +123,12 @@
116 123 *
117 124 * @since 2.6.8
118 125 *
119 126 * @param WP_Site $new_site New site object.
127 + * @return void
120 128 */
121 129 public function new_site( $new_site ) {
122 130 switch_to_blog( $new_site->id );
123 - $this->_activate();
124 - restore_current_blog();
125 - }
126 -
127 - /**
128 - * Blog creation on multisite ( to set default options )
129 - * Backward compatibility with WP < 5.1
130 - *
131 - * @since 0.9.4
132 - *
133 - * @param int $blog_id
134 - */
135 - public function wpmu_new_blog( $blog_id ) {
136 - switch_to_blog( $blog_id );
137 131 $this->_activate();
138 132 restore_current_blog();
139 133 }
140 134 }