X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ftidy%2FRaggettWrapper.php;h=9f6feb8e55a55cd63bfa20b271479467cde53aed;hb=cf3deb6637cf4aab2678949e5ccec8084eec9907;hp=4759023fbf0710ed94d526dd395cace29eeb23fa;hpb=04fdc78370dbc042116488d6826e19bf3910273b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/tidy/RaggettWrapper.php b/includes/tidy/RaggettWrapper.php index 4759023fbf..9f6feb8e55 100644 --- a/includes/tidy/RaggettWrapper.php +++ b/includes/tidy/RaggettWrapper.php @@ -1,7 +1,6 @@ mTokens = null; - } - /** * @param string $text * @return string */ public function getWrapped( $text ) { - $this->mTokens = new ReplacementArray; + $this->mTokens = []; $this->mMarkerIndex = 0; // Replace elements with placeholders $wrappedtext = preg_replace_callback( ParserOutput::EDITSECTION_REGEX, - array( &$this, 'replaceCallback' ), $text ); + [ $this, 'replaceCallback' ], $text ); // ...and markers $wrappedtext = preg_replace_callback( '/\<\\/?mw:toc\>/', - array( &$this, 'replaceCallback' ), $wrappedtext ); + [ $this, 'replaceCallback' ], $wrappedtext ); // ... and tags $wrappedtext = preg_replace_callback( '/\/s', - array( &$this, 'replaceCallback' ), $wrappedtext ); + [ $this, 'replaceCallback' ], $wrappedtext ); // Modify inline Microdata and elements so they say and so // we can trick Tidy into not stripping them out by including them in tidy's new-empty-tags config $wrappedtext = preg_replace( '!<(link|meta)([^>]*?)(/{0,1}>)!', '([ \r\n\t\f]*)!", - '
  • \1
  • ', $wrappedtext ); + '
  • \1
  • ', $wrappedtext ); // Wrap the whole thing in a doctype and body for Tidy. $wrappedtext = 'mMarkerIndex}" . Parser::MARKER_SUFFIX; $this->mMarkerIndex++; - $this->mTokens->setPair( $marker, $m[0] ); + $this->mTokens[$marker] = $m[0]; return $marker; } @@ -88,7 +85,7 @@ class RaggettWrapper { $text = str_replace( '
  • mTokens->replace( $text ); + $text = strtr( $text, $this->mTokens ); return $text; }