| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-07-01 19:57:56 +00:00
										 |  |  |  * Smarty Internal Plugin Compile Function Plugin | 
					
						
							|  |  |  |  * Compiles code for the execution of function plugin | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2010-07-01 19:57:56 +00:00
										 |  |  |  * @subpackage Compiler | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @author     Uwe Tews | 
					
						
							| 
									
										
										
										
											2010-07-01 19:57:56 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-07-01 19:57:56 +00:00
										 |  |  |  * Smarty Internal Plugin Compile Function Plugin Class | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @subpackage Compiler | 
					
						
							| 
									
										
										
										
											2010-07-01 19:57:56 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_CompileBase | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Attribute definition: Overwrites base class. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      * @see Smarty_Internal_CompileBase | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |     public $required_attributes = array(); | 
					
						
							| 
									
										
										
										
											2015-08-06 01:19:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Attribute definition: Overwrites base class. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      * @see Smarty_Internal_CompileBase | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $optional_attributes = array('_any'); | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-07-01 19:57:56 +00:00
										 |  |  |      * Compiles code for the execution of function plugin | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |      * @param  array                                $args      array with attributes from parser | 
					
						
							|  |  |  |      * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object | 
					
						
							|  |  |  |      * @param  array                                $parameter array with compilation parameter | 
					
						
							|  |  |  |      * @param  string                               $tag       name of function plugin | 
					
						
							|  |  |  |      * @param  string                               $function  PHP function name | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-07-01 19:57:56 +00:00
										 |  |  |      * @return string compiled code | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |     public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $function) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         // check and get attributes
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         $_attr = $this->getAttributes($compiler, $args); | 
					
						
							| 
									
										
										
										
											2016-02-10 01:12:57 +01:00
										 |  |  |         //Does tag create output
 | 
					
						
							|  |  |  |         $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         unset($_attr[ 'nocache' ]); | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         // convert attributes into parameter array string
 | 
					
						
							|  |  |  |         $_paramsArray = array(); | 
					
						
							|  |  |  |         foreach ($_attr as $_key => $_value) { | 
					
						
							| 
									
										
										
										
											2009-11-18 21:51:20 +00:00
										 |  |  |             if (is_int($_key)) { | 
					
						
							|  |  |  |                 $_paramsArray[] = "$_key=>$_value"; | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $_paramsArray[] = "'$_key'=>$_value"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         $_params = 'array(' . implode(",", $_paramsArray) . ')'; | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         // compile code
 | 
					
						
							| 
									
										
										
										
											2010-11-12 23:42:32 +00:00
										 |  |  |         $output = "<?php echo {$function}({$_params},\$_smarty_tpl);?>\n"; | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         return $output; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | } |