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 +42 -141 1.1.0 → 3.1.14 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 1.1.0 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 © 2022 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
@@ -16,20 +16,14 @@
16 16 exit; // Exit if accessed directly.
17 17 }
18 18
19 19 use FPFramework\Framework;
20 - use FPFramework\Admin\Includes\MetaboxManager;
21 - use FPFramework\Libs\FPGeoIP;
22 20 use FPFramework\Base\Renderer;
23 21
24 22 use FireBox\Core\Admin\Admin;
25 23 use FireBox\Core\Admin\Includes\Library;
26 - use FireBox\Core\Admin\Includes\Metaboxes as PluginMetaboxes;
27 24 use FireBox\Core\Admin\Includes\Cpts\Cpts;
28 -
29 - use FireBox\Core\Admin\Analytics\Overview\Overview as AnalyticsOverview;
30 25 use FireBox\Core\Admin\Menu\PluginMenu;
31 - use FireBox\Core\Admin\Maintenance;
32 26 use FireBox\Core\FB\Box;
33 27 use FireBox\Core\FB\Boxes;
34 28 use FireBox\Core\FB\Log;
35 29 use FireBox\Core\FB\Track;
@@ -78,29 +72,8 @@
78 72 */
79 73 public $renderer;
80 74
81 75 /**
82 - * Plugin Metaboxes
83 - *
84 - * @var Metaboxes
85 - */
86 - public $plugin_metaboxes;
87 -
88 - /**
89 - * Metaboxes Manager
90 - *
91 - * @var MetaboxManager
92 - */
93 - public $metaboxes_manager;
94 -
95 - /**
96 - * Maintenance
97 - *
98 - * @var Maintenance
99 - */
100 - public $maintenance;
101 -
102 - /**
103 76 * Box
104 77 *
105 78 * @var Box
106 79 */
@@ -120,22 +93,8 @@
120 93 */
121 94 public $menu;
122 95
123 96 /**
124 - * The geolocation class
125 - *
126 - * @var GeoIP
127 - */
128 - public $fpgeoip;
129 -
130 - /**
131 - * The REST API.
132 - *
133 - * @var RESTAPI
134 - */
135 - public $api;
136 -
137 - /**
138 97 * Helper Classes
139 98 *
140 99 * @var HelperMiddleware
141 100 */
@@ -148,15 +107,8 @@
148 107 */
149 108 public $blocks;
150 109
151 110 /**
152 - * Widgets
153 - *
154 - * @var Widgets
155 - */
156 - public $widgets;
157 -
158 - /**
159 111 * Shortcodes
160 112 *
161 113 * @var Shortcodes
162 114 */
@@ -178,13 +130,13 @@
178 130
179 131
180 132
181 133 /**
182 - * Translations
134 + * Translations cache
183 135 *
184 - * @var Translations
136 + * @var Libs\Translations
185 137 */
186 - public $translations;
138 + private $translations_cache;
187 139
188 140 /**
189 141 * Tables used by Hook
190 142 *
@@ -189,10 +141,10 @@
189 141 * Tables used by Hook
190 142 *
191 143 * @var array
192 144 */
193 - private $hook_data = [
194 - 'tables' => [ 'firebox_logs' ],
145 + public $hook_data = [
146 + 'tables' => [ 'firebox_logs', 'firebox_logs_details', 'firebox_submissions', 'firebox_submission_meta' ],
195 147 'activation' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/firebox.sql',
196 148 'uninstall' => FBOX_PLUGIN_DIR . 'Inc/Core/Admin/sql/uninstall.firebox.sql'
197 149 ];
198 150
@@ -248,19 +200,19 @@
248 200 * @return void
249 201 */
250 202 public function admin_init()
251 203 {
204 + new \FPFramework\Admin\Includes\UpgradeProModal($this->plugin_slug, $this->plugin_name);
205 +
252 206
253 - new \FPFramework\Admin\Includes\UpgradeProModal($this->plugin_slug, $this->plugin_name);
207 + new \FireBox\Core\Admin\Includes\UpgradeToPlanModal();
254 208
255 209
256 210 // Admin
257 211 $this->admin = new Admin();
258 212
259 - // Metaboxes
260 - $this->metaboxes_manager = new MetaboxManager();
261 - $this->plugin_metaboxes = new PluginMetaboxes();
262 - $this->metaboxes_manager->init();
213 + // Library
214 + $this->library = new Library();
263 215 }
264 216
265 217 /**
266 218 * Runs at the start of the Plugin
@@ -268,50 +220,15 @@
268 220 * @return void
269 221 */
270 222 public function preFlight()
271 223 {
272 - // set translations
273 - $this->translations = new Libs\Translations();
274 -
275 224 // loads text domain
276 225 add_action('plugins_loaded', [$this, 'loadTextdomain'], 10);
277 226
278 - // show rate reminder after user has activated the plugin
279 - add_action('activated_plugin', [$this, 'set_rate_reminder']);
280 -
281 - // adds plugin translation class to the framework set of translate classes
282 - add_filter('fpframework/set_translation_paths', [$this, 'setTranslationsPaths']);
283 -
284 - // Widgets
285 - $this->widgets = new Widgets();
286 -
287 - if (is_admin())
288 - {
289 - // Run Activation/Deactivation procedures
290 - $this->maintenance = new Maintenance($this->hook_data);
291 - $this->maintenance->init();
292 - }
227 +
293 228 }
294 229
295 230 /**
296 - * Set rate reminder transient on plugin activation.
297 - *
298 - * @return void
299 - */
300 - public function set_rate_reminder()
301 - {
302 - if( get_transient( 'fpf_firebox_rate_reminder_deleted' ) || get_transient( 'fpf_firebox_rate_reminder' ) )
303 - {
304 - return;
305 - }
306 -
307 - // make rate reminder appear 2 days after the plugin has been activated.
308 - $date = new \DateTime();
309 - $date->add( new \DateInterval( 'P2D' ) );
310 - set_transient( 'fpf_firebox_rate_reminder', $date->format( 'Y-m-d' ) );
311 - }
312 -
313 - /**
314 231 * Ensures only one instance of the plugin class is loaded or can be loaded
315 232 *
316 233 * @return Plugin An instance of the class.
317 234 */
@@ -343,11 +260,8 @@
343 260 private function initCommons()
344 261 {
345 262 new AdminBarMenu();
346 263
347 - // Library
348 - $this->library = new Library();
349 -
350 264 // Tables
351 265 $this->tables = new Tables();
352 266
353 267 // Shortcodes
@@ -355,14 +269,18 @@
355 269
356 270 // Log
357 271 $this->log = new Log();
358 272
359 - // REST API
360 - $this->api = new RESTAPI();
273 + new API\API();
274 +
275 +
361 276
362 - // Custom Post Types
363 - $this->cpts = new Cpts();
364 - $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();
365 283
366 284 // Renderer
367 285 $this->renderer = new Renderer(FBOX_LAYOUTS_DIR);
368 286
@@ -371,11 +289,8 @@
371 289
372 290 // Boxes
373 291 $this->boxes = new Boxes();
374 292
375 - // FPGeo IP
376 - $this->fpgeoip = new FPGeoIP();
377 -
378 293 // Helper
379 294 $this->helper = new HelperMiddleware();
380 295
381 296 // Gutenberg Blocks
@@ -380,24 +295,24 @@
380 295
381 296 // Gutenberg Blocks
382 297 $this->blocks = new Blocks();
383 298
299 + // Forms AJAX
300 + new \FireBox\Core\Form\Ajax();
301 +
302 + // Analytics AJAX
303 + new \FireBox\Core\Analytics\Ajax();
304 +
384 305 // Track
385 306 $this->track = new Track();
386 307
387 - // Initialize Analytics
388 - global $wpdb;
389 - $analytics_configuration = [
390 - 'boxes_table' => $wpdb->prefix . 'posts',
391 - 'logs_table' => firebox()->tables->boxlog->getFullTableName(),
392 - 'logs_details_table' => firebox()->tables->boxlogdetails->getFullTableName(),
393 - 'nonce_value' => wp_create_nonce('fb-analytics-nonce'),
394 - ];
395 308
396 -
397 -
398 - // Initialize Analytics Overview
399 - $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();
400 315 }
401 316
402 317 /**
403 318 * Initializes FireBox Plugin with the required components
@@ -416,29 +331,8 @@
416 331 new Frontend();
417 332 }
418 333
419 334 /**
420 - * Append our Plugin translation class to the set of translation classes of the Framework
421 - *
422 - * @param array
423 - *
424 - * @return array
425 - */
426 - public function setTranslationsPaths($paths)
427 - {
428 - if (isset($paths['firebox']))
429 - {
430 - return $paths;
431 - }
432 -
433 - $paths['firebox'] = [
434 - 'prefix' => 'FB_'
435 - ];
436 -
437 - return $paths;
438 - }
439 -
440 - /**
441 335 * Retrieves the translation of $text
442 336 *
443 337 * @param string $text
444 338 * @param string $fallback
@@ -446,9 +340,16 @@
446 340 * @return string
447 341 */
448 342 public function _($text, $fallback = null)
449 343 {
450 - 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);
451 352 }
452 353 }
453 354 }
454 355