Email Encoder Bundle – Protect Email Address - Version 2.0.5

Version Description

  • Feature: Soft-Encode all HTML tags + new settings item (This will prevent complex plugins from breaking)
  • Dev: New filter for randomization of javascript escaping methods
Download this release

Release Info

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

Code changes from version 2.0.4 to 2.0.5

core/includes/classes/class-email-encoder-bundle-settings.php CHANGED
@@ -197,6 +197,11 @@ class Email_Encoder_Settings{
197
  'label' => __( 'no script tags', 'email-encoder-bundle' ),
198
  'description' => __( 'Check this option if you face issues with encoded script tags. This will deactivate protection for script tags.', 'email-encoder-bundle' )
199
  ),
 
 
 
 
 
200
  ),
201
  'required' => false,
202
  ),
197
  'label' => __( 'no script tags', 'email-encoder-bundle' ),
198
  'description' => __( 'Check this option if you face issues with encoded script tags. This will deactivate protection for script tags.', 'email-encoder-bundle' )
199
  ),
200
+ 'no_attribute_validation' => array(
201
+ 'advanced' => true,
202
+ 'label' => __( 'html attributes without soft encoding.', 'email-encoder-bundle' ),
203
+ 'description' => __( 'Do not soft-filter all html attributes. This might optimizes the performance, but can break the site if other plugins use your email in attribute tags.', 'email-encoder-bundle' )
204
+ ),
205
  ),
206
  'required' => false,
207
  ),
core/includes/classes/class-email-encoder-bundle-validate.php CHANGED
@@ -327,10 +327,34 @@ class Email_Encoder_Validate{
327
  public function filter_soft_dom_attributes( $content, $protection_method ){
328
 
329
  $no_script_tags = (bool) EEB()->settings->get_setting( 'no_script_tags', true, 'filter_body' );
 
330
 
331
  if( class_exists( 'DOMDocument' ) ){
332
  $dom = new DOMDocument();
333
  @$dom->loadHTML($content);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
 
335
  //Soft-encode scripts
336
  $script = $dom->getElementsByTagName('script');
@@ -621,7 +645,8 @@ class Email_Encoder_Validate{
621
  */
622
  public function dynamic_js_email_encoding( $email, $protection_text = null ){
623
  $return = $email;
624
- $rand = rand(0,2);
 
625
  switch( $rand ){
626
  case 2:
627
  $return = $this->encode_escape( $return, $protection_text );
327
  public function filter_soft_dom_attributes( $content, $protection_method ){
328
 
329
  $no_script_tags = (bool) EEB()->settings->get_setting( 'no_script_tags', true, 'filter_body' );
330
+ $no_attribute_validation = (bool) EEB()->settings->get_setting( 'no_attribute_validation', true, 'filter_body' );
331
 
332
  if( class_exists( 'DOMDocument' ) ){
333
  $dom = new DOMDocument();
334
  @$dom->loadHTML($content);
335
+
336
+ //Filter html attributes
337
+ if( ! $no_attribute_validation ){
338
+ $allNodes = $dom->getElementsByTagName('*');
339
+ foreach( $allNodes as $snote ){
340
+ if( $snote->hasAttributes() ) {
341
+ foreach( $snote->attributes as $attr ) {
342
+ if( $attr->nodeName == 'href' || $attr->nodeName == 'src' ){
343
+ continue;
344
+ }
345
+
346
+ if( strpos( $attr->nodeValue, '@' ) !== FALSE ){
347
+ $single_tags = array();
348
+ preg_match_all( '/' . $attr->nodeName . '="([^"]*)"/i', $content, $single_tags );
349
+
350
+ foreach( $single_tags as $single ){
351
+ $content = str_replace( $single, $this->filter_plain_emails( $single, null, $protection_method, false ), $content );
352
+ }
353
+ }
354
+ }
355
+ }
356
+ }
357
+ }
358
 
359
  //Soft-encode scripts
360
  $script = $dom->getElementsByTagName('script');
645
  */
646
  public function dynamic_js_email_encoding( $email, $protection_text = null ){
647
  $return = $email;
648
+ $rand = apply_filters( 'eeb/validate/random_encoding', rand(0,2), $email, $protection_text );
649
+
650
  switch( $rand ){
651
  case 2:
652
  $return = $this->encode_escape( $return, $protection_text );
email-encoder-bundle.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: Email Encoder - Protect Email Addresses
4
- * Version: 2.0.4
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.4' );
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.5
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.5' );
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
7
- Stable tag: 2.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -121,6 +121,10 @@ Yes, since version 1.3.0 also special characters are supported.
121
 
122
  == Changelog ==
123
 
 
 
 
 
124
  = 2.0.4 =
125
  * Feature: Exclude script tags from being encoded
126
  * Fix: Revalidate and strip escape sequences for encode_escape function
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.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
121
 
122
  == Changelog ==
123
 
124
+ = 2.0.5 =
125
+ * Feature: Soft-Encode all HTML tags + new settings item (This will prevent complex plugins from breaking)
126
+ * Dev: New filter for randomization of javascript escaping methods
127
+
128
  = 2.0.4 =
129
  * Feature: Exclude script tags from being encoded
130
  * Fix: Revalidate and strip escape sequences for encode_escape function