- md5
- 206665955a6b307a55d866b8e88f0799
- sha1
- 68c04fb2ab446efd8d52ddfdabde7a7126a03c6b
- sha256
- f228d86d31adc5729cc746c6c5be042b5a3e551438733885479e58462f922561
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
<?php
/**
* @package Joomla.Libraries
* @subpackage Feed
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_BASE') or die;
/**
* ATOM Feed Parser class.
*
* @package Joomla.Libraries
* @subpackage Feed
* @link http://www.atomenabled.org/developers/syndication/
* @since 3.0
*/
class JFeedParserAtom extends JFeedParser
{
/**
* @var string The feed format version.
* @since 3.0
*/
protected $version;
/**
* Method to handle the <author> element for the feed.
*
* @param JFeed $feed The JFeed object being built from the parsed feed.
* @param SimpleXMLElement $el The current XML element object to handle.
*
* @return void
*
* @since 3.0
*/
protected function handleAuthor(JFeed $feed, SimpleXMLElement $el)
{
// Set the author information from the XML element.
$feed->setAuthor((string) $el->name, (string) $el->email, (string) $el->uri);
}
/**
* Method to handle the <contributor> element for the feed.
*
* @param JFeed $feed The JFeed object being built from the parsed feed.
* @param SimpleXMLElement $el The current XML element object to handle.
*
* @return void
*
* @since 3.0
*/
protected function handleContributor(JFeed $feed, SimpleXMLElement $el)
{
$feed->addContributor((string) $el->name, (string) $el->email, (string) $el->uri);
}
/**
* Method to handle the <generator> element for the feed.
*
* @param JFeed $feed The JFeed object being built from the parsed feed.
* @param SimpleXMLElement $el The current XML element object to handle.
*
* @return void
*
* @since 3.0
*/
protected function handleGenerator(JFeed $feed, SimpleXMLElement $el)
{
$feed->generator = (string) $el;
}
/**
* Method to handle the <id> element for the feed.
*
* @param JFeed $feed The JFeed object being built from the parsed feed.
* @param SimpleXMLElement $el The current XML element object to handle.
*
* @return void
*
* @since 3.0
*/
protected function handleId(JFeed $feed, SimpleXMLElement $el)
{
$feed->uri = (string) $el;
}
/**
* Method to handle the <link> element for the feed.
*
* @param JFeed $feed The JFeed object being built from the parsed feed.
* @param SimpleXMLElement $el The current XML element object to handle.
*
* @return void
*
* @since 3.0
*/
protected function handleLink(JFeed $feed, SimpleXMLElement $el)
{
$link = new JFeedLink;
$link->uri = (string) $el['href'];
$link->language = (string) $el['hreflang'];
$link->length = (int) $el['length'];
$link->relation = (string) $el['rel'];
$link->title = (string) $el['title'];
$link->type = (string) $el['type'];
$feed->link = $link;
}
/**
* Method to handle the <rights> element for the feed.
*
* @param JFeed $feed The JFeed object being built from the parsed feed.
* @param SimpleXMLElement $el The current XML element object to handle.
*
* @return void
*
* @since 3.0
*/
protected function handleRights(JFeed $feed, SimpleXMLElement $el)
{
$feed->copyright = (string) $el;
}
/**
* Method to handle the <subtitle> element for the feed.
*
* @param JFeed $feed The JFeed object being built from the parsed feed.
* @param SimpleXMLElement $el The current XML element object to handle.
*
* @return void
*
* @since 3.0
*/
protected function handleSubtitle(JFeed $feed, SimpleXMLElement $el)
{
$feed->description = (string) $el;
}
/**
* Method to handle the <title> element for the feed.
*
* @param JFeed $feed The JFeed object being built from the parsed feed.
* @param SimpleXMLElement $el The current XML element object to handle.
*
* @return void
*
* @since 3.0
*/
protected function handleTitle(JFeed $feed, SimpleXMLElement $el)
{
$feed->title = (string) $el;
}
/**
* Method to handle the <updated> element for the feed.
*
* @param JFeed $feed The JFeed object being built from the parsed feed.
* @param SimpleXMLElement $el The current XML element object to handle.
*
* @return void
*
* @since 3.0
*/
protected function handleUpdated(JFeed $feed, SimpleXMLElement $el)
{
$feed->updatedDate = (string) $el;
}
/**
* Method to initialise the feed for parsing. Here we detect the version and advance the stream
* reader so that it is ready to parse feed elements.
*
* @return void
*
* @since 3.0
*/
protected function initialise()
{
// Read the version attribute.
$this->version = ($this->stream->getAttribute('version') == '0.3') ? '0.3' : '1.0';
// We want to move forward to the first element after the root element.
$this->moveToNextElement();
}
/**
* Method to handle the feed entry element for the feed: <entry>.
*
* @param JFeedEntry $entry The JFeedEntry object being built from the parsed feed entry.
* @param SimpleXMLElement $el The current XML element object to handle.
*
* @return void
*
* @since 3.0
*/
protected function processFeedEntry(JFeedEntry $entry, SimpleXMLElement $el)
{
$entry->uri = (string) $el->id;
$entry->title = (string) $el->title;
$entry->updatedDate = (string) $el->updated;
$entry->content = (string) $el->summary;
}
}
The same content is in 3 releases, Joomla 3.0.0 to 3.0.2. See them all, or every version of this file.