Categories
Package/plugin/module WordPress

Plugin: Obfuscate E-mail

This plugin has been updated! Comments to this post are now closed. For the latest download, documentation, and link for posting new comments related to this plugin, visit the plugin’s new homepage at:
coffee2code.com/wp-plugins/obfuscate-email
Name:
Obfuscate E-mail
Author:
Scott Reilly
Version:
0.9
Last updated:
24 March 2005
Description:

Obfuscate e-mail addresses in text and links via random hex and ASCII code substitution while retaining the appearance and functionality of hyperlinks.

Notes:

Example (of full obfuscation):

<a href="mailto:person@example.com">person@example.com</a>

Would be translated into something like this:
<a href="mailto:&#112;&#101;&#114;&#115;&#x6F;&#110;&#x40;&#101;&#x78;&#x61;&#x6D;&#112;&#x6C;&#101;&#x2E;&#x63;om">&#112;&#x65;&#x72;&#x73;&#111;&#110;&#64;&#x65;&#x78;&#x61;&#109;&#x70;&#108;&#x65;&#x2E;&#99;om</a>

However, in your browser it would appear to you as it does prior to obfuscation, and the link for the e-mail would still work. Theorectically, however, spammers would have a somewhat more difficult time harvesting the e-mails you display or link to in your posts.

Installation:
  1. Download the file obfuscate-email.zip and unzip it into your /wp-content/plugins/ directory.
    -OR-
    Copy and paste the the code ( obfuscate-email.phps ) into a file called obfuscate-email.php, and put that file into your /wp-content/plugins/ directory. Please ensure you do not introduce any spaces or other characters before the <?php or after the ?>
  2. Optional: Change configuration options in the file to your liking. In-code comments should help you there.
  3. Activate the plugin from your WordPress admin ‘Plugins’ page.
Functions:

function c2c_obfuscate_email( $text, $encode_everything = 1 )

  • $text : Text to be scanned for e-mail obfuscation
  • $encode_everything: optional; if 1 then full obfuscation (as seen in the Notes section) will occur. If set to 0, then only very minimal obfuscation occurs, i.e. “@” gets replaced with &#064; and “.” gets replaced with &#046;
Tips & Examples:

(See notes section above)

Release Log:
  • 24 Mar 2005 : v0.9 — Released to the public
Copyright & Disclaimer:

Copyright (c) 2005 by Scott Reilly (aka coffee2code)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Acknowledgements:
N/A

18 replies on “Plugin: Obfuscate E-mail”

Mads: Yes, it works on pages in WP.

Pariah: Actually, it does apply to comments. I simply didn’t have the plugin activated on my site. It is now, so feel free to test again.

Simpler Solution:

Just copy this where ever you need it


$email_address = "foo@bar.com";
$email_address = substr( chunk_split( bin2hex( " ".$email_address ), 2, ";&amp;#x" ), 3,-3);

It’s a wonderful plugin.

For several reasons I have put email-addresses in the post meta (such as post_custom(’email’)). They will be published later like

echo post_custom(’email’);
echo ‘” TARGET=”_blank”>Email

Is there any way your plugin can manage this (it does not work with 2.1.3)?

Thanks
Tom

Comments are closed.