Thursday, September 18, 2008 -

Did you change the filter in your Phish tank yet?

John
John Norton
Developer

So this week we had a client come to us with a challenging request. They wanted a Phish filter on their blog to filter out vulgar words. I spent a few hours searching to see if someone had already written an extension for BlogEngine.Net, but couldn’t find one! So after a Google search and ten minutes of “that’s a real word?!”, I began writing a phish filter.

So how does it work?

It works like any other extension in BlogEngine.Net and utilizes the existing Smiley faces extension to replace vulgar words. Well, not all the smiley faces, just the Foot-In-Mouth Smiley. The word list is compiled into an XML file stored in the App_Data folder and the extension resides in the Extensions folder with the other extensions. The extension was based off of the Smiley Face extension so I could make good use of the faces and the “on the fly” replacement. It scans both the blog posts and comments for any of the words deemed “foul” by the XML using a regular expression to assure we don’t ruin good words like “asset” or “password”. If you feel the need to add more words just toss them in the XML. When the page is loaded any modifications to the foul word list will take immediate effect on all posts/comments new or old.

It came out quite well and they seemed very happy with the result. Well enough of my rambling here's a zip file of the extension and a short little how-to. Happy Foot in mouth blogging!

-John

Posted by John on Thursday, September 18, 2008 at 11:49 AM in From the Dev Team
Actions: E-mail | Permalink | Comments (2)

Related posts

Comments

9/18/2008 12:29:49 PM

I gotta test this out...Foot

kelley Muir us

9/22/2008 4:22:45 PM

Does thisFootthing really work? That'sFootawesome!

Michael Longver us

Add comment


 

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

9/10/2010 3:44:16 PM