1 10 package org.mmbase.util.transformers; 11 12 import java.util.regex.*; 13 import java.util.*; 14 import org.mmbase.util.Entry; 15 16 24 25 public class Censor extends RegexpReplacer { 26 27 protected static Collection forbidden = new ArrayList(); 28 29 static { 30 new Censor().readPatterns(forbidden); 31 } 32 33 protected Collection getPatterns() { 34 return forbidden; 35 } 36 37 protected String getConfigFile() { 38 return "censor.xml"; 39 } 40 41 42 43 protected void readDefaultPatterns(Collection patterns) { 44 patterns.add(new Entry(Pattern.compile("(?i)mmbase"), "MMBase")); 45 patterns.add(new Entry(Pattern.compile("(?i)microsoft"), "Micro$soft")); 46 patterns.add(new Entry(Pattern.compile("(?i)fuck"), "****")); 47 } 48 49 50 public String toString() { 51 return "CENSOR"; 52 } 53 } 54 | Popular Tags |