diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-includes/SimplePie/Misc.php --- a/wp/wp-includes/SimplePie/Misc.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-includes/SimplePie/Misc.php Tue Dec 15 13:49:49 2020 +0100 @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,10 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3.1 - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License @@ -138,7 +137,7 @@ foreach ($element['attribs'] as $key => $value) { $key = strtolower($key); - $full .= " $key=\"" . htmlspecialchars($value['data']) . '"'; + $full .= " $key=\"" . htmlspecialchars($value['data'], ENT_COMPAT, 'UTF-8') . '"'; } if ($element['self_closing']) { @@ -218,10 +217,25 @@ { return substr_replace($url, 'itpc', 0, 4); } - else + + return $url; + } + + public static function array_merge_recursive($array1, $array2) + { + foreach ($array2 as $key => $value) { - return $url; + if (is_array($value)) + { + $array1[$key] = SimplePie_Misc::array_merge_recursive($array1[$key], $value); + } + else + { + $array1[$key] = $value; + } } + + return $array1; } public static function parse_url($url) @@ -260,10 +274,8 @@ { return chr($integer); } - else - { - return strtoupper($match[0]); - } + + return strtoupper($match[0]); } /** @@ -317,16 +329,19 @@ { return $return; } - // This is last, as behaviour of this varies with OS userland and PHP version + // This is third, as behaviour of this varies with OS userland and PHP version elseif (function_exists('iconv') && ($return = SimplePie_Misc::change_encoding_iconv($data, $input, $output))) { return $return; } - // If we can't do anything, just fail - else + // This is last, as behaviour of this varies with OS userland and PHP version + elseif (class_exists('\UConverter') && ($return = SimplePie_Misc::change_encoding_uconverter($data, $input, $output))) { - return false; + return $return; } + + // If we can't do anything, just fail + return false; } protected static function change_encoding_mbstring($data, $input, $output) @@ -373,6 +388,17 @@ } /** + * @param string $data + * @param string $input + * @param string $output + * @return string|false + */ + protected static function change_encoding_uconverter($data, $input, $output) + { + return @\UConverter::transcode($data, $output, $input); + } + + /** * Normalize an encoding name * * This is automatically generated by create.php @@ -1826,10 +1852,8 @@ { return trim($mime); } - else - { - return trim(substr($mime, 0, $pos)); - } + + return trim(substr($mime, 0, $pos)); } public static function atom_03_construct_type($attribs) @@ -1862,10 +1886,8 @@ return SIMPLEPIE_CONSTRUCT_NONE | $mode; } } - else - { - return SIMPLEPIE_CONSTRUCT_TEXT | $mode; - } + + return SIMPLEPIE_CONSTRUCT_TEXT | $mode; } public static function atom_10_construct_type($attribs) @@ -1915,10 +1937,8 @@ return SIMPLEPIE_CONSTRUCT_BASE64; } } - else - { - return SIMPLEPIE_CONSTRUCT_TEXT; - } + + return SIMPLEPIE_CONSTRUCT_TEXT; } public static function is_isegment_nz_nc($string) @@ -1926,7 +1946,7 @@ return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string); } - public static function space_seperated_tokens($string) + public static function space_separated_tokens($string) { $space_characters = "\x20\x09\x0A\x0B\x0C\x0D"; $string_length = strlen($string); @@ -1975,11 +1995,9 @@ { return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); } - else - { - // U+FFFD REPLACEMENT CHARACTER - return "\xEF\xBF\xBD"; - } + + // U+FFFD REPLACEMENT CHARACTER + return "\xEF\xBF\xBD"; } /** @@ -2183,10 +2201,8 @@ { return filemtime(dirname(__FILE__) . '/Core.php'); } - else - { - return filemtime(__FILE__); - } + + return filemtime(__FILE__); } /** @@ -2244,4 +2260,3 @@ // No-op } } -