1 Author: Roland Mas <lolando@debian.org>
2 Description: Use SimplePie as provided by the libphp-simplepie Debian package
3 --- src.orig/common/rss/simplepie.inc
10 - * A PHP-Based RSS and Atom Feed Framework.
11 - * Takes the hard work out of managing a complete RSS/Atom solution.
13 - * Copyright (c) 2004-2008, Ryan Parman and Geoffrey Sneddon
14 - * All rights reserved.
16 - * Redistribution and use in source and binary forms, with or without modification, are
17 - * permitted provided that the following conditions are met:
19 - * * Redistributions of source code must retain the above copyright notice, this list of
20 - * conditions and the following disclaimer.
22 - * * Redistributions in binary form must reproduce the above copyright notice, this list
23 - * of conditions and the following disclaimer in the documentation and/or other materials
24 - * provided with the distribution.
26 - * * Neither the name of the SimplePie Team nor the names of its contributors may be used
27 - * to endorse or promote products derived from this software without specific prior
28 - * written permission.
30 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
31 - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
32 - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
33 - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
34 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35 - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
37 - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 - * POSSIBILITY OF SUCH DAMAGE.
40 - * @package SimplePie
42 - * @copyright 2004-2008 Ryan Parman, Geoffrey Sneddon
43 - * @author Ryan Parman
44 - * @author Geoffrey Sneddon
45 - * @link http://simplepie.org/ SimplePie
46 - * @link http://simplepie.org/support/ Please submit all bug reports and feature requests to the SimplePie forums
47 - * @license http://www.opensource.org/licenses/bsd-license.php BSD License
48 - * @todo phpDoc comments
54 -define('SIMPLEPIE_NAME', 'SimplePie');
59 -define('SIMPLEPIE_VERSION', '1.1.3');
64 -define('SIMPLEPIE_BUILD', 20081219);
67 - * SimplePie Website URL
69 -define('SIMPLEPIE_URL', 'http://simplepie.org');
72 - * SimplePie Useragent
73 - * @see SimplePie::set_useragent()
75 -define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . ' (Feed Parser; ' . SIMPLEPIE_URL . '; Allow like Gecko) Build/' . SIMPLEPIE_BUILD);
78 - * SimplePie Linkback
80 -define('SIMPLEPIE_LINKBACK', '<a href="' . SIMPLEPIE_URL . '" title="' . SIMPLEPIE_NAME . ' ' . SIMPLEPIE_VERSION . '">' . SIMPLEPIE_NAME . '</a>');
84 - * @see SimplePie::set_autodiscovery_level()
86 -define('SIMPLEPIE_LOCATOR_NONE', 0);
89 - * Feed Link Element Autodiscovery
90 - * @see SimplePie::set_autodiscovery_level()
92 -define('SIMPLEPIE_LOCATOR_AUTODISCOVERY', 1);
95 - * Local Feed Extension Autodiscovery
96 - * @see SimplePie::set_autodiscovery_level()
98 -define('SIMPLEPIE_LOCATOR_LOCAL_EXTENSION', 2);
101 - * Local Feed Body Autodiscovery
102 - * @see SimplePie::set_autodiscovery_level()
104 -define('SIMPLEPIE_LOCATOR_LOCAL_BODY', 4);
107 - * Remote Feed Extension Autodiscovery
108 - * @see SimplePie::set_autodiscovery_level()
110 -define('SIMPLEPIE_LOCATOR_REMOTE_EXTENSION', 8);
113 - * Remote Feed Body Autodiscovery
114 - * @see SimplePie::set_autodiscovery_level()
116 -define('SIMPLEPIE_LOCATOR_REMOTE_BODY', 16);
119 - * All Feed Autodiscovery
120 - * @see SimplePie::set_autodiscovery_level()
122 -define('SIMPLEPIE_LOCATOR_ALL', 31);
125 - * No known feed type
127 -define('SIMPLEPIE_TYPE_NONE', 0);
132 -define('SIMPLEPIE_TYPE_RSS_090', 1);
135 - * RSS 0.91 (Netscape)
137 -define('SIMPLEPIE_TYPE_RSS_091_NETSCAPE', 2);
140 - * RSS 0.91 (Userland)
142 -define('SIMPLEPIE_TYPE_RSS_091_USERLAND', 4);
145 - * RSS 0.91 (both Netscape and Userland)
147 -define('SIMPLEPIE_TYPE_RSS_091', 6);
152 -define('SIMPLEPIE_TYPE_RSS_092', 8);
157 -define('SIMPLEPIE_TYPE_RSS_093', 16);
162 -define('SIMPLEPIE_TYPE_RSS_094', 32);
167 -define('SIMPLEPIE_TYPE_RSS_10', 64);
172 -define('SIMPLEPIE_TYPE_RSS_20', 128);
177 -define('SIMPLEPIE_TYPE_RSS_RDF', 65);
180 - * Non-RDF-based RSS (truly intended as syndication format)
182 -define('SIMPLEPIE_TYPE_RSS_SYNDICATION', 190);
187 -define('SIMPLEPIE_TYPE_RSS_ALL', 255);
192 -define('SIMPLEPIE_TYPE_ATOM_03', 256);
197 -define('SIMPLEPIE_TYPE_ATOM_10', 512);
202 -define('SIMPLEPIE_TYPE_ATOM_ALL', 768);
207 -define('SIMPLEPIE_TYPE_ALL', 1023);
212 -define('SIMPLEPIE_CONSTRUCT_NONE', 0);
217 -define('SIMPLEPIE_CONSTRUCT_TEXT', 1);
222 -define('SIMPLEPIE_CONSTRUCT_HTML', 2);
227 -define('SIMPLEPIE_CONSTRUCT_XHTML', 4);
230 - * base64-encoded construct
232 -define('SIMPLEPIE_CONSTRUCT_BASE64', 8);
237 -define('SIMPLEPIE_CONSTRUCT_IRI', 16);
240 - * A construct that might be HTML
242 -define('SIMPLEPIE_CONSTRUCT_MAYBE_HTML', 32);
247 -define('SIMPLEPIE_CONSTRUCT_ALL', 63);
250 - * PCRE for HTML attributes
252 -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]*');
255 - * PCRE for XML attributes
257 -define('SIMPLEPIE_PCRE_XML_ATTRIBUTE', '((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'))*)\s*');
262 -define('SIMPLEPIE_NAMESPACE_XML', 'http://www.w3.org/XML/1998/namespace');
265 - * Atom 1.0 Namespace
267 -define('SIMPLEPIE_NAMESPACE_ATOM_10', 'http://www.w3.org/2005/Atom');
270 - * Atom 0.3 Namespace
272 -define('SIMPLEPIE_NAMESPACE_ATOM_03', 'http://purl.org/atom/ns#');
277 -define('SIMPLEPIE_NAMESPACE_RDF', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
280 - * RSS 0.90 Namespace
282 -define('SIMPLEPIE_NAMESPACE_RSS_090', 'http://my.netscape.com/rdf/simple/0.9/');
285 - * RSS 1.0 Namespace
287 -define('SIMPLEPIE_NAMESPACE_RSS_10', 'http://purl.org/rss/1.0/');
290 - * RSS 1.0 Content Module Namespace
292 -define('SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT', 'http://purl.org/rss/1.0/modules/content/');
295 - * RSS 2.0 Namespace
296 - * (Stupid, I know, but I'm certain it will confuse people less with support.)
298 -define('SIMPLEPIE_NAMESPACE_RSS_20', '');
303 -define('SIMPLEPIE_NAMESPACE_DC_10', 'http://purl.org/dc/elements/1.0/');
308 -define('SIMPLEPIE_NAMESPACE_DC_11', 'http://purl.org/dc/elements/1.1/');
311 - * W3C Basic Geo (WGS84 lat/long) Vocabulary Namespace
313 -define('SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO', 'http://www.w3.org/2003/01/geo/wgs84_pos#');
318 -define('SIMPLEPIE_NAMESPACE_GEORSS', 'http://www.georss.org/georss');
321 - * Media RSS Namespace
323 -define('SIMPLEPIE_NAMESPACE_MEDIARSS', 'http://search.yahoo.com/mrss/');
326 - * Wrong Media RSS Namespace
328 -define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG', 'http://search.yahoo.com/mrss');
331 - * iTunes RSS Namespace
333 -define('SIMPLEPIE_NAMESPACE_ITUNES', 'http://www.itunes.com/dtds/podcast-1.0.dtd');
338 -define('SIMPLEPIE_NAMESPACE_XHTML', 'http://www.w3.org/1999/xhtml');
341 - * IANA Link Relations Registry
343 -define('SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY', 'http://www.iana.org/assignments/relation/');
346 - * Whether we're running on PHP5
348 -define('SIMPLEPIE_PHP5', version_compare(PHP_VERSION, '5.0.0', '>='));
353 -define('SIMPLEPIE_FILE_SOURCE_NONE', 0);
356 - * Remote file source
358 -define('SIMPLEPIE_FILE_SOURCE_REMOTE', 1);
361 - * Local file source
363 -define('SIMPLEPIE_FILE_SOURCE_LOCAL', 2);
366 - * fsockopen() file source
368 -define('SIMPLEPIE_FILE_SOURCE_FSOCKOPEN', 4);
373 -define('SIMPLEPIE_FILE_SOURCE_CURL', 8);
376 - * file_get_contents() file source
378 -define('SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16);
383 - * @package SimplePie
384 - * @version "Razzleberry"
385 - * @copyright 2004-2007 Ryan Parman, Geoffrey Sneddon
386 - * @author Ryan Parman
387 - * @author Geoffrey Sneddon
388 - * @todo Option for type of fetching (cache, not modified header, fetch, etc.)
393 - * @var array Raw data
396 - var $data = array();
399 - * @var mixed Error string
405 - * @var object Instance of SimplePie_Sanitize (or other class)
406 - * @see SimplePie::set_sanitize_class()
412 - * @var string SimplePie Useragent
413 - * @see SimplePie::set_useragent()
416 - var $useragent = SIMPLEPIE_USERAGENT;
419 - * @var string Feed URL
420 - * @see SimplePie::set_feed_url()
426 - * @var object Instance of SimplePie_File to use as a feed
427 - * @see SimplePie::set_file()
433 - * @var string Raw feed data
434 - * @see SimplePie::set_raw_data()
440 - * @var int Timeout for fetching remote files
441 - * @see SimplePie::set_timeout()
447 - * @var bool Forces fsockopen() to be used for remote files instead
448 - * of cURL, even if a new enough version is installed
449 - * @see SimplePie::force_fsockopen()
452 - var $force_fsockopen = false;
455 - * @var bool Force the given data/URL to be treated as a feed no matter what
457 - * @see SimplePie::force_feed()
460 - var $force_feed = false;
463 - * @var bool Enable/Disable XML dump
464 - * @see SimplePie::enable_xml_dump()
467 - var $xml_dump = false;
470 - * @var bool Enable/Disable Caching
471 - * @see SimplePie::enable_cache()
477 - * @var int Cache duration (in seconds)
478 - * @see SimplePie::set_cache_duration()
481 - var $cache_duration = 3600;
484 - * @var int Auto-discovery cache duration (in seconds)
485 - * @see SimplePie::set_autodiscovery_cache_duration()
488 - var $autodiscovery_cache_duration = 604800; // 7 Days.
491 - * @var string Cache location (relative to executing script)
492 - * @see SimplePie::set_cache_location()
495 - var $cache_location = './cache';
498 - * @var string Function that creates the cache filename
499 - * @see SimplePie::set_cache_name_function()
502 - var $cache_name_function = 'md5';
505 - * @var bool Reorder feed by date descending
506 - * @see SimplePie::enable_order_by_date()
509 - var $order_by_date = true;
512 - * @var mixed Force input encoding to be set to the follow value
513 - * (false, or anything type-cast to false, disables this feature)
514 - * @see SimplePie::set_input_encoding()
517 - var $input_encoding = false;
520 - * @var int Feed Autodiscovery Level
521 - * @see SimplePie::set_autodiscovery_level()
524 - var $autodiscovery = SIMPLEPIE_LOCATOR_ALL;
527 - * @var string Class used for caching feeds
528 - * @see SimplePie::set_cache_class()
531 - var $cache_class = 'SimplePie_Cache';
534 - * @var string Class used for locating feeds
535 - * @see SimplePie::set_locator_class()
538 - var $locator_class = 'SimplePie_Locator';
541 - * @var string Class used for parsing feeds
542 - * @see SimplePie::set_parser_class()
545 - var $parser_class = 'SimplePie_Parser';
548 - * @var string Class used for fetching feeds
549 - * @see SimplePie::set_file_class()
552 - var $file_class = 'SimplePie_File';
555 - * @var string Class used for items
556 - * @see SimplePie::set_item_class()
559 - var $item_class = 'SimplePie_Item';
562 - * @var string Class used for authors
563 - * @see SimplePie::set_author_class()
566 - var $author_class = 'SimplePie_Author';
569 - * @var string Class used for categories
570 - * @see SimplePie::set_category_class()
573 - var $category_class = 'SimplePie_Category';
576 - * @var string Class used for enclosures
577 - * @see SimplePie::set_enclosures_class()
580 - var $enclosure_class = 'SimplePie_Enclosure';
583 - * @var string Class used for Media RSS <media:text> captions
584 - * @see SimplePie::set_caption_class()
587 - var $caption_class = 'SimplePie_Caption';
590 - * @var string Class used for Media RSS <media:copyright>
591 - * @see SimplePie::set_copyright_class()
594 - var $copyright_class = 'SimplePie_Copyright';
597 - * @var string Class used for Media RSS <media:credit>
598 - * @see SimplePie::set_credit_class()
601 - var $credit_class = 'SimplePie_Credit';
604 - * @var string Class used for Media RSS <media:rating>
605 - * @see SimplePie::set_rating_class()
608 - var $rating_class = 'SimplePie_Rating';
611 - * @var string Class used for Media RSS <media:restriction>
612 - * @see SimplePie::set_restriction_class()
615 - var $restriction_class = 'SimplePie_Restriction';
618 - * @var string Class used for content-type sniffing
619 - * @see SimplePie::set_content_type_sniffer_class()
622 - var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer';
625 - * @var string Class used for item sources.
626 - * @see SimplePie::set_source_class()
629 - var $source_class = 'SimplePie_Source';
632 - * @var mixed Set javascript query string parameter (false, or
633 - * anything type-cast to false, disables this feature)
634 - * @see SimplePie::set_javascript()
637 - var $javascript = 'js';
640 - * @var int Maximum number of feeds to check with autodiscovery
641 - * @see SimplePie::set_max_checked_feeds()
644 - var $max_checked_feeds = 10;
647 - * @var string Web-accessible path to the handler_favicon.php file.
648 - * @see SimplePie::set_favicon_handler()
651 - var $favicon_handler = '';
654 - * @var string Web-accessible path to the handler_image.php file.
655 - * @see SimplePie::set_image_handler()
658 - var $image_handler = '';
661 - * @var array Stores the URLs when multiple feeds are being initialized.
662 - * @see SimplePie::set_feed_url()
665 - var $multifeed_url = array();
668 - * @var array Stores SimplePie objects when multiple feeds initialized.
671 - var $multifeed_objects = array();
674 - * @var array Stores the get_object_vars() array for use with multifeeds.
675 - * @see SimplePie::set_feed_url()
678 - var $config_settings = null;
681 - * @var integer Stores the number of items to return per-feed with multifeeds.
682 - * @see SimplePie::set_item_limit()
685 - var $item_limit = 0;
688 - * @var array Stores the default attributes to be stripped by strip_attributes().
689 - * @see SimplePie::strip_attributes()
692 - var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
695 - * @var array Stores the default tags to be stripped by strip_htmltags().
696 - * @see SimplePie::strip_htmltags()
699 - var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
702 - * @var string proxy used to fetch feeds
703 - * @see SimplePie::set_proxy()
709 - * The SimplePie class contains feed level data and options
711 - * There are two ways that you can create a new SimplePie object. The first
712 - * is by passing a feed URL as a parameter to the SimplePie constructor
713 - * (as well as optionally setting the cache location and cache expiry). This
714 - * will initialise the whole feed with all of the default settings, and you
715 - * can begin accessing methods and properties immediately.
717 - * The second way is to create the SimplePie object with no parameters
718 - * at all. This will enable you to set configuration options. After setting
719 - * them, you must initialise the feed using $feed->init(). At that point the
720 - * object's methods and properties will be available to you. This format is
721 - * what is used throughout this documentation.
724 - * @since 1.0 Preview Release
725 - * @param string $feed_url This is the URL you want to parse.
726 - * @param string $cache_location This is where you want the cache to be stored.
727 - * @param int $cache_duration This is the number of seconds that you want to store the cache file for.
728 - * @param string $proxy This is the proxy "host:port" used to fetch feeds
730 - function SimplePie($feed_url = null, $cache_location = null, $cache_duration = null, $proxy = null)
732 - // Other objects, instances created here so we can set options on them
733 - $this->sanitize = new SimplePie_Sanitize;
735 - // Set options if they're passed to the constructor
736 - if ($cache_location !== null)
738 - $this->set_cache_location($cache_location);
741 - if ($cache_duration !== null)
743 - $this->set_cache_duration($cache_duration);
746 - if ($proxy !== null)
748 - $this->set_proxy($proxy);
751 - // Only init the script if we're passed a feed URL
752 - if ($feed_url !== null)
754 - $this->set_feed_url($feed_url);
760 - * Used for converting object to a string
762 - function __toString()
764 - return md5(serialize($this->data));
768 - * Remove items that link back to this before destroying this object
770 - function __destruct()
772 - if (!empty($this->data['items']))
774 - foreach ($this->data['items'] as $item)
776 - $item->__destruct();
778 - unset($this->data['items']);
780 - if (!empty($this->data['ordered_items']))
782 - foreach ($this->data['ordered_items'] as $item)
784 - $item->__destruct();
786 - unset($this->data['ordered_items']);
791 - * Force the given data/URL to be treated as a feed no matter what it
796 - * @param bool $enable Force the given data/URL to be treated as a feed
798 - function force_feed($enable = false)
800 - $this->force_feed = (bool) $enable;
804 - * This is the URL of the feed you want to parse.
806 - * This allows you to enter the URL of the feed you want to parse, or the
807 - * website you want to try to use auto-discovery on. This takes priority
808 - * over any set raw data.
810 - * You can set multiple feeds to mash together by passing an array instead
811 - * of a string for the $url. Remember that with each additional feed comes
812 - * additional processing and resources.
815 - * @since 1.0 Preview Release
816 - * @param mixed $url This is the URL (or array of URLs) that you want to parse.
817 - * @see SimplePie::set_raw_data()
819 - function set_feed_url($url)
821 - if (is_array($url))
823 - $this->multifeed_url = array();
824 - foreach ($url as $value)
826 - $this->multifeed_url[] = SimplePie_Misc::fix_protocol($value, 1);
831 - $this->feed_url = SimplePie_Misc::fix_protocol($url, 1);
836 - * This is the proxy used to fetch feeds
839 - * @param string $proxy This is the URL of the proxy "host:port"
841 - function set_proxy($proxy)
843 - $this->proxy = $proxy;
844 - $this->sanitize->proxy = $proxy;
848 - * Provides an instance of SimplePie_File to use as a feed
851 - * @param object &$file Instance of SimplePie_File (or subclass)
852 - * @return bool True on success, false on failure
854 - function set_file(&$file)
856 - if (is_a($file, 'SimplePie_File'))
858 - $this->feed_url = $file->url;
859 - $this->file =& $file;
866 - * Allows you to use a string of RSS/Atom data instead of a remote feed.
868 - * If you have a feed available as a string in PHP, you can tell SimplePie
869 - * to parse that data string instead of a remote feed. Any set feed URL
870 - * takes precedence.
873 - * @since 1.0 Beta 3
874 - * @param string $data RSS or Atom data as a string.
875 - * @see SimplePie::set_feed_url()
877 - function set_raw_data($data)
879 - $this->raw_data = $data;
883 - * Allows you to override the default timeout for fetching remote feeds.
885 - * This allows you to change the maximum time the feed's server to respond
886 - * and send the feed back.
889 - * @since 1.0 Beta 3
890 - * @param int $timeout The maximum number of seconds to spend waiting to retrieve a feed.
892 - function set_timeout($timeout = 10)
894 - $this->timeout = (int) $timeout;
898 - * Forces SimplePie to use fsockopen() instead of the preferred cURL
902 - * @since 1.0 Beta 3
903 - * @param bool $enable Force fsockopen() to be used
905 - function force_fsockopen($enable = false)
907 - $this->force_fsockopen = (bool) $enable;
911 - * Outputs the raw XML content of the feed, after it has gone through
912 - * SimplePie's filters.
914 - * Used only for debugging, this function will output the XML content as
915 - * text/xml. When SimplePie reads in a feed, it does a bit of cleaning up
916 - * before trying to parse it. Many parts of the feed are re-written in
917 - * memory, and in the end, you have a parsable feed. XML dump shows you the
918 - * actual XML that SimplePie tries to parse, which may or may not be very
919 - * different from the original feed.
922 - * @since 1.0 Preview Release
923 - * @param bool $enable Enable XML dump
925 - function enable_xml_dump($enable = false)
927 - $this->xml_dump = (bool) $enable;
931 - * Enables/disables caching in SimplePie.
933 - * This option allows you to disable caching all-together in SimplePie.
934 - * However, disabling the cache can lead to longer load times.
937 - * @since 1.0 Preview Release
938 - * @param bool $enable Enable caching
940 - function enable_cache($enable = true)
942 - $this->cache = (bool) $enable;
946 - * Set the length of time (in seconds) that the contents of a feed
950 - * @param int $seconds The feed content cache duration.
952 - function set_cache_duration($seconds = 3600)
954 - $this->cache_duration = (int) $seconds;
958 - * Set the length of time (in seconds) that the autodiscovered feed
959 - * URL will be cached.
962 - * @param int $seconds The autodiscovered feed URL cache duration.
964 - function set_autodiscovery_cache_duration($seconds = 604800)
966 - $this->autodiscovery_cache_duration = (int) $seconds;
970 - * Set the file system location where the cached files should be stored.
973 - * @param string $location The file system location.
975 - function set_cache_location($location = './cache')
977 - $this->cache_location = (string) $location;
981 - * Determines whether feed items should be sorted into reverse chronological order.
984 - * @param bool $enable Sort as reverse chronological order.
986 - function enable_order_by_date($enable = true)
988 - $this->order_by_date = (bool) $enable;
992 - * Allows you to override the character encoding reported by the feed.
995 - * @param string $encoding Character encoding.
997 - function set_input_encoding($encoding = false)
1001 - $this->input_encoding = (string) $encoding;
1005 - $this->input_encoding = false;
1010 - * Set how much feed autodiscovery to do
1013 - * @see SIMPLEPIE_LOCATOR_NONE
1014 - * @see SIMPLEPIE_LOCATOR_AUTODISCOVERY
1015 - * @see SIMPLEPIE_LOCATOR_LOCAL_EXTENSION
1016 - * @see SIMPLEPIE_LOCATOR_LOCAL_BODY
1017 - * @see SIMPLEPIE_LOCATOR_REMOTE_EXTENSION
1018 - * @see SIMPLEPIE_LOCATOR_REMOTE_BODY
1019 - * @see SIMPLEPIE_LOCATOR_ALL
1020 - * @param int $level Feed Autodiscovery Level (level can be a
1021 - * combination of the above constants, see bitwise OR operator)
1023 - function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL)
1025 - $this->autodiscovery = (int) $level;
1029 - * Allows you to change which class SimplePie uses for caching.
1030 - * Useful when you are overloading or extending SimplePie's default classes.
1033 - * @param string $class Name of custom class.
1034 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1035 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1037 - function set_cache_class($class = 'SimplePie_Cache')
1039 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Cache'))
1041 - $this->cache_class = $class;
1048 - * Allows you to change which class SimplePie uses for auto-discovery.
1049 - * Useful when you are overloading or extending SimplePie's default classes.
1052 - * @param string $class Name of custom class.
1053 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1054 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1056 - function set_locator_class($class = 'SimplePie_Locator')
1058 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Locator'))
1060 - $this->locator_class = $class;
1067 - * Allows you to change which class SimplePie uses for XML parsing.
1068 - * Useful when you are overloading or extending SimplePie's default classes.
1071 - * @param string $class Name of custom class.
1072 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1073 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1075 - function set_parser_class($class = 'SimplePie_Parser')
1077 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Parser'))
1079 - $this->parser_class = $class;
1086 - * Allows you to change which class SimplePie uses for remote file fetching.
1087 - * Useful when you are overloading or extending SimplePie's default classes.
1090 - * @param string $class Name of custom class.
1091 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1092 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1094 - function set_file_class($class = 'SimplePie_File')
1096 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_File'))
1098 - $this->file_class = $class;
1105 - * Allows you to change which class SimplePie uses for data sanitization.
1106 - * Useful when you are overloading or extending SimplePie's default classes.
1109 - * @param string $class Name of custom class.
1110 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1111 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1113 - function set_sanitize_class($class = 'SimplePie_Sanitize')
1115 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Sanitize'))
1117 - $this->sanitize = new $class;
1118 - $this->sanitize->proxy = $this->proxy;
1125 - * Allows you to change which class SimplePie uses for handling feed items.
1126 - * Useful when you are overloading or extending SimplePie's default classes.
1129 - * @param string $class Name of custom class.
1130 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1131 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1133 - function set_item_class($class = 'SimplePie_Item')
1135 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Item'))
1137 - $this->item_class = $class;
1144 - * Allows you to change which class SimplePie uses for handling author data.
1145 - * Useful when you are overloading or extending SimplePie's default classes.
1148 - * @param string $class Name of custom class.
1149 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1150 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1152 - function set_author_class($class = 'SimplePie_Author')
1154 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Author'))
1156 - $this->author_class = $class;
1163 - * Allows you to change which class SimplePie uses for handling category data.
1164 - * Useful when you are overloading or extending SimplePie's default classes.
1167 - * @param string $class Name of custom class.
1168 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1169 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1171 - function set_category_class($class = 'SimplePie_Category')
1173 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Category'))
1175 - $this->category_class = $class;
1182 - * Allows you to change which class SimplePie uses for feed enclosures.
1183 - * Useful when you are overloading or extending SimplePie's default classes.
1186 - * @param string $class Name of custom class.
1187 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1188 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1190 - function set_enclosure_class($class = 'SimplePie_Enclosure')
1192 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Enclosure'))
1194 - $this->enclosure_class = $class;
1201 - * Allows you to change which class SimplePie uses for <media:text> captions
1202 - * Useful when you are overloading or extending SimplePie's default classes.
1205 - * @param string $class Name of custom class.
1206 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1207 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1209 - function set_caption_class($class = 'SimplePie_Caption')
1211 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Caption'))
1213 - $this->caption_class = $class;
1220 - * Allows you to change which class SimplePie uses for <media:copyright>
1221 - * Useful when you are overloading or extending SimplePie's default classes.
1224 - * @param string $class Name of custom class.
1225 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1226 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1228 - function set_copyright_class($class = 'SimplePie_Copyright')
1230 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Copyright'))
1232 - $this->copyright_class = $class;
1239 - * Allows you to change which class SimplePie uses for <media:credit>
1240 - * Useful when you are overloading or extending SimplePie's default classes.
1243 - * @param string $class Name of custom class.
1244 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1245 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1247 - function set_credit_class($class = 'SimplePie_Credit')
1249 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Credit'))
1251 - $this->credit_class = $class;
1258 - * Allows you to change which class SimplePie uses for <media:rating>
1259 - * Useful when you are overloading or extending SimplePie's default classes.
1262 - * @param string $class Name of custom class.
1263 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1264 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1266 - function set_rating_class($class = 'SimplePie_Rating')
1268 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Rating'))
1270 - $this->rating_class = $class;
1277 - * Allows you to change which class SimplePie uses for <media:restriction>
1278 - * Useful when you are overloading or extending SimplePie's default classes.
1281 - * @param string $class Name of custom class.
1282 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1283 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1285 - function set_restriction_class($class = 'SimplePie_Restriction')
1287 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Restriction'))
1289 - $this->restriction_class = $class;
1296 - * Allows you to change which class SimplePie uses for content-type sniffing.
1297 - * Useful when you are overloading or extending SimplePie's default classes.
1300 - * @param string $class Name of custom class.
1301 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1302 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1304 - function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer')
1306 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Content_Type_Sniffer'))
1308 - $this->content_type_sniffer_class = $class;
1315 - * Allows you to change which class SimplePie uses item sources.
1316 - * Useful when you are overloading or extending SimplePie's default classes.
1319 - * @param string $class Name of custom class.
1320 - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation
1321 - * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
1323 - function set_source_class($class = 'SimplePie_Source')
1325 - if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Source'))
1327 - $this->source_class = $class;
1334 - * Allows you to override the default user agent string.
1337 - * @param string $ua New user agent string.
1339 - function set_useragent($ua = SIMPLEPIE_USERAGENT)
1341 - $this->useragent = (string) $ua;
1345 - * Set callback function to create cache filename with
1348 - * @param mixed $function Callback function
1350 - function set_cache_name_function($function = 'md5')
1352 - if (is_callable($function))
1354 - $this->cache_name_function = $function;
1359 - * Set javascript query string parameter
1362 - * @param mixed $get Javascript query string parameter
1364 - function set_javascript($get = 'js')
1368 - $this->javascript = (string) $get;
1372 - $this->javascript = false;
1377 - * Set options to make SP as fast as possible. Forgoes a
1378 - * substantial amount of data sanitization in favor of speed.
1381 - * @param bool $set Whether to set them or not
1383 - function set_stupidly_fast($set = false)
1387 - $this->enable_order_by_date(false);
1388 - $this->remove_div(false);
1389 - $this->strip_comments(false);
1390 - $this->strip_htmltags(false);
1391 - $this->strip_attributes(false);
1392 - $this->set_image_handler(false);
1397 - * Set maximum number of feeds to check with autodiscovery
1400 - * @param int $max Maximum number of feeds to check
1402 - function set_max_checked_feeds($max = 10)
1404 - $this->max_checked_feeds = (int) $max;
1407 - function remove_div($enable = true)
1409 - $this->sanitize->remove_div($enable);
1412 - function strip_htmltags($tags = '', $encode = null)
1416 - $tags = $this->strip_htmltags;
1418 - $this->sanitize->strip_htmltags($tags);
1419 - if ($encode !== null)
1421 - $this->sanitize->encode_instead_of_strip($tags);
1425 - function encode_instead_of_strip($enable = true)
1427 - $this->sanitize->encode_instead_of_strip($enable);
1430 - function strip_attributes($attribs = '')
1432 - if ($attribs === '')
1434 - $attribs = $this->strip_attributes;
1436 - $this->sanitize->strip_attributes($attribs);
1439 - function set_output_encoding($encoding = 'UTF-8')
1441 - $this->sanitize->set_output_encoding($encoding);
1444 - function strip_comments($strip = false)
1446 - $this->sanitize->strip_comments($strip);
1450 - * Set element/attribute key/value pairs of HTML attributes
1451 - * containing URLs that need to be resolved relative to the feed
1455 - * @param array $element_attribute Element/attribute key/value pairs
1457 - 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'))
1459 - $this->sanitize->set_url_replacements($element_attribute);
1463 - * Set the handler to enable the display of cached favicons.
1466 - * @param str $page Web-accessible path to the handler_favicon.php file.
1467 - * @param str $qs The query string that the value should be passed to.
1469 - function set_favicon_handler($page = false, $qs = 'i')
1471 - if ($page != false)
1473 - $this->favicon_handler = $page . '?' . $qs . '=';
1477 - $this->favicon_handler = '';
1482 - * Set the handler to enable the display of cached images.
1485 - * @param str $page Web-accessible path to the handler_image.php file.
1486 - * @param str $qs The query string that the value should be passed to.
1488 - function set_image_handler($page = false, $qs = 'i')
1490 - if ($page != false)
1492 - $this->sanitize->set_image_handler($page . '?' . $qs . '=');
1496 - $this->image_handler = '';
1501 - * Set the limit for items returned per-feed with multifeeds.
1504 - * @param integer $limit The maximum number of items to return.
1506 - function set_item_limit($limit = 0)
1508 - $this->item_limit = (int) $limit;
1513 - if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.3.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre'))
1517 - if (isset($_GET[$this->javascript]))
1519 - if (function_exists('ob_gzhandler'))
1521 - ob_start('ob_gzhandler');
1523 - header('Content-type: text/javascript; charset: UTF-8');
1524 - header('Cache-Control: must-revalidate');
1525 - header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
1527 -function embed_odeo(link) {
1528 - 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>');
1531 -function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
1532 - if (placeholder != '') {
1533 - 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>');
1536 - 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>');
1540 -function embed_flash(bgcolor, width, height, link, loop, type) {
1541 - 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>');
1544 -function embed_flv(width, height, link, placeholder, loop, player) {
1545 - 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>');
1548 -function embed_wmedia(width, height, link) {
1549 - document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
1555 - // Pass whatever was set with config options over to the sanitizer.
1556 - $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->cache_class);
1557 - $this->sanitize->pass_file_data($this->file_class, $this->timeout, $this->useragent, $this->force_fsockopen);
1559 - if ($this->feed_url !== null || $this->raw_data !== null)
1561 - $this->data = array();
1562 - $this->multifeed_objects = array();
1565 - if ($this->feed_url !== null)
1567 - $parsed_feed_url = SimplePie_Misc::parse_url($this->feed_url);
1568 - // Decide whether to enable caching
1569 - if ($this->cache && $parsed_feed_url['scheme'] !== '')
1571 - $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc');
1573 - // If it's enabled and we don't want an XML dump, use the cache
1574 - if ($cache && !$this->xml_dump)
1577 - $this->data = $cache->load();
1578 - if (!empty($this->data))
1580 - // If the cache is for an outdated build of SimplePie
1581 - if (!isset($this->data['build']) || $this->data['build'] != SIMPLEPIE_BUILD)
1584 - $this->data = array();
1586 - // If we've hit a collision just rerun it with caching disabled
1587 - elseif (isset($this->data['url']) && $this->data['url'] != $this->feed_url)
1590 - $this->data = array();
1592 - // If we've got a non feed_url stored (if the page isn't actually a feed, or is a redirect) use that URL.
1593 - elseif (isset($this->data['feed_url']))
1595 - // If the autodiscovery cache is still valid use it.
1596 - if ($cache->mtime() + $this->autodiscovery_cache_duration > time())
1598 - // Do not need to do feed autodiscovery yet.
1599 - if ($this->data['feed_url'] == $this->data['url'])
1602 - $this->data = array();
1606 - $this->set_feed_url($this->data['feed_url']);
1607 - return $this->init();
1611 - // Check if the cache has been updated
1612 - elseif ($cache->mtime() + $this->cache_duration < time())
1614 - // If we have last-modified and/or etag set
1615 - if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag']))
1617 - $headers = array();
1618 - if (isset($this->data['headers']['last-modified']))
1620 - $headers['if-modified-since'] = $this->data['headers']['last-modified'];
1622 - if (isset($this->data['headers']['etag']))
1624 - $headers['if-none-match'] = '"' . $this->data['headers']['etag'] . '"';
1626 - $file = new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen, $this->proxy);
1627 - if ($file->success)
1629 - if ($file->status_code == 304)
1636 - $headers = $file->headers;
1645 - // If the cache is still valid, just return true
1651 - // If the cache is empty, delete it
1655 - $this->data = array();
1658 - // 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.
1659 - if (!isset($file))
1661 - if (is_a($this->file, 'SimplePie_File') && $this->file->url == $this->feed_url)
1663 - $file =& $this->file;
1667 - $file = new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen, $this->proxy);
1670 - // If the file connection has an error, set SimplePie::error to that and quit
1671 - if (!$file->success)
1673 - $this->error = $file->error;
1674 - if (!empty($this->data))
1684 - if (!$this->force_feed)
1686 - // Check if the supplied URL is a feed, if it isn't, look for it.
1687 - $locate = new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class);
1688 - if (!$locate->is_feed($file))
1690 - // We need to unset this so that if SimplePie::set_file() has been called that object is untouched
1692 - if ($file = $locate->find($this->autodiscovery))
1696 - $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD);
1697 - if (!$cache->save($this))
1699 - trigger_error("$cache->name is not writeable", E_USER_WARNING);
1701 - $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc');
1703 - $this->feed_url = $file->url;
1707 - $this->error = "A feed could not be found at $this->feed_url";
1708 - SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
1715 - $headers = $file->headers;
1716 - $data = $file->body;
1717 - $sniffer = new $this->content_type_sniffer_class($file);
1718 - $sniffed = $sniffer->get_type();
1722 - $data = $this->raw_data;
1725 - // Set up array of possible encodings
1726 - $encodings = array();
1728 - // First check to see if input has been overridden.
1729 - if ($this->input_encoding !== false)
1731 - $encodings[] = $this->input_encoding;
1734 - $application_types = array('application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity');
1735 - $text_types = array('text/xml', 'text/xml-external-parsed-entity');
1737 - // RFC 3023 (only applies to sniffed content)
1738 - if (isset($sniffed))
1740 - if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) === 'application/' && substr($sniffed, -4) === '+xml')
1742 - if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
1744 - $encodings[] = strtoupper($charset[1]);
1746 - $encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data));
1747 - $encodings[] = 'UTF-8';
1749 - elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml')
1751 - if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
1753 - $encodings[] = $charset[1];
1755 - $encodings[] = 'US-ASCII';
1757 - // Text MIME-type default
1758 - elseif (substr($sniffed, 0, 5) === 'text/')
1760 - $encodings[] = 'US-ASCII';
1764 - // Fallback to XML 1.0 Appendix F.1/UTF-8/ISO-8859-1
1765 - $encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data));
1766 - $encodings[] = 'UTF-8';
1767 - $encodings[] = 'ISO-8859-1';
1769 - // There's no point in trying an encoding twice
1770 - $encodings = array_unique($encodings);
1772 - // If we want the XML, just output that with the most likely encoding and quit
1773 - if ($this->xml_dump)
1775 - header('Content-type: text/xml; charset=' . $encodings[0]);
1780 - // Loop through each possible encoding, till we return something, or run out of possibilities
1781 - foreach ($encodings as $encoding)
1783 - // Change the encoding to UTF-8 (as we always use UTF-8 internally)
1784 - if ($utf8_data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8'))
1786 - // Create new parser
1787 - $parser = new $this->parser_class();
1789 - // If it's parsed fine
1790 - if ($parser->parse($utf8_data, 'UTF-8'))
1792 - $this->data = $parser->get_data();
1793 - if ($this->get_type() & ~SIMPLEPIE_TYPE_NONE)
1795 - if (isset($headers))
1797 - $this->data['headers'] = $headers;
1799 - $this->data['build'] = SIMPLEPIE_BUILD;
1801 - // Cache the file if caching is enabled
1802 - if ($cache && !$cache->save($this))
1804 - trigger_error("$cache->name is not writeable", E_USER_WARNING);
1810 - $this->error = "A feed could not be found at $this->feed_url";
1811 - SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
1817 - // We have an error, just set SimplePie::error to it and quit
1818 - $this->error = sprintf('XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
1819 - SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
1822 - elseif (!empty($this->multifeed_url))
1826 - $this->multifeed_objects = array();
1827 - foreach ($this->multifeed_url as $url)
1829 - if (SIMPLEPIE_PHP5)
1831 - // This keyword needs to defy coding standards for PHP4 compatibility
1832 - $this->multifeed_objects[$i] = clone($this);
1836 - $this->multifeed_objects[$i] = $this;
1838 - $this->multifeed_objects[$i]->set_feed_url($url);
1839 - $success |= $this->multifeed_objects[$i]->init();
1842 - return (bool) $success;
1851 - * Return the error message for the occured error
1854 - * @return string Error message
1858 - return $this->error;
1861 - function get_encoding()
1863 - return $this->sanitize->output_encoding;
1866 - function handle_content_type($mime = 'text/html')
1868 - if (!headers_sent())
1870 - $header = "Content-type: $mime;";
1871 - if ($this->get_encoding())
1873 - $header .= ' charset=' . $this->get_encoding();
1877 - $header .= ' charset=UTF-8';
1883 - function get_type()
1885 - if (!isset($this->data['type']))
1887 - $this->data['type'] = SIMPLEPIE_TYPE_ALL;
1888 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed']))
1890 - $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_10;
1892 - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed']))
1894 - $this->data['type'] &= SIMPLEPIE_TYPE_ATOM_03;
1896 - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF']))
1898 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel'])
1899 - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image'])
1900 - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])
1901 - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput']))
1903 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_10;
1905 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['channel'])
1906 - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image'])
1907 - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])
1908 - || isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput']))
1910 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_090;
1913 - elseif (isset($this->data['child']['']['rss']))
1915 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL;
1916 - if (isset($this->data['child']['']['rss'][0]['attribs']['']['version']))
1918 - switch (trim($this->data['child']['']['rss'][0]['attribs']['']['version']))
1921 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091;
1922 - if (isset($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
1924 - switch (trim($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
1927 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
1931 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_USERLAND;
1938 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_092;
1942 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_093;
1946 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_094;
1950 - $this->data['type'] &= SIMPLEPIE_TYPE_RSS_20;
1957 - $this->data['type'] = SIMPLEPIE_TYPE_NONE;
1960 - return $this->data['type'];
1964 - * Returns the URL for the favicon of the feed's website.
1966 - * @todo Cache atom:icon
1970 - function get_favicon()
1972 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
1974 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
1976 - elseif (($url = $this->get_link()) !== null && preg_match('/^http(s)?:\/\//i', $url))
1978 - $favicon = SimplePie_Misc::absolutize_url('/favicon.ico', $url);
1980 - if ($this->cache && $this->favicon_handler)
1982 - $favicon_filename = call_user_func($this->cache_name_function, $favicon);
1983 - $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $favicon_filename, 'spi');
1985 - if ($cache->load())
1987 - return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI);
1991 - $file = new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen, $this->proxy);
1993 - if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
1995 - $sniffer = new $this->content_type_sniffer_class($file);
1996 - if (substr($sniffer->get_type(), 0, 6) === 'image/')
1998 - if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
2000 - return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI);
2004 - trigger_error("$cache->name is not writeable", E_USER_WARNING);
2005 - return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI);
2013 - return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI);
2020 - * @todo If we have a perm redirect we should return the new URL
2021 - * @todo When we make the above change, let's support <itunes:new-feed-url> as well
2022 - * @todo Also, |atom:link|@rel=self
2024 - function subscribe_url()
2026 - if ($this->feed_url !== null)
2028 - return $this->sanitize($this->feed_url, SIMPLEPIE_CONSTRUCT_IRI);
2036 - function subscribe_feed()
2038 - if ($this->feed_url !== null)
2040 - return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI);
2048 - function subscribe_outlook()
2050 - if ($this->feed_url !== null)
2052 - return 'outlook' . $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI);
2060 - function subscribe_podcast()
2062 - if ($this->feed_url !== null)
2064 - return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 3), SIMPLEPIE_CONSTRUCT_IRI);
2072 - function subscribe_itunes()
2074 - if ($this->feed_url !== null)
2076 - return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 4), SIMPLEPIE_CONSTRUCT_IRI);
2085 - * Creates the subscribe_* methods' return data
2088 - * @param string $feed_url String to prefix to the feed URL
2089 - * @param string $site_url String to prefix to the site URL (and
2090 - * suffix to the feed URL)
2091 - * @return mixed URL if feed exists, false otherwise
2093 - function subscribe_service($feed_url, $site_url = null)
2095 - if ($this->subscribe_url())
2097 - $return = $this->sanitize($feed_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->feed_url);
2098 - if ($site_url !== null && $this->get_link() !== null)
2100 - $return .= $this->sanitize($site_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_link());
2110 - function subscribe_aol()
2112 - return $this->subscribe_service('http://feeds.my.aol.com/add.jsp?url=');
2115 - function subscribe_bloglines()
2117 - return urldecode($this->subscribe_service('http://www.bloglines.com/sub/'));
2120 - function subscribe_eskobo()
2122 - return $this->subscribe_service('http://www.eskobo.com/?AddToMyPage=');
2125 - function subscribe_feedfeeds()
2127 - return $this->subscribe_service('http://www.feedfeeds.com/add?feed=');
2130 - function subscribe_feedster()
2132 - return $this->subscribe_service('http://www.feedster.com/myfeedster.php?action=addrss&confirm=no&rssurl=');
2135 - function subscribe_google()
2137 - return $this->subscribe_service('http://fusion.google.com/add?feedurl=');
2140 - function subscribe_gritwire()
2142 - return $this->subscribe_service('http://my.gritwire.com/feeds/addExternalFeed.aspx?FeedUrl=');
2145 - function subscribe_msn()
2147 - return $this->subscribe_service('http://my.msn.com/addtomymsn.armx?id=rss&ut=', '&ru=');
2150 - function subscribe_netvibes()
2152 - return $this->subscribe_service('http://www.netvibes.com/subscribe.php?url=');
2155 - function subscribe_newsburst()
2157 - return $this->subscribe_service('http://www.newsburst.com/Source/?add=');
2160 - function subscribe_newsgator()
2162 - return $this->subscribe_service('http://www.newsgator.com/ngs/subscriber/subext.aspx?url=');
2165 - function subscribe_odeo()
2167 - return $this->subscribe_service('http://www.odeo.com/listen/subscribe?feed=');
2170 - function subscribe_podnova()
2172 - return $this->subscribe_service('http://www.podnova.com/index_your_podcasts.srf?action=add&url=');
2175 - function subscribe_rojo()
2177 - return $this->subscribe_service('http://www.rojo.com/add-subscription?resource=');
2180 - function subscribe_yahoo()
2182 - return $this->subscribe_service('http://add.my.yahoo.com/rss?url=');
2185 - function get_feed_tags($namespace, $tag)
2187 - $type = $this->get_type();
2188 - if ($type & SIMPLEPIE_TYPE_ATOM_10)
2190 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag]))
2192 - return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag];
2195 - if ($type & SIMPLEPIE_TYPE_ATOM_03)
2197 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag]))
2199 - return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag];
2202 - if ($type & SIMPLEPIE_TYPE_RSS_RDF)
2204 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag]))
2206 - return $this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag];
2209 - if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
2211 - if (isset($this->data['child']['']['rss'][0]['child'][$namespace][$tag]))
2213 - return $this->data['child']['']['rss'][0]['child'][$namespace][$tag];
2219 - function get_channel_tags($namespace, $tag)
2221 - $type = $this->get_type();
2222 - if ($type & SIMPLEPIE_TYPE_ATOM_ALL)
2224 - if ($return = $this->get_feed_tags($namespace, $tag))
2229 - if ($type & SIMPLEPIE_TYPE_RSS_10)
2231 - if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'channel'))
2233 - if (isset($channel[0]['child'][$namespace][$tag]))
2235 - return $channel[0]['child'][$namespace][$tag];
2239 - if ($type & SIMPLEPIE_TYPE_RSS_090)
2241 - if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'channel'))
2243 - if (isset($channel[0]['child'][$namespace][$tag]))
2245 - return $channel[0]['child'][$namespace][$tag];
2249 - if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
2251 - if ($channel = $this->get_feed_tags('', 'channel'))
2253 - if (isset($channel[0]['child'][$namespace][$tag]))
2255 - return $channel[0]['child'][$namespace][$tag];
2262 - function get_image_tags($namespace, $tag)
2264 - $type = $this->get_type();
2265 - if ($type & SIMPLEPIE_TYPE_RSS_10)
2267 - if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'image'))
2269 - if (isset($image[0]['child'][$namespace][$tag]))
2271 - return $image[0]['child'][$namespace][$tag];
2275 - if ($type & SIMPLEPIE_TYPE_RSS_090)
2277 - if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'image'))
2279 - if (isset($image[0]['child'][$namespace][$tag]))
2281 - return $image[0]['child'][$namespace][$tag];
2285 - if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
2287 - if ($image = $this->get_channel_tags('', 'image'))
2289 - if (isset($image[0]['child'][$namespace][$tag]))
2291 - return $image[0]['child'][$namespace][$tag];
2298 - function get_base($element = array())
2300 - if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base']))
2302 - return $element['xml_base'];
2304 - elseif ($this->get_link() !== null)
2306 - return $this->get_link();
2310 - return $this->subscribe_url();
2314 - function sanitize($data, $type, $base = '')
2316 - return $this->sanitize->sanitize($data, $type, $base);
2319 - function get_title()
2321 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
2323 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
2325 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
2327 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
2329 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
2331 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2333 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
2335 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2337 - elseif ($return = $this->get_channel_tags('', 'title'))
2339 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2341 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
2343 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2345 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
2347 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2355 - function get_category($key = 0)
2357 - $categories = $this->get_categories();
2358 - if (isset($categories[$key]))
2360 - return $categories[$key];
2368 - function get_categories()
2370 - $categories = array();
2372 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
2377 - if (isset($category['attribs']['']['term']))
2379 - $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
2381 - if (isset($category['attribs']['']['scheme']))
2383 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
2385 - if (isset($category['attribs']['']['label']))
2387 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
2389 - $categories[] = new $this->category_class($term, $scheme, $label);
2391 - foreach ((array) $this->get_channel_tags('', 'category') as $category)
2393 - $categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
2395 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
2397 - $categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
2399 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
2401 - $categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
2404 - if (!empty($categories))
2406 - return SimplePie_Misc::array_unique($categories);
2414 - function get_author($key = 0)
2416 - $authors = $this->get_authors();
2417 - if (isset($authors[$key]))
2419 - return $authors[$key];
2427 - function get_authors()
2429 - $authors = array();
2430 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
2435 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
2437 - $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2439 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
2441 - $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]));
2443 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
2445 - $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2447 - if ($name !== null || $email !== null || $uri !== null)
2449 - $authors[] = new $this->author_class($name, $uri, $email);
2452 - if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
2457 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
2459 - $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2461 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
2463 - $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]));
2465 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
2467 - $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2469 - if ($name !== null || $email !== null || $url !== null)
2471 - $authors[] = new $this->author_class($name, $url, $email);
2474 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
2476 - $authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
2478 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
2480 - $authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
2482 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
2484 - $authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
2487 - if (!empty($authors))
2489 - return SimplePie_Misc::array_unique($authors);
2497 - function get_contributor($key = 0)
2499 - $contributors = $this->get_contributors();
2500 - if (isset($contributors[$key]))
2502 - return $contributors[$key];
2510 - function get_contributors()
2512 - $contributors = array();
2513 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
2518 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
2520 - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2522 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
2524 - $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]));
2526 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
2528 - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2530 - if ($name !== null || $email !== null || $uri !== null)
2532 - $contributors[] = new $this->author_class($name, $uri, $email);
2535 - foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
2540 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
2542 - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2544 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
2546 - $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]));
2548 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
2550 - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2552 - if ($name !== null || $email !== null || $url !== null)
2554 - $contributors[] = new $this->author_class($name, $url, $email);
2558 - if (!empty($contributors))
2560 - return SimplePie_Misc::array_unique($contributors);
2568 - function get_link($key = 0, $rel = 'alternate')
2570 - $links = $this->get_links($rel);
2571 - if (isset($links[$key]))
2573 - return $links[$key];
2582 - * Added for parity between the parent-level and the item/entry-level.
2584 - function get_permalink()
2586 - return $this->get_link(0);
2589 - function get_links($rel = 'alternate')
2591 - if (!isset($this->data['links']))
2593 - $this->data['links'] = array();
2594 - if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
2596 - foreach ($links as $link)
2598 - if (isset($link['attribs']['']['href']))
2600 - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
2601 - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
2605 - if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
2607 - foreach ($links as $link)
2609 - if (isset($link['attribs']['']['href']))
2611 - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
2612 - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
2617 - if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
2619 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
2621 - if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
2623 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
2625 - if ($links = $this->get_channel_tags('', 'link'))
2627 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
2630 - $keys = array_keys($this->data['links']);
2631 - foreach ($keys as $key)
2633 - if (SimplePie_Misc::is_isegment_nz_nc($key))
2635 - if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
2637 - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
2638 - $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
2642 - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
2645 - elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
2647 - $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
2649 - $this->data['links'][$key] = array_unique($this->data['links'][$key]);
2653 - if (isset($this->data['links'][$rel]))
2655 - return $this->data['links'][$rel];
2663 - function get_description()
2665 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
2667 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
2669 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
2671 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
2673 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
2675 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2677 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
2679 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2681 - elseif ($return = $this->get_channel_tags('', 'description'))
2683 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2685 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
2687 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2689 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
2691 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2693 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
2695 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
2697 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
2699 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
2707 - function get_copyright()
2709 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
2711 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
2713 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
2715 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
2717 - elseif ($return = $this->get_channel_tags('', 'copyright'))
2719 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2721 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
2723 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2725 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
2727 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2735 - function get_language()
2737 - if ($return = $this->get_channel_tags('', 'language'))
2739 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2741 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
2743 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2745 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
2747 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2749 - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang']))
2751 - return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
2753 - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang']))
2755 - return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
2757 - elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang']))
2759 - return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
2761 - elseif (isset($this->data['headers']['content-language']))
2763 - return $this->sanitize($this->data['headers']['content-language'], SIMPLEPIE_CONSTRUCT_TEXT);
2771 - function get_latitude()
2773 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
2775 - return (float) $return[0]['data'];
2777 - elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
2779 - return (float) $match[1];
2787 - function get_longitude()
2789 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
2791 - return (float) $return[0]['data'];
2793 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
2795 - return (float) $return[0]['data'];
2797 - elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
2799 - return (float) $match[2];
2807 - function get_image_title()
2809 - if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
2811 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2813 - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
2815 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2817 - elseif ($return = $this->get_image_tags('', 'title'))
2819 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2821 - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
2823 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2825 - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
2827 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2835 - function get_image_url()
2837 - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
2839 - return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
2841 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
2843 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2845 - elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
2847 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2849 - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url'))
2851 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2853 - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url'))
2855 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2857 - elseif ($return = $this->get_image_tags('', 'url'))
2859 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2867 - function get_image_link()
2869 - if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
2871 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2873 - elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
2875 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2877 - elseif ($return = $this->get_image_tags('', 'link'))
2879 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2887 - function get_image_width()
2889 - if ($return = $this->get_image_tags('', 'width'))
2891 - return round($return[0]['data']);
2893 - elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
2903 - function get_image_height()
2905 - if ($return = $this->get_image_tags('', 'height'))
2907 - return round($return[0]['data']);
2909 - elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
2919 - function get_item_quantity($max = 0)
2921 - $qty = count($this->get_items());
2928 - return ($qty > $max) ? $max : $qty;
2932 - function get_item($key = 0)
2934 - $items = $this->get_items();
2935 - if (isset($items[$key]))
2937 - return $items[$key];
2945 - function get_items($start = 0, $end = 0)
2947 - if (!empty($this->multifeed_objects))
2949 - return SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
2951 - elseif (!isset($this->data['items']))
2953 - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
2955 - $keys = array_keys($items);
2956 - foreach ($keys as $key)
2958 - $this->data['items'][] = new $this->item_class($this, $items[$key]);
2961 - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
2963 - $keys = array_keys($items);
2964 - foreach ($keys as $key)
2966 - $this->data['items'][] = new $this->item_class($this, $items[$key]);
2969 - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
2971 - $keys = array_keys($items);
2972 - foreach ($keys as $key)
2974 - $this->data['items'][] = new $this->item_class($this, $items[$key]);
2977 - if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
2979 - $keys = array_keys($items);
2980 - foreach ($keys as $key)
2982 - $this->data['items'][] = new $this->item_class($this, $items[$key]);
2985 - if ($items = $this->get_channel_tags('', 'item'))
2987 - $keys = array_keys($items);
2988 - foreach ($keys as $key)
2990 - $this->data['items'][] = new $this->item_class($this, $items[$key]);
2995 - if (!empty($this->data['items']))
2997 - // If we want to order it by date, check if all items have a date, and then sort it
2998 - if ($this->order_by_date)
3000 - if (!isset($this->data['ordered_items']))
3003 - foreach ($this->data['items'] as $item)
3005 - if (!$item->get_date('U'))
3012 - $this->data['ordered_items'] = $this->data['items'];
3015 - usort($this->data['ordered_items'], array(&$this, 'sort_items'));
3018 - $items = $this->data['ordered_items'];
3022 - $items = $this->data['items'];
3025 - // Slice the data as desired
3028 - return array_slice($items, $start);
3032 - return array_slice($items, $start, $end);
3041 - function sort_items($a, $b)
3043 - return $a->get_date('U') <= $b->get_date('U');
3046 - function merge_items($urls, $start = 0, $end = 0, $limit = 0)
3048 - if (is_array($urls) && sizeof($urls) > 0)
3051 - foreach ($urls as $arg)
3053 - if (is_a($arg, 'SimplePie'))
3055 - $items = array_merge($items, $arg->get_items(0, $limit));
3059 - trigger_error('Arguments must be SimplePie objects', E_USER_WARNING);
3064 - foreach ($items as $item)
3066 - if (!$item->get_date('U'))
3075 - usort($items, array('SimplePie', 'sort_items'));
3080 - return array_slice($items, $start);
3084 - return array_slice($items, $start, $end);
3089 - trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING);
3095 -class SimplePie_Item
3098 - var $data = array();
3100 - function SimplePie_Item($feed, $data)
3102 - $this->feed = $feed;
3103 - $this->data = $data;
3106 - function __toString()
3108 - return md5(serialize($this->data));
3112 - * Remove items that link back to this before destroying this object
3114 - function __destruct()
3116 - unset($this->feed);
3119 - function get_item_tags($namespace, $tag)
3121 - if (isset($this->data['child'][$namespace][$tag]))
3123 - return $this->data['child'][$namespace][$tag];
3131 - function get_base($element = array())
3133 - return $this->feed->get_base($element);
3136 - function sanitize($data, $type, $base = '')
3138 - return $this->feed->sanitize($data, $type, $base);
3141 - function get_feed()
3143 - return $this->feed;
3146 - function get_id($hash = false)
3150 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id'))
3152 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3154 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id'))
3156 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3158 - elseif ($return = $this->get_item_tags('', 'guid'))
3160 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3162 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier'))
3164 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3166 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier'))
3168 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3170 - elseif (($return = $this->get_permalink()) !== null)
3174 - elseif (($return = $this->get_title()) !== null)
3179 - if ($this->get_permalink() !== null || $this->get_title() !== null)
3181 - return md5($this->get_permalink() . $this->get_title());
3185 - return md5(serialize($this->data));
3189 - function get_title()
3191 - if (!isset($this->data['title']))
3193 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
3195 - $this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3197 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
3199 - $this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3201 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
3203 - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
3205 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
3207 - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
3209 - elseif ($return = $this->get_item_tags('', 'title'))
3211 - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
3213 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
3215 - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3217 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
3219 - $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3223 - $this->data['title'] = null;
3226 - return $this->data['title'];
3229 - function get_description($description_only = false)
3231 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary'))
3233 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3235 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary'))
3237 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3239 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
3241 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
3243 - elseif ($return = $this->get_item_tags('', 'description'))
3245 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
3247 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
3249 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3251 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
3253 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3255 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
3257 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
3259 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
3261 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3263 - elseif (!$description_only)
3265 - return $this->get_content(true);
3273 - function get_content($content_only = false)
3275 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content'))
3277 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_content_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3279 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content'))
3281 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3283 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded'))
3285 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
3287 - elseif (!$content_only)
3289 - return $this->get_description(true);
3297 - function get_category($key = 0)
3299 - $categories = $this->get_categories();
3300 - if (isset($categories[$key]))
3302 - return $categories[$key];
3310 - function get_categories()
3312 - $categories = array();
3314 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
3319 - if (isset($category['attribs']['']['term']))
3321 - $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
3323 - if (isset($category['attribs']['']['scheme']))
3325 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
3327 - if (isset($category['attribs']['']['label']))
3329 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
3331 - $categories[] = new $this->feed->category_class($term, $scheme, $label);
3333 - foreach ((array) $this->get_item_tags('', 'category') as $category)
3335 - $categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
3337 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
3339 - $categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
3341 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
3343 - $categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
3346 - if (!empty($categories))
3348 - return SimplePie_Misc::array_unique($categories);
3356 - function get_author($key = 0)
3358 - $authors = $this->get_authors();
3359 - if (isset($authors[$key]))
3361 - return $authors[$key];
3369 - function get_contributor($key = 0)
3371 - $contributors = $this->get_contributors();
3372 - if (isset($contributors[$key]))
3374 - return $contributors[$key];
3382 - function get_contributors()
3384 - $contributors = array();
3385 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
3390 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
3392 - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3394 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
3396 - $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]));
3398 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
3400 - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3402 - if ($name !== null || $email !== null || $uri !== null)
3404 - $contributors[] = new $this->feed->author_class($name, $uri, $email);
3407 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
3412 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
3414 - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3416 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
3418 - $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]));
3420 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
3422 - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3424 - if ($name !== null || $email !== null || $url !== null)
3426 - $contributors[] = new $this->feed->author_class($name, $url, $email);
3430 - if (!empty($contributors))
3432 - return SimplePie_Misc::array_unique($contributors);
3441 - * @todo Atom inheritance (item author, source author, feed author)
3443 - function get_authors()
3445 - $authors = array();
3446 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
3451 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
3453 - $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3455 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
3457 - $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]));
3459 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
3461 - $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3463 - if ($name !== null || $email !== null || $uri !== null)
3465 - $authors[] = new $this->feed->author_class($name, $uri, $email);
3468 - if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
3473 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
3475 - $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3477 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
3479 - $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]));
3481 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
3483 - $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3485 - if ($name !== null || $email !== null || $url !== null)
3487 - $authors[] = new $this->feed->author_class($name, $url, $email);
3490 - if ($author = $this->get_item_tags('', 'author'))
3492 - $authors[] = new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
3494 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
3496 - $authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
3498 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
3500 - $authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
3502 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
3504 - $authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
3507 - if (!empty($authors))
3509 - return SimplePie_Misc::array_unique($authors);
3511 - elseif (($source = $this->get_source()) && ($authors = $source->get_authors()))
3515 - elseif ($authors = $this->feed->get_authors())
3525 - function get_copyright()
3527 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
3529 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
3531 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
3533 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3535 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
3537 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3545 - function get_date($date_format = 'j F Y, g:i a')
3547 - if (!isset($this->data['date']))
3549 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published'))
3551 - $this->data['date']['raw'] = $return[0]['data'];
3553 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
3555 - $this->data['date']['raw'] = $return[0]['data'];
3557 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued'))
3559 - $this->data['date']['raw'] = $return[0]['data'];
3561 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created'))
3563 - $this->data['date']['raw'] = $return[0]['data'];
3565 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified'))
3567 - $this->data['date']['raw'] = $return[0]['data'];
3569 - elseif ($return = $this->get_item_tags('', 'pubDate'))
3571 - $this->data['date']['raw'] = $return[0]['data'];
3573 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date'))
3575 - $this->data['date']['raw'] = $return[0]['data'];
3577 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date'))
3579 - $this->data['date']['raw'] = $return[0]['data'];
3582 - if (!empty($this->data['date']['raw']))
3584 - $parser = SimplePie_Parse_Date::get();
3585 - $this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']);
3589 - $this->data['date'] = null;
3592 - if ($this->data['date'])
3594 - $date_format = (string) $date_format;
3595 - switch ($date_format)
3598 - return $this->sanitize($this->data['date']['raw'], SIMPLEPIE_CONSTRUCT_TEXT);
3601 - return $this->data['date']['parsed'];
3604 - return date($date_format, $this->data['date']['parsed']);
3613 - function get_local_date($date_format = '%c')
3615 - if (!$date_format)
3617 - return $this->sanitize($this->get_date(''), SIMPLEPIE_CONSTRUCT_TEXT);
3619 - elseif (($date = $this->get_date('U')) !== null)
3621 - return strftime($date_format, $date);
3629 - function get_permalink()
3631 - $link = $this->get_link();
3632 - $enclosure = $this->get_enclosure(0);
3633 - if ($link !== null)
3637 - elseif ($enclosure !== null)
3639 - return $enclosure->get_link();
3647 - function get_link($key = 0, $rel = 'alternate')
3649 - $links = $this->get_links($rel);
3650 - if ($links[$key] !== null)
3652 - return $links[$key];
3660 - function get_links($rel = 'alternate')
3662 - if (!isset($this->data['links']))
3664 - $this->data['links'] = array();
3665 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
3667 - if (isset($link['attribs']['']['href']))
3669 - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
3670 - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
3674 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link)
3676 - if (isset($link['attribs']['']['href']))
3678 - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
3679 - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
3682 - if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
3684 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
3686 - if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
3688 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
3690 - if ($links = $this->get_item_tags('', 'link'))
3692 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
3694 - if ($links = $this->get_item_tags('', 'guid'))
3696 - if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) == 'true')
3698 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
3702 - $keys = array_keys($this->data['links']);
3703 - foreach ($keys as $key)
3705 - if (SimplePie_Misc::is_isegment_nz_nc($key))
3707 - if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
3709 - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
3710 - $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
3714 - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
3717 - elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
3719 - $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
3721 - $this->data['links'][$key] = array_unique($this->data['links'][$key]);
3724 - if (isset($this->data['links'][$rel]))
3726 - return $this->data['links'][$rel];
3735 - * @todo Add ability to prefer one type of content over another (in a media group).
3737 - function get_enclosure($key = 0, $prefer = null)
3739 - $enclosures = $this->get_enclosures();
3740 - if (isset($enclosures[$key]))
3742 - return $enclosures[$key];
3751 - * Grabs all available enclosures (podcasts, etc.)
3753 - * Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS.
3755 - * 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.
3757 - * @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4).
3758 - * @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).
3760 - function get_enclosures()
3762 - if (!isset($this->data['enclosures']))
3764 - $this->data['enclosures'] = array();
3767 - $captions_parent = null;
3768 - $categories_parent = null;
3769 - $copyrights_parent = null;
3770 - $credits_parent = null;
3771 - $description_parent = null;
3772 - $duration_parent = null;
3773 - $hashes_parent = null;
3774 - $keywords_parent = null;
3775 - $player_parent = null;
3776 - $ratings_parent = null;
3777 - $restrictions_parent = null;
3778 - $thumbnails_parent = null;
3779 - $title_parent = null;
3781 - // Let's do the channel and item-level ones first, and just re-use them if we need to.
3782 - $parent = $this->get_feed();
3785 - if ($captions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
3787 - foreach ($captions as $caption)
3789 - $caption_type = null;
3790 - $caption_lang = null;
3791 - $caption_startTime = null;
3792 - $caption_endTime = null;
3793 - $caption_text = null;
3794 - if (isset($caption['attribs']['']['type']))
3796 - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
3798 - if (isset($caption['attribs']['']['lang']))
3800 - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
3802 - if (isset($caption['attribs']['']['start']))
3804 - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
3806 - if (isset($caption['attribs']['']['end']))
3808 - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
3810 - if (isset($caption['data']))
3812 - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3814 - $captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
3817 - elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
3819 - foreach ($captions as $caption)
3821 - $caption_type = null;
3822 - $caption_lang = null;
3823 - $caption_startTime = null;
3824 - $caption_endTime = null;
3825 - $caption_text = null;
3826 - if (isset($caption['attribs']['']['type']))
3828 - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
3830 - if (isset($caption['attribs']['']['lang']))
3832 - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
3834 - if (isset($caption['attribs']['']['start']))
3836 - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
3838 - if (isset($caption['attribs']['']['end']))
3840 - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
3842 - if (isset($caption['data']))
3844 - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3846 - $captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
3849 - if (is_array($captions_parent))
3851 - $captions_parent = array_values(SimplePie_Misc::array_unique($captions_parent));
3855 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category)
3860 - if (isset($category['data']))
3862 - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3864 - if (isset($category['attribs']['']['scheme']))
3866 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
3870 - $scheme = 'http://search.yahoo.com/mrss/category_schema';
3872 - if (isset($category['attribs']['']['label']))
3874 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
3876 - $categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
3878 - foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category)
3883 - if (isset($category['data']))
3885 - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3887 - if (isset($category['attribs']['']['scheme']))
3889 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
3893 - $scheme = 'http://search.yahoo.com/mrss/category_schema';
3895 - if (isset($category['attribs']['']['label']))
3897 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
3899 - $categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
3901 - foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'category') as $category)
3904 - $scheme = 'http://www.itunes.com/dtds/podcast-1.0.dtd';
3906 - if (isset($category['attribs']['']['text']))
3908 - $label = $this->sanitize($category['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT);
3910 - $categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
3912 - if (isset($category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category']))
3914 - foreach ((array) $category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category'] as $subcategory)
3916 - if (isset($subcategory['attribs']['']['text']))
3918 - $label = $this->sanitize($subcategory['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT);
3920 - $categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
3924 - if (is_array($categories_parent))
3926 - $categories_parent = array_values(SimplePie_Misc::array_unique($categories_parent));
3930 - if ($copyright = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
3932 - $copyright_url = null;
3933 - $copyright_label = null;
3934 - if (isset($copyright[0]['attribs']['']['url']))
3936 - $copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
3938 - if (isset($copyright[0]['data']))
3940 - $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3942 - $copyrights_parent = new $this->feed->copyright_class($copyright_url, $copyright_label);
3944 - elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
3946 - $copyright_url = null;
3947 - $copyright_label = null;
3948 - if (isset($copyright[0]['attribs']['']['url']))
3950 - $copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
3952 - if (isset($copyright[0]['data']))
3954 - $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3956 - $copyrights_parent = new $this->feed->copyright_class($copyright_url, $copyright_label);
3960 - if ($credits = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
3962 - foreach ($credits as $credit)
3964 - $credit_role = null;
3965 - $credit_scheme = null;
3966 - $credit_name = null;
3967 - if (isset($credit['attribs']['']['role']))
3969 - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
3971 - if (isset($credit['attribs']['']['scheme']))
3973 - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
3977 - $credit_scheme = 'urn:ebu';
3979 - if (isset($credit['data']))
3981 - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
3983 - $credits_parent[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
3986 - elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
3988 - foreach ($credits as $credit)
3990 - $credit_role = null;
3991 - $credit_scheme = null;
3992 - $credit_name = null;
3993 - if (isset($credit['attribs']['']['role']))
3995 - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
3997 - if (isset($credit['attribs']['']['scheme']))
3999 - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4003 - $credit_scheme = 'urn:ebu';
4005 - if (isset($credit['data']))
4007 - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4009 - $credits_parent[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
4012 - if (is_array($credits_parent))
4014 - $credits_parent = array_values(SimplePie_Misc::array_unique($credits_parent));
4018 - if ($description_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description'))
4020 - if (isset($description_parent[0]['data']))
4022 - $description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4025 - elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description'))
4027 - if (isset($description_parent[0]['data']))
4029 - $description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4034 - if ($duration_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'duration'))
4039 - if (isset($duration_parent[0]['data']))
4041 - $temp = explode(':', $this->sanitize($duration_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4042 - if (sizeof($temp) > 0)
4044 - (int) $seconds = array_pop($temp);
4046 - if (sizeof($temp) > 0)
4048 - (int) $minutes = array_pop($temp);
4049 - $seconds += $minutes * 60;
4051 - if (sizeof($temp) > 0)
4053 - (int) $hours = array_pop($temp);
4054 - $seconds += $hours * 3600;
4057 - $duration_parent = $seconds;
4062 - if ($hashes_iterator = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash'))
4064 - foreach ($hashes_iterator as $hash)
4068 - if (isset($hash['data']))
4070 - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4072 - if (isset($hash['attribs']['']['algo']))
4074 - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
4080 - $hashes_parent[] = $algo.':'.$value;
4083 - elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash'))
4085 - foreach ($hashes_iterator as $hash)
4089 - if (isset($hash['data']))
4091 - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4093 - if (isset($hash['attribs']['']['algo']))
4095 - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
4101 - $hashes_parent[] = $algo.':'.$value;
4104 - if (is_array($hashes_parent))
4106 - $hashes_parent = array_values(SimplePie_Misc::array_unique($hashes_parent));
4110 - if ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords'))
4112 - if (isset($keywords[0]['data']))
4114 - $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4115 - foreach ($temp as $word)
4117 - $keywords_parent[] = trim($word);
4122 - elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
4124 - if (isset($keywords[0]['data']))
4126 - $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4127 - foreach ($temp as $word)
4129 - $keywords_parent[] = trim($word);
4134 - elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords'))
4136 - if (isset($keywords[0]['data']))
4138 - $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4139 - foreach ($temp as $word)
4141 - $keywords_parent[] = trim($word);
4146 - elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
4148 - if (isset($keywords[0]['data']))
4150 - $temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4151 - foreach ($temp as $word)
4153 - $keywords_parent[] = trim($word);
4158 - if (is_array($keywords_parent))
4160 - $keywords_parent = array_values(SimplePie_Misc::array_unique($keywords_parent));
4164 - if ($player_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player'))
4166 - if (isset($player_parent[0]['attribs']['']['url']))
4168 - $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4171 - elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player'))
4173 - if (isset($player_parent[0]['attribs']['']['url']))
4175 - $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4180 - if ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating'))
4182 - foreach ($ratings as $rating)
4184 - $rating_scheme = null;
4185 - $rating_value = null;
4186 - if (isset($rating['attribs']['']['scheme']))
4188 - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4192 - $rating_scheme = 'urn:simple';
4194 - if (isset($rating['data']))
4196 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4198 - $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
4201 - elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
4203 - foreach ($ratings as $rating)
4205 - $rating_scheme = 'urn:itunes';
4206 - $rating_value = null;
4207 - if (isset($rating['data']))
4209 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4211 - $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
4214 - elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating'))
4216 - foreach ($ratings as $rating)
4218 - $rating_scheme = null;
4219 - $rating_value = null;
4220 - if (isset($rating['attribs']['']['scheme']))
4222 - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4226 - $rating_scheme = 'urn:simple';
4228 - if (isset($rating['data']))
4230 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4232 - $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
4235 - elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
4237 - foreach ($ratings as $rating)
4239 - $rating_scheme = 'urn:itunes';
4240 - $rating_value = null;
4241 - if (isset($rating['data']))
4243 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4245 - $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value);
4248 - if (is_array($ratings_parent))
4250 - $ratings_parent = array_values(SimplePie_Misc::array_unique($ratings_parent));
4254 - if ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction'))
4256 - foreach ($restrictions as $restriction)
4258 - $restriction_relationship = null;
4259 - $restriction_type = null;
4260 - $restriction_value = null;
4261 - if (isset($restriction['attribs']['']['relationship']))
4263 - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
4265 - if (isset($restriction['attribs']['']['type']))
4267 - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4269 - if (isset($restriction['data']))
4271 - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4273 - $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4276 - elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
4278 - foreach ($restrictions as $restriction)
4280 - $restriction_relationship = 'allow';
4281 - $restriction_type = null;
4282 - $restriction_value = 'itunes';
4283 - if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
4285 - $restriction_relationship = 'deny';
4287 - $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4290 - elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction'))
4292 - foreach ($restrictions as $restriction)
4294 - $restriction_relationship = null;
4295 - $restriction_type = null;
4296 - $restriction_value = null;
4297 - if (isset($restriction['attribs']['']['relationship']))
4299 - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
4301 - if (isset($restriction['attribs']['']['type']))
4303 - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4305 - if (isset($restriction['data']))
4307 - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4309 - $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4312 - elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
4314 - foreach ($restrictions as $restriction)
4316 - $restriction_relationship = 'allow';
4317 - $restriction_type = null;
4318 - $restriction_value = 'itunes';
4319 - if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
4321 - $restriction_relationship = 'deny';
4323 - $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4326 - if (is_array($restrictions_parent))
4328 - $restrictions_parent = array_values(SimplePie_Misc::array_unique($restrictions_parent));
4332 - if ($thumbnails = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail'))
4334 - foreach ($thumbnails as $thumbnail)
4336 - if (isset($thumbnail['attribs']['']['url']))
4338 - $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4342 - elseif ($thumbnails = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail'))
4344 - foreach ($thumbnails as $thumbnail)
4346 - if (isset($thumbnail['attribs']['']['url']))
4348 - $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4354 - if ($title_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title'))
4356 - if (isset($title_parent[0]['data']))
4358 - $title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4361 - elseif ($title_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title'))
4363 - if (isset($title_parent[0]['data']))
4365 - $title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4369 - // Clear the memory
4376 - $expression = null;
4377 - $framerate = null;
4379 - $javascript = null;
4383 - $samplingrate = null;
4390 - $categories = null;
4391 - $copyrights = null;
4393 - $description = null;
4398 - $restrictions = null;
4399 - $thumbnails = null;
4402 - // If we have media:group tags, loop through them.
4403 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group') as $group)
4405 - // If we have media:content tags, loop through them.
4406 - foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content)
4408 - if (isset($content['attribs']['']['url']))
4414 - $expression = null;
4415 - $framerate = null;
4417 - $javascript = null;
4421 - $samplingrate = null;
4428 - $categories = null;
4429 - $copyrights = null;
4431 - $description = null;
4436 - $restrictions = null;
4437 - $thumbnails = null;
4440 - // Start checking the attributes of media:content
4441 - if (isset($content['attribs']['']['bitrate']))
4443 - $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT);
4445 - if (isset($content['attribs']['']['channels']))
4447 - $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT);
4449 - if (isset($content['attribs']['']['duration']))
4451 - $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT);
4455 - $duration = $duration_parent;
4457 - if (isset($content['attribs']['']['expression']))
4459 - $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT);
4461 - if (isset($content['attribs']['']['framerate']))
4463 - $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT);
4465 - if (isset($content['attribs']['']['height']))
4467 - $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT);
4469 - if (isset($content['attribs']['']['lang']))
4471 - $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
4473 - if (isset($content['attribs']['']['fileSize']))
4475 - $length = ceil($content['attribs']['']['fileSize']);
4477 - if (isset($content['attribs']['']['medium']))
4479 - $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT);
4481 - if (isset($content['attribs']['']['samplingrate']))
4483 - $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT);
4485 - if (isset($content['attribs']['']['type']))
4487 - $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4489 - if (isset($content['attribs']['']['width']))
4491 - $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT);
4493 - $url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4495 - // Checking the other optional media: elements. Priority: media:content, media:group, item, channel
4498 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
4500 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
4502 - $caption_type = null;
4503 - $caption_lang = null;
4504 - $caption_startTime = null;
4505 - $caption_endTime = null;
4506 - $caption_text = null;
4507 - if (isset($caption['attribs']['']['type']))
4509 - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4511 - if (isset($caption['attribs']['']['lang']))
4513 - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
4515 - if (isset($caption['attribs']['']['start']))
4517 - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
4519 - if (isset($caption['attribs']['']['end']))
4521 - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
4523 - if (isset($caption['data']))
4525 - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4527 - $captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
4529 - if (is_array($captions))
4531 - $captions = array_values(SimplePie_Misc::array_unique($captions));
4534 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
4536 - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
4538 - $caption_type = null;
4539 - $caption_lang = null;
4540 - $caption_startTime = null;
4541 - $caption_endTime = null;
4542 - $caption_text = null;
4543 - if (isset($caption['attribs']['']['type']))
4545 - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4547 - if (isset($caption['attribs']['']['lang']))
4549 - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
4551 - if (isset($caption['attribs']['']['start']))
4553 - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
4555 - if (isset($caption['attribs']['']['end']))
4557 - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
4559 - if (isset($caption['data']))
4561 - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4563 - $captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
4565 - if (is_array($captions))
4567 - $captions = array_values(SimplePie_Misc::array_unique($captions));
4572 - $captions = $captions_parent;
4576 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
4578 - foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
4583 - if (isset($category['data']))
4585 - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4587 - if (isset($category['attribs']['']['scheme']))
4589 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4593 - $scheme = 'http://search.yahoo.com/mrss/category_schema';
4595 - if (isset($category['attribs']['']['label']))
4597 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
4599 - $categories[] = new $this->feed->category_class($term, $scheme, $label);
4602 - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
4604 - foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
4609 - if (isset($category['data']))
4611 - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4613 - if (isset($category['attribs']['']['scheme']))
4615 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4619 - $scheme = 'http://search.yahoo.com/mrss/category_schema';
4621 - if (isset($category['attribs']['']['label']))
4623 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
4625 - $categories[] = new $this->feed->category_class($term, $scheme, $label);
4628 - if (is_array($categories) && is_array($categories_parent))
4630 - $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent)));
4632 - elseif (is_array($categories))
4634 - $categories = array_values(SimplePie_Misc::array_unique($categories));
4636 - elseif (is_array($categories_parent))
4638 - $categories = array_values(SimplePie_Misc::array_unique($categories_parent));
4642 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
4644 - $copyright_url = null;
4645 - $copyright_label = null;
4646 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url']))
4648 - $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
4650 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
4652 - $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4654 - $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
4656 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
4658 - $copyright_url = null;
4659 - $copyright_label = null;
4660 - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url']))
4662 - $copyright_url = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
4664 - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
4666 - $copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4668 - $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
4672 - $copyrights = $copyrights_parent;
4676 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
4678 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
4680 - $credit_role = null;
4681 - $credit_scheme = null;
4682 - $credit_name = null;
4683 - if (isset($credit['attribs']['']['role']))
4685 - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
4687 - if (isset($credit['attribs']['']['scheme']))
4689 - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4693 - $credit_scheme = 'urn:ebu';
4695 - if (isset($credit['data']))
4697 - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4699 - $credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
4701 - if (is_array($credits))
4703 - $credits = array_values(SimplePie_Misc::array_unique($credits));
4706 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
4708 - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
4710 - $credit_role = null;
4711 - $credit_scheme = null;
4712 - $credit_name = null;
4713 - if (isset($credit['attribs']['']['role']))
4715 - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
4717 - if (isset($credit['attribs']['']['scheme']))
4719 - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4723 - $credit_scheme = 'urn:ebu';
4725 - if (isset($credit['data']))
4727 - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4729 - $credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
4731 - if (is_array($credits))
4733 - $credits = array_values(SimplePie_Misc::array_unique($credits));
4738 - $credits = $credits_parent;
4742 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
4744 - $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4746 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
4748 - $description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4752 - $description = $description_parent;
4756 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
4758 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
4762 - if (isset($hash['data']))
4764 - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4766 - if (isset($hash['attribs']['']['algo']))
4768 - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
4774 - $hashes[] = $algo.':'.$value;
4776 - if (is_array($hashes))
4778 - $hashes = array_values(SimplePie_Misc::array_unique($hashes));
4781 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
4783 - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
4787 - if (isset($hash['data']))
4789 - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4791 - if (isset($hash['attribs']['']['algo']))
4793 - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
4799 - $hashes[] = $algo.':'.$value;
4801 - if (is_array($hashes))
4803 - $hashes = array_values(SimplePie_Misc::array_unique($hashes));
4808 - $hashes = $hashes_parent;
4812 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
4814 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
4816 - $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4817 - foreach ($temp as $word)
4819 - $keywords[] = trim($word);
4823 - if (is_array($keywords))
4825 - $keywords = array_values(SimplePie_Misc::array_unique($keywords));
4828 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
4830 - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
4832 - $temp = explode(',', $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
4833 - foreach ($temp as $word)
4835 - $keywords[] = trim($word);
4839 - if (is_array($keywords))
4841 - $keywords = array_values(SimplePie_Misc::array_unique($keywords));
4846 - $keywords = $keywords_parent;
4850 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
4852 - $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4854 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
4856 - $player = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4860 - $player = $player_parent;
4864 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
4866 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
4868 - $rating_scheme = null;
4869 - $rating_value = null;
4870 - if (isset($rating['attribs']['']['scheme']))
4872 - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4876 - $rating_scheme = 'urn:simple';
4878 - if (isset($rating['data']))
4880 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4882 - $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
4884 - if (is_array($ratings))
4886 - $ratings = array_values(SimplePie_Misc::array_unique($ratings));
4889 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
4891 - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
4893 - $rating_scheme = null;
4894 - $rating_value = null;
4895 - if (isset($rating['attribs']['']['scheme']))
4897 - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
4901 - $rating_scheme = 'urn:simple';
4903 - if (isset($rating['data']))
4905 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4907 - $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
4909 - if (is_array($ratings))
4911 - $ratings = array_values(SimplePie_Misc::array_unique($ratings));
4916 - $ratings = $ratings_parent;
4920 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
4922 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
4924 - $restriction_relationship = null;
4925 - $restriction_type = null;
4926 - $restriction_value = null;
4927 - if (isset($restriction['attribs']['']['relationship']))
4929 - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
4931 - if (isset($restriction['attribs']['']['type']))
4933 - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4935 - if (isset($restriction['data']))
4937 - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4939 - $restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4941 - if (is_array($restrictions))
4943 - $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
4946 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
4948 - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
4950 - $restriction_relationship = null;
4951 - $restriction_type = null;
4952 - $restriction_value = null;
4953 - if (isset($restriction['attribs']['']['relationship']))
4955 - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
4957 - if (isset($restriction['attribs']['']['type']))
4959 - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
4961 - if (isset($restriction['data']))
4963 - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
4965 - $restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4967 - if (is_array($restrictions))
4969 - $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
4974 - $restrictions = $restrictions_parent;
4978 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
4980 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
4982 - $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4984 - if (is_array($thumbnails))
4986 - $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
4989 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
4991 - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
4993 - $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
4995 - if (is_array($thumbnails))
4997 - $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
5002 - $thumbnails = $thumbnails_parent;
5006 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
5008 - $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5010 - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
5012 - $title = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5016 - $title = $title_parent;
5019 - $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);
5024 - // If we have standalone media:content tags, loop through them.
5025 - if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content']))
5027 - foreach ((array) $this->data['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content)
5029 - if (isset($content['attribs']['']['url']))
5035 - $expression = null;
5036 - $framerate = null;
5038 - $javascript = null;
5042 - $samplingrate = null;
5049 - $categories = null;
5050 - $copyrights = null;
5052 - $description = null;
5057 - $restrictions = null;
5058 - $thumbnails = null;
5061 - // Start checking the attributes of media:content
5062 - if (isset($content['attribs']['']['bitrate']))
5064 - $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT);
5066 - if (isset($content['attribs']['']['channels']))
5068 - $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT);
5070 - if (isset($content['attribs']['']['duration']))
5072 - $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT);
5076 - $duration = $duration_parent;
5078 - if (isset($content['attribs']['']['expression']))
5080 - $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT);
5082 - if (isset($content['attribs']['']['framerate']))
5084 - $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT);
5086 - if (isset($content['attribs']['']['height']))
5088 - $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT);
5090 - if (isset($content['attribs']['']['lang']))
5092 - $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
5094 - if (isset($content['attribs']['']['fileSize']))
5096 - $length = ceil($content['attribs']['']['fileSize']);
5098 - if (isset($content['attribs']['']['medium']))
5100 - $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT);
5102 - if (isset($content['attribs']['']['samplingrate']))
5104 - $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT);
5106 - if (isset($content['attribs']['']['type']))
5108 - $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
5110 - if (isset($content['attribs']['']['width']))
5112 - $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT);
5114 - $url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
5116 - // Checking the other optional media: elements. Priority: media:content, media:group, item, channel
5119 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
5121 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
5123 - $caption_type = null;
5124 - $caption_lang = null;
5125 - $caption_startTime = null;
5126 - $caption_endTime = null;
5127 - $caption_text = null;
5128 - if (isset($caption['attribs']['']['type']))
5130 - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
5132 - if (isset($caption['attribs']['']['lang']))
5134 - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
5136 - if (isset($caption['attribs']['']['start']))
5138 - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
5140 - if (isset($caption['attribs']['']['end']))
5142 - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
5144 - if (isset($caption['data']))
5146 - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5148 - $captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
5150 - if (is_array($captions))
5152 - $captions = array_values(SimplePie_Misc::array_unique($captions));
5157 - $captions = $captions_parent;
5161 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
5163 - foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
5168 - if (isset($category['data']))
5170 - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5172 - if (isset($category['attribs']['']['scheme']))
5174 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
5178 - $scheme = 'http://search.yahoo.com/mrss/category_schema';
5180 - if (isset($category['attribs']['']['label']))
5182 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
5184 - $categories[] = new $this->feed->category_class($term, $scheme, $label);
5187 - if (is_array($categories) && is_array($categories_parent))
5189 - $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent)));
5191 - elseif (is_array($categories))
5193 - $categories = array_values(SimplePie_Misc::array_unique($categories));
5195 - elseif (is_array($categories_parent))
5197 - $categories = array_values(SimplePie_Misc::array_unique($categories_parent));
5201 - $categories = null;
5205 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
5207 - $copyright_url = null;
5208 - $copyright_label = null;
5209 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url']))
5211 - $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
5213 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
5215 - $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5217 - $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
5221 - $copyrights = $copyrights_parent;
5225 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
5227 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
5229 - $credit_role = null;
5230 - $credit_scheme = null;
5231 - $credit_name = null;
5232 - if (isset($credit['attribs']['']['role']))
5234 - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
5236 - if (isset($credit['attribs']['']['scheme']))
5238 - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
5242 - $credit_scheme = 'urn:ebu';
5244 - if (isset($credit['data']))
5246 - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5248 - $credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
5250 - if (is_array($credits))
5252 - $credits = array_values(SimplePie_Misc::array_unique($credits));
5257 - $credits = $credits_parent;
5261 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
5263 - $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5267 - $description = $description_parent;
5271 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
5273 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
5277 - if (isset($hash['data']))
5279 - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5281 - if (isset($hash['attribs']['']['algo']))
5283 - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
5289 - $hashes[] = $algo.':'.$value;
5291 - if (is_array($hashes))
5293 - $hashes = array_values(SimplePie_Misc::array_unique($hashes));
5298 - $hashes = $hashes_parent;
5302 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
5304 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
5306 - $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
5307 - foreach ($temp as $word)
5309 - $keywords[] = trim($word);
5313 - if (is_array($keywords))
5315 - $keywords = array_values(SimplePie_Misc::array_unique($keywords));
5320 - $keywords = $keywords_parent;
5324 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
5326 - $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
5330 - $player = $player_parent;
5334 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
5336 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
5338 - $rating_scheme = null;
5339 - $rating_value = null;
5340 - if (isset($rating['attribs']['']['scheme']))
5342 - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
5346 - $rating_scheme = 'urn:simple';
5348 - if (isset($rating['data']))
5350 - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5352 - $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
5354 - if (is_array($ratings))
5356 - $ratings = array_values(SimplePie_Misc::array_unique($ratings));
5361 - $ratings = $ratings_parent;
5365 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
5367 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
5369 - $restriction_relationship = null;
5370 - $restriction_type = null;
5371 - $restriction_value = null;
5372 - if (isset($restriction['attribs']['']['relationship']))
5374 - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT);
5376 - if (isset($restriction['attribs']['']['type']))
5378 - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
5380 - if (isset($restriction['data']))
5382 - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5384 - $restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
5386 - if (is_array($restrictions))
5388 - $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
5393 - $restrictions = $restrictions_parent;
5397 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
5399 - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
5401 - $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
5403 - if (is_array($thumbnails))
5405 - $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
5410 - $thumbnails = $thumbnails_parent;
5414 - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
5416 - $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5420 - $title = $title_parent;
5423 - $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);
5428 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
5430 - if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
5436 - $expression = null;
5437 - $framerate = null;
5439 - $javascript = null;
5443 - $samplingrate = null;
5448 - $url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
5449 - if (isset($link['attribs']['']['type']))
5451 - $type = $this->sanitize($link['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
5453 - if (isset($link['attribs']['']['length']))
5455 - $length = ceil($link['attribs']['']['length']);
5458 - // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
5459 - $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);
5463 - foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link)
5465 - if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
5471 - $expression = null;
5472 - $framerate = null;
5474 - $javascript = null;
5478 - $samplingrate = null;
5483 - $url = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
5484 - if (isset($link['attribs']['']['type']))
5486 - $type = $this->sanitize($link['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
5488 - if (isset($link['attribs']['']['length']))
5490 - $length = ceil($link['attribs']['']['length']);
5493 - // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
5494 - $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);
5498 - if ($enclosure = $this->get_item_tags('', 'enclosure'))
5500 - if (isset($enclosure[0]['attribs']['']['url']))
5506 - $expression = null;
5507 - $framerate = null;
5509 - $javascript = null;
5513 - $samplingrate = null;
5518 - $url = $this->sanitize($enclosure[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($enclosure[0]));
5519 - if (isset($enclosure[0]['attribs']['']['type']))
5521 - $type = $this->sanitize($enclosure[0]['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
5523 - if (isset($enclosure[0]['attribs']['']['length']))
5525 - $length = ceil($enclosure[0]['attribs']['']['length']);
5528 - // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
5529 - $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);
5533 - 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))
5535 - // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
5536 - $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);
5539 - $this->data['enclosures'] = array_values(SimplePie_Misc::array_unique($this->data['enclosures']));
5541 - if (!empty($this->data['enclosures']))
5543 - return $this->data['enclosures'];
5551 - function get_latitude()
5553 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
5555 - return (float) $return[0]['data'];
5557 - elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
5559 - return (float) $match[1];
5567 - function get_longitude()
5569 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
5571 - return (float) $return[0]['data'];
5573 - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
5575 - return (float) $return[0]['data'];
5577 - elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
5579 - return (float) $match[2];
5587 - function get_source()
5589 - if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source'))
5591 - return new $this->feed->source_class($this, $return[0]);
5600 - * Creates the add_to_* methods' return data
5603 - * @param string $item_url String to prefix to the item permalink
5604 - * @param string $title_url String to prefix to the item title
5605 - * (and suffix to the item permalink)
5606 - * @return mixed URL if feed exists, false otherwise
5608 - function add_to_service($item_url, $title_url = null, $summary_url = null)
5610 - if ($this->get_permalink() !== null)
5612 - $return = $this->sanitize($item_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_permalink());
5613 - if ($title_url !== null && $this->get_title() !== null)
5615 - $return .= $this->sanitize($title_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_title());
5617 - if ($summary_url !== null && $this->get_description() !== null)
5619 - $return .= $this->sanitize($summary_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_description());
5629 - function add_to_blinklist()
5631 - return $this->add_to_service('http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url=', '&Title=');
5634 - function add_to_blogmarks()
5636 - return $this->add_to_service('http://blogmarks.net/my/new.php?mini=1&simple=1&url=', '&title=');
5639 - function add_to_delicious()
5641 - return $this->add_to_service('http://del.icio.us/post/?v=4&url=', '&title=');
5644 - function add_to_digg()
5646 - return $this->add_to_service('http://digg.com/submit?url=', '&title=', '&bodytext=');
5649 - function add_to_furl()
5651 - return $this->add_to_service('http://www.furl.net/storeIt.jsp?u=', '&t=');
5654 - function add_to_magnolia()
5656 - return $this->add_to_service('http://ma.gnolia.com/bookmarklet/add?url=', '&title=');
5659 - function add_to_myweb20()
5661 - return $this->add_to_service('http://myweb2.search.yahoo.com/myresults/bookmarklet?u=', '&t=');
5664 - function add_to_newsvine()
5666 - return $this->add_to_service('http://www.newsvine.com/_wine/save?u=', '&h=');
5669 - function add_to_reddit()
5671 - return $this->add_to_service('http://reddit.com/submit?url=', '&title=');
5674 - function add_to_segnalo()
5676 - return $this->add_to_service('http://segnalo.com/post.html.php?url=', '&title=');
5679 - function add_to_simpy()
5681 - return $this->add_to_service('http://www.simpy.com/simpy/LinkAdd.do?href=', '&title=');
5684 - function add_to_spurl()
5686 - return $this->add_to_service('http://www.spurl.net/spurl.php?v=3&url=', '&title=');
5689 - function add_to_wists()
5691 - return $this->add_to_service('http://wists.com/r.php?c=&r=', '&title=');
5694 - function search_technorati()
5696 - return $this->add_to_service('http://www.technorati.com/search/');
5700 -class SimplePie_Source
5703 - var $data = array();
5705 - function SimplePie_Source($item, $data)
5707 - $this->item = $item;
5708 - $this->data = $data;
5711 - function __toString()
5713 - return md5(serialize($this->data));
5717 - * Remove items that link back to this before destroying this object
5719 - function __destruct()
5721 - unset($this->item);
5724 - function get_source_tags($namespace, $tag)
5726 - if (isset($this->data['child'][$namespace][$tag]))
5728 - return $this->data['child'][$namespace][$tag];
5736 - function get_base($element = array())
5738 - return $this->item->get_base($element);
5741 - function sanitize($data, $type, $base = '')
5743 - return $this->item->sanitize($data, $type, $base);
5746 - function get_item()
5748 - return $this->item;
5751 - function get_title()
5753 - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
5755 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
5757 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
5759 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
5761 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
5763 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
5765 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
5767 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
5769 - elseif ($return = $this->get_source_tags('', 'title'))
5771 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
5773 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
5775 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5777 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
5779 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5787 - function get_category($key = 0)
5789 - $categories = $this->get_categories();
5790 - if (isset($categories[$key]))
5792 - return $categories[$key];
5800 - function get_categories()
5802 - $categories = array();
5804 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
5809 - if (isset($category['attribs']['']['term']))
5811 - $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
5813 - if (isset($category['attribs']['']['scheme']))
5815 - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
5817 - if (isset($category['attribs']['']['label']))
5819 - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
5821 - $categories[] = new $this->item->feed->category_class($term, $scheme, $label);
5823 - foreach ((array) $this->get_source_tags('', 'category') as $category)
5825 - $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
5827 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
5829 - $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
5831 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
5833 - $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
5836 - if (!empty($categories))
5838 - return SimplePie_Misc::array_unique($categories);
5846 - function get_author($key = 0)
5848 - $authors = $this->get_authors();
5849 - if (isset($authors[$key]))
5851 - return $authors[$key];
5859 - function get_authors()
5861 - $authors = array();
5862 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
5867 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
5869 - $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5871 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
5873 - $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]));
5875 - if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
5877 - $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5879 - if ($name !== null || $email !== null || $uri !== null)
5881 - $authors[] = new $this->item->feed->author_class($name, $uri, $email);
5884 - if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
5889 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
5891 - $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5893 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
5895 - $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]));
5897 - if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
5899 - $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5901 - if ($name !== null || $email !== null || $url !== null)
5903 - $authors[] = new $this->item->feed->author_class($name, $url, $email);
5906 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
5908 - $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
5910 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
5912 - $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
5914 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
5916 - $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
5919 - if (!empty($authors))
5921 - return SimplePie_Misc::array_unique($authors);
5929 - function get_contributor($key = 0)
5931 - $contributors = $this->get_contributors();
5932 - if (isset($contributors[$key]))
5934 - return $contributors[$key];
5942 - function get_contributors()
5944 - $contributors = array();
5945 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
5950 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
5952 - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5954 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
5956 - $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]));
5958 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
5960 - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5962 - if ($name !== null || $email !== null || $uri !== null)
5964 - $contributors[] = new $this->item->feed->author_class($name, $uri, $email);
5967 - foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
5972 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
5974 - $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5976 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
5978 - $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]));
5980 - if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
5982 - $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
5984 - if ($name !== null || $email !== null || $url !== null)
5986 - $contributors[] = new $this->item->feed->author_class($name, $url, $email);
5990 - if (!empty($contributors))
5992 - return SimplePie_Misc::array_unique($contributors);
6000 - function get_link($key = 0, $rel = 'alternate')
6002 - $links = $this->get_links($rel);
6003 - if (isset($links[$key]))
6005 - return $links[$key];
6014 - * Added for parity between the parent-level and the item/entry-level.
6016 - function get_permalink()
6018 - return $this->get_link(0);
6021 - function get_links($rel = 'alternate')
6023 - if (!isset($this->data['links']))
6025 - $this->data['links'] = array();
6026 - if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
6028 - foreach ($links as $link)
6030 - if (isset($link['attribs']['']['href']))
6032 - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
6033 - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
6037 - if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
6039 - foreach ($links as $link)
6041 - if (isset($link['attribs']['']['href']))
6043 - $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
6044 - $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
6049 - if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
6051 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
6053 - if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
6055 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
6057 - if ($links = $this->get_source_tags('', 'link'))
6059 - $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
6062 - $keys = array_keys($this->data['links']);
6063 - foreach ($keys as $key)
6065 - if (SimplePie_Misc::is_isegment_nz_nc($key))
6067 - if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
6069 - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
6070 - $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
6074 - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
6077 - elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
6079 - $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
6081 - $this->data['links'][$key] = array_unique($this->data['links'][$key]);
6085 - if (isset($this->data['links'][$rel]))
6087 - return $this->data['links'][$rel];
6095 - function get_description()
6097 - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
6099 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
6101 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
6103 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
6105 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
6107 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
6109 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
6111 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
6113 - elseif ($return = $this->get_source_tags('', 'description'))
6115 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
6117 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
6119 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6121 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
6123 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6125 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
6127 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
6129 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
6131 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
6139 - function get_copyright()
6141 - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
6143 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
6145 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
6147 - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
6149 - elseif ($return = $this->get_source_tags('', 'copyright'))
6151 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6153 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
6155 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6157 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
6159 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6167 - function get_language()
6169 - if ($return = $this->get_source_tags('', 'language'))
6171 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6173 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
6175 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6177 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
6179 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
6181 - elseif (isset($this->data['xml_lang']))
6183 - return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
6191 - function get_latitude()
6193 - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
6195 - return (float) $return[0]['data'];
6197 - elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
6199 - return (float) $match[1];
6207 - function get_longitude()
6209 - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
6211 - return (float) $return[0]['data'];
6213 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
6215 - return (float) $return[0]['data'];
6217 - elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match))
6219 - return (float) $match[2];
6227 - function get_image_url()
6229 - if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
6231 - return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
6233 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
6235 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
6237 - elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
6239 - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
6248 -class SimplePie_Author
6254 - // Constructor, used to input the data
6255 - function SimplePie_Author($name = null, $link = null, $email = null)
6257 - $this->name = $name;
6258 - $this->link = $link;
6259 - $this->email = $email;
6262 - function __toString()
6264 - // There is no $this->data here
6265 - return md5(serialize($this));
6268 - function get_name()
6270 - if ($this->name !== null)
6272 - return $this->name;
6280 - function get_link()
6282 - if ($this->link !== null)
6284 - return $this->link;
6292 - function get_email()
6294 - if ($this->email !== null)
6296 - return $this->email;
6305 -class SimplePie_Category
6311 - // Constructor, used to input the data
6312 - function SimplePie_Category($term = null, $scheme = null, $label = null)
6314 - $this->term = $term;
6315 - $this->scheme = $scheme;
6316 - $this->label = $label;
6319 - function __toString()
6321 - // There is no $this->data here
6322 - return md5(serialize($this));
6325 - function get_term()
6327 - if ($this->term !== null)
6329 - return $this->term;
6337 - function get_scheme()
6339 - if ($this->scheme !== null)
6341 - return $this->scheme;
6349 - function get_label()
6351 - if ($this->label !== null)
6353 - return $this->label;
6357 - return $this->get_term();
6362 -class SimplePie_Enclosure
6385 - var $restrictions;
6386 - var $samplingrate;
6392 - // Constructor, used to input the data
6393 - 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)
6395 - $this->bitrate = $bitrate;
6396 - $this->captions = $captions;
6397 - $this->categories = $categories;
6398 - $this->channels = $channels;
6399 - $this->copyright = $copyright;
6400 - $this->credits = $credits;
6401 - $this->description = $description;
6402 - $this->duration = $duration;
6403 - $this->expression = $expression;
6404 - $this->framerate = $framerate;
6405 - $this->hashes = $hashes;
6406 - $this->height = $height;
6407 - $this->javascript = $javascript;
6408 - $this->keywords = $keywords;
6409 - $this->lang = $lang;
6410 - $this->length = $length;
6411 - $this->link = $link;
6412 - $this->medium = $medium;
6413 - $this->player = $player;
6414 - $this->ratings = $ratings;
6415 - $this->restrictions = $restrictions;
6416 - $this->samplingrate = $samplingrate;
6417 - $this->thumbnails = $thumbnails;
6418 - $this->title = $title;
6419 - $this->type = $type;
6420 - $this->width = $width;
6421 - if (class_exists('idna_convert'))
6423 - $idn = new idna_convert;
6424 - $parsed = SimplePie_Misc::parse_url($link);
6425 - $this->link = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
6427 - $this->handler = $this->get_handler(); // Needs to load last
6430 - function __toString()
6432 - // There is no $this->data here
6433 - return md5(serialize($this));
6436 - function get_bitrate()
6438 - if ($this->bitrate !== null)
6440 - return $this->bitrate;
6448 - function get_caption($key = 0)
6450 - $captions = $this->get_captions();
6451 - if (isset($captions[$key]))
6453 - return $captions[$key];
6461 - function get_captions()
6463 - if ($this->captions !== null)
6465 - return $this->captions;
6473 - function get_category($key = 0)
6475 - $categories = $this->get_categories();
6476 - if (isset($categories[$key]))
6478 - return $categories[$key];
6486 - function get_categories()
6488 - if ($this->categories !== null)
6490 - return $this->categories;
6498 - function get_channels()
6500 - if ($this->channels !== null)
6502 - return $this->channels;
6510 - function get_copyright()
6512 - if ($this->copyright !== null)
6514 - return $this->copyright;
6522 - function get_credit($key = 0)
6524 - $credits = $this->get_credits();
6525 - if (isset($credits[$key]))
6527 - return $credits[$key];
6535 - function get_credits()
6537 - if ($this->credits !== null)
6539 - return $this->credits;
6547 - function get_description()
6549 - if ($this->description !== null)
6551 - return $this->description;
6559 - function get_duration($convert = false)
6561 - if ($this->duration !== null)
6565 - $time = SimplePie_Misc::time_hms($this->duration);
6570 - return $this->duration;
6579 - function get_expression()
6581 - if ($this->expression !== null)
6583 - return $this->expression;
6591 - function get_extension()
6593 - if ($this->link !== null)
6595 - $url = SimplePie_Misc::parse_url($this->link);
6596 - if ($url['path'] !== '')
6598 - return pathinfo($url['path'], PATHINFO_EXTENSION);
6604 - function get_framerate()
6606 - if ($this->framerate !== null)
6608 - return $this->framerate;
6616 - function get_handler()
6618 - return $this->get_real_type(true);
6621 - function get_hash($key = 0)
6623 - $hashes = $this->get_hashes();
6624 - if (isset($hashes[$key]))
6626 - return $hashes[$key];
6634 - function get_hashes()
6636 - if ($this->hashes !== null)
6638 - return $this->hashes;
6646 - function get_height()
6648 - if ($this->height !== null)
6650 - return $this->height;
6658 - function get_language()
6660 - if ($this->lang !== null)
6662 - return $this->lang;
6670 - function get_keyword($key = 0)
6672 - $keywords = $this->get_keywords();
6673 - if (isset($keywords[$key]))
6675 - return $keywords[$key];
6683 - function get_keywords()
6685 - if ($this->keywords !== null)
6687 - return $this->keywords;
6695 - function get_length()
6697 - if ($this->length !== null)
6699 - return $this->length;
6707 - function get_link()
6709 - if ($this->link !== null)
6711 - return urldecode($this->link);
6719 - function get_medium()
6721 - if ($this->medium !== null)
6723 - return $this->medium;
6731 - function get_player()
6733 - if ($this->player !== null)
6735 - return $this->player;
6743 - function get_rating($key = 0)
6745 - $ratings = $this->get_ratings();
6746 - if (isset($ratings[$key]))
6748 - return $ratings[$key];
6756 - function get_ratings()
6758 - if ($this->ratings !== null)
6760 - return $this->ratings;
6768 - function get_restriction($key = 0)
6770 - $restrictions = $this->get_restrictions();
6771 - if (isset($restrictions[$key]))
6773 - return $restrictions[$key];
6781 - function get_restrictions()
6783 - if ($this->restrictions !== null)
6785 - return $this->restrictions;
6793 - function get_sampling_rate()
6795 - if ($this->samplingrate !== null)
6797 - return $this->samplingrate;
6805 - function get_size()
6807 - $length = $this->get_length();
6808 - if ($length !== null)
6810 - return round($length/1048576, 2);
6818 - function get_thumbnail($key = 0)
6820 - $thumbnails = $this->get_thumbnails();
6821 - if (isset($thumbnails[$key]))
6823 - return $thumbnails[$key];
6831 - function get_thumbnails()
6833 - if ($this->thumbnails !== null)
6835 - return $this->thumbnails;
6843 - function get_title()
6845 - if ($this->title !== null)
6847 - return $this->title;
6855 - function get_type()
6857 - if ($this->type !== null)
6859 - return $this->type;
6867 - function get_width()
6869 - if ($this->width !== null)
6871 - return $this->width;
6879 - function native_embed($options='')
6881 - return $this->embed($options, true);
6885 - * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.
6887 - function embed($options = '', $native = false)
6889 - // Set up defaults
6897 - $bgcolor = '#ffffff';
6898 - $mediaplayer = '';
6899 - $widescreen = false;
6900 - $handler = $this->get_handler();
6901 - $type = $this->get_real_type();
6903 - // Process options and reassign values as necessary
6904 - if (is_array($options))
6906 - extract($options);
6910 - $options = explode(',', $options);
6911 - foreach($options as $option)
6913 - $opt = explode(':', $option, 2);
6914 - if (isset($opt[0], $opt[1]))
6916 - $opt[0] = trim($opt[0]);
6917 - $opt[1] = trim($opt[1]);
6933 - $altclass = $opt[1];
6945 - $height = $opt[1];
6949 - $bgcolor = $opt[1];
6952 - case 'mediaplayer':
6953 - $mediaplayer = $opt[1];
6956 - case 'widescreen':
6957 - $widescreen = $opt[1];
6964 - $mime = explode('/', $type, 2);
6967 - // Process values for 'auto'
6968 - if ($width == 'auto')
6970 - if ($mime == 'video')
6972 - if ($height == 'auto')
6976 - elseif ($widescreen)
6978 - $width = round((intval($height)/9)*16);
6982 - $width = round((intval($height)/3)*4);
6991 - if ($height == 'auto')
6993 - if ($mime == 'audio')
6997 - elseif ($mime == 'video')
6999 - if ($width == 'auto')
7010 - elseif ($widescreen)
7012 - $height = round((intval($width)/16)*9);
7016 - $height = round((intval($width)/4)*3);
7024 - elseif ($mime == 'audio')
7029 - // Set proper placeholder value
7030 - if ($mime == 'audio')
7032 - $placeholder = $audio;
7034 - elseif ($mime == 'video')
7036 - $placeholder = $video;
7041 - // Make sure the JS library is included
7044 - static $javascript_outputted = null;
7045 - if (!$javascript_outputted && $this->javascript)
7047 - $embed .= '<script type="text/javascript" src="?' . htmlspecialchars($this->javascript) . '"></script>';
7048 - $javascript_outputted = true;
7052 - // Odeo Feed MP3's
7053 - if ($handler == 'odeo')
7057 - $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>';
7061 - $embed .= '<script language="JavaScript" type="text/javascript">/* <![CDATA[ */embed_odeo("' . $this->get_link() . '");/* ]]> */</script>';
7066 - elseif ($handler == 'flash')
7070 - $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>";
7074 - $embed .= '<script language="JavaScript" type="text/javascript">/* <![CDATA[ */' .
7075 - "embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');/* ]]> */</script>";
7079 - // Flash Media Player file types.
7080 - // Preferred handler for MP3 file types.
7081 - elseif ($handler == 'fmedia' || ($handler == 'mp3' && $mediaplayer != ''))
7086 - $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>";
7090 - $embed .= '<script language="JavaScript" type="text/javascript">/* <![CDATA[ */' .
7091 - "embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');/* ]]> */</script>";
7095 - // QuickTime 7 file types. Need to test with QuickTime 6.
7096 - // Only handle MP3's if the Flash Media Player is not present.
7097 - elseif ($handler == 'quicktime' || ($handler == 'mp3' && $mediaplayer == ''))
7102 - if ($placeholder != ""){
7103 - $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>";
7106 - $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>";
7111 - $embed .= '<script language="JavaScript" type="text/javascript">/* <![CDATA[ */' .
7112 - "embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');/* ]]> */</script>";
7117 - elseif ($handler == 'wmedia')
7122 - $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>";
7126 - $embed .= '<script language="JavaScript" type="text/javascript">/* <![CDATA[ */' .
7127 - "embed_wmedia('$width', '$height', '" . $this->get_link() . "');/* ]]> */</script>";
7131 - // Everything else
7132 - else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
7137 - function get_real_type($find_handler = false)
7139 - // If it's Odeo, let's get it out of the way.
7140 - if (substr(strtolower($this->get_link()), 0, 15) == 'http://odeo.com')
7145 - // Mime-types by handler.
7146 - $types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
7147 - $types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player
7148 - $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
7149 - $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
7150 - $types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3
7152 - if ($this->get_type() !== null)
7154 - $type = strtolower($this->type);
7161 - // If we encounter an unsupported mime-type, check the file extension and guess intelligently.
7162 - if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3)))
7164 - switch (strtolower($this->get_extension()))
7166 - // Audio mime-types
7169 - $type = 'audio/acc';
7176 - $type = 'audio/aiff';
7180 - $type = 'audio/wav';
7187 - $type = 'audio/midi';
7191 - $type = 'audio/x-m4a';
7196 - $type = 'audio/mp3';
7200 - $type = 'audio/wav';
7204 - $type = 'audio/x-ms-wax';
7208 - $type = 'audio/x-ms-wma';
7211 - // Video mime-types
7214 - $type = 'video/3gpp';
7219 - $type = 'video/3gpp2';
7223 - $type = 'video/x-ms-asf';
7227 - $type = 'video/x-flv';
7241 - $type = 'video/mpeg';
7245 - $type = 'video/x-m4v';
7250 - $type = 'video/quicktime';
7255 - $type = 'video/mp4';
7259 - $type = 'video/sd-video';
7263 - $type = 'video/x-ms-wm';
7267 - $type = 'video/x-ms-wmv';
7271 - $type = 'video/x-ms-wvx';
7274 - // Flash mime-types
7276 - $type = 'application/futuresplash';
7280 - $type = 'application/x-shockwave-flash';
7285 - if ($find_handler)
7287 - if (in_array($type, $types_flash))
7291 - elseif (in_array($type, $types_fmedia))
7295 - elseif (in_array($type, $types_quicktime))
7297 - return 'quicktime';
7299 - elseif (in_array($type, $types_wmedia))
7303 - elseif (in_array($type, $types_mp3))
7319 -class SimplePie_Caption
7327 - // Constructor, used to input the data
7328 - function SimplePie_Caption($type = null, $lang = null, $startTime = null, $endTime = null, $text = null)
7330 - $this->type = $type;
7331 - $this->lang = $lang;
7332 - $this->startTime = $startTime;
7333 - $this->endTime = $endTime;
7334 - $this->text = $text;
7337 - function __toString()
7339 - // There is no $this->data here
7340 - return md5(serialize($this));
7343 - function get_endtime()
7345 - if ($this->endTime !== null)
7347 - return $this->endTime;
7355 - function get_language()
7357 - if ($this->lang !== null)
7359 - return $this->lang;
7367 - function get_starttime()
7369 - if ($this->startTime !== null)
7371 - return $this->startTime;
7379 - function get_text()
7381 - if ($this->text !== null)
7383 - return $this->text;
7391 - function get_type()
7393 - if ($this->type !== null)
7395 - return $this->type;
7404 -class SimplePie_Credit
7410 - // Constructor, used to input the data
7411 - function SimplePie_Credit($role = null, $scheme = null, $name = null)
7413 - $this->role = $role;
7414 - $this->scheme = $scheme;
7415 - $this->name = $name;
7418 - function __toString()
7420 - // There is no $this->data here
7421 - return md5(serialize($this));
7424 - function get_role()
7426 - if ($this->role !== null)
7428 - return $this->role;
7436 - function get_scheme()
7438 - if ($this->scheme !== null)
7440 - return $this->scheme;
7448 - function get_name()
7450 - if ($this->name !== null)
7452 - return $this->name;
7461 -class SimplePie_Copyright
7466 - // Constructor, used to input the data
7467 - function SimplePie_Copyright($url = null, $label = null)
7469 - $this->url = $url;
7470 - $this->label = $label;
7473 - function __toString()
7475 - // There is no $this->data here
7476 - return md5(serialize($this));
7479 - function get_url()
7481 - if ($this->url !== null)
7483 - return $this->url;
7491 - function get_attribution()
7493 - if ($this->label !== null)
7495 - return $this->label;
7504 -class SimplePie_Rating
7509 - // Constructor, used to input the data
7510 - function SimplePie_Rating($scheme = null, $value = null)
7512 - $this->scheme = $scheme;
7513 - $this->value = $value;
7516 - function __toString()
7518 - // There is no $this->data here
7519 - return md5(serialize($this));
7522 - function get_scheme()
7524 - if ($this->scheme !== null)
7526 - return $this->scheme;
7534 - function get_value()
7536 - if ($this->value !== null)
7538 - return $this->value;
7547 -class SimplePie_Restriction
7549 - var $relationship;
7553 - // Constructor, used to input the data
7554 - function SimplePie_Restriction($relationship = null, $type = null, $value = null)
7556 - $this->relationship = $relationship;
7557 - $this->type = $type;
7558 - $this->value = $value;
7561 - function __toString()
7563 - // There is no $this->data here
7564 - return md5(serialize($this));
7567 - function get_relationship()
7569 - if ($this->relationship !== null)
7571 - return $this->relationship;
7579 - function get_type()
7581 - if ($this->type !== null)
7583 - return $this->type;
7591 - function get_value()
7593 - if ($this->value !== null)
7595 - return $this->value;
7605 - * @todo Move to properly supporting RFC2616 (HTTP/1.1)
7607 -class SimplePie_File
7611 - var $success = true;
7612 - var $headers = array();
7615 - var $redirects = 0;
7617 - var $method = SIMPLEPIE_FILE_SOURCE_NONE;
7619 - function SimplePie_File($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false, $proxy = "")
7621 - if (class_exists('idna_convert'))
7623 - $idn = new idna_convert;
7624 - $parsed = SimplePie_Misc::parse_url($url);
7625 - $url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
7627 - $this->url = $url;
7628 - $this->useragent = $useragent;
7629 - if (preg_match('/^http(s)?:\/\//i', $url))
7631 - if ($useragent === null)
7633 - $useragent = ini_get('user_agent');
7634 - $this->useragent = $useragent;
7636 - if (!is_array($headers))
7638 - $headers = array();
7640 - if (!$force_fsockopen && function_exists('curl_exec'))
7642 - $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL;
7643 - $fp = curl_init();
7644 - $headers2 = array();
7645 - foreach ($headers as $key => $value)
7647 - $headers2[] = "$key: $value";
7649 - if (version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>='))
7651 - curl_setopt($fp, CURLOPT_ENCODING, '');
7653 - curl_setopt($fp, CURLOPT_URL, $url);
7654 - curl_setopt($fp, CURLOPT_HEADER, 1);
7655 - curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
7656 - curl_setopt($fp, CURLOPT_TIMEOUT, $timeout);
7657 - curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout);
7658 - curl_setopt($fp, CURLOPT_REFERER, $url);
7659 - curl_setopt($fp, CURLOPT_USERAGENT, $useragent);
7660 - curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
7661 - if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>='))
7663 - curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1);
7664 - curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
7668 - curl_setopt($fp, CURLOPT_PROXY, $proxy);
7671 - $this->headers = curl_exec($fp);
7672 - if (curl_errno($fp) == 23 || curl_errno($fp) == 61)
7674 - curl_setopt($fp, CURLOPT_ENCODING, 'none');
7675 - $this->headers = curl_exec($fp);
7677 - if (curl_errno($fp))
7679 - $this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
7680 - $this->success = false;
7684 - $info = curl_getinfo($fp);
7686 - $this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1);
7687 - $this->headers = array_pop($this->headers);
7688 - $parser = new SimplePie_HTTP_Parser($this->headers);
7689 - if ($parser->parse())
7691 - $this->headers = $parser->headers;
7692 - $this->body = $parser->body;
7693 - $this->status_code = $parser->status_code;
7694 - 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)
7696 - $this->redirects++;
7697 - $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
7698 - return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
7705 - $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
7706 - $url_parts = parse_url($url);
7707 - if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) == 'https')
7709 - $url_parts['host'] = "ssl://$url_parts[host]";
7710 - $url_parts['port'] = 443;
7712 - if (!isset($url_parts['port']))
7714 - $url_parts['port'] = 80;
7717 - $proxy_parts = explode(':', $proxy);
7718 - if (!isset($proxy_parts[1])) {
7719 - $proxy_parts[1] = 80;
7721 - $host = $proxy_parts[0];
7722 - $port = $proxy_parts[1];
7724 - $host = $url_parts['host'];
7725 - $port = $url_parts['port'];
7727 - $fp = @fsockopen($host, $port, $errno, $errstr, $timeout);
7730 - $this->error = 'fsockopen error: ' . $errstr;
7731 - $this->success = false;
7735 - stream_set_timeout($fp, $timeout);
7739 - if (isset($url_parts['path']))
7741 - if (isset($url_parts['query']))
7743 - $get = "$url_parts[path]?$url_parts[query]";
7747 - $get = $url_parts['path'];
7755 - $out = "GET $get HTTP/1.0\r\n";
7756 - $out .= "Host: $url_parts[host]\r\n";
7757 - $out .= "User-Agent: $useragent\r\n";
7758 - if (extension_loaded('zlib'))
7760 - $out .= "Accept-Encoding: x-gzip,gzip,deflate\r\n";
7763 - if (isset($url_parts['user']) && isset($url_parts['pass']))
7765 - $out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n";
7767 - foreach ($headers as $key => $value)
7769 - $out .= "$key: $value\r\n";
7771 - $out .= "Connection: Close\r\n\r\n";
7772 - fwrite($fp, $out);
7774 - $info = stream_get_meta_data($fp);
7776 - $this->headers = '';
7777 - while (!$info['eof'] && !$info['timed_out'])
7779 - $this->headers .= fread($fp, 1160);
7780 - $info = stream_get_meta_data($fp);
7782 - if (!$info['timed_out'])
7784 - $parser = new SimplePie_HTTP_Parser($this->headers);
7785 - if ($parser->parse())
7787 - $this->headers = $parser->headers;
7788 - $this->body = $parser->body;
7789 - $this->status_code = $parser->status_code;
7790 - 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)
7792 - $this->redirects++;
7793 - $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
7794 - return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
7796 - if (isset($this->headers['content-encoding']))
7798 - // Hey, we act dumb elsewhere, so let's do that here too
7799 - switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20")))
7803 - $decoder = new SimplePie_gzdecode($this->body);
7804 - if (!$decoder->parse())
7806 - $this->error = 'Unable to decode HTTP "gzip" stream';
7807 - $this->success = false;
7811 - $this->body = $decoder->data;
7816 - if (($body = gzuncompress($this->body)) === false)
7818 - if (($body = gzinflate($this->body)) === false)
7820 - $this->error = 'Unable to decode HTTP "deflate" stream';
7821 - $this->success = false;
7824 - $this->body = $body;
7828 - $this->error = 'Unknown content coding';
7829 - $this->success = false;
7836 - $this->error = 'fsocket timed out';
7837 - $this->success = false;
7845 - $this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS;
7846 - if (!$this->body = file_get_contents($url))
7848 - $this->error = 'file_get_contents could not read the file';
7849 - $this->success = false;
7856 - * HTTP Response Parser
7858 - * @package SimplePie
7860 -class SimplePie_HTTP_Parser
7868 - var $http_version = 0.0;
7876 - var $status_code = 0;
7887 - * Key/value pairs of the headers
7892 - var $headers = array();
7895 - * Body of the response
7903 - * Current state of the state machine
7908 - var $state = 'http_version';
7919 - * Input data length (to avoid calling strlen() everytime this is needed)
7924 - var $data_length = 0;
7927 - * Current position of the pointer
7932 - var $position = 0;
7935 - * Name of the hedaer currently being parsed
7943 - * Value of the hedaer currently being parsed
7951 - * Create an instance of the class with the input data
7954 - * @param string $data Input data
7956 - function SimplePie_HTTP_Parser($data)
7958 - $this->data = $data;
7959 - $this->data_length = strlen($this->data);
7963 - * Parse the input data
7966 - * @return bool true on success, false on failure
7970 - while ($this->state && $this->state !== 'emit' && $this->has_data())
7972 - $state = $this->state;
7976 - if ($this->state === 'emit' || $this->state === 'body')
7982 - $this->http_version = '';
7983 - $this->status_code = '';
7984 - $this->reason = '';
7985 - $this->headers = array();
7992 - * Check whether there is data beyond the pointer
7995 - * @return bool true if there is further data, false if not
7997 - function has_data()
7999 - return (bool) ($this->position < $this->data_length);
8003 - * See if the next character is LWS
8006 - * @return bool true if the next character is LWS, false if not
8008 - function is_linear_whitespace()
8010 - return (bool) ($this->data[$this->position] === "\x09"
8011 - || $this->data[$this->position] === "\x20"
8012 - || ($this->data[$this->position] === "\x0A"
8013 - && isset($this->data[$this->position + 1])
8014 - && ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20")));
8018 - * Parse the HTTP version
8022 - function http_version()
8024 - if (strpos($this->data, "\x0A") !== false && strtoupper(substr($this->data, 0, 5)) === 'HTTP/')
8026 - $len = strspn($this->data, '0123456789.', 5);
8027 - $this->http_version = substr($this->data, 5, $len);
8028 - $this->position += 5 + $len;
8029 - if (substr_count($this->http_version, '.') <= 1)
8031 - $this->http_version = (float) $this->http_version;
8032 - $this->position += strspn($this->data, "\x09\x20", $this->position);
8033 - $this->state = 'status';
8037 - $this->state = false;
8042 - $this->state = false;
8047 - * Parse the status code
8053 - if ($len = strspn($this->data, '0123456789', $this->position))
8055 - $this->status_code = (int) substr($this->data, $this->position, $len);
8056 - $this->position += $len;
8057 - $this->state = 'reason';
8061 - $this->state = false;
8066 - * Parse the reason phrase
8072 - $len = strcspn($this->data, "\x0A", $this->position);
8073 - $this->reason = trim(substr($this->data, $this->position, $len), "\x09\x0D\x20");
8074 - $this->position += $len + 1;
8075 - $this->state = 'new_line';
8079 - * Deal with a new line, shifting data around as needed
8083 - function new_line()
8085 - $this->value = trim($this->value, "\x0D\x20");
8086 - if ($this->name !== '' && $this->value !== '')
8088 - $this->name = strtolower($this->name);
8089 - if (isset($this->headers[$this->name]))
8091 - $this->headers[$this->name] .= ', ' . $this->value;
8095 - $this->headers[$this->name] = $this->value;
8099 - $this->value = '';
8100 - if (substr($this->data[$this->position], 0, 2) === "\x0D\x0A")
8102 - $this->position += 2;
8103 - $this->state = 'body';
8105 - elseif ($this->data[$this->position] === "\x0A")
8107 - $this->position++;
8108 - $this->state = 'body';
8112 - $this->state = 'name';
8117 - * Parse a header name
8123 - $len = strcspn($this->data, "\x0A:", $this->position);
8124 - if (isset($this->data[$this->position + $len]))
8126 - if ($this->data[$this->position + $len] === "\x0A")
8128 - $this->position += $len;
8129 - $this->state = 'new_line';
8133 - $this->name = substr($this->data, $this->position, $len);
8134 - $this->position += $len + 1;
8135 - $this->state = 'value';
8140 - $this->state = false;
8145 - * Parse LWS, replacing consecutive LWS characters with a single space
8149 - function linear_whitespace()
8153 - if (substr($this->data, $this->position, 2) === "\x0D\x0A")
8155 - $this->position += 2;
8157 - elseif ($this->data[$this->position] === "\x0A")
8159 - $this->position++;
8161 - $this->position += strspn($this->data, "\x09\x20", $this->position);
8162 - } while ($this->has_data() && $this->is_linear_whitespace());
8163 - $this->value .= "\x20";
8167 - * See what state to move to while within non-quoted header values
8173 - if ($this->is_linear_whitespace())
8175 - $this->linear_whitespace();
8179 - switch ($this->data[$this->position])
8182 - $this->position++;
8183 - $this->state = 'quote';
8187 - $this->position++;
8188 - $this->state = 'new_line';
8192 - $this->state = 'value_char';
8199 - * Parse a header value while outside quotes
8203 - function value_char()
8205 - $len = strcspn($this->data, "\x09\x20\x0A\"", $this->position);
8206 - $this->value .= substr($this->data, $this->position, $len);
8207 - $this->position += $len;
8208 - $this->state = 'value';
8212 - * See what state to move to while within quoted header values
8218 - if ($this->is_linear_whitespace())
8220 - $this->linear_whitespace();
8224 - switch ($this->data[$this->position])
8227 - $this->position++;
8228 - $this->state = 'value';
8232 - $this->position++;
8233 - $this->state = 'new_line';
8237 - $this->position++;
8238 - $this->state = 'quote_escaped';
8242 - $this->state = 'quote_char';
8249 - * Parse a header value while within quotes
8253 - function quote_char()
8255 - $len = strcspn($this->data, "\x09\x20\x0A\"\\", $this->position);
8256 - $this->value .= substr($this->data, $this->position, $len);
8257 - $this->position += $len;
8258 - $this->state = 'value';
8262 - * Parse an escaped character within quotes
8266 - function quote_escaped()
8268 - $this->value .= $this->data[$this->position];
8269 - $this->position++;
8270 - $this->state = 'quote';
8280 - $this->body = substr($this->data, $this->position);
8281 - $this->state = 'emit';
8288 - * @package SimplePie
8290 -class SimplePie_gzdecode
8296 - * @see gzdecode::$data
8298 - var $compressed_data;
8301 - * Size of compressed data
8305 - var $compressed_size;
8308 - * Minimum size of a valid gzip string
8312 - var $min_compressed_size = 18;
8315 - * Current position of pointer
8319 - var $position = 0;
8329 - * Uncompressed data
8332 - * @see gzdecode::$compressed_data
8351 - * Operating System
8361 - * @see gzdecode::$extra_field
8362 - * @see gzdecode::$SI2
8370 - * @see gzdecode::$extra_field
8371 - * @see gzdecode::$SI1
8376 - * Extra field content
8379 - * @see gzdecode::$SI1
8380 - * @see gzdecode::$SI2
8385 - * Original filename
8392 - * Human readable comment
8399 - * Don't allow anything to be set
8403 - function __set($name, $value)
8405 - trigger_error("Cannot write property $name", E_USER_ERROR);
8409 - * Set the compressed string and related properties
8413 - function SimplePie_gzdecode($data)
8415 - $this->compressed_data = $data;
8416 - $this->compressed_size = strlen($data);
8420 - * Decode the GZIP stream
8426 - if ($this->compressed_size >= $this->min_compressed_size)
8428 - // Check ID1, ID2, and CM
8429 - if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08")
8434 - // Get the FLG (FLaGs)
8435 - $this->flags = ord($this->compressed_data[3]);
8437 - // FLG bits above (1 << 4) are reserved
8438 - if ($this->flags > 0x1F)
8443 - // Advance the pointer after the above
8444 - $this->position += 4;
8447 - $mtime = substr($this->compressed_data, $this->position, 4);
8448 - // Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness
8449 - if (current(unpack('S', "\x00\x01")) === 1)
8451 - $mtime = strrev($mtime);
8453 - $this->MTIME = current(unpack('l', $mtime));
8454 - $this->position += 4;
8456 - // Get the XFL (eXtra FLags)
8457 - $this->XFL = ord($this->compressed_data[$this->position++]);
8459 - // Get the OS (Operating System)
8460 - $this->OS = ord($this->compressed_data[$this->position++]);
8462 - // Parse the FEXTRA
8463 - if ($this->flags & 4)
8465 - // Read subfield IDs
8466 - $this->SI1 = $this->compressed_data[$this->position++];
8467 - $this->SI2 = $this->compressed_data[$this->position++];
8469 - // SI2 set to zero is reserved for future use
8470 - if ($this->SI2 === "\x00")
8475 - // Get the length of the extra field
8476 - $len = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
8479 - // Check the length of the string is still valid
8480 - $this->min_compressed_size += $len + 4;
8481 - if ($this->compressed_size >= $this->min_compressed_size)
8483 - // Set the extra field to the given data
8484 - $this->extra_field = substr($this->compressed_data, $this->position, $len);
8485 - $this->position += $len;
8493 - // Parse the FNAME
8494 - if ($this->flags & 8)
8496 - // Get the length of the filename
8497 - $len = strspn($this->compressed_data, "\x00", $this->position);
8499 - // Check the length of the string is still valid
8500 - $this->min_compressed_size += $len + 1;
8501 - if ($this->compressed_size >= $this->min_compressed_size)
8503 - // Set the original filename to the given string
8504 - $this->filename = substr($this->compressed_data, $this->position, $len);
8505 - $this->position += $len + 1;
8513 - // Parse the FCOMMENT
8514 - if ($this->flags & 16)
8516 - // Get the length of the comment
8517 - $len = strspn($this->compressed_data, "\x00", $this->position);
8519 - // Check the length of the string is still valid
8520 - $this->min_compressed_size += $len + 1;
8521 - if ($this->compressed_size >= $this->min_compressed_size)
8523 - // Set the original comment to the given string
8524 - $this->comment = substr($this->compressed_data, $this->position, $len);
8525 - $this->position += $len + 1;
8533 - // Parse the FHCRC
8534 - if ($this->flags & 2)
8536 - // Check the length of the string is still valid
8537 - $this->min_compressed_size += $len + 2;
8538 - if ($this->compressed_size >= $this->min_compressed_size)
8541 - $crc = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
8543 - // Check the CRC matches
8544 - if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc)
8546 - $this->position += 2;
8559 - // Decompress the actual data
8560 - if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false)
8566 - $this->position = $this->compressed_size - 8;
8569 - // Check CRC of data
8570 - $crc = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
8571 - $this->position += 4;
8572 - /*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc))
8577 - // Check ISIZE of data
8578 - $isize = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
8579 - $this->position += 4;
8580 - if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize))
8585 - // Wow, against all odds, we've actually got a valid gzip string
8595 -class SimplePie_Cache
8598 - * Don't call the constructor. Please.
8602 - function SimplePie_Cache()
8604 - trigger_error('Please call SimplePie_Cache::create() instead of the constructor', E_USER_ERROR);
8608 - * Create a new SimplePie_Cache object
8613 - static function create($location, $filename, $extension)
8615 - return new SimplePie_Cache_File($location, $filename, $extension);
8619 -class SimplePie_Cache_File
8626 - function SimplePie_Cache_File($location, $filename, $extension)
8628 - $this->location = $location;
8629 - $this->filename = rawurlencode($filename);
8630 - $this->extension = rawurlencode($extension);
8631 - $this->name = "$location/$this->filename.$this->extension";
8634 - function save($data)
8636 - if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location))
8638 - if (is_a($data, 'SimplePie'))
8640 - $data = $data->data;
8643 - $data = serialize($data);
8645 - if (function_exists('file_put_contents'))
8647 - return (bool) file_put_contents($this->name, $data);
8651 - $fp = fopen($this->name, 'wb');
8654 - fwrite($fp, $data);
8665 - if (file_exists($this->name) && is_readable($this->name))
8667 - return unserialize(file_get_contents($this->name));
8674 - if (file_exists($this->name))
8676 - return filemtime($this->name);
8683 - if (file_exists($this->name))
8685 - return touch($this->name);
8692 - if (file_exists($this->name))
8694 - return unlink($this->name);
8700 -class SimplePie_Misc
8702 - function time_hms($seconds)
8706 - $hours = floor($seconds / 3600);
8707 - $remainder = $seconds % 3600;
8710 - $time .= $hours.':';
8713 - $minutes = floor($remainder / 60);
8714 - $seconds = $remainder % 60;
8715 - if ($minutes < 10 && $hours > 0)
8717 - $minutes = '0' . $minutes;
8719 - if ($seconds < 10)
8721 - $seconds = '0' . $seconds;
8724 - $time .= $minutes.':';
8725 - $time .= $seconds;
8730 - static function absolutize_url($relative, $base)
8732 - if ($relative !== '')
8734 - $relative = SimplePie_Misc::parse_url($relative);
8735 - if ($relative['scheme'] !== '')
8737 - $target = $relative;
8739 - elseif ($base !== '')
8741 - $base = SimplePie_Misc::parse_url($base);
8742 - $target = SimplePie_Misc::parse_url('');
8743 - if ($relative['authority'] !== '')
8745 - $target = $relative;
8746 - $target['scheme'] = $base['scheme'];
8750 - $target['scheme'] = $base['scheme'];
8751 - $target['authority'] = $base['authority'];
8752 - if ($relative['path'] !== '')
8754 - if (strpos($relative['path'], '/') === 0)
8756 - $target['path'] = $relative['path'];
8758 - elseif ($base['authority'] !== '' && $base['path'] === '')
8760 - $target['path'] = '/' . $relative['path'];
8762 - elseif (($last_segment = strrpos($base['path'], '/')) !== false)
8764 - $target['path'] = substr($base['path'], 0, $last_segment + 1) . $relative['path'];
8768 - $target['path'] = $relative['path'];
8770 - $target['query'] = $relative['query'];
8774 - $target['path'] = $base['path'];
8775 - if ($relative['query'] !== '')
8777 - $target['query'] = $relative['query'];
8779 - elseif ($base['query'] !== '')
8781 - $target['query'] = $base['query'];
8785 - $target['fragment'] = $relative['fragment'];
8789 - // No base URL, just return the relative URL
8790 - $target = $relative;
8792 - $return = SimplePie_Misc::compress_parse_url($target['scheme'], $target['authority'], $target['path'], $target['query'], $target['fragment']);
8798 - $return = SimplePie_Misc::normalize_url($return);
8802 - static function remove_dot_segments($input)
8805 - while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input == '.' || $input == '..')
8807 - // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
8808 - if (strpos($input, '../') === 0)
8810 - $input = substr($input, 3);
8812 - elseif (strpos($input, './') === 0)
8814 - $input = substr($input, 2);
8816 - // 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,
8817 - elseif (strpos($input, '/./') === 0)
8819 - $input = substr_replace($input, '/', 0, 3);
8821 - elseif ($input == '/.')
8825 - // 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,
8826 - elseif (strpos($input, '/../') === 0)
8828 - $input = substr_replace($input, '/', 0, 4);
8829 - $output = substr_replace($output, '', strrpos($output, '/'));
8831 - elseif ($input == '/..')
8834 - $output = substr_replace($output, '', strrpos($output, '/'));
8836 - // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
8837 - elseif ($input == '.' || $input == '..')
8841 - // 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
8842 - elseif (($pos = strpos($input, '/', 1)) !== false)
8844 - $output .= substr($input, 0, $pos);
8845 - $input = substr_replace($input, '', 0, $pos);
8849 - $output .= $input;
8853 - return $output . $input;
8856 - static function get_element($realname, $string)
8858 - $return = array();
8859 - $name = preg_quote($realname, '/');
8860 - if (preg_match_all("/<($name)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE))
8862 - for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++)
8864 - $return[$i]['tag'] = $realname;
8865 - $return[$i]['full'] = $matches[$i][0][0];
8866 - $return[$i]['offset'] = $matches[$i][0][1];
8867 - if (strlen($matches[$i][3][0]) <= 2)
8869 - $return[$i]['self_closing'] = true;
8873 - $return[$i]['self_closing'] = false;
8874 - $return[$i]['content'] = $matches[$i][4][0];
8876 - $return[$i]['attribs'] = array();
8877 - 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))
8879 - for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++)
8881 - if (count($attribs[$j]) == 2)
8883 - $attribs[$j][2] = $attribs[$j][1];
8885 - $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j]), 'UTF-8');
8893 - function element_implode($element)
8895 - $full = "<$element[tag]";
8896 - foreach ($element['attribs'] as $key => $value)
8898 - $key = strtolower($key);
8899 - $full .= " $key=\"" . htmlspecialchars($value['data']) . '"';
8901 - if ($element['self_closing'])
8907 - $full .= ">$element[content]</$element[tag]>";
8912 - static function error($message, $level, $file, $line)
8916 - case E_USER_ERROR:
8917 - $note = 'PHP Error';
8919 - case E_USER_WARNING:
8920 - $note = 'PHP Warning';
8922 - case E_USER_NOTICE:
8923 - $note = 'PHP Notice';
8926 - $note = 'Unknown Error';
8929 - error_log("$note: $message in $file on line $line", 0);
8934 - * If a file has been cached, retrieve and display it.
8936 - * This is most useful for caching images (get_favicon(), etc.),
8937 - * however it works for all cached files. This WILL NOT display ANY
8938 - * file/image/page/whatever, but rather only display what has already
8939 - * been cached by SimplePie.
8942 - * @see SimplePie::get_favicon()
8943 - * @param str $identifier_url URL that is used to identify the content.
8944 - * This may or may not be the actual URL of the live content.
8945 - * @param str $cache_location Location of SimplePie's cache. Defaults
8947 - * @param str $cache_extension The file extension that the file was
8948 - * cached with. Defaults to 'spc'.
8949 - * @param str $cache_class Name of the cache-handling class being used
8950 - * in SimplePie. Defaults to 'SimplePie_Cache', and should be left
8951 - * as-is unless you've overloaded the class.
8952 - * @param str $cache_name_function Obsolete. Exists for backwards
8953 - * compatibility reasons only.
8955 - function display_cached_file($identifier_url, $cache_location = './cache', $cache_extension = 'spc', $cache_class = 'SimplePie_Cache', $cache_name_function = 'md5')
8957 - $cache = call_user_func(array($cache_class, 'create'), $cache_location, $identifier_url, $cache_extension);
8959 - if ($file = $cache->load())
8961 - if (isset($file['headers']['content-type']))
8963 - header('Content-type:' . $file['headers']['content-type']);
8967 - header('Content-type: application/octet-stream');
8969 - header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
8970 - echo $file['body'];
8974 - die('Cached file for ' . $identifier_url . ' cannot be found.');
8977 - static function fix_protocol($url, $http = 1)
8979 - $url = SimplePie_Misc::normalize_url($url);
8980 - $parsed = SimplePie_Misc::parse_url($url);
8981 - if ($parsed['scheme'] !== '' && $parsed['scheme'] != 'http' && $parsed['scheme'] != 'https')
8983 - return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http);
8986 - if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url))
8988 - return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http);
8991 - if ($http == 2 && $parsed['scheme'] !== '')
8993 - return "feed:$url";
8995 - elseif ($http == 3 && strtolower($parsed['scheme']) == 'http')
8997 - return substr_replace($url, 'podcast', 0, 4);
8999 - elseif ($http == 4 && strtolower($parsed['scheme']) == 'http')
9001 - return substr_replace($url, 'itpc', 0, 4);
9009 - static function parse_url($url)
9011 - static $cache = array();
9012 - if (isset($cache[$url]))
9014 - return $cache[$url];
9016 - elseif (preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match))
9018 - for ($i = count($match); $i <= 9; $i++)
9022 - return $cache[$url] = array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
9026 - return $cache[$url] = array('scheme' => '', 'authority' => '', 'path' => '', 'query' => '', 'fragment' => '');
9030 - static function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
9033 - if ($scheme !== '')
9035 - $return .= "$scheme:";
9037 - if ($authority !== '')
9039 - $return .= "//$authority";
9045 - if ($query !== '')
9047 - $return .= "?$query";
9049 - if ($fragment !== '')
9051 - $return .= "#$fragment";
9056 - static function normalize_url($url)
9058 - $url = preg_replace_callback('/%([0-9A-Fa-f]{2})/', array('SimplePie_Misc', 'percent_encoding_normalization'), $url);
9059 - $url = SimplePie_Misc::parse_url($url);
9060 - $url['scheme'] = strtolower($url['scheme']);
9061 - if ($url['authority'] !== '')
9063 - $url['authority'] = strtolower($url['authority']);
9064 - $url['path'] = SimplePie_Misc::remove_dot_segments($url['path']);
9066 - return SimplePie_Misc::compress_parse_url($url['scheme'], $url['authority'], $url['path'], $url['query'], $url['fragment']);
9069 - static function percent_encoding_normalization($match)
9071 - $integer = hexdec($match[1]);
9072 - if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer == 0x2D || $integer == 0x2E || $integer == 0x5F || $integer == 0x7E)
9074 - return chr($integer);
9078 - return strtoupper($match[0]);
9083 - * Remove bad UTF-8 bytes
9085 - * PCRE Pattern to locate bad bytes in a UTF-8 string comes from W3C
9086 - * FAQ: Multilingual Forms (modified to include full ASCII range)
9088 - * @author Geoffrey Sneddon
9089 - * @see http://www.w3.org/International/questions/qa-forms-utf-8
9090 - * @param string $str String to remove bad UTF-8 bytes from
9091 - * @return string UTF-8 string
9093 - function utf8_bad_replace($str)
9095 - if (function_exists('iconv') && ($return = @iconv('UTF-8', 'UTF-8//IGNORE', $str)))
9099 - elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($str, 'UTF-8', 'UTF-8')))
9103 - 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))
9105 - return implode("\xEF\xBF\xBD", $matches[0]);
9107 - elseif ($str !== '')
9109 - return "\xEF\xBF\xBD";
9118 - * Converts a Windows-1252 encoded string to a UTF-8 encoded string
9122 - * @param string $string Windows-1252 encoded string
9123 - * @return string UTF-8 encoded string
9125 - static function windows_1252_to_utf8($string)
9127 - 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");
9129 - return strtr($string, $convert_table);
9132 - static function change_encoding($data, $input, $output)
9134 - $input = SimplePie_Misc::encoding($input);
9135 - $output = SimplePie_Misc::encoding($output);
9137 - // We fail to fail on non US-ASCII bytes
9138 - if ($input === 'US-ASCII')
9140 - static $non_ascii_octects = '';
9141 - if (!$non_ascii_octects)
9143 - for ($i = 0x80; $i <= 0xFF; $i++)
9145 - $non_ascii_octects .= chr($i);
9148 - $data = substr($data, 0, strcspn($data, $non_ascii_octects));
9151 - // This is first, as behaviour of this is completely predictable
9152 - if ($input === 'Windows-1252' && $output === 'UTF-8')
9154 - return SimplePie_Misc::windows_1252_to_utf8($data);
9156 - // This is second, as behaviour of this varies only with PHP version
9157 - elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($data, $output, $input)))
9161 - // This is last, as behaviour of this varies with OS userland and PHP version
9162 - elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data)))
9166 - // If we can't do anything, just fail
9173 - static function encoding($charset)
9175 - /* Character sets are case-insensitive, and also need some further
9176 - normalization in the real world (though we'll return them in the form given
9177 - in their registration). */
9178 - switch (strtolower(preg_replace('/[\x09-\x0D\x20-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]/', '', $charset)))
9180 - case 'adobestandardencoding':
9181 - case 'csadobestandardencoding':
9182 - return 'Adobe-Standard-Encoding';
9184 - case 'adobesymbolencoding':
9185 - case 'cshppsmath':
9186 - return 'Adobe-Symbol-Encoding';
9192 - return 'Amiga-1251';
9194 - case 'ansix31101983':
9195 - case 'csat5001983':
9196 - case 'csiso99naplps':
9199 - return 'ANSI_X3.110-1983';
9203 - case 'csiso89asmo449':
9206 - return 'ASMO_449';
9214 - return 'Big5-HKSCS';
9225 - case 'csiso4unitedkingdom':
9232 - case 'bsviewdata':
9233 - case 'csiso47bsviewdata':
9235 - return 'BS_viewdata';
9243 - case 'csaz243419851':
9244 - case 'csiso121canadian1':
9247 - return 'CSA_Z243.4-1985-1';
9250 - case 'csaz243419852':
9251 - case 'csiso122canadian2':
9254 - return 'CSA_Z243.4-1985-2';
9256 - case 'csaz24341985gr':
9257 - case 'csiso123csaz24341985gr':
9259 - return 'CSA_Z243.4-1985-gr';
9261 - case 'csiso139csn369103':
9264 - return 'CSN_369103';
9271 - case 'csiso21german':
9276 - return 'DIN_66003';
9282 - case 'csiso646danish':
9289 - case 'csibmebcdicatde':
9290 - case 'ebcdicatde':
9291 - return 'EBCDIC-AT-DE';
9293 - case 'csebcdicatdea':
9294 - case 'ebcdicatdea':
9295 - return 'EBCDIC-AT-DE-A';
9297 - case 'csebcdiccafr':
9298 - case 'ebcdiccafr':
9299 - return 'EBCDIC-CA-FR';
9301 - case 'csebcdicdkno':
9302 - case 'ebcdicdkno':
9303 - return 'EBCDIC-DK-NO';
9305 - case 'csebcdicdknoa':
9306 - case 'ebcdicdknoa':
9307 - return 'EBCDIC-DK-NO-A';
9309 - case 'csebcdices':
9311 - return 'EBCDIC-ES';
9313 - case 'csebcdicesa':
9315 - return 'EBCDIC-ES-A';
9317 - case 'csebcdicess':
9319 - return 'EBCDIC-ES-S';
9321 - case 'csebcdicfise':
9322 - case 'ebcdicfise':
9323 - return 'EBCDIC-FI-SE';
9325 - case 'csebcdicfisea':
9326 - case 'ebcdicfisea':
9327 - return 'EBCDIC-FI-SE-A';
9329 - case 'csebcdicfr':
9331 - return 'EBCDIC-FR';
9333 - case 'csebcdicit':
9335 - return 'EBCDIC-IT';
9337 - case 'csebcdicpt':
9339 - return 'EBCDIC-PT';
9341 - case 'csebcdicuk':
9343 - return 'EBCDIC-UK';
9345 - case 'csebcdicus':
9347 - return 'EBCDIC-US';
9349 - case 'csiso111ecmacyrillic':
9350 - case 'ecmacyrillic':
9353 - return 'ECMA-cyrillic';
9355 - case 'csiso17spanish':
9361 - case 'csiso85spanish2':
9367 - case 'cseucfixwidjapanese':
9368 - case 'extendedunixcodefixedwidthforjapanese':
9369 - return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
9371 - case 'cseucpkdfmtjapanese':
9373 - case 'extendedunixcodepackedformatforjapanese':
9374 - return 'Extended_UNIX_Code_Packed_Format_for_Japanese';
9382 - case 'windows936':
9386 - case 'csiso58gb231280':
9392 - case 'csiso57gb1988':
9396 - return 'GB_1988-80';
9398 - case 'csiso153gost1976874':
9399 - case 'gost1976874':
9401 - case 'stsev35888':
9402 - return 'GOST_19768-74';
9405 - case 'csiso150greekccitt':
9406 - case 'greekccitt':
9408 - return 'greek-ccitt';
9410 - case 'csiso88greek7':
9415 - case 'csiso18greek7old':
9418 - return 'greek7-old';
9420 - case 'cshpdesktop':
9422 - return 'HP-DeskTop';
9426 - return 'HP-Legal';
9430 - return 'HP-Math8';
9432 - case 'cshppifont':
9434 - return 'HP-Pi-font';
9436 - case 'cshproman8':
9440 - return 'hp-roman8';
9443 - return 'HZ-GB-2312';
9445 - case 'csibmsymbols':
9446 - case 'ibmsymbols':
9447 - return 'IBM-Symbols';
9451 - return 'IBM-Thai';
9453 - case 'ccsid00858':
9456 - case 'pcmultilingual850euro':
9457 - return 'IBM00858';
9459 - case 'ccsid00924':
9461 - case 'ebcdiclatin9euro':
9463 - return 'IBM00924';
9465 - case 'ccsid01140':
9467 - case 'ebcdicus37euro':
9469 - return 'IBM01140';
9471 - case 'ccsid01141':
9473 - case 'ebcdicde273euro':
9475 - return 'IBM01141';
9477 - case 'ccsid01142':
9479 - case 'ebcdicdk277euro':
9480 - case 'ebcdicno277euro':
9482 - return 'IBM01142';
9484 - case 'ccsid01143':
9486 - case 'ebcdicfi278euro':
9487 - case 'ebcdicse278euro':
9489 - return 'IBM01143';
9491 - case 'ccsid01144':
9493 - case 'ebcdicit280euro':
9495 - return 'IBM01144';
9497 - case 'ccsid01145':
9499 - case 'ebcdices284euro':
9501 - return 'IBM01145';
9503 - case 'ccsid01146':
9505 - case 'ebcdicgb285euro':
9507 - return 'IBM01146';
9509 - case 'ccsid01147':
9511 - case 'ebcdicfr297euro':
9513 - return 'IBM01147';
9515 - case 'ccsid01148':
9517 - case 'ebcdicinternational500euro':
9519 - return 'IBM01148';
9521 - case 'ccsid01149':
9523 - case 'ebcdicis871euro':
9525 - return 'IBM01149';
9529 - case 'ebcdiccpca':
9530 - case 'ebcdiccpnl':
9531 - case 'ebcdiccpus':
9532 - case 'ebcdiccpwt':
9560 - case 'ebcdiccpdk':
9561 - case 'ebcdiccpno':
9567 - case 'ebcdiccpfi':
9568 - case 'ebcdiccpse':
9574 - case 'ebcdiccpit':
9586 - case 'ebcdiccpes':
9592 - case 'ebcdiccpgb':
9598 - case 'ebcdicjpkana':
9604 - case 'ebcdiccpfr':
9610 - case 'ebcdiccpar1':
9616 - case 'ebcdiccpgr':
9622 - case 'ebcdiccphe':
9628 - case 'cspc8codepage437':
9634 - case 'ebcdiccpbe':
9635 - case 'ebcdiccpch':
9640 - case 'cspc775baltic':
9646 - case 'cspc850multilingual':
9689 - case 'cspc862latinhebrew':
9731 - case 'ebcdiccproece':
9732 - case 'ebcdiccpyu':
9738 - case 'ebcdiccpis':
9744 - case 'ebcdiccyrillic':
9766 - case 'ebcdiccptr':
9772 - case 'ebcdiccpar2':
9785 - case 'csiso143iecp271':
9788 - return 'IEC_P27-1';
9790 - case 'csiso49inis':
9795 - case 'csiso50inis8':
9800 - case 'csiso51iniscyrillic':
9801 - case 'iniscyrillic':
9803 - return 'INIS-cyrillic';
9805 - case 'csinvariant':
9807 - return 'INVARIANT';
9810 - return 'ISO-2022-CN';
9812 - case 'iso2022cnext':
9813 - return 'ISO-2022-CN-EXT';
9815 - case 'csiso2022jp':
9817 - return 'ISO-2022-JP';
9819 - case 'csiso2022jp2':
9820 - case 'iso2022jp2':
9821 - return 'ISO-2022-JP-2';
9823 - case 'csiso2022kr':
9825 - return 'ISO-2022-KR';
9827 - case 'cswindows30latin1':
9828 - case 'iso88591windows30latin1':
9829 - return 'ISO-8859-1-Windows-3.0-Latin-1';
9831 - case 'cswindows31latin1':
9832 - case 'iso88591windows31latin1':
9833 - return 'ISO-8859-1-Windows-3.1-Latin-1';
9835 - case 'csisolatin2':
9839 - case 'iso885921987':
9842 - return 'ISO-8859-2';
9844 - case 'cswindows31latin2':
9845 - case 'iso88592windowslatin2':
9846 - return 'ISO-8859-2-Windows-Latin-2';
9848 - case 'csisolatin3':
9852 - case 'iso885931988':
9855 - return 'ISO-8859-3';
9857 - case 'csisolatin4':
9861 - case 'iso885941988':
9864 - return 'ISO-8859-4';
9866 - case 'csisolatincyrillic':
9871 - case 'iso885951988':
9872 - return 'ISO-8859-5';
9876 - case 'csisolatinarabic':
9881 - case 'iso885961987':
9882 - return 'ISO-8859-6';
9884 - case 'csiso88596e':
9887 - return 'ISO-8859-6-E';
9889 - case 'csiso88596i':
9892 - return 'ISO-8859-6-I';
9894 - case 'csisolatingreek':
9902 - case 'iso885971987':
9903 - return 'ISO-8859-7';
9905 - case 'csisolatinhebrew':
9910 - case 'iso885981988':
9911 - return 'ISO-8859-8';
9913 - case 'csiso88598e':
9916 - return 'ISO-8859-8-E';
9918 - case 'csiso88598i':
9921 - return 'ISO-8859-8-I';
9923 - case 'cswindows31latin5':
9924 - case 'iso88599windowslatin5':
9925 - return 'ISO-8859-9-Windows-Latin-5';
9927 - case 'csisolatin6':
9930 - case 'iso8859101992':
9933 - return 'ISO-8859-10';
9936 - return 'ISO-8859-13';
9942 - case 'iso8859141998':
9945 - return 'ISO-8859-14';
9950 - return 'ISO-8859-15';
9955 - case 'iso8859162001':
9958 - return 'ISO-8859-16';
9960 - case 'iso10646j1':
9961 - return 'ISO-10646-J-1';
9964 - case 'iso10646ucs2':
9965 - return 'ISO-10646-UCS-2';
9968 - case 'iso10646ucs4':
9969 - return 'ISO-10646-UCS-4';
9971 - case 'csunicodeascii':
9972 - case 'iso10646ucsbasic':
9973 - return 'ISO-10646-UCS-Basic';
9975 - case 'csunicodelatin1':
9977 - case 'iso10646unicodelatin1':
9978 - return 'ISO-10646-Unicode-Latin1';
9980 - case 'csiso10646utf1':
9981 - case 'iso10646utf1':
9982 - return 'ISO-10646-UTF-1';
9984 - case 'csiso115481':
9987 - case 'isotr115481':
9988 - return 'ISO-11548-1';
9992 - return 'iso-ir-90';
9994 - case 'csunicodeibm1261':
9995 - case 'isounicodeibm1261':
9996 - return 'ISO-Unicode-IBM-1261';
9998 - case 'csunicodeibm1264':
9999 - case 'isounicodeibm1264':
10000 - return 'ISO-Unicode-IBM-1264';
10002 - case 'csunicodeibm1265':
10003 - case 'isounicodeibm1265':
10004 - return 'ISO-Unicode-IBM-1265';
10006 - case 'csunicodeibm1268':
10007 - case 'isounicodeibm1268':
10008 - return 'ISO-Unicode-IBM-1268';
10010 - case 'csunicodeibm1276':
10011 - case 'isounicodeibm1276':
10012 - return 'ISO-Unicode-IBM-1276';
10014 - case 'csiso646basic1983':
10015 - case 'iso646basic1983':
10017 - return 'ISO_646.basic:1983';
10019 - case 'csiso2intlrefversion':
10022 - case 'iso646irv1983':
10023 - return 'ISO_646.irv:1983';
10025 - case 'csiso2033':
10028 - case 'iso20331983':
10029 - return 'ISO_2033-1983';
10031 - case 'csiso5427cyrillic':
10034 - return 'ISO_5427';
10037 - case 'iso5427cyrillic1981':
10038 - case 'iso54271981':
10039 - return 'ISO_5427:1981';
10041 - case 'csiso5428greek':
10043 - case 'iso54281980':
10044 - return 'ISO_5428:1980';
10046 - case 'csiso6937add':
10048 - case 'iso6937225':
10049 - return 'ISO_6937-2-25';
10051 - case 'csisotextcomm':
10053 - case 'iso69372add':
10054 - return 'ISO_6937-2-add';
10056 - case 'csiso8859supp':
10058 - case 'iso8859supp':
10060 - return 'ISO_8859-supp';
10062 - case 'csiso10367box':
10064 - case 'iso10367box':
10065 - return 'ISO_10367-box';
10067 - case 'csiso15italian':
10073 - case 'csiso13jisc6220jp':
10075 - case 'jisc62201969':
10076 - case 'jisc62201969jp':
10079 - return 'JIS_C6220-1969-jp';
10081 - case 'csiso14jisc6220ro':
10084 - case 'jisc62201969ro':
10086 - return 'JIS_C6220-1969-ro';
10088 - case 'csiso42jisc62261978':
10090 - case 'jisc62261978':
10091 - return 'JIS_C6226-1978';
10093 - case 'csiso87jisx0208':
10095 - case 'jisc62261983':
10096 - case 'jisx02081983':
10098 - return 'JIS_C6226-1983';
10100 - case 'csiso91jisc62291984a':
10102 - case 'jisc62291984a':
10104 - return 'JIS_C6229-1984-a';
10106 - case 'csiso92jisc62991984b':
10108 - case 'iso646jpocrb':
10109 - case 'jisc62291984b':
10111 - return 'JIS_C6229-1984-b';
10113 - case 'csiso93jis62291984badd':
10115 - case 'jisc62291984badd':
10116 - case 'jpocrbadd':
10117 - return 'JIS_C6229-1984-b-add';
10119 - case 'csiso94jis62291984hand':
10121 - case 'jisc62291984hand':
10122 - case 'jpocrhand':
10123 - return 'JIS_C6229-1984-hand';
10125 - case 'csiso95jis62291984handadd':
10127 - case 'jisc62291984handadd':
10128 - case 'jpocrhandadd':
10129 - return 'JIS_C6229-1984-hand-add';
10131 - case 'csiso96jisc62291984kana':
10133 - case 'jisc62291984kana':
10134 - return 'JIS_C6229-1984-kana';
10136 - case 'csjisencoding':
10137 - case 'jisencoding':
10138 - return 'JIS_Encoding';
10140 - case 'cshalfwidthkatakana':
10143 - return 'JIS_X0201';
10145 - case 'csiso159jisx02121990':
10147 - case 'jisx02121990':
10149 - return 'JIS_X0212-1990';
10151 - case 'csiso141jusib1002':
10155 - case 'jusib1002':
10157 - return 'JUS_I.B1.002';
10159 - case 'csiso147macedonian':
10161 - case 'jusib1003mac':
10162 - case 'macedonian':
10163 - return 'JUS_I.B1.003-mac';
10165 - case 'csiso146serbian':
10167 - case 'jusib1003serb':
10169 - return 'JUS_I.B1.003-serb';
10171 - case 'koi7switched':
10172 - return 'KOI7-switched';
10181 - case 'csksc5636':
10184 - return 'KSC5636';
10189 - case 'strk10482002':
10190 - return 'KZ-1048';
10192 - case 'csiso19latingreek':
10194 - case 'latingreek':
10195 - return 'latin-greek';
10197 - case 'csiso27latingreek1':
10199 - case 'latingreek1':
10200 - return 'Latin-greek-1';
10202 - case 'csiso158lap':
10206 - return 'latin-lap';
10208 - case 'csmacintosh':
10210 - case 'macintosh':
10211 - return 'macintosh';
10213 - case 'csmicrosoftpublishing':
10214 - case 'microsoftpublishing':
10215 - return 'Microsoft-Publishing';
10221 - case 'csmnemonic':
10223 - return 'MNEMONIC';
10225 - case 'csiso86hungarian':
10230 - return 'MSZ_7795.3';
10232 - case 'csnatsdano':
10235 - return 'NATS-DANO';
10237 - case 'csnatsdanoadd':
10239 - case 'natsdanoadd':
10240 - return 'NATS-DANO-ADD';
10242 - case 'csnatssefi':
10245 - return 'NATS-SEFI';
10247 - case 'csnatssefiadd':
10249 - case 'natssefiadd':
10250 - return 'NATS-SEFI-ADD';
10252 - case 'csiso151cuba':
10256 - case 'ncnc001081':
10257 - return 'NC_NC00-10:81';
10259 - case 'csiso69french':
10264 - return 'NF_Z_62-010';
10266 - case 'csiso25french':
10268 - case 'iso646fr1':
10269 - case 'nfz620101973':
10270 - return 'NF_Z_62-010_(1973)';
10272 - case 'csiso60danishnorwegian':
10273 - case 'csiso60norwegian1':
10278 - return 'NS_4551-1';
10280 - case 'csiso61norwegian2':
10282 - case 'iso646no2':
10285 - return 'NS_4551-2';
10287 - case 'osdebcdicdf03irv':
10288 - return 'OSD_EBCDIC_DF03_IRV';
10290 - case 'osdebcdicdf041':
10291 - return 'OSD_EBCDIC_DF04_1';
10293 - case 'osdebcdicdf0415':
10294 - return 'OSD_EBCDIC_DF04_15';
10296 - case 'cspc8danishnorwegian':
10297 - case 'pc8danishnorwegian':
10298 - return 'PC8-Danish-Norwegian';
10300 - case 'cspc8turkish':
10301 - case 'pc8turkish':
10302 - return 'PC8-Turkish';
10304 - case 'csiso16portuguese':
10310 - case 'csiso84portuguese2':
10312 - case 'iso646pt2':
10317 - case 'csptcp154':
10318 - case 'cyrillicasian':
10321 - return 'PTCP154';
10326 - case 'csiso10swedish':
10332 - case 'sen850200b':
10333 - return 'SEN_850200_B';
10335 - case 'csiso11swedishfornames':
10337 - case 'iso646se2':
10339 - case 'sen850200c':
10340 - return 'SEN_850200_C';
10342 - case 'csshiftjis':
10345 - return 'Shift_JIS';
10347 - case 'csiso102t617bit':
10350 - return 'T.61-7bit';
10352 - case 'csiso103t618bit':
10356 - return 'T.61-8bit';
10358 - case 'csiso128t101g2':
10361 - return 'T.101-G2';
10367 - case 'csunicode11':
10368 - case 'unicode11':
10369 - return 'UNICODE-1-1';
10371 - case 'csunicode11utf7':
10372 - case 'unicode11utf7':
10373 - return 'UNICODE-1-1-UTF-7';
10375 - case 'csunknown8bit':
10376 - case 'unknown8bit':
10377 - return 'UNKNOWN-8BIT';
10379 - case 'ansix341968':
10380 - case 'ansix341986':
10387 - case 'iso646irv1991':
10390 - return 'US-ASCII';
10406 - return 'UTF-16BE';
10409 - return 'UTF-16LE';
10415 - return 'UTF-32BE';
10418 - return 'UTF-32LE';
10420 - case 'csventurainternational':
10421 - case 'venturainternational':
10422 - return 'Ventura-International';
10424 - case 'csventuramath':
10425 - case 'venturamath':
10426 - return 'Ventura-Math';
10428 - case 'csventuraus':
10429 - case 'venturaus':
10430 - return 'Ventura-US';
10432 - case 'csiso70videotexsupp1':
10434 - case 'videotexsuppl':
10435 - return 'videotex-suppl';
10445 - case 'cswindows31j':
10446 - case 'windows31j':
10447 - return 'Windows-31J';
10449 - case 'iso885911':
10451 - return 'Windows-874';
10455 - case 'windows949':
10456 - case 'csksc56011987':
10460 - case 'ksc56011987':
10461 - case 'ksc56011989':
10462 - return 'Windows-949';
10464 - case 'windows1250':
10465 - return 'windows-1250';
10467 - case 'windows1251':
10468 - return 'windows-1251';
10471 - case 'csisolatin1':
10475 - case 'iso885911987':
10478 - case 'windows1252':
10479 - return 'Windows-1252';
10481 - case 'windows1252':
10482 - return 'windows-1252';
10484 - case 'windows1253':
10485 - return 'windows-1253';
10487 - case 'csisolatin5':
10490 - case 'iso885991989':
10493 - case 'windows1254':
10494 - return 'Windows-1254';
10496 - case 'windows1254':
10497 - return 'windows-1254';
10499 - case 'windows1255':
10500 - return 'windows-1255';
10502 - case 'windows1256':
10503 - return 'windows-1256';
10505 - case 'windows1257':
10506 - return 'windows-1257';
10508 - case 'windows1258':
10509 - return 'windows-1258';
10516 - function get_curl_version()
10518 - if (is_array($curl = curl_version()))
10520 - $curl = $curl['version'];
10522 - elseif (substr($curl, 0, 5) == 'curl/')
10524 - $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5));
10526 - elseif (substr($curl, 0, 8) == 'libcurl/')
10528 - $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8));
10537 - function is_subclass_of($class1, $class2)
10539 - if (func_num_args() != 2)
10541 - trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING);
10543 - elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1))
10545 - return is_subclass_of($class1, $class2);
10547 - elseif (is_string($class1) && is_string($class2))
10549 - if (class_exists($class1))
10551 - if (class_exists($class2))
10553 - $class2 = strtolower($class2);
10554 - while ($class1 = strtolower(get_parent_class($class1)))
10556 - if ($class1 == $class2)
10565 - trigger_error('Unknown class passed as parameter', E_USER_WARNNG);
10572 - * Strip HTML comments
10575 - * @param string $data Data to strip comments from
10576 - * @return string Comment stripped string
10578 - function strip_comments($data)
10581 - while (($start = strpos($data, '<!--')) !== false)
10583 - $output .= substr($data, 0, $start);
10584 - if (($end = strpos($data, '-->', $start)) !== false)
10586 - $data = substr_replace($data, '', 0, $end + 3);
10593 - return $output . $data;
10596 - function parse_date($dt)
10598 - $parser = SimplePie_Parse_Date::get();
10599 - return $parser->parse($dt);
10603 - * Decode HTML entities
10607 - * @param string $data Input data
10608 - * @return string Output data
10610 - function entities_decode($data)
10612 - $decoder = new SimplePie_Decode_HTML_Entities($data);
10613 - return $decoder->parse();
10617 - * Remove RFC822 comments
10620 - * @param string $data Data to strip comments from
10621 - * @return string Comment stripped string
10623 - function uncomment_rfc822($string)
10625 - $string = (string) $string;
10627 - $length = strlen($string);
10632 - while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
10634 - $output .= substr($string, $position, $pos - $position);
10635 - $position = $pos + 1;
10636 - if ($string[$pos - 1] !== '\\')
10639 - while ($depth && $position < $length)
10641 - $position += strcspn($string, '()', $position);
10642 - if ($string[$position - 1] === '\\')
10647 - elseif (isset($string[$position]))
10649 - switch ($string[$position])
10672 - $output .= substr($string, $position);
10677 - function parse_mime($mime)
10679 - if (($pos = strpos($mime, ';')) === false)
10681 - return trim($mime);
10685 - return trim(substr($mime, 0, $pos));
10689 - function htmlspecialchars_decode($string, $quote_style)
10691 - if (function_exists('htmlspecialchars_decode'))
10693 - return htmlspecialchars_decode($string, $quote_style);
10697 - return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
10701 - function atom_03_construct_type($attribs)
10703 - if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) == 'base64'))
10705 - $mode = SIMPLEPIE_CONSTRUCT_BASE64;
10709 - $mode = SIMPLEPIE_CONSTRUCT_NONE;
10711 - if (isset($attribs['']['type']))
10713 - switch (strtolower(trim($attribs['']['type'])))
10716 - case 'text/plain':
10717 - return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
10720 - case 'text/html':
10721 - return SIMPLEPIE_CONSTRUCT_HTML | $mode;
10724 - case 'application/xhtml+xml':
10725 - return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
10728 - return SIMPLEPIE_CONSTRUCT_NONE | $mode;
10733 - return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
10737 - static function atom_10_construct_type($attribs)
10739 - if (isset($attribs['']['type']))
10741 - switch (strtolower(trim($attribs['']['type'])))
10744 - return SIMPLEPIE_CONSTRUCT_TEXT;
10747 - return SIMPLEPIE_CONSTRUCT_HTML;
10750 - return SIMPLEPIE_CONSTRUCT_XHTML;
10753 - return SIMPLEPIE_CONSTRUCT_NONE;
10756 - return SIMPLEPIE_CONSTRUCT_TEXT;
10759 - function atom_10_content_construct_type($attribs)
10761 - if (isset($attribs['']['type']))
10763 - $type = strtolower(trim($attribs['']['type']));
10767 - return SIMPLEPIE_CONSTRUCT_TEXT;
10770 - return SIMPLEPIE_CONSTRUCT_HTML;
10773 - return SIMPLEPIE_CONSTRUCT_XHTML;
10775 - if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) == 'text/')
10777 - return SIMPLEPIE_CONSTRUCT_NONE;
10781 - return SIMPLEPIE_CONSTRUCT_BASE64;
10786 - return SIMPLEPIE_CONSTRUCT_TEXT;
10790 - static function is_isegment_nz_nc($string)
10792 - 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);
10795 - function space_seperated_tokens($string)
10797 - $space_characters = "\x20\x09\x0A\x0B\x0C\x0D";
10798 - $string_length = strlen($string);
10800 - $position = strspn($string, $space_characters);
10801 - $tokens = array();
10803 - while ($position < $string_length)
10805 - $len = strcspn($string, $space_characters, $position);
10806 - $tokens[] = substr($string, $position, $len);
10807 - $position += $len;
10808 - $position += strspn($string, $space_characters, $position);
10814 - function array_unique($array)
10816 - if (version_compare(PHP_VERSION, '5.2', '>='))
10818 - return array_unique($array);
10822 - $array = (array) $array;
10823 - $new_array = array();
10824 - $new_array_strings = array();
10825 - foreach ($array as $key => $value)
10827 - if (is_object($value))
10829 - if (method_exists($value, '__toString'))
10831 - $cmp = $value->__toString();
10835 - trigger_error('Object of class ' . get_class($value) . ' could not be converted to string', E_USER_ERROR);
10838 - elseif (is_array($value))
10840 - $cmp = (string) reset($value);
10844 - $cmp = (string) $value;
10846 - if (!in_array($cmp, $new_array_strings))
10848 - $new_array[$key] = $value;
10849 - $new_array_strings[] = $cmp;
10852 - return $new_array;
10857 - * Converts a unicode codepoint to a UTF-8 character
10861 - * @param int $codepoint Unicode codepoint
10862 - * @return string UTF-8 character
10864 - function codepoint_to_utf8($codepoint)
10866 - static $cache = array();
10867 - $codepoint = (int) $codepoint;
10868 - if (isset($cache[$codepoint]))
10870 - return $cache[$codepoint];
10872 - elseif ($codepoint < 0)
10874 - return $cache[$codepoint] = false;
10876 - else if ($codepoint <= 0x7f)
10878 - return $cache[$codepoint] = chr($codepoint);
10880 - else if ($codepoint <= 0x7ff)
10882 - return $cache[$codepoint] = chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
10884 - else if ($codepoint <= 0xffff)
10886 - return $cache[$codepoint] = chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
10888 - else if ($codepoint <= 0x10ffff)
10890 - return $cache[$codepoint] = chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
10894 - // U+FFFD REPLACEMENT CHARACTER
10895 - return $cache[$codepoint] = "\xEF\xBF\xBD";
10900 - * Re-implementation of PHP 5's stripos()
10902 - * Returns the numeric position of the first occurrence of needle in the
10903 - * haystack string.
10907 - * @param object $haystack
10908 - * @param string $needle Note that the needle may be a string of one or more
10909 - * characters. If needle is not a string, it is converted to an integer
10910 - * and applied as the ordinal value of a character.
10911 - * @param int $offset The optional offset parameter allows you to specify which
10912 - * character in haystack to start searching. The position returned is still
10913 - * relative to the beginning of haystack.
10914 - * @return bool If needle is not found, stripos() will return boolean false.
10916 - function stripos($haystack, $needle, $offset = 0)
10918 - if (function_exists('stripos'))
10920 - return stripos($haystack, $needle, $offset);
10924 - if (is_string($needle))
10926 - $needle = strtolower($needle);
10928 - elseif (is_int($needle) || is_bool($needle) || is_double($needle))
10930 - $needle = strtolower(chr($needle));
10934 - trigger_error('needle is not a string or an integer', E_USER_WARNING);
10938 - return strpos(strtolower($haystack), $needle, $offset);
10943 - * Similar to parse_str()
10945 - * Returns an associative array of name/value pairs, where the value is an
10946 - * array of values that have used the same name
10950 - * @param string $str The input string.
10953 - function parse_str($str)
10955 - $return = array();
10956 - $str = explode('&', $str);
10958 - foreach ($str as $section)
10960 - if (strpos($section, '=') !== false)
10962 - list($name, $value) = explode('=', $section, 2);
10963 - $return[urldecode($name)][] = urldecode($value);
10967 - $return[urldecode($section)][] = null;
10975 - * Detect XML encoding, as per XML 1.0 Appendix F.1
10977 - * @todo Add support for EBCDIC
10978 - * @param string $data XML data
10979 - * @return array Possible encodings
10981 - static function xml_encoding($data)
10983 - // UTF-32 Big Endian BOM
10984 - if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
10986 - $encoding[] = 'UTF-32BE';
10988 - // UTF-32 Little Endian BOM
10989 - elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
10991 - $encoding[] = 'UTF-32LE';
10993 - // UTF-16 Big Endian BOM
10994 - elseif (substr($data, 0, 2) === "\xFE\xFF")
10996 - $encoding[] = 'UTF-16BE';
10998 - // UTF-16 Little Endian BOM
10999 - elseif (substr($data, 0, 2) === "\xFF\xFE")
11001 - $encoding[] = 'UTF-16LE';
11004 - elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
11006 - $encoding[] = 'UTF-8';
11008 - // UTF-32 Big Endian Without BOM
11009 - 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")
11011 - if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E"))
11013 - $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
11014 - if ($parser->parse())
11016 - $encoding[] = $parser->encoding;
11019 - $encoding[] = 'UTF-32BE';
11021 - // UTF-32 Little Endian Without BOM
11022 - 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")
11024 - if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00"))
11026 - $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
11027 - if ($parser->parse())
11029 - $encoding[] = $parser->encoding;
11032 - $encoding[] = 'UTF-32LE';
11034 - // UTF-16 Big Endian Without BOM
11035 - elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C")
11037 - if ($pos = strpos($data, "\x00\x3F\x00\x3E"))
11039 - $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
11040 - if ($parser->parse())
11042 - $encoding[] = $parser->encoding;
11045 - $encoding[] = 'UTF-16BE';
11047 - // UTF-16 Little Endian Without BOM
11048 - elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00")
11050 - if ($pos = strpos($data, "\x3F\x00\x3E\x00"))
11052 - $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
11053 - if ($parser->parse())
11055 - $encoding[] = $parser->encoding;
11058 - $encoding[] = 'UTF-16LE';
11060 - // US-ASCII (or superset)
11061 - elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C")
11063 - if ($pos = strpos($data, "\x3F\x3E"))
11065 - $parser = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
11066 - if ($parser->parse())
11068 - $encoding[] = $parser->encoding;
11071 - $encoding[] = 'UTF-8';
11073 - // Fallback to UTF-8
11076 - $encoding[] = 'UTF-8';
11078 - return $encoding;
11083 - * Decode HTML Entities
11085 - * This implements HTML5 as of revision 967 (2007-06-28)
11087 - * @package SimplePie
11089 -class SimplePie_Decode_HTML_Entities
11092 - * Data to be parsed
11094 - * @access private
11100 - * Currently consumed bytes
11102 - * @access private
11105 - var $consumed = '';
11108 - * Position of the current byte being parsed
11110 - * @access private
11113 - var $position = 0;
11116 - * Create an instance of the class with the input data
11119 - * @param string $data Input data
11121 - function SimplePie_Decode_HTML_Entities($data)
11123 - $this->data = $data;
11127 - * Parse the input data
11130 - * @return string Output data
11134 - while (($this->position = strpos($this->data, '&', $this->position)) !== false)
11136 - $this->consume();
11138 - $this->consumed = '';
11140 - return $this->data;
11144 - * Consume the next byte
11146 - * @access private
11147 - * @return mixed The next byte, or false, if there is no more data
11149 - function consume()
11151 - if (isset($this->data[$this->position]))
11153 - $this->consumed .= $this->data[$this->position];
11154 - return $this->data[$this->position++];
11158 - $this->consumed = false;
11164 - * Consume a range of characters
11166 - * @access private
11167 - * @param string $chars Characters to consume
11168 - * @return mixed A series of characters that match the range, or false
11170 - function consume_range($chars)
11172 - if ($len = strspn($this->data, $chars, $this->position))
11174 - $data = substr($this->data, $this->position, $len);
11175 - $this->consumed .= $data;
11176 - $this->position += $len;
11181 - $this->consumed = false;
11187 - * Unconsume one byte
11189 - * @access private
11191 - function unconsume()
11193 - $this->consumed = substr($this->consumed, 0, -1);
11194 - $this->position--;
11198 - * Decode an entity
11200 - * @access private
11202 - function entity()
11204 - switch ($this->consume())
11218 - switch ($this->consume())
11222 - $range = '0123456789ABCDEFabcdef';
11227 - $range = '0123456789';
11229 - $this->unconsume();
11233 - if ($codepoint = $this->consume_range($range))
11235 - 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");
11239 - $codepoint = hexdec($codepoint);
11243 - $codepoint = intval($codepoint);
11246 - if (isset($windows_1252_specials[$codepoint]))
11248 - $replacement = $windows_1252_specials[$codepoint];
11252 - $replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
11255 - if ($this->consume() != ';')
11257 - $this->unconsume();
11260 - $consumed_length = strlen($this->consumed);
11261 - $this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
11262 - $this->position += strlen($replacement) - $consumed_length;
11267 - 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");
11269 - for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++)
11271 - $consumed = substr($this->consumed, 1);
11272 - if (isset($entities[$consumed]))
11274 - $match = $consumed;
11278 - if ($match !== null)
11280 - $this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
11281 - $this->position += strlen($entities[$match]) - strlen($consumed) - 1;
11291 - * @package SimplePie
11293 -class SimplePie_Parse_Date
11298 - * @access protected
11304 - * List of days, calendar day name => ordinal day number in the week
11306 - * @access protected
11309 - var $day = array(
11316 - 'wednesday' => 3,
11329 - 'donderdag' => 4,
11345 - 'donnerstag' => 4,
11348 - 'sonnabend' => 6,
11353 - 'mercoledì' => 3,
11361 - 'miércoles' => 3,
11367 - 'maanantai' => 1,
11369 - 'keskiviikko' => 3,
11371 - 'perjantai' => 5,
11373 - 'sunnuntai' => 7,
11378 - 'csütörtok' => 4,
11393 - * List of months, calendar month name => calendar month number
11395 - * @access protected
11398 - var $month = array(
11409 - // No long form of May
11417 - 'september' => 8,
11421 - 'november' => 11,
11423 - 'december' => 12,
11433 - 'september' => 9,
11435 - 'november' => 11,
11436 - 'december' => 12,
11446 - 'septembre' => 9,
11448 - 'novembre' => 11,
11449 - 'décembre' => 12,
11459 - 'september' => 9,
11461 - 'november' => 11,
11462 - 'dezember' => 12,
11472 - 'settembre' => 9,
11474 - 'novembre' => 11,
11475 - 'dicembre' => 12,
11485 - 'septiembre' => 9,
11486 - 'setiembre' => 9,
11488 - 'noviembre' => 11,
11489 - 'diciembre' => 12,
11493 - 'maaliskuu' => 3,
11502 - 'joulukuu' => 12,
11511 - 'augusztus' => 8,
11512 - 'szeptember' => 9,
11514 - 'november' => 11,
11515 - 'december' => 12,
11538 - * List of timezones, abbreviation => offset from UTC
11540 - * @access protected
11543 - var $timezone = array(
11548 - 'ACWDT' => 35100,
11549 - 'ACWST' => 31500,
11553 - 'AKDT' => -28800,
11554 - 'AKST' => -32400,
11557 - 'ANAST' => 46800,
11560 - 'AZOST' => -3600,
11578 - 'CHADT' => 49500,
11579 - 'CHAST' => 45900,
11580 - 'CIST' => -28800,
11582 - 'CLDT' => -10800,
11583 - 'CLST' => -14400,
11590 - 'EADT' => -18000,
11591 - 'EAST' => -21600,
11601 - 'FKDT' => -10800,
11602 - 'FKST' => -14400,
11604 - 'GALT' => -21600,
11615 - 'HADT' => -32400,
11619 - 'HAST' => -36000,
11632 - 'IRKST' => 32400,
11635 - 'JFDT' => -10800,
11636 - 'JFST' => -14400,
11641 - 'KOVST' => 28800,
11643 - 'KRAST' => 28800,
11650 - 'MAGST' => 43200,
11669 - 'NOVST' => 25200,
11677 - 'OMSST' => 25200,
11681 - 'PETST' => 46800,
11688 - 'PMST' => -10800,
11692 - 'PYST' => -10800,
11695 - 'ROTT' => -10800,
11696 - 'SAMST' => 18000,
11711 - 'THAT' => -36000,
11724 - 'VLAST' => 39600,
11738 - 'YAKST' => 36000,
11741 - 'YEKST' => 21600,
11746 - * Cached PCRE for SimplePie_Parse_Date::$day
11748 - * @access protected
11754 - * Cached PCRE for SimplePie_Parse_Date::$month
11756 - * @access protected
11762 - * Array of user-added callback methods
11764 - * @access private
11767 - var $built_in = array();
11770 - * Array of user-added callback methods
11772 - * @access private
11775 - var $user = array();
11778 - * Create new SimplePie_Parse_Date object, and set self::day_pcre,
11779 - * self::month_pcre, and self::built_in
11781 - * @access private
11783 - function SimplePie_Parse_Date()
11785 - $this->day_pcre = '(' . implode(array_keys($this->day), '|') . ')';
11786 - $this->month_pcre = '(' . implode(array_keys($this->month), '|') . ')';
11789 - if (!isset($cache[get_class($this)]))
11791 - if (extension_loaded('Reflection'))
11793 - $class = new ReflectionClass(get_class($this));
11794 - $methods = $class->getMethods();
11795 - $all_methods = array();
11796 - foreach ($methods as $method)
11798 - $all_methods[] = $method->getName();
11803 - $all_methods = get_class_methods($this);
11806 - foreach ($all_methods as $method)
11808 - if (strtolower(substr($method, 0, 5)) === 'date_')
11810 - $cache[get_class($this)][] = $method;
11815 - foreach ($cache[get_class($this)] as $method)
11817 - $this->built_in[] = $method;
11826 - static function get()
11831 - $object = new SimplePie_Parse_Date;
11841 - * @param string $date Date to parse
11842 - * @return int Timestamp corresponding to date string, or false on failure
11844 - function parse($date)
11846 - foreach ($this->user as $method)
11848 - if (($returned = call_user_func($method, $date)) !== false)
11850 - return $returned;
11854 - foreach ($this->built_in as $method)
11856 - if (($returned = call_user_func(array(&$this, $method), $date)) !== false)
11858 - return $returned;
11866 - * Add a callback method to parse a date
11870 - * @param callback $callback
11872 - function add_callback($callback)
11874 - if (is_callable($callback))
11876 - $this->user[] = $callback;
11880 - trigger_error('User-supplied function must be a valid callback', E_USER_WARNING);
11885 - * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as
11886 - * well as allowing any of upper or lower case "T", horizontal tabs, or
11887 - * spaces to be used as the time seperator (including more than one))
11889 - * @access protected
11890 - * @return int Timestamp
11892 - function date_w3cdtf($date)
11897 - $year = '([0-9]{4})';
11898 - $month = $day = $hour = $minute = $second = '([0-9]{2})';
11899 - $decimal = '([0-9]*)';
11900 - $zone = '(?:(Z)|([+\-])([0-9]{1,2}):?([0-9]{1,2}))';
11901 - $pcre = '/^' . $year . '(?:-?' . $month . '(?:-?' . $day . '(?:[Tt\x09\x20]+' . $hour . '(?::?' . $minute . '(?::?' . $second . '(?:.' . $decimal . ')?)?)?' . $zone . ')?)?)?$/';
11903 - if (preg_match($pcre, $date, $match))
11906 - Capturing subpatterns:
11913 - 7: Decimal fraction of a second
11916 - 10: Timezone hours
11917 - 11: Timezone minutes
11920 - // Fill in empty matches
11921 - for ($i = count($match); $i <= 3; $i++)
11923 - $match[$i] = '1';
11926 - for ($i = count($match); $i <= 7; $i++)
11928 - $match[$i] = '0';
11931 - // Numeric timezone
11932 - if (isset($match[9]) && $match[9] !== '')
11934 - $timezone = $match[10] * 3600;
11935 - $timezone += $match[11] * 60;
11936 - if ($match[9] === '-')
11938 - $timezone = 0 - $timezone;
11946 - // Convert the number of seconds to an integer, taking decimals into account
11947 - $second = round($match[6] + $match[7] / pow(10, strlen($match[7])));
11949 - return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone;
11958 - * Remove RFC822 comments
11960 - * @access protected
11961 - * @param string $data Data to strip comments from
11962 - * @return string Comment stripped string
11964 - function remove_rfc2822_comments($string)
11966 - $string = (string) $string;
11968 - $length = strlen($string);
11973 - while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
11975 - $output .= substr($string, $position, $pos - $position);
11976 - $position = $pos + 1;
11977 - if ($string[$pos - 1] !== '\\')
11980 - while ($depth && $position < $length)
11982 - $position += strcspn($string, '()', $position);
11983 - if ($string[$position - 1] === '\\')
11988 - elseif (isset($string[$position]))
11990 - switch ($string[$position])
12013 - $output .= substr($string, $position);
12019 - * Parse RFC2822's date format
12021 - * @access protected
12022 - * @return int Timestamp
12024 - function date_rfc2822($date)
12029 - $wsp = '[\x09\x20]';
12030 - $fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)';
12031 - $optional_fws = $fws . '?';
12032 - $day_name = $this->day_pcre;
12033 - $month = $this->month_pcre;
12034 - $day = '([0-9]{1,2})';
12035 - $hour = $minute = $second = '([0-9]{2})';
12036 - $year = '([0-9]{2,4})';
12037 - $num_zone = '([+\-])([0-9]{2})([0-9]{2})';
12038 - $character_zone = '([A-Z]{1,5})';
12039 - $zone = '(?:' . $num_zone . '|' . $character_zone . ')';
12040 - $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';
12042 - if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match))
12045 - Capturing subpatterns:
12054 - 9: Timezone hours
12055 - 10: Timezone minutes
12056 - 11: Alphabetic timezone
12059 - // Find the month number
12060 - $month = $this->month[strtolower($match[3])];
12062 - // Numeric timezone
12063 - if ($match[8] !== '')
12065 - $timezone = $match[9] * 3600;
12066 - $timezone += $match[10] * 60;
12067 - if ($match[8] === '-')
12069 - $timezone = 0 - $timezone;
12072 - // Character timezone
12073 - elseif (isset($this->timezone[strtoupper($match[11])]))
12075 - $timezone = $this->timezone[strtoupper($match[11])];
12077 - // Assume everything else to be -0000
12083 - // Deal with 2/3 digit years
12084 - if ($match[4] < 50)
12086 - $match[4] += 2000;
12088 - elseif ($match[4] < 1000)
12090 - $match[4] += 1900;
12093 - // Second is optional, if it is empty set it to zero
12094 - if ($match[7] !== '')
12096 - $second = $match[7];
12103 - return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone;
12112 - * Parse RFC850's date format
12114 - * @access protected
12115 - * @return int Timestamp
12117 - function date_rfc850($date)
12122 - $space = '[\x09\x20]+';
12123 - $day_name = $this->day_pcre;
12124 - $month = $this->month_pcre;
12125 - $day = '([0-9]{1,2})';
12126 - $year = $hour = $minute = $second = '([0-9]{2})';
12127 - $zone = '([A-Z]{1,5})';
12128 - $pcre = '/^' . $day_name . ',' . $space . $day . '-' . $month . '-' . $year . $space . $hour . ':' . $minute . ':' . $second . $space . $zone . '$/i';
12130 - if (preg_match($pcre, $date, $match))
12133 - Capturing subpatterns:
12145 - $month = $this->month[strtolower($match[3])];
12147 - // Character timezone
12148 - if (isset($this->timezone[strtoupper($match[8])]))
12150 - $timezone = $this->timezone[strtoupper($match[8])];
12152 - // Assume everything else to be -0000
12158 - // Deal with 2 digit year
12159 - if ($match[4] < 50)
12161 - $match[4] += 2000;
12165 - $match[4] += 1900;
12168 - return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone;
12177 - * Parse C99's asctime()'s date format
12179 - * @access protected
12180 - * @return int Timestamp
12182 - function date_asctime($date)
12187 - $space = '[\x09\x20]+';
12188 - $wday_name = $this->day_pcre;
12189 - $mon_name = $this->month_pcre;
12190 - $day = '([0-9]{1,2})';
12191 - $hour = $sec = $min = '([0-9]{2})';
12192 - $year = '([0-9]{4})';
12193 - $terminator = '\x0A?\x00?';
12194 - $pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i';
12196 - if (preg_match($pcre, $date, $match))
12199 - Capturing subpatterns:
12209 - $month = $this->month[strtolower($match[2])];
12210 - return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]);
12219 - * Parse dates using strtotime()
12221 - * @access protected
12222 - * @return int Timestamp
12224 - function date_strtotime($date)
12226 - $strtotime = strtotime($date);
12227 - if ($strtotime === -1 || $strtotime === false)
12233 - return $strtotime;
12239 - * Content-type sniffing
12241 - * @package SimplePie
12243 -class SimplePie_Content_Type_Sniffer
12248 - * @var SimplePie_File
12249 - * @access private
12254 - * Create an instance of the class with the input file
12257 - * @param SimplePie_Content_Type_Sniffer $file Input file
12259 - function SimplePie_Content_Type_Sniffer($file)
12261 - $this->file = $file;
12265 - * Get the Content-Type of the specified file
12268 - * @return string Actual Content-Type
12270 - function get_type()
12272 - if (isset($this->file->headers['content-type']))
12274 - if (!isset($this->file->headers['content-encoding'])
12275 - && ($this->file->headers['content-type'] === 'text/plain'
12276 - || $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1'
12277 - || $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1'))
12279 - return $this->text_or_binary();
12282 - if (($pos = strpos($this->file->headers['content-type'], ';')) !== false)
12284 - $official = substr($this->file->headers['content-type'], 0, $pos);
12288 - $official = $this->file->headers['content-type'];
12290 - $official = strtolower($official);
12292 - if ($official === 'unknown/unknown'
12293 - || $official === 'application/unknown')
12295 - return $this->unknown();
12297 - elseif (substr($official, -4) === '+xml'
12298 - || $official === 'text/xml'
12299 - || $official === 'application/xml')
12301 - return $official;
12303 - elseif (substr($official, 0, 6) === 'image/')
12305 - if ($return = $this->image())
12311 - return $official;
12314 - elseif ($official === 'text/html')
12316 - return $this->feed_or_html();
12320 - return $official;
12325 - return $this->unknown();
12330 - * Sniff text or binary
12332 - * @access private
12333 - * @return string Actual Content-Type
12335 - function text_or_binary()
12337 - if (substr($this->file->body, 0, 2) === "\xFE\xFF"
12338 - || substr($this->file->body, 0, 2) === "\xFF\xFE"
12339 - || substr($this->file->body, 0, 4) === "\x00\x00\xFE\xFF"
12340 - || substr($this->file->body, 0, 3) === "\xEF\xBB\xBF")
12342 - return 'text/plain';
12344 - elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body))
12346 - return 'application/octect-stream';
12350 - return 'text/plain';
12357 - * @access private
12358 - * @return string Actual Content-Type
12360 - function unknown()
12362 - $ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20");
12363 - if (strtolower(substr($this->file->body, $ws, 14)) === '<!doctype html'
12364 - || strtolower(substr($this->file->body, $ws, 5)) === '<html'
12365 - || strtolower(substr($this->file->body, $ws, 7)) === '<script')
12367 - return 'text/html';
12369 - elseif (substr($this->file->body, 0, 5) === '%PDF-')
12371 - return 'application/pdf';
12373 - elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-')
12375 - return 'application/postscript';
12377 - elseif (substr($this->file->body, 0, 6) === 'GIF87a'
12378 - || substr($this->file->body, 0, 6) === 'GIF89a')
12380 - return 'image/gif';
12382 - elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
12384 - return 'image/png';
12386 - elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
12388 - return 'image/jpeg';
12390 - elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
12392 - return 'image/bmp';
12396 - return $this->text_or_binary();
12403 - * @access private
12404 - * @return string Actual Content-Type
12408 - if (substr($this->file->body, 0, 6) === 'GIF87a'
12409 - || substr($this->file->body, 0, 6) === 'GIF89a')
12411 - return 'image/gif';
12413 - elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
12415 - return 'image/png';
12417 - elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
12419 - return 'image/jpeg';
12421 - elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
12423 - return 'image/bmp';
12434 - * @access private
12435 - * @return string Actual Content-Type
12437 - function feed_or_html()
12439 - $len = strlen($this->file->body);
12440 - $pos = strspn($this->file->body, "\x09\x0A\x0D\x20");
12442 - while ($pos < $len)
12444 - switch ($this->file->body[$pos])
12450 - $pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos);
12458 - return 'text/html';
12461 - if (substr($this->file->body, $pos, 3) === '!--')
12464 - if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false)
12470 - return 'text/html';
12473 - elseif (substr($this->file->body, $pos, 1) === '!')
12475 - if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false)
12481 - return 'text/html';
12484 - elseif (substr($this->file->body, $pos, 1) === '?')
12486 - if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false)
12492 - return 'text/html';
12495 - elseif (substr($this->file->body, $pos, 3) === 'rss'
12496 - || substr($this->file->body, $pos, 7) === 'rdf:RDF')
12498 - return 'application/rss+xml';
12500 - elseif (substr($this->file->body, $pos, 4) === 'feed')
12502 - return 'application/atom+xml';
12506 - return 'text/html';
12510 - return 'text/html';
12515 - * Parses the XML Declaration
12517 - * @package SimplePie
12519 -class SimplePie_XML_Declaration_Parser
12527 - var $version = '1.0';
12535 - var $encoding = 'UTF-8';
12543 - var $standalone = false;
12546 - * Current state of the state machine
12548 - * @access private
12551 - var $state = 'before_version_name';
12556 - * @access private
12562 - * Input data length (to avoid calling strlen() everytime this is needed)
12564 - * @access private
12567 - var $data_length = 0;
12570 - * Current position of the pointer
12573 - * @access private
12575 - var $position = 0;
12578 - * Create an instance of the class with the input data
12581 - * @param string $data Input data
12583 - function SimplePie_XML_Declaration_Parser($data)
12585 - $this->data = $data;
12586 - $this->data_length = strlen($this->data);
12590 - * Parse the input data
12593 - * @return bool true on success, false on failure
12597 - while ($this->state && $this->state !== 'emit' && $this->has_data())
12599 - $state = $this->state;
12602 - $this->data = '';
12603 - if ($this->state === 'emit')
12609 - $this->version = '';
12610 - $this->encoding = '';
12611 - $this->standalone = '';
12617 - * Check whether there is data beyond the pointer
12619 - * @access private
12620 - * @return bool true if there is further data, false if not
12622 - function has_data()
12624 - return (bool) ($this->position < $this->data_length);
12628 - * Advance past any whitespace
12630 - * @return int Number of whitespace characters passed
12632 - function skip_whitespace()
12634 - $whitespace = strspn($this->data, "\x09\x0A\x0D\x20", $this->position);
12635 - $this->position += $whitespace;
12636 - return $whitespace;
12642 - function get_value()
12644 - $quote = substr($this->data, $this->position, 1);
12645 - if ($quote === '"' || $quote === "'")
12647 - $this->position++;
12648 - $len = strcspn($this->data, $quote, $this->position);
12649 - if ($this->has_data())
12651 - $value = substr($this->data, $this->position, $len);
12652 - $this->position += $len + 1;
12659 - function before_version_name()
12661 - if ($this->skip_whitespace())
12663 - $this->state = 'version_name';
12667 - $this->state = false;
12671 - function version_name()
12673 - if (substr($this->data, $this->position, 7) === 'version')
12675 - $this->position += 7;
12676 - $this->skip_whitespace();
12677 - $this->state = 'version_equals';
12681 - $this->state = false;
12685 - function version_equals()
12687 - if (substr($this->data, $this->position, 1) === '=')
12689 - $this->position++;
12690 - $this->skip_whitespace();
12691 - $this->state = 'version_value';
12695 - $this->state = false;
12699 - function version_value()
12701 - if ($this->version = $this->get_value())
12703 - $this->skip_whitespace();
12704 - if ($this->has_data())
12706 - $this->state = 'encoding_name';
12710 - $this->state = 'emit';
12715 - $this->state = 'standalone_name';
12719 - function encoding_name()
12721 - if (substr($this->data, $this->position, 8) === 'encoding')
12723 - $this->position += 8;
12724 - $this->skip_whitespace();
12725 - $this->state = 'encoding_equals';
12729 - $this->state = false;
12733 - function encoding_equals()
12735 - if (substr($this->data, $this->position, 1) === '=')
12737 - $this->position++;
12738 - $this->skip_whitespace();
12739 - $this->state = 'encoding_value';
12743 - $this->state = false;
12747 - function encoding_value()
12749 - if ($this->encoding = $this->get_value())
12751 - $this->skip_whitespace();
12752 - if ($this->has_data())
12754 - $this->state = 'standalone_name';
12758 - $this->state = 'emit';
12763 - $this->state = false;
12767 - function standalone_name()
12769 - if (substr($this->data, $this->position, 10) === 'standalone')
12771 - $this->position += 10;
12772 - $this->skip_whitespace();
12773 - $this->state = 'standalone_equals';
12777 - $this->state = false;
12781 - function standalone_equals()
12783 - if (substr($this->data, $this->position, 1) === '=')
12785 - $this->position++;
12786 - $this->skip_whitespace();
12787 - $this->state = 'standalone_value';
12791 - $this->state = false;
12795 - function standalone_value()
12797 - if ($standalone = $this->get_value())
12799 - switch ($standalone)
12802 - $this->standalone = true;
12806 - $this->standalone = false;
12810 - $this->state = false;
12814 - $this->skip_whitespace();
12815 - if ($this->has_data())
12817 - $this->state = false;
12821 - $this->state = 'emit';
12826 - $this->state = false;
12831 -class SimplePie_Locator
12836 - var $local = array();
12837 - var $elsewhere = array();
12838 - var $file_class = 'SimplePie_File';
12839 - var $cached_entities = array();
12842 - var $base_location = 0;
12843 - var $checked_feeds = 0;
12844 - var $max_checked_feeds = 10;
12845 - var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer';
12848 - 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 = "")
12850 - $this->file =& $file;
12851 - $this->file_class = $file_class;
12852 - $this->useragent = $useragent;
12853 - $this->timeout = $timeout;
12854 - $this->max_checked_feeds = $max_checked_feeds;
12855 - $this->content_type_sniffer_class = $content_type_sniffer_class;
12856 - $this->proxy = $proxy;
12859 - function find($type = SIMPLEPIE_LOCATOR_ALL)
12861 - if ($this->is_feed($this->file))
12863 - return $this->file;
12866 - if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
12868 - $sniffer = new $this->content_type_sniffer_class($this->file);
12869 - if ($sniffer->get_type() !== 'text/html')
12875 - if ($type & ~SIMPLEPIE_LOCATOR_NONE)
12877 - $this->get_base();
12880 - if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery())
12885 - if ($type & (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links())
12887 - if ($type & SIMPLEPIE_LOCATOR_LOCAL_EXTENSION && $working = $this->extension($this->local))
12892 - if ($type & SIMPLEPIE_LOCATOR_LOCAL_BODY && $working = $this->body($this->local))
12897 - if ($type & SIMPLEPIE_LOCATOR_REMOTE_EXTENSION && $working = $this->extension($this->elsewhere))
12902 - if ($type & SIMPLEPIE_LOCATOR_REMOTE_BODY && $working = $this->body($this->elsewhere))
12910 - function is_feed(&$file)
12912 - if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
12914 - $sniffer = new $this->content_type_sniffer_class($file);
12915 - $sniffed = $sniffer->get_type();
12916 - if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml')))
12925 - elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL)
12935 - function get_base()
12937 - $this->http_base = $this->file->url;
12938 - $this->base = $this->http_base;
12939 - $elements = SimplePie_Misc::get_element('base', $this->file->body);
12940 - foreach ($elements as $element)
12942 - if ($element['attribs']['href']['data'] !== '')
12944 - $this->base = SimplePie_Misc::absolutize_url(trim($element['attribs']['href']['data']), $this->http_base);
12945 - $this->base_location = $element['offset'];
12951 - function autodiscovery()
12953 - $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));
12955 - foreach ($links as $link)
12957 - if ($this->checked_feeds == $this->max_checked_feeds)
12961 - if (isset($link['attribs']['href']['data']) && isset($link['attribs']['rel']['data']))
12963 - $rel = array_unique(SimplePie_Misc::space_seperated_tokens(strtolower($link['attribs']['rel']['data'])));
12965 - if ($this->base_location < $link['offset'])
12967 - $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base);
12971 - $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
12974 - 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'))))
12976 - $this->checked_feeds++;
12977 - $feed = new $this->file_class($href, $this->timeout, 5, null, $this->useragent, false, $this->proxy);
12978 - if ($this->is_feed($feed))
12989 - function get_links()
12991 - $links = SimplePie_Misc::get_element('a', $this->file->body);
12992 - foreach ($links as $link)
12994 - if (isset($link['attribs']['href']['data']))
12996 - $href = trim($link['attribs']['href']['data']);
12997 - $parsed = SimplePie_Misc::parse_url($href);
12998 - if ($parsed['scheme'] === '' || preg_match('/^(http(s)|feed)?$/i', $parsed['scheme']))
13000 - if ($this->base_location < $link['offset'])
13002 - $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base);
13006 - $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
13009 - $current = SimplePie_Misc::parse_url($this->file->url);
13011 - if ($parsed['authority'] === '' || $parsed['authority'] == $current['authority'])
13013 - $this->local[] = $href;
13017 - $this->elsewhere[] = $href;
13022 - $this->local = array_unique($this->local);
13023 - $this->elsewhere = array_unique($this->elsewhere);
13024 - if (!empty($this->local) || !empty($this->elsewhere))
13031 - function extension(&$array)
13033 - foreach ($array as $key => $value)
13035 - if ($this->checked_feeds == $this->max_checked_feeds)
13039 - if (in_array(strtolower(strrchr($value, '.')), array('.rss', '.rdf', '.atom', '.xml')))
13041 - $this->checked_feeds++;
13042 - $feed = new $this->file_class($value, $this->timeout, 5, null, $this->useragent, false, $this->proxy);
13043 - if ($this->is_feed($feed))
13049 - unset($array[$key]);
13056 - function body(&$array)
13058 - foreach ($array as $key => $value)
13060 - if ($this->checked_feeds == $this->max_checked_feeds)
13064 - if (preg_match('/(rss|rdf|atom|xml)/i', $value))
13066 - $this->checked_feeds++;
13067 - $feed = new $this->file_class($value, $this->timeout, 5, null, $this->useragent, false, $this->proxy);
13068 - if ($this->is_feed($feed))
13074 - unset($array[$key]);
13082 -class SimplePie_Parser
13085 - var $error_string;
13086 - var $current_line;
13087 - var $current_column;
13088 - var $current_byte;
13089 - var $separator = ' ';
13090 - var $feed = false;
13091 - var $namespace = array('');
13092 - var $element = array('');
13093 - var $xml_base = array('');
13094 - var $xml_base_explicit = array(false);
13095 - var $xml_lang = array('');
13096 - var $data = array();
13097 - var $datas = array(array());
13098 - var $current_xhtml_construct = -1;
13101 - function parse(&$data, $encoding)
13103 - // Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character
13104 - if (strtoupper($encoding) == 'US-ASCII')
13106 - $this->encoding = 'UTF-8';
13110 - $this->encoding = $encoding;
13114 - // UTF-32 Big Endian BOM
13115 - if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
13117 - $data = substr($data, 4);
13119 - // UTF-32 Little Endian BOM
13120 - elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
13122 - $data = substr($data, 4);
13124 - // UTF-16 Big Endian BOM
13125 - elseif (substr($data, 0, 2) === "\xFE\xFF")
13127 - $data = substr($data, 2);
13129 - // UTF-16 Little Endian BOM
13130 - elseif (substr($data, 0, 2) === "\xFF\xFE")
13132 - $data = substr($data, 2);
13135 - elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
13137 - $data = substr($data, 3);
13140 - if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)
13142 - $declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
13143 - if ($declaration->parse())
13145 - $data = substr($data, $pos + 2);
13146 - $data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . $data;
13150 - $this->error_string = 'SimplePie bug! Please report this!';
13155 - // Work around libxml bug
13156 - $data = str_replace('<', '<', $data);
13157 - $data = str_replace('>', '>', $data);
13158 - $data = str_replace('&', '&', $data);
13159 - $data = str_replace(''', ''', $data);
13160 - $data = str_replace('"', '"', $data);
13164 - // Create the parser
13165 - $xml = xml_parser_create_ns($this->encoding, $this->separator);
13166 - xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1);
13167 - xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0);
13168 - xml_set_object($xml, $this);
13169 - xml_set_character_data_handler($xml, 'cdata');
13170 - xml_set_element_handler($xml, 'tag_open', 'tag_close');
13173 - if (!xml_parse($xml, $data, true))
13175 - $this->error_code = xml_get_error_code($xml);
13176 - $this->error_string = xml_error_string($this->error_code);
13179 - $this->current_line = xml_get_current_line_number($xml);
13180 - $this->current_column = xml_get_current_column_number($xml);
13181 - $this->current_byte = xml_get_current_byte_index($xml);
13182 - xml_parser_free($xml);
13186 - function get_error_code()
13188 - return $this->error_code;
13191 - function get_error_string()
13193 - return $this->error_string;
13196 - function get_current_line()
13198 - return $this->current_line;
13201 - function get_current_column()
13203 - return $this->current_column;
13206 - function get_current_byte()
13208 - return $this->current_byte;
13211 - function get_data()
13213 - return $this->data;
13216 - function tag_open($parser, $tag, $attributes)
13218 - if ($this->feed === 0)
13222 - elseif ($this->feed == false)
13224 - if (in_array($tag, array(
13225 - SIMPLEPIE_NAMESPACE_ATOM_10 . $this->separator . 'feed',
13226 - SIMPLEPIE_NAMESPACE_ATOM_03 . $this->separator . 'feed',
13228 - SIMPLEPIE_NAMESPACE_RDF . $this->separator . 'RDF'
13239 - list($this->namespace[], $this->element[]) = $this->split_ns($tag);
13241 - $attribs = array();
13242 - foreach ($attributes as $name => $value)
13244 - list($attrib_namespace, $attribute) = $this->split_ns($name);
13245 - $attribs[$attrib_namespace][$attribute] = $value;
13248 - if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['base']))
13250 - $this->xml_base[] = SimplePie_Misc::absolutize_url($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base));
13251 - $this->xml_base_explicit[] = true;
13255 - $this->xml_base[] = end($this->xml_base);
13256 - $this->xml_base_explicit[] = end($this->xml_base_explicit);
13259 - if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['lang']))
13261 - $this->xml_lang[] = $attribs[SIMPLEPIE_NAMESPACE_XML]['lang'];
13265 - $this->xml_lang[] = end($this->xml_lang);
13268 - if ($this->current_xhtml_construct >= 0)
13270 - $this->current_xhtml_construct++;
13271 - if (end($this->namespace) == SIMPLEPIE_NAMESPACE_XHTML)
13273 - $this->data['data'] .= '<' . end($this->element);
13274 - if (isset($attribs['']))
13276 - foreach ($attribs[''] as $name => $value)
13278 - $this->data['data'] .= ' ' . $name . '="' . htmlspecialchars($value, ENT_COMPAT, $this->encoding) . '"';
13281 - $this->data['data'] .= '>';
13286 - $this->datas[] =& $this->data;
13287 - $this->data =& $this->data['child'][end($this->namespace)][end($this->element)][];
13288 - $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));
13289 - 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')
13290 - || (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'))
13292 - $this->current_xhtml_construct = 0;
13297 - function cdata($parser, $cdata)
13299 - if ($this->current_xhtml_construct >= 0)
13301 - $this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding);
13303 - elseif ($this->feed > 1)
13305 - $this->data['data'] .= $cdata;
13309 - function tag_close($parser, $tag)
13311 - if (!$this->feed)
13316 - if ($this->current_xhtml_construct >= 0)
13318 - $this->current_xhtml_construct--;
13319 - 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')))
13321 - $this->data['data'] .= '</' . end($this->element) . '>';
13324 - if ($this->current_xhtml_construct == -1)
13326 - $this->data =& $this->datas[$this->feed];
13327 - array_pop($this->datas);
13330 - array_pop($this->element);
13331 - array_pop($this->namespace);
13332 - array_pop($this->xml_base);
13333 - array_pop($this->xml_base_explicit);
13334 - array_pop($this->xml_lang);
13338 - function split_ns($string)
13340 - static $cache = array();
13341 - if (!isset($cache[$string]))
13343 - if ($pos = strpos($string, $this->separator))
13345 - static $separator_length;
13346 - if (!$separator_length)
13348 - $separator_length = strlen($this->separator);
13350 - $namespace = substr($string, 0, $pos);
13351 - $local_name = substr($string, $pos + $separator_length);
13352 - if (strtolower($namespace) === SIMPLEPIE_NAMESPACE_ITUNES)
13354 - $namespace = SIMPLEPIE_NAMESPACE_ITUNES;
13357 - // Normalize the Media RSS namespaces
13358 - if ($namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG)
13360 - $namespace = SIMPLEPIE_NAMESPACE_MEDIARSS;
13362 - $cache[$string] = array($namespace, $local_name);
13366 - $cache[$string] = array('', $string);
13369 - return $cache[$string];
13374 - * @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
13376 -class SimplePie_Sanitize
13382 - var $remove_div = true;
13383 - var $image_handler = '';
13384 - var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
13385 - var $encode_instead_of_strip = false;
13386 - var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
13387 - var $strip_comments = false;
13388 - var $output_encoding = 'UTF-8';
13389 - var $enable_cache = true;
13390 - var $cache_location = './cache';
13391 - var $cache_name_function = 'md5';
13392 - var $cache_class = 'SimplePie_Cache';
13393 - var $file_class = 'SimplePie_File';
13394 - var $timeout = 10;
13395 - var $useragent = '';
13396 - var $force_fsockopen = false;
13399 - var $replace_url_attributes = array(
13401 - 'area' => 'href',
13402 - 'blockquote' => 'cite',
13404 - 'form' => 'action',
13405 - 'img' => array('longdesc', 'src'),
13406 - 'input' => 'src',
13411 - function remove_div($enable = true)
13413 - $this->remove_div = (bool) $enable;
13416 - function set_image_handler($page = false)
13420 - $this->image_handler = (string) $page;
13424 - $this->image_handler = false;
13428 - function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie_Cache')
13430 - if (isset($enable_cache))
13432 - $this->enable_cache = (bool) $enable_cache;
13435 - if ($cache_location)
13437 - $this->cache_location = (string) $cache_location;
13440 - if ($cache_name_function)
13442 - $this->cache_name_function = (string) $cache_name_function;
13445 - if ($cache_class)
13447 - $this->cache_class = (string) $cache_class;
13451 - function pass_file_data($file_class = 'SimplePie_File', $timeout = 10, $useragent = '', $force_fsockopen = false)
13455 - $this->file_class = (string) $file_class;
13460 - $this->timeout = (string) $timeout;
13465 - $this->useragent = (string) $useragent;
13468 - if ($force_fsockopen)
13470 - $this->force_fsockopen = (string) $force_fsockopen;
13474 - function strip_htmltags($tags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'))
13478 - if (is_array($tags))
13480 - $this->strip_htmltags = $tags;
13484 - $this->strip_htmltags = explode(',', $tags);
13489 - $this->strip_htmltags = false;
13493 - function encode_instead_of_strip($encode = false)
13495 - $this->encode_instead_of_strip = (bool) $encode;
13498 - function strip_attributes($attribs = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'))
13502 - if (is_array($attribs))
13504 - $this->strip_attributes = $attribs;
13508 - $this->strip_attributes = explode(',', $attribs);
13513 - $this->strip_attributes = false;
13517 - function strip_comments($strip = false)
13519 - $this->strip_comments = (bool) $strip;
13522 - function set_output_encoding($encoding = 'UTF-8')
13524 - $this->output_encoding = (string) $encoding;
13528 - * Set element/attribute key/value pairs of HTML attributes
13529 - * containing URLs that need to be resolved relative to the feed
13533 - * @param array $element_attribute Element/attribute key/value pairs
13535 - 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'))
13537 - $this->replace_url_attributes = (array) $element_attribute;
13540 - function sanitize($data, $type, $base = '')
13542 - $data = trim($data);
13543 - if ($data !== '' || $type & SIMPLEPIE_CONSTRUCT_IRI)
13545 - if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML)
13547 - 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))
13549 - $type |= SIMPLEPIE_CONSTRUCT_HTML;
13553 - $type |= SIMPLEPIE_CONSTRUCT_TEXT;
13557 - if ($type & SIMPLEPIE_CONSTRUCT_BASE64)
13559 - $data = base64_decode($data);
13562 - if ($type & SIMPLEPIE_CONSTRUCT_XHTML)
13564 - if ($this->remove_div)
13566 - $data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '', $data);
13567 - $data = preg_replace('/<\/div>$/', '', $data);
13571 - $data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '<div>', $data);
13575 - if ($type & (SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML))
13577 - // Strip comments
13578 - if ($this->strip_comments)
13580 - $data = SimplePie_Misc::strip_comments($data);
13583 - // Strip out HTML tags and attributes that might cause various security problems.
13584 - // Based on recommendations by Mark Pilgrim at:
13585 - // http://diveintomark.org/archives/2003/06/12/how_to_consume_rss_safely
13586 - if ($this->strip_htmltags)
13588 - foreach ($this->strip_htmltags as $tag)
13590 - $pcre = "/<($tag)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$tag" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>|(\/)?>)/siU';
13591 - while (preg_match($pcre, $data))
13593 - $data = preg_replace_callback($pcre, array(&$this, 'do_strip_htmltags'), $data);
13598 - if ($this->strip_attributes)
13600 - foreach ($this->strip_attributes as $attrib)
13602 - $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);
13606 - // Replace relative URLs
13607 - $this->base = $base;
13608 - foreach ($this->replace_url_attributes as $element => $attributes)
13610 - $data = $this->replace_urls($data, $element, $attributes);
13613 - // If image handling (caching, etc.) is enabled, cache and rewrite all the image tags.
13614 - if (isset($this->image_handler) && ((string) $this->image_handler) !== '' && $this->enable_cache)
13616 - $images = SimplePie_Misc::get_element('img', $data);
13617 - foreach ($images as $img)
13619 - if (isset($img['attribs']['src']['data']))
13621 - $image_url = call_user_func($this->cache_name_function, $img['attribs']['src']['data']);
13622 - $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $image_url, 'spi');
13624 - if ($cache->load())
13626 - $img['attribs']['src']['data'] = $this->image_handler . $image_url;
13627 - $data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data);
13631 - $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);
13632 - $headers = $file->headers;
13634 - if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)))
13636 - if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
13638 - $img['attribs']['src']['data'] = $this->image_handler . $image_url;
13639 - $data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data);
13643 - trigger_error("$cache->name is not writeable", E_USER_WARNING);
13651 - // Having (possibly) taken stuff out, there may now be whitespace at the beginning/end of the data
13652 - $data = trim($data);
13655 - if ($type & SIMPLEPIE_CONSTRUCT_IRI)
13657 - $data = SimplePie_Misc::absolutize_url($data, $base);
13660 - if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI))
13662 - $data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8');
13665 - if ($this->output_encoding != 'UTF-8')
13667 - $data = SimplePie_Misc::change_encoding($data, 'UTF-8', $this->output_encoding);
13673 - function replace_urls($data, $tag, $attributes)
13675 - if (!is_array($this->strip_htmltags) || !in_array($tag, $this->strip_htmltags))
13677 - $elements = SimplePie_Misc::get_element($tag, $data);
13678 - foreach ($elements as $element)
13680 - if (is_array($attributes))
13682 - foreach ($attributes as $attribute)
13684 - if (isset($element['attribs'][$attribute]['data']))
13686 - $element['attribs'][$attribute]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attribute]['data'], $this->base);
13687 - $new_element = SimplePie_Misc::element_implode($element);
13688 - $data = str_replace($element['full'], $new_element, $data);
13689 - $element['full'] = $new_element;
13693 - elseif (isset($element['attribs'][$attributes]['data']))
13695 - $element['attribs'][$attributes]['data'] = SimplePie_Misc::absolutize_url($element['attribs'][$attributes]['data'], $this->base);
13696 - $data = str_replace($element['full'], SimplePie_Misc::element_implode($element), $data);
13703 - function do_strip_htmltags($match)
13705 - if ($this->encode_instead_of_strip)
13707 - if (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
13709 - $match[1] = htmlspecialchars($match[1], ENT_COMPAT, 'UTF-8');
13710 - $match[2] = htmlspecialchars($match[2], ENT_COMPAT, 'UTF-8');
13711 - return "<$match[1]$match[2]>$match[3]</$match[1]>";
13715 - return htmlspecialchars($match[0], ENT_COMPAT, 'UTF-8');
13718 - elseif (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
13720 - return $match[4];
13730 --- src.orig/common/widget/Widget_Rss.class.php
13731 +++ src/common/widget/Widget_Rss.class.php
13733 return idn_to_unicode($param);
13736 - require_once('common/rss/simplepie.inc');
13737 + require_once('/usr/share/php/simplepie/simplepie.inc');
13738 if (!is_dir(forge_get_config('sys_var_path') .'/rss')) {
13739 mkdir(forge_get_config('sys_var_path') .'/rss');
13741 @@ -128,12 +128,7 @@
13742 $vTitle = new Valid_String('title');
13743 $vTitle->required();
13744 if (!$request->validInArray('rss', $vTitle)) {
13745 - if (function_exists('idn_to_utf8()')) {
13746 - require_once('simplepie/simplepie.inc');
13749 - require_once('common/rss/simplepie.inc');
13751 + require_once('/usr/share/php/simplepie/simplepie.inc');
13752 if (!is_dir(forge_get_config('sys_var_path') .'/rss')) {
13753 mkdir(forge_get_config('sys_var_path') .'/rss');