Completed
Pull Request — master (#1415)
by Stephanie
39s
created
classes/helpers/FrmCSVExportHelper.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
 		unset( $filename );
131 131
 
132
-		$comment_count       = FrmDb::get_count(
132
+		$comment_count = FrmDb::get_count(
133 133
 			'frm_item_metas',
134 134
 			array(
135 135
 				'item_id'         => $atts['entry_ids'],
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	private static function prepare_csv_headings() {
225 225
 		$headings = array();
226 226
 		self::csv_headings( $headings );
227
-		$headings       = apply_filters(
227
+		$headings = apply_filters(
228 228
 			'frm_csv_columns',
229 229
 			$headings,
230 230
 			self::$form_id,
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 		$field_headings  = array();
249 249
 		$separate_values = array( 'user_id', 'file', 'data', 'date' );
250 250
 		if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) {
251
-			$field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) );
251
+			$field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) );
252 252
 		}
253 253
 
254
-		$field_headings[ $col->id ] = strip_tags( $col->name );
254
+		$field_headings[$col->id] = strip_tags( $col->name );
255 255
 		$field_headings             = apply_filters(
256 256
 			'frm_csv_field_columns',
257 257
 			$field_headings,
@@ -272,14 +272,14 @@  discard block
 block discarded – undo
272 272
 			if ( self::is_the_child_of_a_repeater( $col ) ) {
273 273
 				$repeater_id = $col->field_options['in_section'];
274 274
 				// Set a placeholder to maintain order for repeater fields.
275
-				$headings[ 'repeater' . $repeater_id ] = array();
275
+				$headings['repeater' . $repeater_id] = array();
276 276
 
277
-				if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) {
278
-					$fields_by_repeater_id[ $repeater_id ] = array();
277
+				if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) {
278
+					$fields_by_repeater_id[$repeater_id] = array();
279 279
 					$repeater_ids[]                        = $repeater_id;
280 280
 				}
281 281
 
282
-				$fields_by_repeater_id[ $repeater_id ][] = $col;
282
+				$fields_by_repeater_id[$repeater_id][] = $col;
283 283
 
284 284
 				continue;
285 285
 			}
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
 				$end    = strpos( $row->meta_value, ':{' );
299 299
 				$length = substr( $row->meta_value, $start, $end - $start );
300 300
 
301
-				if ( $length > $max[ $row->field_id ] ) {
302
-					$max[ $row->field_id ] = $length;
301
+				if ( $length > $max[$row->field_id] ) {
302
+					$max[$row->field_id] = $length;
303 303
 				}
304 304
 			}
305 305
 			unset( $start, $end, $length, $row, $repeater_meta, $where );
@@ -310,17 +310,17 @@  discard block
 block discarded – undo
310 310
 					$repeater_id = str_replace( 'repeater', '', $key );
311 311
 
312 312
 					$repeater_headings = array();
313
-					foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) {
313
+					foreach ( $fields_by_repeater_id[$repeater_id] as $col ) {
314 314
 						$repeater_headings += self::field_headings( $col );
315 315
 					}
316 316
 
317
-					for ( $i = 0; $i < $max[ $repeater_id ]; $i ++ ) {
317
+					for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) {
318 318
 						foreach ( $repeater_headings as $repeater_key => $repeater_name ) {
319
-							$flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name;
319
+							$flat[$repeater_key . '[' . $i . ']'] = $repeater_name;
320 320
 						}
321 321
 					}
322 322
 				} else {
323
-					$flat[ $key ] = $heading;
323
+					$flat[$key] = $heading;
324 324
 				}
325 325
 			}
326 326
 
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
 
335 335
 		if ( self::$comment_count ) {
336 336
 			for ( $i = 0; $i < self::$comment_count; $i ++ ) {
337
-				$headings[ 'comment' . $i ]            = __( 'Comment', 'formidable' );
338
-				$headings[ 'comment_user_id' . $i ]    = __( 'Comment User', 'formidable' );
339
-				$headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' );
337
+				$headings['comment' . $i]            = __( 'Comment', 'formidable' );
338
+				$headings['comment_user_id' . $i]    = __( 'Comment User', 'formidable' );
339
+				$headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' );
340 340
 			}
341 341
 			unset( $i );
342 342
 		}
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 
382 382
 	private static function prepare_next_csv_rows( $next_set ) {
383 383
 		// order by parent_item_id so children will be first
384
-		$where   = array(
384
+		$where = array(
385 385
 			'or'             => 1,
386 386
 			'id'             => $next_set,
387 387
 			'parent_item_id' => $next_set,
@@ -427,32 +427,32 @@  discard block
 block discarded – undo
427 427
 					continue;
428 428
 				}
429 429
 
430
-				if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) {
431
-					$entries[ self::$entry->parent_item_id ]        = new stdClass();
432
-					$entries[ self::$entry->parent_item_id ]->metas = array();
430
+				if ( ! isset( $entries[self::$entry->parent_item_id] ) ) {
431
+					$entries[self::$entry->parent_item_id]        = new stdClass();
432
+					$entries[self::$entry->parent_item_id]->metas = array();
433 433
 				}
434 434
 
435
-				if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) {
436
-					$entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array();
437
-				} elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) {
435
+				if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) {
436
+					$entries[self::$entry->parent_item_id]->metas[$meta_id] = array();
437
+				} elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) {
438 438
 					// if the data is here, it should be an array but if this field has collected data
439 439
 					// both while inside and outside of the repeating section, it's possible this is a string.
440
-					$entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ];
440
+					$entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id];
441 441
 				}
442 442
 
443 443
 				// Add the repeated values.
444
-				$entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value;
444
+				$entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value;
445 445
 			}//end foreach
446 446
 
447 447
 			self::$entry->metas                              = self::fill_missing_repeater_metas( self::$entry->metas, $entries );
448
-			$entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas;
448
+			$entries[self::$entry->parent_item_id]->metas += self::$entry->metas;
449 449
 		}//end if
450 450
 
451 451
 		// add the embedded form id
452
-		if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) {
453
-			$entries[ self::$entry->parent_item_id ]->embedded_fields = array();
452
+		if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) {
453
+			$entries[self::$entry->parent_item_id]->embedded_fields = array();
454 454
 		}
455
-		$entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id;
455
+		$entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id;
456 456
 	}
457 457
 
458 458
 	/**
@@ -473,19 +473,19 @@  discard block
 block discarded – undo
473 473
 		}
474 474
 
475 475
 		$repeater_id = $field->field_options['in_section'];
476
-		if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) {
476
+		if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) {
477 477
 			return $metas;
478 478
 		}
479 479
 
480
-		foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) {
481
-			if ( ! isset( $metas[ $repeater_child->id ] ) ) {
482
-				$metas[ $repeater_child->id ] = '';
480
+		foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) {
481
+			if ( ! isset( $metas[$repeater_child->id] ) ) {
482
+				$metas[$repeater_child->id] = '';
483 483
 
484
-				if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) {
485
-					$entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array();
484
+				if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) {
485
+					$entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array();
486 486
 				}
487 487
 
488
-				$entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = '';
488
+				$entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = '';
489 489
 			}
490 490
 		}
491 491
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 
505 505
 	private static function add_field_values_to_csv( &$row ) {
506 506
 		foreach ( self::$fields as $col ) {
507
-			$field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false;
507
+			$field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false;
508 508
 
509 509
 			FrmFieldsHelper::prepare_field_value( $field_value, $col->type );
510 510
 			self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) );
@@ -523,20 +523,20 @@  discard block
 block discarded – undo
523 523
 			if ( ! empty( $col->field_options['separate_value'] ) ) {
524 524
 				$label_key = $col->id . '_label';
525 525
 				if ( self::is_the_child_of_a_repeater( $col ) ) {
526
-					$row[ $label_key ] = array();
526
+					$row[$label_key] = array();
527 527
 
528 528
 					if ( is_array( $field_value ) ) {
529 529
 						foreach ( $field_value as $value ) {
530
-							$row[ $label_key ][] = self::get_separate_value_label( $value, $col );
530
+							$row[$label_key][] = self::get_separate_value_label( $value, $col );
531 531
 						}
532 532
 					}
533 533
 				} else {
534
-					$row[ $label_key ] = self::get_separate_value_label( $field_value, $col );
534
+					$row[$label_key] = self::get_separate_value_label( $field_value, $col );
535 535
 				}
536 536
 				unset( $label_key );
537 537
 			}
538 538
 
539
-			$row[ $col->id ] = $field_value;
539
+			$row[$col->id] = $field_value;
540 540
 
541 541
 			unset( $col, $field_value );
542 542
 		}//end foreach
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 				'show_icon'         => false,
560 560
 				'entry_id'          => self::$entry->id,
561 561
 				'sep'               => self::$separator,
562
-				'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0,
562
+				'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0,
563 563
 			)
564 564
 		);
565 565
 	}
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
 					// This is combo field inside repeater. The heading key has this format: [86_first[0]].
575 575
 					foreach ( $sub_value as $sub_key => $sub_sub_value ) {
576 576
 						$column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']';
577
-						if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) {
578
-							$row[ $column_key ] = $sub_sub_value;
577
+						if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) {
578
+							$row[$column_key] = $sub_sub_value;
579 579
 						}
580 580
 					}
581 581
 
@@ -583,8 +583,8 @@  discard block
 block discarded – undo
583 583
 				}
584 584
 
585 585
 				$column_key = $atts['col']->id . '_' . $key;
586
-				if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) {
587
-					$row[ $column_key ] = $sub_value;
586
+				if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) {
587
+					$row[$column_key] = $sub_value;
588 588
 				}
589 589
 			}
590 590
 		}
@@ -609,18 +609,18 @@  discard block
 block discarded – undo
609 609
 		$echo = 'echo' === self::$mode;
610 610
 
611 611
 		foreach ( self::$headings as $k => $heading ) {
612
-			if ( isset( $rows[ $k ] ) ) {
613
-				$row = $rows[ $k ];
612
+			if ( isset( $rows[$k] ) ) {
613
+				$row = $rows[$k];
614 614
 			} else {
615 615
 				$row = '';
616 616
 				// array indexed data is not at $rows[ $k ]
617
-				if ( $k[ strlen( $k ) - 1 ] === ']' ) {
617
+				if ( $k[strlen( $k ) - 1] === ']' ) {
618 618
 					$start = strrpos( $k, '[' );
619 619
 					$key   = substr( $k, 0, $start ++ );
620 620
 					$index = substr( $k, $start, strlen( $k ) - 1 - $start );
621 621
 
622
-					if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) {
623
-						$row = $rows[ $key ][ $index ];
622
+					if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) {
623
+						$row = $rows[$key][$index];
624 624
 					}
625 625
 
626 626
 					unset( $start, $key, $index );
Please login to merge, or discard this patch.
classes/helpers/FrmFieldsHelper.php 2 patches
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 			if ( in_array( $type, array( 'data', 'lookup' ), true ) ) {
32 32
 				$values['field_options']['data_type'] = $setting;
33 33
 			} else {
34
-				$values['field_options'][ $setting ] = 1;
34
+				$values['field_options'][$setting] = 1;
35 35
 			}
36 36
 		}
37 37
 
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 		}
139 139
 
140 140
 		foreach ( $defaults as $opt => $default ) {
141
-			$values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default;
141
+			$values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default;
142 142
 
143 143
 			if ( $check_post ) {
144
-				self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] );
144
+				self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] );
145 145
 			}
146 146
 
147 147
 			unset( $opt, $default );
@@ -185,18 +185,18 @@  discard block
 block discarded – undo
185 185
 	 * @param mixed  $value
186 186
 	 */
187 187
 	private static function get_posted_field_setting( $setting, &$value ) {
188
-		if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
188
+		if ( ! isset( $_POST['field_options'][$setting] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
189 189
 			return;
190 190
 		}
191 191
 
192 192
 		if ( strpos( $setting, 'html' ) !== false ) {
193 193
 			// Strip slashes from HTML but not regex or script tags.
194
-			$value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
194
+			$value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
195 195
 		} elseif ( strpos( $setting, 'format_' ) === 0 ) {
196 196
 			// TODO: Remove stripslashes on output, and use on input only.
197
-			$value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing
197
+			$value = sanitize_text_field( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing
198 198
 		} else {
199
-			$value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
199
+			$value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
200 200
 			FrmAppHelper::sanitize_value( 'wp_kses_post', $value );
201 201
 		}
202 202
 	}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		$values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value );
270 270
 
271 271
 		foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
272
-			$values[ $col ] = $field->{$col};
272
+			$values[$col] = $field->{$col};
273 273
 		}
274 274
 	}
275 275
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		);
310 310
 
311 311
 		$msg = FrmField::get_option( $field, $error );
312
-		$msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg;
312
+		$msg = empty( $msg ) ? $defaults[$error]['part'] : $msg;
313 313
 		$msg = do_shortcode( $msg );
314 314
 
315 315
 		return $msg;
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		}
420 420
 
421 421
 		$base_name = 'default_value_' . $field['id'];
422
-		$html_id    = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field );
422
+		$html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field );
423 423
 
424 424
 		$default_type = self::get_default_value_type( $field );
425 425
 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 				continue;
750 750
 			}
751 751
 
752
-			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
752
+			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] );
753 753
 			$tag  = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key );
754 754
 
755 755
 			$atts['entry'] = $entry;
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 			if ( $replace_with !== null ) {
760 760
 				$replace_with = self::trigger_shortcode_atts( $replace_with, $atts );
761 761
 				self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with );
762
-				$content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
762
+				$content = str_replace( $shortcodes[0][$short_key], $replace_with, $content );
763 763
 			}
764 764
 
765 765
 			unset( $atts, $replace_with );
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 		$supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' );
778 778
 		$included_atts  = array_intersect( $supported_atts, array_keys( $atts ) );
779 779
 		foreach ( $included_atts as $included_att ) {
780
-			if ( '0' === $atts[ $included_att ] ) {
780
+			if ( '0' === $atts[$included_att] ) {
781 781
 				// Skip any option that uses 0 so sanitize_url=0 does not encode.
782 782
 				continue;
783 783
 			}
@@ -850,8 +850,8 @@  discard block
 block discarded – undo
850 850
 
851 851
 		$dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' );
852 852
 
853
-		if ( isset( $shortcode_values[ $atts['tag'] ] ) ) {
854
-			$replace_with = $shortcode_values[ $atts['tag'] ];
853
+		if ( isset( $shortcode_values[$atts['tag']] ) ) {
854
+			$replace_with = $shortcode_values[$atts['tag']];
855 855
 		} elseif ( in_array( $atts['tag'], $dynamic_default ) ) {
856 856
 			$replace_with = self::dynamic_default_values( $atts['tag'], $atts );
857 857
 		} elseif ( $clean_tag === 'user_agent' ) {
@@ -1062,8 +1062,8 @@  discard block
 block discarded – undo
1062 1062
 			self::field_types_for_input( $single_input, $field_selection, $field_types );
1063 1063
 		} elseif ( in_array( $type, $multiple_input ) ) {
1064 1064
 			self::field_types_for_input( $multiple_input, $field_selection, $field_types );
1065
-		} elseif ( isset( $field_selection[ $type ] ) ) {
1066
-			$field_types[ $type ] = $field_selection[ $type ];
1065
+		} elseif ( isset( $field_selection[$type] ) ) {
1066
+			$field_types[$type] = $field_selection[$type];
1067 1067
 		}
1068 1068
 
1069 1069
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) );
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 
1097 1097
 	private static function field_types_for_input( $inputs, $fields, &$field_types ) {
1098 1098
 		foreach ( $inputs as $input ) {
1099
-			$field_types[ $input ] = $fields[ $input ];
1099
+			$field_types[$input] = $fields[$input];
1100 1100
 			unset( $input );
1101 1101
 		}
1102 1102
 	}
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 			'parent'  => false,
1129 1129
 			'pointer' => false,
1130 1130
 		);
1131
-		$args     = wp_parse_args( $args, $defaults );
1131
+		$args = wp_parse_args( $args, $defaults );
1132 1132
 
1133 1133
 		$opt_key   = $args['opt_key'];
1134 1134
 		$field     = $args['field'];
@@ -1144,24 +1144,24 @@  discard block
 block discarded – undo
1144 1144
 
1145 1145
 		// Check posted vals before checking saved values
1146 1146
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
1147
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1147
+		if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1148 1148
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
1149 1149
 				// phpcs:ignore WordPress.Security.NonceVerification.Missing
1150
-				$other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : '';
1150
+				$other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ) : '';
1151 1151
 			} else {
1152
-				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1152
+				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1153 1153
 			}
1154 1154
 
1155 1155
 			return $other_val;
1156 1156
 
1157
-		} elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1157
+		} elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1158 1158
 			// For normal fields
1159 1159
 
1160 1160
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
1161 1161
 				// phpcs:ignore WordPress.Security.NonceVerification.Missing
1162
-				$other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : '';
1162
+				$other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : '';
1163 1163
 			} else {
1164
-				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1164
+				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1165 1165
 			}
1166 1166
 
1167 1167
 			return $other_val;
@@ -1171,8 +1171,8 @@  discard block
 block discarded – undo
1171 1171
 		if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) {
1172 1172
 			// Check if there is an "other" val in saved value and make sure the
1173 1173
 			// "other" val is not equal to the Other checkbox option
1174
-			if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
1175
-				$other_val = $field['value'][ $opt_key ];
1174
+			if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) {
1175
+				$other_val = $field['value'][$opt_key];
1176 1176
 			}
1177 1177
 		} else {
1178 1178
 			/**
@@ -1184,8 +1184,8 @@  discard block
 block discarded – undo
1184 1184
 				// Multi-select dropdowns - key is not preserved
1185 1185
 				if ( is_array( $field['value'] ) ) {
1186 1186
 					$o_key = array_search( $temp_val, $field['value'] );
1187
-					if ( isset( $field['value'][ $o_key ] ) ) {
1188
-						unset( $field['value'][ $o_key ], $o_key );
1187
+					if ( isset( $field['value'][$o_key] ) ) {
1188
+						unset( $field['value'][$o_key], $o_key );
1189 1189
 					}
1190 1190
 				} elseif ( $temp_val == $field['value'] ) {
1191 1191
 					// For radio and regular dropdowns
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 			return $other_args;
1228 1228
 		}
1229 1229
 
1230
-		$other_opt  = true;
1230
+		$other_opt = true;
1231 1231
 
1232 1232
 		self::set_other_name( $args, $other_args );
1233 1233
 		self::set_other_value( $args, $other_args );
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
 		if ( is_array( $val ) ) {
1396 1396
 			foreach ( $val as $k => $v ) {
1397 1397
 				if ( is_string( $v ) ) {
1398
-					$val[ $k ] = str_replace( $replace, $replace_with, $v );
1398
+					$val[$k] = str_replace( $replace, $replace_with, $v );
1399 1399
 					unset( $k, $v );
1400 1400
 				}
1401 1401
 			}
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 			$countries['class'] = 'frm-countries-opts';
1749 1749
 		}
1750 1750
 
1751
-		$prepop[ __( 'Countries', 'formidable' ) ] = $countries;
1751
+		$prepop[__( 'Countries', 'formidable' )] = $countries;
1752 1752
 
1753 1753
 		// State abv.
1754 1754
 		$states    = self::get_us_states();
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 			$state_abv['class'] = 'frm-state-abv-opts';
1759 1759
 		}
1760 1760
 
1761
-		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1761
+		$prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv;
1762 1762
 
1763 1763
 		// States.
1764 1764
 		$states = array_values( $states );
@@ -1767,7 +1767,7 @@  discard block
 block discarded – undo
1767 1767
 			$states['class'] = 'frm-states-opts';
1768 1768
 		}
1769 1769
 
1770
-		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1770
+		$prepop[__( 'U.S. States', 'formidable' )] = $states;
1771 1771
 		unset( $state_abv, $states );
1772 1772
 
1773 1773
 		// Age.
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
 			$ages['class'] = 'frm-age-opts';
1786 1786
 		}
1787 1787
 
1788
-		$prepop[ __( 'Age', 'formidable' ) ] = $ages;
1788
+		$prepop[__( 'Age', 'formidable' )] = $ages;
1789 1789
 
1790 1790
 		// Satisfaction.
1791 1791
 		$satisfaction = array(
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 			$satisfaction['class'] = 'frm-satisfaction-opts';
1801 1801
 		}
1802 1802
 
1803
-		$prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction;
1803
+		$prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction;
1804 1804
 
1805 1805
 		// Importance.
1806 1806
 		$importance = array(
@@ -1815,7 +1815,7 @@  discard block
 block discarded – undo
1815 1815
 			$importance['class'] = 'frm-importance-opts';
1816 1816
 		}
1817 1817
 
1818
-		$prepop[ __( 'Importance', 'formidable' ) ] = $importance;
1818
+		$prepop[__( 'Importance', 'formidable' )] = $importance;
1819 1819
 
1820 1820
 		// Agreement.
1821 1821
 		$agreement = array(
@@ -1830,7 +1830,7 @@  discard block
 block discarded – undo
1830 1830
 			$agreement['class'] = 'frm-agreement-opts';
1831 1831
 		}
1832 1832
 
1833
-		$prepop[ __( 'Agreement', 'formidable' ) ] = $agreement;
1833
+		$prepop[__( 'Agreement', 'formidable' )] = $agreement;
1834 1834
 
1835 1835
 		// Likely.
1836 1836
 		$likely = array(
@@ -1845,7 +1845,7 @@  discard block
 block discarded – undo
1845 1845
 			$likely['class'] = 'frm-likely-opts';
1846 1846
 		}
1847 1847
 
1848
-		$prepop[ __( 'Likely', 'formidable' ) ] = $likely;
1848
+		$prepop[__( 'Likely', 'formidable' )] = $likely;
1849 1849
 
1850 1850
 		$prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1851 1851
 	}
@@ -2052,16 +2052,16 @@  discard block
 block discarded – undo
2052 2052
 	 */
2053 2053
 	private static function fill_image_setting_options( $options, &$args ) {
2054 2054
 		foreach ( $options as $key => $option ) {
2055
-			$args['options'][ $key ] = $option;
2055
+			$args['options'][$key] = $option;
2056 2056
 
2057 2057
 			if ( ! empty( $option['addon'] ) ) {
2058
-				$args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option );
2058
+				$args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option );
2059 2059
 			}
2060 2060
 
2061
-			unset( $args['options'][ $key ]['addon'] );
2061
+			unset( $args['options'][$key]['addon'] );
2062 2062
 			$fill = array( 'upgrade', 'message', 'content' );
2063 2063
 			foreach ( $fill as $f ) {
2064
-				unset( $args['options'][ $key ][ $f ], $f );
2064
+				unset( $args['options'][$key][$f], $f );
2065 2065
 			}
2066 2066
 		}
2067 2067
 	}
@@ -2082,8 +2082,8 @@  discard block
 block discarded – undo
2082 2082
 
2083 2083
 		$fill = array( 'upgrade', 'message', 'content' );
2084 2084
 		foreach ( $fill as $f ) {
2085
-			if ( isset( $option[ $f ] ) ) {
2086
-				$custom_attrs[ 'data-' . $f ] = $option[ $f ];
2085
+			if ( isset( $option[$f] ) ) {
2086
+				$custom_attrs['data-' . $f] = $option[$f];
2087 2087
 			}
2088 2088
 		}
2089 2089
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -185,7 +185,8 @@  discard block
 block discarded – undo
185 185
 	 * @param mixed  $value
186 186
 	 */
187 187
 	private static function get_posted_field_setting( $setting, &$value ) {
188
-		if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
188
+		if ( ! isset( $_POST['field_options'][ $setting ] ) ) {
189
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
189 190
 			return;
190 191
 		}
191 192
 
@@ -1144,7 +1145,8 @@  discard block
 block discarded – undo
1144 1145
 
1145 1146
 		// Check posted vals before checking saved values
1146 1147
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
1147
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1148
+		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
1149
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
1148 1150
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
1149 1151
 				// phpcs:ignore WordPress.Security.NonceVerification.Missing
1150 1152
 				$other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : '';
@@ -1154,7 +1156,8 @@  discard block
 block discarded – undo
1154 1156
 
1155 1157
 			return $other_val;
1156 1158
 
1157
-		} elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1159
+		} elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) {
1160
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
1158 1161
 			// For normal fields
1159 1162
 
1160 1163
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
Please login to merge, or discard this patch.
classes/models/FrmEntryValidate.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 			return $errors;
21 21
 		}
22 22
 
23
-		if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) {
23
+		if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values['frm_submit_entry_' . $values['form_id']] ) || ! wp_verify_nonce( $values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce' ) ) ) {
24 24
 			$frm_settings   = FrmAppHelper::get_settings();
25 25
 			$errors['form'] = $frm_settings->admin_permission;
26 26
 		}
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 			'exclude'         => array(),
121 121
 
122 122
 		);
123
-		$args     = wp_parse_args( $args, $defaults );
123
+		$args = wp_parse_args( $args, $defaults );
124 124
 
125 125
 		if ( empty( $args['parent_field_id'] ) ) {
126
-			$value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : '';
126
+			$value = isset( $values['item_meta'][$args['id']] ) ? $values['item_meta'][$args['id']] : '';
127 127
 		} else {
128 128
 			// value is from a nested form
129 129
 			$value = $values;
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		}
145 145
 
146 146
 		if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) {
147
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
147
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
148 148
 		} elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
149 149
 			self::maybe_add_item_name( $value, $posted_field );
150 150
 		}
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			$pattern = self::phone_format( $field );
223 223
 
224 224
 			if ( ! preg_match( $pattern, $value ) ) {
225
-				$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
225
+				$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
226 226
 			}
227 227
 		}
228 228
 	}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 */
333 333
 	private static function form_is_in_progress( $values ) {
334 334
 		return FrmAppHelper::pro_is_installed() &&
335
-			( isset( $values[ 'frm_page_order_' . $values['form_id'] ] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) &&
335
+			( isset( $values['frm_page_order_' . $values['form_id']] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) &&
336 336
 			FrmField::get_all_types_in_form( $values['form_id'], 'break' );
337 337
 	}
338 338
 
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 			foreach ( $datas['missing_keys'] as $key_index => $key ) {
577 577
 				$found = self::is_akismet_guest_info_value( $key, $value, $field_id, $datas['name_field_ids'] );
578 578
 				if ( $found ) {
579
-					$datas[ $key ]             = $value;
579
+					$datas[$key]             = $value;
580 580
 					$datas['frm_duplicated'][] = $field_id;
581
-					unset( $datas['missing_keys'][ $key_index ] );
581
+					unset( $datas['missing_keys'][$key_index] );
582 582
 				}
583 583
 			}
584 584
 		}//end foreach
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 
625 625
 			// Send any potentially useful $_SERVER vars, but avoid sending junk we don't need.
626 626
 			if ( $include_value ) {
627
-				$datas[ $key ] = $value;
627
+				$datas[$key] = $value;
628 628
 			}
629 629
 			unset( $key, $value );
630 630
 		}
@@ -641,10 +641,10 @@  discard block
 block discarded – undo
641 641
 	private static function add_comment_content_to_akismet( &$datas, $values ) {
642 642
 		if ( isset( $datas['frm_duplicated'] ) ) {
643 643
 			foreach ( $datas['frm_duplicated'] as $index ) {
644
-				if ( isset( $values['item_meta'][ $index ] ) ) {
645
-					unset( $values['item_meta'][ $index ] );
644
+				if ( isset( $values['item_meta'][$index] ) ) {
645
+					unset( $values['item_meta'][$index] );
646 646
 				} else {
647
-					unset( $values[ $index ] );
647
+					unset( $values[$index] );
648 648
 				}
649 649
 			}
650 650
 			unset( $datas['frm_duplicated'] );
@@ -665,14 +665,14 @@  discard block
 block discarded – undo
665 665
 	private static function skip_adding_values_to_akismet( &$values ) {
666 666
 		$skipped_fields = self::get_akismet_skipped_field_ids( $values );
667 667
 		foreach ( $skipped_fields as $skipped_field ) {
668
-			if ( ! isset( $values['item_meta'][ $skipped_field->id ] ) ) {
668
+			if ( ! isset( $values['item_meta'][$skipped_field->id] ) ) {
669 669
 				continue;
670 670
 			}
671 671
 
672 672
 			if ( self::should_really_skip_field( $skipped_field, $values ) ) {
673
-				unset( $values['item_meta'][ $skipped_field->id ] );
674
-				if ( isset( $values['item_meta']['other'][ $skipped_field->id ] ) ) {
675
-					unset( $values['item_meta']['other'][ $skipped_field->id ] );
673
+				unset( $values['item_meta'][$skipped_field->id] );
674
+				if ( isset( $values['item_meta']['other'][$skipped_field->id] ) ) {
675
+					unset( $values['item_meta']['other'][$skipped_field->id] );
676 676
 				}
677 677
 			}
678 678
 		}
@@ -708,14 +708,14 @@  discard block
 block discarded – undo
708 708
 		}
709 709
 
710 710
 		// If a choice field has Other option, but Other is not selected.
711
-		if ( empty( $values['item_meta']['other'][ $field_data->id ] ) ) {
711
+		if ( empty( $values['item_meta']['other'][$field_data->id] ) ) {
712 712
 			return true;
713 713
 		}
714 714
 
715 715
 		// Check if submitted value is same as one of field option.
716 716
 		foreach ( $field_data->options as $option ) {
717 717
 			$option_value = ! is_array( $option ) ? $option : ( isset( $option['value'] ) ? $option['value'] : '' );
718
-			if ( $values['item_meta']['other'][ $field_data->id ] === $option_value ) {
718
+			if ( $values['item_meta']['other'][$field_data->id] === $option_value ) {
719 719
 				return true;
720 720
 			}
721 721
 		}
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 
787 787
 			// Convert name array to string.
788 788
 			if ( isset( $value['first'] ) && isset( $value['last'] ) ) {
789
-				$values['item_meta'][ $field_id ] = trim( implode( ' ', $value ) );
789
+				$values['item_meta'][$field_id] = trim( implode( ' ', $value ) );
790 790
 				$values['name_field_ids'][]       = $field_id;
791 791
 				continue;
792 792
 			}
@@ -807,8 +807,8 @@  discard block
 block discarded – undo
807 807
 						continue;
808 808
 					}
809 809
 
810
-					if ( ! isset( $values['item_meta'][ $subsubindex ] ) ) {
811
-						$values['item_meta'][ $subsubindex ] = array();
810
+					if ( ! isset( $values['item_meta'][$subsubindex] ) ) {
811
+						$values['item_meta'][$subsubindex] = array();
812 812
 					}
813 813
 
814 814
 					// Convert name array to string.
@@ -818,11 +818,11 @@  discard block
 block discarded – undo
818 818
 						$values['name_field_ids'][] = $subsubindex;
819 819
 					}
820 820
 
821
-					$values['item_meta'][ $subsubindex ][] = $subsubvalue;
821
+					$values['item_meta'][$subsubindex][] = $subsubvalue;
822 822
 				}
823 823
 			}//end foreach
824 824
 
825
-			unset( $values['item_meta'][ $field_id ] );
825
+			unset( $values['item_meta'][$field_id] );
826 826
 		}//end foreach
827 827
 
828 828
 		return $form_ids;
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -145,7 +145,8 @@
 block discarded – undo
145 145
 
146 146
 		if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) {
147 147
 			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
148
-		} elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
148
+		} elseif ( ! isset( $_POST['item_name'] ) ) {
149
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
149 150
 			self::maybe_add_item_name( $value, $posted_field );
150 151
 		}
151 152
 
Please login to merge, or discard this patch.
classes/models/FrmApplicationTemplate.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		 *
38 38
 		 * @param array $keys
39 39
 		 */
40
-		self::$keys             = apply_filters(
40
+		self::$keys = apply_filters(
41 41
 			'frm_application_data_keys',
42 42
 			array( 'key', 'name', 'description', 'link', 'categories', 'views', 'forms' )
43 43
 		);
@@ -115,17 +115,17 @@  discard block
 block discarded – undo
115 115
 	public function as_js_object() {
116 116
 		$application = array();
117 117
 		foreach ( self::$keys as $key ) {
118
-			if ( ! isset( $this->api_data[ $key ] ) ) {
118
+			if ( ! isset( $this->api_data[$key] ) ) {
119 119
 				continue;
120 120
 			}
121 121
 
122
-			$value = $this->api_data[ $key ];
122
+			$value = $this->api_data[$key];
123 123
 
124 124
 			if ( 'icon' === $key ) {
125 125
 				// Icon is an array. The first array item is the image URL.
126
-				$application[ $key ] = reset( $value );
126
+				$application[$key] = reset( $value );
127 127
 			} elseif ( 'categories' === $key ) {
128
-				$application[ $key ] = array_values(
128
+				$application[$key] = array_values(
129 129
 					array_filter(
130 130
 						$value,
131 131
 						function( $category ) {
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 					// Strip off the " Template" text at the end of the name as it takes up space.
145 145
 					$value = substr( $value, 0, -9 );
146 146
 				}
147
-				$application[ $key ] = $value;
147
+				$application[$key] = $value;
148 148
 			}//end if
149 149
 		}//end foreach
150 150
 
Please login to merge, or discard this patch.
classes/models/FrmFormAction.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 		$groups = FrmFormActionsController::form_action_groups();
209 209
 		$group  = 'misc';
210 210
 
211
-		if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) {
211
+		if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) {
212 212
 			$group = $action_options['group'];
213
-		} elseif ( isset( $groups[ $this->id_base ] ) ) {
213
+		} elseif ( isset( $groups[$this->id_base] ) ) {
214 214
 			$group = $this->id_base;
215 215
 		} else {
216 216
 			foreach ( $groups as $name => $check_group ) {
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 			}
222 222
 		}
223 223
 
224
-		$groups[ $group ]['id'] = $group;
225
-		return $groups[ $group ];
224
+		$groups[$group]['id'] = $group;
225
+		return $groups[$group];
226 226
 	}
227 227
 
228 228
 	/**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	 * @return integer $post_id
334 334
 	 */
335 335
 	public function maybe_create_action( $action, $forms ) {
336
-		if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) {
336
+		if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) {
337 337
 			// Update action only
338 338
 			$action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] );
339 339
 			$post_id                = $this->save_settings( $action );
@@ -356,18 +356,18 @@  discard block
 block discarded – undo
356 356
 		$switch             = $this->get_global_switch_fields();
357 357
 
358 358
 		foreach ( (array) $action->post_content as $key => $val ) {
359
-			if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) {
360
-				$action->post_content[ $key ] = $frm_duplicate_ids[ $val ];
359
+			if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) {
360
+				$action->post_content[$key] = $frm_duplicate_ids[$val];
361 361
 			} elseif ( ! is_array( $val ) ) {
362
-				$action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val );
363
-			} elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) {
362
+				$action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val );
363
+			} elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) {
364 364
 				// loop through each value if empty
365
-				if ( empty( $switch[ $key ] ) ) {
366
-					$switch[ $key ] = array_keys( $val );
365
+				if ( empty( $switch[$key] ) ) {
366
+					$switch[$key] = array_keys( $val );
367 367
 				}
368 368
 
369
-				foreach ( $switch[ $key ] as $subkey ) {
370
-					$action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val );
369
+				foreach ( $switch[$key] as $subkey ) {
370
+					$action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val );
371 371
 				}
372 372
 			}
373 373
 
@@ -385,20 +385,20 @@  discard block
 block discarded – undo
385 385
 			foreach ( $subkey as $subkey2 ) {
386 386
 				foreach ( (array) $val as $ck => $cv ) {
387 387
 					if ( is_array( $cv ) ) {
388
-						$action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv );
389
-					} elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) {
390
-						$action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ];
388
+						$action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv );
389
+					} elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) {
390
+						$action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]];
391 391
 					}
392 392
 				}
393 393
 			}
394 394
 		} else {
395 395
 			foreach ( (array) $val as $ck => $cv ) {
396 396
 				if ( is_array( $cv ) ) {
397
-					$action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv );
398
-				} elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) {
399
-					$action[ $ck ] = $frm_duplicate_ids[ $cv ];
397
+					$action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv );
398
+				} elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) {
399
+					$action[$ck] = $frm_duplicate_ids[$cv];
400 400
 				} elseif ( $ck == $subkey ) {
401
-					$action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] );
401
+					$action[$ck] = $this->maybe_switch_field_ids( $action[$ck] );
402 402
 				}
403 403
 			}
404 404
 		}//end if
@@ -422,10 +422,10 @@  discard block
 block discarded – undo
422 422
 		}
423 423
 
424 424
 		// phpcs:ignore WordPress.Security.NonceVerification.Missing
425
-		if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) {
425
+		if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) {
426 426
 			// Sanitizing removes scripts and <email> type of values.
427 427
 			// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
428
-			$settings = wp_unslash( $_POST[ $this->option_name ] );
428
+			$settings = wp_unslash( $_POST[$this->option_name] );
429 429
 		} else {
430 430
 			return;
431 431
 		}
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 		foreach ( $settings as $number => $new_instance ) {
436 436
 			$this->_set( $number );
437 437
 
438
-			$old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array();
438
+			$old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array();
439 439
 
440 440
 			if ( ! isset( $new_instance['post_status'] ) ) {
441 441
 				$new_instance['post_status'] = 'draft';
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 			$instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this );
474 474
 
475 475
 			if ( false !== $instance ) {
476
-				$all_instances[ $number ] = $instance;
476
+				$all_instances[$number] = $instance;
477 477
 			}
478 478
 
479 479
 			$action_ids[] = $this->save_settings( $instance );
@@ -555,12 +555,12 @@  discard block
 block discarded – undo
555 555
 			// some plugins/themes are formatting the post_excerpt
556 556
 			$action->post_excerpt = sanitize_title( $action->post_excerpt );
557 557
 
558
-			if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) {
558
+			if ( ! isset( $action_controls[$action->post_excerpt] ) ) {
559 559
 				continue;
560 560
 			}
561 561
 
562
-			$action                  = $action_controls[ $action->post_excerpt ]->prepare_action( $action );
563
-			$settings[ $action->ID ] = $action;
562
+			$action                  = $action_controls[$action->post_excerpt]->prepare_action( $action );
563
+			$settings[$action->ID] = $action;
564 564
 
565 565
 			if ( count( $settings ) >= $limit ) {
566 566
 				break;
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 			'limit'       => 99,
594 594
 			'post_status' => $default_status,
595 595
 		);
596
-		$args     = wp_parse_args( $args, $defaults );
596
+		$args = wp_parse_args( $args, $defaults );
597 597
 	}
598 598
 
599 599
 	/**
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 
660 660
 			$action = $this->prepare_action( $action );
661 661
 
662
-			$settings[ $action->ID ] = $action;
662
+			$settings[$action->ID] = $action;
663 663
 		}
664 664
 
665 665
 		if ( 1 === $limit ) {
@@ -702,10 +702,10 @@  discard block
 block discarded – undo
702 702
 
703 703
 		foreach ( $default_values as $k => $vals ) {
704 704
 			if ( is_array( $vals ) && ! empty( $vals ) ) {
705
-				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) {
705
+				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) {
706 706
 					continue;
707 707
 				}
708
-				$action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals );
708
+				$action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals );
709 709
 			}
710 710
 		}
711 711
 
@@ -788,14 +788,14 @@  discard block
 block discarded – undo
788 788
 	 * Migrate settings from form->options into new action.
789 789
 	 */
790 790
 	public function migrate_to_2( $form, $update = 'update' ) {
791
-		$action        = $this->prepare_new( $form->id );
791
+		$action = $this->prepare_new( $form->id );
792 792
 		FrmAppHelper::unserialize_or_decode( $form->options );
793 793
 
794 794
 		// fill with existing options
795 795
 		foreach ( $action->post_content as $name => $val ) {
796
-			if ( isset( $form->options[ $name ] ) ) {
797
-				$action->post_content[ $name ] = $form->options[ $name ];
798
-				unset( $form->options[ $name ] );
796
+			if ( isset( $form->options[$name] ) ) {
797
+				$action->post_content[$name] = $form->options[$name];
798
+				unset( $form->options[$name] );
799 799
 			}
800 800
 		}
801 801
 
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 				$stop = $stop ? false : true;
862 862
 			}
863 863
 
864
-			$met[ $stop ] = $stop;
864
+			$met[$stop] = $stop;
865 865
 		}//end foreach
866 866
 
867 867
 		if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) {
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
 	private static function get_value_from_entry( $entry, $field_id ) {
916 916
 		$observed_value = '';
917 917
 
918
-		if ( isset( $entry->metas[ $field_id ] ) ) {
919
-			$observed_value = $entry->metas[ $field_id ];
918
+		if ( isset( $entry->metas[$field_id] ) ) {
919
+			$observed_value = $entry->metas[$field_id];
920 920
 		} elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) {
921 921
 			$field          = FrmField::getOne( $field_id );
922 922
 			$observed_value = FrmProEntryMetaHelper::get_post_or_meta_value(
Please login to merge, or discard this patch.
classes/models/FrmEmailStats.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 * @param array $stats Statistics section data.
141 141
 	 */
142 142
 	protected function add_payments_data( &$stats ) {
143
-		$payment_data  = FrmEmailSummaryHelper::get_payments_data( $this->from_date, $this->to_date );
143
+		$payment_data = FrmEmailSummaryHelper::get_payments_data( $this->from_date, $this->to_date );
144 144
 		$stats['payments_count'] = array(
145 145
 			'label'   => __( 'Payments collected', 'formidable' ),
146 146
 			'count'   => $payment_data['count'],
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 		// Build total for each currency.
151 151
 		foreach ( $payment_data['total'] as $currency => $amount ) {
152
-			$stats[ 'payments_total_' . $currency ] = array(
152
+			$stats['payments_total_' . $currency] = array(
153 153
 				// translators: currency name.
154 154
 				'label'   => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ),
155 155
 				'count'   => $amount,
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		}
160 160
 
161 161
 		if ( $this->has_comparison ) {
162
-			$prev_payment_data  = FrmEmailSummaryHelper::get_payments_data( $this->prev_from_date, $this->prev_to_date );
162
+			$prev_payment_data = FrmEmailSummaryHelper::get_payments_data( $this->prev_from_date, $this->prev_to_date );
163 163
 
164 164
 			if ( ! $payment_data['count'] && ! $prev_payment_data['count'] ) {
165 165
 				// Maybe this site doesn't collect payment, hide these sections.
@@ -171,23 +171,23 @@  discard block
 block discarded – undo
171 171
 
172 172
 			// Compare total for each currency.
173 173
 			foreach ( $payment_data['total'] as $currency => $amount ) {
174
-				if ( ! isset( $prev_payment_data['total'][ $currency ] ) ) {
175
-					$stats[ 'payments_total_' . $currency ]['compare'] = 1;
174
+				if ( ! isset( $prev_payment_data['total'][$currency] ) ) {
175
+					$stats['payments_total_' . $currency]['compare'] = 1;
176 176
 					continue;
177 177
 				}
178 178
 
179
-				$stats[ 'payments_total_' . $currency ]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][ $currency ] );
180
-				unset( $prev_payment_data['total'][ $currency ] );
179
+				$stats['payments_total_' . $currency]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][$currency] );
180
+				unset( $prev_payment_data['total'][$currency] );
181 181
 			}
182 182
 
183 183
 			// If prev month has more currencies.
184 184
 			foreach ( $prev_payment_data['total'] as $currency => $amount ) {
185
-				$stats[ 'payments_total_' . $currency ] = array(
185
+				$stats['payments_total_' . $currency] = array(
186 186
 					// translators: currency name.
187 187
 					'label'   => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ),
188 188
 					'count'   => 0,
189 189
 					'display' => $this->get_formatted_price( 0, $currency ),
190
-					'compare' => -1,
190
+					'compare' => - 1,
191 191
 				);
192 192
 			}
193 193
 		}//end if
Please login to merge, or discard this patch.
classes/models/FrmFieldFormHtml.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param array  $atts
45 45
 	 */
46 46
 	private function _set( $param, $atts ) {
47
-		if ( isset( $atts[ $param ] ) ) {
48
-			$this->{$param} = $atts[ $param ];
47
+		if ( isset( $atts[$param] ) ) {
48
+			$this->{$param} = $atts[$param];
49 49
 		}
50 50
 	}
51 51
 
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 
90 90
 		$exclude = array( 'field_obj', 'html' );
91 91
 		foreach ( $exclude as $ex ) {
92
-			if ( isset( $atts[ $ex ] ) ) {
93
-				unset( $this->pass_args[ $ex ] );
92
+			if ( isset( $atts[$ex] ) ) {
93
+				unset( $this->pass_args[$ex] );
94 94
 			}
95 95
 		}
96 96
 	}
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 * @param array $set
103 103
 	 */
104 104
 	private function set_from_field( $atts, $set ) {
105
-		if ( isset( $atts[ $set['param'] ] ) ) {
106
-			$this->{$set['param']} = $atts[ $set['param'] ];
105
+		if ( isset( $atts[$set['param']] ) ) {
106
+			$this->{$set['param']} = $atts[$set['param']];
107 107
 		} else {
108 108
 			$this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] );
109 109
 		}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	private function replace_error_shortcode() {
232 232
 		$this->maybe_add_error_id();
233
-		$error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false;
233
+		$error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false;
234 234
 
235 235
 		if ( ! empty( $error ) && false === strpos( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) {
236 236
 			$error_body = self::get_error_body( $this->html );
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @since 3.06.02
272 272
 	 */
273 273
 	private function maybe_add_error_id() {
274
-		if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) {
274
+		if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) {
275 275
 			return;
276 276
 		}
277 277
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER );
352 352
 
353 353
 		foreach ( $shortcodes[0] as $short_key => $tag ) {
354
-			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
354
+			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
355 355
 			$tag            = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key );
356 356
 
357 357
 			$replace_with = '';
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 				$replace_with = $this->replace_input_shortcode( $shortcode_atts );
363 363
 			}
364 364
 
365
-			$this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html );
365
+			$this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html );
366 366
 		}
367 367
 	}
368 368
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 			unset( $shortcode_atts['class'] );
395 395
 		}
396 396
 
397
-		$shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false';
397
+		$shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? 'true' : 'false';
398 398
 
399 399
 		$this->field_obj->set_field_column( 'shortcodes', $shortcode_atts );
400 400
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 	 */
447 447
 	private function get_field_div_classes() {
448 448
 		// Add error class
449
-		$classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : '';
449
+		$classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : '';
450 450
 
451 451
 		// Add label position class
452 452
 		$settings = $this->field_obj->display_field_settings();
Please login to merge, or discard this patch.
classes/models/fields/FrmFieldNumber.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 		// Validate the number format.
72 72
 		if ( ! is_numeric( $args['value'] ) && '' !== $args['value'] ) {
73
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
73
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
74 74
 		}
75 75
 
76 76
 		// validate number settings
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 			if ( $frm_settings->use_html && $maxnum !== '' && $minnum !== '' ) {
83 83
 				$value = (float) $args['value'];
84 84
 				if ( $value < $minnum ) {
85
-					$errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' );
85
+					$errors['field' . $args['id']] = __( 'Please select a higher number', 'formidable' );
86 86
 				} elseif ( $value > $maxnum ) {
87
-					$errors[ 'field' . $args['id'] ] = __( 'Please select a lower number', 'formidable' );
87
+					$errors['field' . $args['id']] = __( 'Please select a lower number', 'formidable' );
88 88
 				}
89 89
 			}
90 90
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @return void
106 106
 	 */
107 107
 	private function validate_step( &$errors, $args ) {
108
-		if ( isset( $errors[ 'field' . $args['id'] ] ) ) {
108
+		if ( isset( $errors['field' . $args['id']] ) ) {
109 109
 			// Don't need to check if value is invalid before.
110 110
 			return;
111 111
 		}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 			return;
121 121
 		}
122 122
 
123
-		$errors[ 'field' . $args['id'] ] = sprintf(
123
+		$errors['field' . $args['id']] = sprintf(
124 124
 			// Translators: %1$s: the first nearest value; %2$s: the second nearest value.
125 125
 			__( 'Please enter a valid value. Two nearest valid values are %1$s and %2$s', 'formidable' ),
126 126
 			floatval( $result[0] ),
Please login to merge, or discard this patch.
classes/models/FrmField.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		$values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) );
273 273
 
274 274
 		foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) {
275
-			$new_values[ $col ] = $values[ $col ];
275
+			$new_values[$col] = $values[$col];
276 276
 		}
277 277
 
278 278
 		$new_values['options']       = self::maybe_filter_options( $values['options'] );
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		$new_values['created_at']    = current_time( 'mysql', 1 );
284 284
 
285 285
 		if ( isset( $values['id'] ) ) {
286
-			$frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key'];
286
+			$frm_duplicate_ids[$values['field_key']] = $new_values['field_key'];
287 287
 			$new_values                                = apply_filters( 'frm_duplicated_field', $new_values );
288 288
 		}
289 289
 
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 		foreach ( $new_values as $k => $v ) {
293 293
 			if ( is_array( $v ) ) {
294 294
 				if ( $k === 'default_value' ) {
295
-					$new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v );
295
+					$new_values[$k] = FrmAppHelper::maybe_json_encode( $v );
296 296
 				} else {
297
-					$new_values[ $k ] = serialize( $v );
297
+					$new_values[$k] = serialize( $v );
298 298
 				}
299 299
 			}
300 300
 			unset( $k, $v );
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		}
315 315
 
316 316
 		if ( isset( $values['id'] ) ) {
317
-			$frm_duplicate_ids[ $values['id'] ] = $new_id;
317
+			$frm_duplicate_ids[$values['id']] = $new_id;
318 318
 		}
319 319
 
320 320
 		return $new_id;
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) {
375 375
 		global $frm_duplicate_ids;
376 376
 
377
-		$where  = array(
377
+		$where = array(
378 378
 			array(
379 379
 				'or'                => 1,
380 380
 				'fi.form_id'        => $old_form_id,
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 
421 421
 			$values                                 = apply_filters( 'frm_duplicated_field', $values );
422 422
 			$new_id                                 = self::create( $values );
423
-			$frm_duplicate_ids[ $field->id ]        = $new_id;
424
-			$frm_duplicate_ids[ $field->field_key ] = $new_id;
423
+			$frm_duplicate_ids[$field->id]        = $new_id;
424
+			$frm_duplicate_ids[$field->field_key] = $new_id;
425 425
 			unset( $field );
426 426
 		}//end foreach
427 427
 	}
@@ -459,11 +459,11 @@  discard block
 block discarded – undo
459 459
 
460 460
 		// serialize array values
461 461
 		foreach ( array( 'field_options', 'options' ) as $opt ) {
462
-			if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) {
462
+			if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) {
463 463
 				if ( 'field_options' === $opt ) {
464
-					$values[ $opt ] = self::maybe_filter_options( $values[ $opt ] );
464
+					$values[$opt] = self::maybe_filter_options( $values[$opt] );
465 465
 				}
466
-				$values[ $opt ] = serialize( $values[ $opt ] );
466
+				$values[$opt] = serialize( $values[$opt] );
467 467
 			}
468 468
 		}
469 469
 		if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) {
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 				'id'        => $id,
616 616
 				'field_key' => $id,
617 617
 			);
618
-			$type  = FrmDb::get_var( 'frm_fields', $where, $col );
618
+			$type = FrmDb::get_var( 'frm_fields', $where, $col );
619 619
 		}
620 620
 
621 621
 		return $type;
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 					continue;
642 642
 				}
643 643
 
644
-				$fields[ $result->id ] = $result;
644
+				$fields[$result->id] = $result;
645 645
 				$count ++;
646 646
 				if ( $limit == 1 ) {
647 647
 					$fields = $result;
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 			$count  = 0;
688 688
 			foreach ( $results as $result ) {
689 689
 				$count ++;
690
-				$fields[ $result->id ] = $result;
690
+				$fields[$result->id] = $result;
691 691
 				if ( ! empty( $limit ) && $count >= $limit ) {
692 692
 					break;
693 693
 				}
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 			}
757 757
 
758 758
 			if ( ! empty( $sub_fields ) ) {
759
-				$index        = $k + $index_offset;
759
+				$index = $k + $index_offset;
760 760
 				$index_offset += count( $sub_fields );
761 761
 				array_splice( $results, $index, 0, $sub_fields );
762 762
 			}
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 		$query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results';
802 802
 
803 803
 		if ( is_array( $where ) ) {
804
-			$args    = array(
804
+			$args = array(
805 805
 				'order_by' => $order_by,
806 806
 				'limit'    => $limit,
807 807
 			);
@@ -832,9 +832,9 @@  discard block
 block discarded – undo
832 832
 				FrmDb::set_cache( $result->field_key, $result, 'frm_field' );
833 833
 
834 834
 				self::prepare_options( $result );
835
-				$results[ $r_key ]->field_options = $result->field_options;
836
-				$results[ $r_key ]->options       = $result->options;
837
-				$results[ $r_key ]->default_value = $result->default_value;
835
+				$results[$r_key]->field_options = $result->field_options;
836
+				$results[$r_key]->options       = $result->options;
837
+				$results[$r_key]->default_value = $result->default_value;
838 838
 
839 839
 				unset( $r_key, $result );
840 840
 			}
@@ -1037,23 +1037,23 @@  discard block
 block discarded – undo
1037 1037
 	}
1038 1038
 
1039 1039
 	public static function is_option_true_in_array( $field, $option ) {
1040
-		return isset( $field[ $option ] ) && $field[ $option ];
1040
+		return isset( $field[$option] ) && $field[$option];
1041 1041
 	}
1042 1042
 
1043 1043
 	public static function is_option_true_in_object( $field, $option ) {
1044
-		return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ];
1044
+		return isset( $field->field_options[$option] ) && $field->field_options[$option];
1045 1045
 	}
1046 1046
 
1047 1047
 	public static function is_option_empty_in_array( $field, $option ) {
1048
-		return ! isset( $field[ $option ] ) || empty( $field[ $option ] );
1048
+		return ! isset( $field[$option] ) || empty( $field[$option] );
1049 1049
 	}
1050 1050
 
1051 1051
 	public static function is_option_empty_in_object( $field, $option ) {
1052
-		return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] );
1052
+		return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] );
1053 1053
 	}
1054 1054
 
1055 1055
 	public static function is_option_value_in_object( $field, $option ) {
1056
-		return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != '';
1056
+		return isset( $field->field_options[$option] ) && $field->field_options[$option] != '';
1057 1057
 	}
1058 1058
 
1059 1059
 	/**
@@ -1071,10 +1071,10 @@  discard block
 block discarded – undo
1071 1071
 
1072 1072
 	public static function get_option_in_array( $field, $option ) {
1073 1073
 
1074
-		if ( isset( $field[ $option ] ) ) {
1075
-			$this_option = $field[ $option ];
1076
-		} elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) {
1077
-			$this_option = $field['field_options'][ $option ];
1074
+		if ( isset( $field[$option] ) ) {
1075
+			$this_option = $field[$option];
1076
+		} elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) {
1077
+			$this_option = $field['field_options'][$option];
1078 1078
 		} else {
1079 1079
 			$this_option = '';
1080 1080
 		}
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
 	}
1084 1084
 
1085 1085
 	public static function get_option_in_object( $field, $option ) {
1086
-		return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : '';
1086
+		return isset( $field->field_options[$option] ) ? $field->field_options[$option] : '';
1087 1087
 	}
1088 1088
 
1089 1089
 	/**
Please login to merge, or discard this patch.