Skip to content
Permalink
Browse files

ENHANCEMENT Don't force all class names to lowercase

Speeds up autoloading because composer psr-4 works properly now
  • Loading branch information...
Damian Mooyman
Damian Mooyman committed Sep 19, 2017
1 parent 9a7adc4 commit 261302a12150b88068a70f829f7265f31e57f551
@@ -116,7 +116,7 @@ public static function process(HTTPResponse $response)
$chosenFormat = "xhtml";
} else {
foreach ($mimes as $format => $mime) {
$regExp = '/' . str_replace(array('+','/'), array('\+','\/'), $mime) . '(;q=(\d+\.\d+))?/i';
$regExp = '/' . str_replace(array('+', '/'), array('\+', '\/'), $mime) . '(;q=(\d+\.\d+))?/i';
if (isset($_SERVER['HTTP_ACCEPT']) && preg_match($regExp, $_SERVER['HTTP_ACCEPT'], $matches)) {
$preference = isset($matches[2]) ? $matches[2] : 1;
if (!isset($q[$preference])) {
@@ -130,13 +130,13 @@ public static function process(HTTPResponse $response)
krsort($q);
$chosenFormat = reset($q);
} else {
$chosenFormat = Config::inst()->get('SilverStripe\\Control\\ContentNegotiator', 'default_format');
$chosenFormat = Config::inst()->get(static::class, 'default_format');
}
}
}
$negotiator = new ContentNegotiator();
$negotiator->$chosenFormat( $response );
$negotiator->$chosenFormat($response);
}
/**
@@ -202,7 +202,7 @@ public function html(HTTPResponse $response)
$response->addHeader("Vary", "Accept");
$content = $response->getBody();
$hasXMLHeader = (substr($content, 0, 5) == '<' . '?xml' );
$hasXMLHeader = (substr($content, 0, 5) == '<' . '?xml');
// Fix base tag
$content = preg_replace(
@@ -212,7 +212,11 @@ public function html(HTTPResponse $response)
);
$content = preg_replace("#<\\?xml[^>]+\\?>\n?#", '', $content);
$content = str_replace(array('/>','xml:lang','application/xhtml+xml'), array('>','lang','text/html'), $content);
$content = str_replace(
array('/>', 'xml:lang', 'application/xhtml+xml'),
array('>', 'lang', 'text/html'),
$content
);
// Only replace the doctype in templates with the xml header
if ($hasXMLHeader) {

0 comments on commit 261302a

Please sign in to comment.
You can’t perform that action at this time.