Replacing certain censored words with other words, rather than *'s
Hello, everyone! I have been having a bit of a problem, but I think somebody will be able to help me out!
At my forum, I want to have the following filters:
liberal = Capulet
liberals = Capulets
conservative = Montague
conservatives = Montagues
First, I put liberal, liberals, conservative, and conservatives in the vB censorship box.
Then I tried to accomplish my goal by putting the following code in functions.php in the censorship code:
$text = strtolower($text);
if ($text == 'liberals')
{ $text = 'Capulets'; }
else if ($text == 'liberal')
{ $text = 'Capulet'; }
else if ($text == 'conservatives')
{ $text = 'Montagues'; }
else if ($text == 'conservative')
{ $text = 'Montague'; }
It works only if the offending word is the ONLY word in the post. If there is anything else, it simply converts the word to asterisks. Anybody have any suggestions?
|