| @@ 169-171 (lines=3) @@ | ||
| 166 | $option = self::key_for_api_service( $service ); |
|
| 167 | ||
| 168 | $validation = self::validate_service_api_key( $service_api_key, $service, $params ); |
|
| 169 | if ( ! $validation['status'] ) { |
|
| 170 | return new WP_Error( 'invalid_key', esc_html__( 'Invalid API Key', 'jetpack' ), array( 'status' => 404 ) ); |
|
| 171 | } |
|
| 172 | $message = esc_html__( 'API key updated successfully.', 'jetpack' ); |
|
| 173 | Jetpack_Options::update_option( $option, $service_api_key ); |
|
| 174 | return array( |
|
| @@ 1731-1737 (lines=7) @@ | ||
| 1728 | ), null, 'wpcom' ); |
|
| 1729 | $response_code = wp_remote_retrieve_response_code( $response ); |
|
| 1730 | ||
| 1731 | if ( 200 !== $response_code ) { |
|
| 1732 | return new WP_Error( |
|
| 1733 | 'activity_fetch_failed', |
|
| 1734 | esc_html__( 'Could not retrieve site activity.', 'jetpack' ), |
|
| 1735 | array( 'status' => $response_code ) |
|
| 1736 | ); |
|
| 1737 | } |
|
| 1738 | ||
| 1739 | $data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 1740 | ||