psdi.util

Class RichText

  • java.lang.Object
    • psdi.util.RichText

  • Deprecated. 
    Use HTML

    public class RichText
    extends java.lang.Object
    Encapsulates functionality related to rich text including removing script elements that can pose a security risk and converting plain text to rich text.
    • Field Detail

      • RICH_TEXT_MARKER

        public static final java.lang.String RICH_TEXT_MARKER
        Deprecated. Use HTML.RICH_TEXT_MARKER
        Marker indicating that the value already contains rich text. If you change this value, be sure to change the corresponding constant defined in dojo_library.js.
        See Also:
        Constant Field Values
    • Method Detail

      • cleanValue

        public static java.lang.String cleanValue(java.lang.String value,
                                                  boolean escapeForJavascript,
                                                  boolean escapeForHtmlAttrib,
                                                  boolean escapeCDATA)
        If the value is html, removes all Javascript and embedded objects, if it is text, it converts it to html
        Parameters:
        escapeForJavascript - true to escape special so the string can be used in javascript
        escapeForHtmlAttrib - true to encode special characters as character or entity references so the string can be used in an html attribute
        escapeCDATA - true to escape CDATA blocks so that the value can be placed in a CDATA block
      • isHtml

        public static boolean isHtml(java.lang.String value)
        Deprecated. Use HTML.isHtml(String)
        Determine if the given string is html
        Parameters:
        value - the string to evaluate
        Returns:
        true if the value looks like it is html
      • toPlainText

        public static java.lang.String toPlainText(java.lang.String html,
                                                   boolean escapeForHtmlAttribute)
      • cleanText

        public static java.lang.String cleanText(java.lang.String text,
                                                 boolean escapeForJavascript)
        Plain text, need to add line breaks, and escape characters for javascript
        Parameters:
        text - the text to be cleaned up
        escapeForJavascript - True if newlines and quotes should be escaped so the resultant string can be used as-is in a javascript string.
        Returns:
        a cleaned up version of the text
      • cleanHtml

        public static java.lang.String cleanHtml(java.lang.String html,
                                                 boolean escapeForJavascript,
                                                 boolean escapeForHtmlAttribute,
                                                 boolean escapeCDATA)
        Escape values and remove script, object, and embed tags and script from attributes
        Parameters:
        html - the original html string
        Returns:
        the cleaned string