1 | <?php |
||
49 | abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data |
||
50 | { |
||
51 | /** |
||
52 | * Set this if you want different sets of cache files for the same |
||
53 | * templates. |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | public $cache_id = null; |
||
58 | |||
59 | /** |
||
60 | * Set this if you want different sets of compiled files for the same |
||
61 | * templates. |
||
62 | * |
||
63 | * @var string |
||
64 | */ |
||
65 | public $compile_id = null; |
||
66 | |||
67 | /** |
||
68 | * caching enabled |
||
69 | * |
||
70 | * @var int |
||
71 | */ |
||
72 | public $caching = Smarty::CACHING_OFF; |
||
73 | |||
74 | /** |
||
75 | * check template for modifications? |
||
76 | * |
||
77 | * @var int |
||
78 | */ |
||
79 | public $compile_check = Smarty::COMPILECHECK_ON; |
||
80 | |||
81 | /** |
||
82 | * cache lifetime in seconds |
||
83 | * |
||
84 | * @var integer |
||
85 | */ |
||
86 | public $cache_lifetime = 3600; |
||
87 | |||
88 | /** |
||
89 | * Array of source information for known template functions |
||
90 | * |
||
91 | * @var array |
||
92 | */ |
||
93 | public $tplFunctions = array(); |
||
94 | |||
95 | /** |
||
96 | * universal cache |
||
97 | * |
||
98 | * @var array() |
||
99 | */ |
||
100 | public $_cache = array(); |
||
101 | |||
102 | /** |
||
103 | * fetches a rendered Smarty template |
||
104 | * |
||
105 | * @param string $template the resource handle of the template file or template object |
||
106 | * @param mixed $cache_id cache id to be used with this template |
||
107 | * @param mixed $compile_id compile id to be used with this template |
||
108 | * @param object $parent next higher level of Smarty variables |
||
109 | * |
||
110 | * @throws Exception |
||
111 | * @throws SmartyException |
||
112 | * @return string rendered template output |
||
113 | */ |
||
114 | public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null) |
||
119 | |||
120 | /** |
||
121 | * displays a Smarty template |
||
122 | * |
||
123 | * @param string $template the resource handle of the template file or template object |
||
124 | * @param mixed $cache_id cache id to be used with this template |
||
125 | * @param mixed $compile_id compile id to be used with this template |
||
126 | * @param object $parent next higher level of Smarty variables |
||
127 | * |
||
128 | * @throws \Exception |
||
129 | * @throws \SmartyException |
||
130 | */ |
||
131 | public function display($template = null, $cache_id = null, $compile_id = null, $parent = null) |
||
136 | |||
137 | /** |
||
138 | * test if cache is valid |
||
139 | * |
||
140 | * @api Smarty::isCached() |
||
141 | * @link http://www.smarty.net/docs/en/api.is.cached.tpl |
||
142 | * |
||
143 | * @param null|string|\Smarty_Internal_Template $template the resource handle of the template file or template |
||
144 | * object |
||
145 | * @param mixed $cache_id cache id to be used with this template |
||
146 | * @param mixed $compile_id compile id to be used with this template |
||
147 | * @param object $parent next higher level of Smarty variables |
||
148 | * |
||
149 | * @return bool cache status |
||
150 | * @throws \Exception |
||
151 | * @throws \SmartyException |
||
152 | */ |
||
153 | public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null) |
||
157 | |||
158 | /** |
||
159 | * fetches a rendered Smarty template |
||
160 | * |
||
161 | * @param string $template the resource handle of the template file or template object |
||
162 | * @param mixed $cache_id cache id to be used with this template |
||
163 | * @param mixed $compile_id compile id to be used with this template |
||
164 | * @param object $parent next higher level of Smarty variables |
||
165 | * @param string $function function type 0 = fetch, 1 = display, 2 = isCache |
||
166 | * |
||
167 | * @return mixed |
||
168 | * @throws \Exception |
||
169 | * @throws \SmartyException |
||
170 | */ |
||
171 | private function _execute($template, $cache_id, $compile_id, $parent, $function) |
||
259 | |||
260 | /** |
||
261 | * Registers plugin to be used in templates |
||
262 | * |
||
263 | * @api Smarty::registerPlugin() |
||
264 | * @link http://www.smarty.net/docs/en/api.register.plugin.tpl |
||
265 | * |
||
266 | * @param string $type plugin type |
||
267 | * @param string $name name of template tag |
||
268 | * @param callback $callback PHP callback to register |
||
269 | * @param bool $cacheable if true (default) this function is cache able |
||
270 | * @param mixed $cache_attr caching attributes if any |
||
271 | * |
||
272 | * @return \Smarty|\Smarty_Internal_Template |
||
273 | * @throws \SmartyException |
||
274 | */ |
||
275 | public function registerPlugin($type, $name, $callback, $cacheable = true, $cache_attr = null) |
||
279 | |||
280 | /** |
||
281 | * load a filter of specified type and name |
||
282 | * |
||
283 | * @api Smarty::loadFilter() |
||
284 | * @link http://www.smarty.net/docs/en/api.load.filter.tpl |
||
285 | * |
||
286 | * @param string $type filter type |
||
287 | * @param string $name filter name |
||
288 | * |
||
289 | * @return bool |
||
290 | * @throws \SmartyException |
||
291 | */ |
||
292 | public function loadFilter($type, $name) |
||
296 | |||
297 | /** |
||
298 | * Registers a filter function |
||
299 | * |
||
300 | * @api Smarty::registerFilter() |
||
301 | * @link http://www.smarty.net/docs/en/api.register.filter.tpl |
||
302 | * |
||
303 | * @param string $type filter type |
||
304 | * @param callback $callback |
||
305 | * @param string|null $name optional filter name |
||
306 | * |
||
307 | * @return \Smarty|\Smarty_Internal_Template |
||
308 | * @throws \SmartyException |
||
309 | */ |
||
310 | public function registerFilter($type, $callback, $name = null) |
||
314 | |||
315 | /** |
||
316 | * Registers object to be used in templates |
||
317 | * |
||
318 | * @api Smarty::registerObject() |
||
319 | * @link http://www.smarty.net/docs/en/api.register.object.tpl |
||
320 | * |
||
321 | * @param string $object_name |
||
322 | * @param object $object the referenced PHP object to register |
||
323 | * @param array $allowed_methods_properties list of allowed methods (empty = all) |
||
324 | * @param bool $format smarty argument format, else traditional |
||
325 | * @param array $block_methods list of block-methods |
||
326 | * |
||
327 | * @return \Smarty|\Smarty_Internal_Template |
||
328 | * @throws \SmartyException |
||
329 | */ |
||
330 | public function registerObject( |
||
346 | |||
347 | /** |
||
348 | * @param int $compile_check |
||
349 | */ |
||
350 | public function setCompileCheck($compile_check) |
||
354 | |||
355 | /** |
||
356 | * @param int $caching |
||
357 | */ |
||
358 | public function setCaching($caching) |
||
362 | |||
363 | /** |
||
364 | * @param int $cache_lifetime |
||
365 | */ |
||
366 | public function setCacheLifetime($cache_lifetime) |
||
370 | |||
371 | /** |
||
372 | * @param string $compile_id |
||
373 | */ |
||
374 | public function setCompileId($compile_id) |
||
378 | |||
379 | /** |
||
380 | * @param string $cache_id |
||
381 | */ |
||
382 | public function setCacheId($cache_id) |
||
386 | } |
||
387 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.