Version Description
- Added the ability to get notified when your site contains unprotected email addresses
- Made
EAE_DISABLE_NOTICES
check stricter - Removed cross-promotion
Download this release
Release Info
Developer | tillkruess |
Plugin | Email Address Encoder |
Version | 1.0.11 |
Comparing to | |
See all releases |
Code changes from version 1.0.10 to 1.0.11
- email-address-encoder.php +2 -2
- includes/admin.php +55 -9
- includes/mo-notice.php +0 -174
- includes/ui.php +40 -16
- readme.txt +12 -2
email-address-encoder.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/*
|
3 |
Plugin Name: Email Address Encoder
|
4 |
Plugin URI: https://encoder.till.im/
|
5 |
-
Description: A lightweight plugin
|
6 |
-
Version: 1.0.
|
7 |
Author: Till Krüss
|
8 |
Author URI: https://till.im/
|
9 |
Text Domain: email-address-encoder
|
2 |
/*
|
3 |
Plugin Name: Email Address Encoder
|
4 |
Plugin URI: https://encoder.till.im/
|
5 |
+
Description: A lightweight plugin that protects email addresses from email-harvesting robots by encoding them into decimal and hexadecimal entities.
|
6 |
+
Version: 1.0.11
|
7 |
Author: Till Krüss
|
8 |
Author URI: https://till.im/
|
9 |
Text Domain: email-address-encoder
|
includes/admin.php
CHANGED
@@ -2,10 +2,6 @@
|
|
2 |
|
3 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
|
5 |
-
if ( ! defined( 'EAE_DISABLE_NOTICES' ) && time() < 1543622400 ) {
|
6 |
-
include __DIR__ . '/mo-notice.php';
|
7 |
-
}
|
8 |
-
|
9 |
/**
|
10 |
* Load the plugin's text domain.
|
11 |
*/
|
@@ -36,6 +32,11 @@ add_action( 'admin_notices', 'eae_page_scanner_notice' );
|
|
36 |
*/
|
37 |
add_action( 'admin_enqueue_scripts', 'eae_enqueue_script' );
|
38 |
|
|
|
|
|
|
|
|
|
|
|
39 |
/**
|
40 |
* Register AJAX callback for "eae_dismiss_notice" action.
|
41 |
*/
|
@@ -208,7 +209,7 @@ function eae_page_scanner_notice() {
|
|
208 |
return;
|
209 |
}
|
210 |
|
211 |
-
if ( defined( 'EAE_DISABLE_NOTICES' ) ) {
|
212 |
return;
|
213 |
}
|
214 |
|
@@ -216,16 +217,61 @@ function eae_page_scanner_notice() {
|
|
216 |
return;
|
217 |
}
|
218 |
|
219 |
-
if ( get_user_meta( get_current_user_id(), '
|
220 |
return;
|
221 |
}
|
222 |
|
223 |
printf(
|
224 |
-
'<div class="notice notice-info is-dismissible" data-dismissible="
|
225 |
-
__( '
|
226 |
sprintf(
|
227 |
-
__( '
|
228 |
admin_url( 'options-general.php?page=email-address-encoder' )
|
229 |
)
|
230 |
);
|
231 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
|
|
|
|
|
|
|
|
|
5 |
/**
|
6 |
* Load the plugin's text domain.
|
7 |
*/
|
32 |
*/
|
33 |
add_action( 'admin_enqueue_scripts', 'eae_enqueue_script' );
|
34 |
|
35 |
+
/**
|
36 |
+
* Register callback to transmit email address to remote server.
|
37 |
+
*/
|
38 |
+
add_action( 'load-settings_page_email-address-encoder', 'eae_transmit_email' );
|
39 |
+
|
40 |
/**
|
41 |
* Register AJAX callback for "eae_dismiss_notice" action.
|
42 |
*/
|
209 |
return;
|
210 |
}
|
211 |
|
212 |
+
if ( defined( 'EAE_DISABLE_NOTICES' ) && EAE_DISABLE_NOTICES ) {
|
213 |
return;
|
214 |
}
|
215 |
|
217 |
return;
|
218 |
}
|
219 |
|
220 |
+
if ( get_user_meta( get_current_user_id(), 'eae_dismissed_automatic_warnings_notice', true ) === '1' ) {
|
221 |
return;
|
222 |
}
|
223 |
|
224 |
printf(
|
225 |
+
'<div class="notice notice-info is-dismissible" data-dismissible="automatic_warnings_notice"><p><strong>%s</strong> %s</p></div>',
|
226 |
+
__( 'Protect your email addresses!', 'email-address-encoder' ),
|
227 |
sprintf(
|
228 |
+
__( 'Receive <a href="%1$s">automatic warnings</a> when your site contains unprotected email addresses, or use the <a href="%1$s">page scanner</a> to test your site manually.', 'email-address-encoder' ),
|
229 |
admin_url( 'options-general.php?page=email-address-encoder' )
|
230 |
)
|
231 |
);
|
232 |
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Transmit email address to remote server.
|
236 |
+
*
|
237 |
+
* @return void
|
238 |
+
*/
|
239 |
+
function eae_transmit_email() {
|
240 |
+
if (
|
241 |
+
empty( $_POST ) ||
|
242 |
+
! isset( $_POST[ 'action' ], $_POST[ 'eae_notify_email' ] ) ||
|
243 |
+
$_POST[ 'action' ] !== 'subscribe'
|
244 |
+
) {
|
245 |
+
return;
|
246 |
+
}
|
247 |
+
|
248 |
+
check_admin_referer( 'subscribe' );
|
249 |
+
|
250 |
+
$response = wp_remote_post( 'https://encoder.till.im/api/subscribe', [
|
251 |
+
'headers' => [
|
252 |
+
'Accept' => 'application/json',
|
253 |
+
],
|
254 |
+
'body' => [
|
255 |
+
'url' => get_home_url(),
|
256 |
+
'email' => $_POST[ 'eae_notify_email' ],
|
257 |
+
],
|
258 |
+
] );
|
259 |
+
|
260 |
+
if ( is_wp_error( $response ) || $response[ 'response' ][ 'code' ] !== 200 ) {
|
261 |
+
add_settings_error(
|
262 |
+
'eae_notify_email',
|
263 |
+
'invalid',
|
264 |
+
__( 'Whoops, something went wrong. Please try again.', 'email-address-encoder' ),
|
265 |
+
'error'
|
266 |
+
);
|
267 |
+
|
268 |
+
return;
|
269 |
+
}
|
270 |
+
|
271 |
+
add_settings_error(
|
272 |
+
'eae_notify_email',
|
273 |
+
'subscribed',
|
274 |
+
__( 'You’ll receive a notification should your site contain unprotected email addresses.', 'email-address-encoder' ),
|
275 |
+
'updated'
|
276 |
+
);
|
277 |
+
}
|
includes/mo-notice.php
DELETED
@@ -1,174 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
-
|
5 |
-
if ( ! class_exists( 'MO_Admin_Notice' ) ) :
|
6 |
-
|
7 |
-
class MO_Admin_Notice
|
8 |
-
{
|
9 |
-
public function __construct()
|
10 |
-
{
|
11 |
-
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
|
12 |
-
add_action( 'network_admin_notices', array( $this, 'admin_notice' ) );
|
13 |
-
add_action( 'admin_init', array( $this, 'dismiss_admin_notice' ) );
|
14 |
-
}
|
15 |
-
|
16 |
-
public function dismiss_admin_notice()
|
17 |
-
{
|
18 |
-
if ( ! isset( $_GET[ 'mo-adaction' ] ) || $_GET[ 'mo-adaction' ] !== 'mo_dismiss_adnotice' ) {
|
19 |
-
return;
|
20 |
-
}
|
21 |
-
|
22 |
-
$url = admin_url();
|
23 |
-
update_option( 'mo_dismiss_adnotice', 'true' );
|
24 |
-
|
25 |
-
wp_redirect( $url );
|
26 |
-
exit;
|
27 |
-
}
|
28 |
-
|
29 |
-
public function admin_notice()
|
30 |
-
{
|
31 |
-
$screen = get_current_screen();
|
32 |
-
|
33 |
-
if ( isset( $screen->id ) && $screen->id !== 'settings_page_email-address-encoder' ) {
|
34 |
-
return;
|
35 |
-
}
|
36 |
-
|
37 |
-
if ( get_option( 'mo_dismiss_adnotice', 'false' ) === 'true' ) {
|
38 |
-
return;
|
39 |
-
}
|
40 |
-
|
41 |
-
if ( $this->is_plugin_installed() && $this->is_plugin_active() ) {
|
42 |
-
return;
|
43 |
-
}
|
44 |
-
|
45 |
-
$dismiss_url = esc_url_raw(
|
46 |
-
add_query_arg(
|
47 |
-
array(
|
48 |
-
'mo-adaction' => 'mo_dismiss_adnotice'
|
49 |
-
),
|
50 |
-
admin_url()
|
51 |
-
)
|
52 |
-
);
|
53 |
-
|
54 |
-
$this->notice_css();
|
55 |
-
|
56 |
-
$install_url = wp_nonce_url(
|
57 |
-
admin_url( 'update.php?action=install-plugin&plugin=mailoptin' ),
|
58 |
-
'install-plugin_mailoptin'
|
59 |
-
);
|
60 |
-
|
61 |
-
$activate_url = wp_nonce_url(
|
62 |
-
admin_url( 'plugins.php?action=activate&plugin=mailoptin%2Fmailoptin.php' ),
|
63 |
-
'activate-plugin_mailoptin/mailoptin.php'
|
64 |
-
);
|
65 |
-
|
66 |
-
?>
|
67 |
-
<div class="mo-admin-notice notice notice-success">
|
68 |
-
<div class="mo-notice-first-half">
|
69 |
-
<p>
|
70 |
-
<?php
|
71 |
-
printf(
|
72 |
-
__('Free optin form plugin that will %1$sincrease your email list subscribers%2$s and keep them engaged with %1$sautomated and schedule newsletters%2$s.'),
|
73 |
-
'<span class="mo-stylize"><strong>', '</strong></span>');
|
74 |
-
?>
|
75 |
-
</p>
|
76 |
-
</div>
|
77 |
-
<div class="mo-notice-other-half">
|
78 |
-
<?php if ( ! $this->is_plugin_installed()) : ?>
|
79 |
-
<a class="button button-primary button-hero" id="mo-install-mailoptin-plugin" href="<?php echo $install_url; ?>">
|
80 |
-
<?php _e('Install MailOptin Now for Free!'); ?>
|
81 |
-
</a>
|
82 |
-
<?php endif; ?>
|
83 |
-
<?php if ($this->is_plugin_installed() && ! $this->is_plugin_active()) : ?>
|
84 |
-
<a class="button button-primary button-hero" id="mo-activate-mailoptin-plugin" href="<?php echo $activate_url; ?>">
|
85 |
-
<?php _e('Activate MailOptin Now!'); ?>
|
86 |
-
</a>
|
87 |
-
<?php endif; ?>
|
88 |
-
<div class="mo-notice-learn-more">
|
89 |
-
<a target="_blank" href="https://mailoptin.io">Learn more</a>
|
90 |
-
</div>
|
91 |
-
</div>
|
92 |
-
<a href="<?php echo $dismiss_url; ?>">
|
93 |
-
<button type="button" class="notice-dismiss">
|
94 |
-
<span class="screen-reader-text"><?php _e('Dismiss this notice'); ?>.</span>
|
95 |
-
</button>
|
96 |
-
</a>
|
97 |
-
</div>
|
98 |
-
<?php
|
99 |
-
}
|
100 |
-
|
101 |
-
public function is_plugin_installed()
|
102 |
-
{
|
103 |
-
$installed_plugins = get_plugins();
|
104 |
-
|
105 |
-
return isset( $installed_plugins[ 'mailoptin/mailoptin.php' ] );
|
106 |
-
}
|
107 |
-
|
108 |
-
public function is_plugin_active()
|
109 |
-
{
|
110 |
-
return is_plugin_active( 'mailoptin/mailoptin.php' );
|
111 |
-
}
|
112 |
-
|
113 |
-
public function notice_css()
|
114 |
-
{ ?>
|
115 |
-
<style type="text/css">
|
116 |
-
.mo-admin-notice {
|
117 |
-
overflow: hidden;
|
118 |
-
background: #fff;
|
119 |
-
color: #000;
|
120 |
-
border-left-color: #46b450;
|
121 |
-
position: relative;
|
122 |
-
}
|
123 |
-
.mo-admin-notice .notice-dismiss:before {
|
124 |
-
color: #72777c;
|
125 |
-
}
|
126 |
-
.mo-admin-notice .mo-stylize {
|
127 |
-
line-height: 2;
|
128 |
-
}
|
129 |
-
.mo-admin-notice .button-primary {
|
130 |
-
background: #006799;
|
131 |
-
text-shadow: none;
|
132 |
-
border: 0;
|
133 |
-
box-shadow: none;
|
134 |
-
}
|
135 |
-
.mo-notice-first-half {
|
136 |
-
float: left;
|
137 |
-
width: 66%;
|
138 |
-
display: block;
|
139 |
-
margin: 20px 0 10px 0;
|
140 |
-
}
|
141 |
-
.mo-notice-other-half {
|
142 |
-
float: right;
|
143 |
-
width: 33%;
|
144 |
-
display: block;
|
145 |
-
padding: 20px 0;
|
146 |
-
text-align: center;
|
147 |
-
}
|
148 |
-
.mo-notice-first-half p {
|
149 |
-
font-size: 14px;
|
150 |
-
}
|
151 |
-
.mo-notice-learn-more a {
|
152 |
-
margin: 10px;
|
153 |
-
}
|
154 |
-
.mo-notice-learn-more {
|
155 |
-
margin-top: 10px;
|
156 |
-
}
|
157 |
-
</style><?php
|
158 |
-
}
|
159 |
-
|
160 |
-
public static function instance()
|
161 |
-
{
|
162 |
-
static $instance = null;
|
163 |
-
|
164 |
-
if ( is_null( $instance ) ) {
|
165 |
-
$instance = new self;
|
166 |
-
}
|
167 |
-
|
168 |
-
return $instance;
|
169 |
-
}
|
170 |
-
}
|
171 |
-
|
172 |
-
endif;
|
173 |
-
|
174 |
-
MO_Admin_Notice::instance();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/ui.php
CHANGED
@@ -3,21 +3,45 @@
|
|
3 |
|
4 |
<h1><?php _e( 'Email Address Encoder', 'email-address-encoder' ); ?></h1>
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
<?php settings_fields( 'email-address-encoder' ); ?>
|
23 |
|
@@ -121,7 +145,7 @@
|
|
121 |
</th>
|
122 |
<td>
|
123 |
<label for="eae_notices">
|
124 |
-
<?php if ( defined( 'EAE_DISABLE_NOTICES' ) ) : ?>
|
125 |
<input type="checkbox" name="eae_notices" id="eae_notices" value="1" checked disabled>
|
126 |
<?php else : ?>
|
127 |
<input type="checkbox" name="eae_notices" id="eae_notices" value="1" <?php checked( '1', get_option( 'eae_notices' ) ); ?>>
|
3 |
|
4 |
<h1><?php _e( 'Email Address Encoder', 'email-address-encoder' ); ?></h1>
|
5 |
|
6 |
+
<?php if ( get_option( 'eae_notices', '0' ) !== '1' && ( ! defined( 'EAE_DISABLE_NOTICES' ) || ! EAE_DISABLE_NOTICES ) ) : ?>
|
7 |
+
|
8 |
+
<div class="card" style="float: left; margin-bottom: 0; margin-right: 1.5rem;">
|
9 |
+
<h2 class="title">
|
10 |
+
<?php _e( 'Signup for automatic warnings', 'email-address-encoder' ); ?>
|
11 |
+
</h2>
|
12 |
+
<p>
|
13 |
+
<?php printf(
|
14 |
+
__( 'Receive an email notification when any page on <strong>%s</strong> contains unprotected email addresses.', 'email-address-encoder' ),
|
15 |
+
parse_url( get_home_url(), PHP_URL_HOST )
|
16 |
+
); ?>
|
17 |
+
</p>
|
18 |
+
<form method="post" action="<?php echo admin_url( 'options-general.php?page=email-address-encoder' ); ?>">
|
19 |
+
<?php wp_nonce_field('subscribe'); ?>
|
20 |
+
<input type="hidden" name="action" value="subscribe" />
|
21 |
+
<p>
|
22 |
+
<input name="eae_notify_email" type="email" placeholder="<?php _e( 'Your email address...', 'email-address-encoder' ); ?>" class="regular-text" style="min-height: 28px;" required>
|
23 |
+
<?php submit_button( __( 'Notify me', 'email-address-encoder' ), 'primary', 'submit', false ); ?>
|
24 |
+
</p>
|
25 |
+
</form>
|
26 |
+
</div>
|
27 |
+
|
28 |
+
<div class="card" style="float: left; min-height: 146px; margin-bottom: 1.5rem;">
|
29 |
+
<h2 class="title">
|
30 |
+
<?php _e( 'Scan your pages', 'email-address-encoder' ); ?>
|
31 |
+
</h2>
|
32 |
+
<p>
|
33 |
+
<?php _e( 'Don’t want automatic warnings? Use the page scanner to see whether all your email addresses are protected.', 'email-address-encoder' ); ?>
|
34 |
+
</p>
|
35 |
+
<p>
|
36 |
+
<a class="button button-secondary" target="_blank" rel="noopener" href="https://encoder.till.im/scanner?utm_source=wp-plugin&utm_medium=banner&domain=<?php echo urlencode( get_home_url() ) ?>">
|
37 |
+
<?php _e( 'Open Page Scanner', 'email-address-encoder' ); ?>
|
38 |
+
</a>
|
39 |
+
</p>
|
40 |
+
</div>
|
41 |
+
|
42 |
+
<?php endif; ?>
|
43 |
+
|
44 |
+
<form method="post" action="options.php">
|
45 |
|
46 |
<?php settings_fields( 'email-address-encoder' ); ?>
|
47 |
|
145 |
</th>
|
146 |
<td>
|
147 |
<label for="eae_notices">
|
148 |
+
<?php if ( defined( 'EAE_DISABLE_NOTICES' ) && EAE_DISABLE_NOTICES ) : ?>
|
149 |
<input type="checkbox" name="eae_notices" id="eae_notices" value="1" checked disabled>
|
150 |
<?php else : ?>
|
151 |
<input type="checkbox" name="eae_notices" id="eae_notices" value="1" <?php checked( '1', get_option( 'eae_notices' ) ); ?>>
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: antispam, anti spam, spam, email, e-mail, mail, spider, crawler, harvester
|
|
5 |
Requires at least: 2.0
|
6 |
Tested up to: 5.0
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 1.0.
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
@@ -67,6 +67,12 @@ You can use the "Page Scanner" found under _Settings -> Email Encoder_ to see wh
|
|
67 |
|
68 |
== Changelog ==
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
= 1.0.10 =
|
71 |
|
72 |
* Added option to disable notices and promotions
|
@@ -127,9 +133,13 @@ You can use the "Page Scanner" found under _Settings -> Email Encoder_ to see wh
|
|
127 |
|
128 |
== Upgrade Notice ==
|
129 |
|
|
|
|
|
|
|
|
|
130 |
= 1.0.10 =
|
131 |
|
132 |
-
|
133 |
|
134 |
= 1.0.9 =
|
135 |
|
5 |
Requires at least: 2.0
|
6 |
Tested up to: 5.0
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 1.0.11
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
+
= 1.0.11 =
|
71 |
+
|
72 |
+
* Added the ability to get notified when your site contains unprotected email addresses
|
73 |
+
* Made `EAE_DISABLE_NOTICES` check stricter
|
74 |
+
* Removed cross-promotion
|
75 |
+
|
76 |
= 1.0.10 =
|
77 |
|
78 |
* Added option to disable notices and promotions
|
133 |
|
134 |
== Upgrade Notice ==
|
135 |
|
136 |
+
= 1.0.11 =
|
137 |
+
|
138 |
+
This release adds the ability to get notified when your site contains unprotected email addresses.
|
139 |
+
|
140 |
= 1.0.10 =
|
141 |
|
142 |
+
This release includes several improvements and new features.
|
143 |
|
144 |
= 1.0.9 =
|
145 |
|