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 / Helpers / OverviewHelper.php

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

82 lines 2.1 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\Helpers;
13
14 if (!defined('ABSPATH'))
15 {
16 exit; // Exit if accessed directly.
17 }
18
19 class OverviewHelper
20 {
21 /**
22 * Get overview data given a payload of data
23 *
24 * @param array $payload
25 *
26 * @return array
27 */
28 public static function getOverviewData($payload)
29 {
30 if (!$payload)
31 {
32 return [];
33 }
34
35 $data = [];
36
37 foreach ($payload as $key => $value)
38 {
39 if (!isset($value['overview_type']))
40 {
41 continue;
42 }
43
44 $overview_type = $value['overview_type'];
45
46 $class = '\FireBox\Core\Admin\Analytics\Overview\Items\\' . ucfirst(strtolower($overview_type));
47
48 if (!class_exists($class))
49 {
50 continue;
51 }
52
53 // also send the overview item name
54 $value['overview_item_name'] = $key;
55
56 $class = new $class($value);
57
58 $overview_data = $class->getData();
59
60 // set the layout for this specific overview item if we were given one
61 $layout = isset($value['layout']) ? $value['layout'] : $overview_type;
62 $overview_data['layout'] = $layout;
63
64 $overview_title = isset($value['overview_title']) ? $value['overview_title'] : '';
65 $overview_data['overview_title'] = $overview_title;
66
67 // get the overview item content
68 $overview_data['content'] = firebox()->renderer->admin->render('analytics/overview/item.' . $layout, $overview_data, true);
69
70 if (count($payload) == 1)
71 {
72 $data = $overview_data;
73 }
74 else
75 {
76 $data[] = $overview_data;
77 }
78 }
79
80 return $data;
81 }
82 }