| 
									
										
										
										
											2009-12-31 16:38:12 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-05-25 19:33:55 +00:00
										 |  |  |  * Smarty Internal Plugin Function Call Handler | 
					
						
							|  |  |  |  *  | 
					
						
							|  |  |  |  * @package Smarty | 
					
						
							|  |  |  |  * @subpackage PluginsInternal | 
					
						
							|  |  |  |  * @author Uwe Tews  | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2009-12-31 16:38:12 +00:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-05-25 19:33:55 +00:00
										 |  |  |  * This class does call function defined with the {function} tag | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2009-12-31 16:38:12 +00:00
										 |  |  | class Smarty_Internal_Function_Call_Handler extends Smarty_Internal_Template { | 
					
						
							| 
									
										
										
										
											2010-05-25 19:33:55 +00:00
										 |  |  |     static function call ($_name, $_template, $_params, $_hash, $_nocache) | 
					
						
							| 
									
										
										
										
											2009-12-31 16:38:12 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-05-25 19:33:55 +00:00
										 |  |  |         if ($_nocache) { | 
					
						
							|  |  |  |             $_function = "smarty_template_function_{$_name}_nocache"; | 
					
						
							|  |  |  |             $_template->smarty->template_functions[$_name]['called_nocache'] = true; | 
					
						
							| 
									
										
										
										
											2009-12-31 16:38:12 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2010-05-25 19:33:55 +00:00
										 |  |  |             $_function = "smarty_template_function_{$_hash}_{$_name}"; | 
					
						
							| 
									
										
										
										
											2009-12-31 16:38:12 +00:00
										 |  |  |         }  | 
					
						
							| 
									
										
										
										
											2010-05-25 19:33:55 +00:00
										 |  |  |         if (!is_callable($_function)) { | 
					
						
							|  |  |  |             $_code = "function {$_function}(\$_smarty_tpl,\$params) {
 | 
					
						
							|  |  |  | 	\$saved_tpl_vars = \$_smarty_tpl->tpl_vars; | 
					
						
							|  |  |  | 	foreach (\$params as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);}?>";
 | 
					
						
							|  |  |  |             if ($_nocache) { | 
					
						
							|  |  |  |                 $_code .= preg_replace(array("!<\?php echo \\'/\*%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/|/\*/%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/\\';\?>!", | 
					
						
							|  |  |  |                         "!\\\'!"), array('', "'"), $_template->smarty->template_functions[$_name]['compiled']); | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $_code .= preg_replace("/{$_template->smarty->template_functions[$_name]['nocache_hash']}/", $_template->properties['nocache_hash'], $_template->smarty->template_functions[$_name]['compiled']); | 
					
						
							| 
									
										
										
										
											2009-12-31 16:38:12 +00:00
										 |  |  |             }  | 
					
						
							| 
									
										
										
										
											2010-05-25 19:33:55 +00:00
										 |  |  |             $_code .= "<?php \$_smarty_tpl->tpl_vars = \$saved_tpl_vars;}"; | 
					
						
							|  |  |  |             eval($_code); | 
					
						
							| 
									
										
										
										
											2009-12-31 16:38:12 +00:00
										 |  |  |         }  | 
					
						
							| 
									
										
										
										
											2010-05-25 19:33:55 +00:00
										 |  |  |         $_function($_template, $_params); | 
					
						
							| 
									
										
										
										
											2009-12-31 16:38:12 +00:00
										 |  |  |     }  | 
					
						
							|  |  |  | }  | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-25 19:33:55 +00:00
										 |  |  | ?>
 |