- compiler optimization

This commit is contained in:
Uwe Tews
2015-06-29 20:45:21 +02:00
parent 3052406cfc
commit 83f6154eae

View File

@@ -391,6 +391,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
$this->smarty->_current_file = $this->template->source->filepath; $this->smarty->_current_file = $this->template->source->filepath;
// free memory // free memory
unset($this->parser->root_buffer, $this->parser->current_buffer, $this->parser, $this->lex); unset($this->parser->root_buffer, $this->parser->current_buffer, $this->parser, $this->lex);
self::$_tag_objects = array();
// return compiled code to template object // return compiled code to template object
$merged_code = ''; $merged_code = '';
if (!empty($this->mergedSubTemplatesCode)) { if (!empty($this->mergedSubTemplatesCode)) {
@@ -741,15 +742,16 @@ abstract class Smarty_Internal_TemplateCompilerBase
// re-use object if already exists // re-use object if already exists
if (!isset(self::$_tag_objects[$tag])) { if (!isset(self::$_tag_objects[$tag])) {
// lazy load internal compiler plugin // lazy load internal compiler plugin
$class_name = 'Smarty_Internal_Compile_' . $tag; $class_name = 'Smarty_Internal_Compile_' . ucfirst($tag);
if ((class_exists($class_name) || $this->smarty->loadPlugin($class_name)) && (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this))) { if (class_exists($class_name) && (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this))) {
self::$_tag_objects[$tag] = new $class_name; self::$_tag_objects[$tag] = new $class_name;
} else { } else {
self::$_tag_objects[$tag] = false;
return false; return false;
} }
} }
// compile this tag // compile this tag
return self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3); return self::$_tag_objects[$tag] === false ? false : self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3);
} }
/** /**