Email Encoder Bundle – Protect Email Address - Version 2.0.7

Version Description

  • Feature: Underline emails that are converted to an image (Cutsomizable)
  • Feature: Integration for the Google Site Kit plugin - https://wordpress.org/plugins/google-site-kit/
  • Feature: Integration for the events calendar plugin - https://de.wordpress.org/plugins/the-events-calendar/
  • Tweak: Softening the regex to recognize spaces before the closing tags
Download this release

Release Info

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

Code changes from version 2.0.6 to 2.0.7

core/includes/classes/class-email-encoder-bundle-settings.php CHANGED
@@ -240,6 +240,11 @@ class Email_Encoder_Settings{
240
  'label' => __( 'Font Size', 'email-encoder-bundle' ),
241
  'description' => __( 'Change the font size of the image text. Default: 4 - You can choose from 1 - 5', 'email-encoder-bundle' )
242
  ),
 
 
 
 
 
243
  ),
244
  'required' => false,
245
  ),
@@ -358,6 +363,7 @@ class Email_Encoder_Settings{
358
  'image_color' => '0,0,0',
359
  'image_background_color'=> '0,0,0',
360
  'image_text_opacity' => '0',
 
361
  'image_background_opacity' => '127',
362
  'image_font_size' => '4',
363
  );
240
  'label' => __( 'Font Size', 'email-encoder-bundle' ),
241
  'description' => __( 'Change the font size of the image text. Default: 4 - You can choose from 1 - 5', 'email-encoder-bundle' )
242
  ),
243
+ 'image_underline' => array(
244
+ 'advanced' => true,
245
+ 'label' => __( 'Text Underline', 'email-encoder-bundle' ),
246
+ 'description' => __( 'Adds a line beneath the text to highlight it as a link. empty or 0 deactivates the border. 1 = 1px', 'email-encoder-bundle' )
247
+ ),
248
  ),
249
  'required' => false,
250
  ),
363
  'image_color' => '0,0,0',
364
  'image_background_color'=> '0,0,0',
365
  'image_text_opacity' => '0',
366
+ 'image_underline' => '0',
367
  'image_background_opacity' => '127',
368
  'image_font_size' => '4',
369
  );
core/includes/classes/class-email-encoder-bundle-validate.php CHANGED
@@ -279,7 +279,7 @@ class Email_Encoder_Validate{
279
  return $self->create_protected_mailto( $match[4], $attrs, $protection_method );
280
  };
281
 
282
- $regexpMailtoLink = '/<a[\s+]*(([^>]*)href=["\']mailto\:([^>]*)["\'])>(.*?)<\/a[\s+]*>/is';
283
 
284
  return preg_replace_callback( $regexpMailtoLink, $callbackEncodeMailtoLinks, $content );
285
  }
@@ -353,7 +353,7 @@ class Email_Encoder_Validate{
353
 
354
  if( strpos( $attr->nodeValue, '@' ) !== FALSE ){
355
  $single_tags = array();
356
- preg_match_all( '/' . $attr->nodeName . '="([^"]*)"/i', $content, $single_tags );
357
 
358
  foreach( $single_tags as $single ){
359
  $content = str_replace( $single, $this->filter_plain_emails( $single, null, $protection_method, false ), $content );
@@ -713,6 +713,10 @@ class Email_Encoder_Validate{
713
  $image_text_opacity = (int) EEB()->settings->get_setting( 'image_text_opacity', true, 'image_settings' );
714
  $image_background_opacity = (int) EEB()->settings->get_setting( 'image_background_opacity', true, 'image_settings' );
715
  $image_font_size = (int) EEB()->settings->get_setting( 'image_font_size', true, 'image_settings' );
 
 
 
 
716
 
717
  if( $image_background_color === 'default' ){
718
  $image_background_color = $setting_image_background_color;
@@ -748,10 +752,26 @@ class Email_Encoder_Validate{
748
  $font_size = intval( $image_font_size );
749
  }
750
 
751
- $img = imagecreatetruecolor( imagefontwidth( $font_size ) * strlen( $email ), imagefontheight( $font_size ) );
 
 
 
 
 
 
 
 
 
752
  imagesavealpha( $img, true );
753
  imagefill( $img, 0, 0, imagecolorallocatealpha ($img, $bg_red, $bg_green, $bg_blue, $alpha_fill ) );
754
  imagestring( $img, $font_size, 0, 0, $email, imagecolorallocatealpha( $img, $string_red, $string_green, $string_blue, $alpha_string ) );
 
 
 
 
 
 
 
755
  ob_start();
756
  imagepng( $img );
757
  imagedestroy( $img );
279
  return $self->create_protected_mailto( $match[4], $attrs, $protection_method );
280
  };
281
 
282
+ $regexpMailtoLink = '/<a[\s+]*(([^>]*)href=["\']mailto\:([^>]*)["\' ])>(.*?)<\/a[\s+]*>/is';
283
 
284
  return preg_replace_callback( $regexpMailtoLink, $callbackEncodeMailtoLinks, $content );
285
  }
353
 
354
  if( strpos( $attr->nodeValue, '@' ) !== FALSE ){
355
  $single_tags = array();
356
+ preg_match_all( '/' . $attr->nodeName . '=["\']([^"]*)["\']/i', $content, $single_tags );
357
 
358
  foreach( $single_tags as $single ){
359
  $content = str_replace( $single, $this->filter_plain_emails( $single, null, $protection_method, false ), $content );
713
  $image_text_opacity = (int) EEB()->settings->get_setting( 'image_text_opacity', true, 'image_settings' );
714
  $image_background_opacity = (int) EEB()->settings->get_setting( 'image_background_opacity', true, 'image_settings' );
715
  $image_font_size = (int) EEB()->settings->get_setting( 'image_font_size', true, 'image_settings' );
716
+ $image_underline = (int) EEB()->settings->get_setting( 'image_underline', true, 'image_settings' );
717
+ $border_padding = 0;
718
+ $border_offset = 2;
719
+ $border_height = ( is_numeric( $image_underline ) && ! empty( $image_underline ) ) ? intval( $image_underline ) : 0;
720
 
721
  if( $image_background_color === 'default' ){
722
  $image_background_color = $setting_image_background_color;
752
  $font_size = intval( $image_font_size );
753
  }
754
 
755
+ $img_width = imagefontwidth( $font_size ) * strlen( $email );
756
+ $img_height = imagefontheight( $font_size );
757
+
758
+ if( ! empty( $border_height ) ){
759
+ $img_real_height = $img_height + $border_offset + $border_height;
760
+ } else {
761
+ $img_real_height = $img_height;
762
+ }
763
+
764
+ $img = imagecreatetruecolor( $img_width, $img_real_height );
765
  imagesavealpha( $img, true );
766
  imagefill( $img, 0, 0, imagecolorallocatealpha ($img, $bg_red, $bg_green, $bg_blue, $alpha_fill ) );
767
  imagestring( $img, $font_size, 0, 0, $email, imagecolorallocatealpha( $img, $string_red, $string_green, $string_blue, $alpha_string ) );
768
+
769
+
770
+ if( ! empty( $border_height ) ){
771
+ $border_fill = imagecolorallocatealpha ($img, $string_red, $string_green, $string_blue, $alpha_string );
772
+ imagefilledrectangle( $img, 0, $border_offset + $img_height + $border_height - 1, $border_padding + $img_width, $border_offset + $img_height, $border_fill );
773
+ }
774
+
775
  ob_start();
776
  imagepng( $img );
777
  imagedestroy( $img );
core/includes/integrations/classes/google_site_kit.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly.
4
+ if ( !defined( 'ABSPATH' ) ) exit;
5
+
6
+ if( ! class_exists( 'Email_Encoder_Integration_Google_Site_Kit' ) ){
7
+
8
+ /**
9
+ * Class Email_Encoder_Integration_Google_Site_Kit
10
+ *
11
+ * This class integrates support for Google Site Kit plugin https://wordpress.org/plugins/google-site-kit/
12
+ *
13
+ * @since 2.0.7
14
+ * @package EEB
15
+ * @author Ironikus <info@ironikus.com>
16
+ */
17
+
18
+ class Email_Encoder_Integration_Google_Site_Kit{
19
+
20
+ /**
21
+ * Our Email_Encoder_Run constructor.
22
+ */
23
+ function __construct(){
24
+ add_filter( 'googlesitekit_admin_data', array( $this, 'soft_encode_googlesitekit_admin_data' ), 100, 1 );
25
+ }
26
+
27
+ /**
28
+ * ######################
29
+ * ###
30
+ * #### CORE LOGIC
31
+ * ###
32
+ * ######################
33
+ */
34
+
35
+ public function soft_encode_googlesitekit_admin_data( $admin_data ){
36
+
37
+ $soft_encode = apply_filters( 'eeb/integrations/google_site_kit/soft_encode', true );
38
+
39
+ if( isset( $admin_data['userData'] ) && isset( $admin_data['userData']['email'] ) ){
40
+
41
+ if( $soft_encode ){
42
+ $admin_data['userData']['email'] = antispambot( $admin_data['userData']['email'] );
43
+ } else {
44
+ $admin_data['userData']['email'] = EEB()->validate->temp_encode_at_symbol( $admin_data['userData']['email'] );
45
+ }
46
+
47
+ }
48
+
49
+ return $admin_data;
50
+ }
51
+
52
+
53
+ }
54
+
55
+ new Email_Encoder_Integration_Google_Site_Kit();
56
+ }
core/includes/integrations/classes/the_events_calendar.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly.
4
+ if ( !defined( 'ABSPATH' ) ) exit;
5
+
6
+ if( ! class_exists( 'Email_Encoder_Integration_The_Events_Calendar' ) ){
7
+
8
+ /**
9
+ * Class Email_Encoder_Integration_The_Events_Calendar
10
+ *
11
+ * This class integrates support for The Events Calendar https://de.wordpress.org/plugins/the-events-calendar/
12
+ *
13
+ * @since 2.0.7
14
+ * @package EEB
15
+ * @author Ironikus <info@ironikus.com>
16
+ */
17
+
18
+ class Email_Encoder_Integration_The_Events_Calendar{
19
+
20
+ /**
21
+ * Our Email_Encoder_Run constructor.
22
+ */
23
+ function __construct(){
24
+ add_filter( 'tribe_get_organizer_email', array( $this, 'deactivate_tribe_email_filter' ), 100, 2 );
25
+ }
26
+
27
+ /**
28
+ * ######################
29
+ * ###
30
+ * #### CORE LOGIC
31
+ * ###
32
+ * ######################
33
+ */
34
+
35
+ public function deactivate_tribe_email_filter( $filtered_email, $unfiltered_email ){
36
+ return $unfiltered_email;
37
+ }
38
+
39
+
40
+ }
41
+
42
+ new Email_Encoder_Integration_The_Events_Calendar();
43
+ }
core/includes/integrations/loader.php CHANGED
@@ -19,7 +19,9 @@ class EEB_Integrations_Loader{
19
  $plugins = array(
20
  'maintenance' => 'maintenance.php',
21
  'divi_theme' => 'divi_theme.php',
 
22
  'oxygen_builder' => 'oxygen_builder.php',
 
23
  );
24
 
25
  $services = array(
19
  $plugins = array(
20
  'maintenance' => 'maintenance.php',
21
  'divi_theme' => 'divi_theme.php',
22
+ 'google_site_kit' => 'google_site_kit.php',
23
  'oxygen_builder' => 'oxygen_builder.php',
24
+ 'the_events_calendar' => 'the_events_calendar.php',
25
  );
26
 
27
  $services = array(
email-encoder-bundle.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: Email Encoder - Protect Email Addresses
4
- * Version: 2.0.6
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.6' );
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.0.7
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.0.7' );
26
 
27
  // Determines if the plugin is loaded
28
  define( 'EEB_SETUP', true );
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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.3.2
7
- Stable tag: 2.0.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -126,6 +126,12 @@ Yes, since version 1.3.0 also special characters are supported.
126
 
127
  == Changelog ==
128
 
 
 
 
 
 
 
129
  = 2.0.6 =
130
  * Feature: Fully integrated with Foggy Email to protect your real email address: https://foggy.email/
131
  * Feature: We fully removed all external marketing advertisements! Enjoy our plugin without distrations! :)
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.4
7
+ Stable tag: 2.0.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
126
 
127
  == Changelog ==
128
 
129
+ = 2.0.7 =
130
+ * Feature: Underline emails that are converted to an image (Cutsomizable)
131
+ * Feature: Integration for the Google Site Kit plugin - https://wordpress.org/plugins/google-site-kit/
132
+ * Feature: Integration for the events calendar plugin - https://de.wordpress.org/plugins/the-events-calendar/
133
+ * Tweak: Softening the regex to recognize spaces before the closing tags
134
+
135
  = 2.0.6 =
136
  * Feature: Fully integrated with Foggy Email to protect your real email address: https://foggy.email/
137
  * Feature: We fully removed all external marketing advertisements! Enjoy our plugin without distrations! :)