27 public function compile($args, $compiler, $parameter)
29 $_index = preg_split(
"/\]\[/",substr($parameter, 1, strlen($parameter)-2));
31 $variable = trim($_index[0],
"'");
34 return "\$_smarty_tpl->getVariable('smarty')->value$parameter";
36 return "\$_smarty_tpl->getVariable('smarty')->value$parameter";
38 return "Smarty::\$_smarty_vars$parameter";
42 if (isset($compiler->smarty->security_policy) && !$compiler->smarty->security_policy->allow_super_globals) {
43 $compiler->trigger_template_error(
"(secure mode) super globals not permitted");
46 $compiled_ref =
'$_COOKIE';
55 if (isset($compiler->smarty->security_policy) && !$compiler->smarty->security_policy->allow_super_globals) {
56 $compiler->trigger_template_error(
"(secure mode) super globals not permitted");
59 $compiled_ref =
'$_'.strtoupper($variable);
63 return 'basename($_smarty_tpl->source->filepath)';
65 case 'template_object':
66 return '$_smarty_tpl';
69 return 'dirname($_smarty_tpl->source->filepath)';
76 if (isset($compiler->smarty->security_policy) && !$compiler->smarty->security_policy->allow_constants) {
77 $compiler->trigger_template_error(
"(secure mode) constants not permitted");
80 return "@constant({$_index[1]})";
83 if (isset($_index[2])) {
84 return "(is_array(\$tmp = \$_smarty_tpl->getConfigVariable($_index[1])) ? \$tmp[$_index[2]] : null)";
86 return "\$_smarty_tpl->getConfigVariable($_index[1])";
89 $_ldelim = $compiler->smarty->left_delimiter;
93 $_rdelim = $compiler->smarty->right_delimiter;
97 $compiler->trigger_template_error(
'$smarty.' . trim($_index[0],
"'") .
' is invalid');
100 if (isset($_index[1])) {
101 array_shift($_index);
102 foreach ($_index as $_ind) {
103 $compiled_ref = $compiled_ref .
"[$_ind]";
106 return $compiled_ref;
compile($args, $compiler, $parameter)
Compiles code for the speical $smarty variables.
const SMARTY_VERSION
#@+ constant definitions