PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.1.4
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.1.4
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 2.1.4, at Inc/Core/FB/Assignments.php

140 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 2.1.4 Free
5 *
6 * @author FirePlugins <info@fireplugins.com>
7 * @link https://www.fireplugins.com
8 * @copyright Copyright © 2024 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 foreach ($this->assignments as $key => $assignment)
84 {
85 // Break if not passed
86 if (!$pass)
87 {
88 break;
89 }
90
91 $assignmentData = explode('|', $assignment);
92
93 $assignment = $assignmentData[0];
94
95 $method = 'pass' . $assignment;
96
97 // Skip item if there is no assosiated method
98 if (!method_exists($this, $method))
99 {
100 continue;
101 }
102
103 $assign = 'assign_' . $assignment;
104
105 // Skip item if assignment is missing
106 if (!$this->box->params->exists($assign) && !$this->box->params->exists($assign . '_param_type'))
107 {
108 continue;
109 }
110
111 $pass = $this->$method();
112 }
113
114 return $pass;
115 }
116
117 /**
118 * Pass Check for Box Cookie
119 *
120 * @return bool
121 */
122 private function passCookieType()
123 {
124 // Skip if assignment is disabled
125 if ($this->box->params->get('assign_cookietype') == 'never')
126 {
127 return true;
128 }
129
130 // Skip if box is on Test Mode and a Super User is logged in
131 if ($this->box->params->get('testmode') && is_user_logged_in() && current_user_can('manage_options'))
132 {
133 return true;
134 }
135
136 return !$this->box_instance->getCookie()->exist();
137 }
138
139
140 }