Make WordPress Core

Changeset 22366


Ignore:
Timestamp:
11/05/2012 02:25:25 PM (12 years ago)
Author:
ryan
Message:

Update SimplePie to 1.3.1. Props rmccue, ocean90. fixes #22321

Location:
trunk/wp-includes
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/SimplePie/Author.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Cache.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
     
    8080     * @return SimplePie_Cache_Base Type of object depends on scheme of `$location`
    8181     */
    82     public static function create($location, $filename, $extension)
     82    public static function get_handler($location, $filename, $extension)
    8383    {
    8484        $type = explode(':', $location, 2);
     
    9191
    9292        return new SimplePie_Cache_File($location, $filename, $extension);
     93    }
     94
     95    /**
     96     * Create a new SimplePie_Cache object
     97     *
     98     * @deprecated Use {@see get_handler} instead
     99     */
     100    public function create($location, $filename, $extension)
     101    {
     102        trigger_error('Cache::create() has been replaced with Cache::get_handler(). Switch to the registry system to use this.', E_USER_DEPRECATED);
     103        return self::get_handler($location, $filename, $extension);
    93104    }
    94105
  • trunk/wp-includes/SimplePie/Cache/Base.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Cache/DB.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Cache/File.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Cache/Memcache.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Cache/MySQL.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Caption.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Category.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Content/Type/Sniffer.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Copyright.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Core.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Credit.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Decode/HTML/Entities.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Enclosure.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/File.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/HTTP/Parser.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/IRI.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
     
    391391        else
    392392        {
    393             trigger_error('This should never happen', E_USER_ERROR);
    394             die;
     393            // This can occur when a paragraph is accidentally parsed as a URI
     394            return false;
    395395        }
    396396    }
     
    825825        {
    826826            $parsed = $this->parse_iri((string) $iri);
     827            if (!$parsed)
     828            {
     829                return false;
     830            }
    827831
    828832            $return = $this->set_scheme($parsed['scheme'])
  • trunk/wp-includes/SimplePie/Item.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Locator.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
     
    7373        $this->max_checked_feeds = $max_checked_feeds;
    7474
    75         $this->dom = new DOMDocument();
    76 
    77         set_error_handler(array('SimplePie_Misc', 'silence_errors'));
    78         $this->dom->loadHTML($this->file->body);
    79         restore_error_handler();
     75        if (class_exists('DOMDocument'))
     76        {
     77            $this->dom = new DOMDocument();
     78
     79            set_error_handler(array('SimplePie_Misc', 'silence_errors'));
     80            $this->dom->loadHTML($this->file->body);
     81            restore_error_handler();
     82        }
     83        else
     84        {
     85            $this->dom = null;
     86        }
    8087    }
    8188
     
    163170    public function get_base()
    164171    {
     172        if ($this->dom === null)
     173        {
     174            throw new SimplePie_Exception('DOMDocument not found, unable to use locator');
     175        }
    165176        $this->http_base = $this->file->url;
    166177        $this->base = $this->http_base;
     
    170181            if ($element->hasAttribute('href'))
    171182            {
    172                 $this->base = $this->registry->call('Misc', 'absolutize_url', array(trim($element->getAttribute('href')), $this->http_base));
     183                $base = $this->registry->call('Misc', 'absolutize_url', array(trim($element->getAttribute('href')), $this->http_base));
     184                if ($base === false)
     185                {
     186                    continue;
     187                }
     188                $this->base = $base;
    173189                $this->base_location = method_exists($element, 'getLineNo') ? $element->getLineNo() : 0;
    174190                break;
     
    197213    protected function search_elements_by_tag($name, &$done, $feeds)
    198214    {
     215        if ($this->dom === null)
     216        {
     217            throw new SimplePie_Exception('DOMDocument not found, unable to use locator');
     218        }
     219
    199220        $links = $this->dom->getElementsByTagName($name);
    200221        foreach ($links as $link)
     
    216237                {
    217238                    $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base));
     239                }
     240                if ($href === false)
     241                {
     242                    continue;
    218243                }
    219244
     
    239264    public function get_links()
    240265    {
     266        if ($this->dom === null)
     267        {
     268            throw new SimplePie_Exception('DOMDocument not found, unable to use locator');
     269        }
     270
    241271        $links = $this->dom->getElementsByTagName('a');
    242272        foreach ($links as $link)
     
    255285                    {
    256286                        $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base));
     287                    }
     288                    if ($href === false)
     289                    {
     290                        continue;
    257291                    }
    258292
  • trunk/wp-includes/SimplePie/Misc.php

    r22169 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
     
    8181    {
    8282        $iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative);
    83         if ( $iri )
    84             return $iri->get_uri();
    85         return $relative;
     83        if ($iri === false)
     84        {
     85            return false;
     86        }
     87        return $iri->get_uri();
    8688    }
    8789
  • trunk/wp-includes/SimplePie/Net/IPv6.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Parse/Date.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Parser.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
     
    279279        if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['base']))
    280280        {
    281             $this->xml_base[] = $this->registry->call('Misc', 'absolutize_url', array($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base)));
    282             $this->xml_base_explicit[] = true;
     281            $base = $this->registry->call('Misc', 'absolutize_url', array($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base)));
     282            if ($base !== false)
     283            {
     284                $this->xml_base[] = $base;
     285                $this->xml_base_explicit[] = true;
     286            }
    283287        }
    284288        else
  • trunk/wp-includes/SimplePie/Rating.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Registry.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
     
    204204        $class = $this->get_class($type);
    205205
     206        if (in_array($class, $this->legacy))
     207        {
     208            switch ($type)
     209            {
     210                case 'Cache':
     211                    // For backwards compatibility with old non-static
     212                    // Cache::create() methods
     213                    if ($method === 'get_handler')
     214                    {
     215                        $result = @call_user_func_array(array($class, 'create'), $parameters);
     216                        return $result;
     217                    }
     218                    break;
     219            }
     220        }
     221
    206222        $result = call_user_func_array(array($class, $method), $parameters);
    207223        return $result;
  • trunk/wp-includes/SimplePie/Restriction.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/Sanitize.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
     
    303303                        {
    304304                            $image_url = call_user_func($this->cache_name_function, $img->getAttribute('src'));
    305                             $cache = $this->registry->call('Cache', 'create', array($this->cache_location, $image_url, 'spi'));
     305                            $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, $image_url, 'spi'));
    306306
    307307                            if ($cache->load())
     
    357357            if ($type & SIMPLEPIE_CONSTRUCT_IRI)
    358358            {
    359                 $data = $this->registry->call('Misc', 'absolutize_url', array($data, $base));
     359                $absolute = $this->registry->call('Misc', 'absolutize_url', array($data, $base));
     360                if ($absolute !== false)
     361                {
     362                    $data = $absolute;
     363                }
    360364            }
    361365
     
    413417                    {
    414418                        $value = $this->registry->call('Misc', 'absolutize_url', array($element->getAttribute($attribute), $this->base));
    415                         $element->setAttribute($attribute, $value);
     419                        if ($value !== false)
     420                        {
     421                            $element->setAttribute($attribute, $value);
     422                        }
    416423                    }
    417424                }
  • trunk/wp-includes/SimplePie/Source.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/XML/Declaration/Parser.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/SimplePie/gzdecode.php

    r21644 r22366  
    3434 *
    3535 * @package SimplePie
    36  * @version 1.3
     36 * @version 1.3.1
    3737 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    3838 * @author Ryan Parman
  • trunk/wp-includes/class-simplepie.php

    r21645 r22366  
    9494 *
    9595 * @package SimplePie
    96  * @version 1.3
     96 * @version 1.3.1
    9797 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
    9898 * @author Ryan Parman
     
    111111 * SimplePie Version
    112112 */
    113 define('SIMPLEPIE_VERSION', '1.3');
     113define('SIMPLEPIE_VERSION', '1.3.1');
    114114
    115115/**
     
    697697        if (func_num_args() > 0)
    698698        {
    699             trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_location() directly.');
     699            $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
     700            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);
     701
     702            $args = func_get_args();
     703            switch (count($args)) {
     704                case 3:
     705                    $this->set_cache_duration($args[2]);
     706                case 2:
     707                    $this->set_cache_location($args[1]);
     708                case 1:
     709                    $this->set_feed_url($args[0]);
     710                    $this->init();
     711            }
    700712        }
    701713    }
     
    13241336            if ($this->cache && $parsed_feed_url['scheme'] !== '')
    13251337            {
    1326                 $cache = $this->registry->call('Cache', 'create', array($this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc'));
     1338                $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc'));
    13271339            }
    13281340
     
    15611573                // We need to unset this so that if SimplePie::set_file() has been called that object is untouched
    15621574                unset($file);
    1563                 if (!($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds)))
    1564                 {
    1565                     $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.";
    1566                     $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
     1575                try
     1576                {
     1577                    if (!($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds)))
     1578                    {
     1579                        $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.";
     1580                        $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
     1581                        return false;
     1582                    }
     1583                }
     1584                catch (SimplePie_Exception $e)
     1585                {
     1586                    // This is usually because DOMDocument doesn't exist
     1587                    $this->error = $e->getMessage();
     1588                    $this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, $e->getFile(), $e->getLine()));
    15671589                    return false;
    15681590                }
     
    15741596                        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);
    15751597                    }
    1576                     $cache = $this->registry->call('Cache', 'create', array($this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc'));
     1598                    $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc'));
    15771599                }
    15781600                $this->feed_url = $file->url;
     
    29632985
    29642986    /**
     2987     * Set the favicon handler
     2988     *
     2989     * @deprecated Use your own favicon handling instead
     2990     */
     2991    public function set_favicon_handler($page = false, $qs = 'i')
     2992    {
     2993        $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
     2994        trigger_error('Favicon handling has been removed, please use your own handling', $level);
     2995        return false;
     2996    }
     2997
     2998    /**
     2999     * Get the favicon for the current feed
     3000     *
     3001     * @deprecated Use your own favicon handling instead
     3002     */
     3003    public function get_favicon()
     3004    {
     3005        $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
     3006        trigger_error('Favicon handling has been removed, please use your own handling', $level);
     3007
     3008        if (($url = $this->get_link()) !== null)
     3009        {
     3010            return 'http://g.etfv.co/' . urlencode($url);
     3011        }
     3012
     3013        return false;
     3014    }
     3015
     3016    /**
     3017     * Magic method handler
     3018     *
     3019     * @param string $method Method name
     3020     * @param array $args Arguments to the method
     3021     * @return mixed
     3022     */
     3023    public function __call($method, $args)
     3024    {
     3025        if (strpos($method, 'subscribe_') === 0)
     3026        {
     3027            $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
     3028            trigger_error('subscribe_*() has been deprecated, implement the callback yourself', $level);
     3029            return '';
     3030        }
     3031        if ($method === 'enable_xml_dump')
     3032        {
     3033            $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
     3034            trigger_error('enable_xml_dump() has been deprecated, use get_raw_data() instead', $level);
     3035            return false;
     3036        }
     3037
     3038        $class = get_class($this);
     3039        $trace = debug_backtrace();
     3040        $file = $trace[0]['file'];
     3041        $line = $trace[0]['line'];
     3042        trigger_error("Call to undefined method $class::$method() in $file on line $line", E_USER_ERROR);
     3043    }
     3044
     3045    /**
    29653046     * Sorting callback for items
    29663047     *
Note: See TracChangeset for help on using the changeset viewer.