which uses ipboptions
* (bug 4446) $wgExportAllowHistory option to explicitly disable history in
Special:Export form, 'exportnohistory' message to translate live hack.
+* (bug 4453) fix for __TOC__ dollar-number breakage
=== Caveats ===
wfDebugDieBacktrace( "MediaWiki $req_ver required--this is only $wgVersion" );
}
+/**
+ * Escape a string to make it suitable for inclusion in a preg_replace()
+ * replacement parameter.
+ *
+ * @param string $string
+ * @return string
+ */
+function wfRegexReplacement( $string ) {
+ $string = str_replace( '\\', '\\\\', $string );
+ $string = str_replace( '$', '\\$', $string );
+ return $string;
+}
+
?>
* Replaces the word with something else
*/
function replace( $replacement, $subject ) {
- $res = preg_replace( $this->getRegex(), $replacement, $subject );
+ $res = preg_replace( $this->getRegex(), wfRegexReplacement( $replacement ), $subject );
$this->mModified = !($res === $subject);
return $res;
}