MediaWiki  master
MWTidy Class Reference

Class to interact with and configure Remex tidy. More...

Static Public Member Functions

static destroySingleton ()
 Destroy the current singleton instance. More...
 
static factory (array $config=null)
 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 Remex tidy. More...
 

Static Private Attributes

static $instance
 

Detailed Description

Class to interact with and configure Remex tidy.

Definition at line 29 of file MWTidy.php.

Member Function Documentation

◆ destroySingleton()

static MWTidy::destroySingleton ( )
static

Destroy the current singleton instance.

Definition at line 93 of file MWTidy.php.

References null.

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

◆ factory()

static MWTidy::factory ( array  $config = null)
static

Create a new Tidy driver object from configuration.

See also
$wgTidyConfig
Parameters
array | null$configOptional since 1.33
Returns
bool|\MediaWiki\Tidy\TidyDriverBase
Exceptions
MWException

Definition at line 76 of file MWTidy.php.

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

◆ isEnabled()

static MWTidy::isEnabled ( )
static

◆ setInstance()

static MWTidy::setInstance (   $instance)
static

Set the driver to be used.

This is for testing.

Parameters
MediaWiki\\Tidy\\TidyDriverBase | false | null$instance
Deprecated:
Since 1.33

Definition at line 85 of file MWTidy.php.

References $instance, and wfDeprecated().

Referenced by ParserTestRunner\perTestSetup(), SanitizerTest\testRemoveHTMLtags(), and SanitizerTest\testRemovehtmltagsOnHtml5Tags().

◆ singleton()

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

Definition at line 61 of file MWTidy.php.

References $wgTidyConfig, and null.

Referenced by BenchmarkTidy\execute().

◆ tidy()

static MWTidy::tidy (   $text)
static

Interface with Remex 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 42 of file MWTidy.php.

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

Member Data Documentation

◆ $instance

MWTidy::$instance
staticprivate

Definition at line 30 of file MWTidy.php.

Referenced by setInstance().


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