41 parent::__construct();
43 $xoops->preload()->triggerEvent(
'core.template.construct.start', array($this));
44 $this->left_delimiter =
'<{';
45 $this->right_delimiter =
'}>';
49 $this->compile_check = (
$xoops->getConfig(
'theme_fromfile') == 1);
51 $this->addPluginsDir(SMARTY_PLUGINS_DIR);
71 public function fetchFromData($tplSource, $display =
false, $vars = null)
73 $oldVars = $this->_tpl_vars;
78 $out = $this->display(
'eval:'.$tplSource);
80 $out = $this->fetch(
'eval:'.$tplSource);
82 $this->_tpl_vars = $oldVars;
92 public function touch($resourceName)
94 $isForced = $this->force_compile;
95 $this->force_compile =
true;
98 $this->force_compile = $isForced;
111 if (isset($cache_id)) {
112 return (isset($compile_id)) ? $compile_id .
'-' . $cache_id : $cache_id;
114 if (isset($compile_id)) {
130 public function setCompileId($module_dirname = null, $theme_set = null, $template_set = null)
134 $template_set = empty($template_set) ?
$xoops->getConfig(
'template_set') : $template_set;
135 $theme_set = empty($theme_set) ?
$xoops->getConfig(
'theme_set') : $theme_set;
136 $module_dirname = empty($module_dirname) ?
$xoops->moduleDirname : $module_dirname;
137 $this->compile_id = substr(md5(\
XoopsBaseConfig::get(
'url')), 0, 8) .
'-' . $module_dirname .
'-' . $theme_set .
'-' . $template_set;
155 $hold_compile_id = $this->compile_id;
159 $compile_id = $this->compile_id;
160 $this->compile_id = $hold_compile_id;
161 $compile_id = preg_replace(
'![^\w\|]+!',
'_', $compile_id);
162 $glob = $compile_id .
'*.php';
164 $files = glob($this->compile_dir .
'/' . $glob);
165 foreach (
$files as $filename) {
166 $count += unlink($filename) ? 1 : 0;
168 $files = glob($this->cache_dir .
'/*' . $glob);
169 foreach (
$files as $filename) {
170 $count += unlink($filename) ? 1 : 0;
191 public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null,
$type = null)
194 return parent::clearCache($template_name, $cache_id, $compile_id, $exp_time,
$type);
_get_auto_id($cache_id=null, $compile_id=null)
clearCache($template_name, $cache_id=null, $compile_id=null, $exp_time=null, $type=null)
fetchFromData($tplSource, $display=false, $vars=null)
setCompileId($module_dirname=null, $theme_set=null, $template_set=null)
clearModuleCompileCache($module_dirname=null, $theme_set=null, $template_set=null)