'html', // 'html', 'text', 'xml' 'noheader' => false, 'include_empty' => false, 'exclude_from' => false, 'info' => '', )); } function getHtml($dbi, $argarray, $request, $basepage) { $this->run($dbi, WikiPluginCached::glueArgs($argarray), $request, $basepage); } function run($dbi, $argstr, $request, $basepage) { global $WikiTheme; $args = $this->getArgs($argstr, $request); $caption = _("All pages with all links in this wiki (%d total):"); if ( !empty($args['owner']) ) { $pages = PageList::allPagesByOwner($args['owner'],$args['include_empty'], $args['sortby'],$args['limit']); if ($args['owner']) $caption = fmt("List of pages owned by [%s] (%d total):", WikiLink($args['owner'], 'if_known'), count($pages)); } elseif ( !empty($args['author']) ) { $pages = PageList::allPagesByAuthor($args['author'],$args['include_empty'], $args['sortby'],$args['limit']); if ($args['author']) $caption = fmt("List of pages last edited by [%s] (%d total):", WikiLink($args['author'], 'if_known'), count($pages)); } elseif ( !empty($args['creator']) ) { $pages = PageList::allPagesByCreator($args['creator'],$args['include_empty'], $args['sortby'],$args['limit']); if ($args['creator']) $caption = fmt("List of pages created by [%s] (%d total):", WikiLink($args['creator'], 'if_known'), count($pages)); } else { if (! $request->getArg('count')) $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude_from']); else $args['count'] = $request->getArg('count'); $pages = $dbi->getAllPages($args['include_empty'], $args['sortby'], $args['limit'], $args['exclude_from']); } if ($args['format'] == 'html') { $args['types']['links'] = new _PageList_Column_LinkDatabase_links('links', _("Links"), 'left'); $pagelist = new PageList($args['info'], $args['exclude_from'], $args); //$pagelist->_addColumn("links"); if (!$args['noheader']) $pagelist->setCaption($caption); $pagelist->addPages($pages); return $pagelist; } elseif ($args['format'] == 'text') { $request->discardOutput(); $request->buffer_output(false); if (!headers_sent()) header("Content-Type: text/plain"); $request->checkValidators(); while ($page = $pages->next()) { echo preg_replace("/ /","%20",$page->getName()); $links = $page->getPageLinks(false, $args['sortby'], $args['limit'], $args['exclude']); while ($link = $links->next()) { echo " ", preg_replace("/ /","%20",$link->getName()); } echo "\n"; } flush(); if (empty($WikiTheme->DUMP_MODE)) $request->finish(); } elseif ($args['format'] == 'xml') { // For hypergraph.jar. Best dump it to a local sitemap.xml periodically global $WikiTheme, $charset; $currpage = $request->getArg('pagename'); $request->discardOutput(); $request->buffer_output(false); if (!headers_sent()) header("Content-Type: text/xml"); $request->checkValidators(); echo ""; // As applet it prefers only "GraphXML.dtd", but then we must copy it to the webroot. $dtd = $WikiTheme->_findData("GraphXML.dtd"); echo "\n"; echo "\n"; echo "\n"; echo '',"\n\n"; while ($page = $pages->next()) { $pageid = MangleXmlIdentifier($page->getName()); $pagename = $page->getName(); echo ""; echo "\n"; $links = $page->getPageLinks(false, $args['sortby'], $args['limit'], $args['exclude']); while ($link = $links->next()) { $edge = MangleXmlIdentifier($link->getName()); echo "\n"; } echo "\n"; } echo "\n"; echo "\n"; if (empty($WikiTheme->DUMP_MODE)) { unset($GLOBALS['ErrorManager']->_postponed_errors); $request->finish(); } } else { return $this->error(fmt("Unsupported format argument %s", $args['format'])); } } }; class _PageList_Column_LinkDatabase_links extends _PageList_Column { function _getValue($page, &$revision_handle) { $out = HTML(); $links = $page->getPageLinks(); while ($link = $links->next()) { $out->pushContent(" ", WikiLink($link)); } return $out; } } // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: