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


PHP SpecialPage::capturePath方法代碼示例

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


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

示例1: braceSubstitution


//.........這裏部分代碼省略.........
         }
         wfProfileOut(__METHOD__ . '-pfunc');
     }
     # Finish mangling title and then check for loops.
     # Set $title to a Title object and $titleText to the PDBK
     if (!$found) {
         $ns = NS_TEMPLATE;
         # Split the title into page and subpage
         $subpage = '';
         $part1 = $this->maybeDoSubpageLink($part1, $subpage);
         if ($subpage !== '') {
             $ns = $this->mTitle->getNamespace();
         }
         $title = Title::newFromText($part1, $ns);
         if ($title) {
             $titleText = $title->getPrefixedText();
             # Check for language variants if the template is not found
             if ($wgContLang->hasVariants() && $title->getArticleID() == 0) {
                 $wgContLang->findVariantLink($part1, $title, true);
             }
             # Do recursion depth check
             $limit = $this->mOptions->getMaxTemplateDepth();
             if ($frame->depth >= $limit) {
                 $found = true;
                 $text = '<span class="error">' . wfMsgForContent('parser-template-recursion-depth-warning', $limit) . '</span>';
             }
         }
     }
     # Load from database
     if (!$found && $title) {
         wfProfileIn(__METHOD__ . '-loadtpl');
         if (!$title->isExternal()) {
             if ($title->getNamespace() == NS_SPECIAL && $this->mOptions->getAllowSpecialInclusion() && $this->ot['html']) {
                 $text = SpecialPage::capturePath($title);
                 if (is_string($text)) {
                     $found = true;
                     $isHTML = true;
                     $this->disableCache();
                 }
             } else {
                 if ($wgNonincludableNamespaces && in_array($title->getNamespace(), $wgNonincludableNamespaces)) {
                     $found = false;
                     //access denied
                     wfDebug(__METHOD__ . ": template inclusion denied for " . $title->getPrefixedDBkey());
                 } else {
                     list($text, $title) = $this->getTemplateDom($title);
                     if ($text !== false) {
                         $found = true;
                         $isChildObj = true;
                     }
                 }
             }
             # If the title is valid but undisplayable, make a link to it
             if (!$found && ($this->ot['html'] || $this->ot['pre'])) {
                 $text = "[[:{$titleText}]]";
                 $found = true;
             }
         } elseif ($title->isTrans()) {
             // Interwiki transclusion
             if ($this->ot['html'] && !$forceRawInterwiki) {
                 $text = $this->interwikiTransclude($title, 'render');
                 $isHTML = true;
             } else {
                 $text = $this->interwikiTransclude($title, 'raw');
                 // Preprocess it like a template
                 $text = $this->preprocessToDom($text, self::PTD_FOR_INCLUSION);
開發者ID:josephdye,項目名稱:wikireader,代碼行數:67,代碼來源:Parser.php

示例2: braceSubstitution


//.........這裏部分代碼省略.........
             $subpage = '';
             $part1 = $this->maybeDoSubpageLink($part1, $subpage);
             if ($subpage !== '') {
                 $ns = $this->mTitle->getNamespace();
             }
             $title = Title::newFromText($part1, $ns);
             //used by include size checking
             $titleText = $title->getPrefixedText();
             //used by edit section links
             $replaceHeadings = true;
         }
     }
     # Load from database
     if (!$found) {
         wfProfileIn(__METHOD__ . '-loadtpl');
         $ns = NS_TEMPLATE;
         # declaring $subpage directly in the function call
         # does not work correctly with references and breaks
         # {{/subpage}}-style inclusions
         $subpage = '';
         $part1 = $this->maybeDoSubpageLink($part1, $subpage);
         if ($subpage !== '') {
             $ns = $this->mTitle->getNamespace();
         }
         $title = Title::newFromText($part1, $ns);
         if (!is_null($title)) {
             $titleText = $title->getPrefixedText();
             # Check for language variants if the template is not found
             if ($wgContLang->hasVariants() && $title->getArticleID() == 0) {
                 $wgContLang->findVariantLink($part1, $title);
             }
             if (!$title->isExternal()) {
                 if ($title->getNamespace() == NS_SPECIAL && $this->mOptions->getAllowSpecialInclusion() && $this->ot['html']) {
                     $text = SpecialPage::capturePath($title);
                     if (is_string($text)) {
                         $found = true;
                         $noparse = true;
                         $noargs = true;
                         $isHTML = true;
                         $this->disableCache();
                     }
                 } else {
                     if ($wgNonincludableNamespaces && in_array($title->getNamespace(), $wgNonincludableNamespaces)) {
                         $found = false;
                         //access denied
                         wfDebug("{$fname}: template inclusion denied for " . $title->getPrefixedDBkey());
                     } else {
                         list($articleContent, $title) = $this->fetchTemplateAndtitle($title);
                         if ($articleContent !== false) {
                             $found = true;
                             $text = $articleContent;
                             $replaceHeadings = true;
                         }
                     }
                 }
                 # If the title is valid but undisplayable, make a link to it
                 if (!$found && ($this->ot['html'] || $this->ot['pre'])) {
                     $text = "[[:{$titleText}]]";
                     $found = true;
                 }
             } elseif ($title->isTrans()) {
                 // Interwiki transclusion
                 if ($this->ot['html'] && !$forceRawInterwiki) {
                     $text = $this->interwikiTransclude($title, 'render');
                     $isHTML = true;
                     $noparse = true;
開發者ID:Jobava,項目名稱:diacritice-meta-repo,代碼行數:67,代碼來源:Parser_OldPP.php


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