Changeset 47627 for trunk/src/wp-includes/rest-api.php
- Timestamp:
- 04/27/2020 02:27:02 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r47550 r47627 1338 1338 } 1339 1339 1340 if ( 'string' === $args['type'] && ! is_string( $value ) ) { 1341 /* translators: 1: Parameter, 2: Type name. */ 1342 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'string' ) ); 1340 if ( 'string' === $args['type'] ) { 1341 if ( ! is_string( $value ) ) { 1342 /* translators: 1: Parameter, 2: Type name. */ 1343 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'string' ) ); 1344 } 1345 1346 if ( isset( $args['minLength'] ) && mb_strlen( $value ) < $args['minLength'] ) { 1347 return new WP_Error( 1348 'rest_invalid_param', 1349 sprintf( 1350 /* translators: 1: Parameter, 2: Number of characters. */ 1351 _n( '%1$s must be at least %2$s character long.', '%1$s must be at least %2$s characters long.', $args['minLength'] ), 1352 $param, 1353 number_format_i18n( $args['minLength'] ) 1354 ) 1355 ); 1356 } 1357 1358 if ( isset( $args['maxLength'] ) && mb_strlen( $value ) > $args['maxLength'] ) { 1359 return new WP_Error( 1360 'rest_invalid_param', 1361 sprintf( 1362 /* translators: 1: Parameter, 2: Number of characters. */ 1363 _n( '%1$s must be at most %2$s character long.', '%1$s must be at most %2$s characters long.', $args['maxLength'] ), 1364 $param, 1365 number_format_i18n( $args['maxLength'] ) 1366 ) 1367 ); 1368 } 1343 1369 } 1344 1370
Note: See TracChangeset
for help on using the changeset viewer.