From: <var...@us...> - 2016-05-25 08:34:45
|
Revision: 9844 http://sourceforge.net/p/phpwiki/code/9844 Author: vargenau Date: 2016-05-25 08:34:43 +0000 (Wed, 25 May 2016) Log Message: ----------- RssWriter: be case consistent Modified Paths: -------------- trunk/lib/plugin/RecentChanges.php trunk/lib/plugin/RelatedChanges.php Added Paths: ----------- trunk/lib/RssWriter091.php Removed Paths: ------------- trunk/lib/RSSWriter091.php Deleted: trunk/lib/RSSWriter091.php =================================================================== --- trunk/lib/RSSWriter091.php 2016-05-25 08:12:23 UTC (rev 9843) +++ trunk/lib/RSSWriter091.php 2016-05-25 08:34:43 UTC (rev 9844) @@ -1,134 +0,0 @@ -<?php -// ---------------------------------------------------------------------- -// phpWiki -// ---------------------------------------------------------------------- -// LICENSE -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License (GPL) -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// To read the license please visit http://www.gnu.org/copyleft/gpl.html -// ---------------------------------------------------------------------- -// Original Author of file: Lawrence Akka -// Purpose of file: Plugin and associated classes -// for outputting RecentChanges in RSS 0.91 format -// ---------------------------------------------------------------------- - -include_once 'lib/RssWriter.php'; -class RSSWriter091 extends RSSWriter -{ - function __construct() - { - $this->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 <em>typedNode</em>. - */ - 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=UTF-8"); - print("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"); - print("<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n"); - print("\"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\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'), array(), '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 <channel>: - * 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) - ); - } -} Copied: trunk/lib/RssWriter091.php (from rev 9843, trunk/lib/RSSWriter091.php) =================================================================== --- trunk/lib/RssWriter091.php (rev 0) +++ trunk/lib/RssWriter091.php 2016-05-25 08:34:43 UTC (rev 9844) @@ -0,0 +1,134 @@ +<?php +// ---------------------------------------------------------------------- +// phpWiki +// ---------------------------------------------------------------------- +// LICENSE +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License (GPL) +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// To read the license please visit http://www.gnu.org/copyleft/gpl.html +// ---------------------------------------------------------------------- +// Original Author of file: Lawrence Akka +// Purpose of file: Plugin and associated classes +// for outputting RecentChanges in RSS 0.91 format +// ---------------------------------------------------------------------- + +include_once 'lib/RssWriter.php'; +class RssWriter091 extends RssWriter +{ + function __construct() + { + $this->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 <em>typedNode</em>. + */ + 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=UTF-8"); + print("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"); + print("<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n"); + print("\"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\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'), array(), '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 <channel>: + * 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) + ); + } +} Modified: trunk/lib/plugin/RecentChanges.php =================================================================== --- trunk/lib/plugin/RecentChanges.php 2016-05-25 08:12:23 UTC (rev 9843) +++ trunk/lib/plugin/RecentChanges.php 2016-05-25 08:34:43 UTC (rev 9844) @@ -1417,7 +1417,7 @@ elseif ($format == 'atom') $fmt_class = '_RecentChanges_AtomFormatter'; elseif ($format == 'rss091') { - include_once 'lib/RSSWriter091.php'; + include_once 'lib/RssWriter091.php'; $fmt_class = '_RecentChanges_RssFormatter091'; } elseif ($format == 'sidebar') $fmt_class = '_RecentChanges_SideBarFormatter'; Modified: trunk/lib/plugin/RelatedChanges.php =================================================================== --- trunk/lib/plugin/RelatedChanges.php 2016-05-25 08:12:23 UTC (rev 9843) +++ trunk/lib/plugin/RelatedChanges.php 2016-05-25 08:34:43 UTC (rev 9844) @@ -105,7 +105,7 @@ $fmt_class = '_RecentChanges_RssFormatter'; elseif ($format == 'rss2') $fmt_class = '_RecentChanges_Rss2Formatter'; elseif ($format == 'rss091') { - include_once 'lib/RSSWriter091.php'; + include_once 'lib/RssWriter091.php'; $fmt_class = '_RecentChanges_RssFormatter091'; } elseif ($format == 'sidebar') $fmt_class = '_RecentChanges_SideBarFormatter'; elseif ($format == 'box') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |