23 if (is_object(
$tpl)) {
24 $tpl_source =
$tpl->getVar(
'tpl_source',
'n');
26 $fp = fopen(
$tpl,
'r');
27 $filesize = filesize(
$tpl);
28 $tpl_source = ($filesize > 0) ? fread($fp, $filesize) :
'';
39 if (is_object(
$tpl)) {
40 $tpl_timestamp =
$tpl->getVar(
'tpl_lastmodified',
'n');
42 $tpl_timestamp = filemtime(
$tpl);
60 static $cache = array();
63 if (isset($cache[$tpl_name])) {
64 return $cache[$tpl_name];
66 $tplset = $xoopsConfig[
'template_set'];
67 $theme = isset($xoopsConfig[
'theme_set']) ? $xoopsConfig[
'theme_set'] :
'default';
70 if ($tplset !=
"default") {
71 $tplobj = $tplfile_handler->find($tplset, null, null, null, $tpl_name,
true);
73 return $cache[$tpl_name] = $tplobj[0];
77 $tplobj = $tplfile_handler->find(
"default", null, null, null, $tpl_name,
true);
79 if (!count($tplobj)) {
80 return $cache[$tpl_name] =
false;
83 $module = $tplobj->getVar(
'tpl_module',
'n');
84 $type = $tplobj->getVar(
'tpl_type',
'n');
92 $theme = isset($xoopsConfig[
'cpanel']) ? $xoopsConfig[
'cpanel'] :
'default';
102 $filepath = $directory .
"/{$theme}/modules/{$module}/{$path}{$tpl_name}";
103 if (!file_exists($filepath)) {
105 $filepath = XOOPS_ROOT_PATH .
"/modules/{$module}/templates/{$path}{$tpl_name}";
106 if (!file_exists($filepath)) {
107 return $cache[$tpl_name] = $tplobj ;
110 return $cache[$tpl_name] = $filepath;