/*============================================================================== Title: phiXmlHeader Category: Plugin Author: Phize Author URI: http://phize.net License: GNU General Public License(http://www.gnu.org/licenses/gpl.html) Version: 1.2.0 Last Update: 2007-07-30T21:16:01+09:00 ==============================================================================*/ $event = &$modx->Event; if ($event->name == 'OnWebPagePrerender') { $contentType = $modx->documentObject['contentType']; $charset = $modx->config['modx_charset']; $accept = $_SERVER['HTTP_ACCEPT']; $ua = $_SERVER['HTTP_USER_AGENT']; $isXml = preg_match('/application\/(.+?)\+xml/i', $contentType); $supportsXml = (stristr($accept, $contentType) || stristr($ua, 'Opera')); $isValidator = stristr($ua, 'W3C_Validator'); $isLint = stristr($ua, 'Another_HTML-lint'); if ($isXml && $contentType == 'application/xhtml+xml') { if (!$supportsXml && !$isValidator && !$isLint) { header('Content-Type: text/html; charset=' . $charset); } } else if ($isXml && !$supportsXml) { header('Content-Type: text/xml; charset=' . $charset); } }