NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

#1 03-09-2011 13:38:16

claws
New member

word filter?

Hi,  I was wondering if there's a way to add a wordfilter to an oekaki. I'm a noob at PHP but dug up a few wordfilter tuts, made a wordfilter file and tried to include it in index.php and comment.php to no avail |D
I also tried hacking the smileys, but then the filtered words showed up along with the images, which would totally give the filter away (I'm thinking about using it for humor, like filtering "wolf" into "cat", "become" into "digivolve" etc)

Offline

#2 03-09-2011 20:50:17

Waccoon
Administrator

Re: word filter?

You can get yourself into a lot of trouble if you don't do it right, but it's fairly easy.

The simplest method is to use str_ireplace(), though maintaining capitalization and dealing with spaces requires more complex techniques, which are definitely not for newbies.  wink

Code:

$search  = array(
    'wolf', 'become',    'Firefox'
);
$replace = array(
    'cat',  'digivolve', 'Telnet'
);

$comment = str_ireplace ($search, $replace, $comment);

Offline

#3 03-09-2011 23:48:19

claws
New member

Re: word filter?

Thank you so much!!
edit:
Where exactly should I plug this in?

Last edited by claws (03-09-2011 23:59:39)

Offline

#4 04-01-2011 23:07:04

isaac-sul
New member

Re: word filter?

You should try plugging in your own parser. You will be able to parse each entry of the text you will let pass through. Use regular expressions so that you could draw patterns and be able to filter words you would not like to appear. With that also, you will be able to tokenize each word and do whatever you want with it.

Offline

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB