FeedCreator Class Reference

Inheritance diagram for FeedCreator:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 _createAdditionalElements ($elements, $indentString="")
 _createGeneratorComment ()
 _createStylesheetReferences ()
 _generateFilename ()
 _redirect ($filename)
 addItem ($item)
 createFeed ()
 saveFeed ($filename="", $displayContents=true)
 useCached ($filename="", $timeout=3600)

Static Public Member Functions

 iTrunc ($string, $length)

Public Attributes

 $additionalElements = Array()
 $category
 $contentType = "application/xml"
 $copyright
 $description
 $docs
 $editor
 $editorEmail
 $encoding = "UTF-8"
 $image
 $items = Array()
 $language
 $lastBuildDate
 $link
 $pubDate
 $rating
 $skipDays
 $skipHours
 $syndicationURL
 $title
 $ttl
 $webmaster
 $xslStyleSheet = ""

Detailed Description

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


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 535 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 523 of file feedcreator.class.php.

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

FeedCreator::_createStylesheetReferences (  ) 

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

References $xml, and cssStyleSheet.

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 581 of file feedcreator.class.php.

References $_SERVER.

Referenced by saveFeed(), and useCached().

FeedCreator::_redirect ( filename  ) 

Since:
1.4 private

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

References die.

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 473 of file feedcreator.class.php.

References $item.

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 562 of file feedcreator.class.php.

Referenced by saveFeed().

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 490 of file feedcreator.class.php.

Referenced by HTMLCreator::createFeed(), MBOXCreator::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 643 of file feedcreator.class.php.

References _generateFilename(), _redirect(), and createFeed().

Here is the call graph for this function:

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 624 of file feedcreator.class.php.

References _generateFilename(), and _redirect().

Here is the call graph for this function:


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 464 of file feedcreator.class.php.

FeedCreator::$category

Definition at line 426 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 446 of file feedcreator.class.php.

FeedCreator::$copyright

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

FeedCreator::$description

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

FeedCreator::$docs

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

FeedCreator::$editor

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

FeedCreator::$editorEmail

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

FeedCreator::$encoding = "UTF-8"

This feed's character encoding.

Since:
1.6.1

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

FeedCreator::$image

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

FeedCreator::$items = Array()

private

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

FeedCreator::$language

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

FeedCreator::$lastBuildDate

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

FeedCreator::$link

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

FeedCreator::$pubDate

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

Referenced by RSSCreator091::createFeed().

FeedCreator::$rating

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

FeedCreator::$skipDays

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

FeedCreator::$skipHours

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

FeedCreator::$syndicationURL

Optional attributes of a feed.

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

FeedCreator::$title

Mandatory attributes of a feed.

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

Referenced by OPMLCreator::createFeed().

FeedCreator::$ttl

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

FeedCreator::$webmaster

Definition at line 426 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 432 of file feedcreator.class.php.


The documentation for this class was generated from the following file:
Generated on Wed Aug 22 19:34:33 2007 for bitweaver by  doxygen 1.5.2