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


PHP ParserOutput::getTitleText方法代码示例

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


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

示例1: wfWikiAnswersPageTitle

/**
 * @param OutputPage $out
 * @param ParserOutput $parserOutput
 * @return bool
 */
function wfWikiAnswersPageTitle(&$out, $parserOutput)
{
    $answerObj = Answer::newFromTitle($out->getTitle());
    if ($answerObj->isQuestion()) {
        $parserOutput->setTitleText($parserOutput->getTitleText() . wfMsg('?'));
    }
    return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:13,代码来源:WikiAnswers.php

示例2: adjustDisplayTitle

 /**
  * Adjust title for pages with displaytitle, -{T|}- or language conversion
  * @param ParserOutput $pOutput
  */
 public function adjustDisplayTitle(ParserOutput $pOutput)
 {
     # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
     $titleText = $pOutput->getTitleText();
     if (strval($titleText) !== '') {
         $this->getContext()->getOutput()->setPageTitle($titleText);
     }
 }
开发者ID:ngertrudiz,项目名称:mediawiki,代码行数:12,代码来源:Article.php

示例3: view


//.........这里部分代码省略.........
                     $this->showMissingArticle();
                     wfProfileOut(__METHOD__);
                     return;
                 }
                 # Another whitelist check in case oldid is altering the title
                 if (!$this->getTitle()->userCanRead()) {
                     wfDebug(__METHOD__ . ": denied on secondary read check\n");
                     $wgOut->loginToUse();
                     $wgOut->output();
                     $wgOut->disable();
                     wfProfileOut(__METHOD__);
                     return;
                 }
                 # Are we looking at an old revision
                 if ($oldid && !is_null($this->mRevision)) {
                     $this->setOldSubtitle($oldid);
                     if (!$this->showDeletedRevisionHeader()) {
                         wfDebug(__METHOD__ . ": cannot view deleted revision\n");
                         wfProfileOut(__METHOD__);
                         return;
                     }
                     # If this "old" version is the current, then try the parser cache...
                     if ($oldid === $this->mPage->getLatest() && $this->useParserCache(false)) {
                         $this->mParserOutput = $parserCache->get($this, $parserOptions);
                         if ($this->mParserOutput) {
                             wfDebug(__METHOD__ . ": showing parser cache for current rev permalink\n");
                             $wgOut->addParserOutput($this->mParserOutput);
                             $wgOut->setRevisionId($this->mPage->getLatest());
                             $outputDone = true;
                             break;
                         }
                     }
                 }
                 # Ensure that UI elements requiring revision ID have
                 # the correct version information.
                 $wgOut->setRevisionId($this->getRevIdFetched());
                 # Pages containing custom CSS or JavaScript get special treatment
                 if ($this->getTitle()->isCssOrJsPage() || $this->getTitle()->isCssJsSubpage()) {
                     wfDebug(__METHOD__ . ": showing CSS/JS source\n");
                     $this->showCssOrJsPage();
                     $outputDone = true;
                 } else {
                     $rt = Title::newFromRedirectArray($text);
                     if ($rt) {
                         wfDebug(__METHOD__ . ": showing redirect=no page\n");
                         # Viewing a redirect page (e.g. with parameter redirect=no)
                         # Don't append the subtitle if this was an old revision
                         $wgOut->addHTML($this->viewRedirect($rt, !$wasRedirected && $this->isCurrent()));
                         # Parse just to get categories, displaytitle, etc.
                         $this->mParserOutput = $wgParser->parse($text, $this->getTitle(), $parserOptions);
                         $wgOut->addParserOutputNoText($this->mParserOutput);
                         $outputDone = true;
                     }
                 }
                 break;
             case 4:
                 # Run the parse, protected by a pool counter
                 wfDebug(__METHOD__ . ": doing uncached parse\n");
                 $key = $parserCache->getKey($this, $parserOptions);
                 $poolArticleView = new PoolWorkArticleView($this, $key, $useParserCache, $parserOptions);
                 if (!$poolArticleView->execute()) {
                     # Connection or timeout error
                     wfProfileOut(__METHOD__);
                     return;
                 } else {
                     $outputDone = true;
                 }
                 break;
                 # Should be unreachable, but just in case...
             # Should be unreachable, but just in case...
             default:
                 break 2;
         }
     }
     # Adjust the title if it was set by displaytitle, -{T|}- or language conversion
     if ($this->mParserOutput) {
         $titleText = $this->mParserOutput->getTitleText();
         if (strval($titleText) !== '') {
             $wgOut->setPageTitle($titleText);
         }
     }
     # For the main page, overwrite the <title> element with the con-
     # tents of 'pagetitle-view-mainpage' instead of the default (if
     # that's not empty).
     # This message always exists because it is in the i18n files
     if ($this->getTitle()->equals(Title::newMainPage())) {
         $msg = wfMessage('pagetitle-view-mainpage')->inContentLanguage();
         if (!$msg->isDisabled()) {
             $wgOut->setHTMLTitle($msg->title($this->getTitle())->text());
         }
     }
     # Now that we've filled $this->mParserOutput, we know whether
     # there are any __NOINDEX__ tags on the page
     $policy = $this->getRobotPolicy('view');
     $wgOut->setIndexPolicy($policy['index']);
     $wgOut->setFollowPolicy($policy['follow']);
     $this->showViewFooter();
     $this->mPage->viewUpdates();
     wfProfileOut(__METHOD__);
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:101,代码来源:Article.php


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