MediaWiki  1.30.0
OutputHandler.php File Reference

Functions to be used with PHP's output buffer. More...

Go to the source code of this file.

Functions

 wfDoContentLength ( $length)
 Add a Content-Length header if possible. More...
 
 wfGzipHandler ( $s)
 Handler that compresses data with gzip if allowed by the Accept header. More...
 
 wfHtmlValidationHandler ( $s)
 Replace the output with an error if the HTML is not valid. More...
 
 wfMangleFlashPolicy ( $s)
 Mangle flash policy tags which open up the site to XSS attacks. More...
 
 wfOutputHandler ( $s)
 Standard output handler for use with ob_start. More...
 
 wfRequestExtension ()
 Get the "file extension" that some client apps will estimate from the currently-requested URL. More...
 

Detailed Description

Functions to be used with PHP's output buffer.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Definition in file OutputHandler.php.

Function Documentation

◆ wfDoContentLength()

wfDoContentLength (   $length)

Add a Content-Length header if possible.

This makes it cooperate with CDN better.

Parameters
int$length

Definition at line 169 of file OutputHandler.php.

Referenced by wfOutputHandler().

◆ wfGzipHandler()

wfGzipHandler (   $s)

Handler that compresses data with gzip if allowed by the Accept header.

Unlike ob_gzhandler, it works for HEAD requests too.

Parameters
string$s
Returns
string

Definition at line 103 of file OutputHandler.php.

References $ext, $header, $s, $wgUseKeyHeader, as, global, wfClientAcceptsGzip(), wfDebug(), and wfRequestExtension().

Referenced by wfOutputHandler().

◆ wfHtmlValidationHandler()

wfHtmlValidationHandler (   $s)

Replace the output with an error if the HTML is not valid.

Parameters
string$s
Returns
string

Definition at line 185 of file OutputHandler.php.

References $line, $out, $s, MWTidy\checkErrors(), Html\closeElement(), color, Html\element(), Html\htmlHeader(), Html\inlineStyle(), Html\openElement(), and Html\rawElement().

Referenced by wfOutputHandler().

◆ wfMangleFlashPolicy()

wfMangleFlashPolicy (   $s)

Mangle flash policy tags which open up the site to XSS attacks.

Parameters
string$s
Returns
string

Definition at line 155 of file OutputHandler.php.

References $s.

Referenced by wfOutputHandler().

◆ wfOutputHandler()

wfOutputHandler (   $s)

Standard output handler for use with ob_start.

Parameters
string$s
Returns
string

Definition at line 30 of file OutputHandler.php.

References $header, $name, $s, $value, $wgDisableOutputCompression, $wgMangleFlashPolicy, $wgValidateAllHtml, as, captcha-old\count, global, wfDoContentLength(), wfGzipHandler(), wfHtmlValidationHandler(), and wfMangleFlashPolicy().

Referenced by ApiFormatPhpTest\testCrossDomainMangling().

◆ wfRequestExtension()

wfRequestExtension ( )

Get the "file extension" that some client apps will estimate from the currently-requested URL.

This isn't on WebRequest because we need it when things aren't initialized

Access:\n private
Returns
string

Definition at line 75 of file OutputHandler.php.

References $path, and list.

Referenced by wfGzipHandler().