/** * Standard output handler for use with ob_start * * @param $s string * * @return string */ function wfOutputHandler($s) { global $wgDisableOutputCompression, $wgValidateAllHtml; $s = wfMangleFlashPolicy($s); if ($wgValidateAllHtml) { $headers = headers_list(); $isHTML = false; foreach ($headers as $header) { $parts = explode(':', $header, 2); if (count($parts) !== 2) { continue; } $name = strtolower(trim($parts[0])); $value = trim($parts[1]); if ($name == 'content-type' && (strpos($value, 'text/html') === 0 || strpos($value, 'application/xhtml+xml') === 0)) { $isHTML = true; break; } } if ($isHTML) { $s = wfHtmlValidationHandler($s); } } if (!$wgDisableOutputCompression && !ini_get('zlib.output_compression')) { if (!defined('MW_NO_OUTPUT_COMPRESSION')) { $s = wfGzipHandler($s); } if (!ini_get('output_handler')) { wfDoContentLength(strlen($s)); } } return $s; }
/** * Standard output handler for use with ob_start * * @param $s string * * @return string */ function wfOutputHandler($s) { global $wgDisableOutputCompression, $wgValidateAllHtml; $s = wfMangleFlashPolicy($s); if ($wgValidateAllHtml) { $headers = apache_response_headers(); $isHTML = true; foreach ($headers as $name => $value) { if (strtolower($name) == 'content-type' && strpos($value, 'text/html') === false && strpos($value, 'application/xhtml+xml') === false) { $isHTML = false; break; } } if ($isHTML) { $s = wfHtmlValidationHandler($s); } } if (!$wgDisableOutputCompression && !ini_get('zlib.output_compression')) { if (!defined('MW_NO_OUTPUT_COMPRESSION')) { $s = wfGzipHandler($s); } if (!ini_get('output_handler')) { wfDoContentLength(strlen($s)); } } return $s; }