PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
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 +12 -16 6.25 → trunk View file →
@@ -8,9 +8,9 @@
8 8 */
9 9 class FrmEntryValues {
10 10
11 11 /**
12 - * @var stdClass|null
12 + * @var false|stdClass|null
13 13 */
14 14 protected $entry;
15 15
16 16 /**
@@ -86,8 +86,9 @@
86 86 /**
87 87 * Gets entry property.
88 88 *
89 89 * @since 5.0.16
90 + *
90 91 * @return stdClass
91 92 */
92 93 public function get_entry() {
93 94 return $this->entry;
@@ -113,14 +114,11 @@
113 114 *
114 115 * @return void
115 116 */
116 117 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'] ) ) {
121 - $atts['include_fields'] = $atts['fields'];
122 - } else {
120 + if ( is_array( $atts['fields'] ) ) {
123 121 $atts['include_fields'] = '';
124 122
125 123 foreach ( $atts['fields'] as $included_field ) {
126 124 $atts['include_fields'] .= $included_field->id . ',';
@@ -126,8 +124,10 @@
126 124 $atts['include_fields'] .= $included_field->id . ',';
127 125 }
128 126
129 127 $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,19 +177,12 @@
177 177 * @return array
178 178 */
179 179 private function prepare_array_property( $index, $atts ) {
180 180 if ( ! empty( $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();
181 + return is_array( $atts[ $index ] ) ? $atts[ $index ] : explode( ',', $atts[ $index ] );
189 182 }
190 183
191 - return $property;
184 + return array();
192 185 }
193 186
194 187 /**
195 188 * Set the fields property
@@ -314,14 +307,16 @@
314 307 * @return bool
315 308 */
316 309 protected function is_field_included( $field ) {
317 310 $is_included = true;
318 - if ( ! empty( $this->include_fields ) ) {
311 +
312 + if ( $this->include_fields ) {
319 313 $is_included = $this->is_field_in_array( $field, $this->include_fields );
320 314 }
321 315
322 - if ( ! empty( $this->exclude_fields ) ) {
316 + if ( $this->exclude_fields ) {
323 317 $is_excluded = $this->is_field_in_array( $field, $this->exclude_fields );
318 +
324 319 if ( $is_excluded ) {
325 320 $is_included = false;
326 321 }
327 322 }
@@ -339,8 +334,9 @@
339 334 *
340 335 * @return bool
341 336 */
342 337 protected function is_field_in_array( $field, $array ) {
338 + // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
343 339 return in_array( $field->id, $array ) || in_array( (string) $field->field_key, $array, true );
344 340 }
345 341
346 342 /**