Go to the documentation of this file.
38 $s = self::mangleFlashPolicy(
$s );
41 if ( !defined(
'MW_NO_OUTPUT_COMPRESSION' ) ) {
42 $s = self::handleGzip(
$s );
44 if ( !ini_get(
'output_handler' ) ) {
45 self::emitContentLength( strlen(
$s ) );
63 if ( isset( $_SERVER[
'REQUEST_URI'] ) ) {
65 $path = explode(
'?', $_SERVER[
'REQUEST_URI'], 2 )[0];
66 } elseif ( isset( $_SERVER[
'SCRIPT_NAME'] ) ) {
68 $path = $_SERVER[
'SCRIPT_NAME'];
74 $period = strrpos(
$path,
'.' );
75 if ( $period !==
false ) {
76 return strtolower( substr(
$path, $period ) );
90 if ( !function_exists(
'gzencode' ) ) {
91 wfDebug( __METHOD__ .
"() skipping compression (gzencode unavailable)\n" );
94 if ( headers_sent() ) {
95 wfDebug( __METHOD__ .
"() skipping compression (headers already sent)\n" );
99 $ext = self::findUriExtension();
100 if (
$ext ==
'.gz' ||
$ext ==
'.tgz' ) {
109 wfDebug( __METHOD__ .
"() is compressing output\n" );
110 header(
'Content-Encoding: gzip' );
111 $s = gzencode(
$s, 6 );
115 $headers = headers_list();
117 foreach ( $headers as
$header ) {
118 $headerName = strtolower( substr(
$header, 0, 5 ) );
119 if ( $headerName ==
'vary:' ) {
125 header(
'Vary: Accept-Encoding' );
137 # Avoid weird excessive memory usage in PCRE on big articles
138 if ( preg_match(
'/<\s*cross-domain-policy(?=\s|>)/i',
$s ) ) {
139 return preg_replace(
'/<(\s*)(cross-domain-policy(?=\s|>))/i',
'<$1NOT-$2',
$s );
152 && isset( $_SERVER[
'SERVER_PROTOCOL'] )
153 && $_SERVER[
'SERVER_PROTOCOL'] ==
'HTTP/1.0'
155 header(
"Content-Length: $length" );
$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.
$wgDisableOutputCompression
Disable output compression (enabled by default if zlib is available)
if(!is_readable( $file)) $ext