diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-10-30 15:16:22 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-10-30 15:16:22 -0400 |
commit | 00ba1348ff9f43a382a03891700db1e5d058f5c6 (patch) | |
tree | 34ceace1442ab09cfa0c8e420abebac01bd1ea5e | |
parent | e20c374195337f20705115f9c83d3fa2923c427d (diff) |
[News] SimplePie library updated to 1.3.1
34 files changed, 229 insertions, 66 deletions
diff --git a/3rdparty/SimplePie/autoloader.php b/3rdparty/SimplePie/autoloader.php index 9fb7be586..c16a8f8b5 100644 --- a/3rdparty/SimplePie/autoloader.php +++ b/3rdparty/SimplePie/autoloader.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/3rdparty/SimplePie/library/SimplePie.php b/3rdparty/SimplePie/library/SimplePie.php index 5042f6b1a..b33c635f1 100644 --- a/3rdparty/SimplePie/library/SimplePie.php +++ b/3rdparty/SimplePie/library/SimplePie.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 @@ -50,7 +50,7 @@ define('SIMPLEPIE_NAME', 'SimplePie'); /** * SimplePie Version */ -define('SIMPLEPIE_VERSION', '1.3'); +define('SIMPLEPIE_VERSION', '1.3.1'); /** * SimplePie Build @@ -636,7 +636,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(); + } } } @@ -1263,7 +1275,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 @@ -1500,10 +1512,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 + { + 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->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__)); + // 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) @@ -1513,7 +1535,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; } @@ -2902,6 +2924,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 * * @access private diff --git a/3rdparty/SimplePie/library/SimplePie/Author.php b/3rdparty/SimplePie/library/SimplePie/Author.php index ac274ecbf..bbf3812ff 100644 --- a/3rdparty/SimplePie/library/SimplePie/Author.php +++ b/3rdparty/SimplePie/library/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 @@ -154,3 +154,4 @@ class SimplePie_Author } } } + diff --git a/3rdparty/SimplePie/library/SimplePie/Cache.php b/3rdparty/SimplePie/library/SimplePie/Cache.php index 19c69362d..75586d749 100644 --- a/3rdparty/SimplePie/library/SimplePie/Cache.php +++ b/3rdparty/SimplePie/library/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]; @@ -93,6 +93,17 @@ class SimplePie_Cache } /** + * 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 * * @param string $type DSN type to register for diff --git a/3rdparty/SimplePie/library/SimplePie/Cache/Base.php b/3rdparty/SimplePie/library/SimplePie/Cache/Base.php index a82b4cbe7..937e34631 100644 --- a/3rdparty/SimplePie/library/SimplePie/Cache/Base.php +++ b/3rdparty/SimplePie/library/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/3rdparty/SimplePie/library/SimplePie/Cache/DB.php b/3rdparty/SimplePie/library/SimplePie/Cache/DB.php index d6c7767ea..ac509ae08 100644 --- a/3rdparty/SimplePie/library/SimplePie/Cache/DB.php +++ b/3rdparty/SimplePie/library/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/3rdparty/SimplePie/library/SimplePie/Cache/File.php b/3rdparty/SimplePie/library/SimplePie/Cache/File.php index 8c2e171a3..5797b3aed 100644 --- a/3rdparty/SimplePie/library/SimplePie/Cache/File.php +++ b/3rdparty/SimplePie/library/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/3rdparty/SimplePie/library/SimplePie/Cache/Memcache.php b/3rdparty/SimplePie/library/SimplePie/Cache/Memcache.php index d41886726..fd4478060 100644 --- a/3rdparty/SimplePie/library/SimplePie/Cache/Memcache.php +++ b/3rdparty/SimplePie/library/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/3rdparty/SimplePie/library/SimplePie/Cache/MySQL.php b/3rdparty/SimplePie/library/SimplePie/Cache/MySQL.php index 773194618..d53ebc117 100644 --- a/3rdparty/SimplePie/library/SimplePie/Cache/MySQL.php +++ b/3rdparty/SimplePie/library/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/3rdparty/SimplePie/library/SimplePie/Caption.php b/3rdparty/SimplePie/library/SimplePie/Caption.php index e8aa00381..52922c5d9 100644 --- a/3rdparty/SimplePie/library/SimplePie/Caption.php +++ b/3rdparty/SimplePie/library/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 @@ -207,3 +207,4 @@ class SimplePie_Caption } } } + diff --git a/3rdparty/SimplePie/library/SimplePie/Category.php b/3rdparty/SimplePie/library/SimplePie/Category.php index 7a5af892e..ad0407b4e 100644 --- a/3rdparty/SimplePie/library/SimplePie/Category.php +++ b/3rdparty/SimplePie/library/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 @@ -154,3 +154,4 @@ class SimplePie_Category } } } + diff --git a/3rdparty/SimplePie/library/SimplePie/Content/Type/Sniffer.php b/3rdparty/SimplePie/library/SimplePie/Content/Type/Sniffer.php index b5ed9fb06..20d053dca 100644 --- a/3rdparty/SimplePie/library/SimplePie/Content/Type/Sniffer.php +++ b/3rdparty/SimplePie/library/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 @@ -329,3 +329,4 @@ class SimplePie_Content_Type_Sniffer return 'text/html'; } } + diff --git a/3rdparty/SimplePie/library/SimplePie/Copyright.php b/3rdparty/SimplePie/library/SimplePie/Copyright.php index c52fcb760..57c535a64 100644 --- a/3rdparty/SimplePie/library/SimplePie/Copyright.php +++ b/3rdparty/SimplePie/library/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 @@ -127,3 +127,4 @@ class SimplePie_Copyright } } } + diff --git a/3rdparty/SimplePie/library/SimplePie/Core.php b/3rdparty/SimplePie/library/SimplePie/Core.php index f2bba874d..46d996628 100644 --- a/3rdparty/SimplePie/library/SimplePie/Core.php +++ b/3rdparty/SimplePie/library/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/3rdparty/SimplePie/library/SimplePie/Credit.php b/3rdparty/SimplePie/library/SimplePie/Credit.php index 692f860c6..d3a3442ad 100644 --- a/3rdparty/SimplePie/library/SimplePie/Credit.php +++ b/3rdparty/SimplePie/library/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 @@ -153,3 +153,4 @@ class SimplePie_Credit } } } + diff --git a/3rdparty/SimplePie/library/SimplePie/Decode/HTML/Entities.php b/3rdparty/SimplePie/library/SimplePie/Decode/HTML/Entities.php index b06821394..069e8d8e5 100644 --- a/3rdparty/SimplePie/library/SimplePie/Decode/HTML/Entities.php +++ b/3rdparty/SimplePie/library/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 @@ -614,3 +614,4 @@ class SimplePie_Decode_HTML_Entities } } } + diff --git a/3rdparty/SimplePie/library/SimplePie/Enclosure.php b/3rdparty/SimplePie/library/SimplePie/Enclosure.php index d784c77c1..55674379c 100644 --- a/3rdparty/SimplePie/library/SimplePie/Enclosure.php +++ b/3rdparty/SimplePie/library/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 @@ -1377,3 +1377,4 @@ class SimplePie_Enclosure } } } + diff --git a/3rdparty/SimplePie/library/SimplePie/File.php b/3rdparty/SimplePie/library/SimplePie/File.php index a5cf83eb6..b7d1a2ac9 100644 --- a/3rdparty/SimplePie/library/SimplePie/File.php +++ b/3rdparty/SimplePie/library/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/3rdparty/SimplePie/library/SimplePie/HTTP/Parser.php b/3rdparty/SimplePie/library/SimplePie/HTTP/Parser.php index ad33f72c1..bff2222b2 100644 --- a/3rdparty/SimplePie/library/SimplePie/HTTP/Parser.php +++ b/3rdparty/SimplePie/library/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/3rdparty/SimplePie/library/SimplePie/IRI.php b/3rdparty/SimplePie/library/SimplePie/IRI.php index 012866da6..d3198c04f 100644 --- a/3rdparty/SimplePie/library/SimplePie/IRI.php +++ b/3rdparty/SimplePie/library/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/3rdparty/SimplePie/library/SimplePie/Item.php b/3rdparty/SimplePie/library/SimplePie/Item.php index bcf9ad686..a77574b37 100644 --- a/3rdparty/SimplePie/library/SimplePie/Item.php +++ b/3rdparty/SimplePie/library/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 @@ -2961,3 +2961,4 @@ class SimplePie_Item } } } + diff --git a/3rdparty/SimplePie/library/SimplePie/Locator.php b/3rdparty/SimplePie/library/SimplePie/Locator.php index 07270cd37..57e910c22 100644 --- a/3rdparty/SimplePie/library/SimplePie/Locator.php +++ b/3rdparty/SimplePie/library/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('DO |