Example usage for com.liferay.portal.kernel.util HtmlUtil escape

List of usage examples for com.liferay.portal.kernel.util HtmlUtil escape

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util HtmlUtil escape.

Prototype

@Deprecated
public static String escape(String text, int mode) 

Source Link

Document

Escapes the input text as a hexadecimal value, based on the mode (type).

Usage

From source file:com.liferay.so.activities.hook.social.CalendarActivityInterpreter.java

License:Open Source License

protected String getBody(String className, long classPK, ServiceContext serviceContext) throws Exception {

    StringBundler sb = new StringBundler(15);

    sb.append("<div class=\"activity-body\"><div class=\"title\">");
    sb.append(getPageTitle(className, classPK, serviceContext));
    sb.append("</div><div class=\"date\"><strong>");
    sb.append(serviceContext.translate("date"));
    sb.append(": </strong>");

    Format dateFormatDate = FastDateFormatFactoryUtil.getDateTime(DateFormat.FULL, DateFormat.SHORT,
            serviceContext.getLocale(), serviceContext.getTimeZone());

    CalendarBooking calendarBooking = CalendarBookingLocalServiceUtil.fetchCalendarBooking(classPK);

    sb.append(dateFormatDate.format(calendarBooking.getStartTime()));

    sb.append("</div><div class=\"location\"><strong>");
    sb.append(serviceContext.translate("location"));
    sb.append(": </strong>");
    sb.append(calendarBooking.getLocation());
    sb.append("</div><div class=\"description\"><strong>");
    sb.append(serviceContext.translate("description"));
    sb.append(": </strong>");

    AssetRenderer assetRenderer = getAssetRenderer(className, classPK);

    sb.append(StringUtil.shorten(HtmlUtil.escape(assetRenderer.getSummary(), 200)));

    sb.append("</div></div>");

    return sb.toString();
}

From source file:com.liferay.so.activities.hook.social.DLActivityInterpreter.java

License:Open Source License

protected String getBody(String className, long classPK, ServiceContext serviceContext) throws Exception {

    StringBundler sb = new StringBundler(11);

    sb.append("<div class=\"activity-body document\">");
    sb.append("<span class=\"document-thumbnail\"><img src=\"");

    FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(classPK);

    FileVersion fileVersion = fileEntry.getFileVersion();

    String thumbnailSrc = DLUtil.getThumbnailSrc(fileEntry, fileVersion, null,
            serviceContext.getThemeDisplay());

    sb.append(thumbnailSrc);//  w w w .  j  a  v  a2s  .  c o  m
    sb.append("\"></span>");
    sb.append("<div class=\"document-container\"><div class=\"title\">");
    sb.append(getPageTitle(className, classPK, serviceContext));
    sb.append("</div><div class=\"version\">");
    sb.append(serviceContext.translate("version-x", fileVersion.getVersion()));
    sb.append("</div><div class=\"document-content\">");

    AssetRenderer assetRenderer = getAssetRenderer(className, classPK);

    sb.append(StringUtil.shorten(HtmlUtil.escape(assetRenderer.getSummary(), 200)));

    sb.append("</div></div></div>");

    return sb.toString();
}

From source file:com.liferay.so.activities.hook.social.WikiActivityInterpreter.java

License:Open Source License

protected String getBody(String className, long classPK, ServiceContext serviceContext) throws Exception {

    StringBundler sb = new StringBundler(5);

    sb.append("<div class=\"activity-body\"><div class=\"title\">");
    sb.append(getPageTitle(className, classPK, serviceContext));
    sb.append("</div><div class=\"wiki-page-content\">");

    AssetRenderer assetRenderer = getAssetRenderer(className, classPK);

    sb.append(StringUtil.shorten(HtmlUtil.escape(assetRenderer.getSummary(), 200)));

    sb.append("</div></div>");

    return sb.toString();
}