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 String getAUICompatibleId(String html) {
072                    return getHtml().getAUICompatibleId(html);
073            }
074    
075            public static Html getHtml() {
076                    PortalRuntimePermission.checkGetBeanProperty(HtmlUtil.class);
077    
078                    return _html;
079            }
080    
081            public static String render(String html) {
082                    return getHtml().render(html);
083            }
084    
085            @Deprecated
086            public static String replaceMsWordCharacters(String html) {
087                    return getHtml().replaceMsWordCharacters(html);
088            }
089    
090            public static String replaceNewLine(String html) {
091                    return getHtml().replaceNewLine(html);
092            }
093    
094            public static String stripBetween(String html, String tag) {
095                    return getHtml().stripBetween(html, tag);
096            }
097    
098            public static String stripComments(String html) {
099                    return getHtml().stripComments(html);
100            }
101    
102            public static String stripHtml(String html) {
103                    return getHtml().stripHtml(html);
104            }
105    
106            public static String toInputSafe(String html) {
107                    return getHtml().toInputSafe(html);
108            }
109    
110            public static String unescape(String html) {
111                    return getHtml().unescape(html);
112            }
113    
114            public static String unescapeCDATA(String html) {
115                    return getHtml().unescapeCDATA(html);
116            }
117    
118            public static String wordBreak(String html, int columns) {
119                    return getHtml().wordBreak(html, columns);
120            }
121    
122            public void setHtml(Html html) {
123                    PortalRuntimePermission.checkSetBeanProperty(getClass());
124    
125                    _html = html;
126            }
127    
128            private static Html _html;
129    
130    }