[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/ -> feedcreator.class.php (summary)

Version string.

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

Defines 19 classes

FeedItem:: (0 methods):

EnclosureItem:: (0 methods):

FeedImage:: (0 methods):

HtmlDescribable:: (1 method):
  getDescription()

FeedHtmlField:: (2 methods):
  __construct()
  output()

UniversalFeedCreator:: (6 methods):
  _setFormat()
  _sendMIME()
  createFeed()
  saveFeed()
  useCached()
  outputFeed()

FeedCreator:: (11 methods):
  addItem()
  iTrunc()
  _createGeneratorComment()
  _createAdditionalElements()
  _createStylesheetReferences()
  createFeed()
  _generateFilename()
  _redirect()
  useCached()
  saveFeed()
  outputFeed()

FeedDate:: (4 methods):
  __construct()
  rfc822()
  iso8601()
  unix()

RSSCreator10:: (1 method):
  createFeed()

RSSCreator091:: (3 methods):
  __construct()
  _setRSSVersion()
  createFeed()

RSSCreator20:: (1 method):
  __construct()

PIECreator01:: (2 methods):
  __construct()
  createFeed()

AtomCreator10:: (2 methods):
  __construct()
  createFeed()

AtomCreator03:: (2 methods):
  __construct()
  createFeed()

MBOXCreator:: (4 methods):
  __construct()
  qp_enc()
  createFeed()
  _generateFilename()

OPMLCreator:: (2 methods):
  __construct()
  createFeed()

HTMLCreator:: (2 methods):
  createFeed()
  _generateFilename()

JSCreator:: (2 methods):
  createFeed()
  _generateFilename()

DokuWikiFeedCreator:: (1 method):
  createFeed()


Class: FeedItem  - X-Ref

A FeedItem is a part of a FeedCreator feed.

Class: EnclosureItem  - X-Ref

Class EnclosureItem

Class: FeedImage  - X-Ref

An FeedImage may be added to a FeedCreator feed.

Class: HtmlDescribable  - X-Ref

An HtmlDescribable is an item within a feed that can have a description that may
include HTML markup.

getDescription()   X-Ref
Returns a formatted description field, depending on descriptionHtmlSyndicated and
$descriptionTruncSize properties

return: string    the formatted description

Class: FeedHtmlField  - X-Ref

An FeedHtmlField describes and generates
a feed, item or image html field (probably a description). Output is
generated based on $truncSize, $syndicateHtml properties.

__construct($parFieldContent)   X-Ref
Creates a new instance of FeedHtmlField.

param: string $parFieldContent: if given, sets the rawFieldContent property

output()   X-Ref
Creates the right output, depending on $truncSize, $syndicateHtml properties.

return: string    the formatted field

Class: UniversalFeedCreator  - X-Ref

UniversalFeedCreator lets you choose during runtime which
format to build.
For general usage of a feed class, see the FeedCreator class
below or the example above.

_setFormat($format)   X-Ref
Sets format

param: string $format

_sendMIME()   X-Ref
No description

createFeed($format = "RSS0.91")   X-Ref
Creates a syndication feed based on the items previously added.

return: string    the contents of the feed.
see: FeedCreator::addItem()
param: string    $format    format the feed should comply to. Valid values are:

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

param: string  $format  format the feed should comply to. Valid values are:
param: string  $filename    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()).
param: boolean $displayContents optional    send the content of the file or not. If true, the file will be sent in the body of the response.

useCached($format="RSS0.91", $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   $format   format the feed should comply to. Valid values are:
param: string   $filename   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()).
param: int      $timeout optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour)

outputFeed($format='RSS0.91')   X-Ref
Outputs feed to the browser - needed for on-the-fly feed generation (like it is done in WordPress, etc.)

param: $format  string  format the feed should comply to. Valid values are:

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 an FeedItem to the feed.

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

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.

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

_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.

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

_createStylesheetReferences()   X-Ref
Create elements for stylesheets


createFeed()   X-Ref
Builds the feed's text.

return: string    the feed's complete text

_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

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: $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()).
param: $timeout   int     optional    the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour)

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: $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()).
param: $displayContents  boolean optional    send an HTTP redirect header or not. If true, the user will be automatically redirected to the created file.

outputFeed()   X-Ref
Outputs this feed directly to the browser - for on-the-fly feed generation


Class: FeedDate  - X-Ref

FeedDate is an internal class that stores a date for a feed or feed item.
Usually, you won't need to use this.

__construct($dateString="")   X-Ref
Creates a new instance of FeedDate representing a given date.
Accepts RFC 822, ISO 8601 date formats as well as unix time stamps.

param: mixed $dateString optional the date this FeedDate will represent. If not specified, the current date and time is used.

rfc822()   X-Ref
Gets the date stored in this FeedDate as an RFC 822 date.

return: string a date in RFC 822 format

iso8601()   X-Ref
Gets the date stored in this FeedDate as an ISO 8601 date.

return: string a date in ISO 8601 (RFC 3339) format

unix()   X-Ref
Gets the date stored in this FeedDate as unix time stamp.

return: int a date as a unix time stamp

Class: RSSCreator10  - X-Ref

RSSCreator10 is a FeedCreator that implements RDF Site Summary (RSS) 1.0.

createFeed()   X-Ref
Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0.
The feed will contain all items previously added in the same order.

return: string    the feed's complete text

Class: RSSCreator091  - X-Ref

RSSCreator091 is a FeedCreator that implements RSS 0.91 Spec, revision 3.

__construct()   X-Ref
Constructor


_setRSSVersion($version)   X-Ref
Sets this RSS feed's version number.

param: $version

createFeed()   X-Ref
Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0.
The feed will contain all items previously added in the same order.

return: string    the feed's complete text

Class: RSSCreator20  - X-Ref

RSSCreator20 is a FeedCreator that implements RDF Site Summary (RSS) 2.0.

__construct()   X-Ref
Constructor


Class: PIECreator01  - X-Ref

PIECreator01 is a FeedCreator that implements the emerging PIE specification,
as in http://intertwingly.net/wiki/pie/Syntax.

__construct()   X-Ref
Constructor


createFeed()   X-Ref
Build content

return: string

Class: AtomCreator10  - X-Ref

AtomCreator10 is a FeedCreator that implements the atom specification,
as in http://www.atomenabled.org/developers/syndication/atom-format-spec.php
Please note that just by using AtomCreator10 you won't automatically
produce valid atom files. For example, you have to specify either an editor
for the feed or an author for every single feed item.

Some elements have not been implemented yet. These are (incomplete list):
author URL, item author's email and URL, item contents, alternate links,
other link content types than text/html. Some of them may be created with
AtomCreator10::additionalElements.

__construct()   X-Ref
Constructor


createFeed()   X-Ref
Build content

return: string

Class: AtomCreator03  - X-Ref

AtomCreator03 is a FeedCreator that implements the atom specification,
as in http://www.intertwingly.net/wiki/pie/FrontPage.
Please note that just by using AtomCreator03 you won't automatically
produce valid atom files. For example, you have to specify either an editor
for the feed or an author for every single feed item.

Some elements have not been implemented yet. These are (incomplete list):
author URL, item author's email and URL, item contents, alternate links,
other link content types than text/html. Some of them may be created with
AtomCreator03::additionalElements.

__construct()   X-Ref
Constructor


createFeed()   X-Ref
Build content

return: string

Class: MBOXCreator  - X-Ref

MBOXCreator is a FeedCreator that implements the mbox format
as described in http://www.qmail.org/man/man5/mbox.html

__construct()   X-Ref
Constructor


qp_enc($input = "", $line_max = 76)   X-Ref

return: string
param: string $input
param: int $line_max

createFeed()   X-Ref
Builds the MBOX contents.

return: string    the feed's complete text

_generateFilename()   X-Ref
Generate a filename for the feed cache file. Overridden from FeedCreator to prevent XML data types.

return: string the feed cache filename

Class: OPMLCreator  - X-Ref

OPMLCreator is a FeedCreator that implements OPML 1.0.

__construct()   X-Ref
Constructor


createFeed()   X-Ref
Build content

return: string

Class: HTMLCreator  - X-Ref

HTMLCreator is a FeedCreator that writes an HTML feed file to a specific
location, overriding the createFeed method of the parent FeedCreator.
The HTML produced can be included over http by scripting languages, or serve
as the source for an IFrame.
All output by this class is embedded in <div></div> tags to enable formatting
using CSS.

createFeed()   X-Ref
Writes the HTML.

return: string    the scripts's complete text

_generateFilename()   X-Ref
Overrrides parent to produce .html extensions

return: string the feed cache filename

Class: JSCreator  - X-Ref

JSCreator is a class that writes a js file to a specific
location, overriding the createFeed method of the parent HTMLCreator.

createFeed()   X-Ref
writes the javascript

return: string    the scripts's complete text

_generateFilename()   X-Ref
Overrrides parent to produce .js extensions

return: string the feed cache filename

Class: DokuWikiFeedCreator  - X-Ref

This class allows to override the hardcoded charset

createFeed($format = "RSS0.91",$encoding='iso-8859-15')   X-Ref
Build content

return: string
param: string $format
param: string $encoding