Code Modernization: Remove all code using a `version_compare()` with a PHP version older than PHP 5.6.

Props jrf.
Fixes #48074.
Built from https://develop.svn.wordpress.org/trunk@46214


git-svn-id: http://core.svn.wordpress.org/trunk@46026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-09-20 22:02:57 +00:00
parent 995c51380b
commit eb3f420848
5 changed files with 7 additions and 34 deletions

View File

@ -1376,13 +1376,6 @@ final class WP_Customize_Manager {
) )
); );
// In PHP < 5.6 filesize() returns 0 for the temp files unless we clear the file status cache.
// Technically, PHP < 5.6.0 || < 5.5.13 || < 5.4.29 but no need to be so targeted.
// See https://bugs.php.net/bug.php?id=65701
if ( version_compare( PHP_VERSION, '5.6', '<' ) ) {
clearstatcache();
}
$attachment_id = media_handle_sideload( $file_array, 0, null, $attachment_post_data ); $attachment_id = media_handle_sideload( $file_array, 0, null, $attachment_post_data );
if ( is_wp_error( $attachment_id ) ) { if ( is_wp_error( $attachment_id ) ) {
continue; continue;

View File

@ -199,13 +199,8 @@ class WP_Locale {
/* translators: $thousands_sep argument for https://secure.php.net/number_format, default is ',' */ /* translators: $thousands_sep argument for https://secure.php.net/number_format, default is ',' */
$thousands_sep = __( 'number_format_thousands_sep' ); $thousands_sep = __( 'number_format_thousands_sep' );
if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) { // Replace space with a non-breaking space to avoid wrapping.
// Replace space with a non-breaking space to avoid wrapping. $thousands_sep = str_replace( ' ', '&nbsp;', $thousands_sep );
$thousands_sep = str_replace( ' ', '&nbsp;', $thousands_sep );
} else {
// PHP < 5.4.0 does not support multiple bytes in thousands separator.
$thousands_sep = str_replace( array( '&nbsp;', '&#160;' ), ' ', $thousands_sep );
}
$this->number_format['thousands_sep'] = ( 'number_format_thousands_sep' === $thousands_sep ) ? ',' : $thousands_sep; $this->number_format['thousands_sep'] = ( 'number_format_thousands_sep' === $thousands_sep ) ? ',' : $thousands_sep;

View File

@ -5572,15 +5572,10 @@ function _print_emoji_detection_script() {
* @return string The encoded content. * @return string The encoded content.
*/ */
function wp_encode_emoji( $content ) { function wp_encode_emoji( $content ) {
$emoji = _wp_emoji_list( 'partials' ); $emoji = _wp_emoji_list( 'partials' );
$compat = version_compare( phpversion(), '5.4', '<' );
foreach ( $emoji as $emojum ) { foreach ( $emoji as $emojum ) {
if ( $compat ) { $emoji_char = html_entity_decode( $emojum );
$emoji_char = html_entity_decode( $emojum, ENT_COMPAT, 'UTF-8' );
} else {
$emoji_char = html_entity_decode( $emojum );
}
if ( false !== strpos( $content, $emoji_char ) ) { if ( false !== strpos( $content, $emoji_char ) ) {
$content = preg_replace( "/$emoji_char/", $emojum, $content ); $content = preg_replace( "/$emoji_char/", $emojum, $content );
} }
@ -5616,14 +5611,9 @@ function wp_staticize_emoji( $text ) {
// Quickly narrow down the list of emoji that might be in the text and need replacing. // Quickly narrow down the list of emoji that might be in the text and need replacing.
$possible_emoji = array(); $possible_emoji = array();
$compat = version_compare( phpversion(), '5.4', '<' );
foreach ( $emoji as $emojum ) { foreach ( $emoji as $emojum ) {
if ( false !== strpos( $text, $emojum ) ) { if ( false !== strpos( $text, $emojum ) ) {
if ( $compat ) { $possible_emoji[ $emojum ] = html_entity_decode( $emojum );
$possible_emoji[ $emojum ] = html_entity_decode( $emojum, ENT_COMPAT, 'UTF-8' );
} else {
$possible_emoji[ $emojum ] = html_entity_decode( $emojum );
}
} }
} }

View File

@ -6004,12 +6004,7 @@ function wp_allowed_protocols() {
function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) { function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) {
static $truncate_paths; static $truncate_paths;
if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) ) { $trace = debug_backtrace( false );
$trace = debug_backtrace( false );
} else {
$trace = debug_backtrace();
}
$caller = array(); $caller = array();
$check_class = ! is_null( $ignore_class ); $check_class = ! is_null( $ignore_class );
$skip_frames++; // skip this function $skip_frames++; // skip this function

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-46213'; $wp_version = '5.3-alpha-46214';
/** /**
* 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.