Coding Standards: Use strict comparison in `wp-includes/functions.php`.
Follow-up to [5999], [6342], [7406], [8369], [10322], [11288], [11332], [11597], [12405], [13569], [14649], [15806], [19773], [26449], [26926], [39831], [40124]. Props aristath, poena, afercia, SergeyBiryukov. See #58831. Built from https://develop.svn.wordpress.org/trunk@56326 git-svn-id: http://core.svn.wordpress.org/trunk@55838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8aa8b5883a
commit
6035d50bab
|
@ -1061,12 +1061,15 @@ function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urle
|
||||||
if ( $urlencode ) {
|
if ( $urlencode ) {
|
||||||
$k = urlencode( $k );
|
$k = urlencode( $k );
|
||||||
}
|
}
|
||||||
if ( is_int( $k ) && null != $prefix ) {
|
|
||||||
|
if ( is_int( $k ) && null !== $prefix ) {
|
||||||
$k = $prefix . $k;
|
$k = $prefix . $k;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty( $key ) ) {
|
if ( ! empty( $key ) ) {
|
||||||
$k = $key . '%5B' . $k . '%5D';
|
$k = $key . '%5B' . $k . '%5D';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( null === $v ) {
|
if ( null === $v ) {
|
||||||
continue;
|
continue;
|
||||||
} elseif ( false === $v ) {
|
} elseif ( false === $v ) {
|
||||||
|
@ -1772,15 +1775,18 @@ function is_blog_installed() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$suppress = $wpdb->suppress_errors();
|
$suppress = $wpdb->suppress_errors();
|
||||||
|
|
||||||
if ( ! wp_installing() ) {
|
if ( ! wp_installing() ) {
|
||||||
$alloptions = wp_load_alloptions();
|
$alloptions = wp_load_alloptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If siteurl is not set to autoload, check it specifically.
|
// If siteurl is not set to autoload, check it specifically.
|
||||||
if ( ! isset( $alloptions['siteurl'] ) ) {
|
if ( ! isset( $alloptions['siteurl'] ) ) {
|
||||||
$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
|
$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
|
||||||
} else {
|
} else {
|
||||||
$installed = $alloptions['siteurl'];
|
$installed = $alloptions['siteurl'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$wpdb->suppress_errors( $suppress );
|
$wpdb->suppress_errors( $suppress );
|
||||||
|
|
||||||
$installed = ! empty( $installed );
|
$installed = ! empty( $installed );
|
||||||
|
@ -1805,10 +1811,11 @@ function is_blog_installed() {
|
||||||
$wp_tables = $wpdb->tables();
|
$wp_tables = $wpdb->tables();
|
||||||
foreach ( $wp_tables as $table ) {
|
foreach ( $wp_tables as $table ) {
|
||||||
// The existence of custom user tables shouldn't suggest an unwise state or prevent a clean installation.
|
// The existence of custom user tables shouldn't suggest an unwise state or prevent a clean installation.
|
||||||
if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table ) {
|
if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE === $table ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table ) {
|
|
||||||
|
if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE === $table ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2080,7 +2087,7 @@ function wp_mkdir_p( $target ) {
|
||||||
* If a umask is set that modifies $dir_perms, we'll have to re-set
|
* If a umask is set that modifies $dir_perms, we'll have to re-set
|
||||||
* the $dir_perms correctly with chmod()
|
* the $dir_perms correctly with chmod()
|
||||||
*/
|
*/
|
||||||
if ( ( $dir_perms & ~umask() ) != $dir_perms ) {
|
if ( ( $dir_perms & ~umask() ) !== $dir_perms ) {
|
||||||
$folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
|
$folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
|
||||||
for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) {
|
for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) {
|
||||||
chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms );
|
chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms );
|
||||||
|
@ -2430,7 +2437,7 @@ function _wp_upload_dir( $time = null ) {
|
||||||
|
|
||||||
$url = get_option( 'upload_url_path' );
|
$url = get_option( 'upload_url_path' );
|
||||||
if ( ! $url ) {
|
if ( ! $url ) {
|
||||||
if ( empty( $upload_path ) || ( 'wp-content/uploads' === $upload_path ) || ( $upload_path == $dir ) ) {
|
if ( empty( $upload_path ) || ( 'wp-content/uploads' === $upload_path ) || ( $upload_path === $dir ) ) {
|
||||||
$url = WP_CONTENT_URL . '/uploads';
|
$url = WP_CONTENT_URL . '/uploads';
|
||||||
} else {
|
} else {
|
||||||
$url = trailingslashit( $siteurl ) . $upload_path;
|
$url = trailingslashit( $siteurl ) . $upload_path;
|
||||||
|
@ -3095,7 +3102,7 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
||||||
// Attempt to figure out what type of image it actually is.
|
// Attempt to figure out what type of image it actually is.
|
||||||
$real_mime = wp_get_image_mime( $file );
|
$real_mime = wp_get_image_mime( $file );
|
||||||
|
|
||||||
if ( $real_mime && $real_mime != $type ) {
|
if ( $real_mime && $real_mime !== $type ) {
|
||||||
/**
|
/**
|
||||||
* Filters the list mapping image mime types to their respective extensions.
|
* Filters the list mapping image mime types to their respective extensions.
|
||||||
*
|
*
|
||||||
|
@ -3122,9 +3129,10 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
||||||
$filename_parts[] = $mime_to_ext[ $real_mime ];
|
$filename_parts[] = $mime_to_ext[ $real_mime ];
|
||||||
$new_filename = implode( '.', $filename_parts );
|
$new_filename = implode( '.', $filename_parts );
|
||||||
|
|
||||||
if ( $new_filename != $filename ) {
|
if ( $new_filename !== $filename ) {
|
||||||
$proper_filename = $new_filename; // Mark that it changed.
|
$proper_filename = $new_filename; // Mark that it changed.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redefine the extension / MIME.
|
// Redefine the extension / MIME.
|
||||||
$wp_filetype = wp_check_filetype( $new_filename, $mimes );
|
$wp_filetype = wp_check_filetype( $new_filename, $mimes );
|
||||||
$ext = $wp_filetype['ext'];
|
$ext = $wp_filetype['ext'];
|
||||||
|
@ -4787,16 +4795,18 @@ function smilies_init() {
|
||||||
$rest = substr( $smiley, 1 );
|
$rest = substr( $smiley, 1 );
|
||||||
|
|
||||||
// New subpattern?
|
// New subpattern?
|
||||||
if ( $firstchar != $subchar ) {
|
if ( $firstchar !== $subchar ) {
|
||||||
if ( '' !== $subchar ) {
|
if ( '' !== $subchar ) {
|
||||||
$wp_smiliessearch .= ')(?=' . $spaces . '|$)'; // End previous "subpattern".
|
$wp_smiliessearch .= ')(?=' . $spaces . '|$)'; // End previous "subpattern".
|
||||||
$wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "subpattern".
|
$wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "subpattern".
|
||||||
}
|
}
|
||||||
|
|
||||||
$subchar = $firstchar;
|
$subchar = $firstchar;
|
||||||
$wp_smiliessearch .= preg_quote( $firstchar, '/' ) . '(?:';
|
$wp_smiliessearch .= preg_quote( $firstchar, '/' ) . '(?:';
|
||||||
} else {
|
} else {
|
||||||
$wp_smiliessearch .= '|';
|
$wp_smiliessearch .= '|';
|
||||||
}
|
}
|
||||||
|
|
||||||
$wp_smiliessearch .= preg_quote( $rest, '/' );
|
$wp_smiliessearch .= preg_quote( $rest, '/' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5938,7 +5948,7 @@ function is_lighttpd_before_150() {
|
||||||
$server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '' );
|
$server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '' );
|
||||||
$server_parts[1] = isset( $server_parts[1] ) ? $server_parts[1] : '';
|
$server_parts[1] = isset( $server_parts[1] ) ? $server_parts[1] : '';
|
||||||
|
|
||||||
return ( 'lighttpd' === $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' ) );
|
return ( 'lighttpd' === $server_parts[0] && -1 === version_compare( $server_parts[1], '1.5.0' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6347,6 +6357,7 @@ function wp_timezone_override_offset() {
|
||||||
if ( false === $timezone_object || false === $datetime_object ) {
|
if ( false === $timezone_object || false === $datetime_object ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 );
|
return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6367,33 +6378,42 @@ function _wp_timezone_choice_usort_callback( $a, $b ) {
|
||||||
if ( str_starts_with( $a['city'], 'GMT+' ) && str_starts_with( $b['city'], 'GMT+' ) ) {
|
if ( str_starts_with( $a['city'], 'GMT+' ) && str_starts_with( $b['city'], 'GMT+' ) ) {
|
||||||
return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) );
|
return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'UTC' === $a['city'] ) {
|
if ( 'UTC' === $a['city'] ) {
|
||||||
if ( str_starts_with( $b['city'], 'GMT+' ) ) {
|
if ( str_starts_with( $b['city'], 'GMT+' ) ) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'UTC' === $b['city'] ) {
|
if ( 'UTC' === $b['city'] ) {
|
||||||
if ( str_starts_with( $a['city'], 'GMT+' ) ) {
|
if ( str_starts_with( $a['city'], 'GMT+' ) ) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return strnatcasecmp( $a['city'], $b['city'] );
|
return strnatcasecmp( $a['city'], $b['city'] );
|
||||||
}
|
}
|
||||||
if ( $a['t_continent'] == $b['t_continent'] ) {
|
|
||||||
if ( $a['t_city'] == $b['t_city'] ) {
|
if ( $a['t_continent'] === $b['t_continent'] ) {
|
||||||
|
if ( $a['t_city'] === $b['t_city'] ) {
|
||||||
return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] );
|
return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return strnatcasecmp( $a['t_city'], $b['t_city'] );
|
return strnatcasecmp( $a['t_city'], $b['t_city'] );
|
||||||
} else {
|
} else {
|
||||||
// Force Etc to the bottom of the list.
|
// Force Etc to the bottom of the list.
|
||||||
if ( 'Etc' === $a['continent'] ) {
|
if ( 'Etc' === $a['continent'] ) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'Etc' === $b['continent'] ) {
|
if ( 'Etc' === $b['continent'] ) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return strnatcasecmp( $a['t_continent'], $b['t_continent'] );
|
return strnatcasecmp( $a['t_continent'], $b['t_continent'] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6913,7 +6933,7 @@ function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = ar
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tortoise got lapped - must be a loop.
|
// Tortoise got lapped - must be a loop.
|
||||||
if ( $tortoise == $evanescent_hare || $tortoise == $hare ) {
|
if ( $tortoise === $evanescent_hare || $tortoise === $hare ) {
|
||||||
return $_return_loop ? $return : $tortoise;
|
return $_return_loop ? $return : $tortoise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7010,7 +7030,7 @@ function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pr
|
||||||
if ( $skip_frames > 0 ) {
|
if ( $skip_frames > 0 ) {
|
||||||
$skip_frames--;
|
$skip_frames--;
|
||||||
} elseif ( isset( $call['class'] ) ) {
|
} elseif ( isset( $call['class'] ) ) {
|
||||||
if ( $check_class && $ignore_class == $call['class'] ) {
|
if ( $check_class && $ignore_class === $call['class'] ) {
|
||||||
continue; // Filter out calls.
|
continue; // Filter out calls.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.4-alpha-56325';
|
$wp_version = '6.4-alpha-56326';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue