Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

FeedCreator Class Reference
[FeedCreator]

Inheritance diagram for FeedCreator:

HtmlDescribable AtomCreator03 HTMLCreator MBOXCreator OPMLCreator PIECreator01 RSSCreator091 RSSCreator10 UniversalFeedCreator List of all members.

Detailed Description

FeedCreator is the abstract base implementation for concrete implementations that implement a specific format of syndication.

Author:
Kai Blankenhorn <kaib@bitfolge.de>
Since:
1.4

Definition at line 467 of file feedcreator.class.php.

Public Member Functions

 addItem ($item)
 Adds an FeedItem to the feed.
 _createGeneratorComment ()
 Creates a comment indicating the generator of this feed.
 _createAdditionalElements ($elements, $indentString="")
 Creates a string containing all additional elements specified in $additionalElements.
 _createStylesheetReferences ()
 createFeed ()
 Builds the feed's text.
 _generateFilename ()
 Generate a filename for the feed cache file.
 _redirect ($filename)
 
Since:
1.4 private

 useCached ($filename="", $timeout=3600)
 Turns on caching and checks if there is a recent version of this feed in the cache.
 saveFeed ($filename="", $displayContents=true)
 Saves this feed as a file on the local disk.

Static Public Member Functions

 iTrunc ($string, $length)
 Truncates a string to a certain length at the most sensible point.

Public Attributes

 $title
 Mandatory attributes of a feed.
 $description
 Mandatory attributes of a feed.
 $link
 Mandatory attributes of a feed.
 $syndicationURL
 Optional attributes of a feed.
 $image
 Optional attributes of a feed.
 $language
 Optional attributes of a feed.
 $copyright
 Optional attributes of a feed.
 $pubDate
 Optional attributes of a feed.
 $lastBuildDate
 Optional attributes of a feed.
 $editor
 Optional attributes of a feed.
 $editorEmail
 Optional attributes of a feed.
 $webmaster
 Optional attributes of a feed.
 $category
 Optional attributes of a feed.
 $docs
 Optional attributes of a feed.
 $ttl
 Optional attributes of a feed.
 $rating
 Optional attributes of a feed.
 $skipHours
 Optional attributes of a feed.
 $skipDays
 Optional attributes of a feed.
 $xslStyleSheet = ""
 The url of the external xsl stylesheet used to format the naked rss feed.
 $items = Array()
 private
 $contentType = "application/xml"
 This feed's MIME content type.
 $encoding = "ISO-8859-1"
 This feed's character encoding.
 $additionalElements = Array()
 Any additional elements to include as an assiciated array.


Member Function Documentation

FeedCreator::_createAdditionalElements elements,
indentString = ""
 

Creates a string containing all additional elements specified in $additionalElements.

Parameters:
elements array an associative array containing key => value pairs
indentString string a string that will be inserted before every generated line
Returns:
string the XML tags corresponding to $additionalElements

Definition at line 587 of file feedcreator.class.php.

Referenced by AtomCreator03::createFeed(), RSSCreator091::createFeed(), and RSSCreator10::createFeed().

FeedCreator::_createGeneratorComment  ) 
 

Creates a comment indicating the generator of this feed.

The format of this comment seems to be recognized by Syndic8.com.

Definition at line 575 of file feedcreator.class.php.

Referenced by OPMLCreator::createFeed(), AtomCreator03::createFeed(), RSSCreator091::createFeed(), and RSSCreator10::createFeed().

FeedCreator::_createStylesheetReferences  ) 
 

Definition at line 597 of file feedcreator.class.php.

Referenced by OPMLCreator::createFeed(), AtomCreator03::createFeed(), PIECreator01::createFeed(), RSSCreator091::createFeed(), and RSSCreator10::createFeed().

FeedCreator::_generateFilename  ) 
 

Generate a filename for the feed cache file.

The result will be $_SERVER["PHP_SELF"] with the extension changed to .xml. For example:

echo $_SERVER["PHP_SELF"]."\n"; echo FeedCreator::_generateFilename();

would produce:

/rss/latestnews.php latestnews.xml

Returns:
string the feed cache filename
Since:
1.4 private

Reimplemented in MBOXCreator, HTMLCreator, and JSCreator.

Definition at line 629 of file feedcreator.class.php.

Referenced by saveFeed(), and useCached().

FeedCreator::_redirect filename  ) 
 

Since:
1.4 private

Definition at line 643 of file feedcreator.class.php.

Referenced by saveFeed(), and useCached().

FeedCreator::addItem item  ) 
 

Adds an FeedItem to the feed.

Parameters:
object FeedItem $item The FeedItem to add to the feed. public

Definition at line 525 of file feedcreator.class.php.

FeedCreator::createFeed  ) 
 

Builds the feed's text.

Returns:
string the feed's complete text

Reimplemented in RSSCreator10, RSSCreator091, PIECreator01, AtomCreator03, MBOXCreator, OPMLCreator, HTMLCreator, and JSCreator.

Definition at line 610 of file feedcreator.class.php.

FeedCreator::iTrunc string,
length
[static]
 

Truncates a string to a certain length at the most sensible point.

First, if there's a '.' character near the end of the string, the string is truncated after this character. If there is no '.', the string is truncated after the last ' ' character. If the string is truncated, " ..." is appended. If the string is already shorter than $length, it is returned unchanged.

Parameters:
string string A string to be truncated.
int length the maximum length the string should be truncated to
Returns:
string the truncated string

Definition at line 542 of file feedcreator.class.php.

Referenced by HTMLCreator::createFeed(), and FeedHtmlField::output().

FeedCreator::saveFeed filename = "",
displayContents = true
 

Saves this feed as a file on the local disk.

After the file is saved, a redirect header may be sent to redirect the user to the newly created file.

Since:
1.4
Parameters:
filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()).
redirect boolean optional send an HTTP redirect header or not. If true, the user will be automatically redirected to the created file.

Definition at line 698 of file feedcreator.class.php.

References _generateFilename(), and _redirect().

FeedCreator::useCached filename = "",
timeout = 3600
 

Turns on caching and checks if there is a recent version of this feed in the cache.

If there is, an HTTP redirect header is sent. To effectively use caching, you should create the FeedCreator object and call this method before anything else, especially before you do the time consuming task to build the feed (web fetching, for example).

Since:
1.4
Parameters:
filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()).
timeout int optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour)

Definition at line 679 of file feedcreator.class.php.

References _generateFilename(), and _redirect().


Member Data Documentation

FeedCreator::$additionalElements = Array()
 

Any additional elements to include as an assiciated array.

All $key => $value pairs will be included unencoded in the feed in the form <$key>$value</$key> Again: No encoding will be used! This means you can invalidate or enhance the feed if $value contains markup. This may be abused to embed tags not implemented by the FeedCreator class used.

Definition at line 516 of file feedcreator.class.php.

FeedCreator::$category
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$contentType = "application/xml"
 

This feed's MIME content type.

Since:
1.4 private

Reimplemented in HTMLCreator, and JSCreator.

Definition at line 498 of file feedcreator.class.php.

FeedCreator::$copyright
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$description
 

Mandatory attributes of a feed.

Definition at line 472 of file feedcreator.class.php.

FeedCreator::$docs
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$editor
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$editorEmail
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$encoding = "ISO-8859-1"
 

This feed's character encoding.

Since:
1.6.1

Definition at line 505 of file feedcreator.class.php.

FeedCreator::$image
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$items = Array()
 

private

Definition at line 490 of file feedcreator.class.php.

FeedCreator::$language
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$lastBuildDate
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$link
 

Mandatory attributes of a feed.

Definition at line 472 of file feedcreator.class.php.

FeedCreator::$pubDate
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$rating
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$skipDays
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$skipHours
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$syndicationURL
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$title
 

Mandatory attributes of a feed.

Definition at line 472 of file feedcreator.class.php.

FeedCreator::$ttl
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$webmaster
 

Optional attributes of a feed.

Definition at line 478 of file feedcreator.class.php.

FeedCreator::$xslStyleSheet = ""
 

The url of the external xsl stylesheet used to format the naked rss feed.

Ignored in the output when empty.

Definition at line 484 of file feedcreator.class.php.


The documentation for this class was generated from the following file:
Generated on Fri Oct 27 12:26:41 2006 for BaseJumper by doxygen 1.3.9.1