shboard::$version > '4.11.9' ) { return WPMUDEV_Dashboard::$settings->get( 'remote_access' ); } else { return WPMUDEV_Dashboard::$site->get_option( 'remote_access' ); } } /** * Checks if the Hub connector is connected. * * @return bool True if connected, false otherwise. */ public static function get_status(): bool { return API::get()->is_logged_in(); } /** * Checks if Hub Connector is connected. If Dash plugin is not installed Hub connector can take over. * * @return bool */ public function hub_connector_connected(): bool { if ( $this->is_dash_activated() ) { $dash_api = WPMUDEV_Dashboard::$api; $connected = (bool) $dash_api->has_key(); } else { $connected = self::get_status(); } return $connected; } /** * Upgrade the method to get api key from Dashboard plugin or Hub Connector module. * * @return string */ public function get_api_key(): string { if ( $this->is_dash_activated() ) { $api_key = WPMUDEV_Dashboard::$api->get_key(); } else { $api_key = API::get()->get_api_key(); } return $api_key; } /** * Get Membership type. * * @return string */ public function get_membership_type() { if ( $this->is_dash_activated() ) { return WPMUDEV_Dashboard::$api->get_membership_status(); } elseif ( self::get_status() ) { return Data::get()->membership_type(); } return 'free'; } /** * Check if the membership type is expired. * * @return bool True if membership is expired, false otherwise. */ public function is_expired_membership_type(): bool { return 'expired' === $this->get_membership_type(); } /** * Logout from hub. * * @return array|bool|\WP_Error */ public function logout() { return API::get()->logout(); } /** * Check if site is connected to HUB via HCM or Dash. * * @return bool */ public function is_site_connected_to_hub_via_hcm_or_dash(): bool { return $this->hub_connector_connected() || self::get_status(); } }