Add a way to change the "[dot]" replacement text

jlkreiss - December 9, 2008 - 16:15
Project:SpamSpan filter
Version:HEAD
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Wouldn't it be nice if one could change the "[dot]" replacement text in the filter configuration form, like for the "[at]" replacement text ? And maybe one day make these texts translation-aware ?
Because in other countries, people not always understand even simple english words as "at" or "dot"... We in France have "arobase" for "at" in email addresses, as an example. See the matter ?

Thanks a lot and have nice Drupal hacking...

#1

ositoblanco - April 21, 2009 - 19:44
Version:6.x-1.2» HEAD

+ subscribing

And may you also add a option that allows to show a help which says "replace [at] by @ and [dot] by ." and hide this help with js. ... otherwise I don't think my grand parents will be able to send me a mail ;)

#2

naught101 - July 3, 2009 - 07:34

+1, if only because I want to remove the spaces...

#3

pentike - July 15, 2009 - 19:13
Status:active» patch (to be ported)

Hi!

This patch adds a field to the admin page where the user can set the "[dot]" text just like the "[at]".

The patch is against 5.x-1.4
Hope it will be useful :)

Cheers, Gábor
www.zeneszapro.hu

AttachmentSize
spamspan.module.patch 1.29 KB

#4

naught101 - July 16, 2009 - 02:02
Status:patch (to be ported)» needs work

Thanks Gábor,

I'm working on getting this to work with drupal six, and it does when javascript is off, but when it's on, it doesn't replace the new "." replacement properly (because it's looking for "[dot]" instead).

here's the .module patch for 6.x, I'll see if I can fix the js problem.

AttachmentSize
spamspan.module.patch 1.35 KB

#5

naught101 - July 16, 2009 - 02:49
Status:needs work» needs review

Ok, this patch also draws the spamspan_dot variable into Drupal.settings.spamspan.p (for period, or point), and uses that in the javascript file to create a regex string to to be replaced (globally).

I tried to re-compress the .js, but it didn't end up on a single line... anyway, it works now.

AttachmentSize
spamspan.patch 3.93 KB

#6

pentike - July 16, 2009 - 13:10

Hi!

I have backported your patch to 5.x-1.4, but found that when the replacement string contains some regex characters [ ] { }, the js fails.
I found a code at http://simonwillison.net/2006/Jan/20/escape/ what escapes these strings properly. Maybe this would be a nice functionality in core as well (maybe it's already there, but i could not find it).

This patch is for 5.x-1.4

Cheers, Gábor
www.zeneszapro.hu

AttachmentSize
spamspan.patch 5.15 KB

#7

naught101 - July 27, 2009 - 01:05

I can't get that to work for 6, probably because I don't know much javascript, and I'm doing something wrong.

Also, you need to switch these lines around:

                .replace(/\s+/g, '');
                .replace(dot_regex, '.')

Otherwise if the regex has a space in it, it won't match.

 
 

Drupal is a registered trademark of Dries Buytaert.