內容簡介
Pixeline's Email Protector 外掛提供一種高效且不干擾的方式來保護電子郵件地址,防止被垃圾郵件收集器和機器人抓取。使用者可以在文章中以正常格式撰寫電子郵件,外掛將自動進行混淆處理,確保人類訪客能夠正常使用。
【主要功能】
• 自動混淆電子郵件地址
• 兼容 JavaScript 顯示可點擊的郵件連結
• 支援主題文件中的電子郵件保護
• 可自訂可見連結文字
• 簡單易用的設置流程
外掛標籤
開發者團隊
原文外掛簡介
This plugin provides an unobtrusive yet efficient protection against email harvesters / spambots.
Post/page authors may write email addresses in their article in the usual format (“[email protected]”) without exposing them to spam email harvesters. The plugin takes care of the obfuscation, implementing a graceful degradation technique focusing on usability so as to protect your email addresses from harvesters while keeping them usable to your human visitors.
The plugin replaces any email address found in posts, pages, comments and excerpts, and replace them by a bit of html markup that should deceive most email harvesters: john(replace the parenthesis by @)doe.com.
If javascript is available, it will display a clickable link and display the original email to the human user. Maximum usability, maximum protection.
Please rate the plugin if you like it.
Usage
Write your email addresses inside your posts and pages as usual. When the plugin is activated, it will replace them by a human-readable html string that explains how to deduce the email address, and if javascript is available (99.9% of the time), the original email address will be displayed as a clickable mailto: link. For example:
Hello [email protected]. How are you today?
will become
John( replace these parenthesis by @ )doe.com.
Additionally, you can specify what the mailto: link should look like by sticking a parenthesis inside of which you put the visible link text, like this:
Hello [email protected](John Doe). How are you today?
will become
John( replace these parenthesis by @ )doe.com.
inside a theme
If you need to protect emails inside your Theme’s files (like the footer.php for example), you can use the function safe_email() like this:
echo safe_email('[email protected]');
Theme-safe alternative (plugin can be disabled)
If your theme must keep working even when this plugin is disabled, use a wrapper in your theme (for example in functions.php) and call that wrapper everywhere instead of calling safe_email() directly.
if ( ! function_exists( 'theme_safe_email' ) ) {
function theme_safe_email( $email, $label = '' ) {
$email = sanitize_email( $email );
if ( '' === $email ) {
return '';
}
if ( function_exists( 'safe_email' ) ) {
$payload = $email . ( '' !== $label ? '(' . $label . ')' : '' );
return safe_email( $payload );
}
$encoded_email = antispambot( $email );
$link_label = '' !== $label ? $label : $encoded_email;
return '' . esc_html( $link_label ) . '';
}
}
Contribute
Github repo: https://github.com/pixeline/pixeline-email-protector
