mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-09 00:31:45 +01:00
Re-organized rendering (read source / compile / cache) process to avoid circular dependencies.
This commit is contained in:
@@ -36,35 +36,6 @@ abstract class RecompiledPlugin extends BasePlugin {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* compile template from source
|
||||
*
|
||||
* @param Template $_smarty_tpl do not change variable name, is used by compiled template
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function recompile(Template $_smarty_tpl) {
|
||||
$compiled = $_smarty_tpl->getCompiled();
|
||||
$compiled->file_dependency = [];
|
||||
$compiled->includes = [];
|
||||
$compiled->nocache_hash = null;
|
||||
$compiled->unifunc = null;
|
||||
$level = ob_get_level();
|
||||
ob_start();
|
||||
// call compiler
|
||||
try {
|
||||
eval('?>' . $_smarty_tpl->getCompiler()->compileTemplate($_smarty_tpl));
|
||||
} catch (\Exception $e) {
|
||||
while (ob_get_level() > $level) {
|
||||
ob_end_clean();
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
ob_get_clean();
|
||||
$compiled->timestamp = time();
|
||||
$compiled->exists = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable timestamp checks for recompiled resource.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user