pfarrer/yii2-email-obfuscator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pfarrer/yii2-email-obfuscator

Composer 安装命令:

composer require pfarrer/yii2-email-obfuscator

包简介

Yii2 extension to obfuscate eMail addresses.

README 文档

README

Email obfuscatior plugin for Yii2.

This plugin combines some Email obfuscation technics.

  • The @ char is removed and only its index is passed on. It will be reinserted using the expression String.fromCharCode(422*4).
  • The address itself will be transmitted as a ROT13 transformed string which will be retransformed by Javascript.
  • The "mailto:" prefix is decoded as a reversed string which gets unreversed by Javascript.

The Email address "mail@example.com" will result in the following code:

<script type="text/javascript">
var action=":otliam".split("").reverse().join("");
var href="znvyrknzcyr.pbz".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);});
href=href.substr(0, 4) + String.fromCharCode(4*2*2*4) + href.substr(4);
var a = "<a href=\""+action+href+"\">"+href+"</a>";
document.write(a);
</script>

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require "pfarrer/yii2-email-obfuscator" "dev-master"

or add

"pfarrer/yii2-email-obfuscator": "dev-master"

to the require section of your composer.json file.

Usage

Simply insert this in your template:

<?= \pfarrer\yii2\email\Obfuscator::widget([
	'email' => 'mail@example.com',
]) ?>

统计信息

  • 总下载量: 7.75k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2014-08-17