| 
									
										
										
										
											2010-05-05 19:48:42 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty Internal Plugin Nocache Insert | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2010-05-05 19:48:42 +00:00
										 |  |  |  * Compiles the {insert} tag into the cache file | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2010-05-05 19:48:42 +00:00
										 |  |  |  * @package Smarty | 
					
						
							|  |  |  |  * @subpackage Compiler | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @author Uwe Tews | 
					
						
							| 
									
										
										
										
											2010-05-05 19:48:42 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-05 19:48:42 +00:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Smarty Internal Plugin Compile Insert Class | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @package Smarty | 
					
						
							|  |  |  |  * @subpackage Compiler | 
					
						
							| 
									
										
										
										
											2010-05-05 19:48:42 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | class Smarty_Internal_Nocache_Insert { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-05 19:48:42 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Compiles code for the {insert} tag into cache file | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @param string                   $_function insert function name | 
					
						
							|  |  |  |      * @param array                    $_attr     array with paramter | 
					
						
							|  |  |  |      * @param Smarty_Internal_Template $_template template object | 
					
						
							|  |  |  |      * @param string                   $_script   script name to load or 'null' | 
					
						
							|  |  |  |      * @param string                   $_assign   optional variable name | 
					
						
							| 
									
										
										
										
											2010-05-05 19:48:42 +00:00
										 |  |  |      * @return string compiled code | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public static function compile($_function, $_attr, $_template, $_script, $_assign = null) | 
					
						
							| 
									
										
										
										
											2010-05-05 19:48:42 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         $_output = '<?php '; | 
					
						
							|  |  |  |         if ($_script != 'null') { | 
					
						
							|  |  |  |             // script which must be included
 | 
					
						
							|  |  |  |             // code for script file loading
 | 
					
						
							|  |  |  |             $_output .= "require_once '{$_script}';"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-05-05 19:48:42 +00:00
										 |  |  |         // call insert
 | 
					
						
							|  |  |  |         if (isset($_assign)) { | 
					
						
							| 
									
										
										
										
											2010-11-12 23:42:32 +00:00
										 |  |  |             $_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) . ",\$_smarty_tpl), true);?>"; | 
					
						
							| 
									
										
										
										
											2010-05-05 19:48:42 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2010-11-12 23:42:32 +00:00
										 |  |  |             $_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-05-07 18:28:17 +00:00
										 |  |  |         $_tpl = $_template; | 
					
						
							|  |  |  |         while ($_tpl->parent instanceof Smarty_Internal_Template) { | 
					
						
							|  |  |  |             $_tpl = $_tpl->parent; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-05-07 18:28:17 +00:00
										 |  |  |         return "/*%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/" . $_output . "/*/%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2010-05-07 18:28:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-05 19:48:42 +00:00
										 |  |  | ?>
 |