PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.1.39
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.1.39
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/Previewer.php +32 -17 1.0.102.1.39 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 1.0.10 Free
4 + * @version 2.1.39 Free
5 5 *
6 6 * @author FirePlugins <info@fireplugins.com>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2022 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2025 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,11 +15,10 @@
15 15 {
16 16 exit; // Exit if accessed directly.
17 17 }
18 18
19 -use \FPFramework\Libs\Registry;
20 -
21 -class Previewer {
19 +class Previewer
20 +{
22 21 /**
23 22 * FireBox data.
24 23 *
25 24 * @var array
@@ -48,30 +47,40 @@
48 47 * @return boolean
49 48 */
50 49 public function is_preview_page()
51 50 {
51 + global $post;
52 + $post_type = isset($_GET['post_type']) ? sanitize_key($_GET['post_type']) : false; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
53 + $post_id = isset($_GET['p']) ? \absint($_GET['p']) : false; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
54 +
55 + if (!$post_type && !$post_id && $post)
56 + {
57 + $post_type = $post->post_type;
58 + $post_id = $post->ID;
59 + }
60 +
52 61 // Only proceed if we have a item to preview
53 - if (empty($_GET['post_type']))
62 + if (empty($post_type))
54 63 {
55 64 return false;
56 65 }
57 66
58 - if ($_GET['post_type'] != 'firebox')
67 + if ($post_type != 'firebox')
59 68 {
60 69 return false;
61 70 }
62 71
63 - if (empty($_GET['p']))
72 + if (empty($post_id))
64 73 {
65 74 return false;
66 75 }
67 76
68 - if (empty($_GET['preview']))
77 + if (empty($_GET['preview'])) //phpcs:ignore WordPress.Security.NonceVerification.Recommended
69 78 {
70 79 return false;
71 80 }
72 81
73 - if (!$_GET['preview'])
82 + if (!sanitize_key(wp_unslash($_GET['preview']))) //phpcs:ignore WordPress.Security.NonceVerification.Recommended
74 83 {
75 84 return false;
76 85 }
77 86
@@ -85,11 +94,9 @@
85 94 {
86 95 return false;
87 96 }
88 97
89 - $box_id = \absint($_GET['p']); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
90 -
91 - if (!$this->box_data = firebox()->box->get($box_id))
98 + if (!$this->box_data = firebox()->box->get($post_id))
92 99 {
93 100 return false;
94 101 }
95 102
@@ -102,17 +109,25 @@
102 109 * @return void
103 110 */
104 111 public function hooks()
105 112 {
106 - // Remove assignments
113 + // Set to trigger on Page Load
114 + $this->box_data->params->set('triggermethod', 'pageload');
115 + // Remove Impressions
116 + $this->box_data->params->set('assign_impressions_param_type', 'always');
117 + // Remove Assignments
107 118 $this->box_data->params->remove('assignments');
119 + // Remove Rules
120 + $this->box_data->params->remove('rules');
108 121 // Enable Test Mode to prevent cookies
109 122 $this->box_data->params->set('testmode', true);
110 123 // Disable Statistics to prevent impressions from being tracked into the database
111 124 $this->box_data->params->set('stats', 0);
112 125
113 - firebox()->box->render($this->box_data);
126 + \FireBox\Core\Helpers\Actions::run();
114 127
128 + firebox()->box->setBox($this->box_data)->render();
129 +
115 130 \add_filter('the_title', [$this, 'the_title'], 100, 1);
116 131
117 132 \add_filter('the_content', [$this, 'the_content'], 999);
118 133
@@ -129,9 +144,9 @@
129 144 if (!current_user_can('manage_options'))
130 145 {
131 146 return '';
132 147 }
133 -
148 +
134 149 $links = [];
135 150
136 151 $links[] = [
137 152 'url' => esc_url(
@@ -192,9 +207,9 @@
192 207 if (in_the_loop())
193 208 {
194 209 $title = sprintf(
195 210 esc_html('%s'),
196 - ! empty($this->box_data->post_title) ? sanitize_text_field($this->box_data->post_title) . ' ' . firebox()->_('FB_PREVIEW') : esc_html(firebox()->_('FB_FIREBOX_POPUP_PREVIEW'))
211 + ! empty($this->box_data->post_title) ? sanitize_text_field($this->box_data->post_title) . ' ' . firebox()->_('FB_PREVIEW') : esc_html(firebox()->_('FB_FIREBOX_CAMPAIGN_PREVIEW'))
197 212 );
198 213 }
199 214
200 215 return $title;