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:
1. <?php
2. // $feed is an ezcFeed object
3. $author = $feed->add( 'author' );
4. $author->name = 'Guybrush Threepwood';
5. $author->email = 'guybrush@monkey-island.com';
6. $author->uri = 'http://example.com/~guybrush'; // ATOM only
7. ?>
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:
1. <?php
2. $authors = array();
3.
4. // $feed is an ezcFeed object
5. if ( isset( $feed->author ) )
6. {
7. foreach ( $feed->author as $author )
8. {
9. $authors[] = array(
10. 'name' => isset( $author->name ) ? $author->name : null,
11. 'uri' => isset( $author->uri ) ? $author->uri : null, // ATOM only
12. 'email' => isset( $author->email ) ? $author->email : null // ATOM only
13. );
14. }
15. }
16. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $category = $feed->add( 'category' );
4. $category->term = 'holiday';
5. $category->scheme = 'http://example.com/categories/holiday'; // scheme = RSS2 domain
6. $category->label = 'Holiday'; // ATOM only
7. ?>
Parse example:
1. <?php
2. $categories = array();
3.
4. // $feed is an ezcFeed object
5. if ( isset( $feed->category ) )
6. {
7. foreach ( $feed->category as $category )
8. {
9. $categories[] = array(
10. 'term' => isset( $category->term ) ? $category->term : null,
11. 'scheme' => isset( $category->scheme ) ? $category->scheme : null,
12. // scheme = RSS2 domain
13. 'label' => isset( $category->label ) ? $category->label : null // ATOM only
14. );
15. }
16. }
17. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $cloud = $feed->add( 'cloud' );
4. $cloud->domain = 'rpc.sys.com';
5. $cloud->port = 80;
6. $cloud->path = '/RPC2';
7. $cloud->registerProcedure = 'myCloud.rssPleaseNotify';
8. $cloud->protocol = 'xml-rpc';
9. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. if ( isset( $feed->cloud ) )
4. {
5. $cloud = $feed->cloud;
6. $domain = isset( $cloud->domain ) ? $cloud->domain : null;
7. $port = isset( $cloud->port ) ? $cloud->port : null;
8. $path = isset( $cloud->path ) ? $cloud->path : null;
9. $procedure = isset( $cloud->registerProcedure ) ? $cloud->registerProcedure : null;
10. $protocol = isset( $cloud->protocol ) ? $cloud->protocol : null;
11. }
12. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $contributor = $feed->add( 'contributor' );
4. $contributor->name = 'Guybrush Threepwood';
5. $contributor->email = 'guybrush@monkey-island.com';
6. $contributor->uri = 'http://example.com/~guybrush';
7. ?>
Parse example:
1. <?php
2. $contributors = array();
3.
4. // $feed is an ezcFeed object
5. if ( isset( $feed->contributor ) )
6. {
7. foreach ( $feed->contributor as $contributor )
8. {
9. $contributors[] = array(
10. 'name' => isset( $contributor->name ) ? $contributor->name : null,
11. 'uri' => isset( $contributor->uri ) ? $contributor->uri : null,
12. 'email' => isset( $contributor->email ) ? $contributor->email : null
13. );
14. }
15. }
16. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $feed->copyright = 'Copyright <company name>';
4. $feed->copyright->type = 'text'; // ATOM only, ignored in RSS1 and RSS2
5. $feed->copyright->language = 'de'; // ATOM only, ignored in RSS1 and RSS2
6. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. if ( isset( $feed->copyright ) )
4. {
5. $copyrightElement = $feed->copyright;
6. $copyright = $copyrightElement->text;
7. $type = isset( $copyrightElement->type ) ? $copyrightElement->type : null; // ATOM only
8. $language = isset( $copyrightElement->language ) ? $copyrightElement->language : null; // ATOM only
9. }
10. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $feed->description = 'Feed description';
4. $feed->description->type = 'text'; // ATOM only, ignored in RSS1 and RSS2
5. $feed->description->language = 'de'; // ATOM only, ignored in RSS1 and RSS2
6. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. if ( isset( $feed->description ) )
4. {
5. $descriptionElement = $feed->description;
6. $description = $descriptionElement->text;
7. $type = isset( $descriptionElement->type ) ? $descriptionElement->type : null; // ATOM only
8. $language = isset( $descriptionElement->language ) ? $descriptionElement->language : null; // ATOM only
9. }
10. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $feed->docs = 'http://www.rssboard.org/rss-specification';
4. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. $docs = isset( $feed->docs ) ? $feed->docs->__toString() : null;
4. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $generator = $feed->add( 'generator' );
4. $generator->name = 'eZ Components Feed';
5. $generator->url = 'http://ezcomponents.org/docs/tutorials/Feed';
6. $generator->version = '1.0';
7. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. if ( isset( $feed->generator ) )
4. {
5. $name = isset( $feed->generator->name ) ? $feed->generator->name : null;
6. $url = isset( $feed->generator->url ) ? $feed->generator->url : null; // ATOM only
7. $version = isset( $feed->generator->version ) ? $feed->generator->version : null; // ATOM only
8. }
9. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $feed->icon = 'http://example.com/favicon.ico';
4. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. $icon = isset( $feed->icon ) ? $feed->icon->__toString : null;
4. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $feed->id = 'ID value';
4. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. $id = isset( $feed->id ) ? $feed->id->__toString() : null;
4. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $image = $feed->add( 'image' );
4. $image->link = 'http://example.com/target_for_image_click.html';
5. $image->url = 'http://example.com/image.jpg'; // RSS1 and RSS2 only
6. $image->title = 'Click here to go to the link'; // RSS1 and RSS2 only
7. $image->width = 100; // RSS2 only
8. $image->height = 200; // RSS2 only
9. $image->description = 'This image is cool'; // RSS2 only
10. $image->about = 'http://example.com/image.jpg'; // RSS1 only
11. ?>
Parse example (RSS1 and RSS2):
1. <?php
2. // $feed is an ezcFeed object
3. if ( isset( $feed->image ) )
4. {
5. $image = $feed->image;
6. $link = isset( $image->link ) ? $image->link : null;
7. $url = isset( $image->url ) ? $image->url : null; // RSS1 and RSS2 only
8. $title = isset( $image->title ) ? $image->title : null; // RSS1 and RSS2 only
9. $width = isset( $image->width ) ? $image->width : null; // RSS2 only
10. $height = isset( $image->height ) ? $image->height : null; // RSS2 only
11. $description = isset( $image->description ) ? $image->description : null; // RSS2 only
12. $about = isset( $image->about ) ? $image->about : null; // RSS1 only
13. }
14. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $item = $feed->add( 'item' );
4.
5. // set $item properties, for example:
6. $item->title = 'Item title';
7. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. foreach ( $feed->item as $item )
4. {
5. // get $item properties, for example:
6. $title = isset( $item->title ) ? $item->title->__toString() : null;
7. }
8. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $feed->language = 'en';
4. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. $language = isset( $feed->language ) ? $feed->language->__toString() : null;
4. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $link = $feed->add( 'link' );
4. $link->href = 'http://example.com';
5. $link->rel = 'self'; // ATOM only
6. $link->type = 'text/html'; // ATOM only
7. $link->hreflang = 'en'; // ATOM only
8. $link->title = 'Link to the homepage'; // ATOM only
9. $link->length = 12345; // ATOM only
10. ?>
Parse example:
1. <?php
2. $links = array();
3.
4. // $feed is an ezcFeed object
5. foreach ( $feed->link as $link )
6. {
7. $links[] = array(
8. 'href' => isset( $link->href ) ? $link->href : null,
9. 'rel' => isset( $link->rel ) ? $link->rel : null, // ATOM only
10. 'type' => isset( $link->type ) ? $link->type : null, // ATOM only
11. 'hreflang' => isset( $link->hreflang ) ? $link->hreflang : null, // ATOM only
12. 'title' => isset( $link->title ) ? $link->title : null, // ATOM only
13. 'length' => isset( $link->length ) ? $link->length : null, // ATOM only
14. );
15. }
16. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $feed->published = time();
4. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. $published = isset( $feed->published ) ? $feed->published->date->format( 'c' ) : null;
4. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $feed->rating = '(PICS-1.1 "http://www.gcf.org/v2.5" labels
4. on "1994.11.05T08:15-0500"
5. exp "1995.12.31T23:59-0000"
6. for "http://www.greatdocs.com/foo.html"
7. by "George Sanderson, Jr."
8. ratings (suds 0.5 density 0 color/hue 1))';
9. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. $rating = isset( $feed->rating ) ? $feed->rating->__toString() : null;
4. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $skip = $feed->add( 'skipDays' );
4. $skip->days = array( 'Saturday', 'Sunday' );
5. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. $days = array( 'Monday' => false, /*...*/ 'Sunday' => false );
4. foreach ( $feed->skipDays->days as $skip )
5. {
6. $days[$skip] = true;
7. }
8. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $skip = $feed->add( 'skipHours' );
4. $skip->hours = array( 1, 2, 3, 4, 5 );
5. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. $hours = array( '0' => false, /*...*/ '24' => false );
4. foreach ( $feed->skipHours->hours as $skip )
5. {
6. $hours[$skip] = true;
7. }
8. ?>
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:
1. <?php
2. // $feed is an ezcFeed object
3. $textInput = $feed->add( 'textInput' );
4. $textInput->title = 'Text input title';
5. $textInput->description = 'Text input description';
6. $textInput->name = 'Text input name';
7. $textInput->link = 'Text input link';
8. $textInput->about = 'Text input link'; // RSS1 only, ignored in RSS2
9. ?>
Parse example:
1. <?php
2. // $feed is an ezcFeed object
3. if ( isset( $feed->textInput ) )
4. {
5. $textInput = $feed->textInput;
6. $title = isset( $textInput->title ) ? $textInput->title : null;
7. $description = isset( $textInput->description ) ? $textInput->description : null;
8. $name = isset( $textInput->name ) ? $textInput->name