36 $headers = headers_list();
38 foreach ( $headers as
$header ) {
39 $parts = explode(
':',
$header, 2 );
40 if ( count( $parts ) !== 2 ) {
43 $name = strtolower( trim( $parts[0] ) );
44 $value = trim( $parts[1] );
45 if ( $name ==
'content-type' && ( strpos(
$value,
'text/html' ) === 0
46 || strpos(
$value,
'application/xhtml+xml' ) === 0 )
57 if ( !defined(
'MW_NO_OUTPUT_COMPRESSION' ) ) {
60 if ( !ini_get(
'output_handler' ) ) {
77 if ( isset( $_SERVER[
'REQUEST_URI'] ) ) {
79 list( $path ) = explode(
'?', $_SERVER[
'REQUEST_URI'], 2 );
80 } elseif ( isset( $_SERVER[
'SCRIPT_NAME'] ) ) {
82 $path = $_SERVER[
'SCRIPT_NAME'];
88 $period = strrpos( $path,
'.' );
89 if ( $period !==
false ) {
90 return strtolower( substr( $path, $period ) );
104 if ( !function_exists(
'gzencode' ) ) {
105 wfDebug( __FUNCTION__ .
"() skipping compression (gzencode unavailable)\n" );
108 if ( headers_sent() ) {
109 wfDebug( __FUNCTION__ .
"() skipping compression (headers already sent)\n" );
114 if (
$ext ==
'.gz' ||
$ext ==
'.tgz' ) {
123 wfDebug( __FUNCTION__ .
"() is compressing output\n" );
124 header(
'Content-Encoding: gzip' );
125 $s = gzencode(
$s, 6 );
129 $headers = headers_list();
131 foreach ( $headers as
$header ) {
132 $headerName = strtolower( substr(
$header, 0, 5 ) );
133 if ( $headerName ==
'vary:' ) {
139 header(
'Vary: Accept-Encoding' );
142 header(
'Key: Accept-Encoding;match=gzip' );
156 # Avoid weird excessive memory usage in PCRE on big articles
157 if ( preg_match(
'/<\s*cross-domain-policy(?=\s|>)/i',
$s ) ) {
158 return preg_replace(
'/<(\s*)(cross-domain-policy(?=\s|>))/i',
'<$1NOT-$2',
$s );
171 && isset( $_SERVER[
'SERVER_PROTOCOL'] )
172 && $_SERVER[
'SERVER_PROTOCOL'] ==
'HTTP/1.0'
174 header(
"Content-Length: $length" );
191 header(
'Cache-Control: no-cache' );
193 $out = Html::element(
'h1',
null,
'HTML validation error' );
194 $out .= Html::openElement(
'ul' );
196 $error = strtok( $errors,
"\n" );
198 while ( $error !==
false ) {
199 if ( preg_match(
'/^line (\d+)/', $error, $m ) ) {
200 $lineNum = intval( $m[1] );
201 $badLines[$lineNum] =
true;
202 $out .= Html::rawElement(
'li',
null,
203 Html::element(
'a', [
'href' =>
"#line-{$lineNum}" ], $error ) ) .
"\n";
205 $error = strtok(
"\n" );
208 $out .= Html::closeElement(
'ul' );
209 $out .= Html::element(
'pre',
null, $errors );
210 $out .= Html::openElement(
'ol' ) .
"\n";
213 while (
$line !==
false ) {
215 if ( isset( $badLines[$i] ) ) {
216 $attrs[
'class'] =
'highlight';
217 $attrs[
'id'] =
"line-$i";
219 $out .= Html::element(
'li', $attrs,
$line ) .
"\n";
220 $line = strtok(
"\n" );
223 $out .= Html::closeElement(
'ol' );
226.highlight { background-
color: #ffc }
227li { white-space: pre }
230 $out = Html::htmlHeader( [
'lang' =>
'en',
'dir' =>
'ltr' ] ) .
231 Html::rawElement(
'head',
null,
232 Html::element(
'title',
null,
'HTML validation error' ) .
233 Html::inlineStyle( $style ) ) .
234 Html::rawElement(
'body',
null,
$out ) .
235 Html::closeElement(
'html' );
in the sidebar</td >< td > font color
$wgValidateAllHtml
Validate the overall output using tidy and refuse to display the page if it's not valid.
$wgDisableOutputCompression
Disable output compression (enabled by default if zlib is available)
$wgMangleFlashPolicy
When OutputHandler is used, mangle any output that contains <cross-domain-policy>.
$wgUseKeyHeader
Send the Key HTTP header for better caching.
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.
wfRequestExtension()
Get the "file extension" that some client apps will estimate from the currently-requested URL.
wfOutputHandler( $s)
Standard output handler for use with ob_start.
wfDoContentLength( $length)
Add a Content-Length header if possible.
wfMangleFlashPolicy( $s)
Mangle flash policy tags which open up the site to XSS attacks.
wfGzipHandler( $s)
Handler that compresses data with gzip if allowed by the Accept header.
wfHtmlValidationHandler( $s)
Replace the output with an error if the HTML is not valid.
static checkErrors( $text, &$errorStr=null)
Check HTML for errors, used if $wgValidateAllHtml = true.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out