branch | wordpress |
changeset 132 | 4d4862461b8d |
parent 109 | 03b0d1493584 |
131:a4642baaf829 | 132:4d4862461b8d |
---|---|
3 * SimplePie |
3 * SimplePie |
4 * |
4 * |
5 * A PHP-Based RSS and Atom Feed Framework. |
5 * A PHP-Based RSS and Atom Feed Framework. |
6 * Takes the hard work out of managing a complete RSS/Atom solution. |
6 * Takes the hard work out of managing a complete RSS/Atom solution. |
7 * |
7 * |
8 * Copyright (c) 2004-2008, Ryan Parman and Geoffrey Sneddon |
8 * Copyright (c) 2004-2009, Ryan Parman and Geoffrey Sneddon |
9 * All rights reserved. |
9 * All rights reserved. |
10 * |
10 * |
11 * Redistribution and use in source and binary forms, with or without modification, are |
11 * Redistribution and use in source and binary forms, with or without modification, are |
12 * permitted provided that the following conditions are met: |
12 * permitted provided that the following conditions are met: |
13 * |
13 * |
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
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 |
32 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
33 * POSSIBILITY OF SUCH DAMAGE. |
33 * POSSIBILITY OF SUCH DAMAGE. |
34 * |
34 * |
35 * @package SimplePie |
35 * @package SimplePie |
36 * @version 1.1.3 |
36 * @version 1.2 |
37 * @copyright 2004-2008 Ryan Parman, Geoffrey Sneddon |
37 * @copyright 2004-2009 Ryan Parman, Geoffrey Sneddon |
38 * @author Ryan Parman |
38 * @author Ryan Parman |
39 * @author Geoffrey Sneddon |
39 * @author Geoffrey Sneddon |
40 * @link http://simplepie.org/ SimplePie |
40 * @link http://simplepie.org/ SimplePie |
41 * @link http://simplepie.org/support/ Please submit all bug reports and feature requests to the SimplePie forums |
41 * @link http://simplepie.org/support/ Please submit all bug reports and feature requests to the SimplePie forums |
42 * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
42 * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
49 define('SIMPLEPIE_NAME', 'SimplePie'); |
49 define('SIMPLEPIE_NAME', 'SimplePie'); |
50 |
50 |
51 /** |
51 /** |
52 * SimplePie Version |
52 * SimplePie Version |
53 */ |
53 */ |
54 define('SIMPLEPIE_VERSION', '1.1.3'); |
54 define('SIMPLEPIE_VERSION', '1.2'); |
55 |
55 |
56 /** |
56 /** |
57 * SimplePie Build |
57 * SimplePie Build |
58 */ |
58 */ |
59 define('SIMPLEPIE_BUILD', 20081219); |
59 define('SIMPLEPIE_BUILD', '20090627192103'); |
60 |
60 |
61 /** |
61 /** |
62 * SimplePie Website URL |
62 * SimplePie Website URL |
63 */ |
63 */ |
64 define('SIMPLEPIE_URL', 'http://simplepie.org'); |
64 define('SIMPLEPIE_URL', 'http://simplepie.org'); |
240 * All constructs |
240 * All constructs |
241 */ |
241 */ |
242 define('SIMPLEPIE_CONSTRUCT_ALL', 63); |
242 define('SIMPLEPIE_CONSTRUCT_ALL', 63); |
243 |
243 |
244 /** |
244 /** |
245 * Don't change case |
|
246 */ |
|
247 define('SIMPLEPIE_SAME_CASE', 1); |
|
248 |
|
249 /** |
|
250 * Change to lowercase |
|
251 */ |
|
252 define('SIMPLEPIE_LOWERCASE', 2); |
|
253 |
|
254 /** |
|
255 * Change to uppercase |
|
256 */ |
|
257 define('SIMPLEPIE_UPPERCASE', 4); |
|
258 |
|
259 /** |
|
245 * PCRE for HTML attributes |
260 * PCRE for HTML attributes |
246 */ |
261 */ |
247 define('SIMPLEPIE_PCRE_HTML_ATTRIBUTE', '((?:[\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]*)?))?)*)[\x09\x0A\x0B\x0C\x0D\x20]*'); |
262 define('SIMPLEPIE_PCRE_HTML_ATTRIBUTE', '((?:[\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]*)?))?)*)[\x09\x0A\x0B\x0C\x0D\x20]*'); |
248 |
263 |
249 /** |
264 /** |
374 |
389 |
375 /** |
390 /** |
376 * SimplePie |
391 * SimplePie |
377 * |
392 * |
378 * @package SimplePie |
393 * @package SimplePie |
379 * @version "Razzleberry" |
|
380 * @copyright 2004-2007 Ryan Parman, Geoffrey Sneddon |
|
381 * @author Ryan Parman |
|
382 * @author Geoffrey Sneddon |
|
383 * @todo Option for type of fetching (cache, not modified header, fetch, etc.) |
|
384 */ |
394 */ |
385 class SimplePie |
395 class SimplePie |
386 { |
396 { |
387 /** |
397 /** |
388 * @var array Raw data |
398 * @var array Raw data |
635 * @var int Maximum number of feeds to check with autodiscovery |
645 * @var int Maximum number of feeds to check with autodiscovery |
636 * @see SimplePie::set_max_checked_feeds() |
646 * @see SimplePie::set_max_checked_feeds() |
637 * @access private |
647 * @access private |
638 */ |
648 */ |
639 var $max_checked_feeds = 10; |
649 var $max_checked_feeds = 10; |
650 |
|
651 /** |
|
652 * @var array All the feeds found during the autodiscovery process |
|
653 * @see SimplePie::get_all_discovered_feeds() |
|
654 * @access private |
|
655 */ |
|
656 var $all_discovered_feeds = array(); |
|
640 |
657 |
641 /** |
658 /** |
642 * @var string Web-accessible path to the handler_favicon.php file. |
659 * @var string Web-accessible path to the handler_favicon.php file. |
643 * @see SimplePie::set_favicon_handler() |
660 * @see SimplePie::set_favicon_handler() |
644 * @access private |
661 * @access private |
1438 * @param str $page Web-accessible path to the handler_favicon.php file. |
1455 * @param str $page Web-accessible path to the handler_favicon.php file. |
1439 * @param str $qs The query string that the value should be passed to. |
1456 * @param str $qs The query string that the value should be passed to. |
1440 */ |
1457 */ |
1441 function set_favicon_handler($page = false, $qs = 'i') |
1458 function set_favicon_handler($page = false, $qs = 'i') |
1442 { |
1459 { |
1443 if ($page != false) |
1460 if ($page !== false) |
1444 { |
1461 { |
1445 $this->favicon_handler = $page . '?' . $qs . '='; |
1462 $this->favicon_handler = $page . '?' . $qs . '='; |
1446 } |
1463 } |
1447 else |
1464 else |
1448 { |
1465 { |
1457 * @param str $page Web-accessible path to the handler_image.php file. |
1474 * @param str $page Web-accessible path to the handler_image.php file. |
1458 * @param str $qs The query string that the value should be passed to. |
1475 * @param str $qs The query string that the value should be passed to. |
1459 */ |
1476 */ |
1460 function set_image_handler($page = false, $qs = 'i') |
1477 function set_image_handler($page = false, $qs = 'i') |
1461 { |
1478 { |
1462 if ($page != false) |
1479 if ($page !== false) |
1463 { |
1480 { |
1464 $this->sanitize->set_image_handler($page . '?' . $qs . '='); |
1481 $this->sanitize->set_image_handler($page . '?' . $qs . '='); |
1465 } |
1482 } |
1466 else |
1483 else |
1467 { |
1484 { |
1480 $this->item_limit = (int) $limit; |
1497 $this->item_limit = (int) $limit; |
1481 } |
1498 } |
1482 |
1499 |
1483 function init() |
1500 function init() |
1484 { |
1501 { |
1502 // Check absolute bare minimum requirements. |
|
1485 if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.3.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre')) |
1503 if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.3.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre')) |
1486 { |
1504 { |
1487 return false; |
1505 return false; |
1488 } |
1506 } |
1507 // Then check the xml extension is sane (i.e., libxml 2.7.x issue on PHP < 5.2.9 and libxml 2.7.0 to 2.7.2 on any version) if we don't have xmlreader. |
|
1508 elseif (!extension_loaded('xmlreader')) |
|
1509 { |
|
1510 static $xml_is_sane = null; |
|
1511 if ($xml_is_sane === null) |
|
1512 { |
|
1513 $parser_check = xml_parser_create(); |
|
1514 xml_parse_into_struct($parser_check, '<foo>&</foo>', $values); |
|
1515 xml_parser_free($parser_check); |
|
1516 $xml_is_sane = isset($values[0]['value']); |
|
1517 } |
|
1518 if (!$xml_is_sane) |
|
1519 { |
|
1520 return false; |
|
1521 } |
|
1522 } |
|
1523 |
|
1489 if (isset($_GET[$this->javascript])) |
1524 if (isset($_GET[$this->javascript])) |
1490 { |
1525 { |
1491 if (function_exists('ob_gzhandler')) |
1526 SimplePie_Misc::output_javascript(); |
1492 { |
|
1493 ob_start('ob_gzhandler'); |
|
1494 } |
|
1495 header('Content-type: text/javascript; charset: UTF-8'); |
|
1496 header('Cache-Control: must-revalidate'); |
|
1497 header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days |
|
1498 ?> |
|
1499 function embed_odeo(link) { |
|
1500 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>'); |
|
1501 } |
|
1502 |
|
1503 function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) { |
|
1504 if (placeholder != '') { |
|
1505 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>'); |
|
1506 } |
|
1507 else { |
|
1508 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>'); |
|
1509 } |
|
1510 } |
|
1511 |
|
1512 function embed_flash(bgcolor, width, height, link, loop, type) { |
|
1513 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>'); |
|
1514 } |
|
1515 |
|
1516 function embed_flv(width, height, link, placeholder, loop, player) { |
|
1517 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>'); |
|
1518 } |
|
1519 |
|
1520 function embed_wmedia(width, height, link) { |
|
1521 document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>'); |
|
1522 } |
|
1523 <?php |
|
1524 exit; |
1527 exit; |
1525 } |
1528 } |
1526 |
1529 |
1527 // Pass whatever was set with config options over to the sanitizer. |
1530 // Pass whatever was set with config options over to the sanitizer. |
1528 $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->cache_class); |
1531 $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->cache_class); |
1548 // Load the Cache |
1551 // Load the Cache |
1549 $this->data = $cache->load(); |
1552 $this->data = $cache->load(); |
1550 if (!empty($this->data)) |
1553 if (!empty($this->data)) |
1551 { |
1554 { |
1552 // If the cache is for an outdated build of SimplePie |
1555 // If the cache is for an outdated build of SimplePie |
1553 if (!isset($this->data['build']) || $this->data['build'] != SIMPLEPIE_BUILD) |
1556 if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD) |
1554 { |
1557 { |
1555 $cache->unlink(); |
1558 $cache->unlink(); |
1556 $this->data = array(); |
1559 $this->data = array(); |
1557 } |
1560 } |
1558 // If we've hit a collision just rerun it with caching disabled |
1561 // If we've hit a collision just rerun it with caching disabled |
1559 elseif (isset($this->data['url']) && $this->data['url'] != $this->feed_url) |
1562 elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url) |
1560 { |
1563 { |
1561 $cache = false; |
1564 $cache = false; |
1562 $this->data = array(); |
1565 $this->data = array(); |
1563 } |
1566 } |
1564 // If we've got a non feed_url stored (if the page isn't actually a feed, or is a redirect) use that URL. |
1567 // If we've got a non feed_url stored (if the page isn't actually a feed, or is a redirect) use that URL. |
1566 { |
1569 { |
1567 // If the autodiscovery cache is still valid use it. |
1570 // If the autodiscovery cache is still valid use it. |
1568 if ($cache->mtime() + $this->autodiscovery_cache_duration > time()) |
1571 if ($cache->mtime() + $this->autodiscovery_cache_duration > time()) |
1569 { |
1572 { |
1570 // Do not need to do feed autodiscovery yet. |
1573 // Do not need to do feed autodiscovery yet. |
1571 if ($this->data['feed_url'] == $this->data['url']) |
1574 if ($this->data['feed_url'] === $this->data['url']) |
1572 { |
1575 { |
1573 $cache->unlink(); |
1576 $cache->unlink(); |
1574 $this->data = array(); |
1577 $this->data = array(); |
1575 } |
1578 } |
1576 else |
1579 else |
1596 $headers['if-none-match'] = '"' . $this->data['headers']['etag'] . '"'; |
1599 $headers['if-none-match'] = '"' . $this->data['headers']['etag'] . '"'; |
1597 } |
1600 } |
1598 $file =& new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen); |
1601 $file =& new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen); |
1599 if ($file->success) |
1602 if ($file->success) |
1600 { |
1603 { |
1601 if ($file->status_code == 304) |
1604 if ($file->status_code === 304) |
1602 { |
1605 { |
1603 $cache->touch(); |
1606 $cache->touch(); |
1604 return true; |
1607 return true; |
1605 } |
1608 } |
1606 else |
1609 else |
1628 } |
1631 } |
1629 } |
1632 } |
1630 // If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it. |
1633 // If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it. |
1631 if (!isset($file)) |
1634 if (!isset($file)) |
1632 { |
1635 { |
1633 if (is_a($this->file, 'SimplePie_File') && $this->file->url == $this->feed_url) |
1636 if (is_a($this->file, 'SimplePie_File') && $this->file->url === $this->feed_url) |
1634 { |
1637 { |
1635 $file =& $this->file; |
1638 $file =& $this->file; |
1636 } |
1639 } |
1637 else |
1640 else |
1638 { |
1641 { |
1639 $file =& new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen); |
1642 $file =& new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen); |
1640 } |
1643 } |
1641 } |
1644 } |
1642 // If the file connection has an error, set SimplePie::error to that and quit |
1645 // If the file connection has an error, set SimplePie::error to that and quit |
1643 if (!$file->success) |
1646 if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) |
1644 { |
1647 { |
1645 $this->error = $file->error; |
1648 $this->error = $file->error; |
1646 if (!empty($this->data)) |
1649 if (!empty($this->data)) |
1647 { |
1650 { |
1648 return true; |
1651 return true; |
1659 $locate =& new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class); |
1662 $locate =& new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class); |
1660 if (!$locate->is_feed($file)) |
1663 if (!$locate->is_feed($file)) |
1661 { |
1664 { |
1662 // We need to unset this so that if SimplePie::set_file() has been called that object is untouched |
1665 // We need to unset this so that if SimplePie::set_file() has been called that object is untouched |
1663 unset($file); |
1666 unset($file); |
1664 if ($file = $locate->find($this->autodiscovery)) |
1667 if ($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds)) |
1665 { |
1668 { |
1666 if ($cache) |
1669 if ($cache) |
1667 { |
1670 { |
1668 $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD); |
1671 $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD); |
1669 if (!$cache->save($this)) |
1672 if (!$cache->save($this)) |
1670 { |
1673 { |
1671 trigger_error("$cache->name is not writeable", E_USER_WARNING); |
1674 trigger_error("$this->cache_location is not writeable", E_USER_WARNING); |
1672 } |
1675 } |
1673 $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc'); |
1676 $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc'); |
1674 } |
1677 } |
1675 $this->feed_url = $file->url; |
1678 $this->feed_url = $file->url; |
1676 } |
1679 } |
1784 return false; |
1787 return false; |
1785 } |
1788 } |
1786 } |
1789 } |
1787 } |
1790 } |
1788 } |
1791 } |
1789 // We have an error, just set SimplePie::error to it and quit |
1792 if(isset($parser)) |
1790 $this->error = sprintf('XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column()); |
1793 { |
1794 // We have an error, just set SimplePie_Misc::error to it and quit |
|
1795 $this->error = sprintf('XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column()); |
|
1796 } |
|
1797 else |
|
1798 { |
|
1799 $this->error = 'The data could not be converted to UTF-8'; |
|
1800 } |
|
1791 SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__); |
1801 SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__); |
1792 return false; |
1802 return false; |
1793 } |
1803 } |
1794 elseif (!empty($this->multifeed_url)) |
1804 elseif (!empty($this->multifeed_url)) |
1795 { |
1805 { |
1880 || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput'])) |
1890 || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput'])) |
1881 { |
1891 { |
1882 $this->data['type'] &= SIMPLEPIE_TYPE_RSS_090; |
1892 $this->data['type'] &= SIMPLEPIE_TYPE_RSS_090; |
1883 } |
1893 } |
1884 } |
1894 } |
1885 elseif (isset($this->data['child']['']['rss'])) |
1895 elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'])) |
1886 { |
1896 { |
1887 $this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL; |
1897 $this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL; |
1888 if (isset($this->data['child']['']['rss'][0]['attribs']['']['version'])) |
1898 if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) |
1889 { |
1899 { |
1890 switch (trim($this->data['child']['']['rss'][0]['attribs']['']['version'])) |
1900 switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) |
1891 { |
1901 { |
1892 case '0.91': |
1902 case '0.91': |
1893 $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091; |
1903 $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091; |
1894 if (isset($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data'])) |
1904 if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) |
1895 { |
1905 { |
1896 switch (trim($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data'])) |
1906 switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) |
1897 { |
1907 { |
1898 case '0': |
1908 case '0': |
1899 $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE; |
1909 $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE; |
1900 break; |
1910 break; |
1901 |
1911 |
1960 } |
1970 } |
1961 else |
1971 else |
1962 { |
1972 { |
1963 $file =& new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen); |
1973 $file =& new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen); |
1964 |
1974 |
1965 if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0) |
1975 if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0) |
1966 { |
1976 { |
1967 $sniffer =& new $this->content_type_sniffer_class($file); |
1977 $sniffer =& new $this->content_type_sniffer_class($file); |
1968 if (substr($sniffer->get_type(), 0, 6) === 'image/') |
1978 if (substr($sniffer->get_type(), 0, 6) === 'image/') |
1969 { |
1979 { |
1970 if ($cache->save(array('headers' => $file->headers, 'body' => $file->body))) |
1980 if ($cache->save(array('headers' => $file->headers, 'body' => $file->body))) |
1975 { |
1985 { |
1976 trigger_error("$cache->name is not writeable", E_USER_WARNING); |
1986 trigger_error("$cache->name is not writeable", E_USER_WARNING); |
1977 return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI); |
1987 return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI); |
1978 } |
1988 } |
1979 } |
1989 } |
1990 // not an image |
|
1991 else |
|
1992 { |
|
1993 return false; |
|
1994 } |
|
1980 } |
1995 } |
1981 } |
1996 } |
1982 } |
1997 } |
1983 else |
1998 else |
1984 { |
1999 { |
2019 |
2034 |
2020 function subscribe_outlook() |
2035 function subscribe_outlook() |
2021 { |
2036 { |
2022 if ($this->feed_url !== null) |
2037 if ($this->feed_url !== null) |
2023 { |
2038 { |
2024 return 'outlook' . $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI); |
2039 return $this->sanitize('outlook' . SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI); |
2025 } |
2040 } |
2026 else |
2041 else |
2027 { |
2042 { |
2028 return null; |
2043 return null; |
2029 } |
2044 } |
2064 */ |
2079 */ |
2065 function subscribe_service($feed_url, $site_url = null) |
2080 function subscribe_service($feed_url, $site_url = null) |
2066 { |
2081 { |
2067 if ($this->subscribe_url()) |
2082 if ($this->subscribe_url()) |
2068 { |
2083 { |
2069 $return = $this->sanitize($feed_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->feed_url); |
2084 $return = $feed_url . rawurlencode($this->feed_url); |
2070 if ($site_url !== null && $this->get_link() !== null) |
2085 if ($site_url !== null && $this->get_link() !== null) |
2071 { |
2086 { |
2072 $return .= $this->sanitize($site_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_link()); |
2087 $return .= $site_url . rawurlencode($this->get_link()); |
2073 } |
2088 } |
2074 return $return; |
2089 return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI); |
2075 } |
2090 } |
2076 else |
2091 else |
2077 { |
2092 { |
2078 return null; |
2093 return null; |
2079 } |
2094 } |
2084 return $this->subscribe_service('http://feeds.my.aol.com/add.jsp?url='); |
2099 return $this->subscribe_service('http://feeds.my.aol.com/add.jsp?url='); |
2085 } |
2100 } |
2086 |
2101 |
2087 function subscribe_bloglines() |
2102 function subscribe_bloglines() |
2088 { |
2103 { |
2089 return urldecode($this->subscribe_service('http://www.bloglines.com/sub/')); |
2104 return $this->subscribe_service('http://www.bloglines.com/sub/'); |
2090 } |
2105 } |
2091 |
2106 |
2092 function subscribe_eskobo() |
2107 function subscribe_eskobo() |
2093 { |
2108 { |
2094 return $this->subscribe_service('http://www.eskobo.com/?AddToMyPage='); |
2109 return $this->subscribe_service('http://www.eskobo.com/?AddToMyPage='); |
2178 return $this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag]; |
2193 return $this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag]; |
2179 } |
2194 } |
2180 } |
2195 } |
2181 if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) |
2196 if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) |
2182 { |
2197 { |
2183 if (isset($this->data['child']['']['rss'][0]['child'][$namespace][$tag])) |
2198 if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag])) |
2184 { |
2199 { |
2185 return $this->data['child']['']['rss'][0]['child'][$namespace][$tag]; |
2200 return $this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag]; |
2186 } |
2201 } |
2187 } |
2202 } |
2188 return null; |
2203 return null; |
2189 } |
2204 } |
2190 |
2205 |
2218 } |
2233 } |
2219 } |
2234 } |
2220 } |
2235 } |
2221 if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) |
2236 if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) |
2222 { |
2237 { |
2223 if ($channel = $this->get_feed_tags('', 'channel')) |
2238 if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'channel')) |
2224 { |
2239 { |
2225 if (isset($channel[0]['child'][$namespace][$tag])) |
2240 if (isset($channel[0]['child'][$namespace][$tag])) |
2226 { |
2241 { |
2227 return $channel[0]['child'][$namespace][$tag]; |
2242 return $channel[0]['child'][$namespace][$tag]; |
2228 } |
2243 } |
2254 } |
2269 } |
2255 } |
2270 } |
2256 } |
2271 } |
2257 if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) |
2272 if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION) |
2258 { |
2273 { |
2259 if ($image = $this->get_channel_tags('', 'image')) |
2274 if ($image = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'image')) |
2260 { |
2275 { |
2261 if (isset($image[0]['child'][$namespace][$tag])) |
2276 if (isset($image[0]['child'][$namespace][$tag])) |
2262 { |
2277 { |
2263 return $image[0]['child'][$namespace][$tag]; |
2278 return $image[0]['child'][$namespace][$tag]; |
2264 } |
2279 } |
2304 } |
2319 } |
2305 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
2320 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
2306 { |
2321 { |
2307 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
2322 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
2308 } |
2323 } |
2309 elseif ($return = $this->get_channel_tags('', 'title')) |
2324 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) |
2310 { |
2325 { |
2311 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
2326 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
2312 } |
2327 } |
2313 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
2328 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
2314 { |
2329 { |
2358 { |
2373 { |
2359 $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); |
2374 $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); |
2360 } |
2375 } |
2361 $categories[] =& new $this->category_class($term, $scheme, $label); |
2376 $categories[] =& new $this->category_class($term, $scheme, $label); |
2362 } |
2377 } |
2363 foreach ((array) $this->get_channel_tags('', 'category') as $category) |
2378 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) |
2364 { |
2379 { |
2365 $categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); |
2380 // This is really the label, but keep this as the term also for BC. |
2381 // Label will also work on retrieving because that falls back to term. |
|
2382 $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
2383 if (isset($category['attribs']['']['domain'])) |
|
2384 { |
|
2385 $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
2386 } |
|
2387 else |
|
2388 { |
|
2389 $scheme = null; |
|
2390 } |
|
2391 $categories[] =& new $this->category_class($term, $scheme, null); |
|
2366 } |
2392 } |
2367 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) |
2393 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) |
2368 { |
2394 { |
2369 $categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); |
2395 $categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); |
2370 } |
2396 } |
2592 } |
2618 } |
2593 if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) |
2619 if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) |
2594 { |
2620 { |
2595 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
2621 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
2596 } |
2622 } |
2597 if ($links = $this->get_channel_tags('', 'link')) |
2623 if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) |
2598 { |
2624 { |
2599 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
2625 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
2600 } |
2626 } |
2601 |
2627 |
2602 $keys = array_keys($this->data['links']); |
2628 $keys = array_keys($this->data['links']); |
2612 else |
2638 else |
2613 { |
2639 { |
2614 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; |
2640 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; |
2615 } |
2641 } |
2616 } |
2642 } |
2617 elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
2643 elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
2618 { |
2644 { |
2619 $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; |
2645 $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; |
2620 } |
2646 } |
2621 $this->data['links'][$key] = array_unique($this->data['links'][$key]); |
2647 $this->data['links'][$key] = array_unique($this->data['links'][$key]); |
2622 } |
2648 } |
2630 { |
2656 { |
2631 return null; |
2657 return null; |
2632 } |
2658 } |
2633 } |
2659 } |
2634 |
2660 |
2661 function get_all_discovered_feeds() |
|
2662 { |
|
2663 return $this->all_discovered_feeds; |
|
2664 } |
|
2665 |
|
2635 function get_description() |
2666 function get_description() |
2636 { |
2667 { |
2637 if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) |
2668 if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) |
2638 { |
2669 { |
2639 return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); |
2670 return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0])); |
2648 } |
2679 } |
2649 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) |
2680 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) |
2650 { |
2681 { |
2651 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
2682 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
2652 } |
2683 } |
2653 elseif ($return = $this->get_channel_tags('', 'description')) |
2684 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) |
2654 { |
2685 { |
2655 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
2686 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); |
2656 } |
2687 } |
2657 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) |
2688 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) |
2658 { |
2689 { |
2659 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2690 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2660 } |
2691 } |
2684 } |
2715 } |
2685 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) |
2716 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) |
2686 { |
2717 { |
2687 return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); |
2718 return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); |
2688 } |
2719 } |
2689 elseif ($return = $this->get_channel_tags('', 'copyright')) |
2720 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) |
2690 { |
2721 { |
2691 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2722 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2692 } |
2723 } |
2693 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) |
2724 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) |
2694 { |
2725 { |
2704 } |
2735 } |
2705 } |
2736 } |
2706 |
2737 |
2707 function get_language() |
2738 function get_language() |
2708 { |
2739 { |
2709 if ($return = $this->get_channel_tags('', 'language')) |
2740 if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) |
2710 { |
2741 { |
2711 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2742 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2712 } |
2743 } |
2713 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) |
2744 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) |
2714 { |
2745 { |
2784 } |
2815 } |
2785 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
2816 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
2786 { |
2817 { |
2787 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2818 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2788 } |
2819 } |
2789 elseif ($return = $this->get_image_tags('', 'title')) |
2820 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) |
2790 { |
2821 { |
2791 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2822 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2792 } |
2823 } |
2793 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
2824 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
2794 { |
2825 { |
2824 } |
2855 } |
2825 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url')) |
2856 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url')) |
2826 { |
2857 { |
2827 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
2858 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
2828 } |
2859 } |
2829 elseif ($return = $this->get_image_tags('', 'url')) |
2860 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) |
2830 { |
2861 { |
2831 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
2862 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
2832 } |
2863 } |
2833 else |
2864 else |
2834 { |
2865 { |
2844 } |
2875 } |
2845 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) |
2876 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) |
2846 { |
2877 { |
2847 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
2878 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
2848 } |
2879 } |
2849 elseif ($return = $this->get_image_tags('', 'link')) |
2880 elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) |
2850 { |
2881 { |
2851 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
2882 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); |
2852 } |
2883 } |
2853 else |
2884 else |
2854 { |
2885 { |
2856 } |
2887 } |
2857 } |
2888 } |
2858 |
2889 |
2859 function get_image_width() |
2890 function get_image_width() |
2860 { |
2891 { |
2861 if ($return = $this->get_image_tags('', 'width')) |
2892 if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width')) |
2862 { |
2893 { |
2863 return round($return[0]['data']); |
2894 return round($return[0]['data']); |
2864 } |
2895 } |
2865 elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url')) |
2896 elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) |
2866 { |
2897 { |
2867 return 88.0; |
2898 return 88.0; |
2868 } |
2899 } |
2869 else |
2900 else |
2870 { |
2901 { |
2872 } |
2903 } |
2873 } |
2904 } |
2874 |
2905 |
2875 function get_image_height() |
2906 function get_image_height() |
2876 { |
2907 { |
2877 if ($return = $this->get_image_tags('', 'height')) |
2908 if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height')) |
2878 { |
2909 { |
2879 return round($return[0]['data']); |
2910 return round($return[0]['data']); |
2880 } |
2911 } |
2881 elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url')) |
2912 elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url')) |
2882 { |
2913 { |
2883 return 31.0; |
2914 return 31.0; |
2884 } |
2915 } |
2885 else |
2916 else |
2886 { |
2917 { |
2888 } |
2919 } |
2889 } |
2920 } |
2890 |
2921 |
2891 function get_item_quantity($max = 0) |
2922 function get_item_quantity($max = 0) |
2892 { |
2923 { |
2924 $max = (int) $max; |
|
2893 $qty = count($this->get_items()); |
2925 $qty = count($this->get_items()); |
2894 if ($max == 0) |
2926 if ($max === 0) |
2895 { |
2927 { |
2896 return $qty; |
2928 return $qty; |
2897 } |
2929 } |
2898 else |
2930 else |
2899 { |
2931 { |
2914 } |
2946 } |
2915 } |
2947 } |
2916 |
2948 |
2917 function get_items($start = 0, $end = 0) |
2949 function get_items($start = 0, $end = 0) |
2918 { |
2950 { |
2919 if (!empty($this->multifeed_objects)) |
2951 if (!isset($this->data['items'])) |
2920 { |
2952 { |
2921 return SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit); |
2953 if (!empty($this->multifeed_objects)) |
2922 } |
2954 { |
2923 elseif (!isset($this->data['items'])) |
2955 $this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit); |
2924 { |
2956 } |
2925 if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry')) |
2957 else |
2926 { |
2958 { |
2927 $keys = array_keys($items); |
2959 $this->data['items'] = array(); |
2928 foreach ($keys as $key) |
2960 if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry')) |
2929 { |
2961 { |
2930 $this->data['items'][] =& new $this->item_class($this, $items[$key]); |
2962 $keys = array_keys($items); |
2931 } |
2963 foreach ($keys as $key) |
2932 } |
2964 { |
2933 if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry')) |
2965 $this->data['items'][] =& new $this->item_class($this, $items[$key]); |
2934 { |
2966 } |
2935 $keys = array_keys($items); |
2967 } |
2936 foreach ($keys as $key) |
2968 if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry')) |
2937 { |
2969 { |
2938 $this->data['items'][] =& new $this->item_class($this, $items[$key]); |
2970 $keys = array_keys($items); |
2939 } |
2971 foreach ($keys as $key) |
2940 } |
2972 { |
2941 if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item')) |
2973 $this->data['items'][] =& new $this->item_class($this, $items[$key]); |
2942 { |
2974 } |
2943 $keys = array_keys($items); |
2975 } |
2944 foreach ($keys as $key) |
2976 if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item')) |
2945 { |
2977 { |
2946 $this->data['items'][] =& new $this->item_class($this, $items[$key]); |
2978 $keys = array_keys($items); |
2947 } |
2979 foreach ($keys as $key) |
2948 } |
2980 { |
2949 if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item')) |
2981 $this->data['items'][] =& new $this->item_class($this, $items[$key]); |
2950 { |
2982 } |
2951 $keys = array_keys($items); |
2983 } |
2952 foreach ($keys as $key) |
2984 if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item')) |
2953 { |
2985 { |
2954 $this->data['items'][] =& new $this->item_class($this, $items[$key]); |
2986 $keys = array_keys($items); |
2955 } |
2987 foreach ($keys as $key) |
2956 } |
2988 { |
2957 if ($items = $this->get_channel_tags('', 'item')) |
2989 $this->data['items'][] =& new $this->item_class($this, $items[$key]); |
2958 { |
2990 } |
2959 $keys = array_keys($items); |
2991 } |
2960 foreach ($keys as $key) |
2992 if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item')) |
2961 { |
2993 { |
2962 $this->data['items'][] =& new $this->item_class($this, $items[$key]); |
2994 $keys = array_keys($items); |
2995 foreach ($keys as $key) |
|
2996 { |
|
2997 $this->data['items'][] =& new $this->item_class($this, $items[$key]); |
|
2998 } |
|
2963 } |
2999 } |
2964 } |
3000 } |
2965 } |
3001 } |
2966 |
3002 |
2967 if (!empty($this->data['items'])) |
3003 if (!empty($this->data['items'])) |
2968 { |
3004 { |
2969 // If we want to order it by date, check if all items have a date, and then sort it |
3005 // If we want to order it by date, check if all items have a date, and then sort it |
2970 if ($this->order_by_date) |
3006 if ($this->order_by_date && empty($this->multifeed_objects)) |
2971 { |
3007 { |
2972 if (!isset($this->data['ordered_items'])) |
3008 if (!isset($this->data['ordered_items'])) |
2973 { |
3009 { |
2974 $do_sort = true; |
3010 $do_sort = true; |
2975 foreach ($this->data['items'] as $item) |
3011 foreach ($this->data['items'] as $item) |
2993 { |
3029 { |
2994 $items = $this->data['items']; |
3030 $items = $this->data['items']; |
2995 } |
3031 } |
2996 |
3032 |
2997 // Slice the data as desired |
3033 // Slice the data as desired |
2998 if ($end == 0) |
3034 if ($end === 0) |
2999 { |
3035 { |
3000 return array_slice($items, $start); |
3036 return array_slice($items, $start); |
3001 } |
3037 } |
3002 else |
3038 else |
3003 { |
3039 { |
3008 { |
3044 { |
3009 return array(); |
3045 return array(); |
3010 } |
3046 } |
3011 } |
3047 } |
3012 |
3048 |
3049 /** |
|
3050 * @static |
|
3051 */ |
|
3013 function sort_items($a, $b) |
3052 function sort_items($a, $b) |
3014 { |
3053 { |
3015 return $a->get_date('U') <= $b->get_date('U'); |
3054 return $a->get_date('U') <= $b->get_date('U'); |
3016 } |
3055 } |
3017 |
3056 |
3057 /** |
|
3058 * @static |
|
3059 */ |
|
3018 function merge_items($urls, $start = 0, $end = 0, $limit = 0) |
3060 function merge_items($urls, $start = 0, $end = 0, $limit = 0) |
3019 { |
3061 { |
3020 if (is_array($urls) && sizeof($urls) > 0) |
3062 if (is_array($urls) && sizeof($urls) > 0) |
3021 { |
3063 { |
3022 $items = array(); |
3064 $items = array(); |
3045 if ($do_sort) |
3087 if ($do_sort) |
3046 { |
3088 { |
3047 usort($items, array('SimplePie', 'sort_items')); |
3089 usort($items, array('SimplePie', 'sort_items')); |
3048 } |
3090 } |
3049 |
3091 |
3050 if ($end == 0) |
3092 if ($end === 0) |
3051 { |
3093 { |
3052 return array_slice($items, $start); |
3094 return array_slice($items, $start); |
3053 } |
3095 } |
3054 else |
3096 else |
3055 { |
3097 { |
3128 } |
3170 } |
3129 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id')) |
3171 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id')) |
3130 { |
3172 { |
3131 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
3173 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
3132 } |
3174 } |
3133 elseif ($return = $this->get_item_tags('', 'guid')) |
3175 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid')) |
3134 { |
3176 { |
3135 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
3177 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
3136 } |
3178 } |
3137 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier')) |
3179 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier')) |
3138 { |
3180 { |
3179 } |
3221 } |
3180 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
3222 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
3181 { |
3223 { |
3182 $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
3224 $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
3183 } |
3225 } |
3184 elseif ($return = $this->get_item_tags('', 'title')) |
3226 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) |
3185 { |
3227 { |
3186 $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
3228 $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
3187 } |
3229 } |
3188 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
3230 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
3189 { |
3231 { |
3213 } |
3255 } |
3214 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) |
3256 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) |
3215 { |
3257 { |
3216 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
3258 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
3217 } |
3259 } |
3218 elseif ($return = $this->get_item_tags('', 'description')) |
3260 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) |
3219 { |
3261 { |
3220 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); |
3262 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); |
3221 } |
3263 } |
3222 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) |
3264 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) |
3223 { |
3265 { |
3303 { |
3345 { |
3304 $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); |
3346 $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); |
3305 } |
3347 } |
3306 $categories[] =& new $this->feed->category_class($term, $scheme, $label); |
3348 $categories[] =& new $this->feed->category_class($term, $scheme, $label); |
3307 } |
3349 } |
3308 foreach ((array) $this->get_item_tags('', 'category') as $category) |
3350 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) |
3309 { |
3351 { |
3310 $categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); |
3352 // This is really the label, but keep this as the term also for BC. |
3353 // Label will also work on retrieving because that falls back to term. |
|
3354 $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
3355 if (isset($category['attribs']['']['domain'])) |
|
3356 { |
|
3357 $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
3358 } |
|
3359 else |
|
3360 { |
|
3361 $scheme = null; |
|
3362 } |
|
3363 $categories[] =& new $this->feed->category_class($term, $scheme, null); |
|
3311 } |
3364 } |
3312 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) |
3365 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) |
3313 { |
3366 { |
3314 $categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); |
3367 $categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); |
3315 } |
3368 } |
3410 { |
3463 { |
3411 return null; |
3464 return null; |
3412 } |
3465 } |
3413 } |
3466 } |
3414 |
3467 |
3415 /** |
|
3416 * @todo Atom inheritance (item author, source author, feed author) |
|
3417 */ |
|
3418 function get_authors() |
3468 function get_authors() |
3419 { |
3469 { |
3420 $authors = array(); |
3470 $authors = array(); |
3421 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) |
3471 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) |
3422 { |
3472 { |
3460 if ($name !== null || $email !== null || $url !== null) |
3510 if ($name !== null || $email !== null || $url !== null) |
3461 { |
3511 { |
3462 $authors[] =& new $this->feed->author_class($name, $url, $email); |
3512 $authors[] =& new $this->feed->author_class($name, $url, $email); |
3463 } |
3513 } |
3464 } |
3514 } |
3465 if ($author = $this->get_item_tags('', 'author')) |
3515 if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author')) |
3466 { |
3516 { |
3467 $authors[] =& new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); |
3517 $authors[] =& new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); |
3468 } |
3518 } |
3469 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) |
3519 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) |
3470 { |
3520 { |
3539 } |
3589 } |
3540 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified')) |
3590 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified')) |
3541 { |
3591 { |
3542 $this->data['date']['raw'] = $return[0]['data']; |
3592 $this->data['date']['raw'] = $return[0]['data']; |
3543 } |
3593 } |
3544 elseif ($return = $this->get_item_tags('', 'pubDate')) |
3594 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate')) |
3545 { |
3595 { |
3546 $this->data['date']['raw'] = $return[0]['data']; |
3596 $this->data['date']['raw'] = $return[0]['data']; |
3547 } |
3597 } |
3548 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date')) |
3598 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date')) |
3549 { |
3599 { |
3660 } |
3710 } |
3661 if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) |
3711 if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) |
3662 { |
3712 { |
3663 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
3713 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
3664 } |
3714 } |
3665 if ($links = $this->get_item_tags('', 'link')) |
3715 if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) |
3666 { |
3716 { |
3667 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
3717 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
3668 } |
3718 } |
3669 if ($links = $this->get_item_tags('', 'guid')) |
3719 if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid')) |
3670 { |
3720 { |
3671 if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) == 'true') |
3721 if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true') |
3672 { |
3722 { |
3673 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
3723 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
3674 } |
3724 } |
3675 } |
3725 } |
3676 |
3726 |
3687 else |
3737 else |
3688 { |
3738 { |
3689 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; |
3739 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; |
3690 } |
3740 } |
3691 } |
3741 } |
3692 elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
3742 elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
3693 { |
3743 { |
3694 $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; |
3744 $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; |
3695 } |
3745 } |
3696 $this->data['links'][$key] = array_unique($this->data['links'][$key]); |
3746 $this->data['links'][$key] = array_unique($this->data['links'][$key]); |
3697 } |
3747 } |
4253 foreach ($restrictions as $restriction) |
4303 foreach ($restrictions as $restriction) |
4254 { |
4304 { |
4255 $restriction_relationship = 'allow'; |
4305 $restriction_relationship = 'allow'; |
4256 $restriction_type = null; |
4306 $restriction_type = null; |
4257 $restriction_value = 'itunes'; |
4307 $restriction_value = 'itunes'; |
4258 if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes') |
4308 if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') |
4259 { |
4309 { |
4260 $restriction_relationship = 'deny'; |
4310 $restriction_relationship = 'deny'; |
4261 } |
4311 } |
4262 $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); |
4312 $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); |
4263 } |
4313 } |
4289 foreach ($restrictions as $restriction) |
4339 foreach ($restrictions as $restriction) |
4290 { |
4340 { |
4291 $restriction_relationship = 'allow'; |
4341 $restriction_relationship = 'allow'; |
4292 $restriction_type = null; |
4342 $restriction_type = null; |
4293 $restriction_value = 'itunes'; |
4343 $restriction_value = 'itunes'; |
4294 if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes') |
4344 if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes') |
4295 { |
4345 { |
4296 $restriction_relationship = 'deny'; |
4346 $restriction_relationship = 'deny'; |
4297 } |
4347 } |
4298 $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); |
4348 $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); |
4299 } |
4349 } |
5400 } |
5450 } |
5401 } |
5451 } |
5402 |
5452 |
5403 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link) |
5453 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link) |
5404 { |
5454 { |
5405 if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure') |
5455 if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') |
5406 { |
5456 { |
5407 // Attributes |
5457 // Attributes |
5408 $bitrate = null; |
5458 $bitrate = null; |
5409 $channels = null; |
5459 $channels = null; |
5410 $duration = null; |
5460 $duration = null; |
5435 } |
5485 } |
5436 } |
5486 } |
5437 |
5487 |
5438 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link) |
5488 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link) |
5439 { |
5489 { |
5440 if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure') |
5490 if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') |
5441 { |
5491 { |
5442 // Attributes |
5492 // Attributes |
5443 $bitrate = null; |
5493 $bitrate = null; |
5444 $channels = null; |
5494 $channels = null; |
5445 $duration = null; |
5495 $duration = null; |
5468 // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor |
5518 // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor |
5469 $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width); |
5519 $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width); |
5470 } |
5520 } |
5471 } |
5521 } |
5472 |
5522 |
5473 if ($enclosure = $this->get_item_tags('', 'enclosure')) |
5523 if ($enclosure = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'enclosure')) |
5474 { |
5524 { |
5475 if (isset($enclosure[0]['attribs']['']['url'])) |
5525 if (isset($enclosure[0]['attribs']['']['url'])) |
5476 { |
5526 { |
5477 // Attributes |
5527 // Attributes |
5478 $bitrate = null; |
5528 $bitrate = null; |
5503 // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor |
5553 // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor |
5504 $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width); |
5554 $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width); |
5505 } |
5555 } |
5506 } |
5556 } |
5507 |
5557 |
5508 if (sizeof($this->data['enclosures']) == 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width)) |
5558 if (sizeof($this->data['enclosures']) === 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width)) |
5509 { |
5559 { |
5510 // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor |
5560 // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor |
5511 $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width); |
5561 $this->data['enclosures'][] =& new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width); |
5512 } |
5562 } |
5513 |
5563 |
5582 */ |
5632 */ |
5583 function add_to_service($item_url, $title_url = null, $summary_url = null) |
5633 function add_to_service($item_url, $title_url = null, $summary_url = null) |
5584 { |
5634 { |
5585 if ($this->get_permalink() !== null) |
5635 if ($this->get_permalink() !== null) |
5586 { |
5636 { |
5587 $return = $this->sanitize($item_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_permalink()); |
5637 $return = $item_url . rawurlencode($this->get_permalink()); |
5588 if ($title_url !== null && $this->get_title() !== null) |
5638 if ($title_url !== null && $this->get_title() !== null) |
5589 { |
5639 { |
5590 $return .= $this->sanitize($title_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_title()); |
5640 $return .= $title_url . rawurlencode($this->get_title()); |
5591 } |
5641 } |
5592 if ($summary_url !== null && $this->get_description() !== null) |
5642 if ($summary_url !== null && $this->get_description() !== null) |
5593 { |
5643 { |
5594 $return .= $this->sanitize($summary_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_description()); |
5644 $return .= $summary_url . rawurlencode($this->get_description()); |
5595 } |
5645 } |
5596 return $return; |
5646 return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI); |
5597 } |
5647 } |
5598 else |
5648 else |
5599 { |
5649 { |
5600 return null; |
5650 return null; |
5601 } |
5651 } |
5731 } |
5781 } |
5732 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
5782 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
5733 { |
5783 { |
5734 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
5784 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
5735 } |
5785 } |
5736 elseif ($return = $this->get_source_tags('', 'title')) |
5786 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) |
5737 { |
5787 { |
5738 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
5788 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
5739 } |
5789 } |
5740 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
5790 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
5741 { |
5791 { |
5785 { |
5835 { |
5786 $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); |
5836 $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); |
5787 } |
5837 } |
5788 $categories[] =& new $this->item->feed->category_class($term, $scheme, $label); |
5838 $categories[] =& new $this->item->feed->category_class($term, $scheme, $label); |
5789 } |
5839 } |
5790 foreach ((array) $this->get_source_tags('', 'category') as $category) |
5840 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) |
5791 { |
5841 { |
5792 $categories[] =& new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); |
5842 // This is really the label, but keep this as the term also for BC. |
5843 // Label will also work on retrieving because that falls back to term. |
|
5844 $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
5845 if (isset($category['attribs']['']['domain'])) |
|
5846 { |
|
5847 $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
5848 } |
|
5849 else |
|
5850 { |
|
5851 $scheme = null; |
|
5852 } |
|
5853 $categories[] =& new $this->item->feed->category_class($term, $scheme, null); |
|
5793 } |
5854 } |
5794 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) |
5855 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) |
5795 { |
5856 { |
5796 $categories[] =& new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); |
5857 $categories[] =& new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); |
5797 } |
5858 } |
6019 } |
6080 } |
6020 if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) |
6081 if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link')) |
6021 { |
6082 { |
6022 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
6083 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
6023 } |
6084 } |
6024 if ($links = $this->get_source_tags('', 'link')) |
6085 if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link')) |
6025 { |
6086 { |
6026 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
6087 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
6027 } |
6088 } |
6028 |
6089 |
6029 $keys = array_keys($this->data['links']); |
6090 $keys = array_keys($this->data['links']); |
6039 else |
6100 else |
6040 { |
6101 { |
6041 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; |
6102 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; |
6042 } |
6103 } |
6043 } |
6104 } |
6044 elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
6105 elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
6045 { |
6106 { |
6046 $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; |
6107 $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; |
6047 } |
6108 } |
6048 $this->data['links'][$key] = array_unique($this->data['links'][$key]); |
6109 $this->data['links'][$key] = array_unique($this->data['links'][$key]); |
6049 } |
6110 } |
6075 } |
6136 } |
6076 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) |
6137 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) |
6077 { |
6138 { |
6078 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
6139 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
6079 } |
6140 } |
6080 elseif ($return = $this->get_source_tags('', 'description')) |
6141 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) |
6081 { |
6142 { |
6082 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
6143 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
6083 } |
6144 } |
6084 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) |
6145 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) |
6085 { |
6146 { |
6111 } |
6172 } |
6112 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) |
6173 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright')) |
6113 { |
6174 { |
6114 return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); |
6175 return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0])); |
6115 } |
6176 } |
6116 elseif ($return = $this->get_source_tags('', 'copyright')) |
6177 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright')) |
6117 { |
6178 { |
6118 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
6179 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
6119 } |
6180 } |
6120 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) |
6181 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) |
6121 { |
6182 { |
6131 } |
6192 } |
6132 } |
6193 } |
6133 |
6194 |
6134 function get_language() |
6195 function get_language() |
6135 { |
6196 { |
6136 if ($return = $this->get_source_tags('', 'language')) |
6197 if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) |
6137 { |
6198 { |
6138 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
6199 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
6139 } |
6200 } |
6140 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) |
6201 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language')) |
6141 { |
6202 { |
6930 |
6991 |
6931 $mime = explode('/', $type, 2); |
6992 $mime = explode('/', $type, 2); |
6932 $mime = $mime[0]; |
6993 $mime = $mime[0]; |
6933 |
6994 |
6934 // Process values for 'auto' |
6995 // Process values for 'auto' |
6935 if ($width == 'auto') |
6996 if ($width === 'auto') |
6936 { |
6997 { |
6937 if ($mime == 'video') |
6998 if ($mime === 'video') |
6938 { |
6999 { |
6939 if ($height == 'auto') |
7000 if ($height === 'auto') |
6940 { |
7001 { |
6941 $width = 480; |
7002 $width = 480; |
6942 } |
7003 } |
6943 elseif ($widescreen) |
7004 elseif ($widescreen) |
6944 { |
7005 { |
6953 { |
7014 { |
6954 $width = '100%'; |
7015 $width = '100%'; |
6955 } |
7016 } |
6956 } |
7017 } |
6957 |
7018 |
6958 if ($height == 'auto') |
7019 if ($height === 'auto') |
6959 { |
7020 { |
6960 if ($mime == 'audio') |
7021 if ($mime === 'audio') |
6961 { |
7022 { |
6962 $height = 0; |
7023 $height = 0; |
6963 } |
7024 } |
6964 elseif ($mime == 'video') |
7025 elseif ($mime === 'video') |
6965 { |
7026 { |
6966 if ($width == 'auto') |
7027 if ($width === 'auto') |
6967 { |
7028 { |
6968 if ($widescreen) |
7029 if ($widescreen) |
6969 { |
7030 { |
6970 $height = 270; |
7031 $height = 270; |
6971 } |
7032 } |
6986 else |
7047 else |
6987 { |
7048 { |
6988 $height = 376; |
7049 $height = 376; |
6989 } |
7050 } |
6990 } |
7051 } |
6991 elseif ($mime == 'audio') |
7052 elseif ($mime === 'audio') |
6992 { |
7053 { |
6993 $height = 0; |
7054 $height = 0; |
6994 } |
7055 } |
6995 |
7056 |
6996 // Set proper placeholder value |
7057 // Set proper placeholder value |
6997 if ($mime == 'audio') |
7058 if ($mime === 'audio') |
6998 { |
7059 { |
6999 $placeholder = $audio; |
7060 $placeholder = $audio; |
7000 } |
7061 } |
7001 elseif ($mime == 'video') |
7062 elseif ($mime === 'video') |
7002 { |
7063 { |
7003 $placeholder = $video; |
7064 $placeholder = $video; |
7004 } |
7065 } |
7005 |
7066 |
7006 $embed = ''; |
7067 $embed = ''; |
7015 $javascript_outputted = true; |
7076 $javascript_outputted = true; |
7016 } |
7077 } |
7017 } |
7078 } |
7018 |
7079 |
7019 // Odeo Feed MP3's |
7080 // Odeo Feed MP3's |
7020 if ($handler == 'odeo') |
7081 if ($handler === 'odeo') |
7021 { |
7082 { |
7022 if ($native) |
7083 if ($native) |
7023 { |
7084 { |
7024 $embed .= '<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://adobe.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=' . $this->get_link() . '"></embed>'; |
7085 $embed .= '<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://adobe.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=' . $this->get_link() . '"></embed>'; |
7025 } |
7086 } |
7028 $embed .= '<script type="text/javascript">embed_odeo("' . $this->get_link() . '");</script>'; |
7089 $embed .= '<script type="text/javascript">embed_odeo("' . $this->get_link() . '");</script>'; |
7029 } |
7090 } |
7030 } |
7091 } |
7031 |
7092 |
7032 // Flash |
7093 // Flash |
7033 elseif ($handler == 'flash') |
7094 elseif ($handler === 'flash') |
7034 { |
7095 { |
7035 if ($native) |
7096 if ($native) |
7036 { |
7097 { |
7037 $embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>"; |
7098 $embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>"; |
7038 } |
7099 } |
7042 } |
7103 } |
7043 } |
7104 } |
7044 |
7105 |
7045 // Flash Media Player file types. |
7106 // Flash Media Player file types. |
7046 // Preferred handler for MP3 file types. |
7107 // Preferred handler for MP3 file types. |
7047 elseif ($handler == 'fmedia' || ($handler == 'mp3' && $mediaplayer != '')) |
7108 elseif ($handler === 'fmedia' || ($handler === 'mp3' && $mediaplayer !== '')) |
7048 { |
7109 { |
7049 $height += 20; |
7110 $height += 20; |
7050 if ($native) |
7111 if ($native) |
7051 { |
7112 { |
7052 $embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>"; |
7113 $embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>"; |
7057 } |
7118 } |
7058 } |
7119 } |
7059 |
7120 |
7060 // QuickTime 7 file types. Need to test with QuickTime 6. |
7121 // QuickTime 7 file types. Need to test with QuickTime 6. |
7061 // Only handle MP3's if the Flash Media Player is not present. |
7122 // Only handle MP3's if the Flash Media Player is not present. |
7062 elseif ($handler == 'quicktime' || ($handler == 'mp3' && $mediaplayer == '')) |
7123 elseif ($handler === 'quicktime' || ($handler === 'mp3' && $mediaplayer === '')) |
7063 { |
7124 { |
7064 $height += 16; |
7125 $height += 16; |
7065 if ($native) |
7126 if ($native) |
7066 { |
7127 { |
7067 if ($placeholder != ""){ |
7128 if ($placeholder !== '') |
7129 { |
|
7068 $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>"; |
7130 $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>"; |
7069 } |
7131 } |
7070 else { |
7132 else |
7133 { |
|
7071 $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>"; |
7134 $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>"; |
7072 } |
7135 } |
7073 } |
7136 } |
7074 else |
7137 else |
7075 { |
7138 { |
7076 $embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>"; |
7139 $embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>"; |
7077 } |
7140 } |
7078 } |
7141 } |
7079 |
7142 |
7080 // Windows Media |
7143 // Windows Media |
7081 elseif ($handler == 'wmedia') |
7144 elseif ($handler === 'wmedia') |
7082 { |
7145 { |
7083 $height += 45; |
7146 $height += 45; |
7084 if ($native) |
7147 if ($native) |
7085 { |
7148 { |
7086 $embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>"; |
7149 $embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>"; |
7098 } |
7161 } |
7099 |
7162 |
7100 function get_real_type($find_handler = false) |
7163 function get_real_type($find_handler = false) |
7101 { |
7164 { |
7102 // If it's Odeo, let's get it out of the way. |
7165 // If it's Odeo, let's get it out of the way. |
7103 if (substr(strtolower($this->get_link()), 0, 15) == 'http://odeo.com') |
7166 if (substr(strtolower($this->get_link()), 0, 15) === 'http://odeo.com') |
7104 { |
7167 { |
7105 return 'odeo'; |
7168 return 'odeo'; |
7106 } |
7169 } |
7107 |
7170 |
7108 // Mime-types by handler. |
7171 // Mime-types by handler. |
7626 curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1); |
7689 curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1); |
7627 curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects); |
7690 curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects); |
7628 } |
7691 } |
7629 |
7692 |
7630 $this->headers = curl_exec($fp); |
7693 $this->headers = curl_exec($fp); |
7631 if (curl_errno($fp) == 23 || curl_errno($fp) == 61) |
7694 if (curl_errno($fp) === 23 || curl_errno($fp) === 61) |
7632 { |
7695 { |
7633 curl_setopt($fp, CURLOPT_ENCODING, 'none'); |
7696 curl_setopt($fp, CURLOPT_ENCODING, 'none'); |
7634 $this->headers = curl_exec($fp); |
7697 $this->headers = curl_exec($fp); |
7635 } |
7698 } |
7636 if (curl_errno($fp)) |
7699 if (curl_errno($fp)) |
7648 if ($parser->parse()) |
7711 if ($parser->parse()) |
7649 { |
7712 { |
7650 $this->headers = $parser->headers; |
7713 $this->headers = $parser->headers; |
7651 $this->body = $parser->body; |
7714 $this->body = $parser->body; |
7652 $this->status_code = $parser->status_code; |
7715 $this->status_code = $parser->status_code; |
7653 if (($this->status_code == 300 || $this->status_code == 301 || $this->status_code == 302 || $this->status_code == 303 || $this->status_code == 307 || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) |
7716 if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) |
7654 { |
7717 { |
7655 $this->redirects++; |
7718 $this->redirects++; |
7656 $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); |
7719 $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); |
7657 return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); |
7720 return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); |
7658 } |
7721 } |
7661 } |
7724 } |
7662 else |
7725 else |
7663 { |
7726 { |
7664 $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN; |
7727 $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN; |
7665 $url_parts = parse_url($url); |
7728 $url_parts = parse_url($url); |
7666 if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) == 'https') |
7729 if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https') |
7667 { |
7730 { |
7668 $url_parts['host'] = "ssl://$url_parts[host]"; |
7731 $url_parts['host'] = "ssl://$url_parts[host]"; |
7669 $url_parts['port'] = 443; |
7732 $url_parts['port'] = 443; |
7670 } |
7733 } |
7671 if (!isset($url_parts['port'])) |
7734 if (!isset($url_parts['port'])) |
7729 if ($parser->parse()) |
7792 if ($parser->parse()) |
7730 { |
7793 { |
7731 $this->headers = $parser->headers; |
7794 $this->headers = $parser->headers; |
7732 $this->body = $parser->body; |
7795 $this->body = $parser->body; |
7733 $this->status_code = $parser->status_code; |
7796 $this->status_code = $parser->status_code; |
7734 if (($this->status_code == 300 || $this->status_code == 301 || $this->status_code == 302 || $this->status_code == 303 || $this->status_code == 307 || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) |
7797 if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) |
7735 { |
7798 { |
7736 $this->redirects++; |
7799 $this->redirects++; |
7737 $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); |
7800 $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); |
7738 return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); |
7801 return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); |
7739 } |
7802 } |
8436 |
8499 |
8437 // Parse the FNAME |
8500 // Parse the FNAME |
8438 if ($this->flags & 8) |
8501 if ($this->flags & 8) |
8439 { |
8502 { |
8440 // Get the length of the filename |
8503 // Get the length of the filename |
8441 $len = strspn($this->compressed_data, "\x00", $this->position); |
8504 $len = strcspn($this->compressed_data, "\x00", $this->position); |
8442 |
8505 |
8443 // Check the length of the string is still valid |
8506 // Check the length of the string is still valid |
8444 $this->min_compressed_size += $len + 1; |
8507 $this->min_compressed_size += $len + 1; |
8445 if ($this->compressed_size >= $this->min_compressed_size) |
8508 if ($this->compressed_size >= $this->min_compressed_size) |
8446 { |
8509 { |
8456 |
8519 |
8457 // Parse the FCOMMENT |
8520 // Parse the FCOMMENT |
8458 if ($this->flags & 16) |
8521 if ($this->flags & 16) |
8459 { |
8522 { |
8460 // Get the length of the comment |
8523 // Get the length of the comment |
8461 $len = strspn($this->compressed_data, "\x00", $this->position); |
8524 $len = strcspn($this->compressed_data, "\x00", $this->position); |
8462 |
8525 |
8463 // Check the length of the string is still valid |
8526 // Check the length of the string is still valid |
8464 $this->min_compressed_size += $len + 1; |
8527 $this->min_compressed_size += $len + 1; |
8465 if ($this->compressed_size >= $this->min_compressed_size) |
8528 if ($this->compressed_size >= $this->min_compressed_size) |
8466 { |
8529 { |
8554 * @static |
8617 * @static |
8555 * @access public |
8618 * @access public |
8556 */ |
8619 */ |
8557 function create($location, $filename, $extension) |
8620 function create($location, $filename, $extension) |
8558 { |
8621 { |
8559 return new SimplePie_Cache_File($location, $filename, $extension); |
8622 $location_iri =& new SimplePie_IRI($location); |
8623 switch ($location_iri->get_scheme()) |
|
8624 { |
|
8625 case 'mysql': |
|
8626 if (extension_loaded('mysql')) |
|
8627 { |
|
8628 return new SimplePie_Cache_MySQL($location_iri, $filename, $extension); |
|
8629 } |
|
8630 break; |
|
8631 |
|
8632 default: |
|
8633 return new SimplePie_Cache_File($location, $filename, $extension); |
|
8634 } |
|
8560 } |
8635 } |
8561 } |
8636 } |
8562 |
8637 |
8563 class SimplePie_Cache_File |
8638 class SimplePie_Cache_File |
8564 { |
8639 { |
8568 var $name; |
8643 var $name; |
8569 |
8644 |
8570 function SimplePie_Cache_File($location, $filename, $extension) |
8645 function SimplePie_Cache_File($location, $filename, $extension) |
8571 { |
8646 { |
8572 $this->location = $location; |
8647 $this->location = $location; |
8573 $this->filename = rawurlencode($filename); |
8648 $this->filename = $filename; |
8574 $this->extension = rawurlencode($extension); |
8649 $this->extension = $extension; |
8575 $this->name = "$location/$this->filename.$this->extension"; |
8650 $this->name = "$this->location/$this->filename.$this->extension"; |
8576 } |
8651 } |
8577 |
8652 |
8578 function save($data) |
8653 function save($data) |
8579 { |
8654 { |
8580 if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location)) |
8655 if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location)) |
8639 } |
8714 } |
8640 return false; |
8715 return false; |
8641 } |
8716 } |
8642 } |
8717 } |
8643 |
8718 |
8719 class SimplePie_Cache_DB |
|
8720 { |
|
8721 function prepare_simplepie_object_for_cache($data) |
|
8722 { |
|
8723 $items = $data->get_items(); |
|
8724 $items_by_id = array(); |
|
8725 |
|
8726 if (!empty($items)) |
|
8727 { |
|
8728 foreach ($items as $item) |
|
8729 { |
|
8730 $items_by_id[$item->get_id()] = $item; |
|
8731 } |
|
8732 |
|
8733 if (count($items_by_id) !== count($items)) |
|
8734 { |
|
8735 $items_by_id = array(); |
|
8736 foreach ($items as $item) |
|
8737 { |
|
8738 $items_by_id[$item->get_id(true)] = $item; |
|
8739 } |
|
8740 } |
|
8741 |
|
8742 if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) |
|
8743 { |
|
8744 $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; |
|
8745 } |
|
8746 elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) |
|
8747 { |
|
8748 $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; |
|
8749 } |
|
8750 elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) |
|
8751 { |
|
8752 $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; |
|
8753 } |
|
8754 elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0])) |
|
8755 { |
|
8756 $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]; |
|
8757 } |
|
8758 else |
|
8759 { |
|
8760 $channel = null; |
|
8761 } |
|
8762 |
|
8763 if ($channel !== null) |
|
8764 { |
|
8765 if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'])) |
|
8766 { |
|
8767 unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry']); |
|
8768 } |
|
8769 if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry'])) |
|
8770 { |
|
8771 unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry']); |
|
8772 } |
|
8773 if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])) |
|
8774 { |
|
8775 unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']); |
|
8776 } |
|
8777 if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])) |
|
8778 { |
|
8779 unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']); |
|
8780 } |
|
8781 if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item'])) |
|
8782 { |
|
8783 unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item']); |
|
8784 } |
|
8785 } |
|
8786 if (isset($data->data['items'])) |
|
8787 { |
|
8788 unset($data->data['items']); |
|
8789 } |
|
8790 if (isset($data->data['ordered_items'])) |
|
8791 { |
|
8792 unset($data->data['ordered_items']); |
|
8793 } |
|
8794 } |
|
8795 return array(serialize($data->data), $items_by_id); |
|
8796 } |
|
8797 } |
|
8798 |
|
8799 class SimplePie_Cache_MySQL extends SimplePie_Cache_DB |
|
8800 { |
|
8801 var $mysql; |
|
8802 var $options; |
|
8803 var $id; |
|
8804 |
|
8805 function SimplePie_Cache_MySQL($mysql_location, $name, $extension) |
|
8806 { |
|
8807 $host = $mysql_location->get_host(); |
|
8808 if (SimplePie_Misc::stripos($host, 'unix(') === 0 && substr($host, -1) === ')') |
|
8809 { |
|
8810 $server = ':' . substr($host, 5, -1); |
|
8811 } |
|
8812 else |
|
8813 { |
|
8814 $server = $host; |
|
8815 if ($mysql_location->get_port() !== null) |
|
8816 { |
|
8817 $server .= ':' . $mysql_location->get_port(); |
|
8818 } |
|
8819 } |
|
8820 |
|
8821 if (strpos($mysql_location->get_userinfo(), ':') !== false) |
|
8822 { |
|
8823 list($username, $password) = explode(':', $mysql_location->get_userinfo(), 2); |
|
8824 } |
|
8825 else |
|
8826 { |
|
8827 $username = $mysql_location->get_userinfo(); |
|
8828 $password = null; |
|
8829 } |
|
8830 |
|
8831 if ($this->mysql = mysql_connect($server, $username, $password)) |
|
8832 { |
|
8833 $this->id = $name . $extension; |
|
8834 $this->options = SimplePie_Misc::parse_str($mysql_location->get_query()); |
|
8835 if (!isset($this->options['prefix'][0])) |
|
8836 { |
|
8837 $this->options['prefix'][0] = ''; |
|
8838 } |
|
8839 |
|
8840 if (mysql_select_db(ltrim($mysql_location->get_path(), '/')) |
|
8841 && mysql_query('SET NAMES utf8') |
|
8842 && ($query = mysql_unbuffered_query('SHOW TABLES'))) |
|
8843 { |
|
8844 $db = array(); |
|
8845 while ($row = mysql_fetch_row($query)) |
|
8846 { |
|
8847 $db[] = $row[0]; |
|
8848 } |
|
8849 |
|
8850 if (!in_array($this->options['prefix'][0] . 'cache_data', $db)) |
|
8851 { |
|
8852 if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))')) |
|
8853 { |
|
8854 $this->mysql = null; |
|
8855 } |
|
8856 } |
|
8857 |
|
8858 if (!in_array($this->options['prefix'][0] . 'items', $db)) |
|
8859 { |
|
8860 if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` TEXT CHARACTER SET utf8 NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))')) |
|
8861 { |
|
8862 $this->mysql = null; |
|
8863 } |
|
8864 } |
|
8865 } |
|
8866 else |
|
8867 { |
|
8868 $this->mysql = null; |
|
8869 } |
|
8870 } |
|
8871 } |
|
8872 |
|
8873 function save($data) |
|
8874 { |
|
8875 if ($this->mysql) |
|
8876 { |
|
8877 $feed_id = "'" . mysql_real_escape_string($this->id) . "'"; |
|
8878 |
|
8879 if (is_a($data, 'SimplePie')) |
|
8880 { |
|
8881 if (SIMPLEPIE_PHP5) |
|
8882 { |
|
8883 // This keyword needs to defy coding standards for PHP4 compatibility |
|
8884 $data = clone($data); |
|
8885 } |
|
8886 |
|
8887 $prepared = $this->prepare_simplepie_object_for_cache($data); |
|
8888 |
|
8889 if ($query = mysql_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this->mysql)) |
|
8890 { |
|
8891 if (mysql_num_rows($query)) |
|
8892 { |
|
8893 $items = count($prepared[1]); |
|
8894 if ($items) |
|
8895 { |
|
8896 $sql = 'UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `items` = ' . $items . ', `data` = \'' . mysql_real_escape_string($prepared[0]) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id; |
|
8897 } |
|
8898 else |
|
8899 { |
|
8900 $sql = 'UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `data` = \'' . mysql_real_escape_string($prepared[0]) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id; |
|
8901 } |
|
8902 |
|
8903 if (!mysql_query($sql, $this->mysql)) |
|
8904 { |
|
8905 return false; |
|
8906 } |
|
8907 } |
|
8908 elseif (!mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(' . $feed_id . ', ' . count($prepared[1]) . ', \'' . mysql_real_escape_string($prepared[0]) . '\', ' . time() . ')', $this->mysql)) |
|
8909 { |
|
8910 return false; |
|
8911 } |
|
8912 |
|
8913 $ids = array_keys($prepared[1]); |
|
8914 if (!empty($ids)) |
|
8915 { |
|
8916 foreach ($ids as $id) |
|
8917 { |
|
8918 $database_ids[] = mysql_real_escape_string($id); |
|
8919 } |
|
8920 |
|
8921 if ($query = mysql_unbuffered_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'items` WHERE `id` = \'' . implode('\' OR `id` = \'', $database_ids) . '\' AND `feed_id` = ' . $feed_id, $this->mysql)) |
|
8922 { |
|
8923 $existing_ids = array(); |
|
8924 while ($row = mysql_fetch_row($query)) |
|
8925 { |
|
8926 $existing_ids[] = $row[0]; |
|
8927 } |
|
8928 |
|
8929 $new_ids = array_diff($ids, $existing_ids); |
|
8930 |
|
8931 foreach ($new_ids as $new_id) |
|
8932 { |
|
8933 if (!($date = $prepared[1][$new_id]->get_date('U'))) |
|
8934 { |
|
8935 $date = time(); |
|
8936 } |
|
8937 |
|
8938 if (!mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'items` (`feed_id`, `id`, `data`, `posted`) VALUES(' . $feed_id . ', \'' . mysql_real_escape_string($new_id) . '\', \'' . mysql_real_escape_string(serialize($prepared[1][$new_id]->data)) . '\', ' . $date . ')', $this->mysql)) |
|
8939 { |
|
8940 return false; |
|
8941 } |
|
8942 } |
|
8943 return true; |
|
8944 } |
|
8945 } |
|
8946 else |
|
8947 { |
|
8948 return true; |
|
8949 } |
|
8950 } |
|
8951 } |
|
8952 elseif ($query = mysql_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this->mysql)) |
|
8953 { |
|
8954 if (mysql_num_rows($query)) |
|
8955 { |
|
8956 if (mysql_query('UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `items` = 0, `data` = \'' . mysql_real_escape_string(serialize($data)) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id, $this->mysql)) |
|
8957 { |
|
8958 return true; |
|
8959 } |
|
8960 } |
|
8961 elseif (mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(\'' . mysql_real_escape_string($this->id) . '\', 0, \'' . mysql_real_escape_string(serialize($data)) . '\', ' . time() . ')', $this->mysql)) |
|
8962 { |
|
8963 return true; |
|
8964 } |
|
8965 } |
|
8966 } |
|
8967 return false; |
|
8968 } |
|
8969 |
|
8970 function load() |
|
8971 { |
|
8972 if ($this->mysql && ($query = mysql_query('SELECT `items`, `data` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query))) |
|
8973 { |
|
8974 $data = unserialize($row[1]); |
|
8975 |
|
8976 if (isset($this->options['items'][0])) |
|
8977 { |
|
8978 $items = (int) $this->options['items'][0]; |
|
8979 } |
|
8980 else |
|
8981 { |
|
8982 $items = (int) $row[0]; |
|
8983 } |
|
8984 |
|
8985 if ($items !== 0) |
|
8986 { |
|
8987 if (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) |
|
8988 { |
|
8989 $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; |
|
8990 } |
|
8991 elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) |
|
8992 { |
|
8993 $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; |
|
8994 } |
|
8995 elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) |
|
8996 { |
|
8997 $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; |
|
8998 } |
|
8999 elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0])) |
|
9000 { |
|
9001 $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]; |
|
9002 } |
|
9003 else |
|
9004 { |
|
9005 $feed = null; |
|
9006 } |
|
9007 |
|
9008 if ($feed !== null) |
|
9009 { |
|
9010 $sql = 'SELECT `data` FROM `' . $this->options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->id) . '\' ORDER BY `posted` DESC'; |
|
9011 if ($items > 0) |
|
9012 { |
|
9013 $sql .= ' LIMIT ' . $items; |
|
9014 } |
|
9015 |
|
9016 if ($query = mysql_unbuffered_query($sql, $this->mysql)) |
|
9017 { |
|
9018 while ($row = mysql_fetch_row($query)) |
|
9019 { |
|
9020 $feed['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'][] = unserialize($row[0]); |
|
9021 } |
|
9022 } |
|
9023 else |
|
9024 { |
|
9025 return false; |
|
9026 } |
|
9027 } |
|
9028 } |
|
9029 return $data; |
|
9030 } |
|
9031 return false; |
|
9032 } |
|
9033 |
|
9034 function mtime() |
|
9035 { |
|
9036 if ($this->mysql && ($query = mysql_query('SELECT `mtime` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query))) |
|
9037 { |
|
9038 return $row[0]; |
|
9039 } |
|
9040 else |
|
9041 { |
|
9042 return false; |
|
9043 } |
|
9044 } |
|
9045 |
|
9046 function touch() |
|
9047 { |
|
9048 if ($this->mysql && ($query = mysql_query('UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `mtime` = ' . time() . ' WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && mysql_affected_rows($this->mysql)) |
|
9049 { |
|
9050 return true; |
|
9051 } |
|
9052 else |
|
9053 { |
|
9054 return false; |
|
9055 } |
|
9056 } |
|
9057 |
|
9058 function unlink() |
|
9059 { |
|
9060 if ($this->mysql && ($query = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($query2 = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql))) |
|
9061 { |
|
9062 return true; |
|
9063 } |
|
9064 else |
|
9065 { |
|
9066 return false; |
|
9067 } |
|
9068 } |
|
9069 } |
|
9070 |
|
8644 class SimplePie_Misc |
9071 class SimplePie_Misc |
8645 { |
9072 { |
8646 function time_hms($seconds) |
9073 function time_hms($seconds) |
8647 { |
9074 { |
8648 $time = ''; |
9075 $time = ''; |
8671 return $time; |
9098 return $time; |
8672 } |
9099 } |
8673 |
9100 |
8674 function absolutize_url($relative, $base) |
9101 function absolutize_url($relative, $base) |
8675 { |
9102 { |
8676 if ($relative !== '') |
9103 $iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative); |
8677 { |
9104 return $iri->get_iri(); |
8678 $relative = SimplePie_Misc::parse_url($relative); |
|
8679 if ($relative['scheme'] !== '') |
|
8680 { |
|
8681 $target = $relative; |
|
8682 } |
|
8683 elseif ($base !== '') |
|
8684 { |
|
8685 $base = SimplePie_Misc::parse_url($base); |
|
8686 $target = SimplePie_Misc::parse_url(''); |
|
8687 if ($relative['authority'] !== '') |
|
8688 { |
|
8689 $target = $relative; |
|
8690 $target['scheme'] = $base['scheme']; |
|
8691 } |
|
8692 else |
|
8693 { |
|
8694 $target['scheme'] = $base['scheme']; |
|
8695 $target['authority'] = $base['authority']; |
|
8696 if ($relative['path'] !== '') |
|
8697 { |
|
8698 if (strpos($relative['path'], '/') === 0) |
|
8699 { |
|
8700 $target['path'] = $relative['path']; |
|
8701 } |
|
8702 elseif ($base['authority'] !== '' && $base['path'] === '') |
|
8703 { |
|
8704 $target['path'] = '/' . $relative['path']; |
|
8705 } |
|
8706 elseif (($last_segment = strrpos($base['path'], '/')) !== false) |
|
8707 { |
|
8708 $target['path'] = substr($base['path'], 0, $last_segment + 1) . $relative['path']; |
|
8709 } |
|
8710 else |
|
8711 { |
|
8712 $target['path'] = $relative['path']; |
|
8713 } |
|
8714 $target['query'] = $relative['query']; |
|
8715 } |
|
8716 else |
|
8717 { |
|
8718 $target['path'] = $base['path']; |
|
8719 if ($relative['query'] !== '') |
|
8720 { |
|
8721 $target['query'] = $relative['query']; |
|
8722 } |
|
8723 elseif ($base['query'] !== '') |
|
8724 { |
|
8725 $target['query'] = $base['query']; |
|
8726 } |
|
8727 } |
|
8728 } |
|
8729 $target['fragment'] = $relative['fragment']; |
|
8730 } |
|
8731 else |
|
8732 { |
|
8733 // No base URL, just return the relative URL |
|
8734 $target = $relative; |
|
8735 } |
|
8736 $return = SimplePie_Misc::compress_parse_url($target['scheme'], $target['authority'], $target['path'], $target['query'], $target['fragment']); |
|
8737 } |
|
8738 else |
|
8739 { |
|
8740 $return = $base; |
|
8741 } |
|
8742 $return = SimplePie_Misc::normalize_url($return); |
|
8743 return $return; |
|
8744 } |
9105 } |
8745 |
9106 |
8746 function remove_dot_segments($input) |
9107 function remove_dot_segments($input) |
8747 { |
9108 { |
8748 $output = ''; |
9109 $output = ''; |
8749 while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input == '.' || $input == '..') |
9110 while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') |
8750 { |
9111 { |
8751 // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise, |
9112 // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise, |
8752 if (strpos($input, '../') === 0) |
9113 if (strpos($input, '../') === 0) |
8753 { |
9114 { |
8754 $input = substr($input, 3); |
9115 $input = substr($input, 3); |
8760 // 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, |
9121 // 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, |
8761 elseif (strpos($input, '/./') === 0) |
9122 elseif (strpos($input, '/./') === 0) |
8762 { |
9123 { |
8763 $input = substr_replace($input, '/', 0, 3); |
9124 $input = substr_replace($input, '/', 0, 3); |
8764 } |
9125 } |
8765 elseif ($input == '/.') |
9126 elseif ($input === '/.') |
8766 { |
9127 { |
8767 $input = '/'; |
9128 $input = '/'; |
8768 } |
9129 } |
8769 // 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, |
9130 // 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, |
8770 elseif (strpos($input, '/../') === 0) |
9131 elseif (strpos($input, '/../') === 0) |
8771 { |
9132 { |
8772 $input = substr_replace($input, '/', 0, 4); |
9133 $input = substr_replace($input, '/', 0, 4); |
8773 $output = substr_replace($output, '', strrpos($output, '/')); |
9134 $output = substr_replace($output, '', strrpos($output, '/')); |
8774 } |
9135 } |
8775 elseif ($input == '/..') |
9136 elseif ($input === '/..') |
8776 { |
9137 { |
8777 $input = '/'; |
9138 $input = '/'; |
8778 $output = substr_replace($output, '', strrpos($output, '/')); |
9139 $output = substr_replace($output, '', strrpos($output, '/')); |
8779 } |
9140 } |
8780 // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise, |
9141 // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise, |
8781 elseif ($input == '.' || $input == '..') |
9142 elseif ($input === '.' || $input === '..') |
8782 { |
9143 { |
8783 $input = ''; |
9144 $input = ''; |
8784 } |
9145 } |
8785 // 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 |
9146 // 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 |
8786 elseif (($pos = strpos($input, '/', 1)) !== false) |
9147 elseif (($pos = strpos($input, '/', 1)) !== false) |
8820 $return[$i]['attribs'] = array(); |
9181 $return[$i]['attribs'] = array(); |
8821 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)) |
9182 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)) |
8822 { |
9183 { |
8823 for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++) |
9184 for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++) |
8824 { |
9185 { |
8825 if (count($attribs[$j]) == 2) |
9186 if (count($attribs[$j]) === 2) |
8826 { |
9187 { |
8827 $attribs[$j][2] = $attribs[$j][1]; |
9188 $attribs[$j][2] = $attribs[$j][1]; |
8828 } |
9189 } |
8829 $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j]), 'UTF-8'); |
9190 $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j]), 'UTF-8'); |
8830 } |
9191 } |
8853 return $full; |
9214 return $full; |
8854 } |
9215 } |
8855 |
9216 |
8856 function error($message, $level, $file, $line) |
9217 function error($message, $level, $file, $line) |
8857 { |
9218 { |
8858 switch ($level) |
9219 if ((ini_get('error_reporting') & $level) > 0) |
8859 { |
9220 { |
8860 case E_USER_ERROR: |
9221 switch ($level) |
8861 $note = 'PHP Error'; |
9222 { |
8862 break; |
9223 case E_USER_ERROR: |
8863 case E_USER_WARNING: |
9224 $note = 'PHP Error'; |
8864 $note = 'PHP Warning'; |
9225 break; |
8865 break; |
9226 case E_USER_WARNING: |
8866 case E_USER_NOTICE: |
9227 $note = 'PHP Warning'; |
8867 $note = 'PHP Notice'; |
9228 break; |
8868 break; |
9229 case E_USER_NOTICE: |
8869 default: |
9230 $note = 'PHP Notice'; |
8870 $note = 'Unknown Error'; |
9231 break; |
8871 break; |
9232 default: |
8872 } |
9233 $note = 'Unknown Error'; |
8873 error_log("$note: $message in $file on line $line", 0); |
9234 break; |
9235 } |
|
9236 error_log("$note: $message in $file on line $line", 0); |
|
9237 } |
|
8874 return $message; |
9238 return $message; |
8875 } |
9239 } |
8876 |
9240 |
8877 /** |
9241 /** |
8878 * If a file has been cached, retrieve and display it. |
9242 * If a file has been cached, retrieve and display it. |
8920 |
9284 |
8921 function fix_protocol($url, $http = 1) |
9285 function fix_protocol($url, $http = 1) |
8922 { |
9286 { |
8923 $url = SimplePie_Misc::normalize_url($url); |
9287 $url = SimplePie_Misc::normalize_url($url); |
8924 $parsed = SimplePie_Misc::parse_url($url); |
9288 $parsed = SimplePie_Misc::parse_url($url); |
8925 if ($parsed['scheme'] !== '' && $parsed['scheme'] != 'http' && $parsed['scheme'] != 'https') |
9289 if ($parsed['scheme'] !== '' && $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https') |
8926 { |
9290 { |
8927 return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http); |
9291 return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http); |
8928 } |
9292 } |
8929 |
9293 |
8930 if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url)) |
9294 if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url)) |
8931 { |
9295 { |
8932 return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http); |
9296 return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http); |
8933 } |
9297 } |
8934 |
9298 |
8935 if ($http == 2 && $parsed['scheme'] !== '') |
9299 if ($http === 2 && $parsed['scheme'] !== '') |
8936 { |
9300 { |
8937 return "feed:$url"; |
9301 return "feed:$url"; |
8938 } |
9302 } |
8939 elseif ($http == 3 && strtolower($parsed['scheme']) == 'http') |
9303 elseif ($http === 3 && strtolower($parsed['scheme']) === 'http') |
8940 { |
9304 { |
8941 return substr_replace($url, 'podcast', 0, 4); |
9305 return substr_replace($url, 'podcast', 0, 4); |
8942 } |
9306 } |
8943 elseif ($http == 4 && strtolower($parsed['scheme']) == 'http') |
9307 elseif ($http === 4 && strtolower($parsed['scheme']) === 'http') |
8944 { |
9308 { |
8945 return substr_replace($url, 'itpc', 0, 4); |
9309 return substr_replace($url, 'itpc', 0, 4); |
8946 } |
9310 } |
8947 else |
9311 else |
8948 { |
9312 { |
8950 } |
9314 } |
8951 } |
9315 } |
8952 |
9316 |
8953 function parse_url($url) |
9317 function parse_url($url) |
8954 { |
9318 { |
8955 preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match); |
9319 $iri =& new SimplePie_IRI($url); |
8956 for ($i = count($match); $i <= 9; $i++) |
9320 return array( |
8957 { |
9321 'scheme' => (string) $iri->get_scheme(), |
8958 $match[$i] = ''; |
9322 'authority' => (string) $iri->get_authority(), |
8959 } |
9323 'path' => (string) $iri->get_path(), |
8960 return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]); |
9324 'query' => (string) $iri->get_query(), |
9325 'fragment' => (string) $iri->get_fragment() |
|
9326 ); |
|
8961 } |
9327 } |
8962 |
9328 |
8963 function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '') |
9329 function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '') |
8964 { |
9330 { |
8965 $return = ''; |
9331 $iri =& new SimplePie_IRI(''); |
8966 if ($scheme !== '') |
9332 $iri->set_scheme($scheme); |
8967 { |
9333 $iri->set_authority($authority); |
8968 $return .= "$scheme:"; |
9334 $iri->set_path($path); |
8969 } |
9335 $iri->set_query($query); |
8970 if ($authority !== '') |
9336 $iri->set_fragment($fragment); |
8971 { |
9337 return $iri->get_iri(); |
8972 $return .= "//$authority"; |
|
8973 } |
|
8974 if ($path !== '') |
|
8975 { |
|
8976 $return .= $path; |
|
8977 } |
|
8978 if ($query !== '') |
|
8979 { |
|
8980 $return .= "?$query"; |
|
8981 } |
|
8982 if ($fragment !== '') |
|
8983 { |
|
8984 $return .= "#$fragment"; |
|
8985 } |
|
8986 return $return; |
|
8987 } |
9338 } |
8988 |
9339 |
8989 function normalize_url($url) |
9340 function normalize_url($url) |
8990 { |
9341 { |
8991 $url = preg_replace_callback('/%([0-9A-Fa-f]{2})/', array('SimplePie_Misc', 'percent_encoding_normalization'), $url); |
9342 $iri =& new SimplePie_IRI($url); |
8992 $url = SimplePie_Misc::parse_url($url); |
9343 return $iri->get_iri(); |
8993 $url['scheme'] = strtolower($url['scheme']); |
|
8994 if ($url['authority'] !== '') |
|
8995 { |
|
8996 $url['authority'] = strtolower($url['authority']); |
|
8997 $url['path'] = SimplePie_Misc::remove_dot_segments($url['path']); |
|
8998 } |
|
8999 return SimplePie_Misc::compress_parse_url($url['scheme'], $url['authority'], $url['path'], $url['query'], $url['fragment']); |
|
9000 } |
9344 } |
9001 |
9345 |
9002 function percent_encoding_normalization($match) |
9346 function percent_encoding_normalization($match) |
9003 { |
9347 { |
9004 $integer = hexdec($match[1]); |
9348 $integer = hexdec($match[1]); |
9005 if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer == 0x2D || $integer == 0x2E || $integer == 0x5F || $integer == 0x7E) |
9349 if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E) |
9006 { |
9350 { |
9007 return chr($integer); |
9351 return chr($integer); |
9008 } |
9352 } |
9009 else |
9353 else |
9010 { |
9354 { |
9080 } |
9424 } |
9081 $data = substr($data, 0, strcspn($data, $non_ascii_octects)); |
9425 $data = substr($data, 0, strcspn($data, $non_ascii_octects)); |
9082 } |
9426 } |
9083 |
9427 |
9084 // This is first, as behaviour of this is completely predictable |
9428 // This is first, as behaviour of this is completely predictable |
9085 if ($input === 'Windows-1252' && $output === 'UTF-8') |
9429 if ($input === 'windows-1252' && $output === 'UTF-8') |
9086 { |
9430 { |
9087 return SimplePie_Misc::windows_1252_to_utf8($data); |
9431 return SimplePie_Misc::windows_1252_to_utf8($data); |
9088 } |
9432 } |
9089 // This is second, as behaviour of this varies only with PHP version |
9433 // This is second, as behaviour of this varies only with PHP version (the middle part of this expression checks the encoding is supported). |
9090 elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($data, $output, $input))) |
9434 elseif (function_exists('mb_convert_encoding') && @mb_convert_encoding("\x80", 'UTF-16BE', $input) !== "\x00\x80" && ($return = @mb_convert_encoding($data, $output, $input))) |
9091 { |
9435 { |
9092 return $return; |
9436 return $return; |
9093 } |
9437 } |
9094 // This is last, as behaviour of this varies with OS userland and PHP version |
9438 // This is last, as behaviour of this varies with OS userland and PHP version |
9095 elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data))) |
9439 elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data))) |
9103 } |
9447 } |
9104 } |
9448 } |
9105 |
9449 |
9106 function encoding($charset) |
9450 function encoding($charset) |
9107 { |
9451 { |
9108 /* Character sets are case-insensitive, and also need some further |
9452 // Normalization from UTS #22 |
9109 normalization in the real world (though we'll return them in the form given |
9453 switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset))) |
9110 in their registration). */ |
|
9111 switch (strtolower(preg_replace('/[\x09-\x0D\x20-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]/', '', $charset))) |
|
9112 { |
9454 { |
9113 case 'adobestandardencoding': |
9455 case 'adobestandardencoding': |
9114 case 'csadobestandardencoding': |
9456 case 'csadobestandardencoding': |
9115 return 'Adobe-Standard-Encoding'; |
9457 return 'Adobe-Standard-Encoding'; |
9116 |
9458 |
9117 case 'adobesymbolencoding': |
9459 case 'adobesymbolencoding': |
9118 case 'cshppsmath': |
9460 case 'cshppsmath': |
9119 return 'Adobe-Symbol-Encoding'; |
9461 return 'Adobe-Symbol-Encoding'; |
9120 |
9462 |
9121 case 'ami1251': |
9463 case 'ami1251': |
9122 case 'ami1251': |
|
9123 case 'amiga1251': |
|
9124 case 'amiga1251': |
9464 case 'amiga1251': |
9125 return 'Amiga-1251'; |
9465 return 'Amiga-1251'; |
9126 |
9466 |
9127 case 'ansix31101983': |
9467 case 'ansix31101983': |
9128 case 'csat5001983': |
9468 case 'csat5001983': |
9132 return 'ANSI_X3.110-1983'; |
9472 return 'ANSI_X3.110-1983'; |
9133 |
9473 |
9134 case 'arabic7': |
9474 case 'arabic7': |
9135 case 'asmo449': |
9475 case 'asmo449': |
9136 case 'csiso89asmo449': |
9476 case 'csiso89asmo449': |
9477 case 'iso9036': |
|
9137 case 'isoir89': |
9478 case 'isoir89': |
9138 case 'iso9036': |
|
9139 return 'ASMO_449'; |
9479 return 'ASMO_449'; |
9140 |
9480 |
9141 case 'big5': |
9481 case 'big5': |
9142 case 'csbig5': |
9482 case 'csbig5': |
9143 case 'xxbig5': |
9483 case 'xxbig5': |
9155 return 'BRF'; |
9495 return 'BRF'; |
9156 |
9496 |
9157 case 'bs4730': |
9497 case 'bs4730': |
9158 case 'csiso4unitedkingdom': |
9498 case 'csiso4unitedkingdom': |
9159 case 'gb': |
9499 case 'gb': |
9500 case 'iso646gb': |
|
9160 case 'isoir4': |
9501 case 'isoir4': |
9161 case 'iso646gb': |
|
9162 case 'uk': |
9502 case 'uk': |
9163 return 'BS_4730'; |
9503 return 'BS_4730'; |
9164 |
9504 |
9165 case 'bsviewdata': |
9505 case 'bsviewdata': |
9166 case 'csiso47bsviewdata': |
9506 case 'csiso47bsviewdata': |
9173 |
9513 |
9174 case 'ca': |
9514 case 'ca': |
9175 case 'csa71': |
9515 case 'csa71': |
9176 case 'csaz243419851': |
9516 case 'csaz243419851': |
9177 case 'csiso121canadian1': |
9517 case 'csiso121canadian1': |
9518 case 'iso646ca': |
|
9178 case 'isoir121': |
9519 case 'isoir121': |
9179 case 'iso646ca': |
|
9180 return 'CSA_Z243.4-1985-1'; |
9520 return 'CSA_Z243.4-1985-1'; |
9181 |
9521 |
9182 case 'csa72': |
9522 case 'csa72': |
9183 case 'csaz243419852': |
9523 case 'csaz243419852': |
9184 case 'csiso122canadian2': |
9524 case 'csiso122canadian2': |
9525 case 'iso646ca2': |
|
9185 case 'isoir122': |
9526 case 'isoir122': |
9186 case 'iso646ca2': |
|
9187 return 'CSA_Z243.4-1985-2'; |
9527 return 'CSA_Z243.4-1985-2'; |
9188 |
9528 |
9189 case 'csaz24341985gr': |
9529 case 'csaz24341985gr': |
9190 case 'csiso123csaz24341985gr': |
9530 case 'csiso123csaz24341985gr': |
9191 case 'isoir123': |
9531 case 'isoir123': |
9202 return 'DEC-MCS'; |
9542 return 'DEC-MCS'; |
9203 |
9543 |
9204 case 'csiso21german': |
9544 case 'csiso21german': |
9205 case 'de': |
9545 case 'de': |
9206 case 'din66003': |
9546 case 'din66003': |
9547 case 'iso646de': |
|
9207 case 'isoir21': |
9548 case 'isoir21': |
9208 case 'iso646de': |
|
9209 return 'DIN_66003'; |
9549 return 'DIN_66003'; |
9210 |
9550 |
9211 case 'csdkus': |
9551 case 'csdkus': |
9212 case 'dkus': |
9552 case 'dkus': |
9213 return 'dk-us'; |
9553 return 'dk-us'; |
9214 |
9554 |
9215 case 'csiso646danish': |
9555 case 'csiso646danish': |
9216 case 'dk': |
9556 case 'dk': |
9217 case 'ds2089': |
|
9218 case 'ds2089': |
9557 case 'ds2089': |
9219 case 'iso646dk': |
9558 case 'iso646dk': |
9220 return 'DS_2089'; |
9559 return 'DS_2089'; |
9221 |
9560 |
9222 case 'csibmebcdicatde': |
9561 case 'csibmebcdicatde': |
9285 case 'koi8e': |
9624 case 'koi8e': |
9286 return 'ECMA-cyrillic'; |
9625 return 'ECMA-cyrillic'; |
9287 |
9626 |
9288 case 'csiso17spanish': |
9627 case 'csiso17spanish': |
9289 case 'es': |
9628 case 'es': |
9629 case 'iso646es': |
|
9290 case 'isoir17': |
9630 case 'isoir17': |
9291 case 'iso646es': |
|
9292 return 'ES'; |
9631 return 'ES'; |
9293 |
9632 |
9294 case 'csiso85spanish2': |
9633 case 'csiso85spanish2': |
9295 case 'es2': |
9634 case 'es2': |
9635 case 'iso646es2': |
|
9296 case 'isoir85': |
9636 case 'isoir85': |
9297 case 'iso646es2': |
|
9298 return 'ES2'; |
9637 return 'ES2'; |
9299 |
9638 |
9300 case 'cseucfixwidjapanese': |
9639 case 'cseucfixwidjapanese': |
9301 case 'extendedunixcodefixedwidthforjapanese': |
9640 case 'extendedunixcodefixedwidthforjapanese': |
9302 return 'Extended_UNIX_Code_Fixed_Width_for_Japanese'; |
9641 return 'Extended_UNIX_Code_Fixed_Width_for_Japanese'; |
9307 return 'Extended_UNIX_Code_Packed_Format_for_Japanese'; |
9646 return 'Extended_UNIX_Code_Packed_Format_for_Japanese'; |
9308 |
9647 |
9309 case 'gb18030': |
9648 case 'gb18030': |
9310 return 'GB18030'; |
9649 return 'GB18030'; |
9311 |
9650 |
9651 case 'chinese': |
|
9312 case 'cp936': |
9652 case 'cp936': |
9653 case 'csgb2312': |
|
9654 case 'csiso58gb231280': |
|
9655 case 'gb2312': |
|
9656 case 'gb231280': |
|
9313 case 'gbk': |
9657 case 'gbk': |
9658 case 'isoir58': |
|
9314 case 'ms936': |
9659 case 'ms936': |
9315 case 'windows936': |
9660 case 'windows936': |
9316 case 'csgb2312': |
|
9317 case 'gb2312': |
|
9318 case 'chinese': |
|
9319 case 'csiso58gb231280': |
|
9320 case 'gb231280': |
|
9321 case 'isoir58': |
|
9322 return 'GBK'; |
9661 return 'GBK'; |
9323 |
9662 |
9324 case 'cn': |
9663 case 'cn': |
9325 case 'csiso57gb1988': |
9664 case 'csiso57gb1988': |
9326 case 'gb198880': |
9665 case 'gb198880': |
9666 case 'iso646cn': |
|
9327 case 'isoir57': |
9667 case 'isoir57': |
9328 case 'iso646cn': |
|
9329 return 'GB_1988-80'; |
9668 return 'GB_1988-80'; |
9330 |
9669 |
9331 case 'csiso153gost1976874': |
9670 case 'csiso153gost1976874': |
9332 case 'gost1976874': |
9671 case 'gost1976874': |
9333 case 'isoir153': |
9672 case 'isoir153': |
9381 |
9720 |
9382 case 'csibmthai': |
9721 case 'csibmthai': |
9383 case 'ibmthai': |
9722 case 'ibmthai': |
9384 return 'IBM-Thai'; |
9723 return 'IBM-Thai'; |
9385 |
9724 |
9386 case 'ccsid00858': |
9725 case 'ccsid858': |
9387 case 'cp00858': |
9726 case 'cp858': |
9388 case 'ibm00858': |
9727 case 'ibm858': |
9389 case 'pcmultilingual850euro': |
9728 case 'pcmultilingual850euro': |
9390 return 'IBM00858'; |
9729 return 'IBM00858'; |
9391 |
9730 |
9392 case 'ccsid00924': |
9731 case 'ccsid924': |
9393 case 'cp00924': |
9732 case 'cp924': |
9394 case 'ebcdiclatin9euro': |
9733 case 'ebcdiclatin9euro': |
9395 case 'ibm00924': |
9734 case 'ibm924': |
9396 return 'IBM00924'; |
9735 return 'IBM00924'; |
9397 |
9736 |
9398 case 'ccsid01140': |
9737 case 'ccsid1140': |
9399 case 'cp01140': |
9738 case 'cp1140': |
9400 case 'ebcdicus37euro': |
9739 case 'ebcdicus37euro': |
9401 case 'ibm01140': |
9740 case 'ibm1140': |
9402 return 'IBM01140'; |
9741 return 'IBM01140'; |
9403 |
9742 |
9404 case 'ccsid01141': |
9743 case 'ccsid1141': |
9405 case 'cp01141': |
9744 case 'cp1141': |
9406 case 'ebcdicde273euro': |
9745 case 'ebcdicde273euro': |
9407 case 'ibm01141': |
9746 case 'ibm1141': |
9408 return 'IBM01141'; |
9747 return 'IBM01141'; |
9409 |
9748 |
9410 case 'ccsid01142': |
9749 case 'ccsid1142': |
9411 case 'cp01142': |
9750 case 'cp1142': |
9412 case 'ebcdicdk277euro': |
9751 case 'ebcdicdk277euro': |
9413 case 'ebcdicno277euro': |
9752 case 'ebcdicno277euro': |
9414 case 'ibm01142': |
9753 case 'ibm1142': |
9415 return 'IBM01142'; |
9754 return 'IBM01142'; |
9416 |
9755 |
9417 case 'ccsid01143': |
9756 case 'ccsid1143': |
9418 case 'cp01143': |
9757 case 'cp1143': |
9419 case 'ebcdicfi278euro': |
9758 case 'ebcdicfi278euro': |
9420 case 'ebcdicse278euro': |
9759 case 'ebcdicse278euro': |
9421 case 'ibm01143': |
9760 case 'ibm1143': |
9422 return 'IBM01143'; |
9761 return 'IBM01143'; |
9423 |
9762 |
9424 case 'ccsid01144': |
9763 case 'ccsid1144': |
9425 case 'cp01144': |
9764 case 'cp1144': |
9426 case 'ebcdicit280euro': |
9765 case 'ebcdicit280euro': |
9427 case 'ibm01144': |
9766 case 'ibm1144': |
9428 return 'IBM01144'; |
9767 return 'IBM01144'; |
9429 |
9768 |
9430 case 'ccsid01145': |
9769 case 'ccsid1145': |
9431 case 'cp01145': |
9770 case 'cp1145': |
9432 case 'ebcdices284euro': |
9771 case 'ebcdices284euro': |
9433 case 'ibm01145': |
9772 case 'ibm1145': |
9434 return 'IBM01145'; |
9773 return 'IBM01145'; |
9435 |
9774 |
9436 case 'ccsid01146': |
9775 case 'ccsid1146': |
9437 case 'cp01146': |
9776 case 'cp1146': |
9438 case 'ebcdicgb285euro': |
9777 case 'ebcdicgb285euro': |
9439 case 'ibm01146': |
9778 case 'ibm1146': |
9440 return 'IBM01146'; |
9779 return 'IBM01146'; |
9441 |
9780 |
9442 case 'ccsid01147': |
9781 case 'ccsid1147': |
9443 case 'cp01147': |
9782 case 'cp1147': |
9444 case 'ebcdicfr297euro': |
9783 case 'ebcdicfr297euro': |
9445 case 'ibm01147': |
9784 case 'ibm1147': |
9446 return 'IBM01147'; |
9785 return 'IBM01147'; |
9447 |
9786 |
9448 case 'ccsid01148': |
9787 case 'ccsid1148': |
9449 case 'cp01148': |
9788 case 'cp1148': |
9450 case 'ebcdicinternational500euro': |
9789 case 'ebcdicinternational500euro': |
9451 case 'ibm01148': |
9790 case 'ibm1148': |
9452 return 'IBM01148'; |
9791 return 'IBM01148'; |
9453 |
9792 |
9454 case 'ccsid01149': |
9793 case 'ccsid1149': |
9455 case 'cp01149': |
9794 case 'cp1149': |
9456 case 'ebcdicis871euro': |
9795 case 'ebcdicis871euro': |
9457 case 'ibm01149': |
9796 case 'ibm1149': |
9458 return 'IBM01149'; |
9797 return 'IBM01149'; |
9459 |
9798 |
9460 case 'cp037': |
9799 case 'cp37': |
9461 case 'csibm037': |
9800 case 'csibm37': |
9462 case 'ebcdiccpca': |
9801 case 'ebcdiccpca': |
9463 case 'ebcdiccpnl': |
9802 case 'ebcdiccpnl': |
9464 case 'ebcdiccpus': |
9803 case 'ebcdiccpus': |
9465 case 'ebcdiccpwt': |
9804 case 'ebcdiccpwt': |
9466 case 'ibm037': |
9805 case 'ibm37': |
9467 return 'IBM037'; |
9806 return 'IBM037'; |
9468 |
9807 |
9469 case 'cp038': |
9808 case 'cp38': |
9470 case 'csibm038': |
9809 case 'csibm38': |
9471 case 'ebcdicint': |
9810 case 'ebcdicint': |
9472 case 'ibm038': |
9811 case 'ibm38': |
9473 return 'IBM038'; |
9812 return 'IBM038'; |
9474 |
9813 |
9475 case 'cp273': |
9814 case 'cp273': |
9476 case 'csibm273': |
9815 case 'csibm273': |
9477 case 'ibm273': |
9816 case 'ibm273': |
9609 case 'csibm860': |
9948 case 'csibm860': |
9610 case 'ibm860': |
9949 case 'ibm860': |
9611 return 'IBM860'; |
9950 return 'IBM860'; |
9612 |
9951 |
9613 case '861': |
9952 case '861': |
9953 case 'cp861': |
|
9614 case 'cpis': |
9954 case 'cpis': |
9615 case 'cp861': |
|
9616 case 'csibm861': |
9955 case 'csibm861': |
9617 case 'ibm861': |
9956 case 'ibm861': |
9618 return 'IBM861'; |
9957 return 'IBM861'; |
9619 |
9958 |
9620 case '862': |
9959 case '862': |
9644 case 'cp866': |
9983 case 'cp866': |
9645 case 'csibm866': |
9984 case 'csibm866': |
9646 case 'ibm866': |
9985 case 'ibm866': |
9647 return 'IBM866'; |
9986 return 'IBM866'; |
9648 |
9987 |
9988 case 'cp868': |
|
9649 case 'cpar': |
9989 case 'cpar': |
9650 case 'cp868': |
|
9651 case 'csibm868': |
9990 case 'csibm868': |
9652 case 'ibm868': |
9991 case 'ibm868': |
9653 return 'IBM868'; |
9992 return 'IBM868'; |
9654 |
9993 |
9655 case '869': |
9994 case '869': |
9995 case 'cp869': |
|
9656 case 'cpgr': |
9996 case 'cpgr': |
9657 case 'cp869': |
|
9658 case 'csibm869': |
9997 case 'csibm869': |
9659 case 'ibm869': |
9998 case 'ibm869': |
9660 return 'IBM869'; |
9999 return 'IBM869'; |
9661 |
10000 |
9662 case 'cp870': |
10001 case 'cp870': |
9710 case 'csibm1026': |
10049 case 'csibm1026': |
9711 case 'ibm1026': |
10050 case 'ibm1026': |
9712 return 'IBM1026'; |
10051 return 'IBM1026'; |
9713 |
10052 |
9714 case 'ibm1047': |
10053 case 'ibm1047': |
9715 case 'ibm1047': |
|
9716 return 'IBM1047'; |
10054 return 'IBM1047'; |
9717 |
10055 |
9718 case 'csiso143iecp271': |
10056 case 'csiso143iecp271': |
9719 case 'iecp271': |
10057 case 'iecp271': |
9720 case 'isoir143': |
10058 case 'isoir143': |
9765 case 'iso88591windows31latin1': |
10103 case 'iso88591windows31latin1': |
9766 return 'ISO-8859-1-Windows-3.1-Latin-1'; |
10104 return 'ISO-8859-1-Windows-3.1-Latin-1'; |
9767 |
10105 |
9768 case 'csisolatin2': |
10106 case 'csisolatin2': |
9769 case 'iso88592': |
10107 case 'iso88592': |
10108 case 'iso885921987': |
|
9770 case 'isoir101': |
10109 case 'isoir101': |
9771 case 'iso88592': |
|
9772 case 'iso885921987': |
|
9773 case 'l2': |
10110 case 'l2': |
9774 case 'latin2': |
10111 case 'latin2': |
9775 return 'ISO-8859-2'; |
10112 return 'ISO-8859-2'; |
9776 |
10113 |
9777 case 'cswindows31latin2': |
10114 case 'cswindows31latin2': |
9778 case 'iso88592windowslatin2': |
10115 case 'iso88592windowslatin2': |
9779 return 'ISO-8859-2-Windows-Latin-2'; |
10116 return 'ISO-8859-2-Windows-Latin-2'; |
9780 |
10117 |
9781 case 'csisolatin3': |
10118 case 'csisolatin3': |
9782 case 'iso88593': |
10119 case 'iso88593': |
10120 case 'iso885931988': |
|
9783 case 'isoir109': |
10121 case 'isoir109': |
9784 case 'iso88593': |
|
9785 case 'iso885931988': |
|
9786 case 'l3': |
10122 case 'l3': |
9787 case 'latin3': |
10123 case 'latin3': |
9788 return 'ISO-8859-3'; |
10124 return 'ISO-8859-3'; |
9789 |
10125 |
9790 case 'csisolatin4': |
10126 case 'csisolatin4': |
9791 case 'iso88594': |
10127 case 'iso88594': |
10128 case 'iso885941988': |
|
9792 case 'isoir110': |
10129 case 'isoir110': |
9793 case 'iso88594': |
|
9794 case 'iso885941988': |
|
9795 case 'l4': |
10130 case 'l4': |
9796 case 'latin4': |
10131 case 'latin4': |
9797 return 'ISO-8859-4'; |
10132 return 'ISO-8859-4'; |
9798 |
10133 |
9799 case 'csisolatincyrillic': |
10134 case 'csisolatincyrillic': |
9800 case 'cyrillic': |
10135 case 'cyrillic': |
9801 case 'iso88595': |
10136 case 'iso88595': |
10137 case 'iso885951988': |
|
9802 case 'isoir144': |
10138 case 'isoir144': |
9803 case 'iso88595': |
|
9804 case 'iso885951988': |
|
9805 return 'ISO-8859-5'; |
10139 return 'ISO-8859-5'; |
9806 |
10140 |
9807 case 'arabic': |
10141 case 'arabic': |
9808 case 'asmo708': |
10142 case 'asmo708': |
9809 case 'csisolatinarabic': |
10143 case 'csisolatinarabic': |
9810 case 'ecma114': |
10144 case 'ecma114': |
9811 case 'iso88596': |
10145 case 'iso88596': |
10146 case 'iso885961987': |
|
9812 case 'isoir127': |
10147 case 'isoir127': |
9813 case 'iso88596': |
|
9814 case 'iso885961987': |
|
9815 return 'ISO-8859-6'; |
10148 return 'ISO-8859-6'; |
9816 |
10149 |
9817 case 'csiso88596e': |
10150 case 'csiso88596e': |
9818 case 'iso88596e': |
10151 case 'iso88596e': |
9819 case 'iso88596e': |
|
9820 return 'ISO-8859-6-E'; |
10152 return 'ISO-8859-6-E'; |
9821 |
10153 |
9822 case 'csiso88596i': |
10154 case 'csiso88596i': |
9823 case 'iso88596i': |
|
9824 case 'iso88596i': |
10155 case 'iso88596i': |
9825 return 'ISO-8859-6-I'; |
10156 return 'ISO-8859-6-I'; |
9826 |
10157 |
9827 case 'csisolatingreek': |
10158 case 'csisolatingreek': |
9828 case 'ecma118': |
10159 case 'ecma118': |
9829 case 'elot928': |
10160 case 'elot928': |
9830 case 'greek': |
10161 case 'greek': |
9831 case 'greek8': |
10162 case 'greek8': |
9832 case 'iso88597': |
10163 case 'iso88597': |
10164 case 'iso885971987': |
|
9833 case 'isoir126': |
10165 case 'isoir126': |
9834 case 'iso88597': |
|
9835 case 'iso885971987': |
|
9836 return 'ISO-8859-7'; |
10166 return 'ISO-8859-7'; |
9837 |
10167 |
9838 case 'csisolatinhebrew': |
10168 case 'csisolatinhebrew': |
9839 case 'hebrew': |
10169 case 'hebrew': |
9840 case 'iso88598': |
10170 case 'iso88598': |
10171 case 'iso885981988': |
|
9841 case 'isoir138': |
10172 case 'isoir138': |
9842 case 'iso88598': |
|
9843 case 'iso885981988': |
|
9844 return 'ISO-8859-8'; |
10173 return 'ISO-8859-8'; |
9845 |
10174 |
9846 case 'csiso88598e': |
10175 case 'csiso88598e': |
9847 case 'iso88598e': |
10176 case 'iso88598e': |
9848 case 'iso88598e': |
|
9849 return 'ISO-8859-8-E'; |
10177 return 'ISO-8859-8-E'; |
9850 |
10178 |
9851 case 'csiso88598i': |
10179 case 'csiso88598i': |
9852 case 'iso88598i': |
|
9853 case 'iso88598i': |
10180 case 'iso88598i': |
9854 return 'ISO-8859-8-I'; |
10181 return 'ISO-8859-8-I'; |
9855 |
10182 |
9856 case 'cswindows31latin5': |
10183 case 'cswindows31latin5': |
9857 case 'iso88599windowslatin5': |
10184 case 'iso88599windowslatin5': |
9858 return 'ISO-8859-9-Windows-Latin-5'; |
10185 return 'ISO-8859-9-Windows-Latin-5'; |
9859 |
10186 |
9860 case 'csisolatin6': |
10187 case 'csisolatin6': |
9861 case 'iso885910': |
10188 case 'iso885910': |
10189 case 'iso8859101992': |
|
9862 case 'isoir157': |
10190 case 'isoir157': |
9863 case 'iso8859101992': |
|
9864 case 'l6': |
10191 case 'l6': |
9865 case 'latin6': |
10192 case 'latin6': |
9866 return 'ISO-8859-10'; |
10193 return 'ISO-8859-10'; |
9867 |
10194 |
9868 case 'iso885913': |
10195 case 'iso885913': |
9869 return 'ISO-8859-13'; |
10196 return 'ISO-8859-13'; |
9870 |
10197 |
9871 case 'iso885914': |
10198 case 'iso885914': |
10199 case 'iso8859141998': |
|
9872 case 'isoceltic': |
10200 case 'isoceltic': |
9873 case 'isoir199': |
10201 case 'isoir199': |
9874 case 'iso885914': |
|
9875 case 'iso8859141998': |
|
9876 case 'l8': |
10202 case 'l8': |
9877 case 'latin8': |
10203 case 'latin8': |
9878 return 'ISO-8859-14'; |
10204 return 'ISO-8859-14'; |
9879 |
10205 |
9880 case 'iso885915': |
10206 case 'iso885915': |
9881 case 'iso885915': |
|
9882 case 'latin9': |
10207 case 'latin9': |
9883 return 'ISO-8859-15'; |
10208 return 'ISO-8859-15'; |
9884 |
10209 |
9885 case 'iso885916': |
10210 case 'iso885916': |
10211 case 'iso8859162001': |
|
9886 case 'isoir226': |
10212 case 'isoir226': |
9887 case 'iso885916': |
|
9888 case 'iso8859162001': |
|
9889 case 'l10': |
10213 case 'l10': |
9890 case 'latin10': |
10214 case 'latin10': |
9891 return 'ISO-8859-16'; |
10215 return 'ISO-8859-16'; |
9892 |
10216 |
9893 case 'iso10646j1': |
10217 case 'iso10646j1': |
9914 case 'iso10646utf1': |
10238 case 'iso10646utf1': |
9915 return 'ISO-10646-UTF-1'; |
10239 return 'ISO-10646-UTF-1'; |
9916 |
10240 |
9917 case 'csiso115481': |
10241 case 'csiso115481': |
9918 case 'iso115481': |
10242 case 'iso115481': |
9919 case 'iso115481': |
|
9920 case 'isotr115481': |
10243 case 'isotr115481': |
9921 return 'ISO-11548-1'; |
10244 return 'ISO-11548-1'; |
9922 |
10245 |
9923 case 'csiso90': |
10246 case 'csiso90': |
9924 case 'isoir90': |
10247 case 'isoir90': |
9949 case 'ref': |
10272 case 'ref': |
9950 return 'ISO_646.basic:1983'; |
10273 return 'ISO_646.basic:1983'; |
9951 |
10274 |
9952 case 'csiso2intlrefversion': |
10275 case 'csiso2intlrefversion': |
9953 case 'irv': |
10276 case 'irv': |
10277 case 'iso646irv1983': |
|
9954 case 'isoir2': |
10278 case 'isoir2': |
9955 case 'iso646irv1983': |
|
9956 return 'ISO_646.irv:1983'; |
10279 return 'ISO_646.irv:1983'; |
9957 |
10280 |
9958 case 'csiso2033': |
10281 case 'csiso2033': |
9959 case 'e13b': |
10282 case 'e13b': |
10283 case 'iso20331983': |
|
9960 case 'isoir98': |
10284 case 'isoir98': |
9961 case 'iso20331983': |
|
9962 return 'ISO_2033-1983'; |
10285 return 'ISO_2033-1983'; |
9963 |
10286 |
9964 case 'csiso5427cyrillic': |
10287 case 'csiso5427cyrillic': |
10288 case 'iso5427': |
|
9965 case 'isoir37': |
10289 case 'isoir37': |
9966 case 'iso5427': |
|
9967 return 'ISO_5427'; |
10290 return 'ISO_5427'; |
9968 |
10291 |
9969 case 'isoir54': |
|
9970 case 'iso5427cyrillic1981': |
10292 case 'iso5427cyrillic1981': |
9971 case 'iso54271981': |
10293 case 'iso54271981': |
10294 case 'isoir54': |
|
9972 return 'ISO_5427:1981'; |
10295 return 'ISO_5427:1981'; |
9973 |
10296 |
9974 case 'csiso5428greek': |
10297 case 'csiso5428greek': |
10298 case 'iso54281980': |
|
9975 case 'isoir55': |
10299 case 'isoir55': |
9976 case 'iso54281980': |
|
9977 return 'ISO_5428:1980'; |
10300 return 'ISO_5428:1980'; |
9978 |
10301 |
9979 case 'csiso6937add': |
10302 case 'csiso6937add': |
10303 case 'iso6937225': |
|
9980 case 'isoir152': |
10304 case 'isoir152': |
9981 case 'iso6937225': |
|
9982 return 'ISO_6937-2-25'; |
10305 return 'ISO_6937-2-25'; |
9983 |
10306 |
9984 case 'csisotextcomm': |
10307 case 'csisotextcomm': |
10308 case 'iso69372add': |
|
9985 case 'isoir142': |
10309 case 'isoir142': |
9986 case 'iso69372add': |
|
9987 return 'ISO_6937-2-add'; |
10310 return 'ISO_6937-2-add'; |
9988 |
10311 |
9989 case 'csiso8859supp': |
10312 case 'csiso8859supp': |
10313 case 'iso8859supp': |
|
9990 case 'isoir154': |
10314 case 'isoir154': |
9991 case 'iso8859supp': |
|
9992 case 'latin125': |
10315 case 'latin125': |
9993 return 'ISO_8859-supp'; |
10316 return 'ISO_8859-supp'; |
9994 |
10317 |
9995 case 'csiso10367box': |
10318 case 'csiso10367box': |
10319 case 'iso10367box': |
|
9996 case 'isoir155': |
10320 case 'isoir155': |
9997 case 'iso10367box': |
|
9998 return 'ISO_10367-box'; |
10321 return 'ISO_10367-box'; |
9999 |
10322 |
10000 case 'csiso15italian': |
10323 case 'csiso15italian': |
10324 case 'iso646it': |
|
10001 case 'isoir15': |
10325 case 'isoir15': |
10002 case 'iso646it': |
|
10003 case 'it': |
10326 case 'it': |
10004 return 'IT'; |
10327 return 'IT'; |
10005 |
10328 |
10006 case 'csiso13jisc6220jp': |
10329 case 'csiso13jisc6220jp': |
10007 case 'isoir13': |
10330 case 'isoir13': |
10008 case 'jisc62201969': |
10331 case 'jisc62201969': |
10009 case 'jisc62201969jp': |
10332 case 'jisc62201969jp': |
10010 case 'katakana': |
10333 case 'katakana': |
10011 case 'x02017': |
10334 case 'x2017': |
10012 return 'JIS_C6220-1969-jp'; |
10335 return 'JIS_C6220-1969-jp'; |
10013 |
10336 |
10014 case 'csiso14jisc6220ro': |
10337 case 'csiso14jisc6220ro': |
10338 case 'iso646jp': |
|
10015 case 'isoir14': |
10339 case 'isoir14': |
10016 case 'iso646jp': |
|
10017 case 'jisc62201969ro': |
10340 case 'jisc62201969ro': |
10018 case 'jp': |
10341 case 'jp': |
10019 return 'JIS_C6220-1969-ro'; |
10342 return 'JIS_C6220-1969-ro'; |
10020 |
10343 |
10021 case 'csiso42jisc62261978': |
10344 case 'csiso42jisc62261978': |
10022 case 'isoir42': |
10345 case 'isoir42': |
10023 case 'jisc62261978': |
10346 case 'jisc62261978': |
10024 return 'JIS_C6226-1978'; |
10347 return 'JIS_C6226-1978'; |
10025 |
10348 |
10026 case 'csiso87jisx0208': |
10349 case 'csiso87jisx208': |
10027 case 'isoir87': |
10350 case 'isoir87': |
10028 case 'jisc62261983': |
10351 case 'jisc62261983': |
10029 case 'jisx02081983': |
10352 case 'jisx2081983': |
10030 case 'x0208': |
10353 case 'x208': |
10031 return 'JIS_C6226-1983'; |
10354 return 'JIS_C6226-1983'; |
10032 |
10355 |
10033 case 'csiso91jisc62291984a': |
10356 case 'csiso91jisc62291984a': |
10034 case 'isoir91': |
10357 case 'isoir91': |
10035 case 'jisc62291984a': |
10358 case 'jisc62291984a': |
10036 case 'jpocra': |
10359 case 'jpocra': |
10037 return 'JIS_C6229-1984-a'; |
10360 return 'JIS_C6229-1984-a'; |
10038 |
10361 |
10039 case 'csiso92jisc62991984b': |
10362 case 'csiso92jisc62991984b': |
10363 case 'iso646jpocrb': |
|
10040 case 'isoir92': |
10364 case 'isoir92': |
10041 case 'iso646jpocrb': |
|
10042 case 'jisc62291984b': |
10365 case 'jisc62291984b': |
10043 case 'jpocrb': |
10366 case 'jpocrb': |
10044 return 'JIS_C6229-1984-b'; |
10367 return 'JIS_C6229-1984-b'; |
10045 |
10368 |
10046 case 'csiso93jis62291984badd': |
10369 case 'csiso93jis62291984badd': |
10069 case 'csjisencoding': |
10392 case 'csjisencoding': |
10070 case 'jisencoding': |
10393 case 'jisencoding': |
10071 return 'JIS_Encoding'; |
10394 return 'JIS_Encoding'; |
10072 |
10395 |
10073 case 'cshalfwidthkatakana': |
10396 case 'cshalfwidthkatakana': |
10074 case 'jisx0201': |
10397 case 'jisx201': |
10075 case 'x0201': |
10398 case 'x201': |
10076 return 'JIS_X0201'; |
10399 return 'JIS_X0201'; |
10077 |
10400 |
10078 case 'csiso159jisx02121990': |
10401 case 'csiso159jisx2121990': |
10079 case 'isoir159': |
10402 case 'isoir159': |
10080 case 'jisx02121990': |
10403 case 'jisx2121990': |
10081 case 'x0212': |
10404 case 'x212': |
10082 return 'JIS_X0212-1990'; |
10405 return 'JIS_X0212-1990'; |
10083 |
10406 |
10084 case 'csiso141jusib1002': |
10407 case 'csiso141jusib1002': |
10408 case 'iso646yu': |
|
10085 case 'isoir141': |
10409 case 'isoir141': |
10086 case 'iso646yu': |
|
10087 case 'js': |
10410 case 'js': |
10088 case 'jusib1002': |
10411 case 'jusib1002': |
10089 case 'yu': |
10412 case 'yu': |
10090 return 'JUS_I.B1.002'; |
10413 return 'JUS_I.B1.002'; |
10091 |
10414 |
10155 case 'mnemonic': |
10478 case 'mnemonic': |
10156 return 'MNEMONIC'; |
10479 return 'MNEMONIC'; |
10157 |
10480 |
10158 case 'csiso86hungarian': |
10481 case 'csiso86hungarian': |
10159 case 'hu': |
10482 case 'hu': |
10483 case 'iso646hu': |
|
10160 case 'isoir86': |
10484 case 'isoir86': |
10161 case 'iso646hu': |
|
10162 case 'msz77953': |
10485 case 'msz77953': |
10163 return 'MSZ_7795.3'; |
10486 return 'MSZ_7795.3'; |
10164 |
10487 |
10165 case 'csnatsdano': |
10488 case 'csnatsdano': |
10166 case 'isoir91': |
10489 case 'isoir91': |
10182 case 'natssefiadd': |
10505 case 'natssefiadd': |
10183 return 'NATS-SEFI-ADD'; |
10506 return 'NATS-SEFI-ADD'; |
10184 |
10507 |
10185 case 'csiso151cuba': |
10508 case 'csiso151cuba': |
10186 case 'cuba': |
10509 case 'cuba': |
10510 case 'iso646cu': |
|
10187 case 'isoir151': |
10511 case 'isoir151': |
10188 case 'iso646cu': |
10512 case 'ncnc1081': |
10189 case 'ncnc001081': |
|
10190 return 'NC_NC00-10:81'; |
10513 return 'NC_NC00-10:81'; |
10191 |
10514 |
10192 case 'csiso69french': |
10515 case 'csiso69french': |
10193 case 'fr': |
10516 case 'fr': |
10517 case 'iso646fr': |
|
10194 case 'isoir69': |
10518 case 'isoir69': |
10195 case 'iso646fr': |
|
10196 case 'nfz62010': |
10519 case 'nfz62010': |
10197 return 'NF_Z_62-010'; |
10520 return 'NF_Z_62-010'; |
10198 |
10521 |
10199 case 'csiso25french': |
10522 case 'csiso25french': |
10523 case 'iso646fr1': |
|
10200 case 'isoir25': |
10524 case 'isoir25': |
10201 case 'iso646fr1': |
|
10202 case 'nfz620101973': |
10525 case 'nfz620101973': |
10203 return 'NF_Z_62-010_(1973)'; |
10526 return 'NF_Z_62-010_(1973)'; |
10204 |
10527 |
10205 case 'csiso60danishnorwegian': |
10528 case 'csiso60danishnorwegian': |
10206 case 'csiso60norwegian1': |
10529 case 'csiso60norwegian1': |
10530 case 'iso646no': |
|
10207 case 'isoir60': |
10531 case 'isoir60': |
10208 case 'iso646no': |
|
10209 case 'no': |
10532 case 'no': |
10210 case 'ns45511': |
10533 case 'ns45511': |
10211 return 'NS_4551-1'; |
10534 return 'NS_4551-1'; |
10212 |
10535 |
10213 case 'csiso61norwegian2': |
10536 case 'csiso61norwegian2': |
10537 case 'iso646no2': |
|
10214 case 'isoir61': |
10538 case 'isoir61': |
10215 case 'iso646no2': |
|
10216 case 'no2': |
10539 case 'no2': |
10217 case 'ns45512': |
10540 case 'ns45512': |
10218 return 'NS_4551-2'; |
10541 return 'NS_4551-2'; |
10219 |
10542 |
10220 case 'osdebcdicdf03irv': |
10543 case 'osdebcdicdf3irv': |
10221 return 'OSD_EBCDIC_DF03_IRV'; |
10544 return 'OSD_EBCDIC_DF03_IRV'; |
10222 |
10545 |
10223 case 'osdebcdicdf041': |
10546 case 'osdebcdicdf41': |
10224 return 'OSD_EBCDIC_DF04_1'; |
10547 return 'OSD_EBCDIC_DF04_1'; |
10225 |
10548 |
10226 case 'osdebcdicdf0415': |
10549 case 'osdebcdicdf415': |
10227 return 'OSD_EBCDIC_DF04_15'; |
10550 return 'OSD_EBCDIC_DF04_15'; |
10228 |
10551 |
10229 case 'cspc8danishnorwegian': |
10552 case 'cspc8danishnorwegian': |
10230 case 'pc8danishnorwegian': |
10553 case 'pc8danishnorwegian': |
10231 return 'PC8-Danish-Norwegian'; |
10554 return 'PC8-Danish-Norwegian'; |
10233 case 'cspc8turkish': |
10556 case 'cspc8turkish': |
10234 case 'pc8turkish': |
10557 case 'pc8turkish': |
10235 return 'PC8-Turkish'; |
10558 return 'PC8-Turkish'; |
10236 |
10559 |
10237 case 'csiso16portuguese': |
10560 case 'csiso16portuguese': |
10561 case 'iso646pt': |
|
10238 case 'isoir16': |
10562 case 'isoir16': |
10239 case 'iso646pt': |
|
10240 case 'pt': |
10563 case 'pt': |
10241 return 'PT'; |
10564 return 'PT'; |
10242 |
10565 |
10243 case 'csiso84portuguese2': |
10566 case 'csiso84portuguese2': |
10567 case 'iso646pt2': |
|
10244 case 'isoir84': |
10568 case 'isoir84': |
10245 case 'iso646pt2': |
|
10246 case 'pt2': |
10569 case 'pt2': |
10247 return 'PT2'; |
10570 return 'PT2'; |
10248 |
10571 |
10249 case 'cp154': |
10572 case 'cp154': |
10250 case 'csptcp154': |
10573 case 'csptcp154': |
10256 case 'scsu': |
10579 case 'scsu': |
10257 return 'SCSU'; |
10580 return 'SCSU'; |
10258 |
10581 |
10259 case 'csiso10swedish': |
10582 case 'csiso10swedish': |
10260 case 'fi': |
10583 case 'fi': |
10261 case 'isoir10': |
|
10262 case 'iso646fi': |
10584 case 'iso646fi': |
10263 case 'iso646se': |
10585 case 'iso646se': |
10586 case 'isoir10': |
|
10264 case 'se': |
10587 case 'se': |
10265 case 'sen850200b': |
10588 case 'sen850200b': |
10266 return 'SEN_850200_B'; |
10589 return 'SEN_850200_B'; |
10267 |
10590 |
10268 case 'csiso11swedishfornames': |
10591 case 'csiso11swedishfornames': |
10592 case 'iso646se2': |
|
10269 case 'isoir11': |
10593 case 'isoir11': |
10270 case 'iso646se2': |
|
10271 case 'se2': |
10594 case 'se2': |
10272 case 'sen850200c': |
10595 case 'sen850200c': |
10273 return 'SEN_850200_C'; |
10596 return 'SEN_850200_C'; |
10274 |
10597 |
10275 case 'csshiftjis': |
10598 case 'csshiftjis': |
10313 case 'ansix341986': |
10636 case 'ansix341986': |
10314 case 'ascii': |
10637 case 'ascii': |
10315 case 'cp367': |
10638 case 'cp367': |
10316 case 'csascii': |
10639 case 'csascii': |
10317 case 'ibm367': |
10640 case 'ibm367': |
10641 case 'iso646irv1991': |
|
10642 case 'iso646us': |
|
10318 case 'isoir6': |
10643 case 'isoir6': |
10319 case 'iso646us': |
|
10320 case 'iso646irv1991': |
|
10321 case 'us': |
10644 case 'us': |
10322 case 'usascii': |
10645 case 'usascii': |
10323 return 'US-ASCII'; |
10646 return 'US-ASCII'; |
10324 |
10647 |
10325 case 'csusdk': |
10648 case 'csusdk': |
10379 case 'windows31j': |
10702 case 'windows31j': |
10380 return 'Windows-31J'; |
10703 return 'Windows-31J'; |
10381 |
10704 |
10382 case 'iso885911': |
10705 case 'iso885911': |
10383 case 'tis620': |
10706 case 'tis620': |
10384 return 'Windows-874'; |
10707 return 'windows-874'; |
10385 |
10708 |
10386 case 'cseuckr': |
10709 case 'cseuckr': |
10710 case 'csksc56011987': |
|
10387 case 'euckr': |
10711 case 'euckr': |
10388 case 'windows949': |
|
10389 case 'csksc56011987': |
|
10390 case 'isoir149': |
10712 case 'isoir149': |
10391 case 'korean': |
10713 case 'korean': |
10392 case 'ksc5601': |
10714 case 'ksc5601': |
10393 case 'ksc56011987': |
10715 case 'ksc56011987': |
10394 case 'ksc56011989': |
10716 case 'ksc56011989': |
10395 return 'Windows-949'; |
10717 case 'windows949': |
10718 return 'windows-949'; |
|
10396 |
10719 |
10397 case 'windows1250': |
10720 case 'windows1250': |
10398 return 'windows-1250'; |
10721 return 'windows-1250'; |
10399 |
10722 |
10400 case 'windows1251': |
10723 case 'windows1251': |
10402 |
10725 |
10403 case 'cp819': |
10726 case 'cp819': |
10404 case 'csisolatin1': |
10727 case 'csisolatin1': |
10405 case 'ibm819': |
10728 case 'ibm819': |
10406 case 'iso88591': |
10729 case 'iso88591': |
10730 case 'iso885911987': |
|
10407 case 'isoir100': |
10731 case 'isoir100': |
10408 case 'iso885911987': |
|
10409 case 'l1': |
10732 case 'l1': |
10410 case 'latin1': |
10733 case 'latin1': |
10411 case 'windows1252': |
10734 case 'windows1252': |
10412 return 'Windows-1252'; |
|
10413 |
|
10414 case 'windows1252': |
|
10415 return 'windows-1252'; |
10735 return 'windows-1252'; |
10416 |
10736 |
10417 case 'windows1253': |
10737 case 'windows1253': |
10418 return 'windows-1253'; |
10738 return 'windows-1253'; |
10419 |
10739 |
10420 case 'csisolatin5': |
10740 case 'csisolatin5': |
10421 case 'iso88599': |
10741 case 'iso88599': |
10742 case 'iso885991989': |
|
10422 case 'isoir148': |
10743 case 'isoir148': |
10423 case 'iso885991989': |
|
10424 case 'l5': |
10744 case 'l5': |
10425 case 'latin5': |
10745 case 'latin5': |
10426 case 'windows1254': |
10746 case 'windows1254': |
10427 return 'Windows-1254'; |
|
10428 |
|
10429 case 'windows1254': |
|
10430 return 'windows-1254'; |
10747 return 'windows-1254'; |
10431 |
10748 |
10432 case 'windows1255': |
10749 case 'windows1255': |
10433 return 'windows-1255'; |
10750 return 'windows-1255'; |
10434 |
10751 |
10450 { |
10767 { |
10451 if (is_array($curl = curl_version())) |
10768 if (is_array($curl = curl_version())) |
10452 { |
10769 { |
10453 $curl = $curl['version']; |
10770 $curl = $curl['version']; |
10454 } |
10771 } |
10455 elseif (substr($curl, 0, 5) == 'curl/') |
10772 elseif (substr($curl, 0, 5) === 'curl/') |
10456 { |
10773 { |
10457 $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5)); |
10774 $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5)); |
10458 } |
10775 } |
10459 elseif (substr($curl, 0, 8) == 'libcurl/') |
10776 elseif (substr($curl, 0, 8) === 'libcurl/') |
10460 { |
10777 { |
10461 $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8)); |
10778 $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8)); |
10462 } |
10779 } |
10463 else |
10780 else |
10464 { |
10781 { |
10467 return $curl; |
10784 return $curl; |
10468 } |
10785 } |
10469 |
10786 |
10470 function is_subclass_of($class1, $class2) |
10787 function is_subclass_of($class1, $class2) |
10471 { |
10788 { |
10472 if (func_num_args() != 2) |
10789 if (func_num_args() !== 2) |
10473 { |
10790 { |
10474 trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING); |
10791 trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING); |
10475 } |
10792 } |
10476 elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1)) |
10793 elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1)) |
10477 { |
10794 { |
10484 if (class_exists($class2)) |
10801 if (class_exists($class2)) |
10485 { |
10802 { |
10486 $class2 = strtolower($class2); |
10803 $class2 = strtolower($class2); |
10487 while ($class1 = strtolower(get_parent_class($class1))) |
10804 while ($class1 = strtolower(get_parent_class($class1))) |
10488 { |
10805 { |
10489 if ($class1 == $class2) |
10806 if ($class1 === $class2) |
10490 { |
10807 { |
10491 return true; |
10808 return true; |
10492 } |
10809 } |
10493 } |
10810 } |
10494 } |
10811 } |
10631 } |
10948 } |
10632 } |
10949 } |
10633 |
10950 |
10634 function atom_03_construct_type($attribs) |
10951 function atom_03_construct_type($attribs) |
10635 { |
10952 { |
10636 if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) == 'base64')) |
10953 if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64')) |
10637 { |
10954 { |
10638 $mode = SIMPLEPIE_CONSTRUCT_BASE64; |
10955 $mode = SIMPLEPIE_CONSTRUCT_BASE64; |
10639 } |
10956 } |
10640 else |
10957 else |
10641 { |
10958 { |
10703 return SIMPLEPIE_CONSTRUCT_HTML; |
11020 return SIMPLEPIE_CONSTRUCT_HTML; |
10704 |
11021 |
10705 case 'xhtml': |
11022 case 'xhtml': |
10706 return SIMPLEPIE_CONSTRUCT_XHTML; |
11023 return SIMPLEPIE_CONSTRUCT_XHTML; |
10707 } |
11024 } |
10708 if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) == 'text/') |
11025 if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/') |
10709 { |
11026 { |
10710 return SIMPLEPIE_CONSTRUCT_NONE; |
11027 return SIMPLEPIE_CONSTRUCT_NONE; |
10711 } |
11028 } |
10712 else |
11029 else |
10713 { |
11030 { |
11003 { |
11320 { |
11004 $encoding[] = 'UTF-8'; |
11321 $encoding[] = 'UTF-8'; |
11005 } |
11322 } |
11006 return $encoding; |
11323 return $encoding; |
11007 } |
11324 } |
11325 |
|
11326 function output_javascript() |
|
11327 { |
|
11328 if (function_exists('ob_gzhandler')) |
|
11329 { |
|
11330 ob_start('ob_gzhandler'); |
|
11331 } |
|
11332 header('Content-type: text/javascript; charset: UTF-8'); |
|
11333 header('Cache-Control: must-revalidate'); |
|
11334 header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days |
|
11335 ?> |
|
11336 function embed_odeo(link) { |
|
11337 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>'); |
|
11338 } |
|
11339 |
|
11340 function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) { |
|
11341 if (placeholder != '') { |
|
11342 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>'); |
|
11343 } |
|
11344 else { |
|
11345 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>'); |
|
11346 } |
|
11347 } |
|
11348 |
|
11349 function embed_flash(bgcolor, width, height, link, loop, type) { |
|
11350 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>'); |
|
11351 } |
|
11352 |
|
11353 function embed_flv(width, height, link, placeholder, loop, player) { |
|
11354 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>'); |
|
11355 } |
|
11356 |
|
11357 function embed_wmedia(width, height, link) { |
|
11358 document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>'); |
|
11359 } |
|
11360 <?php |
|
11361 } |
|
11008 } |
11362 } |
11009 |
11363 |
11010 /** |
11364 /** |
11011 * Decode HTML Entities |
11365 * Decode HTML Entities |
11012 * |
11366 * |
11081 $this->consumed .= $this->data[$this->position]; |
11435 $this->consumed .= $this->data[$this->position]; |
11082 return $this->data[$this->position++]; |
11436 return $this->data[$this->position++]; |
11083 } |
11437 } |
11084 else |
11438 else |
11085 { |
11439 { |
11086 $this->consumed = false; |
|
11087 return false; |
11440 return false; |
11088 } |
11441 } |
11089 } |
11442 } |
11090 |
11443 |
11091 /** |
11444 /** |
11104 $this->position += $len; |
11457 $this->position += $len; |
11105 return $data; |
11458 return $data; |
11106 } |
11459 } |
11107 else |
11460 else |
11108 { |
11461 { |
11109 $this->consumed = false; |
|
11110 return false; |
11462 return false; |
11111 } |
11463 } |
11112 } |
11464 } |
11113 |
11465 |
11114 /** |
11466 /** |
11178 else |
11530 else |
11179 { |
11531 { |
11180 $replacement = SimplePie_Misc::codepoint_to_utf8($codepoint); |
11532 $replacement = SimplePie_Misc::codepoint_to_utf8($codepoint); |
11181 } |
11533 } |
11182 |
11534 |
11183 if ($this->consume() != ';') |
11535 if (!in_array($this->consume(), array(';', false), true)) |
11184 { |
11536 { |
11185 $this->unconsume(); |
11537 $this->unconsume(); |
11186 } |
11538 } |
11187 |
11539 |
11188 $consumed_length = strlen($this->consumed); |
11540 $consumed_length = strlen($this->consumed); |
11207 { |
11559 { |
11208 $this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1); |
11560 $this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1); |
11209 $this->position += strlen($entities[$match]) - strlen($consumed) - 1; |
11561 $this->position += strlen($entities[$match]) - strlen($consumed) - 1; |
11210 } |
11562 } |
11211 break; |
11563 break; |
11564 } |
|
11565 } |
|
11566 } |
|
11567 |
|
11568 /** |
|
11569 * IRI parser/serialiser |
|
11570 * |
|
11571 * @package SimplePie |
|
11572 */ |
|
11573 class SimplePie_IRI |
|
11574 { |
|
11575 /** |
|
11576 * Scheme |
|
11577 * |
|
11578 * @access private |
|
11579 * @var string |
|
11580 */ |
|
11581 var $scheme; |
|
11582 |
|
11583 /** |
|
11584 * User Information |
|
11585 * |
|
11586 * @access private |
|
11587 * @var string |
|
11588 */ |
|
11589 var $userinfo; |
|
11590 |
|
11591 /** |
|
11592 * Host |
|
11593 * |
|
11594 * @access private |
|
11595 * @var string |
|
11596 */ |
|
11597 var $host; |
|
11598 |
|
11599 /** |
|
11600 * Port |
|
11601 * |
|
11602 * @access private |
|
11603 * @var string |
|
11604 */ |
|
11605 var $port; |
|
11606 |
|
11607 /** |
|
11608 * Path |
|
11609 * |
|
11610 * @access private |
|
11611 * @var string |
|
11612 */ |
|
11613 var $path; |
|
11614 |
|
11615 /** |
|
11616 * Query |
|
11617 * |
|
11618 * @access private |
|
11619 * @var string |
|
11620 */ |
|
11621 var $query; |
|
11622 |
|
11623 /** |
|
11624 * Fragment |
|
11625 * |
|
11626 * @access private |
|
11627 * @var string |
|
11628 */ |
|
11629 var $fragment; |
|
11630 |
|
11631 /** |
|
11632 * Whether the object represents a valid IRI |
|
11633 * |
|
11634 * @access private |
|
11635 * @var array |
|
11636 */ |
|
11637 var $valid = array(); |
|
11638 |
|
11639 /** |
|
11640 * Return the entire IRI when you try and read the object as a string |
|
11641 * |
|
11642 * @access public |
|
11643 * @return string |
|
11644 */ |
|
11645 function __toString() |
|
11646 { |
|
11647 return $this->get_iri(); |
|
11648 } |
|
11649 |
|
11650 /** |
|
11651 * Create a new IRI object, from a specified string |
|
11652 * |
|
11653 * @access public |
|
11654 * @param string $iri |
|
11655 * @return SimplePie_IRI |
|
11656 */ |
|
11657 function SimplePie_IRI($iri) |
|
11658 { |
|
11659 $iri = (string) $iri; |
|
11660 if ($iri !== '') |
|
11661 { |
|
11662 $parsed = $this->parse_iri($iri); |
|
11663 $this->set_scheme($parsed['scheme']); |
|
11664 $this->set_authority($parsed['authority']); |
|
11665 $this->set_path($parsed['path']); |
|
11666 $this->set_query($parsed['query']); |
|
11667 $this->set_fragment($parsed['fragment']); |
|
11668 } |
|
11669 } |
|
11670 |
|
11671 /** |
|
11672 * Create a new IRI object by resolving a relative IRI |
|
11673 * |
|
11674 * @static |
|
11675 * @access public |
|
11676 * @param SimplePie_IRI $base Base IRI |
|
11677 * @param string $relative Relative IRI |
|
11678 * @return SimplePie_IRI |
|
11679 */ |
|
11680 function absolutize($base, $relative) |
|
11681 { |
|
11682 $relative = (string) $relative; |
|
11683 if ($relative !== '') |
|
11684 { |
|
11685 $relative =& new SimplePie_IRI($relative); |
|
11686 if ($relative->get_scheme() !== null) |
|
11687 { |
|
11688 $target = $relative; |
|
11689 } |
|
11690 elseif ($base->get_iri() !== null) |
|
11691 { |
|
11692 if ($relative->get_authority() !== null) |
|
11693 { |
|
11694 $target = $relative; |
|
11695 $target->set_scheme($base->get_scheme()); |
|
11696 } |
|
11697 else |
|
11698 { |
|
11699 $target =& new SimplePie_IRI(''); |
|
11700 $target->set_scheme($base->get_scheme()); |
|
11701 $target->set_userinfo($base->get_userinfo()); |
|
11702 $target->set_host($base->get_host()); |
|
11703 $target->set_port($base->get_port()); |
|
11704 if ($relative->get_path() !== null) |
|
11705 { |
|
11706 if (strpos($relative->get_path(), '/') === 0) |
|
11707 { |
|
11708 $target->set_path($relative->get_path()); |
|
11709 } |
|
11710 elseif (($base->get_userinfo() !== null || $base->get_host() !== null || $base->get_port() !== null) && $base->get_path() === null) |
|
11711 { |
|
11712 $target->set_path('/' . $relative->get_path()); |
|
11713 } |
|
11714 elseif (($last_segment = strrpos($base->get_path(), '/')) !== false) |
|
11715 { |
|
11716 $target->set_path(substr($base->get_path(), 0, $last_segment + 1) . $relative->get_path()); |
|
11717 } |
|
11718 else |
|
11719 { |
|
11720 $target->set_path($relative->get_path()); |
|
11721 } |
|
11722 $target->set_query($relative->get_query()); |
|
11723 } |
|
11724 else |
|
11725 { |
|
11726 $target->set_path($base->get_path()); |
|
11727 if ($relative->get_query() !== null) |
|
11728 { |
|
11729 $target->set_query($relative->get_query()); |
|
11730 } |
|
11731 elseif ($base->get_query() !== null) |
|
11732 { |
|
11733 $target->set_query($base->get_query()); |
|
11734 } |
|
11735 } |
|
11736 } |
|
11737 $target->set_fragment($relative->get_fragment()); |
|
11738 } |
|
11739 else |
|
11740 { |
|
11741 // No base URL, just return the relative URL |
|
11742 $target = $relative; |
|
11743 } |
|
11744 } |
|
11745 else |
|
11746 { |
|
11747 $target = $base; |
|
11748 } |
|
11749 return $target; |
|
11750 } |
|
11751 |
|
11752 /** |
|
11753 * Parse an IRI into scheme/authority/path/query/fragment segments |
|
11754 * |
|
11755 * @access private |
|
11756 * @param string $iri |
|
11757 * @return array |
|
11758 */ |
|
11759 function parse_iri($iri) |
|
11760 { |
|
11761 preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $iri, $match); |
|
11762 for ($i = count($match); $i <= 9; $i++) |
|
11763 { |
|
11764 $match[$i] = ''; |
|
11765 } |
|
11766 return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]); |
|
11767 } |
|
11768 |
|
11769 /** |
|
11770 * Remove dot segments from a path |
|
11771 * |
|
11772 * @access private |
|
11773 * @param string $input |
|
11774 * @return string |
|
11775 */ |
|
11776 function remove_dot_segments($input) |
|
11777 { |
|
11778 $output = ''; |
|
11779 while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') |
|
11780 { |
|
11781 // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise, |
|
11782 if (strpos($input, '../') === 0) |
|
11783 { |
|
11784 $input = substr($input, 3); |
|
11785 } |
|
11786 elseif (strpos($input, './') === 0) |
|
11787 { |
|
11788 $input = substr($input, 2); |
|
11789 } |
|
11790 // 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, |
|
11791 elseif (strpos($input, '/./') === 0) |
|
11792 { |
|
11793 $input = substr_replace($input, '/', 0, 3); |
|
11794 } |
|
11795 elseif ($input === '/.') |
|
11796 { |
|
11797 $input = '/'; |
|
11798 } |
|
11799 // 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, |
|
11800 elseif (strpos($input, '/../') === 0) |
|
11801 { |
|
11802 $input = substr_replace($input, '/', 0, 4); |
|
11803 $output = substr_replace($output, '', strrpos($output, '/')); |
|
11804 } |
|
11805 elseif ($input === '/..') |
|
11806 { |
|
11807 $input = '/'; |
|
11808 $output = substr_replace($output, '', strrpos($output, '/')); |
|
11809 } |
|
11810 // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise, |
|
11811 elseif ($input === '.' || $input === '..') |
|
11812 { |
|
11813 $input = ''; |
|
11814 } |
|
11815 // 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 |
|
11816 elseif (($pos = strpos($input, '/', 1)) !== false) |
|
11817 { |
|
11818 $output .= substr($input, 0, $pos); |
|
11819 $input = substr_replace($input, '', 0, $pos); |
|
11820 } |
|
11821 else |
|
11822 { |
|
11823 $output .= $input; |
|
11824 $input = ''; |
|
11825 } |
|
11826 } |
|
11827 return $output . $input; |
|
11828 } |
|
11829 |
|
11830 /** |
|
11831 * Replace invalid character with percent encoding |
|
11832 * |
|
11833 * @access private |
|
11834 * @param string $string Input string |
|
11835 * @param string $valid_chars Valid characters |
|
11836 * @param int $case Normalise case |
|
11837 * @return string |
|
11838 */ |
|
11839 function replace_invalid_with_pct_encoding($string, $valid_chars, $case = SIMPLEPIE_SAME_CASE) |
|
11840 { |
|
11841 // Normalise case |
|
11842 if ($case & SIMPLEPIE_LOWERCASE) |
|
11843 { |
|
11844 $string = strtolower($string); |
|
11845 } |
|
11846 elseif ($case & SIMPLEPIE_UPPERCASE) |
|
11847 { |
|
11848 $string = strtoupper($string); |
|
11849 } |
|
11850 |
|
11851 // Store position and string length (to avoid constantly recalculating this) |
|
11852 $position = 0; |
|
11853 $strlen = strlen($string); |
|
11854 |
|
11855 // Loop as long as we have invalid characters, advancing the position to the next invalid character |
|
11856 while (($position += strspn($string, $valid_chars, $position)) < $strlen) |
|
11857 { |
|
11858 // If we have a % character |
|
11859 if ($string[$position] === '%') |
|
11860 { |
|
11861 // If we have a pct-encoded section |
|
11862 if ($position + 2 < $strlen && strspn($string, '0123456789ABCDEFabcdef', $position + 1, 2) === 2) |
|
11863 { |
|
11864 // Get the the represented character |
|
11865 $chr = chr(hexdec(substr($string, $position + 1, 2))); |
|
11866 |
|
11867 // If the character is valid, replace the pct-encoded with the actual character while normalising case |
|
11868 if (strpos($valid_chars, $chr) !== false) |
|
11869 { |
|
11870 if ($case & SIMPLEPIE_LOWERCASE) |
|
11871 { |
|
11872 $chr = strtolower($chr); |
|
11873 } |
|
11874 elseif ($case & SIMPLEPIE_UPPERCASE) |
|
11875 { |
|
11876 $chr = strtoupper($chr); |
|
11877 } |
|
11878 $string = substr_replace($string, $chr, $position, 3); |
|
11879 $strlen -= 2; |
|
11880 $position++; |
|
11881 } |
|
11882 |
|
11883 // Otherwise just normalise the pct-encoded to uppercase |
|
11884 else |
|
11885 { |
|
11886 $string = substr_replace($string, strtoupper(substr($string, $position + 1, 2)), $position + 1, 2); |
|
11887 $position += 3; |
|
11888 } |
|
11889 } |
|
11890 // If we don't have a pct-encoded section, just replace the % with its own esccaped form |
|
11891 else |
|
11892 { |
|
11893 $string = substr_replace($string, '%25', $position, 1); |
|
11894 $strlen += 2; |
|
11895 $position += 3; |
|
11896 } |
|
11897 } |
|
11898 // If we have an invalid character, change into its pct-encoded form |
|
11899 else |
|
11900 { |
|
11901 $replacement = sprintf("%%%02X", ord($string[$position])); |
|
11902 $string = str_replace($string[$position], $replacement, $string); |
|
11903 $strlen = strlen($string); |
|
11904 } |
|
11905 } |
|
11906 return $string; |
|
11907 } |
|
11908 |
|
11909 /** |
|
11910 * Check if the object represents a valid IRI |
|
11911 * |
|
11912 * @access public |
|
11913 * @return bool |
|
11914 */ |
|
11915 function is_valid() |
|
11916 { |
|
11917 return array_sum($this->valid) === count($this->valid); |
|
11918 } |
|
11919 |
|
11920 /** |
|
11921 * Set the scheme. Returns true on success, false on failure (if there are |
|
11922 * any invalid characters). |
|
11923 * |
|
11924 * @access public |
|
11925 * @param string $scheme |
|
11926 * @return bool |
|
11927 */ |
|
11928 function set_scheme($scheme) |
|
11929 { |
|
11930 if ($scheme === null || $scheme === '') |
|
11931 { |
|
11932 $this->scheme = null; |
|
11933 } |
|
11934 else |
|
11935 { |
|
11936 $len = strlen($scheme); |
|
11937 switch (true) |
|
11938 { |
|
11939 case $len > 1: |
|
11940 if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1)) |
|
11941 { |
|
11942 $this->scheme = null; |
|
11943 $this->valid[__FUNCTION__] = false; |
|
11944 return false; |
|
11945 } |
|
11946 |
|
11947 case $len > 0: |
|
11948 if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1)) |
|
11949 { |
|
11950 $this->scheme = null; |
|
11951 $this->valid[__FUNCTION__] = false; |
|
11952 return false; |
|
11953 } |
|
11954 } |
|
11955 $this->scheme = strtolower($scheme); |
|
11956 } |
|
11957 $this->valid[__FUNCTION__] = true; |
|
11958 return true; |
|
11959 } |
|
11960 |
|
11961 /** |
|
11962 * Set the authority. Returns true on success, false on failure (if there are |
|
11963 * any invalid characters). |
|
11964 * |
|
11965 * @access public |
|
11966 * @param string $authority |
|
11967 * @return bool |
|
11968 */ |
|
11969 function set_authority($authority) |
|
11970 { |
|
11971 if (($userinfo_end = strrpos($authority, '@')) !== false) |
|
11972 { |
|
11973 $userinfo = substr($authority, 0, $userinfo_end); |
|
11974 $authority = substr($authority, $userinfo_end + 1); |
|
11975 } |
|
11976 else |
|
11977 { |
|
11978 $userinfo = null; |
|
11979 } |
|
11980 |
|
11981 if (($port_start = strpos($authority, ':')) !== false) |
|
11982 { |
|
11983 $port = substr($authority, $port_start + 1); |
|
11984 $authority = substr($authority, 0, $port_start); |
|
11985 } |
|
11986 else |
|
11987 { |
|
11988 $port = null; |
|
11989 } |
|
11990 |
|
11991 return $this->set_userinfo($userinfo) && $this->set_host($authority) && $this->set_port($port); |
|
11992 } |
|
11993 |
|
11994 /** |
|
11995 * Set the userinfo. |
|
11996 * |
|
11997 * @access public |
|
11998 * @param string $userinfo |
|
11999 * @return bool |
|
12000 */ |
|
12001 function set_userinfo($userinfo) |
|
12002 { |
|
12003 if ($userinfo === null || $userinfo === '') |
|
12004 { |
|
12005 $this->userinfo = null; |
|
12006 } |
|
12007 else |
|
12008 { |
|
12009 $this->userinfo = $this->replace_invalid_with_pct_encoding($userinfo, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:'); |
|
12010 } |
|
12011 $this->valid[__FUNCTION__] = true; |
|
12012 return true; |
|
12013 } |
|
12014 |
|
12015 /** |
|
12016 * Set the host. Returns true on success, false on failure (if there are |
|
12017 * any invalid characters). |
|
12018 * |
|
12019 * @access public |
|
12020 * @param string $host |
|
12021 * @return bool |
|
12022 */ |
|
12023 function set_host($host) |
|
12024 { |
|
12025 if ($host === null || $host === '') |
|
12026 { |
|
12027 $this->host = null; |
|
12028 $this->valid[__FUNCTION__] = true; |
|
12029 return true; |
|
12030 } |
|
12031 elseif ($host[0] === '[' && substr($host, -1) === ']') |
|
12032 { |
|
12033 if (Net_IPv6::checkIPv6(substr($host, 1, -1))) |
|
12034 { |
|
12035 $this->host = $host; |
|
12036 $this->valid[__FUNCTION__] = true; |
|
12037 return true; |
|
12038 } |
|
12039 else |
|
12040 { |
|
12041 $this->host = null; |
|
12042 $this->valid[__FUNCTION__] = false; |
|
12043 return false; |
|
12044 } |
|
12045 } |
|
12046 else |
|
12047 { |
|
12048 $this->host = $this->replace_invalid_with_pct_encoding($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=', SIMPLEPIE_LOWERCASE); |
|
12049 $this->valid[__FUNCTION__] = true; |
|
12050 return true; |
|
12051 } |
|
12052 } |
|
12053 |
|
12054 /** |
|
12055 * Set the port. Returns true on success, false on failure (if there are |
|
12056 * any invalid characters). |
|
12057 * |
|
12058 * @access public |
|
12059 * @param string $port |
|
12060 * @return bool |
|
12061 */ |
|
12062 function set_port($port) |
|
12063 { |
|
12064 if ($port === null || $port === '') |
|
12065 { |
|
12066 $this->port = null; |
|
12067 $this->valid[__FUNCTION__] = true; |
|
12068 return true; |
|
12069 } |
|
12070 elseif (strspn($port, '0123456789') === strlen($port)) |
|
12071 { |
|
12072 $this->port = (int) $port; |
|
12073 $this->valid[__FUNCTION__] = true; |
|
12074 return true; |
|
12075 } |
|
12076 else |
|
12077 { |
|
12078 $this->port = null; |
|
12079 $this->valid[__FUNCTION__] = false; |
|
12080 return false; |
|
12081 } |
|
12082 } |
|
12083 |
|
12084 /** |
|
12085 * Set the path. |
|
12086 * |
|
12087 * @access public |
|
12088 * @param string $path |
|
12089 * @return bool |
|
12090 */ |
|
12091 function set_path($path) |
|
12092 { |
|
12093 if ($path === null || $path === '') |
|
12094 { |
|
12095 $this->path = null; |
|
12096 $this->valid[__FUNCTION__] = true; |
|
12097 return true; |
|
12098 } |
|
12099 elseif (substr($path, 0, 2) === '//' && $this->userinfo === null && $this->host === null && $this->port === null) |
|
12100 { |
|
12101 $this->path = null; |
|
12102 $this->valid[__FUNCTION__] = false; |
|
12103 return false; |
|
12104 } |
|
12105 else |
|
12106 { |
|
12107 $this->path = $this->replace_invalid_with_pct_encoding($path, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=@/'); |
|
12108 if ($this->scheme !== null) |
|
12109 { |
|
12110 $this->path = $this->remove_dot_segments($this->path); |
|
12111 } |
|
12112 $this->valid[__FUNCTION__] = true; |
|
12113 return true; |
|
12114 } |
|
12115 } |
|
12116 |
|
12117 /** |
|
12118 * Set the query. |
|
12119 * |
|
12120 * @access public |
|
12121 * @param string $query |
|
12122 * @return bool |
|
12123 */ |
|
12124 function set_query($query) |
|
12125 { |
|
12126 if ($query === null || $query === '') |
|
12127 { |
|
12128 $this->query = null; |
|
12129 } |
|
12130 else |
|
12131 { |
|
12132 $this->query = $this->replace_invalid_with_pct_encoding($query, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?'); |
|
12133 } |
|
12134 $this->valid[__FUNCTION__] = true; |
|
12135 return true; |
|
12136 } |
|
12137 |
|
12138 /** |
|
12139 * Set the fragment. |
|
12140 * |
|
12141 * @access public |
|
12142 * @param string $fragment |
|
12143 * @return bool |
|
12144 */ |
|
12145 function set_fragment($fragment) |
|
12146 { |
|
12147 if ($fragment === null || $fragment === '') |
|
12148 { |
|
12149 $this->fragment = null; |
|
12150 } |
|
12151 else |
|
12152 { |
|
12153 $this->fragment = $this->replace_invalid_with_pct_encoding($fragment, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?'); |
|
12154 } |
|
12155 $this->valid[__FUNCTION__] = true; |
|
12156 return true; |
|
12157 } |
|
12158 |
|
12159 /** |
|
12160 * Get the complete IRI |
|
12161 * |
|
12162 * @access public |
|
12163 * @return string |
|
12164 */ |
|
12165 function get_iri() |
|
12166 { |
|
12167 $iri = ''; |
|
12168 if ($this->scheme !== null) |
|
12169 { |
|
12170 $iri .= $this->scheme . ':'; |
|
12171 } |
|
12172 if (($authority = $this->get_authority()) !== null) |
|
12173 { |
|
12174 $iri .= '//' . $authority; |
|
12175 } |
|
12176 if ($this->path !== null) |
|
12177 { |
|
12178 $iri .= $this->path; |
|
12179 } |
|
12180 if ($this->query !== null) |
|
12181 { |
|
12182 $iri .= '?' . $this->query; |
|
12183 } |
|
12184 if ($this->fragment !== null) |
|
12185 { |
|
12186 $iri .= '#' . $this->fragment; |
|
12187 } |
|
12188 |
|
12189 if ($iri !== '') |
|
12190 { |
|
12191 return $iri; |
|
12192 } |
|
12193 else |
|
12194 { |
|
12195 return null; |
|
12196 } |
|
12197 } |
|
12198 |
|
12199 /** |
|
12200 * Get the scheme |
|
12201 * |
|
12202 * @access public |
|
12203 * @return string |
|
12204 */ |
|
12205 function get_scheme() |
|
12206 { |
|
12207 return $this->scheme; |
|
12208 } |
|
12209 |
|
12210 /** |
|
12211 * Get the complete authority |
|
12212 * |
|
12213 * @access public |
|
12214 * @return string |
|
12215 */ |
|
12216 function get_authority() |
|
12217 { |
|
12218 $authority = ''; |
|
12219 if ($this->userinfo !== null) |
|
12220 { |
|
12221 $authority .= $this->userinfo . '@'; |
|
12222 } |
|
12223 if ($this->host !== null) |
|
12224 { |
|
12225 $authority .= $this->host; |
|
12226 } |
|
12227 if ($this->port !== null) |
|
12228 { |
|
12229 $authority .= ':' . $this->port; |
|
12230 } |
|
12231 |
|
12232 if ($authority !== '') |
|
12233 { |
|
12234 return $authority; |
|
12235 } |
|
12236 else |
|
12237 { |
|
12238 return null; |
|
12239 } |
|
12240 } |
|
12241 |
|
12242 /** |
|
12243 * Get the user information |
|
12244 * |
|
12245 * @access public |
|
12246 * @return string |
|
12247 */ |
|
12248 function get_userinfo() |
|
12249 { |
|
12250 return $this->userinfo; |
|
12251 } |
|
12252 |
|
12253 /** |
|
12254 * Get the host |
|
12255 * |
|
12256 * @access public |
|
12257 * @return string |
|
12258 */ |
|
12259 function get_host() |
|
12260 { |
|
12261 return $this->host; |
|
12262 } |
|
12263 |
|
12264 /** |
|
12265 * Get the port |
|
12266 * |
|
12267 * @access public |
|
12268 * @return string |
|
12269 */ |
|
12270 function get_port() |
|
12271 { |
|
12272 return $this->port; |
|
12273 } |
|
12274 |
|
12275 /** |
|
12276 * Get the path |
|
12277 * |
|
12278 * @access public |
|
12279 * @return string |
|
12280 */ |
|
12281 function get_path() |
|
12282 { |
|
12283 return $this->path; |
|
12284 } |
|
12285 |
|
12286 /** |
|
12287 * Get the query |
|
12288 * |
|
12289 * @access public |
|
12290 * @return string |
|
12291 */ |
|
12292 function get_query() |
|
12293 { |
|
12294 return $this->query; |
|
12295 } |
|
12296 |
|
12297 /** |
|
12298 * Get the fragment |
|
12299 * |
|
12300 * @access public |
|
12301 * @return string |
|
12302 */ |
|
12303 function get_fragment() |
|
12304 { |
|
12305 return $this->fragment; |
|
12306 } |
|
12307 } |
|
12308 |
|
12309 /** |
|
12310 * Class to validate and to work with IPv6 addresses. |
|
12311 * |
|
12312 * @package SimplePie |
|
12313 * @copyright 2003-2005 The PHP Group |
|
12314 * @license http://www.opensource.org/licenses/bsd-license.php |
|
12315 * @link http://pear.php.net/package/Net_IPv6 |
|
12316 * @author Alexander Merz <alexander.merz@web.de> |
|
12317 * @author elfrink at introweb dot nl |
|
12318 * @author Josh Peck <jmp at joshpeck dot org> |
|
12319 * @author Geoffrey Sneddon <geoffers@gmail.com> |
|
12320 */ |
|
12321 class SimplePie_Net_IPv6 |
|
12322 { |
|
12323 /** |
|
12324 * Removes a possible existing netmask specification of an IP address. |
|
12325 * |
|
12326 * @param string $ip the (compressed) IP as Hex representation |
|
12327 * @return string the IP the without netmask |
|
12328 * @since 1.1.0 |
|
12329 * @access public |
|
12330 * @static |
|
12331 */ |
|
12332 function removeNetmaskSpec($ip) |
|
12333 { |
|
12334 if (strpos($ip, '/') !== false) |
|
12335 { |
|
12336 list($addr, $nm) = explode('/', $ip); |
|
12337 } |
|
12338 else |
|
12339 { |
|
12340 $addr = $ip; |
|
12341 } |
|
12342 return $addr; |
|
12343 } |
|
12344 |
|
12345 /** |
|
12346 * Uncompresses an IPv6 address |
|
12347 * |
|
12348 * RFC 2373 allows you to compress zeros in an address to '::'. This |
|
12349 * function expects an valid IPv6 address and expands the '::' to |
|
12350 * the required zeros. |
|
12351 * |
|
12352 * Example: FF01::101 -> FF01:0:0:0:0:0:0:101 |
|
12353 * ::1 -> 0:0:0:0:0:0:0:1 |
|
12354 * |
|
12355 * @access public |
|
12356 * @static |
|
12357 * @param string $ip a valid IPv6-address (hex format) |
|
12358 * @return string the uncompressed IPv6-address (hex format) |
|
12359 */ |
|
12360 function Uncompress($ip) |
|
12361 { |
|
12362 $uip = SimplePie_Net_IPv6::removeNetmaskSpec($ip); |
|
12363 $c1 = -1; |
|
12364 $c2 = -1; |
|
12365 if (strpos($ip, '::') !== false) |
|
12366 { |
|
12367 list($ip1, $ip2) = explode('::', $ip); |
|
12368 if ($ip1 === '') |
|
12369 { |
|
12370 $c1 = -1; |
|
12371 } |
|
12372 else |
|
12373 { |
|
12374 $pos = 0; |
|
12375 if (($pos = substr_count($ip1, ':')) > 0) |
|
12376 { |
|
12377 $c1 = $pos; |
|
12378 } |
|
12379 else |
|
12380 { |
|
12381 $c1 = 0; |
|
12382 } |
|
12383 } |
|
12384 if ($ip2 === '') |
|
12385 { |
|
12386 $c2 = -1; |
|
12387 } |
|
12388 else |
|
12389 { |
|
12390 $pos = 0; |
|
12391 if (($pos = substr_count($ip2, ':')) > 0) |
|
12392 { |
|
12393 $c2 = $pos; |
|
12394 } |
|
12395 else |
|
12396 { |
|
12397 $c2 = 0; |
|
12398 } |
|
12399 } |
|
12400 if (strstr($ip2, '.')) |
|
12401 { |
|
12402 $c2++; |
|
12403 } |
|
12404 // :: |
|
12405 if ($c1 === -1 && $c2 === -1) |
|
12406 { |
|
12407 $uip = '0:0:0:0:0:0:0:0'; |
|
12408 } |
|
12409 // ::xxx |
|
12410 else if ($c1 === -1) |
|
12411 { |
|
12412 $fill = str_repeat('0:', 7 - $c2); |
|
12413 $uip = str_replace('::', $fill, $uip); |
|
12414 } |
|
12415 // xxx:: |
|
12416 else if ($c2 === -1) |
|
12417 { |
|
12418 $fill = str_repeat(':0', 7 - $c1); |
|
12419 $uip = str_replace('::', $fill, $uip); |
|
12420 } |
|
12421 // xxx::xxx |
|
12422 else |
|
12423 { |
|
12424 $fill = str_repeat(':0:', 6 - $c2 - $c1); |
|
12425 $uip = str_replace('::', $fill, $uip); |
|
12426 $uip = str_replace('::', ':', $uip); |
|
12427 } |
|
12428 } |
|
12429 return $uip; |
|
12430 } |
|
12431 |
|
12432 /** |
|
12433 * Splits an IPv6 address into the IPv6 and a possible IPv4 part |
|
12434 * |
|
12435 * RFC 2373 allows you to note the last two parts of an IPv6 address as |
|
12436 * an IPv4 compatible address |
|
12437 * |
|
12438 * Example: 0:0:0:0:0:0:13.1.68.3 |
|
12439 * 0:0:0:0:0:FFFF:129.144.52.38 |
|
12440 * |
|
12441 * @access public |
|
12442 * @static |
|
12443 * @param string $ip a valid IPv6-address (hex format) |
|
12444 * @return array [0] contains the IPv6 part, [1] the IPv4 part (hex format) |
|
12445 */ |
|
12446 function SplitV64($ip) |
|
12447 { |
|
12448 $ip = SimplePie_Net_IPv6::Uncompress($ip); |
|
12449 if (strstr($ip, '.')) |
|
12450 { |
|
12451 $pos = strrpos($ip, ':'); |
|
12452 $ip[$pos] = '_'; |
|
12453 $ipPart = explode('_', $ip); |
|
12454 return $ipPart; |
|
12455 } |
|
12456 else |
|
12457 { |
|
12458 return array($ip, ''); |
|
12459 } |
|
12460 } |
|
12461 |
|
12462 /** |
|
12463 * Checks an IPv6 address |
|
12464 * |
|
12465 * Checks if the given IP is IPv6-compatible |
|
12466 * |
|
12467 * @access public |
|
12468 * @static |
|
12469 * @param string $ip a valid IPv6-address |
|
12470 * @return bool true if $ip is an IPv6 address |
|
12471 */ |
|
12472 function checkIPv6($ip) |
|
12473 { |
|
12474 $ipPart = SimplePie_Net_IPv6::SplitV64($ip); |
|
12475 $count = 0; |
|
12476 if (!empty($ipPart[0])) |
|
12477 { |
|
12478 $ipv6 = explode(':', $ipPart[0]); |
|
12479 for ($i = 0; $i < count($ipv6); $i++) |
|
12480 { |
|
12481 $dec = hexdec($ipv6[$i]); |
|
12482 $hex = strtoupper(preg_replace('/^[0]{1,3}(.*[0-9a-fA-F])$/', '\\1', $ipv6[$i])); |
|
12483 if ($ipv6[$i] >= 0 && $dec <= 65535 && $hex === strtoupper(dechex($dec))) |
|
12484 { |
|
12485 $count++; |
|
12486 } |
|
12487 } |
|
12488 if ($count === 8) |
|
12489 { |
|
12490 return true; |
|
12491 } |
|
12492 elseif ($count === 6 && !empty($ipPart[1])) |
|
12493 { |
|
12494 $ipv4 = explode('.', $ipPart[1]); |
|
12495 $count = 0; |
|
12496 foreach ($ipv4 as $ipv4_part) |
|
12497 { |
|
12498 if ($ipv4_part >= 0 && $ipv4_part <= 255 && preg_match('/^\d{1,3}$/', $ipv4_part)) |
|
12499 { |
|
12500 $count++; |
|
12501 } |
|
12502 } |
|
12503 if ($count === 4) |
|
12504 { |
|
12505 return true; |
|
12506 } |
|
12507 } |
|
12508 else |
|
12509 { |
|
12510 return false; |
|
12511 } |
|
12512 |
|
12513 } |
|
12514 else |
|
12515 { |
|
12516 return false; |
|
11212 } |
12517 } |
11213 } |
12518 } |
11214 } |
12519 } |
11215 |
12520 |
11216 /** |
12521 /** |
12767 $this->timeout = $timeout; |
14072 $this->timeout = $timeout; |
12768 $this->max_checked_feeds = $max_checked_feeds; |
14073 $this->max_checked_feeds = $max_checked_feeds; |
12769 $this->content_type_sniffer_class = $content_type_sniffer_class; |
14074 $this->content_type_sniffer_class = $content_type_sniffer_class; |
12770 } |
14075 } |
12771 |
14076 |
12772 function find($type = SIMPLEPIE_LOCATOR_ALL) |
14077 function find($type = SIMPLEPIE_LOCATOR_ALL, &$working) |
12773 { |
14078 { |
12774 if ($this->is_feed($this->file)) |
14079 if ($this->is_feed($this->file)) |
12775 { |
14080 { |
12776 return $this->file; |
14081 return $this->file; |
12777 } |
14082 } |
12790 $this->get_base(); |
14095 $this->get_base(); |
12791 } |
14096 } |
12792 |
14097 |
12793 if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery()) |
14098 if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery()) |
12794 { |
14099 { |
12795 return $working; |
14100 return $working[0]; |
12796 } |
14101 } |
12797 |
14102 |
12798 if ($type & (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links()) |
14103 if ($type & (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links()) |
12799 { |
14104 { |
12800 if ($type & SIMPLEPIE_LOCATOR_LOCAL_EXTENSION && $working = $this->extension($this->local)) |
14105 if ($type & SIMPLEPIE_LOCATOR_LOCAL_EXTENSION && $working = $this->extension($this->local)) |
12863 |
14168 |
12864 function autodiscovery() |
14169 function autodiscovery() |
12865 { |
14170 { |
12866 $links = array_merge(SimplePie_Misc::get_element('link', $this->file->body), SimplePie_Misc::get_element('a', $this->file->body), SimplePie_Misc::get_element('area', $this->file->body)); |
14171 $links = array_merge(SimplePie_Misc::get_element('link', $this->file->body), SimplePie_Misc::get_element('a', $this->file->body), SimplePie_Misc::get_element('area', $this->file->body)); |
12867 $done = array(); |
14172 $done = array(); |
14173 $feeds = array(); |
|
12868 foreach ($links as $link) |
14174 foreach ($links as $link) |
12869 { |
14175 { |
12870 if ($this->checked_feeds == $this->max_checked_feeds) |
14176 if ($this->checked_feeds === $this->max_checked_feeds) |
12871 { |
14177 { |
12872 break; |
14178 break; |
12873 } |
14179 } |
12874 if (isset($link['attribs']['href']['data']) && isset($link['attribs']['rel']['data'])) |
14180 if (isset($link['attribs']['href']['data']) && isset($link['attribs']['rel']['data'])) |
12875 { |
14181 { |
12882 else |
14188 else |
12883 { |
14189 { |
12884 $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base); |
14190 $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base); |
12885 } |
14191 } |
12886 |
14192 |
12887 if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml')))) |
14193 if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href])) |
12888 { |
14194 { |
12889 $this->checked_feeds++; |
14195 $this->checked_feeds++; |
12890 $feed =& new $this->file_class($href, $this->timeout, 5, null, $this->useragent); |
14196 $feed =& new $this->file_class($href, $this->timeout, 5, null, $this->useragent); |
12891 if ($this->is_feed($feed)) |
14197 if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) |
12892 { |
14198 { |
12893 return $feed; |
14199 $feeds[$href] = $feed; |
12894 } |
14200 } |
12895 } |
14201 } |
12896 $done[] = $href; |
14202 $done[] = $href; |
12897 } |
14203 } |
12898 } |
14204 } |
12899 return null; |
14205 |
14206 if (!empty($feeds)) |
|
14207 { |
|
14208 return array_values($feeds); |
|
14209 } |
|
14210 else { |
|
14211 return null; |
|
14212 } |
|
12900 } |
14213 } |
12901 |
14214 |
12902 function get_links() |
14215 function get_links() |
12903 { |
14216 { |
12904 $links = SimplePie_Misc::get_element('a', $this->file->body); |
14217 $links = SimplePie_Misc::get_element('a', $this->file->body); |
12919 $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base); |
14232 $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base); |
12920 } |
14233 } |
12921 |
14234 |
12922 $current = SimplePie_Misc::parse_url($this->file->url); |
14235 $current = SimplePie_Misc::parse_url($this->file->url); |
12923 |
14236 |
12924 if ($parsed['authority'] === '' || $parsed['authority'] == $current['authority']) |
14237 if ($parsed['authority'] === '' || $parsed['authority'] === $current['authority']) |
12925 { |
14238 { |
12926 $this->local[] = $href; |
14239 $this->local[] = $href; |
12927 } |
14240 } |
12928 else |
14241 else |
12929 { |
14242 { |
12943 |
14256 |
12944 function extension(&$array) |
14257 function extension(&$array) |
12945 { |
14258 { |
12946 foreach ($array as $key => $value) |
14259 foreach ($array as $key => $value) |
12947 { |
14260 { |
12948 if ($this->checked_feeds == $this->max_checked_feeds) |
14261 if ($this->checked_feeds === $this->max_checked_feeds) |
12949 { |
14262 { |
12950 break; |
14263 break; |
12951 } |
14264 } |
12952 if (in_array(strtolower(strrchr($value, '.')), array('.rss', '.rdf', '.atom', '.xml'))) |
14265 if (in_array(strtolower(strrchr($value, '.')), array('.rss', '.rdf', '.atom', '.xml'))) |
12953 { |
14266 { |
12954 $this->checked_feeds++; |
14267 $this->checked_feeds++; |
12955 $feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent); |
14268 $feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent); |
12956 if ($this->is_feed($feed)) |
14269 if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) |
12957 { |
14270 { |
12958 return $feed; |
14271 return $feed; |
12959 } |
14272 } |
12960 else |
14273 else |
12961 { |
14274 { |
12968 |
14281 |
12969 function body(&$array) |
14282 function body(&$array) |
12970 { |
14283 { |
12971 foreach ($array as $key => $value) |
14284 foreach ($array as $key => $value) |
12972 { |
14285 { |
12973 if ($this->checked_feeds == $this->max_checked_feeds) |
14286 if ($this->checked_feeds === $this->max_checked_feeds) |
12974 { |
14287 { |
12975 break; |
14288 break; |
12976 } |
14289 } |
12977 if (preg_match('/(rss|rdf|atom|xml)/i', $value)) |
14290 if (preg_match('/(rss|rdf|atom|xml)/i', $value)) |
12978 { |
14291 { |
12979 $this->checked_feeds++; |
14292 $this->checked_feeds++; |
12980 $feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent); |
14293 $feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent); |
12981 if ($this->is_feed($feed)) |
14294 if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) |
12982 { |
14295 { |
12983 return $feed; |
14296 return $feed; |
12984 } |
14297 } |
12985 else |
14298 else |
12986 { |
14299 { |
12998 var $error_string; |
14311 var $error_string; |
12999 var $current_line; |
14312 var $current_line; |
13000 var $current_column; |
14313 var $current_column; |
13001 var $current_byte; |
14314 var $current_byte; |
13002 var $separator = ' '; |
14315 var $separator = ' '; |
13003 var $feed = false; |
|
13004 var $namespace = array(''); |
14316 var $namespace = array(''); |
13005 var $element = array(''); |
14317 var $element = array(''); |
13006 var $xml_base = array(''); |
14318 var $xml_base = array(''); |
13007 var $xml_base_explicit = array(false); |
14319 var $xml_base_explicit = array(false); |
13008 var $xml_lang = array(''); |
14320 var $xml_lang = array(''); |
13012 var $encoding; |
14324 var $encoding; |
13013 |
14325 |
13014 function parse(&$data, $encoding) |
14326 function parse(&$data, $encoding) |
13015 { |
14327 { |
13016 // Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character |
14328 // Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character |
13017 if (strtoupper($encoding) == 'US-ASCII') |
14329 if (strtoupper($encoding) === 'US-ASCII') |
13018 { |
14330 { |
13019 $this->encoding = 'UTF-8'; |
14331 $this->encoding = 'UTF-8'; |
13020 } |
14332 } |
13021 else |
14333 else |
13022 { |
14334 { |
13063 $this->error_string = 'SimplePie bug! Please report this!'; |
14375 $this->error_string = 'SimplePie bug! Please report this!'; |
13064 return false; |
14376 return false; |
13065 } |
14377 } |
13066 } |
14378 } |
13067 |
14379 |
13068 // Work around libxml bug |
|
13069 $data = str_replace('<', '<', $data); |
|
13070 $data = str_replace('>', '>', $data); |
|
13071 $data = str_replace('&', '&', $data); |
|
13072 $data = str_replace(''', ''', $data); |
|
13073 $data = str_replace('"', '"', $data); |
|
13074 |
|
13075 $return = true; |
14380 $return = true; |
13076 |
14381 |
14382 static $xml_is_sane = null; |
|
14383 if ($xml_is_sane === null) |
|
14384 { |
|
14385 $parser_check = xml_parser_create(); |
|
14386 xml_parse_into_struct($parser_check, '<foo>&</foo>', $values); |
|
14387 xml_parser_free($parser_check); |
|
14388 $xml_is_sane = isset($values[0]['value']); |
|
14389 } |
|
14390 |
|
13077 // Create the parser |
14391 // Create the parser |
13078 $xml = xml_parser_create_ns($this->encoding, $this->separator); |
14392 if ($xml_is_sane) |
13079 xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1); |
14393 { |
13080 xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0); |
14394 $xml = xml_parser_create_ns($this->encoding, $this->separator); |
13081 xml_set_object($xml, $this); |
14395 xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1); |
13082 xml_set_character_data_handler($xml, 'cdata'); |
14396 xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0); |
13083 xml_set_element_handler($xml, 'tag_open', 'tag_close'); |
14397 xml_set_object($xml, $this); |
13084 |
14398 xml_set_character_data_handler($xml, 'cdata'); |
13085 // Parse! |
14399 xml_set_element_handler($xml, 'tag_open', 'tag_close'); |
13086 if (!xml_parse($xml, $data, true)) |
14400 |
13087 { |
14401 // Parse! |
13088 $this->error_code = xml_get_error_code($xml); |
14402 if (!xml_parse($xml, $data, true)) |
13089 $this->error_string = xml_error_string($this->error_code); |
14403 { |
13090 $return = false; |
14404 $this->error_code = xml_get_error_code($xml); |
13091 } |
14405 $this->error_string = xml_error_string($this->error_code); |
13092 $this->current_line = xml_get_current_line_number($xml); |
14406 $return = false; |
13093 $this->current_column = xml_get_current_column_number($xml); |
14407 } |
13094 $this->current_byte = xml_get_current_byte_index($xml); |
14408 $this->current_line = xml_get_current_line_number($xml); |
13095 xml_parser_free($xml); |
14409 $this->current_column = xml_get_current_column_number($xml); |
13096 return $return; |
14410 $this->current_byte = xml_get_current_byte_index($xml); |
14411 xml_parser_free($xml); |
|
14412 return $return; |
|
14413 } |
|
14414 else |
|
14415 { |
|
14416 libxml_clear_errors(); |
|
14417 $xml =& new XMLReader(); |
|
14418 $xml->xml($data); |
|
14419 while (@$xml->read()) |
|
14420 { |
|
14421 switch ($xml->nodeType) |
|
14422 { |
|
14423 |
|
14424 case constant('XMLReader::END_ELEMENT'): |
|
14425 if ($xml->namespaceURI !== '') |
|
14426 { |
|
14427 $tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}"; |
|
14428 } |
|
14429 else |
|
14430 { |
|
14431 $tagName = $xml->localName; |
|
14432 } |
|
14433 $this->tag_close(null, $tagName); |
|
14434 break; |
|
14435 case constant('XMLReader::ELEMENT'): |
|
14436 $empty = $xml->isEmptyElement; |
|
14437 if ($xml->namespaceURI !== '') |
|
14438 { |
|
14439 $tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}"; |
|
14440 } |
|
14441 else |
|
14442 { |
|
14443 $tagName = $xml->localName; |
|
14444 } |
|
14445 $attributes = array(); |
|
14446 while ($xml->moveToNextAttribute()) |
|
14447 { |
|
14448 if ($xml->namespaceURI !== '') |
|
14449 { |
|
14450 $attrName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}"; |
|
14451 } |
|
14452 else |
|
14453 { |
|
14454 $attrName = $xml->localName; |
|
14455 } |
|
14456 $attributes[$attrName] = $xml->value; |
|
14457 } |
|
14458 $this->tag_open(null, $tagName, $attributes); |
|
14459 if ($empty) |
|
14460 { |
|
14461 $this->tag_close(null, $tagName); |
|
14462 } |
|
14463 break; |
|
14464 case constant('XMLReader::TEXT'): |
|
14465 |
|
14466 case constant('XMLReader::CDATA'): |
|
14467 $this->cdata(null, $xml->value); |
|
14468 break; |
|
14469 } |
|
14470 } |
|
14471 if ($error = libxml_get_last_error()) |
|
14472 { |
|
14473 $this->error_code = $error->code; |
|
14474 $this->error_string = $error->message; |
|
14475 $this->current_line = $error->line; |
|
14476 $this->current_column = $error->column; |
|
14477 return false; |
|
14478 } |
|
14479 else |
|
14480 { |
|
14481 return true; |
|
14482 } |
|
14483 } |
|
13097 } |
14484 } |
13098 |
14485 |
13099 function get_error_code() |
14486 function get_error_code() |
13100 { |
14487 { |
13101 return $this->error_code; |
14488 return $this->error_code; |
13126 return $this->data; |
14513 return $this->data; |
13127 } |
14514 } |
13128 |
14515 |
13129 function tag_open($parser, $tag, $attributes) |
14516 function tag_open($parser, $tag, $attributes) |
13130 { |
14517 { |
13131 if ($this->feed === 0) |
|
13132 { |
|
13133 return; |
|
13134 } |
|
13135 elseif ($this->feed == false) |
|
13136 { |
|
13137 if (in_array($tag, array( |
|
13138 SIMPLEPIE_NAMESPACE_ATOM_10 . $this->separator . 'feed', |
|
13139 SIMPLEPIE_NAMESPACE_ATOM_03 . $this->separator . 'feed', |
|
13140 'rss', |
|
13141 SIMPLEPIE_NAMESPACE_RDF . $this->separator . 'RDF' |
|
13142 ))) |
|
13143 { |
|
13144 $this->feed = 1; |
|
13145 } |
|
13146 } |
|
13147 else |
|
13148 { |
|
13149 $this->feed++; |
|
13150 } |
|
13151 |
|
13152 list($this->namespace[], $this->element[]) = $this->split_ns($tag); |
14518 list($this->namespace[], $this->element[]) = $this->split_ns($tag); |
13153 |
14519 |
13154 $attribs = array(); |
14520 $attribs = array(); |
13155 foreach ($attributes as $name => $value) |
14521 foreach ($attributes as $name => $value) |
13156 { |
14522 { |
13179 } |
14545 } |
13180 |
14546 |
13181 if ($this->current_xhtml_construct >= 0) |
14547 if ($this->current_xhtml_construct >= 0) |
13182 { |
14548 { |
13183 $this->current_xhtml_construct++; |
14549 $this->current_xhtml_construct++; |
13184 if (end($this->namespace) == SIMPLEPIE_NAMESPACE_XHTML) |
14550 if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML) |
13185 { |
14551 { |
13186 $this->data['data'] .= '<' . end($this->element); |
14552 $this->data['data'] .= '<' . end($this->element); |
13187 if (isset($attribs[''])) |
14553 if (isset($attribs[''])) |
13188 { |
14554 { |
13189 foreach ($attribs[''] as $name => $value) |
14555 foreach ($attribs[''] as $name => $value) |
13197 else |
14563 else |
13198 { |
14564 { |
13199 $this->datas[] =& $this->data; |
14565 $this->datas[] =& $this->data; |
13200 $this->data =& $this->data['child'][end($this->namespace)][end($this->element)][]; |
14566 $this->data =& $this->data['child'][end($this->namespace)][end($this->element)][]; |
13201 $this->data = array('data' => '', 'attribs' => $attribs, 'xml_base' => end($this->xml_base), 'xml_base_explicit' => end($this->xml_base_explicit), 'xml_lang' => end($this->xml_lang)); |
14567 $this->data = array('data' => '', 'attribs' => $attribs, 'xml_base' => end($this->xml_base), 'xml_base_explicit' => end($this->xml_base_explicit), 'xml_lang' => end($this->xml_lang)); |
13202 if ((end($this->namespace) == SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] == 'xml') |
14568 if ((end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] === 'xml') |
13203 || (end($this->namespace) == SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] == 'xhtml')) |
14569 || (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml')) |
13204 { |
14570 { |
13205 $this->current_xhtml_construct = 0; |
14571 $this->current_xhtml_construct = 0; |
13206 } |
14572 } |
13207 } |
14573 } |
13208 } |
14574 } |
13211 { |
14577 { |
13212 if ($this->current_xhtml_construct >= 0) |
14578 if ($this->current_xhtml_construct >= 0) |
13213 { |
14579 { |
13214 $this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding); |
14580 $this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding); |
13215 } |
14581 } |
13216 elseif ($this->feed > 1) |
14582 else |
13217 { |
14583 { |
13218 $this->data['data'] .= $cdata; |
14584 $this->data['data'] .= $cdata; |
13219 } |
14585 } |
13220 } |
14586 } |
13221 |
14587 |
13222 function tag_close($parser, $tag) |
14588 function tag_close($parser, $tag) |
13223 { |
14589 { |
13224 if (!$this->feed) |
|
13225 { |
|
13226 return; |
|
13227 } |
|
13228 |
|
13229 if ($this->current_xhtml_construct >= 0) |
14590 if ($this->current_xhtml_construct >= 0) |
13230 { |
14591 { |
13231 $this->current_xhtml_construct--; |
14592 $this->current_xhtml_construct--; |
13232 if (end($this->namespace) == SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param'))) |
14593 if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param'))) |
13233 { |
14594 { |
13234 $this->data['data'] .= '</' . end($this->element) . '>'; |
14595 $this->data['data'] .= '</' . end($this->element) . '>'; |
13235 } |
14596 } |
13236 } |
14597 } |
13237 if ($this->current_xhtml_construct == -1) |
14598 if ($this->current_xhtml_construct === -1) |
13238 { |
14599 { |
13239 $this->data =& $this->datas[$this->feed]; |
14600 $this->data =& $this->datas[count($this->datas) - 1]; |
13240 array_pop($this->datas); |
14601 array_pop($this->datas); |
13241 } |
14602 } |
13242 |
14603 |
13243 array_pop($this->element); |
14604 array_pop($this->element); |
13244 array_pop($this->namespace); |
14605 array_pop($this->namespace); |
13245 array_pop($this->xml_base); |
14606 array_pop($this->xml_base); |
13246 array_pop($this->xml_base_explicit); |
14607 array_pop($this->xml_base_explicit); |
13247 array_pop($this->xml_lang); |
14608 array_pop($this->xml_lang); |
13248 $this->feed--; |
|
13249 } |
14609 } |
13250 |
14610 |
13251 function split_ns($string) |
14611 function split_ns($string) |
13252 { |
14612 { |
13253 static $cache = array(); |
14613 static $cache = array(); |
13541 else |
14901 else |
13542 { |
14902 { |
13543 $file =& new $this->file_class($img['attribs']['src']['data'], $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen); |
14903 $file =& new $this->file_class($img['attribs']['src']['data'], $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen); |
13544 $headers = $file->headers; |
14904 $headers = $file->headers; |
13545 |
14905 |
13546 if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300))) |
14906 if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300))) |
13547 { |
14907 { |
13548 if ($cache->save(array('headers' => $file->headers, 'body' => $file->body))) |
14908 if ($cache->save(array('headers' => $file->headers, 'body' => $file->body))) |
13549 { |
14909 { |
13550 $img['attribs']['src']['data'] = $this->image_handler . $image_url; |
14910 $img['attribs']['src']['data'] = $this->image_handler . $image_url; |
13551 $data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data); |
14911 $data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data); |
13552 } |
14912 } |
13553 else |
14913 else |
13554 { |
14914 { |
13555 trigger_error("$cache->name is not writeable", E_USER_WARNING); |
14915 trigger_error("$this->cache_location is not writeable", E_USER_WARNING); |
13556 } |
14916 } |
13557 } |
14917 } |
13558 } |
14918 } |
13559 } |
14919 } |
13560 } |
14920 } |
13572 if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI)) |
14932 if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI)) |
13573 { |
14933 { |
13574 $data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8'); |
14934 $data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8'); |
13575 } |
14935 } |
13576 |
14936 |
13577 if ($this->output_encoding != 'UTF-8') |
14937 if ($this->output_encoding !== 'UTF-8') |
13578 { |
14938 { |
13579 $data = SimplePie_Misc::change_encoding($data, 'UTF-8', $this->output_encoding); |
14939 $data = SimplePie_Misc::change_encoding($data, 'UTF-8', $this->output_encoding); |
13580 } |
14940 } |
13581 } |
14941 } |
13582 return $data; |
14942 return $data; |