]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/3rdparty/libraries/simplepie/library/SimplePie/Item.php
[change] we now use Full-Text RSS 3.1, thank you so much @fivefilters
[github/wallabag/wallabag.git] / inc / 3rdparty / libraries / simplepie / library / SimplePie / Item.php
similarity index 77%
rename from inc/3rdparty/simplepie/SimplePie/Item.php
rename to inc/3rdparty/libraries/simplepie/library/SimplePie/Item.php
index 7538038aeea5b9fb01e91bcf4ffae8dda03135f0..a77574b37e4cda7f21d0a7baf1c4627afbfe77cd 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-2009, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * Copyright (c) 2004-2012, 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.3-dev
- * @copyright 2004-2010 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
  * @author Ryan Parman
  * @author Geoffrey Sneddon
  * @author Ryan McCue
  * @link http://simplepie.org/ SimplePie
  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- * @todo phpDoc comments
  */
 
 
+/**
+ * Manages all item-related data
+ *
+ * Used by {@see SimplePie::get_item()} and {@see SimplePie::get_items()}
+ *
+ * This class can be overloaded with {@see SimplePie::set_item_class()}
+ *
+ * @package SimplePie
+ * @subpackage API
+ */
 class SimplePie_Item
 {
+       /**
+        * Parent feed
+        *
+        * @access private
+        * @var SimplePie
+        */
        var $feed;
+
+       /**
+        * Raw data
+        *
+        * @access private
+        * @var array
+        */
        var $data = array();
 
+       /**
+        * Registry object
+        *
+        * @see set_registry
+        * @var SimplePie_Registry
+        */
+       protected $registry;
+
+       /**
+        * Create a new item object
+        *
+        * This is usually used by {@see SimplePie::get_items} and
+        * {@see SimplePie::get_item}. Avoid creating this manually.
+        *
+        * @param SimplePie $feed Parent feed
+        * @param array $data Raw data
+        */
        public function __construct($feed, $data)
        {
                $this->feed = $feed;
                $this->data = $data;
        }
 
+       /**
+        * Set the registry handler
+        *
+        * This is usually used by {@see SimplePie_Registry::create}
+        *
+        * @since 1.3
+        * @param SimplePie_Registry $registry
+        */
+       public function set_registry(SimplePie_Registry $registry)
+       {
+               $this->registry = $registry;
+       }
+
+       /**
+        * Get a string representation of the item
+        *
+        * @return string
+        */
        public function __toString()
        {
                return md5(serialize($this->data));
@@ -71,6 +128,20 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get data for an item-level element
+        *
+        * This method allows you to get access to ANY element/attribute that is a
+        * sub-element of the item/entry tag.
+        *
+        * See {@see SimplePie::get_feed_tags()} for a description of the return value
+        *
+        * @since 1.0
+        * @see http://simplepie.org/wiki/faq/supported_xml_namespaces
+        * @param string $namespace The URL of the XML namespace of the elements you're trying to access
+        * @param string $tag Tag name
+        * @return array
+        */
        public function get_item_tags($namespace, $tag)
        {
                if (isset($this->data['child'][$namespace][$tag]))
@@ -83,21 +154,62 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get the base URL value from the parent feed
+        *
+        * Uses `<xml:base>`
+        *
+        * @param array $element
+        * @return string
+        */
        public function get_base($element = array())
        {
                return $this->feed->get_base($element);
        }
 
+       /**
+        * Sanitize feed data
+        *
+        * @access private
+        * @see SimplePie::sanitize()
+        * @param string $data Data to sanitize
+        * @param int $type One of the SIMPLEPIE_CONSTRUCT_* constants
+        * @param string $base Base URL to resolve URLs against
+        * @return string Sanitized data
+        */
        public function sanitize($data, $type, $base = '')
        {
                return $this->feed->sanitize($data, $type, $base);
        }
 
+       /**
+        * Get the parent feed
+        *
+        * Note: this may not work as you think for multifeeds!
+        *
+        * @link http://simplepie.org/faq/typical_multifeed_gotchas#missing_data_from_feed
+        * @since 1.0
+        * @return SimplePie
+        */
        public function get_feed()
        {
                return $this->feed;
        }
 
+       /**
+        * Get the unique identifier for the item
+        *
+        * This is usually used when writing code to check for new items in a feed.
+        *
+        * Uses `<atom:id>`, `<guid>`, `<dc:identifier>` or the `about` attribute
+        * for RDF. If none of these are supplied (or `$hash` is true), creates an
+        * MD5 hash based on the permalink and title. If either of those are not
+        * supplied, creates a hash based on the full feed data.
+        *
+        * @since Beta 2
+        * @param boolean $hash Should we force using a hash instead of the supplied ID?
+        * @return string
+        */
        public function get_id($hash = false)
        {
                if (!$hash)
@@ -145,17 +257,25 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get the title of the item
+        *
+        * Uses `<atom:title>`, `<title>` or `<dc:title>`
+        *
+        * @since Beta 2 (previously called `get_item_title` since 0.8)
+        * @return string|null
+        */
        public function get_title()
        {
                if (!isset($this->data['title']))
                {
                        if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
                        {
-                               $this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+                               $this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
                        }
                        elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
                        {
-                               $this->data['title'] = $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+                               $this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
                        }
                        elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
                        {
@@ -185,15 +305,30 @@ class SimplePie_Item
                return $this->data['title'];
        }
 
+       /**
+        * Get the content for the item
+        *
+        * Prefers summaries over full content , but will return full content if a
+        * summary does not exist.
+        *
+        * To prefer full content instead, use {@see get_content}
+        *
+        * Uses `<atom:summary>`, `<description>`, `<dc:description>` or
+        * `<itunes:subtitle>`
+        *
+        * @since 0.8
+        * @param boolean $description_only Should we avoid falling back to the content?
+        * @return string|null
+        */
        public function get_description($description_only = false)
        {
                if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary'))
                {
-                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+                       return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
                }
                elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary'))
                {
-                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+                       return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
                }
                elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
                {
@@ -234,15 +369,29 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get the content for the item
+        *
+        * Prefers full content over summaries, but will return a summary if full
+        * content does not exist.
+        *
+        * To prefer summaries instead, use {@see get_description}
+        *
+        * Uses `<atom:content>` or `<content:encoded>` (RSS 1.0 Content Module)
+        *
+        * @since 1.0
+        * @param boolean $content_only Should we avoid falling back to the description?
+        * @return string|null
+        */
        public function get_content($content_only = false)
        {
                if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content'))
                {
-                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_content_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+                       return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
                }
                elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content'))
                {
-                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+                       return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
                }
                elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded'))
                {
@@ -258,6 +407,13 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get a category for the item
+        *
+        * @since Beta 3 (previously called `get_categories()` since Beta 2)
+        * @param int $key The category that you want to return.  Remember that arrays begin with 0, not 1
+        * @return SimplePie_Category|null
+        */
        public function get_category($key = 0)
        {
                $categories = $this->get_categories();
@@ -271,6 +427,14 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get all categories for the item
+        *
+        * Uses `<atom:category>`, `<category>` or `<dc:subject>`
+        *
+        * @since Beta 3
+        * @return array|null List of {@see SimplePie_Category} objects
+        */
        public function get_categories()
        {
                $categories = array();
@@ -292,7 +456,7 @@ class SimplePie_Item
                        {
                                $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
                        }
-                       $categories[] = new $this->feed->category_class($term, $scheme, $label);
+                       $categories[] = $this->registry->create('Category', array($term, $scheme, $label));
                }
                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
                {
@@ -307,20 +471,20 @@ class SimplePie_Item
                        {
                                $scheme = null;
                        }
-                       $categories[] = new $this->feed->category_class($term, $scheme, null);
+                       $categories[] = $this->registry->create('Category', array($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[] = $this->registry->create('Category', array($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[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
                }
 
                if (!empty($categories))
                {
-                       return SimplePie_Misc::array_unique($categories);
+                       return array_unique($categories);
                }
                else
                {
@@ -328,6 +492,13 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get an author for the item
+        *
+        * @since Beta 2
+        * @param int $key The author that you want to return.  Remember that arrays begin with 0, not 1
+        * @return SimplePie_Author|null
+        */
        public function get_author($key = 0)
        {
                $authors = $this->get_authors();
@@ -341,6 +512,13 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get a contributor for the item
+        *
+        * @since 1.1
+        * @param int $key The contrbutor that you want to return.  Remember that arrays begin with 0, not 1
+        * @return SimplePie_Author|null
+        */
        public function get_contributor($key = 0)
        {
                $contributors = $this->get_contributors();
@@ -354,6 +532,14 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get all contributors for the item
+        *
+        * Uses `<atom:contributor>`
+        *
+        * @since 1.1
+        * @return array|null List of {@see SimplePie_Author} objects
+        */
        public function get_contributors()
        {
                $contributors = array();
@@ -376,7 +562,7 @@ class SimplePie_Item
                        }
                        if ($name !== null || $email !== null || $uri !== null)
                        {
-                               $contributors[] = new $this->feed->author_class($name, $uri, $email);
+                               $contributors[] = $this->registry->create('Author', array($name, $uri, $email));
                        }
                }
                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
@@ -398,13 +584,13 @@ class SimplePie_Item
                        }
                        if ($name !== null || $email !== null || $url !== null)
                        {
-                               $contributors[] = new $this->feed->author_class($name, $url, $email);
+                               $contributors[] = $this->registry->create('Author', array($name, $url, $email));
                        }
                }
 
                if (!empty($contributors))
                {
-                       return SimplePie_Misc::array_unique($contributors);
+                       return array_unique($contributors);
                }
                else
                {
@@ -412,6 +598,14 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get all authors for the item
+        *
+        * Uses `<atom:author>`, `<author>`, `<dc:creator>` or `<itunes:author>`
+        *
+        * @since Beta 2
+        * @return array|null List of {@see SimplePie_Author} objects
+        */
        public function get_authors()
        {
                $authors = array();
@@ -434,7 +628,7 @@ class SimplePie_Item
                        }
                        if ($name !== null || $email !== null || $uri !== null)
                        {
-                               $authors[] = new $this->feed->author_class($name, $uri, $email);
+                               $authors[] = $this->registry->create('Author', array($name, $uri, $email));
                        }
                }
                if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
@@ -456,29 +650,29 @@ class SimplePie_Item
                        }
                        if ($name !== null || $email !== null || $url !== null)
                        {
-                               $authors[] = new $this->feed->author_class($name, $url, $email);
+                               $authors[] = $this->registry->create('Author', array($name, $url, $email));
                        }
                }
                if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author'))
                {
-                       $authors[] = new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
+                       $authors[] = $this->registry->create('Author', array(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[] = $this->registry->create('Author', array($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[] = $this->registry->create('Author', array($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[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
                }
 
                if (!empty($authors))
                {
-                       return SimplePie_Misc::array_unique($authors);
+                       return array_unique($authors);
                }
                elseif (($source = $this->get_source()) && ($authors = $source->get_authors()))
                {
@@ -494,11 +688,19 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get the copyright info for the item
+        *
+        * Uses `<atom:rights>` or `<dc:rights>`
+        *
+        * @since 1.1
+        * @return string
+        */
        public function get_copyright()
        {
                if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
                {
-                       return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
+                       return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
                }
                elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
                {
@@ -514,6 +716,20 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get the posting date/time for the item
+        *
+        * Uses `<atom:published>`, `<atom:updated>`, `<atom:issued>`,
+        * `<atom:modified>`, `<pubDate>` or `<dc:date>`
+        *
+        * Note: obeys PHP's timezone setting. To get a UTC date/time, use
+        * {@see get_gmdate}
+        *
+        * @since Beta 2 (previously called `get_item_date` since 0.8)
+        *
+        * @param string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data)
+        * @return int|string|null
+        */
        public function get_date($date_format = 'j F Y, g:i a')
        {
                if (!isset($this->data['date']))
@@ -553,7 +769,7 @@ class SimplePie_Item
 
                        if (!empty($this->data['date']['raw']))
                        {
-                               $parser = SimplePie_Parse_Date::get();
+                               $parser = $this->registry->call('Parse_Date', 'get');
                                $this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']);
                        }
                        else
@@ -582,6 +798,70 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get the update date/time for the item
+        *
+        * Uses `<atom:updated>`
+        *
+        * Note: obeys PHP's timezone setting. To get a UTC date/time, use
+        * {@see get_gmdate}
+        *
+        * @param string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data)
+        * @return int|string|null
+        */
+       public function get_updated_date($date_format = 'j F Y, g:i a')
+       {
+               if (!isset($this->data['updated']))
+               {
+                       if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
+                       {
+                               $this->data['updated']['raw'] = $return[0]['data'];
+                       }
+
+                       if (!empty($this->data['updated']['raw']))
+                       {
+                               $parser = $this->registry->call('Parse_Date', 'get');
+                               $this->data['updated']['parsed'] = $parser->parse($this->data['date']['raw']);
+                       }
+                       else
+                       {
+                               $this->data['updated'] = null;
+                       }
+               }
+               if ($this->data['updated'])
+               {
+                       $date_format = (string) $date_format;
+                       switch ($date_format)
+                       {
+                               case '':
+                                       return $this->sanitize($this->data['updated']['raw'], SIMPLEPIE_CONSTRUCT_TEXT);
+
+                               case 'U':
+                                       return $this->data['updated']['parsed'];
+
+                               default:
+                                       return date($date_format, $this->data['updated']['parsed']);
+                       }
+               }
+               else
+               {
+                       return null;
+               }
+       }
+
+       /**
+        * Get the localized posting date/time for the item
+        *
+        * Returns the date formatted in the localized language. To display in
+        * languages other than the server's default, you need to change the locale
+        * with {@link http://php.net/setlocale setlocale()}. The available
+        * localizations depend on which ones are installed on your web server.
+        *
+        * @since 1.0
+        *
+        * @param string $date_format Supports any PHP date format from {@see http://php.net/strftime} (empty for the raw data)
+        * @return int|string|null
+        */
        public function get_local_date($date_format = '%c')
        {
                if (!$date_format)
@@ -598,6 +878,52 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get the posting date/time for the item (UTC time)
+        *
+        * @see get_date
+        * @param string $date_format Supports any PHP date format from {@see http://php.net/date}
+        * @return int|string|null
+        */
+       public function get_gmdate($date_format = 'j F Y, g:i a')
+       {
+               $date = $this->get_date('U');
+               if ($date === null)
+               {
+                       return null;
+               }
+
+               return gmdate($date_format, $date);
+       }
+
+       /**
+        * Get the update date/time for the item (UTC time)
+        *
+        * @see get_updated_date
+        * @param string $date_format Supports any PHP date format from {@see http://php.net/date}
+        * @return int|string|null
+        */
+       public function get_updated_gmdate($date_format = 'j F Y, g:i a')
+       {
+               $date = $this->get_updated_date('U');
+               if ($date === null)
+               {
+                       return null;
+               }
+
+               return gmdate($date_format, $date);
+       }
+
+       /**
+        * Get the permalink for the item
+        *
+        * Returns the first link available with a relationship of "alternate".
+        * Identical to {@see get_link()} with key 0
+        *
+        * @see get_link
+        * @since 0.8
+        * @return string|null Permalink URL
+        */
        public function get_permalink()
        {
                $link = $this->get_link();
@@ -616,6 +942,14 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get a single link for the item
+        *
+        * @since Beta 3
+        * @param int $key The link that you want to return.  Remember that arrays begin with 0, not 1
+        * @param string $rel The relationship of the link to return
+        * @return string|null Link URL
+        */
        public function get_link($key = 0, $rel = 'alternate')
        {
                $links = $this->get_links($rel);
@@ -629,6 +963,15 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get all links for the item
+        *
+        * Uses `<atom:link>`, `<link>` or `<guid>`
+        *
+        * @since Beta 2
+        * @param string $rel The relationship of links to return
+        * @return array|null Links found for the item (strings)
+        */
        public function get_links($rel = 'alternate')
        {
                if (!isset($this->data['links']))
@@ -674,7 +1017,7 @@ class SimplePie_Item
                        $keys = array_keys($this->data['links']);
                        foreach ($keys as $key)
                        {
-                               if (SimplePie_Misc::is_isegment_nz_nc($key))
+                               if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
                                {
                                        if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
                                        {
@@ -704,7 +1047,14 @@ class SimplePie_Item
        }
 
        /**
+        * Get an enclosure from the item
+        *
+        * Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS.
+        *
+        * @since Beta 2
         * @todo Add ability to prefer one type of content over another (in a media group).
+        * @param int $key The enclosure that you want to return.  Remember that arrays begin with 0, not 1
+        * @return SimplePie_Enclosure|null
         */
        public function get_enclosure($key = 0, $prefer = null)
        {
@@ -720,14 +1070,18 @@ class SimplePie_Item
        }
 
        /**
-        * Grabs all available enclosures (podcasts, etc.)
+        * Get all available enclosures (podcasts, etc.)
         *
         * Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS.
         *
-        * At this point, we're pretty much assuming that all enclosures for an item are the same content.  Anything else is too complicated to properly support.
+        * At this point, we're pretty much assuming that all enclosures for an item
+        * are the same content.  Anything else is too complicated to
+        * properly support.
         *
+        * @since Beta 2
         * @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).
+        * @return array|null List of SimplePie_Enclosure items
         */
        public function get_enclosures()
        {
@@ -783,7 +1137,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[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text));
                                }
                        }
                        elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
@@ -815,12 +1169,12 @@ 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[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text));
                                }
                        }
                        if (is_array($captions_parent))
                        {
-                               $captions_parent = array_values(SimplePie_Misc::array_unique($captions_parent));
+                               $captions_parent = array_values(array_unique($captions_parent));
                        }
 
                        // CATEGORIES
@@ -845,7 +1199,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[] = $this->registry->create('Category', array($term, $scheme, $label));
                        }
                        foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category)
                        {
@@ -868,7 +1222,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[] = $this->registry->create('Category', array($term, $scheme, $label));
                        }
                        foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'category') as $category)
                        {
@@ -879,7 +1233,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[] = $this->registry->create('Category', array($term, $scheme, $label));
 
                                if (isset($category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category']))
                                {
@@ -889,13 +1243,13 @@ class SimplePie_Item
                                                {
                                                        $label = $this->sanitize($subcategory['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT);
                                                }
-                                               $categories_parent[] = new $this->feed->category_class($term, $scheme, $label);
+                                               $categories_parent[] = $this->registry->create('Category', array($term, $scheme, $label));
                                        }
                                }
                        }
                        if (is_array($categories_parent))
                        {
-                               $categories_parent = array_values(SimplePie_Misc::array_unique($categories_parent));
+                               $categories_parent = array_values(array_unique($categories_parent));
                        }
 
                        // COPYRIGHT
@@ -911,7 +1265,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 = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
                        }
                        elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
                        {
@@ -925,7 +1279,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 = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
                        }
 
                        // CREDITS
@@ -952,7 +1306,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[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name));
                                }
                        }
                        elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
@@ -978,12 +1332,12 @@ 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[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name));
                                }
                        }
                        if (is_array($credits_parent))
                        {
-                               $credits_parent = array_values(SimplePie_Misc::array_unique($credits_parent));
+                               $credits_parent = array_values(array_unique($credits_parent));
                        }
 
                        // DESCRIPTION
@@ -1075,7 +1429,7 @@ class SimplePie_Item
                        }
                        if (is_array($hashes_parent))
                        {
-                               $hashes_parent = array_values(SimplePie_Misc::array_unique($hashes_parent));
+                               $hashes_parent = array_values(array_unique($hashes_parent));
                        }
 
                        // KEYWORDS
@@ -1129,7 +1483,7 @@ class SimplePie_Item
                        }
                        if (is_array($keywords_parent))
                        {
-                               $keywords_parent = array_values(SimplePie_Misc::array_unique($keywords_parent));
+                               $keywords_parent = array_values(array_unique($keywords_parent));
                        }
 
                        // PLAYER
@@ -1167,7 +1521,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[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
                                }
                        }
                        elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
@@ -1180,7 +1534,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[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
                                }
                        }
                        elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating'))
@@ -1201,7 +1555,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[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
                                }
                        }
                        elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
@@ -1214,12 +1568,12 @@ 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[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
                                }
                        }
                        if (is_array($ratings_parent))
                        {
-                               $ratings_parent = array_values(SimplePie_Misc::array_unique($ratings_parent));
+                               $ratings_parent = array_values(array_unique($ratings_parent));
                        }
 
                        // RESTRICTIONS
@@ -1242,7 +1596,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[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
                                }
                        }
                        elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
@@ -1256,7 +1610,7 @@ class SimplePie_Item
                                        {
                                                $restriction_relationship = 'deny';
                                        }
-                                       $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+                                       $restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
                                }
                        }
                        elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction'))
@@ -1278,7 +1632,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[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
                                }
                        }
                        elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
@@ -1292,12 +1646,16 @@ class SimplePie_Item
                                        {
                                                $restriction_relationship = 'deny';
                                        }
-                                       $restrictions_parent[] = new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
+                                       $restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
                                }
                        }
                        if (is_array($restrictions_parent))
                        {
-                               $restrictions_parent = array_values(SimplePie_Misc::array_unique($restrictions_parent));
+                               $restrictions_parent = array_values(array_unique($restrictions_parent));
+                       }
+                       else
+                       {
+                               $restrictions_parent = array(new SimplePie_Restriction('allow', null, 'default'));
                        }
 
                        // THUMBNAILS
@@ -1498,11 +1856,11 @@ 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[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text));
                                                                }
                                                                if (is_array($captions))
                                                                {
-                                                                       $captions = array_values(SimplePie_Misc::array_unique($captions));
+                                                                       $captions = array_values(array_unique($captions));
                                                                }
                                                        }
                                                        elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
@@ -1534,11 +1892,11 @@ 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[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text));
                                                                }
                                                                if (is_array($captions))
                                                                {
-                                                                       $captions = array_values(SimplePie_Misc::array_unique($captions));
+                                                                       $captions = array_values(array_unique($captions));
                                                                }
                                                        }
                                                        else
@@ -1570,7 +1928,7 @@ class SimplePie_Item
                                                                        {
                                                                                $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
                                                                        }
-                                                                       $categories[] = new $this->feed->category_class($term, $scheme, $label);
+                                                                       $categories[] = $this->registry->create('Category', array($term, $scheme, $label));
                                                                }
                                                        }
                                                        if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['category']))
@@ -1596,20 +1954,20 @@ class SimplePie_Item
                                                                        {
                                                                                $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
                                                                        }
-                                                                       $categories[] = new $this->feed->category_class($term, $scheme, $label);
+                                                                       $categories[] = $this->registry->create('Category', array($term, $scheme, $label));
                                                                }
                                                        }
                                                        if (is_array($categories) && is_array($categories_parent))
                                                        {
-                                                               $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent)));
+                                                               $categories = array_values(array_unique(array_merge($categories, $categories_parent)));
                                                        }
                                                        elseif (is_array($categories))
                                                        {
-                                                               $categories = array_values(SimplePie_Misc::array_unique($categories));
+                                                               $categories = array_values(array_unique($categories));
                                                        }
                                                        elseif (is_array($categories_parent))
                                                        {
-                                                               $categories = array_values(SimplePie_Misc::array_unique($categories_parent));
+                                                               $categories = array_values(array_unique($categories_parent));
                                                        }
 
                                                        // COPYRIGHTS
@@ -1625,7 +1983,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 = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
                                                        }
                                                        elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
                                                        {
@@ -1639,7 +1997,7 @@ class SimplePie_Item
                                                                {
                                                                        $copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                                                                }
-                                                               $copyrights = new $this->feed->copyright_class($copyright_url, $copyright_label);
+                                                               $copyrights = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
                                                        }
                                                        else
                                                        {
@@ -1670,11 +2028,11 @@ 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[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name));
                                                                }
                                                                if (is_array($credits))
                                                                {
-                                                                       $credits = array_values(SimplePie_Misc::array_unique($credits));
+                                                                       $credits = array_values(array_unique($credits));
                                                                }
                                                        }
                                                        elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
@@ -1700,11 +2058,11 @@ 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[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name));
                                                                }
                                                                if (is_array($credits))
                                                                {
-                                                                       $credits = array_values(SimplePie_Misc::array_unique($credits));
+                                                                       $credits = array_values(array_unique($credits));
                                                                }
                                                        }
                                                        else
@@ -1749,7 +2107,7 @@ class SimplePie_Item
                                                                }
                                                                if (is_array($hashes))
                                                                {
-                                                                       $hashes = array_values(SimplePie_Misc::array_unique($hashes));
+                                                                       $hashes = array_values(array_unique($hashes));
                                                                }
                                                        }
                                                        elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
@@ -1774,7 +2132,7 @@ class SimplePie_Item
                                                                }
                                                                if (is_array($hashes))
                                                                {
-                                                                       $hashes = array_values(SimplePie_Misc::array_unique($hashes));
+                                                                       $hashes = array_values(array_unique($hashes));
                                                                }
                                                        }
                                                        else
@@ -1796,7 +2154,7 @@ class SimplePie_Item
                                                                }
                                                                if (is_array($keywords))
                                                                {
-                                                                       $keywords = array_values(SimplePie_Misc::array_unique($keywords));
+                                                                       $keywords = array_values(array_unique($keywords));
                                                                }
                                                        }
                                                        elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
@@ -1812,7 +2170,7 @@ class SimplePie_Item
                                                                }
                                                                if (is_array($keywords))
                                                                {
-                                                                       $keywords = array_values(SimplePie_Misc::array_unique($keywords));
+                                                                       $keywords = array_values(array_unique($keywords));
                                                                }
                                                        }
                                                        else
@@ -1853,11 +2211,11 @@ class SimplePie_Item
                                                                        {
                                                                                $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                                                                        }
-                                                                       $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
+                                                                       $ratings[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
                                                                }
                                                                if (is_array($ratings))
                                                                {
-                                                                       $ratings = array_values(SimplePie_Misc::array_unique($ratings));
+                                                                       $ratings = array_values(array_unique($ratings));
                                                                }
                                                        }
                                                        elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
@@ -1878,11 +2236,11 @@ class SimplePie_Item
                                                                        {
                                                                                $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                                                                        }
-                                                                       $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
+                                                                       $ratings[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
                                                                }
                                                                if (is_array($ratings))
                                                                {
-                                                                       $ratings = array_values(SimplePie_Misc::array_unique($ratings));
+                                                                       $ratings = array_values(array_unique($ratings));
                                                                }
                                                        }
                                                        else
@@ -1910,11 +2268,11 @@ 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[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
                                                                }
                                                                if (is_array($restrictions))
                                                                {
-                                                                       $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
+                                                                       $restrictions = array_values(array_unique($restrictions));
                                                                }
                                                        }
                                                        elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
@@ -1936,11 +2294,11 @@ 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[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
                                                                }
                                                                if (is_array($restrictions))
                                                                {
-                                                                       $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
+                                                                       $restrictions = array_values(array_unique($restrictions));
                                                                }
                                                        }
                                                        else
@@ -1957,7 +2315,7 @@ class SimplePie_Item
                                                                }
                                                                if (is_array($thumbnails))
                                                                {
-                                                                       $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
+                                                                       $thumbnails = array_values(array_unique($thumbnails));
                                                                }
                                                        }
                                                        elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
@@ -1968,7 +2326,7 @@ class SimplePie_Item
                                                                }
                                                                if (is_array($thumbnails))
                                                                {
-                                                                       $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
+                                                                       $thumbnails = array_values(array_unique($thumbnails));
                                                                }
                                                        }
                                                        else
@@ -1990,7 +2348,7 @@ class SimplePie_Item
                                                                $title = $title_parent;
                                                        }
 
-                                                       $this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, null, $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'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width));
                                                }
                                        }
                                }
@@ -2122,11 +2480,11 @@ 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[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text));
                                                        }
                                                        if (is_array($captions))
                                                        {
-                                                               $captions = array_values(SimplePie_Misc::array_unique($captions));
+                                                               $captions = array_values(array_unique($captions));
                                                        }
                                                }
                                                else
@@ -2158,20 +2516,20 @@ class SimplePie_Item
                                                                {
                                                                        $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
                                                                }
-                                                               $categories[] = new $this->feed->category_class($term, $scheme, $label);
+                                                               $categories[] = $this->registry->create('Category', array($term, $scheme, $label));
                                                        }
                                                }
                                                if (is_array($categories) && is_array($categories_parent))
                                                {
-                                                       $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent)));
+                                                       $categories = array_values(array_unique(array_merge($categories, $categories_parent)));
                                                }
                                                elseif (is_array($categories))
                                                {
-                                                       $categories = array_values(SimplePie_Misc::array_unique($categories));
+                                                       $categories = array_values(array_unique($categories));
                                                }
                                                elseif (is_array($categories_parent))
                                                {
-                                                       $categories = array_values(SimplePie_Misc::array_unique($categories_parent));
+                                                       $categories = array_values(array_unique($categories_parent));
                                                }
                                                else
                                                {
@@ -2191,7 +2549,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 = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
                                                }
                                                else
                                                {
@@ -2222,11 +2580,11 @@ 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[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name));
                                                        }
                                                        if (is_array($credits))
                                                        {
-                                                               $credits = array_values(SimplePie_Misc::array_unique($credits));
+                                                               $credits = array_values(array_unique($credits));
                                                        }
                                                }
                                                else
@@ -2267,7 +2625,7 @@ class SimplePie_Item
                                                        }
                                                        if (is_array($hashes))
                                                        {
-                                                               $hashes = array_values(SimplePie_Misc::array_unique($hashes));
+                                                               $hashes = array_values(array_unique($hashes));
                                                        }
                                                }
                                                else
@@ -2289,7 +2647,7 @@ class SimplePie_Item
                                                        }
                                                        if (is_array($keywords))
                                                        {
-                                                               $keywords = array_values(SimplePie_Misc::array_unique($keywords));
+                                                               $keywords = array_values(array_unique($keywords));
                                                        }
                                                }
                                                else
@@ -2326,11 +2684,11 @@ class SimplePie_Item
                                                                {
                                                                        $rating_value = $this->sanitize($rating['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                                                                }
-                                                               $ratings[] = new $this->feed->rating_class($rating_scheme, $rating_value);
+                                                               $ratings[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
                                                        }
                                                        if (is_array($ratings))
                                                        {
-                                                               $ratings = array_values(SimplePie_Misc::array_unique($ratings));
+                                                               $ratings = array_values(array_unique($ratings));
                                                        }
                                                }
                                                else
@@ -2358,11 +2716,11 @@ 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[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
                                                        }
                                                        if (is_array($restrictions))
                                                        {
-                                                               $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
+                                                               $restrictions = array_values(array_unique($restrictions));
                                                        }
                                                }
                                                else
@@ -2379,7 +2737,7 @@ class SimplePie_Item
                                                        }
                                                        if (is_array($thumbnails))
                                                        {
-                                                               $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
+                                                               $thumbnails = array_values(array_unique($thumbnails));
                                                        }
                                                }
                                                else
@@ -2397,7 +2755,7 @@ class SimplePie_Item
                                                        $title = $title_parent;
                                                }
 
-                                               $this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, null, $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'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width));
                                        }
                                }
                        }
@@ -2433,7 +2791,7 @@ class SimplePie_Item
                                        }
 
                                        // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
-                                       $this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, null, $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'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $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));
                                }
                        }
 
@@ -2468,7 +2826,7 @@ class SimplePie_Item
                                        }
 
                                        // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
-                                       $this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, null, $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'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $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));
                                }
                        }
 
@@ -2503,17 +2861,17 @@ 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, null, $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'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width));
                                }
                        }
 
                        if (sizeof($this->data['enclosures']) === 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width))
                        {
                                // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
-                               $this->data['enclosures'][] = new $this->feed->enclosure_class($url, $type, $length, null, $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'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width));
                        }
 
-                       $this->data['enclosures'] = array_values(SimplePie_Misc::array_unique($this->data['enclosures']));
+                       $this->data['enclosures'] = array_values(array_unique($this->data['enclosures']));
                }
                if (!empty($this->data['enclosures']))
                {
@@ -2525,6 +2883,18 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get the latitude coordinates for the item
+        *
+        * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications
+        *
+        * Uses `<geo:lat>` or `<georss:point>`
+        *
+        * @since 1.0
+        * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
+        * @link http://www.georss.org/ GeoRSS
+        * @return string|null
+        */
        public function get_latitude()
        {
                if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
@@ -2541,6 +2911,18 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get the longitude coordinates for the item
+        *
+        * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications
+        *
+        * Uses `<geo:long>`, `<geo:lon>` or `<georss:point>`
+        *
+        * @since 1.0
+        * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
+        * @link http://www.georss.org/ GeoRSS
+        * @return string|null
+        */
        public function get_longitude()
        {
                if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
@@ -2561,11 +2943,17 @@ class SimplePie_Item
                }
        }
 
+       /**
+        * Get the `<atom:source>` for the item
+        *
+        * @since 1.1
+        * @return SimplePie_Source|null
+        */
        public function get_source()
        {
                if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source'))
                {
-                       return new $this->feed->source_class($this, $return[0]);
+                       return $this->registry->create('Source', array($this, $return[0]));
                }
                else
                {