MediaWiki REL1_32
RaggettBase.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Tidy;
4
6
10abstract class RaggettBase extends TidyDriverBase {
11
12 function __construct( $config ) {
13 parent::__construct( $config );
14
15 // All tidy modes other than remex are deprecated.
16 wfDeprecated( __METHOD__, '1.32' );
17 }
18
25 public function tidy( $text ) {
26 $wrapper = new RaggettWrapper;
27 $wrappedtext = $wrapper->getWrapped( $text );
28
29 $retVal = null;
30 $correctedtext = $this->cleanWrapped( $wrappedtext, false, $retVal );
31
32 if ( $retVal < 0 ) {
33 wfDebug( "Possible tidy configuration error!\n" );
34 return $text . "\n<!-- Tidy was unable to run -->\n";
35 } elseif ( is_null( $correctedtext ) ) {
36 wfDebug( "Tidy error detected!\n" );
37 return $text . "\n<!-- Tidy found serious XHTML errors -->\n";
38 }
39
40 $correctedtext = $wrapper->postprocess( $correctedtext ); // restore any hidden tokens
41
42 return $correctedtext;
43 }
44
45 public function validate( $text, &$errorStr ) {
46 $retval = 0;
47 $errorStr = $this->cleanWrapped( $text, true, $retval );
48 return ( $retval < 0 && $errorStr == '' ) || $retval == 0;
49 }
50
59 abstract protected function cleanWrapped( $text, $stderr = false, &$retval = null );
60}
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
MediaWiki exception.
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