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/BoxImport.php +35 -29 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;
@@ -49,25 +49,14 @@
49 49 * @return void
50 50 */
51 51 public function processBoxesImport($input)
52 52 {
53 - // run a quick security check
54 - if (!check_admin_referer('fpf_form_nonce_firebox_import', 'fpf_form_nonce_firebox_import'))
55 - {
56 - return; // get out if we didn't click the Activate button
57 - }
53 + $file = $this->getUploadedFile();
58 54
59 - if (!isset($_FILES['file']))
60 - {
61 - return;
62 - }
63 -
64 - $file = $_FILES['file'];
65 -
66 55 // ensure a file was given
67 56 if (!is_array($file) || !isset($file['name']) || empty($file['name']))
68 57 {
69 - \FPFramework\Libs\AdminNotice::displayError(fpframework()->_('FPF_PLEASE_SELECT_A_FILE_TO_UPLOAD'));
58 + add_settings_error(self::settings_name, 'settings_updated', fpframework()->_('FPF_PLEASE_SELECT_A_FILE_TO_UPLOAD'), 'error');
70 59 return;
71 60 }
72 61
73 62 $ext = explode('.', $file['name']);
@@ -74,9 +63,9 @@
74 63
75 64 // ensure given file plugin was given
76 65 if (!in_array($ext[count($ext) - 1], ['fbox']))
77 66 {
78 - \FPFramework\Libs\AdminNotice::displayError(fpframework()->_('FPF_PLEASE_CHOOSE_A_VALID_FILE'));
67 + add_settings_error(self::settings_name, 'settings_updated', fpframework()->_('FPF_PLEASE_CHOOSE_A_VALID_FILE'), 'error');
79 68 return;
80 69 }
81 70
82 71 $publish_all = isset($input['publish_all']) ? $input['publish_all'] : 0;
@@ -81,21 +70,20 @@
81 70
82 71 $publish_all = isset($input['publish_all']) ? $input['publish_all'] : 0;
83 72
84 73 // read file contents
85 - // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
86 - $data = file_get_contents($file['tmp_name']);
74 + $data = $this->getUploadedFileContents($file['tmp_name']);
87 75
88 76 // if empty data file then abort
89 77 if (empty($data))
90 78 {
91 - \FPFramework\Libs\AdminNotice::displayError(fpframework()->_('FPF_FILE_EMPTY'));
79 + add_settings_error(self::settings_name, 'settings_updated', fpframework()->_('FPF_FILE_EMPTY'), 'error');
92 80 return;
93 81 }
94 82
95 83 if (!$items = json_decode($data, true))
96 84 {
97 - \FPFramework\Libs\AdminNotice::displayError(firebox()->_('FB_CAMPAIGN_IMPORT_CONTENTS_ERROR'));
85 + add_settings_error(self::settings_name, 'settings_updated', firebox()->_('FB_CAMPAIGN_IMPORT_CONTENTS_ERROR'), 'error');
98 86 return;
99 87 }
100 88
101 89 if (is_null($items))
@@ -110,17 +98,40 @@
110 98
111 99 // import all boxes
112 100 if (!$new_box_id = $this->importBoxes($items, $publish_all))
113 101 {
114 - \FPFramework\Libs\AdminNotice::displayError(firebox()->_('FB_CAMPAIGN_IMPORT_CONTENTS_ERROR'));
102 + add_settings_error(self::settings_name, 'settings_updated', firebox()->_('FB_CAMPAIGN_IMPORT_CONTENTS_ERROR'), 'error');
115 103 return;
116 104 }
117 105
118 - \FPFramework\Libs\AdminNotice::displaySuccess(fpframework()->_('FPF_ITEMS_SAVED'));
106 + add_settings_error(self::settings_name, 'settings_updated', fpframework()->_('FPF_ITEMS_SAVED'), 'success');
119 107 return $new_box_id;
120 108 }
121 109
122 110 /**
111 + * Returns the uploaded file
112 + *
113 + * @return mixed
114 + */
115 + protected function getUploadedFile()
116 + {
117 + $file = isset($_FILES['file']) ? $_FILES['file'] : '';
118 + return $file;
119 + }
120 +
121 + /**
122 + * Returns the contents of the file
123 + *
124 + * @param string $tmp_name
125 + *
126 + * @return string
127 + */
128 + protected function getUploadedFileContents($tmp_name)
129 + {
130 + return file_get_contents($tmp_name);
131 + }
132 +
133 + /**
123 134 * Imports boxes data
124 135 *
125 136 * @param array $items
126 137 * @param int $publish_all
@@ -164,10 +175,8 @@
164 175
165 176 $box['post_date'] = $date_with_tz->format('Y-m-d H:i:s');
166 177 $box['post_date_gmt'] = $date_without_tz->format('Y-m-d H:i:s');
167 178
168 - \FireBox\Core\Helpers\Form\Form::ensureUniqueFormIDs($box['post_content']);
169 -
170 179 // set publish status
171 180 if (in_array($publish_all, [0, 1]))
172 181 {
173 182 $box['post_status'] = ($publish_all == 0) ? 'draft' : 'publish';
@@ -180,12 +189,9 @@
180 189 break;
181 190 }
182 191
183 192 // add meta options for new box
184 - // TODO: In the future, use "firebox_meta". This is a temporary fix for backwards compatibility.
185 - $checkMeta = (array) $meta;
186 - $meta_key = isset($checkMeta['width']) ? 'firebox_meta' : 'fpframework_meta_settings';
187 - update_post_meta($new_box_id, $meta_key, wp_slash($meta));
193 + update_post_meta($new_box_id, 'fpframework_meta_settings', wp_slash($meta));
188 194 $success = $new_box_id;
189 195 }
190 196
191 197 return $success;
@@ -204,7 +210,7 @@
204 210 'class' => 'settings-ui-inner-fields',
205 211 'button_label' => 'FPF_IMPORT'
206 212 ]);
207 213
208 - echo $form->render(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
214 + echo $form->render();
209 215 }
210 216 }