PluginProbe
Import WP – CSV & XML Import Export for WordPress / 2.15.0
Import WP – CSV & XML Import Export for WordPress v2.15.0
2.15.1 2.15.0 2.14.24 2.14.23 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 2.9.1 All 144 releases
← All changes | class/Common/Addon/AddonBasePanel.php +26 -5 2.7.1 → 2.15.0 View file →
@@ -1,8 +1,11 @@
1 1 <?php
2 2
3 3 namespace ImportWP\Common\Addon;
4 4
5 +/**
6 + * @deprecated 2.14.0
7 + */
5 8 class AddonBasePanel extends AddonBaseContainer implements AddonPanelInterface
6 9 {
7 10 /**
8 11 * @var callable
@@ -25,8 +28,15 @@
25 28 * @var \ImportWP\Common\Importer\ParsedData
26 29 */
27 30 protected $_process_data;
28 31
32 + /**
33 + * If a panel field has permission, then the group also should have permission
34 + *
35 + * @var bool
36 + */
37 + protected $_panel_has_permission = false;
38 +
29 39 public function __construct($addon, $callback, $id, $data)
30 40 {
31 41 $this->_id = $id;
32 42 $this->_register_callback = $callback;
@@ -210,8 +220,9 @@
210 220 $group_fields = $this->fields();
211 221 $repeatable = $this->is_repeatable();
212 222
213 223 $this->_process_data = $data;
224 + $this->_panel_has_permission = false;
214 225
215 226 $rows = $data->getData($section_id);
216 227 if ($repeatable) {
217 228 foreach ($rows as $i => $row) {
@@ -220,13 +231,20 @@
220 231 } else {
221 232 $this->_process_fields($id, $group_fields, $section_id, $rows, $importer_model, $template, false);
222 233 }
223 234
224 - // check permissions before calling save
225 - $permission_key = $section_id;
226 - $allowed = $this->_process_data->permission()->validate([$permission_key => ''], $this->_process_data->getMethod(), $section_id);
227 - $is_allowed = isset($allowed[$permission_key]) ? true : false;
235 + $is_allowed = $this->_panel_has_permission;
228 236
237 + // groups that do not process fields without the callback, can be allowed with this key
238 + if (!$is_allowed) {
239 +
240 + // check permissions before calling save
241 + $permission_key = $section_id;
242 + $allowed = $this->_process_data->permission()->validate([$permission_key => ''], $this->_process_data->getMethod(), $section_id);
243 + $is_allowed = isset($allowed[$permission_key]) ? true : false;
244 + }
245 +
246 +
229 247 if ($is_allowed) {
230 248 $this->_trigger_process_callback($id, $rows, $importer_model, $template);
231 249 }
232 250
@@ -269,8 +287,10 @@
269 287 if (!$is_allowed) {
270 288 continue;
271 289 }
272 290
291 + $this->_panel_has_permission = true;
292 +
273 293 $group_field->_process($this->addon(), $id, $section_id, $data, $importer_model, $template, $i);
274 294 }
275 295 }
276 296
@@ -275,7 +295,8 @@
275 295 }
276 296
277 297 public function clear()
278 298 {
279 - unset($this->_data);
299 + // Removed due to clearing setitngs and other important data.
300 + // unset($this->_data);
280 301 }
281 302 }