Email Subscribers & Newsletters - Version 5.4.12

Version Description

  • Enhancement: Add title for list names on add contact screen
  • Enhancement: Improve error handling when email sending fails for some email addresses
  • Fix: Fatal error when getmypid function is disabled on hosts with PHP v8
  • Fix: Fatal error Fatal error: Uncaught TypeError: number_format() on dashboard

=

Download this release

Release Info

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

Code changes from version 5.4.11 to 5.4.12

email-subscribers.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Email Subscribers & Newsletters
4
  * Plugin URI: https://www.icegram.com/
5
  * Description: Add subscription forms on website, send HTML newsletters & automatically notify subscribers about new blog posts once it is published.
6
- * Version: 5.4.11
7
  * Author: Icegram
8
  * Author URI: https://www.icegram.com/
9
  * Requires at least: 3.9
@@ -67,7 +67,7 @@ if ( ! version_compare( PHP_VERSION, IG_ES_MIN_PHP_VER, '>=' ) ) {
67
  * @since 4.3.0
68
  */
69
  if ( ! defined( 'IG_ES_FEEDBACK_TRACKER_VERSION' ) ) {
70
- define( 'IG_ES_FEEDBACK_TRACKER_VERSION', '1.2.6' );
71
  }
72
 
73
  if ( ! defined( 'IG_ES_TRACKER_VERSION' ) ) {
@@ -187,7 +187,7 @@ if ( 'premium' === $ig_es_plan ) {
187
  /* ***************************** Initial Compatibility Work (End) ******************* */
188
 
189
  if ( ! defined( 'ES_PLUGIN_VERSION' ) ) {
190
- define( 'ES_PLUGIN_VERSION', '5.4.11' );
191
  }
192
 
193
  // Plugin Folder Path.
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: 5.4.12
7
  * Author: Icegram
8
  * Author URI: https://www.icegram.com/
9
  * Requires at least: 3.9
67
  * @since 4.3.0
68
  */
69
  if ( ! defined( 'IG_ES_FEEDBACK_TRACKER_VERSION' ) ) {
70
+ define( 'IG_ES_FEEDBACK_TRACKER_VERSION', '1.2.7' );
71
  }
72
 
73
  if ( ! defined( 'IG_ES_TRACKER_VERSION' ) ) {
187
  /* ***************************** Initial Compatibility Work (End) ******************* */
188
 
189
  if ( ! defined( 'ES_PLUGIN_VERSION' ) ) {
190
+ define( 'ES_PLUGIN_VERSION', '5.4.12' );
191
  }
192
 
193
  // Plugin Folder Path.
lite/admin/partials/dashboard.php CHANGED
@@ -350,7 +350,7 @@ $allowed_html_tags = ig_es_allowed_html_tags_in_esc();
350
  ?>
351
  <div class="inline-block es-tooltip relative align-middle cursor-pointer">
352
  <span class="text-sm mr-0.5 <?php echo esc_attr( $text_color_class ); ?>">
353
- <?php echo esc_html( number_format_i18n( $open_percentage_growth, 2 ) ); ?>%
354
  <?php echo wp_kses( $arraw_html, $allowed_html_tags ); ?>
355
  </span>
356
  <span class="break-words invisible h-auto lg:w-48 xl:w-64 tracking-wide absolute z-70 tooltip-text bg-black text-gray-300 text-xs rounded p-3 py-2">
@@ -400,7 +400,7 @@ $allowed_html_tags = ig_es_allowed_html_tags_in_esc();
400
  </span>
401
  <div class="inline-block es-tooltip relative align-middle cursor-pointer">
402
  <span class="text-sm mr-0.5 <?php echo esc_attr( $text_color_class ); ?>">
403
- <?php echo esc_html( number_format_i18n( $click_percentage_growth, 2 ) ); ?>%
404
  <?php echo wp_kses( $arraw_html, $allowed_html_tags ); ?>
405
  </span>
406
  <span class="break-words invisible h-auto lg:w-48 xl:w-64 tracking-wide absolute z-70 tooltip-text bg-black text-gray-300 text-xs rounded p-3 py-2">
350
  ?>
351
  <div class="inline-block es-tooltip relative align-middle cursor-pointer">
352
  <span class="text-sm mr-0.5 <?php echo esc_attr( $text_color_class ); ?>">
353
+ <?php echo esc_html( $open_percentage_growth ); ?>%
354
  <?php echo wp_kses( $arraw_html, $allowed_html_tags ); ?>
355
  </span>
356
  <span class="break-words invisible h-auto lg:w-48 xl:w-64 tracking-wide absolute z-70 tooltip-text bg-black text-gray-300 text-xs rounded p-3 py-2">
400
  </span>
401
  <div class="inline-block es-tooltip relative align-middle cursor-pointer">
402
  <span class="text-sm mr-0.5 <?php echo esc_attr( $text_color_class ); ?>">
403
+ <?php echo esc_html( $click_percentage_growth ); ?>%
404
  <?php echo wp_kses( $arraw_html, $allowed_html_tags ); ?>
405
  </span>
406
  <span class="break-words invisible h-auto lg:w-48 xl:w-64 tracking-wide absolute z-70 tooltip-text bg-black text-gray-300 text-xs rounded p-3 py-2">
lite/includes/classes/class-es-contacts-table.php CHANGED
@@ -973,9 +973,9 @@ class ES_Contacts_Table extends ES_List_Table {
973
  if ( ! empty( $list_contact_status_map[ $list_id ] ) ) {
974
  $status_span = '<span class="border-gray-400 focus:bg-gray-100 es_list_contact_status ' . $list_contact_status_map[ $list_id ] . '" title="' . ucwords( $list_contact_status_map[ $list_id ] ) . '">';
975
  }
976
-
977
  $list_name = strlen( $list_name ) > 15 ? substr( $list_name, 0, 15 ) . '...' : $list_name;
978
- $lists_html .= "<td class='pr-1 pt-2 text-sm leading-5 font-normal text-gray-500'>$status_span$list_name</td><td>$status_dropdown_html</td>";
979
 
980
  $i ++;
981
  }
973
  if ( ! empty( $list_contact_status_map[ $list_id ] ) ) {
974
  $status_span = '<span class="border-gray-400 focus:bg-gray-100 es_list_contact_status ' . $list_contact_status_map[ $list_id ] . '" title="' . ucwords( $list_contact_status_map[ $list_id ] ) . '">';
975
  }
976
+ $list_title = $list_name;
977
  $list_name = strlen( $list_name ) > 15 ? substr( $list_name, 0, 15 ) . '...' : $list_name;
978
+ $lists_html .= "<td class='pr-1 pt-2 text-sm leading-5 font-normal text-gray-500'>$status_span<span title='$list_title'>$list_name</span></td><td>$status_dropdown_html</td>";
979
 
980
  $i ++;
981
  }
lite/includes/classes/class-es-cron.php CHANGED
@@ -203,7 +203,12 @@ class ES_Cron {
203
  return $process_id;
204
  }
205
 
206
- $process_id = @getmypid();
 
 
 
 
 
207
 
208
  update_option( 'ig_es_cron_lock_' . $key, $process_id, false );
209
 
203
  return $process_id;
204
  }
205
 
206
+ // On some hosts getmypid is disabled due to security reasons.
207
+ if ( function_exists( 'getmypid' ) ) {
208
+ $process_id = @getmypid();
209
+ } else {
210
+ $process_id = wp_rand();
211
+ }
212
 
213
  update_option( 'ig_es_cron_lock_' . $key, $process_id, false );
214
 
lite/includes/classes/class-es-queue.php CHANGED
@@ -776,18 +776,36 @@ if ( ! class_exists( 'ES_Queue' ) ) {
776
 
777
  $campaign_failed = did_action( 'ig_es_message_failed' );
778
  if ( $campaign_failed ) {
779
- $notification_meta = maybe_unserialize( $notification['meta'] );
780
- $failed_count = isset( $notification_meta['failed_count'] ) ? $notification_meta['failed_count'] : 0;
781
- $failed_count++;
782
- $notification_meta['failed_count'] = $failed_count;
783
- $notification_data = array(
784
- 'meta' => maybe_serialize( $notification_meta ),
785
  );
786
- if ( $failed_count >= 3 ) {
787
- $notification_data['status'] = IG_ES_MAILING_QUEUE_STATUS_FAILED;
788
- do_action( 'ig_es_campaign_failed', $notification_guid );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
789
  }
790
- ES_DB_Mailing_Queue::update_mailing_queue( $message_id, $notification_data );
791
  }
792
 
793
  // TODO: Implement better solution
776
 
777
  $campaign_failed = did_action( 'ig_es_message_failed' );
778
  if ( $campaign_failed ) {
779
+ $pending_statuses = array(
780
+ IG_ES_SENDING_QUEUE_STATUS_QUEUED,
781
+ IG_ES_SENDING_QUEUE_STATUS_SENDING
 
 
 
782
  );
783
+ $pending_emails = ES_DB_Sending_Queue::get_total_emails_to_be_sent_by_hash( $notification_guid, $pending_statuses );
784
+ if ( empty( $pending_emails ) ) {
785
+ $notification_meta = maybe_unserialize( $notification['meta'] );
786
+ $failed_count = isset( $notification_meta['failed_count'] ) ? $notification_meta['failed_count'] : 0;
787
+ $failed_count++;
788
+ $notification_meta['failed_count'] = $failed_count;
789
+ $notification_data = array(
790
+ 'meta' => maybe_serialize( $notification_meta ),
791
+ );
792
+ if ( $failed_count >= 3 ) {
793
+ $notification_data['status'] = IG_ES_MAILING_QUEUE_STATUS_FAILED;
794
+ do_action( 'ig_es_campaign_failed', $notification_guid );
795
+ }
796
+ ES_DB_Mailing_Queue::update_mailing_queue( $message_id, $notification_data );
797
+ }
798
+ } elseif ( $triggered_by_admin ) {
799
+ $notification_status = $notification['status'];
800
+ if ( IG_ES_MAILING_QUEUE_STATUS_FAILED === $notification_status ) {
801
+ $notification_meta = maybe_unserialize( $notification['meta'] );
802
+ unset( $notification_meta['failed_count'] );
803
+ $notification_data = array(
804
+ 'meta' => maybe_serialize( $notification_meta ),
805
+ );
806
+ $notification_data['status'] = IG_ES_MAILING_QUEUE_STATUS_SENDING;
807
+ ES_DB_Mailing_Queue::update_mailing_queue( $message_id, $notification_data );
808
  }
 
809
  }
810
 
811
  // TODO: Implement better solution
lite/includes/db/class-es-db-sending-queue.php CHANGED
@@ -55,12 +55,15 @@ class ES_DB_Sending_Queue {
55
  $where = apply_filters( 'ig_es_get_emails_to_be_sent_by_hash_condition', 'AND 1=1' );
56
  $subscribers = $wpbd->get_results(
57
  $wpbd->prepare(
58
- "SELECT * FROM {$wpbd->prefix}ig_sending_queue WHERE status IN( %s, %s, %s ) AND mailing_queue_hash = %s $where ORDER BY id LIMIT 0, %d",
59
  array(
60
  IG_ES_SENDING_QUEUE_STATUS_QUEUED,
61
  IG_ES_SENDING_QUEUE_STATUS_SENDING,
62
  IG_ES_SENDING_QUEUE_STATUS_FAILED,
63
  $guid,
 
 
 
64
  $limit,
65
  )
66
  ),
@@ -136,21 +139,34 @@ class ES_DB_Sending_Queue {
136
  }
137
 
138
  /* count cron email */
139
- public static function get_total_emails_to_be_sent_by_hash( $notification_hash = '' ) {
140
 
141
- global $wpdb;
142
 
143
  $result = 0;
144
  if ( ! empty( $notification_hash ) ) {
145
- $result = $wpdb->get_var(
146
- $wpdb->prepare(
147
- "SELECT COUNT(*) AS count FROM {$wpdb->prefix}ig_sending_queue WHERE mailing_queue_hash = %s AND status IN ( %s, %s, %s )",
148
- array(
149
- $notification_hash,
150
- IG_ES_SENDING_QUEUE_STATUS_QUEUED,
151
- IG_ES_SENDING_QUEUE_STATUS_SENDING,
152
- IG_ES_SENDING_QUEUE_STATUS_FAILED,
153
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  )
155
  );
156
  }
55
  $where = apply_filters( 'ig_es_get_emails_to_be_sent_by_hash_condition', 'AND 1=1' );
56
  $subscribers = $wpbd->get_results(
57
  $wpbd->prepare(
58
+ "SELECT * FROM {$wpbd->prefix}ig_sending_queue WHERE status IN( %s, %s, %s ) AND mailing_queue_hash = %s $where ORDER BY FIELD(`status`, %s, %s, %s) LIMIT 0, %d",
59
  array(
60
  IG_ES_SENDING_QUEUE_STATUS_QUEUED,
61
  IG_ES_SENDING_QUEUE_STATUS_SENDING,
62
  IG_ES_SENDING_QUEUE_STATUS_FAILED,
63
  $guid,
64
+ IG_ES_SENDING_QUEUE_STATUS_QUEUED,
65
+ IG_ES_SENDING_QUEUE_STATUS_SENDING,
66
+ IG_ES_SENDING_QUEUE_STATUS_FAILED,
67
  $limit,
68
  )
69
  ),
139
  }
140
 
141
  /* count cron email */
142
+ public static function get_total_emails_to_be_sent_by_hash( $notification_hash = '', $statuses = array() ) {
143
 
144
+ global $wpbd;
145
 
146
  $result = 0;
147
  if ( ! empty( $notification_hash ) ) {
148
+
149
+
150
+ $params = array( $notification_hash );
151
+
152
+ if ( empty( $statuses ) ) {
153
+ $statuses = array(
154
+ IG_ES_SENDING_QUEUE_STATUS_QUEUED,
155
+ IG_ES_SENDING_QUEUE_STATUS_SENDING,
156
+ IG_ES_SENDING_QUEUE_STATUS_FAILED,
157
+ );
158
+ }
159
+
160
+
161
+ $statuses_count = count( $statuses );
162
+ $statuses_placeholders = array_fill( 0, $statuses_count, '%s' );
163
+
164
+ $params = array_merge( $params, $statuses );
165
+
166
+ $result = $wpbd->get_var(
167
+ $wpbd->prepare(
168
+ "SELECT COUNT(*) AS count FROM {$wpbd->prefix}ig_sending_queue WHERE mailing_queue_hash = %s AND status IN ( " . implode( ',', $statuses_placeholders ) . ' )',
169
+ $params
170
  )
171
  );
172
  }
lite/includes/feedback.php CHANGED
@@ -226,20 +226,31 @@ function ig_es_render_iges_merge_feedback() {
226
  'title' => __( 'Subscription forms and CTAs??', 'email-subscribers' ),
227
  'event' => $event,
228
  'desc' => '<div><p class="mt-4">You use <a href="https://wordpress.org/plugins/email-subscribers" target="_blank"><b class="text-blue-700 font-semibold underline">Email Subscribers</b></a> to send email campaigns.</p><p class="mt-3">Would you like us to include onsite popups and action bars in the plugin as well? This way you can <b class="font-semibold">convert visitors to subscribers, drive traffic and run email marketing from a single plugin</b>.</p> <p class="mt-3">Why do we ask?</p> <p class="mt-3">Our <a class="text-blue-700 font-semibold underline" href="https://wordpress.org/plugins/icegram" target="_blank"><b>Icegram</b></a> plugin already does onsite campaigns. We are thinking of merging Icegram & Email Subscribers into a single plugin.</p> <p class="mt-3"><b class="font-semibold">Will a comprehensive ConvertKit / MailChimp like email + onsite campaign plugin be useful to you?</b></p> </div><p class="mt-3">',
229
- 'poll_options' => array(
230
- 'yes' => array(
231
- 'text' => '<b>' . __( 'Yes', 'email-subscribers' ) . '</b>',
232
- 'color' => 'green',
 
 
 
233
  ),
234
- 'no' => array(
235
- 'text' => '<b>' . __( 'No', 'email-subscribers' ) . '</b>',
236
- 'color' => 'red',
 
 
 
 
 
 
 
237
  ),
238
  ),
239
  'allow_multiple' => false,
240
  'position' => 'bottom-center',
241
  'width' => 400,
242
  'delay' => 2, // seconds
 
243
  'confirmButtonText' => __( 'Send my feedback to <b>Icegram team</b>', 'email-subscribers' ),
244
  'show_once' => true,
245
  );
@@ -341,3 +352,47 @@ if ( ! function_exists( 'ig_es_show_plugin_usage_tracking_notice' ) ) {
341
  }
342
 
343
  add_filter( 'ig_es_show_plugin_usage_tracking_notice', 'ig_es_show_plugin_usage_tracking_notice' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  'title' => __( 'Subscription forms and CTAs??', 'email-subscribers' ),
227
  'event' => $event,
228
  'desc' => '<div><p class="mt-4">You use <a href="https://wordpress.org/plugins/email-subscribers" target="_blank"><b class="text-blue-700 font-semibold underline">Email Subscribers</b></a> to send email campaigns.</p><p class="mt-3">Would you like us to include onsite popups and action bars in the plugin as well? This way you can <b class="font-semibold">convert visitors to subscribers, drive traffic and run email marketing from a single plugin</b>.</p> <p class="mt-3">Why do we ask?</p> <p class="mt-3">Our <a class="text-blue-700 font-semibold underline" href="https://wordpress.org/plugins/icegram" target="_blank"><b>Icegram</b></a> plugin already does onsite campaigns. We are thinking of merging Icegram & Email Subscribers into a single plugin.</p> <p class="mt-3"><b class="font-semibold">Will a comprehensive ConvertKit / MailChimp like email + onsite campaign plugin be useful to you?</b></p> </div><p class="mt-3">',
229
+ 'fields' => array(
230
+ array(
231
+ 'type' => 'radio',
232
+ 'name' => 'poll_options',
233
+ 'label' => __( 'Yes', 'email-subscribers' ),
234
+ 'value' => 'yes',
235
+ 'required' => true,
236
  ),
237
+ array(
238
+ 'type' => 'radio',
239
+ 'name' => 'poll_options',
240
+ 'label' => __( 'No', 'email-subscribers' ),
241
+ 'value' => 'no',
242
+ ),
243
+ array(
244
+ 'type' => 'textarea',
245
+ 'name' => 'details',
246
+ 'placeholder' => __( 'Additional feedback', 'email-subscribers' ),
247
  ),
248
  ),
249
  'allow_multiple' => false,
250
  'position' => 'bottom-center',
251
  'width' => 400,
252
  'delay' => 2, // seconds
253
+ 'display_as' => 'popup',
254
  'confirmButtonText' => __( 'Send my feedback to <b>Icegram team</b>', 'email-subscribers' ),
255
  'show_once' => true,
256
  );
352
  }
353
 
354
  add_filter( 'ig_es_show_plugin_usage_tracking_notice', 'ig_es_show_plugin_usage_tracking_notice' );
355
+
356
+ if ( ! function_exists('ig_es_can_load_sweetalert_js') ) {
357
+ /**
358
+ * Can load sweetalert js
359
+ *
360
+ * @param bool $load
361
+ *
362
+ * @return bool
363
+ *
364
+ * @since 5.4.12
365
+ */
366
+ function ig_es_can_load_sweetalert_js( $load = false ) {
367
+
368
+ if ( ES()->is_es_admin_screen() ) {
369
+ return true;
370
+ }
371
+
372
+ return $load;
373
+ }
374
+ }
375
+
376
+ add_filter( 'ig_es_can_load_sweetalert_js', 'ig_es_can_load_sweetalert_js' );
377
+
378
+ if ( ! function_exists('ig_es_can_load_sweetalert_css') ) {
379
+ /**
380
+ * Can load sweetalert css
381
+ *
382
+ * @param bool $load
383
+ *
384
+ * @return bool
385
+ *
386
+ * @since 5.4.12
387
+ */
388
+ function ig_es_can_load_sweetalert_css( $load = false ) {
389
+
390
+ if ( ES()->is_es_admin_screen() ) {
391
+ return true;
392
+ }
393
+
394
+ return $load;
395
+ }
396
+ }
397
+
398
+ add_filter( 'ig_es_can_load_sweetalert_css', 'ig_es_can_load_sweetalert_css' );
lite/includes/feedback/class-ig-feedback.php CHANGED
@@ -4,20 +4,20 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
- if ( ! class_exists( 'IG_Feedback_V_1_2_6' ) ) {
8
  /**
9
  * IG Feedback
10
  *
11
  * The IG Feedback class adds functionality to get quick interactive feedback from users.
12
  * There are different types of feedabck widget like Stars, Emoji, Thubms Up/ Down, Number etc.
13
  *
14
- * @class IG_Feedback_V_1_2_6
15
  * @since 1.0.0
16
  * @copyright Copyright (c) 2019, Icegram
17
  * @license https://opensource.org/licenses/gpl-license GNU Public License
18
  * @package feedback
19
  */
20
- class IG_Feedback_V_1_2_6 {
21
 
22
  /**
23
  * Version of Feedback Library
@@ -25,7 +25,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_6' ) ) {
25
  * @since 1.0.13
26
  * @var string
27
  */
28
- public $version = '1.2.6';
29
  /**
30
  * The API URL where we will send feedback data.
31
  *
@@ -81,7 +81,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_6' ) ) {
81
  public $event_prefix;
82
 
83
  /**
84
- *
85
  */
86
  public $footer = '<span class="ig-powered-by">Made With&nbsp;💜&nbsp;by&nbsp;<a href="https://www.icegram.com/" target="_blank">Icegram</a></span>';
87
 
@@ -235,7 +235,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_6' ) ) {
235
  $review_url = "https://wordpress.org/support/plugin/{$this->plugin}/reviews/";
236
  $icon_url = plugin_dir_url( __FILE__ ) . 'assets/images/icon-64.png';
237
  /* translators: %s: Plugin name */
238
- $message = __( sprintf( "<span><p>We hope you're enjoying <b>%s</b> plugin! Could you please do us a BIG favor and give us a 5-star rating on WordPress to help us spread the word and boost our motivation?</p>", $this->name ), $this->plugin );
239
 
240
  $message_data = array(
241
  'review_url' => $review_url,
@@ -292,7 +292,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_6' ) ) {
292
  echo wp_kses_post( $message );
293
  echo "<ul class='ig-feedback-notice-links'>";
294
  echo sprintf(
295
- '<li><a href="%s" class="button-primary" target="_blank" data-rated="' . esc_attr__(
296
  'Thank You :) ',
297
  $this->plugin
298
  ) . '"><span class="dashicons dashicons-external"></span>&nbsp;&nbsp;Ok, you deserve it</a></li> <li><a href="%s"><span class="dashicons dashicons-calendar-alt"></span>&nbsp;&nbsp;Maybe later</a></li><li><a href="%s"><span class="dashicons dashicons-smiley"></span>&nbsp;&nbsp;I already did!</a></li><li><a href="%s"><span class="dashicons dashicons-no"></span>&nbsp;&nbsp;Don\'t ask me again</a></li>',
@@ -372,20 +372,25 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_6' ) ) {
372
  * @since 1.0.1
373
  */
374
  public function enqueue_styles() {
375
- wp_register_style( "sweetalert_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/sweetalert2.min.css', array(), $this->version );
376
- wp_enqueue_style( "sweetalert_{$this->version}" );
377
-
378
- wp_register_style( "animate_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/animate.min.css', array(), $this->version );
379
- wp_enqueue_style( "animate_{$this->version}" );
380
-
381
- wp_register_style( "ig-feedback-star-rating_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/star-rating.min.css', array(), $this->version );
382
- wp_enqueue_style( "ig-feedback-star-rating_{$this->version}" );
383
 
384
- wp_register_style( "ig-feedback-emoji_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/emoji.min.css', array(), $this->version );
385
- wp_enqueue_style( "ig-feedback-emoji_{$this->version}" );
386
 
387
- wp_register_style( "ig-feedback_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/feedback.min.css', array(), $this->version );
388
- wp_enqueue_style( "ig-feedback_{$this->version}" );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  }
390
 
391
  /**
@@ -892,18 +897,24 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_6' ) ) {
892
  public function render_poll_widget( $params = array() ) {
893
  $params = $this->prepare_widget_params( $params );
894
 
895
- $poll_options = ! empty( $params['poll_options'] ) ? $params['poll_options'] : array();
896
-
897
- if ( empty( $poll_options ) ) {
898
  return;
899
  }
 
900
 
901
  $allow_multiple = ! empty( $params['allow_multiple'] ) ? $params['allow_multiple'] : false;
902
 
903
  $title = $params['title'];
904
- $slug = sanitize_title( $title );
905
- $event = $this->event_prefix . $params['event'];
906
- $desc = ! empty( $params['desc'] ) ? $params['desc'] : '';
 
 
 
 
 
 
907
 
908
  ob_start();
909
 
@@ -911,16 +922,95 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_6' ) ) {
911
 
912
  <div class="ig-general-feedback" id="ig-general-feedback-<?php echo esc_attr( $this->plugin ); ?>">
913
  <form class="ig-general-feedback" id="ig-general-feedback">
914
- <p><?php echo wp_kses_post( $desc ); ?></p>
915
-
 
 
 
 
 
 
 
 
 
 
 
 
916
  <p class="ig-general-feedback mb-3">
917
- <?php foreach ( $poll_options as $value => $option ) { ?>
918
- <input type="radio" name="feedback_data[poll_options]" value="<?php echo esc_attr( $value ); ?>"><b style="color: <?php echo esc_attr( $option['color'] ); ?>"><?php echo wp_kses_post( $option['text'] ); ?></b><br/>
919
- <?php } ?>
920
- </p>
921
- <p class="ig-feedback-data-poll-message mb-3" id="ig-feedback-data-poll-message">
922
- <textarea name="feedback_data[details]" id="ig-feedback-data-poll-additional-message" placeholder="Additional feedback"></textarea>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
923
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
924
  </form>
925
  </div>
926
 
@@ -928,120 +1018,221 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_6' ) ) {
928
 
929
  $html = str_replace( array( "\r", "\n" ), '', trim( ob_get_clean() ) );
930
 
931
- $params['html'] = $html;
932
-
933
- $title = $params['title'];
934
- $slug = sanitize_title( $title );
935
  $event = $this->event_prefix . $params['event'];
936
- $html = ! empty( $params['html'] ) ? $params['html'] : '';
937
-
938
- $escape_allowed_tags = $this->get_escape_allowed_tags();
 
 
 
939
  ?>
940
-
941
  <script type="text/javascript">
942
 
943
- jQuery(document).ready(function ($) {
 
 
 
 
 
 
 
 
944
 
945
- function doSend(data, meta, system_info) {
946
 
947
- var data = {
948
- action: '<?php echo esc_js( $this->ajax_action ); ?>',
949
- feedback: {
950
- type: '<?php echo esc_js( $params['type'] ); ?>',
951
- slug: '<?php echo esc_js( $slug ); ?>',
952
- title: '<?php echo esc_js( $title ); ?>',
953
- data: data
954
- },
 
 
955
 
956
- event: '<?php echo esc_js( $event ); ?>',
 
 
 
 
957
 
958
- // Add additional information
959
- misc: {
960
- plugin: '<?php echo esc_js( $this->plugin ); ?>',
961
- plugin_abbr: '<?php echo esc_js( $this->plugin_abbr ); ?>',
962
- is_dev_mode: '<?php echo esc_js( $this->is_dev_mode ); ?>',
963
- set_transient: '<?php echo esc_js( $params['set_transient'] ); ?>',
964
- meta_info: meta,
965
- system_info: system_info
966
- },
967
- security: '<?php echo esc_js( wp_create_nonce( $this->plugin_abbr . '-admin-ajax-nonce' ) ); ?>'
968
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
969
 
970
- return jQuery.post(ajaxurl, data);
971
- }
 
 
 
 
 
 
 
 
972
 
973
- Swal.mixin({
974
- footer: '',
975
- position: '<?php echo esc_js( $params['position'] ); ?>',
976
- width: <?php echo esc_js( $params['width'] ); ?>,
977
- animation: false,
978
- focusConfirm: false,
979
- allowEscapeKey: true,
980
- showCloseButton: '<?php echo esc_js( $params['showCloseButton'] ); ?>',
981
- allowOutsideClick: '<?php echo esc_js( $params['allowOutsideClick'] ); ?>',
982
- showLoaderOnConfirm: true,
983
- confirmButtonText: '<?php echo wp_kses_post( $params['confirmButtonText'] ); ?>',
984
- backdrop: '<?php echo (int) $params['backdrop']; ?>'
985
- }).queue([
986
- {
987
- title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
988
- html: '<?php echo wp_kses( $html, $escape_allowed_tags ); ?>',
989
- customClass: {
990
- popup: 'animated fadeInUpBig'
991
- },
992
- onOpen: () => {
993
 
994
- },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
995
 
996
- preConfirm: () => {
997
- var $overlay = $('#ig-general-feedback-<?php echo esc_js( $this->plugin ); ?>');
998
- var $form = $overlay.find('form');
999
- var poll_options = $form.find("input[name='feedback_data[poll_options]']:checked").val();
1000
- var message = $form.find("#ig-feedback-data-poll-additional-message").val();
 
 
 
 
 
 
 
 
1001
 
1002
- if (poll_options === undefined) {
1003
- Swal.showValidationMessage('Please select option');
1004
- return;
1005
- }
1006
 
1007
- var data = {
1008
- poll_option: poll_options,
1009
- additional_feedback: message
1010
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1011
 
1012
- var meta = {};
1013
 
1014
- return doSend(data, meta, true);
 
 
 
 
 
1015
  }
1016
- },
1017
 
1018
- ]).then(response => {
 
1019
 
1020
- if (response.hasOwnProperty('value')) {
 
 
 
1021
 
1022
- Swal.fire({
1023
- type: 'success',
1024
- width: <?php echo esc_js( $params['width'] ); ?>,
1025
- title: '<?php echo esc_attr__( 'Thank You!', $this->plugin ); ?>',
1026
- showConfirmButton: false,
1027
- position: '<?php echo esc_js( $params['position'] ); ?>',
1028
- timer: 1500,
1029
- animation: false
1030
- });
1031
 
 
1032
  }
1033
- });
1034
 
 
1035
 
1036
- });
1037
 
1038
- </script>
 
 
 
 
 
 
 
 
1039
 
 
 
 
1040
 
 
1041
  <?php
1042
  }
1043
-
1044
-
1045
  /**
1046
  * Get Feedback API url
1047
  *
@@ -1726,5 +1917,79 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_6' ) ) {
1726
  $ig_es_escape_allowed_tags = apply_filters( $this->plugin_abbr . '_escape_allowed_tags', array() );
1727
  return $ig_es_escape_allowed_tags;
1728
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1729
  }
1730
  } // End if().
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
+ if ( ! class_exists( 'IG_Feedback_V_1_2_7' ) ) {
8
  /**
9
  * IG Feedback
10
  *
11
  * The IG Feedback class adds functionality to get quick interactive feedback from users.
12
  * There are different types of feedabck widget like Stars, Emoji, Thubms Up/ Down, Number etc.
13
  *
14
+ * @class IG_Feedback_V_1_2_7
15
  * @since 1.0.0
16
  * @copyright Copyright (c) 2019, Icegram
17
  * @license https://opensource.org/licenses/gpl-license GNU Public License
18
  * @package feedback
19
  */
20
+ class IG_Feedback_V_1_2_7 {
21
 
22
  /**
23
  * Version of Feedback Library
25
  * @since 1.0.13
26
  * @var string
27
  */
28
+ public $version = '1.2.7';
29
  /**
30
  * The API URL where we will send feedback data.
31
  *
81
  public $event_prefix;
82
 
83
  /**
84
+ * Footer HTML
85
  */
86
  public $footer = '<span class="ig-powered-by">Made With&nbsp;💜&nbsp;by&nbsp;<a href="https://www.icegram.com/" target="_blank">Icegram</a></span>';
87
 
235
  $review_url = "https://wordpress.org/support/plugin/{$this->plugin}/reviews/";
236
  $icon_url = plugin_dir_url( __FILE__ ) . 'assets/images/icon-64.png';
237
  /* translators: %s: Plugin name */
238
+ $message = __( sprintf( "<span><p>We hope you're enjoying <b>%s</b> plugin! Could you please do us a BIG favor and give us a 5-star rating on WordPress to help us spread the word and boost our motivation?</p>", $this->name ), $this->plugin );
239
 
240
  $message_data = array(
241
  'review_url' => $review_url,
292
  echo wp_kses_post( $message );
293
  echo "<ul class='ig-feedback-notice-links'>";
294
  echo sprintf(
295
+ '<li><a href="%s" class="px-4 py-2 ml-6 mr-2 align-middle cursor-pointer button button-primary bg-indigo-600" target="_blank" data-rated="' . esc_attr__(
296
  'Thank You :) ',
297
  $this->plugin
298
  ) . '"><span class="dashicons dashicons-external"></span>&nbsp;&nbsp;Ok, you deserve it</a></li> <li><a href="%s"><span class="dashicons dashicons-calendar-alt"></span>&nbsp;&nbsp;Maybe later</a></li><li><a href="%s"><span class="dashicons dashicons-smiley"></span>&nbsp;&nbsp;I already did!</a></li><li><a href="%s"><span class="dashicons dashicons-no"></span>&nbsp;&nbsp;Don\'t ask me again</a></li>',
372
  * @since 1.0.1
373
  */
374
  public function enqueue_styles() {
 
 
 
 
 
 
 
 
375
 
376
+ $can_load = apply_filters( $this->plugin_abbr . '_can_load_sweetalert_css', false );
 
377
 
378
+ if ( $can_load ) {
379
+ wp_register_style( "sweetalert_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/sweetalert2.min.css', array(), $this->version );
380
+ wp_enqueue_style( "sweetalert_{$this->version}" );
381
+
382
+ wp_register_style( "animate_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/animate.min.css', array(), $this->version );
383
+ wp_enqueue_style( "animate_{$this->version}" );
384
+
385
+ wp_register_style( "ig-feedback-star-rating_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/star-rating.min.css', array(), $this->version );
386
+ wp_enqueue_style( "ig-feedback-star-rating_{$this->version}" );
387
+
388
+ wp_register_style( "ig-feedback-emoji_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/emoji.min.css', array(), $this->version );
389
+ wp_enqueue_style( "ig-feedback-emoji_{$this->version}" );
390
+
391
+ wp_register_style( "ig-feedback_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/feedback.min.css', array(), $this->version );
392
+ wp_enqueue_style( "ig-feedback_{$this->version}" );
393
+ }
394
  }
395
 
396
  /**
897
  public function render_poll_widget( $params = array() ) {
898
  $params = $this->prepare_widget_params( $params );
899
 
900
+ $fields = ! empty( $params['fields'] ) ? $params['fields'] : array();
901
+ if ( empty( $fields ) ) {
 
902
  return;
903
  }
904
+ $default_values = ! empty( $params['default_values'] ) ? $params['default_values'] : array();
905
 
906
  $allow_multiple = ! empty( $params['allow_multiple'] ) ? $params['allow_multiple'] : false;
907
 
908
  $title = $params['title'];
909
+ if ( ! empty( $params['slug'] ) ) {
910
+ $slug = $params['slug'];
911
+ } else {
912
+ $slug = sanitize_title( $title );
913
+ }
914
+ $event = $this->event_prefix . $params['event'];
915
+ $desc = ! empty( $params['desc'] ) ? $params['desc'] : '';
916
+ $display_as = ! empty( $params['display_as'] ) ? $params['display_as'] : 'inline';
917
+ $system_info = isset( $params['system_info'] ) ? $params['system_info'] : true;
918
 
919
  ob_start();
920
 
922
 
923
  <div class="ig-general-feedback" id="ig-general-feedback-<?php echo esc_attr( $this->plugin ); ?>">
924
  <form class="ig-general-feedback" id="ig-general-feedback">
925
+ <?php
926
+ if ( ! empty( $title ) ) {
927
+ ?>
928
+ <h2><?php echo wp_kses_post( $title ); ?></h2>
929
+ <?php
930
+ }
931
+ ?>
932
+ <?php
933
+ if ( ! empty( $desc ) ) {
934
+ ?>
935
+ <p><?php echo wp_kses_post( $desc ); ?></p>
936
+ <?php
937
+ }
938
+ ?>
939
  <p class="ig-general-feedback mb-3">
940
+ <?php
941
+ foreach ( $fields as $index => $field ) {
942
+ $field_type = $field['type'];
943
+ $field_name = $field['name'];
944
+ $field_value = ! empty( $field['value'] ) ? $field['value'] : '';
945
+ $field_placeholder = ! empty( $field['placeholder'] ) ? $field['placeholder'] : '';
946
+ $field_required = isset ( $field['required'] ) ? $field['required'] : false;
947
+ switch ( $field_type ) {
948
+ case 'textarea':
949
+ ?>
950
+ <p class="ig-feedback-data-poll-message mb-3" id="ig-feedback-data-poll-message">
951
+ <textarea name="feedback_data[<?php echo esc_attr( $field_name ); ?>]" id="ig-feedback-data-poll-additional-message" placeholder="<?php echo esc_attr( $field_placeholder ); ?>"></textarea>
952
+ </p>
953
+ <br/>
954
+ <?php
955
+ break;
956
+ case 'radio':
957
+ case 'checkbox':
958
+ ?>
959
+ <label>
960
+ <input
961
+ type="<?php echo esc_attr( $field_type ); ?>"
962
+ name="feedback_data[<?php echo esc_attr( $field_name ); ?>]"
963
+ value="<?php echo esc_attr( $field_value ); ?>"
964
+ <?php echo ( ! empty( $default_values[ $field_name ] ) && $field_value === $default_values[ $field_name ] ) ? 'checked' : ''; ?>
965
+ class="<?php echo esc_attr( $this->plugin_abbr ); ?>-feedback-field"
966
+ <?php echo $field_required ? 'required' : ''; ?>>
967
+ <?php echo wp_kses_post( $field['label'] ); ?>
968
+ </label>
969
+ <br/>
970
+ <?php
971
+ break;
972
+ default:
973
+ ?>
974
+ <label>
975
+ <input
976
+ type="<?php echo esc_attr( $field_type ); ?>"
977
+ name="feedback_data[<?php echo esc_attr( $field_name ); ?>]"
978
+ value="<?php echo esc_attr( $field['value'] ); ?>"
979
+ class="<?php echo esc_attr( $this->plugin_abbr ); ?>-feedback-field">
980
+ <?php echo wp_kses_post( $field['label'] ); ?>
981
+ </label>
982
+ <br/>
983
+ <?php
984
+ }
985
+ ?>
986
+ <?php
987
+ if ( 'other' === $field['value'] ) {
988
+ ?>
989
+ <div class="ig_feedback_text_wrapper">
990
+ <textarea
991
+ id="feedback_text"
992
+ name="feedback[feedback_text]"
993
+ class="form-textarea text-sm w-2/3 mt-3 mb-1 border-gray-400 w-3/5 hidden"
994
+ placeholder="<?php echo esc_attr__( 'Tell us more about your desired feature', $this->plugin ); ?>"></textarea>
995
+ </div>
996
+ <?php
997
+ }
998
+ }
999
+ ?>
1000
  </p>
1001
+ <?php
1002
+ if ( 'inline' === $display_as ) {
1003
+ ?>
1004
+ <button type="submit" class="button">
1005
+ <?php
1006
+ echo esc_html__( 'Submit your feedback', $this->plugin );
1007
+ ?>
1008
+ </button>
1009
+ <br/>
1010
+ <br/>
1011
+ <?php
1012
+ }
1013
+ ?>
1014
  </form>
1015
  </div>
1016
 
1018
 
1019
  $html = str_replace( array( "\r", "\n" ), '', trim( ob_get_clean() ) );
1020
 
 
 
 
 
1021
  $event = $this->event_prefix . $params['event'];
1022
+
1023
+ if ( 'inline' === $display_as ) {
1024
+ $this->render_inline_feedback_widget( $html );
1025
+ } elseif ( 'popup' === $display_as ) {
1026
+ $this->render_popup_feedback_widget( $html, $params );
1027
+ }
1028
  ?>
 
1029
  <script type="text/javascript">
1030
 
1031
+ function doSend(data) {
1032
+ var system_info = <?php echo $system_info ? 'true' : 'false'; ?>;
1033
+ var requestData = {
1034
+ action: '<?php echo esc_js( $this->ajax_action ); ?>',
1035
+ feedback: {
1036
+ type: '<?php echo esc_js( $params['type'] ); ?>',
1037
+ slug: '<?php echo esc_js( $slug ); ?>',
1038
+ data: data
1039
+ },
1040
 
1041
+ event: '<?php echo esc_js( $event ); ?>',
1042
 
1043
+ // Add additional information
1044
+ misc: {
1045
+ plugin: '<?php echo esc_js( $this->plugin ); ?>',
1046
+ plugin_abbr: '<?php echo esc_js( $this->plugin_abbr ); ?>',
1047
+ is_dev_mode: '<?php echo esc_js( $this->is_dev_mode ); ?>',
1048
+ set_transient: '<?php echo esc_js( $params['set_transient'] ); ?>',
1049
+ system_info: system_info
1050
+ },
1051
+ security: '<?php echo esc_js( wp_create_nonce( $this->plugin_abbr . '-admin-ajax-nonce' ) ); ?>'
1052
+ };
1053
 
1054
+ return jQuery.post(ajaxurl, requestData, null, 'json');
1055
+ }
1056
+ </script>
1057
+ <?php
1058
+ }
1059
 
1060
+ /**
1061
+ * Render inline feedback widget
1062
+ *
1063
+ * @since 1.2.7
1064
+ *
1065
+ * @param array $params
1066
+ * @param string $html
1067
+ * @return void
1068
+ */
1069
+ public function render_inline_feedback_widget( $html ) {
1070
+ $escape_allowed_tags = $this->get_escape_allowed_tags();
1071
+ ?>
1072
+ <style type="text/css">
1073
+ .ig-feedback-inline h2{
1074
+ font-size:2em;
1075
+ padding: 0.5em 0;
1076
+ }
1077
+ .ig-feedback-inline{
1078
+ border:none;
1079
+ width:80%;
1080
+ margin: 1em auto !important;
1081
+ /* background:#fbe2597d; */
1082
+ }
1083
+ .ig-feedback-inline button{
1084
+ background: green !important;
1085
+ color: #FFF !important;
1086
+ }
1087
+ .ig-feedback-inline radio{
1088
+ line-height:1em;
1089
+ }
1090
+ .ig-feedback-logo{
1091
+ float:right;
1092
+ }
1093
+ .ig-feedback-inline label{
1094
+ font-size: 1.2em;
1095
+ padding-bottom: 0.1em;
1096
+ }
1097
+ .ig-feedback-inline .button{
1098
+ padding: 0.7em;
1099
+ font-size: 1.2em;
1100
+ border-radius: 0;
1101
+ }
1102
+ </style>
1103
+ <div class="notice ig-feedback-notice ig-feedback-inline">
1104
+ <div class="ig-feedback-logo">
1105
+ <img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>../../admin/assets/images/icon-64.png">
1106
+ </div>
1107
+ <?php echo wp_kses( $html, $escape_allowed_tags ); ?>
1108
+ </div>
1109
+ <script type="text/javascript">
1110
+ jQuery(document).ready(function ($) {
1111
+ $('.<?php echo esc_attr( $this->plugin_abbr ); ?>-feedback-field').on('change', function(){
1112
+ let value = $(this).val();
1113
+ if ( 'other' === value ) {
1114
+ $('#feedback_text').removeClass('hidden');
1115
+ } else {
1116
+ $('#feedback_text').addClass('hidden');
1117
+ }
1118
+ });
1119
 
1120
+ var $overlay = $('#ig-general-feedback-<?php echo esc_js( $this->plugin ); ?>');
1121
+ var $form = $overlay.find('form');
1122
+ $($form).on('submit', function(e){
1123
+ e.preventDefault();
1124
+ let selected_feature = $form.find("input[name='feedback_data[feature]']:checked").val();
1125
+ let form_data = {
1126
+ questions_response : {
1127
+ selected_feature: selected_feature
1128
+ }
1129
+ }
1130
 
1131
+ if ( selected_feature === 'other' ) {
1132
+ form_data.other_feature = $form.find('textarea[name="feedback[feedback_text]"]').val();
1133
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1134
 
1135
+ var request = doSend( form_data );
1136
+ request.done(response => {
1137
+ if (response.status && response.status === 'success') {
1138
+ let success_text = '<?php echo esc_html__( 'Your feedback submitted successfully.', $this->plugin ); ?>';
1139
+ $('.ig-feedback-notice').html('<p>' + success_text + '</p>');
1140
+ } else {
1141
+ let error_text = '<?php echo esc_html__( 'An error has occured. Please try again.', $this->plugin ); ?>';
1142
+ $('.ig-feedback-notice').removeClass('notice-success').addClass('notice-error').append('<p>' + error_text + '</p>');
1143
+ }
1144
+ }).fail( response => {
1145
+ let error_text = '<?php echo esc_html__( 'An error has occured. Please try again.', $this->plugin ); ?>';
1146
+ $('.ig-feedback-notice').removeClass('notice-success').addClass('notice-error').append('<p>' + error_text + '</p>');
1147
+ });
1148
+ });
1149
+ });
1150
+ </script>
1151
+ <?php
1152
+ }
1153
 
1154
+ /**
1155
+ * Render popup feedback widget
1156
+ *
1157
+ * @since 1.2.7
1158
+ *
1159
+ * @param string $html
1160
+ * @param array $params
1161
+ * @return void
1162
+ */
1163
+ public function render_popup_feedback_widget( $html, $params ) {
1164
+ $escape_allowed_tags = $this->get_escape_allowed_tags();
1165
+ ?>
1166
+ <script type="text/javascript">
1167
 
1168
+ jQuery(document).ready(function ($) {
 
 
 
1169
 
1170
+ Swal.mixin({
1171
+ footer: '',
1172
+ position: '<?php echo esc_js( $params['position'] ); ?>',
1173
+ width: <?php echo esc_js( $params['width'] ); ?>,
1174
+ animation: false,
1175
+ focusConfirm: false,
1176
+ allowEscapeKey: true,
1177
+ showCloseButton: '<?php echo esc_js( $params['showCloseButton'] ); ?>',
1178
+ allowOutsideClick: '<?php echo esc_js( $params['allowOutsideClick'] ); ?>',
1179
+ showLoaderOnConfirm: true,
1180
+ confirmButtonText: '<?php echo wp_kses_post( $params['confirmButtonText'] ); ?>',
1181
+ backdrop: '<?php echo (int) $params['backdrop']; ?>'
1182
+ }).queue([
1183
+ {
1184
+ title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
1185
+ html: '<?php echo wp_kses( $html, $escape_allowed_tags ); ?>',
1186
+ customClass: {
1187
+ popup: 'animated fadeInUpBig'
1188
+ },
1189
+ onOpen: () => {
1190
 
1191
+ },
1192
 
1193
+ preConfirm: () => {
1194
+ var $overlay = $('#ig-general-feedback-<?php echo esc_js( $this->plugin ); ?>');
1195
+ var $form = $overlay.find('form');
1196
+ if ( ! jQuery($form)[0].checkValidity()) {
1197
+ Swal.showValidationMessage('<?php echo esc_html__( 'Please select option', $this->plugin ); ?>');
1198
+ return;
1199
  }
 
1200
 
1201
+ var poll_options = $form.find("input[name='feedback_data[poll_options]']:checked").val();
1202
+ var message = $form.find("#ig-feedback-data-poll-additional-message").val();
1203
 
1204
+ var data = {
1205
+ poll_option: poll_options,
1206
+ additional_feedback: message
1207
+ };
1208
 
1209
+ var meta = {};
 
 
 
 
 
 
 
 
1210
 
1211
+ return doSend(data);
1212
  }
1213
+ },
1214
 
1215
+ ]).then(response => {
1216
 
1217
+ if (response.hasOwnProperty('value')) {
1218
 
1219
+ Swal.fire({
1220
+ type: 'success',
1221
+ width: <?php echo esc_js( $params['width'] ); ?>,
1222
+ title: '<?php echo esc_attr__( 'Thank You!', $this->plugin ); ?>',
1223
+ showConfirmButton: false,
1224
+ position: '<?php echo esc_js( $params['position'] ); ?>',
1225
+ timer: 1500,
1226
+ animation: false
1227
+ });
1228
 
1229
+ }
1230
+ });
1231
+ });
1232
 
1233
+ </script>
1234
  <?php
1235
  }
 
 
1236
  /**
1237
  * Get Feedback API url
1238
  *
1917
  $ig_es_escape_allowed_tags = apply_filters( $this->plugin_abbr . '_escape_allowed_tags', array() );
1918
  return $ig_es_escape_allowed_tags;
1919
  }
1920
+
1921
+ /**
1922
+ * Render Quick Feedback Widget
1923
+ *
1924
+ * @param $params
1925
+ *
1926
+ * @since 4.1.0
1927
+ */
1928
+ public function render_feedback_widget( $params ) {
1929
+
1930
+ if ( ! $this->can_show_feedback_widget() ) {
1931
+ return;
1932
+ }
1933
+
1934
+ $default_params = array(
1935
+ 'set_transient' => true,
1936
+ 'force' => false,
1937
+ 'show_once' => false,
1938
+ );
1939
+
1940
+ $params = wp_parse_args( $params, $default_params );
1941
+
1942
+ if ( ! empty( $params['event'] ) ) {
1943
+
1944
+ $event = $this->event_prefix . $params['event'];
1945
+ $force = ! empty( $params['force'] ) ? $params['force'] : false;
1946
+
1947
+ $can_show = false;
1948
+
1949
+ if ( $force ) {
1950
+ $can_show = true;
1951
+ } else {
1952
+ if ( ! $this->is_event_transient_set( $event ) ) {
1953
+ $can_show = true;
1954
+
1955
+ $feedback_data = $this->get_event_feedback_data( $this->plugin_abbr, $event );
1956
+ if ( count( $feedback_data ) > 0 ) {
1957
+ $show_once = $params['show_once'];
1958
+ $feedback_data = array_reverse( $feedback_data );
1959
+ $last_feedback_given_on = $feedback_data[0]['created_on'];
1960
+
1961
+ // If event feedback given within 45 days or show event only once?
1962
+ // Don't show now
1963
+ if ( $show_once || ( strtotime( $last_feedback_given_on ) > strtotime( '-45 days' ) ) ) {
1964
+ $can_show = false;
1965
+ }
1966
+ }
1967
+ }
1968
+ }
1969
+
1970
+ if ( $can_show ) {
1971
+ if ( 'star' === $params['type'] ) {
1972
+ $this->render_stars( $params );
1973
+ } elseif ( 'emoji' === $params['type'] ) {
1974
+ $this->render_emoji( $params );
1975
+ } elseif ( 'feedback' === $params['type'] ) {
1976
+ $this->render_general_feedback( $params );
1977
+ } elseif ( 'fb' === $params['type'] ) {
1978
+ /**
1979
+ * We are not calling home for this event and we want to show
1980
+ * this Widget only once. So, we are storing feedback data now.
1981
+ */
1982
+ $this->set_feedback_data( $this->plugin_abbr, $event );
1983
+ $this->render_fb_widget( $params );
1984
+ } elseif ( 'poll' === $params['type'] ) {
1985
+ if ( $params['show_once'] ) {
1986
+ $this->set_feedback_data( $this->plugin_abbr, $event );
1987
+ }
1988
+ $this->render_poll_widget( $params );
1989
+ }
1990
+ }
1991
+ }
1992
+
1993
+ }
1994
  }
1995
  } // End if().
lite/language.php CHANGED
@@ -933,6 +933,7 @@ __( 'Email Subscribers Secret Club', 'email-subscribers' ),
933
  __( 'on Facebook', 'email-subscribers' ),
934
  __( '<span><p>We hope you\'re enjoying <b>Email Subscribers</b> plugin! Could you please do us a BIG favor and give us a 5-star rating on WordPress to help us spread the word and boost our motivation?</p>', 'email-subscribers' ),
935
  __( 'Subscription forms and CTAs??', 'email-subscribers' ),
 
936
  __( 'Send my feedback to <b>Icegram team</b>', 'email-subscribers' ),
937
  __( 'Broadcast Created Successfully!', 'email-subscribers' ),
938
  __( 'If you like new Broadcast UI, leave us a <b>5 stars review</b>. <br /><br />Do you have a feedback? Contact Us.', 'email-subscribers' ),
933
  __( 'on Facebook', 'email-subscribers' ),
934
  __( '<span><p>We hope you\'re enjoying <b>Email Subscribers</b> plugin! Could you please do us a BIG favor and give us a 5-star rating on WordPress to help us spread the word and boost our motivation?</p>', 'email-subscribers' ),
935
  __( 'Subscription forms and CTAs??', 'email-subscribers' ),
936
+ __( 'Additional feedback', 'email-subscribers' ),
937
  __( 'Send my feedback to <b>Icegram team</b>', 'email-subscribers' ),
938
  __( 'Broadcast Created Successfully!', 'email-subscribers' ),
939
  __( 'If you like new Broadcast UI, leave us a <b>5 stars review</b>. <br /><br />Do you have a feedback? Contact Us.', 'email-subscribers' ),
lite/languages/email-subscribers.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Email Subscribers & Newsletters plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Email Subscribers & Newsletters 5.4.11\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/email-subscribers\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2022-09-07T07:56:53+02:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: email-subscribers\n"
@@ -2976,77 +2976,77 @@ msgstr ""
2976
  msgid "Contact(s) added to list successfully!"
2977
  msgstr ""
2978
 
2979
- #: lite/includes/classes/class-es-cron.php:280
2980
  msgid "Email Subscribers Cronjob Interval"
2981
  msgstr ""
2982
 
2983
- #: lite/includes/classes/class-es-cron.php:284
2984
  msgid "Two minutes"
2985
  msgstr ""
2986
 
2987
- #: lite/includes/classes/class-es-cron.php:288
2988
  msgid "Fifteen minutes"
2989
  msgstr ""
2990
 
2991
- #: lite/includes/classes/class-es-cron.php:292
2992
  msgid "Monthly"
2993
  msgstr ""
2994
 
2995
- #: lite/includes/classes/class-es-cron.php:328
2996
  msgid "10 minutes"
2997
  msgstr ""
2998
 
2999
- #: lite/includes/classes/class-es-cron.php:329
3000
  msgid "15 minutes"
3001
  msgstr ""
3002
 
3003
- #: lite/includes/classes/class-es-cron.php:330
3004
  msgid "20 minutes"
3005
  msgstr ""
3006
 
3007
- #: lite/includes/classes/class-es-cron.php:331
3008
  msgid "25 minutes"
3009
  msgstr ""
3010
 
3011
- #: lite/includes/classes/class-es-cron.php:332
3012
  msgid "30 minutes"
3013
  msgstr ""
3014
 
3015
- #: lite/includes/classes/class-es-cron.php:649
3016
  msgid "Emails sent successfully!"
3017
  msgstr ""
3018
 
3019
- #: lite/includes/classes/class-es-cron.php:650
3020
  msgid "Emails not found."
3021
  msgstr ""
3022
 
3023
- #: lite/includes/classes/class-es-cron.php:651
3024
  msgid "No notifications found to send."
3025
  msgstr ""
3026
 
3027
- #: lite/includes/classes/class-es-cron.php:652
3028
- #: lite/includes/classes/class-es-cron.php:653
3029
- #: lite/includes/classes/class-es-cron.php:654
3030
  msgid "Invalid GUID."
3031
  msgstr ""
3032
 
3033
- #: lite/includes/classes/class-es-cron.php:655
3034
  msgid "Not allowed to process request."
3035
  msgstr ""
3036
 
3037
- #: lite/includes/classes/class-es-cron.php:656
3038
  msgid "GUID is empty."
3039
  msgstr ""
3040
 
3041
- #: lite/includes/classes/class-es-cron.php:657
3042
  msgid "Please try after sometime."
3043
  msgstr ""
3044
 
3045
- #: lite/includes/classes/class-es-cron.php:658
3046
  msgid "You have hit your hourly email sending limit. Please try after sometime."
3047
  msgstr ""
3048
 
3049
- #: lite/includes/classes/class-es-cron.php:659
3050
  msgid "Cron lock enabled. Please try after sometime."
3051
  msgstr ""
3052
 
@@ -4011,13 +4011,13 @@ msgid "Email Subscribers Widget"
4011
  msgstr ""
4012
 
4013
  #: lite/includes/classes/class-es-widget.php:50
4014
- #: lite/includes/feedback.php:231
4015
  #: starter/starter-class-email-subscribers.php:458
4016
  msgid "Yes"
4017
  msgstr ""
4018
 
4019
  #: lite/includes/classes/class-es-widget.php:51
4020
- #: lite/includes/feedback.php:235
4021
  #: starter/starter-class-email-subscribers.php:458
4022
  msgid "No"
4023
  msgstr ""
@@ -4054,23 +4054,27 @@ msgstr ""
4054
  msgid "Subscription forms and CTAs??"
4055
  msgstr ""
4056
 
4057
- #: lite/includes/feedback.php:243
 
 
 
 
4058
  msgid "Send my feedback to <b>Icegram team</b>"
4059
  msgstr ""
4060
 
4061
- #: lite/includes/feedback.php:297
4062
  msgid "Broadcast Created Successfully!"
4063
  msgstr ""
4064
 
4065
- #: lite/includes/feedback.php:299
4066
  msgid "If you like new Broadcast UI, leave us a <b>5 stars review</b>. <br /><br />Do you have a feedback? Contact Us."
4067
  msgstr ""
4068
 
4069
- #: lite/includes/feedback.php:303
4070
  msgid "Leave Review"
4071
  msgstr ""
4072
 
4073
- #: lite/includes/feedback.php:306
4074
  msgid "Contact Us"
4075
  msgstr ""
4076
 
2
  # This file is distributed under the same license as the Email Subscribers & Newsletters plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Email Subscribers & Newsletters 5.4.12\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/email-subscribers\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2022-09-14T09:04:02+02:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: email-subscribers\n"
2976
  msgid "Contact(s) added to list successfully!"
2977
  msgstr ""
2978
 
2979
+ #: lite/includes/classes/class-es-cron.php:285
2980
  msgid "Email Subscribers Cronjob Interval"
2981
  msgstr ""
2982
 
2983
+ #: lite/includes/classes/class-es-cron.php:289
2984
  msgid "Two minutes"
2985
  msgstr ""
2986
 
2987
+ #: lite/includes/classes/class-es-cron.php:293
2988
  msgid "Fifteen minutes"
2989
  msgstr ""
2990
 
2991
+ #: lite/includes/classes/class-es-cron.php:297
2992
  msgid "Monthly"
2993
  msgstr ""
2994
 
2995
+ #: lite/includes/classes/class-es-cron.php:333
2996
  msgid "10 minutes"
2997
  msgstr ""
2998
 
2999
+ #: lite/includes/classes/class-es-cron.php:334
3000
  msgid "15 minutes"
3001
  msgstr ""
3002
 
3003
+ #: lite/includes/classes/class-es-cron.php:335
3004
  msgid "20 minutes"
3005
  msgstr ""
3006
 
3007
+ #: lite/includes/classes/class-es-cron.php:336
3008
  msgid "25 minutes"
3009
  msgstr ""
3010
 
3011
+ #: lite/includes/classes/class-es-cron.php:337
3012
  msgid "30 minutes"
3013
  msgstr ""
3014
 
3015
+ #: lite/includes/classes/class-es-cron.php:654
3016
  msgid "Emails sent successfully!"
3017
  msgstr ""
3018
 
3019
+ #: lite/includes/classes/class-es-cron.php:655
3020
  msgid "Emails not found."
3021
  msgstr ""
3022
 
3023
+ #: lite/includes/classes/class-es-cron.php:656
3024
  msgid "No notifications found to send."
3025
  msgstr ""
3026
 
3027
+ #: lite/includes/classes/class-es-cron.php:657
3028
+ #: lite/includes/classes/class-es-cron.php:658
3029
+ #: lite/includes/classes/class-es-cron.php:659
3030
  msgid "Invalid GUID."
3031
  msgstr ""
3032
 
3033
+ #: lite/includes/classes/class-es-cron.php:660
3034
  msgid "Not allowed to process request."
3035
  msgstr ""
3036
 
3037
+ #: lite/includes/classes/class-es-cron.php:661
3038
  msgid "GUID is empty."
3039
  msgstr ""
3040
 
3041
+ #: lite/includes/classes/class-es-cron.php:662
3042
  msgid "Please try after sometime."
3043
  msgstr ""
3044
 
3045
+ #: lite/includes/classes/class-es-cron.php:663
3046
  msgid "You have hit your hourly email sending limit. Please try after sometime."
3047
  msgstr ""
3048
 
3049
+ #: lite/includes/classes/class-es-cron.php:664
3050
  msgid "Cron lock enabled. Please try after sometime."
3051
  msgstr ""
3052
 
4011
  msgstr ""
4012
 
4013
  #: lite/includes/classes/class-es-widget.php:50
4014
+ #: lite/includes/feedback.php:233
4015
  #: starter/starter-class-email-subscribers.php:458
4016
  msgid "Yes"
4017
  msgstr ""
4018
 
4019
  #: lite/includes/classes/class-es-widget.php:51
4020
+ #: lite/includes/feedback.php:240
4021
  #: starter/starter-class-email-subscribers.php:458
4022
  msgid "No"
4023
  msgstr ""
4054
  msgid "Subscription forms and CTAs??"
4055
  msgstr ""
4056
 
4057
+ #: lite/includes/feedback.php:246
4058
+ msgid "Additional feedback"
4059
+ msgstr ""
4060
+
4061
+ #: lite/includes/feedback.php:254
4062
  msgid "Send my feedback to <b>Icegram team</b>"
4063
  msgstr ""
4064
 
4065
+ #: lite/includes/feedback.php:308
4066
  msgid "Broadcast Created Successfully!"
4067
  msgstr ""
4068
 
4069
+ #: lite/includes/feedback.php:310
4070
  msgid "If you like new Broadcast UI, leave us a <b>5 stars review</b>. <br /><br />Do you have a feedback? Contact Us."
4071
  msgstr ""
4072
 
4073
+ #: lite/includes/feedback.php:314
4074
  msgid "Leave Review"
4075
  msgstr ""
4076
 
4077
+ #: lite/includes/feedback.php:317
4078
  msgid "Contact Us"
4079
  msgstr ""
4080
 
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: email marketing, subscription, autoresponder, post notification, welcome e
6
  Requires at least: 3.9
7
  Tested up to: 6.0.2
8
  Requires PHP: 5.6
9
- Stable tag: 5.4.11
10
  License: GPLv3
11
  License URI: http://www.gnu.org/licenses
12
 
@@ -310,13 +310,22 @@ Refer [here](https://www.icegram.com/documentation/es-faq/).
310
 
311
  == Upgrade Notice ==
312
 
313
- = 5.4.11 =
314
 
315
- * Enhancement: Simplified merge tag view for editor
316
- * Fix: Campaign preview not working in some cases
 
 
317
 
318
  == Changelog ==
319
 
 
 
 
 
 
 
 
320
  **5.4.11 (07.09.2022)**
321
 
322
  * Enhancement: Simplified merge tag view for editor
6
  Requires at least: 3.9
7
  Tested up to: 6.0.2
8
  Requires PHP: 5.6
9
+ Stable tag: 5.4.12
10
  License: GPLv3
11
  License URI: http://www.gnu.org/licenses
12
 
310
 
311
  == Upgrade Notice ==
312
 
313
+ = 5.4.12 =
314
 
315
+ * Enhancement: Add title for list names on add contact screen
316
+ * Enhancement: Improve error handling when email sending fails for some email addresses
317
+ * Fix: Fatal error when getmypid function is disabled on hosts with PHP v8
318
+ * Fix: Fatal error Fatal error: Uncaught TypeError: number_format() on dashboard
319
 
320
  == Changelog ==
321
 
322
+ **5.4.12 (14.09.2022)**
323
+
324
+ * Enhancement: Add title for list names on add contact screen
325
+ * Enhancement: Improve error handling when email sending fails for some email addresses
326
+ * Fix: Fatal error when getmypid function is disabled on hosts with PHP v8
327
+ * Fix: Fatal error Fatal error: Uncaught TypeError: number_format() on dashboard
328
+
329
  **5.4.11 (07.09.2022)**
330
 
331
  * Enhancement: Simplified merge tag view for editor