本文整理汇总了PHP中FileTemplate::getSource方法的典型用法代码示例。如果您正苦于以下问题:PHP FileTemplate::getSource方法的具体用法?PHP FileTemplate::getSource怎么用?PHP FileTemplate::getSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileTemplate
的用法示例。
在下文中一共展示了FileTemplate::getSource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
$this->newSource = preg_replace_callback('(\\$[\\w\\[\\]\\(\\)\'\\-\\>]*)', function ($matches) {
if (strpos($matches[0], 'style') !== FALSE || strpos($matches[0], '$presenter') !== FALSE) {
return $matches[0];
}
return "'" . str_replace(array("'"), array('"'), $matches[0]) . "'";
}, parent::getSource());
$this->newSource = preg_replace_callback('/\\{[^}]*\\}/', function ($matches) {
if (strpos($matches[0], '{if') !== FALSE || strpos($matches[0], '/if}') !== FALSE || strpos($matches[0], '{ifset') !== FALSE || strpos($matches[0], '/ifset}') !== FALSE || strpos($matches[0], '{for') !== FALSE || strpos($matches[0], '/for}') !== FALSE || strpos($matches[0], '/foreach}') !== FALSE || strpos($matches[0], '{else') !== FALSE || strpos($matches[0], '{var') !== FALSE || strpos($matches[0], '|round') !== FALSE || strpos($matches[0], 'round(') !== FALSE || strpos($matches[0], 'strtolower') !== FALSE || strpos($matches[0], 'nl2br') !== FALSE || strpos($matches[0], '{?') !== FALSE || strpos($matches[0], 'count(') !== FALSE || strpos($matches[0], '|count') !== FALSE || strpos($matches[0], '|replace') !== FALSE || strpos($matches[0], 'replace(') !== FALSE || strpos($matches[0], '_replace') !== FALSE || strpos($matches[0], '{sep') !== FALSE || strpos($matches[0], '/sep}') !== FALSE || strpos($matches[0], '{last') !== FALSE || strpos($matches[0], '/last}') !== FALSE || strpos($matches[0], '{first') !== FALSE || strpos($matches[0], '/first}') !== FALSE || strpos($matches[0], '{*') !== FALSE || strpos($matches[0], '*}') !== FALSE) {
return '';
} elseif (strpos($matches[0], 'number') !== FALSE || strpos($matches[0], '|ceil') !== FALSE || strpos($matches[0], 'ceil(') !== FALSE) {
return "{'NUMBER'}";
} elseif (strpos($matches[0], '{control') !== FALSE) {
return "{'control'}";
} elseif (strpos($matches[0], '|ucwords') !== FALSE || strpos($matches[0], 'ucwords(') !== FALSE) {
return "{'NAME'}";
} elseif (strpos($matches[0], '|date') !== FALSE || strpos($matches[0], 'date(') !== FALSE || strpos($matches[0], 'format(') !== FALSE) {
return "{'DATE'}";
} elseif (strpos($matches[0], '?') !== FALSE) {
return str_replace(array(':', '?'), '.', $matches[0]);
}
return $matches[0];
}, $this->newSource);
$this->newSource = str_replace(array("n:", "[''", "{*", "*}", "ucwords", "{('", "')}", ")' }", "', ('"), array("", "[", '', '', '', "{'", "'}", "') }", "', '"), $this->newSource);
// Uncomment for debugging code
//die($this->newSource);
parent::render();
}