Changeset 55703 for trunk/src/wp-includes/functions.php
- Timestamp:
- 05/02/2023 03:43:03 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r55702 r55703 2379 2379 } else { 2380 2380 if ( ! wp_mkdir_p( $path ) ) { 2381 if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) {2381 if ( str_starts_with( $uploads['basedir'], ABSPATH ) ) { 2382 2382 $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir']; 2383 2383 } else { … … 2414 2414 if ( empty( $upload_path ) || 'wp-content/uploads' === $upload_path ) { 2415 2415 $dir = WP_CONTENT_DIR . '/uploads'; 2416 } elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) {2416 } elseif ( ! str_starts_with( $upload_path, ABSPATH ) ) { 2417 2417 // $dir is absolute, $upload_path is (maybe) relative to ABSPATH. 2418 2418 $dir = path_join( ABSPATH, $upload_path ); … … 2576 2576 $mime_type = $file_type['type']; 2577 2577 2578 $is_image = ( ! empty( $mime_type ) && 0 === strpos( $mime_type, 'image/' ) );2578 $is_image = ( ! empty( $mime_type ) && str_starts_with( $mime_type, 'image/' ) ); 2579 2579 $upload_dir = wp_get_upload_dir(); 2580 2580 $lc_filename = null; … … 2914 2914 $new_file = $upload['path'] . "/$filename"; 2915 2915 if ( ! wp_mkdir_p( dirname( $new_file ) ) ) { 2916 if ( 0 === strpos( $upload['basedir'], ABSPATH ) ) {2916 if ( str_starts_with( $upload['basedir'], ABSPATH ) ) { 2917 2917 $error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir']; 2918 2918 } else { … … 3083 3083 3084 3084 // Validate image types. 3085 if ( $type && 0 === strpos( $type, 'image/' ) ) {3085 if ( $type && str_starts_with( $type, 'image/' ) ) { 3086 3086 3087 3087 // Attempt to figure out what type of image it actually is. … … 3154 3154 $ext = false; 3155 3155 } 3156 } elseif ( 0 === strpos( $real_mime, 'video/' ) || 0 === strpos( $real_mime, 'audio/' ) ) {3156 } elseif ( str_starts_with( $real_mime, 'video/' ) || str_starts_with( $real_mime, 'audio/' ) ) { 3157 3157 /* 3158 3158 * For these types, only the major type must match the real value. … … 3312 3312 if ( 3313 3313 // RIFF. 3314 ( 0 === strpos( $magic, '52494646' ) ) &&3314 ( str_starts_with( $magic, '52494646' ) ) && 3315 3315 // WEBP. 3316 3316 ( 16 === strpos( $magic, '57454250' ) ) … … 7184 7184 $login_url = wp_login_url(); 7185 7185 $current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST']; 7186 $same_domain = ( strpos( $login_url, $current_domain ) === 0);7186 $same_domain = str_starts_with( $login_url, $current_domain ); 7187 7187 7188 7188 /** … … 7432 7432 } 7433 7433 7434 if ( false === $real_file || false === $real_directory || strpos( $real_file, trailingslashit( $real_directory ) ) !== 0) {7434 if ( false === $real_file || false === $real_directory || ! str_starts_with( $real_file, trailingslashit( $real_directory ) ) ) { 7435 7435 return false; 7436 7436 }
Note: See TracChangeset
for help on using the changeset viewer.