Selective Whole-Word Checking for Censor

Started by James Gryphon, March 09, 2016, 10:50:28 PM

Previous topic - Next topic

James Gryphon

It's a clumsy topic name, I know. I hope it provides a little bit of a clue what it's about. I'm also sorry if this is the wrong place for this topic.

Right now, the censor can be set up to filter words that are in words, or not. What I'd like is the ability to choose this on a word-by-word basis, since there are some words that should be filtered in every possible permutation (regardless of whether I can think of them all or not), and other words that can be part of a regular, non-censored word (like, hypothetically, "danger").

Is there anything like this out there already, or would this have to be made from scratch?

dougiefresh

It would definitely need to be made from scratch. 

I started looking to see what would have to be changed.  I found the function censorText in Sources/Load.php and it doesn't look like many changes would be necessary to make it work.  Likewise, in Sources/ManagePosts.php, the function SetCensor would need a few changes, as well.  Can't forget about the template_edit_censored function in Admin.template.php, either....

It might be a few days/weeks before I can write something up for this.....


James Gryphon

Sorry for taking so long to get back to you. Thanks for putting in the work to make this; I've tested it out and it looks great!

The only two problems with it that I can see: for some reason, it gave me a bug report when I first attempted to install it (citing trouble overwriting part of the Admin template file, specifically:
document.getElementById("moreCensoredWords_link").style.display = "";

The strange thing is that I looked in the code, and it seemed like it should have gone in correctly. I don't think I've done anything with that file to change it so that it'd be broken.

So, I went ahead and installed it anyway (after backing up all my files). It seems to work wonderfully, for the most part. The only really peculiar thing is that the censored word page now no longer allows me to add new words to the list. (I'm sure this is where an expert could come in and say, "well of course you dummy, that code affects this and such, so obviously it would cause that to happen"...)

dougiefresh

Thank you for the bug report!  I have fixed the issue with the install.xml so that operation will install correctly....  Damn extraneous spaces are annoying  O:)

dougiefresh


Advertisement: