PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.0.6
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.0.6
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 +19 -12 1.0.22.0.6 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.6 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\Controllers;
@@ -54,9 +54,9 @@
54 54
55 55 // ensure a file was given
56 56 if (!is_array($file) || !isset($file['name']) || empty($file['name']))
57 57 {
58 - add_settings_error( self::settings_name, 'settings_updated', fpframework()->_('FPF_PLEASE_SELECT_A_FILE_TO_UPLOAD'), 'error');
58 + add_settings_error(self::settings_name, 'settings_updated', fpframework()->_('FPF_PLEASE_SELECT_A_FILE_TO_UPLOAD'), 'error');
59 59 return;
60 60 }
61 61
62 62 $ext = explode('.', $file['name']);
@@ -63,9 +63,9 @@
63 63
64 64 // ensure given file plugin was given
65 65 if (!in_array($ext[count($ext) - 1], ['fbox']))
66 66 {
67 - add_settings_error( self::settings_name, 'settings_updated', fpframework()->_('FPF_PLEASE_CHOOSE_A_VALID_FILE'), 'error');
67 + add_settings_error(self::settings_name, 'settings_updated', fpframework()->_('FPF_PLEASE_CHOOSE_A_VALID_FILE'), 'error');
68 68 return;
69 69 }
70 70
71 71 $publish_all = isset($input['publish_all']) ? $input['publish_all'] : 0;
@@ -75,15 +75,15 @@
75 75
76 76 // if empty data file then abort
77 77 if (empty($data))
78 78 {
79 - add_settings_error( self::settings_name, 'settings_updated', fpframework()->_('FPF_FILE_EMPTY'), 'error');
79 + add_settings_error(self::settings_name, 'settings_updated', fpframework()->_('FPF_FILE_EMPTY'), 'error');
80 80 return;
81 81 }
82 82
83 83 if (!$items = json_decode($data, true))
84 84 {
85 - add_settings_error( self::settings_name, 'settings_updated', firebox()->_('FB_POPUP_IMPORT_CONTENTS_ERROR'), 'error');
85 + add_settings_error(self::settings_name, 'settings_updated', firebox()->_('FB_POPUP_IMPORT_CONTENTS_ERROR'), 'error');
86 86 return;
87 87 }
88 88
89 89 if (is_null($items))
@@ -90,16 +90,21 @@
90 90 {
91 91 $items = [];
92 92 }
93 93
94 + if (!$items)
95 + {
96 + return;
97 + }
98 +
94 99 // import all boxes
95 100 if (!$new_box_id = $this->importBoxes($items, $publish_all))
96 101 {
97 - add_settings_error( self::settings_name, 'settings_updated', firebox()->_('FB_POPUP_IMPORT_CONTENTS_ERROR'), 'error');
102 + add_settings_error(self::settings_name, 'settings_updated', firebox()->_('FB_POPUP_IMPORT_CONTENTS_ERROR'), 'error');
98 103 return;
99 104 }
100 105
101 - add_settings_error( self::settings_name, 'settings_updated', fpframework()->_('FPF_ITEMS_SAVED'), 'success');
106 + add_settings_error(self::settings_name, 'settings_updated', fpframework()->_('FPF_ITEMS_SAVED'), 'success');
102 107 return $new_box_id;
103 108 }
104 109
105 110 /**
@@ -177,9 +182,9 @@
177 182 $box['post_status'] = ($publish_all == 0) ? 'draft' : 'publish';
178 183 }
179 184
180 185 // insert new box
181 - if (!$new_box_id = firebox()->models->box->insert((object) $box))
186 + if (!$new_box_id = firebox()->tables->box->insert((object) $box))
182 187 {
183 188 $success = false;
184 189 break;
185 190 }
@@ -199,11 +204,13 @@
199 204 */
200 205 public function settingsPageContent()
201 206 {
202 207 $form = new Form(\FireBox\Core\Admin\Forms\Import::getSettings(), [
203 - 'fields_name_prefix' => 'firebox_import',
208 + 'fields_name_prefix' => self::settings_name,
204 209 'section_name' => self::settings_name,
205 - 'class' => 'settings-ui-inner-fields'
210 + 'class' => 'settings-ui-inner-fields',
211 + 'button_label' => 'FPF_IMPORT'
206 212 ]);
207 - $form->render();
213 +
214 + echo $form->render();
208 215 }
209 216 }