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
← All changes | Inc/Core/Frontend.php +11 -94 trunk2.1.4 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 3.1.13 Free
4 + * @version 2.1.4 Free
5 5 *
6 6 * @author FirePlugins <info@fireplugins.com>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2026 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2024 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;
@@ -15,8 +15,10 @@
15 15 {
16 16 exit; // Exit if accessed directly.
17 17 }
18 18
19 +use FPFramework\Libs\Registry;
20 +
19 21 class Frontend
20 22 {
21 23 public function __construct()
22 24 {
@@ -25,46 +27,8 @@
25 27 {
26 28 return;
27 29 }
28 30
29 - // Keep FireBox assets out of WP Rocket's JS delay/defer/minify and CSS optimizations
30 - new \FireBox\Core\Libs\WPRocket();
31 -
32 - wp_register_script(
33 - 'firebox-main',
34 - FBOX_MEDIA_PUBLIC_URL . 'js/firebox.js',
35 - [],
36 - FBOX_VERSION,
37 - ['in_footer' => true, 'strategy' => 'defer']
38 - );
39 -
40 - // The session stamper on its own, for pages where no campaign renders but a
41 - // campaign elsewhere depends on the session cookies staying accurate.
42 - wp_register_script(
43 - 'firebox-session-stamp',
44 - FBOX_MEDIA_PUBLIC_URL . 'js/session-stamp.js',
45 - [],
46 - FBOX_VERSION,
47 - ['in_footer' => true, 'strategy' => 'defer']
48 - );
49 -
50 - /**
51 - * The session stamper writes the cookies PHP reads back
52 - * (FPFramework\Base\Factory\Session), so it has to name and scope them
53 - * the same way. Attached to both handles because either one can carry
54 - * the stamper: it is bundled into the runtime and also ships alone.
55 - */
56 - $scope = wp_json_encode([
57 - 'name_prefix' => \FPFramework\Helpers\CookieScope::name(''),
58 - 'path' => \FPFramework\Helpers\CookieScope::path(),
59 - 'domain' => \FPFramework\Helpers\CookieScope::domain()
60 - ]);
61 -
62 - foreach (['firebox-main', 'firebox-session-stamp'] as $handle)
63 - {
64 - wp_add_inline_script($handle, 'window.fpfCookieScope = ' . $scope . ';', 'before');
65 - }
66 -
67 31 // Prepare Gutenberg Blocks that contain attributes by FireBox
68 32 new \FireBox\Core\FB\BoxBlocksParser();
69 33
70 34 /**
@@ -71,57 +35,17 @@
71 35 * Event that runs before any rendering of popups.
72 36 */
73 37 do_action('firebox/boxes/before_render');
74 38
75 - // Run Actions
39 + $this->render();
40 +
76 41 \FireBox\Core\Helpers\Actions::run();
77 42
78 - add_action('template_redirect', [$this, 'render']);
79 -
80 - add_action('wp_enqueue_scripts', [$this, 'enqueueEmbedStylesEarly']);
81 -
82 43 /**
83 44 * Event that runs after popups have been rendered.
84 45 */
85 46 do_action('firebox/boxes/after_render');
86 47 }
87 -
88 - /**
89 - * Enqueues the embed-mode campaign CSS early (wp_enqueue_scripts, before wp_head closes)
90 - * when the currently queried post/page contains an Embed Campaign block. This avoids a
91 - * flash of unstyled content, since renderEmbed() otherwise only enqueues this CSS later,
92 - * during content rendering.
93 - *
94 - * @return void
95 - */
96 - public function enqueueEmbedStylesEarly()
97 - {
98 - $post = get_queried_object();
99 -
100 - if (!($post instanceof \WP_Post))
101 - {
102 - return;
103 - }
104 -
105 - if (!has_block('firebox/embed', $post))
106 - {
107 - return;
108 - }
109 -
110 - wp_enqueue_style(
111 - 'firebox',
112 - FBOX_MEDIA_PUBLIC_URL . 'css/firebox.css',
113 - [],
114 - FBOX_VERSION
115 - );
116 -
117 - wp_enqueue_style(
118 - 'fb-block-embed-campaign',
119 - FBOX_MEDIA_PUBLIC_URL . 'css/blocks/embed-campaign.css',
120 - [],
121 - FBOX_VERSION
122 - );
123 - }
124 48
125 49 /**
126 50 * Renders all boxes on front-end
127 51 *
@@ -139,8 +63,11 @@
139 63 {
140 64 return;
141 65 }
142 66
67 + // increment session counter
68 + \FPFramework\Libs\Functions::incrementSession();
69 +
143 70 /**
144 71 * Adds all boxes at the end of page.
145 72 */
146 73 firebox()->boxes->render();
@@ -153,13 +80,9 @@
153 80 */
154 81 private function canRenderInEditors()
155 82 {
156 83 // Don't render the popup if previewing with Elementor
157 - if (class_exists('\Elementor\Plugin') &&
158 - property_exists(\Elementor\Plugin::$instance, 'preview') &&
159 - method_exists(\Elementor\Plugin::$instance->preview, 'is_preview_mode') &&
160 - \Elementor\Plugin::$instance->preview->is_preview_mode()
161 - )
84 + if (class_exists('\Elementor\Plugin') && \Elementor\Plugin::$instance->preview->is_preview_mode())
162 85 {
163 86 return;
164 87 }
165 88
@@ -167,14 +90,8 @@
167 90 if (class_exists('\FLBuilderModel') && method_exists('\FLBuilderModel', 'is_builder_active') && \FLBuilderModel::is_builder_active())
168 91 {
169 92 return;
170 93 }
171 -
172 - // Don't render the popup if previewing with Bricks Builder
173 - if (function_exists('bricks_is_builder') && bricks_is_builder())
174 - {
175 - return;
176 - }
177 94
178 95 return true;
179 96 }
180 97
@@ -187,5 +104,5 @@
187 104 {
188 105 $previewer = new Previewer();
189 106 return $previewer->init();
190 107 }
191 -}
108 +}