*/
protected $mTokens;
- protected $mUniqPrefix;
-
protected $mMarkerIndex;
public function __construct() {
$this->mTokens = null;
- $this->mUniqPrefix = null;
}
/**
*/
public function getWrapped( $text ) {
$this->mTokens = new ReplacementArray;
- $this->mUniqPrefix = "\x7fUNIQ" .
- dechex( mt_rand( 0, 0x7fffffff ) ) . dechex( mt_rand( 0, 0x7fffffff ) );
$this->mMarkerIndex = 0;
// Replace <mw:editsection> elements with placeholders
* @return string
*/
public function replaceCallback( $m ) {
- $marker = "{$this->mUniqPrefix}-item-{$this->mMarkerIndex}" . Parser::MARKER_SUFFIX;
+ $marker = Parser::MARKER_PREFIX . "-item-{$this->mMarkerIndex}" . Parser::MARKER_SUFFIX;
$this->mMarkerIndex++;
$this->mTokens->setPair( $marker, $m[0] );
return $marker;
*/
private static function externalClean( $text, $stderr = false, &$retval = null ) {
global $wgTidyConf, $wgTidyBin, $wgTidyOpts;
- wfProfileIn( __METHOD__ );
$cleansource = '';
$opts = ' -utf8';
$cleansource = null;
}
- wfProfileOut( __METHOD__ );
return $cleansource;
}
*/
private static function phpClean( $text, $stderr = false, &$retval = null ) {
global $wgTidyConf, $wgDebugTidy;
- wfProfileIn( __METHOD__ );
if ( ( !wfIsHHVM() && !class_exists( 'tidy' ) ) ||
( wfIsHHVM() && !function_exists( 'tidy_repair_string' ) )
wfWarn( "Unable to load internal tidy class." );
$retval = -1;
- wfProfileOut( __METHOD__ );
return null;
}
if ( $stderr ) {
$retval = $tidy->getStatus();
-
- wfProfileOut( __METHOD__ );
return $tidy->errorBuffer;
}
}
}
- wfProfileOut( __METHOD__ );
return $cleansource;
}
*/
private static function hhvmClean( $text, &$retval ) {
global $wgTidyConf;
- wfProfileIn( __METHOD__ );
+
$cleansource = tidy_repair_string( $text, $wgTidyConf, 'utf8' );
if ( $cleansource === false ) {
$cleansource = null;
} else {
$retval = 0;
}
- wfProfileOut( __METHOD__ );
+
return $cleansource;
}
}