| @@ -1,8 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * @package Polylang | |
| 4 | - */ | |
| 5 | 2 | |
| 6 | 3 | /** |
| 7 | 4 | * A generic activation / de-activation class compatble with multisite |
| 8 | 5 | * |
| @@ -24,15 +21,10 @@ | ||
| 24 | 21 | // Manages plugin activation and deactivation |
| 25 | 22 | register_activation_hook( $plugin_basename, array( $this, 'activate' ) ); |
| 26 | 23 | register_deactivation_hook( $plugin_basename, array( $this, 'deactivate' ) ); |
| 27 | 24 | |
| 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 | - } | |
| 25 | + // Blog creation on multisite | |
| 26 | + add_action( 'wpmu_new_blog', array( $this, 'wpmu_new_blog' ), 5 ); // Before WP attempts to send mails which can break on some PHP versions | |
| 35 | 27 | } |
| 36 | 28 | |
| 37 | 29 | /** |
| 38 | 30 | * Allows to detect plugin deactivation |
| @@ -41,9 +33,9 @@ | ||
| 41 | 33 | * |
| 42 | 34 | * @return bool true if the plugin is currently beeing deactivated |
| 43 | 35 | */ |
| 44 | 36 | public function is_deactivation() { |
| 45 | - return isset( $_GET['action'], $_GET['plugin'] ) && 'deactivate' === $_GET['action'] && $this->plugin_basename === $_GET['plugin']; // phpcs:ignore WordPress.Security.NonceVerification | |
| 37 | + return isset( $_GET['action'], $_GET['plugin'] ) && 'deactivate' == $_GET['action'] && $this->plugin_basename == $_GET['plugin']; | |
| 46 | 38 | } |
| 47 | 39 | |
| 48 | 40 | /** |
| 49 | 41 | * Activation or deactivation for all blogs |
| @@ -111,23 +103,9 @@ | ||
| 111 | 103 | // Can be overriden in child class |
| 112 | 104 | } |
| 113 | 105 | |
| 114 | 106 | /** |
| 115 | - * Site creation on multisite ( to set default options ) | |
| 116 | - * | |
| 117 | - * @since 2.6.8 | |
| 118 | - * | |
| 119 | - * @param WP_Site $new_site New site object. | |
| 120 | - */ | |
| 121 | - public function new_site( $new_site ) { | |
| 122 | - switch_to_blog( $new_site->id ); | |
| 123 | - $this->_activate(); | |
| 124 | - restore_current_blog(); | |
| 125 | - } | |
| 126 | - | |
| 127 | - /** | |
| 128 | 107 | * Blog creation on multisite ( to set default options ) |
| 129 | - * Backward compatibility with WP < 5.1 | |
| 130 | 108 | * |
| 131 | 109 | * @since 0.9.4 |
| 132 | 110 | * |
| 133 | 111 | * @param int $blog_id |