← All changes
|
json-endpoints/jetpack/class.wpcom-json-api-get-option-endpoint.php
+8
-2
12.2.3
→
16.3-a.7
View file →
| @@ -1,10 +1,16 @@ | ||
| 1 | 1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | 2 | |
| 3 | 3 | use Automattic\Jetpack\Sync\Defaults; |
| 4 | 4 | |
| 5 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 6 | + exit( 0 ); | |
| 7 | +} | |
| 8 | + | |
| 5 | 9 | /** |
| 6 | 10 | * Get option endpoint. |
| 11 | + * | |
| 12 | + * @phan-constructor-used-for-side-effects | |
| 7 | 13 | */ |
| 8 | 14 | class WPCOM_JSON_API_Get_Option_Endpoint extends Jetpack_JSON_API_Endpoint { |
| 9 | 15 | /** |
| 10 | 16 | * This endpoint allows authentication both via a blog and a user token. |
| @@ -48,13 +54,13 @@ | ||
| 48 | 54 | * @return bool|WP_Error |
| 49 | 55 | */ |
| 50 | 56 | public function validate_input( $object ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 51 | 57 | $query_args = $this->query_args(); |
| 52 | - $this->option_name = isset( $query_args['option_name'] ) ? $query_args['option_name'] : false; | |
| 58 | + $this->option_name = $query_args['option_name'] ?? false; | |
| 53 | 59 | if ( ! $this->option_name ) { |
| 54 | 60 | return new WP_Error( 'option_name_not_set', __( 'You must specify an option_name', 'jetpack' ) ); |
| 55 | 61 | } |
| 56 | - $this->site_option = isset( $query_args['site_option'] ) ? $query_args['site_option'] : false; | |
| 62 | + $this->site_option = $query_args['site_option'] ?? false; | |
| 57 | 63 | |
| 58 | 64 | /** |
| 59 | 65 | * Filter the list of options that are manageable via the JSON API. |
| 60 | 66 | * |