1 Author: Roland Mas <lolando@debian.org>
2 Description: Use SimplePie as provided by the libphp-simplepie Debian package
3 Index: src/common/rss/simplepie.inc
4 ===================================================================
5 --- src.orig/common/rss/simplepie.inc
12 - * A PHP-Based RSS and Atom Feed Framework.
13 - * Takes the hard work out of managing a complete RSS/Atom solution.
15 - * Copyright (c) 2004-2008, Ryan Parman and Geoffrey Sneddon
16 - * All rights reserved.
18 - * Redistribution and use in source and binary forms, with or without modification, are
19 - * permitted provided that the following conditions are met:
21 - * * Redistributions of source code must retain the above copyright notice, this list of
22 - * conditions and the following disclaimer.
24 - * * Redistributions in binary form must reproduce the above copyright notice, this list
25 - * of conditions and the following disclaimer in the documentation and/or other materials
26 - * provided with the distribution.
28 - * * Neither the name of the SimplePie Team nor the names of its contributors may be used
29 - * to endorse or promote products derived from this software without specific prior
30 - * written permission.
32 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
33 - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
34 - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
35 - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
37 - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
39 - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 - * POSSIBILITY OF SUCH DAMAGE.
42 - * @package SimplePie
44 - * @copyright 2004-2008 Ryan Parman, Geoffrey Sneddon
45 - * @author Ryan Parman
46 - * @author Geoffrey Sneddon
47 - * @link http://simplepie.org/ SimplePie
48 - * @link http://simplepie.org/support/ Please submit all bug reports and feature requests to the SimplePie forums
49 - * @license http://www.opensource.org/licenses/bsd-license.php BSD License
50 - * @todo phpDoc comments
56 -define('SIMPLEPIE_NAME', 'SimplePie');
61 -define('SIMPLEPIE_VERSION', '1.1.3');
66 -define('SIMPLEPIE_BUILD', 20081219);
69 - * SimplePie Website URL
71 -define('SIMPLEPIE_URL', 'http://simplepie.org');
74 - * SimplePie Useragent
75 - * @see SimplePie::set_useragent()
77 -define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . ' (Feed Parser; ' . SIMPLEPIE_URL . '; Allow like Gecko) Build/' . SIMPLEPIE_BUILD);
80 - * SimplePie Linkback
82 -define('SIMPLEPIE_LINKBACK', '<a href="' . SIMPLEPIE_URL . '" title="' . SIMPLEPIE_NAME . ' ' . SIMPLEPIE_VERSION . '">' . SIMPLEPIE_NAME . '</a>');
86 - * @see SimplePie::set_autodiscovery_level()
88 -define('SIMPLEPIE_LOCATOR_NONE', 0);
91 - * Feed Link Element Autodiscovery
92 - * @see SimplePie::set_autodiscovery_level()
94 -define('SIMPLEPIE_LOCATOR_AUTODISCOVERY', 1);
97 - * Local Feed Extension Autodiscovery
98 - * @see SimplePie::set_autodiscovery_level()
100 -define('SIMPLEPIE_LOCATOR_LOCAL_EXTENSION', 2);
103 - * Local Feed Body Autodiscovery
104 - * @see SimplePie::set_autodiscovery_level()
106 -define('SIMPLEPIE_LOCATOR_LOCAL_BODY', 4);
109 - * Remote Feed Extension Autodiscovery
110 - * @see SimplePie::set_autodiscovery_level()
112 -define('SIMPLEPIE_LOCATOR_REMOTE_EXTENSION', 8);
115 - * Remote Feed Body Autodiscovery
116 - * @see SimplePie::set_autodiscovery_level()
118 -define('SIMPLEPIE_LOCATOR_REMOTE_BODY', 16);
121 - * All Feed Autodiscovery
122 - * @see SimplePie::set_autodiscovery_level()
124 -define('SIMPLEPIE_LOCATOR_ALL', 31);
127 - * No known feed type
129 -define('SIMPLEPIE_TYPE_NONE', 0);
134 -define('SIMPLEPIE_TYPE_RSS_090', 1);
137 - * RSS 0.91 (Netscape)
139 -define('SIMPLEPIE_TYPE_RSS_091_NETSCAPE', 2);
142 - * RSS 0.91 (Userland)
144 -define('SIMPLEPIE_TYPE_RSS_091_USERLAND', 4);
147 - * RSS 0.91 (both Netscape and Userland)
149 -define('SIMPLEPIE_TYPE_RSS_091', 6);
154 -define('SIMPLEPIE_TYPE_RSS_092', 8);
159 -define('SIMPLEPIE_TYPE_RSS_093', 16);
164 -define('SIMPLEPIE_TYPE_RSS_094', 32);
169 -define('SIMPLEPIE_TYPE_RSS_10', 64);
174 -define('SIMPLEPIE_TYPE_RSS_20', 128);
179 -define('SIMPLEPIE_TYPE_RSS_RDF', 65);
182 - * Non-RDF-based RSS (truly intended as syndication format)
184 -define('SIMPLEPIE_TYPE_RSS_SYNDICATION', 190);
189 -define('SIMPLEPIE_TYPE_RSS_ALL', 255);
194 -define('SIMPLEPIE_TYPE_ATOM_03', 256);
199 -define('SIMPLEPIE_TYPE_ATOM_10', 512);
204 -define('SIMPLEPIE_TYPE_ATOM_ALL', 768);
209 -define('SIMPLEPIE_TYPE_ALL', 1023);
214 -define('SIMPLEPIE_CONSTRUCT_NONE', 0);
219 -define('SIMPLEPIE_CONSTRUCT_TEXT', 1);
224 -define('SIMPLEPIE_CONSTRUCT_HTML', 2);
229 -define('SIMPLEPIE_CONSTRUCT_XHTML', 4);
232 - * base64-encoded construct
234 -define('SIMPLEPIE_CONSTRUCT_BASE64', 8);
239 -define('SIMPLEPIE_CONSTRUCT_IRI', 16);
242 - * A construct that might be HTML
244 -define('SIMPLEPIE_CONSTRUCT_MAYBE_HTML', 32);
249 -define('SIMPLEPIE_CONSTRUCT_ALL', 63);
252 - * PCRE for HTML attributes
254 -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]*');
257 - * PCRE for XML attributes
259 -define('SIMPLEPIE_PCRE_XML_ATTRIBUTE', '((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'))*)\s*');
264 -define('SIMPLEPIE_NAMESPACE_XML', 'http://www.w3.org/XML/1998/namespace');
267 - * Atom 1.0 Namespace
269 -define('SIMPLEPIE_NAMESPACE_ATOM_10', 'http://www.w3.org/2005/Atom');
272 - * Atom 0.3 Namespace
274 -define('SIMPLEPIE_NAMESPACE_ATOM_03', 'http://purl.org/atom/ns#');
279 -define('SIMPLEPIE_NAMESPACE_RDF', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
282 - * RSS 0.90 Namespace
284 -define('SIMPLEPIE_NAMESPACE_RSS_090', 'http://my.netscape.com/rdf/simple/0.9/');
287 - * RSS 1.0 Namespace
289 -define('SIMPLEPIE_NAMESPACE_RSS_10', 'http://purl.org/rss/1.0/');
292 - * RSS 1.0 Content Module Namespace
294 -define('SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT', 'http://purl.org/rss/1.0/modules/content/');
297 - * RSS 2.0 Namespace
298 - * (Stupid, I know, but I'm certain it will confuse people less with support.)
300 -define('SIMPLEPIE_NAMESPACE_RSS_20', '');
305 -define('SIMPLEPIE_NAMESPACE_DC_10', 'http://purl.org/dc/elements/1.0/');
310 -define('SIMPLEPIE_NAMESPACE_DC_11', 'http://purl.org/dc/elements/1.1/');
313 - * W3C Basic Geo (WGS84 lat/long) Vocabulary Namespace
315 -define('SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO', 'http://www.w3.org/2003/01/geo/wgs84_pos#');
320 -define('SIMPLEPIE_NAMESPACE_GEORSS', 'http://www.georss.org/georss');
323 - * Media RSS Namespace
325 -define('SIMPLEPIE_NAMESPACE_MEDIARSS', 'http://search.yahoo.com/mrss/');
328 - * Wrong Media RSS Namespace
330 -define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG', 'http://search.yahoo.com/mrss');
333 - * iTunes RSS Namespace
335 -define('SIMPLEPIE_NAMESPACE_ITUNES', 'http://www.itunes.com/dtds/podcast-1.0.dtd');
340 -define('SIMPLEPIE_NAMESPACE_XHTML', 'http://www.w3.org/1999/xhtml');
343 - * IANA Link Relations Registry
345 -define('SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY', 'http://www.iana.org/assignments/relation/');
348 - * Whether we're running on PHP5
350 -define('SIMPLEPIE_PHP5', version_compare(PHP_VERSION, '5.0.0', '>='));
355 -define('SIMPLEPIE_FILE_SOURCE_NONE', 0);
358 - * Remote file source
360 -define('SIMPLEPIE_FILE_SOURCE_REMOTE', 1);
363 - * Local file source
365 -define('SIMPLEPIE_FILE_SOURCE_LOCAL', 2);
368 - * fsockopen() file source
370 -define('SIMPLEPIE_FILE_SOURCE_FSOCKOPEN', 4);
375 -define('SIMPLEPIE_FILE_SOURCE_CURL', 8);
378 - * file_get_contents() file source
380 -define('SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16);
385 - * @package SimplePie
386 - * @version "Razzleberry"
387 - * @copyright 2004-2007 Ryan Parman, Geoffrey Sneddon
388 - * @author Ryan Parman
389 - * @author Geoffrey Sneddon
390 - * @todo Option for type of fetching (cache, not modified header, fetch, etc.)
395 - * @var array Raw data
398 - var $data = array();
401 - * @var mixed Error string
407 - * @var object Instance of SimplePie_Sanitize (or other class)
408 - * @see SimplePie::set_sanitize_class()
414 - * @var string SimplePie Useragent
415 - * @see SimplePie::set_useragent()
418 - var $useragent = SIMPLEPIE_USERAGENT;
421 - * @var string Feed URL
422 - * @see SimplePie::set_feed_url()
428 - * @var object Instance of SimplePie_File to use as a feed
429 - * @see SimplePie::set_file()
435 - * @var string Raw feed data
436 - * @see SimplePie::set_raw_data()
442 - * @var int Timeout for fetching remote files
443 - * @see SimplePie::set_timeout()
449 - * @var bool Forces fsockopen() to be used for remote files instead
450 - * of cURL, even if a new enough version is installed
451 - * @see SimplePie::force_fsockopen()
454 - var $force_fsockopen = false;
457 - * @var bool Force the given data/URL to be treated as a feed no matter what
459 - * @see SimplePie::force_feed()
462 - var $force_feed = false;
465 - * @var bool Enable/Disable XML dump
466 - * @see SimplePie::enable_xml_dump()
469 - var $xml_dump = false;
472 - * @var bool Enable/Disable Caching
473 - * @see SimplePie::enable_cache()
479 - * @var int Cache duration (in seconds)
480 - * @see SimplePie::set_cache_duration()
483 - var $cache_duration = 3600;
486 - * @var int Auto-discovery cache duration (in seconds)
487 - * @see SimplePie::set_autodiscovery_cache_duration()
490 - var $autodiscovery_cache_duration = 604800; // 7 Days.
493 - * @var string Cache location (relative to executing script)
494 - * @see SimplePie::set_cache_location()
497 - var $cache_location = './cache';
500 - * @var string Function that creates the cache filename
501 - * @see SimplePie::set_cache_name_function()
504 - var $cache_name_function = 'md5';
507 - * @var bool Reorder feed by date descending
508 - * @see SimplePie::enable_order_by_date()
511 - var $order_by_date = true;
514 - * @var mixed Force input encoding to be set to the follow value
515 - * (false, or anything type-cast to false, disables this feature)
516 - * @see SimplePie::set_input_encoding()
519 - var $input_encoding = false;
522 - * @var int Feed Autodiscovery Level
523 - * @see SimplePie::set_autodiscovery_level()
526 - var $autodiscovery = SIMPLEPIE_LOCATOR_ALL;
529 - * @var string Class used for caching feeds
530 - * @see SimplePie::set_cache_class()
533 - var $cache_class = 'SimplePie_Cache';
536 - * @var string Class used for locating feeds
537 - * @see SimplePie::set_locator_class()
540 - var $locator_class = 'SimplePie_Locator';
543 - * @var string Class used for parsing feeds
544 - * @see SimplePie::set_parser_class()
547 - var $parser_class = 'SimplePie_Parser';
550 - * @var string Class used for fetching feeds
551 - * @see SimplePie::set_file_class()
554 - var $file_class = 'SimplePie_File';
557 - * @var string Class used for items
558 - * @see SimplePie::set_item_class()
561 - var $item_class = 'SimplePie_Item';
564 - * @var string Class used for authors
565 - * @see SimplePie::set_author_class()
568 - var $author_class = 'SimplePie_Author';
571 - * @var string Class used for categories
572 - * @see SimplePie::set_category_class()
575 - var $category_class = 'SimplePie_Category';
578 - * @var string Class used for enclosures
579 - * @see SimplePie::set_enclosures_class()
582 - var $enclosure_class = 'SimplePie_Enclosure';
585 - * @var string Class used for Media RSS <media:text> captions
586 - * @see SimplePie::set_caption_class()
589 - var $caption_class = 'SimplePie_Caption';
592 - * @var string Class used for Media RSS <media:copyright>
593 - * @see SimplePie::set_copyright_class()
596 - var $copyright_class = 'SimplePie_Copyright';
599 - * @var string Class used for Media RSS <media:credit>
600 - * @see SimplePie::set_credit_class()
603 - var $credit_class = 'SimplePie_Credit';
606 - * @var string Class used for Media RSS <media:rating>
607 - * @see SimplePie::set_rating_class()
610 - var $rating_class = 'SimplePie_Rating';
613 - * @var string Class used for Media RSS <media:restriction>
614 - * @see SimplePie::set_restriction_class()
617 - var $restriction_class = 'SimplePie_Restriction';
620 - * @var string Class used for content-type sniffing
621 - * @see SimplePie::set_content_type_sniffer_class()
624 - var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer';
627 - * @var string Class used for item sources.
628 - * @see SimplePie::set_source_class()
631 - var $source_class = 'SimplePie_Source';
634 - * @var mixed Set javascript query string parameter (false, or
635 - * anything type-cast to false, disables this feature)
636 - * @see SimplePie::set_javascript()
639 - var $javascript = 'js';
642 - * @var int Maximum number of feeds to check with autodiscovery
643 - * @see SimplePie::set_max_checked_feeds()
646 - var $max_checked_feeds = 10;
649 - * @var string Web-accessible path to the handler_favicon.php file.
650 - * @see SimplePie::set_favicon_handler()
653 - var $favicon_handler = '';
656 - * @var string Web-accessible path to the handler_image.php file.
657 - * @see SimplePie::set_image_handler()
660 - var $image_handler = '';
663 - * @var array Stores the URLs when multiple feeds are being initialized.
664 - * @see SimplePie::set_feed_url()
667 - var $multifeed_url = array();
670 - * @var array Stores SimplePie objects when multiple feeds initialized.
673 - var $multifeed_objects = array();
676 - * @var array Stores the get_object_vars() array for use with multifeeds.
677 - * @see SimplePie::set_feed_url()
680 - var $config_settings = null;
683 - * @var integer Stores the number of items to return per-feed with multifeeds.
684 - * @see SimplePie::set_item_limit()
687 - var $item_limit = 0;
690 - * @var array Stores the default attributes to be stripped by strip_attributes().
691 - * @see SimplePie::strip_attributes()
694 - var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
697 - * @var array Stores the default tags to be stripped by strip_htmltags().
698 - * @see SimplePie::strip_htmltags()
701 - var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
704 - * @var string proxy used to fetch feeds
705 - * @see SimplePie::set_proxy()
711 - * The SimplePie class contains feed level data and options
713 - * There are two ways that you can create a new SimplePie object. The first
714 - * is by passing a feed URL as a parameter to the SimplePie constructor
715 - * (as well as optionally setting the cache location and cache expiry). This
716 - * will initialise the whole feed with all of the default settings, and you
717 - * can begin accessing methods and properties immediately.
719 - * The second way is to create the SimplePie object with no parameters
720 - * at all. This will enable you to set configuration options. After setting
721 - * them, you must initialise the feed using $feed->init(). At that point the
722 - * object's methods and properties will be available to you. This format is
723 - * what is used throughout this documentation.
726 - * @since 1.0 Preview Release
727 - * @param string $feed_url This is the URL you want to parse.
728 - * @param string $cache_location This is where you want the cache to be stored.
729 - * @param int $cache_duration This is the number of seconds that you want to store the cache file for.
730 - * @param string $proxy This is the proxy "host:port" used to fetch feeds
732 - function SimplePie($feed_url = null, $cache_location = null, $cache_duration = null, $proxy = null)
734 - // Other objects, instances created here so we can set options on them
735 - $this->sanitize = new SimplePie_Sanitize;
737 - // Set options if they're passed to the constructor
738 - if ($cache_location !== null)
740 - $this->set_cache_location($cache_location);
743 - if ($cache_duration !== null)
745 - $this->set_cache_duration($cache_duration);
748 - if ($proxy !== null)
750 - $this->set_proxy($proxy);
753 - // Only init the script if we're passed a feed URL
754 - if ($feed_url !== null)
756 - $this->set_feed_url($feed_url);
762 - * Used for converting object to a string
764 - function __toString()
766 - return md5(serialize($this->data));
770 - * Remove items that link back to this before destroying this object
772 - function __destruct()
774 - if (!empty($this->data['items']))
776 - foreach ($this->data['items'] as $item)
778 - $item->__destruct();
780 - unset($this->data['items']);
782 - if (!empty($this->data['ordered_items']))
784 - foreach ($this->data['ordered_items'] as $item)
786 - $item->__destruct();
788 - unset($this->data['ordered_items']);
793 - * Force the given data/URL to be treated as a feed no matter what it
798 - * @param bool $enable Force the given data/URL to be treated as a feed
800 - function force_feed($enable = false)
802 - $this->force_feed = (bool) $enable;
806 - * This is the URL of the feed you want to parse.
808 - * This allows you to enter the URL of the feed you want to parse, or the
809 - * website you want to try to use auto-discovery on. This takes priority
810 - * over any set raw data.
812 - * You can set multiple feeds to mash together by passing an array instead
813 - * of a string for the $url. Remember that with each additional feed comes
814 - * additional processing and resources.
817 - * @since 1.0 Preview Release
818 - * @param mixed $url This is the URL (or array of URLs) that you want to parse.
819 - * @see SimplePie::set_raw_data()
821 - function set_feed_url($url)
823 - if (is_array($url))
825 - $this->multifeed_url = array();
826 - foreach ($url as $value)
828 - $this->multifeed_url[] = SimplePie_Misc::fix_protocol($value, 1);
833 - $this->feed_url = SimplePie_Misc::fix_protocol($url, 1);
838 - * This is the proxy used to fetch feeds
841 - * @param string $proxy This is the URL of the proxy "host:port"
843 - function set_proxy($proxy)
845 - $this->proxy = $proxy;
846 - $this->sanitize->proxy = $proxy;
850 - * Provides an instance of SimplePie_File to use as a feed
853 - * @param object &$file Instance of SimplePie_File (or subclass)
854 - * @return bool True on success, false on failure
856 - function set_file(&$file)
858 - if (is_a($file, 'SimplePie_File'))
860 - $this->feed_url = $file->url;
861 - $this->file =& $file;
868 - * Allows you to use a string of RSS/Atom data instead of a remote feed.
870 - * If you have a feed available as a string in PHP, you can tell SimplePie
871 - * to parse that data string instead of a remote feed. Any set feed URL
872 - * takes precedence.
875 - * @since 1.0 Beta 3
876 - * @param string $data RSS or Atom data as a string.
877 - * @see SimplePie::set_feed_url()
879 - function set_raw_data($data)
881 - $this->raw_data = $data;
885 - * Allows you to override the default timeout for fetching remote feeds.
887 - * This allows you to change the maximum time the feed's server to respond
888 - * and send the feed back.
891 - * @since 1.0 Beta 3
892 - * @param int $timeout The maximum number of seconds to spend waiting to retrieve a feed.
894 - function set_timeout($timeout = 10)
896 - $this->timeout = (int) $timeout;
900 - * Forces SimplePie to use fsockopen() instead of the preferred cURL
904 - * @since 1.0 Beta 3
905 - * @param bool $enable Force fsockopen() to be used
907 - function force_fsockopen($enable = false)
909 - $this->force_fsockopen = (bool) $enable;
913 - * Outputs the raw XML content of the feed, after it has gone through
914 - * SimplePie's filters.
916 - * Used only for debugging, this function will output the XML content as
917 - * text/xml. When SimplePie reads in a feed, it does a bit of cleaning up
918 - * before trying to parse it. Many parts of the feed are re-written in
919 - * memory, and in the end, you have a parsable feed. XML dump shows you the
920 - * actual XML that SimplePie tries to parse, which may or may not be very
921 - * different from the original feed.
924 - * @since 1.0 Preview Release
925 - * @param bool $enable Enable XML dump
927 - function enable_xml_dump($enable = false)
929 - $this->xml_dump = (bool) $enable;
933 - * Enables/disables caching in SimplePie.
935 - * This option allows you to disable caching all-together in SimplePie.
936 - * However, disabling the cache can lead to longer load times.
939 - * @since 1.0 Preview Release
940 - * @param bool $enable Enable caching
942 - function enable_cache($enable = true)
944 - $this->cache = (bool) $enable;
948 - * Set the length of time (in seconds) that the contents of a feed
952 - * @param int $seconds The feed content cache duration.
954 - function set_cache_duration($seconds = 3600)
956 - $this->cache_duration = (int) $seconds;
960 - * Set the length of time (in seconds) that the autodiscovered feed
961 - * URL will be cached.
964 - * @param int $seconds The autodiscovered feed URL cache duration.
966 - function set_autodiscovery_cache_duration($seconds = 604800)
968 - $this->autodiscovery_cache_duration = (int) $seconds;
972 - * Set the file system location where the cached files should be stored.
975 - * @param string $location The file system location.
977 - function set_cache_location($location = './cache')
979 - $this->cache_location = (string) $location;
983 - * Determines whether feed items should be sorted into reverse chronological order.
986 - * @param bool $enable Sort as reverse chronological order.
988 - function enable_order_by_date($enable = true)
990 - $this->order_by_date = (bool) $enable;
994 - * Allows you to override the character encoding reported by the feed.
997 - * @param string $encoding Character encoding.
999 - function set_input_encoding($encoding = false)
1003 - $this->input_encoding = (string) $encoding;
1007 - $this->input_encoding = false;
1012 - * Set how much feed autodiscovery to do
1015 - * @see SIMPLEPIE_LOCATOR_NONE
1016 - * @see SIMPLEPIE_LOCATOR_AUTODISCOVERY
1017 - * @see SIMPLEPIE_LOCATOR_LOCAL_EXTENSION
1018 - * @see SIMPLEPIE_LOCATOR_LOCAL_BODY
1019 - * @see SIMPLEPIE_LOCATOR_REMOTE_EXTENSION
1020 - * @see SIMPLEPIE_LOCATOR_REMOTE_BODY
1021 - * @see SIMPLEPIE_LOCATOR_ALL
1022 - * @param int $level Feed Autodiscovery Level (level can be a
1023 - * combination of the above constants, see bitwise OR operator)
1025 - function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL)
1027 - $this->autodiscovery = (int) $level;
1031 - * Allows you to change which class SimplePie uses for caching.
1032 - * Useful when you are overloading or extending SimplePie's default classes.
1035 - * @param string $class Name of custom class.
1036 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1037 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1039 - function set_cache_class($class = 'SimplePie_Cache')
1041 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Cache'))
1043 - $this->cache_class = $class;
1050 - * Allows you to change which class SimplePie uses for auto-discovery.
1051 - * Useful when you are overloading or extending SimplePie's default classes.
1054 - * @param string $class Name of custom class.
1055 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1056 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1058 - function set_locator_class($class = 'SimplePie_Locator')
1060 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Locator'))
1062 - $this->locator_class = $class;
1069 - * Allows you to change which class SimplePie uses for XML parsing.
1070 - * Useful when you are overloading or extending SimplePie's default classes.
1073 - * @param string $class Name of custom class.
1074 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1075 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1077 - function set_parser_class($class = 'SimplePie_Parser')
1079 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Parser'))
1081 - $this->parser_class = $class;
1088 - * Allows you to change which class SimplePie uses for remote file fetching.
1089 - * Useful when you are overloading or extending SimplePie's default classes.
1092 - * @param string $class Name of custom class.
1093 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1094 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1096 - function set_file_class($class = 'SimplePie_File')
1098 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_File'))
1100 - $this->file_class = $class;
1107 - * Allows you to change which class SimplePie uses for data sanitization.
1108 - * Useful when you are overloading or extending SimplePie's default classes.
1111 - * @param string $class Name of custom class.
1112 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1113 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1115 - function set_sanitize_class($class = 'SimplePie_Sanitize')
1117 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Sanitize'))
1119 - $this->sanitize = new $class;
1120 - $this->sanitize->proxy = $this->proxy;
1127 - * Allows you to change which class SimplePie uses for handling feed items.
1128 - * Useful when you are overloading or extending SimplePie's default classes.
1131 - * @param string $class Name of custom class.
1132 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1133 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1135 - function set_item_class($class = 'SimplePie_Item')
1137 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Item'))
1139 - $this->item_class = $class;
1146 - * Allows you to change which class SimplePie uses for handling author data.
1147 - * Useful when you are overloading or extending SimplePie's default classes.
1150 - * @param string $class Name of custom class.
1151 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1152 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1154 - function set_author_class($class = 'SimplePie_Author')
1156 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Author'))
1158 - $this->author_class = $class;
1165 - * Allows you to change which class SimplePie uses for handling category data.
1166 - * Useful when you are overloading or extending SimplePie's default classes.
1169 - * @param string $class Name of custom class.
1170 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1171 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1173 - function set_category_class($class = 'SimplePie_Category')
1175 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Category'))
1177 - $this->category_class = $class;
1184 - * Allows you to change which class SimplePie uses for feed enclosures.
1185 - * Useful when you are overloading or extending SimplePie's default classes.
1188 - * @param string $class Name of custom class.
1189 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1190 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1192 - function set_enclosure_class($class = 'SimplePie_Enclosure')
1194 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Enclosure'))
1196 - $this->enclosure_class = $class;
1203 - * Allows you to change which class SimplePie uses for <media:text> captions
1204 - * Useful when you are overloading or extending SimplePie's default classes.
1207 - * @param string $class Name of custom class.
1208 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1209 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1211 - function set_caption_class($class = 'SimplePie_Caption')
1213 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Caption'))
1215 - $this->caption_class = $class;
1222 - * Allows you to change which class SimplePie uses for <media:copyright>
1223 - * Useful when you are overloading or extending SimplePie's default classes.
1226 - * @param string $class Name of custom class.
1227 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1228 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1230 - function set_copyright_class($class = 'SimplePie_Copyright')
1232 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Copyright'))
1234 - $this->copyright_class = $class;
1241 - * Allows you to change which class SimplePie uses for <media:credit>
1242 - * Useful when you are overloading or extending SimplePie's default classes.
1245 - * @param string $class Name of custom class.
1246 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1247 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1249 - function set_credit_class($class = 'SimplePie_Credit')
1251 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Credit'))
1253 - $this->credit_class = $class;
1260 - * Allows you to change which class SimplePie uses for <media:rating>
1261 - * Useful when you are overloading or extending SimplePie's default classes.
1264 - * @param string $class Name of custom class.
1265 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1266 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1268 - function set_rating_class($class = 'SimplePie_Rating')
1270 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Rating'))
1272 - $this->rating_class = $class;
1279 - * Allows you to change which class SimplePie uses for <media:restriction>
1280 - * Useful when you are overloading or extending SimplePie's default classes.
1283 - * @param string $class Name of custom class.
1284 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1285 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1287 - function set_restriction_class($class = 'SimplePie_Restriction')
1289 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Restriction'))
1291 - $this->restriction_class = $class;
1298 - * Allows you to change which class SimplePie uses for content-type sniffing.
1299 - * Useful when you are overloading or extending SimplePie's default classes.
1302 - * @param string $class Name of custom class.
1303 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1304 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1306 - function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer')
1308 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Content_Type_Sniffer'))
1310 - $this->content_type_sniffer_class = $class;
1317 - * Allows you to change which class SimplePie uses item sources.
1318 - * Useful when you are overloading or extending SimplePie's default classes.
1321 - * @param string $class Name of custom class.
1322 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1323 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1325 - function set_source_class($class = 'SimplePie_Source')
1327 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Source'))
1329 - $this->source_class = $class;
1336 - * Allows you to override the default user agent string.
1339 - * @param string $ua New user agent string.
1341 - function set_useragent($ua = SIMPLEPIE_USERAGENT)
1343 - $this->useragent = (string) $ua;
1347 - * Set callback function to create cache filename with
1350 - * @param mixed $function Callback function
1352 - function set_cache_name_function($function = 'md5')
1354 - if (is_callable($function))
1356 - $this->cache_name_function = $function;
1361 - * Set javascript query string parameter
1364 - * @param mixed $get Javascript query string parameter
1366 - function set_javascript($get = 'js')
1370 - $this->javascript = (string) $get;
1374 - $this->javascript = false;
1379 - * Set options to make SP as fast as possible. Forgoes a
1380 - * substantial amount of data sanitization in favor of speed.
1383 - * @param bool $set Whether to set them or not
1385 - function set_stupidly_fast($set = false)
1389 - $this->enable_order_by_date(false);
1390 - $this->remove_div(false);
1391 - $this->strip_comments(false);
1392 - $this->strip_htmltags(false);
1393 - $this->strip_attributes(false);
1394 - $this->set_image_handler(false);
1399 - * Set maximum number of feeds to check with autodiscovery
1402 - * @param int $max Maximum number of feeds to check
1404 - function set_max_checked_feeds($max = 10)
1406 - $this->max_checked_feeds = (int) $max;
1409 - function remove_div($enable = true)
1411 - $this->sanitize->remove_div($enable);
1414 - function strip_htmltags($tags = '', $encode = null)
1418 - $tags = $this->strip_htmltags;
1420 - $this->sanitize->strip_htmltags($tags);
1421 - if ($encode !== null)
1423 - $this->sanitize->encode_instead_of_strip($tags);
1427 - function encode_instead_of_strip($enable = true)
1429 - $this->sanitize->encode_instead_of_strip($enable);
1432 - function strip_attributes($attribs = '')
1434 - if ($attribs === '')
1436 - $attribs = $this->strip_attributes;
1438 - $this->sanitize->strip_attributes($attribs);
1441 - function set_output_encoding($encoding = 'UTF-8')
1443 - $this->sanitize->set_output_encoding($encoding);
1446 - function strip_comments($strip = false)
1448 - $this->sanitize->strip_comments($strip);
1452 - * Set element/attribute key/value pairs of HTML attributes
1453 - * containing URLs that need to be resolved relative to the feed
1457 - * @param array $element_attribute Element/attribute key/value pairs
1459 - function set_url_replacements($element_attribute = array('a' => 'href', 'area' => 'href', 'blockquote' => 'cite', 'del' => 'cite', 'form' => 'action', 'img' => array('longdesc', 'src'), 'input' => 'src', 'ins' => 'cite', 'q' => 'cite'))
1461 - $this->sanitize->set_url_replacements($element_attribute);
1465 - * Set the handler to enable the display of cached favicons.
1468 - * @param str $page Web-accessible path to the handler_favicon.php file.
1469 - * @param str $qs The query string that the value should be passed to.
1471 - function set_favicon_handler($page = false, $qs = 'i')
1473 - if ($page != false)
1475 - $this->favicon_handler = $page . '?' . $qs . '=';
1479 - $this->favicon_handler = '';
1484 - * Set the handler to enable the display of cached images.
1487 - * @param str $page Web-accessible path to the handler_image.php file.
1488 - * @param str $qs The query string that the value should be passed to.
1490 - function set_image_handler($page = false, $qs = 'i')
1492 - if ($page != false)
1494 - $this->sanitize->set_image_handler($page . '?' . $qs . '=');
1498 - $this->image_handler = '';
1503 - * Set the limit for items returned per-feed with multifeeds.
1506 - * @param integer $limit The maximum number of items to return.
1508 - function set_item_limit($limit = 0)
1510 - $this->item_limit = (int) $limit;
1515 - if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.3.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre'))
1519 - if (isset($_GET[$this->javascript]))
1521 - if (function_exists('ob_gzhandler'))
1523 - ob_start('ob_gzhandler');
1525 - header('Content-type: text/javascript; charset: UTF-8');
1526 - header('Cache-Control: must-revalidate');
1527 - header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
1529 -function embed_odeo(link) {
1530 - 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>');
1533 -function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
1534 - if (placeholder != '') {
1535 - 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>');
1538 - 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>');
1542 -function embed_flash(bgcolor, width, height, link, loop, type) {
1543 - 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>');
1546 -function embed_flv(width, height, link, placeholder, loop, player) {
1547 - 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>');
1550 -function embed_wmedia(width, height, link) {
1551 - document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
1557 - // Pass whatever was set with config options over to the sanitizer.
1558 - $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->cache_class);
1559 - $this->sanitize->pass_file_data($this->file_class, $this->timeout, $this->useragent, $this->force_fsockopen);
1561 - if ($this->feed_url !== null || $this->raw_data !== null)
1563 - $this->data = array();
1564 - $this->multifeed_objects = array();
1567 - if ($this->feed_url !== null)
1569 - $parsed_feed_url = SimplePie_Misc::parse_url($this->feed_url);
1570 - // Decide whether to enable caching
1571 - if ($this->cache && $parsed_feed_url['scheme'] !== '')
1573 - $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc');
1575 - // If it's enabled and we don't want an XML dump, use the cache
1576 - if ($cache && !$this->xml_dump)
1579 - $this->data = $cache->load();
1580 - if (!empty($this->data))
1582 - // If the cache is for an outdated build of SimplePie
1583 - if (!isset($this->data['build']) || $this->data['build'] != SIMPLEPIE_BUILD)
1586 - $this->data = array();
1588 - // If we've hit a collision just rerun it with caching disabled
1589 - elseif (isset($this->data['url']) && $this->data['url'] != $this->feed_url)
1592 - $this->data = array();
1594 - // If we've got a non feed_url stored (if the page isn't actually a feed, or is a redirect) use that URL.
1595 - elseif (isset($this->data['feed_url']))
1597 - // If the autodiscovery cache is still valid use it.
1598 - if ($cache->mtime() + $this->autodiscovery_cache_duration > time())
1600 - // Do not need to do feed autodiscovery yet.
1601 - if ($this->data['feed_url'] == $this->data['url'])
1604 - $this->data = array();
1608 - $this->set_feed_url($this->data['feed_url']);
1609 - return $this->init();
1613 - // Check if the cache has been updated
1614 - elseif ($cache->mtime() + $this->cache_duration < time())
1616 - // If we have last-modified and/or etag set
1617 - if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag']))
1619 - $headers = array();
1620 - if (isset($this->data['headers']['last-modified']))
1622 - $headers['if-modified-since'] = $this->data['headers']['last-modified'];
1624 - if (isset($this->data['headers']['etag']))
1626 - $headers['if-none-match'] = '"' . $this->data['headers']['etag'] . '"';
1628 - $file = new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen, $this->proxy);
1629 - if ($file->success)
1631 - if ($file->status_code == 304)
1638 - $headers = $file->headers;
1647 - // If the cache is still valid, just return true
1653 - // If the cache is empty, delete it
1657 - $this->data = array();
1660 - // 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.
1661 - if (!isset($file))
1663 - if (is_a($this->file, 'SimplePie_File') && $this->file->url == $this->feed_url)
1665 - $file =& $this->file;
1669 - $file = new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen, $this->proxy);
1672 - // If the file connection has an error, set SimplePie::error to that and quit
1673 - if (!$file->success)
1675 - $this->error = $file->error;
1676 - if (!empty($this->data))
1686 - if (!$this->force_feed)
1688 - // Check if the supplied URL is a feed, if it isn't, look for it.
1689 - $locate = new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class);
1690 - if (!$locate->is_feed($file))
1692 - // We need to unset this so that if SimplePie::set_file() has been called that object is untouched
1694 - if ($file = $locate->find($this->autodiscovery))
1698 - $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD);
1699 - if (!$cache->save($this))
1701 - trigger_error("$cache->name is not writeable", E_USER_WARNING);
1703 - $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc');
1705 - $this->feed_url = $file->url;
1709 - $this->error = "A feed could not be found at $this->feed_url";
1710 - SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
1717 - $headers = $file->headers;
1718 - $data = $file->body;
1719 - $sniffer = new $this->content_type_sniffer_class($file);
1720 - $sniffed = $sniffer->get_type();
1724 - $data = $this->raw_data;
1727 - // Set up array of possible encodings
1728 - $encodings = array();
1730 - // First check to see if input has been overridden.
1731 - if ($this->input_encoding !== false)
1733 - $encodings[] = $this->input_encoding;
1736 - $application_types = array('application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity');
1737 - $text_types = array('text/xml', 'text/xml-external-parsed-entity');
1739 - // RFC 3023 (only applies to sniffed content)
1740 - if (isset($sniffed))
1742 - if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) === 'application/' && substr($sniffed, -4) === '+xml')
1744 - if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
1746 - $encodings[] = strtoupper($charset[1]);
1748 - $encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data));
1749 - $encodings[] = 'UTF-8';
1751 - elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml')
1753 - if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
1755 - $encodings[] = $charset[1];
1757 - $encodings[] = 'US-ASCII';
1759 - // Text MIME-type default
1760 - elseif (substr($sniffed, 0, 5) === 'text/')
1762 - $encodings[] = 'US-ASCII';
1766 - // Fallback to XML 1.0 Appendix F.1/UTF-8/ISO-8859-1
1767 - $encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data));
1768 - $encodings[] = 'UTF-8';
1769 - $encodings[] = 'ISO-8859-1';
1771 - // There's no point in trying an encoding twice
1772 - $encodings = array_unique($encodings);
1774 - // If we want the XML, just output that with the most likely encoding and quit
1775 - if ($this->xml_dump)
1777 - header('Content-type: text/xml; charset=' . $encodings[0]);
1782 - // Loop through each possible encoding, till we return something, or run out of possibilities
1783 - foreach ($encodings as $encoding)
1785 - // Change the encoding to UTF-8 (as we always use UTF-8 internally)
1786 - if ($utf8_data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8'))
1788 - // Create new parser
1789 - $parser = new $this->parser_class();
1791 - // If it's parsed fine
1792 - if ($parser->parse($utf8_data, 'UTF-8'))
1794 - $this->data = $parser->get_data();
1795 - if ($this->get_type() & ~SIMPLEPIE_TYPE_NONE)
1797 - if (isset($headers))
1799 - $this->data['headers'] = $headers;
1801 - $this->data['build'] = SIMPLEPIE_BUILD;
1803 - // Cache the file if caching is enabled
1804 - if ($cache && !$cache->save($this))
1806 - trigger_error("$cache->name is not writeable", E_USER_WARNING);
1812 - $this->error = "A feed could not be found at $this->feed_url";
1813 - SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
1819 - // We have an error, just set SimplePie::error to it and quit
1820 - $this->error = sprintf('XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
1821 - SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
1824 - elseif (!empty($this->multifeed_url))
1828 - $this->multifeed_objects = array();
1829 - foreach ($this->multifeed_url as $url)
1831 - if (SIMPLEPIE_PHP5)
1833 - // This keyword needs to defy coding standards for PHP4 compatibility
1834 - $this->multifeed_objects[$i] = clone($this);
1838 - $this->multifeed_objects[$i] = $this;
1840 - $this->multifeed_objects[$i]->set_feed_url($url);
1841 - $success |= $this->multifeed_objects[$i]->init();
1844 - return (bool) $success;
1853 - * Return the error message for the occured error
1856 - * @return string Error message
1860 - return $this->error;
1863 - function get_encoding()
1865 - return $this->sanitize->output_encoding;
1868 - function handle_content_type($mime = 'text/html')
1870 - if (!headers_sent())
1872 - $header = "Content-type: $mime;";
1873 - if ($this->get_encoding())
1875 - $header .= ' charset=' . $this->get_encoding();
1879 - $header .= ' charset=UTF-8';
1885 - function get_type()
1887 - if (!isset($this->data['type']))
1889 - $this->data['type'] = SIMPLEPIE_TYPE_ALL;
1890 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed']))
1892 - $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_10;
1894 - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed']))
1896 - $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_03;
1898 - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF']))
1900 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel'])
1901 - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image'])
1902 - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])
1903 - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput']))
1905 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_10;
1907 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['channel'])
1908 - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image'])
1909 - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])
1910 - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput']))
1912 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_090;
1915 - elseif (isset($this->data['child']['']['rss']))
1917 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL;
1918 - if (isset($this->data['child']['']['rss'][0]['attribs']['']['version']))
1920 - switch (trim($this->data['child']['']['rss'][0]['attribs']['']['version']))
1923 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091;
1924 - if (isset($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
1926 - switch (trim($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
1929 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
1933 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_USERLAND;
1940 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_092;
1944 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_093;
1948 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_094;
1952 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_20;
1959 - $this->data['type'] = SIMPLEPIE_TYPE_NONE;
1962 - return $this->data['type'];
1966 - * Returns the URL for the favicon of the feed's website.
1968 - * @todo Cache atom:icon
1972 - function get_favicon()
1974 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
1976 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
1978 - elseif (($url = $this->get_link()) !== null && preg_match('/^http(s)?:\/\//i', $url))
1980 - $favicon = SimplePie_Misc::absolutize_url('/favicon.ico', $url);
1982 - if ($this->cache && $this->favicon_handler)
1984 - $favicon_filename = call_user_func($this->cache_name_function, $favicon);
1985 - $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $favicon_filename, 'spi');
1987 - if ($cache->load())
1989 - return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI);
1993 - $file = new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen, $this->proxy);
1995 - if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
1997 - $sniffer = new $this->content_type_sniffer_class($file);
1998 - if (substr($sniffer->get_type(), 0, 6) === 'image/')
2000 - if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
2002 - return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI);
2006 - trigger_error("$cache->name is not writeable", E_USER_WARNING);
2007 - return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI);
2015 - return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI);
2022 - * @todo If we have a perm redirect we should return the new URL
2023 - * @todo When we make the above change, let's support <itunes:new-feed-url> as well
2024 - * @todo Also, |atom:link|@rel=self
2026 - function subscribe_url()
2028 - if ($this->feed_url !== null)
2030 - return $this->sanitize($this->feed_url, SIMPLEPIE_CONSTRUCT_IRI);
2038 - function subscribe_feed()
2040 - if ($this->feed_url !== null)
2042 - return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI);
2050 - function subscribe_outlook()
2052 - if ($this->feed_url !== null)
2054 - return 'outlook' . $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI);
2062 - function subscribe_podcast()
2064 - if ($this->feed_url !== null)
2066 - return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 3), SIMPLEPIE_CONSTRUCT_IRI);
2074 - function subscribe_itunes()
2076 - if ($this->feed_url !== null)
2078 - return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 4), SIMPLEPIE_CONSTRUCT_IRI);
2087 - * Creates the subscribe_* methods' return data
2090 - * @param string $feed_url String to prefix to the feed URL
2091 - * @param string $site_url String to prefix to the site URL (and
2092 - * suffix to the feed URL)
2093 - * @return mixed URL if feed exists, false otherwise
2095 - function subscribe_service($feed_url, $site_url = null)
2097 - if ($this->subscribe_url())
2099 - $return = $this->sanitize($feed_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->feed_url);
2100 - if ($site_url !== null && $this->get_link() !== null)
2102 - $return .= $this->sanitize($site_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_link());
2112 - function subscribe_aol()
2114 - return $this->subscribe_service('http://feeds.my.aol.com/add.jsp?url=');
2117 - function subscribe_bloglines()
2119 - return urldecode($this->subscribe_service('http://www.bloglines.com/sub/'));
2122 - function subscribe_eskobo()
2124 - return $this->subscribe_service('http://www.eskobo.com/?AddToMyPage=');
2127 - function subscribe_feedfeeds()
2129 - return $this->subscribe_service('http://www.feedfeeds.com/add?feed=');
2132 - function subscribe_feedster()
2134 - return $this->subscribe_service('http://www.feedster.com/myfeedster.php?action=addrss&confirm=no&rssurl=');
2137 - function subscribe_google()
2139 - return $this->subscribe_service('http://fusion.google.com/add?feedurl=');
2142 - function subscribe_gritwire()
2144 - return $this->subscribe_service('http://my.gritwire.com/feeds/addExternalFeed.aspx?FeedUrl=');
2147 - function subscribe_msn()
2149 - return $this->subscribe_service('http://my.msn.com/addtomymsn.armx?id=rss&ut=', '&ru=');
2152 - function subscribe_netvibes()
2154 - return $this->subscribe_service('http://www.netvibes.com/subscribe.php?url=');
2157 - function subscribe_newsburst()
2159 - return $this->subscribe_service('http://www.newsburst.com/Source/?add=');
2162 - function subscribe_newsgator()
2164 - return $this->subscribe_service('http://www.newsgator.com/ngs/subscriber/subext.aspx?url=');
2167 - function subscribe_odeo()
2169 - return $this->subscribe_service('http://www.odeo.com/listen/subscribe?feed=');
2172 - function subscribe_podnova()
2174 - return $this->subscribe_service('http://www.podnova.com/index_your_podcasts.srf?action=add&url=');
2177 - function subscribe_rojo()
2179 - return $this->subscribe_service('http://www.rojo.com/add-subscription?resource=');
2182 - function subscribe_yahoo()
2184 - return $this->subscribe_service('http://add.my.yahoo.com/rss?url=');
2187 - function get_feed_tags($namespace, $tag)
2189 - $type = $this->get_type();
2190 - if ($type & SIMPLEPIE_TYPE_ATOM_10)
2192 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag]))
2194 - return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag];
2197 - if ($type & SIMPLEPIE_TYPE_ATOM_03)
2199 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag]))
2201 - return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag];
2204 - if ($type & SIMPLEPIE_TYPE_RSS_RDF)
2206 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag]))
2208 - return $this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag];
2211 - if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
2213 - if (isset($this->data['child']['']['rss'][0]['child'][$namespace][$tag]))
2215 - return $this->data['child']['']['rss'][0]['child'][$namespace][$tag];
2221 - function get_channel_tags($namespace, $tag)
2223 - $type = $this->get_type();
2224 - if ($type & SIMPLEPIE_TYPE_ATOM_ALL)
2226 - if ($return = $this->get_feed_tags($namespace, $tag))
2231 - if ($type & SIMPLEPIE_TYPE_RSS_10)
2233 - if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'channel'))
2235 - if (isset($channel[0]['child'][$namespace][$tag]))
2237 - return $channel[0]['child'][$namespace][$tag];
2241 - if ($type & SIMPLEPIE_TYPE_RSS_090)
2243 - if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'channel'))
2245 - if (isset($channel[0]['child'][$namespace][$tag]))
2247 - return $channel[0]['child'][$namespace][$tag];
2251 - if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
2253 - if ($channel = $this->get_feed_tags('', 'channel'))
2255 - if (isset($channel[0]['child'][$namespace][$tag]))
2257 - return $channel[0]['child'][$namespace][$tag];
2264 - function get_image_tags($namespace, $tag)
2266 - $type = $this->get_type();
2267 - if ($type & SIMPLEPIE_TYPE_RSS_10)
2269 - if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'image'))
2271 - if (isset($image[0]['child'][$namespace][$tag]))
2273 - return $image[0]['child'][$namespace][$tag];
2277 - if ($type & SIMPLEPIE_TYPE_RSS_090)
2279 - if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'image'))
2281 - if (isset($image[0]['child'][$namespace][$tag]))
2283 - return $image[0]['child'][$namespace][$tag];
2287 - if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
2289 - if ($image = $this->get_channel_tags('', 'image'))
2291 - if (isset($image[0]['child'][$namespace][$tag]))
2293 - return $image[0]['child'][$namespace][$tag];
2300 - function get_base($element = array())
2302 - if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base']))
2304 - return $element['xml_base'];
2306 - elseif ($this->get_link() !== null)
2308 - return $this->get_link();
2312 - return $this->subscribe_url();
2316 - function sanitize($data, $type, $base = '')
2318 - return $this->sanitize->sanitize($data, $type, $base);
2321 - function get_title()
2323 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
2325 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
2327 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
2329 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
2331 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
2333 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2335 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
2337 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2339 - elseif ($return = $this->get_channel_tags('', 'title'))
2341 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2343 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
2345 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2347 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
2349 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2357 - function get_category($key = 0)
2359 - $categories = $this->get_categories();
2360 - if (isset($categories[$key]))
2362 - return $categories[$key];
2370 - function get_categories()
2372 - $categories = array();
2374 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
2379 - if (isset($category['attribs']['']['term']))
2381 - $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
2383 - if (isset($category['attribs']['']['scheme']))
2385 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
2387 - if (isset($category['attribs']['']['label']))
2389 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
2391 - $categories[] = new $this->category_class($term, $scheme, $label);
2393 - foreach ((array) $this->get_channel_tags('', 'category') as $category)
2395 - $categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
2397 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
2399 - $categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
2401 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
2403 - $categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
2406 - if (!empty($categories))
2408 - return SimplePie_Misc::array_unique($categories);
2416 - function get_author($key = 0)
2418 - $authors = $this->get_authors();
2419 - if (isset($authors[$key]))
2421 - return $authors[$key];
2429 - function get_authors()
2431 - $authors = array();
2432 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
2437 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
2439 - $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2441 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
2443 - $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
2445 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
2447 - $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2449 - if ($name !== null || $email !== null || $uri !== null)
2451 - $authors[] = new $this->author_class($name, $uri, $email);
2454 - if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
2459 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
2461 - $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2463 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
2465 - $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
2467 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
2469 - $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2471 - if ($name !== null || $email !== null || $url !== null)
2473 - $authors[] = new $this->author_class($name, $url, $email);
2476 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
2478 - $authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
2480 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
2482 - $authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
2484 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
2486 - $authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
2489 - if (!empty($authors))
2491 - return SimplePie_Misc::array_unique($authors);
2499 - function get_contributor($key = 0)
2501 - $contributors = $this->get_contributors();
2502 - if (isset($contributors[$key]))
2504 - return $contributors[$key];
2512 - function get_contributors()
2514 - $contributors = array();
2515 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
2520 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
2522 - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2524 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
2526 - $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
2528 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
2530 - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2532 - if ($name !== null || $email !== null || $uri !== null)
2534 - $contributors[] = new $this->author_class($name, $uri, $email);
2537 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
2542 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
2544 - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2546 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
2548 - $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
2550 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
2552 - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2554 - if ($name !== null || $email !== null || $url !== null)
2556 - $contributors[] = new $this->author_class($name, $url, $email);
2560 - if (!empty($contributors))
2562 - return SimplePie_Misc::array_unique($contributors);
2570 - function get_link($key = 0, $rel = 'alternate')
2572 - $links = $this->get_links($rel);
2573 - if (isset($links[$key]))
2575 - return $links[$key];
2584 - * Added for parity between the parent-level and the item/entry-level.
2586 - function get_permalink()
2588 - return $this->get_link(0);
2591 - function get_links($rel = 'alternate')
2593 - if (!isset($this->data['links']))
2595 - $this->data['links'] = array();
2596 - if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
2598 - foreach ($links as $link)
2600 - if (isset($link['attribs']['']['href']))
2602 - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
2603 - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
2607 - if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
2609 - foreach ($links as $link)
2611 - if (isset($link['attribs']['']['href']))
2613 - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
2614 - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
2619 - if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
2621 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
2623 - if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
2625 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
2627 - if ($links = $this->get_channel_tags('', 'link'))
2629 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
2632 - $keys = array_keys($this->data['links']);
2633 - foreach ($keys as $key)
2635 - if (SimplePie_Misc::is_isegment_nz_nc($key))
2637 - if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
2639 - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
2640 - $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
2644 - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
2647 - elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
2649 - $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
2651 - $this->data['links'][$key] = array_unique($this->data['links'][$key]);
2655 - if (isset($this->data['links'][$rel]))
2657 - return $this->data['links'][$rel];
2665 - function get_description()
2667 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
2669 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
2671 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
2673 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
2675 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
2677 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2679 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
2681 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2683 - elseif ($return = $this->get_channel_tags('', 'description'))
2685 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2687 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
2689 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2691 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
2693 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2695 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
2697 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
2699 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
2701 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
2709 - function get_copyright()
2711 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
2713 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
2715 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
2717 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
2719 - elseif ($return = $this->get_channel_tags('', 'copyright'))
2721 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2723 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
2725 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2727 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
2729 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2737 - function get_language()
2739 - if ($return = $this->get_channel_tags('', 'language'))
2741 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2743 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
2745 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2747 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
2749 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2751 - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang']))
2753 - return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
2755 - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang']))
2757 - return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
2759 - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang']))
2761 - return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
2763 - elseif (isset($this->data['headers']['content-language']))
2765 - return $this->sanitize($this->data['headers']['content-language'], SIMPLEPIE_CONSTRUCT_TEXT);
2773 - function get_latitude()
2775 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
2777 - return (float) $return[0]['data'];
2779 - elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
2781 - return (float) $match[1];
2789 - function get_longitude()
2791 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
2793 - return (float) $return[0]['data'];
2795 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
2797 - return (float) $return[0]['data'];
2799 - elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
2801 - return (float) $match[2];
2809 - function get_image_title()
2811 - if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
2813 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2815 - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
2817 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2819 - elseif ($return = $this->get_image_tags('', 'title'))
2821 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2823 - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
2825 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2827 - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
2829 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2837 - function get_image_url()
2839 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
2841 - return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
2843 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
2845 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2847 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
2849 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2851 - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url'))
2853 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2855 - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url'))
2857 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2859 - elseif ($return = $this->get_image_tags('', 'url'))
2861 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2869 - function get_image_link()
2871 - if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
2873 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2875 - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
2877 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2879 - elseif ($return = $this->get_image_tags('', 'link'))
2881 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2889 - function get_image_width()
2891 - if ($return = $this->get_image_tags('', 'width'))
2893 - return round($return[0]['data']);
2895 - elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
2905 - function get_image_height()
2907 - if ($return = $this->get_image_tags('', 'height'))
2909 - return round($return[0]['data']);
2911 - elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
2921 - function get_item_quantity($max = 0)
2923 - $qty = count($this->get_items());
2930 - return ($qty > $max) ? $max : $qty;
2934 - function get_item($key = 0)
2936 - $items = $this->get_items();
2937 - if (isset($items[$key]))
2939 - return $items[$key];
2947 - function get_items($start = 0, $end = 0)
2949 - if (!empty($this->multifeed_objects))
2951 - return SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
2953 - elseif (!isset($this->data['items']))
2955 - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
2957 - $keys = array_keys($items);
2958 - foreach ($keys as $key)
2960 - $this->data['items'][] = new $this->item_class($this, $items[$key]);
2963 - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
2965 - $keys = array_keys($items);
2966 - foreach ($keys as $key)
2968 - $this->data['items'][] = new $this->item_class($this, $items[$key]);
2971 - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
2973 - $keys = array_keys($items);
2974 - foreach ($keys as $key)
2976 - $this->data['items'][] = new $this->item_class($this, $items[$key]);
2979 - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
2981 - $keys = array_keys($items);
2982 - foreach ($keys as $key)
2984 - $this->data['items'][] = new $this->item_class($this, $items[$key]);
2987 - if ($items = $this->get_channel_tags('', 'item'))
2989 - $keys = array_keys($items);
2990 - foreach ($keys as $key)
2992 - $this->data['items'][] = new $this->item_class($this, $items[$key]);
2997 - if (!empty($this->data['items']))
2999 - // If we want to order it by date, check if all items have a date, and then sort it
3000 - if ($this->order_by_date)
3002 - if (!isset($this->data['ordered_items']))
3005 - foreach ($this->data['items'] as $item)
3007 - if (!$item->get_date('U'))
3014 - $this->data['ordered_items'] = $this->data['items'];
3017 - usort($this->data['ordered_items'], array(&$this, 'sort_items'));
3020 - $items = $this->data['ordered_items'];
3024 - $items = $this->data['items'];
3027 - // Slice the data as desired
3030 - return array_slice($items, $start);
3034 - return array_slice($items, $start, $end);
3043 - function sort_items($a, $b)
3045 - return $a->get_date('U') <= $b->get_date('U');
3048 - function merge_items($urls, $start = 0, $end = 0, $limit = 0)
3050 - if (is_array($urls) && sizeof($urls) > 0)
3053 - foreach ($urls as $arg)
3055 - if (is_a($arg, 'SimplePie'))
3057 - $items = array_merge($items, $arg->get_items(0, $limit));
3061 - trigger_error('Arguments must be SimplePie objects', E_USER_WARNING);
3066 - foreach ($items as $item)
3068 - if (!$item->get_date('U'))
3077 - usort($items, array('SimplePie', 'sort_items'));
3082 - return array_slice($items, $start);
3086 - return array_slice($items, $start, $end);
3091 - trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING);
3097 -class SimplePie_Item
3100 - var $data = array();
3102 - function SimplePie_Item($feed, $data)
3104 - $this->feed = $feed;
3105 - $this->data = $data;
3108 - function __toString()
3110 - return md5(serialize($this->data));
3114 - * Remove items that link back to this before destroying this object
3116 - function __destruct()
3118 - unset($this->feed);
3121 - function get_item_tags($namespace, $tag)
3123 - if (isset($this->data['child'][$namespace][$tag]))
3125 - return $this->data['child'][$namespace][$tag];
3133 - function get_base($element = array())
3135 - return $this->feed->get_base($element);
3138 - function sanitize($data, $type, $base = '')
3140 - return $this->feed->sanitize($data, $type, $base);
3143 - function get_feed()
3145 - return $this->feed;
3148 - function get_id($hash = false)
3152 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id'))
3154 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3156 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id'))
3158 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3160 - elseif ($return = $this->get_item_tags('', 'guid'))
3162 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3164 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier'))
3166 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3168 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier'))
3170 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3172 - elseif (($return = $this->get_permalink()) !== null)
3176 - elseif (($return = $this->get_title()) !== null)
3181 - if ($this->get_permalink() !== null || $this->get_title() !== null)
3183 - return md5($this->get_permalink() . $this->get_title());
3187 - return md5(serialize($this->data));
3191 - function get_title()
3193 - if (!isset($this->data['title']))
3195 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
3197 - $this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3199 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
3201 - $this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3203 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
3205 - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
3207 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
3209 - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
3211 - elseif ($return = $this->get_item_tags('', 'title'))
3213 - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
3215 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
3217 - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3219 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
3221 - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3225 - $this->data['title'] = null;
3228 - return $this->data['title'];
3231 - function get_description($description_only = false)
3233 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary'))
3235 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3237 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary'))
3239 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3241 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
3243 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
3245 - elseif ($return = $this->get_item_tags('', 'description'))
3247 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
3249 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
3251 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3253 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
3255 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3257 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
3259 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
3261 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
3263 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3265 - elseif (!$description_only)
3267 - return $this->get_content(true);
3275 - function get_content($content_only = false)
3277 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content'))
3279 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_content_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3281 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content'))
3283 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3285 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded'))
3287 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
3289 - elseif (!$content_only)
3291 - return $this->get_description(true);
3299 - function get_category($key = 0)
3301 - $categories = $this->get_categories();
3302 - if (isset($categories[$key]))
3304 - return $categories[$key];
3312 - function get_categories()
3314 - $categories = array();
3316 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
3321 - if (isset($category['attribs']['']['term']))
3323 - $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
3325 - if (isset($category['attribs']['']['scheme']))
3327 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
3329 - if (isset($category['attribs']['']['label']))
3331 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
3333 - $categories[] = new $this->feed->category_class($term, $scheme, $label);
3335 - foreach ((array) $this->get_item_tags('', 'category') as $category)
3337 - $categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
3339 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
3341 - $categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
3343 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
3345 - $categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
3348 - if (!empty($categories))
3350 - return SimplePie_Misc::array_unique($categories);
3358 - function get_author($key = 0)
3360 - $authors = $this->get_authors();
3361 - if (isset($authors[$key]))
3363 - return $authors[$key];
3371 - function get_contributor($key = 0)
3373 - $contributors = $this->get_contributors();
3374 - if (isset($contributors[$key]))
3376 - return $contributors[$key];
3384 - function get_contributors()
3386 - $contributors = array();
3387 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
3392 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
3394 - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3396 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
3398 - $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
3400 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
3402 - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3404 - if ($name !== null || $email !== null || $uri !== null)
3406 - $contributors[] = new $this->feed->author_class($name, $uri, $email);
3409 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
3414 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
3416 - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3418 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
3420 - $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
3422 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
3424 - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3426 - if ($name !== null || $email !== null || $url !== null)
3428 - $contributors[] = new $this->feed->author_class($name, $url, $email);
3432 - if (!empty($contributors))
3434 - return SimplePie_Misc::array_unique($contributors);
3443 - * @todo Atom inheritance (item author, source author, feed author)
3445 - function get_authors()
3447 - $authors = array();
3448 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
3453 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
3455 - $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3457 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
3459 - $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
3461 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
3463 - $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3465 - if ($name !== null || $email !== null || $uri !== null)
3467 - $authors[] = new $this->feed->author_class($name, $uri, $email);
3470 - if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
3475 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
3477 - $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3479 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
3481 - $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
3483 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
3485 - $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3487 - if ($name !== null || $email !== null || $url !== null)
3489 - $authors[] = new $this->feed->author_class($name, $url, $email);
3492 - if ($author = $this->get_item_tags('', 'author'))
3494 - $authors[] = new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
3496 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
3498 - $authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
3500 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
3502 - $authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
3504 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
3506 - $authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
3509 - if (!empty($authors))
3511 - return SimplePie_Misc::array_unique($authors);
3513 - elseif (($source = $this->get_source()) && ($authors = $source->get_authors()))
3517 - elseif ($authors = $this->feed->get_authors())
3527 - function get_copyright()
3529 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
3531 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3533 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
3535 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3537 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
3539 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3547 - function get_date($date_format = 'j F Y, g:i a')
3549 - if (!isset($this->data['date']))
3551 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published'))
3553 - $this->data['date']['raw'] = $return[0]['data'];
3555 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
3557 - $this->data['date']['raw'] = $return[0]['data'];
3559 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued'))
3561 - $this->data['date']['raw'] = $return[0]['data'];
3563 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created'))
3565 - $this->data['date']['raw'] = $return[0]['data'];
3567 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified'))
3569 - $this->data['date']['raw'] = $return[0]['data'];
3571 - elseif ($return = $this->get_item_tags('', 'pubDate'))
3573 - $this->data['date']['raw'] = $return[0]['data'];
3575 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date'))
3577 - $this->data['date']['raw'] = $return[0]['data'];
3579 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date'))
3581 - $this->data['date']['raw'] = $return[0]['data'];
3584 - if (!empty($this->data['date']['raw']))
3586 - $parser = SimplePie_Parse_Date::get();
3587 - $this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']);
3591 - $this->data['date'] = null;
3594 - if ($this->data['date'])
3596 - $date_format = (string) $date_format;
3597 - switch ($date_format)
3600 - return $this->sanitize($this->data['date']['raw'], SIMPLEPIE_CONSTRUCT_TEXT);
3603 - return $this->data['date']['parsed'];
3606 - return date($date_format, $this->data['date']['parsed']);
3615 - function get_local_date($date_format = '%c')
3617 - if (!$date_format)
3619 - return $this->sanitize($this->get_date(''), SIMPLEPIE_CONSTRUCT_TEXT);
3621 - elseif (($date = $this->get_date('U')) !== null)
3623 - return strftime($date_format, $date);
3631 - function get_permalink()
3633 - $link = $this->get_link();
3634 - $enclosure = $this->get_enclosure(0);
3635 - if ($link !== null)
3639 - elseif ($enclosure !== null)
3641 - return $enclosure->get_link();
3649 - function get_link($key = 0, $rel = 'alternate')
3651 - $links = $this->get_links($rel);
3652 - if ($links[$key] !== null)
3654 - return $links[$key];
3662 - function get_links($rel = 'alternate')
3664 - if (!isset($this->data['links']))
3666 - $this->data['links'] = array();
3667 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
3669 - if (isset($link['attribs']['']['href']))
3671 - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
3672 - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
3676 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link)
3678 - if (isset($link['attribs']['']['href']))
3680 - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
3681 - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
3684 - if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
3686 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
3688 - if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
3690 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
3692 - if ($links = $this->get_item_tags('', 'link'))
3694 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
3696 - if ($links = $this->get_item_tags('', 'guid'))
3698 - if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) == 'true')
3700 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
3704 - $keys = array_keys($this->data['links']);
3705 - foreach ($keys as $key)
3707 - if (SimplePie_Misc::is_isegment_nz_nc($key))
3709 - if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
3711 - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
3712 - $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
3716 - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
3719 - elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
3721 - $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
3723 - $this->data['links'][$key] = array_unique($this->data['links'][$key]);
3726 - if (isset($this->data['links'][$rel]))
3728 - return $this->data['links'][$rel];
3737 - * @todo Add ability to prefer one type of content over another (in a media group).
3739 - function get_enclosure($key = 0, $prefer = null)
3741 - $enclosures = $this->get_enclosures();
3742 - if (isset($enclosures[$key]))
3744 - return $enclosures[$key];
3753 - * Grabs all available enclosures (podcasts, etc.)
3755 - * Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS.
3757 - * At this point, we're pretty much assuming that all enclosures for an item are the same content. Anything else is too complicated to properly support.
3759 - * @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4).
3760 - * @todo If an element exists at a level, but it's value is empty, we should fall back to the value from the parent (if it exists).
3762 - function get_enclosures()
3764 - if (!isset($this->data['enclosures']))
3766 - $this->data['enclosures'] = array();
3769 - $captions_parent = null;
3770 - $categories_parent = null;
3771 - $copyrights_parent = null;
3772 - $credits_parent = null;
3773 - $description_parent = null;
3774 - $duration_parent = null;
3775 - $hashes_parent = null;
3776 - $keywords_parent = null;
3777 - $player_parent = null;
3778 - $ratings_parent = null;
3779 - $restrictions_parent = null;
3780 - $thumbnails_parent = null;
3781 - $title_parent = null;
3783 - // Let's do the channel and item-level ones first, and just re-use them if we need to.
3784 - $parent = $this->get_feed();
3787 - if ($captions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
3789 - foreach ($captions as $caption)
3791 - $caption_type = null;
3792 - $caption_lang = null;
3793 - $caption_startTime = null;
3794 - $caption_endTime = null;
3795 - $caption_text = null;
3796 - if (isset($caption['attribs']['']['type']))
3798 - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
3800 - if (isset($caption['attribs']['']['lang']))
3802 - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
3804 - if (isset($caption['attribs']['']['start']))
3806 - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
3808 - if (isset($caption['attribs']['']['end']))
3810 - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
3812 - if (isset($caption['data']))
3814 - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3816 - $captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
3819 - elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
3821 - foreach ($captions as $caption)
3823 - $caption_type = null;
3824 - $caption_lang = null;
3825 - $caption_startTime = null;
3826 - $caption_endTime = null;
3827 - $caption_text = null;
3828 - if (isset($caption['attribs']['']['type']))
3830 - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
3832 - if (isset($caption['attribs']['']['lang']))
3834 - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
3836 - if (isset($caption['attribs']['']['start']))
3838 - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
3840 - if (isset($caption['attribs']['']['end']))
3842 - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
3844 - if (isset($caption['data']))
3846 - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3848 - $captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
3851 - if (is_array($captions_parent))
3853 - $captions_parent = array_values(SimplePie_Misc::array_unique($captions_parent));
3857 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category)
3862 - if (isset($category['data']))
3864 - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3866 - if (isset($category['attribs']['']['scheme']))
3868 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
3872 - $scheme = 'http://search.yahoo.com/mrss/category_schema';
3874 - if (isset($category['attribs']['']['label']))
3876 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
3878 - $categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
3880 - foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category)
3885 - if (isset($category['data']))
3887 - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3889 - if (isset($category['attribs']['']['scheme']))
3891 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
3895 - $scheme = 'http://search.yahoo.com/mrss/category_schema';
3897 - if (isset($category['attribs']['']['label']))
3899 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
3901 - $categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
3903 - foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'category') as $category)
3906 - $scheme = 'http://www.itunes.com/dtds/podcast-1.0.dtd';
3908 - if (isset($category['attribs']['']['text']))
3910 - $label = $this->sanitize($category['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT);
3912 - $categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
3914 - if (isset($category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category']))
3916 - foreach ((array) $category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category'] as $subcategory)
3918 - if (isset($subcategory['attribs']['']['text']))
3920 - $label = $this->sanitize($subcategory['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT);
3922 - $categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
3926 - if (is_array($categories_parent))
3928 - $categories_parent = array_values(SimplePie_Misc::array_unique($categories_parent));
3932 - if ($copyright = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
3934 - $copyright_url = null;
3935 - $copyright_label = null;
3936 - if (isset($copyright[0]['attribs']['']['url']))
3938 - $copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
3940 - if (isset($copyright[0]['data']))
3942 - $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3944 - $copyrights_parent = new $this->feed->copyright_class($copyright_url, $copyright_label);
3946 - elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
3948 - $copyright_url = null;
3949 - $copyright_label = null;
3950 - if (isset($copyright[0]['attribs']['']['url']))
3952 - $copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
3954 - if (isset($copyright[0]['data']))
3956 - $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3958 - $copyrights_parent = new $this->feed->copyright_class($copyright_url, $copyright_label);
3962 - if ($credits = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
3964 - foreach ($credits as $credit)
3966 - $credit_role = null;
3967 - $credit_scheme = null;
3968 - $credit_name = null;
3969 - if (isset($credit['attribs']['']['role']))
3971 - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
3973 - if (isset($credit['attribs']['']['scheme']))
3975 - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
3979 - $credit_scheme = 'urn:ebu';
3981 - if (isset($credit['data']))
3983 - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3985 - $credits_parent[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
3988 - elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
3990 - foreach ($credits as $credit)
3992 - $credit_role = null;
3993 - $credit_scheme = null;
3994 - $credit_name = null;
3995 - if (isset($credit['attribs']['']['role']))
3997 - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
3999 - if (isset($credit['attribs']['']['scheme']))
4001 - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4005 - $credit_scheme = 'urn:ebu';
4007 - if (isset($credit['data']))
4009 - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4011 - $credits_parent[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
4014 - if (is_array($credits_parent))
4016 - $credits_parent = array_values(SimplePie_Misc::array_unique($credits_parent));
4020 - if ($description_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description'))
4022 - if (isset($description_parent[0]['data']))
4024 - $description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4027 - elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description'))
4029 - if (isset($description_parent[0]['data']))
4031 - $description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4036 - if ($duration_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'duration'))
4041 - if (isset($duration_parent[0]['data']))
4043 - $temp = explode(':', $this->sanitize($duration_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4044 - if (sizeof($temp) > 0)
4046 - (int) $seconds = array_pop($temp);
4048 - if (sizeof($temp) > 0)
4050 - (int) $minutes = array_pop($temp);
4051 - $seconds += $minutes * 60;
4053 - if (sizeof($temp) > 0)
4055 - (int) $hours = array_pop($temp);
4056 - $seconds += $hours * 3600;
4059 - $duration_parent = $seconds;
4064 - if ($hashes_iterator = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash'))
4066 - foreach ($hashes_iterator as $hash)
4070 - if (isset($hash['data']))
4072 - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4074 - if (isset($hash['attribs']['']['algo']))
4076 - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
4082 - $hashes_parent[] = $algo.':'.$value;
4085 - elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash'))
4087 - foreach ($hashes_iterator as $hash)
4091 - if (isset($hash['data']))
4093 - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4095 - if (isset($hash['attribs']['']['algo']))
4097 - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
4103 - $hashes_parent[] = $algo.':'.$value;
4106 - if (is_array($hashes_parent))
4108 - $hashes_parent = array_values(SimplePie_Misc::array_unique($hashes_parent));
4112 - if ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords'))
4114 - if (isset($keywords[0]['data']))
4116 - $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4117 - foreach ($temp as $word)
4119 - $keywords_parent[] = trim($word);
4124 - elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
4126 - if (isset($keywords[0]['data']))
4128 - $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4129 - foreach ($temp as $word)
4131 - $keywords_parent[] = trim($word);
4136 - elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords'))
4138 - if (isset($keywords[0]['data']))
4140 - $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4141 - foreach ($temp as $word)
4143 - $keywords_parent[] = trim($word);
4148 - elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
4150 - if (isset($keywords[0]['data']))
4152 - $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4153 - foreach ($temp as $word)
4155 - $keywords_parent[] = trim($word);
4160 - if (is_array($keywords_parent))
4162 - $keywords_parent = array_values(SimplePie_Misc::array_unique($keywords_parent));
4166 - if ($player_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player'))
4168 - if (isset($player_parent[0]['attribs']['']['url']))
4170 - $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4173 - elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player'))
4175 - if (isset($player_parent[0]['attribs']['']['url']))
4177 - $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4182 - if ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating'))
4184 - foreach ($ratings as $rating)
4186 - $rating_scheme = null;
4187 - $rating_value = null;
4188 - if (isset($rating['attribs']['']['scheme']))
4190 - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4194 - $rating_scheme = 'urn:simple';
4196 - if (isset($rating['data']))
4198 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4200 - $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
4203 - elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
4205 - foreach ($ratings as $rating)
4207 - $rating_scheme = 'urn:itunes';
4208 - $rating_value = null;
4209 - if (isset($rating['data']))
4211 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4213 - $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
4216 - elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating'))
4218 - foreach ($ratings as $rating)
4220 - $rating_scheme = null;
4221 - $rating_value = null;
4222 - if (isset($rating['attribs']['']['scheme']))
4224 - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4228 - $rating_scheme = 'urn:simple';
4230 - if (isset($rating['data']))
4232 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4234 - $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
4237 - elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
4239 - foreach ($ratings as $rating)
4241 - $rating_scheme = 'urn:itunes';
4242 - $rating_value = null;
4243 - if (isset($rating['data']))
4245 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4247 - $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
4250 - if (is_array($ratings_parent))
4252 - $ratings_parent = array_values(SimplePie_Misc::array_unique($ratings_parent));
4256 - if ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction'))
4258 - foreach ($restrictions as $restriction)
4260 - $restriction_relationship = null;
4261 - $restriction_type = null;
4262 - $restriction_value = null;
4263 - if (isset($restriction['attribs']['']['relationship']))
4265 - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
4267 - if (isset($restriction['attribs']['']['type']))
4269 - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4271 - if (isset($restriction['data']))
4273 - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4275 - $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4278 - elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
4280 - foreach ($restrictions as $restriction)
4282 - $restriction_relationship = 'allow';
4283 - $restriction_type = null;
4284 - $restriction_value = 'itunes';
4285 - if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
4287 - $restriction_relationship = 'deny';
4289 - $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4292 - elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction'))
4294 - foreach ($restrictions as $restriction)
4296 - $restriction_relationship = null;
4297 - $restriction_type = null;
4298 - $restriction_value = null;
4299 - if (isset($restriction['attribs']['']['relationship']))
4301 - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
4303 - if (isset($restriction['attribs']['']['type']))
4305 - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4307 - if (isset($restriction['data']))
4309 - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4311 - $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4314 - elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
4316 - foreach ($restrictions as $restriction)
4318 - $restriction_relationship = 'allow';
4319 - $restriction_type = null;
4320 - $restriction_value = 'itunes';
4321 - if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
4323 - $restriction_relationship = 'deny';
4325 - $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4328 - if (is_array($restrictions_parent))
4330 - $restrictions_parent = array_values(SimplePie_Misc::array_unique($restrictions_parent));
4334 - if ($thumbnails = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail'))
4336 - foreach ($thumbnails as $thumbnail)
4338 - if (isset($thumbnail['attribs']['']['url']))
4340 - $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4344 - elseif ($thumbnails = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail'))
4346 - foreach ($thumbnails as $thumbnail)
4348 - if (isset($thumbnail['attribs']['']['url']))
4350 - $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4356 - if ($title_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title'))
4358 - if (isset($title_parent[0]['data']))
4360 - $title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4363 - elseif ($title_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title'))
4365 - if (isset($title_parent[0]['data']))
4367 - $title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4371 - // Clear the memory
4378 - $expression = null;
4379 - $framerate = null;
4381 - $javascript = null;
4385 - $samplingrate = null;
4392 - $categories = null;
4393 - $copyrights = null;
4395 - $description = null;
4400 - $restrictions = null;
4401 - $thumbnails = null;
4404 - // If we have media:group tags, loop through them.
4405 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group') as $group)
4407 - // If we have media:content tags, loop through them.
4408 - foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content)
4410 - if (isset($content['attribs']['']['url']))
4416 - $expression = null;
4417 - $framerate = null;
4419 - $javascript = null;
4423 - $samplingrate = null;
4430 - $categories = null;
4431 - $copyrights = null;
4433 - $description = null;
4438 - $restrictions = null;
4439 - $thumbnails = null;
4442 - // Start checking the attributes of media:content
4443 - if (isset($content['attribs']['']['bitrate']))
4445 - $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT);
4447 - if (isset($content['attribs']['']['channels']))
4449 - $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT);
4451 - if (isset($content['attribs']['']['duration']))
4453 - $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT);
4457 - $duration = $duration_parent;
4459 - if (isset($content['attribs']['']['expression']))
4461 - $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT);
4463 - if (isset($content['attribs']['']['framerate']))
4465 - $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT);
4467 - if (isset($content['attribs']['']['height']))
4469 - $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT);
4471 - if (isset($content['attribs']['']['lang']))
4473 - $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
4475 - if (isset($content['attribs']['']['fileSize']))
4477 - $length = ceil($content['attribs']['']['fileSize']);
4479 - if (isset($content['attribs']['']['medium']))
4481 - $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT);
4483 - if (isset($content['attribs']['']['samplingrate']))
4485 - $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT);
4487 - if (isset($content['attribs']['']['type']))
4489 - $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4491 - if (isset($content['attribs']['']['width']))
4493 - $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT);
4495 - $url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4497 - // Checking the other optional media: elements. Priority: media:content, media:group, item, channel
4500 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
4502 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
4504 - $caption_type = null;
4505 - $caption_lang = null;
4506 - $caption_startTime = null;
4507 - $caption_endTime = null;
4508 - $caption_text = null;
4509 - if (isset($caption['attribs']['']['type']))
4511 - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4513 - if (isset($caption['attribs']['']['lang']))
4515 - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
4517 - if (isset($caption['attribs']['']['start']))
4519 - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
4521 - if (isset($caption['attribs']['']['end']))
4523 - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
4525 - if (isset($caption['data']))
4527 - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4529 - $captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
4531 - if (is_array($captions))
4533 - $captions = array_values(SimplePie_Misc::array_unique($captions));
4536 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
4538 - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
4540 - $caption_type = null;
4541 - $caption_lang = null;
4542 - $caption_startTime = null;
4543 - $caption_endTime = null;
4544 - $caption_text = null;
4545 - if (isset($caption['attribs']['']['type']))
4547 - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4549 - if (isset($caption['attribs']['']['lang']))
4551 - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
4553 - if (isset($caption['attribs']['']['start']))
4555 - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
4557 - if (isset($caption['attribs']['']['end']))
4559 - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
4561 - if (isset($caption['data']))
4563 - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4565 - $captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
4567 - if (is_array($captions))
4569 - $captions = array_values(SimplePie_Misc::array_unique($captions));
4574 - $captions = $captions_parent;
4578 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
4580 - foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
4585 - if (isset($category['data']))
4587 - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4589 - if (isset($category['attribs']['']['scheme']))
4591 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4595 - $scheme = 'http://search.yahoo.com/mrss/category_schema';
4597 - if (isset($category['attribs']['']['label']))
4599 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
4601 - $categories[] = new $this->feed->category_class($term, $scheme, $label);
4604 - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
4606 - foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
4611 - if (isset($category['data']))
4613 - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4615 - if (isset($category['attribs']['']['scheme']))
4617 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4621 - $scheme = 'http://search.yahoo.com/mrss/category_schema';
4623 - if (isset($category['attribs']['']['label']))
4625 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
4627 - $categories[] = new $this->feed->category_class($term, $scheme, $label);
4630 - if (is_array($categories) && is_array($categories_parent))
4632 - $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent)));
4634 - elseif (is_array($categories))
4636 - $categories = array_values(SimplePie_Misc::array_unique($categories));
4638 - elseif (is_array($categories_parent))
4640 - $categories = array_values(SimplePie_Misc::array_unique($categories_parent));
4644 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
4646 - $copyright_url = null;
4647 - $copyright_label = null;
4648 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url']))
4650 - $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
4652 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
4654 - $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4656 - $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
4658 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
4660 - $copyright_url = null;
4661 - $copyright_label = null;
4662 - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url']))
4664 - $copyright_url = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
4666 - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
4668 - $copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4670 - $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
4674 - $copyrights = $copyrights_parent;
4678 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
4680 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
4682 - $credit_role = null;
4683 - $credit_scheme = null;
4684 - $credit_name = null;
4685 - if (isset($credit['attribs']['']['role']))
4687 - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
4689 - if (isset($credit['attribs']['']['scheme']))
4691 - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4695 - $credit_scheme = 'urn:ebu';
4697 - if (isset($credit['data']))
4699 - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4701 - $credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
4703 - if (is_array($credits))
4705 - $credits = array_values(SimplePie_Misc::array_unique($credits));
4708 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
4710 - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
4712 - $credit_role = null;
4713 - $credit_scheme = null;
4714 - $credit_name = null;
4715 - if (isset($credit['attribs']['']['role']))
4717 - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
4719 - if (isset($credit['attribs']['']['scheme']))
4721 - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4725 - $credit_scheme = 'urn:ebu';
4727 - if (isset($credit['data']))
4729 - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4731 - $credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
4733 - if (is_array($credits))
4735 - $credits = array_values(SimplePie_Misc::array_unique($credits));
4740 - $credits = $credits_parent;
4744 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
4746 - $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4748 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
4750 - $description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4754 - $description = $description_parent;
4758 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
4760 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
4764 - if (isset($hash['data']))
4766 - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4768 - if (isset($hash['attribs']['']['algo']))
4770 - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
4776 - $hashes[] = $algo.':'.$value;
4778 - if (is_array($hashes))
4780 - $hashes = array_values(SimplePie_Misc::array_unique($hashes));
4783 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
4785 - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
4789 - if (isset($hash['data']))
4791 - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4793 - if (isset($hash['attribs']['']['algo']))
4795 - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
4801 - $hashes[] = $algo.':'.$value;
4803 - if (is_array($hashes))
4805 - $hashes = array_values(SimplePie_Misc::array_unique($hashes));
4810 - $hashes = $hashes_parent;
4814 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
4816 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
4818 - $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4819 - foreach ($temp as $word)
4821 - $keywords[] = trim($word);
4825 - if (is_array($keywords))
4827 - $keywords = array_values(SimplePie_Misc::array_unique($keywords));
4830 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
4832 - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
4834 - $temp = explode(',', $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4835 - foreach ($temp as $word)
4837 - $keywords[] = trim($word);
4841 - if (is_array($keywords))
4843 - $keywords = array_values(SimplePie_Misc::array_unique($keywords));
4848 - $keywords = $keywords_parent;
4852 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
4854 - $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4856 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
4858 - $player = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4862 - $player = $player_parent;
4866 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
4868 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
4870 - $rating_scheme = null;
4871 - $rating_value = null;
4872 - if (isset($rating['attribs']['']['scheme']))
4874 - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4878 - $rating_scheme = 'urn:simple';
4880 - if (isset($rating['data']))
4882 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4884 - $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
4886 - if (is_array($ratings))
4888 - $ratings = array_values(SimplePie_Misc::array_unique($ratings));
4891 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
4893 - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
4895 - $rating_scheme = null;
4896 - $rating_value = null;
4897 - if (isset($rating['attribs']['']['scheme']))
4899 - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4903 - $rating_scheme = 'urn:simple';
4905 - if (isset($rating['data']))
4907 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4909 - $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
4911 - if (is_array($ratings))
4913 - $ratings = array_values(SimplePie_Misc::array_unique($ratings));
4918 - $ratings = $ratings_parent;
4922 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
4924 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
4926 - $restriction_relationship = null;
4927 - $restriction_type = null;
4928 - $restriction_value = null;
4929 - if (isset($restriction['attribs']['']['relationship']))
4931 - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
4933 - if (isset($restriction['attribs']['']['type']))
4935 - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4937 - if (isset($restriction['data']))
4939 - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4941 - $restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4943 - if (is_array($restrictions))
4945 - $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
4948 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
4950 - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
4952 - $restriction_relationship = null;
4953 - $restriction_type = null;
4954 - $restriction_value = null;
4955 - if (isset($restriction['attribs']['']['relationship']))
4957 - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
4959 - if (isset($restriction['attribs']['']['type']))
4961 - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4963 - if (isset($restriction['data']))
4965 - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4967 - $restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4969 - if (is_array($restrictions))
4971 - $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
4976 - $restrictions = $restrictions_parent;
4980 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
4982 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
4984 - $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4986 - if (is_array($thumbnails))
4988 - $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
4991 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
4993 - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
4995 - $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4997 - if (is_array($thumbnails))
4999 - $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
5004 - $thumbnails = $thumbnails_parent;
5008 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
5010 - $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5012 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
5014 - $title = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5018 - $title = $title_parent;
5021 - $this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
5026 - // If we have standalone media:content tags, loop through them.
5027 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content']))
5029 - foreach ((array) $this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content)
5031 - if (isset($content['attribs']['']['url']))
5037 - $expression = null;
5038 - $framerate = null;
5040 - $javascript = null;
5044 - $samplingrate = null;
5051 - $categories = null;
5052 - $copyrights = null;
5054 - $description = null;
5059 - $restrictions = null;
5060 - $thumbnails = null;
5063 - // Start checking the attributes of media:content
5064 - if (isset($content['attribs']['']['bitrate']))
5066 - $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT);
5068 - if (isset($content['attribs']['']['channels']))
5070 - $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT);
5072 - if (isset($content['attribs']['']['duration']))
5074 - $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT);
5078 - $duration = $duration_parent;
5080 - if (isset($content['attribs']['']['expression']))
5082 - $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT);
5084 - if (isset($content['attribs']['']['framerate']))
5086 - $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT);
5088 - if (isset($content['attribs']['']['height']))
5090 - $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT);
5092 - if (isset($content['attribs']['']['lang']))
5094 - $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
5096 - if (isset($content['attribs']['']['fileSize']))
5098 - $length = ceil($content['attribs']['']['fileSize']);
5100 - if (isset($content['attribs']['']['medium']))
5102 - $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT);
5104 - if (isset($content['attribs']['']['samplingrate']))
5106 - $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT);
5108 - if (isset($content['attribs']['']['type']))
5110 - $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
5112 - if (isset($content['attribs']['']['width']))
5114 - $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT);
5116 - $url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
5118 - // Checking the other optional media: elements. Priority: media:content, media:group, item, channel
5121 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
5123 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
5125 - $caption_type = null;
5126 - $caption_lang = null;
5127 - $caption_startTime = null;
5128 - $caption_endTime = null;
5129 - $caption_text = null;
5130 - if (isset($caption['attribs']['']['type']))
5132 - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
5134 - if (isset($caption['attribs']['']['lang']))
5136 - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
5138 - if (isset($caption['attribs']['']['start']))
5140 - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
5142 - if (isset($caption['attribs']['']['end']))
5144 - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
5146 - if (isset($caption['data']))
5148 - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5150 - $captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
5152 - if (is_array($captions))
5154 - $captions = array_values(SimplePie_Misc::array_unique($captions));
5159 - $captions = $captions_parent;
5163 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
5165 - foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
5170 - if (isset($category['data']))
5172 - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5174 - if (isset($category['attribs']['']['scheme']))
5176 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
5180 - $scheme = 'http://search.yahoo.com/mrss/category_schema';
5182 - if (isset($category['attribs']['']['label']))
5184 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
5186 - $categories[] = new $this->feed->category_class($term, $scheme, $label);
5189 - if (is_array($categories) && is_array($categories_parent))
5191 - $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent)));
5193 - elseif (is_array($categories))
5195 - $categories = array_values(SimplePie_Misc::array_unique($categories));
5197 - elseif (is_array($categories_parent))
5199 - $categories = array_values(SimplePie_Misc::array_unique($categories_parent));
5203 - $categories = null;
5207 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
5209 - $copyright_url = null;
5210 - $copyright_label = null;
5211 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url']))
5213 - $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
5215 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
5217 - $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5219 - $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
5223 - $copyrights = $copyrights_parent;
5227 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
5229 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
5231 - $credit_role = null;
5232 - $credit_scheme = null;
5233 - $credit_name = null;
5234 - if (isset($credit['attribs']['']['role']))
5236 - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
5238 - if (isset($credit['attribs']['']['scheme']))
5240 - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
5244 - $credit_scheme = 'urn:ebu';
5246 - if (isset($credit['data']))
5248 - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5250 - $credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
5252 - if (is_array($credits))
5254 - $credits = array_values(SimplePie_Misc::array_unique($credits));
5259 - $credits = $credits_parent;
5263 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
5265 - $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5269 - $description = $description_parent;
5273 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
5275 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
5279 - if (isset($hash['data']))
5281 - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5283 - if (isset($hash['attribs']['']['algo']))
5285 - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
5291 - $hashes[] = $algo.':'.$value;
5293 - if (is_array($hashes))
5295 - $hashes = array_values(SimplePie_Misc::array_unique($hashes));
5300 - $hashes = $hashes_parent;
5304 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
5306 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
5308 - $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
5309 - foreach ($temp as $word)
5311 - $keywords[] = trim($word);
5315 - if (is_array($keywords))
5317 - $keywords = array_values(SimplePie_Misc::array_unique($keywords));
5322 - $keywords = $keywords_parent;
5326 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
5328 - $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
5332 - $player = $player_parent;
5336 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
5338 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
5340 - $rating_scheme = null;
5341 - $rating_value = null;
5342 - if (isset($rating['attribs']['']['scheme']))
5344 - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
5348 - $rating_scheme = 'urn:simple';
5350 - if (isset($rating['data']))
5352 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5354 - $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
5356 - if (is_array($ratings))
5358 - $ratings = array_values(SimplePie_Misc::array_unique($ratings));
5363 - $ratings = $ratings_parent;
5367 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
5369 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
5371 - $restriction_relationship = null;
5372 - $restriction_type = null;
5373 - $restriction_value = null;
5374 - if (isset($restriction['attribs']['']['relationship']))
5376 - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
5378 - if (isset($restriction['attribs']['']['type']))
5380 - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
5382 - if (isset($restriction['data']))
5384 - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5386 - $restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
5388 - if (is_array($restrictions))
5390 - $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
5395 - $restrictions = $restrictions_parent;
5399 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
5401 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
5403 - $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
5405 - if (is_array($thumbnails))
5407 - $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
5412 - $thumbnails = $thumbnails_parent;
5416 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
5418 - $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5422 - $title = $title_parent;
5425 - $this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
5430 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
5432 - if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
5438 - $expression = null;
5439 - $framerate = null;
5441 - $javascript = null;
5445 - $samplingrate = null;
5450 - $url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
5451 - if (isset($link['attribs']['']['type']))
5453 - $type = $this->sanitize($link['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
5455 - if (isset($link['attribs']['']['length']))
5457 - $length = ceil($link['attribs']['']['length']);
5460 - // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
5461 - $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);
5465 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link)
5467 - if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
5473 - $expression = null;
5474 - $framerate = null;
5476 - $javascript = null;
5480 - $samplingrate = null;
5485 - $url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
5486 - if (isset($link['attribs']['']['type']))
5488 - $type = $this->sanitize($link['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
5490 - if (isset($link['attribs']['']['length']))
5492 - $length = ceil($link['attribs']['']['length']);
5495 - // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
5496 - $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);
5500 - if ($enclosure = $this->get_item_tags('', 'enclosure'))
5502 - if (isset($enclosure[0]['attribs']['']['url']))
5508 - $expression = null;
5509 - $framerate = null;
5511 - $javascript = null;
5515 - $samplingrate = null;
5520 - $url = $this->sanitize($enclosure[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($enclosure[0]));
5521 - if (isset($enclosure[0]['attribs']['']['type']))
5523 - $type = $this->sanitize($enclosure[0]['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
5525 - if (isset($enclosure[0]['attribs']['']['length']))
5527 - $length = ceil($enclosure[0]['attribs']['']['length']);
5530 - // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
5531 - $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);
5535 - 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))
5537 - // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
5538 - $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);
5541 - $this->data['enclosures'] = array_values(SimplePie_Misc::array_unique($this->data['enclosures']));
5543 - if (!empty($this->data['enclosures']))
5545 - return $this->data['enclosures'];
5553 - function get_latitude()
5555 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
5557 - return (float) $return[0]['data'];
5559 - elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
5561 - return (float) $match[1];
5569 - function get_longitude()
5571 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
5573 - return (float) $return[0]['data'];
5575 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
5577 - return (float) $return[0]['data'];
5579 - elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
5581 - return (float) $match[2];
5589 - function get_source()
5591 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source'))
5593 - return new $this->feed->source_class($this, $return[0]);
5602 - * Creates the add_to_* methods' return data
5605 - * @param string $item_url String to prefix to the item permalink
5606 - * @param string $title_url String to prefix to the item title
5607 - * (and suffix to the item permalink)
5608 - * @return mixed URL if feed exists, false otherwise
5610 - function add_to_service($item_url, $title_url = null, $summary_url = null)
5612 - if ($this->get_permalink() !== null)
5614 - $return = $this->sanitize($item_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_permalink());
5615 - if ($title_url !== null && $this->get_title() !== null)
5617 - $return .= $this->sanitize($title_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_title());
5619 - if ($summary_url !== null && $this->get_description() !== null)
5621 - $return .= $this->sanitize($summary_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_description());
5631 - function add_to_blinklist()
5633 - return $this->add_to_service('http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url=', '&Title=');
5636 - function add_to_blogmarks()
5638 - return $this->add_to_service('http://blogmarks.net/my/new.php?mini=1&simple=1&url=', '&title=');
5641 - function add_to_delicious()
5643 - return $this->add_to_service('http://del.icio.us/post/?v=4&url=', '&title=');
5646 - function add_to_digg()
5648 - return $this->add_to_service('http://digg.com/submit?url=', '&title=', '&bodytext=');
5651 - function add_to_furl()
5653 - return $this->add_to_service('http://www.furl.net/storeIt.jsp?u=', '&t=');
5656 - function add_to_magnolia()
5658 - return $this->add_to_service('http://ma.gnolia.com/bookmarklet/add?url=', '&title=');
5661 - function add_to_myweb20()
5663 - return $this->add_to_service('http://myweb2.search.yahoo.com/myresults/bookmarklet?u=', '&t=');
5666 - function add_to_newsvine()
5668 - return $this->add_to_service('http://www.newsvine.com/_wine/save?u=', '&h=');
5671 - function add_to_reddit()
5673 - return $this->add_to_service('http://reddit.com/submit?url=', '&title=');
5676 - function add_to_segnalo()
5678 - return $this->add_to_service('http://segnalo.com/post.html.php?url=', '&title=');
5681 - function add_to_simpy()
5683 - return $this->add_to_service('http://www.simpy.com/simpy/LinkAdd.do?href=', '&title=');
5686 - function add_to_spurl()
5688 - return $this->add_to_service('http://www.spurl.net/spurl.php?v=3&url=', '&title=');
5691 - function add_to_wists()
5693 - return $this->add_to_service('http://wists.com/r.php?c=&r=', '&title=');
5696 - function search_technorati()
5698 - return $this->add_to_service('http://www.technorati.com/search/');
5702 -class SimplePie_Source
5705 - var $data = array();
5707 - function SimplePie_Source($item, $data)
5709 - $this->item = $item;
5710 - $this->data = $data;
5713 - function __toString()
5715 - return md5(serialize($this->data));
5719 - * Remove items that link back to this before destroying this object
5721 - function __destruct()
5723 - unset($this->item);
5726 - function get_source_tags($namespace, $tag)
5728 - if (isset($this->data['child'][$namespace][$tag]))
5730 - return $this->data['child'][$namespace][$tag];
5738 - function get_base($element = array())
5740 - return $this->item->get_base($element);
5743 - function sanitize($data, $type, $base = '')
5745 - return $this->item->sanitize($data, $type, $base);
5748 - function get_item()
5750 - return $this->item;
5753 - function get_title()
5755 - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
5757 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
5759 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
5761 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
5763 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
5765 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
5767 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
5769 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
5771 - elseif ($return = $this->get_source_tags('', 'title'))
5773 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
5775 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
5777 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5779 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
5781 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5789 - function get_category($key = 0)
5791 - $categories = $this->get_categories();
5792 - if (isset($categories[$key]))
5794 - return $categories[$key];
5802 - function get_categories()
5804 - $categories = array();
5806 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
5811 - if (isset($category['attribs']['']['term']))
5813 - $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
5815 - if (isset($category['attribs']['']['scheme']))
5817 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
5819 - if (isset($category['attribs']['']['label']))
5821 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
5823 - $categories[] = new $this->item->feed->category_class($term, $scheme, $label);
5825 - foreach ((array) $this->get_source_tags('', 'category') as $category)
5827 - $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
5829 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
5831 - $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
5833 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
5835 - $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
5838 - if (!empty($categories))
5840 - return SimplePie_Misc::array_unique($categories);
5848 - function get_author($key = 0)
5850 - $authors = $this->get_authors();
5851 - if (isset($authors[$key]))
5853 - return $authors[$key];
5861 - function get_authors()
5863 - $authors = array();
5864 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
5869 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
5871 - $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5873 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
5875 - $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
5877 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
5879 - $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5881 - if ($name !== null || $email !== null || $uri !== null)
5883 - $authors[] = new $this->item->feed->author_class($name, $uri, $email);
5886 - if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
5891 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
5893 - $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5895 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
5897 - $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
5899 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
5901 - $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5903 - if ($name !== null || $email !== null || $url !== null)
5905 - $authors[] = new $this->item->feed->author_class($name, $url, $email);
5908 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
5910 - $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
5912 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
5914 - $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
5916 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
5918 - $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
5921 - if (!empty($authors))
5923 - return SimplePie_Misc::array_unique($authors);
5931 - function get_contributor($key = 0)
5933 - $contributors = $this->get_contributors();
5934 - if (isset($contributors[$key]))
5936 - return $contributors[$key];
5944 - function get_contributors()
5946 - $contributors = array();
5947 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
5952 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
5954 - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5956 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
5958 - $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
5960 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
5962 - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5964 - if ($name !== null || $email !== null || $uri !== null)
5966 - $contributors[] = new $this->item->feed->author_class($name, $uri, $email);
5969 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
5974 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
5976 - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5978 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
5980 - $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
5982 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
5984 - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5986 - if ($name !== null || $email !== null || $url !== null)
5988 - $contributors[] = new $this->item->feed->author_class($name, $url, $email);
5992 - if (!empty($contributors))
5994 - return SimplePie_Misc::array_unique($contributors);
6002 - function get_link($key = 0, $rel = 'alternate')
6004 - $links = $this->get_links($rel);
6005 - if (isset($links[$key]))
6007 - return $links[$key];
6016 - * Added for parity between the parent-level and the item/entry-level.
6018 - function get_permalink()
6020 - return $this->get_link(0);
6023 - function get_links($rel = 'alternate')
6025 - if (!isset($this->data['links']))
6027 - $this->data['links'] = array();
6028 - if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
6030 - foreach ($links as $link)
6032 - if (isset($link['attribs']['']['href']))
6034 - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
6035 - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
6039 - if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
6041 - foreach ($links as $link)
6043 - if (isset($link['attribs']['']['href']))
6045 - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
6046 - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
6051 - if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
6053 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
6055 - if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
6057 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
6059 - if ($links = $this->get_source_tags('', 'link'))
6061 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
6064 - $keys = array_keys($this->data['links']);
6065 - foreach ($keys as $key)
6067 - if (SimplePie_Misc::is_isegment_nz_nc($key))
6069 - if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
6071 - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
6072 - $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
6076 - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
6079 - elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
6081 - $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
6083 - $this->data['links'][$key] = array_unique($this->data['links'][$key]);
6087 - if (isset($this->data['links'][$rel]))
6089 - return $this->data['links'][$rel];
6097 - function get_description()
6099 - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
6101 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
6103 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
6105 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
6107 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
6109 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
6111 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
6113 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
6115 - elseif ($return = $this->get_source_tags('', 'description'))
6117 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
6119 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
6121 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6123 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
6125 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6127 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
6129 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
6131 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
6133 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
6141 - function get_copyright()
6143 - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
6145 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
6147 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
6149 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
6151 - elseif ($return = $this->get_source_tags('', 'copyright'))
6153 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6155 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
6157 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6159 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
6161 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6169 - function get_language()
6171 - if ($return = $this->get_source_tags('', 'language'))
6173 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6175 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
6177 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6179 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
6181 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6183 - elseif (isset($this->data['xml_lang']))
6185 - return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
6193 - function get_latitude()
6195 - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
6197 - return (float) $return[0]['data'];
6199 - elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
6201 - return (float) $match[1];
6209 - function get_longitude()
6211 - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
6213 - return (float) $return[0]['data'];
6215 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
6217 - return (float) $return[0]['data'];
6219 - elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
6221 - return (float) $match[2];
6229 - function get_image_url()
6231 - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
6233 - return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
6235 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
6237 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
6239 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
6241 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
6250 -class SimplePie_Author
6256 - // Constructor, used to input the data
6257 - function SimplePie_Author($name = null, $link = null, $email = null)
6259 - $this->name = $name;
6260 - $this->link = $link;
6261 - $this->email = $email;
6264 - function __toString()
6266 - // There is no $this->data here
6267 - return md5(serialize($this));
6270 - function get_name()
6272 - if ($this->name !== null)
6274 - return $this->name;
6282 - function get_link()
6284 - if ($this->link !== null)
6286 - return $this->link;
6294 - function get_email()
6296 - if ($this->email !== null)
6298 - return $this->email;
6307 -class SimplePie_Category
6313 - // Constructor, used to input the data
6314 - function SimplePie_Category($term = null, $scheme = null, $label = null)
6316 - $this->term = $term;
6317 - $this->scheme = $scheme;
6318 - $this->label = $label;
6321 - function __toString()
6323 - // There is no $this->data here
6324 - return md5(serialize($this));
6327 - function get_term()
6329 - if ($this->term !== null)
6331 - return $this->term;
6339 - function get_scheme()
6341 - if ($this->scheme !== null)
6343 - return $this->scheme;
6351 - function get_label()
6353 - if ($this->label !== null)
6355 - return $this->label;
6359 - return $this->get_term();
6364 -class SimplePie_Enclosure
6387 - var $restrictions;
6388 - var $samplingrate;
6394 - // Constructor, used to input the data
6395 - function SimplePie_Enclosure($link = null, $type = null, $length = null, $javascript = null, $bitrate = null, $captions = null, $categories = null, $channels = null, $copyright = null, $credits = null, $description = null, $duration = null, $expression = null, $framerate = null, $hashes = null, $height = null, $keywords = null, $lang = null, $medium = null, $player = null, $ratings = null, $restrictions = null, $samplingrate = null, $thumbnails = null, $title = null, $width = null)
6397 - $this->bitrate = $bitrate;
6398 - $this->captions = $captions;
6399 - $this->categories = $categories;
6400 - $this->channels = $channels;
6401 - $this->copyright = $copyright;
6402 - $this->credits = $credits;
6403 - $this->description = $description;
6404 - $this->duration = $duration;
6405 - $this->expression = $expression;
6406 - $this->framerate = $framerate;
6407 - $this->hashes = $hashes;
6408 - $this->height = $height;
6409 - $this->javascript = $javascript;
6410 - $this->keywords = $keywords;
6411 - $this->lang = $lang;
6412 - $this->length = $length;
6413 - $this->link = $link;
6414 - $this->medium = $medium;
6415 - $this->player = $player;
6416 - $this->ratings = $ratings;
6417 - $this->restrictions = $restrictions;
6418 - $this->samplingrate = $samplingrate;
6419 - $this->thumbnails = $thumbnails;
6420 - $this->title = $title;
6421 - $this->type = $type;
6422 - $this->width = $width;
6423 - if (class_exists('idna_convert'))
6425 - $idn = new idna_convert;
6426 - $parsed = SimplePie_Misc::parse_url($link);
6427 - $this->link = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
6429 - $this->handler = $this->get_handler(); // Needs to load last
6432 - function __toString()
6434 - // There is no $this->data here
6435 - return md5(serialize($this));
6438 - function get_bitrate()
6440 - if ($this->bitrate !== null)
6442 - return $this->bitrate;
6450 - function get_caption($key = 0)
6452 - $captions = $this->get_captions();
6453 - if (isset($captions[$key]))
6455 - return $captions[$key];
6463 - function get_captions()
6465 - if ($this->captions !== null)
6467 - return $this->captions;
6475 - function get_category($key = 0)
6477 - $categories = $this->get_categories();
6478 - if (isset($categories[$key]))
6480 - return $categories[$key];
6488 - function get_categories()
6490 - if ($this->categories !== null)
6492 - return $this->categories;
6500 - function get_channels()
6502 - if ($this->channels !== null)
6504 - return $this->channels;
6512 - function get_copyright()
6514 - if ($this->copyright !== null)
6516 - return $this->copyright;
6524 - function get_credit($key = 0)
6526 - $credits = $this->get_credits();
6527 - if (isset($credits[$key]))
6529 - return $credits[$key];
6537 - function get_credits()
6539 - if ($this->credits !== null)
6541 - return $this->credits;
6549 - function get_description()
6551 - if ($this->description !== null)
6553 - return $this->description;
6561 - function get_duration($convert = false)
6563 - if ($this->duration !== null)
6567 - $time = SimplePie_Misc::time_hms($this->duration);
6572 - return $this->duration;
6581 - function get_expression()
6583 - if ($this->expression !== null)
6585 - return $this->expression;
6593 - function get_extension()
6595 - if ($this->link !== null)
6597 - $url = SimplePie_Misc::parse_url($this->link);
6598 - if ($url['path'] !== '')
6600 - return pathinfo($url['path'], PATHINFO_EXTENSION);
6606 - function get_framerate()
6608 - if ($this->framerate !== null)
6610 - return $this->framerate;
6618 - function get_handler()
6620 - return $this->get_real_type(true);
6623 - function get_hash($key = 0)
6625 - $hashes = $this->get_hashes();
6626 - if (isset($hashes[$key]))
6628 - return $hashes[$key];
6636 - function get_hashes()
6638 - if ($this->hashes !== null)
6640 - return $this->hashes;
6648 - function get_height()
6650 - if ($this->height !== null)
6652 - return $this->height;
6660 - function get_language()
6662 - if ($this->lang !== null)
6664 - return $this->lang;
6672 - function get_keyword($key = 0)
6674 - $keywords = $this->get_keywords();
6675 - if (isset($keywords[$key]))
6677 - return $keywords[$key];
6685 - function get_keywords()
6687 - if ($this->keywords !== null)
6689 - return $this->keywords;
6697 - function get_length()
6699 - if ($this->length !== null)
6701 - return $this->length;
6709 - function get_link()
6711 - if ($this->link !== null)
6713 - return urldecode($this->link);
6721 - function get_medium()
6723 - if ($this->medium !== null)
6725 - return $this->medium;
6733 - function get_player()
6735 - if ($this->player !== null)
6737 - return $this->player;
6745 - function get_rating($key = 0)
6747 - $ratings = $this->get_ratings();
6748 - if (isset($ratings[$key]))
6750 - return $ratings[$key];
6758 - function get_ratings()
6760 - if ($this->ratings !== null)
6762 - return $this->ratings;
6770 - function get_restriction($key = 0)
6772 - $restrictions = $this->get_restrictions();
6773 - if (isset($restrictions[$key]))
6775 - return $restrictions[$key];
6783 - function get_restrictions()
6785 - if ($this->restrictions !== null)
6787 - return $this->restrictions;
6795 - function get_sampling_rate()
6797 - if ($this->samplingrate !== null)
6799 - return $this->samplingrate;
6807 - function get_size()
6809 - $length = $this->get_length();
6810 - if ($length !== null)
6812 - return round($length/1048576, 2);
6820 - function get_thumbnail($key = 0)
6822 - $thumbnails = $this->get_thumbnails();
6823 - if (isset($thumbnails[$key]))
6825 - return $thumbnails[$key];
6833 - function get_thumbnails()
6835 - if ($this->thumbnails !== null)
6837 - return $this->thumbnails;
6845 - function get_title()
6847 - if ($this->title !== null)
6849 - return $this->title;
6857 - function get_type()
6859 - if ($this->type !== null)
6861 - return $this->type;
6869 - function get_width()
6871 - if ($this->width !== null)
6873 - return $this->width;
6881 - function native_embed($options='')
6883 - return $this->embed($options, true);
6887 - * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.
6889 - function embed($options = '', $native = false)
6891 - // Set up defaults
6899 - $bgcolor = '#ffffff';
6900 - $mediaplayer = '';
6901 - $widescreen = false;
6902 - $handler = $this->get_handler();
6903 - $type = $this->get_real_type();
6905 - // Process options and reassign values as necessary
6906 - if (is_array($options))
6908 - extract($options);
6912 - $options = explode(',', $options);
6913 - foreach($options as $option)
6915 - $opt = explode(':', $option, 2);
6916 - if (isset($opt[0], $opt[1]))
6918 - $opt[0] = trim($opt[0]);
6919 - $opt[1] = trim($opt[1]);
6935 - $altclass = $opt[1];
6947 - $height = $opt[1];
6951 - $bgcolor = $opt[1];
6954 - case 'mediaplayer':
6955 - $mediaplayer = $opt[1];
6958 - case 'widescreen':
6959 - $widescreen = $opt[1];
6966 - $mime = explode('/', $type, 2);
6969 - // Process values for 'auto'
6970 - if ($width == 'auto')
6972 - if ($mime == 'video')
6974 - if ($height == 'auto')
6978 - elseif ($widescreen)
6980 - $width = round((intval($height)/9)*16);
6984 - $width = round((intval($height)/3)*4);
6993 - if ($height == 'auto')
6995 - if ($mime == 'audio')
6999 - elseif ($mime == 'video')
7001 - if ($width == 'auto')
7012 - elseif ($widescreen)
7014 - $height = round((intval($width)/16)*9);
7018 - $height = round((intval($width)/4)*3);
7026 - elseif ($mime == 'audio')
7031 - // Set proper placeholder value
7032 - if ($mime == 'audio')
7034 - $placeholder = $audio;
7036 - elseif ($mime == 'video')
7038 - $placeholder = $video;
7043 - // Make sure the JS library is included
7046 - static $javascript_outputted = null;
7047 - if (!$javascript_outputted && $this->javascript)
7049 - $embed .= '<script type="text/javascript" src="?' . htmlspecialchars($this->javascript) . '"></script>';
7050 - $javascript_outputted = true;
7054 - // Odeo Feed MP3's
7055 - if ($handler == 'odeo')
7059 - $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>';
7063 - $embed .= '<script language="JavaScript" type="text/javascript">/* <![CDATA[ */embed_odeo("' . $this->get_link() . '");/* ]]> */</script>';
7068 - elseif ($handler == 'flash')
7072 - $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>";
7076 - $embed .= '<script language="JavaScript" type="text/javascript">/* <![CDATA[ */' .
7077 - "embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');/* ]]> */</script>";
7081 - // Flash Media Player file types.
7082 - // Preferred handler for MP3 file types.
7083 - elseif ($handler == 'fmedia' || ($handler == 'mp3' && $mediaplayer != ''))
7088 - $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>";
7092 - $embed .= '<script language="JavaScript" type="text/javascript">/* <![CDATA[ */' .
7093 - "embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');/* ]]> */</script>";
7097 - // QuickTime 7 file types. Need to test with QuickTime 6.
7098 - // Only handle MP3's if the Flash Media Player is not present.
7099 - elseif ($handler == 'quicktime' || ($handler == 'mp3' && $mediaplayer == ''))
7104 - if ($placeholder != ""){
7105 - $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>";
7108 - $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>";
7113 - $embed .= '<script language="JavaScript" type="text/javascript">/* <![CDATA[ */' .
7114 - "embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');/* ]]> */</script>";
7119 - elseif ($handler == 'wmedia')
7124 - $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>";
7128 - $embed .= '<script language="JavaScript" type="text/javascript">/* <![CDATA[ */' .
7129 - "embed_wmedia('$width', '$height', '" . $this->get_link() . "');/* ]]> */</script>";
7133 - // Everything else
7134 - else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
7139 - function get_real_type($find_handler = false)
7141 - // If it's Odeo, let's get it out of the way.
7142 - if (substr(strtolower($this->get_link()), 0, 15) == 'http://odeo.com')
7147 - // Mime-types by handler.
7148 - $types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
7149 - $types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player
7150 - $types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime
7151 - $types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media
7152 - $types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3
7154 - if ($this->get_type() !== null)
7156 - $type = strtolower($this->type);
7163 - // If we encounter an unsupported mime-type, check the file extension and guess intelligently.
7164 - if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3)))
7166 - switch (strtolower($this->get_extension()))
7168 - // Audio mime-types
7171 - $type = 'audio/acc';
7178 - $type = 'audio/aiff';
7182 - $type = 'audio/wav';
7189 - $type = 'audio/midi';
7193 - $type = 'audio/x-m4a';
7198 - $type = 'audio/mp3';
7202 - $type = 'audio/wav';
7206 - $type = 'audio/x-ms-wax';
7210 - $type = 'audio/x-ms-wma';
7213 - // Video mime-types
7216 - $type = 'video/3gpp';
7221 - $type = 'video/3gpp2';
7225 - $type = 'video/x-ms-asf';
7229 - $type = 'video/x-flv';
7243 - $type = 'video/mpeg';
7247 - $type = 'video/x-m4v';
7252 - $type = 'video/quicktime';
7257 - $type = 'video/mp4';
7261 - $type = 'video/sd-video';
7265 - $type = 'video/x-ms-wm';
7269 - $type = 'video/x-ms-wmv';
7273 - $type = 'video/x-ms-wvx';
7276 - // Flash mime-types
7278 - $type = 'application/futuresplash';
7282 - $type = 'application/x-shockwave-flash';
7287 - if ($find_handler)
7289 - if (in_array($type, $types_flash))
7293 - elseif (in_array($type, $types_fmedia))
7297 - elseif (in_array($type, $types_quicktime))
7299 - return 'quicktime';
7301 - elseif (in_array($type, $types_wmedia))
7305 - elseif (in_array($type, $types_mp3))
7321 -class SimplePie_Caption
7329 - // Constructor, used to input the data
7330 - function SimplePie_Caption($type = null, $lang = null, $startTime = null, $endTime = null, $text = null)
7332 - $this->type = $type;
7333 - $this->lang = $lang;
7334 - $this->startTime = $startTime;
7335 - $this->endTime = $endTime;
7336 - $this->text = $text;
7339 - function __toString()
7341 - // There is no $this->data here
7342 - return md5(serialize($this));
7345 - function get_endtime()
7347 - if ($this->endTime !== null)
7349 - return $this->endTime;
7357 - function get_language()
7359 - if ($this->lang !== null)
7361 - return $this->lang;
7369 - function get_starttime()
7371 - if ($this->startTime !== null)
7373 - return $this->startTime;
7381 - function get_text()
7383 - if ($this->text !== null)
7385 - return $this->text;
7393 - function get_type()
7395 - if ($this->type !== null)
7397 - return $this->type;
7406 -class SimplePie_Credit
7412 - // Constructor, used to input the data
7413 - function SimplePie_Credit($role = null, $scheme = null, $name = null)
7415 - $this->role = $role;
7416 - $this->scheme = $scheme;
7417 - $this->name = $name;
7420 - function __toString()
7422 - // There is no $this->data here
7423 - return md5(serialize($this));
7426 - function get_role()
7428 - if ($this->role !== null)
7430 - return $this->role;
7438 - function get_scheme()
7440 - if ($this->scheme !== null)
7442 - return $this->scheme;
7450 - function get_name()
7452 - if ($this->name !== null)
7454 - return $this->name;
7463 -class SimplePie_Copyright
7468 - // Constructor, used to input the data
7469 - function SimplePie_Copyright($url = null, $label = null)
7471 - $this->url = $url;
7472 - $this->label = $label;
7475 - function __toString()
7477 - // There is no $this->data here
7478 - return md5(serialize($this));
7481 - function get_url()
7483 - if ($this->url !== null)
7485 - return $this->url;
7493 - function get_attribution()
7495 - if ($this->label !== null)
7497 - return $this->label;
7506 -class SimplePie_Rating
7511 - // Constructor, used to input the data
7512 - function SimplePie_Rating($scheme = null, $value = null)
7514 - $this->scheme = $scheme;
7515 - $this->value = $value;
7518 - function __toString()
7520 - // There is no $this->data here
7521 - return md5(serialize($this));
7524 - function get_scheme()
7526 - if ($this->scheme !== null)
7528 - return $this->scheme;
7536 - function get_value()
7538 - if ($this->value !== null)
7540 - return $this->value;
7549 -class SimplePie_Restriction
7551 - var $relationship;
7555 - // Constructor, used to input the data
7556 - function SimplePie_Restriction($relationship = null, $type = null, $value = null)
7558 - $this->relationship = $relationship;
7559 - $this->type = $type;
7560 - $this->value = $value;
7563 - function __toString()
7565 - // There is no $this->data here
7566 - return md5(serialize($this));
7569 - function get_relationship()
7571 - if ($this->relationship !== null)
7573 - return $this->relationship;
7581 - function get_type()
7583 - if ($this->type !== null)
7585 - return $this->type;
7593 - function get_value()
7595 - if ($this->value !== null)
7597 - return $this->value;
7607 - * @todo Move to properly supporting RFC2616 (HTTP/1.1)
7609 -class SimplePie_File
7613 - var $success = true;
7614 - var $headers = array();
7617 - var $redirects = 0;
7619 - var $method = SIMPLEPIE_FILE_SOURCE_NONE;
7621 - function SimplePie_File($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false, $proxy = "")
7623 - if (class_exists('idna_convert'))
7625 - $idn = new idna_convert;
7626 - $parsed = SimplePie_Misc::parse_url($url);
7627 - $url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
7629 - $this->url = $url;
7630 - $this->useragent = $useragent;
7631 - if (preg_match('/^http(s)?:\/\//i', $url))
7633 - if ($useragent === null)
7635 - $useragent = ini_get('user_agent');
7636 - $this->useragent = $useragent;
7638 - if (!is_array($headers))
7640 - $headers = array();
7642 - if (!$force_fsockopen && function_exists('curl_exec'))
7644 - $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL;
7645 - $fp = curl_init();
7646 - $headers2 = array();
7647 - foreach ($headers as $key => $value)
7649 - $headers2[] = "$key: $value";
7651 - if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>='))
7653 - curl_setopt($fp, CURLOPT_ENCODING, '');
7655 - curl_setopt($fp, CURLOPT_URL, $url);
7656 - curl_setopt($fp, CURLOPT_HEADER, 1);
7657 - curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
7658 - curl_setopt($fp, CURLOPT_TIMEOUT, $timeout);
7659 - curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout);
7660 - curl_setopt($fp, CURLOPT_REFERER, $url);
7661 - curl_setopt($fp, CURLOPT_USERAGENT, $useragent);
7662 - curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
7663 - if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>='))
7665 - curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1);
7666 - curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
7670 - curl_setopt($fp, CURLOPT_PROXY, $proxy);
7673 - $this->headers = curl_exec($fp);
7674 - if (curl_errno($fp) == 23 || curl_errno($fp) == 61)
7676 - curl_setopt($fp, CURLOPT_ENCODING, 'none');
7677 - $this->headers = curl_exec($fp);
7679 - if (curl_errno($fp))
7681 - $this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
7682 - $this->success = false;
7686 - $info = curl_getinfo($fp);
7688 - $this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1);
7689 - $this->headers = array_pop($this->headers);
7690 - $parser = new SimplePie_HTTP_Parser($this->headers);
7691 - if ($parser->parse())
7693 - $this->headers = $parser->headers;
7694 - $this->body = $parser->body;
7695 - $this->status_code = $parser->status_code;
7696 - 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)
7698 - $this->redirects++;
7699 - $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
7700 - return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
7707 - $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
7708 - $url_parts = parse_url($url);
7709 - if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) == 'https')
7711 - $url_parts['host'] = "ssl://$url_parts[host]";
7712 - $url_parts['port'] = 443;
7714 - if (!isset($url_parts['port']))
7716 - $url_parts['port'] = 80;
7719 - $proxy_parts = explode(':', $proxy);
7720 - if (!isset($proxy_parts[1])) {
7721 - $proxy_parts[1] = 80;
7723 - $host = $proxy_parts[0];
7724 - $port = $proxy_parts[1];
7726 - $host = $url_parts['host'];
7727 - $port = $url_parts['port'];
7729 - $fp = @fsockopen($host, $port, $errno, $errstr, $timeout);
7732 - $this->error = 'fsockopen error: ' . $errstr;
7733 - $this->success = false;
7737 - stream_set_timeout($fp, $timeout);
7741 - if (isset($url_parts['path']))
7743 - if (isset($url_parts['query']))
7745 - $get = "$url_parts[path]?$url_parts[query]";
7749 - $get = $url_parts['path'];
7757 - $out = "GET $get HTTP/1.0\r\n";
7758 - $out .= "Host: $url_parts[host]\r\n";
7759 - $out .= "User-Agent: $useragent\r\n";
7760 - if (extension_loaded('zlib'))
7762 - $out .= "Accept-Encoding: x-gzip,gzip,deflate\r\n";
7765 - if (isset($url_parts['user']) && isset($url_parts['pass']))
7767 - $out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n";
7769 - foreach ($headers as $key => $value)
7771 - $out .= "$key: $value\r\n";
7773 - $out .= "Connection: Close\r\n\r\n";
7774 - fwrite($fp, $out);
7776 - $info = stream_get_meta_data($fp);
7778 - $this->headers = '';
7779 - while (!$info['eof'] && !$info['timed_out'])
7781 - $this->headers .= fread($fp, 1160);
7782 - $info = stream_get_meta_data($fp);
7784 - if (!$info['timed_out'])
7786 - $parser = new SimplePie_HTTP_Parser($this->headers);
7787 - if ($parser->parse())
7789 - $this->headers = $parser->headers;
7790 - $this->body = $parser->body;
7791 - $this->status_code = $parser->status_code;
7792 - 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)
7794 - $this->redirects++;
7795 - $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
7796 - return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
7798 - if (isset($this->headers['content-encoding']))
7800 - // Hey, we act dumb elsewhere, so let's do that here too
7801 - switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20")))
7805 - $decoder = new SimplePie_gzdecode($this->body);
7806 - if (!$decoder->parse())
7808 - $this->error = 'Unable to decode HTTP "gzip" stream';
7809 - $this->success = false;
7813 - $this->body = $decoder->data;
7818 - if (($body = gzuncompress($this->body)) === false)
7820 - if (($body = gzinflate($this->body)) === false)
7822 - $this->error = 'Unable to decode HTTP "deflate" stream';
7823 - $this->success = false;
7826 - $this->body = $body;
7830 - $this->error = 'Unknown content coding';
7831 - $this->success = false;
7838 - $this->error = 'fsocket timed out';
7839 - $this->success = false;
7847 - $this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS;
7848 - if (!$this->body = file_get_contents($url))
7850 - $this->error = 'file_get_contents could not read the file';
7851 - $this->success = false;
7858 - * HTTP Response Parser
7860 - * @package SimplePie
7862 -class SimplePie_HTTP_Parser
7870 - var $http_version = 0.0;
7878 - var $status_code = 0;
7889 - * Key/value pairs of the headers
7894 - var $headers = array();
7897 - * Body of the response
7905 - * Current state of the state machine
7910 - var $state = 'http_version';
7921 - * Input data length (to avoid calling strlen() everytime this is needed)
7926 - var $data_length = 0;
7929 - * Current position of the pointer
7934 - var $position = 0;
7937 - * Name of the hedaer currently being parsed
7945 - * Value of the hedaer currently being parsed
7953 - * Create an instance of the class with the input data
7956 - * @param string $data Input data
7958 - function SimplePie_HTTP_Parser($data)
7960 - $this->data = $data;
7961 - $this->data_length = strlen($this->data);
7965 - * Parse the input data
7968 - * @return bool true on success, false on failure
7972 - while ($this->state && $this->state !== 'emit' && $this->has_data())
7974 - $state = $this->state;
7978 - if ($this->state === 'emit' || $this->state === 'body')
7984 - $this->http_version = '';
7985 - $this->status_code = '';
7986 - $this->reason = '';
7987 - $this->headers = array();
7994 - * Check whether there is data beyond the pointer
7997 - * @return bool true if there is further data, false if not
7999 - function has_data()
8001 - return (bool) ($this->position < $this->data_length);
8005 - * See if the next character is LWS
8008 - * @return bool true if the next character is LWS, false if not
8010 - function is_linear_whitespace()
8012 - return (bool) ($this->data[$this->position] === "\x09"
8013 - || $this->data[$this->position] === "\x20"
8014 - || ($this->data[$this->position] === "\x0A"
8015 - && isset($this->data[$this->position + 1])
8016 - && ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20")));
8020 - * Parse the HTTP version
8024 - function http_version()
8026 - if (strpos($this->data, "\x0A") !== false && strtoupper(substr($this->data, 0, 5)) === 'HTTP/')
8028 - $len = strspn($this->data, '0123456789.', 5);
8029 - $this->http_version = substr($this->data, 5, $len);
8030 - $this->position += 5 + $len;
8031 - if (substr_count($this->http_version, '.') <= 1)
8033 - $this->http_version = (float) $this->http_version;
8034 - $this->position += strspn($this->data, "\x09\x20", $this->position);
8035 - $this->state = 'status';
8039 - $this->state = false;
8044 - $this->state = false;
8049 - * Parse the status code
8055 - if ($len = strspn($this->data, '0123456789', $this->position))
8057 - $this->status_code = (int) substr($this->data, $this->position, $len);
8058 - $this->position += $len;
8059 - $this->state = 'reason';
8063 - $this->state = false;
8068 - * Parse the reason phrase
8074 - $len = strcspn($this->data, "\x0A", $this->position);
8075 - $this->reason = trim(substr($this->data, $this->position, $len), "\x09\x0D\x20");
8076 - $this->position += $len + 1;
8077 - $this->state = 'new_line';
8081 - * Deal with a new line, shifting data around as needed
8085 - function new_line()
8087 - $this->value = trim($this->value, "\x0D\x20");
8088 - if ($this->name !== '' && $this->value !== '')
8090 - $this->name = strtolower($this->name);
8091 - if (isset($this->headers[$this->name]))
8093 - $this->headers[$this->name] .= ', ' . $this->value;
8097 - $this->headers[$this->name] = $this->value;
8101 - $this->value = '';
8102 - if (substr($this->data[$this->position], 0, 2) === "\x0D\x0A")
8104 - $this->position += 2;
8105 - $this->state = 'body';
8107 - elseif ($this->data[$this->position] === "\x0A")
8109 - $this->position++;
8110 - $this->state = 'body';
8114 - $this->state = 'name';
8119 - * Parse a header name
8125 - $len = strcspn($this->data, "\x0A:", $this->position);
8126 - if (isset($this->data[$this->position + $len]))
8128 - if ($this->data[$this->position + $len] === "\x0A")
8130 - $this->position += $len;
8131 - $this->state = 'new_line';
8135 - $this->name = substr($this->data, $this->position, $len);
8136 - $this->position += $len + 1;
8137 - $this->state = 'value';
8142 - $this->state = false;
8147 - * Parse LWS, replacing consecutive LWS characters with a single space
8151 - function linear_whitespace()
8155 - if (substr($this->data, $this->position, 2) === "\x0D\x0A")
8157 - $this->position += 2;
8159 - elseif ($this->data[$this->position] === "\x0A")
8161 - $this->position++;
8163 - $this->position += strspn($this->data, "\x09\x20", $this->position);
8164 - } while ($this->has_data() && $this->is_linear_whitespace());
8165 - $this->value .= "\x20";
8169 - * See what state to move to while within non-quoted header values
8175 - if ($this->is_linear_whitespace())
8177 - $this->linear_whitespace();
8181 - switch ($this->data[$this->position])
8184 - $this->position++;
8185 - $this->state = 'quote';
8189 - $this->position++;
8190 - $this->state = 'new_line';
8194 - $this->state = 'value_char';
8201 - * Parse a header value while outside quotes
8205 - function value_char()
8207 - $len = strcspn($this->data, "\x09\x20\x0A\"", $this->position);
8208 - $this->value .= substr($this->data, $this->position, $len);
8209 - $this->position += $len;
8210 - $this->state = 'value';
8214 - * See what state to move to while within quoted header values
8220 - if ($this->is_linear_whitespace())
8222 - $this->linear_whitespace();
8226 - switch ($this->data[$this->position])
8229 - $this->position++;
8230 - $this->state = 'value';
8234 - $this->position++;
8235 - $this->state = 'new_line';
8239 - $this->position++;
8240 - $this->state = 'quote_escaped';
8244 - $this->state = 'quote_char';
8251 - * Parse a header value while within quotes
8255 - function quote_char()
8257 - $len = strcspn($this->data, "\x09\x20\x0A\"\\", $this->position);
8258 - $this->value .= substr($this->data, $this->position, $len);
8259 - $this->position += $len;
8260 - $this->state = 'value';
8264 - * Parse an escaped character within quotes
8268 - function quote_escaped()
8270 - $this->value .= $this->data[$this->position];
8271 - $this->position++;
8272 - $this->state = 'quote';
8282 - $this->body = substr($this->data, $this->position);
8283 - $this->state = 'emit';
8290 - * @package SimplePie
8292 -class SimplePie_gzdecode
8298 - * @see gzdecode::$data
8300 - var $compressed_data;
8303 - * Size of compressed data
8307 - var $compressed_size;
8310 - * Minimum size of a valid gzip string
8314 - var $min_compressed_size = 18;
8317 - * Current position of pointer
8321 - var $position = 0;
8331 - * Uncompressed data
8334 - * @see gzdecode::$compressed_data
8353 - * Operating System
8363 - * @see gzdecode::$extra_field
8364 - * @see gzdecode::$SI2
8372 - * @see gzdecode::$extra_field
8373 - * @see gzdecode::$SI1
8378 - * Extra field content
8381 - * @see gzdecode::$SI1
8382 - * @see gzdecode::$SI2
8387 - * Original filename
8394 - * Human readable comment
8401 - * Don't allow anything to be set
8405 - function __set($name, $value)
8407 - trigger_error("Cannot write property $name", E_USER_ERROR);
8411 - * Set the compressed string and related properties
8415 - function SimplePie_gzdecode($data)
8417 - $this->compressed_data = $data;
8418 - $this->compressed_size = strlen($data);
8422 - * Decode the GZIP stream
8428 - if ($this->compressed_size >= $this->min_compressed_size)
8430 - // Check ID1, ID2, and CM
8431 - if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08")
8436 - // Get the FLG (FLaGs)
8437 - $this->flags = ord($this->compressed_data[3]);
8439 - // FLG bits above (1 << 4) are reserved
8440 - if ($this->flags > 0x1F)
8445 - // Advance the pointer after the above
8446 - $this->position += 4;
8449 - $mtime = substr($this->compressed_data, $this->position, 4);
8450 - // Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness
8451 - if (current(unpack('S', "\x00\x01")) === 1)
8453 - $mtime = strrev($mtime);
8455 - $this->MTIME = current(unpack('l', $mtime));
8456 - $this->position += 4;
8458 - // Get the XFL (eXtra FLags)
8459 - $this->XFL = ord($this->compressed_data[$this->position++]);
8461 - // Get the OS (Operating System)
8462 - $this->OS = ord($this->compressed_data[$this->position++]);
8464 - // Parse the FEXTRA
8465 - if ($this->flags & 4)
8467 - // Read subfield IDs
8468 - $this->SI1 = $this->compressed_data[$this->position++];
8469 - $this->SI2 = $this->compressed_data[$this->position++];
8471 - // SI2 set to zero is reserved for future use
8472 - if ($this->SI2 === "\x00")
8477 - // Get the length of the extra field
8478 - $len = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
8481 - // Check the length of the string is still valid
8482 - $this->min_compressed_size += $len + 4;
8483 - if ($this->compressed_size >= $this->min_compressed_size)
8485 - // Set the extra field to the given data
8486 - $this->extra_field = substr($this->compressed_data, $this->position, $len);
8487 - $this->position += $len;
8495 - // Parse the FNAME
8496 - if ($this->flags & 8)
8498 - // Get the length of the filename
8499 - $len = strspn($this->compressed_data, "\x00", $this->position);
8501 - // Check the length of the string is still valid
8502 - $this->min_compressed_size += $len + 1;
8503 - if ($this->compressed_size >= $this->min_compressed_size)
8505 - // Set the original filename to the given string
8506 - $this->filename = substr($this->compressed_data, $this->position, $len);
8507 - $this->position += $len + 1;
8515 - // Parse the FCOMMENT
8516 - if ($this->flags & 16)
8518 - // Get the length of the comment
8519 - $len = strspn($this->compressed_data, "\x00", $this->position);
8521 - // Check the length of the string is still valid
8522 - $this->min_compressed_size += $len + 1;
8523 - if ($this->compressed_size >= $this->min_compressed_size)
8525 - // Set the original comment to the given string
8526 - $this->comment = substr($this->compressed_data, $this->position, $len);
8527 - $this->position += $len + 1;
8535 - // Parse the FHCRC
8536 - if ($this->flags & 2)
8538 - // Check the length of the string is still valid
8539 - $this->min_compressed_size += $len + 2;
8540 - if ($this->compressed_size >= $this->min_compressed_size)
8543 - $crc = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
8545 - // Check the CRC matches
8546 - if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc)
8548 - $this->position += 2;
8561 - // Decompress the actual data
8562 - if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false)
8568 - $this->position = $this->compressed_size - 8;
8571 - // Check CRC of data
8572 - $crc = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
8573 - $this->position += 4;
8574 - /*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc))
8579 - // Check ISIZE of data
8580 - $isize = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
8581 - $this->position += 4;
8582 - if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize))
8587 - // Wow, against all odds, we've actually got a valid gzip string
8597 -class SimplePie_Cache
8600 - * Don't call the constructor. Please.
8604 - function SimplePie_Cache()
8606 - trigger_error('Please call SimplePie_Cache::create() instead of the constructor', E_USER_ERROR);
8610 - * Create a new SimplePie_Cache object
8615 - static function create($location, $filename, $extension)
8617 - return new SimplePie_Cache_File($location, $filename, $extension);
8621 -class SimplePie_Cache_File
8628 - function SimplePie_Cache_File($location, $filename, $extension)
8630 - $this->location = $location;
8631 - $this->filename = rawurlencode($filename);
8632 - $this->extension = rawurlencode($extension);
8633 - $this->name = "$location/$this->filename.$this->extension";
8636 - function save($data)
8638 - if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location))
8640 - if (is_a($data, 'SimplePie'))
8642 - $data = $data->data;
8645 - $data = serialize($data);
8647 - if (function_exists('file_put_contents'))
8649 - return (bool) file_put_contents($this->name, $data);
8653 - $fp = fopen($this->name, 'wb');
8656 - fwrite($fp, $data);
8667 - if (file_exists($this->name) && is_readable($this->name))
8669 - return unserialize(file_get_contents($this->name));
8676 - if (file_exists($this->name))
8678 - return filemtime($this->name);
8685 - if (file_exists($this->name))
8687 - return touch($this->name);
8694 - if (file_exists($this->name))
8696 - return unlink($this->name);
8702 -class SimplePie_Misc
8704 - function time_hms($seconds)
8708 - $hours = floor($seconds / 3600);
8709 - $remainder = $seconds % 3600;
8712 - $time .= $hours.':';
8715 - $minutes = floor($remainder / 60);
8716 - $seconds = $remainder % 60;
8717 - if ($minutes < 10 && $hours > 0)
8719 - $minutes = '0' . $minutes;
8721 - if ($seconds < 10)
8723 - $seconds = '0' . $seconds;
8726 - $time .= $minutes.':';
8727 - $time .= $seconds;
8732 - static function absolutize_url($relative, $base)
8734 - if ($relative !== '')
8736 - $relative = SimplePie_Misc::parse_url($relative);
8737 - if ($relative['scheme'] !== '')
8739 - $target = $relative;
8741 - elseif ($base !== '')
8743 - $base = SimplePie_Misc::parse_url($base);
8744 - $target = SimplePie_Misc::parse_url('');
8745 - if ($relative['authority'] !== '')
8747 - $target = $relative;
8748 - $target['scheme'] = $base['scheme'];
8752 - $target['scheme'] = $base['scheme'];
8753 - $target['authority'] = $base['authority'];
8754 - if ($relative['path'] !== '')
8756 - if (strpos($relative['path'], '/') === 0)
8758 - $target['path'] = $relative['path'];
8760 - elseif ($base['authority'] !== '' && $base['path'] === '')
8762 - $target['path'] = '/' . $relative['path'];
8764 - elseif (($last_segment = strrpos($base['path'], '/')) !== false)
8766 - $target['path'] = substr($base['path'], 0, $last_segment + 1) . $relative['path'];
8770 - $target['path'] = $relative['path'];
8772 - $target['query'] = $relative['query'];
8776 - $target['path'] = $base['path'];
8777 - if ($relative['query'] !== '')
8779 - $target['query'] = $relative['query'];
8781 - elseif ($base['query'] !== '')
8783 - $target['query'] = $base['query'];
8787 - $target['fragment'] = $relative['fragment'];
8791 - // No base URL, just return the relative URL
8792 - $target = $relative;
8794 - $return = SimplePie_Misc::compress_parse_url($target['scheme'], $target['authority'], $target['path'], $target['query'], $target['fragment']);
8800 - $return = SimplePie_Misc::normalize_url($return);
8804 - static function remove_dot_segments($input)
8807 - while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input == '.' || $input == '..')
8809 - // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
8810 - if (strpos($input, '../') === 0)
8812 - $input = substr($input, 3);
8814 - elseif (strpos($input, './') === 0)
8816 - $input = substr($input, 2);
8818 - // 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,
8819 - elseif (strpos($input, '/./') === 0)
8821 - $input = substr_replace($input, '/', 0, 3);
8823 - elseif ($input == '/.')
8827 - // 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,
8828 - elseif (strpos($input, '/../') === 0)
8830 - $input = substr_replace($input, '/', 0, 4);
8831 - $output = substr_replace($output, '', strrpos($output, '/'));
8833 - elseif ($input == '/..')
8836 - $output = substr_replace($output, '', strrpos($output, '/'));
8838 - // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
8839 - elseif ($input == '.' || $input == '..')
8843 - // 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
8844 - elseif (($pos = strpos($input, '/', 1)) !== false)
8846 - $output .= substr($input, 0, $pos);
8847 - $input = substr_replace($input, '', 0, $pos);
8851 - $output .= $input;
8855 - return $output . $input;
8858 - static function get_element($realname, $string)
8860 - $return = array();
8861 - $name = preg_quote($realname, '/');
8862 - if (preg_match_all("/<($name)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE))
8864 - for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++)
8866 - $return[$i]['tag'] = $realname;
8867 - $return[$i]['full'] = $matches[$i][0][0];
8868 - $return[$i]['offset'] = $matches[$i][0][1];
8869 - if (strlen($matches[$i][3][0]) <= 2)
8871 - $return[$i]['self_closing'] = true;
8875 - $return[$i]['self_closing'] = false;
8876 - $return[$i]['content'] = $matches[$i][4][0];
8878 - $return[$i]['attribs'] = array();
8879 - 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))
8881 - for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++)
8883 - if (count($attribs[$j]) == 2)
8885 - $attribs[$j][2] = $attribs[$j][1];
8887 - $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j]), 'UTF-8');
8895 - function element_implode($element)
8897 - $full = "<$element[tag]";
8898 - foreach ($element['attribs'] as $key => $value)
8900 - $key = strtolower($key);
8901 - $full .= " $key=\"" . htmlspecialchars($value['data']) . '"';
8903 - if ($element['self_closing'])
8909 - $full .= ">$element[content]</$element[tag]>";
8914 - static function error($message, $level, $file, $line)
8918 - case E_USER_ERROR:
8919 - $note = 'PHP Error';
8921 - case E_USER_WARNING:
8922 - $note = 'PHP Warning';
8924 - case E_USER_NOTICE:
8925 - $note = 'PHP Notice';
8928 - $note = 'Unknown Error';
8931 - error_log("$note: $message in $file on line $line", 0);
8936 - * If a file has been cached, retrieve and display it.
8938 - * This is most useful for caching images (get_favicon(), etc.),
8939 - * however it works for all cached files. This WILL NOT display ANY
8940 - * file/image/page/whatever, but rather only display what has already
8941 - * been cached by SimplePie.
8944 - * @see SimplePie::get_favicon()
8945 - * @param str $identifier_url URL that is used to identify the content.
8946 - * This may or may not be the actual URL of the live content.
8947 - * @param str $cache_location Location of SimplePie's cache. Defaults
8949 - * @param str $cache_extension The file extension that the file was
8950 - * cached with. Defaults to 'spc'.
8951 - * @param str $cache_class Name of the cache-handling class being used
8952 - * in SimplePie. Defaults to 'SimplePie_Cache', and should be left
8953 - * as-is unless you've overloaded the class.
8954 - * @param str $cache_name_function Obsolete. Exists for backwards
8955 - * compatibility reasons only.
8957 - function display_cached_file($identifier_url, $cache_location = './cache', $cache_extension = 'spc', $cache_class = 'SimplePie_Cache', $cache_name_function = 'md5')
8959 - $cache = call_user_func(array($cache_class, 'create'), $cache_location, $identifier_url, $cache_extension);
8961 - if ($file = $cache->load())
8963 - if (isset($file['headers']['content-type']))
8965 - header('Content-type:' . $file['headers']['content-type']);
8969 - header('Content-type: application/octet-stream');
8971 - header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
8972 - echo $file['body'];
8976 - die('Cached file for ' . $identifier_url . ' cannot be found.');
8979 - static function fix_protocol($url, $http = 1)
8981 - $url = SimplePie_Misc::normalize_url($url);
8982 - $parsed = SimplePie_Misc::parse_url($url);
8983 - if ($parsed['scheme'] !== '' && $parsed['scheme'] != 'http' && $parsed['scheme'] != 'https')
8985 - return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http);
8988 - if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url))
8990 - return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http);
8993 - if ($http == 2 && $parsed['scheme'] !== '')
8995 - return "feed:$url";
8997 - elseif ($http == 3 && strtolower($parsed['scheme']) == 'http')
8999 - return substr_replace($url, 'podcast', 0, 4);
9001 - elseif ($http == 4 && strtolower($parsed['scheme']) == 'http')
9003 - return substr_replace($url, 'itpc', 0, 4);
9011 - static function parse_url($url)
9013 - static $cache = array();
9014 - if (isset($cache[$url]))
9016 - return $cache[$url];
9018 - elseif (preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match))
9020 - for ($i = count($match); $i <= 9; $i++)
9024 - return $cache[$url] = array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
9028 - return $cache[$url] = array('scheme' => '', 'authority' => '', 'path' => '', 'query' => '', 'fragment' => '');
9032 - static function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
9035 - if ($scheme !== '')
9037 - $return .= "$scheme:";
9039 - if ($authority !== '')
9041 - $return .= "//$authority";
9047 - if ($query !== '')
9049 - $return .= "?$query";
9051 - if ($fragment !== '')
9053 - $return .= "#$fragment";
9058 - static function normalize_url($url)
9060 - $url = preg_replace_callback('/%([0-9A-Fa-f]{2})/', array('SimplePie_Misc', 'percent_encoding_normalization'), $url);
9061 - $url = SimplePie_Misc::parse_url($url);
9062 - $url['scheme'] = strtolower($url['scheme']);
9063 - if ($url['authority'] !== '')
9065 - $url['authority'] = strtolower($url['authority']);
9066 - $url['path'] = SimplePie_Misc::remove_dot_segments($url['path']);
9068 - return SimplePie_Misc::compress_parse_url($url['scheme'], $url['authority'], $url['path'], $url['query'], $url['fragment']);
9071 - static function percent_encoding_normalization($match)
9073 - $integer = hexdec($match[1]);
9074 - if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer == 0x2D || $integer == 0x2E || $integer == 0x5F || $integer == 0x7E)
9076 - return chr($integer);
9080 - return strtoupper($match[0]);
9085 - * Remove bad UTF-8 bytes
9087 - * PCRE Pattern to locate bad bytes in a UTF-8 string comes from W3C
9088 - * FAQ: Multilingual Forms (modified to include full ASCII range)
9090 - * @author Geoffrey Sneddon
9091 - * @see http://www.w3.org/International/questions/qa-forms-utf-8
9092 - * @param string $str String to remove bad UTF-8 bytes from
9093 - * @return string UTF-8 string
9095 - function utf8_bad_replace($str)
9097 - if (function_exists('iconv') && ($return = @iconv('UTF-8', 'UTF-8//IGNORE', $str)))
9101 - elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($str, 'UTF-8', 'UTF-8')))
9105 - elseif (preg_match_all('/(?:[\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})+/', $str, $matches))
9107 - return implode("\xEF\xBF\xBD", $matches[0]);
9109 - elseif ($str !== '')
9111 - return "\xEF\xBF\xBD";
9120 - * Converts a Windows-1252 encoded string to a UTF-8 encoded string
9124 - * @param string $string Windows-1252 encoded string
9125 - * @return string UTF-8 encoded string
9127 - static function windows_1252_to_utf8($string)
9129 - static $convert_table = array("\x80" => "\xE2\x82\xAC", "\x81" => "\xEF\xBF\xBD", "\x82" => "\xE2\x80\x9A", "\x83" => "\xC6\x92", "\x84" => "\xE2\x80\x9E", "\x85" => "\xE2\x80\xA6", "\x86" => "\xE2\x80\xA0", "\x87" => "\xE2\x80\xA1", "\x88" => "\xCB\x86", "\x89" => "\xE2\x80\xB0", "\x8A" => "\xC5\xA0", "\x8B" => "\xE2\x80\xB9", "\x8C" => "\xC5\x92", "\x8D" => "\xEF\xBF\xBD", "\x8E" => "\xC5\xBD", "\x8F" => "\xEF\xBF\xBD", "\x90" => "\xEF\xBF\xBD", "\x91" => "\xE2\x80\x98", "\x92" => "\xE2\x80\x99", "\x93" => "\xE2\x80\x9C", "\x94" => "\xE2\x80\x9D", "\x95" => "\xE2\x80\xA2", "\x96" => "\xE2\x80\x93", "\x97" => "\xE2\x80\x94", "\x98" => "\xCB\x9C", "\x99" => "\xE2\x84\xA2", "\x9A" => "\xC5\xA1", "\x9B" => "\xE2\x80\xBA", "\x9C" => "\xC5\x93", "\x9D" => "\xEF\xBF\xBD", "\x9E" => "\xC5\xBE", "\x9F" => "\xC5\xB8", "\xA0" => "\xC2\xA0", "\xA1" => "\xC2\xA1", "\xA2" => "\xC2\xA2", "\xA3" => "\xC2\xA3", "\xA4" => "\xC2\xA4", "\xA5" => "\xC2\xA5", "\xA6" => "\xC2\xA6", "\xA7" => "\xC2\xA7", "\xA8" => "\xC2\xA8", "\xA9" => "\xC2\xA9", "\xAA" => "\xC2\xAA", "\xAB" => "\xC2\xAB", "\xAC" => "\xC2\xAC", "\xAD" => "\xC2\xAD", "\xAE" => "\xC2\xAE", "\xAF" => "\xC2\xAF", "\xB0" => "\xC2\xB0", "\xB1" => "\xC2\xB1", "\xB2" => "\xC2\xB2", "\xB3" => "\xC2\xB3", "\xB4" => "\xC2\xB4", "\xB5" => "\xC2\xB5", "\xB6" => "\xC2\xB6", "\xB7" => "\xC2\xB7", "\xB8" => "\xC2\xB8", "\xB9" => "\xC2\xB9", "\xBA" => "\xC2\xBA", "\xBB" => "\xC2\xBB", "\xBC" => "\xC2\xBC", "\xBD" => "\xC2\xBD", "\xBE" => "\xC2\xBE", "\xBF" => "\xC2\xBF", "\xC0" => "\xC3\x80", "\xC1" => "\xC3\x81", "\xC2" => "\xC3\x82", "\xC3" => "\xC3\x83", "\xC4" => "\xC3\x84", "\xC5" => "\xC3\x85", "\xC6" => "\xC3\x86", "\xC7" => "\xC3\x87", "\xC8" => "\xC3\x88", "\xC9" => "\xC3\x89", "\xCA" => "\xC3\x8A", "\xCB" => "\xC3\x8B", "\xCC" => "\xC3\x8C", "\xCD" => "\xC3\x8D", "\xCE" => "\xC3\x8E", "\xCF" => "\xC3\x8F", "\xD0" => "\xC3\x90", "\xD1" => "\xC3\x91", "\xD2" => "\xC3\x92", "\xD3" => "\xC3\x93", "\xD4" => "\xC3\x94", "\xD5" => "\xC3\x95", "\xD6" => "\xC3\x96", "\xD7" => "\xC3\x97", "\xD8" => "\xC3\x98", "\xD9" => "\xC3\x99", "\xDA" => "\xC3\x9A", "\xDB" => "\xC3\x9B", "\xDC" => "\xC3\x9C", "\xDD" => "\xC3\x9D", "\xDE" => "\xC3\x9E", "\xDF" => "\xC3\x9F", "\xE0" => "\xC3\xA0", "\xE1" => "\xC3\xA1", "\xE2" => "\xC3\xA2", "\xE3" => "\xC3\xA3", "\xE4" => "\xC3\xA4", "\xE5" => "\xC3\xA5", "\xE6" => "\xC3\xA6", "\xE7" => "\xC3\xA7", "\xE8" => "\xC3\xA8", "\xE9" => "\xC3\xA9", "\xEA" => "\xC3\xAA", "\xEB" => "\xC3\xAB", "\xEC" => "\xC3\xAC", "\xED" => "\xC3\xAD", "\xEE" => "\xC3\xAE", "\xEF" => "\xC3\xAF", "\xF0" => "\xC3\xB0", "\xF1" => "\xC3\xB1", "\xF2" => "\xC3\xB2", "\xF3" => "\xC3\xB3", "\xF4" => "\xC3\xB4", "\xF5" => "\xC3\xB5", "\xF6" => "\xC3\xB6", "\xF7" => "\xC3\xB7", "\xF8" => "\xC3\xB8", "\xF9" => "\xC3\xB9", "\xFA" => "\xC3\xBA", "\xFB" => "\xC3\xBB", "\xFC" => "\xC3\xBC", "\xFD" => "\xC3\xBD", "\xFE" => "\xC3\xBE", "\xFF" => "\xC3\xBF");
9131 - return strtr($string, $convert_table);
9134 - static function change_encoding($data, $input, $output)
9136 - $input = SimplePie_Misc::encoding($input);
9137 - $output = SimplePie_Misc::encoding($output);
9139 - // We fail to fail on non US-ASCII bytes
9140 - if ($input === 'US-ASCII')
9142 - static $non_ascii_octects = '';
9143 - if (!$non_ascii_octects)
9145 - for ($i = 0x80; $i <= 0xFF; $i++)
9147 - $non_ascii_octects .= chr($i);
9150 - $data = substr($data, 0, strcspn($data, $non_ascii_octects));
9153 - // This is first, as behaviour of this is completely predictable
9154 - if ($input === 'Windows-1252' && $output === 'UTF-8')
9156 - return SimplePie_Misc::windows_1252_to_utf8($data);
9158 - // This is second, as behaviour of this varies only with PHP version
9159 - elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($data, $output, $input)))
9163 - // This is last, as behaviour of this varies with OS userland and PHP version
9164 - elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data)))
9168 - // If we can't do anything, just fail
9175 - static function encoding($charset)
9177 - /* Character sets are case-insensitive, and also need some further
9178 - normalization in the real world (though we'll return them in the form given
9179 - in their registration). */
9180 - switch (strtolower(preg_replace('/[\x09-\x0D\x20-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]/', '', $charset)))
9182 - case 'adobestandardencoding':
9183 - case 'csadobestandardencoding':
9184 - return 'Adobe-Standard-Encoding';
9186 - case 'adobesymbolencoding':
9187 - case 'cshppsmath':
9188 - return 'Adobe-Symbol-Encoding';
9194 - return 'Amiga-1251';
9196 - case 'ansix31101983':
9197 - case 'csat5001983':
9198 - case 'csiso99naplps':
9201 - return 'ANSI_X3.110-1983';
9205 - case 'csiso89asmo449':
9208 - return 'ASMO_449';
9216 - return 'Big5-HKSCS';
9227 - case 'csiso4unitedkingdom':
9234 - case 'bsviewdata':
9235 - case 'csiso47bsviewdata':
9237 - return 'BS_viewdata';
9245 - case 'csaz243419851':
9246 - case 'csiso121canadian1':
9249 - return 'CSA_Z243.4-1985-1';
9252 - case 'csaz243419852':
9253 - case 'csiso122canadian2':
9256 - return 'CSA_Z243.4-1985-2';
9258 - case 'csaz24341985gr':
9259 - case 'csiso123csaz24341985gr':
9261 - return 'CSA_Z243.4-1985-gr';
9263 - case 'csiso139csn369103':
9266 - return 'CSN_369103';
9273 - case 'csiso21german':
9278 - return 'DIN_66003';
9284 - case 'csiso646danish':
9291 - case 'csibmebcdicatde':
9292 - case 'ebcdicatde':
9293 - return 'EBCDIC-AT-DE';
9295 - case 'csebcdicatdea':
9296 - case 'ebcdicatdea':
9297 - return 'EBCDIC-AT-DE-A';
9299 - case 'csebcdiccafr':
9300 - case 'ebcdiccafr':
9301 - return 'EBCDIC-CA-FR';
9303 - case 'csebcdicdkno':
9304 - case 'ebcdicdkno':
9305 - return 'EBCDIC-DK-NO';
9307 - case 'csebcdicdknoa':
9308 - case 'ebcdicdknoa':
9309 - return 'EBCDIC-DK-NO-A';
9311 - case 'csebcdices':
9313 - return 'EBCDIC-ES';
9315 - case 'csebcdicesa':
9317 - return 'EBCDIC-ES-A';
9319 - case 'csebcdicess':
9321 - return 'EBCDIC-ES-S';
9323 - case 'csebcdicfise':
9324 - case 'ebcdicfise':
9325 - return 'EBCDIC-FI-SE';
9327 - case 'csebcdicfisea':
9328 - case 'ebcdicfisea':
9329 - return 'EBCDIC-FI-SE-A';
9331 - case 'csebcdicfr':
9333 - return 'EBCDIC-FR';
9335 - case 'csebcdicit':
9337 - return 'EBCDIC-IT';
9339 - case 'csebcdicpt':
9341 - return 'EBCDIC-PT';
9343 - case 'csebcdicuk':
9345 - return 'EBCDIC-UK';
9347 - case 'csebcdicus':
9349 - return 'EBCDIC-US';
9351 - case 'csiso111ecmacyrillic':
9352 - case 'ecmacyrillic':
9355 - return 'ECMA-cyrillic';
9357 - case 'csiso17spanish':
9363 - case 'csiso85spanish2':
9369 - case 'cseucfixwidjapanese':
9370 - case 'extendedunixcodefixedwidthforjapanese':
9371 - return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
9373 - case 'cseucpkdfmtjapanese':
9375 - case 'extendedunixcodepackedformatforjapanese':
9376 - return 'Extended_UNIX_Code_Packed_Format_for_Japanese';
9384 - case 'windows936':
9388 - case 'csiso58gb231280':
9394 - case 'csiso57gb1988':
9398 - return 'GB_1988-80';
9400 - case 'csiso153gost1976874':
9401 - case 'gost1976874':
9403 - case 'stsev35888':
9404 - return 'GOST_19768-74';
9407 - case 'csiso150greekccitt':
9408 - case 'greekccitt':
9410 - return 'greek-ccitt';
9412 - case 'csiso88greek7':
9417 - case 'csiso18greek7old':
9420 - return 'greek7-old';
9422 - case 'cshpdesktop':
9424 - return 'HP-DeskTop';
9428 - return 'HP-Legal';
9432 - return 'HP-Math8';
9434 - case 'cshppifont':
9436 - return 'HP-Pi-font';
9438 - case 'cshproman8':
9442 - return 'hp-roman8';
9445 - return 'HZ-GB-2312';
9447 - case 'csibmsymbols':
9448 - case 'ibmsymbols':
9449 - return 'IBM-Symbols';
9453 - return 'IBM-Thai';
9455 - case 'ccsid00858':
9458 - case 'pcmultilingual850euro':
9459 - return 'IBM00858';
9461 - case 'ccsid00924':
9463 - case 'ebcdiclatin9euro':
9465 - return 'IBM00924';
9467 - case 'ccsid01140':
9469 - case 'ebcdicus37euro':
9471 - return 'IBM01140';
9473 - case 'ccsid01141':
9475 - case 'ebcdicde273euro':
9477 - return 'IBM01141';
9479 - case 'ccsid01142':
9481 - case 'ebcdicdk277euro':
9482 - case 'ebcdicno277euro':
9484 - return 'IBM01142';
9486 - case 'ccsid01143':
9488 - case 'ebcdicfi278euro':
9489 - case 'ebcdicse278euro':
9491 - return 'IBM01143';
9493 - case 'ccsid01144':
9495 - case 'ebcdicit280euro':
9497 - return 'IBM01144';
9499 - case 'ccsid01145':
9501 - case 'ebcdices284euro':
9503 - return 'IBM01145';
9505 - case 'ccsid01146':
9507 - case 'ebcdicgb285euro':
9509 - return 'IBM01146';
9511 - case 'ccsid01147':
9513 - case 'ebcdicfr297euro':
9515 - return 'IBM01147';
9517 - case 'ccsid01148':
9519 - case 'ebcdicinternational500euro':
9521 - return 'IBM01148';
9523 - case 'ccsid01149':
9525 - case 'ebcdicis871euro':
9527 - return 'IBM01149';
9531 - case 'ebcdiccpca':
9532 - case 'ebcdiccpnl':
9533 - case 'ebcdiccpus':
9534 - case 'ebcdiccpwt':
9562 - case 'ebcdiccpdk':
9563 - case 'ebcdiccpno':
9569 - case 'ebcdiccpfi':
9570 - case 'ebcdiccpse':
9576 - case 'ebcdiccpit':
9588 - case 'ebcdiccpes':
9594 - case 'ebcdiccpgb':
9600 - case 'ebcdicjpkana':
9606 - case 'ebcdiccpfr':
9612 - case 'ebcdiccpar1':
9618 - case 'ebcdiccpgr':
9624 - case 'ebcdiccphe':
9630 - case 'cspc8codepage437':
9636 - case 'ebcdiccpbe':
9637 - case 'ebcdiccpch':
9642 - case 'cspc775baltic':
9648 - case 'cspc850multilingual':
9691 - case 'cspc862latinhebrew':
9733 - case 'ebcdiccproece':
9734 - case 'ebcdiccpyu':
9740 - case 'ebcdiccpis':
9746 - case 'ebcdiccyrillic':
9768 - case 'ebcdiccptr':
9774 - case 'ebcdiccpar2':
9787 - case 'csiso143iecp271':
9790 - return 'IEC_P27-1';
9792 - case 'csiso49inis':
9797 - case 'csiso50inis8':
9802 - case 'csiso51iniscyrillic':
9803 - case 'iniscyrillic':
9805 - return 'INIS-cyrillic';
9807 - case 'csinvariant':
9809 - return 'INVARIANT';
9812 - return 'ISO-2022-CN';
9814 - case 'iso2022cnext':
9815 - return 'ISO-2022-CN-EXT';
9817 - case 'csiso2022jp':
9819 - return 'ISO-2022-JP';
9821 - case 'csiso2022jp2':
9822 - case 'iso2022jp2':
9823 - return 'ISO-2022-JP-2';
9825 - case 'csiso2022kr':
9827 - return 'ISO-2022-KR';
9829 - case 'cswindows30latin1':
9830 - case 'iso88591windows30latin1':
9831 - return 'ISO-8859-1-Windows-3.0-Latin-1';
9833 - case 'cswindows31latin1':
9834 - case 'iso88591windows31latin1':
9835 - return 'ISO-8859-1-Windows-3.1-Latin-1';
9837 - case 'csisolatin2':
9841 - case 'iso885921987':
9844 - return 'ISO-8859-2';
9846 - case 'cswindows31latin2':
9847 - case 'iso88592windowslatin2':
9848 - return 'ISO-8859-2-Windows-Latin-2';
9850 - case 'csisolatin3':
9854 - case 'iso885931988':
9857 - return 'ISO-8859-3';
9859 - case 'csisolatin4':
9863 - case 'iso885941988':
9866 - return 'ISO-8859-4';
9868 - case 'csisolatincyrillic':
9873 - case 'iso885951988':
9874 - return 'ISO-8859-5';
9878 - case 'csisolatinarabic':
9883 - case 'iso885961987':
9884 - return 'ISO-8859-6';
9886 - case 'csiso88596e':
9889 - return 'ISO-8859-6-E';
9891 - case 'csiso88596i':
9894 - return 'ISO-8859-6-I';
9896 - case 'csisolatingreek':
9904 - case 'iso885971987':
9905 - return 'ISO-8859-7';
9907 - case 'csisolatinhebrew':
9912 - case 'iso885981988':
9913 - return 'ISO-8859-8';
9915 - case 'csiso88598e':
9918 - return 'ISO-8859-8-E';
9920 - case 'csiso88598i':
9923 - return 'ISO-8859-8-I';
9925 - case 'cswindows31latin5':
9926 - case 'iso88599windowslatin5':
9927 - return 'ISO-8859-9-Windows-Latin-5';
9929 - case 'csisolatin6':
9932 - case 'iso8859101992':
9935 - return 'ISO-8859-10';
9938 - return 'ISO-8859-13';
9944 - case 'iso8859141998':
9947 - return 'ISO-8859-14';
9952 - return 'ISO-8859-15';
9957 - case 'iso8859162001':
9960 - return 'ISO-8859-16';
9962 - case 'iso10646j1':
9963 - return 'ISO-10646-J-1';
9966 - case 'iso10646ucs2':
9967 - return 'ISO-10646-UCS-2';
9970 - case 'iso10646ucs4':
9971 - return 'ISO-10646-UCS-4';
9973 - case 'csunicodeascii':
9974 - case 'iso10646ucsbasic':
9975 - return 'ISO-10646-UCS-Basic';
9977 - case 'csunicodelatin1':
9979 - case 'iso10646unicodelatin1':
9980 - return 'ISO-10646-Unicode-Latin1';
9982 - case 'csiso10646utf1':
9983 - case 'iso10646utf1':
9984 - return 'ISO-10646-UTF-1';
9986 - case 'csiso115481':
9989 - case 'isotr115481':
9990 - return 'ISO-11548-1';
9994 - return 'iso-ir-90';
9996 - case 'csunicodeibm1261':
9997 - case 'isounicodeibm1261':
9998 - return 'ISO-Unicode-IBM-1261';
10000 - case 'csunicodeibm1264':
10001 - case 'isounicodeibm1264':
10002 - return 'ISO-Unicode-IBM-1264';
10004 - case 'csunicodeibm1265':
10005 - case 'isounicodeibm1265':
10006 - return 'ISO-Unicode-IBM-1265';
10008 - case 'csunicodeibm1268':
10009 - case 'isounicodeibm1268':
10010 - return 'ISO-Unicode-IBM-1268';
10012 - case 'csunicodeibm1276':
10013 - case 'isounicodeibm1276':
10014 - return 'ISO-Unicode-IBM-1276';
10016 - case 'csiso646basic1983':
10017 - case 'iso646basic1983':
10019 - return 'ISO_646.basic:1983';
10021 - case 'csiso2intlrefversion':
10024 - case 'iso646irv1983':
10025 - return 'ISO_646.irv:1983';
10027 - case 'csiso2033':
10030 - case 'iso20331983':
10031 - return 'ISO_2033-1983';
10033 - case 'csiso5427cyrillic':
10036 - return 'ISO_5427';
10039 - case 'iso5427cyrillic1981':
10040 - case 'iso54271981':
10041 - return 'ISO_5427:1981';
10043 - case 'csiso5428greek':
10045 - case 'iso54281980':
10046 - return 'ISO_5428:1980';
10048 - case 'csiso6937add':
10050 - case 'iso6937225':
10051 - return 'ISO_6937-2-25';
10053 - case 'csisotextcomm':
10055 - case 'iso69372add':
10056 - return 'ISO_6937-2-add';
10058 - case 'csiso8859supp':
10060 - case 'iso8859supp':
10062 - return 'ISO_8859-supp';
10064 - case 'csiso10367box':
10066 - case 'iso10367box':
10067 - return 'ISO_10367-box';
10069 - case 'csiso15italian':
10075 - case 'csiso13jisc6220jp':
10077 - case 'jisc62201969':
10078 - case 'jisc62201969jp':
10081 - return 'JIS_C6220-1969-jp';
10083 - case 'csiso14jisc6220ro':
10086 - case 'jisc62201969ro':
10088 - return 'JIS_C6220-1969-ro';
10090 - case 'csiso42jisc62261978':
10092 - case 'jisc62261978':
10093 - return 'JIS_C6226-1978';
10095 - case 'csiso87jisx0208':
10097 - case 'jisc62261983':
10098 - case 'jisx02081983':
10100 - return 'JIS_C6226-1983';
10102 - case 'csiso91jisc62291984a':
10104 - case 'jisc62291984a':
10106 - return 'JIS_C6229-1984-a';
10108 - case 'csiso92jisc62991984b':
10110 - case 'iso646jpocrb':
10111 - case 'jisc62291984b':
10113 - return 'JIS_C6229-1984-b';
10115 - case 'csiso93jis62291984badd':
10117 - case 'jisc62291984badd':
10118 - case 'jpocrbadd':
10119 - return 'JIS_C6229-1984-b-add';
10121 - case 'csiso94jis62291984hand':
10123 - case 'jisc62291984hand':
10124 - case 'jpocrhand':
10125 - return 'JIS_C6229-1984-hand';
10127 - case 'csiso95jis62291984handadd':
10129 - case 'jisc62291984handadd':
10130 - case 'jpocrhandadd':
10131 - return 'JIS_C6229-1984-hand-add';
10133 - case 'csiso96jisc62291984kana':
10135 - case 'jisc62291984kana':
10136 - return 'JIS_C6229-1984-kana';
10138 - case 'csjisencoding':
10139 - case 'jisencoding':
10140 - return 'JIS_Encoding';
10142 - case 'cshalfwidthkatakana':
10145 - return 'JIS_X0201';
10147 - case 'csiso159jisx02121990':
10149 - case 'jisx02121990':
10151 - return 'JIS_X0212-1990';
10153 - case 'csiso141jusib1002':
10157 - case 'jusib1002':
10159 - return 'JUS_I.B1.002';
10161 - case 'csiso147macedonian':
10163 - case 'jusib1003mac':
10164 - case 'macedonian':
10165 - return 'JUS_I.B1.003-mac';
10167 - case 'csiso146serbian':
10169 - case 'jusib1003serb':
10171 - return 'JUS_I.B1.003-serb';
10173 - case 'koi7switched':
10174 - return 'KOI7-switched';
10183 - case 'csksc5636':
10186 - return 'KSC5636';
10191 - case 'strk10482002':
10192 - return 'KZ-1048';
10194 - case 'csiso19latingreek':
10196 - case 'latingreek':
10197 - return 'latin-greek';
10199 - case 'csiso27latingreek1':
10201 - case 'latingreek1':
10202 - return 'Latin-greek-1';
10204 - case 'csiso158lap':
10208 - return 'latin-lap';
10210 - case 'csmacintosh':
10212 - case 'macintosh':
10213 - return 'macintosh';
10215 - case 'csmicrosoftpublishing':
10216 - case 'microsoftpublishing':
10217 - return 'Microsoft-Publishing';
10223 - case 'csmnemonic':
10225 - return 'MNEMONIC';
10227 - case 'csiso86hungarian':
10232 - return 'MSZ_7795.3';
10234 - case 'csnatsdano':
10237 - return 'NATS-DANO';
10239 - case 'csnatsdanoadd':
10241 - case 'natsdanoadd':
10242 - return 'NATS-DANO-ADD';
10244 - case 'csnatssefi':
10247 - return 'NATS-SEFI';
10249 - case 'csnatssefiadd':
10251 - case 'natssefiadd':
10252 - return 'NATS-SEFI-ADD';
10254 - case 'csiso151cuba':
10258 - case 'ncnc001081':
10259 - return 'NC_NC00-10:81';
10261 - case 'csiso69french':
10266 - return 'NF_Z_62-010';
10268 - case 'csiso25french':
10270 - case 'iso646fr1':
10271 - case 'nfz620101973':
10272 - return 'NF_Z_62-010_(1973)';
10274 - case 'csiso60danishnorwegian':
10275 - case 'csiso60norwegian1':
10280 - return 'NS_4551-1';
10282 - case 'csiso61norwegian2':
10284 - case 'iso646no2':
10287 - return 'NS_4551-2';
10289 - case 'osdebcdicdf03irv':
10290 - return 'OSD_EBCDIC_DF03_IRV';
10292 - case 'osdebcdicdf041':
10293 - return 'OSD_EBCDIC_DF04_1';
10295 - case 'osdebcdicdf0415':
10296 - return 'OSD_EBCDIC_DF04_15';
10298 - case 'cspc8danishnorwegian':
10299 - case 'pc8danishnorwegian':
10300 - return 'PC8-Danish-Norwegian';
10302 - case 'cspc8turkish':
10303 - case 'pc8turkish':
10304 - return 'PC8-Turkish';
10306 - case 'csiso16portuguese':
10312 - case 'csiso84portuguese2':
10314 - case 'iso646pt2':
10319 - case 'csptcp154':
10320 - case 'cyrillicasian':
10323 - return 'PTCP154';
10328 - case 'csiso10swedish':
10334 - case 'sen850200b':
10335 - return 'SEN_850200_B';
10337 - case 'csiso11swedishfornames':
10339 - case 'iso646se2':
10341 - case 'sen850200c':
10342 - return 'SEN_850200_C';
10344 - case 'csshiftjis':
10347 - return 'Shift_JIS';
10349 - case 'csiso102t617bit':
10352 - return 'T.61-7bit';
10354 - case 'csiso103t618bit':
10358 - return 'T.61-8bit';
10360 - case 'csiso128t101g2':
10363 - return 'T.101-G2';
10369 - case 'csunicode11':
10370 - case 'unicode11':
10371 - return 'UNICODE-1-1';
10373 - case 'csunicode11utf7':
10374 - case 'unicode11utf7':
10375 - return 'UNICODE-1-1-UTF-7';
10377 - case 'csunknown8bit':
10378 - case 'unknown8bit':
10379 - return 'UNKNOWN-8BIT';
10381 - case 'ansix341968':
10382 - case 'ansix341986':
10389 - case 'iso646irv1991':
10392 - return 'US-ASCII';
10408 - return 'UTF-16BE';
10411 - return 'UTF-16LE';
10417 - return 'UTF-32BE';
10420 - return 'UTF-32LE';
10422 - case 'csventurainternational':
10423 - case 'venturainternational':
10424 - return 'Ventura-International';
10426 - case 'csventuramath':
10427 - case 'venturamath':
10428 - return 'Ventura-Math';
10430 - case 'csventuraus':
10431 - case 'venturaus':
10432 - return 'Ventura-US';
10434 - case 'csiso70videotexsupp1':
10436 - case 'videotexsuppl':
10437 - return 'videotex-suppl';
10447 - case 'cswindows31j':
10448 - case 'windows31j':
10449 - return 'Windows-31J';
10451 - case 'iso885911':
10453 - return 'Windows-874';
10457 - case 'windows949':
10458 - case 'csksc56011987':
10462 - case 'ksc56011987':
10463 - case 'ksc56011989':
10464 - return 'Windows-949';
10466 - case 'windows1250':
10467 - return 'windows-1250';
10469 - case 'windows1251':
10470 - return 'windows-1251';
10473 - case 'csisolatin1':
10477 - case 'iso885911987':
10480 - case 'windows1252':
10481 - return 'Windows-1252';
10483 - case 'windows1252':
10484 - return 'windows-1252';
10486 - case 'windows1253':
10487 - return 'windows-1253';
10489 - case 'csisolatin5':
10492 - case 'iso885991989':
10495 - case 'windows1254':
10496 - return 'Windows-1254';
10498 - case 'windows1254':
10499 - return 'windows-1254';
10501 - case 'windows1255':
10502 - return 'windows-1255';
10504 - case 'windows1256':
10505 - return 'windows-1256';
10507 - case 'windows1257':
10508 - return 'windows-1257';
10510 - case 'windows1258':
10511 - return 'windows-1258';
10518 - function get_curl_version()
10520 - if (is_array($curl = curl_version()))
10522 - $curl = $curl['version'];
10524 - elseif (substr($curl, 0, 5) == 'curl/')
10526 - $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5));
10528 - elseif (substr($curl, 0, 8) == 'libcurl/')
10530 - $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8));
10539 - function is_subclass_of($class1, $class2)
10541 - if (func_num_args() != 2)
10543 - trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING);
10545 - elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1))
10547 - return is_subclass_of($class1, $class2);
10549 - elseif (is_string($class1) && is_string($class2))
10551 - if (class_exists($class1))
10553 - if (class_exists($class2))
10555 - $class2 = strtolower($class2);
10556 - while ($class1 = strtolower(get_parent_class($class1)))
10558 - if ($class1 == $class2)
10567 - trigger_error('Unknown class passed as parameter', E_USER_WARNNG);
10574 - * Strip HTML comments
10577 - * @param string $data Data to strip comments from
10578 - * @return string Comment stripped string
10580 - function strip_comments($data)
10583 - while (($start = strpos($data, '<!--')) !== false)
10585 - $output .= substr($data, 0, $start);
10586 - if (($end = strpos($data, '-->', $start)) !== false)
10588 - $data = substr_replace($data, '', 0, $end + 3);
10595 - return $output . $data;
10598 - function parse_date($dt)
10600 - $parser = SimplePie_Parse_Date::get();
10601 - return $parser->parse($dt);
10605 - * Decode HTML entities
10609 - * @param string $data Input data
10610 - * @return string Output data
10612 - function entities_decode($data)
10614 - $decoder = new SimplePie_Decode_HTML_Entities($data);
10615 - return $decoder->parse();
10619 - * Remove RFC822 comments
10622 - * @param string $data Data to strip comments from
10623 - * @return string Comment stripped string
10625 - function uncomment_rfc822($string)
10627 - $string = (string) $string;
10629 - $length = strlen($string);
10634 - while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
10636 - $output .= substr($string, $position, $pos - $position);
10637 - $position = $pos + 1;
10638 - if ($string[$pos - 1] !== '\\')
10641 - while ($depth && $position < $length)
10643 - $position += strcspn($string, '()', $position);
10644 - if ($string[$position - 1] === '\\')
10649 - elseif (isset($string[$position]))
10651 - switch ($string[$position])
10674 - $output .= substr($string, $position);
10679 - function parse_mime($mime)
10681 - if (($pos = strpos($mime, ';')) === false)
10683 - return trim($mime);
10687 - return trim(substr($mime, 0, $pos));
10691 - function htmlspecialchars_decode($string, $quote_style)
10693 - if (function_exists('htmlspecialchars_decode'))
10695 - return htmlspecialchars_decode($string, $quote_style);
10699 - return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
10703 - function atom_03_construct_type($attribs)
10705 - if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) == 'base64'))
10707 - $mode = SIMPLEPIE_CONSTRUCT_BASE64;
10711 - $mode = SIMPLEPIE_CONSTRUCT_NONE;
10713 - if (isset($attribs['']['type']))
10715 - switch (strtolower(trim($attribs['']['type'])))
10718 - case 'text/plain':
10719 - return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
10722 - case 'text/html':
10723 - return SIMPLEPIE_CONSTRUCT_HTML | $mode;
10726 - case 'application/xhtml+xml':
10727 - return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
10730 - return SIMPLEPIE_CONSTRUCT_NONE | $mode;
10735 - return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
10739 - static function atom_10_construct_type($attribs)
10741 - if (isset($attribs['']['type']))
10743 - switch (strtolower(trim($attribs['']['type'])))
10746 - return SIMPLEPIE_CONSTRUCT_TEXT;
10749 - return SIMPLEPIE_CONSTRUCT_HTML;
10752 - return SIMPLEPIE_CONSTRUCT_XHTML;
10755 - return SIMPLEPIE_CONSTRUCT_NONE;
10758 - return SIMPLEPIE_CONSTRUCT_TEXT;
10761 - function atom_10_content_construct_type($attribs)
10763 - if (isset($attribs['']['type']))
10765 - $type = strtolower(trim($attribs['']['type']));
10769 - return SIMPLEPIE_CONSTRUCT_TEXT;
10772 - return SIMPLEPIE_CONSTRUCT_HTML;
10775 - return SIMPLEPIE_CONSTRUCT_XHTML;
10777 - if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) == 'text/')
10779 - return SIMPLEPIE_CONSTRUCT_NONE;
10783 - return SIMPLEPIE_CONSTRUCT_BASE64;
10788 - return SIMPLEPIE_CONSTRUCT_TEXT;
10792 - static function is_isegment_nz_nc($string)
10794 - return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string);
10797 - function space_seperated_tokens($string)
10799 - $space_characters = "\x20\x09\x0A\x0B\x0C\x0D";
10800 - $string_length = strlen($string);
10802 - $position = strspn($string, $space_characters);
10803 - $tokens = array();
10805 - while ($position < $string_length)
10807 - $len = strcspn($string, $space_characters, $position);
10808 - $tokens[] = substr($string, $position, $len);
10809 - $position += $len;
10810 - $position += strspn($string, $space_characters, $position);
10816 - function array_unique($array)
10818 - if (version_compare(PHP_VERSION, '5.2', '>='))
10820 - return array_unique($array);
10824 - $array = (array) $array;
10825 - $new_array = array();
10826 - $new_array_strings = array();
10827 - foreach ($array as $key => $value)
10829 - if (is_object($value))
10831 - if (method_exists($value, '__toString'))
10833 - $cmp = $value->__toString();
10837 - trigger_error('Object of class ' . get_class($value) . ' could not be converted to string', E_USER_ERROR);
10840 - elseif (is_array($value))
10842 - $cmp = (string) reset($value);
10846 - $cmp = (string) $value;
10848 - if (!in_array($cmp, $new_array_strings))
10850 - $new_array[$key] = $value;
10851 - $new_array_strings[] = $cmp;
10854 - return $new_array;
10859 - * Converts a unicode codepoint to a UTF-8 character
10863 - * @param int $codepoint Unicode codepoint
10864 - * @return string UTF-8 character
10866 - function codepoint_to_utf8($codepoint)
10868 - static $cache = array();
10869 - $codepoint = (int) $codepoint;
10870 - if (isset($cache[$codepoint]))
10872 - return $cache[$codepoint];
10874 - elseif ($codepoint < 0)
10876 - return $cache[$codepoint] = false;
10878 - else if ($codepoint <= 0x7f)
10880 - return $cache[$codepoint] = chr($codepoint);
10882 - else if ($codepoint <= 0x7ff)
10884 - return $cache[$codepoint] = chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
10886 - else if ($codepoint <= 0xffff)
10888 - return $cache[$codepoint] = chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
10890 - else if ($codepoint <= 0x10ffff)
10892 - return $cache[$codepoint] = chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
10896 - // U+FFFD REPLACEMENT CHARACTER
10897 - return $cache[$codepoint] = "\xEF\xBF\xBD";
10902 - * Re-implementation of PHP 5's stripos()
10904 - * Returns the numeric position of the first occurrence of needle in the
10905 - * haystack string.
10909 - * @param object $haystack
10910 - * @param string $needle Note that the needle may be a string of one or more
10911 - * characters. If needle is not a string, it is converted to an integer
10912 - * and applied as the ordinal value of a character.
10913 - * @param int $offset The optional offset parameter allows you to specify which
10914 - * character in haystack to start searching. The position returned is still
10915 - * relative to the beginning of haystack.
10916 - * @return bool If needle is not found, stripos() will return boolean false.
10918 - function stripos($haystack, $needle, $offset = 0)
10920 - if (function_exists('stripos'))
10922 - return stripos($haystack, $needle, $offset);
10926 - if (is_string($needle))
10928 - $needle = strtolower($needle);
10930 - elseif (is_int($needle) || is_bool($needle) || is_double($needle))
10932 - $needle = strtolower(chr($needle));
10936 - trigger_error('needle is not a string or an integer', E_USER_WARNING);
10940 - return strpos(strtolower($haystack), $needle, $offset);
10945 - * Similar to parse_str()
10947 - * Returns an associative array of name/value pairs, where the value is an
10948 - * array of values that have used the same name
10952 - * @param string $str The input string.
10955 - function parse_str($str)
10957 - $return = array();
10958 - $str = explode('&', $str);
10960 - foreach ($str as $section)
10962 - if (strpos($section, '=') !== false)
10964 - list($name, $value) = explode('=', $section, 2);
10965 - $return[urldecode($name)][] = urldecode($value);
10969 - $return[urldecode($section)][] = null;
10977 - * Detect XML encoding, as per XML 1.0 Appendix F.1
10979 - * @todo Add support for EBCDIC
10980 - * @param string $data XML data
10981 - * @return array Possible encodings
10983 - static function xml_encoding($data)
10985 - // UTF-32 Big Endian BOM
10986 - if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
10988 - $encoding[] = 'UTF-32BE';
10990 - // UTF-32 Little Endian BOM
10991 - elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
10993 - $encoding[] = 'UTF-32LE';
10995 - // UTF-16 Big Endian BOM
10996 - elseif (substr($data, 0, 2) === "\xFE\xFF")
10998 - $encoding[] = 'UTF-16BE';
11000 - // UTF-16 Little Endian BOM
11001 - elseif (substr($data, 0, 2) === "\xFF\xFE")
11003 - $encoding[] = 'UTF-16LE';
11006 - elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
11008 - $encoding[] = 'UTF-8';
11010 - // UTF-32 Big Endian Without BOM
11011 - elseif (substr($data, 0, 20) === "\x00\x00\x00\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C")
11013 - if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E"))
11015 - $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
11016 - if ($parser->parse())
11018 - $encoding[] = $parser->encoding;
11021 - $encoding[] = 'UTF-32BE';
11023 - // UTF-32 Little Endian Without BOM
11024 - elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00")
11026 - if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00"))
11028 - $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
11029 - if ($parser->parse())
11031 - $encoding[] = $parser->encoding;
11034 - $encoding[] = 'UTF-32LE';
11036 - // UTF-16 Big Endian Without BOM
11037 - elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C")
11039 - if ($pos = strpos($data, "\x00\x3F\x00\x3E"))
11041 - $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
11042 - if ($parser->parse())
11044 - $encoding[] = $parser->encoding;
11047 - $encoding[] = 'UTF-16BE';
11049 - // UTF-16 Little Endian Without BOM
11050 - elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00")
11052 - if ($pos = strpos($data, "\x3F\x00\x3E\x00"))
11054 - $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
11055 - if ($parser->parse())
11057 - $encoding[] = $parser->encoding;
11060 - $encoding[] = 'UTF-16LE';
11062 - // US-ASCII (or superset)
11063 - elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C")
11065 - if ($pos = strpos($data, "\x3F\x3E"))
11067 - $parser = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
11068 - if ($parser->parse())
11070 - $encoding[] = $parser->encoding;
11073 - $encoding[] = 'UTF-8';
11075 - // Fallback to UTF-8
11078 - $encoding[] = 'UTF-8';
11080 - return $encoding;
11085 - * Decode HTML Entities
11087 - * This implements HTML5 as of revision 967 (2007-06-28)
11089 - * @package SimplePie
11091 -class SimplePie_Decode_HTML_Entities
11094 - * Data to be parsed
11096 - * @access private
11102 - * Currently consumed bytes
11104 - * @access private
11107 - var $consumed = '';
11110 - * Position of the current byte being parsed
11112 - * @access private
11115 - var $position = 0;
11118 - * Create an instance of the class with the input data
11121 - * @param string $data Input data
11123 - function SimplePie_Decode_HTML_Entities($data)
11125 - $this->data = $data;
11129 - * Parse the input data
11132 - * @return string Output data
11136 - while (($this->position = strpos($this->data, '&', $this->position)) !== false)
11138 - $this->consume();
11140 - $this->consumed = '';
11142 - return $this->data;
11146 - * Consume the next byte
11148 - * @access private
11149 - * @return mixed The next byte, or false, if there is no more data
11151 - function consume()
11153 - if (isset($this->data[$this->position]))
11155 - $this->consumed .= $this->data[$this->position];
11156 - return $this->data[$this->position++];
11160 - $this->consumed = false;
11166 - * Consume a range of characters
11168 - * @access private
11169 - * @param string $chars Characters to consume
11170 - * @return mixed A series of characters that match the range, or false
11172 - function consume_range($chars)
11174 - if ($len = strspn($this->data, $chars, $this->position))
11176 - $data = substr($this->data, $this->position, $len);
11177 - $this->consumed .= $data;
11178 - $this->position += $len;
11183 - $this->consumed = false;
11189 - * Unconsume one byte
11191 - * @access private
11193 - function unconsume()
11195 - $this->consumed = substr($this->consumed, 0, -1);
11196 - $this->position--;
11200 - * Decode an entity
11202 - * @access private
11204 - function entity()
11206 - switch ($this->consume())
11220 - switch ($this->consume())
11224 - $range = '0123456789ABCDEFabcdef';
11229 - $range = '0123456789';
11231 - $this->unconsume();
11235 - if ($codepoint = $this->consume_range($range))
11237 - static $windows_1252_specials = array(0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8");
11241 - $codepoint = hexdec($codepoint);
11245 - $codepoint = intval($codepoint);
11248 - if (isset($windows_1252_specials[$codepoint]))
11250 - $replacement = $windows_1252_specials[$codepoint];
11254 - $replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
11257 - if ($this->consume() != ';')
11259 - $this->unconsume();
11262 - $consumed_length = strlen($this->consumed);
11263 - $this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
11264 - $this->position += strlen($replacement) - $consumed_length;
11269 - static $entities = array('Aacute' => "\xC3\x81", 'aacute' => "\xC3\xA1", 'Aacute;' => "\xC3\x81", 'aacute;' => "\xC3\xA1", 'Acirc' => "\xC3\x82", 'acirc' => "\xC3\xA2", 'Acirc;' => "\xC3\x82", 'acirc;' => "\xC3\xA2", 'acute' => "\xC2\xB4", 'acute;' => "\xC2\xB4", 'AElig' => "\xC3\x86", 'aelig' => "\xC3\xA6", 'AElig;' => "\xC3\x86", 'aelig;' => "\xC3\xA6", 'Agrave' => "\xC3\x80", 'agrave' => "\xC3\xA0", 'Agrave;' => "\xC3\x80", 'agrave;' => "\xC3\xA0", 'alefsym;' => "\xE2\x84\xB5", 'Alpha;' => "\xCE\x91", 'alpha;' => "\xCE\xB1", 'AMP' => "\x26", 'amp' => "\x26", 'AMP;' => "\x26", 'amp;' => "\x26", 'and;' => "\xE2\x88\xA7", 'ang;' => "\xE2\x88\xA0", 'apos;' => "\x27", 'Aring' => "\xC3\x85", 'aring' => "\xC3\xA5", 'Aring;' => "\xC3\x85", 'aring;' => "\xC3\xA5", 'asymp;' => "\xE2\x89\x88", 'Atilde' => "\xC3\x83", 'atilde' => "\xC3\xA3", 'Atilde;' => "\xC3\x83", 'atilde;' => "\xC3\xA3", 'Auml' => "\xC3\x84", 'auml' => "\xC3\xA4", 'Auml;' => "\xC3\x84", 'auml;' => "\xC3\xA4", 'bdquo;' => "\xE2\x80\x9E", 'Beta;' => "\xCE\x92", 'beta;' => "\xCE\xB2", 'brvbar' => "\xC2\xA6", 'brvbar;' => "\xC2\xA6", 'bull;' => "\xE2\x80\xA2", 'cap;' => "\xE2\x88\xA9", 'Ccedil' => "\xC3\x87", 'ccedil' => "\xC3\xA7", 'Ccedil;' => "\xC3\x87", 'ccedil;' => "\xC3\xA7", 'cedil' => "\xC2\xB8", 'cedil;' => "\xC2\xB8", 'cent' => "\xC2\xA2", 'cent;' => "\xC2\xA2", 'Chi;' => "\xCE\xA7", 'chi;' => "\xCF\x87", 'circ;' => "\xCB\x86", 'clubs;' => "\xE2\x99\xA3", 'cong;' => "\xE2\x89\x85", 'COPY' => "\xC2\xA9", 'copy' => "\xC2\xA9", 'COPY;' => "\xC2\xA9", 'copy;' => "\xC2\xA9", 'crarr;' => "\xE2\x86\xB5", 'cup;' => "\xE2\x88\xAA", 'curren' => "\xC2\xA4", 'curren;' => "\xC2\xA4", 'Dagger;' => "\xE2\x80\xA1", 'dagger;' => "\xE2\x80\xA0", 'dArr;' => "\xE2\x87\x93", 'darr;' => "\xE2\x86\x93", 'deg' => "\xC2\xB0", 'deg;' => "\xC2\xB0", 'Delta;' => "\xCE\x94", 'delta;' => "\xCE\xB4", 'diams;' => "\xE2\x99\xA6", 'divide' => "\xC3\xB7", 'divide;' => "\xC3\xB7", 'Eacute' => "\xC3\x89", 'eacute' => "\xC3\xA9", 'Eacute;' => "\xC3\x89", 'eacute;' => "\xC3\xA9", 'Ecirc' => "\xC3\x8A", 'ecirc' => "\xC3\xAA", 'Ecirc;' => "\xC3\x8A", 'ecirc;' => "\xC3\xAA", 'Egrave' => "\xC3\x88", 'egrave' => "\xC3\xA8", 'Egrave;' => "\xC3\x88", 'egrave;' => "\xC3\xA8", 'empty;' => "\xE2\x88\x85", 'emsp;' => "\xE2\x80\x83", 'ensp;' => "\xE2\x80\x82", 'Epsilon;' => "\xCE\x95", 'epsilon;' => "\xCE\xB5", 'equiv;' => "\xE2\x89\xA1", 'Eta;' => "\xCE\x97", 'eta;' => "\xCE\xB7", 'ETH' => "\xC3\x90", 'eth' => "\xC3\xB0", 'ETH;' => "\xC3\x90", 'eth;' => "\xC3\xB0", 'Euml' => "\xC3\x8B", 'euml' => "\xC3\xAB", 'Euml;' => "\xC3\x8B", 'euml;' => "\xC3\xAB", 'euro;' => "\xE2\x82\xAC", 'exist;' => "\xE2\x88\x83", 'fnof;' => "\xC6\x92", 'forall;' => "\xE2\x88\x80", 'frac12' => "\xC2\xBD", 'frac12;' => "\xC2\xBD", 'frac14' => "\xC2\xBC", 'frac14;' => "\xC2\xBC", 'frac34' => "\xC2\xBE", 'frac34;' => "\xC2\xBE", 'frasl;' => "\xE2\x81\x84", 'Gamma;' => "\xCE\x93", 'gamma;' => "\xCE\xB3", 'ge;' => "\xE2\x89\xA5", 'GT' => "\x3E", 'gt' => "\x3E", 'GT;' => "\x3E", 'gt;' => "\x3E", 'hArr;' => "\xE2\x87\x94", 'harr;' => "\xE2\x86\x94", 'hearts;' => "\xE2\x99\xA5", 'hellip;' => "\xE2\x80\xA6", 'Iacute' => "\xC3\x8D", 'iacute' => "\xC3\xAD", 'Iacute;' => "\xC3\x8D", 'iacute;' => "\xC3\xAD", 'Icirc' => "\xC3\x8E", 'icirc' => "\xC3\xAE", 'Icirc;' => "\xC3\x8E", 'icirc;' => "\xC3\xAE", 'iexcl' => "\xC2\xA1", 'iexcl;' => "\xC2\xA1", 'Igrave' => "\xC3\x8C", 'igrave' => "\xC3\xAC", 'Igrave;' => "\xC3\x8C", 'igrave;' => "\xC3\xAC", 'image;' => "\xE2\x84\x91", 'infin;' => "\xE2\x88\x9E", 'int;' => "\xE2\x88\xAB", 'Iota;' => "\xCE\x99", 'iota;' => "\xCE\xB9", 'iquest' => "\xC2\xBF", 'iquest;' => "\xC2\xBF", 'isin;' => "\xE2\x88\x88", 'Iuml' => "\xC3\x8F", 'iuml' => "\xC3\xAF", 'Iuml;' => "\xC3\x8F", 'iuml;' => "\xC3\xAF", 'Kappa;' => "\xCE\x9A", 'kappa;' => "\xCE\xBA", 'Lambda;' => "\xCE\x9B", 'lambda;' => "\xCE\xBB", 'lang;' => "\xE3\x80\x88", 'laquo' => "\xC2\xAB", 'laquo;' => "\xC2\xAB", 'lArr;' => "\xE2\x87\x90", 'larr;' => "\xE2\x86\x90", 'lceil;' => "\xE2\x8C\x88", 'ldquo;' => "\xE2\x80\x9C", 'le;' => "\xE2\x89\xA4", 'lfloor;' => "\xE2\x8C\x8A", 'lowast;' => "\xE2\x88\x97", 'loz;' => "\xE2\x97\x8A", 'lrm;' => "\xE2\x80\x8E", 'lsaquo;' => "\xE2\x80\xB9", 'lsquo;' => "\xE2\x80\x98", 'LT' => "\x3C", 'lt' => "\x3C", 'LT;' => "\x3C", 'lt;' => "\x3C", 'macr' => "\xC2\xAF", 'macr;' => "\xC2\xAF", 'mdash;' => "\xE2\x80\x94", 'micro' => "\xC2\xB5", 'micro;' => "\xC2\xB5", 'middot' => "\xC2\xB7", 'middot;' => "\xC2\xB7", 'minus;' => "\xE2\x88\x92", 'Mu;' => "\xCE\x9C", 'mu;' => "\xCE\xBC", 'nabla;' => "\xE2\x88\x87", 'nbsp' => "\xC2\xA0", 'nbsp;' => "\xC2\xA0", 'ndash;' => "\xE2\x80\x93", 'ne;' => "\xE2\x89\xA0", 'ni;' => "\xE2\x88\x8B", 'not' => "\xC2\xAC", 'not;' => "\xC2\xAC", 'notin;' => "\xE2\x88\x89", 'nsub;' => "\xE2\x8A\x84", 'Ntilde' => "\xC3\x91", 'ntilde' => "\xC3\xB1", 'Ntilde;' => "\xC3\x91", 'ntilde;' => "\xC3\xB1", 'Nu;' => "\xCE\x9D", 'nu;' => "\xCE\xBD", 'Oacute' => "\xC3\x93", 'oacute' => "\xC3\xB3", 'Oacute;' => "\xC3\x93", 'oacute;' => "\xC3\xB3", 'Ocirc' => "\xC3\x94", 'ocirc' => "\xC3\xB4", 'Ocirc;' => "\xC3\x94", 'ocirc;' => "\xC3\xB4", 'OElig;' => "\xC5\x92", 'oelig;' => "\xC5\x93", 'Ograve' => "\xC3\x92", 'ograve' => "\xC3\xB2", 'Ograve;' => "\xC3\x92", 'ograve;' => "\xC3\xB2", 'oline;' => "\xE2\x80\xBE", 'Omega;' => "\xCE\xA9", 'omega;' => "\xCF\x89", 'Omicron;' => "\xCE\x9F", 'omicron;' => "\xCE\xBF", 'oplus;' => "\xE2\x8A\x95", 'or;' => "\xE2\x88\xA8", 'ordf' => "\xC2\xAA", 'ordf;' => "\xC2\xAA", 'ordm' => "\xC2\xBA", 'ordm;' => "\xC2\xBA", 'Oslash' => "\xC3\x98", 'oslash' => "\xC3\xB8", 'Oslash;' => "\xC3\x98", 'oslash;' => "\xC3\xB8", 'Otilde' => "\xC3\x95", 'otilde' => "\xC3\xB5", 'Otilde;' => "\xC3\x95", 'otilde;' => "\xC3\xB5", 'otimes;' => "\xE2\x8A\x97", 'Ouml' => "\xC3\x96", 'ouml' => "\xC3\xB6", 'Ouml;' => "\xC3\x96", 'ouml;' => "\xC3\xB6", 'para' => "\xC2\xB6", 'para;' => "\xC2\xB6", 'part;' => "\xE2\x88\x82", 'permil;' => "\xE2\x80\xB0", 'perp;' => "\xE2\x8A\xA5", 'Phi;' => "\xCE\xA6", 'phi;' => "\xCF\x86", 'Pi;' => "\xCE\xA0", 'pi;' => "\xCF\x80", 'piv;' => "\xCF\x96", 'plusmn' => "\xC2\xB1", 'plusmn;' => "\xC2\xB1", 'pound' => "\xC2\xA3", 'pound;' => "\xC2\xA3", 'Prime;' => "\xE2\x80\xB3", 'prime;' => "\xE2\x80\xB2", 'prod;' => "\xE2\x88\x8F", 'prop;' => "\xE2\x88\x9D", 'Psi;' => "\xCE\xA8", 'psi;' => "\xCF\x88", 'QUOT' => "\x22", 'quot' => "\x22", 'QUOT;' => "\x22", 'quot;' => "\x22", 'radic;' => "\xE2\x88\x9A", 'rang;' => "\xE3\x80\x89", 'raquo' => "\xC2\xBB", 'raquo;' => "\xC2\xBB", 'rArr;' => "\xE2\x87\x92", 'rarr;' => "\xE2\x86\x92", 'rceil;' => "\xE2\x8C\x89", 'rdquo;' => "\xE2\x80\x9D", 'real;' => "\xE2\x84\x9C", 'REG' => "\xC2\xAE", 'reg' => "\xC2\xAE", 'REG;' => "\xC2\xAE", 'reg;' => "\xC2\xAE", 'rfloor;' => "\xE2\x8C\x8B", 'Rho;' => "\xCE\xA1", 'rho;' => "\xCF\x81", 'rlm;' => "\xE2\x80\x8F", 'rsaquo;' => "\xE2\x80\xBA", 'rsquo;' => "\xE2\x80\x99", 'sbquo;' => "\xE2\x80\x9A", 'Scaron;' => "\xC5\xA0", 'scaron;' => "\xC5\xA1", 'sdot;' => "\xE2\x8B\x85", 'sect' => "\xC2\xA7", 'sect;' => "\xC2\xA7", 'shy' => "\xC2\xAD", 'shy;' => "\xC2\xAD", 'Sigma;' => "\xCE\xA3", 'sigma;' => "\xCF\x83", 'sigmaf;' => "\xCF\x82", 'sim;' => "\xE2\x88\xBC", 'spades;' => "\xE2\x99\xA0", 'sub;' => "\xE2\x8A\x82", 'sube;' => "\xE2\x8A\x86", 'sum;' => "\xE2\x88\x91", 'sup;' => "\xE2\x8A\x83", 'sup1' => "\xC2\xB9", 'sup1;' => "\xC2\xB9", 'sup2' => "\xC2\xB2", 'sup2;' => "\xC2\xB2", 'sup3' => "\xC2\xB3", 'sup3;' => "\xC2\xB3", 'supe;' => "\xE2\x8A\x87", 'szlig' => "\xC3\x9F", 'szlig;' => "\xC3\x9F", 'Tau;' => "\xCE\xA4", 'tau;' => "\xCF\x84", 'there4;' => "\xE2\x88\xB4", 'Theta;' => "\xCE\x98", 'theta;' => "\xCE\xB8", 'thetasym;' => "\xCF\x91", 'thinsp;' => "\xE2\x80\x89", 'THORN' => "\xC3\x9E", 'thorn' => "\xC3\xBE", 'THORN;' => "\xC3\x9E", 'thorn;' => "\xC3\xBE", 'tilde;' => "\xCB\x9C", 'times' => "\xC3\x97", 'times;' => "\xC3\x97", 'TRADE;' => "\xE2\x84\xA2", 'trade;' => "\xE2\x84\xA2", 'Uacute' => "\xC3\x9A", 'uacute' => "\xC3\xBA", 'Uacute;' => "\xC3\x9A", 'uacute;' => "\xC3\xBA", 'uArr;' => "\xE2\x87\x91", 'uarr;' => "\xE2\x86\x91", 'Ucirc' => "\xC3\x9B", 'ucirc' => "\xC3\xBB", 'Ucirc;' => "\xC3\x9B", 'ucirc;' => "\xC3\xBB", 'Ugrave' => "\xC3\x99", 'ugrave' => "\xC3\xB9", 'Ugrave;' => "\xC3\x99", 'ugrave;' => "\xC3\xB9", 'uml' => "\xC2\xA8", 'uml;' => "\xC2\xA8", 'upsih;' => "\xCF\x92", 'Upsilon;' => "\xCE\xA5", 'upsilon;' => "\xCF\x85", 'Uuml' => "\xC3\x9C", 'uuml' => "\xC3\xBC", 'Uuml;' => "\xC3\x9C", 'uuml;' => "\xC3\xBC", 'weierp;' => "\xE2\x84\x98", 'Xi;' => "\xCE\x9E", 'xi;' => "\xCE\xBE", 'Yacute' => "\xC3\x9D", 'yacute' => "\xC3\xBD", 'Yacute;' => "\xC3\x9D", 'yacute;' => "\xC3\xBD", 'yen' => "\xC2\xA5", 'yen;' => "\xC2\xA5", 'yuml' => "\xC3\xBF", 'Yuml;' => "\xC5\xB8", 'yuml;' => "\xC3\xBF", 'Zeta;' => "\xCE\x96", 'zeta;' => "\xCE\xB6", 'zwj;' => "\xE2\x80\x8D", 'zwnj;' => "\xE2\x80\x8C");
11271 - for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++)
11273 - $consumed = substr($this->consumed, 1);
11274 - if (isset($entities[$consumed]))
11276 - $match = $consumed;
11280 - if ($match !== null)
11282 - $this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
11283 - $this->position += strlen($entities[$match]) - strlen($consumed) - 1;
11293 - * @package SimplePie
11295 -class SimplePie_Parse_Date
11300 - * @access protected
11306 - * List of days, calendar day name => ordinal day number in the week
11308 - * @access protected
11311 - var $day = array(
11318 - 'wednesday' => 3,
11331 - 'donderdag' => 4,
11347 - 'donnerstag' => 4,
11350 - 'sonnabend' => 6,
11355 - 'mercoledì' => 3,
11363 - 'miércoles' => 3,
11369 - 'maanantai' => 1,
11371 - 'keskiviikko' => 3,
11373 - 'perjantai' => 5,
11375 - 'sunnuntai' => 7,
11380 - 'csütörtok' => 4,
11395 - * List of months, calendar month name => calendar month number
11397 - * @access protected
11400 - var $month = array(
11411 - // No long form of May
11419 - 'september' => 8,
11423 - 'november' => 11,
11425 - 'december' => 12,
11435 - 'september' => 9,
11437 - 'november' => 11,
11438 - 'december' => 12,
11448 - 'septembre' => 9,
11450 - 'novembre' => 11,
11451 - 'décembre' => 12,
11461 - 'september' => 9,
11463 - 'november' => 11,
11464 - 'dezember' => 12,
11474 - 'settembre' => 9,
11476 - 'novembre' => 11,
11477 - 'dicembre' => 12,
11487 - 'septiembre' => 9,
11488 - 'setiembre' => 9,
11490 - 'noviembre' => 11,
11491 - 'diciembre' => 12,
11495 - 'maaliskuu' => 3,
11504 - 'joulukuu' => 12,
11513 - 'augusztus' => 8,
11514 - 'szeptember' => 9,
11516 - 'november' => 11,
11517 - 'december' => 12,
11540 - * List of timezones, abbreviation => offset from UTC
11542 - * @access protected
11545 - var $timezone = array(
11550 - 'ACWDT' => 35100,
11551 - 'ACWST' => 31500,
11555 - 'AKDT' => -28800,
11556 - 'AKST' => -32400,
11559 - 'ANAST' => 46800,
11562 - 'AZOST' => -3600,
11580 - 'CHADT' => 49500,
11581 - 'CHAST' => 45900,
11582 - 'CIST' => -28800,
11584 - 'CLDT' => -10800,
11585 - 'CLST' => -14400,
11592 - 'EADT' => -18000,
11593 - 'EAST' => -21600,
11603 - 'FKDT' => -10800,
11604 - 'FKST' => -14400,
11606 - 'GALT' => -21600,
11617 - 'HADT' => -32400,
11621 - 'HAST' => -36000,
11634 - 'IRKST' => 32400,
11637 - 'JFDT' => -10800,
11638 - 'JFST' => -14400,
11643 - 'KOVST' => 28800,
11645 - 'KRAST' => 28800,
11652 - 'MAGST' => 43200,
11671 - 'NOVST' => 25200,
11679 - 'OMSST' => 25200,
11683 - 'PETST' => 46800,
11690 - 'PMST' => -10800,
11694 - 'PYST' => -10800,
11697 - 'ROTT' => -10800,
11698 - 'SAMST' => 18000,
11713 - 'THAT' => -36000,
11726 - 'VLAST' => 39600,
11740 - 'YAKST' => 36000,
11743 - 'YEKST' => 21600,
11748 - * Cached PCRE for SimplePie_Parse_Date::$day
11750 - * @access protected
11756 - * Cached PCRE for SimplePie_Parse_Date::$month
11758 - * @access protected
11764 - * Array of user-added callback methods
11766 - * @access private
11769 - var $built_in = array();
11772 - * Array of user-added callback methods
11774 - * @access private
11777 - var $user = array();
11780 - * Create new SimplePie_Parse_Date object, and set self::day_pcre,
11781 - * self::month_pcre, and self::built_in
11783 - * @access private
11785 - function SimplePie_Parse_Date()
11787 - $this->day_pcre = '(' . implode(array_keys($this->day), '|') . ')';
11788 - $this->month_pcre = '(' . implode(array_keys($this->month), '|') . ')';
11791 - if (!isset($cache[get_class($this)]))
11793 - if (extension_loaded('Reflection'))
11795 - $class = new ReflectionClass(get_class($this));
11796 - $methods = $class->getMethods();
11797 - $all_methods = array();
11798 - foreach ($methods as $method)
11800 - $all_methods[] = $method->getName();
11805 - $all_methods = get_class_methods($this);
11808 - foreach ($all_methods as $method)
11810 - if (strtolower(substr($method, 0, 5)) === 'date_')
11812 - $cache[get_class($this)][] = $method;
11817 - foreach ($cache[get_class($this)] as $method)
11819 - $this->built_in[] = $method;
11828 - static function get()
11833 - $object = new SimplePie_Parse_Date;
11843 - * @param string $date Date to parse
11844 - * @return int Timestamp corresponding to date string, or false on failure
11846 - function parse($date)
11848 - foreach ($this->user as $method)
11850 - if (($returned = call_user_func($method, $date)) !== false)
11852 - return $returned;
11856 - foreach ($this->built_in as $method)
11858 - if (($returned = call_user_func(array(&$this, $method), $date)) !== false)
11860 - return $returned;
11868 - * Add a callback method to parse a date
11872 - * @param callback $callback
11874 - function add_callback($callback)
11876 - if (is_callable($callback))
11878 - $this->user[] = $callback;
11882 - trigger_error('User-supplied function must be a valid callback', E_USER_WARNING);
11887 - * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as
11888 - * well as allowing any of upper or lower case "T", horizontal tabs, or
11889 - * spaces to be used as the time seperator (including more than one))
11891 - * @access protected
11892 - * @return int Timestamp
11894 - function date_w3cdtf($date)
11899 - $year = '([0-9]{4})';
11900 - $month = $day = $hour = $minute = $second = '([0-9]{2})';
11901 - $decimal = '([0-9]*)';
11902 - $zone = '(?:(Z)|([+\-])([0-9]{1,2}):?([0-9]{1,2}))';
11903 - $pcre = '/^' . $year . '(?:-?' . $month . '(?:-?' . $day . '(?:[Tt\x09\x20]+' . $hour . '(?::?' . $minute . '(?::?' . $second . '(?:.' . $decimal . ')?)?)?' . $zone . ')?)?)?$/';
11905 - if (preg_match($pcre, $date, $match))
11908 - Capturing subpatterns:
11915 - 7: Decimal fraction of a second
11918 - 10: Timezone hours
11919 - 11: Timezone minutes
11922 - // Fill in empty matches
11923 - for ($i = count($match); $i <= 3; $i++)
11925 - $match[$i] = '1';
11928 - for ($i = count($match); $i <= 7; $i++)
11930 - $match[$i] = '0';
11933 - // Numeric timezone
11934 - if (isset($match[9]) && $match[9] !== '')
11936 - $timezone = $match[10] * 3600;
11937 - $timezone += $match[11] * 60;
11938 - if ($match[9] === '-')
11940 - $timezone = 0 - $timezone;
11948 - // Convert the number of seconds to an integer, taking decimals into account
11949 - $second = round($match[6] + $match[7] / pow(10, strlen($match[7])));
11951 - return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone;
11960 - * Remove RFC822 comments
11962 - * @access protected
11963 - * @param string $data Data to strip comments from
11964 - * @return string Comment stripped string
11966 - function remove_rfc2822_comments($string)
11968 - $string = (string) $string;
11970 - $length = strlen($string);
11975 - while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
11977 - $output .= substr($string, $position, $pos - $position);
11978 - $position = $pos + 1;
11979 - if ($string[$pos - 1] !== '\\')
11982 - while ($depth && $position < $length)
11984 - $position += strcspn($string, '()', $position);
11985 - if ($string[$position - 1] === '\\')
11990 - elseif (isset($string[$position]))
11992 - switch ($string[$position])
12015 - $output .= substr($string, $position);
12021 - * Parse RFC2822's date format
12023 - * @access protected
12024 - * @return int Timestamp
12026 - function date_rfc2822($date)
12031 - $wsp = '[\x09\x20]';
12032 - $fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)';
12033 - $optional_fws = $fws . '?';
12034 - $day_name = $this->day_pcre;
12035 - $month = $this->month_pcre;
12036 - $day = '([0-9]{1,2})';
12037 - $hour = $minute = $second = '([0-9]{2})';
12038 - $year = '([0-9]{2,4})';
12039 - $num_zone = '([+\-])([0-9]{2})([0-9]{2})';
12040 - $character_zone = '([A-Z]{1,5})';
12041 - $zone = '(?:' . $num_zone . '|' . $character_zone . ')';
12042 - $pcre = '/(?:' . $optional_fws . $day_name . $optional_fws . ',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws . ':' . $optional_fws . $minute . '(?:' . $optional_fws . ':' . $optional_fws . $second . ')?' . $fws . $zone . '/i';
12044 - if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match))
12047 - Capturing subpatterns:
12056 - 9: Timezone hours
12057 - 10: Timezone minutes
12058 - 11: Alphabetic timezone
12061 - // Find the month number
12062 - $month = $this->month[strtolower($match[3])];
12064 - // Numeric timezone
12065 - if ($match[8] !== '')
12067 - $timezone = $match[9] * 3600;
12068 - $timezone += $match[10] * 60;
12069 - if ($match[8] === '-')
12071 - $timezone = 0 - $timezone;
12074 - // Character timezone
12075 - elseif (isset($this->timezone[strtoupper($match[11])]))
12077 - $timezone = $this->timezone[strtoupper($match[11])];
12079 - // Assume everything else to be -0000
12085 - // Deal with 2/3 digit years
12086 - if ($match[4] < 50)
12088 - $match[4] += 2000;
12090 - elseif ($match[4] < 1000)
12092 - $match[4] += 1900;
12095 - // Second is optional, if it is empty set it to zero
12096 - if ($match[7] !== '')
12098 - $second = $match[7];
12105 - return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone;
12114 - * Parse RFC850's date format
12116 - * @access protected
12117 - * @return int Timestamp
12119 - function date_rfc850($date)
12124 - $space = '[\x09\x20]+';
12125 - $day_name = $this->day_pcre;
12126 - $month = $this->month_pcre;
12127 - $day = '([0-9]{1,2})';
12128 - $year = $hour = $minute = $second = '([0-9]{2})';
12129 - $zone = '([A-Z]{1,5})';
12130 - $pcre = '/^' . $day_name . ',' . $space . $day . '-' . $month . '-' . $year . $space . $hour . ':' . $minute . ':' . $second . $space . $zone . '$/i';
12132 - if (preg_match($pcre, $date, $match))
12135 - Capturing subpatterns:
12147 - $month = $this->month[strtolower($match[3])];
12149 - // Character timezone
12150 - if (isset($this->timezone[strtoupper($match[8])]))
12152 - $timezone = $this->timezone[strtoupper($match[8])];
12154 - // Assume everything else to be -0000
12160 - // Deal with 2 digit year
12161 - if ($match[4] < 50)
12163 - $match[4] += 2000;
12167 - $match[4] += 1900;
12170 - return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone;
12179 - * Parse C99's asctime()'s date format
12181 - * @access protected
12182 - * @return int Timestamp
12184 - function date_asctime($date)
12189 - $space = '[\x09\x20]+';
12190 - $wday_name = $this->day_pcre;
12191 - $mon_name = $this->month_pcre;
12192 - $day = '([0-9]{1,2})';
12193 - $hour = $sec = $min = '([0-9]{2})';
12194 - $year = '([0-9]{4})';
12195 - $terminator = '\x0A?\x00?';
12196 - $pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i';
12198 - if (preg_match($pcre, $date, $match))
12201 - Capturing subpatterns:
12211 - $month = $this->month[strtolower($match[2])];
12212 - return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]);
12221 - * Parse dates using strtotime()
12223 - * @access protected
12224 - * @return int Timestamp
12226 - function date_strtotime($date)
12228 - $strtotime = strtotime($date);
12229 - if ($strtotime === -1 || $strtotime === false)
12235 - return $strtotime;
12241 - * Content-type sniffing
12243 - * @package SimplePie
12245 -class SimplePie_Content_Type_Sniffer
12250 - * @var SimplePie_File
12251 - * @access private
12256 - * Create an instance of the class with the input file
12259 - * @param SimplePie_Content_Type_Sniffer $file Input file
12261 - function SimplePie_Content_Type_Sniffer($file)
12263 - $this->file = $file;
12267 - * Get the Content-Type of the specified file
12270 - * @return string Actual Content-Type
12272 - function get_type()
12274 - if (isset($this->file->headers['content-type']))
12276 - if (!isset($this->file->headers['content-encoding'])
12277 - && ($this->file->headers['content-type'] === 'text/plain'
12278 - || $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1'
12279 - || $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1'))
12281 - return $this->text_or_binary();
12284 - if (($pos = strpos($this->file->headers['content-type'], ';')) !== false)
12286 - $official = substr($this->file->headers['content-type'], 0, $pos);
12290 - $official = $this->file->headers['content-type'];
12292 - $official = strtolower($official);
12294 - if ($official === 'unknown/unknown'
12295 - || $official === 'application/unknown')
12297 - return $this->unknown();
12299 - elseif (substr($official, -4) === '+xml'
12300 - || $official === 'text/xml'
12301 - || $official === 'application/xml')
12303 - return $official;
12305 - elseif (substr($official, 0, 6) === 'image/')
12307 - if ($return = $this->image())
12313 - return $official;
12316 - elseif ($official === 'text/html')
12318 - return $this->feed_or_html();
12322 - return $official;
12327 - return $this->unknown();
12332 - * Sniff text or binary
12334 - * @access private
12335 - * @return string Actual Content-Type
12337 - function text_or_binary()
12339 - if (substr($this->file->body, 0, 2) === "\xFE\xFF"
12340 - || substr($this->file->body, 0, 2) === "\xFF\xFE"
12341 - || substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF"
12342 - || substr($this->file->body, 0, 3) === "\xEF\xBB\xBF")
12344 - return 'text/plain';
12346 - elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body))
12348 - return 'application/octect-stream';
12352 - return 'text/plain';
12359 - * @access private
12360 - * @return string Actual Content-Type
12362 - function unknown()
12364 - $ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20");
12365 - if (strtolower(substr($this->file->body, $ws, 14)) === '<!doctype html'
12366 - || strtolower(substr($this->file->body, $ws, 5)) === '<html'
12367 - || strtolower(substr($this->file->body, $ws, 7)) === '<script')
12369 - return 'text/html';
12371 - elseif (substr($this->file->body, 0, 5) === '%PDF-')
12373 - return 'application/pdf';
12375 - elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-')
12377 - return 'application/postscript';
12379 - elseif (substr($this->file->body, 0, 6) === 'GIF87a'
12380 - || substr($this->file->body, 0, 6) === 'GIF89a')
12382 - return 'image/gif';
12384 - elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
12386 - return 'image/png';
12388 - elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
12390 - return 'image/jpeg';
12392 - elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
12394 - return 'image/bmp';
12398 - return $this->text_or_binary();
12405 - * @access private
12406 - * @return string Actual Content-Type
12410 - if (substr($this->file->body, 0, 6) === 'GIF87a'
12411 - || substr($this->file->body, 0, 6) === 'GIF89a')
12413 - return 'image/gif';
12415 - elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
12417 - return 'image/png';
12419 - elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
12421 - return 'image/jpeg';
12423 - elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
12425 - return 'image/bmp';
12436 - * @access private
12437 - * @return string Actual Content-Type
12439 - function feed_or_html()
12441 - $len = strlen($this->file->body);
12442 - $pos = strspn($this->file->body, "\x09\x0A\x0D\x20");
12444 - while ($pos < $len)
12446 - switch ($this->file->body[$pos])
12452 - $pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos);
12460 - return 'text/html';
12463 - if (substr($this->file->body, $pos, 3) === '!--')
12466 - if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false)
12472 - return 'text/html';
12475 - elseif (substr($this->file->body, $pos, 1) === '!')
12477 - if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false)
12483 - return 'text/html';
12486 - elseif (substr($this->file->body, $pos, 1) === '?')
12488 - if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false)
12494 - return 'text/html';
12497 - elseif (substr($this->file->body, $pos, 3) === 'rss'
12498 - || substr($this->file->body, $pos, 7) === 'rdf:RDF')
12500 - return 'application/rss+xml';
12502 - elseif (substr($this->file->body, $pos, 4) === 'feed')
12504 - return 'application/atom+xml';
12508 - return 'text/html';
12512 - return 'text/html';
12517 - * Parses the XML Declaration
12519 - * @package SimplePie
12521 -class SimplePie_XML_Declaration_Parser
12529 - var $version = '1.0';
12537 - var $encoding = 'UTF-8';
12545 - var $standalone = false;
12548 - * Current state of the state machine
12550 - * @access private
12553 - var $state = 'before_version_name';
12558 - * @access private
12564 - * Input data length (to avoid calling strlen() everytime this is needed)
12566 - * @access private
12569 - var $data_length = 0;
12572 - * Current position of the pointer
12575 - * @access private
12577 - var $position = 0;
12580 - * Create an instance of the class with the input data
12583 - * @param string $data Input data
12585 - function SimplePie_XML_Declaration_Parser($data)
12587 - $this->data = $data;
12588 - $this->data_length = strlen($this->data);
12592 - * Parse the input data
12595 - * @return bool true on success, false on failure
12599 - while ($this->state && $this->state !== 'emit' && $this->has_data())
12601 - $state = $this->state;
12604 - $this->data = '';
12605 - if ($this->state === 'emit')
12611 - $this->version = '';
12612 - $this->encoding = '';
12613 - $this->standalone = '';
12619 - * Check whether there is data beyond the pointer
12621 - * @access private
12622 - * @return bool true if there is further data, false if not
12624 - function has_data()
12626 - return (bool) ($this->position < $this->data_length);
12630 - * Advance past any whitespace
12632 - * @return int Number of whitespace characters passed
12634 - function skip_whitespace()
12636 - $whitespace = strspn($this->data, "\x09\x0A\x0D\x20", $this->position);
12637 - $this->position += $whitespace;
12638 - return $whitespace;
12644 - function get_value()
12646 - $quote = substr($this->data, $this->position, 1);
12647 - if ($quote === '"' || $quote === "'")
12649 - $this->position++;
12650 - $len = strcspn($this->data, $quote, $this->position);
12651 - if ($this->has_data())
12653 - $value = substr($this->data, $this->position, $len);
12654 - $this->position += $len + 1;
12661 - function before_version_name()
12663 - if ($this->skip_whitespace())
12665 - $this->state = 'version_name';
12669 - $this->state = false;
12673 - function version_name()
12675 - if (substr($this->data, $this->position, 7) === 'version')
12677 - $this->position += 7;
12678 - $this->skip_whitespace();
12679 - $this->state = 'version_equals';
12683 - $this->state = false;
12687 - function version_equals()
12689 - if (substr($this->data, $this->position, 1) === '=')
12691 - $this->position++;
12692 - $this->skip_whitespace();
12693 - $this->state = 'version_value';
12697 - $this->state = false;
12701 - function version_value()
12703 - if ($this->version = $this->get_value())
12705 - $this->skip_whitespace();
12706 - if ($this->has_data())
12708 - $this->state = 'encoding_name';
12712 - $this->state = 'emit';
12717 - $this->state = 'standalone_name';
12721 - function encoding_name()
12723 - if (substr($this->data, $this->position, 8) === 'encoding')
12725 - $this->position += 8;
12726 - $this->skip_whitespace();
12727 - $this->state = 'encoding_equals';
12731 - $this->state = false;
12735 - function encoding_equals()
12737 - if (substr($this->data, $this->position, 1) === '=')
12739 - $this->position++;
12740 - $this->skip_whitespace();
12741 - $this->state = 'encoding_value';
12745 - $this->state = false;
12749 - function encoding_value()
12751 - if ($this->encoding = $this->get_value())
12753 - $this->skip_whitespace();
12754 - if ($this->has_data())
12756 - $this->state = 'standalone_name';
12760 - $this->state = 'emit';
12765 - $this->state = false;
12769 - function standalone_name()
12771 - if (substr($this->data, $this->position, 10) === 'standalone')
12773 - $this->position += 10;
12774 - $this->skip_whitespace();
12775 - $this->state = 'standalone_equals';
12779 - $this->state = false;
12783 - function standalone_equals()
12785 - if (substr($this->data, $this->position, 1) === '=')
12787 - $this->position++;
12788 - $this->skip_whitespace();
12789 - $this->state = 'standalone_value';
12793 - $this->state = false;
12797 - function standalone_value()
12799 - if ($standalone = $this->get_value())
12801 - switch ($standalone)
12804 - $this->standalone = true;
12808 - $this->standalone = false;
12812 - $this->state = false;
12816 - $this->skip_whitespace();
12817 - if ($this->has_data())
12819 - $this->state = false;
12823 - $this->state = 'emit';
12828 - $this->state = false;
12833 -class SimplePie_Locator
12838 - var $local = array();
12839 - var $elsewhere = array();
12840 - var $file_class = 'SimplePie_File';
12841 - var $cached_entities = array();
12844 - var $base_location = 0;
12845 - var $checked_feeds = 0;
12846 - var $max_checked_feeds = 10;
12847 - var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer';
12850 - function SimplePie_Locator(&$file, $timeout = 10, $useragent = null, $file_class = 'SimplePie_File', $max_checked_feeds = 10, $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer', $proxy = "")
12852 - $this->file =& $file;
12853 - $this->file_class = $file_class;
12854 - $this->useragent = $useragent;
12855 - $this->timeout = $timeout;
12856 - $this->max_checked_feeds = $max_checked_feeds;
12857 - $this->content_type_sniffer_class = $content_type_sniffer_class;
12858 - $this->proxy = $proxy;
12861 - function find($type = SIMPLEPIE_LOCATOR_ALL)
12863 - if ($this->is_feed($this->file))
12865 - return $this->file;
12868 - if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
12870 - $sniffer = new $this->content_type_sniffer_class($this->file);
12871 - if ($sniffer->get_type() !== 'text/html')
12877 - if ($type & ~SIMPLEPIE_LOCATOR_NONE)
12879 - $this->get_base();
12882 - if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery())
12887 - if ($type & (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links())
12889 - if ($type & SIMPLEPIE_LOCATOR_LOCAL_EXTENSION && $working = $this->extension($this->local))
12894 - if ($type & SIMPLEPIE_LOCATOR_LOCAL_BODY && $working = $this->body($this->local))
12899 - if ($type & SIMPLEPIE_LOCATOR_REMOTE_EXTENSION && $working = $this->extension($this->elsewhere))
12904 - if ($type & SIMPLEPIE_LOCATOR_REMOTE_BODY && $working = $this->body($this->elsewhere))
12912 - function is_feed(&$file)
12914 - if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
12916 - $sniffer = new $this->content_type_sniffer_class($file);
12917 - $sniffed = $sniffer->get_type();
12918 - if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml')))
12927 - elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL)
12937 - function get_base()
12939 - $this->http_base = $this->file->url;
12940 - $this->base = $this->http_base;
12941 - $elements = SimplePie_Misc::get_element('base', $this->file->body);
12942 - foreach ($elements as $element)
12944 - if ($element['attribs']['href']['data'] !== '')
12946 - $this->base = SimplePie_Misc::absolutize_url(trim($element['attribs']['href']['data']), $this->http_base);
12947 - $this->base_location = $element['offset'];
12953 - function autodiscovery()
12955 - $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));
12957 - foreach ($links as $link)
12959 - if ($this->checked_feeds == $this->max_checked_feeds)
12963 - if (isset($link['attribs']['href']['data']) && isset($link['attribs']['rel']['data']))
12965 - $rel = array_unique(SimplePie_Misc::space_seperated_tokens(strtolower($link['attribs']['rel']['data'])));
12967 - if ($this->base_location < $link['offset'])
12969 - $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base);
12973 - $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
12976 - 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'))))
12978 - $this->checked_feeds++;
12979 - $feed = new $this->file_class($href, $this->timeout, 5, null, $this->useragent, false, $this->proxy);
12980 - if ($this->is_feed($feed))
12991 - function get_links()
12993 - $links = SimplePie_Misc::get_element('a', $this->file->body);
12994 - foreach ($links as $link)
12996 - if (isset($link['attribs']['href']['data']))
12998 - $href = trim($link['attribs']['href']['data']);
12999 - $parsed = SimplePie_Misc::parse_url($href);
13000 - if ($parsed['scheme'] === '' || preg_match('/^(http(s)|feed)?$/i', $parsed['scheme']))
13002 - if ($this->base_location < $link['offset'])
13004 - $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base);
13008 - $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
13011 - $current = SimplePie_Misc::parse_url($this->file->url);
13013 - if ($parsed['authority'] === '' || $parsed['authority'] == $current['authority'])
13015 - $this->local[] = $href;
13019 - $this->elsewhere[] = $href;
13024 - $this->local = array_unique($this->local);
13025 - $this->elsewhere = array_unique($this->elsewhere);
13026 - if (!empty($this->local) || !empty($this->elsewhere))
13033 - function extension(&$array)
13035 - foreach ($array as $key => $value)
13037 - if ($this->checked_feeds == $this->max_checked_feeds)
13041 - if (in_array(strtolower(strrchr($value, '.')), array('.rss', '.rdf', '.atom', '.xml')))
13043 - $this->checked_feeds++;
13044 - $feed = new $this->file_class($value, $this->timeout, 5, null, $this->useragent, false, $this->proxy);
13045 - if ($this->is_feed($feed))
13051 - unset($array[$key]);
13058 - function body(&$array)
13060 - foreach ($array as $key => $value)
13062 - if ($this->checked_feeds == $this->max_checked_feeds)
13066 - if (preg_match('/(rss|rdf|atom|xml)/i', $value))
13068 - $this->checked_feeds++;
13069 - $feed = new $this->file_class($value, $this->timeout, 5, null, $this->useragent, false, $this->proxy);
13070 - if ($this->is_feed($feed))
13076 - unset($array[$key]);
13084 -class SimplePie_Parser
13087 - var $error_string;
13088 - var $current_line;
13089 - var $current_column;
13090 - var $current_byte;
13091 - var $separator = ' ';
13092 - var $feed = false;
13093 - var $namespace = array('');
13094 - var $element = array('');
13095 - var $xml_base = array('');
13096 - var $xml_base_explicit = array(false);
13097 - var $xml_lang = array('');
13098 - var $data = array();
13099 - var $datas = array(array());
13100 - var $current_xhtml_construct = -1;
13103 - function parse(&$data, $encoding)
13105 - // Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character
13106 - if (strtoupper($encoding) == 'US-ASCII')
13108 - $this->encoding = 'UTF-8';
13112 - $this->encoding = $encoding;
13116 - // UTF-32 Big Endian BOM
13117 - if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
13119 - $data = substr($data, 4);
13121 - // UTF-32 Little Endian BOM
13122 - elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
13124 - $data = substr($data, 4);
13126 - // UTF-16 Big Endian BOM
13127 - elseif (substr($data, 0, 2) === "\xFE\xFF")
13129 - $data = substr($data, 2);
13131 - // UTF-16 Little Endian BOM
13132 - elseif (substr($data, 0, 2) === "\xFF\xFE")
13134 - $data = substr($data, 2);
13137 - elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
13139 - $data = substr($data, 3);
13142 - if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)
13144 - $declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
13145 - if ($declaration->parse())
13147 - $data = substr($data, $pos + 2);
13148 - $data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . $data;
13152 - $this->error_string = 'SimplePie bug! Please report this!';
13157 - // Work around libxml bug
13158 - $data = str_replace('<', '<', $data);
13159 - $data = str_replace('>', '>', $data);
13160 - $data = str_replace('&', '&', $data);
13161 - $data = str_replace(''', ''', $data);
13162 - $data = str_replace('"', '"', $data);
13166 - // Create the parser
13167 - $xml = xml_parser_create_ns($this->encoding, $this->separator);
13168 - xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1);
13169 - xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0);
13170 - xml_set_object($xml, $this);
13171 - xml_set_character_data_handler($xml, 'cdata');
13172 - xml_set_element_handler($xml, 'tag_open', 'tag_close');
13175 - if (!xml_parse($xml, $data, true))
13177 - $this->error_code = xml_get_error_code($xml);
13178 - $this->error_string = xml_error_string($this->error_code);
13181 - $this->current_line = xml_get_current_line_number($xml);
13182 - $this->current_column = xml_get_current_column_number($xml);
13183 - $this->current_byte = xml_get_current_byte_index($xml);
13184 - xml_parser_free($xml);
13188 - function get_error_code()
13190 - return $this->error_code;
13193 - function get_error_string()
13195 - return $this->error_string;
13198 - function get_current_line()
13200 - return $this->current_line;
13203 - function get_current_column()
13205 - return $this->current_column;
13208 - function get_current_byte()
13210 - return $this->current_byte;
13213 - function get_data()
13215 - return $this->data;
13218 - function tag_open($parser, $tag, $attributes)
13220 - if ($this->feed === 0)
13224 - elseif ($this->feed == false)
13226 - if (in_array($tag, array(
13227 - SIMPLEPIE_NAMESPACE_ATOM_10 . $this->separator . 'feed',
13228 - SIMPLEPIE_NAMESPACE_ATOM_03 . $this->separator . 'feed',
13230 - SIMPLEPIE_NAMESPACE_RDF . $this->separator . 'RDF'
13241 - list($this->namespace[], $this->element[]) = $this->split_ns($tag);
13243 - $attribs = array();
13244 - foreach ($attributes as $name => $value)
13246 - list($attrib_namespace, $attribute) = $this->split_ns($name);
13247 - $attribs[$attrib_namespace][$attribute] = $value;
13250 - if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['base']))
13252 - $this->xml_base[] = SimplePie_Misc::absolutize_url($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base));
13253 - $this->xml_base_explicit[] = true;
13257 - $this->xml_base[] = end($this->xml_base);
13258 - $this->xml_base_explicit[] = end($this->xml_base_explicit);
13261 - if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['lang']))
13263 - $this->xml_lang[] = $attribs[SIMPLEPIE_NAMESPACE_XML]['lang'];
13267 - $this->xml_lang[] = end($this->xml_lang);
13270 - if ($this->current_xhtml_construct >= 0)
13272 - $this->current_xhtml_construct++;
13273 - if (end($this->namespace) == SIMPLEPIE_NAMESPACE_XHTML)
13275 - $this->data['data'] .= '<' . end($this->element);
13276 - if (isset($attribs['']))
13278 - foreach ($attribs[''] as $name => $value)
13280 - $this->data['data'] .= ' ' . $name . '="' . htmlspecialchars($value, ENT_COMPAT, $this->encoding) . '"';
13283 - $this->data['data'] .= '>';
13288 - $this->datas[] =& $this->data;
13289 - $this->data =& $this->data['child'][end($this->namespace)][end($this->element)][];
13290 - $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));
13291 - 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')
13292 - || (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'))
13294 - $this->current_xhtml_construct = 0;
13299 - function cdata($parser, $cdata)
13301 - if ($this->current_xhtml_construct >= 0)
13303 - $this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding);
13305 - elseif ($this->feed > 1)
13307 - $this->data['data'] .= $cdata;
13311 - function tag_close($parser, $tag)
13313 - if (!$this->feed)
13318 - if ($this->current_xhtml_construct >= 0)
13320 - $this->current_xhtml_construct--;
13321 - 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')))
13323 - $this->data['data'] .= '</' . end($this->element) . '>';
13326 - if ($this->current_xhtml_construct == -1)
13328 - $this->data =& $this->datas[$this->feed];
13329 - array_pop($this->datas);
13332 - array_pop($this->element);
13333 - array_pop($this->namespace);
13334 - array_pop($this->xml_base);
13335 - array_pop($this->xml_base_explicit);
13336 - array_pop($this->xml_lang);
13340 - function split_ns($string)
13342 - static $cache = array();
13343 - if (!isset($cache[$string]))
13345 - if ($pos = strpos($string, $this->separator))
13347 - static $separator_length;
13348 - if (!$separator_length)
13350 - $separator_length = strlen($this->separator);
13352 - $namespace = substr($string, 0, $pos);
13353 - $local_name = substr($string, $pos + $separator_length);
13354 - if (strtolower($namespace) === SIMPLEPIE_NAMESPACE_ITUNES)
13356 - $namespace = SIMPLEPIE_NAMESPACE_ITUNES;
13359 - // Normalize the Media RSS namespaces
13360 - if ($namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG)
13362 - $namespace = SIMPLEPIE_NAMESPACE_MEDIARSS;
13364 - $cache[$string] = array($namespace, $local_name);
13368 - $cache[$string] = array('', $string);
13371 - return $cache[$string];
13376 - * @todo Move to using an actual HTML parser (this will allow tags to be properly stripped, and to switch between HTML and XHTML), this will also make it easier to shorten a string while preserving HTML tags
13378 -class SimplePie_Sanitize
13384 - var $remove_div = true;
13385 - var $image_handler = '';
13386 - var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
13387 - var $encode_instead_of_strip = false;
13388 - var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
13389 - var $strip_comments = false;
13390 - var $output_encoding = 'UTF-8';
13391 - var $enable_cache = true;
13392 - var $cache_location = './cache';
13393 - var $cache_name_function = 'md5';
13394 - var $cache_class = 'SimplePie_Cache';
13395 - var $file_class = 'SimplePie_File';
13396 - var $timeout = 10;
13397 - var $useragent = '';
13398 - var $force_fsockopen = false;
13401 - var $replace_url_attributes = array(
13403 - 'area' => 'href',
13404 - 'blockquote' => 'cite',
13406 - 'form' => 'action',
13407 - 'img' => array('longdesc', 'src'),
13408 - 'input' => 'src',
13413 - function remove_div($enable = true)
13415 - $this->remove_div = (bool) $enable;
13418 - function set_image_handler($page = false)
13422 - $this->image_handler = (string) $page;
13426 - $this->image_handler = false;
13430 - function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie_Cache')
13432 - if (isset($enable_cache))
13434 - $this->enable_cache = (bool) $enable_cache;
13437 - if ($cache_location)
13439 - $this->cache_location = (string) $cache_location;
13442 - if ($cache_name_function)
13444 - $this->cache_name_function = (string) $cache_name_function;
13447 - if ($cache_class)
13449 - $this->cache_class = (string) $cache_class;
13453 - function pass_file_data($file_class = 'SimplePie_File', $timeout = 10, $useragent = '', $force_fsockopen = false)
13457 - $this->file_class = (string) $file_class;
13462 - $this->timeout = (string) $timeout;
13467 - $this->useragent = (string) $useragent;
13470 - if ($force_fsockopen)
13472 - $this->force_fsockopen = (string) $force_fsockopen;
13476 - function strip_htmltags($tags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'))
13480 - if (is_array($tags))
13482 - $this->strip_htmltags = $tags;
13486 - $this->strip_htmltags = explode(',', $tags);
13491 - $this->strip_htmltags = false;
13495 - function encode_instead_of_strip($encode = false)
13497 - $this->encode_instead_of_strip = (bool) $encode;
13500 - function strip_attributes($attribs = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'))
13504 - if (is_array($attribs))
13506 - $this->strip_attributes = $attribs;
13510 - $this->strip_attributes = explode(',', $attribs);
13515 - $this->strip_attributes = false;
13519 - function strip_comments($strip = false)
13521 - $this->strip_comments = (bool) $strip;
13524 - function set_output_encoding($encoding = 'UTF-8')
13526 - $this->output_encoding = (string) $encoding;
13530 - * Set element/attribute key/value pairs of HTML attributes
13531 - * containing URLs that need to be resolved relative to the feed
13535 - * @param array $element_attribute Element/attribute key/value pairs
13537 - function set_url_replacements($element_attribute = array('a' => 'href', 'area' => 'href', 'blockquote' => 'cite', 'del' => 'cite', 'form' => 'action', 'img' => array('longdesc', 'src'), 'input' => 'src', 'ins' => 'cite', 'q' => 'cite'))
13539 - $this->replace_url_attributes = (array) $element_attribute;
13542 - function sanitize($data, $type, $base = '')
13544 - $data = trim($data);
13545 - if ($data !== '' || $type & SIMPLEPIE_CONSTRUCT_IRI)
13547 - if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML)
13549 - if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data))
13551 - $type |= SIMPLEPIE_CONSTRUCT_HTML;
13555 - $type |= SIMPLEPIE_CONSTRUCT_TEXT;
13559 - if ($type & SIMPLEPIE_CONSTRUCT_BASE64)
13561 - $data = base64_decode($data);
13564 - if ($type & SIMPLEPIE_CONSTRUCT_XHTML)
13566 - if ($this->remove_div)
13568 - $data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '', $data);
13569 - $data = preg_replace('/<\/div>$/', '', $data);
13573 - $data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '<div>', $data);
13577 - if ($type & (SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML))
13579 - // Strip comments
13580 - if ($this->strip_comments)
13582 - $data = SimplePie_Misc::strip_comments($data);
13585 - // Strip out HTML tags and attributes that might cause various security problems.
13586 - // Based on recommendations by Mark Pilgrim at:
13587 - // http://diveintomark.org/archives/2003/06/12/how_to_consume_rss_safely
13588 - if ($this->strip_htmltags)
13590 - foreach ($this->strip_htmltags as $tag)
13592 - $pcre = "/<($tag)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$tag" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>|(\/)?>)/siU';
13593 - while (preg_match($pcre, $data))
13595 - $data = preg_replace_callback($pcre, array(&$this, 'do_strip_htmltags'), $data);
13600 - if ($this->strip_attributes)
13602 - foreach ($this->strip_attributes as $attrib)
13604 - $data = preg_replace('/(<[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*)' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . trim($attrib) . '(?:\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>/', '\1\2\3>', $data);
13608 - // Replace relative URLs
13609 - $this->base = $base;
13610 - foreach ($this->replace_url_attributes as $element => $attributes)
13612 - $data = $this->replace_urls($data, $element, $attributes);
13615 - // If image handling (caching, etc.) is enabled, cache and rewrite all the image tags.
13616 - if (isset($this->image_handler) && ((string) $this->image_handler) !== '' && $this->enable_cache)
13618 - $images = SimplePie_Misc::get_element('img', $data);
13619 - foreach ($images as $img)
13621 - if (isset($img['attribs']['src']['data']))
13623 - $image_url = call_user_func($this->cache_name_function, $img['attribs']['src']['data']);
13624 - $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $image_url, 'spi');
13626 - if ($cache->load())
13628 - $img['attribs']['src']['data'] = $this->image_handler . $image_url;
13629 - $data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data);
13633 - $file = new $this->file_class($img['attribs']['src']['data'], $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen, $this->proxy);
13634 - $headers = $file->headers;
13636 - if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)))
13638 - if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
13640 - $img['attribs']['src']['data'] = $this->image_handler . $image_url;
13641 - $data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data);
13645 - trigger_error("$cache->name is not writeable", E_USER_WARNING);
13653 - // Having (possibly) taken stuff out, there may now be whitespace at the beginning/end of the data
13654 - $data = trim($data);
13657 - if ($type & SIMPLEPIE_CONSTRUCT_IRI)
13659 - $data = SimplePie_Misc::absolutize_url($data, $base);
13662 - if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI))
13664 - $data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8');
13667 - if ($this->output_encoding != 'UTF-8')
13669 - $data = SimplePie_Misc::change_encoding($data, 'UTF-8', $this->output_encoding);
13675 - function replace_urls($data, $tag, $attributes)
13677 - if (!is_array($this->strip_htmltags) || !in_array($tag, $this->strip_htmltags))
13679 - $elements = SimplePie_Misc::get_element($tag, $data);
13680 - foreach ($elements as $element)
13682 - if (is_array($attributes))
13684 - foreach ($attributes as $attribute)
13686 - if (isset($element['attribs'][$attribute]['data']))
13688 - $element['attribs'][$attribute]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attribute]['data'], $this->base);
13689 - $new_element = SimplePie_Misc::element_implode($element);
13690 - $data = str_replace($element['full'], $new_element, $data);
13691 - $element['full'] = $new_element;
13695 - elseif (isset($element['attribs'][$attributes]['data']))
13697 - $element['attribs'][$attributes]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attributes]['data'], $this->base);
13698 - $data = str_replace($element['full'], SimplePie_Misc::element_implode($element), $data);
13705 - function do_strip_htmltags($match)
13707 - if ($this->encode_instead_of_strip)
13709 - if (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
13711 - $match[1] = htmlspecialchars($match[1], ENT_COMPAT, 'UTF-8');
13712 - $match[2] = htmlspecialchars($match[2], ENT_COMPAT, 'UTF-8');
13713 - return "<$match[1]$match[2]>$match[3]</$match[1]>";
13717 - return htmlspecialchars($match[0], ENT_COMPAT, 'UTF-8');
13720 - elseif (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
13722 - return $match[4];
13732 Index: src/common/widget/Widget_Rss.class.php
13733 ===================================================================
13734 --- src.orig/common/widget/Widget_Rss.class.php
13735 +++ src/common/widget/Widget_Rss.class.php
13737 return idn_to_unicode($param);
13740 - require_once('common/rss/simplepie.inc');
13741 + require_once('/usr/share/php/simplepie/simplepie.inc');
13742 if (!is_dir(forge_get_config('sys_var_path') .'/rss')) {
13743 mkdir(forge_get_config('sys_var_path') .'/rss');
13745 @@ -128,12 +128,7 @@
13746 $vTitle = new Valid_String('title');
13747 $vTitle->required();
13748 if (!$request->validInArray('rss', $vTitle)) {
13749 - if (function_exists('idn_to_utf8()')) {
13750 - require_once('simplepie/simplepie.inc');
13753 - require_once('common/rss/simplepie.inc');
13755 + require_once('/usr/share/php/simplepie/simplepie.inc');
13756 if (!is_dir(forge_get_config('sys_var_path') .'/rss')) {
13757 mkdir(forge_get_config('sys_var_path') .'/rss');