| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |  * Smarty Internal Plugin Template | 
					
						
							|  |  |  |  * This file contains the Smarty template engine | 
					
						
							| 
									
										
										
										
											2011-03-16 23:57:04 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |  * @subpackage Template | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @author     Uwe Tews | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |  * Main class with template data structures and methods | 
					
						
							| 
									
										
										
										
											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 Template | 
					
						
							| 
									
										
										
										
											2015-01-07 17:46:12 +01:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-05-01 23:53:38 +02:00
										 |  |  |  * @property Smarty_Template_Compiled             $compiled | 
					
						
							|  |  |  |  * @property Smarty_Template_Cached               $cached | 
					
						
							|  |  |  |  * @property Smarty_Internal_TemplateCompilerBase $compiler | 
					
						
							| 
									
										
										
										
											2015-12-27 07:18:35 +01:00
										 |  |  |  * | 
					
						
							|  |  |  |  * The following methods will be dynamically loaded by the extension handler when they are called. | 
					
						
							|  |  |  |  * They are located in a corresponding Smarty_Internal_Method_xxxx class | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2015-08-17 21:52:32 +02:00
										 |  |  |  * @method bool mustCompile() | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | class Smarty_Internal_Template extends Smarty_Internal_TemplateBase | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-08-17 21:52:32 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * This object type (Smarty = 1, template = 2, data = 4) | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $_objType = 2; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-15 01:45:37 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Global smarty instance | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var Smarty | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $smarty = null; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-06 19:12:24 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Source instance | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2016-07-19 00:19:22 +02:00
										 |  |  |      * @var Smarty_Template_Source|Smarty_Template_Config | 
					
						
							| 
									
										
										
										
											2015-08-06 19:12:24 +02:00
										 |  |  |      */ | 
					
						
							|  |  |  |     public $source = null; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-10 03:54:56 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Inheritance runtime extension | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var Smarty_Internal_Runtime_Inheritance | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $inheritance = null; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2014-12-31 15:44:08 +01:00
										 |  |  |      * Template resource | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2014-12-31 15:44:08 +01:00
										 |  |  |     public $template_resource = null; | 
					
						
							| 
									
										
										
										
											2015-07-07 17:51:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * flag if compiled template is invalid and must be (re)compiled | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * @var bool | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     public $mustCompile = null; | 
					
						
							| 
									
										
										
										
											2015-07-07 17:51:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-10 21:57:06 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Template Id | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-09-01 02:27:22 +02:00
										 |  |  |      * @var null|string | 
					
						
							| 
									
										
										
										
											2015-08-10 21:57:06 +02:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-09-01 02:27:22 +02:00
										 |  |  |     public $templateId = null; | 
					
						
							| 
									
										
										
										
											2015-08-10 21:57:06 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-24 04:45:09 +02:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |      * Scope in which variables shall be assigned | 
					
						
							| 
									
										
										
										
											2015-10-24 04:45:09 +02:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @var int | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $scope = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-14 02:54:38 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Flag which is set while rending a cache file | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var bool | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $isRenderingCache = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-11 02:55:55 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Callbacks called before rendering template | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var callback[] | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $startRenderCallbacks = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Callbacks called after rendering template | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var callback[] | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $endRenderCallbacks = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-23 17:12:38 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Template object cache | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var Smarty_Internal_Template[] | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public static $tplObjCache = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Template object cache for Smarty::isCached() == true | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var Smarty_Internal_Template[] | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public static $isCacheTplObj = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Subtemplate Info Cache | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string[]int[] | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public static $subTplInfo = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-01 01:54:28 +02:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |      * Create template data object | 
					
						
							|  |  |  |      * Some of the global Smarty settings copied to template scope | 
					
						
							| 
									
										
										
										
											2015-01-07 17:46:12 +01:00
										 |  |  |      * It load the required template resources and caching plugins | 
					
						
							| 
									
										
										
										
											2011-03-16 23:57:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2016-09-11 05:41:16 +02:00
										 |  |  |      * @param string                                                       $template_resource template resource string | 
					
						
							|  |  |  |      * @param Smarty                                                       $smarty            Smarty instance | 
					
						
							|  |  |  |      * @param null|\Smarty_Internal_Template|\Smarty|\Smarty_Internal_Data $_parent           back pointer to parent object | 
					
						
							|  |  |  |      *                                                                                        with variables or null | 
					
						
							|  |  |  |      * @param mixed                                                        $_cache_id         cache   id or null | 
					
						
							|  |  |  |      * @param mixed                                                        $_compile_id       compile id or null | 
					
						
							|  |  |  |      * @param bool|int|null                                                $_caching          use caching? | 
					
						
							|  |  |  |      * @param int|null                                                     $_cache_lifetime   cache life-time in seconds | 
					
						
							|  |  |  |      * @param bool                                                         $_isConfig | 
					
						
							| 
									
										
										
										
											2015-08-15 18:35:51 +02:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @throws \SmartyException | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-09-01 02:27:22 +02:00
										 |  |  |     public function __construct($template_resource, Smarty $smarty, Smarty_Internal_Data $_parent = null, | 
					
						
							| 
									
										
										
										
											2016-09-11 05:41:16 +02:00
										 |  |  |                                 $_cache_id = null, $_compile_id = null, $_caching = null, $_cache_lifetime = null, | 
					
						
							|  |  |  |                                 $_isConfig = false) | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |         $this->smarty = $smarty; | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         // Smarty parameter
 | 
					
						
							|  |  |  |         $this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id; | 
					
						
							|  |  |  |         $this->compile_id = $_compile_id === null ? $this->smarty->compile_id : $_compile_id; | 
					
						
							| 
									
										
										
										
											2009-11-26 22:49:56 +00:00
										 |  |  |         $this->caching = $_caching === null ? $this->smarty->caching : $_caching; | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |         if ($this->caching === true) { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $this->caching = Smarty::CACHING_LIFETIME_CURRENT; | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         $this->cache_lifetime = $_cache_lifetime === null ? $this->smarty->cache_lifetime : $_cache_lifetime; | 
					
						
							| 
									
										
										
										
											2011-03-16 23:57:04 +00:00
										 |  |  |         $this->parent = $_parent; | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         // Template resource
 | 
					
						
							| 
									
										
										
										
											2011-03-16 23:57:04 +00:00
										 |  |  |         $this->template_resource = $template_resource; | 
					
						
							| 
									
										
										
										
											2016-09-11 05:41:16 +02:00
										 |  |  |         $this->source = $_isConfig ? Smarty_Template_Config::load($this) : Smarty_Template_Source::load($this); | 
					
						
							| 
									
										
										
										
											2015-10-24 04:45:09 +02:00
										 |  |  |         parent::__construct(); | 
					
						
							| 
									
										
										
										
											2016-03-11 02:55:55 +01:00
										 |  |  |         if ($smarty->security_policy && method_exists($smarty->security_policy, 'registerCallBacks')) { | 
					
						
							|  |  |  |             $smarty->security_policy->registerCallBacks($this); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-03-16 23:57:04 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * render template | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |      * @param  bool      $no_output_filter if true do not run output filter | 
					
						
							| 
									
										
										
										
											2015-12-27 08:12:46 +01:00
										 |  |  |      * @param  null|bool $display          true: display, false: fetch null: sub-template | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-12-27 08:12:46 +01:00
										 |  |  |      * @return string | 
					
						
							|  |  |  |      * @throws \SmartyException | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-10-24 22:43:19 +02:00
										 |  |  |     public function render($no_output_filter = true, $display = null) | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         if ($this->smarty->debugging) { | 
					
						
							| 
									
										
										
										
											2016-07-13 01:07:53 +02:00
										 |  |  |             if (!isset($this->smarty->_debug)) { | 
					
						
							|  |  |  |                 $this->smarty->_debug = new Smarty_Internal_Debug(); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |             $this->smarty->_debug->start_template($this, $display); | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-07-01 06:44:28 +02:00
										 |  |  |         // checks if template exists
 | 
					
						
							|  |  |  |         if (!$this->source->exists) { | 
					
						
							| 
									
										
										
										
											2016-08-07 16:08:10 +02:00
										 |  |  |             throw new SmartyException("Unable to load template '{$this->source->type}:{$this->source->name}'" . | 
					
						
							| 
									
										
										
										
											2016-09-11 04:35:52 +02:00
										 |  |  |                                       ($this->_isSubTpl() ? " in '{$this->parent->template_resource}'" : '')); | 
					
						
							| 
									
										
										
										
											2015-07-01 06:44:28 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-08-23 05:35:13 +02:00
										 |  |  |         // disable caching for evaluated code
 | 
					
						
							|  |  |  |         if ($this->source->handler->recompiled) { | 
					
						
							|  |  |  |             $this->caching = false; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         // read from cache or render
 | 
					
						
							| 
									
										
										
										
											2015-09-01 02:27:22 +02:00
										 |  |  |         $isCacheTpl = | 
					
						
							|  |  |  |             $this->caching == Smarty::CACHING_LIFETIME_CURRENT || $this->caching == Smarty::CACHING_LIFETIME_SAVED; | 
					
						
							| 
									
										
										
										
											2015-08-23 05:35:13 +02:00
										 |  |  |         if ($isCacheTpl) { | 
					
						
							| 
									
										
										
										
											2016-03-01 00:54:33 +01:00
										 |  |  |             if (!isset($this->cached) || $this->cached->cache_id !== $this->cache_id || | 
					
						
							|  |  |  |                 $this->cached->compile_id !== $this->compile_id | 
					
						
							|  |  |  |             ) { | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |                 $this->loadCached(true); | 
					
						
							| 
									
										
										
										
											2015-08-23 05:35:13 +02:00
										 |  |  |             } | 
					
						
							|  |  |  |             $this->cached->render($this, $no_output_filter); | 
					
						
							| 
									
										
										
										
											2015-08-23 01:25:57 +02:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2016-03-01 00:54:33 +01:00
										 |  |  |             if (!isset($this->compiled) || $this->compiled->compile_id !== $this->compile_id) { | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |                 $this->loadCompiled(true); | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-08-23 05:35:13 +02:00
										 |  |  |             $this->compiled->render($this); | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-08-23 05:35:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |         // display or fetch
 | 
					
						
							|  |  |  |         if ($display) { | 
					
						
							|  |  |  |             if ($this->caching && $this->smarty->cache_modified_check) { | 
					
						
							| 
									
										
										
										
											2015-12-27 08:12:46 +01:00
										 |  |  |                 $this->smarty->ext->_cacheModify->cacheModifiedCheck($this->cached, $this, | 
					
						
							| 
									
										
										
										
											2015-10-29 22:17:35 +01:00
										 |  |  |                                                                      isset($content) ? $content : ob_get_clean()); | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2015-10-18 04:54:09 +02:00
										 |  |  |                 if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) && | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |                     !$no_output_filter && (isset($this->smarty->autoload_filters[ 'output' ]) || | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                                            isset($this->smarty->registered_filters[ 'output' ])) | 
					
						
							| 
									
										
										
										
											2015-10-18 04:54:09 +02:00
										 |  |  |                 ) { | 
					
						
							| 
									
										
										
										
											2015-10-24 05:02:24 +02:00
										 |  |  |                     echo $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this); | 
					
						
							| 
									
										
										
										
											2015-10-18 04:54:09 +02:00
										 |  |  |                 } else { | 
					
						
							| 
									
										
										
										
											2016-02-19 16:10:17 +01:00
										 |  |  |                     echo ob_get_clean(); | 
					
						
							| 
									
										
										
										
											2015-10-18 04:54:09 +02:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |             if ($this->smarty->debugging) { | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |                 $this->smarty->_debug->end_template($this); | 
					
						
							| 
									
										
										
										
											2015-10-21 02:02:42 +02:00
										 |  |  |                 // debug output
 | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |                 $this->smarty->_debug->display_debug($this, true); | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |             return ''; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             if ($this->smarty->debugging) { | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |                 $this->smarty->_debug->end_template($this); | 
					
						
							| 
									
										
										
										
											2015-12-13 14:15:54 +01:00
										 |  |  |                 if ($this->smarty->debugging === 2 && $display === false) { | 
					
						
							| 
									
										
										
										
											2015-08-19 00:58:47 +02:00
										 |  |  |                     $this->smarty->_debug->display_debug($this, true); | 
					
						
							| 
									
										
										
										
											2015-05-07 04:36:49 +02:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-09-11 04:35:52 +02:00
										 |  |  |             if ($this->_isSubTpl()) { | 
					
						
							| 
									
										
										
										
											2016-08-04 23:10:26 +02:00
										 |  |  |                 foreach ($this->compiled->required_plugins as $code => $tmp1) { | 
					
						
							|  |  |  |                     foreach ($tmp1 as $name => $tmp) { | 
					
						
							|  |  |  |                         foreach ($tmp as $type => $data) { | 
					
						
							|  |  |  |                             $this->parent->compiled->required_plugins[ $code ][ $name ][ $type ] = $data; | 
					
						
							| 
									
										
										
										
											2015-03-14 12:02:57 +01:00
										 |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-10-18 04:54:09 +02:00
										 |  |  |             if (!$no_output_filter && | 
					
						
							|  |  |  |                 (!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) && | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |                 (isset($this->smarty->autoload_filters[ 'output' ]) || | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                  isset($this->smarty->registered_filters[ 'output' ])) | 
					
						
							| 
									
										
										
										
											2015-10-18 04:54:09 +02:00
										 |  |  |             ) { | 
					
						
							| 
									
										
										
										
											2015-10-24 05:02:24 +02:00
										 |  |  |                 return $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this); | 
					
						
							| 
									
										
										
										
											2015-10-18 04:54:09 +02:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-03-17 01:10:51 +01:00
										 |  |  |             // return cache content
 | 
					
						
							| 
									
										
										
										
											2015-10-18 04:54:09 +02:00
										 |  |  |             return null; | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Runtime function to render sub-template | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string  $template       template name | 
					
						
							|  |  |  |      * @param mixed   $cache_id       cache id | 
					
						
							|  |  |  |      * @param mixed   $compile_id     compile id | 
					
						
							|  |  |  |      * @param integer $caching        cache mode | 
					
						
							|  |  |  |      * @param integer $cache_lifetime life time of cache data | 
					
						
							|  |  |  |      * @param array   $data           passed parameter template variables | 
					
						
							|  |  |  |      * @param int     $scope          scope in which {include} should execute | 
					
						
							|  |  |  |      * @param bool    $forceTplCache  cache template object | 
					
						
							|  |  |  |      * @param string  $uid            file dependency uid | 
					
						
							|  |  |  |      * @param string  $content_func   function name | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function _subTemplateRender($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $scope, | 
					
						
							|  |  |  |                                        $forceTplCache, $uid = null, $content_func = null) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-02-14 09:17:55 +01:00
										 |  |  |         $tpl = clone $this; | 
					
						
							|  |  |  |         $tpl->parent = $this; | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |         $smarty = &$this->smarty; | 
					
						
							| 
									
										
										
										
											2016-05-01 23:53:38 +02:00
										 |  |  |         $_templateId = $smarty->_getTemplateId($template, $cache_id, $compile_id, $caching, $tpl); | 
					
						
							| 
									
										
										
										
											2016-02-14 09:17:55 +01:00
										 |  |  |         // recursive call ?
 | 
					
						
							| 
									
										
										
										
											2016-05-10 03:54:56 +02:00
										 |  |  |         if (isset($tpl->templateId) ? $tpl->templateId : $tpl->_getTemplateId() != $_templateId) { | 
					
						
							| 
									
										
										
										
											2016-02-14 09:17:55 +01:00
										 |  |  |             // already in template cache?
 | 
					
						
							| 
									
										
										
										
											2016-11-23 17:12:38 +01:00
										 |  |  |             if (isset(self::$tplObjCache[ $_templateId ])) { | 
					
						
							| 
									
										
										
										
											2016-02-14 09:17:55 +01:00
										 |  |  |                 // copy data from cached object
 | 
					
						
							| 
									
										
										
										
											2016-11-23 17:12:38 +01:00
										 |  |  |                 $cachedTpl = &self::$tplObjCache[ $_templateId ]; | 
					
						
							| 
									
										
										
										
											2016-02-14 09:17:55 +01:00
										 |  |  |                 $tpl->templateId = $cachedTpl->templateId; | 
					
						
							|  |  |  |                 $tpl->template_resource = $cachedTpl->template_resource; | 
					
						
							|  |  |  |                 $tpl->cache_id = $cachedTpl->cache_id; | 
					
						
							|  |  |  |                 $tpl->compile_id = $cachedTpl->compile_id; | 
					
						
							|  |  |  |                 $tpl->source = $cachedTpl->source; | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |                 if (isset($cachedTpl->compiled)) { | 
					
						
							| 
									
										
										
										
											2016-02-14 09:17:55 +01:00
										 |  |  |                     $tpl->compiled = $cachedTpl->compiled; | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     unset($tpl->compiled); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 if ($caching != 9999 && isset($cachedTpl->cached)) { | 
					
						
							|  |  |  |                     $tpl->cached = $cachedTpl->cached; | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     unset($tpl->cached); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |             } else { | 
					
						
							|  |  |  |                 $tpl->templateId = $_templateId; | 
					
						
							|  |  |  |                 $tpl->template_resource = $template; | 
					
						
							|  |  |  |                 $tpl->cache_id = $cache_id; | 
					
						
							|  |  |  |                 $tpl->compile_id = $compile_id; | 
					
						
							|  |  |  |                 if (isset($uid)) { | 
					
						
							|  |  |  |                     // for inline templates we can get all resource information from file dependency
 | 
					
						
							| 
									
										
										
										
											2016-02-14 09:17:55 +01:00
										 |  |  |                     list($filepath, $timestamp, $type) = $tpl->compiled->file_dependency[ $uid ]; | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |                     $tpl->source = new Smarty_Template_Source($smarty, $filepath, $type, $filepath); | 
					
						
							| 
									
										
										
										
											2016-02-14 09:17:55 +01:00
										 |  |  |                     $tpl->source->filepath = $filepath; | 
					
						
							|  |  |  |                     $tpl->source->timestamp = $timestamp; | 
					
						
							|  |  |  |                     $tpl->source->exists = true; | 
					
						
							|  |  |  |                     $tpl->source->uid = $uid; | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |                 } else { | 
					
						
							|  |  |  |                     $tpl->source = Smarty_Template_Source::load($tpl); | 
					
						
							|  |  |  |                     unset($tpl->compiled); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2016-02-14 09:17:55 +01:00
										 |  |  |                 if ($caching != 9999) { | 
					
						
							|  |  |  |                     unset($tpl->cached); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-02-14 09:17:55 +01:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             // on recursive calls force caching
 | 
					
						
							|  |  |  |             $forceTplCache = true; | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |         $tpl->caching = $caching; | 
					
						
							|  |  |  |         $tpl->cache_lifetime = $cache_lifetime; | 
					
						
							|  |  |  |         // set template scope
 | 
					
						
							|  |  |  |         $tpl->scope = $scope; | 
					
						
							| 
									
										
										
										
											2016-11-23 17:12:38 +01:00
										 |  |  |         if (!isset(self::$tplObjCache[ $tpl->templateId ]) && !$tpl->source->handler->recompiled) { | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |             // check if template object should be cached
 | 
					
						
							| 
									
										
										
										
											2016-11-23 17:12:38 +01:00
										 |  |  |             if ($forceTplCache || (isset(self::$subTplInfo[ $tpl->template_resource ]) && | 
					
						
							|  |  |  |                                    self::$subTplInfo[ $tpl->template_resource ] > 1) || | 
					
						
							|  |  |  |                 ($tpl->_isSubTpl() &&  isset(self::$tplObjCache[ $tpl->parent->templateId ])) | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |             ) { | 
					
						
							| 
									
										
										
										
											2016-11-23 17:12:38 +01:00
										 |  |  |                 self::$tplObjCache[ $tpl->templateId ] = $tpl; | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (!empty($data)) { | 
					
						
							|  |  |  |             // set up variable values
 | 
					
						
							|  |  |  |             foreach ($data as $_key => $_val) { | 
					
						
							| 
									
										
										
										
											2016-02-14 02:54:38 +01:00
										 |  |  |                 $tpl->tpl_vars[ $_key ] = new Smarty_Variable($_val, $this->isRenderingCache); | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |         if ($tpl->caching == 9999) { | 
					
						
							|  |  |  |             if (!isset($tpl->compiled)) { | 
					
						
							|  |  |  |                 $this->loadCompiled(true); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             if ($tpl->compiled->has_nocache_code) { | 
					
						
							|  |  |  |                 $this->cached->hashes[ $tpl->compiled->nocache_hash ] = true; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |         $tpl->_cache = array(); | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |         if (isset($uid)) { | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |             if ($smarty->debugging) { | 
					
						
							| 
									
										
										
										
											2016-07-13 01:07:53 +02:00
										 |  |  |                 if (!isset($smarty->_debug)) { | 
					
						
							|  |  |  |                     $smarty->_debug = new Smarty_Internal_Debug(); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |                 $smarty->_debug->start_template($tpl); | 
					
						
							|  |  |  |                 $smarty->_debug->start_render($tpl); | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |             $tpl->compiled->getRenderedTemplateCode($tpl, $content_func); | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |             if ($smarty->debugging) { | 
					
						
							|  |  |  |                 $smarty->_debug->end_template($tpl); | 
					
						
							|  |  |  |                 $smarty->_debug->end_render($tpl); | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             if (isset($tpl->compiled)) { | 
					
						
							|  |  |  |                 $tpl->compiled->render($tpl); | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $tpl->render(); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Get called sub-templates and save call count | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function _subTemplateRegister() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         foreach ($this->compiled->includes as $name => $count) { | 
					
						
							| 
									
										
										
										
											2016-11-23 17:12:38 +01:00
										 |  |  |             if (isset(self::$subTplInfo[ $name ])) { | 
					
						
							|  |  |  |                 self::$subTplInfo[ $name ] += $count; | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2016-11-23 17:12:38 +01:00
										 |  |  |                 self::$subTplInfo[ $name ] = $count; | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2016-09-11 04:35:52 +02:00
										 |  |  |      * Check if this is a sub template | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2016-09-11 04:35:52 +02:00
										 |  |  |      * @return bool true is sub template | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-09-11 04:35:52 +02:00
										 |  |  |     public function _isSubTpl() | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-09-11 04:35:52 +02:00
										 |  |  |         return isset($this->parent) && $this->parent->_isTplObj(); | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-31 02:20:47 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Assign variable in scope | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |      * @param string $varName variable name | 
					
						
							|  |  |  |      * @param mixed  $value   value | 
					
						
							|  |  |  |      * @param bool   $nocache nocache flag | 
					
						
							|  |  |  |      * @param int    $scope   scope into which variable shall be assigned | 
					
						
							| 
									
										
										
										
											2015-12-31 02:20:47 +01:00
										 |  |  |      * | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |     public function _assignInScope($varName, $value, $nocache = false, $scope = 0) | 
					
						
							| 
									
										
										
										
											2015-12-31 02:20:47 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |         if (isset($this->tpl_vars[ $varName ])) { | 
					
						
							| 
									
										
										
										
											2015-12-31 02:20:47 +01:00
										 |  |  |             $this->tpl_vars[ $varName ] = clone $this->tpl_vars[ $varName ]; | 
					
						
							|  |  |  |             $this->tpl_vars[ $varName ]->value = $value; | 
					
						
							| 
									
										
										
										
											2016-02-14 02:54:38 +01:00
										 |  |  |             if ($nocache || $this->isRenderingCache) { | 
					
						
							|  |  |  |                 $this->tpl_vars[ $varName ]->nocache = true; | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-12-31 02:20:47 +01:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2016-02-14 02:54:38 +01:00
										 |  |  |             $this->tpl_vars[ $varName ] = new Smarty_Variable($value, $nocache || $this->isRenderingCache); | 
					
						
							| 
									
										
										
										
											2015-12-31 02:20:47 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-03-09 01:01:32 +01:00
										 |  |  |         if ($scope >= 0) { | 
					
						
							| 
									
										
										
										
											2016-08-14 03:32:07 +02:00
										 |  |  |             if ($scope > 0 || $this->scope > 0) { | 
					
						
							| 
									
										
										
										
											2016-03-09 01:01:32 +01:00
										 |  |  |                 $this->smarty->ext->_updateScope->_updateScope($this, $varName, $scope); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-12-31 02:20:47 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * This function is executed automatically when a compiled or cached template file is included | 
					
						
							|  |  |  |      * - Decode saved properties from compiled template and cache files | 
					
						
							|  |  |  |      * - Check if compiled or cache file is valid | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-12-27 08:12:46 +01:00
										 |  |  |      * @param \Smarty_Internal_Template $tpl | 
					
						
							|  |  |  |      * @param  array                    $properties special template properties | 
					
						
							|  |  |  |      * @param  bool                     $cache      flag if called from cache file | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-12-27 08:12:46 +01:00
										 |  |  |      * @return bool flag if compiled or cache file is valid | 
					
						
							|  |  |  |      * @throws \SmartyException | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |      */ | 
					
						
							|  |  |  |     public function _decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-09-19 14:59:49 +02:00
										 |  |  |         // on cache resources other than file check version stored in cache code
 | 
					
						
							| 
									
										
										
										
											2016-11-19 18:13:00 +01:00
										 |  |  |         if (!isset($properties[ 'version' ]) || Smarty::SMARTY_VERSION !== $properties[ 'version' ]) { | 
					
						
							|  |  |  |             if ($cache) { | 
					
						
							|  |  |  |                 $tpl->smarty->clearAllCache(); | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $tpl->smarty->clearCompiledTemplate(); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-09-19 14:59:49 +02:00
										 |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |         $is_valid = true; | 
					
						
							| 
									
										
										
										
											2016-09-19 14:59:49 +02:00
										 |  |  |         if (!empty($properties[ 'file_dependency' ]) && | 
					
						
							| 
									
										
										
										
											2016-11-23 17:12:38 +01:00
										 |  |  |                   ((!$cache && $tpl->smarty->compile_check) || $tpl->smarty->compile_check == 1) | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |         ) { | 
					
						
							|  |  |  |             // check file dependencies at compiled code
 | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |             foreach ($properties[ 'file_dependency' ] as $_file_to_check) { | 
					
						
							| 
									
										
										
										
											2016-05-15 11:13:31 +02:00
										 |  |  |                 if ($_file_to_check[ 2 ] == 'file' || $_file_to_check[ 2 ] == 'php') { | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |                     if ($tpl->source->filepath == $_file_to_check[ 0 ]) { | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |                         // do not recheck current template
 | 
					
						
							|  |  |  |                         continue; | 
					
						
							|  |  |  |                         //$mtime = $tpl->source->getTimeStamp();
 | 
					
						
							|  |  |  |                     } else { | 
					
						
							|  |  |  |                         // file and php types can be checked without loading the respective resource handlers
 | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |                         $mtime = is_file($_file_to_check[ 0 ]) ? filemtime($_file_to_check[ 0 ]) : false; | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |                     } | 
					
						
							|  |  |  |                 } else { | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |                     $handler = Smarty_Resource::load($tpl->smarty, $_file_to_check[ 2 ]); | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |                     if ($handler->checkTimestamps()) { | 
					
						
							|  |  |  |                         $source = Smarty_Template_Source::load($tpl, $tpl->smarty, $_file_to_check[ 0 ]); | 
					
						
							|  |  |  |                         $mtime = $source->getTimeStamp(); | 
					
						
							|  |  |  |                     } else { | 
					
						
							|  |  |  |                         continue; | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2016-05-15 11:13:31 +02:00
										 |  |  |                 if ($mtime === false || $mtime > $_file_to_check[ 1 ]) { | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |                     $is_valid = false; | 
					
						
							|  |  |  |                     break; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if ($cache) { | 
					
						
							|  |  |  |             // CACHING_LIFETIME_SAVED cache expiry has to be validated here since otherwise we'd define the unifunc
 | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |             if ($tpl->caching === Smarty::CACHING_LIFETIME_SAVED && $properties[ 'cache_lifetime' ] >= 0 && | 
					
						
							|  |  |  |                 (time() > ($tpl->cached->timestamp + $properties[ 'cache_lifetime' ])) | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |             ) { | 
					
						
							|  |  |  |                 $is_valid = false; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |             $tpl->cached->cache_lifetime = $properties[ 'cache_lifetime' ]; | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |             $tpl->cached->valid = $is_valid; | 
					
						
							|  |  |  |             $resource = $tpl->cached; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $tpl->mustCompile = !$is_valid; | 
					
						
							|  |  |  |             $resource = $tpl->compiled; | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |             $resource->includes = isset($properties[ 'includes' ]) ? $properties[ 'includes' ] : array(); | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |         if ($is_valid) { | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |             $resource->unifunc = $properties[ 'unifunc' ]; | 
					
						
							|  |  |  |             $resource->has_nocache_code = $properties[ 'has_nocache_code' ]; | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |             //            $tpl->compiled->nocache_hash = $properties['nocache_hash'];
 | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |             $resource->file_dependency = $properties[ 'file_dependency' ]; | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-01-02 02:47:32 +01:00
										 |  |  |         return $is_valid && !function_exists($properties[ 'unifunc' ]); | 
					
						
							| 
									
										
										
										
											2015-12-23 00:44:51 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |      * Compiles the template | 
					
						
							|  |  |  |      * If the template is not evaluated the compiled template is saved on disk | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function compileTemplateSource() | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |         return $this->compiled->compileTemplateSource($this); | 
					
						
							| 
									
										
										
										
											2011-03-16 23:57:04 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |      * Writes the content to cache resource | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @param string $content | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * @return bool | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function writeCachedContent($content) | 
					
						
							| 
									
										
										
										
											2009-12-27 15:06:49 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-10-25 05:03:23 +01:00
										 |  |  |         return $this->smarty->ext->_updateCache->writeCachedContent($this->cached, $this, $content); | 
					
						
							| 
									
										
										
										
											2011-03-16 23:57:04 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2015-09-01 02:27:22 +02:00
										 |  |  |      * Get unique template id | 
					
						
							| 
									
										
										
										
											2014-11-01 22:42:34 +01:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-09-01 02:27:22 +02:00
										 |  |  |      * @return string | 
					
						
							| 
									
										
										
										
											2014-11-01 22:42:34 +01:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2015-09-01 02:27:22 +02:00
										 |  |  |     public function _getTemplateId() | 
					
						
							| 
									
										
										
										
											2014-11-01 22:42:34 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2015-09-01 02:27:22 +02:00
										 |  |  |         return isset($this->templateId) ? $this->templateId : $this->templateId = | 
					
						
							|  |  |  |             $this->smarty->_getTemplateId($this->template_resource, $this->cache_id, $this->compile_id); | 
					
						
							| 
									
										
										
										
											2014-11-01 22:42:34 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2011-10-11 15:49:19 +00:00
										 |  |  |      * runtime error not matching capture tags | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function capture_error() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         throw new SmartyException("Not matching {capture} open/close in \"{$this->template_resource}\""); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-10-21 12:08:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-07 22:57:59 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Load compiled object | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |      * @param bool $force force new compiled object | 
					
						
							| 
									
										
										
										
											2015-05-07 22:57:59 +02:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |     public function loadCompiled($force = false) | 
					
						
							| 
									
										
										
										
											2015-05-07 22:57:59 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |         if ($force || !isset($this->compiled)) { | 
					
						
							| 
									
										
										
										
											2015-05-07 22:57:59 +02:00
										 |  |  |             $this->compiled = Smarty_Template_Compiled::load($this); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Load cached object | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |      * @param bool $force force new cached object | 
					
						
							| 
									
										
										
										
											2015-05-07 22:57:59 +02:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |     public function loadCached($force = false) | 
					
						
							| 
									
										
										
										
											2015-05-07 22:57:59 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |         if ($force || !isset($this->cached)) { | 
					
						
							| 
									
										
										
										
											2015-05-07 22:57:59 +02:00
										 |  |  |             $this->cached = Smarty_Template_Cached::load($this); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-10 03:54:56 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Load inheritance object | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function _loadInheritance() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (!isset($this->inheritance)) { | 
					
						
							|  |  |  |             $this->inheritance = new Smarty_Internal_Runtime_Inheritance(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Unload inheritance object | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function _cleanUp() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $this->startRenderCallbacks = array(); | 
					
						
							|  |  |  |         $this->endRenderCallbacks = array(); | 
					
						
							|  |  |  |         $this->inheritance = null; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-07 22:57:59 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Load compiler object | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @throws \SmartyException | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function loadCompiler() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |         if (!class_exists($this->source->compiler_class)) { | 
					
						
							|  |  |  |             $this->smarty->loadPlugin($this->source->compiler_class); | 
					
						
							| 
									
										
										
										
											2015-06-27 21:23:22 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-03-10 22:22:46 +01:00
										 |  |  |         $this->compiler = | 
					
						
							|  |  |  |             new $this->source->compiler_class($this->source->template_lexer_class, $this->source->template_parser_class, | 
					
						
							|  |  |  |                                               $this->smarty); | 
					
						
							| 
									
										
										
										
											2015-05-07 22:57:59 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2015-02-15 01:45:37 +01:00
										 |  |  |      * Handle unknown class methods | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $name unknown method-name | 
					
						
							|  |  |  |      * @param array  $args argument array | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-05-10 12:09:24 +02:00
										 |  |  |      * @return mixed | 
					
						
							| 
									
										
										
										
											2015-02-15 01:45:37 +01:00
										 |  |  |      * @throws SmartyException | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function __call($name, $args) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // method of Smarty object?
 | 
					
						
							|  |  |  |         if (method_exists($this->smarty, $name)) { | 
					
						
							|  |  |  |             return call_user_func_array(array($this->smarty, $name), $args); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         // parent
 | 
					
						
							|  |  |  |         return parent::__call($name, $args); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-03-17 01:10:51 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2011-03-16 23:57:04 +00:00
										 |  |  |      * set Smarty property in template context | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |      * @param string $property_name property name | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * @param mixed  $value         value | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @throws SmartyException | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |      */ | 
					
						
							|  |  |  |     public function __set($property_name, $value) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         switch ($property_name) { | 
					
						
							|  |  |  |             case 'compiled': | 
					
						
							|  |  |  |             case 'cached': | 
					
						
							|  |  |  |             case 'compiler': | 
					
						
							|  |  |  |                 $this->$property_name = $value; | 
					
						
							|  |  |  |                 return; | 
					
						
							|  |  |  |             default: | 
					
						
							| 
									
										
										
										
											2015-05-07 22:57:59 +02:00
										 |  |  |                 // Smarty property ?
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 if (property_exists($this->smarty, $property_name)) { | 
					
						
							|  |  |  |                     $this->smarty->$property_name = $value; | 
					
						
							|  |  |  |                     return; | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         throw new SmartyException("invalid template property '$property_name'."); | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-08 16:20:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2011-03-16 23:57:04 +00:00
										 |  |  |      * get Smarty property in template context | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |      * @param string $property_name property name | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2015-01-02 09:12:01 +01:00
										 |  |  |      * @return mixed|Smarty_Template_Cached | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @throws SmartyException | 
					
						
							| 
									
										
										
										
											2010-03-08 16:20:19 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |     public function __get($property_name) | 
					
						
							| 
									
										
										
										
											2010-03-08 16:20:19 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         switch ($property_name) { | 
					
						
							|  |  |  |             case 'compiled': | 
					
						
							| 
									
										
										
										
											2015-05-07 22:57:59 +02:00
										 |  |  |                 $this->loadCompiled(); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 return $this->compiled; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             case 'cached': | 
					
						
							| 
									
										
										
										
											2015-05-07 22:57:59 +02:00
										 |  |  |                 $this->loadCached(); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 return $this->cached; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             case 'compiler': | 
					
						
							| 
									
										
										
										
											2015-05-07 22:57:59 +02:00
										 |  |  |                 $this->loadCompiler(); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 return $this->compiler; | 
					
						
							| 
									
										
										
										
											2015-05-10 12:09:24 +02:00
										 |  |  |             default: | 
					
						
							|  |  |  |                 // Smarty property ?
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 if (property_exists($this->smarty, $property_name)) { | 
					
						
							|  |  |  |                     return $this->smarty->$property_name; | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         throw new SmartyException("template property '$property_name' does not exist."); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-03-31 16:23:01 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-08 15:15:41 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * Template data object destructor | 
					
						
							| 
									
										
										
										
											2010-03-08 15:15:41 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function __destruct() | 
					
						
							| 
									
										
										
										
											2010-03-08 15:15:41 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         if ($this->smarty->cache_locking && isset($this->cached) && $this->cached->is_locked) { | 
					
						
							|  |  |  |             $this->cached->handler->releaseLock($this->smarty, $this->cached); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-03-16 23:57:04 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  | } |