Email Subscribers & Newsletters - Version 3.5.13

Version Description

(05.10.2018) =

  • Fix: Oops, an unexpected error occurred while subscribing
  • Update: Added shortcode support in email templates learn more
Download this release

Release Info

Developer Icegram
Plugin Icon 128x128 Email Subscribers & Newsletters
Version 3.5.13
Comparing to
See all releases

Code changes from version 3.5.12 to 3.5.13

changelog.txt CHANGED
@@ -4,6 +4,11 @@ Author : Icegram
4
  Author URI : https://www.icegram.com/
5
  License : GPLv3
6
 
 
 
 
 
 
7
  ***********************************************************Version 3.5.12***********************************************************
8
 
9
  * Fix: Invalid unsubscribe link
4
  Author URI : https://www.icegram.com/
5
  License : GPLv3
6
 
7
+ ***********************************************************Version 3.5.13***********************************************************
8
+
9
+ * Fix: “Oops, an unexpected error occurred” while subscribing
10
+ * Update: Added shortcode support in email templates [learn more](https://www.icegram.com/documentation/why-some-shortcodes-are-not-working-in-email-templates)
11
+
12
  ***********************************************************Version 3.5.12***********************************************************
13
 
14
  * Fix: Invalid unsubscribe link
classes/es-register.php CHANGED
@@ -1031,7 +1031,7 @@ class es_cls_registerhook {
1031
  $content = $GLOBALS['wp_embed']->autoembed( $content );
1032
  }
1033
  $content = wpautop( $content );
1034
- // $content = do_shortcode( shortcode_unautop( $content ) );
1035
  $data['content'] = $content;
1036
  $data['tmpl_id'] = $tmpl_id;
1037
  $data = apply_filters( 'es_after_process_template_body', $data );
@@ -1124,10 +1124,8 @@ class es_cls_registerhook {
1124
  $es_name = $instance['es_name'];
1125
  $es_group = $instance['es_group'];
1126
  $es_pre = $instance['es_pre'];
1127
-
1128
  ob_start();
1129
  ?>
1130
-
1131
  <div class="es_form_container">
1132
  <form class="es_<?php echo $es_pre ?>_form" data-es_form_id="es_<?php echo $es_pre ?>_form">
1133
  <?php if ( $es_desc != "" ) { ?>
@@ -1159,15 +1157,14 @@ class es_cls_registerhook {
1159
  <?php if ( $es_name != "YES" ) { ?>
1160
  <input type="hidden" id="es_txt_name" name="es_txt_name" value="">
1161
  <?php } ?>
 
1162
  <input type="hidden" id="es_txt_group" name="es_txt_group" value="<?php echo $es_group; ?>">
1163
  <?php $nonce = wp_create_nonce( 'es-subscribe' ); ?>
1164
  <input type="hidden" name="es-subscribe" id="es-subscribe" value="<?php echo $nonce; ?>"/>
1165
  </form>
1166
  <?php do_action( 'es_after_form' ) ?>
1167
  </div>
1168
-
1169
- <?php
1170
- return $es_form = ob_get_clean();
1171
 
1172
  }
1173
 
1031
  $content = $GLOBALS['wp_embed']->autoembed( $content );
1032
  }
1033
  $content = wpautop( $content );
1034
+ $content = do_shortcode( shortcode_unautop( $content ) );
1035
  $data['content'] = $content;
1036
  $data['tmpl_id'] = $tmpl_id;
1037
  $data = apply_filters( 'es_after_process_template_body', $data );
1124
  $es_name = $instance['es_name'];
1125
  $es_group = $instance['es_group'];
1126
  $es_pre = $instance['es_pre'];
 
1127
  ob_start();
1128
  ?>
 
1129
  <div class="es_form_container">
1130
  <form class="es_<?php echo $es_pre ?>_form" data-es_form_id="es_<?php echo $es_pre ?>_form">
1131
  <?php if ( $es_desc != "" ) { ?>
1157
  <?php if ( $es_name != "YES" ) { ?>
1158
  <input type="hidden" id="es_txt_name" name="es_txt_name" value="">
1159
  <?php } ?>
1160
+ <div style="position:absolute; left: -5000px"><input type="text" name="es_required_field" class="es_required_field" tabindex="-1" autocomplete="es_test"/></div>
1161
  <input type="hidden" id="es_txt_group" name="es_txt_group" value="<?php echo $es_group; ?>">
1162
  <?php $nonce = wp_create_nonce( 'es-subscribe' ); ?>
1163
  <input type="hidden" name="es-subscribe" id="es-subscribe" value="<?php echo $nonce; ?>"/>
1164
  </form>
1165
  <?php do_action( 'es_after_form' ) ?>
1166
  </div>
1167
+ <?php return $es_form = ob_get_clean();
 
 
1168
 
1169
  }
1170
 
email-subscribers.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Email Subscribers & Newsletters
4
  * Plugin URI: https://www.icegram.com/
5
  * Description: Add subscription forms on website, send HTML newsletters & automatically notify subscribers about new blog posts once it is published.
6
- * Version: 3.5.12
7
  * Author: Icegram
8
  * Author URI: https://www.icegram.com/
9
  * Requires at least: 3.9
@@ -93,7 +93,6 @@ if (is_admin() && !( in_array('email-subscribers-premium/email-subscribers-premi
93
  add_action( 'es_after_email_sent_option', array( 'es_cls_registerhook', 'add_cron_service' ) );
94
  add_action( 'edit_form_advanced', array( 'es_cls_registerhook', 'add_spam_score_utm_link' ) );
95
  }
96
-
97
  // To store current date and version in db with each update
98
  add_action( 'upgrader_process_complete', 'es_update_current_version_and_date', 10, 2 );
99
  function es_update_current_version_and_date( $upgrader_object, $options ) {
3
  * Plugin Name: Email Subscribers & Newsletters
4
  * Plugin URI: https://www.icegram.com/
5
  * Description: Add subscription forms on website, send HTML newsletters & automatically notify subscribers about new blog posts once it is published.
6
+ * Version: 3.5.13
7
  * Author: Icegram
8
  * Author URI: https://www.icegram.com/
9
  * Requires at least: 3.9
93
  add_action( 'es_after_email_sent_option', array( 'es_cls_registerhook', 'add_cron_service' ) );
94
  add_action( 'edit_form_advanced', array( 'es_cls_registerhook', 'add_spam_score_utm_link' ) );
95
  }
 
96
  // To store current date and version in db with each update
97
  add_action( 'upgrader_process_complete', 'es_update_current_version_and_date', 10, 2 );
98
  function es_update_current_version_and_date( $upgrader_object, $options ) {
job/es-subscribe.php CHANGED
@@ -15,87 +15,91 @@ class es_cls_job_subscribe {
15
  }
16
 
17
  public function es_add_subscriber() {
18
-
19
  $es_response = array();
20
- $homeurl = home_url();
21
- $homeurl_host = (!empty($homeurl)) ? parse_url($homeurl, PHP_URL_HOST) : '';
22
- $referer = wp_get_referer();
23
- $referer_host = (!empty($referer)) ? parse_url($referer, PHP_URL_HOST) : '';
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- if ( !empty($homeurl_host) && !empty($referer_host) && $referer_host === $homeurl_host) {
 
 
 
26
 
27
- if ( ( isset( $_REQUEST['es'] ) ) && ( 'subscribe' === $_REQUEST['es'] ) && ( isset( $_REQUEST['action'] ) ) && ( 'es_add_subscriber' === $_REQUEST['action'] ) && !empty( $_REQUEST['esfpx_es-subscribe'] ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
- foreach ($_REQUEST as $key => $value) {
30
- $new_key = str_replace('_pg', '', $key);
31
- $_REQUEST[$new_key] = $value;
32
- }
 
 
33
 
34
- $es_subscriber_name = isset( $_REQUEST['esfpx_es_txt_name'] ) ? trim($_REQUEST['esfpx_es_txt_name']) : '';
35
- $es_subscriber_email = isset( $_REQUEST['esfpx_es_txt_email'] ) ? trim($_REQUEST['esfpx_es_txt_email']) : '';
36
- $es_subscriber_group = isset( $_REQUEST['esfpx_es_txt_group'] ) ? trim($_REQUEST['esfpx_es_txt_group']) : '';
37
- $es_nonce = $_REQUEST['esfpx_es-subscribe'];
38
 
39
- $subscriber_form = array(
40
- 'es_email_name' => '',
41
- 'es_email_mail' => '',
42
- 'es_email_group' => '',
43
- 'es_email_status' => '',
44
- 'es_nonce' => ''
45
- );
46
 
47
- if( $es_subscriber_group == '' ) {
48
- $es_subscriber_group = 'Public';
49
- }
50
-
51
- if ( $es_subscriber_email != '' ) {
52
- if ( !filter_var( $es_subscriber_email, FILTER_VALIDATE_EMAIL ) ) {
53
- $es_response['error'] = 'invalid-email';
54
  } else {
55
- $action = '';
56
- global $wpdb;
57
-
58
- $subscriber_form['es_email_name'] = $es_subscriber_name;
59
- $subscriber_form['es_email_mail'] = $es_subscriber_email;
60
- $subscriber_form['es_email_group'] = $es_subscriber_group;
61
- $subscriber_form['es_nonce'] = $es_nonce;
62
-
63
- $es_optintype = get_option( 'ig_es_optintype' );
64
 
 
 
 
65
  if( $es_optintype == "Double Opt In" ) {
66
- $subscriber_form['es_email_status'] = "Unconfirmed";
 
67
  } else {
68
- $subscriber_form['es_email_status'] = "Single Opt In";
69
- }
70
-
71
- $action = es_cls_dbquery::es_view_subscriber_widget($subscriber_form);
72
- if( $action == "sus" ) {
73
- $subscribers = es_cls_dbquery::es_view_subscriber_one($es_subscriber_email,$es_subscriber_group);
74
- if( $es_optintype == "Double Opt In" ) {
75
- es_cls_sendmail::es_sendmail("optin", $template = 0, $subscribers, "optin", 0);
76
- $es_response['success'] = 'subscribed-pending-doubleoptin';
77
- } else {
78
- $es_c_usermailoption = get_option( 'ig_es_welcomeemail' );
79
- if ( $es_c_usermailoption == "YES" ) {
80
- es_cls_sendmail::es_sendmail("welcome", $template = 0, $subscribers, "welcome", 0);
81
- }
82
- $es_response['success'] = 'subscribed-successfully';
83
- }
84
- } elseif( $action == "ext" ) {
85
- $es_response['success'] = 'already-exist';
86
- } elseif( $action == "invalid" ) {
87
- $es_response['error'] = 'invalid-email';
88
- }
89
  }
90
- } else {
91
- $es_response['error'] = 'no-email-address';
92
  }
93
  } else {
94
- $es_response['error'] = 'unexpected-error';
95
  }
96
- }else{
97
  $es_response['error'] = 'unexpected-error';
98
- }
 
99
 
100
  echo json_encode($es_response);
101
  die();
15
  }
16
 
17
  public function es_add_subscriber() {
 
18
  $es_response = array();
19
+ //honey-pot validation
20
+ if(!empty($_POST['es_required_field'])){
21
+ $es_response['error'] = 'unexpected-error';
22
+ echo json_encode($es_response);
23
+ die();
24
+ }
25
+ //block address list
26
+ $es_disposable_list = array('mail.ru');
27
+ $es_domain = substr(strrchr(trim($_POST['esfpx_es_txt_email']) , "@"), 1); //extract domain name from email
28
+ if(in_array($es_domain, $es_disposable_list)){
29
+ $es_response['error'] = 'unexpected-error';
30
+ echo json_encode($es_response);
31
+ die();
32
+ }
33
+ if ( ( isset( $_POST['es'] ) ) && ( 'subscribe' === $_POST['es'] ) && ( isset( $_POST['action'] ) ) && ( 'es_add_subscriber' === $_POST['action'] ) && !empty( $_POST['esfpx_es-subscribe'] ) ) {
34
 
35
+ foreach ($_POST as $key => $value) {
36
+ $new_key = str_replace('_pg', '', $key);
37
+ $_POST[$new_key] = $value;
38
+ }
39
 
40
+ $es_subscriber_name = isset( $_POST['esfpx_es_txt_name'] ) ? trim($_POST['esfpx_es_txt_name']) : '';
41
+ $es_subscriber_email = isset( $_POST['esfpx_es_txt_email'] ) ? trim($_POST['esfpx_es_txt_email']) : '';
42
+ $es_subscriber_group = isset( $_POST['esfpx_es_txt_group'] ) ? trim($_POST['esfpx_es_txt_group']) : '';
43
+ $es_nonce = $_POST['esfpx_es-subscribe'];
44
+
45
+ $subscriber_form = array(
46
+ 'es_email_name' => '',
47
+ 'es_email_mail' => '',
48
+ 'es_email_group' => '',
49
+ 'es_email_status' => '',
50
+ 'es_nonce' => ''
51
+ );
52
+
53
+ if( $es_subscriber_group == '' ) {
54
+ $es_subscriber_group = 'Public';
55
+ }
56
 
57
+ if ( $es_subscriber_email != '' ) {
58
+ if ( !filter_var( $es_subscriber_email, FILTER_VALIDATE_EMAIL ) ) {
59
+ $es_response['error'] = 'invalid-email';
60
+ } else {
61
+ $action = '';
62
+ global $wpdb;
63
 
64
+ $subscriber_form['es_email_name'] = $es_subscriber_name;
65
+ $subscriber_form['es_email_mail'] = $es_subscriber_email;
66
+ $subscriber_form['es_email_group'] = $es_subscriber_group;
67
+ $subscriber_form['es_nonce'] = $es_nonce;
68
 
69
+ $es_optintype = get_option( 'ig_es_optintype' );
 
 
 
 
 
 
70
 
71
+ if( $es_optintype == "Double Opt In" ) {
72
+ $subscriber_form['es_email_status'] = "Unconfirmed";
 
 
 
 
 
73
  } else {
74
+ $subscriber_form['es_email_status'] = "Single Opt In";
75
+ }
 
 
 
 
 
 
 
76
 
77
+ $action = es_cls_dbquery::es_view_subscriber_widget($subscriber_form);
78
+ if( $action == "sus" ) {
79
+ $subscribers = es_cls_dbquery::es_view_subscriber_one($es_subscriber_email,$es_subscriber_group);
80
  if( $es_optintype == "Double Opt In" ) {
81
+ es_cls_sendmail::es_sendmail("optin", $template = 0, $subscribers, "optin", 0);
82
+ $es_response['success'] = 'subscribed-pending-doubleoptin';
83
  } else {
84
+ $es_c_usermailoption = get_option( 'ig_es_welcomeemail' );
85
+ if ( $es_c_usermailoption == "YES" ) {
86
+ es_cls_sendmail::es_sendmail("welcome", $template = 0, $subscribers, "welcome", 0);
87
+ }
88
+ $es_response['success'] = 'subscribed-successfully';
89
+ }
90
+ } elseif( $action == "ext" ) {
91
+ $es_response['success'] = 'already-exist';
92
+ } elseif( $action == "invalid" ) {
93
+ $es_response['error'] = 'invalid-email';
 
 
 
 
 
 
 
 
 
 
 
94
  }
 
 
95
  }
96
  } else {
97
+ $es_response['error'] = 'no-email-address';
98
  }
99
+ } else {
100
  $es_response['error'] = 'unexpected-error';
101
+ }
102
+
103
 
104
  echo json_encode($es_response);
105
  die();
query/db_subscriber.php CHANGED
@@ -98,10 +98,9 @@ class es_cls_dbquery {
98
  public static function es_view_subscriber_ins($data = array(), $action = "insert") {
99
 
100
  global $wpdb;
101
-
102
  // Security
103
  if ( array_key_exists( 'es_nonce', $data ) ) {
104
- if ( empty ( $data['es_nonce'] ) || ! wp_verify_nonce( $data['es_nonce'], 'es-subscribe' ) ) {
105
  return "invalid";
106
  }
107
  } elseif ( array_key_exists( 'es_af_nonce', $data ) ) {
98
  public static function es_view_subscriber_ins($data = array(), $action = "insert") {
99
 
100
  global $wpdb;
 
101
  // Security
102
  if ( array_key_exists( 'es_nonce', $data ) ) {
103
+ if ( empty ( $data['es_nonce'] ) || ! wp_verify_nonce( $data['es_nonce'], 'es-subscribe') ) {
104
  return "invalid";
105
  }
106
  } elseif ( array_key_exists( 'es_af_nonce', $data ) ) {
readme.txt CHANGED
@@ -5,7 +5,7 @@ Author URI: https://www.icegram.com/
5
  Tags: subscription, newsletter, email marketing, post notification, email newsletter form, email signup, email widget, newsletter signup, subscribe, subscription form, bulk emails, signup form, list builder, lead generation
6
  Requires at least: 3.9
7
  Tested up to: 4.9.8
8
- Stable tag: 3.5.12
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
@@ -342,6 +342,11 @@ Use our free plugin [Email Subscribers - Group Selector](https://wordpress.org/p
342
 
343
  == Changelog ==
344
 
 
 
 
 
 
345
  = 3.5.12 (28.09.2018) =
346
 
347
  * Fix: Invalid unsubscribe link
5
  Tags: subscription, newsletter, email marketing, post notification, email newsletter form, email signup, email widget, newsletter signup, subscribe, subscription form, bulk emails, signup form, list builder, lead generation
6
  Requires at least: 3.9
7
  Tested up to: 4.9.8
8
+ Stable tag: 3.5.13
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
342
 
343
  == Changelog ==
344
 
345
+ = 3.5.13 (05.10.2018) =
346
+
347
+ * Fix: “Oops, an unexpected error occurred” while subscribing
348
+ * Update: Added shortcode support in email templates [learn more](https://www.icegram.com/documentation/why-some-shortcodes-are-not-working-in-email-templates)
349
+
350
  = 3.5.12 (28.09.2018) =
351
 
352
  * Fix: Invalid unsubscribe link
templates/template-preview.php CHANGED
@@ -68,7 +68,7 @@ $template_type = get_post_meta( $did, 'es_template_type', true );
68
  $es_templ_body = str_replace('{{POSTTITLE}}', $post_title, $es_templ_body);
69
 
70
  $post_link = get_permalink($post_id);
71
- $es_templ_body = str_replace('{{POSTLINK}}', $post_link, $es_templ_body);
72
 
73
  // Size of {{POSTIMAGE}}
74
  $post_thumbnail = "";
@@ -113,14 +113,14 @@ $template_type = get_post_meta( $did, 'es_template_type', true );
113
  $post_author_id = $recent['post_author'];
114
  $post_author = get_the_author_meta( 'display_name' , $post_author_id );
115
  $es_templ_body = str_replace('{{POSTAUTHOR}}', $post_author, $es_templ_body);
 
116
 
117
  if($post_link != "") {
118
  $post_link_with_title = "<a href='".$post_link."' target='_blank'>".$post_title."</a>";
119
  $es_templ_body = str_replace('{{POSTLINK-WITHTITLE}}', $post_link_with_title, $es_templ_body);
120
-
121
  $post_link = "<a href='".$post_link."' target='_blank'>".$post_link."</a>";
122
  }
123
- $es_templ_body = str_replace('{{POSTLINK-ONLY}}', $post_link, $es_templ_body);
124
 
125
  // Get full post
126
  $post_full = $recent['post_content'];
68
  $es_templ_body = str_replace('{{POSTTITLE}}', $post_title, $es_templ_body);
69
 
70
  $post_link = get_permalink($post_id);
71
+
72
 
73
  // Size of {{POSTIMAGE}}
74
  $post_thumbnail = "";
113
  $post_author_id = $recent['post_author'];
114
  $post_author = get_the_author_meta( 'display_name' , $post_author_id );
115
  $es_templ_body = str_replace('{{POSTAUTHOR}}', $post_author, $es_templ_body);
116
+ $es_templ_body = str_replace('{{POSTLINK-ONLY}}', $post_link, $es_templ_body);
117
 
118
  if($post_link != "") {
119
  $post_link_with_title = "<a href='".$post_link."' target='_blank'>".$post_title."</a>";
120
  $es_templ_body = str_replace('{{POSTLINK-WITHTITLE}}', $post_link_with_title, $es_templ_body);
 
121
  $post_link = "<a href='".$post_link."' target='_blank'>".$post_link."</a>";
122
  }
123
+ $es_templ_body = str_replace('{{POSTLINK}}', $post_link, $es_templ_body);
124
 
125
  // Get full post
126
  $post_full = $recent['post_content'];
widget/es-widget-page.js CHANGED
@@ -31,6 +31,11 @@ ES.prototype = {
31
  var formData = window.es.prepareFormData(e, form, formData);
32
  formData['es'] = 'subscribe';
33
  formData['action'] = 'es_add_subscriber';
 
 
 
 
 
34
  var action_url = es_widget_page_notices.es_ajax_url;
35
  jQuery(form).trigger( 'addSubscriber.es', [formData] );
36
  jQuery(form).removeClass('es_form_success');
31
  var formData = window.es.prepareFormData(e, form, formData);
32
  formData['es'] = 'subscribe';
33
  formData['action'] = 'es_add_subscriber';
34
+ if(jQuery(form).find('.es_required_field').val()){
35
+ es_msg_text = es_widget_page_notices.es_success_message;
36
+ jQuery(form).find('.es_msg span').text(es_msg_text).show();
37
+ return;
38
+ }
39
  var action_url = es_widget_page_notices.es_ajax_url;
40
  jQuery(form).trigger( 'addSubscriber.es', [formData] );
41
  jQuery(form).removeClass('es_form_success');