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


PHP ParserOutput::setFlag方法代码示例

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


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

示例1: fetchTemplateAndTitle

 /**
  * Fetch the unparsed text of a template and register a reference to it.
  * @param Title $title
  * @return array ( string or false, Title )
  */
 public function fetchTemplateAndTitle($title)
 {
     // Defaults to Parser::statelessFetchTemplate()
     $templateCb = $this->mOptions->getTemplateCallback();
     $stuff = call_user_func($templateCb, $title, $this);
     // We use U+007F DELETE to distinguish strip markers from regular text.
     $text = $stuff['text'];
     if (is_string($stuff['text'])) {
         $text = strtr($text, "", "?");
     }
     $finalTitle = isset($stuff['finalTitle']) ? $stuff['finalTitle'] : $title;
     if (isset($stuff['deps'])) {
         foreach ($stuff['deps'] as $dep) {
             $this->mOutput->addTemplate($dep['title'], $dep['page_id'], $dep['rev_id']);
             if ($dep['title']->equals($this->getTitle())) {
                 // If we transclude ourselves, the final result
                 // will change based on the new version of the page
                 $this->mOutput->setFlag('vary-revision');
             }
         }
     }
     return array($text, $finalTitle);
 }
开发者ID:rrameshs,项目名称:mediawiki,代码行数:28,代码来源:Parser.php

示例2: fetchTemplateAndTitle

 /**
  * Fetch the unparsed text of a template and register a reference to it.
  * @param Title $title
  * @return Array ( string or false, Title )
  */
 function fetchTemplateAndTitle($title)
 {
     $templateCb = $this->mOptions->getTemplateCallback();
     # Defaults to Parser::statelessFetchTemplate()
     $stuff = call_user_func($templateCb, $title, $this);
     $text = $stuff['text'];
     $finalTitle = isset($stuff['finalTitle']) ? $stuff['finalTitle'] : $title;
     if (isset($stuff['deps'])) {
         foreach ($stuff['deps'] as $dep) {
             $this->mOutput->addTemplate($dep['title'], $dep['page_id'], $dep['rev_id']);
             if ($dep['title']->equals($this->getTitle())) {
                 // If we transclude ourselves, the final result
                 // will change based on the new version of the page
                 $this->mOutput->setFlag('vary-revision');
             }
         }
     }
     return array($text, $finalTitle);
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:24,代码来源:Parser.php

示例3: getVariableValue


//.........这里部分代码省略.........
             break;
         case 'talkpagename':
             if ($this->mTitle->canTalk()) {
                 $talkPage = $this->mTitle->getTalkPage();
                 $value = wfEscapeWikiText($talkPage->getPrefixedText());
             } else {
                 $value = '';
             }
             break;
         case 'talkpagenamee':
             if ($this->mTitle->canTalk()) {
                 $talkPage = $this->mTitle->getTalkPage();
                 $value = wfEscapeWikiText($talkPage->getPrefixedUrl());
             } else {
                 $value = '';
             }
             break;
         case 'subjectpagename':
             $subjPage = $this->mTitle->getSubjectPage();
             $value = wfEscapeWikiText($subjPage->getPrefixedText());
             break;
         case 'subjectpagenamee':
             $subjPage = $this->mTitle->getSubjectPage();
             $value = wfEscapeWikiText($subjPage->getPrefixedUrl());
             break;
         case 'pageid':
             // requested in bug 23427
             $pageid = $this->getTitle()->getArticleId();
             if ($pageid == 0) {
                 # 0 means the page doesn't exist in the database,
                 # which means the user is previewing a new page.
                 # The vary-revision flag must be set, because the magic word
                 # will have a different value once the page is saved.
                 $this->mOutput->setFlag('vary-revision');
                 wfDebug(__METHOD__ . ": {{PAGEID}} used in a new page, setting vary-revision...\n");
             }
             $value = $pageid ? $pageid : null;
             break;
         case 'revisionid':
             # Let the edit saving system know we should parse the page
             # *after* a revision ID has been assigned.
             $this->mOutput->setFlag('vary-revision');
             wfDebug(__METHOD__ . ": {{REVISIONID}} used, setting vary-revision...\n");
             $value = $this->mRevisionId;
             break;
         case 'revisionday':
             # Let the edit saving system know we should parse the page
             # *after* a revision ID has been assigned. This is for null edits.
             $this->mOutput->setFlag('vary-revision');
             wfDebug(__METHOD__ . ": {{REVISIONDAY}} used, setting vary-revision...\n");
             $value = intval(substr($this->getRevisionTimestamp(), 6, 2));
             break;
         case 'revisionday2':
             # Let the edit saving system know we should parse the page
             # *after* a revision ID has been assigned. This is for null edits.
             $this->mOutput->setFlag('vary-revision');
             wfDebug(__METHOD__ . ": {{REVISIONDAY2}} used, setting vary-revision...\n");
             $value = substr($this->getRevisionTimestamp(), 6, 2);
             break;
         case 'revisionmonth':
             # Let the edit saving system know we should parse the page
             # *after* a revision ID has been assigned. This is for null edits.
             $this->mOutput->setFlag('vary-revision');
             wfDebug(__METHOD__ . ": {{REVISIONMONTH}} used, setting vary-revision...\n");
             $value = substr($this->getRevisionTimestamp(), 4, 2);
             break;
开发者ID:h4ck3rm1k3,项目名称:mediawiki,代码行数:67,代码来源:Parser.php


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