Popups, Welcome Bar, Optins and Lead Generation Plugin – Icegram - Version 3.0.8

Version Description

  • New: Target campaigns to any post with "Where" conditions

=

Download this release

Release Info

Developer Icegram
Plugin Icon 128x128 Popups, Welcome Bar, Optins and Lead Generation Plugin – Icegram
Version 3.0.8
Comparing to
See all releases

Code changes from version 3.0.7 to 3.0.8

icegram.php CHANGED
@@ -3,8 +3,8 @@
3
  * Plugin Name: Icegram - Popups, Optins, CTAs & lot more...
4
  * Plugin URI: https://www.icegram.com/
5
  * Description: All in one solution to inspire, convert and engage your audiences. Action bars, Popup windows, Messengers, Toast notifications and more. Awesome themes and powerful rules.
6
- * Version: 3.0.7
7
- * Tested up to: 6.0.1
8
  * Author: icegram
9
  * Author URI: https://www.icegram.com/
10
  * Copyright (c) 2014-22 Icegram
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
20
  }
21
 
22
  if ( ! defined( 'IG_FEEDBACK_TRACKER_VERSION' ) ) {
23
- define( 'IG_FEEDBACK_TRACKER_VERSION', '1.2.3' );
24
  }
25
 
26
  /* ***************************** Initial Compatibility Work (Start) ******************* */
@@ -122,7 +122,7 @@ if ( ! defined( 'IG_PLUGIN_FILE' ) ) {
122
  }
123
 
124
  if ( ! defined( 'IG_PLUGIN_VERSION' ) ) {
125
- define( 'IG_PLUGIN_VERSION', '3.0.7' );
126
  }
127
 
128
  if ( ! defined( 'IG_PRODUCT_ID' ) ) {
3
  * Plugin Name: Icegram - Popups, Optins, CTAs & lot more...
4
  * Plugin URI: https://www.icegram.com/
5
  * Description: All in one solution to inspire, convert and engage your audiences. Action bars, Popup windows, Messengers, Toast notifications and more. Awesome themes and powerful rules.
6
+ * Version: 3.0.8
7
+ * Tested up to: 6.0.2
8
  * Author: icegram
9
  * Author URI: https://www.icegram.com/
10
  * Copyright (c) 2014-22 Icegram
20
  }
21
 
22
  if ( ! defined( 'IG_FEEDBACK_TRACKER_VERSION' ) ) {
23
+ define( 'IG_FEEDBACK_TRACKER_VERSION', '1.2.8' );
24
  }
25
 
26
  /* ***************************** Initial Compatibility Work (Start) ******************* */
122
  }
123
 
124
  if ( ! defined( 'IG_PLUGIN_VERSION' ) ) {
125
+ define( 'IG_PLUGIN_VERSION', '3.0.8' );
126
  }
127
 
128
  if ( ! defined( 'IG_PRODUCT_ID' ) ) {
lite/class-icegram.php CHANGED
@@ -1409,6 +1409,10 @@ if ( ! class_exists( 'Icegram' ) ) {
1409
  //local url
1410
  $sql .= " OR ( pm.meta_value LIKE '%%%s%%' )";
1411
  $sql_params[] = 's:9:"local_url";s:3:"yes";';
 
 
 
 
1412
  if ( ! empty( $_REQUEST['cache_compatibility'] ) && $_REQUEST['cache_compatibility'] == 'yes' ) {
1413
  $is_home = ( ! empty( $_REQUEST['is_home'] ) && $_REQUEST['is_home'] === 'true' ) ? true : false;
1414
  } else {
1409
  //local url
1410
  $sql .= " OR ( pm.meta_value LIKE '%%%s%%' )";
1411
  $sql_params[] = 's:9:"local_url";s:3:"yes";';
1412
+
1413
+ $sql .= " OR ( pm.meta_value LIKE '%%%s%%' )";
1414
+ $sql_params[] = 's:10:"post_types";s:3:"yes";';
1415
+
1416
  if ( ! empty( $_REQUEST['cache_compatibility'] ) && $_REQUEST['cache_compatibility'] == 'yes' ) {
1417
  $is_home = ( ! empty( $_REQUEST['is_home'] ) && $_REQUEST['is_home'] === 'true' ) ? true : false;
1418
  } else {
lite/classes/class-icegram-campaign-admin.php CHANGED
@@ -504,6 +504,9 @@ if ( ! class_exists( 'Icegram_Campaign_Admin' ) ) {
504
  echo '</select>';
505
  ?>
506
  </p>
 
 
 
507
  <p class="form-field py-1">
508
 
509
  <label for="where_local_url">
504
  echo '</select>';
505
  ?>
506
  </p>
507
+ <?php
508
+ do_action( 'icegram_after_campaign_pages_where_rule', $campaign_id, $campaign_target_rules );
509
+ ?>
510
  <p class="form-field py-1">
511
 
512
  <label for="where_local_url">
lite/classes/class-icegram-campaign.php CHANGED
@@ -181,7 +181,12 @@ if ( ! class_exists( 'Icegram_Campaign' ) ) {
181
  }
182
  }
183
 
184
- return false;
 
 
 
 
 
185
  }
186
 
187
  static function is_valid_url( $pattern, $current_page_url ) {
181
  }
182
  }
183
 
184
+ $campaign_valid = false;
185
+
186
+ //Validating campaign for Post Types.
187
+ $campaign_valid = apply_filters('icegram_campaign_validate_post_type', $campaign_valid, $campaign, $options);
188
+
189
+ return $campaign_valid;
190
  }
191
 
192
  static function is_valid_url( $pattern, $current_page_url ) {
lite/classes/feedback.php CHANGED
@@ -2,21 +2,11 @@
2
 
3
  /**
4
  * Get additional system & plugin specific information for feedback
5
- *
6
- *
7
  */
8
  if ( ! function_exists( 'ig_get_additional_info' ) ) {
9
 
10
- /**
11
- * Get TLWP specific information
12
- *
13
- * @param $additional_info
14
- * @param bool $system_info
15
- *
16
- * @return mixed
17
- *
18
- * @since 1.5.17
19
- */
20
  function ig_get_additional_info( $additional_info, $system_info = false ) {
21
  global $icegram, $ig_tracker;
22
  $additional_info['version'] = $icegram->version;
@@ -143,16 +133,34 @@ function ig_render_iges_merge_feedback() {
143
  'title' => __( 'Subscription forms and CTAs??', 'email-subscribers' ),
144
  'event' => $event,
145
  'desc' => '<div><p>You use <a href="https://wordpress.org/plugins/icegram" target="_blank"><b>Icegram</b></a> to show onsite campaigns like popups and action bars.</p> <p>Would you like us to include email campaigns in the plugin as well? This way you can <b>convert visitors to subscribers, drive traffic and run email marketing from a single plugin</b>.</p> <p>Why do we ask?</p> <p>Our <a href="https://wordpress.org/plugins/email-subscribers" target="_blank"><b>Email Subscribers</b></a> plugin already does email campaigns. We are thinking of merging Icegram & Email Subscribers into a single plugin.</p> <p><b>Will a comprehensive ConvertKit / MailChimp like email + onsite campaign plugin be useful to you?</b></p> </div>',
146
- 'poll_options' => array(
147
- 'yes' => array( 'text' => '<b>' . __( 'Yes', 'email-subscribers' ) . '</b>', 'color' => 'green' ),
148
- 'no' => array( 'text' => '<b>' . __( 'No', 'email-subscribers' ) . '</b>', 'color' => 'red' )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  ),
150
  'allow_multiple' => false,
151
  'position' => 'bottom-center',
152
  'width' => 400,
153
  'delay' => 2, // seconds
 
154
  'confirmButtonText' => __( 'Send my feedback to <b>Icegram team</b>', 'email-subscribers' ),
155
- 'show_once' => true
156
  );
157
 
158
  $icegram->render_feedback_widget( $params );
@@ -175,8 +183,8 @@ add_action( 'admin_footer', 'ig_render_iges_merge_feedback' );
175
  function ig_can_load_sweetalert_js( $load = false ) {
176
 
177
  $screen = get_current_screen();
178
- if ( ! in_array( $screen->id, array( 'ig_campaign', 'ig_message', 'edit-ig_message', 'edit-ig_campaign' ), true ) ) {
179
- return false;
180
  }
181
 
182
  return $load;
@@ -184,6 +192,28 @@ function ig_can_load_sweetalert_js( $load = false ) {
184
 
185
  add_filter( 'ig_can_load_sweetalert_js', 'ig_can_load_sweetalert_js', 10, 1 );
186
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
 
188
  if ( ! function_exists( 'ig_show_plugin_usage_tracking_notice' ) ) {
189
 
@@ -210,3 +240,153 @@ if ( ! function_exists( 'ig_show_plugin_usage_tracking_notice' ) ) {
210
  }
211
 
212
  add_filter( 'ig_show_plugin_usage_tracking_notice', 'ig_show_plugin_usage_tracking_notice' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  /**
4
  * Get additional system & plugin specific information for feedback
5
+
 
6
  */
7
  if ( ! function_exists( 'ig_get_additional_info' ) ) {
8
 
9
+
 
 
 
 
 
 
 
 
 
10
  function ig_get_additional_info( $additional_info, $system_info = false ) {
11
  global $icegram, $ig_tracker;
12
  $additional_info['version'] = $icegram->version;
133
  'title' => __( 'Subscription forms and CTAs??', 'email-subscribers' ),
134
  'event' => $event,
135
  'desc' => '<div><p>You use <a href="https://wordpress.org/plugins/icegram" target="_blank"><b>Icegram</b></a> to show onsite campaigns like popups and action bars.</p> <p>Would you like us to include email campaigns in the plugin as well? This way you can <b>convert visitors to subscribers, drive traffic and run email marketing from a single plugin</b>.</p> <p>Why do we ask?</p> <p>Our <a href="https://wordpress.org/plugins/email-subscribers" target="_blank"><b>Email Subscribers</b></a> plugin already does email campaigns. We are thinking of merging Icegram & Email Subscribers into a single plugin.</p> <p><b>Will a comprehensive ConvertKit / MailChimp like email + onsite campaign plugin be useful to you?</b></p> </div>',
136
+ 'fields' => array(
137
+ array(
138
+ 'type' => 'radio',
139
+ 'name' => 'poll_options',
140
+ 'label' => __( 'Yes', 'email-subscribers' ),
141
+ 'value' => 'yes',
142
+ 'required' => true,
143
+ ),
144
+ array(
145
+ 'type' => 'radio',
146
+ 'name' => 'poll_options',
147
+ 'label' => __( 'No', 'email-subscribers' ),
148
+ 'value' => 'no',
149
+ ),
150
+ array(
151
+ 'type' => 'textarea',
152
+ 'name' => 'details',
153
+ 'placeholder' => __( 'Additional feedback', 'email-subscribers' ),
154
+ 'value' => '',
155
+ ),
156
  ),
157
  'allow_multiple' => false,
158
  'position' => 'bottom-center',
159
  'width' => 400,
160
  'delay' => 2, // seconds
161
+ 'display_as' => 'popup',
162
  'confirmButtonText' => __( 'Send my feedback to <b>Icegram team</b>', 'email-subscribers' ),
163
+ 'show_once' => true,
164
  );
165
 
166
  $icegram->render_feedback_widget( $params );
183
  function ig_can_load_sweetalert_js( $load = false ) {
184
 
185
  $screen = get_current_screen();
186
+ if ( in_array( $screen->id, array( 'ig_campaign', 'ig_message', 'edit-ig_message', 'edit-ig_campaign' ), true ) ) {
187
+ return true;
188
  }
189
 
190
  return $load;
192
 
193
  add_filter( 'ig_can_load_sweetalert_js', 'ig_can_load_sweetalert_js', 10, 1 );
194
 
195
+ if ( ! function_exists('ig_can_load_sweetalert_css') ) {
196
+ /**
197
+ * Can load sweetalert css
198
+ *
199
+ * @param bool $load
200
+ *
201
+ * @return bool
202
+ *
203
+ * @since
204
+ */
205
+ function ig_can_load_sweetalert_css( $load = false ) {
206
+
207
+ $screen = get_current_screen();
208
+ if ( in_array( $screen->id, array( 'ig_campaign', 'ig_message', 'edit-ig_message', 'edit-ig_campaign' ), true ) ) {
209
+ return true;
210
+ }
211
+
212
+ return $load;
213
+ }
214
+ }
215
+
216
+ add_filter( 'ig_can_load_sweetalert_css', 'ig_can_load_sweetalert_css', 10, 1 );
217
 
218
  if ( ! function_exists( 'ig_show_plugin_usage_tracking_notice' ) ) {
219
 
240
  }
241
 
242
  add_filter( 'ig_show_plugin_usage_tracking_notice', 'ig_show_plugin_usage_tracking_notice' );
243
+
244
+ if ( ! function_exists( 'ig_add_escape_allowed_tags') ) {
245
+ /**
246
+ * Add HTML tags to be excluded while escaping
247
+ *
248
+ * @return array $allowedtags
249
+ */
250
+ function ig_add_escape_allowed_tags() {
251
+ $context_allowed_tags = wp_kses_allowed_html( 'post' );
252
+ $custom_allowed_tags = array(
253
+ 'div' => array(
254
+ 'x-data' => true,
255
+ 'x-show' => true,
256
+ ),
257
+ 'select' => array(
258
+ 'class' => true,
259
+ 'name' => true,
260
+ 'id' => true,
261
+ 'style' => true,
262
+ 'title' => true,
263
+ 'role' => true,
264
+ 'data-*' => true,
265
+ 'tab-*' => true,
266
+ 'multiple' => true,
267
+ 'aria-*' => true,
268
+ 'disabled' => true,
269
+ 'required' => 'required',
270
+ ),
271
+ 'optgroup' => array(
272
+ 'label' => true,
273
+ ),
274
+ 'option' => array(
275
+ 'class' => true,
276
+ 'value' => true,
277
+ 'selected' => true,
278
+ 'name' => true,
279
+ 'id' => true,
280
+ 'style' => true,
281
+ 'title' => true,
282
+ 'data-*' => true,
283
+ ),
284
+ 'input' => array(
285
+ 'class' => true,
286
+ 'name' => true,
287
+ 'type' => true,
288
+ 'value' => true,
289
+ 'id' => true,
290
+ 'checked' => true,
291
+ 'disabled' => true,
292
+ 'selected' => true,
293
+ 'style' => true,
294
+ 'required' => 'required',
295
+ 'min' => true,
296
+ 'max' => true,
297
+ 'maxlength' => true,
298
+ 'size' => true,
299
+ 'placeholder' => true,
300
+ 'autocomplete' => true,
301
+ 'autocapitalize' => true,
302
+ 'autocorrect' => true,
303
+ 'tabindex' => true,
304
+ 'role' => true,
305
+ 'aria-*' => true,
306
+ 'data-*' => true,
307
+ ),
308
+ 'label' => array(
309
+ 'class' => true,
310
+ 'name' => true,
311
+ 'type' => true,
312
+ 'value' => true,
313
+ 'id' => true,
314
+ 'for' => true,
315
+ 'style' => true,
316
+ ),
317
+ 'form' => array(
318
+ 'class' => true,
319
+ 'name' => true,
320
+ 'value' => true,
321
+ 'id' => true,
322
+ 'style' => true,
323
+ 'action' => true,
324
+ 'method' => true,
325
+ 'data-*' => true,
326
+ ),
327
+ 'svg' => array(
328
+ 'width' => true,
329
+ 'height' => true,
330
+ 'viewbox' => true,
331
+ 'xmlns' => true,
332
+ 'class' => true,
333
+ 'stroke-*' => true,
334
+ 'fill' => true,
335
+ 'stroke' => true,
336
+ ),
337
+ 'path' => array(
338
+ 'd' => true,
339
+ 'fill' => true,
340
+ 'class' => true,
341
+ 'fill-*' => true,
342
+ 'clip-*' => true,
343
+ 'stroke-linecap' => true,
344
+ 'stroke-linejoin' => true,
345
+ 'stroke-width' => true,
346
+ 'fill-rule' => true,
347
+ ),
348
+
349
+ 'main' => array(
350
+ 'align' => true,
351
+ 'dir' => true,
352
+ 'lang' => true,
353
+ 'xml:lang' => true,
354
+ 'aria-*' => true,
355
+ 'class' => true,
356
+ 'id' => true,
357
+ 'style' => true,
358
+ 'title' => true,
359
+ 'role' => true,
360
+ 'data-*' => true,
361
+ ),
362
+ 'textarea' => array(
363
+ 'id' => true,
364
+ 'autocomplete' => true,
365
+ 'required' => 'required',
366
+ 'placeholder' => true,
367
+ 'class' => true,
368
+ ),
369
+ 'style' => array(),
370
+ 'link' => array(
371
+ 'rel' => true,
372
+ 'id' => true,
373
+ 'href' => true,
374
+ 'media' => true,
375
+ ),
376
+ 'a' => array(
377
+ 'x-on:click' => true,
378
+ ),
379
+ 'polygon' => array(
380
+ 'class' => true,
381
+ 'points' => true,
382
+ ),
383
+ );
384
+
385
+ $allowedtags = array_merge_recursive( $context_allowed_tags, $custom_allowed_tags );
386
+
387
+ return $allowedtags;
388
+ }
389
+ }
390
+
391
+ add_filter( 'ig_escape_allowed_tags', 'ig_add_escape_allowed_tags' );
392
+
lite/classes/feedback/class-ig-feedback.php CHANGED
@@ -4,30 +4,30 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
- if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
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_3
15
  * @since 1.0.0
16
  * @copyright Copyright (c) 2019, Icegram
17
  * @license https://opensource.org/licenses/gpl-license GNU Public License
18
- * @author Icegram
19
  * @package feedback
20
  */
21
- class IG_Feedback_V_1_2_3 {
22
 
23
  /**
24
  * Version of Feedback Library
25
  *
26
  * @since 1.0.13
27
  * @var string
28
- *
29
  */
30
- public $version = '1.2.3';
31
  /**
32
  * The API URL where we will send feedback data.
33
  *
@@ -35,7 +35,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
35
  * @var string
36
  */
37
  public $api_url = 'https://api.icegram.com/store/feedback/'; // Production
38
-
39
 
40
  /**
41
  * Name for this plugin.
@@ -71,6 +71,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
71
 
72
  /**
73
  * Enable/Disable Dev Mode
 
74
  * @var bool
75
  */
76
  public $is_dev_mode = true;
@@ -83,7 +84,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
83
  public $event_prefix;
84
 
85
  /**
86
- *
87
  */
88
  public $footer = '<span class="ig-powered-by">Made With&nbsp;💜&nbsp;by&nbsp;<a href="https://www.icegram.com/" target="_blank">Icegram</a></span>';
89
 
@@ -194,31 +195,34 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
194
 
195
  if ( $can_ask_user_for_review ) {
196
 
197
- $current_page_url = "//" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
 
 
 
198
 
199
  $got_feedback = false;
200
- /************** Update Review Status ********************/
201
- $nonce = ! empty( $_GET['ig_feedback_nonce'] ) ? esc_attr( wp_unslash( $_GET['ig_feedback_nonce'] ) ) : '';
202
  $nonce_verified = wp_verify_nonce( $nonce, 'review' );
203
 
204
  $action = '';
205
  if ( $nonce_verified ) {
206
- $action = ! empty( $_GET['ig_feedback_action'] ) ? esc_attr( wp_unslash( $_GET['ig_feedback_action'] ) ) : '';
207
 
208
  if ( ! empty( $action ) && $this->is_valid_action( $action ) ) {
209
  update_user_meta( $current_user_id, $action, 1 );
210
- update_user_meta( $current_user_id, $action . "_time", time() );
211
 
212
  // Got the review request?
213
  // Redirect them to review page
214
  if ( $action === $review_done_option ) {
215
 
216
- $url = ! empty( $_GET['review_url'] ) ? $_GET['review_url'] : '';
217
 
218
  if ( ! empty( $url ) ) {
219
  ?>
220
 
221
- <meta http-equiv="refresh" content="0; url=<?php echo $url; ?>"/>
222
 
223
  <?php
224
  }
@@ -227,18 +231,19 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
227
 
228
  $got_feedback = true;
229
  }
230
- /************** Update Review Status (End) ********************/
231
 
232
  if ( ! $got_feedback ) {
233
 
234
  $review_url = "https://wordpress.org/support/plugin/{$this->plugin}/reviews/";
235
  $icon_url = plugin_dir_url( __FILE__ ) . 'assets/images/icon-64.png';
236
- $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 );
 
237
 
238
  $message_data = array(
239
  'review_url' => $review_url,
240
  'icon_url' => $icon_url,
241
- 'message' => $message
242
  );
243
 
244
  $message_data = apply_filters( $this->plugin_abbr . '_review_message_data', $message_data );
@@ -256,43 +261,50 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
256
 
257
  ?>
258
 
259
- <style type="text/css">
260
 
261
- .ig-feedback-notice-links li {
262
- display: inline-block;
263
- margin-right: 15px;
264
- }
265
 
266
- .ig-feedback-notice-links li a {
267
- display: inline-block;
268
- color: #10738b;
269
- text-decoration: none;
270
- padding-left: 26px;
271
- position: relative;
272
- }
273
 
274
- .ig-feedback-notice {
275
- display: flex;
276
- align-items: center;
277
- }
278
 
279
- .ig-feedback-plugin-icon {
280
- float: left;
281
- margin-right: 0.5em;
282
- }
283
 
284
- </style>
285
 
286
  <?php
287
 
288
  echo '<div class="notice notice-success ig-feedback-notice">';
289
- echo '<span class="ig-feedback-plugin-icon"> <img src="' . $icon_url . '" alt="Logo"/></span>';
290
- echo $message;
291
  echo "<ul class='ig-feedback-notice-links'>";
292
- echo sprintf( '<li><a href="%s" class="button-primary" target="_blank" data-rated="' . esc_attr__( "Thank You :) ",
293
- $this->plugin ) . '"><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>',
294
- esc_url( $review_url ), esc_url( $maybe_later_url ), esc_url( $already_did_url ), esc_url( $no_bug_url ) );
295
- echo "</ul></span>";
 
 
 
 
 
 
 
296
  echo '</div>';
297
  }
298
  }
@@ -334,8 +346,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
334
  * Render Deactivation Feedback
335
  *
336
  * @since 1.0.0
337
- *
338
- * @modify 1.2.3
339
  */
340
  public function render_deactivate_feedback() {
341
  add_action( 'admin_print_footer_scripts', array( $this, 'js' ), 20 );
@@ -365,20 +376,26 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
365
  * @since 1.0.1
366
  */
367
  public function enqueue_styles() {
368
- wp_register_style( "sweetalert_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/sweetalert2.min.css', array(), $this->version );
369
- wp_enqueue_style( "sweetalert_{$this->version}" );
370
-
371
- wp_register_style( "animate_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/animate.min.css', array(), $this->version );
372
- wp_enqueue_style( "animate_{$this->version}" );
373
 
374
- wp_register_style( "ig-feedback-star-rating_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/star-rating.min.css', array(), $this->version );
375
- wp_enqueue_style( "ig-feedback-star-rating_{$this->version}" );
376
 
377
- wp_register_style( "ig-feedback-emoji_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/emoji.min.css', array(), $this->version );
378
- wp_enqueue_style( "ig-feedback-emoji_{$this->version}" );
379
 
380
- wp_register_style( "ig-feedback_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/feedback.min.css', array(), $this->version );
381
- wp_enqueue_style( "ig-feedback_{$this->version}" );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
  }
383
 
384
  /**
@@ -407,7 +424,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
407
  'consent_text' => 'You are agree to our terms and condition',
408
  'email' => $this->get_contact_email(),
409
  'name' => '',
410
- 'consent' => false
411
  );
412
 
413
  $params = wp_parse_args( $params, $default_params );
@@ -433,30 +450,31 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
433
 
434
  ?>
435
 
436
- <script>
437
 
438
  function doSend(rating, details) {
439
 
440
  var data = {
441
- action: '<?php echo $this->ajax_action; ?>',
442
  feedback: {
443
- type: '<?php echo $params['type']; ?>',
444
- slug: '<?php echo $slug; ?>',
445
  title: '<?php echo esc_js( $title ); ?>',
446
  value: rating,
447
  details: details
448
  },
449
 
450
- event: '<?php echo $event; ?>',
451
 
452
  // Add additional information
453
  misc: {
454
- plugin: '<?php echo $this->plugin; ?>',
455
- plugin_abbr: '<?php echo $this->plugin_abbr; ?>',
456
- is_dev_mode: '<?php echo $this->is_dev_mode; ?>',
457
- set_transient: '<?php echo $params['set_transient']; ?>'
458
  //system_info: enable_system_info
459
- }
 
460
  };
461
 
462
  return jQuery.post(ajaxurl, data);
@@ -467,21 +485,21 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
467
  setTimeout(function () {
468
 
469
  Swal.mixin({
470
- footer: '<?php echo $this->footer; ?>',
471
- position: '<?php echo $params['position']; ?>',
472
- width: <?php echo $params['width']; ?>,
473
  animation: false,
474
  focusConfirm: false,
475
- allowEscapeKey: '<?php echo $params['allowEscapeKey']; ?>',
476
- showCloseButton: '<?php echo $params['showCloseButton']; ?>',
477
- allowOutsideClick: '<?php echo $params['allowOutsideClick']; ?>',
478
  showLoaderOnConfirm: true,
479
- confirmButtonText: '<?php echo $params['confirmButtonText']; ?>',
480
- backdrop: '<?php echo (int) $params['backdrop']; ?>'
481
  }).queue([
482
  {
483
  title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
484
- html: '<?php echo $html; ?>',
485
  customClass: {
486
  popup: 'animated fadeInUpBig'
487
  },
@@ -527,10 +545,10 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
527
 
528
  Swal.fire({
529
  type: 'success',
530
- width: <?php echo $params['width']; ?>,
531
- title: "Thank You!",
532
  showConfirmButton: false,
533
- position: '<?php echo $params['position']; ?>',
534
  timer: 1500,
535
  animation: false
536
  });
@@ -541,11 +559,11 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
541
  }, delay * 1000);
542
  }
543
 
544
- var delay = <?php echo $params['delay']; ?>;
545
  showWidget(delay);
546
 
547
 
548
- </script>
549
  <?php
550
  }
551
 
@@ -562,14 +580,14 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
562
 
563
  ?>
564
 
565
- <div class="rating">
566
- <!--elements are in reversed order, to allow "previous sibling selectors" in CSS-->
567
- <input class="ratings" type="radio" name="rating" value="5" id="5"><label for="5">☆</label>
568
- <input class="ratings" type="radio" name="rating" value="4" id="4"><label for="4">☆</label>
569
- <input class="ratings" type="radio" name="rating" value="3" id="3"><label for="3">☆</label>
570
- <input class="ratings" type="radio" name="rating" value="2" id="2"><label for="2">☆</label>
571
- <input class="ratings" type="radio" name="rating" value="1" id="1"><label for="1">☆</label>
572
- </div>
573
 
574
  <?php
575
 
@@ -593,15 +611,15 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
593
 
594
  ?>
595
 
596
- <div class="emoji">
597
- <!--elements are in reversed order, to allow "previous sibling selectors" in CSS-->
598
- <input class="emojis" type="radio" name="rating" value="love" id="5"/><label for="5" class="ig-emoji" data-reaction="Love">😍</label>
599
- <input class="emojis" type="radio" name="rating" value="smile" id="4"/><label for="4" class="ig-emoji" data-reaction="Smile">😊</label>
600
- <input class="emojis" type="radio" name="rating" value="neutral" id="3"/><label for="3" class="ig-emoji" data-reaction="Neutral">😐</label>
601
- <input class="emojis" type="radio" name="rating" value="sad" id="1"/><label for="2" class="ig-emoji" data-reaction="Sad">😠</label>
602
- <input class="emojis" type="radio" name="rating" value="angry" id="1"/><label for="1" class="ig-emoji" data-reaction="Angry">😡</label>
603
- </div>
604
- <div id="emoji-info"></div>
605
 
606
  <?php
607
 
@@ -626,27 +644,27 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
626
 
627
  ?>
628
 
629
- <div class="ig-general-feedback" id="ig-general-feedback-<?php echo $this->plugin; ?>">
630
- <form class="ig-general-feedback" id="ig-general-feedback">
631
- <p class="ig-feedback-data-name">
632
- <label class="ig-label">Name</label><br/>
633
- <input type="text" name="feedback_data[name]" id="ig-feedback-data-name" value="<?php echo $params['name']; ?>"/>
634
- </p>
635
- <p class="ig-feedback-data-email">
636
- <label class="ig-label"">Email</label><br/>
637
- <input type="email" name="feedback_data[email]" id="ig-feedback-data-email" value="<?php echo $params['email']; ?>"/>
638
- </p>
639
- <p class="ig-feedback-data-message">
640
- <label class="ig-label"">Feedback</label><br/>
641
- <textarea name="feedback_data[details]" id="ig-feedback-data-message"></textarea>
642
- </p>
643
- <?php if ( isset( $params['consent'] ) && $params['consent'] === true ) { ?>
644
- <p>
645
- <input type="checkbox" name="feedback_data[collect_system_info]" checked="checked" id="ig-feedback-data-consent"/><?php echo $params['consent_text']; ?>
646
- </p>
647
  <?php } ?>
648
- </form>
649
- </div>
650
 
651
  <?php
652
 
@@ -659,35 +677,38 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
659
  $event = $this->event_prefix . $params['event'];
660
  $html = ! empty( $params['html'] ) ? $params['html'] : '';
661
 
 
 
662
  ob_start();
663
  ?>
664
 
665
- <script type="text/javascript">
666
 
667
  jQuery(document).ready(function ($) {
668
 
669
  function doSend(details, meta, system_info) {
670
 
671
  var data = {
672
- action: '<?php echo $this->ajax_action; ?>',
673
  feedback: {
674
- type: '<?php echo $params['type']; ?>',
675
- slug: '<?php echo $slug; ?>',
676
  title: '<?php echo esc_js( $title ); ?>',
677
  details: details
678
  },
679
 
680
- event: '<?php echo $event; ?>',
681
 
682
  // Add additional information
683
  misc: {
684
- plugin: '<?php echo $this->plugin; ?>',
685
- plugin_abbr: '<?php echo $this->plugin_abbr; ?>',
686
- is_dev_mode: '<?php echo $this->is_dev_mode; ?>',
687
- set_transient: '<?php echo $params['set_transient']; ?>',
688
  meta_info: meta,
689
  system_info: system_info
690
- }
 
691
  };
692
 
693
  return jQuery.post(ajaxurl, data);
@@ -702,27 +723,27 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
702
  }
703
  }
704
 
705
- var feedbackButtonClass = 'ig-feedback-button-<?php echo $this->plugin; ?>';
706
 
707
  $('#wpwrap').append('<div class="ig-es-feedback-button ' + feedbackButtonClass + '">Feedback</div>');
708
 
709
  $('.' + feedbackButtonClass).on('click', function () {
710
  Swal.mixin({
711
- footer: '<?php echo $this->footer; ?>',
712
- position: '<?php echo $params['position']; ?>',
713
- width: <?php echo $params['width']; ?>,
714
  animation: false,
715
  focusConfirm: false,
716
  allowEscapeKey: true,
717
- showCloseButton: '<?php echo $params['showCloseButton']; ?>',
718
- allowOutsideClick: '<?php echo $params['allowOutsideClick']; ?>',
719
  showLoaderOnConfirm: true,
720
- confirmButtonText: '<?php echo $params['confirmButtonText']; ?>',
721
  backdrop: '<?php echo (int) $params['backdrop']; ?>'
722
  }).queue([
723
  {
724
  title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
725
- html: '<?php echo $html; ?>',
726
  customClass: {
727
  popup: 'animated fadeInUpBig'
728
  },
@@ -731,7 +752,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
731
 
732
  },
733
  preConfirm: () => {
734
- var $overlay = $('#ig-general-feedback-<?php echo $this->plugin; ?>');
735
  var $form = $overlay.find('form');
736
 
737
  var email = $form.find('#ig-feedback-data-email').val();
@@ -769,10 +790,10 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
769
 
770
  Swal.fire({
771
  type: 'success',
772
- width: <?php echo $params['width']; ?>,
773
- title: "Thank You!",
774
  showConfirmButton: false,
775
- position: '<?php echo $params['position']; ?>',
776
  timer: 1500,
777
  animation: false
778
  });
@@ -784,7 +805,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
784
  });
785
  });
786
 
787
- </script>
788
 
789
 
790
  <?php
@@ -800,39 +821,47 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
800
 
801
  $params = $this->prepare_widget_params( $params );
802
 
803
- $title = $params['title'];
804
- $slug = sanitize_title( $title );
805
- $event = $this->event_prefix . $params['event'];
806
- $html = ! empty( $params['html'] ) ? $params['html'] : '';
 
 
 
 
 
807
 
808
  ?>
809
 
810
- <script>
811
 
812
  Swal.mixin({
813
- type: 'question',
814
- footer: '<?php echo $this->footer; ?>',
815
- position: '<?php echo $params['position']; ?>',
816
- width: <?php echo $params['width']; ?>,
817
  animation: false,
818
- focusConfirm: false,
819
  allowEscapeKey: true,
820
- showCloseButton: '<?php echo $params['showCloseButton']; ?>',
821
- allowOutsideClick: '<?php echo $params['allowOutsideClick']; ?>',
 
 
 
 
822
  showLoaderOnConfirm: true,
823
- confirmButtonText: '<?php echo $params['confirmButtonText']; ?>',
824
  backdrop: '<?php echo (int) $params['backdrop']; ?>'
825
  }).queue([
826
  {
827
  title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
828
- html: '<?php echo $html; ?>',
829
  customClass: {
830
  popup: 'animated fadeInUpBig'
831
  },
832
 
833
  preConfirm: () => {
834
  window.open(
835
- 'https://www.facebook.com/groups/2298909487017349/',
836
  '_blank' // <- This is what makes it open in a new window.
837
  );
838
  }
@@ -843,19 +872,24 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
843
 
844
  Swal.fire({
845
  type: 'success',
846
- width: <?php echo $params['width']; ?>,
847
  title: "Thank You!",
848
  showConfirmButton: false,
849
- position: '<?php echo $params['position']; ?>',
850
  timer: 1500,
851
  animation: false
852
  });
 
 
 
 
 
853
  }
854
 
855
 
856
  });
857
 
858
- </script>
859
 
860
  <?php
861
  }
@@ -870,150 +904,340 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
870
  public function render_poll_widget( $params = array() ) {
871
  $params = $this->prepare_widget_params( $params );
872
 
873
- $poll_options = ! empty( $params['poll_options'] ) ? $params['poll_options'] : array();
874
-
875
- if ( empty( $poll_options ) ) {
876
  return;
877
  }
 
878
 
879
  $allow_multiple = ! empty( $params['allow_multiple'] ) ? $params['allow_multiple'] : false;
880
 
881
  $title = $params['title'];
882
- $slug = sanitize_title( $title );
883
- $event = $this->event_prefix . $params['event'];
884
- $desc = ! empty( $params['desc'] ) ? $params['desc'] : '';
 
 
 
 
 
 
885
 
886
  ob_start();
887
 
888
  ?>
889
 
890
- <div class="ig-general-feedback" id="ig-general-feedback-<?php echo $this->plugin; ?>">
891
- <form class="ig-general-feedback" id="ig-general-feedback">
892
- <p><?php echo $desc; ?></p>
893
-
894
- <p class="ig-general-feedback mb-3">
895
- <?php foreach ( $poll_options as $value => $option ) { ?>
896
- <input type="radio" name="feedback_data[poll_options]" value="<?php echo $value; ?>"><b style="color: <?php echo $option['color']; ?>"><?php echo $option['text']; ?></b><br/>
897
- <?php } ?>
898
- </p>
899
- <p class="ig-feedback-data-poll-message mb-3" id="ig-feedback-data-poll-message">
900
- <textarea name="feedback_data[details]" id="ig-feedback-data-poll-additional-message" placeholder="Additional feedback"></textarea>
901
- </p>
902
- </form>
903
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
904
 
905
  <?php
906
 
907
  $html = str_replace( array( "\r", "\n" ), '', trim( ob_get_clean() ) );
908
-
909
- $params['html'] = $html;
910
-
911
- $title = $params['title'];
912
- $slug = sanitize_title( $title );
913
  $event = $this->event_prefix . $params['event'];
914
- $html = ! empty( $params['html'] ) ? $params['html'] : '';
915
-
 
 
 
 
916
  ?>
 
917
 
918
- <script type="text/javascript">
 
 
 
 
 
 
 
 
919
 
920
- jQuery(document).ready(function ($) {
921
 
922
- function doSend(data, meta, system_info) {
 
 
 
 
 
 
 
 
 
923
 
924
- var data = {
925
- action: '<?php echo $this->ajax_action; ?>',
926
- feedback: {
927
- type: '<?php echo $params['type']; ?>',
928
- slug: '<?php echo $slug; ?>',
929
- title: '<?php echo esc_js( $title ); ?>',
930
- data: data
931
- },
932
 
933
- event: '<?php echo $event; ?>',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
934
 
935
- // Add additional information
936
- misc: {
937
- plugin: '<?php echo $this->plugin; ?>',
938
- plugin_abbr: '<?php echo $this->plugin_abbr; ?>',
939
- is_dev_mode: '<?php echo $this->is_dev_mode; ?>',
940
- set_transient: '<?php echo $params['set_transient']; ?>',
941
- meta_info: meta,
942
- system_info: system_info
943
  }
944
- };
945
-
946
- return jQuery.post(ajaxurl, data);
947
- }
948
 
949
- Swal.mixin({
950
- footer: '',
951
- position: '<?php echo $params['position']; ?>',
952
- width: <?php echo $params['width']; ?>,
953
- animation: false,
954
- focusConfirm: false,
955
- allowEscapeKey: true,
956
- showCloseButton: '<?php echo $params['showCloseButton']; ?>',
957
- allowOutsideClick: '<?php echo $params['allowOutsideClick']; ?>',
958
- showLoaderOnConfirm: true,
959
- confirmButtonText: '<?php echo $params['confirmButtonText']; ?>',
960
- backdrop: '<?php echo (int) $params['backdrop']; ?>'
961
- }).queue([
962
- {
963
- title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
964
- html: '<?php echo $html; ?>',
965
- customClass: {
966
- popup: 'animated fadeInUpBig'
967
- },
968
- onOpen: () => {
969
 
970
- },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
971
 
972
- preConfirm: () => {
973
- var $overlay = $('#ig-general-feedback-<?php echo $this->plugin; ?>');
974
- var $form = $overlay.find('form');
975
- var poll_options = $form.find("input[name='feedback_data[poll_options]']:checked").val();
976
- var message = $form.find("#ig-feedback-data-poll-additional-message").val();
 
 
 
 
 
 
 
 
977
 
978
- if (poll_options === undefined) {
979
- Swal.showValidationMessage('Please select option');
980
- return;
981
- }
982
 
983
- var data = {
984
- poll_option: poll_options,
985
- additional_feedback: message
986
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
987
 
988
- var meta = {};
989
 
990
- return doSend(data, meta, true);
 
 
 
 
 
991
  }
992
- },
993
 
994
- ]).then(response => {
 
995
 
996
- if (response.hasOwnProperty('value')) {
 
 
 
997
 
998
- Swal.fire({
999
- type: 'success',
1000
- width: <?php echo $params['width']; ?>,
1001
- title: "Thank You!",
1002
- showConfirmButton: false,
1003
- position: '<?php echo $params['position']; ?>',
1004
- timer: 1500,
1005
- animation: false
1006
- });
1007
 
 
1008
  }
1009
- });
1010
 
 
1011
 
1012
- });
1013
 
1014
- </script>
 
 
 
 
 
 
 
 
1015
 
 
 
 
1016
 
 
1017
  <?php
1018
  }
1019
 
@@ -1052,13 +1276,13 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1052
  $event = $this->event_prefix . 'plugin.deactivation';
1053
 
1054
  ?>
1055
- <script type="text/javascript">
1056
  jQuery(function ($) {
1057
- var $deactivateLink = $('#the-list').find('[data-slug="<?php echo $this->plugin; ?>"] span.deactivate a'),
1058
- $overlay = $('#ig-deactivate-survey-<?php echo $this->plugin; ?>'),
1059
  $form = $overlay.find('form'),
1060
  formOpen = false,
1061
- consent = $('#ig-deactivate-survey-help-consent-<?php echo $this->plugin; ?>');
1062
 
1063
  function togglePersonalInfoFields(show) {
1064
 
@@ -1115,7 +1339,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1115
  // Survey Skip & Deactivate.
1116
  $form.on('click', '.ig-deactivate-survey-deactivate', function (event) {
1117
  event.preventDefault();
1118
- deactivationURL = $deactivateLink.attr('href');
1119
  let skipSurveyURL = deactivationURL + '&survey_status=skipped';
1120
  location.href = skipSurveyURL;
1121
  });
@@ -1160,26 +1384,27 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1160
  };
1161
 
1162
  var data = {
1163
- action: '<?php echo $this->ajax_action; ?>',
1164
  feedback: {
1165
  type: 'radio',
1166
- title: '<?php echo $title; ?>',
1167
- slug: '<?php echo $slug; ?>',
1168
  value: $form.find('.selected input[type=radio]').attr('data-option-slug'),
1169
  details: $form.find('.selected input[type=text]').val()
1170
  },
1171
 
1172
- event: '<?php echo $event; ?>',
1173
 
1174
  // Add additional information
1175
  misc: {
1176
- plugin: '<?php echo $this->plugin; ?>',
1177
- plugin_abbr: '<?php echo $this->plugin_abbr; ?>',
1178
- is_dev_mode: '<?php echo $this->is_dev_mode; ?>',
1179
  set_cookie: '',
1180
  meta_info: meta,
1181
  system_info: system_info
1182
- }
 
1183
  };
1184
 
1185
  var submitSurvey = $.post(ajaxurl, data);
@@ -1196,7 +1421,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1196
  }
1197
  });
1198
  });
1199
- </script>
1200
  <?php
1201
  }
1202
 
@@ -1211,108 +1436,108 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1211
  return;
1212
  }
1213
  ?>
1214
- <style type="text/css">
1215
- .ig-deactivate-survey-modal {
1216
- display: none;
1217
- table-layout: fixed;
1218
- position: fixed;
1219
- z-index: 9999;
1220
- width: 100%;
1221
- height: 100%;
1222
- text-align: center;
1223
- font-size: 14px;
1224
- top: 0;
1225
- left: 0;
1226
- background: rgba(0, 0, 0, 0.8);
1227
- }
1228
-
1229
- .ig-deactivate-survey-wrap {
1230
- display: table-cell;
1231
- vertical-align: middle;
1232
- }
1233
-
1234
- .ig-deactivate-survey {
1235
- background-color: #fff;
1236
- max-width: 550px;
1237
- margin: 0 auto;
1238
- padding: 30px;
1239
- text-align: left;
1240
- }
1241
-
1242
- .ig-deactivate-survey .error {
1243
- display: block;
1244
- color: red;
1245
- margin: 0 0 10px 0;
1246
- }
1247
-
1248
- .ig-deactivate-survey-title {
1249
- display: block;
1250
- font-size: 18px;
1251
- font-weight: 700;
1252
- text-transform: uppercase;
1253
- border-bottom: 1px solid #ddd;
1254
- padding: 0 0 18px 0;
1255
- margin: 0 0 18px 0;
1256
- }
1257
-
1258
- .ig-deactivate-survey-options {
1259
- border-bottom: 1px solid #ddd;
1260
- padding: 0 0 18px 0;
1261
- margin: 0 0 18px 0;
1262
- }
1263
-
1264
- .ig-deactivate-survey-info-data {
1265
- padding: 0 0 18px 0;
1266
- margin: 10px 10px 10px 30px;
1267
- }
1268
-
1269
- .ig-deactivate-survey-info-name, .ig-deactivate-survey-info-email-address {
1270
- width: 230px;
1271
- margin: 10px;
1272
- }
1273
-
1274
- .ig-deactivate-survey-title span {
1275
- color: #999;
1276
- margin-right: 10px;
1277
- }
1278
-
1279
- .ig-deactivate-survey-desc {
1280
- display: block;
1281
- font-weight: 600;
1282
- margin: 0 0 18px 0;
1283
- }
1284
-
1285
- .ig-deactivate-survey-option {
1286
- margin: 0 0 10px 0;
1287
- }
1288
-
1289
- .ig-deactivate-survey-option-input {
1290
- margin-right: 10px !important;
1291
- }
1292
-
1293
- .ig-deactivate-survey-option-details {
1294
- display: none;
1295
- width: 90%;
1296
- margin: 10px 0 0 30px;
1297
- }
1298
-
1299
- .ig-deactivate-survey-footer {
1300
- margin-top: 18px;
1301
- }
1302
-
1303
- .ig-deactivate-survey-deactivate {
1304
- float: right;
1305
- font-size: 13px;
1306
- color: #ccc;
1307
- text-decoration: none;
1308
- padding-top: 7px;
1309
- }
1310
-
1311
- .ig-deactivate-survey-loader {
1312
- vertical-align: middle;
1313
- padding: 10px;
1314
- }
1315
- </style>
1316
  <?php
1317
  }
1318
 
@@ -1332,7 +1557,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1332
  $options = array(
1333
  1 => array(
1334
  'title' => esc_html__( 'I no longer need the plugin', $this->plugin ),
1335
- 'slug' => 'i-no-longer-need-the-plugin'
1336
  ),
1337
  2 => array(
1338
  'title' => esc_html__( 'I\'m switching to a different plugin', $this->plugin ),
@@ -1341,11 +1566,11 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1341
  ),
1342
  3 => array(
1343
  'title' => esc_html__( 'I couldn\'t get the plugin to work', $this->plugin ),
1344
- 'slug' => 'i-could-not-get-the-plugin-to-work'
1345
  ),
1346
  4 => array(
1347
  'title' => esc_html__( 'It\'s a temporary deactivation', $this->plugin ),
1348
- 'slug' => 'it-is-a-temporary-deactivation'
1349
  ),
1350
  5 => array(
1351
  'title' => esc_html__( 'Other', $this->plugin ),
@@ -1354,40 +1579,40 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1354
  ),
1355
  );
1356
  ?>
1357
- <div class="ig-deactivate-survey-modal" id="ig-deactivate-survey-<?php echo $this->plugin; ?>">
1358
- <div class="ig-deactivate-survey-wrap">
1359
- <form class="ig-deactivate-survey" method="post">
1360
- <span class="ig-deactivate-survey-title"><span class="dashicons dashicons-testimonial"></span><?php echo ' ' . esc_html__( 'Quick Feedback', $this->plugin ); ?></span>
1361
- <span class="ig-deactivate-survey-desc"><?php echo sprintf( esc_html__( 'If you have a moment, please share why you are deactivating %s:', $this->plugin ), $this->name ); ?></span>
1362
- <div class="ig-deactivate-survey-options">
1363
  <?php foreach ( $options as $id => $option ) : ?>
1364
- <div class="ig-deactivate-survey-option">
1365
- <label for="ig-deactivate-survey-option-<?php echo $this->plugin; ?>-<?php echo $id; ?>" class="ig-deactivate-survey-option-label">
1366
- <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']; ?>"/>
1367
- <span class="ig-deactivate-survey-option-reason"><?php echo $option['title']; ?></span>
1368
- </label>
1369
  <?php if ( ! empty( $option['details'] ) ) : ?>
1370
- <input class="ig-deactivate-survey-option-details" type="text" placeholder="<?php echo $option['details']; ?>"/>
1371
  <?php endif; ?>
1372
- </div>
1373
  <?php endforeach; ?>
1374
- </div>
1375
- <div class="ig-deactivate-survey-help-consent">
1376
- <input id="ig-deactivate-survey-help-consent-<?php echo $this->plugin; ?>" class="ig-deactivate-survey-option-input" type="checkbox" name="code" data-option-slug="<?php echo $option['slug']; ?>"/><b>Yes, I give my consent to track plugin usage and contact me back to make this plugin works!</b>
1377
- </div>
1378
- <div class="ig-deactivate-survey-info-data">
1379
-
1380
- <input type="text" class="ig-deactivate-survey-info-name" id="ig-deactivate-survey-info-name" placeholder="Enter Name" name="ig-deactivate-survey-info-name" value=""/>
1381
- <input type="text" class="ig-deactivate-survey-info-email-address" id="ig-deactivate-survey-info-email-address" name="ig-deactivate-survey-info-email-address" value="<?php echo $email; ?>"/>
1382
- </div>
1383
- <div class="ig-deactivate-survey-footer">
1384
- <button type="submit" class="ig-deactivate-survey-submit button button-primary button-large"><?php echo sprintf( esc_html__( 'Submit %s Deactivate', $this->plugin ), '&amp;' ); ?></button>
1385
- <img class="ig-deactivate-survey-loader" id="ig-deactivate-survey-loader" src="<?php echo plugin_dir_url( __FILE__ ); ?>/assets/images/loading.gif"/>
1386
- <a href="#" class="ig-deactivate-survey-deactivate"><?php echo sprintf( esc_html__( 'Skip %s Deactivate', $this->plugin ), '&amp;' ); ?></a>
1387
- </div>
1388
- </form>
1389
- </div>
1390
- </div>
1391
  <?php
1392
  }
1393
 
@@ -1583,7 +1808,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1583
  * Set event into transient
1584
  *
1585
  * @param $event
1586
- * @param int $expiry in days
1587
  */
1588
  public function set_event_transient( $event, $expiry = 45 ) {
1589
  set_transient( $event, 1, time() + ( 86400 * $expiry ) );
@@ -1632,7 +1857,9 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1632
  *
1633
  * Send feedback to server
1634
  */
1635
- function submit_feedback() {
 
 
1636
 
1637
  $data = ! empty( $_POST ) ? $_POST : array();
1638
 
@@ -1651,7 +1878,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1651
  'plugin' => sanitize_key( $plugin ),
1652
  'locale' => get_locale(),
1653
  'wp_version' => get_bloginfo( 'version' ),
1654
- 'php_version' => PHP_VERSION
1655
  );
1656
 
1657
  $meta_info = wp_parse_args( $meta_info, $default_meta_info );
@@ -1671,7 +1898,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1671
  'timeout' => 15,
1672
  'sslverify' => false,
1673
  'body' => $data,
1674
- 'blocking' => false
1675
  );
1676
 
1677
  $this->set_feedback_data( $plugin_abbr, $data['event'], $data['feedback'] );
@@ -1681,8 +1908,7 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1681
  $this->set_event_transient( $data['event'] );
1682
  }
1683
 
1684
- $response = wp_remote_post( $this->get_api_url( $is_dev_mode ), $args );
1685
-
1686
  $result['status'] = 'success';
1687
  if ( $response instanceof WP_Error ) {
1688
  $error_message = $response->get_error_message();
@@ -1692,5 +1918,89 @@ if ( ! class_exists( 'IG_Feedback_V_1_2_3' ) ) {
1692
 
1693
  die( json_encode( $result ) );
1694
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1695
  }
1696
  } // End if().
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
+ if ( ! class_exists( 'IG_Feedback_V_1_2_8' ) ) {
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_8
15
  * @since 1.0.0
16
  * @copyright Copyright (c) 2019, Icegram
17
  * @license https://opensource.org/licenses/gpl-license GNU Public License
18
+
19
  * @package feedback
20
  */
21
+ class IG_Feedback_V_1_2_8 {
22
 
23
  /**
24
  * Version of Feedback Library
25
  *
26
  * @since 1.0.13
27
  * @var string
28
+
29
  */
30
+ public $version = '1.2.8';
31
  /**
32
  * The API URL where we will send feedback data.
33
  *
35
  * @var string
36
  */
37
  public $api_url = 'https://api.icegram.com/store/feedback/'; // Production
38
+
39
 
40
  /**
41
  * Name for this plugin.
71
 
72
  /**
73
  * Enable/Disable Dev Mode
74
+ *
75
  * @var bool
76
  */
77
  public $is_dev_mode = true;
84
  public $event_prefix;
85
 
86
  /**
87
+ * Footer HTML
88
  */
89
  public $footer = '<span class="ig-powered-by">Made With&nbsp;💜&nbsp;by&nbsp;<a href="https://www.icegram.com/" target="_blank">Icegram</a></span>';
90
 
195
 
196
  if ( $can_ask_user_for_review ) {
197
 
198
+ $current_page_url = '';
199
+ if ( ! empty( $_SERVER['HTTP_HOST'] ) && ! empty( $_SERVER['REQUEST_URI'] ) ) {
200
+ $current_page_url = esc_url_raw( '//' . wp_unslash( $_SERVER['HTTP_HOST'] ) . wp_unslash( $_SERVER['REQUEST_URI'] ) );
201
+ }
202
 
203
  $got_feedback = false;
204
+ /************** Update Review Status */
205
+ $nonce = ! empty( $_GET['ig_feedback_nonce'] ) ? sanitize_text_field( wp_unslash( $_GET['ig_feedback_nonce'] ) ) : '';
206
  $nonce_verified = wp_verify_nonce( $nonce, 'review' );
207
 
208
  $action = '';
209
  if ( $nonce_verified ) {
210
+ $action = ! empty( $_GET['ig_feedback_action'] ) ? sanitize_text_field( wp_unslash( $_GET['ig_feedback_action'] ) ) : '';
211
 
212
  if ( ! empty( $action ) && $this->is_valid_action( $action ) ) {
213
  update_user_meta( $current_user_id, $action, 1 );
214
+ update_user_meta( $current_user_id, $action . '_time', time() );
215
 
216
  // Got the review request?
217
  // Redirect them to review page
218
  if ( $action === $review_done_option ) {
219
 
220
+ $url = ! empty( $_GET['review_url'] ) ? esc_url_raw( wp_unslash( $_GET['review_url'] ) ) : '';
221
 
222
  if ( ! empty( $url ) ) {
223
  ?>
224
 
225
+ <meta http-equiv="refresh" content="0; url=<?php echo esc_url( $url ); ?>"/>
226
 
227
  <?php
228
  }
231
 
232
  $got_feedback = true;
233
  }
234
+ /************** Update Review Status (End) */
235
 
236
  if ( ! $got_feedback ) {
237
 
238
  $review_url = "https://wordpress.org/support/plugin/{$this->plugin}/reviews/";
239
  $icon_url = plugin_dir_url( __FILE__ ) . 'assets/images/icon-64.png';
240
+ /* translators: %s: Plugin name */
241
+ $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 );
242
 
243
  $message_data = array(
244
  'review_url' => $review_url,
245
  'icon_url' => $icon_url,
246
+ 'message' => $message,
247
  );
248
 
249
  $message_data = apply_filters( $this->plugin_abbr . '_review_message_data', $message_data );
261
 
262
  ?>
263
 
264
+ <style type="text/css">
265
 
266
+ .ig-feedback-notice-links li {
267
+ display: inline-block;
268
+ margin-right: 15px;
269
+ }
270
 
271
+ .ig-feedback-notice-links li a {
272
+ display: inline-block;
273
+ color: #10738b;
274
+ text-decoration: none;
275
+ padding-left: 26px;
276
+ position: relative;
277
+ }
278
 
279
+ .ig-feedback-notice {
280
+ display: flex;
281
+ align-items: center;
282
+ }
283
 
284
+ .ig-feedback-plugin-icon {
285
+ float: left;
286
+ margin-right: 0.5em;
287
+ }
288
 
289
+ </style>
290
 
291
  <?php
292
 
293
  echo '<div class="notice notice-success ig-feedback-notice">';
294
+ echo '<span class="ig-feedback-plugin-icon"> <img src="' . esc_url( $icon_url ) . '" alt="Logo"/></span>';
295
+ echo wp_kses_post( $message );
296
  echo "<ul class='ig-feedback-notice-links'>";
297
+ echo sprintf(
298
+ '<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__(
299
+ 'Thank You :) ',
300
+ $this->plugin
301
+ ) . '"><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>',
302
+ esc_url( $review_url ),
303
+ esc_url( $maybe_later_url ),
304
+ esc_url( $already_did_url ),
305
+ esc_url( $no_bug_url )
306
+ );
307
+ echo '</ul></span>';
308
  echo '</div>';
309
  }
310
  }
346
  * Render Deactivation Feedback
347
  *
348
  * @since 1.0.0
349
+
 
350
  */
351
  public function render_deactivate_feedback() {
352
  add_action( 'admin_print_footer_scripts', array( $this, 'js' ), 20 );
376
  * @since 1.0.1
377
  */
378
  public function enqueue_styles() {
 
 
 
 
 
379
 
 
 
380
 
381
+ $can_load = apply_filters( $this->plugin_abbr . '_can_load_sweetalert_css', false );
 
382
 
383
+ if ( $can_load ) {
384
+ wp_register_style( "sweetalert_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/sweetalert2.min.css', array(), $this->version );
385
+ wp_enqueue_style( "sweetalert_{$this->version}" );
386
+
387
+ wp_register_style( "animate_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/animate.min.css', array(), $this->version );
388
+ wp_enqueue_style( "animate_{$this->version}" );
389
+
390
+ wp_register_style( "ig-feedback-star-rating_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/star-rating.min.css', array(), $this->version );
391
+ wp_enqueue_style( "ig-feedback-star-rating_{$this->version}" );
392
+
393
+ wp_register_style( "ig-feedback-emoji_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/emoji.min.css', array(), $this->version );
394
+ wp_enqueue_style( "ig-feedback-emoji_{$this->version}" );
395
+
396
+ wp_register_style( "ig-feedback_{$this->version}", plugin_dir_url( __FILE__ ) . 'assets/css/feedback.min.css', array(), $this->version );
397
+ wp_enqueue_style( "ig-feedback_{$this->version}" );
398
+ }
399
  }
400
 
401
  /**
424
  'consent_text' => 'You are agree to our terms and condition',
425
  'email' => $this->get_contact_email(),
426
  'name' => '',
427
+ 'consent' => false,
428
  );
429
 
430
  $params = wp_parse_args( $params, $default_params );
450
 
451
  ?>
452
 
453
+ <script>
454
 
455
  function doSend(rating, details) {
456
 
457
  var data = {
458
+ action: '<?php echo esc_js( $this->ajax_action ); ?>',
459
  feedback: {
460
+ type: '<?php echo esc_js( $params['type'] ); ?>',
461
+ slug: '<?php echo esc_js( $slug ); ?>',
462
  title: '<?php echo esc_js( $title ); ?>',
463
  value: rating,
464
  details: details
465
  },
466
 
467
+ event: '<?php echo esc_js( $event ); ?>',
468
 
469
  // Add additional information
470
  misc: {
471
+ plugin: '<?php echo esc_js( $this->plugin ); ?>',
472
+ plugin_abbr: '<?php echo esc_js( $this->plugin_abbr ); ?>',
473
+ is_dev_mode: '<?php echo esc_js( $this->is_dev_mode ); ?>',
474
+ set_transient: '<?php echo esc_js( $params['set_transient'] ); ?>'
475
  //system_info: enable_system_info
476
+ },
477
+ security: '<?php echo esc_js( wp_create_nonce( $this->plugin_abbr . '-admin-ajax-nonce' ) ); ?>'
478
  };
479
 
480
  return jQuery.post(ajaxurl, data);
485
  setTimeout(function () {
486
 
487
  Swal.mixin({
488
+ footer: '<?php echo wp_kses_post( $this->footer ); ?>',
489
+ position: '<?php echo esc_js( $params['position'] ); ?>',
490
+ width: <?php echo esc_js( $params['width'] ); ?>,
491
  animation: false,
492
  focusConfirm: false,
493
+ allowEscapeKey: '<?php echo esc_js( $params['allowEscapeKey'] ); ?>',
494
+ showCloseButton: '<?php echo esc_js( $params['showCloseButton'] ); ?>',
495
+ allowOutsideClick: '<?php echo esc_js( $params['allowOutsideClick'] ); ?>',
496
  showLoaderOnConfirm: true,
497
+ confirmButtonText: '<?php echo wp_kses_post( $params['confirmButtonText'] ); ?>',
498
+ backdrop: '<?php echo (int) esc_js( $params['backdrop'] ); ?>'
499
  }).queue([
500
  {
501
  title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
502
+ html: '<?php echo wp_kses_post( $html ); ?>',
503
  customClass: {
504
  popup: 'animated fadeInUpBig'
505
  },
545
 
546
  Swal.fire({
547
  type: 'success',
548
+ width: <?php echo esc_js( $params['width'] ); ?>,
549
+ title: '<?php echo esc_attr__( 'Thank You!', $this->plugin ); ?>',
550
  showConfirmButton: false,
551
+ position: '<?php echo esc_js( $params['position'] ); ?>',
552
  timer: 1500,
553
  animation: false
554
  });
559
  }, delay * 1000);
560
  }
561
 
562
+ var delay = <?php echo esc_js( $params['delay'] ); ?>;
563
  showWidget(delay);
564
 
565
 
566
+ </script>
567
  <?php
568
  }
569
 
580
 
581
  ?>
582
 
583
+ <div class="rating">
584
+ <!--elements are in reversed order, to allow "previous sibling selectors" in CSS-->
585
+ <input class="ratings" type="radio" name="rating" value="5" id="5"><label for="5">☆</label>
586
+ <input class="ratings" type="radio" name="rating" value="4" id="4"><label for="4">☆</label>
587
+ <input class="ratings" type="radio" name="rating" value="3" id="3"><label for="3">☆</label>
588
+ <input class="ratings" type="radio" name="rating" value="2" id="2"><label for="2">☆</label>
589
+ <input class="ratings" type="radio" name="rating" value="1" id="1"><label for="1">☆</label>
590
+ </div>
591
 
592
  <?php
593
 
611
 
612
  ?>
613
 
614
+ <div class="emoji">
615
+ <!--elements are in reversed order, to allow "previous sibling selectors" in CSS-->
616
+ <input class="emojis" type="radio" name="rating" value="love" id="5"/><label for="5" class="ig-emoji" data-reaction="Love">😍</label>
617
+ <input class="emojis" type="radio" name="rating" value="smile" id="4"/><label for="4" class="ig-emoji" data-reaction="Smile">😊</label>
618
+ <input class="emojis" type="radio" name="rating" value="neutral" id="3"/><label for="3" class="ig-emoji" data-reaction="Neutral">😐</label>
619
+ <input class="emojis" type="radio" name="rating" value="sad" id="1"/><label for="2" class="ig-emoji" data-reaction="Sad">😠</label>
620
+ <input class="emojis" type="radio" name="rating" value="angry" id="1"/><label for="1" class="ig-emoji" data-reaction="Angry">😡</label>
621
+ </div>
622
+ <div id="emoji-info"></div>
623
 
624
  <?php
625
 
644
 
645
  ?>
646
 
647
+ <div class="ig-general-feedback" id="ig-general-feedback-<?php echo esc_attr( $this->plugin ); ?>">
648
+ <form class="ig-general-feedback" id="ig-general-feedback">
649
+ <p class="ig-feedback-data-name">
650
+ <label class="ig-label">Name</label><br/>
651
+ <input type="text" name="feedback_data[name]" id="ig-feedback-data-name" value="<?php echo esc_attr( $params['name'] ); ?>"/>
652
+ </p>
653
+ <p class="ig-feedback-data-email">
654
+ <label class="ig-label"">Email</label><br/>
655
+ <input type="email" name="feedback_data[email]" id="ig-feedback-data-email" value="<?php echo esc_attr( $params['email'] ); ?>"/>
656
+ </p>
657
+ <p class="ig-feedback-data-message">
658
+ <label class="ig-label"">Feedback</label><br/>
659
+ <textarea name="feedback_data[details]" id="ig-feedback-data-message"></textarea>
660
+ </p>
661
+ <?php if ( isset( $params['consent'] ) && true === $params['consent'] ) { ?>
662
+ <p>
663
+ <input type="checkbox" name="feedback_data[collect_system_info]" checked="checked" id="ig-feedback-data-consent"/><?php echo esc_html( $params['consent_text'] ); ?>
664
+ </p>
665
  <?php } ?>
666
+ </form>
667
+ </div>
668
 
669
  <?php
670
 
677
  $event = $this->event_prefix . $params['event'];
678
  $html = ! empty( $params['html'] ) ? $params['html'] : '';
679
 
680
+ $escape_allowed_tags = $this->get_escape_allowed_tags();
681
+
682
  ob_start();
683
  ?>
684
 
685
+ <script type="text/javascript">
686
 
687
  jQuery(document).ready(function ($) {
688
 
689
  function doSend(details, meta, system_info) {
690
 
691
  var data = {
692
+ action: '<?php echo esc_js( $this->ajax_action ); ?>',
693
  feedback: {
694
+ type: '<?php echo esc_js( $params['type'] ); ?>',
695
+ slug: '<?php echo esc_js( $slug ); ?>',
696
  title: '<?php echo esc_js( $title ); ?>',
697
  details: details
698
  },
699
 
700
+ event: '<?php echo esc_js( $event ); ?>',
701
 
702
  // Add additional information
703
  misc: {
704
+ plugin: '<?php echo esc_js( $this->plugin ); ?>',
705
+ plugin_abbr: '<?php echo esc_js( $this->plugin_abbr ); ?>',
706
+ is_dev_mode: '<?php echo esc_js( $this->is_dev_mode ); ?>',
707
+ set_transient: '<?php echo esc_js( $params['set_transient'] ); ?>',
708
  meta_info: meta,
709
  system_info: system_info
710
+ },
711
+ security: '<?php echo esc_js( wp_create_nonce( $this->plugin_abbr . '-admin-ajax-nonce' ) ); ?>'
712
  };
713
 
714
  return jQuery.post(ajaxurl, data);
723
  }
724
  }
725
 
726
+ var feedbackButtonClass = 'ig-feedback-button-<?php echo esc_js( $this->plugin ); ?>';
727
 
728
  $('#wpwrap').append('<div class="ig-es-feedback-button ' + feedbackButtonClass + '">Feedback</div>');
729
 
730
  $('.' + feedbackButtonClass).on('click', function () {
731
  Swal.mixin({
732
+ footer: '<?php echo wp_kses_post( $this->footer ); ?>',
733
+ position: '<?php echo esc_js( $params['position'] ); ?>',
734
+ width: <?php echo esc_js( $params['width'] ); ?>,
735
  animation: false,
736
  focusConfirm: false,
737
  allowEscapeKey: true,
738
+ showCloseButton: '<?php echo esc_js( $params['showCloseButton'] ); ?>',
739
+ allowOutsideClick: '<?php echo esc_js( $params['allowOutsideClick'] ); ?>',
740
  showLoaderOnConfirm: true,
741
+ confirmButtonText: '<?php echo wp_kses_post( $params['confirmButtonText'] ); ?>',
742
  backdrop: '<?php echo (int) $params['backdrop']; ?>'
743
  }).queue([
744
  {
745
  title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
746
+ html: '<?php echo wp_kses( $html, $escape_allowed_tags ); ?>',
747
  customClass: {
748
  popup: 'animated fadeInUpBig'
749
  },
752
 
753
  },
754
  preConfirm: () => {
755
+ var $overlay = $('#ig-general-feedback-<?php echo esc_js( $this->plugin ); ?>');
756
  var $form = $overlay.find('form');
757
 
758
  var email = $form.find('#ig-feedback-data-email').val();
790
 
791
  Swal.fire({
792
  type: 'success',
793
+ width: <?php echo esc_js( $params['width'] ); ?>,
794
+ title: '<?php echo esc_attr__( 'Thank You!', $this->plugin ); ?>',
795
  showConfirmButton: false,
796
+ position: '<?php echo esc_js( $params['position'] ); ?>',
797
  timer: 1500,
798
  animation: false
799
  });
805
  });
806
  });
807
 
808
+ </script>
809
 
810
 
811
  <?php
821
 
822
  $params = $this->prepare_widget_params( $params );
823
 
824
+ $title = $params['title'];
825
+ $widget_tyoe = ! empty( $params['widget_tyoe'] ) ? $params['widget_tyoe'] : 'question';
826
+ $slug = sanitize_title( $title );
827
+ $event = $this->event_prefix . $params['event'];
828
+ $html = ! empty( $params['html'] ) ? $params['html'] : '';
829
+ $confirm_button_link = ! empty( $params['confirmButtonLink'] ) ? $params['confirmButtonLink'] : '';
830
+ $cancel_button_link = ! empty( $params['cancelButtonLink'] ) ? $params['cancelButtonLink'] : '';
831
+ $show_cancel_button = ! empty( $params['showCancelButton'] ) ? 'true' : 'false';
832
+ $cancel_button_text = ! empty( $params['cancelButtonText'] ) ? $params['cancelButtonText'] : 'Cancel';
833
 
834
  ?>
835
 
836
+ <script>
837
 
838
  Swal.mixin({
839
+ type: '<?php echo esc_js( $widget_tyoe ); ?>',
840
+ position: '<?php echo esc_js( $params['position'] ); ?>',
841
+ width: <?php echo esc_js( $params['width'] ); ?>,
 
842
  animation: false,
843
+ focusConfirm: true,
844
  allowEscapeKey: true,
845
+ showCancelButton: <?php echo esc_js( $show_cancel_button ); ?>,
846
+ confirmButtonColor: '#0e9f6e',
847
+ cancelButtonColor: '#5850ec',
848
+ cancelButtonText: '<?php echo wp_kses_post( $cancel_button_text ); ?>',
849
+ showCloseButton: '<?php echo esc_js( $params['showCloseButton'] ); ?>',
850
+ allowOutsideClick: '<?php echo esc_js( $params['allowOutsideClick'] ); ?>',
851
  showLoaderOnConfirm: true,
852
+ confirmButtonText: '<?php echo wp_kses_post( $params['confirmButtonText'] ); ?>',
853
  backdrop: '<?php echo (int) $params['backdrop']; ?>'
854
  }).queue([
855
  {
856
  title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
857
+ html: '<?php echo wp_kses_post( $html ); ?>',
858
  customClass: {
859
  popup: 'animated fadeInUpBig'
860
  },
861
 
862
  preConfirm: () => {
863
  window.open(
864
+ '<?php echo esc_url( $confirm_button_link ); ?>',
865
  '_blank' // <- This is what makes it open in a new window.
866
  );
867
  }
872
 
873
  Swal.fire({
874
  type: 'success',
875
+ width: <?php echo esc_js( $params['width'] ); ?>,
876
  title: "Thank You!",
877
  showConfirmButton: false,
878
+ position: '<?php echo esc_js( $params['position'] ); ?>',
879
  timer: 1500,
880
  animation: false
881
  });
882
+ } else if(response.dismiss == 'cancel') {
883
+ window.open(
884
+ '<?php echo esc_url( $cancel_button_link ); ?>',
885
+ '_blank' // <- This is what makes it open in a new window.
886
+ );
887
  }
888
 
889
 
890
  });
891
 
892
+ </script>
893
 
894
  <?php
895
  }
904
  public function render_poll_widget( $params = array() ) {
905
  $params = $this->prepare_widget_params( $params );
906
 
907
+ $fields = ! empty( $params['fields'] ) ? $params['fields'] : array();
908
+ if ( empty( $fields ) ) {
 
909
  return;
910
  }
911
+ $default_values = ! empty( $params['default_values'] ) ? $params['default_values'] : array();
912
 
913
  $allow_multiple = ! empty( $params['allow_multiple'] ) ? $params['allow_multiple'] : false;
914
 
915
  $title = $params['title'];
916
+ if ( ! empty( $params['slug'] ) ) {
917
+ $slug = $params['slug'];
918
+ } else {
919
+ $slug = sanitize_title( $title );
920
+ }
921
+ $event = $this->event_prefix . $params['event'];
922
+ $desc = ! empty( $params['desc'] ) ? $params['desc'] : '';
923
+ $display_as = ! empty( $params['display_as'] ) ? $params['display_as'] : 'inline';
924
+ $system_info = isset( $params['system_info'] ) ? $params['system_info'] : true;
925
 
926
  ob_start();
927
 
928
  ?>
929
 
930
+ <div class="ig-general-feedback" id="ig-general-feedback-<?php echo esc_attr( $this->plugin ); ?>">
931
+ <form class="ig-general-feedback" id="ig-general-feedback">
932
+ <?php
933
+ if ( ! empty( $title ) ) {
934
+ ?>
935
+ <h2><?php echo wp_kses_post( $title ); ?></h2>
936
+ <?php
937
+ }
938
+ ?>
939
+ <?php
940
+ if ( ! empty( $desc ) ) {
941
+ ?>
942
+ <p><?php echo wp_kses_post( $desc ); ?></p>
943
+ <?php
944
+ }
945
+ ?>
946
+ <p class="ig-general-feedback mb-3">
947
+ <?php
948
+ foreach ( $fields as $index => $field ) {
949
+ $field_type = $field['type'];
950
+ $field_name = $field['name'];
951
+ $field_value = ! empty( $field['value'] ) ? $field['value'] : '';
952
+ $field_placeholder = ! empty( $field['placeholder'] ) ? $field['placeholder'] : '';
953
+ $field_required = isset ( $field['required'] ) ? $field['required'] : false;
954
+ switch ( $field_type ) {
955
+ case 'textarea':
956
+ ?>
957
+ <p class="ig-feedback-data-poll-message mb-3" id="ig-feedback-data-poll-message">
958
+ <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>
959
+ </p>
960
+ <br/>
961
+ <?php
962
+ break;
963
+ case 'radio':
964
+ case 'checkbox':
965
+ ?>
966
+ <label>
967
+ <input
968
+ type="<?php echo esc_attr( $field_type ); ?>"
969
+ name="feedback_data[<?php echo esc_attr( $field_name ); ?>]"
970
+ value="<?php echo esc_attr( $field_value ); ?>"
971
+ <?php echo ( ! empty( $default_values[ $field_name ] ) && $field_value === $default_values[ $field_name ] ) ? 'checked' : ''; ?>
972
+ class="<?php echo esc_attr( $this->plugin_abbr ); ?>-feedback-field"
973
+ <?php echo $field_required ? 'required' : ''; ?>>
974
+ <?php echo wp_kses_post( $field['label'] ); ?>
975
+ </label>
976
+ <br/>
977
+ <?php
978
+ break;
979
+ default:
980
+ ?>
981
+ <label>
982
+ <input
983
+ type="<?php echo esc_attr( $field_type ); ?>"
984
+ name="feedback_data[<?php echo esc_attr( $field_name ); ?>]"
985
+ value="<?php echo esc_attr( $field['value'] ); ?>"
986
+ class="<?php echo esc_attr( $this->plugin_abbr ); ?>-feedback-field">
987
+ <?php echo wp_kses_post( $field['label'] ); ?>
988
+ </label>
989
+ <br/>
990
+ <?php
991
+ }
992
+ ?>
993
+ <?php
994
+ if ( 'other' === $field['value'] ) {
995
+ ?>
996
+ <div class="ig_feedback_text_wrapper">
997
+ <textarea
998
+ id="feedback_text"
999
+ name="feedback[feedback_text]"
1000
+ class="form-textarea text-sm w-2/3 mt-3 mb-1 border-gray-400 w-3/5 hidden"
1001
+ placeholder="<?php echo esc_attr__( 'Tell us more about your desired feature', $this->plugin ); ?>"></textarea>
1002
+ </div>
1003
+ <?php
1004
+ }
1005
+ }
1006
+ ?>
1007
+ </p>
1008
+ <?php
1009
+ if ( 'inline' === $display_as ) {
1010
+ ?>
1011
+ <button type="submit" class="button">
1012
+ <?php
1013
+ echo esc_html__( 'Submit your feedback', $this->plugin );
1014
+ ?>
1015
+ </button>
1016
+ <br/>
1017
+ <br/>
1018
+ <?php
1019
+ }
1020
+ ?>
1021
+ </form>
1022
+ </div>
1023
 
1024
  <?php
1025
 
1026
  $html = str_replace( array( "\r", "\n" ), '', trim( ob_get_clean() ) );
1027
+
 
 
 
 
1028
  $event = $this->event_prefix . $params['event'];
1029
+
1030
+ if ( 'inline' === $display_as ) {
1031
+ $this->render_inline_feedback_widget( $html, $params );
1032
+ } elseif ( 'popup' === $display_as ) {
1033
+ $this->render_popup_feedback_widget( $html, $params );
1034
+ }
1035
  ?>
1036
+ <script type="text/javascript">
1037
 
1038
+ function doSend(data) {
1039
+ var system_info = <?php echo $system_info ? 'true' : 'false'; ?>;
1040
+ var requestData = {
1041
+ action: '<?php echo esc_js( $this->ajax_action ); ?>',
1042
+ feedback: {
1043
+ type: '<?php echo esc_js( $params['type'] ); ?>',
1044
+ slug: '<?php echo esc_js( $slug ); ?>',
1045
+ data: data
1046
+ },
1047
 
1048
+ event: '<?php echo esc_js( $event ); ?>',
1049
 
1050
+ // Add additional information
1051
+ misc: {
1052
+ plugin: '<?php echo esc_js( $this->plugin ); ?>',
1053
+ plugin_abbr: '<?php echo esc_js( $this->plugin_abbr ); ?>',
1054
+ is_dev_mode: '<?php echo esc_js( $this->is_dev_mode ); ?>',
1055
+ set_transient: '<?php echo esc_js( $params['set_transient'] ); ?>',
1056
+ system_info: system_info
1057
+ },
1058
+ security: '<?php echo esc_js( wp_create_nonce( $this->plugin_abbr . '-admin-ajax-nonce' ) ); ?>'
1059
+ };
1060
 
1061
+ return jQuery.post(ajaxurl, requestData, null, 'json');
1062
+ }
1063
+ </script>
1064
+ <?php
1065
+ }
 
 
 
1066
 
1067
+ /**
1068
+ * Render inline feedback widget
1069
+ *
1070
+ * @since 1.2.7
1071
+ *
1072
+ * @param array $params
1073
+ * @param string $html
1074
+ * @return void
1075
+ */
1076
+ public function render_inline_feedback_widget( $html, $params ) {
1077
+ $escape_allowed_tags = $this->get_escape_allowed_tags();
1078
+ ?>
1079
+ <style type="text/css">
1080
+ .ig-feedback-inline h2{
1081
+ font-size:2em;
1082
+ padding: 0.5em 0;
1083
+ }
1084
+ .ig-feedback-inline{
1085
+ border:none;
1086
+ width:80%;
1087
+ margin: 1em auto !important;
1088
+ /* background:#fbe2597d; */
1089
+ }
1090
+ .ig-feedback-inline button{
1091
+ background: green !important;
1092
+ color: #FFF !important;
1093
+ }
1094
+ .ig-feedback-inline radio{
1095
+ line-height:1em;
1096
+ }
1097
+ .ig-feedback-logo{
1098
+ float:right;
1099
+ }
1100
+ .ig-feedback-inline label{
1101
+ font-size: 1.2em;
1102
+ padding-bottom: 0.1em;
1103
+ }
1104
+ .ig-feedback-inline .button{
1105
+ padding: 0.7em;
1106
+ font-size: 1.2em;
1107
+ border-radius: 0;
1108
+ }
1109
+ </style>
1110
+ <div class="notice ig-feedback-notice ig-feedback-inline">
1111
+ <div class="ig-feedback-logo">
1112
+ <img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>../../admin/assets/images/icon-64.png">
1113
+ </div>
1114
+ <?php echo wp_kses( $html, $escape_allowed_tags ); ?>
1115
+ </div>
1116
+ <script type="text/javascript">
1117
+ jQuery(document).ready(function ($) {
1118
+ $('.<?php echo esc_attr( $this->plugin_abbr ); ?>-feedback-field').on('change', function(){
1119
+ let value = $(this).val();
1120
+ if ( 'other' === value ) {
1121
+ $('#feedback_text').removeClass('hidden');
1122
+ } else {
1123
+ $('#feedback_text').addClass('hidden');
1124
+ }
1125
+ });
1126
 
1127
+ var $overlay = $('#ig-general-feedback-<?php echo esc_js( $this->plugin ); ?>');
1128
+ var $form = $overlay.find('form');
1129
+ $($form).on('submit', function(e){
1130
+ e.preventDefault();
1131
+ let selected_feature = $form.find("input[name='feedback_data[feature]']:checked").val();
1132
+ let form_data = {
1133
+ questions_response : {
1134
+ selected_feature: selected_feature
1135
  }
1136
+ }
 
 
 
1137
 
1138
+ if ( selected_feature === 'other' ) {
1139
+ form_data.other_feature = $form.find('textarea[name="feedback[feedback_text]"]').val();
1140
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1141
 
1142
+ var request = doSend( form_data );
1143
+ request.done(response => {
1144
+ if (response.status && response.status === 'success') {
1145
+ let success_text = '<?php echo esc_html__( 'Your feedback submitted successfully.', $this->plugin ); ?>';
1146
+ $('.ig-feedback-notice').html('<p>' + success_text + '</p>');
1147
+ } else {
1148
+ let error_text = '<?php echo esc_html__( 'An error has occured. Please try again.', $this->plugin ); ?>';
1149
+ $('.ig-feedback-notice').removeClass('notice-success').addClass('notice-error').append('<p>' + error_text + '</p>');
1150
+ }
1151
+ }).fail( response => {
1152
+ let error_text = '<?php echo esc_html__( 'An error has occured. Please try again.', $this->plugin ); ?>';
1153
+ $('.ig-feedback-notice').removeClass('notice-success').addClass('notice-error').append('<p>' + error_text + '</p>');
1154
+ });
1155
+ });
1156
+ });
1157
+ </script>
1158
+ <?php
1159
+ }
1160
 
1161
+ /**
1162
+ * Render popup feedback widget
1163
+ *
1164
+ * @since 1.2.7
1165
+ *
1166
+ * @param string $html
1167
+ * @param array $params
1168
+ * @return void
1169
+ */
1170
+ public function render_popup_feedback_widget( $html, $params ) {
1171
+ $escape_allowed_tags = $this->get_escape_allowed_tags();
1172
+ ?>
1173
+ <script type="text/javascript">
1174
 
1175
+ jQuery(document).ready(function ($) {
 
 
 
1176
 
1177
+ Swal.mixin({
1178
+ footer: '',
1179
+ position: '<?php echo esc_js( $params['position'] ); ?>',
1180
+ width: <?php echo esc_js( $params['width'] ); ?>,
1181
+ animation: false,
1182
+ focusConfirm: false,
1183
+ allowEscapeKey: true,
1184
+ showCloseButton: '<?php echo esc_js( $params['showCloseButton'] ); ?>',
1185
+ allowOutsideClick: '<?php echo esc_js( $params['allowOutsideClick'] ); ?>',
1186
+ showLoaderOnConfirm: true,
1187
+ confirmButtonText: '<?php echo wp_kses_post( $params['confirmButtonText'] ); ?>',
1188
+ backdrop: '<?php echo (int) $params['backdrop']; ?>'
1189
+ }).queue([
1190
+ {
1191
+ title: '<p class="ig-feedback-title"><?php echo esc_js( $params['title'] ); ?></p>',
1192
+ html: '<?php echo wp_kses( $html, $escape_allowed_tags ); ?>',
1193
+ customClass: {
1194
+ popup: 'animated fadeInUpBig'
1195
+ },
1196
+ onOpen: () => {
1197
 
1198
+ },
1199
 
1200
+ preConfirm: () => {
1201
+ var $overlay = $('#ig-general-feedback-<?php echo esc_js( $this->plugin ); ?>');
1202
+ var $form = $overlay.find('form');
1203
+ if ( ! jQuery($form)[0].checkValidity()) {
1204
+ Swal.showValidationMessage('<?php echo esc_html__( 'Please select option', $this->plugin ); ?>');
1205
+ return;
1206
  }
 
1207
 
1208
+ var poll_options = $form.find("input[name='feedback_data[poll_options]']:checked").val();
1209
+ var message = $form.find("#ig-feedback-data-poll-additional-message").val();
1210
 
1211
+ var data = {
1212
+ poll_option: poll_options,
1213
+ additional_feedback: message
1214
+ };
1215
 
1216
+ var meta = {};
 
 
 
 
 
 
 
 
1217
 
1218
+ return doSend(data);
1219
  }
1220
+ },
1221
 
1222
+ ]).then(response => {
1223
 
1224
+ if (response.hasOwnProperty('value')) {
1225
 
1226
+ Swal.fire({
1227
+ type: 'success',
1228
+ width: <?php echo esc_js( $params['width'] ); ?>,
1229
+ title: '<?php echo esc_attr__( 'Thank You!', $this->plugin ); ?>',
1230
+ showConfirmButton: false,
1231
+ position: '<?php echo esc_js( $params['position'] ); ?>',
1232
+ timer: 1500,
1233
+ animation: false
1234
+ });
1235
 
1236
+ }
1237
+ });
1238
+ });
1239
 
1240
+ </script>
1241
  <?php
1242
  }
1243
 
1276
  $event = $this->event_prefix . 'plugin.deactivation';
1277
 
1278
  ?>
1279
+ <script type="text/javascript">
1280
  jQuery(function ($) {
1281
+ var $deactivateLink = $('#the-list').find('[data-slug="<?php echo esc_js( $this->plugin ); ?>"] span.deactivate a'),
1282
+ $overlay = $('#ig-deactivate-survey-<?php echo esc_js( $this->plugin ); ?>'),
1283
  $form = $overlay.find('form'),
1284
  formOpen = false,
1285
+ consent = $('#ig-deactivate-survey-help-consent-<?php echo esc_js( $this->plugin ); ?>');
1286
 
1287
  function togglePersonalInfoFields(show) {
1288
 
1339
  // Survey Skip & Deactivate.
1340
  $form.on('click', '.ig-deactivate-survey-deactivate', function (event) {
1341
  event.preventDefault();
1342
+ let deactivationURL = $deactivateLink.attr('href');
1343
  let skipSurveyURL = deactivationURL + '&survey_status=skipped';
1344
  location.href = skipSurveyURL;
1345
  });
1384
  };
1385
 
1386
  var data = {
1387
+ action: '<?php echo esc_js( $this->ajax_action ); ?>',
1388
  feedback: {
1389
  type: 'radio',
1390
+ title: '<?php echo esc_js( $title ); ?>',
1391
+ slug: '<?php echo esc_js( $slug ); ?>',
1392
  value: $form.find('.selected input[type=radio]').attr('data-option-slug'),
1393
  details: $form.find('.selected input[type=text]').val()
1394
  },
1395
 
1396
+ event: '<?php echo esc_js( $event ); ?>',
1397
 
1398
  // Add additional information
1399
  misc: {
1400
+ plugin: '<?php echo esc_js( $this->plugin ); ?>',
1401
+ plugin_abbr: '<?php echo esc_js( $this->plugin_abbr ); ?>',
1402
+ is_dev_mode: '<?php echo esc_js( $this->is_dev_mode ); ?>',
1403
  set_cookie: '',
1404
  meta_info: meta,
1405
  system_info: system_info
1406
+ },
1407
+ security: '<?php echo esc_js( wp_create_nonce( $this->plugin_abbr . '-admin-ajax-nonce' ) ); ?>'
1408
  };
1409
 
1410
  var submitSurvey = $.post(ajaxurl, data);
1421
  }
1422
  });
1423
  });
1424
+ </script>
1425
  <?php
1426
  }
1427
 
1436
  return;
1437
  }
1438
  ?>
1439
+ <style type="text/css">
1440
+ .ig-deactivate-survey-modal {
1441
+ display: none;
1442
+ table-layout: fixed;
1443
+ position: fixed;
1444
+ z-index: 9999;
1445
+ width: 100%;
1446
+ height: 100%;
1447
+ text-align: center;
1448
+ font-size: 14px;
1449
+ top: 0;
1450
+ left: 0;
1451
+ background: rgba(0, 0, 0, 0.8);
1452
+ }
1453
+
1454
+ .ig-deactivate-survey-wrap {
1455
+ display: table-cell;
1456
+ vertical-align: middle;
1457
+ }
1458
+
1459
+ .ig-deactivate-survey {
1460
+ background-color: #fff;
1461
+ max-width: 550px;
1462
+ margin: 0 auto;
1463
+ padding: 30px;
1464
+ text-align: left;
1465
+ }
1466
+
1467
+ .ig-deactivate-survey .error {
1468
+ display: block;
1469
+ color: red;
1470
+ margin: 0 0 10px 0;
1471
+ }
1472
+
1473
+ .ig-deactivate-survey-title {
1474
+ display: block;
1475
+ font-size: 18px;
1476
+ font-weight: 700;
1477
+ text-transform: uppercase;
1478
+ border-bottom: 1px solid #ddd;
1479
+ padding: 0 0 18px 0;
1480
+ margin: 0 0 18px 0;
1481
+ }
1482
+
1483
+ .ig-deactivate-survey-options {
1484
+ border-bottom: 1px solid #ddd;
1485
+ padding: 0 0 18px 0;
1486
+ margin: 0 0 18px 0;
1487
+ }
1488
+
1489
+ .ig-deactivate-survey-info-data {
1490
+ padding: 0 0 18px 0;
1491
+ margin: 10px 10px 10px 30px;
1492
+ }
1493
+
1494
+ .ig-deactivate-survey-info-name, .ig-deactivate-survey-info-email-address {
1495
+ width: 230px;
1496
+ margin: 10px;
1497
+ }
1498
+
1499
+ .ig-deactivate-survey-title span {
1500
+ color: #999;
1501
+ margin-right: 10px;
1502
+ }
1503
+
1504
+ .ig-deactivate-survey-desc {
1505
+ display: block;
1506
+ font-weight: 600;
1507
+ margin: 0 0 18px 0;
1508
+ }
1509
+
1510
+ .ig-deactivate-survey-option {
1511
+ margin: 0 0 10px 0;
1512
+ }
1513
+
1514
+ .ig-deactivate-survey-option-input {
1515
+ margin-right: 10px !important;
1516
+ }
1517
+
1518
+ .ig-deactivate-survey-option-details {
1519
+ display: none;
1520
+ width: 90%;
1521
+ margin: 10px 0 0 30px;
1522
+ }
1523
+
1524
+ .ig-deactivate-survey-footer {
1525
+ margin-top: 18px;
1526
+ }
1527
+
1528
+ .ig-deactivate-survey-deactivate {
1529
+ float: right;
1530
+ font-size: 13px;
1531
+ color: #ccc;
1532
+ text-decoration: none;
1533
+ padding-top: 7px;
1534
+ }
1535
+
1536
+ .ig-deactivate-survey-loader {
1537
+ vertical-align: middle;
1538
+ padding: 10px;
1539
+ }
1540
+ </style>
1541
  <?php
1542
  }
1543
 
1557
  $options = array(
1558
  1 => array(
1559
  'title' => esc_html__( 'I no longer need the plugin', $this->plugin ),
1560
+ 'slug' => 'i-no-longer-need-the-plugin',
1561
  ),
1562
  2 => array(
1563
  'title' => esc_html__( 'I\'m switching to a different plugin', $this->plugin ),
1566
  ),
1567
  3 => array(
1568
  'title' => esc_html__( 'I couldn\'t get the plugin to work', $this->plugin ),
1569
+ 'slug' => 'i-could-not-get-the-plugin-to-work',
1570
  ),
1571
  4 => array(
1572
  'title' => esc_html__( 'It\'s a temporary deactivation', $this->plugin ),
1573
+ 'slug' => 'it-is-a-temporary-deactivation',
1574
  ),
1575
  5 => array(
1576
  'title' => esc_html__( 'Other', $this->plugin ),
1579
  ),
1580
  );
1581
  ?>
1582
+ <div class="ig-deactivate-survey-modal" id="ig-deactivate-survey-<?php echo esc_js( $this->plugin ); ?>">
1583
+ <div class="ig-deactivate-survey-wrap">
1584
+ <form class="ig-deactivate-survey" method="post">
1585
+ <span class="ig-deactivate-survey-title"><span class="dashicons dashicons-testimonial"></span><?php echo ' ' . esc_html__( 'Quick Feedback', $this->plugin ); ?></span>
1586
+ <span class="ig-deactivate-survey-desc"><?php echo esc_html__( sprintf( 'If you have a moment, please share why you are deactivating %s:', $this->name ), $this->plugin ); ?></span>
1587
+ <div class="ig-deactivate-survey-options">
1588
  <?php foreach ( $options as $id => $option ) : ?>
1589
+ <div class="ig-deactivate-survey-option">
1590
+ <label for="ig-deactivate-survey-option-<?php echo esc_attr( $this->plugin ); ?>-<?php echo esc_attr( $id ); ?>" class="ig-deactivate-survey-option-label">
1591
+ <input id="ig-deactivate-survey-option-<?php echo esc_attr( $this->plugin ); ?>-<?php echo esc_attr( $id ); ?>" class="ig-deactivate-survey-option-input" type="radio" name="code" value="<?php echo esc_attr( $id ); ?>" data-option-slug="<?php echo esc_attr( $option['slug'] ); ?>"/>
1592
+ <span class="ig-deactivate-survey-option-reason"><?php echo esc_attr( $option['title'] ); ?></span>
1593
+ </label>
1594
  <?php if ( ! empty( $option['details'] ) ) : ?>
1595
+ <input class="ig-deactivate-survey-option-details" type="text" placeholder="<?php echo esc_attr( $option['details'] ); ?>"/>
1596
  <?php endif; ?>
1597
+ </div>
1598
  <?php endforeach; ?>
1599
+ </div>
1600
+ <div class="ig-deactivate-survey-help-consent">
1601
+ <input id="ig-deactivate-survey-help-consent-<?php echo esc_attr( $this->plugin ); ?>" class="ig-deactivate-survey-option-input" type="checkbox" name="code" data-option-slug="<?php echo esc_attr( $option['slug'] ); ?>"/><b><?php echo esc_html__( 'Yes, I give my consent to track plugin usage and contact me back to make this plugin works!', $this->plugin ); ?></b>
1602
+ </div>
1603
+ <div class="ig-deactivate-survey-info-data">
1604
+
1605
+ <input type="text" class="ig-deactivate-survey-info-name" id="ig-deactivate-survey-info-name" placeholder="Enter Name" name="ig-deactivate-survey-info-name" value=""/>
1606
+ <input type="text" class="ig-deactivate-survey-info-email-address" id="ig-deactivate-survey-info-email-address" name="ig-deactivate-survey-info-email-address" value="<?php echo esc_js( $email ); ?>"/>
1607
+ </div>
1608
+ <div class="ig-deactivate-survey-footer">
1609
+ <button type="submit" class="ig-deactivate-survey-submit button button-primary button-large"><?php echo sprintf( esc_html__( 'Submit %s Deactivate', $this->plugin ), '&amp;' ); ?></button>
1610
+ <img class="ig-deactivate-survey-loader" id="ig-deactivate-survey-loader" src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>/assets/images/loading.gif"/>
1611
+ <a href="#" class="ig-deactivate-survey-deactivate"><?php echo sprintf( esc_html__( 'Skip %s Deactivate', $this->plugin ), '&amp;' ); ?></a>
1612
+ </div>
1613
+ </form>
1614
+ </div>
1615
+ </div>
1616
  <?php
1617
  }
1618
 
1808
  * Set event into transient
1809
  *
1810
  * @param $event
1811
+ * @param int $expiry in days
1812
  */
1813
  public function set_event_transient( $event, $expiry = 45 ) {
1814
  set_transient( $event, 1, time() + ( 86400 * $expiry ) );
1857
  *
1858
  * Send feedback to server
1859
  */
1860
+ public function submit_feedback() {
1861
+
1862
+ check_ajax_referer( $this->plugin_abbr . '-admin-ajax-nonce', 'security' );
1863
 
1864
  $data = ! empty( $_POST ) ? $_POST : array();
1865
 
1878
  'plugin' => sanitize_key( $plugin ),
1879
  'locale' => get_locale(),
1880
  'wp_version' => get_bloginfo( 'version' ),
1881
+ 'php_version' => PHP_VERSION,
1882
  );
1883
 
1884
  $meta_info = wp_parse_args( $meta_info, $default_meta_info );
1898
  'timeout' => 15,
1899
  'sslverify' => false,
1900
  'body' => $data,
1901
+ 'blocking' => false,
1902
  );
1903
 
1904
  $this->set_feedback_data( $plugin_abbr, $data['event'], $data['feedback'] );
1908
  $this->set_event_transient( $data['event'] );
1909
  }
1910
 
1911
+ $response = wp_remote_post( $this->get_api_url( $is_dev_mode ), $args );
 
1912
  $result['status'] = 'success';
1913
  if ( $response instanceof WP_Error ) {
1914
  $error_message = $response->get_error_message();
1918
 
1919
  die( json_encode( $result ) );
1920
  }
1921
+
1922
+ /**
1923
+ * Get list of tags allowed in escaping
1924
+ *
1925
+ * @return array $ig_es_escape_allowed_tags
1926
+ */
1927
+ public function get_escape_allowed_tags() {
1928
+ $ig_escape_allowed_tags = apply_filters( $this->plugin_abbr . '_escape_allowed_tags', array() );
1929
+ return $ig_escape_allowed_tags;
1930
+ }
1931
+
1932
+ /**
1933
+ * Render Quick Feedback Widget
1934
+ *
1935
+ * @param $params
1936
+ *
1937
+ * @since 4.1.0
1938
+ */
1939
+ public function render_feedback_widget( $params ) {
1940
+
1941
+ if ( ! $this->can_show_feedback_widget() ) {
1942
+ return;
1943
+ }
1944
+
1945
+ $default_params = array(
1946
+ 'set_transient' => true,
1947
+ 'force' => false,
1948
+ 'show_once' => false,
1949
+ );
1950
+
1951
+ $params = wp_parse_args( $params, $default_params );
1952
+
1953
+ if ( ! empty( $params['event'] ) ) {
1954
+
1955
+ $event = $this->event_prefix . $params['event'];
1956
+ $force = ! empty( $params['force'] ) ? $params['force'] : false;
1957
+
1958
+ $can_show = false;
1959
+
1960
+ if ( $force ) {
1961
+ $can_show = true;
1962
+ } else {
1963
+ if ( ! $this->is_event_transient_set( $event ) ) {
1964
+ $can_show = true;
1965
+
1966
+ $feedback_data = $this->get_event_feedback_data( $this->plugin_abbr, $event );
1967
+ if ( count( $feedback_data ) > 0 ) {
1968
+ $show_once = $params['show_once'];
1969
+ $feedback_data = array_reverse( $feedback_data );
1970
+ $last_feedback_given_on = $feedback_data[0]['created_on'];
1971
+
1972
+ // If event feedback given within 45 days or show event only once?
1973
+ // Don't show now
1974
+ if ( $show_once || ( strtotime( $last_feedback_given_on ) > strtotime( '-45 days' ) ) ) {
1975
+ $can_show = false;
1976
+ }
1977
+ }
1978
+ }
1979
+ }
1980
+
1981
+ if ( $can_show ) {
1982
+ if ( 'star' === $params['type'] ) {
1983
+ $this->render_stars( $params );
1984
+ } elseif ( 'emoji' === $params['type'] ) {
1985
+ $this->render_emoji( $params );
1986
+ } elseif ( 'feedback' === $params['type'] ) {
1987
+ $this->render_general_feedback( $params );
1988
+ } elseif ( 'fb' === $params['type'] ) {
1989
+ /**
1990
+ * We are not calling home for this event and we want to show
1991
+ * this Widget only once. So, we are storing feedback data now.
1992
+ */
1993
+ $this->set_feedback_data( $this->plugin_abbr, $event );
1994
+ $this->render_fb_widget( $params );
1995
+ } elseif ( 'poll' === $params['type'] ) {
1996
+ if ( $params['show_once'] ) {
1997
+ $this->set_feedback_data( $this->plugin_abbr, $event );
1998
+ }
1999
+ $this->render_poll_widget( $params );
2000
+ }
2001
+ }
2002
+ }
2003
+
2004
+ }
2005
  }
2006
  } // End if().
lite/classes/feedback/class-ig-tracker.php CHANGED
@@ -4,15 +4,15 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
- if ( ! class_exists( 'IG_Tracker_V_1_2_3' ) ) {
8
 
9
  /**
10
- * Class IG_Tracker_V_1_2_3
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
- * @class IG_Tracker_V_1_2_3
16
  * @since 1.0.0
17
  *
18
  * @copyright Copyright (c) 2019, Icegram
@@ -20,7 +20,7 @@ if ( ! class_exists( 'IG_Tracker_V_1_2_3' ) ) {
20
  * @author Icegram
21
  * @package feedback
22
  */
23
- class IG_Tracker_V_1_2_3 {
24
 
25
 
26
 
4
  exit; // Exit if accessed directly.
5
  }
6
 
7
+ if ( ! class_exists( 'IG_Tracker_V_1_2_8' ) ) {
8
 
9
  /**
10
+ * Class IG_Tracker_V_1_2_8
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
+ * @class IG_Tracker_V_1_2_8
16
  * @since 1.0.0
17
  *
18
  * @copyright Copyright (c) 2019, Icegram
20
  * @author Icegram
21
  * @package feedback
22
  */
23
+ class IG_Tracker_V_1_2_8 {
24
 
25
 
26
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: icegram, storeapps, niravmehta, sandhyam, malayladu, putler, kisha
3
  Donate link: https://www.icegram.com/
4
  Tags: popup, optin, hellobar, lead capture, form
5
  Requires at least: 3.9
6
- Tested up to: 6.0.1
7
- Stable tag: 3.0.7
8
  License: GPLv3
9
 
10
  The best WordPress popup plugin that lets you create popups and action bars within seconds. Customize exit-intent popup campaigns, action bars, badges, stickies, inline optin, fullscreen overlay, ribbons, sidebar panel and more in no time.
@@ -458,12 +458,16 @@ Contact Us, provide as much detail of the problem as you can. We will try to sol
458
 
459
  == Upgrade Notice ==
460
 
461
- = 3.0.7 =
462
 
463
- * New: Added content locker setting for campaigns
464
 
465
  == Changelog ==
466
 
 
 
 
 
467
  **3.0.7 (08.09.2022)**
468
 
469
  * New: Added content locker setting for campaigns
3
  Donate link: https://www.icegram.com/
4
  Tags: popup, optin, hellobar, lead capture, form
5
  Requires at least: 3.9
6
+ Tested up to: 6.0.2
7
+ Stable tag: 3.0.8
8
  License: GPLv3
9
 
10
  The best WordPress popup plugin that lets you create popups and action bars within seconds. Customize exit-intent popup campaigns, action bars, badges, stickies, inline optin, fullscreen overlay, ribbons, sidebar panel and more in no time.
458
 
459
  == Upgrade Notice ==
460
 
461
+ = 3.0.8 =
462
 
463
+ * New: Target campaigns to any post with "Where" conditions
464
 
465
  == Changelog ==
466
 
467
+ **3.0.8 (15.09.2022)**
468
+
469
+ * New: Target campaigns to any post with "Where" conditions
470
+
471
  **3.0.7 (08.09.2022)**
472
 
473
  * New: Added content locker setting for campaigns