From a1789ddde42033f1b05cc4929491214ee6e79383 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 17 Dec 2015 09:15:42 +0100 Subject: Update to MediaWiki 1.26.0 --- includes/tidy/RaggettBase.php | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 includes/tidy/RaggettBase.php (limited to 'includes/tidy/RaggettBase.php') diff --git a/includes/tidy/RaggettBase.php b/includes/tidy/RaggettBase.php new file mode 100644 index 00000000..a3717b2b --- /dev/null +++ b/includes/tidy/RaggettBase.php @@ -0,0 +1,47 @@ +getWrapped( $text ); + + $retVal = null; + $correctedtext = $this->cleanWrapped( $wrappedtext, false, $retVal ); + + if ( $retVal < 0 ) { + wfDebug( "Possible tidy configuration error!\n" ); + return $text . "\n\n"; + } elseif ( is_null( $correctedtext ) ) { + wfDebug( "Tidy error detected!\n" ); + return $text . "\n\n"; + } + + $correctedtext = $wrapper->postprocess( $correctedtext ); // restore any hidden tokens + + return $correctedtext; + } + + public function validate( $text, &$errorStr ) { + $retval = 0; + $errorStr = $this->cleanWrapped( $text, true, $retval ); + return ( $retval < 0 && $errorStr == '' ) || $retval == 0; + } + + /** + * Perform a clean/repair operation + * @param string $text HTML to check + * @param bool $stderr Whether to read result from STDERR rather than STDOUT + * @param int &$retval Exit code (-1 on internal error) + * @return null|string + * @throws MWException + */ + abstract protected function cleanWrapped( $text, $stderr = false, &$retval = null ); +} -- cgit v1.2.3-54-g00ecf