MediaWiki  REL1_31
MWTidy Class Reference

Class to interact with HTML tidy. More...

Static Public Member Functions

static destroySingleton ()
 Destroy the current singleton instance. More...
 
static factory (array $config)
 Create a new Tidy driver object from configuration. More...
 
static isEnabled ()
 
static setInstance ( $instance)
 Set the driver to be used. More...
 
static singleton ()
 
static tidy ( $text)
 Interface with html tidy. More...
 

Static Private Attributes

static $instance
 

Detailed Description

Class to interact with HTML tidy.

Either the external tidy program or the in-process tidy extension will be used depending on availability. Override the default $wgTidyInternal setting to disable the internal if it's not working.

Definition at line 33 of file MWTidy.php.

Member Function Documentation

◆ destroySingleton()

static MWTidy::destroySingleton ( )
static

Destroy the current singleton instance.

Definition at line 142 of file MWTidy.php.

Referenced by ParserTestRunner\perTestSetup(), TextContentTest\setUp(), and TextContentTest\tearDown().

◆ factory()

static MWTidy::factory ( array  $config)
static

Create a new Tidy driver object from configuration.

See also
$wgTidyConfig
Parameters
array$config
Returns
bool|\MediaWiki\Tidy\TidyDriverBase
Exceptions
MWException

Definition at line 103 of file MWTidy.php.

References $instance.

Referenced by BenchmarkTidy\execute(), ParserTestRunner\perTestSetup(), and singleton().

◆ isEnabled()

static MWTidy::isEnabled ( )
static
Returns
bool

Definition at line 58 of file MWTidy.php.

References singleton().

Referenced by Parser\internalParseHalfParsed(), Sanitizer\removeHTMLtags(), and TidyTest\setUp().

◆ setInstance()

static MWTidy::setInstance (   $instance)
static

Set the driver to be used.

This is for testing.

Parameters
MediaWiki\\Tidy\\TidyDriverBase | false | null$instance

Definition at line 135 of file MWTidy.php.

References $instance.

Referenced by ParserTestRunner\perTestSetup().

◆ singleton()

static MWTidy::singleton ( )
static
Returns
bool|\MediaWiki\Tidy\TidyDriverBase

Definition at line 65 of file MWTidy.php.

References $instance, $wgDebugTidy, $wgTidyBin, $wgTidyConf, $wgTidyConfig, $wgTidyInternal, $wgTidyOpts, $wgUseTidy, factory(), global, and wfIsHHVM().

Referenced by BenchmarkTidy\execute(), isEnabled(), and tidy().

◆ tidy()

static MWTidy::tidy (   $text)
static

Interface with html tidy.

If tidy isn't able to correct the markup, the original will be returned in all its glory with a warning comment appended.

Parameters
string$textHTML input fragment. This should not contain a <body> or <html> tag.
Returns
string Corrected HTML output
Exceptions
MWException

Definition at line 46 of file MWTidy.php.

References singleton().

Referenced by SpecialExpandTemplates\execute(), Parser\internalParseHalfParsed(), and TidyTest\testTidyWrapping().

Member Data Documentation

◆ $instance

MWTidy::$instance
staticprivate

Definition at line 34 of file MWTidy.php.

Referenced by factory(), setInstance(), and singleton().


The documentation for this class was generated from the following file: