Version Description
- Added
EAE_FILTER_PRIORITY
constant to adjust default filter priorty
Download this release
Release Info
Developer | tillkruess |
Plugin | Email Address Encoder |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- email-address-encoder.php +16 -8
- readme.txt +23 -11
email-address-encoder.php
CHANGED
@@ -1,16 +1,18 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Email Address Encoder
|
4 |
-
Plugin URI: http://wordpress.org/
|
5 |
Description: A lightweight plugin to protect email addresses from email-harvesting robots by encoding them into decimal and hexadecimal entities.
|
6 |
-
Version: 1.0.
|
7 |
Author: Till Krüss
|
8 |
-
Author URI: http://
|
|
|
9 |
License: GPLv3
|
|
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
-
* Copyright
|
14 |
*
|
15 |
* This program is free software: you can redistribute it and/or modify
|
16 |
* it under the terms of the GNU General Public License as published by
|
@@ -26,24 +28,30 @@ License: GPLv3
|
|
26 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
27 |
*
|
28 |
* @package Email Address Encoder
|
29 |
-
* @copyright
|
30 |
*/
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
/**
|
33 |
* Register filters to encode exposed email addresses in
|
34 |
* posts, pages, excerpts, comments and widgets.
|
35 |
*/
|
36 |
foreach (array('the_content', 'the_excerpt', 'widget_text', 'comment_text', 'comment_excerpt') as $filter) {
|
37 |
-
add_filter($filter, 'eae_encode_emails',
|
38 |
}
|
39 |
|
40 |
/**
|
41 |
* Searches for plain email addresses in given $string and
|
42 |
* encodes them (by default) with the help of eae_encode_str().
|
43 |
-
*
|
44 |
* Regular expression is based on based on John Gruber's Markdown.
|
45 |
* http://daringfireball.net/projects/markdown/
|
46 |
-
*
|
47 |
* @param string $string Text with email addresses to encode
|
48 |
* @return string $string Given text with encoded email addresses
|
49 |
*/
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Email Address Encoder
|
4 |
+
Plugin URI: http://wordpress.org/plugins/email-address-encoder/
|
5 |
Description: A lightweight plugin to protect email addresses from email-harvesting robots by encoding them into decimal and hexadecimal entities.
|
6 |
+
Version: 1.0.4
|
7 |
Author: Till Krüss
|
8 |
+
Author URI: http://till.kruss.me/
|
9 |
+
Text Domain: email-address-encoder
|
10 |
License: GPLv3
|
11 |
+
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
12 |
*/
|
13 |
|
14 |
/**
|
15 |
+
* Copyright 2014 Till Krüss (http://till.kruss.me/)
|
16 |
*
|
17 |
* This program is free software: you can redistribute it and/or modify
|
18 |
* it under the terms of the GNU General Public License as published by
|
28 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
29 |
*
|
30 |
* @package Email Address Encoder
|
31 |
+
* @copyright 2014 Till Krüss
|
32 |
*/
|
33 |
|
34 |
+
/**
|
35 |
+
* Define plugin constants that can be overridden, generally in wp-config.php.
|
36 |
+
*/
|
37 |
+
if (!defined('EAE_FILTER_PRIORITY'))
|
38 |
+
define('EAE_FILTER_PRIORITY', 1000);
|
39 |
+
|
40 |
/**
|
41 |
* Register filters to encode exposed email addresses in
|
42 |
* posts, pages, excerpts, comments and widgets.
|
43 |
*/
|
44 |
foreach (array('the_content', 'the_excerpt', 'widget_text', 'comment_text', 'comment_excerpt') as $filter) {
|
45 |
+
add_filter($filter, 'eae_encode_emails', EAE_FILTER_PRIORITY);
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
* Searches for plain email addresses in given $string and
|
50 |
* encodes them (by default) with the help of eae_encode_str().
|
51 |
+
*
|
52 |
* Regular expression is based on based on John Gruber's Markdown.
|
53 |
* http://daringfireball.net/projects/markdown/
|
54 |
+
*
|
55 |
* @param string $string Text with email addresses to encode
|
56 |
* @return string $string Given text with encoded email addresses
|
57 |
*/
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Email Address Encoder ===
|
2 |
Contributors: tillkruess
|
3 |
-
Donate link:
|
4 |
Tags: antispam, anti spam, spam, email, e-mail, mail, spider, crawler, harvester, robots, spambot, block, obfuscate, obfuscation, encode, encoder, encoding, encrypt, encryption, protect, protection
|
5 |
Requires at least: 2.0
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -33,34 +33,42 @@ This plugin hooks into the WordPress filters like `the_content`, `widget_text` a
|
|
33 |
|
34 |
= How can I make sure the plugin works? =
|
35 |
|
36 |
-
You cannot use Firebug, Web Inspector or Dragonfly, because they decode decimal/hexadecimal entities into plain text. To make sure email addresses are encoded, right
|
37 |
|
38 |
-
= How can I use WP's antispambot() function instead? =
|
39 |
|
40 |
You specify any valid callback function with the `eae_method` filter to apply to found email addresses: `add_filter('eae_method', function() { return 'antispambot'; });`
|
41 |
|
42 |
= How can I filter other parts of my site? =
|
43 |
|
44 |
-
* If the content supports WordPress filters, register the `eae_encode_emails()` function to it: `add_filter($tag, 'eae_encode_emails');`.
|
45 |
-
* If the content is a PHP string, run it through the `eae_encode_emails()` function: `$text = eae_encode_emails($text);`.
|
46 |
-
* If you want to encode a single email address, use the `eae_encode_str()` function: `<?php echo eae_encode_str('
|
47 |
|
48 |
This plugin doesn't encode the entire website for performance reasons, it encodes only the content of the following WordPress filters `the_content`, `the_excerpt`, `widget_text`, `comment_text`, `comment_excerpt`.
|
49 |
|
50 |
= How can I change the regular expression pattern? =
|
51 |
|
52 |
-
You can override [the pattern](http://fightingforalostcause.net/misc/2006/compare-email-regex.php "Comparing E-mail Address Validating Regular Expressions") with the `eae_regexp` filter: `add_filter('eae_regexp', function() { return '/^pattern$/'; });`
|
|
|
|
|
|
|
|
|
53 |
|
54 |
= How can I disable the @-sign check? =
|
55 |
|
56 |
-
Like this: `add_filter('eae_at_sign_check', '__return_false');`
|
57 |
|
58 |
|
59 |
== Changelog ==
|
60 |
|
|
|
|
|
|
|
|
|
61 |
= 1.0.3 =
|
62 |
|
63 |
-
* Added filter to override the function
|
64 |
* Improved randomness of encode-function
|
65 |
* Improved speed by doing fast @-sign existence check
|
66 |
|
@@ -79,6 +87,10 @@ Like this: `add_filter('eae_at_sign_check', '__return_false');`
|
|
79 |
|
80 |
== Upgrade Notice ==
|
81 |
|
|
|
|
|
|
|
|
|
82 |
= 1.0.3 =
|
83 |
|
84 |
Speed and "randomness" improvements.
|
1 |
=== Email Address Encoder ===
|
2 |
Contributors: tillkruess
|
3 |
+
Donate link: https://www.paypal.me/tillkruss
|
4 |
Tags: antispam, anti spam, spam, email, e-mail, mail, spider, crawler, harvester, robots, spambot, block, obfuscate, obfuscation, encode, encoder, encoding, encrypt, encryption, protect, protection
|
5 |
Requires at least: 2.0
|
6 |
+
Tested up to: 4.5
|
7 |
+
Stable tag: 1.0.4
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
33 |
|
34 |
= How can I make sure the plugin works? =
|
35 |
|
36 |
+
You cannot use Firebug, Web Inspector or Dragonfly, because they decode decimal/hexadecimal entities into plain text. To make sure email addresses are encoded, right-/secondary-click the page, click "View Source", "View Page Source" or "Source" and search for any plain text email addresses. In Firefox, be sure to test with "View Source" not "View Selection Source".
|
37 |
|
38 |
+
= How can I use WP's built-in `antispambot()` function instead? =
|
39 |
|
40 |
You specify any valid callback function with the `eae_method` filter to apply to found email addresses: `add_filter('eae_method', function() { return 'antispambot'; });`
|
41 |
|
42 |
= How can I filter other parts of my site? =
|
43 |
|
44 |
+
* If the content supports WordPress filters, register the `eae_encode_emails()` function to it: `add_filter( $tag, 'eae_encode_emails' );`.
|
45 |
+
* If the content is a PHP string, run it through the `eae_encode_emails()` function: `$text = eae_encode_emails( $text );`.
|
46 |
+
* If you want to encode a single email address, use the `eae_encode_str()` function: `<?php echo eae_encode_str( 'name@domain.com' ); ?>`
|
47 |
|
48 |
This plugin doesn't encode the entire website for performance reasons, it encodes only the content of the following WordPress filters `the_content`, `the_excerpt`, `widget_text`, `comment_text`, `comment_excerpt`.
|
49 |
|
50 |
= How can I change the regular expression pattern? =
|
51 |
|
52 |
+
You can override [the pattern](http://fightingforalostcause.net/misc/2006/compare-email-regex.php "Comparing E-mail Address Validating Regular Expressions") with the `eae_regexp` filter: `add_filter( 'eae_regexp', function () { return '/^pattern$/'; } );`
|
53 |
+
|
54 |
+
= How can I change the priorty of the default filters? =
|
55 |
+
|
56 |
+
The default filter priorty is `1000` and you can adjust it by defining the `EAE_FILTER_PRIORITY` constant: `define( 'EAE_FILTER_PRIORITY', 99999 );`. The constant has to be defined before this plugin is loaded, e.g. in your `wp-config.php` or in Must-use plugin (a.k.a. mu-plugin).
|
57 |
|
58 |
= How can I disable the @-sign check? =
|
59 |
|
60 |
+
Like this: `add_filter( 'eae_at_sign_check', '__return_false' );`
|
61 |
|
62 |
|
63 |
== Changelog ==
|
64 |
|
65 |
+
= 1.0.4 =
|
66 |
+
|
67 |
+
* Added `EAE_FILTER_PRIORITY` constant to adjust default filter priorty
|
68 |
+
|
69 |
= 1.0.3 =
|
70 |
|
71 |
+
* Added filter to override the encoding function
|
72 |
* Improved randomness of encode-function
|
73 |
* Improved speed by doing fast @-sign existence check
|
74 |
|
87 |
|
88 |
== Upgrade Notice ==
|
89 |
|
90 |
+
= 1.0.4 =
|
91 |
+
|
92 |
+
Added constant to adjust default filter priorty.
|
93 |
+
|
94 |
= 1.0.3 =
|
95 |
|
96 |
Speed and "randomness" improvements.
|