PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.10
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.10
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmEntryValues.php +17 -13 6.336.10 View file →
@@ -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,11 +113,14 @@
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 - if ( is_array( $atts['fields'] ) ) {
120 + if ( ! is_array( $atts['fields'] ) ) {
121 + $atts['include_fields'] = $atts['fields'];
122 + } else {
121 123 $atts['include_fields'] = '';
122 124
123 125 foreach ( $atts['fields'] as $included_field ) {
124 126 $atts['include_fields'] .= $included_field->id . ',';
@@ -124,10 +126,8 @@
124 126 $atts['include_fields'] .= $included_field->id . ',';
125 127 }
126 128
127 129 $atts['include_fields'] = rtrim( $atts['include_fields'], ',' );
128 - } else {
129 - $atts['include_fields'] = $atts['fields'];
130 130 }
131 131 }
132 132
133 133 $this->include_fields = $this->prepare_array_property( 'include_fields', $atts );
@@ -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,16 +314,14 @@
307 314 * @return bool
308 315 */
309 316 protected function is_field_included( $field ) {
310 317 $is_included = true;
311 -
312 - if ( $this->include_fields ) {
318 + if ( ! empty( $this->include_fields ) ) {
313 319 $is_included = $this->is_field_in_array( $field, $this->include_fields );
314 320 }
315 321
316 - if ( $this->exclude_fields ) {
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 /**