Changeset 57450
- Timestamp:
- 01/30/2024 06:00:03 PM (10 months ago)
- Location:
- branches/4.6/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.6/src
-
branches/4.6/src/wp-includes/functions.php
r54561 r57450 5 5 * @package WordPress 6 6 */ 7 8 /* 9 These next two functions are in this file due to compat.php having `__autoload` 10 in it and the PHP linter auto failing on it. 11 */ 12 13 if ( ! function_exists( 'str_starts_with' ) ) { 14 /** 15 * Polyfill for `str_starts_with()` function added in PHP 8.0. 16 * 17 * Performs a case-sensitive check indicating if 18 * the haystack begins with needle. 19 * 20 * @since 5.9.0 21 * 22 * @param string $haystack The string to search in. 23 * @param string $needle The substring to search for in the `$haystack`. 24 * @return bool True if `$haystack` starts with `$needle`, otherwise false. 25 */ 26 function str_starts_with( $haystack, $needle ) { 27 if ( '' === $needle ) { 28 return true; 29 } 30 31 return 0 === strpos( $haystack, $needle ); 32 } 33 } 34 35 if ( ! function_exists( 'str_ends_with' ) ) { 36 /** 37 * Polyfill for `str_ends_with()` function added in PHP 8.0. 38 * 39 * Performs a case-sensitive check indicating if 40 * the haystack ends with needle. 41 * 42 * @since 5.9.0 43 * 44 * @param string $haystack The string to search in. 45 * @param string $needle The substring to search for in the `$haystack`. 46 * @return bool True if `$haystack` ends with `$needle`, otherwise false. 47 */ 48 function str_ends_with( $haystack, $needle ) { 49 if ( '' === $haystack ) { 50 return '' === $needle; 51 } 52 53 $len = strlen( $needle ); 54 55 return substr( $haystack, -$len, $len ) === $needle; 56 } 57 } 58 7 59 8 60 require( ABSPATH . WPINC . '/option.php' ); … … 2358 2410 if ( $type !== $real_mime ) { 2359 2411 /* 2360 * Everything else including image/* and application/*: 2412 * Everything else including image/* and application/*: 2361 2413 * If the real content type doesn't match the file extension, assume it's dangerous. 2362 2414 */ … … 2367 2419 } 2368 2420 2369 // The mime type must be allowed 2421 // The mime type must be allowed 2370 2422 if ( $type ) { 2371 2423 $allowed = get_allowed_mime_types();
Note: See TracChangeset
for help on using the changeset viewer.