3 namespace MediaWiki\Tidy
;
6 * @deprecated since 1.32, use RemexDriver
8 class RaggettInternalPHP
extends RaggettBase
{
10 * Use the HTML tidy extension to use the tidy library in-process,
11 * saving the overhead of spawning a new process.
13 * @param string $text HTML to check
14 * @param bool $stderr Whether to read result from error status instead of output
15 * @param int|null &$retval Exit code (-1 on internal error)
18 protected function cleanWrapped( $text, $stderr = false, &$retval = null ) {
19 if ( !class_exists( 'tidy' ) ) {
20 wfWarn( "Unable to load internal tidy class." );
27 $tidy->parseString( $text, $this->config
['tidyConfigFile'], 'utf8' );
30 $retval = $tidy->getStatus();
31 return $tidy->errorBuffer
;
35 $retval = $tidy->getStatus();
37 // 2 is magic number for fatal error
38 // https://secure.php.net/manual/en/tidy.getstatus.php
41 $cleansource = tidy_get_output( $tidy );
42 if ( !empty( $this->config
['debugComment'] ) && $retval > 0 ) {
43 $cleansource .= "<!--\nTidy reports:\n" .
44 str_replace( '-->', '-->', $tidy->errorBuffer
) .
52 public function supportsValidate() {