Go to the documentation of this file.
48 $this->mTokens =
null;
49 $this->mUniqPrefix =
null;
58 $this->mUniqPrefix =
"\x7fUNIQ" .
59 dechex( mt_rand( 0, 0x7fffffff ) ) . dechex( mt_rand( 0, 0x7fffffff ) );
60 $this->mMarkerIndex = 0;
64 array( &$this,
'replaceCallback' ), $text );
66 $wrappedtext = preg_replace_callback(
'/<\\/?mw:toc>/',
67 array( &$this,
'replaceCallback' ), $wrappedtext );
71 $wrappedtext = preg_replace(
'!<(link|meta)([^>]*?)(/{0,1}>)!',
'<html-$1$2$3', $wrappedtext );
74 $wrappedtext =
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"' .
75 ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>' .
76 '<head><title>test</title></head><body>' . $wrappedtext .
'</body></html>';
87 $marker =
"{$this->mUniqPrefix}-item-{$this->mMarkerIndex}" . Parser::MARKER_SUFFIX;
88 $this->mMarkerIndex++;
89 $this->mTokens->setPair( $marker, $m[0] );
99 $text = preg_replace(
'!<html-(link|meta)([^>]*?)(/{0,1}>)!',
'<$1$2$3', $text );
102 $text = $this->mTokens->replace( $text );
127 public static function tidy( $text ) {
134 if ( $wgTidyInternal ) {
141 wfDebug(
"Possible tidy configuration error!\n" );
142 return $text .
"\n<!-- Tidy was unable to run -->\n";
143 } elseif ( is_null( $correctedtext ) ) {
144 wfDebug(
"Tidy error detected!\n" );
145 return $text .
"\n<!-- Tidy found serious XHTML errors -->\n";
148 $correctedtext = $wrapper->postprocess( $correctedtext );
150 return $correctedtext;
160 public static function checkErrors( $text, &$errorStr =
null ) {
164 if ( $wgTidyInternal ) {
183 global $wgTidyConf, $wgTidyBin, $wgTidyOpts;
190 $descriptorspec =
array(
191 0 =>
array(
'pipe',
'r' ),
193 2 =>
array(
'pipe',
'w' )
196 $descriptorspec =
array(
197 0 =>
array(
'pipe',
'r' ),
198 1 =>
array(
'pipe',
'w' ),
203 $readpipe = $stderr ? 2 : 1;
206 $process = proc_open(
207 "$wgTidyBin -config $wgTidyConf $wgTidyOpts$opts", $descriptorspec, $pipes );
212 if ( is_resource( $process ) ) {
218 fwrite( $pipes[0], $text );
220 while ( !feof( $pipes[$readpipe] ) ) {
221 $cleansource .= fgets( $pipes[$readpipe], 1024 );
223 fclose( $pipes[$readpipe] );
224 $retval = proc_close( $process );
226 wfWarn(
"Unable to start external tidy process" );
230 if ( !$stderr && $cleansource ==
'' && $text !=
'' ) {
250 global $wgTidyConf, $wgDebugTidy;
253 if ( !class_exists(
'tidy' ) ) {
254 wfWarn(
"Unable to load internal tidy class." );
262 $tidy->parseString( $text, $wgTidyConf,
'utf8' );
268 return $tidy->errorBuffer;
271 $tidy->cleanRepair();
278 $cleansource = tidy_get_output( $tidy );
279 if ( $wgDebugTidy &&
$retval > 0 ) {
280 $cleansource .=
"<!--\nTidy reports:\n" .
281 str_replace(
'-->',
'-->', $tidy->errorBuffer ) .
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
ReplacementArray $mTokens
wfProfileIn( $functionname)
Begin profiling of a function.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
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...
Class to interact with HTML tidy.
when a variable name is used in a it is silently declared as a new masking the global
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Replacement array for FSS with fallback to strtr() Supports lazy initialisation of FSS resource.
static execExternalTidy( $text, $stderr=false, &$retval=null)
Spawn an external HTML tidy process and get corrected markup back from it.
Class used to hide mw:editsection tokens from Tidy so that it doesn't break them or break on them.
wfGetNull()
Get a platform-independent path to the null file, e.g.
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
static checkErrors( $text, &$errorStr=null)
Check HTML for errors, used if $wgValidateAllHtml = true.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account incomplete not yet checked for validity & $retval
static tidy( $text)
Interface with html tidy, used if $wgUseTidy = true.