| 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 | | } |
|---|