| @@ -8,11 +8,11 @@ | ||
| 8 | 8 | */ |
| 9 | 9 | class FrmEntryValues { |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | - * @var stdClass | |
| 12 | + * @var stdClass|null | |
| 13 | 13 | */ |
| 14 | - protected $entry = null; | |
| 14 | + protected $entry; | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @var int |
| 18 | 18 | */ |
| @@ -48,9 +48,9 @@ | ||
| 48 | 48 | * |
| 49 | 49 | * @since 2.04 |
| 50 | 50 | * |
| 51 | 51 | * @param int|string $entry_id |
| 52 | - * @param array $atts | |
| 52 | + * @param array $atts | |
| 53 | 53 | */ |
| 54 | 54 | public function __construct( $entry_id, $atts = array() ) { |
| 55 | 55 | if ( isset( $atts['entry'] ) && is_object( $atts['entry'] ) && ! empty( $atts['entry']->metas ) ) { |
| 56 | 56 | $this->entry = $atts['entry']; |
| @@ -114,24 +114,20 @@ | ||
| 114 | 114 | * @return void |
| 115 | 115 | */ |
| 116 | 116 | protected function init_include_fields( $atts ) { |
| 117 | 117 | |
| 118 | - // For reverse compatibility with the fields parameter | |
| 119 | - if ( ! isset( $atts['include_fields'] ) || empty( $atts['include_fields'] ) ) { | |
| 118 | + // For reverse compatibility with the fields parameter. | |
| 119 | + if ( empty( $atts['include_fields'] ) && ! empty( $atts['fields'] ) ) { | |
| 120 | + if ( ! is_array( $atts['fields'] ) ) { | |
| 121 | + $atts['include_fields'] = $atts['fields']; | |
| 122 | + } else { | |
| 123 | + $atts['include_fields'] = ''; | |
| 120 | 124 | |
| 121 | - if ( isset( $atts['fields'] ) && ! empty( $atts['fields'] ) ) { | |
| 125 | + foreach ( $atts['fields'] as $included_field ) { | |
| 126 | + $atts['include_fields'] .= $included_field->id . ','; | |
| 127 | + } | |
| 122 | 128 | |
| 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'], ',' ); | |
| 133 | - } | |
| 129 | + $atts['include_fields'] = rtrim( $atts['include_fields'], ',' ); | |
| 134 | 130 | } |
| 135 | 131 | } |
| 136 | 132 | |
| 137 | 133 | $this->include_fields = $this->prepare_array_property( 'include_fields', $atts ); |
| @@ -175,14 +171,14 @@ | ||
| 175 | 171 | * |
| 176 | 172 | * @since 2.04 |
| 177 | 173 | * |
| 178 | 174 | * @param string $index |
| 179 | - * @param array $atts | |
| 175 | + * @param array $atts | |
| 180 | 176 | * |
| 181 | 177 | * @return array |
| 182 | 178 | */ |
| 183 | 179 | private function prepare_array_property( $index, $atts ) { |
| 184 | - if ( isset( $atts[ $index ] ) && ! empty( $atts[ $index ] ) ) { | |
| 180 | + if ( ! empty( $atts[ $index ] ) ) { | |
| 185 | 181 | |
| 186 | 182 | if ( is_array( $atts[ $index ] ) ) { |
| 187 | 183 | $property = $atts[ $index ]; |
| 188 | 184 | } else { |
| @@ -265,13 +261,13 @@ | ||
| 265 | 261 | 'referrer' => '', |
| 266 | 262 | ); |
| 267 | 263 | } |
| 268 | 264 | |
| 269 | - $ip = array( | |
| 265 | + $ip = array( | |
| 270 | 266 | 'label' => __( 'IP Address', 'formidable' ), |
| 271 | 267 | 'value' => $this->entry->ip, |
| 272 | 268 | ); |
| 273 | - $browser = array( | |
| 269 | + $browser = array( | |
| 274 | 270 | 'label' => __( 'User-Agent (Browser/OS)', 'formidable' ), |
| 275 | 271 | 'value' => isset( $entry_description['browser'] ) ? FrmEntriesHelper::get_browser( $entry_description['browser'] ) : '', |
| 276 | 272 | ); |
| 277 | 273 | $referrer = array( |
| @@ -283,10 +279,11 @@ | ||
| 283 | 279 | * Allow the referrer to be modified. |
| 284 | 280 | * |
| 285 | 281 | * @since 5.5.1 |
| 286 | 282 | * |
| 287 | - * @param array $referrer | |
| 288 | - * @param array @entry_description | |
| 283 | + * @param array $referrer | |
| 284 | + * @param array $entry_description | |
| 285 | + * @param object $entry | |
| 289 | 286 | */ |
| 290 | 287 | $referrer = apply_filters( 'frm_user_info_referrer', $referrer, $entry_description, $this->entry ); |
| 291 | 288 | |
| 292 | 289 | $this->user_info = array( |
| @@ -337,9 +334,9 @@ | ||
| 337 | 334 | * |
| 338 | 335 | * @since 2.04 |
| 339 | 336 | * |
| 340 | 337 | * @param stdClass $field |
| 341 | - * @param array $array | |
| 338 | + * @param array $array | |
| 342 | 339 | * |
| 343 | 340 | * @return bool |
| 344 | 341 | */ |
| 345 | 342 | protected function is_field_in_array( $field, $array ) { |