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 / Plugin.php

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

368 lines 6.0 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
13 {
14 if (!defined('ABSPATH'))
15 {
16 exit; // Exit if accessed directly.
17 }
18
19 use FPFramework\Framework;
20 use FPFramework\Base\Renderer;
21
22 use FireBox\Core\Admin\Admin;
23 use FireBox\Core\Admin\Includes\Library;
24 use FireBox\Core\Admin\Includes\Cpts\Cpts;
25 use FireBox\Core\Admin\Menu\PluginMenu;
26 use FireBox\Core\FB\Box;
27 use FireBox\Core\FB\Boxes;
28 use FireBox\Core\FB\Log;
29 use FireBox\Core\FB\Track;
30 use FireBox\Core\Shortcodes\Shortcodes;
31 use FireBox\Core\Libs\Translations;
32
33 /**
34 * This class is responsible for initializing FireBox.
35 *
36 * It registers all required components needed for the plugin to run.
37 */
38 final class Plugin
39 {
40 /**
41 * Holds the admin plugin.
42 *
43 * @var Admin
44 */
45 public $admin;
46
47 /**
48 * Library
49 *
50 * @var Library
51 */
52 public $library;
53
54 /**
55 * Tables
56 *
57 * @var Tables
58 */
59 public $tables;
60
61 /**
62 * Custom Post Types
63 *
64 * @var CPTS
65 */
66 public $cpts;
67
68 /**
69 * Renderer
70 *
71 * @var Renderer
72 */
73 public $renderer;
74
75 /**
76 * Box
77 *
78 * @var Box
79 */
80 public $box;
81
82 /**
83 * Boxes
84 *
85 * @var Boxes
86 */
87 public $boxes;
88
89 /**
90 * The WP Admin Menu of the Plugin
91 *
92 * @var Menu
93 */
94 public $menu;
95
96 /**
97 * Helper Classes
98 *
99 * @var HelperMiddleware
100 */
101 public $helper;
102
103 /**
104 * Gutenberg blocks
105 *
106 * @var Blocks
107 */
108 public $blocks;
109
110 /**
111 * Shortcodes
112 *
113 * @var Shortcodes
114 */
115 public $shortcodes;
116
117 /**
118 * Track
119 *
120 * @var Track
121 */
122 public $track;
123
124 /**
125 * log
126 *
127 * @var Log
128 */
129 public $log;
130
131 /**
132 * PHP Scripts
133 *
134 * @var PHPScripts
135 */
136 public $phpscripts;
137 #PRO-END
138
139 /**
140 * Translations cache
141 *
142 * @var Libs\Translations
143 */
144 private $translations_cache;
145
146 /**
147 * Tables used by Hook
148 *
149 * @var array
150 */
151 public $hook_data = [
152 'tables' => [ 'firebox_logs', 'firebox_logs_details', 'firebox_submissions', 'firebox_submission_meta' ],
153 'activation' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/firebox.sql',
154 'uninstall' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/uninstall.firebox.sql'
155 ];
156
157 /**
158 * The plugin name
159 *
160 * @var String
161 */
162 public $plugin_name = 'FireBox';
163
164 /**
165 * The plugin slug
166 *
167 * @var String
168 */
169 public $plugin_slug = 'firebox';
170
171 /**
172 * Holds the plugin instance
173 *
174 * @var Plugin $instance
175 */
176 public static $instance = null;
177
178 private function __construct()
179 {
180 $this->preFlight();
181
182 // run init
183 add_action('fpf_init', [$this, 'init']);
184
185 // admin init
186 add_action('fpf_admin_init', [$this, 'admin_init']);
187
188 // admin menu
189 add_action('admin_menu', [$this, 'admin_menu']);
190 }
191
192 /**
193 * Admin Menu
194 *
195 * @return void
196 */
197 public function admin_menu()
198 {
199 $this->menu = new PluginMenu();
200 $this->menu->init();
201 }
202
203 /**
204 * Admin Init
205 *
206 * @return void
207 */
208 public function admin_init()
209 {
210 new \FPFramework\Admin\Includes\UpgradeProModal($this->plugin_slug, $this->plugin_name);
211
212
213 new \FireBox\Core\Admin\Includes\UpgradeToPlanModal();
214
215
216 // Admin
217 $this->admin = new Admin();
218
219 // Library
220 $this->library = new Library();
221 }
222
223 /**
224 * Runs at the start of the Plugin
225 *
226 * @return void
227 */
228 public function preFlight()
229 {
230 // loads text domain
231 add_action('plugins_loaded', [$this, 'loadTextdomain'], 10);
232
233
234 }
235
236 /**
237 * Ensures only one instance of the plugin class is loaded or can be loaded
238 *
239 * @return Plugin An instance of the class.
240 */
241 public static function instance()
242 {
243 if (is_null(self::$instance))
244 {
245 self::$instance = new self();
246 }
247
248 return self::$instance;
249 }
250
251 /**
252 * Loads the textdomain
253 *
254 * @return void
255 */
256 public function loadTextdomain()
257 {
258 load_plugin_textdomain('firebox', false, FBOX_PLUGIN_DIR . 'languages/');
259 }
260
261 /**
262 * Initializes all Common components used by front-end and back-end.
263 *
264 * @return void
265 */
266 private function initCommons()
267 {
268 new AdminBarMenu();
269
270 // Tables
271 $this->tables = new Tables();
272
273 // Shortcodes
274 $this->shortcodes = new Shortcodes();
275
276 // Log
277 $this->log = new Log();
278
279 new API\API();
280
281
282
283 // Register Custom Post Type
284 new \FireBox\Core\Admin\Includes\Cpts\Firebox();
285
286 // Renderer
287 $this->renderer = new Renderer(FBOX_LAYOUTS_DIR);
288
289 // Box
290 $this->box = new Box();
291
292 // Boxes
293 $this->boxes = new Boxes();
294
295 // Helper
296 $this->helper = new HelperMiddleware();
297
298 // Gutenberg Blocks
299 $this->blocks = new Blocks();
300
301 // Forms AJAX
302 new \FireBox\Core\Form\Ajax();
303
304 // Analytics AJAX
305 new \FireBox\Core\Analytics\Ajax();
306
307 // Track
308 $this->track = new Track();
309
310
311
312 // Usage Tracking
313 $usageTracking = new \FireBox\Core\UsageTracking\SendUsage();
314 $usageTracking->maybeStart();
315
316 new FB\Meta();
317 }
318
319 /**
320 * Initializes FireBox Plugin with the required components
321 *
322 * @return void
323 */
324 public function init()
325 {
326 // init framework
327 \FPFramework\Framework::getInstance($this->plugin_slug);
328
329 // common classes (both front/back end)
330 $this->initCommons();
331
332 // Load front-end
333 new Frontend();
334 }
335
336 /**
337 * Retrieves the translation of $text
338 *
339 * @param string $text
340 * @param string $fallback
341 *
342 * @return string
343 */
344 public function _($text, $fallback = null)
345 {
346 // check if translations instance exists
347 if (!isset($this->translations_cache))
348 {
349 // set translations
350 $this->translations_cache = new Libs\Translations();
351 }
352
353 return $this->translations_cache->_($text, $fallback);
354 }
355 }
356 }
357
358 namespace {
359 /**
360 * The function which returns the one and only FireBox instance.
361 *
362 * @return Plugin
363 */
364 function firebox()
365 {
366 return FireBox\Core\Plugin::instance();
367 }
368 }