aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/simplepie/SimplePie/Misc.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/3rdparty/simplepie/SimplePie/Misc.php')
-rw-r--r--inc/3rdparty/simplepie/SimplePie/Misc.php2365
1 files changed, 2365 insertions, 0 deletions
diff --git a/inc/3rdparty/simplepie/SimplePie/Misc.php b/inc/3rdparty/simplepie/SimplePie/Misc.php
new file mode 100644
index 00000000..eabf2738
--- /dev/null
+++ b/inc/3rdparty/simplepie/SimplePie/Misc.php
@@ -0,0 +1,2365 @@
1<?php
2/**
3 * SimplePie
4 *
5 * A PHP-Based RSS and Atom Feed Framework.
6 * Takes the hard work out of managing a complete RSS/Atom solution.
7 *
8 * Copyright (c) 2004-2009, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without modification, are
12 * permitted provided that the following conditions are met:
13 *
14 * * Redistributions of source code must retain the above copyright notice, this list of
15 * conditions and the following disclaimer.
16 *
17 * * Redistributions in binary form must reproduce the above copyright notice, this list
18 * of conditions and the following disclaimer in the documentation and/or other materials
19 * provided with the distribution.
20 *
21 * * Neither the name of the SimplePie Team nor the names of its contributors may be used
22 * to endorse or promote products derived from this software without specific prior
23 * written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
26 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
28 * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 *
35 * @package SimplePie
36 * @version 1.3-dev
37 * @copyright 2004-2010 Ryan Parman, Geoffrey Sneddon, Ryan McCue
38 * @author Ryan Parman
39 * @author Geoffrey Sneddon
40 * @author Ryan McCue
41 * @link http://simplepie.org/ SimplePie
42 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
43 * @todo phpDoc comments
44 */
45
46
47class SimplePie_Misc
48{
49 public static function time_hms($seconds)
50 {
51 $time = '';
52
53 $hours = floor($seconds / 3600);
54 $remainder = $seconds % 3600;
55 if ($hours > 0)
56 {
57 $time .= $hours.':';
58 }
59
60 $minutes = floor($remainder / 60);
61 $seconds = $remainder % 60;
62 if ($minutes < 10 && $hours > 0)
63 {
64 $minutes = '0' . $minutes;
65 }
66 if ($seconds < 10)
67 {
68 $seconds = '0' . $seconds;
69 }
70
71 $time .= $minutes.':';
72 $time .= $seconds;
73
74 return $time;
75 }
76
77 public static function absolutize_url($relative, $base)
78 {
79 $iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative);
80 return $iri->get_iri();
81 }
82
83 public static function remove_dot_segments($input)
84 {
85 $output = '';
86 while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
87 {
88 // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
89 if (strpos($input, '../') === 0)
90 {
91 $input = substr($input, 3);
92 }
93 elseif (strpos($input, './') === 0)
94 {
95 $input = substr($input, 2);
96 }
97 // B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise,
98 elseif (strpos($input, '/./') === 0)
99 {
100 $input = substr_replace($input, '/', 0, 3);
101 }
102 elseif ($input === '/.')
103 {
104 $input = '/';
105 }
106 // C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise,
107 elseif (strpos($input, '/../') === 0)
108 {
109 $input = substr_replace($input, '/', 0, 4);
110 $output = substr_replace($output, '', strrpos($output, '/'));
111 }
112 elseif ($input === '/..')
113 {
114 $input = '/';
115 $output = substr_replace($output, '', strrpos($output, '/'));
116 }
117 // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
118 elseif ($input === '.' || $input === '..')
119 {
120 $input = '';
121 }
122 // E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer
123 elseif (($pos = strpos($input, '/', 1)) !== false)
124 {
125 $output .= substr($input, 0, $pos);
126 $input = substr_replace($input, '', 0, $pos);
127 }
128 else
129 {
130 $output .= $input;
131 $input = '';
132 }
133 }
134 return $output . $input;
135 }
136
137 public static function get_element($realname, $string)
138 {
139 $return = array();
140 $name = preg_quote($realname, '/');
141 if (preg_match_all("/<($name)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE))
142 {
143 for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++)
144 {
145 $return[$i]['tag'] = $realname;
146 $return[$i]['full'] = $matches[$i][0][0];
147 $return[$i]['offset'] = $matches[$i][0][1];
148 if (strlen($matches[$i][3][0]) <= 2)
149 {
150 $return[$i]['self_closing'] = true;
151 }
152 else
153 {
154 $return[$i]['self_closing'] = false;
155 $return[$i]['content'] = $matches[$i][4][0];
156 }
157 $return[$i]['attribs'] = array();
158 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))
159 {
160 for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++)
161 {
162 if (count($attribs[$j]) === 2)
163 {
164 $attribs[$j][2] = $attribs[$j][1];
165 }
166 $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j]), 'UTF-8');
167 }
168 }
169 }
170 }
171 return $return;
172 }
173
174 public static function element_implode($element)
175 {
176 $full = "<$element[tag]";
177 foreach ($element['attribs'] as $key => $value)
178 {
179 $key = strtolower($key);
180 $full .= " $key=\"" . htmlspecialchars($value['data']) . '"';
181 }
182 if ($element['self_closing'])
183 {
184 $full .= ' />';
185 }
186 else
187 {
188 $full .= ">$element[content]</$element[tag]>";
189 }
190 return $full;
191 }
192
193 public static function error($message, $level, $file, $line)
194 {
195 if ((ini_get('error_reporting') & $level) > 0)
196 {
197 switch ($level)
198 {
199 case E_USER_ERROR:
200 $note = 'PHP Error';
201 break;
202 case E_USER_WARNING:
203 $note = 'PHP Warning';
204 break;
205 case E_USER_NOTICE:
206 $note = 'PHP Notice';
207 break;
208 default:
209 $note = 'Unknown Error';
210 break;
211 }
212
213 $log_error = true;
214 if (!function_exists('error_log'))
215 {
216 $log_error = false;
217 }
218
219 $log_file = @ini_get('error_log');
220 if (!empty($log_file) && ('syslog' !== $log_file) && !@is_writable($log_file))
221 {
222 $log_error = false;
223 }
224
225 if ($log_error)
226 {
227 @error_log("$note: $message in $file on line $line", 0);
228 }
229 }
230
231 return $message;
232 }
233
234 public static function fix_protocol($url, $http = 1)
235 {
236 $url = SimplePie_Misc::normalize_url($url);
237 $parsed = SimplePie_Misc::parse_url($url);
238 if ($parsed['scheme'] !== '' && $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https')
239 {
240 return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http);
241 }
242
243 if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url))
244 {
245 return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http);
246 }
247
248 if ($http === 2 && $parsed['scheme'] !== '')
249 {
250 return "feed:$url";
251 }
252 elseif ($http === 3 && strtolower($parsed['scheme']) === 'http')
253 {
254 return substr_replace($url, 'podcast', 0, 4);
255 }
256 elseif ($http === 4 && strtolower($parsed['scheme']) === 'http')
257 {
258 return substr_replace($url, 'itpc', 0, 4);
259 }
260 else
261 {
262 return $url;
263 }
264 }
265
266 public static function parse_url($url)
267 {
268 $iri = new SimplePie_IRI($url);
269 return array(
270 'scheme' => (string) $iri->get_scheme(),
271 'authority' => (string) $iri->get_authority(),
272 'path' => (string) $iri->get_path(),
273 'query' => (string) $iri->get_query(),
274 'fragment' => (string) $iri->get_fragment()
275 );
276 }
277
278 public static function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
279 {
280 $iri = new SimplePie_IRI('');
281 $iri->set_scheme($scheme);
282 $iri->set_authority($authority);
283 $iri->set_path($path);
284 $iri->set_query($query);
285 $iri->set_fragment($fragment);
286 return $iri->get_iri();
287 }
288
289 public static function normalize_url($url)
290 {
291 $iri = new SimplePie_IRI($url);
292 return $iri->get_iri();
293 }
294
295 public static function percent_encoding_normalization($match)
296 {
297 $integer = hexdec($match[1]);
298 if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E)
299 {
300 return chr($integer);
301 }
302 else
303 {
304 return strtoupper($match[0]);
305 }
306 }
307
308 /**
309 * Converts a Windows-1252 encoded string to a UTF-8 encoded string
310 *
311 * @static
312 * @param string $string Windows-1252 encoded string
313 * @return string UTF-8 encoded string
314 */
315 public static function windows_1252_to_utf8($string)
316 {
317 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");
318
319 return strtr($string, $convert_table);
320 }
321
322 /**
323 * Change a string from one encoding to another
324 *
325 * @param string $data Raw data in $input encoding
326 * @param string $input Encoding of $data
327 * @param string $output Encoding you want
328 * @return string|boolean False if we can't convert it
329 */
330 public static function change_encoding($data, $input, $output)
331 {
332 $input = SimplePie_Misc::encoding($input);
333 $output = SimplePie_Misc::encoding($output);
334
335 // We fail to fail on non US-ASCII bytes
336 if ($input === 'US-ASCII')
337 {
338 static $non_ascii_octects = '';
339 if (!$non_ascii_octects)
340 {
341 for ($i = 0x80; $i <= 0xFF; $i++)
342 {
343 $non_ascii_octects .= chr($i);
344 }
345 }
346 $data = substr($data, 0, strcspn($data, $non_ascii_octects));
347 }
348
349 // This is first, as behaviour of this is completely predictable
350 if ($input === 'windows-1252' && $output === 'UTF-8')
351 {
352 return SimplePie_Misc::windows_1252_to_utf8($data);
353 }
354 // This is second, as behaviour of this varies only with PHP version (the middle part of this expression checks the encoding is supported).
355 elseif (function_exists('mb_convert_encoding') && ($return = SimplePie_Misc::change_encoding_mbstring($data, $input, $output)))
356 {
357 return $return;
358 }
359 // This is last, as behaviour of this varies with OS userland and PHP version
360 elseif (function_exists('iconv') && ($return = SimplePie_Misc::change_encoding_iconv($data, $input, $output)))
361 {
362 return $return;
363 }
364 // If we can't do anything, just fail
365 else
366 {
367 return false;
368 }
369 }
370
371 protected static function change_encoding_mbstring($data, $input, $output)
372 {
373 if ($input === 'windows-949')
374 {
375 $input = 'EUC-KR';
376 }
377 if ($output === 'windows-949')
378 {
379 $output = 'EUC-KR';
380 }
381
382 // Check that the encoding is supported
383 if (@mb_convert_encoding("\x80", 'UTF-16BE', $input) === "\x00\x80")
384 {
385 return false;
386 }
387 if (!in_array($input, mb_list_encodings()))
388 {
389 return false;
390 }
391
392 // Let's do some conversion
393 if ($return = @mb_convert_encoding($data, $output, $input))
394 {
395 return $return;
396 }
397
398 return false;
399 }
400
401 protected static function change_encoding_iconv($data, $input, $output)
402 {
403 return @iconv($input, $output, $data);
404 }
405
406 /**
407 * Normalize an encoding name
408 *
409 * This is automatically generated by create.php
410 *
411 * To generate it, run `php create.php` on the command line, and copy the
412 * output to replace this function.
413 *
414 * @param string $charset Character set to standardise
415 * @return string Standardised name
416 */
417 public static function encoding($charset)
418 {
419 // Normalization from UTS #22
420 switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset)))
421 {
422 case 'adobestandardencoding':
423 case 'csadobestandardencoding':
424 return 'Adobe-Standard-Encoding';
425
426 case 'adobesymbolencoding':
427 case 'cshppsmath':
428 return 'Adobe-Symbol-Encoding';
429
430 case 'ami1251':
431 case 'amiga1251':
432 return 'Amiga-1251';
433
434 case 'ansix31101983':
435 case 'csat5001983':
436 case 'csiso99naplps':
437 case 'isoir99':
438 case 'naplps':
439 return 'ANSI_X3.110-1983';
440
441 case 'arabic7':
442 case 'asmo449':
443 case 'csiso89asmo449':
444 case 'iso9036':
445 case 'isoir89':
446 return 'ASMO_449';
447
448 case 'big5':
449 case 'csbig5':
450 return 'Big5';
451
452 case 'big5hkscs':
453 return 'Big5-HKSCS';
454
455 case 'bocu1':
456 case 'csbocu1':
457 return 'BOCU-1';
458
459 case 'brf':
460 case 'csbrf':
461 return 'BRF';
462
463 case 'bs4730':
464 case 'csiso4unitedkingdom':
465 case 'gb':
466 case 'iso646gb':
467 case 'isoir4':
468 case 'uk':
469 return 'BS_4730';
470
471 case 'bsviewdata':
472 case 'csiso47bsviewdata':
473 case 'isoir47':
474 return 'BS_viewdata';
475
476 case 'cesu8':
477 case 'cscesu8':
478 return 'CESU-8';
479
480 case 'ca':
481 case 'csa71':
482 case 'csaz243419851':
483 case 'csiso121canadian1':
484 case 'iso646ca':
485 case 'isoir121':
486 return 'CSA_Z243.4-1985-1';
487
488 case 'csa72':
489 case 'csaz243419852':
490 case 'csiso122canadian2':
491 case 'iso646ca2':
492 case 'isoir122':
493 return 'CSA_Z243.4-1985-2';
494
495 case 'csaz24341985gr':
496 case 'csiso123csaz24341985gr':
497 case 'isoir123':
498 return 'CSA_Z243.4-1985-gr';
499
500 case 'csiso139csn369103':
501 case 'csn369103':
502 case 'isoir139':
503 return 'CSN_369103';
504
505 case 'csdecmcs':
506 case 'dec':
507 case 'decmcs':
508 return 'DEC-MCS';
509
510 case 'csiso21german':
511 case 'de':
512 case 'din66003':
513 case 'iso646de':
514 case 'isoir21':
515 return 'DIN_66003';
516
517 case 'csdkus':
518 case 'dkus':
519 return 'dk-us';
520
521 case 'csiso646danish':
522 case 'dk':
523 case 'ds2089':
524 case 'iso646dk':
525 return 'DS_2089';
526
527 case 'csibmebcdicatde':
528 case 'ebcdicatde':
529 return 'EBCDIC-AT-DE';
530
531 case 'csebcdicatdea':
532 case 'ebcdicatdea':
533 return 'EBCDIC-AT-DE-A';
534
535 case 'csebcdiccafr':
536 case 'ebcdiccafr':
537 return 'EBCDIC-CA-FR';
538
539 case 'csebcdicdkno':
540 case 'ebcdicdkno':
541 return 'EBCDIC-DK-NO';
542
543 case 'csebcdicdknoa':
544 case 'ebcdicdknoa':
545 return 'EBCDIC-DK-NO-A';
546
547 case 'csebcdices':
548 case 'ebcdices':
549 return 'EBCDIC-ES';
550
551 case 'csebcdicesa':
552 case 'ebcdicesa':
553 return 'EBCDIC-ES-A';
554
555 case 'csebcdicess':
556 case 'ebcdicess':
557 return 'EBCDIC-ES-S';
558
559 case 'csebcdicfise':
560 case 'ebcdicfise':
561 return 'EBCDIC-FI-SE';
562
563 case 'csebcdicfisea':
564 case 'ebcdicfisea':
565 return 'EBCDIC-FI-SE-A';
566
567 case 'csebcdicfr':
568 case 'ebcdicfr':
569 return 'EBCDIC-FR';
570
571 case 'csebcdicit':
572 case 'ebcdicit':
573 return 'EBCDIC-IT';
574
575 case 'csebcdicpt':
576 case 'ebcdicpt':
577 return 'EBCDIC-PT';
578
579 case 'csebcdicuk':
580 case 'ebcdicuk':
581 return 'EBCDIC-UK';
582
583 case 'csebcdicus':
584 case 'ebcdicus':
585 return 'EBCDIC-US';
586
587 case 'csiso111ecmacyrillic':
588 case 'ecmacyrillic':
589 case 'isoir111':
590 case 'koi8e':
591 return 'ECMA-cyrillic';
592
593 case 'csiso17spanish':
594 case 'es':
595 case 'iso646es':
596 case 'isoir17':
597 return 'ES';
598
599 case 'csiso85spanish2':
600 case 'es2':
601 case 'iso646es2':
602 case 'isoir85':
603 return 'ES2';
604
605 case 'cseucpkdfmtjapanese':
606 case 'eucjp':
607 case 'extendedunixcodepackedformatforjapanese':
608 return 'EUC-JP';
609
610 case 'cseucfixwidjapanese':
611 case 'extendedunixcodefixedwidthforjapanese':
612 return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
613
614 case 'gb18030':
615 return 'GB18030';
616
617 case 'chinese':
618 case 'cp936':
619 case 'csgb2312':
620 case 'csiso58gb231280':
621 case 'gb2312':
622 case 'gb231280':
623 case 'gbk':
624 case 'isoir58':
625 case 'ms936':
626 case 'windows936':
627 return 'GBK';
628
629 case 'cn':
630 case 'csiso57gb1988':
631 case 'gb198880':
632 case 'iso646cn':
633 case 'isoir57':
634 return 'GB_1988-80';
635
636 case 'csiso153gost1976874':
637 case 'gost1976874':
638 case 'isoir153':
639 case 'stsev35888':
640 return 'GOST_19768-74';
641
642 case 'csiso150':
643 case 'csiso150greekccitt':
644 case 'greekccitt':
645 case 'isoir150':
646 return 'greek-ccitt';
647
648 case 'csiso88greek7':
649 case 'greek7':
650 case 'isoir88':
651 return 'greek7';
652
653 case 'csiso18greek7old':
654 case 'greek7old':
655 case 'isoir18':
656 return 'greek7-old';
657
658 case 'cshpdesktop':
659 case 'hpdesktop':
660 return 'HP-DeskTop';
661
662 case 'cshplegal':
663 case 'hplegal':
664 return 'HP-Legal';
665
666 case 'cshpmath8':
667 case 'hpmath8':
668 return 'HP-Math8';
669
670 case 'cshppifont':
671 case 'hppifont':
672 return 'HP-Pi-font';
673
674 case 'cshproman8':
675 case 'hproman8':
676 case 'r8':
677 case 'roman8':
678 return 'hp-roman8';
679
680 case 'hzgb2312':
681 return 'HZ-GB-2312';
682
683 case 'csibmsymbols':
684 case 'ibmsymbols':
685 return 'IBM-Symbols';
686
687 case 'csibmthai':
688 case 'ibmthai':
689 return 'IBM-Thai';
690
691 case 'cp37':
692 case 'csibm37':
693 case 'ebcdiccpca':
694 case 'ebcdiccpnl':
695 case 'ebcdiccpus':
696 case 'ebcdiccpwt':
697 case 'ibm37':
698 return 'IBM037';
699
700 case 'cp38':
701 case 'csibm38':
702 case 'ebcdicint':
703 case 'ibm38':
704 return 'IBM038';
705
706 case 'cp273':
707 case 'csibm273':
708 case 'ibm273':
709 return 'IBM273';
710
711 case 'cp274':
712 case 'csibm274':
713 case 'ebcdicbe':
714 case 'ibm274':
715 return 'IBM274';
716
717 case 'cp275':
718 case 'csibm275':
719 case 'ebcdicbr':
720 case 'ibm275':
721 return 'IBM275';
722
723 case 'csibm277':
724 case 'ebcdiccpdk':
725 case 'ebcdiccpno':
726 case 'ibm277':
727 return 'IBM277';
728
729 case 'cp278':
730 case 'csibm278':
731 case 'ebcdiccpfi':
732 case 'ebcdiccpse':
733 case 'ibm278':
734 return 'IBM278';
735
736 case 'cp280':
737 case 'csibm280':
738 case 'ebcdiccpit':
739 case 'ibm280':
740 return 'IBM280';
741
742 case 'cp281':
743 case 'csibm281':
744 case 'ebcdicjpe':
745 case 'ibm281':
746 return 'IBM281';
747
748 case 'cp284':
749 case 'csibm284':
750 case 'ebcdiccpes':
751 case 'ibm284':
752 return 'IBM284';
753
754 case 'cp285':
755 case 'csibm285':
756 case 'ebcdiccpgb':
757 case 'ibm285':
758 return 'IBM285';
759
760 case 'cp290':
761 case 'csibm290':
762 case 'ebcdicjpkana':
763 case 'ibm290':
764 return 'IBM290';
765
766 case 'cp297':
767 case 'csibm297':
768 case 'ebcdiccpfr':
769 case 'ibm297':
770 return 'IBM297';
771
772 case 'cp420':
773 case 'csibm420':
774 case 'ebcdiccpar1':
775 case 'ibm420':
776 return 'IBM420';
777
778 case 'cp423':
779 case 'csibm423':
780 case 'ebcdiccpgr':
781 case 'ibm423':
782 return 'IBM423';
783
784 case 'cp424':
785 case 'csibm424':
786 case 'ebcdiccphe':
787 case 'ibm424':
788 return 'IBM424';
789
790 case '437':
791 case 'cp437':
792 case 'cspc8codepage437':
793 case 'ibm437':
794 return 'IBM437';
795
796 case 'cp500':
797 case 'csibm500':
798 case 'ebcdiccpbe':
799 case 'ebcdiccpch':
800 case 'ibm500':
801 return 'IBM500';
802
803 case 'cp775':
804 case 'cspc775baltic':
805 case 'ibm775':
806 return 'IBM775';
807
808 case '850':
809 case 'cp850':
810 case 'cspc850multilingual':
811 case 'ibm850':
812 return 'IBM850';
813
814 case '851':
815 case 'cp851':
816 case 'csibm851':
817 case 'ibm851':
818 return 'IBM851';
819
820 case '852':
821 case 'cp852':
822 case 'cspcp852':
823 case 'ibm852':
824 return 'IBM852';
825
826 case '855':
827 case 'cp855':
828 case 'csibm855':
829 case 'ibm855':
830 return 'IBM855';
831
832 case '857':
833 case 'cp857':
834 case 'csibm857':
835 case 'ibm857':
836 return 'IBM857';
837
838 case 'ccsid858':
839 case 'cp858':
840 case 'ibm858':
841 case 'pcmultilingual850euro':
842 return 'IBM00858';
843
844 case '860':
845 case 'cp860':
846 case 'csibm860':
847 case 'ibm860':
848 return 'IBM860';
849
850 case '861':
851 case 'cp861':
852 case 'cpis':
853 case 'csibm861':
854 case 'ibm861':
855 return 'IBM861';
856
857 case '862':
858 case 'cp862':
859 case 'cspc862latinhebrew':
860 case 'ibm862':
861 return 'IBM862';
862
863 case '863':
864 case 'cp863':
865 case 'csibm863':
866 case 'ibm863':
867 return 'IBM863';
868
869 case 'cp864':
870 case 'csibm864':
871 case 'ibm864':
872 return 'IBM864';
873
874 case '865':
875 case 'cp865':
876 case 'csibm865':
877 case 'ibm865':
878 return 'IBM865';
879
880 case '866':
881 case 'cp866':
882 case 'csibm866':
883 case 'ibm866':
884 return 'IBM866';
885
886 case 'cp868':
887 case 'cpar':
888 case 'csibm868':
889 case 'ibm868':
890 return 'IBM868';
891
892 case '869':
893 case 'cp869':
894 case 'cpgr':
895 case 'csibm869':
896 case 'ibm869':
897 return 'IBM869';
898
899 case 'cp870':
900 case 'csibm870':
901 case 'ebcdiccproece':
902 case 'ebcdiccpyu':
903 case 'ibm870':
904 return 'IBM870';
905
906 case 'cp871':
907 case 'csibm871':
908 case 'ebcdiccpis':
909 case 'ibm871':
910 return 'IBM871';
911
912 case 'cp880':
913 case 'csibm880':
914 case 'ebcdiccyrillic':
915 case 'ibm880':
916 return 'IBM880';
917
918 case 'cp891':
919 case 'csibm891':
920 case 'ibm891':
921 return 'IBM891';
922
923 case 'cp903':
924 case 'csibm903':
925 case 'ibm903':
926 return 'IBM903';
927
928 case '904':
929 case 'cp904':
930 case 'csibbm904':
931 case 'ibm904':
932 return 'IBM904';
933
934 case 'cp905':
935 case 'csibm905':
936 case 'ebcdiccptr':
937 case 'ibm905':
938 return 'IBM905';
939
940 case 'cp918':
941 case 'csibm918':
942 case 'ebcdiccpar2':
943 case 'ibm918':
944 return 'IBM918';
945
946 case 'ccsid924':
947 case 'cp924':
948 case 'ebcdiclatin9euro':
949 case 'ibm924':
950 return 'IBM00924';
951
952 case 'cp1026':
953 case 'csibm1026':
954 case 'ibm1026':
955 return 'IBM1026';
956
957 case 'ibm1047':
958 return 'IBM1047';
959
960 case 'ccsid1140':
961 case 'cp1140':
962 case 'ebcdicus37euro':
963 case 'ibm1140':
964 return 'IBM01140';
965
966 case 'ccsid1141':
967 case 'cp1141':
968 case 'ebcdicde273euro':
969 case 'ibm1141':
970 return 'IBM01141';
971
972 case 'ccsid1142':
973 case 'cp1142':
974 case 'ebcdicdk277euro':
975 case 'ebcdicno277euro':
976 case 'ibm1142':
977 return 'IBM01142';
978
979 case 'ccsid1143':
980 case 'cp1143':
981 case 'ebcdicfi278euro':
982 case 'ebcdicse278euro':
983 case 'ibm1143':
984 return 'IBM01143';
985
986 case 'ccsid1144':
987 case 'cp1144':
988 case 'ebcdicit280euro':
989 case 'ibm1144':
990 return 'IBM01144';
991
992 case 'ccsid1145':
993 case 'cp1145':
994 case 'ebcdices284euro':
995 case 'ibm1145':
996 return 'IBM01145';
997
998 case 'ccsid1146':
999 case 'cp1146':
1000 case 'ebcdicgb285euro':
1001 case 'ibm1146':
1002 return 'IBM01146';
1003
1004 case 'ccsid1147':
1005 case 'cp1147':
1006 case 'ebcdicfr297euro':
1007 case 'ibm1147':
1008 return 'IBM01147';
1009
1010 case 'ccsid1148':
1011 case 'cp1148':
1012 case 'ebcdicinternational500euro':
1013 case 'ibm1148':
1014 return 'IBM01148';
1015
1016 case 'ccsid1149':
1017 case 'cp1149':
1018 case 'ebcdicis871euro':
1019 case 'ibm1149':
1020 return 'IBM01149';
1021
1022 case 'csiso143iecp271':
1023 case 'iecp271':
1024 case 'isoir143':
1025 return 'IEC_P27-1';
1026
1027 case 'csiso49inis':
1028 case 'inis':
1029 case 'isoir49':
1030 return 'INIS';
1031
1032 case 'csiso50inis8':
1033 case 'inis8':
1034 case 'isoir50':
1035 return 'INIS-8';
1036
1037 case 'csiso51iniscyrillic':
1038 case 'iniscyrillic':
1039 case 'isoir51':
1040 return 'INIS-cyrillic';
1041
1042 case 'csinvariant':
1043 case 'invariant':
1044 return 'INVARIANT';
1045
1046 case 'iso2022cn':
1047 return 'ISO-2022-CN';
1048
1049 case 'iso2022cnext':
1050 return 'ISO-2022-CN-EXT';
1051
1052 case 'csiso2022jp':
1053 case 'iso2022jp':
1054 return 'ISO-2022-JP';
1055
1056 case 'csiso2022jp2':
1057 case 'iso2022jp2':
1058 return 'ISO-2022-JP-2';
1059
1060 case 'csiso2022kr':
1061 case 'iso2022kr':
1062 return 'ISO-2022-KR';
1063
1064 case 'cswindows30latin1':
1065 case 'iso88591windows30latin1':
1066 return 'ISO-8859-1-Windows-3.0-Latin-1';
1067
1068 case 'cswindows31latin1':
1069 case 'iso88591windows31latin1':
1070 return 'ISO-8859-1-Windows-3.1-Latin-1';
1071
1072 case 'csisolatin2':
1073 case 'iso88592':
1074 case 'iso885921987':
1075 case 'isoir101':
1076 case 'l2':
1077 case 'latin2':
1078 return 'ISO-8859-2';
1079
1080 case 'cswindows31latin2':
1081 case 'iso88592windowslatin2':
1082 return 'ISO-8859-2-Windows-Latin-2';
1083
1084 case 'csisolatin3':
1085 case 'iso88593':
1086 case 'iso885931988':
1087 case 'isoir109':
1088 case 'l3':
1089 case 'latin3':
1090 return 'ISO-8859-3';
1091
1092 case 'csisolatin4':
1093 case 'iso88594':
1094 case 'iso885941988':
1095 case 'isoir110':
1096 case 'l4':
1097 case 'latin4':
1098 return 'ISO-8859-4';
1099
1100 case 'csisolatincyrillic':
1101 case 'cyrillic':
1102 case 'iso88595':
1103 case 'iso885951988':
1104 case 'isoir144':
1105 return 'ISO-8859-5';
1106
1107 case 'arabic':
1108 case 'asmo708':
1109 case 'csisolatinarabic':
1110 case 'ecma114':
1111 case 'iso88596':
1112 case 'iso885961987':
1113 case 'isoir127':
1114 return 'ISO-8859-6';
1115
1116 case 'csiso88596e':
1117 case 'iso88596e':
1118 return 'ISO-8859-6-E';
1119
1120 case 'csiso88596i':
1121 case 'iso88596i':
1122 return 'ISO-8859-6-I';
1123
1124 case 'csisolatingreek':
1125 case 'ecma118':
1126 case 'elot928':
1127 case 'greek':
1128 case 'greek8':
1129 case 'iso88597':
1130 case 'iso885971987':
1131 case 'isoir126':
1132 return 'ISO-8859-7';
1133
1134 case 'csisolatinhebrew':
1135 case 'hebrew':
1136 case 'iso88598':
1137 case 'iso885981988':
1138 case 'isoir138':
1139 return 'ISO-8859-8';
1140
1141 case 'csiso88598e':
1142 case 'iso88598e':
1143 return 'ISO-8859-8-E';
1144
1145 case 'csiso88598i':
1146 case 'iso88598i':
1147 return 'ISO-8859-8-I';
1148
1149 case 'cswindows31latin5':
1150 case 'iso88599windowslatin5':
1151 return 'ISO-8859-9-Windows-Latin-5';
1152
1153 case 'csisolatin6':
1154 case 'iso885910':
1155 case 'iso8859101992':
1156 case 'isoir157':
1157 case 'l6':
1158 case 'latin6':
1159 return 'ISO-8859-10';
1160
1161 case 'iso885913':
1162 return 'ISO-8859-13';
1163
1164 case 'iso885914':
1165 case 'iso8859141998':
1166 case 'isoceltic':
1167 case 'isoir199':
1168 case 'l8':
1169 case 'latin8':
1170 return 'ISO-8859-14';
1171
1172 case 'iso885915':
1173 case 'latin9':
1174 return 'ISO-8859-15';
1175
1176 case 'iso885916':
1177 case 'iso8859162001':
1178 case 'isoir226':
1179 case 'l10':
1180 case 'latin10':
1181 return 'ISO-8859-16';
1182
1183 case 'iso10646j1':
1184 return 'ISO-10646-J-1';
1185
1186 case 'csunicode':
1187 case 'iso10646ucs2':
1188 return 'ISO-10646-UCS-2';
1189
1190 case 'csucs4':
1191 case 'iso10646ucs4':
1192 return 'ISO-10646-UCS-4';
1193
1194 case 'csunicodeascii':
1195 case 'iso10646ucsbasic':
1196 return 'ISO-10646-UCS-Basic';
1197
1198 case 'csunicodelatin1':
1199 case 'iso10646':
1200 case 'iso10646unicodelatin1':
1201 return 'ISO-10646-Unicode-Latin1';
1202
1203 case 'csiso10646utf1':
1204 case 'iso10646utf1':
1205 return 'ISO-10646-UTF-1';
1206
1207 case 'csiso115481':
1208 case 'iso115481':
1209 case 'isotr115481':
1210 return 'ISO-11548-1';
1211
1212 case 'csiso90':
1213 case 'isoir90':
1214 return 'iso-ir-90';
1215
1216 case 'csunicodeibm1261':
1217 case 'isounicodeibm1261':
1218 return 'ISO-Unicode-IBM-1261';
1219
1220 case 'csunicodeibm1264':
1221 case 'isounicodeibm1264':
1222 return 'ISO-Unicode-IBM-1264';
1223
1224 case 'csunicodeibm1265':
1225 case 'isounicodeibm1265':
1226 return 'ISO-Unicode-IBM-1265';
1227
1228 case 'csunicodeibm1268':
1229 case 'isounicodeibm1268':
1230 return 'ISO-Unicode-IBM-1268';
1231
1232 case 'csunicodeibm1276':
1233 case 'isounicodeibm1276':
1234 return 'ISO-Unicode-IBM-1276';
1235
1236 case 'csiso646basic1983':
1237 case 'iso646basic1983':
1238 case 'ref':
1239 return 'ISO_646.basic:1983';
1240
1241 case 'csiso2intlrefversion':
1242 case 'irv':
1243 case 'iso646irv1983':
1244 case 'isoir2':
1245 return 'ISO_646.irv:1983';
1246
1247 case 'csiso2033':
1248 case 'e13b':
1249 case 'iso20331983':
1250 case 'isoir98':
1251 return 'ISO_2033-1983';
1252
1253 case 'csiso5427cyrillic':
1254 case 'iso5427':
1255 case 'isoir37':
1256 return 'ISO_5427';
1257
1258 case 'iso5427cyrillic1981':
1259 case 'iso54271981':
1260 case 'isoir54':
1261 return 'ISO_5427:1981';
1262
1263 case 'csiso5428greek':
1264 case 'iso54281980':
1265 case 'isoir55':
1266 return 'ISO_5428:1980';
1267
1268 case 'csiso6937add':
1269 case 'iso6937225':
1270 case 'isoir152':
1271 return 'ISO_6937-2-25';
1272
1273 case 'csisotextcomm':
1274 case 'iso69372add':
1275 case 'isoir142':
1276 return 'ISO_6937-2-add';
1277
1278 case 'csiso8859supp':
1279 case 'iso8859supp':
1280 case 'isoir154':
1281 case 'latin125':
1282 return 'ISO_8859-supp';
1283
1284 case 'csiso10367box':
1285 case 'iso10367box':
1286 case 'isoir155':
1287 return 'ISO_10367-box';
1288
1289 case 'csiso15italian':
1290 case 'iso646it':
1291 case 'isoir15':
1292 case 'it':
1293 return 'IT';
1294
1295 case 'csiso13jisc6220jp':
1296 case 'isoir13':
1297 case 'jisc62201969':
1298 case 'jisc62201969jp':
1299 case 'katakana':
1300 case 'x2017':
1301 return 'JIS_C6220-1969-jp';
1302
1303 case 'csiso14jisc6220ro':
1304 case 'iso646jp':
1305 case 'isoir14':
1306 case 'jisc62201969ro':
1307 case 'jp':
1308 return 'JIS_C6220-1969-ro';
1309
1310 case 'csiso42jisc62261978':
1311 case 'isoir42':
1312 case 'jisc62261978':
1313 return 'JIS_C6226-1978';
1314
1315 case 'csiso87jisx208':
1316 case 'isoir87':
1317 case 'jisc62261983':
1318 case 'jisx2081983':
1319 case 'x208':
1320 return 'JIS_C6226-1983';
1321
1322 case 'csiso91jisc62291984a':
1323 case 'isoir91':
1324 case 'jisc62291984a':
1325 case 'jpocra':
1326 return 'JIS_C6229-1984-a';
1327
1328 case 'csiso92jisc62991984b':
1329 case 'iso646jpocrb':
1330 case 'isoir92':
1331 case 'jisc62291984b':
1332 case 'jpocrb':
1333 return 'JIS_C6229-1984-b';
1334
1335 case 'csiso93jis62291984badd':
1336 case 'isoir93':
1337 case 'jisc62291984badd':
1338 case 'jpocrbadd':
1339 return 'JIS_C6229-1984-b-add';
1340
1341 case 'csiso94jis62291984hand':
1342 case 'isoir94':
1343 case 'jisc62291984hand':
1344 case 'jpocrhand':
1345 return 'JIS_C6229-1984-hand';
1346
1347 case 'csiso95jis62291984handadd':
1348 case 'isoir95':
1349 case 'jisc62291984handadd':
1350 case 'jpocrhandadd':
1351 return 'JIS_C6229-1984-hand-add';
1352
1353 case 'csiso96jisc62291984kana':
1354 case 'isoir96':
1355 case 'jisc62291984kana':
1356 return 'JIS_C6229-1984-kana';
1357
1358 case 'csjisencoding':
1359 case 'jisencoding':
1360 return 'JIS_Encoding';
1361
1362 case 'cshalfwidthkatakana':
1363 case 'jisx201':
1364 case 'x201':
1365 return 'JIS_X0201';
1366
1367 case 'csiso159jisx2121990':
1368 case 'isoir159':
1369 case 'jisx2121990':
1370 case 'x212':
1371 return 'JIS_X0212-1990';
1372
1373 case 'csiso141jusib1002':
1374 case 'iso646yu':
1375 case 'isoir141':
1376 case 'js':
1377 case 'jusib1002':
1378 case 'yu':
1379 return 'JUS_I.B1.002';
1380
1381 case 'csiso147macedonian':
1382 case 'isoir147':
1383 case 'jusib1003mac':
1384 case 'macedonian':
1385 return 'JUS_I.B1.003-mac';
1386
1387 case 'csiso146serbian':
1388 case 'isoir146':
1389 case 'jusib1003serb':
1390 case 'serbian':
1391 return 'JUS_I.B1.003-serb';
1392
1393 case 'koi7switched':
1394 return 'KOI7-switched';
1395
1396 case 'cskoi8r':
1397 case 'koi8r':
1398 return 'KOI8-R';
1399
1400 case 'koi8u':
1401 return 'KOI8-U';
1402
1403 case 'csksc5636':
1404 case 'iso646kr':
1405 case 'ksc5636':
1406 return 'KSC5636';
1407
1408 case 'cskz1048':
1409 case 'kz1048':
1410 case 'rk1048':
1411 case 'strk10482002':
1412 return 'KZ-1048';
1413
1414 case 'csiso19latingreek':
1415 case 'isoir19':
1416 case 'latingreek':
1417 return 'latin-greek';
1418
1419 case 'csiso27latingreek1':
1420 case 'isoir27':
1421 case 'latingreek1':
1422 return 'Latin-greek-1';
1423
1424 case 'csiso158lap':
1425 case 'isoir158':
1426 case 'lap':
1427 case 'latinlap':
1428 return 'latin-lap';
1429
1430 case 'csmacintosh':
1431 case 'mac':
1432 case 'macintosh':
1433 return 'macintosh';
1434
1435 case 'csmicrosoftpublishing':
1436 case 'microsoftpublishing':
1437 return 'Microsoft-Publishing';
1438
1439 case 'csmnem':
1440 case 'mnem':
1441 return 'MNEM';
1442
1443 case 'csmnemonic':
1444 case 'mnemonic':
1445 return 'MNEMONIC';
1446
1447 case 'csiso86hungarian':
1448 case 'hu':
1449 case 'iso646hu':
1450 case 'isoir86':
1451 case 'msz77953':
1452 return 'MSZ_7795.3';
1453
1454 case 'csnatsdano':
1455 case 'isoir91':
1456 case 'natsdano':
1457 return 'NATS-DANO';
1458
1459 case 'csnatsdanoadd':
1460 case 'isoir92':
1461 case 'natsdanoadd':
1462 return 'NATS-DANO-ADD';
1463
1464 case 'csnatssefi':
1465 case 'isoir81':
1466 case 'natssefi':
1467 return 'NATS-SEFI';
1468
1469 case 'csnatssefiadd':
1470 case 'isoir82':
1471 case 'natssefiadd':
1472 return 'NATS-SEFI-ADD';
1473
1474 case 'csiso151cuba':
1475 case 'cuba':
1476 case 'iso646cu':
1477 case 'isoir151':
1478 case 'ncnc1081':
1479 return 'NC_NC00-10:81';
1480
1481 case 'csiso69french':
1482 case 'fr':
1483 case 'iso646fr':
1484 case 'isoir69':
1485 case 'nfz62010':
1486 return 'NF_Z_62-010';
1487
1488 case 'csiso25french':
1489 case 'iso646fr1':
1490 case 'isoir25':
1491 case 'nfz620101973':
1492 return 'NF_Z_62-010_(1973)';
1493
1494 case 'csiso60danishnorwegian':
1495 case 'csiso60norwegian1':
1496 case 'iso646no':
1497 case 'isoir60':
1498 case 'no':
1499 case 'ns45511':
1500 return 'NS_4551-1';
1501
1502 case 'csiso61norwegian2':
1503 case 'iso646no2':
1504 case 'isoir61':
1505 case 'no2':
1506 case 'ns45512':
1507 return 'NS_4551-2';
1508
1509 case 'osdebcdicdf3irv':
1510 return 'OSD_EBCDIC_DF03_IRV';
1511
1512 case 'osdebcdicdf41':
1513 return 'OSD_EBCDIC_DF04_1';
1514
1515 case 'osdebcdicdf415':
1516 return 'OSD_EBCDIC_DF04_15';
1517
1518 case 'cspc8danishnorwegian':
1519 case 'pc8danishnorwegian':
1520 return 'PC8-Danish-Norwegian';
1521
1522 case 'cspc8turkish':
1523 case 'pc8turkish':
1524 return 'PC8-Turkish';
1525
1526 case 'csiso16portuguese':
1527 case 'iso646pt':
1528 case 'isoir16':
1529 case 'pt':
1530 return 'PT';
1531
1532 case 'csiso84portuguese2':
1533 case 'iso646pt2':
1534 case 'isoir84':
1535 case 'pt2':
1536 return 'PT2';
1537
1538 case 'cp154':
1539 case 'csptcp154':
1540 case 'cyrillicasian':
1541 case 'pt154':
1542 case 'ptcp154':
1543 return 'PTCP154';
1544
1545 case 'scsu':
1546 return 'SCSU';
1547
1548 case 'csiso10swedish':
1549 case 'fi':
1550 case 'iso646fi':
1551 case 'iso646se':
1552 case 'isoir10':
1553 case 'se':
1554 case 'sen850200b':
1555 return 'SEN_850200_B';
1556
1557 case 'csiso11swedishfornames':
1558 case 'iso646se2':
1559 case 'isoir11':
1560 case 'se2':
1561 case 'sen850200c':
1562 return 'SEN_850200_C';
1563
1564 case 'csiso102t617bit':
1565 case 'isoir102':
1566 case 't617bit':
1567 return 'T.61-7bit';
1568
1569 case 'csiso103t618bit':
1570 case 'isoir103':
1571 case 't61':
1572 case 't618bit':
1573 return 'T.61-8bit';
1574
1575 case 'csiso128t101g2':
1576 case 'isoir128':
1577 case 't101g2':
1578 return 'T.101-G2';
1579
1580 case 'cstscii':
1581 case 'tscii':
1582 return 'TSCII';
1583
1584 case 'csunicode11':
1585 case 'unicode11':
1586 return 'UNICODE-1-1';
1587
1588 case 'csunicode11utf7':
1589 case 'unicode11utf7':
1590 return 'UNICODE-1-1-UTF-7';
1591
1592 case 'csunknown8bit':
1593 case 'unknown8bit':
1594 return 'UNKNOWN-8BIT';
1595
1596 case 'ansix341968':
1597 case 'ansix341986':
1598 case 'ascii':
1599 case 'cp367':
1600 case 'csascii':
1601 case 'ibm367':
1602 case 'iso646irv1991':
1603 case 'iso646us':
1604 case 'isoir6':
1605 case 'us':
1606 case 'usascii':
1607 return 'US-ASCII';
1608
1609 case 'csusdk':
1610 case 'usdk':
1611 return 'us-dk';
1612
1613 case 'utf7':
1614 return 'UTF-7';
1615
1616 case 'utf8':
1617 return 'UTF-8';
1618
1619 case 'utf16':
1620 return 'UTF-16';
1621
1622 case 'utf16be':
1623 return 'UTF-16BE';
1624
1625 case 'utf16le':
1626 return 'UTF-16LE';
1627
1628 case 'utf32':
1629 return 'UTF-32';
1630
1631 case 'utf32be':
1632 return 'UTF-32BE';
1633
1634 case 'utf32le':
1635 return 'UTF-32LE';
1636
1637 case 'csventurainternational':
1638 case 'venturainternational':
1639 return 'Ventura-International';
1640
1641 case 'csventuramath':
1642 case 'venturamath':
1643 return 'Ventura-Math';
1644
1645 case 'csventuraus':
1646 case 'venturaus':
1647 return 'Ventura-US';
1648
1649 case 'csiso70videotexsupp1':
1650 case 'isoir70':
1651 case 'videotexsuppl':
1652 return 'videotex-suppl';
1653
1654 case 'csviqr':
1655 case 'viqr':
1656 return 'VIQR';
1657
1658 case 'csviscii':
1659 case 'viscii':
1660 return 'VISCII';
1661
1662 case 'csshiftjis':
1663 case 'cswindows31j':
1664 case 'mskanji':
1665 case 'shiftjis':
1666 case 'windows31j':
1667 return 'SJIS';
1668 //return 'Windows-31J';
1669
1670 case 'iso885911':
1671 case 'tis620':
1672 return 'windows-874';
1673
1674 case 'cseuckr':
1675 case 'csksc56011987':
1676 case 'euckr':
1677 case 'isoir149':
1678 case 'korean':
1679 case 'ksc5601':
1680 case 'ksc56011987':
1681 case 'ksc56011989':
1682 case 'windows949':
1683 return 'windows-949';
1684
1685 case 'windows1250':
1686 return 'windows-1250';
1687
1688 case 'windows1251':
1689 return 'windows-1251';
1690
1691 case 'cp819':
1692 case 'csisolatin1':
1693 case 'ibm819':
1694 case 'iso88591':
1695 case 'iso885911987':
1696 case 'isoir100':
1697 case 'l1':
1698 case 'latin1':
1699 case 'windows1252':
1700 return 'windows-1252';
1701
1702 case 'windows1253':
1703 return 'windows-1253';
1704
1705 case 'csisolatin5':
1706 case 'iso88599':
1707 case 'iso885991989':
1708 case 'isoir148':
1709 case 'l5':
1710 case 'latin5':
1711 case 'windows1254':
1712 return 'windows-1254';
1713
1714 case 'windows1255':
1715 return 'windows-1255';
1716
1717 case 'windows1256':
1718 return 'windows-1256';
1719
1720 case 'windows1257':
1721 return 'windows-1257';
1722
1723 case 'windows1258':
1724 return 'windows-1258';
1725
1726 default:
1727 return $charset;
1728 }
1729 }
1730
1731 public static function get_curl_version()
1732 {
1733 if (is_array($curl = curl_version()))
1734 {
1735 $curl = $curl['version'];
1736 }
1737 elseif (substr($curl, 0, 5) === 'curl/')
1738 {
1739 $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5));
1740 }
1741 elseif (substr($curl, 0, 8) === 'libcurl/')
1742 {
1743 $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8));
1744 }
1745 else
1746 {
1747 $curl = 0;
1748 }
1749 return $curl;
1750 }
1751
1752 public static function is_subclass_of($class1, $class2)
1753 {
1754 if (func_num_args() !== 2)
1755 {
1756 trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING);
1757 }
1758 elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1))
1759 {
1760 return is_subclass_of($class1, $class2);
1761 }
1762 elseif (is_string($class1) && is_string($class2))
1763 {
1764 if (class_exists($class1))
1765 {
1766 if (class_exists($class2))
1767 {
1768 $class2 = strtolower($class2);
1769 while ($class1 = strtolower(get_parent_class($class1)))
1770 {
1771 if ($class1 === $class2)
1772 {
1773 return true;
1774 }
1775 }
1776 }
1777 }
1778 else
1779 {
1780 trigger_error('Unknown class passed as parameter', E_USER_WARNNG);
1781 }
1782 }
1783 return false;
1784 }
1785
1786 /**
1787 * Strip HTML comments
1788 *
1789 * @param string $data Data to strip comments from
1790 * @return string Comment stripped string
1791 */
1792 public static function strip_comments($data)
1793 {
1794 $output = '';
1795 while (($start = strpos($data, '<!--')) !== false)
1796 {
1797 $output .= substr($data, 0, $start);
1798 if (($end = strpos($data, '-->', $start)) !== false)
1799 {
1800 $data = substr_replace($data, '', 0, $end + 3);
1801 }
1802 else
1803 {
1804 $data = '';
1805 }
1806 }
1807 return $output . $data;
1808 }
1809
1810 public static function parse_date($dt)
1811 {
1812 $parser = SimplePie_Parse_Date::get();
1813 return $parser->parse($dt);
1814 }
1815
1816 /**
1817 * Decode HTML entities
1818 *
1819 * @static
1820 * @param string $data Input data
1821 * @return string Output data
1822 */
1823 public static function entities_decode($data)
1824 {
1825 $decoder = new SimplePie_Decode_HTML_Entities($data);
1826 return $decoder->parse();
1827 }
1828
1829 /**
1830 * Remove RFC822 comments
1831 *
1832 * @param string $data Data to strip comments from
1833 * @return string Comment stripped string
1834 */
1835 public static function uncomment_rfc822($string)
1836 {
1837 $string = (string) $string;
1838 $position = 0;
1839 $length = strlen($string);
1840 $depth = 0;
1841
1842 $output = '';
1843
1844 while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
1845 {
1846 $output .= substr($string, $position, $pos - $position);
1847 $position = $pos + 1;
1848 if ($string[$pos - 1] !== '\\')
1849 {
1850 $depth++;
1851 while ($depth && $position < $length)
1852 {
1853 $position += strcspn($string, '()', $position);
1854 if ($string[$position - 1] === '\\')
1855 {
1856 $position++;
1857 continue;
1858 }
1859 elseif (isset($string[$position]))
1860 {
1861 switch ($string[$position])
1862 {
1863 case '(':
1864 $depth++;
1865 break;
1866
1867 case ')':
1868 $depth--;
1869 break;
1870 }
1871 $position++;
1872 }
1873 else
1874 {
1875 break;
1876 }
1877 }
1878 }
1879 else
1880 {
1881 $output .= '(';
1882 }
1883 }
1884 $output .= substr($string, $position);
1885
1886 return $output;
1887 }
1888
1889 public static function parse_mime($mime)
1890 {
1891 if (($pos = strpos($mime, ';')) === false)
1892 {
1893 return trim($mime);
1894 }
1895 else
1896 {
1897 return trim(substr($mime, 0, $pos));
1898 }
1899 }
1900
1901 public static function htmlspecialchars_decode($string, $quote_style)
1902 {
1903 if (function_exists('htmlspecialchars_decode'))
1904 {
1905 return htmlspecialchars_decode($string, $quote_style);
1906 }
1907 else
1908 {
1909 return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
1910 }
1911 }
1912
1913 public static function atom_03_construct_type($attribs)
1914 {
1915 if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64'))
1916 {
1917 $mode = SIMPLEPIE_CONSTRUCT_BASE64;
1918 }
1919 else
1920 {
1921 $mode = SIMPLEPIE_CONSTRUCT_NONE;
1922 }
1923 if (isset($attribs['']['type']))
1924 {
1925 switch (strtolower(trim($attribs['']['type'])))
1926 {
1927 case 'text':
1928 case 'text/plain':
1929 return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
1930
1931 case 'html':
1932 case 'text/html':
1933 return SIMPLEPIE_CONSTRUCT_HTML | $mode;
1934
1935 case 'xhtml':
1936 case 'application/xhtml+xml':
1937 return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
1938
1939 default:
1940 return SIMPLEPIE_CONSTRUCT_NONE | $mode;
1941 }
1942 }
1943 else
1944 {
1945 return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
1946 }
1947 }
1948
1949 public static function atom_10_construct_type($attribs)
1950 {
1951 if (isset($attribs['']['type']))
1952 {
1953 switch (strtolower(trim($attribs['']['type'])))
1954 {
1955 case 'text':
1956 return SIMPLEPIE_CONSTRUCT_TEXT;
1957
1958 case 'html':
1959 return SIMPLEPIE_CONSTRUCT_HTML;
1960
1961 case 'xhtml':
1962 return SIMPLEPIE_CONSTRUCT_XHTML;
1963
1964 default:
1965 return SIMPLEPIE_CONSTRUCT_NONE;
1966 }
1967 }
1968 return SIMPLEPIE_CONSTRUCT_TEXT;
1969 }
1970
1971 public static function atom_10_content_construct_type($attribs)
1972 {
1973 if (isset($attribs['']['type']))
1974 {
1975 $type = strtolower(trim($attribs['']['type']));
1976 switch ($type)
1977 {
1978 case 'text':
1979 return SIMPLEPIE_CONSTRUCT_TEXT;
1980
1981 case 'html':
1982 return SIMPLEPIE_CONSTRUCT_HTML;
1983
1984 case 'xhtml':
1985 return SIMPLEPIE_CONSTRUCT_XHTML;
1986 }
1987 if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/')
1988 {
1989 return SIMPLEPIE_CONSTRUCT_NONE;
1990 }
1991 else
1992 {
1993 return SIMPLEPIE_CONSTRUCT_BASE64;
1994 }
1995 }
1996 else
1997 {
1998 return SIMPLEPIE_CONSTRUCT_TEXT;
1999 }
2000 }
2001
2002 public static function is_isegment_nz_nc($string)
2003 {
2004 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);
2005 }
2006
2007 public static function space_seperated_tokens($string)
2008 {
2009 $space_characters = "\x20\x09\x0A\x0B\x0C\x0D";
2010 $string_length = strlen($string);
2011
2012 $position = strspn($string, $space_characters);
2013 $tokens = array();
2014
2015 while ($position < $string_length)
2016 {
2017 $len = strcspn($string, $space_characters, $position);
2018 $tokens[] = substr($string, $position, $len);
2019 $position += $len;
2020 $position += strspn($string, $space_characters, $position);
2021 }
2022
2023 return $tokens;
2024 }
2025
2026 public static function array_unique($array)
2027 {
2028 if (version_compare(PHP_VERSION, '5.2', '>='))
2029 {
2030 return array_unique($array);
2031 }
2032 else
2033 {
2034 $array = (array) $array;
2035 $new_array = array();
2036 $new_array_strings = array();
2037 foreach ($array as $key => $value)
2038 {
2039 if (is_object($value))
2040 {
2041 if (method_exists($value, '__toString'))
2042 {
2043 $cmp = $value->__toString();
2044 }
2045 else
2046 {
2047 trigger_error('Object of class ' . get_class($value) . ' could not be converted to string', E_USER_ERROR);
2048 }
2049 }
2050 elseif (is_array($value))
2051 {
2052 $cmp = (string) reset($value);
2053 }
2054 else
2055 {
2056 $cmp = (string) $value;
2057 }
2058 if (!in_array($cmp, $new_array_strings))
2059 {
2060 $new_array[$key] = $value;
2061 $new_array_strings[] = $cmp;
2062 }
2063 }
2064 return $new_array;
2065 }
2066 }
2067
2068 /**
2069 * Converts a unicode codepoint to a UTF-8 character
2070 *
2071 * @static
2072 * @param int $codepoint Unicode codepoint
2073 * @return string UTF-8 character
2074 */
2075 public static function codepoint_to_utf8($codepoint)
2076 {
2077 $codepoint = (int) $codepoint;
2078 if ($codepoint < 0)
2079 {
2080 return false;
2081 }
2082 else if ($codepoint <= 0x7f)
2083 {
2084 return chr($codepoint);
2085 }
2086 else if ($codepoint <= 0x7ff)
2087 {
2088 return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
2089 }
2090 else if ($codepoint <= 0xffff)
2091 {
2092 return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
2093 }
2094 else if ($codepoint <= 0x10ffff)
2095 {
2096 return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
2097 }
2098 else
2099 {
2100 // U+FFFD REPLACEMENT CHARACTER
2101 return "\xEF\xBF\xBD";
2102 }
2103 }
2104
2105 /**
2106 * Similar to parse_str()
2107 *
2108 * Returns an associative array of name/value pairs, where the value is an
2109 * array of values that have used the same name
2110 *
2111 * @static
2112 * @param string $str The input string.
2113 * @return array
2114 */
2115 public static function parse_str($str)
2116 {
2117 $return = array();
2118 $str = explode('&', $str);
2119
2120 foreach ($str as $section)
2121 {
2122 if (strpos($section, '=') !== false)
2123 {
2124 list($name, $value) = explode('=', $section, 2);
2125 $return[urldecode($name)][] = urldecode($value);
2126 }
2127 else
2128 {
2129 $return[urldecode($section)][] = null;
2130 }
2131 }
2132
2133 return $return;
2134 }
2135
2136 /**
2137 * Detect XML encoding, as per XML 1.0 Appendix F.1
2138 *
2139 * @todo Add support for EBCDIC
2140 * @param string $data XML data
2141 * @return array Possible encodings
2142 */
2143 public static function xml_encoding($data)
2144 {
2145 // UTF-32 Big Endian BOM
2146 if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
2147 {
2148 $encoding[] = 'UTF-32BE';
2149 }
2150 // UTF-32 Little Endian BOM
2151 elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
2152 {
2153 $encoding[] = 'UTF-32LE';
2154 }
2155 // UTF-16 Big Endian BOM
2156 elseif (substr($data, 0, 2) === "\xFE\xFF")
2157 {
2158 $encoding[] = 'UTF-16BE';
2159 }
2160 // UTF-16 Little Endian BOM
2161 elseif (substr($data, 0, 2) === "\xFF\xFE")
2162 {
2163 $encoding[] = 'UTF-16LE';
2164 }
2165 // UTF-8 BOM
2166 elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
2167 {
2168 $encoding[] = 'UTF-8';
2169 }
2170 // UTF-32 Big Endian Without BOM
2171 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")
2172 {
2173 if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E"))
2174 {
2175 $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
2176 if ($parser->parse())
2177 {
2178 $encoding[] = $parser->encoding;
2179 }
2180 }
2181 $encoding[] = 'UTF-32BE';
2182 }
2183 // UTF-32 Little Endian Without BOM
2184 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")
2185 {
2186 if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00"))
2187 {
2188 $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
2189 if ($parser->parse())
2190 {
2191 $encoding[] = $parser->encoding;
2192 }
2193 }
2194 $encoding[] = 'UTF-32LE';
2195 }
2196 // UTF-16 Big Endian Without BOM
2197 elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C")
2198 {
2199 if ($pos = strpos($data, "\x00\x3F\x00\x3E"))
2200 {
2201 $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
2202 if ($parser->parse())
2203 {
2204 $encoding[] = $parser->encoding;
2205 }
2206 }
2207 $encoding[] = 'UTF-16BE';
2208 }
2209 // UTF-16 Little Endian Without BOM
2210 elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00")
2211 {
2212 if ($pos = strpos($data, "\x3F\x00\x3E\x00"))
2213 {
2214 $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
2215 if ($parser->parse())
2216 {
2217 $encoding[] = $parser->encoding;
2218 }
2219 }
2220 $encoding[] = 'UTF-16LE';
2221 }
2222 // US-ASCII (or superset)
2223 elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C")
2224 {
2225 if ($pos = strpos($data, "\x3F\x3E"))
2226 {
2227 $parser = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
2228 if ($parser->parse())
2229 {
2230 $encoding[] = $parser->encoding;
2231 }
2232 }
2233 $encoding[] = 'UTF-8';
2234 }
2235 // Fallback to UTF-8
2236 else
2237 {
2238 $encoding[] = 'UTF-8';
2239 }
2240 return $encoding;
2241 }
2242
2243 public static function output_javascript()
2244 {
2245 if (function_exists('ob_gzhandler'))
2246 {
2247 ob_start('ob_gzhandler');
2248 }
2249 header('Content-type: text/javascript; charset: UTF-8');
2250 header('Cache-Control: must-revalidate');
2251 header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
2252 ?>
2253function embed_odeo(link) {
2254 document.writeln('<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+'"></embed>');
2255}
2256
2257function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
2258 if (placeholder != '') {
2259 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>');
2260 }
2261 else {
2262 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>');
2263 }
2264}
2265
2266function embed_flash(bgcolor, width, height, link, loop, type) {
2267 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>');
2268}
2269
2270function embed_flv(width, height, link, placeholder, loop, player) {
2271 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>');
2272}
2273
2274function embed_wmedia(width, height, link) {
2275 document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
2276}
2277 <?php
2278 }
2279
2280 /**
2281 * Get the SimplePie build timestamp
2282 *
2283 * Uses the git index if it exists, otherwise uses the modification time
2284 * of the newest file.
2285 */
2286 public static function get_build()
2287 {
2288 $root = dirname(dirname(__FILE__));
2289 if (file_exists($root . '/.git/index'))
2290 {
2291 return filemtime($root . '/.git/index');
2292 }
2293 elseif (file_exists($root . '/SimplePie'))
2294 {
2295 $time = 0;
2296 foreach (glob($root . '/SimplePie/*.php') as $file)
2297 {
2298 if (($mtime = filemtime($file)) > $time)
2299 {
2300 $time = $mtime;
2301 }
2302 }
2303 return $time;
2304 }
2305 elseif (file_exists(dirname(__FILE__) . '/Core.php'))
2306 {
2307 return filemtime(dirname(__FILE__) . '/Core.php');
2308 }
2309 else
2310 {
2311 return filemtime(__FILE__);
2312 }
2313 }
2314
2315 /**
2316 * Format debugging information
2317 */
2318 public static function debug(&$sp)
2319 {
2320 $info = 'SimplePie ' . SIMPLEPIE_VERSION . ' Build ' . SIMPLEPIE_BUILD . "\n";
2321 $info .= 'PHP ' . PHP_VERSION . "\n";
2322 if ($sp->error() !== null)
2323 {
2324 $info .= 'Error occurred: ' . $sp->error() . "\n";
2325 }
2326 else
2327 {
2328 $info .= "No error found.\n";
2329 }
2330 $info .= "Extensions:\n";
2331 $extensions = array('pcre', 'curl', 'zlib', 'mbstring', 'iconv', 'xmlreader', 'xml');
2332 foreach ($extensions as $ext)
2333 {
2334 if (extension_loaded($ext))
2335 {
2336 $info .= " $ext loaded\n";
2337 switch ($ext)
2338 {
2339 case 'pcre':
2340 $info .= ' Version ' . PCRE_VERSION . "\n";
2341 break;
2342 case 'curl':
2343 $version = curl_version();
2344 $info .= ' Version ' . $version['version'] . "\n";
2345 break;
2346 case 'mbstring':
2347 $info .= ' Overloading: ' . mb_get_info('func_overload') . "\n";
2348 break;
2349 case 'iconv':
2350 $info .= ' Version ' . ICONV_VERSION . "\n";
2351 break;
2352 case 'xml':
2353 $info .= ' Version ' . LIBXML_DOTTED_VERSION . "\n";
2354 break;
2355 }
2356 }
2357 else
2358 {
2359 $info .= " $ext not loaded\n";
2360 }
2361 }
2362 return $info;
2363 }
2364}
2365