The Enkoder plugin provides an extension to TextHelper that can be used to
protect email addresses (or other information) by obfuscating them using
hiding the results from email-harvesting robots while revealing them to real
It uses a significantly different (and some might say more secure) algorithm
than the built-in mail_to helper.
Note: There’s no guarantee here — the only way to be completely safe is to not
publish your address at all.
Just drop the “enkoder” folder into the /vendor/plugins folder in your project.
There are two methods:enkode( html )
The second method is:enkode_mail( email, link_text, title_text=nil, subject=nil )
This method takes an email address, the text to show to the viewer, optional
title text (what’s seen when somebody hovers over the link), and optional
subject for the email, and returns an enkoded email address link.
To enkode a single email address, one could just do:<%= enkode_mail('firstname.lastname@example.org’,'click here’) %>
Adding a title and subject text would require the second two optional fields:<%= enkode_mail('email@example.com’,'click here’, 'email me’, 'enkoder’) %>
Of course we can also enkode many email addresses on the fly:<%
users.each do |user| %> <p><%= enkode_mail(user.email,@user.name) %></p> <% end %>
To enkode a snippet of XHTML, we can do:<%= enkode(”<p>This block will be hidden from spambots.</p>”) %>
We could protect a link or block of XHTML from being indexed like this:<%= enkode('Try and find <a href=“secret.html”>this</a>, google!’) %>
We could have anything we wanted in that block, XHTML, links, email addresses, etc.
For more examples and to see the full functionality of the Enkoder, have a look
its permanent page on the web:
Copyright© 2009 Hivelogic Corporation
This plugin is released under the GPL license. See LICENSE file for details.