obfuscator Obfuscates email addresses in the source, but presents valid address to user.

  1. Documentation
  2. Change Log

This extension is designed to protect email addresses from harvesting by spambots, through obfuscation. It then uses jQuery to clarify the email address, presenting a valid email address to the user (optionally in a mailto: link).

Resources

Documentation

Requirements
  • Yii 1.0.11 or above
Installation
  • Extract the release file under protected/extensions
  • Add the class as a component in your application's main.php config file.

Config code:

'components'=>array(
  ...
  'obfuscator'=>array(
'class' =>'application.extensions.obfuscator.Obfuscator',

), ... ),

Usage

The class has a single public function: disguise(). This function takes 2 parameters:

  • $email (string): The email address to be obfuscated
  • $link (bool): Whether the email address should be displayed to the user as a mailto link - default is 'true'

Wherever you want an email address inserted, call the disguise function according to the following examples:

With a mailto link:

<?php echo Yii::app()->obfuscator->disguise('email@example.com',true); ?>
Without a link:
<?php echo Yii::app()->obfuscator->disguise('email@example.com',false); ?>

Change Log

February 2, 2010
  • Initial release.
3 0
4 followers
576 downloads
Yii Version: 1.1
License: GPL-3.0
Category: Others
Tags:
Developed by: M Wotton
Created on: Feb 3, 2010
Last updated: 14 years ago

Downloads

show all