PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.1.14
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.1.14
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 +16 -9 1.0.142.1.14 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 1.0.14 Free
4 + * @version 2.1.14 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 © 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;
@@ -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_CAMPAIGN_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_CAMPAIGN_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 /**
@@ -121,8 +126,9 @@
121 126 * @return string
122 127 */
123 128 protected function getUploadedFileContents($tmp_name)
124 129 {
130 + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
125 131 return file_get_contents($tmp_name);
126 132 }
127 133
128 134 /**
@@ -204,7 +210,8 @@
204 210 'section_name' => self::settings_name,
205 211 'class' => 'settings-ui-inner-fields',
206 212 'button_label' => 'FPF_IMPORT'
207 213 ]);
208 - $form->render();
214 +
215 + echo $form->render();
209 216 }
210 217 }