1 5 package org.roller.presentation.velocity.plugins.email; 6 7 import org.apache.commons.lang.StringEscapeUtils; 8 import org.apache.commons.logging.Log; 9 import org.apache.commons.logging.LogFactory; 10 import org.apache.velocity.context.Context; 11 import org.roller.pojos.WeblogEntryData; 12 import org.roller.presentation.RollerRequest; 13 import org.roller.presentation.velocity.PagePlugin; 14 import org.roller.util.RegexUtil; 15 16 20 public class ObfuscateEmailPlugin implements PagePlugin 21 { 22 protected String name = "Email Scrambler"; 23 protected String description = "Automatically converts email addresses " + 24 "to me-AT-mail-DOT-com format. Also "scrambles" mailto: links."; 25 26 private static Log mLogger = 27 LogFactory.getFactory().getInstance(ObfuscateEmailPlugin.class); 28 29 public ObfuscateEmailPlugin() 30 { 31 mLogger.debug("ObfuscateEmailPlugin instantiated."); 32 } 33 34 public String toString() { return name; } 35 36 39 public void init(RollerRequest rreq, Context ctx) 40 { 41 } 42 43 48 public String render(String str) 49 { 50 return RegexUtil.encodeEmail(str); 51 } 52 53 public String render(WeblogEntryData entry, boolean skipFlag) 54 { 55 return render(entry.getText()); 56 } 57 58 public String getName() { return name; } 59 public String getDescription() { return StringEscapeUtils.escapeJavaScript(description); } 60 61 } 62 | Popular Tags |