PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.1.14
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.1.14
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
← All changes | Inc/Core/FB/Assignments.php +23 -29 1.0.02.1.14 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 1.0.0 Free
4 + * @version 2.1.14 Free
5 5 *
6 6 * @author FirePlugins <info@fireplugins.com>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2021 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2024 FirePlugins All Rights Reserved
9 9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 10 */
11 11
12 12 namespace FireBox\Core\FB;
@@ -20,20 +20,20 @@
20 20
21 21 class Assignments
22 22 {
23 23 /**
24 - * Box
24 + * Box Class Instance
25 25 *
26 26 * @var Box
27 27 */
28 - private $box;
29 -
28 + private $box_instance;
29 +
30 30 /**
31 - * Box Settings
31 + * Box Object
32 32 *
33 - * @var object
33 + * @var Object
34 34 */
35 - private $boxSettings;
35 + private $box;
36 36
37 37 /**
38 38 * Factory
39 39 *
@@ -46,26 +46,25 @@
46 46 *
47 47 * @var array
48 48 */
49 49 private $assignments = [
50 - 'cookietype|local',
50 + 'cookietype',
51 51
52 52 ];
53 53
54 54 /**
55 - * Class Constructor
55 + * Class Constructor
56 56 *
57 - * @param object $item The object to be checked
57 + * @param object $box_instance The Box Class Instance
58 + * @param object $factory The Framework Class Instance
59 + *
60 + * @return void
58 61 */
59 - public function __construct($box, $factory = null)
62 + public function __construct($box_instance = null, $factory = null)
60 63 {
61 - if (!$box)
62 - {
63 - return;
64 - }
65 - $this->box = $box;
66 - $this->boxSettings = $this->box->getBoxSettings();
67 -
64 + $this->box_instance = $box_instance;
65 + $this->box = $this->box_instance->getBox();
66 +
68 67 if (!$factory)
69 68 {
70 69 $factory = new \FPFramework\Base\Factory();
71 70 }
@@ -91,9 +90,8 @@
91 90
92 91 $assignmentData = explode('|', $assignment);
93 92
94 93 $assignment = $assignmentData[0];
95 - $type = isset($assignmentData[1]) ? $assignmentData[1] : '';
96 94
97 95 $method = 'pass' . $assignment;
98 96
99 97 // Skip item if there is no assosiated method
@@ -101,14 +99,12 @@
101 99 {
102 100 continue;
103 101 }
104 102
105 - $prefix = empty($type) ? 'assignments.' : '';
103 + $assign = 'assign_' . $assignment;
106 104
107 - $assign = $prefix . 'assign_' . $assignment;
108 -
109 105 // Skip item if assignment is missing
110 - if (!$this->boxSettings->params->exists($assign))
106 + if (!$this->box->params->exists($assign) && !$this->box->params->exists($assign . '_param_type'))
111 107 {
112 108 continue;
113 109 }
114 110
@@ -125,22 +121,20 @@
125 121 */
126 122 private function passCookieType()
127 123 {
128 124 // Skip if assignment is disabled
129 - if ($this->boxSettings->params->get('assign_cookietype') == 'never')
125 + if ($this->box->params->get('assign_cookietype') == 'never')
130 126 {
131 127 return true;
132 128 }
133 129
134 130 // Skip if box is on Test Mode and a Super User is logged in
135 - if ($this->boxSettings->params->get('testmode') && is_user_logged_in() && current_user_can('manage_options'))
131 + if ($this->box->params->get('testmode') && is_user_logged_in() && current_user_can('manage_options'))
136 132 {
137 133 return true;
138 134 }
139 135
140 - $cookie = $this->box->getCookie($this->boxSettings->ID);
141 -
142 - return !$cookie->exist();
136 + return !$this->box_instance->getCookie()->exist();
143 137 }
144 138
145 139
146 140 }