Make WordPress Core


Ignore:
Timestamp:
05/01/2020 02:24:42 PM (6 years ago)
Author:
desrosj
Message:

External Libraries: Update the SimplePie library to the latest version (1.5.5).

This brings SimplePie in sync with the most up to date version, 1.5.5.

This update brings many bug fixes, small enhancements, and PHP compatibility fixes for newer versions of PHP.

For a full list of changes, see ​https://github.com/simplepie/simplepie/blob/master/CHANGELOG.md#155-may-1-2020.

Props dshanske, slushman, etruel, wpshades, dmenard, desrosj, hareesh-pillai, stevenkword, jrf, Ipstenu, johnbillion.
Fixes #36669.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/SimplePie/Misc.php

    r24589 r47733  
    66 * Takes the hard work out of managing a complete RSS/Atom solution.
    77 *
    8  * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
     8 * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
    99 * All rights reserved.
    1010 *
    … …  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3.1
    37  * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
     36 * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
    3837 * @author Ryan Parman
    39  * @author Geoffrey Sneddon
     38 * @author Sam Sneddon
    4039 * @author Ryan McCue
    4140 * @link http://simplepie.org/ SimplePie
    … …  
    139138                {
    140139                        $key = strtolower($key);
    141                         $full .= " $key=\"" . htmlspecialchars($value['data']) . '"';
     140                        $full .= " $key=\"" . htmlspecialchars($value['data'], ENT_COMPAT, 'UTF-8') . '"';
    142141                }
    143142                if ($element['self_closing'])
    … …  
    219218                        return substr_replace($url, 'itpc', 0, 4);
    220219                }
    221                 else
    222                 {
    223                         return $url;
    224                 }
     220
     221                return $url;
     222        }
     223
     224        public static function array_merge_recursive($array1, $array2)
     225        {
     226                foreach ($array2 as $key => $value)
     227                {
     228                        if (is_array($value))
     229                        {
     230                                $array1[$key] = SimplePie_Misc::array_merge_recursive($array1[$key], $value);
     231                        }
     232                        else
     233                        {
     234                                $array1[$key] = $value;
     235                        }
     236                }
     237
     238                return $array1;
    225239        }
    226240
    … …  
    261275                        return chr($integer);
    262276                }
    263                 else
    264                 {
    265                         return strtoupper($match[0]);
    266                 }
     277
     278                return strtoupper($match[0]);
    267279        }
    268280
    … …  
    318330                        return $return;
    319331                }
     332                // This is third, as behaviour of this varies with OS userland and PHP version
     333                elseif (function_exists('iconv') && ($return = SimplePie_Misc::change_encoding_iconv($data, $input, $output)))
     334                {
     335                        return $return;
     336                }
    320337                // This is last, as behaviour of this varies with OS userland and PHP version
    321                 elseif (function_exists('iconv') && ($return = SimplePie_Misc::change_encoding_iconv($data, $input, $output)))
     338                elseif (class_exists('\UConverter') && ($return = SimplePie_Misc::change_encoding_uconverter($data, $input, $output)))
    322339                {
    323340                        return $return;
    324341                }
     342
    325343                // If we can't do anything, just fail
    326                 else
    327                 {
    328                         return false;
    329                 }
     344                return false;
    330345        }
    331346
    … …  
    371386        {
    372387                return @iconv($input, $output, $data);
     388        }
     389
     390        /**
     391         * @param string $data
     392         * @param string $input
     393         * @param string $output
     394         * @return string|false
     395         */
     396        protected static function change_encoding_uconverter($data, $input, $output)
     397        {
     398                return @\UConverter::transcode($data, $output, $input);
    373399        }
    374400
    … …  
    18271853                        return trim($mime);
    18281854                }
    1829                 else
    1830                 {
    1831                         return trim(substr($mime, 0, $pos));
    1832                 }
     1855
     1856                return trim(substr($mime, 0, $pos));
    18331857        }
    18341858
    … …  
    18631887                        }
    18641888                }
    1865                 else
    1866                 {
    1867                         return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
    1868                 }
     1889
     1890                return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
    18691891        }
    18701892
    … …  
    19161938                        }
    19171939                }
    1918                 else
    1919                 {
    1920                         return SIMPLEPIE_CONSTRUCT_TEXT;
    1921                 }
     1940
     1941                return SIMPLEPIE_CONSTRUCT_TEXT;
    19221942        }
    19231943
    … …  
    19271947        }
    19281948
    1929         public static function space_seperated_tokens($string)
     1949        public static function space_separated_tokens($string)
    19301950        {
    19311951                $space_characters = "\x20\x09\x0A\x0B\x0C\x0D";
    … …  
    19761996                        return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
    19771997                }
    1978                 else
    1979                 {
    1980                         // U+FFFD REPLACEMENT CHARACTER
    1981                         return "\xEF\xBF\xBD";
    1982                 }
     1998
     1999                // U+FFFD REPLACEMENT CHARACTER
     2000                return "\xEF\xBF\xBD";
    19832001        }
    19842002
    … …  
    21842202                        return filemtime(dirname(__FILE__) . '/Core.php');
    21852203                }
    2186                 else
    2187                 {
    2188                         return filemtime(__FILE__);
    2189                 }
     2204
     2205                return filemtime(__FILE__);
    21902206        }
    21912207
    … …  
    22452261        }
    22462262}
    2247 
Note: See TracChangeset for help on using the changeset viewer.