| 
									
										
										
										
											2009-04-24 19:59:51 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2009-04-24 22:36:12 +00:00
										 |  |  | * Smarty Internal Plugin Compile Function
 | 
					
						
							| 
									
										
										
										
											2009-04-24 19:59:51 +00:00
										 |  |  | *  | 
					
						
							| 
									
										
										
										
											2009-04-24 22:36:12 +00:00
										 |  |  | * Compiles the {function} tag | 
					
						
							| 
									
										
										
										
											2009-04-24 19:59:51 +00:00
										 |  |  | *  | 
					
						
							|  |  |  | * @package Smarty | 
					
						
							|  |  |  | * @subpackage Compiler | 
					
						
							|  |  |  | * @author Uwe Tews  | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2009-04-24 22:36:12 +00:00
										 |  |  | * Smarty Internal Plugin Compile Function Class | 
					
						
							| 
									
										
										
										
											2009-04-24 19:59:51 +00:00
										 |  |  | */ | 
					
						
							| 
									
										
										
										
											2009-04-24 22:36:12 +00:00
										 |  |  | class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase { | 
					
						
							| 
									
										
										
										
											2009-04-24 19:59:51 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2009-04-24 22:36:12 +00:00
										 |  |  |     * Compiles code for the {function} tag | 
					
						
							| 
									
										
										
										
											2009-04-24 19:59:51 +00:00
										 |  |  |     *  | 
					
						
							|  |  |  |     * @param array $args array with attributes from parser | 
					
						
							|  |  |  |     * @param object $compiler compiler object | 
					
						
							|  |  |  |     * @return boolean true | 
					
						
							|  |  |  |     */ | 
					
						
							|  |  |  |     public function compile($args, $compiler) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $this->compiler = $compiler; | 
					
						
							|  |  |  |         $this->required_attributes = array('name'); | 
					
						
							|  |  |  |         $this->optional_attributes = array('_any');  | 
					
						
							|  |  |  |         // check and get attributes
 | 
					
						
							|  |  |  |         $_attr = $this->_get_attributes($args); | 
					
						
							|  |  |  |         $save = array($_attr, $compiler->template->extracted_compiled_code, $compiler->template->extract_code); | 
					
						
							| 
									
										
										
										
											2009-04-24 22:36:12 +00:00
										 |  |  |         $this->_open_tag('function', $save); | 
					
						
							| 
									
										
										
										
											2009-04-24 19:59:51 +00:00
										 |  |  |         $_name = trim($_attr['name'], "'"); | 
					
						
							|  |  |  |         foreach ($_attr as $_key => $_data) { | 
					
						
							| 
									
										
										
										
											2009-04-24 22:36:12 +00:00
										 |  |  |             $compiler->template->properties['function'][$_name]['parameter'][$_key] = $_data; | 
					
						
							| 
									
										
										
										
											2009-04-24 19:59:51 +00:00
										 |  |  |         }  | 
					
						
							| 
									
										
										
										
											2009-05-05 17:19:33 +00:00
										 |  |  |         // make function known for recursive calls
 | 
					
						
							| 
									
										
										
										
											2009-06-14 11:07:26 +00:00
										 |  |  |         $this->compiler->smarty->template_functions[$_name]['compiled'] = ''; | 
					
						
							| 
									
										
										
										
											2009-04-24 19:59:51 +00:00
										 |  |  |         $compiler->template->extract_code = true; | 
					
						
							|  |  |  |         $compiler->template->extracted_compiled_code = ''; | 
					
						
							|  |  |  |         $compiler->template->has_code = false; | 
					
						
							|  |  |  |         return true; | 
					
						
							|  |  |  |     }  | 
					
						
							|  |  |  | }  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ?>
 |