Abandoned Cart Lite for WooCommerce - Version 4.8

Version Description

Download this release

Release Info

Developer ashokrane
Plugin Icon 128x128 Abandoned Cart Lite for WooCommerce
Version 4.8
Comparing to
See all releases

Code changes from version 4.7 to 4.8

Files changed (24) hide show
  1. woocommerce-abandoned-cart/assets/css/view.abandoned.orders.style.css +20 -12
  2. woocommerce-abandoned-cart/assets/css/wcal_template_activate.css +4 -2
  3. woocommerce-abandoned-cart/assets/js/abandoncart_plugin_button.js +12 -2
  4. woocommerce-abandoned-cart/assets/js/wcal_template_activate.js +5 -0
  5. woocommerce-abandoned-cart/assets/js/wcal_ts_dismiss_notice.js +4 -1
  6. woocommerce-abandoned-cart/cron/wcal_send_email.php +108 -11
  7. woocommerce-abandoned-cart/includes/classes/class-wcal-abandoned-orders-table.php +88 -12
  8. woocommerce-abandoned-cart/includes/classes/class-wcal-aes-counter.php +17 -2
  9. woocommerce-abandoned-cart/includes/classes/class-wcal-aes.php +21 -0
  10. woocommerce-abandoned-cart/includes/classes/class-wcal-product-report-table.php +39 -48
  11. woocommerce-abandoned-cart/includes/classes/class-wcal-recover-orders-table.php +77 -10
  12. woocommerce-abandoned-cart/includes/classes/class-wcal-templates-table.php +81 -10
  13. woocommerce-abandoned-cart/includes/classes/class-wcal-ts-tracker.php +140 -44
  14. woocommerce-abandoned-cart/includes/wcal-common.php +71 -2
  15. woocommerce-abandoned-cart/includes/wcal_actions.php +18 -5
  16. woocommerce-abandoned-cart/includes/wcal_admin_notice.php +40 -1
  17. woocommerce-abandoned-cart/includes/wcal_class-guest.php +39 -6
  18. woocommerce-abandoned-cart/includes/wcal_default-settings.php +16 -3
  19. woocommerce-abandoned-cart/includes/wcal_ts_tracking.php +32 -6
  20. woocommerce-abandoned-cart/includes/welcome.php +14 -31
  21. woocommerce-abandoned-cart/readme.txt +11 -10
  22. woocommerce-abandoned-cart/views/wcal-email-template-preview.php +11 -0
  23. woocommerce-abandoned-cart/views/wcal-wc-email-template-preview.php +10 -0
  24. woocommerce-abandoned-cart/woocommerce-ac.php +372 -98
woocommerce-abandoned-cart/assets/css/view.abandoned.orders.style.css CHANGED
@@ -1,38 +1,46 @@
1
- /* Decrease the width of the Id column */
 
 
 
2
  table.wp-list-table .column-id {
3
  width:5%;
4
  }
5
- /* Decrease the width of the cutomer name column
6
- table.wp-list-table .column-customer {
7
- width:12%;
8
- }*/
9
- /* Decrease the width of the email column*/
10
  table.wp-list-table .column-email {
11
  width:15%;
12
  }
13
 
14
- /* Decrease the width of the abandoned order date column */
 
 
15
  table.wp-list-table .column-date {
16
  width:20%;
17
  }
18
 
19
- /* Decrease the width of the abandoned order total column */
 
 
20
  table.wp-list-table .column-order_total {
21
  width:20%;
22
  }
23
 
24
- /* This is for the new cart and checkout button in tinymce */
 
 
25
  #woocommerce_ac_email_body_abandoncart_email_variables_css{
26
 
27
  width : 60px !important;
28
  }
29
-
30
  span.mce_abandoncart_email_variables_css {
31
-
32
  width : 60px !important;
33
  }
34
 
35
- /* Decrease the width of the sr column in templates tab */
 
 
36
  table.wp-list-table .column-sr {
37
  width:4% !important;
38
  }
1
+ /**
2
+ * Decrease the width of the Id column.
3
+ *
4
+ */
5
  table.wp-list-table .column-id {
6
  width:5%;
7
  }
8
+
9
+ /**
10
+ * Decrease the width of the email column.
11
+ */
 
12
  table.wp-list-table .column-email {
13
  width:15%;
14
  }
15
 
16
+ /**
17
+ * Decrease the width of the abandoned order date column.
18
+ */
19
  table.wp-list-table .column-date {
20
  width:20%;
21
  }
22
 
23
+ /**
24
+ * Decrease the width of the abandoned order total column.
25
+ */
26
  table.wp-list-table .column-order_total {
27
  width:20%;
28
  }
29
 
30
+ /**
31
+ * This is for the new cart and checkout button in tinymce.
32
+ */
33
  #woocommerce_ac_email_body_abandoncart_email_variables_css{
34
 
35
  width : 60px !important;
36
  }
 
37
  span.mce_abandoncart_email_variables_css {
 
38
  width : 60px !important;
39
  }
40
 
41
+ /**
42
+ * Decrease the width of the sr column in templates tab.
43
+ */
44
  table.wp-list-table .column-sr {
45
  width:4% !important;
46
  }
woocommerce-abandoned-cart/assets/css/wcal_template_activate.css CHANGED
@@ -1,5 +1,7 @@
1
- /* To display the toggle button on the template page*/
2
-
 
 
3
  .wcal-switch {
4
  cursor: pointer;
5
  text-indent: -999em;
1
+ /**
2
+ * To display the toggle button on the template page.
3
+ * @since 4.4
4
+ */
5
  .wcal-switch {
6
  cursor: pointer;
7
  text-indent: -999em;
woocommerce-abandoned-cart/assets/js/abandoncart_plugin_button.js CHANGED
@@ -1,9 +1,19 @@
 
 
 
 
 
1
  (function() {
2
 
 
 
 
 
 
 
3
  tinymce.PluginManager.add('abandoncart', function(editor, url) {
4
 
5
-
6
- editor.addButton('abandoncart', {
7
  type: 'menubutton',
8
  text: false,
9
  icon: "abandoncart_email_variables",
1
+ /**
2
+ * This function will add the new button in the tinymce editor.
3
+ * It will add all the mergecode of the plugin.
4
+ * @function wcal_filter_mce_plugin
5
+ */
6
  (function() {
7
 
8
+ /**
9
+ * This function will add the new button in the tinymce editor.
10
+ * It will add all the mergecode of the plugin.
11
+ * @return array buttons
12
+ * @since: 2.6
13
+ */
14
  tinymce.PluginManager.add('abandoncart', function(editor, url) {
15
 
16
+ editor.addButton('abandoncart', {
 
17
  type: 'menubutton',
18
  text: false,
19
  icon: "abandoncart_email_variables",
woocommerce-abandoned-cart/assets/js/wcal_template_activate.js CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  jQuery(function( $ ) {
2
 
3
  $('.wcal-switch.wcal-toggle-template-status').click(function(){
1
+ /**
2
+ * This function will toggle the status of the email template.
3
+ *
4
+ * @function toggle_template_status
5
+ */
6
  jQuery(function( $ ) {
7
 
8
  $('.wcal-switch.wcal-toggle-template-status').click(function(){
woocommerce-abandoned-cart/assets/js/wcal_ts_dismiss_notice.js CHANGED
@@ -1,4 +1,7 @@
1
- // Make notices dismissible
 
 
 
2
  jQuery(document).ready( function() {
3
  jQuery( '.notice.is-dismissible' ).each( function() {
4
 
1
+ /**
2
+ * It will add the button of the dimiss on the pro version notice.
3
+ * @function dismiss_notice
4
+ */
5
  jQuery(document).ready( function() {
6
  jQuery( '.notice.is-dismissible' ).each( function() {
7
 
woocommerce-abandoned-cart/cron/wcal_send_email.php CHANGED
@@ -1,9 +1,20 @@
1
  <?php
 
 
 
 
 
 
 
 
2
  static $wp_load; // Since this will be called twice, hold onto it.
3
  if ( ! isset( $wp_load ) ) {
4
  $wp_load = false;
5
  $dir = __FILE__;
6
  while( '/' != ( $dir = dirname( $dir ) ) ) {
 
 
 
7
  if( file_exists( $wp_load = "{$dir}/wp-load.php" ) ) {
8
  break;
9
  }
@@ -13,11 +24,14 @@ $wcal_root = dirname( dirname(__FILE__) ); // go two level up for directory from
13
  require_once $wp_load;
14
  require_once $wcal_root.'/includes/classes/class-wcal-aes.php';
15
  require_once $wcal_root.'/includes/classes/class-wcal-aes-counter.php';
16
- /**
17
- * woocommerce_abandon_cart_cron class
18
- **/
19
  if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
20
 
 
 
 
 
21
  class woocommerce_abandon_cart_cron {
22
  var $cart_settings_cron;
23
  var $cart_abandon_cut_off_time_cron;
@@ -26,7 +40,12 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
26
  $this->cart_abandon_cut_off_time_cron = ( $this->cart_settings_cron ) * 60;
27
  }
28
  /**
29
- * Function to send emails
 
 
 
 
 
30
  */
31
  function wcal_send_email_notification() {
32
  global $wpdb, $woocommerce;
@@ -94,11 +113,11 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
94
  if( isset( $value->abandoned_cart_info ) ) {
95
  $cart_info_db_field = json_decode( $value->abandoned_cart_info );
96
  }
97
- $cart = array();
98
  if( !empty( $cart_info_db_field->cart ) ) {
99
  $cart = $cart_info_db_field->cart;
100
  }
101
- if( count( $cart ) > 0 && isset( $value->user_id ) && '0' != $value->user_id && isset( $value->id ) ) {
102
  $cart_update_time = $value->abandoned_cart_time;
103
  $new_user = $this->wcal_check_sent_history( $value->user_id, $cart_update_time, $template_id, $value->id );
104
  if ( $new_user == true ) {
@@ -381,6 +400,10 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
381
  /**
382
  * This function will check if the user type is Guest and the id is greater than 63000000
383
  * Then conider that as a correct guest user, if is not then do not send the emails
 
 
 
 
384
  */
385
  public static function wcal_get_is_guest_valid ( $wcal_user_id, $wcal_user_type ) {
386
 
@@ -397,6 +420,13 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
397
  */
398
  return false;
399
  }
 
 
 
 
 
 
 
400
  function wcal_check_cart_total ( $cart ){
401
  foreach( $cart as $k => $v ) {
402
  if( $v->line_total != 0 && $v->line_total > 0 ) {
@@ -406,7 +436,12 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
406
  return false;
407
  }
408
  /**
409
- * get all carts which have the creation time earlier than the one that is passed
 
 
 
 
 
410
  */
411
  function wcal_get_carts( $template_to_send_after_time, $cart_abandon_cut_off_time ) {
412
  global $wpdb;
@@ -423,6 +458,18 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
423
  exit;
424
  }
425
 
 
 
 
 
 
 
 
 
 
 
 
 
426
  public static function wcal_update_abandoned_cart_status_for_placed_orders( $time_to_send_template_after, $wcal_cart_time, $wcal_user_id, $wcal_user_type, $wcal_cart_id, $wcal_user_email ){
427
  global $wpdb;
428
 
@@ -440,6 +487,16 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
440
  return false;
441
  }
442
 
 
 
 
 
 
 
 
 
 
 
443
  public static function wcal_update_status_of_guest ( $cart_id, $abandoned_cart_time , $time_to_send_template_after, $wcal_user_email_address ) {
444
  global $wpdb;
445
 
@@ -460,7 +517,7 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
460
  if ( $order_date == $todays_date ) {
461
 
462
  /**
463
- * in some case the cart is recovered but it is not marked as the recovred. So here we check if any
464
  * record is found for that cart id if yes then update the record respectively.
465
  */
466
  $wcal_check_email_sent_to_cart = woocommerce_abandon_cart_cron::wcal_get_cart_sent_data ( $cart_id );
@@ -505,6 +562,16 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
505
  return 0;
506
  }
507
 
 
 
 
 
 
 
 
 
 
 
508
  public static function wcal_update_status_of_loggedin( $cart_id, $abandoned_cart_time , $time_to_send_template_after, $user_billing_email ) {
509
  global $wpdb;
510
 
@@ -558,6 +625,13 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
558
  return 0; // it means there are no record found to be update it.
559
  }
560
 
 
 
 
 
 
 
 
561
  public static function wcal_get_cart_sent_data ( $wcal_cart_id ) {
562
  global $wpdb;
563
 
@@ -571,6 +645,16 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
571
  return 0;
572
  }
573
 
 
 
 
 
 
 
 
 
 
 
574
  public static function wcal_remove_cart_for_mutiple_templates( $wcal_cart_id, $time_to_send_template_after, $template_id ) {
575
  global $wpdb;
576
 
@@ -588,15 +672,28 @@ if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
588
 
589
  return false;
590
  }
591
- /******
592
- * This function is used to encode the validate string.
593
- ******/
 
 
 
594
  function wcal_encrypt_validate( $validate ) {
595
  $cryptKey = get_option( 'wcal_security_key' );
596
  $validate_encoded = Wcal_Aes_Ctr::encrypt( $validate, $cryptKey, 256 );
597
  return( $validate_encoded );
598
  }
599
 
 
 
 
 
 
 
 
 
 
 
600
  function wcal_check_sent_history( $user_id, $cart_update_time, $template_id, $id ) {
601
  global $wpdb;
602
  $query = "SELECT wpcs . * , wpac . abandoned_cart_time , wpac . user_id FROM `".$wpdb->prefix."ac_sent_history_lite` AS wpcs
1
  <?php
2
+ /**
3
+ * It will send the automatic reminder emails to the customers.
4
+ *
5
+ * @author Tyche Softwares
6
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Cron
7
+ */
8
+
9
+
10
  static $wp_load; // Since this will be called twice, hold onto it.
11
  if ( ! isset( $wp_load ) ) {
12
  $wp_load = false;
13
  $dir = __FILE__;
14
  while( '/' != ( $dir = dirname( $dir ) ) ) {
15
+ /**
16
+ * Comment this "If" condition for generating the developer documentations.
17
+ */
18
  if( file_exists( $wp_load = "{$dir}/wp-load.php" ) ) {
19
  break;
20
  }
24
  require_once $wp_load;
25
  require_once $wcal_root.'/includes/classes/class-wcal-aes.php';
26
  require_once $wcal_root.'/includes/classes/class-wcal-aes-counter.php';
27
+
28
+
 
29
  if ( !class_exists( 'woocommerce_abandon_cart_cron' ) ) {
30
 
31
+ /**
32
+ * It will send the automatic reminder emails to the customers
33
+ * @since 1.3
34
+ */
35
  class woocommerce_abandon_cart_cron {
36
  var $cart_settings_cron;
37
  var $cart_abandon_cut_off_time_cron;
40
  $this->cart_abandon_cut_off_time_cron = ( $this->cart_settings_cron ) * 60;
41
  }
42
  /**
43
+ * It will send the reminder emails to the cutomers.
44
+ * It will also replace the merge code to its original data.
45
+ * it will also check if guest id is valid, and check if the order is placed before sending the reminder email.
46
+ * @globals mixed $wpdb
47
+ * @globals mixed $woocommerce
48
+ * @since 1.3
49
  */
50
  function wcal_send_email_notification() {
51
  global $wpdb, $woocommerce;
113
  if( isset( $value->abandoned_cart_info ) ) {
114
  $cart_info_db_field = json_decode( $value->abandoned_cart_info );
115
  }
116
+ $cart = new stdClass();
117
  if( !empty( $cart_info_db_field->cart ) ) {
118
  $cart = $cart_info_db_field->cart;
119
  }
120
+ if( count( get_object_vars( $cart ) ) > 0 && isset( $value->user_id ) && '0' != $value->user_id && isset( $value->id ) ) {
121
  $cart_update_time = $value->abandoned_cart_time;
122
  $new_user = $this->wcal_check_sent_history( $value->user_id, $cart_update_time, $template_id, $value->id );
123
  if ( $new_user == true ) {
400
  /**
401
  * This function will check if the user type is Guest and the id is greater than 63000000
402
  * Then conider that as a correct guest user, if is not then do not send the emails
403
+ * @param strinng | int $wcal_user_id User id
404
+ * @param strinng $wcal_user_type User Type
405
+ * @return boolean true | false
406
+ * @since 4.4
407
  */
408
  public static function wcal_get_is_guest_valid ( $wcal_user_id, $wcal_user_type ) {
409
 
420
  */
421
  return false;
422
  }
423
+
424
+ /**
425
+ * It will check the cart total.
426
+ * @param array | object $cart Cart details
427
+ * @return boolean true | false
428
+ * @since 4.3
429
+ */
430
  function wcal_check_cart_total ( $cart ){
431
  foreach( $cart as $k => $v ) {
432
  if( $v->line_total != 0 && $v->line_total > 0 ) {
436
  return false;
437
  }
438
  /**
439
+ * Get all carts which have the creation time earlier than the one that is passed.
440
+ * @param string | timestamp $template_to_send_after_time Template time
441
+ * @param string | timestamp $cart_abandon_cut_off_time Cutoff time
442
+ * @globals mixed $wpdb
443
+ * @return array | object $results
444
+ * @since 1.3
445
  */
446
  function wcal_get_carts( $template_to_send_after_time, $cart_abandon_cut_off_time ) {
447
  global $wpdb;
458
  exit;
459
  }
460
 
461
+ /**
462
+ * It will update the abandoned cart staus if the order has been placed before sending the reminder emails.
463
+ * @param string | timestamp $time_to_send_template_after Template time
464
+ * @param string | timestamp $wcal_cart_time Abandoned time
465
+ * @param string | int $wcal_user_id User id
466
+ * @param string $wcal_user_type User type
467
+ * @param string | int $wcal_cart_id Abandoned cart id
468
+ * @param string $wcal_user_email User Email
469
+ * @globals mixed $wpdb
470
+ * @return boolean true | false
471
+ * @since 4.3
472
+ */
473
  public static function wcal_update_abandoned_cart_status_for_placed_orders( $time_to_send_template_after, $wcal_cart_time, $wcal_user_id, $wcal_user_type, $wcal_cart_id, $wcal_user_email ){
474
  global $wpdb;
475
 
487
  return false;
488
  }
489
 
490
+ /**
491
+ * It will update the Guest users abandoned cart staus if the order has been placed before sending the reminder emails.
492
+ * @param string | int $cart_id Abandoned cart id
493
+ * @param string | timestamp $time_to_send_template_after Template time
494
+ * @param string | timestamp $abandoned_cart_time Abandoned time
495
+ * @param string $wcal_user_email_address User Email
496
+ * @globals mixed $wpdb
497
+ * @return int 0 | 1
498
+ * @since 4.3
499
+ */
500
  public static function wcal_update_status_of_guest ( $cart_id, $abandoned_cart_time , $time_to_send_template_after, $wcal_user_email_address ) {
501
  global $wpdb;
502
 
517
  if ( $order_date == $todays_date ) {
518
 
519
  /**
520
+ * in some case the cart is recovered but it is not marked as the recovered. So here we check if any
521
  * record is found for that cart id if yes then update the record respectively.
522
  */
523
  $wcal_check_email_sent_to_cart = woocommerce_abandon_cart_cron::wcal_get_cart_sent_data ( $cart_id );
562
  return 0;
563
  }
564
 
565
+ /**
566
+ * It will update the Loggedin users abandoned cart staus if the order has been placed before sending the reminder emails.
567
+ * @param string | int $cart_id Abandoned cart id
568
+ * @param string | timestamp $time_to_send_template_after Template time
569
+ * @param string | timestamp $abandoned_cart_time Abandoned time
570
+ * @param string $user_billing_email User Email
571
+ * @globals mixed $wpdb
572
+ * @return int 0 | 1
573
+ * @since 4.3
574
+ */
575
  public static function wcal_update_status_of_loggedin( $cart_id, $abandoned_cart_time , $time_to_send_template_after, $user_billing_email ) {
576
  global $wpdb;
577
 
625
  return 0; // it means there are no record found to be update it.
626
  }
627
 
628
+ /**
629
+ * It will check that for abandoned cart remider email has been sent.
630
+ * @param string | int $wcal_cart_id Abandoned cart id
631
+ * @return int $wcal_sent_id | 0 Email sent id
632
+ * @globals mixed $wpdb
633
+ * @since 4.3
634
+ */
635
  public static function wcal_get_cart_sent_data ( $wcal_cart_id ) {
636
  global $wpdb;
637
 
645
  return 0;
646
  }
647
 
648
+ /**
649
+ * If none of the email has been sent for some time then from the time where it send the first email template it will consider
650
+ * the time and further email will sent from first email sent time. So all template will not sent at the same time.
651
+ * @param string | int $wcal_cart_id Abandoned cart id
652
+ * @param string | timestamp $time_to_send_template_after Template time
653
+ * @param string | int $template_id Template id
654
+ * @return boolean true | false
655
+ * @globals mixed $wpdb
656
+ * @since 3.1
657
+ */
658
  public static function wcal_remove_cart_for_mutiple_templates( $wcal_cart_id, $time_to_send_template_after, $template_id ) {
659
  global $wpdb;
660
 
672
 
673
  return false;
674
  }
675
+ /**
676
+ * This function is used to encode the validate string.
677
+ * @param string $validate
678
+ * @return encoded data $validate_encoded
679
+ * @since 1.3
680
+ */
681
  function wcal_encrypt_validate( $validate ) {
682
  $cryptKey = get_option( 'wcal_security_key' );
683
  $validate_encoded = Wcal_Aes_Ctr::encrypt( $validate, $cryptKey, 256 );
684
  return( $validate_encoded );
685
  }
686
 
687
+ /**
688
+ * It will check if the reminder email has been sent to the abandoned cart.
689
+ * @param string | int $user_id User id
690
+ * @param string | timestamp $cart_update_time Abandoned cart time
691
+ * @param string | int $template_id Template id
692
+ * @param string | int $id Abandoned cart id
693
+ * @globals mixed $wpdb
694
+ * @return boolean true | false
695
+ * @since 1.3
696
+ */
697
  function wcal_check_sent_history( $user_id, $cart_update_time, $template_id, $id ) {
698
  global $wpdb;
699
  $query = "SELECT wpcs . * , wpac . abandoned_cart_time , wpac . user_id FROM `".$wpdb->prefix."ac_sent_history_lite` AS wpcs
woocommerce-abandoned-cart/includes/classes/class-wcal-abandoned-orders-table.php CHANGED
@@ -4,6 +4,16 @@ if ( ! class_exists( 'WP_List_Table' ) ) {
4
  require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
5
  }
6
 
 
 
 
 
 
 
 
 
 
 
7
  class WCAL_Abandoned_Orders_Table extends WP_List_Table {
8
 
9
  /**
@@ -31,8 +41,8 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
31
  public $total_count;
32
 
33
  /**
34
- * Get things started
35
- *
36
  * @see WP_List_Table::__construct()
37
  */
38
  public function __construct() {
@@ -46,6 +56,11 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
46
  $this->process_bulk_action();
47
  $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page' );
48
  }
 
 
 
 
 
49
 
50
  public function wcal_abandoned_order_prepare_items() {
51
  $columns = $this->get_columns();
@@ -69,6 +84,11 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
69
  );
70
  }
71
 
 
 
 
 
 
72
  public function get_columns() {
73
  $columns = array();
74
  $columns = array(
@@ -83,8 +103,11 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
83
  return apply_filters( 'wcal_abandoned_orders_columns', $columns );
84
  }
85
 
86
- /***
87
- * It is used to add the check box for the items
 
 
 
88
  */
89
  function column_cb( $item ){
90
  $abandoned_order_id = '';
@@ -98,6 +121,11 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
98
  );
99
  }
100
 
 
 
 
 
 
101
  public function get_sortable_columns() {
102
  $columns = array(
103
  'date' => array( 'date', false ),
@@ -107,14 +135,11 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
107
  }
108
 
109
  /**
110
- * Render the Email Column
111
- *
112
- * @access public
113
- * @since 2.4.8
114
- * @param array $abandoned_row_info Contains all the data of the abandoned order tabs row
115
- * @return string Data shown in the Email column
116
- *
117
  * This function used for individual delete of row, It is for hover effect delete.
 
 
 
118
  */
119
  public function column_email( $abandoned_row_info ) {
120
  $row_actions = array();
@@ -130,6 +155,12 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
130
  return apply_filters( 'wcal_abandoned_orders_single_column', $value, $abandoned_order_id, 'email' );
131
  }
132
 
 
 
 
 
 
 
133
  public function wcal_abandoned_cart_data() {
134
  global $wpdb;
135
  $return_abandoned_orders = array();
@@ -288,7 +319,7 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
288
  $cut_off_time = intval( $ac_cutoff_time ) * 60;
289
  $current_time = current_time( 'timestamp' );
290
  $compare_time = $current_time - $cart_update_time;
291
- $cart_details = array();
292
  if( isset( $cart_info->cart ) ){
293
  $cart_details = $cart_info->cart;
294
  }
@@ -384,6 +415,13 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
384
  return apply_filters( 'wcal_abandoned_orders_table_data', $return_abandoned_orders_display );
385
  }
386
 
 
 
 
 
 
 
 
387
  function wcal_class_order_date_asc( $value1,$value2 ) {
388
  $date_two = $date_one = '';
389
  $value_one = $value1->date;
@@ -400,6 +438,13 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
400
  return strtotime( $date_one ) - strtotime( $date_two );
401
  }
402
 
 
 
 
 
 
 
 
403
  function wcal_class_order_date_dsc( $value1,$value2 ) {
404
  $date_two = $date_one = '';
405
  $value_one = $value1->date;
@@ -416,14 +461,35 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
416
  return strtotime($date_two) - strtotime($date_one);
417
  }
418
 
 
 
 
 
 
 
 
419
  function wcal_class_status_asc( $value1,$value2 ) {
420
  return strcasecmp( $value1->status,$value2->status );
421
  }
422
 
 
 
 
 
 
 
 
423
  function wcal_class_status_dsc( $value1,$value2 ) {
424
  return strcasecmp( $value2->status,$value1->status );
425
  }
426
 
 
 
 
 
 
 
 
427
  public function column_default( $wcal_abandoned_orders, $column_name ) {
428
  $value = '';
429
  switch( $column_name ) {
@@ -459,12 +525,22 @@ class WCAL_Abandoned_Orders_Table extends WP_List_Table {
459
  return apply_filters( 'wcal_abandoned_orders_column_default', $value, $wcal_abandoned_orders, $column_name );
460
  }
461
 
 
 
 
 
 
462
  public function get_bulk_actions() {
463
  return array(
464
  'wcal_delete' => __( 'Delete', 'woocommerce-abandoned-cart' )
465
  );
466
  }
467
 
 
 
 
 
 
468
  public function wcal_get_current_section () {
469
  $section = 'wcal_all_abandoned';
470
  if ( isset( $_GET[ 'wcal_section' ] ) ) {
4
  require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
5
  }
6
 
7
+ /**
8
+ * Abandoned Cart Lite for WooCommerce
9
+ *
10
+ * It will handle the common action for the plugin.
11
+ *
12
+ * @author Tyche Softwares
13
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/List-Class
14
+ * @since 2.5.2
15
+ */
16
+
17
  class WCAL_Abandoned_Orders_Table extends WP_List_Table {
18
 
19
  /**
41
  public $total_count;
42
 
43
  /**
44
+ * It will add the bulk action function and other variable needed for the class.
45
+ * @since 2.5.2
46
  * @see WP_List_Table::__construct()
47
  */
48
  public function __construct() {
56
  $this->process_bulk_action();
57
  $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page' );
58
  }
59
+
60
+ /**
61
+ * It will prepare the list of the abandoned carts, like columns, pagination, sortable column, all data.
62
+ * @since 2.5.2
63
+ */
64
 
65
  public function wcal_abandoned_order_prepare_items() {
66
  $columns = $this->get_columns();
84
  );
85
  }
86
 
87
+ /**
88
+ * It will add the columns for abanodned orders list.
89
+ * @return array $columns All columns name.
90
+ * @since 2.5.2
91
+ */
92
  public function get_columns() {
93
  $columns = array();
94
  $columns = array(
103
  return apply_filters( 'wcal_abandoned_orders_columns', $columns );
104
  }
105
 
106
+ /**
107
+ * It is used to add the check box for the items.
108
+ * @param $string $item
109
+ * @return string
110
+ * @since 2.5.2
111
  */
112
  function column_cb( $item ){
113
  $abandoned_order_id = '';
121
  );
122
  }
123
 
124
+ /**
125
+ * We can mention on which column we need the sorting. Here, abandoned cart date, abandoned cart status
126
+ * @return array $columns Name of the column
127
+ * @since 2.5.2
128
+ */
129
  public function get_sortable_columns() {
130
  $columns = array(
131
  'date' => array( 'date', false ),
135
  }
136
 
137
  /**
138
+ * Render the Email Column. So we will add the action on the hover affect.
 
 
 
 
 
 
139
  * This function used for individual delete of row, It is for hover effect delete.
140
+ * @param array $abandoned_row_info Contains all the data of the abandoned order tabs row .
141
+ * @return string $value shown in the Email column.
142
+ * @since 2.5.2
143
  */
144
  public function column_email( $abandoned_row_info ) {
145
  $row_actions = array();
155
  return apply_filters( 'wcal_abandoned_orders_single_column', $value, $abandoned_order_id, 'email' );
156
  }
157
 
158
+ /**
159
+ * It will generate the abandoned cart list data.
160
+ * @globals mixed $wpdb
161
+ * @return array $return_abandoned_orders_display Key and value of all the columns
162
+ * @since 2.5.2
163
+ */
164
  public function wcal_abandoned_cart_data() {
165
  global $wpdb;
166
  $return_abandoned_orders = array();
319
  $cut_off_time = intval( $ac_cutoff_time ) * 60;
320
  $current_time = current_time( 'timestamp' );
321
  $compare_time = $current_time - $cart_update_time;
322
+ $cart_details = new stdClass();
323
  if( isset( $cart_info->cart ) ){
324
  $cart_details = $cart_info->cart;
325
  }
415
  return apply_filters( 'wcal_abandoned_orders_table_data', $return_abandoned_orders_display );
416
  }
417
 
418
+ /**
419
+ * It will sort the ascending data based on the abandoned cart date.
420
+ * @param array | object $value1 All data of the list
421
+ * @param array | object $value2 All data of the list
422
+ * @return timestamp
423
+ * @since 2.5.2
424
+ */
425
  function wcal_class_order_date_asc( $value1,$value2 ) {
426
  $date_two = $date_one = '';
427
  $value_one = $value1->date;
438
  return strtotime( $date_one ) - strtotime( $date_two );
439
  }
440
 
441
+ /**
442
+ * It will sort the descending data based on the abandoned cart date.
443
+ * @param array | object $value1 All data of the list
444
+ * @param array | object $value2 All data of the list
445
+ * @return timestamp
446
+ * @since 2.5.2
447
+ */
448
  function wcal_class_order_date_dsc( $value1,$value2 ) {
449
  $date_two = $date_one = '';
450
  $value_one = $value1->date;
461
  return strtotime($date_two) - strtotime($date_one);
462
  }
463
 
464
+ /**
465
+ * It will sort the alphabetally ascending on the abandoned cart staus.
466
+ * @param array | object $value1 All data of the list
467
+ * @param array | object $value2 All data of the list
468
+ * @return sorted array
469
+ * @since 2.5.2
470
+ */
471
  function wcal_class_status_asc( $value1,$value2 ) {
472
  return strcasecmp( $value1->status,$value2->status );
473
  }
474
 
475
+ /**
476
+ * It will sort the alphabetally descending on the abandoned cart staus.
477
+ * @param array | object $value1 All data of the list
478
+ * @param array | object $value2 All data of the list
479
+ * @return sorted array
480
+ * @since 2.5.2
481
+ */
482
  function wcal_class_status_dsc( $value1,$value2 ) {
483
  return strcasecmp( $value2->status,$value1->status );
484
  }
485
 
486
+ /**
487
+ * It will display the data for the abanodned column
488
+ * @param array | object $wcal_abandoned_orders All data of the list
489
+ * @param stirng $column_name Name of the column
490
+ * @return string $value Data of the column
491
+ * @since 2.5.2
492
+ */
493
  public function column_default( $wcal_abandoned_orders, $column_name ) {
494
  $value = '';
495
  switch( $column_name ) {
525
  return apply_filters( 'wcal_abandoned_orders_column_default', $value, $wcal_abandoned_orders, $column_name );
526
  }
527
 
528
+ /**
529
+ * It will add the bulk action, here Delete
530
+ * @return array
531
+ * @since 2.5.2
532
+ */
533
  public function get_bulk_actions() {
534
  return array(
535
  'wcal_delete' => __( 'Delete', 'woocommerce-abandoned-cart' )
536
  );
537
  }
538
 
539
+ /**
540
+ * It will give the section name.
541
+ * @return string $section Name of the current section
542
+ * @since 2.5.2
543
+ */
544
  public function wcal_get_current_section () {
545
  $section = 'wcal_all_abandoned';
546
  if ( isset( $_GET[ 'wcal_section' ] ) ) {
woocommerce-abandoned-cart/includes/classes/class-wcal-aes-counter.php CHANGED
@@ -5,7 +5,19 @@
5
  /* Right of free use is granted for all commercial or non-commercial use under CC-BY licence. */
6
  /* No warranty of any form is offered. */
7
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
8
-
 
 
 
 
 
 
 
 
 
 
 
 
9
  Class Wcal_Aes_Ctr extends Wcal_Aes
10
  {
11
 
@@ -19,6 +31,7 @@ Class Wcal_Aes_Ctr extends Wcal_Aes
19
  * @param password the password to use to generate a key
20
  * @param nBits number of bits to be used in the key (128, 192, or 256)
21
  * @return encrypted text
 
22
  */
23
  public static function encrypt($plaintext, $password, $nBits)
24
  {
@@ -90,6 +103,7 @@ Class Wcal_Aes_Ctr extends Wcal_Aes
90
  * @param password the password to use to generate a key
91
  * @param nBits number of bits to be used in the key (128, 192, or 256)
92
  * @return decrypted text
 
93
  */
94
  public static function decrypt($ciphertext, $password, $nBits)
95
  {
@@ -145,12 +159,13 @@ Class Wcal_Aes_Ctr extends Wcal_Aes
145
  }
146
 
147
 
148
- /*
149
  * Unsigned right shift function, since PHP has neither >>> operator nor unsigned ints
150
  *
151
  * @param a number to be shifted (32-bit integer)
152
  * @param b number of bits to shift a to the right (0..31)
153
  * @return a right-shifted and zero-filled by b bits
 
154
  */
155
  private static function urs($a, $b)
156
  {
5
  /* Right of free use is granted for all commercial or non-commercial use under CC-BY licence. */
6
  /* No warranty of any form is offered. */
7
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
8
+ /**
9
+ * Abandoned Cart Lite for WooCommerce
10
+ *
11
+ * It will handle the common action for the plugin.
12
+ *
13
+ * @author Tyche Softwares
14
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Encrypt-Decrypt-Data
15
+ */
16
+
17
+ /**
18
+ * This class will encrypt and decrypt the data.
19
+ * @since 2.8
20
+ */
21
  Class Wcal_Aes_Ctr extends Wcal_Aes
22
  {
23
 
31
  * @param password the password to use to generate a key
32
  * @param nBits number of bits to be used in the key (128, 192, or 256)
33
  * @return encrypted text
34
+ * @since 2.8
35
  */
36
  public static function encrypt($plaintext, $password, $nBits)
37
  {
103
  * @param password the password to use to generate a key
104
  * @param nBits number of bits to be used in the key (128, 192, or 256)
105
  * @return decrypted text
106
+ * @since 2.8
107
  */
108
  public static function decrypt($ciphertext, $password, $nBits)
109
  {
159
  }
160
 
161
 
162
+ /**
163
  * Unsigned right shift function, since PHP has neither >>> operator nor unsigned ints
164
  *
165
  * @param a number to be shifted (32-bit integer)
166
  * @param b number of bits to shift a to the right (0..31)
167
  * @return a right-shifted and zero-filled by b bits
168
+ * @since 2.8
169
  */
170
  private static function urs($a, $b)
171
  {
woocommerce-abandoned-cart/includes/classes/class-wcal-aes.php CHANGED
@@ -6,6 +6,19 @@
6
  /* No warranty of any form is offered. */
7
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  Class Wcal_Aes
10
  {
11
  /**
@@ -15,6 +28,7 @@ Class Wcal_Aes
15
  * @param w key schedule as 2D byte-array (Nr+1 x Nb bytes) -
16
  * generated from the cipher key by keyExpansion()
17
  * @return ciphertext as byte-array (16 bytes)
 
18
  */
19
  public static function cipher($input, $w)
20
  {
@@ -42,6 +56,7 @@ Class Wcal_Aes
42
  }
43
  /**
44
  * Xor Round Key into state S [�5.1.4].
 
45
  */
46
  private static function addRoundKey( $state, $w, $rnd, $Nb )
47
  {
@@ -53,6 +68,7 @@ Class Wcal_Aes
53
 
54
  /**
55
  * Apply SBox to state S [�5.1.1].
 
56
  */
57
  private static function subBytes($s, $Nb)
58
  {
@@ -64,6 +80,7 @@ Class Wcal_Aes
64
 
65
  /**
66
  * Shift row r of state S left by r bytes [�5.1.2].
 
67
  */
68
  private static function shiftRows($s, $Nb)
69
  {
@@ -77,6 +94,7 @@ Class Wcal_Aes
77
 
78
  /**
79
  * Combine bytes of each col of state S [�5.1.3].
 
80
  */
81
  private static function mixColumns($s, $Nb)
82
  {
@@ -103,6 +121,7 @@ Class Wcal_Aes
103
  *
104
  * @param key cipher key byte-array (16 bytes).
105
  * @return key schedule as 2D byte-array (Nr+1 x Nb bytes).
 
106
  */
107
  public static function keyExpansion($key)
108
  {
@@ -134,6 +153,7 @@ Class Wcal_Aes
134
 
135
  /**
136
  * Apply SBox to 4-byte word w.
 
137
  */
138
  private static function subWord($w)
139
  {
@@ -143,6 +163,7 @@ Class Wcal_Aes
143
 
144
  /**
145
  * Rotate 4-byte word w left by one byte.
 
146
  */
147
  private static function rotWord($w)
148
  {
6
  /* No warranty of any form is offered. */
7
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
8
 
9
+ /**
10
+ * Abandoned Cart Lite for WooCommerce
11
+ *
12
+ * It will handle the common action for the plugin.
13
+ *
14
+ * @author Tyche Softwares
15
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Encrypt-Decrypt-Data
16
+ */
17
+
18
+ /**
19
+ * It will genrate the encryption and decryption for data.
20
+ * @since 2.8
21
+ */
22
  Class Wcal_Aes
23
  {
24
  /**
28
  * @param w key schedule as 2D byte-array (Nr+1 x Nb bytes) -
29
  * generated from the cipher key by keyExpansion()
30
  * @return ciphertext as byte-array (16 bytes)
31
+ * @since 2.8
32
  */
33
  public static function cipher($input, $w)
34
  {
56
  }
57
  /**
58
  * Xor Round Key into state S [�5.1.4].
59
+ * @since 2.8
60
  */
61
  private static function addRoundKey( $state, $w, $rnd, $Nb )
62
  {
68
 
69
  /**
70
  * Apply SBox to state S [�5.1.1].
71
+ * @since 2.8
72
  */
73
  private static function subBytes($s, $Nb)
74
  {
80
 
81
  /**
82
  * Shift row r of state S left by r bytes [�5.1.2].
83
+ * @since 2.8
84
  */
85
  private static function shiftRows($s, $Nb)
86
  {
94
 
95
  /**
96
  * Combine bytes of each col of state S [�5.1.3].
97
+ * @since 2.8
98
  */
99
  private static function mixColumns($s, $Nb)
100
  {
121
  *
122
  * @param key cipher key byte-array (16 bytes).
123
  * @return key schedule as 2D byte-array (Nr+1 x Nb bytes).
124
+ * @since 2.8
125
  */
126
  public static function keyExpansion($key)
127
  {
153
 
154
  /**
155
  * Apply SBox to 4-byte word w.
156
+ * @since 2.8
157
  */
158
  private static function subWord($w)
159
  {
163
 
164
  /**
165
  * Rotate 4-byte word w left by one byte.
166
+ * @since 2.8
167
  */
168
  private static function rotWord($w)
169
  {
woocommerce-abandoned-cart/includes/classes/class-wcal-product-report-table.php CHANGED
@@ -9,6 +9,16 @@ if ( ! class_exists( 'WP_List_Table' ) ) {
9
  require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
10
  }
11
 
 
 
 
 
 
 
 
 
 
 
12
  class WCAL_Product_Report_Table extends WP_List_Table {
13
 
14
  /**
@@ -28,52 +38,18 @@ class WCAL_Product_Report_Table extends WP_List_Table {
28
  public $base_url;
29
 
30
  /**
31
- * Total number of recovred orders
32
  *
33
  * @var int
34
  * @since 2.5.3
35
  */
36
  public $total_count;
37
 
38
-
39
- /**
40
- * Total number of recovred orders
41
- *
42
- * @var int
43
- * @since 2.5.3
44
- */
45
- public $open_emails;
46
-
47
- /**
48
- * Total amount of abandoned orders
49
- *
50
- * @var int
51
- * @since 2.5.3
52
- */
53
- public $link_click_count;
54
-
55
- /**
56
- * Total number recovred orders
57
- *
58
- * @var int
59
- * @since 2.5.3
60
- */
61
- public $start_date_db;
62
-
63
  /**
64
- * Total number recovred orders total
65
- *
66
- * @var int
67
- * @since 2.5.3
68
- */
69
- public $end_date_db;
70
-
71
- public $duration;
72
-
73
- /**
74
- * Get things started
75
  *
76
  * @see WP_List_Table::__construct()
 
77
  */
78
  public function __construct() {
79
  global $status, $page;
@@ -86,6 +62,10 @@ class WCAL_Product_Report_Table extends WP_List_Table {
86
  $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=stats' );
87
  }
88
 
 
 
 
 
89
  public function wcal_product_report_prepare_items() {
90
  $columns = $this->get_columns();
91
  $hidden = array(); // No hidden columns
@@ -101,6 +81,11 @@ class WCAL_Product_Report_Table extends WP_List_Table {
101
  );
102
  }
103
 
 
 
 
 
 
104
  public function get_columns() {
105
  $columns = array(
106
  'product_name' => __( 'Product Name', 'woocommerce-abandoned-cart' ),
@@ -111,22 +96,21 @@ class WCAL_Product_Report_Table extends WP_List_Table {
111
  }
112
 
113
  /**
114
- * Render the user name Column
115
- *
116
- * @access public
117
- * @since 2.5.3
118
- * @param array $abandoned_row_info Contains all the data of the template row
119
- * @return string Data shown in the Email column
120
- *
121
- * This function used for individual delete of row, It is for hover effect delete.
122
- */
123
  public function wcal_product_report_data () {
124
  global $wpdb;
125
  $wcal_class = new woocommerce_abandon_cart_lite ();
126
  $per_page = $this->per_page;
127
  $i = 0;
128
  $order = "desc";
129
- $query = "SELECT abandoned_cart_time, abandoned_cart_info, recovered_cart FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` ORDER BY recovered_cart DESC";
 
 
 
130
  $recover_query = $wpdb->get_results( $query );
131
  $rec_carts_array = array ( );
132
  $recover_product_array = array( );
@@ -137,7 +121,7 @@ class WCAL_Product_Report_Table extends WP_List_Table {
137
  $recovered_cart_dat = json_decode( $recovered_cart_value->recovered_cart);
138
  $cart_update_time = $recovered_cart_value->abandoned_cart_time;
139
  $quantity_total = 0;
140
- $cart_details = array();
141
  if( isset( $recovered_cart_info->cart ) ){
142
  $cart_details = $recovered_cart_info->cart;
143
  }
@@ -221,6 +205,13 @@ class WCAL_Product_Report_Table extends WP_List_Table {
221
  return apply_filters( 'wcal_product_report_table_data', $return_product_report_display );
222
  }
223
 
 
 
 
 
 
 
 
224
  public function column_default( $wcal_sent_emails, $column_name ) {
225
  $value = '';
226
  switch ( $column_name ) {
9
  require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
10
  }
11
 
12
+ /**
13
+ * Abandoned Cart Lite for WooCommerce
14
+ *
15
+ * It will handle the common action for the plugin.
16
+ *
17
+ * @author Tyche Softwares
18
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/List-Class
19
+ * @since 2.5.3
20
+ */
21
+
22
  class WCAL_Product_Report_Table extends WP_List_Table {
23
 
24
  /**
38
  public $base_url;
39
 
40
  /**
41
+ * Total number of products
42
  *
43
  * @var int
44
  * @since 2.5.3
45
  */
46
  public $total_count;
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  /**
49
+ * It will add the variable needed for the class.
 
 
 
 
 
 
 
 
 
 
50
  *
51
  * @see WP_List_Table::__construct()
52
+ * @since 2.5.3
53
  */
54
  public function __construct() {
55
  global $status, $page;
62
  $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=stats' );
63
  }
64
 
65
+ /**
66
+ * It will prepare the list of the Product reports, like columns, pagination, sortable column, all data
67
+ * @since 2.5.3
68
+ */
69
  public function wcal_product_report_prepare_items() {
70
  $columns = $this->get_columns();
71
  $hidden = array(); // No hidden columns
81
  );
82
  }
83
 
84
+ /**
85
+ * It will add the columns product report list.
86
+ * @return array $columns All columns name.
87
+ * @since 2.5.3
88
+ */
89
  public function get_columns() {
90
  $columns = array(
91
  'product_name' => __( 'Product Name', 'woocommerce-abandoned-cart' ),
96
  }
97
 
98
  /**
99
+ * It will generate the product list data.
100
+ * @globals mixed $wpdb
101
+ * @return array $return_product_report_display Key and value of all the columns
102
+ * @since 2.5.3
103
+ */
 
 
 
 
104
  public function wcal_product_report_data () {
105
  global $wpdb;
106
  $wcal_class = new woocommerce_abandon_cart_lite ();
107
  $per_page = $this->per_page;
108
  $i = 0;
109
  $order = "desc";
110
+ $blank_cart_info = '{"cart":[]}';
111
+ $blank_cart_info_guest = '[]';
112
+ $blank_cart = '""';
113
+ $query = "SELECT abandoned_cart_time, abandoned_cart_info, recovered_cart FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE abandoned_cart_info NOT LIKE '%$blank_cart_info%' AND abandoned_cart_info NOT LIKE '$blank_cart_info_guest' AND abandoned_cart_info NOT LIKE '%$blank_cart%' ORDER BY recovered_cart DESC";
114
  $recover_query = $wpdb->get_results( $query );
115
  $rec_carts_array = array ( );
116
  $recover_product_array = array( );
121
  $recovered_cart_dat = json_decode( $recovered_cart_value->recovered_cart);
122
  $cart_update_time = $recovered_cart_value->abandoned_cart_time;
123
  $quantity_total = 0;
124
+ $cart_details = new stdClass();
125
  if( isset( $recovered_cart_info->cart ) ){
126
  $cart_details = $recovered_cart_info->cart;
127
  }
205
  return apply_filters( 'wcal_product_report_table_data', $return_product_report_display );
206
  }
207
 
208
+ /**
209
+ * It will display the data for product column
210
+ * @param array | object $wcal_sent_emails All data of the list
211
+ * @param stirng $column_name Name of the column
212
+ * @return string $value Data of the column
213
+ * @since 2.5.3
214
+ */
215
  public function column_default( $wcal_sent_emails, $column_name ) {
216
  $value = '';
217
  switch ( $column_name ) {
woocommerce-abandoned-cart/includes/classes/class-wcal-recover-orders-table.php CHANGED
@@ -4,6 +4,15 @@
4
  if ( ! class_exists( 'WP_List_Table' ) ) {
5
  require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
6
  }
 
 
 
 
 
 
 
 
 
7
 
8
  class wcal_Recover_Orders_Table extends WP_List_Table {
9
 
@@ -65,9 +74,10 @@ class wcal_Recover_Orders_Table extends WP_List_Table {
65
  public $total_recover_amount;
66
 
67
  /**
68
- * Get things started
69
  *
70
  * @see WP_List_Table::__construct()
 
71
  */
72
  public function __construct() {
73
  global $status, $page;
@@ -80,6 +90,10 @@ class wcal_Recover_Orders_Table extends WP_List_Table {
80
  $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=stats' );
81
  }
82
 
 
 
 
 
83
  public function wcal_recovered_orders_prepare_items() {
84
  $columns = $this->get_columns();
85
  $hidden = array(); // No hidden columns
@@ -100,6 +114,11 @@ class wcal_Recover_Orders_Table extends WP_List_Table {
100
  );
101
  }
102
 
 
 
 
 
 
103
  public function get_columns() {
104
  $columns = array(
105
  'user_name' => __( 'Customer Name', 'woocommerce-abandoned-cart' ),
@@ -111,6 +130,11 @@ class wcal_Recover_Orders_Table extends WP_List_Table {
111
  return apply_filters( 'wcal_recovered_orders_columns', $columns );
112
  }
113
 
 
 
 
 
 
114
  public function recovered_orders_get_sortable_columns() {
115
  $columns = array(
116
  'created_on' => array( 'created_on', false ),
@@ -120,14 +144,12 @@ class wcal_Recover_Orders_Table extends WP_List_Table {
120
  }
121
 
122
  /**
123
- * Render the user name Column
124
- *
125
- * @access public
126
  * @since 2.5.2
127
- * @param array $abandoned_row_info Contains all the data of the template row
128
- * @return string Data shown in the Email column
129
  *
130
- * This function used for individual delete of row, It is for hover effect delete.
131
  */
132
  public function column_user_name( $recovered_orders_row_info ) {
133
  $row_actions = array();
@@ -142,7 +164,14 @@ class wcal_Recover_Orders_Table extends WP_List_Table {
142
  }
143
  return apply_filters( 'wcal_recovered_orders_single_column', $value, $recovered_id, 'email' );
144
  }
145
-
 
 
 
 
 
 
 
146
  public function wcal_recovered_orders_data() {
147
  global $wpdb, $woocommerce;
148
  $wcal_class = new woocommerce_abandon_cart_lite ();
@@ -210,7 +239,7 @@ class wcal_Recover_Orders_Table extends WP_List_Table {
210
  foreach ( $ac_carts_results as $key => $value ) {
211
  $count_carts += 1;
212
  $cart_detail = json_decode( $value->abandoned_cart_info );
213
- $product_details = array();
214
  if( isset( $cart_detail->cart ) ) {
215
  $product_details = $cart_detail->cart;
216
  }
@@ -337,14 +366,36 @@ class wcal_Recover_Orders_Table extends WP_List_Table {
337
  return apply_filters( 'wcal_recovered_orders_table_data', $return_recovered_orders_display );
338
  }
339
 
 
 
 
 
 
 
 
340
  function wcal_class_recovered_created_on_asc( $value1,$value2 ) {
341
  return $value1->abandoned_date - $value2->abandoned_date;
342
  }
343
 
 
 
 
 
 
 
 
344
  function wcal_class_recovered_created_on_dsc( $value1,$value2 ) {
345
  return $value2->abandoned_date - $value1->abandoned_date;
346
  }
347
-
 
 
 
 
 
 
 
 
348
  function wcal_class_recovered_date_asc( $value1,$value2 ) {
349
 
350
  global $woocommerce;
@@ -357,6 +408,15 @@ class wcal_Recover_Orders_Table extends WP_List_Table {
357
  }
358
  return $value1->recover_order_date - $value2->recover_order_date;
359
  }
 
 
 
 
 
 
 
 
 
360
 
361
  function wcal_class_recovered_date_dsc( $value1,$value2 ) {
362
  global $woocommerce;
@@ -370,6 +430,13 @@ class wcal_Recover_Orders_Table extends WP_List_Table {
370
  return $value2->recover_order_date - $value1->recover_order_date;
371
  }
372
 
 
 
 
 
 
 
 
373
  public function column_default( $wcal_abandoned_orders, $column_name ) {
374
  $value = '';
375
  switch ( $column_name ) {
4
  if ( ! class_exists( 'WP_List_Table' ) ) {
5
  require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
6
  }
7
+ /**
8
+ * Abandoned Cart Lite for WooCommerce
9
+ *
10
+ * It will handle the common action for the plugin.
11
+ *
12
+ * @author Tyche Softwares
13
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/List-Class
14
+ * @since 2.5.2
15
+ */
16
 
17
  class wcal_Recover_Orders_Table extends WP_List_Table {
18
 
74
  public $total_recover_amount;
75
 
76
  /**
77
+ * It will add the variable needed for the class.
78
  *
79
  * @see WP_List_Table::__construct()
80
+ * @since 2.5.2
81
  */
82
  public function __construct() {
83
  global $status, $page;
90
  $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=stats' );
91
  }
92
 
93
+ /**
94
+ * It will prepare the list of the recovered carts, like columns, pagination, sortable column, all data.
95
+ * @since 2.5.2
96
+ */
97
  public function wcal_recovered_orders_prepare_items() {
98
  $columns = $this->get_columns();
99
  $hidden = array(); // No hidden columns
114
  );
115
  }
116
 
117
+ /**
118
+ * It will add the columns recovered orders list.
119
+ * @return array $columns All columns name.
120
+ * @since 2.5.2
121
+ */
122
  public function get_columns() {
123
  $columns = array(
124
  'user_name' => __( 'Customer Name', 'woocommerce-abandoned-cart' ),
130
  return apply_filters( 'wcal_recovered_orders_columns', $columns );
131
  }
132
 
133
+ /**
134
+ * We can mention on which column we need the sorting. Here, Abandoned cart date and recovered date.
135
+ * @return array $columns Name of the column
136
+ * @since 2.5.2
137
+ */
138
  public function recovered_orders_get_sortable_columns() {
139
  $columns = array(
140
  'created_on' => array( 'created_on', false ),
144
  }
145
 
146
  /**
147
+ * Render the user name Column.
148
+ * We will add the view detials hover link.
 
149
  * @since 2.5.2
150
+ * @param array $recovered_orders_row_info Contains all the data of the recovered order row
151
+ * @return string $value shown in the User name
152
  *
 
153
  */
154
  public function column_user_name( $recovered_orders_row_info ) {
155
  $row_actions = array();
164
  }
165
  return apply_filters( 'wcal_recovered_orders_single_column', $value, $recovered_id, 'email' );
166
  }
167
+
168
+ /**
169
+ * It will generate the recovered cart list data.
170
+ * @globals mixed $wpdb
171
+ * @globals mixed $woocommerce
172
+ * @return array $return_recovered_orders_display Key and value of all the columns
173
+ * @since 2.5.2
174
+ */
175
  public function wcal_recovered_orders_data() {
176
  global $wpdb, $woocommerce;
177
  $wcal_class = new woocommerce_abandon_cart_lite ();
239
  foreach ( $ac_carts_results as $key => $value ) {
240
  $count_carts += 1;
241
  $cart_detail = json_decode( $value->abandoned_cart_info );
242
+ $product_details = new stdClass();
243
  if( isset( $cart_detail->cart ) ) {
244
  $product_details = $cart_detail->cart;
245
  }
366
  return apply_filters( 'wcal_recovered_orders_table_data', $return_recovered_orders_display );
367
  }
368
 
369
+ /**
370
+ * It will sort the ascending data based on the abandoned cart date.
371
+ * @param array | object $value1 All data of the list
372
+ * @param array | object $value2 All data of the list
373
+ * @return timestamp
374
+ * @since 2.5.2
375
+ */
376
  function wcal_class_recovered_created_on_asc( $value1,$value2 ) {
377
  return $value1->abandoned_date - $value2->abandoned_date;
378
  }
379
 
380
+ /**
381
+ * It will sort the descending data based on the abandoned cart date.
382
+ * @param array | object $value1 All data of the list
383
+ * @param array | object $value2 All data of the list
384
+ * @return timestamp
385
+ * @since 2.5.2
386
+ */
387
  function wcal_class_recovered_created_on_dsc( $value1,$value2 ) {
388
  return $value2->abandoned_date - $value1->abandoned_date;
389
  }
390
+
391
+ /**
392
+ * It will sort the ascending data based on the recovered cart date.
393
+ * @param array | object $value1 All data of the list
394
+ * @param array | object $value2 All data of the list
395
+ * @globals mixed $woocommerce
396
+ * @return timestamp
397
+ * @since 2.5.2
398
+ */
399
  function wcal_class_recovered_date_asc( $value1,$value2 ) {
400
 
401
  global $woocommerce;
408
  }
409
  return $value1->recover_order_date - $value2->recover_order_date;
410
  }
411
+
412
+ /**
413
+ * It will sort the descending data based on the recovered cart date.
414
+ * @param array | object $value1 All data of the list
415
+ * @param array | object $value2 All data of the list
416
+ * @globals mixed $woocommerce
417
+ * @return timestamp
418
+ * @since 2.5.2
419
+ */
420
 
421
  function wcal_class_recovered_date_dsc( $value1,$value2 ) {
422
  global $woocommerce;
430
  return $value2->recover_order_date - $value1->recover_order_date;
431
  }
432
 
433
+ /**
434
+ * It will display the data for the recovered column.
435
+ * @param array | object $wcal_abandoned_orders All data of the list
436
+ * @param stirng $column_name Name of the column
437
+ * @return string $value Data of the column
438
+ * @since 2.5.2
439
+ */
440
  public function column_default( $wcal_abandoned_orders, $column_name ) {
441
  $value = '';
442
  switch ( $column_name ) {
woocommerce-abandoned-cart/includes/classes/class-wcal-templates-table.php CHANGED
@@ -4,6 +4,15 @@
4
  if ( ! class_exists( 'WP_List_Table' ) ) {
5
  require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
6
  }
 
 
 
 
 
 
 
 
 
7
 
8
  class WCAL_Templates_Table extends WP_List_Table {
9
 
@@ -32,9 +41,10 @@ class WCAL_Templates_Table extends WP_List_Table {
32
  public $total_count;
33
 
34
  /**
35
- * Get things started
36
  *
37
  * @see WP_List_Table::__construct()
 
38
  */
39
  public function __construct() {
40
  global $status, $page;
@@ -48,6 +58,10 @@ class WCAL_Templates_Table extends WP_List_Table {
48
  $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=emailtemplates' );
49
  }
50
 
 
 
 
 
51
  public function wcal_templates_prepare_items() {
52
  $columns = $this->get_columns();
53
  $hidden = array(); // No hidden columns
@@ -66,6 +80,11 @@ class WCAL_Templates_Table extends WP_List_Table {
66
  );
67
  }
68
 
 
 
 
 
 
69
  public function get_columns() {
70
  $columns = array(
71
  'cb' => '<input type="checkbox" />',
@@ -76,8 +95,11 @@ class WCAL_Templates_Table extends WP_List_Table {
76
  );
77
  return apply_filters( 'wcal_templates_columns', $columns );
78
  }
79
- /***
80
- * It is used to add the check box for the items
 
 
 
81
  */
82
  function column_cb( $item ) {
83
  $template_id = '';
@@ -91,6 +113,11 @@ class WCAL_Templates_Table extends WP_List_Table {
91
  );
92
  }
93
 
 
 
 
 
 
94
  public function templates_get_sortable_columns() {
95
  $columns = array(
96
  'template_name' => array( 'template_name', false ),
@@ -100,14 +127,12 @@ class WCAL_Templates_Table extends WP_List_Table {
100
  }
101
 
102
  /**
103
- * Render the Email Column
104
- *
105
- * @access public
106
  * @since 2.5.2
107
- * @param array $abandoned_row_info Contains all the data of the template row
108
- * @return string Data shown in the Email column
109
  *
110
- * This function used for individual delete of row, It is for hover effect delete.
111
  */
112
  public function column_template_name( $template_row_info ) {
113
  $row_actions = array();
@@ -125,6 +150,12 @@ class WCAL_Templates_Table extends WP_List_Table {
125
  return apply_filters( 'wcal_template_single_column', $value, $template_id, 'email' );
126
  }
127
 
 
 
 
 
 
 
128
  public function wcal_templates_data() {
129
  global $wpdb;
130
  $return_templates_data = array();
@@ -194,22 +225,57 @@ class WCAL_Templates_Table extends WP_List_Table {
194
  return apply_filters( 'wcal_templates_table_data', $return_templates_data_display );
195
  }
196
 
 
 
 
 
 
 
 
197
  function wcal_class_template_name_asc( $value1,$value2 ) {
198
  return strcasecmp( $value1->template_name,$value2->template_name );
199
  }
200
 
 
 
 
 
 
 
 
201
  function wcal_class_template_name_dsc( $value1,$value2 ) {
202
  return strcasecmp( $value2->template_name,$value1->template_name );
203
  }
204
 
 
 
 
 
 
 
 
205
  function wcal_class_sent_time_asc( $value1,$value2 ) {
206
  return strnatcasecmp( $value1->sent_time,$value2->sent_time );
207
  }
208
 
 
 
 
 
 
 
 
209
  function wcal_class_sent_time_dsc( $value1,$value2 ) {
210
  return strnatcasecmp( $value2->sent_time,$value1->sent_time );
211
  }
212
-
 
 
 
 
 
 
 
213
  public function column_default( $wcal_abandoned_orders, $column_name ) {
214
  $value = '';
215
  switch ( $column_name ) {
@@ -254,6 +320,11 @@ class WCAL_Templates_Table extends WP_List_Table {
254
  return apply_filters( 'wcal_template_column_default', $value, $wcal_abandoned_orders, $column_name );
255
  }
256
 
 
 
 
 
 
257
  public function get_bulk_actions() {
258
  return array(
259
  'wcal_delete_template' => __( 'Delete', 'woocommerce-abandoned-cart' )
4
  if ( ! class_exists( 'WP_List_Table' ) ) {
5
  require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
6
  }
7
+ /**
8
+ * Abandoned Cart Lite for WooCommerce
9
+ *
10
+ * It will handle the common action for the plugin.
11
+ *
12
+ * @author Tyche Softwares
13
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/List-Class
14
+ * @since 2.5.2
15
+ */
16
 
17
  class WCAL_Templates_Table extends WP_List_Table {
18
 
41
  public $total_count;
42
 
43
  /**
44
+ * It will add the bulk action function and other variable needed for the class.
45
  *
46
  * @see WP_List_Table::__construct()
47
+ * @since 2.5.2
48
  */
49
  public function __construct() {
50
  global $status, $page;
58
  $this->base_url = admin_url( 'admin.php?page=woocommerce_ac_page&action=emailtemplates' );
59
  }
60
 
61
+ /**
62
+ * It will prepare the list of the templates, like columns, pagination, sortable column, all data.
63
+ * @since 2.5.2
64
+ */
65
  public function wcal_templates_prepare_items() {
66
  $columns = $this->get_columns();
67
  $hidden = array(); // No hidden columns
80
  );
81
  }
82
 
83
+ /**
84
+ * It will add the columns templates list.
85
+ * @return array $columns All columns name.
86
+ * @since 2.5.2
87
+ */
88
  public function get_columns() {
89
  $columns = array(
90
  'cb' => '<input type="checkbox" />',
95
  );
96
  return apply_filters( 'wcal_templates_columns', $columns );
97
  }
98
+ /**
99
+ * It is used to add the check box for the items.
100
+ * @param string $item
101
+ * @return string
102
+ * @since 2.5.2
103
  */
104
  function column_cb( $item ) {
105
  $template_id = '';
113
  );
114
  }
115
 
116
+ /**
117
+ * We can mention on which column we need the sorting. Here we have template name, email sent time
118
+ * @return array $columns Name of the column
119
+ * @since 2.5.2
120
+ */
121
  public function templates_get_sortable_columns() {
122
  $columns = array(
123
  'template_name' => array( 'template_name', false ),
127
  }
128
 
129
  /**
130
+ * It will add the hover link on the template name.
131
+ * This function used for individual delete, edit of row.
 
132
  * @since 2.5.2
133
+ * @param array $template_row_info Contains all the data of the template row
134
+ * @return string $value All hover links, here we have edit and delete
135
  *
 
136
  */
137
  public function column_template_name( $template_row_info ) {
138
  $row_actions = array();
150
  return apply_filters( 'wcal_template_single_column', $value, $template_id, 'email' );
151
  }
152
 
153
+ /**
154
+ * It will generate the templates list data.
155
+ * @globals mixed $wpdb
156
+ * @return array $return_templates_data_display Key and value of all the columns
157
+ * @since 2.5.2
158
+ */
159
  public function wcal_templates_data() {
160
  global $wpdb;
161
  $return_templates_data = array();
225
  return apply_filters( 'wcal_templates_table_data', $return_templates_data_display );
226
  }
227
 
228
+ /**
229
+ * It will sort the data alphabetally ascending on the template name.
230
+ * @param array | object $value1 All data of the list
231
+ * @param array | object $value2 All data of the list
232
+ * @return sorted array
233
+ * @since 2.5.2
234
+ */
235
  function wcal_class_template_name_asc( $value1,$value2 ) {
236
  return strcasecmp( $value1->template_name,$value2->template_name );
237
  }
238
 
239
+ /**
240
+ * It will sort the data alphabetally descending on the template name.
241
+ * @param array | object $value1 All data of the list
242
+ * @param array | object $value2 All data of the list
243
+ * @return sorted array
244
+ * @since 2.5.2
245
+ */
246
  function wcal_class_template_name_dsc( $value1,$value2 ) {
247
  return strcasecmp( $value2->template_name,$value1->template_name );
248
  }
249
 
250
+ /**
251
+ * It will sort the data alphanumeric ascending on the template time.
252
+ * @param array | object $value1 All data of the list
253
+ * @param array | object $value2 All data of the list
254
+ * @return sorted array
255
+ * @since 2.5.2
256
+ */
257
  function wcal_class_sent_time_asc( $value1,$value2 ) {
258
  return strnatcasecmp( $value1->sent_time,$value2->sent_time );
259
  }
260
 
261
+ /**
262
+ * It will sort the data alphanumeric descending on the template time.
263
+ * @param array | object $value1 All data of the list
264
+ * @param array | object $value2 All data of the list
265
+ * @return sorted array
266
+ * @since 2.5.2
267
+ */
268
  function wcal_class_sent_time_dsc( $value1,$value2 ) {
269
  return strnatcasecmp( $value2->sent_time,$value1->sent_time );
270
  }
271
+
272
+ /**
273
+ * It will display the data for the templates list
274
+ * @param array | object $wcal_abandoned_orders All data of the list
275
+ * @param stirng $column_name Name of the column
276
+ * @return string $value Data of the column
277
+ * @since 2.5.2
278
+ */
279
  public function column_default( $wcal_abandoned_orders, $column_name ) {
280
  $value = '';
281
  switch ( $column_name ) {
320
  return apply_filters( 'wcal_template_column_default', $value, $wcal_abandoned_orders, $column_name );
321
  }
322
 
323
+ /**
324
+ * It will add the bulk action, here Delete
325
+ * @return array
326
+ * @since 2.5.2
327
+ */
328
  public function get_bulk_actions() {
329
  return array(
330
  'wcal_delete_template' => __( 'Delete', 'woocommerce-abandoned-cart' )
woocommerce-abandoned-cart/includes/classes/class-wcal-ts-tracker.php CHANGED
@@ -1,18 +1,24 @@
1
  <?php
2
  /**
3
- * Abandoned cart data tracker
4
  *
5
- * The Abandoned Cart lite tracker class adds functionality to track Abandoned Cart lite Date usage based on if the customer opted in.
6
- * No personal information is tracked, only general Abandoned Cart lite settings, abandoned orders and recovered orders, abandoned orders amount, recovred orders amount, total templates, total email sent, logged-in users abandoned & recovered amount, guest users abandoned and admin email for discount code.
 
 
7
  *
8
- * @class Class_Wcal_Ts_Tracker
9
- * @version 6.8
10
  */
11
 
12
  if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
  }
15
 
 
 
 
 
16
  class Class_Wcal_Ts_Tracker {
17
 
18
  /**
@@ -22,7 +28,8 @@ class Class_Wcal_Ts_Tracker {
22
  private static $wcal_api_url = 'http://tracking.tychesoftwares.com/v1/';
23
 
24
  /**
25
- * Hook into cron event.
 
26
  */
27
  public static function init() {
28
  add_action( 'wcal_ts_tracker_send_event', array( __CLASS__, 'wcal_ts_send_tracking_data' ) );
@@ -32,8 +39,9 @@ class Class_Wcal_Ts_Tracker {
32
 
33
  /**
34
  * Decide whether to send tracking data or not.
35
- *
36
  * @param boolean $override
 
37
  */
38
  public static function wcal_ts_send_tracking_data( $override = false ) {
39
 
@@ -87,6 +95,7 @@ class Class_Wcal_Ts_Tracker {
87
  /**
88
  * Get the last time tracking data was sent.
89
  * @return int|bool
 
90
  */
91
  private static function wcal_ts_get_last_send_time() {
92
  return apply_filters( 'wcal_ts_tracker_last_send_time', get_option( 'wcal_ts_tracker_last_send', false ) );
@@ -95,6 +104,7 @@ class Class_Wcal_Ts_Tracker {
95
  /**
96
  * Get all the tracking data.
97
  * @return array
 
98
  */
99
  private static function wcal_ts_get_tracking_data() {
100
  $data = array();
@@ -122,8 +132,11 @@ class Class_Wcal_Ts_Tracker {
122
  }
123
 
124
  /**
125
- * Get plugin related data.
126
- * @return array
 
 
 
127
  */
128
  public static function wcal_ts_add_plugin_tracking_data ( $data ){
129
 
@@ -181,8 +194,10 @@ class Class_Wcal_Ts_Tracker {
181
  }
182
 
183
  /**
184
- * Get data when user dont want to share information.
185
- * @return array
 
 
186
  */
187
  public static function wcal_get_data_for_opt_out( $params ){
188
 
@@ -200,7 +215,8 @@ class Class_Wcal_Ts_Tracker {
200
 
201
  /**
202
  * Get WordPress related data.
203
- * @return array
 
204
  */
205
  private static function wcal_ts_get_wordpress_info() {
206
  $wp_data = array();
@@ -222,8 +238,9 @@ class Class_Wcal_Ts_Tracker {
222
  }
223
 
224
  /**
225
- * Get the current theme info, theme name and version.
226
  * @return array
 
227
  */
228
  public static function wcal_ts_get_theme_info() {
229
  $theme_data = wp_get_theme();
@@ -235,8 +252,10 @@ class Class_Wcal_Ts_Tracker {
235
  }
236
 
237
  /**
238
- * Get server related info.
239
- * @return array
 
 
240
  */
241
  private static function wcal_ts_get_server_info() {
242
  $server_data = array();
@@ -269,8 +288,10 @@ class Class_Wcal_Ts_Tracker {
269
  }
270
 
271
  /**
272
- * Get all plugins grouped into activated or not.
273
- * @return array
 
 
274
  */
275
  private static function wcal_ts_get_all_plugins() {
276
  // Ensure get_plugins function is loaded
@@ -312,7 +333,9 @@ class Class_Wcal_Ts_Tracker {
312
 
313
  /**
314
  * Get abandoned orders counts.
315
- * @return string
 
 
316
  */
317
  private static function wcal_ts_get_abandoned_order_counts() {
318
  global $wpdb;
@@ -336,7 +359,9 @@ class Class_Wcal_Ts_Tracker {
336
 
337
  /**
338
  * Get recovered orders counts.
339
- * @return string
 
 
340
  */
341
  private static function wcal_ts_get_recovered_order_counts(){
342
 
@@ -355,10 +380,12 @@ class Class_Wcal_Ts_Tracker {
355
  return $wcal_recovered_order_count;
356
  }
357
 
358
- /*
359
- * Get Total abandoned orders amount
360
- *
361
- */
 
 
362
  private static function wcal_ts_get_abandoned_order_total_amount(){
363
  global $wpdb;
364
  $wcal_abandoned_orders_amount = 0;
@@ -380,6 +407,13 @@ class Class_Wcal_Ts_Tracker {
380
  return $wcal_abandoned_orders_amount;
381
  }
382
 
 
 
 
 
 
 
 
383
  private static function wcal_get_abandoned_amount( $wcal_abandoned_query_result ){
384
 
385
  $wcal_abandoned_orders_amount = 0;
@@ -405,10 +439,13 @@ class Class_Wcal_Ts_Tracker {
405
  return $wcal_abandoned_orders_amount;
406
  }
407
 
408
- /*
409
- * Get recovered orders total amount
410
- */
411
- private static function wcal_ts_get_recovered_order_total_amount(){
 
 
 
412
 
413
  global $wpdb;
414
  $wcal_recovered_orders_amount = 0;
@@ -427,6 +464,14 @@ class Class_Wcal_Ts_Tracker {
427
  return $wcal_recovered_orders_amount;
428
  }
429
 
 
 
 
 
 
 
 
 
430
  private static function wcal_get_recovered_amount ( $wcal_data ){
431
 
432
  $wcal_recovered_orders_amount = 0;
@@ -439,9 +484,12 @@ class Class_Wcal_Ts_Tracker {
439
  return $wcal_recovered_orders_amount;
440
  }
441
 
442
- /*
443
- * Get sent email total count
444
- */
 
 
 
445
  private static function wcal_ts_get_sent_emails_total_count(){
446
 
447
  global $wpdb;
@@ -451,9 +499,12 @@ class Class_Wcal_Ts_Tracker {
451
  return $wcal_sent_emails_count;
452
  }
453
 
454
- /*
455
- * Get email templates total count
456
- */
 
 
 
457
  private static function wcal_ts_get_email_templates_data(){
458
 
459
  global $wpdb;
@@ -482,9 +533,12 @@ class Class_Wcal_Ts_Tracker {
482
  return $wcal_templates_data;
483
  }
484
 
485
- /*
486
- * Get logged-in users total abandoned count
487
- */
 
 
 
488
  private static function wcal_ts_get_logged_in_users_abandoned_cart_total_count (){
489
 
490
  global $wpdb;
@@ -505,9 +559,12 @@ class Class_Wcal_Ts_Tracker {
505
  return $wcal_logged_in_user_query_count;
506
  }
507
 
508
- /*
509
- * Get logged-in users total abandoned count
510
- */
 
 
 
511
  private static function wcal_ts_get_guest_users_abandoned_cart_total_count(){
512
  global $wpdb;
513
  $wcal_guest_user_query_count = 0;
@@ -527,6 +584,12 @@ class Class_Wcal_Ts_Tracker {
527
  return $wcal_guest_user_query_count;
528
  }
529
 
 
 
 
 
 
 
530
  private static function wcal_ts_get_logged_in_users_abandoned_cart_total_amount (){
531
 
532
  global $wpdb;
@@ -549,6 +612,12 @@ class Class_Wcal_Ts_Tracker {
549
  return $wcal_abandoned_orders_amount;
550
  }
551
 
 
 
 
 
 
 
552
  private static function wcal_ts_get_guest_users_abandoned_cart_total_amount (){
553
 
554
  global $wpdb;
@@ -571,6 +640,12 @@ class Class_Wcal_Ts_Tracker {
571
  return $wcal_abandoned_orders_amount;
572
  }
573
 
 
 
 
 
 
 
574
  private static function wcal_ts_get_logged_in_users_recovered_cart_total_amount(){
575
 
576
  global $wpdb;
@@ -592,6 +667,12 @@ class Class_Wcal_Ts_Tracker {
592
  }
593
 
594
 
 
 
 
 
 
 
595
  private static function wcal_ts_get_guest_users_recovered_cart_total_amount (){
596
 
597
  global $wpdb;
@@ -612,8 +693,9 @@ class Class_Wcal_Ts_Tracker {
612
 
613
  }
614
  /**
615
- * Get all options starting with woocommerce_ prefix.
616
  * @return array
 
617
  */
618
  private static function wcal_ts_get_all_plugin_options_values() {
619
 
@@ -624,26 +706,40 @@ class Class_Wcal_Ts_Tracker {
624
  );
625
  }
626
 
 
 
 
 
 
627
  private static function wcal_ts_get_wc_plugin_version() {
628
  return WC()->version;
629
  }
630
 
 
 
 
 
 
631
  private static function wcal_ts_get_plugin_license_key() {
632
  return 'Abandoned Cart Lite';
633
  }
634
 
 
 
 
 
 
635
  private static function wcal_ts_get_plugin_version() {
636
  $wcal_plugin_version = self::wcal_plugin_get_version();
637
  return $wcal_plugin_version;
638
  }
639
 
640
  /**
641
- * @return string Plugin version
 
 
642
  */
643
-
644
  public static function wcal_plugin_get_version() {
645
-
646
-
647
  $plugin_path = dirname ( dirname ( dirname ( __FILE__ ) ) ) ;
648
  $plugin_path_with_base_file_name = $plugin_path . "/woocommerce-ac.php";
649
  $plugin_data = get_plugin_data( $plugin_path_with_base_file_name );
1
  <?php
2
  /**
3
+ * Abandoned Cart Lite for WooCommerce
4
  *
5
+ * The Abandoned Cart lite tracker class adds functionality to track Abandoned Cart lite Data usage based on if the customer opted in.
6
+ * No personal information is tracked, only general Abandoned Cart lite settings, abandoned orders and
7
+ * recovered orders, abandoned orders amount, recovered orders amount, total templates, total email sent, logged-in users abandoned
8
+ * & recovered amount, guest users abandoned and admin email for discount code.
9
  *
10
+ * @author Tyche Softwares
11
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Tracking-Data
12
  */
13
 
14
  if ( ! defined( 'ABSPATH' ) ) {
15
  exit;
16
  }
17
 
18
+ /**
19
+ * It will get all the data for the tracking.
20
+ * @since 3.9
21
+ */
22
  class Class_Wcal_Ts_Tracker {
23
 
24
  /**
28
  private static $wcal_api_url = 'http://tracking.tychesoftwares.com/v1/';
29
 
30
  /**
31
+ * It will add all the action needed for tracking the data from customers site.
32
+ * @since 3.9
33
  */
34
  public static function init() {
35
  add_action( 'wcal_ts_tracker_send_event', array( __CLASS__, 'wcal_ts_send_tracking_data' ) );
39
 
40
  /**
41
  * Decide whether to send tracking data or not.
42
+ * @hook wcal_ts_tracker_send_event
43
  * @param boolean $override
44
+ * @since 3.9
45
  */
46
  public static function wcal_ts_send_tracking_data( $override = false ) {
47
 
95
  /**
96
  * Get the last time tracking data was sent.
97
  * @return int|bool
98
+ * @since 3.9
99
  */
100
  private static function wcal_ts_get_last_send_time() {
101
  return apply_filters( 'wcal_ts_tracker_last_send_time', get_option( 'wcal_ts_tracker_last_send', false ) );
104
  /**
105
  * Get all the tracking data.
106
  * @return array
107
+ * @since 3.9
108
  */
109
  private static function wcal_ts_get_tracking_data() {
110
  $data = array();
132
  }
133
 
134
  /**
135
+ * If admin allow to track the data the it will gather all information and return back.
136
+ * @hook ts_tracker_data
137
+ * @param array $data
138
+ * @return array $data
139
+ * @since 3.9
140
  */
141
  public static function wcal_ts_add_plugin_tracking_data ( $data ){
142
 
194
  }
195
 
196
  /**
197
+ * Get data when Admin dont want to share information.
198
+ * @param array $params
199
+ * @return array $params
200
+ * @since 3.9
201
  */
202
  public static function wcal_get_data_for_opt_out( $params ){
203
 
215
 
216
  /**
217
  * Get WordPress related data.
218
+ * @return array $wp_data
219
+ * @since 3.9
220
  */
221
  private static function wcal_ts_get_wordpress_info() {
222
  $wp_data = array();
238
  }
239
 
240
  /**
241
+ * Get the current theme information, theme name and version.
242
  * @return array
243
+ * @since 3.9
244
  */
245
  public static function wcal_ts_get_theme_info() {
246
  $theme_data = wp_get_theme();
252
  }
253
 
254
  /**
255
+ * Get server related information.
256
+ * @return array $server_data
257
+ * @globals mixed $wpdb
258
+ * @since 3.9
259
  */
260
  private static function wcal_ts_get_server_info() {
261
  $server_data = array();
288
  }
289
 
290
  /**
291
+ * Get all plugins grouped into activated or deactivated.
292
+ * @return array $active_plugins
293
+ * @return array $plugins
294
+ * @since 3.9
295
  */
296
  private static function wcal_ts_get_all_plugins() {
297
  // Ensure get_plugins function is loaded
333
 
334
  /**
335
  * Get abandoned orders counts.
336
+ * @globals mixed $wpdb
337
+ * @return string | int $wcal_order_count
338
+ * @since 3.9
339
  */
340
  private static function wcal_ts_get_abandoned_order_counts() {
341
  global $wpdb;
359
 
360
  /**
361
  * Get recovered orders counts.
362
+ * @globals mixed $wpdb
363
+ * @return string | int $wcal_recovered_order_count
364
+ * @since 3.9
365
  */
366
  private static function wcal_ts_get_recovered_order_counts(){
367
 
380
  return $wcal_recovered_order_count;
381
  }
382
 
383
+ /**
384
+ * Get Total abandoned orders amount.
385
+ * @globals mixed $wpdb
386
+ * @return string | int $wcal_abandoned_orders_amount
387
+ * @since 3.9
388
+ */
389
  private static function wcal_ts_get_abandoned_order_total_amount(){
390
  global $wpdb;
391
  $wcal_abandoned_orders_amount = 0;
407
  return $wcal_abandoned_orders_amount;
408
  }
409
 
410
+ /**
411
+ * Get Total abandoned orders amount.
412
+ * @globals mixed $wpdb
413
+ * @param array | object $wcal_abandoned_query_result
414
+ * @return string | int $wcal_abandoned_orders_amount
415
+ * @since 3.9
416
+ */
417
  private static function wcal_get_abandoned_amount( $wcal_abandoned_query_result ){
418
 
419
  $wcal_abandoned_orders_amount = 0;
439
  return $wcal_abandoned_orders_amount;
440
  }
441
 
442
+ /**
443
+ * Get recovered orders total amount.
444
+ * @globals mixed $wpdb
445
+ * @return string | int $wcal_recovered_orders_amount
446
+ * @since 3.9
447
+ */
448
+ private static function wcal_ts_get_recovered_order_total_amount() {
449
 
450
  global $wpdb;
451
  $wcal_recovered_orders_amount = 0;
464
  return $wcal_recovered_orders_amount;
465
  }
466
 
467
+ /**
468
+ * Get recovered orders total amount.
469
+ * @globals mixed $wpdb
470
+ * @param array | object $wcal_data
471
+ * @return string | int $wcal_recovered_orders_amount
472
+ * @since 3.9
473
+ */
474
+
475
  private static function wcal_get_recovered_amount ( $wcal_data ){
476
 
477
  $wcal_recovered_orders_amount = 0;
484
  return $wcal_recovered_orders_amount;
485
  }
486
 
487
+ /**
488
+ * Get sent email total count.
489
+ * @globals mixed $wpdb
490
+ * @return string | int $wcal_sent_emails_count
491
+ * @since 3.9
492
+ */
493
  private static function wcal_ts_get_sent_emails_total_count(){
494
 
495
  global $wpdb;
499
  return $wcal_sent_emails_count;
500
  }
501
 
502
+ /**
503
+ * Get email templates total count.
504
+ * @globals mixed $wpdb
505
+ * @return array $wcal_templates_data
506
+ * @since 3.9
507
+ */
508
  private static function wcal_ts_get_email_templates_data(){
509
 
510
  global $wpdb;
533
  return $wcal_templates_data;
534
  }
535
 
536
+ /**
537
+ * Get logged-in users total abandoned count.
538
+ * @globals mixed $wpdb
539
+ * @return string | int $wcal_logged_in_user_query_count
540
+ * @since 3.9
541
+ */
542
  private static function wcal_ts_get_logged_in_users_abandoned_cart_total_count (){
543
 
544
  global $wpdb;
559
  return $wcal_logged_in_user_query_count;
560
  }
561
 
562
+ /**
563
+ * Get Guest users total abandoned count.
564
+ * @globals mixed $wpdb
565
+ * @return string | int $wcal_guest_user_query_count
566
+ * @since 3.9
567
+ */
568
  private static function wcal_ts_get_guest_users_abandoned_cart_total_count(){
569
  global $wpdb;
570
  $wcal_guest_user_query_count = 0;
584
  return $wcal_guest_user_query_count;
585
  }
586
 
587
+ /**
588
+ * Get logged-in users total abandoned amount.
589
+ * @globals mixed $wpdb
590
+ * @return string | int $wcal_abandoned_orders_amount
591
+ * @since 3.9
592
+ */
593
  private static function wcal_ts_get_logged_in_users_abandoned_cart_total_amount (){
594
 
595
  global $wpdb;
612
  return $wcal_abandoned_orders_amount;
613
  }
614
 
615
+ /**
616
+ * Get Guest users total abandoned amount.
617
+ * @globals mixed $wpdb
618
+ * @return string | int $wcal_abandoned_orders_amount
619
+ * @since 3.9
620
+ */
621
  private static function wcal_ts_get_guest_users_abandoned_cart_total_amount (){
622
 
623
  global $wpdb;
640
  return $wcal_abandoned_orders_amount;
641
  }
642
 
643
+ /**
644
+ * Get logged-in users total recovered amount.
645
+ * @globals mixed $wpdb
646
+ * @return string | int $wcal_recovered_orders_amount
647
+ * @since 3.9
648
+ */
649
  private static function wcal_ts_get_logged_in_users_recovered_cart_total_amount(){
650
 
651
  global $wpdb;
667
  }
668
 
669
 
670
+ /**
671
+ * Get Guest users total recovered amount.
672
+ * @globals mixed $wpdb
673
+ * @return string | int $wcal_recovered_orders_amount
674
+ * @since 3.9
675
+ */
676
  private static function wcal_ts_get_guest_users_recovered_cart_total_amount (){
677
 
678
  global $wpdb;
693
 
694
  }
695
  /**
696
+ * Get all options of the plugin.
697
  * @return array
698
+ * @since 3.9
699
  */
700
  private static function wcal_ts_get_all_plugin_options_values() {
701
 
706
  );
707
  }
708
 
709
+ /**
710
+ * Get WooCommerce version.
711
+ * @return string | int
712
+ * @since 3.9
713
+ */
714
  private static function wcal_ts_get_wc_plugin_version() {
715
  return WC()->version;
716
  }
717
 
718
+ /**
719
+ * Get License Key for the plugin.
720
+ * @return string
721
+ * @since 3.9
722
+ */
723
  private static function wcal_ts_get_plugin_license_key() {
724
  return 'Abandoned Cart Lite';
725
  }
726
 
727
+ /**
728
+ * Get the plugin version.
729
+ * @return string | int $wcal_plugin_version
730
+ * @since 3.9
731
+ */
732
  private static function wcal_ts_get_plugin_version() {
733
  $wcal_plugin_version = self::wcal_plugin_get_version();
734
  return $wcal_plugin_version;
735
  }
736
 
737
  /**
738
+ * Get the plugin version.
739
+ * @return string | int $plugin_version
740
+ * @since 3.9
741
  */
 
742
  public static function wcal_plugin_get_version() {
 
 
743
  $plugin_path = dirname ( dirname ( dirname ( __FILE__ ) ) ) ;
744
  $plugin_path_with_base_file_name = $plugin_path . "/woocommerce-ac.php";
745
  $plugin_data = get_plugin_data( $plugin_path_with_base_file_name );
woocommerce-abandoned-cart/includes/wcal-common.php CHANGED
@@ -1,6 +1,24 @@
1
  <?php
 
 
 
 
 
 
2
 
3
- class wcal_common {
 
 
 
 
 
 
 
 
 
 
 
 
4
  public static function wcal_get_abandoned_order_count( $get_section_result ){
5
  global $wpdb;
6
  $return_abandoned_count = 0;
@@ -43,6 +61,8 @@ class wcal_common {
43
 
44
  /**
45
  * This function returns the Abandoned Cart Lite plugin version number.
 
 
46
  */
47
  public static function wcal_get_version() {
48
  $plugin_version = '';
@@ -57,10 +77,59 @@ class wcal_common {
57
  }
58
 
59
  /**
60
- * This function returns the plugin url
 
 
61
  */
62
  public static function wcal_get_plugin_url() {
63
  return plugins_url() . '/woocommerce-abandoned-cart/';
64
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  }
66
  ?>
1
  <?php
2
+ /**
3
+ * Abandoned Cart Lite for WooCommerce
4
+ *
5
+ * @author Tyche Softwares
6
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Common-Functions
7
+ */
8
 
9
+ /**
10
+ * It will have all the common funtions for the plugin.
11
+ * @since 2.5.2
12
+ */
13
+ class wcal_common {
14
+
15
+ /**
16
+ * It will fetch the total count for the abandoned cart section.
17
+ * @param string $get_section_result Name of the section for which we need result
18
+ * @return string | int $return_abandoned_count
19
+ * @globals mixed $wpdb
20
+ * @since 2.5.2
21
+ */
22
  public static function wcal_get_abandoned_order_count( $get_section_result ){
23
  global $wpdb;
24
  $return_abandoned_count = 0;
61
 
62
  /**
63
  * This function returns the Abandoned Cart Lite plugin version number.
64
+ * @return string $plugin_version
65
+ * @since 2.5.2
66
  */
67
  public static function wcal_get_version() {
68
  $plugin_version = '';
77
  }
78
 
79
  /**
80
+ * This function returns the plugin url.
81
+ * @return string plugin url
82
+ * @since 2.5.2
83
  */
84
  public static function wcal_get_plugin_url() {
85
  return plugins_url() . '/woocommerce-abandoned-cart/';
86
  }
87
+
88
+ /**
89
+ * This function will alter Email Templates Table to include emojis
90
+ *
91
+ * @return bool true if success else false
92
+ *
93
+ * @since 4.8
94
+ */
95
+ public static function update_templates_table(){
96
+
97
+ global $wpdb;
98
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
99
+
100
+ $query = "ALTER TABLE " . $wpdb->prefix . "ac_email_templates_lite" . " CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci";
101
+
102
+ return $wpdb->query( $query );
103
+ }
104
+
105
+ /**
106
+ * This function will show a dismissible success message after DB update is completed
107
+ *
108
+ * @since 4.8
109
+ */
110
+ public static function show_update_success() {
111
+ ?>
112
+
113
+ <div class="notice notice-success is-dismissible">
114
+ <p><strong><?php _e( 'Database Updated Successfully', 'woocommerce-abandoned-cart');?></strong></p>
115
+ </div>
116
+
117
+ <?php
118
+ }
119
+
120
+ /**
121
+ * This function will show a dismissible success message after DB update is completed
122
+ *
123
+ * @since 4.8
124
+ */
125
+ public static function show_update_failure() {
126
+ ?>
127
+
128
+ <div class="notice notice-error is-dismissible">
129
+ <p><strong><?php _e( 'Database Update Failed. Please try again after sometime', 'woocommerce-abandoned-cart');?></strong></p>
130
+ </div>
131
+
132
+ <?php
133
+ }
134
  }
135
  ?>
woocommerce-abandoned-cart/includes/wcal_actions.php CHANGED
@@ -3,17 +3,23 @@
3
  if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
6
-
7
  /**
8
- * Trigger a abandoned cart Deletion
 
 
9
  *
 
 
10
  * @since 2.5.2
11
- * @param $abandoned_cart_id Arguments passed
12
- * @return void
13
  */
14
 
15
  class wcal_delete_bulk_action_handler {
16
-
 
 
 
 
 
17
  function wcal_delete_bulk_action_handler_function( $abandoned_cart_id ) {
18
  global $wpdb;
19
  $get_user_id = "SELECT user_id FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
@@ -33,6 +39,13 @@ class wcal_delete_bulk_action_handler {
33
  }
34
  wp_safe_redirect( admin_url( '/admin.php?page=woocommerce_ac_page&wcal_deleted=YES' ) );
35
  }
 
 
 
 
 
 
 
36
  function wcal_delete_template_bulk_action_handler_function( $template_id ) {
37
  global $wpdb;
38
  $id_remove = $template_id;
3
  if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
 
6
  /**
7
+ * Abandoned Cart Lite for WooCommerce
8
+ *
9
+ * It will handle the common action for the plugin.
10
  *
11
+ * @author Tyche Softwares
12
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Admin-Action
13
  * @since 2.5.2
 
 
14
  */
15
 
16
  class wcal_delete_bulk_action_handler {
17
+ /**
18
+ * Trigger when we delete the abandoned cart.
19
+ * @param int | string $abandoned_cart_id Abandoned cart id
20
+ * @globals mixed $wpdb
21
+ * @since 2.5.2
22
+ */
23
  function wcal_delete_bulk_action_handler_function( $abandoned_cart_id ) {
24
  global $wpdb;
25
  $get_user_id = "SELECT user_id FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite`
39
  }
40
  wp_safe_redirect( admin_url( '/admin.php?page=woocommerce_ac_page&wcal_deleted=YES' ) );
41
  }
42
+
43
+ /**
44
+ * Trigger when we delete the template.
45
+ * @param int | string $template_id Template id
46
+ * @globals mixed $wpdb
47
+ * @since 2.5.2
48
+ */
49
  function wcal_delete_template_bulk_action_handler_function( $template_id ) {
50
  global $wpdb;
51
  $id_remove = $template_id;
woocommerce-abandoned-cart/includes/wcal_admin_notice.php CHANGED
@@ -4,8 +4,19 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
6
 
 
 
 
 
 
 
 
7
  class Wcal_Admin_Notice {
8
 
 
 
 
 
9
  public static function wcal_pro_notice () {
10
 
11
  $wcal_activate_time = get_option ( 'wcal_activate_time' );
@@ -129,7 +140,8 @@ class Wcal_Admin_Notice {
129
  }
130
 
131
  /**
132
- * Ignore pro notice
 
133
  */
134
  public static function wcal_pro_notice_ignore() {
135
 
@@ -159,4 +171,31 @@ class Wcal_Admin_Notice {
159
  wp_safe_redirect( remove_query_arg( 'wcal_pro_fourth_notice_ignore' ) );
160
  }
161
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  }
4
  exit;
5
  }
6
 
7
+ /**
8
+ * It will display the admin notices for the pro version.
9
+ *
10
+ * @author Tyche Softwares
11
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Admin-Notice
12
+ */
13
+
14
  class Wcal_Admin_Notice {
15
 
16
+ /**
17
+ * It will display the four notices for the pro version of the plugin.
18
+ * @since 4.3
19
+ */
20
  public static function wcal_pro_notice () {
21
 
22
  $wcal_activate_time = get_option ( 'wcal_activate_time' );
140
  }
141
 
142
  /**
143
+ * When admin ignores the notice it will handle the functionality
144
+ * @since 4.3
145
  */
146
  public static function wcal_pro_notice_ignore() {
147
 
171
  wp_safe_redirect( remove_query_arg( 'wcal_pro_fourth_notice_ignore' ) );
172
  }
173
  }
174
+
175
+ /**
176
+ * Show a DB Update Notice when upgrading from 4.7 to latest version
177
+ *
178
+ * @since 4.8
179
+ *
180
+ * @hook admin_notices
181
+ */
182
+ public static function wcal_show_db_update_notice(){
183
+
184
+ if( isset( $_GET['ac_update'] ) && $_GET['ac_update'] == 'email_templates' ){
185
+ return;
186
+ }
187
+
188
+ global $wpdb;
189
+
190
+ $query_status = "SHOW FULL COLUMNS FROM " . $wpdb->prefix . "ac_email_templates_lite" . " WHERE Field = 'subject' OR Field = 'body'" ;
191
+
192
+ $results = $wpdb->get_results( $query_status );
193
+
194
+ foreach ( $results as $key => $value) {
195
+ if ( $value->Collation !== 'utf8mb4_unicode_ci' ) {
196
+ printf( __( '<div id="wcal_update" class="updated woocommerce-message" style="padding:15px;"><span>We need to update your email template database for some improvements. Please take a backup of your databases for your peice of mind</span><span class="submit"><a href="%s" class="button-primary" style="float:right;">Update</a></span></div>', 'woocommerce-abandoned-cart' ), 'admin.php?page=woocommerce_ac_page&action=listcart&ac_update=email_templates' );
197
+ break;
198
+ }
199
+ }
200
+ }
201
  }
woocommerce-abandoned-cart/includes/wcal_class-guest.php CHANGED
@@ -1,9 +1,20 @@
1
  <?php
2
- /*
3
- * Woocommerce Abandoned Cart Lite Plugin - Saves guest cart information
4
- */
 
 
 
 
 
 
5
  if ( ! class_exists( 'woocommerce_guest_ac' ) ) {
6
 
 
 
 
 
 
7
  class woocommerce_guest_ac {
8
  var $a;
9
  public function __construct() {
@@ -12,15 +23,23 @@ if ( ! class_exists( 'woocommerce_guest_ac' ) ) {
12
  add_filter( 'woocommerce_checkout_fields', 'guest_checkout_fields' );
13
  }
14
  }
15
- /*-----------------------------------------------------------------------------------*/
16
- /* Class Functions */
17
- /*-----------------------------------------------------------------------------------*/
 
 
 
18
  function load_ac_ajax() {
19
  if ( ! is_user_logged_in() ) {
20
  add_action( 'wp_ajax_nopriv_save_data', 'save_data' );
21
  }
22
  }
23
 
 
 
 
 
 
24
  function user_side_js() {
25
  ?>
26
  <script type="text/javascript">
@@ -57,6 +76,13 @@ if ( ! class_exists( 'woocommerce_guest_ac' ) ) {
57
  <?php
58
  }
59
 
 
 
 
 
 
 
 
60
  function save_data() {
61
  if ( ! is_user_logged_in() ) {
62
  if( session_id() === '' ) {
@@ -236,6 +262,13 @@ if ( ! class_exists( 'woocommerce_guest_ac' ) ) {
236
  }
237
  }
238
 
 
 
 
 
 
 
 
239
  function guest_checkout_fields( $fields ) {
240
  if ( isset( $_SESSION['guest_first_name'] ) && $_SESSION['guest_first_name'] != "" ) {
241
  $_POST['billing_first_name'] = $_SESSION['guest_first_name'];
1
  <?php
2
+ /**
3
+ * Abandoned Cart Lite for WooCommerce
4
+ *
5
+ * It will capture the guest users data.
6
+ *
7
+ * @author Tyche Softwares
8
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Frontend/Capture-Guest-Cart
9
+ */
10
+
11
  if ( ! class_exists( 'woocommerce_guest_ac' ) ) {
12
 
13
+ /**
14
+ * It will add the js, ajax for capturing the guest cart.
15
+ * It will add an action for populating the guest data when user comes from the abandoned cart reminder emails.
16
+ * @since 2.2
17
+ */
18
  class woocommerce_guest_ac {
19
  var $a;
20
  public function __construct() {
23
  add_filter( 'woocommerce_checkout_fields', 'guest_checkout_fields' );
24
  }
25
  }
26
+
27
+ /**
28
+ * It will add the ajax for capturing the guest record.
29
+ * @hook init
30
+ * @since 2.2
31
+ */
32
  function load_ac_ajax() {
33
  if ( ! is_user_logged_in() ) {
34
  add_action( 'wp_ajax_nopriv_save_data', 'save_data' );
35
  }
36
  }
37
 
38
+ /**
39
+ * It will add the js for capturing the guest cart.
40
+ * @hook woocommerce_after_checkout_billing_form
41
+ * @since 2.2
42
+ */
43
  function user_side_js() {
44
  ?>
45
  <script type="text/javascript">
76
  <?php
77
  }
78
 
79
+ /**
80
+ * It will add the guest users data in the database.
81
+ * @hook wp_ajax_nopriv_save_data
82
+ * @globals mixed $wpdb
83
+ * @globals mixed $woocommerce
84
+ * @since 2.2
85
+ */
86
  function save_data() {
87
  if ( ! is_user_logged_in() ) {
88
  if( session_id() === '' ) {
262
  }
263
  }
264
 
265
+ /**
266
+ * It will populate the data on the chekout field if user comes from the abandoned cart reminder emails.
267
+ * @hook woocommerce_checkout_fields
268
+ * @param array $fields All fields of checkout page
269
+ * @return array $fields
270
+ * @since 2.2
271
+ */
272
  function guest_checkout_fields( $fields ) {
273
  if ( isset( $_SESSION['guest_first_name'] ) && $_SESSION['guest_first_name'] != "" ) {
274
  $_POST['billing_first_name'] = $_SESSION['guest_first_name'];
woocommerce-abandoned-cart/includes/wcal_default-settings.php CHANGED
@@ -1,8 +1,21 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
2
  class wcal_default_template_settings {
3
- /* This function will load default template while activating the plugin.
4
- *
5
- * @since: AFter 2.5 version
 
 
6
  */
7
  function wcal_create_default_templates() {
8
  global $wpdb;
1
  <?php
2
+
3
+ /**
4
+ * Abandoned Cart Lite for WooCommerce
5
+ *
6
+ * It will add the default template for the plugin.
7
+ *
8
+ * @author Tyche Softwares
9
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Default-Template
10
+ * @since 2.5
11
+ */
12
+
13
  class wcal_default_template_settings {
14
+
15
+ /**
16
+ * This function will load default template while activating the plugin.
17
+ * @globals mixed $wpdb
18
+ * @since 2.5
19
  */
20
  function wcal_create_default_templates() {
21
  global $wpdb;
woocommerce-abandoned-cart/includes/wcal_ts_tracking.php CHANGED
@@ -1,6 +1,24 @@
1
  <?php
 
 
 
 
 
 
 
 
 
2
  include_once( 'classes/class-wcal-ts-tracker.php' );
 
 
 
 
 
3
  class Wcal_TS_Tracking {
 
 
 
 
4
  public function __construct() {
5
  //Tracking Data
6
  add_action( 'admin_notices', array( &$this, 'wcal_track_usage_data' ), 10 );
@@ -8,12 +26,18 @@ class Wcal_TS_Tracking {
8
  add_action( 'wp_ajax_wcal_admin_notices', array( &$this, 'wcal_admin_notices' ) );
9
  }
10
 
 
 
 
 
11
  public static function wcal_admin_notices_scripts() {
12
-
13
-
14
- wp_enqueue_script( 'wcal_admin_dismissal_notice', plugins_url() . '/woocommerce-abandoned-cart/assets/js/wcal_ts_dismiss_notice.js' );
15
  }
16
 
 
 
 
 
17
  public static function wcal_admin_notices() {
18
  Class_Wcal_Ts_Tracker::wcal_ts_send_tracking_data( false );
19
  update_option( 'wcal_allow_tracking', 'dismissed' );
@@ -21,7 +45,8 @@ class Wcal_TS_Tracking {
21
  }
22
 
23
  /**
24
- * Actions on the final step.
 
25
  */
26
  private function wcal_ts_tracking_actions() {
27
 
@@ -37,8 +62,9 @@ class Wcal_TS_Tracking {
37
  }
38
 
39
  /**
40
- * Data Usage tracking notice
41
- */
 
42
  function wcal_track_usage_data() {
43
  $wcal_admin_url = get_admin_url();
44
  echo '<input type="hidden" id="admin_url" value="' . $wcal_admin_url . '"/>';
1
  <?php
2
+ /**
3
+ * Abandoned Cart Lite for WooCommerce
4
+ *
5
+ * It will manage the tracking of the plugin data.
6
+ *
7
+ * @author Tyche Softwares
8
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Tracking-Data
9
+ */
10
+
11
  include_once( 'classes/class-wcal-ts-tracker.php' );
12
+
13
+ /**
14
+ * It will have all the data for tracking the data.
15
+ * @since 3.9
16
+ */
17
  class Wcal_TS_Tracking {
18
+ /**
19
+ * It will add all the necessary action for tracking the data.
20
+ * @since 3.9
21
+ */
22
  public function __construct() {
23
  //Tracking Data
24
  add_action( 'admin_notices', array( &$this, 'wcal_track_usage_data' ), 10 );
26
  add_action( 'wp_ajax_wcal_admin_notices', array( &$this, 'wcal_admin_notices' ) );
27
  }
28
 
29
+ /**
30
+ * It will add the js for dismissible notice.
31
+ * @since 3.9
32
+ */
33
  public static function wcal_admin_notices_scripts() {
34
+ wp_enqueue_script( 'wcal_admin_dismissal_notice', plugins_url() . '/woocommerce-abandoned-cart/assets/js/wcal_ts_dismiss_notice.js' );
 
 
35
  }
36
 
37
+ /**
38
+ * It will the admin notice.
39
+ * @since 3.9
40
+ */
41
  public static function wcal_admin_notices() {
42
  Class_Wcal_Ts_Tracker::wcal_ts_send_tracking_data( false );
43
  update_option( 'wcal_allow_tracking', 'dismissed' );
45
  }
46
 
47
  /**
48
+ * It will check the selected admin action it will be either allow or not allow.
49
+ * @since 3.9
50
  */
51
  private function wcal_ts_tracking_actions() {
52
 
62
  }
63
 
64
  /**
65
+ * It will add the notice on the admin side.
66
+ * @since 3.9
67
+ */
68
  function wcal_track_usage_data() {
69
  $wcal_admin_url = get_admin_url();
70
  echo '<input type="hidden" id="admin_url" value="' . $wcal_admin_url . '"/>';
woocommerce-abandoned-cart/includes/welcome.php CHANGED
@@ -1,23 +1,19 @@
1
  <?php
2
 
3
- /**
4
- * Abandoned Cart Lite Welcome Page Class
5
- *
6
- * Displays on plugin activation
7
- */
8
-
9
  // Exit if accessed directly.
10
  if ( ! defined( 'ABSPATH' ) ) {
11
  exit;
12
  }
13
 
14
  /**
15
- * Wcal_Welcome Class
16
  *
17
- * A general class for About page.
18
  *
19
- * @since 4.5
 
20
  */
 
21
  class Wcal_Welcome {
22
 
23
  /**
@@ -26,8 +22,7 @@ class Wcal_Welcome {
26
  public $minimum_capability = 'manage_options';
27
 
28
  /**
29
- * Get things started
30
- *
31
  * @since 4.5
32
  */
33
  public function __construct() {
@@ -44,15 +39,12 @@ class Wcal_Welcome {
44
  /**
45
  * Register the Dashboard Page which is later hidden but this pages
46
  * is used to render the Welcome page.
47
- *
48
- * @access public
49
  * @since 4.5
50
- * @return void
51
  */
52
  public function admin_menus() {
53
  $display_version = WCAL_VERSION;
54
 
55
- // About Page
56
  add_dashboard_page(
57
  sprintf( esc_html__( 'Welcome to Abandoned Cart Lite %s', 'woocommerce-abandoned-cart' ), $display_version ),
58
  esc_html__( 'Welcome to Abandoned Cart Lite', 'woocommerce-abandoned-cart' ),
@@ -64,22 +56,16 @@ class Wcal_Welcome {
64
  }
65
 
66
  /**
67
- * Hide Individual Dashboard Pages
68
- *
69
- * @access public
70
  * @since 4.5
71
- * @return void
72
  */
73
  public function admin_head() {
74
  remove_submenu_page( 'index.php', 'wcal-about' );
75
  }
76
 
77
  /**
78
- * Render About Screen
79
- *
80
- * @access public
81
  * @since 4.5
82
- * @return void
83
  */
84
  public function about_screen() {
85
  $display_version = WCAL_VERSION;
@@ -232,13 +218,13 @@ class Wcal_Welcome {
232
  </div>
233
 
234
 
235
- <div class="content feature-section-item">
236
 
237
  <h3><?php esc_html_e( 'Current Offers', 'woocommerce-abandoned-cart' ); ?></h3>
238
 
239
  <p>Buy all our <a href="https://tychesoftwares.com/premium-plugins/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank">premium plugins</a> at 30% off till 31st December 2017</p>
240
 
241
- </div>
242
 
243
  </div>
244
  <!-- /.feature-section -->
@@ -267,9 +253,10 @@ class Wcal_Welcome {
267
 
268
 
269
  /**
270
- * Social Media Like Buttons
271
  *
272
- * Various social media elements to Tyche Softwares
 
273
  */
274
  public function social_media_elements() { ?>
275
 
@@ -306,11 +293,7 @@ class Wcal_Welcome {
306
  /**
307
  * Sends user to the Welcome page on first activation of Abandoned Cart Lite as well as each
308
  * time Abandoned Cart Lite is upgraded to a new version
309
- *
310
- * @access public
311
  * @since 4.5
312
- *
313
- * @return void
314
  */
315
  public function welcome() {
316
 
1
  <?php
2
 
 
 
 
 
 
 
3
  // Exit if accessed directly.
4
  if ( ! defined( 'ABSPATH' ) ) {
5
  exit;
6
  }
7
 
8
  /**
9
+ * Abandoned Cart Lite for WooCommerce
10
  *
11
+ * Displays on plugin activation.
12
  *
13
+ * @author Tyche Softwares
14
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Welcome-Page
15
  */
16
+
17
  class Wcal_Welcome {
18
 
19
  /**
22
  public $minimum_capability = 'manage_options';
23
 
24
  /**
25
+ * It will add all the action for welcome page.
 
26
  * @since 4.5
27
  */
28
  public function __construct() {
39
  /**
40
  * Register the Dashboard Page which is later hidden but this pages
41
  * is used to render the Welcome page.
 
 
42
  * @since 4.5
 
43
  */
44
  public function admin_menus() {
45
  $display_version = WCAL_VERSION;
46
 
47
+ // Welcome Page
48
  add_dashboard_page(
49
  sprintf( esc_html__( 'Welcome to Abandoned Cart Lite %s', 'woocommerce-abandoned-cart' ), $display_version ),
50
  esc_html__( 'Welcome to Abandoned Cart Lite', 'woocommerce-abandoned-cart' ),
56
  }
57
 
58
  /**
59
+ * Hide Individual Dashboard Pages.
 
 
60
  * @since 4.5
 
61
  */
62
  public function admin_head() {
63
  remove_submenu_page( 'index.php', 'wcal-about' );
64
  }
65
 
66
  /**
67
+ * Render Welcome Screen.
 
 
68
  * @since 4.5
 
69
  */
70
  public function about_screen() {
71
  $display_version = WCAL_VERSION;
218
  </div>
219
 
220
 
221
+ <!-- <div class="content feature-section-item">
222
 
223
  <h3><?php esc_html_e( 'Current Offers', 'woocommerce-abandoned-cart' ); ?></h3>
224
 
225
  <p>Buy all our <a href="https://tychesoftwares.com/premium-plugins/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=AbandonedCartLitePlugin" target="_blank">premium plugins</a> at 30% off till 31st December 2017</p>
226
 
227
+ </div> -->
228
 
229
  </div>
230
  <!-- /.feature-section -->
253
 
254
 
255
  /**
256
+ * Social Media Like Buttons.
257
  *
258
+ * Various social media elements to Tyche Softwares.
259
+ * @since 4.5
260
  */
261
  public function social_media_elements() { ?>
262
 
293
  /**
294
  * Sends user to the Welcome page on first activation of Abandoned Cart Lite as well as each
295
  * time Abandoned Cart Lite is upgraded to a new version
 
 
296
  * @since 4.5
 
 
297
  */
298
  public function welcome() {
299
 
woocommerce-abandoned-cart/readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: ashokrane, pinal.shah, bhavik.kiri, chetnapatel, tychesoftwares
4
  Tags: abandon cart, cart recovery, increase woocommerce conversion rate , recover woocommerce cart, increase sales with woocommerce
5
  Author URI: https://www.tychesoftwares.com/
6
  Requires at least: 1.3
7
- Tested up to: 4.9.4
8
  Stable tag: trunk
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -188,18 +188,19 @@ You can refer **[here](https://www.tychesoftwares.com/differences-between-pro-an
188
 
189
  == Changelog ==
190
 
191
- = 4.7 (16.02-2018) =
 
192
 
193
-
194
- *
195
- This version has 2 bug fixes.
196
-
197
 
 
198
 
199
- * Bug Fixed - Due to the introduction of language packs through translate.wordpress.org, our plugin was not prepared for localization. So, we changed textdomain from "woocommerce-ac" to "woocommerce-abandoned-cart".
 
 
 
200
 
201
-
202
- * Bug Fixed - Warning error messages had been displayed on Abandoned Orders tab and Recovered Orders tab with PHP 7.2. This issue has been fixed.
203
 
204
  = 4.6 (31.01-2018) =
205
 
@@ -215,7 +216,7 @@ This version has 2 bug fixes.
215
 
216
  * Bug Fixed - When the user places an order and goes to the order received page, blank carts were added in the database. So, twice entries had been created under Recovered Orders tab. This issue has been fixed.
217
 
218
- * Bug Fixed - If "Email admin On Order Recovery" setting is enabled and admin of the store create manual order from WooCommerce -> Orders page then Recovery Email was getting sent to the Admin. This has been fixed.
219
 
220
  * Bug Fixed - With the PHP 7.1.7, Abandoned cart reminder emails were not being sent. This issue has been fixed now.
221
 
4
  Tags: abandon cart, cart recovery, increase woocommerce conversion rate , recover woocommerce cart, increase sales with woocommerce
5
  Author URI: https://www.tychesoftwares.com/
6
  Requires at least: 1.3
7
+ Tested up to: 4.9.2
8
  Stable tag: trunk
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
188
 
189
  == Changelog ==
190
 
191
+ = 4.8 (20.03-2018) =
192
+ * This is a minor update to the plugin which contains some bug fixes and requires Database update to include emojis in the email templates. We recommend that you take a backup of the database of your store for your piece of mind.
193
 
194
+ * Bug Fixed - Fixed compatibility issues related to PHP 7.2 where error notices were being displayed on Abandoned Order List page
 
 
 
195
 
196
+ * Bug Fixed - Fixed issue related to saving email template where changes were not getting saved despite a success message.
197
 
198
+ * Additonal Changes - PHP Doc blocks added for generating documentation and readability
199
+
200
+ = 4.7 (16.02-2018) =
201
+ * This version has 2 bug fixes.
202
 
203
+ * Bug Fixed - Due to the introduction of language packs through translate.wordpress.org, our plugin was not prepared for localization. So, we changed textdomain from "woocommerce-ac" to "woocommerce-abandoned-cart".
 
204
 
205
  = 4.6 (31.01-2018) =
206
 
216
 
217
  * Bug Fixed - When the user places an order and goes to the order received page, blank carts were added in the database. So, twice entries had been created under Recovered Orders tab. This issue has been fixed.
218
 
219
+ * Bug Fixed - If "Email admin On Order Recovery" setting is enabled and admin of the store create manual order from WooCommerce -> Orders page then Recovery Email was getting sent to the Admin. This has been fixed.
220
 
221
  * Bug Fixed - With the PHP 7.1.7, Abandoned cart reminder emails were not being sent. This issue has been fixed now.
222
 
woocommerce-abandoned-cart/views/wcal-email-template-preview.php CHANGED
@@ -5,6 +5,17 @@
5
  if ( ! defined( 'ABSPATH' ) ) {
6
  exit; // Exit if accessed directly
7
  }
 
 
 
 
 
 
 
 
 
 
 
8
  $current_time_stamp = current_time( 'timestamp' );
9
  $date_format = date_i18n( get_option( 'date_format' ), $current_time_stamp );
10
  $time_format = date_i18n( get_option( 'time_format' ), $current_time_stamp );
5
  if ( ! defined( 'ABSPATH' ) ) {
6
  exit; // Exit if accessed directly
7
  }
8
+
9
+ /**
10
+ * Abandoned Cart Lite for WooCommerce
11
+ *
12
+ * It will handle the common action for the plugin.
13
+ *
14
+ * @author Tyche Softwares
15
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Template-view
16
+ * @since 2.5.2
17
+ */
18
+
19
  $current_time_stamp = current_time( 'timestamp' );
20
  $date_format = date_i18n( get_option( 'date_format' ), $current_time_stamp );
21
  $time_format = date_i18n( get_option( 'time_format' ), $current_time_stamp );
woocommerce-abandoned-cart/views/wcal-wc-email-template-preview.php CHANGED
@@ -5,6 +5,16 @@
5
  if( ! defined( 'ABSPATH' ) ) {
6
  exit; // Exit if accessed directly
7
  }
 
 
 
 
 
 
 
 
 
 
8
  $current_time_stamp = current_time( 'timestamp' );
9
  $date_format = date_i18n( get_option( 'date_format' ), $current_time_stamp );
10
  $time_format = date_i18n( get_option( 'time_format' ), $current_time_stamp );
5
  if( ! defined( 'ABSPATH' ) ) {
6
  exit; // Exit if accessed directly
7
  }
8
+ /**
9
+ * Abandoned Cart Lite for WooCommerce
10
+ *
11
+ * It will handle the common action for the plugin.
12
+ *
13
+ * @author Tyche Softwares
14
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Template-view
15
+ * @since 2.5.2
16
+ */
17
+
18
  $current_time_stamp = current_time( 'timestamp' );
19
  $date_format = date_i18n( get_option( 'date_format' ), $current_time_stamp );
20
  $time_format = date_i18n( get_option( 'time_format' ), $current_time_stamp );
woocommerce-abandoned-cart/woocommerce-ac.php CHANGED
@@ -2,15 +2,19 @@
2
  /*
3
  * Plugin Name: Abandoned Cart Lite for WooCommerce
4
  * Plugin URI: http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro
5
- * Description: This plugin captures abandoned carts by logged-in users & emails them about it. <strong><a href="http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro">Click here to get the PRO Version.</a></strong>
6
- * Version: 4.7
 
 
7
  * Author: Tyche Softwares
8
  * Author URI: http://www.tychesoftwares.com/
9
  * Text Domain: woocommerce-abandoned-cart
10
  * Domain Path: /i18n/languages/
11
  * Requires PHP: 5.6
12
  * WC requires at least: 3.0.0
13
- * WC tested up to: 3.3.1
 
 
14
  */
15
 
16
  // Deletion Settings
@@ -36,6 +40,15 @@ if ( is_admin() ) {
36
  // Add a new interval of 15 minutes
37
  add_filter( 'cron_schedules', 'wcal_add_cron_schedule' );
38
 
 
 
 
 
 
 
 
 
 
39
  function wcal_add_cron_schedule( $schedules ) {
40
  $schedules['15_minutes_lite'] = array(
41
  'interval' => 900, // 15 minutes in seconds
@@ -43,13 +56,24 @@ function wcal_add_cron_schedule( $schedules ) {
43
  );
44
  return $schedules;
45
  }
46
- // Schedule an action if it's not already scheduled
 
 
 
 
 
47
  if ( ! wp_next_scheduled( 'woocommerce_ac_send_email_action' ) ) {
48
  wp_schedule_event( time(), '15_minutes_lite', 'woocommerce_ac_send_email_action' );
49
  }
50
 
51
  /**
52
- * Run a cron once in week to delete old records for lockout
 
 
 
 
 
 
53
  */
54
  function wcal_add_tracking_cron_schedule( $schedules ) {
55
  $schedules[ 'daily_once' ] = array(
@@ -59,20 +83,40 @@ function wcal_add_tracking_cron_schedule( $schedules ) {
59
  return $schedules;
60
  }
61
 
62
- /* To capture the data from the client site */
 
 
 
 
63
  if ( ! wp_next_scheduled( 'wcal_ts_tracker_send_event' ) ) {
64
  wp_schedule_event( time(), 'daily_once', 'wcal_ts_tracker_send_event' );
65
  }
66
 
67
- // Hook into that action that'll fire every 15 minutes
 
 
 
68
  add_action( 'woocommerce_ac_send_email_action', 'wcal_send_email_cron' );
69
 
 
 
 
 
 
 
70
  function wcal_send_email_cron() {
71
  //require_once( ABSPATH.'wp-content/plugins/woocommerce-abandoned-cart/cron/send_email.php' );
72
  $plugin_dir_path = plugin_dir_path( __FILE__ );
73
  require_once( $plugin_dir_path . 'cron/wcal_send_email.php' );
74
  }
75
 
 
 
 
 
 
 
 
76
  function woocommerce_ac_delete_lite() {
77
  global $wpdb;
78
  if ( ! is_multisite() ) {
@@ -163,7 +207,14 @@ function woocommerce_ac_delete_lite() {
163
  **/
164
  if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
165
 
166
- class woocommerce_abandon_cart_lite {
 
 
 
 
 
 
 
167
  var $one_hour;
168
  var $three_hours;
169
  var $six_hours;
@@ -172,7 +223,11 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
172
  var $one_week;
173
  var $duration_range_select = array();
174
  var $start_end_dates = array();
175
-
 
 
 
 
176
  public function __construct() {
177
  $this->one_hour = 60 * 60;
178
  $this->three_hours = 3 * $this->one_hour;
@@ -261,6 +316,7 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
261
 
262
  add_action( 'admin_notices', array( 'Wcal_Admin_Notice', 'wcal_pro_notice' ) );
263
  add_action( 'admin_init', array( 'Wcal_Admin_Notice', 'wcal_pro_notice_ignore' ) );
 
264
 
265
  /**
266
  * @since: 4.2
@@ -270,8 +326,8 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
270
  }
271
 
272
  /**
 
273
  * @since: 4.2
274
- * Check if WC is active or not.
275
  */
276
  public static function wcal_wc_check_ac_installed() {
277
 
@@ -283,8 +339,8 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
283
  }
284
 
285
  /**
 
286
  * @since: 4.2
287
- * Ensure that the Abandoned cart lite get deactivated when WC is deactivated.
288
  */
289
  public static function wcal_wc_check_compatibility() {
290
 
@@ -297,15 +353,12 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
297
  if ( isset( $_GET['activate'] ) ) {
298
  unset( $_GET['activate'] );
299
  }
300
-
301
  }
302
-
303
  }
304
  }
305
  /**
 
306
  * @since: 4.2
307
- * Display a notice in the admin Plugins page if the Abandoned cart lite is
308
- * activated while WC is deactivated.
309
  */
310
  public static function wcal_wc_disabled_notice() {
311
 
@@ -314,7 +367,17 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
314
 
315
  printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
316
  }
317
-
 
 
 
 
 
 
 
 
 
 
318
  public static function wcal_order_placed( $order_id ) {
319
  if( session_id() === '' ) {
320
  //session has not started
@@ -396,9 +459,7 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
396
  if ( isset( $_SESSION['user_id'] ) && '' != $_SESSION['user_id'] ) {
397
  $wcal_user_id_of_guest = $_SESSION['user_id'];
398
  }
399
-
400
-
401
- /* delete the guest record. As it become the logged in user */
402
  $get_ac_id_guest_results = array();
403
  if ( isset( $wcal_user_id_of_guest ) && '' != $wcal_user_id_of_guest ) {
404
  $get_ac_id_guest_query = "SELECT id FROM `" . $wcal_history_table_name ."` WHERE user_id = %d ORDER BY id DESC";
@@ -409,7 +470,7 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
409
  $wpdb->delete( $wcal_history_table_name , array( 'id' => $abandoned_order_id_of_guest ) );
410
  }
411
 
412
- /* it is the new registered users cart id */
413
  if ( isset( $wcal_user_id_of_guest ) && '' != $wcal_user_id_of_guest ) {
414
  $wpdb->delete( $wcal_history_table_name , array( 'id' => $abandoned_cart_id_new_user ) );
415
  }
@@ -477,22 +538,24 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
477
  /* cart is declared as adandoned */
478
  add_post_meta( $order_id , 'wcal_recover_order_placed', $wcal_abandoned_cart_id );
479
  }else {
480
- /* cart order is placed within the cutoff time.
481
- we will delete that abandoned cart */
 
 
482
 
483
- /* if user becomes the registred user */
484
 
485
  if ( isset( $_POST['account_password'] ) && $_POST['account_password'] != '' ) {
486
 
487
  $abandoned_cart_id_new_user = $_SESSION['abandoned_cart_id_lite'];
488
  $wcal_user_id_of_guest = $_SESSION['user_id'];
489
 
490
- /* delete the guest record. As it become the logged in user */
491
 
492
  $wpdb->delete( $wcal_history_table_name , array( 'user_id' => $wcal_user_id_of_guest ) );
493
  $wpdb->delete( $wcal_guest_table_name , array( 'id' => $wcal_user_id_of_guest ) );
494
 
495
- /* it is the new registered users cart id */
496
  $wpdb->delete( $wcal_history_table_name , array( 'id' => $abandoned_cart_id_new_user ) );
497
  }else {
498
 
@@ -502,7 +565,7 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
502
  */
503
  $wpdb->delete( $wcal_history_table_name , array( 'id' => $wcap_abandoned_cart_id ) );
504
 
505
- /* this user id is set for the guest uesrs. */
506
  if ( isset( $_SESSION['user_id'] ) && $_SESSION['user_id'] != '' ) {
507
 
508
  $wcal_user_id_of_guest = $_SESSION['user_id'];
@@ -514,6 +577,18 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
514
  }
515
  }
516
 
 
 
 
 
 
 
 
 
 
 
 
 
517
  public function wcal_order_complete_action( $order_status, $order_id ) {
518
 
519
  /**
@@ -568,15 +643,13 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
568
  }
569
  }
570
  return $order_status;
571
- }
572
-
573
- /*-----------------------------------------------------------------------------------*/
574
- /* Class Functions */
575
- /*-----------------------------------------------------------------------------------*/
576
  /**
577
- * Preview email template
578
- *
579
- * @return string
 
580
  */
581
  public function wcal_preview_emails() {
582
  global $woocommerce;
@@ -627,7 +700,12 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
627
  }
628
  }
629
 
630
- // Language Translation
 
 
 
 
 
631
  function wcal_update_po_file() {
632
  /*
633
  * Due to the introduction of language packs through translate.wordpress.org, loading our textdomain is complex.
@@ -643,9 +721,12 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
643
  }
644
  }
645
 
646
- /*-----------------------------------------------------------------------------------*/
647
- /* Class Functions */
648
- /*-----------------------------------------------------------------------------------*/
 
 
 
649
  function wcal_activate() {
650
  global $wpdb;
651
  $wcap_collate = '';
@@ -655,12 +736,12 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
655
  $table_name = $wpdb->prefix . "ac_email_templates_lite";
656
  $sql = "CREATE TABLE IF NOT EXISTS $table_name (
657
  `id` int(11) NOT NULL AUTO_INCREMENT,
658
- `subject` text COLLATE utf8_unicode_ci NOT NULL,
659
- `body` mediumtext COLLATE utf8_unicode_ci NOT NULL,
660
- `is_active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL,
661
  `frequency` int(11) NOT NULL,
662
- `day_or_hour` enum('Days','Hours') COLLATE utf8_unicode_ci NOT NULL,
663
- `template_name` text COLLATE utf8_unicode_ci NOT NULL,
664
  PRIMARY KEY (`id`)
665
  ) $wcap_collate AUTO_INCREMENT=1 ";
666
 
@@ -673,7 +754,7 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
673
 
674
  if ( count( $results ) == 0 ) {
675
  $alter_template_table_query = "ALTER TABLE $table_name
676
- ADD COLUMN `is_wc_template` enum('0','1') COLLATE utf8_unicode_ci NOT NULL AFTER `template_name`,
677
  ADD COLUMN `default_template` int(11) NOT NULL AFTER `is_wc_template`";
678
 
679
  $wpdb->get_results( $alter_template_table_query );
@@ -777,9 +858,11 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
777
  }
778
  }
779
 
780
- /***************************************************************
781
- * WP Settings API
782
- **************************************************************/
 
 
783
  function wcal_initialize_plugin_options() {
784
 
785
  // First, we register a section. This is necessary since all future options must belong to a
@@ -816,9 +899,9 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
816
  'ac_lite_general_settings_section',
817
  array( __( 'Enable tracking of abandoned products & carts even if customer does not visit the checkout page or does not enter any details on the checkout page like Name or Email. Tracking will begin as soon as a visitor adds a product to their cart and visits the cart page.', 'woocommerce-abandoned-cart' ) )
818
  );
819
- /*
820
  * New section for the Adding the abandoned cart setting.
821
- * Since @: 4.7
822
  */
823
 
824
  add_settings_section(
@@ -886,16 +969,19 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
886
  );
887
  }
888
 
889
- /***************************************************************
890
- * WP Settings API callback for section
891
- **************************************************************/
 
892
  function ac_lite_general_options_callback() {
893
 
894
  }
895
 
896
- /***************************************************************
897
- * WP Settings API callback for cart time field
898
- **************************************************************/
 
 
899
  function ac_lite_cart_abandoned_time_callback( $args ) {
900
  // First, we read the option
901
  $cart_abandoned_time = get_option( 'ac_lite_cart_abandoned_time' );
@@ -910,9 +996,12 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
910
  echo $html;
911
  }
912
 
913
- /***************************************************************
914
- * WP Settings API cart time field validation
915
- **************************************************************/
 
 
 
916
  function ac_lite_cart_time_validation( $input ) {
917
  $output = '';
918
  if ( $input != '' && ( is_numeric( $input) && $input > 0 ) ) {
@@ -923,9 +1012,11 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
923
  return $output;
924
  }
925
 
926
- /***************************************************************
927
- * WP Settings API callback for email admin on cart recovery field
928
- **************************************************************/
 
 
929
  function ac_lite_email_admin_on_recovery( $args ) {
930
  // First, we read the option
931
  $email_admin_on_recovery = get_option( 'ac_lite_email_admin_on_recovery' );
@@ -946,10 +1037,11 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
946
  $html .= '<label for="ac_lite_email_admin_on_recovery"> ' . $args[0] . '</label>';
947
  echo $html;
948
  }
949
- /***************************************************************
950
- * @since : 2.7
951
- * WP Settings API callback for capturing guest cart which do not reach the checkout page.
952
- **************************************************************/
 
953
  function wcal_track_guest_cart_from_cart_page_callback( $args ) {
954
  // First, we read the option
955
  $disable_guest_cart_from_cart_page = get_option( 'ac_lite_track_guest_cart_from_cart_page' );
@@ -970,13 +1062,19 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
970
  echo $html;
971
  }
972
 
973
- /***************************************************************
974
- * WP Settings API callback for Abandoned cart email settings of the plugin
975
- **************************************************************/
 
976
  function wcal_email_callback () {
977
 
978
  }
979
 
 
 
 
 
 
980
  public static function wcal_from_name_callback( $args ) {
981
  // First, we read the option
982
  $wcal_from_name = get_option( 'wcal_from_name' );
@@ -991,6 +1089,11 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
991
  echo $html;
992
  }
993
 
 
 
 
 
 
994
  public static function wcal_from_email_callback( $args ) {
995
  // First, we read the option
996
  $wcal_from_email = get_option( 'wcal_from_email' );
@@ -1005,6 +1108,11 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1005
  echo $html;
1006
  }
1007
 
 
 
 
 
 
1008
  public static function wcal_reply_email_callback( $args ) {
1009
  // First, we read the option
1010
  $wcal_reply_email = get_option( 'wcal_reply_email' );
@@ -1018,9 +1126,13 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1018
  $html = '<label for="wcal_reply_email_label"> ' . $args[0] . '</label>';
1019
  echo $html;
1020
  }
1021
- /**************************************************
1022
- * This function is run when the plugin is upgraded
1023
- *************************************************/
 
 
 
 
1024
  function wcal_update_db_check() {
1025
  global $wpdb;
1026
 
@@ -1051,7 +1163,7 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1051
 
1052
  if ( count( $results_email ) == 0 ) {
1053
  $alter_email_template_table_query = "ALTER TABLE $table_name
1054
- ADD COLUMN `wc_email_header` varchar(50) COLLATE utf8_unicode_ci NOT NULL AFTER `default_template`";
1055
  $wpdb->get_results( $alter_email_template_table_query );
1056
  }
1057
 
@@ -1067,9 +1179,8 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1067
  }
1068
  }
1069
  /**
1070
- *
1071
- * This is used to prevent guest users wrong Id. If guest users id is less then 63000000 then this code will ensure that we
1072
- * will change the id of guest tables so it wont affect on the next guest users.
1073
  */
1074
  if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ac_guest_abandoned_cart_history_lite';" ) && 'yes' != get_option( 'wcal_guest_user_id_altered' ) ) {
1075
  $last_id = $wpdb->get_var( "SELECT max(id) FROM `{$wpdb->prefix}ac_guest_abandoned_cart_history_lite`;" );
@@ -1161,7 +1272,13 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1161
 
1162
  /**
1163
  * Send email to admin when cart is recovered only via PayPal.
1164
- * @since 2.9 version
 
 
 
 
 
 
1165
  */
1166
  public static function wcal_email_admin_recovery_for_paypal( $order_id, $old, $new_status ) {
1167
  if ( 'pending' == $old && 'processing' == $new_status ) {
@@ -1210,7 +1327,15 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1210
 
1211
  /**
1212
  * Send email to admin when cart is recovered via any other payment gateway other than PayPal.
1213
- * @since 2.3 version
 
 
 
 
 
 
 
 
1214
  */
1215
  function wcal_email_admin_recovery ( $order_id ) {
1216
  global $wpdb, $woocommerce;
@@ -1255,7 +1380,13 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1255
  }
1256
  }
1257
 
1258
- // For sending Recovery Email to Admin, we will check that order is recovered or not.
 
 
 
 
 
 
1259
  function wcal_check_order_is_recovered( $wcal_order_id ) {
1260
  global $wpdb;
1261
  $wcal_recover_order_query = "SELECT `recovered_cart` FROM `wp_ac_abandoned_cart_history_lite` WHERE `recovered_cart` = %d";
@@ -1266,12 +1397,22 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1266
  return false;
1267
  }
1268
 
1269
- // Add a submenu page.
 
 
 
 
1270
  function wcal_admin_menu() {
1271
  $page = add_submenu_page ( 'woocommerce', __( 'Abandoned Carts', 'woocommerce-abandoned-cart' ), __( 'Abandoned Carts', 'woocommerce-abandoned-cart' ), 'manage_woocommerce', 'woocommerce_ac_page', array( &$this, 'wcal_menu_page' ) );
1272
  }
1273
 
1274
- // Capture the cart and insert the information of the cart into DataBase
 
 
 
 
 
 
1275
  function wcal_store_cart_timestamp() {
1276
 
1277
  if( session_id() === '' ){
@@ -1407,8 +1548,7 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1407
  } else {
1408
  /**
1409
  * Here we capture the guest cart from the cart page.
1410
- * @since: 3.5
1411
- *
1412
  */
1413
  if ( $track_guest_user_cart_from_cart == "on" && $get_cookie[0] != '' ) {
1414
  $query = "SELECT * FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE session_id LIKE %s AND cart_ignored = '0' AND recovered_cart = '0' ";
@@ -1448,6 +1588,14 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1448
  }
1449
  }
1450
 
 
 
 
 
 
 
 
 
1451
  function wcal_email_unsubscribe( $args ) {
1452
  global $wpdb;
1453
 
@@ -1499,7 +1647,15 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1499
  }
1500
  }
1501
 
1502
- // It will track the URL of cart link from email
 
 
 
 
 
 
 
 
1503
  function wcal_email_track_links( $template ) {
1504
  global $woocommerce;
1505
  $track_link = '';
@@ -1578,7 +1734,12 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1578
  return $template;
1579
  }
1580
 
1581
- // load the information of the guest user
 
 
 
 
 
1582
  function wcal_load_guest_persistent_cart() {
1583
  if ( isset( $_SESSION['user_id'] ) && '' != $_SESSION['user_id'] ) {
1584
  global $woocommerce;
@@ -1638,6 +1799,13 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1638
  }
1639
  }
1640
 
 
 
 
 
 
 
 
1641
  function wcal_compare_only_guest_carts( $new_cart, $last_abandoned_cart ) {
1642
  $current_woo_cart = array();
1643
  $current_woo_cart = json_decode( stripslashes( $new_cart ), true );
@@ -1686,7 +1854,13 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1686
  return true;
1687
  }
1688
 
1689
- // Compare the existing cart with new cart
 
 
 
 
 
 
1690
  function wcal_compare_carts( $user_id, $last_abandoned_cart ) {
1691
  global $woocommerce;
1692
  $current_woo_cart = array();
@@ -1739,7 +1913,15 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1739
  return true;
1740
  }
1741
 
1742
- // function is call when order is recovered
 
 
 
 
 
 
 
 
1743
  function wcal_action_after_delivery_session( $order ) {
1744
 
1745
  if( session_id() === '' ){
@@ -1853,7 +2035,12 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1853
  }
1854
  }
1855
  }
1856
-
 
 
 
 
 
1857
  function wcal_action_admin_init() {
1858
 
1859
  // only hook up these filters if we're in the admin panel and the current user has permission
@@ -1878,18 +2065,36 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1878
  }
1879
  }
1880
 
 
 
 
 
 
 
 
1881
  function wcal_filter_mce_button( $buttons ) {
1882
  // add a separation before our button, here our button's id is &quot;mygallery_button&quot;
1883
  array_push( $buttons, 'abandoncart', '|' );
1884
  return $buttons;
1885
  }
1886
 
 
 
 
 
 
 
 
1887
  function wcal_filter_mce_plugin( $plugins ) {
1888
  // this plugin file will work the magic of our button
1889
  $plugins['abandoncart'] = plugin_dir_url( __FILE__ ) . 'assets/js/abandoncart_plugin_button.js';
1890
  return $plugins;
1891
  }
1892
 
 
 
 
 
1893
  function wcal_display_tabs() {
1894
 
1895
  if ( isset( $_GET['action'] ) ) {
@@ -1929,6 +2134,12 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1929
  <?php
1930
  }
1931
 
 
 
 
 
 
 
1932
  function wcal_enqueue_scripts_js( $hook ) {
1933
 
1934
  if ( $hook != 'woocommerce_page_woocommerce_ac_page' ) {
@@ -1966,7 +2177,14 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1966
  wp_enqueue_script( 'wcal_activate_template', plugins_url() . '/woocommerce-abandoned-cart/assets/js/wcal_template_activate.js' );
1967
  }
1968
  }
1969
-
 
 
 
 
 
 
 
1970
  function wcal_format_tiny_MCE( $in ) {
1971
  $in['force_root_block'] = false;
1972
  $in['valid_children'] = '+body[style]';
@@ -1992,6 +2210,12 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
1992
  return $in;
1993
  }
1994
 
 
 
 
 
 
 
1995
  function wcal_enqueue_scripts_css( $hook ) {
1996
  if ( $hook != 'woocommerce_page_woocommerce_ac_page' ) {
1997
  return;
@@ -2004,14 +2228,24 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
2004
 
2005
  }
2006
  }
2007
- //bulk action
2008
- // to over come the wp redirect warning while deleting
 
 
 
 
 
2009
  function wcal_app_output_buffer() {
2010
  ob_start();
2011
  }
2012
 
2013
  /**
2014
- * Abandon Cart Settings Page
 
 
 
 
 
2015
  */
2016
  function wcal_menu_page() {
2017
 
@@ -2025,6 +2259,16 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
2025
  <div class="wrap">
2026
  <h2><?php _e( 'WooCommerce - Abandon Cart Lite', 'woocommerce-abandoned-cart' ); ?></h2>
2027
  <?php
 
 
 
 
 
 
 
 
 
 
2028
 
2029
  if ( isset( $_GET['action'] ) ) {
2030
  $action = $_GET['action'];
@@ -2073,12 +2317,12 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
2073
  <div id="message" class="updated fade">
2074
  <p><strong><?php _e( 'The Abandoned cart has been successfully deleted.', 'woocommerce-abandoned-cart' ); ?></strong></p>
2075
  </div>
2076
- <?php }
2077
  if ( isset( $_GET ['wcal_template_deleted'] ) && 'YES' == $_GET['wcal_template_deleted'] ) { ?>
2078
  <div id="message" class="updated fade">
2079
  <p><strong><?php _e( 'The Template has been successfully deleted.', 'woocommerce-abandoned-cart' ); ?></strong></p>
2080
  </div>
2081
- <?php }
2082
  if ( $action == 'emailsettings' ) {
2083
  // Save the field values
2084
  ?>
@@ -2348,7 +2592,7 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
2348
  <?php
2349
  }
2350
 
2351
- if ( isset( $_POST['ac_settings_frm'] ) && $_POST['ac_settings_frm'] == 'update' && isset($update_template_successfuly) && $update_template_successfuly >= 0 ) { ?>
2352
  <div id="message" class="updated fade">
2353
  <p>
2354
  <strong>
@@ -3092,6 +3336,13 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
3092
  }
3093
  }
3094
 
 
 
 
 
 
 
 
3095
  function wcal_admin_footer_text( $footer_text ) {
3096
 
3097
  if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'woocommerce_ac_page' ) {
@@ -3106,6 +3357,13 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
3106
  return $footer_text;
3107
  }
3108
 
 
 
 
 
 
 
 
3109
  function bubble_sort_function( $unsort_array, $order ) {
3110
  $temp = array();
3111
  foreach ( $unsort_array as $key => $value )
@@ -3120,7 +3378,12 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
3120
  unset( $temp );
3121
  return $array;
3122
  }
3123
-
 
 
 
 
 
3124
  function wcal_action_send_preview() {
3125
  ?>
3126
  <script type="text/javascript" >
@@ -3163,9 +3426,16 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
3163
  });
3164
  });
3165
  });
3166
- </script>
3167
  <?php
3168
  }
 
 
 
 
 
 
 
3169
  public static function wcal_toggle_template_status () {
3170
  global $wpdb;
3171
  $template_id = $_POST['wcal_template_id'];
@@ -3206,7 +3476,11 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
3206
  wp_die();
3207
 
3208
  }
3209
- // Send Test Email
 
 
 
 
3210
  function wcal_preview_email_sent() {
3211
  if ( '' != $_POST['body_email_preview'] ) {
3212
  $from_email_name = get_option ( 'wcal_from_name' );
@@ -3333,7 +3607,7 @@ if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
3333
  echo "not sent";
3334
  die();
3335
  }
3336
- }
3337
  }
3338
  }
3339
  $woocommerce_abandon_cart = new woocommerce_abandon_cart_lite();
2
  /*
3
  * Plugin Name: Abandoned Cart Lite for WooCommerce
4
  * Plugin URI: http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro
5
+ * Description: This plugin captures abandoned carts by logged-in users & emails them about it.
6
+ * <strong><a href="http://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro">Click here to get the
7
+ * PRO Version.</a></strong>
8
+ * Version: 4.8
9
  * Author: Tyche Softwares
10
  * Author URI: http://www.tychesoftwares.com/
11
  * Text Domain: woocommerce-abandoned-cart
12
  * Domain Path: /i18n/languages/
13
  * Requires PHP: 5.6
14
  * WC requires at least: 3.0.0
15
+ * WC tested up to: 3.2.0
16
+ *
17
+ * @package Abandoned-Cart-Lite-for-WooCommerce
18
  */
19
 
20
  // Deletion Settings
40
  // Add a new interval of 15 minutes
41
  add_filter( 'cron_schedules', 'wcal_add_cron_schedule' );
42
 
43
+ /**
44
+ * It will add a cron job for sending the Abandonend cart reminder emails.
45
+ * By default it will set 15 minutes of interval.
46
+ * @hook cron_schedules
47
+ * @param array $schedules
48
+ * @return array $schedules
49
+ * @since 1.3
50
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Cron
51
+ */
52
  function wcal_add_cron_schedule( $schedules ) {
53
  $schedules['15_minutes_lite'] = array(
54
  'interval' => 900, // 15 minutes in seconds
56
  );
57
  return $schedules;
58
  }
59
+
60
+ /**
61
+ * Schedule an action if it's not already scheduled.
62
+ * @since 1.3
63
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Cron
64
+ */
65
  if ( ! wp_next_scheduled( 'woocommerce_ac_send_email_action' ) ) {
66
  wp_schedule_event( time(), '15_minutes_lite', 'woocommerce_ac_send_email_action' );
67
  }
68
 
69
  /**
70
+ * It will add a cron job for sending the tarcking data.
71
+ * By default it will set once in a week interval.
72
+ * @hook cron_schedules
73
+ * @param array $schedules
74
+ * @return array $schedules
75
+ * @since 3.9
76
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Tracking-Data
77
  */
78
  function wcal_add_tracking_cron_schedule( $schedules ) {
79
  $schedules[ 'daily_once' ] = array(
83
  return $schedules;
84
  }
85
 
86
+ /**
87
+ * To capture the data from the client site.
88
+ * @since 3.9
89
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Admin/Tracking-Data
90
+ */
91
  if ( ! wp_next_scheduled( 'wcal_ts_tracker_send_event' ) ) {
92
  wp_schedule_event( time(), 'daily_once', 'wcal_ts_tracker_send_event' );
93
  }
94
 
95
+ /**
96
+ * Hook into that action that'll fire every 15 minutes
97
+ */
98
+
99
  add_action( 'woocommerce_ac_send_email_action', 'wcal_send_email_cron' );
100
 
101
+ /**
102
+ * It will add the wcal_send_email.php file which is responsible for sending the abandoned cart reminde emails.
103
+ * @hook woocommerce_ac_send_email_action
104
+ * @since 1.3
105
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Cron
106
+ */
107
  function wcal_send_email_cron() {
108
  //require_once( ABSPATH.'wp-content/plugins/woocommerce-abandoned-cart/cron/send_email.php' );
109
  $plugin_dir_path = plugin_dir_path( __FILE__ );
110
  require_once( $plugin_dir_path . 'cron/wcal_send_email.php' );
111
  }
112
 
113
+ /**
114
+ * This function will delete plugin tables, options and usermeta when we delete the plugin.
115
+ * @hook register_uninstall_hook
116
+ * @globals mixed $wpdb
117
+ * @since 1.0
118
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Uninstaller
119
+ */
120
  function woocommerce_ac_delete_lite() {
121
  global $wpdb;
122
  if ( ! is_multisite() ) {
207
  **/
208
  if( !class_exists( 'woocommerce_abandon_cart_lite' ) ) {
209
 
210
+
211
+ /**
212
+ * It will add the hooks, filters, menu and the variables and all the necessary actions for the plguins which will be used
213
+ * all over the plugin.
214
+ * @since 1.0
215
+ * @package Abandoned-Cart-Lite-for-WooCommerce/Core
216
+ */
217
+ class woocommerce_abandon_cart_lite {
218
  var $one_hour;
219
  var $three_hours;
220
  var $six_hours;
223
  var $one_week;
224
  var $duration_range_select = array();
225
  var $start_end_dates = array();
226
+ /**
227
+ * The constructor will add the hooks, filters and the variable which will be used all over the plugin.
228
+ * @since 1.0
229
+ *
230
+ */
231
  public function __construct() {
232
  $this->one_hour = 60 * 60;
233
  $this->three_hours = 3 * $this->one_hour;
316
 
317
  add_action( 'admin_notices', array( 'Wcal_Admin_Notice', 'wcal_pro_notice' ) );
318
  add_action( 'admin_init', array( 'Wcal_Admin_Notice', 'wcal_pro_notice_ignore' ) );
319
+ add_action( 'admin_notices', array( 'Wcal_Admin_Notice', 'wcal_show_db_update_notice' ) );
320
 
321
  /**
322
  * @since: 4.2
326
  }
327
 
328
  /**
329
+ * Check if WooCommerce is active or not.
330
  * @since: 4.2
 
331
  */
332
  public static function wcal_wc_check_ac_installed() {
333
 
339
  }
340
 
341
  /**
342
+ * Ensures that the Abandoned cart lite get deactivated when WooCommerce is deactivated.
343
  * @since: 4.2
 
344
  */
345
  public static function wcal_wc_check_compatibility() {
346
 
353
  if ( isset( $_GET['activate'] ) ) {
354
  unset( $_GET['activate'] );
355
  }
 
356
  }
 
357
  }
358
  }
359
  /**
360
+ * Display a notice in the admin Plugins page if the Abandoned cart lite is activated while WooCommerce is deactivated.
361
  * @since: 4.2
 
 
362
  */
363
  public static function wcal_wc_disabled_notice() {
364
 
367
 
368
  printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
369
  }
370
+
371
+ /**
372
+ * When customer clicks on the "Place Order" button on the checkout page, it will identify if we need to keep that cart or
373
+ * delete it.
374
+ * @hook woocommerce_checkout_order_processed
375
+ * @param int | string $order_id Order id
376
+ * @globals mixed $wpdb
377
+ * @globals mixed $woocommerce
378
+ *
379
+ * @since 3.4
380
+ */
381
  public static function wcal_order_placed( $order_id ) {
382
  if( session_id() === '' ) {
383
  //session has not started
459
  if ( isset( $_SESSION['user_id'] ) && '' != $_SESSION['user_id'] ) {
460
  $wcal_user_id_of_guest = $_SESSION['user_id'];
461
  }
462
+ /* Delete the guest record. As it become the logged in user */
 
 
463
  $get_ac_id_guest_results = array();
464
  if ( isset( $wcal_user_id_of_guest ) && '' != $wcal_user_id_of_guest ) {
465
  $get_ac_id_guest_query = "SELECT id FROM `" . $wcal_history_table_name ."` WHERE user_id = %d ORDER BY id DESC";
470
  $wpdb->delete( $wcal_history_table_name , array( 'id' => $abandoned_order_id_of_guest ) );
471
  }
472
 
473
+ /* It is the new registered users cart id */
474
  if ( isset( $wcal_user_id_of_guest ) && '' != $wcal_user_id_of_guest ) {
475
  $wpdb->delete( $wcal_history_table_name , array( 'id' => $abandoned_cart_id_new_user ) );
476
  }
538
  /* cart is declared as adandoned */
539
  add_post_meta( $order_id , 'wcal_recover_order_placed', $wcal_abandoned_cart_id );
540
  }else {
541
+ /**
542
+ * Cart order is placed within the cutoff time.
543
+ * We will delete that abandoned cart.
544
+ */
545
 
546
+ /* If user becomes the registred user */
547
 
548
  if ( isset( $_POST['account_password'] ) && $_POST['account_password'] != '' ) {
549
 
550
  $abandoned_cart_id_new_user = $_SESSION['abandoned_cart_id_lite'];
551
  $wcal_user_id_of_guest = $_SESSION['user_id'];
552
 
553
+ /* Delete the guest record. As it become the logged in user */
554
 
555
  $wpdb->delete( $wcal_history_table_name , array( 'user_id' => $wcal_user_id_of_guest ) );
556
  $wpdb->delete( $wcal_guest_table_name , array( 'id' => $wcal_user_id_of_guest ) );
557
 
558
+ /* It is the new registered users cart id */
559
  $wpdb->delete( $wcal_history_table_name , array( 'id' => $abandoned_cart_id_new_user ) );
560
  }else {
561
 
565
  */
566
  $wpdb->delete( $wcal_history_table_name , array( 'id' => $wcap_abandoned_cart_id ) );
567
 
568
+ /* This user id is set for the guest uesrs. */
569
  if ( isset( $_SESSION['user_id'] ) && $_SESSION['user_id'] != '' ) {
570
 
571
  $wcal_user_id_of_guest = $_SESSION['user_id'];
577
  }
578
  }
579
 
580
+ /**
581
+ * It will check the WooCommerce order status. If the order status is pending or failed the we will keep that cart record
582
+ * as an abandoned cart.
583
+ * It will be executed after order placed.
584
+ * @hook woocommerce_payment_complete_order_status
585
+ * @param string $order_status Order Status
586
+ * @param int | string $order_id Order Id
587
+ * @return string $order_status
588
+ * @globals mixed $wpdb
589
+ * @globals mixed $woocommerce
590
+ * @since 3.4
591
+ */
592
  public function wcal_order_complete_action( $order_status, $order_id ) {
593
 
594
  /**
643
  }
644
  }
645
  return $order_status;
646
+ }
647
+
 
 
 
648
  /**
649
+ * It will ganerate the preview email template.
650
+ * @hook admin_init
651
+ * @globals mixed $woocommerce
652
+ * @since 2.5
653
  */
654
  public function wcal_preview_emails() {
655
  global $woocommerce;
700
  }
701
  }
702
 
703
+ /**
704
+ * In this version we have allowed customer to transalte the plugin string using .po and .pot file.
705
+ * @hook init
706
+ * @return $loaded
707
+ * @since 1.6
708
+ */
709
  function wcal_update_po_file() {
710
  /*
711
  * Due to the introduction of language packs through translate.wordpress.org, loading our textdomain is complex.
721
  }
722
  }
723
 
724
+ /**
725
+ * It will create the plugin tables & the options reqired for plugin.
726
+ * @hook register_activation_hook
727
+ * @globals mixed $wpdb
728
+ * @since 1.0
729
+ */
730
  function wcal_activate() {
731
  global $wpdb;
732
  $wcap_collate = '';
736
  $table_name = $wpdb->prefix . "ac_email_templates_lite";
737
  $sql = "CREATE TABLE IF NOT EXISTS $table_name (
738
  `id` int(11) NOT NULL AUTO_INCREMENT,
739
+ `subject` text COLLATE utf8mb4_unicode_ci NOT NULL,
740
+ `body` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
741
+ `is_active` enum('0','1') COLLATE utf8mb4_unicode_ci NOT NULL,
742
  `frequency` int(11) NOT NULL,
743
+ `day_or_hour` enum('Days','Hours') COLLATE utf8mb4_unicode_ci NOT NULL,
744
+ `template_name` text COLLATE utf8mb4_unicode_ci NOT NULL,
745
  PRIMARY KEY (`id`)
746
  ) $wcap_collate AUTO_INCREMENT=1 ";
747
 
754
 
755
  if ( count( $results ) == 0 ) {
756
  $alter_template_table_query = "ALTER TABLE $table_name
757
+ ADD COLUMN `is_wc_template` enum('0','1') COLLATE utf8mb4_unicode_ci NOT NULL AFTER `template_name`,
758
  ADD COLUMN `default_template` int(11) NOT NULL AFTER `is_wc_template`";
759
 
760
  $wpdb->get_results( $alter_template_table_query );
858
  }
859
  }
860
 
861
+ /**
862
+ * It will add the section, field, & registres the plugin fields using Settings API.
863
+ * @hook admin_init
864
+ * @since 2.5
865
+ */
866
  function wcal_initialize_plugin_options() {
867
 
868
  // First, we register a section. This is necessary since all future options must belong to a
899
  'ac_lite_general_settings_section',
900
  array( __( 'Enable tracking of abandoned products & carts even if customer does not visit the checkout page or does not enter any details on the checkout page like Name or Email. Tracking will begin as soon as a visitor adds a product to their cart and visits the cart page.', 'woocommerce-abandoned-cart' ) )
901
  );
902
+ /**
903
  * New section for the Adding the abandoned cart setting.
904
+ * @since 4.7
905
  */
906
 
907
  add_settings_section(
969
  );
970
  }
971
 
972
+ /**
973
+ * Settings API callback for section "ac_lite_general_settings_section".
974
+ * @since 2.5
975
+ */
976
  function ac_lite_general_options_callback() {
977
 
978
  }
979
 
980
+ /**
981
+ * Settings API callback for cart time field.
982
+ * @param array $args Arguments
983
+ * @since 2.5
984
+ */
985
  function ac_lite_cart_abandoned_time_callback( $args ) {
986
  // First, we read the option
987
  $cart_abandoned_time = get_option( 'ac_lite_cart_abandoned_time' );
996
  echo $html;
997
  }
998
 
999
+ /**
1000
+ * Settings API cart time field validation.
1001
+ * @param int | string $input
1002
+ * @return int | string $output
1003
+ * @since 2.5
1004
+ */
1005
  function ac_lite_cart_time_validation( $input ) {
1006
  $output = '';
1007
  if ( $input != '' && ( is_numeric( $input) && $input > 0 ) ) {
1012
  return $output;
1013
  }
1014
 
1015
+ /**
1016
+ * Settings API callback for email admin on cart recovery field.
1017
+ * @param array $args Arguments
1018
+ * @since 2.5
1019
+ */
1020
  function ac_lite_email_admin_on_recovery( $args ) {
1021
  // First, we read the option
1022
  $email_admin_on_recovery = get_option( 'ac_lite_email_admin_on_recovery' );
1037
  $html .= '<label for="ac_lite_email_admin_on_recovery"> ' . $args[0] . '</label>';
1038
  echo $html;
1039
  }
1040
+ /**
1041
+ * Settings API callback for capturing guest cart which do not reach the checkout page.
1042
+ * @param array $args Arguments
1043
+ * @since 2.7
1044
+ */
1045
  function wcal_track_guest_cart_from_cart_page_callback( $args ) {
1046
  // First, we read the option
1047
  $disable_guest_cart_from_cart_page = get_option( 'ac_lite_track_guest_cart_from_cart_page' );
1062
  echo $html;
1063
  }
1064
 
1065
+ /**
1066
+ * Settings API callback for Abandoned cart email settings of the plugin.
1067
+ * @since 3.5
1068
+ */
1069
  function wcal_email_callback () {
1070
 
1071
  }
1072
 
1073
+ /**
1074
+ * Settings API callback for from name used in Abandoned cart email.
1075
+ * @param array $args Arguments
1076
+ * @since 3.5
1077
+ */
1078
  public static function wcal_from_name_callback( $args ) {
1079
  // First, we read the option
1080
  $wcal_from_name = get_option( 'wcal_from_name' );
1089
  echo $html;
1090
  }
1091
 
1092
+ /**
1093
+ * Settings API callback for from email used in Abandoned cart email.
1094
+ * @param array $args Arguments
1095
+ * @since 3.5
1096
+ */
1097
  public static function wcal_from_email_callback( $args ) {
1098
  // First, we read the option
1099
  $wcal_from_email = get_option( 'wcal_from_email' );
1108
  echo $html;
1109
  }
1110
 
1111
+ /**
1112
+ * Settings API callback for reply email used in Abandoned cart email.
1113
+ * @param array $args Arguments
1114
+ * @since 3.5
1115
+ */
1116
  public static function wcal_reply_email_callback( $args ) {
1117
  // First, we read the option
1118
  $wcal_reply_email = get_option( 'wcal_reply_email' );
1126
  $html = '<label for="wcal_reply_email_label"> ' . $args[0] . '</label>';
1127
  echo $html;
1128
  }
1129
+
1130
+ /**
1131
+ * It will be executed when the plugin is upgraded.
1132
+ * @hook admin_init
1133
+ * @globals mixed $wpdb
1134
+ * @since 1.0
1135
+ */
1136
  function wcal_update_db_check() {
1137
  global $wpdb;
1138
 
1163
 
1164
  if ( count( $results_email ) == 0 ) {
1165
  $alter_email_template_table_query = "ALTER TABLE $table_name
1166
+ ADD COLUMN `wc_email_header` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL AFTER `default_template`";
1167
  $wpdb->get_results( $alter_email_template_table_query );
1168
  }
1169
 
1179
  }
1180
  }
1181
  /**
1182
+ * This is used to prevent guest users wrong Id. If guest users id is less then 63000000 then this code will
1183
+ * ensure that we will change the id of guest tables so it wont affect on the next guest users.
 
1184
  */
1185
  if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ac_guest_abandoned_cart_history_lite';" ) && 'yes' != get_option( 'wcal_guest_user_id_altered' ) ) {
1186
  $last_id = $wpdb->get_var( "SELECT max(id) FROM `{$wpdb->prefix}ac_guest_abandoned_cart_history_lite`;" );
1272
 
1273
  /**
1274
  * Send email to admin when cart is recovered only via PayPal.
1275
+ * @hook woocommerce_order_status_changed
1276
+ * @param int | string $order_id Order id
1277
+ * @param string $old Old status
1278
+ * @param string $new_status New status
1279
+ * @globals mixed $wpdb
1280
+ * @globals mixed $woocommerce
1281
+ * @since 2.9
1282
  */
1283
  public static function wcal_email_admin_recovery_for_paypal( $order_id, $old, $new_status ) {
1284
  if ( 'pending' == $old && 'processing' == $new_status ) {
1327
 
1328
  /**
1329
  * Send email to admin when cart is recovered via any other payment gateway other than PayPal.
1330
+ * @hook woocommerce_order_status_pending_to_processing_notification
1331
+ * @hook woocommerce_order_status_pending_to_completed_notification
1332
+ * @hook woocommerce_order_status_pending_to_on-hold_notification
1333
+ * @hook woocommerce_order_status_failed_to_processing_notification
1334
+ * @hook woocommerce_order_status_failed_to_completed_notification
1335
+ * @param int | string $order_id Order id
1336
+ * @globals mixed $wpdb
1337
+ * @globals mixed $woocommerce
1338
+ * @since 2.3
1339
  */
1340
  function wcal_email_admin_recovery ( $order_id ) {
1341
  global $wpdb, $woocommerce;
1380
  }
1381
  }
1382
 
1383
+ /**
1384
+ * For sending Recovery Email to Admin, we will check that order is recovered or not.
1385
+ * @param int | string $wcal_order_id Order id
1386
+ * @return boolean true | false
1387
+ * @globals mixed $wpdb
1388
+ * @since 2.3
1389
+ */
1390
  function wcal_check_order_is_recovered( $wcal_order_id ) {
1391
  global $wpdb;
1392
  $wcal_recover_order_query = "SELECT `recovered_cart` FROM `wp_ac_abandoned_cart_history_lite` WHERE `recovered_cart` = %d";
1397
  return false;
1398
  }
1399
 
1400
+ /**
1401
+ * Add a submenu page under the WooCommerce.
1402
+ * @hook admin_menu
1403
+ * @since 1.0
1404
+ */
1405
  function wcal_admin_menu() {
1406
  $page = add_submenu_page ( 'woocommerce', __( 'Abandoned Carts', 'woocommerce-abandoned-cart' ), __( 'Abandoned Carts', 'woocommerce-abandoned-cart' ), 'manage_woocommerce', 'woocommerce_ac_page', array( &$this, 'wcal_menu_page' ) );
1407
  }
1408
 
1409
+ /**
1410
+ * Capture the cart and insert the information of the cart into DataBase.
1411
+ * @hook woocommerce_cart_updated
1412
+ * @globals mixed $wpdb
1413
+ * @globals mixed $woocommerce
1414
+ * @since 1.0
1415
+ */
1416
  function wcal_store_cart_timestamp() {
1417
 
1418
  if( session_id() === '' ){
1548
  } else {
1549
  /**
1550
  * Here we capture the guest cart from the cart page.
1551
+ * @since 3.5
 
1552
  */
1553
  if ( $track_guest_user_cart_from_cart == "on" && $get_cookie[0] != '' ) {
1554
  $query = "SELECT * FROM `" . $wpdb->prefix . "ac_abandoned_cart_history_lite` WHERE session_id LIKE %s AND cart_ignored = '0' AND recovered_cart = '0' ";
1588
  }
1589
  }
1590
 
1591
+ /**
1592
+ * It will unsubscribe the abandoned cart, so user will not recieve further abandoned cart emails.
1593
+ * @hook template_include
1594
+ * @param string $args Arguments
1595
+ * @return string $args
1596
+ * @globals mixed $wpdb
1597
+ * @since 2.9
1598
+ */
1599
  function wcal_email_unsubscribe( $args ) {
1600
  global $wpdb;
1601
 
1647
  }
1648
  }
1649
 
1650
+ /**
1651
+ * It will track the URL of cart link from email, and it will populate the logged-in and guest users cart.
1652
+ * @hook template_include
1653
+ * @param string $template
1654
+ * @return string $template
1655
+ * @globals mixed $wpdb
1656
+ * @globals mixed $woocommerce
1657
+ * @since 1.0
1658
+ */
1659
  function wcal_email_track_links( $template ) {
1660
  global $woocommerce;
1661
  $track_link = '';
1734
  return $template;
1735
  }
1736
 
1737
+ /**
1738
+ * When customer clicks on the abandoned cart link and that cart is for the the guest users the it will load the guest
1739
+ * user's cart detail.
1740
+ * @globals mixed $woocommerce
1741
+ * @since 1.0
1742
+ */
1743
  function wcal_load_guest_persistent_cart() {
1744
  if ( isset( $_SESSION['user_id'] ) && '' != $_SESSION['user_id'] ) {
1745
  global $woocommerce;
1799
  }
1800
  }
1801
 
1802
+ /**
1803
+ * It will compare only guest users cart while capturing the cart.
1804
+ * @param json_encode $new_cart New abandoned cart details
1805
+ * @param json_encode $last_abandoned_cart Old abandoned cart details
1806
+ * @return boolean true | false
1807
+ * @since 1.0
1808
+ */
1809
  function wcal_compare_only_guest_carts( $new_cart, $last_abandoned_cart ) {
1810
  $current_woo_cart = array();
1811
  $current_woo_cart = json_decode( stripslashes( $new_cart ), true );
1854
  return true;
1855
  }
1856
 
1857
+ /**
1858
+ * It will compare only loggedin users cart while capturing the cart.
1859
+ * @param int | string $user_id User id
1860
+ * @param json_encode $last_abandoned_cart Old abandoned cart details
1861
+ * @return boolean true | false
1862
+ * @since 1.0
1863
+ */
1864
  function wcal_compare_carts( $user_id, $last_abandoned_cart ) {
1865
  global $woocommerce;
1866
  $current_woo_cart = array();
1913
  return true;
1914
  }
1915
 
1916
+ /**
1917
+ * When user places the order and reach the order recieved page, then it will check if it is abandoned cart and subsequently
1918
+ * recovered or not.
1919
+ * @hook woocommerce_order_details_after_order_table
1920
+ * @param array | object $order Order details
1921
+ * @globals mixed $wpdb
1922
+ * @globals mixed $woocommerce
1923
+ * @since 1.0
1924
+ */
1925
  function wcal_action_after_delivery_session( $order ) {
1926
 
1927
  if( session_id() === '' ){
2035
  }
2036
  }
2037
  }
2038
+
2039
+ /**
2040
+ * It will add the wp editor for email body on the email edit page.
2041
+ * @hook admin_init
2042
+ * @since 2.6
2043
+ */
2044
  function wcal_action_admin_init() {
2045
 
2046
  // only hook up these filters if we're in the admin panel and the current user has permission
2065
  }
2066
  }
2067
 
2068
+ /**
2069
+ * It will create a button on the WordPress editor.
2070
+ * @hook mce_buttons
2071
+ * @param array $buttons
2072
+ * @return array $buttons
2073
+ * @since 2.6
2074
+ */
2075
  function wcal_filter_mce_button( $buttons ) {
2076
  // add a separation before our button, here our button's id is &quot;mygallery_button&quot;
2077
  array_push( $buttons, 'abandoncart', '|' );
2078
  return $buttons;
2079
  }
2080
 
2081
+ /**
2082
+ * It will add the list for the added extra button.
2083
+ * @hook mce_external_plugins
2084
+ * @param array $plugins
2085
+ * @return array $plugins
2086
+ * @since 2.6
2087
+ */
2088
  function wcal_filter_mce_plugin( $plugins ) {
2089
  // this plugin file will work the magic of our button
2090
  $plugins['abandoncart'] = plugin_dir_url( __FILE__ ) . 'assets/js/abandoncart_plugin_button.js';
2091
  return $plugins;
2092
  }
2093
 
2094
+ /**
2095
+ * It will add the tabs on the Abandoned cart page.
2096
+ * @since 1.0
2097
+ */
2098
  function wcal_display_tabs() {
2099
 
2100
  if ( isset( $_GET['action'] ) ) {
2134
  <?php
2135
  }
2136
 
2137
+ /**
2138
+ * It will add the scripts needed for the plugin.
2139
+ * @hook admin_enqueue_scripts
2140
+ * @param string $hook Name of hook
2141
+ * @since 1.0
2142
+ */
2143
  function wcal_enqueue_scripts_js( $hook ) {
2144
 
2145
  if ( $hook != 'woocommerce_page_woocommerce_ac_page' ) {
2177
  wp_enqueue_script( 'wcal_activate_template', plugins_url() . '/woocommerce-abandoned-cart/assets/js/wcal_template_activate.js' );
2178
  }
2179
  }
2180
+
2181
+ /**
2182
+ * It will add the parameter to the editor.
2183
+ * @hook tiny_mce_before_init
2184
+ * @param array $in
2185
+ * @return array $in
2186
+ * @since 2.6
2187
+ */
2188
  function wcal_format_tiny_MCE( $in ) {
2189
  $in['force_root_block'] = false;
2190
  $in['valid_children'] = '+body[style]';
2210
  return $in;
2211
  }
2212
 
2213
+ /**
2214
+ * It will add the necesaary css for the plugin.
2215
+ * @hook admin_enqueue_scripts
2216
+ * @param string $hook Name of page
2217
+ * @since 1.0
2218
+ */
2219
  function wcal_enqueue_scripts_css( $hook ) {
2220
  if ( $hook != 'woocommerce_page_woocommerce_ac_page' ) {
2221
  return;
2228
 
2229
  }
2230
  }
2231
+
2232
+ /**
2233
+ * When we have added the wp list table for the listing then while deleting the record with the bulk action it was showing
2234
+ * the notice. To overcome the wp redirect warning we need to start the ob_start.
2235
+ * @hook init
2236
+ * @since 2.5.2
2237
+ */
2238
  function wcal_app_output_buffer() {
2239
  ob_start();
2240
  }
2241
 
2242
  /**
2243
+ * Abandon Cart Settings Page. It will show the tabs, notices for the plugin.
2244
+ * It will also update the template records and display the template fields.
2245
+ * It will also show the abandoned cart details page.
2246
+ * It will also show the details of all the tabs.
2247
+ * @globals mixed $wpdb
2248
+ * @since 1.0
2249
  */
2250
  function wcal_menu_page() {
2251
 
2259
  <div class="wrap">
2260
  <h2><?php _e( 'WooCommerce - Abandon Cart Lite', 'woocommerce-abandoned-cart' ); ?></h2>
2261
  <?php
2262
+
2263
+ if ( isset( $_GET['ac_update'] ) && $_GET['ac_update'] === 'email_templates' ) {
2264
+ $status = wcal_common::update_templates_table();
2265
+
2266
+ if ( $status !== false ) {
2267
+ wcal_common::show_update_success();
2268
+ }else {
2269
+ wcal_common::show_update_failure();
2270
+ }
2271
+ }
2272
 
2273
  if ( isset( $_GET['action'] ) ) {
2274
  $action = $_GET['action'];
2317
  <div id="message" class="updated fade">
2318
  <p><strong><?php _e( 'The Abandoned cart has been successfully deleted.', 'woocommerce-abandoned-cart' ); ?></strong></p>
2319
  </div>
2320
+ <?php }
2321
  if ( isset( $_GET ['wcal_template_deleted'] ) && 'YES' == $_GET['wcal_template_deleted'] ) { ?>
2322
  <div id="message" class="updated fade">
2323
  <p><strong><?php _e( 'The Template has been successfully deleted.', 'woocommerce-abandoned-cart' ); ?></strong></p>
2324
  </div>
2325
+ <?php }
2326
  if ( $action == 'emailsettings' ) {
2327
  // Save the field values
2328
  ?>
2592
  <?php
2593
  }
2594
 
2595
+ if ( isset( $_POST['ac_settings_frm'] ) && $_POST['ac_settings_frm'] == 'update' && isset($update_template_successfuly) && $update_template_successfuly !== false ) { ?>
2596
  <div id="message" class="updated fade">
2597
  <p>
2598
  <strong>
3336
  }
3337
  }
3338
 
3339
+ /**
3340
+ * It will add the footer text for the plugin.
3341
+ * @hook admin_footer_text
3342
+ * @param string $footer_text Text
3343
+ * @return string $footer_text
3344
+ * @since 1.0
3345
+ */
3346
  function wcal_admin_footer_text( $footer_text ) {
3347
 
3348
  if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'woocommerce_ac_page' ) {
3357
  return $footer_text;
3358
  }
3359
 
3360
+ /**
3361
+ * It will sort the record for the product reports tab.
3362
+ * @param array $unsort_array Unsorted array
3363
+ * @param string $order Order details
3364
+ * @return array $array
3365
+ * @since 2.6
3366
+ */
3367
  function bubble_sort_function( $unsort_array, $order ) {
3368
  $temp = array();
3369
  foreach ( $unsort_array as $key => $value )
3378
  unset( $temp );
3379
  return $array;
3380
  }
3381
+
3382
+ /**
3383
+ * It will be called when we send the test email from the email edit page.
3384
+ * @hook wp_ajax_wcal_preview_email_sent
3385
+ * @since 1.0
3386
+ */
3387
  function wcal_action_send_preview() {
3388
  ?>
3389
  <script type="text/javascript" >
3426
  });
3427
  });
3428
  });
3429
+ </script>
3430
  <?php
3431
  }
3432
+
3433
+ /**
3434
+ * It will update the template satus when we change the template active status from the email template list page.
3435
+ * @hook wp_ajax_wcal_toggle_template_status
3436
+ * @globals mixed $wpdb
3437
+ * @since 4.4
3438
+ */
3439
  public static function wcal_toggle_template_status () {
3440
  global $wpdb;
3441
  $template_id = $_POST['wcal_template_id'];
3476
  wp_die();
3477
 
3478
  }
3479
+ /**
3480
+ * It will replace the test email data with the static content.
3481
+ * @return string email sent | not sent
3482
+ * @since 1.0
3483
+ */
3484
  function wcal_preview_email_sent() {
3485
  if ( '' != $_POST['body_email_preview'] ) {
3486
  $from_email_name = get_option ( 'wcal_from_name' );
3607
  echo "not sent";
3608
  die();
3609
  }
3610
+ }
3611
  }
3612
  }
3613
  $woocommerce_abandon_cart = new woocommerce_abandon_cart_lite();