Email Address Encoder - Version 1.0.13

Version Description

  • Resolve issue with WordPress 4.7 and older
  • Block signup for local domains and IP addresses
Download this release

Release Info

Developer tillkruess
Plugin Icon 128x128 Email Address Encoder
Version 1.0.13
Comparing to
See all releases

Code changes from version 1.0.12 to 1.0.13

Files changed (3) hide show
  1. email-address-encoder.php +1 -1
  2. includes/admin.php +48 -34
  3. readme.txt +7 -2
email-address-encoder.php CHANGED
@@ -3,7 +3,7 @@
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.12
7
  Author: Till Krüss
8
  Author URI: https://till.im/
9
  Text Domain: email-address-encoder
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.13
7
  Author: Till Krüss
8
  Author URI: https://till.im/
9
  Text Domain: email-address-encoder
includes/admin.php CHANGED
@@ -76,29 +76,10 @@ function eae_register_ui() {
76
  * @return void
77
  */
78
  function eae_register_settings() {
79
- register_setting( 'email-address-encoder', 'eae_search_in', array(
80
- 'type' => 'string',
81
- 'default' => 'filters',
82
- 'sanitize_callback' => 'sanitize_text_field',
83
- ) );
84
-
85
- register_setting( 'email-address-encoder', 'eae_technique', array(
86
- 'type' => 'string',
87
- 'default' => 'entities',
88
- 'sanitize_callback' => 'sanitize_text_field',
89
- ) );
90
-
91
- register_setting( 'email-address-encoder', 'eae_filter_priority', array(
92
- 'type' => 'integer',
93
- 'default' => 1000,
94
- 'sanitize_callback' => 'sanitize_text_field',
95
- ) );
96
-
97
- register_setting( 'email-address-encoder', 'eae_notices', array(
98
- 'type' => 'integer',
99
- 'default' => 0,
100
- 'sanitize_callback' => 'intval',
101
- ) );
102
  }
103
 
104
  /**
@@ -107,6 +88,14 @@ function eae_register_settings() {
107
  * @return void
108
  */
109
  function eae_uninstall_hook() {
 
 
 
 
 
 
 
 
110
  delete_option( 'eae_search_in' );
111
  delete_option( 'eae_technique' );
112
  delete_option( 'eae_filter_priority' );
@@ -133,7 +122,7 @@ function eae_options_page() {
133
  }
134
 
135
  /**
136
- * Callback to add "Settings" link to the plugin's action links.
137
  *
138
  * @param array $links
139
  * @param string $file
@@ -145,13 +134,21 @@ function eae_plugin_actions_links( $links, $file ) {
145
  return $links;
146
  }
147
 
148
- $link = sprintf(
149
- '<a href="%s">%s</a>',
150
- admin_url( 'options-general.php?page=email-address-encoder' ),
151
- __( 'Settings', 'email-address-encoder' )
152
- );
153
-
154
- return array_merge( array( $link ), $links );
 
 
 
 
 
 
 
 
155
  }
156
 
157
  /**
@@ -245,6 +242,25 @@ function eae_transmit_email() {
245
  return;
246
  }
247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  check_admin_referer( 'subscribe' );
249
 
250
  $response = wp_remote_post( 'https://encoder.till.im/api/subscribe', array(
@@ -258,14 +274,12 @@ function eae_transmit_email() {
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(
76
  * @return void
77
  */
78
  function eae_register_settings() {
79
+ register_setting( 'email-address-encoder', 'eae_search_in', 'sanitize_text_field' );
80
+ register_setting( 'email-address-encoder', 'eae_technique', 'sanitize_text_field' );
81
+ register_setting( 'email-address-encoder', 'eae_filter_priority', 'absint' );
82
+ register_setting( 'email-address-encoder', 'eae_notices', 'absint' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  }
84
 
85
  /**
88
  * @return void
89
  */
90
  function eae_uninstall_hook() {
91
+ if ( ! function_exists( 'get_plugins' ) ) {
92
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
93
+ }
94
+
95
+ if ( array_key_exists( 'email-encoder-premium/email-address-encoder.php', get_plugins() ) ) {
96
+ return;
97
+ }
98
+
99
  delete_option( 'eae_search_in' );
100
  delete_option( 'eae_technique' );
101
  delete_option( 'eae_filter_priority' );
122
  }
123
 
124
  /**
125
+ * Callback to add links to the plugin's action links.
126
  *
127
  * @param array $links
128
  * @param string $file
134
  return $links;
135
  }
136
 
137
+ return array_merge( array(
138
+ sprintf(
139
+ '<a target="_blank" rel="noopener" href="https://encoder.till.im/guide?utm_source=wp-plugin&amp;utm_medium=action-link">%s</a>',
140
+ __( 'FAQ', 'email-address-encoder' )
141
+ ),
142
+ sprintf(
143
+ '<a target="_blank" rel="noopener" href="https://encoder.till.im/download?utm_source=wp-plugin&amp;utm_medium=action-link">%s</a>',
144
+ __( 'Premium', 'email-address-encoder' )
145
+ ),
146
+ sprintf(
147
+ '<a href="%s">%s</a>',
148
+ admin_url( 'options-general.php?page=email-address-encoder' ),
149
+ __( 'Settings', 'email-address-encoder' )
150
+ ),
151
+ ), $links );
152
  }
153
 
154
  /**
242
  return;
243
  }
244
 
245
+ $host = parse_url( get_home_url(), PHP_URL_HOST );
246
+
247
+ if (
248
+ $host === 'localhost' ||
249
+ filter_var( $host, FILTER_VALIDATE_IP ) ||
250
+ preg_match( '/\.(dev|test|local)$/', $host )
251
+ ) {
252
+ return add_settings_error(
253
+ 'eae_notify_email',
254
+ 'invalid',
255
+ sprintf(
256
+ __( 'Sorry, "%s" doesn’t appear to be a valid domain. Signup for automatic warnings using the <a href="%s">page scanner</a> instead.', 'email-address-encoder' ),
257
+ $host,
258
+ 'https://encoder.till.im/scanner?utm_source=wp-plugin&amp;utm_medium=subscribe-error'
259
+ ),
260
+ 'error'
261
+ );
262
+ }
263
+
264
  check_admin_referer( 'subscribe' );
265
 
266
  $response = wp_remote_post( 'https://encoder.till.im/api/subscribe', array(
274
  ) );
275
 
276
  if ( is_wp_error( $response ) || $response[ 'response' ][ 'code' ] !== 200 ) {
277
+ return add_settings_error(
278
  'eae_notify_email',
279
  'invalid',
280
  __( 'Whoops, something went wrong. Please try again.', 'email-address-encoder' ),
281
  'error'
282
  );
 
 
283
  }
284
 
285
  add_settings_error(
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.12
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -67,6 +67,11 @@ You can use the "Page Scanner" found under _Settings -> Email Encoder_ to see wh
67
 
68
  == Changelog ==
69
 
 
 
 
 
 
70
  = 1.0.12 =
71
 
72
  * Avoid fatal error when using PHP 5.3 or lesser
@@ -179,4 +184,4 @@ Added filter to override the regular expression.
179
 
180
  = 1.0.1 =
181
 
182
- Effects now also page, post and comment excerpts.
5
  Requires at least: 2.0
6
  Tested up to: 5.0
7
  Requires PHP: 5.3
8
+ Stable tag: 1.0.13
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
67
 
68
  == Changelog ==
69
 
70
+ = 1.0.13 =
71
+
72
+ * Resolve issue with WordPress 4.7 and older
73
+ * Block signup for local domains and IP addresses
74
+
75
  = 1.0.12 =
76
 
77
  * Avoid fatal error when using PHP 5.3 or lesser
184
 
185
  = 1.0.1 =
186
 
187
+ Effects now also page, post and comment excerpts.