本文整理汇总了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);
}
示例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);
}
示例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);
}