| @@ -40,22 +40,22 @@ | ||
| 40 | 40 | * |
| 41 | 41 | * @return bool|string |
| 42 | 42 | */ |
| 43 | 43 | public function get_apikey() { |
| 44 | - if ( ! class_exists( '\WPMUDEV_Dashboard' ) ) { | |
| 45 | - return false; | |
| 44 | + if ( $this->is_site_connected_to_hub_via_hcm_or_dash() && '' !== $this->get_api_key() ) { | |
| 45 | + return $this->get_api_key(); | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - \WPMUDEV_Dashboard::instance(); | |
| 48 | + return false; | |
| 49 | + } | |
| 49 | 50 | |
| 50 | - $membership_status = \WPMUDEV_Dashboard::$api->get_membership_data(); | |
| 51 | - $key = \WPMUDEV_Dashboard::$api->get_key(); | |
| 52 | - | |
| 53 | - if ( isset( $membership_status['hub_site_id'] ) && $membership_status['hub_site_id'] && '' !== $key ) { | |
| 54 | - return $key; | |
| 55 | - } | |
| 56 | - | |
| 57 | - return false; | |
| 51 | + /** | |
| 52 | + * Is the Hub API key available? | |
| 53 | + * | |
| 54 | + * @return bool | |
| 55 | + */ | |
| 56 | + public function is_apikey_available(): bool { | |
| 57 | + return false !== $this->get_apikey(); | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Check if whitelabel is enabled. |