Email Subscribers & Newsletters - Version 4.1.1

Version Description

(21.05.2019) = * Fix: "Oops.. Unexpected error occurred" while subscribing * Fix: Typo in "Campaigns > Edit Post Notification" title * Fix: Duplicate lists while syncing WordPress users

Download this release

Release Info

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

Code changes from version 4.1 to 4.1.1

Files changed (35) hide show
  1. admin/class-email-subscribers-admin.php +95 -6
  2. admin/css/email-subscribers-admin.css +288 -16
  3. admin/images/es-comments.png +0 -0
  4. admin/images/woocommerce-sync.png +0 -0
  5. admin/js/email-subscribers-admin.js +46 -1
  6. admin/js/es-onboarding.js +61 -0
  7. admin/js/mycustom.js +0 -8
  8. admin/partials/dashboard.php +18 -52
  9. admin/partials/help.php +20 -6
  10. admin/partials/onboarding.php +106 -0
  11. email-subscribers.php +4 -3
  12. includes/admin/class-es-campaigns-table.php +7 -18
  13. includes/admin/class-es-export-subscribers.php +9 -15
  14. includes/admin/class-es-forms-table.php +10 -19
  15. includes/admin/class-es-handle-subscription.php +13 -7
  16. includes/admin/class-es-handle-sync-wp-user.php +26 -7
  17. includes/admin/class-es-import-subscribers.php +18 -19
  18. includes/admin/class-es-lists-table.php +13 -22
  19. includes/admin/class-es-newsletters.php +3 -12
  20. includes/admin/class-es-post-notifications.php +6 -16
  21. includes/admin/class-es-reports-table.php +6 -15
  22. includes/admin/class-es-subscribers-table.php +89 -34
  23. includes/admin/class-es-tools.php +8 -6
  24. includes/class-email-subscribers.php +24 -4
  25. includes/class-es-common.php +77 -5
  26. includes/class-es-install.php +40 -13
  27. includes/class-es-mailer.php +3 -3
  28. includes/es-core-functions.php +1 -1
  29. includes/feedback/class-ig-deactivation-survey.php +331 -0
  30. includes/feedback/class-ig-feedback-v-1-0-0.php +212 -0
  31. includes/feedback/class-ig-tracker.php +191 -0
  32. includes/pro-features.php +87 -11
  33. includes/upgrade/es-update-functions.php +14 -1
  34. public/class-email-subscribers-public.php +2 -0
  35. readme.txt +7 -2
admin/class-email-subscribers-admin.php CHANGED
@@ -67,6 +67,8 @@ class Email_Subscribers_Admin {
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
  }
72
 
@@ -148,6 +150,7 @@ class Email_Subscribers_Admin {
148
  return;
149
  }
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() {
@@ -195,7 +198,9 @@ class Email_Subscribers_Admin {
195
  // Function for Klawoo's Subscribe form on Help & Info page
196
  public static function klawoo_subscribe() {
197
  $url = 'http://app.klawoo.com/subscribe';
198
-
 
 
199
  if ( ! empty( $_POST ) ) {
200
  $params = $_POST;
201
  } else {
@@ -281,14 +286,32 @@ class Email_Subscribers_Admin {
281
  $preview->es_template_preview_callback();
282
  }
283
 
284
- public function do_send( $data ) {
 
 
 
 
 
 
285
 
286
  $to_email = $data['to_email'];
287
  $subject = $data['subject'];
288
  $email_template = $data['email_template'];
289
  $headers = $data['headers'];
290
 
291
- wp_mail( $to_email, $subject, $email_template, $headers );
 
 
 
 
 
 
 
 
 
 
 
 
292
  }
293
 
294
  function submenu_order( $menu_order ) {
@@ -335,15 +358,19 @@ class Email_Subscribers_Admin {
335
  $es_plugin_data = get_plugin_data( plugin_dir_path( __DIR__ ) . 'email-subscribers.php' );
336
  $es_current_version = $es_plugin_data['Version'];
337
  $admin_email = get_option( 'admin_email' );
338
-
339
- include plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/dashboard.php';
 
 
 
 
 
340
 
341
  }
342
 
343
  public static function es_feedback() {
344
  // if ( get_option( 'es_star_review' ) != 1 ) {
345
  // echo '<div class="notice notice-warning" style="background-color: #FFF;"><p style="letter-spacing: 0.6px;">If you like <strong>Email Subscribers</strong>, please consider leaving us a <a target="_blank" href="https://wordpress.org/support/plugin/email-subscribers/reviews/?filter=5#new-post"><span>&#9733;</span><span>&#9733;</span><span>&#9733;</span><span>&#9733;</span><span>&#9733;</span></a> rating. A huge thank you from Icegram in advance! <a style="float:right" class="es-admin-btn es-admin-btn-secondary" href="' . admin_url() . 'admin.php?page=es_dashboard&dismiss_admin_notice=1&option_name=es_star_review">No, I don\'t like it</a></p></div>';
346
-
347
  // }
348
  }
349
 
@@ -360,4 +387,66 @@ class Email_Subscribers_Admin {
360
  <?php
361
  }
362
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
363
  }
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
+ add_action( 'wp_ajax_send_test_email', array( $this, 'send_test_email' ) );
71
+ add_action( 'admin_init', array( $this, 'es_save_onboarding_skip' ) );
72
 
73
  }
74
 
150
  return;
151
  }
152
  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 );
153
+ wp_enqueue_script( 'custom', plugin_dir_url( __FILE__ ) . 'js/es-onboarding.js', array( 'jquery' ), $this->version, false );
154
  }
155
 
156
  public function remove_submenu() {
198
  // Function for Klawoo's Subscribe form on Help & Info page
199
  public static function klawoo_subscribe() {
200
  $url = 'http://app.klawoo.com/subscribe';
201
+ if( !empty($_REQUEST['form-source']) ){
202
+ update_option('ig_es_onboarding_status', $_REQUEST['form-source']);
203
+ }
204
  if ( ! empty( $_POST ) ) {
205
  $params = $_POST;
206
  } else {
286
  $preview->es_template_preview_callback();
287
  }
288
 
289
+ public function do_send( $response, $data ) {
290
+ global $phpmailer;
291
+
292
+ if ( ! is_object( $phpmailer ) || ! is_a( $phpmailer, 'PHPMailer' ) ) {
293
+ require_once ABSPATH . WPINC . '/class-phpmailer.php';
294
+ $phpmailer = new PHPMailer( true );
295
+ }
296
 
297
  $to_email = $data['to_email'];
298
  $subject = $data['subject'];
299
  $email_template = $data['email_template'];
300
  $headers = $data['headers'];
301
 
302
+ $send_mail = wp_mail( $to_email, $subject, $email_template, $headers );
303
+ $result = array('status' => 'SUCCESS');
304
+
305
+ if(!$send_mail) {
306
+
307
+ $result = array(
308
+ 'status' => 'ERROR',
309
+ 'message' => wp_strip_all_tags( $phpmailer->ErrorInfo )
310
+ );
311
+
312
+ }
313
+
314
+ return $result;
315
  }
316
 
317
  function submenu_order( $menu_order ) {
358
  $es_plugin_data = get_plugin_data( plugin_dir_path( __DIR__ ) . 'email-subscribers.php' );
359
  $es_current_version = $es_plugin_data['Version'];
360
  $admin_email = get_option( 'admin_email' );
361
+ $ig_es_4015_db_updated_at = get_option( 'ig_es_4015_db_updated_at', false);
362
+ $onboarding_status = get_option( 'ig_es_onboarding_complete', 'no');
363
+ if ( !$ig_es_4015_db_updated_at && 'yes' !== $onboarding_status) {
364
+ include plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/onboarding.php';
365
+ }else{
366
+ include plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/dashboard.php';
367
+ }
368
 
369
  }
370
 
371
  public static function es_feedback() {
372
  // if ( get_option( 'es_star_review' ) != 1 ) {
373
  // echo '<div class="notice notice-warning" style="background-color: #FFF;"><p style="letter-spacing: 0.6px;">If you like <strong>Email Subscribers</strong>, please consider leaving us a <a target="_blank" href="https://wordpress.org/support/plugin/email-subscribers/reviews/?filter=5#new-post"><span>&#9733;</span><span>&#9733;</span><span>&#9733;</span><span>&#9733;</span><span>&#9733;</span></a> rating. A huge thank you from Icegram in advance! <a style="float:right" class="es-admin-btn es-admin-btn-secondary" href="' . admin_url() . 'admin.php?page=es_dashboard&dismiss_admin_notice=1&option_name=es_star_review">No, I don\'t like it</a></p></div>';
 
374
  // }
375
  }
376
 
387
  <?php
388
  }
389
 
390
+ function send_test_email(){
391
+ $message = array();
392
+ $message = array(
393
+ 'status' => 'ERROR',
394
+ 'message' => __('Something went wrong', 'email-subscribers')
395
+ );
396
+ if(!empty($_REQUEST['emails'])){
397
+ $emails = $_REQUEST['emails'];
398
+ $default_list = ES_DB_Lists::get_list_by_name( IG_DEFAULT_LIST );
399
+ $list_id = $default_list['id'];
400
+ //add to the default list
401
+ foreach ($emails as $email) {
402
+ $data = array(
403
+ 'first_name' => ES_Common::get_name_from_email( $email ),
404
+ 'email' => $email,
405
+ 'source' => 'admin',
406
+ 'form_id' => 0,
407
+ 'status' => 'verified',
408
+ 'unsubscribed' => 0,
409
+ 'hash' => ES_Common::generate_guid(),
410
+ 'created_at' => ig_get_current_date_time()
411
+ );
412
+ $contact_id = ES_DB_Contacts::add_subscriber( $data );
413
+ if ( $contact_id ) {
414
+ $data = array(
415
+ 'list_id' => array( $list_id ),
416
+ 'contact_id' => $contact_id,
417
+ 'status' => 'subscribed',
418
+ 'optin_type' => IG_SINGLE_OPTIN,
419
+ 'subscribed_at' => ig_get_current_date_time(),
420
+ 'subscribed_ip' => null
421
+ );
422
+
423
+ ES_DB_Lists_Contacts::add_lists_contacts( $data );
424
+ }
425
+ }
426
+ $res = ES_Install::create_and_send_default_broadcast();
427
+ $res = ES_Install::create_and_send_default_post_notification();
428
+ if( $res['status'] === 'SUCCESS'){
429
+ update_option('ig_es_onboarding_test_campaign_success', 'yes');
430
+ }else{
431
+ update_option('ig_es_onboarding_test_campaign_error', 'yes');
432
+ }
433
+ update_option('ig_es_onboarding_complete', 'yes');
434
+ $res['dashboard_url'] = admin_url('admin.php?page=es_dashboard');
435
+ echo json_encode($res);
436
+ exit;
437
+
438
+ }
439
+ }
440
+
441
+ //save skip signup option
442
+ function es_save_onboarding_skip(){
443
+ if ( isset( $_GET['es_skip'] ) && $_GET['es_skip'] == '1' && isset( $_GET['option_name'] ) ) {
444
+ $option_name = sanitize_text_field( $_GET['option_name'] );
445
+ update_option( 'ig_es_ob_skip_' . $option_name, 'yes' );
446
+ $referer = wp_get_referer();
447
+ wp_safe_redirect( $referer );
448
+ exit();
449
+ }
450
+ }
451
+
452
  }
admin/css/email-subscribers-admin.css CHANGED
@@ -234,8 +234,8 @@ div#post-body-content .meta-box-sortables .row-blog p.submit input#submit {
234
 
235
  .email-subscribers_page_es_newsletters table.form-table td select,
236
  .email-subscribers_page_es_notifications table.form-table td select,
237
- .email-subscribers_page_es_newsletters table.form-table input[type="text"] ,
238
- .email-subscribers_page_es_notifications table.form-table input[type="text"]{
239
  width: 35%;
240
  }
241
 
@@ -578,7 +578,7 @@ p.search-box.box-ma10 {
578
 
579
  .form-table td.es-emm-optin {
580
  /*padding: 15px 10px;*/
581
- /*width: 25%;*/
582
  padding: 1em;
583
  }
584
 
@@ -635,7 +635,7 @@ p.search-box.box-ma10 {
635
  }
636
 
637
  li.es-quick-links {
638
- margin: 0.5em 1em;
639
  font-size: 1.3em;
640
  /* font-weight: 800; */
641
  list-style: none;
@@ -655,10 +655,12 @@ li.es-quick-links {
655
  line-height: 3em !important;
656
  margin: 1em auto !important;
657
  }
658
- .es-right{
 
659
  margin-left: 2em;
660
  }
661
- .es-doc-links{
 
662
  font-size: 1.2em;
663
  /*font-weight: bold;*/
664
  }
@@ -772,9 +774,10 @@ h5.es-badge {
772
 
773
  /* Force table to not be like tables anymore */
774
  .klawoo-form table.form-table, .klawoo-form .form-table thead, .klawoo-form .form-table tbody, .klawoo-form .form-table th, .klawoo-form .form-table td, .klawoo-form .form-table tr {
775
- display: block;
776
  }
777
- .klawoo-form .form-table td.es-emm-text{
 
778
  width: 100%;
779
  }
780
  }
@@ -851,6 +854,7 @@ h5.es-badge {
851
  .es-icon {
852
  font-family: "dashicons";
853
  }
 
854
  .es-send-success:before {
855
  content: "\f147";
856
  color: green;
@@ -882,27 +886,295 @@ h5.es-badge {
882
  font-size: 1.5em;
883
  }
884
 
885
- @keyframes beat{
886
- to { transform: scale(1.1); }
 
 
887
  }
888
 
889
- #es-test-email{
890
  width: 60%;
891
  margin-right: 0.7em;
892
  }
893
- .es_spinner_image_admin img{
 
894
  height: 20px;
895
  margin-left: 0.3em;
896
  vertical-align: middle;
897
  }
898
 
899
- .es-upsale-image img{
900
  margin-left: -16em;
901
  }
902
- .es-smtp-image img{
 
903
  margin-left: -1em;
904
  margin-top: 0.8em;
905
  }
906
- .es-smtp-label{
 
907
  margin-left: -0.6em;
908
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
 
235
  .email-subscribers_page_es_newsletters table.form-table td select,
236
  .email-subscribers_page_es_notifications table.form-table td select,
237
+ .email-subscribers_page_es_newsletters table.form-table input[type="text"],
238
+ .email-subscribers_page_es_notifications table.form-table input[type="text"] {
239
  width: 35%;
240
  }
241
 
578
 
579
  .form-table td.es-emm-optin {
580
  /*padding: 15px 10px;*/
581
+ width: 20%;
582
  padding: 1em;
583
  }
584
 
635
  }
636
 
637
  li.es-quick-links {
638
+ margin: 0.5em 1em;
639
  font-size: 1.3em;
640
  /* font-weight: 800; */
641
  list-style: none;
655
  line-height: 3em !important;
656
  margin: 1em auto !important;
657
  }
658
+
659
+ .es-right {
660
  margin-left: 2em;
661
  }
662
+
663
+ .es-doc-links {
664
  font-size: 1.2em;
665
  /*font-weight: bold;*/
666
  }
774
 
775
  /* Force table to not be like tables anymore */
776
  .klawoo-form table.form-table, .klawoo-form .form-table thead, .klawoo-form .form-table tbody, .klawoo-form .form-table th, .klawoo-form .form-table td, .klawoo-form .form-table tr {
777
+ display: block;
778
  }
779
+
780
+ .klawoo-form .form-table td.es-emm-text {
781
  width: 100%;
782
  }
783
  }
854
  .es-icon {
855
  font-family: "dashicons";
856
  }
857
+
858
  .es-send-success:before {
859
  content: "\f147";
860
  color: green;
886
  font-size: 1.5em;
887
  }
888
 
889
+ @keyframes beat {
890
+ to {
891
+ transform: scale(1.1);
892
+ }
893
  }
894
 
895
+ #es-test-email {
896
  width: 60%;
897
  margin-right: 0.7em;
898
  }
899
+
900
+ .es_spinner_image_admin img {
901
  height: 20px;
902
  margin-left: 0.3em;
903
  vertical-align: middle;
904
  }
905
 
906
+ .es-upsale-image img {
907
  margin-left: -16em;
908
  }
909
+
910
+ .es-smtp-image img {
911
  margin-left: -1em;
912
  margin-top: 0.8em;
913
  }
914
+
915
+ .es-smtp-label {
916
  margin-left: -0.6em;
917
+ }
918
+
919
+ /*onboarding css */
920
+ #slider-wrapper {
921
+ background: #fff;
922
+ border-radius: 7px;
923
+ -webkit-box-shadow: 0 5px 20px rgba(0, 0, 0, 0.07);
924
+ box-shadow: 0 5px 20px rgba(0, 0, 0, 0.07);
925
+ -webkit-box-sizing: border-box;
926
+ box-sizing: border-box;
927
+ color: #444;
928
+ display: block;
929
+ margin: 1.5em auto 0;
930
+ max-width: 50em;
931
+ overflow: hidden;
932
+ padding: 2em 3em;
933
+ height:40em;
934
+ /*-webkit-transform: translate(0%,45%);*/
935
+ -webkit-transform: translate(0%,7vw);
936
+ transform: translate(0%,7vw);
937
+ /*top: 50%;
938
+ left: 50%;*/
939
+ }
940
+ .sp {
941
+ background: #FFF;
942
+ height:22em;
943
+ position: absolute;
944
+ font-size: 1.1em;
945
+ line-height: 2em;
946
+ width: 40em;
947
+ }
948
+ .es-footer{
949
+ float: right;
950
+ margin-top:75%;
951
+ /*font-weight: bold;*/
952
+ font-size: 1.2em;
953
+ cursor: pointer;
954
+ /*text-decoration: underline;*/
955
+ }
956
+ a.button-send,.es-error-actions .es-dashboard-btn{
957
+ text-decoration: none !important;
958
+ color: #387bff;
959
+ /* font-size: 1.1em; */
960
+ font-weight: 500;
961
+ padding: 0.50em 0.55em;
962
+ border-radius: 3px;
963
+ transition: background-color 0.5s;
964
+ cursor: pointer;
965
+ }
966
+ a.button-send:hover,.es-error-actions .es-dashboard-btn:hover{
967
+ background-color: #387bff !important;
968
+ color: white !important;
969
+ }
970
+ .es-send-email-screen img.es-loader{
971
+ display: inline-block;
972
+ vertical-align: middle;
973
+ margin-right: 1em;
974
+ }
975
+ .sp input[type="email"].error{
976
+ border: 1px solid red;
977
+ }
978
+ .es-error-actions{
979
+ text-align: center;
980
+ margin-top: 3em;
981
+ }
982
+ .es-error-actions .es-dashboard-btn{
983
+
984
+ }
985
+ .es-error-actions .button-hero{
986
+ width: 46% !important;
987
+ }
988
+ .sp h1{
989
+ text-align: center;
990
+ color: #387bff;
991
+ line-height:1.3em;
992
+ }
993
+ .sp .es-ltr {
994
+ padding: 1em;
995
+ }
996
+ .sp .button-hero{
997
+ color: #FFFFFF !important;
998
+ border-color: #03a025 !important;
999
+ background: #03a025 !important;
1000
+ box-shadow: 0 1px 0 #03a025;
1001
+ font-weight: bold;
1002
+ height: 3em;
1003
+ line-height: 1em;
1004
+
1005
+ }
1006
+ .sp .es-actions{
1007
+ margin: 0 auto;
1008
+ display: block;
1009
+ text-align: center;
1010
+ width: 45%;
1011
+ padding-top: 2em;
1012
+ }
1013
+ .sp form[name=klawoo_subscribe]{
1014
+ margin-right: 2em;
1015
+ }
1016
+ .sp .dashicons{
1017
+ vertical-align: middle;
1018
+ color: #44ad69;
1019
+ margin-right: 0.3em;
1020
+ }
1021
+ .sp form[name=klawoo_subscribe] input[type="email"], .sp form[name=klawoo_subscribe] input[type="text"]{
1022
+ width: 320px;
1023
+ padding: 1.25em 1em;
1024
+ }
1025
+
1026
+
1027
+ #es-send-email-form input[type="email"]{
1028
+ width: 60%;
1029
+ padding: 0.4em 0.5em;
1030
+ border: none;
1031
+ box-shadow: none;
1032
+ border-bottom: 1px solid gray;
1033
+ }
1034
+ .es-form-wrapper{
1035
+ padding: 0.5em 0.8em;
1036
+ background-color: #f9f9f9;
1037
+ border-radius: 3px;
1038
+ }
1039
+ .es-send-email-screen .es-form-wrapper form{
1040
+ margin-top: 0.8em;
1041
+ }
1042
+ .sp.es-receive-error li{
1043
+ margin-bottom: 0;
1044
+ }
1045
+ .es-email-sending-error{
1046
+ line-height: 1em;
1047
+ padding: 1em;
1048
+ }
1049
+ .es-error form.es-onboarding{
1050
+ margin-top: 1em;
1051
+ }
1052
+ .sp .es-gray{
1053
+ color: #737373;
1054
+ line-height: 1.75;
1055
+ }
1056
+ .sp .es-skip{
1057
+ cursor: pointer;
1058
+ }
1059
+ /* onboarding :end */
1060
+
1061
+ .ig-es-indicator {
1062
+ text-align: center;
1063
+ z-index: 26;
1064
+ font-size: 0.8em;
1065
+ margin-left: 0.3em;
1066
+ padding: 2px;
1067
+ background: #e66060;
1068
+ color: #fff;
1069
+ border-radius: 2px;
1070
+ }
1071
+
1072
+ .ig-es-success-indicator {
1073
+ background-color: #008000;
1074
+ }
1075
+
1076
+ .ig-es-indicator-new {
1077
+ background-color: #e66060;
1078
+ }
1079
+
1080
+ /* Information Box CSS */
1081
+ div.ig-es-information-box {
1082
+ padding: 4px 12px;
1083
+ margin-top: 25px;
1084
+ margin-bottom: 25px;
1085
+ border-radius: 10px;
1086
+ }
1087
+
1088
+ div.ig-es-center {
1089
+ margin-left: auto;
1090
+ margin-right: auto;
1091
+ width: 50%;
1092
+ }
1093
+
1094
+ div.ig-es-box-shadow {
1095
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
1096
+ -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
1097
+ -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
1098
+ -o-box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
1099
+ border-left: 0px;
1100
+ }
1101
+
1102
+ .ig-es-success {
1103
+ background-color: #ddffdd;
1104
+ border-left: 6px solid #4CAF50;
1105
+ }
1106
+
1107
+ .ig-es-danger {
1108
+ background-color: #ffdddd;
1109
+ border-left: 6px solid #f44336;
1110
+ }
1111
+
1112
+ .ig-es-info {
1113
+ background-color: #e7f3fe;
1114
+ border-left: 6px solid #2196F3;
1115
+ content: "\f348";
1116
+ }
1117
+
1118
+ .ig-es-warning {
1119
+ background-color: #ffffcc;
1120
+ border-left: 6px solid #ffeb3b;
1121
+ }
1122
+
1123
+ .ig-vertical-align {
1124
+ display: flex;
1125
+ align-items: center;
1126
+ }
1127
+
1128
+ .ig-es-icon {
1129
+ margin-right: 2em;
1130
+ }
1131
+
1132
+ .ig-es-icon-success:before {
1133
+ content: "\f147";
1134
+ color: #3c763d;
1135
+ font-size: 36px;
1136
+ }
1137
+
1138
+ .ig-es-icon-danger:before {
1139
+ content: "\f153";
1140
+ color: #a94442;
1141
+ font-size: 36px;
1142
+ }
1143
+
1144
+ .ig-es-icon-info:before {
1145
+ content: "\f348";
1146
+ color: #31708f;
1147
+ font-size: 36px;
1148
+ }
1149
+
1150
+ .ig-es-icon-warning:before {
1151
+ content: "\f534";
1152
+ color: #856404;
1153
+ font-size: 36px;
1154
+ }
1155
+
1156
+ /* Structure */
1157
+ div.es .column {
1158
+ float: left;
1159
+ margin-right: 4%;
1160
+ }
1161
+
1162
+ div.es .row {
1163
+ margin-left: auto;
1164
+ margin-right: auto;
1165
+ position: relative;
1166
+ }
1167
+
1168
+ div.es .one-half {
1169
+ width: 48%;
1170
+ position: relative;
1171
+ }
1172
+
1173
+ div.es .one-third {
1174
+ width: 33%;
1175
+ position: relative;
1176
+ }
1177
+
1178
+ div.es .last {
1179
+ margin-right: 0;
1180
+ }
admin/images/es-comments.png CHANGED
Binary file
admin/images/woocommerce-sync.png ADDED
Binary file
admin/js/email-subscribers-admin.js CHANGED
@@ -75,8 +75,10 @@
75
  data: params,
76
  dataType: 'json',
77
  success: function (response) {
78
- if (response && typeof response.status !== 'undefined' && response.status === "success") {
79
  $('#es-send-test').parent().find('.helper').html('<span style="color:green">' + response.message + '</span>');
 
 
80
  }
81
 
82
  $('#es-send-test').next('#spinner-image').hide();
@@ -91,6 +93,49 @@
91
  }
92
 
93
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  });
95
 
96
 
75
  data: params,
76
  dataType: 'json',
77
  success: function (response) {
78
+ if (response && typeof response.status !== 'undefined' && response.status == "SUCCESS") {
79
  $('#es-send-test').parent().find('.helper').html('<span style="color:green">' + response.message + '</span>');
80
+ }else{
81
+ $('#es-send-test').parent().find('.helper').html('<span style="color:#e66060">' + response.message + '</span>');
82
  }
83
 
84
  $('#es-send-test').next('#spinner-image').hide();
93
  }
94
 
95
  });
96
+
97
+ //klawoo form submit
98
+ jQuery("form[name=klawoo_subscribe]").submit(function (e) {
99
+ e.preventDefault();
100
+ var form = e.target;
101
+ jQuery(form).find('#klawoo_response').html('');
102
+ jQuery(form).find('#klawoo_response').show();
103
+
104
+ params = jQuery(form).serializeArray();
105
+ params.push( {name: 'action', value: 'es_klawoo_subscribe' });
106
+
107
+ jQuery.ajax({
108
+ method: 'POST',
109
+ type: 'text',
110
+ url: ajaxurl,
111
+ async: false,
112
+ data: params,
113
+ success: function(response) {
114
+ if (response != '') {
115
+ var parser = new DOMParser()
116
+ var el = parser.parseFromString(response, "text/xml");
117
+ var msg = el.childNodes[0].firstChild.nextElementSibling.innerHTML;
118
+ if( jQuery(form).hasClass('es-onboarding')){
119
+ location.reload();
120
+ }else{
121
+ jQuery(form).find('#klawoo_response').html();
122
+
123
+ jQuery('.es-emm-optin #name').val('');
124
+ jQuery('.es-emm-optin #email').val('');
125
+ jQuery('.es-emm-optin #es-gdpr-agree').attr('checked', false);
126
+ setTimeout(function() {
127
+ jQuery(form).find('#klawoo_response').hide('slow');
128
+ }, 2000);
129
+ }
130
+
131
+
132
+ } else {
133
+ jQuery('#klawoo_response').html('error!');
134
+ }
135
+ }
136
+ });
137
+
138
+ });
139
  });
140
 
141
 
admin/js/es-onboarding.js ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ jQuery('.sp').first().addClass('active');
3
+ jQuery('.sp').hide();
4
+ jQuery('.active').show();
5
+
6
+ if (jQuery('.es-send-email-screen').hasClass('active')) {
7
+ jQuery('#button-send').addClass('es-send-email');
8
+ }
9
+
10
+ jQuery(document).on('click', '.es-send-email', function() {
11
+ if(jQuery("#es-send-email-form")[0].checkValidity()) {
12
+ jQuery('.es-send-email-screen .es-loader').show();
13
+ var emails = [];
14
+ jQuery(".es_email").each(function() {
15
+ if ((jQuery.trim(jQuery(this).val()).length > 0)) {
16
+ emails.push(jQuery(this).val());
17
+ }
18
+ });
19
+ var params = {
20
+ type: 'POST',
21
+ url: ajaxurl,
22
+ data: {
23
+ action: 'send_test_email',
24
+ emails: emails
25
+ },
26
+ dataType: 'json',
27
+ success: function(data, status, xhr) {
28
+ jQuery('.es-send-email-screen .es-loader').find('img').hide();
29
+ jQuery('.active').fadeOut('fast').removeClass('active');
30
+ jQuery('#button-send').hide();
31
+ if (data.status == 'SUCCESS') {
32
+ jQuery('.sp.es-success').addClass('active').fadeIn('slow');
33
+ } else if(data.status == 'ERROR'){
34
+ jQuery('.sp.es-error').find('.es-email-sending-error').html('<i class="dashicons dashicons-es dashicons-no-alt" style="color: #e66060"></i>'+data.message);
35
+ jQuery('.sp.es-error').addClass('active').fadeIn('slow');
36
+ jQuery('#button-send').hide();
37
+ }
38
+ },
39
+ error: function(data, status, xhr) {}
40
+ };
41
+
42
+ jQuery.ajax(params);
43
+ }else{
44
+ jQuery(".es_email").addClass('error')
45
+ jQuery("#es-send-email-form")[0].reportValidity();
46
+ }
47
+
48
+ });
49
+
50
+ jQuery(document).on('click', '.es-receive-success-btn', function() {
51
+ jQuery('.active').fadeOut('fast').removeClass('active');
52
+ jQuery('.sp.es-receive-success').fadeIn('slow').addClass('active');
53
+
54
+ });
55
+
56
+ jQuery(document).on('click', '.es-receive-error-btn', function() {
57
+ jQuery('.active').fadeOut('fast').removeClass('active');
58
+ jQuery('.sp.es-receive-error').fadeIn('slow').addClass('active');
59
+ });
60
+
61
+ });
admin/js/mycustom.js DELETED
@@ -1,8 +0,0 @@
1
- jQuery(document).ready(function () {
2
- jQuery('li.es-card').first().addClass('active');
3
- jQuery('.control_next').on( 'click', function(){
4
- console.log(999);
5
- jQuery('.es-card').next().addClass('active');
6
-
7
- });
8
- });
 
 
 
 
 
 
 
 
admin/partials/dashboard.php CHANGED
@@ -5,50 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) {
5
  }
6
 
7
  ?>
8
- <script type="text/javascript">
9
- jQuery(function () {
10
- jQuery("form[name=klawoo_subscribe]").submit(function (e) {
11
-
12
- e.preventDefault();
13
-
14
- jQuery('#klawoo_response').html('');
15
- jQuery('#klawoo_response').show();
16
-
17
- params = jQuery("form[name=klawoo_subscribe]").serializeArray();
18
- params.push( {name: 'action', value: 'es_klawoo_subscribe' });
19
-
20
- jQuery.ajax({
21
- method: 'POST',
22
- type: 'text',
23
- url: "<?php echo admin_url( 'admin-ajax.php' ); ?>",
24
- async: false,
25
- data: params,
26
- success: function(response) {
27
-
28
- if (response != '') {
29
- var parser = new DOMParser()
30
- var el = parser.parseFromString(response, "text/xml");
31
-
32
- jQuery('#klawoo_response').html(el.childNodes[0].firstChild.nextElementSibling.innerHTML);
33
-
34
- jQuery('.es-emm-optin #name').val('');
35
- jQuery('.es-emm-optin #email').val('');
36
- jQuery('.es-emm-optin #es-gdpr-agree').attr('checked', false);
37
- setTimeout(function() {
38
- jQuery('#klawoo_response').hide('slow');
39
- }, 2000);
40
-
41
- } else {
42
- jQuery('#klawoo_response').html('error!');
43
- }
44
- }
45
- });
46
-
47
- });
48
- });
49
- </script>
50
-
51
- <div class="wrap">
52
  <?php do_action( 'es_before_dashboard' ) ?>
53
  <div class="about-header">
54
  <div class="es-upper">
@@ -56,6 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
56
  <div class="es-about">
57
  <?php
58
  $es_upgrade_to_4 = get_option('ig_es_db_version', '' );
 
59
  if(empty($es_upgrade_to_4)){?>
60
  <h2><?php echo __( "Congratulations! You've successfully upgraded to " . ES_PLUGIN_VERSION , 'email-subscribers' ); ?></h2>
61
  <ul><strong><?php _e('Here\'s a quick look at changes within the plugin:', 'email-subscribers'); ?></strong>
@@ -65,6 +23,15 @@ if ( ! defined( 'ABSPATH' ) ) {
65
  <li class="es-notify-about-new-post-2"><?php echo sprintf( __( '4. Find <a href="%s" target="_blank">Forms</a> here', 'email-subscribers' ), admin_url( 'admin.php?page=es_forms' )); ?></li>
66
  </ul>
67
  <a href="https://www.icegram.com/email-subscribers-plugin-redesign/?utm_source=es&utm_medium=in_app&utm_campaign=es_4" target="_blank" class="button button-main"><?php _e('Explore all changes', 'email-subscribers'); ?></a>
 
 
 
 
 
 
 
 
 
68
  <?php }else{?>
69
  <h2><?php echo __( 'Hello! 👋', 'email-subscribers' ); ?></h2>
70
  <div class="es-about-line"><?php _e('Email Subscribers is a complete newsletter plugin that lets you collect leads, send automated new blog post notification emails, send newsletters and more. It’s your tool to build an audience and engage with them ongoingly.', 'email-subscribers')?></div>
@@ -93,16 +60,15 @@ if ( ! defined( 'ABSPATH' ) ) {
93
  <td class="es-emm-optin">
94
  <form name="klawoo_subscribe" action="#" method="POST" accept-charset="utf-8">
95
  <input class="es-ltr" type="text" name="name" id="name" placeholder="Your Name" />
96
- <input class="es-ltr" type="text" name="email" id="email" placeholder="Your Email" /> <br />
97
  <input type="hidden" name="list" value="hN8OkYzujUlKgDgfCTEcIA"/>
98
  <input type="checkbox" name="es-gdpr-agree" id ="es-gdpr-agree" value="1" required="required">
99
  <label for="es-gdpr-agree"><?php echo sprintf(__( 'I have read and agreed to your %s.', 'email-subscribers' ), '<a href="https://www.icegram.com/privacy-policy/" target="_blank">' . __( 'Privacy Policy', 'email-subscribers' ) . '</a>' ); ?></label>
100
  <br /><br />
101
  <input type="submit" name="submit" id="submit" class="button button-hero" value="<?php echo __( 'Subscribe', 'email-subscribers' ); ?>">
102
  <br><br>
103
- <p id="klawoo_response"></p>
104
  </form>
105
-
106
  </td>
107
  </tr>
108
  </table>
@@ -118,10 +84,10 @@ if ( ! defined( 'ABSPATH' ) ) {
118
  </div>
119
  <div class="es-quick-links-wrapper" >
120
  <h3 class="es-right-headline"><?php _e('Overview', 'email-subscribers'); ?></h3>
121
- <li class="es-quick-links"><span class="es-count"><?php echo $sub_count; ?> <a target="_blank" href="<?php echo admin_url( 'admin.php?page=es_subscribers&filter_by_status=subscribed' )?>" ><?php _e('Active Contacts', 'email-subscribers')?></a></li>
122
- <li class="es-quick-links"><span class="es-count"><?php echo $total_forms; ?> <a target="_blank" href="<?php echo admin_url( 'admin.php?page=es_forms' )?>" ><?php _e('Forms', 'email-subscribers')?></a></li>
123
- <li class="es-quick-links"><span class="es-count"><?php echo $total_campaigns; ?> <a target="_blank" href="<?php echo admin_url( 'admin.php?page=es_campaigns' )?>" ><?php _e('Campaigns', 'email-subscribers')?></a></li>
124
- <li class="es-quick-links"><span class="es-count"><?php echo $total_lists; ?> <a target="_blank" href="<?php echo admin_url( 'admin.php?page=es_lists' )?>" ><?php _e('Lists', 'email-subscribers')?></a></li>
125
  </div>
126
  <div class="es-docs-wrapper" >
127
  <h3 class="es-right-headline"><?php _e('Help & How to\'s', 'email-subscribers'); ?></h3>
@@ -149,4 +115,4 @@ if ( ! defined( 'ABSPATH' ) ) {
149
  </div>
150
 
151
  </div>
152
- </div>
5
  }
6
 
7
  ?>
8
+ <!-- <div class="wrap"> -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  <?php do_action( 'es_before_dashboard' ) ?>
10
  <div class="about-header">
11
  <div class="es-upper">
13
  <div class="es-about">
14
  <?php
15
  $es_upgrade_to_4 = get_option('ig_es_db_version', '' );
16
+ $ig_es_onboarding_complete = get_option('ig_es_onboarding_complete', 'no' );
17
  if(empty($es_upgrade_to_4)){?>
18
  <h2><?php echo __( "Congratulations! You've successfully upgraded to " . ES_PLUGIN_VERSION , 'email-subscribers' ); ?></h2>
19
  <ul><strong><?php _e('Here\'s a quick look at changes within the plugin:', 'email-subscribers'); ?></strong>
23
  <li class="es-notify-about-new-post-2"><?php echo sprintf( __( '4. Find <a href="%s" target="_blank">Forms</a> here', 'email-subscribers' ), admin_url( 'admin.php?page=es_forms' )); ?></li>
24
  </ul>
25
  <a href="https://www.icegram.com/email-subscribers-plugin-redesign/?utm_source=es&utm_medium=in_app&utm_campaign=es_4" target="_blank" class="button button-main"><?php _e('Explore all changes', 'email-subscribers'); ?></a>
26
+ <?php }else if( 'yes' === $ig_es_onboarding_complete ){?>
27
+ <h2><?php echo __( "You are all setup 👍", 'email-subscribers' ); ?></h2>
28
+ <div class="es-notify-about-new-post-1"><b><?php echo __( 'Here are the things you can do next', 'email-subscribers' ); ?></b></div>
29
+ <ul>
30
+ <li class="es-notify-about-new-post-2"><?php echo sprintf( __( '1.Check <a href="%s" target="blank" >optin form</a> on your homepage', 'email-subscribers' ), home_url()); ?></li>
31
+ <li class="es-notify-about-new-post-2"><?php echo sprintf( __( '2. <a href="%s" target="blank" ><b>Review and rearrange the form from Widgets.</b></a> You can also learn about <a href="%s" target="_blank">adding a form to another place from this help article.</a>', 'email-subscribers' ), admin_url( 'widgets.php' ), 'https://www.icegram.com/documentation/how-to-create-form-in-email-subscribers/' ); ?></li>
32
+ <li class="es-notify-about-new-post-2"><?php echo sprintf( __( '3. Go ahead and take a look around. Tweak settings, review <a href="%s" target="_blank">design templates</a> or go through the documentation.', 'email-subscribers' ), admin_url('edit.php?post_type=es_template') ); ?></li>
33
+ <li class="es-notify-about-new-post-2"><?php echo __( '4. And if you haven\'t already, signup for the free course below.', 'email-subscribers' ); ?></li>
34
+ </ul>
35
  <?php }else{?>
36
  <h2><?php echo __( 'Hello! 👋', 'email-subscribers' ); ?></h2>
37
  <div class="es-about-line"><?php _e('Email Subscribers is a complete newsletter plugin that lets you collect leads, send automated new blog post notification emails, send newsletters and more. It’s your tool to build an audience and engage with them ongoingly.', 'email-subscribers')?></div>
60
  <td class="es-emm-optin">
61
  <form name="klawoo_subscribe" action="#" method="POST" accept-charset="utf-8">
62
  <input class="es-ltr" type="text" name="name" id="name" placeholder="Your Name" />
63
+ <input class="es-ltr" type="text" name="email" id="email" placeholder="Your Email" required /> <br />
64
  <input type="hidden" name="list" value="hN8OkYzujUlKgDgfCTEcIA"/>
65
  <input type="checkbox" name="es-gdpr-agree" id ="es-gdpr-agree" value="1" required="required">
66
  <label for="es-gdpr-agree"><?php echo sprintf(__( 'I have read and agreed to your %s.', 'email-subscribers' ), '<a href="https://www.icegram.com/privacy-policy/" target="_blank">' . __( 'Privacy Policy', 'email-subscribers' ) . '</a>' ); ?></label>
67
  <br /><br />
68
  <input type="submit" name="submit" id="submit" class="button button-hero" value="<?php echo __( 'Subscribe', 'email-subscribers' ); ?>">
69
  <br><br>
70
+ <p id="klawoo_response"></p>
71
  </form>
 
72
  </td>
73
  </tr>
74
  </table>
84
  </div>
85
  <div class="es-quick-links-wrapper" >
86
  <h3 class="es-right-headline"><?php _e('Overview', 'email-subscribers'); ?></h3>
87
+ <li class="es-quick-links"><a target="_blank" href="<?php echo admin_url( 'admin.php?page=es_subscribers&filter_by_status=subscribed' )?>" ><?php _e('Active Contacts', 'email-subscribers')?></a> <span class="es-count"><?php echo '- '.$sub_count; ?> </span></li>
88
+ <li class="es-quick-links"><a target="_blank" href="<?php echo admin_url( 'admin.php?page=es_forms' )?>" ><?php _e('Forms', 'email-subscribers')?></a><span class="es-count"><?php echo '- '.$total_forms; ?> </span></li>
89
+ <li class="es-quick-links"><a target="_blank" href="<?php echo admin_url( 'admin.php?page=es_campaigns' )?>" ><?php _e('Campaigns', 'email-subscribers')?></a><span class="es-count"><?php echo '- '.$total_campaigns; ?> </span></li>
90
+ <li class="es-quick-links"><a target="_blank" href="<?php echo admin_url( 'admin.php?page=es_lists' )?>" ><?php _e('Lists', 'email-subscribers')?></a><span class="es-count"><?php echo '- '.$total_lists; ?> </span></li>
91
  </div>
92
  <div class="es-docs-wrapper" >
93
  <h3 class="es-right-headline"><?php _e('Help & How to\'s', 'email-subscribers'); ?></h3>
115
  </div>
116
 
117
  </div>
118
+ <!-- </div> -->
admin/partials/help.php CHANGED
@@ -30,22 +30,36 @@ if ( ! defined( 'ABSPATH' ) ) {
30
  </div>
31
  <div class="right-blog">
32
 
33
- <?php if($enable_manual_update) { ?>
 
 
 
 
 
 
 
 
 
34
 
35
  <div class="database-migration">
36
- <h3><?php echo __('Database Migration', 'email-subscribers'); ?></h3>
37
 
38
- <p><?php echo __( 'If you found duplicate campaigns, lists, forms, reports after upgrading from Email Subscribers 3.5.x to 4.x and want to run the database migration again to fix this, please click the below <b>Run the updater</b> button.', 'email-subscribers'); ?></p>
39
 
40
- <p><?php echo __('Once you click on <b>Run the updater</b> button, it will run the migration process from 3.5.x once again. So, if you have created new campaigns, forms or lists after migration to 4.x earlier, you will lose those data. So, make sure you have a backup with you.', 'email-subscribers'); ?></p>
41
 
42
  <p class="submit">
43
- <a href="<?php echo esc_url( $update_url ); ?>" class="es-update-now button-primary"><?php echo __('Run the updater', 'email-subscribers'); ?></a>
44
  </p>
45
 
46
  </div>
47
 
48
- <?php } ?>
 
 
 
 
 
49
 
50
  <div class="subscribe-form">
51
  <h4><?php echo __( 'Additional form settings', 'email-subscribers' ); ?></h4>
30
  </div>
31
  <div class="right-blog">
32
 
33
+ <?php if ( $enable_manual_update ) {
34
+
35
+ $info = array(
36
+ 'type' => 'info',
37
+ 'center' => false,
38
+ 'show_icon' => false
39
+ );
40
+
41
+ ob_start();
42
+ ?>
43
 
44
  <div class="database-migration">
45
+ <h3><?php echo __( 'Database Migration', 'email-subscribers' ); ?></h3>
46
 
47
+ <p><?php echo __( 'If you found duplicate campaigns, lists, forms, reports after upgrading from Email Subscribers 3.5.x to 4.x and want to run the database migration again to fix this, please click the below <b>Run the updater</b> button.', 'email-subscribers' ); ?></p>
48
 
49
+ <p><?php echo __( 'Once you click on <b>Run the updater</b> button, it will run the migration process from 3.5.x once again. So, if you have created new campaigns, forms or lists after migration to 4.x earlier, you will lose those data. So, make sure you have a backup with you.', 'email-subscribers' ); ?></p>
50
 
51
  <p class="submit">
52
+ <a href="<?php echo esc_url( $update_url ); ?>" class="es-update-now button-primary"><?php echo __( 'Run the updater', 'email-subscribers' ); ?></a>
53
  </p>
54
 
55
  </div>
56
 
57
+ <?php
58
+ $content = ob_get_clean();
59
+
60
+ ES_Common::prepare_information_box( $info, $content );
61
+
62
+ } ?>
63
 
64
  <div class="subscribe-form">
65
  <h4><?php echo __( 'Additional form settings', 'email-subscribers' ); ?></h4>
admin/partials/onboarding.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="slider-wrapper">
2
+ <div id="slider">
3
+ <div class="sp es-send-email-screen" >
4
+ <h1> 👍 <?php _e('80% done!'); ?></h1>
5
+ <strong><?php _e('We automatically:'); ?></strong>
6
+ <ol>
7
+ <li> <?php echo sprintf( __('Created two Lists - <a href="%s" target="_blank">Main</a> and <a href="%s" target="_blank">Test</a>', 'email-subscribers'), admin_url('admin.php?page=es_lists'), admin_url('admin.php?page=es_lists'));?></li>
8
+ <li><?php _e('Added yourself', 'email-subscribers');?> <strong>(<?php echo get_option('admin_email'); ?>)</strong> <?php _e('to both lists', 'email-subscribers');?> </li>
9
+ <li> <?php echo sprintf( __('Created a <a href="%s" target="_blank"> subscription / lead collection optin form</a>', 'email-subscribers'), admin_url('admin.php?page=es_forms') );?></li>
10
+ <li> <?php echo sprintf( __('Added optin form to <a href="%s" target="_blank">default widget area</a> to show it on your site', 'email-subscribers'), admin_url('widgets.php'));?></li>
11
+ <li> <?php echo sprintf( __('Created two Campaigns - "<a href="%s" target="_blank">Newsletter Broadcast</a>" and "<a href="%s" target="_blank">New Post Notification</a>"', 'email-subscribers'), admin_url('admin.php?page=es_campaigns'), admin_url('admin.php?page=es_campaigns'));?></li>
12
+ </ol>
13
+ <div class="es-form-wrapper">
14
+ <div class="es-form-next"style="padding: 0.5em 0.8em; border-radius: 3px;">
15
+ <?php _e('Next step is to test everything by <strong>sending a test mail</strong>. <br>We\'ve already added you, but recommend adding another email to test.', 'email-subscribers'); ?>
16
+ </div>
17
+ <form id="es-send-email-form">
18
+ <label><strong><?php _e('Add an email to send a test to:', 'email-subscribers'); ?></strong></label><br/>
19
+ <input type="email" placeholder="abc@gmail.com" name="es_test_email[]" class="es_email" required style="padding: 0.6em 0.5em; border: 1px solid #dcdcdc; "/>
20
+ <a id="button-send" class="button-send"><?php _e('Send a test email', 'email-subscribers');?></a>
21
+ <img class="es-loader" src="<?php echo EMAIL_SUBSCRIBERS_URL ?>/public/images/spinner.gif" style="display:none;"/>
22
+ </form>
23
+ </div>
24
+ </div>
25
+ <div class="sp es-success" >
26
+ <h1><?php _e('Test emails sent, check your inbox'); ?></h1>
27
+ <div class="es-sent-success">
28
+ <div class="es-gray"><?php echo sprintf( __('We sent two Campaigns to %s and email you have added.', 'email-subscribers'), get_option('admin_email'));?></div>
29
+ <div class="es-gray"><?php echo __('They may take a few minutes to arrive. But do confirm you received them.', 'email-subscribers');?></div>
30
+ </div>
31
+ <div class="emoji" style="text-align: center; font-size: 10em; opacity: 0.45"> 📨 </div>
32
+ <div class="es-actions">
33
+ <div class="button button-hero es-receive-success-btn" style="width: 100%; text-align: center;padding: 0"><?php _e('Yes, I received the test emails', 'email-subscribers'); ?></div>
34
+ <div style="margin-top: 0.7em; "><a href="#" style="text-decoration: none;color: #737373" class="es-secondary es-receive-error-btn""><?php _e('No, I haven\'t received them yet', 'email-subscribers'); ?></a></div>
35
+ </div>
36
+ </div>
37
+ <div class="sp es-receive-success">
38
+ <h1> 👍 <?php _e('We\'re done!'); ?></h1>
39
+ <div>
40
+ <div class="" style="color: #737373; line-height: 1.75;"><?php _e('Everything is setup now. It\'s a perfect time to get better at email marketing now. Sign up below to get our highly acclaimed course for free.', 'email-subscribers');?> </div>
41
+ <form name="klawoo_subscribe" action="#" method="POST" accept-charset="utf-8" class="es-onboarding" style="margin-right: 0; margin-top: 1em; /* text-align: center; */ ">
42
+ <input class="es-ltr" type="text" name="name" id="name" placeholder="Your Name"/> <br />
43
+ <input class="es-ltr" type="text" name="email" id="email" placeholder="Your Email" required/> <br />
44
+ <input type="hidden" name="list" value="hN8OkYzujUlKgDgfCTEcIA"/>
45
+ <input type="hidden" name="form-source" value="es_email_send_success"/>
46
+ <input type="checkbox" name="es-gdpr-agree" id ="es-gdpr-agree" value="1" required="required">
47
+ <label for="es-gdpr-agree" style="font-size: 0.9em; color: #777777; "><?php echo sprintf(__( 'I have read and agreed to your %s.', 'email-subscribers' ), '<a href="https://www.icegram.com/privacy-policy/" target="_blank">' . __( 'Privacy Policy', 'email-subscribers' ) . '</a>' ); ?></label>
48
+ <br />
49
+ <input type="submit" name="submit" id="submit" class="button button-hero" style="padding: 0; width: 320px; "value="<?php echo __( 'Signup and send me the course for free', 'email-subscribers' ); ?>">
50
+ <div style="text-align: center; width: 56%; margin-top: 0.5em;"><a class="es-skip" href="<?php echo admin_url('admin.php?page=es_dashboard&es_skip=1&option_name=email_send_success'); ?>"><?php _e('Skip and goto Dashboard', 'email-subscribers') ?></a></div>
51
+ <br>
52
+ <p id="klawoo_response"></p>
53
+ </form>
54
+ </div>
55
+ </div>
56
+ <div class="sp es-receive-error">
57
+ <h1><?php _e('Check these few things below'); ?></h1>
58
+ <ul>
59
+ <li><?php _e('1. Check your spam or junk folder', 'email-subscribers')?></li>
60
+ <li><?php echo sprintf(_e('2. <a href="%s" target="_blank">Go back and send another test email</a> with different email address ', 'email-subscribers'), admin_url('admin.php?page=es_settings'))?> </li>
61
+ <li><?php echo '3. '.get_option('admin_email'); ?> address is free/disposable</li>
62
+ <li><a href="https://www.icegram.com/documentation/reasons-why-you-havent-received-the-test-email/?utm_source=es&utm_medium=es_onboarding&utm_campaign=view_docs_help_page" target="_blank" style="color: #387bff; font-weight: 500; "> <?php _e('Explore more', 'email-subscribers')?></a></li>
63
+ </ul>
64
+ <div class="">
65
+ <div class="es-gray"><?php _e('Also, it\'s a perfect time to get better at email marketing now. Sign up below to get our highly acclaimed course for free.', 'email-subscribers'); ?></div>
66
+ <form name="klawoo_subscribe" action="#" method="POST" accept-charset="utf-8" class="es-onboarding">
67
+ <input class="es-ltr" type="text" name="name" id="name" placeholder="Your Name"/> <br />
68
+ <input class="es-ltr" type="text" name="email" id="email" placeholder="Your Email" required/> <br />
69
+ <input type="hidden" name="list" value="hN8OkYzujUlKgDgfCTEcIA"/>
70
+ <input type="hidden" name="form-source" value="es_email_receive_error"/>
71
+ <input type="checkbox" name="es-gdpr-agree" id ="es-gdpr-agree" value="1" required="required">
72
+ <label for="es-gdpr-agree" style="font-size: 0.9em; color: #777777; "><?php echo sprintf(__( 'I have read and agreed to your %s.', 'email-subscribers' ), '<a href="https://www.icegram.com/privacy-policy/" target="_blank">' . __( 'Privacy Policy', 'email-subscribers' ) . '</a>' ); ?></label>
73
+ <br />
74
+ <input type="submit" name="submit" id="submit" class="button button-hero" value="<?php echo __( 'Signup and send me the course for free', 'email-subscribers' ); ?>">
75
+ <div style="text-align: center; width: 56%; margin-top: 0.5em;"><a class="es-skip" href="<?php echo admin_url('admin.php?page=es_dashboard&es_skip=1&option_name=email_receive_error'); ?>" ><?php _e('Skip and goto Dashboard', 'email-subscribers') ?></a></div>
76
+ <br>
77
+ <p id="klawoo_response"></p>
78
+ </form>
79
+ </div>
80
+ </div>
81
+ <div class="sp es-error" >
82
+ <h1>⚠️ <?php _e('Problem sending emails - fix this first.'); ?></h1>
83
+ <div style="font-weight: 500; font-size: 1.1em;"><?php _e('We faced some problems sending test Campaigns.'); ?></div>
84
+ <div class="es-email-sending-error"></div>
85
+ <div><a href="https://www.icegram.com/documentation/common-email-sending-problems/?utm_source=es&utm_medium=es_onboarding&utm_campaign=view_docs_help_page" target="_blank" style="color: #387bff; font-weight: 500; "> <?php _e('Explore more about problems', 'email-subscribers')?></a></div>
86
+ <div class="es-gray"><?php _e('Please solve these problems, without that email sending won\'t work.'); ?></div>
87
+ <div style="margin-top: 1em;">
88
+ <div class="es-gray"><?php _e('Also, it\'s a perfect time to get better at email marketing now. Sign up below to get our highly acclaimed course for free.', 'email-subscribers'); ?></div>
89
+ <form name="klawoo_subscribe" action="#" method="POST" accept-charset="utf-8" class="es-onboarding">
90
+ <input class="es-ltr" type="text" name="name" id="name" placeholder="Your Name"/> <br />
91
+ <input class="es-ltr" type="text" name="email" id="email" placeholder="Your Email" required/> <br />
92
+ <input type="hidden" name="list" value="hN8OkYzujUlKgDgfCTEcIA"/>
93
+ <input type="hidden" name="form-source" value="es_email_send_error"/>
94
+ <input type="checkbox" name="es-gdpr-agree" id ="es-gdpr-agree" value="1" required="required">
95
+ <label for="es-gdpr-agree" style="font-size: 0.9em; color: #777777; "><?php echo sprintf(__( 'I have read and agreed to your %s.', 'email-subscribers' ), '<a href="https://www.icegram.com/privacy-policy/" target="_blank">' . __( 'Privacy Policy', 'email-subscribers' ) . '</a>' ); ?></label>
96
+ <br />
97
+ <input type="submit" name="submit" id="submit" class="button button-hero" value="<?php echo __( 'Signup and send me the course for free', 'email-subscribers' ); ?>">
98
+ <div style="text-align: center; width: 56%; margin-top: 0.5em;"><a class="es-skip" href="<?php echo admin_url('admin.php?page=es_dashboard&es_skip=1&option_name=email_send_error'); ?>"><?php _e('Skip and goto Dashboard', 'email-subscribers') ?></a></div>
99
+ <br>
100
+ <p id="klawoo_response"></p>
101
+ </form>
102
+ </div>
103
+ </div>
104
+
105
+ </div>
106
+ </div>
email-subscribers.php CHANGED
@@ -3,11 +3,11 @@
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
10
- * Tested up to: 5.1.1
11
  * Text Domain: email-subscribers
12
  * Domain Path: /languages/
13
  * License: GPLv3
@@ -24,8 +24,9 @@ if ( ! defined( 'WPINC' ) ) {
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' ) ) {
31
  define( 'ES_PLUGIN_FILE', __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.1
7
  * Author: Icegram
8
  * Author URI: https://www.icegram.com/
9
  * Requires at least: 3.9
10
+ * Tested up to: 5.2
11
  * Text Domain: email-subscribers
12
  * Domain Path: /languages/
13
  * License: GPLv3
24
  * Define constants
25
  */
26
  define( 'ES_PLUGIN_DIR', dirname( __FILE__ ) );
27
+ define( 'ES_PLUGIN_VERSION', '4.1.1' );
28
  define( 'ES_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
29
+ define( 'IG_ES_DEV_MODE', false);
30
 
31
  if ( ! defined( 'ES_PLUGIN_FILE' ) ) {
32
  define( 'ES_PLUGIN_FILE', __FILE__ );
includes/admin/class-es-campaigns-table.php CHANGED
@@ -251,10 +251,10 @@ class ES_Campaigns_Table extends WP_List_Table {
251
  function get_columns() {
252
  $columns = array(
253
  'cb' => '<input type="checkbox" />',
254
- 'base_template_id' => __( 'Name', 'sp' ),
255
- 'type' => __( 'Type', 'sp' ),
256
- 'list_ids' => __( 'List', 'sp' ),
257
- 'status' => __( 'Status', 'sp' )
258
  );
259
 
260
  return $columns;
@@ -338,7 +338,7 @@ class ES_Campaigns_Table extends WP_List_Table {
338
  $status = 'success';
339
  }
340
 
341
- $this->show_message( $message, $status );
342
  }
343
 
344
  $action = Email_Subscribers::get_request( 'action' );
@@ -354,12 +354,12 @@ class ES_Campaigns_Table extends WP_List_Table {
354
 
355
  if ( $deleted ) {
356
  $message = __( 'Campaign(s) have been deleted successfully!', 'email-subscribers' );
357
- $this->show_message( $message );
358
  }
359
  } else {
360
 
361
  $message = __( 'Please check campaign(s) to delete.', 'email-subscribers' );
362
- $this->show_message( $message, 'error' );
363
  }
364
 
365
 
@@ -433,17 +433,6 @@ class ES_Campaigns_Table extends WP_List_Table {
433
  return $arrNotification;
434
 
435
  }
436
-
437
-
438
- public function show_message( $message = '', $status = 'success' ) {
439
-
440
- $class = 'notice notice-success is-dismissible';
441
- if ( 'error' === $status ) {
442
- $class = 'notice notice-error is-dismissible';
443
- }
444
- echo "<div class='{$class}'><p>{$message}</p></div>";
445
- }
446
-
447
  }
448
 
449
  // add_action( 'admin_menu', function () {
251
  function get_columns() {
252
  $columns = array(
253
  'cb' => '<input type="checkbox" />',
254
+ 'base_template_id' => __( 'Name', 'email-subscribers' ),
255
+ 'type' => __( 'Type', 'email-subscribers' ),
256
+ 'list_ids' => __( 'List', 'email-subscribers' ),
257
+ 'status' => __( 'Status', 'email-subscribers' )
258
  );
259
 
260
  return $columns;
338
  $status = 'success';
339
  }
340
 
341
+ ES_Common::show_message( $message, $status );
342
  }
343
 
344
  $action = Email_Subscribers::get_request( 'action' );
354
 
355
  if ( $deleted ) {
356
  $message = __( 'Campaign(s) have been deleted successfully!', 'email-subscribers' );
357
+ ES_Common::show_message( $message );
358
  }
359
  } else {
360
 
361
  $message = __( 'Please check campaign(s) to delete.', 'email-subscribers' );
362
+ ES_Common::show_message( $message, 'error' );
363
  }
364
 
365
 
433
  return $arrNotification;
434
 
435
  }
 
 
 
 
 
 
 
 
 
 
 
436
  }
437
 
438
  // add_action( 'admin_menu', function () {
includes/admin/class-es-export-subscribers.php CHANGED
@@ -25,7 +25,7 @@ class Export_Subscribers {
25
 
26
  if ( empty( $csv ) ) {
27
  $message = __( "No data available", 'email-subscribers' );
28
- $this->show_message( $message, 'error' );
29
  exit();
30
  } else {
31
  header( "Pragma: public" );
@@ -96,13 +96,17 @@ class Export_Subscribers {
96
  }
97
 
98
  public function export_subscribers_page() {
 
 
 
 
 
99
  ?>
100
  <div class="wrap">
101
  <h2 style="margin-bottom:1em;">
102
- <?php _e( 'Audience > Export Contacts', 'email-subscribers' ); ?>
103
- <a class="add-new-h2" href="admin.php?page=es_subscribers&action=new"><?php _e( 'Add New Contact', 'email-subscribers' ); ?></a>
104
- <a href="admin.php?page=es_subscribers&action=import" class="page-title-action"><?php _e( 'Import Contacts', 'email-subscribers' ); ?></a>
105
- <a href="admin.php?page=es_lists" class="page-title-action es-imp-button"><?php _e( 'Manage Lists', 'email-subscribers' ); ?></a>
106
  </h2>
107
  <div class="tool-box">
108
  <form name="frm_es_subscriberexport" method="post">
@@ -243,15 +247,5 @@ class Export_Subscribers {
243
  return $csv_output;
244
  }
245
 
246
- public function show_message( $message = '', $status = 'success' ) {
247
-
248
- $class = 'notice notice-success is-dismissible';
249
- if ( 'error' === $status ) {
250
- $class = 'notice notice-error is-dismissible';
251
- }
252
- echo "<div class='{$class}'><p>{$message}</p></div>";
253
- }
254
-
255
-
256
  }
257
 
25
 
26
  if ( empty( $csv ) ) {
27
  $message = __( "No data available", 'email-subscribers' );
28
+ ES_Common::show_message( $message, 'error' );
29
  exit();
30
  } else {
31
  header( "Pragma: public" );
96
  }
97
 
98
  public function export_subscribers_page() {
99
+
100
+ $audience_tab_main_navigation = array();
101
+ $active_tab = 'export';
102
+ $audience_tab_main_navigation = apply_filters( 'ig_es_audience_tab_main_navigation', $active_tab, $audience_tab_main_navigation );
103
+
104
  ?>
105
  <div class="wrap">
106
  <h2 style="margin-bottom:1em;">
107
+ <?php _e( 'Audience > Export Contacts', 'email-subscribers' );
108
+ ES_Common::prepare_main_header_navigation($audience_tab_main_navigation);
109
+ ?>
 
110
  </h2>
111
  <div class="tool-box">
112
  <form name="frm_es_subscriberexport" method="post">
247
  return $csv_output;
248
  }
249
 
 
 
 
 
 
 
 
 
 
 
250
  }
251
 
includes/admin/class-es-forms-table.php CHANGED
@@ -129,7 +129,7 @@ class ES_Forms_Table extends WP_List_Table {
129
 
130
  if ( 'error' === $response['status'] ) {
131
  $message = $response['message'];
132
- $this->show_message( $message, 'error' );
133
  $this->prepare_list_form( null, $form_data );
134
 
135
  return;
@@ -137,7 +137,7 @@ class ES_Forms_Table extends WP_List_Table {
137
 
138
  $this->save_form( null, $form_data );
139
  $message = __( 'Form has been added successfully!', 'email-subscribers' );
140
- $this->show_message( $message, 'success' );
141
  }
142
 
143
  $this->prepare_list_form();
@@ -174,7 +174,7 @@ class ES_Forms_Table extends WP_List_Table {
174
 
175
  if ( 'error' === $response['status'] ) {
176
  $message = $response['message'];
177
- $this->show_message( $message, 'error' );
178
  $this->prepare_list_form( $id, $form_data );
179
 
180
  return;
@@ -182,7 +182,7 @@ class ES_Forms_Table extends WP_List_Table {
182
 
183
  $this->save_form( $id, $form_data );
184
  $message = __( 'Form has been updated successfully!', 'email-subscribers' );
185
- $this->show_message( $message, 'success' );
186
  } else {
187
 
188
  $data = $data[0];
@@ -191,7 +191,7 @@ class ES_Forms_Table extends WP_List_Table {
191
  }
192
  } else {
193
  $message = __( 'Sorry, form not found', 'email-subscribers' );
194
- $this->show_message( $message, 'error' );
195
  }
196
 
197
  $this->prepare_list_form( $id, $form_data );
@@ -345,7 +345,7 @@ class ES_Forms_Table extends WP_List_Table {
345
  $lists_page_url = admin_url( 'admin.php?page=es_lists' );
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
  ?>
@@ -732,14 +732,14 @@ class ES_Forms_Table extends WP_List_Table {
732
 
733
  if ( ! wp_verify_nonce( $nonce, 'es_form' ) ) {
734
  $message = __( 'You do not have permission to delete this form.', 'email-subscribers' );
735
- $this->show_message( $message, 'error' );
736
  } else {
737
 
738
  $form = Email_Subscribers::get_request( 'form' );
739
 
740
  $this->delete_list( array( $form ) );
741
  $message = __( 'Form has been deleted successfully!', 'email-subscribers' );
742
- $this->show_message( $message, 'success' );
743
  }
744
  }
745
 
@@ -754,25 +754,16 @@ class ES_Forms_Table extends WP_List_Table {
754
  $this->delete_list( $forms );
755
 
756
  $message = __( 'Form(s) have been deleted successfully!', 'email-subscribers' );
757
- $this->show_message( $message, 'success' );
758
  } else {
759
  $message = __( 'Please select form(s) to delete.', 'email-subscribers' );
760
- $this->show_message( $message, 'error' );
761
 
762
  return;
763
  }
764
  }
765
  }
766
 
767
- public function show_message( $message = '', $status = 'success' ) {
768
-
769
- $class = 'notice notice-success is-dismissible';
770
- if ( 'error' === $status ) {
771
- $class = 'notice notice-error is-dismissible';
772
- }
773
- echo "<div class='{$class}'><p>{$message}</p></div>";
774
- }
775
-
776
  public function status_label_map( $status ) {
777
 
778
  $statuses = array(
129
 
130
  if ( 'error' === $response['status'] ) {
131
  $message = $response['message'];
132
+ ES_Common::show_message( $message, 'error' );
133
  $this->prepare_list_form( null, $form_data );
134
 
135
  return;
137
 
138
  $this->save_form( null, $form_data );
139
  $message = __( 'Form has been added successfully!', 'email-subscribers' );
140
+ ES_Common::show_message( $message, 'success' );
141
  }
142
 
143
  $this->prepare_list_form();
174
 
175
  if ( 'error' === $response['status'] ) {
176
  $message = $response['message'];
177
+ ES_Common::show_message( $message, 'error' );
178
  $this->prepare_list_form( $id, $form_data );
179
 
180
  return;
182
 
183
  $this->save_form( $id, $form_data );
184
  $message = __( 'Form has been updated successfully!', 'email-subscribers' );
185
+ ES_Common::show_message( $message, 'success' );
186
  } else {
187
 
188
  $data = $data[0];
191
  }
192
  } else {
193
  $message = __( 'Sorry, form not found', 'email-subscribers' );
194
+ ES_Common::show_message( $message, 'error' );
195
  }
196
 
197
  $this->prepare_list_form( $id, $form_data );
345
  $lists_page_url = admin_url( 'admin.php?page=es_lists' );
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
+ ES_Common::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
  ?>
732
 
733
  if ( ! wp_verify_nonce( $nonce, 'es_form' ) ) {
734
  $message = __( 'You do not have permission to delete this form.', 'email-subscribers' );
735
+ ES_Common::show_message( $message, 'error' );
736
  } else {
737
 
738
  $form = Email_Subscribers::get_request( 'form' );
739
 
740
  $this->delete_list( array( $form ) );
741
  $message = __( 'Form has been deleted successfully!', 'email-subscribers' );
742
+ ES_Common::show_message( $message, 'success' );
743
  }
744
  }
745
 
754
  $this->delete_list( $forms );
755
 
756
  $message = __( 'Form(s) have been deleted successfully!', 'email-subscribers' );
757
+ ES_Common::show_message( $message, 'success' );
758
  } else {
759
  $message = __( 'Please select form(s) to delete.', 'email-subscribers' );
760
+ ES_Common::show_message( $message, 'error' );
761
 
762
  return;
763
  }
764
  }
765
  }
766
 
 
 
 
 
 
 
 
 
 
767
  public function status_label_map( $status ) {
768
 
769
  $statuses = array(
includes/admin/class-es-handle-subscription.php CHANGED
@@ -270,7 +270,7 @@ class ES_Handle_Subscription {
270
  }
271
 
272
  $template_data = array(
273
- 'name' => ES_Common::prepare_name_from_first_name_last_name($this->first_name, $this->last_name),
274
  'email' => $this->email,
275
  'list_name' => $list_name
276
  );
@@ -292,11 +292,16 @@ class ES_Handle_Subscription {
292
 
293
  if ( ! $this->from_rainmaker ) {
294
  //honey-pot validation
295
- $hp_key = "esfpx_es_hp_" . wp_create_nonce( 'es_hp' );
296
- if ( ! isset( $data[ $hp_key ] ) || ! empty( $data[ $hp_key ] ) ) {
297
- $es_response['message'] = 'es_unexpected_error_notice';
298
-
299
- return $es_response;
 
 
 
 
 
300
  }
301
 
302
  }
@@ -342,6 +347,7 @@ class ES_Handle_Subscription {
342
  $timeout = ES_Subscription_Throttaling::throttle();
343
  if ( $timeout > 0 ) {
344
  $response['message'] = 'es_rate_limit_notice';
 
345
  return $response;
346
  }
347
 
@@ -356,7 +362,7 @@ class ES_Handle_Subscription {
356
 
357
  $domains = explode( PHP_EOL, $domains );
358
 
359
- $domains = apply_filters('ig_es_blocked_domains', $domains);
360
 
361
  if ( empty( $domains ) ) {
362
  return false;
270
  }
271
 
272
  $template_data = array(
273
+ 'name' => ES_Common::prepare_name_from_first_name_last_name( $this->first_name, $this->last_name ),
274
  'email' => $this->email,
275
  'list_name' => $list_name
276
  );
292
 
293
  if ( ! $this->from_rainmaker ) {
294
  //honey-pot validation
295
+ //$hp_key = "esfpx_es_hp_" . wp_create_nonce( 'es_hp' );
296
+ $data_keys = array_keys( $data );
297
+ $hp_key = "esfpx_es_hp_";
298
+ foreach ( $data_keys as $i => $key ) {
299
+ if ( strpos( $key, $hp_key ) === 0) {
300
+ if ( ! isset( $data[ $data_keys[ $i ] ] ) || ! empty( $data[ $data_keys[ $i ] ] ) ) {
301
+ $es_response['message'] = 'es_unexpected_error_notice';
302
+ return $es_response;
303
+ }
304
+ }
305
  }
306
 
307
  }
347
  $timeout = ES_Subscription_Throttaling::throttle();
348
  if ( $timeout > 0 ) {
349
  $response['message'] = 'es_rate_limit_notice';
350
+
351
  return $response;
352
  }
353
 
362
 
363
  $domains = explode( PHP_EOL, $domains );
364
 
365
+ $domains = apply_filters( 'ig_es_blocked_domains', $domains );
366
 
367
  if ( empty( $domains ) ) {
368
  return false;
includes/admin/class-es-handle-sync-wp-user.php CHANGED
@@ -13,8 +13,11 @@ class ES_Handle_Sync_Wp_User {
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
 
@@ -130,12 +133,16 @@ class ES_Handle_Sync_Wp_User {
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>
138
- <a href="admin.php?page=es_lists" class="page-title-action es-imp-button"><?php _e( 'Manage Lists', 'email-subscribers' ); ?></a>
139
  </h2>
140
  <?php $this->sync_users_callback(); ?>
141
  </div>
@@ -163,14 +170,26 @@ class ES_Handle_Sync_Wp_User {
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
13
 
14
  }
15
 
16
+ public function sync_wordpress_users_settings( $wordpress_tab ) {
17
 
18
+ if ( ! empty( $wordpress_tab['indicator_option'] ) ) {
19
+ update_option( $wordpress_tab['indicator_option'], 'no' );
20
+ }
21
  if ( ! empty( $_POST['submitted'] ) && 'submitted' === $_POST['submitted'] ) {
22
  $form_data = $_POST['form_data'];
23
 
133
  }
134
 
135
  public function prepare_sync_user() {
136
+
137
+ $audience_tab_main_navigation = array();
138
+ $active_tab = 'sync';
139
+ $audience_tab_main_navigation = apply_filters( 'ig_es_audience_tab_main_navigation', $active_tab, $audience_tab_main_navigation );
140
+
141
  ?>
142
  <div class="wrap">
143
+ <h2> <?php _e( 'Audience > Sync Contacts', 'email-subscribers' );
144
+ ES_Common::prepare_main_header_navigation($audience_tab_main_navigation);
145
+ ?>
 
146
  </h2>
147
  <?php $this->sync_users_callback(); ?>
148
  </div>
170
  <?php foreach ( $tabs as $key => $tab ) {
171
  $tab_url = admin_url( 'admin.php?page=es_subscribers&action=sync' );
172
  $tab_url = add_query_arg( 'tab', $key, $tab_url );
173
+
174
+ $indicator_option = ! empty( $tab['indicator_option'] ) ? $tab['indicator_option'] : '';
175
+ $indicator_label = '';
176
+ $indicator_class = '';
177
+ if ( ! empty( $indicator_option ) && ( get_option( $indicator_option, 'yes' ) == 'yes' ) ) {
178
+ $indicator_label = ! empty( $tab['indicator_label'] ) ? $tab['indicator_label'] : '';
179
+ $indicator_class = ! empty( $tab['indicator_type'] ) ? 'ig-es-indicator-' . $tab['indicator_type'] : 'ig-es-indicator-new';
180
+ }
181
  ?>
182
+ <a class="nav-tab <?php echo $key === $active_tab ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( $tab_url ); ?>"><?php echo esc_html__( $tab['name'] ); ?>
183
+ <?php if ( ! empty( $indicator_label ) ) { ?>
184
+ <span class="ig-es-indicator<?php echo " " . $indicator_class; ?>"><?php echo $indicator_label; ?></span>
185
+ <?php } ?>
186
+ </a>
187
  <?php } ?>
188
  </h2>
189
  <form name="form_sync" id="form_sync" method="post" action="#">
190
  <?php
191
  $from = ! empty( $tabs[ $active_tab ]['from'] ) ? $tabs[ $active_tab ]['from'] . '_' : '';
192
+ do_action( $from . 'ig_es_sync_users_tabs_' . $active_tab, $tabs[ $active_tab ] ); ?>
193
  </form>
194
 
195
  <?php
includes/admin/class-es-import-subscribers.php CHANGED
@@ -131,27 +131,27 @@ class ES_Import_Subscribers {
131
  }
132
 
133
  fclose( $handle );
134
- $this->show_message( $message, $status );
135
 
136
  } else {
137
  $message = __( "Error: Please Select List", 'email-subscribers' );
138
- $this->show_message( $message, 'error' );
139
  }
140
  } else {
141
  $message = __( "Error: Please select status", 'email-subscribers' );
142
- $this->show_message( $message, 'error' );
143
  }
144
  } else {
145
  $message = __( "Error: Please Upload only CSV File", 'email-subscribers' );
146
- $this->show_message( $message, 'error' );
147
  }
148
  } else {
149
  $message = __( "Error: Please Upload File", 'email-subscribers' );
150
- $this->show_message( $message, 'error' );
151
  }
152
  } else {
153
  $message = __( "Error: Please Upload File", 'email-subscribers' );
154
- $this->show_message( $message, 'error' );
155
  }
156
  }
157
 
@@ -215,13 +215,20 @@ class ES_Import_Subscribers {
215
  <?php
216
  }
217
 
218
- public function import_subscribers_page() { ?>
 
 
 
 
 
 
219
 
220
  <div class="wrap">
221
- <h2> <?php _e( 'Audience > Import Contacts', 'email-subscribers' ); ?>
222
- <a href="admin.php?page=es_subscribers&action=new" class="page-title-action"><?php _e( 'Add New Contact', 'email-subscribers' ); ?></a>
223
- <a href="admin.php?page=es_subscribers&action=export" class="page-title-action"><?php _e( 'Export Contacts', 'email-subscribers' ); ?></a>
224
- <a href="admin.php?page=es_lists" class="page-title-action es-imp-button"><?php _e( 'Manage Lists', 'email-subscribers' ); ?></a>
 
225
  </h2>
226
  <?php $this->import_report_callback(); ?>
227
  </div>
@@ -229,13 +236,5 @@ class ES_Import_Subscribers {
229
  <?php
230
  }
231
 
232
- public function show_message( $message = '', $status = 'success' ) {
233
-
234
- $class = 'notice notice-success is-dismissible';
235
- if ( 'error' === $status ) {
236
- $class = 'notice notice-error is-dismissible';
237
- }
238
- echo "<div class='{$class}'><p>{$message}</p></div>";
239
- }
240
  }
241
 
131
  }
132
 
133
  fclose( $handle );
134
+ ES_Common::show_message( $message, $status );
135
 
136
  } else {
137
  $message = __( "Error: Please Select List", 'email-subscribers' );
138
+ ES_Common::show_message( $message, 'error' );
139
  }
140
  } else {
141
  $message = __( "Error: Please select status", 'email-subscribers' );
142
+ ES_Common::show_message( $message, 'error' );
143
  }
144
  } else {
145
  $message = __( "Error: Please Upload only CSV File", 'email-subscribers' );
146
+ ES_Common::show_message( $message, 'error' );
147
  }
148
  } else {
149
  $message = __( "Error: Please Upload File", 'email-subscribers' );
150
+ ES_Common::show_message( $message, 'error' );
151
  }
152
  } else {
153
  $message = __( "Error: Please Upload File", 'email-subscribers' );
154
+ ES_Common::show_message( $message, 'error' );
155
  }
156
  }
157
 
215
  <?php
216
  }
217
 
218
+ public function import_subscribers_page() {
219
+
220
+ $audience_tab_main_navigation = array();
221
+ $active_tab = 'import';
222
+ $audience_tab_main_navigation = apply_filters( 'ig_es_audience_tab_main_navigation', $active_tab, $audience_tab_main_navigation );
223
+
224
+ ?>
225
 
226
  <div class="wrap">
227
+ <h2> <?php _e( 'Audience > Import Contacts', 'email-subscribers' );
228
+
229
+ ES_Common::prepare_main_header_navigation($audience_tab_main_navigation);
230
+ ?>
231
+
232
  </h2>
233
  <?php $this->import_report_callback(); ?>
234
  </div>
236
  <?php
237
  }
238
 
 
 
 
 
 
 
 
 
239
  }
240
 
includes/admin/class-es-lists-table.php CHANGED
@@ -16,8 +16,8 @@ class ES_Lists_Table extends WP_List_Table {
16
  public function __construct() {
17
 
18
  parent::__construct( array(
19
- 'singular' => __( 'List', 'sp' ), //singular name of the listed records
20
- 'plural' => __( 'Lists', 'sp' ), //plural name of the listed records
21
  'ajax' => false, //does this table support ajax?,
22
  'screen' => 'es_lists'
23
  ) );
@@ -114,7 +114,7 @@ class ES_Lists_Table extends WP_List_Table {
114
 
115
  if ( 'error' === $response['status'] ) {
116
  $message = $response['message'];
117
- $this->show_message( $message, 'error' );
118
  $this->prepare_list_form( null, $validate_data );
119
 
120
  return;
@@ -126,7 +126,7 @@ class ES_Lists_Table extends WP_List_Table {
126
 
127
  $this->save_list( null, $data );
128
  $message = __( 'List has been added successfully!', 'email-subscribers' );
129
- $this->show_message( $message, 'success' );
130
  }
131
 
132
  $this->prepare_list_form();
@@ -155,7 +155,7 @@ class ES_Lists_Table extends WP_List_Table {
155
 
156
  if ( 'error' === $response['status'] ) {
157
  $message = $response['message'];
158
- $this->show_message( $message, 'error' );
159
  $this->prepare_list_form( $id, $validate_data );
160
 
161
  return;
@@ -167,7 +167,7 @@ class ES_Lists_Table extends WP_List_Table {
167
 
168
  $this->save_list( $id, $data );
169
  $message = __( 'List has been updated successfully!', 'email-subscribers' );
170
- $this->show_message( $message, 'success' );
171
  } else {
172
  $id = $list[0]->id;
173
 
@@ -510,11 +510,11 @@ class ES_Lists_Table extends WP_List_Table {
510
 
511
  if ( ! wp_verify_nonce( $nonce, 'es_list' ) ) {
512
  $message = __( 'You do not have permission to edit list', 'email-subscribers' );
513
- $this->show_message( $message, 'error' );
514
  } else {
515
  $this->edit_list( absint( Email_Subscribers::get_request( 'list' ) ) );
516
  $message = __( 'List has been updated successfully!', 'email-subscribers' );
517
- $this->show_message( $message, 'success' );
518
  }
519
 
520
  }
@@ -526,12 +526,12 @@ class ES_Lists_Table extends WP_List_Table {
526
 
527
  if ( ! wp_verify_nonce( $nonce, 'es_list' ) ) {
528
  $message = __( 'You do not have permission to delete list', 'email-subscribers' );
529
- $this->show_message( $message, 'error' );
530
  } else {
531
  if ( Email_Subscribers::get_request( 'list' ) != 1 ) {
532
  $this->delete_list( array( absint( Email_Subscribers::get_request( 'list' ) ) ) );
533
  $message = __( 'List has been deleted successfully!', 'email-subscribers' );
534
- $this->show_message( $message, 'success' );
535
  }
536
  }
537
  }
@@ -546,25 +546,16 @@ class ES_Lists_Table extends WP_List_Table {
546
  if ( ! empty( $lists ) > 0 ) {
547
  $this->delete_list( $lists );
548
  $message = __( 'List(s) have been deleted successfully', 'email-subscribers' );
549
- $this->show_message( $message, 'success' );
550
  } else {
551
  $message = __( 'Please select list', 'email-subscribers' );
552
- $this->show_message( $message, 'error' );
553
 
554
  return;
555
  }
556
  }
557
  }
558
 
559
- public function show_message( $message = '', $status = 'success' ) {
560
-
561
- $class = 'notice notice-success is-dismissible';
562
- if ( 'error' === $status ) {
563
- $class = 'notice notice-error is-dismissible';
564
- }
565
- echo "<div class='{$class}'><p>{$message}</p></div>";
566
- }
567
-
568
  public function status_label_map( $status ) {
569
 
570
  $statuses = array(
@@ -581,7 +572,7 @@ class ES_Lists_Table extends WP_List_Table {
581
 
582
  /** Text displayed when no list data is available */
583
  public function no_items() {
584
- _e( 'No lists avaliable.', 'sp' );
585
  }
586
 
587
  public static function get_instance() {
16
  public function __construct() {
17
 
18
  parent::__construct( array(
19
+ 'singular' => __( 'List', 'email-subscribers' ), //singular name of the listed records
20
+ 'plural' => __( 'Lists', 'email-subscribers' ), //plural name of the listed records
21
  'ajax' => false, //does this table support ajax?,
22
  'screen' => 'es_lists'
23
  ) );
114
 
115
  if ( 'error' === $response['status'] ) {
116
  $message = $response['message'];
117
+ ES_Common::show_message( $message, 'error' );
118
  $this->prepare_list_form( null, $validate_data );
119
 
120
  return;
126
 
127
  $this->save_list( null, $data );
128
  $message = __( 'List has been added successfully!', 'email-subscribers' );
129
+ ES_Common::show_message( $message, 'success' );
130
  }
131
 
132
  $this->prepare_list_form();
155
 
156
  if ( 'error' === $response['status'] ) {
157
  $message = $response['message'];
158
+ ES_Common::show_message( $message, 'error' );
159
  $this->prepare_list_form( $id, $validate_data );
160
 
161
  return;
167
 
168
  $this->save_list( $id, $data );
169
  $message = __( 'List has been updated successfully!', 'email-subscribers' );
170
+ ES_Common::show_message( $message, 'success' );
171
  } else {
172
  $id = $list[0]->id;
173
 
510
 
511
  if ( ! wp_verify_nonce( $nonce, 'es_list' ) ) {
512
  $message = __( 'You do not have permission to edit list', 'email-subscribers' );
513
+ ES_Common::show_message( $message, 'error' );
514
  } else {
515
  $this->edit_list( absint( Email_Subscribers::get_request( 'list' ) ) );
516
  $message = __( 'List has been updated successfully!', 'email-subscribers' );
517
+ ES_Common::show_message( $message, 'success' );
518
  }
519
 
520
  }
526
 
527
  if ( ! wp_verify_nonce( $nonce, 'es_list' ) ) {
528
  $message = __( 'You do not have permission to delete list', 'email-subscribers' );
529
+ ES_Common::show_message( $message, 'error' );
530
  } else {
531
  if ( Email_Subscribers::get_request( 'list' ) != 1 ) {
532
  $this->delete_list( array( absint( Email_Subscribers::get_request( 'list' ) ) ) );
533
  $message = __( 'List has been deleted successfully!', 'email-subscribers' );
534
+ ES_Common::show_message( $message, 'success' );
535
  }
536
  }
537
  }
546
  if ( ! empty( $lists ) > 0 ) {
547
  $this->delete_list( $lists );
548
  $message = __( 'List(s) have been deleted successfully', 'email-subscribers' );
549
+ ES_Common::show_message( $message, 'success' );
550
  } else {
551
  $message = __( 'Please select list', 'email-subscribers' );
552
+ ES_Common::show_message( $message, 'error' );
553
 
554
  return;
555
  }
556
  }
557
  }
558
 
 
 
 
 
 
 
 
 
 
559
  public function status_label_map( $status ) {
560
 
561
  $statuses = array(
572
 
573
  /** Text displayed when no list data is available */
574
  public function no_items() {
575
+ _e( 'No lists avaliable.', 'email-subscribers' );
576
  }
577
 
578
  public static function get_instance() {
includes/admin/class-es-newsletters.php CHANGED
@@ -44,10 +44,10 @@ class ES_Newsletters {
44
 
45
  if ( empty( $template_id ) ) {
46
  $message = __( 'Please select template.', 'email-subscribers' );
47
- $this->show_message( $message, 'error' );
48
  } elseif ( empty( $list_id ) ) {
49
  $message = __( 'Please select list.', 'email-subscribers' );
50
- $this->show_message( $message, 'error' );
51
  }
52
 
53
  $data = array(
@@ -61,7 +61,7 @@ class ES_Newsletters {
61
  $reports_url = admin_url('admin.php?page=es_reports');
62
  $message = __( sprintf( 'A new broadcast has been created successfully! Contacts from selected list will be notified within an hour. Want to notify now? <a href="%s" target="_blank">Click here</a>', $reports_url ), 'email-subscribers' );
63
 
64
- $this->show_message( $message, 'success' );
65
  }
66
 
67
  $this->prepare_newsletter_settings_form();
@@ -242,15 +242,6 @@ class ES_Newsletters {
242
 
243
  }
244
 
245
- public function show_message( $message = '', $status = 'success' ) {
246
-
247
- $class = 'notice notice-success is-dismissible';
248
- if ( 'error' === $status ) {
249
- $class = 'notice notice-error is-dismissible';
250
- }
251
- echo "<div class='{$class}'><p>{$message}</p></div>";
252
- }
253
-
254
  public static function get_instance() {
255
  if ( ! isset( self::$instance ) ) {
256
  self::$instance = new self();
44
 
45
  if ( empty( $template_id ) ) {
46
  $message = __( 'Please select template.', 'email-subscribers' );
47
+ ES_Common::show_message( $message, 'error' );
48
  } elseif ( empty( $list_id ) ) {
49
  $message = __( 'Please select list.', 'email-subscribers' );
50
+ ES_Common::show_message( $message, 'error' );
51
  }
52
 
53
  $data = array(
61
  $reports_url = admin_url('admin.php?page=es_reports');
62
  $message = __( sprintf( 'A new broadcast has been created successfully! Contacts from selected list will be notified within an hour. Want to notify now? <a href="%s" target="_blank">Click here</a>', $reports_url ), 'email-subscribers' );
63
 
64
+ ES_Common::show_message( $message, 'success' );
65
  }
66
 
67
  $this->prepare_newsletter_settings_form();
242
 
243
  }
244
 
 
 
 
 
 
 
 
 
 
245
  public static function get_instance() {
246
  if ( ! isset( self::$instance ) ) {
247
  self::$instance = new self();
includes/admin/class-es-post-notifications.php CHANGED
@@ -40,7 +40,7 @@ class ES_Post_Notifications_Table {
40
 
41
  if ( empty( $list_id ) ) {
42
  $message = __( 'Please select list.', 'email-subscribers' );
43
- $this->show_message( $message, 'error' );
44
  $this->prepare_post_notification_form();
45
 
46
  return;
@@ -48,7 +48,7 @@ class ES_Post_Notifications_Table {
48
 
49
  if ( empty( $template_id ) ) {
50
  $message = __( 'Please select template.', 'email-subscribers' );
51
- $this->show_message( $message, 'error' );
52
  $this->prepare_post_notification_form();
53
 
54
  return;
@@ -56,7 +56,7 @@ class ES_Post_Notifications_Table {
56
 
57
  if ( empty( $cat ) ) {
58
  $message = __( 'Please select categories.', 'email-subscribers' );
59
- $this->show_message( $message, 'error' );
60
  $this->prepare_post_notification_form();
61
 
62
  return;
@@ -77,7 +77,7 @@ class ES_Post_Notifications_Table {
77
 
78
  $this->save_list( $data );
79
  $message = __( 'Post notification has been added successfully!', 'email-subscribers' );
80
- $this->show_message( $message, 'success' );
81
  }
82
 
83
  $this->prepare_post_notification_form();
@@ -189,7 +189,7 @@ class ES_Post_Notifications_Table {
189
 
190
  $data['categories'] = ES_Common::convert_categories_string_to_array($data['categories']);
191
  $message = __( 'Post notification has been updated successfully!', 'email-subscribers' );
192
- $this->show_message( $message, 'success' );
193
  } else {
194
 
195
  $notification = array_shift( $notifications );
@@ -218,7 +218,7 @@ class ES_Post_Notifications_Table {
218
  $heading = __( 'Campaigns > New Post Notification', 'email-subscribers' );
219
  if ( ! $is_new ) {
220
  $action = 'edit';
221
- $heading = __( 'Campigns > Edit Post Notification', 'email-subscribers' );
222
  }
223
  $cat = isset( $data['categories'] ) ? $data['categories'] : '';
224
  $list_id = isset( $data['list_ids'] ) ? $data['list_ids'] : '';
@@ -351,16 +351,6 @@ class ES_Post_Notifications_Table {
351
  <?php
352
  }
353
 
354
- public function show_message( $message = '', $status = 'success' ) {
355
-
356
- $class = 'notice notice-success is-dismissible';
357
- if ( 'error' === $status ) {
358
- $class = 'notice notice-error is-dismissible';
359
- }
360
- echo "<div class='{$class}'><p>{$message}</p></div>";
361
- }
362
-
363
-
364
  public static function get_instance() {
365
  if ( ! isset( self::$instance ) ) {
366
  self::$instance = new self();
40
 
41
  if ( empty( $list_id ) ) {
42
  $message = __( 'Please select list.', 'email-subscribers' );
43
+ ES_Common::show_message( $message, 'error' );
44
  $this->prepare_post_notification_form();
45
 
46
  return;
48
 
49
  if ( empty( $template_id ) ) {
50
  $message = __( 'Please select template.', 'email-subscribers' );
51
+ ES_Common::show_message( $message, 'error' );
52
  $this->prepare_post_notification_form();
53
 
54
  return;
56
 
57
  if ( empty( $cat ) ) {
58
  $message = __( 'Please select categories.', 'email-subscribers' );
59
+ ES_Common::show_message( $message, 'error' );
60
  $this->prepare_post_notification_form();
61
 
62
  return;
77
 
78
  $this->save_list( $data );
79
  $message = __( 'Post notification has been added successfully!', 'email-subscribers' );
80
+ ES_Common::show_message( $message, 'success' );
81
  }
82
 
83
  $this->prepare_post_notification_form();
189
 
190
  $data['categories'] = ES_Common::convert_categories_string_to_array($data['categories']);
191
  $message = __( 'Post notification has been updated successfully!', 'email-subscribers' );
192
+ ES_Common::show_message( $message, 'success' );
193
  } else {
194
 
195
  $notification = array_shift( $notifications );
218
  $heading = __( 'Campaigns > New Post Notification', 'email-subscribers' );
219
  if ( ! $is_new ) {
220
  $action = 'edit';
221
+ $heading = __( 'Campaigns > Edit Post Notification', 'email-subscribers' );
222
  }
223
  $cat = isset( $data['categories'] ) ? $data['categories'] : '';
224
  $list_id = isset( $data['list_ids'] ) ? $data['list_ids'] : '';
351
  <?php
352
  }
353
 
 
 
 
 
 
 
 
 
 
 
354
  public static function get_instance() {
355
  if ( ! isset( self::$instance ) ) {
356
  self::$instance = new self();
includes/admin/class-es-reports-table.php CHANGED
@@ -93,7 +93,7 @@ class ES_Reports_Table extends WP_List_Table {
93
  ?>
94
 
95
  <tr>
96
- <th width="3%" scope="col"><?php _e( 'No', 'email-subscribers' ); ?></th>
97
  <th scope="col"><?php _e( 'Email', 'email-subscribers' ); ?></th>
98
  <th scope="col"><?php _e( 'Status', 'email-subscribers' ); ?></th>
99
  <th scope="col"><?php _e( 'Sent Date', 'email-subscribers' ); ?></th>
@@ -366,7 +366,7 @@ class ES_Reports_Table extends WP_List_Table {
366
 
367
  if ( ! wp_verify_nonce( $nonce, 'es_notification' ) ) {
368
  $message = __( 'You do not have permission to view notification', 'email-subscribers' );
369
- $this->show_message( $message, 'error' );
370
  } else {
371
  $this->view_list( Email_Subscribers::get_request( 'list' ) );
372
  }
@@ -378,12 +378,12 @@ class ES_Reports_Table extends WP_List_Table {
378
 
379
  if ( ! wp_verify_nonce( $nonce, 'es_notification' ) ) {
380
  $message = __( 'You do not have permission to delete notification', 'email-subscribers' );
381
- $this->show_message( $message, 'error' );
382
  } else {
383
  ES_DB_Mailing_Queue::delete_notifications( array( absint( Email_Subscribers::get_request( 'list' ) ) ) );
384
  ES_DB_Sending_Queue::delete_sending_queue_by_mailing_id( array( absint( Email_Subscribers::get_request( 'list' ) ) ) );
385
  $message = __( 'Report has been deleted successfully!', 'email-subscribers' );
386
- $this->show_message( $message, 'success' );
387
  }
388
 
389
  } elseif ( 'preview' === $this->current_action() ) {
@@ -392,7 +392,7 @@ class ES_Reports_Table extends WP_List_Table {
392
 
393
  if ( ! wp_verify_nonce( $nonce, 'es_notification' ) ) {
394
  $message = __( 'You do not have permission to preview notification', 'email-subscribers' );
395
- $this->show_message( $message, 'error' );
396
  } else {
397
  $report_id = Email_Subscribers::get_request( 'list' );
398
  echo $this->preview_email( $report_id );
@@ -410,21 +410,12 @@ class ES_Reports_Table extends WP_List_Table {
410
  ES_DB_Mailing_Queue::delete_notifications( $notification_ids );
411
  ES_DB_Sending_Queue::delete_sending_queue_by_mailing_id( $notification_ids );
412
  $message = __( 'Reports have been deleted successfully!', 'email-subscribers' );
413
- $this->show_message( $message, 'success' );
414
  }
415
 
416
  }
417
  }
418
 
419
- public function show_message( $message = '', $status = 'success' ) {
420
-
421
- $class = 'notice notice-success is-dismissible';
422
- if ( 'error' === $status ) {
423
- $class = 'notice notice-error is-dismissible';
424
- }
425
- echo "<div class='{$class}'><p>{$message}</p></div>";
426
- }
427
-
428
  public function preview_email( $report_id ) {
429
  ob_start();
430
  ?>
93
  ?>
94
 
95
  <tr>
96
+ <th width="6%" scope="col"><?php _e( 'Sr No', 'email-subscribers' ); ?></th>
97
  <th scope="col"><?php _e( 'Email', 'email-subscribers' ); ?></th>
98
  <th scope="col"><?php _e( 'Status', 'email-subscribers' ); ?></th>
99
  <th scope="col"><?php _e( 'Sent Date', 'email-subscribers' ); ?></th>
366
 
367
  if ( ! wp_verify_nonce( $nonce, 'es_notification' ) ) {
368
  $message = __( 'You do not have permission to view notification', 'email-subscribers' );
369
+ ES_Common::show_message( $message, 'error' );
370
  } else {
371
  $this->view_list( Email_Subscribers::get_request( 'list' ) );
372
  }
378
 
379
  if ( ! wp_verify_nonce( $nonce, 'es_notification' ) ) {
380
  $message = __( 'You do not have permission to delete notification', 'email-subscribers' );
381
+ ES_Common::show_message( $message, 'error' );
382
  } else {
383
  ES_DB_Mailing_Queue::delete_notifications( array( absint( Email_Subscribers::get_request( 'list' ) ) ) );
384
  ES_DB_Sending_Queue::delete_sending_queue_by_mailing_id( array( absint( Email_Subscribers::get_request( 'list' ) ) ) );
385
  $message = __( 'Report has been deleted successfully!', 'email-subscribers' );
386
+ ES_Common::show_message( $message, 'success' );
387
  }
388
 
389
  } elseif ( 'preview' === $this->current_action() ) {
392
 
393
  if ( ! wp_verify_nonce( $nonce, 'es_notification' ) ) {
394
  $message = __( 'You do not have permission to preview notification', 'email-subscribers' );
395
+ ES_Common::show_message( $message, 'error' );
396
  } else {
397
  $report_id = Email_Subscribers::get_request( 'list' );
398
  echo $this->preview_email( $report_id );
410
  ES_DB_Mailing_Queue::delete_notifications( $notification_ids );
411
  ES_DB_Sending_Queue::delete_sending_queue_by_mailing_id( $notification_ids );
412
  $message = __( 'Reports have been deleted successfully!', 'email-subscribers' );
413
+ ES_Common::show_message( $message, 'success' );
414
  }
415
 
416
  }
417
  }
418
 
 
 
 
 
 
 
 
 
 
419
  public function preview_email( $report_id ) {
420
  ob_start();
421
  ?>
includes/admin/class-es-subscribers-table.php CHANGED
@@ -25,6 +25,65 @@ class ES_Subscribers_Table extends WP_List_Table {
25
 
26
 
27
  add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
29
 
30
  public function set_screen( $status, $option, $value ) {
@@ -48,18 +107,23 @@ class ES_Subscribers_Table extends WP_List_Table {
48
  } elseif ( 'edit' === $action ) {
49
  echo $this->edit_list( absint( Email_Subscribers::get_request( 'subscriber' ) ) );
50
  } elseif ( 'sync' === $action ) {
 
51
  $this->load_sync();
52
- } else { ?>
53
- <h1 class="wp-heading-inline"><?php _e( 'Audience > Contacts', 'email-subscribers' ); ?>
54
- <a href="admin.php?page=es_subscribers&action=new" class="page-title-action"><?php _e( 'Add New Contact', 'email-subscribers' ); ?></a>
55
- <a href="admin.php?page=es_subscribers&action=export" class="page-title-action"><?php _e( 'Export Contacts', 'email-subscribers' ); ?></a>
56
- <a href="admin.php?page=es_subscribers&action=import" class="page-title-action"><?php _e( 'Import Contacts', 'email-subscribers' ); ?></a>
57
- <a href="admin.php?page=es_subscribers&action=sync" class="page-title-action"><?php _e( 'Sync', 'email-subscribers' ); ?></a>
58
- <a href="admin.php?page=es_lists&action=manage-lists" class="page-title-action es-imp-button"><?php _e( 'Manage Lists', 'email-subscribers' ); ?></a>
59
- <?php
60
- do_action( 'es_after_action_buttons' );
61
- ?>
 
 
 
62
  </h1>
 
63
  <?php Email_Subscribers_Admin::es_feedback(); ?>
64
  <div id="poststuff" class="es-audience-view">
65
  <div id="post-body" class="metabox-holder column-1">
@@ -143,7 +207,7 @@ class ES_Subscribers_Table extends WP_List_Table {
143
 
144
  if ( empty( $list_id ) ) {
145
  $message = __( 'Please Select List', 'email-subscribers' );
146
- $this->show_message( $message, 'error' );
147
 
148
  return '';
149
  }
@@ -182,11 +246,11 @@ class ES_Subscribers_Table extends WP_List_Table {
182
  $result = ES_DB_Lists_Contacts::add_lists_contacts( $list_contact_data );
183
  if ( $added ) {
184
  $message = __( 'Contact has been added successfully!', 'email-subscribers' );
185
- $this->show_message( $message, 'success' );
186
  }
187
  } else {
188
  $message = __( 'Contact already exist.', 'email-subscribers' );
189
- $this->show_message( $message, 'success' );
190
  }
191
 
192
  return '';
@@ -195,15 +259,6 @@ class ES_Subscribers_Table extends WP_List_Table {
195
  }
196
  }
197
 
198
- public function show_message( $message = '', $status = 'success' ) {
199
-
200
- $class = 'notice notice-success is-dismissible';
201
- if ( 'error' === $status ) {
202
- $class = 'notice notice-error is-dismissible';
203
- }
204
- echo "<div class='{$class}'><p>{$message}</p></div>";
205
- }
206
-
207
  /**
208
  * Retrieve subscribers data from the database
209
  *
@@ -320,7 +375,7 @@ class ES_Subscribers_Table extends WP_List_Table {
320
 
321
  if ( Email_Subscribers::get_request( 'subscriber_name' ) ) {
322
  $message = __( 'Contact updated successfully!', 'email-subscribers' );
323
- $this->show_message( $message, 'success' );
324
  }
325
 
326
  $editform = '<div class="wrap">
@@ -668,7 +723,7 @@ class ES_Subscribers_Table extends WP_List_Table {
668
  } else {
669
  $this->edit_list( absint( Email_Subscribers::get_request( 'subscriber' ) ) );
670
  $message = __( 'Contact have been updated successfully!', 'email-subscribers' );
671
- $this->show_message( $message, 'success' );
672
 
673
  return;
674
  }
@@ -685,7 +740,7 @@ class ES_Subscribers_Table extends WP_List_Table {
685
  $deleted = ES_DB_Contacts::delete_subscribers( array( absint( Email_Subscribers::get_request( 'subscriber' ) ) ) );
686
  if ( $deleted ) {
687
  $message = __( 'Contact(s) have been deleted successfully!', 'email-subscribers' );
688
- $this->show_message( $message, 'success' );
689
  }
690
 
691
  return;
@@ -715,7 +770,7 @@ class ES_Subscribers_Table extends WP_List_Table {
715
 
716
  if ( $response ) {
717
  $message = __( 'Confirmation email has been sent successfully!', 'email-subscribers' );
718
- $this->show_message( $message, 'success' );
719
  }
720
 
721
  return;
@@ -733,7 +788,7 @@ class ES_Subscribers_Table extends WP_List_Table {
733
  $subscriber_ids = esc_sql( Email_Subscribers::get_request( 'subscribers' ) );
734
  if ( empty( $subscriber_ids ) ) {
735
  $message = __( 'Please select subscribers to update.', 'email-subscribers' );
736
- $this->show_message( $message, 'error' );
737
 
738
  return;
739
  }
@@ -745,7 +800,7 @@ class ES_Subscribers_Table extends WP_List_Table {
745
 
746
  if ( $deleted ) {
747
  $message = __( 'Contact(s) have been deleted successfully!', 'email-subscribers' );
748
- $this->show_message( $message, 'success' );
749
  }
750
 
751
  return;
@@ -756,7 +811,7 @@ class ES_Subscribers_Table extends WP_List_Table {
756
 
757
  if ( empty( $status ) ) {
758
  $message = __( 'Please select status.', 'email-subscribers' );
759
- $this->show_message( $message, 'error' );
760
 
761
  return;
762
  }
@@ -766,7 +821,7 @@ class ES_Subscribers_Table extends WP_List_Table {
766
 
767
  if ( $edited ) {
768
  $message = __( 'Status has been changed successfully!', 'email-subscribers' );
769
- $this->show_message( $message, 'success' );
770
  }
771
 
772
  return;
@@ -777,7 +832,7 @@ class ES_Subscribers_Table extends WP_List_Table {
777
  $list_id = Email_Subscribers::get_request( 'list_id' );
778
  if ( empty( $list_id ) ) {
779
  $message = __( 'Please select list.', 'email-subscribers' );
780
- $this->show_message( $message, 'error' );
781
 
782
  return;
783
  }
@@ -786,7 +841,7 @@ class ES_Subscribers_Table extends WP_List_Table {
786
 
787
  if ( $edited ) {
788
  $message = __( 'Contact(s) have been moved to list successfully!', 'email-subscribers' );
789
- $this->show_message( $message, 'success' );
790
  }
791
 
792
  return;
@@ -797,7 +852,7 @@ class ES_Subscribers_Table extends WP_List_Table {
797
  $list_id = Email_Subscribers::get_request( 'list_id' );
798
  if ( empty( $list_id ) ) {
799
  $message = __( 'Please select list.', 'email-subscribers' );
800
- $this->show_message( $message, 'error' );
801
 
802
  return;
803
  }
@@ -806,7 +861,7 @@ class ES_Subscribers_Table extends WP_List_Table {
806
 
807
  if ( $edited ) {
808
  $message = __( 'Contact(s) have been added to list successfully!', 'email-subscribers' );
809
- $this->show_message( $message, 'success' );
810
  }
811
 
812
  return;
25
 
26
 
27
  add_filter( 'set-screen-option', array( $this, 'set_screen' ), 10, 3 );
28
+ add_filter( 'ig_es_audience_tab_main_navigation', array( $this, 'get_audience_main_tabs' ), 10, 3 );
29
+ }
30
+
31
+ public function get_audience_main_tabs( $active_tab, $audience_main_tabs ) {
32
+
33
+ $audience_tab_main_navigation = array(
34
+ 'new_contact' => array(
35
+ 'label' => __( 'Add New Contact', 'email-subscribers' ),
36
+ 'indicator_option' => '',
37
+ 'indicator_label' => '',
38
+ 'indicator_type' => '',
39
+ 'action' => 'new',
40
+ 'url' => add_query_arg( 'action', 'new', 'admin.php?page=es_subscribers' )
41
+ ),
42
+
43
+ 'export' => array(
44
+ 'label' => __( 'Export Contacts', 'email-subscribers' ),
45
+ 'indicator_option' => '',
46
+ 'indicator_label' => '',
47
+ 'indicator_type' => '',
48
+ 'action' => 'export',
49
+ 'url' => add_query_arg( 'action', 'export', 'admin.php?page=es_subscribers' )
50
+ ),
51
+
52
+ 'import' => array(
53
+ 'label' => __( 'Import Contacts', 'email-subscribers' ),
54
+ 'indicator_option' => '',
55
+ 'indicator_label' => '',
56
+ 'indicator_type' => '',
57
+ 'action' => 'import',
58
+ 'url' => add_query_arg( 'action', 'import', 'admin.php?page=es_subscribers' )
59
+ ),
60
+
61
+ 'sync' => array(
62
+ 'label' => __( 'Sync', 'email-subscribers' ),
63
+ 'indicator_option' => 'ig_es_show_sync_tab',
64
+ 'indicator_label' => __('New', 'email-subscribers'),
65
+ 'indicator_type' => 'new',
66
+ 'action' => 'sync',
67
+ 'url' => add_query_arg( 'action', 'sync', 'admin.php?page=es_subscribers' )
68
+ ),
69
+
70
+ 'manage_lists' => array(
71
+ 'label' => __( 'Manage Lists', 'email-subscribers' ),
72
+ 'indicator_option' => '',
73
+ 'indicator_label' => '',
74
+ 'indicator_type' => '',
75
+ 'action' => 'manage-lists',
76
+ 'is_imp' => true,
77
+ 'url' => add_query_arg( 'action', 'manage-lists', 'admin.php?page=es_lists' )
78
+ )
79
+ );
80
+
81
+ $audience_main_tabs = $audience_main_tabs + $audience_tab_main_navigation;
82
+ if ( ! empty( $active_tab ) ) {
83
+ unset( $audience_main_tabs[ $active_tab ] );
84
+ }
85
+
86
+ return $audience_main_tabs;
87
  }
88
 
89
  public function set_screen( $status, $option, $value ) {
107
  } elseif ( 'edit' === $action ) {
108
  echo $this->edit_list( absint( Email_Subscribers::get_request( 'subscriber' ) ) );
109
  } elseif ( 'sync' === $action ) {
110
+ update_option( 'ig_es_show_sync_tab', 'no' ); // yes/no
111
  $this->load_sync();
112
+ } else {
113
+
114
+ $audience_tab_main_navigation = array();
115
+ $active_tab = '';
116
+ $audience_tab_main_navigation = apply_filters( 'ig_es_audience_tab_main_navigation', $active_tab, $audience_tab_main_navigation );
117
+
118
+ ?>
119
+
120
+ <h1 class="wp-heading-inline">
121
+ <?php
122
+ _e( 'Audience > Contacts', 'email-subscribers' );
123
+ ES_Common::prepare_main_header_navigation($audience_tab_main_navigation);
124
+ ?>
125
  </h1>
126
+
127
  <?php Email_Subscribers_Admin::es_feedback(); ?>
128
  <div id="poststuff" class="es-audience-view">
129
  <div id="post-body" class="metabox-holder column-1">
207
 
208
  if ( empty( $list_id ) ) {
209
  $message = __( 'Please Select List', 'email-subscribers' );
210
+ ES_Common::show_message( $message, 'error' );
211
 
212
  return '';
213
  }
246
  $result = ES_DB_Lists_Contacts::add_lists_contacts( $list_contact_data );
247
  if ( $added ) {
248
  $message = __( 'Contact has been added successfully!', 'email-subscribers' );
249
+ ES_Common::show_message( $message, 'success' );
250
  }
251
  } else {
252
  $message = __( 'Contact already exist.', 'email-subscribers' );
253
+ ES_Common::show_message( $message, 'success' );
254
  }
255
 
256
  return '';
259
  }
260
  }
261
 
 
 
 
 
 
 
 
 
 
262
  /**
263
  * Retrieve subscribers data from the database
264
  *
375
 
376
  if ( Email_Subscribers::get_request( 'subscriber_name' ) ) {
377
  $message = __( 'Contact updated successfully!', 'email-subscribers' );
378
+ ES_Common::show_message( $message, 'success' );
379
  }
380
 
381
  $editform = '<div class="wrap">
723
  } else {
724
  $this->edit_list( absint( Email_Subscribers::get_request( 'subscriber' ) ) );
725
  $message = __( 'Contact have been updated successfully!', 'email-subscribers' );
726
+ ES_Common::show_message( $message, 'success' );
727
 
728
  return;
729
  }
740
  $deleted = ES_DB_Contacts::delete_subscribers( array( absint( Email_Subscribers::get_request( 'subscriber' ) ) ) );
741
  if ( $deleted ) {
742
  $message = __( 'Contact(s) have been deleted successfully!', 'email-subscribers' );
743
+ ES_Common::show_message( $message, 'success' );
744
  }
745
 
746
  return;
770
 
771
  if ( $response ) {
772
  $message = __( 'Confirmation email has been sent successfully!', 'email-subscribers' );
773
+ ES_Common::show_message( $message, 'success' );
774
  }
775
 
776
  return;
788
  $subscriber_ids = esc_sql( Email_Subscribers::get_request( 'subscribers' ) );
789
  if ( empty( $subscriber_ids ) ) {
790
  $message = __( 'Please select subscribers to update.', 'email-subscribers' );
791
+ ES_Common::show_message( $message, 'error' );
792
 
793
  return;
794
  }
800
 
801
  if ( $deleted ) {
802
  $message = __( 'Contact(s) have been deleted successfully!', 'email-subscribers' );
803
+ ES_Common::show_message( $message, 'success' );
804
  }
805
 
806
  return;
811
 
812
  if ( empty( $status ) ) {
813
  $message = __( 'Please select status.', 'email-subscribers' );
814
+ ES_Common::show_message( $message, 'error' );
815
 
816
  return;
817
  }
821
 
822
  if ( $edited ) {
823
  $message = __( 'Status has been changed successfully!', 'email-subscribers' );
824
+ ES_Common::show_message( $message, 'success' );
825
  }
826
 
827
  return;
832
  $list_id = Email_Subscribers::get_request( 'list_id' );
833
  if ( empty( $list_id ) ) {
834
  $message = __( 'Please select list.', 'email-subscribers' );
835
+ ES_Common::show_message( $message, 'error' );
836
 
837
  return;
838
  }
841
 
842
  if ( $edited ) {
843
  $message = __( 'Contact(s) have been moved to list successfully!', 'email-subscribers' );
844
+ ES_Common::show_message( $message, 'success' );
845
  }
846
 
847
  return;
852
  $list_id = Email_Subscribers::get_request( 'list_id' );
853
  if ( empty( $list_id ) ) {
854
  $message = __( 'Please select list.', 'email-subscribers' );
855
+ ES_Common::show_message( $message, 'error' );
856
 
857
  return;
858
  }
861
 
862
  if ( $edited ) {
863
  $message = __( 'Contact(s) have been added to list successfully!', 'email-subscribers' );
864
+ ES_Common::show_message( $message, 'success' );
865
  }
866
 
867
  return;
includes/admin/class-es-tools.php CHANGED
@@ -30,14 +30,16 @@ class ES_Tools {
30
  if ( ! empty( $email ) ) {
31
  $subject = 'Email Subscribers: ' . sprintf( esc_html__( 'Test email to %s', 'email-subscribers' ), $email );
32
  $content = self::get_email_message();
33
- $email_response = ES_Mailer::send( $email, $subject, $content );
34
- if ( $email_response ) {
35
  $response['message'] = __( 'Email has been sent. Please check your inbox', 'email-subscribers' );
36
- $response['status'] = 'success';
37
- } else {
38
- $response['message'] = __( 'Something went wrong', 'email-subscribers' );
39
- $response['status'] = 'error';
40
  }
 
 
 
 
 
 
41
  }
42
 
43
  echo json_encode( $response );
30
  if ( ! empty( $email ) ) {
31
  $subject = 'Email Subscribers: ' . sprintf( esc_html__( 'Test email to %s', 'email-subscribers' ), $email );
32
  $content = self::get_email_message();
33
+ $response = ES_Mailer::send( $email, $subject, $content );
34
+ if($response['status'] === 'SUCCESS'){
35
  $response['message'] = __( 'Email has been sent. Please check your inbox', 'email-subscribers' );
 
 
 
 
36
  }
37
+ // if ( $email_response ) {
38
+ // $response['status'] = 'success';
39
+ // } else {
40
+ // $response['message'] = __( 'Something went wrong', 'email-subscribers' );
41
+ // $response['status'] = 'error';
42
+ // }
43
  }
44
 
45
  echo json_encode( $response );
includes/class-email-subscribers.php CHANGED
@@ -75,6 +75,7 @@ class Email_Subscribers {
75
 
76
  require_once plugin_dir_path( __FILE__ ) . 'class-email-subscribers-activator.php';
77
  require_once plugin_dir_path( __FILE__ ) . 'class-email-subscribers-deactivator.php';
 
78
  add_action( 'admin_notices', array( $this, 'add_version_notice' ) );
79
  add_action( 'admin_init', array( &$this, 'es_dismiss_admin_notice' ) );
80
  if ( ! post_type_exists( 'es_template' ) ) {
@@ -89,11 +90,16 @@ class Email_Subscribers {
89
  $this->define_admin_hooks();
90
  $this->define_public_hooks();
91
 
 
 
 
 
92
  add_action( 'widgets_init', array( $this, 'register_es_widget' ) );
93
  add_filter( 'cron_schedules', array( $this, 'es_add_cron_interval' ) );
94
  }
95
 
96
  public function add_version_notice() {
 
97
  //Email Subscribers Pro update notice
98
  $active_plugins = get_option( 'active_plugins', array() );
99
  if ( is_multisite() ) {
@@ -113,14 +119,19 @@ class Email_Subscribers {
113
  <?php
114
  return;
115
  }
 
 
 
 
 
116
  }
117
  //cron notice
118
- $notice_option = get_option( 'ig_es_wp_cron_notice', 'yes' );
119
 
120
  $show_notice = true;
121
  $show_notice = apply_filters( 'ig_es_show_wp_cron_notice', $show_notice );
122
 
123
- if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON && $notice_option != 'no' && $show_notice ) {
124
  $es_cron_url = 'https://www.icegram.com/documentation/how-to-enable-the-wordpress-cron/?utm_source=es&utm_medium=in_app&utm_campaign=view_admin_notice';
125
  $cpanel_url = 'https://www.icegram.com/documentation/es-how-to-schedule-cron-emails-in-cpanel/?utm_source=es&utm_medium=in_app&utm_campaign=view_admin_notice';
126
  $es_pro_url = 'https://www.icegram.com/documentation/es-how-to-schedule-cron-emails-in-cpanel/?utm_source=es&utm_medium=in_app&utm_campaign=view_admin_notice';
@@ -297,11 +308,20 @@ class Email_Subscribers {
297
 
298
  'includes/pro-features.php',
299
 
 
 
 
300
  );
301
 
302
  foreach ( $required_files as $file ) {
303
  $file_path = plugin_dir_path( dirname( __FILE__ ) ) . $file;
304
- require_once $file_path;
 
 
 
 
 
 
305
  }
306
 
307
  add_shortcode( 'email-subscribers', array( 'ES_Shortcode', 'render_es_subscription_shortcode' ) );
@@ -337,7 +357,7 @@ class Email_Subscribers {
337
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
338
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
339
  $this->loader->add_action( 'plugins_loaded', $plugin_admin, 'plugins_loaded' );
340
- $this->loader->add_action( 'ig_es_lite_do_send', $plugin_admin, 'do_send', 10, 1 );
341
 
342
  //$this->loader->add_filter( 'ig_es_blocked_domains', $plugin_admin, 'blocked_domains', 10, 1 );
343
  //$this->loader->add_filter( 'ig_es_whitelist_ips', $plugin_admin, 'whitelist_ips', 10, 1 );
75
 
76
  require_once plugin_dir_path( __FILE__ ) . 'class-email-subscribers-activator.php';
77
  require_once plugin_dir_path( __FILE__ ) . 'class-email-subscribers-deactivator.php';
78
+
79
  add_action( 'admin_notices', array( $this, 'add_version_notice' ) );
80
  add_action( 'admin_init', array( &$this, 'es_dismiss_admin_notice' ) );
81
  if ( ! post_type_exists( 'es_template' ) ) {
90
  $this->define_admin_hooks();
91
  $this->define_public_hooks();
92
 
93
+ if(is_admin()) {
94
+ new IG_Deactivation_Survey('Email Subscribers', 'email-subscribers', 'ig_es');
95
+ }
96
+
97
  add_action( 'widgets_init', array( $this, 'register_es_widget' ) );
98
  add_filter( 'cron_schedules', array( $this, 'es_add_cron_interval' ) );
99
  }
100
 
101
  public function add_version_notice() {
102
+
103
  //Email Subscribers Pro update notice
104
  $active_plugins = get_option( 'active_plugins', array() );
105
  if ( is_multisite() ) {
119
  <?php
120
  return;
121
  }
122
+ if ( is_admin() && ! empty( $es_pro_plugin_version ) && version_compare( $es_pro_plugin_version, '4.1.1' , '<' ) ) {
123
+ $url = admin_url( "plugins.php?plugin_status=upgrade" );
124
+ $es_upgrade_text = __( 'We have released a recommended update of Email subscribers Premium. So kindly ', 'email-subscribers-premium' ) . '<a href=' . $url . ' target="_blank" style="cursor:pointer">' . __( "update to the latest version", "email-subscribers-premium" ) . '</a>' . __( " right now", "email-subscribers-premium" );
125
+ echo '<div class="notice notice-warning" style="background-color: #FFF;"><p style="letter-spacing: 0.6px;">' . $es_upgrade_text . '</p></div>';
126
+ }
127
  }
128
  //cron notice
129
+ $notice_option = get_option( 'ig_es_wp_cron_notice' );
130
 
131
  $show_notice = true;
132
  $show_notice = apply_filters( 'ig_es_show_wp_cron_notice', $show_notice );
133
 
134
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON && $notice_option != 'yes' && $show_notice ) {
135
  $es_cron_url = 'https://www.icegram.com/documentation/how-to-enable-the-wordpress-cron/?utm_source=es&utm_medium=in_app&utm_campaign=view_admin_notice';
136
  $cpanel_url = 'https://www.icegram.com/documentation/es-how-to-schedule-cron-emails-in-cpanel/?utm_source=es&utm_medium=in_app&utm_campaign=view_admin_notice';
137
  $es_pro_url = 'https://www.icegram.com/documentation/es-how-to-schedule-cron-emails-in-cpanel/?utm_source=es&utm_medium=in_app&utm_campaign=view_admin_notice';
308
 
309
  'includes/pro-features.php',
310
 
311
+ // Feedback
312
+ 'includes/feedback/class-ig-tracker.php',
313
+ 'includes/feedback/class-ig-deactivation-survey.php'
314
  );
315
 
316
  foreach ( $required_files as $file ) {
317
  $file_path = plugin_dir_path( dirname( __FILE__ ) ) . $file;
318
+
319
+ if(is_file($file_path)) {
320
+ require_once $file_path;
321
+ } else {
322
+ echo $file_path;
323
+ die('Not Found');
324
+ }
325
  }
326
 
327
  add_shortcode( 'email-subscribers', array( 'ES_Shortcode', 'render_es_subscription_shortcode' ) );
357
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
358
  $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
359
  $this->loader->add_action( 'plugins_loaded', $plugin_admin, 'plugins_loaded' );
360
+ $this->loader->add_filter( 'ig_es_lite_do_send', $plugin_admin, 'do_send', 10, 2 );
361
 
362
  //$this->loader->add_filter( 'ig_es_blocked_domains', $plugin_admin, 'blocked_domains', 10, 1 );
363
  //$this->loader->add_filter( 'ig_es_whitelist_ips', $plugin_admin, 'whitelist_ips', 10, 1 );
includes/class-es-common.php CHANGED
@@ -41,13 +41,13 @@ Class ES_Common {
41
  /**
42
  * Convert email subscribe templates.
43
  *
44
- * @since 4.0
45
- *
46
  * @param string $template Get email subscribe templates.
47
  * @param string $name Get subscriber name.
48
  * @param string $email Get subscriber email.
49
  *
50
  * @return string $convert_template
 
 
51
  */
52
  public static function convert_es_templates( $template, $name, $email, $es_templ_id = 0 ) {
53
  $convert_template = str_replace( "{{NAME}}", $name, $template );
@@ -84,9 +84,9 @@ Class ES_Common {
84
  /**
85
  * Get html content type.
86
  *
 
87
  * @since 4.0
88
  *
89
- * @return string
90
  */
91
  public static function es_set_html_content_type() {
92
  return 'text/html';
@@ -482,7 +482,7 @@ Class ES_Common {
482
  $categories_str = '';
483
  if ( is_array( $categories ) && count( $categories ) > 0 ) {
484
  $categories_str = "##" . implode( '##', $categories ) . "##";
485
- $categories_str = wp_specialchars_decode( $categories_str, ENT_QUOTES );
486
  }
487
 
488
  return $categories_str;
@@ -799,10 +799,82 @@ Class ES_Common {
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
  }
41
  /**
42
  * Convert email subscribe templates.
43
  *
 
 
44
  * @param string $template Get email subscribe templates.
45
  * @param string $name Get subscriber name.
46
  * @param string $email Get subscriber email.
47
  *
48
  * @return string $convert_template
49
+ * @since 4.0
50
+ *
51
  */
52
  public static function convert_es_templates( $template, $name, $email, $es_templ_id = 0 ) {
53
  $convert_template = str_replace( "{{NAME}}", $name, $template );
84
  /**
85
  * Get html content type.
86
  *
87
+ * @return string
88
  * @since 4.0
89
  *
 
90
  */
91
  public static function es_set_html_content_type() {
92
  return 'text/html';
482
  $categories_str = '';
483
  if ( is_array( $categories ) && count( $categories ) > 0 ) {
484
  $categories_str = "##" . implode( '##', $categories ) . "##";
485
+ $categories_str = wp_specialchars_decode( $categories_str, ENT_QUOTES );
486
  }
487
 
488
  return $categories_str;
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
+
809
+ public static function prepare_main_header_navigation( $navigation_tabs ) {
810
+
811
+ foreach ( $navigation_tabs as $key => $navigation ) {
812
+ $action = ! empty( $navigation['action'] ) ? $navigation['action'] : '';
813
+ $action_label = ! empty( $navigation['label'] ) ? $navigation['label'] : '';
814
+ $url = ! empty( $navigation['url'] ) ? $navigation['url'] : '';
815
+ $indicator_class = ! empty( $navigation['indicator_type'] ) ? 'ig-es-indicator-' . $navigation['indicator_type'] : 'ig-es-indicator-new';
816
+ $show_indicator = ! empty( $navigation['indicator_option'] ) ? ( ( get_option( $navigation['indicator_option'], 'yes' ) === 'yes' ) ? true : false ) : false;
817
+ $indicator_label = ! empty( $navigation['indicator_label'] ) ? $navigation['indicator_label'] : '';
818
+ $is_imp = ! empty( $navigation['is_imp'] ) ? $navigation['is_imp'] : false;
819
+ ?>
820
+
821
+ <a href="<?php echo $url; ?>" class="page-title-action<?php if ( $is_imp ) {
822
+ echo " es-imp-button";
823
+ } ?>"><?php echo $action_label; ?>
824
+ <?php if ( $show_indicator ) { ?>
825
+ <span class="ig-es-indicator <?php echo $indicator_class; ?>">
826
+ <?php echo $indicator_label ?>
827
+ </span>
828
+
829
+ <?php } ?>
830
+ </a>
831
+ <?php }
832
+ }
833
+
834
+ public static function prepare_information_box( $info, $content_html ) {
835
+
836
+ $default_args = array(
837
+ 'type' => 'info',
838
+ 'center' => true,
839
+ 'box_shadow' => true,
840
+ 'show_icon' => true
841
+ );
842
+
843
+ $info = wp_parse_args( $info, $default_args );
844
+
845
+ $type = $info['type'];
846
+ $show_icon = $info['show_icon'];
847
+ $is_center = $info['center'];
848
+ $is_box_shadow = $info['box_shadow'];
849
+
850
+ $div_class = 'ig-es-information-box';
851
+ if($is_center) {
852
+ $div_class .= ' ig-es-center';
853
+ }
854
+
855
+ if($is_box_shadow) {
856
+ $div_class .= ' ig-es-box-shadow';
857
+ }
858
+
859
+ if($type) {
860
+ $div_class .= ' ig-es-' .$type;
861
+ }
862
+
863
+ ?>
864
+
865
+ <div class="<?php echo $div_class; ?>">
866
+ <div class="ig-vertical-align">
867
+ <?php if($show_icon) { ?>
868
+ <div class="ig-es-icon text-center">
869
+ <span class="dashicons ig-es-icon-<?php echo $type; ?>"></span>
870
+ </div>
871
+ <?php } ?>
872
+ <div class="ig-es-info-message">
873
+ <?php echo $content_html; ?>
874
+ </div>
875
+ </div>
876
+ </div>
877
+
878
+ <?php
879
+ }
880
  }
includes/class-es-install.php CHANGED
@@ -106,6 +106,11 @@ class ES_Install {
106
  '4.0.15' => array(
107
  'ig_es_update_4015_alter_blocked_emails_table',
108
  'ig_es_update_4015_db_version',
 
 
 
 
 
109
  )
110
  );
111
 
@@ -197,10 +202,10 @@ class ES_Install {
197
  self::create_default_list_contact();
198
 
199
  // Create and send default broadcast
200
- self::create_and_send_default_broadcast();
201
 
202
  // Create and send Post Notification
203
- self::create_and_send_default_post_notification();
204
 
205
  //Create Default form
206
  self::create_default_form();
@@ -228,7 +233,7 @@ class ES_Install {
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
  }
234
 
@@ -298,7 +303,6 @@ class ES_Install {
298
  self::$background_updater->save()->dispatch();
299
  }
300
 
301
-
302
  }
303
 
304
  public static function update_db_version( $version = null ) {
@@ -444,7 +448,7 @@ class ES_Install {
444
  `first_name` varchar(50) DEFAULT NULL,
445
  `last_name` varchar(50) DEFAULT NULL,
446
  `email` varchar(50) NOT NULL,
447
- `source` varchar(10) DEFAULT NULL,
448
  `form_id` int(10) NOT NULL DEFAULT '0',
449
  `status` varchar(10) DEFAULT NULL,
450
  `unsubscribed` tinyint(1) NOT NULL DEFAULT '0',
@@ -607,7 +611,7 @@ class ES_Install {
607
  $list_id = ES_DB_Lists::add_list( IG_MAIN_LIST );
608
  }
609
 
610
- private static function create_and_send_default_broadcast() {
611
  /**
612
  * - Create Default Template
613
  * - Create Broadcast Campaign
@@ -676,7 +680,7 @@ class ES_Install {
676
  'subject' => $title,
677
  'body' => $sample,
678
  'count' => count( $subscribers ),
679
- 'status' => 'Sent',
680
  'start_at' => $now,
681
  'finish_at' => $now,
682
  'created_at' => $now,
@@ -690,7 +694,7 @@ class ES_Install {
690
  $delivery_data['subscribers'] = $subscribers;
691
  $delivery_data['campaign_id'] = $campaign_id;
692
  $delivery_data['mailing_queue_id'] = $last_report_id;
693
- $delivery_data['status'] = 'Sent';
694
  ES_DB_Sending_Queue::do_batch_insert( $delivery_data );
695
 
696
  $email_created = time();
@@ -698,7 +702,18 @@ class ES_Install {
698
  // Newsletter Send
699
 
700
  $email_template = ES_Common::convert_es_templates( $sample, $admin_name, $admin_email, $email_created );
701
- ES_Mailer::send( $admin_email, $title, $email_template );
 
 
 
 
 
 
 
 
 
 
 
702
  }
703
 
704
  }
@@ -706,7 +721,7 @@ class ES_Install {
706
 
707
  }
708
 
709
- private static function create_and_send_default_post_notification() {
710
 
711
  $admin_name = ES_Common::get_ig_option( 'admin_name' );
712
  $admin_email = ES_Common::get_ig_option( 'admin_email' );
@@ -787,7 +802,7 @@ class ES_Install {
787
  'subject' => $subject,
788
  'body' => $content,
789
  'count' => count( $subscribers ),
790
- 'status' => 'Sent',
791
  'start_at' => $now,
792
  'finish_at' => $now,
793
  'created_at' => $now,
@@ -801,14 +816,26 @@ class ES_Install {
801
  $delivery_data['subscribers'] = $subscribers;
802
  $delivery_data['campaign_id'] = $campaign_id;
803
  $delivery_data['mailing_queue_id'] = $last_report_id;
804
- $delivery_data['status'] = 'Sent';
805
  ES_DB_Sending_Queue::do_batch_insert( $delivery_data );
806
 
807
  $email_created = time();
808
 
809
  // Post Notification Send Send
810
  $email_template = ES_Common::convert_es_templates( $content, $admin_name, $admin_email, $email_created );
811
- ES_Mailer::send( $admin_email, $subject, $email_template );
 
 
 
 
 
 
 
 
 
 
 
 
812
  }
813
  }
814
 
106
  '4.0.15' => array(
107
  'ig_es_update_4015_alter_blocked_emails_table',
108
  'ig_es_update_4015_db_version',
109
+ ),
110
+
111
+ '4.1.1' => array(
112
+ 'ig_es_update_411_alter_contacts_table',
113
+ 'ig_es_update_411_db_version'
114
  )
115
  );
116
 
202
  self::create_default_list_contact();
203
 
204
  // Create and send default broadcast
205
+ // self::create_and_send_default_broadcast();
206
 
207
  // Create and send Post Notification
208
+ // self::create_and_send_default_post_notification();
209
 
210
  //Create Default form
211
  self::create_default_form();
233
  $wpdb->query( $query );
234
  }
235
 
236
+ public static function is_new_install() {
237
  return is_null( get_option( 'ig_es_db_version', null ) ) && is_null( get_option( 'current_sa_email_subscribers_db_version', null ) );
238
  }
239
 
303
  self::$background_updater->save()->dispatch();
304
  }
305
 
 
306
  }
307
 
308
  public static function update_db_version( $version = null ) {
448
  `first_name` varchar(50) DEFAULT NULL,
449
  `last_name` varchar(50) DEFAULT NULL,
450
  `email` varchar(50) NOT NULL,
451
+ `source` varchar(50) DEFAULT NULL,
452
  `form_id` int(10) NOT NULL DEFAULT '0',
453
  `status` varchar(10) DEFAULT NULL,
454
  `unsubscribed` tinyint(1) NOT NULL DEFAULT '0',
611
  $list_id = ES_DB_Lists::add_list( IG_MAIN_LIST );
612
  }
613
 
614
+ public static function create_and_send_default_broadcast() {
615
  /**
616
  * - Create Default Template
617
  * - Create Broadcast Campaign
680
  'subject' => $title,
681
  'body' => $sample,
682
  'count' => count( $subscribers ),
683
+ 'status' => 'In Queue',
684
  'start_at' => $now,
685
  'finish_at' => $now,
686
  'created_at' => $now,
694
  $delivery_data['subscribers'] = $subscribers;
695
  $delivery_data['campaign_id'] = $campaign_id;
696
  $delivery_data['mailing_queue_id'] = $last_report_id;
697
+ $delivery_data['status'] = 'In Queue';
698
  ES_DB_Sending_Queue::do_batch_insert( $delivery_data );
699
 
700
  $email_created = time();
702
  // Newsletter Send
703
 
704
  $email_template = ES_Common::convert_es_templates( $sample, $admin_name, $admin_email, $email_created );
705
+ $response = ES_Mailer::send( $admin_email, $title, $email_template );
706
+ if( !empty($response) && $response['status'] === 'SUCCESS'){
707
+ //update sent details
708
+ $emails = ES_DB_Sending_Queue::get_emails_to_be_sent_by_hash( $guid, 5 );
709
+ $ids = array();
710
+ foreach ( $emails as $email ) {
711
+ $ids[] = $email['id'];
712
+ }
713
+ ES_DB_Sending_Queue::update_sent_status( $ids, 'Sent' );
714
+ ES_DB_Mailing_Queue::update_sent_status( $guid, 'Sent' );
715
+ }
716
+ return $response;
717
  }
718
 
719
  }
721
 
722
  }
723
 
724
+ public static function create_and_send_default_post_notification() {
725
 
726
  $admin_name = ES_Common::get_ig_option( 'admin_name' );
727
  $admin_email = ES_Common::get_ig_option( 'admin_email' );
802
  'subject' => $subject,
803
  'body' => $content,
804
  'count' => count( $subscribers ),
805
+ 'status' => 'In Queue',
806
  'start_at' => $now,
807
  'finish_at' => $now,
808
  'created_at' => $now,
816
  $delivery_data['subscribers'] = $subscribers;
817
  $delivery_data['campaign_id'] = $campaign_id;
818
  $delivery_data['mailing_queue_id'] = $last_report_id;
819
+ $delivery_data['status'] = 'In Queue';
820
  ES_DB_Sending_Queue::do_batch_insert( $delivery_data );
821
 
822
  $email_created = time();
823
 
824
  // Post Notification Send Send
825
  $email_template = ES_Common::convert_es_templates( $content, $admin_name, $admin_email, $email_created );
826
+ $response = ES_Mailer::send( $admin_email, $title, $email_template );
827
+ if( !empty($response) && $response['status'] === 'SUCCESS'){
828
+ //update sent details
829
+ $emails = ES_DB_Sending_Queue::get_emails_to_be_sent_by_hash( $guid, 5 );
830
+ $ids = array();
831
+ foreach ( $emails as $email ) {
832
+ $ids[] = $email['id'];
833
+ }
834
+ ES_DB_Sending_Queue::update_sent_status( $ids, 'Sent' );
835
+ ES_DB_Mailing_Queue::update_sent_status( $guid, 'Sent' );
836
+ //change post notification from test to main
837
+ }
838
+ return $response;
839
  }
840
  }
841
 
includes/class-es-mailer.php CHANGED
@@ -339,9 +339,9 @@ class ES_Mailer {
339
  'email_type' => $get_email_type
340
  );
341
 
342
- do_action( $send_email_via . '_do_send', $data );
343
-
344
- return true;
345
  } else {
346
  mail( $to_email, $subject, $email_template, $headers );
347
  }
339
  'email_type' => $get_email_type
340
  );
341
 
342
+ $response = array();
343
+ $response = apply_filters( $send_email_via . '_do_send', $response, $data );
344
+ return $response;
345
  } else {
346
  mail( $to_email, $subject, $email_template, $headers );
347
  }
includes/es-core-functions.php CHANGED
@@ -57,7 +57,7 @@ if ( ! function_exists( 'ig_get_current_date_time' ) ) {
57
 
58
  if ( ! function_exists( 'ig_es_format_date_time' ) ) {
59
  function ig_es_format_date_time( $date ) {
60
- $local_timestamp = ( $date !== '0000-00-00 00:00:00' ) ? get_date_from_gmt( $date) : $date;
61
  return $local_timestamp;
62
  }
63
  }
57
 
58
  if ( ! function_exists( 'ig_es_format_date_time' ) ) {
59
  function ig_es_format_date_time( $date ) {
60
+ $local_timestamp = ( $date !== '0000-00-00 00:00:00' ) ? get_date_from_gmt( $date) : '<i class="dashicons dashicons-es dashicons-minus"></i>';
61
  return $local_timestamp;
62
  }
63
  }
includes/feedback/class-ig-deactivation-survey.php ADDED
@@ -0,0 +1,331 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'IG_Feedback_V_1_0_0', false ) ) {
6
+ include_once dirname( __FILE__ ) . '/class-ig-feedback-v-1-0-0.php';
7
+ }
8
+
9
+ if ( ! class_exists( 'IG_Deactivation_Survey' ) ) {
10
+ /**
11
+ * Icegram Deactivation Survey.
12
+ *
13
+ * This prompts the user for more details when they deactivate the plugin.
14
+ *
15
+ * @version 1.0.0
16
+ * @package Icegram
17
+ * @author Malay Ladu
18
+ * @license GPL-2.0+
19
+ * @copyright Copyright (c) 2019
20
+ */
21
+ class IG_Deactivation_Survey extends IG_Feedback_V_1_0_0 {
22
+
23
+ public function __construct( $name = '', $plugin = '', $plugin_abbr = 'ig_fb' ) {
24
+ parent::__construct($name, $plugin, $plugin_abbr);
25
+
26
+ // Don't run deactivation survey on dev sites.
27
+ if ( ! $this->can_show_feedback_widget()) {
28
+ return;
29
+ }
30
+
31
+ add_action( 'admin_print_scripts', array( $this, 'js' ), 20 );
32
+ add_action( 'admin_print_scripts', array( $this, 'css' ) );
33
+ add_action( 'admin_footer', array( $this, 'modal' ) );
34
+ }
35
+
36
+ /**
37
+ * Survey javascript.
38
+ *
39
+ * @since 1.0.0
40
+ */
41
+ public function js() {
42
+
43
+ if ( ! $this->is_plugin_page() ) {
44
+ return;
45
+ }
46
+ ?>
47
+ <script type="text/javascript">
48
+ jQuery(function ($) {
49
+ var $deactivateLink = $('#the-list').find('[data-slug="<?php echo $this->plugin; ?>"] span.deactivate a'),
50
+ $overlay = $('#ig-deactivate-survey-<?php echo $this->plugin; ?>'),
51
+ $form = $overlay.find('form'),
52
+ formOpen = false;
53
+ // Plugin listing table deactivate link.
54
+ $deactivateLink.on('click', function (event) {
55
+ event.preventDefault();
56
+ $overlay.css('display', 'table');
57
+ formOpen = true;
58
+ $form.find('.ig-deactivate-survey-option:first-of-type input[type=radio]').focus();
59
+ });
60
+ // Survey radio option selected.
61
+ $form.on('change', 'input[type=radio]', function (event) {
62
+ event.preventDefault();
63
+ $form.find('input[type=text], .error').hide();
64
+ $form.find('.ig-deactivate-survey-option').removeClass('selected');
65
+ $(this).closest('.ig-deactivate-survey-option').addClass('selected').find('input[type=text]').show();
66
+ });
67
+ // Survey Skip & Deactivate.
68
+ $form.on('click', '.ig-deactivate-survey-deactivate', function (event) {
69
+ event.preventDefault();
70
+ location.href = $deactivateLink.attr('href');
71
+ });
72
+ // Survey submit.
73
+ $form.submit(function (event) {
74
+ event.preventDefault();
75
+ if (!$form.find('input[type=radio]:checked').val()) {
76
+ $form.find('.ig-deactivate-survey-footer').prepend('<span class="error"><?php echo esc_js( __( 'Please select an option', 'email-subscribers' ) ); ?></span>');
77
+ return;
78
+ }
79
+
80
+ var data = {
81
+ action: '<?php echo $this->ajax_action; ?>',
82
+ feedback: [{
83
+ type: 'radio',
84
+ slug: 'why-are-ypu-deactivating-email-subscribers',
85
+ title: 'Why are you deactivating Email Subscribers',
86
+ value: $form.find('.selected input[type=radio]').attr('data-option-slug'),
87
+ details: $form.find('.selected input[type=text]').val()
88
+ }],
89
+
90
+ event: 'esfree.plugin.deactivation',
91
+ };
92
+
93
+ var submitSurvey = $.post(ajaxurl, data);
94
+ submitSurvey.always(function () {
95
+ location.href = $deactivateLink.attr('href');
96
+ });
97
+ });
98
+ // Exit key closes survey when open.
99
+ $(document).keyup(function (event) {
100
+ if (27 === event.keyCode && formOpen) {
101
+ $overlay.hide();
102
+ formOpen = false;
103
+ $deactivateLink.focus();
104
+ }
105
+ });
106
+ });
107
+ </script>
108
+ <?php
109
+ }
110
+
111
+ /**
112
+ * Survey CSS.
113
+ *
114
+ * @since 1.0.0
115
+ */
116
+ public function css() {
117
+
118
+ if ( ! $this->is_plugin_page() ) {
119
+ return;
120
+ }
121
+ ?>
122
+ <style type="text/css">
123
+ .ig-deactivate-survey-modal {
124
+ display: none;
125
+ table-layout: fixed;
126
+ position: fixed;
127
+ z-index: 9999;
128
+ width: 100%;
129
+ height: 100%;
130
+ text-align: center;
131
+ font-size: 14px;
132
+ top: 0;
133
+ left: 0;
134
+ background: rgba(0, 0, 0, 0.8);
135
+ }
136
+
137
+ .ig-deactivate-survey-wrap {
138
+ display: table-cell;
139
+ vertical-align: middle;
140
+ }
141
+
142
+ .ig-deactivate-survey {
143
+ background-color: #fff;
144
+ max-width: 550px;
145
+ margin: 0 auto;
146
+ padding: 30px;
147
+ text-align: left;
148
+ }
149
+
150
+ .ig-deactivate-survey .error {
151
+ display: block;
152
+ color: red;
153
+ margin: 0 0 10px 0;
154
+ }
155
+
156
+ .ig-deactivate-survey-title {
157
+ display: block;
158
+ font-size: 18px;
159
+ font-weight: 700;
160
+ text-transform: uppercase;
161
+ border-bottom: 1px solid #ddd;
162
+ padding: 0 0 18px 0;
163
+ margin: 0 0 18px 0;
164
+ }
165
+
166
+ .ig-deactivate-survey-title span {
167
+ color: #999;
168
+ margin-right: 10px;
169
+ }
170
+
171
+ .ig-deactivate-survey-desc {
172
+ display: block;
173
+ font-weight: 600;
174
+ margin: 0 0 18px 0;
175
+ }
176
+
177
+ .ig-deactivate-survey-option {
178
+ margin: 0 0 10px 0;
179
+ }
180
+
181
+ .ig-deactivate-survey-option-input {
182
+ margin-right: 10px !important;
183
+ }
184
+
185
+ .ig-deactivate-survey-option-details {
186
+ display: none;
187
+ width: 90%;
188
+ margin: 10px 0 0 30px;
189
+ }
190
+
191
+ .ig-deactivate-survey-footer {
192
+ margin-top: 18px;
193
+ }
194
+
195
+ .ig-deactivate-survey-deactivate {
196
+ float: right;
197
+ font-size: 13px;
198
+ color: #ccc;
199
+ text-decoration: none;
200
+ padding-top: 7px;
201
+ }
202
+ </style>
203
+ <?php
204
+ }
205
+
206
+ /**
207
+ * Survey modal.
208
+ *
209
+ * @since 1.0.0
210
+ */
211
+ public function modal() {
212
+
213
+ if ( ! $this->is_plugin_page() ) {
214
+ return;
215
+ }
216
+
217
+ $options = array(
218
+ 1 => array(
219
+ 'title' => esc_html__( 'I no longer need the plugin', 'email-subscribers' ),
220
+ 'slug' => 'i-no-longer-need-the-plugin'
221
+ ),
222
+ 2 => array(
223
+ 'title' => esc_html__( 'I\'m switching to a different plugin', 'email-subscribers' ),
224
+ 'slug' => 'i-am-switching-to-a-different-plugin',
225
+ 'details' => esc_html__( 'Please share which plugin', 'email-subscribers' ),
226
+ ),
227
+ 3 => array(
228
+ 'title' => esc_html__( 'I couldn\'t get the plugin to work', 'email-subscribers' ),
229
+ 'slug' => 'i-could-not-get-the-plugin-to-work'
230
+ ),
231
+ 4 => array(
232
+ 'title' => esc_html__( 'It\'s a temporary deactivation', 'email-subscribers' ),
233
+ 'slug' => 'it-is-a-temporary-deactivation'
234
+ ),
235
+ 5 => array(
236
+ 'title' => esc_html__( 'Other', 'email-subscribers' ),
237
+ 'slug' => 'other',
238
+ 'details' => esc_html__( 'Please share the reason', 'email-subscribers' ),
239
+ ),
240
+ );
241
+ ?>
242
+ <div class="ig-deactivate-survey-modal" id="ig-deactivate-survey-<?php echo $this->plugin; ?>">
243
+ <div class="ig-deactivate-survey-wrap">
244
+ <form class="ig-deactivate-survey" method="post">
245
+ <span class="ig-deactivate-survey-title"><span class="dashicons dashicons-testimonial"></span><?php echo ' ' . esc_html__( 'Quick Feedback', 'email-subscribers' ); ?></span>
246
+ <span class="ig-deactivate-survey-desc"><?php echo sprintf( esc_html__( 'If you have a moment, please share why you are deactivating %s:', 'email-subscribers' ), $this->name ); ?></span>
247
+ <div class="ig-deactivate-survey-options">
248
+ <?php foreach ( $options as $id => $option ) : ?>
249
+ <div class="ig-deactivate-survey-option">
250
+ <label for="ig-deactivate-survey-option-<?php echo $this->plugin; ?>-<?php echo $id; ?>" class="ig-deactivate-survey-option-label">
251
+ <input id="ig-deactivate-survey-option-<?php echo $this->plugin; ?>-<?php echo $id; ?>" class="ig-deactivate-survey-option-input" type="radio" name="code" value="<?php echo $id; ?>" data-option-slug="<?php echo $option['slug']; ?>" />
252
+ <span class="ig-deactivate-survey-option-reason"><?php echo $option['title']; ?></span>
253
+ </label>
254
+ <?php if ( ! empty( $option['details'] ) ) : ?>
255
+ <input class="ig-deactivate-survey-option-details" type="text" placeholder="<?php echo $option['details']; ?>"/>
256
+ <?php endif; ?>
257
+ </div>
258
+ <?php endforeach; ?>
259
+ </div>
260
+ <div class="ig-deactivate-survey-footer">
261
+ <button type="submit" class="ig-deactivate-survey-submit button button-primary button-large"><?php echo sprintf( esc_html__( 'Submit %s Deactivate', 'email-subscribers' ), '&amp;' ); ?></button>
262
+ <a href="#" class="ig-deactivate-survey-deactivate"><?php echo sprintf( esc_html__( 'Skip %s Deactivate', 'email-subscribers' ), '&amp;' ); ?></a>
263
+ </div>
264
+ </form>
265
+ </div>
266
+ </div>
267
+ <?php
268
+ }
269
+
270
+ /**
271
+ * Is plugin in development mode?
272
+ * @return bool
273
+ */
274
+ public function is_dev_mode() {
275
+
276
+ if ( defined( 'IG_ES_DEV_MODE' ) && IG_ES_DEV_MODE ) {
277
+ return true;
278
+ }
279
+
280
+ return false;
281
+ }
282
+
283
+ /**
284
+ * Can we show feedback widget in this environment
285
+ *
286
+ * @return bool
287
+ */
288
+ public function can_show_feedback_widget() {
289
+
290
+ // Is development mode? Enable it.
291
+ if($this->is_dev_mode()) {
292
+ return true;
293
+ }
294
+
295
+ // Don't show on dev setup if dev mode is off.
296
+ if($this->is_dev_url()) {
297
+ return false;
298
+ }
299
+
300
+ return true;
301
+ }
302
+
303
+ /**
304
+ * Checks if current admin screen is the plugins page.
305
+ *
306
+ * @return bool
307
+ * @since 1.0.0
308
+ */
309
+ public function is_plugin_page() {
310
+
311
+ $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
312
+ if ( empty( $screen ) ) {
313
+ return false;
314
+ }
315
+
316
+ return ( ! empty( $screen->id ) && in_array( $screen->id, array( 'plugins', 'plugins-network' ), true ) );
317
+ }
318
+
319
+ /**
320
+ * Get additional plugin specific information
321
+ */
322
+ public function get_additional_info() {
323
+ $additional_info = array();
324
+
325
+ $additional_info['ig_es_version'] = ES_PLUGIN_VERSION;
326
+
327
+ return $additional_info;
328
+ }
329
+
330
+ }
331
+ } // End if().
includes/feedback/class-ig-feedback-v-1-0-0.php ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( ! class_exists( 'IG_Feedback_V_1_0_0' ) ) {
6
+ /**
7
+ * Icegram Deactivation Survey.
8
+ *
9
+ * This prompts the user for more details when they deactivate the plugin.
10
+ *
11
+ * @version 1.0
12
+ * @package Icegram
13
+ * @author Malay Ladu
14
+ * @license GPL-2.0+
15
+ * @copyright Copyright (c) 2019
16
+ */
17
+ class IG_Feedback_V_1_0_0 {
18
+
19
+ /**
20
+ * The API URL where we will send feedback data.
21
+ *
22
+ * @since 1.0.0
23
+ * @var string
24
+ */
25
+ public $api_url = 'https://api.icegram.com/store/feedback/'; // Production
26
+
27
+ /**
28
+ * Name for this plugin.
29
+ *
30
+ * @since 1.0.0
31
+ * @var string
32
+ */
33
+ public $name;
34
+
35
+ /**
36
+ * Unique slug for this plugin.
37
+ *
38
+ * @since 1.0.0
39
+ * @var string
40
+ */
41
+ public $plugin;
42
+
43
+ /**
44
+ * Ajax action where feedback data will post
45
+ *
46
+ * @since 1.0.0
47
+ * @var string
48
+ */
49
+ public $ajax_action;
50
+
51
+ /**
52
+ * Plugin Abbreviation
53
+ *
54
+ * @since 1.0.0
55
+ * @var string
56
+ */
57
+ public $plugin_abbr;
58
+
59
+ /**
60
+ * Primary class constructor.
61
+ *
62
+ * @param string $name Plugin name.
63
+ * @param string $plugin Plugin slug.
64
+ *
65
+ * @since 1.0.0
66
+ */
67
+ public function __construct( $name = '', $plugin = '', $plugin_abbr = 'ig_fb' ) {
68
+ $this->name = $name;
69
+ $this->plugin = $plugin;
70
+ $this->plugin_abbr = $plugin_abbr;
71
+ $this->ajax_action = 'ig-submit-feedback';
72
+
73
+ add_action( 'wp_ajax_' . $this->ajax_action, array( $this, 'submit_feedback' ) );
74
+ }
75
+
76
+ /**
77
+ * It's a default constant for Feedback.
78
+ *
79
+ * @return bool
80
+ */
81
+ public function is_dev_mode() {
82
+
83
+ if ( defined( 'IG_FEEDBACK_DEV_MODE' ) && IG_FEEDBACK_DEV_MODE ) {
84
+ return true;
85
+ }
86
+
87
+ return false;
88
+ }
89
+
90
+ /**
91
+ * Get API Url. It's a different for dev & production mode
92
+ *
93
+ * @return string
94
+ */
95
+ public function get_api_url() {
96
+
97
+ if ( $this->is_dev_mode() ) {
98
+ $this->api_url = 'http://192.168.0.130:9094/store/feedback/'; // Malay: Development
99
+ }
100
+
101
+ return $this->api_url;
102
+ }
103
+
104
+ /**
105
+ * Checks if current site is a development one.
106
+ *
107
+ * @return bool
108
+ * @since 1.2.0
109
+ */
110
+ public function is_dev_url() {
111
+
112
+ $url = network_site_url( '/' );
113
+ $is_local_url = false;
114
+
115
+ // Trim it up
116
+ $url = strtolower( trim( $url ) );
117
+
118
+ // Need to get the host...so let's add the scheme so we can use parse_url
119
+ if ( false === strpos( $url, 'http://' ) && false === strpos( $url, 'https://' ) ) {
120
+ $url = 'http://' . $url;
121
+ }
122
+ $url_parts = parse_url( $url );
123
+ $host = ! empty( $url_parts['host'] ) ? $url_parts['host'] : false;
124
+ if ( ! empty( $url ) && ! empty( $host ) ) {
125
+ if ( false !== ip2long( $host ) ) {
126
+ if ( ! filter_var( $host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) ) {
127
+ $is_local_url = true;
128
+ }
129
+ } elseif ( 'localhost' === $host ) {
130
+ $is_local_url = true;
131
+ }
132
+
133
+ $tlds_to_check = array( '.dev', '.local', ':8888' );
134
+ foreach ( $tlds_to_check as $tld ) {
135
+ if ( false !== strpos( $host, $tld ) ) {
136
+ $is_local_url = true;
137
+ continue;
138
+ }
139
+
140
+ }
141
+ if ( substr_count( $host, '.' ) > 1 ) {
142
+ $subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' );
143
+ foreach ( $subdomains_to_check as $subdomain ) {
144
+ $subdomain = str_replace( '.', '(.)', $subdomain );
145
+ $subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain );
146
+ if ( preg_match( '/^(' . $subdomain . ')/', $host ) ) {
147
+ $is_local_url = true;
148
+ continue;
149
+ }
150
+ }
151
+ }
152
+ }
153
+
154
+ return $is_local_url;
155
+ }
156
+
157
+ /**
158
+ * Collect Meta information
159
+ *
160
+ * @return array|mixed|void
161
+ */
162
+ public function get_additional_info() {
163
+ return array();
164
+ }
165
+
166
+ /**
167
+ * Hook to ajax_action
168
+ *
169
+ * Send feedback to server
170
+ */
171
+ function submit_feedback() {
172
+
173
+ $data = ! empty( $_POST ) ? $_POST : array();
174
+
175
+ $data['site'] = esc_url( home_url() );
176
+
177
+ $meta_info = array(
178
+ 'plugin' => sanitize_key( $this->plugin ),
179
+ 'locale' => get_locale(),
180
+ 'wp_version' => get_bloginfo( 'version' )
181
+ );
182
+
183
+ $additional_info = $this->get_additional_info(); // Get Additional meta information
184
+
185
+ if ( is_array( $meta_info ) && count( $meta_info ) > 0 ) {
186
+ $meta_info = $meta_info + $additional_info;
187
+ }
188
+
189
+ $data['meta'] = $meta_info;
190
+
191
+ $args = array(
192
+ 'timeout' => 15,
193
+ 'sslverify' => false,
194
+ 'body' => $data,
195
+ 'blocking' => false
196
+ );
197
+
198
+ $response = wp_remote_post( $this->get_api_url(), $args );
199
+
200
+ $result['status'] = 'success';
201
+ if ( $response instanceof WP_Error ) {
202
+ $error_message = $response->get_error_message();
203
+ $result['status'] = 'error';
204
+ $result['message'] = $error_message;
205
+ }
206
+
207
+ die( json_encode( $result ) );
208
+
209
+ }
210
+
211
+ }
212
+ } // End if().
includes/feedback/class-ig-tracker.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly.
5
+ }
6
+
7
+ if ( ! class_exists( 'IG_Tracker' ) ) {
8
+
9
+ /**
10
+ * Icegram tracker.
11
+ *
12
+ * Icegram tracker handler class is responsible for sending anonymous plugin
13
+ * data to Icegram servers for users that actively allowed data tracking.
14
+ *
15
+ * @since 1.0.0
16
+ */
17
+ class IG_Tracker {
18
+
19
+ /**
20
+ * Get Active & Inactive plugins info
21
+ *
22
+ * @return array
23
+ *
24
+ * @since 1.0.0
25
+ */
26
+ public static function get_plugins( $status = 'all', $details = false ) {
27
+
28
+ $plugins = array(
29
+ 'active_plugins' => array(),
30
+ 'inactive_plugins' => array()
31
+ );
32
+
33
+ $all_plugins = get_plugins();
34
+ $active_plugins = get_option( 'active_plugins', array() );
35
+
36
+ if ( is_multisite() ) {
37
+ $sitewide_activated_plugins = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
38
+ $active_plugins = ! empty( $active_plugins ) ? array_merge( $sitewide_activated_plugins, $active_plugins ) : $sitewide_activated_plugins;
39
+ }
40
+
41
+ $i = 0;
42
+ foreach ( $all_plugins as $plugin_path => $plugin ) {
43
+ // If the plugin isn't active, don't show it.
44
+ if ( in_array( $plugin_path, $active_plugins ) ) {
45
+ $slug = 'active_plugins';
46
+ } else {
47
+ $slug = 'inactive_plugins';
48
+ }
49
+
50
+ if ( $details ) {
51
+
52
+ $plugin_data = array(
53
+ 'name' => $plugin['Name'],
54
+ 'version' => $plugin['Version'],
55
+ 'author' => $plugin['Author'],
56
+ 'author_uri' => $plugin['AuthorURI'],
57
+ 'plugin_uri' => $plugin['PluginURI']
58
+ );
59
+
60
+ $plugins[ $slug ][ $plugin_path ] = $plugin_data;
61
+ } else {
62
+ $plugins[ $slug ][] = $plugin_path;
63
+ }
64
+ }
65
+
66
+ if ( 'active' === $status ) {
67
+ return $plugins['active_plugins'];
68
+ } elseif ( 'in_active' === $status ) {
69
+ return $plugins['inactive_plugins'];
70
+ } else {
71
+ return $plugins;
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Get Active Plugins
77
+ *
78
+ * @param bool $details
79
+ *
80
+ * @return array
81
+ *
82
+ * @since 1.0.0
83
+ */
84
+ public static function get_active_plugins( $details = false ) {
85
+ return self::get_plugins( 'active', $details );
86
+ }
87
+
88
+ /**
89
+ * Get Inactive plugins
90
+ *
91
+ * @param bool $details
92
+ *
93
+ * @return array
94
+ *
95
+ * @since 1.0.0
96
+ */
97
+ public static function get_in_active_plugins( $details = false ) {
98
+ return self::get_plugins( 'in_active', $details );
99
+ }
100
+
101
+ /**
102
+ * Get Current Theme Info
103
+ *
104
+ * @return array
105
+ *
106
+ * @since 1.0.0
107
+ */
108
+ public static function get_current_theme_info() {
109
+ $current_theme = array();
110
+ if ( function_exists( 'wp_get_theme' ) ) {
111
+ $theme_data = wp_get_theme();
112
+ $current_theme = array(
113
+ 'name' => $theme_data->get( 'Name' ),
114
+ 'version' => $theme_data->get( 'Version' ),
115
+ 'author' => $theme_data->get( 'Author' ),
116
+ 'author_uri' => $theme_data->get( 'AuthorURI' )
117
+ );
118
+ } elseif ( function_exists( 'get_theme_data' ) ) {
119
+ $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
120
+ $current_theme = array(
121
+ 'name' => $theme_data['Name'],
122
+ 'version' => $theme_data['Version'],
123
+ 'author' => $theme_data['Author'],
124
+ 'author_uri' => $theme_data['AuthorURI']
125
+ );
126
+ }
127
+
128
+ return $current_theme;
129
+ }
130
+
131
+ /**
132
+ * Get server info
133
+ *
134
+ * @return array
135
+ *
136
+ * @since 1.0.0
137
+ */
138
+ public static function get_server_info() {
139
+ global $wpdb;
140
+
141
+ $server_info = array(
142
+ 'php_version' => PHP_VERSION,
143
+ 'mysql_version' => $wpdb->db_version(),
144
+ 'web_server_info' => $_SERVER['SERVER_SOFTWARE'],
145
+ 'user_agent' => $_SERVER['HTTP_USER_AGENT'],
146
+ 'php_memory_limit' => ini_get( 'memory_limit' ),
147
+ 'php_post_max_size' => ini_get( 'post_max_size' ),
148
+ 'php_upload_max_file_size' => ini_get( 'upload_max_filesize' ),
149
+ 'php_max_execution_time' => ini_get( 'max_execution_time' ),
150
+ 'session' => isset( $_SESSION ) ? 'enabled' : 'disabled',
151
+ 'session_name' => esc_html( ini_get( 'session.name' ) ),
152
+ 'cookie_path' => esc_html( ini_get( 'session.cookie_path' ) ),
153
+ 'session_save_path' => esc_html( ini_get( 'session.save_path' ) ),
154
+ 'use_cookies' => ini_get( 'session.use_cookies' ) ? 'on' : 'off',
155
+ 'use_only_cookies' => ini_get( 'session.use_only_cookies' ) ? 'on' : 'off',
156
+ 'ssl_support_extension_loaded' => extension_loaded( 'openssl' ) ? 'yes' : 'no',
157
+ 'mb_string_extension_loaded' => extension_loaded( 'mbstring' ) ? 'yes' : 'no',
158
+ );
159
+
160
+ return $server_info;
161
+ }
162
+
163
+ /**
164
+ * Get WordPress information
165
+ *
166
+ * @return array
167
+ *
168
+ * @since 1.0.0
169
+ */
170
+ public static function get_wp_info() {
171
+ global $wpdb;
172
+
173
+ $wp_info = array(
174
+ 'site_url' => site_url(),
175
+ 'home_url' => home_url(),
176
+ 'wp_version' => get_bloginfo( 'version' ),
177
+ 'permalink_structure' => get_option( 'permalink_structure' ),
178
+ 'multisite' => is_multisite() ? 'yes' : 'no',
179
+ 'wp_debug' => defined( 'WP_DEBUG' ) ? ( WP_DEBUG ? 'enabled' : 'disabled' ) : '',
180
+ 'display_errors' => ( ini_get( 'display_errors' ) ) ? 'on' : 'off',
181
+ 'wp_table_prefix' => $wpdb->prefix,
182
+ 'wp_db_charset_Collate' => $wpdb->get_charset_collate(),
183
+ 'wp_memory_limit' => ( size_format( (int) WP_MEMORY_LIMIT * 1048576 ) ),
184
+ 'wp_upload_size' => ( size_format( wp_max_upload_size() ) ),
185
+ 'filesystem_method' => get_filesystem_method(),
186
+ );
187
+
188
+ return $wp_info;
189
+ }
190
+ }
191
+ }
includes/pro-features.php CHANGED
@@ -2,10 +2,12 @@
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
 
@@ -29,8 +31,8 @@ function ig_es_add_upsale( $fields ) {
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
 
@@ -39,20 +41,94 @@ function ig_es_add_upsale( $fields ) {
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
 
2
 
3
  add_filter( 'ig_es_registered_settings', 'ig_es_add_upsale', 10, 2 );
4
 
5
+ // Add additional tab "Comments" in Audience > Sync
6
+ add_filter( 'ig_es_sync_users_tabs', 'ig_es_add_sync_users_tabs', 11, 1 );
7
+
8
 
9
  add_action( 'ig_es_sync_users_tabs_comments', 'ig_es_add_comments_tab_settings' );
10
+ add_action( 'ig_es_sync_users_tabs_woocommerce', 'ig_es_add_woocommerce_tab_settings' );
11
 
12
  function ig_es_add_upsale( $fields ) {
13
 
31
  $field_smtp['es_upsale_smtp'] = array(
32
  'id' => 'ig_es_blocked_domains',
33
  'type' => 'html',
34
+ '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_smtp&utm_campaign=es_upsale"><img src="' . EMAIL_SUBSCRIBERS_URL . '/admin/images/es-smtp-label.png' . '"/></a></div>',
35
+ '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_smtp&utm_campaign=es_upsale"><img src="' . EMAIL_SUBSCRIBERS_URL . '/admin/images/es-smtp.png' . '"/></a></div>'
36
  );
37
  $fields['email_sending'] = array_merge( $fields['email_sending'], $field_smtp );
38
 
41
  return $fields;
42
  }
43
 
44
+ function ig_es_add_sync_users_tabs( $tabs ) {
45
+
46
  $tabs['comments'] = array(
47
+ 'name' => __( 'Comments', 'email-subscribers' ),
48
+ 'indicator_option' => 'ig_es_show_sync_comment_users_indicator',
49
+ 'indicator_label' => 'Starter'
50
  );
51
+
52
+ $woocommerce_plugin = 'woocommerce/woocommerce.php';
53
+ $active_plugins = IG_Tracker::get_active_plugins();
54
+
55
+ if ( in_array( $woocommerce_plugin, $active_plugins ) ) {
56
+ $tabs['woocommerce'] = array(
57
+ 'name' => __( 'WooCommerce', 'email-subscribers' ),
58
+ 'indicator_option' => 'ig_es_show_sync_woocommerce_users_indicator',
59
+ 'indicator_label' => 'Starter'
60
+ );
61
+ }
62
+
63
  return $tabs;
64
  }
65
 
66
+ function ig_es_add_comments_tab_settings( $tab_options ) {
67
+
68
+ // If you want to hide once shown. Set it to 'no'
69
+ // If you don't want to hide. do not use following code or set value as 'yes'
70
+ /*
71
+ if ( ! empty( $tab_options['indicator_option'] ) ) {
72
+ update_option( $tab_options['indicator_option'], 'yes' ); // yes/no
73
+ }
74
+ */
75
+
76
+ $info = array(
77
+ 'type' => 'info'
78
+ );
79
+
80
+ ob_start();
81
+ ?>
82
+ <div class="">
83
+ <h2>Sync Comment Users</h2>
84
+ <p>Quickly add to your mailing list when someone post a comment on your website.</p>
85
+ <h2>How to setup?</h2>
86
+ <p>Once you upgrade to <a href="https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=woocommerce_sync&utm_campaign=es_upsale">Email Subscribers Starter</a>, you will have settings panel where you need to enable Comment user sync and select the list in which you want to add people whenever someone post a comment.</p>
87
+ <hr>
88
+ <p class="help">Checkout <a href="https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=woocommerce_sync&utm_campaign=es_upsale">Email Subscribers Starter</a> Plan Now</p>
89
+ </div>
90
+ <?php
91
+
92
+ $content = ob_get_clean();
93
+
94
+ ?>
95
+ <a target="_blank" href="https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=es_comment_upsale&utm_campaign=es_upsale">
96
+ <img src=" <?php echo EMAIL_SUBSCRIBERS_URL . '/admin/images/es-comments.png' ?> "/>
97
+ </a>
98
  <?php
99
+ ES_Common::prepare_information_box( $info, $content );
100
  }
101
 
102
+ function ig_es_add_woocommerce_tab_settings( $tab_options ) {
103
+
104
+ $info = array(
105
+ 'type' => 'info',
106
+ );
107
+
108
+ ob_start();
109
+ ?>
110
+ <div class="">
111
+ <h2>Sync WooCommerce Customers</h2>
112
+ <p>Are you using WooCommerce for your online business? You can use this integration to add to a specific list whenever someone purchase something from you</p>
113
+ <h2>How to setup?</h2>
114
+ <p>Once you upgrade to <a href="https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=woocommerce_sync&utm_campaign=es_upsale">Email Subscribers Starter</a>, you will have following settings panel where you need to enable WooCommerce sync and select the list in which you want to add people whenever they purchase something
115
+ from you.</p>
116
+ <hr>
117
+ <p class="help">Checkout <a href="https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=woocommerce_sync&utm_campaign=es_upsale">Email Subscribers Starter</a> Now</p>
118
+ </div>
119
+ <?php $content = ob_get_clean(); ?>
120
+
121
+ <a target="_blank" href="https://www.icegram.com/email-subscribers-starter/?utm_source=in_app&utm_medium=es_comment_upsale&utm_campaign=es_upsale">
122
+ <img src=" <?php echo EMAIL_SUBSCRIBERS_URL . '/admin/images/woocommerce-sync.png' ?> "/>
123
+ </a>
124
+
125
+ <?php
126
+
127
+ ES_Common::prepare_information_box( $info, $content );
128
+
129
+ ?>
130
+
131
+ <?php
132
+ }
133
 
134
 
includes/upgrade/es-update-functions.php CHANGED
@@ -656,4 +656,17 @@ function ig_es_update_4015_db_version() {
656
  $db_update_option = '4015_db_updated_at';
657
  ES_Common::set_ig_option( $db_update_option, ig_get_current_date_time() );
658
  }
659
- /* --------------------- ES 4.0.15(End)--------------------------- */
 
 
 
 
 
 
 
 
 
 
 
 
 
656
  $db_update_option = '4015_db_updated_at';
657
  ES_Common::set_ig_option( $db_update_option, ig_get_current_date_time() );
658
  }
659
+ /* --------------------- ES 4.0.15(End)--------------------------- */
660
+ function ig_es_update_411_alter_contacts_table() {
661
+ global $wpdb;
662
+
663
+ $query = "ALTER TABLE {$wpdb->prefix}ig_contacts MODIFY `source` varchar(50) DEFAULT NULL";
664
+ $wpdb->query( $query );
665
+ }
666
+
667
+ function ig_es_update_411_db_version() {
668
+ ES_Install::update_db_version( '4.1.1' );
669
+ $db_update_option = '411_db_updated_at';
670
+ ES_Common::set_ig_option( $db_update_option, ig_get_current_date_time() );
671
+ }
672
+ /* --------------------- ES 4.1.1(End)--------------------------- */
public/class-email-subscribers-public.php CHANGED
@@ -212,6 +212,7 @@ class Email_Subscribers_Public {
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;
@@ -224,6 +225,7 @@ class Email_Subscribers_Public {
224
  'subscribed_ip' => null
225
  );
226
 
 
227
  $result = ES_DB_Lists_Contacts::add_lists_contacts( $list_contact_data );
228
  }
229
 
212
  }
213
 
214
  if ( empty( $contact['list_id'] ) ) {
215
+
216
  $optin_type = get_option( 'ig_es_optin_type', true );
217
  $optin_type = ( $optin_type === 'double_opt_in' ) ? 2 : 1;
218
  $list_id = ! empty( $list_id ) ? $list_id : 1;
225
  'subscribed_ip' => null
226
  );
227
 
228
+ ES_DB_Lists_Contacts::delete_list_contacts( $contact_id, array($list_id) );
229
  $result = ES_DB_Lists_Contacts::add_lists_contacts( $list_contact_data );
230
  }
231
 
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  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.1
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
@@ -301,6 +301,11 @@ Use our free plugin [Email Subscribers - Group Selector](https://wordpress.org/p
301
 
302
  == Changelog ==
303
 
 
 
 
 
 
304
  = 4.1 (14.05.2019) =
305
  * New: Now, able to change the label of "Subscribe" button
306
 
4
  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.2
8
+ Stable tag: 4.1.1
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses
11
 
301
 
302
  == Changelog ==
303
 
304
+ = 4.1.1 (21.05.2019) =
305
+ * Fix: "Oops.. Unexpected error occurred" while subscribing
306
+ * Fix: Typo in "Campaigns > Edit Post Notification" title
307
+ * Fix: Duplicate lists while syncing WordPress users
308
+
309
  = 4.1 (14.05.2019) =
310
  * New: Now, able to change the label of "Subscribe" button
311