Email Subscribers & Newsletters - Version 4.1

Version Description

(14.05.2019) = * New: Now, able to change the label of "Subscribe" button

Download this release

Release Info

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

Code changes from version 4.0.18 to 4.1

admin/class-email-subscribers-admin.php CHANGED
@@ -48,10 +48,11 @@ class Email_Subscribers_Admin {
48
  /**
49
  * Initialize the class and set its properties.
50
  *
 
 
 
51
  * @since 4.0
52
  *
53
- * @param string $email_subscribers The name of this plugin.
54
- * @param string $version The version of this plugin.
55
  */
56
  public function __construct( $email_subscribers, $version ) {
57
 
@@ -64,7 +65,7 @@ class Email_Subscribers_Admin {
64
 
65
  add_action( 'admin_menu', array( $this, 'email_subscribers_admin_menu' ) );
66
  add_action( 'wp_ajax_es_klawoo_subscribe', array( $this, 'klawoo_subscribe' ) );
67
- add_action('admin_footer', array( $this, 'remove_submenu') );
68
  add_action( 'edit_form_advanced', array( $this, 'add_spam_score_utm_link' ) );
69
 
70
  }
@@ -75,8 +76,8 @@ class Email_Subscribers_Admin {
75
  * @since 4.0
76
  */
77
  public function enqueue_styles() {
78
- $screen = get_current_screen();
79
- $screen_id = $screen ? $screen->id : '';
80
  $enqueue_on_screens = array(
81
  'toplevel_page_es_dashboard',
82
  'email-subscribers_page_es_subscribers',
@@ -125,8 +126,8 @@ class Email_Subscribers_Admin {
125
  * @since 4.0
126
  */
127
  public function enqueue_scripts() {
128
- $screen = get_current_screen();
129
- $screen_id = $screen ? $screen->id : '';
130
  $enqueue_on_screens = array(
131
  'toplevel_page_es_dashboard',
132
  'email-subscribers_page_es_subscribers',
@@ -149,17 +150,17 @@ class Email_Subscribers_Admin {
149
  wp_enqueue_script( $this->email_subscribers, plugin_dir_url( __FILE__ ) . 'js/email-subscribers-admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-tabs' ), $this->version, false );
150
  }
151
 
152
- public function remove_submenu(){
153
  //remove submenues
154
  ?>
155
- <script type="text/javascript">
156
  jQuery(document).ready(function () {
157
  var removeSubmenu = ['ig-es-broadcast', 'ig-es-lists', 'ig-es-post-notifications'];
158
  jQuery.each(removeSubmenu, function (key, id) {
159
  jQuery("#" + id).parent('a').parent('li').hide();
160
  });
161
  })
162
- </script>
163
  <?php
164
  }
165
 
@@ -184,7 +185,7 @@ class Email_Subscribers_Admin {
184
  ES_Templates_Table::get_instance();
185
  new Export_Subscribers();
186
  new ES_Handle_Post_Notification();
187
- new ES_Handle_Sync_Wp_User();
188
  new ES_Import_Subscribers();
189
  ES_Info::get_instance();
190
  ES_Newsletters::get_instance();
@@ -353,9 +354,9 @@ class Email_Subscribers_Admin {
353
  return;
354
  }
355
  ?>
356
- <script>
357
- jQuery('#submitdiv').after('<div class="es_upsale"><a style="text-decoration:none;" target="_blank" href="https://www.icegram.com/documentation/how-ready-made-template-in-in-email-subscribers-look/?utm_source=in_app&utm_medium=es_template&utm_campaign=es_upsale"><img title="Get readymade templates" style="width:100%;border:0.3em #d46307 solid" src="<?php echo EMAIL_SUBSCRIBERS_URL?>/admin/images/starter-tmpl.png"/><p style="background: #d46307; color: #FFF; padding: 4px; width: 100%; text-align:center">Get readymade beautiful email templates</p></a></div>');
358
- </script>
359
  <?php
360
  }
361
 
48
  /**
49
  * Initialize the class and set its properties.
50
  *
51
+ * @param string $email_subscribers The name of this plugin.
52
+ * @param string $version The version of this plugin.
53
+ *
54
  * @since 4.0
55
  *
 
 
56
  */
57
  public function __construct( $email_subscribers, $version ) {
58
 
65
 
66
  add_action( 'admin_menu', array( $this, 'email_subscribers_admin_menu' ) );
67
  add_action( 'wp_ajax_es_klawoo_subscribe', array( $this, 'klawoo_subscribe' ) );
68
+ add_action( 'admin_footer', array( $this, 'remove_submenu' ) );
69
  add_action( 'edit_form_advanced', array( $this, 'add_spam_score_utm_link' ) );
70
 
71
  }
76
  * @since 4.0
77
  */
78
  public function enqueue_styles() {
79
+ $screen = get_current_screen();
80
+ $screen_id = $screen ? $screen->id : '';
81
  $enqueue_on_screens = array(
82
  'toplevel_page_es_dashboard',
83
  'email-subscribers_page_es_subscribers',
126
  * @since 4.0
127
  */
128
  public function enqueue_scripts() {
129
+ $screen = get_current_screen();
130
+ $screen_id = $screen ? $screen->id : '';
131
  $enqueue_on_screens = array(
132
  'toplevel_page_es_dashboard',
133
  'email-subscribers_page_es_subscribers',
150
  wp_enqueue_script( $this->email_subscribers, plugin_dir_url( __FILE__ ) . 'js/email-subscribers-admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-tabs' ), $this->version, false );
151
  }
152
 
153
+ public function remove_submenu() {
154
  //remove submenues
155
  ?>
156
+ <script type="text/javascript">
157
  jQuery(document).ready(function () {
158
  var removeSubmenu = ['ig-es-broadcast', 'ig-es-lists', 'ig-es-post-notifications'];
159
  jQuery.each(removeSubmenu, function (key, id) {
160
  jQuery("#" + id).parent('a').parent('li').hide();
161
  });
162
  })
163
+ </script>
164
  <?php
165
  }
166
 
185
  ES_Templates_Table::get_instance();
186
  new Export_Subscribers();
187
  new ES_Handle_Post_Notification();
188
+ ES_Handle_Sync_Wp_User::get_instance();
189
  new ES_Import_Subscribers();
190
  ES_Info::get_instance();
191
  ES_Newsletters::get_instance();
354
  return;
355
  }
356
  ?>
357
+ <script>
358
+ jQuery('#submitdiv').after('<div class="es_upsale"><a style="text-decoration:none;" target="_blank" href="https://www.icegram.com/documentation/how-ready-made-template-in-in-email-subscribers-look/?utm_source=in_app&utm_medium=es_template&utm_campaign=es_upsale"><img title="Get readymade templates" style="width:100%;border:0.3em #d46307 solid" src="<?php echo EMAIL_SUBSCRIBERS_URL?>/admin/images/starter-tmpl.png"/><p style="background: #d46307; color: #FFF; padding: 4px; width: 100%; text-align:center">Get readymade beautiful email templates</p></a></div>');
359
+ </script>
360
  <?php
361
  }
362
 
admin/images/es-comments.png ADDED
Binary file
admin/js/email-subscribers-admin.js CHANGED
@@ -5,8 +5,10 @@
5
  $(document).on('change', '.es_visible', function () {
6
  if ($('.es_visible:checked').length >= 1) {
7
  $('.es_required').prop('disabled', false);
 
8
  } else {
9
  $('.es_required').prop('disabled', true);
 
10
  }
11
  });
12
  $('.es_visible').change();
5
  $(document).on('change', '.es_visible', function () {
6
  if ($('.es_visible:checked').length >= 1) {
7
  $('.es_required').prop('disabled', false);
8
+ $('.es_name_label').removeAttr('disabled');
9
  } else {
10
  $('.es_required').prop('disabled', true);
11
+ $('.es_name_label').attr('disabled', 'disabled');
12
  }
13
  });
14
  $('.es_visible').change();
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.18
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.18' );
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.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.1' );
28
  define( 'ES_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
29
 
30
  if ( ! defined( 'ES_PLUGIN_FILE' ) ) {
includes/admin/class-es-admin-settings.php CHANGED
@@ -16,33 +16,17 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  */
17
  class ES_Admin_Settings {
18
 
19
- // class instance
20
  static $instance;
21
 
22
- // subscriber WP_Template_Table object
23
  public $subscribers_obj;
24
 
25
- // class constructor
26
  public function __construct() {
27
- //add_filter( 'set-screen-option', [ __CLASS__, 'set_screen' ], 10, 3 );
28
- // add_action( 'admin_menu', [ $this, 'plugin_menu' ] );
29
- add_filter( 'ig_es_registered_settings', array( &$this, 'es_add_upsale' ), 10, 2 );
30
  }
31
 
32
  public static function set_screen( $status, $option, $value ) {
33
  return $value;
34
  }
35
 
36
- public function show_message( $message = '', $status = 'success' ) {
37
-
38
- $class = 'notice notice-success is-dismissible';
39
- if ( 'error' === $status ) {
40
- $class = 'notice notice-error is-dismissible';
41
- }
42
- echo "<div class='{$class}'><p>{$message}</p></div>";
43
- }
44
-
45
-
46
  public function es_settings_callback() {
47
 
48
  $submitted = ! empty( $_POST['submitted'] ) ? $_POST['submitted'] : '';
@@ -64,7 +48,7 @@ class ES_Admin_Settings {
64
  }
65
  $message = __( 'Settings have been saved successfully!' );
66
  $status = 'success';
67
- $this->show_message( $message, $status );
68
  }
69
 
70
 
@@ -122,375 +106,384 @@ class ES_Admin_Settings {
122
 
123
  public static function get_registered_settings() {
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
- $es_settings = array(
 
 
 
 
 
 
127
 
128
- 'general' => array(
129
-
130
- 'sender_information' => array(
131
- 'id' => 'sender_information',
132
- 'name' => __( 'Sender', 'email-subscribers' ),
133
- 'sub_fields' => array(
134
- 'from_name' => array(
135
- 'id' => 'ig_es_from_name',
136
- 'name' => __( 'Name', 'email-subscribers' ),
137
- 'desc' => __( 'Choose a FROM name for all the emails to be sent from this plugin.', 'email-subscribers' ),
138
- 'type' => 'text',
139
- 'placeholder' => __( 'Name', 'email-subscribers' ),
140
- 'default' => ''
141
- ),
142
 
143
- 'from_email' => array(
144
- 'id' => 'ig_es_from_email',
145
- 'name' => __( 'Email', 'email-subscribers' ),
146
- 'desc' => __( 'Choose a FROM email address for all the emails to be sent from this plugin', 'email-subscribers' ),
147
- 'type' => 'text',
148
- 'placeholder' => __( 'Email Address', 'email-subscribers' ),
149
- 'default' => ''
150
- ),
151
- )
152
- ),
153
-
154
- 'admin_email' => array(
155
- 'id' => 'ig_es_admin_emails',
156
- 'name' => __( 'Email Addresses', 'email-subscribers' ),
157
- 'type' => 'text',
158
- 'desc' => __( 'Enter the admin email addresses that should receive notifications (separated by comma).', 'email-subscribers' ),
159
- 'default' => ''
160
- ),
161
-
162
- 'email_type' => array(
163
- 'id' => 'ig_es_email_type',
164
- 'name' => __( 'Email Type', 'email-subscribers' ),
165
- 'desc' => __( 'Select whether to send HTML or Plain Text email using WordPress or PHP mail(). We recommend to send email using WordPres', 'email-subscribers' ),
166
- 'type' => 'select',
167
- 'options' => ES_Common::get_email_sending_type(),
168
- 'default' => 'wp_html_mail'
169
- ),
170
-
171
- 'ig_es_optin_type' => array(
172
- 'id' => 'ig_es_optin_type',
173
- 'name' => __( 'Opt-in Type', 'email-subscribers' ),
174
- 'desc' => '',
175
- 'type' => 'select',
176
- 'options' => ES_Common::get_optin_types(),
177
- 'default' => ''
178
- ),
179
-
180
- 'ig_es_post_image_size' => array(
181
- 'id' => 'ig_es_post_image_size',
182
- 'name' => __( 'Image Size', 'email-subscribers' ),
183
- 'type' => 'select',
184
- 'options' => ES_Common::get_image_sizes(),
185
- 'desc' => __( '<p>Select image size for {{POSTIMAGE}} to be shown in the Post Notification Emails.</p>', 'email-subscribers' ),
186
- 'default' => 'full'
187
- ),
188
-
189
- 'ig_es_track_email_opens' => array(
190
- 'id' => 'ig_es_track_email_opens',
191
- 'name' => __( 'Track Opens', 'email-subscribers' ),
192
- 'type' => 'checkbox',
193
- 'desc' => __( 'Check this if you want to track email opening.', 'email-subscribers' ),
194
- 'default' => 'yes'
195
- ),
196
-
197
- //'ig_es_unsubscribe_link' => array( 'type' => 'text', 'options' => false, 'placeholder' => '', 'readonly' => 'readonly', 'supplemental' => '', 'default' => '', 'id' => 'ig_es_unsubscribe_link', 'name' => __( 'Unsubscribe Link', 'email-subscribers' ), 'desc' => '', ),
198
- 'ig_es_unsubscribe_link_content' => array(
199
- 'type' => 'textarea',
200
- 'options' => false,
201
- 'placeholder' => '',
202
- 'supplemental' => '',
203
- 'default' => '',
204
- 'id' => 'ig_es_unsubscribe_link_content',
205
- 'name' => __( 'Show Unsubscribe Message In Email Footer', 'email-subscribers' ),
206
- 'desc' => __( 'Add text which you want your contact to see in footer to unsubscribe. Use {{UNSUBSCRIBE-LINK}} keyword to add unsubscribe link.', 'email-subscribers' ),
207
- ),
208
-
209
- //'ig_es_optin_link' => array( 'type' => 'text', 'options' => false, 'readonly' => 'readonly', 'placeholder' => '', 'supplemental' => '', 'default' => '', 'id' => 'ig_es_optin_link', 'name' => 'Double Opt-In Confirmation Link', 'desc' => '', ),
210
-
211
- 'subscription_messages' => array(
212
- 'id' => 'subscription_messages',
213
- 'name' => __( 'Subscription Success/ Error Messages', 'email-subscribers' ),
214
- 'sub_fields' => array(
215
- 'ig_es_subscription_success_message' => array(
216
- 'type' => 'textarea',
217
- 'options' => false,
218
- 'placeholder' => '',
219
- 'supplemental' => '',
220
- 'default' => __( 'You have been subscribed successfully!', 'email-subscribers' ),
221
- 'id' => 'ig_es_subscription_success_message',
222
- 'name' => __( 'Success Message', 'email-subscribers' ),
223
- 'desc' => __( 'Show this message if contact is successfully subscribed from Double Opt-In (Confirmation) Email', 'email-subscribers' )
224
- ),
225
 
226
- 'ig_es_subscription_error_messsage' => array(
227
- 'type' => 'textarea',
228
- 'options' => false,
229
- 'placeholder' => '',
230
- 'supplemental' => '',
231
- 'default' => __( 'Oops.. Your request couldn\'t be completed. This email address seems to be already subscribed / blocked.', 'email-subscribers' ),
232
- 'id' => 'ig_es_subscription_error_messsage',
233
- 'name' => __( 'Error Message', 'email-subscribers' ),
234
- 'desc' => __( 'Show this message if any error occured after clicking confirmation link from Double Opt-In (Confirmation) Email.', 'email-subscribers' )
235
- ),
236
 
237
- )
238
- ),
239
-
240
- 'unsubscription_messages' => array(
241
- 'id' => 'unsubscription_messages',
242
- 'name' => __( 'Unsubscribe Success/ Error Messages', 'email-subscribers' ),
243
- 'sub_fields' => array(
244
-
245
- 'ig_es_unsubscribe_success_message' => array(
246
- 'type' => 'textarea',
247
- 'options' => false,
248
- 'placeholder' => '',
249
- 'supplemental' => '',
250
- 'default' => __( 'Thank You, You have been successfully unsubscribed. You will no longer hear from us.', 'email-subscribers' ),
251
- 'id' => 'ig_es_unsubscribe_success_message',
252
- 'name' => __( 'Success Message', 'email-subscribers' ),
253
- 'desc' => __( 'Once contact clicks on unsubscribe link, he/she will be redirected to a page where this message will be shown.', 'email-subscribers' )
254
- ),
255
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
 
257
- 'ig_es_unsubscribe_error_message' => array(
258
- 'type' => 'textarea',
259
- 'options' => false,
260
- 'placeholder' => '',
261
- 'supplemental' => '',
262
- 'default' => 'Oops.. There was some technical error. Please try again later or contact us.',
263
- 'id' => 'ig_es_unsubscribe_error_message',
264
- 'name' => __( 'Error Message', 'email-subscribers' ),
265
- 'desc' => __( 'Show this message if any error occured after clicking on unsubscribe link.', 'email-subscribers' )
266
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  )
268
- ),
269
-
270
-
271
- /*
272
- 'sent_report_subject' => array(
273
- 'id' => 'ig_es_sent_report_subject',
274
- 'name' => __( 'Sent Report Subject', 'email-subscribers' ),
275
- 'type' => 'text',
276
- 'desc' => __( 'Subject for the email report which will be sent to admin.', 'email-subscribers' ),
277
- 'default' => 'Your email has been sent'
278
- ),
279
-
280
- 'sent_report_content' => array(
281
- 'id' => 'ig_es_sent_report_content',
282
- 'name' => __( 'Sent Report Content', 'email-subscribers' ),
283
- 'type' => 'textarea',
284
- 'desc' => __( 'Content for the email report which will be sent to admin.</p><p>Available Keywords: {{COUNT}}, {{UNIQUE}}, {{STARTTIME}}, {{ENDTIME}}', 'email-subscribers' ),
285
- ),
286
- */
287
  ),
288
 
289
- 'signup_confirmation' => array(
290
-
291
- 'welcome_emails' => array(
292
- 'id' => 'welcome_emails',
293
- 'name' => __( 'Welcome Email', 'email-subscribers' ),
294
- 'sub_fields' => array(
295
-
296
- 'ig_es_enable_welcome_email' => array(
297
- 'type' => 'select',
298
- 'options' => array( 'yes' => __( 'Yes', 'email-subscribers' ), 'no' => __( 'No', 'email-subscribers' ) ),
299
- 'placeholder' => '',
300
- 'supplemental' => '',
301
- 'default' => 'yes',
302
- 'id' => 'ig_es_enable_welcome_email',
303
- 'name' => __( 'Enable?', 'email-subscribers' ),
304
- 'desc' => __( 'Send welcome email to new contact after signup.', 'email-subscribers' ),
305
- ),
306
 
307
- 'ig_es_welcome_email_subject' => array(
308
- 'type' => 'text',
309
- 'options' => false,
310
- 'placeholder' => '',
311
- 'supplemental' => '',
312
- 'default' => '',
313
- 'id' => 'ig_es_welcome_email_subject',
314
- 'name' => __( 'Subject', 'email-subscribers' ),
315
- 'desc' => '',
316
- ),
317
- 'ig_es_welcome_email_content' => array(
318
- 'type' => 'textarea',
319
- 'options' => false,
320
- 'placeholder' => '',
321
- 'supplemental' => '',
322
- 'default' => '',
323
- 'id' => 'ig_es_welcome_email_content',
324
- 'name' => __( 'Content', 'email-subscribers' ),
325
- 'desc' => __( 'Available keywords. {{NAME}}, {{EMAIL}}, {{LIST}}, {{UNSUBSCRIBE-LINK}}', 'email-subscribers' ),
326
- ),
327
- )
328
- ),
329
-
330
- 'confirmation_notifications' => array(
331
- 'id' => 'confirmation_notifications',
332
- 'name' => __( 'Confirmation Email', 'email-subscribers' ),
333
- 'sub_fields' => array(
334
-
335
- 'ig_es_confirmation_mail_subject' => array(
336
- 'type' => 'text',
337
- 'options' => false,
338
- 'placeholder' => '',
339
- 'supplemental' => '',
340
- 'default' => '',
341
- 'id' => 'ig_es_confirmation_mail_subject',
342
- 'name' => __( 'Subject', 'email-subscribers' ),
343
- 'desc' => '',
344
- ),
345
 
346
- 'ig_es_confirmation_mail_content' => array(
347
- 'type' => 'textarea',
348
- 'options' => false,
349
- 'placeholder' => '',
350
- 'supplemental' => '',
351
- 'default' => '',
352
- 'id' => 'ig_es_confirmation_mail_content',
353
- 'name' => __( 'Content', 'email-subscribers' ),
354
- 'desc' => __( 'If Double Optin is set, contact will receive confirmation email with above content. You can use {{NAME}}, {{EMAIL}}, {{SUBSCRIBE-LINK}} keywords', 'email-subscribers' ),
355
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
356
  )
357
- ),
358
-
359
- 'admin_notifications' => array(
360
-
361
- 'id' => 'admin_notifications',
362
- 'name' => __( 'Admin Notification On New Subscription', 'email-subscribers' ),
363
- 'sub_fields' => array(
364
-
365
- 'notify_admin' => array(
366
- 'id' => 'ig_es_notify_admin',
367
- 'name' => __( 'Notify?', 'email-subscribers' ),
368
- 'type' => 'select',
369
- 'options' => array(
370
- 'yes' => __( 'Yes', 'email-subscribers' ),
371
- 'no' => __( 'No', 'email-subscribers' )
372
- ),
373
- 'desc' => __( 'Set this option to "Yes" to notify admin(s) for new contact signup.', 'email-subscribers' ),
374
- 'default' => 'yes'
375
- ),
376
 
 
 
 
377
 
378
- 'new_contact_email_subject' => array(
379
- 'id' => 'ig_es_admin_new_contact_email_subject',
380
- 'name' => __( 'Subject', 'email-subscribers' ),
381
- 'type' => 'text',
382
- 'desc' => __( 'Subject for the admin email whenever a new contact signs up and is confirmed', 'email-subscribers' ),
383
- 'default' => __( 'New email subscription', 'email-subscribers' )
 
384
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
 
386
- 'new_contact_email_content' => array(
387
- 'id' => 'ig_es_admin_new_contact_email_content',
388
- 'name' => __( 'Content', 'email-subscribers' ),
389
- 'type' => 'textarea',
390
- 'desc' => __( 'Content for the admin email whenever a new subscriber signs up and is confirmed. Available Keywords: {{NAME}}, {{EMAIL}}, {{LIST}}', 'email-subscribers' ),
391
- 'default' => '',
 
 
 
 
 
 
392
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  )
394
- ),
395
-
396
- 'ig_es_cron_report' => array(
397
- 'id' => 'ig_es_cron_report',
398
- 'name' => __( 'Admin Notification On Every Campaign Sent', 'email-subscribers' ),
399
- 'sub_fields' => array(
400
-
401
- 'ig_es_enable_cron_admin_email' => array(
402
- 'id' => 'ig_es_enable_cron_admin_email',
403
- 'name' => __( 'Notify?', 'email-subscribers' ),
404
- 'type' => 'select',
405
- 'options' => array(
406
- 'yes' => __( 'Yes', 'email-subscribers' ),
407
- 'no' => __( 'No', 'email-subscribers' )
408
- ),
409
- 'desc' => __( 'Set this option to "Yes" to notify admin(s) on every campaign sent.', 'email-subscribers' ),
410
- 'default' => 'yes'
411
- ),
412
- 'ig_es_cron_admin_email_subject' => array(
413
- 'type' => 'text',
414
- 'options' => false,
415
- 'placeholder' => '',
416
- 'supplemental' => '',
417
- 'default' => __( 'Campaign Sent!', 'email-subscribers' ),
418
- 'id' => 'ig_es_cron_admin_email_subject',
419
- 'name' => __( 'Subject', 'email-subscribers' ),
420
- 'desc' => '',
421
- ),
422
 
423
- 'ig_es_cron_admin_email' => array(
424
- 'type' => 'textarea',
425
- 'options' => false,
426
- 'placeholder' => '',
427
- 'supplemental' => '',
428
- 'default' => '',
429
- 'id' => 'ig_es_cron_admin_email',
430
- 'name' => __( 'Content', 'email-subscribers' ),
431
- 'desc' => __( 'Send report to admin(s) whenever campaign is successfully sent to all contacts. Available Keywords: {{DATE}}, {{SUBJECT}}, {{COUNT}}', 'email-subscribers' ),
432
- )
433
-
434
- )
435
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
  ),
437
 
438
- 'email_sending' => array(
439
- 'ig_es_cronurl' => array(
440
- 'type' => 'text',
441
- 'placeholder' => '',
442
- 'supplemental' => '',
443
- 'default' => '',
444
- 'readonly' => 'readonly',
445
- 'id' => 'ig_es_cronurl',
446
- 'name' => __( 'Cron URL', 'email-subscribers' ),
447
- 'desc' => __( sprintf( __( "You need to visit this URL to send email notifications. Know <a href='%s' target='_blank'>how to run this in background</a>", 'email-subscribers' ),
448
- "https://www.icegram.com/documentation/es-how-to-schedule-cron-emails-in-cpanel/?utm_source=es&utm_medium=in_app&utm_campaign=view_docs_help_page" ) )
449
- ),
450
- 'ig_es_disable_wp_cron' => array(
451
- 'type' => 'checkbox',
452
- 'placeholder' => '',
453
- 'supplemental' => '',
454
- 'default' => 'no',
455
- 'id' => 'ig_es_disable_wp_cron',
456
- 'name' => __( 'Disable WordPress Cron', 'email-subscribers' ),
457
- 'desc' => __( 'Check this if you do not want Email Subscribers to use WP cron for sending emails', 'email-subscribers' )
458
- ),
459
-
460
- 'ig_es_hourly_email_send_limit' => array(
461
- 'type' => 'text',
462
- 'placeholder' => '',
463
- 'supplemental' => '',
464
- 'default' => 50,
465
- 'id' => 'ig_es_hourly_email_send_limit',
466
- 'name' => __( 'Maximum Emails To Send In An Hour', 'email-subscribers' ),
467
- 'desc' => __( 'Total emails your host can send in an hour.', 'email-subscribers' )
468
- ),
469
-
470
- 'ig_es_test_send_email' => array(
471
- 'type' => 'html',
472
- 'html' => '<input id="es-test-email" type="email"/><input type="submit" name="submit" id="es-send-test" class="button button-primary" value="Send Email"><span class="es_spinner_image_admin" id="spinner-image" style="display:none"><img src="'.EMAIL_SUBSCRIBERS_URL. '/public/images/spinner.gif'.'"/></span>',
473
- 'placeholder' => '',
474
- 'supplemental' => '',
475
- 'default' => '',
476
- 'id' => 'ig_es_test_send_email',
477
- 'name' => __( 'Send Test Email', 'email-subscribers' ),
478
- 'desc' => __( 'Enter email address to send test email.', 'email-subscribers' )
479
- )
480
  ),
481
 
482
- 'security_settings' => array(
483
- 'blocked_domains' => array(
484
- 'id' => 'ig_es_blocked_domains',
485
- 'name' => __( 'Blocked Domain(s)', 'email-subscribers' ),
486
- 'type' => 'textarea',
487
- 'info' => __( 'Seeing spam signups from particular domains? Enter domains names (one per line) that you want to block here.', 'email-subscribers' ),
488
- 'default' => 'mail.ru'
489
- ),
490
-
491
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
492
 
 
493
 
 
 
 
 
 
494
  );
495
 
496
  return apply_filters( 'ig_es_registered_settings', $es_settings );
@@ -626,7 +619,7 @@ class ES_Admin_Settings {
626
  $html .= '<input type="hidden" name="submit_action" value="ig-es-save-admin-settings"/>';
627
  $nonce = wp_create_nonce( 'es-update-settings' );
628
  $html .= '<input type="hidden" name="update-settings" id="ig-update-settings" value="' . $nonce . '"/>';
629
- $html .= '<input type="submit" name="submit" id="submit" class="button button-primary" value="' . __( 'Save Changes', 'email-subscribers' ) . '">';
630
  $html .= "</td></tr>";
631
  $html .= "</tbody>";
632
  $html .= "</table>";
@@ -634,33 +627,6 @@ class ES_Admin_Settings {
634
 
635
  }
636
 
637
- function es_add_upsale( $fields ) {
638
- $active_plugins = (array) get_option( 'active_plugins', array() );
639
- if ( is_multisite() ) {
640
- $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
641
- }
642
-
643
- if ( ! ( in_array( 'email-subscribers-premium/email-subscribers-premium.php', $active_plugins ) || array_key_exists( 'email-subscribers-premium/email-subscribers-premium.php', $active_plugins ) ) ) {
644
- //add upsale
645
- $field_security['es_upsale_security'] = array(
646
- 'id' => 'ig_es_blocked_domains',
647
- 'type' => 'html',
648
- 'name' => '',
649
- 'html' => '<div class="es-upsale-image" style=""><a target="_blank" href="https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=es_security_settings&utm_campaign=es_upsale"><image src="'.EMAIL_SUBSCRIBERS_URL. '/admin/images/es-captcha-2.png'.'"/></a></div>'
650
- );
651
- $fields['security_settings'] = array_merge( $fields['security_settings'], $field_security );
652
-
653
- //add upsale
654
- $field_smtp['es_upsale_smtp'] = array(
655
- 'id' => 'ig_es_blocked_domains',
656
- 'type' => 'html',
657
- 'name' => '<div class="es-smtp-label" style=""><a target="_blank" href="https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=es_security_settings&utm_campaign=es_upsale"><img src="'.EMAIL_SUBSCRIBERS_URL. '/admin/images/es-smtp-label.png'.'"/></a></div>',
658
- 'html' => '<div class="es-upsale-image es-smtp-image" style=""><a target="_blank" href="https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=es_security_settings&utm_campaign=es_upsale"><img src="'.EMAIL_SUBSCRIBERS_URL. '/admin/images/es-smtp.png'.'"/></a></div>'
659
- );
660
- $fields['email_sending'] = array_merge( $fields['email_sending'], $field_smtp );
661
 
662
- }
663
- return $fields;
664
- }
665
 
666
  }
16
  */
17
  class ES_Admin_Settings {
18
 
 
19
  static $instance;
20
 
 
21
  public $subscribers_obj;
22
 
 
23
  public function __construct() {
 
 
 
24
  }
25
 
26
  public static function set_screen( $status, $option, $value ) {
27
  return $value;
28
  }
29
 
 
 
 
 
 
 
 
 
 
 
30
  public function es_settings_callback() {
31
 
32
  $submitted = ! empty( $_POST['submitted'] ) ? $_POST['submitted'] : '';
48
  }
49
  $message = __( 'Settings have been saved successfully!' );
50
  $status = 'success';
51
+ ES_Common::show_message( $message, $status );
52
  }
53
 
54
 
106
 
107
  public static function get_registered_settings() {
108
 
109
+ $general_settings = array(
110
+
111
+ 'sender_information' => array(
112
+ 'id' => 'sender_information',
113
+ 'name' => __( 'Sender', 'email-subscribers' ),
114
+ 'sub_fields' => array(
115
+ 'from_name' => array(
116
+ 'id' => 'ig_es_from_name',
117
+ 'name' => __( 'Name', 'email-subscribers' ),
118
+ 'desc' => __( 'Choose a FROM name for all the emails to be sent from this plugin.', 'email-subscribers' ),
119
+ 'type' => 'text',
120
+ 'placeholder' => __( 'Name', 'email-subscribers' ),
121
+ 'default' => ''
122
+ ),
123
+
124
+ 'from_email' => array(
125
+ 'id' => 'ig_es_from_email',
126
+ 'name' => __( 'Email', 'email-subscribers' ),
127
+ 'desc' => __( 'Choose a FROM email address for all the emails to be sent from this plugin', 'email-subscribers' ),
128
+ 'type' => 'text',
129
+ 'placeholder' => __( 'Email Address', 'email-subscribers' ),
130
+ 'default' => ''
131
+ ),
132
+ )
133
+ ),
134
 
135
+ 'admin_email' => array(
136
+ 'id' => 'ig_es_admin_emails',
137
+ 'name' => __( 'Email Addresses', 'email-subscribers' ),
138
+ 'type' => 'text',
139
+ 'desc' => __( 'Enter the admin email addresses that should receive notifications (separated by comma).', 'email-subscribers' ),
140
+ 'default' => ''
141
+ ),
142
 
143
+ 'email_type' => array(
144
+ 'id' => 'ig_es_email_type',
145
+ 'name' => __( 'Email Type', 'email-subscribers' ),
146
+ 'desc' => __( 'Select whether to send HTML or Plain Text email using WordPress or PHP mail(). We recommend to send email using WordPres', 'email-subscribers' ),
147
+ 'type' => 'select',
148
+ 'options' => ES_Common::get_email_sending_type(),
149
+ 'default' => 'wp_html_mail'
150
+ ),
 
 
 
 
 
 
151
 
152
+ 'ig_es_optin_type' => array(
153
+ 'id' => 'ig_es_optin_type',
154
+ 'name' => __( 'Opt-in Type', 'email-subscribers' ),
155
+ 'desc' => '',
156
+ 'type' => 'select',
157
+ 'options' => ES_Common::get_optin_types(),
158
+ 'default' => ''
159
+ ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
+ 'ig_es_post_image_size' => array(
162
+ 'id' => 'ig_es_post_image_size',
163
+ 'name' => __( 'Image Size', 'email-subscribers' ),
164
+ 'type' => 'select',
165
+ 'options' => ES_Common::get_image_sizes(),
166
+ 'desc' => __( '<p>Select image size for {{POSTIMAGE}} to be shown in the Post Notification Emails.</p>', 'email-subscribers' ),
167
+ 'default' => 'full'
168
+ ),
 
 
169
 
170
+ 'ig_es_track_email_opens' => array(
171
+ 'id' => 'ig_es_track_email_opens',
172
+ 'name' => __( 'Track Opens', 'email-subscribers' ),
173
+ 'type' => 'checkbox',
174
+ 'desc' => __( 'Check this if you want to track email opening.', 'email-subscribers' ),
175
+ 'default' => 'yes'
176
+ ),
 
 
 
 
 
 
 
 
 
 
 
177
 
178
+ //'ig_es_unsubscribe_link' => array( 'type' => 'text', 'options' => false, 'placeholder' => '', 'readonly' => 'readonly', 'supplemental' => '', 'default' => '', 'id' => 'ig_es_unsubscribe_link', 'name' => __( 'Unsubscribe Link', 'email-subscribers' ), 'desc' => '', ),
179
+ 'ig_es_unsubscribe_link_content' => array(
180
+ 'type' => 'textarea',
181
+ 'options' => false,
182
+ 'placeholder' => '',
183
+ 'supplemental' => '',
184
+ 'default' => '',
185
+ 'id' => 'ig_es_unsubscribe_link_content',
186
+ 'name' => __( 'Show Unsubscribe Message In Email Footer', 'email-subscribers' ),
187
+ 'desc' => __( 'Add text which you want your contact to see in footer to unsubscribe. Use {{UNSUBSCRIBE-LINK}} keyword to add unsubscribe link.', 'email-subscribers' ),
188
+ ),
189
+
190
+ //'ig_es_optin_link' => array( 'type' => 'text', 'options' => false, 'readonly' => 'readonly', 'placeholder' => '', 'supplemental' => '', 'default' => '', 'id' => 'ig_es_optin_link', 'name' => 'Double Opt-In Confirmation Link', 'desc' => '', ),
191
+
192
+ 'subscription_messages' => array(
193
+ 'id' => 'subscription_messages',
194
+ 'name' => __( 'Subscription Success/ Error Messages', 'email-subscribers' ),
195
+ 'sub_fields' => array(
196
+ 'ig_es_subscription_success_message' => array(
197
+ 'type' => 'textarea',
198
+ 'options' => false,
199
+ 'placeholder' => '',
200
+ 'supplemental' => '',
201
+ 'default' => __( 'You have been subscribed successfully!', 'email-subscribers' ),
202
+ 'id' => 'ig_es_subscription_success_message',
203
+ 'name' => __( 'Success Message', 'email-subscribers' ),
204
+ 'desc' => __( 'Show this message if contact is successfully subscribed from Double Opt-In (Confirmation) Email', 'email-subscribers' )
205
+ ),
206
+
207
+ 'ig_es_subscription_error_messsage' => array(
208
+ 'type' => 'textarea',
209
+ 'options' => false,
210
+ 'placeholder' => '',
211
+ 'supplemental' => '',
212
+ 'default' => __( 'Oops.. Your request couldn\'t be completed. This email address seems to be already subscribed / blocked.', 'email-subscribers' ),
213
+ 'id' => 'ig_es_subscription_error_messsage',
214
+ 'name' => __( 'Error Message', 'email-subscribers' ),
215
+ 'desc' => __( 'Show this message if any error occured after clicking confirmation link from Double Opt-In (Confirmation) Email.', 'email-subscribers' )
216
+ ),
217
+
218
+ )
219
+ ),
220
 
221
+ 'unsubscription_messages' => array(
222
+ 'id' => 'unsubscription_messages',
223
+ 'name' => __( 'Unsubscribe Success/ Error Messages', 'email-subscribers' ),
224
+ 'sub_fields' => array(
225
+
226
+ 'ig_es_unsubscribe_success_message' => array(
227
+ 'type' => 'textarea',
228
+ 'options' => false,
229
+ 'placeholder' => '',
230
+ 'supplemental' => '',
231
+ 'default' => __( 'Thank You, You have been successfully unsubscribed. You will no longer hear from us.', 'email-subscribers' ),
232
+ 'id' => 'ig_es_unsubscribe_success_message',
233
+ 'name' => __( 'Success Message', 'email-subscribers' ),
234
+ 'desc' => __( 'Once contact clicks on unsubscribe link, he/she will be redirected to a page where this message will be shown.', 'email-subscribers' )
235
+ ),
236
+
237
+
238
+ 'ig_es_unsubscribe_error_message' => array(
239
+ 'type' => 'textarea',
240
+ 'options' => false,
241
+ 'placeholder' => '',
242
+ 'supplemental' => '',
243
+ 'default' => 'Oops.. There was some technical error. Please try again later or contact us.',
244
+ 'id' => 'ig_es_unsubscribe_error_message',
245
+ 'name' => __( 'Error Message', 'email-subscribers' ),
246
+ 'desc' => __( 'Show this message if any error occured after clicking on unsubscribe link.', 'email-subscribers' )
247
  )
248
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  ),
250
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
 
252
+ /*
253
+ 'sent_report_subject' => array(
254
+ 'id' => 'ig_es_sent_report_subject',
255
+ 'name' => __( 'Sent Report Subject', 'email-subscribers' ),
256
+ 'type' => 'text',
257
+ 'desc' => __( 'Subject for the email report which will be sent to admin.', 'email-subscribers' ),
258
+ 'default' => 'Your email has been sent'
259
+ ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
 
261
+ 'sent_report_content' => array(
262
+ 'id' => 'ig_es_sent_report_content',
263
+ 'name' => __( 'Sent Report Content', 'email-subscribers' ),
264
+ 'type' => 'textarea',
265
+ 'desc' => __( 'Content for the email report which will be sent to admin.</p><p>Available Keywords: {{COUNT}}, {{UNIQUE}}, {{STARTTIME}}, {{ENDTIME}}', 'email-subscribers' ),
266
+ ),
267
+ */
268
+ );
269
+
270
+ $general_settings = apply_filters( 'ig_es_registered_general_settings', $general_settings );
271
+
272
+ $signup_confirmation_settings = array(
273
+
274
+ 'welcome_emails' => array(
275
+ 'id' => 'welcome_emails',
276
+ 'name' => __( 'Welcome Email', 'email-subscribers' ),
277
+ 'sub_fields' => array(
278
+
279
+ 'ig_es_enable_welcome_email' => array(
280
+ 'type' => 'select',
281
+ 'options' => array( 'yes' => __( 'Yes', 'email-subscribers' ), 'no' => __( 'No', 'email-subscribers' ) ),
282
+ 'placeholder' => '',
283
+ 'supplemental' => '',
284
+ 'default' => 'yes',
285
+ 'id' => 'ig_es_enable_welcome_email',
286
+ 'name' => __( 'Enable?', 'email-subscribers' ),
287
+ 'desc' => __( 'Send welcome email to new contact after signup.', 'email-subscribers' ),
288
+ ),
289
+
290
+ 'ig_es_welcome_email_subject' => array(
291
+ 'type' => 'text',
292
+ 'options' => false,
293
+ 'placeholder' => '',
294
+ 'supplemental' => '',
295
+ 'default' => '',
296
+ 'id' => 'ig_es_welcome_email_subject',
297
+ 'name' => __( 'Subject', 'email-subscribers' ),
298
+ 'desc' => '',
299
+ ),
300
+ 'ig_es_welcome_email_content' => array(
301
+ 'type' => 'textarea',
302
+ 'options' => false,
303
+ 'placeholder' => '',
304
+ 'supplemental' => '',
305
+ 'default' => '',
306
+ 'id' => 'ig_es_welcome_email_content',
307
+ 'name' => __( 'Content', 'email-subscribers' ),
308
+ 'desc' => __( 'Available keywords. {{NAME}}, {{EMAIL}}, {{LIST}}, {{UNSUBSCRIBE-LINK}}', 'email-subscribers' ),
309
+ ),
310
+ )
311
+ ),
312
+
313
+ 'confirmation_notifications' => array(
314
+ 'id' => 'confirmation_notifications',
315
+ 'name' => __( 'Confirmation Email', 'email-subscribers' ),
316
+ 'sub_fields' => array(
317
+
318
+ 'ig_es_confirmation_mail_subject' => array(
319
+ 'type' => 'text',
320
+ 'options' => false,
321
+ 'placeholder' => '',
322
+ 'supplemental' => '',
323
+ 'default' => '',
324
+ 'id' => 'ig_es_confirmation_mail_subject',
325
+ 'name' => __( 'Subject', 'email-subscribers' ),
326
+ 'desc' => '',
327
+ ),
328
+
329
+ 'ig_es_confirmation_mail_content' => array(
330
+ 'type' => 'textarea',
331
+ 'options' => false,
332
+ 'placeholder' => '',
333
+ 'supplemental' => '',
334
+ 'default' => '',
335
+ 'id' => 'ig_es_confirmation_mail_content',
336
+ 'name' => __( 'Content', 'email-subscribers' ),
337
+ 'desc' => __( 'If Double Optin is set, contact will receive confirmation email with above content. You can use {{NAME}}, {{EMAIL}}, {{SUBSCRIBE-LINK}} keywords', 'email-subscribers' ),
338
  )
339
+ )
340
+ ),
341
+
342
+ 'admin_notifications' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
 
344
+ 'id' => 'admin_notifications',
345
+ 'name' => __( 'Admin Notification On New Subscription', 'email-subscribers' ),
346
+ 'sub_fields' => array(
347
 
348
+ 'notify_admin' => array(
349
+ 'id' => 'ig_es_notify_admin',
350
+ 'name' => __( 'Notify?', 'email-subscribers' ),
351
+ 'type' => 'select',
352
+ 'options' => array(
353
+ 'yes' => __( 'Yes', 'email-subscribers' ),
354
+ 'no' => __( 'No', 'email-subscribers' )
355
  ),
356
+ 'desc' => __( 'Set this option to "Yes" to notify admin(s) for new contact signup.', 'email-subscribers' ),
357
+ 'default' => 'yes'
358
+ ),
359
+
360
+
361
+ 'new_contact_email_subject' => array(
362
+ 'id' => 'ig_es_admin_new_contact_email_subject',
363
+ 'name' => __( 'Subject', 'email-subscribers' ),
364
+ 'type' => 'text',
365
+ 'desc' => __( 'Subject for the admin email whenever a new contact signs up and is confirmed', 'email-subscribers' ),
366
+ 'default' => __( 'New email subscription', 'email-subscribers' )
367
+ ),
368
+
369
+ 'new_contact_email_content' => array(
370
+ 'id' => 'ig_es_admin_new_contact_email_content',
371
+ 'name' => __( 'Content', 'email-subscribers' ),
372
+ 'type' => 'textarea',
373
+ 'desc' => __( 'Content for the admin email whenever a new subscriber signs up and is confirmed. Available Keywords: {{NAME}}, {{EMAIL}}, {{LIST}}', 'email-subscribers' ),
374
+ 'default' => '',
375
+ ),
376
+ )
377
+ ),
378
 
379
+ 'ig_es_cron_report' => array(
380
+ 'id' => 'ig_es_cron_report',
381
+ 'name' => __( 'Admin Notification On Every Campaign Sent', 'email-subscribers' ),
382
+ 'sub_fields' => array(
383
+
384
+ 'ig_es_enable_cron_admin_email' => array(
385
+ 'id' => 'ig_es_enable_cron_admin_email',
386
+ 'name' => __( 'Notify?', 'email-subscribers' ),
387
+ 'type' => 'select',
388
+ 'options' => array(
389
+ 'yes' => __( 'Yes', 'email-subscribers' ),
390
+ 'no' => __( 'No', 'email-subscribers' )
391
  ),
392
+ 'desc' => __( 'Set this option to "Yes" to notify admin(s) on every campaign sent.', 'email-subscribers' ),
393
+ 'default' => 'yes'
394
+ ),
395
+ 'ig_es_cron_admin_email_subject' => array(
396
+ 'type' => 'text',
397
+ 'options' => false,
398
+ 'placeholder' => '',
399
+ 'supplemental' => '',
400
+ 'default' => __( 'Campaign Sent!', 'email-subscribers' ),
401
+ 'id' => 'ig_es_cron_admin_email_subject',
402
+ 'name' => __( 'Subject', 'email-subscribers' ),
403
+ 'desc' => '',
404
+ ),
405
+
406
+ 'ig_es_cron_admin_email' => array(
407
+ 'type' => 'textarea',
408
+ 'options' => false,
409
+ 'placeholder' => '',
410
+ 'supplemental' => '',
411
+ 'default' => '',
412
+ 'id' => 'ig_es_cron_admin_email',
413
+ 'name' => __( 'Content', 'email-subscribers' ),
414
+ 'desc' => __( 'Send report to admin(s) whenever campaign is successfully sent to all contacts. Available Keywords: {{DATE}}, {{SUBJECT}}, {{COUNT}}', 'email-subscribers' ),
415
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
 
 
 
 
 
 
 
 
 
 
 
 
 
417
  )
418
+ )
419
+ );
420
+
421
+ $signup_confirmation_settings = apply_filters( 'ig_es_registered_signup_confirmation_settings', $signup_confirmation_settings );
422
+
423
+ $email_sending_settings = array(
424
+ 'ig_es_cronurl' => array(
425
+ 'type' => 'text',
426
+ 'placeholder' => '',
427
+ 'supplemental' => '',
428
+ 'default' => '',
429
+ 'readonly' => 'readonly',
430
+ 'id' => 'ig_es_cronurl',
431
+ 'name' => __( 'Cron URL', 'email-subscribers' ),
432
+ 'desc' => __( sprintf( __( "You need to visit this URL to send email notifications. Know <a href='%s' target='_blank'>how to run this in background</a>", 'email-subscribers' ),
433
+ "https://www.icegram.com/documentation/es-how-to-schedule-cron-emails-in-cpanel/?utm_source=es&utm_medium=in_app&utm_campaign=view_docs_help_page" ) )
434
+ ),
435
+ 'ig_es_disable_wp_cron' => array(
436
+ 'type' => 'checkbox',
437
+ 'placeholder' => '',
438
+ 'supplemental' => '',
439
+ 'default' => 'no',
440
+ 'id' => 'ig_es_disable_wp_cron',
441
+ 'name' => __( 'Disable WordPress Cron', 'email-subscribers' ),
442
+ 'desc' => __( 'Check this if you do not want Email Subscribers to use WP cron for sending emails', 'email-subscribers' )
443
  ),
444
 
445
+ 'ig_es_hourly_email_send_limit' => array(
446
+ 'type' => 'text',
447
+ 'placeholder' => '',
448
+ 'supplemental' => '',
449
+ 'default' => 50,
450
+ 'id' => 'ig_es_hourly_email_send_limit',
451
+ 'name' => __( 'Maximum Emails To Send In An Hour', 'email-subscribers' ),
452
+ 'desc' => __( 'Total emails your host can send in an hour.', 'email-subscribers' )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  ),
454
 
455
+ 'ig_es_test_send_email' => array(
456
+ 'type' => 'html',
457
+ 'html' => '<input id="es-test-email" type="email"/><input type="submit" name="submit" id="es-send-test" class="button button-primary" value="Send Email"><span class="es_spinner_image_admin" id="spinner-image" style="display:none"><img src="' . EMAIL_SUBSCRIBERS_URL . '/public/images/spinner.gif' . '"/></span>',
458
+ 'placeholder' => '',
459
+ 'supplemental' => '',
460
+ 'default' => '',
461
+ 'id' => 'ig_es_test_send_email',
462
+ 'name' => __( 'Send Test Email', 'email-subscribers' ),
463
+ 'desc' => __( 'Enter email address to send test email.', 'email-subscribers' )
464
  )
465
+ );
466
+
467
+ $email_sending_settings = apply_filters( 'ig_es_registered_email_sending_settings', $email_sending_settings );
468
+
469
+ $security_settings = array(
470
+ 'blocked_domains' => array(
471
+ 'id' => 'ig_es_blocked_domains',
472
+ 'name' => __( 'Blocked Domain(s)', 'email-subscribers' ),
473
+ 'type' => 'textarea',
474
+ 'info' => __( 'Seeing spam signups from particular domains? Enter domains names (one per line) that you want to block here.', 'email-subscribers' ),
475
+ 'default' => 'mail.ru'
476
+ ),
477
+
478
+ );
479
 
480
+ $security_settings = apply_filters( 'ig_es_registered_security_settings', $security_settings );
481
 
482
+ $es_settings = array(
483
+ 'general' => $general_settings,
484
+ 'signup_confirmation' => $signup_confirmation_settings,
485
+ 'email_sending' => $email_sending_settings,
486
+ 'security_settings' => $security_settings
487
  );
488
 
489
  return apply_filters( 'ig_es_registered_settings', $es_settings );
619
  $html .= '<input type="hidden" name="submit_action" value="ig-es-save-admin-settings"/>';
620
  $nonce = wp_create_nonce( 'es-update-settings' );
621
  $html .= '<input type="hidden" name="update-settings" id="ig-update-settings" value="' . $nonce . '"/>';
622
+ $html .= '<input type="submit" name="submit" id="submit" class="button button-primary" value="' . __( 'Save Settings', 'email-subscribers' ) . '">';
623
  $html .= "</td></tr>";
624
  $html .= "</tbody>";
625
  $html .= "</table>";
627
 
628
  }
629
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
630
 
 
 
 
631
 
632
  }
includes/admin/class-es-form-widget.php CHANGED
@@ -31,19 +31,26 @@ class ES_Form_Widget extends WP_Widget {
31
  $form_data = ES_Forms_Table::get_form_data_from_body( $form );
32
  }
33
 
34
- $name_visible = ( ! empty( $form_data['name_visible'] ) && 'yes' === $form_data['name_visible'] ) ? 'yes' : '';
35
- $name_required = ( ! empty( $form_data['name_required'] ) && 'yes' === $form_data['name_required'] ) ? 'yes' : '';
36
- $list_visible = ( ! empty( $form_data['list_visible'] ) && 'yes' === $form_data['list_visible'] ) ? 'yes' : '';
37
- $lists = ( ! empty( $form_data['lists'] ) ) ? $form_data['lists'] : array();
38
- $desc = ( ! empty( $form_data['desc'] ) ) ? $form_data['desc'] : '';
39
 
40
- $data['name_visible'] = $name_visible;
 
 
 
 
 
 
 
 
 
41
  $data['name_required'] = $name_required;
42
- $data['form_id'] = $form_id;
43
- $data['list_visible'] = $list_visible;
44
- $data['lists'] = $lists;
45
- $data['list'] = '';
46
- $data['desc'] = $desc;
 
 
 
47
 
48
  ES_Shortcode::render_form( $data );
49
 
31
  $form_data = ES_Forms_Table::get_form_data_from_body( $form );
32
  }
33
 
 
 
 
 
 
34
 
35
+ $name_visible = ( ! empty( $form_data['name_visible'] ) && 'yes' === $form_data['name_visible'] ) ? 'yes' : '';
36
+ $name_required = ( ! empty( $form_data['name_required'] ) && 'yes' === $form_data['name_required'] ) ? 'yes' : '';
37
+ $list_visible = ( ! empty( $form_data['list_visible'] ) && 'yes' === $form_data['list_visible'] ) ? 'yes' : '';
38
+ $lists = ( ! empty( $form_data['lists'] ) ) ? $form_data['lists'] : array();
39
+ $desc = ( ! empty( $form_data['desc'] ) ) ? $form_data['desc'] : '';
40
+ $name_label = ( ! empty( $form_data['name_label'] ) ) ? $form_data['name_label'] : '';
41
+ $email_label = ( ! empty( $form_data['email_label'] ) ) ? $form_data['email_label'] : '';
42
+ $button_label = ( ! empty( $form_data['button_label'] ) ) ? $form_data['button_label'] : '';
43
+
44
+ $data['name_visible'] = $name_visible;
45
  $data['name_required'] = $name_required;
46
+ $data['form_id'] = $form_id;
47
+ $data['list_visible'] = $list_visible;
48
+ $data['lists'] = $lists;
49
+ $data['list'] = '';
50
+ $data['desc'] = $desc;
51
+ $data['name_label'] = $name_label;
52
+ $data['email_label'] = $email_label;
53
+ $data['button_label'] = $button_label;
54
 
55
  ES_Shortcode::render_form( $data );
56
 
includes/admin/class-es-forms-table.php CHANGED
@@ -210,6 +210,9 @@ class ES_Forms_Table extends WP_List_Table {
210
  $form_data['name'] = ! empty( $data['name'] ) ? $data['name'] : '';
211
  $form_data['name_visible'] = ! empty( $data['name_visible'] ) ? $data['name_visible'] : 'no';
212
  $form_data['name_required'] = ! empty( $data['name_required'] ) ? $data['name_required'] : 'no';
 
 
 
213
  $form_data['list_visible'] = ! empty( $data['list_visible'] ) ? $data['list_visible'] : 'no';
214
  $form_data['lists'] = ! empty( $data['lists'] ) ? $data['lists'] : array();
215
  $form_data['af_id'] = ! empty( $data['af_id'] ) ? $data['af_id'] : 0;
@@ -264,14 +267,16 @@ class ES_Forms_Table extends WP_List_Table {
264
  <td>
265
  <table class="">
266
  <tr class="form-field">
267
- <td><?php _e( 'Field', 'email-subscribers' ); ?></td>
268
- <td><?php _e( 'Show?', 'email-subscribers' ); ?></td>
269
- <td><?php _e( 'Required?', 'email-subscribers' ); ?></td>
 
270
  </tr>
271
  <tr class="form-field">
272
  <td><?php _e( 'Email', 'email-subscribers' ); ?></td>
273
  <td><input type="checkbox" class="" name="form_data[email_visible]" value="yes" disabled="disabled" checked="checked"></td>
274
  <td><input type="checkbox" class="" name="form_data[email_required]" value="yes" disabled="disabled" checked="checked"></td>
 
275
  </tr>
276
  <tr class="form-field">
277
  <td><?php _e( 'Name', 'email-subscribers' ); ?></td>
@@ -281,6 +286,13 @@ class ES_Forms_Table extends WP_List_Table {
281
  <td><input type="checkbox" class="es_required" name="form_data[name_required]" value="yes" <?php if ( $form_data['name_required'] === 'yes' ) {
282
  echo 'checked=checked';
283
  } ?>></td>
 
 
 
 
 
 
 
284
  </tr>
285
  </table>
286
  </td>
@@ -334,10 +346,11 @@ class ES_Forms_Table extends WP_List_Table {
334
  $message = __( sprintf( 'List(s) not found. Please create a first list from <a href="%s">here</a>', $lists_page_url ), 'email-subscribers' );
335
  $status = 'error';
336
  $this->show_message( $message, $status );
337
- }
338
  $url = 'https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=es_form_captcha&utm_campaign=es_upsale';
339
  ?>
340
- <div style=" background-image: linear-gradient(-100deg, rgba(250, 247, 133, 0.4), rgba(250, 247, 133, 0.8) 95%, rgba(250, 247, 133, 0.2)); padding: 10px; width: 35%; border-radius: 1em 0 1em 0; "><?php echo sprintf( __('Secure you form and avoid spam signups with Email Subscribers Starter Plan <a target="_blank" style="font-weight: bold; cursor:pointer; text-decoration:none" href="%s">Get started</a>', 'email-subscribers'), $url)?></div>
 
341
  </form>
342
  </div>
343
  </div>
@@ -370,6 +383,9 @@ class ES_Forms_Table extends WP_List_Table {
370
  $form_data = array();
371
  $name = ! empty( $data['name'] ) ? $data['name'] : '';
372
  $desc = ! empty( $data['desc'] ) ? $data['desc'] : '';
 
 
 
373
  $name_visible = ( ! empty( $data['name_visible'] ) && $data['name_visible'] === 'yes' ) ? true : false;
374
  $name_required = ( ! empty( $data['name_required'] ) && $data['name_required'] === 'yes' ) ? true : false;
375
  $list_visible = ( ! empty( $data['list_visible'] ) && $data['list_visible'] === 'yes' ) ? true : false;
@@ -383,7 +399,7 @@ class ES_Forms_Table extends WP_List_Table {
383
  'name' => 'Name',
384
  'id' => 'name',
385
  'params' => array(
386
- 'label' => 'Name',
387
  'show' => $name_visible,
388
  'required' => $name_required
389
  ),
@@ -396,7 +412,7 @@ class ES_Forms_Table extends WP_List_Table {
396
  'name' => 'Email',
397
  'id' => 'email',
398
  'params' => array(
399
- 'label' => 'Email',
400
  'show' => true,
401
  'required' => true
402
  ),
@@ -423,8 +439,9 @@ class ES_Forms_Table extends WP_List_Table {
423
  'name' => 'submit',
424
  'id' => 'submit',
425
  'params' => array(
426
- 'label' => 'Submit',
427
- 'show' => true
 
428
  ),
429
 
430
  'position' => 4
@@ -464,11 +481,16 @@ class ES_Forms_Table extends WP_List_Table {
464
  if ( $d['id'] === 'name' ) {
465
  $form_data['name_visible'] = ( $d['params']['show'] === true ) ? 'yes' : '';
466
  $form_data['name_required'] = ( $d['params']['required'] === true ) ? 'yes' : '';
 
467
  } elseif ( $d['id'] === 'lists' ) {
468
  $form_data['list_visible'] = ( $d['params']['show'] === true ) ? 'yes' : '';
469
  $form_data['list_required'] = ( $d['params']['required'] === true ) ? 'yes' : '';
470
  $form_data['lists'] = ! empty( $d['params']['values'] ) ? $d['params']['values'] : array();
471
- }
 
 
 
 
472
  }
473
 
474
  return $form_data;
@@ -778,7 +800,3 @@ class ES_Forms_Table extends WP_List_Table {
778
  return self::$instance;
779
  }
780
  }
781
-
782
- // add_action( 'admin_menu', function () {
783
- // ES_Forms_Table::get_instance();
784
- // } );
210
  $form_data['name'] = ! empty( $data['name'] ) ? $data['name'] : '';
211
  $form_data['name_visible'] = ! empty( $data['name_visible'] ) ? $data['name_visible'] : 'no';
212
  $form_data['name_required'] = ! empty( $data['name_required'] ) ? $data['name_required'] : 'no';
213
+ $form_data['name_label'] = ! empty( $data['name_label'] ) ? $data['name_label'] : '';
214
+ $form_data['email_label'] = ! empty( $data['email_label'] ) ? $data['email_label'] : '';
215
+ $form_data['button_label'] = ! empty( $data['button_label'] ) ? $data['button_label'] : __( 'Subscribe', 'email-subscribers' );
216
  $form_data['list_visible'] = ! empty( $data['list_visible'] ) ? $data['list_visible'] : 'no';
217
  $form_data['lists'] = ! empty( $data['lists'] ) ? $data['lists'] : array();
218
  $form_data['af_id'] = ! empty( $data['af_id'] ) ? $data['af_id'] : 0;
267
  <td>
268
  <table class="">
269
  <tr class="form-field">
270
+ <td><b><?php _e( 'Field', 'email-subscribers' ); ?></b></td>
271
+ <td><b><?php _e( 'Show?', 'email-subscribers' ); ?></b></td>
272
+ <td><b><?php _e( 'Required?', 'email-subscribers' ); ?></b></td>
273
+ <td><b><?php _e( 'Label', 'email-subscribers' ); ?></b></td>
274
  </tr>
275
  <tr class="form-field">
276
  <td><?php _e( 'Email', 'email-subscribers' ); ?></td>
277
  <td><input type="checkbox" class="" name="form_data[email_visible]" value="yes" disabled="disabled" checked="checked"></td>
278
  <td><input type="checkbox" class="" name="form_data[email_required]" value="yes" disabled="disabled" checked="checked"></td>
279
+ <!--<td><input type="text" class="" name="form_data[email_label]" value="<?php echo $form_data['email_label']; ?>"></td>-->
280
  </tr>
281
  <tr class="form-field">
282
  <td><?php _e( 'Name', 'email-subscribers' ); ?></td>
286
  <td><input type="checkbox" class="es_required" name="form_data[name_required]" value="yes" <?php if ( $form_data['name_required'] === 'yes' ) {
287
  echo 'checked=checked';
288
  } ?>></td>
289
+ <!-- <td> <input type="text" class="es_name_label" name="form_data[name_label]" value="<?php echo $form_data['name_label']; ?>" <?php if ( $form_data['name_required'] === 'yes' ) { echo 'disabled=disabled'; } ?> ></td>-->
290
+ </tr>
291
+ <tr class="form-field">
292
+ <td><?php _e( 'Button', 'email-subscribers' ); ?></td>
293
+ <td><input type="checkbox" class="" name="form_data[button_visible]" value="yes" disabled="disabled" checked="checked"></td>
294
+ <td><input type="checkbox" class="" name="form_data[button_required]" value="yes" disabled="disabled" checked="checked"></td>
295
+ <td><input type="text" class="" name="form_data[button_label]" value="<?php echo $form_data['button_label']; ?>"></td>
296
  </tr>
297
  </table>
298
  </td>
346
  $message = __( sprintf( 'List(s) not found. Please create a first list from <a href="%s">here</a>', $lists_page_url ), 'email-subscribers' );
347
  $status = 'error';
348
  $this->show_message( $message, $status );
349
+ }
350
  $url = 'https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=es_form_captcha&utm_campaign=es_upsale';
351
  ?>
352
+ <div style=" background-image: linear-gradient(-100deg, rgba(250, 247, 133, 0.4), rgba(250, 247, 133, 0.8) 95%, rgba(250, 247, 133, 0.2)); padding: 10px; width: 35%; border-radius: 1em 0 1em 0; "><?php echo sprintf( __( 'Secure you form and avoid spam signups with Email Subscribers Starter Plan <a target="_blank" style="font-weight: bold; cursor:pointer; text-decoration:none" href="%s">Get started</a>',
353
+ 'email-subscribers' ), $url ) ?></div>
354
  </form>
355
  </div>
356
  </div>
383
  $form_data = array();
384
  $name = ! empty( $data['name'] ) ? $data['name'] : '';
385
  $desc = ! empty( $data['desc'] ) ? $data['desc'] : '';
386
+ $email_label = ! empty( $data['email_label'] ) ? $data['email_label'] : '';
387
+ $name_label = ! empty( $data['name_label'] ) ? $data['name_label'] : '';
388
+ $button_label = ! empty( $data['button_label'] ) ? $data['button_label'] : '';
389
  $name_visible = ( ! empty( $data['name_visible'] ) && $data['name_visible'] === 'yes' ) ? true : false;
390
  $name_required = ( ! empty( $data['name_required'] ) && $data['name_required'] === 'yes' ) ? true : false;
391
  $list_visible = ( ! empty( $data['list_visible'] ) && $data['list_visible'] === 'yes' ) ? true : false;
399
  'name' => 'Name',
400
  'id' => 'name',
401
  'params' => array(
402
+ 'label' => $name_label,
403
  'show' => $name_visible,
404
  'required' => $name_required
405
  ),
412
  'name' => 'Email',
413
  'id' => 'email',
414
  'params' => array(
415
+ 'label' => $email_label,
416
  'show' => true,
417
  'required' => true
418
  ),
439
  'name' => 'submit',
440
  'id' => 'submit',
441
  'params' => array(
442
+ 'label' => $button_label,
443
+ 'show' => true,
444
+ 'required' => true
445
  ),
446
 
447
  'position' => 4
481
  if ( $d['id'] === 'name' ) {
482
  $form_data['name_visible'] = ( $d['params']['show'] === true ) ? 'yes' : '';
483
  $form_data['name_required'] = ( $d['params']['required'] === true ) ? 'yes' : '';
484
+ $form_data['name_label'] = !empty($d['params']['label']) ? $d['params']['label'] : '';
485
  } elseif ( $d['id'] === 'lists' ) {
486
  $form_data['list_visible'] = ( $d['params']['show'] === true ) ? 'yes' : '';
487
  $form_data['list_required'] = ( $d['params']['required'] === true ) ? 'yes' : '';
488
  $form_data['lists'] = ! empty( $d['params']['values'] ) ? $d['params']['values'] : array();
489
+ } elseif ($d['id'] === 'email') {
490
+ $form_data['email_label'] = !empty($d['params']['label']) ? $d['params']['label'] : '';
491
+ } elseif($d['id'] === 'submit') {
492
+ $form_data['button_label'] = !empty($d['params']['label']) ? $d['params']['label'] : '';
493
+ }
494
  }
495
 
496
  return $form_data;
800
  return self::$instance;
801
  }
802
  }
 
 
 
 
includes/admin/class-es-handle-subscription.php CHANGED
@@ -391,6 +391,8 @@ class ES_Handle_Subscription {
391
  'es_invalid_captcha' => __( 'Invalid Captcha', 'email-subscribers' )
392
  );
393
 
 
 
394
  if ( ! empty( $messages ) ) {
395
  return isset( $messages[ $message ] ) ? $messages[ $message ] : '';
396
  }
391
  'es_invalid_captcha' => __( 'Invalid Captcha', 'email-subscribers' )
392
  );
393
 
394
+ $messages = apply_filters( 'ig_es_subscription_messages', $messages );
395
+
396
  if ( ! empty( $messages ) ) {
397
  return isset( $messages[ $message ] ) ? $messages[ $message ] : '';
398
  }
includes/admin/class-es-handle-sync-wp-user.php CHANGED
@@ -2,33 +2,117 @@
2
 
3
  class ES_Handle_Sync_Wp_User {
4
 
 
 
5
  public function __construct() {
6
  add_action( 'admin_menu', array( $this, 'plugin_menu' ) );
 
7
  // Sync upcoming WordPress users
8
- add_action( 'user_register', array($this, 'sync_registered_wp_user' ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  }
10
 
11
  public function plugin_menu() {
12
  add_submenu_page( null, 'Sync', __( 'Sync', 'email-subscribers' ), get_option( 'es_roles_subscriber', true ), 'es_sync', array( $this, 'prepare_sync_user' ) );
13
  }
14
 
15
- public function sync_registered_wp_user( $user_id ){
16
  //get option
17
- $ig_es_sync_wp_users = get_option( 'ig_es_sync_wp_users', 'norecord' );
18
- $ig_es_sync_unserialized_data = maybe_unserialize($ig_es_sync_wp_users);
19
- $ig_es_registered = $ig_es_sync_unserialized_data['es_registered'];
20
- if( $ig_es_sync_wp_users != 'norecord' && 'YES' === $ig_es_registered) {
21
  $list_id = $ig_es_sync_unserialized_data['es_registered_group'];
22
  //get user info
23
- $user_info = get_userdata( $user_id );
24
- if( !($user_info instanceof WP_User) ) return false;
 
 
25
  $user_firstname = $user_info->display_name;
 
 
26
  $email = $user_info->user_email;
27
  if ( empty( $user_firstname ) ) {
28
  $user_firstname = ES_Common::get_name_from_email( $email );
29
  }
30
  //prepare data
31
- $data = array(
32
  'first_name' => $user_firstname,
33
  'email' => $email,
34
  'source' => 'wp',
@@ -37,35 +121,17 @@ class ES_Handle_Sync_Wp_User {
37
  'created_at' => ig_get_current_date_time(),
38
  'wp_user_id' => $user_id
39
  );
40
- $check = ES_DB_Contacts::is_subscriber_exist_in_list( $email, $list_id );
41
- if ( empty( $check['contact_id'] ) ) {
42
- $added = ES_DB_Contacts::add_subscriber( $data );
43
- } else {
44
- $added = $check['contact_id'];
45
- }
46
- if ( empty( $check['list_id'] ) ) {
47
- $optin_type = get_option( 'ig_es_optin_type', true );
48
- $optin_type = ( $optin_type === 'double_opt_in' ) ? 2 : 1;
49
- $list_id = ! empty( $list_id ) ? $list_id : 1;
50
- $list_contact_data = array(
51
- 'list_id' => array($list_id),
52
- 'contact_id' => $added,
53
- 'status' => 'subscribed',
54
- 'subscribed_at' => ig_get_current_date_time(),
55
- 'optin_type' => $optin_type,
56
- 'subscribed_ip' => null
57
- );
58
-
59
- $result = ES_DB_Lists_Contacts::add_lists_contacts( $list_contact_data );
60
- }
61
  }
 
62
  return true;
63
 
64
  }
65
 
66
- public function prepare_sync_user(){
67
- ?>
68
- <div class="wrap">
69
  <h2> <?php _e( 'Audience > Sync Contacts', 'email-subscribers' ); ?>
70
  <a href="admin.php?page=es_subscribers&action=new" class="page-title-action"><?php _e( 'Add New Contact', 'email-subscribers' ); ?></a>
71
  <a href="admin.php?page=es_subscribers&action=export" class="page-title-action"><?php _e( 'Export Contacts', 'email-subscribers' ); ?></a>
@@ -77,69 +143,45 @@ class ES_Handle_Sync_Wp_User {
77
  <?php
78
  }
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
- public function sync_users_callback(){
82
- if ( !empty( $_POST["es_sync_submit"] ) && 'yes' === $_POST["es_sync_submit"] ) {
83
- if( $_POST['es_registered_group'] == 0 ){
84
- $message = __( 'Please select List', 'email-subscribers' );
85
- $this->show_message( $message, 'error' );
86
- }
87
- $ig_es_sync_wp_users['es_registered'] = $_POST['es_registered'];
88
- $ig_es_sync_wp_users['es_registered_group'] = $_POST['es_registered_group'];
89
- update_option('ig_es_sync_wp_users', $ig_es_sync_wp_users);
90
- }
91
- $ig_es_sync_wp_users = get_option( 'ig_es_sync_wp_users', 'norecord' );
92
- if( $ig_es_sync_wp_users != 'norecord' && $ig_es_sync_wp_users != "") {
93
- $ig_es_sync_unserialized_data = maybe_unserialize($ig_es_sync_wp_users);
94
- $ig_es_registered = $ig_es_sync_unserialized_data['es_registered'];
95
- $ig_es_registered_list = $ig_es_sync_unserialized_data['es_registered_group'];
96
- }
97
  ?>
98
- <form name="form_sync" id="form_sync" method="post" action="#" >
99
- <table class="form-table">
100
- <tbody>
101
- <tr>
102
- <th scope="row">
103
- <label for="tag-image">
104
- <?php echo __( 'Sync newly registered users to subscribers list', 'email-subscribers' ); ?>
105
- </label>
106
- </th>
107
- <td>
108
- <select name="es_registered" id="es_email_status">
109
- <option value='NO' <?php if($ig_es_registered == 'NO') { echo "selected='selected'" ; } ?>><?php echo __( 'No', 'email-subscribers' ); ?></option>
110
- <option value='YES' <?php if($ig_es_registered == 'YES') { echo "selected='selected'" ; } ?>><?php echo __( 'Yes', 'email-subscribers' ); ?></option>
111
- </select>
112
- </td>
113
- </tr>
114
- <tr>
115
- <th>
116
- <label for="tag-display-status">
117
- <?php echo __( 'Select list to add newly registered users to', 'email-subscribers' ); ?>
118
- </label>
119
- </th>
120
- <td>
121
- <select name="es_registered_group">
122
- <?php echo ES_Common::prepare_list_dropdown_options( $ig_es_registered_list, 'Select Lists' ); ?>
123
- </select>
124
- </td>
125
- </tr>
126
- </tbody>
127
- </table>
128
- <input type="hidden" name="es_sync_submit" value="yes"/>
129
- <p style="padding-top:5px;">
130
- <input type="submit" class="button-primary" value="<?php echo __( 'Sync Now', 'email-subscribers' ); ?>" />
131
- </p>
132
- </form>
133
- <?php
134
- }
135
 
136
- public function show_message( $message = '', $status = 'success' ) {
 
137
 
138
- $class = 'notice notice-success is-dismissible';
139
- if ( 'error' === $status ) {
140
- $class = 'notice notice-error is-dismissible';
141
  }
142
- echo "<div class='{$class}'><p>{$message}</p></div>";
 
143
  }
144
 
145
  }
2
 
3
  class ES_Handle_Sync_Wp_User {
4
 
5
+ public static $instance;
6
+
7
  public function __construct() {
8
  add_action( 'admin_menu', array( $this, 'plugin_menu' ) );
9
+
10
  // Sync upcoming WordPress users
11
+ add_action( 'user_register', array( $this, 'sync_registered_wp_user' ) );
12
+ add_action( 'ig_es_sync_users_tabs_wordpress', array( $this, 'sync_wordpress_users_settings' ) );
13
+
14
+ }
15
+
16
+ public function sync_wordpress_users_settings() {
17
+
18
+ if ( ! empty( $_POST['submitted'] ) && 'submitted' === $_POST['submitted'] ) {
19
+ $form_data = $_POST['form_data'];
20
+
21
+ $error = false;
22
+ if ( ! empty( $form_data['es_registered'] ) && 'YES' === $form_data['es_registered'] ) {
23
+ $list_id = ! empty( $form_data['es_registered_group'] ) ? $form_data['es_registered_group'] : 0;
24
+ if ( $list_id === 0 ) {
25
+ $message = __( 'Please select list', 'email-subscribers' );
26
+ ES_Common::show_message( $message, 'error' );
27
+ $error = true;
28
+ }
29
+ }
30
+
31
+ if ( ! $error ) {
32
+ update_option( 'ig_es_sync_wp_users', $form_data );
33
+ $message = __( 'Settings have been saved successfully!', 'email-subscribers' );
34
+ ES_Common::show_message( $message, 'success' );
35
+ }
36
+ }
37
+
38
+ $default_form_data = array(
39
+ 'es_registered' => 'NO',
40
+ 'es_registered_group' => 0,
41
+ );
42
+
43
+ $form_data = get_option( 'ig_es_sync_wp_users', array() );
44
+ $form_data = wp_parse_args( $form_data, $default_form_data );
45
+
46
+ ?>
47
+
48
+ <table class="form-table">
49
+ <tbody>
50
+ <tr>
51
+ <th scope="row">
52
+ <label for="tag-image">
53
+ <?php echo __( 'Sync WordPress Users?', 'email-subscribers' ); ?>
54
+ </label>
55
+ <p class="description"><?php _e( "Whenever someone signup, it will automatically be added into selected list", 'email-subscribers' ); ?></p>
56
+ </th>
57
+ <td>
58
+ <select name="form_data[es_registered]" id="es_email_status">
59
+ <option value='NO' <?php if ( $form_data['es_registered'] == 'NO' ) {
60
+ echo "selected='selected'";
61
+ } ?>><?php echo __( 'No', 'email-subscribers' ); ?></option>
62
+ <option value='YES' <?php if ( $form_data['es_registered'] == 'YES' ) {
63
+ echo "selected='selected'";
64
+ } ?>><?php echo __( 'Yes', 'email-subscribers' ); ?></option>
65
+ </select>
66
+ </td>
67
+ </tr>
68
+ <tr>
69
+ <th>
70
+ <label for="tag-display-status">
71
+ <?php echo __( 'Select List', 'email-subscribers' ); ?>
72
+ </label>
73
+ <p class="description"><?php _e( "Select the list in which newly registered user will be subscribed to", 'email-subscribers' ); ?></p>
74
+ </th>
75
+ <td>
76
+ <select name="form_data[es_registered_group]">
77
+ <?php echo ES_Common::prepare_list_dropdown_options( $form_data['es_registered_group'], 'Select List' ); ?>
78
+ </select>
79
+ </td>
80
+ </tr>
81
+ </tbody>
82
+ </table>
83
+ <input type="hidden" name="submitted" value="submitted"/>
84
+ <p style="padding-top:5px;">
85
+ <input type="submit" class="button-primary" value="<?php echo __( 'Save Settings', 'email-subscribers' ); ?>"/>
86
+ </p>
87
+
88
+ <?php
89
  }
90
 
91
  public function plugin_menu() {
92
  add_submenu_page( null, 'Sync', __( 'Sync', 'email-subscribers' ), get_option( 'es_roles_subscriber', true ), 'es_sync', array( $this, 'prepare_sync_user' ) );
93
  }
94
 
95
+ public function sync_registered_wp_user( $user_id ) {
96
  //get option
97
+ $ig_es_sync_wp_users = get_option( 'ig_es_sync_wp_users', 'norecord' );
98
+ $ig_es_sync_unserialized_data = maybe_unserialize( $ig_es_sync_wp_users );
99
+ $ig_es_registered = $ig_es_sync_unserialized_data['es_registered'];
100
+ if ( $ig_es_sync_wp_users != 'norecord' && 'YES' === $ig_es_registered ) {
101
  $list_id = $ig_es_sync_unserialized_data['es_registered_group'];
102
  //get user info
103
+ $user_info = get_userdata( $user_id );
104
+ if ( ! ( $user_info instanceof WP_User ) ) {
105
+ return false;
106
+ }
107
  $user_firstname = $user_info->display_name;
108
+
109
+
110
  $email = $user_info->user_email;
111
  if ( empty( $user_firstname ) ) {
112
  $user_firstname = ES_Common::get_name_from_email( $email );
113
  }
114
  //prepare data
115
+ $data = array(
116
  'first_name' => $user_firstname,
117
  'email' => $email,
118
  'source' => 'wp',
121
  'created_at' => ig_get_current_date_time(),
122
  'wp_user_id' => $user_id
123
  );
124
+
125
+ do_action( 'ig_es_add_contact', $data, $list_id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
+
128
  return true;
129
 
130
  }
131
 
132
+ public function prepare_sync_user() {
133
+ ?>
134
+ <div class="wrap">
135
  <h2> <?php _e( 'Audience > Sync Contacts', 'email-subscribers' ); ?>
136
  <a href="admin.php?page=es_subscribers&action=new" class="page-title-action"><?php _e( 'Add New Contact', 'email-subscribers' ); ?></a>
137
  <a href="admin.php?page=es_subscribers&action=export" class="page-title-action"><?php _e( 'Export Contacts', 'email-subscribers' ); ?></a>
143
  <?php
144
  }
145
 
146
+ public function sync_users_callback() {
147
+
148
+ $logger = get_ig_logger();
149
+ $logger->trace( 'Sync Users' );
150
+ $active_tab = ! empty( $_GET['tab'] ) ? $_GET['tab'] : 'wordpress';
151
+
152
+ $tabs = array(
153
+ 'wordpress' => array(
154
+ 'name' => __( 'WordPress', 'email-subscribers' ),
155
+ 'url' => admin_url( 'admin.php?page=es_subscribers&action=sync&tab=wordpress' )
156
+ )
157
+ );
158
+
159
+ $tabs = apply_filters( 'ig_es_sync_users_tabs', $tabs );
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  ?>
162
+ <h2 class="nav-tab-wrapper">
163
+ <?php foreach ( $tabs as $key => $tab ) {
164
+ $tab_url = admin_url( 'admin.php?page=es_subscribers&action=sync' );
165
+ $tab_url = add_query_arg( 'tab', $key, $tab_url );
166
+ ?>
167
+ <a href="<?php echo esc_url( $tab_url ); ?>" class="nav-tab <?php echo $key === $active_tab ? 'nav-tab-active' : ''; ?>"><?php echo esc_html__( $tab['name'] ); ?></a>
168
+ <?php } ?>
169
+ </h2>
170
+ <form name="form_sync" id="form_sync" method="post" action="#">
171
+ <?php
172
+ $from = ! empty( $tabs[ $active_tab ]['from'] ) ? $tabs[ $active_tab ]['from'] . '_' : '';
173
+ do_action( $from . 'ig_es_sync_users_tabs_' . $active_tab ); ?>
174
+ </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
 
176
+ <?php
177
+ }
178
 
179
+ public static function get_instance() {
180
+ if ( ! isset( self::$instance ) ) {
181
+ self::$instance = new self();
182
  }
183
+
184
+ return self::$instance;
185
  }
186
 
187
  }
includes/admin/class-es-subscribers-table.php CHANGED
@@ -91,7 +91,7 @@ class ES_Subscribers_Table extends WP_List_Table {
91
  }
92
 
93
  public function load_sync() {
94
- $sync = new ES_Handle_Sync_Wp_User();
95
  $sync->prepare_sync_user();
96
  }
97
 
91
  }
92
 
93
  public function load_sync() {
94
+ $sync = ES_Handle_Sync_Wp_User::get_instance();
95
  $sync->prepare_sync_user();
96
  }
97
 
includes/class-email-subscribers.php CHANGED
@@ -295,6 +295,8 @@ class Email_Subscribers {
295
  // Main Admin Class
296
  'admin/class-email-subscribers-admin.php',
297
 
 
 
298
  );
299
 
300
  foreach ( $required_files as $file ) {
@@ -357,6 +359,8 @@ class Email_Subscribers {
357
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
358
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
359
  $this->loader->add_action( 'init', $plugin_public, 'es_email_subscribe_init' );
 
 
360
 
361
  }
362
 
295
  // Main Admin Class
296
  'admin/class-email-subscribers-admin.php',
297
 
298
+ 'includes/pro-features.php',
299
+
300
  );
301
 
302
  foreach ( $required_files as $file ) {
359
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
360
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
361
  $this->loader->add_action( 'init', $plugin_public, 'es_email_subscribe_init' );
362
+ $this->loader->add_action( 'ig_es_add_contact', $plugin_public, 'add_contact', 10, 2 );
363
+
364
 
365
  }
366
 
includes/class-es-common.php CHANGED
@@ -792,5 +792,17 @@ Class ES_Common {
792
  return trim( trim( $category, '##' ), '' );
793
  }
794
 
 
795
 
 
 
 
 
 
 
 
 
 
 
 
796
  }
792
  return trim( trim( $category, '##' ), '' );
793
  }
794
 
795
+ public static function show_message( $message = '', $status = 'success', $is_dismissible = true ) {
796
 
797
+ $class = 'notice notice-success';
798
+ if ( 'error' === $status ) {
799
+ $class = 'notice notice-error';
800
+ }
801
+
802
+ if($is_dismissible) {
803
+ $class .= ' is-dismissible';
804
+ }
805
+
806
+ echo "<div class='{$class}'><p>{$message}</p></div>";
807
+ }
808
  }
includes/class-es-install.php CHANGED
@@ -45,6 +45,7 @@ class ES_Install {
45
  'ig_es_update_3516_db_version'
46
  ),
47
 
 
48
  '4.0.0' => array(
49
  /**
50
  * - Create Tables
@@ -104,7 +105,7 @@ class ES_Install {
104
 
105
  '4.0.15' => array(
106
  'ig_es_update_4015_alter_blocked_emails_table',
107
- 'ig_es_update_4015_db_version'
108
  )
109
  );
110
 
@@ -147,10 +148,11 @@ class ES_Install {
147
  public static function install_actions() {
148
  if ( ! empty( $_GET['do_update_ig_es'] ) ) { // WPCS: input var ok.
149
  check_admin_referer( 'ig_es_db_update', 'ig_es_db_update_nonce' );
150
- $from_db_version = !empty($_GET['from_db_version']) ? $_GET['from_db_version'] : '';
151
 
152
- if(!empty($from_db_version)) {
153
  self::update_db_version( $from_db_version );
 
154
  }
155
 
156
  self::update();
@@ -213,6 +215,19 @@ class ES_Install {
213
 
214
  }
215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  private static function is_new_install() {
217
  return is_null( get_option( 'ig_es_db_version', null ) ) && is_null( get_option( 'current_sa_email_subscribers_db_version', null ) );
218
  }
@@ -852,7 +867,7 @@ class ES_Install {
852
  'name' => 'submit',
853
  'id' => 'submit',
854
  'params' => array(
855
- 'label' => 'Submit',
856
  'show' => true
857
  ),
858
 
45
  'ig_es_update_3516_db_version'
46
  ),
47
 
48
+
49
  '4.0.0' => array(
50
  /**
51
  * - Create Tables
105
 
106
  '4.0.15' => array(
107
  'ig_es_update_4015_alter_blocked_emails_table',
108
+ 'ig_es_update_4015_db_version',
109
  )
110
  );
111
 
148
  public static function install_actions() {
149
  if ( ! empty( $_GET['do_update_ig_es'] ) ) { // WPCS: input var ok.
150
  check_admin_referer( 'ig_es_db_update', 'ig_es_db_update_nonce' );
151
+ $from_db_version = ! empty( $_GET['from_db_version'] ) ? $_GET['from_db_version'] : '';
152
 
153
+ if ( ! empty( $from_db_version ) ) {
154
  self::update_db_version( $from_db_version );
155
+ self::delete_update_transient();
156
  }
157
 
158
  self::update();
215
 
216
  }
217
 
218
+ public static function delete_update_transient() {
219
+ global $wpdb;
220
+
221
+ $transient_like = $wpdb->esc_like( '_transient_ig_es_update_' ) . '%';
222
+ $updating_like = $wpdb->esc_like( '_transient_ig_es_updating' ) . '%';
223
+ $last_sent_queue_like = '%' . $wpdb->esc_like( '_last_sending_queue_batch_run' ) . '%';
224
+ $running_migration_queue_like = '%' . $wpdb->esc_like( '_running_migration_for_' ) . '%';
225
+
226
+ $query = "DELETE FROM {$wpdb->prefix}options WHERE option_name LIKE '{$transient_like}' OR option_name LIKE '{$updating_like}' OR option_name LIKE '{$last_sent_queue_like}' OR option_name LIKE '{$running_migration_queue_like}' ";
227
+
228
+ $wpdb->query( $query );
229
+ }
230
+
231
  private static function is_new_install() {
232
  return is_null( get_option( 'ig_es_db_version', null ) ) && is_null( get_option( 'current_sa_email_subscribers_db_version', null ) );
233
  }
867
  'name' => 'submit',
868
  'id' => 'submit',
869
  'params' => array(
870
+ 'label' => 'Subscribe',
871
  'show' => true
872
  ),
873
 
includes/db/class-es-db-forms.php CHANGED
@@ -176,7 +176,7 @@ class ES_DB_Forms {
176
  'name' => 'submit',
177
  'id' => 'submit',
178
  'params' => array(
179
- 'label' => 'Submit',
180
  'show' => true
181
  ),
182
 
176
  'name' => 'submit',
177
  'id' => 'submit',
178
  'params' => array(
179
+ 'label' => 'Subscribe',
180
  'show' => true
181
  ),
182
 
includes/db/class-es-db-sending-queue.php CHANGED
@@ -240,7 +240,7 @@ class ES_DB_Sending_Queue {
240
 
241
  $total_bataches = ( $total > IG_DEFAULT_BATCH_SIZE ) ? ceil( $total / $batch_size ) : 1;
242
 
243
- $last_sending_queue_batch_run = get_transient( 'last_sending_queue_batch_run' );
244
 
245
  if ( false === $last_sending_queue_batch_run ) {
246
  $batch_start_from = 0;
@@ -251,19 +251,17 @@ class ES_DB_Sending_Queue {
251
  $logger = get_ig_logger();
252
  $logger->info( 'Sending Queue Start From: ' . $batch_start_from, array( 'source' => 'es_update' ) );
253
 
254
-
255
  for ( $i = $batch_start_from; $i < $total_bataches; $i ++ ) {
 
256
 
257
- if ( false === get_transient( 'running_migration_for_' . $i ) ) {
258
-
259
- set_transient( 'running_migration_for_' . $i, true, 300 );
260
  $batch_start = $i * $batch_size;
261
 
262
  $query = "SELECT * FROM " . EMAIL_SUBSCRIBERS_STATS_TABLE . " LIMIT {$batch_start}, {$batch_size}";
 
263
  $results = $wpdb->get_results( $query, ARRAY_A );
264
  $values = $data = $place_holders = array();
265
  foreach ( $results as $key => $result ) {
266
-
267
  $email = $result['es_deliver_emailmail'];
268
  $is_opened = ( $result['es_deliver_viewdate'] != '0000-00-00 00:00:00' ) ? 1 : 0;
269
 
@@ -299,15 +297,109 @@ class ES_DB_Sending_Queue {
299
 
300
  $logger->info( '------------------[Running.....]: ' . $i, array( 'source' => 'es_update' ) );
301
  ES_DB::do_insert( IG_SENDING_QUEUE_TABLE, $fields, $place_holders, $values );
302
- delete_transient( 'running_migration_for_' . $i );
 
303
 
304
  $logger->info( '------------------[last_sending_queue_batch_run]: ' . $i, array( 'source' => 'es_update' ) );
305
- set_transient( 'last_sending_queue_batch_run', $i, MINUTE_IN_SECONDS * 100 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  }
307
 
308
  }
309
  }
310
  }
 
 
 
 
 
 
 
 
 
 
311
 
312
  public static function delete_sending_queue_by_mailing_id( $mailing_queue_ids ) {
313
  global $wpdb;
240
 
241
  $total_bataches = ( $total > IG_DEFAULT_BATCH_SIZE ) ? ceil( $total / $batch_size ) : 1;
242
 
243
+ $last_sending_queue_batch_run = get_transient( 'ig_es_last_sending_queue_batch_run'. false );
244
 
245
  if ( false === $last_sending_queue_batch_run ) {
246
  $batch_start_from = 0;
251
  $logger = get_ig_logger();
252
  $logger->info( 'Sending Queue Start From: ' . $batch_start_from, array( 'source' => 'es_update' ) );
253
 
 
254
  for ( $i = $batch_start_from; $i < $total_bataches; $i ++ ) {
255
+ if ( false === get_transient( 'ig_es_running_migration_for_' . $i ) ) {
256
 
257
+ set_transient( 'ig_es_running_migration_for_' . $i, true, 300 );
 
 
258
  $batch_start = $i * $batch_size;
259
 
260
  $query = "SELECT * FROM " . EMAIL_SUBSCRIBERS_STATS_TABLE . " LIMIT {$batch_start}, {$batch_size}";
261
+
262
  $results = $wpdb->get_results( $query, ARRAY_A );
263
  $values = $data = $place_holders = array();
264
  foreach ( $results as $key => $result ) {
 
265
  $email = $result['es_deliver_emailmail'];
266
  $is_opened = ( $result['es_deliver_viewdate'] != '0000-00-00 00:00:00' ) ? 1 : 0;
267
 
297
 
298
  $logger->info( '------------------[Running.....]: ' . $i, array( 'source' => 'es_update' ) );
299
  ES_DB::do_insert( IG_SENDING_QUEUE_TABLE, $fields, $place_holders, $values );
300
+
301
+ delete_transient( 'ig_es_running_migration_for_' . $i );
302
 
303
  $logger->info( '------------------[last_sending_queue_batch_run]: ' . $i, array( 'source' => 'es_update' ) );
304
+ set_transient( 'ig_es_last_sending_queue_batch_run', $i, MINUTE_IN_SECONDS * 100 );
305
+ }
306
+
307
+ }
308
+ }
309
+ }
310
+
311
+ /*
312
+ public static function migrate_reports_data() {
313
+ global $wpdb;
314
+
315
+ $mailing_queue_details = ES_DB_Mailing_Queue::get_id_details_map();
316
+ $email_details = ES_DB_Contacts::get_email_details_map();
317
+
318
+ $query = "SELECT count(*) as total FROM " . EMAIL_SUBSCRIBERS_STATS_TABLE;
319
+
320
+ $total = $wpdb->get_var( $query );
321
+
322
+ if ( $total > 0 ) {
323
+ $columns = self::get_columns();
324
+ unset( $columns['id'] );
325
+ $fields = array_keys( $columns );
326
+ $batch_size = IG_DEFAULT_BATCH_SIZE;
327
+
328
+ $total_bataches = ( $total > IG_DEFAULT_BATCH_SIZE ) ? ceil( $total / $batch_size ) : 1;
329
+
330
+ $logger = get_ig_logger();
331
+
332
+ for ( $i = 0; $i < $total_bataches; $i ++ ) {
333
+
334
+ if(false === get_transient('running_reports_migration_for')) {
335
+
336
+ set_transient( 'running_reports_migration_for', true, 300 );
337
+
338
+ $batch_start = 0;
339
+
340
+ $query = "SELECT * FROM " . EMAIL_SUBSCRIBERS_STATS_TABLE . " LIMIT {$batch_start}, {$batch_size}";
341
+ $results = $wpdb->get_results( $query, ARRAY_A );
342
+ $values = $data = $place_holders = array();
343
+ $es_delivery_ids = array();
344
+ foreach ( $results as $key => $result ) {
345
+
346
+ $es_delivery_ids[] = $result['es_deliver_id'];
347
+
348
+ $email = $result['es_deliver_emailmail'];
349
+ $is_opened = ( $result['es_deliver_viewdate'] != '0000-00-00 00:00:00' ) ? 1 : 0;
350
+
351
+ $contact_id = 0;
352
+ $hash = '';
353
+ if ( isset( $email_details[ $email ] ) ) {
354
+ $contact_id = $email_details[ $email ]['id'];
355
+ $hash = $email_details[ $email ]['hash'];
356
+ }
357
+
358
+ $mailing_queue_id = ! empty( $mailing_queue_details[ $result['es_deliver_sentguid'] ] ) ? $mailing_queue_details[ $result['es_deliver_sentguid'] ]['id'] : 0;
359
+ $start_at = ! empty( $mailing_queue_details[ $result['es_deliver_sentguid'] ] ) ? $mailing_queue_details[ $result['es_deliver_sentguid'] ]['start_at'] : '0000-00-00 00:00:00';
360
+ $data['mailing_queue_id'] = $mailing_queue_id;
361
+ $data['mailing_queue_hash'] = $result['es_deliver_sentguid'];
362
+ $data['contact_id'] = $contact_id;
363
+ $data['contact_hash'] = $hash;
364
+ $data['email'] = $email;
365
+ $data['status'] = $result['es_deliver_sentstatus'];
366
+ $data['opened'] = $is_opened;
367
+ $data['sent_at'] = $start_at;
368
+ $data['opened_at'] = $result['es_deliver_viewdate'];
369
+
370
+ $data = wp_parse_args( $data, self::get_column_defaults() );
371
+
372
+ $formats = array();
373
+ foreach ( $columns as $column => $format ) {
374
+ $values[] = $data[ $column ];
375
+ $formats[] = $format;
376
+ }
377
+
378
+ $place_holders[] = "( " . implode( ', ', $formats ) . " )";
379
+ }
380
+
381
+ $logger->info( '------------------[Running.....]: ' . $i, array( 'source' => 'es_update' ) );
382
+ ES_DB::do_insert( IG_SENDING_QUEUE_TABLE, $fields, $place_holders, $values );
383
+
384
+ $logger->info( '------------------[Deleting Records]: ', array( 'source' => 'es_update' ) );
385
+ self::delete_records_from_delivereport( $es_delivery_ids );
386
+ $logger->info( '------------------[Deleted]: ' . print_r($es_delivery_ids, true), array( 'source' => 'es_update' ) );
387
+ delete_transient( 'running_reports_migration_for' );
388
  }
389
 
390
  }
391
  }
392
  }
393
+ */
394
+ public static function delete_records_from_delivereport( $ids ) {
395
+ global $wpdb;
396
+
397
+ $delivereport_ids = implode( ',', array_map( 'absint', $ids ) );
398
+
399
+ $query = "DELETE FROM " . EMAIL_SUBSCRIBERS_STATS_TABLE . " WHERE es_deliver_id IN ($delivereport_ids)";
400
+
401
+ $wpdb->query( $query );
402
+ }
403
 
404
  public static function delete_sending_queue_by_mailing_id( $mailing_queue_ids ) {
405
  global $wpdb;
includes/pro-features.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_filter( 'ig_es_registered_settings', 'ig_es_add_upsale', 10, 2 );
4
+
5
+ // Add additional tab in Audience > Sync
6
+ add_filter('ig_es_sync_users_tabs', 'ig_es_add_comments_tab', 11, 1);
7
+
8
+ add_action( 'ig_es_sync_users_tabs_comments', 'ig_es_add_comments_tab_settings' );
9
+
10
+ function ig_es_add_upsale( $fields ) {
11
+
12
+ $active_plugins = (array) get_option( 'active_plugins', array() );
13
+ if ( is_multisite() ) {
14
+ $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
15
+ }
16
+
17
+ if ( ! ( in_array( 'email-subscribers-premium/email-subscribers-premium.php', $active_plugins ) || array_key_exists( 'email-subscribers-premium/email-subscribers-premium.php', $active_plugins ) ) ) {
18
+
19
+ // Security settings
20
+ $field_security['es_upsale_security'] = array(
21
+ 'id' => 'ig_es_blocked_domains',
22
+ 'type' => 'html',
23
+ 'name' => '',
24
+ 'html' => '<div class="es-upsale-image" style=""><a target="_blank" href="https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=es_security_settings&utm_campaign=es_upsale"><img src="' . EMAIL_SUBSCRIBERS_URL . '/admin/images/es-captcha-2.png' . '"/></a></div>'
25
+ );
26
+ $fields['security_settings'] = array_merge( $fields['security_settings'], $field_security );
27
+
28
+ // SMTP settings
29
+ $field_smtp['es_upsale_smtp'] = array(
30
+ 'id' => 'ig_es_blocked_domains',
31
+ 'type' => 'html',
32
+ 'name' => '<div class="es-smtp-label" style=""><a target="_blank" href="https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=es_security_settings&utm_campaign=es_upsale"><img src="' . EMAIL_SUBSCRIBERS_URL . '/admin/images/es-smtp-label.png' . '"/></a></div>',
33
+ 'html' => '<div class="es-upsale-image es-smtp-image" style=""><a target="_blank" href="https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=es_security_settings&utm_campaign=es_upsale"><img src="' . EMAIL_SUBSCRIBERS_URL . '/admin/images/es-smtp.png' . '"/></a></div>'
34
+ );
35
+ $fields['email_sending'] = array_merge( $fields['email_sending'], $field_smtp );
36
+
37
+ }
38
+
39
+ return $fields;
40
+ }
41
+
42
+ function ig_es_add_comments_tab( $tabs ) {
43
+ $tabs['comments'] = array(
44
+ 'name' => __('Comments', 'email-subscribers')
45
+ );
46
+ return $tabs;
47
+ }
48
+
49
+ function ig_es_add_comments_tab_settings() {
50
+ ?>
51
+ <a target="_blank" href="https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=es_comment_upsale&utm_campaign=es_upsale">
52
+ <img src=" <?php echo EMAIL_SUBSCRIBERS_URL . '/admin/images/es-comments.png' ?> "/>
53
+ </a>
54
+ <?php
55
+ }
56
+
57
+
58
+
includes/upgrade/es-update-functions.php CHANGED
@@ -507,11 +507,14 @@ function ig_es_update_400_migrate_notifications() {
507
  }
508
 
509
  function ig_es_update_400_migrate_reports_data() {
 
 
510
  /**
511
  * - Migrate individual notification data from es_deliverreport to ig_es_sending_queue table
512
  * es_deliverreport => ig_es_sending_queue
513
  */
514
  ES_DB_Sending_Queue::migrate_reports_data();
 
515
  }
516
 
517
  function ig_es_update_400_migrate_group_selectors_forms() {
507
  }
508
 
509
  function ig_es_update_400_migrate_reports_data() {
510
+
511
+ @ini_set('max_execution_time', 0);
512
  /**
513
  * - Migrate individual notification data from es_deliverreport to ig_es_sending_queue table
514
  * es_deliverreport => ig_es_sending_queue
515
  */
516
  ES_DB_Sending_Queue::migrate_reports_data();
517
+
518
  }
519
 
520
  function ig_es_update_400_migrate_group_selectors_forms() {
public/class-email-subscribers-public.php CHANGED
@@ -48,10 +48,11 @@ class Email_Subscribers_Public {
48
  /**
49
  * Initialize the class and set its properties.
50
  *
 
 
 
51
  * @since 4.0
52
  *
53
- * @param string $email_subscribers The name of the plugin.
54
- * @param string $version The version of this plugin.
55
  */
56
  public function __construct( $email_subscribers, $version ) {
57
 
@@ -133,13 +134,13 @@ class Email_Subscribers_Public {
133
  new ES_Cron();
134
  new ES_Handle_Subscription();
135
  new ES_Shortcode();
136
-
137
  $option = ! empty( $_REQUEST['es'] ) ? $_REQUEST['es'] : '';
138
  $db_id = ! empty( $_REQUEST['db'] ) ? $_REQUEST['db'] : '';
139
  $email = ! empty( $_REQUEST['email'] ) ? $_REQUEST['email'] : '';
140
  $guid = ! empty( $_REQUEST['guid'] ) ? $_REQUEST['guid'] : '';
141
 
142
- $email = str_replace(' ', '+', $email);
143
 
144
  if ( ! empty( $option ) ) {
145
  if ( ( 'optin' === $option || 'unsubscribe' === $option ) && ! empty( $db_id ) ) {
@@ -199,4 +200,33 @@ class Email_Subscribers_Public {
199
 
200
  }
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
48
  /**
49
  * Initialize the class and set its properties.
50
  *
51
+ * @param string $email_subscribers The name of the plugin.
52
+ * @param string $version The version of this plugin.
53
+ *
54
  * @since 4.0
55
  *
 
 
56
  */
57
  public function __construct( $email_subscribers, $version ) {
58
 
134
  new ES_Cron();
135
  new ES_Handle_Subscription();
136
  new ES_Shortcode();
137
+
138
  $option = ! empty( $_REQUEST['es'] ) ? $_REQUEST['es'] : '';
139
  $db_id = ! empty( $_REQUEST['db'] ) ? $_REQUEST['db'] : '';
140
  $email = ! empty( $_REQUEST['email'] ) ? $_REQUEST['email'] : '';
141
  $guid = ! empty( $_REQUEST['guid'] ) ? $_REQUEST['guid'] : '';
142
 
143
+ $email = str_replace( ' ', '+', $email );
144
 
145
  if ( ! empty( $option ) ) {
146
  if ( ( 'optin' === $option || 'unsubscribe' === $option ) && ! empty( $db_id ) ) {
200
 
201
  }
202
 
203
+ public function add_contact( $contact_data, $list_id ) {
204
+
205
+ $email = $contact_data['email'];
206
+
207
+ $contact = ES_DB_Contacts::is_subscriber_exist_in_list( $email, $list_id );
208
+ if ( empty( $contact['contact_id'] ) ) {
209
+ $contact_id = ES_DB_Contacts::add_subscriber( $contact_data );
210
+ } else {
211
+ $contact_id = $contact['contact_id'];
212
+ }
213
+
214
+ if ( empty( $contact['list_id'] ) ) {
215
+ $optin_type = get_option( 'ig_es_optin_type', true );
216
+ $optin_type = ( $optin_type === 'double_opt_in' ) ? 2 : 1;
217
+ $list_id = ! empty( $list_id ) ? $list_id : 1;
218
+ $list_contact_data = array(
219
+ 'list_id' => array( $list_id ),
220
+ 'contact_id' => $contact_id,
221
+ 'status' => 'subscribed',
222
+ 'subscribed_at' => ig_get_current_date_time(),
223
+ 'optin_type' => $optin_type,
224
+ 'subscribed_ip' => null
225
+ );
226
+
227
+ $result = ES_DB_Lists_Contacts::add_lists_contacts( $list_contact_data );
228
+ }
229
+
230
+ }
231
+
232
  }
public/partials/class-es-shortcode.php CHANGED
@@ -47,7 +47,7 @@ class ES_Shortcode {
47
  $data['desc'] = $atts['desc'];
48
 
49
  self::render_form( $data );
50
-
51
  return ob_get_clean();
52
  }
53
 
@@ -90,6 +90,7 @@ class ES_Shortcode {
90
  $form = ES_DB_Forms::get_form_by_af_id( $af_id );
91
  if ( $form ) {
92
  $form_data = ES_Forms_Table::get_form_data_from_body( $form );
 
93
  self::render_form( $form_data );
94
  }
95
  }
@@ -116,17 +117,20 @@ class ES_Shortcode {
116
  $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
117
  }
118
 
119
- $show_name = ! empty( $data['name_visible'] ) ? strtolower($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'] : '';
 
 
 
126
  //replace total contact
127
- $total_contacts = ES_DB_Contacts::count_active_subscribers_by_list_id();
128
- $desc = str_replace( "{{TOTAL-CONTACTS}}", $total_contacts, $desc );
129
-
130
  $current_page = get_the_ID();
131
  $current_page_url = get_the_permalink( get_the_ID() );
132
 
@@ -136,8 +140,7 @@ class ES_Shortcode {
136
 
137
  // Name
138
  $name_html = '';
139
- $name_place_holder = __('Enter Name', 'email-subscribers');
140
- if ( !empty($show_name) && 'no' !== $show_name ) {
141
  $name_label = ( 'yes' === $required_name ) ? __( 'Name', 'email-subscribers' ) . '*' : __( 'Name', 'email-subscribers' );
142
  $required = ( 'yes' === $required_name ) ? 'required' : '';
143
  $name_html = '<div class="es-field-wrap"><label>' . $name_label . '<br/><input type="text" name="name" placeholder="' . $name_place_holder . '" value="" ' . $required . '/></label></div>';
@@ -168,12 +171,11 @@ class ES_Shortcode {
168
  // Form html
169
  $form_html = '<input type="hidden" name="form_id" value="' . $form_id . '" />';
170
 
171
- $email_place_holder = __('Enter Email Address', 'email-subscribers');
172
- $email_html = '<div class="es-field-wrap"><label>' . __( 'Email', 'email-subscribers' ) . '*'. '<br/><input class="es_required_field es_txt_email" type="email" name="email" value="" placeholder="' . $email_place_holder .'" required/></label></div>';
173
  ?>
174
 
175
  <div class="emaillist">
176
- <form action="#" method="post" class="es_subscription_form es_shortcode_form" id="es_subscription_form_<?php echo $unique_id; ?>" data-source="ig-es" >
177
  <?php if ( $desc != "" ) { ?>
178
  <div class="es_caption"><?php echo $desc; ?></div>
179
  <?php } ?>
@@ -191,7 +193,7 @@ class ES_Shortcode {
191
  <?php if ( ( in_array( 'gdpr/gdpr.php', $active_plugins ) || array_key_exists( 'gdpr/gdpr.php', $active_plugins ) ) ) {
192
  echo GDPR::consent_checkboxes();
193
  } ?>
194
- <input type="submit" name="submit" class="es_subscription_form_submit es_submit_button es_textbox_button" id="es_subscription_form_submit_<?php echo $unique_id; ?>" value="<?php _e( 'Subscribe', 'email-subscribers' ) ?>"/>
195
 
196
 
197
  <?php $spinner_image_path = plugin_dir_url( ES_PLUGIN_BASE_NAME ) . 'public/images/spinner.gif'; ?>
@@ -215,11 +217,11 @@ class ES_Shortcode {
215
  $status_span = '';
216
  if ( in_array( $list_id, $list_ids ) ) {
217
  if ( in_array( $list_id, $selected_lists ) ) {
218
- if( !empty( $contact_id )){
219
  $list_contact_status_map = ES_DB_Lists_Contacts::get_list_contact_status_map( $contact_id );
220
- $status_span = '<span class="es_list_contact_status '.$list_contact_status_map[$list_id].'" title="'.ucwords($list_contact_status_map[$list_id]).'">';
221
  }
222
- $lists_html .= '<td>'.$status_span.'<label><input type="checkbox" name="lists[]" checked="checked" value="' . $list_id . '" />' . $list_name . '</label></td>';
223
  } else {
224
  $lists_html .= '<td><label><input type="checkbox" name="lists[]" value="' . $list_id . '" />' . $list_name . '</label></td>';
225
  }
47
  $data['desc'] = $atts['desc'];
48
 
49
  self::render_form( $data );
50
+
51
  return ob_get_clean();
52
  }
53
 
90
  $form = ES_DB_Forms::get_form_by_af_id( $af_id );
91
  if ( $form ) {
92
  $form_data = ES_Forms_Table::get_form_data_from_body( $form );
93
+
94
  self::render_form( $form_data );
95
  }
96
  }
117
  $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
118
  }
119
 
120
+ $show_name = ! empty( $data['name_visible'] ) ? strtolower( $data['name_visible'] ) : false;
121
+ $required_name = ! empty( $data['name_required'] ) ? $data['name_required'] : false;
122
+ $name_place_holder = ! empty( $data['name_label'] ) ? $data['name_label'] : '';
123
+ $email_label = ! empty( $data['email_label'] ) ? $data['email_label'] : '';
124
+ $button_label = ! empty( $data['button_label'] ) ? $data['button_label'] : __( 'Subscribe', 'email-subscribers' );
125
+ $show_list = ! empty( $data['list_visible'] ) ? $data['list_visible'] : false;
126
+ $list_ids = ! empty( $data['lists'] ) ? $data['lists'] : array();
127
+ $form_id = ! empty( $data['form_id'] ) ? $data['form_id'] : 0;
128
+ $list = ! empty( $data['list'] ) ? $data['list'] : 0;
129
+ $desc = ! empty( $data['desc'] ) ? $data['desc'] : '';
130
  //replace total contact
131
+ $total_contacts = ES_DB_Contacts::count_active_subscribers_by_list_id();
132
+ $desc = str_replace( "{{TOTAL-CONTACTS}}", $total_contacts, $desc );
133
+
134
  $current_page = get_the_ID();
135
  $current_page_url = get_the_permalink( get_the_ID() );
136
 
140
 
141
  // Name
142
  $name_html = '';
143
+ if ( ! empty( $show_name ) && 'no' !== $show_name ) {
 
144
  $name_label = ( 'yes' === $required_name ) ? __( 'Name', 'email-subscribers' ) . '*' : __( 'Name', 'email-subscribers' );
145
  $required = ( 'yes' === $required_name ) ? 'required' : '';
146
  $name_html = '<div class="es-field-wrap"><label>' . $name_label . '<br/><input type="text" name="name" placeholder="' . $name_place_holder . '" value="" ' . $required . '/></label></div>';
171
  // Form html
172
  $form_html = '<input type="hidden" name="form_id" value="' . $form_id . '" />';
173
 
174
+ $email_html = '<div class="es-field-wrap"><label>' . __( 'Email', 'email-subscribers' ) . '*' . '<br/><input class="es_required_field es_txt_email" type="email" name="email" value="" placeholder="' . $email_label . '" required/></label></div>';
 
175
  ?>
176
 
177
  <div class="emaillist">
178
+ <form action="#" method="post" class="es_subscription_form es_shortcode_form" id="es_subscription_form_<?php echo $unique_id; ?>" data-source="ig-es">
179
  <?php if ( $desc != "" ) { ?>
180
  <div class="es_caption"><?php echo $desc; ?></div>
181
  <?php } ?>
193
  <?php if ( ( in_array( 'gdpr/gdpr.php', $active_plugins ) || array_key_exists( 'gdpr/gdpr.php', $active_plugins ) ) ) {
194
  echo GDPR::consent_checkboxes();
195
  } ?>
196
+ <input type="submit" name="submit" class="es_subscription_form_submit es_submit_button es_textbox_button" id="es_subscription_form_submit_<?php echo $unique_id; ?>" value="<?php echo $button_label; ?>"/>
197
 
198
 
199
  <?php $spinner_image_path = plugin_dir_url( ES_PLUGIN_BASE_NAME ) . 'public/images/spinner.gif'; ?>
217
  $status_span = '';
218
  if ( in_array( $list_id, $list_ids ) ) {
219
  if ( in_array( $list_id, $selected_lists ) ) {
220
+ if ( ! empty( $contact_id ) ) {
221
  $list_contact_status_map = ES_DB_Lists_Contacts::get_list_contact_status_map( $contact_id );
222
+ $status_span = '<span class="es_list_contact_status ' . $list_contact_status_map[ $list_id ] . '" title="' . ucwords( $list_contact_status_map[ $list_id ] ) . '">';
223
  }
224
+ $lists_html .= '<td>' . $status_span . '<label><input type="checkbox" name="lists[]" checked="checked" value="' . $list_id . '" />' . $list_name . '</label></td>';
225
  } else {
226
  $lists_html .= '<td><label><input type="checkbox" name="lists[]" value="' . $list_id . '" />' . $list_name . '</label></td>';
227
  }
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.1
8
- Stable tag: 4.0.18
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
@@ -301,6 +301,9 @@ Use our free plugin [Email Subscribers - Group Selector](https://wordpress.org/p
301
 
302
  == Changelog ==
303
 
 
 
 
304
  = 4.0.18 (07.05.2019) =
305
  * New : Added a feature to duplicate any template
306
  * New : Added support to re run database migration from ES 3.5.18
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.1
8
+ Stable tag: 4.1
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
301
 
302
  == Changelog ==
303
 
304
+ = 4.1 (14.05.2019) =
305
+ * New: Now, able to change the label of "Subscribe" button
306
+
307
  = 4.0.18 (07.05.2019) =
308
  * New : Added a feature to duplicate any template
309
  * New : Added support to re run database migration from ES 3.5.18