/** * Escapes the input text as a hexadecimal value, based on the mode (type). * * @param text the text to escape * @param mode the encoding type * @return the escaped hexadecimal value of the input text, based on the * mode, or <code>null</code> if the text is <code>null</code> * @see com.liferay.portal.util.HtmlImpl#escape(String, int) */ public static String escape(String text, int mode) { return getHtml().escape(text, mode); }
public static String unescape(String text) { return getHtml().unescape(text); }
/** * Extracts the raw text from the HTML input, compressing its whitespace and * removing all attributes, scripts, and styles. * * <p> * For example, raw text returned by this method can be stored in a search * index. * </p> * * @param html the HTML text * @return the raw text from the HTML input, or <code>null</code> if the * HTML input is <code>null</code> */ public static String extractText(String html) { return getHtml().extractText(html); }
protected String getFileEntryURL( HttpServletRequest request, FileEntry fileEntry) { if (fileEntry == null) { return StringPool.BLANK; } StringBundler sb = new StringBundler(9); ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute( WebKeys.THEME_DISPLAY); sb.append(themeDisplay.getPathContext()); sb.append("/documents/"); sb.append(fileEntry.getRepositoryId()); sb.append(StringPool.SLASH); sb.append(fileEntry.getFolderId()); sb.append(StringPool.SLASH); sb.append( URLCodec.encodeURL(html.unescape(fileEntry.getTitle()), true)); sb.append(StringPool.SLASH); sb.append(fileEntry.getUuid()); return html.escape(sb.toString()); }
/** * Strips all XML comments out of the text. * * @param text the text * @return the text, without the stripped XML comments, or <code>null</code> * if the text is <code>null</code> */ public static String stripComments(String text) { return getHtml().stripComments(text); }
/** * Replaces all Microsoft® Word Unicode characters with plain HTML * entities or characters. * * @param text the text * @return the converted text, or <code>null</code> if the text is * <code>null</code> * @deprecated As of Wilberforce (7.0.x), with no direct replacement */ @Deprecated public static String replaceMsWordCharacters(String text) { return getHtml().replaceMsWordCharacters(text); }
public static String fromInputSafe(String text) { return getHtml().fromInputSafe(text); }
public static String stripHtml(String text) { return getHtml().stripHtml(text); }
/** * Encodes the text so that it's safe to use as an HTML input field value. * * <p> * For example, the <code>&</code> character is replaced by * <code>&amp;</code>. * </p> * * @param text the text * @return the encoded text that is safe to use as an HTML input field * value, or <code>null</code> if the text is <code>null</code> */ public static String toInputSafe(String text) { return getHtml().toInputSafe(text); }
/** * Strips all content delimited by the tag out of the text. * * <p> * If the tag appears multiple times, all occurrences (including the tag) * are stripped. The tag may have attributes. In order for this method to * recognize the tag, it must consist of a separate opening and closing tag. * Self-closing tags remain in the result. * </p> * * @param text the text * @param tag the tag used for delimiting, which should only be the tag's * name (e.g. no <) * @return the text, without the stripped tag and its contents, or * <code>null</code> if the text is <code>null</code> */ public static String stripBetween(String text, String tag) { return getHtml().stripBetween(text, tag); }
public static String stripComments(String html) { return getHtml().stripComments(html); }
public static String replaceMsWordCharacters(String html) { return getHtml().replaceMsWordCharacters(html); }
public static String fromInputSafe(String html) { return getHtml().fromInputSafe(html); }
public static String stripHtml(String html) { return getHtml().stripHtml(html); }
public static String toInputSafe(String html) { return getHtml().toInputSafe(html); }
public static String stripBetween(String html, String tag) { return getHtml().stripBetween(html, tag); }
/** * Escapes the text so that it is safe to use in an HTML context. * * @param text the text to escape * @return the escaped HTML text, or <code>null</code> if the text is * <code>null</code> */ public static String escape(String text) { return getHtml().escape(text); }
public static String unescape(String html) { return getHtml().unescape(html); }
public static String extractText(String html) { return getHtml().extractText(html); }
protected String getFileEntryTitle(FileEntry fileEntry) { if (fileEntry == null) { return StringPool.BLANK; } return html.escape(fileEntry.getTitle()); }