Class: AlphaFeed
Source Location: /util/feeds/AlphaFeed.inc
Class AlphaFeed
Class Overview
Base feed class for generating syndication feeds
Located in /util/feeds/AlphaFeed.inc [line 49]
Author(s):
- John Collins <dev@alphaframework.org>
API Tags:
Information Tags:
Version: | $Id: AlphaFeed.inc 1341 2011-03-17 15:02:02Z johnc $ |
Copyright: | Copyright (c) 2011, John Collins (founder of Alpha Framework). All rights reserved. Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the Alpha Framework nor the names
of its contributors may be used to endorse or promote
products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Since: | 1.0 |
License: | The BSD License |
|
Properties
|
Methods
|
Descendants
Atom |
Atom class for syndication
|
RSS |
RSS 1.0 class for synication
|
RSS2 |
RSS 2.0 class for syndication
|
Property Summary
DOMElement |
$docElement |
The DOMElement object used to hold the item or entry elements |
boolean |
$hasChannel |
If the feed format has a channel or not |
array |
$items |
An array of feed items |
string |
$nameSpace |
The XML namespace to use in the generated feed |
DOMElement |
$root |
Holds the DOMElement to which metadata is added for the feed |
string |
$rootTag |
The actual root tag used in each feed type |
DOMDocument |
$rssDoc |
The DOMDocument object used to create the feed |
array |
$tagMap |
Maps the tags to the feed-specific tags |
Method Summary
void |
addBO() |
Method for adding a BO to the current feed |
void |
addItem() |
Method for adding an item to a feed |
void |
createLink() |
Method for creating link elements (note that Atom has a different format) |
void |
createRSSNode() |
Method for creating an RSS node with a title, url and description |
void |
loadBOs() |
Method to load all of the BO items to the feed from the database, from the newest to the $limit provided |
string |
render() |
Returns the formatted XML for the feed as a string |
Properties
The DOMElement object used to hold the item or entry elements
API Tags:
Information Tags:
An array containing BO field names -> RSS field name mappings
API Tags:
Information Tags:
If the feed format has a channel or not
API Tags:
Information Tags:
Redefined in descendants as:
An array of feed items
API Tags:
Information Tags:
The XML namespace to use in the generated feed
API Tags:
Redefined in descendants as:
Holds the DOMElement to which metadata is added for the feed
API Tags:
Information Tags:
The actual root tag used in each feed type
API Tags:
Information Tags:
Redefined in descendants as:
The DOMDocument object used to create the feed
API Tags:
Information Tags:
Maps the tags to the feed-specific tags
API Tags:
Information Tags:
Redefined in descendants as:
Methods
AlphaFeed __construct(
string
$BOName, string
$title, string
$url, string
$description, [string
$pubDate = null], [integer
$id = null], [integer
$limit = 10]
)
|
|
The constructor
Parameters:
string |
$BOName: |
The classname of the BO to render a feed for. |
string |
$title: |
The title of the feed. |
string |
$url: |
The base URL for the feed. |
string |
$description: |
The description of the feed. |
string |
$pubDate: |
The publish date, only used in Atom feeds. |
integer |
$id: |
The feed id, only used in Atom feeds. |
integer |
$limit: |
The amount of items to render in the feed. |
API Tags:
Information Tags:
Throws: | IllegalArguementException |
Since: | 1.0 |
Redefined in descendants as:
Method for adding a BO to the current feed
Parameters:
API Tags:
void addItem(
string
$title, string
$url, [string
$description = null], [string
$pubDate = null], [integer
$id = null]
)
|
|
Method for adding an item to a feed
Parameters:
string |
$title: |
The title of the feed. |
string |
$url: |
The base URL for the feed. |
string |
$description: |
The description of the feed. |
string |
$pubDate: |
The publish date, only used in Atom feeds. |
integer |
$id: |
The feed id, only used in Atom feeds. |
API Tags:
Information Tags:
Redefined in descendants as:
DOMElement createFeedElement(
string
$name, [string
$value = null]
)
|
|
Method for creating a new feed element
Parameters:
string |
$name: |
The name of the element. |
string |
$value: |
The value of the element. |
API Tags:
Information Tags:
void createLink(
DOMElement
$parent, string
$url
)
|
|
Method for creating link elements (note that Atom has a different format)
Parameters:
DOMElement |
$parent: |
The parent element. |
string |
$url: |
The URL for the link. |
API Tags:
Information Tags:
Redefined in descendants as:
void createRSSNode(
integer
$type, DOMElement
$parent, string
$title, string
$url, string
$description, [string
$pubDate = null], [integer
$id = null]
)
|
|
Method for creating an RSS node with a title, url and description
Parameters:
integer |
$type: |
Can be either (item|feed) to indicate the type of node we are creating. |
DOMElement |
$parent: |
The parent element. |
string |
$title: |
The title of the feed. |
string |
$url: |
The base URL for the feed. |
string |
$description: |
The description of the feed. |
string |
$pubDate: |
The publish date, only used in Atom feeds. |
integer |
$id: |
The feed id, only used in Atom feeds. |
API Tags:
Information Tags:
Since: | 1.0 |
Throws: | IllegalArguementException |
Redefined in descendants as:
void loadBOs(
integer
$limit, string
$sortBy
)
|
|
Method to load all of the BO items to the feed from the database, from the newest to the $limit provided
Parameters:
integer |
$limit: |
The amount of items to render in the feed. |
string |
$sortBy: |
The name of the field to sort the feed by. |
API Tags:
Information Tags:
Returns the formatted XML for the feed as a string
API Tags:
Information Tags:
void setFieldMappings(
string
$title, string
$url, [string
$description = null], [string
$pubDate = null], [integer
$id = null]
)
|
|
Method for mapping BO fieldnames to feed field names
Parameters:
string |
$title: |
The title of the feed. |
string |
$url: |
The base URL for the feed. |
string |
$description: |
The description of the feed. |
string |
$pubDate: |
The publish date, only used in Atom feeds. |
integer |
$id: |
The feed id, only used in Atom feeds. |
API Tags:
Information Tags:
|
|