| @@ -8,9 +8,9 @@ | ||
| 8 | 8 | */ |
| 9 | 9 | class FrmEntryValues { |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | - * @var false|stdClass|null | |
| 12 | + * @var stdClass|null | |
| 13 | 13 | */ |
| 14 | 14 | protected $entry; |
| 15 | 15 | |
| 16 | 16 | /** |
| @@ -86,9 +86,8 @@ | ||
| 86 | 86 | /** |
| 87 | 87 | * Gets entry property. |
| 88 | 88 | * |
| 89 | 89 | * @since 5.0.16 |
| 90 | - * | |
| 91 | 90 | * @return stdClass |
| 92 | 91 | */ |
| 93 | 92 | public function get_entry() { |
| 94 | 93 | return $this->entry; |
| @@ -114,8 +113,9 @@ | ||
| 114 | 113 | * |
| 115 | 114 | * @return void |
| 116 | 115 | */ |
| 117 | 116 | protected function init_include_fields( $atts ) { |
| 117 | + | |
| 118 | 118 | // For reverse compatibility with the fields parameter. |
| 119 | 119 | if ( empty( $atts['include_fields'] ) && ! empty( $atts['fields'] ) ) { |
| 120 | 120 | if ( ! is_array( $atts['fields'] ) ) { |
| 121 | 121 | $atts['include_fields'] = $atts['fields']; |
| @@ -177,12 +177,19 @@ | ||
| 177 | 177 | * @return array |
| 178 | 178 | */ |
| 179 | 179 | private function prepare_array_property( $index, $atts ) { |
| 180 | 180 | if ( ! empty( $atts[ $index ] ) ) { |
| 181 | - return is_array( $atts[ $index ] ) ? $atts[ $index ] : explode( ',', $atts[ $index ] ); | |
| 181 | + | |
| 182 | + if ( is_array( $atts[ $index ] ) ) { | |
| 183 | + $property = $atts[ $index ]; | |
| 184 | + } else { | |
| 185 | + $property = explode( ',', $atts[ $index ] ); | |
| 186 | + } | |
| 187 | + } else { | |
| 188 | + $property = array(); | |
| 182 | 189 | } |
| 183 | 190 | |
| 184 | - return array(); | |
| 191 | + return $property; | |
| 185 | 192 | } |
| 186 | 193 | |
| 187 | 194 | /** |
| 188 | 195 | * Set the fields property |
| @@ -264,9 +271,9 @@ | ||
| 264 | 271 | 'value' => isset( $entry_description['browser'] ) ? FrmEntriesHelper::get_browser( $entry_description['browser'] ) : '', |
| 265 | 272 | ); |
| 266 | 273 | $referrer = array( |
| 267 | 274 | 'label' => __( 'Referrer', 'formidable' ), |
| 268 | - 'value' => $entry_description['referrer'] ?? '', | |
| 275 | + 'value' => isset( $entry_description['referrer'] ) ? $entry_description['referrer'] : '', | |
| 269 | 276 | ); |
| 270 | 277 | |
| 271 | 278 | /** |
| 272 | 279 | * Allow the referrer to be modified. |
| @@ -307,9 +314,8 @@ | ||
| 307 | 314 | * @return bool |
| 308 | 315 | */ |
| 309 | 316 | protected function is_field_included( $field ) { |
| 310 | 317 | $is_included = true; |
| 311 | - | |
| 312 | 318 | if ( ! empty( $this->include_fields ) ) { |
| 313 | 319 | $is_included = $this->is_field_in_array( $field, $this->include_fields ); |
| 314 | 320 | } |
| 315 | 321 | |
| @@ -314,9 +320,8 @@ | ||
| 314 | 320 | } |
| 315 | 321 | |
| 316 | 322 | if ( ! empty( $this->exclude_fields ) ) { |
| 317 | 323 | $is_excluded = $this->is_field_in_array( $field, $this->exclude_fields ); |
| 318 | - | |
| 319 | 324 | if ( $is_excluded ) { |
| 320 | 325 | $is_included = false; |
| 321 | 326 | } |
| 322 | 327 | } |
| @@ -334,9 +339,8 @@ | ||
| 334 | 339 | * |
| 335 | 340 | * @return bool |
| 336 | 341 | */ |
| 337 | 342 | protected function is_field_in_array( $field, $array ) { |
| 338 | - // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict | |
| 339 | 343 | return in_array( $field->id, $array ) || in_array( (string) $field->field_key, $array, true ); |
| 340 | 344 | } |
| 341 | 345 | |
| 342 | 346 | /** |