mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
#2094: Make ContentNegotiator send XHTML to the W3C validator
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@47875 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
05051ef484
commit
2427c0c50c
@ -43,6 +43,12 @@ class ContentNegotiator {
|
||||
} else if(isset($_GET['forceFormat'])) {
|
||||
$chosenFormat = $_GET['forceFormat'];
|
||||
|
||||
} else {
|
||||
// The W3C validator doesn't send an HTTP_ACCEPT header, but it can support xhtml. We put this special case in here so that
|
||||
// designers don't get worried that their templates are HTML4.
|
||||
if(substr($_SERVER['HTTP_USER_AGENT'], 0, 14) == 'W3C_Validator/') {
|
||||
$chosenFormat = "xhtml";
|
||||
|
||||
} else {
|
||||
foreach($mimes as $format => $mime) {
|
||||
$regExp = '/' . str_replace(array('+','/'),array('\+','\/'), $mime) . '(;q=(\d+\.\d+))?/i';
|
||||
@ -60,6 +66,7 @@ class ContentNegotiator {
|
||||
$chosenFormat = "html";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$negotiator = new ContentNegotiator();
|
||||
$negotiator->$chosenFormat( $response );
|
||||
|
Loading…
Reference in New Issue
Block a user