- optimize {block} compilation

This commit is contained in:
Uwe Tews
2015-07-06 03:12:25 +02:00
parent 7e7112153a
commit b198e6488c
3 changed files with 22 additions and 25 deletions

View File

@@ -297,6 +297,13 @@ abstract class Smarty_Internal_TemplateCompilerBase
*/
public $has_output = false;
/**
* Universal cache
*
* @var array
*/
public $cache = array();
/**
* Strip preg pattern
*
@@ -386,7 +393,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
$this->prefix_code = array();
$_compiled_code = '';
// get template source
$_content = $this->template->source->content;
$_content = $this->template->source->getContent();
if ($_content != '') {
// run pre filter if required
if ((isset($this->smarty->autoload_filters['pre']) || isset($this->smarty->registered_filters['pre'])) && !$this->suppressFilter) {
@@ -429,8 +436,6 @@ abstract class Smarty_Internal_TemplateCompilerBase
$_compiled_code .= $this->templateFunctionCode;
}
}
// unset content because template inheritance could have replace source with parent code
unset ($template->source->content);
$this->parent_compiler = null;
$this->template = null;
return $_compiled_code;
@@ -955,7 +960,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
*/
public function getVariableName($input)
{
if (preg_match('~^[$]_smarty_tpl->tpl_vars\[[\'"]*([0-9]*[a-zA-Z_]\w*)[\'"]*\]~', $input, $match)) {
if (preg_match('~^[$]_smarty_tpl->tpl_vars\[[\'"]*([0-9]*[a-zA-Z_]\w*)[\'"]*\]->value$~', $input, $match)) {
return $match[1];
}
return false;