Atom extends Feed
Atom class for syndication.
Tags
Table of Contents
- $docElement : DOMElement
- The DOMElement object used to hold the item or entry elements.
- $fieldNameMappings : array<string|int, mixed>
- An array containing Record field names -> RSS field name mappings.
- $hasChannel : bool
- If the feed format has a channel or not.
- $items : array<string|int, mixed>
- An array of feed items.
- $nameSpace : string
- The XML namespace.
- $root : DOMElement
- Holds the DOMElement to which metadata is added for the feed.
- $rootTag : string
- The actual root tag used in each feed type.
- $rssDoc : DOMDocument
- The DOMDocument object used to create the feed.
- $tagMap : array<string|int, mixed>
- Maps the tags to the feed-specific tags.
- $logger : Logger
- Trace logger.
- $record : ActiveRecord
- The Record which we will serve up in this feed.
- __construct() : mixed
- Constructor to create a new Atom feed.
- addAuthor() : mixed
- Adds an auther to a feed.
- addRecord() : mixed
- Method for adding a Record to the current feed.
- loadRecords() : mixed
- Method to load all of the Record items to the feed from the database, from the newest to the $limit provided.
- render() : string
- Returns the formatted XML for the feed as a string.
- setFieldMappings() : mixed
- Method for mapping Record fieldnames to feed field names.
- addItem() : mixed
- Method for adding an item to a feed.
- createFeedElement() : DOMElement
- Method for creating a new feed element.
- createLink() : mixed
- Method for creating link elements (note that Atom has a different format).
- createRSSNode() : mixed
- Method for creating an RSS node with a title, url and description.
Properties
$docElement
The DOMElement object used to hold the item or entry elements.
protected
DOMElement
$docElement
Tags
$fieldNameMappings
An array containing Record field names -> RSS field name mappings.
protected
array<string|int, mixed>
$fieldNameMappings
Tags
$hasChannel
If the feed format has a channel or not.
protected
bool
$hasChannel
= false
Tags
$items
An array of feed items.
protected
array<string|int, mixed>
$items
Tags
$nameSpace
The XML namespace.
protected
string
$nameSpace
= 'http://www.w3.org/2005/Atom'
Tags
$root
Holds the DOMElement to which metadata is added for the feed.
protected
DOMElement
$root
Tags
$rootTag
The actual root tag used in each feed type.
protected
string
$rootTag
= '<feed xmlns="http://www.w3.org/2005/Atom" />'
Tags
$rssDoc
The DOMDocument object used to create the feed.
protected
DOMDocument
$rssDoc
Tags
$tagMap
Maps the tags to the feed-specific tags.
protected
array<string|int, mixed>
$tagMap
= array('item' => 'entry', 'feeddesc' => 'subtitle', 'itemdesc' => 'summary')
Tags
$logger
Trace logger.
private
static Logger
$logger
= null
Tags
$record
The Record which we will serve up in this feed.
private
ActiveRecord
$record
Tags
Methods
__construct()
Constructor to create a new Atom feed.
public
__construct(string $title, string $url, string $description[, string $pubDate = null ][, int $id = null ]) : mixed
Parameters
- $title : string
- $url : string
- $description : string
- $pubDate : string = null
- $id : int = null
Tags
Return values
mixed —addAuthor()
Adds an auther to a feed.
public
addAuthor(string $name) : mixed
Parameters
- $name : string
-
The name of the author.
Tags
Return values
mixed —addRecord()
Method for adding a Record to the current feed.
public
addRecord(ActiveRecord $Record) : mixed
Parameters
- $Record : ActiveRecord
Return values
mixed —loadRecords()
Method to load all of the Record items to the feed from the database, from the newest to the $limit provided.
public
loadRecords(int $limit, string $sortBy) : mixed
Parameters
- $limit : int
-
The amount of items to render in the feed.
- $sortBy : string
-
The name of the field to sort the feed by.
Tags
Return values
mixed —render()
Returns the formatted XML for the feed as a string.
public
render() : string
Tags
Return values
string —setFieldMappings()
Method for mapping Record fieldnames to feed field names.
public
setFieldMappings(string $title, string $url[, string $description = null ][, string $pubDate = null ][, int $id = null ]) : mixed
Parameters
- $title : string
-
The title of the feed.
- $url : string
-
The base URL for the feed.
- $description : string = null
-
The description of the feed.
- $pubDate : string = null
-
The publish date, only used in Atom feeds.
- $id : int = null
-
The feed id, only used in Atom feeds.
Tags
Return values
mixed —addItem()
Method for adding an item to a feed.
protected
addItem(mixed $title, mixed $link[, mixed $description = null ][, mixed $pubDate = null ][, mixed $id = null ]) : mixed
Parameters
- $title : mixed
-
The title of the feed.
- $link : mixed
- $description : mixed = null
-
The description of the feed.
- $pubDate : mixed = null
-
The publish date, only used in Atom feeds.
- $id : mixed = null
-
The feed id, only used in Atom feeds.
Return values
mixed —createFeedElement()
Method for creating a new feed element.
protected
createFeedElement(string $name[, string $value = null ]) : DOMElement
Parameters
- $name : string
-
The name of the element.
- $value : string = null
-
The value of the element.
Tags
Return values
DOMElement —createLink()
Method for creating link elements (note that Atom has a different format).
protected
createLink(mixed $parent, mixed $url) : mixed
Parameters
- $parent : mixed
-
The parent element.
- $url : mixed
-
The URL for the link.
Return values
mixed —createRSSNode()
Method for creating an RSS node with a title, url and description.
protected
createRSSNode(int $type, DOMElement $parent, string $title, string $url, string $description[, string $pubDate = null ][, int $id = null ]) : mixed
Parameters
- $type : int
-
Can be either (item|feed) to indicate the type of node we are creating.
- $parent : DOMElement
-
The parent element.
- $title : string
-
The title of the feed.
- $url : string
-
The base URL for the feed.
- $description : string
-
The description of the feed.
- $pubDate : string = null
-
The publish date, only used in Atom feeds.
- $id : int = null
-
The feed id, only used in Atom feeds.