📄 func_tpl.php
字号:
<?php
if (!defined('ROOT'))
exit('Access Denied');
function tpl($mod, $file)
{
if (file_exists($_file = './' . $mod . '/templates/' . TPL . '/' . $file .
'.html'))
{
$tpl = TPL;
} else
{
if (!file_exists($_file = './' . $mod . '/templates/default/' . $file . '.html'))
return;
$tpl = is_dir('./' . $mod . '/templates/' . TPL) ? TPL : 'default';
}
switch (substr($file, 0, 4))
{
case 'box_':
$fname = 'box_header';
break;
case 'aja_':
case 'fra_':
$fname = '';
default:
$fname = 'header';
}
$f_htpl = is_dir('./templates/' . TPL) ? true : false;
if (!file_exists($_file2 = './' . $mod . '/templates/' . $tpl . '/' . $fname .
'.html'))
{
if (!file_exists($_file2 = './templates/' . TPL . '/' . $fname . '.html'))
{
return;
} else
$h_tpl = TPL;
} else
{
$h_tpl = $tpl;
}
$str = read_file($_file);
$str2 = read_file($_file2);
$css = '';
preg_replace("/\<\!--link--\>(.+?)\<\!--linkend--\>/ies", "\$css='\\1'", $str);
$css = str_replace('\"', '"', $css);
$css = str_replace('$', '{/$}', $css);
$css = preg_replace("/(href=\")([^\"]*)(_[_|~]include)/is", "\\1\\3", $css);
$str = preg_replace("/\<\!--end--\>(.+?)$/is", '', $str);
$str = preg_replace("/^(.+?)\<\!--begin--\>/is", '', $str);
switch (substr($file, 0, 4))
{
case 'box_':
$str = str_replace('{body}', $str, $str2);
break;
case 'aja_':
break;
case 'fra_':
$_displayid = 'e' . uniqid();
$jsstr = '<script language="javascript">';
$jsstr .= '<?php if(!empty($_GET[\'displayid\'])) {?>parent.document.getElementById(\'<?php echo htmlspecialchars($_GET[\'displayid\']);?>\').innerHTML = document.getElementById(\'' .
$_displayid . '\').innerHTML;parent.<?php echo htmlspecialchars($_GET[\'displayid\']);?>_q=true;<?php } ?>';
$jsstr .= '<?php if(!empty($_GET[\'loadid\'])) {?>parent.document.getElementById(\'<?php echo htmlspecialchars($_GET[\'loadid\']);?>\').innerHTML = \'\';<?php } ?>';
$jsstr .= '</script>';
if (preg_match("/<script(.+?)\/>(.+?)<\/script>/is", $str, $_t))
{
$str = preg_replace("/<script(.+?)\/>(.+?)<\\script>/is", '', $str);
$jsstr .= $_t[0];
}
$str = '<html><body><div id="' . $_displayid . '">' . $str . '</div>' . $jsstr .
'</body></html>';
break;
default:
$str = str_replace('{body}', $str, $str2);
}
$str = preg_replace("/\<\!--link--\>(.+?)\<\!--linkend--\>/is", $css, $str);
$str = str_replace('{/$}', '$', $str);
$str = preg_replace("/\{\/[\$](.+?)\/\}/is", '<?=$\\1?>', $str);
$str = preg_replace("/\{\/(.+?)\/\}/is", '<?=$GLOBALS[\'tpl\'][\'\\1\']?>', $str);
$str = preg_replace("/\[\/([a-z]+),([0-9]+)\/\]/ies", "showad('\\1',\\2)", $str);
$str = str_replace('__include', './' . $mod . '/templates/' . $tpl .
'/__include', $str);
$str = str_replace('_~include', './templates/' . $h_tpl . '/_~include', $str);
write_file('./cache/templates/' . $mod . '_' . TPL . '_' . $file . '.php', $str);
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -