| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * Smarty Internal Plugin Compile Object Function
 | 
					
						
							| 
									
										
										
										
											2010-03-16 18:26:46 +00:00
										 |  |  |  * Compiles code for registered objects as function
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2010-03-16 18:26:46 +00:00
										 |  |  |  * @subpackage Compiler | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @author     Uwe Tews | 
					
						
							| 
									
										
										
										
											2010-03-16 18:26:46 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-03-16 18:26:46 +00:00
										 |  |  |  * Smarty Internal Plugin Compile Object Function 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-03-16 18:26:46 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_CompileBase | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											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-03-16 18:26:46 +00:00
										 |  |  |      * Compiles code for the execution of function plugin | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-08-06 01:19:11 +02: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
 | 
					
						
							|  |  |  |      * @param  string                                      $method    name of method to call | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-03-16 18:26:46 +00:00
										 |  |  |      * @return string compiled code | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-08-06 01:19:11 +02:00
										 |  |  |     public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $method) | 
					
						
							| 
									
										
										
										
											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); | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |         if ($_attr['nocache'] === true) { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $compiler->tag_nocache = true; | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |         unset($_attr['nocache']); | 
					
						
							| 
									
										
										
										
											2010-03-16 18:26:46 +00:00
										 |  |  |         $_assign = null; | 
					
						
							|  |  |  |         if (isset($_attr['assign'])) { | 
					
						
							|  |  |  |             $_assign = $_attr['assign']; | 
					
						
							|  |  |  |             unset($_attr['assign']); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2013-07-27 09:48:42 +00:00
										 |  |  |         // method or property ?
 | 
					
						
							|  |  |  |         if (method_exists($compiler->smarty->registered_objects[$tag][0], $method)) { | 
					
						
							|  |  |  |             // convert attributes into parameter array string
 | 
					
						
							|  |  |  |             if ($compiler->smarty->registered_objects[$tag][2]) { | 
					
						
							|  |  |  |                 $_paramsArray = array(); | 
					
						
							|  |  |  |                 foreach ($_attr as $_key => $_value) { | 
					
						
							|  |  |  |                     if (is_int($_key)) { | 
					
						
							|  |  |  |                         $_paramsArray[] = "$_key=>$_value"; | 
					
						
							|  |  |  |                     } else { | 
					
						
							|  |  |  |                         $_paramsArray[] = "'$_key'=>$_value"; | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2013-07-27 09:48:42 +00:00
										 |  |  |                 $_params = 'array(' . implode(",", $_paramsArray) . ')'; | 
					
						
							|  |  |  |                 $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)"; | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $_params = implode(",", $_attr); | 
					
						
							|  |  |  |                 $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2010-01-16 12:03:53 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2013-07-27 09:48:42 +00:00
										 |  |  |             // object property
 | 
					
						
							|  |  |  |             $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2013-07-27 09:48:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-16 18:26:46 +00:00
										 |  |  |         if (empty($_assign)) { | 
					
						
							|  |  |  |             // This tag does create output
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $compiler->has_output = true; | 
					
						
							| 
									
										
										
										
											2010-03-16 18:26:46 +00:00
										 |  |  |             $output = "<?php echo {$return};?>\n"; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $output = "<?php \$_smarty_tpl->assign({$_assign},{$return});?>\n"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											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
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  | } |