Changeset 47733 for trunk/src/wp-includes/SimplePie/Misc.php
- Timestamp:
- 05/01/2020 02:24:42 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/SimplePie/Misc.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/SimplePie/Misc.php
r24589 r47733 6 6 * Takes the hard work out of managing a complete RSS/Atom solution. 7 7 * 8 * Copyright (c) 2004-201 2, Ryan Parman, GeoffreySneddon, Ryan McCue, and contributors8 * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors 9 9 * All rights reserved. 10 10 * … … 34 34 * 35 35 * @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 38 37 * @author Ryan Parman 39 * @author GeoffreySneddon38 * @author Sam Sneddon 40 39 * @author Ryan McCue 41 40 * @link http://simplepie.org/ SimplePie … … 139 138 { 140 139 $key = strtolower($key); 141 $full .= " $key=\"" . htmlspecialchars($value['data'] ) . '"';140 $full .= " $key=\"" . htmlspecialchars($value['data'], ENT_COMPAT, 'UTF-8') . '"'; 142 141 } 143 142 if ($element['self_closing']) … … 219 218 return substr_replace($url, 'itpc', 0, 4); 220 219 } 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; 225 239 } 226 240 … … 261 275 return chr($integer); 262 276 } 263 else 264 { 265 return strtoupper($match[0]); 266 } 277 278 return strtoupper($match[0]); 267 279 } 268 280 … … 318 330 return $return; 319 331 } 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 } 320 337 // 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))) 322 339 { 323 340 return $return; 324 341 } 342 325 343 // If we can't do anything, just fail 326 else 327 { 328 return false; 329 } 344 return false; 330 345 } 331 346 … … 371 386 { 372 387 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); 373 399 } 374 400 … … 1827 1853 return trim($mime); 1828 1854 } 1829 else 1830 { 1831 return trim(substr($mime, 0, $pos)); 1832 } 1855 1856 return trim(substr($mime, 0, $pos)); 1833 1857 } 1834 1858 … … 1863 1887 } 1864 1888 } 1865 else 1866 { 1867 return SIMPLEPIE_CONSTRUCT_TEXT | $mode; 1868 } 1889 1890 return SIMPLEPIE_CONSTRUCT_TEXT | $mode; 1869 1891 } 1870 1892 … … 1916 1938 } 1917 1939 } 1918 else 1919 { 1920 return SIMPLEPIE_CONSTRUCT_TEXT; 1921 } 1940 1941 return SIMPLEPIE_CONSTRUCT_TEXT; 1922 1942 } 1923 1943 … … 1927 1947 } 1928 1948 1929 public static function space_sep erated_tokens($string)1949 public static function space_separated_tokens($string) 1930 1950 { 1931 1951 $space_characters = "\x20\x09\x0A\x0B\x0C\x0D"; … … 1976 1996 return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); 1977 1997 } 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"; 1983 2001 } 1984 2002 … … 2184 2202 return filemtime(dirname(__FILE__) . '/Core.php'); 2185 2203 } 2186 else 2187 { 2188 return filemtime(__FILE__); 2189 } 2204 2205 return filemtime(__FILE__); 2190 2206 } 2191 2207 … … 2245 2261 } 2246 2262 } 2247
Note: See TracChangeset
for help on using the changeset viewer.