mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Removed XHTML XML declaration requirement
This commit is contained in:
parent
d57caa6477
commit
13b7386a2f
@ -134,25 +134,19 @@ class ContentNegotiator {
|
|||||||
*/
|
*/
|
||||||
public function xhtml(SS_HTTPResponse $response) {
|
public function xhtml(SS_HTTPResponse $response) {
|
||||||
$content = $response->getBody();
|
$content = $response->getBody();
|
||||||
|
|
||||||
// Only serve "pure" XHTML if the XML header is present
|
|
||||||
if(substr($content,0,5) == '<' . '?xml' ) {
|
|
||||||
$response->addHeader("Content-Type", "application/xhtml+xml; charset=" . self::$encoding);
|
|
||||||
$response->addHeader("Vary" , "Accept");
|
|
||||||
|
|
||||||
// Fix base tag
|
$response->addHeader("Content-Type", "application/xhtml+xml; charset=" . self::$encoding);
|
||||||
$content = preg_replace('/<base href="([^"]*)"><!--\[if[[^\]*]\] \/><!\[endif\]-->/',
|
$response->addHeader("Vary" , "Accept");
|
||||||
'<base href="$1" />', $content);
|
|
||||||
|
|
||||||
$content = str_replace(' ',' ', $content);
|
|
||||||
$content = str_replace('<br>','<br />', $content);
|
|
||||||
$content = preg_replace('#(<img[^>]*[^/>])>#i', '\\1/>', $content);
|
|
||||||
|
|
||||||
$response->setBody($content);
|
|
||||||
|
|
||||||
} else {
|
// Fix base tag
|
||||||
return $this->html($response);
|
$content = preg_replace('/<base href="([^"]*)"><!--\[if[[^\]*]\] \/><!\[endif\]-->/',
|
||||||
}
|
'<base href="$1" />', $content);
|
||||||
|
|
||||||
|
$content = str_replace(' ',' ', $content);
|
||||||
|
$content = str_replace('<br>','<br />', $content);
|
||||||
|
$content = preg_replace('#(<img[^>]*[^/>])>#i', '\\1/>', $content);
|
||||||
|
|
||||||
|
$response->setBody($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user