summaryrefslogtreecommitdiffstats
path: root/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers')
-rw-r--r--3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Atom.php292
-rw-r--r--3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss10.php88
-rw-r--r--3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss20.php300
-rw-r--r--3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss91.php17
-rw-r--r--3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss92.php17
5 files changed, 0 insertions, 714 deletions
diff --git a/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Atom.php b/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Atom.php
deleted file mode 100644
index 8a86b815c..000000000
--- a/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Atom.php
+++ /dev/null
@@ -1,292 +0,0 @@
-<?php
-
-namespace PicoFeed\Parsers;
-
-use SimpleXMLElement;
-use PicoFeed\Parser;
-use PicoFeed\XmlParser;
-use PicoFeed\Logging;
-use PicoFeed\Feed;
-use PicoFeed\Filter;
-use PicoFeed\Item;
-use PicoFeed\Url;
-
-/**
- * Atom parser
- *
- * @author Frederic Guillot
- * @package parser
- */
-class Atom extends Parser
-{
- /**
- * Get the path to the items XML tree
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @return SimpleXMLElement
- */
- public function getItemsTree(SimpleXMLElement $xml)
- {
- return $xml->entry;
- }
-
- /**
- * Find the feed url
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedUrl(SimpleXMLElement $xml, Feed $feed)
- {
- $feed->url = $this->getLink($xml);
- }
-
- /**
- * Find the feed description
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedDescription(SimpleXMLElement $xml, Feed $feed)
- {
- $feed->description = (string) $xml->subtitle;
- }
-
- /**
- * Find the feed logo url
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedLogo(SimpleXMLElement $xml, Feed $feed)
- {
- $feed->logo = (string) $xml->logo;
- }
-
- /**
- * Find the feed title
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedTitle(SimpleXMLElement $xml, Feed $feed)
- {
- $feed->title = Filter::stripWhiteSpace((string) $xml->title) ?: $feed->url;
- }
-
- /**
- * Find the feed language
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedLanguage(SimpleXMLElement $xml, Feed $feed)
- {
- $feed->language = XmlParser::getXmlLang($this->content);
- }
-
- /**
- * Find the feed id
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedId(SimpleXMLElement $xml, Feed $feed)
- {
- $feed->id = (string) $xml->id;
- }
-
- /**
- * Find the feed date
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedDate(SimpleXMLElement $xml, Feed $feed)
- {
- $feed->date = $this->parseDate((string) $xml->updated);
- }
-
- /**
- * Find the item date
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param Item $item Item object
- */
- public function findItemDate(SimpleXMLElement $entry, Item $item)
- {
- $item->date = $this->parseDate((string) $entry->updated);
- }
-
- /**
- * Find the item title
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param Item $item Item object
- */
- public function findItemTitle(SimpleXMLElement $entry, Item $item)
- {
- $item->title = Filter::stripWhiteSpace((string) $entry->title);
-
- if (empty($item->title)) {
- $item->title = $item->url;
- }
- }
-
- /**
- * Find the item author
- *
- * @access public
- * @param SimpleXMLElement $xml Feed
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- */
- public function findItemAuthor(SimpleXMLElement $xml, SimpleXMLElement $entry, Item $item)
- {
- if (isset($entry->author->name)) {
- $item->author = (string) $entry->author->name;
- }
- else {
- $item->author = (string) $xml->author->name;
- }
- }
-
- /**
- * Find the item content
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- */
- public function findItemContent(SimpleXMLElement $entry, Item $item)
- {
- $item->content = $this->getContent($entry);
- }
-
- /**
- * Find the item URL
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- */
- public function findItemUrl(SimpleXMLElement $entry, Item $item)
- {
- $item->url = $this->getLink($entry);
- }
-
- /**
- * Genereate the item id
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findItemId(SimpleXMLElement $entry, Item $item, Feed $feed)
- {
- $id = (string) $entry->id;
-
- if ($id !== $item->url) {
- $item_permalink = $id;
- }
- else {
- $item_permalink = $item->url;
- }
-
- if ($this->isExcludedFromId($feed->url)) {
- $feed_permalink = '';
- }
- else {
- $feed_permalink = $feed->url;
- }
-
- $item->id = $this->generateId($item_permalink, $feed_permalink);
- }
-
- /**
- * Find the item enclosure
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findItemEnclosure(SimpleXMLElement $entry, Item $item, Feed $feed)
- {
- foreach ($entry->link as $link) {
- if ((string) $link['rel'] === 'enclosure') {
-
- $item->enclosure_url = Url::resolve((string) $link['href'], $feed->url);
- $item->enclosure_type = (string) $link['type'];
- break;
- }
- }
- }
-
- /**
- * Find the item language
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findItemLanguage(SimpleXMLElement $entry, Item $item, Feed $feed)
- {
- $item->language = $feed->language;
- }
-
- /**
- * Get the URL from a link tag
- *
- * @access public
- * @param SimpleXMLElement $xml XML tag
- * @return string
- */
- public function getLink(SimpleXMLElement $xml)
- {
- foreach ($xml->link as $link) {
- if ((string) $link['type'] === 'text/html' || (string) $link['type'] === 'application/xhtml+xml') {
- return (string) $link['href'];
- }
- }
-
- return (string) $xml->link['href'];
- }
-
- /**
- * Get the entry content
- *
- * @access public
- * @param SimpleXMLElement $entry XML Entry
- * @return string
- */
- public function getContent(SimpleXMLElement $entry)
- {
- if (isset($entry->content) && ! empty($entry->content)) {
-
- if (count($entry->content->children())) {
- return (string) $entry->content->asXML();
- }
- else {
- return (string) $entry->content;
- }
- }
- else if (isset($entry->summary) && ! empty($entry->summary)) {
- return (string) $entry->summary;
- }
-
- return '';
- }
-}
diff --git a/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss10.php b/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss10.php
deleted file mode 100644
index 728c79206..000000000
--- a/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss10.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
-namespace PicoFeed\Parsers;
-
-require_once __DIR__.'/Rss20.php';
-
-use SimpleXMLElement;
-use PicoFeed\Feed;
-use PicoFeed\Item;
-use PicoFeed\XmlParser;
-use PicoFeed\Parsers\Rss20;
-
-/**
- * RSS 1.0 parser
- *
- * @author Frederic Guillot
- * @package parser
- */
-class Rss10 extends Rss20
-{
- /**
- * Get the path to the items XML tree
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @return SimpleXMLElement
- */
- public function getItemsTree(SimpleXMLElement $xml)
- {
- return $xml->item;
- }
-
- /**
- * Find the feed date
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedDate(SimpleXMLElement $xml, Feed $feed)
- {
- $feed->date = $this->parseDate(XmlParser::getNamespaceValue($xml->channel, $this->namespaces, 'date'));
- }
-
- /**
- * Find the feed language
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedLanguage(SimpleXMLElement $xml, Feed $feed)
- {
- $feed->language = XmlParser::getNamespaceValue($xml->channel, $this->namespaces, 'language');
- }
-
- /**
- * Genereate the item id
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findItemId(SimpleXMLElement $entry, Item $item, Feed $feed)
- {
- if ($this->isExcludedFromId($feed->url)) {
- $feed_permalink = '';
- }
- else {
- $feed_permalink = $feed->url;
- }
-
- $item->id = $this->generateId($item->url, $feed_permalink);
- }
-
- /**
- * Find the item enclosure
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findItemEnclosure(SimpleXMLElement $entry, Item $item, Feed $feed)
- {
- }
-}
diff --git a/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss20.php b/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss20.php
deleted file mode 100644
index 255c6e589..000000000
--- a/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss20.php
+++ /dev/null
@@ -1,300 +0,0 @@
-<?php
-
-namespace PicoFeed\Parsers;
-
-use SimpleXMLElement;
-use PicoFeed\Parser;
-use PicoFeed\XmlParser;
-use PicoFeed\Logging;
-use PicoFeed\Feed;
-use PicoFeed\Filter;
-use PicoFeed\Item;
-use PicoFeed\Url;
-
-/**
- * RSS 2.0 Parser
- *
- * @author Frederic Guillot
- * @package parser
- */
-class Rss20 extends Parser
-{
- /**
- * Get the path to the items XML tree
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @return SimpleXMLElement
- */
- public function getItemsTree(SimpleXMLElement $xml)
- {
- return $xml->channel->item;
- }
-
- /**
- * Find the feed url
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedUrl(SimpleXMLElement $xml, Feed $feed)
- {
- if ($xml->channel->link && $xml->channel->link->count() > 1) {
-
- foreach ($xml->channel->link as $xml_link) {
-
- $link = (string) $xml_link;
-
- if ($link !== '') {
- $feed->url = $link;
- break;
- }
- }
- }
- else {
-
- $feed->url = (string) $xml->channel->link;
- }
- }
-
- /**
- * Find the feed description
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedDescription(SimpleXMLElement $xml, Feed $feed)
- {
- $feed->description = (string) $xml->channel->description;
- }
-
- /**
- * Find the feed logo url
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedLogo(SimpleXMLElement $xml, Feed $feed)
- {
- if (isset($xml->channel->image->url)) {
- $feed->logo = (string) $xml->channel->image->url;
- }
- }
-
- /**
- * Find the feed title
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedTitle(SimpleXMLElement $xml, Feed $feed)
- {
- $feed->title = Filter::stripWhiteSpace((string) $xml->channel->title) ?: $feed->url;
- }
-
- /**
- * Find the feed language
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedLanguage(SimpleXMLElement $xml, Feed $feed)
- {
- $feed->language = isset($xml->channel->language) ? (string) $xml->channel->language : '';
- }
-
- /**
- * Find the feed id
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedId(SimpleXMLElement $xml, Feed $feed)
- {
- $feed->id = $feed->url;
- }
-
- /**
- * Find the feed date
- *
- * @access public
- * @param SimpleXMLElement $xml Feed xml
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findFeedDate(SimpleXMLElement $xml, Feed $feed)
- {
- $date = isset($xml->channel->pubDate) ? $xml->channel->pubDate : $xml->channel->lastBuildDate;
- $feed->date = $this->parseDate((string) $date);
- }
-
- /**
- * Find the item date
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- */
- public function findItemDate(SimpleXMLElement $entry, Item $item)
- {
- $date = XmlParser::getNamespaceValue($entry, $this->namespaces, 'date');
-
- if (empty($date)) {
- $date = XmlParser::getNamespaceValue($entry, $this->namespaces, 'updated');
- }
-
- if (empty($date)) {
- $date = (string) $entry->pubDate;
- }
-
- $item->date = $this->parseDate($date);
- }
-
- /**
- * Find the item title
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- */
- public function findItemTitle(SimpleXMLElement $entry, Item $item)
- {
- $item->title = Filter::stripWhiteSpace((string) $entry->title);
-
- if (empty($item->title)) {
- $item->title = $item->url;
- }
- }
-
- /**
- * Find the item author
- *
- * @access public
- * @param SimpleXMLElement $xml Feed
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- */
- public function findItemAuthor(SimpleXMLElement $xml, SimpleXMLElement $entry, Item $item)
- {
- $item->author = XmlParser::getNamespaceValue($entry, $this->namespaces, 'creator');
-
- if (empty($item->author)) {
- if (isset($entry->author)) {
- $item->author = (string) $entry->author;
- }
- else if (isset($xml->channel->webMaster)) {
- $item->author = (string) $xml->channel->webMaster;
- }
- }
- }
-
- /**
- * Find the item content
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- */
- public function findItemContent(SimpleXMLElement $entry, Item $item)
- {
- $content = XmlParser::getNamespaceValue($entry, $this->namespaces, 'encoded');
-
- if (empty($content) && $entry->description->count() > 0) {
- $content = (string) $entry->description;
- }
-
- $item->content = $content;
- }
-
- /**
- * Find the item URL
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- */
- public function findItemUrl(SimpleXMLElement $entry, Item $item)
- {
- $links = array(
- XmlParser::getNamespaceValue($entry, $this->namespaces, 'origLink'),
- isset($entry->link) ? (string) $entry->link : '',
- XmlParser::getNamespaceValue($entry, $this->namespaces, 'link', 'href'),
- isset($entry->guid) ? (string) $entry->guid : '',
- );
-
- foreach ($links as $link) {
- if (! empty($link) && filter_var($link, FILTER_VALIDATE_URL) !== false) {
- $item->url = $link;
- break;
- }
- }
- }
-
- /**
- * Genereate the item id
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findItemId(SimpleXMLElement $entry, Item $item, Feed $feed)
- {
- $item_permalink = $item->url;
-
- if ($this->isExcludedFromId($feed->url)) {
- $feed_permalink = '';
- }
- else {
- $feed_permalink = $feed->url;
- }
-
- if ($entry->guid->count() > 0 && ((string) $entry->guid['isPermaLink'] === 'false' || ! isset($entry->guid['isPermaLink']))) {
- $item->id = $this->generateId($item_permalink, $feed_permalink, (string) $entry->guid);
- }
- else {
- $item->id = $this->generateId($item_permalink, $feed_permalink);
- }
- }
-
- /**
- * Find the item enclosure
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findItemEnclosure(SimpleXMLElement $entry, Item $item, Feed $feed)
- {
- if (isset($entry->enclosure)) {
-
- $item->enclosure_url = XmlParser::getNamespaceValue($entry->enclosure, $this->namespaces, 'origEnclosureLink');
-
- if (empty($item->enclosure_url)) {
- $item->enclosure_url = isset($entry->enclosure['url']) ? (string) $entry->enclosure['url'] : '';
- }
-
- $item->enclosure_type = isset($entry->enclosure['type']) ? (string) $entry->enclosure['type'] : '';
- $item->enclosure_url = Url::resolve($item->enclosure_url, $feed->url);
- }
- }
-
- /**
- * Find the item language
- *
- * @access public
- * @param SimpleXMLElement $entry Feed item
- * @param \PicoFeed\Item $item Item object
- * @param \PicoFeed\Feed $feed Feed object
- */
- public function findItemLanguage(SimpleXMLElement $entry, Item $item, Feed $feed)
- {
- $item->language = $feed->language;
- }
-}
diff --git a/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss91.php b/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss91.php
deleted file mode 100644
index 8df3ce0b5..000000000
--- a/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss91.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-
-namespace PicoFeed\Parsers;
-
-require_once __DIR__.'/Rss20.php';
-
-use PicoFeed\Parsers\Rss20;
-
-/**
- * RSS 0.91 Parser
- *
- * @author Frederic Guillot
- * @package parser
- */
-class Rss91 extends Rss20
-{
-}
diff --git a/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss92.php b/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss92.php
deleted file mode 100644
index 71478a06f..000000000
--- a/3rdparty/fguillot/picofeed/lib/PicoFeed/Parsers/Rss92.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-
-namespace PicoFeed\Parsers;
-
-require_once __DIR__.'/Rss20.php';
-
-use PicoFeed\Parsers\Rss20;
-
-/**
- * RSS 0.92 Parser
- *
- * @author Frederic Guillot
- * @package parser
- */
-class Rss92 extends Rss20
-{
-}