aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/simplepie
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/simplepie')
-rw-r--r--vendor/simplepie/simplepie/.travis.yml21
-rw-r--r--[-rwxr-xr-x]vendor/simplepie/simplepie/library/SimplePie.php58
-rw-r--r--[-rwxr-xr-x]vendor/simplepie/simplepie/library/SimplePie/Cache/Memcached.php0
-rw-r--r--vendor/simplepie/simplepie/library/SimplePie/File.php3
-rw-r--r--vendor/simplepie/simplepie/library/SimplePie/HTTP/Parser.php21
-rw-r--r--vendor/simplepie/simplepie/library/SimplePie/Item.php30
-rw-r--r--vendor/simplepie/simplepie/library/SimplePie/Parser.php63
-rw-r--r--[-rwxr-xr-x]vendor/simplepie/simplepie/library/SimplePie/Registry.php0
8 files changed, 118 insertions, 78 deletions
diff --git a/vendor/simplepie/simplepie/.travis.yml b/vendor/simplepie/simplepie/.travis.yml
new file mode 100644
index 000000000..83d90ad19
--- /dev/null
+++ b/vendor/simplepie/simplepie/.travis.yml
@@ -0,0 +1,21 @@
+sudo: false
+language: php
+matrix:
+ fast_finish: true
+ include:
+ - php: 5.4
+ - php: 5.5
+ - php: 5.6
+ - php: 7.0
+ - php: 7.1
+ - php: hhvm
+ sudo: true
+ dist: trusty
+ group: edge # until the next Travis CI update
+ allow_failures:
+ - php: hhvm
+ - php: 7.0
+ - php: 7.1
+branches:
+ except:
+ - one-dot-two
diff --git a/vendor/simplepie/simplepie/library/SimplePie.php b/vendor/simplepie/simplepie/library/SimplePie.php
index 428bfc068..34b6ca0c9 100755..100644
--- a/vendor/simplepie/simplepie/library/SimplePie.php
+++ b/vendor/simplepie/simplepie/library/SimplePie.php
@@ -33,7 +33,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @package SimplePie
- * @version 1.5
+ * @version 1.5.1
* @copyright 2004-2017 Ryan Parman, Geoffrey Sneddon, Ryan McCue
* @author Ryan Parman
* @author Geoffrey Sneddon
@@ -50,7 +50,7 @@ define('SIMPLEPIE_NAME', 'SimplePie');
/**
* SimplePie Version
*/
-define('SIMPLEPIE_VERSION', '1.5');
+define('SIMPLEPIE_VERSION', '1.5.1');
/**
* SimplePie Build
@@ -810,7 +810,7 @@ class SimplePie
}
/**
- * Set the the default timeout for fetching remote feeds
+ * Set the default timeout for fetching remote feeds
*
* This allows you to change the maximum time the feed's server to respond
* and send the feed back.
@@ -1320,6 +1320,11 @@ class SimplePie
}
}
+ // The default sanitize class gets set in the constructor, check if it has
+ // changed.
+ if ($this->registry->get_class('Sanitize') !== 'SimplePie_Sanitize') {
+ $this->sanitize = $this->registry->create('Sanitize');
+ }
if (method_exists($this->sanitize, 'set_registry'))
{
$this->sanitize->set_registry($this->registry);
@@ -1644,33 +1649,18 @@ class SimplePie
try
{
$microformats = false;
- if (function_exists('Mf2\parse')) {
+ if (class_exists('DOMXpath') && function_exists('Mf2\parse')) {
+ $doc = new DOMDocument();
+ @$doc->loadHTML($file->body);
+ $xpath = new DOMXpath($doc);
// Check for both h-feed and h-entry, as both a feed with no entries
// and a list of entries without an h-feed wrapper are both valid.
- $position = 0;
- while ($position = strpos($file->body, 'h-feed', $position))
- {
- $start = $position < 200 ? 0 : $position - 200;
- $check = substr($file->body, $start, 400);
- if ($microformats = preg_match('/class="[^"]*h-feed/', $check))
- {
- break;
- }
- $position += 7;
- }
- $position = 0;
- while ($position = strpos($file->body, 'h-entry', $position))
- {
- $start = $position < 200 ? 0 : $position - 200;
- $check = substr($file->body, $start, 400);
- if ($microformats = preg_match('/class="[^"]*h-entry/', $check))
- {
- break;
- }
- $position += 7;
- }
+ $query = '//*[contains(concat(" ", @class, " "), " h-feed ") or '.
+ 'contains(concat(" ", @class, " "), " h-entry ")]';
+ $result = $xpath->query($query);
+ $microformats = $result->length !== 0;
}
- // Now also do feed discovery, but if an h-entry was found don't
+ // Now also do feed discovery, but if microformats were found don't
// overwrite the current value of file.
$discovered = $locate->find($this->autodiscovery,
$this->all_discovered_feeds);
@@ -2606,15 +2596,15 @@ class SimplePie
}
}
- if (isset($this->data['links'][$rel]))
+ if (isset($this->data['headers']['link']) &&
+ preg_match('/<([^>]+)>; rel='.preg_quote($rel).'/',
+ $this->data['headers']['link'], $match))
{
- return $this->data['links'][$rel];
+ return array($match[1]);
}
- else if (isset($this->data['headers']['link']) &&
- preg_match('/<([^>]+)>; rel='.preg_quote($rel).'/',
- $this->data['headers']['link'], $match))
+ else if (isset($this->data['links'][$rel]))
{
- return array($match[1]);
+ return $this->data['links'][$rel];
}
else
{
@@ -3155,7 +3145,7 @@ class SimplePie
if (($url = $this->get_link()) !== null)
{
- return 'http://g.etfv.co/' . urlencode($url);
+ return 'https://www.google.com/s2/favicons?domain=' . urlencode($url);
}
return false;
diff --git a/vendor/simplepie/simplepie/library/SimplePie/Cache/Memcached.php b/vendor/simplepie/simplepie/library/SimplePie/Cache/Memcached.php
index 1f73b3890..1f73b3890 100755..100644
--- a/vendor/simplepie/simplepie/library/SimplePie/Cache/Memcached.php
+++ b/vendor/simplepie/simplepie/library/SimplePie/Cache/Memcached.php
diff --git a/vendor/simplepie/simplepie/library/SimplePie/File.php b/vendor/simplepie/simplepie/library/SimplePie/File.php
index e670e05a0..2bb0a3b44 100644
--- a/vendor/simplepie/simplepie/library/SimplePie/File.php
+++ b/vendor/simplepie/simplepie/library/SimplePie/File.php
@@ -136,8 +136,7 @@ class SimplePie_File
$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())
{
diff --git a/vendor/simplepie/simplepie/library/SimplePie/HTTP/Parser.php b/vendor/simplepie/simplepie/library/SimplePie/HTTP/Parser.php
index 63ae1e03d..e982c206f 100644
--- a/vendor/simplepie/simplepie/library/SimplePie/HTTP/Parser.php
+++ b/vendor/simplepie/simplepie/library/SimplePie/HTTP/Parser.php
@@ -496,4 +496,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;
+ }
}
diff --git a/vendor/simplepie/simplepie/library/SimplePie/Item.php b/vendor/simplepie/simplepie/library/SimplePie/Item.php
index 00f4179bf..2083e7a92 100644
--- a/vendor/simplepie/simplepie/library/SimplePie/Item.php
+++ b/vendor/simplepie/simplepie/library/SimplePie/Item.php
@@ -477,15 +477,15 @@ class SimplePie_Item
$label = null;
if (isset($category['attribs']['']['term']))
{
- $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_HTML);
+ $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($category['attribs']['']['scheme']))
{
- $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_HTML);
+ $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($category['attribs']['']['label']))
{
- $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_HTML);
+ $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
}
$categories[] = $this->registry->create('Category', array($term, $scheme, $label, $type));
}
@@ -493,10 +493,10 @@ class SimplePie_Item
{
// 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.
- $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_HTML);
+ $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($category['attribs']['']['domain']))
{
- $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_HTML);
+ $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
}
else
{
@@ -508,11 +508,11 @@ class SimplePie_Item
$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_HTML), null, null, $type));
+ $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, $type) as $category)
{
- $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null, $type));
+ $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null, $type));
}
if (!empty($categories))
@@ -649,7 +649,7 @@ class SimplePie_Item
$email = null;
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
{
- $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML);
+ $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
{
@@ -657,7 +657,7 @@ class SimplePie_Item
}
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
{
- $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML);
+ $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if ($name !== null || $email !== null || $uri !== null)
{
@@ -671,7 +671,7 @@ class SimplePie_Item
$email = null;
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
{
- $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML);
+ $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
{
@@ -679,7 +679,7 @@ class SimplePie_Item
}
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
{
- $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_HTML);
+ $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
}
if ($name !== null || $email !== null || $url !== null)
{
@@ -688,19 +688,19 @@ class SimplePie_Item
}
if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author'))
{
- $authors[] = $this->registry->create('Author', array(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_HTML)));
+ $authors[] = $this->registry->create('Author', array(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)));
}
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
{
- $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null));
+ $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
}
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
{
- $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null));
+ $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
}
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
{
- $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_HTML), null, null));
+ $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
}
if (!empty($authors))
diff --git a/vendor/simplepie/simplepie/library/SimplePie/Parser.php b/vendor/simplepie/simplepie/library/SimplePie/Parser.php
index 17139abe9..df1234023 100644
--- a/vendor/simplepie/simplepie/library/SimplePie/Parser.php
+++ b/vendor/simplepie/simplepie/library/SimplePie/Parser.php
@@ -76,26 +76,17 @@ class SimplePie_Parser
public function parse(&$data, $encoding, $url = '')
{
- if (function_exists('Mf2\parse')) {
+ if (class_exists('DOMXpath') && function_exists('Mf2\parse')) {
+ $doc = new DOMDocument();
+ @$doc->loadHTML($data);
+ $xpath = new DOMXpath($doc);
// Check for both h-feed and h-entry, as both a feed with no entries
// and a list of entries without an h-feed wrapper are both valid.
- $position = 0;
- while ($position = strpos($data, 'h-feed', $position)) {
- $start = $position < 200 ? 0 : $position - 200;
- $check = substr($data, $start, 400);
- if (preg_match('/class="[^"]*h-feed/', $check)) {
- return $this->parse_microformats($data, $url);
- }
- $position += 7;
- }
- $position = 0;
- while ($position = strpos($data, 'h-entry', $position)) {
- $start = $position < 200 ? 0 : $position - 200;
- $check = substr($data, $start, 400);
- if (preg_match('/class="[^"]*h-entry/', $check)) {
- return $this->parse_microformats($data, $url);
- }
- $position += 7;
+ $query = '//*[contains(concat(" ", @class, " "), " h-feed ") or '.
+ 'contains(concat(" ", @class, " "), " h-entry ")]';
+ $result = $xpath->query($query);
+ if ($result->length !== 0) {
+ return $this->parse_microformats($data, $url);
}
}
@@ -465,7 +456,7 @@ class SimplePie_Parser
$h_feed = $mf_item;
break;
}
- // Also look for an h-feed in the children of each top level item.
+ // Also look for h-feed or h-entry in the children of each top level item.
if (!isset($mf_item['children'][0]['type'])) continue;
if (in_array('h-feed', $mf_item['children'][0]['type'])) {
$h_feed = $mf_item['children'][0];
@@ -474,6 +465,13 @@ class SimplePie_Parser
if (in_array('h-card', $mf_item['type'])) $feed_author = $mf_item;
break;
}
+ else if (in_array('h-entry', $mf_item['children'][0]['type'])) {
+ $entries = $mf_item['children'];
+ // In this case the parent of the h-entry list may be an h-card, so use
+ // it as the feed_author.
+ if (in_array('h-card', $mf_item['type'])) $feed_author = $mf_item;
+ break;
+ }
}
if (isset($h_feed['children'])) {
$entries = $h_feed['children'];
@@ -485,7 +483,7 @@ class SimplePie_Parser
$feed_author = $mf['items'][0]['properties']['author'][0];
}
}
- else {
+ else if (count($entries) === 0) {
$entries = $mf['items'];
}
for ($i = 0; $i < count($entries); $i++) {
@@ -554,18 +552,21 @@ class SimplePie_Parser
$photo_list = array();
for ($j = 0; $j < count($entry['properties']['photo']); $j++) {
$photo = $entry['properties']['photo'][$j];
- if (strpos($content, $photo) === false) {
+ if (!empty($photo) && strpos($content, $photo) === false) {
$photo_list[] = $photo;
}
}
// When there's more than one photo show the first and use a lightbox.
+ // Need a permanent, unique name for the image set, but don't have
+ // anything unique except for the content itself, so use that.
$count = count($photo_list);
if ($count > 1) {
+ $image_set_id = preg_replace('/[[:^alnum:]]/', '', $photo_list[0]);
$description = '<p>';
for ($j = 0; $j < $count; $j++) {
$hidden = $j === 0 ? '' : 'class="hidden" ';
$description .= '<a href="'.$photo_list[$j].'" '.$hidden.
- 'data-lightbox="image-set-'.$i.'">'.
+ 'data-lightbox="image-set-'.$image_set_id.'">'.
'<img src="'.$photo_list[$j].'"></a>';
}
$description .= '<br><b>'.$count.' photos</b></p>';
@@ -583,10 +584,18 @@ class SimplePie_Parser
$item['title'] = array(array('data' => $title));
}
$description .= $entry['properties']['content'][0]['html'];
- if (isset($entry['properties']['in-reply-to'][0]['value'])) {
- $in_reply_to = $entry['properties']['in-reply-to'][0]['value'];
- $description .= '<p><span class="in-reply-to"></span> '.
- '<a href="'.$in_reply_to.'">'.$in_reply_to.'</a><p>';
+ if (isset($entry['properties']['in-reply-to'][0])) {
+ $in_reply_to = '';
+ if (is_string($entry['properties']['in-reply-to'][0])) {
+ $in_reply_to = $entry['properties']['in-reply-to'][0];
+ }
+ else if (isset($entry['properties']['in-reply-to'][0]['value'])) {
+ $in_reply_to = $entry['properties']['in-reply-to'][0]['value'];
+ }
+ if ($in_reply_to !== '') {
+ $description .= '<p><span class="in-reply-to"></span> '.
+ '<a href="'.$in_reply_to.'">'.$in_reply_to.'</a><p>';
+ }
}
$item['description'] = array(array('data' => $description));
}
@@ -627,7 +636,7 @@ class SimplePie_Parser
$image = array(array('child' => array('' => array('url' =>
array(array('data' => $feed_author['properties']['photo'][0]))))));
}
- // Use the a name given for the h-feed, or get the title from the html.
+ // Use the name given for the h-feed, or get the title from the html.
if ($feed_title !== '') {
$feed_title = array(array('data' => htmlspecialchars($feed_title)));
}
diff --git a/vendor/simplepie/simplepie/library/SimplePie/Registry.php b/vendor/simplepie/simplepie/library/SimplePie/Registry.php
index e0909bb74..e0909bb74 100755..100644
--- a/vendor/simplepie/simplepie/library/SimplePie/Registry.php
+++ b/vendor/simplepie/simplepie/library/SimplePie/Registry.php