function html(HTTPResponse $response) { $response->addHeader("Content-type", "text/html; charset=" . self::$encoding); $response->addHeader("Vary", "Accept"); $content = $response->getBody(); $content = ereg_replace("<\\?xml[^>]+\\?>\n?", '', $content); $content = str_replace(array('/>', 'xml:lang', 'application/xhtml+xml'), array('>', 'lang', 'text/html'), $content); $content = ereg_replace('<!DOCTYPE[^>]+>', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', $content); $content = ereg_replace('<html xmlns="[^"]+"', '<html ', $content); $response->setBody($content); }
function html(HTTPResponse $response) { $response->addHeader("Content-Type", "text/html; charset=" . self::$encoding); $response->addHeader("Vary", "Accept"); $content = $response->getBody(); $hasXMLHeader = substr($content, 0, 5) == '<' . '?xml'; $content = ereg_replace("<\\?xml[^>]+\\?>\n?", '', $content); $content = str_replace(array('/>', 'xml:lang', 'application/xhtml+xml'), array('>', 'lang', 'text/html'), $content); // Only replace the doctype in templates with the xml header if ($hasXMLHeader) { $content = ereg_replace('<!DOCTYPE[^>]+>', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', $content); } $content = ereg_replace('<html xmlns="[^"]+"', '<html ', $content); $response->setBody($content); }