| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty Resource Plugin | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @subpackage TemplateResources | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @author     Rodney Rehm | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty Resource Plugin | 
					
						
							|  |  |  |  * Base implementation for resource plugins that don't compile cache | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @subpackage TemplateResources | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | abstract class Smarty_Resource_Recompiled extends Smarty_Resource | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-01-01 23:34:29 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Flag that it's an recompiled resource | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var bool | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $recompiled = true; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-23 01:25:57 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Resource does implement populateCompiledFilepath() method | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var bool | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $hasCompiledHandler = true; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-15 11:13:31 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * compile template from source | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @throws Exception | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function process(Smarty_Internal_Template $_smarty_tpl) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $compiled = &$_smarty_tpl->compiled; | 
					
						
							|  |  |  |         $compiled->file_dependency = array(); | 
					
						
							|  |  |  |         $compiled->includes = array(); | 
					
						
							|  |  |  |         $compiled->nocache_hash = null; | 
					
						
							|  |  |  |         $compiled->unifunc = null; | 
					
						
							|  |  |  |         $level = ob_get_level(); | 
					
						
							|  |  |  |         ob_start(); | 
					
						
							|  |  |  |         $_smarty_tpl->loadCompiler(); | 
					
						
							|  |  |  |         // call compiler
 | 
					
						
							|  |  |  |         try { | 
					
						
							|  |  |  |             eval("?>" . $_smarty_tpl->compiler->compileTemplate($_smarty_tpl)); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         catch (Exception $e) { | 
					
						
							|  |  |  |             unset($_smarty_tpl->compiler); | 
					
						
							|  |  |  |             while (ob_get_level() > $level) { | 
					
						
							|  |  |  |                 ob_end_clean(); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             throw $e; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         // release compiler object to free memory
 | 
					
						
							|  |  |  |         unset($_smarty_tpl->compiler); | 
					
						
							|  |  |  |         ob_get_clean(); | 
					
						
							|  |  |  |         $compiled->timestamp = time(); | 
					
						
							|  |  |  |         $compiled->exists = true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * populate Compiled Object with compiled filepath | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @param  Smarty_Template_Compiled $compiled  compiled object | 
					
						
							|  |  |  |      * @param  Smarty_Internal_Template $_template template object | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $compiled->filepath = false; | 
					
						
							|  |  |  |         $compiled->timestamp = false; | 
					
						
							|  |  |  |         $compiled->exists = false; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-05-15 11:13:31 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /* | 
					
						
							|  |  |  |        * Disable timestamp checks for recompiled resource. | 
					
						
							|  |  |  |        * | 
					
						
							|  |  |  |        * @return bool | 
					
						
							|  |  |  |        */ | 
					
						
							|  |  |  |     public function checkTimestamps() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | } |