Example #1
0
 function format($changes)
 {
     global $request;
     include_once 'lib/RssWriter.php';
     $rss = new AtomFeed();
     // "channel" is called "feed" in atom
     $rc_url = WikiURL($request->getArg('pagename'), false, 'absurl');
     extract($this->_args);
     $title = WIKI_NAME;
     $description = $this->title();
     if ($category) {
         $title = $category;
     } elseif ($pagematch) {
         $title = $pagematch;
     }
     $feed_props = array('title' => $description, 'link' => array('rel' => "alternate", 'type' => "text/html", 'href' => $rc_url), 'id' => md5($rc_url), 'modified' => Iso8601DateTime(time()), 'generator' => 'PhpWiki-' . PHPWIKI_VERSION, 'tagline' => '');
     $rss->feed($feed_props);
     $first = true;
     while ($rev = $changes->next()) {
         // enforce view permission
         if (mayAccessPage('view', $rev->_pagename)) {
             $props = $this->item_properties($rev);
             $rss->addItem($props, false, $this->pageURI($rev));
             if ($first) {
                 $this->setValidators($rev);
             }
             $first = false;
         }
     }
     $request->discardOutput();
     $rss->finish();
     //header("Content-Type: application/atom; charset=" . $GLOBALS['charset']);
     printf("\n<!-- Generated by PhpWiki-%s -->\n", PHPWIKI_VERSION);
     // Flush errors in comment, otherwise it's invalid XML.
     global $ErrorManager;
     if ($errors = $ErrorManager->getPostponedErrorsAsHTML()) {
         printf("\n<!-- PHP Warnings:\n%s-->\n", AsXML($errors));
     }
     $request->finish();
     // NORETURN!!!!
 }