Another approach is to do some shuffling of the addresses with
javascript: check here:
http://my.gr-navigator.com/eeg/2008/02/18/a-piece-of-cake-javascript-email-cloaking-for-cakephp/

On Feb 6, 8:29 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> On Feb 6, 2008 5:25 AM, cronet <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > In the template engine smarty, there exists an protection which
> > encodes the address e.g. in hex chars. So the address isn't grabbable
> > by spam bots via source...
>
> > is there something like an e-Mail Spam protection or do I need to
> > create a helper?
>
> Hex translation probably won't help against bots anymore. It's a
> trivial task to implement a bot that can translate hex. What I've been
> doing is translating email addresses as they're written to output like
> so:
>
> [EMAIL PROTECTED] -> <span class="Obfuscated">foo AT bar DOT net</span>
>
> Then, on the client side, I have some javascript that trawls through
> each page for these spans and rewrites them as proper links. I doubt
> there are any bots out there with a javascript engine, so this is
> probably pretty safe. If javascript is disabled, the address is still
> fairly understandable.
>
> Here's the version that doesn't require any extra libraries (pretty
> straightforward to convert this to work with, say, prototype, etc.):
>
> /**
>  * from Simon Willison
>  *
>  *http://simon.incutio.com/archive/2004/05/26/addLoadEvent
>  **/
> function addLoadEvent(func)
> {
>   var oldonload = window.onload;
>   if (typeof window.onload != 'function')
>   {
>     window.onload = func;
>   }
>   else
>   {
>     window.onload = function()
>     {
>       oldonload();
>       func();
>     }
>   }
>
> }
>
> addLoadEvent(function()
> {
>         var emails = document.getElementsByClassName('span', 'Obfuscated');
>
>         if (!emails) return;
>
>         var title = '';
>         var search = [' AT ', ' DOT '];
>         var replace = ['@', '.'];
>         var replaced_text = '';
>
>         for (var i = 0; i < emails.length; i++)
>         {
>                 /* get the text node
>                  */
>                 var text = emails[i].childNodes[0];
>
>                 if (text)
>                 {
>                         /* search & replace text
>                          */
>                         replaced_text = text.nodeValue;
>
>                         for (var j = 0; j < search.length; j++)
>                         {
>                                 var reg_exp = new RegExp(search[j], 'g');
>                                 replaced_text = 
> replaced_text.replace(reg_exp, replace[j]);
>                         }
>
>                         /* create anchor node
>                          */
>                         var link = document.createElement('a');
>                         link.setAttribute('title', title);
>                         link.setAttribute('href', 'mailto:' + replaced_text);
>
>                         /* create new text node and append to anchor
>                          */
>                         var text_node = 
> document.createTextNode(replaced_text);
>
>                         link.appendChild(text_node);
>
>                         /* swap in anchor for text
>                          */
>                         emails[i].replaceChild(link, emails[i].childNodes[0]);
>                 }
>         }
>
> });
>
> Whether you do the server-side stuff as a helper or not i can't say
> because i haven't got there yet (still a Cake noob).

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to