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).
- Yii 1.0.11 or above
- Extract the release file under
- Add the class as a component in your application's main.php config file.
'components'=>array( ... 'obfuscator'=>array(
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:
Without a link:
<?php echo Yii::app()->obfuscator->disguise('email@example.com',true); ?>
<?php echo Yii::app()->obfuscator->disguise('firstname.lastname@example.org',false); ?>
Change Log ¶
February 2, 2010 ¶
- Initial release.