| @@ 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( |
|
| @@ 1886-1892 (lines=7) @@ | ||
| 1883 | ), null, 'wpcom' ); |
|
| 1884 | $response_code = wp_remote_retrieve_response_code( $response ); |
|
| 1885 | ||
| 1886 | if ( 200 !== $response_code ) { |
|
| 1887 | return new WP_Error( |
|
| 1888 | 'activity_fetch_failed', |
|
| 1889 | esc_html__( 'Could not retrieve site activity.', 'jetpack' ), |
|
| 1890 | array( 'status' => $response_code ) |
|
| 1891 | ); |
|
| 1892 | } |
|
| 1893 | ||
| 1894 | $data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 1895 | ||