aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2015-07-12 00:35:31 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2015-07-12 00:35:31 +0200
commitcb114a341b904799b73e8e7ff1ebeab39d3c21ab (patch)
treecd5a15fda67edfe8985dbdde5568a0ecfc9afa1a /lib
parent1f07bd2cdd4361a36359ae73bdcf0b5ecbea8f0a (diff)
Merge some pull requests from upstream
silent Warning cast with PHP 5.3.3 (RHEL-6) https://github.com/simplepie/simplepie/pull/258 Use rss:pubDate over atom:updated when determining the posting date https://github.com/simplepie/simplepie/pull/288 Update Item.php: add support for media thumbnails https://github.com/simplepie/simplepie/pull/340 Remove PHP Notices https://github.com/simplepie/simplepie/pull/353 And removed "FreshRSS" annotations for pull requests submitted upstream Fixed a typo in Date.php (wrong number for September) https://github.com/simplepie/simplepie/pull/374 Remove duplicate case https://github.com/simplepie/simplepie/pull/406 Added set_curl_options method to allow custom options https://github.com/simplepie/simplepie/pull/407 Improved error message https://github.com/simplepie/simplepie/pull/412
Diffstat (limited to 'lib')
-rw-r--r--lib/SimplePie/SimplePie.php149
-rw-r--r--lib/SimplePie/SimplePie/Cache/File.php12
-rw-r--r--lib/SimplePie/SimplePie/Decode/HTML/Entities.php1
-rw-r--r--lib/SimplePie/SimplePie/File.php10
-rw-r--r--lib/SimplePie/SimplePie/Item.php42
-rw-r--r--lib/SimplePie/SimplePie/Locator.php2
-rw-r--r--lib/SimplePie/SimplePie/Misc.php8
-rw-r--r--lib/SimplePie/SimplePie/Parse/Date.php6
-rwxr-xr-xlib/SimplePie/SimplePie/Registry.php4
-rw-r--r--lib/SimplePie/SimplePie/Sanitize.php4
10 files changed, 133 insertions, 105 deletions
diff --git a/lib/SimplePie/SimplePie.php b/lib/SimplePie/SimplePie.php
index 54f4c5770..6c0962a9f 100644
--- a/lib/SimplePie/SimplePie.php
+++ b/lib/SimplePie/SimplePie.php
@@ -456,7 +456,7 @@ class SimplePie
* @see SimplePie::subscribe_url()
* @access private
*/
- public $permanent_url = null; //FreshRSS
+ public $permanent_url = null;
/**
* @var object Instance of SimplePie_File to use as a feed
@@ -480,6 +480,13 @@ class SimplePie
public $timeout = 10;
/**
+ * @var array Custom curl options
+ * @see SimplePie::set_curl_options()
+ * @access private
+ */
+ public $curl_options = array();
+
+ /**
* @var bool Forces fsockopen() to be used for remote files instead
* of cURL, even if a new enough version is installed
* @see SimplePie::force_fsockopen()
@@ -754,7 +761,7 @@ class SimplePie
else
{
$this->feed_url = $this->registry->call('Misc', 'fix_protocol', array($url, 1));
- $this->permanent_url = $this->feed_url; //FreshRSS
+ $this->permanent_url = $this->feed_url;
}
}
@@ -769,7 +776,7 @@ class SimplePie
if ($file instanceof SimplePie_File)
{
$this->feed_url = $file->url;
- $this->permanent_url = $this->feed_url; //FreshRSS
+ $this->permanent_url = $this->feed_url;
$this->file =& $file;
return true;
}
@@ -807,6 +814,19 @@ class SimplePie
{
$this->timeout = (int) $timeout;
}
+
+ /**
+ * Set custom curl options
+ *
+ * This allows you to change default curl options
+ *
+ * @since 1.0 Beta 3
+ * @param array $curl_options Curl options to add to default settings
+ */
+ public function set_curl_options(array $curl_options = array())
+ {
+ $this->curl_options = $curl_options;
+ }
/**
* Force SimplePie to use fsockopen() instead of cURL
@@ -1251,7 +1271,7 @@ class SimplePie
$this->enable_exceptions = $enable;
}
- function cleanMd5($rss) //FreshRSS
+ function cleanMd5($rss)
{
return md5(preg_replace(array('#<(lastBuildDate|pubDate|updated|feedDate|dc:date|slash:comments)>[^<]+</\\1>#', '#<!--.+?-->#s'), '', $rss));
}
@@ -1297,7 +1317,7 @@ class SimplePie
// Pass whatever was set with config options over to the sanitizer.
// Pass the classes in for legacy support; new classes should use the registry instead
$this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->registry->get_class('Cache'));
- $this->sanitize->pass_file_data($this->registry->get_class('File'), $this->timeout, $this->useragent, $this->force_fsockopen);
+ $this->sanitize->pass_file_data($this->registry->get_class('File'), $this->timeout, $this->useragent, $this->force_fsockopen, $this->curl_options);
if (!empty($this->multifeed_url))
{
@@ -1342,7 +1362,7 @@ class SimplePie
// Fetch the data via SimplePie_File into $this->raw_data
if (($fetched = $this->fetch_data($cache)) === true)
{
- return $this->data['mtime']; //FreshRSS
+ return $this->data['mtime'];
}
elseif ($fetched === false) {
return false;
@@ -1350,7 +1370,7 @@ class SimplePie
list($headers, $sniffed) = $fetched;
- if (isset($this->data['md5'])) //FreshRSS
+ if (isset($this->data['md5']))
{
$md5 = $this->data['md5'];
}
@@ -1435,8 +1455,8 @@ class SimplePie
$this->data['headers'] = $headers;
}
$this->data['build'] = SIMPLEPIE_BUILD;
- $this->data['mtime'] = time(); //FreshRSS
- $this->data['md5'] = empty($md5) ? $this->cleanMd5($this->raw_data) : $md5; //FreshRSS
+ $this->data['mtime'] = time();
+ $this->data['md5'] = empty($md5) ? $this->cleanMd5($this->raw_data) : $md5;
// Cache the file if caching is enabled
if ($cache && !$cache->save($this))
@@ -1451,7 +1471,7 @@ class SimplePie
if (isset($parser))
{
// We have an error, just set SimplePie_Misc::error to it and quit
- $this->error = sprintf('This XML document is invalid, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
+ $this->error = sprintf('This XML document is invalid, likely due to invalid characters. XML error: %s at line %d, column %d, encoding %s, URL: %s', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column(), $encoding, $this->feed_url);
}
else
{
@@ -1477,7 +1497,7 @@ class SimplePie
{
// Load the Cache
$this->data = $cache->load();
- if ($cache->mtime() + $this->cache_duration > time()) //FreshRSS
+ if ($cache->mtime() + $this->cache_duration > time())
{
$this->raw_data = false;
return true; // If the cache is still valid, just return true
@@ -1514,71 +1534,58 @@ class SimplePie
}
}
// Check if the cache has been updated
- else //if ($cache->mtime() + $this->cache_duration < time()) //FreshRSS removed
+ else
{
- // If we have last-modified and/or etag set
- //if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) //FreshRSS removed
+ $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',
+ );
+ if (isset($this->data['headers']['last-modified']))
{
- $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',
- );
- if (isset($this->data['headers']['last-modified']))
- {
- $headers['if-modified-since'] = $this->data['headers']['last-modified'];
- }
- if (isset($this->data['headers']['etag']))
- {
- $headers['if-none-match'] = $this->data['headers']['etag'];
- }
+ $headers['if-modified-since'] = $this->data['headers']['last-modified'];
+ }
+ if (isset($this->data['headers']['etag']))
+ {
+ $headers['if-none-match'] = $this->data['headers']['etag'];
+ }
- $file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen)); //FreshRSS
+ $file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options));
- if ($file->success)
+ if ($file->success)
+ {
+ if ($file->status_code === 304)
{
- if ($file->status_code === 304)
- {
- $cache->touch();
- return true;
- }
+ $cache->touch();
+ return true;
}
- else
+ }
+ else
+ {
+ $cache->touch();
+ $this->error = $file->error;
+ return !empty($this->data);
+ }
+
+ $md5 = $this->cleanMd5($file->body);
+ if ($this->data['md5'] === $md5) {
+ if ($this->syslog_enabled)
{
- $cache->touch(); //FreshRSS
- $this->error = $file->error; //FreshRSS
- return !empty($this->data); //FreshRSS
- //unset($file); //FreshRSS removed
+ syslog(LOG_DEBUG, 'SimplePie MD5 cache match for ' . SimplePie_Misc::url_remove_credentials($this->feed_url));
}
- }
- { //FreshRSS
- $md5 = $this->cleanMd5($file->body);
- if ($this->data['md5'] === $md5) {
- if ($this->syslog_enabled)
- {
- syslog(LOG_DEBUG, 'SimplePie MD5 cache match for ' . SimplePie_Misc::url_remove_credentials($this->feed_url));
- }
- $cache->touch();
- return true; //Content unchanged even though server did not send a 304
- } else {
- if ($this->syslog_enabled)
- {
- syslog(LOG_DEBUG, 'SimplePie MD5 cache no match for ' . SimplePie_Misc::url_remove_credentials($this->feed_url));
- }
- $this->data['md5'] = $md5;
+ $cache->touch();
+ return true; //Content unchanged even though server did not send a 304
+ } else {
+ if ($this->syslog_enabled)
+ {
+ syslog(LOG_DEBUG, 'SimplePie MD5 cache no match for ' . SimplePie_Misc::url_remove_credentials($this->feed_url));
}
+ $this->data['md5'] = $md5;
}
}
- //// If the cache is still valid, just return true
- //else //FreshRSS removed
- //{
- // $this->raw_data = false;
- // return true;
- //}
- }
- // If the cache is empty, delete it
+ }
+ // If the cache is empty
else
{
- //$cache->unlink(); //FreshRSS removed
- $cache->touch(); //FreshRSS
+ $cache->touch(); //To keep the date/time of the last tentative update
$this->data = array();
}
}
@@ -1594,7 +1601,7 @@ class SimplePie
$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',
);
- $file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen));
+ $file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options));
}
}
// If the file connection has an error, set SimplePie::error to that and quit
@@ -1611,15 +1618,15 @@ class SimplePie
if (!$locate->is_feed($file))
{
- $copyStatusCode = $file->status_code; //FreshRSS
- $copyContentType = $file->headers['content-type']; //FreshRSS
+ $copyStatusCode = $file->status_code;
+ $copyContentType = $file->headers['content-type'];
// We need to unset this so that if SimplePie::set_file() has been called that object is untouched
unset($file);
try
{
if (!($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds)))
{
- $this->error = "A feed could not be found at `$this->feed_url`; the status code is `$copyStatusCode` and content-type is `$copyContentType`"; //FreshRSS
+ $this->error = "A feed could not be found at `$this->feed_url`; the status code is `$copyStatusCode` and content-type is `$copyContentType`";
$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
return false;
}
@@ -1634,8 +1641,8 @@ class SimplePie
if ($cache)
{
$this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD);
- $this->data['mtime'] = time(); //FreshRSS
- $this->data['md5'] = empty($md5) ? $this->cleanMd5($file->body) : $md5; //FreshRSS
+ $this->data['mtime'] = time();
+ $this->data['md5'] = empty($md5) ? $this->cleanMd5($file->body) : $md5;
if (!$cache->save($this))
{
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);
@@ -1648,7 +1655,7 @@ class SimplePie
}
$this->raw_data = $file->body;
- $this->permanent_url = $file->permanent_url; //FreshRSS
+ $this->permanent_url = $file->permanent_url;
$headers = $file->headers;
$sniffer = $this->registry->create('Content_Type_Sniffer', array(&$file));
$sniffed = $sniffer->get_type();
@@ -1852,7 +1859,7 @@ class SimplePie
*/
public function subscribe_url($permanent = false)
{
- if ($permanent) //FreshRSS
+ if ($permanent)
{
if ($this->permanent_url !== null)
{
diff --git a/lib/SimplePie/SimplePie/Cache/File.php b/lib/SimplePie/SimplePie/Cache/File.php
index cb4b528c4..72e75a4b6 100644
--- a/lib/SimplePie/SimplePie/Cache/File.php
+++ b/lib/SimplePie/SimplePie/Cache/File.php
@@ -136,11 +136,7 @@ class SimplePie_Cache_File implements SimplePie_Cache_Base
*/
public function mtime()
{
- //if (file_exists($this->name)) //FreshRSS removed
- {
- return @filemtime($this->name); //FreshRSS
- }
- //return false; //FreshRSS removed
+ return @filemtime($this->name);
}
/**
@@ -150,11 +146,7 @@ class SimplePie_Cache_File implements SimplePie_Cache_Base
*/
public function touch()
{
- //if (file_exists($this->name)) //FreshRSS removed
- {
- return @touch($this->name); //FreshRSS
- }
- //return false; //FreshRSS removed
+ return @touch($this->name);
}
/**
diff --git a/lib/SimplePie/SimplePie/Decode/HTML/Entities.php b/lib/SimplePie/SimplePie/Decode/HTML/Entities.php
index cde06c884..46b3a1dff 100644
--- a/lib/SimplePie/SimplePie/Decode/HTML/Entities.php
+++ b/lib/SimplePie/SimplePie/Decode/HTML/Entities.php
@@ -169,7 +169,6 @@ class SimplePie_Decode_HTML_Entities
case "\x09":
case "\x0A":
case "\x0B":
- case "\x0B":
case "\x0C":
case "\x20":
case "\x3C":
diff --git a/lib/SimplePie/SimplePie/File.php b/lib/SimplePie/SimplePie/File.php
index 1f9e3d502..643648ddb 100644
--- a/lib/SimplePie/SimplePie/File.php
+++ b/lib/SimplePie/SimplePie/File.php
@@ -66,7 +66,7 @@ class SimplePie_File
var $method = SIMPLEPIE_FILE_SOURCE_NONE;
var $permanent_url; //FreshRSS
- public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false, $syslog_enabled = SIMPLEPIE_SYSLOG)
+ public function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false, $curl_options = array(), $syslog_enabled = SIMPLEPIE_SYSLOG)
{
if (class_exists('idna_convert'))
{
@@ -75,7 +75,7 @@ class SimplePie_File
$url = SimplePie_Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
}
$this->url = $url;
- $this->permanent_url = $url; //FreshRSS
+ $this->permanent_url = $url;
$this->useragent = $useragent;
if (preg_match('/^http(s)?:\/\//i', $url))
{
@@ -119,6 +119,10 @@ class SimplePie_File
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)
@@ -149,7 +153,7 @@ class SimplePie_File
$location = SimplePie_Misc::absolutize_url($this->headers['location'], $url);
$previousStatusCode = $this->status_code;
$this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
- $this->permanent_url = ($previousStatusCode == 301) ? $location : $url; //FreshRSS
+ $this->permanent_url = ($previousStatusCode == 301) ? $location : $url;
return;
}
}
diff --git a/lib/SimplePie/SimplePie/Item.php b/lib/SimplePie/SimplePie/Item.php
index 7bd96c15f..27e93456e 100644
--- a/lib/SimplePie/SimplePie/Item.php
+++ b/lib/SimplePie/SimplePie/Item.php
@@ -406,6 +406,30 @@ class SimplePie_Item
return null;
}
}
+
+ /**
+ * Get the media:thumbnail of the item
+ *
+ * Uses `<media:thumbnail>`
+ *
+ *
+ * @return array|null
+ */
+ public function get_thumbnail()
+ {
+ if (!isset($this->data['thumbnail']))
+ {
+ 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'];
+ }
/**
* Get a category for the item
@@ -738,31 +762,31 @@ class SimplePie_Item
{
$this->data['date']['raw'] = $return[0]['data'];
}
- elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
+ 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_ATOM_03, 'issued'))
+ 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_ATOM_03, 'created'))
+ 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_03, 'modified'))
+ elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
{
$this->data['date']['raw'] = $return[0]['data'];
}
- elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate'))
+ elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued'))
{
$this->data['date']['raw'] = $return[0]['data'];
}
- elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date'))
+ elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created'))
{
$this->data['date']['raw'] = $return[0]['data'];
}
- elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date'))
+ elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified'))
{
$this->data['date']['raw'] = $return[0]['data'];
}
@@ -2733,7 +2757,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))
{
diff --git a/lib/SimplePie/SimplePie/Locator.php b/lib/SimplePie/SimplePie/Locator.php
index 4e5f7c1ca..ba4a843b0 100644
--- a/lib/SimplePie/SimplePie/Locator.php
+++ b/lib/SimplePie/SimplePie/Locator.php
@@ -148,7 +148,7 @@ class SimplePie_Locator
{
$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', 'application/x-rss+xml'))) //FreshRSS
+ if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml', 'application/x-rss+xml')))
{
return true;
}
diff --git a/lib/SimplePie/SimplePie/Misc.php b/lib/SimplePie/SimplePie/Misc.php
index 956a284cb..9e7ac4fa8 100644
--- a/lib/SimplePie/SimplePie/Misc.php
+++ b/lib/SimplePie/SimplePie/Misc.php
@@ -79,8 +79,8 @@ class SimplePie_Misc
public static function absolutize_url($relative, $base)
{
- if (substr($relative, 0, 2) === '//') //FreshRSS: disable absolutize_url for "//www.example.net" which will pick HTTP or HTTPS automatically
- {
+ if (substr($relative, 0, 2) === '//')
+ {//Allow protocol-relative URLs "//www.example.net" which will pick HTTP or HTTPS automatically
return $relative;
}
$iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative);
@@ -128,7 +128,7 @@ class SimplePie_Misc
{
$attribs[$j][2] = $attribs[$j][1];
}
- $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j]), 'UTF-8'); //FreshRSS
+ $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j]), 'UTF-8');
}
}
}
@@ -142,7 +142,7 @@ class SimplePie_Misc
foreach ($element['attribs'] as $key => $value)
{
$key = strtolower($key);
- $full .= " $key=\"" . htmlspecialchars($value['data'], ENT_COMPAT, 'UTF-8') . '"'; //FreshRSS
+ $full .= " $key=\"" . htmlspecialchars($value['data'], ENT_COMPAT, 'UTF-8') . '"';
}
if ($element['self_closing'])
{
diff --git a/lib/SimplePie/SimplePie/Parse/Date.php b/lib/SimplePie/SimplePie/Parse/Date.php
index ba7c0703e..50bb5cffa 100644
--- a/lib/SimplePie/SimplePie/Parse/Date.php
+++ b/lib/SimplePie/SimplePie/Parse/Date.php
@@ -173,7 +173,7 @@ class SimplePie_Parse_Date
'aug' => 8,
'august' => 8,
'sep' => 9,
- 'september' => 8,
+ 'september' => 9,
'oct' => 10,
'october' => 10,
'nov' => 11,
@@ -331,8 +331,8 @@ class SimplePie_Parse_Date
'CCT' => 23400,
'CDT' => -18000,
'CEDT' => 7200,
- 'CEST' => 7200, //FreshRSS
'CET' => 3600,
+ 'CEST' => 7200,
'CGST' => -7200,
'CGT' => -10800,
'CHADT' => 49500,
@@ -721,7 +721,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)
diff --git a/lib/SimplePie/SimplePie/Registry.php b/lib/SimplePie/SimplePie/Registry.php
index bd9c1f535..dac55e34e 100755
--- a/lib/SimplePie/SimplePie/Registry.php
+++ b/lib/SimplePie/SimplePie/Registry.php
@@ -113,7 +113,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 +222,4 @@ class SimplePie_Registry
$result = call_user_func_array(array($class, $method), $parameters);
return $result;
}
-} \ No newline at end of file
+}
diff --git a/lib/SimplePie/SimplePie/Sanitize.php b/lib/SimplePie/SimplePie/Sanitize.php
index e7c9f925f..a6863ec03 100644
--- a/lib/SimplePie/SimplePie/Sanitize.php
+++ b/lib/SimplePie/SimplePie/Sanitize.php
@@ -249,7 +249,7 @@ class SimplePie_Sanitize
{
if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML)
{
- $data = htmlspecialchars_decode($data, ENT_QUOTES); //FreshRSS
+ $data = htmlspecialchars_decode($data, ENT_QUOTES);
if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data))
{
$type |= SIMPLEPIE_CONSTRUCT_HTML;
@@ -280,7 +280,7 @@ class SimplePie_Sanitize
$document->loadHTML($data);
restore_error_handler();
- $xpath = new DOMXPath($document); //FreshRSS
+ $xpath = new DOMXPath($document);
// Strip comments
if ($this->strip_comments)