/**
  * Template code runtime function to set up an inline subtemplate
  *
  * @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     $parent_scope   scope in which {include} should execute
  * @param bool    $cache_tpl_obj  cache template object
  *
  * @return \Smarty_Internal_Template template object
  */
 public function setupSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope, $cache_tpl_obj)
 {
     $_templateId = $this->smarty->_getTemplateId($template, $cache_id, $compile_id);
     // already in template cache?
     /* @var Smarty_Internal_Template $tpl */
     if (isset($this->smarty->_cache['template_objects'][$_templateId])) {
         // clone cached template object because of possible recursive call
         $tpl = clone $this->smarty->_cache['template_objects'][$_templateId];
         $tpl->parent = $this;
         if ((bool) $tpl->caching !== (bool) $caching) {
             unset($tpl->compiled);
         }
         if ($parent_scope = Smarty::SCOPE_LOCAL) {
             $tpl->tpl_vars = $this->tpl_vars;
             $tpl->config_vars = $this->config_vars;
         }
         $tpl->tpl_function = $this->tpl_function;
     } else {
         $tpl = clone $this;
         $tpl->parent = $this;
         if ($tpl->templateId !== $_templateId) {
             $tpl->templateId = $_templateId;
             $tpl->template_resource = $template;
             $tpl->cache_id = $cache_id;
             $tpl->compile_id = $compile_id;
             $tpl->source = Smarty_Template_Source::load($tpl);
             unset($tpl->compiled, $tpl->cached);
             $tpl->cacheTpl($cache_tpl_obj);
         }
     }
     $tpl->caching = $caching;
     $tpl->cache_lifetime = $cache_lifetime;
     if ($caching == 9999) {
         $tpl->cached = $this->cached;
     }
     // get variables from calling scope
     if ($parent_scope != Smarty::SCOPE_LOCAL) {
         if ($parent_scope == Smarty::SCOPE_PARENT) {
             $tpl->tpl_vars =& $this->tpl_vars;
             $tpl->config_vars =& $this->config_vars;
         } elseif ($parent_scope == Smarty::SCOPE_GLOBAL) {
             $tpl->tpl_vars =& Smarty::$global_tpl_vars;
             $tpl->config_vars = $this->config_vars;
         } elseif (($scope_ptr = $this->getScopePointer($parent_scope)) == null) {
             $tpl->tpl_vars =& $this->tpl_vars;
             $tpl->config_vars =& $this->config_vars;
         } else {
             $tpl->tpl_vars =& $scope_ptr->tpl_vars;
             $tpl->config_vars =& $scope_ptr->config_vars;
         }
     }
     if (!empty($data)) {
         // set up variable values
         foreach ($data as $_key => $_val) {
             $tpl->tpl_vars[$_key] = new Smarty_Variable($_val);
         }
     }
     return $tpl;
 }
 /**
  * Get unique template id
  *
  * @return string
  */
 public function _getTemplateId()
 {
     return isset($this->templateId) ? $this->templateId : ($this->templateId = $this->smarty->_getTemplateId($this->template_resource, $this->cache_id, $this->compile_id));
 }
 /**
  * Template code runtime function to set up an inline subtemplate
  *
  * @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         $parent_scope   scope in which {include} should execute
  * @param bool        $cache_tpl_obj  cache template object
  * @param string|null $uid            source uid
  *
  * @return \Smarty_Internal_Template template object
  * @throws \SmartyException
  */
 public function setupSubtemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope, $cache_tpl_obj, $uid = null)
 {
     // if there are cached template objects calculate $templateID
     $_templateId = isset($this->smarty->_cache['template_objects']) ? $this->smarty->_getTemplateId($template, $cache_id, $compile_id) : null;
     // already in template cache?
     /* @var Smarty_Internal_Template $tpl */
     if (isset($this->smarty->_cache['template_objects'][$_templateId])) {
         // clone cached template object because of possible recursive call
         $tpl = clone $this->smarty->_cache['template_objects'][$_templateId];
         $tpl->parent = $this;
         // if $caching mode changed the compiled resource is invalid
         if ((bool) $tpl->caching !== (bool) $caching) {
             unset($tpl->compiled);
         }
         // get variables from calling scope
         if ($parent_scope == Smarty::SCOPE_LOCAL) {
             $tpl->tpl_vars = $this->tpl_vars;
             $tpl->config_vars = $this->config_vars;
         }
         $tpl->tpl_function = $this->tpl_function;
         // copy inheritance object?
         if (isset($this->_inheritance)) {
             $tpl->_inheritance = $this->_inheritance;
         } else {
             unset($tpl->_inheritance);
         }
     } else {
         $tpl = clone $this;
         $tpl->parent = $this;
         if (!isset($tpl->templateId) || $tpl->templateId !== $_templateId) {
             $tpl->templateId = $_templateId;
             $tpl->template_resource = $template;
             $tpl->cache_id = $cache_id;
             $tpl->compile_id = $compile_id;
             // $uid is set if template is inline
             if (isset($uid)) {
                 // inline templates have same compiled resource
                 $tpl->compiled = $this->compiled;
                 // if template is called multiple times set flag to to cache template objects
                 if (isset($tpl->compiled->includes[$template]) && $tpl->compiled->includes[$template] > 1) {
                     $cache_tpl_obj = true;
                 }
                 if (isset($tpl->compiled->file_dependency[$uid])) {
                     list($filepath, $timestamp, $resource) = $tpl->compiled->file_dependency[$uid];
                     $tpl->source = new Smarty_Template_Source(isset($tpl->smarty->_cache['resource_handlers'][$resource]) ? $tpl->smarty->_cache['resource_handlers'][$resource] : Smarty_Resource::load($tpl->smarty, $resource), $tpl->smarty, $filepath, $resource, $filepath);
                     $tpl->source->filepath = $filepath;
                     $tpl->source->timestamp = $timestamp;
                     $tpl->source->exist = true;
                     $tpl->source->uid = $uid;
                 } else {
                     $tpl->source = null;
                 }
             } else {
                 $tpl->source = null;
                 unset($tpl->compiled);
             }
             if (!isset($tpl->source)) {
                 $tpl->source = Smarty_Template_Source::load($tpl);
             }
             unset($tpl->cached);
             // check if template object should be cached
             if (!$tpl->source->handler->recompiled && (isset($tpl->parent->templateId) && isset($tpl->smarty->_cache['template_objects'][$tpl->parent->templateId]) || $cache_tpl_obj && $tpl->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_AUTOMATIC || $tpl->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_ON)) {
                 $tpl->smarty->_cache['template_objects'][$tpl->_getTemplateId()] = $tpl;
             }
         }
     }
     $tpl->caching = $caching;
     $tpl->cache_lifetime = $cache_lifetime;
     if ($caching == 9999) {
         $tpl->cached = $this->cached;
     }
     // get variables from calling scope
     if ($parent_scope != Smarty::SCOPE_LOCAL) {
         if ($parent_scope == Smarty::SCOPE_PARENT) {
             $tpl->tpl_vars =& $this->tpl_vars;
             $tpl->config_vars =& $this->config_vars;
         } elseif ($parent_scope == Smarty::SCOPE_GLOBAL) {
             $tpl->tpl_vars =& Smarty::$global_tpl_vars;
             $tpl->config_vars = $this->config_vars;
         } elseif ($parent_scope == Smarty::SCOPE_ROOT) {
             $ptr = $tpl->parent;
             while (!empty($ptr->parent)) {
                 $ptr = $ptr->parent;
             }
             $tpl->tpl_vars =& $ptr->tpl_vars;
             $tpl->config_vars =& $ptr->config_vars;
         } else {
             $tpl->tpl_vars = $this->tpl_vars;
             $tpl->config_vars = $this->config_vars;
         }
     }
     if (!empty($data)) {
         // set up variable values
         foreach ($data as $_key => $_val) {
             $tpl->tpl_vars[$_key] = new Smarty_Variable($_val);
         }
     }
     return $tpl;
 }