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


PHP SpecialPage::getPageByAlias方法代码示例

本文整理汇总了PHP中SpecialPage::getPageByAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP SpecialPage::getPageByAlias方法的具体用法?PHP SpecialPage::getPageByAlias怎么用?PHP SpecialPage::getPageByAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SpecialPage的用法示例。


在下文中一共展示了SpecialPage::getPageByAlias方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wfAjaxQueryPagesAddJS

function wfAjaxQueryPagesAddJS($out)
{
    global $wgExtensionAssetsPath;
    if ($out->getTitle()->getNamespace() == NS_SPECIAL && SpecialPage::getPageByAlias($out->getTitle()->getDBkey())) {
        $out->addScriptFile("{$wgExtensionAssetsPath}/AjaxQueryPages/AjaxQueryPages.js");
    }
    return true;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:8,代码来源:Hooks.php

示例2: wfAjaxQueryPages

/**
 * Ajax responder entry point
 */
function wfAjaxQueryPages($specialpagename, $offset, $limit, $dir = false)
{
    global $wgRequest, $wgOut;
    // Make sure we requested an existing special page
    if (!($spObj = SpecialPage::getPageByAlias($specialpagename))) {
        return null;
    }
    // Alter the GET request.
    $wgRequest->setVal('offset', $offset);
    $wgRequest->setVal('limit', $limit);
    if ($dir == 'prev' || $dir == 'next') {
        $wgRequest->setVal('dir', $dir);
    }
    $spObj->execute(null);
    return $wgOut->getHTML();
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:19,代码来源:Response.php

示例3: executePath

 /**
  * Execute a special page path.
  * The path	may contain parameters, e.g. Special:Name/Params
  * Extracts the special page name and call the execute method, passing the parameters
  *
  * Returns a title object if the page is redirected, false if there was no such special
  * page, and true if it was successful.
  *
  * @param $title          a title object
  * @param $including      output is being captured for use in {{special:whatever}}
  */
 static function executePath(&$title, $including = false)
 {
     global $wgOut, $wgTitle, $wgRequest;
     wfProfileIn(__METHOD__);
     # FIXME: redirects broken due to this call
     $bits = explode('/', $title->getDBkey(), 2);
     $name = $bits[0];
     if (!isset($bits[1])) {
         // bug 2087
         $par = NULL;
     } else {
         $par = $bits[1];
     }
     $page = SpecialPage::getPageByAlias($name);
     # Nonexistent?
     if (!$page) {
         if (!$including) {
             $wgOut->setArticleRelated(false);
             $wgOut->setRobotpolicy('noindex,nofollow');
             $wgOut->setStatusCode(404);
             $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         }
         wfProfileOut(__METHOD__);
         return false;
     }
     # Check for redirect
     if (!$including) {
         $redirect = $page->getRedirect($par);
         if ($redirect) {
             $query = $page->getRedirectQuery();
             $url = $redirect->getFullUrl($query);
             $wgOut->redirect($url);
             wfProfileOut(__METHOD__);
             return $redirect;
         }
     }
     # Redirect to canonical alias for GET commands
     # Not for POST, we'd lose the post data, so it's best to just distribute
     # the request. Such POST requests are possible for old extensions that
     # generate self-links without being aware that their default name has
     # changed.
     if (!$including && $name != $page->getLocalName() && !$wgRequest->wasPosted()) {
         $query = $_GET;
         unset($query['title']);
         $query = wfArrayToCGI($query);
         $title = $page->getTitle($par);
         $url = $title->getFullUrl($query);
         $wgOut->redirect($url);
         wfProfileOut(__METHOD__);
         return $redirect;
     }
     if ($including && !$page->includable()) {
         wfProfileOut(__METHOD__);
         return false;
     } elseif (!$including) {
         $wgTitle = $page->getTitle();
     }
     $page->including($including);
     // Execute special page
     $profName = 'Special:' . $page->getName();
     wfProfileIn($profName);
     $page->execute($par);
     wfProfileOut($profName);
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:negabaro,项目名称:alfresco,代码行数:77,代码来源:SpecialPage.php


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