Changeset 49063 for trunk/src/wp-includes/rest-api.php
- Timestamp:
- 09/27/2020 07:01:18 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r49054 r49063 1553 1553 * Validate required properties. 1554 1554 * @since 5.6.0 Support the "minProperties" and "maxProperties" keywords for objects. 1555 * Support the "multipleOf" keyword for numbers and integers. 1555 1556 * 1556 1557 * @param mixed $value The value to validate. … … 1692 1693 } 1693 1694 1694 if ( in_array( $args['type'], array( 'integer', 'number' ), true ) && ! is_numeric( $value ) ) { 1695 /* translators: 1: Parameter, 2: Type name. */ 1696 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, $args['type'] ) ); 1695 if ( in_array( $args['type'], array( 'integer', 'number' ), true ) ) { 1696 if ( ! is_numeric( $value ) ) { 1697 /* translators: 1: Parameter, 2: Type name. */ 1698 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, $args['type'] ) ); 1699 } 1700 1701 if ( isset( $args['multipleOf'] ) && fmod( $value, $args['multipleOf'] ) !== 0.0 ) { 1702 /* translators: 1: Parameter, 2: Multiplier. */ 1703 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be a multiple of %2$s.' ), $param, $args['multipleOf'] ) ); 1704 } 1697 1705 } 1698 1706 … … 2299 2307 'exclusiveMinimum', 2300 2308 'exclusiveMaximum', 2309 'multipleOf', 2301 2310 'minLength', 2302 2311 'maxLength',
Note: See TracChangeset
for help on using the changeset viewer.