PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 3.1.14
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v3.1.14
3.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 All 123 releases
← All changes | Inc/Core/FB/Assignments.php +28 -32 1.0.9 → 3.1.14 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 1.0.9 Free
4 + * @version 3.1.14 Free
5 5 *
6 6 * @author FirePlugins <[email protected]>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2021 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2026 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 }
@@ -79,9 +78,9 @@
79 78 */
80 79 public function passAll()
81 80 {
82 81 $pass = true;
83 -
82 +
84 83 foreach ($this->assignments as $key => $assignment)
85 84 {
86 85 // Break if not passed
87 86 if (!$pass)
@@ -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
@@ -100,22 +98,22 @@
100 98 if (!method_exists($this, $method))
101 99 {
102 100 continue;
103 101 }
104 -
105 - $prefix = empty($type) ? 'assignments.' : '';
106 102
107 - $assign = $prefix . 'assign_' . $assignment;
108 -
103 + $assign = 'assign_' . $assignment;
104 +
109 105 // Skip item if assignment is missing
110 - if (!$this->boxSettings->params->exists($assign) && !$this->boxSettings->params->exists($assign . '_param_type'))
106 + if (!$this->box->params->exists($assign) && !$this->box->params->exists($assign . '_param_type'))
111 107 {
112 108 continue;
113 109 }
114 -
110 +
115 111 $pass = $this->$method();
116 112 }
113 +
117 114
115 +
118 116 return $pass;
119 117 }
120 118
121 119 /**
@@ -125,22 +123,20 @@
125 123 */
126 124 private function passCookieType()
127 125 {
128 126 // Skip if assignment is disabled
129 - if ($this->boxSettings->params->get('assign_cookietype') == 'never')
127 + if ($this->box->params->get('assign_cookietype') == 'never')
130 128 {
131 129 return true;
132 130 }
133 131
134 132 // 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'))
133 + if ($this->box->params->get('testmode') && is_user_logged_in() && current_user_can('manage_options'))
136 134 {
137 135 return true;
138 136 }
139 137
140 - $cookie = $this->box->getCookie($this->boxSettings->ID);
141 -
142 - return !$cookie->exist();
138 + return !$this->box_instance->getCookie()->exist();
143 139 }
144 140
145 141
146 142 }