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/Plugin.php +56 -143 1.0.1 → 3.1.14 View file →
@@ -1,16 +1,17 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 1.0.1 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 -namespace FireBox\Core {
12 +namespace FireBox\Core
13 +{
13 14 if (!defined('ABSPATH'))
14 15 {
15 16 exit; // Exit if accessed directly.
16 17 }
@@ -15,20 +16,15 @@
15 16 exit; // Exit if accessed directly.
16 17 }
17 18
18 19 use FPFramework\Framework;
19 - use FPFramework\Admin\Includes\MetaboxManager;
20 - use FPFramework\Libs\FPGeoIP;
21 20 use FPFramework\Base\Renderer;
22 21
23 22 use FireBox\Core\Admin\Admin;
24 23 use FireBox\Core\Admin\Includes\Library;
25 - use FireBox\Core\Admin\Includes\Metaboxes as PluginMetaboxes;
26 24 use FireBox\Core\Admin\Includes\Cpts\Cpts;
27 -
28 - use FireBox\Core\Admin\Analytics\Overview\Overview as AnalyticsOverview;
29 25 use FireBox\Core\Admin\Menu\PluginMenu;
30 - use FireBox\Core\Admin\Maintenance;
26 + use FireBox\Core\FB\Box;
31 27 use FireBox\Core\FB\Boxes;
32 28 use FireBox\Core\FB\Log;
33 29 use FireBox\Core\FB\Track;
34 30 use FireBox\Core\Shortcodes\Shortcodes;
@@ -55,13 +51,13 @@
55 51 */
56 52 public $library;
57 53
58 54 /**
59 - * Models
55 + * Tables
60 56 *
61 - * @var Models
57 + * @var Tables
62 58 */
63 - public $models;
59 + public $tables;
64 60
65 61 /**
66 62 * Custom Post Types
67 63 *
@@ -76,29 +72,15 @@
76 72 */
77 73 public $renderer;
78 74
79 75 /**
80 - * Plugin Metaboxes
76 + * Box
81 77 *
82 - * @var Metaboxes
78 + * @var Box
83 79 */
84 - public $plugin_metaboxes;
80 + public $box;
85 81
86 82 /**
87 - * Metaboxes Manager
88 - *
89 - * @var MetaboxManager
90 - */
91 - public $metaboxes_manager;
92 -
93 - /**
94 - * Maintenance
95 - *
96 - * @var Maintenance
97 - */
98 - public $maintenance;
99 -
100 - /**
101 83 * Boxes
102 84 *
103 85 * @var Boxes
104 86 */
@@ -111,22 +93,8 @@
111 93 */
112 94 public $menu;
113 95
114 96 /**
115 - * The geolocation class
116 - *
117 - * @var GeoIP
118 - */
119 - public $fpgeoip;
120 -
121 - /**
122 - * The REST API.
123 - *
124 - * @var RESTAPI
125 - */
126 - public $api;
127 -
128 - /**
129 97 * Helper Classes
130 98 *
131 99 * @var HelperMiddleware
132 100 */
@@ -139,15 +107,8 @@
139 107 */
140 108 public $blocks;
141 109
142 110 /**
143 - * Widgets
144 - *
145 - * @var Widgets
146 - */
147 - public $widgets;
148 -
149 - /**
150 111 * Shortcodes
151 112 *
152 113 * @var Shortcodes
153 114 */
@@ -169,13 +130,13 @@
169 130
170 131
171 132
172 133 /**
173 - * Translations
134 + * Translations cache
174 135 *
175 - * @var Translations
136 + * @var Libs\Translations
176 137 */
177 - public $translations;
138 + private $translations_cache;
178 139
179 140 /**
180 141 * Tables used by Hook
181 142 *
@@ -180,10 +141,10 @@
180 141 * Tables used by Hook
181 142 *
182 143 * @var array
183 144 */
184 - private $hook_data = [
185 - 'tables' => [ 'firebox_logs' ],
145 + public $hook_data = [
146 + 'tables' => [ 'firebox_logs', 'firebox_logs_details', 'firebox_submissions', 'firebox_submission_meta' ],
186 147 'activation' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/firebox.sql',
187 148 'uninstall' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/uninstall.firebox.sql'
188 149 ];
189 150
@@ -239,19 +200,19 @@
239 200 * @return void
240 201 */
241 202 public function admin_init()
242 203 {
204 + new \FPFramework\Admin\Includes\UpgradeProModal($this->plugin_slug, $this->plugin_name);
205 +
243 206
244 - new \FPFramework\Admin\Includes\UpgradeProModal($this->plugin_slug, $this->plugin_name);
207 + new \FireBox\Core\Admin\Includes\UpgradeToPlanModal();
245 208
246 209
247 210 // Admin
248 211 $this->admin = new Admin();
249 212
250 - // Metaboxes
251 - $this->metaboxes_manager = new MetaboxManager();
252 - $this->plugin_metaboxes = new PluginMetaboxes();
253 - $this->metaboxes_manager->init();
213 + // Library
214 + $this->library = new Library();
254 215 }
255 216
256 217 /**
257 218 * Runs at the start of the Plugin
@@ -259,50 +220,15 @@
259 220 * @return void
260 221 */
261 222 public function preFlight()
262 223 {
263 - // set translations
264 - $this->translations = new Libs\Translations();
265 -
266 224 // loads text domain
267 225 add_action('plugins_loaded', [$this, 'loadTextdomain'], 10);
268 226
269 - // show rate reminder after user has activated the plugin
270 - add_action('activated_plugin', [$this, 'set_rate_reminder']);
271 -
272 - // adds plugin translation class to the framework set of translate classes
273 - add_filter('fpframework/set_translation_paths', [$this, 'setTranslationsPaths']);
274 -
275 - // Widgets
276 - $this->widgets = new Widgets();
277 -
278 - if (is_admin())
279 - {
280 - // Run Activation/Deactivation procedures
281 - $this->maintenance = new Maintenance($this->hook_data);
282 - $this->maintenance->init();
283 - }
227 +
284 228 }
285 229
286 230 /**
287 - * Set rate reminder transient on plugin activation.
288 - *
289 - * @return void
290 - */
291 - public function set_rate_reminder()
292 - {
293 - if( get_transient( 'fpf_firebox_rate_reminder_deleted' ) || get_transient( 'fpf_firebox_rate_reminder' ) )
294 - {
295 - return;
296 - }
297 -
298 - // make rate reminder appear 2 days after the plugin has been activated.
299 - $date = new \DateTime();
300 - $date->add( new \DateInterval( 'P2D' ) );
301 - set_transient( 'fpf_firebox_rate_reminder', $date->format( 'Y-m-d' ) );
302 - }
303 -
304 - /**
305 231 * Ensures only one instance of the plugin class is loaded or can be loaded
306 232 *
307 233 * @return Plugin An instance of the class.
308 234 */
@@ -334,14 +260,11 @@
334 260 private function initCommons()
335 261 {
336 262 new AdminBarMenu();
337 263
338 - // Library
339 - $this->library = new Library();
264 + // Tables
265 + $this->tables = new Tables();
340 266
341 - // Models
342 - $this->models = new Models();
343 -
344 267 // Shortcodes
345 268 $this->shortcodes = new Shortcodes();
346 269
347 270 // Log
@@ -346,24 +269,28 @@
346 269
347 270 // Log
348 271 $this->log = new Log();
349 272
350 - // REST API
351 - $this->api = new RESTAPI();
273 + new API\API();
274 +
275 +
352 276
353 - // Custom Post Types
354 - $this->cpts = new Cpts();
355 - $this->cpts->init();
277 + // Register Custom Post Type
278 + new \FireBox\Core\Admin\Includes\Cpts\Firebox();
279 +
280 + // Keep the campaign-derived caches (box list, "session conditions in use"
281 + // flag) in sync with campaign writes
282 + \FireBox\Core\Helpers\BoxHelper::registerCacheInvalidation();
356 283
357 284 // Renderer
358 285 $this->renderer = new Renderer(FBOX_LAYOUTS_DIR);
359 286
287 + // Box
288 + $this->box = new Box();
289 +
360 290 // Boxes
361 291 $this->boxes = new Boxes();
362 292
363 - // FPGeo IP
364 - $this->fpgeoip = new FPGeoIP();
365 -
366 293 // Helper
367 294 $this->helper = new HelperMiddleware();
368 295
369 296 // Gutenberg Blocks
@@ -368,24 +295,24 @@
368 295
369 296 // Gutenberg Blocks
370 297 $this->blocks = new Blocks();
371 298
299 + // Forms AJAX
300 + new \FireBox\Core\Form\Ajax();
301 +
302 + // Analytics AJAX
303 + new \FireBox\Core\Analytics\Ajax();
304 +
372 305 // Track
373 306 $this->track = new Track();
374 307
375 - // Initialize Analytics
376 - global $wpdb;
377 - $analytics_configuration = [
378 - 'boxes_table' => $wpdb->prefix . 'posts',
379 - 'logs_table' => firebox()->models->boxlog->getFullTableName(),
380 - 'logs_details_table' => firebox()->models->boxlogdetails->getFullTableName(),
381 - 'nonce_value' => wp_create_nonce('fb-analytics-nonce'),
382 - ];
383 308
384 -
385 -
386 - // Initialize Analytics Overview
387 - $this->analytics_overview = new AnalyticsOverview($analytics_configuration);
309 +
310 + // Usage Tracking
311 + $usageTracking = new \FireBox\Core\UsageTracking\SendUsage();
312 + $usageTracking->maybeStart();
313 +
314 + new FB\Meta();
388 315 }
389 316
390 317 /**
391 318 * Initializes FireBox Plugin with the required components
@@ -404,29 +331,8 @@
404 331 new Frontend();
405 332 }
406 333
407 334 /**
408 - * Append our Plugin translation class to the set of translation classes of the Framework
409 - *
410 - * @param array
411 - *
412 - * @return array
413 - */
414 - public function setTranslationsPaths($paths)
415 - {
416 - if (isset($paths['firebox']))
417 - {
418 - return $paths;
419 - }
420 -
421 - $paths['firebox'] = [
422 - 'prefix' => 'FB_'
423 - ];
424 -
425 - return $paths;
426 - }
427 -
428 - /**
429 335 * Retrieves the translation of $text
430 336 *
431 337 * @param string $text
432 338 * @param string $fallback
@@ -434,9 +340,16 @@
434 340 * @return string
435 341 */
436 342 public function _($text, $fallback = null)
437 343 {
438 - return $this->translations->_($text, $fallback);
344 + // check if translations instance exists
345 + if (!isset($this->translations_cache))
346 + {
347 + // set translations
348 + $this->translations_cache = new Libs\Translations();
349 + }
350 +
351 + return $this->translations_cache->_($text, $fallback);
439 352 }
440 353 }
441 354 }
442 355