← All changes
|
jetpack_vendor/automattic/jetpack-connection/src/class-plugin.php
+19
-32
13.7.2
→
16.3-a.5
View file →
| @@ -31,8 +31,15 @@ | ||
| 31 | 31 | */ |
| 32 | 32 | private $slug; |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | + * Users Connection Admin instance. | |
| 36 | + * | |
| 37 | + * @var Users_Connection_Admin | |
| 38 | + */ | |
| 39 | + private $users_connection_admin; | |
| 40 | + | |
| 41 | + /** | |
| 35 | 42 | * Initialize the plugin manager. |
| 36 | 43 | * |
| 37 | 44 | * @param string $slug Plugin slug. |
| 38 | 45 | */ |
| @@ -37,8 +44,11 @@ | ||
| 37 | 44 | * @param string $slug Plugin slug. |
| 38 | 45 | */ |
| 39 | 46 | public function __construct( $slug ) { |
| 40 | 47 | $this->slug = $slug; |
| 48 | + | |
| 49 | + // Initialize Users_Connection_Admin | |
| 50 | + $this->users_connection_admin = new Users_Connection_Admin(); | |
| 41 | 51 | } |
| 42 | 52 | |
| 43 | 53 | /** |
| 44 | 54 | * Get the plugin slug. |
| @@ -84,39 +94,16 @@ | ||
| 84 | 94 | */ |
| 85 | 95 | public function is_only() { |
| 86 | 96 | $plugins = Plugin_Storage::get_all(); |
| 87 | 97 | |
| 98 | + if ( is_wp_error( $plugins ) ) { | |
| 99 | + if ( 'too_early' === $plugins->get_error_code() ) { | |
| 100 | + _doing_it_wrong( __METHOD__, esc_html( $plugins->get_error_code() . ': ' . $plugins->get_error_message() ), '6.16.1' ); | |
| 101 | + } else { | |
| 102 | + wp_trigger_error( __METHOD__, $plugins->get_error_code() . ': ' . $plugins->get_error_message() ); | |
| 103 | + } | |
| 104 | + return false; | |
| 105 | + } | |
| 106 | + | |
| 88 | 107 | return ! $plugins || ( array_key_exists( $this->slug, $plugins ) && 1 === count( $plugins ) ); |
| 89 | - } | |
| 90 | - | |
| 91 | - /** | |
| 92 | - * Add the plugin to the set of disconnected ones. | |
| 93 | - * | |
| 94 | - * @deprecated since 1.39.0. | |
| 95 | - * | |
| 96 | - * @return bool | |
| 97 | - */ | |
| 98 | - public function disable() { | |
| 99 | - return true; | |
| 100 | - } | |
| 101 | - | |
| 102 | - /** | |
| 103 | - * Remove the plugin from the set of disconnected ones. | |
| 104 | - * | |
| 105 | - * @deprecated since 1.39.0. | |
| 106 | - * | |
| 107 | - * @return bool | |
| 108 | - */ | |
| 109 | - public function enable() { | |
| 110 | - return true; | |
| 111 | - } | |
| 112 | - | |
| 113 | - /** | |
| 114 | - * Whether this plugin is allowed to use the connection. | |
| 115 | - * | |
| 116 | - * @deprecated since 11.0 | |
| 117 | - * @return bool | |
| 118 | - */ | |
| 119 | - public function is_enabled() { | |
| 120 | - return true; | |
| 121 | 108 | } |
| 122 | 109 | } |