本文整理匯總了PHP中SpecialPage::getPages方法的典型用法代碼示例。如果您正苦於以下問題:PHP SpecialPage::getPages方法的具體用法?PHP SpecialPage::getPages怎麽用?PHP SpecialPage::getPages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SpecialPage
的用法示例。
在下文中一共展示了SpecialPage::getPages方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: wfSpecialSpecialpages
/**
*
*/
function wfSpecialSpecialpages()
{
global $wgOut, $wgUser, $wgAvailableRights;
$wgOut->setRobotpolicy('index,nofollow');
$sk = $wgUser->getSkin();
# Get listable pages, in a 2-d array with the first dimension being user right
$pages = SpecialPage::getPages();
/** Pages available to all */
wfSpecialSpecialpages_gen($pages[''], 'spheading', $sk);
/** Restricted special pages */
$rpages = array();
foreach ($wgAvailableRights as $right) {
/** only show pages a user can access */
if ($wgUser->isAllowed($right)) {
/** some rights might not have any special page associated */
if (isset($pages[$right])) {
$rpages = array_merge($rpages, $pages[$right]);
}
}
}
wfSpecialSpecialpages_gen($rpages, 'restrictedpheading', $sk);
}
示例2: specialPagesList
/**
* show a drop-down box of special pages
* @TODO crash bug913. Need to be rewrote completly.
*/
function specialPagesList()
{
global $wgUser, $wgOut, $wgContLang, $wgServer, $wgRedirectScript, $wgAvailableRights;
require_once 'SpecialPage.php';
$a = array();
$pages = SpecialPage::getPages();
// special pages without access restriction
foreach ($pages[''] as $name => $page) {
$a[$name] = $page->getDescription();
}
// Other special pages that are restricted.
// Copied from SpecialSpecialpages.php
foreach ($wgAvailableRights as $right) {
if ($wgUser->isAllowed($right)) {
/** Add all pages for this right */
if (isset($pages[$right])) {
foreach ($pages[$right] as $name => $page) {
$a[$name] = $page->getDescription();
}
}
}
}
$go = wfMsg('go');
$sp = wfMsg('specialpages');
$spp = $wgContLang->specialPage('Specialpages');
$s = '<form id="specialpages" method="get" class="inline" ' . 'action="' . htmlspecialchars("{$wgServer}{$wgRedirectScript}") . "\">\n";
$s .= "<select name=\"wpDropdown\">\n";
$s .= "<option value=\"{$spp}\">{$sp}</option>\n";
foreach ($a as $name => $desc) {
$p = $wgContLang->specialPage($name);
$s .= "<option value=\"{$p}\">{$desc}</option>\n";
}
$s .= "</select>\n";
$s .= "<input type='submit' value=\"{$go}\" name='redirect' />\n";
$s .= "</form>\n";
return $s;
}