public static function enabled_for($response)
    {
        $contentType = $response->getHeader("Content-Type");

        // Disable content negotiation for other content types
        if ($contentType
            && substr($contentType, 0, 9) != 'text/html'
            && substr($contentType, 0, 21) != 'application/xhtml+xml'
        ) {
            return false;
        }

        if (ContentNegotiator::getEnabled()) {
            return true;
        } else {
            return (substr($response->getBody(), 0, 5) == '<' . '?xml');
        }
    }