Update of picoFeed
This commit is contained in:
parent
7ac57db487
commit
271241fcf7
@ -1,5 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
@ -38,4 +38,4 @@
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
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);
|
||||
|
||||
if ($xml->channel->link->count() > 1) {
|
||||
if ($xml->channel->link && $xml->channel->link->count() > 1) {
|
||||
|
||||
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 = $this->updated ? strtotime($this->updated) : time();
|
||||
|
||||
// RSS feed might be empty
|
||||
if (! $xml->channel->item) return $this;
|
||||
|
||||
foreach ($xml->channel->item as $entry) {
|
||||
|
||||
$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)
|
||||
{
|
||||
// Strip HTML comments
|
||||
$data = preg_replace('/<!--(.*)-->/Uis', '', $data);
|
||||
// Strip HTML comments (max of 5,000 characters long to prevent crashing)
|
||||
$data = preg_replace('/<!--(.{0,5000}?)-->/Uis', '', $data);
|
||||
|
||||
// Strip Doctype
|
||||
$data = preg_replace('/<!DOCTYPE(.*)>/Uis', '', $data);
|
||||
/* Strip Doctype:
|
||||
* 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....
|
||||
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_HTTPHEADER, $headers);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
|
||||
curl_setopt($ch, CURLOPT_ENCODING, '');
|
||||
|
||||
// Don't check SSL certificates (for auto-signed certificates...)
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
|
Loading…
Reference in New Issue
Block a user