diff options
Diffstat (limited to 'vendor/simplepie/simplepie/library/SimplePie.php')
-rw-r--r--[-rwxr-xr-x] | vendor/simplepie/simplepie/library/SimplePie.php | 58 |
1 files changed, 24 insertions, 34 deletions
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; |