Changeset 41388 for trunk/src/wp-includes/functions.php
- Timestamp:
- 09/18/2017 11:03:06 PM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/functions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r41380 r41388 5706 5706 5707 5707 /** 5708 * Validates that a UUID is valid. 5709 * 5710 * @since 4.9.0 5711 * 5712 * @param mixed $uuid UUID to check. 5713 * @param int $version Specify which version of UUID to check against. Default is none, to accept any UUID version. Otherwise, only version allowed is `4`. 5714 * @return bool The string is a valid UUID or false on failure. 5715 */ 5716 function wp_is_uuid( $uuid, $version = null ) { 5717 5718 if ( ! is_string( $uuid ) ) { 5719 return false; 5720 } 5721 5722 if ( is_numeric( $version ) ) { 5723 if ( 4 !== (int) $version ) { 5724 _doing_it_wrong( __FUNCTION__, __( 'Only UUID V4 is supported at this time.' ), '4.9.0' ); 5725 return false; 5726 } 5727 $regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/'; 5728 } else { 5729 $regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/'; 5730 } 5731 5732 return (bool) preg_match( $regex, $uuid ); 5733 } 5734 5735 /** 5708 5736 * Get last changed date for the specified cache group. 5709 5737 *
Note: See TracChangeset
for help on using the changeset viewer.