From a7c34c4c51a8501385fd6953e0715657a2de3611 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 19 Sep 2007 14:51:02 +0000 Subject: [PATCH] Tweak it up a little more -- also unescape the double-escaped quotes and angle brackets to keep the help message legible, but move unescaping down below the XML metaformatting, so the mail samples don't get misformatted as if they were XML elements. --- includes/api/ApiFormatBase.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 6cfbfb174e..dc5b7444f7 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -172,13 +172,6 @@ See complete documentation, or protected function formatHTML($text) { // Escape everything first for full coverage $text = htmlspecialchars($text); - - /* Temporary fix for bad links in help messages. As a special case, XML-escaped - * ampersands 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 = str_replace( '&amp;', '&', $text ); // encode all comments or tags as safe blue strings $text = preg_replace('/\<(!--.*?--|.*?)\>/', '<\1>', $text); @@ -191,6 +184,13 @@ See complete documentation, or $text = ereg_replace("\\*[^<>\n]+\\*", '\\0', $text); // make strings inside $ italic $text = ereg_replace("\\$[^<>\n]+\\$", '\\0', $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 ); return $text; } -- 2.20.1