Email Encoder Bundle – Protect Email Address - Version 1.4.5

Version Description

  • Fixed ? params bug
Download this release

Release Info

Developer freelancephp
Plugin Icon 128x128 Email Encoder Bundle – Protect Email Address
Version 1.4.5
Comparing to
See all releases

Code changes from version 1.4.4 to 1.4.5

email-encoder-bundle.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Email Encoder Bundle - Protect Email Address
4
  Plugin URI: http://www.freelancephp.net/email-encoder-php-class-wp-plugin/
5
  Description: Protect email addresses on your site and hide them from spambots by using an encoding method. Easy to use, flexible .
6
  Author: Victor Villaverde Laan
7
- Version: 1.4.4
8
  Author URI: http://www.freelancephp.net
9
  License: Dual licensed under the MIT and GPL licenses
10
  Text Domain: email-encoder-bundle
@@ -12,7 +12,7 @@ Domain Path: /languages
12
  */
13
 
14
  // constants
15
- if (!defined('EMAIL_ENCODER_BUNDLE_VERSION')) { define('EMAIL_ENCODER_BUNDLE_VERSION', '1.4.4'); }
16
  if (!defined('EMAIL_ENCODER_BUNDLE_FILE')) { define('EMAIL_ENCODER_BUNDLE_FILE', defined('TEST_EEB_PLUGIN_FILE') ? TEST_EEB_PLUGIN_FILE : __FILE__); }
17
  if (!defined('EMAIL_ENCODER_BUNDLE_KEY')) { define('EMAIL_ENCODER_BUNDLE_KEY', 'WP_Email_Encoder_Bundle'); }
18
  if (!defined('EMAIL_ENCODER_BUNDLE_OPTIONS_NAME')) { define('EMAIL_ENCODER_BUNDLE_OPTIONS_NAME', 'WP_Email_Encoder_Bundle_options'); }
4
  Plugin URI: http://www.freelancephp.net/email-encoder-php-class-wp-plugin/
5
  Description: Protect email addresses on your site and hide them from spambots by using an encoding method. Easy to use, flexible .
6
  Author: Victor Villaverde Laan
7
+ Version: 1.4.5
8
  Author URI: http://www.freelancephp.net
9
  License: Dual licensed under the MIT and GPL licenses
10
  Text Domain: email-encoder-bundle
12
  */
13
 
14
  // constants
15
+ if (!defined('EMAIL_ENCODER_BUNDLE_VERSION')) { define('EMAIL_ENCODER_BUNDLE_VERSION', '1.4.5'); }
16
  if (!defined('EMAIL_ENCODER_BUNDLE_FILE')) { define('EMAIL_ENCODER_BUNDLE_FILE', defined('TEST_EEB_PLUGIN_FILE') ? TEST_EEB_PLUGIN_FILE : __FILE__); }
17
  if (!defined('EMAIL_ENCODER_BUNDLE_KEY')) { define('EMAIL_ENCODER_BUNDLE_KEY', 'WP_Email_Encoder_Bundle'); }
18
  if (!defined('EMAIL_ENCODER_BUNDLE_OPTIONS_NAME')) { define('EMAIL_ENCODER_BUNDLE_OPTIONS_NAME', 'WP_Email_Encoder_Bundle_options'); }
includes/class-eeb-admin.php CHANGED
@@ -349,7 +349,7 @@ abstract class Eeb_Admin {
349
  </tr>
350
  <tr>
351
  <th><?php _e('Add class to protected mailto links', 'email-encoder-bundle') ?></th>
352
- <td><label><input type="text" id="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[class_name]" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[class_name]" value="<?php echo $options['class_name']; ?>" />
353
  <br/><span class="description"><?php _e('All protected mailto links will get these class(es). Optional, else keep blank.', 'email-encoder-bundle') ?></span></label></td>
354
  </tr>
355
  </table>
@@ -379,7 +379,7 @@ abstract class Eeb_Admin {
379
  </tr>
380
  <tr>
381
  <th><?php _e('Set protection text in RSS feeds', 'email-encoder-bundle') ?></th>
382
- <td><label><input type="text" id="protection_text" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[protection_text_rss]" value="<?php echo $options['protection_text_rss']; ?>" />
383
  <br/><span class="description"><?php _e('Used as replacement for email addresses in RSS feeds.', 'email-encoder-bundle') ?></span>
384
  </label>
385
  </td>
@@ -413,13 +413,13 @@ abstract class Eeb_Admin {
413
  <th><?php _e('Set <code>&lt;noscript&gt;</code> text', 'email-encoder-bundle') ?></th>
414
  <td><label>
415
  <span><?php _e('For encoded emails:', 'email-encoder-bundle') ?></span>
416
- <br/><input type="text" id="protection_text" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[protection_text]" value="<?php echo $options['protection_text']; ?>" />
417
  </label>
418
  <br/>
419
  <br/>
420
  <label>
421
  <span><?php _e('For other encoded content:', 'email-encoder-bundle') ?></span>
422
- <br/><input type="text" id="protection_text_content" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[protection_text_content]" value="<?php echo $options['protection_text_content']; ?>" />
423
  </label>
424
  <br/>
425
  <br/><span class="description"><?php _e('Used as <code>&lt;noscript&gt;</code> fallback for JavaScrip methods.', 'email-encoder-bundle') ?></span>
@@ -430,7 +430,7 @@ abstract class Eeb_Admin {
430
  <td>
431
  <label>
432
  <span><?php _e('Do <strong>not</strong> apply protection on posts or pages with the folllowing ID:', 'email-encoder-bundle') ?></span>
433
- <br/><input type="text" id="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[skip_posts]" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[skip_posts]" value="<?php echo $options['skip_posts']; ?>" />
434
  <br/><span class="description"><?php _e('Seperate Id\'s by comma, f.e.: 2, 7, 13, 32.', 'email-encoder-bundle') ?></span>
435
  <br/><span class="description"><?php _e('Notice: shortcodes still work on these posts.', 'email-encoder-bundle') ?></span>
436
  </label>
349
  </tr>
350
  <tr>
351
  <th><?php _e('Add class to protected mailto links', 'email-encoder-bundle') ?></th>
352
+ <td><label><input type="text" id="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[class_name]" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[class_name]" value="<?php echo esc_attr($options['class_name']); ?>" />
353
  <br/><span class="description"><?php _e('All protected mailto links will get these class(es). Optional, else keep blank.', 'email-encoder-bundle') ?></span></label></td>
354
  </tr>
355
  </table>
379
  </tr>
380
  <tr>
381
  <th><?php _e('Set protection text in RSS feeds', 'email-encoder-bundle') ?></th>
382
+ <td><label><input type="text" id="protection_text" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[protection_text_rss]" value="<?php echo esc_attr($options['protection_text_rss']); ?>" />
383
  <br/><span class="description"><?php _e('Used as replacement for email addresses in RSS feeds.', 'email-encoder-bundle') ?></span>
384
  </label>
385
  </td>
413
  <th><?php _e('Set <code>&lt;noscript&gt;</code> text', 'email-encoder-bundle') ?></th>
414
  <td><label>
415
  <span><?php _e('For encoded emails:', 'email-encoder-bundle') ?></span>
416
+ <br/><input type="text" id="protection_text" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[protection_text]" value="<?php echo esc_attr($options['protection_text']); ?>" />
417
  </label>
418
  <br/>
419
  <br/>
420
  <label>
421
  <span><?php _e('For other encoded content:', 'email-encoder-bundle') ?></span>
422
+ <br/><input type="text" id="protection_text_content" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[protection_text_content]" value="<?php echo esc_attr($options['protection_text_content']); ?>" />
423
  </label>
424
  <br/>
425
  <br/><span class="description"><?php _e('Used as <code>&lt;noscript&gt;</code> fallback for JavaScrip methods.', 'email-encoder-bundle') ?></span>
430
  <td>
431
  <label>
432
  <span><?php _e('Do <strong>not</strong> apply protection on posts or pages with the folllowing ID:', 'email-encoder-bundle') ?></span>
433
+ <br/><input type="text" id="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[skip_posts]" class="regular-text" name="<?php echo EMAIL_ENCODER_BUNDLE_OPTIONS_NAME ?>[skip_posts]" value="<?php echo esc_attr($options['skip_posts']); ?>" />
434
  <br/><span class="description"><?php _e('Seperate Id\'s by comma, f.e.: 2, 7, 13, 32.', 'email-encoder-bundle') ?></span>
435
  <br/><span class="description"><?php _e('Notice: shortcodes still work on these posts.', 'email-encoder-bundle') ?></span>
436
  </label>
includes/class-eeb-site.php CHANGED
@@ -29,7 +29,7 @@ final class Eeb_Site extends Eeb_Admin {
29
  * @var array Regular expresssions
30
  */
31
  private $regexp_patterns = array(
32
- 'mailto' => '/<a([^<>]*?)href=["\']mailto:([A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9](\.[A-Z.]{2,6}))["\'](.*?)>(.*?)<\/a[\s+]*>/is',
33
  'email' => '/[A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9](\.[A-Z.]{2,6})/is',
34
  'input' => '/<input([^>]*)value=["\'][\s+]*([A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z.]{2,6})[\s+]*["\']([^>]*)>/is',
35
  'class' => '/class=["\'](.*?)["\']/i',
@@ -187,7 +187,7 @@ final class Eeb_Site extends Eeb_Admin {
187
  * @return string
188
  */
189
  public function callback_filter_rss($content) {
190
- $content = preg_replace($this->regexp_patterns, $this->options['protection_text_rss'], $content);
191
 
192
  return $content;
193
  }
@@ -258,7 +258,7 @@ final class Eeb_Site extends Eeb_Admin {
258
  if (count($match) < 4) {
259
  $encoded = $this->encode_email($email);
260
  } else {
261
- $encoded = $this->encode_email($email, $match[5], $match[1] . ' ' . $match[4]);
262
  }
263
 
264
  // workaround for double encoding bug when auto-protect mailto is enabled and method is enc_html
@@ -351,7 +351,7 @@ final class Eeb_Site extends Eeb_Admin {
351
  */
352
  public function encode_content($content, $method = null, $no_html_checked = false, $protection_text = null) {
353
  if ($protection_text === null) {
354
- $protection_text = $this->options['protection_text_content'];
355
  }
356
 
357
  // get encode method
@@ -404,10 +404,10 @@ final class Eeb_Site extends Eeb_Admin {
404
  // add class
405
  if (preg_match($this->regexp_patterns['class'], $extra_attrs, $matches)) {
406
  // class attribute set
407
- $extra_attrs = str_replace($matches[0], sprintf('class="%s"', $matches[1] . ' ' . $this->options['class_name']), $extra_attrs);
408
  } else {
409
  // class attribute not set
410
- $extra_attrs .= ' class="' . $this->options['class_name'] . '"';
411
  }
412
 
413
  $mailto = '<a href="mailto:' . $email . '"'. $extra_attrs . '>' . $display . '</a>';
@@ -418,7 +418,7 @@ final class Eeb_Site extends Eeb_Admin {
418
  $mailto = $this->get_success_check($mailto);
419
  }
420
  } else {
421
- $mailto = $this->encode_content($mailto, $method, $no_html_checked, $this->options['protection_text']);
422
  }
423
 
424
  // get encoded email code
29
  * @var array Regular expresssions
30
  */
31
  private $regexp_patterns = array(
32
+ 'mailto' => '/<a([^<>]*?)href=["\']mailto:([A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9](\.[A-Z.]{2,6})(.*?))["\'](.*?)>(.*?)<\/a[\s+]*>/is',
33
  'email' => '/[A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9](\.[A-Z.]{2,6})/is',
34
  'input' => '/<input([^>]*)value=["\'][\s+]*([A-Z0-9._-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z.]{2,6})[\s+]*["\']([^>]*)>/is',
35
  'class' => '/class=["\'](.*?)["\']/i',
187
  * @return string
188
  */
189
  public function callback_filter_rss($content) {
190
+ $content = preg_replace($this->regexp_patterns, esc_attr($this->options['protection_text_rss']), $content);
191
 
192
  return $content;
193
  }
258
  if (count($match) < 4) {
259
  $encoded = $this->encode_email($email);
260
  } else {
261
+ $encoded = $this->encode_email($email, $match[6], $match[1] . ' ' . $match[5]);
262
  }
263
 
264
  // workaround for double encoding bug when auto-protect mailto is enabled and method is enc_html
351
  */
352
  public function encode_content($content, $method = null, $no_html_checked = false, $protection_text = null) {
353
  if ($protection_text === null) {
354
+ $protection_text = esc_attr($this->options['protection_text_content']);
355
  }
356
 
357
  // get encode method
404
  // add class
405
  if (preg_match($this->regexp_patterns['class'], $extra_attrs, $matches)) {
406
  // class attribute set
407
+ $extra_attrs = str_replace($matches[0], sprintf('class="%s"', $matches[1] . ' ' . esc_attr($this->options['class_name'])), $extra_attrs);
408
  } else {
409
  // class attribute not set
410
+ $extra_attrs .= ' class="' . esc_attr($this->options['class_name']) . '"';
411
  }
412
 
413
  $mailto = '<a href="mailto:' . $email . '"'. $extra_attrs . '>' . $display . '</a>';
418
  $mailto = $this->get_success_check($mailto);
419
  }
420
  } else {
421
+ $mailto = $this->encode_content($mailto, $method, $no_html_checked, esc_attr($this->options['protection_text']));
422
  }
423
 
424
  // get encoded email code
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: freelancephp
3
  Tags: email address, protect, antispam, mailto, spambot, secure, e-mail, email, mail, obfuscate, encode, encoder, encrypt, hide, bot, crawl, spider, robots, spam, protection, harvest, harvesting, security
4
  Requires at least: 3.6.0
5
  Tested up to: 4.5.2
6
- Stable tag: 1.4.4
7
 
8
  Encode mailto links, email addresses, phone numbers and any text to hide them from (spam)bots. Mailto links will be protected automatically.
9
 
@@ -124,6 +124,9 @@ It's possible to filter all widgets by using the [Widget Logic Plugin](https://w
124
 
125
  == Changelog ==
126
 
 
 
 
127
  = 1.4.4 =
128
  * Fixed skip responsive images containing @
129
 
3
  Tags: email address, protect, antispam, mailto, spambot, secure, e-mail, email, mail, obfuscate, encode, encoder, encrypt, hide, bot, crawl, spider, robots, spam, protection, harvest, harvesting, security
4
  Requires at least: 3.6.0
5
  Tested up to: 4.5.2
6
+ Stable tag: 1.4.5
7
 
8
  Encode mailto links, email addresses, phone numbers and any text to hide them from (spam)bots. Mailto links will be protected automatically.
9
 
124
 
125
  == Changelog ==
126
 
127
+ = 1.4.5 =
128
+ * Fixed ? params bug
129
+
130
  = 1.4.4 =
131
  * Fixed skip responsive images containing @
132