+ return $cleansource;
+ }
+
+ /**
+ * Use the tidy extension for HHVM from
+ * https://github.com/wikimedia/mediawiki-php-tidy
+ *
+ * This currently does not support the object-oriented interface, but
+ * tidy_repair_string() can be used for the most common tasks.
+ *
+ * @param string $text HTML to check
+ * @param int &$retval Exit code (-1 on internal error)
+ * @return string|null
+ */
+ private static function hhvmClean( $text, &$retval ) {
+ global $wgTidyConf;
+
+ $cleansource = tidy_repair_string( $text, $wgTidyConf, 'utf8' );
+ if ( $cleansource === false ) {
+ $cleansource = null;
+ $retval = -1;
+ } else {
+ $retval = 0;
+ }
+