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