Go to the documentation of this file.
31 global $wgDisableOutputCompression, $wgValidateAllHtml;
33 if ( $wgValidateAllHtml ) {
34 $headers = headers_list();
36 foreach ( $headers
as $header ) {
37 $parts = explode(
':', $header, 2 );
38 if ( count( $parts ) !== 2 ) {
41 $name = strtolower( trim( $parts[0] ) );
42 $value = trim( $parts[1] );
43 if (
$name ==
'content-type' && ( strpos(
$value,
'text/html' ) === 0
44 || strpos(
$value,
'application/xhtml+xml' ) === 0 )
54 if ( !$wgDisableOutputCompression && !ini_get(
'zlib.output_compression' ) ) {
55 if ( !defined(
'MW_NO_OUTPUT_COMPRESSION' ) ) {
58 if ( !ini_get(
'output_handler' ) ) {
75 if ( isset( $_SERVER[
'REQUEST_URI'] ) ) {
77 list(
$path ) = explode(
'?', $_SERVER[
'REQUEST_URI'], 2 );
78 } elseif ( isset( $_SERVER[
'SCRIPT_NAME'] ) ) {
80 $path = $_SERVER[
'SCRIPT_NAME'];
86 $period = strrpos(
$path,
'.' );
87 if ( $period !==
false ) {
88 return strtolower( substr(
$path, $period ) );
102 if ( !function_exists(
'gzencode' ) ) {
103 wfDebug( __FUNCTION__ .
"() skipping compression (gzencode unavailable)\n" );
106 if ( headers_sent() ) {
107 wfDebug( __FUNCTION__ .
"() skipping compression (headers already sent)\n" );
112 if (
$ext ==
'.gz' ||
$ext ==
'.tgz' ) {
121 wfDebug( __FUNCTION__ .
"() is compressing output\n" );
122 header(
'Content-Encoding: gzip' );
123 $s = gzencode(
$s, 6 );
127 $headers = headers_list();
129 foreach ( $headers
as $header ) {
130 if ( substr( $header, 0, 5 ) ==
'Vary:' ) {
136 header(
'Vary: Accept-Encoding' );
139 header(
'X-Vary-Options: Accept-Encoding;list-contains=gzip' );
153 # Avoid weird excessive memory usage in PCRE on big articles
154 if ( preg_match(
'/<\s*cross-domain-policy\s*>/i',
$s ) ) {
155 return preg_replace(
'/<\s*cross-domain-policy\s*>/i',
'<NOT-cross-domain-policy>',
$s );
167 if ( !headers_sent() && isset( $_SERVER[
'SERVER_PROTOCOL'] ) && $_SERVER[
'SERVER_PROTOCOL'] ==
'HTTP/1.0' ) {
168 header(
"Content-Length: $length" );
186 header(
'Cache-Control: no-cache' );
191 $error = strtok( $errors,
"\n" );
193 while (
$error !==
false ) {
194 if ( preg_match(
'/^line (\d+)/',
$error, $m ) ) {
195 $lineNum = intval( $m[1] );
196 $badLines[$lineNum] =
true;
208 while (
$line !==
false ) {
210 if ( isset( $badLines[$i] ) ) {
211 $attrs[
'class'] =
'highlight';
212 $attrs[
'id'] =
"line-$i";
215 $line = strtok(
"\n" );
221 .highlight { background-
color: #ffc }
222 li { white-space:
pre }
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static htmlHeader( $attribs=array())
Constructs the opening html-tag with necessary doctypes depending on global variables.
wfMangleFlashPolicy( $s)
Mangle flash policy tags which open up the site to XSS attacks.
</p > ! end ! test Empty pre
static closeElement( $element)
Returns "</$element>", except if $wgWellFormedXml is off, in which case it returns the empty string w...
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
wfHtmlValidationHandler( $s)
Replace the output with an error if the HTML is not valid.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
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
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Allows to change the fields on the form that will be generated $name
wfClientAcceptsGzip( $force=false)
static inlineStyle( $contents, $media='all')
Output a "<style>" tag with the given contents for the given media type (if any).
wfGzipHandler( $s)
Handler that compresses data with gzip if allowed by the Accept header.
wfOutputHandler( $s)
Standard output handler for use with ob_start.
in the sidebar</td >< td > font color
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
wfDoContentLength( $length)
Add a Content-Length header if possible.
static checkErrors( $text, &$errorStr=null)
Check HTML for errors, used if $wgValidateAllHtml = true.
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
wfRequestExtension()
Get the "file extension" that some client apps will estimate from the currently-requested URL.