You do not have permission to view the full content of this post.
Log in or register now.
BOO Censorship!
I hate censorship as much as anyone, but as a web application developer, there are times when a banned-word list is necessary, especially if the application or site is geared towards younger users or corporate environments.
What This Script Does
The script will take a word or phrase and replace the words you put in the $badwords array and replace it with asterisks.
- Case insensitive
- Looks for "leetspeak"-style combinations of foreign characters, numbers and symbols
- Uses regex, so your badword list stays short
- Uses asterisks as the replacement, but you can specify your own character
- Add as many bad words as you like
I haven't finished all of the leetspeak filters yet, but I have a good start so far. If you wish to twiddle those to add or remove, they can be found in the censor.function.php file in the master branch, in the $leet_replace array.