load config variables into template object

@param \Smarty_Internal_Template $tpl
@param  array                    $_config_vars
514511
public function _loadConfigVars(Smarty_Internal_Template $tpl, $_config_vars)
    {
        $this->_assignConfigVars($tpl->parent, $tpl, $_config_vars);
        $scope = $tpl->source->scope;
        if (!$scope && !$tpl->scope) {
            return;
        }
        foreach (array($scope, $tpl->scope) as $s) {
            $s = ($bubble_up = $s >= Smarty::SCOPE_BUBBLE_UP) ? $s - Smarty::SCOPE_BUBBLE_UP : $s;
            if ($bubble_up && $s) {
                $ptr = $tpl->parent->parent;
                if (isset($ptr)) {
                    $this->_assignConfigVars($ptr, $tpl, $_config_vars);
                    $ptr = $ptr->parent;
                }
                if ($s == Smarty::SCOPE_PARENT) {
                    continue;
                }
                while (isset($ptr) && $ptr->_objType == 2) {
                    $this->_assignConfigVars($ptr, $tpl, $_config_vars);
                    $ptr = $ptr->parent;
                }
                if ($s == Smarty::SCOPE_TPL_ROOT) {
                    continue;
                } elseif ($s == Smarty::SCOPE_SMARTY) {
                    $this->_assignConfigVars($tpl->smarty, $tpl, $_config_vars);
                } elseif ($s == Smarty::SCOPE_GLOBAL) {
                    $this->_assignConfigVars($tpl->smarty, $tpl, $_config_vars);
                } elseif ($s == Smarty::SCOPE_ROOT) {
                    while (isset($ptr->parent)) {
                        $ptr = $ptr->parent;
                    }
                    $this->_assignConfigVars($ptr, $tpl, $_config_vars);
                }
            }
        }
    }
769014
public function updateScope(Smarty_Internal_Template $tpl, $varName, $scope = Smarty::SCOPE_LOCAL)
    {
        if (!$scope && !$tpl->scope) {
            return;
        }
        foreach (array($scope, $tpl->scope) as $s) {
            $s = ($bubble_up = $s >= Smarty::SCOPE_BUBBLE_UP) ? $s - Smarty::SCOPE_BUBBLE_UP : $s;
            if ($bubble_up && $s) {
                $ptr = $tpl->parent;
                if (isset($ptr)) {
                    $ptr->tpl_vars[$varName] = $tpl->tpl_vars[$varName];
                    $ptr = $ptr->parent;
                }
                if ($s == Smarty::SCOPE_PARENT) {
                    continue;
                }
                while (isset($ptr) && $ptr->_objType == 2) {
                    $ptr->tpl_vars[$varName] = $tpl->tpl_vars[$varName];
                    $ptr = $ptr->parent;
                }
                if ($s == Smarty::SCOPE_TPL_ROOT) {
                    continue;
                } elseif ($s == Smarty::SCOPE_SMARTY) {
                    $tpl->smarty->tpl_vars[$varName] = $tpl->tpl_vars[$varName];
                } elseif ($s == Smarty::SCOPE_GLOBAL) {
                    Smarty::$global_tpl_vars[$varName] = $tpl->tpl_vars[$varName];
                } elseif ($s == Smarty::SCOPE_ROOT) {
                    while (isset($ptr->parent)) {
                        $ptr = $ptr->parent;
                    }
                    $ptr->tpl_vars[$varName] = $tpl->tpl_vars[$varName];
                }
            }
        }
    }
941961
public function fetch($templateFile,$var) {
        $templateFile   =   substr($templateFile,strlen(THEME_PATH));
        vendor('Smarty.Smarty#class');
        $tpl            =   new \Smarty();
        $tpl->caching       = C('TMPL_CACHE_ON');
        $tpl->template_dir  = THEME_PATH;
        $tpl->compile_dir   = CACHE_PATH ;
        $tpl->cache_dir     = TEMP_PATH ;        
        if(C('TMPL_ENGINE_CONFIG')) {
            $config  =  C('TMPL_ENGINE_CONFIG');
            foreach ($config as $key=>$val){
                $tpl->{$key}   =  $val;
            }
        }
        $tpl->assign($var);
        $tpl->display($templateFile);
    }
220227
function XTemplateRuntime(tpl, option) {
        var self = this;
        self.tpl = tpl;
        option = S.merge(defaultConfig, option);
        option.subTpls = S.merge(option.subTpls, XTemplateRuntime.subTpls);
        option.commands = S.merge(option.commands, XTemplateRuntime.commands);
        this.option = option;
    }
65827
static function load(Smarty_Internal_Template $_template)
    {
        $_template->cached = new Smarty_Template_Cached($_template);
        $_template->cached->handler->populate($_template->cached, $_template);
        // caching enabled ?
        if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT ||
                $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || $_template->source->handler->recompiled
        ) {
            $_template->cached->valid = false;
        }
        return $_template->cached;
    }
1259684
public function addTemplate($template, $vars = []) {
        $tpl = new Template($template, 'template-mail', 0);

        foreach ($vars as $key => $var) {
            $tpl->assign($key, $var);
        }

        $message = $tpl->show();
        array_push($this->_message, $message);
    }
1182926
public function tpl(string $tpl, ?array $params = [], ?string $dir = null)
    {
        try {
            $this->message = App::$View->render($tpl, $params, $dir);
        } catch (SyntaxException $e) {
        }
        return $this;
    }
259070
public function prepareTemplateVariables($variables)
    {
        if (!isset($variables)) {
            $variables = new \stdClass();
        }

        // Set name property if the schema does not define it.
        if (!isset($variables->name) && !empty($this->schema_name)) {
            $variables->name = $this->schema_name;
        }

        // Set template property if the schema does not define it.
        if (!isset($variables->template) && ($theme = $this->getTheme())) {
            $variables->template = $theme;
        }
    }
193743
public function renderTemplate($tpl, array $render_vars) {
    $registry = new Registry();
    $loader = new \Twig_Loader_Filesystem($registry->templateDirs());
    $twig = new \Twig_Environment($loader, array(
      'cache' => sys_get_temp_dir() . '/drutiny/cache',
      'auto_reload' => TRUE,
    ));
    // $filter = new \Twig_SimpleFilter('filterXssAdmin', [$this, 'filterXssAdmin'], [
    //   'is_safe' => ['html'],
    // ]);
    // $twig->addFilter($filter);
    $template = $twig->load($tpl . '.html.twig');
    $contents = $template->render($render_vars);
    return $contents;
  }
1001091
public function load(array $config, ContainerBuilder $container)
    {
        $configs[] = $this->options;
        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

        $container->setParameter('twig.template_dir', $config['template_dir']);

        $container->register('twig.asset_extension', 'Nice\Twig\AssetExtension')
            ->addArgument(new Reference('service_container'))
            ->addTag('twig.extension');

        $container->register('twig.router_extension', 'Nice\Twig\RouterExtension')
            ->addArgument(new Reference('service_container'))
            ->addTag('twig.extension');

        $container->register('twig.loader', 'Twig_Loader_Filesystem')
            ->addArgument(array('%twig.template_dir%'));

        $container->register('twig', 'Twig_Environment')
            ->addArgument(new Reference('twig.loader'));

        $container->register('templating.engine.twig', 'Nice\Templating\TwigEngine')
            ->addArgument(new Reference('twig'))
            ->addArgument(new Reference('templating.template_name_parser'))
            ->addTag('templating.engine');
    }
933709
protected function render($tpl, array $data = [])
	{
		$suffix = $this->app->config('template.suffix');
        $suffix = (empty($suffix)) ? $this->viewSuffix : $suffix;
        $tpl   .= $suffix;

		$this->app->render($tpl, $data);
	}
1181029
public static function display($tpl, $variablesDefinitions = NULL, $indent = NULL) {
    $html = self::get($tpl, $variablesDefinitions, $indent);
    print $html;
  }
582041
public function render($tpl, array $vars = array(), array $cookies = array())
    {
        Logger::log('Start render response');
        $vars = ResponseHelper::setDebugHeaders($vars);
        $output = $this->dump($tpl, $vars);

        return $this->output($output, 'text/html', $cookies);
    }
822927
public function loadConfig()
    {
        if ($this->configIsValid()) {
            return;
        }

        $this->yaml->loadToConfig($this->getConfigPath(), 'tddd', true)->toArray();
    }
1005349
protected function _getTemplateVars() {
        $vars = parent::_getTemplateVars();
        $vars['advanced_session_validation'] =
            $this->_getAdvancedSessionValidation();

        //dispatch event to allow other extensions to add custom vcl template variables
        Mage::dispatchEvent('turpentine_get_templatevars_after', array(
            'vars' => &$vars,
            'vcl_version'=> self::VCL_VERSION
        ));

        return $vars;
    }
1087464
public function processTemplate($template, $vars = [])
    {
        // override the twig header vars for local resolution
        $this->grav->fireEvent('onTwigTemplateVariables');
        $vars += $this->twig_vars;

        try {
            $output = $this->twig->render($template, $vars);
        } catch (\Twig_Error_Loader $e) {
            throw new \RuntimeException($e->getRawMessage(), 404, $e);
        }

        return $output;

    }
496289
public function display($tpl, $tpl_vars = null) {
        if (!($this->_response instanceof \Swoole\Http\Response)) {
            throw new \Exception(200118);
        }


        $old_value = ini_set('xdebug.cli_color', 0);
        $html = $this->render($tpl, $tpl_vars);
        $this->_response->end($html);
        $old_value === false || ini_set('xdebug.cli_color', $old_value);
        return true;
    }