Initial commit.
This commit is contained in:
28
lib/php/monica/xhtml.inc.php
Normal file
28
lib/php/monica/xhtml.inc.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
// File name: xhtml.inc.php
|
||||
// Description: Extended PHP subroutine to read from/write to a file
|
||||
// Date: 2004-12-29
|
||||
// Author: imacat <imacat@pristine.com.tw>
|
||||
// Copyright: Copyright (C) 2004-2007 Pristine Communications
|
||||
|
||||
// xhtml_content_type: Check whether application/xhtml+xml or text/html
|
||||
// should be sent to the client
|
||||
function xhtml_content_type()
|
||||
{
|
||||
// Browsers that claim to support application/xhtml+xml explicitly
|
||||
if ( array_key_exists("HTTP_ACCEPT", $_SERVER)
|
||||
&& strpos($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml") !== false) {
|
||||
return "application/xhtml+xml";
|
||||
}
|
||||
// Browsers that are known to support application/xhtml+xml
|
||||
if (array_key_exists("HTTP_USER_AGENT", $_SERVER)) {
|
||||
// W3C validator can recognize application/xhtml+xml
|
||||
if (substr($_SERVER["HTTP_USER_AGENT"], 0, 13) == "W3C_Validator") {
|
||||
return "application/xhtml+xml";
|
||||
}
|
||||
}
|
||||
// Else, we assume that application/xhtml+xml is not supported
|
||||
return "text/html";
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user