public
Description: The Hivelogic Enkoder Rails Plugin
Homepage: http://hivelogic.com/enkoder
Clone URL: git://github.com/dan/hivelogic-enkoder-rails.git
Click here to lend your support to: hivelogic-enkoder-rails and make a donation at www.pledgie.com !
dan (author)
Sat May 23 05:43:05 -0700 2009
commit  0bb874722502eb6f49bd5ded6ac6cc636106d80e
tree    df1cd82372bf43ffbf8ef134b9fda8578f2d9fe0
parent  fbbf0dd19f5e684116934fedf36b21c1a2baf206
name age message
file LICENSE Sat May 23 05:41:10 -0700 2009 First commit [dan]
file README.textile Sat May 23 05:43:05 -0700 2009 Fixing the license. [dan]
file init.rb Sat May 23 05:41:10 -0700 2009 First commit [dan]
directory lib/ Sat May 23 05:41:10 -0700 2009 First commit [dan]
README.textile

Hivelogic Enkoder

The Enkoder plugin provides an extension to TextHelper that can be used to
protect email addresses (or other information) by obfuscating them using
JavaScript code. The only way to decrypt the JavaScript is to actually run it,
hiding the results from email-harvesting robots while revealing them to real
people.

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.

Installation:

Just drop the “enkoder” folder into the /vendor/plugins folder in your project.

Usage:

There are two methods:

enkode( html )

This method accepts a block of html (or any text) and returns an enkoded JavaScript.

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.

Examples:

To enkode a single email address, one could just do:

<%= enkode_mail(‘user@domain.com’,‘click here’) %>

And the following link would be returned (enkoded as JavaScript):

<a href=“mailto:”user@domain.com" title="">click here

Adding a title and subject text would require the second two optional fields:

<%= enkode_mail(‘user@domain.com’,‘click here’, ‘email me’, ‘enkoder’) %>

And we’d get back (enkoded as JavaScript):

<a href=“mailto:”user@domain.com?subject=enkoder" title=“email me”>click here

Of course we can also enkode many email addresses on the fly:

<% users.each do |user| %> <p><%= enkode_mail(user.email,@user.name) >


< end %>

To enkode a snippet of XHTML, we can do:

<%= enkode(“

This block will be hidden from spambots.

”) %>

We could protect a link or block of XHTML from being indexed like this:

<%= enkode(‘Try and find this, 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:

http://hivelogic.com/enkoder

License:

Copyright © 2009 Hivelogic Corporation

This plugin is released under the GPL license. See LICENSE file for details.