|
@@ 124-129 (lines=6) @@
|
| 121 |
|
'interval' => $request['interval'], |
| 122 |
|
) |
| 123 |
|
); |
| 124 |
|
if ( is_wp_error( $response ) ) { |
| 125 |
|
if ( $response->get_error_code() === 'missing_token' ) { |
| 126 |
|
return new WP_Error( 'missing_token', __( 'Please connect your user account to WordPress.com', 'jetpack' ), 404 ); |
| 127 |
|
} |
| 128 |
|
return new WP_Error( 'wpcom_connection_error', __( 'Could not connect to WordPress.com', 'jetpack' ), 404 ); |
| 129 |
|
} |
| 130 |
|
$data = isset( $response['body'] ) ? json_decode( $response['body'], true ) : null; |
| 131 |
|
// If endpoint returned error, we have to detect it. |
| 132 |
|
if ( 200 !== $response['response']['code'] && $data['code'] && $data['message'] ) { |
|
@@ 164-169 (lines=6) @@
|
| 161 |
|
array(), |
| 162 |
|
null |
| 163 |
|
); |
| 164 |
|
if ( is_wp_error( $response ) ) { |
| 165 |
|
if ( $response->get_error_code() === 'missing_token' ) { |
| 166 |
|
return new WP_Error( 'missing_token', __( 'Please connect your user account to WordPress.com', 'jetpack' ), 404 ); |
| 167 |
|
} |
| 168 |
|
return new WP_Error( 'wpcom_connection_error', __( 'Could not connect to WordPress.com', 'jetpack' ), 404 ); |
| 169 |
|
} |
| 170 |
|
$data = isset( $response['body'] ) ? json_decode( $response['body'], true ) : null; |
| 171 |
|
if ( ! $connected_account_id ) { |
| 172 |
|
$connect_url = empty( $data['connect_url'] ) ? '' : $data['connect_url']; |