MediaWiki  REL1_24
MWTidy Class Reference

Class to interact with HTML tidy. More...

List of all members.

Static Public Member Functions

static checkErrors ($text, &$errorStr=null)
 Check HTML for errors, used if $wgValidateAllHtml = true.
static tidy ($text)
 Interface with html tidy, used if $wgUseTidy = true.

Static Private Member Functions

static execExternalTidy ($text, $stderr=false, &$retval=null)
 Spawn an external HTML tidy process and get corrected markup back from it.
static execInternalTidy ($text, $stderr=false, &$retval=null)
 Use the HTML tidy extension to use the tidy library in-process, saving the overhead of spawning a new process.

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 119 of file MWTidy.php.


Member Function Documentation

static MWTidy::checkErrors ( text,
&$  errorStr = null 
) [static]

Check HTML for errors, used if $wgValidateAllHtml = true.

Parameters:
string$text
string&$errorStrReturn the error string
Returns:
bool Whether the HTML is valid

Definition at line 161 of file MWTidy.php.

Referenced by wfHtmlValidationHandler().

static MWTidy::execExternalTidy ( text,
stderr = false,
&$  retval = null 
) [static, private]

Spawn an external HTML tidy process and get corrected markup back from it.

Also called in OutputHandler.php for full page validation

Parameters:
string$textHTML to check
bool$stderrWhether to read result from STDERR rather than STDOUT
int&$retvalExit code (-1 on internal error)
Returns:
string|null

Definition at line 183 of file MWTidy.php.

static MWTidy::execInternalTidy ( text,
stderr = false,
&$  retval = null 
) [static, private]

Use the HTML tidy extension to use the tidy library in-process, saving the overhead of spawning a new process.

Parameters:
string$textHTML to check
bool$stderrWhether to read result from error status instead of output
int&$retvalExit code (-1 on internal error)
Returns:
string|null

Definition at line 250 of file MWTidy.php.

static MWTidy::tidy ( text) [static]

Interface with html tidy, used if $wgUseTidy = true.

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$textHideous HTML input
Returns:
string Corrected HTML output

Definition at line 128 of file MWTidy.php.

Referenced by TidyTest\setUp(), and TidyTest\testTidyWrapping().


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