| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |  * Smarty Internal Plugin Compile Include | 
					
						
							|  |  |  |  * Compiles the {include} tag | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |  * @subpackage Compiler | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @author     Uwe Tews | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2010-08-17 15:39:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |  * Smarty Internal Plugin Compile Include Class | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |  * @subpackage Compiler | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |      * caching mode to create nocache code but no cache file | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     const CACHING_NOCACHE_CODE = 9999; | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |      * Attribute definition: Overwrites base class. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      * @see Smarty_Internal_CompileBase | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |     public $required_attributes = array('file'); | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |      * Attribute definition: Overwrites base class. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      * @see Smarty_Internal_CompileBase | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public $shorttag_order = array('file'); | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |      * Attribute definition: Overwrites base class. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      * @see Smarty_Internal_CompileBase | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public $option_flags = array('nocache', 'inline', 'caching'); | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |      * Attribute definition: Overwrites base class. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      * @see Smarty_Internal_CompileBase | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |     public $optional_attributes = array('_any'); | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |      * Compiles code for the {include} tag | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @param  array  $args      array with attributes from parser | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @param  object $compiler  compiler object | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @param  array  $parameter array with compilation parameter | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2010-05-25 19:33:55 +00:00
										 |  |  |      * @return string compiled code | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |     public function compile($args, $compiler, $parameter) | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         // check and get attributes
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         $_attr = $this->getAttributes($compiler, $args); | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |         // save possible attributes
 | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |         $include_file = $_attr['file']; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (isset($_attr['assign'])) { | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |             // output will be stored in a smarty variable instead of being displayed
 | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |             $_assign = $_attr['assign']; | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |         $_parent_scope = Smarty::SCOPE_LOCAL; | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |         if (isset($_attr['scope'])) { | 
					
						
							| 
									
										
										
										
											2010-07-30 13:09:52 +00:00
										 |  |  |             $_attr['scope'] = trim($_attr['scope'], "'\""); | 
					
						
							|  |  |  |             if ($_attr['scope'] == 'parent') { | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |                 $_parent_scope = Smarty::SCOPE_PARENT; | 
					
						
							| 
									
										
										
										
											2010-07-30 13:09:52 +00:00
										 |  |  |             } elseif ($_attr['scope'] == 'root') { | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |                 $_parent_scope = Smarty::SCOPE_ROOT; | 
					
						
							| 
									
										
										
										
											2010-07-30 13:09:52 +00:00
										 |  |  |             } elseif ($_attr['scope'] == 'global') { | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |                 $_parent_scope = Smarty::SCOPE_GLOBAL; | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |         $_caching = Smarty::CACHING_OFF; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // flag if included template code should be merged into caller
 | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |         $merge_compiled_includes = ($compiler->smarty->merge_compiled_includes || ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes) || $_attr['inline'] === true) && !$compiler->template->source->recompiled; | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // set default when in nocache mode
 | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |         //       if ($compiler->template->caching && ($compiler->nocache || $compiler->tag_nocache || $compiler->forceNocache == 2)) {
 | 
					
						
							|  |  |  |         if ($compiler->template->caching && ((!$compiler->inheritance && !$compiler->nocache && !$compiler->tag_nocache) || ($compiler->inheritance && ($compiler->nocache || $compiler->tag_nocache)))) { | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |             $_caching = self::CACHING_NOCACHE_CODE; | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |         /* | 
					
						
							|  |  |  |         * if the {include} tag provides individual parameter for caching | 
					
						
							|  |  |  |         * it will not be included into the common cache file and treated like | 
					
						
							|  |  |  |         * a nocache section | 
					
						
							|  |  |  |         */ | 
					
						
							|  |  |  |         if (isset($_attr['cache_lifetime'])) { | 
					
						
							|  |  |  |             $_cache_lifetime = $_attr['cache_lifetime']; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $compiler->tag_nocache = true; | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |             $_caching = Smarty::CACHING_LIFETIME_CURRENT; | 
					
						
							| 
									
										
										
										
											2009-11-26 22:49:56 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2009-12-17 16:58:44 +00:00
										 |  |  |             $_cache_lifetime = 'null'; | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-08-22 12:15:51 +00:00
										 |  |  |         if (isset($_attr['cache_id'])) { | 
					
						
							|  |  |  |             $_cache_id = $_attr['cache_id']; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $compiler->tag_nocache = true; | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |             $_caching = Smarty::CACHING_LIFETIME_CURRENT; | 
					
						
							| 
									
										
										
										
											2010-08-22 12:15:51 +00:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             $_cache_id = '$_smarty_tpl->cache_id'; | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |         if (isset($_attr['compile_id'])) { | 
					
						
							|  |  |  |             $_compile_id = $_attr['compile_id']; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $_compile_id = '$_smarty_tpl->compile_id'; | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |         if ($_attr['caching'] === true) { | 
					
						
							|  |  |  |             $_caching = Smarty::CACHING_LIFETIME_CURRENT; | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |         if ($_attr['nocache'] === true) { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $compiler->tag_nocache = true; | 
					
						
							| 
									
										
										
										
											2013-10-28 18:24:01 +00:00
										 |  |  |             if ($merge_compiled_includes) { | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |                 $_caching = self::CACHING_NOCACHE_CODE; | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |                 $_caching = Smarty::CACHING_OFF; | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         $has_compiled_template = false; | 
					
						
							| 
									
										
										
										
											2013-12-15 15:19:01 +00:00
										 |  |  |         if ($merge_compiled_includes && $_attr['inline'] !== true) { | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |             // variable template name ?
 | 
					
						
							|  |  |  |             if ($compiler->has_variable_string || !((substr_count($include_file, '"') == 2 || substr_count($include_file, "'") == 2)) | 
					
						
							|  |  |  |                 || substr_count($include_file, '(') != 0 || substr_count($include_file, '$_smarty_tpl->') != 0 | 
					
						
							|  |  |  |             ) { | 
					
						
							|  |  |  |                 $merge_compiled_includes = false; | 
					
						
							| 
									
										
										
										
											2013-12-15 15:19:01 +00:00
										 |  |  |                 if ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes) { | 
					
						
							|  |  |  |                     $compiler->trigger_template_error(' variable template file names not allow within {block} tags'); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |             // variable compile_id?
 | 
					
						
							|  |  |  |             if (isset($_attr['compile_id'])) { | 
					
						
							|  |  |  |                 if (!((substr_count($_attr['compile_id'], '"') == 2 || substr_count($_attr['compile_id'], "'") == 2)) | 
					
						
							|  |  |  |                     || substr_count($_attr['compile_id'], '(') != 0 || substr_count($_attr['compile_id'], '$_smarty_tpl->') != 0 | 
					
						
							|  |  |  |                 ) { | 
					
						
							|  |  |  |                     $merge_compiled_includes = false; | 
					
						
							| 
									
										
										
										
											2013-12-15 15:19:01 +00:00
										 |  |  |                     if ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes) { | 
					
						
							|  |  |  |                         $compiler->trigger_template_error(' variable compile_id not allow within {block} tags'); | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2013-12-15 15:19:01 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |         if ($merge_compiled_includes) { | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |             if ($compiler->template->caching && ($compiler->tag_nocache || $compiler->nocache) && $_caching != self::CACHING_NOCACHE_CODE) { | 
					
						
							|  |  |  |                 $merge_compiled_includes = false; | 
					
						
							| 
									
										
										
										
											2013-12-15 15:19:01 +00:00
										 |  |  |                 if ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes) { | 
					
						
							|  |  |  |                     $compiler->trigger_template_error(' invalid caching mode of subtemplate within {block} tags'); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2013-10-28 18:24:01 +00:00
										 |  |  |         if ($merge_compiled_includes) { | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |             // we must observe different compile_id
 | 
					
						
							|  |  |  |             $uid = sha1($_compile_id); | 
					
						
							|  |  |  |             $tpl_name = null; | 
					
						
							|  |  |  |             $nocache = false; | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |             /** @var Smarty_Internal_Template $_smarty_tpl | 
					
						
							|  |  |  |              * used in evaluated code | 
					
						
							|  |  |  |              */ | 
					
						
							| 
									
										
										
										
											2013-12-15 15:19:01 +00:00
										 |  |  |             $_smarty_tpl = $compiler->template; | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |             eval("\$tpl_name = $include_file;"); | 
					
						
							| 
									
										
										
										
											2014-01-18 14:43:02 +00:00
										 |  |  |             if (!isset($compiler->smarty->merged_templates_func[$tpl_name][$uid])) { | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |                 $tpl = new $compiler->smarty->template_class ($tpl_name, $compiler->smarty, $compiler->template, $compiler->template->cache_id, $compiler->template->compile_id); | 
					
						
							|  |  |  |                 // save unique function name
 | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |                 $compiler->smarty->merged_templates_func[$tpl_name][$uid]['func'] = $tpl->properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true)); | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |                 // use current nocache hash for inlined code
 | 
					
						
							|  |  |  |                 $compiler->smarty->merged_templates_func[$tpl_name][$uid]['nocache_hash'] = $tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash']; | 
					
						
							|  |  |  |                 if ($compiler->template->caching && $_caching == self::CACHING_NOCACHE_CODE) { | 
					
						
							|  |  |  |                     // all code must be nocache
 | 
					
						
							|  |  |  |                     $nocache = true; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 if ($compiler->inheritance) { | 
					
						
							|  |  |  |                     $tpl->compiler->inheritance = true; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 // make sure whole chain gets compiled
 | 
					
						
							|  |  |  |                 $tpl->mustCompile = true; | 
					
						
							|  |  |  |                 if (!($tpl->source->uncompiled) && $tpl->source->exists) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     // get compiled code
 | 
					
						
							|  |  |  |                     $compiled_code = $tpl->compiler->compileTemplate($tpl, $nocache); | 
					
						
							|  |  |  |                     // release compiler object to free memory
 | 
					
						
							|  |  |  |                     unset($tpl->compiler); | 
					
						
							|  |  |  |                     // merge compiled code for {function} tags
 | 
					
						
							|  |  |  |                     $compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $tpl->properties['function']); | 
					
						
							|  |  |  |                     // merge filedependency
 | 
					
						
							|  |  |  |                     $tpl->properties['file_dependency'][$tpl->source->uid] = array($tpl->source->filepath, $tpl->source->timestamp, $tpl->source->type); | 
					
						
							|  |  |  |                     $compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $tpl->properties['file_dependency']); | 
					
						
							|  |  |  |                     // remove header code
 | 
					
						
							|  |  |  |                     $compiled_code = preg_replace("/(<\?php \/\*%%SmartyHeaderCode:{$tpl->properties['nocache_hash']}%%\*\/(.+?)\/\*\/%%SmartyHeaderCode%%\*\/\?>\n)/s", '', $compiled_code); | 
					
						
							|  |  |  |                     if ($tpl->has_nocache_code) { | 
					
						
							|  |  |  |                         // replace nocache_hash
 | 
					
						
							|  |  |  |                         $compiled_code = str_replace("{$tpl->properties['nocache_hash']}", $compiler->template->properties['nocache_hash'], $compiled_code); | 
					
						
							|  |  |  |                         $compiler->template->has_nocache_code = true; | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |                     } | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |                     $compiler->merged_templates[$tpl->properties['unifunc']] = $compiled_code; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                     $has_compiled_template = true; | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |                     unset ($tpl); | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |             } else { | 
					
						
							|  |  |  |                 $has_compiled_template = true; | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |         // delete {include} standard attributes
 | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |         unset($_attr['file'], $_attr['assign'], $_attr['cache_id'], $_attr['compile_id'], $_attr['cache_lifetime'], $_attr['nocache'], $_attr['caching'], $_attr['scope'], $_attr['inline']); | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |         // remaining attributes must be assigned as smarty variable
 | 
					
						
							|  |  |  |         if (!empty($_attr)) { | 
					
						
							| 
									
										
										
										
											2010-11-11 21:34:36 +00:00
										 |  |  |             if ($_parent_scope == Smarty::SCOPE_LOCAL) { | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |                 // create variables
 | 
					
						
							| 
									
										
										
										
											2014-06-21 08:53:38 +00:00
										 |  |  |                 $nccode = ''; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 foreach ($_attr as $key => $value) { | 
					
						
							|  |  |  |                     $_pairs[] = "'$key'=>$value"; | 
					
						
							| 
									
										
										
										
											2014-06-21 08:53:38 +00:00
										 |  |  |                     $nccode .= "\$_smarty_tpl->tpl_vars['$key'] =  new Smarty_variable($value);\n"; | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |                 $_vars = 'array(' . join(',', $_pairs) . ')'; | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |                 $compiler->trigger_template_error('variable passing not allowed in parent/global scope', $compiler->lex->taglineno); | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             $_vars = 'array()'; | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |         if ($has_compiled_template) { | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |             // never call inline templates in nocache mode
 | 
					
						
							|  |  |  |             $compiler->suppressNocacheProcessing = true; | 
					
						
							|  |  |  |             $_hash = $compiler->smarty->merged_templates_func[$tpl_name][$uid]['nocache_hash']; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $_output = "<?php /*  Call merged included template \"" . $tpl_name . "\" */\n"; | 
					
						
							|  |  |  |             $_output .= "\$_tpl_stack[] = \$_smarty_tpl;\n"; | 
					
						
							| 
									
										
										
										
											2014-06-21 08:53:38 +00:00
										 |  |  |             if (!empty($nccode) && $_caching == 9999 && $_smarty_tpl->caching) { | 
					
						
							|  |  |  |                 $compiler->suppressNocacheProcessing = false; | 
					
						
							|  |  |  |                 $_output .=  substr($compiler->processNocacheCode('<?php ' .$nccode . "?>\n", true), 6, -3); | 
					
						
							|  |  |  |                 $compiler->suppressNocacheProcessing = true; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $_output .= " \$_smarty_tpl = \$_smarty_tpl->setupInlineSubTemplate($include_file, $_cache_id, $_compile_id, $_caching, $_cache_lifetime, $_vars, $_parent_scope, '$_hash');\n"; | 
					
						
							|  |  |  |             if (isset($_assign)) { | 
					
						
							|  |  |  |                 $_output .= 'ob_start(); '; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |             $_output .= $compiler->smarty->merged_templates_func[$tpl_name][$uid]['func'] . "(\$_smarty_tpl);\n"; | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $_output .= "\$_smarty_tpl = array_pop(\$_tpl_stack); "; | 
					
						
							|  |  |  |             if (isset($_assign)) { | 
					
						
							|  |  |  |                 $_output .= " \$_smarty_tpl->tpl_vars[$_assign] = new Smarty_variable(ob_get_clean());"; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2013-08-24 18:46:31 +00:00
										 |  |  |             $_output .= "\n/*  End of included template \"" . $tpl_name . "\" */?>"; | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             return $_output; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |         // was there an assign attribute
 | 
					
						
							|  |  |  |         if (isset($_assign)) { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $_output = "<?php \$_smarty_tpl->tpl_vars[$_assign] = new Smarty_variable(\$_smarty_tpl->getSubTemplate ($include_file, $_cache_id, $_compile_id, $_caching, $_cache_lifetime, $_vars, $_parent_scope));?>\n";; | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2011-09-16 14:19:56 +00:00
										 |  |  |             $_output = "<?php echo \$_smarty_tpl->getSubTemplate ($include_file, $_cache_id, $_compile_id, $_caching, $_cache_lifetime, $_vars, $_parent_scope);?>\n"; | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-06 14:35:00 +00:00
										 |  |  |         return $_output; | 
					
						
							| 
									
										
										
										
											2011-07-15 00:42:43 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | } |