From 73f272016a3b81ee0470d3bc4189dfc453310c53 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Mon, 19 Jul 2010 08:22:58 +0000 Subject: [PATCH] MDL-19698 importing latest dev version of simplepie, this should fix most PHP5.3 deprecated issues --- lib/simplepie/readme_moodle.txt | 6 +- lib/simplepie/simplepie.inc | 2589 +++++++++++++------------------ 2 files changed, 1093 insertions(+), 1502 deletions(-) diff --git a/lib/simplepie/readme_moodle.txt b/lib/simplepie/readme_moodle.txt index f5a4faa9b77..eb1d73a4ee0 100644 --- a/lib/simplepie/readme_moodle.txt +++ b/lib/simplepie/readme_moodle.txt @@ -1,10 +1,10 @@ -Description of SimplePie v1.1.3 library import into Moodle +Description of SimplePie v1.3dev library import into Moodle -Obtained from http://simplepie.org/downloads/ +Obtained from http://simplepie.org/downloads/ - 009bbd51322d037d21e3e3f4db2ec0a187d31836 Changes: * None. This import contains _NO_CHANGES_ to the simplepie.inc file, changes are - controlled through OO extension of the classes intead. + controlled through OO extension of the classes instead. Dan Poltawski diff --git a/lib/simplepie/simplepie.inc b/lib/simplepie/simplepie.inc index 45c33c86e27..b87cbcd5c91 100644 --- a/lib/simplepie/simplepie.inc +++ b/lib/simplepie/simplepie.inc @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2009, Ryan Parman and Geoffrey Sneddon + * Copyright (c) 2004-2009, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,12 +33,12 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.2 - * @copyright 2004-2009 Ryan Parman, Geoffrey Sneddon + * @version 1.3-dev + * @copyright 2004-2009 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon + * @author Ryan McCue * @link http://simplepie.org/ SimplePie - * @link http://simplepie.org/support/ Please submit all bug reports and feature requests to the SimplePie forums * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @todo phpDoc comments */ @@ -51,12 +51,13 @@ define('SIMPLEPIE_NAME', 'SimplePie'); /** * SimplePie Version */ -define('SIMPLEPIE_VERSION', '1.2'); +define('SIMPLEPIE_VERSION', '1.3-dev'); /** * SimplePie Build + * @todo Hardcode for release (there's no need to have to call SimplePie_Misc::parse_date() only every load of simplepie.inc) */ -define('SIMPLEPIE_BUILD', '20090627192103'); +define('SIMPLEPIE_BUILD', gmdate('YmdHis', SimplePie_Misc::parse_date(substr('$Date$', 7, 25)) ? SimplePie_Misc::parse_date(substr('$Date$', 7, 25)) : filemtime(__FILE__))); /** * SimplePie Website URL @@ -333,10 +334,30 @@ define('SIMPLEPIE_NAMESPACE_GEORSS', 'http://www.georss.org/georss'); define('SIMPLEPIE_NAMESPACE_MEDIARSS', 'http://search.yahoo.com/mrss/'); /** - * Wrong Media RSS Namespace + * Wrong Media RSS Namespace. Caused by a long-standing typo in the spec. */ define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG', 'http://search.yahoo.com/mrss'); +/** + * Wrong Media RSS Namespace #2. New namespace introduced in Media RSS 1.5. + */ +define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG2', 'http://video.search.yahoo.com/mrss'); + +/** + * Wrong Media RSS Namespace #3. A possible typo of the Media RSS 1.5 namespace. + */ +define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG3', 'http://video.search.yahoo.com/mrss/'); + +/** + * Wrong Media RSS Namespace #4. New spec location after the RSS Advisory Board takes it over, but not a valid namespace. + */ +define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG4', 'http://www.rssboard.org/media-rss'); + +/** + * Wrong Media RSS Namespace #5. A possible typo of the RSS Advisory Board URL. + */ +define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG5', 'http://www.rssboard.org/media-rss/'); + /** * iTunes RSS Namespace */ @@ -398,55 +419,55 @@ class SimplePie * @var array Raw data * @access private */ - var $data = array(); + public $data = array(); /** * @var mixed Error string * @access private */ - var $error; + public $error; /** * @var object Instance of SimplePie_Sanitize (or other class) * @see SimplePie::set_sanitize_class() * @access private */ - var $sanitize; + public $sanitize; /** * @var string SimplePie Useragent * @see SimplePie::set_useragent() * @access private */ - var $useragent = SIMPLEPIE_USERAGENT; + public $useragent = SIMPLEPIE_USERAGENT; /** * @var string Feed URL * @see SimplePie::set_feed_url() * @access private */ - var $feed_url; + public $feed_url; /** * @var object Instance of SimplePie_File to use as a feed * @see SimplePie::set_file() * @access private */ - var $file; + public $file; /** * @var string Raw feed data * @see SimplePie::set_raw_data() * @access private */ - var $raw_data; + public $raw_data; /** * @var int Timeout for fetching remote files * @see SimplePie::set_timeout() * @access private */ - var $timeout = 10; + public $timeout = 10; /** * @var bool Forces fsockopen() to be used for remote files instead @@ -454,7 +475,7 @@ class SimplePie * @see SimplePie::force_fsockopen() * @access private */ - var $force_fsockopen = false; + public $force_fsockopen = false; /** * @var bool Force the given data/URL to be treated as a feed no matter what @@ -462,56 +483,56 @@ class SimplePie * @see SimplePie::force_feed() * @access private */ - var $force_feed = false; + public $force_feed = false; /** * @var bool Enable/Disable XML dump * @see SimplePie::enable_xml_dump() * @access private */ - var $xml_dump = false; + public $xml_dump = false; /** * @var bool Enable/Disable Caching * @see SimplePie::enable_cache() * @access private */ - var $cache = true; + public $cache = true; /** * @var int Cache duration (in seconds) * @see SimplePie::set_cache_duration() * @access private */ - var $cache_duration = 3600; + public $cache_duration = 3600; /** * @var int Auto-discovery cache duration (in seconds) * @see SimplePie::set_autodiscovery_cache_duration() * @access private */ - var $autodiscovery_cache_duration = 604800; // 7 Days. + public $autodiscovery_cache_duration = 604800; // 7 Days. /** * @var string Cache location (relative to executing script) * @see SimplePie::set_cache_location() * @access private */ - var $cache_location = './cache'; + public $cache_location = './cache'; /** * @var string Function that creates the cache filename * @see SimplePie::set_cache_name_function() * @access private */ - var $cache_name_function = 'md5'; + public $cache_name_function = 'md5'; /** * @var bool Reorder feed by date descending * @see SimplePie::enable_order_by_date() * @access private */ - var $order_by_date = true; + public $order_by_date = true; /** * @var mixed Force input encoding to be set to the follow value @@ -519,119 +540,119 @@ class SimplePie * @see SimplePie::set_input_encoding() * @access private */ - var $input_encoding = false; + public $input_encoding = false; /** * @var int Feed Autodiscovery Level * @see SimplePie::set_autodiscovery_level() * @access private */ - var $autodiscovery = SIMPLEPIE_LOCATOR_ALL; + public $autodiscovery = SIMPLEPIE_LOCATOR_ALL; /** * @var string Class used for caching feeds * @see SimplePie::set_cache_class() * @access private */ - var $cache_class = 'SimplePie_Cache'; + public $cache_class = 'SimplePie_Cache'; /** * @var string Class used for locating feeds * @see SimplePie::set_locator_class() * @access private */ - var $locator_class = 'SimplePie_Locator'; + public $locator_class = 'SimplePie_Locator'; /** * @var string Class used for parsing feeds * @see SimplePie::set_parser_class() * @access private */ - var $parser_class = 'SimplePie_Parser'; + public $parser_class = 'SimplePie_Parser'; /** * @var string Class used for fetching feeds * @see SimplePie::set_file_class() * @access private */ - var $file_class = 'SimplePie_File'; + public $file_class = 'SimplePie_File'; /** * @var string Class used for items * @see SimplePie::set_item_class() * @access private */ - var $item_class = 'SimplePie_Item'; + public $item_class = 'SimplePie_Item'; /** * @var string Class used for authors * @see SimplePie::set_author_class() * @access private */ - var $author_class = 'SimplePie_Author'; + public $author_class = 'SimplePie_Author'; /** * @var string Class used for categories * @see SimplePie::set_category_class() * @access private */ - var $category_class = 'SimplePie_Category'; + public $category_class = 'SimplePie_Category'; /** * @var string Class used for enclosures * @see SimplePie::set_enclosures_class() * @access private */ - var $enclosure_class = 'SimplePie_Enclosure'; + public $enclosure_class = 'SimplePie_Enclosure'; /** * @var string Class used for Media RSS captions * @see SimplePie::set_caption_class() * @access private */ - var $caption_class = 'SimplePie_Caption'; + public $caption_class = 'SimplePie_Caption'; /** * @var string Class used for Media RSS * @see SimplePie::set_copyright_class() * @access private */ - var $copyright_class = 'SimplePie_Copyright'; + public $copyright_class = 'SimplePie_Copyright'; /** * @var string Class used for Media RSS * @see SimplePie::set_credit_class() * @access private */ - var $credit_class = 'SimplePie_Credit'; + public $credit_class = 'SimplePie_Credit'; /** * @var string Class used for Media RSS * @see SimplePie::set_rating_class() * @access private */ - var $rating_class = 'SimplePie_Rating'; + public $rating_class = 'SimplePie_Rating'; /** * @var string Class used for Media RSS * @see SimplePie::set_restriction_class() * @access private */ - var $restriction_class = 'SimplePie_Restriction'; + public $restriction_class = 'SimplePie_Restriction'; /** * @var string Class used for content-type sniffing * @see SimplePie::set_content_type_sniffer_class() * @access private */ - var $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer'; + public $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer'; /** * @var string Class used for item sources. * @see SimplePie::set_source_class() * @access private */ - var $source_class = 'SimplePie_Source'; + public $source_class = 'SimplePie_Source'; /** * @var mixed Set javascript query string parameter (false, or @@ -639,76 +660,69 @@ class SimplePie * @see SimplePie::set_javascript() * @access private */ - var $javascript = 'js'; + public $javascript = 'js'; /** * @var int Maximum number of feeds to check with autodiscovery * @see SimplePie::set_max_checked_feeds() * @access private */ - var $max_checked_feeds = 10; + public $max_checked_feeds = 10; /** * @var array All the feeds found during the autodiscovery process * @see SimplePie::get_all_discovered_feeds() * @access private */ - var $all_discovered_feeds = array(); - - /** - * @var string Web-accessible path to the handler_favicon.php file. - * @see SimplePie::set_favicon_handler() - * @access private - */ - var $favicon_handler = ''; + public $all_discovered_feeds = array(); /** * @var string Web-accessible path to the handler_image.php file. * @see SimplePie::set_image_handler() * @access private */ - var $image_handler = ''; + public $image_handler = ''; /** * @var array Stores the URLs when multiple feeds are being initialized. * @see SimplePie::set_feed_url() * @access private */ - var $multifeed_url = array(); + public $multifeed_url = array(); /** * @var array Stores SimplePie objects when multiple feeds initialized. * @access private */ - var $multifeed_objects = array(); + public $multifeed_objects = array(); /** * @var array Stores the get_object_vars() array for use with multifeeds. * @see SimplePie::set_feed_url() * @access private */ - var $config_settings = null; + public $config_settings = null; /** * @var integer Stores the number of items to return per-feed with multifeeds. * @see SimplePie::set_item_limit() * @access private */ - var $item_limit = 0; + public $item_limit = 0; /** * @var array Stores the default attributes to be stripped by strip_attributes(). * @see SimplePie::strip_attributes() * @access private */ - var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'); + public $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'); /** * @var array Stores the default tags to be stripped by strip_htmltags(). * @see SimplePie::strip_htmltags() * @access private */ - var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'); + public $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'); /** * The SimplePie class contains feed level data and options @@ -727,38 +741,28 @@ class SimplePie * * @access public * @since 1.0 Preview Release - * @param string $feed_url This is the URL you want to parse. - * @param string $cache_location This is where you want the cache to be stored. - * @param int $cache_duration This is the number of seconds that you want to store the cache file for. */ - function SimplePie($feed_url = null, $cache_location = null, $cache_duration = null) + public function __construct() { - // Other objects, instances created here so we can set options on them - $this->sanitize =& new SimplePie_Sanitize; - - // Set options if they're passed to the constructor - if ($cache_location !== null) + if (version_compare(PHP_VERSION, '5.0', '<')) { - $this->set_cache_location($cache_location); + trigger_error('PHP 4.x is no longer supported. Please upgrade to PHP 5.2 or newer.'); + die(); } - if ($cache_duration !== null) - { - $this->set_cache_duration($cache_duration); - } + // Other objects, instances created here so we can set options on them + $this->sanitize = new SimplePie_Sanitize(); - // Only init the script if we're passed a feed URL - if ($feed_url !== null) + if (func_num_args() > 0) { - $this->set_feed_url($feed_url); - $this->init(); + trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_location() directly.'); } } /** * Used for converting object to a string */ - function __toString() + public function __toString() { return md5(serialize($this->data)); } @@ -766,7 +770,7 @@ class SimplePie /** * Remove items that link back to this before destroying this object */ - function __destruct() + public function __destruct() { if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) { @@ -797,7 +801,7 @@ class SimplePie * @since 1.1 * @param bool $enable Force the given data/URL to be treated as a feed */ - function force_feed($enable = false) + public function force_feed($enable = false) { $this->force_feed = (bool) $enable; } @@ -818,7 +822,7 @@ class SimplePie * @param mixed $url This is the URL (or array of URLs) that you want to parse. * @see SimplePie::set_raw_data() */ - function set_feed_url($url) + public function set_feed_url($url) { if (is_array($url)) { @@ -841,7 +845,7 @@ class SimplePie * @param object &$file Instance of SimplePie_File (or subclass) * @return bool True on success, false on failure */ - function set_file(&$file) + public function set_file(&$file) { if (is_a($file, 'SimplePie_File')) { @@ -864,7 +868,7 @@ class SimplePie * @param string $data RSS or Atom data as a string. * @see SimplePie::set_feed_url() */ - function set_raw_data($data) + public function set_raw_data($data) { $this->raw_data = $data; } @@ -879,7 +883,7 @@ class SimplePie * @since 1.0 Beta 3 * @param int $timeout The maximum number of seconds to spend waiting to retrieve a feed. */ - function set_timeout($timeout = 10) + public function set_timeout($timeout = 10) { $this->timeout = (int) $timeout; } @@ -892,31 +896,11 @@ class SimplePie * @since 1.0 Beta 3 * @param bool $enable Force fsockopen() to be used */ - function force_fsockopen($enable = false) + public function force_fsockopen($enable = false) { $this->force_fsockopen = (bool) $enable; } - /** - * Outputs the raw XML content of the feed, after it has gone through - * SimplePie's filters. - * - * Used only for debugging, this function will output the XML content as - * text/xml. When SimplePie reads in a feed, it does a bit of cleaning up - * before trying to parse it. Many parts of the feed are re-written in - * memory, and in the end, you have a parsable feed. XML dump shows you the - * actual XML that SimplePie tries to parse, which may or may not be very - * different from the original feed. - * - * @access public - * @since 1.0 Preview Release - * @param bool $enable Enable XML dump - */ - function enable_xml_dump($enable = false) - { - $this->xml_dump = (bool) $enable; - } - /** * Enables/disables caching in SimplePie. * @@ -927,7 +911,7 @@ class SimplePie * @since 1.0 Preview Release * @param bool $enable Enable caching */ - function enable_cache($enable = true) + public function enable_cache($enable = true) { $this->cache = (bool) $enable; } @@ -939,7 +923,7 @@ class SimplePie * @access public * @param int $seconds The feed content cache duration. */ - function set_cache_duration($seconds = 3600) + public function set_cache_duration($seconds = 3600) { $this->cache_duration = (int) $seconds; } @@ -951,7 +935,7 @@ class SimplePie * @access public * @param int $seconds The autodiscovered feed URL cache duration. */ - function set_autodiscovery_cache_duration($seconds = 604800) + public function set_autodiscovery_cache_duration($seconds = 604800) { $this->autodiscovery_cache_duration = (int) $seconds; } @@ -962,7 +946,7 @@ class SimplePie * @access public * @param string $location The file system location. */ - function set_cache_location($location = './cache') + public function set_cache_location($location = './cache') { $this->cache_location = (string) $location; } @@ -973,7 +957,7 @@ class SimplePie * @access public * @param bool $enable Sort as reverse chronological order. */ - function enable_order_by_date($enable = true) + public function enable_order_by_date($enable = true) { $this->order_by_date = (bool) $enable; } @@ -984,7 +968,7 @@ class SimplePie * @access public * @param string $encoding Character encoding. */ - function set_input_encoding($encoding = false) + public function set_input_encoding($encoding = false) { if ($encoding) { @@ -1010,7 +994,7 @@ class SimplePie * @param int $level Feed Autodiscovery Level (level can be a * combination of the above constants, see bitwise OR operator) */ - function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL) + public function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL) { $this->autodiscovery = (int) $level; } @@ -1021,10 +1005,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_cache_class($class = 'SimplePie_Cache') + public function set_cache_class($class = 'SimplePie_Cache') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Cache')) { @@ -1040,10 +1023,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_locator_class($class = 'SimplePie_Locator') + public function set_locator_class($class = 'SimplePie_Locator') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Locator')) { @@ -1059,10 +1041,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_parser_class($class = 'SimplePie_Parser') + public function set_parser_class($class = 'SimplePie_Parser') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Parser')) { @@ -1078,10 +1059,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_file_class($class = 'SimplePie_File') + public function set_file_class($class = 'SimplePie_File') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_File')) { @@ -1097,14 +1077,13 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_sanitize_class($class = 'SimplePie_Sanitize') + public function set_sanitize_class($class = 'SimplePie_Sanitize') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Sanitize')) { - $this->sanitize =& new $class; + $this->sanitize = new $class(); return true; } return false; @@ -1116,10 +1095,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_item_class($class = 'SimplePie_Item') + public function set_item_class($class = 'SimplePie_Item') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Item')) { @@ -1135,10 +1113,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_author_class($class = 'SimplePie_Author') + public function set_author_class($class = 'SimplePie_Author') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Author')) { @@ -1154,10 +1131,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_category_class($class = 'SimplePie_Category') + public function set_category_class($class = 'SimplePie_Category') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Category')) { @@ -1173,10 +1149,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_enclosure_class($class = 'SimplePie_Enclosure') + public function set_enclosure_class($class = 'SimplePie_Enclosure') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Enclosure')) { @@ -1192,10 +1167,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_caption_class($class = 'SimplePie_Caption') + public function set_caption_class($class = 'SimplePie_Caption') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Caption')) { @@ -1211,10 +1185,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_copyright_class($class = 'SimplePie_Copyright') + public function set_copyright_class($class = 'SimplePie_Copyright') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Copyright')) { @@ -1230,10 +1203,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_credit_class($class = 'SimplePie_Credit') + public function set_credit_class($class = 'SimplePie_Credit') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Credit')) { @@ -1249,10 +1221,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_rating_class($class = 'SimplePie_Rating') + public function set_rating_class($class = 'SimplePie_Rating') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Rating')) { @@ -1268,10 +1239,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_restriction_class($class = 'SimplePie_Restriction') + public function set_restriction_class($class = 'SimplePie_Restriction') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Restriction')) { @@ -1287,10 +1257,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer') + public function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Content_Type_Sniffer')) { @@ -1306,10 +1275,9 @@ class SimplePie * * @access public * @param string $class Name of custom class. - * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ - function set_source_class($class = 'SimplePie_Source') + public function set_source_class($class = 'SimplePie_Source') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Source')) { @@ -1325,7 +1293,7 @@ class SimplePie * @access public * @param string $ua New user agent string. */ - function set_useragent($ua = SIMPLEPIE_USERAGENT) + public function set_useragent($ua = SIMPLEPIE_USERAGENT) { $this->useragent = (string) $ua; } @@ -1336,7 +1304,7 @@ class SimplePie * @access public * @param mixed $function Callback function */ - function set_cache_name_function($function = 'md5') + public function set_cache_name_function($function = 'md5') { if (is_callable($function)) { @@ -1350,7 +1318,7 @@ class SimplePie * @access public * @param mixed $get Javascript query string parameter */ - function set_javascript($get = 'js') + public function set_javascript($get = 'js') { if ($get) { @@ -1369,7 +1337,7 @@ class SimplePie * @access public * @param bool $set Whether to set them or not */ - function set_stupidly_fast($set = false) + public function set_stupidly_fast($set = false) { if ($set) { @@ -1388,17 +1356,17 @@ class SimplePie * @access public * @param int $max Maximum number of feeds to check */ - function set_max_checked_feeds($max = 10) + public function set_max_checked_feeds($max = 10) { $this->max_checked_feeds = (int) $max; } - function remove_div($enable = true) + public function remove_div($enable = true) { $this->sanitize->remove_div($enable); } - function strip_htmltags($tags = '', $encode = null) + public function strip_htmltags($tags = '', $encode = null) { if ($tags === '') { @@ -1411,12 +1379,12 @@ class SimplePie } } - function encode_instead_of_strip($enable = true) + public function encode_instead_of_strip($enable = true) { $this->sanitize->encode_instead_of_strip($enable); } - function strip_attributes($attribs = '') + public function strip_attributes($attribs = '') { if ($attribs === '') { @@ -1425,12 +1393,12 @@ class SimplePie $this->sanitize->strip_attributes($attribs); } - function set_output_encoding($encoding = 'UTF-8') + public function set_output_encoding($encoding = 'UTF-8') { $this->sanitize->set_output_encoding($encoding); } - function strip_comments($strip = false) + public function strip_comments($strip = false) { $this->sanitize->strip_comments($strip); } @@ -1443,30 +1411,11 @@ class SimplePie * @since 1.0 * @param array $element_attribute Element/attribute key/value pairs */ - 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')) + public 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')) { $this->sanitize->set_url_replacements($element_attribute); } - /** - * Set the handler to enable the display of cached favicons. - * - * @access public - * @param str $page Web-accessible path to the handler_favicon.php file. - * @param str $qs The query string that the value should be passed to. - */ - function set_favicon_handler($page = false, $qs = 'i') - { - if ($page !== false) - { - $this->favicon_handler = $page . '?' . $qs . '='; - } - else - { - $this->favicon_handler = ''; - } - } - /** * Set the handler to enable the display of cached images. * @@ -1474,7 +1423,7 @@ class SimplePie * @param str $page Web-accessible path to the handler_image.php file. * @param str $qs The query string that the value should be passed to. */ - function set_image_handler($page = false, $qs = 'i') + public function set_image_handler($page = false, $qs = 'i') { if ($page !== false) { @@ -1492,12 +1441,12 @@ class SimplePie * @access public * @param integer $limit The maximum number of items to return. */ - function set_item_limit($limit = 0) + public function set_item_limit($limit = 0) { $this->item_limit = (int) $limit; } - function init() + public function init() { // Check absolute bare minimum requirements. if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.3.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre')) @@ -1533,6 +1482,7 @@ class SimplePie if ($this->feed_url !== null || $this->raw_data !== null) { + $this->error = null; $this->data = array(); $this->multifeed_objects = array(); $cache = false; @@ -1598,7 +1548,9 @@ class SimplePie { $headers['if-none-match'] = '"' . $this->data['headers']['etag'] . '"'; } - $file =& new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen); + + $file = new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen); + if ($file->success) { if ($file->status_code === 304) @@ -1639,7 +1591,7 @@ class SimplePie } else { - $file =& new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen); + $file = new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen); } } // If the file connection has an error, set SimplePie::error to that and quit @@ -1659,7 +1611,8 @@ class SimplePie if (!$this->force_feed) { // Check if the supplied URL is a feed, if it isn't, look for it. - $locate =& new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class); + $locate = new $this->locator_class($file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class); + if (!$locate->is_feed($file)) { // We need to unset this so that if SimplePie::set_file() has been called that object is untouched @@ -1671,7 +1624,7 @@ class SimplePie $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD); if (!$cache->save($this)) { - trigger_error("$this->cache_location is not writeable", E_USER_WARNING); + trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); } $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc'); } @@ -1679,7 +1632,7 @@ class SimplePie } else { - $this->error = "A feed could not be found at $this->feed_url"; + $this->error = "A feed could not be found at $this->feed_url. A feed with an invalid mime type may fall victim to this error, or " . SIMPLEPIE_NAME . " was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed."; SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__); return false; } @@ -1689,7 +1642,7 @@ class SimplePie $headers = $file->headers; $data = $file->body; - $sniffer =& new $this->content_type_sniffer_class($file); + $sniffer = new $this->content_type_sniffer_class($file); $sniffed = $sniffer->get_type(); } else @@ -1759,7 +1712,7 @@ class SimplePie if ($utf8_data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8')) { // Create new parser - $parser =& new $this->parser_class(); + $parser = new $this->parser_class(); // If it's parsed fine if ($parser->parse($utf8_data, 'UTF-8')) @@ -1776,29 +1729,32 @@ class SimplePie // Cache the file if caching is enabled if ($cache && !$cache->save($this)) { - trigger_error("$cache->name is not writeable", E_USER_WARNING); + trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); } return true; } else { - $this->error = "A feed could not be found at $this->feed_url"; + $this->error = "A feed could not be found at $this->feed_url. This does not appear to be a valid RSS or Atom feed."; SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__); return false; } } } } - if(isset($parser)) + + if (isset($parser)) { // We have an error, just set SimplePie_Misc::error to it and quit - $this->error = sprintf('XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column()); + $this->error = sprintf('This XML document is invalid, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column()); } else { - $this->error = 'The data could not be converted to UTF-8'; + $this->error = 'The data could not be converted to UTF-8. You MUST have either the iconv or mbstring extension installed. Upgrading to PHP 5.x (which includes iconv) is highly recommended.'; } + SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__); + return false; } elseif (!empty($this->multifeed_url)) @@ -1835,17 +1791,17 @@ class SimplePie * @access public * @return string Error message */ - function error() + public function error() { return $this->error; } - function get_encoding() + public function get_encoding() { return $this->sanitize->output_encoding; } - function handle_content_type($mime = 'text/html') + public function handle_content_type($mime = 'text/html') { if (!headers_sent()) { @@ -1862,7 +1818,7 @@ class SimplePie } } - function get_type() + public function get_type() { if (!isset($this->data['type'])) { @@ -1942,73 +1898,12 @@ class SimplePie return $this->data['type']; } - /** - * Returns the URL for the favicon of the feed's website. - * - * @todo Cache atom:icon - * @access public - * @since 1.0 - */ - function get_favicon() - { - if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon')) - { - return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0])); - } - elseif (($url = $this->get_link()) !== null && preg_match('/^http(s)?:\/\//i', $url)) - { - $favicon = SimplePie_Misc::absolutize_url('/favicon.ico', $url); - - if ($this->cache && $this->favicon_handler) - { - $favicon_filename = call_user_func($this->cache_name_function, $favicon); - $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, $favicon_filename, 'spi'); - - if ($cache->load()) - { - return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI); - } - else - { - $file =& new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen); - - if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0) - { - $sniffer =& new $this->content_type_sniffer_class($file); - if (substr($sniffer->get_type(), 0, 6) === 'image/') - { - if ($cache->save(array('headers' => $file->headers, 'body' => $file->body))) - { - return $this->sanitize($this->favicon_handler . $favicon_filename, SIMPLEPIE_CONSTRUCT_IRI); - } - else - { - trigger_error("$cache->name is not writeable", E_USER_WARNING); - return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI); - } - } - // not an image - else - { - return false; - } - } - } - } - else - { - return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI); - } - } - return false; - } - /** * @todo If we have a perm redirect we should return the new URL * @todo When we make the above change, let's support as well * @todo Also, |atom:link|@rel=self */ - function subscribe_url() + public function subscribe_url() { if ($this->feed_url !== null) { @@ -2020,156 +1915,7 @@ class SimplePie } } - function subscribe_feed() - { - if ($this->feed_url !== null) - { - return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI); - } - else - { - return null; - } - } - - function subscribe_outlook() - { - if ($this->feed_url !== null) - { - return $this->sanitize('outlook' . SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI); - } - else - { - return null; - } - } - - function subscribe_podcast() - { - if ($this->feed_url !== null) - { - return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 3), SIMPLEPIE_CONSTRUCT_IRI); - } - else - { - return null; - } - } - - function subscribe_itunes() - { - if ($this->feed_url !== null) - { - return $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 4), SIMPLEPIE_CONSTRUCT_IRI); - } - else - { - return null; - } - } - - /** - * Creates the subscribe_* methods' return data - * - * @access private - * @param string $feed_url String to prefix to the feed URL - * @param string $site_url String to prefix to the site URL (and - * suffix to the feed URL) - * @return mixed URL if feed exists, false otherwise - */ - function subscribe_service($feed_url, $site_url = null) - { - if ($this->subscribe_url()) - { - $return = $feed_url . rawurlencode($this->feed_url); - if ($site_url !== null && $this->get_link() !== null) - { - $return .= $site_url . rawurlencode($this->get_link()); - } - return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI); - } - else - { - return null; - } - } - - function subscribe_aol() - { - return $this->subscribe_service('http://feeds.my.aol.com/add.jsp?url='); - } - - function subscribe_bloglines() - { - return $this->subscribe_service('http://www.bloglines.com/sub/'); - } - - function subscribe_eskobo() - { - return $this->subscribe_service('http://www.eskobo.com/?AddToMyPage='); - } - - function subscribe_feedfeeds() - { - return $this->subscribe_service('http://www.feedfeeds.com/add?feed='); - } - - function subscribe_feedster() - { - return $this->subscribe_service('http://www.feedster.com/myfeedster.php?action=addrss&confirm=no&rssurl='); - } - - function subscribe_google() - { - return $this->subscribe_service('http://fusion.google.com/add?feedurl='); - } - - function subscribe_gritwire() - { - return $this->subscribe_service('http://my.gritwire.com/feeds/addExternalFeed.aspx?FeedUrl='); - } - - function subscribe_msn() - { - return $this->subscribe_service('http://my.msn.com/addtomymsn.armx?id=rss&ut=', '&ru='); - } - - function subscribe_netvibes() - { - return $this->subscribe_service('http://www.netvibes.com/subscribe.php?url='); - } - - function subscribe_newsburst() - { - return $this->subscribe_service('http://www.newsburst.com/Source/?add='); - } - - function subscribe_newsgator() - { - return $this->subscribe_service('http://www.newsgator.com/ngs/subscriber/subext.aspx?url='); - } - - function subscribe_odeo() - { - return $this->subscribe_service('http://www.odeo.com/listen/subscribe?feed='); - } - - function subscribe_podnova() - { - return $this->subscribe_service('http://www.podnova.com/index_your_podcasts.srf?action=add&url='); - } - - function subscribe_rojo() - { - return $this->subscribe_service('http://www.rojo.com/add-subscription?resource='); - } - - function subscribe_yahoo() - { - return $this->subscribe_service('http://add.my.yahoo.com/rss?url='); - } - - function get_feed_tags($namespace, $tag) + public function get_feed_tags($namespace, $tag) { $type = $this->get_type(); if ($type & SIMPLEPIE_TYPE_ATOM_10) @@ -2203,7 +1949,7 @@ class SimplePie return null; } - function get_channel_tags($namespace, $tag) + public function get_channel_tags($namespace, $tag) { $type = $this->get_type(); if ($type & SIMPLEPIE_TYPE_ATOM_ALL) @@ -2246,7 +1992,7 @@ class SimplePie return null; } - function get_image_tags($namespace, $tag) + public function get_image_tags($namespace, $tag) { $type = $this->get_type(); if ($type & SIMPLEPIE_TYPE_RSS_10) @@ -2282,7 +2028,7 @@ class SimplePie return null; } - function get_base($element = array()) + public function get_base($element = array()) { if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base'])) { @@ -2298,12 +2044,12 @@ class SimplePie } } - function sanitize($data, $type, $base = '') + public function sanitize($data, $type, $base = '') { return $this->sanitize->sanitize($data, $type, $base); } - function get_title() + public function get_title() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) { @@ -2339,7 +2085,7 @@ class SimplePie } } - function get_category($key = 0) + public function get_category($key = 0) { $categories = $this->get_categories(); if (isset($categories[$key])) @@ -2352,7 +2098,7 @@ class SimplePie } } - function get_categories() + public function get_categories() { $categories = array(); @@ -2373,7 +2119,7 @@ class SimplePie { $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); } - $categories[] =& new $this->category_class($term, $scheme, $label); + $categories[] = new $this->category_class($term, $scheme, $label); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) { @@ -2388,15 +2134,15 @@ class SimplePie { $scheme = null; } - $categories[] =& new $this->category_class($term, $scheme, null); + $categories[] = new $this->category_class($term, $scheme, null); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) { - $categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) { - $categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $categories[] = new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } if (!empty($categories)) @@ -2409,7 +2155,7 @@ class SimplePie } } - function get_author($key = 0) + public function get_author($key = 0) { $authors = $this->get_authors(); if (isset($authors[$key])) @@ -2422,7 +2168,7 @@ class SimplePie } } - function get_authors() + public function get_authors() { $authors = array(); foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) @@ -2444,7 +2190,7 @@ class SimplePie } if ($name !== null || $email !== null || $uri !== null) { - $authors[] =& new $this->author_class($name, $uri, $email); + $authors[] = new $this->author_class($name, $uri, $email); } } if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) @@ -2466,20 +2212,20 @@ class SimplePie } if ($name !== null || $email !== null || $url !== null) { - $authors[] =& new $this->author_class($name, $url, $email); + $authors[] = new $this->author_class($name, $url, $email); } } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) { - $authors[] =& new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) { - $authors[] =& new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) { - $authors[] =& new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $authors[] = new $this->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } if (!empty($authors)) @@ -2492,7 +2238,7 @@ class SimplePie } } - function get_contributor($key = 0) + public function get_contributor($key = 0) { $contributors = $this->get_contributors(); if (isset($contributors[$key])) @@ -2505,7 +2251,7 @@ class SimplePie } } - function get_contributors() + public function get_contributors() { $contributors = array(); foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) @@ -2527,7 +2273,7 @@ class SimplePie } if ($name !== null || $email !== null || $uri !== null) { - $contributors[] =& new $this->author_class($name, $uri, $email); + $contributors[] = new $this->author_class($name, $uri, $email); } } foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) @@ -2549,7 +2295,7 @@ class SimplePie } if ($name !== null || $email !== null || $url !== null) { - $contributors[] =& new $this->author_class($name, $url, $email); + $contributors[] = new $this->author_class($name, $url, $email); } } @@ -2563,7 +2309,7 @@ class SimplePie } } - function get_link($key = 0, $rel = 'alternate') + public function get_link($key = 0, $rel = 'alternate') { $links = $this->get_links($rel); if (isset($links[$key])) @@ -2579,12 +2325,12 @@ class SimplePie /** * Added for parity between the parent-level and the item/entry-level. */ - function get_permalink() + public function get_permalink() { return $this->get_link(0); } - function get_links($rel = 'alternate') + public function get_links($rel = 'alternate') { if (!isset($this->data['links'])) { @@ -2658,12 +2404,12 @@ class SimplePie } } - function get_all_discovered_feeds() + public function get_all_discovered_feeds() { return $this->all_discovered_feeds; } - function get_description() + public function get_description() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) { @@ -2707,7 +2453,7 @@ class SimplePie } } - function get_copyright() + public function get_copyright() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) { @@ -2735,7 +2481,7 @@ class SimplePie } } - function get_language() + public function get_language() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) { @@ -2771,13 +2517,14 @@ class SimplePie } } - function get_latitude() + public function get_latitude() { + if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) { return (float) $return[0]['data']; } - elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) + elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) { return (float) $match[1]; } @@ -2787,7 +2534,7 @@ class SimplePie } } - function get_longitude() + public function get_longitude() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) { @@ -2797,7 +2544,7 @@ class SimplePie { return (float) $return[0]['data']; } - elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) + elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) { return (float) $match[2]; } @@ -2807,7 +2554,7 @@ class SimplePie } } - function get_image_title() + public function get_image_title() { if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) { @@ -2835,7 +2582,7 @@ class SimplePie } } - function get_image_url() + public function get_image_url() { if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) { @@ -2867,7 +2614,7 @@ class SimplePie } } - function get_image_link() + public function get_image_link() { if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link')) { @@ -2887,7 +2634,7 @@ class SimplePie } } - function get_image_width() + public function get_image_width() { if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width')) { @@ -2903,7 +2650,7 @@ class SimplePie } } - function get_image_height() + public function get_image_height() { if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height')) { @@ -2919,7 +2666,7 @@ class SimplePie } } - function get_item_quantity($max = 0) + public function get_item_quantity($max = 0) { $max = (int) $max; $qty = count($this->get_items()); @@ -2933,7 +2680,7 @@ class SimplePie } } - function get_item($key = 0) + public function get_item($key = 0) { $items = $this->get_items(); if (isset($items[$key])) @@ -2946,7 +2693,7 @@ class SimplePie } } - function get_items($start = 0, $end = 0) + public function get_items($start = 0, $end = 0) { if (!isset($this->data['items'])) { @@ -2962,7 +2709,7 @@ class SimplePie $keys = array_keys($items); foreach ($keys as $key) { - $this->data['items'][] =& new $this->item_class($this, $items[$key]); + $this->data['items'][] = new $this->item_class($this, $items[$key]); } } if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry')) @@ -2970,7 +2717,7 @@ class SimplePie $keys = array_keys($items); foreach ($keys as $key) { - $this->data['items'][] =& new $this->item_class($this, $items[$key]); + $this->data['items'][] = new $this->item_class($this, $items[$key]); } } if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item')) @@ -2978,7 +2725,7 @@ class SimplePie $keys = array_keys($items); foreach ($keys as $key) { - $this->data['items'][] =& new $this->item_class($this, $items[$key]); + $this->data['items'][] = new $this->item_class($this, $items[$key]); } } if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item')) @@ -2986,7 +2733,7 @@ class SimplePie $keys = array_keys($items); foreach ($keys as $key) { - $this->data['items'][] =& new $this->item_class($this, $items[$key]); + $this->data['items'][] = new $this->item_class($this, $items[$key]); } } if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item')) @@ -2994,7 +2741,7 @@ class SimplePie $keys = array_keys($items); foreach ($keys as $key) { - $this->data['items'][] =& new $this->item_class($this, $items[$key]); + $this->data['items'][] = new $this->item_class($this, $items[$key]); } } } @@ -3049,7 +2796,7 @@ class SimplePie /** * @static */ - function sort_items($a, $b) + public function sort_items($a, $b) { return $a->get_date('U') <= $b->get_date('U'); } @@ -3057,7 +2804,7 @@ class SimplePie /** * @static */ - function merge_items($urls, $start = 0, $end = 0, $limit = 0) + public function merge_items($urls, $start = 0, $end = 0, $limit = 0) { if (is_array($urls) && sizeof($urls) > 0) { @@ -3111,13 +2858,13 @@ class SimplePie_Item var $feed; var $data = array(); - function SimplePie_Item($feed, $data) + public function __construct($feed, $data) { $this->feed = $feed; $this->data = $data; } - function __toString() + public function __toString() { return md5(serialize($this->data)); } @@ -3125,7 +2872,7 @@ class SimplePie_Item /** * Remove items that link back to this before destroying this object */ - function __destruct() + public function __destruct() { if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) { @@ -3133,7 +2880,7 @@ class SimplePie_Item } } - function get_item_tags($namespace, $tag) + public function get_item_tags($namespace, $tag) { if (isset($this->data['child'][$namespace][$tag])) { @@ -3145,22 +2892,22 @@ class SimplePie_Item } } - function get_base($element = array()) + public function get_base($element = array()) { return $this->feed->get_base($element); } - function sanitize($data, $type, $base = '') + public function sanitize($data, $type, $base = '') { return $this->feed->sanitize($data, $type, $base); } - function get_feed() + public function get_feed() { return $this->feed; } - function get_id($hash = false) + public function get_id($hash = false) { if (!$hash) { @@ -3203,7 +2950,7 @@ class SimplePie_Item } } - function get_title() + public function get_title() { if (!isset($this->data['title'])) { @@ -3243,7 +2990,7 @@ class SimplePie_Item return $this->data['title']; } - function get_description($description_only = false) + public function get_description($description_only = false) { if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary')) { @@ -3287,7 +3034,7 @@ class SimplePie_Item } } - function get_content($content_only = false) + public function get_content($content_only = false) { if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content')) { @@ -3311,7 +3058,7 @@ class SimplePie_Item } } - function get_category($key = 0) + public function get_category($key = 0) { $categories = $this->get_categories(); if (isset($categories[$key])) @@ -3324,7 +3071,7 @@ class SimplePie_Item } } - function get_categories() + public function get_categories() { $categories = array(); @@ -3345,7 +3092,7 @@ class SimplePie_Item { $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); } - $categories[] =& new $this->feed->category_class($term, $scheme, $label); + $categories[] = new $this->feed->category_class($term, $scheme, $label); } foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) { @@ -3360,15 +3107,15 @@ class SimplePie_Item { $scheme = null; } - $categories[] =& new $this->feed->category_class($term, $scheme, null); + $categories[] = new $this->feed->category_class($term, $scheme, null); } foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) { - $categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) { - $categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $categories[] = new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } if (!empty($categories)) @@ -3381,7 +3128,7 @@ class SimplePie_Item } } - function get_author($key = 0) + public function get_author($key = 0) { $authors = $this->get_authors(); if (isset($authors[$key])) @@ -3394,7 +3141,7 @@ class SimplePie_Item } } - function get_contributor($key = 0) + public function get_contributor($key = 0) { $contributors = $this->get_contributors(); if (isset($contributors[$key])) @@ -3407,7 +3154,7 @@ class SimplePie_Item } } - function get_contributors() + public function get_contributors() { $contributors = array(); foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) @@ -3429,7 +3176,7 @@ class SimplePie_Item } if ($name !== null || $email !== null || $uri !== null) { - $contributors[] =& new $this->feed->author_class($name, $uri, $email); + $contributors[] = new $this->feed->author_class($name, $uri, $email); } } foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) @@ -3451,7 +3198,7 @@ class SimplePie_Item } if ($name !== null || $email !== null || $url !== null) { - $contributors[] =& new $this->feed->author_class($name, $url, $email); + $contributors[] = new $this->feed->author_class($name, $url, $email); } } @@ -3465,7 +3212,7 @@ class SimplePie_Item } } - function get_authors() + public function get_authors() { $authors = array(); foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) @@ -3487,7 +3234,7 @@ class SimplePie_Item } if ($name !== null || $email !== null || $uri !== null) { - $authors[] =& new $this->feed->author_class($name, $uri, $email); + $authors[] = new $this->feed->author_class($name, $uri, $email); } } if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) @@ -3509,24 +3256,24 @@ class SimplePie_Item } if ($name !== null || $email !== null || $url !== null) { - $authors[] =& new $this->feed->author_class($name, $url, $email); + $authors[] = new $this->feed->author_class($name, $url, $email); } } if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author')) { - $authors[] =& new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); + $authors[] = new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); } foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) { - $authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) { - $authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) { - $authors[] =& new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $authors[] = new $this->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } if (!empty($authors)) @@ -3547,7 +3294,7 @@ class SimplePie_Item } } - function get_copyright() + public function get_copyright() { if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) { @@ -3567,7 +3314,7 @@ class SimplePie_Item } } - function get_date($date_format = 'j F Y, g:i a') + public function get_date($date_format = 'j F Y, g:i a') { if (!isset($this->data['date'])) { @@ -3635,7 +3382,7 @@ class SimplePie_Item } } - function get_local_date($date_format = '%c') + public function get_local_date($date_format = '%c') { if (!$date_format) { @@ -3651,7 +3398,7 @@ class SimplePie_Item } } - function get_permalink() + public function get_permalink() { $link = $this->get_link(); $enclosure = $this->get_enclosure(0); @@ -3669,7 +3416,7 @@ class SimplePie_Item } } - function get_link($key = 0, $rel = 'alternate') + public function get_link($key = 0, $rel = 'alternate') { $links = $this->get_links($rel); if ($links[$key] !== null) @@ -3682,7 +3429,7 @@ class SimplePie_Item } } - function get_links($rel = 'alternate') + public function get_links($rel = 'alternate') { if (!isset($this->data['links'])) { @@ -3759,7 +3506,7 @@ class SimplePie_Item /** * @todo Add ability to prefer one type of content over another (in a media group). */ - function get_enclosure($key = 0, $prefer = null) + public function get_enclosure($key = 0, $prefer = null) { $enclosures = $this->get_enclosures(); if (isset($enclosures[$key])) @@ -3782,7 +3529,7 @@ class SimplePie_Item * @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4). * @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). */ - function get_enclosures() + public function get_enclosures() { if (!isset($this->data['enclosures'])) { @@ -3836,7 +3583,7 @@ class SimplePie_Item { $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $captions_parent[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); + $captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); } } elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) @@ -3868,7 +3615,7 @@ class SimplePie_Item { $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $captions_parent[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); + $captions_parent[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); } } if (is_array($captions_parent)) @@ -3898,7 +3645,7 @@ class SimplePie_Item { $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); } - $categories_parent[] =& new $this->feed->category_class($term, $scheme, $label); + $categories_parent[] = new $this->feed->category_class($term, $scheme, $label); } foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category) { @@ -3921,7 +3668,7 @@ class SimplePie_Item { $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); } - $categories_parent[] =& new $this->feed->category_class($term, $scheme, $label); + $categories_parent[] = new $this->feed->category_class($term, $scheme, $label); } foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'category') as $category) { @@ -3932,7 +3679,7 @@ class SimplePie_Item { $label = $this->sanitize($category['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT); } - $categories_parent[] =& new $this->feed->category_class($term, $scheme, $label); + $categories_parent[] = new $this->feed->category_class($term, $scheme, $label); if (isset($category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category'])) { @@ -3942,7 +3689,7 @@ class SimplePie_Item { $label = $this->sanitize($subcategory['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT); } - $categories_parent[] =& new $this->feed->category_class($term, $scheme, $label); + $categories_parent[] = new $this->feed->category_class($term, $scheme, $label); } } } @@ -3964,7 +3711,7 @@ class SimplePie_Item { $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $copyrights_parent =& new $this->feed->copyright_class($copyright_url, $copyright_label); + $copyrights_parent = new $this->feed->copyright_class($copyright_url, $copyright_label); } elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright')) { @@ -3978,7 +3725,7 @@ class SimplePie_Item { $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $copyrights_parent =& new $this->feed->copyright_class($copyright_url, $copyright_label); + $copyrights_parent = new $this->feed->copyright_class($copyright_url, $copyright_label); } // CREDITS @@ -4005,7 +3752,7 @@ class SimplePie_Item { $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $credits_parent[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); + $credits_parent[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); } } elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit')) @@ -4031,7 +3778,7 @@ class SimplePie_Item { $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $credits_parent[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); + $credits_parent[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); } } if (is_array($credits_parent)) @@ -4220,7 +3967,7 @@ class SimplePie_Item { $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value); + $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value); } } elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) @@ -4233,7 +3980,7 @@ class SimplePie_Item { $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value); + $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value); } } elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating')) @@ -4254,7 +4001,7 @@ class SimplePie_Item { $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value); + $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value); } } elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) @@ -4267,7 +4014,7 @@ class SimplePie_Item { $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $ratings_parent[] =& new $this->feed->rating_class($rating_scheme, $rating_value); + $ratings_parent[] = new $this->feed->rating_class($rating_scheme, $rating_value); } } if (is_array($ratings_parent)) @@ -4295,7 +4042,7 @@ class SimplePie_Item { $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); + $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); } } elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) @@ -4309,7 +4056,7 @@ class SimplePie_Item { $restriction_relationship = 'deny'; } - $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); + $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); } } elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction')) @@ -4331,7 +4078,7 @@ class SimplePie_Item { $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); + $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); } } elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) @@ -4345,7 +4092,7 @@ class SimplePie_Item { $restriction_relationship = 'deny'; } - $restrictions_parent[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); + $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); } } if (is_array($restrictions_parent)) @@ -4427,621 +4174,624 @@ class SimplePie_Item // If we have media:group tags, loop through them. foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group') as $group) { - // If we have media:content tags, loop through them. - foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content) - { - if (isset($content['attribs']['']['url'])) - { - // Attributes - $bitrate = null; - $channels = null; - $duration = null; - $expression = null; - $framerate = null; - $height = null; - $javascript = null; - $lang = null; - $length = null; - $medium = null; - $samplingrate = null; - $type = null; - $url = null; - $width = null; + if(isset($group['child']) && isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'])) + { + // If we have media:content tags, loop through them. + foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content) + { + if (isset($content['attribs']['']['url'])) + { + // Attributes + $bitrate = null; + $channels = null; + $duration = null; + $expression = null; + $framerate = null; + $height = null; + $javascript = null; + $lang = null; + $length = null; + $medium = null; + $samplingrate = null; + $type = null; + $url = null; + $width = null; + + // Elements + $captions = null; + $categories = null; + $copyrights = null; + $credits = null; + $description = null; + $hashes = null; + $keywords = null; + $player = null; + $ratings = null; + $restrictions = null; + $thumbnails = null; + $title = null; + + // Start checking the attributes of media:content + if (isset($content['attribs']['']['bitrate'])) + { + $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['channels'])) + { + $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['duration'])) + { + $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $duration = $duration_parent; + } + if (isset($content['attribs']['']['expression'])) + { + $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['framerate'])) + { + $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['height'])) + { + $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['lang'])) + { + $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['fileSize'])) + { + $length = ceil($content['attribs']['']['fileSize']); + } + if (isset($content['attribs']['']['medium'])) + { + $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['samplingrate'])) + { + $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['type'])) + { + $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($content['attribs']['']['width'])) + { + $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - // Elements - $captions = null; - $categories = null; - $copyrights = null; - $credits = null; - $description = null; - $hashes = null; - $keywords = null; - $player = null; - $ratings = null; - $restrictions = null; - $thumbnails = null; - $title = null; + // Checking the other optional media: elements. Priority: media:content, media:group, item, channel - // Start checking the attributes of media:content - if (isset($content['attribs']['']['bitrate'])) - { - $bitrate = $this->sanitize($content['attribs']['']['bitrate'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['channels'])) - { - $channels = $this->sanitize($content['attribs']['']['channels'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['duration'])) - { - $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $duration = $duration_parent; - } - if (isset($content['attribs']['']['expression'])) - { - $expression = $this->sanitize($content['attribs']['']['expression'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['framerate'])) - { - $framerate = $this->sanitize($content['attribs']['']['framerate'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['height'])) - { - $height = $this->sanitize($content['attribs']['']['height'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['lang'])) - { - $lang = $this->sanitize($content['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['fileSize'])) - { - $length = ceil($content['attribs']['']['fileSize']); - } - if (isset($content['attribs']['']['medium'])) - { - $medium = $this->sanitize($content['attribs']['']['medium'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['samplingrate'])) - { - $samplingrate = $this->sanitize($content['attribs']['']['samplingrate'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['type'])) - { - $type = $this->sanitize($content['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($content['attribs']['']['width'])) - { - $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT); - } - $url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - - // Checking the other optional media: elements. Priority: media:content, media:group, item, channel - - // CAPTIONS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) + // CAPTIONS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) { - $caption_type = null; - $caption_lang = null; - $caption_startTime = null; - $caption_endTime = null; - $caption_text = null; - if (isset($caption['attribs']['']['type'])) - { - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['lang'])) + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) { - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['start'])) - { - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['end'])) - { - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); + $caption_type = null; + $caption_lang = null; + $caption_startTime = null; + $caption_endTime = null; + $caption_text = null; + if (isset($caption['attribs']['']['type'])) + { + $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['lang'])) + { + $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['start'])) + { + $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['end'])) + { + $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['data'])) + { + $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); } - if (isset($caption['data'])) + if (is_array($captions)) { - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $captions = array_values(SimplePie_Misc::array_unique($captions)); } - $captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); } - if (is_array($captions)) + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) { - $captions = array_values(SimplePie_Misc::array_unique($captions)); - } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) - { - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) - { - $caption_type = null; - $caption_lang = null; - $caption_startTime = null; - $caption_endTime = null; - $caption_text = null; - if (isset($caption['attribs']['']['type'])) - { - $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['lang'])) - { - $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['start'])) + foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) { - $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($caption['attribs']['']['end'])) - { - $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); + $caption_type = null; + $caption_lang = null; + $caption_startTime = null; + $caption_endTime = null; + $caption_text = null; + if (isset($caption['attribs']['']['type'])) + { + $caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['lang'])) + { + $caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['start'])) + { + $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['attribs']['']['end'])) + { + $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($caption['data'])) + { + $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); } - if (isset($caption['data'])) + if (is_array($captions)) { - $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $captions = array_values(SimplePie_Misc::array_unique($captions)); } - $captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); } - if (is_array($captions)) + else { - $captions = array_values(SimplePie_Misc::array_unique($captions)); + $captions = $captions_parent; } - } - else - { - $captions = $captions_parent; - } - // CATEGORIES - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) - { - foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) + // CATEGORIES + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) { - $term = null; - $scheme = null; - $label = null; - if (isset($category['data'])) - { - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($category['attribs']['']['scheme'])) + foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) { - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $scheme = 'http://search.yahoo.com/mrss/category_schema'; - } - if (isset($category['attribs']['']['label'])) - { - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); + $term = null; + $scheme = null; + $label = null; + if (isset($category['data'])) + { + $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($category['attribs']['']['scheme'])) + { + $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $scheme = 'http://search.yahoo.com/mrss/category_schema'; + } + if (isset($category['attribs']['']['label'])) + { + $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $categories[] = new $this->feed->category_class($term, $scheme, $label); } - $categories[] =& new $this->feed->category_class($term, $scheme, $label); } - } - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) - { - foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) + if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'])) { - $term = null; - $scheme = null; - $label = null; - if (isset($category['data'])) - { - $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($category['attribs']['']['scheme'])) + foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category) { - $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $scheme = 'http://search.yahoo.com/mrss/category_schema'; - } - if (isset($category['attribs']['']['label'])) - { - $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); + $term = null; + $scheme = null; + $label = null; + if (isset($category['data'])) + { + $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($category['attribs']['']['scheme'])) + { + $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $scheme = 'http://search.yahoo.com/mrss/category_schema'; + } + if (isset($category['attribs']['']['label'])) + { + $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $categories[] = new $this->feed->category_class($term, $scheme, $label); } - $categories[] =& new $this->feed->category_class($term, $scheme, $label); - } - } - if (is_array($categories) && is_array($categories_parent)) - { - $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent))); - } - elseif (is_array($categories)) - { - $categories = array_values(SimplePie_Misc::array_unique($categories)); - } - elseif (is_array($categories_parent)) - { - $categories = array_values(SimplePie_Misc::array_unique($categories_parent)); - } - - // COPYRIGHTS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) - { - $copyright_url = null; - $copyright_label = null; - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) - { - $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); } - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) + if (is_array($categories) && is_array($categories_parent)) { - $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent))); } - $copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label); - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) - { - $copyright_url = null; - $copyright_label = null; - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) + elseif (is_array($categories)) { - $copyright_url = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); + $categories = array_values(SimplePie_Misc::array_unique($categories)); } - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) + elseif (is_array($categories_parent)) { - $copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $categories = array_values(SimplePie_Misc::array_unique($categories_parent)); } - $copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label); - } - else - { - $copyrights = $copyrights_parent; - } - // CREDITS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) + // COPYRIGHTS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) { - $credit_role = null; - $credit_scheme = null; - $credit_name = null; - if (isset($credit['attribs']['']['role'])) + $copyright_url = null; + $copyright_label = null; + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) { - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); + $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); } - if (isset($credit['attribs']['']['scheme'])) + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) { - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - else + $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label); + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) + { + $copyright_url = null; + $copyright_label = null; + if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'])) { - $credit_scheme = 'urn:ebu'; + $copyright_url = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT); } - if (isset($credit['data'])) + if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'])) { - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); + $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label); } - if (is_array($credits)) + else { - $credits = array_values(SimplePie_Misc::array_unique($credits)); + $copyrights = $copyrights_parent; } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) - { - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) + + // CREDITS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) { - $credit_role = null; - $credit_scheme = null; - $credit_name = null; - if (isset($credit['attribs']['']['role'])) + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) { - $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); + $credit_role = null; + $credit_scheme = null; + $credit_name = null; + if (isset($credit['attribs']['']['role'])) + { + $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($credit['attribs']['']['scheme'])) + { + $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $credit_scheme = 'urn:ebu'; + } + if (isset($credit['data'])) + { + $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); } - if (isset($credit['attribs']['']['scheme'])) + if (is_array($credits)) { - $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + $credits = array_values(SimplePie_Misc::array_unique($credits)); } - else + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) + { + foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) { - $credit_scheme = 'urn:ebu'; + $credit_role = null; + $credit_scheme = null; + $credit_name = null; + if (isset($credit['attribs']['']['role'])) + { + $credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($credit['attribs']['']['scheme'])) + { + $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $credit_scheme = 'urn:ebu'; + } + if (isset($credit['data'])) + { + $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); } - if (isset($credit['data'])) + if (is_array($credits)) { - $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $credits = array_values(SimplePie_Misc::array_unique($credits)); } - $credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); } - if (is_array($credits)) + else { - $credits = array_values(SimplePie_Misc::array_unique($credits)); + $credits = $credits_parent; } - } - else - { - $credits = $credits_parent; - } - - // DESCRIPTION - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) - { - $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) - { - $description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $description = $description_parent; - } - // HASHES - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) + // DESCRIPTION + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) { - $value = null; - $algo = null; - if (isset($hash['data'])) - { - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($hash['attribs']['']['algo'])) - { - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $algo = 'md5'; - } - $hashes[] = $algo.':'.$value; + $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - if (is_array($hashes)) + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) { - $hashes = array_values(SimplePie_Misc::array_unique($hashes)); + $description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) - { - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) + else { - $value = null; - $algo = null; - if (isset($hash['data'])) - { - $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - if (isset($hash['attribs']['']['algo'])) + $description = $description_parent; + } + + // HASHES + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) { - $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); + $value = null; + $algo = null; + if (isset($hash['data'])) + { + $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($hash['attribs']['']['algo'])) + { + $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $algo = 'md5'; + } + $hashes[] = $algo.':'.$value; } - else + if (is_array($hashes)) { - $algo = 'md5'; + $hashes = array_values(SimplePie_Misc::array_unique($hashes)); } - $hashes[] = $algo.':'.$value; - } - if (is_array($hashes)) - { - $hashes = array_values(SimplePie_Misc::array_unique($hashes)); } - } - else - { - $hashes = $hashes_parent; - } - - // KEYWORDS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) - { - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) { - $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); - foreach ($temp as $word) + foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) { - $keywords[] = trim($word); + $value = null; + $algo = null; + if (isset($hash['data'])) + { + $value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($hash['attribs']['']['algo'])) + { + $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $algo = 'md5'; + } + $hashes[] = $algo.':'.$value; } - unset($temp); - } - if (is_array($keywords)) - { - $keywords = array_values(SimplePie_Misc::array_unique($keywords)); - } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) - { - if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) - { - $temp = explode(',', $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); - foreach ($temp as $word) + if (is_array($hashes)) { - $keywords[] = trim($word); + $hashes = array_values(SimplePie_Misc::array_unique($hashes)); } - unset($temp); } - if (is_array($keywords)) + else { - $keywords = array_values(SimplePie_Misc::array_unique($keywords)); - } - } - else - { - $keywords = $keywords_parent; - } - - // PLAYER - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) - { - $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) - { - $player = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - else - { - $player = $player_parent; - } - - // RATINGS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) + $hashes = $hashes_parent; + } + + // KEYWORDS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) { - $rating_scheme = null; - $rating_value = null; - if (isset($rating['attribs']['']['scheme'])) + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) { - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); + foreach ($temp as $word) + { + $keywords[] = trim($word); + } + unset($temp); } - else + if (is_array($keywords)) { - $rating_scheme = 'urn:simple'; + $keywords = array_values(SimplePie_Misc::array_unique($keywords)); } - if (isset($rating['data'])) + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) + { + if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) { - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $temp = explode(',', $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)); + foreach ($temp as $word) + { + $keywords[] = trim($word); + } + unset($temp); + } + if (is_array($keywords)) + { + $keywords = array_values(SimplePie_Misc::array_unique($keywords)); } - $ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value); } - if (is_array($ratings)) + else { - $ratings = array_values(SimplePie_Misc::array_unique($ratings)); + $keywords = $keywords_parent; } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) - { - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) + + // PLAYER + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) { - $rating_scheme = null; - $rating_value = null; - if (isset($rating['attribs']['']['scheme'])) + $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) + { + $player = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } + else + { + $player = $player_parent; + } + + // RATINGS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) + { + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) { - $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + $rating_scheme = null; + $rating_value = null; + if (isset($rating['attribs']['']['scheme'])) + { + $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $rating_scheme = 'urn:simple'; + } + if (isset($rating['data'])) + { + $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value); } - else + if (is_array($ratings)) { - $rating_scheme = 'urn:simple'; + $ratings = array_values(SimplePie_Misc::array_unique($ratings)); } - if (isset($rating['data'])) + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) + { + foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) { - $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $rating_scheme = null; + $rating_value = null; + if (isset($rating['attribs']['']['scheme'])) + { + $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); + } + else + { + $rating_scheme = 'urn:simple'; + } + if (isset($rating['data'])) + { + $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value); + } + if (is_array($ratings)) + { + $ratings = array_values(SimplePie_Misc::array_unique($ratings)); } - $ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value); } - if (is_array($ratings)) + else { - $ratings = array_values(SimplePie_Misc::array_unique($ratings)); + $ratings = $ratings_parent; } - } - else - { - $ratings = $ratings_parent; - } - // RESTRICTIONS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) + // RESTRICTIONS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) { - $restriction_relationship = null; - $restriction_type = null; - $restriction_value = null; - if (isset($restriction['attribs']['']['relationship'])) + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) { - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); + $restriction_relationship = null; + $restriction_type = null; + $restriction_value = null; + if (isset($restriction['attribs']['']['relationship'])) + { + $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['attribs']['']['type'])) + { + $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['data'])) + { + $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); } - if (isset($restriction['attribs']['']['type'])) + if (is_array($restrictions)) { - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + $restrictions = array_values(SimplePie_Misc::array_unique($restrictions)); } - if (isset($restriction['data'])) + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) + { + foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) { - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $restriction_relationship = null; + $restriction_type = null; + $restriction_value = null; + if (isset($restriction['attribs']['']['relationship'])) + { + $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['attribs']['']['type'])) + { + $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + } + if (isset($restriction['data'])) + { + $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); + } + $restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); + } + if (is_array($restrictions)) + { + $restrictions = array_values(SimplePie_Misc::array_unique($restrictions)); } - $restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); } - if (is_array($restrictions)) + else { - $restrictions = array_values(SimplePie_Misc::array_unique($restrictions)); + $restrictions = $restrictions_parent; } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) - { - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) + + // THUMBNAILS + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) { - $restriction_relationship = null; - $restriction_type = null; - $restriction_value = null; - if (isset($restriction['attribs']['']['relationship'])) + foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) { - $restriction_relationship = $this->sanitize($restriction['attribs']['']['relationship'], SIMPLEPIE_CONSTRUCT_TEXT); + $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); } - if (isset($restriction['attribs']['']['type'])) + if (is_array($thumbnails)) { - $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT); + $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails)); } - if (isset($restriction['data'])) + } + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) + { + foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) { - $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); + $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + } + if (is_array($thumbnails)) + { + $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails)); } - $restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); } - if (is_array($restrictions)) + else { - $restrictions = array_values(SimplePie_Misc::array_unique($restrictions)); + $thumbnails = $thumbnails_parent; } - } - else - { - $restrictions = $restrictions_parent; - } - // THUMBNAILS - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) - { - foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) - { - $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); - } - if (is_array($thumbnails)) + // TITLES + if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) { - $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails)); + $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) - { - foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) + elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) { - $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); + $title = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - if (is_array($thumbnails)) + else { - $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails)); + $title = $title_parent; } - } - else - { - $thumbnails = $thumbnails_parent; - } - // TITLES - if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) - { - $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) - { - $title = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); - } - else - { - $title = $title_parent; + $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); } - - $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); } } } @@ -5170,7 +4920,7 @@ class SimplePie_Item { $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); + $captions[] = new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text); } if (is_array($captions)) { @@ -5206,7 +4956,7 @@ class SimplePie_Item { $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); } - $categories[] =& new $this->feed->category_class($term, $scheme, $label); + $categories[] = new $this->feed->category_class($term, $scheme, $label); } } if (is_array($categories) && is_array($categories_parent)) @@ -5239,7 +4989,7 @@ class SimplePie_Item { $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $copyrights =& new $this->feed->copyright_class($copyright_url, $copyright_label); + $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label); } else { @@ -5270,7 +5020,7 @@ class SimplePie_Item { $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $credits[] =& new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); + $credits[] = new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name); } if (is_array($credits)) { @@ -5374,7 +5124,7 @@ class SimplePie_Item { $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $ratings[] =& new $this->feed->rating_class($rating_scheme, $rating_value); + $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value); } if (is_array($ratings)) { @@ -5406,7 +5156,7 @@ class SimplePie_Item { $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT); } - $restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); + $restrictions[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value); } if (is_array($restrictions)) { @@ -5445,7 +5195,7 @@ class SimplePie_Item $title = $title_parent; } - $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); + $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); } } } @@ -5481,7 +5231,7 @@ class SimplePie_Item } // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor - $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); + $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); } } @@ -5516,7 +5266,7 @@ class SimplePie_Item } // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor - $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); + $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); } } @@ -5551,14 +5301,14 @@ class SimplePie_Item } // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor - $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); + $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); } } 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)) { // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor - $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); + $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); } $this->data['enclosures'] = array_values(SimplePie_Misc::array_unique($this->data['enclosures'])); @@ -5573,13 +5323,13 @@ class SimplePie_Item } } - function get_latitude() + public function get_latitude() { if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) { return (float) $return[0]['data']; } - elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) + elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) { return (float) $match[1]; } @@ -5589,7 +5339,7 @@ class SimplePie_Item } } - function get_longitude() + public function get_longitude() { if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) { @@ -5599,7 +5349,7 @@ class SimplePie_Item { return (float) $return[0]['data']; } - elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) + elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) { return (float) $match[2]; } @@ -5609,7 +5359,7 @@ class SimplePie_Item } } - function get_source() + public function get_source() { if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source')) { @@ -5620,106 +5370,6 @@ class SimplePie_Item return null; } } - - /** - * Creates the add_to_* methods' return data - * - * @access private - * @param string $item_url String to prefix to the item permalink - * @param string $title_url String to prefix to the item title - * (and suffix to the item permalink) - * @return mixed URL if feed exists, false otherwise - */ - function add_to_service($item_url, $title_url = null, $summary_url = null) - { - if ($this->get_permalink() !== null) - { - $return = $item_url . rawurlencode($this->get_permalink()); - if ($title_url !== null && $this->get_title() !== null) - { - $return .= $title_url . rawurlencode($this->get_title()); - } - if ($summary_url !== null && $this->get_description() !== null) - { - $return .= $summary_url . rawurlencode($this->get_description()); - } - return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI); - } - else - { - return null; - } - } - - function add_to_blinklist() - { - return $this->add_to_service('http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url=', '&Title='); - } - - function add_to_blogmarks() - { - return $this->add_to_service('http://blogmarks.net/my/new.php?mini=1&simple=1&url=', '&title='); - } - - function add_to_delicious() - { - return $this->add_to_service('http://del.icio.us/post/?v=4&url=', '&title='); - } - - function add_to_digg() - { - return $this->add_to_service('http://digg.com/submit?url=', '&title=', '&bodytext='); - } - - function add_to_furl() - { - return $this->add_to_service('http://www.furl.net/storeIt.jsp?u=', '&t='); - } - - function add_to_magnolia() - { - return $this->add_to_service('http://ma.gnolia.com/bookmarklet/add?url=', '&title='); - } - - function add_to_myweb20() - { - return $this->add_to_service('http://myweb2.search.yahoo.com/myresults/bookmarklet?u=', '&t='); - } - - function add_to_newsvine() - { - return $this->add_to_service('http://www.newsvine.com/_wine/save?u=', '&h='); - } - - function add_to_reddit() - { - return $this->add_to_service('http://reddit.com/submit?url=', '&title='); - } - - function add_to_segnalo() - { - return $this->add_to_service('http://segnalo.com/post.html.php?url=', '&title='); - } - - function add_to_simpy() - { - return $this->add_to_service('http://www.simpy.com/simpy/LinkAdd.do?href=', '&title='); - } - - function add_to_spurl() - { - return $this->add_to_service('http://www.spurl.net/spurl.php?v=3&url=', '&title='); - } - - function add_to_wists() - { - return $this->add_to_service('http://wists.com/r.php?c=&r=', '&title='); - } - - function search_technorati() - { - return $this->add_to_service('http://www.technorati.com/search/'); - } } class SimplePie_Source @@ -5727,18 +5377,18 @@ class SimplePie_Source var $item; var $data = array(); - function SimplePie_Source($item, $data) + public function __construct($item, $data) { $this->item = $item; $this->data = $data; } - function __toString() + public function __toString() { return md5(serialize($this->data)); } - function get_source_tags($namespace, $tag) + public function get_source_tags($namespace, $tag) { if (isset($this->data['child'][$namespace][$tag])) { @@ -5750,22 +5400,22 @@ class SimplePie_Source } } - function get_base($element = array()) + public function get_base($element = array()) { return $this->item->get_base($element); } - function sanitize($data, $type, $base = '') + public function sanitize($data, $type, $base = '') { return $this->item->sanitize($data, $type, $base); } - function get_item() + public function get_item() { return $this->item; } - function get_title() + public function get_title() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) { @@ -5801,7 +5451,7 @@ class SimplePie_Source } } - function get_category($key = 0) + public function get_category($key = 0) { $categories = $this->get_categories(); if (isset($categories[$key])) @@ -5814,7 +5464,7 @@ class SimplePie_Source } } - function get_categories() + public function get_categories() { $categories = array(); @@ -5835,7 +5485,7 @@ class SimplePie_Source { $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); } - $categories[] =& new $this->item->feed->category_class($term, $scheme, $label); + $categories[] = new $this->item->feed->category_class($term, $scheme, $label); } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) { @@ -5850,15 +5500,15 @@ class SimplePie_Source { $scheme = null; } - $categories[] =& new $this->item->feed->category_class($term, $scheme, null); + $categories[] = new $this->item->feed->category_class($term, $scheme, null); } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) { - $categories[] =& new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) { - $categories[] =& new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } if (!empty($categories)) @@ -5871,7 +5521,7 @@ class SimplePie_Source } } - function get_author($key = 0) + public function get_author($key = 0) { $authors = $this->get_authors(); if (isset($authors[$key])) @@ -5884,7 +5534,7 @@ class SimplePie_Source } } - function get_authors() + public function get_authors() { $authors = array(); foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author) @@ -5906,7 +5556,7 @@ class SimplePie_Source } if ($name !== null || $email !== null || $uri !== null) { - $authors[] =& new $this->item->feed->author_class($name, $uri, $email); + $authors[] = new $this->item->feed->author_class($name, $uri, $email); } } if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author')) @@ -5928,20 +5578,20 @@ class SimplePie_Source } if ($name !== null || $email !== null || $url !== null) { - $authors[] =& new $this->item->feed->author_class($name, $url, $email); + $authors[] = new $this->item->feed->author_class($name, $url, $email); } } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author) { - $authors[] =& new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author) { - $authors[] =& new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author) { - $authors[] =& new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); + $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null); } if (!empty($authors)) @@ -5954,7 +5604,7 @@ class SimplePie_Source } } - function get_contributor($key = 0) + public function get_contributor($key = 0) { $contributors = $this->get_contributors(); if (isset($contributors[$key])) @@ -5967,7 +5617,7 @@ class SimplePie_Source } } - function get_contributors() + public function get_contributors() { $contributors = array(); foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor) @@ -5989,7 +5639,7 @@ class SimplePie_Source } if ($name !== null || $email !== null || $uri !== null) { - $contributors[] =& new $this->item->feed->author_class($name, $uri, $email); + $contributors[] = new $this->item->feed->author_class($name, $uri, $email); } } foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor) @@ -6011,7 +5661,7 @@ class SimplePie_Source } if ($name !== null || $email !== null || $url !== null) { - $contributors[] =& new $this->item->feed->author_class($name, $url, $email); + $contributors[] = new $this->item->feed->author_class($name, $url, $email); } } @@ -6025,7 +5675,7 @@ class SimplePie_Source } } - function get_link($key = 0, $rel = 'alternate') + public function get_link($key = 0, $rel = 'alternate') { $links = $this->get_links($rel); if (isset($links[$key])) @@ -6041,12 +5691,12 @@ class SimplePie_Source /** * Added for parity between the parent-level and the item/entry-level. */ - function get_permalink() + public function get_permalink() { return $this->get_link(0); } - function get_links($rel = 'alternate') + public function get_links($rel = 'alternate') { if (!isset($this->data['links'])) { @@ -6120,7 +5770,7 @@ class SimplePie_Source } } - function get_description() + public function get_description() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle')) { @@ -6164,7 +5814,7 @@ class SimplePie_Source } } - function get_copyright() + public function get_copyright() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) { @@ -6192,7 +5842,7 @@ class SimplePie_Source } } - function get_language() + public function get_language() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language')) { @@ -6216,13 +5866,13 @@ class SimplePie_Source } } - function get_latitude() + public function get_latitude() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) { return (float) $return[0]['data']; } - elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) + elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) { return (float) $match[1]; } @@ -6232,7 +5882,7 @@ class SimplePie_Source } } - function get_longitude() + public function get_longitude() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) { @@ -6242,7 +5892,7 @@ class SimplePie_Source { return (float) $return[0]['data']; } - elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', $return[0]['data'], $match)) + elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) { return (float) $match[2]; } @@ -6252,7 +5902,7 @@ class SimplePie_Source } } - function get_image_url() + public function get_image_url() { if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image')) { @@ -6280,20 +5930,20 @@ class SimplePie_Author var $email; // Constructor, used to input the data - function SimplePie_Author($name = null, $link = null, $email = null) + public function __construct($name = null, $link = null, $email = null) { $this->name = $name; $this->link = $link; $this->email = $email; } - function __toString() + public function __toString() { // There is no $this->data here return md5(serialize($this)); } - function get_name() + public function get_name() { if ($this->name !== null) { @@ -6305,7 +5955,7 @@ class SimplePie_Author } } - function get_link() + public function get_link() { if ($this->link !== null) { @@ -6317,7 +5967,7 @@ class SimplePie_Author } } - function get_email() + public function get_email() { if ($this->email !== null) { @@ -6337,20 +5987,20 @@ class SimplePie_Category var $label; // Constructor, used to input the data - function SimplePie_Category($term = null, $scheme = null, $label = null) + public function __construct($term = null, $scheme = null, $label = null) { $this->term = $term; $this->scheme = $scheme; $this->label = $label; } - function __toString() + public function __toString() { // There is no $this->data here return md5(serialize($this)); } - function get_term() + public function get_term() { if ($this->term !== null) { @@ -6362,7 +6012,7 @@ class SimplePie_Category } } - function get_scheme() + public function get_scheme() { if ($this->scheme !== null) { @@ -6374,7 +6024,7 @@ class SimplePie_Category } } - function get_label() + public function get_label() { if ($this->label !== null) { @@ -6418,7 +6068,7 @@ class SimplePie_Enclosure var $width; // Constructor, used to input the data - 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) + public function __construct($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) { $this->bitrate = $bitrate; $this->captions = $captions; @@ -6446,22 +6096,23 @@ class SimplePie_Enclosure $this->title = $title; $this->type = $type; $this->width = $width; + if (class_exists('idna_convert')) { - $idn =& new idna_convert; + $idn = new idna_convert(); $parsed = SimplePie_Misc::parse_url($link); $this->link = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']); } $this->handler = $this->get_handler(); // Needs to load last } - function __toString() + public function __toString() { // There is no $this->data here return md5(serialize($this)); } - function get_bitrate() + public function get_bitrate() { if ($this->bitrate !== null) { @@ -6473,7 +6124,7 @@ class SimplePie_Enclosure } } - function get_caption($key = 0) + public function get_caption($key = 0) { $captions = $this->get_captions(); if (isset($captions[$key])) @@ -6486,7 +6137,7 @@ class SimplePie_Enclosure } } - function get_captions() + public function get_captions() { if ($this->captions !== null) { @@ -6498,7 +6149,7 @@ class SimplePie_Enclosure } } - function get_category($key = 0) + public function get_category($key = 0) { $categories = $this->get_categories(); if (isset($categories[$key])) @@ -6511,7 +6162,7 @@ class SimplePie_Enclosure } } - function get_categories() + public function get_categories() { if ($this->categories !== null) { @@ -6523,7 +6174,7 @@ class SimplePie_Enclosure } } - function get_channels() + public function get_channels() { if ($this->channels !== null) { @@ -6535,7 +6186,7 @@ class SimplePie_Enclosure } } - function get_copyright() + public function get_copyright() { if ($this->copyright !== null) { @@ -6547,7 +6198,7 @@ class SimplePie_Enclosure } } - function get_credit($key = 0) + public function get_credit($key = 0) { $credits = $this->get_credits(); if (isset($credits[$key])) @@ -6560,7 +6211,7 @@ class SimplePie_Enclosure } } - function get_credits() + public function get_credits() { if ($this->credits !== null) { @@ -6572,7 +6223,7 @@ class SimplePie_Enclosure } } - function get_description() + public function get_description() { if ($this->description !== null) { @@ -6584,7 +6235,7 @@ class SimplePie_Enclosure } } - function get_duration($convert = false) + public function get_duration($convert = false) { if ($this->duration !== null) { @@ -6604,7 +6255,7 @@ class SimplePie_Enclosure } } - function get_expression() + public function get_expression() { if ($this->expression !== null) { @@ -6616,7 +6267,7 @@ class SimplePie_Enclosure } } - function get_extension() + public function get_extension() { if ($this->link !== null) { @@ -6629,7 +6280,7 @@ class SimplePie_Enclosure return null; } - function get_framerate() + public function get_framerate() { if ($this->framerate !== null) { @@ -6641,12 +6292,12 @@ class SimplePie_Enclosure } } - function get_handler() + public function get_handler() { return $this->get_real_type(true); } - function get_hash($key = 0) + public function get_hash($key = 0) { $hashes = $this->get_hashes(); if (isset($hashes[$key])) @@ -6659,7 +6310,7 @@ class SimplePie_Enclosure } } - function get_hashes() + public function get_hashes() { if ($this->hashes !== null) { @@ -6671,7 +6322,7 @@ class SimplePie_Enclosure } } - function get_height() + public function get_height() { if ($this->height !== null) { @@ -6683,7 +6334,7 @@ class SimplePie_Enclosure } } - function get_language() + public function get_language() { if ($this->lang !== null) { @@ -6695,7 +6346,7 @@ class SimplePie_Enclosure } } - function get_keyword($key = 0) + public function get_keyword($key = 0) { $keywords = $this->get_keywords(); if (isset($keywords[$key])) @@ -6708,7 +6359,7 @@ class SimplePie_Enclosure } } - function get_keywords() + public function get_keywords() { if ($this->keywords !== null) { @@ -6720,7 +6371,7 @@ class SimplePie_Enclosure } } - function get_length() + public function get_length() { if ($this->length !== null) { @@ -6732,7 +6383,7 @@ class SimplePie_Enclosure } } - function get_link() + public function get_link() { if ($this->link !== null) { @@ -6744,7 +6395,7 @@ class SimplePie_Enclosure } } - function get_medium() + public function get_medium() { if ($this->medium !== null) { @@ -6756,7 +6407,7 @@ class SimplePie_Enclosure } } - function get_player() + public function get_player() { if ($this->player !== null) { @@ -6768,7 +6419,7 @@ class SimplePie_Enclosure } } - function get_rating($key = 0) + public function get_rating($key = 0) { $ratings = $this->get_ratings(); if (isset($ratings[$key])) @@ -6781,7 +6432,7 @@ class SimplePie_Enclosure } } - function get_ratings() + public function get_ratings() { if ($this->ratings !== null) { @@ -6793,7 +6444,7 @@ class SimplePie_Enclosure } } - function get_restriction($key = 0) + public function get_restriction($key = 0) { $restrictions = $this->get_restrictions(); if (isset($restrictions[$key])) @@ -6806,7 +6457,7 @@ class SimplePie_Enclosure } } - function get_restrictions() + public function get_restrictions() { if ($this->restrictions !== null) { @@ -6818,7 +6469,7 @@ class SimplePie_Enclosure } } - function get_sampling_rate() + public function get_sampling_rate() { if ($this->samplingrate !== null) { @@ -6830,7 +6481,7 @@ class SimplePie_Enclosure } } - function get_size() + public function get_size() { $length = $this->get_length(); if ($length !== null) @@ -6843,7 +6494,7 @@ class SimplePie_Enclosure } } - function get_thumbnail($key = 0) + public function get_thumbnail($key = 0) { $thumbnails = $this->get_thumbnails(); if (isset($thumbnails[$key])) @@ -6856,7 +6507,7 @@ class SimplePie_Enclosure } } - function get_thumbnails() + public function get_thumbnails() { if ($this->thumbnails !== null) { @@ -6868,7 +6519,7 @@ class SimplePie_Enclosure } } - function get_title() + public function get_title() { if ($this->title !== null) { @@ -6880,7 +6531,7 @@ class SimplePie_Enclosure } } - function get_type() + public function get_type() { if ($this->type !== null) { @@ -6892,7 +6543,7 @@ class SimplePie_Enclosure } } - function get_width() + public function get_width() { if ($this->width !== null) { @@ -6904,7 +6555,7 @@ class SimplePie_Enclosure } } - function native_embed($options='') + public function native_embed($options='') { return $this->embed($options, true); } @@ -6912,7 +6563,7 @@ class SimplePie_Enclosure /** * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'. */ - function embed($options = '', $native = false) + public function embed($options = '', $native = false) { // Set up defaults $audio = ''; @@ -7160,7 +6811,7 @@ class SimplePie_Enclosure return $embed; } - function get_real_type($find_handler = false) + public function get_real_type($find_handler = false) { // If it's Odeo, let's get it out of the way. if (substr(strtolower($this->get_link()), 0, 15) === 'http://odeo.com') @@ -7351,7 +7002,7 @@ class SimplePie_Caption var $text; // Constructor, used to input the data - function SimplePie_Caption($type = null, $lang = null, $startTime = null, $endTime = null, $text = null) + public function __construct($type = null, $lang = null, $startTime = null, $endTime = null, $text = null) { $this->type = $type; $this->lang = $lang; @@ -7360,13 +7011,13 @@ class SimplePie_Caption $this->text = $text; } - function __toString() + public function __toString() { // There is no $this->data here return md5(serialize($this)); } - function get_endtime() + public function get_endtime() { if ($this->endTime !== null) { @@ -7378,7 +7029,7 @@ class SimplePie_Caption } } - function get_language() + public function get_language() { if ($this->lang !== null) { @@ -7390,7 +7041,7 @@ class SimplePie_Caption } } - function get_starttime() + public function get_starttime() { if ($this->startTime !== null) { @@ -7402,7 +7053,7 @@ class SimplePie_Caption } } - function get_text() + public function get_text() { if ($this->text !== null) { @@ -7414,7 +7065,7 @@ class SimplePie_Caption } } - function get_type() + public function get_type() { if ($this->type !== null) { @@ -7434,20 +7085,20 @@ class SimplePie_Credit var $name; // Constructor, used to input the data - function SimplePie_Credit($role = null, $scheme = null, $name = null) + public function __construct($role = null, $scheme = null, $name = null) { $this->role = $role; $this->scheme = $scheme; $this->name = $name; } - function __toString() + public function __toString() { // There is no $this->data here return md5(serialize($this)); } - function get_role() + public function get_role() { if ($this->role !== null) { @@ -7459,7 +7110,7 @@ class SimplePie_Credit } } - function get_scheme() + public function get_scheme() { if ($this->scheme !== null) { @@ -7471,7 +7122,7 @@ class SimplePie_Credit } } - function get_name() + public function get_name() { if ($this->name !== null) { @@ -7490,19 +7141,19 @@ class SimplePie_Copyright var $label; // Constructor, used to input the data - function SimplePie_Copyright($url = null, $label = null) + public function __construct($url = null, $label = null) { $this->url = $url; $this->label = $label; } - function __toString() + public function __toString() { // There is no $this->data here return md5(serialize($this)); } - function get_url() + public function get_url() { if ($this->url !== null) { @@ -7514,7 +7165,7 @@ class SimplePie_Copyright } } - function get_attribution() + public function get_attribution() { if ($this->label !== null) { @@ -7533,19 +7184,19 @@ class SimplePie_Rating var $value; // Constructor, used to input the data - function SimplePie_Rating($scheme = null, $value = null) + public function __construct($scheme = null, $value = null) { $this->scheme = $scheme; $this->value = $value; } - function __toString() + public function __toString() { // There is no $this->data here return md5(serialize($this)); } - function get_scheme() + public function get_scheme() { if ($this->scheme !== null) { @@ -7557,7 +7208,7 @@ class SimplePie_Rating } } - function get_value() + public function get_value() { if ($this->value !== null) { @@ -7577,20 +7228,20 @@ class SimplePie_Restriction var $value; // Constructor, used to input the data - function SimplePie_Restriction($relationship = null, $type = null, $value = null) + public function __construct($relationship = null, $type = null, $value = null) { $this->relationship = $relationship; $this->type = $type; $this->value = $value; } - function __toString() + public function __toString() { // There is no $this->data here return md5(serialize($this)); } - function get_relationship() + public function get_relationship() { if ($this->relationship !== null) { @@ -7602,7 +7253,7 @@ class SimplePie_Restriction } } - function get_type() + public function get_type() { if ($this->type !== null) { @@ -7614,7 +7265,7 @@ class SimplePie_Restriction } } - function get_value() + public function get_value() { if ($this->value !== null) { @@ -7642,11 +7293,11 @@ class SimplePie_File var $error; var $method = SIMPLEPIE_FILE_SOURCE_NONE; - function SimplePie_File($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) + public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) { if (class_exists('idna_convert')) { - $idn =& new idna_convert; + $idn = new idna_convert(); $parsed = SimplePie_Misc::parse_url($url); $url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']); } @@ -7707,7 +7358,7 @@ class SimplePie_File curl_close($fp); $this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1); $this->headers = array_pop($this->headers); - $parser =& new SimplePie_HTTP_Parser($this->headers); + $parser = new SimplePie_HTTP_Parser($this->headers); if ($parser->parse()) { $this->headers = $parser->headers; @@ -7788,7 +7439,7 @@ class SimplePie_File } if (!$info['timed_out']) { - $parser =& new SimplePie_HTTP_Parser($this->headers); + $parser = new SimplePie_HTTP_Parser($this->headers); if ($parser->parse()) { $this->headers = $parser->headers; @@ -7807,7 +7458,7 @@ class SimplePie_File { case 'gzip': case 'x-gzip': - $decoder =& new SimplePie_gzdecode($this->body); + $decoder = new SimplePie_gzdecode($this->body); if (!$decoder->parse()) { $this->error = 'Unable to decode HTTP "gzip" stream'; @@ -7960,7 +7611,7 @@ class SimplePie_HTTP_Parser * @access public * @param string $data Input data */ - function SimplePie_HTTP_Parser($data) + public function __construct($data) { $this->data = $data; $this->data_length = strlen($this->data); @@ -7972,7 +7623,7 @@ class SimplePie_HTTP_Parser * @access public * @return bool true on success, false on failure */ - function parse() + public function parse() { while ($this->state && $this->state !== 'emit' && $this->has_data()) { @@ -8001,7 +7652,7 @@ class SimplePie_HTTP_Parser * @access private * @return bool true if there is further data, false if not */ - function has_data() + public function has_data() { return (bool) ($this->position < $this->data_length); } @@ -8012,7 +7663,7 @@ class SimplePie_HTTP_Parser * @access private * @return bool true if the next character is LWS, false if not */ - function is_linear_whitespace() + public function is_linear_whitespace() { return (bool) ($this->data[$this->position] === "\x09" || $this->data[$this->position] === "\x20" @@ -8026,7 +7677,7 @@ class SimplePie_HTTP_Parser * * @access private */ - function http_version() + public function http_version() { if (strpos($this->data, "\x0A") !== false && strtoupper(substr($this->data, 0, 5)) === 'HTTP/') { @@ -8055,7 +7706,7 @@ class SimplePie_HTTP_Parser * * @access private */ - function status() + public function status() { if ($len = strspn($this->data, '0123456789', $this->position)) { @@ -8074,7 +7725,7 @@ class SimplePie_HTTP_Parser * * @access private */ - function reason() + public function reason() { $len = strcspn($this->data, "\x0A", $this->position); $this->reason = trim(substr($this->data, $this->position, $len), "\x09\x0D\x20"); @@ -8087,7 +7738,7 @@ class SimplePie_HTTP_Parser * * @access private */ - function new_line() + public function new_line() { $this->value = trim($this->value, "\x0D\x20"); if ($this->name !== '' && $this->value !== '') @@ -8125,7 +7776,7 @@ class SimplePie_HTTP_Parser * * @access private */ - function name() + public function name() { $len = strcspn($this->data, "\x0A:", $this->position); if (isset($this->data[$this->position + $len])) @@ -8153,7 +7804,7 @@ class SimplePie_HTTP_Parser * * @access private */ - function linear_whitespace() + public function linear_whitespace() { do { @@ -8175,7 +7826,7 @@ class SimplePie_HTTP_Parser * * @access private */ - function value() + public function value() { if ($this->is_linear_whitespace()) { @@ -8207,7 +7858,7 @@ class SimplePie_HTTP_Parser * * @access private */ - function value_char() + public function value_char() { $len = strcspn($this->data, "\x09\x20\x0A\"", $this->position); $this->value .= substr($this->data, $this->position, $len); @@ -8220,7 +7871,7 @@ class SimplePie_HTTP_Parser * * @access private */ - function quote() + public function quote() { if ($this->is_linear_whitespace()) { @@ -8257,7 +7908,7 @@ class SimplePie_HTTP_Parser * * @access private */ - function quote_char() + public function quote_char() { $len = strcspn($this->data, "\x09\x20\x0A\"\\", $this->position); $this->value .= substr($this->data, $this->position, $len); @@ -8270,7 +7921,7 @@ class SimplePie_HTTP_Parser * * @access private */ - function quote_escaped() + public function quote_escaped() { $this->value .= $this->data[$this->position]; $this->position++; @@ -8282,7 +7933,7 @@ class SimplePie_HTTP_Parser * * @access private */ - function body() + public function body() { $this->body = substr($this->data, $this->position); $this->state = 'emit'; @@ -8407,7 +8058,7 @@ class SimplePie_gzdecode * * @access public */ - function __set($name, $value) + public function __set($name, $value) { trigger_error("Cannot write property $name", E_USER_ERROR); } @@ -8417,7 +8068,7 @@ class SimplePie_gzdecode * * @access public */ - function SimplePie_gzdecode($data) + public function __construct($data) { $this->compressed_data = $data; $this->compressed_size = strlen($data); @@ -8428,7 +8079,7 @@ class SimplePie_gzdecode * * @access public */ - function parse() + public function parse() { if ($this->compressed_size >= $this->min_compressed_size) { @@ -8606,7 +8257,7 @@ class SimplePie_Cache * * @access private */ - function SimplePie_Cache() + private function __construct() { trigger_error('Please call SimplePie_Cache::create() instead of the constructor', E_USER_ERROR); } @@ -8617,9 +8268,9 @@ class SimplePie_Cache * @static * @access public */ - function create($location, $filename, $extension) + public static function create($location, $filename, $extension) { - $location_iri =& new SimplePie_IRI($location); + $location_iri = new SimplePie_IRI($location); switch ($location_iri->get_scheme()) { case 'mysql': @@ -8642,7 +8293,7 @@ class SimplePie_Cache_File var $extension; var $name; - function SimplePie_Cache_File($location, $filename, $extension) + public function __construct($location, $filename, $extension) { $this->location = $location; $this->filename = $filename; @@ -8650,7 +8301,7 @@ class SimplePie_Cache_File $this->name = "$this->location/$this->filename.$this->extension"; } - function save($data) + public function save($data) { if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location)) { @@ -8679,7 +8330,7 @@ class SimplePie_Cache_File return false; } - function load() + public function load() { if (file_exists($this->name) && is_readable($this->name)) { @@ -8688,7 +8339,7 @@ class SimplePie_Cache_File return false; } - function mtime() + public function mtime() { if (file_exists($this->name)) { @@ -8697,7 +8348,7 @@ class SimplePie_Cache_File return false; } - function touch() + public function touch() { if (file_exists($this->name)) { @@ -8706,7 +8357,7 @@ class SimplePie_Cache_File return false; } - function unlink() + public function unlink() { if (file_exists($this->name)) { @@ -8718,7 +8369,7 @@ class SimplePie_Cache_File class SimplePie_Cache_DB { - function prepare_simplepie_object_for_cache($data) + public function prepare_simplepie_object_for_cache($data) { $items = $data->get_items(); $items_by_id = array(); @@ -8802,7 +8453,7 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB var $options; var $id; - function SimplePie_Cache_MySQL($mysql_location, $name, $extension) + public function __construct($mysql_location, $name, $extension) { $host = $mysql_location->get_host(); if (SimplePie_Misc::stripos($host, 'unix(') === 0 && substr($host, -1) === ')') @@ -8870,7 +8521,7 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB } } - function save($data) + public function save($data) { if ($this->mysql) { @@ -8967,7 +8618,7 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB return false; } - function load() + public function load() { if ($this->mysql && ($query = mysql_query('SELECT `items`, `data` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query))) { @@ -9031,7 +8682,7 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB return false; } - function mtime() + public function mtime() { if ($this->mysql && ($query = mysql_query('SELECT `mtime` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query))) { @@ -9043,7 +8694,7 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB } } - function touch() + public function touch() { if ($this->mysql && ($query = mysql_query('UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `mtime` = ' . time() . ' WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && mysql_affected_rows($this->mysql)) { @@ -9055,7 +8706,7 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB } } - function unlink() + public function unlink() { if ($this->mysql && ($query = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($query2 = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql))) { @@ -9070,7 +8721,7 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB class SimplePie_Misc { - function time_hms($seconds) + public static function time_hms($seconds) { $time = ''; @@ -9098,13 +8749,13 @@ class SimplePie_Misc return $time; } - function absolutize_url($relative, $base) + public static function absolutize_url($relative, $base) { $iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative); return $iri->get_iri(); } - function remove_dot_segments($input) + public static function remove_dot_segments($input) { $output = ''; while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..') @@ -9158,7 +8809,7 @@ class SimplePie_Misc return $output . $input; } - function get_element($realname, $string) + public static function get_element($realname, $string) { $return = array(); $name = preg_quote($realname, '/'); @@ -9195,7 +8846,7 @@ class SimplePie_Misc return $return; } - function element_implode($element) + public static function element_implode($element) { $full = "<$element[tag]"; foreach ($element['attribs'] as $key => $value) @@ -9214,7 +8865,7 @@ class SimplePie_Misc return $full; } - function error($message, $level, $file, $line) + public static function error($message, $level, $file, $line) { if ((ini_get('error_reporting') & $level) > 0) { @@ -9233,56 +8884,29 @@ class SimplePie_Misc $note = 'Unknown Error'; break; } - error_log("$note: $message in $file on line $line", 0); - } - return $message; - } - /** - * If a file has been cached, retrieve and display it. - * - * This is most useful for caching images (get_favicon(), etc.), - * however it works for all cached files. This WILL NOT display ANY - * file/image/page/whatever, but rather only display what has already - * been cached by SimplePie. - * - * @access public - * @see SimplePie::get_favicon() - * @param str $identifier_url URL that is used to identify the content. - * This may or may not be the actual URL of the live content. - * @param str $cache_location Location of SimplePie's cache. Defaults - * to './cache'. - * @param str $cache_extension The file extension that the file was - * cached with. Defaults to 'spc'. - * @param str $cache_class Name of the cache-handling class being used - * in SimplePie. Defaults to 'SimplePie_Cache', and should be left - * as-is unless you've overloaded the class. - * @param str $cache_name_function Obsolete. Exists for backwards - * compatibility reasons only. - */ - function display_cached_file($identifier_url, $cache_location = './cache', $cache_extension = 'spc', $cache_class = 'SimplePie_Cache', $cache_name_function = 'md5') - { - $cache = call_user_func(array($cache_class, 'create'), $cache_location, $identifier_url, $cache_extension); + $log_error = true; + if (!function_exists('error_log')) + { + $log_error = false; + } - if ($file = $cache->load()) - { - if (isset($file['headers']['content-type'])) + $log_file = @ini_get('error_log'); + if (!empty($log_file) && ('syslog' != $log_file) && !@is_writable($log_file)) { - header('Content-type:' . $file['headers']['content-type']); + $log_error = false; } - else + + if ($log_error) { - header('Content-type: application/octet-stream'); + @error_log("$note: $message in $file on line $line", 0); } - header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days - echo $file['body']; - exit; } - die('Cached file for ' . $identifier_url . ' cannot be found.'); + return $message; } - function fix_protocol($url, $http = 1) + public static function fix_protocol($url, $http = 1) { $url = SimplePie_Misc::normalize_url($url); $parsed = SimplePie_Misc::parse_url($url); @@ -9314,9 +8938,9 @@ class SimplePie_Misc } } - function parse_url($url) + public static function parse_url($url) { - $iri =& new SimplePie_IRI($url); + $iri = new SimplePie_IRI($url); return array( 'scheme' => (string) $iri->get_scheme(), 'authority' => (string) $iri->get_authority(), @@ -9326,9 +8950,9 @@ class SimplePie_Misc ); } - function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '') + public static function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '') { - $iri =& new SimplePie_IRI(''); + $iri = new SimplePie_IRI(''); $iri->set_scheme($scheme); $iri->set_authority($authority); $iri->set_path($path); @@ -9337,13 +8961,13 @@ class SimplePie_Misc return $iri->get_iri(); } - function normalize_url($url) + public static function normalize_url($url) { - $iri =& new SimplePie_IRI($url); + $iri = new SimplePie_IRI($url); return $iri->get_iri(); } - function percent_encoding_normalization($match) + public static function percent_encoding_normalization($match) { $integer = hexdec($match[1]); if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E) @@ -9356,41 +8980,6 @@ class SimplePie_Misc } } - /** - * Remove bad UTF-8 bytes - * - * PCRE Pattern to locate bad bytes in a UTF-8 string comes from W3C - * FAQ: Multilingual Forms (modified to include full ASCII range) - * - * @author Geoffrey Sneddon - * @see http://www.w3.org/International/questions/qa-forms-utf-8 - * @param string $str String to remove bad UTF-8 bytes from - * @return string UTF-8 string - */ - function utf8_bad_replace($str) - { - if (function_exists('iconv') && ($return = @iconv('UTF-8', 'UTF-8//IGNORE', $str))) - { - return $return; - } - elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($str, 'UTF-8', 'UTF-8'))) - { - return $return; - } - 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)) - { - return implode("\xEF\xBF\xBD", $matches[0]); - } - elseif ($str !== '') - { - return "\xEF\xBF\xBD"; - } - else - { - return ''; - } - } - /** * Converts a Windows-1252 encoded string to a UTF-8 encoded string * @@ -9399,14 +8988,14 @@ class SimplePie_Misc * @param string $string Windows-1252 encoded string * @return string UTF-8 encoded string */ - function windows_1252_to_utf8($string) + public static function windows_1252_to_utf8($string) { 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"); return strtr($string, $convert_table); } - function change_encoding($data, $input, $output) + public static function change_encoding($data, $input, $output) { $input = SimplePie_Misc::encoding($input); $output = SimplePie_Misc::encoding($output); @@ -9447,7 +9036,7 @@ class SimplePie_Misc } } - function encoding($charset) + public static function encoding($charset) { // Normalization from UTS #22 switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset))) @@ -10763,7 +10352,7 @@ class SimplePie_Misc } } - function get_curl_version() + public static function get_curl_version() { if (is_array($curl = curl_version())) { @@ -10784,7 +10373,7 @@ class SimplePie_Misc return $curl; } - function is_subclass_of($class1, $class2) + public static function is_subclass_of($class1, $class2) { if (func_num_args() !== 2) { @@ -10825,7 +10414,7 @@ class SimplePie_Misc * @param string $data Data to strip comments from * @return string Comment stripped string */ - function strip_comments($data) + public static function strip_comments($data) { $output = ''; while (($start = strpos($data, '