| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FirePlugins Framework |
| 4 | - * @version 1.1.146 | |
| 4 | + * @version 1.2.6 | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <[email protected]> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | 8 | * @copyright Copyright © 2026 FirePlugins All Rights Reserved |
| @@ -97,9 +97,10 @@ | ||
| 97 | 97 | $name = $this->prepareName($options); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // add [value] to the name of the field if it has units |
| 101 | - if (count($options->get('units', [])) && !in_array($options->get('type'), ['Units', 'ResponsiveControl', 'Dimensions'])) | |
| 101 | + // (cast: count() throws a TypeError on non-countables since PHP 8.0) | |
| 102 | + if (count((array) $options->get('units', [])) && !in_array($options->get('type'), ['Units', 'ResponsiveControl', 'Dimensions'])) | |
| 102 | 103 | { |
| 103 | 104 | $name .= '[value]'; |
| 104 | 105 | } |
| 105 | 106 | $this->options['name'] = $name; |
| @@ -324,9 +325,9 @@ | ||
| 324 | 325 | |
| 325 | 326 | if (!$meta) |
| 326 | 327 | { |
| 327 | 328 | global $post; |
| 328 | - $meta = get_post_meta($post->ID, 'fpframework_meta_settings', true); | |
| 329 | + $meta = $post ? get_post_meta($post->ID, 'fpframework_meta_settings', true) : []; | |
| 329 | 330 | } |
| 330 | 331 | |
| 331 | 332 | $val = FieldsHelper::findFieldValueInArray($name, $default, $meta); |
| 332 | 333 | |
| @@ -436,9 +437,9 @@ | ||
| 436 | 437 | /** |
| 437 | 438 | * Renders field top |
| 438 | 439 | * Contains the Responsive Controls and the Units |
| 439 | 440 | * |
| 440 | - * @return void | |
| 441 | + * @return string | |
| 441 | 442 | */ |
| 442 | 443 | public function getFieldTop() |
| 443 | 444 | { |
| 444 | 445 | $options = $this->getOptions(); |
| @@ -488,9 +489,9 @@ | ||
| 488 | 489 | |
| 489 | 490 | /** |
| 490 | 491 | * Renders field body |
| 491 | 492 | * |
| 492 | - * @return void | |
| 493 | + * @return string | |
| 493 | 494 | */ |
| 494 | 495 | public function getFieldBody() |
| 495 | 496 | { |
| 496 | 497 | // determine who will render the field (plugin or framework) |
| @@ -534,9 +535,9 @@ | ||
| 534 | 535 | * @return array |
| 535 | 536 | */ |
| 536 | 537 | public function getOption($option = null) |
| 537 | 538 | { |
| 538 | - if (!$option && !is_string($option) && !isset($this->option[$option])) | |
| 539 | + if (!$option || !is_string($option) || !isset($this->options[$option])) | |
| 539 | 540 | { |
| 540 | 541 | return null; |
| 541 | 542 | } |
| 542 | 543 | |