protected static function getResponseFormat()
    {
        // Check content type
        foreach (headers_list() as $header) {
            if (stripos($header, 'content-type:') === 0) {
                // This handler only works with HTML and javascript outputs
                // text/javascript is obsolete in favour of application/javascript, but still used
                if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) {
                    return 'js';
                }
                if (stripos($header, 'text/html') === false) {
                    return 'unknown';
                }
                break;
            }
        }

        return 'html';
    }
protected static function getResponseFormat()
    {
        // Check content type
        foreach (headers_list() as $header) {
            if (stripos($header, 'content-type:') === 0) {
                // This handler only works with HTML and javascript outputs
                // text/javascript is obsolete in favour of application/javascript, but still used
                if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) {
                    return 'js';
                }
                if (stripos($header, 'text/html') === false) {
                    return 'unknown';
                }
                break;
            }
        }

        return 'html';
    }
protected static function getResponseFormat ( ) { // Check content type foreach ( headers_list ( ) as $ header ) { if ( stripos ( $ header , 'content-type:' ) === 0 ) { // This handler only works with HTML and javascript outputs // text/javascript is obsolete in favour of application/javascript, but still used if ( stripos ( $ header , 'application/javascript' ) !== false || stripos ( $ header , 'text/javascript' ) !== false ) { return 'js' ; } if ( stripos ( $ header , 'text/html' ) === false ) { return 'unknown' ; } break ; } } return 'html' ; }
Checks the format of the response

If Content-Type is set to application/javascript or text/javascript -> js
If Content-Type is set to text/html, or is unset -> html
If Content-Type is anything else -> unknown

@return string One of 'js', 'html' or 'unknown'
Checks the format of the response