- $text = ereg_replace("api\\.php\\?[^ \\()<\n\t]+", '<a href="\\0">\\0</a>', $text);
- // make strings inside * bold
- $text = ereg_replace("\\*[^<>\n]+\\*", '<b>\\0</b>', $text);
- // make strings inside $ italic
- $text = ereg_replace("\\$[^<>\n]+\\$", '<b><i>\\0</i></b>', $text);
+ $text = preg_replace( "#api\\.php\\?[^ \\()<\n\t]+#", '<a href="\\0">\\0</a>', $text );
+ if ( $this->mHelp ) {
+ // make strings inside * bold
+ $text = preg_replace( "#\\*[^<>\n]+\\*#", '<b>\\0</b>', $text );
+ // make strings inside $ italic
+ $text = preg_replace( "#\\$[^<>\n]+\\$#", '<b><i>\\0</i></b>', $text );
+ }
+
+ /**
+ * Temporary fix for bad links in help messages. As a special case,
+ * XML-escaped metachars are de-escaped one level in the help message
+ * for legibility. Should be removed once we have completed a fully-HTML
+ * version of the help message.
+ */
+ if ( $this->mUnescapeAmps ) {
+ $text = preg_replace( '/&(amp|quot|lt|gt);/', '&\1;', $text );
+ }