Email Encoder Bundle – Protect Email Address - Version 2.1.0

Version Description

  • Feature: New advanced setting to automatically protect custom link attributes such as tel:, file:, ftp:, skype:, etc. (Protect custom href attributes)
  • Tweak: Adjust JS documentation
  • Tweak: Adjust readme file
  • Tweak: Allow a hard-reset on foggy.email aliases
  • Dev: New filter eeb/integrations/foggy_email/http_args for manipulating the http arguments send over to foggy.email
Download this release

Release Info

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

Code changes from version 2.0.9 to 2.1.0

core/includes/assets/js/custom.js CHANGED
@@ -12,6 +12,10 @@ jQuery(function ($) {
12
  });
13
  }
14
 
 
 
 
 
15
  // fetch email from data attribute
16
  function fetchEmail(el) {
17
  var email = el.getAttribute('data-enc-email');
12
  });
13
  }
14
 
15
+ /**
16
+ * EMAIL RELATED LOGIC
17
+ */
18
+
19
  // fetch email from data attribute
20
  function fetchEmail(el) {
21
  var email = el.getAttribute('data-enc-email');
core/includes/classes/class-email-encoder-bundle-settings.php CHANGED
@@ -283,6 +283,18 @@ class Email_Encoder_Settings{
283
  'description' => __('Leave blank for none', 'email-encoder-bundle')
284
  ),
285
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  'footer_scripts' => array(
287
  'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
288
  'id' => 'footer_scripts',
283
  'description' => __('Leave blank for none', 'email-encoder-bundle')
284
  ),
285
 
286
+ 'custom_href_attr' => array(
287
+ 'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
288
+ 'id' => 'custom_href_attr',
289
+ 'type' => 'text',
290
+ 'advanced' => true,
291
+ 'title' => __('Protect custom href attributes', 'email-encoder-bundle'),
292
+ 'label' => __('Protect href atrributes such as tel:, ftp:, file:, etc.', 'email-encoder-bundle'),
293
+ 'placeholder' => '',
294
+ 'required' => false,
295
+ 'description' => __('Add the href attributes you want to protect as a comme-separated list. E.g. tel,file,ftp', 'email-encoder-bundle')
296
+ ),
297
+
298
  'footer_scripts' => array(
299
  'fieldset' => array( 'slug' => 'main', 'label' => 'Label' ),
300
  'id' => 'footer_scripts',
core/includes/classes/class-email-encoder-bundle-validate.php CHANGED
@@ -123,6 +123,7 @@ class Email_Encoder_Validate{
123
  case 'without_javascript':
124
  $filtered = $this->filter_input_fields( $filtered, $protect_using );
125
  $filtered = $this->filter_mailto_links( $filtered, 'without_javascript' );
 
126
 
127
  if( $convert_plain_to_image ){
128
  $replace_by = 'convert_image';
@@ -146,6 +147,7 @@ class Email_Encoder_Validate{
146
  case 'with_javascript':
147
  $filtered = $this->filter_input_fields( $filtered, $protect_using );
148
  $filtered = $this->filter_mailto_links( $filtered );
 
149
 
150
  if( $convert_plain_to_image ){
151
  $replace_by = 'convert_image';
@@ -284,6 +286,33 @@ class Email_Encoder_Validate{
284
  return preg_replace_callback( $regexpMailtoLink, $callbackEncodeMailtoLinks, $content );
285
  }
286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  /**
288
  * Emails will be replaced by '*protected email*'
289
  *
@@ -628,6 +657,64 @@ class Email_Encoder_Validate{
628
  return $link;
629
  }
630
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
631
  /**
632
  * Create protected display combining these 3 methods:
633
  * - reversing string
123
  case 'without_javascript':
124
  $filtered = $this->filter_input_fields( $filtered, $protect_using );
125
  $filtered = $this->filter_mailto_links( $filtered, 'without_javascript' );
126
+ $filtered = $this->filter_custom_links( $filtered, 'without_javascript' );
127
 
128
  if( $convert_plain_to_image ){
129
  $replace_by = 'convert_image';
147
  case 'with_javascript':
148
  $filtered = $this->filter_input_fields( $filtered, $protect_using );
149
  $filtered = $this->filter_mailto_links( $filtered );
150
+ $filtered = $this->filter_custom_links( $filtered );
151
 
152
  if( $convert_plain_to_image ){
153
  $replace_by = 'convert_image';
286
  return preg_replace_callback( $regexpMailtoLink, $callbackEncodeMailtoLinks, $content );
287
  }
288
 
289
+ /**
290
+ * @param string $content
291
+ * @return string
292
+ */
293
+ public function filter_custom_links( $content, $protection_method = null ){
294
+ $self = $this;
295
+ $custom_href_attr = (string) EEB()->settings->get_setting( 'custom_href_attr', true );
296
+
297
+ if( ! empty( $custom_href_attr ) ){
298
+ $custom_attr_list = explode( ',', $custom_href_attr );
299
+ foreach( $custom_attr_list as $s_attr ){
300
+ $attr_name = trim( $s_attr );
301
+
302
+ $callbackEncodeCustomLinks = function ( $match ) use ( $self, $protection_method ) {
303
+ $attrs = shortcode_parse_atts( $match[1] );
304
+ return $self->create_protected_href_att( $match[4], $attrs, $protection_method );
305
+ };
306
+
307
+ $regexpMailtoLink = '/<a[\s+]*(([^>]*)href=["\']' . addslashes( $attr_name ) . '\:([^>]*)["\' ])>(.*?)<\/a[\s+]*>/is';
308
+
309
+ $content = preg_replace_callback( $regexpMailtoLink, $callbackEncodeCustomLinks, $content );
310
+ }
311
+ }
312
+
313
+ return $content;
314
+ }
315
+
316
  /**
317
  * Emails will be replaced by '*protected email*'
318
  *
657
  return $link;
658
  }
659
 
660
+ /**
661
+ * Create a protected custom attribute
662
+ *
663
+ * @param string $display
664
+ * @param array $attrs Optional
665
+ * @return string
666
+ */
667
+ public function create_protected_href_att( $display, $attrs = array(), $protection_method = null ){
668
+ $email = '';
669
+ $class_ori = ( empty( $attrs['class'] ) ) ? '' : $attrs['class'];
670
+ $custom_class = (string) EEB()->settings->get_setting( 'class_name', true );
671
+ $show_encoded_check = (string) EEB()->settings->get_setting( 'show_encoded_check', true );
672
+
673
+ // set user-defined class
674
+ if ( $custom_class && strpos( $class_ori, $custom_class ) === FALSE ) {
675
+ $attrs['class'] = ( empty( $attrs['class'] ) ) ? $custom_class : $attrs['class'] . ' ' . $custom_class;
676
+ }
677
+
678
+ // check title for email address
679
+ if ( ! empty( $attrs['title'] ) ) {
680
+ $attrs['title'] = antispambot( $attrs['title'] );
681
+ }
682
+
683
+ // set ignore to data-attribute to prevent being processed by WPEL plugin
684
+ $attrs['data-wpel-link'] = 'ignore';
685
+
686
+ // create element code
687
+ $link = '<a ';
688
+
689
+ foreach ( $attrs AS $key => $value ) {
690
+ if ( strtolower( $key ) == 'href' ) {
691
+ $link .= $key . '="' . antispambot( $value ) . '" ';
692
+ } else {
693
+ $link .= $key . '="' . $value . '" ';
694
+ }
695
+ }
696
+
697
+ // remove last space
698
+ $link = substr( $link, 0, -1 );
699
+
700
+ $link .= '>';
701
+
702
+ $link .= $this->get_protected_display( $display, $protection_method );
703
+
704
+ $link .= '</a>';
705
+
706
+ // filter
707
+ $link = apply_filters( 'eeb_custom_href', $link, $display, $email, $attrs );
708
+
709
+ // mark link as successfullly encoded (for admin users)
710
+ if ( current_user_can( EEB()->settings->get_admin_cap( 'frontend-display-security-check' ) ) && $show_encoded_check ) {
711
+ $link .= '<i class="eeb-encoded dashicons-before dashicons-lock" title="' . __( 'Custom attribute encoded successfully!', 'email-encoder-bundle' ) . '"></i>';
712
+ }
713
+
714
+
715
+ return $link;
716
+ }
717
+
718
  /**
719
  * Create protected display combining these 3 methods:
720
  * - reversing string
core/includes/integrations/classes/foggy_email.php CHANGED
@@ -108,6 +108,11 @@ if( ! class_exists( 'Email_Encoder_Integration_FoggyEmail' ) ){
108
  //Make sure after deactivating the logic, the emails get removed as well
109
  if( empty( $foggy_email_api_key ) && ! empty( $emails ) ){
110
 
 
 
 
 
 
111
  if( is_array( $emails ) ){
112
  foreach( $emails as $key => $mail ){
113
  if( isset( $mail['alias'] ) && isset( $mail['api_key'] ) ){
@@ -192,6 +197,8 @@ if( ! class_exists( 'Email_Encoder_Integration_FoggyEmail' ) ){
192
  ) ),
193
  'cookies' => array()
194
  );
 
 
195
  $response = wp_remote_post( $endpoint, $http_args );
196
 
197
  if ( ! is_wp_error( $response ) && isset( $response['body'] ) ) {
108
  //Make sure after deactivating the logic, the emails get removed as well
109
  if( empty( $foggy_email_api_key ) && ! empty( $emails ) ){
110
 
111
+ //Allow a hard reset of the added emails
112
+ if( isset( $_GET['eeb_fggy_email_clear_entries'] ) && current_user_can( 'manage_options' ) ){
113
+ $emails = null;
114
+ }
115
+
116
  if( is_array( $emails ) ){
117
  foreach( $emails as $key => $mail ){
118
  if( isset( $mail['alias'] ) && isset( $mail['api_key'] ) ){
197
  ) ),
198
  'cookies' => array()
199
  );
200
+ $http_args = apply_filters( 'eeb/integrations/foggy_email/http_args', $http_args, $email );
201
+
202
  $response = wp_remote_post( $endpoint, $http_args );
203
 
204
  if ( ! is_wp_error( $response ) && isset( $response['body'] ) ) {
email-encoder-bundle.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: Email Encoder - Protect Email Addresses
4
- * Version: 2.0.9
5
  * Plugin URI: https://wordpress.org/plugins/email-encoder-bundle/
6
  * Description: Protect email addresses on your site and hide them from spambots. Easy to use & flexible.
7
  * Author: Ironikus
@@ -22,7 +22,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
22
  define( 'EEB_NAME', 'Email Encoder' );
23
 
24
  // Plugin version.
25
- define( 'EEB_VERSION', '2.0.9' );
26
 
27
  // Determines if the plugin is loaded
28
  define( 'EEB_SETUP', true );
1
  <?php
2
  /**
3
  * Plugin Name: Email Encoder - Protect Email Addresses
4
+ * Version: 2.1.0
5
  * Plugin URI: https://wordpress.org/plugins/email-encoder-bundle/
6
  * Description: Protect email addresses on your site and hide them from spambots. Easy to use & flexible.
7
  * Author: Ironikus
22
  define( 'EEB_NAME', 'Email Encoder' );
23
 
24
  // Plugin version.
25
+ define( 'EEB_VERSION', '2.1.0' );
26
 
27
  // Determines if the plugin is loaded
28
  define( 'EEB_SETUP', true );
readme.txt CHANGED
@@ -1,24 +1,25 @@
1
  === Email Encoder - Protect Email Addresses ===
2
  Contributors: ironikus
3
- Tags: anti spam, protect, encode, encrypt, hide, antispam, mailto, spambot, secure, e-mail, email, mail
4
  Requires at least: 4.7
5
  Requires PHP: 5.1
6
- Tested up to: 5.5.1
7
- Stable tag: 2.0.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Protect email addresses on your site and hide them from spambots. Easy to use & flexible.
12
 
13
  == Description ==
14
 
15
  Full site protection for your email addresses from spam-bots, email harvesters and other robots. No configuration needed.
16
- Also supports [foggy.email](https://foggy.email/) and protects phone numbers or any other text using our integrated `[eeb_protect_content]` shortcode.
17
 
18
  = Features =
19
  * Full page protection for all of your emails
20
  * Instant results (No confiruation needed)
21
  * Protects mailto links, plain emails, email input fields, RSS feeds and much more
 
22
  * Autmoatic protection technique detection (Our plugin chooses automatically the best protection technique for each email)
23
  * Exclude posts and pages from protection
24
  * Automatically convert plain emails to mailto-links
@@ -87,8 +88,7 @@ All email addresses are protected automatically by default, so it is not necessa
87
 
88
  In case you wish to customize it, we also offer some neatsettings, shortcodes and template functions. Please check the settings page within your WordPress website or [our documentation](https://ironikus.com/docs/article-categories/email-encoder/)
89
 
90
- The visitors will see everything as normal, but the source behind it will now be encoded (for spambots), and looks, for example, like the code down below (Depending on your settings):
91
- `<script type="text/javascript">/*<![CDATA[*/ML="mo@k<insc:r.y=-Ehe a\">f/lMt";MI="4CB8HC77=D0C5HJ1>H563DB@:AF=D0C5HJ190<6C0A2JA7J;6HDBBJ5JHA=DI<B?0C5HDEI<B?0C5H4GCE";OT="";for(j=0;j<MI.length;j++){OT+=ML.charAt(MI.charCodeAt(j)-48);}document.write(OT);/*]]>*/</script><noscript>*protected email*</noscript>`
92
 
93
  For more information, please check out the [following page](https://ironikus.com/docs/knowledge-base/what-will-be-protected-2/)
94
 
@@ -126,6 +126,13 @@ Yes, since version 1.3.0 also special characters are supported.
126
 
127
  == Changelog ==
128
 
 
 
 
 
 
 
 
129
  = 2.0.9 =
130
  * Fix: Issue with not properly validated soft-encoded attribute tags on the dom attributes
131
  * Fix: Issue with not properly validated soft-encoded attributes on special softencoded tags for the content filter
1
  === Email Encoder - Protect Email Addresses ===
2
  Contributors: ironikus
3
+ Tags: anti spam, protect, encode, encrypt, hide, antispam, phone number, spambot, secure, e-mail, email, mail
4
  Requires at least: 4.7
5
  Requires PHP: 5.1
6
+ Tested up to: 5.6
7
+ Stable tag: 2.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Protect email addresses and phone numbers on your site and hide them from spambots. Easy to use & flexible.
12
 
13
  == Description ==
14
 
15
  Full site protection for your email addresses from spam-bots, email harvesters and other robots. No configuration needed.
16
+ Also supports [foggy.email](https://foggy.email/) and protects phone numbers or any other text using our integrated `[eeb_protect_content]` shortcode or href attribute encoding.
17
 
18
  = Features =
19
  * Full page protection for all of your emails
20
  * Instant results (No confiruation needed)
21
  * Protects mailto links, plain emails, email input fields, RSS feeds and much more
22
+ * Protect phone number links, ftp, skype, file and other custom link attributes
23
  * Autmoatic protection technique detection (Our plugin chooses automatically the best protection technique for each email)
24
  * Exclude posts and pages from protection
25
  * Automatically convert plain emails to mailto-links
88
 
89
  In case you wish to customize it, we also offer some neatsettings, shortcodes and template functions. Please check the settings page within your WordPress website or [our documentation](https://ironikus.com/docs/article-categories/email-encoder/)
90
 
91
+ The visitors will see everything as normal, but the source behind it will now be encoded.
 
92
 
93
  For more information, please check out the [following page](https://ironikus.com/docs/knowledge-base/what-will-be-protected-2/)
94
 
126
 
127
  == Changelog ==
128
 
129
+ = 2.1.0 =
130
+ * Feature: New advanced setting to automatically protect custom link attributes such as tel:, file:, ftp:, skype:, etc. (Protect custom href attributes)
131
+ * Tweak: Adjust JS documentation
132
+ * Tweak: Adjust readme file
133
+ * Tweak: Allow a hard-reset on foggy.email aliases
134
+ * Dev: New filter eeb/integrations/foggy_email/http_args for manipulating the http arguments send over to foggy.email
135
+
136
  = 2.0.9 =
137
  * Fix: Issue with not properly validated soft-encoded attribute tags on the dom attributes
138
  * Fix: Issue with not properly validated soft-encoded attributes on special softencoded tags for the content filter