3 * Smarty Resource Plugin
6 * @subpackage TemplateResources
11 * Smarty Resource Plugin
12 * Base implementation for resource plugins that don't compile cache
15 * @subpackage TemplateResources
17 abstract class Smarty_Resource_Recompiled extends Smarty_Resource
20 * Flag that it's an recompiled resource
24 public $recompiled = true;
27 * Resource does implement populateCompiledFilepath() method
31 public $hasCompiledHandler = true;
34 * compile template from source
36 * @param Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
40 public function process(Smarty_Internal_Template $_smarty_tpl)
42 $compiled = &$_smarty_tpl->compiled;
43 $compiled->file_dependency = array();
44 $compiled->includes = array();
45 $compiled->nocache_hash = null;
46 $compiled->unifunc = null;
47 $level = ob_get_level();
49 $_smarty_tpl->loadCompiler();
52 eval("?>" . $_smarty_tpl->compiler->compileTemplate($_smarty_tpl));
54 catch (Exception $e) {
55 unset($_smarty_tpl->compiler);
56 while (ob_get_level() > $level) {
61 // release compiler object to free memory
62 unset($_smarty_tpl->compiler);
64 $compiled->timestamp = time();
65 $compiled->exists = true;
69 * populate Compiled Object with compiled filepath
71 * @param Smarty_Template_Compiled $compiled compiled object
72 * @param Smarty_Internal_Template $_template template object
76 public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
78 $compiled->filepath = false;
79 $compiled->timestamp = false;
80 $compiled->exists = false;
84 * Disable timestamp checks for recompiled resource.
88 public function checkTimestamps()