| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty Internal Plugin Compile Include | 
					
						
							|  |  |  |  * Compiles the {include} tag | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @package    Smarty | 
					
						
							|  |  |  |  * @subpackage Compiler | 
					
						
							|  |  |  |  * @author     Uwe Tews | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty Internal Plugin Compile Include Class | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @package    Smarty | 
					
						
							|  |  |  |  * @subpackage Compiler | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * caching mode to create nocache code but no cache file | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     const CACHING_NOCACHE_CODE = 9999; | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Attribute definition: Overwrites base class. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      * @see Smarty_Internal_CompileBase | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $required_attributes = array('file'); | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Attribute definition: Overwrites base class. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      * @see Smarty_Internal_CompileBase | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $shorttag_order = array('file'); | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Attribute definition: Overwrites base class. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      * @see Smarty_Internal_CompileBase | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-03-09 01:01:32 +01:00
										 |  |  |     public $option_flags = array('nocache', 'inline', 'caching'); | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Attribute definition: Overwrites base class. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      * @see Smarty_Internal_CompileBase | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public $optional_attributes = array('_any'); | 
					
						
							| 
									
										
										
										
											2015-11-01 02:02:27 +01:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Valid scope names | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |     public $valid_scopes = array('parent' => Smarty::SCOPE_PARENT, 'root' => Smarty::SCOPE_ROOT, | 
					
						
							|  |  |  |                                  'global' => Smarty::SCOPE_GLOBAL, 'tpl_root' => Smarty::SCOPE_TPL_ROOT, | 
					
						
							|  |  |  |                                  'smarty' => Smarty::SCOPE_SMARTY); | 
					
						
							| 
									
										
										
										
											2015-11-01 02:02:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Compiles code for the {include} tag | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2017-10-26 10:25:41 +02:00
										 |  |  |      * @param  array                                  $args     array with attributes from parser | 
					
						
							|  |  |  |      * @param  Smarty_Internal_SmartyTemplateCompiler $compiler compiler object | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2017-10-26 10:25:41 +02:00
										 |  |  |      * @return string | 
					
						
							|  |  |  |      * @throws \Exception | 
					
						
							|  |  |  |      * @throws \SmartyCompilerException | 
					
						
							|  |  |  |      * @throws \SmartyException | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2017-10-26 10:25:41 +02:00
										 |  |  |     public function compile($args, Smarty_Internal_SmartyTemplateCompiler $compiler) | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-05-01 23:53:38 +02:00
										 |  |  |         $uid = $t_hash = null; | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |         // check and get attributes
 | 
					
						
							|  |  |  |         $_attr = $this->getAttributes($compiler, $args); | 
					
						
							| 
									
										
										
										
											2016-05-01 23:53:38 +02:00
										 |  |  |         $fullResourceName = $source_resource = $_attr[ 'file' ]; | 
					
						
							| 
									
										
										
										
											2015-09-14 23:12:03 +02:00
										 |  |  |         $variable_template = false; | 
					
						
							|  |  |  |         $cache_tpl = false; | 
					
						
							|  |  |  |         // parse resource_name
 | 
					
						
							|  |  |  |         if (preg_match('/^([\'"])(([A-Za-z0-9_\-]{2,})[:])?(([^$()]+)|(.+))\1$/', $source_resource, $match)) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $type = !empty($match[ 3 ]) ? $match[ 3 ] : $compiler->template->smarty->default_resource_type; | 
					
						
							|  |  |  |             $name = !empty($match[ 5 ]) ? $match[ 5 ] : $match[ 6 ]; | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |             $handler = Smarty_Resource::load($compiler->smarty, $type); | 
					
						
							| 
									
										
										
										
											2015-09-14 23:12:03 +02:00
										 |  |  |             if ($handler->recompiled || $handler->uncompiled) { | 
					
						
							|  |  |  |                 $variable_template = true; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             if (!$variable_template) { | 
					
						
							| 
									
										
										
										
											2017-10-26 05:27:25 +02:00
										 |  |  |                 if ($type !== 'string') { | 
					
						
							| 
									
										
										
										
											2015-09-14 23:12:03 +02:00
										 |  |  |                     $fullResourceName = "{$type}:{$name}"; | 
					
						
							|  |  |  |                     $compiled = $compiler->parent_compiler->template->compiled; | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |                     if (isset($compiled->includes[ $fullResourceName ])) { | 
					
						
							| 
									
										
										
										
											2017-10-26 05:27:25 +02:00
										 |  |  |                         $compiled->includes[ $fullResourceName ]++; | 
					
						
							| 
									
										
										
										
											2015-09-14 23:12:03 +02:00
										 |  |  |                         $cache_tpl = true; | 
					
						
							|  |  |  |                     } else { | 
					
						
							| 
									
										
										
										
											2016-02-14 09:17:55 +01:00
										 |  |  |                         if ("{$compiler->template->source->type}:{$compiler->template->source->name}" == | 
					
						
							|  |  |  |                             $fullResourceName | 
					
						
							|  |  |  |                         ) { | 
					
						
							|  |  |  |                             // recursive call of current template
 | 
					
						
							|  |  |  |                             $compiled->includes[ $fullResourceName ] = 2; | 
					
						
							|  |  |  |                             $cache_tpl = true; | 
					
						
							|  |  |  |                         } else { | 
					
						
							|  |  |  |                             $compiled->includes[ $fullResourceName ] = 1; | 
					
						
							|  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2015-09-14 23:12:03 +02:00
										 |  |  |                     } | 
					
						
							| 
									
										
										
										
											2016-10-12 01:02:54 +02:00
										 |  |  |                     $fullResourceName = $match[ 1 ] . $fullResourceName . $match[ 1 ]; | 
					
						
							| 
									
										
										
										
											2015-09-14 23:12:03 +02:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             if (empty($match[ 5 ])) { | 
					
						
							| 
									
										
										
										
											2015-09-14 23:12:03 +02:00
										 |  |  |                 $variable_template = true; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-08-18 02:55:53 +02:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2015-09-14 23:12:03 +02:00
										 |  |  |             $variable_template = true; | 
					
						
							| 
									
										
										
										
											2015-08-18 02:55:53 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-11-01 02:02:27 +01:00
										 |  |  |         // scope setup
 | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |         $_scope = $compiler->convertScope($_attr, $this->valid_scopes); | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |         // set flag to cache subtemplate object when called within loop or template name is variable.
 | 
					
						
							| 
									
										
										
										
											2015-09-14 23:12:03 +02:00
										 |  |  |         if ($cache_tpl || $variable_template || $compiler->loopNesting > 0) { | 
					
						
							| 
									
										
										
										
											2015-08-10 21:57:06 +02:00
										 |  |  |             $_cache_tpl = 'true'; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $_cache_tpl = 'false'; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |         // assume caching is off
 | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |         $_caching = Smarty::CACHING_OFF; | 
					
						
							| 
									
										
										
										
											2014-11-11 00:03:08 +01:00
										 |  |  |         $call_nocache = $compiler->tag_nocache || $compiler->nocache; | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |         // caching was on and {include} is not in nocache mode
 | 
					
						
							| 
									
										
										
										
											2014-10-26 09:47:10 +01:00
										 |  |  |         if ($compiler->template->caching && !$compiler->nocache && !$compiler->tag_nocache) { | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |             $_caching = self::CACHING_NOCACHE_CODE; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |         // flag if included template code should be merged into caller
 | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         $merge_compiled_includes = ($compiler->smarty->merge_compiled_includes || $_attr[ 'inline' ] === true) && | 
					
						
							|  |  |  |                                    !$compiler->template->source->handler->recompiled; | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |         if ($merge_compiled_includes) { | 
					
						
							| 
									
										
										
										
											2015-05-27 22:24:24 +02:00
										 |  |  |             // variable template name ?
 | 
					
						
							| 
									
										
										
										
											2015-08-18 02:55:53 +02:00
										 |  |  |             if ($variable_template) { | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |                 $merge_compiled_includes = false; | 
					
						
							| 
									
										
										
										
											2015-05-27 22:24:24 +02:00
										 |  |  |             } | 
					
						
							|  |  |  |             // variable compile_id?
 | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |             if (isset($_attr[ 'compile_id' ]) && $compiler->isVariable($_attr[ 'compile_id' ])) { | 
					
						
							|  |  |  |                 $merge_compiled_includes = false; | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2014-12-30 16:28:18 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |         /* | 
					
						
							|  |  |  |         * if the {include} tag provides individual parameter for caching or compile_id | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |         * the subtemplate must not be included into the common cache file and is treated like | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |         * a call in nocache mode. | 
					
						
							|  |  |  |         * | 
					
						
							|  |  |  |         */ | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if ($_attr[ 'nocache' ] !== true && $_attr[ 'caching' ]) { | 
					
						
							| 
									
										
										
										
											2017-10-26 05:27:25 +02:00
										 |  |  |             $_caching = $_new_caching = (int)$_attr[ 'caching' ]; | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |             $call_nocache = true; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $_new_caching = Smarty::CACHING_LIFETIME_CURRENT; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (isset($_attr[ 'cache_lifetime' ])) { | 
					
						
							|  |  |  |             $_cache_lifetime = $_attr[ 'cache_lifetime' ]; | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |             $call_nocache = true; | 
					
						
							|  |  |  |             $_caching = $_new_caching; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $_cache_lifetime = '$_smarty_tpl->cache_lifetime'; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (isset($_attr[ 'cache_id' ])) { | 
					
						
							|  |  |  |             $_cache_id = $_attr[ 'cache_id' ]; | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |             $call_nocache = true; | 
					
						
							|  |  |  |             $_caching = $_new_caching; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $_cache_id = '$_smarty_tpl->cache_id'; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |         if (isset($_attr[ 'compile_id' ])) { | 
					
						
							|  |  |  |             $_compile_id = $_attr[ 'compile_id' ]; | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             $_compile_id = '$_smarty_tpl->compile_id'; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |         // if subtemplate will be called in nocache mode do not merge
 | 
					
						
							| 
									
										
										
										
											2014-11-11 00:03:08 +01:00
										 |  |  |         if ($compiler->template->caching && $call_nocache) { | 
					
						
							|  |  |  |             $merge_compiled_includes = false; | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |         // assign attribute
 | 
					
						
							|  |  |  |         if (isset($_attr[ 'assign' ])) { | 
					
						
							|  |  |  |             // output will be stored in a smarty variable instead of being displayed
 | 
					
						
							|  |  |  |             if ($_assign = $compiler->getId($_attr[ 'assign' ])) { | 
					
						
							|  |  |  |                 $_assign = "'{$_assign}'"; | 
					
						
							|  |  |  |                 if ($compiler->tag_nocache || $compiler->nocache || $call_nocache) { | 
					
						
							|  |  |  |                     // create nocache var to make it know for further compiling
 | 
					
						
							|  |  |  |                     $compiler->setNocacheInVariable($_attr[ 'assign' ]); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $_assign = $_attr[ 'assign' ]; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |         $has_compiled_template = false; | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |         if ($merge_compiled_includes) { | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $c_id = isset($_attr[ 'compile_id' ]) ? $_attr[ 'compile_id' ] : $compiler->template->compile_id; | 
					
						
							| 
									
										
										
										
											2014-10-26 09:47:10 +01:00
										 |  |  |             // we must observe different compile_id and caching
 | 
					
						
							| 
									
										
										
										
											2015-09-01 01:54:28 +02:00
										 |  |  |             $t_hash = sha1($c_id . ($_caching ? '--caching' : '--nocaching')); | 
					
						
							| 
									
										
										
										
											2016-05-01 23:53:38 +02:00
										 |  |  |             $compiler->smarty->allow_ambiguous_resources = true; | 
					
						
							|  |  |  |             /* @var Smarty_Internal_Template $tpl */ | 
					
						
							|  |  |  |             $tpl = new $compiler->smarty->template_class (trim($fullResourceName, '"\''), $compiler->smarty, | 
					
						
							|  |  |  |                                                           $compiler->template, $compiler->template->cache_id, $c_id, | 
					
						
							|  |  |  |                                                           $_caching); | 
					
						
							| 
									
										
										
										
											2016-05-02 04:28:09 +02:00
										 |  |  |             $uid = $tpl->source->type . $tpl->source->uid; | 
					
						
							| 
									
										
										
										
											2016-05-01 23:53:38 +02:00
										 |  |  |             if (!isset($compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ])) { | 
					
						
							|  |  |  |                 $has_compiled_template = $this->compileInlineTemplate($compiler, $tpl, $t_hash); | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |             } else { | 
					
						
							|  |  |  |                 $has_compiled_template = true; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-05-01 23:53:38 +02:00
										 |  |  |             unset($tpl); | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |         // delete {include} standard attributes
 | 
					
						
							| 
									
										
										
										
											2016-03-09 01:01:32 +01:00
										 |  |  |         unset($_attr[ 'file' ], $_attr[ 'assign' ], $_attr[ 'cache_id' ], $_attr[ 'compile_id' ], $_attr[ 'cache_lifetime' ], $_attr[ 'nocache' ], $_attr[ 'caching' ], $_attr[ 'scope' ], $_attr[ 'inline' ]); | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |         // remaining attributes must be assigned as smarty variable
 | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |         $_vars = 'array()'; | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |         if (!empty($_attr)) { | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |             $_pairs = array(); | 
					
						
							|  |  |  |             // create variables
 | 
					
						
							|  |  |  |             foreach ($_attr as $key => $value) { | 
					
						
							|  |  |  |                 $_pairs[] = "'$key'=>$value"; | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |             $_vars = 'array(' . join(',', $_pairs) . ')'; | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-08-06 01:19:11 +02:00
										 |  |  |         $update_compile_id = $compiler->template->caching && !$compiler->tag_nocache && !$compiler->nocache && | 
					
						
							| 
									
										
										
										
											2017-10-26 05:27:25 +02:00
										 |  |  |                              $_compile_id !== '$_smarty_tpl->compile_id'; | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |         if ($has_compiled_template && !$call_nocache) { | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |             $_output = "<?php\n"; | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |             if ($update_compile_id) { | 
					
						
							|  |  |  |                 $_output .= $compiler->makeNocacheCode("\$_compile_id_save[] = \$_smarty_tpl->compile_id;\n\$_smarty_tpl->compile_id = {$_compile_id};\n"); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2017-10-26 05:27:25 +02:00
										 |  |  |             if (!empty($_attr) && $_caching === 9999 && $compiler->template->caching) { | 
					
						
							| 
									
										
										
										
											2016-02-09 23:27:07 +01:00
										 |  |  |                 $_vars_nc = "foreach ($_vars as \$ik => \$iv) {\n"; | 
					
						
							|  |  |  |                 $_vars_nc .= "\$_smarty_tpl->tpl_vars[\$ik] =  new Smarty_Variable(\$iv);\n"; | 
					
						
							|  |  |  |                 $_vars_nc .= "}\n"; | 
					
						
							| 
									
										
										
										
											2017-10-26 05:27:25 +02:00
										 |  |  |                 $_output .= substr($compiler->processNocacheCode('<?php ' . $_vars_nc . "?>\n", true), 6, -3); | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |             } | 
					
						
							|  |  |  |             if (isset($_assign)) { | 
					
						
							| 
									
										
										
										
											2015-08-19 01:09:08 +02:00
										 |  |  |                 $_output .= "ob_start();\n"; | 
					
						
							| 
									
										
										
										
											2015-09-14 23:12:03 +02:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-05-01 23:53:38 +02:00
										 |  |  |             $_output .= "\$_smarty_tpl->_subTemplateRender({$fullResourceName}, {$_cache_id}, {$_compile_id}, {$_caching}, {$_cache_lifetime}, {$_vars}, {$_scope}, {$_cache_tpl}, '{$compiler->parent_compiler->mergedSubTemplatesData[$uid][$t_hash]['uid']}', '{$compiler->parent_compiler->mergedSubTemplatesData[$uid][$t_hash]['func']}');\n"; | 
					
						
							| 
									
										
										
										
											2015-09-14 23:12:03 +02:00
										 |  |  |             if (isset($_assign)) { | 
					
						
							| 
									
										
										
										
											2015-10-29 22:17:35 +01:00
										 |  |  |                 $_output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n"; | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |             if ($update_compile_id) { | 
					
						
							|  |  |  |                 $_output .= $compiler->makeNocacheCode("\$_smarty_tpl->compile_id = array_pop(\$_compile_id_save);\n"); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2017-11-20 04:07:51 +01:00
										 |  |  |             $_output .= "?>"; | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |             return $_output; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |         if ($call_nocache) { | 
					
						
							|  |  |  |             $compiler->tag_nocache = true; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |         $_output = "<?php "; | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |         if ($update_compile_id) { | 
					
						
							|  |  |  |             $_output .= "\$_compile_id_save[] = \$_smarty_tpl->compile_id;\n\$_smarty_tpl->compile_id = {$_compile_id};\n"; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |         // was there an assign attribute
 | 
					
						
							|  |  |  |         if (isset($_assign)) { | 
					
						
							| 
									
										
										
										
											2015-08-19 01:09:08 +02:00
										 |  |  |             $_output .= "ob_start();\n"; | 
					
						
							| 
									
										
										
										
											2015-09-14 23:12:03 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-12-23 03:08:23 +01:00
										 |  |  |         $_output .= "\$_smarty_tpl->_subTemplateRender({$fullResourceName}, $_cache_id, $_compile_id, $_caching, $_cache_lifetime, $_vars, $_scope, {$_cache_tpl});\n"; | 
					
						
							| 
									
										
										
										
											2015-09-14 23:12:03 +02:00
										 |  |  |         if (isset($_assign)) { | 
					
						
							| 
									
										
										
										
											2015-10-29 22:17:35 +01:00
										 |  |  |             $_output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n"; | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2014-11-08 21:27:53 +01:00
										 |  |  |         if ($update_compile_id) { | 
					
						
							|  |  |  |             $_output .= "\$_smarty_tpl->compile_id = array_pop(\$_compile_id_save);\n"; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-11-20 04:07:51 +01:00
										 |  |  |         $_output .= "?>"; | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  |         return $_output; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-09-16 16:23:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Compile inline sub template | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |      * @param \Smarty_Internal_SmartyTemplateCompiler $compiler | 
					
						
							| 
									
										
										
										
											2016-05-01 23:53:38 +02:00
										 |  |  |      * @param \Smarty_Internal_Template               $tpl | 
					
						
							|  |  |  |      * @param  string                                 $t_hash | 
					
						
							| 
									
										
										
										
											2015-09-16 16:23:38 +02:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @return bool | 
					
						
							| 
									
										
										
										
											2017-10-26 10:25:41 +02:00
										 |  |  |      * @throws \Exception | 
					
						
							|  |  |  |      * @throws \SmartyException | 
					
						
							| 
									
										
										
										
											2015-09-16 16:23:38 +02:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-05-01 23:53:38 +02:00
										 |  |  |     public function compileInlineTemplate(Smarty_Internal_SmartyTemplateCompiler $compiler, | 
					
						
							| 
									
										
										
										
											2017-10-26 05:27:25 +02:00
										 |  |  |                                           Smarty_Internal_Template $tpl, | 
					
						
							|  |  |  |                                           $t_hash) | 
					
						
							| 
									
										
										
										
											2015-09-16 16:23:38 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-05-02 04:28:09 +02:00
										 |  |  |         $uid = $tpl->source->type . $tpl->source->uid; | 
					
						
							| 
									
										
										
										
											2015-09-16 16:23:38 +02:00
										 |  |  |         if (!($tpl->source->handler->uncompiled) && $tpl->source->exists) { | 
					
						
							| 
									
										
										
										
											2016-10-12 01:02:54 +02:00
										 |  |  |             $compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ][ 'uid' ] = $tpl->source->uid; | 
					
						
							| 
									
										
										
										
											2016-05-10 03:54:56 +02:00
										 |  |  |             if (isset($compiler->template->inheritance)) { | 
					
						
							|  |  |  |                 $tpl->inheritance = clone $compiler->template->inheritance; | 
					
						
							| 
									
										
										
										
											2015-10-18 04:46:05 +02:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |             $tpl->compiled = new Smarty_Template_Compiled(); | 
					
						
							|  |  |  |             $tpl->compiled->nocache_hash = $compiler->parent_compiler->template->compiled->nocache_hash; | 
					
						
							|  |  |  |             $tpl->loadCompiler(); | 
					
						
							| 
									
										
										
										
											2015-09-16 16:23:38 +02:00
										 |  |  |             // save unique function name
 | 
					
						
							| 
									
										
										
										
											2016-05-02 04:28:09 +02:00
										 |  |  |             $compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ][ 'func' ] = | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |             $tpl->compiled->unifunc = 'content_' . str_replace(array('.', ','), '_', uniqid('', true)); | 
					
						
							| 
									
										
										
										
											2015-09-16 16:23:38 +02:00
										 |  |  |             // make sure whole chain gets compiled
 | 
					
						
							|  |  |  |             $tpl->mustCompile = true; | 
					
						
							| 
									
										
										
										
											2016-05-02 04:28:09 +02:00
										 |  |  |             $compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ][ 'nocache_hash' ] = | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |                 $tpl->compiled->nocache_hash; | 
					
						
							| 
									
										
										
										
											2018-04-16 10:25:47 +02:00
										 |  |  |             if ($tpl->source->type === 'file') { | 
					
						
							|  |  |  |                 $sourceInfo = $tpl->source->filepath; | 
					
						
							| 
									
										
										
										
											2016-01-26 22:22:20 +01:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2018-04-16 10:25:47 +02:00
										 |  |  |                 $basename = $tpl->source->handler->getBasename($tpl->source); | 
					
						
							|  |  |  |                 $sourceInfo = $tpl->source->type . ':' . | 
					
						
							|  |  |  |                               ($basename ? $basename : $tpl->source->name); | 
					
						
							| 
									
										
										
										
											2016-01-26 22:22:20 +01:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2015-09-16 16:23:38 +02:00
										 |  |  |             // get compiled code
 | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |             $compiled_code = "<?php\n\n"; | 
					
						
							| 
									
										
										
										
											2016-01-26 22:22:20 +01:00
										 |  |  |             $compiled_code .= "/* Start inline template \"{$sourceInfo}\" =============================*/\n"; | 
					
						
							| 
									
										
										
										
											2017-11-20 04:07:51 +01:00
										 |  |  |             $compiled_code .= "function {$tpl->compiled->unifunc} (Smarty_Internal_Template \$_smarty_tpl) {\n"; | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |             $compiled_code .= "?>\n" . $tpl->compiler->compileTemplateSource($tpl, null, $compiler->parent_compiler); | 
					
						
							|  |  |  |             $compiled_code .= "<?php\n"; | 
					
						
							|  |  |  |             $compiled_code .= "}\n?>\n"; | 
					
						
							|  |  |  |             $compiled_code .= $tpl->compiler->postFilter($tpl->compiler->blockOrFunctionCode); | 
					
						
							|  |  |  |             $compiled_code .= "<?php\n\n"; | 
					
						
							| 
									
										
										
										
											2016-01-26 22:22:20 +01:00
										 |  |  |             $compiled_code .= "/* End inline template \"{$sourceInfo}\" =============================*/\n"; | 
					
						
							| 
									
										
										
										
											2017-11-06 01:02:56 +01:00
										 |  |  |             $compiled_code .= '?>'; | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |             unset($tpl->compiler); | 
					
						
							| 
									
										
										
										
											2015-09-16 16:23:38 +02:00
										 |  |  |             if ($tpl->compiled->has_nocache_code) { | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |                 // replace nocache_hash
 | 
					
						
							|  |  |  |                 $compiled_code = | 
					
						
							| 
									
										
										
										
											2017-10-26 05:27:25 +02:00
										 |  |  |                     str_replace("{$tpl->compiled->nocache_hash}", | 
					
						
							|  |  |  |                                 $compiler->template->compiled->nocache_hash, | 
					
						
							| 
									
										
										
										
											2016-01-26 21:49:56 +01:00
										 |  |  |                                 $compiled_code); | 
					
						
							| 
									
										
										
										
											2015-09-16 16:23:38 +02:00
										 |  |  |                 $compiler->template->compiled->has_nocache_code = true; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2016-02-09 01:27:15 +01:00
										 |  |  |             $compiler->parent_compiler->mergedSubTemplatesCode[ $tpl->compiled->unifunc ] = $compiled_code; | 
					
						
							| 
									
										
										
										
											2015-09-16 16:23:38 +02:00
										 |  |  |             return true; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2014-10-18 00:18:11 +02:00
										 |  |  | } |