<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[11938] trunk/wp-includes/class-simplepie.php: Update SimplePie to 1.2.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/11938">11938</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2009-09-15 16:33:59 +0000 (Tue, 15 Sep 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update SimplePie to 1.2. fixes <a href="http://trac.wordpress.org/ticket/10392">#10392</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesclasssimplepiephp">trunk/wp-includes/class-simplepie.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesclasssimplepiephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-simplepie.php (11937 => 11938)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-simplepie.php        2009-09-15 15:57:49 UTC (rev 11937)
+++ trunk/wp-includes/class-simplepie.php        2009-09-15 16:33:59 UTC (rev 11938)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx"> * A PHP-Based RSS and Atom Feed Framework.
</span><span class="cx"> * Takes the hard work out of managing a complete RSS/Atom solution.
</span><span class="cx"> *
</span><del>- * Copyright (c) 2004-2008, Ryan Parman and Geoffrey Sneddon
</del><ins>+ * Copyright (c) 2004-2009, Ryan Parman and Geoffrey Sneddon
</ins><span class="cx"> * All rights reserved.
</span><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without modification, are
</span><span class="lines">@@ -33,8 +33,8 @@
</span><span class="cx"> * POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> *
</span><span class="cx"> * @package SimplePie
</span><del>- * @version 1.1.3
- * @copyright 2004-2008 Ryan Parman, Geoffrey Sneddon
</del><ins>+ * @version 1.2
+ * @copyright 2004-2009 Ryan Parman, Geoffrey Sneddon
</ins><span class="cx"> * @author Ryan Parman
</span><span class="cx"> * @author Geoffrey Sneddon
</span><span class="cx"> * @link http://simplepie.org/ SimplePie
</span><span class="lines">@@ -51,12 +51,12 @@
</span><span class="cx"> /**
</span><span class="cx"> * SimplePie Version
</span><span class="cx"> */
</span><del>-define('SIMPLEPIE_VERSION', '1.1.3');
</del><ins>+define('SIMPLEPIE_VERSION', '1.2');
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * SimplePie Build
</span><span class="cx"> */
</span><del>-define('SIMPLEPIE_BUILD', 20081219);
</del><ins>+define('SIMPLEPIE_BUILD', '20090627192103');
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * SimplePie Website URL
</span><span class="lines">@@ -242,6 +242,21 @@
</span><span class="cx"> define('SIMPLEPIE_CONSTRUCT_ALL', 63);
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Don't change case
+ */
+define('SIMPLEPIE_SAME_CASE', 1);
+
+/**
+ * Change to lowercase
+ */
+define('SIMPLEPIE_LOWERCASE', 2);
+
+/**
+ * Change to uppercase
+ */
+define('SIMPLEPIE_UPPERCASE', 4);
+
+/**
</ins><span class="cx"> * PCRE for HTML attributes
</span><span class="cx"> */
</span><span class="cx"> define('SIMPLEPIE_PCRE_HTML_ATTRIBUTE', '((?:[\x09\x0A\x0B\x0C\x0D\x20]+[^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?)*)[\x09\x0A\x0B\x0C\x0D\x20]*');
</span><span class="lines">@@ -376,11 +391,6 @@
</span><span class="cx"> * SimplePie
</span><span class="cx"> *
</span><span class="cx"> * @package SimplePie
</span><del>- * @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.)
</del><span class="cx"> */
</span><span class="cx"> class SimplePie
</span><span class="cx"> {
</span><span class="lines">@@ -639,6 +649,13 @@
</span><span class="cx">         var $max_checked_feeds = 10;
</span><span class="cx">
</span><span class="cx">         /**
</span><ins>+         * @var array All the feeds found during the autodiscovery process
+         * @see SimplePie::get_all_discovered_feeds()
+         * @access private
+         */
+        var $all_discovered_feeds = array();
+
+        /**
</ins><span class="cx">          * @var string Web-accessible path to the handler_favicon.php file.
</span><span class="cx">          * @see SimplePie::set_favicon_handler()
</span><span class="cx">          * @access private
</span><span class="lines">@@ -1440,7 +1457,7 @@
</span><span class="cx">          */
</span><span class="cx">         function set_favicon_handler($page = false, $qs = 'i')
</span><span class="cx">         {
</span><del>-                if ($page != false)
</del><ins>+                if ($page !== false)
</ins><span class="cx">                 {
</span><span class="cx">                         $this->favicon_handler = $page . '?' . $qs . '=';
</span><span class="cx">                 }
</span><span class="lines">@@ -1459,7 +1476,7 @@
</span><span class="cx">          */
</span><span class="cx">         function set_image_handler($page = false, $qs = 'i')
</span><span class="cx">         {
</span><del>-                if ($page != false)
</del><ins>+                if ($page !== false)
</ins><span class="cx">                 {
</span><span class="cx">                         $this->sanitize->set_image_handler($page . '?' . $qs . '=');
</span><span class="cx">                 }
</span><span class="lines">@@ -1482,45 +1499,31 @@
</span><span class="cx">
</span><span class="cx">         function init()
</span><span class="cx">         {
</span><ins>+                // Check absolute bare minimum requirements.
</ins><span class="cx">                 if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.3.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre'))
</span><span class="cx">                 {
</span><span class="cx">                         return false;
</span><span class="cx">                 }
</span><del>-                if (isset($_GET[$this->javascript]))
</del><ins>+                // 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'))
</ins><span class="cx">                 {
</span><del>-                        if (function_exists('ob_gzhandler'))
</del><ins>+                        static $xml_is_sane = null;
+                        if ($xml_is_sane === null)
</ins><span class="cx">                         {
</span><del>-                                ob_start('ob_gzhandler');
</del><ins>+                                $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']);
</ins><span class="cx">                         }
</span><del>-                        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>');
-}
</del><ins>+                        if (!$xml_is_sane)
+                        {
+                                return false;
+                        }
+                }
</ins><span class="cx">
</span><del>-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>');
-}
-
-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
</del><ins>+                if (isset($_GET[$this->javascript]))
+                {
+                        SimplePie_Misc::output_javascript();
</ins><span class="cx">                         exit;
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="lines">@@ -1550,13 +1553,13 @@
</span><span class="cx">                                         if (!empty($this->data))
</span><span class="cx">                                         {
</span><span class="cx">                                                 // If the cache is for an outdated build of SimplePie
</span><del>-                                                if (!isset($this->data['build']) || $this->data['build'] != SIMPLEPIE_BUILD)
</del><ins>+                                                if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD)
</ins><span class="cx">                                                 {
</span><span class="cx">                                                         $cache->unlink();
</span><span class="cx">                                                         $this->data = array();
</span><span class="cx">                                                 }
</span><span class="cx">                                                 // If we've hit a collision just rerun it with caching disabled
</span><del>-                                                elseif (isset($this->data['url']) && $this->data['url'] != $this->feed_url)
</del><ins>+                                                elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url)
</ins><span class="cx">                                                 {
</span><span class="cx">                                                         $cache = false;
</span><span class="cx">                                                         $this->data = array();
</span><span class="lines">@@ -1568,7 +1571,7 @@
</span><span class="cx">                                                         if ($cache->mtime() + $this->autodiscovery_cache_duration > time())
</span><span class="cx">                                                         {
</span><span class="cx">                                                                 // Do not need to do feed autodiscovery yet.
</span><del>-                                                                if ($this->data['feed_url'] == $this->data['url'])
</del><ins>+                                                                if ($this->data['feed_url'] === $this->data['url'])
</ins><span class="cx">                                                                 {
</span><span class="cx">                                                                         $cache->unlink();
</span><span class="cx">                                                                         $this->data = array();
</span><span class="lines">@@ -1598,7 +1601,7 @@
</span><span class="cx">                                                                 $file =& new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen);
</span><span class="cx">                                                                 if ($file->success)
</span><span class="cx">                                                                 {
</span><del>-                                                                        if ($file->status_code == 304)
</del><ins>+                                                                        if ($file->status_code === 304)
</ins><span class="cx">                                                                         {
</span><span class="cx">                                                                                 $cache->touch();
</span><span class="cx">                                                                                 return true;
</span><span class="lines">@@ -1630,7 +1633,7 @@
</span><span class="cx">                                 // 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.
</span><span class="cx">                                 if (!isset($file))
</span><span class="cx">                                 {
</span><del>-                                        if (is_a($this->file, 'SimplePie_File') && $this->file->url == $this->feed_url)
</del><ins>+                                        if (is_a($this->file, 'SimplePie_File') && $this->file->url === $this->feed_url)
</ins><span class="cx">                                         {
</span><span class="cx">                                                 $file =& $this->file;
</span><span class="cx">                                         }
</span><span class="lines">@@ -1640,7 +1643,7 @@
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx">                                 // If the file connection has an error, set SimplePie::error to that and quit
</span><del>-                                if (!$file->success)
</del><ins>+                                if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
</ins><span class="cx">                                 {
</span><span class="cx">                                         $this->error = $file->error;
</span><span class="cx">                                         if (!empty($this->data))
</span><span class="lines">@@ -1661,14 +1664,14 @@
</span><span class="cx">                                         {
</span><span class="cx">                                                 // We need to unset this so that if SimplePie::set_file() has been called that object is untouched
</span><span class="cx">                                                 unset($file);
</span><del>-                                                if ($file = $locate->find($this->autodiscovery))
</del><ins>+                                                if ($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds))
</ins><span class="cx">                                                 {
</span><span class="cx">                                                         if ($cache)
</span><span class="cx">                                                         {
</span><span class="cx">                                                                 $this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD);
</span><span class="cx">                                                                 if (!$cache->save($this))
</span><span class="cx">                                                                 {
</span><del>-                                                                        trigger_error("$cache->name is not writeable", E_USER_WARNING);
</del><ins>+                                                                        trigger_error("$this->cache_location is not writeable", E_USER_WARNING);
</ins><span class="cx">                                                                 }
</span><span class="cx">                                                                 $cache = call_user_func(array($this->cache_class, 'create'), $this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc');
</span><span class="cx">                                                         }
</span><span class="lines">@@ -1786,8 +1789,15 @@
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><del>-                        // 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());
</del><ins>+                        if(isset($parser))
+                        {
+                                // We have an error, just set SimplePie_Misc::error to it and quit
+                                $this->error = sprintf('XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
+                        }
+                        else
+                        {
+                                $this->error = 'The data could not be converted to UTF-8';
+                        }
</ins><span class="cx">                         SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__);
</span><span class="cx">                         return false;
</span><span class="cx">                 }
</span><span class="lines">@@ -1882,18 +1892,18 @@
</span><span class="cx">                                         $this->data['type'] &= SIMPLEPIE_TYPE_RSS_090;
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><del>-                        elseif (isset($this->data['child']['']['rss']))
</del><ins>+                        elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss']))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL;
</span><del>-                                if (isset($this->data['child']['']['rss'][0]['attribs']['']['version']))
</del><ins>+                                if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
</ins><span class="cx">                                 {
</span><del>-                                        switch (trim($this->data['child']['']['rss'][0]['attribs']['']['version']))
</del><ins>+                                        switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
</ins><span class="cx">                                         {
</span><span class="cx">                                                 case '0.91':
</span><span class="cx">                                                         $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091;
</span><del>-                                                        if (isset($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
</del><ins>+                                                        if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
</ins><span class="cx">                                                         {
</span><del>-                                                                switch (trim($this->data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
</del><ins>+                                                                switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
</ins><span class="cx">                                                                 {
</span><span class="cx">                                                                         case '0':
</span><span class="cx">                                                                                 $this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
</span><span class="lines">@@ -1962,7 +1972,7 @@
</span><span class="cx">                                 {
</span><span class="cx">                                         $file =& new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
</span><span class="cx">
</span><del>-                                        if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
</del><ins>+                                        if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
</ins><span class="cx">                                         {
</span><span class="cx">                                                 $sniffer =& new $this->content_type_sniffer_class($file);
</span><span class="cx">                                                 if (substr($sniffer->get_type(), 0, 6) === 'image/')
</span><span class="lines">@@ -1977,6 +1987,11 @@
</span><span class="cx">                                                                 return $this->sanitize($favicon, SIMPLEPIE_CONSTRUCT_IRI);
</span><span class="cx">                                                         }
</span><span class="cx">                                                 }
</span><ins>+                                                // not an image
+                                                else
+                                                {
+                                                        return false;
+                                                }
</ins><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="lines">@@ -2021,7 +2036,7 @@
</span><span class="cx">         {
</span><span class="cx">                 if ($this->feed_url !== null)
</span><span class="cx">                 {
</span><del>-                        return 'outlook' . $this->sanitize(SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI);
</del><ins>+                        return $this->sanitize('outlook' . SimplePie_Misc::fix_protocol($this->feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI);
</ins><span class="cx">                 }
</span><span class="cx">                 else
</span><span class="cx">                 {
</span><span class="lines">@@ -2066,12 +2081,12 @@
</span><span class="cx">         {
</span><span class="cx">                 if ($this->subscribe_url())
</span><span class="cx">                 {
</span><del>-                        $return = $this->sanitize($feed_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->feed_url);
</del><ins>+                        $return = $feed_url . rawurlencode($this->feed_url);
</ins><span class="cx">                         if ($site_url !== null && $this->get_link() !== null)
</span><span class="cx">                         {
</span><del>-                                $return .= $this->sanitize($site_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_link());
</del><ins>+                                $return .= $site_url . rawurlencode($this->get_link());
</ins><span class="cx">                         }
</span><del>-                        return $return;
</del><ins>+                        return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI);
</ins><span class="cx">                 }
</span><span class="cx">                 else
</span><span class="cx">                 {
</span><span class="lines">@@ -2086,7 +2101,7 @@
</span><span class="cx">
</span><span class="cx">         function subscribe_bloglines()
</span><span class="cx">         {
</span><del>-                return urldecode($this->subscribe_service('http://www.bloglines.com/sub/'));
</del><ins>+                return $this->subscribe_service('http://www.bloglines.com/sub/');
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function subscribe_eskobo()
</span><span class="lines">@@ -2180,9 +2195,9 @@
</span><span class="cx">                 }
</span><span class="cx">                 if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
</span><span class="cx">                 {
</span><del>-                        if (isset($this->data['child']['']['rss'][0]['child'][$namespace][$tag]))
</del><ins>+                        if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag]))
</ins><span class="cx">                         {
</span><del>-                                return $this->data['child']['']['rss'][0]['child'][$namespace][$tag];
</del><ins>+                                return $this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag];
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">                 return null;
</span><span class="lines">@@ -2220,7 +2235,7 @@
</span><span class="cx">                 }
</span><span class="cx">                 if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
</span><span class="cx">                 {
</span><del>-                        if ($channel = $this->get_feed_tags('', 'channel'))
</del><ins>+                        if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'channel'))
</ins><span class="cx">                         {
</span><span class="cx">                                 if (isset($channel[0]['child'][$namespace][$tag]))
</span><span class="cx">                                 {
</span><span class="lines">@@ -2256,7 +2271,7 @@
</span><span class="cx">                 }
</span><span class="cx">                 if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
</span><span class="cx">                 {
</span><del>-                        if ($image = $this->get_channel_tags('', 'image'))
</del><ins>+                        if ($image = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'image'))
</ins><span class="cx">                         {
</span><span class="cx">                                 if (isset($image[0]['child'][$namespace][$tag]))
</span><span class="cx">                                 {
</span><span class="lines">@@ -2306,7 +2321,7 @@
</span><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this->get_channel_tags('', 'title'))
</del><ins>+                elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
</span><span class="cx">                 }
</span><span class="lines">@@ -2360,9 +2375,20 @@
</span><span class="cx">                         }
</span><span class="cx">                         $categories[] =& new $this->category_class($term, $scheme, $label);
</span><span class="cx">                 }
</span><del>-                foreach ((array) $this->get_channel_tags('', 'category') as $category)
</del><ins>+                foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
</ins><span class="cx">                 {
</span><del>-                        $categories[] =& new $this->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
</del><ins>+                        // 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);
</ins><span class="cx">                 }
</span><span class="cx">                 foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
</span><span class="cx">                 {
</span><span class="lines">@@ -2594,7 +2620,7 @@
</span><span class="cx">                         {
</span><span class="cx">                                 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
</span><span class="cx">                         }
</span><del>-                        if ($links = $this->get_channel_tags('', 'link'))
</del><ins>+                        if ($links = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
</span><span class="cx">                         }
</span><span class="lines">@@ -2614,7 +2640,7 @@
</span><span class="cx">                                                 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><del>-                                elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
</del><ins>+                                elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
</ins><span class="cx">                                 {
</span><span class="cx">                                         $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
</span><span class="cx">                                 }
</span><span class="lines">@@ -2632,6 +2658,11 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        function get_all_discovered_feeds()
+        {
+                return $this->all_discovered_feeds;
+        }
+
</ins><span class="cx">         function get_description()
</span><span class="cx">         {
</span><span class="cx">                 if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
</span><span class="lines">@@ -2650,9 +2681,9 @@
</span><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this->get_channel_tags('', 'description'))
</del><ins>+                elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
</ins><span class="cx">                 {
</span><del>-                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
</del><ins>+                        return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
</ins><span class="cx">                 }
</span><span class="cx">                 elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
</span><span class="cx">                 {
</span><span class="lines">@@ -2686,7 +2717,7 @@
</span><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this->get_channel_tags('', 'copyright'))
</del><ins>+                elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
</span><span class="cx">                 }
</span><span class="lines">@@ -2706,7 +2737,7 @@
</span><span class="cx">
</span><span class="cx">         function get_language()
</span><span class="cx">         {
</span><del>-                if ($return = $this->get_channel_tags('', 'language'))
</del><ins>+                if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
</span><span class="cx">                 }
</span><span class="lines">@@ -2786,7 +2817,7 @@
</span><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this->get_image_tags('', 'title'))
</del><ins>+                elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
</span><span class="cx">                 }
</span><span class="lines">@@ -2826,7 +2857,7 @@
</span><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this->get_image_tags('', 'url'))
</del><ins>+                elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
</span><span class="cx">                 }
</span><span class="lines">@@ -2846,7 +2877,7 @@
</span><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this->get_image_tags('', 'link'))
</del><ins>+                elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
</span><span class="cx">                 }
</span><span class="lines">@@ -2858,11 +2889,11 @@
</span><span class="cx">
</span><span class="cx">         function get_image_width()
</span><span class="cx">         {
</span><del>-                if ($return = $this->get_image_tags('', 'width'))
</del><ins>+                if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width'))
</ins><span class="cx">                 {
</span><span class="cx">                         return round($return[0]['data']);
</span><span class="cx">                 }
</span><del>-                elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
</del><ins>+                elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
</ins><span class="cx">                 {
</span><span class="cx">                         return 88.0;
</span><span class="cx">                 }
</span><span class="lines">@@ -2874,11 +2905,11 @@
</span><span class="cx">
</span><span class="cx">         function get_image_height()
</span><span class="cx">         {
</span><del>-                if ($return = $this->get_image_tags('', 'height'))
</del><ins>+                if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height'))
</ins><span class="cx">                 {
</span><span class="cx">                         return round($return[0]['data']);
</span><span class="cx">                 }
</span><del>-                elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags('', 'url'))
</del><ins>+                elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
</ins><span class="cx">                 {
</span><span class="cx">                         return 31.0;
</span><span class="cx">                 }
</span><span class="lines">@@ -2890,8 +2921,9 @@
</span><span class="cx">
</span><span class="cx">         function get_item_quantity($max = 0)
</span><span class="cx">         {
</span><ins>+                $max = (int) $max;
</ins><span class="cx">                 $qty = count($this->get_items());
</span><del>-                if ($max == 0)
</del><ins>+                if ($max === 0)
</ins><span class="cx">                 {
</span><span class="cx">                         return $qty;
</span><span class="cx">                 }
</span><span class="lines">@@ -2916,58 +2948,62 @@
</span><span class="cx">
</span><span class="cx">         function get_items($start = 0, $end = 0)
</span><span class="cx">         {
</span><del>-                if (!empty($this->multifeed_objects))
</del><ins>+                if (!isset($this->data['items']))
</ins><span class="cx">                 {
</span><del>-                        return SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
-                }
-                elseif (!isset($this->data['items']))
-                {
-                        if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
</del><ins>+                        if (!empty($this->multifeed_objects))
</ins><span class="cx">                         {
</span><del>-                                $keys = array_keys($items);
-                                foreach ($keys as $key)
-                                {
-                                        $this->data['items'][] =& new $this->item_class($this, $items[$key]);
-                                }
</del><ins>+                                $this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
</ins><span class="cx">                         }
</span><del>-                        if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
</del><ins>+                        else
</ins><span class="cx">                         {
</span><del>-                                $keys = array_keys($items);
-                                foreach ($keys as $key)
</del><ins>+                                $this->data['items'] = array();
+                                if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
</ins><span class="cx">                                 {
</span><del>-                                        $this->data['items'][] =& new $this->item_class($this, $items[$key]);
</del><ins>+                                        $keys = array_keys($items);
+                                        foreach ($keys as $key)
+                                        {
+                                                $this->data['items'][] =& new $this->item_class($this, $items[$key]);
+                                        }
</ins><span class="cx">                                 }
</span><del>-                        }
-                        if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
-                        {
-                                $keys = array_keys($items);
-                                foreach ($keys as $key)
</del><ins>+                                if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
</ins><span class="cx">                                 {
</span><del>-                                        $this->data['items'][] =& new $this->item_class($this, $items[$key]);
</del><ins>+                                        $keys = array_keys($items);
+                                        foreach ($keys as $key)
+                                        {
+                                                $this->data['items'][] =& new $this->item_class($this, $items[$key]);
+                                        }
</ins><span class="cx">                                 }
</span><del>-                        }
-                        if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
-                        {
-                                $keys = array_keys($items);
-                                foreach ($keys as $key)
</del><ins>+                                if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
</ins><span class="cx">                                 {
</span><del>-                                        $this->data['items'][] =& new $this->item_class($this, $items[$key]);
</del><ins>+                                        $keys = array_keys($items);
+                                        foreach ($keys as $key)
+                                        {
+                                                $this->data['items'][] =& new $this->item_class($this, $items[$key]);
+                                        }
</ins><span class="cx">                                 }
</span><del>-                        }
-                        if ($items = $this->get_channel_tags('', 'item'))
-                        {
-                                $keys = array_keys($items);
-                                foreach ($keys as $key)
</del><ins>+                                if ($items = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
</ins><span class="cx">                                 {
</span><del>-                                        $this->data['items'][] =& new $this->item_class($this, $items[$key]);
</del><ins>+                                        $keys = array_keys($items);
+                                        foreach ($keys as $key)
+                                        {
+                                                $this->data['items'][] =& new $this->item_class($this, $items[$key]);
+                                        }
</ins><span class="cx">                                 }
</span><ins>+                                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]);
+                                        }
+                                }
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 if (!empty($this->data['items']))
</span><span class="cx">                 {
</span><span class="cx">                         // If we want to order it by date, check if all items have a date, and then sort it
</span><del>-                        if ($this->order_by_date)
</del><ins>+                        if ($this->order_by_date && empty($this->multifeed_objects))
</ins><span class="cx">                         {
</span><span class="cx">                                 if (!isset($this->data['ordered_items']))
</span><span class="cx">                                 {
</span><span class="lines">@@ -2995,7 +3031,7 @@
</span><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         // Slice the data as desired
</span><del>-                        if ($end == 0)
</del><ins>+                        if ($end === 0)
</ins><span class="cx">                         {
</span><span class="cx">                                 return array_slice($items, $start);
</span><span class="cx">                         }
</span><span class="lines">@@ -3010,11 +3046,17 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        /**
+         * @static
+         */
</ins><span class="cx">         function sort_items($a, $b)
</span><span class="cx">         {
</span><span class="cx">                 return $a->get_date('U') <= $b->get_date('U');
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        /**
+         * @static
+         */
</ins><span class="cx">         function merge_items($urls, $start = 0, $end = 0, $limit = 0)
</span><span class="cx">         {
</span><span class="cx">                 if (is_array($urls) && sizeof($urls) > 0)
</span><span class="lines">@@ -3047,7 +3089,7 @@
</span><span class="cx">                                 usort($items, array('SimplePie', 'sort_items'));
</span><span class="cx">                         }
</span><span class="cx">
</span><del>-                        if ($end == 0)
</del><ins>+                        if ($end === 0)
</ins><span class="cx">                         {
</span><span class="cx">                                 return array_slice($items, $start);
</span><span class="cx">                         }
</span><span class="lines">@@ -3130,7 +3172,7 @@
</span><span class="cx">                         {
</span><span class="cx">                                 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
</span><span class="cx">                         }
</span><del>-                        elseif ($return = $this->get_item_tags('', 'guid'))
</del><ins>+                        elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
</ins><span class="cx">                         {
</span><span class="cx">                                 return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
</span><span class="cx">                         }
</span><span class="lines">@@ -3181,7 +3223,7 @@
</span><span class="cx">                         {
</span><span class="cx">                                 $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
</span><span class="cx">                         }
</span><del>-                        elseif ($return = $this->get_item_tags('', 'title'))
</del><ins>+                        elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
</span><span class="cx">                         }
</span><span class="lines">@@ -3215,7 +3257,7 @@
</span><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this->get_item_tags('', 'description'))
</del><ins>+                elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
</span><span class="cx">                 }
</span><span class="lines">@@ -3305,9 +3347,20 @@
</span><span class="cx">                         }
</span><span class="cx">                         $categories[] =& new $this->feed->category_class($term, $scheme, $label);
</span><span class="cx">                 }
</span><del>-                foreach ((array) $this->get_item_tags('', 'category') as $category)
</del><ins>+                foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
</ins><span class="cx">                 {
</span><del>-                        $categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
</del><ins>+                        // 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);
</ins><span class="cx">                 }
</span><span class="cx">                 foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
</span><span class="cx">                 {
</span><span class="lines">@@ -3412,9 +3465,6 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        /**
-         * @todo Atom inheritance (item author, source author, feed author)
-         */
</del><span class="cx">         function get_authors()
</span><span class="cx">         {
</span><span class="cx">                 $authors = array();
</span><span class="lines">@@ -3462,7 +3512,7 @@
</span><span class="cx">                                 $authors[] =& new $this->feed->author_class($name, $url, $email);
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-                if ($author = $this->get_item_tags('', 'author'))
</del><ins>+                if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author'))
</ins><span class="cx">                 {
</span><span class="cx">                         $authors[] =& new $this->feed->author_class(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
</span><span class="cx">                 }
</span><span class="lines">@@ -3541,7 +3591,7 @@
</span><span class="cx">                         {
</span><span class="cx">                                 $this->data['date']['raw'] = $return[0]['data'];
</span><span class="cx">                         }
</span><del>-                        elseif ($return = $this->get_item_tags('', 'pubDate'))
</del><ins>+                        elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate'))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this->data['date']['raw'] = $return[0]['data'];
</span><span class="cx">                         }
</span><span class="lines">@@ -3662,13 +3712,13 @@
</span><span class="cx">                         {
</span><span class="cx">                                 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
</span><span class="cx">                         }
</span><del>-                        if ($links = $this->get_item_tags('', 'link'))
</del><ins>+                        if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
</span><span class="cx">                         }
</span><del>-                        if ($links = $this->get_item_tags('', 'guid'))
</del><ins>+                        if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
</ins><span class="cx">                         {
</span><del>-                                if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) == 'true')
</del><ins>+                                if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true')
</ins><span class="cx">                                 {
</span><span class="cx">                                         $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
</span><span class="cx">                                 }
</span><span class="lines">@@ -3689,7 +3739,7 @@
</span><span class="cx">                                                 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><del>-                                elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
</del><ins>+                                elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
</ins><span class="cx">                                 {
</span><span class="cx">                                         $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
</span><span class="cx">                                 }
</span><span class="lines">@@ -4255,7 +4305,7 @@
</span><span class="cx">                                         $restriction_relationship = 'allow';
</span><span class="cx">                                         $restriction_type = null;
</span><span class="cx">                                         $restriction_value = 'itunes';
</span><del>-                                        if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
</del><ins>+                                        if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes')
</ins><span class="cx">                                         {
</span><span class="cx">                                                 $restriction_relationship = 'deny';
</span><span class="cx">                                         }
</span><span class="lines">@@ -4291,7 +4341,7 @@
</span><span class="cx">                                         $restriction_relationship = 'allow';
</span><span class="cx">                                         $restriction_type = null;
</span><span class="cx">                                         $restriction_value = 'itunes';
</span><del>-                                        if (isset($restriction['data']) && strtolower($restriction['data']) == 'yes')
</del><ins>+                                        if (isset($restriction['data']) && strtolower($restriction['data']) === 'yes')
</ins><span class="cx">                                         {
</span><span class="cx">                                                 $restriction_relationship = 'deny';
</span><span class="cx">                                         }
</span><span class="lines">@@ -5402,7 +5452,7 @@
</span><span class="cx">
</span><span class="cx">                         foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
</span><span class="cx">                         {
</span><del>-                                if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
</del><ins>+                                if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure')
</ins><span class="cx">                                 {
</span><span class="cx">                                         // Attributes
</span><span class="cx">                                         $bitrate = null;
</span><span class="lines">@@ -5437,7 +5487,7 @@
</span><span class="cx">
</span><span class="cx">                         foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link)
</span><span class="cx">                         {
</span><del>-                                if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] == 'enclosure')
</del><ins>+                                if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure')
</ins><span class="cx">                                 {
</span><span class="cx">                                         // Attributes
</span><span class="cx">                                         $bitrate = null;
</span><span class="lines">@@ -5470,7 +5520,7 @@
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">
</span><del>-                        if ($enclosure = $this->get_item_tags('', 'enclosure'))
</del><ins>+                        if ($enclosure = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'enclosure'))
</ins><span class="cx">                         {
</span><span class="cx">                                 if (isset($enclosure[0]['attribs']['']['url']))
</span><span class="cx">                                 {
</span><span class="lines">@@ -5505,7 +5555,7 @@
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">
</span><del>-                        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))
</del><ins>+                        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))
</ins><span class="cx">                         {
</span><span class="cx">                                 // Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
</span><span class="cx">                                 $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);
</span><span class="lines">@@ -5584,16 +5634,16 @@
</span><span class="cx">         {
</span><span class="cx">                 if ($this->get_permalink() !== null)
</span><span class="cx">                 {
</span><del>-                        $return = $this->sanitize($item_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_permalink());
</del><ins>+                        $return = $item_url . rawurlencode($this->get_permalink());
</ins><span class="cx">                         if ($title_url !== null && $this->get_title() !== null)
</span><span class="cx">                         {
</span><del>-                                $return .= $this->sanitize($title_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_title());
</del><ins>+                                $return .= $title_url . rawurlencode($this->get_title());
</ins><span class="cx">                         }
</span><span class="cx">                         if ($summary_url !== null && $this->get_description() !== null)
</span><span class="cx">                         {
</span><del>-                                $return .= $this->sanitize($summary_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this->get_description());
</del><ins>+                                $return .= $summary_url . rawurlencode($this->get_description());
</ins><span class="cx">                         }
</span><del>-                        return $return;
</del><ins>+                        return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_IRI);
</ins><span class="cx">                 }
</span><span class="cx">                 else
</span><span class="cx">                 {
</span><span class="lines">@@ -5733,7 +5783,7 @@
</span><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this->get_source_tags('', 'title'))
</del><ins>+                elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
</span><span class="cx">                 }
</span><span class="lines">@@ -5787,9 +5837,20 @@
</span><span class="cx">                         }
</span><span class="cx">                         $categories[] =& new $this->item->feed->category_class($term, $scheme, $label);
</span><span class="cx">                 }
</span><del>-                foreach ((array) $this->get_source_tags('', 'category') as $category)
</del><ins>+                foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
</ins><span class="cx">                 {
</span><del>-                        $categories[] =& new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
</del><ins>+                        // 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->item->feed->category_class($term, $scheme, null);
</ins><span class="cx">                 }
</span><span class="cx">                 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
</span><span class="cx">                 {
</span><span class="lines">@@ -6021,7 +6082,7 @@
</span><span class="cx">                         {
</span><span class="cx">                                 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
</span><span class="cx">                         }
</span><del>-                        if ($links = $this->get_source_tags('', 'link'))
</del><ins>+                        if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
</span><span class="cx">                         }
</span><span class="lines">@@ -6041,7 +6102,7 @@
</span><span class="cx">                                                 $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><del>-                                elseif (substr($key, 0, 41) == SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
</del><ins>+                                elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
</ins><span class="cx">                                 {
</span><span class="cx">                                         $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
</span><span class="cx">                                 }
</span><span class="lines">@@ -6077,7 +6138,7 @@
</span><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this->get_source_tags('', 'description'))
</del><ins>+                elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
</span><span class="cx">                 }
</span><span class="lines">@@ -6113,7 +6174,7 @@
</span><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this->get_source_tags('', 'copyright'))
</del><ins>+                elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
</span><span class="cx">                 }
</span><span class="lines">@@ -6133,7 +6194,7 @@
</span><span class="cx">
</span><span class="cx">         function get_language()
</span><span class="cx">         {
</span><del>-                if ($return = $this->get_source_tags('', 'language'))
</del><ins>+                if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
</span><span class="cx">                 }
</span><span class="lines">@@ -6932,11 +6993,11 @@
</span><span class="cx">                 $mime = $mime[0];
</span><span class="cx">
</span><span class="cx">                 // Process values for 'auto'
</span><del>-                if ($width == 'auto')
</del><ins>+                if ($width === 'auto')
</ins><span class="cx">                 {
</span><del>-                        if ($mime == 'video')
</del><ins>+                        if ($mime === 'video')
</ins><span class="cx">                         {
</span><del>-                                if ($height == 'auto')
</del><ins>+                                if ($height === 'auto')
</ins><span class="cx">                                 {
</span><span class="cx">                                         $width = 480;
</span><span class="cx">                                 }
</span><span class="lines">@@ -6955,15 +7016,15 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                if ($height == 'auto')
</del><ins>+                if ($height === 'auto')
</ins><span class="cx">                 {
</span><del>-                        if ($mime == 'audio')
</del><ins>+                        if ($mime === 'audio')
</ins><span class="cx">                         {
</span><span class="cx">                                 $height = 0;
</span><span class="cx">                         }
</span><del>-                        elseif ($mime == 'video')
</del><ins>+                        elseif ($mime === 'video')
</ins><span class="cx">                         {
</span><del>-                                if ($width == 'auto')
</del><ins>+                                if ($width === 'auto')
</ins><span class="cx">                                 {
</span><span class="cx">                                         if ($widescreen)
</span><span class="cx">                                         {
</span><span class="lines">@@ -6988,17 +7049,17 @@
</span><span class="cx">                                 $height = 376;
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-                elseif ($mime == 'audio')
</del><ins>+                elseif ($mime === 'audio')
</ins><span class="cx">                 {
</span><span class="cx">                         $height = 0;
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // Set proper placeholder value
</span><del>-                if ($mime == 'audio')
</del><ins>+                if ($mime === 'audio')
</ins><span class="cx">                 {
</span><span class="cx">                         $placeholder = $audio;
</span><span class="cx">                 }
</span><del>-                elseif ($mime == 'video')
</del><ins>+                elseif ($mime === 'video')
</ins><span class="cx">                 {
</span><span class="cx">                         $placeholder = $video;
</span><span class="cx">                 }
</span><span class="lines">@@ -7017,7 +7078,7 @@
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // Odeo Feed MP3's
</span><del>-                if ($handler == 'odeo')
</del><ins>+                if ($handler === 'odeo')
</ins><span class="cx">                 {
</span><span class="cx">                         if ($native)
</span><span class="cx">                         {
</span><span class="lines">@@ -7030,7 +7091,7 @@
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // Flash
</span><del>-                elseif ($handler == 'flash')
</del><ins>+                elseif ($handler === 'flash')
</ins><span class="cx">                 {
</span><span class="cx">                         if ($native)
</span><span class="cx">                         {
</span><span class="lines">@@ -7044,7 +7105,7 @@
</span><span class="cx">
</span><span class="cx">                 // Flash Media Player file types.
</span><span class="cx">                 // Preferred handler for MP3 file types.
</span><del>-                elseif ($handler == 'fmedia' || ($handler == 'mp3' && $mediaplayer != ''))
</del><ins>+                elseif ($handler === 'fmedia' || ($handler === 'mp3' && $mediaplayer !== ''))
</ins><span class="cx">                 {
</span><span class="cx">                         $height += 20;
</span><span class="cx">                         if ($native)
</span><span class="lines">@@ -7059,15 +7120,17 @@
</span><span class="cx">
</span><span class="cx">                 // QuickTime 7 file types. Need to test with QuickTime 6.
</span><span class="cx">                 // Only handle MP3's if the Flash Media Player is not present.
</span><del>-                elseif ($handler == 'quicktime' || ($handler == 'mp3' && $mediaplayer == ''))
</del><ins>+                elseif ($handler === 'quicktime' || ($handler === 'mp3' && $mediaplayer === ''))
</ins><span class="cx">                 {
</span><span class="cx">                         $height += 16;
</span><span class="cx">                         if ($native)
</span><span class="cx">                         {
</span><del>-                                if ($placeholder != ""){
</del><ins>+                                if ($placeholder !== '')
+                                {
</ins><span class="cx">                                         $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
</span><span class="cx">                                 }
</span><del>-                                else {
</del><ins>+                                else
+                                {
</ins><span class="cx">                                         $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="lines">@@ -7078,7 +7141,7 @@
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // Windows Media
</span><del>-                elseif ($handler == 'wmedia')
</del><ins>+                elseif ($handler === 'wmedia')
</ins><span class="cx">                 {
</span><span class="cx">                         $height += 45;
</span><span class="cx">                         if ($native)
</span><span class="lines">@@ -7100,7 +7163,7 @@
</span><span class="cx">         function get_real_type($find_handler = false)
</span><span class="cx">         {
</span><span class="cx">                 // If it's Odeo, let's get it out of the way.
</span><del>-                if (substr(strtolower($this->get_link()), 0, 15) == 'http://odeo.com')
</del><ins>+                if (substr(strtolower($this->get_link()), 0, 15) === 'http://odeo.com')
</ins><span class="cx">                 {
</span><span class="cx">                         return 'odeo';
</span><span class="cx">                 }
</span><span class="lines">@@ -7628,7 +7691,7 @@
</span><span class="cx">                                 }
</span><span class="cx">
</span><span class="cx">                                 $this->headers = curl_exec($fp);
</span><del>-                                if (curl_errno($fp) == 23 || curl_errno($fp) == 61)
</del><ins>+                                if (curl_errno($fp) === 23 || curl_errno($fp) === 61)
</ins><span class="cx">                                 {
</span><span class="cx">                                         curl_setopt($fp, CURLOPT_ENCODING, 'none');
</span><span class="cx">                                         $this->headers = curl_exec($fp);
</span><span class="lines">@@ -7650,7 +7713,7 @@
</span><span class="cx">                                                 $this->headers = $parser->headers;
</span><span class="cx">                                                 $this->body = $parser->body;
</span><span class="cx">                                                 $this->status_code = $parser->status_code;
</span><del>-                                                if (($this->status_code == 300 || $this->status_code == 301 || $this->status_code == 302 || $this->status_code == 303 || $this->status_code == 307 || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
</del><ins>+                                                if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
</ins><span class="cx">                                                 {
</span><span class="cx">                                                         $this->redirects++;
</span><span class="cx">                                                         $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
</span><span class="lines">@@ -7663,7 +7726,7 @@
</span><span class="cx">                         {
</span><span class="cx">                                 $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
</span><span class="cx">                                 $url_parts = parse_url($url);
</span><del>-                                if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) == 'https')
</del><ins>+                                if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https')
</ins><span class="cx">                                 {
</span><span class="cx">                                         $url_parts['host'] = "ssl://$url_parts[host]";
</span><span class="cx">                                         $url_parts['port'] = 443;
</span><span class="lines">@@ -7731,7 +7794,7 @@
</span><span class="cx">                                                         $this->headers = $parser->headers;
</span><span class="cx">                                                         $this->body = $parser->body;
</span><span class="cx">                                                         $this->status_code = $parser->status_code;
</span><del>-                                                        if (($this->status_code == 300 || $this->status_code == 301 || $this->status_code == 302 || $this->status_code == 303 || $this->status_code == 307 || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
</del><ins>+                                                        if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
</ins><span class="cx">                                                         {
</span><span class="cx">                                                                 $this->redirects++;
</span><span class="cx">                                                                 $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
</span><span class="lines">@@ -8438,7 +8501,7 @@
</span><span class="cx">                         if ($this->flags & 8)
</span><span class="cx">                         {
</span><span class="cx">                                 // Get the length of the filename
</span><del>-                                $len = strspn($this->compressed_data, "\x00", $this->position);
</del><ins>+                                $len = strcspn($this->compressed_data, "\x00", $this->position);
</ins><span class="cx">
</span><span class="cx">                                 // Check the length of the string is still valid
</span><span class="cx">                                 $this->min_compressed_size += $len + 1;
</span><span class="lines">@@ -8458,7 +8521,7 @@
</span><span class="cx">                         if ($this->flags & 16)
</span><span class="cx">                         {
</span><span class="cx">                                 // Get the length of the comment
</span><del>-                                $len = strspn($this->compressed_data, "\x00", $this->position);
</del><ins>+                                $len = strcspn($this->compressed_data, "\x00", $this->position);
</ins><span class="cx">
</span><span class="cx">                                 // Check the length of the string is still valid
</span><span class="cx">                                 $this->min_compressed_size += $len + 1;
</span><span class="lines">@@ -8556,7 +8619,19 @@
</span><span class="cx">          */
</span><span class="cx">         function create($location, $filename, $extension)
</span><span class="cx">         {
</span><del>-                return new SimplePie_Cache_File($location, $filename, $extension);
</del><ins>+                $location_iri =& new SimplePie_IRI($location);
+                switch ($location_iri->get_scheme())
+                {
+                        case 'mysql':
+                                if (extension_loaded('mysql'))
+                                {
+                                        return new SimplePie_Cache_MySQL($location_iri, $filename, $extension);
+                                }
+                                break;
+
+                        default:
+                                return new SimplePie_Cache_File($location, $filename, $extension);
+                }
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -8570,9 +8645,9 @@
</span><span class="cx">         function SimplePie_Cache_File($location, $filename, $extension)
</span><span class="cx">         {
</span><span class="cx">                 $this->location = $location;
</span><del>-                $this->filename = rawurlencode($filename);
-                $this->extension = rawurlencode($extension);
-                $this->name = "$location/$this->filename.$this->extension";
</del><ins>+                $this->filename = $filename;
+                $this->extension = $extension;
+                $this->name = "$this->location/$this->filename.$this->extension";
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function save($data)
</span><span class="lines">@@ -8641,112 +8716,398 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-class SimplePie_Misc
</del><ins>+class SimplePie_Cache_DB
</ins><span class="cx"> {
</span><del>-        function time_hms($seconds)
</del><ins>+        function prepare_simplepie_object_for_cache($data)
</ins><span class="cx">         {
</span><del>-                $time = '';
</del><ins>+                $items = $data->get_items();
+                $items_by_id = array();
</ins><span class="cx">
</span><del>-                $hours = floor($seconds / 3600);
-                $remainder = $seconds % 3600;
-                if ($hours > 0)
</del><ins>+                if (!empty($items))
</ins><span class="cx">                 {
</span><del>-                        $time .= $hours.':';
</del><ins>+                        foreach ($items as $item)
+                        {
+                                $items_by_id[$item->get_id()] = $item;
+                        }
+
+                        if (count($items_by_id) !== count($items))
+                        {
+                                $items_by_id = array();
+                                foreach ($items as $item)
+                                {
+                                        $items_by_id[$item->get_id(true)] = $item;
+                                }
+                        }
+
+                        if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]))
+                        {
+                                $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
+                        }
+                        elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
+                        {
+                                $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
+                        }
+                        elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
+                        {
+                                $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
+                        }
+                        elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]))
+                        {
+                                $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0];
+                        }
+                        else
+                        {
+                                $channel = null;
+                        }
+
+                        if ($channel !== null)
+                        {
+                                if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry']))
+                                {
+                                        unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry']);
+                                }
+                                if (isset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry']))
+                                {
+                                        unset($channel['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['entry']);
+                                }
+                                if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']))
+                                {
+                                        unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item']);
+                                }
+                                if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']))
+                                {
+                                        unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item']);
+                                }
+                                if (isset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item']))
+                                {
+                                        unset($channel['child'][SIMPLEPIE_NAMESPACE_RSS_20]['item']);
+                                }
+                        }
+                        if (isset($data->data['items']))
+                        {
+                                unset($data->data['items']);
+                        }
+                        if (isset($data->data['ordered_items']))
+                        {
+                                unset($data->data['ordered_items']);
+                        }
</ins><span class="cx">                 }
</span><ins>+                return array(serialize($data->data), $items_by_id);
+        }
+}
</ins><span class="cx">
</span><del>-                $minutes = floor($remainder / 60);
-                $seconds = $remainder % 60;
-                if ($minutes < 10 && $hours > 0)
</del><ins>+class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
+{
+        var $mysql;
+        var $options;
+        var $id;
+
+        function SimplePie_Cache_MySQL($mysql_location, $name, $extension)
+        {
+                $host = $mysql_location->get_host();
+                if (SimplePie_Misc::stripos($host, 'unix(') === 0 && substr($host, -1) === ')')
</ins><span class="cx">                 {
</span><del>-                        $minutes = '0' . $minutes;
</del><ins>+                        $server = ':' . substr($host, 5, -1);
</ins><span class="cx">                 }
</span><del>-                if ($seconds < 10)
</del><ins>+                else
</ins><span class="cx">                 {
</span><del>-                        $seconds = '0' . $seconds;
</del><ins>+                        $server = $host;
+                        if ($mysql_location->get_port() !== null)
+                        {
+                                $server .= ':' . $mysql_location->get_port();
+                        }
</ins><span class="cx">                 }
</span><span class="cx">
</span><del>-                $time .= $minutes.':';
-                $time .= $seconds;
</del><ins>+                if (strpos($mysql_location->get_userinfo(), ':') !== false)
+                {
+                        list($username, $password) = explode(':', $mysql_location->get_userinfo(), 2);
+                }
+                else
+                {
+                        $username = $mysql_location->get_userinfo();
+                        $password = null;
+                }
</ins><span class="cx">
</span><del>-                return $time;
</del><ins>+                if ($this->mysql = mysql_connect($server, $username, $password))
+                {
+                        $this->id = $name . $extension;
+                        $this->options = SimplePie_Misc::parse_str($mysql_location->get_query());
+                        if (!isset($this->options['prefix'][0]))
+                        {
+                                $this->options['prefix'][0] = '';
+                        }
+
+                        if (mysql_select_db(ltrim($mysql_location->get_path(), '/'))
+                                && mysql_query('SET NAMES utf8')
+                                && ($query = mysql_unbuffered_query('SHOW TABLES')))
+                        {
+                                $db = array();
+                                while ($row = mysql_fetch_row($query))
+                                {
+                                        $db[] = $row[0];
+                                }
+
+                                if (!in_array($this->options['prefix'][0] . 'cache_data', $db))
+                                {
+                                        if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))'))
+                                        {
+                                                $this->mysql = null;
+                                        }
+                                }
+
+                                if (!in_array($this->options['prefix'][0] . 'items', $db))
+                                {
+                                        if (!mysql_query('CREATE TABLE `' . $this->options['prefix'][0] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` TEXT CHARACTER SET utf8 NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))'))
+                                        {
+                                                $this->mysql = null;
+                                        }
+                                }
+                        }
+                        else
+                        {
+                                $this->mysql = null;
+                        }
+                }
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        function absolutize_url($relative, $base)
</del><ins>+        function save($data)
</ins><span class="cx">         {
</span><del>-                if ($relative !== '')
</del><ins>+                if ($this->mysql)
</ins><span class="cx">                 {
</span><del>-                        $relative = SimplePie_Misc::parse_url($relative);
-                        if ($relative['scheme'] !== '')
</del><ins>+                        $feed_id = "'" . mysql_real_escape_string($this->id) . "'";
+
+                        if (is_a($data, 'SimplePie'))
</ins><span class="cx">                         {
</span><del>-                                $target = $relative;
-                        }
-                        elseif ($base !== '')
-                        {
-                                $base = SimplePie_Misc::parse_url($base);
-                                $target = SimplePie_Misc::parse_url('');
-                                if ($relative['authority'] !== '')
</del><ins>+                                if (SIMPLEPIE_PHP5)
</ins><span class="cx">                                 {
</span><del>-                                        $target = $relative;
-                                        $target['scheme'] = $base['scheme'];
</del><ins>+                                        // This keyword needs to defy coding standards for PHP4 compatibility
+                                        $data = clone($data);
</ins><span class="cx">                                 }
</span><del>-                                else
</del><ins>+
+                                $prepared = $this->prepare_simplepie_object_for_cache($data);
+
+                                if ($query = mysql_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this->mysql))
</ins><span class="cx">                                 {
</span><del>-                                        $target['scheme'] = $base['scheme'];
-                                        $target['authority'] = $base['authority'];
-                                        if ($relative['path'] !== '')
</del><ins>+                                        if (mysql_num_rows($query))
</ins><span class="cx">                                         {
</span><del>-                                                if (strpos($relative['path'], '/') === 0)
</del><ins>+                                                $items = count($prepared[1]);
+                                                if ($items)
</ins><span class="cx">                                                 {
</span><del>-                                                        $target['path'] = $relative['path'];
</del><ins>+                                                        $sql = 'UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `items` = ' . $items . ', `data` = \'' . mysql_real_escape_string($prepared[0]) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id;
</ins><span class="cx">                                                 }
</span><del>-                                                elseif ($base['authority'] !== '' && $base['path'] === '')
</del><ins>+                                                else
</ins><span class="cx">                                                 {
</span><del>-                                                        $target['path'] = '/' . $relative['path'];
</del><ins>+                                                        $sql = 'UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `data` = \'' . mysql_real_escape_string($prepared[0]) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id;
</ins><span class="cx">                                                 }
</span><del>-                                                elseif (($last_segment = strrpos($base['path'], '/')) !== false)
</del><ins>+
+                                                if (!mysql_query($sql, $this->mysql))
</ins><span class="cx">                                                 {
</span><del>-                                                        $target['path'] = substr($base['path'], 0, $last_segment + 1) . $relative['path'];
</del><ins>+                                                        return false;
</ins><span class="cx">                                                 }
</span><del>-                                                else
-                                                {
-                                                        $target['path'] = $relative['path'];
-                                                }
-                                                $target['query'] = $relative['query'];
</del><span class="cx">                                         }
</span><del>-                                        else
</del><ins>+                                        elseif (!mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(' . $feed_id . ', ' . count($prepared[1]) . ', \'' . mysql_real_escape_string($prepared[0]) . '\', ' . time() . ')', $this->mysql))
</ins><span class="cx">                                         {
</span><del>-                                                $target['path'] = $base['path'];
-                                                if ($relative['query'] !== '')
</del><ins>+                                                return false;
+                                        }
+
+                                        $ids = array_keys($prepared[1]);
+                                        if (!empty($ids))
+                                        {
+                                                foreach ($ids as $id)
</ins><span class="cx">                                                 {
</span><del>-                                                        $target['query'] = $relative['query'];
</del><ins>+                                                        $database_ids[] = mysql_real_escape_string($id);
</ins><span class="cx">                                                 }
</span><del>-                                                elseif ($base['query'] !== '')
</del><ins>+
+                                                if ($query = mysql_unbuffered_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'items` WHERE `id` = \'' . implode('\' OR `id` = \'', $database_ids) . '\' AND `feed_id` = ' . $feed_id, $this->mysql))
</ins><span class="cx">                                                 {
</span><del>-                                                        $target['query'] = $base['query'];
</del><ins>+                                                        $existing_ids = array();
+                                                        while ($row = mysql_fetch_row($query))
+                                                        {
+                                                                $existing_ids[] = $row[0];
+                                                        }
+
+                                                        $new_ids = array_diff($ids, $existing_ids);
+
+                                                        foreach ($new_ids as $new_id)
+                                                        {
+                                                                if (!($date = $prepared[1][$new_id]->get_date('U')))
+                                                                {
+                                                                        $date = time();
+                                                                }
+
+                                                                if (!mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'items` (`feed_id`, `id`, `data`, `posted`) VALUES(' . $feed_id . ', \'' . mysql_real_escape_string($new_id) . '\', \'' . mysql_real_escape_string(serialize($prepared[1][$new_id]->data)) . '\', ' . $date . ')', $this->mysql))
+                                                                {
+                                                                        return false;
+                                                                }
+                                                        }
+                                                        return true;
</ins><span class="cx">                                                 }
</span><span class="cx">                                         }
</span><ins>+                                        else
+                                        {
+                                                return true;
+                                        }
</ins><span class="cx">                                 }
</span><del>-                                $target['fragment'] = $relative['fragment'];
</del><span class="cx">                         }
</span><ins>+                        elseif ($query = mysql_query('SELECT `id` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this->mysql))
+                        {
+                                if (mysql_num_rows($query))
+                                {
+                                        if (mysql_query('UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `items` = 0, `data` = \'' . mysql_real_escape_string(serialize($data)) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id, $this->mysql))
+                                        {
+                                                return true;
+                                        }
+                                }
+                                elseif (mysql_query('INSERT INTO `' . $this->options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(\'' . mysql_real_escape_string($this->id) . '\', 0, \'' . mysql_real_escape_string(serialize($data)) . '\', ' . time() . ')', $this->mysql))
+                                {
+                                        return true;
+                                }
+                        }
+                }
+                return false;
+        }
+
+        function load()
+        {
+                if ($this->mysql && ($query = mysql_query('SELECT `items`, `data` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query)))
+                {
+                        $data = unserialize($row[1]);
+
+                        if (isset($this->options['items'][0]))
+                        {
+                                $items = (int) $this->options['items'][0];
+                        }
</ins><span class="cx">                         else
</span><span class="cx">                         {
</span><del>-                                // No base URL, just return the relative URL
-                                $target = $relative;
</del><ins>+                                $items = (int) $row[0];
</ins><span class="cx">                         }
</span><del>-                        $return = SimplePie_Misc::compress_parse_url($target['scheme'], $target['authority'], $target['path'], $target['query'], $target['fragment']);
</del><ins>+
+                        if ($items !== 0)
+                        {
+                                if (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]))
+                                {
+                                        $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
+                                }
+                                elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
+                                {
+                                        $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
+                                }
+                                elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
+                                {
+                                        $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
+                                }
+                                elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]))
+                                {
+                                        $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0];
+                                }
+                                else
+                                {
+                                        $feed = null;
+                                }
+
+                                if ($feed !== null)
+                                {
+                                        $sql = 'SELECT `data` FROM `' . $this->options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->id) . '\' ORDER BY `posted` DESC';
+                                        if ($items > 0)
+                                        {
+                                                $sql .= ' LIMIT ' . $items;
+                                        }
+
+                                        if ($query = mysql_unbuffered_query($sql, $this->mysql))
+                                        {
+                                                while ($row = mysql_fetch_row($query))
+                                                {
+                                                        $feed['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'][] = unserialize($row[0]);
+                                                }
+                                        }
+                                        else
+                                        {
+                                                return false;
+                                        }
+                                }
+                        }
+                        return $data;
</ins><span class="cx">                 }
</span><ins>+                return false;
+        }
+
+        function mtime()
+        {
+                if ($this->mysql && ($query = mysql_query('SELECT `mtime` FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($row = mysql_fetch_row($query)))
+                {
+                        return $row[0];
+                }
</ins><span class="cx">                 else
</span><span class="cx">                 {
</span><del>-                        $return = $base;
</del><ins>+                        return false;
</ins><span class="cx">                 }
</span><del>-                $return = SimplePie_Misc::normalize_url($return);
-                return $return;
</del><span class="cx">         }
</span><span class="cx">
</span><ins>+        function touch()
+        {
+                if ($this->mysql && ($query = mysql_query('UPDATE `' . $this->options['prefix'][0] . 'cache_data` SET `mtime` = ' . time() . ' WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && mysql_affected_rows($this->mysql))
+                {
+                        return true;
+                }
+                else
+                {
+                        return false;
+                }
+        }
+
+        function unlink()
+        {
+                if ($this->mysql && ($query = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)) && ($query2 = mysql_query('DELETE FROM `' . $this->options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->id) . "'", $this->mysql)))
+                {
+                        return true;
+                }
+                else
+                {
+                        return false;
+                }
+        }
+}
+
+class SimplePie_Misc
+{
+        function time_hms($seconds)
+        {
+                $time = '';
+
+                $hours = floor($seconds / 3600);
+                $remainder = $seconds % 3600;
+                if ($hours > 0)
+                {
+                        $time .= $hours.':';
+                }
+
+                $minutes = floor($remainder / 60);
+                $seconds = $remainder % 60;
+                if ($minutes < 10 && $hours > 0)
+                {
+                        $minutes = '0' . $minutes;
+                }
+                if ($seconds < 10)
+                {
+                        $seconds = '0' . $seconds;
+                }
+
+                $time .= $minutes.':';
+                $time .= $seconds;
+
+                return $time;
+        }
+
+        function absolutize_url($relative, $base)
+        {
+                $iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative);
+                return $iri->get_iri();
+        }
+
</ins><span class="cx">         function remove_dot_segments($input)
</span><span class="cx">         {
</span><span class="cx">                 $output = '';
</span><del>-                while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input == '.' || $input == '..')
</del><ins>+                while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
</ins><span class="cx">                 {
</span><span class="cx">                         // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
</span><span class="cx">                         if (strpos($input, '../') === 0)
</span><span class="lines">@@ -8762,7 +9123,7 @@
</span><span class="cx">                         {
</span><span class="cx">                                 $input = substr_replace($input, '/', 0, 3);
</span><span class="cx">                         }
</span><del>-                        elseif ($input == '/.')
</del><ins>+                        elseif ($input === '/.')
</ins><span class="cx">                         {
</span><span class="cx">                                 $input = '/';
</span><span class="cx">                         }
</span><span class="lines">@@ -8772,13 +9133,13 @@
</span><span class="cx">                                 $input = substr_replace($input, '/', 0, 4);
</span><span class="cx">                                 $output = substr_replace($output, '', strrpos($output, '/'));
</span><span class="cx">                         }
</span><del>-                        elseif ($input == '/..')
</del><ins>+                        elseif ($input === '/..')
</ins><span class="cx">                         {
</span><span class="cx">                                 $input = '/';
</span><span class="cx">                                 $output = substr_replace($output, '', strrpos($output, '/'));
</span><span class="cx">                         }
</span><span class="cx">                         // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
</span><del>-                        elseif ($input == '.' || $input == '..')
</del><ins>+                        elseif ($input === '.' || $input === '..')
</ins><span class="cx">                         {
</span><span class="cx">                                 $input = '';
</span><span class="cx">                         }
</span><span class="lines">@@ -8822,7 +9183,7 @@
</span><span class="cx">                                 {
</span><span class="cx">                                         for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++)
</span><span class="cx">                                         {
</span><del>-                                                if (count($attribs[$j]) == 2)
</del><ins>+                                                if (count($attribs[$j]) === 2)
</ins><span class="cx">                                                 {
</span><span class="cx">                                                         $attribs[$j][2] = $attribs[$j][1];
</span><span class="cx">                                                 }
</span><span class="lines">@@ -8855,22 +9216,25 @@
</span><span class="cx">
</span><span class="cx">         function error($message, $level, $file, $line)
</span><span class="cx">         {
</span><del>-                switch ($level)
</del><ins>+                if ((ini_get('error_reporting') & $level) > 0)
</ins><span class="cx">                 {
</span><del>-                        case E_USER_ERROR:
-                                $note = 'PHP Error';
-                                break;
-                        case E_USER_WARNING:
-                                $note = 'PHP Warning';
-                                break;
-                        case E_USER_NOTICE:
-                                $note = 'PHP Notice';
-                                break;
-                        default:
-                                $note = 'Unknown Error';
-                                break;
</del><ins>+                        switch ($level)
+                        {
+                                case E_USER_ERROR:
+                                        $note = 'PHP Error';
+                                        break;
+                                case E_USER_WARNING:
+                                        $note = 'PHP Warning';
+                                        break;
+                                case E_USER_NOTICE:
+                                        $note = 'PHP Notice';
+                                        break;
+                                default:
+                                        $note = 'Unknown Error';
+                                        break;
+                        }
+                        error_log("$note: $message in $file on line $line", 0);
</ins><span class="cx">                 }
</span><del>-                error_log("$note: $message in $file on line $line", 0);
</del><span class="cx">                 return $message;
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -8922,7 +9286,7 @@
</span><span class="cx">         {
</span><span class="cx">                 $url = SimplePie_Misc::normalize_url($url);
</span><span class="cx">                 $parsed = SimplePie_Misc::parse_url($url);
</span><del>-                if ($parsed['scheme'] !== '' && $parsed['scheme'] != 'http' && $parsed['scheme'] != 'https')
</del><ins>+                if ($parsed['scheme'] !== '' && $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https')
</ins><span class="cx">                 {
</span><span class="cx">                         return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http);
</span><span class="cx">                 }
</span><span class="lines">@@ -8932,15 +9296,15 @@
</span><span class="cx">                         return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http);
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                if ($http == 2 && $parsed['scheme'] !== '')
</del><ins>+                if ($http === 2 && $parsed['scheme'] !== '')
</ins><span class="cx">                 {
</span><span class="cx">                         return "feed:$url";
</span><span class="cx">                 }
</span><del>-                elseif ($http == 3 && strtolower($parsed['scheme']) == 'http')
</del><ins>+                elseif ($http === 3 && strtolower($parsed['scheme']) === 'http')
</ins><span class="cx">                 {
</span><span class="cx">                         return substr_replace($url, 'podcast', 0, 4);
</span><span class="cx">                 }
</span><del>-                elseif ($http == 4 && strtolower($parsed['scheme']) == 'http')
</del><ins>+                elseif ($http === 4 && strtolower($parsed['scheme']) === 'http')
</ins><span class="cx">                 {
</span><span class="cx">                         return substr_replace($url, 'itpc', 0, 4);
</span><span class="cx">                 }
</span><span class="lines">@@ -8952,57 +9316,37 @@
</span><span class="cx">
</span><span class="cx">         function parse_url($url)
</span><span class="cx">         {
</span><del>-                preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match);
-                for ($i = count($match); $i <= 9; $i++)
-                {
-                        $match[$i] = '';
-                }
-                return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
</del><ins>+                $iri =& new SimplePie_IRI($url);
+                return array(
+                        'scheme' => (string) $iri->get_scheme(),
+                        'authority' => (string) $iri->get_authority(),
+                        'path' => (string) $iri->get_path(),
+                        'query' => (string) $iri->get_query(),
+                        'fragment' => (string) $iri->get_fragment()
+                );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
</span><span class="cx">         {
</span><del>-                $return = '';
-                if ($scheme !== '')
-                {
-                        $return .= "$scheme:";
-                }
-                if ($authority !== '')
-                {
-                        $return .= "//$authority";
-                }
-                if ($path !== '')
-                {
-                        $return .= $path;
-                }
-                if ($query !== '')
-                {
-                        $return .= "?$query";
-                }
-                if ($fragment !== '')
-                {
-                        $return .= "#$fragment";
-                }
-                return $return;
</del><ins>+                $iri =& new SimplePie_IRI('');
+                $iri->set_scheme($scheme);
+                $iri->set_authority($authority);
+                $iri->set_path($path);
+                $iri->set_query($query);
+                $iri->set_fragment($fragment);
+                return $iri->get_iri();
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function normalize_url($url)
</span><span class="cx">         {
</span><del>-                $url = preg_replace_callback('/%([0-9A-Fa-f]{2})/', array('SimplePie_Misc', 'percent_encoding_normalization'), $url);
-                $url = SimplePie_Misc::parse_url($url);
-                $url['scheme'] = strtolower($url['scheme']);
-                if ($url['authority'] !== '')
-                {
-                        $url['authority'] = strtolower($url['authority']);
-                        $url['path'] = SimplePie_Misc::remove_dot_segments($url['path']);
-                }
-                return SimplePie_Misc::compress_parse_url($url['scheme'], $url['authority'], $url['path'], $url['query'], $url['fragment']);
</del><ins>+                $iri =& new SimplePie_IRI($url);
+                return $iri->get_iri();
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function percent_encoding_normalization($match)
</span><span class="cx">         {
</span><span class="cx">                 $integer = hexdec($match[1]);
</span><del>-                if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer == 0x2D || $integer == 0x2E || $integer == 0x5F || $integer == 0x7E)
</del><ins>+                if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E)
</ins><span class="cx">                 {
</span><span class="cx">                         return chr($integer);
</span><span class="cx">                 }
</span><span class="lines">@@ -9086,8 +9430,8 @@
</span><span class="cx">                 {
</span><span class="cx">                         return SimplePie_Misc::windows_1252_to_utf8($data);
</span><span class="cx">                 }
</span><del>-                // This is second, as behaviour of this varies only with PHP version
-                elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($data, $output, $input)))
</del><ins>+                // This is second, as behaviour of this varies only with PHP version (the middle part of this expression checks the encoding is supported).
+                elseif (function_exists('mb_convert_encoding') && @mb_convert_encoding("\x80", 'UTF-16BE', $input) !== "\x00\x80" && ($return = @mb_convert_encoding($data, $output, $input)))
</ins><span class="cx">                 {
</span><span class="cx">                         return $return;
</span><span class="cx">                 }
</span><span class="lines">@@ -9105,10 +9449,8 @@
</span><span class="cx">
</span><span class="cx">         function encoding($charset)
</span><span class="cx">         {
</span><del>-                /* Character sets are case-insensitive, and also need some further
-                normalization in the real world (though we'll return them in the form given
-                in their registration). */
-                switch (strtolower(preg_replace('/[\x09-\x0D\x20-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]/', '', $charset)))
</del><ins>+                // Normalization from UTS #22
+                switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset)))
</ins><span class="cx">                 {
</span><span class="cx">                         case 'adobestandardencoding':
</span><span class="cx">                         case 'csadobestandardencoding':
</span><span class="lines">@@ -9119,9 +9461,7 @@
</span><span class="cx">                                 return 'Adobe-Symbol-Encoding';
</span><span class="cx">
</span><span class="cx">                         case 'ami1251':
</span><del>-                        case 'ami1251':
</del><span class="cx">                         case 'amiga1251':
</span><del>-                        case 'amiga1251':
</del><span class="cx">                                 return 'Amiga-1251';
</span><span class="cx">
</span><span class="cx">                         case 'ansix31101983':
</span><span class="lines">@@ -9134,8 +9474,8 @@
</span><span class="cx">                         case 'arabic7':
</span><span class="cx">                         case 'asmo449':
</span><span class="cx">                         case 'csiso89asmo449':
</span><ins>+                        case 'iso9036':
</ins><span class="cx">                         case 'isoir89':
</span><del>-                        case 'iso9036':
</del><span class="cx">                                 return 'ASMO_449';
</span><span class="cx">
</span><span class="cx">                         case 'big5':
</span><span class="lines">@@ -9157,8 +9497,8 @@
</span><span class="cx">                         case 'bs4730':
</span><span class="cx">                         case 'csiso4unitedkingdom':
</span><span class="cx">                         case 'gb':
</span><ins>+                        case 'iso646gb':
</ins><span class="cx">                         case 'isoir4':
</span><del>-                        case 'iso646gb':
</del><span class="cx">                         case 'uk':
</span><span class="cx">                                 return 'BS_4730';
</span><span class="cx">
</span><span class="lines">@@ -9175,15 +9515,15 @@
</span><span class="cx">                         case 'csa71':
</span><span class="cx">                         case 'csaz243419851':
</span><span class="cx">                         case 'csiso121canadian1':
</span><ins>+                        case 'iso646ca':
</ins><span class="cx">                         case 'isoir121':
</span><del>-                        case 'iso646ca':
</del><span class="cx">                                 return 'CSA_Z243.4-1985-1';
</span><span class="cx">
</span><span class="cx">                         case 'csa72':
</span><span class="cx">                         case 'csaz243419852':
</span><span class="cx">                         case 'csiso122canadian2':
</span><ins>+                        case 'iso646ca2':
</ins><span class="cx">                         case 'isoir122':
</span><del>-                        case 'iso646ca2':
</del><span class="cx">                                 return 'CSA_Z243.4-1985-2';
</span><span class="cx">
</span><span class="cx">                         case 'csaz24341985gr':
</span><span class="lines">@@ -9204,8 +9544,8 @@
</span><span class="cx">                         case 'csiso21german':
</span><span class="cx">                         case 'de':
</span><span class="cx">                         case 'din66003':
</span><ins>+                        case 'iso646de':
</ins><span class="cx">                         case 'isoir21':
</span><del>-                        case 'iso646de':
</del><span class="cx">                                 return 'DIN_66003';
</span><span class="cx">
</span><span class="cx">                         case 'csdkus':
</span><span class="lines">@@ -9215,7 +9555,6 @@
</span><span class="cx">                         case 'csiso646danish':
</span><span class="cx">                         case 'dk':
</span><span class="cx">                         case 'ds2089':
</span><del>-                        case 'ds2089':
</del><span class="cx">                         case 'iso646dk':
</span><span class="cx">                                 return 'DS_2089';
</span><span class="cx">
</span><span class="lines">@@ -9287,14 +9626,14 @@
</span><span class="cx">
</span><span class="cx">                         case 'csiso17spanish':
</span><span class="cx">                         case 'es':
</span><ins>+                        case 'iso646es':
</ins><span class="cx">                         case 'isoir17':
</span><del>-                        case 'iso646es':
</del><span class="cx">                                 return 'ES';
</span><span class="cx">
</span><span class="cx">                         case 'csiso85spanish2':
</span><span class="cx">                         case 'es2':
</span><ins>+                        case 'iso646es2':
</ins><span class="cx">                         case 'isoir85':
</span><del>-                        case 'iso646es2':
</del><span class="cx">                                 return 'ES2';
</span><span class="cx">
</span><span class="cx">                         case 'cseucfixwidjapanese':
</span><span class="lines">@@ -9309,23 +9648,23 @@
</span><span class="cx">                         case 'gb18030':
</span><span class="cx">                                 return 'GB18030';
</span><span class="cx">
</span><ins>+                        case 'chinese':
</ins><span class="cx">                         case 'cp936':
</span><del>-                        case 'gbk':
-                        case 'ms936':
-                        case 'windows936':
</del><span class="cx">                         case 'csgb2312':
</span><ins>+                        case 'csiso58gb231280':
</ins><span class="cx">                         case 'gb2312':
</span><del>-                        case 'chinese':
-                        case 'csiso58gb231280':
</del><span class="cx">                         case 'gb231280':
</span><ins>+                        case 'gbk':
</ins><span class="cx">                         case 'isoir58':
</span><ins>+                        case 'ms936':
+                        case 'windows936':
</ins><span class="cx">                                 return 'GBK';
</span><span class="cx">
</span><span class="cx">                         case 'cn':
</span><span class="cx">                         case 'csiso57gb1988':
</span><span class="cx">                         case 'gb198880':
</span><ins>+                        case 'iso646cn':
</ins><span class="cx">                         case 'isoir57':
</span><del>-                        case 'iso646cn':
</del><span class="cx">                                 return 'GB_1988-80';
</span><span class="cx">
</span><span class="cx">                         case 'csiso153gost1976874':
</span><span class="lines">@@ -9383,93 +9722,93 @@
</span><span class="cx">                         case 'ibmthai':
</span><span class="cx">                                 return 'IBM-Thai';
</span><span class="cx">
</span><del>-                        case 'ccsid00858':
-                        case 'cp00858':
-                        case 'ibm00858':
</del><ins>+                        case 'ccsid858':
+                        case 'cp858':
+                        case 'ibm858':
</ins><span class="cx">                         case 'pcmultilingual850euro':
</span><span class="cx">                                 return 'IBM00858';
</span><span class="cx">
</span><del>-                        case 'ccsid00924':
-                        case 'cp00924':
</del><ins>+                        case 'ccsid924':
+                        case 'cp924':
</ins><span class="cx">                         case 'ebcdiclatin9euro':
</span><del>-                        case 'ibm00924':
</del><ins>+                        case 'ibm924':
</ins><span class="cx">                                 return 'IBM00924';
</span><span class="cx">
</span><del>-                        case 'ccsid01140':
-                        case 'cp01140':
</del><ins>+                        case 'ccsid1140':
+                        case 'cp1140':
</ins><span class="cx">                         case 'ebcdicus37euro':
</span><del>-                        case 'ibm01140':
</del><ins>+                        case 'ibm1140':
</ins><span class="cx">                                 return 'IBM01140';
</span><span class="cx">
</span><del>-                        case 'ccsid01141':
-                        case 'cp01141':
</del><ins>+                        case 'ccsid1141':
+                        case 'cp1141':
</ins><span class="cx">                         case 'ebcdicde273euro':
</span><del>-                        case 'ibm01141':
</del><ins>+                        case 'ibm1141':
</ins><span class="cx">                                 return 'IBM01141';
</span><span class="cx">
</span><del>-                        case 'ccsid01142':
-                        case 'cp01142':
</del><ins>+                        case 'ccsid1142':
+                        case 'cp1142':
</ins><span class="cx">                         case 'ebcdicdk277euro':
</span><span class="cx">                         case 'ebcdicno277euro':
</span><del>-                        case 'ibm01142':
</del><ins>+                        case 'ibm1142':
</ins><span class="cx">                                 return 'IBM01142';
</span><span class="cx">
</span><del>-                        case 'ccsid01143':
-                        case 'cp01143':
</del><ins>+                        case 'ccsid1143':
+                        case 'cp1143':
</ins><span class="cx">                         case 'ebcdicfi278euro':
</span><span class="cx">                         case 'ebcdicse278euro':
</span><del>-                        case 'ibm01143':
</del><ins>+                        case 'ibm1143':
</ins><span class="cx">                                 return 'IBM01143';
</span><span class="cx">
</span><del>-                        case 'ccsid01144':
-                        case 'cp01144':
</del><ins>+                        case 'ccsid1144':
+                        case 'cp1144':
</ins><span class="cx">                         case 'ebcdicit280euro':
</span><del>-                        case 'ibm01144':
</del><ins>+                        case 'ibm1144':
</ins><span class="cx">                                 return 'IBM01144';
</span><span class="cx">
</span><del>-                        case 'ccsid01145':
-                        case 'cp01145':
</del><ins>+                        case 'ccsid1145':
+                        case 'cp1145':
</ins><span class="cx">                         case 'ebcdices284euro':
</span><del>-                        case 'ibm01145':
</del><ins>+                        case 'ibm1145':
</ins><span class="cx">                                 return 'IBM01145';
</span><span class="cx">
</span><del>-                        case 'ccsid01146':
-                        case 'cp01146':
</del><ins>+                        case 'ccsid1146':
+                        case 'cp1146':
</ins><span class="cx">                         case 'ebcdicgb285euro':
</span><del>-                        case 'ibm01146':
</del><ins>+                        case 'ibm1146':
</ins><span class="cx">                                 return 'IBM01146';
</span><span class="cx">
</span><del>-                        case 'ccsid01147':
-                        case 'cp01147':
</del><ins>+                        case 'ccsid1147':
+                        case 'cp1147':
</ins><span class="cx">                         case 'ebcdicfr297euro':
</span><del>-                        case 'ibm01147':
</del><ins>+                        case 'ibm1147':
</ins><span class="cx">                                 return 'IBM01147';
</span><span class="cx">
</span><del>-                        case 'ccsid01148':
-                        case 'cp01148':
</del><ins>+                        case 'ccsid1148':
+                        case 'cp1148':
</ins><span class="cx">                         case 'ebcdicinternational500euro':
</span><del>-                        case 'ibm01148':
</del><ins>+                        case 'ibm1148':
</ins><span class="cx">                                 return 'IBM01148';
</span><span class="cx">
</span><del>-                        case 'ccsid01149':
-                        case 'cp01149':
</del><ins>+                        case 'ccsid1149':
+                        case 'cp1149':
</ins><span class="cx">                         case 'ebcdicis871euro':
</span><del>-                        case 'ibm01149':
</del><ins>+                        case 'ibm1149':
</ins><span class="cx">                                 return 'IBM01149';
</span><span class="cx">
</span><del>-                        case 'cp037':
-                        case 'csibm037':
</del><ins>+                        case 'cp37':
+                        case 'csibm37':
</ins><span class="cx">                         case 'ebcdiccpca':
</span><span class="cx">                         case 'ebcdiccpnl':
</span><span class="cx">                         case 'ebcdiccpus':
</span><span class="cx">                         case 'ebcdiccpwt':
</span><del>-                        case 'ibm037':
</del><ins>+                        case 'ibm37':
</ins><span class="cx">                                 return 'IBM037';
</span><span class="cx">
</span><del>-                        case 'cp038':
-                        case 'csibm038':
</del><ins>+                        case 'cp38':
+                        case 'csibm38':
</ins><span class="cx">                         case 'ebcdicint':
</span><del>-                        case 'ibm038':
</del><ins>+                        case 'ibm38':
</ins><span class="cx">                                 return 'IBM038';
</span><span class="cx">
</span><span class="cx">                         case 'cp273':
</span><span class="lines">@@ -9611,8 +9950,8 @@
</span><span class="cx">                                 return 'IBM860';
</span><span class="cx">
</span><span class="cx">                         case '861':
</span><ins>+                        case 'cp861':
</ins><span class="cx">                         case 'cpis':
</span><del>-                        case 'cp861':
</del><span class="cx">                         case 'csibm861':
</span><span class="cx">                         case 'ibm861':
</span><span class="cx">                                 return 'IBM861';
</span><span class="lines">@@ -9646,15 +9985,15 @@
</span><span class="cx">                         case 'ibm866':
</span><span class="cx">                                 return 'IBM866';
</span><span class="cx">
</span><ins>+                        case 'cp868':
</ins><span class="cx">                         case 'cpar':
</span><del>-                        case 'cp868':
</del><span class="cx">                         case 'csibm868':
</span><span class="cx">                         case 'ibm868':
</span><span class="cx">                                 return 'IBM868';
</span><span class="cx">
</span><span class="cx">                         case '869':
</span><ins>+                        case 'cp869':
</ins><span class="cx">                         case 'cpgr':
</span><del>-                        case 'cp869':
</del><span class="cx">                         case 'csibm869':
</span><span class="cx">                         case 'ibm869':
</span><span class="cx">                                 return 'IBM869';
</span><span class="lines">@@ -9712,7 +10051,6 @@
</span><span class="cx">                                 return 'IBM1026';
</span><span class="cx">
</span><span class="cx">                         case 'ibm1047':
</span><del>-                        case 'ibm1047':
</del><span class="cx">                                 return 'IBM1047';
</span><span class="cx">
</span><span class="cx">                         case 'csiso143iecp271':
</span><span class="lines">@@ -9767,9 +10105,8 @@
</span><span class="cx">
</span><span class="cx">                         case 'csisolatin2':
</span><span class="cx">                         case 'iso88592':
</span><ins>+                        case 'iso885921987':
</ins><span class="cx">                         case 'isoir101':
</span><del>-                        case 'iso88592':
-                        case 'iso885921987':
</del><span class="cx">                         case 'l2':
</span><span class="cx">                         case 'latin2':
</span><span class="cx">                                 return 'ISO-8859-2';
</span><span class="lines">@@ -9780,18 +10117,16 @@
</span><span class="cx">
</span><span class="cx">                         case 'csisolatin3':
</span><span class="cx">                         case 'iso88593':
</span><ins>+                        case 'iso885931988':
</ins><span class="cx">                         case 'isoir109':
</span><del>-                        case 'iso88593':
-                        case 'iso885931988':
</del><span class="cx">                         case 'l3':
</span><span class="cx">                         case 'latin3':
</span><span class="cx">                                 return 'ISO-8859-3';
</span><span class="cx">
</span><span class="cx">                         case 'csisolatin4':
</span><span class="cx">                         case 'iso88594':
</span><ins>+                        case 'iso885941988':
</ins><span class="cx">                         case 'isoir110':
</span><del>-                        case 'iso88594':
-                        case 'iso885941988':
</del><span class="cx">                         case 'l4':
</span><span class="cx">                         case 'latin4':
</span><span class="cx">                                 return 'ISO-8859-4';
</span><span class="lines">@@ -9799,9 +10134,8 @@
</span><span class="cx">                         case 'csisolatincyrillic':
</span><span class="cx">                         case 'cyrillic':
</span><span class="cx">                         case 'iso88595':
</span><ins>+                        case 'iso885951988':
</ins><span class="cx">                         case 'isoir144':
</span><del>-                        case 'iso88595':
-                        case 'iso885951988':
</del><span class="cx">                                 return 'ISO-8859-5';
</span><span class="cx">
</span><span class="cx">                         case 'arabic':
</span><span class="lines">@@ -9809,19 +10143,16 @@
</span><span class="cx">                         case 'csisolatinarabic':
</span><span class="cx">                         case 'ecma114':
</span><span class="cx">                         case 'iso88596':
</span><ins>+                        case 'iso885961987':
</ins><span class="cx">                         case 'isoir127':
</span><del>-                        case 'iso88596':
-                        case 'iso885961987':
</del><span class="cx">                                 return 'ISO-8859-6';
</span><span class="cx">
</span><span class="cx">                         case 'csiso88596e':
</span><span class="cx">                         case 'iso88596e':
</span><del>-                        case 'iso88596e':
</del><span class="cx">                                 return 'ISO-8859-6-E';
</span><span class="cx">
</span><span class="cx">                         case 'csiso88596i':
</span><span class="cx">                         case 'iso88596i':
</span><del>-                        case 'iso88596i':
</del><span class="cx">                                 return 'ISO-8859-6-I';
</span><span class="cx">
</span><span class="cx">                         case 'csisolatingreek':
</span><span class="lines">@@ -9830,27 +10161,23 @@
</span><span class="cx">                         case 'greek':
</span><span class="cx">                         case 'greek8':
</span><span class="cx">                         case 'iso88597':
</span><ins>+                        case 'iso885971987':
</ins><span class="cx">                         case 'isoir126':
</span><del>-                        case 'iso88597':
-                        case 'iso885971987':
</del><span class="cx">                                 return 'ISO-8859-7';
</span><span class="cx">
</span><span class="cx">                         case 'csisolatinhebrew':
</span><span class="cx">                         case 'hebrew':
</span><span class="cx">                         case 'iso88598':
</span><ins>+                        case 'iso885981988':
</ins><span class="cx">                         case 'isoir138':
</span><del>-                        case 'iso88598':
-                        case 'iso885981988':
</del><span class="cx">                                 return 'ISO-8859-8';
</span><span class="cx">
</span><span class="cx">                         case 'csiso88598e':
</span><span class="cx">                         case 'iso88598e':
</span><del>-                        case 'iso88598e':
</del><span class="cx">                                 return 'ISO-8859-8-E';
</span><span class="cx">
</span><span class="cx">                         case 'csiso88598i':
</span><span class="cx">                         case 'iso88598i':
</span><del>-                        case 'iso88598i':
</del><span class="cx">                                 return 'ISO-8859-8-I';
</span><span class="cx">
</span><span class="cx">                         case 'cswindows31latin5':
</span><span class="lines">@@ -9859,8 +10186,8 @@
</span><span class="cx">
</span><span class="cx">                         case 'csisolatin6':
</span><span class="cx">                         case 'iso885910':
</span><ins>+                        case 'iso8859101992':
</ins><span class="cx">                         case 'isoir157':
</span><del>-                        case 'iso8859101992':
</del><span class="cx">                         case 'l6':
</span><span class="cx">                         case 'latin6':
</span><span class="cx">                                 return 'ISO-8859-10';
</span><span class="lines">@@ -9869,23 +10196,20 @@
</span><span class="cx">                                 return 'ISO-8859-13';
</span><span class="cx">
</span><span class="cx">                         case 'iso885914':
</span><ins>+                        case 'iso8859141998':
</ins><span class="cx">                         case 'isoceltic':
</span><span class="cx">                         case 'isoir199':
</span><del>-                        case 'iso885914':
-                        case 'iso8859141998':
</del><span class="cx">                         case 'l8':
</span><span class="cx">                         case 'latin8':
</span><span class="cx">                                 return 'ISO-8859-14';
</span><span class="cx">
</span><span class="cx">                         case 'iso885915':
</span><del>-                        case 'iso885915':
</del><span class="cx">                         case 'latin9':
</span><span class="cx">                                 return 'ISO-8859-15';
</span><span class="cx">
</span><span class="cx">                         case 'iso885916':
</span><ins>+                        case 'iso8859162001':
</ins><span class="cx">                         case 'isoir226':
</span><del>-                        case 'iso885916':
-                        case 'iso8859162001':
</del><span class="cx">                         case 'l10':
</span><span class="cx">                         case 'latin10':
</span><span class="cx">                                 return 'ISO-8859-16';
</span><span class="lines">@@ -9916,7 +10240,6 @@
</span><span class="cx">
</span><span class="cx">                         case 'csiso115481':
</span><span class="cx">                         case 'iso115481':
</span><del>-                        case 'iso115481':
</del><span class="cx">                         case 'isotr115481':
</span><span class="cx">                                 return 'ISO-11548-1';
</span><span class="cx">
</span><span class="lines">@@ -9951,55 +10274,55 @@
</span><span class="cx">
</span><span class="cx">                         case 'csiso2intlrefversion':
</span><span class="cx">                         case 'irv':
</span><ins>+                        case 'iso646irv1983':
</ins><span class="cx">                         case 'isoir2':
</span><del>-                        case 'iso646irv1983':
</del><span class="cx">                                 return 'ISO_646.irv:1983';
</span><span class="cx">
</span><span class="cx">                         case 'csiso2033':
</span><span class="cx">                         case 'e13b':
</span><ins>+                        case 'iso20331983':
</ins><span class="cx">                         case 'isoir98':
</span><del>-                        case 'iso20331983':
</del><span class="cx">                                 return 'ISO_2033-1983';
</span><span class="cx">
</span><span class="cx">                         case 'csiso5427cyrillic':
</span><ins>+                        case 'iso5427':
</ins><span class="cx">                         case 'isoir37':
</span><del>-                        case 'iso5427':
</del><span class="cx">                                 return 'ISO_5427';
</span><span class="cx">
</span><del>-                        case 'isoir54':
</del><span class="cx">                         case 'iso5427cyrillic1981':
</span><span class="cx">                         case 'iso54271981':
</span><ins>+                        case 'isoir54':
</ins><span class="cx">                                 return 'ISO_5427:1981';
</span><span class="cx">
</span><span class="cx">                         case 'csiso5428greek':
</span><ins>+                        case 'iso54281980':
</ins><span class="cx">                         case 'isoir55':
</span><del>-                        case 'iso54281980':
</del><span class="cx">                                 return 'ISO_5428:1980';
</span><span class="cx">
</span><span class="cx">                         case 'csiso6937add':
</span><ins>+                        case 'iso6937225':
</ins><span class="cx">                         case 'isoir152':
</span><del>-                        case 'iso6937225':
</del><span class="cx">                                 return 'ISO_6937-2-25';
</span><span class="cx">
</span><span class="cx">                         case 'csisotextcomm':
</span><ins>+                        case 'iso69372add':
</ins><span class="cx">                         case 'isoir142':
</span><del>-                        case 'iso69372add':
</del><span class="cx">                                 return 'ISO_6937-2-add';
</span><span class="cx">
</span><span class="cx">                         case 'csiso8859supp':
</span><ins>+                        case 'iso8859supp':
</ins><span class="cx">                         case 'isoir154':
</span><del>-                        case 'iso8859supp':
</del><span class="cx">                         case 'latin125':
</span><span class="cx">                                 return 'ISO_8859-supp';
</span><span class="cx">
</span><span class="cx">                         case 'csiso10367box':
</span><ins>+                        case 'iso10367box':
</ins><span class="cx">                         case 'isoir155':
</span><del>-                        case 'iso10367box':
</del><span class="cx">                                 return 'ISO_10367-box';
</span><span class="cx">
</span><span class="cx">                         case 'csiso15italian':
</span><ins>+                        case 'iso646it':
</ins><span class="cx">                         case 'isoir15':
</span><del>-                        case 'iso646it':
</del><span class="cx">                         case 'it':
</span><span class="cx">                                 return 'IT';
</span><span class="cx">
</span><span class="lines">@@ -10008,12 +10331,12 @@
</span><span class="cx">                         case 'jisc62201969':
</span><span class="cx">                         case 'jisc62201969jp':
</span><span class="cx">                         case 'katakana':
</span><del>-                        case 'x02017':
</del><ins>+                        case 'x2017':
</ins><span class="cx">                                 return 'JIS_C6220-1969-jp';
</span><span class="cx">
</span><span class="cx">                         case 'csiso14jisc6220ro':
</span><ins>+                        case 'iso646jp':
</ins><span class="cx">                         case 'isoir14':
</span><del>-                        case 'iso646jp':
</del><span class="cx">                         case 'jisc62201969ro':
</span><span class="cx">                         case 'jp':
</span><span class="cx">                                 return 'JIS_C6220-1969-ro';
</span><span class="lines">@@ -10023,11 +10346,11 @@
</span><span class="cx">                         case 'jisc62261978':
</span><span class="cx">                                 return 'JIS_C6226-1978';
</span><span class="cx">
</span><del>-                        case 'csiso87jisx0208':
</del><ins>+                        case 'csiso87jisx208':
</ins><span class="cx">                         case 'isoir87':
</span><span class="cx">                         case 'jisc62261983':
</span><del>-                        case 'jisx02081983':
-                        case 'x0208':
</del><ins>+                        case 'jisx2081983':
+                        case 'x208':
</ins><span class="cx">                                 return 'JIS_C6226-1983';
</span><span class="cx">
</span><span class="cx">                         case 'csiso91jisc62291984a':
</span><span class="lines">@@ -10037,8 +10360,8 @@
</span><span class="cx">                                 return 'JIS_C6229-1984-a';
</span><span class="cx">
</span><span class="cx">                         case 'csiso92jisc62991984b':
</span><ins>+                        case 'iso646jpocrb':
</ins><span class="cx">                         case 'isoir92':
</span><del>-                        case 'iso646jpocrb':
</del><span class="cx">                         case 'jisc62291984b':
</span><span class="cx">                         case 'jpocrb':
</span><span class="cx">                                 return 'JIS_C6229-1984-b';
</span><span class="lines">@@ -10071,19 +10394,19 @@
</span><span class="cx">                                 return 'JIS_Encoding';
</span><span class="cx">
</span><span class="cx">                         case 'cshalfwidthkatakana':
</span><del>-                        case 'jisx0201':
-                        case 'x0201':
</del><ins>+                        case 'jisx201':
+                        case 'x201':
</ins><span class="cx">                                 return 'JIS_X0201';
</span><span class="cx">
</span><del>-                        case 'csiso159jisx02121990':
</del><ins>+                        case 'csiso159jisx2121990':
</ins><span class="cx">                         case 'isoir159':
</span><del>-                        case 'jisx02121990':
-                        case 'x0212':
</del><ins>+                        case 'jisx2121990':
+                        case 'x212':
</ins><span class="cx">                                 return 'JIS_X0212-1990';
</span><span class="cx">
</span><span class="cx">                         case 'csiso141jusib1002':
</span><ins>+                        case 'iso646yu':
</ins><span class="cx">                         case 'isoir141':
</span><del>-                        case 'iso646yu':
</del><span class="cx">                         case 'js':
</span><span class="cx">                         case 'jusib1002':
</span><span class="cx">                         case 'yu':
</span><span class="lines">@@ -10157,8 +10480,8 @@
</span><span class="cx">
</span><span class="cx">                         case 'csiso86hungarian':
</span><span class="cx">                         case 'hu':
</span><ins>+                        case 'iso646hu':
</ins><span class="cx">                         case 'isoir86':
</span><del>-                        case 'iso646hu':
</del><span class="cx">                         case 'msz77953':
</span><span class="cx">                                 return 'MSZ_7795.3';
</span><span class="cx">
</span><span class="lines">@@ -10184,46 +10507,46 @@
</span><span class="cx">
</span><span class="cx">                         case 'csiso151cuba':
</span><span class="cx">                         case 'cuba':
</span><ins>+                        case 'iso646cu':
</ins><span class="cx">                         case 'isoir151':
</span><del>-                        case 'iso646cu':
-                        case 'ncnc001081':
</del><ins>+                        case 'ncnc1081':
</ins><span class="cx">                                 return 'NC_NC00-10:81';
</span><span class="cx">
</span><span class="cx">                         case 'csiso69french':
</span><span class="cx">                         case 'fr':
</span><ins>+                        case 'iso646fr':
</ins><span class="cx">                         case 'isoir69':
</span><del>-                        case 'iso646fr':
</del><span class="cx">                         case 'nfz62010':
</span><span class="cx">                                 return 'NF_Z_62-010';
</span><span class="cx">
</span><span class="cx">                         case 'csiso25french':
</span><ins>+                        case 'iso646fr1':
</ins><span class="cx">                         case 'isoir25':
</span><del>-                        case 'iso646fr1':
</del><span class="cx">                         case 'nfz620101973':
</span><span class="cx">                                 return 'NF_Z_62-010_(1973)';
</span><span class="cx">
</span><span class="cx">                         case 'csiso60danishnorwegian':
</span><span class="cx">                         case 'csiso60norwegian1':
</span><ins>+                        case 'iso646no':
</ins><span class="cx">                         case 'isoir60':
</span><del>-                        case 'iso646no':
</del><span class="cx">                         case 'no':
</span><span class="cx">                         case 'ns45511':
</span><span class="cx">                                 return 'NS_4551-1';
</span><span class="cx">
</span><span class="cx">                         case 'csiso61norwegian2':
</span><ins>+                        case 'iso646no2':
</ins><span class="cx">                         case 'isoir61':
</span><del>-                        case 'iso646no2':
</del><span class="cx">                         case 'no2':
</span><span class="cx">                         case 'ns45512':
</span><span class="cx">                                 return 'NS_4551-2';
</span><span class="cx">
</span><del>-                        case 'osdebcdicdf03irv':
</del><ins>+                        case 'osdebcdicdf3irv':
</ins><span class="cx">                                 return 'OSD_EBCDIC_DF03_IRV';
</span><span class="cx">
</span><del>-                        case 'osdebcdicdf041':
</del><ins>+                        case 'osdebcdicdf41':
</ins><span class="cx">                                 return 'OSD_EBCDIC_DF04_1';
</span><span class="cx">
</span><del>-                        case 'osdebcdicdf0415':
</del><ins>+                        case 'osdebcdicdf415':
</ins><span class="cx">                                 return 'OSD_EBCDIC_DF04_15';
</span><span class="cx">
</span><span class="cx">                         case 'cspc8danishnorwegian':
</span><span class="lines">@@ -10235,14 +10558,14 @@
</span><span class="cx">                                 return 'PC8-Turkish';
</span><span class="cx">
</span><span class="cx">                         case 'csiso16portuguese':
</span><ins>+                        case 'iso646pt':
</ins><span class="cx">                         case 'isoir16':
</span><del>-                        case 'iso646pt':
</del><span class="cx">                         case 'pt':
</span><span class="cx">                                 return 'PT';
</span><span class="cx">
</span><span class="cx">                         case 'csiso84portuguese2':
</span><ins>+                        case 'iso646pt2':
</ins><span class="cx">                         case 'isoir84':
</span><del>-                        case 'iso646pt2':
</del><span class="cx">                         case 'pt2':
</span><span class="cx">                                 return 'PT2';
</span><span class="cx">
</span><span class="lines">@@ -10258,16 +10581,16 @@
</span><span class="cx">
</span><span class="cx">                         case 'csiso10swedish':
</span><span class="cx">                         case 'fi':
</span><del>-                        case 'isoir10':
</del><span class="cx">                         case 'iso646fi':
</span><span class="cx">                         case 'iso646se':
</span><ins>+                        case 'isoir10':
</ins><span class="cx">                         case 'se':
</span><span class="cx">                         case 'sen850200b':
</span><span class="cx">                                 return 'SEN_850200_B';
</span><span class="cx">
</span><span class="cx">                         case 'csiso11swedishfornames':
</span><ins>+                        case 'iso646se2':
</ins><span class="cx">                         case 'isoir11':
</span><del>-                        case 'iso646se2':
</del><span class="cx">                         case 'se2':
</span><span class="cx">                         case 'sen850200c':
</span><span class="cx">                                 return 'SEN_850200_C';
</span><span class="lines">@@ -10315,9 +10638,9 @@
</span><span class="cx">                         case 'cp367':
</span><span class="cx">                         case 'csascii':
</span><span class="cx">                         case 'ibm367':
</span><ins>+                        case 'iso646irv1991':
+                        case 'iso646us':
</ins><span class="cx">                         case 'isoir6':
</span><del>-                        case 'iso646us':
-                        case 'iso646irv1991':
</del><span class="cx">                         case 'us':
</span><span class="cx">                         case 'usascii':
</span><span class="cx">                                 return 'US-ASCII';
</span><span class="lines">@@ -10381,18 +10704,18 @@
</span><span class="cx">
</span><span class="cx">                         case 'iso885911':
</span><span class="cx">                         case 'tis620':
</span><del>-                                return 'Windows-874';
</del><ins>+                                return 'windows-874';
</ins><span class="cx">
</span><span class="cx">                         case 'cseuckr':
</span><ins>+                        case 'csksc56011987':
</ins><span class="cx">                         case 'euckr':
</span><del>-                        case 'windows949':
-                        case 'csksc56011987':
</del><span class="cx">                         case 'isoir149':
</span><span class="cx">                         case 'korean':
</span><span class="cx">                         case 'ksc5601':
</span><span class="cx">                         case 'ksc56011987':
</span><span class="cx">                         case 'ksc56011989':
</span><del>-                                return 'Windows-949';
</del><ins>+                        case 'windows949':
+                                return 'windows-949';
</ins><span class="cx">
</span><span class="cx">                         case 'windows1250':
</span><span class="cx">                                 return 'windows-1250';
</span><span class="lines">@@ -10404,14 +10727,11 @@
</span><span class="cx">                         case 'csisolatin1':
</span><span class="cx">                         case 'ibm819':
</span><span class="cx">                         case 'iso88591':
</span><ins>+                        case 'iso885911987':
</ins><span class="cx">                         case 'isoir100':
</span><del>-                        case 'iso885911987':
</del><span class="cx">                         case 'l1':
</span><span class="cx">                         case 'latin1':
</span><span class="cx">                         case 'windows1252':
</span><del>-                                return 'Windows-1252';
-
-                        case 'windows1252':
</del><span class="cx">                                 return 'windows-1252';
</span><span class="cx">
</span><span class="cx">                         case 'windows1253':
</span><span class="lines">@@ -10419,14 +10739,11 @@
</span><span class="cx">
</span><span class="cx">                         case 'csisolatin5':
</span><span class="cx">                         case 'iso88599':
</span><ins>+                        case 'iso885991989':
</ins><span class="cx">                         case 'isoir148':
</span><del>-                        case 'iso885991989':
</del><span class="cx">                         case 'l5':
</span><span class="cx">                         case 'latin5':
</span><span class="cx">                         case 'windows1254':
</span><del>-                                return 'Windows-1254';
-
-                        case 'windows1254':
</del><span class="cx">                                 return 'windows-1254';
</span><span class="cx">
</span><span class="cx">                         case 'windows1255':
</span><span class="lines">@@ -10452,11 +10769,11 @@
</span><span class="cx">                 {
</span><span class="cx">                         $curl = $curl['version'];
</span><span class="cx">                 }
</span><del>-                elseif (substr($curl, 0, 5) == 'curl/')
</del><ins>+                elseif (substr($curl, 0, 5) === 'curl/')
</ins><span class="cx">                 {
</span><span class="cx">                         $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5));
</span><span class="cx">                 }
</span><del>-                elseif (substr($curl, 0, 8) == 'libcurl/')
</del><ins>+                elseif (substr($curl, 0, 8) === 'libcurl/')
</ins><span class="cx">                 {
</span><span class="cx">                         $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8));
</span><span class="cx">                 }
</span><span class="lines">@@ -10469,7 +10786,7 @@
</span><span class="cx">
</span><span class="cx">         function is_subclass_of($class1, $class2)
</span><span class="cx">         {
</span><del>-                if (func_num_args() != 2)
</del><ins>+                if (func_num_args() !== 2)
</ins><span class="cx">                 {
</span><span class="cx">                         trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING);
</span><span class="cx">                 }
</span><span class="lines">@@ -10486,7 +10803,7 @@
</span><span class="cx">                                         $class2 = strtolower($class2);
</span><span class="cx">                                         while ($class1 = strtolower(get_parent_class($class1)))
</span><span class="cx">                                         {
</span><del>-                                                if ($class1 == $class2)
</del><ins>+                                                if ($class1 === $class2)
</ins><span class="cx">                                                 {
</span><span class="cx">                                                         return true;
</span><span class="cx">                                                 }
</span><span class="lines">@@ -10633,7 +10950,7 @@
</span><span class="cx">
</span><span class="cx">         function atom_03_construct_type($attribs)
</span><span class="cx">         {
</span><del>-                if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) == 'base64'))
</del><ins>+                if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64'))
</ins><span class="cx">                 {
</span><span class="cx">                         $mode = SIMPLEPIE_CONSTRUCT_BASE64;
</span><span class="cx">                 }
</span><span class="lines">@@ -10705,7 +11022,7 @@
</span><span class="cx">                                 case 'xhtml':
</span><span class="cx">                                         return SIMPLEPIE_CONSTRUCT_XHTML;
</span><span class="cx">                         }
</span><del>-                        if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) == 'text/')
</del><ins>+                        if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/')
</ins><span class="cx">                         {
</span><span class="cx">                                 return SIMPLEPIE_CONSTRUCT_NONE;
</span><span class="cx">                         }
</span><span class="lines">@@ -11005,8 +11322,45 @@
</span><span class="cx">                 }
</span><span class="cx">                 return $encoding;
</span><span class="cx">         }
</span><ins>+
+        function output_javascript()
+        {
+                if (function_exists('ob_gzhandler'))
+                {
+                        ob_start('ob_gzhandler');
+                }
+                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>');
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+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>');
+}
+
+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
+        }
+}
+
</ins><span class="cx"> /**
</span><span class="cx"> * Decode HTML Entities
</span><span class="cx"> *
</span><span class="lines">@@ -11083,7 +11437,6 @@
</span><span class="cx">                 }
</span><span class="cx">                 else
</span><span class="cx">                 {
</span><del>-                        $this->consumed = false;
</del><span class="cx">                         return false;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -11106,7 +11459,6 @@
</span><span class="cx">                 }
</span><span class="cx">                 else
</span><span class="cx">                 {
</span><del>-                        $this->consumed = false;
</del><span class="cx">                         return false;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -11180,7 +11532,7 @@
</span><span class="cx">                                                 $replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
</span><span class="cx">                                         }
</span><span class="cx">
</span><del>-                                        if ($this->consume() != ';')
</del><ins>+                                        if (!in_array($this->consume(), array(';', false), true))
</ins><span class="cx">                                         {
</span><span class="cx">                                                 $this->unconsume();
</span><span class="cx">                                         }
</span><span class="lines">@@ -11214,6 +11566,959 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * IRI parser/serialiser
+ *
+ * @package SimplePie
+ */
+class SimplePie_IRI
+{
+        /**
+         * Scheme
+         *
+         * @access private
+         * @var string
+         */
+        var $scheme;
+
+        /**
+         * User Information
+         *
+         * @access private
+         * @var string
+         */
+        var $userinfo;
+
+        /**
+         * Host
+         *
+         * @access private
+         * @var string
+         */
+        var $host;
+
+        /**
+         * Port
+         *
+         * @access private
+         * @var string
+         */
+        var $port;
+
+        /**
+         * Path
+         *
+         * @access private
+         * @var string
+         */
+        var $path;
+
+        /**
+         * Query
+         *
+         * @access private
+         * @var string
+         */
+        var $query;
+
+        /**
+         * Fragment
+         *
+         * @access private
+         * @var string
+         */
+        var $fragment;
+
+        /**
+         * Whether the object represents a valid IRI
+         *
+         * @access private
+         * @var array
+         */
+        var $valid = array();
+
+        /**
+         * Return the entire IRI when you try and read the object as a string
+         *
+         * @access public
+         * @return string
+         */
+        function __toString()
+        {
+                return $this->get_iri();
+        }
+
+        /**
+         * Create a new IRI object, from a specified string
+         *
+         * @access public
+         * @param string $iri
+         * @return SimplePie_IRI
+         */
+        function SimplePie_IRI($iri)
+        {
+                $iri = (string) $iri;
+                if ($iri !== '')
+                {
+                        $parsed = $this->parse_iri($iri);
+                        $this->set_scheme($parsed['scheme']);
+                        $this->set_authority($parsed['authority']);
+                        $this->set_path($parsed['path']);
+                        $this->set_query($parsed['query']);
+                        $this->set_fragment($parsed['fragment']);
+                }
+        }
+
+        /**
+         * Create a new IRI object by resolving a relative IRI
+         *
+         * @static
+         * @access public
+         * @param SimplePie_IRI $base Base IRI
+         * @param string $relative Relative IRI
+         * @return SimplePie_IRI
+         */
+        function absolutize($base, $relative)
+        {
+                $relative = (string) $relative;
+                if ($relative !== '')
+                {
+                        $relative =& new SimplePie_IRI($relative);
+                        if ($relative->get_scheme() !== null)
+                        {
+                                $target = $relative;
+                        }
+                        elseif ($base->get_iri() !== null)
+                        {
+                                if ($relative->get_authority() !== null)
+                                {
+                                        $target = $relative;
+                                        $target->set_scheme($base->get_scheme());
+                                }
+                                else
+                                {
+                                        $target =& new SimplePie_IRI('');
+                                        $target->set_scheme($base->get_scheme());
+                                        $target->set_userinfo($base->get_userinfo());
+                                        $target->set_host($base->get_host());
+                                        $target->set_port($base->get_port());
+                                        if ($relative->get_path() !== null)
+                                        {
+                                                if (strpos($relative->get_path(), '/') === 0)
+                                                {
+                                                        $target->set_path($relative->get_path());
+                                                }
+                                                elseif (($base->get_userinfo() !== null || $base->get_host() !== null || $base->get_port() !== null) && $base->get_path() === null)
+                                                {
+                                                        $target->set_path('/' . $relative->get_path());
+                                                }
+                                                elseif (($last_segment = strrpos($base->get_path(), '/')) !== false)
+                                                {
+                                                        $target->set_path(substr($base->get_path(), 0, $last_segment + 1) . $relative->get_path());
+                                                }
+                                                else
+                                                {
+                                                        $target->set_path($relative->get_path());
+                                                }
+                                                $target->set_query($relative->get_query());
+                                        }
+                                        else
+                                        {
+                                                $target->set_path($base->get_path());
+                                                if ($relative->get_query() !== null)
+                                                {
+                                                        $target->set_query($relative->get_query());
+                                                }
+                                                elseif ($base->get_query() !== null)
+                                                {
+                                                        $target->set_query($base->get_query());
+                                                }
+                                        }
+                                }
+                                $target->set_fragment($relative->get_fragment());
+                        }
+                        else
+                        {
+                                // No base URL, just return the relative URL
+                                $target = $relative;
+                        }
+                }
+                else
+                {
+                        $target = $base;
+                }
+                return $target;
+        }
+
+        /**
+         * Parse an IRI into scheme/authority/path/query/fragment segments
+         *
+         * @access private
+         * @param string $iri
+         * @return array
+         */
+        function parse_iri($iri)
+        {
+                preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $iri, $match);
+                for ($i = count($match); $i <= 9; $i++)
+                {
+                        $match[$i] = '';
+                }
+                return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
+        }
+
+        /**
+         * Remove dot segments from a path
+         *
+         * @access private
+         * @param string $input
+         * @return string
+         */
+        function remove_dot_segments($input)
+        {
+                $output = '';
+                while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
+                {
+                        // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
+                        if (strpos($input, '../') === 0)
+                        {
+                                $input = substr($input, 3);
+                        }
+                        elseif (strpos($input, './') === 0)
+                        {
+                                $input = substr($input, 2);
+                        }
+                        // B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise,
+                        elseif (strpos($input, '/./') === 0)
+                        {
+                                $input = substr_replace($input, '/', 0, 3);
+                        }
+                        elseif ($input === '/.')
+                        {
+                                $input = '/';
+                        }
+                        // C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise,
+                        elseif (strpos($input, '/../') === 0)
+                        {
+                                $input = substr_replace($input, '/', 0, 4);
+                                $output = substr_replace($output, '', strrpos($output, '/'));
+                        }
+                        elseif ($input === '/..')
+                        {
+                                $input = '/';
+                                $output = substr_replace($output, '', strrpos($output, '/'));
+                        }
+                        // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
+                        elseif ($input === '.' || $input === '..')
+                        {
+                                $input = '';
+                        }
+                        // E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer
+                        elseif (($pos = strpos($input, '/', 1)) !== false)
+                        {
+                                $output .= substr($input, 0, $pos);
+                                $input = substr_replace($input, '', 0, $pos);
+                        }
+                        else
+                        {
+                                $output .= $input;
+                                $input = '';
+                        }
+                }
+                return $output . $input;
+        }
+
+        /**
+         * Replace invalid character with percent encoding
+         *
+         * @access private
+         * @param string $string Input string
+         * @param string $valid_chars Valid characters
+         * @param int $case Normalise case
+         * @return string
+         */
+        function replace_invalid_with_pct_encoding($string, $valid_chars, $case = SIMPLEPIE_SAME_CASE)
+        {
+                // Normalise case
+                if ($case & SIMPLEPIE_LOWERCASE)
+                {
+                        $string = strtolower($string);
+                }
+                elseif ($case & SIMPLEPIE_UPPERCASE)
+                {
+                        $string = strtoupper($string);
+                }
+
+                // Store position and string length (to avoid constantly recalculating this)
+                $position = 0;
+                $strlen = strlen($string);
+
+                // Loop as long as we have invalid characters, advancing the position to the next invalid character
+                while (($position += strspn($string, $valid_chars, $position)) < $strlen)
+                {
+                        // If we have a % character
+                        if ($string[$position] === '%')
+                        {
+                                // If we have a pct-encoded section
+                                if ($position + 2 < $strlen && strspn($string, '0123456789ABCDEFabcdef', $position + 1, 2) === 2)
+                                {
+                                        // Get the the represented character
+                                        $chr = chr(hexdec(substr($string, $position + 1, 2)));
+
+                                        // If the character is valid, replace the pct-encoded with the actual character while normalising case
+                                        if (strpos($valid_chars, $chr) !== false)
+                                        {
+                                                if ($case & SIMPLEPIE_LOWERCASE)
+                                                {
+                                                        $chr = strtolower($chr);
+                                                }
+                                                elseif ($case & SIMPLEPIE_UPPERCASE)
+                                                {
+                                                        $chr = strtoupper($chr);
+                                                }
+                                                $string = substr_replace($string, $chr, $position, 3);
+                                                $strlen -= 2;
+                                                $position++;
+                                        }
+
+                                        // Otherwise just normalise the pct-encoded to uppercase
+                                        else
+                                        {
+                                                $string = substr_replace($string, strtoupper(substr($string, $position + 1, 2)), $position + 1, 2);
+                                                $position += 3;
+                                        }
+                                }
+                                // If we don't have a pct-encoded section, just replace the % with its own esccaped form
+                                else
+                                {
+                                        $string = substr_replace($string, '%25', $position, 1);
+                                        $strlen += 2;
+                                        $position += 3;
+                                }
+                        }
+                        // If we have an invalid character, change into its pct-encoded form
+                        else
+                        {
+                                $replacement = sprintf("%%%02X", ord($string[$position]));
+                                $string = str_replace($string[$position], $replacement, $string);
+                                $strlen = strlen($string);
+                        }
+                }
+                return $string;
+        }
+
+        /**
+         * Check if the object represents a valid IRI
+         *
+         * @access public
+         * @return bool
+         */
+        function is_valid()
+        {
+                return array_sum($this->valid) === count($this->valid);
+        }
+
+        /**
+         * Set the scheme. Returns true on success, false on failure (if there are
+         * any invalid characters).
+         *
+         * @access public
+         * @param string $scheme
+         * @return bool
+         */
+        function set_scheme($scheme)
+        {
+                if ($scheme === null || $scheme === '')
+                {
+                        $this->scheme = null;
+                }
+                else
+                {
+                        $len = strlen($scheme);
+                        switch (true)
+                        {
+                                case $len > 1:
+                                        if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1))
+                                        {
+                                                $this->scheme = null;
+                                                $this->valid[__FUNCTION__] = false;
+                                                return false;
+                                        }
+
+                                case $len > 0:
+                                        if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1))
+                                        {
+                                                $this->scheme = null;
+                                                $this->valid[__FUNCTION__] = false;
+                                                return false;
+                                        }
+                        }
+                        $this->scheme = strtolower($scheme);
+                }
+                $this->valid[__FUNCTION__] = true;
+                return true;
+        }
+
+        /**
+         * Set the authority. Returns true on success, false on failure (if there are
+         * any invalid characters).
+         *
+         * @access public
+         * @param string $authority
+         * @return bool
+         */
+        function set_authority($authority)
+        {
+                if (($userinfo_end = strrpos($authority, '@')) !== false)
+                {
+                        $userinfo = substr($authority, 0, $userinfo_end);
+                        $authority = substr($authority, $userinfo_end + 1);
+                }
+                else
+                {
+                        $userinfo = null;
+                }
+
+                if (($port_start = strpos($authority, ':')) !== false)
+                {
+                        $port = substr($authority, $port_start + 1);
+                        $authority = substr($authority, 0, $port_start);
+                }
+                else
+                {
+                        $port = null;
+                }
+
+                return $this->set_userinfo($userinfo) && $this->set_host($authority) && $this->set_port($port);
+        }
+
+        /**
+         * Set the userinfo.
+         *
+         * @access public
+         * @param string $userinfo
+         * @return bool
+         */
+        function set_userinfo($userinfo)
+        {
+                if ($userinfo === null || $userinfo === '')
+                {
+                        $this->userinfo = null;
+                }
+                else
+                {
+                        $this->userinfo = $this->replace_invalid_with_pct_encoding($userinfo, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:');
+                }
+                $this->valid[__FUNCTION__] = true;
+                return true;
+        }
+
+        /**
+         * Set the host. Returns true on success, false on failure (if there are
+         * any invalid characters).
+         *
+         * @access public
+         * @param string $host
+         * @return bool
+         */
+        function set_host($host)
+        {
+                if ($host === null || $host === '')
+                {
+                        $this->host = null;
+                        $this->valid[__FUNCTION__] = true;
+                        return true;
+                }
+                elseif ($host[0] === '[' && substr($host, -1) === ']')
+                {
+                        if (Net_IPv6::checkIPv6(substr($host, 1, -1)))
+                        {
+                                $this->host = $host;
+                                $this->valid[__FUNCTION__] = true;
+                                return true;
+                        }
+                        else
+                        {
+                                $this->host = null;
+                                $this->valid[__FUNCTION__] = false;
+                                return false;
+                        }
+                }
+                else
+                {
+                        $this->host = $this->replace_invalid_with_pct_encoding($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=', SIMPLEPIE_LOWERCASE);
+                        $this->valid[__FUNCTION__] = true;
+                        return true;
+                }
+        }
+
+        /**
+         * Set the port. Returns true on success, false on failure (if there are
+         * any invalid characters).
+         *
+         * @access public
+         * @param string $port
+         * @return bool
+         */
+        function set_port($port)
+        {
+                if ($port === null || $port === '')
+                {
+                        $this->port = null;
+                        $this->valid[__FUNCTION__] = true;
+                        return true;
+                }
+                elseif (strspn($port, '0123456789') === strlen($port))
+                {
+                        $this->port = (int) $port;
+                        $this->valid[__FUNCTION__] = true;
+                        return true;
+                }
+                else
+                {
+                        $this->port = null;
+                        $this->valid[__FUNCTION__] = false;
+                        return false;
+                }
+        }
+
+        /**
+         * Set the path.
+         *
+         * @access public
+         * @param string $path
+         * @return bool
+         */
+        function set_path($path)
+        {
+                if ($path === null || $path === '')
+                {
+                        $this->path = null;
+                        $this->valid[__FUNCTION__] = true;
+                        return true;
+                }
+                elseif (substr($path, 0, 2) === '//' && $this->userinfo === null && $this->host === null && $this->port === null)
+                {
+                        $this->path = null;
+                        $this->valid[__FUNCTION__] = false;
+                        return false;
+                }
+                else
+                {
+                        $this->path = $this->replace_invalid_with_pct_encoding($path, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=@/');
+                        if ($this->scheme !== null)
+                        {
+                                $this->path = $this->remove_dot_segments($this->path);
+                        }
+                        $this->valid[__FUNCTION__] = true;
+                        return true;
+                }
+        }
+
+        /**
+         * Set the query.
+         *
+         * @access public
+         * @param string $query
+         * @return bool
+         */
+        function set_query($query)
+        {
+                if ($query === null || $query === '')
+                {
+                        $this->query = null;
+                }
+                else
+                {
+                        $this->query = $this->replace_invalid_with_pct_encoding($query, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?');
+                }
+                $this->valid[__FUNCTION__] = true;
+                return true;
+        }
+
+        /**
+         * Set the fragment.
+         *
+         * @access public
+         * @param string $fragment
+         * @return bool
+         */
+        function set_fragment($fragment)
+        {
+                if ($fragment === null || $fragment === '')
+                {
+                        $this->fragment = null;
+                }
+                else
+                {
+                        $this->fragment = $this->replace_invalid_with_pct_encoding($fragment, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?');
+                }
+                $this->valid[__FUNCTION__] = true;
+                return true;
+        }
+
+        /**
+         * Get the complete IRI
+         *
+         * @access public
+         * @return string
+         */
+        function get_iri()
+        {
+                $iri = '';
+                if ($this->scheme !== null)
+                {
+                        $iri .= $this->scheme . ':';
+                }
+                if (($authority = $this->get_authority()) !== null)
+                {
+                        $iri .= '//' . $authority;
+                }
+                if ($this->path !== null)
+                {
+                        $iri .= $this->path;
+                }
+                if ($this->query !== null)
+                {
+                        $iri .= '?' . $this->query;
+                }
+                if ($this->fragment !== null)
+                {
+                        $iri .= '#' . $this->fragment;
+                }
+
+                if ($iri !== '')
+                {
+                        return $iri;
+                }
+                else
+                {
+                        return null;
+                }
+        }
+
+        /**
+         * Get the scheme
+         *
+         * @access public
+         * @return string
+         */
+        function get_scheme()
+        {
+                return $this->scheme;
+        }
+
+        /**
+         * Get the complete authority
+         *
+         * @access public
+         * @return string
+         */
+        function get_authority()
+        {
+                $authority = '';
+                if ($this->userinfo !== null)
+                {
+                        $authority .= $this->userinfo . '@';
+                }
+                if ($this->host !== null)
+                {
+                        $authority .= $this->host;
+                }
+                if ($this->port !== null)
+                {
+                        $authority .= ':' . $this->port;
+                }
+
+                if ($authority !== '')
+                {
+                        return $authority;
+                }
+                else
+                {
+                        return null;
+                }
+        }
+
+        /**
+         * Get the user information
+         *
+         * @access public
+         * @return string
+         */
+        function get_userinfo()
+        {
+                return $this->userinfo;
+        }
+
+        /**
+         * Get the host
+         *
+         * @access public
+         * @return string
+         */
+        function get_host()
+        {
+                return $this->host;
+        }
+
+        /**
+         * Get the port
+         *
+         * @access public
+         * @return string
+         */
+        function get_port()
+        {
+                return $this->port;
+        }
+
+        /**
+         * Get the path
+         *
+         * @access public
+         * @return string
+         */
+        function get_path()
+        {
+                return $this->path;
+        }
+
+        /**
+         * Get the query
+         *
+         * @access public
+         * @return string
+         */
+        function get_query()
+        {
+                return $this->query;
+        }
+
+        /**
+         * Get the fragment
+         *
+         * @access public
+         * @return string
+         */
+        function get_fragment()
+        {
+                return $this->fragment;
+        }
+}
+
+/**
+ * Class to validate and to work with IPv6 addresses.
+ *
+ * @package SimplePie
+ * @copyright 2003-2005 The PHP Group
+ * @license http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/package/Net_IPv6
+ * @author Alexander Merz <alexander.merz@web.de>
+ * @author elfrink at introweb dot nl
+ * @author Josh Peck <jmp at joshpeck dot org>
+ * @author Geoffrey Sneddon <geoffers@gmail.com>
+ */
+class SimplePie_Net_IPv6
+{
+        /**
+         * Removes a possible existing netmask specification of an IP address.
+         *
+         * @param string $ip the (compressed) IP as Hex representation
+         * @return string the IP the without netmask
+         * @since 1.1.0
+         * @access public
+         * @static
+         */
+        function removeNetmaskSpec($ip)
+        {
+                if (strpos($ip, '/') !== false)
+                {
+                        list($addr, $nm) = explode('/', $ip);
+                }
+                else
+                {
+                        $addr = $ip;
+                }
+                return $addr;
+        }
+
+        /**
+         * Uncompresses an IPv6 address
+         *
+         * RFC 2373 allows you to compress zeros in an address to '::'. This
+         * function expects an valid IPv6 address and expands the '::' to
+         * the required zeros.
+         *
+         * Example:         FF01::101        ->        FF01:0:0:0:0:0:0:101
+         *                         ::1                ->        0:0:0:0:0:0:0:1
+         *
+         * @access public
+         * @static
+         * @param string $ip a valid IPv6-address (hex format)
+         * @return string the uncompressed IPv6-address (hex format)
+         */
+        function Uncompress($ip)
+        {
+                $uip = SimplePie_Net_IPv6::removeNetmaskSpec($ip);
+                $c1 = -1;
+                $c2 = -1;
+                if (strpos($ip, '::') !== false)
+                {
+                        list($ip1, $ip2) = explode('::', $ip);
+                        if ($ip1 === '')
+                        {
+                                $c1 = -1;
+                        }
+                        else
+                        {
+                                $pos = 0;
+                                if (($pos = substr_count($ip1, ':')) > 0)
+                                {
+                                        $c1 = $pos;
+                                }
+                                else
+                                {
+                                        $c1 = 0;
+                                }
+                        }
+                        if ($ip2 === '')
+                        {
+                                $c2 = -1;
+                        }
+                        else
+                        {
+                                $pos = 0;
+                                if (($pos = substr_count($ip2, ':')) > 0)
+                                {
+                                        $c2 = $pos;
+                                }
+                                else
+                                {
+                                        $c2 = 0;
+                                }
+                        }
+                        if (strstr($ip2, '.'))
+                        {
+                                $c2++;
+                        }
+                        // ::
+                        if ($c1 === -1 && $c2 === -1)
+                        {
+                                $uip = '0:0:0:0:0:0:0:0';
+                        }
+                        // ::xxx
+                        else if ($c1 === -1)
+                        {
+                                $fill = str_repeat('0:', 7 - $c2);
+                                $uip =        str_replace('::', $fill, $uip);
+                        }
+                        // xxx::
+                        else if ($c2 === -1)
+                        {
+                                $fill = str_repeat(':0', 7 - $c1);
+                                $uip =        str_replace('::', $fill, $uip);
+                        }
+                        // xxx::xxx
+                        else
+                        {
+                                $fill = str_repeat(':0:', 6 - $c2 - $c1);
+                                $uip =        str_replace('::', $fill, $uip);
+                                $uip =        str_replace('::', ':', $uip);
+                        }
+                }
+                return $uip;
+        }
+
+        /**
+         * Splits an IPv6 address into the IPv6 and a possible IPv4 part
+         *
+         * RFC 2373 allows you to note the last two parts of an IPv6 address as
+         * an IPv4 compatible address
+         *
+         * Example:         0:0:0:0:0:0:13.1.68.3
+         *                         0:0:0:0:0:FFFF:129.144.52.38
+         *
+         * @access public
+         * @static
+         * @param string $ip a valid IPv6-address (hex format)
+         * @return array [0] contains the IPv6 part, [1] the IPv4 part (hex format)
+         */
+        function SplitV64($ip)
+        {
+                $ip = SimplePie_Net_IPv6::Uncompress($ip);
+                if (strstr($ip, '.'))
+                {
+                        $pos = strrpos($ip, ':');
+                        $ip[$pos] = '_';
+                        $ipPart = explode('_', $ip);
+                        return $ipPart;
+                }
+                else
+                {
+                        return array($ip, '');
+                }
+        }
+
+        /**
+         * Checks an IPv6 address
+         *
+         * Checks if the given IP is IPv6-compatible
+         *
+         * @access public
+         * @static
+         * @param string $ip a valid IPv6-address
+         * @return bool true if $ip is an IPv6 address
+         */
+        function checkIPv6($ip)
+        {
+                $ipPart = SimplePie_Net_IPv6::SplitV64($ip);
+                $count = 0;
+                if (!empty($ipPart[0]))
+                {
+                        $ipv6 = explode(':', $ipPart[0]);
+                        for ($i = 0; $i < count($ipv6); $i++)
+                        {
+                                $dec = hexdec($ipv6[$i]);
+                                $hex = strtoupper(preg_replace('/^[0]{1,3}(.*[0-9a-fA-F])$/', '\\1', $ipv6[$i]));
+                                if ($ipv6[$i] >= 0 && $dec <= 65535 && $hex === strtoupper(dechex($dec)))
+                                {
+                                        $count++;
+                                }
+                        }
+                        if ($count === 8)
+                        {
+                                return true;
+                        }
+                        elseif ($count === 6 && !empty($ipPart[1]))
+                        {
+                                $ipv4 = explode('.', $ipPart[1]);
+                                $count = 0;
+                                foreach ($ipv4 as $ipv4_part)
+                                {
+                                        if ($ipv4_part >= 0 && $ipv4_part <= 255 && preg_match('/^\d{1,3}$/', $ipv4_part))
+                                        {
+                                                $count++;
+                                        }
+                                }
+                                if ($count === 4)
+                                {
+                                        return true;
+                                }
+                        }
+                        else
+                        {
+                                return false;
+                        }
+
+                }
+                else
+                {
+                        return false;
+                }
+        }
+}
+
+/**
</ins><span class="cx"> * Date Parser
</span><span class="cx"> *
</span><span class="cx"> * @package SimplePie
</span><span class="lines">@@ -12769,7 +14074,7 @@
</span><span class="cx">                 $this->content_type_sniffer_class = $content_type_sniffer_class;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function find($type = SIMPLEPIE_LOCATOR_ALL)
</del><ins>+        function find($type = SIMPLEPIE_LOCATOR_ALL, &$working)
</ins><span class="cx">         {
</span><span class="cx">                 if ($this->is_feed($this->file))
</span><span class="cx">                 {
</span><span class="lines">@@ -12792,7 +14097,7 @@
</span><span class="cx">
</span><span class="cx">                 if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery())
</span><span class="cx">                 {
</span><del>-                        return $working;
</del><ins>+                        return $working[0];
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 if ($type & (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links())
</span><span class="lines">@@ -12865,9 +14170,10 @@
</span><span class="cx">         {
</span><span class="cx">                 $links = array_merge(SimplePie_Misc::get_element('link', $this->file->body), SimplePie_Misc::get_element('a', $this->file->body), SimplePie_Misc::get_element('area', $this->file->body));
</span><span class="cx">                 $done = array();
</span><ins>+                $feeds = array();
</ins><span class="cx">                 foreach ($links as $link)
</span><span class="cx">                 {
</span><del>-                        if ($this->checked_feeds == $this->max_checked_feeds)
</del><ins>+                        if ($this->checked_feeds === $this->max_checked_feeds)
</ins><span class="cx">                         {
</span><span class="cx">                                 break;
</span><span class="cx">                         }
</span><span class="lines">@@ -12884,19 +14190,26 @@
</span><span class="cx">                                         $href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
</span><span class="cx">                                 }
</span><span class="cx">
</span><del>-                                if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))))
</del><ins>+                                if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href]))
</ins><span class="cx">                                 {
</span><span class="cx">                                         $this->checked_feeds++;
</span><span class="cx">                                         $feed =& new $this->file_class($href, $this->timeout, 5, null, $this->useragent);
</span><del>-                                        if ($this->is_feed($feed))
</del><ins>+                                        if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
</ins><span class="cx">                                         {
</span><del>-                                                return $feed;
</del><ins>+                                                $feeds[$href] = $feed;
</ins><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx">                                 $done[] = $href;
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-                return null;
</del><ins>+
+                if (!empty($feeds))
+                {
+                        return array_values($feeds);
+                }
+                else {
+                        return null;
+                }
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function get_links()
</span><span class="lines">@@ -12921,7 +14234,7 @@
</span><span class="cx">
</span><span class="cx">                                         $current = SimplePie_Misc::parse_url($this->file->url);
</span><span class="cx">
</span><del>-                                        if ($parsed['authority'] === '' || $parsed['authority'] == $current['authority'])
</del><ins>+                                        if ($parsed['authority'] === '' || $parsed['authority'] === $current['authority'])
</ins><span class="cx">                                         {
</span><span class="cx">                                                 $this->local[] = $href;
</span><span class="cx">                                         }
</span><span class="lines">@@ -12945,7 +14258,7 @@
</span><span class="cx">         {
</span><span class="cx">                 foreach ($array as $key => $value)
</span><span class="cx">                 {
</span><del>-                        if ($this->checked_feeds == $this->max_checked_feeds)
</del><ins>+                        if ($this->checked_feeds === $this->max_checked_feeds)
</ins><span class="cx">                         {
</span><span class="cx">                                 break;
</span><span class="cx">                         }
</span><span class="lines">@@ -12953,7 +14266,7 @@
</span><span class="cx">                         {
</span><span class="cx">                                 $this->checked_feeds++;
</span><span class="cx">                                 $feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
</span><del>-                                if ($this->is_feed($feed))
</del><ins>+                                if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
</ins><span class="cx">                                 {
</span><span class="cx">                                         return $feed;
</span><span class="cx">                                 }
</span><span class="lines">@@ -12970,7 +14283,7 @@
</span><span class="cx">         {
</span><span class="cx">                 foreach ($array as $key => $value)
</span><span class="cx">                 {
</span><del>-                        if ($this->checked_feeds == $this->max_checked_feeds)
</del><ins>+                        if ($this->checked_feeds === $this->max_checked_feeds)
</ins><span class="cx">                         {
</span><span class="cx">                                 break;
</span><span class="cx">                         }
</span><span class="lines">@@ -12978,7 +14291,7 @@
</span><span class="cx">                         {
</span><span class="cx">                                 $this->checked_feeds++;
</span><span class="cx">                                 $feed =& new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
</span><del>-                                if ($this->is_feed($feed))
</del><ins>+                                if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
</ins><span class="cx">                                 {
</span><span class="cx">                                         return $feed;
</span><span class="cx">                                 }
</span><span class="lines">@@ -13000,7 +14313,6 @@
</span><span class="cx">         var $current_column;
</span><span class="cx">         var $current_byte;
</span><span class="cx">         var $separator = ' ';
</span><del>-        var $feed = false;
</del><span class="cx">         var $namespace = array('');
</span><span class="cx">         var $element = array('');
</span><span class="cx">         var $xml_base = array('');
</span><span class="lines">@@ -13014,7 +14326,7 @@
</span><span class="cx">         function parse(&$data, $encoding)
</span><span class="cx">         {
</span><span class="cx">                 // Use UTF-8 if we get passed US-ASCII, as every US-ASCII character is a UTF-8 character
</span><del>-                if (strtoupper($encoding) == 'US-ASCII')
</del><ins>+                if (strtoupper($encoding) === 'US-ASCII')
</ins><span class="cx">                 {
</span><span class="cx">                         $this->encoding = 'UTF-8';
</span><span class="cx">                 }
</span><span class="lines">@@ -13065,35 +14377,110 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                // Work around libxml bug
-                $data = str_replace('&lt;', '&#60;', $data);
-                $data = str_replace('&gt;', '&#62;', $data);
-                $data = str_replace('&amp;', '&#38;', $data);
-                $data = str_replace('&apos;', '&#39;', $data);
-                $data = str_replace('&quot;', '&#34;', $data);
-
</del><span class="cx">                 $return = true;
</span><span class="cx">
</span><ins>+                static $xml_is_sane = null;
+                if ($xml_is_sane === null)
+                {
+                        $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']);
+                }
+
</ins><span class="cx">                 // Create the parser
</span><del>-                $xml = xml_parser_create_ns($this->encoding, $this->separator);
-                xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1);
-                xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0);
-                xml_set_object($xml, $this);
-                xml_set_character_data_handler($xml, 'cdata');
-                xml_set_element_handler($xml, 'tag_open', 'tag_close');
</del><ins>+                if ($xml_is_sane)
+                {
+                        $xml = xml_parser_create_ns($this->encoding, $this->separator);
+                        xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1);
+                        xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0);
+                        xml_set_object($xml, $this);
+                        xml_set_character_data_handler($xml, 'cdata');
+                        xml_set_element_handler($xml, 'tag_open', 'tag_close');
</ins><span class="cx">
</span><del>-                // Parse!
-                if (!xml_parse($xml, $data, true))
</del><ins>+                        // Parse!
+                        if (!xml_parse($xml, $data, true))
+                        {
+                                $this->error_code = xml_get_error_code($xml);
+                                $this->error_string = xml_error_string($this->error_code);
+                                $return = false;
+                        }
+                        $this->current_line = xml_get_current_line_number($xml);
+                        $this->current_column = xml_get_current_column_number($xml);
+                        $this->current_byte = xml_get_current_byte_index($xml);
+                        xml_parser_free($xml);
+                        return $return;
+                }
+                else
</ins><span class="cx">                 {
</span><del>-                        $this->error_code = xml_get_error_code($xml);
-                        $this->error_string = xml_error_string($this->error_code);
-                        $return = false;
</del><ins>+                        libxml_clear_errors();
+                        $xml =& new XMLReader();
+                        $xml->xml($data);
+                        while (@$xml->read())
+                        {
+                                switch ($xml->nodeType)
+                                {
+
+                                        case constant('XMLReader::END_ELEMENT'):
+                                                if ($xml->namespaceURI !== '')
+                                                {
+                                                        $tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+                                                }
+                                                else
+                                                {
+                                                        $tagName = $xml->localName;
+                                                }
+                                                $this->tag_close(null, $tagName);
+                                                break;
+                                        case constant('XMLReader::ELEMENT'):
+                                                $empty = $xml->isEmptyElement;
+                                                if ($xml->namespaceURI !== '')
+                                                {
+                                                        $tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+                                                }
+                                                else
+                                                {
+                                                        $tagName = $xml->localName;
+                                                }
+                                                $attributes = array();
+                                                while ($xml->moveToNextAttribute())
+                                                {
+                                                        if ($xml->namespaceURI !== '')
+                                                        {
+                                                                $attrName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+                                                        }
+                                                        else
+                                                        {
+                                                                $attrName = $xml->localName;
+                                                        }
+                                                        $attributes[$attrName] = $xml->value;
+                                                }
+                                                $this->tag_open(null, $tagName, $attributes);
+                                                if ($empty)
+                                                {
+                                                        $this->tag_close(null, $tagName);
+                                                }
+                                                break;
+                                        case constant('XMLReader::TEXT'):
+
+                                        case constant('XMLReader::CDATA'):
+                                                $this->cdata(null, $xml->value);
+                                                break;
+                                }
+                        }
+                        if ($error = libxml_get_last_error())
+                        {
+                                $this->error_code = $error->code;
+                                $this->error_string = $error->message;
+                                $this->current_line = $error->line;
+                                $this->current_column = $error->column;
+                                return false;
+                        }
+                        else
+                        {
+                                return true;
+                        }
</ins><span class="cx">                 }
</span><del>-                $this->current_line = xml_get_current_line_number($xml);
-                $this->current_column = xml_get_current_column_number($xml);
-                $this->current_byte = xml_get_current_byte_index($xml);
-                xml_parser_free($xml);
-                return $return;
</del><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function get_error_code()
</span><span class="lines">@@ -13128,27 +14515,6 @@
</span><span class="cx">
</span><span class="cx">         function tag_open($parser, $tag, $attributes)
</span><span class="cx">         {
</span><del>-                if ($this->feed === 0)
-                {
-                        return;
-                }
-                elseif ($this->feed == false)
-                {
-                        if (in_array($tag, array(
-                                SIMPLEPIE_NAMESPACE_ATOM_10 . $this->separator . 'feed',
-                                SIMPLEPIE_NAMESPACE_ATOM_03 . $this->separator . 'feed',
-                                'rss',
-                                SIMPLEPIE_NAMESPACE_RDF . $this->separator . 'RDF'
-                        )))
-                        {
-                                        $this->feed = 1;
-                        }
-                }
-                else
-                {
-                        $this->feed++;
-                }
-
</del><span class="cx">                 list($this->namespace[], $this->element[]) = $this->split_ns($tag);
</span><span class="cx">
</span><span class="cx">                 $attribs = array();
</span><span class="lines">@@ -13181,7 +14547,7 @@
</span><span class="cx">                 if ($this->current_xhtml_construct >= 0)
</span><span class="cx">                 {
</span><span class="cx">                         $this->current_xhtml_construct++;
</span><del>-                        if (end($this->namespace) == SIMPLEPIE_NAMESPACE_XHTML)
</del><ins>+                        if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML)
</ins><span class="cx">                         {
</span><span class="cx">                                 $this->data['data'] .= '<' . end($this->element);
</span><span class="cx">                                 if (isset($attribs['']))
</span><span class="lines">@@ -13199,8 +14565,8 @@
</span><span class="cx">                         $this->datas[] =& $this->data;
</span><span class="cx">                         $this->data =& $this->data['child'][end($this->namespace)][end($this->element)][];
</span><span class="cx">                         $this->data = array('data' => '', 'attribs' => $attribs, 'xml_base' => end($this->xml_base), 'xml_base_explicit' => end($this->xml_base_explicit), 'xml_lang' => end($this->xml_lang));
</span><del>-                        if ((end($this->namespace) == SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] == 'xml')
-                        || (end($this->namespace) == SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] == 'xhtml'))
</del><ins>+                        if ((end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] === 'xml')
+                        || (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml'))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this->current_xhtml_construct = 0;
</span><span class="cx">                         }
</span><span class="lines">@@ -13213,7 +14579,7 @@
</span><span class="cx">                 {
</span><span class="cx">                         $this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding);
</span><span class="cx">                 }
</span><del>-                elseif ($this->feed > 1)
</del><ins>+                else
</ins><span class="cx">                 {
</span><span class="cx">                         $this->data['data'] .= $cdata;
</span><span class="cx">                 }
</span><span class="lines">@@ -13221,22 +14587,17 @@
</span><span class="cx">
</span><span class="cx">         function tag_close($parser, $tag)
</span><span class="cx">         {
</span><del>-                if (!$this->feed)
-                {
-                        return;
-                }
-
</del><span class="cx">                 if ($this->current_xhtml_construct >= 0)
</span><span class="cx">                 {
</span><span class="cx">                         $this->current_xhtml_construct--;
</span><del>-                        if (end($this->namespace) == SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param')))
</del><ins>+                        if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param')))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this->data['data'] .= '</' . end($this->element) . '>';
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-                if ($this->current_xhtml_construct == -1)
</del><ins>+                if ($this->current_xhtml_construct === -1)
</ins><span class="cx">                 {
</span><del>-                        $this->data =& $this->datas[$this->feed];
</del><ins>+                        $this->data =& $this->datas[count($this->datas) - 1];
</ins><span class="cx">                         array_pop($this->datas);
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="lines">@@ -13245,7 +14606,6 @@
</span><span class="cx">                 array_pop($this->xml_base);
</span><span class="cx">                 array_pop($this->xml_base_explicit);
</span><span class="cx">                 array_pop($this->xml_lang);
</span><del>-                $this->feed--;
</del><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function split_ns($string)
</span><span class="lines">@@ -13543,7 +14903,7 @@
</span><span class="cx">                                                                 $file =& new $this->file_class($img['attribs']['src']['data'], $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
</span><span class="cx">                                                                 $headers = $file->headers;
</span><span class="cx">
</span><del>-                                                                if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)))
</del><ins>+                                                                if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
</ins><span class="cx">                                                                 {
</span><span class="cx">                                                                         if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
</span><span class="cx">                                                                         {
</span><span class="lines">@@ -13552,7 +14912,7 @@
</span><span class="cx">                                                                         }
</span><span class="cx">                                                                         else
</span><span class="cx">                                                                         {
</span><del>-                                                                                trigger_error("$cache->name is not writeable", E_USER_WARNING);
</del><ins>+                                                                                trigger_error("$this->cache_location is not writeable", E_USER_WARNING);
</ins><span class="cx">                                                                         }
</span><span class="cx">                                                                 }
</span><span class="cx">                                                         }
</span><span class="lines">@@ -13574,7 +14934,7 @@
</span><span class="cx">                                 $data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8');
</span><span class="cx">                         }
</span><span class="cx">
</span><del>-                        if ($this->output_encoding != 'UTF-8')
</del><ins>+                        if ($this->output_encoding !== 'UTF-8')
</ins><span class="cx">                         {
</span><span class="cx">                                 $data = SimplePie_Misc::change_encoding($data, 'UTF-8', $this->output_encoding);
</span><span class="cx">                         }
</span></span></pre>
</div>
</div>
</body>
</html>