Documentation

Obfuscation methods that come with the package

HTML character references (default)

This add-on uses the following obfuscation method by default:

  • @ letters will be replaced in all email addresses with (at)
  • The whole e-mail string, e.g. email(at)address.com, will be obfuscated with the HTML character references, so the example address would translate in the source to:
    • email@address
      .com
  • mailto-links will be modified to #MAIL:obfuscated_email_address
    • The default obfuscation method is the same as for the plain e-mail addresses
  • For doing the deobfuscation, all email links (a element) will be given class name obfuscated_link
  • The email addresses inside the link and also email addresses outside any links will be wrapped inside a span element with the class name obfuscated_link_text

If this is not strong enough for you, you're free to write your own obfuscation method, guide is provided below.

RTL form of the emails

If you want to use the rtl-obfuscation method you need to add the following to your site/config.php:

define('EMAIL_OBFUSCATION_METHOD', 'rtl');

This method works as follows:

  • All the emails (e.g. [email protected]) are reversed so the result would be [email protected]
  • For all the mailto-link hrefs, "mailto:" is replaced with "#MAIL:" so that users will not be trying to send mail to the wrong address
  • The JavaScript deobfuscator converts the rtl text back to normal text for easier copy pasting for users

Vigenere cipher

The vigenere cipher obfuscation method is strong enough to fool any bots. Thanks to user mnakalay it is now available also for the Automatic Email Obfuscator! He was also one of the first people to put the extendable obfuscation method architecture to the test.

More information about the encryption algorithm is available from Wikipedia.

This method does not work without JavaScript!

If you want to use the Vigenere cipher method you need to add the following to your site/config.php:

define('EMAIL_OBFUSCATION_METHOD', 'vigenere');

Not pleased with the default obfuscation methods?

If you believe the default obfuscation methods are not strong enough, don't worry. You're free to easily write your own. It is done by writing your own email obfuscator or overriding the old obfuscation classes.

It is suggested to write your own method at this point. This is done by adding your obfuscation class under /libraries/ and namig it "email_obfuscator_yourmethod.php".

The class should look something like this:

<?php
Loader::library("email_obfuscator_default", "automatic_email_obfuscator");
class EmailObfuscatorYourmethod extends EmailObfuscatorDefault {

	public function on_page_view() {
		// Optional method
	}

	public function obfuscateMail($email) {
		// TODO: Write here the function to obfuscate mail addresses inside and outside links
		return $email;
	}

	public function obfuscateMailtoLinkHref($href) {
		// TODO: Write here your links mailto-link href obfuscation
		return str_replace("mailto:", "#", $href);
	}
}

After you have written your obfuscator class, just add the following to your config/site.php:

define('EMAIL_OBFUSCATION_METHOD', 'yourmethod');

Please make sure that your file is named accordingly to your class name, so that EmailObfuscatorYourmethod would be stored in a file named email_obfuscator_yourmethod.php. Also, please ensure that this file can really be found from the libraries-folder, otherwise you will see a PHP error.

Writing your own  client side deobfuscation script

If your obfuscation method needs client side deobfuscation, you can do this by loading your javascript in the "on_page_view" method of your obfuscator class:

public function on_page_view() {
	$html = Loader::helper("html");
	$v = View::getInstance();
	$v->addHeaderItem($html->javascript("email_deobfuscator_yourmethod.js"));
}

After adding this to your obfuscator you can easily write your deobfuscator js:

(function($){

$(document).ready(function() {
	$("a.obfuscated_link").deobfuscateEmailLink();
	$("span.obfuscated_link_text").deobfuscateEmailLink();
});
$.fn.deobfuscateEmailLink = function() {
	$(this).each(function() {
		// TODO: Your deobfuscation method here
	});
};

})(jQuery);