PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 3.1.8
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v3.1.8
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 / FB / Assignments.php

Assignments.php in FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment 3.1.8, at Inc/Core/FB/Assignments.php

142 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 3.1.8 Free
5 *
6 * @author FirePlugins <info@fireplugins.com>
7 * @link https://www.fireplugins.com
8 * @copyright Copyright © 2026 FirePlugins All Rights Reserved
9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 */
11
12 namespace FireBox\Core\FB;
13
14 if (!defined('ABSPATH'))
15 {
16 exit; // Exit if accessed directly.
17 }
18
19 use FPFramework\Libs\Registry;
20
21 class Assignments
22 {
23 /**
24 * Box Class Instance
25 *
26 * @var Box
27 */
28 private $box_instance;
29
30 /**
31 * Box Object
32 *
33 * @var Object
34 */
35 private $box;
36
37 /**
38 * Factory
39 *
40 * @var object
41 */
42 protected $factory;
43
44 /**
45 * Local assignments list
46 *
47 * @var array
48 */
49 private $assignments = [
50 'cookietype',
51
52 ];
53
54 /**
55 * Class Constructor
56 *
57 * @param object $box_instance The Box Class Instance
58 * @param object $factory The Framework Class Instance
59 *
60 * @return void
61 */
62 public function __construct($box_instance = null, $factory = null)
63 {
64 $this->box_instance = $box_instance;
65 $this->box = $this->box_instance->getBox();
66
67 if (!$factory)
68 {
69 $factory = new \FPFramework\Base\Factory();
70 }
71 $this->factory = $factory;
72 }
73
74 /**
75 * Pass all checks
76 *
77 * @return boolean Returns true if all assignments pass
78 */
79 public function passAll()
80 {
81 $pass = true;
82
83
84
85 foreach ($this->assignments as $key => $assignment)
86 {
87 // Break if not passed
88 if (!$pass)
89 {
90 break;
91 }
92
93 $assignmentData = explode('|', $assignment);
94
95 $assignment = $assignmentData[0];
96
97 $method = 'pass' . $assignment;
98
99 // Skip item if there is no assosiated method
100 if (!method_exists($this, $method))
101 {
102 continue;
103 }
104
105 $assign = 'assign_' . $assignment;
106
107 // Skip item if assignment is missing
108 if (!$this->box->params->exists($assign) && !$this->box->params->exists($assign . '_param_type'))
109 {
110 continue;
111 }
112
113 $pass = $this->$method();
114 }
115
116 return $pass;
117 }
118
119 /**
120 * Pass Check for Box Cookie
121 *
122 * @return bool
123 */
124 private function passCookieType()
125 {
126 // Skip if assignment is disabled
127 if ($this->box->params->get('assign_cookietype') == 'never')
128 {
129 return true;
130 }
131
132 // Skip if box is on Test Mode and a Super User is logged in
133 if ($this->box->params->get('testmode') && is_user_logged_in() && current_user_can('manage_options'))
134 {
135 return true;
136 }
137
138 return !$this->box_instance->getCookie()->exist();
139 }
140
141
142 }