Changeset 409

Show
Ignore:
Timestamp:
2011-01-01 15:58:59 (1 year ago)
Author:
hannes
Message:

Always send text/html MIME type.
The regular XHTML type causes too many problems
with common browsers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/classes/pages/Page.php

    r407 r409  
    706706    public function send($html) { 
    707707        global $SETTINGS; 
    708         /* figure out which MIME type to send the document with; 
    709          * depending on browser capabilities */ 
    710         // set text/html as default (for deprecated legacy browsers) 
     708        // set text/html as default 
    711709        $mime = 'text/html'; 
    712         if ($html->asXML() !== FALSE) { 
    713             if (stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml')) { 
    714                 if (preg_match('/application\/xhtml\+xml;q=([01]|0\.\d{1,3}|1\.0)/i', $_SERVER['HTTP_ACCEPT'], $matches)) { 
    715                     // priority of XHTML 
    716                     $xhtml_q = $matches[1]; 
    717                     if (preg_match('/text\/html;q=q=([01]|0\.\d{1,3}|1\.0)/i', $_SERVER['HTTP_ACCEPT'], $matches)) { 
    718                         // priority of HTML 
    719                         $html_q = $matches[1]; 
    720                         if ((float)$xhtml_q >= (float)$html_q) { 
    721                             /* browser prefers XHTML over HTML, so send the document as such; 
    722                              * this guarantees faster and more reliable rendering */ 
    723                             $mime = 'application/xhtml+xml'; 
    724                         } 
    725                     } 
    726                 } else { 
    727                     /* browser accepts XHTML, but script can't figure out which one it prefers; 
    728                      * send as XHTML */ 
    729                     $mime = 'application/xhtml+xml'; 
    730                 } 
    731             } 
    732         } 
    733710        // start output with the document headers 
    734711        header('Content-Type: ' . $mime . '; charset=' . $SETTINGS['encoding']);