mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
External Libraries: Update the SimplePie library to the latest version (1.5.5).
This brings SimplePie in sync with the most up to date version, 1.5.5. This update brings many bug fixes, small enhancements, and PHP compatibility fixes for newer versions of PHP. For a full list of changes, see https://github.com/simplepie/simplepie/blob/master/CHANGELOG.md#155-may-1-2020. Props dshanske, slushman, etruel, wpshades, dmenard, desrosj, hareesh-pillai, stevenkword, jrf, Ipstenu, johnbillion. Fixes #36669. Built from https://develop.svn.wordpress.org/trunk@47733 git-svn-id: http://core.svn.wordpress.org/trunk@47509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7f5686d40e
commit
a72e30d847
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -114,10 +113,8 @@ class SimplePie_Author
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,10 +128,8 @@ class SimplePie_Author
|
||||
{
|
||||
return $this->link;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -148,10 +143,7 @@ class SimplePie_Author
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -62,8 +61,10 @@ class SimplePie_Cache
|
||||
* @var array
|
||||
*/
|
||||
protected static $handlers = array(
|
||||
'mysql' => 'SimplePie_Cache_MySQL',
|
||||
'memcache' => 'SimplePie_Cache_Memcache',
|
||||
'mysql' => 'SimplePie_Cache_MySQL',
|
||||
'memcache' => 'SimplePie_Cache_Memcache',
|
||||
'memcached' => 'SimplePie_Cache_Memcached',
|
||||
'redis' => 'SimplePie_Cache_Redis'
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -102,7 +101,7 @@ class SimplePie_Cache_File implements SimplePie_Cache_Base
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location))
|
||||
if (file_exists($this->name) && is_writable($this->name) || file_exists($this->location) && is_writable($this->location))
|
||||
{
|
||||
if ($data instanceof SimplePie)
|
||||
{
|
||||
@ -136,11 +135,7 @@ class SimplePie_Cache_File implements SimplePie_Cache_Base
|
||||
*/
|
||||
public function mtime()
|
||||
{
|
||||
if (file_exists($this->name))
|
||||
{
|
||||
return filemtime($this->name);
|
||||
}
|
||||
return false;
|
||||
return @filemtime($this->name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,11 +145,7 @@ class SimplePie_Cache_File implements SimplePie_Cache_Base
|
||||
*/
|
||||
public function touch()
|
||||
{
|
||||
if (file_exists($this->name))
|
||||
{
|
||||
return touch($this->name);
|
||||
}
|
||||
return false;
|
||||
return @touch($this->name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -95,10 +94,8 @@ class SimplePie_Cache_Memcache implements SimplePie_Cache_Base
|
||||
'prefix' => 'simplepie_',
|
||||
),
|
||||
);
|
||||
$parsed = SimplePie_Cache::parse_URL($location);
|
||||
$this->options['host'] = empty($parsed['host']) ? $this->options['host'] : $parsed['host'];
|
||||
$this->options['port'] = empty($parsed['port']) ? $this->options['port'] : $parsed['port'];
|
||||
$this->options['extras'] = array_merge($this->options['extras'], $parsed['extras']);
|
||||
$this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
|
||||
|
||||
$this->name = $this->options['extras']['prefix'] . md5("$name:$type");
|
||||
|
||||
$this->cache = new Memcache();
|
||||
@ -147,7 +144,7 @@ class SimplePie_Cache_Memcache implements SimplePie_Cache_Base
|
||||
|
||||
if ($data !== false)
|
||||
{
|
||||
// essentially ignore the mtime because Memcache expires on it's own
|
||||
// essentially ignore the mtime because Memcache expires on its own
|
||||
return time();
|
||||
}
|
||||
|
||||
@ -165,7 +162,7 @@ class SimplePie_Cache_Memcache implements SimplePie_Cache_Base
|
||||
|
||||
if ($data !== false)
|
||||
{
|
||||
return $this->cache->set($this->name, $data, MEMCACHE_COMPRESSED, (int) $this->duration);
|
||||
return $this->cache->set($this->name, $data, MEMCACHE_COMPRESSED, (int) $this->options['extras']['timeout']);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
166
wp-includes/SimplePie/Cache/Memcached.php
Normal file
166
wp-includes/SimplePie/Cache/Memcached.php
Normal file
@ -0,0 +1,166 @@
|
||||
<?php
|
||||
/**
|
||||
* SimplePie
|
||||
*
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the SimplePie Team nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
|
||||
* AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Caches data to memcached
|
||||
*
|
||||
* Registered for URLs with the "memcached" protocol
|
||||
*
|
||||
* For example, `memcached://localhost:11211/?timeout=3600&prefix=sp_` will
|
||||
* connect to memcached on `localhost` on port 11211. All tables will be
|
||||
* prefixed with `sp_` and data will expire after 3600 seconds
|
||||
*
|
||||
* @package SimplePie
|
||||
* @subpackage Caching
|
||||
* @author Paul L. McNeely
|
||||
* @uses Memcached
|
||||
*/
|
||||
class SimplePie_Cache_Memcached implements SimplePie_Cache_Base
|
||||
{
|
||||
/**
|
||||
* Memcached instance
|
||||
* @var Memcached
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* Options
|
||||
* @var array
|
||||
*/
|
||||
protected $options;
|
||||
|
||||
/**
|
||||
* Cache name
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Create a new cache object
|
||||
* @param string $location Location string (from SimplePie::$cache_location)
|
||||
* @param string $name Unique ID for the cache
|
||||
* @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
|
||||
*/
|
||||
public function __construct($location, $name, $type) {
|
||||
$this->options = array(
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 11211,
|
||||
'extras' => array(
|
||||
'timeout' => 3600, // one hour
|
||||
'prefix' => 'simplepie_',
|
||||
),
|
||||
);
|
||||
$this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
|
||||
|
||||
$this->name = $this->options['extras']['prefix'] . md5("$name:$type");
|
||||
|
||||
$this->cache = new Memcached();
|
||||
$this->cache->addServer($this->options['host'], (int)$this->options['port']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save data to the cache
|
||||
* @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
|
||||
* @return bool Successfulness
|
||||
*/
|
||||
public function save($data) {
|
||||
if ($data instanceof SimplePie) {
|
||||
$data = $data->data;
|
||||
}
|
||||
|
||||
return $this->setData(serialize($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the data saved to the cache
|
||||
* @return array Data for SimplePie::$data
|
||||
*/
|
||||
public function load() {
|
||||
$data = $this->cache->get($this->name);
|
||||
|
||||
if ($data !== false) {
|
||||
return unserialize($data);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the last modified time for the cache
|
||||
* @return int Timestamp
|
||||
*/
|
||||
public function mtime() {
|
||||
$data = $this->cache->get($this->name . '_mtime');
|
||||
return (int) $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the last modified time to the current time
|
||||
* @return bool Success status
|
||||
*/
|
||||
public function touch() {
|
||||
$data = $this->cache->get($this->name);
|
||||
return $this->setData($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the cache
|
||||
* @return bool Success status
|
||||
*/
|
||||
public function unlink() {
|
||||
return $this->cache->delete($this->name, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the last modified time and data to Memcached
|
||||
* @return bool Success status
|
||||
*/
|
||||
private function setData($data) {
|
||||
|
||||
if ($data !== false) {
|
||||
$this->cache->set($this->name . '_mtime', time(), (int)$this->options['extras']['timeout']);
|
||||
return $this->cache->set($this->name, $data, (int)$this->options['extras']['timeout']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -94,9 +93,11 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
|
||||
'path' => '',
|
||||
'extras' => array(
|
||||
'prefix' => '',
|
||||
'cache_purge_time' => 2592000
|
||||
),
|
||||
);
|
||||
$this->options = array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
|
||||
|
||||
$this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
|
||||
|
||||
// Path is prefixed with a "/"
|
||||
$this->options['dbname'] = substr($this->options['path'], 1);
|
||||
@ -130,16 +131,20 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
|
||||
$query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . '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)))');
|
||||
if ($query === false)
|
||||
{
|
||||
trigger_error("Can't create " . $this->options['extras']['prefix'] . "cache_data table, check permissions", E_USER_WARNING);
|
||||
$this->mysql = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!in_array($this->options['extras']['prefix'] . 'items', $db))
|
||||
{
|
||||
$query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . '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)))');
|
||||
$query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` MEDIUMBLOB NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))');
|
||||
if ($query === false)
|
||||
{
|
||||
trigger_error("Can't create " . $this->options['extras']['prefix'] . "items table, check permissions", E_USER_WARNING);
|
||||
$this->mysql = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -157,6 +162,17 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = $this->mysql->prepare('DELETE i, cd FROM `' . $this->options['extras']['prefix'] . 'cache_data` cd, ' .
|
||||
'`' . $this->options['extras']['prefix'] . 'items` i ' .
|
||||
'WHERE cd.id = i.feed_id ' .
|
||||
'AND cd.mtime < (unix_timestamp() - :purge_time)');
|
||||
$query->bindValue(':purge_time', $this->options['extras']['cache_purge_time']);
|
||||
|
||||
if (!$query->execute())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($data instanceof SimplePie)
|
||||
{
|
||||
$data = clone $data;
|
||||
@ -379,10 +395,8 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
|
||||
{
|
||||
return $time;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -400,14 +414,8 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
|
||||
$query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `mtime` = :time WHERE `id` = :id');
|
||||
$query->bindValue(':time', time());
|
||||
$query->bindValue(':id', $this->id);
|
||||
if ($query->execute() && $query->rowCount() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return $query->execute() && $query->rowCount() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -426,13 +434,7 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
|
||||
$query->bindValue(':id', $this->id);
|
||||
$query2 = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :id');
|
||||
$query2->bindValue(':id', $this->id);
|
||||
if ($query->execute() && $query2->execute())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return $query->execute() && $query2->execute();
|
||||
}
|
||||
}
|
||||
|
172
wp-includes/SimplePie/Cache/Redis.php
Normal file
172
wp-includes/SimplePie/Cache/Redis.php
Normal file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SimplePie Redis Cache Extension
|
||||
*
|
||||
* @package SimplePie
|
||||
* @author Jan Kozak <galvani78@gmail.com>
|
||||
* @link http://galvani.cz/
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
* @version 0.2.9
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Caches data to redis
|
||||
*
|
||||
* Registered for URLs with the "redis" protocol
|
||||
*
|
||||
* For example, `redis://localhost:6379/?timeout=3600&prefix=sp_&dbIndex=0` will
|
||||
* connect to redis on `localhost` on port 6379. All tables will be
|
||||
* prefixed with `simple_primary-` and data will expire after 3600 seconds
|
||||
*
|
||||
* @package SimplePie
|
||||
* @subpackage Caching
|
||||
* @uses Redis
|
||||
*/
|
||||
class SimplePie_Cache_Redis implements SimplePie_Cache_Base {
|
||||
/**
|
||||
* Redis instance
|
||||
*
|
||||
* @var \Redis
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* Options
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options;
|
||||
|
||||
/**
|
||||
* Cache name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Cache Data
|
||||
*
|
||||
* @var type
|
||||
*/
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* Create a new cache object
|
||||
*
|
||||
* @param string $location Location string (from SimplePie::$cache_location)
|
||||
* @param string $name Unique ID for the cache
|
||||
* @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
|
||||
*/
|
||||
public function __construct($location, $name, $options = null) {
|
||||
//$this->cache = \flow\simple\cache\Redis::getRedisClientInstance();
|
||||
$parsed = SimplePie_Cache::parse_URL($location);
|
||||
$redis = new Redis();
|
||||
$redis->connect($parsed['host'], $parsed['port']);
|
||||
if (isset($parsed['pass'])) {
|
||||
$redis->auth($parsed['pass']);
|
||||
}
|
||||
if (isset($parsed['path'])) {
|
||||
$redis->select((int)substr($parsed['path'], 1));
|
||||
}
|
||||
$this->cache = $redis;
|
||||
|
||||
if (!is_null($options) && is_array($options)) {
|
||||
$this->options = $options;
|
||||
} else {
|
||||
$this->options = array (
|
||||
'prefix' => 'rss:simple_primary:',
|
||||
'expire' => 0,
|
||||
);
|
||||
}
|
||||
|
||||
$this->name = $this->options['prefix'] . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Redis $cache
|
||||
*/
|
||||
public function setRedisClient(\Redis $cache) {
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save data to the cache
|
||||
*
|
||||
* @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
|
||||
* @return bool Successfulness
|
||||
*/
|
||||
public function save($data) {
|
||||
if ($data instanceof SimplePie) {
|
||||
$data = $data->data;
|
||||
}
|
||||
$response = $this->cache->set($this->name, serialize($data));
|
||||
if ($this->options['expire']) {
|
||||
$this->cache->expire($this->name, $this->options['expire']);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the data saved to the cache
|
||||
*
|
||||
* @return array Data for SimplePie::$data
|
||||
*/
|
||||
public function load() {
|
||||
$data = $this->cache->get($this->name);
|
||||
|
||||
if ($data !== false) {
|
||||
return unserialize($data);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the last modified time for the cache
|
||||
*
|
||||
* @return int Timestamp
|
||||
*/
|
||||
public function mtime() {
|
||||
|
||||
$data = $this->cache->get($this->name);
|
||||
|
||||
if ($data !== false) {
|
||||
return time();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the last modified time to the current time
|
||||
*
|
||||
* @return bool Success status
|
||||
*/
|
||||
public function touch() {
|
||||
|
||||
$data = $this->cache->get($this->name);
|
||||
|
||||
if ($data !== false) {
|
||||
$return = $this->cache->set($this->name, $data);
|
||||
if ($this->options['expire']) {
|
||||
return $this->cache->expire($this->name, $this->ttl);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the cache
|
||||
*
|
||||
* @return bool Success status
|
||||
*/
|
||||
public function unlink() {
|
||||
return $this->cache->set($this->name, null);
|
||||
}
|
||||
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -132,10 +131,8 @@ class SimplePie_Caption
|
||||
{
|
||||
return $this->endTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,10 +147,8 @@ class SimplePie_Caption
|
||||
{
|
||||
return $this->lang;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -167,10 +162,8 @@ class SimplePie_Caption
|
||||
{
|
||||
return $this->startTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,10 +177,8 @@ class SimplePie_Caption
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -201,10 +192,7 @@ class SimplePie_Caption
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -57,7 +56,7 @@ class SimplePie_Category
|
||||
/**
|
||||
* Category identifier
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
* @see get_term
|
||||
*/
|
||||
var $term;
|
||||
@ -65,7 +64,7 @@ class SimplePie_Category
|
||||
/**
|
||||
* Categorization scheme identifier
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
* @see get_scheme()
|
||||
*/
|
||||
var $scheme;
|
||||
@ -73,23 +72,36 @@ class SimplePie_Category
|
||||
/**
|
||||
* Human readable label
|
||||
*
|
||||
* @var string
|
||||
* @var string|null
|
||||
* @see get_label()
|
||||
*/
|
||||
var $label;
|
||||
|
||||
/**
|
||||
* Category type
|
||||
*
|
||||
* category for <category>
|
||||
* subject for <dc:subject>
|
||||
*
|
||||
* @var string|null
|
||||
* @see get_type()
|
||||
*/
|
||||
var $type;
|
||||
|
||||
/**
|
||||
* Constructor, used to input the data
|
||||
*
|
||||
* @param string $term
|
||||
* @param string $scheme
|
||||
* @param string $label
|
||||
* @param string|null $term
|
||||
* @param string|null $scheme
|
||||
* @param string|null $label
|
||||
* @param string|null $type
|
||||
*/
|
||||
public function __construct($term = null, $scheme = null, $label = null)
|
||||
public function __construct($term = null, $scheme = null, $label = null, $type = null)
|
||||
{
|
||||
$this->term = $term;
|
||||
$this->scheme = $scheme;
|
||||
$this->label = $label;
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,14 +122,7 @@ class SimplePie_Category
|
||||
*/
|
||||
public function get_term()
|
||||
{
|
||||
if ($this->term !== null)
|
||||
{
|
||||
return $this->term;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return $this->term;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,31 +132,32 @@ class SimplePie_Category
|
||||
*/
|
||||
public function get_scheme()
|
||||
{
|
||||
if ($this->scheme !== null)
|
||||
{
|
||||
return $this->scheme;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return $this->scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human readable label
|
||||
*
|
||||
* @param bool $strict
|
||||
* @return string|null
|
||||
*/
|
||||
public function get_label()
|
||||
public function get_label($strict = false)
|
||||
{
|
||||
if ($this->label !== null)
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
else
|
||||
if ($this->label === null && $strict !== true)
|
||||
{
|
||||
return $this->get_term();
|
||||
}
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the category type
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function get_type()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -121,24 +120,18 @@ class SimplePie_Content_Type_Sniffer
|
||||
{
|
||||
return $return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $official;
|
||||
}
|
||||
|
||||
return $official;
|
||||
}
|
||||
elseif ($official === 'text/html')
|
||||
{
|
||||
return $this->feed_or_html();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $official;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->unknown();
|
||||
|
||||
return $official;
|
||||
}
|
||||
|
||||
return $this->unknown();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,10 +152,8 @@ class SimplePie_Content_Type_Sniffer
|
||||
{
|
||||
return 'application/octect-stream';
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'text/plain';
|
||||
}
|
||||
|
||||
return 'text/plain';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -208,10 +199,8 @@ class SimplePie_Content_Type_Sniffer
|
||||
{
|
||||
return 'image/vnd.microsoft.icon';
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->text_or_binary();
|
||||
}
|
||||
|
||||
return $this->text_or_binary();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -242,10 +231,8 @@ class SimplePie_Content_Type_Sniffer
|
||||
{
|
||||
return 'image/vnd.microsoft.icon';
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -256,7 +243,7 @@ class SimplePie_Content_Type_Sniffer
|
||||
public function feed_or_html()
|
||||
{
|
||||
$len = strlen($this->file->body);
|
||||
$pos = strspn($this->file->body, "\x09\x0A\x0D\x20");
|
||||
$pos = strspn($this->file->body, "\x09\x0A\x0D\x20\xEF\xBB\xBF");
|
||||
|
||||
while ($pos < $len)
|
||||
{
|
||||
@ -329,4 +316,3 @@ class SimplePie_Content_Type_Sniffer
|
||||
return 'text/html';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -104,10 +103,8 @@ class SimplePie_Copyright
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,10 +118,7 @@ class SimplePie_Copyright
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2009, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -113,10 +112,8 @@ class SimplePie_Credit
|
||||
{
|
||||
return $this->role;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -130,10 +127,8 @@ class SimplePie_Credit
|
||||
{
|
||||
return $this->scheme;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,10 +142,7 @@ class SimplePie_Credit
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -118,10 +117,8 @@ class SimplePie_Decode_HTML_Entities
|
||||
$this->consumed .= $this->data[$this->position];
|
||||
return $this->data[$this->position++];
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -140,10 +137,8 @@ class SimplePie_Decode_HTML_Entities
|
||||
$this->position += $len;
|
||||
return $data;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,7 +164,6 @@ class SimplePie_Decode_HTML_Entities
|
||||
case "\x09":
|
||||
case "\x0A":
|
||||
case "\x0B":
|
||||
case "\x0B":
|
||||
case "\x0C":
|
||||
case "\x20":
|
||||
case "\x3C":
|
||||
@ -614,4 +608,3 @@ class SimplePie_Decode_HTML_Entities
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -283,10 +282,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->bitrate;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -302,10 +299,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $captions[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -319,10 +314,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->captions;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -338,10 +331,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $categories[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -355,10 +346,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->categories;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -372,10 +361,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->channels;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -389,10 +376,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->copyright;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -408,10 +393,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $credits[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -425,10 +408,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->credits;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -442,16 +423,14 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the duration of the enclosure
|
||||
*
|
||||
* @param string $convert Convert seconds into hh:mm:ss
|
||||
* @param bool $convert Convert seconds into hh:mm:ss
|
||||
* @return string|int|null 'hh:mm:ss' string if `$convert` was specified, otherwise integer (or null if none found)
|
||||
*/
|
||||
public function get_duration($convert = false)
|
||||
@ -463,15 +442,11 @@ class SimplePie_Enclosure
|
||||
$time = SimplePie_Misc::time_hms($this->duration);
|
||||
return $time;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->duration;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
|
||||
return $this->duration;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -485,10 +460,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->expression;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'full';
|
||||
}
|
||||
|
||||
return 'full';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -520,10 +493,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->framerate;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -550,10 +521,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $hashes[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -567,10 +536,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->hashes;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -584,10 +551,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -602,10 +567,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->lang;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -621,10 +584,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $keywords[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -638,10 +599,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->keywords;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -655,10 +614,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->length;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -672,10 +629,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return urldecode($this->link);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -690,10 +645,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->medium;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -708,10 +661,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->player;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -727,10 +678,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $ratings[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -744,10 +693,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->ratings;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -763,10 +710,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $restrictions[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -780,10 +725,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->restrictions;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -797,10 +740,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->samplingrate;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -815,10 +756,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return round($length/1048576, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -834,10 +773,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $thumbnails[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -851,10 +788,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->thumbnails;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -868,10 +803,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -886,10 +819,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -903,10 +834,8 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -942,7 +871,7 @@ class SimplePie_Enclosure
|
||||
* - `height` (integer): The height of the embedded media. Accepts any
|
||||
* numeric pixel value (such as `360`) or `auto`. Defaults to `auto`,
|
||||
* and it is recommended that you use this default.
|
||||
* - `loop` (boolean): Do you want the media to loop when its done?
|
||||
* - `loop` (boolean): Do you want the media to loop when it's done?
|
||||
* Defaults to `false`.
|
||||
* - `mediaplayer` (string): The location of the included
|
||||
* `mediaplayer.swf` file. This allows for the playback of Flash Video
|
||||
@ -1366,15 +1295,10 @@ class SimplePie_Enclosure
|
||||
{
|
||||
return 'mp3';
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $type;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.4-dev
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -64,16 +63,18 @@ class SimplePie_File
|
||||
var $redirects = 0;
|
||||
var $error;
|
||||
var $method = SIMPLEPIE_FILE_SOURCE_NONE;
|
||||
var $permanent_url;
|
||||
|
||||
public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false)
|
||||
public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false, $curl_options = array())
|
||||
{
|
||||
if (class_exists('idna_convert'))
|
||||
{
|
||||
$idn = new idna_convert();
|
||||
$parsed = SimplePie_Misc::parse_url($url);
|
||||
$url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
|
||||
$url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], NULL);
|
||||
}
|
||||
$this->url = $url;
|
||||
$this->permanent_url = $url;
|
||||
$this->useragent = $useragent;
|
||||
if (preg_match('/^http(s)?:\/\//i', $url))
|
||||
{
|
||||
@ -102,16 +103,20 @@ class SimplePie_File
|
||||
curl_setopt($fp, CURLOPT_URL, $url);
|
||||
curl_setopt($fp, CURLOPT_HEADER, 1);
|
||||
curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($fp, CURLOPT_FAILONERROR, 1);
|
||||
curl_setopt($fp, CURLOPT_TIMEOUT, $timeout);
|
||||
curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout);
|
||||
curl_setopt($fp, CURLOPT_REFERER, $url);
|
||||
curl_setopt($fp, CURLOPT_USERAGENT, $useragent);
|
||||
curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
|
||||
if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>='))
|
||||
if (!ini_get('open_basedir') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>='))
|
||||
{
|
||||
curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects);
|
||||
}
|
||||
foreach ($curl_options as $curl_param => $curl_value) {
|
||||
curl_setopt($fp, $curl_param, $curl_value);
|
||||
}
|
||||
|
||||
$this->headers = curl_exec($fp);
|
||||
if (curl_errno($fp) === 23 || curl_errno($fp) === 61)
|
||||
@ -126,21 +131,26 @@ class SimplePie_File
|
||||
}
|
||||
else
|
||||
{
|
||||
$info = curl_getinfo($fp);
|
||||
// Use the updated url provided by curl_getinfo after any redirects.
|
||||
if ($info = curl_getinfo($fp)) {
|
||||
$this->url = $info['url'];
|
||||
}
|
||||
curl_close($fp);
|
||||
$this->headers = explode("\r\n\r\n", $this->headers, $info['redirect_count'] + 1);
|
||||
$this->headers = array_pop($this->headers);
|
||||
$this->headers = SimplePie_HTTP_Parser::prepareHeaders($this->headers, $info['redirect_count'] + 1);
|
||||
$parser = new SimplePie_HTTP_Parser($this->headers);
|
||||
if ($parser->parse())
|
||||
{
|
||||
$this->headers = $parser->headers;
|
||||
$this->body = $parser->body;
|
||||
$this->body = trim($parser->body);
|
||||
$this->status_code = $parser->status_code;
|
||||
if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects)
|
||||
{
|
||||
$this->redirects++;
|
||||
$location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
|
||||
return $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
|
||||
$previousStatusCode = $this->status_code;
|
||||
$this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
|
||||
$this->permanent_url = ($previousStatusCode == 301) ? $location : $url;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,7 +232,10 @@ class SimplePie_File
|
||||
{
|
||||
$this->redirects++;
|
||||
$location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
|
||||
return $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
|
||||
$previousStatusCode = $this->status_code;
|
||||
$this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
|
||||
$this->permanent_url = ($previousStatusCode == 301) ? $location : $url;
|
||||
return;
|
||||
}
|
||||
if (isset($this->headers['content-encoding']))
|
||||
{
|
||||
@ -239,7 +252,7 @@ class SimplePie_File
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->body = $decoder->data;
|
||||
$this->body = trim($decoder->data);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -282,7 +295,7 @@ class SimplePie_File
|
||||
else
|
||||
{
|
||||
$this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS;
|
||||
if (!$this->body = file_get_contents($url))
|
||||
if (empty($url) || !($this->body = trim(file_get_contents($url))))
|
||||
{
|
||||
$this->error = 'file_get_contents could not read the file';
|
||||
$this->success = false;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -156,15 +155,13 @@ class SimplePie_HTTP_Parser
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->http_version = '';
|
||||
$this->status_code = '';
|
||||
$this->reason = '';
|
||||
$this->headers = array();
|
||||
$this->body = '';
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->http_version = '';
|
||||
$this->status_code = '';
|
||||
$this->reason = '';
|
||||
$this->headers = array();
|
||||
$this->body = '';
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -497,4 +494,25 @@ class SimplePie_HTTP_Parser
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare headers (take care of proxies headers)
|
||||
*
|
||||
* @param string $headers Raw headers
|
||||
* @param integer $count Redirection count. Default to 1.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
static public function prepareHeaders($headers, $count = 1)
|
||||
{
|
||||
$data = explode("\r\n\r\n", $headers, $count);
|
||||
$data = array_pop($data);
|
||||
if (false !== stripos($data, "HTTP/1.0 200 Connection established\r\n\r\n")) {
|
||||
$data = str_ireplace("HTTP/1.0 200 Connection established\r\n\r\n", '', $data);
|
||||
}
|
||||
if (false !== stripos($data, "HTTP/1.1 200 Connection established\r\n\r\n")) {
|
||||
$data = str_ireplace("HTTP/1.1 200 Connection established\r\n\r\n", '', $data);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -47,10 +46,10 @@
|
||||
*
|
||||
* @package SimplePie
|
||||
* @subpackage HTTP
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Steve Minutillo
|
||||
* @author Ryan McCue
|
||||
* @copyright 2007-2012 Geoffrey Sneddon, Steve Minutillo, Ryan McCue
|
||||
* @copyright 2007-2012 Sam Sneddon, Steve Minutillo, Ryan McCue
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php
|
||||
*/
|
||||
class SimplePie_IRI
|
||||
@ -212,10 +211,8 @@ class SimplePie_IRI
|
||||
{
|
||||
return $this->normalization[$this->scheme][$name];
|
||||
}
|
||||
else
|
||||
{
|
||||
return $return;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -226,14 +223,7 @@ class SimplePie_IRI
|
||||
*/
|
||||
public function __isset($name)
|
||||
{
|
||||
if (method_exists($this, 'get_' . $name) || isset($this->$name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return method_exists($this, 'get_' . $name) || isset($this->$name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -259,6 +249,15 @@ class SimplePie_IRI
|
||||
$this->set_iri($iri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up
|
||||
*/
|
||||
public function __destruct() {
|
||||
$this->set_iri(null, true);
|
||||
$this->set_path(null, true);
|
||||
$this->set_authority(null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new IRI object by resolving a relative IRI
|
||||
*
|
||||
@ -348,10 +347,8 @@ class SimplePie_IRI
|
||||
$target->scheme_normalization();
|
||||
return $target;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -388,11 +385,9 @@ class SimplePie_IRI
|
||||
}
|
||||
return $match;
|
||||
}
|
||||
else
|
||||
{
|
||||
// This can occur when a paragraph is accidentally parsed as a URI
|
||||
return false;
|
||||
}
|
||||
|
||||
// This can occur when a paragraph is accidentally parsed as a URI
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -768,24 +763,20 @@ class SimplePie_IRI
|
||||
*/
|
||||
public function is_valid()
|
||||
{
|
||||
$isauthority = $this->iuserinfo !== null || $this->ihost !== null || $this->port !== null;
|
||||
if ($this->ipath !== '' &&
|
||||
(
|
||||
$isauthority && (
|
||||
$this->ipath[0] !== '/' ||
|
||||
substr($this->ipath, 0, 2) === '//'
|
||||
) ||
|
||||
(
|
||||
$this->scheme === null &&
|
||||
!$isauthority &&
|
||||
strpos($this->ipath, ':') !== false &&
|
||||
(strpos($this->ipath, '/') === false ? true : strpos($this->ipath, ':') < strpos($this->ipath, '/'))
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ($this->ipath === '') return true;
|
||||
|
||||
$isauthority = $this->iuserinfo !== null || $this->ihost !== null ||
|
||||
$this->port !== null;
|
||||
if ($isauthority && $this->ipath[0] === '/') return true;
|
||||
|
||||
if (!$isauthority && (substr($this->ipath, 0, 2) === '//')) return false;
|
||||
|
||||
// Relative urls cannot have a colon in the first path segment (and the
|
||||
// slashes themselves are not included so skip the first character).
|
||||
if (!$this->scheme && !$isauthority &&
|
||||
strpos($this->ipath, ':') !== false &&
|
||||
strpos($this->ipath, '/', 1) !== false &&
|
||||
strpos($this->ipath, ':') < strpos($this->ipath, '/', 1)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -797,9 +788,14 @@ class SimplePie_IRI
|
||||
* @param string $iri
|
||||
* @return bool
|
||||
*/
|
||||
public function set_iri($iri)
|
||||
public function set_iri($iri, $clear_cache = false)
|
||||
{
|
||||
static $cache;
|
||||
if ($clear_cache)
|
||||
{
|
||||
$cache = null;
|
||||
return;
|
||||
}
|
||||
if (!$cache)
|
||||
{
|
||||
$cache = array();
|
||||
@ -821,30 +817,28 @@ class SimplePie_IRI
|
||||
$return) = $cache[$iri];
|
||||
return $return;
|
||||
}
|
||||
else
|
||||
|
||||
$parsed = $this->parse_iri((string) $iri);
|
||||
if (!$parsed)
|
||||
{
|
||||
$parsed = $this->parse_iri((string) $iri);
|
||||
if (!$parsed)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$return = $this->set_scheme($parsed['scheme'])
|
||||
&& $this->set_authority($parsed['authority'])
|
||||
&& $this->set_path($parsed['path'])
|
||||
&& $this->set_query($parsed['query'])
|
||||
&& $this->set_fragment($parsed['fragment']);
|
||||
|
||||
$cache[$iri] = array($this->scheme,
|
||||
$this->iuserinfo,
|
||||
$this->ihost,
|
||||
$this->port,
|
||||
$this->ipath,
|
||||
$this->iquery,
|
||||
$this->ifragment,
|
||||
$return);
|
||||
return $return;
|
||||
return false;
|
||||
}
|
||||
|
||||
$return = $this->set_scheme($parsed['scheme'])
|
||||
&& $this->set_authority($parsed['authority'])
|
||||
&& $this->set_path($parsed['path'])
|
||||
&& $this->set_query($parsed['query'])
|
||||
&& $this->set_fragment($parsed['fragment']);
|
||||
|
||||
$cache[$iri] = array($this->scheme,
|
||||
$this->iuserinfo,
|
||||
$this->ihost,
|
||||
$this->port,
|
||||
$this->ipath,
|
||||
$this->iquery,
|
||||
$this->ifragment,
|
||||
$return);
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -879,9 +873,14 @@ class SimplePie_IRI
|
||||
* @param string $authority
|
||||
* @return bool
|
||||
*/
|
||||
public function set_authority($authority)
|
||||
public function set_authority($authority, $clear_cache = false)
|
||||
{
|
||||
static $cache;
|
||||
if ($clear_cache)
|
||||
{
|
||||
$cache = null;
|
||||
return;
|
||||
}
|
||||
if (!$cache)
|
||||
$cache = array();
|
||||
|
||||
@ -901,42 +900,40 @@ class SimplePie_IRI
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
$remaining = $authority;
|
||||
if (($iuserinfo_end = strrpos($remaining, '@')) !== false)
|
||||
{
|
||||
$iuserinfo = substr($remaining, 0, $iuserinfo_end);
|
||||
$remaining = substr($remaining, $iuserinfo_end + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$remaining = $authority;
|
||||
if (($iuserinfo_end = strrpos($remaining, '@')) !== false)
|
||||
{
|
||||
$iuserinfo = substr($remaining, 0, $iuserinfo_end);
|
||||
$remaining = substr($remaining, $iuserinfo_end + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$iuserinfo = null;
|
||||
}
|
||||
if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false)
|
||||
{
|
||||
if (($port = substr($remaining, $port_start + 1)) === false)
|
||||
{
|
||||
$port = null;
|
||||
}
|
||||
$remaining = substr($remaining, 0, $port_start);
|
||||
}
|
||||
else
|
||||
$iuserinfo = null;
|
||||
}
|
||||
if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false)
|
||||
{
|
||||
if (($port = substr($remaining, $port_start + 1)) === false)
|
||||
{
|
||||
$port = null;
|
||||
}
|
||||
|
||||
$return = $this->set_userinfo($iuserinfo) &&
|
||||
$this->set_host($remaining) &&
|
||||
$this->set_port($port);
|
||||
|
||||
$cache[$authority] = array($this->iuserinfo,
|
||||
$this->ihost,
|
||||
$this->port,
|
||||
$return);
|
||||
|
||||
return $return;
|
||||
$remaining = substr($remaining, 0, $port_start);
|
||||
}
|
||||
else
|
||||
{
|
||||
$port = null;
|
||||
}
|
||||
|
||||
$return = $this->set_userinfo($iuserinfo) &&
|
||||
$this->set_host($remaining) &&
|
||||
$this->set_port($port);
|
||||
|
||||
$cache[$authority] = array($this->iuserinfo,
|
||||
$this->ihost,
|
||||
$this->port,
|
||||
$return);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1036,11 +1033,9 @@ class SimplePie_IRI
|
||||
$this->scheme_normalization();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->port = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->port = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1049,9 +1044,14 @@ class SimplePie_IRI
|
||||
* @param string $ipath
|
||||
* @return bool
|
||||
*/
|
||||
public function set_path($ipath)
|
||||
public function set_path($ipath, $clear_cache = false)
|
||||
{
|
||||
static $cache;
|
||||
if ($clear_cache)
|
||||
{
|
||||
$cache = null;
|
||||
return;
|
||||
}
|
||||
if (!$cache)
|
||||
{
|
||||
$cache = array();
|
||||
@ -1166,7 +1166,7 @@ class SimplePie_IRI
|
||||
{
|
||||
$iri .= $this->ipath;
|
||||
}
|
||||
elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '')
|
||||
elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '')
|
||||
{
|
||||
$iri .= $this->normalization[$this->scheme]['ipath'];
|
||||
}
|
||||
@ -1210,16 +1210,14 @@ class SimplePie_IRI
|
||||
{
|
||||
$iauthority .= $this->ihost;
|
||||
}
|
||||
if ($this->port !== null)
|
||||
if ($this->port !== null && $this->port !== 0)
|
||||
{
|
||||
$iauthority .= ':' . $this->port;
|
||||
}
|
||||
return $iauthority;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1232,7 +1230,7 @@ class SimplePie_IRI
|
||||
$iauthority = $this->get_iauthority();
|
||||
if (is_string($iauthority))
|
||||
return $this->to_uri($iauthority);
|
||||
else
|
||||
return $iauthority;
|
||||
|
||||
return $iauthority;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -122,7 +121,7 @@ class SimplePie_Item
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
|
||||
if (!gc_enabled())
|
||||
{
|
||||
unset($this->feed);
|
||||
}
|
||||
@ -148,10 +147,8 @@ class SimplePie_Item
|
||||
{
|
||||
return $this->data['child'][$namespace][$tag];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -203,14 +200,14 @@ class SimplePie_Item
|
||||
*
|
||||
* Uses `<atom:id>`, `<guid>`, `<dc:identifier>` or the `about` attribute
|
||||
* for RDF. If none of these are supplied (or `$hash` is true), creates an
|
||||
* MD5 hash based on the permalink and title. If either of those are not
|
||||
* supplied, creates a hash based on the full feed data.
|
||||
* MD5 hash based on the permalink, title and content.
|
||||
*
|
||||
* @since Beta 2
|
||||
* @param boolean $hash Should we force using a hash instead of the supplied ID?
|
||||
* @return string
|
||||
* @param string|false $fn User-supplied function to generate an hash
|
||||
* @return string|null
|
||||
*/
|
||||
public function get_id($hash = false)
|
||||
public function get_id($hash = false, $fn = 'md5')
|
||||
{
|
||||
if (!$hash)
|
||||
{
|
||||
@ -238,23 +235,18 @@ class SimplePie_Item
|
||||
{
|
||||
return $this->sanitize($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
elseif (($return = $this->get_permalink()) !== null)
|
||||
{
|
||||
return $return;
|
||||
}
|
||||
elseif (($return = $this->get_title()) !== null)
|
||||
{
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
if ($this->get_permalink() !== null || $this->get_title() !== null)
|
||||
if ($fn === false)
|
||||
{
|
||||
return md5($this->get_permalink() . $this->get_title());
|
||||
return null;
|
||||
}
|
||||
else
|
||||
elseif (!is_callable($fn))
|
||||
{
|
||||
return md5(serialize($this->data));
|
||||
trigger_error('User-supplied function $fn must be callable', E_USER_WARNING);
|
||||
$fn = 'md5';
|
||||
}
|
||||
return call_user_func($fn,
|
||||
$this->get_permalink().$this->get_title().$this->get_content());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -322,51 +314,58 @@ class SimplePie_Item
|
||||
*/
|
||||
public function get_description($description_only = false)
|
||||
{
|
||||
if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary'))
|
||||
if (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary')) &&
|
||||
($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
|
||||
return $return;
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary'))
|
||||
elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) &&
|
||||
($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
|
||||
return $return;
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
|
||||
elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) &&
|
||||
($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($tags[0]))))
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
|
||||
return $return;
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
|
||||
elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) &&
|
||||
($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0]))))
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
|
||||
return $return;
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
|
||||
elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) &&
|
||||
($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)))
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
return $return;
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
|
||||
elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) &&
|
||||
($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)))
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
return $return;
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
|
||||
elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) &&
|
||||
($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0]))))
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
|
||||
return $return;
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
|
||||
elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) &&
|
||||
($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)))
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
return $return;
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
|
||||
elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) &&
|
||||
($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML)))
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML);
|
||||
return $return;
|
||||
}
|
||||
|
||||
elseif (!$description_only)
|
||||
{
|
||||
return $this->get_content(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -385,26 +384,51 @@ class SimplePie_Item
|
||||
*/
|
||||
public function get_content($content_only = false)
|
||||
{
|
||||
if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content'))
|
||||
if (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content')) &&
|
||||
($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
|
||||
return $return;
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content'))
|
||||
elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) &&
|
||||
($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
|
||||
return $return;
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded'))
|
||||
elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) &&
|
||||
($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0]))))
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
|
||||
return $return;
|
||||
}
|
||||
elseif (!$content_only)
|
||||
{
|
||||
return $this->get_description(true);
|
||||
}
|
||||
else
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the media:thumbnail of the item
|
||||
*
|
||||
* Uses `<media:thumbnail>`
|
||||
*
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function get_thumbnail()
|
||||
{
|
||||
if (!isset($this->data['thumbnail']))
|
||||
{
|
||||
return null;
|
||||
if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail'))
|
||||
{
|
||||
$this->data['thumbnail'] = $return[0]['attribs'][''];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->data['thumbnail'] = null;
|
||||
}
|
||||
}
|
||||
return $this->data['thumbnail'];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -421,10 +445,8 @@ class SimplePie_Item
|
||||
{
|
||||
return $categories[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -433,13 +455,14 @@ class SimplePie_Item
|
||||
* Uses `<atom:category>`, `<category>` or `<dc:subject>`
|
||||
*
|
||||
* @since Beta 3
|
||||
* @return array|null List of {@see SimplePie_Category} objects
|
||||
* @return SimplePie_Category[]|null List of {@see SimplePie_Category} objects
|
||||
*/
|
||||
public function get_categories()
|
||||
{
|
||||
$categories = array();
|
||||
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
|
||||
$type = 'category';
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, $type) as $category)
|
||||
{
|
||||
$term = null;
|
||||
$scheme = null;
|
||||
@ -456,9 +479,9 @@ class SimplePie_Item
|
||||
{
|
||||
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
$categories[] = $this->registry->create('Category', array($term, $scheme, $label));
|
||||
$categories[] = $this->registry->create('Category', array($term, $scheme, $label, $type));
|
||||
}
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, $type) as $category)
|
||||
{
|
||||
// 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.
|
||||
@ -471,25 +494,25 @@ class SimplePie_Item
|
||||
{
|
||||
$scheme = null;
|
||||
}
|
||||
$categories[] = $this->registry->create('Category', array($term, $scheme, null));
|
||||
$categories[] = $this->registry->create('Category', array($term, $scheme, null, $type));
|
||||
}
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
|
||||
|
||||
$type = 'subject';
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, $type) as $category)
|
||||
{
|
||||
$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
|
||||
$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null, $type));
|
||||
}
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
|
||||
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, $type) as $category)
|
||||
{
|
||||
$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
|
||||
$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null, $type));
|
||||
}
|
||||
|
||||
if (!empty($categories))
|
||||
{
|
||||
return array_unique($categories);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -506,10 +529,8 @@ class SimplePie_Item
|
||||
{
|
||||
return $authors[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -526,10 +547,8 @@ class SimplePie_Item
|
||||
{
|
||||
return $contributors[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -538,7 +557,7 @@ class SimplePie_Item
|
||||
* Uses `<atom:contributor>`
|
||||
*
|
||||
* @since 1.1
|
||||
* @return array|null List of {@see SimplePie_Author} objects
|
||||
* @return SimplePie_Author[]|null List of {@see SimplePie_Author} objects
|
||||
*/
|
||||
public function get_contributors()
|
||||
{
|
||||
@ -592,10 +611,8 @@ class SimplePie_Item
|
||||
{
|
||||
return array_unique($contributors);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -604,7 +621,7 @@ class SimplePie_Item
|
||||
* Uses `<atom:author>`, `<author>`, `<dc:creator>` or `<itunes:author>`
|
||||
*
|
||||
* @since Beta 2
|
||||
* @return array|null List of {@see SimplePie_Author} objects
|
||||
* @return SimplePie_Author[]|null List of {@see SimplePie_Author} objects
|
||||
*/
|
||||
public function get_authors()
|
||||
{
|
||||
@ -682,10 +699,8 @@ class SimplePie_Item
|
||||
{
|
||||
return $authors;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -710,10 +725,8 @@ class SimplePie_Item
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -738,6 +751,18 @@ class SimplePie_Item
|
||||
{
|
||||
$this->data['date']['raw'] = $return[0]['data'];
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate'))
|
||||
{
|
||||
$this->data['date']['raw'] = $return[0]['data'];
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date'))
|
||||
{
|
||||
$this->data['date']['raw'] = $return[0]['data'];
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date'))
|
||||
{
|
||||
$this->data['date']['raw'] = $return[0]['data'];
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
|
||||
{
|
||||
$this->data['date']['raw'] = $return[0]['data'];
|
||||
@ -754,18 +779,6 @@ class SimplePie_Item
|
||||
{
|
||||
$this->data['date']['raw'] = $return[0]['data'];
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate'))
|
||||
{
|
||||
$this->data['date']['raw'] = $return[0]['data'];
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date'))
|
||||
{
|
||||
$this->data['date']['raw'] = $return[0]['data'];
|
||||
}
|
||||
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date'))
|
||||
{
|
||||
$this->data['date']['raw'] = $return[0]['data'];
|
||||
}
|
||||
|
||||
if (!empty($this->data['date']['raw']))
|
||||
{
|
||||
@ -792,10 +805,8 @@ class SimplePie_Item
|
||||
return date($date_format, $this->data['date']['parsed']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -821,7 +832,7 @@ class SimplePie_Item
|
||||
if (!empty($this->data['updated']['raw']))
|
||||
{
|
||||
$parser = $this->registry->call('Parse_Date', 'get');
|
||||
$this->data['updated']['parsed'] = $parser->parse($this->data['date']['raw']);
|
||||
$this->data['updated']['parsed'] = $parser->parse($this->data['updated']['raw']);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -843,10 +854,8 @@ class SimplePie_Item
|
||||
return date($date_format, $this->data['updated']['parsed']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -872,10 +881,8 @@ class SimplePie_Item
|
||||
{
|
||||
return strftime($date_format, $date);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -936,10 +943,8 @@ class SimplePie_Item
|
||||
{
|
||||
return $enclosure->get_link();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -953,14 +958,12 @@ class SimplePie_Item
|
||||
public function get_link($key = 0, $rel = 'alternate')
|
||||
{
|
||||
$links = $this->get_links($rel);
|
||||
if ($links[$key] !== null)
|
||||
if ($links && $links[$key] !== null)
|
||||
{
|
||||
return $links[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1040,10 +1043,8 @@ class SimplePie_Item
|
||||
{
|
||||
return $this->data['links'][$rel];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1063,10 +1064,8 @@ class SimplePie_Item
|
||||
{
|
||||
return $enclosures[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1080,8 +1079,8 @@ class SimplePie_Item
|
||||
*
|
||||
* @since Beta 2
|
||||
* @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4).
|
||||
* @todo If an element exists at a level, but it's value is empty, we should fall back to the value from the parent (if it exists).
|
||||
* @return array|null List of SimplePie_Enclosure items
|
||||
* @todo If an element exists at a level, but its value is empty, we should fall back to the value from the parent (if it exists).
|
||||
* @return SimplePie_Enclosure[]|null List of SimplePie_Enclosure items
|
||||
*/
|
||||
public function get_enclosures()
|
||||
{
|
||||
@ -2658,7 +2657,9 @@ class SimplePie_Item
|
||||
// PLAYER
|
||||
if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
|
||||
{
|
||||
$player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
|
||||
if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'])) {
|
||||
$player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2733,7 +2734,9 @@ class SimplePie_Item
|
||||
{
|
||||
foreach ($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
|
||||
{
|
||||
$thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
|
||||
if (isset($thumbnail['attribs']['']['url'])) {
|
||||
$thumbnails[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
|
||||
}
|
||||
}
|
||||
if (is_array($thumbnails))
|
||||
{
|
||||
@ -2789,9 +2792,17 @@ class SimplePie_Item
|
||||
{
|
||||
$length = ceil($link['attribs']['']['length']);
|
||||
}
|
||||
if (isset($link['attribs']['']['title']))
|
||||
{
|
||||
$title = $this->sanitize($link['attribs']['']['title'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
else
|
||||
{
|
||||
$title = $title_parent;
|
||||
}
|
||||
|
||||
// Since we don't have group or content for these, we'll just pass the '*_parent' variables directly to the constructor
|
||||
$this->data['enclosures'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $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));
|
||||
$this->data['enclosures'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $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, $width));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2877,10 +2888,8 @@ class SimplePie_Item
|
||||
{
|
||||
return $this->data['enclosures'];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2905,10 +2914,8 @@ class SimplePie_Item
|
||||
{
|
||||
return (float) $match[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2937,10 +2944,8 @@ class SimplePie_Item
|
||||
{
|
||||
return (float) $match[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2955,10 +2960,7 @@ class SimplePie_Item
|
||||
{
|
||||
return $this->registry->create('Source', array($this, $return[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -63,14 +62,18 @@ class SimplePie_Locator
|
||||
var $base_location = 0;
|
||||
var $checked_feeds = 0;
|
||||
var $max_checked_feeds = 10;
|
||||
var $force_fsockopen = false;
|
||||
var $curl_options = array();
|
||||
protected $registry;
|
||||
|
||||
public function __construct(SimplePie_File $file, $timeout = 10, $useragent = null, $max_checked_feeds = 10)
|
||||
public function __construct(SimplePie_File $file, $timeout = 10, $useragent = null, $max_checked_feeds = 10, $force_fsockopen = false, $curl_options = array())
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->useragent = $useragent;
|
||||
$this->timeout = $timeout;
|
||||
$this->max_checked_feeds = $max_checked_feeds;
|
||||
$this->force_fsockopen = $force_fsockopen;
|
||||
$this->curl_options = $curl_options;
|
||||
|
||||
if (class_exists('DOMDocument'))
|
||||
{
|
||||
@ -121,41 +124,42 @@ class SimplePie_Locator
|
||||
{
|
||||
if ($type & SIMPLEPIE_LOCATOR_LOCAL_EXTENSION && $working = $this->extension($this->local))
|
||||
{
|
||||
return $working;
|
||||
return $working[0];
|
||||
}
|
||||
|
||||
if ($type & SIMPLEPIE_LOCATOR_LOCAL_BODY && $working = $this->body($this->local))
|
||||
{
|
||||
return $working;
|
||||
return $working[0];
|
||||
}
|
||||
|
||||
if ($type & SIMPLEPIE_LOCATOR_REMOTE_EXTENSION && $working = $this->extension($this->elsewhere))
|
||||
{
|
||||
return $working;
|
||||
return $working[0];
|
||||
}
|
||||
|
||||
if ($type & SIMPLEPIE_LOCATOR_REMOTE_BODY && $working = $this->body($this->elsewhere))
|
||||
{
|
||||
return $working;
|
||||
return $working[0];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function is_feed($file)
|
||||
public function is_feed($file, $check_html = false)
|
||||
{
|
||||
if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
|
||||
{
|
||||
$sniffer = $this->registry->create('Content_Type_Sniffer', array($file));
|
||||
$sniffed = $sniffer->get_type();
|
||||
if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml')))
|
||||
$mime_types = array('application/rss+xml', 'application/rdf+xml',
|
||||
'text/rdf', 'application/atom+xml', 'text/xml',
|
||||
'application/xml', 'application/x-rss+xml');
|
||||
if ($check_html)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
$mime_types[] = 'text/html';
|
||||
}
|
||||
|
||||
return in_array($sniffed, $mime_types);
|
||||
}
|
||||
elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL)
|
||||
{
|
||||
@ -204,10 +208,8 @@ class SimplePie_Locator
|
||||
{
|
||||
return array_values($feeds);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function search_elements_by_tag($name, &$done, $feeds)
|
||||
@ -226,7 +228,7 @@ class SimplePie_Locator
|
||||
}
|
||||
if ($link->hasAttribute('href') && $link->hasAttribute('rel'))
|
||||
{
|
||||
$rel = array_unique($this->registry->call('Misc', 'space_seperated_tokens', array(strtolower($link->getAttribute('rel')))));
|
||||
$rel = array_unique($this->registry->call('Misc', 'space_separated_tokens', array(strtolower($link->getAttribute('rel')))));
|
||||
$line = method_exists($link, 'getLineNo') ? $link->getLineNo() : 1;
|
||||
|
||||
if ($this->base_location < $line)
|
||||
@ -242,14 +244,14 @@ class SimplePie_Locator
|
||||
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]))
|
||||
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('text/html', 'application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href]))
|
||||
{
|
||||
$this->checked_feeds++;
|
||||
$headers = array(
|
||||
'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
|
||||
);
|
||||
$feed = $this->registry->create('File', array($href, $this->timeout, 5, $headers, $this->useragent));
|
||||
if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
|
||||
$feed = $this->registry->create('File', array($href, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options));
|
||||
if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed, true))
|
||||
{
|
||||
$feeds[$href] = $feed;
|
||||
}
|
||||
@ -275,7 +277,7 @@ class SimplePie_Locator
|
||||
{
|
||||
$href = trim($link->getAttribute('href'));
|
||||
$parsed = $this->registry->call('Misc', 'parse_url', array($href));
|
||||
if ($parsed['scheme'] === '' || preg_match('/^(http(s)|feed)?$/i', $parsed['scheme']))
|
||||
if ($parsed['scheme'] === '' || preg_match('/^(https?|feed)?$/i', $parsed['scheme']))
|
||||
{
|
||||
if (method_exists($link, 'getLineNo') && $this->base_location < $link->getLineNo())
|
||||
{
|
||||
@ -312,6 +314,57 @@ class SimplePie_Locator
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_rel_link($rel)
|
||||
{
|
||||
if ($this->dom === null)
|
||||
{
|
||||
throw new SimplePie_Exception('DOMDocument not found, unable to use '.
|
||||
'locator');
|
||||
}
|
||||
if (!class_exists('DOMXpath'))
|
||||
{
|
||||
throw new SimplePie_Exception('DOMXpath not found, unable to use '.
|
||||
'get_rel_link');
|
||||
}
|
||||
|
||||
$xpath = new DOMXpath($this->dom);
|
||||
$query = '//a[@rel and @href] | //link[@rel and @href]';
|
||||
foreach ($xpath->query($query) as $link)
|
||||
{
|
||||
$href = trim($link->getAttribute('href'));
|
||||
$parsed = $this->registry->call('Misc', 'parse_url', array($href));
|
||||
if ($parsed['scheme'] === '' ||
|
||||
preg_match('/^https?$/i', $parsed['scheme']))
|
||||
{
|
||||
if (method_exists($link, 'getLineNo') &&
|
||||
$this->base_location < $link->getLineNo())
|
||||
{
|
||||
$href =
|
||||
$this->registry->call('Misc', 'absolutize_url',
|
||||
array(trim($link->getAttribute('href')),
|
||||
$this->base));
|
||||
}
|
||||
else
|
||||
{
|
||||
$href =
|
||||
$this->registry->call('Misc', 'absolutize_url',
|
||||
array(trim($link->getAttribute('href')),
|
||||
$this->http_base));
|
||||
}
|
||||
if ($href === false)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
$rel_values = explode(' ', strtolower($link->getAttribute('rel')));
|
||||
if (in_array($rel, $rel_values))
|
||||
{
|
||||
return $href;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function extension(&$array)
|
||||
{
|
||||
foreach ($array as $key => $value)
|
||||
@ -327,10 +380,10 @@ class SimplePie_Locator
|
||||
$headers = array(
|
||||
'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
|
||||
);
|
||||
$feed = $this->registry->create('File', array($value, $this->timeout, 5, $headers, $this->useragent));
|
||||
$feed = $this->registry->create('File', array($value, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options));
|
||||
if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
|
||||
{
|
||||
return $feed;
|
||||
return array($feed);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -349,16 +402,16 @@ class SimplePie_Locator
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (preg_match('/(rss|rdf|atom|xml)/i', $value))
|
||||
if (preg_match('/(feed|rss|rdf|atom|xml)/i', $value))
|
||||
{
|
||||
$this->checked_feeds++;
|
||||
$headers = array(
|
||||
'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
|
||||
);
|
||||
$feed = $this->registry->create('File', array($value, $this->timeout, 5, null, $this->useragent));
|
||||
$feed = $this->registry->create('File', array($value, $this->timeout, 5, null, $this->useragent, $this->force_fsockopen, $this->curl_options));
|
||||
if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
|
||||
{
|
||||
return $feed;
|
||||
return array($feed);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -369,4 +422,3 @@ class SimplePie_Locator
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -138,7 +137,7 @@ class SimplePie_Misc
|
||||
foreach ($element['attribs'] as $key => $value)
|
||||
{
|
||||
$key = strtolower($key);
|
||||
$full .= " $key=\"" . htmlspecialchars($value['data']) . '"';
|
||||
$full .= " $key=\"" . htmlspecialchars($value['data'], ENT_COMPAT, 'UTF-8') . '"';
|
||||
}
|
||||
if ($element['self_closing'])
|
||||
{
|
||||
@ -218,10 +217,25 @@ class SimplePie_Misc
|
||||
{
|
||||
return substr_replace($url, 'itpc', 0, 4);
|
||||
}
|
||||
else
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
public static function array_merge_recursive($array1, $array2)
|
||||
{
|
||||
foreach ($array2 as $key => $value)
|
||||
{
|
||||
return $url;
|
||||
if (is_array($value))
|
||||
{
|
||||
$array1[$key] = SimplePie_Misc::array_merge_recursive($array1[$key], $value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$array1[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $array1;
|
||||
}
|
||||
|
||||
public static function parse_url($url)
|
||||
@ -260,10 +274,8 @@ class SimplePie_Misc
|
||||
{
|
||||
return chr($integer);
|
||||
}
|
||||
else
|
||||
{
|
||||
return strtoupper($match[0]);
|
||||
}
|
||||
|
||||
return strtoupper($match[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -317,16 +329,19 @@ class SimplePie_Misc
|
||||
{
|
||||
return $return;
|
||||
}
|
||||
// This is last, as behaviour of this varies with OS userland and PHP version
|
||||
// This is third, as behaviour of this varies with OS userland and PHP version
|
||||
elseif (function_exists('iconv') && ($return = SimplePie_Misc::change_encoding_iconv($data, $input, $output)))
|
||||
{
|
||||
return $return;
|
||||
}
|
||||
// If we can't do anything, just fail
|
||||
else
|
||||
// This is last, as behaviour of this varies with OS userland and PHP version
|
||||
elseif (class_exists('\UConverter') && ($return = SimplePie_Misc::change_encoding_uconverter($data, $input, $output)))
|
||||
{
|
||||
return false;
|
||||
return $return;
|
||||
}
|
||||
|
||||
// If we can't do anything, just fail
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static function change_encoding_mbstring($data, $input, $output)
|
||||
@ -372,6 +387,17 @@ class SimplePie_Misc
|
||||
return @iconv($input, $output, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
* @param string $input
|
||||
* @param string $output
|
||||
* @return string|false
|
||||
*/
|
||||
protected static function change_encoding_uconverter($data, $input, $output)
|
||||
{
|
||||
return @\UConverter::transcode($data, $output, $input);
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize an encoding name
|
||||
*
|
||||
@ -1826,10 +1852,8 @@ class SimplePie_Misc
|
||||
{
|
||||
return trim($mime);
|
||||
}
|
||||
else
|
||||
{
|
||||
return trim(substr($mime, 0, $pos));
|
||||
}
|
||||
|
||||
return trim(substr($mime, 0, $pos));
|
||||
}
|
||||
|
||||
public static function atom_03_construct_type($attribs)
|
||||
@ -1862,10 +1886,8 @@ class SimplePie_Misc
|
||||
return SIMPLEPIE_CONSTRUCT_NONE | $mode;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
|
||||
}
|
||||
|
||||
return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
|
||||
}
|
||||
|
||||
public static function atom_10_construct_type($attribs)
|
||||
@ -1915,10 +1937,8 @@ class SimplePie_Misc
|
||||
return SIMPLEPIE_CONSTRUCT_BASE64;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return SIMPLEPIE_CONSTRUCT_TEXT;
|
||||
}
|
||||
|
||||
return SIMPLEPIE_CONSTRUCT_TEXT;
|
||||
}
|
||||
|
||||
public static function is_isegment_nz_nc($string)
|
||||
@ -1926,7 +1946,7 @@ class SimplePie_Misc
|
||||
return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string);
|
||||
}
|
||||
|
||||
public static function space_seperated_tokens($string)
|
||||
public static function space_separated_tokens($string)
|
||||
{
|
||||
$space_characters = "\x20\x09\x0A\x0B\x0C\x0D";
|
||||
$string_length = strlen($string);
|
||||
@ -1975,11 +1995,9 @@ class SimplePie_Misc
|
||||
{
|
||||
return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
|
||||
}
|
||||
else
|
||||
{
|
||||
// U+FFFD REPLACEMENT CHARACTER
|
||||
return "\xEF\xBF\xBD";
|
||||
}
|
||||
|
||||
// U+FFFD REPLACEMENT CHARACTER
|
||||
return "\xEF\xBF\xBD";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2183,10 +2201,8 @@ function embed_wmedia(width, height, link) {
|
||||
{
|
||||
return filemtime(dirname(__FILE__) . '/Core.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
return filemtime(__FILE__);
|
||||
}
|
||||
|
||||
return filemtime(__FILE__);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2244,4 +2260,3 @@ function embed_wmedia(width, height, link) {
|
||||
// No-op
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -54,7 +53,7 @@
|
||||
* @author Alexander Merz <alexander.merz@web.de>
|
||||
* @author elfrink at introweb dot nl
|
||||
* @author Josh Peck <jmp at joshpeck dot org>
|
||||
* @author Geoffrey Sneddon <geoffers@gmail.com>
|
||||
* @author Sam Sneddon <geoffers@gmail.com>
|
||||
*/
|
||||
class SimplePie_Net_IPv6
|
||||
{
|
||||
@ -174,10 +173,8 @@ class SimplePie_Net_IPv6
|
||||
{
|
||||
return implode(':', $ip_parts);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $ip_parts[0];
|
||||
}
|
||||
|
||||
return $ip_parts[0];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -201,10 +198,8 @@ class SimplePie_Net_IPv6
|
||||
$ipv4_part = substr($ip, $pos + 1);
|
||||
return array($ipv6_part, $ipv4_part);
|
||||
}
|
||||
else
|
||||
{
|
||||
return array($ip, '');
|
||||
}
|
||||
|
||||
return array($ip, '');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -254,10 +249,8 @@ class SimplePie_Net_IPv6
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -99,12 +98,20 @@ class SimplePie_Parse_Date
|
||||
'dimanche' => 7,
|
||||
// German
|
||||
'montag' => 1,
|
||||
'mo' => 1,
|
||||
'dienstag' => 2,
|
||||
'di' => 2,
|
||||
'mittwoch' => 3,
|
||||
'mi' => 3,
|
||||
'donnerstag' => 4,
|
||||
'do' => 4,
|
||||
'freitag' => 5,
|
||||
'fr' => 5,
|
||||
'samstag' => 6,
|
||||
'sa' => 6,
|
||||
'sonnabend' => 6,
|
||||
// AFAIK no short form for sonnabend
|
||||
'so' => 7,
|
||||
'sonntag' => 7,
|
||||
// Italian
|
||||
'lunedì' => 1,
|
||||
@ -146,6 +153,14 @@ class SimplePie_Parse_Date
|
||||
'Παρ' => 5,
|
||||
'Σαβ' => 6,
|
||||
'Κυρ' => 7,
|
||||
// Russian
|
||||
'Пн.' => 1,
|
||||
'Вт.' => 2,
|
||||
'Ср.' => 3,
|
||||
'Чт.' => 4,
|
||||
'Пт.' => 5,
|
||||
'Сб.' => 6,
|
||||
'Вс.' => 7,
|
||||
);
|
||||
|
||||
/**
|
||||
@ -173,7 +188,7 @@ class SimplePie_Parse_Date
|
||||
'aug' => 8,
|
||||
'august' => 8,
|
||||
'sep' => 9,
|
||||
'september' => 8,
|
||||
'september' => 9,
|
||||
'oct' => 10,
|
||||
'october' => 10,
|
||||
'nov' => 11,
|
||||
@ -208,17 +223,28 @@ class SimplePie_Parse_Date
|
||||
'décembre' => 12,
|
||||
// German
|
||||
'januar' => 1,
|
||||
'jan' => 1,
|
||||
'februar' => 2,
|
||||
'feb' => 2,
|
||||
'märz' => 3,
|
||||
'mär' => 3,
|
||||
'april' => 4,
|
||||
'mai' => 5,
|
||||
'apr' => 4,
|
||||
'mai' => 5, // no short form for may
|
||||
'juni' => 6,
|
||||
'jun' => 6,
|
||||
'juli' => 7,
|
||||
'jul' => 7,
|
||||
'august' => 8,
|
||||
'aug' => 8,
|
||||
'september' => 9,
|
||||
'sep' => 9,
|
||||
'oktober' => 10,
|
||||
'okt' => 10,
|
||||
'november' => 11,
|
||||
'nov' => 11,
|
||||
'dezember' => 12,
|
||||
'dez' => 12,
|
||||
// Italian
|
||||
'gennaio' => 1,
|
||||
'febbraio' => 2,
|
||||
@ -290,7 +316,33 @@ class SimplePie_Parse_Date
|
||||
'Σεπ' => 9,
|
||||
'Οκτ' => 10,
|
||||
'Νοέ' => 11,
|
||||
'Δεκ' => 12,
|
||||
'Δεκ' => 12,
|
||||
// Russian
|
||||
'Янв' => 1,
|
||||
'января' => 1,
|
||||
'Фев' => 2,
|
||||
'февраля' => 2,
|
||||
'Мар' => 3,
|
||||
'марта' => 3,
|
||||
'Апр' => 4,
|
||||
'апреля' => 4,
|
||||
'Май' => 5,
|
||||
'мая' => 5,
|
||||
'Июн' => 6,
|
||||
'июня' => 6,
|
||||
'Июл' => 7,
|
||||
'июля' => 7,
|
||||
'Авг' => 8,
|
||||
'августа' => 8,
|
||||
'Сен' => 9,
|
||||
'сентября' => 9,
|
||||
'Окт' => 10,
|
||||
'октября' => 10,
|
||||
'Ноя' => 11,
|
||||
'ноября' => 11,
|
||||
'Дек' => 12,
|
||||
'декабря' => 12,
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
@ -614,7 +666,7 @@ class SimplePie_Parse_Date
|
||||
*
|
||||
* @final
|
||||
* @access public
|
||||
* @param callable $callback
|
||||
* @param callback $callback
|
||||
*/
|
||||
public function add_callback($callback)
|
||||
{
|
||||
@ -631,7 +683,7 @@ class SimplePie_Parse_Date
|
||||
/**
|
||||
* Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as
|
||||
* well as allowing any of upper or lower case "T", horizontal tabs, or
|
||||
* spaces to be used as the time seperator (including more than one))
|
||||
* spaces to be used as the time separator (including more than one))
|
||||
*
|
||||
* @access protected
|
||||
* @return int Timestamp
|
||||
@ -691,14 +743,12 @@ class SimplePie_Parse_Date
|
||||
}
|
||||
|
||||
// Convert the number of seconds to an integer, taking decimals into account
|
||||
$second = round($match[6] + $match[7] / pow(10, strlen($match[7])));
|
||||
$second = round((int)$match[6] + (int)$match[7] / (10 ** strlen($match[7])));
|
||||
|
||||
return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -721,7 +771,7 @@ class SimplePie_Parse_Date
|
||||
{
|
||||
$output .= substr($string, $position, $pos - $position);
|
||||
$position = $pos + 1;
|
||||
if ($string[$pos - 1] !== '\\')
|
||||
if ($pos === 0 || $string[$pos - 1] !== '\\')
|
||||
{
|
||||
$depth++;
|
||||
while ($depth && $position < $length)
|
||||
@ -849,10 +899,8 @@ class SimplePie_Parse_Date
|
||||
|
||||
return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -914,10 +962,8 @@ class SimplePie_Parse_Date
|
||||
|
||||
return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -956,10 +1002,8 @@ class SimplePie_Parse_Date
|
||||
$month = $this->month[strtolower($match[2])];
|
||||
return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -975,10 +1019,7 @@ class SimplePie_Parse_Date
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $strtotime;
|
||||
}
|
||||
|
||||
return $strtotime;
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -104,10 +103,8 @@ class SimplePie_Rating
|
||||
{
|
||||
return $this->scheme;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,9 +118,7 @@ class SimplePie_Rating
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -113,7 +112,7 @@ class SimplePie_Registry
|
||||
*/
|
||||
public function register($type, $class, $legacy = false)
|
||||
{
|
||||
if (!is_subclass_of($class, $this->default[$type]))
|
||||
if (!@is_subclass_of($class, $this->default[$type]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -222,4 +221,4 @@ class SimplePie_Registry
|
||||
$result = call_user_func_array(array($class, $method), $parameters);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -113,10 +112,8 @@ class SimplePie_Restriction
|
||||
{
|
||||
return $this->relationship;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -130,10 +127,8 @@ class SimplePie_Restriction
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,9 +142,7 @@ class SimplePie_Restriction
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -61,7 +60,8 @@ class SimplePie_Sanitize
|
||||
var $image_handler = '';
|
||||
var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
|
||||
var $encode_instead_of_strip = false;
|
||||
var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
|
||||
var $strip_attributes = array('bgsound', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc');
|
||||
var $add_attributes = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none'));
|
||||
var $strip_comments = false;
|
||||
var $output_encoding = 'UTF-8';
|
||||
var $enable_cache = true;
|
||||
@ -160,7 +160,7 @@ class SimplePie_Sanitize
|
||||
$this->encode_instead_of_strip = (bool) $encode;
|
||||
}
|
||||
|
||||
public function strip_attributes($attribs = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'))
|
||||
public function strip_attributes($attribs = array('bgsound', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'))
|
||||
{
|
||||
if ($attribs)
|
||||
{
|
||||
@ -179,6 +179,25 @@ class SimplePie_Sanitize
|
||||
}
|
||||
}
|
||||
|
||||
public function add_attributes($attribs = array('audio' => array('preload' => 'none'), 'iframe' => array('sandbox' => 'allow-scripts allow-same-origin'), 'video' => array('preload' => 'none')))
|
||||
{
|
||||
if ($attribs)
|
||||
{
|
||||
if (is_array($attribs))
|
||||
{
|
||||
$this->add_attributes = $attribs;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->add_attributes = explode(',', $attribs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->add_attributes = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function strip_comments($strip = false)
|
||||
{
|
||||
$this->strip_comments = (bool) $strip;
|
||||
@ -249,21 +268,22 @@ class SimplePie_Sanitize
|
||||
|
||||
if (!class_exists('DOMDocument'))
|
||||
{
|
||||
$this->registry->call('Misc', 'error', array('DOMDocument not found, unable to use sanitizer', E_USER_WARNING, __FILE__, __LINE__));
|
||||
return '';
|
||||
throw new SimplePie_Exception('DOMDocument not found, unable to use sanitizer');
|
||||
}
|
||||
$document = new DOMDocument();
|
||||
$document->encoding = 'UTF-8';
|
||||
|
||||
$data = $this->preprocess($data, $type);
|
||||
|
||||
set_error_handler(array('SimplePie_Misc', 'silence_errors'));
|
||||
$document->loadHTML($data);
|
||||
restore_error_handler();
|
||||
|
||||
$xpath = new DOMXPath($document);
|
||||
|
||||
// Strip comments
|
||||
if ($this->strip_comments)
|
||||
{
|
||||
$xpath = new DOMXPath($document);
|
||||
$comments = $xpath->query('//comment()');
|
||||
|
||||
foreach ($comments as $comment)
|
||||
@ -279,7 +299,7 @@ class SimplePie_Sanitize
|
||||
{
|
||||
foreach ($this->strip_htmltags as $tag)
|
||||
{
|
||||
$this->strip_tag($tag, $document, $type);
|
||||
$this->strip_tag($tag, $document, $xpath, $type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -287,7 +307,15 @@ class SimplePie_Sanitize
|
||||
{
|
||||
foreach ($this->strip_attributes as $attrib)
|
||||
{
|
||||
$this->strip_attr($attrib, $document);
|
||||
$this->strip_attr($attrib, $xpath);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->add_attributes)
|
||||
{
|
||||
foreach ($this->add_attributes as $tag => $valuePairs)
|
||||
{
|
||||
$this->add_attr($tag, $valuePairs, $document);
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,7 +354,7 @@ class SimplePie_Sanitize
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
trigger_error("$this->cache_location is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -334,19 +362,10 @@ class SimplePie_Sanitize
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the DOCTYPE
|
||||
// Seems to cause segfaulting if we don't do this
|
||||
if ($document->firstChild instanceof DOMDocumentType)
|
||||
{
|
||||
$document->removeChild($document->firstChild);
|
||||
}
|
||||
|
||||
// Move everything from the body to the root
|
||||
$real_body = $document->getElementsByTagName('body')->item(0)->childNodes->item(0);
|
||||
$document->replaceChild($real_body, $document->firstChild);
|
||||
|
||||
// Get content node
|
||||
$div = $document->getElementsByTagName('body')->item(0)->firstChild;
|
||||
// Finally, convert to a HTML string
|
||||
$data = trim($document->saveHTML());
|
||||
$data = trim($document->saveHTML($div));
|
||||
|
||||
if ($this->remove_div)
|
||||
{
|
||||
@ -384,6 +403,7 @@ class SimplePie_Sanitize
|
||||
protected function preprocess($html, $type)
|
||||
{
|
||||
$ret = '';
|
||||
$html = preg_replace('%</?(?:html|body)[^>]*?'.'>%is', '', $html);
|
||||
if ($type & ~SIMPLEPIE_CONSTRUCT_XHTML)
|
||||
{
|
||||
// Atom XHTML constructs are wrapped with a div by default
|
||||
@ -456,9 +476,8 @@ class SimplePie_Sanitize
|
||||
}
|
||||
}
|
||||
|
||||
protected function strip_tag($tag, $document, $type)
|
||||
protected function strip_tag($tag, $document, $xpath, $type)
|
||||
{
|
||||
$xpath = new DOMXPath($document);
|
||||
$elements = $xpath->query('body//' . $tag);
|
||||
if ($this->encode_instead_of_strip)
|
||||
{
|
||||
@ -541,9 +560,8 @@ class SimplePie_Sanitize
|
||||
}
|
||||
}
|
||||
|
||||
protected function strip_attr($attrib, $document)
|
||||
protected function strip_attr($attrib, $xpath)
|
||||
{
|
||||
$xpath = new DOMXPath($document);
|
||||
$elements = $xpath->query('//*[@' . $attrib . ']');
|
||||
|
||||
foreach ($elements as $element)
|
||||
@ -551,4 +569,16 @@ class SimplePie_Sanitize
|
||||
$element->removeAttribute($attrib);
|
||||
}
|
||||
}
|
||||
|
||||
protected function add_attr($tag, $valuePairs, $document)
|
||||
{
|
||||
$elements = $document->getElementsByTagName($tag);
|
||||
foreach ($elements as $element)
|
||||
{
|
||||
foreach ($valuePairs as $attrib => $value)
|
||||
{
|
||||
$element->setAttribute($attrib, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -80,10 +79,8 @@ class SimplePie_Source
|
||||
{
|
||||
return $this->data['child'][$namespace][$tag];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_base($element = array())
|
||||
@ -131,10 +128,8 @@ class SimplePie_Source
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_category($key = 0)
|
||||
@ -144,10 +139,8 @@ class SimplePie_Source
|
||||
{
|
||||
return $categories[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_categories()
|
||||
@ -201,10 +194,8 @@ class SimplePie_Source
|
||||
{
|
||||
return array_unique($categories);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_author($key = 0)
|
||||
@ -214,10 +205,8 @@ class SimplePie_Source
|
||||
{
|
||||
return $authors[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_authors()
|
||||
@ -284,10 +273,8 @@ class SimplePie_Source
|
||||
{
|
||||
return array_unique($authors);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_contributor($key = 0)
|
||||
@ -297,10 +284,8 @@ class SimplePie_Source
|
||||
{
|
||||
return $contributors[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_contributors()
|
||||
@ -355,10 +340,8 @@ class SimplePie_Source
|
||||
{
|
||||
return array_unique($contributors);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_link($key = 0, $rel = 'alternate')
|
||||
@ -368,10 +351,8 @@ class SimplePie_Source
|
||||
{
|
||||
return $links[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -450,10 +431,8 @@ class SimplePie_Source
|
||||
{
|
||||
return $this->data['links'][$rel];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_description()
|
||||
@ -494,10 +473,8 @@ class SimplePie_Source
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_copyright()
|
||||
@ -522,10 +499,8 @@ class SimplePie_Source
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_language()
|
||||
@ -546,10 +521,8 @@ class SimplePie_Source
|
||||
{
|
||||
return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_latitude()
|
||||
@ -562,10 +535,8 @@ class SimplePie_Source
|
||||
{
|
||||
return (float) $match[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_longitude()
|
||||
@ -582,10 +553,8 @@ class SimplePie_Source
|
||||
{
|
||||
return (float) $match[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_image_url()
|
||||
@ -602,10 +571,7 @@ class SimplePie_Source
|
||||
{
|
||||
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -137,13 +136,11 @@ class SimplePie_XML_Declaration_Parser
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->version = '';
|
||||
$this->encoding = '';
|
||||
$this->standalone = '';
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->version = '';
|
||||
$this->encoding = '';
|
||||
$this->standalone = '';
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,7 +5,7 @@
|
||||
* A PHP-Based RSS and Atom Feed Framework.
|
||||
* Takes the hard work out of managing a complete RSS/Atom solution.
|
||||
*
|
||||
* Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
|
||||
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
@ -33,10 +33,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package SimplePie
|
||||
* @version 1.3.1
|
||||
* @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
|
||||
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
|
||||
* @author Ryan Parman
|
||||
* @author Geoffrey Sneddon
|
||||
* @author Sam Sneddon
|
||||
* @author Ryan McCue
|
||||
* @link http://simplepie.org/ SimplePie
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
||||
@ -339,10 +338,8 @@ class SimplePie_gzdecode
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->position = $this->compressed_size - 8;
|
||||
}
|
||||
|
||||
$this->position = $this->compressed_size - 8;
|
||||
|
||||
// Check CRC of data
|
||||
$crc = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
|
||||
@ -363,9 +360,7 @@ class SimplePie_gzdecode
|
||||
// Wow, against all odds, we've actually got a valid gzip string
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-47730';
|
||||
$wp_version = '5.5-alpha-47733';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user