urns true.
*
* @deprecated 1.42.0 This method no longer has a purpose after the removal of the soft disconnect feature.
*
* @return bool
*/
public function is_plugin_enabled() {
return true;
}
/**
* Perform the API request to refresh the blog token.
* Note that we are making this request on behalf of the Jetpack master user,
* given they were (most probably) the ones that registered the site at the first place.
*
* @return WP_Error|bool The result of updating the blog_token option.
*/
public function refresh_blog_token() {
( new Tracking() )->record_user_event( 'restore_connection_refresh_blog_token' );
$blog_id = \Jetpack_Options::get_option( 'id' );
if ( ! $blog_id ) {
return new WP_Error( 'site_not_registered', 'Site not registered.' );
}
$url = sprintf(
'%s/%s/v%s/%s',
Constants::get_constant( 'JETPACK__WPCOM_JSON_API_BASE' ),
'wpcom',
'2',
'sites/' . $blog_id . '/jetpack-refresh-blog-token'
);
$method = 'POST';
$user_id = get_current_user_id();
$response = Client::remote_request( compact( 'url', 'method', 'user_id' ) );
if ( is_wp_error( $response ) ) {
return new WP_Error( 'refresh_blog_token_http_request_failed', $response->get_error_message() );
}
$code = wp_remote_retrieve_response_code( $response );
$entity = wp_remote_retrieve_body( $response );
if ( $entity ) {
$json = json_decode( $entity );
} else {
$json = false;
}
if ( 200 !== $code ) {
if ( empty( $json->code ) ) {
return new WP_Error( 'unknown', '', $code );
}
/* translators: Error description string. */
$error_description = isset( $json->message ) ? sprintf( __( 'Error Details: %s', 'jetpack-connection' ), (string) $json->message ) : '';
return new WP_Error( (string) $json->code, $error_description, $code );
}
if ( empty( $json->jetpack_secret ) || ! is_scalar( $json->jetpack_secret ) ) {
return new WP_Error( 'jetpack_secret', '', $code );
}
Error_Handler::get_instance()->delete_all_errors();
return $this->get_tokens()->update_blog_token( (string) $json->jetpack_secret );
}
/**
* Disconnect the user from WP.com, and initiate the reconnect process.
*
* @return bool
*/
public function refresh_user_token() {
( new Tracking() )->record_user_event( 'restore_connection_refresh_user_token' );
$this->disconnect_user( null, true, true );
return true;
}
/**
* Fetches a signed token.
*
* @deprecated 1.24.0 Use Automattic\Jetpack\Connection\Tokens->get_signed_token() instead.
*
* @param object $token the token.
* @return WP_Error|string a signed token
*/
public function get_signed_token( $token ) {
_deprecated_function( __METHOD__, '1.24.0', 'Automattic\\Jetpack\\Connection\\Tokens->get_signed_token' );
return $this->get_tokens()->get_signed_token( $token );
}
/**
* If the site-level connection is active, add the list of plugins using connection to the heartbeat (except Jetpack itself)
*
* @param array $stats The Heartbeat stats array.
* @return array $stats
*/
public function add_stats_to_heartbeat( $stats ) {
if ( ! $this->is_connected() ) {
return $stats;
}
$active_plugins_using_connection = Plugin_Storage::get_all();
foreach ( array_keys( $active_plugins_using_connection ) as $plugin_slug ) {
if ( 'jetpack' !== $plugin_slug ) {
$stats_group = isset( $active_plugins_using_connection['jetpack'] ) ? 'combined-connection' : 'standalone-connection';
$stats[ $stats_group ][] = $plugin_slug;
}
}
return $stats;
}
/**
* Get the WPCOM or self-hosted site ID.
*
* @param bool $quiet Return null instead of an error.
*
* @return int|WP_Error|null
*/
public static function get_site_id( $quiet = false ) {
$is_wpcom = ( defined( 'IS_WPCOM' ) && IS_WPCOM );
$site_id = $is_wpcom ? get_current_blog_id() : \Jetpack_Options::get_option( 'id' );
if ( ! $site_id ) {
return $quiet
? null
: new \WP_Error(
'unavailable_site_id',
__( 'Sorry, something is wrong with your Jetpack connection.', 'jetpack-connection' ),
403
);
}
return (int) $site_id;
}
/**
* Check if Jetpack is ready for uninstall cleanup.
*
* @param string $current_plugin_slug The current plugin's slug.
*
* @return bool
*/
public static function is_ready_for_cleanup( $current_plugin_slug ) {
$active_plugins = get_option( Plugin_Storage::ACTIVE_PLUGINS_OPTION_NAME );
return empty( $active_plugins ) || ! is_array( $active_plugins )
|| ( count( $active_plugins ) === 1 && array_key_exists( $current_plugin_slug, $active_plugins ) );
}
}
Fatal error: Uncaught Error: Class "Automattic\Jetpack\Connection\Manager" not found in /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-connection/src/class-rest-authentication.php:63
Stack trace:
#0 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-connection/src/class-rest-authentication.php(73): Automattic\Jetpack\Connection\Rest_Authentication->__construct()
#1 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/jetpack/class.jetpack.php(733): Automattic\Jetpack\Connection\Rest_Authentication::init()
#2 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/jetpack/class.jetpack.php(498): Jetpack->__construct()
#3 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/jetpack/load-jetpack.php(74): Jetpack::init()
#4 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/jetpack/jetpack.php(219): require_once('...')
#5 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-settings.php(517): include_once('...')
#6 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-config.php(87): require_once('...')
#7 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-load.php(50): require_once('...')
#8 /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-blog-header.php(13): require_once('...')
#9 /var/www/vhosts/casainfotech.co.nz/httpdocs/index.php(17): require('...')
#10 {main}
thrown in /var/www/vhosts/casainfotech.co.nz/httpdocs/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-connection/src/class-rest-authentication.php on line 63