|
Author: lektran
Date: Fri Jan 22 19:11:27 2010 New Revision: 902228 URL: http://svn.apache.org/viewvc?rev=902228&view=rev Log: Removed deprecated method StringUtil.htmlSpecialChars(String, boolean, boolean, boolean), there was an undeprecated overloaded method (StringUtil.htmlSpecialChars(String)) calling this method so I've moved the implementation to it and marked it as deprecated. Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java?rev=902228&r1=902227&r2=902228&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java Fri Jan 22 19:11:27 2010 @@ -598,13 +598,12 @@ * Translates various HTML characters in a string so that the string can be displayed in a browser safely * <p> * This function is useful in preventing user-supplied text from containing HTML markup, such as in a message board or - * guest book application. The optional arguments doubleQuotes and singleQuotes allow the control of the substitution of - * the quote characters. The default is to translate them with the HTML equivalent. + * guest book application. * </p> * The translations performed are: <ol> * <li>'&' (ampersand) becomes '&' - * <li>'"' (double quote) becomes '"' when doubleQuotes is true. - * <li>''' (single quote) becomes ''' when singleQuotes is true. + * <li>'"' (double quote) becomes '"' + * <li>''' (single quote) becomes ''' * <li>'<' (less than) becomes '<' * <li>'>' (greater than) becomes '>' * <li>\n (Carriage Return) becomes '<br>gt;' @@ -613,27 +612,17 @@ * @deprecated Use StringUtil.htmlEncoder instead. */ @Deprecated - public static String htmlSpecialChars(String html, boolean doubleQuotes, boolean singleQuotes, boolean insertBR) { + public static String htmlSpecialChars(String html) { html = StringUtil.replaceString(html, "&", "&"); html = StringUtil.replaceString(html, "<", "<"); html = StringUtil.replaceString(html, ">", ">"); - if (doubleQuotes) { - html = StringUtil.replaceString(html, "\"", """); - } - if (singleQuotes) { - html = StringUtil.replaceString(html, "'", "'"); - } - if (insertBR) { - html = StringUtil.replaceString(html, "\n", "<br>"); - } + html = StringUtil.replaceString(html, "\"", """); + html = StringUtil.replaceString(html, "'", "'"); + html = StringUtil.replaceString(html, "\n", "<br>"); return html; } - public static String htmlSpecialChars(String html) { - return htmlSpecialChars(html, true, true, true); - } - /** * Remove/collapse multiple newline characters * |
| Free forum by Nabble | Edit this page |
