MDL-23979 fixed non standard entities result
[moodle.git] / lib / simplepie / simplepie.inc
index d0c1092..b87cbcd 100644 (file)
@@ -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-2008, 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
  * POSSIBILITY OF SUCH DAMAGE.
  *
  * @package SimplePie
- * @version 1.1.3
- * @copyright 2004-2008 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.1.3');
+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', 20081219);
+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
@@ -241,6 +242,21 @@ define('SIMPLEPIE_CONSTRUCT_MAYBE_HTML', 32);
  */
 define('SIMPLEPIE_CONSTRUCT_ALL', 63);
 
+/**
+ * Don't change case
+ */
+define('SIMPLEPIE_SAME_CASE', 1);
+
+/**
+ * Change to lowercase
+ */
+define('SIMPLEPIE_LOWERCASE', 2);
+
+/**
+ * Change to uppercase
+ */
+define('SIMPLEPIE_UPPERCASE', 4);
+
 /**
  * PCRE for HTML attributes
  */
@@ -318,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
  */
@@ -376,11 +412,6 @@ define('SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16);
  * SimplePie
  *
  * @package SimplePie
- * @version "Razzleberry"
- * @copyright 2004-2007 Ryan Parman, Geoffrey Sneddon
- * @author Ryan Parman
- * @author Geoffrey Sneddon
- * @todo Option for type of fetching (cache, not modified header, fetch, etc.)
  */
 class SimplePie
 {
@@ -388,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
@@ -444,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
@@ -452,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
@@ -509,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 <media:text> 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 <media:copyright>
         * @see SimplePie::set_copyright_class()
         * @access private
         */
-       var $copyright_class = 'SimplePie_Copyright';
+       public $copyright_class = 'SimplePie_Copyright';
 
        /**
         * @var string Class used for Media RSS <media:credit>
         * @see SimplePie::set_credit_class()
         * @access private
         */
-       var $credit_class = 'SimplePie_Credit';
+       public $credit_class = 'SimplePie_Credit';
 
        /**
         * @var string Class used for Media RSS <media:rating>
         * @see SimplePie::set_rating_class()
         * @access private
         */
-       var $rating_class = 'SimplePie_Rating';
+       public $rating_class = 'SimplePie_Rating';
 
        /**
         * @var string Class used for Media RSS <media:restriction>
         * @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
@@ -629,69 +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 string Web-accessible path to the handler_favicon.php file.
-        * @see SimplePie::set_favicon_handler()
+        * @var array All the feeds found during the autodiscovery process
+        * @see SimplePie::get_all_discovered_feeds()
         * @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
@@ -710,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));
        }
@@ -749,23 +770,26 @@ class SimplePie
        /**
         * Remove items that link back to this before destroying this object
         */
-       function __destruct()
+       public function __destruct()
        {
-               if (!empty($this->data['items']))
+               if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
                {
-                       foreach ($this->data['items'] as $item)
+                       if (!empty($this->data['items']))
                        {
-                               $item->__destruct();
+                               foreach ($this->data['items'] as $item)
+                               {
+                                       $item->__destruct();
+                               }
+                               unset($item, $this->data['items']);
                        }
-                       unset($this->data['items']);
-               }
-               if (!empty($this->data['ordered_items']))
-               {
-                       foreach ($this->data['ordered_items'] as $item)
+                       if (!empty($this->data['ordered_items']))
                        {
-                               $item->__destruct();
+                               foreach ($this->data['ordered_items'] as $item)
+                               {
+                                       $item->__destruct();
+                               }
+                               unset($item, $this->data['ordered_items']);
                        }
-                       unset($this->data['ordered_items']);
                }
        }
 
@@ -777,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;
        }
@@ -798,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))
                {
@@ -821,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'))
                {
@@ -844,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;
        }
@@ -859,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;
        }
@@ -872,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.
         *
@@ -907,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;
        }
@@ -919,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;
        }
@@ -931,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;
        }
@@ -942,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;
        }
@@ -953,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;
        }
@@ -964,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)
                {
@@ -990,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;
        }
@@ -1001,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'))
                {
@@ -1020,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'))
                {
@@ -1039,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'))
                {
@@ -1058,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'))
                {
@@ -1077,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;
@@ -1096,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'))
                {
@@ -1115,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'))
                {
@@ -1134,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'))
                {
@@ -1153,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'))
                {
@@ -1172,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'))
                {
@@ -1191,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'))
                {
@@ -1210,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'))
                {
@@ -1229,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'))
                {
@@ -1248,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'))
                {
@@ -1267,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'))
                {
@@ -1286,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'))
                {
@@ -1305,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;
        }
@@ -1316,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))
                {
@@ -1330,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)
                {
@@ -1349,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)
                {
@@ -1368,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 === '')
                {
@@ -1391,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 === '')
                {
@@ -1405,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);
        }
@@ -1423,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.
         *
@@ -1454,9 +1423,9 @@ 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)
+               if ($page !== false)
                {
                        $this->sanitize->set_image_handler($page . '?' . $qs . '=');
                }
@@ -1472,52 +1441,38 @@ 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'))
                {
                        return false;
                }
-               if (isset($_GET[$this->javascript]))
+               // Then check the xml extension is sane (i.e., libxml 2.7.x issue on PHP < 5.2.9 and libxml 2.7.0 to 2.7.2 on any version) if we don't have xmlreader.
+               elseif (!extension_loaded('xmlreader'))
                {
-                       if (function_exists('ob_gzhandler'))
+                       static $xml_is_sane = null;
+                       if ($xml_is_sane === null)
                        {
-                               ob_start('ob_gzhandler');
+                               $parser_check = xml_parser_create();
+                               xml_parse_into_struct($parser_check, '<foo>&amp;</foo>', $values);
+                               xml_parser_free($parser_check);
+                               $xml_is_sane = isset($values[0]['value']);
                        }
-                       header('Content-type: text/javascript; charset: UTF-8');
-                       header('Cache-Control: must-revalidate');
-                       header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
-                       ?>
-function embed_odeo(link) {
-       document.writeln('<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+'"></embed>');
-}
-
-function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
-       if (placeholder != '') {
-               document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" href="'+link+'" src="'+placeholder+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="false" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
-       }
-       else {
-               document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" src="'+link+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="true" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
-       }
-}
-
-function embed_flash(bgcolor, width, height, link, loop, type) {
-       document.writeln('<embed src="'+link+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="'+type+'" quality="high" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'" loop="'+loop+'"></embed>');
-}
-
-function embed_flv(width, height, link, placeholder, loop, player) {
-       document.writeln('<embed src="'+player+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="'+width+'" height="'+height+'" wmode="transparent" flashvars="file='+link+'&autostart=false&repeat='+loop+'&showdigits=true&showfsbutton=false"></embed>');
-}
+                       if (!$xml_is_sane)
+                       {
+                               return false;
+                       }
+               }
 
-function embed_wmedia(width, height, link) {
-       document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
-}
-                       <?php
+               if (isset($_GET[$this->javascript]))
+               {
+                       SimplePie_Misc::output_javascript();
                        exit;
                }
 
@@ -1527,6 +1482,7 @@ function embed_wmedia(width, height, link) {
 
                if ($this->feed_url !== null || $this->raw_data !== null)
                {
+                       $this->error = null;
                        $this->data = array();
                        $this->multifeed_objects = array();
                        $cache = false;
@@ -1547,13 +1503,13 @@ function embed_wmedia(width, height, link) {
                                        if (!empty($this->data))
                                        {
                                                // If the cache is for an outdated build of SimplePie
-                                               if (!isset($this->data['build']) || $this->data['build'] != SIMPLEPIE_BUILD)
+                                               if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD)
                                                {
                                                        $cache->unlink();
                                                        $this->data = array();
                                                }
                                                // If we've hit a collision just rerun it with caching disabled
-                                               elseif (isset($this->data['url']) && $this->data['url'] != $this->feed_url)
+                                               elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url)
                                                {
                                                        $cache = false;
                                                        $this->data = array();
@@ -1565,7 +1521,7 @@ function embed_wmedia(width, height, link) {
                                                        if ($cache->mtime() + $this->autodiscovery_cache_duration > time())
                                                        {
                                                                // Do not need to do feed autodiscovery yet.
-                                                               if ($this->data['feed_url'] == $this->data['url'])
+                                                               if ($this->data['feed_url'] === $this->data['url'])
                                                                {
                                                                        $cache->unlink();
                                                                        $this->data = array();
@@ -1592,10 +1548,12 @@ function embed_wmedia(width, height, link) {
                                                                {
                                                                        $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)
+                                                                       if ($file->status_code === 304)
                                                                        {
                                                                                $cache->touch();
                                                                                return true;
@@ -1627,17 +1585,17 @@ function embed_wmedia(width, height, link) {
                                // If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it.
                                if (!isset($file))
                                {
-                                       if (is_a($this->file, 'SimplePie_File') && $this->file->url == $this->feed_url)
+                                       if (is_a($this->file, 'SimplePie_File') && $this->file->url === $this->feed_url)
                                        {
                                                $file =& $this->file;
                                        }
                                        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
-                               if (!$file->success)
+                               if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
                                {
                                        $this->error = $file->error;
                                        if (!empty($this->data))
@@ -1653,19 +1611,20 @@ function embed_wmedia(width, height, link) {
                                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
                                                unset($file);
-                                               if ($file = $locate->find($this->autodiscovery))
+                                               if ($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds))
                                                {
                                                        if ($cache)
                                                        {
                                                                $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD);
                                                                if (!$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);
                                                                }
                                                                $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc');
                                                        }
@@ -1673,7 +1632,7 @@ function embed_wmedia(width, height, link) {
                                                }
                                                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;
                                                }
@@ -1753,7 +1712,7 @@ function embed_wmedia(width, height, link) {
                                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'))
@@ -1770,22 +1729,32 @@ function embed_wmedia(width, height, link) {
                                                        // 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;
                                                }
                                        }
                                }
                        }
-                       // We have an error, just set SimplePie::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());
+
+                       if (isset($parser))
+                       {
+                               // We have an error, just set SimplePie_Misc::error to it and quit
+                               $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. 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))
@@ -1822,17 +1791,17 @@ function embed_wmedia(width, height, link) {
         * @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())
                {
@@ -1849,7 +1818,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_type()
+       public function get_type()
        {
                if (!isset($this->data['type']))
                {
@@ -1879,18 +1848,18 @@ function embed_wmedia(width, height, link) {
                                        $this->data['type'] &= SIMPLEPIE_TYPE_RSS_090;
                                }
                        }
-                       elseif (isset($this->data['child']['']['rss']))
+                       elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss']))
                        {
                                $this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL;
-                               if (isset($this->data['child']['']['rss'][0]['attribs']['']['version']))
+                               if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
                                {
-                                       switch (trim($this->data['child']['']['rss'][0]['attribs']['']['version']))
+                                       switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
                                        {
                                                case '0.91':
                                                        $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091;
-                                                       if (isset($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
+                                                       if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
                                                        {
-                                                               switch (trim($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
+                                                               switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
                                                                {
                                                                        case '0':
                                                                                $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
@@ -1929,68 +1898,12 @@ function embed_wmedia(width, height, link) {
                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->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);
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-                       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 <itunes:new-feed-url> as well
         * @todo Also, |atom:link|@rel=self
         */
-       function subscribe_url()
+       public function subscribe_url()
        {
                if ($this->feed_url !== null)
                {
@@ -2002,156 +1915,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       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 'outlook' . $this->sanitize(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 = $this->sanitize($feed_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->feed_url);
-                       if ($site_url !== null && $this->get_link() !== null)
-                       {
-                               $return .= $this->sanitize($site_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_link());
-                       }
-                       return $return;
-               }
-               else
-               {
-                       return null;
-               }
-       }
-
-       function subscribe_aol()
-       {
-               return $this->subscribe_service('http://feeds.my.aol.com/add.jsp?url=');
-       }
-
-       function subscribe_bloglines()
-       {
-               return urldecode($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)
@@ -2177,15 +1941,15 @@ function embed_wmedia(width, height, link) {
                }
                if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
                {
-                       if (isset($this->data['child']['']['rss'][0]['child'][$namespace][$tag]))
+                       if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag]))
                        {
-                               return $this->data['child']['']['rss'][0]['child'][$namespace][$tag];
+                               return $this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag];
                        }
                }
                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)
@@ -2217,7 +1981,7 @@ function embed_wmedia(width, height, link) {
                }
                if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
                {
-                       if ($channel = $this->get_feed_tags('', 'channel'))
+                       if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'channel'))
                        {
                                if (isset($channel[0]['child'][$namespace][$tag]))
                                {
@@ -2228,7 +1992,7 @@ function embed_wmedia(width, height, link) {
                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)
@@ -2253,7 +2017,7 @@ function embed_wmedia(width, height, link) {
                }
                if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
                {
-                       if ($image = $this->get_channel_tags('', 'image'))
+                       if ($image = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'image'))
                        {
                                if (isset($image[0]['child'][$namespace][$tag]))
                                {
@@ -2264,7 +2028,7 @@ function embed_wmedia(width, height, link) {
                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']))
                {
@@ -2280,12 +2044,12 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       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'))
                {
@@ -2303,7 +2067,7 @@ function embed_wmedia(width, height, link) {
                {
                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
                }
-               elseif ($return = $this->get_channel_tags('', 'title'))
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
                {
                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
                }
@@ -2321,7 +2085,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_category($key = 0)
+       public function get_category($key = 0)
        {
                $categories = $this->get_categories();
                if (isset($categories[$key]))
@@ -2334,7 +2098,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_categories()
+       public function get_categories()
        {
                $categories = array();
 
@@ -2355,19 +2119,30 @@ function embed_wmedia(width, height, link) {
                        {
                                $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('', 'category') as $category)
+               foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
                {
-                       $categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+                       // This is really the label, but keep this as the term also for BC.
+                       // Label will also work on retrieving because that falls back to term.
+                       $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       if (isset($category['attribs']['']['domain']))
+                       {
+                               $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       else
+                       {
+                               $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))
@@ -2380,7 +2155,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_author($key = 0)
+       public function get_author($key = 0)
        {
                $authors = $this->get_authors();
                if (isset($authors[$key]))
@@ -2393,7 +2168,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_authors()
+       public function get_authors()
        {
                $authors = array();
                foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
@@ -2415,7 +2190,7 @@ function embed_wmedia(width, height, link) {
                        }
                        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'))
@@ -2437,20 +2212,20 @@ function embed_wmedia(width, height, link) {
                        }
                        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))
@@ -2463,7 +2238,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_contributor($key = 0)
+       public function get_contributor($key = 0)
        {
                $contributors = $this->get_contributors();
                if (isset($contributors[$key]))
@@ -2476,7 +2251,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_contributors()
+       public function get_contributors()
        {
                $contributors = array();
                foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
@@ -2498,7 +2273,7 @@ function embed_wmedia(width, height, link) {
                        }
                        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)
@@ -2520,7 +2295,7 @@ function embed_wmedia(width, height, link) {
                        }
                        if ($name !== null || $email !== null || $url !== null)
                        {
-                               $contributors[] =& new $this->author_class($name, $url, $email);
+                               $contributors[] = new $this->author_class($name, $url, $email);
                        }
                }
 
@@ -2534,7 +2309,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_link($key = 0, $rel = 'alternate')
+       public function get_link($key = 0, $rel = 'alternate')
        {
                $links = $this->get_links($rel);
                if (isset($links[$key]))
@@ -2550,12 +2325,12 @@ function embed_wmedia(width, height, link) {
        /**
         * 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']))
                {
@@ -2591,7 +2366,7 @@ function embed_wmedia(width, height, link) {
                        {
                                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
                        }
-                       if ($links = $this->get_channel_tags('', 'link'))
+                       if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
                        {
                                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
                        }
@@ -2611,7 +2386,7 @@ function embed_wmedia(width, height, link) {
                                                $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
                                        }
                                }
-                               elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
+                               elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
                                {
                                        $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
                                }
@@ -2629,9 +2404,14 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_description()
+       public function get_all_discovered_feeds()
        {
-               if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
+               return $this->all_discovered_feeds;
+       }
+
+       public function get_description()
+       {
+               if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
                {
                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
                }
@@ -2647,9 +2427,9 @@ function embed_wmedia(width, height, link) {
                {
                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
                }
-               elseif ($return = $this->get_channel_tags('', 'description'))
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
                {
-                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
+                       return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
                }
                elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
                {
@@ -2673,7 +2453,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_copyright()
+       public function get_copyright()
        {
                if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
                {
@@ -2683,7 +2463,7 @@ function embed_wmedia(width, height, link) {
                {
                        return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
                }
-               elseif ($return = $this->get_channel_tags('', 'copyright'))
+               elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
                {
                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                }
@@ -2701,9 +2481,9 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_language()
+       public function get_language()
        {
-               if ($return = $this->get_channel_tags('', 'language'))
+               if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
                {
                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                }
@@ -2737,13 +2517,14 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       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];
                }
@@ -2753,7 +2534,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_longitude()
+       public function get_longitude()
        {
                if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
                {
@@ -2763,7 +2544,7 @@ function embed_wmedia(width, height, link) {
                {
                        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];
                }
@@ -2773,7 +2554,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_image_title()
+       public function get_image_title()
        {
                if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
                {
@@ -2783,7 +2564,7 @@ function embed_wmedia(width, height, link) {
                {
                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                }
-               elseif ($return = $this->get_image_tags('', 'title'))
+               elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
                {
                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                }
@@ -2801,7 +2582,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_image_url()
+       public function get_image_url()
        {
                if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
                {
@@ -2823,7 +2604,7 @@ function embed_wmedia(width, height, link) {
                {
                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
                }
-               elseif ($return = $this->get_image_tags('', 'url'))
+               elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
                {
                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
                }
@@ -2833,7 +2614,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_image_link()
+       public function get_image_link()
        {
                if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
                {
@@ -2843,7 +2624,7 @@ function embed_wmedia(width, height, link) {
                {
                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
                }
-               elseif ($return = $this->get_image_tags('', 'link'))
+               elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
                {
                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
                }
@@ -2853,13 +2634,13 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_image_width()
+       public function get_image_width()
        {
-               if ($return = $this->get_image_tags('', 'width'))
+               if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width'))
                {
                        return round($return[0]['data']);
                }
-               elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
+               elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
                {
                        return 88.0;
                }
@@ -2869,13 +2650,13 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_image_height()
+       public function get_image_height()
        {
-               if ($return = $this->get_image_tags('', 'height'))
+               if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height'))
                {
                        return round($return[0]['data']);
                }
-               elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
+               elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
                {
                        return 31.0;
                }
@@ -2885,10 +2666,11 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_item_quantity($max = 0)
+       public function get_item_quantity($max = 0)
        {
+               $max = (int) $max;
                $qty = count($this->get_items());
-               if ($max == 0)
+               if ($max === 0)
                {
                        return $qty;
                }
@@ -2898,7 +2680,7 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_item($key = 0)
+       public function get_item($key = 0)
        {
                $items = $this->get_items();
                if (isset($items[$key]))
@@ -2911,52 +2693,56 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function get_items($start = 0, $end = 0)
+       public function get_items($start = 0, $end = 0)
        {
-               if (!empty($this->multifeed_objects))
-               {
-                       return SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
-               }
-               elseif (!isset($this->data['items']))
+               if (!isset($this->data['items']))
                {
-                       if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
+                       if (!empty($this->multifeed_objects))
                        {
-                               $keys = array_keys($items);
-                               foreach ($keys as $key)
-                               {
-                                       $this->data['items'][] =& new $this->item_class($this, $items[$key]);
-                               }
+                               $this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
                        }
-                       if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
+                       else
                        {
-                               $keys = array_keys($items);
-                               foreach ($keys as $key)
+                               $this->data['items'] = array();
+                               if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
                                {
-                                       $this->data['items'][] =& new $this->item_class($this, $items[$key]);
+                                       $keys = array_keys($items);
+                                       foreach ($keys as $key)
+                                       {
+                                               $this->data['items'][] = new $this->item_class($this, $items[$key]);
+                                       }
                                }
-                       }
-                       if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
-                       {
-                               $keys = array_keys($items);
-                               foreach ($keys as $key)
+                               if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
                                {
-                                       $this->data['items'][] =& new $this->item_class($this, $items[$key]);
+                                       $keys = array_keys($items);
+                                       foreach ($keys as $key)
+                                       {
+                                               $this->data['items'][] = new $this->item_class($this, $items[$key]);
+                                       }
                                }
-                       }
-                       if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
-                       {
-                               $keys = array_keys($items);
-                               foreach ($keys as $key)
+                               if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
                                {
-                                       $this->data['items'][] =& new $this->item_class($this, $items[$key]);
+                                       $keys = array_keys($items);
+                                       foreach ($keys as $key)
+                                       {
+                                               $this->data['items'][] = new $this->item_class($this, $items[$key]);
+                                       }
                                }
-                       }
-                       if ($items = $this->get_channel_tags('', 'item'))
-                       {
-                               $keys = array_keys($items);
-                               foreach ($keys as $key)
+                               if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
                                {
-                                       $this->data['items'][] =& new $this->item_class($this, $items[$key]);
+                                       $keys = array_keys($items);
+                                       foreach ($keys as $key)
+                                       {
+                                               $this->data['items'][] = new $this->item_class($this, $items[$key]);
+                                       }
+                               }
+                               if ($items = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item'))
+                               {
+                                       $keys = array_keys($items);
+                                       foreach ($keys as $key)
+                                       {
+                                               $this->data['items'][] = new $this->item_class($this, $items[$key]);
+                                       }
                                }
                        }
                }
@@ -2964,7 +2750,7 @@ function embed_wmedia(width, height, link) {
                if (!empty($this->data['items']))
                {
                        // If we want to order it by date, check if all items have a date, and then sort it
-                       if ($this->order_by_date)
+                       if ($this->order_by_date && empty($this->multifeed_objects))
                        {
                                if (!isset($this->data['ordered_items']))
                                {
@@ -2992,7 +2778,7 @@ function embed_wmedia(width, height, link) {
                        }
 
                        // Slice the data as desired
-                       if ($end == 0)
+                       if ($end === 0)
                        {
                                return array_slice($items, $start);
                        }
@@ -3007,12 +2793,18 @@ function embed_wmedia(width, height, link) {
                }
        }
 
-       function sort_items($a, $b)
+       /**
+        * @static
+        */
+       public function sort_items($a, $b)
        {
                return $a->get_date('U') <= $b->get_date('U');
        }
 
-       function merge_items($urls, $start = 0, $end = 0, $limit = 0)
+       /**
+        * @static
+        */
+       public function merge_items($urls, $start = 0, $end = 0, $limit = 0)
        {
                if (is_array($urls) && sizeof($urls) > 0)
                {
@@ -3044,7 +2836,7 @@ function embed_wmedia(width, height, link) {
                                usort($items, array('SimplePie', 'sort_items'));
                        }
 
-                       if ($end == 0)
+                       if ($end === 0)
                        {
                                return array_slice($items, $start);
                        }
@@ -3066,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));
        }
@@ -3080,12 +2872,15 @@ class SimplePie_Item
        /**
         * Remove items that link back to this before destroying this object
         */
-       function __destruct()
+       public function __destruct()
        {
-               unset($this->feed);
+               if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
+               {
+                       unset($this->feed);
+               }
        }
 
-       function get_item_tags($namespace, $tag)
+       public function get_item_tags($namespace, $tag)
        {
                if (isset($this->data['child'][$namespace][$tag]))
                {
@@ -3097,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)
                {
@@ -3124,7 +2919,7 @@ class SimplePie_Item
                        {
                                return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                        }
-                       elseif ($return = $this->get_item_tags('', 'guid'))
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
                        {
                                return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                        }
@@ -3155,7 +2950,7 @@ class SimplePie_Item
                }
        }
 
-       function get_title()
+       public function get_title()
        {
                if (!isset($this->data['title']))
                {
@@ -3175,7 +2970,7 @@ class SimplePie_Item
                        {
                                $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
                        }
-                       elseif ($return = $this->get_item_tags('', 'title'))
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
                        {
                                $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
                        }
@@ -3195,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'))
                {
@@ -3209,7 +3004,7 @@ class SimplePie_Item
                {
                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
                }
-               elseif ($return = $this->get_item_tags('', 'description'))
+               elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
                {
                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
                }
@@ -3239,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'))
                {
@@ -3263,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]))
@@ -3276,7 +3071,7 @@ class SimplePie_Item
                }
        }
 
-       function get_categories()
+       public function get_categories()
        {
                $categories = array();
 
@@ -3297,19 +3092,30 @@ 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('', 'category') as $category)
+               foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
                {
-                       $categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
+                       // This is really the label, but keep this as the term also for BC.
+                       // Label will also work on retrieving because that falls back to term.
+                       $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       if (isset($category['attribs']['']['domain']))
+                       {
+                               $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
+                       else
+                       {
+                               $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))
@@ -3322,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]))
@@ -3335,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]))
@@ -3348,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)
@@ -3370,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)
@@ -3392,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);
                        }
                }
 
@@ -3406,10 +3212,7 @@ class SimplePie_Item
                }
        }
 
-       /**
-        * @todo Atom inheritance (item author, source author, feed author)
-        */
-       function get_authors()
+       public function get_authors()
        {
                $authors = array();
                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
@@ -3431,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'))
@@ -3453,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('', 'author'))
+               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))
@@ -3491,7 +3294,7 @@ class SimplePie_Item
                }
        }
 
-       function get_copyright()
+       public function get_copyright()
        {
                if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
                {
@@ -3511,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']))
                {
@@ -3535,7 +3338,7 @@ class SimplePie_Item
                        {
                                $this->data['date']['raw'] = $return[0]['data'];
                        }
-                       elseif ($return = $this->get_item_tags('', 'pubDate'))
+                       elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate'))
                        {
                                $this->data['date']['raw'] = $return[0]['data'];
                        }
@@ -3579,7 +3382,7 @@ class SimplePie_Item
                }
        }
 
-       function get_local_date($date_format = '%c')
+       public function get_local_date($date_format = '%c')
        {
                if (!$date_format)
                {
@@ -3595,7 +3398,7 @@ class SimplePie_Item
                }
        }
 
-       function get_permalink()
+       public function get_permalink()
        {
                $link = $this->get_link();
                $enclosure = $this->get_enclosure(0);
@@ -3613,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)
@@ -3626,7 +3429,7 @@ class SimplePie_Item
                }
        }
 
-       function get_links($rel = 'alternate')
+       public function get_links($rel = 'alternate')
        {
                if (!isset($this->data['links']))
                {
@@ -3656,13 +3459,13 @@ class SimplePie_Item
                        {
                                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
                        }
-                       if ($links = $this->get_item_tags('', 'link'))
+                       if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
                        {
                                $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
                        }
-                       if ($links = $this->get_item_tags('', 'guid'))
+                       if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
                        {
-                               if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) == 'true')
+                               if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true')
                                {
                                        $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
                                }
@@ -3683,7 +3486,7 @@ class SimplePie_Item
                                                $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
                                        }
                                }
-                               elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
+                               elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
                                {
                                        $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
                                }
@@ -3703,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]))
@@ -3726,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']))
                {
@@ -3780,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'))
@@ -3812,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))
@@ -3842,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)
                        {
@@ -3865,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)
                        {
@@ -3876,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']))
                                {
@@ -3886,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);
                                        }
                                }
                        }
@@ -3908,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'))
                        {
@@ -3922,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
@@ -3949,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'))
@@ -3975,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))
@@ -4164,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'))
@@ -4177,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'))
@@ -4198,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'))
@@ -4211,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))
@@ -4239,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'))
@@ -4249,11 +4052,11 @@ class SimplePie_Item
                                        $restriction_relationship = 'allow';
                                        $restriction_type = null;
                                        $restriction_value = 'itunes';
-                                       if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
+                                       if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes')
                                        {
                                                $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'))
@@ -4275,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'))
@@ -4285,11 +4088,11 @@ class SimplePie_Item
                                        $restriction_relationship = 'allow';
                                        $restriction_type = null;
                                        $restriction_value = 'itunes';
-                                       if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
+                                       if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes')
                                        {
                                                $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))
@@ -4371,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($group['child']) && isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content']))
                                {
-                                       if (isset($content['attribs']['']['url']))
+                                       // If we have media:content tags, loop through them.
+                                       foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content)
                                        {
-                                               // 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']))
+                                               if (isset($content['attribs']['']['url']))
                                                {
-                                                       $width = $this->sanitize($content['attribs']['']['width'], SIMPLEPIE_CONSTRUCT_TEXT);
-                                               }
-                                               $url = $this->sanitize($content['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
+                                                       // 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);
 
-                                               // Checking the other optional media: elements. Priority: media:content, media:group, item, channel
+                                                       // 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);
+                                                                       $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['attribs']['']['start']))
+                                                               if (is_array($captions))
                                                                {
-                                                                       $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $captions = array_values(SimplePie_Misc::array_unique($captions));
                                                                }
-                                                               if (isset($caption['attribs']['']['end']))
+                                                       }
+                                                       elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
+                                                       {
+                                                               foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
                                                                {
-                                                                       $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;
                                                        }
-                                               }
-                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
-                                               {
-                                                       foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
+
+                                                       // CATEGORIES
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
                                                        {
-                                                               $caption_type = null;
-                                                               $caption_lang = null;
-                                                               $caption_startTime = null;
-                                                               $caption_endTime = null;
-                                                               $caption_text = null;
-                                                               if (isset($caption['attribs']['']['type']))
+                                                               foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
                                                                {
-                                                                       $caption_type = $this->sanitize($caption['attribs']['']['type'], 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);
                                                                }
-                                                               if (isset($caption['attribs']['']['lang']))
+                                                       }
+                                                       if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
+                                                       {
+                                                               foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
                                                                {
-                                                                       $caption_lang = $this->sanitize($caption['attribs']['']['lang'], 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);
                                                                }
-                                                               if (isset($caption['attribs']['']['start']))
+                                                       }
+                                                       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']))
                                                                {
-                                                                       $caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
                                                                }
-                                                               if (isset($caption['attribs']['']['end']))
+                                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
                                                                {
-                                                                       $caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                                                                }
-                                                               if (isset($caption['data']))
+                                                               $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']))
                                                                {
-                                                                       $caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $copyright_url = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               }
+                                                               if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
+                                                               {
+                                                                       $copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                                                                }
-                                                               $captions[] =& new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
+                                                               $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
                                                        }
-                                                       if (is_array($captions))
+                                                       else
                                                        {
-                                                               $captions = array_values(SimplePie_Misc::array_unique($captions));
+                                                               $copyrights = $copyrights_parent;
                                                        }
-                                               }
-                                               else
-                                               {
-                                                       $captions = $captions_parent;
-                                               }
 
-                                               // CATEGORIES
-                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
-                                               {
-                                                       foreach ((array) $content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category'] as $category)
+                                                       // CREDITS
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
                                                        {
-                                                               $term = null;
-                                                               $scheme = null;
-                                                               $label = null;
-                                                               if (isset($category['data']))
+                                                               foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
                                                                {
-                                                                       $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';
+                                                                       $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($category['attribs']['']['label']))
+                                                               if (is_array($credits))
                                                                {
-                                                                       $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $credits = array_values(SimplePie_Misc::array_unique($credits));
                                                                }
-                                                               $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)
+                                                       elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
                                                        {
-                                                               $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
+                                                               foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
                                                                {
-                                                                       $scheme = 'http://search.yahoo.com/mrss/category_schema';
+                                                                       $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($category['attribs']['']['label']))
+                                                               if (is_array($credits))
                                                                {
-                                                                       $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $credits = array_values(SimplePie_Misc::array_unique($credits));
                                                                }
-                                                               $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']))
+                                                       else
                                                        {
-                                                               $copyright_url = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               $credits = $credits_parent;
                                                        }
-                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
+
+                                                       // DESCRIPTION
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
                                                        {
-                                                               $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                                                        }
-                                                       $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 (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
                                                        {
-                                                               $copyright_url = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               $description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                                                        }
-                                                       if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data']))
+                                                       else
                                                        {
-                                                               $copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                               $description = $description_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)
+                                                       // HASHES
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
                                                        {
-                                                               $credit_role = null;
-                                                               $credit_scheme = null;
-                                                               $credit_name = null;
-                                                               if (isset($credit['attribs']['']['role']))
+                                                               foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
                                                                {
-                                                                       $credit_role = $this->sanitize($credit['attribs']['']['role'], 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;
                                                                }
-                                                               if (isset($credit['attribs']['']['scheme']))
+                                                               if (is_array($hashes))
                                                                {
-                                                                       $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $hashes = array_values(SimplePie_Misc::array_unique($hashes));
                                                                }
-                                                               else
+                                                       }
+                                                       elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
+                                                       {
+                                                               foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
                                                                {
-                                                                       $credit_scheme = 'urn:ebu';
+                                                                       $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;
                                                                }
-                                                               if (isset($credit['data']))
+                                                               if (is_array($hashes))
                                                                {
-                                                                       $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $hashes = array_values(SimplePie_Misc::array_unique($hashes));
                                                                }
-                                                               $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));
+                                                               $hashes = $hashes_parent;
                                                        }
-                                               }
-                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
-                                               {
-                                                       foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
+
+                                                       // KEYWORDS
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
                                                        {
-                                                               $credit_role = null;
-                                                               $credit_scheme = null;
-                                                               $credit_name = null;
-                                                               if (isset($credit['attribs']['']['role']))
+                                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
                                                                {
-                                                                       $credit_role = $this->sanitize($credit['attribs']['']['role'], 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);
                                                                }
-                                                               if (isset($credit['attribs']['']['scheme']))
+                                                               if (is_array($keywords))
                                                                {
-                                                                       $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $keywords = array_values(SimplePie_Misc::array_unique($keywords));
                                                                }
-                                                               else
+                                                       }
+                                                       elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
+                                                       {
+                                                               if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
                                                                {
-                                                                       $credit_scheme = 'urn:ebu';
+                                                                       $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 (isset($credit['data']))
+                                                               if (is_array($keywords))
                                                                {
-                                                                       $credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $keywords = array_values(SimplePie_Misc::array_unique($keywords));
                                                                }
-                                                               $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));
+                                                               $keywords = $keywords_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;
-                                               }
+                                                       // 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;
+                                                       }
 
-                                               // HASHES
-                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
-                                               {
-                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
+                                                       // RATINGS
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
                                                        {
-                                                               $value = null;
-                                                               $algo = null;
-                                                               if (isset($hash['data']))
+                                                               foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
                                                                {
-                                                                       $value = $this->sanitize($hash['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 (isset($hash['attribs']['']['algo']))
+                                                               if (is_array($ratings))
                                                                {
-                                                                       $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $ratings = array_values(SimplePie_Misc::array_unique($ratings));
                                                                }
-                                                               else
+                                                       }
+                                                       elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
+                                                       {
+                                                               foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
                                                                {
-                                                                       $algo = 'md5';
+                                                                       $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));
                                                                }
-                                                               $hashes[] = $algo.':'.$value;
                                                        }
-                                                       if (is_array($hashes))
+                                                       else
                                                        {
-                                                               $hashes = array_values(SimplePie_Misc::array_unique($hashes));
+                                                               $ratings = $ratings_parent;
                                                        }
-                                               }
-                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
-                                               {
-                                                       foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
+
+                                                       // RESTRICTIONS
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
                                                        {
-                                                               $value = null;
-                                                               $algo = null;
-                                                               if (isset($hash['data']))
+                                                               foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
                                                                {
-                                                                       $value = $this->sanitize($hash['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 (isset($hash['attribs']['']['algo']))
+                                                               if (is_array($restrictions))
                                                                {
-                                                                       $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
                                                                }
-                                                               else
+                                                       }
+                                                       elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
+                                                       {
+                                                               foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
                                                                {
-                                                                       $algo = 'md5';
+                                                                       $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));
                                                                }
-                                                               $hashes[] = $algo.':'.$value;
                                                        }
-                                                       if (is_array($hashes))
+                                                       else
                                                        {
-                                                               $hashes = array_values(SimplePie_Misc::array_unique($hashes));
+                                                               $restrictions = $restrictions_parent;
                                                        }
-                                               }
-                                               else
-                                               {
-                                                       $hashes = $hashes_parent;
-                                               }
 
-                                               // KEYWORDS
-                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
-                                               {
-                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
+                                                       // THUMBNAILS
+                                                       if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
                                                        {
-                                                               $temp = explode(',', $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
-                                                               foreach ($temp as $word)
+                                                               foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
                                                                {
-                                                                       $keywords[] = trim($word);
+                                                                       $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
                                                                }
-                                                               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)
-                                                               {
-                                                                       $keywords[] = trim($word);
-                                                               }
-                                                               unset($temp);
-                                                       }
-                                                       if (is_array($keywords))
-                                                       {
-                                                               $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)
-                                                       {
-                                                               $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));
-                                                       }
-                                               }
-                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
-                                               {
-                                                       foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
-                                                       {
-                                                               $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));
-                                                       }
-                                               }
-                                               else
-                                               {
-                                                       $ratings = $ratings_parent;
-                                               }
-
-                                               // RESTRICTIONS
-                                               if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
-                                               {
-                                                       foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
-                                                       {
-                                                               $restriction_relationship = null;
-                                                               $restriction_type = null;
-                                                               $restriction_value = null;
-                                                               if (isset($restriction['attribs']['']['relationship']))
+                                                               if (is_array($thumbnails))
                                                                {
-                                                                       $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);
+                                                                       $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
                                                                }
-                                                               $restrictions[] =& new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
-                                                       }
-                                                       if (is_array($restrictions))
-                                                       {
-                                                               $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
                                                        }
-                                               }
-                                               elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
-                                               {
-                                                       foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
+                                                       elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
                                                        {
-                                                               $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']))
+                                                               foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
                                                                {
-                                                                       $restriction_type = $this->sanitize($restriction['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
                                                                }
-                                                               if (isset($restriction['data']))
+                                                               if (is_array($thumbnails))
                                                                {
-                                                                       $restriction_value = $this->sanitize($restriction['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                                                                       $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);
                                        }
                                }
                        }
@@ -5114,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))
                                                        {
@@ -5150,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))
@@ -5183,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
                                                {
@@ -5214,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))
                                                        {
@@ -5318,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))
                                                        {
@@ -5350,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))
                                                        {
@@ -5389,14 +5195,14 @@ 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);
                                        }
                                }
                        }
 
                        foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
                        {
-                               if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
+                               if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure')
                                {
                                        // Attributes
                                        $bitrate = null;
@@ -5425,13 +5231,13 @@ 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);
                                }
                        }
 
                        foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link)
                        {
-                               if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
+                               if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure')
                                {
                                        // Attributes
                                        $bitrate = null;
@@ -5460,11 +5266,11 @@ 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 ($enclosure = $this->get_item_tags('', 'enclosure'))
+                       if ($enclosure = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'enclosure