From 08821279dd493b64ffc78085cd724094a1cd3baa Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Sat, 27 Jul 2019 01:32:32 +0200
Subject: [PATCH] [src] Remove work-arounds for PHP < 5.6
---
src/wp-includes/class-wp-customize-manager.php | 7 -------
src/wp-includes/class-wp-locale.php | 9 ++-------
src/wp-includes/formatting.php | 16 +++-------------
src/wp-includes/functions.php | 7 +------
4 files changed, 6 insertions(+), 33 deletions(-)
diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php
index 1948e7a794..b7cdf27400 100644
a
|
b
|
final class WP_Customize_Manager { |
1375 | 1375 | ) |
1376 | 1376 | ); |
1377 | 1377 | |
1378 | | // In PHP < 5.6 filesize() returns 0 for the temp files unless we clear the file status cache. |
1379 | | // Technically, PHP < 5.6.0 || < 5.5.13 || < 5.4.29 but no need to be so targeted. |
1380 | | // See https://bugs.php.net/bug.php?id=65701 |
1381 | | if ( version_compare( PHP_VERSION, '5.6', '<' ) ) { |
1382 | | clearstatcache(); |
1383 | | } |
1384 | | |
1385 | 1378 | $attachment_id = media_handle_sideload( $file_array, 0, null, $attachment_post_data ); |
1386 | 1379 | if ( is_wp_error( $attachment_id ) ) { |
1387 | 1380 | continue; |
diff --git a/src/wp-includes/class-wp-locale.php b/src/wp-includes/class-wp-locale.php
index 8582964a07..875a061568 100644
a
|
b
|
class WP_Locale { |
199 | 199 | /* translators: $thousands_sep argument for https://secure.php.net/number_format, default is ',' */ |
200 | 200 | $thousands_sep = __( 'number_format_thousands_sep' ); |
201 | 201 | |
202 | | if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) { |
203 | | // Replace space with a non-breaking space to avoid wrapping. |
204 | | $thousands_sep = str_replace( ' ', ' ', $thousands_sep ); |
205 | | } else { |
206 | | // PHP < 5.4.0 does not support multiple bytes in thousands separator. |
207 | | $thousands_sep = str_replace( array( ' ', ' ' ), ' ', $thousands_sep ); |
208 | | } |
| 202 | // Replace space with a non-breaking space to avoid wrapping. |
| 203 | $thousands_sep = str_replace( ' ', ' ', $thousands_sep ); |
209 | 204 | |
210 | 205 | $this->number_format['thousands_sep'] = ( 'number_format_thousands_sep' === $thousands_sep ) ? ',' : $thousands_sep; |
211 | 206 | |
diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
index feed291794..63397aea5d 100644
a
|
b
|
function _print_emoji_detection_script() { |
5572 | 5572 | * @return string The encoded content. |
5573 | 5573 | */ |
5574 | 5574 | function wp_encode_emoji( $content ) { |
5575 | | $emoji = _wp_emoji_list( 'partials' ); |
5576 | | $compat = version_compare( phpversion(), '5.4', '<' ); |
| 5575 | $emoji = _wp_emoji_list( 'partials' ); |
5577 | 5576 | |
5578 | 5577 | foreach ( $emoji as $emojum ) { |
5579 | | if ( $compat ) { |
5580 | | $emoji_char = html_entity_decode( $emojum, ENT_COMPAT, 'UTF-8' ); |
5581 | | } else { |
5582 | | $emoji_char = html_entity_decode( $emojum ); |
5583 | | } |
| 5578 | $emoji_char = html_entity_decode( $emojum ); |
5584 | 5579 | if ( false !== strpos( $content, $emoji_char ) ) { |
5585 | 5580 | $content = preg_replace( "/$emoji_char/", $emojum, $content ); |
5586 | 5581 | } |
… |
… |
function wp_staticize_emoji( $text ) { |
5616 | 5611 | |
5617 | 5612 | // Quickly narrow down the list of emoji that might be in the text and need replacing. |
5618 | 5613 | $possible_emoji = array(); |
5619 | | $compat = version_compare( phpversion(), '5.4', '<' ); |
5620 | 5614 | foreach ( $emoji as $emojum ) { |
5621 | 5615 | if ( false !== strpos( $text, $emojum ) ) { |
5622 | | if ( $compat ) { |
5623 | | $possible_emoji[ $emojum ] = html_entity_decode( $emojum, ENT_COMPAT, 'UTF-8' ); |
5624 | | } else { |
5625 | | $possible_emoji[ $emojum ] = html_entity_decode( $emojum ); |
5626 | | } |
| 5616 | $possible_emoji[ $emojum ] = html_entity_decode( $emojum ); |
5627 | 5617 | } |
5628 | 5618 | } |
5629 | 5619 | |
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index d6230bd478..ff8ba87686 100644
a
|
b
|
function wp_allowed_protocols() { |
6053 | 6053 | function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) { |
6054 | 6054 | static $truncate_paths; |
6055 | 6055 | |
6056 | | if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) ) { |
6057 | | $trace = debug_backtrace( false ); |
6058 | | } else { |
6059 | | $trace = debug_backtrace(); |
6060 | | } |
6061 | | |
| 6056 | $trace = debug_backtrace( false ); |
6062 | 6057 | $caller = array(); |
6063 | 6058 | $check_class = ! is_null( $ignore_class ); |
6064 | 6059 | $skip_frames++; // skip this function |