| 
									
										
										
										
											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 use the compiler | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											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_Uncompiled extends Smarty_Resource | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-01-01 23:34:29 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Flag that it's an uncompiled resource | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var bool | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $uncompiled = true; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-23 01:25:57 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Resource does implement populateCompiledFilepath() method | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var bool | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $hasCompiledHandler = true; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Render and output the template (without using the compiler) | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @param  Smarty_Template_Source   $source    source object | 
					
						
							|  |  |  |      * @param  Smarty_Internal_Template $_template template object | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @throws SmartyException          on failure | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |     abstract public function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * populate compiled object with compiled filepath | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param Smarty_Template_Compiled $compiled  compiled object | 
					
						
							|  |  |  |      * @param Smarty_Internal_Template $_template template object (is ignored) | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $compiled->filepath = false; | 
					
						
							|  |  |  |         $compiled->timestamp = false; | 
					
						
							|  |  |  |         $compiled->exists = false; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-01-01 23:34:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * render compiled template code | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param Smarty_Internal_Template $_template | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      * @throws Exception | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function render($_template) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-03-01 21:39:54 +01:00
										 |  |  |         $level = ob_get_level(); | 
					
						
							|  |  |  |         ob_start(); | 
					
						
							| 
									
										
										
										
											2015-01-01 23:34:29 +01:00
										 |  |  |         try { | 
					
						
							|  |  |  |             $this->renderUncompiled($_template->source, $_template); | 
					
						
							|  |  |  |             return ob_get_clean(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         catch (Exception $e) { | 
					
						
							| 
									
										
										
										
											2015-03-01 21:39:54 +01:00
										 |  |  |             while (ob_get_level() > $level) { | 
					
						
							|  |  |  |                 ob_end_clean(); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-01-01 23:34:29 +01:00
										 |  |  |             throw $e; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  | } |