当前位置: 首页>>代码示例>>PHP>>正文


PHP SpecialPage::getPages方法代码示例

本文整理汇总了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);
}
开发者ID:k-hasan-19,项目名称:wiki,代码行数:25,代码来源:SpecialSpecialpages.php

示例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;
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:41,代码来源:Skin.php


注:本文中的SpecialPage::getPages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。