当前位置: 首页>>代码示例>>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;未经允许,请勿转载。