Commits

Samael Bate committed 6ec380a Merge

commit to default branch

  • Participants
  • Parent commits 5abb273, 9ff41b0

Comments (0)

Files changed (16)

     <version>1.0.0-BETA</version>
 
     <organization>
-        <name>Sam and Rob</name>
-        <url>https://bitbucket.org/robincrorie/WTFilter/wiki/Home</url>
+        <name>SingingBush.com</name>
+        <url>http://www.singingbush.com</url>
     </organization>
 
     <name>WTFilter</name>
     <packaging>atlassian-plugin</packaging>
     
     <properties>
-        <confluence.version>3.4</confluence.version>
-        <confluence.data.version>3.1</confluence.data.version>
-        <confluence.func-test>2.3</confluence.func-test>
+        <confluence.version>4.2.11</confluence.version>
+        <confluence.data.version>4.2</confluence.data.version>
+        <amps.version>3.9.3</amps.version>
+        <confluence.func-test>2.3.2</confluence.func-test>
     </properties>
     
     <developers>
         <developer>
             <name>Samael Bate</name>
-            <email>sbate@adaptavist.com</email>
-            <organization>Adaptavist.com Ltd</organization>
-            <organizationUrl>http://www.adaptavist.com/</organizationUrl>
+            <email>singingbush@hotmail.com.com</email>
+            <url>http://www.samael.me.uk</url>
+            <organization>singingbush.com</organization>
+            <organizationUrl>http://www.singingbush.com/</organizationUrl>
             <roles>
                 <role>Lead Developer</role>
             </roles>
             </roles>
         </developer>
     </developers>
+
+    <scm>
+        <connection>scm:hg:https://bitbucket.org/singingbush/wtfilter</connection>
+        <developerConnection>scm:hg:https://bitbucket.org/singingbush/wtfilter</developerConnection>
+        <url>https://bitbucket.org/singingbush/wtfilter</url>
+    </scm>
+
+    <issueManagement>
+        <system>bitbucket</system>
+        <url>https://bitbucket.org/singingbush/wtfilter/issues</url>
+    </issueManagement>
+
+    <prerequisites>
+        <maven>2.1</maven>
+    </prerequisites>
     
     <dependencies>
         <dependency>
             <artifactId>confluence</artifactId>
             <version>${confluence.version}</version>
             <scope>provided</scope>
+
+	    <!-- this exclusion was added due this issue: 
+https://answers.atlassian.com/questions/48095/can-t-compile-against-confluence-4-2-due-to-potentially-incorrect-dependency-in-confluence
+	    -->
+            <exclusions>
+                <exclusion>
+                    <artifactId>connector</artifactId>
+                    <groupId>javax.resource</groupId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>com.atlassian.confluence.plugin</groupId>
             <plugin>
                 <groupId>com.atlassian.maven.plugins</groupId>
                 <artifactId>maven-confluence-plugin</artifactId>
-                <version>3.2</version>
+                <version>${amps.version}</version>
                 <extensions>true</extensions>
                 <configuration>
                     <productVersion>${confluence.version}</productVersion>
             <plugin>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
-                    <source>1.5</source>
-                    <target>1.5</target>
+                    <source>1.6</source>
+                    <target>1.6</target>
                 </configuration>
             </plugin>
         </plugins>

File src/main/java/com/samandrob/confluence/WTFilter/CensorCreatePageServlet.java

-package com.samandrob.confluence.WTFilter;
-
-import java.io.IOException;
-import java.util.Date;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
-
-public class CensorCreatePageServlet implements Filter {
-    private ProfanityManager manager;
-
-    public void setProfanityManager(ProfanityManager manager) {
-        this.manager = manager;
-    }
-
-    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
-
-        HttpServletRequest request = (HttpServletRequest) req;
-        HttpRequestWithModifiableParameters modifiedReq = new HttpRequestWithModifiableParameters(request);
-
-String editorUsed;
-        if (request.getParameter("mode").matches("richtext"))
-            editorUsed = "wysiwygcontent";
-        else if (request.getParameter("mode").matches("markup"))
-            editorUsed = "content";
-        else
-            editorUsed = "wysiwygcontent";
-
-        String postedTitle = request.getParameter("title");
-        String postedArticle = request.getParameter(editorUsed);
-
-        if (manager.getWords() != null) {
-            String editedText = manager.replaceCensoredWords(postedArticle, "######");
-            modifiedReq.setParameter(editorUsed, editedText);
-
-            editedText = manager.replaceCensoredWords(postedTitle, "CENSORED");
-            modifiedReq.setParameter("title", editedText);
-
-            for (String word : manager.getWords()) {
-                if ( (postedArticle.contains(word)) || (postedTitle.contains(word)) ) {
-                    //todo - make a message here which can pass to the core code so that the Admin is informed which user has been posting profanities
-                    String ipAddress = request.getRemoteAddr();
-                    String timeStamp = new Date().toString();
-                    //String userName = request.getRemoteUser();        //todo - How to return the username?
-                    String grassMessage = "User" + " attempted to post censored word. " + timeStamp + " From IP: " + ipAddress;
-
-                    //Test it:
-                    System.out.println(grassMessage);
-                }
-            }
-        }
-        chain.doFilter(modifiedReq, res);
-    }
-    public void init(FilterConfig config) throws ServletException {
-        //
-    }
-
-    public void destroy() {
-        //add code to release any resource
-    }
-}

File src/main/java/com/samandrob/confluence/WTFilter/CensorEditPageServlet.java

-package com.samandrob.confluence.WTFilter;
-
-import java.io.IOException;
-import java.util.Date;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
-public class CensorEditPageServlet implements Filter {
-    private ProfanityManager manager;
-
-    public void setProfanityManager(ProfanityManager manager) {
-        this.manager = manager;
-    }
-
-    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
-
-        HttpServletRequest request = (HttpServletRequest) req;
-        HttpRequestWithModifiableParameters modifiedReq = new HttpRequestWithModifiableParameters(request);
-
-        String editorUsed;
-        if (request.getParameter("mode").matches("richtext"))
-            editorUsed = "wysiwygcontent";
-        else if (request.getParameter("mode").matches("markup"))
-            editorUsed = "content";
-        else
-            editorUsed = "wysiwygcontent";
-
-        String postedTitle = request.getParameter("title");
-        String postedArticle = request.getParameter(editorUsed);
-
-        if (manager.getWords() != null) {
-            String editedText = manager.replaceCensoredWords(postedArticle, "######");
-            modifiedReq.setParameter(editorUsed, editedText);
-
-            editedText = manager.replaceCensoredWords(postedTitle, "CENSORED");
-            modifiedReq.setParameter("title", editedText);
-
-            for (String word : manager.getWords()) {
-                if ( (postedArticle.contains(word)) || (postedTitle.contains(word)) ) {
-                    //todo - make a message here which can pass to the core code so that the Admin is informed which user has been posting profanities
-                    String ipAddress = request.getRemoteAddr();
-                    String timeStamp = new Date().toString();
-                    //String userName = request.getRemoteUser();        //todo - How to return the username?
-                    String grassMessage = "User" + " attempted to post censored word. " + timeStamp + " From IP: " + ipAddress;
-
-                    //Test it:
-                    System.out.println(grassMessage);
-                }
-            }
-        }
-        chain.doFilter(modifiedReq, res);
-    }
-    
-    public void init(FilterConfig config) throws ServletException {
-        //Get init parameter
-        //String testParam = config.getInitParameter("parameter-Name");
-
-        //Print the init parameter
-        //System.out.println("\n ** ** Test Parameter: " + testParam);
-    }
-
-    public void destroy() {
-        //add code to release any resource
-    }
-}

File src/main/java/com/samandrob/confluence/WTFilter/ConfigAction.java

+package com.samandrob.confluence.WTFilter;
+
+import com.atlassian.confluence.core.ConfluenceActionSupport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.util.*;
+
+public class ConfigAction extends ConfluenceActionSupport {
+
+    private ProfanityManager manager;
+    private static final Logger log = LoggerFactory.getLogger(ConfigAction.class);
+
+    private String bannedWord;
+    private String errorMessage;
+
+    // ************* Setters, used when the form in Velocity Template posts it's data *********************
+    public void setProfanityManager(ProfanityManager manager) {
+        this.manager = manager;
+    }
+
+    public void setBannedWord(String bannedWord) {
+        this.bannedWord = bannedWord;
+    }
+
+    public void setReplacementWord(String replacementWord) {
+        this.manager.setReplacementText(replacementWord);
+    }
+
+    // Entry Point
+    public String execute() throws Exception {
+        errorMessage = null;
+
+        if (bannedWord != null) {
+            log.debug("Word added to list of banned words: " + bannedWord);
+
+            if (bannedWord.length() <= 1) {
+                errorMessage = "profanityLength";
+                return ERROR;
+            }
+
+            if ("DELETEALL".equals(bannedWord) ) {
+                manager.clearWords();
+                return "words-cleared";
+            }
+
+            if (bannedWord.length() > 1) {
+                manager.addWord(bannedWord);
+                return "word-added";
+            }
+
+        }
+
+        // errorMessage = "wordAlreadyListed";
+
+        return "input";
+    }
+
+    // ************* Getters, these are used by variables in Velocity Template *********************
+    public String getBannedWord() {
+        return bannedWord;
+    }
+
+    public List<String> getBannedWords() {
+        return manager.getWords();
+    }
+
+    public String getErrorMessage() {
+        return errorMessage;        
+    }
+}

File src/main/java/com/samandrob/confluence/WTFilter/ProfanityConfigAction.java

-package com.samandrob.confluence.WTFilter;
-
-import com.atlassian.confluence.core.ConfluenceActionSupport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import java.util.*;
-
-public class ProfanityConfigAction extends ConfluenceActionSupport {
-
-    private ProfanityManager manager;
-    private static final Logger log = LoggerFactory.getLogger(ProfanityConfigAction.class);
-    private String word;
-    private String errorMessage;
-
-    // ************* Setters, used when the form in Velocity Template posts it's data *********************
-    public void setProfanityManager(ProfanityManager manager) {
-        this.manager = manager;
-    }
-
-    public void setBadword(String word) {
-        this.word = word;
-    }
-
-    // Entry Point
-    public String execute() throws Exception {
-        errorMessage = null;
-
-        if (word != null) {
-            log.debug("*** Word being submitted which is " + word.length() + " characters long.");
-
-            if (word.length() == 1) {
-                errorMessage = "profanityLength";
-                return ERROR;
-            }
-
-            if ("DELETEALL".equals(word) ) {
-                manager.clearWords();
-                return "words-cleared";
-            }
-
-            if (word.length() > 1) {
-                manager.addWord(word);
-                return "word-added";
-            }
-
-        }
-
-        // errorMessage = "wordAlreadyListed";
-
-        return "input";
-    }
-
-    // ************* Getters, these are used by variables in Velocity Template *********************
-    public String getWord() {
-        return word;
-    }
-
-    public List<String> getBadWords() {
-        return manager.getWords();
-    }
-
-    public String getErrorMessage() {
-        return errorMessage;        
-    }
-}

File src/main/java/com/samandrob/confluence/WTFilter/ProfanityManager.java

 
     String replaceCensoredWords(String in, String replaceWith);
 
+    String replaceCensoredWords(String in);
+
     void clearWords();
+
+    void setReplacementText(String word);
 }

File src/main/java/com/samandrob/confluence/WTFilter/ProfanityManagerImpl.java

 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
+import java.util.LinkedList;
 import java.util.List;
 
 public class ProfanityManagerImpl implements ProfanityManager {
     private BandanaContext bandanaContext;
     protected static final String BANDANAKEY = "com.adaptavist.confluence.WTFilter.ProfanityManager";
 
+    private String replacementText = "CENSORED";
+
     private static final Logger log = LoggerFactory.getLogger(ProfanityManagerImpl.class);
 
     private XStream xStream;
 
-    // ************************** my Constructor: ***************************
     public ProfanityManagerImpl() {
         this.bandanaContext = new ConfluenceBandanaContext();
         
         }
     }
 
-    public void removeWord(String badword) {
+    public void removeWord(String word) {
 
-        if (this.getData().contains(badword)) {
-            this.getData().remove(badword);
-            log.debug("Removing " + badword + " from bandana.");
+        if (this.getData().contains(word)) {
+            this.getData().remove(word);
+            log.debug("Removing " + word + " from bandana.");
         } else
-            log.debug("Cannot remove " + badword + " as it is not a banned word.");
+            log.debug("Cannot remove " + word + " as it is not a banned word.");
 
         this.save();
     }
 
     public void clearWords() {
-        log.info("Clearing following words: " + getData() );
-        List<String> temp = getData();
-        getData().clear();
-        save();
+        log.info("Clearing total of " + getData().size() + " words.");
+        bannedWords.clear();
+        this.save();
     }
 
+    @Override
+    public void setReplacementText(String word) {
+        this.replacementText = word;
+    }
+
+    @Deprecated
     public String replaceCensoredWords(String input, String replacement) {
 
-        String returnValue = input;
+        //String returnValue = input;
+        StringBuffer stringBuffer = new StringBuffer(input);
         
-        for (String bannedWord : getWords()) {
-            String regex = "(?i)(\\b)" + bannedWord + "(\\b)";
-            returnValue = returnValue.replaceAll(regex, replacement);
+        for (String word : getWords()) {
+            String regex = "(?i)(\\b)" + word + "(\\b)";
+            stringBuffer = new StringBuffer(stringBuffer.toString().replaceAll(regex, replacement));
         }
-        return returnValue;
+        return stringBuffer.toString();
+    }
+
+    public String replaceCensoredWords(String input) {
+
+        //String returnValue = input;
+        StringBuffer stringBuffer = new StringBuffer(input);
+
+        for (String word : getWords()) {
+            String regex = "(?i)(\\b)" + word + "(\\b)";
+            stringBuffer = new StringBuffer(stringBuffer.toString().replaceAll(regex, replacementText));
+        }
+        return stringBuffer.toString();
     }
 
     // *************************** Components: *****************************
         bandanaManager.setValue(bandanaContext, BANDANAKEY, xStream.toXML(getData()));
     }
 
-    public List<String> getData() {
+    private List<String> getData() {
 
         if (bannedWords == null) {
             Object banData = bandanaManager.getValue(bandanaContext, BANDANAKEY);
             }
         }
         if (bannedWords == null) {
-            bannedWords = new ArrayList<String>();
+            bannedWords = new LinkedList<String>();
         }
         return bannedWords;
     }
 
-    public void setData(ArrayList<String> data) {
+    public void setData(LinkedList<String> data) {
         this.bannedWords = data;
     }
 }

File src/main/java/com/samandrob/confluence/WTFilter/WtfServletFilter.java

+package com.samandrob.confluence.WTFilter;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author samael
+ */
+public class WtfServletFilter implements Filter {
+    private ProfanityManager manager;
+
+    public void setProfanityManager(ProfanityManager manager) {
+        this.manager = manager;
+    }
+
+    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
+
+        HttpServletRequest httpRequest = (HttpServletRequest) req;
+        HttpRequestWithModifiableParameters modifiedReq = new HttpRequestWithModifiableParameters(httpRequest);
+
+        Map params = httpRequest.getParameterMap();
+
+        String editorUsed;
+        if (params.containsKey("mode") && httpRequest.getParameter("mode").matches("richtext"))
+            editorUsed = "wysiwygcontent";
+        else if (params.containsKey("mode") && httpRequest.getParameter("mode").matches("markup"))
+            editorUsed = "content";
+        else
+            editorUsed = "wysiwygContent";
+
+        if (manager.getWords().size() >= 1) {
+
+            if(params.containsKey("title")) {
+                String title = httpRequest.getParameter("title");
+                String editedTitle = manager.replaceCensoredWords(title);
+                modifiedReq.setParameter("title", editedTitle);
+            }
+
+            if(params.containsKey(editorUsed)) {
+                String content = httpRequest.getParameter(editorUsed);
+                String editedContent = manager.replaceCensoredWords(content);
+                modifiedReq.setParameter(editorUsed, editedContent);
+            }
+
+
+
+
+//            for (String word : manager.getWords()) {
+//                if ( (content.contains(word)) || (title.contains(word)) ) {
+//                    //todo - make a message here which can pass to the core code so that the Admin is informed which user has been posting profanities
+//                    String ipAddress = httpRequest.getRemoteAddr();
+//                    String timeStamp = new Date().toString();
+//                    //String userName = request.getRemoteUser();        //todo - How to return the username?
+//                    String logMessage = "User" + " attempted to post censored word. " + timeStamp + " From IP: " + ipAddress;
+//
+//                    //Test it:
+//                    System.out.println(logMessage);
+//                }
+//            }
+        }
+        chain.doFilter(modifiedReq, res);
+    }
+
+    private void logMessage() {
+        //
+    }
+
+    public void init(FilterConfig config) throws ServletException {
+        //Get init parameter
+        //String testParam = config.getInitParameter("parameter-Name");
+
+        //Print the init parameter
+        //System.out.println("\n ** ** Test Parameter: " + testParam);
+    }
+
+    public void destroy() {
+        //add code to release any resource
+    }
+}

File src/main/resources/adv-i18n.properties

 profanity.i18n.module.actions=Config Actions
 profanity.i18n.module.servlet.createpage=Censor during page creation
 profanity.i18n.module.servlet.editpage=Censor during page edits
+profanity.i18n.module.servlet.createblogpost=Censor during blog post creation
+profanity.i18n.module.servlet.editblogpost=Censor during blog post edits
 profanity.i18n.module.servlet.comment=Censor adding of comments 
 profanity.i18n.module.servlet.editcomment=Censor editing of comments
 
 profanity.i18n.configscreen.listing.heading=Current Profanities:
 profanity.i18n.configscreen.listing.subtext.nowords=There are currently no words being blocked.
 profanity.i18n.configscreen.listing.subtext.havewords=The following words are currently being blocked:
-profanity.i18n.configscreen.adaptavistInfo=This plugin has been created by a member of staff at <a href="http://www.adaptavist.com">Adaptavist</a>.
+profanity.i18n.configscreen.pluginInfo=WTFilter was made open-source in 2011 by Samael Bate &amp; Robin Crorie. Whilst the plugin can be used to prevent users from using specified words in page bodies and page titles, it is by no means production ready. If you wish for this plugin to be updated for current versions of Confluence or wish to contribute code please contact Samael Bate.
 
 ## Button text:
 profanity.i18n.config.action.add=Add word

File src/main/resources/adv-i18n_de.properties

 profanity.i18n.module.actions=Config Actions
 profanity.i18n.module.servlet.createpage=Censor during page creation
 profanity.i18n.module.servlet.editpage=Censor during page edits
+profanity.i18n.module.servlet.createblogpost=Censor during blog post creation
+profanity.i18n.module.servlet.editblogpost=Censor during blog post edits
 profanity.i18n.module.servlet.comment=Censor adding of comments 
 profanity.i18n.module.servlet.editcomment=Censor editing of comments
 
 profanity.i18n.configscreen.listing.heading=Current Profanities:
 profanity.i18n.configscreen.listing.subtext.nowords=There are currently no words being blocked.
 profanity.i18n.configscreen.listing.subtext.havewords=The following words are currently being blocked:
-profanity.i18n.configscreen.adaptavistInfo=This plugin has been created by a member of staff at <a href="http://www.adaptavist.com">Adaptavist</a>.
+profanity.i18n.configscreen.pluginInfo=WTFilter was made open-source in 2011 by Samael Bate &amp; Robin Crorie. Whilst the plugin can be used to prevent users from using specified words in page bodies and page titles, it is by no means production ready. If you wish for this plugin to be updated for current versions of Confluence or wish to contribute code please contact Samael Bate.
 
 ## Button text:
 profanity.i18n.config.action.add=Add word

File src/main/resources/adv-i18n_ru.properties

 
 ## Module names:
 profanity.i18n.module.manager=Цензор
-profanity.i18n.module.actions=Config Actions - ??? (I ll call u about it later)
+profanity.i18n.module.actions=Config Actions
 profanity.i18n.module.servlet.createpage=цензура в период создания страницы
 profanity.i18n.module.servlet.editpage=цензура в период обработки страницы
+profanity.i18n.module.servlet.createblogpost=Censor during blog post creation
+profanity.i18n.module.servlet.editblogpost=Censor during blog post edits
 profanity.i18n.module.servlet.comment=цензура на добавление комментариев
 profanity.i18n.module.servlet.editcomment=цензура на редактирование комментариев
 
 profanity.i18n.configscreen.listing.heading=Current Profanities:
 profanity.i18n.configscreen.listing.subtext.nowords=В настоящее время нет заблокированных слов.
 profanity.i18n.configscreen.listing.subtext.havewords=Следующие слова в настоящее время блокируются:
-profanity.i18n.configscreen.adaptavistInfo=This plugin has been created by a member of staff at <a href="http://www.adaptavist.com">Adaptavist</a>.
+profanity.i18n.configscreen.pluginInfo=WTFilter was made open-source in 2011 by Samael Bate &amp; Robin Crorie. Whilst the plugin can be used to prevent users from using specified words in page bodies and page titles, it is by no means production ready. If you wish for this plugin to be updated for current versions of Confluence or wish to contribute code please contact Samael Bate.
 
 ## Button text:
 profanity.i18n.config.action.add=Ввести слово

File src/main/resources/atlassian-plugin.xml

         <param name="configure.url">/admin/WTFilter/configurePlugin.action</param>
     </plugin-info>
 
-    <resource key="icons" name="icons/" type="download" location="images" />
+    <resource key="icons" name="icons" type="download" location="${atlassian.plugin.key}/images" />
 
     <resource type="i18n" name="i18n" location="adv-i18n" />
 
-    <component key="ProfanityManager" name="Profanity Manager"
+    <component key="WTFilterManager" name="WTFilter Manager"
                class="com.samandrob.confluence.WTFilter.ProfanityManagerImpl"
                public="true">
         <interface>com.samandrob.confluence.WTFilter.ProfanityManager</interface>
-        <description>Manager for Profanity Censor functionality.</description>
+        <description>Manager for WTFilter functionality.</description>
     </component>
 
-    <xwork key="actions" name="Configuration Actions" >
+    <web-item key="WTFilterConfigPage" name="WTFilter Configuration" section="system.admin/administration" weight="70">
+        <label key="WTFilter" />
+        <link linkId="pm-config-link">/admin/WTFilter/configurePlugin.action</link>
+        <description>Allows access to the WTFilter configuration page from the Confluence admin panel.</description>
+    </web-item>
+
+    <xwork key="WTFilterConfigAction" name="Configuration Actions" >
         <description>Profanity Censor Configuration Menu.</description>
         <package name="profanity-admin" extends="default" namespace="/admin/WTFilter">
             <default-interceptor-ref name="defaultStack" />
-            <action name="configurePlugin" class="com.samandrob.confluence.WTFilter.ProfanityConfigAction">
+            <action name="configurePlugin" class="com.samandrob.confluence.WTFilter.ConfigAction">
                 <result name="input" type="velocity">/config2.vm</result>
                 <result name="error" type="velocity">/config2.vm</result>
                 <!--<result name="errorinlength" type="velocity">/config2.vm</result>-->
         </package>
     </xwork>
 
-    <servlet-filter key="CensorCreatePageServlet" name="Create Page Censorship Servlet"
+    <servlet-filter key="WtfCreatePageFilter" name="Create Page Servlet Filter"
                     i18n-name-key="profanity.i18n.module.servlet.createpage"
-                    class="com.samandrob.confluence.WTFilter.CensorCreatePageServlet"
+                    class="com.samandrob.confluence.WTFilter.WtfServletFilter"
                     location="before-login" weight="200">
         <description>Prevent unwanted words being used during page creation</description>
         <url-pattern>*docreatepage.action*</url-pattern>
     </servlet-filter>
 
-    <servlet-filter key="CensorEditPageServlet" name="Edit Page Censorship Servlet"
+    <servlet-filter key="WtfEditPageFilter" name="Edit Page Servlet Filter"
                     i18n-name-key="profanity.i18n.module.servlet.editpage"
-                    class="com.samandrob.confluence.WTFilter.CensorEditPageServlet"
+                    class="com.samandrob.confluence.WTFilter.WtfServletFilter"
                     location="before-login" weight="200">
         <description>Prevent unwanted words being used when editing pages</description>
         <url-pattern>*doeditpage.action*</url-pattern>
     </servlet-filter>
 
-    <!--<servlet-filter key="CensorAddCommentsServlet" name="Censor Add Comments Servlet"-->
-                    <!--i18n-name-key="WTFilter.i18n.module.servlet.comment"-->
-                    <!--class="com.samandrob.confluence.WTFilterCensorAddCommentsServlet"-->
+    <servlet-filter key="WtfCreateBlogPostFilter" name="Create Blog Post Servlet Filter"
+                    i18n-name-key="profanity.i18n.module.servlet.createblogpost"
+                    class="com.samandrob.confluence.WTFilter.WtfServletFilter"
+                    location="before-login" weight="200">
+        <description>Prevent unwanted words being used when creating blog posts</description>
+        <url-pattern>*docreateblogpost.action*</url-pattern>
+    </servlet-filter>
+
+    <servlet-filter key="WtfEditBlogPostFilter" name="Edit Blog Post Servlet Filter"
+                    i18n-name-key="profanity.i18n.module.servlet.editblogpost"
+                    class="com.samandrob.confluence.WTFilter.WtfServletFilter"
+                    location="before-login" weight="200">
+        <description>Prevent unwanted words being used when editing blog posts</description>
+        <url-pattern>*doeditblogpost.action*</url-pattern>
+    </servlet-filter>
+
+    <!-- CATCHING WORDS DURING COMMENT CREATION WILL BE MORE TRICKY -->
+    <!--<servlet-filter key="WtfAddCommentsServlet" name="Add Comments Filter"-->
+                    <!--i18n-name-key="profanity.i18n.module.servlet.comment"-->
+                    <!--class="com.samandrob.confluence.WTFilter.WtfServletFilter
                     <!--location="before-login" weight="200">-->
         <!--<description>Prevent unwanted words being used when adding comments</description>-->
-        <!--<url-pattern>*doaddcomment.action?pageId=*</url-pattern>-->
+        <!--<url-pattern>*doaddcomment.action*</url-pattern>  THIS ISN'T RIGHT  -->
     <!--</servlet-filter>-->
 
-    <!--<servlet-filter key="CensorEditCommentsServlet" name="Censor Edit Comments Servlet"-->
-                    <!--i18n-name-key="WTFilter.i18n.module.servlet.editcomment"-->
-                    <!--class="com.samandrob.confluence.WTFilterCensorEditCommentsServlet"-->
-                    <!--location="before-login" weight="200">-->
-        <!--<description>Prevent unwanted words being used when comments are being edited</description>-->
-        <!--<url-pattern>*doeditcomment.action?pageId=*</url-pattern>-->
-    <!--</servlet-filter>-->
+    <servlet-filter key="WtfEditCommentFilter" name="Edit Comments Filter"
+                    i18n-name-key="profanity.i18n.module.servlet.editcomment"
+                    class="com.samandrob.confluence.WTFilter.WtfServletFilter"
+                    location="before-login" weight="200">
+        <description>Prevent unwanted words being used when comments are being edited</description>
+        <url-pattern>*doeditcomment.action*</url-pattern>
+    </servlet-filter>
 
 </atlassian-plugin>

File src/main/resources/com/samandrob/confluence/WTFilter/images/wtfilter_icon.png

Added
New image

File src/main/resources/config.vm

         </div>
 
         <div class="functionbox thickPadded">
-            <p>$i18n.getText("profanity.i18n.configscreen.adaptavistInfo")</p>
+            <p>$i18n.getText("profanity.i18n.configscreen.pluginInfo")</p>
         </div>
     </div>
 </div>

File src/main/resources/config2.vm

-<title>$i18n.getText("profanity.i18n.pluginname") - $i18n.getText("profanity.i18n.configscreen.title")</title>
+<html>
+    <head>
+        <title>$i18n.getText("profanity.i18n.pluginname") - $i18n.getText("profanity.i18n.configscreen.title")</title>
+    </head>
 
-#if ($!{word})
-word added: ${word} is $word.length() characters in length.
-#end
-
-##<form class="aui" id="#profanityForm" name="update-profanities" action="configurePlugin.action" method="post">
-##    <label>
-##        <input type="text" id="profanity" name="badword" value=""/>
-##    </label>
-##    <label>
-##        <input type="submit" id="" class="submit button" value="Update" />
-##     </label>
-##</form>
+    <body>
 
         <div id="search-index-panel" class="functionbox thickPadded">
             <div id="search-index-panel-contents">
                 <h2>$i18n.getText("profanity.i18n.configscreen.heading")</h2>
                 <p class="description">$i18n.getText("profanity.i18n.configscreen.instructions")</p>
                 <form class="aui" id="#profanityForm" name="update-profanities" action="configurePlugin.action" method="post">
-                    <label for="profanity">Enter a word to add it to your list of censored
-                        <words></words>:
-                        <input type="text" id="profanity" name="badword" value="" />
+                    <label for="bannedWord">Enter a word to add it to your list of censored words
+                        <input type="text" id="bannedWord" name="bannedWord" value="" />
                     </label>
                     <label for="add-profanity">
-                        <input type="submit" id="add-profanity" name="add-profanity" class="submit button"
-                               value="$i18n.getText("profanity.i18n.config.action.add")"  />
-                     </label>
-                    <label for="clear-all">
-                        <input type="submit" id="clear-all" name="clear-all" class="submit button"
-                               value="$i18n.getText("profanity.i18n.config.action.reset")"  />
-                     </label>
+                        <input type="submit" id="add-profanity" name="add-profanity" class="submit button" />
+                    </label>
+                    <!--<label for="clear-all">-->
+                        <!--<input type="submit" id="clear-all" name="clear-all" class="submit button"-->
+                               <!--value="$i18n.getText('profanity.i18n.config.action.reset')"  />-->
+                    <!--</label>-->
                 </form>
-                 #if ( ($!{word}) && ($word.length() > 1) ) 
-                     <p class="successBox"><strong>${word}</strong> has been added to your censored words.</p>
-                 #end
-                 #if (${errorMessage} == "profanityLength")
-                     <p class="error">$i18n.getText("profanity.i18n.configscreen.errorMessage.profanityLength")</p>
-                 #elseif (${errorMessage} == "wordAlreadyListed")
-                     <p class="error">$i18n.getText("profanity.i18n.configscreen.errorMessage.wordAlreadyListed")</p>
-                 #end
+                #if ( ($!{bannedWord}) && ($bannedWord.length() > 1) )
+                    <p class="successBox"><strong>${bannedWord}</strong> has been added to your censored words.</p>
+                #end
+                #if (${errorMessage} == "profanityLength")
+                    <p class="error">$i18n.getText("profanity.i18n.configscreen.errorMessage.profanityLength")</p>
+                #elseif (${errorMessage} == "wordAlreadyListed")
+                    <p class="error">$i18n.getText("profanity.i18n.configscreen.errorMessage.wordAlreadyListed")</p>
+                #end
             </div>
         </div>
 
         <div class="functionbox thickPadded">
             <h2>$i18n.getText("profanity.i18n.configscreen.listing.heading")</h2>
-            #if ($badWords.size() == 0)
+            #if ($bannedWords.size() == 0)
                 <div class="description">$i18n.getText("profanity.i18n.configscreen.listing.subtext.nowords")</div>
             #else
-                <div class="description">$i18n.getText("profanity.i18n.configscreen.listing.subtext.havewords")  Total: $badWords.size()</div>
+                <div class="description">$i18n.getText("profanity.i18n.configscreen.listing.subtext.havewords")  Total: $bannedWords.size()</div>
             #end
-            #if ($!{word})
-                #foreach ($currentWord in ${badWords})
-                    <ol><strong class="good">$currentWord</strong> | <strong class="bad">Remove Word</strong></ol>
-                #end
+
+            <ol>
+            #foreach ($currentWord in ${bannedWords})
+                <li><strong class="good">$currentWord</strong> | <strong class="bad">Remove Word</strong></li>
+            #end
+            </ol>
+
+            #if ($!{errorMessage})
+            <div class="error">$i18n.getText("profanity.i18n.configscreen.errorMessage")</div>
             #end
 
         </div>
 
         <div class="functionbox thickPadded">
-            <p>$i18n.getText("profanity.i18n.configscreen.adaptavistInfo")</p>
-        </div>
+            <p>$i18n.getText("profanity.i18n.configscreen.pluginInfo")</p>
+        </div>
+
+    </body>
+</html>

File src/test/java/com/samandrob/confluence/WTFilter/TestProfanityManager.java

         profanityManager.clearWords();
         assertEquals(0, profanityManager.getWords().size());
     }
+
+    @Test
+    public void testReplacementText() {
+        String post = "Badminton is a great sport, unless you're bad at it.";
+        profanityManager.addWord("Bad");
+
+        String defaultResult = profanityManager.replaceCensoredWords(post);
+        assertEquals("Badminton is a great sport, unless you're CENSORED at it.", defaultResult); // CENSORED is default
+
+        profanityManager.setReplacementText("terrible");
+        String terribleResult = profanityManager.replaceCensoredWords(post);
+        assertEquals("Badminton is a great sport, unless you're terrible at it.", terribleResult);
+    }
 }