I'm using the censored words feature as a way of getting rid of kiddie-talk on my forum (eg. "u" -> "you", "r" -> "are", etc).
However, I've got a problem in that underline tags [ u ] are being changed to [you] which obviously stops them working.
I had a quick look at the word censor code but I'm not very hot on regular expressions - how can I modify it not to replace words within square brackets?
See this part in Sources/Load.php?
'/\b' . $censor_vulgar[$i] . '\b/'
Change it to, erm...
'/(?<=[A-Za-z0-9\.,!?]|^)' . $censor_vulgar[$i] . '\b/'
This is assuming you have "censor whole word" on.
Untested, mind you, but it should work.
-[Unknown]
Thanks - that works so far as fixing [ u ], but unfortunately it also seems to break the Whole Word Only setting, and now all the "u" characters in every word are getting replaced :D
--EDIT--
I figured it out. In case anyone else wants to know, the regexp that works is:
'/(^|[^\[\/])\b' . $censor_vulgar[$i] . '\b/'
and I had to change the line underneath to:
$censor_proper[$i] = "\\1" . $censor_proper[$i];
I have the same problem, I'm banning the word d, n, k, because it's a form of text-messaging lingo in my language. "d" should be "diri" which means "here" in english, "n" should be "na" which means already and so forth
my problem with censoring "d" all by it self is that when someone post in english using the contraction you'd, the d in you' is filtered out.
in addition, when I use the "Ignore case when censoring" option, the d in smiley :D is also filtered.
Thanks in advance!!
Lainaus käyttäjältä: orange - toukokuu 03, 2004, 08:12:25 AP
Thanks - that works so far as fixing [ u ], but unfortunately it also seems to break the Whole Word Only setting, and now all the "u" characters in every word are getting replaced :D
--EDIT--
I figured it out. In case anyone else wants to know, the regexp that works is:
'/(^|[^\[\/])\b' . $censor_vulgar[$i] . '\b/'
and I had to change the line underneath to:
$censor_proper[$i] = "\\1" . $censor_proper[$i];
How do I add the ' in this array?
i sensor the single letter "d" but when added to i'd or you'd the filter doesn't recognize it as part of the prefix