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


PHP SpecialPage::executePath方法代码示例

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


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

示例1: initializeSpecialCases

 /**
  * Initialize the object to be known as $wgArticle for special cases
  */
 function initializeSpecialCases(&$title, &$output, $request)
 {
     wfProfileIn('MediaWiki::initializeSpecialCases');
     $search = $this->getVal('Search');
     $action = $this->getVal('Action');
     if (!$this->getVal('DisableInternalSearch') && !is_null($search) && $search !== '') {
         require_once 'includes/SpecialSearch.php';
         $title = Title::makeTitle(NS_SPECIAL, 'Search');
         wfSpecialSearch();
     } else {
         if (!$title or $title->getDBkey() == '') {
             $title = Title::makeTitle(NS_SPECIAL, 'Badtitle');
             # Die now before we mess up $wgArticle and the skin stops working
             throw new ErrorPageError('badtitle', 'badtitletext');
         } else {
             if ($title->getInterwiki() != '') {
                 if ($rdfrom = $request->getVal('rdfrom')) {
                     $url = $title->getFullURL('rdfrom=' . urlencode($rdfrom));
                 } else {
                     $url = $title->getFullURL();
                 }
                 /* Check for a redirect loop */
                 if (!preg_match('/^' . preg_quote($this->getVal('Server'), '/') . '/', $url) && $title->isLocal()) {
                     $output->redirect($url);
                 } else {
                     $title = Title::makeTitle(NS_SPECIAL, 'Badtitle');
                     throw new ErrorPageError('badtitle', 'badtitletext');
                 }
             } else {
                 if ($action == 'view' && (!isset($this->GET['title']) || $title->getPrefixedDBKey() != $this->GET['title']) && !count(array_diff(array_keys($this->GET), array('action', 'title')))) {
                     /* Redirect to canonical url, make it a 301 to allow caching */
                     $output->setSquidMaxage(1200);
                     $output->redirect($title->getFullURL(), '301');
                 } else {
                     if (NS_SPECIAL == $title->getNamespace()) {
                         /* actions that need to be made when we have a special pages */
                         SpecialPage::executePath($title);
                     } else {
                         /* No match to special cases */
                         wfProfileOut('MediaWiki::initializeSpecialCases');
                         return false;
                     }
                 }
             }
         }
     }
     /* Did match a special case */
     wfProfileOut('MediaWiki::initializeSpecialCases');
     return true;
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:53,代码来源:Wiki.php

示例2: handleSpecialCases

 /**
  * Initialize some special cases:
  * - bad titles
  * - local interwiki redirects
  * - redirect loop
  * - special pages
  *
  * @param $title Title
  * @param $output OutputPage
  * @param $request WebRequest
  * @return bool true if the request is already executed
  */
 function handleSpecialCases(&$title, &$output, $request)
 {
     wfProfileIn(__METHOD__);
     $action = $this->getVal('Action');
     // Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
     if (is_null($title) || $title->getDBkey() == '' && $title->getInterwiki() == '') {
         $title = SpecialPage::getTitleFor('Badtitle');
         $output->setTitle($title);
         // bug 21456
         // Die now before we mess up $wgArticle and the skin stops working
         throw new ErrorPageError('badtitle', 'badtitletext');
         // Interwiki redirects
     } else {
         if ($title->getInterwiki() != '') {
             $rdfrom = $request->getVal('rdfrom');
             if ($rdfrom) {
                 $url = $title->getFullURL('rdfrom=' . urlencode($rdfrom));
             } else {
                 $query = $request->getValues();
                 unset($query['title']);
                 $url = $title->getFullURL($query);
             }
             /* Check for a redirect loop */
             if (!preg_match('/^' . preg_quote($this->getVal('Server'), '/') . '/', $url) && $title->isLocal()) {
                 // 301 so google et al report the target as the actual url.
                 $output->redirect($url, 301);
             } else {
                 $title = SpecialPage::getTitleFor('Badtitle');
                 $output->setTitle($title);
                 // bug 21456
                 wfProfileOut(__METHOD__);
                 throw new ErrorPageError('badtitle', 'badtitletext');
             }
             // Redirect loops, no title in URL, $wgUsePathInfo URLs, and URLs with a variant
         } else {
             if ($action == 'view' && !$request->wasPosted() && ($request->getVal('title') === null || $title->getPrefixedDBKey() != $request->getVal('title')) && !count(array_diff(array_keys($request->getValues()), array('action', 'title')))) {
                 if ($title->getNamespace() == NS_SPECIAL) {
                     list($name, $subpage) = SpecialPage::resolveAliasWithSubpage($title->getDBkey());
                     if ($name) {
                         $title = SpecialPage::getTitleFor($name, $subpage);
                     }
                 }
                 $targetUrl = $title->getFullURL();
                 // Redirect to canonical url, make it a 301 to allow caching
                 if ($targetUrl == $request->getFullRequestURL()) {
                     $message = "Redirect loop detected!\n\n" . "This means the wiki got confused about what page was " . "requested; this sometimes happens when moving a wiki " . "to a new server or changing the server configuration.\n\n";
                     if ($this->getVal('UsePathInfo')) {
                         $message .= "The wiki is trying to interpret the page " . "title from the URL path portion (PATH_INFO), which " . "sometimes fails depending on the web server. Try " . "setting \"\$wgUsePathInfo = false;\" in your " . "LocalSettings.php, or check that \$wgArticlePath " . "is correct.";
                     } else {
                         $message .= "Your web server was detected as possibly not " . "supporting URL path components (PATH_INFO) correctly; " . "check your LocalSettings.php for a customized " . "\$wgArticlePath setting and/or toggle \$wgUsePathInfo " . "to true.";
                     }
                     wfHttpError(500, "Internal error", $message);
                     wfProfileOut(__METHOD__);
                     return false;
                 } else {
                     $output->setSquidMaxage(1200);
                     $output->redirect($targetUrl, '301');
                 }
                 // Special pages
             } else {
                 if (NS_SPECIAL == $title->getNamespace()) {
                     /* actions that need to be made when we have a special pages */
                     SpecialPage::executePath($title);
                 } else {
                     /* No match to special cases */
                     wfProfileOut(__METHOD__);
                     return false;
                 }
             }
         }
     }
     /* Did match a special case */
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:87,代码来源:Wiki.php

示例3: ImagePage

     # Check for a redirect loop
     if (!preg_match('/^' . preg_quote($wgServer, '/') . '/', $url) && $wgTitle->isLocal()) {
         $wgOut->redirect($url);
     } else {
         $wgTitle = Title::newFromText(wfMsgForContent('badtitle'));
         $wgOut->errorpage('badtitle', 'badtitletext');
     }
 } else {
     if ($action == 'view' && (!isset($_GET['title']) || $wgTitle->getPrefixedDBKey() != $_GET['title']) && !count(array_diff(array_keys($_GET), array('action', 'title')))) {
         /* redirect to canonical url, make it a 301 to allow caching */
         $wgOut->setSquidMaxage(1200);
         $wgOut->redirect($wgTitle->getFullURL(), '301');
     } else {
         if (NS_SPECIAL == $wgTitle->getNamespace()) {
             # actions that need to be made when we have a special pages
             SpecialPage::executePath($wgTitle);
         } else {
             if (NS_MEDIA == $wgTitle->getNamespace()) {
                 $wgTitle = Title::makeTitle(NS_IMAGE, $wgTitle->getDBkey());
             }
             $ns = $wgTitle->getNamespace();
             if ($ns == NS_IMAGE) {
                 require_once 'includes/ImagePage.php';
                 $wgArticle = new ImagePage($wgTitle);
             } elseif ($wgUseCategoryMagic && $ns == NS_CATEGORY) {
                 require_once 'includes/CategoryPage.php';
                 $wgArticle = new CategoryPage($wgTitle);
             } else {
                 $wgArticle = new Article($wgTitle);
             }
             if (in_array($action, $wgDisabledActions)) {
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:31,代码来源:index.php

示例4: capturePath

 /**
  * Just like executePath() except it returns the HTML instead of outputting it
  * Returns false if there was no such special page, or a title object if it was
  * a redirect.
  * @static
  */
 static function capturePath(&$title)
 {
     global $wgOut, $wgTitle;
     $oldTitle = $wgTitle;
     $oldOut = $wgOut;
     $wgOut = new OutputPage();
     $ret = SpecialPage::executePath($title, true);
     if ($ret === true) {
         $ret = $wgOut->getHTML();
     }
     $wgTitle = $oldTitle;
     $wgOut = $oldOut;
     return $ret;
 }
开发者ID:negabaro,项目名称:alfresco,代码行数:20,代码来源:SpecialPage.php

示例5: initializeSpecialCases

 /**
  * Initialize the object to be known as $wgArticle for special cases
  */
 function initializeSpecialCases(&$title, &$output, $request)
 {
     global $wgRequest, $wgUseGoogleMini, $IP;
     wfProfileIn('MediaWiki::initializeSpecialCases');
     $action = $this->getVal('Action');
     $search = $request->getVal('search');
     if ($this->getVal('Server') != "http://" . $_SERVER['HTTP_HOST'] && !preg_match("@[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+@", $_SERVER['HTTP_HOST']) && !IS_SPARE_HOST && !IS_CLOUD_SITE) {
         $output->redirect($this->getVal('Server') . $_SERVER['REQUEST_URI'], 301);
         return;
     }
     if (!$title or $title->getDBkey() == '') {
         $title = SpecialPage::getTitleFor('Badtitle');
         # Die now before we mess up $wgArticle and the skin stops working
         throw new ErrorPageError('badtitle', 'badtitletext');
     } else {
         if (!is_null($search) && $search !== '' && $wgUseGoogleMini) {
             //XXCHANGED
             if ($wgRequest->getVal('advanced', null) == null && $wgUseGoogleMini) {
                 $title = Title::makeTitle(NS_SPECIAL, 'LSearch');
                 require_once "{$IP}/extensions/wikihow/LSearch.body.php";
                 $s = new LSearch();
                 $s->execute('');
             } else {
                 require_once "{$IP}/includes/SpecialSearch.php";
                 $title = Title::makeTitle(NS_SPECIAL, 'Search');
                 #$s = new SpecialSearch();
                 #$s->execute('');
                 wfSpecialSearch();
             }
         } else {
             if ($title->getInterwiki() != '') {
                 if ($rdfrom = $request->getVal('rdfrom')) {
                     $url = $title->getFullURL('rdfrom=' . urlencode($rdfrom));
                 } else {
                     $url = $title->getFullURL();
                 }
                 /* Check for a redirect loop */
                 if (!preg_match('/^' . preg_quote($this->getVal('Server'), '/') . '/', $url) && $title->isLocal()) {
                     $output->redirect($url);
                 } else {
                     $title = SpecialPage::getTitleFor('Badtitle');
                     throw new ErrorPageError('badtitle', 'badtitletext');
                 }
             } else {
                 if ($action == 'view' && !$wgRequest->wasPosted() && (!isset($this->GET['title']) || $title->getPrefixedDBKey() != $this->GET['title']) && !count(array_diff(array_keys($this->GET), array('action', 'title')))) {
                     $targetUrl = $title->getFullURL();
                     // Redirect to canonical url, make it a 301 to allow caching
                     global $wgUsePathInfo;
                     if ($targetUrl == $wgRequest->getFullRequestURL()) {
                         $message = "Redirect loop detected!\n\n" . "This means the wiki got confused about what page was " . "requested; this sometimes happens when moving a wiki " . "to a new server or changing the server configuration.\n\n";
                         if ($wgUsePathInfo) {
                             $message .= "The wiki is trying to interpret the page " . "title from the URL path portion (PATH_INFO), which " . "sometimes fails depending on the web server. Try " . "setting \"\$wgUsePathInfo = false;\" in your " . "LocalSettings.php, or check that \$wgArticlePath " . "is correct.";
                         } else {
                             $message .= "Your web server was detected as possibly not " . "supporting URL path components (PATH_INFO) correctly; " . "check your LocalSettings.php for a customized " . "\$wgArticlePath setting and/or toggle \$wgUsePathInfo " . "to true.";
                         }
                         wfHttpError(500, "Internal error", $message);
                         return false;
                     } else {
                         $output->setSquidMaxage(1200);
                         $output->redirect($targetUrl, '301');
                     }
                 } else {
                     if (NS_SPECIAL == $title->getNamespace()) {
                         /* actions that need to be made when we have a special pages */
                         SpecialPage::executePath($title);
                     } else {
                         /* No match to special cases */
                         wfProfileOut('MediaWiki::initializeSpecialCases');
                         return false;
                     }
                 }
             }
         }
     }
     /* Did match a special case */
     wfProfileOut('MediaWiki::initializeSpecialCases');
     return true;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:81,代码来源:Wiki.php


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