joinbox/email-obfuscator
Composer 安装命令:
composer require joinbox/email-obfuscator
包简介
Obfuscate emails any and everywhere
README 文档
README
The Drupal Email Obfuscator Module uses a middleware get rendered content from each request. The content is searched for emails with regexes. The emails are obfuscated depending on where the text is found.
Obfuscations
Emails in a Mailto-Link
Example: <a href="mailto:test@email.com">
- The email string excluding
mailto:is reversed - An onfocus and an onmousedown are added which re-reverse the email after the
mailto:. These two events cover the following cases: right-click, left-click and focus with tab. (onfocus would do it for most browsers, but Safari needs onmousedown.)
The re-reverse is only done once in order to avoid reversing back to the reversed email
All other Emails
Example: <a>test@email.com</a>
- A span with
display:nonecontaining a text with delimiters that are invalid email characters is added in the middle of the email
Exclusions
- Any email that is invalid (according to PHP's
filter_varfunction) - Everything in the backoffice (admin pages)
- Emails inside HTML-attributes (placeholder for input fields)
- Exclude Ajax webform request:
- Because Ajax is usually used when sending a web form.
This means that the request does not contain HTML, but a JSON object in which HTML is encoded with Unicode.
The regex does not apply here and it is not necessary to obfuscate this email address as it is added by the sender.
- Because Ajax is usually used when sending a web form.
- Content in routes that are whitelisted (see below)
Whitelisting Routes
- Define whitelisted (excluded) routes in settings.php
$settings['email_obfuscator'] = [ 'route_whitelist' => [ 'rest.api_layout_footer.GET', 'editor.link_dialog' ] ];
- IMPORTANT: If you are using CKEditor 4 you should whitelist the route
editor.link_dialogto avoid obfuscating the email in the CKEditor link dialog.
Disabling use of data-nosnippet
- The attribute data-nosnippet is used by default, to disable displaying the $displayNoneText in search results.
It is possible to disable it in settings.php
$settings['email_obfuscator'] = [ 'use_datanosnippet' => FALSE, ];
- IMPORTANT: The data-nosnippet attribute is officially supported ONLY by the Googlebot. Support from other bots is not guaranteed.
joinbox/email-obfuscator 适用场景与选型建议
joinbox/email-obfuscator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 806 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 03 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 joinbox/email-obfuscator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 joinbox/email-obfuscator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 806
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2023-03-29