Uruchomienie szablonu
@param string $templateCode kod szablonu
@param string $compilationFile adres kompilanta
@return string
769277
private function _compileTemplate($templateCode, $compilationFile)
    {
        //start bufora
        ob_start();
        //wymuszona kompilacja
        if ($this->_alwaysCompile) {
            file_put_contents($compilationFile, $this->template($templateCode));
        }
        //próba włączenia skompilowanego pliku
        try {
            //włączenie kompilanta do kodu
            include $compilationFile;
        } catch (\Exception $e) {
            //kompilacja i zapis i włączenie kompilanta do kodu
            file_put_contents($compilationFile, $this->template($templateCode));
            include $compilationFile;
        }
        //przechwycenie danych z bufora
        return ob_get_clean();
    }
958500
static function restoreCache( $key, $templateFilepath )
    {
        if ( !eZTemplateTreeCache::isCacheEnabled() )
            return false;

        $templateCache =& eZTemplateTreeCache::cacheTable();
        $key = eZTemplateTreeCache::internalKey( $key );
        if ( isset( $templateCache[$key] ) )
        {
            eZDebug::writeDebug( "Template cache for key '$key' already exist, cannot restore cache", __METHOD__ );
            return false;
        }
        $cacheFileName = eZTemplateTreeCache::treeCacheFilename( $key, $templateFilepath );

        $php = new eZPHPCreator( eZTemplateTreeCache::cacheDirectory(), $cacheFileName );
        $variables = $php->restore( array( 'info' => 'TemplateInfo',
                                           'root' => 'TemplateRoot',
                                           'cache-date' => 'eZTemplateTreeCacheCodeDate' ) );
        if ( $variables['cache-date'] != eZTemplateTreeCache::CODE_DATE )
            return false;
        $cache =& $templateCache[$key];
        $cache['root'] =& $variables['root'];
        $cache['info'] =& $variables['info'];
        return true;
    }
111377
public function load(string $templatePath): TemplateInterface
    {
        $path = $this->resolveCachedTemplatePath($templatePath);
        $class = $this->generateTemplateCacheClass($path);

        return $this->compileAndSaveTemplate(
            $this->finder->getContents($path),
            $this->resolveCacheTemplatePath($class),
            $class
        );
    }
702859
private function compile($source)
    {
        $name = $this->getTemplateClassName($source);

        $this->log(
            Mustache_Logger::INFO,
            'Compiling template to "{className}" class',
            array('className' => $name)
        );

        if ($source instanceof Mustache_Source) {
            $source = $source->getSource();
        }
        $tree = $this->parse($source);

        $compiler = $this->getCompiler();
        $compiler->setPragmas($this->getPragmas());

        return $compiler->compile($source, $tree, $name, isset($this->escape), $this->charset, $this->strictCallables, $this->entityFlags);
    }
1087111
public static function unescape($output, $dynamicId, $compiledFile)
    {
        $output = preg_replace_callback('/<dwoo:dynamic_(' . $dynamicId . ')>(.+?)<\/dwoo:dynamic_' . $dynamicId . '>/s', array(
            'self',
            'unescapePhp'
        ), $output, - 1, $count);
        // re-add the includes on top of the file
        if ($count && preg_match('#/\* template head \*/(.+?)/\* end template head \*/#s', file_get_contents($compiledFile), $m)) {
            $output = '<?php ' . $m[1] . ' ?>' . $output;
        }

        return $output;
    }
660320
static function compilationFilename( $key, $resourceData )
    {
        $internalCharset = eZTextCodec::internalCharset();
        $templateFilepath = $resourceData['template-filename'];
        $extraName = '';
        if ( preg_match( "#^.+/(.*)\.tpl$#", $templateFilepath, $matches ) )
            $extraName = $matches[1] . '-';
        else if ( preg_match( "#^(.*)\.tpl$#", $templateFilepath, $matches ) )
            $extraName = $matches[1] . '-';
        $accessText = false;
        if ( isset( $GLOBALS['eZCurrentAccess']['name'] ) )
            $accessText = '-' . $GLOBALS['eZCurrentAccess']['name'];
        $locale = eZLocale::instance();
        $language = $locale->localeFullCode();
        $http = eZHTTPTool::instance();
        $useFullUrlText = $http->UseFullUrl ? 'full' : 'relative';

        $pageLayoutVariable = "";
        if ( isset( $GLOBALS['eZCustomPageLayout'] ) )
            $pageLayoutVariable = $GLOBALS['eZCustomPageLayout'];

        $ini = eZINI::instance();

        $shareTemplates = $ini->hasVariable( 'TemplateSettings', 'ShareCompiledTemplates' ) ?
                            $ini->variable( 'TemplateSettings', 'ShareCompiledTemplates' ) == 'enabled' :
                            false;

        if ( $shareTemplates )
            $cacheFileKey = $key . '-' . $language;
        else
            $cacheFileKey = $key . '-' . $internalCharset . '-' . $language . '-' . $useFullUrlText . $accessText . "-" . $pageLayoutVariable . '-' . eZSys::indexFile();

        $cacheFileName = $extraName . md5( $cacheFileKey ) . '.php';
        return $cacheFileName;
    }
1035998
public function compile($template, $data)
    {
        foreach ($data as $key => $value) {
            $key = strtoupper($key);

            if(is_bool($value))
                $value = $value ? 'true' : 'false';

            $template = preg_replace("#\\$$key\\$#i", $value, $template);
        }

        return $template;
    }
540408
public function twigLoadFileTemplate ($template_file = null, $template_dir_list = [], $options = []) {
		if (isset($this->textTemplate)) {
			return $this->twigLoadStringTemplate($this->textTemplate, $template_dir_list);
		}

		$twig = $this->twigTemplateSetting(null, $template_dir_list, $options);
		$this->templateDir = $this->templateDir ?: $this->controller;
		$this->template = $this->template ?: $this->action;

		if ($template_file === null) {
			if (!isset($this->templateFile) || $this->templateFile === null) {
				$this->templateFile = PathTrait::CreateFilePath([implode('.', [Strings::ToSnakeCase($this->template), $this->mimeType, 'twig'])]);
			}
			$template_file = $this->templateFile;
		}

		return $twig->loadTemplate($template_file);
	}
472942
function hasCompiledTemplate( $keyData, $uri, &$resourceData, $templatePath, &$extraParameters, $timestamp )
    {
        $key = $this->cacheKey( $keyData, $resourceData, $templatePath, $extraParameters );
        return eZTemplateCompiler::hasCompiledTemplate( $key, $timestamp, $resourceData );
    }
746146
protected function compiled($template)
    {
        $template = ltrim($template, '/');
        if (strrchr($template, '.') == $this->extension)
            $template = substr($template, 0, -strlen($this->extension));
        $file = $this->dir . DIRECTORY_SEPARATOR . $template . $this->extension;
        if (!is_file($file))
            throw new \RuntimeException("template not found:$file!");

        $modified = filemtime($file);
        $compiled = $this->temp . DIRECTORY_SEPARATOR . $template . ".{$modified}.php";
        if (!$this->debug && is_file($compiled) && filemtime($compiled) >= $modified)
            return $compiled;

        $content = self::compile(file_get_contents($file), $this->left, $this->right);
        self::writeFile($compiled, $content, $this->temp);

        return $compiled;
    }
879907
public function write(Smarty_Internal_Template $_template, $code)
    {
        if (!$_template->source->handler->recompiled) {
            if ($_template->smarty->ext->_writeFile->writeFile($this->filepath, $code, $_template->smarty) === true) {
                $this->timestamp = $this->exists = is_file($this->filepath);
                if ($this->exists) {
                    $this->timestamp = filemtime($this->filepath);
                    return true;
                }
            }
            return false;
        } else {
            $this->content = $code;
        }
        $this->timestamp = time();
        $this->exists = true;
        return true;
    }
1111639
public function getPageUsingTemplate($templatefile)
    {
        $pages = $this->getPagesUsingTemplate($templatefile);

        return count($pages) ? $pages[0] : null;
    }
422261
public function compileTemplateSource(Smarty_Internal_Template $_template)
    {
        $_template->source->compileds = array();
        $this->file_dependency = array();
        $this->tpl_function = array();
        $this->includes = array();
        $this->nocache_hash = null;
        $this->unifunc = null;
        // compile locking
        if (!$_template->source->handler->recompiled) {
            if ($saved_timestamp = $_template->compiled->getTimeStamp()) {
                touch($_template->compiled->filepath);
            }
        }
        // call compiler
        try {
            $_template->loadCompiler();
            $code = $_template->compiler->compileTemplate($_template);
        }
        catch (Exception $e) {
            // restore old timestamp in case of error
            if (!$_template->source->handler->recompiled && $saved_timestamp) {
                touch($_template->compiled->filepath, $saved_timestamp);
            }
            throw $e;
        }
        // compiling succeeded
        if ($_template->compiler->write_compiled_code) {
            // write compiled template
            $this->write($_template, $code);
            $code = '';
        }
        // release compiler object to free memory
        unset($_template->compiler);
        return $code;
    }
110293
public function deleteCompiledFile($templateName)
    {
        $className = $this->jigConverter->getClassNameFromFilename($templateName);
        $compileFilename = $this->jigConfig->getCompiledFilenameFromClassname($className);
        $deleted = @unlink($compileFilename);

        return $deleted;
    }
1292475
public function compileTemplate(Smarty_Internal_Template $template, $nocache = false)
    {
        if (empty($template->properties['nocache_hash'])) {
            $template->properties['nocache_hash'] = $this->nocache_hash;
        } else {
            $this->nocache_hash = $template->properties['nocache_hash'];
        }
        // flag for nochache sections
        $this->nocache = $nocache;
        $this->tag_nocache = false;
        // save template object in compiler class
        $this->template = $template;
        // reset has nocache code flag
        $this->template->has_nocache_code = false;
        $save_source = $this->template->source;
        // template header code
        $template_header = '';
        if (!$this->suppressHeader) {
            $template_header .= "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . "\n";
            $template_header .= "         compiled from \"" . $this->template->source->filepath . "\" */ ?>\n";
        }

        if (empty($this->template->source->components)) {
            $this->sources = array($template->source);
        } else {
            // we have array of inheritance templates by extends: resource
            $this->sources = array_reverse($template->source->components);
        }
        $loop = 0;
        // the $this->sources array can get additional elements while compiling by the {extends} tag
        while ($this->template->source = array_shift($this->sources)) {
            $this->smarty->_current_file = $this->template->source->filepath;
            if ($this->smarty->debugging) {
                Smarty_Internal_Debug::start_compile($this->template);
            }
            $no_sources = count($this->sources);
            if ($loop || $no_sources) {
                $this->template->properties['file_dependency'][$this->template->source->uid] = array($this->template->source->filepath, $this->template->source->timestamp, $this->template->source->type);
            }
            $loop++;
            if ($no_sources) {
                $this->inheritance_child = true;
            } else {
                $this->inheritance_child = false;
            }
            do {
                $_compiled_code = '';
                // flag for aborting current and start recompile
                $this->abort_and_recompile = false;
                // get template source
                $_content = $this->template->source->content;
                if ($_content != '') {
                    // run prefilter if required
                    if ((isset($this->smarty->autoload_filters['pre']) || isset($this->smarty->registered_filters['pre'])) && !$this->suppressFilter) {
                        $_content = Smarty_Internal_Filter_Handler::runFilter('pre', $_content, $template);
                    }
                    // call compiler
                    $_compiled_code = $this->doCompile($_content);
                }
            } while ($this->abort_and_recompile);
            if ($this->smarty->debugging) {
                Smarty_Internal_Debug::end_compile($this->template);
            }
        }
        // restore source
        $this->template->source = $save_source;
        unset($save_source);
        $this->smarty->_current_file = $this->template->source->filepath;
        // free memory
        unset($this->parser->root_buffer, $this->parser->current_buffer, $this->parser, $this->lex, $this->template);
        self::$_tag_objects = array();
        // return compiled code to template object
        $merged_code = '';
        if (!$this->suppressMergedTemplates && !empty($this->merged_templates)) {
            foreach ($this->merged_templates as $code) {
                $merged_code .= $code;
            }
        }
        // run postfilter if required on compiled template code
        if ((isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) && !$this->suppressFilter && $_compiled_code != '') {
            $_compiled_code = Smarty_Internal_Filter_Handler::runFilter('post', $_compiled_code, $template);
        }
        if ($this->suppressTemplatePropertyHeader) {
            $code = $_compiled_code . $merged_code;
        } else {
            $code = $template_header . $template->createTemplateCodeFrame($_compiled_code) . $merged_code;
        }
        // unset content because template inheritance could have replace source with parent code
        unset ($template->source->content);

        return $code;
    }
180173
public function matchParentTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler)
    {
        // search parent compiler template source
        $nextCompiler = $compiler;
        while ($nextCompiler !== $nextCompiler->parent_compiler) {
            $nextCompiler = $nextCompiler->parent_compiler;
            if ($compiler !== $nextCompiler) {
                // get template source
                $_content = $nextCompiler->template->source->getContent();
                if ($_content != '') {
                    // run pre filter if required
                    if ((isset($nextCompiler->smarty->autoload_filters['pre']) ||
                            isset($nextCompiler->smarty->registered_filters['pre']))) {
                        $_content = $nextCompiler->smarty->ext->_filter_Handler->runFilter('pre', $_content, $nextCompiler->template);
                    }
                    $this->matchProperty($_content);
                }
            }
        }
    }
216710
public function compile($template)
    {
        $name = md5($template);
        
        if (isset(self::$callbacks[$name])) {
            return self::$callbacks[$name];
        }
        
        $file = $this->cache . '/' . $this->prefix . $name . '.php';

        if (is_dir($this->cache) && file_exists($file)) {
            $callback = include($file);
        } else {
            $code = Compiler::i($this, $template)->compile();
            
            if (is_dir($this->cache)) {
                file_put_contents($file, $code);
            }
            
            //called like: function($data) {};
            $callback = @eval('?>'.$code);
            //$this->checkEval($code);
        }
        
        self::$callbacks[$name] = $callback;
        
        return $callback;
    }