亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? filterprofanity.java

?? Jvie論壇的程序
?? JAVA
字號:
/**
 * Copyright (C) 2001 Yasna.com. All rights reserved.
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        Yasna.com (http://www.yasna.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Yazd" and "Yasna.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact yazd@yasna.com.
 *
 * 5. Products derived from this software may not be called "Yazd",
 *    nor may "Yazd" appear in their name, without prior written
 *    permission of Yasna.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL YASNA.COM OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of Yasna.com. For more information
 * on Yasna.com, please see <http://www.yasna.com>.
 */

/**
 * Copyright (C) 2000 CoolServlets.com. All rights reserved.
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        CoolServlets.com (http://www.coolservlets.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Jive" and "CoolServlets.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact webmaster@coolservlets.com.
 *
 * 5. Products derived from this software may not be called "Jive",
 *    nor may "Jive" appear in their name, without prior written
 *    permission of CoolServlets.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL COOLSERVLETS.COM OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CoolServlets.com. For more information
 * on CoolServlets.com, please see <http://www.coolservlets.com>.
 */

package com.Yasna.forum.filter;

import java.util.*;

import com.Yasna.forum.*;

/**
 * A ForumMessageFilter that replaces profanity.
 */
public class FilterProfanity extends ForumMessageFilter {

    /**
     * Array of all the bad words to filter.
     */
    private String [] filterList;

    /**
     * Indicates if case of words should be ignored.
     */
    private boolean ignoreCase = true;

    /**
     * Property values of the filter.
     */
    private Properties props;

    /**
     * Property descriptions of the filter.
     */
    private Properties propDescriptions;

    /**
     * Creates a new filter not associated with a message. This is
     * generally only useful for defining a template filter that other
     * fitlers will be cloned from.
     */
    public FilterProfanity() {
        super();
        this.props = new Properties();
        this.propDescriptions = new Properties();
        initializeProperties();
    }

    /**
     * Creates a new filter wrapped around the specified message. This
     * constructor is normally called when cloning a filter template.
     *
     * @param message the ForumMessage to wrap the new filter around.
     * @param properties the property values for the filter.
     * @param propertyDescriptions the property descriptions for the filter.
     */
    public FilterProfanity(ForumMessage message, Properties props,
            Properties propDescriptions, String [] filterList, boolean ignoreCase)
    {
        super(message);
        this.props = new Properties(props);
        this.propDescriptions = new Properties(propDescriptions);
        this.filterList = filterList;
        this.ignoreCase = ignoreCase;
    }

    /**
     * Clones a new filter that will have the same properties and that
     * will wrap around the specified message.
     *
     * @param message the ForumMessage to wrap the new filter around.
     */
    public ForumMessageFilter clone(ForumMessage message){
        return new FilterProfanity(message, props, propDescriptions,
                filterList, ignoreCase);
    }

    /**
     * Returns the name of the filter.
     */
    public String getName() {
        return "Profanity Filter";
    }

    /**
     * Returns a description of the filter.
     */
    public String getDescription() {
        return "Removes profanity from messages using a custom word list.";
    }

    /**
     * Returns the author of the filter.
     */
    public String getAuthor() {
        return "CoolServlets.com";
    }

    /**
     * Returns the major version number of the filter.
     */
    public int getMajorVersion() {
        return 1;
    }

    /**
     * Returns the minor version number of the filter.
     */
    public int getMinorVersion() {
        return 0;
    }

    /**
     * Returns the value of a property of the filter.
     *
     * @param name the name of the property.
     * @returns the value of the property.
     */
    public String getFilterProperty(String name) {
        return props.getProperty(name);
    }

    /**
     * Returns the description of a property of the filter.
     *
     * @param name the name of the property.
     * @return the description of the property.
     */
    public String getFilterPropertyDescription(String name) {
        return propDescriptions.getProperty(name);
    }

    /**
     * Returns an Enumeration of all the property names.
     */
    public Enumeration filterPropertyNames() {
        return props.propertyNames();
    }

    /**
     * Sets a property of the filter. Each filter has a set number of
     * properties that are determined by the filter author.
     *
     * @param name the name of the property to set.
     * @param value the new value for the property.
     *
     * @throws IllegalArgumentException if the property trying to be set doesn't
     *    exist.
     */
    public void setFilterProperty(String name, String value)
            throws IllegalArgumentException
    {
        if (props.getProperty(name) == null) {
            throw new IllegalArgumentException();
        }
        props.put(name, value);
        applyProperties();
    }

    /**
     * <b>Overloaded</b> to return the subject of the message with profanity
     * filtered out.
     */
    public String getSubject() {
        return filterProfanity(message.getSubject());
    }

    /**
     * <b>Overloaded</b> to return the body of the message with profanity
     * filtered out.
     */
    public String getBody() {
        return filterProfanity(message.getBody());
    }

    /**
     * Creates properties and sets their descriptions.
     */
    private void initializeProperties() {
        filterList = new String[0];
        props.put("filterList","");
        props.put("ignoreCase","on");

        propDescriptions.put("filterList","A comma delimitted list of "
            + "the bad words to filter out.");
        propDescriptions.put("ignoreCase","Indicates whether the case "
            + "of words should be ignored or not. For example, when on, the "
            + "words 'CRap' and 'crap' would both be filterd if an entry of "
            + "'CRAP' was found in the filter list.");
    }

    private void applyProperties() {
        ignoreCase = ((String)props.getProperty("ignoreCase")).equals("on");
        String list = (String)props.get("filterList");
        StringTokenizer tokens = new StringTokenizer(list,",");
        String [] newFilterList = new String[tokens.countTokens()];
        for (int i=0; i<newFilterList.length; i++) {
            if (ignoreCase) {
                newFilterList[i] = tokens.nextToken().toLowerCase().trim();
            }
            else {
                newFilterList[i] = tokens.nextToken().trim();
            }
        }
        filterList = newFilterList;
    }

    /**
     * Filters out bad words.
     */
    private String filterProfanity(String str) {
        // Check to see if the string is null or zero-length
        if (str == null || "".equals(str)) {
            return str;
        }
        String lower;
        if (ignoreCase) {
            lower = str.toLowerCase();
        }
        else {
            lower = str;
        }
        for (int i=0; i<filterList.length; i++) {
            str = replace(str, lower, filterList[i], cleanWord(filterList[i].length()));
        }
        return str;
    }

    /**
     * Generates a string of characters of specified length. For example:
     * !@%$ or %!@$%!@@ or *****
     */
    private String cleanWord(int length) {
        char[] newWord = new char[length];
        for (int i=0; i<newWord.length; i++) {
            newWord[i] = '*';
        }
        return new String(newWord);
    }

    /**
     * Replaces all instances of oldString with newString in the String line.
     */
    private String replace(String line, String lowerCaseLine,
            String oldString, String newString )
    {
        int i=0;
        if ( ( i=lowerCaseLine.indexOf( oldString, i ) ) >= 0 ) {
            int oLength = oldString.length();
            int nLength = newString.length();
            StringBuffer buf = new StringBuffer(line.length()+15);
            buf.append(line.substring(0,i)).append(newString);
            i += oLength;
            int j = i;
            while( ( i=lowerCaseLine.indexOf( oldString, i ) ) > 0 ) {
                buf.append(line.substring(j,i)).append(newString);
                i += oLength;
                j = i;
            }
            buf.append(line.substring(j));
            return buf.toString();
        }
        return line;
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品少妇一区二区三区 | 欧美中文字幕一区二区三区亚洲| 精品裸体舞一区二区三区| 日韩av在线播放中文字幕| 欧美二区乱c少妇| 麻豆91在线播放| 久久蜜桃av一区精品变态类天堂| 国产九九视频一区二区三区| 国产精品久久久久影院| 在线观看亚洲专区| 日本成人在线不卡视频| 国产婷婷色一区二区三区| 99精品一区二区三区| 午夜日韩在线电影| 2021久久国产精品不只是精品| 国产成人小视频| 亚洲免费三区一区二区| 欧美一级在线视频| 972aa.com艺术欧美| 天堂成人国产精品一区| 久久影院午夜论| 欧美色视频在线| 国产精品99久久久久| 亚洲一二三四区| 久久久影视传媒| 欧美在线视频不卡| 成人少妇影院yyyy| 日本不卡视频一二三区| 国产精品久久久久久户外露出 | 欧美午夜一区二区三区免费大片| 麻豆精品在线视频| 亚洲欧美激情插| 精品久久免费看| 欧美日韩日日骚| 成人午夜av电影| 男女男精品视频| 亚洲三级电影网站| xfplay精品久久| 欧美在线观看视频在线| 国产精品亚洲综合一区在线观看| 亚洲资源中文字幕| 国产人妖乱国产精品人妖| 欧美疯狂做受xxxx富婆| 91影院在线免费观看| 国产麻豆成人传媒免费观看| 亚洲18色成人| 亚洲精品视频在线| 国产精品污网站| 精品国产精品网麻豆系列| 欧美日韩视频一区二区| 色婷婷精品大视频在线蜜桃视频| 国产精品亚洲成人| 麻豆视频观看网址久久| 亚洲国产成人高清精品| 亚洲欧美日韩国产中文在线| 国产精品视频你懂的| 久久久777精品电影网影网| 欧美大片免费久久精品三p| 欧美日韩一区二区三区高清| 91成人在线免费观看| 色综合久久88色综合天天6| 粉嫩嫩av羞羞动漫久久久| 久久国产三级精品| 久久er精品视频| 久久精品av麻豆的观看方式| 五月婷婷久久综合| 亚洲成人动漫在线观看| 婷婷开心久久网| 五月天激情综合网| 青青草国产成人av片免费| 轻轻草成人在线| 免费成人美女在线观看.| 日韩主播视频在线| 日韩成人免费看| 老司机一区二区| 国产真实乱对白精彩久久| 激情综合色综合久久| 国产在线播放一区三区四| 极品少妇一区二区| 成人一区在线观看| av一二三不卡影片| 色哟哟一区二区三区| 日本韩国一区二区三区视频| 在线观看亚洲一区| 欧美高清视频一二三区 | 不卡av电影在线播放| 成人短视频下载| 99久久国产综合精品麻豆| 本田岬高潮一区二区三区| 99视频国产精品| 欧美在线观看一区二区| 欧美日韩一级二级三级| 日韩情涩欧美日韩视频| 国产日产欧产精品推荐色| 亚洲欧美一区二区不卡| 婷婷夜色潮精品综合在线| 精品综合久久久久久8888| 国产成人8x视频一区二区| 91香蕉视频黄| 欧美一区二区三区人| 国产色产综合色产在线视频| 亚洲欧美区自拍先锋| 日韩国产欧美在线播放| 久久精品国产免费看久久精品| 高清在线观看日韩| 欧美在线制服丝袜| 2021久久国产精品不只是精品| 中文字幕一区视频| 五月综合激情日本mⅴ| 国产成人免费在线| 欧美三级日本三级少妇99| 精品成人私密视频| 亚洲激情自拍偷拍| 国模一区二区三区白浆| 日本高清成人免费播放| 日韩一级在线观看| 伊人一区二区三区| 激情成人综合网| 欧美午夜视频网站| 国产日韩高清在线| 日韩精品亚洲一区| 9i在线看片成人免费| 日韩一区二区三区三四区视频在线观看| 欧美日韩国产天堂| 日韩欧美的一区二区| 亚洲免费观看高清完整版在线观看| 日韩av一二三| 色伊人久久综合中文字幕| 26uuu国产日韩综合| 亚洲123区在线观看| 99视频有精品| wwww国产精品欧美| 午夜电影网亚洲视频| eeuss国产一区二区三区| 精品对白一区国产伦| 亚洲电影在线免费观看| www.99精品| 久久亚洲一区二区三区明星换脸 | 亚洲午夜羞羞片| www.日韩大片| 久久综合色之久久综合| 日韩国产欧美在线播放| 欧美在线一二三| 亚洲女同一区二区| 成人av在线观| 国产无人区一区二区三区| 久久精品99国产精品日本| 欧美一a一片一级一片| 国产精品成人免费| 国产精品一级片| 精品国产乱码久久| 免费观看成人鲁鲁鲁鲁鲁视频| 在线视频你懂得一区二区三区| 国产精品高潮呻吟| 成人天堂资源www在线| 久久亚洲精精品中文字幕早川悠里| 日韩av一区二区三区| 91精品在线麻豆| 亚洲一区二区五区| 在线视频国产一区| 亚洲自拍偷拍网站| 欧美日韩大陆一区二区| 一区二区三区在线看| 一本色道久久综合亚洲精品按摩| 国产精品看片你懂得| 成人一区二区视频| 国产精品欧美综合在线| 丰满少妇在线播放bd日韩电影| 久久久久久久综合色一本| 国产在线精品免费av| 久久久99久久| av中文字幕不卡| 亚洲免费观看高清完整版在线 | 国产在线观看一区二区| 久久色在线观看| 国产一区二区精品久久99| 久久久91精品国产一区二区三区| 国产另类ts人妖一区二区| 中文乱码免费一区二区| 99re视频精品| 亚洲一区二区av在线| 欧美日韩国产片| 久热成人在线视频| 中文欧美字幕免费| 色狠狠桃花综合| 日韩电影在线一区| 久久蜜臀精品av| 99国内精品久久| 亚洲va在线va天堂| 精品乱人伦一区二区三区| 成人一级片网址| 亚洲综合免费观看高清完整版| 欧美日韩视频在线一区二区| 麻豆成人免费电影| 国产精品毛片久久久久久| 色偷偷成人一区二区三区91| 亚洲bt欧美bt精品777| 欧美不卡123| 成人激情免费网站| 亚洲国产日韩a在线播放|