From 6c9f23bbab78ca9512157298c2b60b23986e9da1 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 5 Nov 2012 14:25:25 +0000 Subject: [PATCH] Update SimplePie to 1.3.1. Props rmccue, ocean90. fixes #22321 git-svn-id: http://core.svn.wordpress.org/trunk@22366 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/SimplePie/Author.php | 2 +- wp-includes/SimplePie/Cache.php | 15 ++- wp-includes/SimplePie/Cache/Base.php | 2 +- wp-includes/SimplePie/Cache/DB.php | 2 +- wp-includes/SimplePie/Cache/File.php | 2 +- wp-includes/SimplePie/Cache/Memcache.php | 2 +- wp-includes/SimplePie/Cache/MySQL.php | 2 +- wp-includes/SimplePie/Caption.php | 2 +- wp-includes/SimplePie/Category.php | 2 +- .../SimplePie/Content/Type/Sniffer.php | 2 +- wp-includes/SimplePie/Copyright.php | 2 +- wp-includes/SimplePie/Core.php | 2 +- wp-includes/SimplePie/Credit.php | 2 +- .../SimplePie/Decode/HTML/Entities.php | 2 +- wp-includes/SimplePie/Enclosure.php | 2 +- wp-includes/SimplePie/File.php | 2 +- wp-includes/SimplePie/HTTP/Parser.php | 2 +- wp-includes/SimplePie/IRI.php | 10 +- wp-includes/SimplePie/Item.php | 2 +- wp-includes/SimplePie/Locator.php | 46 +++++++-- wp-includes/SimplePie/Misc.php | 10 +- wp-includes/SimplePie/Net/IPv6.php | 2 +- wp-includes/SimplePie/Parse/Date.php | 2 +- wp-includes/SimplePie/Parser.php | 10 +- wp-includes/SimplePie/Rating.php | 2 +- wp-includes/SimplePie/Registry.php | 18 +++- wp-includes/SimplePie/Restriction.php | 2 +- wp-includes/SimplePie/Sanitize.php | 15 ++- wp-includes/SimplePie/Source.php | 2 +- .../SimplePie/XML/Declaration/Parser.php | 2 +- wp-includes/SimplePie/gzdecode.php | 2 +- wp-includes/class-simplepie.php | 97 +++++++++++++++++-- 32 files changed, 214 insertions(+), 55 deletions(-) diff --git a/wp-includes/SimplePie/Author.php b/wp-includes/SimplePie/Author.php index 7f698ae9fe..bbf3812ff8 100755 --- a/wp-includes/SimplePie/Author.php +++ b/wp-includes/SimplePie/Author.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Cache.php b/wp-includes/SimplePie/Cache.php index 19c69362d9..75586d7497 100755 --- a/wp-includes/SimplePie/Cache.php +++ b/wp-includes/SimplePie/Cache.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon @@ -79,7 +79,7 @@ class SimplePie_Cache * @param string $extension 'spi' or 'spc' * @return SimplePie_Cache_Base Type of object depends on scheme of `$location` */ - public static function create($location, $filename, $extension) + public static function get_handler($location, $filename, $extension) { $type = explode(':', $location, 2); $type = $type[0]; @@ -92,6 +92,17 @@ class SimplePie_Cache return new SimplePie_Cache_File($location, $filename, $extension); } + /** + * Create a new SimplePie_Cache object + * + * @deprecated Use {@see get_handler} instead + */ + public function create($location, $filename, $extension) + { + trigger_error('Cache::create() has been replaced with Cache::get_handler(). Switch to the registry system to use this.', E_USER_DEPRECATED); + return self::get_handler($location, $filename, $extension); + } + /** * Register a handler * diff --git a/wp-includes/SimplePie/Cache/Base.php b/wp-includes/SimplePie/Cache/Base.php index a82b4cbe75..937e346317 100755 --- a/wp-includes/SimplePie/Cache/Base.php +++ b/wp-includes/SimplePie/Cache/Base.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Cache/DB.php b/wp-includes/SimplePie/Cache/DB.php index d6c7767ea6..ac509ae087 100755 --- a/wp-includes/SimplePie/Cache/DB.php +++ b/wp-includes/SimplePie/Cache/DB.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Cache/File.php b/wp-includes/SimplePie/Cache/File.php index 8c2e171a3b..5797b3aede 100755 --- a/wp-includes/SimplePie/Cache/File.php +++ b/wp-includes/SimplePie/Cache/File.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Cache/Memcache.php b/wp-includes/SimplePie/Cache/Memcache.php index d418867262..fd44780609 100755 --- a/wp-includes/SimplePie/Cache/Memcache.php +++ b/wp-includes/SimplePie/Cache/Memcache.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Cache/MySQL.php b/wp-includes/SimplePie/Cache/MySQL.php index 773194618d..d53ebc1174 100755 --- a/wp-includes/SimplePie/Cache/MySQL.php +++ b/wp-includes/SimplePie/Cache/MySQL.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Caption.php b/wp-includes/SimplePie/Caption.php index 9c61820add..52922c5d95 100755 --- a/wp-includes/SimplePie/Caption.php +++ b/wp-includes/SimplePie/Caption.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Category.php b/wp-includes/SimplePie/Category.php index f36ff781db..ad0407b4e2 100755 --- a/wp-includes/SimplePie/Category.php +++ b/wp-includes/SimplePie/Category.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Content/Type/Sniffer.php b/wp-includes/SimplePie/Content/Type/Sniffer.php index ce332b52a6..20d053dca4 100755 --- a/wp-includes/SimplePie/Content/Type/Sniffer.php +++ b/wp-includes/SimplePie/Content/Type/Sniffer.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Copyright.php b/wp-includes/SimplePie/Copyright.php index b40159e9d9..57c535a64a 100755 --- a/wp-includes/SimplePie/Copyright.php +++ b/wp-includes/SimplePie/Copyright.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Core.php b/wp-includes/SimplePie/Core.php index f2bba874d1..46d996628e 100755 --- a/wp-includes/SimplePie/Core.php +++ b/wp-includes/SimplePie/Core.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Credit.php b/wp-includes/SimplePie/Credit.php index 475263b881..d3a3442ad9 100755 --- a/wp-includes/SimplePie/Credit.php +++ b/wp-includes/SimplePie/Credit.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Decode/HTML/Entities.php b/wp-includes/SimplePie/Decode/HTML/Entities.php index 1298b62178..069e8d8e56 100755 --- a/wp-includes/SimplePie/Decode/HTML/Entities.php +++ b/wp-includes/SimplePie/Decode/HTML/Entities.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Enclosure.php b/wp-includes/SimplePie/Enclosure.php index 919dc65644..55674379c2 100755 --- a/wp-includes/SimplePie/Enclosure.php +++ b/wp-includes/SimplePie/Enclosure.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/File.php b/wp-includes/SimplePie/File.php index a5cf83eb6d..b7d1a2ac9b 100755 --- a/wp-includes/SimplePie/File.php +++ b/wp-includes/SimplePie/File.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/HTTP/Parser.php b/wp-includes/SimplePie/HTTP/Parser.php index ad33f72c1c..bff2222b2c 100755 --- a/wp-includes/SimplePie/HTTP/Parser.php +++ b/wp-includes/SimplePie/HTTP/Parser.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/IRI.php b/wp-includes/SimplePie/IRI.php index 012866da6b..d3198c04ff 100755 --- a/wp-includes/SimplePie/IRI.php +++ b/wp-includes/SimplePie/IRI.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon @@ -390,8 +390,8 @@ class SimplePie_IRI } else { - trigger_error('This should never happen', E_USER_ERROR); - die; + // This can occur when a paragraph is accidentally parsed as a URI + return false; } } @@ -824,6 +824,10 @@ class SimplePie_IRI else { $parsed = $this->parse_iri((string) $iri); + if (!$parsed) + { + return false; + } $return = $this->set_scheme($parsed['scheme']) && $this->set_authority($parsed['authority']) diff --git a/wp-includes/SimplePie/Item.php b/wp-includes/SimplePie/Item.php index a9ec1f301b..a77574b37e 100755 --- a/wp-includes/SimplePie/Item.php +++ b/wp-includes/SimplePie/Item.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Locator.php b/wp-includes/SimplePie/Locator.php index 58ddaf78a0..57e910c22b 100755 --- a/wp-includes/SimplePie/Locator.php +++ b/wp-includes/SimplePie/Locator.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon @@ -72,11 +72,18 @@ class SimplePie_Locator $this->timeout = $timeout; $this->max_checked_feeds = $max_checked_feeds; - $this->dom = new DOMDocument(); + if (class_exists('DOMDocument')) + { + $this->dom = new DOMDocument(); - set_error_handler(array('SimplePie_Misc', 'silence_errors')); - $this->dom->loadHTML($this->file->body); - restore_error_handler(); + set_error_handler(array('SimplePie_Misc', 'silence_errors')); + $this->dom->loadHTML($this->file->body); + restore_error_handler(); + } + else + { + $this->dom = null; + } } public function set_registry(SimplePie_Registry $registry) @@ -162,6 +169,10 @@ class SimplePie_Locator public function get_base() { + if ($this->dom === null) + { + throw new SimplePie_Exception('DOMDocument not found, unable to use locator'); + } $this->http_base = $this->file->url; $this->base = $this->http_base; $elements = $this->dom->getElementsByTagName('base'); @@ -169,7 +180,12 @@ class SimplePie_Locator { if ($element->hasAttribute('href')) { - $this->base = $this->registry->call('Misc', 'absolutize_url', array(trim($element->getAttribute('href')), $this->http_base)); + $base = $this->registry->call('Misc', 'absolutize_url', array(trim($element->getAttribute('href')), $this->http_base)); + if ($base === false) + { + continue; + } + $this->base = $base; $this->base_location = method_exists($element, 'getLineNo') ? $element->getLineNo() : 0; break; } @@ -196,6 +212,11 @@ class SimplePie_Locator protected function search_elements_by_tag($name, &$done, $feeds) { + if ($this->dom === null) + { + throw new SimplePie_Exception('DOMDocument not found, unable to use locator'); + } + $links = $this->dom->getElementsByTagName($name); foreach ($links as $link) { @@ -216,6 +237,10 @@ class SimplePie_Locator { $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base)); } + if ($href === false) + { + continue; + } if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !in_array('stylesheet', $rel) && $link->hasAttribute('type') && in_array(strtolower($this->registry->call('Misc', 'parse_mime', array($link->getAttribute('type')))), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href])) { @@ -238,6 +263,11 @@ class SimplePie_Locator public function get_links() { + if ($this->dom === null) + { + throw new SimplePie_Exception('DOMDocument not found, unable to use locator'); + } + $links = $this->dom->getElementsByTagName('a'); foreach ($links as $link) { @@ -255,6 +285,10 @@ class SimplePie_Locator { $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base)); } + if ($href === false) + { + continue; + } $current = $this->registry->call('Misc', 'parse_url', array($this->file->url)); diff --git a/wp-includes/SimplePie/Misc.php b/wp-includes/SimplePie/Misc.php index 138a6f933d..5d7367f646 100755 --- a/wp-includes/SimplePie/Misc.php +++ b/wp-includes/SimplePie/Misc.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon @@ -80,9 +80,11 @@ class SimplePie_Misc public static function absolutize_url($relative, $base) { $iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative); - if ( $iri ) - return $iri->get_uri(); - return $relative; + if ($iri === false) + { + return false; + } + return $iri->get_uri(); } /** diff --git a/wp-includes/SimplePie/Net/IPv6.php b/wp-includes/SimplePie/Net/IPv6.php index b9e4b35c94..da80d8acac 100755 --- a/wp-includes/SimplePie/Net/IPv6.php +++ b/wp-includes/SimplePie/Net/IPv6.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Parse/Date.php b/wp-includes/SimplePie/Parse/Date.php index 9f76945f19..d51f500d3f 100755 --- a/wp-includes/SimplePie/Parse/Date.php +++ b/wp-includes/SimplePie/Parse/Date.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Parser.php b/wp-includes/SimplePie/Parser.php index 47172d1087..d698552ca7 100755 --- a/wp-includes/SimplePie/Parser.php +++ b/wp-includes/SimplePie/Parser.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon @@ -278,8 +278,12 @@ class SimplePie_Parser if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['base'])) { - $this->xml_base[] = $this->registry->call('Misc', 'absolutize_url', array($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base))); - $this->xml_base_explicit[] = true; + $base = $this->registry->call('Misc', 'absolutize_url', array($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base))); + if ($base !== false) + { + $this->xml_base[] = $base; + $this->xml_base_explicit[] = true; + } } else { diff --git a/wp-includes/SimplePie/Rating.php b/wp-includes/SimplePie/Rating.php index d14eb6fa50..8689e5dfbd 100755 --- a/wp-includes/SimplePie/Rating.php +++ b/wp-includes/SimplePie/Rating.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Registry.php b/wp-includes/SimplePie/Registry.php index 4fcd53c7b0..1072cdebb5 100755 --- a/wp-includes/SimplePie/Registry.php +++ b/wp-includes/SimplePie/Registry.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon @@ -203,6 +203,22 @@ class SimplePie_Registry { $class = $this->get_class($type); + if (in_array($class, $this->legacy)) + { + switch ($type) + { + case 'Cache': + // For backwards compatibility with old non-static + // Cache::create() methods + if ($method === 'get_handler') + { + $result = @call_user_func_array(array($class, 'create'), $parameters); + return $result; + } + break; + } + } + $result = call_user_func_array(array($class, $method), $parameters); return $result; } diff --git a/wp-includes/SimplePie/Restriction.php b/wp-includes/SimplePie/Restriction.php index 40ea17df74..4ba371bfbc 100755 --- a/wp-includes/SimplePie/Restriction.php +++ b/wp-includes/SimplePie/Restriction.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/Sanitize.php b/wp-includes/SimplePie/Sanitize.php index 9e11357dfb..6810cc49ff 100755 --- a/wp-includes/SimplePie/Sanitize.php +++ b/wp-includes/SimplePie/Sanitize.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon @@ -302,7 +302,7 @@ class SimplePie_Sanitize if ($img->hasAttribute('src')) { $image_url = call_user_func($this->cache_name_function, $img->getAttribute('src')); - $cache = $this->registry->call('Cache', 'create', array($this->cache_location, $image_url, 'spi')); + $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, $image_url, 'spi')); if ($cache->load()) { @@ -356,7 +356,11 @@ class SimplePie_Sanitize if ($type & SIMPLEPIE_CONSTRUCT_IRI) { - $data = $this->registry->call('Misc', 'absolutize_url', array($data, $base)); + $absolute = $this->registry->call('Misc', 'absolutize_url', array($data, $base)); + if ($absolute !== false) + { + $data = $absolute; + } } if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI)) @@ -412,7 +416,10 @@ class SimplePie_Sanitize if ($element->hasAttribute($attribute)) { $value = $this->registry->call('Misc', 'absolutize_url', array($element->getAttribute($attribute), $this->base)); - $element->setAttribute($attribute, $value); + if ($value !== false) + { + $element->setAttribute($attribute, $value); + } } } } diff --git a/wp-includes/SimplePie/Source.php b/wp-includes/SimplePie/Source.php index 3aa3b60710..51d8e6c256 100755 --- a/wp-includes/SimplePie/Source.php +++ b/wp-includes/SimplePie/Source.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/XML/Declaration/Parser.php b/wp-includes/SimplePie/XML/Declaration/Parser.php index a03f63a030..aec19f10ad 100755 --- a/wp-includes/SimplePie/XML/Declaration/Parser.php +++ b/wp-includes/SimplePie/XML/Declaration/Parser.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/SimplePie/gzdecode.php b/wp-includes/SimplePie/gzdecode.php index 88cb07f3a1..52e024ea98 100755 --- a/wp-includes/SimplePie/gzdecode.php +++ b/wp-includes/SimplePie/gzdecode.php @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon diff --git a/wp-includes/class-simplepie.php b/wp-includes/class-simplepie.php index c5b0f11a12..ba6f28dba0 100644 --- a/wp-includes/class-simplepie.php +++ b/wp-includes/class-simplepie.php @@ -93,7 +93,7 @@ if ( function_exists( 'spl_autoload_register' ) ) { * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.3 + * @version 1.3.1 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue * @author Ryan Parman * @author Geoffrey Sneddon @@ -110,7 +110,7 @@ define('SIMPLEPIE_NAME', 'SimplePie'); /** * SimplePie Version */ -define('SIMPLEPIE_VERSION', '1.3'); +define('SIMPLEPIE_VERSION', '1.3.1'); /** * SimplePie Build @@ -696,7 +696,19 @@ class SimplePie if (func_num_args() > 0) { - trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_location() directly.'); + $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; + trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_location() directly.', $level); + + $args = func_get_args(); + switch (count($args)) { + case 3: + $this->set_cache_duration($args[2]); + case 2: + $this->set_cache_location($args[1]); + case 1: + $this->set_feed_url($args[0]); + $this->init(); + } } } @@ -1323,7 +1335,7 @@ class SimplePie // Decide whether to enable caching if ($this->cache && $parsed_feed_url['scheme'] !== '') { - $cache = $this->registry->call('Cache', 'create', array($this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc')); + $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc')); } // Fetch the data via SimplePie_File into $this->raw_data @@ -1560,10 +1572,20 @@ class SimplePie { // We need to unset this so that if SimplePie::set_file() has been called that object is untouched unset($file); - if (!($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds))) + try { - $this->error = "A feed could not be found at $this->feed_url. A feed with an invalid mime type may fall victim to this error, or " . SIMPLEPIE_NAME . " was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed."; - $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); + if (!($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds))) + { + $this->error = "A feed could not be found at $this->feed_url. A feed with an invalid mime type may fall victim to this error, or " . SIMPLEPIE_NAME . " was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed."; + $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__)); + return false; + } + } + catch (SimplePie_Exception $e) + { + // This is usually because DOMDocument doesn't exist + $this->error = $e->getMessage(); + $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, $e->getFile(), $e->getLine())); return false; } if ($cache) @@ -1573,7 +1595,7 @@ class SimplePie { trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING); } - $cache = $this->registry->call('Cache', 'create', array($this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc')); + $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc')); } $this->feed_url = $file->url; } @@ -2961,6 +2983,65 @@ class SimplePie } } + /** + * Set the favicon handler + * + * @deprecated Use your own favicon handling instead + */ + public function set_favicon_handler($page = false, $qs = 'i') + { + $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; + trigger_error('Favicon handling has been removed, please use your own handling', $level); + return false; + } + + /** + * Get the favicon for the current feed + * + * @deprecated Use your own favicon handling instead + */ + public function get_favicon() + { + $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; + trigger_error('Favicon handling has been removed, please use your own handling', $level); + + if (($url = $this->get_link()) !== null) + { + return 'http://g.etfv.co/' . urlencode($url); + } + + return false; + } + + /** + * Magic method handler + * + * @param string $method Method name + * @param array $args Arguments to the method + * @return mixed + */ + public function __call($method, $args) + { + if (strpos($method, 'subscribe_') === 0) + { + $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; + trigger_error('subscribe_*() has been deprecated, implement the callback yourself', $level); + return ''; + } + if ($method === 'enable_xml_dump') + { + $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING; + trigger_error('enable_xml_dump() has been deprecated, use get_raw_data() instead', $level); + return false; + } + + $class = get_class($this); + $trace = debug_backtrace(); + $file = $trace[0]['file']; + $line = $trace[0]['line']; + trigger_error("Call to undefined method $class::$method() in $file on line $line", E_USER_ERROR); + } + /** * Sorting callback for items *