private static String[][] _singleToPairArray(String[] array) { String[][] pairArray = new String[array.length][2]; for (int i = 0; i < array.length; i++) { pairArray[i][0] = HtmlUtil.escape(array[i]); pairArray[i][1] = array[i]; } return pairArray; }
/** * @deprecated As of Wilberforce (7.0.x) */ @Deprecated protected String cleanContent(String content) { return StringUtil.shorten(HtmlUtil.extractText(content), 200); }
/** * 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); }
protected List<Node> getElementsByName(Document document, String name) { name = HtmlUtil.escapeXPathAttribute(name); XPath xPathSelector = _saxReader.createXPath( "//dynamic-element[@name=".concat( name ).concat( "]" )); return xPathSelector.selectNodes(document); }
content = HtmlUtil.stripHtml(articleDisplay.getDescription()); content = HtmlUtil.replaceNewLine(content); content = HtmlUtil.extractText(articleDisplay.getContent());
String text = dynamicContentElement.getText(); text = HtmlUtil.stripComments(text); text = HtmlUtil.stripHtml(text); text = text.trim();
@Override public String getSummary( PortletRequest portletRequest, PortletResponse portletResponse) { return HtmlUtil.stripHtml(_category.getDescription()); }
protected String getJSEscapedSpecialChars() { if (_jsEscapedSpecialChars == null) { _jsEscapedSpecialChars = HtmlUtil.escapeJS(getSpecialChars()); } return _jsEscapedSpecialChars; }
protected Element fetchMetadataEntry( Element parentElement, String entryName) { XPath xPathSelector = _saxReader.createXPath( "entry[@name=" + HtmlUtil.escapeXPathAttribute(entryName) + StringPool.CLOSE_BRACKET); return (Element)xPathSelector.selectSingleNode(parentElement); }
@Override public String getTitle(Locale locale) { return HtmlUtil.stripHtml(_rootMessage.getSubject()); }
@Override public String get(DDMFormFieldValue ddmFormFieldValue) { Value value = ddmFormFieldValue.getValue(); return StringUtil.replace( _HTML, new String[] {"[$DDM_FORM_FIELD_VALUE$]", "[$PREVIEW$]"}, new String[] { HtmlUtil.escapeJS(value.getString(locale)), LanguageUtil.get(locale, "preview") }); }
private String _formatText(String text) { return HtmlUtil.escape(text); }
protected String getValue( DDMFormFieldRenderingContext ddmFormFieldRenderingContext) { String value = String.valueOf( ddmFormFieldRenderingContext.getProperty("value")); if (ddmFormFieldRenderingContext.isViewMode()) { value = HtmlUtil.extractText(value); } return value; }
/** * Replaces all new lines or carriage returns with the <code><br /></code> * HTML tag. * * @param html the text * @return the converted text, or <code>null</code> if the HTML text is * <code>null</code> */ public static String replaceNewLine(String html) { return getHtml().replaceNewLine(html); }
private static Element _getElementByInstanceId( Document document, String instanceId) { if (Validator.isNull(instanceId)) { return null; } XPath xPathSelector = SAXReaderUtil.createXPath( "//dynamic-element[@instance-id=" + HtmlUtil.escapeXPathAttribute(instanceId) + "]"); List<Node> nodes = xPathSelector.selectNodes(document); if (nodes.size() == 1) { return (Element)nodes.get(0); } return null; }
private String _stripAndHighlight(String text) { text = StringUtil.replace( text, _HIGHLIGHT_TAGS, _ESCAPE_SAFE_HIGHLIGHTS); text = HtmlUtil.stripHtml(text); text = StringUtil.replace( text, _ESCAPE_SAFE_HIGHLIGHTS, _HIGHLIGHT_TAGS); return text; }
/** * Returns the HTML-escaped name of the navigation item's layout. * * @return the HTML-escaped name of the navigation item's layout */ public String getName() { return HtmlUtil.escape(getUnescapedName()); }
protected String getValueString( Value value, Locale locale, DDMFormFieldRenderingContext ddmFormFieldRenderingContext) { if (value == null) { return StringPool.BLANK; } String valueString = value.getString(locale); if (ddmFormFieldRenderingContext.isViewMode()) { valueString = HtmlUtil.extractText(valueString); } return valueString; }
/** * 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); }
sb.append(HtmlUtil.escapeXPathAttribute(uuid)); sb.append(HtmlUtil.escapeXPathAttribute(groupId));