<link 로 시작하는 코드만 가지고 올것

This commit is contained in:
whitedot
2013-04-24 10:39:16 +09:00
parent 08fafe3bc2
commit 355034bafd

View File

@ -1959,12 +1959,12 @@ function html_end()
$buffer = ob_get_contents();
ob_end_clean();
preg_match('#<body>(.*)</body>#is', $buffer, $bodys);
preg_match_all('/<link[^>]+>/i', $bodys[0], $links);
preg_match_all('/(\r|\n)<link[^>]+>/i', $bodys[0], $links);
$stylesheet = '';
$links[0] = array_unique($links[0]);
foreach ($links[0] as $key=>$link) {
//$link = PHP_EOL.$links[0][$i];
$stylesheet .= PHP_EOL.$link;
$stylesheet .= $link;
$buffer = preg_replace('#'.$link.'#', '', $buffer);
}
return preg_replace('#(</title>)#', "$1$stylesheet", $buffer);