PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.1.0
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.1.0
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 +21 -95 1.0.42.1.0 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 1.0.4 Free
4 + * @version 2.1.0 Free
5 5 *
6 6 * @author FirePlugins <info@fireplugins.com>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2021 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2023 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;
@@ -27,40 +27,24 @@
27 27 {
28 28 return;
29 29 }
30 30
31 - $this->init_dependencies();
31 + // Prepare Gutenberg Blocks that contain attributes by FireBox
32 + new \FireBox\Core\FB\BoxBlocksParser();
32 33
33 - $this->render();
34 - }
35 -
36 - /**
37 - * Initializes the dependencies
38 - *
39 - * @return void
40 - */
41 - private function init_dependencies()
42 - {
43 34 /**
44 35 * Event that runs before any rendering of popups.
45 36 */
46 37 do_action('firebox/boxes/before_render');
47 38
48 - $actions = [];
49 -
50 -
39 + add_action('template_redirect', [$this, 'render']);
51 40
52 - // Initialize Sounds
53 - $actions[] = new \FireBox\Core\FB\Actions\Sounds();
54 -
55 - // Make actions filterable
56 - $actions = apply_filters('firebox/actions/box/edit', $actions);
57 -
58 - // Run actions
59 - new \FireBox\Core\FB\Actions\ActionsBase($actions);
41 + \FireBox\Core\Helpers\Actions::run();
60 42
61 - // Prepare Gutenberg Blocks that contain attributes by FireBox
62 - new \FireBox\Core\FB\BoxBlocksParser();
43 + /**
44 + * Event that runs after popups have been rendered.
45 + */
46 + do_action('firebox/boxes/after_render');
63 47 }
64 48
65 49 /**
66 50 * Renders all boxes on front-end
@@ -66,9 +50,9 @@
66 50 * Renders all boxes on front-end
67 51 *
68 52 * @return void
69 53 */
70 - private function render()
54 + public function render()
71 55 {
72 56 if ($this->checkForBoxPreview())
73 57 {
74 58 return;
@@ -73,27 +57,27 @@
73 57 {
74 58 return;
75 59 }
76 60
77 - if ($this->checkForBoxTemplatePreview())
61 + // Don't render the popup if previewing with Elementor
62 + if (class_exists('\Elementor\Plugin') && \Elementor\Plugin::$instance->preview->is_preview_mode())
78 63 {
79 64 return;
80 65 }
81 66
67 + // Don't render the popup if previewing with Beaver Builder
68 + if (class_exists('\FLBuilderModel') && method_exists('\FLBuilderModel', 'is_builder_active') && \FLBuilderModel::is_builder_active())
69 + {
70 + return;
71 + }
72 +
82 73 // increment session counter
83 74 \FPFramework\Libs\Functions::incrementSession();
84 -
75 +
85 76 /**
86 77 * Adds all boxes at the end of page.
87 78 */
88 - add_action('wp', function() {
89 - firebox()->boxes->render();
90 - });
91 -
92 - /**
93 - * Event that runs after popups have been rendered.
94 - */
95 - do_action('firebox/boxes/after_render');
79 + firebox()->boxes->render();
96 80 }
97 81
98 82 /**
99 83 * Check if we are previewing a box and do not show other boxes.
@@ -103,64 +87,6 @@
103 87 private function checkForBoxPreview()
104 88 {
105 89 $previewer = new Previewer();
106 90 return $previewer->init();
107 - }
108 -
109 - /**
110 - * Check if we are previewing a box template and do not show other boxes.
111 - *
112 - * @return boolean
113 - */
114 - private function checkForBoxTemplatePreview()
115 - {
116 - // Preview a box template
117 - if (!isset($_GET['firebox_preview_template']))
118 - {
119 - return false;
120 - }
121 -
122 - $preview_box = sanitize_text_field($_GET['firebox_preview_template']);
123 - $this->render_template(base64_decode($preview_box));
124 - return true;
125 - }
126 -
127 - /**
128 - * Render template content
129 - *
130 - * @param string $template_alias
131 - *
132 - * @return void
133 - */
134 - private function render_template($template_alias)
135 - {
136 - $templates = firebox()->library;
137 -
138 - if (!$box = $templates->find($template_alias))
139 - {
140 - return;
141 - }
142 -
143 - $box->params = new Registry($box->params);
144 -
145 - // Remove Publishing Assignments
146 - foreach ($box->params as $key => $value)
147 - {
148 - if (strpos($key, 'assign') !== false)
149 - {
150 - $box->params->remove($key);
151 - }
152 - }
153 - $box->params->remove('assignments');
154 -
155 - // Set id to 999999 for making front-end script happy
156 - $box->ID = 999999;
157 -
158 - // Enable Test Mode to prevent cookies
159 - $box->params->set('testmode', true);
160 -
161 - // Disable Statistics to prevent impressions from being tracked into the database
162 - $box->stats = 0;
163 -
164 - return firebox()->box->render($box);
165 91 }
166 92 }