| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | * @package Polylang |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | - * A generic activation / de-activation class compatble with multisite | |
| 7 | + * A generic activation / de-activation class compatible with multisite | |
| 8 | 8 | * |
| 9 | 9 | * @since 1.7 |
| 10 | 10 | */ |
| 11 | 11 | class PLL_Install_Base { |
| @@ -30,9 +30,9 @@ | ||
| 30 | 30 | register_activation_hook( $plugin_basename, array( $this, 'activate' ) ); |
| 31 | 31 | register_deactivation_hook( $plugin_basename, array( $this, 'deactivate' ) ); |
| 32 | 32 | |
| 33 | 33 | // Site creation on multisite. |
| 34 | - add_action( 'wp_insert_site', array( $this, 'new_site' ) ); | |
| 34 | + add_action( 'wp_initialize_site', array( $this, 'new_site' ), 50 ); // After WP (prio 10). | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Allows to detect plugin deactivation |
| @@ -38,9 +38,9 @@ | ||
| 38 | 38 | * Allows to detect plugin deactivation |
| 39 | 39 | * |
| 40 | 40 | * @since 1.7 |
| 41 | 41 | * |
| 42 | - * @return bool true if the plugin is currently beeing deactivated | |
| 42 | + * @return bool true if the plugin is currently being deactivated | |
| 43 | 43 | */ |
| 44 | 44 | public function is_deactivation() { |
| 45 | 45 | return isset( $_GET['action'], $_GET['plugin'] ) && 'deactivate' === $_GET['action'] && $this->plugin_basename === $_GET['plugin']; // phpcs:ignore WordPress.Security.NonceVerification |
| 46 | 46 | } |
| @@ -45,14 +45,14 @@ | ||
| 45 | 45 | return isset( $_GET['action'], $_GET['plugin'] ) && 'deactivate' === $_GET['action'] && $this->plugin_basename === $_GET['plugin']; // phpcs:ignore WordPress.Security.NonceVerification |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * Activation or deactivation for all blogs | |
| 49 | + * Activation or deactivation for all blogs. | |
| 50 | 50 | * |
| 51 | 51 | * @since 1.2 |
| 52 | 52 | * |
| 53 | - * @param string $what Either 'activate' or 'deactivate' | |
| 54 | - * @param bool $networkwide | |
| 53 | + * @param string $what Either 'activate' or 'deactivate'. | |
| 54 | + * @param bool $networkwide Whether the plugin is (de)activated for all sites in the network or just the current site. | |
| 55 | 55 | * @return void |
| 56 | 56 | */ |
| 57 | 57 | protected function do_for_all_blogs( $what, $networkwide ) { |
| 58 | 58 | // Network |
| @@ -72,13 +72,13 @@ | ||
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | - * Plugin activation for multisite | |
| 76 | + * Plugin activation for multisite. | |
| 77 | 77 | * |
| 78 | 78 | * @since 1.7 |
| 79 | 79 | * |
| 80 | - * @param bool $networkwide | |
| 80 | + * @param bool $networkwide Whether the plugin is activated for all sites in the network or just the current site. | |
| 81 | 81 | * @return void |
| 82 | 82 | */ |
| 83 | 83 | public function activate( $networkwide ) { |
| 84 | 84 | $this->do_for_all_blogs( 'activate', $networkwide ); |
| @@ -91,17 +91,17 @@ | ||
| 91 | 91 | * |
| 92 | 92 | * @return void |
| 93 | 93 | */ |
| 94 | 94 | protected function _activate() { |
| 95 | - // Can be overriden in child class | |
| 95 | + // Can be overridden in child class | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | - * Plugin deactivation for multisite | |
| 99 | + * Plugin deactivation for multisite. | |
| 100 | 100 | * |
| 101 | 101 | * @since 0.1 |
| 102 | 102 | * |
| 103 | - * @param bool $networkwide | |
| 103 | + * @param bool $networkwide Whether the plugin is deactivated for all sites in the network or just the current site. | |
| 104 | 104 | * @return void |
| 105 | 105 | */ |
| 106 | 106 | public function deactivate( $networkwide ) { |
| 107 | 107 | $this->do_for_all_blogs( 'deactivate', $networkwide ); |
| @@ -114,9 +114,9 @@ | ||
| 114 | 114 | * |
| 115 | 115 | * @return void |
| 116 | 116 | */ |
| 117 | 117 | protected function _deactivate() { |
| 118 | - // Can be overriden in child class | |
| 118 | + // Can be overridden in child class | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * Site creation on multisite ( to set default options ) |