| @@ 168-170 (lines=3) @@ | ||
| 165 | $option = self::key_for_api_service( $service ); |
|
| 166 | ||
| 167 | $validation = self::validate_service_api_key( $service_api_key, $service, $params ); |
|
| 168 | if ( ! $validation['status'] ) { |
|
| 169 | return new WP_Error( 'invalid_key', esc_html__( 'Invalid API Key', 'jetpack' ), array( 'status' => 404 ) ); |
|
| 170 | } |
|
| 171 | $message = esc_html__( 'API key updated successfully.', 'jetpack' ); |
|
| 172 | Jetpack_Options::update_option( $option, $service_api_key ); |
|
| 173 | return array( |
|
| @@ 1691-1697 (lines=7) @@ | ||
| 1688 | ), null, 'wpcom' ); |
|
| 1689 | $response_code = wp_remote_retrieve_response_code( $response ); |
|
| 1690 | ||
| 1691 | if ( 200 !== $response_code ) { |
|
| 1692 | return new WP_Error( |
|
| 1693 | 'activity_fetch_failed', |
|
| 1694 | esc_html__( 'Could not retrieve site activity.', 'jetpack' ), |
|
| 1695 | array( 'status' => $response_code ) |
|
| 1696 | ); |
|
| 1697 | } |
|
| 1698 | ||
| 1699 | $data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 1700 | ||