<!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]*(?:&quot;(?:[^&quot;]*)&quot;|\'(?:[^\']*)\'|(?:[^\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 &quot;Razzleberry&quot;
- * @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-&gt;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-&gt;sanitize-&gt;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') &amp;&amp; version_compare(PHP_VERSION, '4.3.0', '&lt;')) || !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-&gt;javascript]))
</del><ins>+                // Then check the xml extension is sane (i.e., libxml 2.7.x issue on PHP &lt; 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, '&lt;foo&gt;&amp;amp;&lt;/foo&gt;', $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
-                        ?&gt;
-function embed_odeo(link) {
-        document.writeln('&lt;embed src=&quot;http://odeo.com/flash/audio_player_fullsize.swf&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; type=&quot;application/x-shockwave-flash&quot; quality=&quot;high&quot; width=&quot;440&quot; height=&quot;80&quot; wmode=&quot;transparent&quot; allowScriptAccess=&quot;any&quot; flashvars=&quot;valid_sample_rate=true&amp;external_url='+link+'&quot;&gt;&lt;/embed&gt;');
-}
</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('&lt;embed type=&quot;'+type+'&quot; style=&quot;cursor:hand; cursor:pointer;&quot; href=&quot;'+link+'&quot; src=&quot;'+placeholder+'&quot; width=&quot;'+width+'&quot; height=&quot;'+height+'&quot; autoplay=&quot;false&quot; target=&quot;myself&quot; controller=&quot;false&quot; loop=&quot;'+loop+'&quot; scale=&quot;aspect&quot; bgcolor=&quot;'+bgcolor+'&quot; pluginspage=&quot;http://www.apple.com/quicktime/download/&quot;&gt;&lt;/embed&gt;');
-        }
-        else {
-                document.writeln('&lt;embed type=&quot;'+type+'&quot; style=&quot;cursor:hand; cursor:pointer;&quot; src=&quot;'+link+'&quot; width=&quot;'+width+'&quot; height=&quot;'+height+'&quot; autoplay=&quot;false&quot; target=&quot;myself&quot; controller=&quot;true&quot; loop=&quot;'+loop+'&quot; scale=&quot;aspect&quot; bgcolor=&quot;'+bgcolor+'&quot; pluginspage=&quot;http://www.apple.com/quicktime/download/&quot;&gt;&lt;/embed&gt;');
-        }
-}
-
-function embed_flash(bgcolor, width, height, link, loop, type) {
-        document.writeln('&lt;embed src=&quot;'+link+'&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; type=&quot;'+type+'&quot; quality=&quot;high&quot; width=&quot;'+width+'&quot; height=&quot;'+height+'&quot; bgcolor=&quot;'+bgcolor+'&quot; loop=&quot;'+loop+'&quot;&gt;&lt;/embed&gt;');
-}
-
-function embed_flv(width, height, link, placeholder, loop, player) {
-        document.writeln('&lt;embed src=&quot;'+player+'&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; type=&quot;application/x-shockwave-flash&quot; quality=&quot;high&quot; width=&quot;'+width+'&quot; height=&quot;'+height+'&quot; wmode=&quot;transparent&quot; flashvars=&quot;file='+link+'&amp;autostart=false&amp;repeat='+loop+'&amp;showdigits=true&amp;showfsbutton=false&quot;&gt;&lt;/embed&gt;');
-}
-
-function embed_wmedia(width, height, link) {
-        document.writeln('&lt;embed type=&quot;application/x-mplayer2&quot; src=&quot;'+link+'&quot; autosize=&quot;1&quot; width=&quot;'+width+'&quot; height=&quot;'+height+'&quot; showcontrols=&quot;1&quot; showstatusbar=&quot;0&quot; showdisplay=&quot;0&quot; autostart=&quot;0&quot;&gt;&lt;/embed&gt;');
-}
-                        &lt;?php
</del><ins>+                if (isset($_GET[$this-&gt;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-&gt;data))
</span><span class="cx">                                         {
</span><span class="cx">                                                 // If the cache is for an outdated build of SimplePie
</span><del>-                                                if (!isset($this-&gt;data['build']) || $this-&gt;data['build'] != SIMPLEPIE_BUILD)
</del><ins>+                                                if (!isset($this-&gt;data['build']) || $this-&gt;data['build'] !== SIMPLEPIE_BUILD)
</ins><span class="cx">                                                 {
</span><span class="cx">                                                         $cache-&gt;unlink();
</span><span class="cx">                                                         $this-&gt;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-&gt;data['url']) &amp;&amp; $this-&gt;data['url'] != $this-&gt;feed_url)
</del><ins>+                                                elseif (isset($this-&gt;data['url']) &amp;&amp; $this-&gt;data['url'] !== $this-&gt;feed_url)
</ins><span class="cx">                                                 {
</span><span class="cx">                                                         $cache = false;
</span><span class="cx">                                                         $this-&gt;data = array();
</span><span class="lines">@@ -1568,7 +1571,7 @@
</span><span class="cx">                                                         if ($cache-&gt;mtime() + $this-&gt;autodiscovery_cache_duration &gt; time())
</span><span class="cx">                                                         {
</span><span class="cx">                                                                 // Do not need to do feed autodiscovery yet.
</span><del>-                                                                if ($this-&gt;data['feed_url'] == $this-&gt;data['url'])
</del><ins>+                                                                if ($this-&gt;data['feed_url'] === $this-&gt;data['url'])
</ins><span class="cx">                                                                 {
</span><span class="cx">                                                                         $cache-&gt;unlink();
</span><span class="cx">                                                                         $this-&gt;data = array();
</span><span class="lines">@@ -1598,7 +1601,7 @@
</span><span class="cx">                                                                 $file =&amp; new $this-&gt;file_class($this-&gt;feed_url, $this-&gt;timeout/10, 5, $headers, $this-&gt;useragent, $this-&gt;force_fsockopen);
</span><span class="cx">                                                                 if ($file-&gt;success)
</span><span class="cx">                                                                 {
</span><del>-                                                                        if ($file-&gt;status_code == 304)
</del><ins>+                                                                        if ($file-&gt;status_code === 304)
</ins><span class="cx">                                                                         {
</span><span class="cx">                                                                                 $cache-&gt;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-&gt;file, 'SimplePie_File') &amp;&amp; $this-&gt;file-&gt;url == $this-&gt;feed_url)
</del><ins>+                                        if (is_a($this-&gt;file, 'SimplePie_File') &amp;&amp; $this-&gt;file-&gt;url === $this-&gt;feed_url)
</ins><span class="cx">                                         {
</span><span class="cx">                                                 $file =&amp; $this-&gt;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-&gt;success)
</del><ins>+                                if (!$file-&gt;success &amp;&amp; !($file-&gt;method &amp; SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file-&gt;status_code === 200 || $file-&gt;status_code &gt; 206 &amp;&amp; $file-&gt;status_code &lt; 300)))
</ins><span class="cx">                                 {
</span><span class="cx">                                         $this-&gt;error = $file-&gt;error;
</span><span class="cx">                                         if (!empty($this-&gt;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-&gt;find($this-&gt;autodiscovery))
</del><ins>+                                                if ($file = $locate-&gt;find($this-&gt;autodiscovery, $this-&gt;all_discovered_feeds))
</ins><span class="cx">                                                 {
</span><span class="cx">                                                         if ($cache)
</span><span class="cx">                                                         {
</span><span class="cx">                                                                 $this-&gt;data = array('url' =&gt; $this-&gt;feed_url, 'feed_url' =&gt; $file-&gt;url, 'build' =&gt; SIMPLEPIE_BUILD);
</span><span class="cx">                                                                 if (!$cache-&gt;save($this))
</span><span class="cx">                                                                 {
</span><del>-                                                                        trigger_error(&quot;$cache-&gt;name is not writeable&quot;, E_USER_WARNING);
</del><ins>+                                                                        trigger_error(&quot;$this-&gt;cache_location is not writeable&quot;, E_USER_WARNING);
</ins><span class="cx">                                                                 }
</span><span class="cx">                                                                 $cache = call_user_func(array($this-&gt;cache_class, 'create'), $this-&gt;cache_location, call_user_func($this-&gt;cache_name_function, $file-&gt;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-&gt;error = sprintf('XML error: %s at line %d, column %d', $parser-&gt;get_error_string(), $parser-&gt;get_current_line(), $parser-&gt;get_current_column());
</del><ins>+                        if(isset($parser))
+                        {
+                                // We have an error, just set SimplePie_Misc::error to it and quit
+                                $this-&gt;error = sprintf('XML error: %s at line %d, column %d', $parser-&gt;get_error_string(), $parser-&gt;get_current_line(), $parser-&gt;get_current_column());
+                        }
+                        else
+                        {
+                                $this-&gt;error = 'The data could not be converted to UTF-8';
+                        }
</ins><span class="cx">                         SimplePie_Misc::error($this-&gt;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-&gt;data['type'] &amp;= SIMPLEPIE_TYPE_RSS_090;
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><del>-                        elseif (isset($this-&gt;data['child']['']['rss']))
</del><ins>+                        elseif (isset($this-&gt;data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss']))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this-&gt;data['type'] &amp;= SIMPLEPIE_TYPE_RSS_ALL;
</span><del>-                                if (isset($this-&gt;data['child']['']['rss'][0]['attribs']['']['version']))
</del><ins>+                                if (isset($this-&gt;data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
</ins><span class="cx">                                 {
</span><del>-                                        switch (trim($this-&gt;data['child']['']['rss'][0]['attribs']['']['version']))
</del><ins>+                                        switch (trim($this-&gt;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-&gt;data['type'] &amp;= SIMPLEPIE_TYPE_RSS_091;
</span><del>-                                                        if (isset($this-&gt;data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
</del><ins>+                                                        if (isset($this-&gt;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-&gt;data['child']['']['rss'][0]['child']['']['skiphours']['hour'][0]['data']))
</del><ins>+                                                                switch (trim($this-&gt;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-&gt;data['type'] &amp;= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
</span><span class="lines">@@ -1962,7 +1972,7 @@
</span><span class="cx">                                 {
</span><span class="cx">                                         $file =&amp; new $this-&gt;file_class($favicon, $this-&gt;timeout / 10, 5, array('X-FORWARDED-FOR' =&gt; $_SERVER['REMOTE_ADDR']), $this-&gt;useragent, $this-&gt;force_fsockopen);
</span><span class="cx"> 
</span><del>-                                        if ($file-&gt;success &amp;&amp; ($file-&gt;status_code == 200 || ($file-&gt;status_code &gt; 206 &amp;&amp; $file-&gt;status_code &lt; 300)) &amp;&amp; strlen($file-&gt;body) &gt; 0)
</del><ins>+                                        if ($file-&gt;success &amp;&amp; ($file-&gt;method &amp; SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file-&gt;status_code === 200 || $file-&gt;status_code &gt; 206 &amp;&amp; $file-&gt;status_code &lt; 300)) &amp;&amp; strlen($file-&gt;body) &gt; 0)
</ins><span class="cx">                                         {
</span><span class="cx">                                                 $sniffer =&amp; new $this-&gt;content_type_sniffer_class($file);
</span><span class="cx">                                                 if (substr($sniffer-&gt;get_type(), 0, 6) === 'image/')
</span><span class="lines">@@ -1977,6 +1987,11 @@
</span><span class="cx">                                                                 return $this-&gt;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-&gt;feed_url !== null)
</span><span class="cx">                 {
</span><del>-                        return 'outlook' . $this-&gt;sanitize(SimplePie_Misc::fix_protocol($this-&gt;feed_url, 2), SIMPLEPIE_CONSTRUCT_IRI);
</del><ins>+                        return $this-&gt;sanitize('outlook' . SimplePie_Misc::fix_protocol($this-&gt;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-&gt;subscribe_url())
</span><span class="cx">                 {
</span><del>-                        $return = $this-&gt;sanitize($feed_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this-&gt;feed_url);
</del><ins>+                        $return = $feed_url . rawurlencode($this-&gt;feed_url);
</ins><span class="cx">                         if ($site_url !== null &amp;&amp; $this-&gt;get_link() !== null)
</span><span class="cx">                         {
</span><del>-                                $return .= $this-&gt;sanitize($site_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this-&gt;get_link());
</del><ins>+                                $return .= $site_url . rawurlencode($this-&gt;get_link());
</ins><span class="cx">                         }
</span><del>-                        return $return;
</del><ins>+                        return $this-&gt;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-&gt;subscribe_service('http://www.bloglines.com/sub/'));
</del><ins>+                return $this-&gt;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 &amp; SIMPLEPIE_TYPE_RSS_SYNDICATION)
</span><span class="cx">                 {
</span><del>-                        if (isset($this-&gt;data['child']['']['rss'][0]['child'][$namespace][$tag]))
</del><ins>+                        if (isset($this-&gt;data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag]))
</ins><span class="cx">                         {
</span><del>-                                return $this-&gt;data['child']['']['rss'][0]['child'][$namespace][$tag];
</del><ins>+                                return $this-&gt;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 &amp; SIMPLEPIE_TYPE_RSS_SYNDICATION)
</span><span class="cx">                 {
</span><del>-                        if ($channel = $this-&gt;get_feed_tags('', 'channel'))
</del><ins>+                        if ($channel = $this-&gt;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 &amp; SIMPLEPIE_TYPE_RSS_SYNDICATION)
</span><span class="cx">                 {
</span><del>-                        if ($image = $this-&gt;get_channel_tags('', 'image'))
</del><ins>+                        if ($image = $this-&gt;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-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this-&gt;get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this-&gt;get_channel_tags('', 'title'))
</del><ins>+                elseif ($return = $this-&gt;get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this-&gt;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[] =&amp; new $this-&gt;category_class($term, $scheme, $label);
</span><span class="cx">                 }
</span><del>-                foreach ((array) $this-&gt;get_channel_tags('', 'category') as $category)
</del><ins>+                foreach ((array) $this-&gt;get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
</ins><span class="cx">                 {
</span><del>-                        $categories[] =&amp; new $this-&gt;category_class($this-&gt;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-&gt;sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                        if (isset($category['attribs']['']['domain']))
+                        {
+                                $scheme = $this-&gt;sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
+                        }
+                        else
+                        {
+                                $scheme = null;
+                        }
+                        $categories[] =&amp; new $this-&gt;category_class($term, $scheme, null);
</ins><span class="cx">                 }
</span><span class="cx">                 foreach ((array) $this-&gt;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-&gt;data['links']['alternate'][] = $this-&gt;sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this-&gt;get_base($links[0]));
</span><span class="cx">                         }
</span><del>-                        if ($links = $this-&gt;get_channel_tags('', 'link'))
</del><ins>+                        if ($links = $this-&gt;get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this-&gt;data['links']['alternate'][] = $this-&gt;sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this-&gt;get_base($links[0]));
</span><span class="cx">                         }
</span><span class="lines">@@ -2614,7 +2640,7 @@
</span><span class="cx">                                                 $this-&gt;data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =&amp; $this-&gt;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-&gt;data['links'][substr($key, 41)] =&amp; $this-&gt;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-&gt;all_discovered_feeds;
+        }
+
</ins><span class="cx">         function get_description()
</span><span class="cx">         {
</span><span class="cx">                 if ($return = $this-&gt;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-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this-&gt;get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this-&gt;get_channel_tags('', 'description'))
</del><ins>+                elseif ($return = $this-&gt;get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
</ins><span class="cx">                 {
</span><del>-                        return $this-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this-&gt;get_base($return[0]));
</del><ins>+                        return $this-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this-&gt;get_base($return[0]));
</ins><span class="cx">                 }
</span><span class="cx">                 elseif ($return = $this-&gt;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-&gt;sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this-&gt;get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this-&gt;get_channel_tags('', 'copyright'))
</del><ins>+                elseif ($return = $this-&gt;get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this-&gt;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-&gt;get_channel_tags('', 'language'))
</del><ins>+                if ($return = $this-&gt;get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this-&gt;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-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this-&gt;get_image_tags('', 'title'))
</del><ins>+                elseif ($return = $this-&gt;get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this-&gt;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-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this-&gt;get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this-&gt;get_image_tags('', 'url'))
</del><ins>+                elseif ($return = $this-&gt;get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this-&gt;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-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this-&gt;get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this-&gt;get_image_tags('', 'link'))
</del><ins>+                elseif ($return = $this-&gt;get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this-&gt;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-&gt;get_image_tags('', 'width'))
</del><ins>+                if ($return = $this-&gt;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-&gt;get_type() &amp; SIMPLEPIE_TYPE_RSS_SYNDICATION &amp;&amp; $this-&gt;get_image_tags('', 'url'))
</del><ins>+                elseif ($this-&gt;get_type() &amp; SIMPLEPIE_TYPE_RSS_SYNDICATION &amp;&amp; $this-&gt;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-&gt;get_image_tags('', 'height'))
</del><ins>+                if ($return = $this-&gt;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-&gt;get_type() &amp; SIMPLEPIE_TYPE_RSS_SYNDICATION &amp;&amp; $this-&gt;get_image_tags('', 'url'))
</del><ins>+                elseif ($this-&gt;get_type() &amp; SIMPLEPIE_TYPE_RSS_SYNDICATION &amp;&amp; $this-&gt;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-&gt;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-&gt;multifeed_objects))
</del><ins>+                if (!isset($this-&gt;data['items']))
</ins><span class="cx">                 {
</span><del>-                        return SimplePie::merge_items($this-&gt;multifeed_objects, $start, $end, $this-&gt;item_limit);
-                }
-                elseif (!isset($this-&gt;data['items']))
-                {
-                        if ($items = $this-&gt;get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
</del><ins>+                        if (!empty($this-&gt;multifeed_objects))
</ins><span class="cx">                         {
</span><del>-                                $keys = array_keys($items);
-                                foreach ($keys as $key)
-                                {
-                                        $this-&gt;data['items'][] =&amp; new $this-&gt;item_class($this, $items[$key]);
-                                }
</del><ins>+                                $this-&gt;data['items'] = SimplePie::merge_items($this-&gt;multifeed_objects, $start, $end, $this-&gt;item_limit);
</ins><span class="cx">                         }
</span><del>-                        if ($items = $this-&gt;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-&gt;data['items'] = array();
+                                if ($items = $this-&gt;get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'entry'))
</ins><span class="cx">                                 {
</span><del>-                                        $this-&gt;data['items'][] =&amp; new $this-&gt;item_class($this, $items[$key]);
</del><ins>+                                        $keys = array_keys($items);
+                                        foreach ($keys as $key)
+                                        {
+                                                $this-&gt;data['items'][] =&amp; new $this-&gt;item_class($this, $items[$key]);
+                                        }
</ins><span class="cx">                                 }
</span><del>-                        }
-                        if ($items = $this-&gt;get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
-                        {
-                                $keys = array_keys($items);
-                                foreach ($keys as $key)
</del><ins>+                                if ($items = $this-&gt;get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'entry'))
</ins><span class="cx">                                 {
</span><del>-                                        $this-&gt;data['items'][] =&amp; new $this-&gt;item_class($this, $items[$key]);
</del><ins>+                                        $keys = array_keys($items);
+                                        foreach ($keys as $key)
+                                        {
+                                                $this-&gt;data['items'][] =&amp; new $this-&gt;item_class($this, $items[$key]);
+                                        }
</ins><span class="cx">                                 }
</span><del>-                        }
-                        if ($items = $this-&gt;get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
-                        {
-                                $keys = array_keys($items);
-                                foreach ($keys as $key)
</del><ins>+                                if ($items = $this-&gt;get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'item'))
</ins><span class="cx">                                 {
</span><del>-                                        $this-&gt;data['items'][] =&amp; new $this-&gt;item_class($this, $items[$key]);
</del><ins>+                                        $keys = array_keys($items);
+                                        foreach ($keys as $key)
+                                        {
+                                                $this-&gt;data['items'][] =&amp; new $this-&gt;item_class($this, $items[$key]);
+                                        }
</ins><span class="cx">                                 }
</span><del>-                        }
-                        if ($items = $this-&gt;get_channel_tags('', 'item'))
-                        {
-                                $keys = array_keys($items);
-                                foreach ($keys as $key)
</del><ins>+                                if ($items = $this-&gt;get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'item'))
</ins><span class="cx">                                 {
</span><del>-                                        $this-&gt;data['items'][] =&amp; new $this-&gt;item_class($this, $items[$key]);
</del><ins>+                                        $keys = array_keys($items);
+                                        foreach ($keys as $key)
+                                        {
+                                                $this-&gt;data['items'][] =&amp; new $this-&gt;item_class($this, $items[$key]);
+                                        }
</ins><span class="cx">                                 }
</span><ins>+                                if ($items = $this-&gt;get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'item'))
+                                {
+                                        $keys = array_keys($items);
+                                        foreach ($keys as $key)
+                                        {
+                                                $this-&gt;data['items'][] =&amp; new $this-&gt;item_class($this, $items[$key]);
+                                        }
+                                }
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if (!empty($this-&gt;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-&gt;order_by_date)
</del><ins>+                        if ($this-&gt;order_by_date &amp;&amp; empty($this-&gt;multifeed_objects))
</ins><span class="cx">                         {
</span><span class="cx">                                 if (!isset($this-&gt;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-&gt;get_date('U') &lt;= $b-&gt;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) &amp;&amp; sizeof($urls) &gt; 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-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
</span><span class="cx">                         }
</span><del>-                        elseif ($return = $this-&gt;get_item_tags('', 'guid'))
</del><ins>+                        elseif ($return = $this-&gt;get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
</ins><span class="cx">                         {
</span><span class="cx">                                 return $this-&gt;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-&gt;data['title'] = $this-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this-&gt;get_base($return[0]));
</span><span class="cx">                         }
</span><del>-                        elseif ($return = $this-&gt;get_item_tags('', 'title'))
</del><ins>+                        elseif ($return = $this-&gt;get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this-&gt;data['title'] = $this-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this-&gt;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-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this-&gt;get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this-&gt;get_item_tags('', 'description'))
</del><ins>+                elseif ($return = $this-&gt;get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this-&gt;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[] =&amp; new $this-&gt;feed-&gt;category_class($term, $scheme, $label);
</span><span class="cx">                 }
</span><del>-                foreach ((array) $this-&gt;get_item_tags('', 'category') as $category)
</del><ins>+                foreach ((array) $this-&gt;get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
</ins><span class="cx">                 {
</span><del>-                        $categories[] =&amp; new $this-&gt;feed-&gt;category_class($this-&gt;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-&gt;sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                        if (isset($category['attribs']['']['domain']))
+                        {
+                                $scheme = $this-&gt;sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
+                        }
+                        else
+                        {
+                                $scheme = null;
+                        }
+                        $categories[] =&amp; new $this-&gt;feed-&gt;category_class($term, $scheme, null);
</ins><span class="cx">                 }
</span><span class="cx">                 foreach ((array) $this-&gt;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[] =&amp; new $this-&gt;feed-&gt;author_class($name, $url, $email);
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-                if ($author = $this-&gt;get_item_tags('', 'author'))
</del><ins>+                if ($author = $this-&gt;get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author'))
</ins><span class="cx">                 {
</span><span class="cx">                         $authors[] =&amp; new $this-&gt;feed-&gt;author_class(null, null, $this-&gt;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-&gt;data['date']['raw'] = $return[0]['data'];
</span><span class="cx">                         }
</span><del>-                        elseif ($return = $this-&gt;get_item_tags('', 'pubDate'))
</del><ins>+                        elseif ($return = $this-&gt;get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate'))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this-&gt;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-&gt;data['links']['alternate'][] = $this-&gt;sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this-&gt;get_base($links[0]));
</span><span class="cx">                         }
</span><del>-                        if ($links = $this-&gt;get_item_tags('', 'link'))
</del><ins>+                        if ($links = $this-&gt;get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this-&gt;data['links']['alternate'][] = $this-&gt;sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this-&gt;get_base($links[0]));
</span><span class="cx">                         }
</span><del>-                        if ($links = $this-&gt;get_item_tags('', 'guid'))
</del><ins>+                        if ($links = $this-&gt;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-&gt;data['links']['alternate'][] = $this-&gt;sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this-&gt;get_base($links[0]));
</span><span class="cx">                                 }
</span><span class="lines">@@ -3689,7 +3739,7 @@
</span><span class="cx">                                                 $this-&gt;data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =&amp; $this-&gt;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-&gt;data['links'][substr($key, 41)] =&amp; $this-&gt;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']) &amp;&amp; strtolower($restriction['data']) == 'yes')
</del><ins>+                                        if (isset($restriction['data']) &amp;&amp; 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']) &amp;&amp; strtolower($restriction['data']) == 'yes')
</del><ins>+                                        if (isset($restriction['data']) &amp;&amp; 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-&gt;get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
</span><span class="cx">                         {
</span><del>-                                if (isset($link['attribs']['']['href']) &amp;&amp; !empty($link['attribs']['']['rel']) &amp;&amp; $link['attribs']['']['rel'] == 'enclosure')
</del><ins>+                                if (isset($link['attribs']['']['href']) &amp;&amp; !empty($link['attribs']['']['rel']) &amp;&amp; $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-&gt;get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link)
</span><span class="cx">                         {
</span><del>-                                if (isset($link['attribs']['']['href']) &amp;&amp; !empty($link['attribs']['']['rel']) &amp;&amp; $link['attribs']['']['rel'] == 'enclosure')
</del><ins>+                                if (isset($link['attribs']['']['href']) &amp;&amp; !empty($link['attribs']['']['rel']) &amp;&amp; $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-&gt;get_item_tags('', 'enclosure'))
</del><ins>+                        if ($enclosure = $this-&gt;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-&gt;data['enclosures']) == 0 &amp;&amp; ($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-&gt;data['enclosures']) === 0 &amp;&amp; ($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-&gt;data['enclosures'][] =&amp; new $this-&gt;feed-&gt;enclosure_class($url, $type, $length, $this-&gt;feed-&gt;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-&gt;get_permalink() !== null)
</span><span class="cx">                 {
</span><del>-                        $return = $this-&gt;sanitize($item_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this-&gt;get_permalink());
</del><ins>+                        $return = $item_url . rawurlencode($this-&gt;get_permalink());
</ins><span class="cx">                         if ($title_url !== null &amp;&amp; $this-&gt;get_title() !== null)
</span><span class="cx">                         {
</span><del>-                                $return .= $this-&gt;sanitize($title_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this-&gt;get_title());
</del><ins>+                                $return .= $title_url . rawurlencode($this-&gt;get_title());
</ins><span class="cx">                         }
</span><span class="cx">                         if ($summary_url !== null &amp;&amp; $this-&gt;get_description() !== null)
</span><span class="cx">                         {
</span><del>-                                $return .= $this-&gt;sanitize($summary_url, SIMPLEPIE_CONSTRUCT_IRI) . rawurlencode($this-&gt;get_description());
</del><ins>+                                $return .= $summary_url . rawurlencode($this-&gt;get_description());
</ins><span class="cx">                         }
</span><del>-                        return $return;
</del><ins>+                        return $this-&gt;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-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this-&gt;get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this-&gt;get_source_tags('', 'title'))
</del><ins>+                elseif ($return = $this-&gt;get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this-&gt;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[] =&amp; new $this-&gt;item-&gt;feed-&gt;category_class($term, $scheme, $label);
</span><span class="cx">                 }
</span><del>-                foreach ((array) $this-&gt;get_source_tags('', 'category') as $category)
</del><ins>+                foreach ((array) $this-&gt;get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
</ins><span class="cx">                 {
</span><del>-                        $categories[] =&amp; new $this-&gt;item-&gt;feed-&gt;category_class($this-&gt;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-&gt;sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+                        if (isset($category['attribs']['']['domain']))
+                        {
+                                $scheme = $this-&gt;sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
+                        }
+                        else
+                        {
+                                $scheme = null;
+                        }
+                        $categories[] =&amp; new $this-&gt;item-&gt;feed-&gt;category_class($term, $scheme, null);
</ins><span class="cx">                 }
</span><span class="cx">                 foreach ((array) $this-&gt;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-&gt;data['links']['alternate'][] = $this-&gt;sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this-&gt;get_base($links[0]));
</span><span class="cx">                         }
</span><del>-                        if ($links = $this-&gt;get_source_tags('', 'link'))
</del><ins>+                        if ($links = $this-&gt;get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this-&gt;data['links']['alternate'][] = $this-&gt;sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this-&gt;get_base($links[0]));
</span><span class="cx">                         }
</span><span class="lines">@@ -6041,7 +6102,7 @@
</span><span class="cx">                                                 $this-&gt;data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =&amp; $this-&gt;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-&gt;data['links'][substr($key, 41)] =&amp; $this-&gt;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-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this-&gt;get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this-&gt;get_source_tags('', 'description'))
</del><ins>+                elseif ($return = $this-&gt;get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this-&gt;sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this-&gt;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-&gt;sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this-&gt;get_base($return[0]));
</span><span class="cx">                 }
</span><del>-                elseif ($return = $this-&gt;get_source_tags('', 'copyright'))
</del><ins>+                elseif ($return = $this-&gt;get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this-&gt;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-&gt;get_source_tags('', 'language'))
</del><ins>+                if ($return = $this-&gt;get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
</ins><span class="cx">                 {
</span><span class="cx">                         return $this-&gt;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' &amp;&amp; $mediaplayer != ''))
</del><ins>+                elseif ($handler === 'fmedia' || ($handler === 'mp3' &amp;&amp; $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' &amp;&amp; $mediaplayer == ''))
</del><ins>+                elseif ($handler === 'quicktime' || ($handler === 'mp3' &amp;&amp; $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 != &quot;&quot;){
</del><ins>+                                if ($placeholder !== '')
+                                {
</ins><span class="cx">                                         $embed .= &quot;&lt;embed type=\&quot;$type\&quot; style=\&quot;cursor:hand; cursor:pointer;\&quot; href=\&quot;&quot; . $this-&gt;get_link() . &quot;\&quot; src=\&quot;$placeholder\&quot; width=\&quot;$width\&quot; height=\&quot;$height\&quot; autoplay=\&quot;false\&quot; target=\&quot;myself\&quot; controller=\&quot;false\&quot; loop=\&quot;$loop\&quot; scale=\&quot;aspect\&quot; bgcolor=\&quot;$bgcolor\&quot; pluginspage=\&quot;http://apple.com/quicktime/download/\&quot;&gt;&lt;/embed&gt;&quot;;
</span><span class="cx">                                 }
</span><del>-                                else {
</del><ins>+                                else
+                                {
</ins><span class="cx">                                         $embed .= &quot;&lt;embed type=\&quot;$type\&quot; style=\&quot;cursor:hand; cursor:pointer;\&quot; src=\&quot;&quot; . $this-&gt;get_link() . &quot;\&quot; width=\&quot;$width\&quot; height=\&quot;$height\&quot; autoplay=\&quot;false\&quot; target=\&quot;myself\&quot; controller=\&quot;true\&quot; loop=\&quot;$loop\&quot; scale=\&quot;aspect\&quot; bgcolor=\&quot;$bgcolor\&quot; pluginspage=\&quot;http://apple.com/quicktime/download/\&quot;&gt;&lt;/embed&gt;&quot;;
</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-&gt;get_link()), 0, 15) == 'http://odeo.com')
</del><ins>+                if (substr(strtolower($this-&gt;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-&gt;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-&gt;headers = curl_exec($fp);
</span><span class="lines">@@ -7650,7 +7713,7 @@
</span><span class="cx">                                                 $this-&gt;headers = $parser-&gt;headers;
</span><span class="cx">                                                 $this-&gt;body = $parser-&gt;body;
</span><span class="cx">                                                 $this-&gt;status_code = $parser-&gt;status_code;
</span><del>-                                                if (($this-&gt;status_code == 300 || $this-&gt;status_code == 301 || $this-&gt;status_code == 302 || $this-&gt;status_code == 303 || $this-&gt;status_code == 307 || $this-&gt;status_code &gt; 307 &amp;&amp; $this-&gt;status_code &lt; 400) &amp;&amp; isset($this-&gt;headers['location']) &amp;&amp; $this-&gt;redirects &lt; $redirects)
</del><ins>+                                                if ((in_array($this-&gt;status_code, array(300, 301, 302, 303, 307)) || $this-&gt;status_code &gt; 307 &amp;&amp; $this-&gt;status_code &lt; 400) &amp;&amp; isset($this-&gt;headers['location']) &amp;&amp; $this-&gt;redirects &lt; $redirects)
</ins><span class="cx">                                                 {
</span><span class="cx">                                                         $this-&gt;redirects++;
</span><span class="cx">                                                         $location = SimplePie_Misc::absolutize_url($this-&gt;headers['location'], $url);
</span><span class="lines">@@ -7663,7 +7726,7 @@
</span><span class="cx">                         {
</span><span class="cx">                                 $this-&gt;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']) &amp;&amp; strtolower($url_parts['scheme']) == 'https')
</del><ins>+                                if (isset($url_parts['scheme']) &amp;&amp; strtolower($url_parts['scheme']) === 'https')
</ins><span class="cx">                                 {
</span><span class="cx">                                         $url_parts['host'] = &quot;ssl://$url_parts[host]&quot;;
</span><span class="cx">                                         $url_parts['port'] = 443;
</span><span class="lines">@@ -7731,7 +7794,7 @@
</span><span class="cx">                                                         $this-&gt;headers = $parser-&gt;headers;
</span><span class="cx">                                                         $this-&gt;body = $parser-&gt;body;
</span><span class="cx">                                                         $this-&gt;status_code = $parser-&gt;status_code;
</span><del>-                                                        if (($this-&gt;status_code == 300 || $this-&gt;status_code == 301 || $this-&gt;status_code == 302 || $this-&gt;status_code == 303 || $this-&gt;status_code == 307 || $this-&gt;status_code &gt; 307 &amp;&amp; $this-&gt;status_code &lt; 400) &amp;&amp; isset($this-&gt;headers['location']) &amp;&amp; $this-&gt;redirects &lt; $redirects)
</del><ins>+                                                        if ((in_array($this-&gt;status_code, array(300, 301, 302, 303, 307)) || $this-&gt;status_code &gt; 307 &amp;&amp; $this-&gt;status_code &lt; 400) &amp;&amp; isset($this-&gt;headers['location']) &amp;&amp; $this-&gt;redirects &lt; $redirects)
</ins><span class="cx">                                                         {
</span><span class="cx">                                                                 $this-&gt;redirects++;
</span><span class="cx">                                                                 $location = SimplePie_Misc::absolutize_url($this-&gt;headers['location'], $url);
</span><span class="lines">@@ -8438,7 +8501,7 @@
</span><span class="cx">                         if ($this-&gt;flags &amp; 8)
</span><span class="cx">                         {
</span><span class="cx">                                 // Get the length of the filename
</span><del>-                                $len = strspn($this-&gt;compressed_data, &quot;\x00&quot;, $this-&gt;position);
</del><ins>+                                $len = strcspn($this-&gt;compressed_data, &quot;\x00&quot;, $this-&gt;position);
</ins><span class="cx"> 
</span><span class="cx">                                 // Check the length of the string is still valid
</span><span class="cx">                                 $this-&gt;min_compressed_size += $len + 1;
</span><span class="lines">@@ -8458,7 +8521,7 @@
</span><span class="cx">                         if ($this-&gt;flags &amp; 16)
</span><span class="cx">                         {
</span><span class="cx">                                 // Get the length of the comment
</span><del>-                                $len = strspn($this-&gt;compressed_data, &quot;\x00&quot;, $this-&gt;position);
</del><ins>+                                $len = strcspn($this-&gt;compressed_data, &quot;\x00&quot;, $this-&gt;position);
</ins><span class="cx"> 
</span><span class="cx">                                 // Check the length of the string is still valid
</span><span class="cx">                                 $this-&gt;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 =&amp; new SimplePie_IRI($location);
+                switch ($location_iri-&gt;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-&gt;location = $location;
</span><del>-                $this-&gt;filename = rawurlencode($filename);
-                $this-&gt;extension = rawurlencode($extension);
-                $this-&gt;name = &quot;$location/$this-&gt;filename.$this-&gt;extension&quot;;
</del><ins>+                $this-&gt;filename = $filename;
+                $this-&gt;extension = $extension;
+                $this-&gt;name = &quot;$this-&gt;location/$this-&gt;filename.$this-&gt;extension&quot;;
</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-&gt;get_items();
+                $items_by_id = array();
</ins><span class="cx"> 
</span><del>-                $hours = floor($seconds / 3600);
-                $remainder = $seconds % 3600;
-                if ($hours &gt; 0)
</del><ins>+                if (!empty($items))
</ins><span class="cx">                 {
</span><del>-                        $time .= $hours.':';
</del><ins>+                        foreach ($items as $item)
+                        {
+                                $items_by_id[$item-&gt;get_id()] = $item;
+                        }
+
+                        if (count($items_by_id) !== count($items))
+                        {
+                                $items_by_id = array();
+                                foreach ($items as $item)
+                                {
+                                        $items_by_id[$item-&gt;get_id(true)] = $item;
+                                }
+                        }
+
+                        if (isset($data-&gt;data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]))
+                        {
+                                $channel =&amp; $data-&gt;data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
+                        }
+                        elseif (isset($data-&gt;data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
+                        {
+                                $channel =&amp; $data-&gt;data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
+                        }
+                        elseif (isset($data-&gt;data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
+                        {
+                                $channel =&amp; $data-&gt;data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
+                        }
+                        elseif (isset($data-&gt;data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]))
+                        {
+                                $channel =&amp; $data-&gt;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-&gt;data['items']))
+                        {
+                                unset($data-&gt;data['items']);
+                        }
+                        if (isset($data-&gt;data['ordered_items']))
+                        {
+                                unset($data-&gt;data['ordered_items']);
+                        }
</ins><span class="cx">                 }
</span><ins>+                return array(serialize($data-&gt;data), $items_by_id);
+        }
+}
</ins><span class="cx"> 
</span><del>-                $minutes = floor($remainder / 60);
-                $seconds = $remainder % 60;
-                if ($minutes &lt; 10 &amp;&amp; $hours &gt; 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-&gt;get_host();
+                if (SimplePie_Misc::stripos($host, 'unix(') === 0 &amp;&amp; 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 &lt; 10)
</del><ins>+                else
</ins><span class="cx">                 {
</span><del>-                        $seconds = '0' . $seconds;
</del><ins>+                        $server = $host;
+                        if ($mysql_location-&gt;get_port() !== null)
+                        {
+                                $server .= ':' . $mysql_location-&gt;get_port();
+                        }
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $time .= $minutes.':';
-                $time .= $seconds;
</del><ins>+                if (strpos($mysql_location-&gt;get_userinfo(), ':') !== false)
+                {
+                        list($username, $password) = explode(':', $mysql_location-&gt;get_userinfo(), 2);
+                }
+                else
+                {
+                        $username = $mysql_location-&gt;get_userinfo();
+                        $password = null;
+                }
</ins><span class="cx"> 
</span><del>-                return $time;
</del><ins>+                if ($this-&gt;mysql = mysql_connect($server, $username, $password))
+                {
+                        $this-&gt;id = $name . $extension;
+                        $this-&gt;options = SimplePie_Misc::parse_str($mysql_location-&gt;get_query());
+                        if (!isset($this-&gt;options['prefix'][0]))
+                        {
+                                $this-&gt;options['prefix'][0] = '';
+                        }
+
+                        if (mysql_select_db(ltrim($mysql_location-&gt;get_path(), '/'))
+                                &amp;&amp; mysql_query('SET NAMES utf8')
+                                &amp;&amp; ($query = mysql_unbuffered_query('SHOW TABLES')))
+                        {
+                                $db = array();
+                                while ($row = mysql_fetch_row($query))
+                                {
+                                        $db[] = $row[0];
+                                }
+
+                                if (!in_array($this-&gt;options['prefix'][0] . 'cache_data', $db))
+                                {
+                                        if (!mysql_query('CREATE TABLE `' . $this-&gt;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-&gt;mysql = null;
+                                        }
+                                }
+
+                                if (!in_array($this-&gt;options['prefix'][0] . 'items', $db))
+                                {
+                                        if (!mysql_query('CREATE TABLE `' . $this-&gt;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-&gt;mysql = null;
+                                        }
+                                }
+                        }
+                        else
+                        {
+                                $this-&gt;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-&gt;mysql)
</ins><span class="cx">                 {
</span><del>-                        $relative = SimplePie_Misc::parse_url($relative);
-                        if ($relative['scheme'] !== '')
</del><ins>+                        $feed_id = &quot;'&quot; . mysql_real_escape_string($this-&gt;id) . &quot;'&quot;;
+
+                        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-&gt;prepare_simplepie_object_for_cache($data);
+
+                                if ($query = mysql_query('SELECT `id` FROM `' . $this-&gt;options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this-&gt;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-&gt;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'] !== '' &amp;&amp; $base['path'] === '')
</del><ins>+                                                else
</ins><span class="cx">                                                 {
</span><del>-                                                        $target['path'] = '/' . $relative['path'];
</del><ins>+                                                        $sql = 'UPDATE `' . $this-&gt;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-&gt;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-&gt;options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(' . $feed_id . ', ' . count($prepared[1]) . ', \'' . mysql_real_escape_string($prepared[0]) . '\', ' . time() . ')', $this-&gt;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-&gt;options['prefix'][0] . 'items` WHERE `id` = \'' . implode('\' OR `id` = \'', $database_ids) . '\' AND `feed_id` = ' . $feed_id, $this-&gt;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]-&gt;get_date('U')))
+                                                                {
+                                                                        $date = time();
+                                                                }
+
+                                                                if (!mysql_query('INSERT INTO `' . $this-&gt;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]-&gt;data)) . '\', ' . $date . ')', $this-&gt;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-&gt;options['prefix'][0] . 'cache_data` WHERE `id` = ' . $feed_id, $this-&gt;mysql))
+                        {
+                                if (mysql_num_rows($query))
+                                {
+                                        if (mysql_query('UPDATE `' . $this-&gt;options['prefix'][0] . 'cache_data` SET `items` = 0, `data` = \'' . mysql_real_escape_string(serialize($data)) . '\', `mtime` = ' . time() . ' WHERE `id` = ' . $feed_id, $this-&gt;mysql))
+                                        {
+                                                return true;
+                                        }
+                                }
+                                elseif (mysql_query('INSERT INTO `' . $this-&gt;options['prefix'][0] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(\'' . mysql_real_escape_string($this-&gt;id) . '\', 0, \'' . mysql_real_escape_string(serialize($data)) . '\', ' . time() . ')', $this-&gt;mysql))
+                                {
+                                        return true;
+                                }
+                        }
+                }
+                return false;
+        }
+
+        function load()
+        {
+                if ($this-&gt;mysql &amp;&amp; ($query = mysql_query('SELECT `items`, `data` FROM `' . $this-&gt;options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this-&gt;id) . &quot;'&quot;, $this-&gt;mysql)) &amp;&amp; ($row = mysql_fetch_row($query)))
+                {
+                        $data = unserialize($row[1]);
+
+                        if (isset($this-&gt;options['items'][0]))
+                        {
+                                $items = (int) $this-&gt;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 =&amp; $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
+                                }
+                                elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
+                                {
+                                        $feed =&amp; $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
+                                }
+                                elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
+                                {
+                                        $feed =&amp; $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
+                                }
+                                elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]))
+                                {
+                                        $feed =&amp; $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0];
+                                }
+                                else
+                                {
+                                        $feed = null;
+                                }
+
+                                if ($feed !== null)
+                                {
+                                        $sql = 'SELECT `data` FROM `' . $this-&gt;options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this-&gt;id) . '\' ORDER BY `posted` DESC';
+                                        if ($items &gt; 0)
+                                        {
+                                                $sql .= ' LIMIT ' . $items;
+                                        }
+
+                                        if ($query = mysql_unbuffered_query($sql, $this-&gt;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-&gt;mysql &amp;&amp; ($query = mysql_query('SELECT `mtime` FROM `' . $this-&gt;options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this-&gt;id) . &quot;'&quot;, $this-&gt;mysql)) &amp;&amp; ($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-&gt;mysql &amp;&amp; ($query = mysql_query('UPDATE `' . $this-&gt;options['prefix'][0] . 'cache_data` SET `mtime` = ' . time() . ' WHERE `id` = \'' . mysql_real_escape_string($this-&gt;id) . &quot;'&quot;, $this-&gt;mysql)) &amp;&amp; mysql_affected_rows($this-&gt;mysql))
+                {
+                        return true;
+                }
+                else
+                {
+                        return false;
+                }
+        }
+
+        function unlink()
+        {
+                if ($this-&gt;mysql &amp;&amp; ($query = mysql_query('DELETE FROM `' . $this-&gt;options['prefix'][0] . 'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this-&gt;id) . &quot;'&quot;, $this-&gt;mysql)) &amp;&amp; ($query2 = mysql_query('DELETE FROM `' . $this-&gt;options['prefix'][0] . 'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this-&gt;id) . &quot;'&quot;, $this-&gt;mysql)))
+                {
+                        return true;
+                }
+                else
+                {
+                        return false;
+                }
+        }
+}
+
+class SimplePie_Misc
+{
+        function time_hms($seconds)
+        {
+                $time = '';
+
+                $hours = floor($seconds / 3600);
+                $remainder = $seconds % 3600;
+                if ($hours &gt; 0)
+                {
+                        $time .= $hours.':';
+                }
+
+                $minutes = floor($remainder / 60);
+                $seconds = $remainder % 60;
+                if ($minutes &lt; 10 &amp;&amp; $hours &gt; 0)
+                {
+                        $minutes = '0' . $minutes;
+                }
+                if ($seconds &lt; 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-&gt;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 &quot;../&quot; or &quot;./&quot;, 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 &quot;.&quot; or &quot;..&quot;, 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 &lt; $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') &amp; $level) &gt; 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(&quot;$note: $message in $file on line $line&quot;, 0);
</ins><span class="cx">                 }
</span><del>-                error_log(&quot;$note: $message in $file on line $line&quot;, 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'] !== '' &amp;&amp; $parsed['scheme'] != 'http' &amp;&amp; $parsed['scheme'] != 'https')
</del><ins>+                if ($parsed['scheme'] !== '' &amp;&amp; $parsed['scheme'] !== 'http' &amp;&amp; $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 &amp;&amp; $parsed['scheme'] !== '')
</del><ins>+                if ($http === 2 &amp;&amp; $parsed['scheme'] !== '')
</ins><span class="cx">                 {
</span><span class="cx">                         return &quot;feed:$url&quot;;
</span><span class="cx">                 }
</span><del>-                elseif ($http == 3 &amp;&amp; strtolower($parsed['scheme']) == 'http')
</del><ins>+                elseif ($http === 3 &amp;&amp; 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 &amp;&amp; strtolower($parsed['scheme']) == 'http')
</del><ins>+                elseif ($http === 4 &amp;&amp; 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 &lt;= 9; $i++)
-                {
-                        $match[$i] = '';
-                }
-                return array('scheme' =&gt; $match[2], 'authority' =&gt; $match[4], 'path' =&gt; $match[5], 'query' =&gt; $match[7], 'fragment' =&gt; $match[9]);
</del><ins>+                $iri =&amp; new SimplePie_IRI($url);
+                return array(
+                        'scheme' =&gt; (string) $iri-&gt;get_scheme(),
+                        'authority' =&gt; (string) $iri-&gt;get_authority(),
+                        'path' =&gt; (string) $iri-&gt;get_path(),
+                        'query' =&gt; (string) $iri-&gt;get_query(),
+                        'fragment' =&gt; (string) $iri-&gt;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 .= &quot;$scheme:&quot;;
-                }
-                if ($authority !== '')
-                {
-                        $return .= &quot;//$authority&quot;;
-                }
-                if ($path !== '')
-                {
-                        $return .= $path;
-                }
-                if ($query !== '')
-                {
-                        $return .= &quot;?$query&quot;;
-                }
-                if ($fragment !== '')
-                {
-                        $return .= &quot;#$fragment&quot;;
-                }
-                return $return;
</del><ins>+                $iri =&amp; new SimplePie_IRI('');
+                $iri-&gt;set_scheme($scheme);
+                $iri-&gt;set_authority($authority);
+                $iri-&gt;set_path($path);
+                $iri-&gt;set_query($query);
+                $iri-&gt;set_fragment($fragment);
+                return $iri-&gt;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 =&amp; new SimplePie_IRI($url);
+                return $iri-&gt;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 &gt;= 0x41 &amp;&amp; $integer &lt;= 0x5A || $integer &gt;= 0x61 &amp;&amp; $integer &lt;= 0x7A || $integer &gt;= 0x30 &amp;&amp; $integer &lt;= 0x39 || $integer == 0x2D || $integer == 0x2E || $integer == 0x5F || $integer == 0x7E)
</del><ins>+                if ($integer &gt;= 0x41 &amp;&amp; $integer &lt;= 0x5A || $integer &gt;= 0x61 &amp;&amp; $integer &lt;= 0x7A || $integer &gt;= 0x30 &amp;&amp; $integer &lt;= 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') &amp;&amp; ($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') &amp;&amp; @mb_convert_encoding(&quot;\x80&quot;, 'UTF-16BE', $input) !== &quot;\x00\x80&quot; &amp;&amp; ($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, &quot;\x09\x0A\x0B\x0C\x0D&quot;, 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, &quot;\x09\x0A\x0B\x0C\x0D&quot;, 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']) &amp;&amp; strtolower(trim($attribs['']['mode']) == 'base64'))
</del><ins>+                if (isset($attribs['']['mode']) &amp;&amp; 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
+                ?&gt;
+function embed_odeo(link) {
+        document.writeln('&lt;embed src=&quot;http://odeo.com/flash/audio_player_fullsize.swf&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; type=&quot;application/x-shockwave-flash&quot; quality=&quot;high&quot; width=&quot;440&quot; height=&quot;80&quot; wmode=&quot;transparent&quot; allowScriptAccess=&quot;any&quot; flashvars=&quot;valid_sample_rate=true&amp;external_url='+link+'&quot;&gt;&lt;/embed&gt;');
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
+        if (placeholder != '') {
+                document.writeln('&lt;embed type=&quot;'+type+'&quot; style=&quot;cursor:hand; cursor:pointer;&quot; href=&quot;'+link+'&quot; src=&quot;'+placeholder+'&quot; width=&quot;'+width+'&quot; height=&quot;'+height+'&quot; autoplay=&quot;false&quot; target=&quot;myself&quot; controller=&quot;false&quot; loop=&quot;'+loop+'&quot; scale=&quot;aspect&quot; bgcolor=&quot;'+bgcolor+'&quot; pluginspage=&quot;http://www.apple.com/quicktime/download/&quot;&gt;&lt;/embed&gt;');
+        }
+        else {
+                document.writeln('&lt;embed type=&quot;'+type+'&quot; style=&quot;cursor:hand; cursor:pointer;&quot; src=&quot;'+link+'&quot; width=&quot;'+width+'&quot; height=&quot;'+height+'&quot; autoplay=&quot;false&quot; target=&quot;myself&quot; controller=&quot;true&quot; loop=&quot;'+loop+'&quot; scale=&quot;aspect&quot; bgcolor=&quot;'+bgcolor+'&quot; pluginspage=&quot;http://www.apple.com/quicktime/download/&quot;&gt;&lt;/embed&gt;');
+        }
+}
+
+function embed_flash(bgcolor, width, height, link, loop, type) {
+        document.writeln('&lt;embed src=&quot;'+link+'&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; type=&quot;'+type+'&quot; quality=&quot;high&quot; width=&quot;'+width+'&quot; height=&quot;'+height+'&quot; bgcolor=&quot;'+bgcolor+'&quot; loop=&quot;'+loop+'&quot;&gt;&lt;/embed&gt;');
+}
+
+function embed_flv(width, height, link, placeholder, loop, player) {
+        document.writeln('&lt;embed src=&quot;'+player+'&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; type=&quot;application/x-shockwave-flash&quot; quality=&quot;high&quot; width=&quot;'+width+'&quot; height=&quot;'+height+'&quot; wmode=&quot;transparent&quot; flashvars=&quot;file='+link+'&amp;autostart=false&amp;repeat='+loop+'&amp;showdigits=true&amp;showfsbutton=false&quot;&gt;&lt;/embed&gt;');
+}
+
+function embed_wmedia(width, height, link) {
+        document.writeln('&lt;embed type=&quot;application/x-mplayer2&quot; src=&quot;'+link+'&quot; autosize=&quot;1&quot; width=&quot;'+width+'&quot; height=&quot;'+height+'&quot; showcontrols=&quot;1&quot; showstatusbar=&quot;0&quot; showdisplay=&quot;0&quot; autostart=&quot;0&quot;&gt;&lt;/embed&gt;');
+}
+                &lt;?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-&gt;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-&gt;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-&gt;consume() != ';')
</del><ins>+                                        if (!in_array($this-&gt;consume(), array(';', false), true))
</ins><span class="cx">                                         {
</span><span class="cx">                                                 $this-&gt;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-&gt;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-&gt;parse_iri($iri);
+                        $this-&gt;set_scheme($parsed['scheme']);
+                        $this-&gt;set_authority($parsed['authority']);
+                        $this-&gt;set_path($parsed['path']);
+                        $this-&gt;set_query($parsed['query']);
+                        $this-&gt;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 =&amp; new SimplePie_IRI($relative);
+                        if ($relative-&gt;get_scheme() !== null)
+                        {
+                                $target = $relative;
+                        }
+                        elseif ($base-&gt;get_iri() !== null)
+                        {
+                                if ($relative-&gt;get_authority() !== null)
+                                {
+                                        $target = $relative;
+                                        $target-&gt;set_scheme($base-&gt;get_scheme());
+                                }
+                                else
+                                {
+                                        $target =&amp; new SimplePie_IRI('');
+                                        $target-&gt;set_scheme($base-&gt;get_scheme());
+                                        $target-&gt;set_userinfo($base-&gt;get_userinfo());
+                                        $target-&gt;set_host($base-&gt;get_host());
+                                        $target-&gt;set_port($base-&gt;get_port());
+                                        if ($relative-&gt;get_path() !== null)
+                                        {
+                                                if (strpos($relative-&gt;get_path(), '/') === 0)
+                                                {
+                                                        $target-&gt;set_path($relative-&gt;get_path());
+                                                }
+                                                elseif (($base-&gt;get_userinfo() !== null || $base-&gt;get_host() !== null || $base-&gt;get_port() !== null) &amp;&amp; $base-&gt;get_path() === null)
+                                                {
+                                                        $target-&gt;set_path('/' . $relative-&gt;get_path());
+                                                }
+                                                elseif (($last_segment = strrpos($base-&gt;get_path(), '/')) !== false)
+                                                {
+                                                        $target-&gt;set_path(substr($base-&gt;get_path(), 0, $last_segment + 1) . $relative-&gt;get_path());
+                                                }
+                                                else
+                                                {
+                                                        $target-&gt;set_path($relative-&gt;get_path());
+                                                }
+                                                $target-&gt;set_query($relative-&gt;get_query());
+                                        }
+                                        else
+                                        {
+                                                $target-&gt;set_path($base-&gt;get_path());
+                                                if ($relative-&gt;get_query() !== null)
+                                                {
+                                                        $target-&gt;set_query($relative-&gt;get_query());
+                                                }
+                                                elseif ($base-&gt;get_query() !== null)
+                                                {
+                                                        $target-&gt;set_query($base-&gt;get_query());
+                                                }
+                                        }
+                                }
+                                $target-&gt;set_fragment($relative-&gt;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 &lt;= 9; $i++)
+                {
+                        $match[$i] = '';
+                }
+                return array('scheme' =&gt; $match[2], 'authority' =&gt; $match[4], 'path' =&gt; $match[5], 'query' =&gt; $match[7], 'fragment' =&gt; $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 &quot;../&quot; or &quot;./&quot;, 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 &quot;/./&quot; or &quot;/.&quot;, where &quot;.&quot; is a complete path segment, then replace that prefix with &quot;/&quot; 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 &quot;/../&quot; or &quot;/..&quot;, where &quot;..&quot; is a complete path segment, then replace that prefix with &quot;/&quot; in the input buffer and remove the last segment and its preceding &quot;/&quot; (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 &quot;.&quot; or &quot;..&quot;, 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 &quot;/&quot; character (if any) and any subsequent characters up to, but not including, the next &quot;/&quot; 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 &amp; SIMPLEPIE_LOWERCASE)
+                {
+                        $string = strtolower($string);
+                }
+                elseif ($case &amp; 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)) &lt; $strlen)
+                {
+                        // If we have a % character
+                        if ($string[$position] === '%')
+                        {
+                                // If we have a pct-encoded section
+                                if ($position + 2 &lt; $strlen &amp;&amp; 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 &amp; SIMPLEPIE_LOWERCASE)
+                                                {
+                                                        $chr = strtolower($chr);
+                                                }
+                                                elseif ($case &amp; 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(&quot;%%%02X&quot;, 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-&gt;valid) === count($this-&gt;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-&gt;scheme = null;
+                }
+                else
+                {
+                        $len = strlen($scheme);
+                        switch (true)
+                        {
+                                case $len &gt; 1:
+                                        if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1))
+                                        {
+                                                $this-&gt;scheme = null;
+                                                $this-&gt;valid[__FUNCTION__] = false;
+                                                return false;
+                                        }
+
+                                case $len &gt; 0:
+                                        if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1))
+                                        {
+                                                $this-&gt;scheme = null;
+                                                $this-&gt;valid[__FUNCTION__] = false;
+                                                return false;
+                                        }
+                        }
+                        $this-&gt;scheme = strtolower($scheme);
+                }
+                $this-&gt;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-&gt;set_userinfo($userinfo) &amp;&amp; $this-&gt;set_host($authority) &amp;&amp; $this-&gt;set_port($port);
+        }
+
+        /**
+         * Set the userinfo.
+         *
+         * @access public
+         * @param string $userinfo
+         * @return bool
+         */
+        function set_userinfo($userinfo)
+        {
+                if ($userinfo === null || $userinfo === '')
+                {
+                        $this-&gt;userinfo = null;
+                }
+                else
+                {
+                        $this-&gt;userinfo = $this-&gt;replace_invalid_with_pct_encoding($userinfo, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&amp;\'()*+,;=:');
+                }
+                $this-&gt;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-&gt;host = null;
+                        $this-&gt;valid[__FUNCTION__] = true;
+                        return true;
+                }
+                elseif ($host[0] === '[' &amp;&amp; substr($host, -1) === ']')
+                {
+                        if (Net_IPv6::checkIPv6(substr($host, 1, -1)))
+                        {
+                                $this-&gt;host = $host;
+                                $this-&gt;valid[__FUNCTION__] = true;
+                                return true;
+                        }
+                        else
+                        {
+                                $this-&gt;host = null;
+                                $this-&gt;valid[__FUNCTION__] = false;
+                                return false;
+                        }
+                }
+                else
+                {
+                        $this-&gt;host = $this-&gt;replace_invalid_with_pct_encoding($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&amp;\'()*+,;=', SIMPLEPIE_LOWERCASE);
+                        $this-&gt;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-&gt;port = null;
+                        $this-&gt;valid[__FUNCTION__] = true;
+                        return true;
+                }
+                elseif (strspn($port, '0123456789') === strlen($port))
+                {
+                        $this-&gt;port = (int) $port;
+                        $this-&gt;valid[__FUNCTION__] = true;
+                        return true;
+                }
+                else
+                {
+                        $this-&gt;port = null;
+                        $this-&gt;valid[__FUNCTION__] = false;
+                        return false;
+                }
+        }
+
+        /**
+         * Set the path.
+         *
+         * @access public
+         * @param string $path
+         * @return bool
+         */
+        function set_path($path)
+        {
+                if ($path === null || $path === '')
+                {
+                        $this-&gt;path = null;
+                        $this-&gt;valid[__FUNCTION__] = true;
+                        return true;
+                }
+                elseif (substr($path, 0, 2) === '//' &amp;&amp; $this-&gt;userinfo === null &amp;&amp; $this-&gt;host === null &amp;&amp; $this-&gt;port === null)
+                {
+                        $this-&gt;path = null;
+                        $this-&gt;valid[__FUNCTION__] = false;
+                        return false;
+                }
+                else
+                {
+                        $this-&gt;path = $this-&gt;replace_invalid_with_pct_encoding($path, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&amp;\'()*+,;=@/');
+                        if ($this-&gt;scheme !== null)
+                        {
+                                $this-&gt;path = $this-&gt;remove_dot_segments($this-&gt;path);
+                        }
+                        $this-&gt;valid[__FUNCTION__] = true;
+                        return true;
+                }
+        }
+
+        /**
+         * Set the query.
+         *
+         * @access public
+         * @param string $query
+         * @return bool
+         */
+        function set_query($query)
+        {
+                if ($query === null || $query === '')
+                {
+                        $this-&gt;query = null;
+                }
+                else
+                {
+                        $this-&gt;query = $this-&gt;replace_invalid_with_pct_encoding($query, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&amp;\'()*+,;=:@/?');
+                }
+                $this-&gt;valid[__FUNCTION__] = true;
+                return true;
+        }
+
+        /**
+         * Set the fragment.
+         *
+         * @access public
+         * @param string $fragment
+         * @return bool
+         */
+        function set_fragment($fragment)
+        {
+                if ($fragment === null || $fragment === '')
+                {
+                        $this-&gt;fragment = null;
+                }
+                else
+                {
+                        $this-&gt;fragment = $this-&gt;replace_invalid_with_pct_encoding($fragment, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&amp;\'()*+,;=:@/?');
+                }
+                $this-&gt;valid[__FUNCTION__] = true;
+                return true;
+        }
+
+        /**
+         * Get the complete IRI
+         *
+         * @access public
+         * @return string
+         */
+        function get_iri()
+        {
+                $iri = '';
+                if ($this-&gt;scheme !== null)
+                {
+                        $iri .= $this-&gt;scheme . ':';
+                }
+                if (($authority = $this-&gt;get_authority()) !== null)
+                {
+                        $iri .= '//' . $authority;
+                }
+                if ($this-&gt;path !== null)
+                {
+                        $iri .= $this-&gt;path;
+                }
+                if ($this-&gt;query !== null)
+                {
+                        $iri .= '?' . $this-&gt;query;
+                }
+                if ($this-&gt;fragment !== null)
+                {
+                        $iri .= '#' . $this-&gt;fragment;
+                }
+
+                if ($iri !== '')
+                {
+                        return $iri;
+                }
+                else
+                {
+                        return null;
+                }
+        }
+
+        /**
+         * Get the scheme
+         *
+         * @access public
+         * @return string
+         */
+        function get_scheme()
+        {
+                return $this-&gt;scheme;
+        }
+
+        /**
+         * Get the complete authority
+         *
+         * @access public
+         * @return string
+         */
+        function get_authority()
+        {
+                $authority = '';
+                if ($this-&gt;userinfo !== null)
+                {
+                        $authority .= $this-&gt;userinfo . '@';
+                }
+                if ($this-&gt;host !== null)
+                {
+                        $authority .= $this-&gt;host;
+                }
+                if ($this-&gt;port !== null)
+                {
+                        $authority .= ':' . $this-&gt;port;
+                }
+
+                if ($authority !== '')
+                {
+                        return $authority;
+                }
+                else
+                {
+                        return null;
+                }
+        }
+
+        /**
+         * Get the user information
+         *
+         * @access public
+         * @return string
+         */
+        function get_userinfo()
+        {
+                return $this-&gt;userinfo;
+        }
+
+        /**
+         * Get the host
+         *
+         * @access public
+         * @return string
+         */
+        function get_host()
+        {
+                return $this-&gt;host;
+        }
+
+        /**
+         * Get the port
+         *
+         * @access public
+         * @return string
+         */
+        function get_port()
+        {
+                return $this-&gt;port;
+        }
+
+        /**
+         * Get the path
+         *
+         * @access public
+         * @return string
+         */
+        function get_path()
+        {
+                return $this-&gt;path;
+        }
+
+        /**
+         * Get the query
+         *
+         * @access public
+         * @return string
+         */
+        function get_query()
+        {
+                return $this-&gt;query;
+        }
+
+        /**
+         * Get the fragment
+         *
+         * @access public
+         * @return string
+         */
+        function get_fragment()
+        {
+                return $this-&gt;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 &lt;alexander.merz@web.de&gt;
+ * @author elfrink at introweb dot nl
+ * @author Josh Peck &lt;jmp at joshpeck dot org&gt;
+ * @author Geoffrey Sneddon &lt;geoffers@gmail.com&gt;
+ */
+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        -&gt;        FF01:0:0:0:0:0:0:101
+         *                         ::1                -&gt;        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, ':')) &gt; 0)
+                                {
+                                        $c1 = $pos;
+                                }
+                                else
+                                {
+                                        $c1 = 0;
+                                }
+                        }
+                        if ($ip2 === '')
+                        {
+                                $c2 = -1;
+                        }
+                        else
+                        {
+                                $pos = 0;
+                                if (($pos = substr_count($ip2, ':')) &gt; 0)
+                                {
+                                        $c2 = $pos;
+                                }
+                                else
+                                {
+                                        $c2 = 0;
+                                }
+                        }
+                        if (strstr($ip2, '.'))
+                        {
+                                $c2++;
+                        }
+                        // ::
+                        if ($c1 === -1 &amp;&amp; $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 &lt; count($ipv6); $i++)
+                        {
+                                $dec = hexdec($ipv6[$i]);
+                                $hex = strtoupper(preg_replace('/^[0]{1,3}(.*[0-9a-fA-F])$/', '\\1', $ipv6[$i]));
+                                if ($ipv6[$i] &gt;= 0 &amp;&amp; $dec &lt;= 65535 &amp;&amp; $hex === strtoupper(dechex($dec)))
+                                {
+                                        $count++;
+                                }
+                        }
+                        if ($count === 8)
+                        {
+                                return true;
+                        }
+                        elseif ($count === 6 &amp;&amp; !empty($ipPart[1]))
+                        {
+                                $ipv4 = explode('.', $ipPart[1]);
+                                $count = 0;
+                                foreach ($ipv4 as $ipv4_part)
+                                {
+                                        if ($ipv4_part &gt;= 0 &amp;&amp; $ipv4_part &lt;= 255 &amp;&amp; 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-&gt;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, &amp;$working)
</ins><span class="cx">         {
</span><span class="cx">                 if ($this-&gt;is_feed($this-&gt;file))
</span><span class="cx">                 {
</span><span class="lines">@@ -12792,7 +14097,7 @@
</span><span class="cx"> 
</span><span class="cx">                 if ($type &amp; SIMPLEPIE_LOCATOR_AUTODISCOVERY &amp;&amp; $working = $this-&gt;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 &amp; (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) &amp;&amp; $this-&gt;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-&gt;file-&gt;body), SimplePie_Misc::get_element('a', $this-&gt;file-&gt;body), SimplePie_Misc::get_element('area', $this-&gt;file-&gt;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-&gt;checked_feeds == $this-&gt;max_checked_feeds)
</del><ins>+                        if ($this-&gt;checked_feeds === $this-&gt;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-&gt;http_base);
</span><span class="cx">                                 }
</span><span class="cx"> 
</span><del>-                                if (!in_array($href, $done) &amp;&amp; in_array('feed', $rel) || (in_array('alternate', $rel) &amp;&amp; !empty($link['attribs']['type']['data']) &amp;&amp; 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) &amp;&amp; in_array('feed', $rel) || (in_array('alternate', $rel) &amp;&amp; !empty($link['attribs']['type']['data']) &amp;&amp; in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))) &amp;&amp; !isset($feeds[$href]))
</ins><span class="cx">                                 {
</span><span class="cx">                                         $this-&gt;checked_feeds++;
</span><span class="cx">                                         $feed =&amp; new $this-&gt;file_class($href, $this-&gt;timeout, 5, null, $this-&gt;useragent);
</span><del>-                                        if ($this-&gt;is_feed($feed))
</del><ins>+                                        if ($feed-&gt;success &amp;&amp; ($feed-&gt;method &amp; SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed-&gt;status_code === 200 || $feed-&gt;status_code &gt; 206 &amp;&amp; $feed-&gt;status_code &lt; 300)) &amp;&amp; $this-&gt;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-&gt;file-&gt;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-&gt;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 =&gt; $value)
</span><span class="cx">                 {
</span><del>-                        if ($this-&gt;checked_feeds == $this-&gt;max_checked_feeds)
</del><ins>+                        if ($this-&gt;checked_feeds === $this-&gt;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-&gt;checked_feeds++;
</span><span class="cx">                                 $feed =&amp; new $this-&gt;file_class($value, $this-&gt;timeout, 5, null, $this-&gt;useragent);
</span><del>-                                if ($this-&gt;is_feed($feed))
</del><ins>+                                if ($feed-&gt;success &amp;&amp; ($feed-&gt;method &amp; SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed-&gt;status_code === 200 || $feed-&gt;status_code &gt; 206 &amp;&amp; $feed-&gt;status_code &lt; 300)) &amp;&amp; $this-&gt;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 =&gt; $value)
</span><span class="cx">                 {
</span><del>-                        if ($this-&gt;checked_feeds == $this-&gt;max_checked_feeds)
</del><ins>+                        if ($this-&gt;checked_feeds === $this-&gt;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-&gt;checked_feeds++;
</span><span class="cx">                                 $feed =&amp; new $this-&gt;file_class($value, $this-&gt;timeout, 5, null, $this-&gt;useragent);
</span><del>-                                if ($this-&gt;is_feed($feed))
</del><ins>+                                if ($feed-&gt;success &amp;&amp; ($feed-&gt;method &amp; SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed-&gt;status_code === 200 || $feed-&gt;status_code &gt; 206 &amp;&amp; $feed-&gt;status_code &lt; 300)) &amp;&amp; $this-&gt;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(&amp;$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-&gt;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('&amp;lt;', '&amp;#60;', $data);
-                $data = str_replace('&amp;gt;', '&amp;#62;', $data);
-                $data = str_replace('&amp;amp;', '&amp;#38;', $data);
-                $data = str_replace('&amp;apos;', '&amp;#39;', $data);
-                $data = str_replace('&amp;quot;', '&amp;#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, '&lt;foo&gt;&amp;amp;&lt;/foo&gt;', $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-&gt;encoding, $this-&gt;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-&gt;encoding, $this-&gt;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-&gt;error_code = xml_get_error_code($xml);
+                                $this-&gt;error_string = xml_error_string($this-&gt;error_code);
+                                $return = false;
+                        }
+                        $this-&gt;current_line = xml_get_current_line_number($xml);
+                        $this-&gt;current_column = xml_get_current_column_number($xml);
+                        $this-&gt;current_byte = xml_get_current_byte_index($xml);
+                        xml_parser_free($xml);
+                        return $return;
+                }
+                else
</ins><span class="cx">                 {
</span><del>-                        $this-&gt;error_code = xml_get_error_code($xml);
-                        $this-&gt;error_string = xml_error_string($this-&gt;error_code);
-                        $return = false;
</del><ins>+                        libxml_clear_errors();
+                        $xml =&amp; new XMLReader();
+                        $xml-&gt;xml($data);
+                        while (@$xml-&gt;read())
+                        {
+                                switch ($xml-&gt;nodeType)
+                                {
+
+                                        case constant('XMLReader::END_ELEMENT'):
+                                                if ($xml-&gt;namespaceURI !== '')
+                                                {
+                                                        $tagName = &quot;{$xml-&gt;namespaceURI}{$this-&gt;separator}{$xml-&gt;localName}&quot;;
+                                                }
+                                                else
+                                                {
+                                                        $tagName = $xml-&gt;localName;
+                                                }
+                                                $this-&gt;tag_close(null, $tagName);
+                                                break;
+                                        case constant('XMLReader::ELEMENT'):
+                                                $empty = $xml-&gt;isEmptyElement;
+                                                if ($xml-&gt;namespaceURI !== '')
+                                                {
+                                                        $tagName = &quot;{$xml-&gt;namespaceURI}{$this-&gt;separator}{$xml-&gt;localName}&quot;;
+                                                }
+                                                else
+                                                {
+                                                        $tagName = $xml-&gt;localName;
+                                                }
+                                                $attributes = array();
+                                                while ($xml-&gt;moveToNextAttribute())
+                                                {
+                                                        if ($xml-&gt;namespaceURI !== '')
+                                                        {
+                                                                $attrName = &quot;{$xml-&gt;namespaceURI}{$this-&gt;separator}{$xml-&gt;localName}&quot;;
+                                                        }
+                                                        else
+                                                        {
+                                                                $attrName = $xml-&gt;localName;
+                                                        }
+                                                        $attributes[$attrName] = $xml-&gt;value;
+                                                }
+                                                $this-&gt;tag_open(null, $tagName, $attributes);
+                                                if ($empty)
+                                                {
+                                                        $this-&gt;tag_close(null, $tagName);
+                                                }
+                                                break;
+                                        case constant('XMLReader::TEXT'):
+
+                                        case constant('XMLReader::CDATA'):
+                                                $this-&gt;cdata(null, $xml-&gt;value);
+                                                break;
+                                }
+                        }
+                        if ($error = libxml_get_last_error())
+                        {
+                                $this-&gt;error_code = $error-&gt;code;
+                                $this-&gt;error_string = $error-&gt;message;
+                                $this-&gt;current_line = $error-&gt;line;
+                                $this-&gt;current_column = $error-&gt;column;
+                                return false;
+                        }
+                        else
+                        {
+                                return true;
+                        }
</ins><span class="cx">                 }
</span><del>-                $this-&gt;current_line = xml_get_current_line_number($xml);
-                $this-&gt;current_column = xml_get_current_column_number($xml);
-                $this-&gt;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-&gt;feed === 0)
-                {
-                        return;
-                }
-                elseif ($this-&gt;feed == false)
-                {
-                        if (in_array($tag, array(
-                                SIMPLEPIE_NAMESPACE_ATOM_10 . $this-&gt;separator . 'feed',
-                                SIMPLEPIE_NAMESPACE_ATOM_03 . $this-&gt;separator . 'feed',
-                                'rss',
-                                SIMPLEPIE_NAMESPACE_RDF . $this-&gt;separator . 'RDF'
-                        )))
-                        {
-                                        $this-&gt;feed = 1;
-                        }
-                }
-                else
-                {
-                        $this-&gt;feed++;
-                }
-
</del><span class="cx">                 list($this-&gt;namespace[], $this-&gt;element[]) = $this-&gt;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-&gt;current_xhtml_construct &gt;= 0)
</span><span class="cx">                 {
</span><span class="cx">                         $this-&gt;current_xhtml_construct++;
</span><del>-                        if (end($this-&gt;namespace) == SIMPLEPIE_NAMESPACE_XHTML)
</del><ins>+                        if (end($this-&gt;namespace) === SIMPLEPIE_NAMESPACE_XHTML)
</ins><span class="cx">                         {
</span><span class="cx">                                 $this-&gt;data['data'] .= '&lt;' . end($this-&gt;element);
</span><span class="cx">                                 if (isset($attribs['']))
</span><span class="lines">@@ -13199,8 +14565,8 @@
</span><span class="cx">                         $this-&gt;datas[] =&amp; $this-&gt;data;
</span><span class="cx">                         $this-&gt;data =&amp; $this-&gt;data['child'][end($this-&gt;namespace)][end($this-&gt;element)][];
</span><span class="cx">                         $this-&gt;data = array('data' =&gt; '', 'attribs' =&gt; $attribs, 'xml_base' =&gt; end($this-&gt;xml_base), 'xml_base_explicit' =&gt; end($this-&gt;xml_base_explicit), 'xml_lang' =&gt; end($this-&gt;xml_lang));
</span><del>-                        if ((end($this-&gt;namespace) == SIMPLEPIE_NAMESPACE_ATOM_03 &amp;&amp; in_array(end($this-&gt;element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) &amp;&amp; isset($attribs['']['mode']) &amp;&amp; $attribs['']['mode'] == 'xml')
-                        || (end($this-&gt;namespace) == SIMPLEPIE_NAMESPACE_ATOM_10 &amp;&amp; in_array(end($this-&gt;element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) &amp;&amp; isset($attribs['']['type']) &amp;&amp; $attribs['']['type'] == 'xhtml'))
</del><ins>+                        if ((end($this-&gt;namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 &amp;&amp; in_array(end($this-&gt;element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) &amp;&amp; isset($attribs['']['mode']) &amp;&amp; $attribs['']['mode'] === 'xml')
+                        || (end($this-&gt;namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 &amp;&amp; in_array(end($this-&gt;element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) &amp;&amp; isset($attribs['']['type']) &amp;&amp; $attribs['']['type'] === 'xhtml'))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this-&gt;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-&gt;data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this-&gt;encoding);
</span><span class="cx">                 }
</span><del>-                elseif ($this-&gt;feed &gt; 1)
</del><ins>+                else
</ins><span class="cx">                 {
</span><span class="cx">                         $this-&gt;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-&gt;feed)
-                {
-                        return;
-                }
-
</del><span class="cx">                 if ($this-&gt;current_xhtml_construct &gt;= 0)
</span><span class="cx">                 {
</span><span class="cx">                         $this-&gt;current_xhtml_construct--;
</span><del>-                        if (end($this-&gt;namespace) == SIMPLEPIE_NAMESPACE_XHTML &amp;&amp; !in_array(end($this-&gt;element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param')))
</del><ins>+                        if (end($this-&gt;namespace) === SIMPLEPIE_NAMESPACE_XHTML &amp;&amp; !in_array(end($this-&gt;element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param')))
</ins><span class="cx">                         {
</span><span class="cx">                                 $this-&gt;data['data'] .= '&lt;/' . end($this-&gt;element) . '&gt;';
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-                if ($this-&gt;current_xhtml_construct == -1)
</del><ins>+                if ($this-&gt;current_xhtml_construct === -1)
</ins><span class="cx">                 {
</span><del>-                        $this-&gt;data =&amp; $this-&gt;datas[$this-&gt;feed];
</del><ins>+                        $this-&gt;data =&amp; $this-&gt;datas[count($this-&gt;datas) - 1];
</ins><span class="cx">                         array_pop($this-&gt;datas);
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -13245,7 +14606,6 @@
</span><span class="cx">                 array_pop($this-&gt;xml_base);
</span><span class="cx">                 array_pop($this-&gt;xml_base_explicit);
</span><span class="cx">                 array_pop($this-&gt;xml_lang);
</span><del>-                $this-&gt;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 =&amp; new $this-&gt;file_class($img['attribs']['src']['data'], $this-&gt;timeout, 5, array('X-FORWARDED-FOR' =&gt; $_SERVER['REMOTE_ADDR']), $this-&gt;useragent, $this-&gt;force_fsockopen);
</span><span class="cx">                                                                 $headers = $file-&gt;headers;
</span><span class="cx"> 
</span><del>-                                                                if ($file-&gt;success &amp;&amp; ($file-&gt;status_code == 200 || ($file-&gt;status_code &gt; 206 &amp;&amp; $file-&gt;status_code &lt; 300)))
</del><ins>+                                                                if ($file-&gt;success &amp;&amp; ($file-&gt;method &amp; SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file-&gt;status_code === 200 || $file-&gt;status_code &gt; 206 &amp;&amp; $file-&gt;status_code &lt; 300)))
</ins><span class="cx">                                                                 {
</span><span class="cx">                                                                         if ($cache-&gt;save(array('headers' =&gt; $file-&gt;headers, 'body' =&gt; $file-&gt;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(&quot;$cache-&gt;name is not writeable&quot;, E_USER_WARNING);
</del><ins>+                                                                                trigger_error(&quot;$this-&gt;cache_location is not writeable&quot;, 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-&gt;output_encoding != 'UTF-8')
</del><ins>+                        if ($this-&gt;output_encoding !== 'UTF-8')
</ins><span class="cx">                         {
</span><span class="cx">                                 $data = SimplePie_Misc::change_encoding($data, 'UTF-8', $this-&gt;output_encoding);
</span><span class="cx">                         }
</span></span></pre>
</div>
</div>

</body>
</html>