X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/includes/tidy/RaggettInternalPHP.php diff --git a/includes/tidy/RaggettInternalPHP.php b/includes/tidy/RaggettInternalPHP.php new file mode 100644 index 00000000..e5642d9e --- /dev/null +++ b/includes/tidy/RaggettInternalPHP.php @@ -0,0 +1,52 @@ +parseString( $text, $this->config['tidyConfigFile'], 'utf8' ); + + if ( $stderr ) { + $retval = $tidy->getStatus(); + return $tidy->errorBuffer; + } + + $tidy->cleanRepair(); + $retval = $tidy->getStatus(); + if ( $retval == 2 ) { + // 2 is magic number for fatal error + // https://secure.php.net/manual/en/tidy.getstatus.php + $cleansource = null; + } else { + $cleansource = tidy_get_output( $tidy ); + if ( !empty( $this->config['debugComment'] ) && $retval > 0 ) { + $cleansource .= "', '-->', $tidy->errorBuffer ) . + "\n-->"; + } + } + + return $cleansource; + } + + public function supportsValidate() { + return true; + } +}