001    /**
002     * Copyright (c) 2000-2011 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    /**
018     * @author Brian Wing Shun Chan
019     * @author Clarence Shen
020     * @author Harry Mark
021     * @author Samuel Kong
022     */
023    public class HtmlUtil {
024    
025            public static String escape(String html) {
026                    return getHtml().escape(html);
027            }
028    
029            public static String escape(String html, int mode) {
030                    return getHtml().escape(html, mode);
031            }
032    
033            public static String escapeAttribute(String attribute) {
034                    return getHtml().escapeAttribute(attribute);
035            }
036    
037            public static String escapeCSS(String css) {
038                    return getHtml().escapeCSS(css);
039            }
040    
041            public static String escapeHREF(String href) {
042                    return getHtml().escapeHREF(href);
043            }
044    
045            public static String escapeJS(String js) {
046                    return getHtml().escapeJS(js);
047            }
048    
049            public static String escapeURL(String url) {
050                    return getHtml().escapeURL(url);
051            }
052    
053            public static String extractText(String html) {
054                    return getHtml().extractText(html);
055            }
056    
057            public static String fromInputSafe(String html) {
058                    return getHtml().fromInputSafe(html);
059            }
060    
061            public static Html getHtml() {
062                    return _html;
063            }
064    
065            public static String replaceMsWordCharacters(String html) {
066                    return getHtml().replaceMsWordCharacters(html);
067            }
068    
069            public static String stripBetween(String html, String tag) {
070                    return getHtml().stripBetween(html, tag);
071            }
072    
073            public static String stripComments(String html) {
074                    return getHtml().stripComments(html);
075            }
076    
077            public static String stripHtml(String html) {
078                    return getHtml().stripHtml(html);
079            }
080    
081            public static String toInputSafe(String html) {
082                    return getHtml().toInputSafe(html);
083            }
084    
085            public static String unescape(String html) {
086                    return getHtml().unescape(html);
087            }
088    
089            public static String wordBreak(String html, int columns) {
090                    return getHtml().wordBreak(html, columns);
091            }
092    
093            public void setHtml(Html html) {
094                    _html = html;
095            }
096    
097            private static Html _html;
098    
099    }