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


PHP ParserOptions::getTemplateCallback方法代码示例

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


在下文中一共展示了ParserOptions::getTemplateCallback方法的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: 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']);
         }
     }
     return array($text, $finalTitle);
 }
开发者ID:h4ck3rm1k3,项目名称:mediawiki,代码行数:19,代码来源:Parser.php


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