| 
									
										
										
										
											2015-10-18 04:46:05 +02:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty Internal Plugin Compile Shared Inheritance | 
					
						
							|  |  |  |  * Shared methods for {extends} and {block} tags | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @package    Smarty | 
					
						
							|  |  |  |  * @subpackage Compiler | 
					
						
							|  |  |  |  * @author     Uwe Tews | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty Internal Plugin Compile Shared Inheritance Class | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @package    Smarty | 
					
						
							|  |  |  |  * @subpackage Compiler | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class Smarty_Internal_Compile_Shared_Inheritance extends Smarty_Internal_CompileBase | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Register post compile callback to compile inheritance initialization code | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param \Smarty_Internal_TemplateCompilerBase $compiler | 
					
						
							|  |  |  |      * @param bool|false                            $initChildSequence if true force child template | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if ($initChildSequence || !isset($compiler->_cache[ 'inheritanceInit' ])) { | 
					
						
							| 
									
										
										
										
											2015-10-18 04:46:05 +02:00
										 |  |  |             $compiler->registerPostCompileCallback(array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'), | 
					
						
							|  |  |  |                                                    array($initChildSequence), 'inheritanceInit', $initChildSequence); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $compiler->_cache[ 'inheritanceInit' ] = true; | 
					
						
							| 
									
										
										
										
											2015-10-18 04:46:05 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Compile inheritance initialization code as prefix | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param \Smarty_Internal_TemplateCompilerBase $compiler | 
					
						
							|  |  |  |      * @param bool|false                            $initChildSequence if true force child template | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     static function postCompile(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-05-10 03:54:56 +02:00
										 |  |  |         $compiler->prefixCompiledCode .= "<?php \$_smarty_tpl->_loadInheritance();\n\$_smarty_tpl->inheritance->init(\$_smarty_tpl, " . | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                                          var_export($initChildSequence, true) . ");\n?>\n"; | 
					
						
							| 
									
										
										
										
											2015-10-18 04:46:05 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } |