01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. The ASF licenses this file to You
04: * under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License. For additional information regarding
15: * copyright in this work, please see the NOTICE file in the top level
16: * directory of this distribution.
17: */
18:
19: package org.apache.roller.ui.rendering.plugins;
20:
21: import java.util.Map;
22: import org.apache.commons.lang.StringEscapeUtils;
23: import org.apache.commons.logging.Log;
24: import org.apache.commons.logging.LogFactory;
25: import org.apache.roller.RollerException;
26: import org.apache.roller.business.WeblogEntryPlugin;
27: import org.apache.roller.pojos.WeblogEntryData;
28: import org.apache.roller.pojos.WebsiteData;
29: import org.apache.roller.util.RegexUtil;
30:
31: /**
32: * Obfuscate email addresses in entry text.
33: */
34: public class ObfuscateEmailPlugin implements WeblogEntryPlugin {
35:
36: private static Log mLogger = LogFactory
37: .getLog(ObfuscateEmailPlugin.class);
38:
39: protected String name = "Email Scrambler";
40:
41: protected String description = "Automatically converts email addresses "
42: + "to me-AT-mail-DOT-com format. Also "scrambles" mailto: links.";
43:
44: public ObfuscateEmailPlugin() {
45: mLogger.debug("ObfuscateEmailPlugin instantiated.");
46: }
47:
48: public String getName() {
49: return name;
50: }
51:
52: public String getDescription() {
53: return StringEscapeUtils.escapeJavaScript(description);
54: }
55:
56: public void init(WebsiteData website) throws RollerException {
57: }
58:
59: public String render(WeblogEntryData entry, String str) {
60: return RegexUtil.encodeEmail(str);
61: }
62:
63: }
|