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_all('/<link[^>]+>/i', $bodys[0], $links);
$stylesheet = '';
for ($i=0; $i<count($links[0]); $i++) {
$link = PHP_EOL.$links[0][$i];
$stylesheet .= $link;
$links[0] = array_unique($links[0]);
foreach ($links[0] as $key=>$link) {
//$link = PHP_EOL.$links[0][$i];
$stylesheet .= PHP_EOL.$link;
$buffer = preg_replace('#'.$link.'#', '', $buffer);
}
return preg_replace('#(</title>)#', "$1$stylesheet", $buffer);