PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 1.7.2
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v1.7.2
2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 1.8.1 All 42 releases
sellkit / includes / admin / components / analytics / class.php

class.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster 1.7.2, at includes/admin/components/analytics/class.php

51 lines 810 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sellkit\Admin\Components\Analytics;
4
5 use Sellkit\Admin\Components\Analytics;
6
7 defined( 'ABSPATH' ) || die();
8
9 /**
10 * Components class.
11 *
12 * @since 1.1.0
13 */
14 abstract class Analytics_Base {
15
16 /**
17 * Output data.
18 *
19 * @var $output array Analytics data.
20 */
21 public $output;
22
23 /**
24 * Target id.
25 *
26 * @var $target_id int Target id.
27 */
28 public $target_id;
29
30 /**
31 * Getting chart data.
32 *
33 * @since 1.1.0
34 */
35 public function get_data() {
36 $chart_data = [];
37
38 for ( $i = Analytics::$date_range; $i >= 0; $i-- ) {
39 $time = strtotime( "-{$i} days" );
40 $date = date( 'M_d', $time );
41
42 $chart_data[] = [
43 'date' => str_replace( '_', ' ', $date ),
44 'value' => ! empty( $this->output[ $date ] ) ? floatval( $this->output[ $date ] ) : 0,
45 ];
46 }
47
48 return $chart_data;
49 }
50 }
51