001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.util;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    
019    /**
020     * @author Brian Wing Shun Chan
021     * @author Clarence Shen
022     * @author Harry Mark
023     * @author Samuel Kong
024     */
025    public class HtmlUtil {
026    
027            public static String escape(String html) {
028                    return getHtml().escape(html);
029            }
030    
031            public static String escape(String html, int mode) {
032                    return getHtml().escape(html, mode);
033            }
034    
035            public static String escapeAttribute(String attribute) {
036                    return getHtml().escapeAttribute(attribute);
037            }
038    
039            public static String escapeCSS(String css) {
040                    return getHtml().escapeCSS(css);
041            }
042    
043            public static String escapeHREF(String href) {
044                    return getHtml().escapeHREF(href);
045            }
046    
047            public static String escapeJS(String js) {
048                    return getHtml().escapeJS(js);
049            }
050    
051            public static String escapeURL(String url) {
052                    return getHtml().escapeURL(url);
053            }
054    
055            public static String escapeXPath(String xPath) {
056                    return getHtml().escapeXPath(xPath);
057            }
058    
059            public static String escapeXPathAttribute(String xPathAttribute) {
060                    return getHtml().escapeXPathAttribute(xPathAttribute);
061            }
062    
063            public static String extractText(String html) {
064                    return getHtml().extractText(html);
065            }
066    
067            public static String fromInputSafe(String html) {
068                    return getHtml().fromInputSafe(html);
069            }
070    
071            public static Html getHtml() {
072                    PortalRuntimePermission.checkGetBeanProperty(HtmlUtil.class);
073    
074                    return _html;
075            }
076    
077            public static String render(String html) {
078                    return getHtml().render(html);
079            }
080    
081            public static String replaceMsWordCharacters(String html) {
082                    return getHtml().replaceMsWordCharacters(html);
083            }
084    
085            public static String stripBetween(String html, String tag) {
086                    return getHtml().stripBetween(html, tag);
087            }
088    
089            public static String stripComments(String html) {
090                    return getHtml().stripComments(html);
091            }
092    
093            public static String stripHtml(String html) {
094                    return getHtml().stripHtml(html);
095            }
096    
097            public static String toInputSafe(String html) {
098                    return getHtml().toInputSafe(html);
099            }
100    
101            public static String unescape(String html) {
102                    return getHtml().unescape(html);
103            }
104    
105            public static String unescapeCDATA(String html) {
106                    return getHtml().unescapeCDATA(html);
107            }
108    
109            public static String wordBreak(String html, int columns) {
110                    return getHtml().wordBreak(html, columns);
111            }
112    
113            public void setHtml(Html html) {
114                    PortalRuntimePermission.checkSetBeanProperty(getClass());
115    
116                    _html = html;
117            }
118    
119            private static Html _html;
120    
121    }