/** * Load fresh compiled template by including the PHP file * HHVM requires a work around because of a PHP incompatibility * * @param \Smarty_Internal_Template $_template */ private function loadCompiledTemplate(Smarty_Internal_Template $_template) { if (function_exists('opcache_invalidate')) { opcache_invalidate($_template->compiled->filepath); } $_smarty_tpl = $_template; if (strpos(phpversion(), 'hhvm') !== false) { Smarty_Internal_Extension_Hhvm::includeHhvm($_template, $_template->compiled->filepath); } else { include $_template->compiled->filepath; } }
/** * Read the cached template and process its header * * @param Smarty_Internal_Template $_template template object * @param Smarty_Template_Cached $cached cached object * @param bool $update flag if called because cache update * * @return boolean true or false if the cached content does not exist */ public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null, $update = false) { /** @var Smarty_Internal_Template $_smarty_tpl * used in included file */ $_smarty_tpl = $_template; if (strpos(phpversion(), 'hhvm') !== false) { return Smarty_Internal_Extension_Hhvm::includeHhvm($_template, $_template->cached->filepath); } else { return @(include $_template->cached->filepath); } }
/** * load compiled template or compile from source * * @param Smarty_Internal_Template $_template * * @throws Exception */ public function process(Smarty_Internal_Template $_template) { $_smarty_tpl = $_template; if ($_template->source->recompiled || !$_template->compiled->exists || $_template->smarty->force_compile || $_template->smarty->compile_check && $_template->source->getTimeStamp() > $_template->compiled->getTimeStamp()) { $this->compileTemplateSource($_template); $compileCheck = $_template->smarty->compile_check; $_template->smarty->compile_check = false; if ($_template->source->recompiled) { $level = ob_get_level(); ob_start(); try { eval("?>" . $this->code); } catch (Exception $e) { while (ob_get_level() > $level) { ob_end_clean(); } throw $e; } ob_get_clean(); $this->code = null; } else { if (function_exists('opcache_invalidate')) { opcache_invalidate($_template->compiled->filepath); } if (strpos(phpversion(), 'hhvm') !== false) { Smarty_Internal_Extension_Hhvm::includeHhvm($_template, $_template->compiled->filepath); } else { include $_template->compiled->filepath; } } $_template->smarty->compile_check = $compileCheck; } else { include $_template->compiled->filepath; if ($_template->mustCompile) { $this->compileTemplateSource($_template); $compileCheck = $_template->smarty->compile_check; $_template->smarty->compile_check = false; if (function_exists('opcache_invalidate')) { opcache_invalidate($_template->compiled->filepath); } if (strpos(phpversion(), 'hhvm') !== false) { Smarty_Internal_Extension_Hhvm::includeHhvm($_template, $_template->compiled->filepath); } else { include $_template->compiled->filepath; } $_template->smarty->compile_check = $compileCheck; } } $this->unifunc = $_template->properties['unifunc']; $this->processed = true; }