- Timestamp:
- 09/11/2022 11:28:39 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
r51000 r54131 259 259 } 260 260 261 $rest_args['schema'] = $this->set_additional_properties_to_false( $rest_args['schema'] );261 $rest_args['schema'] = rest_default_additional_properties_to_false( $rest_args['schema'] ); 262 262 263 263 $rest_options[ $rest_args['name'] ] = $rest_args; … … 323 323 324 324 /** 325 * Recursively add additionalProperties = false to all objects in a schema. 326 * 327 * This is need to restrict properties of objects in settings values to only 325 * Recursively add additionalProperties = false to all objects in a schema 326 * if no additionalProperties setting is specified. 327 * 328 * This is needed to restrict properties of objects in settings values to only 328 329 * registered items, as the REST API will allow additional properties by 329 330 * default. 330 331 * 331 332 * @since 4.9.0 333 * @deprecated 6.1.0 Use {@see rest_default_additional_properties_to_false()} instead. 332 334 * 333 335 * @param array $schema The schema array. … … 335 337 */ 336 338 protected function set_additional_properties_to_false( $schema ) { 337 switch ( $schema['type'] ) { 338 case 'object': 339 foreach ( $schema['properties'] as $key => $child_schema ) { 340 $schema['properties'][ $key ] = $this->set_additional_properties_to_false( $child_schema ); 341 } 342 343 $schema['additionalProperties'] = false; 344 break; 345 case 'array': 346 $schema['items'] = $this->set_additional_properties_to_false( $schema['items'] ); 347 break; 348 } 349 350 return $schema; 339 _deprecated_function( __METHOD__, '6.1.0', 'rest_default_additional_properties_to_false()' ); 340 341 return rest_default_additional_properties_to_false( $schema ); 351 342 } 352 343 }
Note: See TracChangeset
for help on using the changeset viewer.