Abstract Class FeedCreator

Description

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

Located in /de/bitfolge/feedcreator/feedcreator.php (line 459)

HtmlDescribable
   |
   --FeedCreator
Direct descendents
Class Description
 class UniversalFeedCreator UniversalFeedCreator lets you choose during runtime which format to build.
 class RSSCreator10 RSSCreator10 is a FeedCreator that implements RDF Site Summary (RSS) 1.0.
 class RSSCreator091 RSSCreator091 is a FeedCreator that implements RSS 0.91 Spec, revision 3.
 class PIECreator01 PIECreator01 is a FeedCreator that implements the emerging PIE specification, as in http://intertwingly.net/wiki/pie/Syntax.
 class AtomCreator03 AtomCreator03 is a FeedCreator that implements the atom specification, as in http://www.intertwingly.net/wiki/pie/FrontPage.
 class MBOXCreator MBOXCreator is a FeedCreator that implements the mbox format as described in http://www.qmail.org/man/man5/mbox.html
 class OPMLCreator OPMLCreator is a FeedCreator that implements OPML 1.0.
 class HTMLCreator HTMLCreator is a FeedCreator that writes an HTML feed file to a specific location, overriding the createFeed method of the parent FeedCreator.
Variable Summary
 mixed $category
 mixed $contentType
 mixed $copyright
 mixed $description
 mixed $docs
 mixed $editor
 mixed $editorEmail
 mixed $encoding
 mixed $image
 mixed $items
 mixed $language
 mixed $link
 mixed $pubDate
 mixed $rating
 mixed $skipDays
 mixed $skipHours
 mixed $title
 mixed $ttl
 mixed $webmaster
Method Summary
 void addItem (object FeedItem $item)
 string createFeed ()
 string iTrunc (string $string, int $length)
 void saveFeed ([filename $filename = ""], [redirect $displayContents = true])
 void useCached ([filename $filename = ""], [timeout $timeout = 3600])
 string _createAdditionalElements (elements $elements, [indentString $indentString = ""])
 string _generateFilename ()
 void _redirect (mixed $filename)
Variables
mixed $additionalElements = array() (line 508)

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.

mixed $category (line 470)
mixed $contentType = "application/xml" (line 490)

This feed's MIME content type.

  • access: private
  • since: 1.4

Redefined in descendants as:
mixed $copyright (line 470)
mixed $description (line 464)
mixed $docs (line 470)
mixed $editor (line 470)
mixed $editorEmail (line 470)
mixed $encoding = "ISO-8859-1" (line 497)

This feed's character encoding.

  • since: 1.6.1
mixed $image (line 470)
mixed $items = array() (line 482)
  • access: private
mixed $language (line 470)
mixed $lastBuildDate (line 470)
mixed $link (line 464)
mixed $pubDate (line 470)
mixed $rating (line 470)
mixed $skipDays (line 470)
mixed $skipHours (line 470)
mixed $syndicationURL (line 470)

Optional attributes of a feed.

mixed $title (line 464)

Mandatory attributes of a feed.

mixed $ttl (line 470)
mixed $webmaster (line 470)
mixed $xslStyleSheet = "" (line 476)

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

Ignored in the output when empty.

Inherited Variables

Inherited from HtmlDescribable

HtmlDescribable::$descriptionHtmlSyndicated
HtmlDescribable::$descriptionTruncSize
Methods
addItem (line 517)

Adds an FeedItem to the feed.

  • access: public
void addItem (object FeedItem $item)
createFeed (line 602)

Builds the feed's text.

  • return: the feed's complete text
  • abstract:
string createFeed ()

Redefined in descendants as:
iTrunc (line 534)

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.

  • return: the truncated string
  • static:
string iTrunc (string $string, int $length)
  • string $string: string A string to be truncated.
  • int $length: length the maximum length the string should be truncated to
saveFeed (line 680)

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
void saveFeed ([filename $filename = ""], [redirect $displayContents = true])
  • filename $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 $displayContents: boolean optional send an HTTP redirect header or not. If true, the user will be automatically redirected to the created file.

Redefined in descendants as:
  • UniversalFeedCreator::saveFeed() : Saves this feed as a file on the local disk. After the file is saved, an HTTP redirect header may be sent to redirect the use to the newly created file.
useCached (line 661)

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
void useCached ([filename $filename = ""], [timeout $timeout = 3600])
  • filename $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 $timeout: int optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour)

Redefined in descendants as:
_createAdditionalElements (line 579)

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

  • return: the XML tags corresponding to $additionalElements
string _createAdditionalElements (elements $elements, [indentString $indentString = ""])
  • elements $elements: array an associative array containing key => value pairs
  • indentString $indentString: string a string that will be inserted before every generated line
_createGeneratorComment (line 567)

Creates a comment indicating the generator of this feed.

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

void _createGeneratorComment ()
_createStylesheetReferences (line 589)
void _createStylesheetReferences ()
_generateFilename (line 621)

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

  • return: the feed cache filename
  • access: private
  • since: 1.4
string _generateFilename ()

Redefined in descendants as:
_redirect (line 631)
  • access: private
  • since: 1.4
void _redirect (mixed $filename)

Inherited Methods

Inherited From HtmlDescribable

 HtmlDescribable::getDescription()

Documentation generated on Mon, 21 Nov 2005 18:15:35 +0100 by phpDocumentor 1.3.0RC3