From: Brion Vibber Date: Wed, 19 Sep 2007 14:51:02 +0000 (+0000) Subject: Tweak it up a little more -- also unescape the double-escaped quotes and angle bracke... X-Git-Tag: 1.31.0-rc.0~51357 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=commitdiff_plain;h=a7c34c4c51a8501385fd6953e0715657a2de3611;p=lhc%2Fweb%2Fwiklou.git 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. --- 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; }