PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 3.1.14
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v3.1.14
3.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 All 123 releases
← All changes | Inc/Framework/Inc/Base/FieldsParser.php +38 -35 1.0.7 → 3.1.14 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FirePlugins Framework
4 - * @version 1.0.16
4 + * @version 1.2.6
5 5 *
6 6 * @author FirePlugins <[email protected]>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2021 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2026 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 FPFramework\Base;
@@ -44,11 +44,11 @@
44 44 protected $fields_name_prefix;
45 45
46 46 public function __construct($data = [])
47 47 {
48 - $this->bind_data = isset($data['bind_data']) ? $data['bind_data'] : [];
48 + $this->bind_data = isset($data['bind_data']) ? (array) $data['bind_data'] : [];
49 49 $this->fields_path = isset($data['fields_path']) ? (array) $data['fields_path'] : null;
50 - $this->fields_name_prefix = isset($data['fields_name_prefix']) ? $data['fields_name_prefix'] : \FPFramework\Admin\Includes\MetaboxManager::$fields_prefix;
50 + $this->fields_name_prefix = isset($data['fields_name_prefix']) ? $data['fields_name_prefix'] : \FPFramework\Helpers\FieldsHelper::$fields_prefix;
51 51 }
52 52
53 53 /**
54 54 * Renders the sections, in left, plain or right orientation
@@ -78,10 +78,16 @@
78 78 * @param array $section
79 79 *
80 80 * @return void
81 81 */
82 - protected function renderSectionFields($section)
82 + public function renderSectionFields($section)
83 83 {
84 + // Hide section if set
85 + if (isset($section['hide']))
86 + {
87 + return;
88 + }
89 +
84 90 if (!isset($section['fields']))
85 91 {
86 92 return;
87 93 }
@@ -150,15 +156,15 @@
150 156 // set field name prefix
151 157 if (isset($field['name']) && !$name_clean)
152 158 {
153 159 $field['name_key'] = $field['name'];
154 -
155 - // set name prefix for the field
156 - if ($this->fields_name_prefix)
157 - {
158 - $field['name_prefix'] = $this->fields_name_prefix;
159 - }
160 160 }
161 +
162 + // set name prefix for the field
163 + if ($this->fields_name_prefix)
164 + {
165 + $field['name_prefix'] = $this->fields_name_prefix;
166 + }
161 167
162 168 // set field path
163 169 $field['field_path'] = $field_path;
164 170
@@ -192,10 +198,18 @@
192 198 * @return mixed
193 199 */
194 200 private function getFieldPath($field)
195 201 {
202 + static $resolved = [];
203 +
196 204 $field_type = $field['type'];
205 + $cache_key = $field_type . '|' . implode(',', (array) $this->fields_path);
197 206
207 + if (array_key_exists($cache_key, $resolved))
208 + {
209 + return $resolved[$cache_key];
210 + }
211 +
198 212 if ($this->fields_path && is_array($this->fields_path))
199 213 {
200 214 foreach ($this->fields_path as $fields_path)
201 215 {
@@ -204,9 +218,9 @@
204 218 {
205 219 continue;
206 220 }
207 221
208 - return $fields_path;
222 + return $resolved[$cache_key] = $fields_path;
209 223 }
210 224 }
211 225
212 226 // check framework
@@ -212,12 +226,12 @@
212 226 // check framework
213 227 $framework_fields_path = '\\FPFramework\\Base\\Fields\\';
214 228 if (class_exists($framework_fields_path . $field_type))
215 229 {
216 - return $framework_fields_path;
230 + return $resolved[$cache_key] = $framework_fields_path;
217 231 }
218 -
219 - return false;
232 +
233 + return $resolved[$cache_key] = false;
220 234 }
221 235
222 236 /**
223 237 * Gets the value from bind data based on field name
@@ -241,10 +255,8 @@
241 255 {
242 256 return null;
243 257 }
244 258
245 - $this->bind_data = (array) $this->bind_data;
246 -
247 259 // split name as format is key.key2.key3
248 260 $splitted_name = explode('.', $name);
249 261
250 262 // make sure we splitted the name and have data to use
@@ -325,19 +337,14 @@
325 337
326 338 // render div openings
327 339 if ($outer_classes)
328 340 {
329 - echo HTML::renderStartDiv([
330 - 'showon' => $showon,
331 - 'class' => $outer_classes
332 - ]);
341 + echo HTML::renderStartDiv(['showon' => $showon, 'class' => $outer_classes]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
333 342 }
334 343
335 344 if ($inner_classes)
336 345 {
337 - echo HTML::renderStartDiv([
338 - 'class' => $inner_classes
339 - ]);
346 + echo HTML::renderStartDiv(['class' => $inner_classes]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
340 347 }
341 348 }
342 349
343 350 /**
@@ -364,14 +371,14 @@
364 371
365 372 // render div openings
366 373 if ($outer_classes)
367 374 {
368 - echo HTML::renderEndDiv();
375 + echo HTML::renderEndDiv(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
369 376 }
370 377
371 378 if ($inner_classes)
372 379 {
373 - echo HTML::renderEndDiv();
380 + echo HTML::renderEndDiv(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
374 381 }
375 382 }
376 383
377 384 /**
@@ -395,9 +402,9 @@
395 402 }
396 403
397 404 $section['title']['input_class'][] = 'cell large-3 fpf-section-heading';
398 405
399 - echo HTML::renderHeading($section['title']);
406 + echo HTML::renderHeading($section['title']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
400 407 }
401 408
402 409 /**
403 410 * Checks if we have a section title and wraps the fields with a div
@@ -412,15 +419,11 @@
412 419 {
413 420 return;
414 421 }
415 422
416 - echo HTML::renderStartDiv([
417 - 'class' => ['cell', 'large-auto', 'fpf-section-content']
418 - ]);
423 + echo HTML::renderStartDiv(['class' => ['cell', 'large-auto', 'fpf-section-content']]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
419 424
420 - echo HTML::renderStartDiv([
421 - 'class' => ['grid-x', 'grid-margin-x', 'grid-margin-y']
422 - ]);
425 + echo HTML::renderStartDiv(['class' => ['grid-x', 'grid-margin-x', 'grid-margin-y']]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
423 426 }
424 427
425 428 /**
426 429 * Checks if we have a section title and close the div that wrapped the fields
@@ -435,10 +438,10 @@
435 438 {
436 439 return;
437 440 }
438 441
439 - echo HTML::renderEndDiv();
440 - echo HTML::renderEndDiv();
442 + echo HTML::renderEndDiv(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
443 + echo HTML::renderEndDiv(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
441 444 }
442 445
443 446 /**
444 447 * Set form bind data