WooCommerce Cart Abandonment Recovery - Version 1.2.4

Version Description

Download this release

Release Info

Developer rohitrpatil
Plugin Icon 128x128 WooCommerce Cart Abandonment Recovery
Version 1.2.4
Comparing to
See all releases

Code changes from version 1.2.3 to 1.2.4

admin/assets/css/admin-cart-abandonment-rtl.css CHANGED
@@ -107,8 +107,9 @@
107
 
108
  .wcf-ca-report-btn {
109
  padding: 15px 0px 15px 0px;
110
- display: table;
111
  width: 100%;
 
112
  }
113
 
114
  .wcf-ca-email-inputs {
@@ -128,11 +129,23 @@
128
  }
129
 
130
  .wcf-ca-left-report-field-group {
131
- display: table-cell; text-align: right;
 
132
  }
133
  .wcf-ca-right-report-field-group {
134
- display: table-cell; text-align: left;
 
 
 
 
 
135
  }
 
 
 
 
 
 
136
  .wcf-ca-report-table-row {
137
  color: #636363;
138
  border: 1px solid #e5e5e5;
@@ -411,3 +424,7 @@
411
  font-weight: bold;
412
  }
413
 
 
 
 
 
107
 
108
  .wcf-ca-report-btn {
109
  padding: 15px 0px 15px 0px;
110
+ display: flex;
111
  width: 100%;
112
+ position: relative;
113
  }
114
 
115
  .wcf-ca-email-inputs {
129
  }
130
 
131
  .wcf-ca-left-report-field-group {
132
+ flex: 1;
133
+ margin-top: 0px;
134
  }
135
  .wcf-ca-right-report-field-group {
136
+ flex: 1;
137
+ text-align: left;
138
+
139
+ }
140
+ .wcf-search-orders{
141
+ display: inline-block;
142
  }
143
+ .wcf_export_orders{
144
+ display: inline-block;
145
+ vertical-align: bottom;
146
+ padding-right: 5px;
147
+ }
148
+
149
  .wcf-ca-report-table-row {
150
  color: #636363;
151
  border: 1px solid #e5e5e5;
424
  font-weight: bold;
425
  }
426
 
427
+ .wcf-ca-export-icon{
428
+ line-height: 1.8;
429
+ font-size:17px;
430
+ }
admin/assets/css/admin-cart-abandonment.css CHANGED
@@ -107,8 +107,9 @@
107
 
108
  .wcf-ca-report-btn {
109
  padding: 15px 0px 15px 0px;
110
- display: table;
111
  width: 100%;
 
112
  }
113
 
114
  .wcf-ca-email-inputs {
@@ -128,11 +129,23 @@
128
  }
129
 
130
  .wcf-ca-left-report-field-group {
131
- display: table-cell; text-align: left;
 
132
  }
133
  .wcf-ca-right-report-field-group {
134
- display: table-cell; text-align: right;
 
 
 
 
 
135
  }
 
 
 
 
 
 
136
  .wcf-ca-report-table-row {
137
  color: #636363;
138
  border: 1px solid #e5e5e5;
@@ -411,3 +424,7 @@
411
  font-weight: bold;
412
  }
413
 
 
 
 
 
107
 
108
  .wcf-ca-report-btn {
109
  padding: 15px 0px 15px 0px;
110
+ display: flex;
111
  width: 100%;
112
+ position: relative;
113
  }
114
 
115
  .wcf-ca-email-inputs {
129
  }
130
 
131
  .wcf-ca-left-report-field-group {
132
+ flex: 1;
133
+ margin-top: 0px;
134
  }
135
  .wcf-ca-right-report-field-group {
136
+ flex: 1;
137
+ text-align: right;
138
+
139
+ }
140
+ .wcf-search-orders{
141
+ display: inline-block;
142
  }
143
+ .wcf_export_orders{
144
+ display: inline-block;
145
+ vertical-align: bottom;
146
+ padding-left: 5px;
147
+ }
148
+
149
  .wcf-ca-report-table-row {
150
  color: #636363;
151
  border: 1px solid #e5e5e5;
424
  font-weight: bold;
425
  }
426
 
427
+ .wcf-ca-export-icon{
428
+ line-height: 1.8;
429
+ font-size:17px;
430
+ }
admin/assets/js/admin-email-templates.js CHANGED
@@ -29,6 +29,11 @@
29
 
30
  });
31
 
 
 
 
 
 
32
  // Hide initially.
33
  $("#wcf_ca_discount_type, #wcf_ca_coupon_amount, #wcf_ca_coupon_expiry, #wcf_ca_zapier_cart_abandoned_webhook, #wcf_ca_coupon_code_status, #wcf_ca_gdpr_message").closest('tr').hide();
34
 
@@ -93,7 +98,7 @@
93
  $(document).on('click', '#wcf_preview_email', EmailTemplatesAdmin.send_test_email);
94
  $(document).on('click', '.wcf-ca-switch.wcf-toggle-template-status', EmailTemplatesAdmin.toggle_activate_template);
95
  $(document).on('click', '#wcf_ca_delete_coupons', EmailTemplatesAdmin.delete_coupons);
96
-
97
  $(document).on('click', '.wcar-switch-grid', EmailTemplatesAdmin.toggle_activate_template_on_grid);
98
  var coupon_child_fields = "#wcf_email_discount_type, #wcf_email_discount_amount, #wcf_email_coupon_expiry_date, #wcf_free_shipping_coupon, #wcf_auto_coupon_apply, #wcf_individual_use_only";
99
  $(coupon_child_fields).closest('tr').toggle($("#wcf_override_global_coupon").is(":checked"));
@@ -131,7 +136,7 @@
131
  email_body: email_body,
132
  email_send_to: email_send_to,
133
  action: 'wcf_ca_preview_email_send',
134
- security: wp_nonce
135
  };
136
  $("#wcf_preview_email").css('cursor', 'wait').attr("disabled", true);
137
 
@@ -158,13 +163,10 @@
158
  },
159
 
160
  delete_coupons: function () {
161
- var msg = wcf_ca_delete_coupons._confirm_msg;
162
- var show_msg = confirm(msg);
163
- if (show_msg == true) {
164
- var nonce = wcf_ca_delete_coupons._delete_coupon_nonce
165
  var data = {
166
  action: 'wcf_ca_delete_garbage_coupons',
167
- security: nonce
168
  };
169
  $('.wcf-ca-spinner').show();
170
 
@@ -183,21 +185,23 @@
183
  );
184
  }
185
  },
186
-
187
-
 
 
 
188
  toggle_activate_template_on_grid: function () {
189
  var $switch, state, new_state;
190
  $switch = $(this);
191
  state = $switch.attr('wcf-ca-template-switch');
192
  var css = (state === 'on') ? 'green' : 'red';
193
- var nonce = wcf_ca_details.email_toggle_button_nonce;
194
 
195
  $.post(
196
  ajaxurl, {
197
  action: 'activate_email_templates',
198
  id: $(this).attr('id'),
199
  state: state,
200
- security: nonce
201
  }, function (response) {
202
 
203
  $("#wcf_activate_email_template").val(new_state == 'on' ? 1 : 0);
@@ -282,9 +286,7 @@
282
  $(".wcf-ca-report-table-row .wcf-ca-icon-row").hover(function(){
283
  $(this).find('.wcf-ca-tooltip-text').toggleClass("display_tool_tip");
284
  });
285
- },
286
-
287
-
288
  }
289
 
290
  $(document).ready(
29
 
30
  });
31
 
32
+ $("#wcf_search_id_submit").click( function () {
33
+ var search = $("#wcf_search_id_search_input").val().trim();
34
+ window.location.href = window.location.search + "&search_term=" + search;
35
+ } );
36
+
37
  // Hide initially.
38
  $("#wcf_ca_discount_type, #wcf_ca_coupon_amount, #wcf_ca_coupon_expiry, #wcf_ca_zapier_cart_abandoned_webhook, #wcf_ca_coupon_code_status, #wcf_ca_gdpr_message").closest('tr').hide();
39
 
98
  $(document).on('click', '#wcf_preview_email', EmailTemplatesAdmin.send_test_email);
99
  $(document).on('click', '.wcf-ca-switch.wcf-toggle-template-status', EmailTemplatesAdmin.toggle_activate_template);
100
  $(document).on('click', '#wcf_ca_delete_coupons', EmailTemplatesAdmin.delete_coupons);
101
+ $(document).on('click', '#wcf_ca_export_orders', EmailTemplatesAdmin.export_orders);
102
  $(document).on('click', '.wcar-switch-grid', EmailTemplatesAdmin.toggle_activate_template_on_grid);
103
  var coupon_child_fields = "#wcf_email_discount_type, #wcf_email_discount_amount, #wcf_email_coupon_expiry_date, #wcf_free_shipping_coupon, #wcf_auto_coupon_apply, #wcf_individual_use_only";
104
  $(coupon_child_fields).closest('tr').toggle($("#wcf_override_global_coupon").is(":checked"));
136
  email_body: email_body,
137
  email_send_to: email_send_to,
138
  action: 'wcf_ca_preview_email_send',
139
+ security: wp_nonce,
140
  };
141
  $("#wcf_preview_email").css('cursor', 'wait').attr("disabled", true);
142
 
163
  },
164
 
165
  delete_coupons: function () {
166
+ if (confirm(wcf_ca_localized_vars._confirm_msg)) {
 
 
 
167
  var data = {
168
  action: 'wcf_ca_delete_garbage_coupons',
169
+ security: wcf_ca_localized_vars._delete_coupon_nonce
170
  };
171
  $('.wcf-ca-spinner').show();
172
 
185
  );
186
  }
187
  },
188
+ export_orders: function () {
189
+ if( confirm( wcf_ca_localized_vars._confirm_msg_export ) ) {
190
+ window.location.href = window.location.search + "&export_data=true";
191
+ }
192
+ },
193
  toggle_activate_template_on_grid: function () {
194
  var $switch, state, new_state;
195
  $switch = $(this);
196
  state = $switch.attr('wcf-ca-template-switch');
197
  var css = (state === 'on') ? 'green' : 'red';
 
198
 
199
  $.post(
200
  ajaxurl, {
201
  action: 'activate_email_templates',
202
  id: $(this).attr('id'),
203
  state: state,
204
+ security: wcf_ca_details.email_toggle_button_nonce
205
  }, function (response) {
206
 
207
  $("#wcf_activate_email_template").val(new_state == 'on' ? 1 : 0);
286
  $(".wcf-ca-report-table-row .wcf-ca-icon-row").hover(function(){
287
  $(this).find('.wcf-ca-tooltip-text').toggleClass("display_tool_tip");
288
  });
289
+ },
 
 
290
  }
291
 
292
  $(document).ready(
assets/images/hoodie.jpg CHANGED
File without changes
assets/images/polo.jpg CHANGED
File without changes
changelog.txt CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  Version 1.2.3 - Thursday, 12th December 2019
2
  - New: Added option to unsubscribe users in bulk.
3
  - New: Added filter 'woo_ca_exclude_on_hold_order_from_tracking' to exclude on hold orders from the tracking.
1
+ Version 1.2.4 - Thursday, 06th February 2020
2
+ - New: Added option to export abandoned orders.
3
+ - New: Added option to search abandoned orders.
4
+ - Improvement: Compatibility with the latest WordPress PHP_CodeSniffer rules.
5
+ - Fix: Get id error while sending emails.
6
+
7
  Version 1.2.3 - Thursday, 12th December 2019
8
  - New: Added option to unsubscribe users in bulk.
9
  - New: Added filter 'woo_ca_exclude_on_hold_order_from_tracking' to exclude on hold orders from the tracking.
classes/class-cartflows-ca-loader.php CHANGED
@@ -35,7 +35,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
35
 
36
  if ( is_null( self::$instance ) ) {
37
 
38
- self::$instance = new self;
39
 
40
  /**
41
  * CartFlows CA loaded.
@@ -78,7 +78,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
78
  define( 'CARTFLOWS_CA_BASE', plugin_basename( CARTFLOWS_CA_FILE ) );
79
  define( 'CARTFLOWS_CA_DIR', plugin_dir_path( CARTFLOWS_CA_FILE ) );
80
  define( 'CARTFLOWS_CA_URL', plugins_url( '/', CARTFLOWS_CA_FILE ) );
81
- define( 'CARTFLOWS_CA_VER', '1.2.3' );
82
  define( 'CARTFLOWS_CA_SLUG', 'cartflows_ca' );
83
 
84
  define( 'CARTFLOWS_CA_CART_ABANDONMENT_TABLE', 'cartflows_ca_cart_abandonment' );
@@ -94,7 +94,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
94
  *
95
  * @return void
96
  */
97
- function load_plugin() {
98
 
99
  if ( ! function_exists( 'WC' ) ) {
100
  add_action( 'admin_notices', array( $this, 'fails_to_load' ) );
@@ -133,8 +133,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
133
  $class = 'notice notice-error';
134
  /* translators: %s: html tags */
135
  $message = sprintf( __( 'The %1$sWooCommerce Cart Abandonment Recovery%2$s plugin requires %1$sWooCommerce%2$s plugin installed & activated.', 'woo-cart-abandonment-recovery' ), '<strong>', '</strong>' );
136
-
137
- $plugin = 'woocommerce/woocommerce.php';
138
 
139
  if ( $this->is_woo_installed() ) {
140
  if ( ! current_user_can( 'activate_plugins' ) ) {
@@ -155,7 +154,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
155
 
156
  $button = '<p><a href="' . $action_url . '" class="button-primary">' . $button_label . '</a></p><p></p>';
157
 
158
- printf( '<div class="%1$s"><p>%2$s</p>%3$s</div>', esc_attr( $class ), $message, $button );
159
  }
160
 
161
 
@@ -166,7 +165,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
166
  *
167
  * @access public
168
  */
169
- function is_woo_installed() {
170
 
171
  $path = 'woocommerce/woocommerce.php';
172
  $plugins = get_plugins();
@@ -181,7 +180,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
181
  *
182
  * @return void
183
  */
184
- function initialize_cart_abandonment_tables() {
185
 
186
  include_once CARTFLOWS_CA_DIR . 'modules/cart-abandonment/class-cartflows-ca-cart-abandonment-db.php';
187
  $db = Cartflows_Ca_Cart_Abandonment_Db::get_instance();
@@ -197,7 +196,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
197
  *
198
  * @return void
199
  */
200
- function load_helper_files_components() {
201
 
202
  include_once CARTFLOWS_CA_DIR . 'classes/class-cartflows-ca-utils.php';
203
  $this->utils = Cartflows_Ca_Utils::get_instance();
@@ -206,7 +205,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
206
  /**
207
  * Load core files.
208
  */
209
- function load_core_files() {
210
  /* Update compatibility. */
211
  require_once CARTFLOWS_CA_DIR . 'classes/class-cartflows-ca-update.php';
212
 
@@ -275,7 +274,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
275
  *
276
  * @return void
277
  */
278
- function load_core_components() {
279
 
280
  /* Cart abandonment templates class */
281
  include_once CARTFLOWS_CA_DIR . 'modules/cart-abandonment/class-cartflows-ca-module-loader.php';
@@ -286,7 +285,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
286
  /**
287
  * Activation Reset
288
  */
289
- function activation_reset() {
290
  $this->update_default_settings();
291
  $this->initialize_cart_abandonment_tables();
292
  }
@@ -295,7 +294,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
295
  /**
296
  * Set the default cart abandonment settings.
297
  */
298
- function update_default_settings() {
299
 
300
  $current_user = wp_get_current_user();
301
  $email_from = ( isset( $current_user->user_firstname ) && ! empty( $current_user->user_firstname ) ) ? $current_user->user_firstname . ' ' . $current_user->user_lastname : 'Admin';
@@ -326,7 +325,7 @@ if ( ! class_exists( 'CARTFLOWS_CA_Loader' ) ) {
326
  /**
327
  * Deactivation Reset
328
  */
329
- function deactivation_reset() {
330
  wp_clear_scheduled_hook( 'cartflows_ca_update_order_status_action' );
331
  }
332
  }
35
 
36
  if ( is_null( self::$instance ) ) {
37
 
38
+ self::$instance = new self();
39
 
40
  /**
41
  * CartFlows CA loaded.
78
  define( 'CARTFLOWS_CA_BASE', plugin_basename( CARTFLOWS_CA_FILE ) );
79
  define( 'CARTFLOWS_CA_DIR', plugin_dir_path( CARTFLOWS_CA_FILE ) );
80
  define( 'CARTFLOWS_CA_URL', plugins_url( '/', CARTFLOWS_CA_FILE ) );
81
+ define( 'CARTFLOWS_CA_VER', '1.2.4' );
82
  define( 'CARTFLOWS_CA_SLUG', 'cartflows_ca' );
83
 
84
  define( 'CARTFLOWS_CA_CART_ABANDONMENT_TABLE', 'cartflows_ca_cart_abandonment' );
94
  *
95
  * @return void
96
  */
97
+ public function load_plugin() {
98
 
99
  if ( ! function_exists( 'WC' ) ) {
100
  add_action( 'admin_notices', array( $this, 'fails_to_load' ) );
133
  $class = 'notice notice-error';
134
  /* translators: %s: html tags */
135
  $message = sprintf( __( 'The %1$sWooCommerce Cart Abandonment Recovery%2$s plugin requires %1$sWooCommerce%2$s plugin installed & activated.', 'woo-cart-abandonment-recovery' ), '<strong>', '</strong>' );
136
+ $plugin = 'woocommerce/woocommerce.php';
 
137
 
138
  if ( $this->is_woo_installed() ) {
139
  if ( ! current_user_can( 'activate_plugins' ) ) {
154
 
155
  $button = '<p><a href="' . $action_url . '" class="button-primary">' . $button_label . '</a></p><p></p>';
156
 
157
+ printf( '<div class="%1$s"><p>%2$s</p>%3$s</div>', esc_attr( $class ), wp_kses_post( $message ), wp_kses_post( $button ) );
158
  }
159
 
160
 
165
  *
166
  * @access public
167
  */
168
+ public function is_woo_installed() {
169
 
170
  $path = 'woocommerce/woocommerce.php';
171
  $plugins = get_plugins();
180
  *
181
  * @return void
182
  */
183
+ public function initialize_cart_abandonment_tables() {
184
 
185
  include_once CARTFLOWS_CA_DIR . 'modules/cart-abandonment/class-cartflows-ca-cart-abandonment-db.php';
186
  $db = Cartflows_Ca_Cart_Abandonment_Db::get_instance();
196
  *
197
  * @return void
198
  */
199
+ public function load_helper_files_components() {
200
 
201
  include_once CARTFLOWS_CA_DIR . 'classes/class-cartflows-ca-utils.php';
202
  $this->utils = Cartflows_Ca_Utils::get_instance();
205
  /**
206
  * Load core files.
207
  */
208
+ public function load_core_files() {
209
  /* Update compatibility. */
210
  require_once CARTFLOWS_CA_DIR . 'classes/class-cartflows-ca-update.php';
211
 
274
  *
275
  * @return void
276
  */
277
+ public function load_core_components() {
278
 
279
  /* Cart abandonment templates class */
280
  include_once CARTFLOWS_CA_DIR . 'modules/cart-abandonment/class-cartflows-ca-module-loader.php';
285
  /**
286
  * Activation Reset
287
  */
288
+ public function activation_reset() {
289
  $this->update_default_settings();
290
  $this->initialize_cart_abandonment_tables();
291
  }
294
  /**
295
  * Set the default cart abandonment settings.
296
  */
297
+ public function update_default_settings() {
298
 
299
  $current_user = wp_get_current_user();
300
  $email_from = ( isset( $current_user->user_firstname ) && ! empty( $current_user->user_firstname ) ) ? $current_user->user_firstname . ' ' . $current_user->user_lastname : 'Admin';
325
  /**
326
  * Deactivation Reset
327
  */
328
+ public function deactivation_reset() {
329
  wp_clear_scheduled_hook( 'cartflows_ca_update_order_status_action' );
330
  }
331
  }
classes/class-cartflows-ca-settings.php CHANGED
@@ -46,7 +46,7 @@ class Cartflows_Ca_Settings {
46
  *
47
  * @since 1.1.5
48
  */
49
- function wcf_initialize_settings() {
50
 
51
  // Start: Settings for cart abandonment.
52
  add_settings_section(
@@ -324,7 +324,7 @@ class Cartflows_Ca_Settings {
324
  * @param array $args args.
325
  * @since 1.1.5
326
  */
327
- function wcf_ca_coupon_code_status_callback( $args ) {
328
  $wcf_ca_coupon_code_status = get_option( 'wcf_ca_coupon_code_status' );
329
  $html = '';
330
  printf(
@@ -332,7 +332,7 @@ class Cartflows_Ca_Settings {
332
  ' . checked( 'on', $wcf_ca_coupon_code_status, false ) . ' />'
333
  );
334
  $html .= '<label for="wcf_ca_coupon_code_status"> ' . $args[0] . '</label>';
335
- echo $html;
336
  }
337
 
338
 
@@ -342,13 +342,13 @@ class Cartflows_Ca_Settings {
342
  * @param array $args args.
343
  * @since 1.1.5
344
  */
345
- function wcf_ca_zapier_cart_abandoned_webhook_callback( $args ) {
346
  $wcf_ca_zapier_cart_abandoned_webhook = get_option( 'wcf_ca_zapier_cart_abandoned_webhook' );
347
- echo '<input type="text" class="wcf-ca-trigger-input" id="wcf_ca_zapier_cart_abandoned_webhook" name="wcf_ca_zapier_cart_abandoned_webhook" value="' . sanitize_text_field( $wcf_ca_zapier_cart_abandoned_webhook ) . '" />';
348
  echo '<button id="wcf_ca_trigger_web_hook_abandoned_btn" type="button" class="button"> Trigger Sample </button>';
349
  echo '<span style="margin-left: 10px;" id="wcf_ca_abandoned_btn_message"></span>';
350
  $html = '<label for="wcf_ca_zapier_cart_abandoned_webhook"> ' . $args[0] . '</label>';
351
- echo $html;
352
  }
353
 
354
 
@@ -358,7 +358,7 @@ class Cartflows_Ca_Settings {
358
  * @param array $args args.
359
  * @since 1.1.5
360
  */
361
- function wcf_ca_zapier_tracking_status_callback( $args ) {
362
  $wcf_ca_zapier_tracking_status = get_option( 'wcf_ca_zapier_tracking_status' );
363
 
364
  $html = '';
@@ -367,7 +367,7 @@ class Cartflows_Ca_Settings {
367
  ' . checked( 'on', $wcf_ca_zapier_tracking_status, false ) . ' />'
368
  );
369
  $html .= '<label for="wcf_ca_zapier_tracking_status"> ' . $args[0] . '</label>';
370
- echo $html;
371
  }
372
 
373
 
@@ -377,14 +377,14 @@ class Cartflows_Ca_Settings {
377
  * @param array $args args.
378
  * @since 1.1.5
379
  */
380
- function wcf_ca_coupon_amount_callback( $args ) {
381
  $wcf_ca_coupon_amount = get_option( 'wcf_ca_coupon_amount' );
382
  printf(
383
  '<input type="number" class="wcf-ca-trigger-input wcf-ca-email-inputs" id="wcf_ca_coupon_amount" name="wcf_ca_coupon_amount" value="%s" />',
384
  isset( $wcf_ca_coupon_amount ) ? esc_attr( $wcf_ca_coupon_amount ) : ''
385
  );
386
  $html = '<label for="wcf_ca_coupon_amount"> ' . $args[0] . '</label>';
387
- echo $html;
388
  }
389
 
390
  /**
@@ -393,7 +393,7 @@ class Cartflows_Ca_Settings {
393
  * @param array $args args.
394
  * @since 1.1.5
395
  */
396
- function wcf_ca_coupon_expiry_callback( $args ) {
397
  $wcf_ca_coupon_expiry = intval( get_option( 'wcf_ca_coupon_expiry' ) );
398
  printf(
399
  '<input type="number" class="wcf-ca-trigger-input wcf-ca-coupon-inputs" id="wcf_ca_coupon_expiry" name="wcf_ca_coupon_expiry" value="%s" autocomplete="off" />',
@@ -408,12 +408,12 @@ class Cartflows_Ca_Settings {
408
  echo "<select id='wcf_ca_coupon_expiry_unit' name='wcf_ca_coupon_expiry_unit'>";
409
  foreach ( $items as $key => $item ) {
410
  $selected = ( $coupon_expiry_unit === $key ) ? 'selected="selected"' : '';
411
- echo "<option value='$key' $selected>$item</option>";
412
  }
413
  echo '</select>';
414
 
415
  $html = '<label for="wcf_ca_coupon_expiry_unit"> ' . $args[0] . '</label>';
416
- echo $html;
417
  }
418
 
419
 
@@ -424,7 +424,7 @@ class Cartflows_Ca_Settings {
424
  * @param array $args args.
425
  * @since 1.1.5
426
  */
427
- function wcf_ca_gdpr_message_callback( $args ) {
428
  $wcf_ca_gdpr_message = get_option( 'wcf_ca_gdpr_message' );
429
 
430
  printf(
@@ -432,7 +432,7 @@ class Cartflows_Ca_Settings {
432
  isset( $wcf_ca_gdpr_message ) ? esc_attr( $wcf_ca_gdpr_message ) : ''
433
  );
434
  $html = '<label for="wcf_ca_gdpr_message"> ' . $args[0] . '</label>';
435
- echo $html;
436
  }
437
 
438
  /**
@@ -441,7 +441,7 @@ class Cartflows_Ca_Settings {
441
  * @param array $args args.
442
  * @since 1.1.5
443
  */
444
- function wcf_ca_discount_type_callback( $args ) {
445
 
446
  $discount_type = get_option( 'wcf_ca_discount_type' );
447
  $items = array(
@@ -451,7 +451,7 @@ class Cartflows_Ca_Settings {
451
  echo "<select id='wcf_ca_discount_type' name='wcf_ca_discount_type'>";
452
  foreach ( $items as $key => $item ) {
453
  $selected = ( $discount_type === $key ) ? 'selected="selected"' : '';
454
- echo "<option value='$key' $selected>$item</option>";
455
  }
456
  echo '</select>';
457
  }
@@ -462,7 +462,7 @@ class Cartflows_Ca_Settings {
462
  * @param array $input input.
463
  * @since 1.1.5
464
  */
465
- function wcf_ca_coupon_amount_validation( $input ) {
466
 
467
  $output = '';
468
  if ( ( is_numeric( $input ) && $input >= 1 ) ) {
@@ -482,7 +482,7 @@ class Cartflows_Ca_Settings {
482
  *
483
  * @since 1.1.5
484
  */
485
- function wcf_cart_abandonment_options_callback() {
486
  echo '<hr/>';
487
  }
488
 
@@ -493,7 +493,7 @@ class Cartflows_Ca_Settings {
493
  * @param array $args args.
494
  * @since 1.1.5
495
  */
496
- function wcf_ca_status_callback( $args ) {
497
  $wcf_ca_status = get_option( 'wcf_ca_status' );
498
  $html = '';
499
  printf(
@@ -501,7 +501,7 @@ class Cartflows_Ca_Settings {
501
  ' . checked( 'on', $wcf_ca_status, false ) . ' />'
502
  );
503
  $html .= '<label for="wcf_ca_status"> ' . $args[0] . '</label>';
504
- echo $html;
505
  }
506
 
507
  /**
@@ -510,7 +510,7 @@ class Cartflows_Ca_Settings {
510
  * @param array $args args.
511
  * @since 1.1.5
512
  */
513
- function wcf_ca_ignore_users_callback( $args ) {
514
 
515
  $wcf_ca_ignore_users = get_option( 'wcf_ca_ignore_users' );
516
  $html = '';
@@ -532,14 +532,14 @@ class Cartflows_Ca_Settings {
532
  ?>
533
  value="<?php echo esc_attr( $role_name ); ?>">
534
  <?php
535
- echo $role_name;
536
  echo '<br> ';
537
  }
538
  ?>
539
  </p>
540
  <?php
541
  $html .= '<span for="wcf_ca_ignore_users"> ' . $args[0] . '</span>';
542
- echo $html;
543
  }
544
 
545
  /**
@@ -547,7 +547,7 @@ class Cartflows_Ca_Settings {
547
  *
548
  * @param array $args args.
549
  */
550
- function wcf_ca_auto_delete_coupons_callback( $args ) {
551
  $wcf_ca_auto_delete_coupons = get_option( 'wcf_ca_auto_delete_coupons' );
552
  $html = '';
553
  printf(
@@ -555,7 +555,7 @@ class Cartflows_Ca_Settings {
555
  ' . checked( 'on', $wcf_ca_auto_delete_coupons, false ) . ' />'
556
  );
557
  $html .= '<span for="wcf_ca_auto_delete_coupons"> ' . $args[0] . '</span>';
558
- echo $html;
559
  }
560
 
561
  /**
@@ -563,7 +563,7 @@ class Cartflows_Ca_Settings {
563
  *
564
  * @param array $args args.
565
  */
566
- function wcf_ca_delete_coupons_callback( $args ) {
567
  ?>
568
 
569
  <input type="button" class="button-secondary" id="wcf_ca_delete_coupons" value="<?php esc_html_e( 'Delete', 'woo-cart-abandonment-recovery' ); ?>" >
@@ -572,7 +572,7 @@ class Cartflows_Ca_Settings {
572
  <?php
573
  $html = '';
574
  $html .= '<span for="wcf_ca_delete_coupons"> ' . $args[0] . '</span>';
575
- echo $html;
576
  }
577
 
578
  /**
@@ -581,7 +581,7 @@ class Cartflows_Ca_Settings {
581
  * @param array $args args.
582
  * @since 1.1.5
583
  */
584
- function wcf_ca_gdpr_status_callback( $args ) {
585
  $wcf_ca_gdpr_status = get_option( 'wcf_ca_gdpr_status' );
586
  $html = '';
587
  printf(
@@ -589,7 +589,7 @@ class Cartflows_Ca_Settings {
589
  ' . checked( 'on', $wcf_ca_gdpr_status, false ) . ' />'
590
  );
591
  $html .= '<label for="wcf_ca_gdpr_status"> ' . $args[0] . '</label>';
592
- echo $html;
593
  }
594
 
595
  /**
@@ -604,7 +604,7 @@ class Cartflows_Ca_Settings {
604
  isset( $wcf_ca_from_name ) ? esc_attr( $wcf_ca_from_name ) : ''
605
  );
606
  $html = '<label for="wcf_ca_from_name"> ' . $args[0] . '</label>';
607
- echo $html;
608
  }
609
 
610
  /**
@@ -619,7 +619,7 @@ class Cartflows_Ca_Settings {
619
  isset( $wcf_ca_from_email ) ? esc_attr( $wcf_ca_from_email ) : ''
620
  );
621
  $html = '<label for="wcf_ca_from_email"> ' . $args[0] . '</label>';
622
- echo $html;
623
  }
624
 
625
  /**
@@ -636,7 +636,7 @@ class Cartflows_Ca_Settings {
636
  );
637
 
638
  $html = '<label for="wcf_ca_reply_email"> ' . $args[0] . '</label>';
639
- echo $html;
640
  }
641
 
642
 
@@ -646,7 +646,7 @@ class Cartflows_Ca_Settings {
646
  * @param array $input input.
647
  * @since 1.1.5
648
  */
649
- function wcf_ca_from_email_validation( $input ) {
650
 
651
  if ( $input && ! is_email( $input ) ) {
652
  add_settings_error(
@@ -664,7 +664,7 @@ class Cartflows_Ca_Settings {
664
  * @param array $input input.
665
  * @since 1.1.5
666
  */
667
- function wcf_ca_reply_email_validation( $input ) {
668
 
669
  if ( $input && ! is_email( $input ) ) {
670
  add_settings_error(
@@ -681,7 +681,7 @@ class Cartflows_Ca_Settings {
681
  */
682
  public static function get_instance() {
683
  if ( ! isset( self::$instance ) ) {
684
- self::$instance = new self;
685
  }
686
  return self::$instance;
687
  }
46
  *
47
  * @since 1.1.5
48
  */
49
+ public function wcf_initialize_settings() {
50
 
51
  // Start: Settings for cart abandonment.
52
  add_settings_section(
324
  * @param array $args args.
325
  * @since 1.1.5
326
  */
327
+ public function wcf_ca_coupon_code_status_callback( $args ) {
328
  $wcf_ca_coupon_code_status = get_option( 'wcf_ca_coupon_code_status' );
329
  $html = '';
330
  printf(
332
  ' . checked( 'on', $wcf_ca_coupon_code_status, false ) . ' />'
333
  );
334
  $html .= '<label for="wcf_ca_coupon_code_status"> ' . $args[0] . '</label>';
335
+ echo wp_kses_post( $html );
336
  }
337
 
338
 
342
  * @param array $args args.
343
  * @since 1.1.5
344
  */
345
+ public function wcf_ca_zapier_cart_abandoned_webhook_callback( $args ) {
346
  $wcf_ca_zapier_cart_abandoned_webhook = get_option( 'wcf_ca_zapier_cart_abandoned_webhook' );
347
+ echo '<input type="text" class="wcf-ca-trigger-input" id="wcf_ca_zapier_cart_abandoned_webhook" name="wcf_ca_zapier_cart_abandoned_webhook" value="' . esc_attr( sanitize_text_field( $wcf_ca_zapier_cart_abandoned_webhook ) ) . '" />';
348
  echo '<button id="wcf_ca_trigger_web_hook_abandoned_btn" type="button" class="button"> Trigger Sample </button>';
349
  echo '<span style="margin-left: 10px;" id="wcf_ca_abandoned_btn_message"></span>';
350
  $html = '<label for="wcf_ca_zapier_cart_abandoned_webhook"> ' . $args[0] . '</label>';
351
+ echo wp_kses_post( $html );
352
  }
353
 
354
 
358
  * @param array $args args.
359
  * @since 1.1.5
360
  */
361
+ public function wcf_ca_zapier_tracking_status_callback( $args ) {
362
  $wcf_ca_zapier_tracking_status = get_option( 'wcf_ca_zapier_tracking_status' );
363
 
364
  $html = '';
367
  ' . checked( 'on', $wcf_ca_zapier_tracking_status, false ) . ' />'
368
  );
369
  $html .= '<label for="wcf_ca_zapier_tracking_status"> ' . $args[0] . '</label>';
370
+ echo wp_kses_post( $html );
371
  }
372
 
373
 
377
  * @param array $args args.
378
  * @since 1.1.5
379
  */
380
+ public function wcf_ca_coupon_amount_callback( $args ) {
381
  $wcf_ca_coupon_amount = get_option( 'wcf_ca_coupon_amount' );
382
  printf(
383
  '<input type="number" class="wcf-ca-trigger-input wcf-ca-email-inputs" id="wcf_ca_coupon_amount" name="wcf_ca_coupon_amount" value="%s" />',
384
  isset( $wcf_ca_coupon_amount ) ? esc_attr( $wcf_ca_coupon_amount ) : ''
385
  );
386
  $html = '<label for="wcf_ca_coupon_amount"> ' . $args[0] . '</label>';
387
+ echo wp_kses_post( $html );
388
  }
389
 
390
  /**
393
  * @param array $args args.
394
  * @since 1.1.5
395
  */
396
+ public function wcf_ca_coupon_expiry_callback( $args ) {
397
  $wcf_ca_coupon_expiry = intval( get_option( 'wcf_ca_coupon_expiry' ) );
398
  printf(
399
  '<input type="number" class="wcf-ca-trigger-input wcf-ca-coupon-inputs" id="wcf_ca_coupon_expiry" name="wcf_ca_coupon_expiry" value="%s" autocomplete="off" />',
408
  echo "<select id='wcf_ca_coupon_expiry_unit' name='wcf_ca_coupon_expiry_unit'>";
409
  foreach ( $items as $key => $item ) {
410
  $selected = ( $coupon_expiry_unit === $key ) ? 'selected="selected"' : '';
411
+ echo "<option value='$key' $selected>$item</option>"; //phpcs:ignore
412
  }
413
  echo '</select>';
414
 
415
  $html = '<label for="wcf_ca_coupon_expiry_unit"> ' . $args[0] . '</label>';
416
+ echo wp_kses_post( $html );
417
  }
418
 
419
 
424
  * @param array $args args.
425
  * @since 1.1.5
426
  */
427
+ public function wcf_ca_gdpr_message_callback( $args ) {
428
  $wcf_ca_gdpr_message = get_option( 'wcf_ca_gdpr_message' );
429
 
430
  printf(
432
  isset( $wcf_ca_gdpr_message ) ? esc_attr( $wcf_ca_gdpr_message ) : ''
433
  );
434
  $html = '<label for="wcf_ca_gdpr_message"> ' . $args[0] . '</label>';
435
+ echo wp_kses_post( $html );
436
  }
437
 
438
  /**
441
  * @param array $args args.
442
  * @since 1.1.5
443
  */
444
+ public function wcf_ca_discount_type_callback( $args ) {
445
 
446
  $discount_type = get_option( 'wcf_ca_discount_type' );
447
  $items = array(
451
  echo "<select id='wcf_ca_discount_type' name='wcf_ca_discount_type'>";
452
  foreach ( $items as $key => $item ) {
453
  $selected = ( $discount_type === $key ) ? 'selected="selected"' : '';
454
+ echo "<option value='$key' $selected>$item</option>"; //phpcs:ignore
455
  }
456
  echo '</select>';
457
  }
462
  * @param array $input input.
463
  * @since 1.1.5
464
  */
465
+ public function wcf_ca_coupon_amount_validation( $input ) {
466
 
467
  $output = '';
468
  if ( ( is_numeric( $input ) && $input >= 1 ) ) {
482
  *
483
  * @since 1.1.5
484
  */
485
+ public function wcf_cart_abandonment_options_callback() {
486
  echo '<hr/>';
487
  }
488
 
493
  * @param array $args args.
494
  * @since 1.1.5
495
  */
496
+ public function wcf_ca_status_callback( $args ) {
497
  $wcf_ca_status = get_option( 'wcf_ca_status' );
498
  $html = '';
499
  printf(
501
  ' . checked( 'on', $wcf_ca_status, false ) . ' />'
502
  );
503
  $html .= '<label for="wcf_ca_status"> ' . $args[0] . '</label>';
504
+ echo wp_kses_post( $html );
505
  }
506
 
507
  /**
510
  * @param array $args args.
511
  * @since 1.1.5
512
  */
513
+ public function wcf_ca_ignore_users_callback( $args ) {
514
 
515
  $wcf_ca_ignore_users = get_option( 'wcf_ca_ignore_users' );
516
  $html = '';
532
  ?>
533
  value="<?php echo esc_attr( $role_name ); ?>">
534
  <?php
535
+ echo esc_attr( $role_name );
536
  echo '<br> ';
537
  }
538
  ?>
539
  </p>
540
  <?php
541
  $html .= '<span for="wcf_ca_ignore_users"> ' . $args[0] . '</span>';
542
+ echo wp_kses_post( $html );
543
  }
544
 
545
  /**
547
  *
548
  * @param array $args args.
549
  */
550
+ public function wcf_ca_auto_delete_coupons_callback( $args ) {
551
  $wcf_ca_auto_delete_coupons = get_option( 'wcf_ca_auto_delete_coupons' );
552
  $html = '';
553
  printf(
555
  ' . checked( 'on', $wcf_ca_auto_delete_coupons, false ) . ' />'
556
  );
557
  $html .= '<span for="wcf_ca_auto_delete_coupons"> ' . $args[0] . '</span>';
558
+ echo wp_kses_post( $html );
559
  }
560
 
561
  /**
563
  *
564
  * @param array $args args.
565
  */
566
+ public function wcf_ca_delete_coupons_callback( $args ) {
567
  ?>
568
 
569
  <input type="button" class="button-secondary" id="wcf_ca_delete_coupons" value="<?php esc_html_e( 'Delete', 'woo-cart-abandonment-recovery' ); ?>" >
572
  <?php
573
  $html = '';
574
  $html .= '<span for="wcf_ca_delete_coupons"> ' . $args[0] . '</span>';
575
+ echo wp_kses_post( $html );
576
  }
577
 
578
  /**
581
  * @param array $args args.
582
  * @since 1.1.5
583
  */
584
+ public function wcf_ca_gdpr_status_callback( $args ) {
585
  $wcf_ca_gdpr_status = get_option( 'wcf_ca_gdpr_status' );
586
  $html = '';
587
  printf(
589
  ' . checked( 'on', $wcf_ca_gdpr_status, false ) . ' />'
590
  );
591
  $html .= '<label for="wcf_ca_gdpr_status"> ' . $args[0] . '</label>';
592
+ echo wp_kses_post( $html );
593
  }
594
 
595
  /**
604
  isset( $wcf_ca_from_name ) ? esc_attr( $wcf_ca_from_name ) : ''
605
  );
606
  $html = '<label for="wcf_ca_from_name"> ' . $args[0] . '</label>';
607
+ echo wp_kses_post( $html );
608
  }
609
 
610
  /**
619
  isset( $wcf_ca_from_email ) ? esc_attr( $wcf_ca_from_email ) : ''
620
  );
621
  $html = '<label for="wcf_ca_from_email"> ' . $args[0] . '</label>';
622
+ echo wp_kses_post( $html );
623
  }
624
 
625
  /**
636
  );
637
 
638
  $html = '<label for="wcf_ca_reply_email"> ' . $args[0] . '</label>';
639
+ echo wp_kses_post( $html );
640
  }
641
 
642
 
646
  * @param array $input input.
647
  * @since 1.1.5
648
  */
649
+ public function wcf_ca_from_email_validation( $input ) {
650
 
651
  if ( $input && ! is_email( $input ) ) {
652
  add_settings_error(
664
  * @param array $input input.
665
  * @since 1.1.5
666
  */
667
+ public function wcf_ca_reply_email_validation( $input ) {
668
 
669
  if ( $input && ! is_email( $input ) ) {
670
  add_settings_error(
681
  */
682
  public static function get_instance() {
683
  if ( ! isset( self::$instance ) ) {
684
+ self::$instance = new self();
685
  }
686
  return self::$instance;
687
  }
classes/class-cartflows-ca-update.php CHANGED
@@ -56,7 +56,7 @@ if ( ! class_exists( 'Cartflows_Ca_Update' ) ) :
56
  * @since 1.0.0
57
  * @return void
58
  */
59
- static public function init() {
60
 
61
  do_action( 'cartflows_ca_update_before' );
62
 
56
  * @since 1.0.0
57
  * @return void
58
  */
59
+ public static function init() {
60
 
61
  do_action( 'cartflows_ca_update_before' );
62
 
classes/class-cartflows-ca-utils.php CHANGED
@@ -42,7 +42,7 @@ class Cartflows_Ca_Utils {
42
  */
43
  public static function get_instance() {
44
  if ( ! isset( self::$instance ) ) {
45
- self::$instance = new self;
46
  }
47
  return self::$instance;
48
  }
@@ -52,7 +52,7 @@ class Cartflows_Ca_Utils {
52
  *
53
  * @return bool
54
  */
55
- function is_cart_abandonment_tracking_enabled() {
56
 
57
  $wcf_ca_status = get_option( 'wcf_ca_status' );
58
 
@@ -69,7 +69,7 @@ class Cartflows_Ca_Utils {
69
  *
70
  * @return bool
71
  */
72
- function is_zapier_trigger_enabled() {
73
 
74
  $wcf_ca_zapier_tracking_status = get_option( 'wcf_ca_zapier_tracking_status' );
75
 
@@ -87,7 +87,7 @@ class Cartflows_Ca_Utils {
87
  * @param boolean $in_seconds get cutoff time in seconds if true.
88
  * @return bool
89
  */
90
- function get_cart_abandonment_tracking_cut_off_time( $in_seconds = false ) {
91
 
92
  $cart_abandoned_time = apply_filters( 'cartflows_ca_cart_abandonment_cut_off_time', WCF_DEFAULT_CUT_OFF_TIME );
93
  return $in_seconds ? $cart_abandoned_time * MINUTE_IN_SECONDS : $cart_abandoned_time;
@@ -99,7 +99,7 @@ class Cartflows_Ca_Utils {
99
  *
100
  * @return bool
101
  */
102
- function is_gdpr_enabled() {
103
 
104
  $wcf_ca_gdpr_status = get_option( 'wcf_ca_gdpr_status' );
105
 
42
  */
43
  public static function get_instance() {
44
  if ( ! isset( self::$instance ) ) {
45
+ self::$instance = new self();
46
  }
47
  return self::$instance;
48
  }
52
  *
53
  * @return bool
54
  */
55
+ public function is_cart_abandonment_tracking_enabled() {
56
 
57
  $wcf_ca_status = get_option( 'wcf_ca_status' );
58
 
69
  *
70
  * @return bool
71
  */
72
+ public function is_zapier_trigger_enabled() {
73
 
74
  $wcf_ca_zapier_tracking_status = get_option( 'wcf_ca_zapier_tracking_status' );
75
 
87
  * @param boolean $in_seconds get cutoff time in seconds if true.
88
  * @return bool
89
  */
90
+ public function get_cart_abandonment_tracking_cut_off_time( $in_seconds = false ) {
91
 
92
  $cart_abandoned_time = apply_filters( 'cartflows_ca_cart_abandonment_cut_off_time', WCF_DEFAULT_CUT_OFF_TIME );
93
  return $in_seconds ? $cart_abandoned_time * MINUTE_IN_SECONDS : $cart_abandoned_time;
99
  *
100
  * @return bool
101
  */
102
+ public function is_gdpr_enabled() {
103
 
104
  $wcf_ca_gdpr_status = get_option( 'wcf_ca_gdpr_status' );
105
 
languages/woo-cart-abandonment-recovery.pot CHANGED
@@ -1,15 +1,15 @@
1
- # Copyright (C) 2019 CartFlows Inc
2
  # This file is distributed under the same license as the WooCommerce Cart Abandonment Recovery package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Cart Abandonment Recovery 1.2.3\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woo-cart-abandonment-recovery\n"
8
- "POT-Creation-Date: 2019-12-12 05:59:07+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
  "Language: en\n"
@@ -32,11 +32,11 @@ msgid ""
32
  "%1$sWooCommerce%2$s plugin installed & activated."
33
  msgstr ""
34
 
35
- #: classes/class-cartflows-ca-loader.php:145
36
  msgid "Activate WooCommerce"
37
  msgstr ""
38
 
39
- #: classes/class-cartflows-ca-loader.php:153
40
  msgid "Install WooCommerce"
41
  msgstr ""
42
 
@@ -149,12 +149,12 @@ msgid ""
149
  msgstr ""
150
 
151
  #: classes/class-cartflows-ca-settings.php:225
152
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:532
153
  msgid "Discount Type"
154
  msgstr ""
155
 
156
  #: classes/class-cartflows-ca-settings.php:234
157
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:564
158
  msgid "Coupon Amount"
159
  msgstr ""
160
 
@@ -192,14 +192,14 @@ msgid "GDPR Message"
192
  msgstr ""
193
 
194
  #: classes/class-cartflows-ca-settings.php:405
195
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:602
196
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:698
197
  msgid "Hour(s)"
198
  msgstr ""
199
 
200
  #: classes/class-cartflows-ca-settings.php:406
201
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:603
202
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:699
203
  msgid "Day(s)"
204
  msgstr ""
205
 
@@ -208,8 +208,8 @@ msgid "Coupon code should be numeric and has to be greater than or equals to 1."
208
  msgstr ""
209
 
210
  #: classes/class-cartflows-ca-settings.php:569
211
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:66
212
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:118
213
  #: modules/cart-abandonment/class-cartflows-ca-email-templates-table.php:84
214
  #: modules/cart-abandonment/class-cartflows-ca-email-templates-table.php:118
215
  msgid "Delete"
@@ -223,152 +223,164 @@ msgstr ""
223
  msgid "Invalid email \"Reply\" address field"
224
  msgstr ""
225
 
226
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:65
227
  msgid "View"
228
  msgstr ""
229
 
230
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:70
231
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:122
232
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1682
233
  msgid "Unsubscribe"
234
  msgstr ""
235
 
236
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:189
237
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1825
238
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1879
239
  #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:173
240
  msgid "Name"
241
  msgstr ""
242
 
243
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:190
244
  msgid "Email"
245
  msgstr ""
246
 
247
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:191
248
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1901
249
  msgid "Cart Total"
250
  msgstr ""
251
 
252
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:192
253
  msgid "Order Status"
254
  msgstr ""
255
 
256
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:193
257
  msgid "Time"
258
  msgstr ""
259
 
260
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:133
261
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:941
262
  msgid "This order was abandoned & subsequently recovered."
263
  msgstr ""
264
 
265
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:154
266
  msgid "Mail has been sent successfully!"
267
  msgstr ""
268
 
269
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:156
270
  msgid "Mail sending failed!"
271
  msgstr ""
272
 
273
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:196
274
  msgid "Every Fifteen Minutes"
275
  msgstr ""
276
 
277
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:262
278
  msgid "You have successfully unsubscribed from our email list."
279
  msgstr ""
280
 
281
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:262
282
  #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:164
283
  msgid "Unsubscribed"
284
  msgstr ""
285
 
286
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:417
287
  msgid ""
288
  "This checkout page is generated by WooCommerce Cart Abandonment Recovery "
289
  "plugin from test mail."
290
  msgstr ""
291
 
292
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:459
293
  msgid "No Thanks"
294
  msgstr ""
295
 
296
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:460
297
  msgid "You won't receive further emails from us, thank you!"
298
  msgstr ""
299
 
300
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1096
301
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1097
302
  msgid "Cart Abandonment"
303
  msgstr ""
304
 
305
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1130
306
  msgid "Items deleted: %d"
307
  msgstr ""
308
 
309
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1147
310
  msgid "User(s) unsubscribed successfully!"
311
  msgstr ""
312
 
313
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1199
314
  msgid ""
315
  "Do you really want to delete the used and expired coupons created by Cart "
316
  "Abandonment Plugin?"
317
  msgstr ""
318
 
319
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1357
320
- msgid "Report"
 
 
 
 
 
 
 
 
321
  msgstr ""
322
 
323
  #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1373
324
- msgid "Follow-Up Emails"
325
  msgstr ""
326
 
327
  #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1389
 
 
 
 
328
  msgid "Settings"
329
  msgstr ""
330
 
331
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1643
332
  msgid "there"
333
  msgstr ""
334
 
335
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1817
336
  msgid "Cart Total ( Cart Total + Shipping + Tax )"
337
  msgstr ""
338
 
339
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1824
340
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1878
341
  msgid "Item"
342
  msgstr ""
343
 
344
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1826
345
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1880
346
  msgid "Quantity"
347
  msgstr ""
348
 
349
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1827
350
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1881
351
  msgid "Price"
352
  msgstr ""
353
 
354
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1828
355
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1882
356
  msgid "Line Subtotal"
357
  msgstr ""
358
 
359
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1888
360
  msgid "Discount"
361
  msgstr ""
362
 
363
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1892
364
  msgid "Other"
365
  msgstr ""
366
 
367
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1897
368
  msgid "Shipping"
369
  msgstr ""
370
 
371
- #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:2045
372
  #. translators: %1$s: Coupons Deleted, %2$s: Deleted coupons count'.
373
  msgid "%1$s: %2$d"
374
  msgstr ""
@@ -381,197 +393,197 @@ msgstr ""
381
  msgid "Clone"
382
  msgstr ""
383
 
384
- #: modules/cart-abandonment/class-cartflows-ca-email-templates-table.php:182
385
  msgid "Template Name"
386
  msgstr ""
387
 
388
- #: modules/cart-abandonment/class-cartflows-ca-email-templates-table.php:183
389
  #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:83
390
  msgid "Email Subject"
391
  msgstr ""
392
 
393
- #: modules/cart-abandonment/class-cartflows-ca-email-templates-table.php:184
394
  msgid "Trigger After"
395
  msgstr ""
396
 
397
- #: modules/cart-abandonment/class-cartflows-ca-email-templates-table.php:185
398
  msgid "Activate Template"
399
  msgstr ""
400
 
401
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:127
402
  msgid "Admin Firstname"
403
  msgstr ""
404
 
405
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:128
406
  msgid "Admin Company"
407
  msgstr ""
408
 
409
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:129
410
  msgid "Abandoned Product Details Table"
411
  msgstr ""
412
 
413
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:130
414
  msgid "Abandoned Product Names"
415
  msgstr ""
416
 
417
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:131
418
  msgid "Cart Checkout URL"
419
  msgstr ""
420
 
421
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:132
422
  msgid "Coupon Code"
423
  msgstr ""
424
 
425
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:133
426
  msgid "Customer First Name"
427
  msgstr ""
428
 
429
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:134
430
  msgid "Customer Last Name"
431
  msgstr ""
432
 
433
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:135
434
  msgid "Customer Full Name"
435
  msgstr ""
436
 
437
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:136
438
  msgid "Cart Abandonment Date"
439
  msgstr ""
440
 
441
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:137
442
  msgid "Site URL"
443
  msgstr ""
444
 
445
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:138
446
  msgid "Unsubscribe Link"
447
  msgstr ""
448
 
449
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:158
450
  msgid "Something went wrong"
451
  msgstr ""
452
 
453
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:165
454
  msgid "Activated"
455
  msgstr ""
456
 
457
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:168
458
  msgid "Deactivated"
459
  msgstr ""
460
 
461
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:227
462
  msgid "The Email Template has been successfully added."
463
  msgstr ""
464
 
465
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:237
466
  msgid "The Email Template has been cloned successfully."
467
  msgstr ""
468
 
469
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:247
470
  msgid "The Email Template has been successfully deleted."
471
  msgstr ""
472
 
473
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:256
474
  msgid "The Email Template has been successfully updated."
475
  msgstr ""
476
 
477
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:266
478
  msgid "Default Email Templates has been restored successfully."
479
  msgstr ""
480
 
481
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:433
482
  msgid "Activate Template now?"
483
  msgstr ""
484
 
485
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:453
486
  msgid "Template Name:"
487
  msgstr ""
488
 
489
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:468
490
  msgid "Email Subject:"
491
  msgstr ""
492
 
493
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:483
494
  msgid "Email Body:"
495
  msgstr ""
496
 
497
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:512
498
  msgid "Create Coupon"
499
  msgstr ""
500
 
501
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:525
502
  msgid "Allows you to send new coupon only for this template."
503
  msgstr ""
504
 
505
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:582
506
  msgid "Coupon expiry date"
507
  msgstr ""
508
 
509
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:612
510
  msgid "Enter zero (0) to restrict coupon from expiring"
511
  msgstr ""
512
 
513
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:618
514
  msgid "Free Shipping"
515
  msgstr ""
516
 
517
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:631
518
  msgid ""
519
  "Allows you to grant free shipping. A free shipping method must be enabled "
520
  "in your shipping zone and be set to require \"a valid free shipping "
521
  "coupon\". "
522
  msgstr ""
523
 
524
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:638
525
  msgid "Individual use only"
526
  msgstr ""
527
 
528
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:652
529
  msgid ""
530
  "Check this box if the coupon cannot be used in conjunction with other "
531
  "coupons."
532
  msgstr ""
533
 
534
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:659
535
  msgid "Auto Apply Coupon"
536
  msgstr ""
537
 
538
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:673
539
  msgid " Automatically add the coupon to the cart at the checkout."
540
  msgstr ""
541
 
542
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:679
543
  msgid "Send This Email"
544
  msgstr ""
545
 
546
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:697
547
  msgid "Minute(s)"
548
  msgstr ""
549
 
550
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:712
551
  msgid "after cart is abandoned."
552
  msgstr ""
553
 
554
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:722
555
  msgid "Send Test Email To:"
556
  msgstr ""
557
 
558
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:726
559
  msgid "Send a test email"
560
  msgstr ""
561
 
562
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:739
563
  msgid "Save Changes"
564
  msgstr ""
565
 
566
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:741
567
  msgid "Update Changes"
568
  msgstr ""
569
 
570
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:1047
571
  msgid "Create New Template"
572
  msgstr ""
573
 
574
- #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:1050
575
  msgid " Restore Default Templates"
576
  msgstr ""
577
 
@@ -585,8 +597,8 @@ msgstr ""
585
 
586
  #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:48
587
  msgid ""
588
- "All new activated emails will be reschedule for this abandoned order. "
589
- "<br/>New emails will\n"
590
  "\t\t\t\t\t\t\t\t\t\t\tbe sent to user according to schedule time."
591
  msgstr ""
592
 
@@ -779,7 +791,15 @@ msgstr ""
779
  msgid "Total Percentage Of Recovered Orders After Abandonment."
780
  msgstr ""
781
 
782
- #: modules/cart-abandonment/includes/admin/cartflows-cart-abandonment-reports.php:135
 
 
 
 
 
 
 
 
783
  msgid "No Orders Found."
784
  msgstr ""
785
 
1
+ # Copyright (C) 2020 CartFlows Inc
2
  # This file is distributed under the same license as the WooCommerce Cart Abandonment Recovery package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Cart Abandonment Recovery 1.2.4\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woo-cart-abandonment-recovery\n"
8
+ "POT-Creation-Date: 2020-02-06 11:49:03+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2020-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
  "Language: en\n"
32
  "%1$sWooCommerce%2$s plugin installed & activated."
33
  msgstr ""
34
 
35
+ #: classes/class-cartflows-ca-loader.php:144
36
  msgid "Activate WooCommerce"
37
  msgstr ""
38
 
39
+ #: classes/class-cartflows-ca-loader.php:152
40
  msgid "Install WooCommerce"
41
  msgstr ""
42
 
149
  msgstr ""
150
 
151
  #: classes/class-cartflows-ca-settings.php:225
152
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:533
153
  msgid "Discount Type"
154
  msgstr ""
155
 
156
  #: classes/class-cartflows-ca-settings.php:234
157
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:565
158
  msgid "Coupon Amount"
159
  msgstr ""
160
 
192
  msgstr ""
193
 
194
  #: classes/class-cartflows-ca-settings.php:405
195
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:603
196
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:699
197
  msgid "Hour(s)"
198
  msgstr ""
199
 
200
  #: classes/class-cartflows-ca-settings.php:406
201
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:604
202
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:700
203
  msgid "Day(s)"
204
  msgstr ""
205
 
208
  msgstr ""
209
 
210
  #: classes/class-cartflows-ca-settings.php:569
211
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:82
212
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:134
213
  #: modules/cart-abandonment/class-cartflows-ca-email-templates-table.php:84
214
  #: modules/cart-abandonment/class-cartflows-ca-email-templates-table.php:118
215
  msgid "Delete"
223
  msgid "Invalid email \"Reply\" address field"
224
  msgstr ""
225
 
226
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:81
227
  msgid "View"
228
  msgstr ""
229
 
230
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:86
231
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:138
232
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1706
233
  msgid "Unsubscribe"
234
  msgstr ""
235
 
236
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:218
237
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1846
238
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1897
239
  #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:173
240
  msgid "Name"
241
  msgstr ""
242
 
243
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:219
244
  msgid "Email"
245
  msgstr ""
246
 
247
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:220
248
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1919
249
  msgid "Cart Total"
250
  msgstr ""
251
 
252
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:221
253
  msgid "Order Status"
254
  msgstr ""
255
 
256
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php:222
257
  msgid "Time"
258
  msgstr ""
259
 
260
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:135
261
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:951
262
  msgid "This order was abandoned & subsequently recovered."
263
  msgstr ""
264
 
265
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:156
266
  msgid "Mail has been sent successfully!"
267
  msgstr ""
268
 
269
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:158
270
  msgid "Mail sending failed!"
271
  msgstr ""
272
 
273
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:198
274
  msgid "Every Fifteen Minutes"
275
  msgstr ""
276
 
277
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:270
278
  msgid "You have successfully unsubscribed from our email list."
279
  msgstr ""
280
 
281
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:270
282
  #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:164
283
  msgid "Unsubscribed"
284
  msgstr ""
285
 
286
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:424
287
  msgid ""
288
  "This checkout page is generated by WooCommerce Cart Abandonment Recovery "
289
  "plugin from test mail."
290
  msgstr ""
291
 
292
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:466
293
  msgid "No Thanks"
294
  msgstr ""
295
 
296
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:467
297
  msgid "You won't receive further emails from us, thank you!"
298
  msgstr ""
299
 
300
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1107
301
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1108
302
  msgid "Cart Abandonment"
303
  msgstr ""
304
 
305
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1133
306
  msgid "Items deleted: %d"
307
  msgstr ""
308
 
309
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1150
310
  msgid "User(s) unsubscribed successfully!"
311
  msgstr ""
312
 
313
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1211
314
  msgid ""
315
  "Do you really want to delete the used and expired coupons created by Cart "
316
  "Abandonment Plugin?"
317
  msgstr ""
318
 
319
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1212
320
+ msgid "Do you really want to export orders?"
321
+ msgstr ""
322
+
323
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1216
324
+ msgid "No such order is found."
325
+ msgstr ""
326
+
327
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1235
328
+ msgid "View Report"
329
  msgstr ""
330
 
331
  #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1373
332
+ msgid "Report"
333
  msgstr ""
334
 
335
  #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1389
336
+ msgid "Follow-Up Emails"
337
+ msgstr ""
338
+
339
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1405
340
  msgid "Settings"
341
  msgstr ""
342
 
343
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1667
344
  msgid "there"
345
  msgstr ""
346
 
347
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1838
348
  msgid "Cart Total ( Cart Total + Shipping + Tax )"
349
  msgstr ""
350
 
351
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1845
352
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1896
353
  msgid "Item"
354
  msgstr ""
355
 
356
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1847
357
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1898
358
  msgid "Quantity"
359
  msgstr ""
360
 
361
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1848
362
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1899
363
  msgid "Price"
364
  msgstr ""
365
 
366
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1849
367
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1900
368
  msgid "Line Subtotal"
369
  msgstr ""
370
 
371
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1906
372
  msgid "Discount"
373
  msgstr ""
374
 
375
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1910
376
  msgid "Other"
377
  msgstr ""
378
 
379
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:1915
380
  msgid "Shipping"
381
  msgstr ""
382
 
383
+ #: modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php:2063
384
  #. translators: %1$s: Coupons Deleted, %2$s: Deleted coupons count'.
385
  msgid "%1$s: %2$d"
386
  msgstr ""
393
  msgid "Clone"
394
  msgstr ""
395
 
396
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates-table.php:183
397
  msgid "Template Name"
398
  msgstr ""
399
 
400
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates-table.php:184
401
  #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:83
402
  msgid "Email Subject"
403
  msgstr ""
404
 
405
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates-table.php:185
406
  msgid "Trigger After"
407
  msgstr ""
408
 
409
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates-table.php:186
410
  msgid "Activate Template"
411
  msgstr ""
412
 
413
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:128
414
  msgid "Admin Firstname"
415
  msgstr ""
416
 
417
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:129
418
  msgid "Admin Company"
419
  msgstr ""
420
 
421
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:130
422
  msgid "Abandoned Product Details Table"
423
  msgstr ""
424
 
425
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:131
426
  msgid "Abandoned Product Names"
427
  msgstr ""
428
 
429
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:132
430
  msgid "Cart Checkout URL"
431
  msgstr ""
432
 
433
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:133
434
  msgid "Coupon Code"
435
  msgstr ""
436
 
437
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:134
438
  msgid "Customer First Name"
439
  msgstr ""
440
 
441
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:135
442
  msgid "Customer Last Name"
443
  msgstr ""
444
 
445
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:136
446
  msgid "Customer Full Name"
447
  msgstr ""
448
 
449
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:137
450
  msgid "Cart Abandonment Date"
451
  msgstr ""
452
 
453
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:138
454
  msgid "Site URL"
455
  msgstr ""
456
 
457
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:139
458
  msgid "Unsubscribe Link"
459
  msgstr ""
460
 
461
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:159
462
  msgid "Something went wrong"
463
  msgstr ""
464
 
465
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:166
466
  msgid "Activated"
467
  msgstr ""
468
 
469
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:169
470
  msgid "Deactivated"
471
  msgstr ""
472
 
473
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:228
474
  msgid "The Email Template has been successfully added."
475
  msgstr ""
476
 
477
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:238
478
  msgid "The Email Template has been cloned successfully."
479
  msgstr ""
480
 
481
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:248
482
  msgid "The Email Template has been successfully deleted."
483
  msgstr ""
484
 
485
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:257
486
  msgid "The Email Template has been successfully updated."
487
  msgstr ""
488
 
489
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:267
490
  msgid "Default Email Templates has been restored successfully."
491
  msgstr ""
492
 
493
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:434
494
  msgid "Activate Template now?"
495
  msgstr ""
496
 
497
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:454
498
  msgid "Template Name:"
499
  msgstr ""
500
 
501
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:469
502
  msgid "Email Subject:"
503
  msgstr ""
504
 
505
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:484
506
  msgid "Email Body:"
507
  msgstr ""
508
 
509
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:513
510
  msgid "Create Coupon"
511
  msgstr ""
512
 
513
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:526
514
  msgid "Allows you to send new coupon only for this template."
515
  msgstr ""
516
 
517
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:583
518
  msgid "Coupon expiry date"
519
  msgstr ""
520
 
521
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:613
522
  msgid "Enter zero (0) to restrict coupon from expiring"
523
  msgstr ""
524
 
525
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:619
526
  msgid "Free Shipping"
527
  msgstr ""
528
 
529
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:632
530
  msgid ""
531
  "Allows you to grant free shipping. A free shipping method must be enabled "
532
  "in your shipping zone and be set to require \"a valid free shipping "
533
  "coupon\". "
534
  msgstr ""
535
 
536
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:639
537
  msgid "Individual use only"
538
  msgstr ""
539
 
540
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:653
541
  msgid ""
542
  "Check this box if the coupon cannot be used in conjunction with other "
543
  "coupons."
544
  msgstr ""
545
 
546
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:660
547
  msgid "Auto Apply Coupon"
548
  msgstr ""
549
 
550
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:674
551
  msgid " Automatically add the coupon to the cart at the checkout."
552
  msgstr ""
553
 
554
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:680
555
  msgid "Send This Email"
556
  msgstr ""
557
 
558
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:698
559
  msgid "Minute(s)"
560
  msgstr ""
561
 
562
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:713
563
  msgid "after cart is abandoned."
564
  msgstr ""
565
 
566
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:723
567
  msgid "Send Test Email To:"
568
  msgstr ""
569
 
570
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:727
571
  msgid "Send a test email"
572
  msgstr ""
573
 
574
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:740
575
  msgid "Save Changes"
576
  msgstr ""
577
 
578
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:742
579
  msgid "Update Changes"
580
  msgstr ""
581
 
582
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:1048
583
  msgid "Create New Template"
584
  msgstr ""
585
 
586
+ #: modules/cart-abandonment/class-cartflows-ca-email-templates.php:1051
587
  msgid " Restore Default Templates"
588
  msgstr ""
589
 
597
 
598
  #: modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php:48
599
  msgid ""
600
+ "All new activated emails will be reschedule for this abandoned order.New "
601
+ "emails will\n"
602
  "\t\t\t\t\t\t\t\t\t\t\tbe sent to user according to schedule time."
603
  msgstr ""
604
 
791
  msgid "Total Percentage Of Recovered Orders After Abandonment."
792
  msgstr ""
793
 
794
+ #: modules/cart-abandonment/includes/admin/cartflows-cart-abandonment-reports.php:124
795
+ msgid "Search by email"
796
+ msgstr ""
797
+
798
+ #: modules/cart-abandonment/includes/admin/cartflows-cart-abandonment-reports.php:125
799
+ msgid "Search Orders"
800
+ msgstr ""
801
+
802
+ #: modules/cart-abandonment/includes/admin/cartflows-cart-abandonment-reports.php:152
803
  msgid "No Orders Found."
804
  msgstr ""
805
 
modules/cart-abandonment/class-cartflows-ca-cart-abandonment-db.php CHANGED
@@ -24,7 +24,7 @@ class Cartflows_Ca_Cart_Abandonment_Db {
24
  */
25
  public static function get_instance() {
26
  if ( ! isset( self::$instance ) ) {
27
- self::$instance = new self;
28
  }
29
  return self::$instance;
30
  }
24
  */
25
  public static function get_instance() {
26
  if ( ! isset( self::$instance ) ) {
27
+ self::$instance = new self();
28
  }
29
  return self::$instance;
30
  }
modules/cart-abandonment/class-cartflows-ca-cart-abandonment-table.php CHANGED
@@ -14,11 +14,27 @@ if ( ! class_exists( 'WP_List_Table' ) ) {
14
  class Cartflows_Ca_Cart_Abandonment_Table extends WP_List_Table {
15
 
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  /**
19
  * Constructor function.
20
  */
21
- function __construct() {
22
  global $status, $page;
23
 
24
  parent::__construct(
@@ -35,7 +51,7 @@ class Cartflows_Ca_Cart_Abandonment_Table extends WP_List_Table {
35
  * @param object $item item.
36
  * @param string $column_name column name.
37
  */
38
- function column_default( $item, $column_name ) {
39
  return $item[ $column_name ];
40
  }
41
 
@@ -45,7 +61,7 @@ class Cartflows_Ca_Cart_Abandonment_Table extends WP_List_Table {
45
  * @param object $item item.
46
  * @return string
47
  */
48
- function column_nameSurname( $item ) {
49
 
50
  $item_details = unserialize( $item['other_fields'] );
51
 
@@ -86,7 +102,7 @@ class Cartflows_Ca_Cart_Abandonment_Table extends WP_List_Table {
86
  * @param object $item - row (key, value array).
87
  * @return HTML
88
  */
89
- function column_time( $item ) {
90
  $database_time = $item['time'];
91
  $date_time = new DateTime( $database_time );
92
  $date_time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
@@ -101,7 +117,7 @@ class Cartflows_Ca_Cart_Abandonment_Table extends WP_List_Table {
101
  * @param object $item item.
102
  * @return HTML
103
  */
104
- function column_cb( $item ) {
105
  return sprintf(
106
  '<input type="checkbox" name="id[]" value="%s" />',
107
  esc_html( $item['id'] )
@@ -113,12 +129,12 @@ class Cartflows_Ca_Cart_Abandonment_Table extends WP_List_Table {
113
  *
114
  * @return array
115
  */
116
- function get_bulk_actions() {
117
- $actions = array(
118
  'delete' => __( 'Delete', 'woo-cart-abandonment-recovery' ),
119
  );
120
-
121
- if ( ! isset( $_GET['filter_table'] ) || ( isset( $_GET['filter_table'] ) && WCF_CART_ABANDONED_ORDER === $_GET['filter_table'] ) ) {
122
  $actions['unsubscribe'] = __( 'Unsubscribe', 'woo-cart-abandonment-recovery' );
123
  }
124
 
@@ -141,7 +157,7 @@ class Cartflows_Ca_Cart_Abandonment_Table extends WP_List_Table {
141
  * @param string $from_date from date.
142
  * @param string $to_date to date.
143
  */
144
- function prepare_items( $cart_type = WCF_CART_ABANDONED_ORDER, $from_date = '', $to_date = '' ) {
145
  global $wpdb;
146
  $cart_abandonment_table_name = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
147
 
@@ -155,18 +171,29 @@ class Cartflows_Ca_Cart_Abandonment_Table extends WP_List_Table {
155
 
156
  $this->process_bulk_action();
157
 
158
- $paged = filter_input( INPUT_GET, 'paged', FILTER_SANITIZE_NUMBER_INT );
159
- $orderby = filter_input( INPUT_GET, 'orderby', FILTER_SANITIZE_STRING );
160
- $order = filter_input( INPUT_GET, 'order', FILTER_SANITIZE_STRING );
 
161
 
162
  $paged = $paged ? max( 0, $paged - 1 ) : 0;
163
  $orderby = ( $orderby && in_array( $orderby, array_keys( $this->get_sortable_columns() ), true ) ) ? $orderby : 'id';
164
  $order = ( $order && in_array( $order, array( 'asc', 'desc' ), true ) ) ? $order : 'desc';
165
 
166
  $this->items = $wpdb->get_results(
167
- $wpdb->prepare("SELECT * FROM $cart_abandonment_table_name WHERE `order_status` = %s AND DATE(`time`) >= %s AND DATE(`time`) <= %s ORDER BY $orderby $order LIMIT %d OFFSET %d", $cart_type, $from_date, $to_date, $per_page, $paged * $per_page), ARRAY_A); // phpcs:ignore
168
-
169
- $total_items = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $cart_abandonment_table_name WHERE `order_status` = %s AND DATE(`time`) >= %s AND DATE(`time`) <= %s", $cart_type, $from_date, $to_date)); // phpcs:ignore
 
 
 
 
 
 
 
 
 
 
170
 
171
  // [REQUIRED] configure pagination
172
  $this->set_pagination_args(
@@ -176,6 +203,8 @@ class Cartflows_Ca_Cart_Abandonment_Table extends WP_List_Table {
176
  'total_pages' => ceil( $total_items / $per_page ),
177
  )
178
  );
 
 
179
  }
180
 
181
  /**
@@ -183,7 +212,7 @@ class Cartflows_Ca_Cart_Abandonment_Table extends WP_List_Table {
183
  *
184
  * @return array
185
  */
186
- function get_columns() {
187
  $columns = array(
188
  'cb' => '<input type="checkbox" />',
189
  'nameSurname' => __( 'Name', 'woo-cart-abandonment-recovery' ),
@@ -214,15 +243,16 @@ class Cartflows_Ca_Cart_Abandonment_Table extends WP_List_Table {
214
  /**
215
  * Processes bulk actions
216
  */
217
- function process_bulk_action() {
218
  global $wpdb;
219
  $table_name = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
220
 
221
- $ids = array();
222
- if ( isset( $_REQUEST['id'] ) && is_array( $_REQUEST['id'] ) ) {
223
- $ids = array_map( 'intval', $_REQUEST['id'] );
224
- } elseif ( isset( $_REQUEST['id'] ) ) {
225
- $ids = array( intval( $_REQUEST['id'] ) );
 
226
  }
227
  $ids = implode( ',', $ids );
228
  if ( ! empty( $ids ) ) {
@@ -240,4 +270,6 @@ class Cartflows_Ca_Cart_Abandonment_Table extends WP_List_Table {
240
  }
241
 
242
  }
 
 
243
  }
14
  class Cartflows_Ca_Cart_Abandonment_Table extends WP_List_Table {
15
 
16
 
17
+ /**
18
+ * Member Variable
19
+ *
20
+ * @var object instance
21
+ */
22
+ private static $instance;
23
+
24
+ /**
25
+ * Initiator
26
+ */
27
+ public static function get_instance() {
28
+ if ( ! isset( self::$instance ) ) {
29
+ self::$instance = new self();
30
+ }
31
+ return self::$instance;
32
+ }
33
 
34
  /**
35
  * Constructor function.
36
  */
37
+ public function __construct() {
38
  global $status, $page;
39
 
40
  parent::__construct(
51
  * @param object $item item.
52
  * @param string $column_name column name.
53
  */
54
+ public function column_default( $item, $column_name ) {
55
  return $item[ $column_name ];
56
  }
57
 
61
  * @param object $item item.
62
  * @return string
63
  */
64
+ public function column_nameSurname( $item ) {
65
 
66
  $item_details = unserialize( $item['other_fields'] );
67
 
102
  * @param object $item - row (key, value array).
103
  * @return HTML
104
  */
105
+ public function column_time( $item ) {
106
  $database_time = $item['time'];
107
  $date_time = new DateTime( $database_time );
108
  $date_time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
117
  * @param object $item item.
118
  * @return HTML
119
  */
120
+ public function column_cb( $item ) {
121
  return sprintf(
122
  '<input type="checkbox" name="id[]" value="%s" />',
123
  esc_html( $item['id'] )
129
  *
130
  * @return array
131
  */
132
+ public function get_bulk_actions() {
133
+ $actions = array(
134
  'delete' => __( 'Delete', 'woo-cart-abandonment-recovery' ),
135
  );
136
+ $filter_table = isset( $_GET['filter_table'] ) ? sanitize_text_field( wp_unslash( $_GET['filter_table'] ) ) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
137
+ if ( ! isset( $filter_table ) || ( isset( $filter_table ) && WCF_CART_ABANDONED_ORDER === $filter_table ) ) {
138
  $actions['unsubscribe'] = __( 'Unsubscribe', 'woo-cart-abandonment-recovery' );
139
  }
140
 
157
  * @param string $from_date from date.
158
  * @param string $to_date to date.
159
  */
160
+ public function prepare_items( $cart_type = WCF_CART_ABANDONED_ORDER, $from_date = '', $to_date = '' ) {
161
  global $wpdb;
162
  $cart_abandonment_table_name = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
163
 
171
 
172
  $this->process_bulk_action();
173
 
174
+ $paged = filter_input( INPUT_GET, 'paged', FILTER_SANITIZE_NUMBER_INT );
175
+ $orderby = filter_input( INPUT_GET, 'orderby', FILTER_SANITIZE_STRING );
176
+ $order = filter_input( INPUT_GET, 'order', FILTER_SANITIZE_STRING );
177
+ $search_term = filter_input( INPUT_GET, 'search_term', FILTER_SANITIZE_STRING );
178
 
179
  $paged = $paged ? max( 0, $paged - 1 ) : 0;
180
  $orderby = ( $orderby && in_array( $orderby, array_keys( $this->get_sortable_columns() ), true ) ) ? $orderby : 'id';
181
  $order = ( $order && in_array( $order, array( 'asc', 'desc' ), true ) ) ? $order : 'desc';
182
 
183
  $this->items = $wpdb->get_results(
184
+ $wpdb->prepare( "SELECT * FROM {$cart_abandonment_table_name} WHERE `order_status` = %s AND DATE(`time`) >= %s AND DATE(`time`) <= %s AND `email` LIKE '%%%s%%' ORDER BY %s %s LIMIT %d OFFSET %d", //phpcs:ignore
185
+ $cart_type,
186
+ $from_date,
187
+ $to_date,
188
+ $wpdb->esc_like( $search_term ),
189
+ $orderby,
190
+ $order,
191
+ $per_page,
192
+ $paged * $per_page
193
+ ),
194
+ ARRAY_A
195
+ );
196
+ $total_items = count( array( $this->items ) );
197
 
198
  // [REQUIRED] configure pagination
199
  $this->set_pagination_args(
203
  'total_pages' => ceil( $total_items / $per_page ),
204
  )
205
  );
206
+
207
+ return $this->items;
208
  }
209
 
210
  /**
212
  *
213
  * @return array
214
  */
215
+ public function get_columns() {
216
  $columns = array(
217
  'cb' => '<input type="checkbox" />',
218
  'nameSurname' => __( 'Name', 'woo-cart-abandonment-recovery' ),
243
  /**
244
  * Processes bulk actions
245
  */
246
+ public function process_bulk_action() {
247
  global $wpdb;
248
  $table_name = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
249
 
250
+ $ids = array();
251
+ $request_id = isset( $_REQUEST['id'] ) ? $_REQUEST['id'] : ''; //phpcs:ignore
252
+ if ( is_array( $request_id ) ) {
253
+ $ids = array_map( 'intval', $request_id );
254
+ } elseif ( isset( $request_id ) ) {
255
+ $ids = array( intval( $request_id ) );
256
  }
257
  $ids = implode( ',', $ids );
258
  if ( ! empty( $ids ) ) {
270
  }
271
 
272
  }
273
+
274
+
275
  }
modules/cart-abandonment/class-cartflows-ca-cart-abandonment.php CHANGED
@@ -24,7 +24,7 @@ class Cartflows_Ca_Cart_Abandonment {
24
  */
25
  public static function get_instance() {
26
  if ( ! isset( self::$instance ) ) {
27
- self::$instance = new self;
28
  }
29
  return self::$instance;
30
  }
@@ -69,14 +69,15 @@ class Cartflows_Ca_Cart_Abandonment {
69
  // Delete coupons.
70
  add_action( 'wp_ajax_wcf_ca_delete_garbage_coupons', array( $this, 'delete_used_and_expired_coupons' ) );
71
 
72
- $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
 
73
  if ( WCF_CA_PAGE_NAME === $page ) {
74
  // Adding filter to add new button to add custom fields.
75
  add_filter( 'mce_buttons', array( $this, 'wcf_filter_mce_button' ) );
76
  add_filter( 'mce_external_plugins', array( $this, 'wcf_filter_mce_plugin' ), 9 );
77
  }
78
 
79
- add_filter( 'cron_schedules', array( $this, 'cartflows_ca_update_order_status_action' ) );
80
 
81
  // Schedule an action if it's not already scheduled.
82
  if ( ! wp_next_scheduled( 'cartflows_ca_update_order_status_action' ) ) {
@@ -91,6 +92,7 @@ class Cartflows_Ca_Cart_Abandonment {
91
 
92
  }
93
 
 
94
  /**
95
  * Update the Order status.
96
  *
@@ -184,7 +186,7 @@ class Cartflows_Ca_Cart_Abandonment {
184
  * @param array $schedules schedules.
185
  * @return mixed
186
  */
187
- function cartflows_ca_update_order_status_action( $schedules ) {
188
 
189
  /**
190
  * Add filter to change the cron interval time to uodate order status.
@@ -208,34 +210,40 @@ class Cartflows_Ca_Cart_Abandonment {
208
  * @param string $free_shipping is free shipping.
209
  * @param string $individual_use use coupon individual.
210
  */
211
- function generate_coupon_code( $discount_type, $amount, $expiry = '', $free_shipping = 'no', $individual_use = 'no' ) {
212
 
213
  $coupon_code = '';
214
 
215
  $coupon_code = wp_generate_password( 8, false, false );
216
 
217
- $coupon = array(
218
- 'post_title' => $coupon_code,
219
- 'post_content' => '',
220
- 'post_status' => 'publish',
221
- 'post_author' => 1,
222
- 'post_type' => 'shop_coupon',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  );
224
 
225
- $new_coupon_id = wp_insert_post( $coupon );
226
-
227
- update_post_meta( $new_coupon_id, 'discount_type', $discount_type );
228
- update_post_meta( $new_coupon_id, 'description', WCF_CA_COUPON_DESCRIPTION );
229
- update_post_meta( $new_coupon_id, 'coupon_amount', $amount );
230
- update_post_meta( $new_coupon_id, 'individual_use', $individual_use );
231
- update_post_meta( $new_coupon_id, 'product_ids', '' );
232
- update_post_meta( $new_coupon_id, 'exclude_product_ids', '' );
233
- update_post_meta( $new_coupon_id, 'usage_limit', '1' );
234
- update_post_meta( $new_coupon_id, 'usage_count', '0' );
235
- update_post_meta( $new_coupon_id, 'date_expires', $expiry );
236
- update_post_meta( $new_coupon_id, 'apply_before_tax', 'yes' );
237
- update_post_meta( $new_coupon_id, 'free_shipping', $free_shipping );
238
- update_post_meta( $new_coupon_id, 'coupon_generated_by', WCF_CA_COUPON_GENERATED_BY );
239
 
240
  return $coupon_code;
241
  }
@@ -243,7 +251,7 @@ class Cartflows_Ca_Cart_Abandonment {
243
  /**
244
  * Unsubscribe the user from the mailing list.
245
  */
246
- function unsubscribe_cart_abandonment_emails() {
247
 
248
  $unsubscribe = filter_input( INPUT_GET, 'unsubscribe', FILTER_VALIDATE_BOOLEAN );
249
  $wcf_ac_token = filter_input( INPUT_GET, 'wcf_ac_token', FILTER_SANITIZE_STRING );
@@ -259,7 +267,7 @@ class Cartflows_Ca_Cart_Abandonment {
259
  array( 'unsubscribed' => true ),
260
  array( 'session_id' => $session_id )
261
  );
262
- wp_die( __( 'You have successfully unsubscribed from our email list.', 'woo-cart-abandonment-recovery' ), __( 'Unsubscribed', 'woo-cart-abandonment-recovery' ) );
263
 
264
  }
265
  }
@@ -273,7 +281,7 @@ class Cartflows_Ca_Cart_Abandonment {
273
  * @param array $plugins mce pluggins.
274
  * @return mixed
275
  */
276
- function wcf_filter_mce_plugin( $plugins ) {
277
  $plugins['cartflows_ac'] = CARTFLOWS_CA_URL . 'admin/assets/js/admin-mce.js';
278
  return $plugins;
279
  }
@@ -284,7 +292,7 @@ class Cartflows_Ca_Cart_Abandonment {
284
  * @param array $buttons mce buttons.
285
  * @return mixed
286
  */
287
- function wcf_filter_mce_button( $buttons ) {
288
  array_push( $buttons, 'cartflows_ac' );
289
  return $buttons;
290
  }
@@ -292,7 +300,7 @@ class Cartflows_Ca_Cart_Abandonment {
292
  /**
293
  * Initialise all the constants
294
  */
295
- function define_cart_abandonment_constants() {
296
  define( 'CARTFLOWS_CART_ABANDONMENT_TRACKING_DIR', CARTFLOWS_CA_DIR . 'modules/cart-abandonment/' );
297
  define( 'CARTFLOWS_CART_ABANDONMENT_TRACKING_URL', CARTFLOWS_CA_URL . 'modules/cart-abandonment/' );
298
  define( 'WCF_CART_ABANDONED_ORDER', 'abandoned' );
@@ -320,14 +328,13 @@ class Cartflows_Ca_Cart_Abandonment {
320
  define( 'WCF_CA_COUPON_GENERATED_BY', 'woo-cart-abandonment-recovery' );
321
  }
322
 
323
-
324
  /**
325
  * Restore cart abandonemnt data on checkout page.
326
  *
327
  * @param array $fields checkout fields values.
328
  * @return array field values
329
  */
330
- function restore_cart_abandonment_data( $fields = array() ) {
331
  global $woocommerce;
332
  $result = array();
333
  // Restore only of user is not logged in.
@@ -409,7 +416,7 @@ class Cartflows_Ca_Cart_Abandonment {
409
  /**
410
  * Add notice to inform user about test email checkout page.
411
  */
412
- function test_email_checkout_page() {
413
 
414
  $wcf_ac_token = filter_input( INPUT_GET, 'wcf_ac_token', FILTER_SANITIZE_STRING );
415
  $token_data = $this->wcf_decode_token( $wcf_ac_token );
@@ -424,7 +431,7 @@ class Cartflows_Ca_Cart_Abandonment {
424
  *
425
  * @return void
426
  */
427
- function cart_abandonment_tracking_script() {
428
 
429
  $wcf_ca_ignore_users = get_option( 'wcf_ca_ignore_users' );
430
  $current_user = wp_get_current_user();
@@ -471,7 +478,7 @@ class Cartflows_Ca_Cart_Abandonment {
471
  * @param string $token token form the url.
472
  * @return bool
473
  */
474
- function is_valid_token( $token ) {
475
  $is_valid = false;
476
  $token_data = $this->wcf_decode_token( $token );
477
  if ( is_array( $token_data ) && array_key_exists( 'wcf_session_id', $token_data ) ) {
@@ -490,7 +497,7 @@ class Cartflows_Ca_Cart_Abandonment {
490
  * @param array $current_cart_data cart data.
491
  * @return bool
492
  */
493
- function check_if_already_purchased_by_email_product_ids( $email_data, $current_cart_data ) {
494
 
495
  global $wpdb;
496
  $current_cart_data = unserialize( $current_cart_data );
@@ -506,7 +513,7 @@ class Cartflows_Ca_Cart_Abandonment {
506
  array(
507
  'billing_email' => $email_data->email,
508
  'status' => array( 'processing', 'completed' ),
509
- 'date_after' => date(
510
  'Y-m-d h:i:s',
511
  strtotime( '-30 days' )
512
  ),
@@ -537,7 +544,7 @@ class Cartflows_Ca_Cart_Abandonment {
537
  *
538
  * @since 1.0.0
539
  */
540
- function update_order_status() {
541
 
542
  global $wpdb;
543
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
@@ -629,7 +636,7 @@ class Cartflows_Ca_Cart_Abandonment {
629
  * @param string $session_id session id.
630
  * @param string $order_status order status.
631
  */
632
- function trigger_zapier_webhook( $session_id, $order_status ) {
633
 
634
  $checkout_details = $this->get_checkout_details( $session_id );
635
 
@@ -655,16 +662,19 @@ class Cartflows_Ca_Cart_Abandonment {
655
  $trigger_details['product_table'] = $this->get_email_product_block( $checkout_details->cart_contents, $checkout_details->cart_total );
656
 
657
  $parameters = http_build_query( $trigger_details );
658
- $args = array(
659
- 'body' => $parameters,
660
- 'timeout' => '5',
661
- 'redirection' => '5',
662
- 'httpversion' => '1.0',
663
- 'blocking' => true,
664
- 'headers' => array(),
665
- 'cookies' => array(),
 
 
 
 
666
  );
667
- wp_remote_post( $url, $args );
668
 
669
  }
670
  }
@@ -675,7 +685,7 @@ class Cartflows_Ca_Cart_Abandonment {
675
  *
676
  * @return array
677
  */
678
- function sanitize_post_data() {
679
 
680
  $input_post_values = array(
681
  'wcf_billing_company' => array(
@@ -771,7 +781,7 @@ class Cartflows_Ca_Cart_Abandonment {
771
  $sanitized_post = array();
772
  foreach ( $input_post_values as $key => $input_post_value ) {
773
 
774
- if ( isset( $_POST[ $key ] ) ) {
775
  $sanitized_post[ $key ] = filter_input( INPUT_POST, $key, $input_post_value['sanitize'] );
776
  } else {
777
  $sanitized_post[ $key ] = $input_post_value['default'];
@@ -787,7 +797,7 @@ class Cartflows_Ca_Cart_Abandonment {
787
  *
788
  * @since 1.0.0
789
  */
790
- function save_cart_abandonment_data() {
791
  check_ajax_referer( 'cartflows_save_cart_abandonment_data', 'security' );
792
  $post_data = $this->sanitize_post_data();
793
  if ( isset( $post_data['wcf_email'] ) ) {
@@ -806,7 +816,7 @@ class Cartflows_Ca_Cart_Abandonment {
806
  $session_id = $session_checkout_details->session_id;
807
  WC()->session->set( 'wcf_session_id', $session_id );
808
  } else {
809
- $session_id = md5( uniqid( rand(), true ) );
810
  }
811
  }
812
 
@@ -814,7 +824,7 @@ class Cartflows_Ca_Cart_Abandonment {
814
 
815
  if ( isset( $session_checkout_details ) && WCF_CART_COMPLETED_ORDER === $session_checkout_details->order_status ) {
816
  WC()->session->__unset( 'wcf_session_id' );
817
- $session_id = md5( uniqid( rand(), true ) );
818
  }
819
 
820
  if ( isset( $checkout_details['cart_total'] ) && $checkout_details['cart_total'] > 0 ) {
@@ -856,7 +866,7 @@ class Cartflows_Ca_Cart_Abandonment {
856
  * @param array $post_data post data.
857
  * @return array
858
  */
859
- function prepare_abandonment_data( $post_data = array() ) {
860
 
861
  if ( function_exists( 'WC' ) ) {
862
 
@@ -906,7 +916,7 @@ class Cartflows_Ca_Cart_Abandonment {
906
  * @param int $order_id Order ID.
907
  * @since 1.0.0
908
  */
909
- function delete_cart_abandonment_data( $order_id ) {
910
 
911
  $acceptable_order_statuses = array( 'completed', 'processing' );
912
  $order = wc_get_order( $order_id );
@@ -976,7 +986,7 @@ class Cartflows_Ca_Cart_Abandonment {
976
  * @param string $session_id session id.
977
  * @param bool $skip_complete skip update query.
978
  */
979
- function skip_future_emails_when_order_is_completed( $session_id, $skip_complete = false ) {
980
 
981
  global $wpdb;
982
  $email_history_table = $wpdb->prefix . CARTFLOWS_CA_EMAIL_HISTORY_TABLE;
@@ -1011,7 +1021,7 @@ class Cartflows_Ca_Cart_Abandonment {
1011
  * @param array $cart_b cart_b.
1012
  * @return bool
1013
  */
1014
- function check_if_similar_cart( $cart_a, $cart_b ) {
1015
  return (
1016
  is_array( $cart_a )
1017
  && is_array( $cart_b )
@@ -1027,7 +1037,7 @@ class Cartflows_Ca_Cart_Abandonment {
1027
  * @param string $wcf_session_id checkout page session id.
1028
  * @since 1.0.0
1029
  */
1030
- function get_checkout_details( $wcf_session_id ) {
1031
  global $wpdb;
1032
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
1033
  $result = $wpdb->get_row(
@@ -1042,7 +1052,7 @@ class Cartflows_Ca_Cart_Abandonment {
1042
  * @param string $email user email.
1043
  * @since 1.0.0
1044
  */
1045
- function get_checkout_details_by_email( $email ) {
1046
  global $wpdb;
1047
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
1048
  $result = $wpdb->get_row(
@@ -1058,7 +1068,7 @@ class Cartflows_Ca_Cart_Abandonment {
1058
  * @param string $value value.
1059
  * @since 1.0.0
1060
  */
1061
- function get_captured_data_by_email( $value ) {
1062
  global $wpdb;
1063
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
1064
  $result = $wpdb->get_row(
@@ -1075,7 +1085,7 @@ class Cartflows_Ca_Cart_Abandonment {
1075
  * @param string $value value.
1076
  * @since 1.0.0
1077
  */
1078
- function get_tracked_data_without_status( $value ) {
1079
  global $wpdb;
1080
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
1081
  $result = $wpdb->get_row(
@@ -1090,22 +1100,15 @@ class Cartflows_Ca_Cart_Abandonment {
1090
  *
1091
  * @since 1.1.5
1092
  */
1093
- function abandoned_cart_tracking_menu() {
1094
-
1095
- $parent_slug = 'woocommerce';
1096
- $page_title = __( 'Cart Abandonment', 'woo-cart-abandonment-recovery' );
1097
- $menu_title = __( 'Cart Abandonment', 'woo-cart-abandonment-recovery' );
1098
- $capability = 'manage_options';
1099
- $menu_slug = WCF_CA_PAGE_NAME;
1100
- $callback = array( $this, 'render_abandoned_cart_tracking' );
1101
 
1102
  add_submenu_page(
1103
- $parent_slug,
1104
- $page_title,
1105
- $menu_title,
1106
- $capability,
1107
- $menu_slug,
1108
- $callback
1109
  );
1110
  }
1111
 
@@ -1114,15 +1117,15 @@ class Cartflows_Ca_Cart_Abandonment {
1114
  *
1115
  * @since 1.1.5
1116
  */
1117
- function render_abandoned_cart_tracking() {
1118
 
1119
- $wcf_list_table = new Cartflows_Ca_Cart_Abandonment_Table();
1120
 
1121
  if ( 'delete' === $wcf_list_table->current_action() ) {
1122
 
1123
  $ids = array();
1124
- if ( isset( $_REQUEST['id'] ) && is_array( $_REQUEST['id'] ) ) {
1125
- $ids = array_map( 'intval', $_REQUEST['id'] );
1126
  }
1127
  $deleted_row_count = empty( $ids ) ? 1 : count( $ids );
1128
 
@@ -1130,7 +1133,7 @@ class Cartflows_Ca_Cart_Abandonment {
1130
  $message = '<div class="notice notice-success is-dismissible" id="message"><p>' . sprintf( __( 'Items deleted: %d', 'woo-cart-abandonment-recovery' ), $deleted_row_count ) . '</p></div>'; // phpcs:ignore
1131
  set_transient( 'wcf_ca_show_message', $message, 5 );
1132
  if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
1133
- wp_safe_redirect( $_SERVER['HTTP_REFERER'] );
1134
  }
1135
  } elseif ( 'unsubscribe' === $wcf_list_table->current_action() ) {
1136
 
@@ -1147,7 +1150,7 @@ class Cartflows_Ca_Cart_Abandonment {
1147
  $message = '<div class="notice notice-success is-dismissible" id="message"><p>' . sprintf( __( 'User(s) unsubscribed successfully!', 'woo-cart-abandonment-recovery' ) ) . '</p></div>'; // phpcs:ignore
1148
  set_transient( 'wcf_ca_show_message', $message, 5 );
1149
  if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
1150
- wp_safe_redirect( $_SERVER['HTTP_REFERER'] );
1151
  }
1152
  }
1153
  ?>
@@ -1163,7 +1166,7 @@ class Cartflows_Ca_Cart_Abandonment {
1163
  *
1164
  * @since 1.1.5
1165
  */
1166
- function abandoned_cart_count() {
1167
  global $wpdb;
1168
  $cart_abandonment_table_name = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
1169
 
@@ -1175,11 +1178,11 @@ class Cartflows_Ca_Cart_Abandonment {
1175
  /**
1176
  * Load analytics scripts.
1177
  */
1178
- function load_admin_cart_abandonment_script() {
1179
 
1180
- $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
1181
 
1182
- if ( ! ( WCF_CA_PAGE_NAME === $page ) ) {
1183
  return;
1184
  }
1185
 
@@ -1190,17 +1193,30 @@ class Cartflows_Ca_Cart_Abandonment {
1190
  'cartflows-ca-email-tmpl-settings',
1191
  CARTFLOWS_CA_URL . 'admin/assets/js/admin-email-templates.js',
1192
  array( 'jquery' ),
1193
- CARTFLOWS_CA_VER
 
1194
  );
1195
 
 
 
 
 
 
 
1196
  $vars = array(
1197
  'url' => 'admin-ajax.php',
 
 
1198
  '_delete_coupon_nonce' => wp_create_nonce( 'wcf_ca_delete_garbage_coupons' ),
1199
  '_confirm_msg' => __( 'Do you really want to delete the used and expired coupons created by Cart Abandonment Plugin?', 'woo-cart-abandonment-recovery' ),
 
1200
 
1201
- );
1202
- wp_localize_script( 'cartflows-ca-email-tmpl-settings', 'wcf_ca_delete_coupons', $vars );
 
1203
 
 
 
1204
  }
1205
 
1206
 
@@ -1216,11 +1232,11 @@ class Cartflows_Ca_Cart_Abandonment {
1216
  $reports_btn_markup = '<style>.wrap{ position:relative;}</style>';
1217
  $reports_btn_markup .= "<div class='wcf-reports-button-wrap'>";
1218
  $reports_btn_markup .= "<button class='wcf-cart-abandonment-reports-popup button button-secondary'>";
1219
- $reports_btn_markup .= esc_html( 'View Report', 'woo-cart-abandonment-recovery' );
1220
  $reports_btn_markup .= '</button>';
1221
  $reports_btn_markup .= '</div>';
1222
 
1223
- echo $reports_btn_markup;
1224
 
1225
  }
1226
 
@@ -1230,17 +1246,17 @@ class Cartflows_Ca_Cart_Abandonment {
1230
  * @param string $interval interval .
1231
  * @return array
1232
  */
1233
- function get_start_end_by_interval( $interval ) {
1234
 
1235
  if ( 'today' === $interval ) {
1236
- $start_date = date( 'Y-m-d' );
1237
- $end_date = date( 'Y-m-d' );
1238
  } else {
1239
 
1240
  $days = $interval;
1241
 
1242
- $start_date = date( 'Y-m-d', strtotime( '-' . $days . ' days' ) );
1243
- $end_date = date( 'Y-m-d' );
1244
  }
1245
 
1246
  return array(
@@ -1258,7 +1274,7 @@ class Cartflows_Ca_Cart_Abandonment {
1258
  * @param string $from_date from date.
1259
  * @param string $to_date to date.
1260
  */
1261
- function get_report_by_type( $type = WCF_CART_ABANDONED_ORDER, $from_date, $to_date ) {
1262
  global $wpdb;
1263
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
1264
  $minutes = wcf_ca()->utils->get_cart_abandonment_tracking_cut_off_time();
@@ -1277,7 +1293,7 @@ class Cartflows_Ca_Cart_Abandonment {
1277
  * @param string $token_data token data.
1278
  * @return string
1279
  */
1280
- function get_checkout_url( $post_id, $token_data ) {
1281
 
1282
  $token = $this->wcf_generate_token( (array) $token_data );
1283
  $checkout_url = get_permalink( $post_id ) . '?wcf_ac_token=' . $token;
@@ -1289,7 +1305,7 @@ class Cartflows_Ca_Cart_Abandonment {
1289
  *
1290
  * @param array $data data.
1291
  */
1292
- function wcf_generate_token( $data ) {
1293
  return urlencode( base64_encode( http_build_query( $data ) ) );
1294
  }
1295
 
@@ -1298,7 +1314,7 @@ class Cartflows_Ca_Cart_Abandonment {
1298
  *
1299
  * @param string $token token.
1300
  */
1301
- function wcf_decode_token( $token ) {
1302
  $token = sanitize_text_field( $token );
1303
  parse_str( base64_decode( urldecode( $token ) ), $token );
1304
  return $token;
@@ -1309,19 +1325,19 @@ class Cartflows_Ca_Cart_Abandonment {
1309
  *
1310
  * @since 1.1.5
1311
  */
1312
- function wcf_display_tabs() {
1313
 
1314
- $action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING );
1315
- $sub_action = filter_input( INPUT_GET, 'sub_action', FILTER_SANITIZE_STRING );
1316
 
1317
- if ( ! $action ) {
1318
- $action = WCF_ACTION_REPORTS;
1319
  $active_settings = '';
1320
  $active_reports = '';
1321
  $active_email_templates = '';
1322
  }
1323
 
1324
- switch ( $action ) {
1325
  case WCF_ACTION_SETTINGS:
1326
  $active_settings = 'nav-tab-active';
1327
  break;
@@ -1399,7 +1415,7 @@ class Cartflows_Ca_Cart_Abandonment {
1399
  *
1400
  * @since 1.1.5
1401
  */
1402
- function wcf_display_settings() {
1403
  ?>
1404
 
1405
  <form method="post" action="options.php">
@@ -1416,7 +1432,7 @@ class Cartflows_Ca_Cart_Abandonment {
1416
  *
1417
  * @since 1.1.5
1418
  */
1419
- function wcf_display_reports() {
1420
 
1421
  $filter = filter_input( INPUT_GET, 'filter', FILTER_SANITIZE_STRING );
1422
  $filter_table = filter_input( INPUT_GET, 'filter_table', FILTER_SANITIZE_STRING );
@@ -1428,29 +1444,30 @@ class Cartflows_Ca_Cart_Abandonment {
1428
  $filter_table = WCF_CART_ABANDONED_ORDER;
1429
  }
1430
 
1431
- $from_date = filter_input( INPUT_GET, 'from_date', FILTER_SANITIZE_STRING );
1432
- $to_date = filter_input( INPUT_GET, 'to_date', FILTER_SANITIZE_STRING );
 
1433
 
1434
  switch ( $filter ) {
1435
 
1436
  case 'yesterday':
1437
- $to_date = date( 'Y-m-d', strtotime( '-1 days' ) );
1438
  $from_date = $to_date;
1439
  break;
1440
  case 'today':
1441
- $to_date = date( 'Y-m-d' );
1442
  $from_date = $to_date;
1443
  break;
1444
  case 'last_week':
1445
- $from_date = date( 'Y-m-d', strtotime( '-7 days' ) );
1446
- $to_date = date( 'Y-m-d' );
1447
  break;
1448
  case 'last_month':
1449
- $from_date = date( 'Y-m-d', strtotime( '-1 months' ) );
1450
- $to_date = date( 'Y-m-d' );
1451
  break;
1452
  case 'custom':
1453
- $to_date = $to_date ? $to_date : date( 'Y-m-d' );
1454
  $from_date = $from_date ? $from_date : $to_date;
1455
  break;
1456
 
@@ -1460,9 +1477,17 @@ class Cartflows_Ca_Cart_Abandonment {
1460
  $recovered_report = $this->get_report_by_type( WCF_CART_COMPLETED_ORDER, $from_date, $to_date );
1461
  $lost_report = $this->get_report_by_type( WCF_CART_LOST_ORDER, $from_date, $to_date );
1462
 
1463
- $wcf_list_table = new Cartflows_Ca_Cart_Abandonment_Table();
1464
  $wcf_list_table->prepare_items( $filter_table, $from_date, $to_date );
1465
 
 
 
 
 
 
 
 
 
1466
  $conversion_rate = 0;
1467
  $total_orders = ( $recovered_report['no_of_orders'] + $abandoned_report['no_of_orders'] + $lost_report['no_of_orders'] );
1468
  if ( $total_orders ) {
@@ -1473,13 +1498,14 @@ class Cartflows_Ca_Cart_Abandonment {
1473
  $conversion_rate = number_format_i18n( $conversion_rate, 2 );
1474
  $currency_symbol = get_woocommerce_currency_symbol();
1475
  require_once CARTFLOWS_CART_ABANDONMENT_TRACKING_DIR . 'includes/admin/cartflows-cart-abandonment-reports.php';
 
1476
  }
1477
 
1478
 
1479
  /**
1480
  * Show report details for specific order.
1481
  */
1482
- function wcf_display_report_details() {
1483
 
1484
  $sesson_id = filter_input( INPUT_GET, 'session_id', FILTER_SANITIZE_STRING );
1485
 
@@ -1488,7 +1514,7 @@ class Cartflows_Ca_Cart_Abandonment {
1488
  $user_details = (object) unserialize( $details->other_fields );
1489
  $scheduled_emails = $this->fetch_scheduled_emails( $sesson_id );
1490
 
1491
- require_once CARTFLOWS_CART_ABANDONMENT_TRACKING_DIR . 'includes/admin/cartflows-ca-single-report-details.php';
1492
  }
1493
 
1494
  }
@@ -1496,7 +1522,7 @@ class Cartflows_Ca_Cart_Abandonment {
1496
  /**
1497
  * Check and show warning message if cart abandonment is disabled.
1498
  */
1499
- function wcf_show_warning_ca() {
1500
  $settings_url = add_query_arg(
1501
  array(
1502
  'page' => WCF_CA_PAGE_NAME,
@@ -1520,7 +1546,7 @@ class Cartflows_Ca_Cart_Abandonment {
1520
  /**
1521
  * Callback trigger event to send the emails.
1522
  */
1523
- function send_emails_to_callback() {
1524
 
1525
  global $wpdb;
1526
  $email_history_table = $wpdb->prefix . CARTFLOWS_CA_EMAIL_HISTORY_TABLE;
@@ -1562,28 +1588,26 @@ class Cartflows_Ca_Cart_Abandonment {
1562
 
1563
  $email_data = new stdClass();
1564
  $current_user = wp_get_current_user();
1565
- $user_data = array(
1566
- 'wcf_first_name' => $current_user->user_firstname,
1567
- 'wcf_last_name' => $current_user->user_lastname,
1568
- );
1569
  $email_data->email_template_id = null;
1570
  $email_data->checkout_id = wc_get_page_id( 'checkout' );
1571
  $email_data->session_id = 'dummy-session-id';
1572
- $email_data->email_template_id = null;
1573
-
1574
- $email_send_to = filter_input( INPUT_POST, 'email_send_to', FILTER_SANITIZE_EMAIL );
1575
- $email_data->email = $email_send_to ? $email_send_to : $current_user->user_email;
1576
- $email_data->email_body = filter_input( INPUT_POST, 'email_body', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
1577
- $email_data->email_subject = filter_input( INPUT_POST, 'email_subject', FILTER_SANITIZE_STRING );
1578
- $email_data->email_body = html_entity_decode( $email_data->email_body );
1579
-
1580
- $email_data->other_fields = serialize( $user_data );
 
 
1581
  if ( ! WC()->cart->get_cart_contents_count() ) {
1582
  $args = array(
1583
  'posts_per_page' => 1,
1584
  'orderby' => 'rand',
1585
  'post_type' => 'product',
1586
- 'meta_query' => array(
1587
  // Exclude out of stock products.
1588
  array(
1589
  'key' => '_stock_status',
@@ -1591,7 +1615,7 @@ class Cartflows_Ca_Cart_Abandonment {
1591
  'compare' => 'NOT IN',
1592
  ),
1593
  ),
1594
- 'tax_query' => array(
1595
  array(
1596
  'taxonomy' => 'product_type',
1597
  'field' => 'slug',
@@ -1620,7 +1644,7 @@ class Cartflows_Ca_Cart_Abandonment {
1620
  * @param boolean $preview_email preview email.
1621
  * @since 1.0.0
1622
  */
1623
- function send_email_templates( $email_data, $preview_email = false ) {
1624
 
1625
  if ( $preview_email ) {
1626
  $email_data = $this->create_dummy_session_for_preview_email();
@@ -1644,7 +1668,7 @@ class Cartflows_Ca_Cart_Abandonment {
1644
  $user_last_name = ucfirst( $other_fields['wcf_last_name'] );
1645
  $user_full_name = trim( $user_first_name . ' ' . $user_last_name );
1646
 
1647
- $subject_email_preview = stripslashes( html_entity_decode( $email_data->email_subject, ENT_QUOTES ) );
1648
  $subject_email_preview = convert_smilies( $subject_email_preview );
1649
  $subject_email_preview = str_replace( '{{customer.firstname}}', $user_first_name, $subject_email_preview );
1650
  $body_email_preview = convert_smilies( $email_data->email_body );
@@ -1679,12 +1703,12 @@ class Cartflows_Ca_Cart_Abandonment {
1679
 
1680
  $current_time_stamp = $email_data->time;
1681
  $body_email_preview = str_replace( '{{cart.abandoned_date}}', $current_time_stamp, $body_email_preview );
1682
- $unsubscribe_element = '<a target="_blank" style="color: lightgray" href="' . $checkout_url . '&unsubscribe=true' . '">' . __( 'Unsubscribe', 'woo-cart-abandonment-recovery' ) . '</a>';
1683
  $body_email_preview = str_replace( '{{cart.unsubscribe}}', $unsubscribe_element, $body_email_preview );
1684
  $body_email_preview = str_replace( 'http://{{cart.checkout_url}}', '{{cart.checkout_url}}', $body_email_preview );
1685
  $body_email_preview = str_replace( 'https://{{cart.checkout_url}}', '{{cart.checkout_url}}', $body_email_preview );
1686
  $body_email_preview = str_replace( '{{cart.checkout_url}}', $checkout_url, $body_email_preview );
1687
- $host = parse_url( get_site_url() );
1688
  $body_email_preview = str_replace( '{{site.url}}', $host['host'], $body_email_preview );
1689
 
1690
  if ( false !== strpos( $body_email_preview, '{{cart.product.names}}' ) ) {
@@ -1731,7 +1755,7 @@ class Cartflows_Ca_Cart_Abandonment {
1731
  *
1732
  * @param object $cart_contents user cart details.
1733
  */
1734
- function get_comma_separated_products( $cart_contents ) {
1735
  $cart_comma_string = '';
1736
  if ( ! $cart_contents ) {
1737
  return $cart_comma_string;
@@ -1767,7 +1791,7 @@ class Cartflows_Ca_Cart_Abandonment {
1767
  * @param float $cart_total user cart total.
1768
  * @return string
1769
  */
1770
- function get_email_product_block( $cart_contents, $cart_total ) {
1771
 
1772
  $cart_items = unserialize( $cart_contents );
1773
 
@@ -1794,18 +1818,15 @@ class Cartflows_Ca_Cart_Abandonment {
1794
  foreach ( $cart_items as $cart_item ) {
1795
 
1796
  if ( isset( $cart_item['product_id'] ) && isset( $cart_item['quantity'] ) && isset( $cart_item['line_total'] ) ) {
1797
- $product = wc_get_product( $cart_item['product_id'] );
1798
- } else {
1799
- continue;
1800
- }
1801
 
1802
- $tr = $tr . '<tr style=' . $style . ' align="center">
1803
- <td style="' . $style . '"><img class="demo_img" style="' . $product_image_style . '" src="' . esc_url( get_the_post_thumbnail_url( $product->get_id() ) ) . '"></td>
1804
- <td style="' . $style . '">' . $product->get_title() . '</td>
1805
  <td style="' . $style . '"> ' . $cart_item['quantity'] . ' </td>
1806
  <td style="' . $style . '">' . $currency_symbol . number_format_i18n( $cart_item['line_total'], 2 ) . '</td>
1807
  <td style="' . $style . '" >' . $currency_symbol . number_format_i18n( $cart_item['line_total'], 2 ) . '</td>
1808
  </tr> ';
 
1809
  }
1810
 
1811
  /**
@@ -1837,7 +1858,7 @@ class Cartflows_Ca_Cart_Abandonment {
1837
  * @param float $cart_total user cart total.
1838
  * @return string
1839
  */
1840
- function get_admin_product_block( $cart_contents, $cart_total ) {
1841
 
1842
  $cart_items = unserialize( $cart_contents );
1843
 
@@ -1854,22 +1875,19 @@ class Cartflows_Ca_Cart_Abandonment {
1854
  foreach ( $cart_items as $cart_item ) {
1855
 
1856
  if ( isset( $cart_item['product_id'] ) && isset( $cart_item['quantity'] ) && isset( $cart_item['line_total'] ) && isset( $cart_item['line_subtotal'] ) ) {
1857
- $product = wc_get_product( $cart_item['product_id'] );
1858
- } else {
1859
- continue;
1860
- }
1861
 
1862
- $discount = number_format_i18n( $discount + ( $cart_item['line_subtotal'] - $cart_item['line_total'] ), 2 );
1863
- $total = number_format_i18n( $total + $cart_item['line_subtotal'], 2 );
1864
- $tax = number_format_i18n( $tax + $cart_item['line_tax'], 2 );
1865
 
1866
- $tr = $tr . '<tr align="center">
1867
- <td ><img class="demo_img" width="42" height="42" src=" ' . esc_url( get_the_post_thumbnail_url( $product->get_id() ) ) . ' "/></td>
1868
- <td >' . $product->get_title() . '</td>
1869
  <td > ' . $cart_item['quantity'] . ' </td>
1870
  <td >' . $currency_symbol . number_format_i18n( $cart_item['line_total'], 2 ) . '</td>
1871
  <td >' . $currency_symbol . number_format_i18n( $cart_item['line_total'], 2 ) . '</td>
1872
  </tr> ';
 
1873
  }
1874
 
1875
  return '<table align="left" cellspacing="0" class="widefat fixed striped posts">
@@ -1911,7 +1929,7 @@ class Cartflows_Ca_Cart_Abandonment {
1911
  * @param integer $session_id user session id.
1912
  * @param boolean $force_reschedule force reschedule.
1913
  */
1914
- function schedule_emails( $session_id, $force_reschedule = false ) {
1915
 
1916
  $checkout_details = $this->get_checkout_details( $session_id );
1917
 
@@ -1920,7 +1938,7 @@ class Cartflows_Ca_Cart_Abandonment {
1920
  }
1921
  $scheduled_time_from = current_time( WCF_CA_DATETIME_FORMAT );
1922
  $scheduled_emails = $this->fetch_scheduled_emails( $session_id );
1923
- $scheduled_templates = array_column( $scheduled_emails, 'template_id' );
1924
  $scheduled_time_from = $checkout_details->time;
1925
 
1926
  $email_tmpl = Cartflows_Ca_Email_Templates::get_instance();
@@ -1937,7 +1955,7 @@ class Cartflows_Ca_Cart_Abandonment {
1937
  }
1938
 
1939
  $timestamp_str = '+' . $template->frequency . ' ' . $template->frequency_unit . 'S';
1940
- $scheduled_time = date( WCF_CA_DATETIME_FORMAT, strtotime( $scheduled_time_from . $timestamp_str ) );
1941
  $discount_type = $email_tmpl->get_email_template_meta_by_key( $template->id, 'discount_type' );
1942
  $discount_type = isset( $discount_type->meta_value ) ? $discount_type->meta_value : '';
1943
  $amount = $email_tmpl->get_email_template_meta_by_key( $template->id, 'coupon_amount' );
@@ -1982,7 +2000,7 @@ class Cartflows_Ca_Cart_Abandonment {
1982
  * @param boolean $fetch_sent sfetch sent emails.
1983
  * @return array|object|null
1984
  */
1985
- function fetch_scheduled_emails( $session_id, $fetch_sent = false ) {
1986
  global $wpdb;
1987
  $email_history_table = $wpdb->prefix . CARTFLOWS_CA_EMAIL_HISTORY_TABLE;
1988
  $email_template_table = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_TABLE;
@@ -2000,7 +2018,7 @@ class Cartflows_Ca_Cart_Abandonment {
2000
  /**
2001
  * Delete orders from cart abandonment table whose cart total is zero and order status is abandoned.
2002
  */
2003
- function delete_empty_abandoned_order() {
2004
  global $wpdb;
2005
 
2006
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
@@ -2016,7 +2034,7 @@ class Cartflows_Ca_Cart_Abandonment {
2016
  /**
2017
  * Check if transient is set for delete garbage coupons.
2018
  */
2019
- function delete_used_and_expired_coupons() {
2020
  $is_ajax_request = wp_doing_ajax();
2021
  $is_transient_set = false;
2022
  global $wpdb;
@@ -2051,9 +2069,10 @@ class Cartflows_Ca_Cart_Abandonment {
2051
  /**
2052
  * Set transient and delete garbage coupons.
2053
  */
2054
- function delete_garbage_coupons() {
2055
 
2056
  global $wpdb;
 
2057
  $coupon_generated_by = WCF_CA_COUPON_GENERATED_BY;
2058
  $timestamp = time();
2059
  $post_type = 'shop_coupon';
@@ -2065,13 +2084,14 @@ class Cartflows_Ca_Cart_Abandonment {
2065
  Max(CASE WHEN pm.meta_key = 'date_expires' AND p.`ID` = pm.`post_id` THEN pm.meta_value END) AS expiry_date,
2066
  Max(CASE WHEN pm.meta_key = 'usage_limit' AND p.`ID` = pm.`post_id` THEN pm.meta_value END) AS usage_limit,
2067
  Max(CASE WHEN pm.meta_key = 'usage_count' AND p.`ID` = pm.`post_id` THEN pm.meta_value END) AS total_usaged,
 
2068
  Max(CASE WHEN pm.meta_key = 'coupon_generated_by' AND p.`ID` = pm.`post_id` THEN pm.meta_value END) AS coupon_generated_by
2069
  FROM wp_posts AS p
2070
  INNER JOIN wp_postmeta AS pm ON p.ID = pm.post_id
2071
  WHERE p.`post_type` = %s
2072
 
2073
  GROUP BY p.ID
2074
- ) AS final_res WHERE coupon_generated_by IS NOT NULL AND coupon_generated_by = %s AND ( ( usage_limit = total_usaged ) OR ( expiry_date <= %d AND expiry_date != '') )",
2075
  $post_type,
2076
  $coupon_generated_by,
2077
  $timestamp
@@ -2080,6 +2100,73 @@ class Cartflows_Ca_Cart_Abandonment {
2080
  return $coupons;
2081
  }
2082
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2083
  }
2084
 
2085
  Cartflows_Ca_Cart_Abandonment::get_instance();
24
  */
25
  public static function get_instance() {
26
  if ( ! isset( self::$instance ) ) {
27
+ self::$instance = new self();
28
  }
29
  return self::$instance;
30
  }
69
  // Delete coupons.
70
  add_action( 'wp_ajax_wcf_ca_delete_garbage_coupons', array( $this, 'delete_used_and_expired_coupons' ) );
71
 
72
+ $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
73
+ $action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING );
74
  if ( WCF_CA_PAGE_NAME === $page ) {
75
  // Adding filter to add new button to add custom fields.
76
  add_filter( 'mce_buttons', array( $this, 'wcf_filter_mce_button' ) );
77
  add_filter( 'mce_external_plugins', array( $this, 'wcf_filter_mce_plugin' ), 9 );
78
  }
79
 
80
+ add_filter( 'cron_schedules', array( $this, 'cartflows_ca_update_order_status_action' ) ); //phpcs:ignore WordPress.WP.CronInterval.ChangeDetected
81
 
82
  // Schedule an action if it's not already scheduled.
83
  if ( ! wp_next_scheduled( 'cartflows_ca_update_order_status_action' ) ) {
92
 
93
  }
94
 
95
+
96
  /**
97
  * Update the Order status.
98
  *
186
  * @param array $schedules schedules.
187
  * @return mixed
188
  */
189
+ public function cartflows_ca_update_order_status_action( $schedules ) {
190
 
191
  /**
192
  * Add filter to change the cron interval time to uodate order status.
210
  * @param string $free_shipping is free shipping.
211
  * @param string $individual_use use coupon individual.
212
  */
213
+ public function generate_coupon_code( $discount_type, $amount, $expiry = '', $free_shipping = 'no', $individual_use = 'no' ) {
214
 
215
  $coupon_code = '';
216
 
217
  $coupon_code = wp_generate_password( 8, false, false );
218
 
219
+ $new_coupon_id = wp_insert_post(
220
+ array(
221
+ 'post_title' => $coupon_code,
222
+ 'post_content' => '',
223
+ 'post_status' => 'publish',
224
+ 'post_author' => 1,
225
+ 'post_type' => 'shop_coupon',
226
+ )
227
+ );
228
+
229
+ $coupon_post_data = array(
230
+ 'discount_type' => $discount_type,
231
+ 'description' => WCF_CA_COUPON_DESCRIPTION,
232
+ 'coupon_amount' => $amount,
233
+ 'individual_use' => $individual_use,
234
+ 'product_ids' => '',
235
+ 'exclude_product_ids' => '',
236
+ 'usage_limit' => '1',
237
+ 'usage_count' => '0',
238
+ 'date_expires' => $expiry,
239
+ 'apply_before_tax' => 'yes',
240
+ 'free_shipping' => $free_shipping,
241
+ 'coupon_generated_by' => WCF_CA_COUPON_GENERATED_BY,
242
  );
243
 
244
+ foreach ( $coupon_post_data as $key => $value ) {
245
+ update_post_meta( $new_coupon_id, $key, $value );
246
+ }
 
 
 
 
 
 
 
 
 
 
 
247
 
248
  return $coupon_code;
249
  }
251
  /**
252
  * Unsubscribe the user from the mailing list.
253
  */
254
+ public function unsubscribe_cart_abandonment_emails() {
255
 
256
  $unsubscribe = filter_input( INPUT_GET, 'unsubscribe', FILTER_VALIDATE_BOOLEAN );
257
  $wcf_ac_token = filter_input( INPUT_GET, 'wcf_ac_token', FILTER_SANITIZE_STRING );
267
  array( 'unsubscribed' => true ),
268
  array( 'session_id' => $session_id )
269
  );
270
+ wp_die( esc_html__( 'You have successfully unsubscribed from our email list.', 'woo-cart-abandonment-recovery' ), esc_html__( 'Unsubscribed', 'woo-cart-abandonment-recovery' ) );
271
 
272
  }
273
  }
281
  * @param array $plugins mce pluggins.
282
  * @return mixed
283
  */
284
+ public function wcf_filter_mce_plugin( $plugins ) {
285
  $plugins['cartflows_ac'] = CARTFLOWS_CA_URL . 'admin/assets/js/admin-mce.js';
286
  return $plugins;
287
  }
292
  * @param array $buttons mce buttons.
293
  * @return mixed
294
  */
295
+ public function wcf_filter_mce_button( $buttons ) {
296
  array_push( $buttons, 'cartflows_ac' );
297
  return $buttons;
298
  }
300
  /**
301
  * Initialise all the constants
302
  */
303
+ public function define_cart_abandonment_constants() {
304
  define( 'CARTFLOWS_CART_ABANDONMENT_TRACKING_DIR', CARTFLOWS_CA_DIR . 'modules/cart-abandonment/' );
305
  define( 'CARTFLOWS_CART_ABANDONMENT_TRACKING_URL', CARTFLOWS_CA_URL . 'modules/cart-abandonment/' );
306
  define( 'WCF_CART_ABANDONED_ORDER', 'abandoned' );
328
  define( 'WCF_CA_COUPON_GENERATED_BY', 'woo-cart-abandonment-recovery' );
329
  }
330
 
 
331
  /**
332
  * Restore cart abandonemnt data on checkout page.
333
  *
334
  * @param array $fields checkout fields values.
335
  * @return array field values
336
  */
337
+ public function restore_cart_abandonment_data( $fields = array() ) {
338
  global $woocommerce;
339
  $result = array();
340
  // Restore only of user is not logged in.
416
  /**
417
  * Add notice to inform user about test email checkout page.
418
  */
419
+ public function test_email_checkout_page() {
420
 
421
  $wcf_ac_token = filter_input( INPUT_GET, 'wcf_ac_token', FILTER_SANITIZE_STRING );
422
  $token_data = $this->wcf_decode_token( $wcf_ac_token );
431
  *
432
  * @return void
433
  */
434
+ public function cart_abandonment_tracking_script() {
435
 
436
  $wcf_ca_ignore_users = get_option( 'wcf_ca_ignore_users' );
437
  $current_user = wp_get_current_user();
478
  * @param string $token token form the url.
479
  * @return bool
480
  */
481
+ public function is_valid_token( $token ) {
482
  $is_valid = false;
483
  $token_data = $this->wcf_decode_token( $token );
484
  if ( is_array( $token_data ) && array_key_exists( 'wcf_session_id', $token_data ) ) {
497
  * @param array $current_cart_data cart data.
498
  * @return bool
499
  */
500
+ public function check_if_already_purchased_by_email_product_ids( $email_data, $current_cart_data ) {
501
 
502
  global $wpdb;
503
  $current_cart_data = unserialize( $current_cart_data );
513
  array(
514
  'billing_email' => $email_data->email,
515
  'status' => array( 'processing', 'completed' ),
516
+ 'date_after' => gmdate(
517
  'Y-m-d h:i:s',
518
  strtotime( '-30 days' )
519
  ),
544
  *
545
  * @since 1.0.0
546
  */
547
+ public function update_order_status() {
548
 
549
  global $wpdb;
550
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
636
  * @param string $session_id session id.
637
  * @param string $order_status order status.
638
  */
639
+ public function trigger_zapier_webhook( $session_id, $order_status ) {
640
 
641
  $checkout_details = $this->get_checkout_details( $session_id );
642
 
662
  $trigger_details['product_table'] = $this->get_email_product_block( $checkout_details->cart_contents, $checkout_details->cart_total );
663
 
664
  $parameters = http_build_query( $trigger_details );
665
+
666
+ wp_remote_post(
667
+ $url,
668
+ array(
669
+ 'body' => $parameters,
670
+ 'timeout' => '5',
671
+ 'redirection' => '5',
672
+ 'httpversion' => '1.0',
673
+ 'blocking' => true,
674
+ 'headers' => array(),
675
+ 'cookies' => array(),
676
+ )
677
  );
 
678
 
679
  }
680
  }
685
  *
686
  * @return array
687
  */
688
+ public function sanitize_post_data() {
689
 
690
  $input_post_values = array(
691
  'wcf_billing_company' => array(
781
  $sanitized_post = array();
782
  foreach ( $input_post_values as $key => $input_post_value ) {
783
 
784
+ if ( isset( $_POST[ $key ] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Missing
785
  $sanitized_post[ $key ] = filter_input( INPUT_POST, $key, $input_post_value['sanitize'] );
786
  } else {
787
  $sanitized_post[ $key ] = $input_post_value['default'];
797
  *
798
  * @since 1.0.0
799
  */
800
+ public function save_cart_abandonment_data() {
801
  check_ajax_referer( 'cartflows_save_cart_abandonment_data', 'security' );
802
  $post_data = $this->sanitize_post_data();
803
  if ( isset( $post_data['wcf_email'] ) ) {
816
  $session_id = $session_checkout_details->session_id;
817
  WC()->session->set( 'wcf_session_id', $session_id );
818
  } else {
819
+ $session_id = md5( uniqid( wp_rand(), true ) );
820
  }
821
  }
822
 
824
 
825
  if ( isset( $session_checkout_details ) && WCF_CART_COMPLETED_ORDER === $session_checkout_details->order_status ) {
826
  WC()->session->__unset( 'wcf_session_id' );
827
+ $session_id = md5( uniqid( wp_rand(), true ) );
828
  }
829
 
830
  if ( isset( $checkout_details['cart_total'] ) && $checkout_details['cart_total'] > 0 ) {
866
  * @param array $post_data post data.
867
  * @return array
868
  */
869
+ public function prepare_abandonment_data( $post_data = array() ) {
870
 
871
  if ( function_exists( 'WC' ) ) {
872
 
916
  * @param int $order_id Order ID.
917
  * @since 1.0.0
918
  */
919
+ public function delete_cart_abandonment_data( $order_id ) {
920
 
921
  $acceptable_order_statuses = array( 'completed', 'processing' );
922
  $order = wc_get_order( $order_id );
986
  * @param string $session_id session id.
987
  * @param bool $skip_complete skip update query.
988
  */
989
+ public function skip_future_emails_when_order_is_completed( $session_id, $skip_complete = false ) {
990
 
991
  global $wpdb;
992
  $email_history_table = $wpdb->prefix . CARTFLOWS_CA_EMAIL_HISTORY_TABLE;
1021
  * @param array $cart_b cart_b.
1022
  * @return bool
1023
  */
1024
+ public function check_if_similar_cart( $cart_a, $cart_b ) {
1025
  return (
1026
  is_array( $cart_a )
1027
  && is_array( $cart_b )
1037
  * @param string $wcf_session_id checkout page session id.
1038
  * @since 1.0.0
1039
  */
1040
+ public function get_checkout_details( $wcf_session_id ) {
1041
  global $wpdb;
1042
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
1043
  $result = $wpdb->get_row(
1052
  * @param string $email user email.
1053
  * @since 1.0.0
1054
  */
1055
+ public function get_checkout_details_by_email( $email ) {
1056
  global $wpdb;
1057
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
1058
  $result = $wpdb->get_row(
1068
  * @param string $value value.
1069
  * @since 1.0.0
1070
  */
1071
+ public function get_captured_data_by_email( $value ) {
1072
  global $wpdb;
1073
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
1074
  $result = $wpdb->get_row(
1085
  * @param string $value value.
1086
  * @since 1.0.0
1087
  */
1088
+ public function get_tracked_data_without_status( $value ) {
1089
  global $wpdb;
1090
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
1091
  $result = $wpdb->get_row(
1100
  *
1101
  * @since 1.1.5
1102
  */
1103
+ public function abandoned_cart_tracking_menu() {
 
 
 
 
 
 
 
1104
 
1105
  add_submenu_page(
1106
+ 'woocommerce',
1107
+ __( 'Cart Abandonment', 'woo-cart-abandonment-recovery' ),
1108
+ __( 'Cart Abandonment', 'woo-cart-abandonment-recovery' ),
1109
+ 'manage_options',
1110
+ WCF_CA_PAGE_NAME,
1111
+ array( $this, 'render_abandoned_cart_tracking' )
1112
  );
1113
  }
1114
 
1117
  *
1118
  * @since 1.1.5
1119
  */
1120
+ public function render_abandoned_cart_tracking() {
1121
 
1122
+ $wcf_list_table = Cartflows_Ca_Cart_Abandonment_Table::get_instance();
1123
 
1124
  if ( 'delete' === $wcf_list_table->current_action() ) {
1125
 
1126
  $ids = array();
1127
+ if ( isset( $_REQUEST['id'] ) && is_array( $_REQUEST['id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
1128
+ $ids = array_map( 'intval', $_REQUEST['id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
1129
  }
1130
  $deleted_row_count = empty( $ids ) ? 1 : count( $ids );
1131
 
1133
  $message = '<div class="notice notice-success is-dismissible" id="message"><p>' . sprintf( __( 'Items deleted: %d', 'woo-cart-abandonment-recovery' ), $deleted_row_count ) . '</p></div>'; // phpcs:ignore
1134
  set_transient( 'wcf_ca_show_message', $message, 5 );
1135
  if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
1136
+ wp_safe_redirect( esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) );
1137
  }
1138
  } elseif ( 'unsubscribe' === $wcf_list_table->current_action() ) {
1139
 
1150
  $message = '<div class="notice notice-success is-dismissible" id="message"><p>' . sprintf( __( 'User(s) unsubscribed successfully!', 'woo-cart-abandonment-recovery' ) ) . '</p></div>'; // phpcs:ignore
1151
  set_transient( 'wcf_ca_show_message', $message, 5 );
1152
  if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
1153
+ wp_safe_redirect( esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) );
1154
  }
1155
  }
1156
  ?>
1166
  *
1167
  * @since 1.1.5
1168
  */
1169
+ public function abandoned_cart_count() {
1170
  global $wpdb;
1171
  $cart_abandonment_table_name = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
1172
 
1178
  /**
1179
  * Load analytics scripts.
1180
  */
1181
+ public function load_admin_cart_abandonment_script() {
1182
 
1183
+ $wcar_page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
1184
 
1185
+ if ( ! ( WCF_CA_PAGE_NAME === $wcar_page ) ) {
1186
  return;
1187
  }
1188
 
1193
  'cartflows-ca-email-tmpl-settings',
1194
  CARTFLOWS_CA_URL . 'admin/assets/js/admin-email-templates.js',
1195
  array( 'jquery' ),
1196
+ CARTFLOWS_CA_VER,
1197
+ false
1198
  );
1199
 
1200
+ if ( WCF_CA_PAGE_NAME === $wcar_page ) {
1201
+ $filter_table = filter_input( INPUT_GET, 'filter_table', FILTER_SANITIZE_STRING );
1202
+ $from_date = filter_input( INPUT_GET, 'from_date', FILTER_SANITIZE_STRING );
1203
+ $to_date = filter_input( INPUT_GET, 'to_date', FILTER_SANITIZE_STRING );
1204
+ }
1205
+
1206
  $vars = array(
1207
  'url' => 'admin-ajax.php',
1208
+
1209
+ // For delete coupons.
1210
  '_delete_coupon_nonce' => wp_create_nonce( 'wcf_ca_delete_garbage_coupons' ),
1211
  '_confirm_msg' => __( 'Do you really want to delete the used and expired coupons created by Cart Abandonment Plugin?', 'woo-cart-abandonment-recovery' ),
1212
+ '_confirm_msg_export' => __( 'Do you really want to export orders?', 'woo-cart-abandonment-recovery' ),
1213
 
1214
+ // For Search orders.
1215
+ '_search_button_nonce' => wp_create_nonce( 'wcf_ca_search_orders' ),
1216
+ '_result_msg' => __( 'No such order is found.', 'woo-cart-abandonment-recovery' ),
1217
 
1218
+ );
1219
+ wp_localize_script( 'cartflows-ca-email-tmpl-settings', 'wcf_ca_localized_vars', $vars );
1220
  }
1221
 
1222
 
1232
  $reports_btn_markup = '<style>.wrap{ position:relative;}</style>';
1233
  $reports_btn_markup .= "<div class='wcf-reports-button-wrap'>";
1234
  $reports_btn_markup .= "<button class='wcf-cart-abandonment-reports-popup button button-secondary'>";
1235
+ $reports_btn_markup .= esc_html__( 'View Report', 'woo-cart-abandonment-recovery' );
1236
  $reports_btn_markup .= '</button>';
1237
  $reports_btn_markup .= '</div>';
1238
 
1239
+ echo wp_kses_post( $reports_btn_markup );
1240
 
1241
  }
1242
 
1246
  * @param string $interval interval .
1247
  * @return array
1248
  */
1249
+ public function get_start_end_by_interval( $interval ) {
1250
 
1251
  if ( 'today' === $interval ) {
1252
+ $start_date = gmdate( 'Y-m-d' );
1253
+ $end_date = gmdate( 'Y-m-d' );
1254
  } else {
1255
 
1256
  $days = $interval;
1257
 
1258
+ $start_date = gmdate( 'Y-m-d', strtotime( '-' . $days . ' days' ) );
1259
+ $end_date = gmdate( 'Y-m-d' );
1260
  }
1261
 
1262
  return array(
1274
  * @param string $from_date from date.
1275
  * @param string $to_date to date.
1276
  */
1277
+ public function get_report_by_type( $type = WCF_CART_ABANDONED_ORDER, $from_date, $to_date ) {
1278
  global $wpdb;
1279
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
1280
  $minutes = wcf_ca()->utils->get_cart_abandonment_tracking_cut_off_time();
1293
  * @param string $token_data token data.
1294
  * @return string
1295
  */
1296
+ public function get_checkout_url( $post_id, $token_data ) {
1297
 
1298
  $token = $this->wcf_generate_token( (array) $token_data );
1299
  $checkout_url = get_permalink( $post_id ) . '?wcf_ac_token=' . $token;
1305
  *
1306
  * @param array $data data.
1307
  */
1308
+ public function wcf_generate_token( $data ) {
1309
  return urlencode( base64_encode( http_build_query( $data ) ) );
1310
  }
1311
 
1314
  *
1315
  * @param string $token token.
1316
  */
1317
+ public function wcf_decode_token( $token ) {
1318
  $token = sanitize_text_field( $token );
1319
  parse_str( base64_decode( urldecode( $token ) ), $token );
1320
  return $token;
1325
  *
1326
  * @since 1.1.5
1327
  */
1328
+ public function wcf_display_tabs() {
1329
 
1330
+ $wcar_action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING );
1331
+ $sub_action = filter_input( INPUT_GET, 'sub_action', FILTER_SANITIZE_STRING );
1332
 
1333
+ if ( ! $wcar_action ) {
1334
+ $wcar_action = WCF_ACTION_REPORTS;
1335
  $active_settings = '';
1336
  $active_reports = '';
1337
  $active_email_templates = '';
1338
  }
1339
 
1340
+ switch ( $wcar_action ) {
1341
  case WCF_ACTION_SETTINGS:
1342
  $active_settings = 'nav-tab-active';
1343
  break;
1415
  *
1416
  * @since 1.1.5
1417
  */
1418
+ public function wcf_display_settings() {
1419
  ?>
1420
 
1421
  <form method="post" action="options.php">
1432
  *
1433
  * @since 1.1.5
1434
  */
1435
+ public function wcf_display_reports() {
1436
 
1437
  $filter = filter_input( INPUT_GET, 'filter', FILTER_SANITIZE_STRING );
1438
  $filter_table = filter_input( INPUT_GET, 'filter_table', FILTER_SANITIZE_STRING );
1444
  $filter_table = WCF_CART_ABANDONED_ORDER;
1445
  }
1446
 
1447
+ $from_date = filter_input( INPUT_GET, 'from_date', FILTER_SANITIZE_STRING );
1448
+ $to_date = filter_input( INPUT_GET, 'to_date', FILTER_SANITIZE_STRING );
1449
+ $export_data = filter_input( INPUT_GET, 'export_data', FILTER_VALIDATE_BOOLEAN );
1450
 
1451
  switch ( $filter ) {
1452
 
1453
  case 'yesterday':
1454
+ $to_date = gmdate( 'Y-m-d', strtotime( '-1 days' ) );
1455
  $from_date = $to_date;
1456
  break;
1457
  case 'today':
1458
+ $to_date = gmdate( 'Y-m-d' );
1459
  $from_date = $to_date;
1460
  break;
1461
  case 'last_week':
1462
+ $from_date = gmdate( 'Y-m-d', strtotime( '-7 days' ) );
1463
+ $to_date = gmdate( 'Y-m-d' );
1464
  break;
1465
  case 'last_month':
1466
+ $from_date = gmdate( 'Y-m-d', strtotime( '-1 months' ) );
1467
+ $to_date = gmdate( 'Y-m-d' );
1468
  break;
1469
  case 'custom':
1470
+ $to_date = $to_date ? $to_date : gmdate( 'Y-m-d' );
1471
  $from_date = $from_date ? $from_date : $to_date;
1472
  break;
1473
 
1477
  $recovered_report = $this->get_report_by_type( WCF_CART_COMPLETED_ORDER, $from_date, $to_date );
1478
  $lost_report = $this->get_report_by_type( WCF_CART_LOST_ORDER, $from_date, $to_date );
1479
 
1480
+ $wcf_list_table = Cartflows_Ca_Cart_Abandonment_Table::get_instance();
1481
  $wcf_list_table->prepare_items( $filter_table, $from_date, $to_date );
1482
 
1483
+ if ( $export_data ) {
1484
+
1485
+ $this->download_send_headers();
1486
+ echo $this->array2csv( $wcf_list_table->items ); //phpcs:ignore
1487
+ die;
1488
+
1489
+ }
1490
+
1491
  $conversion_rate = 0;
1492
  $total_orders = ( $recovered_report['no_of_orders'] + $abandoned_report['no_of_orders'] + $lost_report['no_of_orders'] );
1493
  if ( $total_orders ) {
1498
  $conversion_rate = number_format_i18n( $conversion_rate, 2 );
1499
  $currency_symbol = get_woocommerce_currency_symbol();
1500
  require_once CARTFLOWS_CART_ABANDONMENT_TRACKING_DIR . 'includes/admin/cartflows-cart-abandonment-reports.php';
1501
+
1502
  }
1503
 
1504
 
1505
  /**
1506
  * Show report details for specific order.
1507
  */
1508
+ public function wcf_display_report_details() {
1509
 
1510
  $sesson_id = filter_input( INPUT_GET, 'session_id', FILTER_SANITIZE_STRING );
1511
 
1514
  $user_details = (object) unserialize( $details->other_fields );
1515
  $scheduled_emails = $this->fetch_scheduled_emails( $sesson_id );
1516
 
1517
+ require_once CARTFLOWS_CART_ABANDONMENT_TRACKING_DIR . 'includes/admin/cartflows-ca-single-report-details.php';
1518
  }
1519
 
1520
  }
1522
  /**
1523
  * Check and show warning message if cart abandonment is disabled.
1524
  */
1525
+ public function wcf_show_warning_ca() {
1526
  $settings_url = add_query_arg(
1527
  array(
1528
  'page' => WCF_CA_PAGE_NAME,
1546
  /**
1547
  * Callback trigger event to send the emails.
1548
  */
1549
+ public function send_emails_to_callback() {
1550
 
1551
  global $wpdb;
1552
  $email_history_table = $wpdb->prefix . CARTFLOWS_CA_EMAIL_HISTORY_TABLE;
1588
 
1589
  $email_data = new stdClass();
1590
  $current_user = wp_get_current_user();
 
 
 
 
1591
  $email_data->email_template_id = null;
1592
  $email_data->checkout_id = wc_get_page_id( 'checkout' );
1593
  $email_data->session_id = 'dummy-session-id';
1594
+ $email_send_to = filter_input( INPUT_POST, 'email_send_to', FILTER_SANITIZE_EMAIL );
1595
+ $email_data->email = $email_send_to ? $email_send_to : $current_user->user_email;
1596
+ $email_data->email_body = filter_input( INPUT_POST, 'email_body', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
1597
+ $email_data->email_subject = filter_input( INPUT_POST, 'email_subject', FILTER_SANITIZE_STRING );
1598
+ $email_data->email_body = html_entity_decode( $email_data->email_body, ENT_COMPAT, 'UTF-8' );
1599
+ $email_data->other_fields = serialize(
1600
+ array(
1601
+ 'wcf_first_name' => $current_user->user_firstname,
1602
+ 'wcf_last_name' => $current_user->user_lastname,
1603
+ )
1604
+ );
1605
  if ( ! WC()->cart->get_cart_contents_count() ) {
1606
  $args = array(
1607
  'posts_per_page' => 1,
1608
  'orderby' => 'rand',
1609
  'post_type' => 'product',
1610
+ 'meta_query' => array( //phpcs:ignore
1611
  // Exclude out of stock products.
1612
  array(
1613
  'key' => '_stock_status',
1615
  'compare' => 'NOT IN',
1616
  ),
1617
  ),
1618
+ 'tax_query' => array( //phpcs:ignore
1619
  array(
1620
  'taxonomy' => 'product_type',
1621
  'field' => 'slug',
1644
  * @param boolean $preview_email preview email.
1645
  * @since 1.0.0
1646
  */
1647
+ public function send_email_templates( $email_data, $preview_email = false ) {
1648
 
1649
  if ( $preview_email ) {
1650
  $email_data = $this->create_dummy_session_for_preview_email();
1668
  $user_last_name = ucfirst( $other_fields['wcf_last_name'] );
1669
  $user_full_name = trim( $user_first_name . ' ' . $user_last_name );
1670
 
1671
+ $subject_email_preview = stripslashes( html_entity_decode( $email_data->email_subject, ENT_QUOTES, 'UTF-8' ) );
1672
  $subject_email_preview = convert_smilies( $subject_email_preview );
1673
  $subject_email_preview = str_replace( '{{customer.firstname}}', $user_first_name, $subject_email_preview );
1674
  $body_email_preview = convert_smilies( $email_data->email_body );
1703
 
1704
  $current_time_stamp = $email_data->time;
1705
  $body_email_preview = str_replace( '{{cart.abandoned_date}}', $current_time_stamp, $body_email_preview );
1706
+ $unsubscribe_element = '<a target="_blank" style="color: lightgray" href="' . $checkout_url . '&unsubscribe=true ">' . __( 'Unsubscribe', 'woo-cart-abandonment-recovery' ) . '</a>';
1707
  $body_email_preview = str_replace( '{{cart.unsubscribe}}', $unsubscribe_element, $body_email_preview );
1708
  $body_email_preview = str_replace( 'http://{{cart.checkout_url}}', '{{cart.checkout_url}}', $body_email_preview );
1709
  $body_email_preview = str_replace( 'https://{{cart.checkout_url}}', '{{cart.checkout_url}}', $body_email_preview );
1710
  $body_email_preview = str_replace( '{{cart.checkout_url}}', $checkout_url, $body_email_preview );
1711
+ $host = wp_parse_url( get_site_url() );
1712
  $body_email_preview = str_replace( '{{site.url}}', $host['host'], $body_email_preview );
1713
 
1714
  if ( false !== strpos( $body_email_preview, '{{cart.product.names}}' ) ) {
1755
  *
1756
  * @param object $cart_contents user cart details.
1757
  */
1758
+ public function get_comma_separated_products( $cart_contents ) {
1759
  $cart_comma_string = '';
1760
  if ( ! $cart_contents ) {
1761
  return $cart_comma_string;
1791
  * @param float $cart_total user cart total.
1792
  * @return string
1793
  */
1794
+ public function get_email_product_block( $cart_contents, $cart_total ) {
1795
 
1796
  $cart_items = unserialize( $cart_contents );
1797
 
1818
  foreach ( $cart_items as $cart_item ) {
1819
 
1820
  if ( isset( $cart_item['product_id'] ) && isset( $cart_item['quantity'] ) && isset( $cart_item['line_total'] ) ) {
 
 
 
 
1821
 
1822
+ $tr = $tr . '<tr style=' . $style . ' align="center">
1823
+ <td style="' . $style . '"><img class="demo_img" style="' . $product_image_style . '" src="' . esc_url( get_the_post_thumbnail_url( $cart_item['product_id'] ) ) . '"></td>
1824
+ <td style="' . $style . '">' . get_the_title( $cart_item['product_id'] ) . '</td>
1825
  <td style="' . $style . '"> ' . $cart_item['quantity'] . ' </td>
1826
  <td style="' . $style . '">' . $currency_symbol . number_format_i18n( $cart_item['line_total'], 2 ) . '</td>
1827
  <td style="' . $style . '" >' . $currency_symbol . number_format_i18n( $cart_item['line_total'], 2 ) . '</td>
1828
  </tr> ';
1829
+ }
1830
  }
1831
 
1832
  /**
1858
  * @param float $cart_total user cart total.
1859
  * @return string
1860
  */
1861
+ public function get_admin_product_block( $cart_contents, $cart_total ) {
1862
 
1863
  $cart_items = unserialize( $cart_contents );
1864
 
1875
  foreach ( $cart_items as $cart_item ) {
1876
 
1877
  if ( isset( $cart_item['product_id'] ) && isset( $cart_item['quantity'] ) && isset( $cart_item['line_total'] ) && isset( $cart_item['line_subtotal'] ) ) {
 
 
 
 
1878
 
1879
+ $discount = number_format_i18n( $discount + ( $cart_item['line_subtotal'] - $cart_item['line_total'] ), 2 );
1880
+ $total = number_format_i18n( $total + $cart_item['line_subtotal'], 2 );
1881
+ $tax = number_format_i18n( $tax + $cart_item['line_tax'], 2 );
1882
 
1883
+ $tr = $tr . '<tr align="center">
1884
+ <td ><img class="demo_img" width="42" height="42" src=" ' . esc_url( get_the_post_thumbnail_url( $cart_item['product_id'] ) ) . ' "/></td>
1885
+ <td >' . get_the_title( $cart_item['product_id'] ) . '</td>
1886
  <td > ' . $cart_item['quantity'] . ' </td>
1887
  <td >' . $currency_symbol . number_format_i18n( $cart_item['line_total'], 2 ) . '</td>
1888
  <td >' . $currency_symbol . number_format_i18n( $cart_item['line_total'], 2 ) . '</td>
1889
  </tr> ';
1890
+ }
1891
  }
1892
 
1893
  return '<table align="left" cellspacing="0" class="widefat fixed striped posts">
1929
  * @param integer $session_id user session id.
1930
  * @param boolean $force_reschedule force reschedule.
1931
  */
1932
+ public function schedule_emails( $session_id, $force_reschedule = false ) {
1933
 
1934
  $checkout_details = $this->get_checkout_details( $session_id );
1935
 
1938
  }
1939
  $scheduled_time_from = current_time( WCF_CA_DATETIME_FORMAT );
1940
  $scheduled_emails = $this->fetch_scheduled_emails( $session_id );
1941
+ $scheduled_templates = array_column( $scheduled_emails, 'template_id' ); //phpcs:ignore
1942
  $scheduled_time_from = $checkout_details->time;
1943
 
1944
  $email_tmpl = Cartflows_Ca_Email_Templates::get_instance();
1955
  }
1956
 
1957
  $timestamp_str = '+' . $template->frequency . ' ' . $template->frequency_unit . 'S';
1958
+ $scheduled_time = gmdate( WCF_CA_DATETIME_FORMAT, strtotime( $scheduled_time_from . $timestamp_str ) );
1959
  $discount_type = $email_tmpl->get_email_template_meta_by_key( $template->id, 'discount_type' );
1960
  $discount_type = isset( $discount_type->meta_value ) ? $discount_type->meta_value : '';
1961
  $amount = $email_tmpl->get_email_template_meta_by_key( $template->id, 'coupon_amount' );
2000
  * @param boolean $fetch_sent sfetch sent emails.
2001
  * @return array|object|null
2002
  */
2003
+ public function fetch_scheduled_emails( $session_id, $fetch_sent = false ) {
2004
  global $wpdb;
2005
  $email_history_table = $wpdb->prefix . CARTFLOWS_CA_EMAIL_HISTORY_TABLE;
2006
  $email_template_table = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_TABLE;
2018
  /**
2019
  * Delete orders from cart abandonment table whose cart total is zero and order status is abandoned.
2020
  */
2021
+ public function delete_empty_abandoned_order() {
2022
  global $wpdb;
2023
 
2024
  $cart_abandonment_table = $wpdb->prefix . CARTFLOWS_CA_CART_ABANDONMENT_TABLE;
2034
  /**
2035
  * Check if transient is set for delete garbage coupons.
2036
  */
2037
+ public function delete_used_and_expired_coupons() {
2038
  $is_ajax_request = wp_doing_ajax();
2039
  $is_transient_set = false;
2040
  global $wpdb;
2069
  /**
2070
  * Set transient and delete garbage coupons.
2071
  */
2072
+ public function delete_garbage_coupons() {
2073
 
2074
  global $wpdb;
2075
+
2076
  $coupon_generated_by = WCF_CA_COUPON_GENERATED_BY;
2077
  $timestamp = time();
2078
  $post_type = 'shop_coupon';
2084
  Max(CASE WHEN pm.meta_key = 'date_expires' AND p.`ID` = pm.`post_id` THEN pm.meta_value END) AS expiry_date,
2085
  Max(CASE WHEN pm.meta_key = 'usage_limit' AND p.`ID` = pm.`post_id` THEN pm.meta_value END) AS usage_limit,
2086
  Max(CASE WHEN pm.meta_key = 'usage_count' AND p.`ID` = pm.`post_id` THEN pm.meta_value END) AS total_usaged,
2087
+
2088
  Max(CASE WHEN pm.meta_key = 'coupon_generated_by' AND p.`ID` = pm.`post_id` THEN pm.meta_value END) AS coupon_generated_by
2089
  FROM wp_posts AS p
2090
  INNER JOIN wp_postmeta AS pm ON p.ID = pm.post_id
2091
  WHERE p.`post_type` = %s
2092
 
2093
  GROUP BY p.ID
2094
+ ) AS final_res WHERE coupon_generated_by IS NOT NULL AND coupon_generated_by = %s AND ( ( usage_limit = total_usaged ) OR ( expiry_date <= %d AND expiry_date != '') )",
2095
  $post_type,
2096
  $coupon_generated_by,
2097
  $timestamp
2100
  return $coupons;
2101
  }
2102
 
2103
+ /**
2104
+ * Send headers to export orders to csv format.
2105
+ */
2106
+ private function download_send_headers() {
2107
+ $now = gmdate( 'Y-m-d-H-i-s' );
2108
+ $filename = 'woo-cart-abandonment-recovery-export-' . $now . '.csv';
2109
+
2110
+ header( 'Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate' );
2111
+ header( "Last-Modified: {$now} GMT" );
2112
+
2113
+ // force download.
2114
+ header( 'Content-Type: application/force-download' );
2115
+ header( 'Content-Type: application/octet-stream' );
2116
+ header( 'Content-Type: application/download' );
2117
+
2118
+ // disposition / encoding on response body.
2119
+ header( "Content-Disposition: attachment;filename={$filename}" );
2120
+ header( 'Content-Transfer-Encoding: binary' );
2121
+ }
2122
+
2123
+ /**
2124
+ * Convert users data to csv format.
2125
+ *
2126
+ * @param array $user_data users data.
2127
+ */
2128
+ private function array2csv( array $user_data ) {
2129
+ if ( empty( $user_data ) ) {
2130
+ return;
2131
+ }
2132
+ ob_clean();
2133
+ ob_start();
2134
+ $data_file = fopen( 'php://output', 'w' );
2135
+ fputcsv(
2136
+ $data_file,
2137
+ array(
2138
+ 'First-Name',
2139
+ 'Last-Name',
2140
+ 'Email',
2141
+ 'Products',
2142
+ 'Cart-Total in ' . get_woocommerce_currency(),
2143
+ 'Order-Status',
2144
+ 'Unsubscribed',
2145
+ 'Coupon-Code',
2146
+ )
2147
+ );
2148
+ foreach ( $user_data as $data ) {
2149
+ $name = unserialize( $data['other_fields'] );
2150
+ $checkout_details = $this->get_checkout_details( $data['session_id'] );
2151
+ $cart_data = $this->get_comma_separated_products( $checkout_details->cart_contents );
2152
+ fputcsv(
2153
+ $data_file,
2154
+ array(
2155
+ $name['wcf_first_name'],
2156
+ $name['wcf_last_name'],
2157
+ $data['email'],
2158
+ $cart_data,
2159
+ $data['cart_total'],
2160
+ $data['order_status'],
2161
+ $data['unsubscribed'] ? 'Yes' : 'No',
2162
+ $data['coupon_code'],
2163
+ )
2164
+ );
2165
+
2166
+ }
2167
+ fclose( $data_file ); //phpcs:ignore
2168
+ return ob_get_clean();
2169
+ }
2170
  }
2171
 
2172
  Cartflows_Ca_Cart_Abandonment::get_instance();
modules/cart-abandonment/class-cartflows-ca-email-templates-table.php CHANGED
@@ -28,7 +28,7 @@ class Cartflows_Ca_Email_Templates_Table extends WP_List_Table {
28
  /**
29
  * Constructor function.
30
  */
31
- function __construct() {
32
  global $status, $page;
33
 
34
  parent::__construct(
@@ -47,7 +47,7 @@ class Cartflows_Ca_Email_Templates_Table extends WP_List_Table {
47
  * @param object $item item.
48
  * @param string $column_name column name.
49
  */
50
- function column_default( $item, $column_name ) {
51
  return $item[ $column_name ];
52
  }
53
 
@@ -57,7 +57,7 @@ class Cartflows_Ca_Email_Templates_Table extends WP_List_Table {
57
  * @param object $item item.
58
  * @return HTML
59
  */
60
- function column_template_name( $item ) {
61
 
62
  $row_actions['edit'] = '<a href="' . wp_nonce_url(
63
  add_query_arg(
@@ -104,7 +104,7 @@ class Cartflows_Ca_Email_Templates_Table extends WP_List_Table {
104
  * @param object $item item.
105
  * @return HTML
106
  */
107
- function column_cb( $item ) {
108
  return sprintf( '<input type="checkbox" name="id[]" value="%s" />', esc_html( $item['id'] ) );
109
  }
110
 
@@ -113,7 +113,7 @@ class Cartflows_Ca_Email_Templates_Table extends WP_List_Table {
113
  *
114
  * @return array
115
  */
116
- function get_bulk_actions() {
117
  $actions = array(
118
  WCF_ACTION_EMAIL_TEMPLATES => __( 'Delete', 'woo-cart-abandonment-recovery' ),
119
  );
@@ -134,7 +134,7 @@ class Cartflows_Ca_Email_Templates_Table extends WP_List_Table {
134
  *
135
  * @param string $cart_type abandoned|completed.
136
  */
137
- function prepare_items( $cart_type = WCF_CART_ABANDONED_ORDER ) {
138
  global $wpdb;
139
  $cart_abandonment_template_table_name = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_TABLE;
140
 
@@ -148,7 +148,7 @@ class Cartflows_Ca_Email_Templates_Table extends WP_List_Table {
148
 
149
  $this->process_bulk_action();
150
 
151
- $total_items = $wpdb->get_var("SELECT COUNT(id) FROM $cart_abandonment_template_table_name"); // phpcs:ignore
152
 
153
  $paged = filter_input( INPUT_GET, 'paged', FILTER_SANITIZE_NUMBER_INT );
154
  $orderby = filter_input( INPUT_GET, 'orderby', FILTER_SANITIZE_STRING );
@@ -166,9 +166,10 @@ class Cartflows_Ca_Email_Templates_Table extends WP_List_Table {
166
  'total_pages' => ceil( $total_items / $per_page ),
167
  )
168
  );
169
-
170
  $this->items = $wpdb->get_results(
171
- $wpdb->prepare("SELECT * FROM $cart_abandonment_template_table_name ORDER BY $orderby $order LIMIT %d OFFSET %d", $per_page, $paged * $per_page), ARRAY_A); // phpcs:ignore
 
 
172
  }
173
 
174
  /**
@@ -176,7 +177,7 @@ class Cartflows_Ca_Email_Templates_Table extends WP_List_Table {
176
  *
177
  * @return array
178
  */
179
- function get_columns() {
180
  $columns = array(
181
  'cb' => '<input type="checkbox" />',
182
  'template_name' => __( 'Template Name', 'woo-cart-abandonment-recovery' ),
@@ -195,7 +196,7 @@ class Cartflows_Ca_Email_Templates_Table extends WP_List_Table {
195
  * @param object $item item.
196
  * @return string
197
  */
198
- function column_trigger_time( $item ) {
199
 
200
  return sprintf(
201
  '%d %s',
@@ -209,7 +210,7 @@ class Cartflows_Ca_Email_Templates_Table extends WP_List_Table {
209
  *
210
  * @param object $item item.
211
  */
212
- function column_is_activated( $item ) {
213
  global $wpdb;
214
  if ( isset( $item['id'] ) ) {
215
  $id = $item['id'];
@@ -221,8 +222,8 @@ class Cartflows_Ca_Email_Templates_Table extends WP_List_Table {
221
  $is_activated = $active_status ? 'on' : 'off';
222
 
223
  }
224
- print'<button type="button" id="' . $id . '" class="wcf-ca-switch wcf-toggle-template-status wcar-switch-grid" wcf-ca-template-switch="' . $is_activated . '"> ' . $is_activated . ' </button>';
225
- print'<input type="hidden" name="wcf_activate_email_template" id="wcf_activate_email_template" value="' . $active_status . '" />';
226
  }
227
 
228
  /**
@@ -242,16 +243,19 @@ class Cartflows_Ca_Email_Templates_Table extends WP_List_Table {
242
  /**
243
  * Processes bulk actions
244
  */
245
- function process_bulk_action() {
246
 
247
  global $wpdb;
248
  $table_name = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_TABLE;
249
  $action = filter_input( INPUT_GET, 'sub_action', FILTER_SANITIZE_STRING );
250
 
251
  if ( WCF_SUB_ACTION_DELETE_BULK_EMAIL_TEMPLATES === $action ) {
252
- $ids = array();
253
- if ( isset( $_REQUEST['id'] ) && is_array( $_REQUEST['id'] ) ) {
254
- $ids = array_map( 'intval', $_REQUEST['id'] );
 
 
 
255
  }
256
  $ids = implode( ',', $ids );
257
 
28
  /**
29
  * Constructor function.
30
  */
31
+ public function __construct() {
32
  global $status, $page;
33
 
34
  parent::__construct(
47
  * @param object $item item.
48
  * @param string $column_name column name.
49
  */
50
+ public function column_default( $item, $column_name ) {
51
  return $item[ $column_name ];
52
  }
53
 
57
  * @param object $item item.
58
  * @return HTML
59
  */
60
+ public function column_template_name( $item ) {
61
 
62
  $row_actions['edit'] = '<a href="' . wp_nonce_url(
63
  add_query_arg(
104
  * @param object $item item.
105
  * @return HTML
106
  */
107
+ public function column_cb( $item ) {
108
  return sprintf( '<input type="checkbox" name="id[]" value="%s" />', esc_html( $item['id'] ) );
109
  }
110
 
113
  *
114
  * @return array
115
  */
116
+ public function get_bulk_actions() {
117
  $actions = array(
118
  WCF_ACTION_EMAIL_TEMPLATES => __( 'Delete', 'woo-cart-abandonment-recovery' ),
119
  );
134
  *
135
  * @param string $cart_type abandoned|completed.
136
  */
137
+ public function prepare_items( $cart_type = WCF_CART_ABANDONED_ORDER ) {
138
  global $wpdb;
139
  $cart_abandonment_template_table_name = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_TABLE;
140
 
148
 
149
  $this->process_bulk_action();
150
 
151
+ $total_items = $wpdb->get_var( "SELECT COUNT(id) FROM $cart_abandonment_template_table_name" ); // phpcs:ignore
152
 
153
  $paged = filter_input( INPUT_GET, 'paged', FILTER_SANITIZE_NUMBER_INT );
154
  $orderby = filter_input( INPUT_GET, 'orderby', FILTER_SANITIZE_STRING );
166
  'total_pages' => ceil( $total_items / $per_page ),
167
  )
168
  );
 
169
  $this->items = $wpdb->get_results(
170
+ $wpdb->prepare( "SELECT * FROM {$cart_abandonment_template_table_name} ORDER BY $orderby $order LIMIT %d OFFSET %d", $per_page, $paged * $per_page ), // phpcs:ignore
171
+ ARRAY_A
172
+ );
173
  }
174
 
175
  /**
177
  *
178
  * @return array
179
  */
180
+ public function get_columns() {
181
  $columns = array(
182
  'cb' => '<input type="checkbox" />',
183
  'template_name' => __( 'Template Name', 'woo-cart-abandonment-recovery' ),
196
  * @param object $item item.
197
  * @return string
198
  */
199
+ protected function column_trigger_time( $item ) {
200
 
201
  return sprintf(
202
  '%d %s',
210
  *
211
  * @param object $item item.
212
  */
213
+ protected function column_is_activated( $item ) {
214
  global $wpdb;
215
  if ( isset( $item['id'] ) ) {
216
  $id = $item['id'];
222
  $is_activated = $active_status ? 'on' : 'off';
223
 
224
  }
225
+ print '<button type="button" id="' . esc_attr( $id ) . '" class="wcf-ca-switch wcf-toggle-template-status wcar-switch-grid" wcf-ca-template-switch="' . esc_attr( $is_activated ) . '"> ' . esc_attr( $is_activated ) . ' </button>';
226
+ print '<input type="hidden" name="wcf_activate_email_template" id="wcf_activate_email_template" value="' . esc_attr( $active_status ) . '" />';
227
  }
228
 
229
  /**
243
  /**
244
  * Processes bulk actions
245
  */
246
+ public function process_bulk_action() {
247
 
248
  global $wpdb;
249
  $table_name = $wpdb->prefix . CARTFLOWS_CA_EMAIL_TEMPLATE_TABLE;
250
  $action = filter_input( INPUT_GET, 'sub_action', FILTER_SANITIZE_STRING );
251
 
252
  if ( WCF_SUB_ACTION_DELETE_BULK_EMAIL_TEMPLATES === $action ) {
253
+ $ids = array();
254
+ $request_id = isset( $_REQUEST['id'] ) ? $_REQUEST['id'] : ''; //phpcs:ignore
255
+ if ( is_array( $request_id ) ) {
256
+ $ids = array_map( 'intval', $request_id );
257
+ } else {
258
+ $ids = array( intval( $request_id ) );
259
  }
260
  $ids = implode( ',', $ids );
261
 
modules/cart-abandonment/class-cartflows-ca-email-templates.php CHANGED
@@ -55,7 +55,7 @@ class Cartflows_Ca_Email_Templates {
55
  */
56
  public static function get_instance() {
57
  if ( ! isset( self::$instance ) ) {
58
- self::$instance = new self;
59
  }
60
  return self::$instance;
61
  }
@@ -100,7 +100,8 @@ class Cartflows_Ca_Email_Templates {
100
  'cartflows-ca-email-tmpl-settings',
101
  CARTFLOWS_CA_URL . 'admin/assets/js/admin-email-templates.js',
102
  array( 'jquery' ),
103
- CARTFLOWS_CA_VER
 
104
  );
105
 
106
  $current_user = wp_get_current_user();
@@ -211,7 +212,7 @@ class Cartflows_Ca_Email_Templates {
211
  /**
212
  * Show success messages for email templates.
213
  */
214
- function show_messages() {
215
 
216
  $wcf_ca_template_created = filter_input( INPUT_GET, 'wcf_ca_template_created', FILTER_SANITIZE_STRING );
217
  $wcf_ca_template_cloned = filter_input( INPUT_GET, 'wcf_ca_template_cloned', FILTER_SANITIZE_STRING );
@@ -224,7 +225,7 @@ class Cartflows_Ca_Email_Templates {
224
  <div id="message" class="notice notice-success is-dismissible">
225
  <p>
226
  <strong>
227
- <?php _e( 'The Email Template has been successfully added.', 'woo-cart-abandonment-recovery' ); ?>
228
  </strong>
229
  </p>
230
  </div>
@@ -234,7 +235,7 @@ class Cartflows_Ca_Email_Templates {
234
  <div id="message" class="notice notice-success is-dismissible">
235
  <p>
236
  <strong>
237
- <?php _e( 'The Email Template has been cloned successfully.', 'woo-cart-abandonment-recovery' ); ?>
238
  </strong>
239
  </p>
240
  </div>
@@ -244,7 +245,7 @@ class Cartflows_Ca_Email_Templates {
244
  <div id="message" class="notice notice-success is-dismissible">
245
  <p>
246
  <strong>
247
- <?php _e( 'The Email Template has been successfully deleted.', 'woo-cart-abandonment-recovery' ); ?>
248
  </strong>
249
  </p>
250
  </div>
@@ -253,7 +254,7 @@ class Cartflows_Ca_Email_Templates {
253
  <div id="message" class="notice notice-success is-dismissible">
254
  <p>
255
  <strong>
256
- <?php _e( 'The Email Template has been successfully updated.', 'woo-cart-abandonment-recovery' ); ?>
257
  </strong>
258
  </p>
259
  </div>
@@ -263,7 +264,7 @@ class Cartflows_Ca_Email_Templates {
263
  <div id="message" class="notice notice-success is-dismissible">
264
  <p>
265
  <strong>
266
- <?php _e( 'Default Email Templates has been restored successfully.', 'woo-cart-abandonment-recovery' ); ?>
267
  </strong>
268
  </p>
269
  </div>
@@ -275,7 +276,7 @@ class Cartflows_Ca_Email_Templates {
275
  /**
276
  * Delete bulk email templates.
277
  */
278
- function delete_bulk_templates() {
279
  $wcf_template_list = new Cartflows_Ca_Email_Templates_Table();
280
  $wcf_template_list->process_bulk_action();
281
  $param = array(
@@ -291,7 +292,7 @@ class Cartflows_Ca_Email_Templates {
291
  /**
292
  * Delete email templates.
293
  */
294
- function delete_single_template() {
295
 
296
  $id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
297
  $wpnonce = filter_input( INPUT_GET, '_wpnonce', FILTER_SANITIZE_STRING );
@@ -317,7 +318,7 @@ class Cartflows_Ca_Email_Templates {
317
  /**
318
  * Delete email templates.
319
  */
320
- function clone_email_template() {
321
 
322
  $id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
323
  $wpnonce = filter_input( INPUT_GET, '_wpnonce', FILTER_SANITIZE_STRING );
@@ -369,7 +370,7 @@ class Cartflows_Ca_Email_Templates {
369
  *
370
  * @param int $email_tmpl_id template id.
371
  */
372
- function get_email_template_by_id( $email_tmpl_id ) {
373
 
374
  $query = 'SELECT * FROM ' . $this->cart_abandonment_template_table_name . ' WHERE id = %d ';
375
  return $this->wpdb->get_row($this->wpdb->prepare($query, $email_tmpl_id)); // phpcs:ignore
@@ -381,7 +382,7 @@ class Cartflows_Ca_Email_Templates {
381
  *
382
  * @param string $sub_action sub_action.
383
  */
384
- function render_email_template_form( $sub_action = WCF_SUB_ACTION_ADD_EMAIL_TEMPLATES ) {
385
 
386
  $id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
387
 
@@ -402,15 +403,15 @@ class Cartflows_Ca_Email_Templates {
402
  $save_template_url = esc_url( add_query_arg( $param, admin_url( '/admin.php' ) ) );
403
  ?>
404
 
405
- <form method="post" action="<?php echo $save_template_url; ?>" id="wcf_settings">
406
- <input type="hidden" name="sub_action" value="<?php echo $sub_action; ?>"/>
407
  <?php
408
  $id_by = '';
409
  if ( isset( $id ) ) {
410
  $id_by = $id;
411
  }
412
  ?>
413
- <input type="hidden" name="id" value="<?php echo $id_by; ?>"/>
414
  <?php
415
 
416
  $button_sub_action = 'save';
@@ -420,17 +421,17 @@ class Cartflows_Ca_Email_Templates {
420
  $button_sub_action = 'update';
421
  $display_message = 'Edit Email Template:';
422
  }
423
- print'<input type="hidden" name="wcf_settings_frm" value="' . $button_sub_action . '">';
424
  ?>
425
  <div id="poststuff">
426
  <div> <!-- <div class="postbox" > -->
427
- <h3><?php _e($display_message, 'woo-cart-abandonment-recovery'); // phpcs:ignore ?></h3>
428
  <hr/>
429
  <div>
430
  <table class="form-table" id="addedit_template">
431
  <tr>
432
  <th>
433
- <label for="wcf_email_subject"><b><?php _e( 'Activate Template now?', 'woo-cart-abandonment-recovery' ); ?></b></label>
434
  </th>
435
  <td>
436
  <?php
@@ -441,8 +442,8 @@ class Cartflows_Ca_Email_Templates {
441
  $is_activated = $active_status ? 'on' : 'off';
442
 
443
  }
444
- print'<button type="button" class="wcf-ca-switch wcf-toggle-template-status" wcf-template-id="1" wcf-ca-template-switch="' . $is_activated . '"> ' . $is_activated . ' </button>';
445
- print'<input type="hidden" name="wcf_activate_email_template" id="wcf_activate_email_template" value="' . $active_status . '" />';
446
  ?>
447
 
448
  </td>
@@ -450,7 +451,7 @@ class Cartflows_Ca_Email_Templates {
450
 
451
  <tr>
452
  <th>
453
- <label for="wcf_template_name"><b><?php _e( 'Template Name:', 'woo-cart-abandonment-recovery' ); ?></b></label>
454
  </th>
455
  <td>
456
  <?php
@@ -458,14 +459,14 @@ class Cartflows_Ca_Email_Templates {
458
  if ( WCF_SUB_ACTION_EDIT_EMAIL_TEMPLATES === $sub_action && $results && isset( $results->template_name ) ) {
459
  $template_name = $results->template_name;
460
  }
461
- print'<input type="text" name="wcf_template_name" id="wcf_template_name" class="wcf-ca-trigger-input" value="' . $template_name . '">';
462
  ?>
463
  </td>
464
  </tr>
465
 
466
  <tr>
467
  <th>
468
- <label for="wcf_email_subject"><b><?php _e( 'Email Subject:', 'woo-cart-abandonment-recovery' ); ?></b></label>
469
  </th>
470
  <td>
471
  <?php
@@ -473,14 +474,14 @@ class Cartflows_Ca_Email_Templates {
473
  if ( WCF_SUB_ACTION_EDIT_EMAIL_TEMPLATES === $sub_action && $results && isset( $results->email_subject ) ) {
474
  $subject_edit = stripslashes( $results->email_subject );
475
  }
476
- print'<input type="text" name="wcf_email_subject" id="wcf_email_subject" class="wcf-ca-trigger-input" value="' . $subject_edit . '">';
477
  ?>
478
  </td>
479
  </tr>
480
 
481
  <tr>
482
  <th>
483
- <label for="wcf_email_body"><b><?php _e( 'Email Body:', 'woo-cart-abandonment-recovery' ); ?></b></label>
484
  </th>
485
  <td>
486
  <?php
@@ -503,13 +504,13 @@ class Cartflows_Ca_Email_Templates {
503
  );
504
 
505
  ?>
506
- <?php echo stripslashes( get_option( 'wcf_email_body' ) ); ?>
507
  </td>
508
  </tr>
509
 
510
  <tr>
511
  <th>
512
- <label for="wcf_override_global_coupon"><b><?php _e( 'Create Coupon', 'woo-cart-abandonment-recovery' ); ?></b></label>
513
  </th>
514
  <td>
515
  <?php
@@ -522,14 +523,14 @@ class Cartflows_Ca_Email_Templates {
522
  }
523
  }
524
 
525
- print'<input ' . $wcf_override_global_coupon . ' id="wcf_override_global_coupon" name="wcf_override_global_coupon" type="checkbox" value="" /><span class="description">' . __( 'Allows you to send new coupon only for this template.', 'woo-cart-abandonment-recovery' ) . '</span>';
526
  ?>
527
  </td>
528
  </tr>
529
 
530
  <tr>
531
  <th>
532
- <label class="wcf-sub-heading" for="wcf_email_discount_type"> <?php _e( 'Discount Type', 'woo-cart-abandonment-recovery' ); ?> </label>
533
  </th>
534
  <td>
535
  <?php
@@ -550,7 +551,7 @@ class Cartflows_Ca_Email_Templates {
550
  echo '<select id="wcf_email_discount_type" name="wcf_email_discount_type">';
551
  foreach ( $dropdown_options as $key => $value ) {
552
  $is_selected = $key === $wcf_email_discount_type ? 'selected' : '';
553
- echo '<option ' . $is_selected . ' value=' . $key . '>' . $value . '</option>';
554
 
555
  }
556
  echo '</select>';
@@ -561,7 +562,7 @@ class Cartflows_Ca_Email_Templates {
561
 
562
  <tr>
563
  <th>
564
- <label class="wcf-sub-heading" for="wcf_email_discount_amount"> <?php _e( 'Coupon Amount', 'woo-cart-abandonment-recovery' ); ?> </label>
565
  </th>
566
  <td>
567
  <?php
@@ -572,14 +573,14 @@ class Cartflows_Ca_Email_Templates {
572
  $wcf_email_discount_amount = $wcf_email_discount_amount->meta_value;
573
  }
574
  }
575
- print'<input class="wcf-ca-trigger-input wcf-ca-email-inputs" type="number" id="wcf_email_discount_amount" name="wcf_email_discount_amount" value="' . $wcf_email_discount_amount . '">';
576
  ?>
577
  </td>
578
  </tr>
579
 
580
  <tr>
581
  <th>
582
- <label class="wcf-sub-heading" for="wcf_email_coupon_expiry_date"> <?php _e( 'Coupon expiry date', 'woo-cart-abandonment-recovery' ); ?> </label>
583
  </th>
584
  <td>
585
  <?php
@@ -597,25 +598,25 @@ class Cartflows_Ca_Email_Templates {
597
  $coupon_expiry_unit = $wcf_email_coupon_expiry_unit->meta_value;
598
  }
599
  }
600
- print'<input type="number" class="wcf-ca-trigger-input wcf-ca-coupon-inputs" id="wcf_email_coupon_expiry_date" name="wcf_email_coupon_expiry_date" value="' . intval( $wcf_email_coupon_expiry_date ) . '" autocomplete="off" />';
601
  $items = array(
602
- 'hours' => __( 'Hour(s)', 'woo-cart-abandonment-recovery' ),
603
- 'days' => __( 'Day(s)', 'woo-cart-abandonment-recovery' ),
604
  );
605
  echo "<select id='wcf_coupon_expiry_unit' name='wcf_coupon_expiry_unit'>";
606
  foreach ( $items as $key => $item ) {
607
  $selected = ( $coupon_expiry_unit === $key ) ? 'selected="selected"' : '';
608
- echo "<option value='$key' $selected>$item</option>";
609
  }
610
  echo '</select>';
611
 
612
- echo " <span class='description'>" . __( 'Enter zero (0) to restrict coupon from expiring', 'woo-cart-abandonment-recovery' ) . ' </span>'
613
  ?>
614
  </td>
615
  </tr>
616
  <tr>
617
  <th>
618
- <label class="wcf-sub-heading" for="wcf_free_shipping_coupon"> <?php _e( 'Free Shipping', 'woo-cart-abandonment-recovery' ); ?> </label>
619
  </th>
620
  <td>
621
  <?php
@@ -628,14 +629,14 @@ class Cartflows_Ca_Email_Templates {
628
  }
629
  }
630
 
631
- print'<input ' . $wcf_free_shipping_coupon . ' id="wcf_free_shipping_coupon" name="wcf_free_shipping_coupon" type="checkbox" value="" /><span class="description"> ' . __( 'Allows you to grant free shipping. A free shipping method must be enabled in your shipping zone and be set to require "a valid free shipping coupon". ', 'woo-cart-abandonment-recovery' ) . '</span>';
632
 
633
  ?>
634
  </td>
635
  </tr>
636
  <tr>
637
  <th>
638
- <label class="wcf-sub-heading" for="wcf_individual_use_only"><?php _e( 'Individual use only', 'woo-cart-abandonment-recovery' ); ?></label>
639
  </th>
640
  <td>
641
  <?php
@@ -648,15 +649,15 @@ class Cartflows_Ca_Email_Templates {
648
  }
649
  }
650
 
651
- print'<input ' . $wcf_individual_use_only . ' id="wcf_individual_use_only" name="wcf_individual_use_only" type="checkbox" value="" />
652
- <span class="description">' . __( 'Check this box if the coupon cannot be used in conjunction with other coupons.', 'woo-cart-abandonment-recovery' ) . ' </span>';
653
 
654
  ?>
655
  </td>
656
  </tr>
657
  <tr>
658
  <th>
659
- <label class="wcf-sub-heading" for="wcf_apply_coupon_auto"> <?php _e( 'Auto Apply Coupon', 'woo-cart-abandonment-recovery' ); ?> </label>
660
  </th>
661
  <td>
662
  <?php
@@ -670,13 +671,13 @@ class Cartflows_Ca_Email_Templates {
670
  }
671
  }
672
 
673
- print'<input ' . $wcf_apply_coupon_auto . ' id="wcf_auto_coupon_apply" name="wcf_auto_coupon_apply" type="checkbox" value="" /><span class="description" > ' . __( ' Automatically add the coupon to the cart at the checkout.', 'woo-cart-abandonment-recovery' ) . ' </span>';
674
  ?>
675
  </td>
676
  </tr>
677
  <tr>
678
  <th>
679
- <label for="wcf_email_subject"><b><?php _e( 'Send This Email', 'woo-cart-abandonment-recovery' ); ?></b></label>
680
  </th>
681
  <td>
682
  <?php
@@ -684,7 +685,7 @@ class Cartflows_Ca_Email_Templates {
684
  if ( WCF_SUB_ACTION_EDIT_EMAIL_TEMPLATES === $sub_action && $results && isset( $results->frequency ) ) {
685
  $frequency_edit = $results->frequency;
686
  }
687
- print'<input style="width:15%" type="number" name="wcf_email_frequency" id="wcf_email_frequency" class="wcf-ca-trigger-input" value="' . $frequency_edit . '">';
688
  ?>
689
 
690
  <select name="wcf_email_frequency_unit" id="wcf_email_frequency_unit">
@@ -694,22 +695,22 @@ class Cartflows_Ca_Email_Templates {
694
  $frequency_unit = $results->frequency_unit;
695
  }
696
  $days_or_hours = array(
697
- 'MINUTE' => __( 'Minute(s)', 'woo-cart-abandonment-recovery' ),
698
- 'HOUR' => __( 'Hour(s)', 'woo-cart-abandonment-recovery' ),
699
- 'DAY' => __( 'Day(s)', 'woo-cart-abandonment-recovery' ),
700
  );
701
- foreach ( $days_or_hours as $k => $v ) {
702
  printf(
703
  "<option %s value='%s'>%s</option>\n",
704
- selected( $k, $frequency_unit, false ),
705
- esc_attr( $k ),
706
- $v
707
  );
708
  }
709
  ?>
710
  </select>
711
  <span class="description">
712
- <?php _e( 'after cart is abandoned.', 'woo-cart-abandonment-recovery' ); ?>
713
  </span>
714
 
715
 
@@ -719,11 +720,11 @@ class Cartflows_Ca_Email_Templates {
719
  <tr>
720
  <?php $current_user = wp_get_current_user(); ?>
721
  <th>
722
- <label for="wcf_email_preview"><b><?php _e( 'Send Test Email To:', 'woo-cart-abandonment-recovery' ); ?></b></label>
723
  </th>
724
  <td>
725
- <input class="wcf-ca-trigger-input" type="text" id="wcf_send_test_email" name="send_test_email" value="<?php echo $current_user->user_email; ?>" class="wcf-ca-trigger-input">
726
- <input class="button" type="button" value=" <?php _e( 'Send a test email', 'woo-cart-abandonment-recovery' ); ?>" id="wcf_preview_email"/> <br/>
727
 
728
  <label id="mail_response_msg"> </label>
729
  </td>
@@ -736,12 +737,12 @@ class Cartflows_Ca_Email_Templates {
736
  <?php wp_nonce_field( WCF_EMAIL_TEMPLATES_NONCE, '_wpnonce' ); ?>
737
  <p class="submit">
738
  <?php
739
- $button_value = __( 'Save Changes', 'woo-cart-abandonment-recovery' );
740
  if ( WCF_SUB_ACTION_EDIT_EMAIL_TEMPLATES === $sub_action ) {
741
- $button_value = __( 'Update Changes', 'woo-cart-abandonment-recovery' );
742
  }
743
  ?>
744
- <input type="submit" name="Submit" class="button-primary" value="<?php echo $button_value; ?>"/>
745
  </p>
746
  </form>
747
  </div>
@@ -755,7 +756,7 @@ class Cartflows_Ca_Email_Templates {
755
  *
756
  * @return array
757
  */
758
- function sanitize_email_post_data() {
759
 
760
  $input_post_values = array(
761
  'wcf_email_subject' => array(
@@ -808,18 +809,18 @@ class Cartflows_Ca_Email_Templates {
808
  $sanitized_post = array();
809
  foreach ( $input_post_values as $key => $input_post_value ) {
810
 
811
- if ( isset( $_POST[ $key ] ) ) {
812
  $sanitized_post[ $key ] = filter_input( INPUT_POST, $key, $input_post_value['sanitize'] );
813
  } else {
814
  $sanitized_post[ $key ] = $input_post_value['default'];
815
  }
816
  }
817
 
818
- $sanitized_post['wcf_override_global_coupon'] = isset( $_POST['wcf_override_global_coupon'] ) ? true : false;
819
- $sanitized_post['wcf_auto_coupon_apply'] = isset( $_POST['wcf_auto_coupon_apply'] ) ? true : false;
820
- $sanitized_post['wcf_free_shipping_coupon'] = isset( $_POST['wcf_free_shipping_coupon'] ) ? true : false;
821
- $sanitized_post['wcf_individual_use_only'] = isset( $_POST['wcf_individual_use_only'] ) ? true : false;
822
- $sanitized_post['wcf_email_body'] = html_entity_decode( $sanitized_post['wcf_email_body'] );
823
 
824
  return $sanitized_post;
825
 
@@ -829,7 +830,7 @@ class Cartflows_Ca_Email_Templates {
829
  /**
830
  * Add email template callback ajax.
831
  */
832
- function add_email_template() {
833
 
834
  $sanitized_post = $this->sanitize_email_post_data();
835
  $this->wpdb->insert(
@@ -877,7 +878,7 @@ class Cartflows_Ca_Email_Templates {
877
  /**
878
  * Edit email template callback ajax.
879
  */
880
- function edit_email_template() {
881
  $sanitized_post = $this->sanitize_email_post_data();
882
  $email_template_id = $sanitized_post['id'];
883
 
@@ -955,7 +956,7 @@ class Cartflows_Ca_Email_Templates {
955
  * @param string $meta_key meta key.
956
  * @param string $meta_value meta value.
957
  */
958
- function update_email_template_meta( $email_template_id, $meta_key, $meta_value ) {
959
 
960
  $template_meta = $this->get_email_template_meta_by_key( $email_template_id, $meta_key );
961
 
@@ -963,11 +964,11 @@ class Cartflows_Ca_Email_Templates {
963
  $this->wpdb->update(
964
  $this->email_templates_meta_table,
965
  array(
966
- 'meta_value' => sanitize_text_field( $meta_value ),
967
  ),
968
  array(
969
  'email_template_id' => $email_template_id,
970
- 'meta_key' => sanitize_text_field( $meta_key ),
971
  )
972
  );
973
  } else {
@@ -984,13 +985,13 @@ class Cartflows_Ca_Email_Templates {
984
  * @param string $meta_key meta key.
985
  * @param string $meta_value meta value.
986
  */
987
- function add_email_template_meta( $email_template_id, $meta_key, $meta_value ) {
988
  $this->wpdb->insert(
989
  $this->email_templates_meta_table,
990
  array(
991
  'email_template_id' => $email_template_id,
992
- 'meta_key' => sanitize_text_field( $meta_key ),
993
- 'meta_value' => sanitize_text_field( $meta_value ),
994
  )
995
  );
996
  }
@@ -1001,7 +1002,7 @@ class Cartflows_Ca_Email_Templates {
1001
  * @param integer $email_template_id email template id.
1002
  * @param string $meta_key meta key.
1003
  */
1004
- function get_email_template_meta_by_key( $email_template_id, $meta_key ) {
1005
  return $this->wpdb->get_row(
1006
  $this->wpdb->prepare( "select * from $this->email_templates_meta_table where email_template_id = %d AND meta_key = %s", $email_template_id, $meta_key ) // phpcs:ignore
1007
  );
@@ -1010,7 +1011,7 @@ class Cartflows_Ca_Email_Templates {
1010
  /**
1011
  * Render email template grid.
1012
  */
1013
- function show_email_template_data_table() {
1014
  $wcf_template_list = new Cartflows_Ca_Email_Templates_Table();
1015
  $wcf_template_list->prepare_items();
1016
  $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
@@ -1044,10 +1045,10 @@ class Cartflows_Ca_Email_Templates {
1044
  ?>
1045
  <div class="wcf-ca-report-btn">
1046
  <div class="wcf-ca-left-report-field-group">
1047
- <a style="cursor: pointer" href="<?php echo $add_new_template_url; ?>" class="button-secondary"><?php _e( 'Create New Template', 'woo-cart-abandonment-recovery' ); ?></a>
1048
  </div>
1049
  <div class="wcf-ca-right-report-field-group">
1050
- <a onclick="return confirm('Are you sure to restore email templates?');" style="cursor: pointer" href="<?php echo $restore_template_url; ?>" class="button-secondary"><?php _e( ' Restore Default Templates', 'woo-cart-abandonment-recovery' ); ?></a>
1051
  </div>
1052
  </div>
1053
  <?php
55
  */
56
  public static function get_instance() {
57
  if ( ! isset( self::$instance ) ) {
58
+ self::$instance = new self();
59
  }
60
  return self::$instance;
61
  }
100
  'cartflows-ca-email-tmpl-settings',
101
  CARTFLOWS_CA_URL . 'admin/assets/js/admin-email-templates.js',
102
  array( 'jquery' ),
103
+ CARTFLOWS_CA_VER,
104
+ false
105
  );
106
 
107
  $current_user = wp_get_current_user();
212
  /**
213
  * Show success messages for email templates.
214
  */
215
+ public function show_messages() {
216
 
217
  $wcf_ca_template_created = filter_input( INPUT_GET, 'wcf_ca_template_created', FILTER_SANITIZE_STRING );
218
  $wcf_ca_template_cloned = filter_input( INPUT_GET, 'wcf_ca_template_cloned', FILTER_SANITIZE_STRING );
225
  <div id="message" class="notice notice-success is-dismissible">
226
  <p>
227
  <strong>
228
+ <?php esc_html_e( 'The Email Template has been successfully added.', 'woo-cart-abandonment-recovery' ); ?>
229
  </strong>
230
  </p>
231
  </div>
235
  <div id="message" class="notice notice-success is-dismissible">
236
  <p>
237
  <strong>
238
+ <?php esc_html_e( 'The Email Template has been cloned successfully.', 'woo-cart-abandonment-recovery' ); ?>
239
  </strong>
240
  </p>
241
  </div>
245
  <div id="message" class="notice notice-success is-dismissible">
246
  <p>
247
  <strong>
248
+ <?php esc_html_e( 'The Email Template has been successfully deleted.', 'woo-cart-abandonment-recovery' ); ?>
249
  </strong>
250
  </p>
251
  </div>
254
  <div id="message" class="notice notice-success is-dismissible">
255
  <p>
256
  <strong>
257
+ <?php esc_html_e( 'The Email Template has been successfully updated.', 'woo-cart-abandonment-recovery' ); ?>
258
  </strong>
259
  </p>
260
  </div>
264
  <div id="message" class="notice notice-success is-dismissible">
265
  <p>
266
  <strong>
267
+ <?php esc_html_e( 'Default Email Templates has been restored successfully.', 'woo-cart-abandonment-recovery' ); ?>
268
  </strong>
269
  </p>
270
  </div>
276
  /**
277
  * Delete bulk email templates.
278
  */
279
+ public function delete_bulk_templates() {
280
  $wcf_template_list = new Cartflows_Ca_Email_Templates_Table();
281
  $wcf_template_list->process_bulk_action();
282
  $param = array(
292
  /**
293
  * Delete email templates.
294
  */
295
+ public function delete_single_template() {
296
 
297
  $id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
298
  $wpnonce = filter_input( INPUT_GET, '_wpnonce', FILTER_SANITIZE_STRING );
318
  /**
319
  * Delete email templates.
320
  */
321
+ public function clone_email_template() {
322
 
323
  $id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
324
  $wpnonce = filter_input( INPUT_GET, '_wpnonce', FILTER_SANITIZE_STRING );
370
  *
371
  * @param int $email_tmpl_id template id.
372
  */
373
+ public function get_email_template_by_id( $email_tmpl_id ) {
374
 
375
  $query = 'SELECT * FROM ' . $this->cart_abandonment_template_table_name . ' WHERE id = %d ';
376
  return $this->wpdb->get_row($this->wpdb->prepare($query, $email_tmpl_id)); // phpcs:ignore
382
  *
383
  * @param string $sub_action sub_action.
384
  */
385
+ public function render_email_template_form( $sub_action = WCF_SUB_ACTION_ADD_EMAIL_TEMPLATES ) {
386
 
387
  $id = filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
388
 
403
  $save_template_url = esc_url( add_query_arg( $param, admin_url( '/admin.php' ) ) );
404
  ?>
405
 
406
+ <form method="post" action="<?php echo esc_attr( $save_template_url ); ?>" id="wcf_settings">
407
+ <input type="hidden" name="sub_action" value="<?php echo esc_attr( $sub_action ); ?>"/>
408
  <?php
409
  $id_by = '';
410
  if ( isset( $id ) ) {
411
  $id_by = $id;
412
  }
413
  ?>
414
+ <input type="hidden" name="id" value="<?php echo esc_attr( $id_by ); ?>"/>
415
  <?php
416
 
417
  $button_sub_action = 'save';
421
  $button_sub_action = 'update';
422
  $display_message = 'Edit Email Template:';
423
  }
424
+ print '<input type="hidden" name="wcf_settings_frm" value="' . esc_attr( $button_sub_action ) . '">';
425
  ?>
426
  <div id="poststuff">
427
  <div> <!-- <div class="postbox" > -->
428
+ <h3><?php esc_html_e($display_message, 'woo-cart-abandonment-recovery'); // phpcs:ignore ?></h3>
429
  <hr/>
430
  <div>
431
  <table class="form-table" id="addedit_template">
432
  <tr>
433
  <th>
434
+ <label for="wcf_email_subject"><b><?php esc_html_e( 'Activate Template now?', 'woo-cart-abandonment-recovery' ); ?></b></label>
435
  </th>
436
  <td>
437
  <?php
442
  $is_activated = $active_status ? 'on' : 'off';
443
 
444
  }
445
+ print '<button type="button" class="wcf-ca-switch wcf-toggle-template-status" wcf-template-id="1" wcf-ca-template-switch="' . esc_attr( $is_activated ) . '"> ' . esc_attr( $is_activated ) . ' </button>';
446
+ print '<input type="hidden" name="wcf_activate_email_template" id="wcf_activate_email_template" value="' . esc_attr( $active_status ) . '" />';
447
  ?>
448
 
449
  </td>
451
 
452
  <tr>
453
  <th>
454
+ <label for="wcf_template_name"><b><?php esc_html_e( 'Template Name:', 'woo-cart-abandonment-recovery' ); ?></b></label>
455
  </th>
456
  <td>
457
  <?php
459
  if ( WCF_SUB_ACTION_EDIT_EMAIL_TEMPLATES === $sub_action && $results && isset( $results->template_name ) ) {
460
  $template_name = $results->template_name;
461
  }
462
+ print '<input type="text" name="wcf_template_name" id="wcf_template_name" class="wcf-ca-trigger-input" value="' . esc_attr( $template_name ) . '">';
463
  ?>
464
  </td>
465
  </tr>
466
 
467
  <tr>
468
  <th>
469
+ <label for="wcf_email_subject"><b><?php esc_html_e( 'Email Subject:', 'woo-cart-abandonment-recovery' ); ?></b></label>
470
  </th>
471
  <td>
472
  <?php
474
  if ( WCF_SUB_ACTION_EDIT_EMAIL_TEMPLATES === $sub_action && $results && isset( $results->email_subject ) ) {
475
  $subject_edit = stripslashes( $results->email_subject );
476
  }
477
+ print '<input type="text" name="wcf_email_subject" id="wcf_email_subject" class="wcf-ca-trigger-input" value="' . esc_attr( $subject_edit ) . '">';
478
  ?>
479
  </td>
480
  </tr>
481
 
482
  <tr>
483
  <th>
484
+ <label for="wcf_email_body"><b><?php esc_html_e( 'Email Body:', 'woo-cart-abandonment-recovery' ); ?></b></label>
485
  </th>
486
  <td>
487
  <?php
504
  );
505
 
506
  ?>
507
+ <?php echo stripslashes( get_option( 'wcf_email_body' ) ); //phpcs:ignore ?>
508
  </td>
509
  </tr>
510
 
511
  <tr>
512
  <th>
513
+ <label for="wcf_override_global_coupon"><b><?php esc_html_e( 'Create Coupon', 'woo-cart-abandonment-recovery' ); ?></b></label>
514
  </th>
515
  <td>
516
  <?php
523
  }
524
  }
525
 
526
+ print '<input ' . esc_attr( $wcf_override_global_coupon ) . ' id="wcf_override_global_coupon" name="wcf_override_global_coupon" type="checkbox" value="" /><span class="description">' . esc_html__( 'Allows you to send new coupon only for this template.', 'woo-cart-abandonment-recovery' ) . '</span>';
527
  ?>
528
  </td>
529
  </tr>
530
 
531
  <tr>
532
  <th>
533
+ <label class="wcf-sub-heading" for="wcf_email_discount_type"> <?php esc_html_e( 'Discount Type', 'woo-cart-abandonment-recovery' ); ?> </label>
534
  </th>
535
  <td>
536
  <?php
551
  echo '<select id="wcf_email_discount_type" name="wcf_email_discount_type">';
552
  foreach ( $dropdown_options as $key => $value ) {
553
  $is_selected = $key === $wcf_email_discount_type ? 'selected' : '';
554
+ echo '<option ' . esc_attr( $is_selected ) . ' value=' . esc_attr( $key ) . '>' . esc_attr( $value ) . '</option>';
555
 
556
  }
557
  echo '</select>';
562
 
563
  <tr>
564
  <th>
565
+ <label class="wcf-sub-heading" for="wcf_email_discount_amount"> <?php esc_html_e( 'Coupon Amount', 'woo-cart-abandonment-recovery' ); ?> </label>
566
  </th>
567
  <td>
568
  <?php
573
  $wcf_email_discount_amount = $wcf_email_discount_amount->meta_value;
574
  }
575
  }
576
+ print '<input class="wcf-ca-trigger-input wcf-ca-email-inputs" type="number" id="wcf_email_discount_amount" name="wcf_email_discount_amount" value="' . esc_attr( $wcf_email_discount_amount ) . '">';
577
  ?>
578
  </td>
579
  </tr>
580
 
581
  <tr>
582
  <th>
583
+ <label class="wcf-sub-heading" for="wcf_email_coupon_expiry_date"> <?php esc_html_e( 'Coupon expiry date', 'woo-cart-abandonment-recovery' ); ?> </label>
584
  </th>
585
  <td>
586
  <?php
598
  $coupon_expiry_unit = $wcf_email_coupon_expiry_unit->meta_value;
599
  }
600
  }
601
+ print '<input type="number" class="wcf-ca-trigger-input wcf-ca-coupon-inputs" id="wcf_email_coupon_expiry_date" name="wcf_email_coupon_expiry_date" value="' . intval( $wcf_email_coupon_expiry_date ) . '" autocomplete="off" />';
602
  $items = array(
603
+ 'hours' => esc_html__( 'Hour(s)', 'woo-cart-abandonment-recovery' ),
604
+ 'days' => esc_html__( 'Day(s)', 'woo-cart-abandonment-recovery' ),
605
  );
606
  echo "<select id='wcf_coupon_expiry_unit' name='wcf_coupon_expiry_unit'>";
607
  foreach ( $items as $key => $item ) {
608
  $selected = ( $coupon_expiry_unit === $key ) ? 'selected="selected"' : '';
609
+ echo "<option value='$key' $selected>$item</option>"; //phpcs:ignore
610
  }
611
  echo '</select>';
612
 
613
+ echo " <span class='description'>" . esc_html__( 'Enter zero (0) to restrict coupon from expiring', 'woo-cart-abandonment-recovery' ) . ' </span>'
614
  ?>
615
  </td>
616
  </tr>
617
  <tr>
618
  <th>
619
+ <label class="wcf-sub-heading" for="wcf_free_shipping_coupon"> <?php esc_html_e( 'Free Shipping', 'woo-cart-abandonment-recovery' ); ?> </label>
620
  </th>
621
  <td>
622
  <?php
629
  }
630
  }
631
 
632
+ print '<input ' . esc_attr( $wcf_free_shipping_coupon ) . ' id="wcf_free_shipping_coupon" name="wcf_free_shipping_coupon" type="checkbox" value="" /><span class="description"> ' . esc_html__( 'Allows you to grant free shipping. A free shipping method must be enabled in your shipping zone and be set to require "a valid free shipping coupon". ', 'woo-cart-abandonment-recovery' ) . '</span>';
633
 
634
  ?>
635
  </td>
636
  </tr>
637
  <tr>
638
  <th>
639
+ <label class="wcf-sub-heading" for="wcf_individual_use_only"><?php esc_html_e( 'Individual use only', 'woo-cart-abandonment-recovery' ); ?></label>
640
  </th>
641
  <td>
642
  <?php
649
  }
650
  }
651
 
652
+ print '<input ' . esc_attr( $wcf_individual_use_only ) . ' id="wcf_individual_use_only" name="wcf_individual_use_only" type="checkbox" value="" />
653
+ <span class="description">' . esc_html__( 'Check this box if the coupon cannot be used in conjunction with other coupons.', 'woo-cart-abandonment-recovery' ) . ' </span>';
654
 
655
  ?>
656
  </td>
657
  </tr>
658
  <tr>
659
  <th>
660
+ <label class="wcf-sub-heading" for="wcf_apply_coupon_auto"> <?php esc_html_e( 'Auto Apply Coupon', 'woo-cart-abandonment-recovery' ); ?> </label>
661
  </th>
662
  <td>
663
  <?php
671
  }
672
  }
673
 
674
+ print '<input ' . esc_attr( $wcf_apply_coupon_auto ) . ' id="wcf_auto_coupon_apply" name="wcf_auto_coupon_apply" type="checkbox" value="" /><span class="description" > ' . esc_html__( ' Automatically add the coupon to the cart at the checkout.', 'woo-cart-abandonment-recovery' ) . ' </span>';
675
  ?>
676
  </td>
677
  </tr>
678
  <tr>
679
  <th>
680
+ <label for="wcf_email_subject"><b><?php esc_html_e( 'Send This Email', 'woo-cart-abandonment-recovery' ); ?></b></label>
681
  </th>
682
  <td>
683
  <?php
685
  if ( WCF_SUB_ACTION_EDIT_EMAIL_TEMPLATES === $sub_action && $results && isset( $results->frequency ) ) {
686
  $frequency_edit = $results->frequency;
687
  }
688
+ print '<input style="width:15%" type="number" name="wcf_email_frequency" id="wcf_email_frequency" class="wcf-ca-trigger-input" value="' . esc_attr( $frequency_edit ) . '">';
689
  ?>
690
 
691
  <select name="wcf_email_frequency_unit" id="wcf_email_frequency_unit">
695
  $frequency_unit = $results->frequency_unit;
696
  }
697
  $days_or_hours = array(
698
+ 'MINUTE' => esc_html__( 'Minute(s)', 'woo-cart-abandonment-recovery' ),
699
+ 'HOUR' => esc_html__( 'Hour(s)', 'woo-cart-abandonment-recovery' ),
700
+ 'DAY' => esc_html__( 'Day(s)', 'woo-cart-abandonment-recovery' ),
701
  );
702
+ foreach ( $days_or_hours as $key => $value ) {
703
  printf(
704
  "<option %s value='%s'>%s</option>\n",
705
+ selected( $key, $frequency_unit, false ),
706
+ esc_attr( $key ),
707
+ esc_attr( $value )
708
  );
709
  }
710
  ?>
711
  </select>
712
  <span class="description">
713
+ <?php esc_html_e( 'after cart is abandoned.', 'woo-cart-abandonment-recovery' ); ?>
714
  </span>
715
 
716
 
720
  <tr>
721
  <?php $current_user = wp_get_current_user(); ?>
722
  <th>
723
+ <label for="wcf_email_preview"><b><?php esc_html_e( 'Send Test Email To:', 'woo-cart-abandonment-recovery' ); ?></b></label>
724
  </th>
725
  <td>
726
+ <input class="wcf-ca-trigger-input" type="text" id="wcf_send_test_email" name="send_test_email" value="<?php echo esc_attr( $current_user->user_email ); ?>" class="wcf-ca-trigger-input">
727
+ <input class="button" type="button" value=" <?php esc_html_e( 'Send a test email', 'woo-cart-abandonment-recovery' ); ?>" id="wcf_preview_email"/> <br/>
728
 
729
  <label id="mail_response_msg"> </label>
730
  </td>
737
  <?php wp_nonce_field( WCF_EMAIL_TEMPLATES_NONCE, '_wpnonce' ); ?>
738
  <p class="submit">
739
  <?php
740
+ $button_value = esc_html__( 'Save Changes', 'woo-cart-abandonment-recovery' );
741
  if ( WCF_SUB_ACTION_EDIT_EMAIL_TEMPLATES === $sub_action ) {
742
+ $button_value = esc_html__( 'Update Changes', 'woo-cart-abandonment-recovery' );
743
  }
744
  ?>
745
+ <input type="submit" name="Submit" class="button-primary" value="<?php echo esc_attr( $button_value ); ?>"/>
746
  </p>
747
  </form>
748
  </div>
756
  *
757
  * @return array
758
  */
759
+ public function sanitize_email_post_data() {
760
 
761
  $input_post_values = array(
762
  'wcf_email_subject' => array(
809
  $sanitized_post = array();
810
  foreach ( $input_post_values as $key => $input_post_value ) {
811
 
812
+ if ( isset( $_POST[ $key ] ) ) { //phpcs:ignore
813
  $sanitized_post[ $key ] = filter_input( INPUT_POST, $key, $input_post_value['sanitize'] );
814
  } else {
815
  $sanitized_post[ $key ] = $input_post_value['default'];
816
  }
817
  }
818
 
819
+ $sanitized_post['wcf_override_global_coupon'] = isset( $_POST['wcf_override_global_coupon'] ) ? true : false; //phpcs:ignore
820
+ $sanitized_post['wcf_auto_coupon_apply'] = isset( $_POST['wcf_auto_coupon_apply'] ) ? true : false; //phpcs:ignore
821
+ $sanitized_post['wcf_free_shipping_coupon'] = isset( $_POST['wcf_free_shipping_coupon'] ) ? true : false; //phpcs:ignore
822
+ $sanitized_post['wcf_individual_use_only'] = isset( $_POST['wcf_individual_use_only'] ) ? true : false; //phpcs:ignore
823
+ $sanitized_post['wcf_email_body'] = html_entity_decode( $sanitized_post['wcf_email_body'], ENT_COMPAT, 'UTF-8' );
824
 
825
  return $sanitized_post;
826
 
830
  /**
831
  * Add email template callback ajax.
832
  */
833
+ public function add_email_template() {
834
 
835
  $sanitized_post = $this->sanitize_email_post_data();
836
  $this->wpdb->insert(
878
  /**
879
  * Edit email template callback ajax.
880
  */
881
+ public function edit_email_template() {
882
  $sanitized_post = $this->sanitize_email_post_data();
883
  $email_template_id = $sanitized_post['id'];
884
 
956
  * @param string $meta_key meta key.
957
  * @param string $meta_value meta value.
958
  */
959
+ public function update_email_template_meta( $email_template_id, $meta_key, $meta_value ) {
960
 
961
  $template_meta = $this->get_email_template_meta_by_key( $email_template_id, $meta_key );
962
 
964
  $this->wpdb->update(
965
  $this->email_templates_meta_table,
966
  array(
967
+ 'meta_value' => sanitize_text_field( $meta_value ), // phpcs:ignore
968
  ),
969
  array(
970
  'email_template_id' => $email_template_id,
971
+ 'meta_key' => sanitize_text_field( $meta_key ), // phpcs:ignore
972
  )
973
  );
974
  } else {
985
  * @param string $meta_key meta key.
986
  * @param string $meta_value meta value.
987
  */
988
+ public function add_email_template_meta( $email_template_id, $meta_key, $meta_value ) {
989
  $this->wpdb->insert(
990
  $this->email_templates_meta_table,
991
  array(
992
  'email_template_id' => $email_template_id,
993
+ 'meta_key' => sanitize_text_field( $meta_key ), // phpcs:ignore
994
+ 'meta_value' => sanitize_text_field( $meta_value ), // phpcs:ignore
995
  )
996
  );
997
  }
1002
  * @param integer $email_template_id email template id.
1003
  * @param string $meta_key meta key.
1004
  */
1005
+ public function get_email_template_meta_by_key( $email_template_id, $meta_key ) {
1006
  return $this->wpdb->get_row(
1007
  $this->wpdb->prepare( "select * from $this->email_templates_meta_table where email_template_id = %d AND meta_key = %s", $email_template_id, $meta_key ) // phpcs:ignore
1008
  );
1011
  /**
1012
  * Render email template grid.
1013
  */
1014
+ public function show_email_template_data_table() {
1015
  $wcf_template_list = new Cartflows_Ca_Email_Templates_Table();
1016
  $wcf_template_list->prepare_items();
1017
  $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
1045
  ?>
1046
  <div class="wcf-ca-report-btn">
1047
  <div class="wcf-ca-left-report-field-group">
1048
+ <a style="cursor: pointer" href="<?php echo esc_url( $add_new_template_url ); ?>" class="button-secondary"><?php esc_html_e( 'Create New Template', 'woo-cart-abandonment-recovery' ); ?></a>
1049
  </div>
1050
  <div class="wcf-ca-right-report-field-group">
1051
+ <a onclick="return confirm('Are you sure to restore email templates?');" style="cursor: pointer" href="<?php echo esc_url( $restore_template_url ); ?>" class="button-secondary"><?php esc_html_e( ' Restore Default Templates', 'woo-cart-abandonment-recovery' ); ?></a>
1052
  </div>
1053
  </div>
1054
  <?php
modules/cart-abandonment/class-cartflows-ca-module-loader.php CHANGED
@@ -24,7 +24,7 @@ class Cartflows_Ca_Module_Loader {
24
  */
25
  public static function get_instance() {
26
  if ( ! isset( self::$instance ) ) {
27
- self::$instance = new self;
28
  }
29
  return self::$instance;
30
  }
@@ -41,7 +41,7 @@ class Cartflows_Ca_Module_Loader {
41
  /**
42
  * Load required files for module.
43
  */
44
- function load_module_files() {
45
 
46
  /* Cart abandonment templates class */
47
  include_once CARTFLOWS_CA_DIR . 'modules/cart-abandonment/class-cartflows-ca-email-templates.php';
24
  */
25
  public static function get_instance() {
26
  if ( ! isset( self::$instance ) ) {
27
+ self::$instance = new self();
28
  }
29
  return self::$instance;
30
  }
41
  /**
42
  * Load required files for module.
43
  */
44
+ private function load_module_files() {
45
 
46
  /* Cart abandonment templates class */
47
  include_once CARTFLOWS_CA_DIR . 'modules/cart-abandonment/class-cartflows-ca-email-templates.php';
modules/cart-abandonment/includes/admin/cartflows-ca-single-report-details.php CHANGED
@@ -23,8 +23,8 @@
23
  );
24
  }
25
  ?>
26
- <a href="<?php echo $back_link; ?>" class="button button-secondary back-button"><span
27
- class="dashicons dashicons-arrow-left"></span> <?php _e( 'Back to Reports', 'woo-cart-abandonment-recovery' ); ?> </a>
28
  </div>
29
  </div>
30
 
@@ -35,7 +35,7 @@
35
 
36
  <div class="wcf-ca-report-btn" style="padding: 0px">
37
  <div class="wcf-ca-left-report-field-group">
38
- <h2> <?php _e( 'Email Details:', 'woo-cart-abandonment-recovery' ); ?> </h2>
39
  </div>
40
  <div class="wcf-ca-right-report-field-group">
41
 
@@ -45,45 +45,45 @@
45
  <div style="text-align:center;">
46
  <p>
47
  <?php
48
- _e(
49
- 'All new activated emails will be reschedule for this abandoned order. <br/>New emails will
50
  be sent to user according to schedule time.',
51
  'woo-cart-abandonment-recovery'
52
  );
53
  ?>
54
  </p>
55
  <p>
56
- <strong><?php _e( 'Are your sure?', 'woo-cart-abandonment-recovery' ); ?></strong>
57
  </p>
58
  <p>
59
- <button onclick="window.location.search += '&sub_action=<?php echo WCF_SUB_ACTION_REPORTS_RESCHEDULE; ?>';"
60
- class="button button-secondary"> <?php _e( 'Reschedule', 'woo-cart-abandonment-recovery' ); ?>
61
  </button>
62
  <button type="button"
63
  onclick='document.getElementById("TB_closeWindowButton").click()'
64
- class="button button-secondary"> <?php _e( 'Close', 'woo-cart-abandonment-recovery' ); ?>
65
  </button>
66
  </p>
67
  </div>
68
  </div>
69
- <a name="<?php _e( 'Do you really want to reschedule emails?', 'woo-cart-abandonment-recovery' ); ?>" href="#TB_inline?&width=500&height=200&inlineId=wcf-ca-confirm-email-reschedule" class="thickbox button button-secondary"> <?php _e( 'Reschedule Emails', 'woo-cart-abandonment-recovery' ); ?> </a>
70
  <?php endif; ?>
71
  </div>
72
  </div>
73
 
74
  <?php if ( empty( $scheduled_emails ) ) : ?>
75
- <div style="text-align: center;"><strong> <?php _e( ' No Email Scheduled.', 'woo-cart-abandonment-recovery' ); ?></strong>
76
  </div>
77
  <?php else : ?>
78
  <table cellpadding="15" cellspacing="0" class="wcf-table wcf-table-striped fixed posts">
79
  <thead>
80
  <tr>
81
 
82
- <th class="wcf-ca-report-table-row"> <?php _e( 'Scheduled Template', 'woo-cart-abandonment-recovery' ); ?></th>
83
- <th class="wcf-ca-report-table-row"> <?php _e( 'Email Subject', 'woo-cart-abandonment-recovery' ); ?></th>
84
- <th class="wcf-ca-report-table-row"> <?php _e( 'Email Coupon', 'woo-cart-abandonment-recovery' ); ?></th>
85
- <th class="wcf-ca-report-table-row"> <?php _e( 'Email Sent', 'woo-cart-abandonment-recovery' ); ?></th>
86
- <th class="wcf-ca-report-table-row"><span class="dashicons dashicons-clock"></span> <?php _e( 'Scheduled At', 'woo-cart-abandonment-recovery' ); ?>
87
  </th>
88
 
89
  </tr>
@@ -111,38 +111,38 @@
111
  switch ( $scheduled_email->email_sent ) {
112
  case 0:
113
  if ( $details->unsubscribed ) {
114
- $icon = '<span class="dashicons dashicons-minus"></span>';
115
- $title = __( 'The email has been unsubscribed and won\'t be sent further.', 'woo-cart-abandonment-recovery' );
116
  } else {
117
- $icon = '<span class="dashicons dashicons-no"></span>';
118
- $title = __( 'Email is in the queue and will be sent at the scheduled time.', 'woo-cart-abandonment-recovery' );
119
  }
120
  break;
121
  case 1:
122
- $icon = '<span class="dashicons dashicons-yes wp-ui-text-highlight" ></span>';
123
- $title = __( 'The email has been sent.', 'woo-cart-abandonment-recovery' );
124
  break;
125
  case -1:
126
- $icon = '<span class="dashicons dashicons-dismiss wp-ui-text-highlight" ></span>';
127
- $title = __( 'The email has been unscheduled due to the complete order and won\'t be sent further.', 'woo-cart-abandonment-recovery' );
128
  break;
129
  }
130
 
131
 
132
- $scheduled_time = date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $scheduled_email->scheduled_time ) );
133
  ?>
134
 
135
  <tr class="wcf-ca-report-table-row">
136
  <td class="wcf-ca-report-table-row"><a
137
- href="<?php echo $email_tmpl_url; ?>"
138
- class="wp-ui-text-highlight"> <?php echo( $scheduled_email->template_name ); ?> </a>
139
  </td>
140
- <td class="wcf-ca-report-table-row"> <?php echo( $scheduled_email->email_subject ); ?> </td>
141
- <td class="wcf-ca-report-table-row"> <?php echo( $scheduled_email->coupon_code ? $scheduled_email->coupon_code : '--' ); ?> </td>
142
- <td class="wcf-ca-report-table-row wcf-ca-icon-row"> <?php echo $icon; ?>
143
- <span class="wcf-ca-tooltip-text"><?php echo $title; ?></span>
144
  </td>
145
- <td class="wcf-ca-report-table-row"> <?php echo( $scheduled_time ); ?> </td>
146
  </tr>
147
  <?php endforeach; ?>
148
  </tbody>
@@ -157,76 +157,76 @@
157
 
158
  <div class="wcf-ca-report-btn" style="padding: 0px">
159
  <div class="wcf-ca-left-report-field-group">
160
- <h2> <?php _e( 'User Address Details:', 'woo-cart-abandonment-recovery' ); ?> </h2>
161
  </div>
162
  <div class="wcf-ca-right-report-field-group">
163
  <?php if ( $details->unsubscribed ) : ?>
164
- <span class="wcf-ca-tag"> <?php _e( 'Unsubscribed', 'woo-cart-abandonment-recovery' ); ?> </span>
165
  <?php endif; ?>
166
 
167
- <span class="wcf-ca-tag"> <?php echo ucfirst( $details->order_status ); ?> </span>
168
  </div>
169
  </div>
170
 
171
  <div class="wcf-ca-user-address wcf-pull-left">
172
- <h3> <?php _e( 'Billing Address', 'woo-cart-abandonment-recovery' ); ?> </h3>
173
- <p><strong> <?php _e( 'Name', 'woo-cart-abandonment-recovery' ); ?> </strong>
174
- <?php echo $user_details->wcf_first_name . ' ' . $user_details->wcf_last_name; ?> </p>
175
  <p>
176
- <strong> <?php _e( 'Email address', 'woo-cart-abandonment-recovery' ); ?> </strong>
177
- <a href="mailto:<?php echo( $details->email ); ?>"><?php echo( $details->email ); ?></a>
178
  </p>
179
 
180
  <p>
181
- <strong> <?php _e( 'Phone', 'woo-cart-abandonment-recovery' ); ?> </strong>
182
- <a href="tel:<?php echo( $user_details->wcf_phone_number ); ?>"><?php echo( $user_details->wcf_phone_number ); ?></a>
183
  </p>
184
 
185
  <p>
186
- <strong> <?php _e( 'Address 1:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo $user_details->wcf_billing_address_1; ?>
187
  </p>
188
  <p>
189
- <strong> <?php _e( 'Address 2:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo $user_details->wcf_billing_address_2; ?>
190
  </p>
191
  <p>
192
- <strong> <?php _e( 'Country, City:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo( $user_details->wcf_location ); ?>
193
  </p>
194
  <p>
195
- <strong> <?php _e( 'State:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo( $user_details->wcf_billing_state ); ?>
196
  </p>
197
 
198
  <p>
199
- <strong> <?php _e( 'Postcode:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo( $user_details->wcf_billing_postcode ); ?>
200
  </p>
201
  </div>
202
 
203
  <div class="wcf-ca-user-address wcf-pull-left">
204
- <h3> <?php _e( 'Shipping Address', 'woo-cart-abandonment-recovery' ); ?> </h3>
205
  <p>
206
- <strong> <?php _e( 'Address 1:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo( $user_details->wcf_shipping_address_1 ); ?>
207
  </p>
208
  <p>
209
- <strong> <?php _e( 'Address 2:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo( $user_details->wcf_shipping_address_2 ); ?>
210
  </p>
211
  <p>
212
- <strong> <?php _e( 'City:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo( $user_details->wcf_shipping_city ); ?>
213
  </p>
214
  <p>
215
- <strong> <?php _e( 'State:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo( $user_details->wcf_shipping_state ); ?>
216
  </p>
217
  <p>
218
- <strong> <?php _e( 'Country:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo( $user_details->wcf_shipping_country ); ?>
219
  </p>
220
  <p>
221
- <strong> <?php _e( 'Postcode:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo( $user_details->wcf_shipping_postcode ); ?>
222
  </p>
223
  <p>
224
  <?php
225
  $cart_abandonment = Cartflows_Ca_Cart_Abandonment::get_instance();
226
  $token_data = array( 'wcf_session_id' => $details->session_id );
227
  ?>
228
- <strong> <a target="_blank" href=" <?php echo $cart_abandonment->get_checkout_url( $details->checkout_id, $token_data ); ?> ">
229
- <?php _e( 'Checkout Link', 'woo-cart-abandonment-recovery' ); ?>
230
  </a>
231
  </strong>
232
  </p>
@@ -241,8 +241,8 @@
241
  <div class="wcf-ca-panel">
242
  <div class="wcf-ca-column wcf-ca-column-one">
243
  <div class="wcf-ca-user-order">
244
- <h2> <?php _e( 'User Order Details:', 'woo-cart-abandonment-recovery' ); ?> </h2>
245
- <?php echo( $this->get_admin_product_block( $details->cart_contents, $details->cart_total ) ); ?>
246
  </div>
247
  </div>
248
  </div>
23
  );
24
  }
25
  ?>
26
+ <a href="<?php echo esc_attr( $back_link ); ?>" class="button button-secondary back-button"><span
27
+ class="dashicons dashicons-arrow-left"></span> <?php esc_html_e( 'Back to Reports', 'woo-cart-abandonment-recovery' ); ?> </a>
28
  </div>
29
  </div>
30
 
35
 
36
  <div class="wcf-ca-report-btn" style="padding: 0px">
37
  <div class="wcf-ca-left-report-field-group">
38
+ <h2> <?php esc_html_e( 'Email Details:', 'woo-cart-abandonment-recovery' ); ?> </h2>
39
  </div>
40
  <div class="wcf-ca-right-report-field-group">
41
 
45
  <div style="text-align:center;">
46
  <p>
47
  <?php
48
+ esc_html_e(
49
+ 'All new activated emails will be reschedule for this abandoned order.New emails will
50
  be sent to user according to schedule time.',
51
  'woo-cart-abandonment-recovery'
52
  );
53
  ?>
54
  </p>
55
  <p>
56
+ <strong><?php esc_html_e( 'Are your sure?', 'woo-cart-abandonment-recovery' ); ?></strong>
57
  </p>
58
  <p>
59
+ <button onclick="window.location.search += '&sub_action=<?php echo esc_attr( WCF_SUB_ACTION_REPORTS_RESCHEDULE ); ?>';"
60
+ class="button button-secondary"> <?php esc_html_e( 'Reschedule', 'woo-cart-abandonment-recovery' ); ?>
61
  </button>
62
  <button type="button"
63
  onclick='document.getElementById("TB_closeWindowButton").click()'
64
+ class="button button-secondary"> <?php esc_html_e( 'Close', 'woo-cart-abandonment-recovery' ); ?>
65
  </button>
66
  </p>
67
  </div>
68
  </div>
69
+ <a name="<?php esc_html_e( 'Do you really want to reschedule emails?', 'woo-cart-abandonment-recovery' ); ?>" href="#TB_inline?&width=500&height=200&inlineId=wcf-ca-confirm-email-reschedule" class="thickbox button button-secondary"> <?php esc_html_e( 'Reschedule Emails', 'woo-cart-abandonment-recovery' ); ?> </a>
70
  <?php endif; ?>
71
  </div>
72
  </div>
73
 
74
  <?php if ( empty( $scheduled_emails ) ) : ?>
75
+ <div style="text-align: center;"><strong> <?php esc_html_e( ' No Email Scheduled.', 'woo-cart-abandonment-recovery' ); ?></strong>
76
  </div>
77
  <?php else : ?>
78
  <table cellpadding="15" cellspacing="0" class="wcf-table wcf-table-striped fixed posts">
79
  <thead>
80
  <tr>
81
 
82
+ <th class="wcf-ca-report-table-row"> <?php esc_html_e( 'Scheduled Template', 'woo-cart-abandonment-recovery' ); ?></th>
83
+ <th class="wcf-ca-report-table-row"> <?php esc_html_e( 'Email Subject', 'woo-cart-abandonment-recovery' ); ?></th>
84
+ <th class="wcf-ca-report-table-row"> <?php esc_html_e( 'Email Coupon', 'woo-cart-abandonment-recovery' ); ?></th>
85
+ <th class="wcf-ca-report-table-row"> <?php esc_html_e( 'Email Sent', 'woo-cart-abandonment-recovery' ); ?></th>
86
+ <th class="wcf-ca-report-table-row"><span class="dashicons dashicons-clock"></span> <?php esc_html_e( 'Scheduled At', 'woo-cart-abandonment-recovery' ); ?>
87
  </th>
88
 
89
  </tr>
111
  switch ( $scheduled_email->email_sent ) {
112
  case 0:
113
  if ( $details->unsubscribed ) {
114
+ $icon = '<span class="dashicons dashicons-minus"></span>';
115
+ $title_text = esc_html__( 'The email has been unsubscribed and won\'t be sent further.', 'woo-cart-abandonment-recovery' );
116
  } else {
117
+ $icon = '<span class="dashicons dashicons-no"></span>';
118
+ $title_text = esc_html__( 'Email is in the queue and will be sent at the scheduled time.', 'woo-cart-abandonment-recovery' );
119
  }
120
  break;
121
  case 1:
122
+ $icon = '<span class="dashicons dashicons-yes wp-ui-text-highlight" ></span>';
123
+ $title_text = esc_html__( 'The email has been sent.', 'woo-cart-abandonment-recovery' );
124
  break;
125
  case -1:
126
+ $icon = '<span class="dashicons dashicons-dismiss wp-ui-text-highlight" ></span>';
127
+ $title_text = esc_html__( 'The email has been unscheduled due to the complete order and won\'t be sent further.', 'woo-cart-abandonment-recovery' );
128
  break;
129
  }
130
 
131
 
132
+ $scheduled_time = gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $scheduled_email->scheduled_time ) );
133
  ?>
134
 
135
  <tr class="wcf-ca-report-table-row">
136
  <td class="wcf-ca-report-table-row"><a
137
+ href="<?php echo esc_url( $email_tmpl_url ); ?>"
138
+ class="wp-ui-text-highlight"> <?php echo esc_attr( $scheduled_email->template_name ); ?> </a>
139
  </td>
140
+ <td class="wcf-ca-report-table-row"> <?php echo esc_attr( $scheduled_email->email_subject ); ?> </td>
141
+ <td class="wcf-ca-report-table-row"> <?php echo esc_attr( $scheduled_email->coupon_code ? $scheduled_email->coupon_code : '--' ); ?> </td>
142
+ <td class="wcf-ca-report-table-row wcf-ca-icon-row"> <?php echo( $icon ); //phpcs:ignore ?>
143
+ <span class="wcf-ca-tooltip-text"><?php echo esc_attr( $title_text ); ?></span>
144
  </td>
145
+ <td class="wcf-ca-report-table-row"> <?php echo esc_attr( $scheduled_time ); ?> </td>
146
  </tr>
147
  <?php endforeach; ?>
148
  </tbody>
157
 
158
  <div class="wcf-ca-report-btn" style="padding: 0px">
159
  <div class="wcf-ca-left-report-field-group">
160
+ <h2> <?php esc_html_e( 'User Address Details:', 'woo-cart-abandonment-recovery' ); ?> </h2>
161
  </div>
162
  <div class="wcf-ca-right-report-field-group">
163
  <?php if ( $details->unsubscribed ) : ?>
164
+ <span class="wcf-ca-tag"> <?php esc_html_e( 'Unsubscribed', 'woo-cart-abandonment-recovery' ); ?> </span>
165
  <?php endif; ?>
166
 
167
+ <span class="wcf-ca-tag"> <?php echo esc_attr( ucfirst( $details->order_status ) ); ?> </span>
168
  </div>
169
  </div>
170
 
171
  <div class="wcf-ca-user-address wcf-pull-left">
172
+ <h3> <?php esc_html_e( 'Billing Address', 'woo-cart-abandonment-recovery' ); ?> </h3>
173
+ <p><strong> <?php esc_html_e( 'Name', 'woo-cart-abandonment-recovery' ); ?> </strong>
174
+ <?php echo esc_attr( $user_details->wcf_first_name . ' ' . $user_details->wcf_last_name ); ?> </p>
175
  <p>
176
+ <strong> <?php esc_html_e( 'Email address', 'woo-cart-abandonment-recovery' ); ?> </strong>
177
+ <a href="mailto:<?php echo esc_attr( $details->email ); ?>"><?php echo esc_attr( $details->email ); ?></a>
178
  </p>
179
 
180
  <p>
181
+ <strong> <?php esc_html_e( 'Phone', 'woo-cart-abandonment-recovery' ); ?> </strong>
182
+ <a href="tel:<?php echo esc_attr( $user_details->wcf_phone_number ); ?>"><?php echo esc_attr( $user_details->wcf_phone_number ); ?></a>
183
  </p>
184
 
185
  <p>
186
+ <strong> <?php esc_html_e( 'Address 1:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo esc_attr( $user_details->wcf_billing_address_1 ); ?>
187
  </p>
188
  <p>
189
+ <strong> <?php esc_html_e( 'Address 2:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo esc_attr( $user_details->wcf_billing_address_2 ); ?>
190
  </p>
191
  <p>
192
+ <strong> <?php esc_html_e( 'Country, City:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo esc_attr( $user_details->wcf_location ); ?>
193
  </p>
194
  <p>
195
+ <strong> <?php esc_html_e( 'State:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo esc_attr( $user_details->wcf_billing_state ); ?>
196
  </p>
197
 
198
  <p>
199
+ <strong> <?php esc_html_e( 'Postcode:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo esc_attr( $user_details->wcf_billing_postcode ); ?>
200
  </p>
201
  </div>
202
 
203
  <div class="wcf-ca-user-address wcf-pull-left">
204
+ <h3> <?php esc_html_e( 'Shipping Address', 'woo-cart-abandonment-recovery' ); ?> </h3>
205
  <p>
206
+ <strong> <?php esc_html_e( 'Address 1:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo esc_attr( $user_details->wcf_shipping_address_1 ); ?>
207
  </p>
208
  <p>
209
+ <strong> <?php esc_html_e( 'Address 2:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo esc_attr( $user_details->wcf_shipping_address_2 ); ?>
210
  </p>
211
  <p>
212
+ <strong> <?php esc_html_e( 'City:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo esc_attr( $user_details->wcf_shipping_city ); ?>
213
  </p>
214
  <p>
215
+ <strong> <?php esc_html_e( 'State:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo esc_attr( $user_details->wcf_shipping_state ); ?>
216
  </p>
217
  <p>
218
+ <strong> <?php esc_html_e( 'Country:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo esc_attr( $user_details->wcf_shipping_country ); ?>
219
  </p>
220
  <p>
221
+ <strong> <?php esc_html_e( 'Postcode:', 'woo-cart-abandonment-recovery' ); ?> </strong> <?php echo esc_attr( $user_details->wcf_shipping_postcode ); ?>
222
  </p>
223
  <p>
224
  <?php
225
  $cart_abandonment = Cartflows_Ca_Cart_Abandonment::get_instance();
226
  $token_data = array( 'wcf_session_id' => $details->session_id );
227
  ?>
228
+ <strong> <a target="_blank" href=" <?php echo $cart_abandonment->get_checkout_url( $details->checkout_id, $token_data ); //phpcs:ignore?> ">
229
+ <?php esc_html_e( 'Checkout Link', 'woo-cart-abandonment-recovery' ); ?>
230
  </a>
231
  </strong>
232
  </p>
241
  <div class="wcf-ca-panel">
242
  <div class="wcf-ca-column wcf-ca-column-one">
243
  <div class="wcf-ca-user-order">
244
+ <h2> <?php esc_html_e( 'User Order Details:', 'woo-cart-abandonment-recovery' ); ?> </h2>
245
+ <?php echo( $this->get_admin_product_block( $details->cart_contents, $details->cart_total ) ); //phpcs:ignore ?>
246
  </div>
247
  </div>
248
  </div>
modules/cart-abandonment/includes/admin/cartflows-cart-abandonment-reports.php CHANGED
@@ -11,28 +11,28 @@
11
 
12
  <div class="wcf-ca-left-report-field-group">
13
  <button onclick="window.location.search += '&filter=today';"
14
- class="button <?php echo 'today' === $filter ? 'button-primary' : 'button-secondary'; ?>"> <?php _e( 'Today', 'woo-cart-abandonment-recovery' ); ?>
15
  </button>
16
 
17
  <button onclick="window.location.search += '&filter=yesterday';"
18
- class="button <?php echo 'yesterday' === $filter ? 'button-primary' : 'button-secondary'; ?>"> <?php _e( 'Yesterday', 'woo-cart-abandonment-recovery' ); ?>
19
  </button>
20
 
21
  <button onclick="window.location.search += '&filter=last_week';"
22
- class="button <?php echo 'last_week' === $filter ? 'button-primary' : 'button-secondary'; ?>"> <?php _e( 'Last Week', 'woo-cart-abandonment-recovery' ); ?>
23
  </button>
24
 
25
  <button onclick="window.location.search += '&filter=last_month';"
26
- class="button <?php echo 'last_month' === $filter ? 'button-primary' : 'button-secondary'; ?> "> <?php _e( 'Last Month', 'woo-cart-abandonment-recovery' ); ?>
27
  </button>
28
  </div>
29
 
30
  <div class="wcf-ca-right-report-field-group">
31
 
32
- <input class="wcf-ca-filter-input" type="text" id="wcf_ca_custom_filter_from" placeholder="YYYY-MM-DD" value="<?php echo $from_date; ?>"/>
33
- <input class="wcf-ca-filter-input" type="text" id="wcf_ca_custom_filter_to" placeholder="YYYY-MM-DD" value="<?php echo $to_date; ?>" />
34
  <button id="wcf_ca_custom_filter"
35
- class="button <?php echo 'custom' === $filter ? 'button-primary' : 'button-secondary'; ?> "> <?php _e( 'Custom Filter', 'woo-cart-abandonment-recovery' ); ?>
36
  </button>
37
 
38
  </div>
@@ -43,26 +43,26 @@
43
 
44
  <div class="wcf-ca-ibox">
45
  <div class="wcf-ca-ibox-title">
46
- <h3> <?php _e( 'Recoverable Orders', 'woo-cart-abandonment-recovery' ); ?> </h3>
47
  </div>
48
  <div class="wcf-ca-ibox-content">
49
- <h1> <?php echo $abandoned_report['no_of_orders']; ?> </h1>
50
- <small> <?php _e( 'Total Recoverable Orders.', 'woo-cart-abandonment-recovery' ); ?> </small>
51
  </div>
52
  </div>
53
 
54
  <div class="wcf-ca-ibox">
55
- <div class="wcf-ca-ibox-title"><h3><?php _e( 'Recovered Orders', 'woo-cart-abandonment-recovery' ); ?></h3></div>
56
- <div class="wcf-ca-ibox-content"><h1><?php echo $recovered_report['no_of_orders']; ?></h1>
57
- <small> <?php _e( 'Total Recovered Orders.', 'woo-cart-abandonment-recovery' ); ?> </small>
58
  </div>
59
  </div>
60
 
61
  <div class="wcf-ca-ibox">
62
- <div class="wcf-ca-ibox-title"><h3><?php _e( 'Lost Orders', 'woo-cart-abandonment-recovery' ); ?></h3></div>
63
  <div class="wcf-ca-ibox-content"><h1
64
- ><?php echo $lost_report['no_of_orders']; ?></h1>
65
- <small> <?php _e( 'Total Lost Orders.', 'woo-cart-abandonment-recovery' ); ?> </small>
66
  </div>
67
  </div>
68
 
@@ -71,30 +71,30 @@
71
  <div class="wcf-ca-grid-container">
72
 
73
  <div class="wcf-ca-ibox">
74
- <div class="wcf-ca-ibox-title"><h3> <?php _e( 'Recoverable Revenue', 'woo-cart-abandonment-recovery' ); ?> </h3></div>
75
  <div class="wcf-ca-ibox-content">
76
  <h1>
77
- <?php echo $currency_symbol . number_format_i18n( $abandoned_report['revenue'], 2 ); ?>
78
  </h1>
79
- <small> <?php _e( 'Total Recoverable Revenue.', 'woo-cart-abandonment-recovery' ); ?> </small>
80
  </div>
81
  </div>
82
 
83
  <div class="wcf-ca-ibox">
84
- <div class="wcf-ca-ibox-title"><h3><?php _e( 'Recovered Revenue', 'woo-cart-abandonment-recovery' ); ?></h3></div>
85
  <div class="wcf-ca-ibox-content"><h1>
86
  <?php
87
- echo $currency_symbol . number_format_i18n( $recovered_report['revenue'], 2 );
88
  ?>
89
  </h1>
90
- <small> <?php _e( 'Total Recovered Revenue.', 'woo-cart-abandonment-recovery' ); ?> </small>
91
  </div>
92
  </div>
93
 
94
  <div class="wcf-ca-ibox">
95
- <div class="wcf-ca-ibox-title"><h3> <?php _e( 'Recovery Rate', 'woo-cart-abandonment-recovery' ); ?> </h3></div>
96
- <div class="wcf-ca-ibox-content"><h1><?php echo $conversion_rate . '%'; ?></h1>
97
- <small><?php _e( 'Total Percentage Of Recovered Orders After Abandonment.', 'woo-cart-abandonment-recovery' ); ?> </small>
98
  </div>
99
  </div>
100
 
@@ -104,35 +104,52 @@
104
 
105
  <div class="wcf-ca-report-btn">
106
  <div class="wcf-ca-left-report-field-group">
107
- <button onclick="window.location.search += '&filter_table=<?php echo WCF_CART_ABANDONED_ORDER; ?>';"
108
- class="button <?php echo WCF_CART_ABANDONED_ORDER === $filter_table ? 'button-primary' : 'button-secondary'; ?> "> <?php _e( 'Recoverable Orders', 'woo-cart-abandonment-recovery' ); ?>
109
  </button>
110
- <button onclick="window.location.search += '&filter_table=<?php echo WCF_CART_COMPLETED_ORDER; ?>';"
111
- class="button <?php echo WCF_CART_COMPLETED_ORDER === $filter_table ? 'button-primary' : 'button-secondary'; ?>"><?php _e( 'Recovered Orders', 'woo-cart-abandonment-recovery' ); ?>
112
  </button>
113
- <button onclick="window.location.search += '&filter_table=<?php echo WCF_CART_LOST_ORDER; ?>';"
114
- class="button <?php echo WCF_CART_LOST_ORDER === $filter_table ? 'button-primary' : 'button-secondary'; ?>"><?php _e( 'Lost Orders', 'woo-cart-abandonment-recovery' ); ?>
115
  </button>
116
  </div>
117
- </div>
118
-
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  <?php
122
  if ( count( $wcf_list_table->items ) ) {
123
- $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
124
-
125
  ?>
126
-
127
  <form id="wcf-cart-abandonment-table" method="GET">
128
- <input type="hidden" name="page" value="<?php echo esc_html( $page ); ?>"/>
129
  <?php $wcf_list_table->display(); ?>
130
  </form>
131
 
132
  <?php
133
  } else {
134
 
135
- echo '<div> <strong> ' . __( 'No Orders Found.', 'woo-cart-abandonment-recovery' ) . '</strong> </div>';
136
 
137
  }
138
 
11
 
12
  <div class="wcf-ca-left-report-field-group">
13
  <button onclick="window.location.search += '&filter=today';"
14
+ class="button <?php echo 'today' === $filter ? 'button-primary' : 'button-secondary'; ?>"> <?php esc_html_e( 'Today', 'woo-cart-abandonment-recovery' ); ?>
15
  </button>
16
 
17
  <button onclick="window.location.search += '&filter=yesterday';"
18
+ class="button <?php echo 'yesterday' === $filter ? 'button-primary' : 'button-secondary'; ?>"> <?php esc_html_e( 'Yesterday', 'woo-cart-abandonment-recovery' ); ?>
19
  </button>
20
 
21
  <button onclick="window.location.search += '&filter=last_week';"
22
+ class="button <?php echo 'last_week' === $filter ? 'button-primary' : 'button-secondary'; ?>"> <?php esc_html_e( 'Last Week', 'woo-cart-abandonment-recovery' ); ?>
23
  </button>
24
 
25
  <button onclick="window.location.search += '&filter=last_month';"
26
+ class="button <?php echo 'last_month' === $filter ? 'button-primary' : 'button-secondary'; ?> "> <?php esc_html_e( 'Last Month', 'woo-cart-abandonment-recovery' ); ?>
27
  </button>
28
  </div>
29
 
30
  <div class="wcf-ca-right-report-field-group">
31
 
32
+ <input class="wcf-ca-filter-input" type="text" id="wcf_ca_custom_filter_from" placeholder="YYYY-MM-DD" value="<?php echo esc_attr( $from_date ); ?>"/>
33
+ <input class="wcf-ca-filter-input" type="text" id="wcf_ca_custom_filter_to" placeholder="YYYY-MM-DD" value="<?php echo esc_attr( $to_date ); ?>" />
34
  <button id="wcf_ca_custom_filter"
35
+ class="button <?php echo 'custom' === $filter ? 'button-primary' : 'button-secondary'; ?> "> <?php esc_html_e( 'Custom Filter', 'woo-cart-abandonment-recovery' ); ?>
36
  </button>
37
 
38
  </div>
43
 
44
  <div class="wcf-ca-ibox">
45
  <div class="wcf-ca-ibox-title">
46
+ <h3> <?php esc_html_e( 'Recoverable Orders', 'woo-cart-abandonment-recovery' ); ?> </h3>
47
  </div>
48
  <div class="wcf-ca-ibox-content">
49
+ <h1> <?php echo esc_attr( $abandoned_report['no_of_orders'] ); ?> </h1>
50
+ <small> <?php esc_html_e( 'Total Recoverable Orders.', 'woo-cart-abandonment-recovery' ); ?> </small>
51
  </div>
52
  </div>
53
 
54
  <div class="wcf-ca-ibox">
55
+ <div class="wcf-ca-ibox-title"><h3><?php esc_html_e( 'Recovered Orders', 'woo-cart-abandonment-recovery' ); ?></h3></div>
56
+ <div class="wcf-ca-ibox-content"><h1><?php echo esc_attr( $recovered_report['no_of_orders'] ); ?></h1>
57
+ <small> <?php esc_html_e( 'Total Recovered Orders.', 'woo-cart-abandonment-recovery' ); ?> </small>
58
  </div>
59
  </div>
60
 
61
  <div class="wcf-ca-ibox">
62
+ <div class="wcf-ca-ibox-title"><h3><?php esc_html_e( 'Lost Orders', 'woo-cart-abandonment-recovery' ); ?></h3></div>
63
  <div class="wcf-ca-ibox-content"><h1
64
+ ><?php echo esc_attr( $lost_report['no_of_orders'] ); ?></h1>
65
+ <small> <?php esc_html_e( 'Total Lost Orders.', 'woo-cart-abandonment-recovery' ); ?> </small>
66
  </div>
67
  </div>
68
 
71
  <div class="wcf-ca-grid-container">
72
 
73
  <div class="wcf-ca-ibox">
74
+ <div class="wcf-ca-ibox-title"><h3> <?php esc_html_e( 'Recoverable Revenue', 'woo-cart-abandonment-recovery' ); ?> </h3></div>
75
  <div class="wcf-ca-ibox-content">
76
  <h1>
77
+ <?php echo esc_attr( $currency_symbol ) . esc_attr( number_format_i18n( $abandoned_report['revenue'], 2 ) ); ?>
78
  </h1>
79
+ <small> <?php esc_html_e( 'Total Recoverable Revenue.', 'woo-cart-abandonment-recovery' ); ?> </small>
80
  </div>
81
  </div>
82
 
83
  <div class="wcf-ca-ibox">
84
+ <div class="wcf-ca-ibox-title"><h3><?php esc_html_e( 'Recovered Revenue', 'woo-cart-abandonment-recovery' ); ?></h3></div>
85
  <div class="wcf-ca-ibox-content"><h1>
86
  <?php
87
+ echo esc_attr( $currency_symbol ) . esc_attr( number_format_i18n( $recovered_report['revenue'], 2 ) );
88
  ?>
89
  </h1>
90
+ <small> <?php esc_html_e( 'Total Recovered Revenue.', 'woo-cart-abandonment-recovery' ); ?> </small>
91
  </div>
92
  </div>
93
 
94
  <div class="wcf-ca-ibox">
95
+ <div class="wcf-ca-ibox-title"><h3> <?php esc_html_e( 'Recovery Rate', 'woo-cart-abandonment-recovery' ); ?> </h3></div>
96
+ <div class="wcf-ca-ibox-content"><h1><?php echo esc_attr( $conversion_rate ) . '%'; ?></h1>
97
+ <small><?php esc_html_e( 'Total Percentage Of Recovered Orders After Abandonment.', 'woo-cart-abandonment-recovery' ); ?> </small>
98
  </div>
99
  </div>
100
 
104
 
105
  <div class="wcf-ca-report-btn">
106
  <div class="wcf-ca-left-report-field-group">
107
+ <button onclick="window.location.search += '&filter_table=<?php echo esc_attr( WCF_CART_ABANDONED_ORDER ); ?>';"
108
+ class="button <?php echo WCF_CART_ABANDONED_ORDER === $filter_table ? 'button-primary' : 'button-secondary'; ?> "> <?php esc_html_e( 'Recoverable Orders', 'woo-cart-abandonment-recovery' ); ?>
109
  </button>
110
+ <button onclick="window.location.search += '&filter_table=<?php echo esc_attr( WCF_CART_COMPLETED_ORDER ); ?>';"
111
+ class="button <?php echo WCF_CART_COMPLETED_ORDER === $filter_table ? 'button-primary' : 'button-secondary'; ?>"><?php esc_html_e( 'Recovered Orders', 'woo-cart-abandonment-recovery' ); ?>
112
  </button>
113
+ <button onclick="window.location.search += '&filter_table=<?php echo esc_attr( WCF_CART_LOST_ORDER ); ?>';"
114
+ class="button <?php echo WCF_CART_LOST_ORDER === $filter_table ? 'button-primary' : 'button-secondary'; ?>"><?php esc_html_e( 'Lost Orders', 'woo-cart-abandonment-recovery' ); ?>
115
  </button>
116
  </div>
 
 
117
 
118
+ <div class="wcf-ca-right-report-field-group">
119
+ <div class="wcf-search-orders" id="wcf_search_wrapper" >
120
+ <div class="search-box">
121
+ <?php
122
+ $search_term = filter_input( INPUT_GET, 'search_term', FILTER_SANITIZE_STRING );
123
+ ?>
124
+ <input type="search" id="wcf_search_id_search_input" name="s" placeholder="<?php echo esc_html__( 'Search by email', 'woo-cart-abandonment-recovery' ); ?>" value="<?php echo esc_attr( $search_term ); ?>">
125
+ <input type="submit" id="wcf_search_id_submit" class="button" value="<?php esc_html_e( 'Search Orders', 'woo-cart-abandonment-recovery' ); ?>">
126
+ </div>
127
+ </div>
128
+ <div class="wcf_export_orders">
129
+ <?php
130
+ if ( count( $wcf_list_table->items ) !== 0 ) {
131
+ ?>
132
+ <button id="wcf_ca_export_orders"
133
+ class="button-primary " > Export Orders <span class="dashicons dashicons-download wcf-ca-export-icon" ></span>
134
+ </button>
135
+ <?php } ?>
136
+ </div>
137
+ </div>
138
+ </div>
139
 
140
  <?php
141
  if ( count( $wcf_list_table->items ) ) {
142
+ $wcar_page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
 
143
  ?>
 
144
  <form id="wcf-cart-abandonment-table" method="GET">
145
+ <input type="hidden" name="page" value="<?php echo esc_html( $wcar_page ); ?>"/>
146
  <?php $wcf_list_table->display(); ?>
147
  </form>
148
 
149
  <?php
150
  } else {
151
 
152
+ echo '<div> <strong> ' . esc_html__( 'No Orders Found.', 'woo-cart-abandonment-recovery' ) . '</strong> </div>';
153
 
154
  }
155
 
modules/cart-abandonment/includes/admin/cartflows-cart-abandonment-tabs.php CHANGED
@@ -7,31 +7,31 @@
7
 
8
  ?>
9
  <div class="wrap">
10
- <h1 id="wcf_cart_abandonment_tracking_table"><?php echo __( 'WooCommerce Cart Abandonment Recovery ', 'woo-cart-abandonment-recovery' ); ?></h1>
11
  <?php
12
 
13
- $action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING );
14
- $sub_action = filter_input( INPUT_GET, 'sub_action', FILTER_SANITIZE_STRING );
15
 
16
 
17
- if ( ! $action ) {
18
- $action = WCF_ACTION_REPORTS;
19
  }
20
 
21
  $this->wcf_display_tabs();
22
  $this->wcf_show_warning_ca();
23
  ?>
24
  <?php
25
- echo get_transient( 'wcf_ca_show_message' );
26
  ?>
27
 
28
- <?php if ( WCF_ACTION_SETTINGS === $action ) : ?>
29
  <?php
30
  $this->wcf_display_settings();
31
  ?>
32
  <?php endif; ?>
33
 
34
- <?php if ( WCF_ACTION_REPORTS === $action ) : ?>
35
 
36
  <?php
37
 
@@ -69,7 +69,7 @@
69
 
70
  <?php endif; ?>
71
 
72
- <?php if ( WCF_ACTION_EMAIL_TEMPLATES === $action ) : ?>
73
 
74
  <?php
75
  $email_template_class_inst = Cartflows_Ca_Email_Templates::get_instance();
@@ -96,11 +96,11 @@
96
  check_ajax_referer( WCF_EMAIL_TEMPLATES_NONCE, '_wpnonce' );
97
 
98
  $wcf_settings_frm = filter_input( INPUT_POST, 'wcf_settings_frm', FILTER_SANITIZE_STRING );
99
- $id = filter_input( INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT );
100
 
101
  if ( 'save' === $wcf_settings_frm ) {
102
  $email_template_class_inst->add_email_template();
103
- } elseif ( 'update' === $wcf_settings_frm && $id ) {
104
  $email_template_class_inst->edit_email_template();
105
  }
106
  break;
7
 
8
  ?>
9
  <div class="wrap">
10
+ <h1 id="wcf_cart_abandonment_tracking_table"><?php echo esc_html__( 'WooCommerce Cart Abandonment Recovery ', 'woo-cart-abandonment-recovery' ); ?></h1>
11
  <?php
12
 
13
+ $wcar_action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING );
14
+ $sub_action = filter_input( INPUT_GET, 'sub_action', FILTER_SANITIZE_STRING );
15
 
16
 
17
+ if ( ! $wcar_action ) {
18
+ $wcar_action = WCF_ACTION_REPORTS;
19
  }
20
 
21
  $this->wcf_display_tabs();
22
  $this->wcf_show_warning_ca();
23
  ?>
24
  <?php
25
+ echo wp_kses_post( get_transient( 'wcf_ca_show_message' ) );
26
  ?>
27
 
28
+ <?php if ( WCF_ACTION_SETTINGS === $wcar_action ) : ?>
29
  <?php
30
  $this->wcf_display_settings();
31
  ?>
32
  <?php endif; ?>
33
 
34
+ <?php if ( WCF_ACTION_REPORTS === $wcar_action ) : ?>
35
 
36
  <?php
37
 
69
 
70
  <?php endif; ?>
71
 
72
+ <?php if ( WCF_ACTION_EMAIL_TEMPLATES === $wcar_action ) : ?>
73
 
74
  <?php
75
  $email_template_class_inst = Cartflows_Ca_Email_Templates::get_instance();
96
  check_ajax_referer( WCF_EMAIL_TEMPLATES_NONCE, '_wpnonce' );
97
 
98
  $wcf_settings_frm = filter_input( INPUT_POST, 'wcf_settings_frm', FILTER_SANITIZE_STRING );
99
+ $action_id = filter_input( INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT );
100
 
101
  if ( 'save' === $wcf_settings_frm ) {
102
  $email_template_class_inst->add_email_template();
103
+ } elseif ( 'update' === $wcf_settings_frm && $action_id ) {
104
  $email_template_class_inst->edit_email_template();
105
  }
106
  break;
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: brainstormforce, wpcrafter
3
  Donate link: https://www.paypal.me/BrainstormForce
4
  Tags: woocommerce, cart abandonment, cart recovery
5
  Requires at least: 4.4
6
- Tested up to: 5.2
7
- Stable tag: 1.2.3
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -129,6 +129,12 @@ Here are few thoughts behind making it available for free:
129
 
130
  == Changelog ==
131
 
 
 
 
 
 
 
132
  = Version 1.2.3 - Thursday, 12th December 2019 =
133
  * New: Added option to unsubscribe users in bulk.
134
  * New: Added filter 'woo_ca_exclude_on_hold_order_from_tracking' to exclude on hold orders from the tracking.
3
  Donate link: https://www.paypal.me/BrainstormForce
4
  Tags: woocommerce, cart abandonment, cart recovery
5
  Requires at least: 4.4
6
+ Tested up to: 5.3.2
7
+ Stable tag: 1.2.4
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
129
 
130
  == Changelog ==
131
 
132
+ = Version 1.2.4 - Thursday, 06th February 2020 =
133
+ * New: Added option to export abandoned orders.
134
+ * New: Added option to search abandoned orders.
135
+ * Improvement: Compatibility with the latest WordPress PHP_CodeSniffer rules.
136
+ * Fix: Get id error while sending emails.
137
+
138
  = Version 1.2.3 - Thursday, 12th December 2019 =
139
  * New: Added option to unsubscribe users in bulk.
140
  * New: Added filter 'woo_ca_exclude_on_hold_order_from_tracking' to exclude on hold orders from the tracking.
uninstall.php CHANGED
File without changes
woo-cart-abandonment-recovery.php CHANGED
@@ -3,12 +3,12 @@
3
  * Plugin Name: WooCommerce Cart Abandonment Recovery
4
  * Plugin URI: https://cartflows.com/
5
  * Description: Recover your lost revenue. Capture email address of users on the checkout page and send follow up emails if they don't complete the purchase.
6
- * Version: 1.2.3
7
  * Author: CartFlows Inc
8
  * Author URI: https://cartflows.com/
9
  * Text Domain: woo-cart-abandonment-recovery
10
  * WC requires at least: 3.0
11
- * WC tested up to: 3.6.3
12
  *
13
  * @package Woocommerce-Cart-Abandonment-Recovery
14
  */
3
  * Plugin Name: WooCommerce Cart Abandonment Recovery
4
  * Plugin URI: https://cartflows.com/
5
  * Description: Recover your lost revenue. Capture email address of users on the checkout page and send follow up emails if they don't complete the purchase.
6
+ * Version: 1.2.4
7
  * Author: CartFlows Inc
8
  * Author URI: https://cartflows.com/
9
  * Text Domain: woo-cart-abandonment-recovery
10
  * WC requires at least: 3.0
11
+ * WC tested up to: 3.9.1
12
  *
13
  * @package Woocommerce-Cart-Abandonment-Recovery
14
  */