38 if ( $phase | PHP_OUTPUT_HANDLER_CLEAN ) {
43 $s = self::mangleFlashPolicy(
$s );
46 if ( !defined(
'MW_NO_OUTPUT_COMPRESSION' ) ) {
47 $s = self::handleGzip(
$s );
49 if ( !ini_get(
'output_handler' ) ) {
50 self::emitContentLength( strlen(
$s ) );
68 if ( isset( $_SERVER[
'REQUEST_URI'] ) ) {
70 $path = explode(
'?', $_SERVER[
'REQUEST_URI'], 2 )[0];
71 } elseif ( isset( $_SERVER[
'SCRIPT_NAME'] ) ) {
73 $path = $_SERVER[
'SCRIPT_NAME'];
79 $period = strrpos(
$path,
'.' );
80 if ( $period !==
false ) {
81 return strtolower( substr(
$path, $period ) );
95 if ( !function_exists(
'gzencode' ) ) {
96 wfDebug( __METHOD__ .
"() skipping compression (gzencode unavailable)" );
99 if ( headers_sent() ) {
100 wfDebug( __METHOD__ .
"() skipping compression (headers already sent)" );
104 $ext = self::findUriExtension();
105 if (
$ext ==
'.gz' ||
$ext ==
'.tgz' ) {
114 wfDebug( __METHOD__ .
"() is compressing output" );
115 header(
'Content-Encoding: gzip' );
116 $s = gzencode(
$s, 6 );
120 $headers = headers_list();
122 foreach ( $headers as
$header ) {
123 $headerName = strtolower( substr(
$header, 0, 5 ) );
124 if ( $headerName ==
'vary:' ) {
130 header(
'Vary: Accept-Encoding' );
142 # Avoid weird excessive memory usage in PCRE on big articles
143 if ( preg_match(
'/<\s*cross-domain-policy(?=\s|>)/i',
$s ) ) {
144 return preg_replace(
'/<(\s*)(cross-domain-policy(?=\s|>))/i',
'<$1NOT-$2',
$s );
157 && isset( $_SERVER[
'SERVER_PROTOCOL'] )
158 && $_SERVER[
'SERVER_PROTOCOL'] ==
'HTTP/1.0'
160 header(
"Content-Length: $length" );
$wgDisableOutputCompression
Disable output compression (enabled by default if zlib is available)
$wgMangleFlashPolicy
When OutputHandler is used, mangle any output that contains <cross-domain-policy>.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfClientAcceptsGzip( $force=false)
Whether the client accept gzip encoding.
if(!is_readable( $file)) $ext