XmlElement('rss', array('version' => "0.91"));
$this->_items = array();
}
/**
* Finish construction of RSS.
*/
function finish()
{
if (isset($this->_finished))
return;
$channel = &$this->_channel;
$items = &$this->_items;
if ($items) {
foreach ($items as $i)
$channel->pushContent($i);
}
$this->pushContent($channel);
$this->__spew();
$this->_finished = true;
}
/**
* Create a new RDF typedNode.
*/
function __node($type, $properties, $uri = false)
{
return new XmlElement($type, '',
$this->__elementize($properties));
}
/**
* Write output to HTTP client.
*/
function __spew()
{
header("Content-Type: application/xml; charset=" . RSS_ENCODING);
printf("\n", RSS_ENCODING);
print("\n\n");
$this->printXML();
}
}
class _RecentChanges_RssFormatter091
extends _RecentChanges_RSSFormatter
// This class should probably go at then of RecentChanges.php
{
function format($changes)
{
// include_once('lib/RssWriter.php');
$rss = new RssWriter091;
$rss->channel($this->channel_properties());
if (($props = $this->image_properties()))
$rss->image($props);
if (($props = $this->textinput_properties()))
$rss->textinput($props);
while ($rev = $changes->next()) {
$rss->addItem($this->item_properties($rev),
$this->pageURI($rev));
}
global $request;
$request->discardOutput();
$rss->finish();
$request->finish(); // NORETURN!!!!
}
function channel_properties()
{
global $request;
$rc_url = WikiURL($request->getArg('pagename'), false, 'absurl');
return array('title' => WIKI_NAME,
'description' => _("RecentChanges"),
'link' => $rc_url,
'language' => 'en-US');
/* FIXME: language should come from $LANG (or other config variable). */
/* FIXME: other things one might like in :
* managingEditor
* webmaster
* lastBuildDate
* copyright
*/
}
function item_properties($rev)
{
$page = $rev->getPage();
$pagename = $page->getName();
return array('title' => SplitPagename($pagename),
'description' => $this->summary($rev),
'link' => $this->pageURL($rev)
);
}
}
// Local Variables:
// mode: php
// tab-width: 8
// c-basic-offset: 4
// c-hanging-comment-ender-p: nil
// indent-tabs-mode: nil
// End: