PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 1.0.0
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v1.0.0
3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 All 122 releases
firebox / Inc / Core / Admin / Analytics / Overview / Item.php

Item.php in FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment 1.0.0, at Inc/Core/Admin/Analytics/Overview/Item.php

100 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package FireBox
4 * @version 1.0.0 Free
5 *
6 * @author FirePlugins <info@fireplugins.com>
7 * @link https://www.fireplugins.com
8 * @copyright Copyright © 2021 FirePlugins All Rights Reserved
9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 */
11
12 namespace FireBox\Core\Admin\Analytics\Overview;
13
14 if (!defined('ABSPATH'))
15 {
16 exit; // Exit if accessed directly.
17 }
18
19 class Item
20 {
21 /**
22 * Metrics of the Overview Item
23 *
24 * @var array
25 */
26 protected $metrics;
27
28 /**
29 * Toolbar Items of the Overview Item
30 *
31 * @var array
32 */
33 protected $toolbar_items;
34
35 /**
36 * Other Data of the Overview Item
37 *
38 * @var array
39 */
40 protected $other_data;
41
42 /**
43 * Overview Item Data
44 *
45 * @var array
46 */
47 protected $overview_item_data;
48
49 public function __construct($overview_item_data = null)
50 {
51 $this->overview_item_data = $overview_item_data;
52
53 $this->toolbar_items = isset($this->overview_item_data['toolbar_items']) ? $this->overview_item_data['toolbar_items'] : [];
54 $this->metrics = isset($this->overview_item_data['metrics']) ? $this->overview_item_data['metrics'] : [];
55 $this->other_data = isset($this->overview_item_data['other_data']) ? $this->overview_item_data['other_data'] : [];
56 }
57
58 /**
59 * Returns all Overview Item data
60 *
61 * @return array
62 */
63 public function getData()
64 {
65 $item_data = [];
66
67 if (method_exists($this, 'getItemData'))
68 {
69 $item_data = $this->getItemData();
70 }
71
72 $data = array_merge($this->getCommonData(), $item_data);
73
74 $data['show_total'] = isset($this->overview_item_data['show_total']) ? $this->overview_item_data['show_total'] : true;
75
76 $show_percentage = isset($this->overview_item_data['show_percentage']) ? $this->overview_item_data['show_percentage'] : true;
77 if (!$show_percentage)
78 {
79 $data['percentage_change'] = 0;
80 }
81
82 return $data;
83 }
84
85 /**
86 * Returns all common data
87 *
88 * @return array
89 */
90 private function getCommonData()
91 {
92 return [
93 'overview_item_name' => isset($this->overview_item_data['overview_item_name']) ? $this->overview_item_data['overview_item_name'] : '',
94 'overview_type' => isset($this->overview_item_data['overview_type']) ? $this->overview_item_data['overview_type'] : '',
95 'redirect_base' => isset($this->overview_item_data['redirect_base']) ? $this->overview_item_data['redirect_base'] : false,
96 'show_overlay_message' => isset($this->overview_item_data['show_overlay_message']) ? $this->overview_item_data['show_overlay_message'] : false,
97 'class' => isset($this->overview_item_data['class']) ? $this->overview_item_data['class'] : '',
98 ];
99 }
100 }