Update of picoFeed
This commit is contained in:
parent
7ac57db487
commit
271241fcf7
@ -1,5 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
5
vendor/PicoFeed/Parsers/Rss20.php
vendored
5
vendor/PicoFeed/Parsers/Rss20.php
vendored
@ -17,7 +17,7 @@ class Rss20 extends Parser
|
|||||||
|
|
||||||
$namespaces = $xml->getNamespaces(true);
|
$namespaces = $xml->getNamespaces(true);
|
||||||
|
|
||||||
if ($xml->channel->link->count() > 1) {
|
if ($xml->channel->link && $xml->channel->link->count() > 1) {
|
||||||
|
|
||||||
foreach ($xml->channel->link as $xml_link) {
|
foreach ($xml->channel->link as $xml_link) {
|
||||||
|
|
||||||
@ -40,6 +40,9 @@ class Rss20 extends Parser
|
|||||||
$this->updated = isset($xml->channel->pubDate) ? (string) $xml->channel->pubDate : (string) $xml->channel->lastBuildDate;
|
$this->updated = isset($xml->channel->pubDate) ? (string) $xml->channel->pubDate : (string) $xml->channel->lastBuildDate;
|
||||||
$this->updated = $this->updated ? strtotime($this->updated) : time();
|
$this->updated = $this->updated ? strtotime($this->updated) : time();
|
||||||
|
|
||||||
|
// RSS feed might be empty
|
||||||
|
if (! $xml->channel->item) return $this;
|
||||||
|
|
||||||
foreach ($xml->channel->item as $entry) {
|
foreach ($xml->channel->item as $entry) {
|
||||||
|
|
||||||
$item = new \StdClass;
|
$item = new \StdClass;
|
||||||
|
12
vendor/PicoFeed/Reader.php
vendored
12
vendor/PicoFeed/Reader.php
vendored
@ -51,11 +51,15 @@ class Reader
|
|||||||
|
|
||||||
public function getFirstTag($data)
|
public function getFirstTag($data)
|
||||||
{
|
{
|
||||||
// Strip HTML comments
|
// Strip HTML comments (max of 5,000 characters long to prevent crashing)
|
||||||
$data = preg_replace('/<!--(.*)-->/Uis', '', $data);
|
$data = preg_replace('/<!--(.{0,5000}?)-->/Uis', '', $data);
|
||||||
|
|
||||||
// Strip Doctype
|
/* Strip Doctype:
|
||||||
$data = preg_replace('/<!DOCTYPE(.*)>/Uis', '', $data);
|
* Doctype needs to be within the first 500 characters. (Ideally the first!)
|
||||||
|
* If it's not found by then, we need to stop looking to prevent PREG
|
||||||
|
* from reaching max backtrack depth and crashing.
|
||||||
|
*/
|
||||||
|
$data = preg_replace('/^.{0,500}<!DOCTYPE([^>]*)>/Uis', '', $data);
|
||||||
|
|
||||||
// Find <?xml version....
|
// Find <?xml version....
|
||||||
if (strpos($data, '<?xml') !== false) {
|
if (strpos($data, '<?xml') !== false) {
|
||||||
|
1
vendor/PicoFeed/RemoteResource.php
vendored
1
vendor/PicoFeed/RemoteResource.php
vendored
@ -124,6 +124,7 @@ class RemoteResource
|
|||||||
curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
|
curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
|
||||||
|
curl_setopt($ch, CURLOPT_ENCODING, '');
|
||||||
|
|
||||||
// Don't check SSL certificates (for auto-signed certificates...)
|
// Don't check SSL certificates (for auto-signed certificates...)
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user