MediaWiki REL1_31
RaggettBase.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Tidy;
4
5abstract class RaggettBase extends TidyDriverBase {
12 public function tidy( $text ) {
13 $wrapper = new RaggettWrapper;
14 $wrappedtext = $wrapper->getWrapped( $text );
15
16 $retVal = null;
17 $correctedtext = $this->cleanWrapped( $wrappedtext, false, $retVal );
18
19 if ( $retVal < 0 ) {
20 wfDebug( "Possible tidy configuration error!\n" );
21 return $text . "\n<!-- Tidy was unable to run -->\n";
22 } elseif ( is_null( $correctedtext ) ) {
23 wfDebug( "Tidy error detected!\n" );
24 return $text . "\n<!-- Tidy found serious XHTML errors -->\n";
25 }
26
27 $correctedtext = $wrapper->postprocess( $correctedtext ); // restore any hidden tokens
28
29 return $correctedtext;
30 }
31
32 public function validate( $text, &$errorStr ) {
33 $retval = 0;
34 $errorStr = $this->cleanWrapped( $text, true, $retval );
35 return ( $retval < 0 && $errorStr == '' ) || $retval == 0;
36 }
37
46 abstract protected function cleanWrapped( $text, $stderr = false, &$retval = null );
47}
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
cleanWrapped( $text, $stderr=false, &$retval=null)
Perform a clean/repair operation.
validate( $text, &$errorStr)
tidy( $text)
Generic interface for wrapping and unwrapping HTML for Dave Raggett's tidy.
Class used to hide mw:editsection tokens from Tidy so that it doesn't break them or break on them.
Base class for HTML cleanup utilities.
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 local account incomplete not yet checked for validity & $retval
Definition hooks.txt:266