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;
|
2014-10-19 20:42:31 +02:00
|
|
|
use PicoFeed\XmlParser;
|
2014-05-20 20:20:27 +02:00
|
|
|
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)
|
|
|
|
{
|
2014-10-19 20:42:31 +02:00
|
|
|
$feed->date = $this->parseDate(XmlParser::getNamespaceValue($xml->channel, $this->namespaces, 'date'));
|
2014-05-20 20:20:27 +02:00
|
|
|
}
|
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)
|
|
|
|
{
|
2014-10-19 20:42:31 +02:00
|
|
|
$feed->language = XmlParser::getNamespaceValue($xml->channel, $this->namespaces, 'language');
|
2014-05-20 20:20:27 +02:00
|
|
|
}
|
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
|
|
|
}
|