Version Description
- Added filter to override the regular expression.
Download this release
Release Info
Developer | tillkruess |
Plugin | Email Address Encoder |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- email-address-encoder.php +14 -7
- readme.txt +11 -1
email-address-encoder.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Email Address Encoder
|
4 |
Plugin URI: http://wordpress.org/extend/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.
|
7 |
Author: Till Krüss
|
8 |
Author URI: http://tillkruess.com/
|
9 |
License: GPLv3
|
@@ -38,9 +38,8 @@ foreach (array('the_content', 'the_excerpt', 'widget_text', 'comment_text', 'com
|
|
38 |
}
|
39 |
|
40 |
/**
|
41 |
-
*
|
42 |
-
*
|
43 |
-
* the help of eae_encode_str().
|
44 |
*
|
45 |
* Regular expression is based on based on John Gruber's Markdown.
|
46 |
* http://daringfireball.net/projects/markdown/
|
@@ -51,8 +50,11 @@ foreach (array('the_content', 'the_excerpt', 'widget_text', 'comment_text', 'com
|
|
51 |
* @return string $string Given text with encoded email addresses
|
52 |
*/
|
53 |
function eae_encode_emails($string) {
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
56 |
(?:mailto:)?
|
57 |
(?:
|
58 |
[-!#$%&*+/=?^_`.{|}~\w\x80-\xFF]+
|
@@ -65,13 +67,18 @@ function eae_encode_emails($string) {
|
|
65 |
|
|
66 |
\[[\d.a-fA-F:]+\]
|
67 |
)
|
68 |
-
}xi'
|
|
|
|
|
|
|
|
|
69 |
create_function(
|
70 |
'$matches',
|
71 |
'return eae_encode_str($matches[0]);'
|
72 |
),
|
73 |
$string
|
74 |
);
|
|
|
75 |
}
|
76 |
|
77 |
/**
|
3 |
Plugin Name: Email Address Encoder
|
4 |
Plugin URI: http://wordpress.org/extend/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.2
|
7 |
Author: Till Krüss
|
8 |
Author URI: http://tillkruess.com/
|
9 |
License: GPLv3
|
38 |
}
|
39 |
|
40 |
/**
|
41 |
+
* Searches for plain email addresses in given $string and
|
42 |
+
* encodes them 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/
|
50 |
* @return string $string Given text with encoded email addresses
|
51 |
*/
|
52 |
function eae_encode_emails($string) {
|
53 |
+
|
54 |
+
// Use the 'eae_regexp' filter to override
|
55 |
+
$regexp = apply_filters(
|
56 |
+
'eae_regexp',
|
57 |
+
'{
|
58 |
(?:mailto:)?
|
59 |
(?:
|
60 |
[-!#$%&*+/=?^_`.{|}~\w\x80-\xFF]+
|
67 |
|
|
68 |
\[[\d.a-fA-F:]+\]
|
69 |
)
|
70 |
+
}xi'
|
71 |
+
);
|
72 |
+
|
73 |
+
return preg_replace_callback(
|
74 |
+
$regexp,
|
75 |
create_function(
|
76 |
'$matches',
|
77 |
'return eae_encode_str($matches[0]);'
|
78 |
),
|
79 |
$string
|
80 |
);
|
81 |
+
|
82 |
}
|
83 |
|
84 |
/**
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: tillkruess
|
|
3 |
Tags: antispam, anti spam, spam, email, e-mail, mail, spider, crawler, harvester, robots, spambot, block, obfuscate, obfuscation, encode, encoder, encoding, encrypt, encryption, protect, protection
|
4 |
Requires at least: 2.0
|
5 |
Tested up to: 3.3
|
6 |
-
Stable tag: 1.0.
|
7 |
|
8 |
A lightweight plugin to protect email addresses from email-harvesting robots by encoding them into decimal and hexadecimal entities.
|
9 |
|
@@ -18,6 +18,8 @@ To manually encode an single email address use the `eae_encode_str()` function:
|
|
18 |
|
19 |
To manually encode all email addresses in a string pass it through the `eae_encode_emails()` function: `<?php echo eae_encode_emails($text); ?>`
|
20 |
|
|
|
|
|
21 |
|
22 |
== Installation ==
|
23 |
|
@@ -30,6 +32,10 @@ For detailed installation instructions, please read the [standard installation p
|
|
30 |
|
31 |
== Changelog ==
|
32 |
|
|
|
|
|
|
|
|
|
33 |
= 1.0.1 =
|
34 |
|
35 |
* Effects now also page, post and comment excerpts
|
@@ -41,6 +47,10 @@ For detailed installation instructions, please read the [standard installation p
|
|
41 |
|
42 |
== Upgrade Notice ==
|
43 |
|
|
|
|
|
|
|
|
|
44 |
= 1.0.1 =
|
45 |
|
46 |
Effects now also page, post and comment excerpts.
|
3 |
Tags: antispam, anti spam, spam, email, e-mail, mail, spider, crawler, harvester, robots, spambot, block, obfuscate, obfuscation, encode, encoder, encoding, encrypt, encryption, protect, protection
|
4 |
Requires at least: 2.0
|
5 |
Tested up to: 3.3
|
6 |
+
Stable tag: 1.0.2
|
7 |
|
8 |
A lightweight plugin to protect email addresses from email-harvesting robots by encoding them into decimal and hexadecimal entities.
|
9 |
|
18 |
|
19 |
To manually encode all email addresses in a string pass it through the `eae_encode_emails()` function: `<?php echo eae_encode_emails($text); ?>`
|
20 |
|
21 |
+
To override the regular expression used to find email addresses use the `eae_regexp` filter: `<?php add_filter('eae_regexp', $pattern); ?>`
|
22 |
+
|
23 |
|
24 |
== Installation ==
|
25 |
|
32 |
|
33 |
== Changelog ==
|
34 |
|
35 |
+
= 1.0.2 =
|
36 |
+
|
37 |
+
* Added filter to override the regular expression.
|
38 |
+
|
39 |
= 1.0.1 =
|
40 |
|
41 |
* Effects now also page, post and comment excerpts
|
47 |
|
48 |
== Upgrade Notice ==
|
49 |
|
50 |
+
= 1.0.2 =
|
51 |
+
|
52 |
+
Added filter to override the regular expression.
|
53 |
+
|
54 |
= 1.0.1 =
|
55 |
|
56 |
Effects now also page, post and comment excerpts.
|