/*!
\static
\return true if template node tree named \a $treeName should be included the compiled template.
169562
static function isTreeEnabled( $treeName )
    {
        $ini = eZINI::instance();
        $treeList = $ini->variable( 'TemplateSettings', 'CompileIncludeNodeTree' );
        return in_array( $treeName, $treeList );
    }
926662
protected function templateExists($template)
    {
        try {
            $class = $this->templating->getTemplateClass($template);
        } catch (Twig_Error_Loader $e) {
            return false;
        }

        return $template;
    }
1159297
protected function needsRecompile()
    {
        clearstatcache();
        return !is_file($this->file) || (
            (!empty($this->configTree['z']['sources'])
            && max(array_map('filemtime', $this->configTree['z']['sources'])) >= filemtime($this->file))
        );
    }
1292160
protected function templateExists($template)
    {
        $loader = $this->twig->getLoader();
        if ($loader instanceof ExistsLoaderInterface) {
            return $loader->exists($template);
        }

        try {
            if ($loader instanceof SourceContextLoaderInterface || method_exists($loader, 'getSourceContext')) {
                $loader->getSourceContext($template);
            } else {
                $loader->getSource($template);
            }

            return true;
        } catch (LoaderError $e) {
        }

        return false;
    }
1013832
function templateFile( $templateName )
    {
        if ( isset( $this->Templates[$templateName] ) )
        {
            return $this->Templates[$templateName]['filepath'];
        }
        return false;
    }
952132
protected function _include($template, $data = NULL)
    {
        // Merge local data with global data
        $data = isset($data) ? array_merge($this->_data, $data) : $this->_data;
        // Compile and run template
        $compiled = $this->_compile($template);

        return $this->_run($compiled, $data);
    }
203119
public boolean checkDebugEnabled(String tplName) {

        // Check first the exclude patterns. Any matching pattern in the exclude
        // list means that the debugging is disabled for the given template.
        if (debugNsExclude != null && debugNsExclude.matcher(tplName).matches()) {
            return false;
        }

        // Now check the include patterns. Any matching pattern here means that
        // the debugging for this template is enabled.
        if (debugNsInclude != null && debugNsInclude.matcher(tplName).matches()) {
            return true;
        }

        // If we get here, then the template didn't match anything. By default,
        // the debugging is turned off.
        return false;
    }
128600
public function template_exists($name)
    {
        foreach ($this->skin_paths as $skin_path) {
            $filename = RCUBE_INSTALL_PATH . $skin_path . '/templates/' . $name . '.html';
            if ((is_file($filename) && is_readable($filename))
                || ($this->deprecated_templates[$name] && $this->template_exists($this->deprecated_templates[$name]))
            ) {
                return true;
            }
        }

        return false;
    }
59738
function _compile_source($resource_name, &$source_content, &$compiled_content, $cache_include_path=null)
	{
		if (file_exists(SMARTY_DIR . $this->compiler_file)) {
			require_once(SMARTY_DIR . $this->compiler_file);
		} else {
			// use include_path
			require_once($this->compiler_file);
		}


		$smarty_compiler = new $this->compiler_class;

		$smarty_compiler->template_dir      = $this->template_dir;
		$smarty_compiler->compile_dir       = $this->compile_dir;
		$smarty_compiler->plugins_dir       = $this->plugins_dir;
		$smarty_compiler->config_dir        = $this->config_dir;
		$smarty_compiler->force_compile     = $this->force_compile;
		$smarty_compiler->caching           = $this->caching;
		$smarty_compiler->php_handling      = $this->php_handling;
		$smarty_compiler->left_delimiter    = $this->left_delimiter;
		$smarty_compiler->right_delimiter   = $this->right_delimiter;
		$smarty_compiler->_version          = $this->_version;
		$smarty_compiler->security          = $this->security;
		$smarty_compiler->secure_dir        = $this->secure_dir;
		$smarty_compiler->security_settings = $this->security_settings;
		$smarty_compiler->trusted_dir       = $this->trusted_dir;
		$smarty_compiler->use_sub_dirs      = $this->use_sub_dirs;
		$smarty_compiler->_reg_objects      = &$this->_reg_objects;
		$smarty_compiler->_plugins          = &$this->_plugins;
		$smarty_compiler->_tpl_vars         = &$this->_tpl_vars;
		$smarty_compiler->default_modifiers = $this->default_modifiers;
		$smarty_compiler->compile_id        = $this->_compile_id;
		$smarty_compiler->_config            = $this->_config;
		$smarty_compiler->request_use_auto_globals  = $this->request_use_auto_globals;

		if (isset($cache_include_path) && isset($this->_cache_serials[$cache_include_path])) {
			$smarty_compiler->_cache_serial = $this->_cache_serials[$cache_include_path];
		}
		$smarty_compiler->_cache_include = $cache_include_path;


		$_results = $smarty_compiler->_compile_file($resource_name, $source_content, $compiled_content);

		if ($smarty_compiler->_cache_serial) {
			$this->_cache_include_info = array(
                'cache_serial'=>$smarty_compiler->_cache_serial
			,'plugins_code'=>$smarty_compiler->_plugins_code
			,'include_file_path' => $cache_include_path);

		} else {
			$this->_cache_include_info = null;

		}

		return $_results;
	}
735461
public function setNodeName( $name )
	{
		if( $this->nodeName == (string) $name )
			return FALSE;
		$this->nodeName = (string) $name;
		return TRUE;
	}
387603
static function compileChildBlock(Smarty_Internal_TemplateCompilerBase $compiler, $_name = null)
    {
        if (!isset($compiler->_cache['blockNesting'])) {
            $compiler->trigger_template_error(' tag {$smarty.block.child} used outside {block} tags ',
                                              $compiler->parser->lex->taglineno);
        }
        $compiler->has_code = true;
        $compiler->suppressNocacheProcessing = true;
        $compiler->_cache['blockParams'][$compiler->_cache['blockNesting']][1] = true;
        $output = "<?php \n\$_smarty_tpl->ext->_inheritance->processBlock(\$_smarty_tpl, 2, {$compiler->_cache['blockName'][$compiler->_cache['blockNesting']]}, null, \$_blockParentStack);\n?>\n";
        return $output;
    }
912547
protected function shouldBeIncluded(string $sectionName): bool
    {
        return (count($this->includeExcluded) > 0 && in_array($sectionName, $this->includeExcluded));
    }
397855
function isExcludedFromBuild(node) {
	if (node.load.excludeFromBuild) {
		return true;
	}

	if (
		node.load.metadata &&
		node.load.metadata.hasOwnProperty("bundle") &&
		node.load.metadata.bundle === false
	) {
		return true;
	}

	if (
		node.isPlugin &&
		!node.value.includeInBuild &&
		!node.load.metadata.includeInBuild
	) {
		return true;
	}

	return false;
}
1232841
public function hasAttribute($qname)
    {
        foreach($this->attribute_nodes as $attr) if ($attr->getQualifiedName() == $qname) return true;
        return false;
    }
602714
static function processNodeCombining( $useComments, $php, $tpl, &$node, &$resourceData, &$newNode )
    {
        $nodeType = $node[0];
        if ( $nodeType == eZTemplate::NODE_ROOT )
        {
            $children = $node[1];
            $newNode[0] = $nodeType;
            $newNode[1] = false;
            if ( $children )
            {
                eZTemplateCompiler::processNodeCombiningChildren( $useComments, $php, $tpl, $children, $resourceData, $newNode );
            }
        }
        else
            $tpl->error( 'processNodeCombining', "Unknown root type $nodeType, should be " . eZTemplate::NODE_ROOT );
    }
1172615
public function isNamed()
    {
        // If file is not array, then template
        // is not named for sure.
        if ( ! is_array($this->file)) {
            return false;
        }

        // Return false if template is named, but name 
        // is invalid. A valid name should be:
        if (
            isset($this->file[1]) && is_bool($this->file[1]) // should be set and not be a boolean
            || null === $this->file[1] // or null value
            || empty($this->file[1]) // or empty sting or array
        ) {
            return false;
        }

        return true;
    }
469653
protected function _compileTemplates(array $templates = [])
    {
        if (empty($templates)) {
            $templates = array_keys($this->_config);
        }
        foreach ($templates as $name) {
            $template = $this->get($name);
            if ($template === null) {
                $this->_compiled[$name] = [null, null];
            }

            $template = str_replace('%', '%%', $template);
            preg_match_all('#\{\{([\w\._]+)\}\}#', $template, $matches);
            $this->_compiled[$name] = [
                str_replace($matches[0], '%s', $template),
                $matches[1]
            ];
        }
    }