MWTidy Class Reference
[Parser]

Class to interact with HTML tidy. More...

List of all members.

Static Public Member Functions

static tidy ($text)
 Interface with html tidy, used if $wgUseTidy = true.
static checkErrors ($text, &$errorStr=null)
 Check HTML for errors, used if $wgValidateAllHtml = 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 PECL 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 12 of file Tidy.php.


Member Function Documentation

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

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

Parameters:
$text String
&$errorStr String: return the error string
Returns:
Boolean: whether the HTML is valid

Definition at line 55 of file Tidy.php.

References $text, $wgTidyInternal, execExternalTidy(), and execInternalTidy().

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:
$text String: HTML to check
$stderr Boolean: Whether to read from STDERR rather than STDOUT
&$retval Exit code (-1 on internal error) mixed String or null

Definition at line 76 of file Tidy.php.

References $stderr, $text, $wgTidyBin, $wgTidyConf, $wgTidyOpts, wfGetNull(), wfProfileIn(), and wfProfileOut().

Referenced by checkErrors(), and tidy().

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

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

'pear install tidy' should be able to compile the extension module.

Definition at line 139 of file Tidy.php.

References $IP, $stderr, $text, $wgDebugTidy, $wgTidyConf, tidy(), wfProfileIn(), and wfProfileOut().

Referenced by checkErrors(), and tidy().

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

Definition at line 22 of file Tidy.php.

References $text, $wgTidyInternal, execExternalTidy(), execInternalTidy(), and wfDebug().

Referenced by execInternalTidy().


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

Generated on Sat Sep 5 02:08:43 2009 for MediaWiki by  doxygen 1.5.9