[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/vendor/openpsa/universalfeedcreator/lib/Creator/ -> FeedCreator.php (summary)

(no description)

File Size: 273 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

FeedCreator:: (10 methods):
  addItem()
  version()
  iTrunc()
  _createGeneratorComment()
  _createAdditionalElements()
  _createStylesheetReferences()
  _generateFilename()
  _redirect()
  useCached()
  saveFeed()


Class: FeedCreator  - X-Ref

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

addItem($item)   X-Ref
Adds a FeedItem to the feed.

param: FeedItem $item The FeedItem to add to the feed.

version()   X-Ref
Get the version string for the generator

return: string

iTrunc($string, $length)   X-Ref
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.

param: string $string A string to be truncated.
param: int $length    the maximum length the string should be truncated to
return: string the truncated string

_createGeneratorComment()   X-Ref
Creates a comment indicating the generator of this feed.
The format of this comment seems to be recognized by
Syndic8.com.


_createAdditionalElements($elements, $indentString = "")   X-Ref
Creates a string containing all additional elements specified in
$additionalElements.

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

_createStylesheetReferences()   X-Ref
No description

_generateFilename()   X-Ref
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: string the feed cache filename

_redirect($filename)   X-Ref
Send given file to Browser

param: string $filename

useCached($filename = "", $timeout = 3600)   X-Ref
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).

param: string $filename optional    the filename where a recent version of the feed is saved. If not specified,
param: int $timeout     optional    the timeout in seconds before a cached version is refreshed (defaults to

saveFeed($filename = "", $displayContents = true)   X-Ref
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.

param: string $filename      optional    the filename where a recent version of the feed is saved. If not
param: bool $displayContents optional    send an HTTP redirect header or not. If true, the user will be