- minor compiler optimizations

This commit is contained in:
Uwe Tews
2015-06-27 21:50:33 +02:00
parent 38e47c7ee2
commit 1360be4eef

View File

@@ -728,13 +728,11 @@ abstract class Smarty_Internal_TemplateCompilerBase
*/ */
public function callTagCompiler($tag, $args, $param1 = null, $param2 = null, $param3 = null) public function callTagCompiler($tag, $args, $param1 = null, $param2 = null, $param3 = null)
{ {
// check if tag allowed by security
if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {
// 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_' . $tag;
if ($this->smarty->loadPlugin($class_name)) { if ((class_exists($class_name) || $this->smarty->loadPlugin($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 {
return false; return false;
@@ -743,9 +741,6 @@ abstract class Smarty_Internal_TemplateCompilerBase
// compile this tag // compile this tag
return self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3); return self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3);
} }
// no internal compile plugin for this tag
return false;
}
/** /**
* Check for plugins and return function name * Check for plugins and return function name