move compileVariable() from parser to compiler

This commit is contained in:
Uwe Tews
2015-04-02 01:35:16 +02:00
parent ea2a566b1f
commit e9fd2354ef
3 changed files with 184 additions and 202 deletions
@@ -577,6 +577,24 @@ abstract class Smarty_Internal_TemplateCompilerBase
}
}
/**
* compile variable
*
* @param string $variable
*
* @return string
*/
public function compileVariable($variable)
{
if (strpos($variable, '(') == 0) {
// not a variable variable
$var = trim($variable, '\'');
$this->tag_nocache = $this->tag_nocache | $this->template->getVariable($var, null, true, false)->nocache;
$this->template->properties['variables'][$var] = $this->tag_nocache | $this->nocache;
}
return '$_smarty_tpl->tpl_vars[' . $variable . ']->value';
}
/**
* lazy loads internal compile plugin for tag and calls the compile method
* compile objects cached for reuse.