link 에서 외부 css 파일이 겹치는 경우가 있어 버퍼링 소스코드 보완

This commit is contained in:
gnuboard
2013-04-22 14:28:00 +09:00
parent 113231ac78
commit 809a8a6e9b
3 changed files with 8 additions and 3 deletions

View File

@ -1961,9 +1961,10 @@ function html_end()
preg_match('#<body>(.*)</body>#is', $buffer, $bodys); preg_match('#<body>(.*)</body>#is', $buffer, $bodys);
preg_match_all('/<link[^>]+>/i', $bodys[0], $links); preg_match_all('/<link[^>]+>/i', $bodys[0], $links);
$stylesheet = ''; $stylesheet = '';
for ($i=0; $i<count($links[0]); $i++) { $links[0] = array_unique($links[0]);
$link = PHP_EOL.$links[0][$i]; foreach ($links[0] as $key=>$link) {
$stylesheet .= $link; //$link = PHP_EOL.$links[0][$i];
$stylesheet .= PHP_EOL.$link;
$buffer = preg_replace('#'.$link.'#', '', $buffer); $buffer = preg_replace('#'.$link.'#', '', $buffer);
} }
return preg_replace('#(</title>)#', "$1$stylesheet", $buffer); return preg_replace('#(</title>)#', "$1$stylesheet", $buffer);

View File

@ -39,11 +39,13 @@ function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40)
include_once($cache_file); include_once($cache_file);
/*
// 같은 스킨은 .css 를 한번만 호출한다. // 같은 스킨은 .css 를 한번만 호출한다.
if (!in_array($skin_dir, $css) && is_file($latest_skin_path.'/style.css')) { if (!in_array($skin_dir, $css) && is_file($latest_skin_path.'/style.css')) {
echo '<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">'; echo '<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">';
$css[] = $skin_dir; $css[] = $skin_dir;
} }
*/
ob_start(); ob_start();
include $latest_skin_path.'/latest.skin.php'; include $latest_skin_path.'/latest.skin.php';

View File

@ -2,6 +2,8 @@
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
?> ?>
<link rel="stylesheet" href="<?=$latest_skin_url?>/style.css">
<div class="lt"> <div class="lt">
<strong class="lt_title"><a href="<?=G4_BBS_URL?>/board.php?bo_table=<?=$bo_table?>"><?=$bo_subject?></a></strong> <strong class="lt_title"><a href="<?=G4_BBS_URL?>/board.php?bo_table=<?=$bo_table?>"><?=$bo_subject?></a></strong>
<ul> <ul>