The SpamSpan module should provide a filter function that can be used from other modules. To achieve this I have refactored the spamspan_callback function and added a function _spamspan_encode_adr that is used by spamspan_callback and a function spamspan_encode that also uses _spamspan_encode_adr.

Since _spamspan_encode_adr expects two parameters (user and domain part of the mail address) and spamspan_encode should have only one parameter I tried to split the mail address in two parts by searching for the @-sign. Maybe there is a better way to do this.

I have no idea how to use the format settings that are specified for the input filters. The Invisimail module has the same behaviour with its invisimail_ascii_encode function. There also the default format settings are used when invoked from another module. Maybe this is a general problem.

I have generated a patch against 5.x-1.0. Comments are welcome.

CommentFileSizeAuthor
#5 spamspan_1.patch1.5 KBAnonymous (not verified)
#2 spamspan_0.patch1.62 KBAnonymous (not verified)
spamspan.patch1.62 KBAnonymous (not verified)

Comments

Anonymous’s picture

Status: Active » Needs review

To demonstrate the usage of this patch I also patched the E-Mail field module for CCK. See the corresponding issue there.

Anonymous’s picture

StatusFileSize
new1.62 KB

The old patch had a wrong function call in it. Here is the cleaned up version.

emdalton’s picture

I applied both this patch and the CCK email one and I am still not seeing obfuscation in CCK email fields. I do see obfuscation in regular nodes in which an email address appears (except when the user has entered mailto tags).

Anonymous’s picture

Version: 5.x-1.0 » 5.x-1.3
Status: Needs review » Reviewed & tested by the community

This patch has now been around for almost half a year and there have been three additional releases of spamspan since the opening of this issue. I would really appreciate having it included in a new release.

Anonymous’s picture

StatusFileSize
new1.5 KB

adjustments for 1.3

lakka’s picture

Status: Reviewed & tested by the community » Needs work

Thanks for your comments and the patch. I have been playing with this for some time, but I really do not see how it fits in here. The patch ignores the format settings (which means that users calling the function will not get back what they expect), and it provides no way for the relevant javascript to be incorporated into the page (for example, if the spamspan module is not enabled).

Precisely how do you envisage your new function being used by users or developers?

Finally, the patch is backwards. Please can you correct it?

I'm happy to talk about how this might be used - I can see potential, but I'm just not sure it's ready to be committed yet.

lakka’s picture

On reflection, won't replacing this line:

function spamspan ($string, $format) {

with this one (untested!):

function spamspan ($string, $format=-1) {

do what you want? You can then convert an email address like this:

spamspan ($string) {

or have I missed the point?

Anonymous’s picture

Thanks for your comments. Your suggested change might indeed work for me. I'm going to test it and report my findings.

emdalton’s picture

Last time I tried the CCK patch it broke my CCK email listings (I got white screens on any pages that included a CCK Email field), so I'm waiting to hear what will happen after your current round of testing.

lakka’s picture

Status: Needs work » Closed (fixed)

Seems to be inactive - assumed fixed