Type: array(ezcFeedPersonElement).
One author of the feed.
Required in ATOM: one author must be present at feed-level if there is one
entry which does not have an author. Optional in RSS2 (recommended). Ignored
for RSS1 feeds.
Multiple authors can appear in ATOM (not recommended). Can appear only once
in RSS2 feeds.
ATOM has required elements: name. Optional elements: uri (ignored in
RSS2) and email.
In RSS2 the generated XML element value will be email (name).
Create example:
// $feed is an ezcFeed object
$author = $feed->add( 'author' );
$author->name = 'Guybrush Threepwood';
$author->email = 'guybrush@monkey-island.com';
$author->uri = 'http://example.com/~guybrush'; // ATOM only
The resulting ATOM XML element will be:
<author>
<name>Guybrush Threepwood</name>
<email>guybrush@monkey-island.com</email>
<uri>http://example.com/~guybrush</uri>
</author>
The resulting RSS2 XML element will be:
<managingEditor>guybrush@monkey-island.com (Guybrush Threepwood)</managingEditor>
Parse example:
$authors = array();
// $feed is an ezcFeed object
if ( isset( $feed->author ) )
{
foreach ( $feed->author as $author )
{
$authors[] = array(
'name' => isset( $author->name ) ? $author->name : null,
'uri' => isset( $author->uri ) ? $author->uri : null, // ATOM only
'email' => isset( $author->email ) ? $author->email : null // ATOM only
);
}
}
Equivalents: ezcFeed-author, ATOM-author, RSS1-none,
RSS2-managingEditor.
Type: array(ezcFeedCategoryElement).
A category for the feed.
Optional. Only ATOM and RSS2 feeds will have this element after
generating the feed. It will be ignored for RSS1 feeds.
Multiple categories can appear in ATOM and RSS2 feeds.
ATOM has one required attribute: term. It also has 2 optional attributes:
scheme (equivalent to RSS2 domain attribute), label. The label
attribute will be ignored for RSS2 feeds.
RSS2 has one optional attribute: domain (equivalent to ATOM scheme
attribute).
Create example:
// $feed is an ezcFeed object
$category = $feed->add( 'category' );
$category->term = 'holiday';
$category->scheme = 'http://example.com/categories/holiday'; // scheme = RSS2 domain
$category->label = 'Holiday'; // ATOM only
Parse example:
$categories = array();
// $feed is an ezcFeed object
if ( isset( $feed->category ) )
{
foreach ( $feed->category as $category )
{
$categories[] = array(
'term' => isset( $category->term ) ? $category->term : null,
'scheme' => isset( $category->scheme ) ? $category->scheme : null,
// scheme = RSS2 domain
'label' => isset( $category->label ) ? $category->label : null // ATOM only
);
}
}
Equivalents: ezcFeed-category, ATOM-category, RSS1-none,
RSS2-category.
Type: ezcFeedCloudElement.
Allows processes to register with a cloud to be notified of updates to the
channel, implementing a lightweight publish-subscribe protocol for RSS feeds.
Optional (not recommended). Only RSS2 feeds will have this element after
generating the feed. It will be ignored for RSS1 and ATOM.
Can appear only once.
Has the required attributes: domain, port, path, registerProcedure,
protocol.
Create example:
// $feed is an ezcFeed object
$cloud = $feed->add( 'cloud' );
$cloud->domain = 'rpc.sys.com';
$cloud->port = 80;
$cloud->path = '/RPC2';
$cloud->registerProcedure = 'myCloud.rssPleaseNotify';
$cloud->protocol = 'xml-rpc';
Parse example:
// $feed is an ezcFeed object
if ( isset( $feed->cloud ) )
{
$cloud = $feed->cloud;
$domain = isset( $cloud->domain ) ? $cloud->domain : null;
$port = isset( $cloud->port ) ? $cloud->port : null;
$path = isset( $cloud->path ) ? $cloud->path : null;
$procedure = isset( $cloud->registerProcedure ) ? $cloud->registerProcedure : null;
$protocol = isset( $cloud->protocol ) ? $cloud->protocol : null;
}
Equivalents: ezcFeed-cloud, ATOM-none, RSS1-none, RSS2-cloud.
Type: array(ezcFeedPersonElement).
One contributor of the feed.
Optional (not recommended). Only ATOM feeds will have this element after
generating the feed. It will be ignored for RSS1 and RSS2 feeds.
Multiple contributors can appear.
Required elements: name. Optional elements: uri, email.
Create example:
// $feed is an ezcFeed object
$contributor = $feed->add( 'contributor' );
$contributor->name = 'Guybrush Threepwood';
$contributor->email = 'guybrush@monkey-island.com';
$contributor->uri = 'http://example.com/~guybrush';
Parse example:
$contributors = array();
// $feed is an ezcFeed object
if ( isset( $feed->contributor ) )
{
foreach ( $feed->contributor as $contributor )
{
$contributors[] = array(
'name' => isset( $contributor->name ) ? $contributor->name : null,
'uri' => isset( $contributor->uri ) ? $contributor->uri : null,
'email' => isset( $contributor->email ) ? $contributor->email : null
);
}
}
Equivalents: ezcFeed-contributor, ATOM-contributor, RSS1-none,
RSS2-none.
Type: ezcFeedTextElement.
Copyright information for the feed.
Optional. Only ATOM and RSS2 feeds will have this element after
generating the feed. It will be ignored for RSS1 feeds.
Can appear only once.
ATOM has an optional attribute type with possible values text
(default), html, xhtml. This attribute will be ignored for RSS1 and
RSS2 feeds.
ATOM has an optional attribute xml:lang which specifies the language of
the text. A list of allowed languages can be found here:
RSS language codes. This attribute is accessed through ezcFeed as
language. This attribute will be ignored for RSS1 and RSS2 feeds.
Create example:
// $feed is an ezcFeed object
$feed->copyright = 'Copyright <company name>';
$feed->copyright->type = 'text'; // ATOM only, ignored in RSS1 and RSS2
$feed->copyright->language = 'de'; // ATOM only, ignored in RSS1 and RSS2
Parse example:
// $feed is an ezcFeed object
if ( isset( $feed->copyright ) )
{
$copyrightElement = $feed->copyright;
$copyright = $copyrightElement->text;
$type = isset( $copyrightElement->type ) ? $copyrightElement->type : null; // ATOM only
$language = isset( $copyrightElement->language ) ? $copyrightElement->language : null; // ATOM only
}
Equivalents: ezcFeed-copyright, ATOM-rights, RSS1-none,
RSS2-copyright.
Type: ezcFeedTextElement.
A short description of the feed.
Required.
Can appear only once.
ATOM has an optional attribute type with possible values text
(default), html, xhtml. This attribute will be ignored for RSS1 and
RSS2 feeds.
ATOM has an optional attribute xml:lang which specifies the language of
the text. A list of allowed languages can be found here:
RSS language codes. This attribute is accessed through ezcFeed as
language. This attribute will be ignored for RSS1 and RSS2 feeds.
Create example:
// $feed is an ezcFeed object
$feed->description = 'Feed description';
$feed->description->type = 'text'; // ATOM only, ignored in RSS1 and RSS2
$feed->description->language = 'de'; // ATOM only, ignored in RSS1 and RSS2
Parse example:
// $feed is an ezcFeed object
if ( isset( $feed->description ) )
{
$descriptionElement = $feed->description;
$description = $descriptionElement->text;
$type = isset( $descriptionElement->type ) ? $descriptionElement->type : null; // ATOM only
$language = isset( $descriptionElement->language ) ? $descriptionElement->language : null; // ATOM only
}
Equivalents: ezcFeed-description, ATOM-subtitle, RSS1-description,
RSS2-description.
Type: ezcFeedTextElement.
An URL that points to the documentation for the format used in the feed file.
Optional. Only RSS2 feeds will have this element after generating the feed.
It will be ignored for RSS1 and ATOM feeds.
Can appear only once.
Create example:
// $feed is an ezcFeed object
$feed->docs = 'http://www.rssboard.org/rss-specification';
Parse example:
// $feed is an ezcFeed object
$docs = isset( $feed->docs ) ? $feed->docs->__toString() : null;
Equivalents: ezcFeed-docs, ATOM-none, RSS1-none, RSS2-docs.
Type: ezcFeedGeneratorElement.
Indicates the software used to generate the feed.
Optional. Only ATOM and RSS2 feeds will have this element after
generating the feed. It will be ignored for RSS1 feeds.
Can appear only once.
ATOM has 2 optional attributes: url, version. These attributes are
used in RSS2 to generate the string name version (url). This element
and its attributes will be filled automatically by ezcFeed when generating
the feed with the values eZComponents Feed,
http://ezcomponents.org/docs/tutorials/Feed and <version>
respectively, where the version is the current version of the Feed component
(dev for pre-alpha1).
RSS2 will get this value automatically when generating the feed:
eZ Components Feed <version> (http://ezcomponents.org/docs/tutorials/Feed),
where the version is the current version of the Feed component (dev for
pre-alpha1)
Create example - this is automatically done by ezcFeed when calling the
generate() method:
// $feed is an ezcFeed object
$generator = $feed->add( 'generator' );
$generator->name = 'eZ Components Feed';
$generator->url = 'http://ezcomponents.org/docs/tutorials/Feed';
$generator->version = '1.0';
Parse example:
// $feed is an ezcFeed object
if ( isset( $feed->generator ) )
{
$name = isset( $feed->generator->name ) ? $feed->generator->name : null;
$url = isset( $feed->generator->url ) ? $feed->generator->url : null; // ATOM only
$version = isset( $feed->generator->version ) ? $feed->generator->version : null; // ATOM only
}
Equivalents: ezcFeed-generator, ATOM-generator, RSS1-none,
RSS2-generator.
Type: ezcFeedImageElement.
An icon for a feed, similar with favicon.ico for websites.
Optional. Only ATOM feeds will have this element after generating the
feed. It will be ignored for RSS1 and RSS2 feeds.
Can appear only once.
Create example:
// $feed is an ezcFeed object
$feed->icon = 'http://example.com/favicon.ico';
Parse example:
// $feed is an ezcFeed object
$icon = isset( $feed->icon ) ? $feed->icon->__toString : null;
Equivalents: ezcFeed-icon, ATOM-icon, RSS1-none, RSS2-none.
Type: ezcFeedIdElement.
A universally unique and permanent URI for a feed. For example, it can be an
Internet domain name.
Required. Only RSS1 and ATOM feeds will have this element after
generating the feed. It will be ignored for RSS2 feeds.
Can appear only once.
Create example:
// $feed is an ezcFeed object
$feed->id = 'ID value';
Parse example:
// $feed is an ezcFeed object
$id = isset( $feed->id ) ? $feed->id->__toString() : null;
Equivalents: ezcFeed-id, ATOM-id, RSS1-about, RSS2-none.
Type: ezcFeedImageElement.
An image associated with the feed.
Optional.
Can appear only once.
RSS1 has the required attribute about, which should have the same value
as the url sub-element.
RSS1 and RSS2 have 3 required sub-elements: title, link, url
(same for both feed types). These attributes will be ignored for ATOM feeds.
RSS2 has 3 optional sub-elements: width, height, description. These
attributes will be ignored for RSS1 and ATOM feeds.
Create example:
// $feed is an ezcFeed object
$image = $feed->add( 'image' );
$image->link = 'http://example.com/target_for_image_click.html';
$image->url = 'http://example.com/image.jpg'; // RSS1 and RSS2 only
$image->title = 'Click here to go to the link'; // RSS1 and RSS2 only
$image->width = 100; // RSS2 only
$image->height = 200; // RSS2 only
$image->description = 'This image is cool'; // RSS2 only
$image->about = 'http://example.com/image.jpg'; // RSS1 only
Parse example (RSS1 and RSS2):
// $feed is an ezcFeed object
if ( isset( $feed->image ) )
{
$image = $feed->image;
$link = isset( $image->link ) ? $image->link : null;
$url = isset( $image->url ) ? $image->url : null; // RSS1 and RSS2 only
$title = isset( $image->title ) ? $image->title : null; // RSS1 and RSS2 only
$width = isset( $image->width ) ? $image->width : null; // RSS2 only
$height = isset( $image->height ) ? $image->height : null; // RSS2 only
$description = isset( $image->description ) ? $image->description : null; // RSS2 only
$about = isset( $image->about ) ? $image->about : null; // RSS1 only
}
Equivalents: ezcFeed-image, ATOM-logo, RSS1-image, RSS2-image.
Type: array(ezcFeedEntryElement).
Feed entry.
Required for RSS1 and RSS2 feeds. Optional (recommended) for ATOM
feeds.
Multiple entries can appear.
Create example:
// $feed is an ezcFeed object
$item = $feed->add( 'item' );
// set $item properties, for example:
$item->title = 'Item title';
Parse example:
// $feed is an ezcFeed object
foreach ( $feed->item as $item )
{
// get $item properties, for example:
$title = isset( $item->title ) ? $item->title->__toString() : null;
}
Equivalents: ezcFeed-item, ATOM-entry, RSS1-item, RSS2-item.
Type: ezcFeedTextElement.
The language for the feed.
Optional (recommended). Only RSS2 feeds will have this element after
generating the feed. It will be ignored for RSS1 and ATOM feeds.
Can appear only once.
In ATOM you can assign the language to each element instead.
A list of allowed languages can be found here: RSS language codes.
Create example:
// $feed is an ezcFeed object
$feed->language = 'en';
Parse example:
// $feed is an ezcFeed object
$language = isset( $feed->language ) ? $feed->language->__toString() : null;
Equivalents: ezcFeed-language, ATOM-xml:lang for each element, RSS1-none,
RSS2-language.
Type: array(ezcFeedLinkElement).
An URL to the HTML website corresponding to the feed.
Required for all feed types. In ATOM a link back to the feed itself must be
present (with rel="self").
Multiple links can appear in ATOM (not recommended).
Required attributes: href. Optional attributes for ATOM: rel (possible
values: alternate (default), enclosure, related, self,
via), type, hreflang, title, length.
A maximum of one link with rel="alternate" can appear per type and
hreflang.
These attributes will be ignored for RSS1 and RSS2 feeds.
Create example:
// $feed is an ezcFeed object
$link = $feed->add( 'link' );
$link->href = 'http://example.com';
$link->rel = 'self'; // ATOM only
$link->type = 'text/html'; // ATOM only
$link->hreflang = 'en'; // ATOM only
$link->title = 'Link to the homepage'; // ATOM only
$link->length = 12345; // ATOM only
Parse example:
$links = array();
// $feed is an ezcFeed object
foreach ( $feed->link as $link )
{
$links[] = array(
'href' => isset( $link->href ) ? $link->href : null,
'rel' => isset( $link->rel ) ? $link->rel : null, // ATOM only
'type' => isset( $link->type ) ? $link->type : null, // ATOM only
'hreflang' => isset( $link->hreflang ) ? $link->hreflang : null, // ATOM only
'title' => isset( $link->title ) ? $link->title : null, // ATOM only
'length' => isset( $link->length ) ? $link->length : null, // ATOM only
);
}
Equivalents: ezcFeed-link, ATOM-link, RSS1-link, RSS2-link.
Type: ezcFeedDateElement.
The time the feed was published.
Optional (not recommended). Only RSS2 feeds will have this element after
generating the feed. It will be ignored for RSS1 and ATOM feeds.
Can appear only once.
Can be assigned with an integer timestamp, a string date or a DateTime object.
Create example:
// $feed is an ezcFeed object
$feed->published = time();
Parse example:
// $feed is an ezcFeed object
$published = isset( $feed->published ) ? $feed->published->date->format( 'c' ) : null;
Other formats can be used also instead of 'c', see the documentation for
date_format().
Equivalents: ezcFeed-published, ATOM-none, RSS1-none, RSS2-pubDate.
Type: ezcFeedTextElement.
The PICS rating for the channel.
Optional (not recommended). Only RSS2 feeds will have this element after
generating the feed. It will be ignored for RSS1 and ATOM feeds.
Can appear only once.
Create example:
// $feed is an ezcFeed object
$feed->rating = '(PICS-1.1 "http://www.gcf.org/v2.5" labels
on "1994.11.05T08:15-0500"
exp "1995.12.31T23:59-0000"
for "http://www.greatdocs.com/foo.html"
by "George Sanderson, Jr."
ratings (suds 0.5 density 0 color/hue 1))';
Parse example:
// $feed is an ezcFeed object
$rating = isset( $feed->rating ) ? $feed->rating->__toString() : null;
Equivalents: ezcFeed-rating, ATOM-none, RSS1-none, RSS2-rating.
Type: ezcFeedSkipDaysElement.
A hint for aggregators telling them which days they can skip when reading the
feed.
Optional (not recommended). Only RSS2 feeds will have this element after
generating the feed. It will be ignored for RSS1 and ATOM feeds.
Can appear only once.
Can have up to 7 day elements, each with a value from Monday to Sunday.
Create example:
// $feed is an ezcFeed object
$skip = $feed->add( 'skipDays' );
$skip->days = array( 'Saturday', 'Sunday' );
Parse example:
// $feed is an ezcFeed object
$days = array( 'Monday' => false, /*...*/ 'Sunday' => false );
foreach ( $feed->skipDays->days as $skip )
{
$days[$skip] = true;
}
Equivalents: ezcFeed-skipDays, ATOM-none, RSS1-none, RSS2-skipDays.
Type: ezcFeedSkipHoursElement.
A hint for aggregators telling them which hours they can skip when reading the
feed.
Optional (not recommended). Only RSS2 feeds will have this element after
generating the feed. It will be ignored for RSS1 and ATOM feeds.
Can appear only once.
Can have up to 24 hour elements, each with an integer value from 0
(midnight) to 23. The value 24 can also be used for midnight.
Create example:
// $feed is an ezcFeed object
$skip = $feed->add( 'skipHours' );
$skip->hours = array( 1, 2, 3, 4, 5 );
Parse example:
// $feed is an ezcFeed object
$hours = array( '0' => false, /*...*/ '24' => false );
foreach ( $feed->skipHours->hours as $skip )
{
$hours[$skip] = true;
}
Equivalents: ezcFeed-skipHours, ATOM-none, RSS1-none, RSS2-skipHours.
Type: ezcFeedTextInputElement.
Specifies a text input box that can be displayed with the feed.
Optional (not recommended). Only RSS1 and RSS2 feeds will have this
element after generating the feed. It will be ignored for ATOM feeds.
Can appear only once.
For RSS1 it has the required attribute about, which should have the same
value as the link sub-element.
Has four required sub-elements: title, description, name, link (same
for RSS1 and RSS2).
Create example:
// $feed is an ezcFeed object
$textInput = $feed->add( 'textInput' );
$textInput->title = 'Text input title';
$textInput->description = 'Text input description';
$textInput->name = 'Text input name';
$textInput->link = 'Text input link';
$textInput->about = 'Text input link'; // RSS1 only, ignored in RSS2
Parse example:
// $feed is an ezcFeed object
if ( isset( $feed->textInput ) )
{
$textInput = $feed->textInput;
$title = isset( $textInput->title ) ? $textInput->title : null;
$description = isset( $textInput->description ) ? $textInput->description : null;
$name = isset( $textInput->name ) ? $textInput->name : null;
$link = isset( $textInput->link ) ? $textInput->link : null;
$about = isset( $textInput->about ) ? $textInput->about : null; // RSS1 only
}
Equivalents: ezcFeed-textInput, ATOM-none, RSS1-textinput,
RSS2-textInput.
Type: ezcFeedTextElement.
Human readable title for the feed. For example, it can be the same as the
website title.
Required.
Can appear only once.
ATOM has an optional attribute type with possible values text
(default), html, xhtml. This attribute will be ignored for RSS1 and
RSS2 feeds.
ATOM has an optional attribute xml:lang which specifies the language of
the text. A list of allowed languages can be found here:
RSS language codes. This attribute is accessed through ezcFeed as language.
This attribute will be ignored for RSS1 and RSS2 feeds.
Create example:
// $feed is an ezcFeed object
$feed->title = 'Feed title';
$feed->title->type = 'text'; // ATOM only, ignored in RSS1 and RSS2
$feed->title->language = 'de'; // ATOM only, ignored in RSS1 and RSS2
Parse example:
// $feed is an ezcFeed object
if ( isset( $feed->title ) )
{
$element = $feed->title;
$title = isset( $element->text ) ? $element->text : null;
$type = isset( $element->type ) ? $element->type : null; // ATOM only
$language = isset( $element->language ) ? $element->language : null; // ATOM only
}
Equivalents: ezcFeed-title, ATOM-title, RSS1-title, RSS2-title.
Type: ezcFeedTextElement.
Number of minutes that indicates how long a channel can be cached before
refreshing from the source.
Optional (not recommended). Only RSS2 feeds will have this element after
generating the feed. It will be ignored RSS1 and ATOM feeds.
Can appear only once.
Create example:
// $feed is an ezcFeed object
$feed->ttl = '60'; // minutes
Parse example:
// $feed is an ezcFeed object
$ttl = isset( $feed->ttl ) ? $feed->ttl->__toString() : null;
Equivalents: ezcFeed-ttl, ATOM-none, RSS1-none, RSS2-ttl.
Type: ezcFeedDateElement.
The last time the feed was updated.
Required for ATOM. Optional for RSS2. It will be ignored for RSS1
feeds. ezcFeed will add automatically the updated element with the value the
current time in ATOM and RSS2 feeds.
Can appear only once.
Can be assigned with an integer timestamp, a string date or a DateTime object.
Create example:
// $feed is an ezcFeed object
$feed->updated = 'Tue, 10 Jun 2003 04:00:00 GMT';
Parse example:
// $feed is an ezcFeed object
$updated = isset( $feed->updated ) ? $feed->updated->date->format( 'c' ) : null;
Other formats can be used also instead of 'c', see the documentation for
date_format().
Equivalents: ezcFeed-updated, ATOM-updated, RSS1-none, RSS2-lastBuildDate.
Type: ezcFeedPersonElement.
The email address of the webmaster responsible for the feed.
Optional (not recommended). Only RSS2 feeds will have this element after
generating the feed. It will be ignored for RSS1 and ATOM feeds.
Can appear only once.
It is a good practice to include the name and email of the webmaster,
for example john.doe@example.com (John Doe).
Create example:
// $feed is an ezcFeed object
$webMaster = $feed->add( 'webMaster' );
$webMaster->name = 'John Doe';
$webMaster->email = 'john.doe@example.com';
Parse example:
// $feed is an ezcFeed object
if ( isset( $feed->webMaster ) )
{
$name = isset( $feed->webMaster->name ) ? $feed->webMaster->name : null;
}
Equivalents: ezcFeed-webMaster, ATOM-none, RSS1-none, RSS2-webMaster.
Type: array(ezcFeedPersonElement).
One author of the feed entry.
Required in ATOM: one author must be present in each entry in case the feed
does not contain an author. Optional in RSS2 (recommended). Ignored for
RSS1 feeds.
Multiple authors can appear in ATOM (not recommended). Can appear only once
in RSS2 feeds.
ATOM has required elements: name. Optional elements: uri (ignored in
RSS2) and email.
In RSS2 the generated XML element value will be email (name).
Create example:
// $item is an ezcFeedEntryElement object
$author = $item->add( 'author' );
$author->name = 'Guybrush Threepwood';
$author->email = 'guybrush@monkey-island.com';
$author->uri = 'http://example.com/~guybrush'; // ATOM only
The resulting ATOM XML element will be:
<author>
<name>Guybrush Threepwood</name>
<email>guybrush@monkey-island.com</email>
<uri>http://example.com/~guybrush</uri>
</author>
The resulting RSS2 XML element will be:
<author>guybrush@monkey-island.com (Guybrush Threepwood)</author>
Parse example:
$authors = array();
// $item is an ezcFeedEntryElement object
if ( isset( $item->author ) )
{
foreach ( $item->author as $author )
{
$authors[] = array(
'name' => isset( $author->name ) ? $author->name : null,
'uri' => isset( $author->uri ) ? $author->uri : null, // ATOM only
'email' => isset( $author->email ) ? $author->email : null // ATOM only
);
}
}
Equivalents: ezcFeed-item-author, ATOM-entry-author, RSS1-none,
RSS2-item-author.
Type: array(ezcFeedCategoryElement).
A category for the feed entry.
Optional. Only ATOM and RSS2 feeds will have this element after
generating the feed. It will be ignored for RSS1 feeds.
Multiple categories can appear in ATOM and RSS2 feeds.
ATOM has one required attribute: term. Optional attributes: scheme
(domain in RSS2) and label (ignored in RSS2).
Create example:
// $item is an ezcFeedEntryElement object
$category = $item->add( 'category' );
$category->term = 'holiday';
$category->scheme = 'http://example.com/categories/holiday'; // scheme = RSS2 domain
$category->label = 'Holiday'; // ATOM only
Parse example:
$categories = array();
// $item is an ezcFeedEntryElement object
if ( isset( $item->category ) )
{
foreach ( $item->category as $category )
{
$categories[] = array(
'term' => isset( $category->term ) ? $category->term : null,
'scheme' => isset( $category->scheme ) ? $category->scheme : null, // scheme = RSS2 domain
'label' => isset( $category->label ) ? $category->label : null // ATOM only
);
}
}
Equivalents: ezcFeed-item-category, ATOM-entry-category, RSS1-none,
RSS2-item-category.
Type: ezcFeedTextElement.
A link to a webpage for comments.
Optional (not recommended). Only RSS2 feeds will have this element after
generating the feed. It will be ignored for RSS1 and ATOM feeds.
Can appear only once.
Create example:
// $item is an ezcFeedEntryElement object
$item->comments = 'http://www.example.com/comments.php';
Parse example:
// $item is an ezcFeedEntryElement object
$comments = isset( $item->comments ) ? $item->comments->__toString() : null;
Equivalents: ezcFeed-item-comments, ATOM-none, RSS1-none,
RSS2-item-comments.
Type: ezcFeedContentElement.
A short description for the feed item.
Optional (not recommended). Only ATOM feeds will have this element after
generating the feed. It will be ignored for RSS1 and RSS2 feeds. Can be
substituted with description (recommended).
Can appear only once.
Has an optional attribute type with possible values text (default),
html, xhtml, or other mime values, depending on the data it contains.
Has an optional attribute src which specifies the URI where the full content
is located.
Has an optional attribute xml:lang which specifies the language of the text.
This attribute is accessed through ezcFeed as language. A list of allowed
languages can be found here: RSS language codes.
If src is present, the type attribute, if present, is the media type of the
content.
Otherwise, if the type attribute ends in +xml or /xml, then an XML
document of this type is contained inline.
Otherwise, if the type attribute starts with text, then an escaped document
of this type is contained inline.
Otherwise, a base64 encoded document of the indicated media type is contained
inline.
Create example:
// $item is an ezcFeedEntryElement object
$item->content = 'Content';
$item->content->type = 'text';
$item->content->language = 'de';
$item->content->src = 'http://example.com/content_src.html';
Parse example:
// $item is an ezcFeedEntryElement object
if ( isset( $item->content ) )
{
$contentElement = $item->content;
$content = $descriptionElement->text;
$type = isset( $contentElement->type ) ? $contentElement->type : null;
$language = isset( $contentElement->language ) ? $contentElement->language : null;
$src = isset( $contentElement->src ) ? $contentElement->src : null;
}
Equivalents: ezcFeed-item-content/ezcFeed-item-description,
ATOM-entry-content, RSS1-none, RSS2-none.
Type: array(ezcFeedPersonElement).
One contributor of the feed entry.
Optional (not recommended). Only ATOM feeds will have this element after
generating the feed. It will be ignored for RSS1 and RSS2 feeds.
Multiple contributors can appear.
Required elements: name. Optional elements: uri, email.
Create example:
// $item is an ezcFeedEntryElement object
$contributor = $item->add( 'contributor' );
$contributor->name = 'Guybrush Threepwood';
$contributor->uri = 'http://example.com/~guybrush';
$contributor->email = 'guybrush@monkey-island.com';
Parse example:
$contributors = array();
// $item is an ezcFeedEntryElement object
if ( isset( $item->contributor ) )
{
foreach ( $item->contributor as $contributor )
{
$contributors[] = array(
'name' => isset( $contributor->name ) ? $contributor->name : null,
'uri' => isset( $contributor->uri ) ? $contributor->uri : null,
'email' => isset( $contributor->email ) ? $contributor->email : null
);
}
}
Equivalents: ezcFeed-item-contributor, ATOM-entry-contributor,
RSS1-none, RSS2-none.
Type: ezcFeedTextElement.
Copyright information for the feed entry.
Optional. Only ATOM feeds will have this element after generating the feed.
It will be ignored for RSS1 and RSS2 feeds. For RSS2 the copyright is
specified for the whole feed, not for any feed items (see
ezcFeed-copyright).
Can appear only once.
ATOM has an optional attribute type with possible values text
(default), html, xhtml. This attribute will be ignored for RSS1 and
RSS2 feeds.
ATOM has an optional attribute xml:lang which specifies the language of
the text. A list of allowed languages can be found here:
RSS language codes. This attribute is accessed through ezcFeed as
language. This attribute will be ignored for RSS1 and RSS2 feeds.
Create example:
// $item is an ezcFeedEntryElement object
$item->copyright = 'Copyright <company name>';
$item->copyright->type = 'text'; // ATOM only
$item->copyright->language = 'de'; // ATOM only
Parse example:
// $item is an ezcFeedEntryElement object
if ( isset( $item->copyright ) )
{
$copyrightElement = $item->copyright;
$copyright = $copyrightElement->text;
$type = isset( $copyrightElement->type ) ? $copyrightElement->type : null; // ATOM only
$language = isset( $copyrightElement->language ) ? $copyrightElement->language : null; // ATOM only
}
Equivalents: ezcFeed-item-copyright, ATOM-entry-rights, RSS1-none,
RSS2-none (RSS2-copyright for the whole feed).
Type: ezcFeedTextElement.
A short description of the feed item.
Required. In ATOM it can be substituted with ATOM-entry-content (not
recommended) (see ezcFeed-item-content).
Can appear only once.
ATOM has an optional attribute type with possible values text
(default), html, xhtml. This attribute will be ignored for RSS1 and
RSS2 feeds.
ATOM has an optional attribute xml:lang which specifies the language of
the text. A list of allowed languages can be found here:
RSS language codes. This attribute is accessed through ezcFeed as
language. This attribute will ignored for RSS1 and RSS2 feeds.
Create example:
// $item is an ezcFeedEntryElement object
$item->description = 'Feed description';
$item->description->type = 'text'; // ATOM only, ignored in RSS1 and RSS2
$item->description->language = 'de'; // ATOM only, ignored in RSS1 and RSS2
Parse example:
// $item is an ezcFeedEntryElement object
if ( isset( $item->description ) )
{
$desc = $item->description;
$description = $desc->text;
$type = isset( $desc->type ) ? $desc->type : null; // ATOM only
$language = isset( $desc->language ) ? $desc->language : null; // ATOM only
}
Equivalents: ezcFeed-item-description, ATOM-entry-summary,
RSS1-item-description, RSS2-item-description.
Type: array(ezcFeedEnclosureElement).
A link to a multimedia file attached to the feed item.
Optional. Only RSS2 feeds will have this element after generating the feed.
It will be ignored for RSS1. For ATOM feeds the enclosure elements will
be converted to ATOM-entry-link elements with the attribute
rel="enclosure".
Can appear only once.
Has 3 required attributes: url, length, type.
Create example:
// $item is an ezcFeedEntryElement object
$enclosure = $item->add( 'enclosure' );
$enclosure->url = 'http://example.com/media/episode_001.mp3';
$enclosure->length = 49099054; // bytes
$enclosure->type = 'audio/x-mp3';
RSS2 output:
<enclosure url="http://example.com/media/episode_001.mp3" length="49099054" type="audio/x-mp3"/>
ATOM output:
<link href="http://example.com/media/episode_001.mp3" rel="enclosure" length="49099054" type="audio/x-mp3"/>
Parse example (RSS2):
// $item is an ezcFeedEntryElement object
if ( isset( $item->enclosure ) )
{
$enclosure = $item->enclosure[0];
$url = isset( $enclosure->url ) ? $enclosure->url : null;
$length = isset( $enclosure->length ) ? $enclosure->length : null;
$type = isset( $enclosure->type ) ? $enclosure->type : null;
}
Equivalents: ezcFeed-item-enclosure, ATOM-none (ATOM-entry-link for
similar functionality), RSS1-none, RSS2-item-enclosure.
Type: ezcFeedIdElement.
A unique identifier in respect to other id values of entries in the feed. It
identifies the entry.
Required for ATOM and RSS1. Optional for RSS2 (recommended).
RSS2 has the optional attribute isPermLink. This attribute is ignored for
RSS1 and ATOM.
Can appear only once.
Create example:
// $item is an ezcFeedEntryElement object
$item->id = 'ID value';
$item->id->isPermLink = false; // RSS2 only, it will be ignored for RSS1 and ATOM
Parse example:
// $item is an ezcFeedEntryElement object
if ( isset( $item->id ) )
{
$id = isset( $feed->id->id ) : $feed->id->id : null;
$isPermLink = isset( $feed->id->isPermLink ) ? $feed->id->isPermLink : null; // RSS2 only
}
Equivalents: ezcFeed-item-id, ATOM-entry-id, RSS1-item-about,
RSS2-item-guid.
Type: array(ezcFeedLinkElement).
A link to a resource related to the feed entry.
Required.
Multiple links can appear in ATOM (not recommended). Can appear only once
in RSS1 and RSS2 feeds.
Enclosures of media files (used mainly for podcasts) can be added with this
element. In RSS2 use ezcFeed-item-enclosure. RSS1 does not support
enclosures.
ATOM has required attributes: href. Optional attributes: rel (possible
values: alternate (default), enclosure, related, self,
via), type, hreflang, title, length.
A maximum of one link with rel="alternate" can appear per type and
hreflang.
Recommended only one rel="enclosure" link to keep compatibility with
RSS2 enclosure.
These attributes are ignored for RSS1 and RSS2 feeds.
Create example:
// $item is an ezcFeedEntryElement object
$link = $item->add( 'link' );
$link->href = 'http://example.com';
$link->rel = 'self'; // ATOM only
$link->type = 'text/html'; // ATOM only
$link->hreflang = 'en'; // ATOM only
$link->title = 'Link to the article'; // ATOM only
$link->length = '20:14'; // ATOM only
Parse example:
$links = array();
// $item is an ezcFeedEntryElement object
foreach ( $item->link as $link )
{
$links[] = array(
'href' => isset( $link->href ) ? $link->href : null,
'rel' => isset( $link->rel ) ? $link->rel : null, // ATOM only
'type' => isset( $link->type ) ? $link->type : null, // ATOM only
'hreflang' => isset( $link->hreflang ) ? $link->hreflang : null, // ATOM only
'title' => isset( $link->title ) ? $link->title : null, // ATOM only
'length' => isset( $link->length ) ? $link->length : null, // ATOM only
);
}
Equivalents: ezcFeed-item-link/ezcFeed-item-enclosure,
ATOM-entry-link, RSS1-item-link, RSS2-item-link/
RSS2-item-enclosure.
Type: ezcFeedTextElement.
Human readable title for the feed item.
Required.
Can appear only once.
ATOM has an optional attribute type with possible values text
(default), html, xhtml. This attribute will be ignored for RSS1 and
RSS2 feeds.
ATOM has an optional attribute xml:lang which specifies the language of
the text. A list of allowed languages can be found here:
RSS language codes. This attribute is accessed through ezcFeed as
language. This attribute will be ignored for RSS1 and RSS2 feeds.
Create example:
// $item is an ezcFeedEntryElement object
$item->title = 'Feed title';
$item->title->type = 'text'; // ATOM only, ignored in RSS1 and RSS2
$item->title->language = 'de'; // ATOM only, ignored in RSS1 and RSS2
Parse example:
// $item is an ezcFeedEntryElement object
if ( isset( $item->title ) )
{
$titleElement = $item->title;
$title = $titleElement->text;
$type = isset( $titleElement->type ) ? $titleElement->type : null; // ATOM only
$language = isset( $titleElement->language ) ? $titleElement->language : null; // ATOM only
}
Equivalents: ezcFeed-item-title, ATOM-entry-title, RSS1-item-title,
RSS2-item-title.
Type: ezcFeedDateElement.
The last time the feed entry was updated.
Required. Only ATOM feeds will have this element after generating the
feed. It will be ignored for RSS1 and RSS2 feeds.
Can appear only once.
Can be assigned with an integer timestamp, a string date or a DateTime object.
Create example:
// $item is an ezcFeedEntryElement object
$item->updated = 'Tue, 10 Jun 2003 04:00:00 GMT';
Parse example:
// $item is an ezcFeedEntryElement object
$updated = isset( $item->updated ) ? $item->updated->date->format( 'c' ) : null;
Equivalents: ezcFeed-item-updated, ATOM-entry-updated, RSS1-none,
RSS2-none.