本文整理汇总了PHP中PageList::allPagesByOwner方法的典型用法代码示例。如果您正苦于以下问题:PHP PageList::allPagesByOwner方法的具体用法?PHP PageList::allPagesByOwner怎么用?PHP PageList::allPagesByOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageList
的用法示例。
在下文中一共展示了PageList::allPagesByOwner方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preSelectS
/**
* Preselect a list of pagenames by the supporting the follwing args:
* 's': comma-seperated list of pagename wildcards
* 'author', 'owner', 'creator': from WikiDB_Page
* 'only: forgot what the diffrrence to 's' was.
* Sets $this->_list, which is picked up by collectPages() and is a default for p[]
*/
function preSelectS(&$args, &$request)
{
// override plugin argument by GET: probably not needed if s||="" is used
// anyway, we force it for unique interface.
if (!empty($request->getArg['s'])) {
$args['s'] = $request->getArg['s'];
}
if (!empty($args['owner'])) {
$sl = PageList::allPagesByOwner($args['owner'], false, $args['sortby'], $args['limit'], $args['exclude']);
} elseif (!empty($args['author'])) {
$sl = PageList::allPagesByAuthor($args['author'], false, $args['sortby'], $args['limit'], $args['exclude']);
} elseif (!empty($args['creator'])) {
$sl = PageList::allPagesByCreator($args['creator'], false, $args['sortby'], $args['limit'], $args['exclude']);
} elseif (!empty($args['s']) or !empty($args['only'])) {
// all pages by name
$sl = explodePageList(empty($args['only']) ? $args['s'] : $args['only']);
}
$this->_list = array();
if (!empty($sl)) {
$request->setArg('verify', 1);
foreach ($sl as $name) {
if (!empty($args['exclude'])) {
if (!in_array($name, $args['exclude'])) {
$this->_list[$name] = 1;
}
} else {
$this->_list[$name] = 1;
}
}
}
return $this->_list;
}
示例2: run
function run($dbi, $argstr, $request, $basepage)
{
$args = $this->getArgs($argstr, $request);
$pages = false;
// Todo: extend given _GET args
if ($args['debug']) {
$timer = new DebugTimer();
}
$caption = _("All pages 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'] == '[]' ? $request->_user->getAuthenticatedId() : $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'] == '[]' ? $request->_user->getAuthenticatedId() : $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'] == '[]' ? $request->_user->getAuthenticatedId() : $args['creator'], 'if_known'), count($pages));
}
//} elseif ($pages) {
// $args['count'] = count($pages);
} else {
if (!$request->getArg('count')) {
$args['count'] = $dbi->numPages($args['include_empty'], $args['exclude']);
} else {
$args['count'] = $request->getArg('count');
}
}
if (empty($args['count']) and !empty($pages)) {
$args['count'] = count($pages);
}
$pagelist = new PageList($args['info'], $args['exclude'], $args);
if (!$args['noheader']) {
$pagelist->setCaption($caption);
}
// deleted pages show up as version 0.
if ($args['include_empty']) {
$pagelist->_addColumn('version');
}
if ($pages !== false) {
$pagelist->addPageList($pages);
} else {
$pagelist->addPages($dbi->getAllPages($args['include_empty'], $args['sortby'], $args['limit']));
}
if ($args['debug']) {
return HTML($pagelist, HTML::p(fmt("Elapsed time: %s s", $timer->getStats())));
} else {
return $pagelist;
}
}
示例3: run
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);
if (!$args['noheader']) {
$pagelist->setCaption($caption);
}
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 $page->getName();
$links = $page->getPageLinks(false, $args['sortby'], $args['limit'], $args['exclude']);
while ($link = $links->next()) {
echo " ", $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 "<?xml version=\"1.0\" encoding=\"{$charset}\"?>";
// As applet it prefers only "GraphXML.dtd", but then we must copy it to the webroot.
$dtd = $WikiTheme->_findData("GraphXML.dtd");
echo "<!DOCTYPE GraphXML SYSTEM \"{$dtd}\">\n";
echo "<GraphXML xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n";
echo "<graph id=\"", MangleXmlIdentifier(WIKI_NAME), "\">\n";
echo '<style><line tag="node" class="main" colour="#ffffff"/><line tag="node" class="child" colour="blue"/><line tag="node" class="relation" colour="green"/></style>', "\n\n";
while ($page = $pages->next()) {
$pageid = MangleXmlIdentifier($page->getName());
$pagename = $page->getName();
echo "<node name=\"{$pageid}\"";
if ($pagename == $currpage) {
echo " class=\"main\"";
}
echo "><label>{$pagename}</label>";
echo "<dataref><ref xlink:href=\"", WikiURL($pagename, '', true), "\"/></dataref></node>\n";
$links = $page->getPageLinks(false, $args['sortby'], $args['limit'], $args['exclude']);
while ($link = $links->next()) {
$edge = MangleXmlIdentifier($link->getName());
echo "<edge source=\"{$pageid}\" target=\"{$edge}\" />\n";
}
echo "\n";
}
echo "</graph>\n";
echo "</GraphXML>\n";
if (empty($WikiTheme->DUMP_MODE)) {
unset($GLOBALS['ErrorManager']->_postponed_errors);
$request->finish();
}
} else {
return $this->error(fmt("Unsupported format argument %s", $args['format']));
}
}