SimplePie_Misc

Miscellanous utilities.

Defined (1)

The class is defined in the following location(s).

/wp-includes/SimplePie/Misc.php  
  1. class SimplePie_Misc 
  2. public static function time_hms($seconds) 
  3. $time = ''; 
  4.  
  5. $hours = floor($seconds / 3600); 
  6. $remainder = $seconds % 3600; 
  7. if ($hours > 0) 
  8. $time .= $hours.':'; 
  9.  
  10. $minutes = floor($remainder / 60); 
  11. $seconds = $remainder % 60; 
  12. if ($minutes < 10 && $hours > 0) 
  13. $minutes = '0' . $minutes; 
  14. if ($seconds < 10) 
  15. $seconds = '0' . $seconds; 
  16.  
  17. $time .= $minutes.':'; 
  18. $time .= $seconds; 
  19.  
  20. return $time; 
  21.  
  22. public static function absolutize_url($relative, $base) 
  23. $iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative); 
  24. if ($iri === false) 
  25. return false; 
  26. return $iri->get_uri(); 
  27.  
  28. /** 
  29. * Get a HTML/XML element from a HTML string 
  30. * @deprecated Use DOMDocument instead (parsing HTML with regex is bad!) 
  31. * @param string $realname Element name (including namespace prefix if applicable) 
  32. * @param string $string HTML document 
  33. * @return array 
  34. */ 
  35. public static function get_element($realname, $string) 
  36. $return = array(); 
  37. $name = preg_quote($realname, '/'); 
  38. if (preg_match_all("/<($name)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) 
  39. for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++) 
  40. $return[$i]['tag'] = $realname; 
  41. $return[$i]['full'] = $matches[$i][0][0]; 
  42. $return[$i]['offset'] = $matches[$i][0][1]; 
  43. if (strlen($matches[$i][3][0]) <= 2) 
  44. $return[$i]['self_closing'] = true; 
  45. else 
  46. $return[$i]['self_closing'] = false; 
  47. $return[$i]['content'] = $matches[$i][4][0]; 
  48. $return[$i]['attribs'] = array(); 
  49. if (isset($matches[$i][2][0]) && preg_match_all('/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*)(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"([^"]*)"|\'([^\']*)\'|([^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?/', ' ' . $matches[$i][2][0] . ' ', $attribs, PREG_SET_ORDER)) 
  50. for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++) 
  51. if (count($attribs[$j]) === 2) 
  52. $attribs[$j][2] = $attribs[$j][1]; 
  53. $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j])); 
  54. return $return; 
  55.  
  56. public static function element_implode($element) 
  57. $full = "<$element[tag]"; 
  58. foreach ($element['attribs'] as $key => $value) 
  59. $key = strtolower($key); 
  60. $full .= " $key=\"" . htmlspecialchars($value['data']) . '"'; 
  61. if ($element['self_closing']) 
  62. $full .= ' />'; 
  63. else 
  64. $full .= ">$element[content]</$element[tag]>"; 
  65. return $full; 
  66.  
  67. public static function error($message, $level, $file, $line) 
  68. if ((ini_get('error_reporting') & $level) > 0) 
  69. switch ($level) 
  70. case E_USER_ERROR: 
  71. $note = 'PHP Error'; 
  72. break; 
  73. case E_USER_WARNING: 
  74. $note = 'PHP Warning'; 
  75. break; 
  76. case E_USER_NOTICE: 
  77. $note = 'PHP Notice'; 
  78. break; 
  79. default: 
  80. $note = 'Unknown Error'; 
  81. break; 
  82.  
  83. $log_error = true; 
  84. if (!function_exists('error_log')) 
  85. $log_error = false; 
  86.  
  87. $log_file = @ini_get('error_log'); 
  88. if (!empty($log_file) && ('syslog' !== $log_file) && !@is_writable($log_file)) 
  89. $log_error = false; 
  90.  
  91. if ($log_error) 
  92. @error_log("$note: $message in $file on line $line", 0); 
  93.  
  94. return $message; 
  95.  
  96. public static function fix_protocol($url, $http = 1) 
  97. $url = SimplePie_Misc::normalize_url($url); 
  98. $parsed = SimplePie_Misc::parse_url($url); 
  99. if ($parsed['scheme'] !== '' && $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https') 
  100. return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http); 
  101.  
  102. if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url)) 
  103. return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http); 
  104.  
  105. if ($http === 2 && $parsed['scheme'] !== '') 
  106. return "feed:$url"; 
  107. elseif ($http === 3 && strtolower($parsed['scheme']) === 'http') 
  108. return substr_replace($url, 'podcast', 0, 4); 
  109. elseif ($http === 4 && strtolower($parsed['scheme']) === 'http') 
  110. return substr_replace($url, 'itpc', 0, 4); 
  111. else 
  112. return $url; 
  113.  
  114. public static function parse_url($url) 
  115. $iri = new SimplePie_IRI($url); 
  116. return array( 
  117. 'scheme' => (string) $iri->scheme,  
  118. 'authority' => (string) $iri->authority,  
  119. 'path' => (string) $iri->path,  
  120. 'query' => (string) $iri->query,  
  121. 'fragment' => (string) $iri->fragment 
  122. ); 
  123.  
  124. public static function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '') 
  125. $iri = new SimplePie_IRI(''); 
  126. $iri->scheme = $scheme; 
  127. $iri->authority = $authority; 
  128. $iri->path = $path; 
  129. $iri->query = $query; 
  130. $iri->fragment = $fragment; 
  131. return $iri->get_uri(); 
  132.  
  133. public static function normalize_url($url) 
  134. $iri = new SimplePie_IRI($url); 
  135. return $iri->get_uri(); 
  136.  
  137. public static function percent_encoding_normalization($match) 
  138. $integer = hexdec($match[1]); 
  139. if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E) 
  140. return chr($integer); 
  141. else 
  142. return strtoupper($match[0]); 
  143.  
  144. /** 
  145. * Converts a Windows-1252 encoded string to a UTF-8 encoded string 
  146. * @static 
  147. * @param string $string Windows-1252 encoded string 
  148. * @return string UTF-8 encoded string 
  149. */ 
  150. public static function windows_1252_to_utf8($string) 
  151. static $convert_table = array("\x80" => "\xE2\x82\xAC", "\x81" => "\xEF\xBF\xBD", "\x82" => "\xE2\x80\x9A", "\x83" => "\xC6\x92", "\x84" => "\xE2\x80\x9E", "\x85" => "\xE2\x80\xA6", "\x86" => "\xE2\x80\xA0", "\x87" => "\xE2\x80\xA1", "\x88" => "\xCB\x86", "\x89" => "\xE2\x80\xB0", "\x8A" => "\xC5\xA0", "\x8B" => "\xE2\x80\xB9", "\x8C" => "\xC5\x92", "\x8D" => "\xEF\xBF\xBD", "\x8E" => "\xC5\xBD", "\x8F" => "\xEF\xBF\xBD", "\x90" => "\xEF\xBF\xBD", "\x91" => "\xE2\x80\x98", "\x92" => "\xE2\x80\x99", "\x93" => "\xE2\x80\x9C", "\x94" => "\xE2\x80\x9D", "\x95" => "\xE2\x80\xA2", "\x96" => "\xE2\x80\x93", "\x97" => "\xE2\x80\x94", "\x98" => "\xCB\x9C", "\x99" => "\xE2\x84\xA2", "\x9A" => "\xC5\xA1", "\x9B" => "\xE2\x80\xBA", "\x9C" => "\xC5\x93", "\x9D" => "\xEF\xBF\xBD", "\x9E" => "\xC5\xBE", "\x9F" => "\xC5\xB8", "\xA0" => "\xC2\xA0", "\xA1" => "\xC2\xA1", "\xA2" => "\xC2\xA2", "\xA3" => "\xC2\xA3", "\xA4" => "\xC2\xA4", "\xA5" => "\xC2\xA5", "\xA6" => "\xC2\xA6", "\xA7" => "\xC2\xA7", "\xA8" => "\xC2\xA8", "\xA9" => "\xC2\xA9", "\xAA" => "\xC2\xAA", "\xAB" => "\xC2\xAB", "\xAC" => "\xC2\xAC", "\xAD" => "\xC2\xAD", "\xAE" => "\xC2\xAE", "\xAF" => "\xC2\xAF", "\xB0" => "\xC2\xB0", "\xB1" => "\xC2\xB1", "\xB2" => "\xC2\xB2", "\xB3" => "\xC2\xB3", "\xB4" => "\xC2\xB4", "\xB5" => "\xC2\xB5", "\xB6" => "\xC2\xB6", "\xB7" => "\xC2\xB7", "\xB8" => "\xC2\xB8", "\xB9" => "\xC2\xB9", "\xBA" => "\xC2\xBA", "\xBB" => "\xC2\xBB", "\xBC" => "\xC2\xBC", "\xBD" => "\xC2\xBD", "\xBE" => "\xC2\xBE", "\xBF" => "\xC2\xBF", "\xC0" => "\xC3\x80", "\xC1" => "\xC3\x81", "\xC2" => "\xC3\x82", "\xC3" => "\xC3\x83", "\xC4" => "\xC3\x84", "\xC5" => "\xC3\x85", "\xC6" => "\xC3\x86", "\xC7" => "\xC3\x87", "\xC8" => "\xC3\x88", "\xC9" => "\xC3\x89", "\xCA" => "\xC3\x8A", "\xCB" => "\xC3\x8B", "\xCC" => "\xC3\x8C", "\xCD" => "\xC3\x8D", "\xCE" => "\xC3\x8E", "\xCF" => "\xC3\x8F", "\xD0" => "\xC3\x90", "\xD1" => "\xC3\x91", "\xD2" => "\xC3\x92", "\xD3" => "\xC3\x93", "\xD4" => "\xC3\x94", "\xD5" => "\xC3\x95", "\xD6" => "\xC3\x96", "\xD7" => "\xC3\x97", "\xD8" => "\xC3\x98", "\xD9" => "\xC3\x99", "\xDA" => "\xC3\x9A", "\xDB" => "\xC3\x9B", "\xDC" => "\xC3\x9C", "\xDD" => "\xC3\x9D", "\xDE" => "\xC3\x9E", "\xDF" => "\xC3\x9F", "\xE0" => "\xC3\xA0", "\xE1" => "\xC3\xA1", "\xE2" => "\xC3\xA2", "\xE3" => "\xC3\xA3", "\xE4" => "\xC3\xA4", "\xE5" => "\xC3\xA5", "\xE6" => "\xC3\xA6", "\xE7" => "\xC3\xA7", "\xE8" => "\xC3\xA8", "\xE9" => "\xC3\xA9", "\xEA" => "\xC3\xAA", "\xEB" => "\xC3\xAB", "\xEC" => "\xC3\xAC", "\xED" => "\xC3\xAD", "\xEE" => "\xC3\xAE", "\xEF" => "\xC3\xAF", "\xF0" => "\xC3\xB0", "\xF1" => "\xC3\xB1", "\xF2" => "\xC3\xB2", "\xF3" => "\xC3\xB3", "\xF4" => "\xC3\xB4", "\xF5" => "\xC3\xB5", "\xF6" => "\xC3\xB6", "\xF7" => "\xC3\xB7", "\xF8" => "\xC3\xB8", "\xF9" => "\xC3\xB9", "\xFA" => "\xC3\xBA", "\xFB" => "\xC3\xBB", "\xFC" => "\xC3\xBC", "\xFD" => "\xC3\xBD", "\xFE" => "\xC3\xBE", "\xFF" => "\xC3\xBF"); 
  152.  
  153. return strtr($string, $convert_table); 
  154.  
  155. /** 
  156. * Change a string from one encoding to another 
  157. * @param string $data Raw data in $input encoding 
  158. * @param string $input Encoding of $data 
  159. * @param string $output Encoding you want 
  160. * @return string|boolean False if we can't convert it 
  161. */ 
  162. public static function change_encoding($data, $input, $output) 
  163. $input = SimplePie_Misc::encoding($input); 
  164. $output = SimplePie_Misc::encoding($output); 
  165.  
  166. // We fail to fail on non US-ASCII bytes 
  167. if ($input === 'US-ASCII') 
  168. static $non_ascii_octects = ''; 
  169. if (!$non_ascii_octects) 
  170. for ($i = 0x80; $i <= 0xFF; $i++) 
  171. $non_ascii_octects .= chr($i); 
  172. $data = substr($data, 0, strcspn($data, $non_ascii_octects)); 
  173.  
  174. // This is first, as behaviour of this is completely predictable 
  175. if ($input === 'windows-1252' && $output === 'UTF-8') 
  176. return SimplePie_Misc::windows_1252_to_utf8($data); 
  177. // This is second, as behaviour of this varies only with PHP version (the middle part of this expression checks the encoding is supported). 
  178. elseif (function_exists('mb_convert_encoding') && ($return = SimplePie_Misc::change_encoding_mbstring($data, $input, $output))) 
  179. return $return; 
  180. // This is last, as behaviour of this varies with OS userland and PHP version 
  181. elseif (function_exists('iconv') && ($return = SimplePie_Misc::change_encoding_iconv($data, $input, $output))) 
  182. return $return; 
  183. // If we can't do anything, just fail 
  184. else 
  185. return false; 
  186.  
  187. protected static function change_encoding_mbstring($data, $input, $output) 
  188. if ($input === 'windows-949') 
  189. $input = 'EUC-KR'; 
  190. if ($output === 'windows-949') 
  191. $output = 'EUC-KR'; 
  192. if ($input === 'Windows-31J') 
  193. $input = 'SJIS'; 
  194. if ($output === 'Windows-31J') 
  195. $output = 'SJIS'; 
  196.  
  197. // Check that the encoding is supported 
  198. if (@mb_convert_encoding("\x80", 'UTF-16BE', $input) === "\x00\x80") 
  199. return false; 
  200. if (!in_array($input, mb_list_encodings())) 
  201. return false; 
  202.  
  203. // Let's do some conversion 
  204. if ($return = @mb_convert_encoding($data, $output, $input)) 
  205. return $return; 
  206.  
  207. return false; 
  208.  
  209. protected static function change_encoding_iconv($data, $input, $output) 
  210. return @iconv($input, $output, $data); 
  211.  
  212. /** 
  213. * Normalize an encoding name 
  214. * This is automatically generated by create.php 
  215. * To generate it, run `php create.php` on the command line, and copy the 
  216. * output to replace this function. 
  217. * @param string $charset Character set to standardise 
  218. * @return string Standardised name 
  219. */ 
  220. public static function encoding($charset) 
  221. // Normalization from UTS #22 
  222. switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset))) 
  223. case 'adobestandardencoding': 
  224. case 'csadobestandardencoding': 
  225. return 'Adobe-Standard-Encoding'; 
  226.  
  227. case 'adobesymbolencoding': 
  228. case 'cshppsmath': 
  229. return 'Adobe-Symbol-Encoding'; 
  230.  
  231. case 'ami1251': 
  232. case 'amiga1251': 
  233. return 'Amiga-1251'; 
  234.  
  235. case 'ansix31101983': 
  236. case 'csat5001983': 
  237. case 'csiso99naplps': 
  238. case 'isoir99': 
  239. case 'naplps': 
  240. return 'ANSI_X3.110-1983'; 
  241.  
  242. case 'arabic7': 
  243. case 'asmo449': 
  244. case 'csiso89asmo449': 
  245. case 'iso9036': 
  246. case 'isoir89': 
  247. return 'ASMO_449'; 
  248.  
  249. case 'big5': 
  250. case 'csbig5': 
  251. return 'Big5'; 
  252.  
  253. case 'big5hkscs': 
  254. return 'Big5-HKSCS'; 
  255.  
  256. case 'bocu1': 
  257. case 'csbocu1': 
  258. return 'BOCU-1'; 
  259.  
  260. case 'brf': 
  261. case 'csbrf': 
  262. return 'BRF'; 
  263.  
  264. case 'bs4730': 
  265. case 'csiso4unitedkingdom': 
  266. case 'gb': 
  267. case 'iso646gb': 
  268. case 'isoir4': 
  269. case 'uk': 
  270. return 'BS_4730'; 
  271.  
  272. case 'bsviewdata': 
  273. case 'csiso47bsviewdata': 
  274. case 'isoir47': 
  275. return 'BS_viewdata'; 
  276.  
  277. case 'cesu8': 
  278. case 'cscesu8': 
  279. return 'CESU-8'; 
  280.  
  281. case 'ca': 
  282. case 'csa71': 
  283. case 'csaz243419851': 
  284. case 'csiso121canadian1': 
  285. case 'iso646ca': 
  286. case 'isoir121': 
  287. return 'CSA_Z243.4-1985-1'; 
  288.  
  289. case 'csa72': 
  290. case 'csaz243419852': 
  291. case 'csiso122canadian2': 
  292. case 'iso646ca2': 
  293. case 'isoir122': 
  294. return 'CSA_Z243.4-1985-2'; 
  295.  
  296. case 'csaz24341985gr': 
  297. case 'csiso123csaz24341985gr': 
  298. case 'isoir123': 
  299. return 'CSA_Z243.4-1985-gr'; 
  300.  
  301. case 'csiso139csn369103': 
  302. case 'csn369103': 
  303. case 'isoir139': 
  304. return 'CSN_369103'; 
  305.  
  306. case 'csdecmcs': 
  307. case 'dec': 
  308. case 'decmcs': 
  309. return 'DEC-MCS'; 
  310.  
  311. case 'csiso21german': 
  312. case 'de': 
  313. case 'din66003': 
  314. case 'iso646de': 
  315. case 'isoir21': 
  316. return 'DIN_66003'; 
  317.  
  318. case 'csdkus': 
  319. case 'dkus': 
  320. return 'dk-us'; 
  321.  
  322. case 'csiso646danish': 
  323. case 'dk': 
  324. case 'ds2089': 
  325. case 'iso646dk': 
  326. return 'DS_2089'; 
  327.  
  328. case 'csibmebcdicatde': 
  329. case 'ebcdicatde': 
  330. return 'EBCDIC-AT-DE'; 
  331.  
  332. case 'csebcdicatdea': 
  333. case 'ebcdicatdea': 
  334. return 'EBCDIC-AT-DE-A'; 
  335.  
  336. case 'csebcdiccafr': 
  337. case 'ebcdiccafr': 
  338. return 'EBCDIC-CA-FR'; 
  339.  
  340. case 'csebcdicdkno': 
  341. case 'ebcdicdkno': 
  342. return 'EBCDIC-DK-NO'; 
  343.  
  344. case 'csebcdicdknoa': 
  345. case 'ebcdicdknoa': 
  346. return 'EBCDIC-DK-NO-A'; 
  347.  
  348. case 'csebcdices': 
  349. case 'ebcdices': 
  350. return 'EBCDIC-ES'; 
  351.  
  352. case 'csebcdicesa': 
  353. case 'ebcdicesa': 
  354. return 'EBCDIC-ES-A'; 
  355.  
  356. case 'csebcdicess': 
  357. case 'ebcdicess': 
  358. return 'EBCDIC-ES-S'; 
  359.  
  360. case 'csebcdicfise': 
  361. case 'ebcdicfise': 
  362. return 'EBCDIC-FI-SE'; 
  363.  
  364. case 'csebcdicfisea': 
  365. case 'ebcdicfisea': 
  366. return 'EBCDIC-FI-SE-A'; 
  367.  
  368. case 'csebcdicfr': 
  369. case 'ebcdicfr': 
  370. return 'EBCDIC-FR'; 
  371.  
  372. case 'csebcdicit': 
  373. case 'ebcdicit': 
  374. return 'EBCDIC-IT'; 
  375.  
  376. case 'csebcdicpt': 
  377. case 'ebcdicpt': 
  378. return 'EBCDIC-PT'; 
  379.  
  380. case 'csebcdicuk': 
  381. case 'ebcdicuk': 
  382. return 'EBCDIC-UK'; 
  383.  
  384. case 'csebcdicus': 
  385. case 'ebcdicus': 
  386. return 'EBCDIC-US'; 
  387.  
  388. case 'csiso111ecmacyrillic': 
  389. case 'ecmacyrillic': 
  390. case 'isoir111': 
  391. case 'koi8e': 
  392. return 'ECMA-cyrillic'; 
  393.  
  394. case 'csiso17spanish': 
  395. case 'es': 
  396. case 'iso646es': 
  397. case 'isoir17': 
  398. return 'ES'; 
  399.  
  400. case 'csiso85spanish2': 
  401. case 'es2': 
  402. case 'iso646es2': 
  403. case 'isoir85': 
  404. return 'ES2'; 
  405.  
  406. case 'cseucpkdfmtjapanese': 
  407. case 'eucjp': 
  408. case 'extendedunixcodepackedformatforjapanese': 
  409. return 'EUC-JP'; 
  410.  
  411. case 'cseucfixwidjapanese': 
  412. case 'extendedunixcodefixedwidthforjapanese': 
  413. return 'Extended_UNIX_Code_Fixed_Width_for_Japanese'; 
  414.  
  415. case 'gb18030': 
  416. return 'GB18030'; 
  417.  
  418. case 'chinese': 
  419. case 'cp936': 
  420. case 'csgb2312': 
  421. case 'csiso58gb231280': 
  422. case 'gb2312': 
  423. case 'gb231280': 
  424. case 'gbk': 
  425. case 'isoir58': 
  426. case 'ms936': 
  427. case 'windows936': 
  428. return 'GBK'; 
  429.  
  430. case 'cn': 
  431. case 'csiso57gb1988': 
  432. case 'gb198880': 
  433. case 'iso646cn': 
  434. case 'isoir57': 
  435. return 'GB_1988-80'; 
  436.  
  437. case 'csiso153gost1976874': 
  438. case 'gost1976874': 
  439. case 'isoir153': 
  440. case 'stsev35888': 
  441. return 'GOST_19768-74'; 
  442.  
  443. case 'csiso150': 
  444. case 'csiso150greekccitt': 
  445. case 'greekccitt': 
  446. case 'isoir150': 
  447. return 'greek-ccitt'; 
  448.  
  449. case 'csiso88greek7': 
  450. case 'greek7': 
  451. case 'isoir88': 
  452. return 'greek7'; 
  453.  
  454. case 'csiso18greek7old': 
  455. case 'greek7old': 
  456. case 'isoir18': 
  457. return 'greek7-old'; 
  458.  
  459. case 'cshpdesktop': 
  460. case 'hpdesktop': 
  461. return 'HP-DeskTop'; 
  462.  
  463. case 'cshplegal': 
  464. case 'hplegal': 
  465. return 'HP-Legal'; 
  466.  
  467. case 'cshpmath8': 
  468. case 'hpmath8': 
  469. return 'HP-Math8'; 
  470.  
  471. case 'cshppifont': 
  472. case 'hppifont': 
  473. return 'HP-Pi-font'; 
  474.  
  475. case 'cshproman8': 
  476. case 'hproman8': 
  477. case 'r8': 
  478. case 'roman8': 
  479. return 'hp-roman8'; 
  480.  
  481. case 'hzgb2312': 
  482. return 'HZ-GB-2312'; 
  483.  
  484. case 'csibmsymbols': 
  485. case 'ibmsymbols': 
  486. return 'IBM-Symbols'; 
  487.  
  488. case 'csibmthai': 
  489. case 'ibmthai': 
  490. return 'IBM-Thai'; 
  491.  
  492. case 'cp37': 
  493. case 'csibm37': 
  494. case 'ebcdiccpca': 
  495. case 'ebcdiccpnl': 
  496. case 'ebcdiccpus': 
  497. case 'ebcdiccpwt': 
  498. case 'ibm37': 
  499. return 'IBM037'; 
  500.  
  501. case 'cp38': 
  502. case 'csibm38': 
  503. case 'ebcdicint': 
  504. case 'ibm38': 
  505. return 'IBM038'; 
  506.  
  507. case 'cp273': 
  508. case 'csibm273': 
  509. case 'ibm273': 
  510. return 'IBM273'; 
  511.  
  512. case 'cp274': 
  513. case 'csibm274': 
  514. case 'ebcdicbe': 
  515. case 'ibm274': 
  516. return 'IBM274'; 
  517.  
  518. case 'cp275': 
  519. case 'csibm275': 
  520. case 'ebcdicbr': 
  521. case 'ibm275': 
  522. return 'IBM275'; 
  523.  
  524. case 'csibm277': 
  525. case 'ebcdiccpdk': 
  526. case 'ebcdiccpno': 
  527. case 'ibm277': 
  528. return 'IBM277'; 
  529.  
  530. case 'cp278': 
  531. case 'csibm278': 
  532. case 'ebcdiccpfi': 
  533. case 'ebcdiccpse': 
  534. case 'ibm278': 
  535. return 'IBM278'; 
  536.  
  537. case 'cp280': 
  538. case 'csibm280': 
  539. case 'ebcdiccpit': 
  540. case 'ibm280': 
  541. return 'IBM280'; 
  542.  
  543. case 'cp281': 
  544. case 'csibm281': 
  545. case 'ebcdicjpe': 
  546. case 'ibm281': 
  547. return 'IBM281'; 
  548.  
  549. case 'cp284': 
  550. case 'csibm284': 
  551. case 'ebcdiccpes': 
  552. case 'ibm284': 
  553. return 'IBM284'; 
  554.  
  555. case 'cp285': 
  556. case 'csibm285': 
  557. case 'ebcdiccpgb': 
  558. case 'ibm285': 
  559. return 'IBM285'; 
  560.  
  561. case 'cp290': 
  562. case 'csibm290': 
  563. case 'ebcdicjpkana': 
  564. case 'ibm290': 
  565. return 'IBM290'; 
  566.  
  567. case 'cp297': 
  568. case 'csibm297': 
  569. case 'ebcdiccpfr': 
  570. case 'ibm297': 
  571. return 'IBM297'; 
  572.  
  573. case 'cp420': 
  574. case 'csibm420': 
  575. case 'ebcdiccpar1': 
  576. case 'ibm420': 
  577. return 'IBM420'; 
  578.  
  579. case 'cp423': 
  580. case 'csibm423': 
  581. case 'ebcdiccpgr': 
  582. case 'ibm423': 
  583. return 'IBM423'; 
  584.  
  585. case 'cp424': 
  586. case 'csibm424': 
  587. case 'ebcdiccphe': 
  588. case 'ibm424': 
  589. return 'IBM424'; 
  590.  
  591. case '437': 
  592. case 'cp437': 
  593. case 'cspc8codepage437': 
  594. case 'ibm437': 
  595. return 'IBM437'; 
  596.  
  597. case 'cp500': 
  598. case 'csibm500': 
  599. case 'ebcdiccpbe': 
  600. case 'ebcdiccpch': 
  601. case 'ibm500': 
  602. return 'IBM500'; 
  603.  
  604. case 'cp775': 
  605. case 'cspc775baltic': 
  606. case 'ibm775': 
  607. return 'IBM775'; 
  608.  
  609. case '850': 
  610. case 'cp850': 
  611. case 'cspc850multilingual': 
  612. case 'ibm850': 
  613. return 'IBM850'; 
  614.  
  615. case '851': 
  616. case 'cp851': 
  617. case 'csibm851': 
  618. case 'ibm851': 
  619. return 'IBM851'; 
  620.  
  621. case '852': 
  622. case 'cp852': 
  623. case 'cspcp852': 
  624. case 'ibm852': 
  625. return 'IBM852'; 
  626.  
  627. case '855': 
  628. case 'cp855': 
  629. case 'csibm855': 
  630. case 'ibm855': 
  631. return 'IBM855'; 
  632.  
  633. case '857': 
  634. case 'cp857': 
  635. case 'csibm857': 
  636. case 'ibm857': 
  637. return 'IBM857'; 
  638.  
  639. case 'ccsid858': 
  640. case 'cp858': 
  641. case 'ibm858': 
  642. case 'pcmultilingual850euro': 
  643. return 'IBM00858'; 
  644.  
  645. case '860': 
  646. case 'cp860': 
  647. case 'csibm860': 
  648. case 'ibm860': 
  649. return 'IBM860'; 
  650.  
  651. case '861': 
  652. case 'cp861': 
  653. case 'cpis': 
  654. case 'csibm861': 
  655. case 'ibm861': 
  656. return 'IBM861'; 
  657.  
  658. case '862': 
  659. case 'cp862': 
  660. case 'cspc862latinhebrew': 
  661. case 'ibm862': 
  662. return 'IBM862'; 
  663.  
  664. case '863': 
  665. case 'cp863': 
  666. case 'csibm863': 
  667. case 'ibm863': 
  668. return 'IBM863'; 
  669.  
  670. case 'cp864': 
  671. case 'csibm864': 
  672. case 'ibm864': 
  673. return 'IBM864'; 
  674.  
  675. case '865': 
  676. case 'cp865': 
  677. case 'csibm865': 
  678. case 'ibm865': 
  679. return 'IBM865'; 
  680.  
  681. case '866': 
  682. case 'cp866': 
  683. case 'csibm866': 
  684. case 'ibm866': 
  685. return 'IBM866'; 
  686.  
  687. case 'cp868': 
  688. case 'cpar': 
  689. case 'csibm868': 
  690. case 'ibm868': 
  691. return 'IBM868'; 
  692.  
  693. case '869': 
  694. case 'cp869': 
  695. case 'cpgr': 
  696. case 'csibm869': 
  697. case 'ibm869': 
  698. return 'IBM869'; 
  699.  
  700. case 'cp870': 
  701. case 'csibm870': 
  702. case 'ebcdiccproece': 
  703. case 'ebcdiccpyu': 
  704. case 'ibm870': 
  705. return 'IBM870'; 
  706.  
  707. case 'cp871': 
  708. case 'csibm871': 
  709. case 'ebcdiccpis': 
  710. case 'ibm871': 
  711. return 'IBM871'; 
  712.  
  713. case 'cp880': 
  714. case 'csibm880': 
  715. case 'ebcdiccyrillic': 
  716. case 'ibm880': 
  717. return 'IBM880'; 
  718.  
  719. case 'cp891': 
  720. case 'csibm891': 
  721. case 'ibm891': 
  722. return 'IBM891'; 
  723.  
  724. case 'cp903': 
  725. case 'csibm903': 
  726. case 'ibm903': 
  727. return 'IBM903'; 
  728.  
  729. case '904': 
  730. case 'cp904': 
  731. case 'csibbm904': 
  732. case 'ibm904': 
  733. return 'IBM904'; 
  734.  
  735. case 'cp905': 
  736. case 'csibm905': 
  737. case 'ebcdiccptr': 
  738. case 'ibm905': 
  739. return 'IBM905'; 
  740.  
  741. case 'cp918': 
  742. case 'csibm918': 
  743. case 'ebcdiccpar2': 
  744. case 'ibm918': 
  745. return 'IBM918'; 
  746.  
  747. case 'ccsid924': 
  748. case 'cp924': 
  749. case 'ebcdiclatin9euro': 
  750. case 'ibm924': 
  751. return 'IBM00924'; 
  752.  
  753. case 'cp1026': 
  754. case 'csibm1026': 
  755. case 'ibm1026': 
  756. return 'IBM1026'; 
  757.  
  758. case 'ibm1047': 
  759. return 'IBM1047'; 
  760.  
  761. case 'ccsid1140': 
  762. case 'cp1140': 
  763. case 'ebcdicus37euro': 
  764. case 'ibm1140': 
  765. return 'IBM01140'; 
  766.  
  767. case 'ccsid1141': 
  768. case 'cp1141': 
  769. case 'ebcdicde273euro': 
  770. case 'ibm1141': 
  771. return 'IBM01141'; 
  772.  
  773. case 'ccsid1142': 
  774. case 'cp1142': 
  775. case 'ebcdicdk277euro': 
  776. case 'ebcdicno277euro': 
  777. case 'ibm1142': 
  778. return 'IBM01142'; 
  779.  
  780. case 'ccsid1143': 
  781. case 'cp1143': 
  782. case 'ebcdicfi278euro': 
  783. case 'ebcdicse278euro': 
  784. case 'ibm1143': 
  785. return 'IBM01143'; 
  786.  
  787. case 'ccsid1144': 
  788. case 'cp1144': 
  789. case 'ebcdicit280euro': 
  790. case 'ibm1144': 
  791. return 'IBM01144'; 
  792.  
  793. case 'ccsid1145': 
  794. case 'cp1145': 
  795. case 'ebcdices284euro': 
  796. case 'ibm1145': 
  797. return 'IBM01145'; 
  798.  
  799. case 'ccsid1146': 
  800. case 'cp1146': 
  801. case 'ebcdicgb285euro': 
  802. case 'ibm1146': 
  803. return 'IBM01146'; 
  804.  
  805. case 'ccsid1147': 
  806. case 'cp1147': 
  807. case 'ebcdicfr297euro': 
  808. case 'ibm1147': 
  809. return 'IBM01147'; 
  810.  
  811. case 'ccsid1148': 
  812. case 'cp1148': 
  813. case 'ebcdicinternational500euro': 
  814. case 'ibm1148': 
  815. return 'IBM01148'; 
  816.  
  817. case 'ccsid1149': 
  818. case 'cp1149': 
  819. case 'ebcdicis871euro': 
  820. case 'ibm1149': 
  821. return 'IBM01149'; 
  822.  
  823. case 'csiso143iecp271': 
  824. case 'iecp271': 
  825. case 'isoir143': 
  826. return 'IEC_P27-1'; 
  827.  
  828. case 'csiso49inis': 
  829. case 'inis': 
  830. case 'isoir49': 
  831. return 'INIS'; 
  832.  
  833. case 'csiso50inis8': 
  834. case 'inis8': 
  835. case 'isoir50': 
  836. return 'INIS-8'; 
  837.  
  838. case 'csiso51iniscyrillic': 
  839. case 'iniscyrillic': 
  840. case 'isoir51': 
  841. return 'INIS-cyrillic'; 
  842.  
  843. case 'csinvariant': 
  844. case 'invariant': 
  845. return 'INVARIANT'; 
  846.  
  847. case 'iso2022cn': 
  848. return 'ISO-2022-CN'; 
  849.  
  850. case 'iso2022cnext': 
  851. return 'ISO-2022-CN-EXT'; 
  852.  
  853. case 'csiso2022jp': 
  854. case 'iso2022jp': 
  855. return 'ISO-2022-JP'; 
  856.  
  857. case 'csiso2022jp2': 
  858. case 'iso2022jp2': 
  859. return 'ISO-2022-JP-2'; 
  860.  
  861. case 'csiso2022kr': 
  862. case 'iso2022kr': 
  863. return 'ISO-2022-KR'; 
  864.  
  865. case 'cswindows30latin1': 
  866. case 'iso88591windows30latin1': 
  867. return 'ISO-8859-1-Windows-3.0-Latin-1'; 
  868.  
  869. case 'cswindows31latin1': 
  870. case 'iso88591windows31latin1': 
  871. return 'ISO-8859-1-Windows-3.1-Latin-1'; 
  872.  
  873. case 'csisolatin2': 
  874. case 'iso88592': 
  875. case 'iso885921987': 
  876. case 'isoir101': 
  877. case 'l2': 
  878. case 'latin2': 
  879. return 'ISO-8859-2'; 
  880.  
  881. case 'cswindows31latin2': 
  882. case 'iso88592windowslatin2': 
  883. return 'ISO-8859-2-Windows-Latin-2'; 
  884.  
  885. case 'csisolatin3': 
  886. case 'iso88593': 
  887. case 'iso885931988': 
  888. case 'isoir109': 
  889. case 'l3': 
  890. case 'latin3': 
  891. return 'ISO-8859-3'; 
  892.  
  893. case 'csisolatin4': 
  894. case 'iso88594': 
  895. case 'iso885941988': 
  896. case 'isoir110': 
  897. case 'l4': 
  898. case 'latin4': 
  899. return 'ISO-8859-4'; 
  900.  
  901. case 'csisolatincyrillic': 
  902. case 'cyrillic': 
  903. case 'iso88595': 
  904. case 'iso885951988': 
  905. case 'isoir144': 
  906. return 'ISO-8859-5'; 
  907.  
  908. case 'arabic': 
  909. case 'asmo708': 
  910. case 'csisolatinarabic': 
  911. case 'ecma114': 
  912. case 'iso88596': 
  913. case 'iso885961987': 
  914. case 'isoir127': 
  915. return 'ISO-8859-6'; 
  916.  
  917. case 'csiso88596e': 
  918. case 'iso88596e': 
  919. return 'ISO-8859-6-E'; 
  920.  
  921. case 'csiso88596i': 
  922. case 'iso88596i': 
  923. return 'ISO-8859-6-I'; 
  924.  
  925. case 'csisolatingreek': 
  926. case 'ecma118': 
  927. case 'elot928': 
  928. case 'greek': 
  929. case 'greek8': 
  930. case 'iso88597': 
  931. case 'iso885971987': 
  932. case 'isoir126': 
  933. return 'ISO-8859-7'; 
  934.  
  935. case 'csisolatinhebrew': 
  936. case 'hebrew': 
  937. case 'iso88598': 
  938. case 'iso885981988': 
  939. case 'isoir138': 
  940. return 'ISO-8859-8'; 
  941.  
  942. case 'csiso88598e': 
  943. case 'iso88598e': 
  944. return 'ISO-8859-8-E'; 
  945.  
  946. case 'csiso88598i': 
  947. case 'iso88598i': 
  948. return 'ISO-8859-8-I'; 
  949.  
  950. case 'cswindows31latin5': 
  951. case 'iso88599windowslatin5': 
  952. return 'ISO-8859-9-Windows-Latin-5'; 
  953.  
  954. case 'csisolatin6': 
  955. case 'iso885910': 
  956. case 'iso8859101992': 
  957. case 'isoir157': 
  958. case 'l6': 
  959. case 'latin6': 
  960. return 'ISO-8859-10'; 
  961.  
  962. case 'iso885913': 
  963. return 'ISO-8859-13'; 
  964.  
  965. case 'iso885914': 
  966. case 'iso8859141998': 
  967. case 'isoceltic': 
  968. case 'isoir199': 
  969. case 'l8': 
  970. case 'latin8': 
  971. return 'ISO-8859-14'; 
  972.  
  973. case 'iso885915': 
  974. case 'latin9': 
  975. return 'ISO-8859-15'; 
  976.  
  977. case 'iso885916': 
  978. case 'iso8859162001': 
  979. case 'isoir226': 
  980. case 'l10': 
  981. case 'latin10': 
  982. return 'ISO-8859-16'; 
  983.  
  984. case 'iso10646j1': 
  985. return 'ISO-10646-J-1'; 
  986.  
  987. case 'csunicode': 
  988. case 'iso10646ucs2': 
  989. return 'ISO-10646-UCS-2'; 
  990.  
  991. case 'csucs4': 
  992. case 'iso10646ucs4': 
  993. return 'ISO-10646-UCS-4'; 
  994.  
  995. case 'csunicodeascii': 
  996. case 'iso10646ucsbasic': 
  997. return 'ISO-10646-UCS-Basic'; 
  998.  
  999. case 'csunicodelatin1': 
  1000. case 'iso10646': 
  1001. case 'iso10646unicodelatin1': 
  1002. return 'ISO-10646-Unicode-Latin1'; 
  1003.  
  1004. case 'csiso10646utf1': 
  1005. case 'iso10646utf1': 
  1006. return 'ISO-10646-UTF-1'; 
  1007.  
  1008. case 'csiso115481': 
  1009. case 'iso115481': 
  1010. case 'isotr115481': 
  1011. return 'ISO-11548-1'; 
  1012.  
  1013. case 'csiso90': 
  1014. case 'isoir90': 
  1015. return 'iso-ir-90'; 
  1016.  
  1017. case 'csunicodeibm1261': 
  1018. case 'isounicodeibm1261': 
  1019. return 'ISO-Unicode-IBM-1261'; 
  1020.  
  1021. case 'csunicodeibm1264': 
  1022. case 'isounicodeibm1264': 
  1023. return 'ISO-Unicode-IBM-1264'; 
  1024.  
  1025. case 'csunicodeibm1265': 
  1026. case 'isounicodeibm1265': 
  1027. return 'ISO-Unicode-IBM-1265'; 
  1028.  
  1029. case 'csunicodeibm1268': 
  1030. case 'isounicodeibm1268': 
  1031. return 'ISO-Unicode-IBM-1268'; 
  1032.  
  1033. case 'csunicodeibm1276': 
  1034. case 'isounicodeibm1276': 
  1035. return 'ISO-Unicode-IBM-1276'; 
  1036.  
  1037. case 'csiso646basic1983': 
  1038. case 'iso646basic1983': 
  1039. case 'ref': 
  1040. return 'ISO_646.basic:1983'; 
  1041.  
  1042. case 'csiso2intlrefversion': 
  1043. case 'irv': 
  1044. case 'iso646irv1983': 
  1045. case 'isoir2': 
  1046. return 'ISO_646.irv:1983'; 
  1047.  
  1048. case 'csiso2033': 
  1049. case 'e13b': 
  1050. case 'iso20331983': 
  1051. case 'isoir98': 
  1052. return 'ISO_2033-1983'; 
  1053.  
  1054. case 'csiso5427cyrillic': 
  1055. case 'iso5427': 
  1056. case 'isoir37': 
  1057. return 'ISO_5427'; 
  1058.  
  1059. case 'iso5427cyrillic1981': 
  1060. case 'iso54271981': 
  1061. case 'isoir54': 
  1062. return 'ISO_5427:1981'; 
  1063.  
  1064. case 'csiso5428greek': 
  1065. case 'iso54281980': 
  1066. case 'isoir55': 
  1067. return 'ISO_5428:1980'; 
  1068.  
  1069. case 'csiso6937add': 
  1070. case 'iso6937225': 
  1071. case 'isoir152': 
  1072. return 'ISO_6937-2-25'; 
  1073.  
  1074. case 'csisotextcomm': 
  1075. case 'iso69372add': 
  1076. case 'isoir142': 
  1077. return 'ISO_6937-2-add'; 
  1078.  
  1079. case 'csiso8859supp': 
  1080. case 'iso8859supp': 
  1081. case 'isoir154': 
  1082. case 'latin125': 
  1083. return 'ISO_8859-supp'; 
  1084.  
  1085. case 'csiso10367box': 
  1086. case 'iso10367box': 
  1087. case 'isoir155': 
  1088. return 'ISO_10367-box'; 
  1089.  
  1090. case 'csiso15italian': 
  1091. case 'iso646it': 
  1092. case 'isoir15': 
  1093. case 'it': 
  1094. return 'IT'; 
  1095.  
  1096. case 'csiso13jisc6220jp': 
  1097. case 'isoir13': 
  1098. case 'jisc62201969': 
  1099. case 'jisc62201969jp': 
  1100. case 'katakana': 
  1101. case 'x2017': 
  1102. return 'JIS_C6220-1969-jp'; 
  1103.  
  1104. case 'csiso14jisc6220ro': 
  1105. case 'iso646jp': 
  1106. case 'isoir14': 
  1107. case 'jisc62201969ro': 
  1108. case 'jp': 
  1109. return 'JIS_C6220-1969-ro'; 
  1110.  
  1111. case 'csiso42jisc62261978': 
  1112. case 'isoir42': 
  1113. case 'jisc62261978': 
  1114. return 'JIS_C6226-1978'; 
  1115.  
  1116. case 'csiso87jisx208': 
  1117. case 'isoir87': 
  1118. case 'jisc62261983': 
  1119. case 'jisx2081983': 
  1120. case 'x208': 
  1121. return 'JIS_C6226-1983'; 
  1122.  
  1123. case 'csiso91jisc62291984a': 
  1124. case 'isoir91': 
  1125. case 'jisc62291984a': 
  1126. case 'jpocra': 
  1127. return 'JIS_C6229-1984-a'; 
  1128.  
  1129. case 'csiso92jisc62991984b': 
  1130. case 'iso646jpocrb': 
  1131. case 'isoir92': 
  1132. case 'jisc62291984b': 
  1133. case 'jpocrb': 
  1134. return 'JIS_C6229-1984-b'; 
  1135.  
  1136. case 'csiso93jis62291984badd': 
  1137. case 'isoir93': 
  1138. case 'jisc62291984badd': 
  1139. case 'jpocrbadd': 
  1140. return 'JIS_C6229-1984-b-add'; 
  1141.  
  1142. case 'csiso94jis62291984hand': 
  1143. case 'isoir94': 
  1144. case 'jisc62291984hand': 
  1145. case 'jpocrhand': 
  1146. return 'JIS_C6229-1984-hand'; 
  1147.  
  1148. case 'csiso95jis62291984handadd': 
  1149. case 'isoir95': 
  1150. case 'jisc62291984handadd': 
  1151. case 'jpocrhandadd': 
  1152. return 'JIS_C6229-1984-hand-add'; 
  1153.  
  1154. case 'csiso96jisc62291984kana': 
  1155. case 'isoir96': 
  1156. case 'jisc62291984kana': 
  1157. return 'JIS_C6229-1984-kana'; 
  1158.  
  1159. case 'csjisencoding': 
  1160. case 'jisencoding': 
  1161. return 'JIS_Encoding'; 
  1162.  
  1163. case 'cshalfwidthkatakana': 
  1164. case 'jisx201': 
  1165. case 'x201': 
  1166. return 'JIS_X0201'; 
  1167.  
  1168. case 'csiso159jisx2121990': 
  1169. case 'isoir159': 
  1170. case 'jisx2121990': 
  1171. case 'x212': 
  1172. return 'JIS_X0212-1990'; 
  1173.  
  1174. case 'csiso141jusib1002': 
  1175. case 'iso646yu': 
  1176. case 'isoir141': 
  1177. case 'js': 
  1178. case 'jusib1002': 
  1179. case 'yu': 
  1180. return 'JUS_I.B1.002'; 
  1181.  
  1182. case 'csiso147macedonian': 
  1183. case 'isoir147': 
  1184. case 'jusib1003mac': 
  1185. case 'macedonian': 
  1186. return 'JUS_I.B1.003-mac'; 
  1187.  
  1188. case 'csiso146serbian': 
  1189. case 'isoir146': 
  1190. case 'jusib1003serb': 
  1191. case 'serbian': 
  1192. return 'JUS_I.B1.003-serb'; 
  1193.  
  1194. case 'koi7switched': 
  1195. return 'KOI7-switched'; 
  1196.  
  1197. case 'cskoi8r': 
  1198. case 'koi8r': 
  1199. return 'KOI8-R'; 
  1200.  
  1201. case 'koi8u': 
  1202. return 'KOI8-U'; 
  1203.  
  1204. case 'csksc5636': 
  1205. case 'iso646kr': 
  1206. case 'ksc5636': 
  1207. return 'KSC5636'; 
  1208.  
  1209. case 'cskz1048': 
  1210. case 'kz1048': 
  1211. case 'rk1048': 
  1212. case 'strk10482002': 
  1213. return 'KZ-1048'; 
  1214.  
  1215. case 'csiso19latingreek': 
  1216. case 'isoir19': 
  1217. case 'latingreek': 
  1218. return 'latin-greek'; 
  1219.  
  1220. case 'csiso27latingreek1': 
  1221. case 'isoir27': 
  1222. case 'latingreek1': 
  1223. return 'Latin-greek-1'; 
  1224.  
  1225. case 'csiso158lap': 
  1226. case 'isoir158': 
  1227. case 'lap': 
  1228. case 'latinlap': 
  1229. return 'latin-lap'; 
  1230.  
  1231. case 'csmacintosh': 
  1232. case 'mac': 
  1233. case 'macintosh': 
  1234. return 'macintosh'; 
  1235.  
  1236. case 'csmicrosoftpublishing': 
  1237. case 'microsoftpublishing': 
  1238. return 'Microsoft-Publishing'; 
  1239.  
  1240. case 'csmnem': 
  1241. case 'mnem': 
  1242. return 'MNEM'; 
  1243.  
  1244. case 'csmnemonic': 
  1245. case 'mnemonic': 
  1246. return 'MNEMONIC'; 
  1247.  
  1248. case 'csiso86hungarian': 
  1249. case 'hu': 
  1250. case 'iso646hu': 
  1251. case 'isoir86': 
  1252. case 'msz77953': 
  1253. return 'MSZ_7795.3'; 
  1254.  
  1255. case 'csnatsdano': 
  1256. case 'isoir91': 
  1257. case 'natsdano': 
  1258. return 'NATS-DANO'; 
  1259.  
  1260. case 'csnatsdanoadd': 
  1261. case 'isoir92': 
  1262. case 'natsdanoadd': 
  1263. return 'NATS-DANO-ADD'; 
  1264.  
  1265. case 'csnatssefi': 
  1266. case 'isoir81': 
  1267. case 'natssefi': 
  1268. return 'NATS-SEFI'; 
  1269.  
  1270. case 'csnatssefiadd': 
  1271. case 'isoir82': 
  1272. case 'natssefiadd': 
  1273. return 'NATS-SEFI-ADD'; 
  1274.  
  1275. case 'csiso151cuba': 
  1276. case 'cuba': 
  1277. case 'iso646cu': 
  1278. case 'isoir151': 
  1279. case 'ncnc1081': 
  1280. return 'NC_NC00-10:81'; 
  1281.  
  1282. case 'csiso69french': 
  1283. case 'fr': 
  1284. case 'iso646fr': 
  1285. case 'isoir69': 
  1286. case 'nfz62010': 
  1287. return 'NF_Z_62-010'; 
  1288.  
  1289. case 'csiso25french': 
  1290. case 'iso646fr1': 
  1291. case 'isoir25': 
  1292. case 'nfz620101973': 
  1293. return 'NF_Z_62-010_(1973)'; 
  1294.  
  1295. case 'csiso60danishnorwegian': 
  1296. case 'csiso60norwegian1': 
  1297. case 'iso646no': 
  1298. case 'isoir60': 
  1299. case 'no': 
  1300. case 'ns45511': 
  1301. return 'NS_4551-1'; 
  1302.  
  1303. case 'csiso61norwegian2': 
  1304. case 'iso646no2': 
  1305. case 'isoir61': 
  1306. case 'no2': 
  1307. case 'ns45512': 
  1308. return 'NS_4551-2'; 
  1309.  
  1310. case 'osdebcdicdf3irv': 
  1311. return 'OSD_EBCDIC_DF03_IRV'; 
  1312.  
  1313. case 'osdebcdicdf41': 
  1314. return 'OSD_EBCDIC_DF04_1'; 
  1315.  
  1316. case 'osdebcdicdf415': 
  1317. return 'OSD_EBCDIC_DF04_15'; 
  1318.  
  1319. case 'cspc8danishnorwegian': 
  1320. case 'pc8danishnorwegian': 
  1321. return 'PC8-Danish-Norwegian'; 
  1322.  
  1323. case 'cspc8turkish': 
  1324. case 'pc8turkish': 
  1325. return 'PC8-Turkish'; 
  1326.  
  1327. case 'csiso16portuguese': 
  1328. case 'iso646pt': 
  1329. case 'isoir16': 
  1330. case 'pt': 
  1331. return 'PT'; 
  1332.  
  1333. case 'csiso84portuguese2': 
  1334. case 'iso646pt2': 
  1335. case 'isoir84': 
  1336. case 'pt2': 
  1337. return 'PT2'; 
  1338.  
  1339. case 'cp154': 
  1340. case 'csptcp154': 
  1341. case 'cyrillicasian': 
  1342. case 'pt154': 
  1343. case 'ptcp154': 
  1344. return 'PTCP154'; 
  1345.  
  1346. case 'scsu': 
  1347. return 'SCSU'; 
  1348.  
  1349. case 'csiso10swedish': 
  1350. case 'fi': 
  1351. case 'iso646fi': 
  1352. case 'iso646se': 
  1353. case 'isoir10': 
  1354. case 'se': 
  1355. case 'sen850200b': 
  1356. return 'SEN_850200_B'; 
  1357.  
  1358. case 'csiso11swedishfornames': 
  1359. case 'iso646se2': 
  1360. case 'isoir11': 
  1361. case 'se2': 
  1362. case 'sen850200c': 
  1363. return 'SEN_850200_C'; 
  1364.  
  1365. case 'csiso102t617bit': 
  1366. case 'isoir102': 
  1367. case 't617bit': 
  1368. return 'T.61-7bit'; 
  1369.  
  1370. case 'csiso103t618bit': 
  1371. case 'isoir103': 
  1372. case 't61': 
  1373. case 't618bit': 
  1374. return 'T.61-8bit'; 
  1375.  
  1376. case 'csiso128t101g2': 
  1377. case 'isoir128': 
  1378. case 't101g2': 
  1379. return 'T.101-G2'; 
  1380.  
  1381. case 'cstscii': 
  1382. case 'tscii': 
  1383. return 'TSCII'; 
  1384.  
  1385. case 'csunicode11': 
  1386. case 'unicode11': 
  1387. return 'UNICODE-1-1'; 
  1388.  
  1389. case 'csunicode11utf7': 
  1390. case 'unicode11utf7': 
  1391. return 'UNICODE-1-1-UTF-7'; 
  1392.  
  1393. case 'csunknown8bit': 
  1394. case 'unknown8bit': 
  1395. return 'UNKNOWN-8BIT'; 
  1396.  
  1397. case 'ansix341968': 
  1398. case 'ansix341986': 
  1399. case 'ascii': 
  1400. case 'cp367': 
  1401. case 'csascii': 
  1402. case 'ibm367': 
  1403. case 'iso646irv1991': 
  1404. case 'iso646us': 
  1405. case 'isoir6': 
  1406. case 'us': 
  1407. case 'usascii': 
  1408. return 'US-ASCII'; 
  1409.  
  1410. case 'csusdk': 
  1411. case 'usdk': 
  1412. return 'us-dk'; 
  1413.  
  1414. case 'utf7': 
  1415. return 'UTF-7'; 
  1416.  
  1417. case 'utf8': 
  1418. return 'UTF-8'; 
  1419.  
  1420. case 'utf16': 
  1421. return 'UTF-16'; 
  1422.  
  1423. case 'utf16be': 
  1424. return 'UTF-16BE'; 
  1425.  
  1426. case 'utf16le': 
  1427. return 'UTF-16LE'; 
  1428.  
  1429. case 'utf32': 
  1430. return 'UTF-32'; 
  1431.  
  1432. case 'utf32be': 
  1433. return 'UTF-32BE'; 
  1434.  
  1435. case 'utf32le': 
  1436. return 'UTF-32LE'; 
  1437.  
  1438. case 'csventurainternational': 
  1439. case 'venturainternational': 
  1440. return 'Ventura-International'; 
  1441.  
  1442. case 'csventuramath': 
  1443. case 'venturamath': 
  1444. return 'Ventura-Math'; 
  1445.  
  1446. case 'csventuraus': 
  1447. case 'venturaus': 
  1448. return 'Ventura-US'; 
  1449.  
  1450. case 'csiso70videotexsupp1': 
  1451. case 'isoir70': 
  1452. case 'videotexsuppl': 
  1453. return 'videotex-suppl'; 
  1454.  
  1455. case 'csviqr': 
  1456. case 'viqr': 
  1457. return 'VIQR'; 
  1458.  
  1459. case 'csviscii': 
  1460. case 'viscii': 
  1461. return 'VISCII'; 
  1462.  
  1463. case 'csshiftjis': 
  1464. case 'cswindows31j': 
  1465. case 'mskanji': 
  1466. case 'shiftjis': 
  1467. case 'windows31j': 
  1468. return 'Windows-31J'; 
  1469.  
  1470. case 'iso885911': 
  1471. case 'tis620': 
  1472. return 'windows-874'; 
  1473.  
  1474. case 'cseuckr': 
  1475. case 'csksc56011987': 
  1476. case 'euckr': 
  1477. case 'isoir149': 
  1478. case 'korean': 
  1479. case 'ksc5601': 
  1480. case 'ksc56011987': 
  1481. case 'ksc56011989': 
  1482. case 'windows949': 
  1483. return 'windows-949'; 
  1484.  
  1485. case 'windows1250': 
  1486. return 'windows-1250'; 
  1487.  
  1488. case 'windows1251': 
  1489. return 'windows-1251'; 
  1490.  
  1491. case 'cp819': 
  1492. case 'csisolatin1': 
  1493. case 'ibm819': 
  1494. case 'iso88591': 
  1495. case 'iso885911987': 
  1496. case 'isoir100': 
  1497. case 'l1': 
  1498. case 'latin1': 
  1499. case 'windows1252': 
  1500. return 'windows-1252'; 
  1501.  
  1502. case 'windows1253': 
  1503. return 'windows-1253'; 
  1504.  
  1505. case 'csisolatin5': 
  1506. case 'iso88599': 
  1507. case 'iso885991989': 
  1508. case 'isoir148': 
  1509. case 'l5': 
  1510. case 'latin5': 
  1511. case 'windows1254': 
  1512. return 'windows-1254'; 
  1513.  
  1514. case 'windows1255': 
  1515. return 'windows-1255'; 
  1516.  
  1517. case 'windows1256': 
  1518. return 'windows-1256'; 
  1519.  
  1520. case 'windows1257': 
  1521. return 'windows-1257'; 
  1522.  
  1523. case 'windows1258': 
  1524. return 'windows-1258'; 
  1525.  
  1526. default: 
  1527. return $charset; 
  1528.  
  1529. public static function get_curl_version() 
  1530. if (is_array($curl = curl_version())) 
  1531. $curl = $curl['version']; 
  1532. elseif (substr($curl, 0, 5) === 'curl/') 
  1533. $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5)); 
  1534. elseif (substr($curl, 0, 8) === 'libcurl/') 
  1535. $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8)); 
  1536. else 
  1537. $curl = 0; 
  1538. return $curl; 
  1539.  
  1540. /** 
  1541. * Strip HTML comments 
  1542. * @param string $data Data to strip comments from 
  1543. * @return string Comment stripped string 
  1544. */ 
  1545. public static function strip_comments($data) 
  1546. $output = ''; 
  1547. while (($start = strpos($data, '<!--')) !== false) 
  1548. $output .= substr($data, 0, $start); 
  1549. if (($end = strpos($data, '-->', $start)) !== false) 
  1550. $data = substr_replace($data, '', 0, $end + 3); 
  1551. else 
  1552. $data = ''; 
  1553. return $output . $data; 
  1554.  
  1555. public static function parse_date($dt) 
  1556. $parser = SimplePie_Parse_Date::get(); 
  1557. return $parser->parse($dt); 
  1558.  
  1559. /** 
  1560. * Decode HTML entities 
  1561. * @deprecated Use DOMDocument instead 
  1562. * @param string $data Input data 
  1563. * @return string Output data 
  1564. */ 
  1565. public static function entities_decode($data) 
  1566. $decoder = new SimplePie_Decode_HTML_Entities($data); 
  1567. return $decoder->parse(); 
  1568.  
  1569. /** 
  1570. * Remove RFC822 comments 
  1571. * @param string $data Data to strip comments from 
  1572. * @return string Comment stripped string 
  1573. */ 
  1574. public static function uncomment_rfc822($string) 
  1575. $string = (string) $string; 
  1576. $position = 0; 
  1577. $length = strlen($string); 
  1578. $depth = 0; 
  1579.  
  1580. $output = ''; 
  1581.  
  1582. while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) 
  1583. $output .= substr($string, $position, $pos - $position); 
  1584. $position = $pos + 1; 
  1585. if ($string[$pos - 1] !== '\\') 
  1586. $depth++; 
  1587. while ($depth && $position < $length) 
  1588. $position += strcspn($string, '()', $position); 
  1589. if ($string[$position - 1] === '\\') 
  1590. $position++; 
  1591. continue; 
  1592. elseif (isset($string[$position])) 
  1593. switch ($string[$position]) 
  1594. case '(': 
  1595. $depth++; 
  1596. break; 
  1597.  
  1598. case ')': 
  1599. $depth--; 
  1600. break; 
  1601. $position++; 
  1602. else 
  1603. break; 
  1604. else 
  1605. $output .= '('; 
  1606. $output .= substr($string, $position); 
  1607.  
  1608. return $output; 
  1609.  
  1610. public static function parse_mime($mime) 
  1611. if (($pos = strpos($mime, ';')) === false) 
  1612. return trim($mime); 
  1613. else 
  1614. return trim(substr($mime, 0, $pos)); 
  1615.  
  1616. public static function atom_03_construct_type($attribs) 
  1617. if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64')) 
  1618. $mode = SIMPLEPIE_CONSTRUCT_BASE64; 
  1619. else 
  1620. $mode = SIMPLEPIE_CONSTRUCT_NONE; 
  1621. if (isset($attribs['']['type'])) 
  1622. switch (strtolower(trim($attribs['']['type']))) 
  1623. case 'text': 
  1624. case 'text/plain': 
  1625. return SIMPLEPIE_CONSTRUCT_TEXT | $mode; 
  1626.  
  1627. case 'html': 
  1628. case 'text/html': 
  1629. return SIMPLEPIE_CONSTRUCT_HTML | $mode; 
  1630.  
  1631. case 'xhtml': 
  1632. case 'application/xhtml+xml': 
  1633. return SIMPLEPIE_CONSTRUCT_XHTML | $mode; 
  1634.  
  1635. default: 
  1636. return SIMPLEPIE_CONSTRUCT_NONE | $mode; 
  1637. else 
  1638. return SIMPLEPIE_CONSTRUCT_TEXT | $mode; 
  1639.  
  1640. public static function atom_10_construct_type($attribs) 
  1641. if (isset($attribs['']['type'])) 
  1642. switch (strtolower(trim($attribs['']['type']))) 
  1643. case 'text': 
  1644. return SIMPLEPIE_CONSTRUCT_TEXT; 
  1645.  
  1646. case 'html': 
  1647. return SIMPLEPIE_CONSTRUCT_HTML; 
  1648.  
  1649. case 'xhtml': 
  1650. return SIMPLEPIE_CONSTRUCT_XHTML; 
  1651.  
  1652. default: 
  1653. return SIMPLEPIE_CONSTRUCT_NONE; 
  1654. return SIMPLEPIE_CONSTRUCT_TEXT; 
  1655.  
  1656. public static function atom_10_content_construct_type($attribs) 
  1657. if (isset($attribs['']['type'])) 
  1658. $type = strtolower(trim($attribs['']['type'])); 
  1659. switch ($type) 
  1660. case 'text': 
  1661. return SIMPLEPIE_CONSTRUCT_TEXT; 
  1662.  
  1663. case 'html': 
  1664. return SIMPLEPIE_CONSTRUCT_HTML; 
  1665.  
  1666. case 'xhtml': 
  1667. return SIMPLEPIE_CONSTRUCT_XHTML; 
  1668. if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/') 
  1669. return SIMPLEPIE_CONSTRUCT_NONE; 
  1670. else 
  1671. return SIMPLEPIE_CONSTRUCT_BASE64; 
  1672. else 
  1673. return SIMPLEPIE_CONSTRUCT_TEXT; 
  1674.  
  1675. public static function is_isegment_nz_nc($string) 
  1676. 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); 
  1677.  
  1678. public static function space_seperated_tokens($string) 
  1679. $space_characters = "\x20\x09\x0A\x0B\x0C\x0D"; 
  1680. $string_length = strlen($string); 
  1681.  
  1682. $position = strspn($string, $space_characters); 
  1683. $tokens = array(); 
  1684.  
  1685. while ($position < $string_length) 
  1686. $len = strcspn($string, $space_characters, $position); 
  1687. $tokens[] = substr($string, $position, $len); 
  1688. $position += $len; 
  1689. $position += strspn($string, $space_characters, $position); 
  1690.  
  1691. return $tokens; 
  1692.  
  1693. /** 
  1694. * Converts a unicode codepoint to a UTF-8 character 
  1695. * @static 
  1696. * @param int $codepoint Unicode codepoint 
  1697. * @return string UTF-8 character 
  1698. */ 
  1699. public static function codepoint_to_utf8($codepoint) 
  1700. $codepoint = (int) $codepoint; 
  1701. if ($codepoint < 0) 
  1702. return false; 
  1703. else if ($codepoint <= 0x7f) 
  1704. return chr($codepoint); 
  1705. else if ($codepoint <= 0x7ff) 
  1706. return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f)); 
  1707. else if ($codepoint <= 0xffff) 
  1708. return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); 
  1709. else if ($codepoint <= 0x10ffff) 
  1710. return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); 
  1711. else 
  1712. // U+FFFD REPLACEMENT CHARACTER 
  1713. return "\xEF\xBF\xBD"; 
  1714.  
  1715. /** 
  1716. * Similar to parse_str() 
  1717. * Returns an associative array of name/value pairs, where the value is an 
  1718. * array of values that have used the same name 
  1719. * @static 
  1720. * @param string $str The input string. 
  1721. * @return array 
  1722. */ 
  1723. public static function parse_str($str) 
  1724. $return = array(); 
  1725. $str = explode('&', $str); 
  1726.  
  1727. foreach ($str as $section) 
  1728. if (strpos($section, '=') !== false) 
  1729. list($name, $value) = explode('=', $section, 2); 
  1730. $return[urldecode($name)][] = urldecode($value); 
  1731. else 
  1732. $return[urldecode($section)][] = null; 
  1733.  
  1734. return $return; 
  1735.  
  1736. /** 
  1737. * Detect XML encoding, as per XML 1.0 Appendix F.1 
  1738. * @todo Add support for EBCDIC 
  1739. * @param string $data XML data 
  1740. * @param SimplePie_Registry $registry Class registry 
  1741. * @return array Possible encodings 
  1742. */ 
  1743. public static function xml_encoding($data, $registry) 
  1744. // UTF-32 Big Endian BOM 
  1745. if (substr($data, 0, 4) === "\x00\x00\xFE\xFF") 
  1746. $encoding[] = 'UTF-32BE'; 
  1747. // UTF-32 Little Endian BOM 
  1748. elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00") 
  1749. $encoding[] = 'UTF-32LE'; 
  1750. // UTF-16 Big Endian BOM 
  1751. elseif (substr($data, 0, 2) === "\xFE\xFF") 
  1752. $encoding[] = 'UTF-16BE'; 
  1753. // UTF-16 Little Endian BOM 
  1754. elseif (substr($data, 0, 2) === "\xFF\xFE") 
  1755. $encoding[] = 'UTF-16LE'; 
  1756. // UTF-8 BOM 
  1757. elseif (substr($data, 0, 3) === "\xEF\xBB\xBF") 
  1758. $encoding[] = 'UTF-8'; 
  1759. // UTF-32 Big Endian Without BOM 
  1760. elseif (substr($data, 0, 20) === "\x00\x00\x00\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C") 
  1761. if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E")) 
  1762. $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'))); 
  1763. if ($parser->parse()) 
  1764. $encoding[] = $parser->encoding; 
  1765. $encoding[] = 'UTF-32BE'; 
  1766. // UTF-32 Little Endian Without BOM 
  1767. elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00") 
  1768. if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00")) 
  1769. $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'))); 
  1770. if ($parser->parse()) 
  1771. $encoding[] = $parser->encoding; 
  1772. $encoding[] = 'UTF-32LE'; 
  1773. // UTF-16 Big Endian Without BOM 
  1774. elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C") 
  1775. if ($pos = strpos($data, "\x00\x3F\x00\x3E")) 
  1776. $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'))); 
  1777. if ($parser->parse()) 
  1778. $encoding[] = $parser->encoding; 
  1779. $encoding[] = 'UTF-16BE'; 
  1780. // UTF-16 Little Endian Without BOM 
  1781. elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00") 
  1782. if ($pos = strpos($data, "\x3F\x00\x3E\x00")) 
  1783. $parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'))); 
  1784. if ($parser->parse()) 
  1785. $encoding[] = $parser->encoding; 
  1786. $encoding[] = 'UTF-16LE'; 
  1787. // US-ASCII (or superset) 
  1788. elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C") 
  1789. if ($pos = strpos($data, "\x3F\x3E")) 
  1790. $parser = $registry->create('XML_Declaration_Parser', array(substr($data, 5, $pos - 5))); 
  1791. if ($parser->parse()) 
  1792. $encoding[] = $parser->encoding; 
  1793. $encoding[] = 'UTF-8'; 
  1794. // Fallback to UTF-8 
  1795. else 
  1796. $encoding[] = 'UTF-8'; 
  1797. return $encoding; 
  1798.  
  1799. public static function output_javascript() 
  1800. if (function_exists('ob_gzhandler')) 
  1801. ob_start('ob_gzhandler'); 
  1802. header('Content-type: text/javascript; charset: UTF-8'); 
  1803. header('Cache-Control: must-revalidate'); 
  1804. header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days 
  1805. ?> 
  1806. function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) { 
  1807. if (placeholder != '') { 
  1808. document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" href="'+link+'" src="'+placeholder+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="false" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>'); 
  1809. else { 
  1810. document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" src="'+link+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="true" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>'); 
  1811.  
  1812. function embed_flash(bgcolor, width, height, link, loop, type) { 
  1813. document.writeln('<embed src="'+link+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="'+type+'" quality="high" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'" loop="'+loop+'"></embed>'); 
  1814.  
  1815. function embed_flv(width, height, link, placeholder, loop, player) { 
  1816. document.writeln('<embed src="'+player+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="'+width+'" height="'+height+'" wmode="transparent" flashvars="file='+link+'&autostart=false&repeat='+loop+'&showdigits=true&showfsbutton=false"></embed>'); 
  1817.  
  1818. function embed_wmedia(width, height, link) { 
  1819. document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>'); 
  1820. <?php 
  1821.  
  1822. /** 
  1823. * Get the SimplePie build timestamp 
  1824. * Uses the git index if it exists, otherwise uses the modification time 
  1825. * of the newest file. 
  1826. */ 
  1827. public static function get_build() 
  1828. $root = dirname(dirname(__FILE__)); 
  1829. if (file_exists($root . '/.git/index')) 
  1830. return filemtime($root . '/.git/index'); 
  1831. elseif (file_exists($root . '/SimplePie')) 
  1832. $time = 0; 
  1833. foreach (glob($root . '/SimplePie/*.php') as $file) 
  1834. if (($mtime = filemtime($file)) > $time) 
  1835. $time = $mtime; 
  1836. return $time; 
  1837. elseif (file_exists(dirname(__FILE__) . '/Core.php')) 
  1838. return filemtime(dirname(__FILE__) . '/Core.php'); 
  1839. else 
  1840. return filemtime(__FILE__); 
  1841.   
  1842. /** 
  1843. * Format debugging information 
  1844. */ 
  1845. public static function debug(&$sp) 
  1846. $info = 'SimplePie ' . SIMPLEPIE_VERSION . ' Build ' . SIMPLEPIE_BUILD . "\n"; 
  1847. $info .= 'PHP ' . PHP_VERSION . "\n"; 
  1848. if ($sp->error() !== null) 
  1849. $info .= 'Error occurred: ' . $sp->error() . "\n"; 
  1850. else 
  1851. $info .= "No error found.\n"; 
  1852. $info .= "Extensions:\n"; 
  1853. $extensions = array('pcre', 'curl', 'zlib', 'mbstring', 'iconv', 'xmlreader', 'xml'); 
  1854. foreach ($extensions as $ext) 
  1855. if (extension_loaded($ext)) 
  1856. $info .= " $ext loaded\n"; 
  1857. switch ($ext) 
  1858. case 'pcre': 
  1859. $info .= ' Version ' . PCRE_VERSION . "\n"; 
  1860. break; 
  1861. case 'curl': 
  1862. $version = curl_version(); 
  1863. $info .= ' Version ' . $version['version'] . "\n"; 
  1864. break; 
  1865. case 'mbstring': 
  1866. $info .= ' Overloading: ' . mb_get_info('func_overload') . "\n"; 
  1867. break; 
  1868. case 'iconv': 
  1869. $info .= ' Version ' . ICONV_VERSION . "\n"; 
  1870. break; 
  1871. case 'xml': 
  1872. $info .= ' Version ' . LIBXML_DOTTED_VERSION . "\n"; 
  1873. break; 
  1874. else 
  1875. $info .= " $ext not loaded\n"; 
  1876. return $info; 
  1877.  
  1878. public static function silence_errors($num, $str) 
  1879. // No-op