PEEL Shopping
Open source ecommerce : PEEL Shopping
smarty_internal_compile_private_special_variable.php
Go to the documentation of this file.
1 <?php
19 
27  public function compile($args, $compiler, $parameter)
28  {
29  $_index = preg_split("/\]\[/",substr($parameter, 1, strlen($parameter)-2));
30  $compiled_ref = ' ';
31  $variable = trim($_index[0], "'");
32  switch ($variable) {
33  case 'foreach':
34  return "\$_smarty_tpl->getVariable('smarty')->value$parameter";
35  case 'section':
36  return "\$_smarty_tpl->getVariable('smarty')->value$parameter";
37  case 'capture':
38  return "Smarty::\$_smarty_vars$parameter";
39  case 'now':
40  return 'time()';
41  case 'cookies':
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");
44  break;
45  }
46  $compiled_ref = '$_COOKIE';
47  break;
48 
49  case 'get':
50  case 'post':
51  case 'env':
52  case 'server':
53  case 'session':
54  case 'request':
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");
57  break;
58  }
59  $compiled_ref = '$_'.strtoupper($variable);
60  break;
61 
62  case 'template':
63  return 'basename($_smarty_tpl->source->filepath)';
64 
65  case 'template_object':
66  return '$_smarty_tpl';
67 
68  case 'current_dir':
69  return 'dirname($_smarty_tpl->source->filepath)';
70 
71  case 'version':
72  $_version = Smarty::SMARTY_VERSION;
73  return "'$_version'";
74 
75  case 'const':
76  if (isset($compiler->smarty->security_policy) && !$compiler->smarty->security_policy->allow_constants) {
77  $compiler->trigger_template_error("(secure mode) constants not permitted");
78  break;
79  }
80  return "@constant({$_index[1]})";
81 
82  case 'config':
83  if (isset($_index[2])) {
84  return "(is_array(\$tmp = \$_smarty_tpl->getConfigVariable($_index[1])) ? \$tmp[$_index[2]] : null)";
85  } else {
86  return "\$_smarty_tpl->getConfigVariable($_index[1])";
87  }
88  case 'ldelim':
89  $_ldelim = $compiler->smarty->left_delimiter;
90  return "'$_ldelim'";
91 
92  case 'rdelim':
93  $_rdelim = $compiler->smarty->right_delimiter;
94  return "'$_rdelim'";
95 
96  default:
97  $compiler->trigger_template_error('$smarty.' . trim($_index[0], "'") . ' is invalid');
98  break;
99  }
100  if (isset($_index[1])) {
101  array_shift($_index);
102  foreach ($_index as $_ind) {
103  $compiled_ref = $compiled_ref . "[$_ind]";
104  }
105  }
106  return $compiled_ref;
107  }
108 
109 }
110 
111 ?>
compile($args, $compiler, $parameter)
Compiles code for the speical $smarty variables.
const SMARTY_VERSION
#@+ constant definitions

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:17 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.