← All changes
|
_inc/lib/core-api/wpcom-endpoints/service-api-keys.php
+7
-3
12.2.3
→
16.3-a.1
View file →
| @@ -4,13 +4,17 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * @package automattic/jetpack |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 9 | + exit( 0 ); | |
| 10 | +} | |
| 11 | + | |
| 8 | 12 | /** |
| 9 | 13 | * Service API Keys: Exposes 3rd party api keys that are used on a site. |
| 10 | 14 | * |
| 11 | 15 | * [ |
| 12 | - * { # Availabilty Object. See schema for more detail. | |
| 16 | + * { # Availability Object. See schema for more detail. | |
| 13 | 17 | * code: (string) Displays success if the operation was successfully executed and an error code if it was not |
| 14 | 18 | * service: (string) The name of the service in question |
| 15 | 19 | * service_api_key: (string) The API key used by the service empty if one is not set yet |
| 16 | 20 | * service_api_key_source: (string) The source of the API key, defaults to "site" |
| @@ -179,9 +183,9 @@ | ||
| 179 | 183 | $params = ! empty( $json_params ) ? $json_params : $request->get_body_params(); |
| 180 | 184 | $service_api_key = trim( $params['service_api_key'] ); |
| 181 | 185 | $option = self::key_for_api_service( $service ); |
| 182 | 186 | |
| 183 | - $validation = self::validate_service_api_key( $service_api_key, $service, $params ); | |
| 187 | + $validation = self::validate_service_api_key( $service_api_key, $service ); | |
| 184 | 188 | if ( ! $validation['status'] ) { |
| 185 | 189 | return new WP_Error( 'invalid_key', esc_html__( 'Invalid API Key', 'jetpack' ), array( 'status' => 404 ) ); |
| 186 | 190 | } |
| 187 | 191 | $message = esc_html__( 'API key updated successfully.', 'jetpack' ); |
| @@ -314,9 +318,9 @@ | ||
| 314 | 318 | $mapbox_geocode_body = wp_remote_retrieve_body( $mapbox_geocode_response ); |
| 315 | 319 | $mapbox_geocode_json = json_decode( $mapbox_geocode_body ); |
| 316 | 320 | if ( isset( $mapbox_geocode_json->message ) || ! isset( $mapbox_geocode_json->query ) ) { |
| 317 | 321 | $status = false; |
| 318 | - $msg = isset( $mapbox_geocode_json->message ) ? $mapbox_geocode_json->message : 'Unknown error'; | |
| 322 | + $msg = $mapbox_geocode_json->message ?? 'Unknown error'; | |
| 319 | 323 | } |
| 320 | 324 | return array( |
| 321 | 325 | 'status' => $status, |
| 322 | 326 | 'error_message' => $msg, |