Changeset 49308
- Timestamp:
- 10/25/2020 08:28:50 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
r49295 r49308 467 467 } 468 468 469 $rest_args['schema'] = $this->default_additional_properties_to_false( $rest_args['schema'] );469 $rest_args['schema'] = rest_default_additional_properties_to_false( $rest_args['schema'] ); 470 470 471 471 if ( ! in_array( $type, array( 'string', 'boolean', 'integer', 'number', 'array', 'object' ), true ) ) { … … 572 572 * 573 573 * @since 5.3.0 574 * @deprecated 5.6.0 Use rest_default_additional_properties_to_false() instead. 574 575 * 575 576 * @param array $schema The schema array. … … 577 578 */ 578 579 protected function default_additional_properties_to_false( $schema ) { 579 switch ( $schema['type'] ) { 580 case 'object': 581 foreach ( $schema['properties'] as $key => $child_schema ) { 582 $schema['properties'][ $key ] = $this->default_additional_properties_to_false( $child_schema ); 583 } 584 585 if ( ! isset( $schema['additionalProperties'] ) ) { 586 $schema['additionalProperties'] = false; 587 } 588 break; 589 case 'array': 590 $schema['items'] = $this->default_additional_properties_to_false( $schema['items'] ); 591 break; 592 } 593 594 return $schema; 580 _deprecated_function( __METHOD__, '5.6.0', 'rest_default_additional_properties_to_false()' ); 581 582 return rest_default_additional_properties_to_false( $schema ); 595 583 } 596 584
Note: See TracChangeset
for help on using the changeset viewer.