| @@ -8,11 +8,11 @@ | ||
| 8 | 8 | */ |
| 9 | 9 | class FrmEntryValues { |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | - * @var stdClass|null | |
| 12 | + * @var stdClass | |
| 13 | 13 | */ |
| 14 | - protected $entry; | |
| 14 | + protected $entry = null; | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @var int |
| 18 | 18 | */ |
| @@ -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; |
| @@ -115,20 +114,24 @@ | ||
| 115 | 114 | * @return void |
| 116 | 115 | */ |
| 117 | 116 | protected function init_include_fields( $atts ) { |
| 118 | 117 | |
| 119 | - // For reverse compatibility with the fields parameter. | |
| 120 | - if ( empty( $atts['include_fields'] ) && ! empty( $atts['fields'] ) ) { | |
| 121 | - if ( ! is_array( $atts['fields'] ) ) { | |
| 122 | - $atts['include_fields'] = $atts['fields']; | |
| 123 | - } else { | |
| 124 | - $atts['include_fields'] = ''; | |
| 118 | + // For reverse compatibility with the fields parameter | |
| 119 | + if ( ! isset( $atts['include_fields'] ) || empty( $atts['include_fields'] ) ) { | |
| 125 | 120 | |
| 126 | - foreach ( $atts['fields'] as $included_field ) { | |
| 127 | - $atts['include_fields'] .= $included_field->id . ','; | |
| 121 | + if ( isset( $atts['fields'] ) && ! empty( $atts['fields'] ) ) { | |
| 122 | + | |
| 123 | + if ( ! is_array( $atts['fields'] ) ) { | |
| 124 | + $atts['include_fields'] = $atts['fields']; | |
| 125 | + } else { | |
| 126 | + $atts['include_fields'] = ''; | |
| 127 | + | |
| 128 | + foreach ( $atts['fields'] as $included_field ) { | |
| 129 | + $atts['include_fields'] .= $included_field->id . ','; | |
| 130 | + } | |
| 131 | + | |
| 132 | + $atts['include_fields'] = rtrim( $atts['include_fields'], ',' ); | |
| 128 | 133 | } |
| 129 | - | |
| 130 | - $atts['include_fields'] = rtrim( $atts['include_fields'], ',' ); | |
| 131 | 134 | } |
| 132 | 135 | } |
| 133 | 136 | |
| 134 | 137 | $this->include_fields = $this->prepare_array_property( 'include_fields', $atts ); |
| @@ -177,9 +180,9 @@ | ||
| 177 | 180 | * |
| 178 | 181 | * @return array |
| 179 | 182 | */ |
| 180 | 183 | private function prepare_array_property( $index, $atts ) { |
| 181 | - if ( ! empty( $atts[ $index ] ) ) { | |
| 184 | + if ( isset( $atts[ $index ] ) && ! empty( $atts[ $index ] ) ) { | |
| 182 | 185 | |
| 183 | 186 | if ( is_array( $atts[ $index ] ) ) { |
| 184 | 187 | $property = $atts[ $index ]; |
| 185 | 188 | } else { |
| @@ -262,19 +265,19 @@ | ||
| 262 | 265 | 'referrer' => '', |
| 263 | 266 | ); |
| 264 | 267 | } |
| 265 | 268 | |
| 266 | - $ip = array( | |
| 269 | + $ip = array( | |
| 267 | 270 | 'label' => __( 'IP Address', 'formidable' ), |
| 268 | 271 | 'value' => $this->entry->ip, |
| 269 | 272 | ); |
| 270 | - $browser = array( | |
| 273 | + $browser = array( | |
| 271 | 274 | 'label' => __( 'User-Agent (Browser/OS)', 'formidable' ), |
| 272 | 275 | 'value' => isset( $entry_description['browser'] ) ? FrmEntriesHelper::get_browser( $entry_description['browser'] ) : '', |
| 273 | 276 | ); |
| 274 | 277 | $referrer = array( |
| 275 | 278 | 'label' => __( 'Referrer', 'formidable' ), |
| 276 | - 'value' => $entry_description['referrer'] ?? '', | |
| 279 | + 'value' => isset( $entry_description['referrer'] ) ? $entry_description['referrer'] : '', | |
| 277 | 280 | ); |
| 278 | 281 | |
| 279 | 282 | /** |
| 280 | 283 | * Allow the referrer to be modified. |
| @@ -315,9 +318,8 @@ | ||
| 315 | 318 | * @return bool |
| 316 | 319 | */ |
| 317 | 320 | protected function is_field_included( $field ) { |
| 318 | 321 | $is_included = true; |
| 319 | - | |
| 320 | 322 | if ( ! empty( $this->include_fields ) ) { |
| 321 | 323 | $is_included = $this->is_field_in_array( $field, $this->include_fields ); |
| 322 | 324 | } |
| 323 | 325 | |
| @@ -322,9 +324,8 @@ | ||
| 322 | 324 | } |
| 323 | 325 | |
| 324 | 326 | if ( ! empty( $this->exclude_fields ) ) { |
| 325 | 327 | $is_excluded = $this->is_field_in_array( $field, $this->exclude_fields ); |
| 326 | - | |
| 327 | 328 | if ( $is_excluded ) { |
| 328 | 329 | $is_included = false; |
| 329 | 330 | } |
| 330 | 331 | } |