| @@ 1521-1527 (lines=7) @@ | ||
| 1518 | ), null, 'wpcom' ); |
|
| 1519 | $response_code = wp_remote_retrieve_response_code( $response ); |
|
| 1520 | ||
| 1521 | if ( 200 !== $response_code ) { |
|
| 1522 | return new WP_Error( |
|
| 1523 | 'activity_fetch_failed', |
|
| 1524 | esc_html__( 'Could not retrieve site activity.', 'jetpack' ), |
|
| 1525 | array( 'status' => $response_code ) |
|
| 1526 | ); |
|
| 1527 | } |
|
| 1528 | ||
| 1529 | $data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 1530 | ||
| @@ 165-167 (lines=3) @@ | ||
| 162 | $option = self::key_for_api_service( $service ); |
|
| 163 | ||
| 164 | $validation = self::validate_service_api_key( $service_api_key, $service, $params ); |
|
| 165 | if ( ! $validation['status'] ) { |
|
| 166 | return new WP_Error( 'invalid_key', esc_html__( 'Invalid API Key', 'jetpack' ), array( 'status' => 404 ) ); |
|
| 167 | } |
|
| 168 | $message = esc_html__( 'API key updated successfully.', 'jetpack' ); |
|
| 169 | Jetpack_Options::update_option( $option, $service_api_key ); |
|
| 170 | return array( |
|