| @@ 147-149 (lines=3) @@ | ||
| 144 | $option = self::key_for_api_service( $service ); |
|
| 145 | ||
| 146 | $validation = self::validate_service_api_key( $service_api_key, $service, $params ); |
|
| 147 | if ( ! $validation['status'] ) { |
|
| 148 | return new WP_Error( 'invalid_key', esc_html__( 'Invalid API Key', 'jetpack' ), array( 'status' => 404 ) ); |
|
| 149 | } |
|
| 150 | $message = esc_html__( 'API key updated successfully.', 'jetpack' ); |
|
| 151 | Jetpack_Options::update_option( $option, $service_api_key ); |
|
| 152 | return array( |
|
| @@ 1410-1416 (lines=7) @@ | ||
| 1407 | ), null, 'wpcom' ); |
|
| 1408 | $response_code = wp_remote_retrieve_response_code( $response ); |
|
| 1409 | ||
| 1410 | if ( 200 !== $response_code ) { |
|
| 1411 | return new WP_Error( |
|
| 1412 | 'activity_fetch_failed', |
|
| 1413 | esc_html__( 'Could not retrieve site activity.', 'jetpack' ), |
|
| 1414 | array( 'status' => $response_code ) |
|
| 1415 | ); |
|
| 1416 | } |
|
| 1417 | ||
| 1418 | $data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 1419 | ||