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/Controllers/BoxSettings.php +11 -112 3.1.72.1.4 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 3.1.7 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\Controllers;
@@ -21,10 +21,8 @@
21 21 use FPFramework\Base\Ui\Tabs;
22 22
23 23 class BoxSettings extends BaseController
24 24 {
25 - protected $action = '';
26 -
27 25 /**
28 26 * The form settings name
29 27 *
30 28 * @var string
@@ -30,13 +28,8 @@
30 28 * @var string
31 29 */
32 30 const settings_name = 'firebox_settings';
33 31
34 - public function __construct()
35 - {
36 - add_action('update_option_firebox_settings', [$this, 'after_update_settings'], 10, 3);
37 - }
38 -
39 32 /**
40 33 * Render the page content
41 34 *
42 35 * @return void
@@ -49,25 +42,8 @@
49 42 // render layout
50 43 firebox()->renderer->admin->render('pages/settings');
51 44 }
52 45
53 - /**
54 - * Stop the usage tracking if the user disables the tracking behavior.
55 - *
56 - * @param array $old_value
57 - * @param array $new_value
58 - *
59 - * @return void
60 - */
61 - public function after_update_settings($old_value, $new_value)
62 - {
63 - if (isset($new_value['usage_tracking']) && !$new_value['usage_tracking'])
64 - {
65 - $tracking = new \FireBox\Core\UsageTracking\SendUsage();
66 - $tracking->stop();
67 - }
68 - }
69 -
70 46 /**
71 47 * Load required media files
72 48 *
73 49 * @return void
@@ -82,53 +58,8 @@
82 58 FPF_VERSION,
83 59 false
84 60 );
85 61 wp_enqueue_script('fpf-geoip');
86 -
87 - wp_register_script(
88 - 'firebox-settings-integrations',
89 - FBOX_MEDIA_ADMIN_URL . 'js/integrations_settings.js',
90 - [],
91 - FBOX_VERSION,
92 - true
93 - );
94 - wp_enqueue_script('firebox-settings-integrations');
95 -
96 - wp_register_style(
97 - 'firebox-settings-integrations',
98 - FBOX_MEDIA_ADMIN_URL . 'css/integrations_settings.css',
99 - [],
100 - FBOX_VERSION
101 - );
102 - wp_enqueue_style('firebox-settings-integrations');
103 -
104 - $integrations = [];
105 - foreach (\FireBox\Core\Helpers\Integrations::getSettingsManagedIntegrations() as $integration)
106 - {
107 - $integrations[$integration['slug']] = [
108 - 'label' => $integration['label'],
109 - 'connected' => !empty($integration['connected']),
110 - 'locked' => !empty($integration['locked']),
111 - 'connection_type' => isset($integration['connection_type']) ? $integration['connection_type'] : 'api_key',
112 - 'docs_url' => isset($integration['docs_url']) ? $integration['docs_url'] : ''
113 - ];
114 - }
115 -
116 - $data = [
117 - 'ajax_url' => admin_url('admin-ajax.php'),
118 - 'settings_url' => admin_url('admin.php?page=firebox-settings#integrations'),
119 - 'nonce' => wp_create_nonce('fpf_js_nonce'),
120 - 'i18n' => [
121 - 'connected' => firebox()->_('FB_INTEGRATION_CONNECTED'),
122 - 'disconnected' => firebox()->_('FB_INTEGRATION_DISCONNECTED'),
123 - 'could_not_connect' => firebox()->_('FB_INTEGRATION_ERROR_CONNECT'),
124 - 'could_not_disconnect' => firebox()->_('FB_INTEGRATION_ERROR_DISCONNECT'),
125 - 'please_enter_api_key' => fpframework()->_('FPF_PLEASE_ENTER_AN_API_KEY')
126 - ],
127 - 'integrations' => $integrations
128 - ];
129 -
130 - wp_localize_script('firebox-settings-integrations', 'firebox_integrations_settings', $data);
131 62 }
132 63
133 64 /**
134 65 * Callback used to handle the processing of settings.
@@ -139,52 +70,22 @@
139 70 * @return void
140 71 */
141 72 public function processBoxSettings($input)
142 73 {
143 - if (isset($_REQUEST['action']) && in_array($_REQUEST['action'], ['firebox_download_key_notice_activate', 'firebox_enable_usage_tracking']))
144 - {
145 - return $input;
146 - }
147 -
148 - $input = is_array($input) ? $input : [];
149 - $is_settings_form_submit = isset($_POST['option_page']) && sanitize_text_field(wp_unslash($_POST['option_page'])) === self::settings_name;
150 -
151 - // Allow programmatic updates (e.g. AJAX integration connect/disconnect) without settings form nonce.
152 - if (!$is_settings_form_submit)
74 + // create a unique db option to use it on all plugins to fetch the geo license key
75 + $geo_license_key = '';
76 + if (isset($input['geo_license_key']) && !empty($input['geo_license_key']))
153 77 {
154 - return $input;
78 + $geo_license_key = $input['geo_license_key'];
155 79 }
156 -
157 - // run a quick security check
158 - if (!check_admin_referer('fpf_form_nonce_firebox_settings', 'fpf_form_nonce_firebox_settings'))
159 - {
160 - return; // get out if we didn't click the Activate button
161 - }
80 + update_option('fpf_geo_license_key', $geo_license_key);
162 81
163 - // Disable usage tracking
164 - if (!isset($input['usage_tracking']))
165 - {
166 - $tracking = new \FireBox\Core\UsageTracking\SendUsage();
167 - $tracking->stop();
168 - }
169 -
170 82
171 83
172 - // Preserve integration keys managed through AJAX connect/disconnect.
173 - $stored_settings = get_option('firebox_settings', []);
174 - $stored_settings = is_array($stored_settings) ? $stored_settings : [];
175 - foreach (\FireBox\Core\Helpers\Integrations::getSettingsKeys() as $key)
176 - {
177 - if (!array_key_exists($key, $input) && isset($stored_settings[$key]))
178 - {
179 - $input[$key] = $stored_settings[$key];
180 - }
181 - }
182 -
183 84 // Filters the fields value
184 85 \FPFramework\Helpers\FormHelper::filterFields($input, \FireBox\Core\Admin\Forms\Settings::getSettings());
185 86
186 - \FPFramework\Libs\AdminNotice::displaySuccess(fpframework()->_('FPF_SETTINGS_SAVED'));
87 + add_settings_error(self::settings_name, 'settings_updated', fpframework()->_('FPF_SETTINGS_SAVED'), 'success');
187 88
188 89 return $input;
189 90 }
190 91
@@ -197,10 +98,9 @@
197 98 */
198 99 public function settingsPageContent()
199 100 {
200 101 $fieldsParser = new FieldsParser([
201 - 'fields_name_prefix' => 'firebox_settings',
202 - 'fields_path' => ['\\FireBox\\Core\\Fields\\']
102 + 'fields_name_prefix' => 'firebox_settings'
203 103 ]);
204 104
205 105 $settings = \FireBox\Core\Admin\Forms\Settings::getSettings();
206 106 foreach ($settings['data'] as $key => $value)
@@ -221,8 +121,7 @@
221 121 $form = new Form($tabs->render(), [
222 122 'section_name' => self::settings_name
223 123 ]);
224 124
225 - echo $form->render(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
125 + echo $form->render();
226 126 }
227 -
228 -}
127 +}