Email Subscribers & Newsletters - Version 4.0.1

Version Description

(02.03.2019) =

  • Fix: Widget sidebar is broken due to Email Subscribers Widget
  • Fix: GDPR consent checkbox is missing
  • Fix: PHP HTML Mail/ Plain Text email option missing
  • Fix: "Name" & "Email" label missing in subscription form
  • Fix: Couldn't delete List
  • Fix: Compatibility with POST SMTP, WP SES plugin.
  • Fix: Accentuated letters and special characters are not working in post categories.
Download this release

Release Info

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

Code changes from version 4.0 to 4.0.1

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: 4.0
7
  * Author: Icegram
8
  * Author URI: https://www.icegram.com/
9
  * Requires at least: 3.9
@@ -24,7 +24,7 @@ if ( ! defined( 'WPINC' ) ) {
24
  * Define constants
25
  */
26
  define( 'ES_PLUGIN_DIR', dirname( __FILE__ ) );
27
- define( 'ES_PLUGIN_VERSION', '4.0.0' );
28
  define( 'ES_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
29
 
30
  if ( ! defined( 'ES_PLUGIN_FILE' ) ) {
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: 4.0.1
7
  * Author: Icegram
8
  * Author URI: https://www.icegram.com/
9
  * Requires at least: 3.9
24
  * Define constants
25
  */
26
  define( 'ES_PLUGIN_DIR', dirname( __FILE__ ) );
27
+ define( 'ES_PLUGIN_VERSION', '4.0.1' );
28
  define( 'ES_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
29
 
30
  if ( ! defined( 'ES_PLUGIN_FILE' ) ) {
includes/admin/class-es-campaigns-table.php CHANGED
@@ -15,12 +15,12 @@ class ES_Campaigns_Table extends WP_List_Table {
15
 
16
  public function __construct() {
17
 
18
- parent::__construct( [
19
  'singular' => __( 'Campaign', 'email-subscribers' ), //singular name of the listed records
20
  'plural' => __( 'Campaign', 'email-subscribers' ), //plural name of the listed records
21
  'ajax' => false, //does this table support ajax?
22
  'screen' => 'es_campaigns'
23
- ] );
24
 
25
  add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 );
26
  }
@@ -177,18 +177,21 @@ class ES_Campaigns_Table extends WP_List_Table {
177
  case 'base_template_id':
178
  return $item[ $column_name ];
179
  case 'list_ids':
180
- return ES_DB_Lists::get_list_id_name_map( $item[ $column_name ] );
 
 
 
 
 
181
  case 'status':
182
  $status = ( $item[ $column_name ] == 1 ) ? __( 'Active', 'email-subscribers' ) : __( 'Inactive', 'email-subscribers' );
183
-
184
  return $status;
185
  case 'type':
186
  $type = ( $item[ $column_name ] === 'newsletter' ) ? __( 'Broadcast', 'email-subscribers' ) : $item[ $column_name ];
187
  $type = ucwords( str_replace( '_', ' ', $type ) );
188
-
189
  return $type;
190
  default:
191
- return print_r( $item, true ); //Show the whole array for troubleshooting purposes
192
  }
193
  }
194
 
@@ -214,17 +217,25 @@ class ES_Campaigns_Table extends WP_List_Table {
214
  * @return string
215
  */
216
  function column_base_template_id( $item ) {
217
- $nonce = wp_create_nonce( 'es_post_notification' );
218
 
219
- $template = get_post( $item['base_template_id'] );
220
 
221
- $title = '<strong>' . $template->post_title . '</strong>';
222
- if ( ! empty( $item['type'] ) && $item['type'] == 'post_notification' ) {
223
- $actions ['edit'] = sprintf( '<a href="?page=%s&action=%s&list=%s&_wpnonce=%s">Edit</a>', esc_attr( 'es_notifications' ), 'edit', absint( $item['id'] ), $nonce );
224
- }
 
 
 
 
 
 
225
 
226
- $actions['delete'] = sprintf( '<a href="?page=%s&action=%s&list=%s&_wpnonce=%s" onclick="return checkDelete()">Delete</a>', esc_attr( 'es_campaigns' ), 'delete', absint( $item['id'] ), $nonce );
227
- $title = $title . $this->row_actions( $actions );
 
 
 
228
 
229
  return $title;
230
  }
15
 
16
  public function __construct() {
17
 
18
+ parent::__construct( array(
19
  'singular' => __( 'Campaign', 'email-subscribers' ), //singular name of the listed records
20
  'plural' => __( 'Campaign', 'email-subscribers' ), //plural name of the listed records
21
  'ajax' => false, //does this table support ajax?
22
  'screen' => 'es_campaigns'
23
+ ) );
24
 
25
  add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 );
26
  }
177
  case 'base_template_id':
178
  return $item[ $column_name ];
179
  case 'list_ids':
180
+ if(!empty($item[$column_name])) {
181
+ return ES_DB_Lists::get_list_id_name_map( $item[ $column_name ] );
182
+ } else {
183
+ return '-';
184
+ }
185
+
186
  case 'status':
187
  $status = ( $item[ $column_name ] == 1 ) ? __( 'Active', 'email-subscribers' ) : __( 'Inactive', 'email-subscribers' );
 
188
  return $status;
189
  case 'type':
190
  $type = ( $item[ $column_name ] === 'newsletter' ) ? __( 'Broadcast', 'email-subscribers' ) : $item[ $column_name ];
191
  $type = ucwords( str_replace( '_', ' ', $type ) );
 
192
  return $type;
193
  default:
194
+ return $item[$column_name]; //Show the whole array for troubleshooting purposes
195
  }
196
  }
197
 
217
  * @return string
218
  */
219
  function column_base_template_id( $item ) {
 
220
 
221
+ $type = $item['type'];
222
 
223
+ if($type === 'post_notification') {
224
+
225
+ $nonce = wp_create_nonce( 'es_post_notification' );
226
+
227
+ $template = get_post( $item['base_template_id'] );
228
+
229
+ $title = '<strong>' . $template->post_title . '</strong>';
230
+ if ( ! empty( $item['type'] ) && $item['type'] == 'post_notification' ) {
231
+ $actions ['edit'] = sprintf( '<a href="?page=%s&action=%s&list=%s&_wpnonce=%s">Edit</a>', esc_attr( 'es_notifications' ), 'edit', absint( $item['id'] ), $nonce );
232
+ }
233
 
234
+ $actions['delete'] = sprintf( '<a href="?page=%s&action=%s&list=%s&_wpnonce=%s" onclick="return checkDelete()">Delete</a>', esc_attr( 'es_campaigns' ), 'delete', absint( $item['id'] ), $nonce );
235
+ $title = $title . $this->row_actions( $actions );
236
+ } else {
237
+ $title = $item['name'];
238
+ }
239
 
240
  return $title;
241
  }
includes/admin/class-es-handle-subscription.php CHANGED
@@ -236,7 +236,7 @@ class ES_Handle_Subscription {
236
  'guid' => $this->guid
237
  );
238
 
239
- $subject = get_option( 'ig_es_confirmsubject', true );
240
  $content = ES_Mailer::prepare_double_optin_email( $template_data );
241
 
242
  $response = ES_Mailer::send( $this->email, $subject, $content );
236
  'guid' => $this->guid
237
  );
238
 
239
+ $subject = get_option( 'ig_es_confirmation_mail_subject', true );
240
  $content = ES_Mailer::prepare_double_optin_email( $template_data );
241
 
242
  $response = ES_Mailer::send( $this->email, $subject, $content );
includes/admin/class-es-import-subscribers.php CHANGED
@@ -19,7 +19,6 @@ class ES_Import_Subscribers {
19
  * Import Data HTML
20
  */
21
  public function import_report_callback() {
22
- global $wpdb;
23
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
24
 
25
  if ( isset( $_POST["submit"] ) ) {
19
  * Import Data HTML
20
  */
21
  public function import_report_callback() {
 
22
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
23
 
24
  if ( isset( $_POST["submit"] ) ) {
includes/admin/class-es-lists-table.php CHANGED
@@ -15,12 +15,12 @@ class ES_Lists_Table extends WP_List_Table {
15
 
16
  public function __construct() {
17
 
18
- parent::__construct( [
19
  'singular' => __( 'List', 'sp' ), //singular name of the listed records
20
  'plural' => __( 'Lists', 'sp' ), //plural name of the listed records
21
  'ajax' => false, //does this table support ajax?,
22
  'screen' => 'es_lists'
23
- ] );
24
 
25
  add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 );
26
  }
@@ -209,7 +209,7 @@ class ES_Lists_Table extends WP_List_Table {
209
  }
210
 
211
  ?>
212
- <a href="admin.php?page=es_subscribers&action=manage-lists" class="page-title-action es-imp-button"><?php _e( 'Manage Lists', 'email-subscribers' ); ?></a>
213
  </h1>
214
 
215
  <?php Email_Subscribers_Admin::es_feedback(); ?>
@@ -303,7 +303,7 @@ class ES_Lists_Table extends WP_List_Table {
303
  // Prepare Order by clause
304
  $order_by_clause = '';
305
  $order = ! empty( $order ) ? ' ' . esc_sql( $order ) : ' DESC';
306
- $order_by_clause = ' ORDER BY ' . esc_sql( 'created_at' ) . ' ' . $order;
307
  $order_by_clause = ! empty( $order_by ) ? $order_by_clause . ' , ' . esc_sql( $order_by ) . ' ' . $order : $order_by_clause;
308
 
309
  $sql .= $order_by_clause;
@@ -367,7 +367,7 @@ class ES_Lists_Table extends WP_List_Table {
367
  return ES_DB_Lists_Contacts::get_total_count_by_list( $item['id'], 'active' );
368
  break;
369
  case 'all_contacts':
370
- return ES_DB_Lists_Contacts::get_total_count_by_list( $item['id'], 'all' );
371
  break;
372
  case 'created_at':
373
  return ig_es_format_date_time( $item[ $column_name ] );
@@ -421,11 +421,11 @@ class ES_Lists_Table extends WP_List_Table {
421
  */
422
  function get_columns() {
423
  $columns = array(
424
- 'cb' => '<input type="checkbox" />',
425
- 'name' => __( 'Name', 'email-subscribers' ),
426
- 'active_contacts' => __( 'Active Contacts', 'email-subscribers' ),
427
- 'all_contacts' => __( 'All Contacts', 'email-subscribers' ),
428
- 'created_at' => __( 'Created', 'email-subscribers' )
429
  );
430
 
431
  return $columns;
15
 
16
  public function __construct() {
17
 
18
+ parent::__construct( array(
19
  'singular' => __( 'List', 'sp' ), //singular name of the listed records
20
  'plural' => __( 'Lists', 'sp' ), //plural name of the listed records
21
  'ajax' => false, //does this table support ajax?,
22
  'screen' => 'es_lists'
23
+ ) );
24
 
25
  add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 );
26
  }
209
  }
210
 
211
  ?>
212
+ <a href="admin.php?page=es_lists&action=manage-lists" class="page-title-action es-imp-button"><?php _e( 'Manage Lists', 'email-subscribers' ); ?></a>
213
  </h1>
214
 
215
  <?php Email_Subscribers_Admin::es_feedback(); ?>
303
  // Prepare Order by clause
304
  $order_by_clause = '';
305
  $order = ! empty( $order ) ? ' ' . esc_sql( $order ) : ' DESC';
306
+ //$order_by_clause = ' ORDER BY ' . esc_sql( 'created_at' ) . ' ' . $order;
307
  $order_by_clause = ! empty( $order_by ) ? $order_by_clause . ' , ' . esc_sql( $order_by ) . ' ' . $order : $order_by_clause;
308
 
309
  $sql .= $order_by_clause;
367
  return ES_DB_Lists_Contacts::get_total_count_by_list( $item['id'], 'active' );
368
  break;
369
  case 'all_contacts':
370
+ return ES_DB_Lists_Contacts::get_total_count_by_list( $item['id'], 'all' );
371
  break;
372
  case 'created_at':
373
  return ig_es_format_date_time( $item[ $column_name ] );
421
  */
422
  function get_columns() {
423
  $columns = array(
424
+ 'cb' => '<input type="checkbox" />',
425
+ 'name' => __( 'Name', 'email-subscribers' ),
426
+ 'active_contacts' => __( 'Active Contacts', 'email-subscribers' ),
427
+ 'all_contacts' => __( 'All Contacts', 'email-subscribers' ),
428
+ 'created_at' => __( 'Created', 'email-subscribers' )
429
  );
430
 
431
  return $columns;
includes/admin/class-es-post-notifications.php CHANGED
@@ -170,8 +170,9 @@ class ES_Post_Notifications_Table {
170
  if ( 'submitted' === $submitted ) {
171
 
172
  $categories = Email_Subscribers::get_request( 'es_note_cat' );
 
173
  $data = array(
174
- 'categories' => ES_Common::convert_categories_array_to_string( $categories ),
175
  'list_ids' => Email_Subscribers::get_request( 'list_id' ),
176
  'base_template_id' => Email_Subscribers::get_request( 'template_id' ),
177
  'status' => Email_Subscribers::get_request( 'status' )
@@ -189,6 +190,7 @@ class ES_Post_Notifications_Table {
189
 
190
  $categories_str = ! empty( $notification['categories'] ) ? $notification['categories'] : '';
191
  $categories = ES_Common::convert_categories_string_to_array( $categories_str );
 
192
  $data = array(
193
  'categories' => $categories,
194
  'list_ids' => $notification['list_ids'],
@@ -217,6 +219,7 @@ class ES_Post_Notifications_Table {
217
  $template_id = isset( $data['base_template_id'] ) ? $data['base_template_id'] : '';
218
  $status = isset( $data['status'] ) ? $data['status'] : '';
219
  $nonce = wp_create_nonce( 'es_post_notification' );
 
220
  ?>
221
 
222
  <div class="wrap">
170
  if ( 'submitted' === $submitted ) {
171
 
172
  $categories = Email_Subscribers::get_request( 'es_note_cat' );
173
+
174
  $data = array(
175
+ 'categories' => stripslashes(ES_Common::convert_categories_array_to_string( $categories )),
176
  'list_ids' => Email_Subscribers::get_request( 'list_id' ),
177
  'base_template_id' => Email_Subscribers::get_request( 'template_id' ),
178
  'status' => Email_Subscribers::get_request( 'status' )
190
 
191
  $categories_str = ! empty( $notification['categories'] ) ? $notification['categories'] : '';
192
  $categories = ES_Common::convert_categories_string_to_array( $categories_str );
193
+
194
  $data = array(
195
  'categories' => $categories,
196
  'list_ids' => $notification['list_ids'],
219
  $template_id = isset( $data['base_template_id'] ) ? $data['base_template_id'] : '';
220
  $status = isset( $data['status'] ) ? $data['status'] : '';
221
  $nonce = wp_create_nonce( 'es_post_notification' );
222
+
223
  ?>
224
 
225
  <div class="wrap">
includes/admin/class-es-reports-table.php CHANGED
@@ -15,12 +15,12 @@ class ES_Reports_Table extends WP_List_Table {
15
 
16
  public function __construct() {
17
 
18
- parent::__construct( [
19
  'singular' => __( 'Report', 'email-subscribers' ), //singular name of the listed records
20
  'plural' => __( 'Reports', 'email-subscribers' ), //plural name of the listed records
21
  'ajax' => false, //does this table support ajax?,
22
  'screen' => 'es_reports'
23
- ] );
24
 
25
  add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 );
26
  }
15
 
16
  public function __construct() {
17
 
18
+ parent::__construct( array(
19
  'singular' => __( 'Report', 'email-subscribers' ), //singular name of the listed records
20
  'plural' => __( 'Reports', 'email-subscribers' ), //plural name of the listed records
21
  'ajax' => false, //does this table support ajax?,
22
  'screen' => 'es_reports'
23
+ ) );
24
 
25
  add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 );
26
  }
includes/admin/class-es-subscribers-table.php CHANGED
@@ -16,12 +16,12 @@ class ES_Subscribers_Table extends WP_List_Table {
16
  public function __construct() {
17
 
18
  //set_error_handler(array( 'Email_General' , 'es_handle_error'));
19
- parent::__construct( [
20
  'singular' => __( 'Contact', 'email-subscribers' ), //singular name of the listed records
21
  'plural' => __( 'Contacts', 'email-subscribers' ), //plural name of the listed records
22
  'ajax' => false,//does this table support ajax?
23
  'screen' => 'es_subscribers'
24
- ] );
25
 
26
 
27
  add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 );
@@ -39,9 +39,7 @@ class ES_Subscribers_Table extends WP_List_Table {
39
  <?php
40
 
41
  $action = Email_Subscribers::get_request( 'action' );
42
- if ( 'manage-lists' === $action ) {
43
- $this->manage_lists();
44
- } elseif ( 'import' === $action ) {
45
  $this->load_import();
46
  } elseif ( 'export' === $action ) {
47
  $this->load_export();
@@ -54,7 +52,7 @@ class ES_Subscribers_Table extends WP_List_Table {
54
  <a href="admin.php?page=es_subscribers&action=new" class="page-title-action"><?php _e( 'Add New Contact', 'email-subscribers' ); ?></a>
55
  <a href="admin.php?page=es_subscribers&action=export" class="page-title-action"><?php _e( 'Export Contacts', 'email-subscribers' ); ?></a>
56
  <a href="admin.php?page=es_subscribers&action=import" class="page-title-action"><?php _e( 'Import Contacts', 'email-subscribers' ); ?></a>
57
- <a href="admin.php?page=es_subscribers&action=manage-lists" class="page-title-action es-imp-button"><?php _e( 'Manage Lists', 'email-subscribers' ); ?></a>
58
  <?php
59
  do_action( 'es_after_action_buttons' );
60
  ?>
@@ -98,8 +96,8 @@ class ES_Subscribers_Table extends WP_List_Table {
98
 
99
  $option = 'per_page';
100
  $args = array(
101
- 'label' => 'Contacts',
102
- 'default' => 20,
103
  'option' => 'subscribers_per_page'
104
  );
105
 
@@ -112,7 +110,7 @@ class ES_Subscribers_Table extends WP_List_Table {
112
  ?>
113
  <div class="wrap">
114
  <h1 class="wp-heading-inline"><?php _e( 'Add New Contact', 'email-subscribers' ); ?>
115
- <a href="admin.php?page=es_subscribers&action=manage-lists" class="page-title-action es-imp-button"><?php _e( 'Manage Lists', 'email-subscribers' ); ?></a>
116
  </h1>
117
  <?php Email_Subscribers_Admin::es_feedback(); ?>
118
  <div id="poststuff">
@@ -585,7 +583,7 @@ class ES_Subscribers_Table extends WP_List_Table {
585
  $this->edit_group();
586
  $this->edit_status();
587
 
588
- $per_page = $this->get_items_per_page( 'subscribers_per_page', 25 );
589
  $current_page = $this->get_pagenum();
590
  $total_items = $this->get_subscribers( 0, 0, true );
591
 
@@ -667,7 +665,7 @@ class ES_Subscribers_Table extends WP_List_Table {
667
  'guid' => $subscriber['hash']
668
  );
669
 
670
- $subject = get_option( 'ig_es_confirmsubject', true );
671
  $content = ES_Mailer::prepare_double_optin_email( $template_data );
672
  $response = ES_Mailer::send( $subscriber['email'], $subject, $content );
673
 
16
  public function __construct() {
17
 
18
  //set_error_handler(array( 'Email_General' , 'es_handle_error'));
19
+ parent::__construct( array(
20
  'singular' => __( 'Contact', 'email-subscribers' ), //singular name of the listed records
21
  'plural' => __( 'Contacts', 'email-subscribers' ), //plural name of the listed records
22
  'ajax' => false,//does this table support ajax?
23
  'screen' => 'es_subscribers'
24
+ ) );
25
 
26
 
27
  add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 );
39
  <?php
40
 
41
  $action = Email_Subscribers::get_request( 'action' );
42
+ if ( 'import' === $action ) {
 
 
43
  $this->load_import();
44
  } elseif ( 'export' === $action ) {
45
  $this->load_export();
52
  <a href="admin.php?page=es_subscribers&action=new" class="page-title-action"><?php _e( 'Add New Contact', 'email-subscribers' ); ?></a>
53
  <a href="admin.php?page=es_subscribers&action=export" class="page-title-action"><?php _e( 'Export Contacts', 'email-subscribers' ); ?></a>
54
  <a href="admin.php?page=es_subscribers&action=import" class="page-title-action"><?php _e( 'Import Contacts', 'email-subscribers' ); ?></a>
55
+ <a href="admin.php?page=es_lists&action=manage-lists" class="page-title-action es-imp-button"><?php _e( 'Manage Lists', 'email-subscribers' ); ?></a>
56
  <?php
57
  do_action( 'es_after_action_buttons' );
58
  ?>
96
 
97
  $option = 'per_page';
98
  $args = array(
99
+ 'label' => __('Contacts', 'email-subscribers'),
100
+ 'default' => 150,
101
  'option' => 'subscribers_per_page'
102
  );
103
 
110
  ?>
111
  <div class="wrap">
112
  <h1 class="wp-heading-inline"><?php _e( 'Add New Contact', 'email-subscribers' ); ?>
113
+ <a href="admin.php?page=es_lists&action=manage-lists" class="page-title-action es-imp-button"><?php _e( 'Manage Lists', 'email-subscribers' ); ?></a>
114
  </h1>
115
  <?php Email_Subscribers_Admin::es_feedback(); ?>
116
  <div id="poststuff">
583
  $this->edit_group();
584
  $this->edit_status();
585
 
586
+ $per_page = $this->get_items_per_page( 'subscribers_per_page', 200 );
587
  $current_page = $this->get_pagenum();
588
  $total_items = $this->get_subscribers( 0, 0, true );
589
 
665
  'guid' => $subscriber['hash']
666
  );
667
 
668
+ $subject = get_option( 'ig_es_confirmation_mail_subject', true );
669
  $content = ES_Mailer::prepare_double_optin_email( $template_data );
670
  $response = ES_Mailer::send( $subscriber['email'], $subject, $content );
671
 
includes/class-email-subscribers.php CHANGED
@@ -73,7 +73,6 @@ class Email_Subscribers {
73
  */
74
  public function __construct() {
75
 
76
- require_once( ABSPATH . 'wp-includes/pluggable.php' );
77
  require_once plugin_dir_path( __FILE__ ) . 'class-email-subscribers-activator.php';
78
  require_once plugin_dir_path( __FILE__ ) . 'class-email-subscribers-deactivator.php';
79
  add_action( 'admin_init', array( $this, 'add_version_notice' ) );
@@ -157,7 +156,7 @@ class Email_Subscribers {
157
  'IG_DOUBLE_OPTIN' => 2,
158
 
159
  'IG_CAMPAIGN_TYPE_POST_NOTIFICATION' => 'post_notification',
160
- 'IG_CAMPAIGN_TYPE_Newsletter' => 'newsletter',
161
  'IG_DEFAULT_BATCH_SIZE' => 100,
162
  'IG_MAX_MEMORY_LIMIT' => '-1',
163
  'IG_SET_TIME_LIMIT' => 0,
73
  */
74
  public function __construct() {
75
 
 
76
  require_once plugin_dir_path( __FILE__ ) . 'class-email-subscribers-activator.php';
77
  require_once plugin_dir_path( __FILE__ ) . 'class-email-subscribers-deactivator.php';
78
  add_action( 'admin_init', array( $this, 'add_version_notice' ) );
156
  'IG_DOUBLE_OPTIN' => 2,
157
 
158
  'IG_CAMPAIGN_TYPE_POST_NOTIFICATION' => 'post_notification',
159
+ 'IG_CAMPAIGN_TYPE_NEWSLETTER' => 'newsletter',
160
  'IG_DEFAULT_BATCH_SIZE' => 100,
161
  'IG_MAX_MEMORY_LIMIT' => '-1',
162
  'IG_SET_TIME_LIMIT' => 0,
includes/class-es-common.php CHANGED
@@ -350,11 +350,15 @@ Class ES_Common {
350
 
351
  $category_html = '';
352
  foreach ( $categories as $category ) {
353
- if ( in_array( $category->name, $category_names ) ) {
 
 
 
354
  $checked = "checked='checked'";
355
  } else {
356
  $checked = "";
357
  }
 
358
  $category_html .= '<tr><td style="padding-top:4px;padding-bottom:4px;padding-right:10px;"><input type="checkbox" ' . $checked . ' value="' . $category->name . '" id="es_note_cat[]" name="es_note_cat[]">' . $category->name . '</td></tr>';
359
  }
360
 
@@ -390,8 +394,8 @@ Class ES_Common {
390
  $types = array(
391
  'wp_html_mail' => __( 'HTML Mail', 'email-subsribers' ),
392
  'wp_plaintext_mail' => __( 'Plain Text Mail', 'email-subsribers' ),
393
- //'php_html_mail' => __( 'PHP HTML MAIL', 'email-subsribers' ),
394
- //'php_plaintext_mail' => __( 'PHP PLAINTEXT MAIL', 'email-subsribers' )
395
  );
396
 
397
  return $types;
@@ -465,6 +469,7 @@ Class ES_Common {
465
  public static function prepare_category_string( $category = '' ) {
466
  $category_str = '';
467
  if ( ! empty( $category ) ) {
 
468
  $category_str = "##" . $category . "##";
469
  }
470
 
350
 
351
  $category_html = '';
352
  foreach ( $categories as $category ) {
353
+
354
+ $category_str = wp_specialchars_decode($category->name, ENT_QUOTES);
355
+
356
+ if ( in_array( $category_str, $category_names ) ) {
357
  $checked = "checked='checked'";
358
  } else {
359
  $checked = "";
360
  }
361
+
362
  $category_html .= '<tr><td style="padding-top:4px;padding-bottom:4px;padding-right:10px;"><input type="checkbox" ' . $checked . ' value="' . $category->name . '" id="es_note_cat[]" name="es_note_cat[]">' . $category->name . '</td></tr>';
363
  }
364
 
394
  $types = array(
395
  'wp_html_mail' => __( 'HTML Mail', 'email-subsribers' ),
396
  'wp_plaintext_mail' => __( 'Plain Text Mail', 'email-subsribers' ),
397
+ 'php_html_mail' => __( 'PHP HTML MAIL', 'email-subsribers' ),
398
+ 'php_plaintext_mail' => __( 'PHP PLAINTEXT MAIL', 'email-subsribers' )
399
  );
400
 
401
  return $types;
469
  public static function prepare_category_string( $category = '' ) {
470
  $category_str = '';
471
  if ( ! empty( $category ) ) {
472
+ $category = wp_specialchars_decode($category, ENT_QUOTES);
473
  $category_str = "##" . $category . "##";
474
  }
475
 
includes/class-es-install.php CHANGED
@@ -62,11 +62,16 @@ class ES_Install {
62
  'ig_es_update_400_migrate_lists',
63
  'ig_es_update_400_migrate_subscribers',
64
  'ig_es_update_400_migrate_post_notifications',
65
- 'ig_es_update_400_migrate_newsletters',
66
  'ig_es_update_400_migrate_notifications',
67
  'ig_es_update_400_migrate_reports_data',
68
  'ig_es_update_400_migrate_group_selectors_forms',
69
  'ig_es_update_400_db_version'
 
 
 
 
 
 
70
  )
71
  );
72
 
@@ -291,7 +296,7 @@ class ES_Install {
291
  'ig_es_from_email' => array( 'default' => $admin_email, 'old_option' => 'ig_es_fromemail' ),
292
  'ig_es_admin_new_contact_email_subject' => array( 'default' => $new_contact_email_subject, 'old_option' => 'ig_es_admin_new_sub_subject' ),
293
  'ig_es_admin_new_contact_email_content' => array( 'default' => $new_contact_email_content, 'old_option' => 'ig_es_admin_new_sub_content' ),
294
- 'ig_es_admin_emails' => array( 'default' => $admin_email, 'old_option' => 'ig_es_adminemail' ),
295
  'ig_es_confirmation_mail_subject' => array( 'default' => $confirmation_email_subject, 'old_option' => 'ig_es_confirmsubject' ),
296
  'ig_es_confirmation_mail_content' => array( 'default' => $confirmation_email_content, 'old_option' => 'ig_es_confirmcontent' ),
297
  'ig_es_enable_welcome_email' => array( 'default' => 'yes', 'old_option' => 'ig_es_welcomeemail', 'action' => 'convert_space_to_underscore' ),
@@ -819,7 +824,6 @@ class ES_Install {
819
  $form_data['af_id'] = 0;
820
  $form_id = ES_DB_Forms::add_form( $form_data );
821
  }
822
-
823
  }
824
 
825
  ES_Install::init();
62
  'ig_es_update_400_migrate_lists',
63
  'ig_es_update_400_migrate_subscribers',
64
  'ig_es_update_400_migrate_post_notifications',
 
65
  'ig_es_update_400_migrate_notifications',
66
  'ig_es_update_400_migrate_reports_data',
67
  'ig_es_update_400_migrate_group_selectors_forms',
68
  'ig_es_update_400_db_version'
69
+ ),
70
+
71
+ '4.0.1' => array(
72
+
73
+ 'ig_es_update_401_migrate_newsletters',
74
+ 'ig_es_update_401_db_version'
75
  )
76
  );
77
 
296
  'ig_es_from_email' => array( 'default' => $admin_email, 'old_option' => 'ig_es_fromemail' ),
297
  'ig_es_admin_new_contact_email_subject' => array( 'default' => $new_contact_email_subject, 'old_option' => 'ig_es_admin_new_sub_subject' ),
298
  'ig_es_admin_new_contact_email_content' => array( 'default' => $new_contact_email_content, 'old_option' => 'ig_es_admin_new_sub_content' ),
299
+ 'ig_es_admin_emails' => array( 'default' => $admin_email, 'old_option' => 'ig_es_adminemail' ),
300
  'ig_es_confirmation_mail_subject' => array( 'default' => $confirmation_email_subject, 'old_option' => 'ig_es_confirmsubject' ),
301
  'ig_es_confirmation_mail_content' => array( 'default' => $confirmation_email_content, 'old_option' => 'ig_es_confirmcontent' ),
302
  'ig_es_enable_welcome_email' => array( 'default' => 'yes', 'old_option' => 'ig_es_welcomeemail', 'action' => 'convert_space_to_underscore' ),
824
  $form_data['af_id'] = 0;
825
  $form_id = ES_DB_Forms::add_form( $form_data );
826
  }
 
827
  }
828
 
829
  ES_Install::init();
includes/db/class-es-db-campaigns.php CHANGED
@@ -91,7 +91,7 @@ class ES_DB_Campaigns {
91
  $query = "SELECT base_template_id FROM " . IG_CAMPAIGNS_TABLE . " WHERE id = %d";
92
 
93
  $sql = $wpdb->prepare( $query, array( $id ) );
94
- $template_id = $wpdb->get_var( $sql, ARRAY_A );
95
 
96
  return $template_id;
97
  }
@@ -242,9 +242,11 @@ class ES_DB_Campaigns {
242
  $from_email = ES_Common::get_ig_option( 'from_email' );
243
 
244
  $query = "SELECT count(*) as total FROM " . EMAIL_SUBSCRIBERS_SENT_TABLE . " WHERE es_sent_source = 'Newsletter'";
245
- $total = $wpdb->get_var( $query, ARRAY_A );
246
 
247
  if ( $total > 0 ) {
 
 
248
  $batch_size = IG_DEFAULT_BATCH_SIZE;
249
  $total_bataches = ceil( $total / $batch_size );
250
 
91
  $query = "SELECT base_template_id FROM " . IG_CAMPAIGNS_TABLE . " WHERE id = %d";
92
 
93
  $sql = $wpdb->prepare( $query, array( $id ) );
94
+ $template_id = $wpdb->get_var( $sql );
95
 
96
  return $template_id;
97
  }
242
  $from_email = ES_Common::get_ig_option( 'from_email' );
243
 
244
  $query = "SELECT count(*) as total FROM " . EMAIL_SUBSCRIBERS_SENT_TABLE . " WHERE es_sent_source = 'Newsletter'";
245
+ $total = $wpdb->get_var( $query );
246
 
247
  if ( $total > 0 ) {
248
+
249
+ $list_is_name_map = ES_DB_Lists::get_list_id_name_map( '', true );
250
  $batch_size = IG_DEFAULT_BATCH_SIZE;
251
  $total_bataches = ceil( $total / $batch_size );
252
 
includes/db/class-es-db-notifications.php CHANGED
@@ -7,7 +7,6 @@ if ( ! defined( 'ABSPATH' ) ) {
7
 
8
  class ES_DB_Notifications {
9
 
10
-
11
  public $table_name;
12
 
13
  public $version;
@@ -39,9 +38,9 @@ class ES_DB_Notifications {
39
  } else {
40
  $sSql .= " or";
41
  }
42
- //$sSql .= " categories LIKE '%" . addslashes( htmlspecialchars_decode( $categories[ $i ]->cat_name ) ) . "%'"; // alternative addslashes(htmlspecialchars_decode(text)) = mysqli_real_escape_string but not working all the time
43
  $category_str = ES_Common::prepare_category_string( $categories[ $i ]->cat_name );
44
- $sSql .= " categories LIKE '%" . $wpdb->esc_like( $category_str ) . "%'"; // alternative addslashes(htmlspecialchars_decode(text)) = mysqli_real_escape_string but not working all the time
45
  if ( $i == ( $total_categories - 1 ) ) {
46
  $sSql .= ")";
47
  }
@@ -49,8 +48,7 @@ class ES_DB_Notifications {
49
  }
50
  } else {
51
  $post_type = ES_Common::prepare_custom_post_type_string( $post_type );
52
- $sSql .= " and categories LIKE '%" . $wpdb->esc_like( $post_type ) . "%'";
53
-
54
  }
55
 
56
  $arrNotification = $wpdb->get_results( $sSql, ARRAY_A );
7
 
8
  class ES_DB_Notifications {
9
 
 
10
  public $table_name;
11
 
12
  public $version;
38
  } else {
39
  $sSql .= " or";
40
  }
41
+
42
  $category_str = ES_Common::prepare_category_string( $categories[ $i ]->cat_name );
43
+ $sSql .= " categories LIKE '%" . wp_specialchars_decode(addslashes($category_str )) . "%'";
44
  if ( $i == ( $total_categories - 1 ) ) {
45
  $sSql .= ")";
46
  }
48
  }
49
  } else {
50
  $post_type = ES_Common::prepare_custom_post_type_string( $post_type );
51
+ $sSql .= " and categories LIKE '%" . wp_specialchars_decode(addslashes( $post_type )) . "%'";
 
52
  }
53
 
54
  $arrNotification = $wpdb->get_results( $sSql, ARRAY_A );
includes/upgrade/es-update-functions.php CHANGED
@@ -495,13 +495,7 @@ function ig_es_update_400_migrate_post_notifications() {
495
 
496
  }
497
 
498
- function ig_es_update_400_migrate_newsletters() {
499
- global $wpdb;
500
- // Migrate newsletters from es_sentdetails table
501
- $logger = get_ig_logger();
502
- ES_DB_Campaigns::migrate_newsletters();
503
- $logger->info( 'Run ig_es_update_400_migrate_newsletters' );
504
- }
505
 
506
  function ig_es_update_400_migrate_notifications() {
507
  /**
@@ -539,4 +533,20 @@ function ig_es_update_400_db_version() {
539
  $logger->info( 'Run ig_es_update_400_db_version' );
540
  }
541
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
542
  /* --------------------- ES 4.0.0 (End)--------------------------- */
495
 
496
  }
497
 
498
+
 
 
 
 
 
 
499
 
500
  function ig_es_update_400_migrate_notifications() {
501
  /**
533
  $logger->info( 'Run ig_es_update_400_db_version' );
534
  }
535
 
536
+ /* --------------------- ES 4.0.0 (End)--------------------------- */
537
+
538
+ function ig_es_update_401_migrate_newsletters() {
539
+ global $wpdb;
540
+ // Migrate newsletters from es_sentdetails table
541
+ $logger = get_ig_logger();
542
+ ES_DB_Campaigns::migrate_newsletters();
543
+ $logger->info( 'Run ig_es_update_401_migrate_newsletters' );
544
+ }
545
+
546
+ function ig_es_update_401_db_version() {
547
+ ES_Install::update_db_version( '4.0.1' );
548
+ $db_update_option = '401_db_updated_at';
549
+ ES_Common::set_ig_option( $db_update_option, ig_get_current_date_time() );
550
+ }
551
+
552
  /* --------------------- ES 4.0.0 (End)--------------------------- */
public/css/email-subscribers-public.css CHANGED
@@ -48,4 +48,7 @@
48
  .es_spinner_image {
49
  display: none;
50
  float: right;
 
 
 
51
  }
48
  .es_spinner_image {
49
  display: none;
50
  float: right;
51
+ }
52
+ .es-field-wrap{
53
+ margin-bottom: 0.6em;
54
  }
public/js/email-subscribers-public.js CHANGED
@@ -61,7 +61,6 @@
61
 
62
  var responseText = response['message_text'];
63
  var messageContainer = $(form).next('.es_subscription_message');
64
- console.log(messageContainer, 'messageContainer');
65
  messageContainer.attr('class', 'es_subscription_message ' + message_class);
66
  messageContainer.html(responseText);
67
  }
@@ -70,11 +69,10 @@
70
 
71
  // var submitButton = $('.es_subscription_form_submit');
72
 
73
- $(document).on('click', '.es_subscription_form_submit', function (e) {
74
- var form = $(this).closest('form');
75
  var formData = {};
76
  formData = prepareFormData(form, formData);
77
- console.log(formData, 'FormData');
78
  formData['es'] = 'subscribe';
79
  formData['action'] = 'es_add_subscriber';
80
  var actionUrl = es_data.es_ajax_url;
61
 
62
  var responseText = response['message_text'];
63
  var messageContainer = $(form).next('.es_subscription_message');
 
64
  messageContainer.attr('class', 'es_subscription_message ' + message_class);
65
  messageContainer.html(responseText);
66
  }
69
 
70
  // var submitButton = $('.es_subscription_form_submit');
71
 
72
+ $(document).on('submit', '.es_subscription_form', function (e) {
73
+ var form = $(this);
74
  var formData = {};
75
  formData = prepareFormData(form, formData);
 
76
  formData['es'] = 'subscribe';
77
  formData['action'] = 'es_add_subscriber';
78
  var actionUrl = es_data.es_ajax_url;
public/partials/class-es-shortcode.php CHANGED
@@ -44,7 +44,7 @@ class ES_Shortcode {
44
  $data['lists'] = array();
45
  $data['form_id'] = 0;
46
  $data['list'] = $atts['group'];
47
- $data['content'] = $atts['desc'];
48
 
49
  self::render_form( $data );
50
 
@@ -98,6 +98,7 @@ class ES_Shortcode {
98
  }
99
 
100
  public static function render_form( $data ) {
 
101
  /**
102
  * - Show name? -> Prepare HTML for name
103
  * - Show email? -> Prepare HTML for email // Always true
@@ -109,14 +110,19 @@ class ES_Shortcode {
109
  * es-subscribe,
110
  * honeypot field
111
  */
112
-
 
 
 
 
113
 
114
  $show_name = ! empty( $data['name_visible'] ) ? $data['name_visible'] : false;
 
115
  $show_list = ! empty( $data['list_visible'] ) ? $data['list_visible'] : false;
116
  $list_ids = ! empty( $data['lists'] ) ? $data['lists'] : array();
117
  $form_id = ! empty( $data['form_id'] ) ? $data['form_id'] : 0;
118
  $list = ! empty( $data['list'] ) ? $data['list'] : 0;
119
- $content = ! empty( $data['content'] ) ? $data['content'] : 0;
120
 
121
  $current_page = get_the_ID();
122
  $current_page_url = get_the_permalink( get_the_ID() );
@@ -128,7 +134,9 @@ class ES_Shortcode {
128
  // Name
129
  $name_html = '';
130
  if ( $show_name ) {
131
- $name_html = '<input type="text" name="name" placeholder="Enter Name" value="" /> <br />';
 
 
132
  }
133
 
134
  // Lists
@@ -154,21 +162,17 @@ class ES_Shortcode {
154
  }
155
 
156
  // Form html
157
- $form_html = '<input type="hidden" name="form_id" value="' . $form_id . '" /> <br />';
158
 
159
- // Set Content
160
- if ( empty( $content ) ) {
161
- $content_html = apply_filters( 'the_content', 'Email Subscriber' );
162
- } else {
163
- $content_html = apply_filters( 'the_content', $content );
164
- }
165
 
166
- $email_html = '<input class="es_required_field" type="email" name="email" value="" placeholder="Email Address" /><br />'
167
  ?>
168
 
169
  <div class="emaillist">
170
  <form action="#" method="post" class="es_subscription_form" id="es_subscription_form_<?php echo $unique_id; ?>">
171
- <?php echo $content_html; ?>
 
 
172
  <?php echo $name_html; ?>
173
  <?php echo $email_html; ?>
174
  <?php echo $list_html; ?>
@@ -180,6 +184,9 @@ class ES_Shortcode {
180
  <input type="hidden" name="es-subscribe" id="es-subscribe" value="<?php echo $nonce; ?>"/>
181
  <label style="<?php echo $hp_style; ?>"><input type="text" name="es_hp_<?php echo wp_create_nonce( 'es_hp' ); ?>" class="es_required_field" tabindex="-1" autocomplete="off"/></label>
182
  <?php do_action( 'es_after_form_fields' ) ?>
 
 
 
183
  <input type="submit" name="submit" class="es_subscription_form_submit es_submit_button" id="es_subscription_form_submit_<?php echo $unique_id; ?>" value="Subscribe" />
184
 
185
 
44
  $data['lists'] = array();
45
  $data['form_id'] = 0;
46
  $data['list'] = $atts['group'];
47
+ $data['desc'] = $atts['desc'];
48
 
49
  self::render_form( $data );
50
 
98
  }
99
 
100
  public static function render_form( $data ) {
101
+ error_log(print_r($data, true));
102
  /**
103
  * - Show name? -> Prepare HTML for name
104
  * - Show email? -> Prepare HTML for email // Always true
110
  * es-subscribe,
111
  * honeypot field
112
  */
113
+ // Compatibility for GDPR
114
+ $active_plugins = get_option( 'active_plugins', array() );
115
+ if ( is_multisite() ) {
116
+ $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
117
+ }
118
 
119
  $show_name = ! empty( $data['name_visible'] ) ? $data['name_visible'] : false;
120
+ $required_name = ! empty( $data['name_required'] ) ? $data['name_required'] : false;
121
  $show_list = ! empty( $data['list_visible'] ) ? $data['list_visible'] : false;
122
  $list_ids = ! empty( $data['lists'] ) ? $data['lists'] : array();
123
  $form_id = ! empty( $data['form_id'] ) ? $data['form_id'] : 0;
124
  $list = ! empty( $data['list'] ) ? $data['list'] : 0;
125
+ $desc = ! empty( $data['desc'] ) ? $data['desc'] : 0;
126
 
127
  $current_page = get_the_ID();
128
  $current_page_url = get_the_permalink( get_the_ID() );
134
  // Name
135
  $name_html = '';
136
  if ( $show_name ) {
137
+ $name_label = ('yes' === $required_name) ? __('Name *', 'email-subscribers') : __('Name', 'email-subscribers');
138
+ $required = ('yes' === $required_name) ? 'required' : '';
139
+ $name_html = '<div class="es-field-wrap"><label>'.$name_label.'<input type="text" name="name" placeholder="Enter Name" value="" '.$required.'/></label></div>';
140
  }
141
 
142
  // Lists
162
  }
163
 
164
  // Form html
165
+ $form_html = '<input type="hidden" name="form_id" value="' . $form_id . '" />';
166
 
 
 
 
 
 
 
167
 
168
+ $email_html = '<div class="es-field-wrap"><label>'.__('Email *', 'email-subscribers').'<input class="es_required_field" type="email" name="email" value="" placeholder="Email Address" required/></label></div>';
169
  ?>
170
 
171
  <div class="emaillist">
172
  <form action="#" method="post" class="es_subscription_form" id="es_subscription_form_<?php echo $unique_id; ?>">
173
+ <?php if ( $desc != "" ) { ?>
174
+ <div class="es_caption"><?php echo $desc; ?></div>
175
+ <?php } ?>
176
  <?php echo $name_html; ?>
177
  <?php echo $email_html; ?>
178
  <?php echo $list_html; ?>
184
  <input type="hidden" name="es-subscribe" id="es-subscribe" value="<?php echo $nonce; ?>"/>
185
  <label style="<?php echo $hp_style; ?>"><input type="text" name="es_hp_<?php echo wp_create_nonce( 'es_hp' ); ?>" class="es_required_field" tabindex="-1" autocomplete="off"/></label>
186
  <?php do_action( 'es_after_form_fields' ) ?>
187
+ <?php if ( ( in_array( 'gdpr/gdpr.php', $active_plugins ) || array_key_exists( 'gdpr/gdpr.php', $active_plugins ) ) ) {
188
+ echo GDPR::consent_checkboxes();
189
+ } ?>
190
  <input type="submit" name="submit" class="es_subscription_form_submit es_submit_button" id="es_subscription_form_submit_<?php echo $unique_id; ?>" value="Subscribe" />
191
 
192
 
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, welcome email, contacts
6
  Requires at least: 3.9
7
  Tested up to: 5.1
8
- Stable tag: 4.0
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
@@ -308,6 +308,16 @@ Use our free plugin [Email Subscribers - Group Selector](https://wordpress.org/p
308
 
309
  == Changelog ==
310
 
 
 
 
 
 
 
 
 
 
 
311
  = 4.0 (01.03.2019) =
312
  * New: [Revamped the plugin](https://www.icegram.com/email-subscribers-plugin-redesign/) - Changes in UI and terminology
313
  * New: Added domain blocking to prevent spam attacks
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, welcome email, contacts
6
  Requires at least: 3.9
7
  Tested up to: 5.1
8
+ Stable tag: 4.0.1
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
308
 
309
  == Changelog ==
310
 
311
+ = 4.0.1 (02.03.2019) =
312
+
313
+ * Fix: Widget sidebar is broken due to Email Subscribers Widget
314
+ * Fix: GDPR consent checkbox is missing
315
+ * Fix: PHP HTML Mail/ Plain Text email option missing
316
+ * Fix: "Name" & "Email" label missing in subscription form
317
+ * Fix: Couldn't delete List
318
+ * Fix: Compatibility with POST SMTP, WP SES plugin.
319
+ * Fix: Accentuated letters and special characters are not working in post categories.
320
+
321
  = 4.0 (01.03.2019) =
322
  * New: [Revamped the plugin](https://www.icegram.com/email-subscribers-plugin-redesign/) - Changes in UI and terminology
323
  * New: Added domain blocking to prevent spam attacks