Changeset 55988 for trunk/src/wp-includes/functions.php
- Timestamp:
- 06/22/2023 02:34:56 PM (3 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/functions.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r55968 r55988 709 709 return false; 710 710 } 711 } elseif ( false === strpos( $data, '"' ) ) {711 } elseif ( ! str_contains( $data, '"' ) ) { 712 712 return false; 713 713 } … … 1159 1159 } 1160 1160 1161 if ( str pos( $uri, '?' ) !== false) {1161 if ( str_contains( $uri, '?' ) ) { 1162 1162 list( $base, $query ) = explode( '?', $uri, 2 ); 1163 1163 $base .= '?'; 1164 } elseif ( $protocol || strpos( $uri, '=' ) === false) {1164 } elseif ( $protocol || ! str_contains( $uri, '=' ) ) { 1165 1165 $base = $uri . '?'; 1166 1166 $query = ''; … … 2055 2055 2056 2056 // Do not allow path traversals. 2057 if ( false !== strpos( $target, '../' ) || false !== strpos( $target, '..' . DIRECTORY_SEPARATOR ) ) {2057 if ( str_contains( $target, '../' ) || str_contains( $target, '..' . DIRECTORY_SEPARATOR ) ) { 2058 2058 return false; 2059 2059 } … … 2642 2642 2643 2643 // The (resized) image files would have name and extension, and will be in the uploads dir. 2644 if ( $name && $ext && @is_dir( $dir ) && false !== strpos( $dir, $upload_dir['basedir'] ) ) {2644 if ( $name && $ext && @is_dir( $dir ) && str_contains( $dir, $upload_dir['basedir'] ) ) { 2645 2645 /** 2646 2646 * Filters the file list used for calculating a unique filename for a newly added file. … … 4657 4657 $mce_init['rtl_ui'] = true; 4658 4658 4659 if ( ! empty( $mce_init['plugins'] ) && strpos( $mce_init['plugins'], 'directionality' ) === false) {4659 if ( ! empty( $mce_init['plugins'] ) && ! str_contains( $mce_init['plugins'], 'directionality' ) ) { 4660 4660 $mce_init['plugins'] .= ',directionality'; 4661 4661 } … … 5969 5969 if ( empty( $loaded_mods ) 5970 5970 && function_exists( 'phpinfo' ) 5971 && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' )5971 && ! str_contains( ini_get( 'disable_functions' ), 'phpinfo' ) 5972 5972 ) { 5973 5973 ob_start(); … … 5975 5975 $phpinfo = ob_get_clean(); 5976 5976 5977 if ( false !== strpos( $phpinfo, $mod ) ) {5977 if ( str_contains( $phpinfo, $mod ) ) { 5978 5978 return true; 5979 5979 } … … 6050 6050 6051 6051 // `../` which does not occur at the end of the path is not allowed: 6052 if ( false !== strpos( $file, '../' ) && '../' !== mb_substr( $file, -3, 3 ) ) {6052 if ( str_contains( $file, '../' ) && '../' !== mb_substr( $file, -3, 3 ) ) { 6053 6053 return 1; 6054 6054 } … … 6105 6105 6106 6106 // The request is for the admin. 6107 if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || str pos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) !== false) {6107 if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || str_contains( $_SERVER['REQUEST_URI'], 'wp-login.php' ) ) { 6108 6108 $path = preg_replace( '#/(wp-admin/?.*|wp-login\.php.*)#i', '', $_SERVER['REQUEST_URI'] ); 6109 6109 … … 6114 6114 6115 6115 } else { 6116 if ( false !== strpos( $_SERVER['SCRIPT_FILENAME'], $abspath_fix ) ) {6116 if ( str_contains( $_SERVER['SCRIPT_FILENAME'], $abspath_fix ) ) { 6117 6117 // Request is hitting a file inside ABSPATH. 6118 6118 $directory = str_replace( ABSPATH, '', $script_filename_dir ); 6119 6119 // Strip off the subdirectory, and any file/query params. 6120 6120 $path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '', $_SERVER['REQUEST_URI'] ); 6121 } elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) {6121 } elseif ( str_contains( $abspath_fix, $script_filename_dir ) ) { 6122 6122 // Request is hitting a file above ABSPATH. 6123 6123 $subdirectory = substr( $abspath_fix, strpos( $abspath_fix, $script_filename_dir ) + strlen( $script_filename_dir ) ); … … 7105 7105 $ua = $_SERVER['HTTP_USER_AGENT']; 7106 7106 7107 if ( str pos( $ua, 'iPhone' ) !== false7108 || str pos( $ua, 'iPad' ) !== false7109 || str pos( $ua, 'iPod' ) !== false) {7107 if ( str_contains( $ua, 'iPhone' ) 7108 || str_contains( $ua, 'iPad' ) 7109 || str_contains( $ua, 'iPod' ) ) { 7110 7110 return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' ); 7111 7111 } … … 8511 8511 8512 8512 if ( 8513 strpos( $path, '/' ) === false&&8514 strpos( $path, '\\' ) === false8513 ! str_contains( $path, '/' ) && 8514 ! str_contains( $path, '\\' ) 8515 8515 ) { 8516 8516 unset( $directory_cache[ $path ] );
Note:
See TracChangeset
for help on using the changeset viewer.