diff --git a/miniflux/vendor/PicoFeed/Import.php b/miniflux/vendor/PicoFeed/Import.php index 40aac90..9cad626 100644 --- a/miniflux/vendor/PicoFeed/Import.php +++ b/miniflux/vendor/PicoFeed/Import.php @@ -22,7 +22,7 @@ class Import $xml = new \SimpleXMLElement(trim($this->content)); - if ($xml->getName() !== 'opml') { + if ($xml->getName() !== 'opml' || ! isset($xml->body)) { return false; } @@ -40,21 +40,24 @@ class Import public function parseEntries($tree) { - foreach ($tree->outline as $item) { + if (isset($tree->outline)) { - if (isset($item['type']) && strtolower($item['type']) === 'folder' && isset($item->outline)) { + foreach ($tree->outline as $item) { - $this->parseEntries($item); - } - else if (isset($item['type']) && strtolower($item['type']) === 'rss') { + if (isset($item->outline)) { - $entry = new \StdClass; - $entry->title = (string) $item['text']; - $entry->site_url = (string) $item['htmlUrl']; - $entry->feed_url = (string) $item['xmlUrl']; - $entry->type = isset($item['version']) ? (string) $item['version'] : (string) $item['type']; - $entry->description = (string) $item['description']; - $this->items[] = $entry; + $this->parseEntries($item); + } + else if (isset($item['text']) && isset($item['xmlUrl']) && isset($item['htmlUrl'])) { + + $entry = new \StdClass; + $entry->title = isset($item['title']) ? (string) $item['title'] : (string) $item['text']; + $entry->site_url = (string) $item['htmlUrl']; + $entry->feed_url = (string) $item['xmlUrl']; + $entry->type = isset($item['version']) ? (string) $item['version'] : isset($item['type']) ? (string) $item['type'] : 'rss'; + $entry->description = isset($item['description']) ? (string) $item['description'] : $entry->title; + $this->items[] = $entry; + } } } } diff --git a/miniflux/vendor/PicoFeed/Parser.php b/miniflux/vendor/PicoFeed/Parser.php index cd5bdd1..40b0ba8 100644 --- a/miniflux/vendor/PicoFeed/Parser.php +++ b/miniflux/vendor/PicoFeed/Parser.php @@ -185,3 +185,79 @@ class Rss20 extends Parser return $this; } } + + +class Rss10 extends Parser +{ + public function execute() + { + try { + + \libxml_use_internal_errors(true); + + $xml = new \SimpleXMLElement($this->content); + $ns = $xml->getNamespaces(true); + + $this->title = (string) $xml->channel->title; + $this->url = (string) $xml->channel->link; + $this->id = $this->url; + + if (isset($ns['dc'])) { + + $ns_dc = $xml->channel->children($ns['dc']); + $this->updated = isset($ns_dc->date) ? strtotime($ns_dc->date) : time(); + } + else { + + $this->updated = time(); + } + + foreach ($xml->item as $entry) { + + $author = ''; + $content = ''; + $pubdate = ''; + $link = ''; + + if (isset($ns['feedburner'])) { + + $ns_fb = $entry->children($ns['feedburner']); + $link = $ns_fb->origLink; + } + + if (isset($ns['dc'])) { + + $ns_dc = $entry->children($ns['dc']); + $author = (string) $ns_dc->creator; + $pubdate = (string) $ns_dc->date; + } + + if (isset($ns['content'])) { + + $ns_content = $entry->children($ns['content']); + $content = (string) $ns_content->encoded; + } + + if ($content === '' && isset($entry->description)) { + + $content = (string) $entry->description; + } + + $item = new \StdClass; + $item->title = (string) $entry->title; + $item->url = $link ?: (string) $entry->link; + $item->id = $item->url; + $item->updated = $pubdate ? strtotime($pubdate) : time(); + $item->content = $this->filterHtml($content, $item->url); + $item->author = $author ?: (string) $xml->channel->webMaster; + + $this->items[] = $item; + } + } + catch (\Exception $e) { + + } + + return $this; + } +} diff --git a/miniflux/vendor/PicoFeed/Reader.php b/miniflux/vendor/PicoFeed/Reader.php index 5e62a87..47e2586 100644 --- a/miniflux/vendor/PicoFeed/Reader.php +++ b/miniflux/vendor/PicoFeed/Reader.php @@ -70,6 +70,10 @@ class Reader return new Rss20($this->content); } + else if (strpos($first_tag, 'content); + } else if ($discover === true) { return false;