| Conditions | 5 |
| Paths | 10 |
| Total Lines | 22 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 17 | function validate_input( $object ) { |
||
| 18 | $query_args = $this->query_args(); |
||
| 19 | $this->option_name = isset( $query_args['option_name'] ) ? $query_args['option_name'] : false; |
||
| 20 | if ( ! $this->option_name ) { |
||
| 21 | return new WP_Error( 'option_name_not_set', __( 'You must specify an option_name', 'jetpack' ) ); |
||
| 22 | } |
||
| 23 | $this->site_option = isset( $query_args['site_option'] ) ? $query_args['site_option'] : false; |
||
| 24 | /** |
||
| 25 | * Filter the list of options that are manageable via the JSON API. |
||
| 26 | * |
||
| 27 | * @module json-api |
||
| 28 | * |
||
| 29 | * @since 3.8.2 |
||
| 30 | * |
||
| 31 | * @param array The default list of site options. |
||
| 32 | * @param bool Is the option a site option. |
||
| 33 | */ |
||
| 34 | if ( ! in_array( $this->option_name, apply_filters( 'jetpack_options_whitelist', array(), $this->site_option ) ) ) { |
||
| 35 | return new WP_Error( 'option_name_not_in_whitelist', __( 'You must specify a whitelisted option_name', 'jetpack' ) ); |
||
| 36 | } |
||
| 37 | return true; |
||
| 38 | } |
||
| 39 | } |
||
| 40 |