miniflux-legacy/vendor/PicoFeed/Parsers/Rss10.php

88 lines
2.1 KiB
PHP
Raw Normal View History

2013-04-05 05:34:07 +02:00
<?php
2013-06-29 03:50:15 +02:00
namespace PicoFeed\Parsers;
2013-04-05 05:34:07 +02:00
2014-05-20 20:20:27 +02:00
require_once __DIR__.'/Rss20.php';
use SimpleXMLElement;
use PicoFeed\Feed;
use PicoFeed\Item;
use PicoFeed\Parsers\Rss20;
/**
* RSS 1.0 parser
*
* @author Frederic Guillot
* @package parser
*/
class Rss10 extends Rss20
2013-04-05 05:34:07 +02:00
{
2014-05-20 20:20:27 +02:00
/**
* Get the path to the items XML tree
*
* @access public
* @param SimpleXMLElement $xml Feed xml
* @return SimpleXMLElement
*/
public function getItemsTree(SimpleXMLElement $xml)
2013-04-05 05:34:07 +02:00
{
2014-05-20 20:20:27 +02:00
return $xml->item;
}
2013-04-05 05:34:07 +02:00
2014-05-20 20:20:27 +02:00
/**
* 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($this->getNamespaceValue($xml->channel, $this->namespaces, 'date'));
}
2013-04-05 05:34:07 +02:00
2014-05-20 20:20:27 +02:00
/**
* 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 = $this->getNamespaceValue($xml->channel, $this->namespaces, 'language');
}
2013-04-05 05:34:07 +02:00
2014-05-20 20:20:27 +02:00
/**
* 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 = '';
2013-04-05 05:34:07 +02:00
}
else {
2014-05-20 20:20:27 +02:00
$feed_permalink = $feed->url;
2013-04-05 05:34:07 +02:00
}
2014-05-20 20:20:27 +02:00
$item->id = $this->generateId($item->url, $feed_permalink);
}
2013-08-30 01:34:11 +02:00
2014-05-20 20:20:27 +02:00
/**
* 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)
{
2013-04-05 05:34:07 +02:00
}
2014-05-20 20:20:27 +02:00
}