beastbytes/emailobfuscator
最新稳定版本:v1.0.0
Composer 安装命令:
composer require beastbytes/emailobfuscator
包简介
Widget to obfuscate email addresses
README 文档
README
Widget to obfuscate an email address to help prevent harvesting by spam bots.
If JavaScript is disabled on the client, the widget will output either a message or an obfuscated version of the email address.
If JavaScript is enabled the output is replaced with (by default) a mailto link showing (again by default) the email address. The content of the mailto link can be customised.
For license information see the LICENSE file.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist beastbytes/emailobfuscator
or add
"beastbytes/emailobfuscator": "^1.0"
to the require section of your composer.json.
Usage
Use this extension in a view.
To output the default message ("This e-mail address is protected to prevent harvesting by spam-bots")
echo EmailObfuscator::widget([ 'email' => 'my.address@example.com' ]);
Output
JavaScript Disabled
<span id="w0">This e-mail address is protected to prevent harvesting by spam-bots</span>
JavaScript Enabled
<span id="w0"><a href="mailto:my.address@example.com">my.address@example.com</a></span>
To output a different message set content['obfuscated']
echo EmailObfuscator::widget([ 'email' => 'my.address@example.com', 'content' => ['obfuscated' => 'Enable JavaScript to see the email address'] ]);
Output
JavaScript Disabled
<span id="w0">Enable JavaScript to see the email address</span>
JavaScript Enabled
<span id="w0"><a href="mailto:my.address@example.com">my.address@example.com</a></span>
To output an obfuscated version of the email address set the obfuscators: "my dot address at example dot com"
echo EmailObfuscator::widget([ 'email' => 'my.address@example.com', 'obfuscators' => [' dot ', ' at '] ]);
Output
JavaScript Disabled
<span id="w0">my dot address at example dot com</span>
JavaScript Enabled
<span id="w0"><a href="mailto:my.address@example.com">my.address@example.com</a></span>
To set the content of the mailto link, set content['clear']
echo EmailObfuscator::widget([ 'email' => 'my.address@example.com', 'content' => ['clear' => 'by email'] ]);
Output
JavaScript Disabled
<span id="w0">This e-mail address is protected to prevent harvesting by spam-bots</span>
JavaScript Enabled
<span id="w0"><a href="mailto:my.address@example.com">by email</a></span>
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2023-08-14