當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SpecialPage::getRedirectParams方法代碼示例

本文整理匯總了PHP中SpecialPage::getRedirectParams方法的典型用法代碼示例。如果您正苦於以下問題:PHP SpecialPage::getRedirectParams方法的具體用法?PHP SpecialPage::getRedirectParams怎麽用?PHP SpecialPage::getRedirectParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SpecialPage的用法示例。


在下文中一共展示了SpecialPage::getRedirectParams方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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;
     $fname = 'SpecialPage::executePath';
     wfProfileIn($fname);
     $bits = split("/", $title->getDBkey(), 2);
     $name = $bits[0];
     if (!isset($bits[1])) {
         // bug 2087
         $par = NULL;
     } else {
         $par = $bits[1];
     }
     $page = SpecialPage::getPage($name);
     if (is_null($page)) {
         if ($including) {
             wfProfileOut($fname);
             return false;
         } else {
             $redir = SpecialPage::getRedirect($name);
             if (isset($redir)) {
                 if ($par) {
                     $redir = Title::makeTitle($redir->getNamespace(), $redir->getText() . '/' . $par);
                 }
                 $params = SpecialPage::getRedirectParams($name);
                 if ($params) {
                     $url = $redir->getFullUrl($params);
                 } else {
                     $url = $redir->getFullUrl();
                 }
                 $wgOut->redirect($url);
                 $retVal = $redir;
                 $wgOut->redirect($url);
                 $retVal = $redir;
             } else {
                 $wgOut->setArticleRelated(false);
                 $wgOut->setRobotpolicy('noindex,nofollow');
                 $wgOut->setStatusCode(404);
                 $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
                 $retVal = false;
             }
         }
     } else {
         if ($including && !$page->includable()) {
             wfProfileOut($fname);
             return false;
         } elseif (!$including) {
             if ($par !== NULL) {
                 $wgTitle = Title::makeTitle(NS_SPECIAL, $name);
             } else {
                 $wgTitle = $title;
             }
         }
         $page->including($including);
         $profName = 'Special:' . $page->getName();
         wfProfileIn($profName);
         $page->execute($par);
         wfProfileOut($profName);
         $retVal = true;
     }
     wfProfileOut($fname);
     return $retVal;
 }
開發者ID:puring0815,項目名稱:OpenKore,代碼行數:74,代碼來源:SpecialPage.php


注:本文中的SpecialPage::getRedirectParams方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。