Completed
Push — master ( 2be54b...64acd5 )
by Stephanie
02:19
created
classes/controllers/FrmEntriesController.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
 		global $frm_vars;
66 66
 		$form_id = FrmForm::get_current_form_id();
67 67
 
68
-		$columns[ $form_id . '_id' ]       = 'ID';
69
-		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
68
+		$columns[$form_id . '_id']       = 'ID';
69
+		$columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' );
70 70
 
71 71
 		if ( $form_id ) {
72 72
 			self::get_columns_for_form( $form_id, $columns );
73 73
 		} else {
74
-			$columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' );
75
-			$columns[ $form_id . '_name' ]    = __( 'Entry Name', 'formidable' );
76
-			$columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' );
74
+			$columns[$form_id . '_form_id'] = __( 'Form', 'formidable' );
75
+			$columns[$form_id . '_name']    = __( 'Entry Name', 'formidable' );
76
+			$columns[$form_id . '_user_id'] = __( 'Created By', 'formidable' );
77 77
 		}
78 78
 
79
-		$columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
80
-		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
79
+		$columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' );
80
+		$columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' );
81 81
 		self::maybe_add_ip_col( $form_id, $columns );
82 82
 
83 83
 		$frm_vars['cols'] = $columns;
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
 
126 126
 		foreach ( $sub_form_cols as $k => $sub_form_col ) {
127 127
 			if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
128
-				unset( $sub_form_cols[ $k ] );
128
+				unset( $sub_form_cols[$k] );
129 129
 				continue;
130 130
 			}
131
-			$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
131
+			$columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
132 132
 			unset( $sub_form_col );
133 133
 		}
134 134
 	}
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 		$has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' );
146 146
 		$is_post_status     = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] == 'post_status';
147 147
 		if ( $has_separate_value && ! $is_post_status ) {
148
-			$columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 );
148
+			$columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 );
149 149
 		}
150 150
 
151
-		$columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 );
151
+		$columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 );
152 152
 	}
153 153
 
154 154
 	private static function maybe_add_ip_col( $form_id, &$columns ) {
155 155
 		if ( FrmAppHelper::ips_saved() ) {
156
-			$columns[ $form_id . '_ip' ] = 'IP';
156
+			$columns[$form_id . '_ip'] = 'IP';
157 157
 		}
158 158
 	}
159 159
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		foreach ( $meta_value as $mk => $mv ) {
192 192
 			// Remove blank values.
193 193
 			if ( empty( $mv ) ) {
194
-				unset( $meta_value[ $mk ] );
194
+				unset( $meta_value[$mk] );
195 195
 			}
196 196
 		}
197 197
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 		foreach ( $fields as $field ) {
269 269
 			if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
270 270
 				// Can't sort on checkboxes because they are stored serialized, or post fields
271
-				$columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
271
+				$columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id;
272 272
 			}
273 273
 		}
274 274
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 			$atts['form_id'] . '_item_key' => '',
333 333
 			$atts['form_id'] . '_id'       => '',
334 334
 		);
335
-		$cols         = $remove_first + array_reverse( $frm_vars['cols'], true );
335
+		$cols = $remove_first + array_reverse( $frm_vars['cols'], true );
336 336
 
337 337
 		$i = $atts['i'];
338 338
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 
344 344
 			if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) {
345 345
 				$result[] = $col_key;
346
-				$i--;
346
+				$i --;
347 347
 			}
348 348
 
349 349
 			unset( $col_key, $col );
@@ -476,9 +476,9 @@  discard block
 block discarded – undo
476 476
 		if ( ! isset( $frm_vars['form_params'] ) ) {
477 477
 			$frm_vars['form_params'] = array();
478 478
 		}
479
-		$frm_vars['form_params'][ $form->id ] = $params;
479
+		$frm_vars['form_params'][$form->id] = $params;
480 480
 
481
-		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
481
+		if ( isset( $frm_vars['created_entries'][$form_id] ) ) {
482 482
 			return;
483 483
 		}
484 484
 
@@ -494,16 +494,16 @@  discard block
 block discarded – undo
494 494
 		 */
495 495
 		$errors = apply_filters( 'frm_entries_before_create', $errors, $form );
496 496
 
497
-		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
497
+		$frm_vars['created_entries'][$form_id] = array( 'errors' => $errors );
498 498
 
499 499
 		if ( empty( $errors ) ) {
500 500
 			$_POST['frm_skip_cookie'] = 1;
501 501
 			$do_success               = false;
502 502
 			if ( $params['action'] == 'create' ) {
503
-				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
504
-					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
503
+				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) {
504
+					$frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST );
505 505
 
506
-					$params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id'];
506
+					$params['id'] = $frm_vars['created_entries'][$form_id]['entry_id'];
507 507
 					$do_success   = true;
508 508
 				}
509 509
 			}
Please login to merge, or discard this patch.
classes/helpers/FrmAppHelper.php 2 patches
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 			'fill'   => '#4d4d4d',
150 150
 			'orange' => '#f05a24',
151 151
 		);
152
-		$atts     = array_merge( $defaults, $atts );
152
+		$atts = array_merge( $defaults, $atts );
153 153
 
154 154
 		return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 599.68 601.37" width="' . esc_attr( $atts['width'] ) . '" height="' . esc_attr( $atts['height'] ) . '">
155 155
 			<path fill="' . esc_attr( $atts['orange'] ) . '" d="M289.6 384h140v76h-140z"/>
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	 * @return string
338 338
 	 */
339 339
 	public static function get_server_value( $value ) {
340
-		return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : '';
340
+		return isset( $_SERVER[$value] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[$value] ) ) : '';
341 341
 	}
342 342
 
343 343
 	/**
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 		);
361 361
 		$ip = '';
362 362
 		foreach ( $ip_options as $key ) {
363
-			if ( ! isset( $_SERVER[ $key ] ) ) {
363
+			if ( ! isset( $_SERVER[$key] ) ) {
364 364
 				continue;
365 365
 			}
366 366
 
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 
386 386
 		if ( $src == 'get' ) {
387 387
 			// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
388
-			$value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default );
389
-			if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
388
+			$value = isset( $_POST[$param] ) ? wp_unslash( $_POST[$param] ) : ( isset( $_GET[$param] ) ? wp_unslash( $_GET[$param] ) : $default );
389
+			if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) {
390 390
 				// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
391
-				$value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) );
391
+				$value = htmlspecialchars_decode( wp_unslash( $_GET[$param] ) );
392 392
 			}
393 393
 			self::sanitize_value( $sanitize, $value );
394 394
 		} else {
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 				}
410 410
 
411 411
 				$p     = trim( $p, ']' );
412
-				$value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
412
+				$value = isset( $value[$p] ) ? $value[$p] : $default;
413 413
 			}
414 414
 		}
415 415
 
@@ -465,26 +465,26 @@  discard block
 block discarded – undo
465 465
 			'sanitize' => 'sanitize_text_field',
466 466
 			'serialized' => false,
467 467
 		);
468
-		$args     = wp_parse_args( $args, $defaults );
468
+		$args = wp_parse_args( $args, $defaults );
469 469
 
470 470
 		$value = $args['default'];
471 471
 		if ( $args['type'] == 'get' ) {
472
-			if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
472
+			if ( $_GET && isset( $_GET[$args['param']] ) ) {
473 473
 				// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
474
-				$value = wp_unslash( $_GET[ $args['param'] ] );
474
+				$value = wp_unslash( $_GET[$args['param']] );
475 475
 			}
476 476
 		} elseif ( $args['type'] == 'post' ) {
477
-			if ( isset( $_POST[ $args['param'] ] ) ) {
477
+			if ( isset( $_POST[$args['param']] ) ) {
478 478
 				// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
479
-				$value = wp_unslash( $_POST[ $args['param'] ] );
479
+				$value = wp_unslash( $_POST[$args['param']] );
480 480
 				if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) {
481 481
 					self::unserialize_or_decode( $value );
482 482
 				}
483 483
 			}
484 484
 		} else {
485
-			if ( isset( $_REQUEST[ $args['param'] ] ) ) {
485
+			if ( isset( $_REQUEST[$args['param']] ) ) {
486 486
 				// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
487
-				$value = wp_unslash( $_REQUEST[ $args['param'] ] );
487
+				$value = wp_unslash( $_REQUEST[$args['param']] );
488 488
 			}
489 489
 		}
490 490
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 			if ( is_array( $value ) ) {
517 517
 				$temp_values = $value;
518 518
 				foreach ( $temp_values as $k => $v ) {
519
-					self::sanitize_value( $sanitize, $value[ $k ] );
519
+					self::sanitize_value( $sanitize, $value[$k] );
520 520
 				}
521 521
 			} else {
522 522
 				$value = call_user_func( $sanitize, $value );
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 	public static function sanitize_request( $sanitize_method, &$values ) {
528 528
 		$temp_values = $values;
529 529
 		foreach ( $temp_values as $k => $val ) {
530
-			if ( isset( $sanitize_method[ $k ] ) ) {
531
-				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
530
+			if ( isset( $sanitize_method[$k] ) ) {
531
+				$values[$k] = call_user_func( $sanitize_method[$k], $val );
532 532
 			}
533 533
 		}
534 534
 	}
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 		if ( is_array( $value ) ) {
552 552
 			$temp_values = $value;
553 553
 			foreach ( $temp_values as $k => $v ) {
554
-				self::decode_specialchars( $value[ $k ] );
554
+				self::decode_specialchars( $value[$k] );
555 555
 			}
556 556
 		} else {
557 557
 			self::decode_amp( $value );
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 			$allowed_html = $html;
629 629
 		} elseif ( ! empty( $allowed ) ) {
630 630
 			foreach ( (array) $allowed as $a ) {
631
-				$allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array();
631
+				$allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array();
632 632
 			}
633 633
 		}
634 634
 
@@ -785,8 +785,8 @@  discard block
 block discarded – undo
785 785
 		}
786 786
 
787 787
 		global $wp_query;
788
-		if ( isset( $wp_query->query_vars[ $param ] ) ) {
789
-			$value = $wp_query->query_vars[ $param ];
788
+		if ( isset( $wp_query->query_vars[$param] ) ) {
789
+			$value = $wp_query->query_vars[$param];
790 790
 		}
791 791
 
792 792
 		return $value;
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 				'new_file_path' => self::plugin_path() . '/js',
951 951
 			)
952 952
 		);
953
-		$new_file  = new FrmCreateFile( $file_atts );
953
+		$new_file = new FrmCreateFile( $file_atts );
954 954
 
955 955
 		$files = array(
956 956
 			self::plugin_path() . '/js/jquery/jquery.placeholder.min.js',
@@ -1208,8 +1208,8 @@  discard block
 block discarded – undo
1208 1208
 			return $error;
1209 1209
 		}
1210 1210
 
1211
-		$nonce_value = ( $_REQUEST && isset( $_REQUEST[ $nonce_name ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $nonce_name ] ) ) : '';
1212
-		if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) {
1211
+		$nonce_value = ( $_REQUEST && isset( $_REQUEST[$nonce_name] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[$nonce_name] ) ) : '';
1212
+		if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) {
1213 1213
 			$frm_settings = self::get_settings();
1214 1214
 			$error        = $frm_settings->admin_permission;
1215 1215
 		}
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 			} else {
1245 1245
 				foreach ( $value as $k => $v ) {
1246 1246
 					if ( ! is_array( $v ) ) {
1247
-						$value[ $k ] = call_user_func( $original_function, $v );
1247
+						$value[$k] = call_user_func( $original_function, $v );
1248 1248
 					}
1249 1249
 				}
1250 1250
 			}
@@ -1269,7 +1269,7 @@  discard block
 block discarded – undo
1269 1269
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
1270 1270
 			} else {
1271 1271
 				if ( $keys == 'keep' ) {
1272
-					$return[ $key ] = $value;
1272
+					$return[$key] = $value;
1273 1273
 				} else {
1274 1274
 					$return[] = $value;
1275 1275
 				}
@@ -1333,11 +1333,11 @@  discard block
 block discarded – undo
1333 1333
 		}
1334 1334
 
1335 1335
 		$ver = $default;
1336
-		if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
1336
+		if ( ! isset( $wp_scripts->registered[$handle] ) ) {
1337 1337
 			return $ver;
1338 1338
 		}
1339 1339
 
1340
-		$query = $wp_scripts->registered[ $handle ];
1340
+		$query = $wp_scripts->registered[$handle];
1341 1341
 		if ( is_object( $query ) && ! empty( $query->ver ) ) {
1342 1342
 			$ver = $query->ver;
1343 1343
 		}
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
 
1473 1473
 		foreach ( array( 'name', 'description' ) as $var ) {
1474 1474
 			$default_val    = isset( $record->{$var} ) ? $record->{$var} : '';
1475
-			$values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
1475
+			$values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
1476 1476
 			unset( $var, $default_val );
1477 1477
 		}
1478 1478
 
@@ -1527,9 +1527,9 @@  discard block
 block discarded – undo
1527 1527
 			}
1528 1528
 		}
1529 1529
 
1530
-		$field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type;
1531
-		if ( isset( $post_values['item_meta'][ $field->id ] ) ) {
1532
-			$new_value = $post_values['item_meta'][ $field->id ];
1530
+		$field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type;
1531
+		if ( isset( $post_values['item_meta'][$field->id] ) ) {
1532
+			$new_value = $post_values['item_meta'][$field->id];
1533 1533
 			self::unserialize_or_decode( $new_value );
1534 1534
 		} else {
1535 1535
 			$new_value = $meta_value;
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
 
1551 1551
 		$field_array = array_merge( $field->field_options, $field_array );
1552 1552
 
1553
-		$values['fields'][ $field->id ] = $field_array;
1553
+		$values['fields'][$field->id] = $field_array;
1554 1554
 	}
1555 1555
 
1556 1556
 	/**
@@ -1597,11 +1597,11 @@  discard block
 block discarded – undo
1597 1597
 		}
1598 1598
 
1599 1599
 		foreach ( $form->options as $opt => $value ) {
1600
-			if ( isset( $post_values[ $opt ] ) ) {
1601
-				$values[ $opt ] = $post_values[ $opt ];
1602
-				self::unserialize_or_decode( $values[ $opt ] );
1600
+			if ( isset( $post_values[$opt] ) ) {
1601
+				$values[$opt] = $post_values[$opt];
1602
+				self::unserialize_or_decode( $values[$opt] );
1603 1603
 			} else {
1604
-				$values[ $opt ] = $value;
1604
+				$values[$opt] = $value;
1605 1605
 			}
1606 1606
 		}
1607 1607
 
@@ -1615,8 +1615,8 @@  discard block
 block discarded – undo
1615 1615
 		$form_defaults = FrmFormsHelper::get_default_opts();
1616 1616
 
1617 1617
 		foreach ( $form_defaults as $opt => $default ) {
1618
-			if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1619
-				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1618
+			if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) {
1619
+				$values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default;
1620 1620
 			}
1621 1621
 
1622 1622
 			unset( $opt, $default );
@@ -1627,8 +1627,8 @@  discard block
 block discarded – undo
1627 1627
 		}
1628 1628
 
1629 1629
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1630
-			if ( ! isset( $values[ $h . '_html' ] ) ) {
1631
-				$values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
1630
+			if ( ! isset( $values[$h . '_html'] ) ) {
1631
+				$values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) );
1632 1632
 			}
1633 1633
 			unset( $h );
1634 1634
 		}
@@ -1778,10 +1778,10 @@  discard block
 block discarded – undo
1778 1778
 		$time_strings = self::get_time_strings();
1779 1779
 
1780 1780
 		foreach ( $time_strings as $k => $v ) {
1781
-			if ( $diff[ $k ] ) {
1782
-				$time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] );
1781
+			if ( $diff[$k] ) {
1782
+				$time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] );
1783 1783
 			} else {
1784
-				unset( $time_strings[ $k ] );
1784
+				unset( $time_strings[$k] );
1785 1785
 			}
1786 1786
 		}
1787 1787
 
@@ -1862,17 +1862,17 @@  discard block
 block discarded – undo
1862 1862
 
1863 1863
 					case 1:
1864 1864
 						$l2 = $name;
1865
-						self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1865
+						self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] );
1866 1866
 						break;
1867 1867
 
1868 1868
 					case 2:
1869 1869
 						$l3 = $name;
1870
-						self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1870
+						self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] );
1871 1871
 						break;
1872 1872
 
1873 1873
 					case 3:
1874 1874
 						$l4 = $name;
1875
-						self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1875
+						self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] );
1876 1876
 				}
1877 1877
 
1878 1878
 				unset( $this_val, $n );
@@ -1891,8 +1891,8 @@  discard block
 block discarded – undo
1891 1891
 	public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1892 1892
 		if ( $name == '' ) {
1893 1893
 			$vars[] = $val;
1894
-		} elseif ( ! isset( $vars[ $l1 ] ) ) {
1895
-			$vars[ $l1 ] = $val;
1894
+		} elseif ( ! isset( $vars[$l1] ) ) {
1895
+			$vars[$l1] = $val;
1896 1896
 		}
1897 1897
 	}
1898 1898
 
@@ -1908,7 +1908,7 @@  discard block
 block discarded – undo
1908 1908
 			'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1909 1909
 		);
1910 1910
 
1911
-		if ( ! isset( $tooltips[ $name ] ) ) {
1911
+		if ( ! isset( $tooltips[$name] ) ) {
1912 1912
 			return;
1913 1913
 		}
1914 1914
 
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
 			echo ' class="frm_help"';
1919 1919
 		}
1920 1920
 
1921
-		echo ' title="' . esc_attr( $tooltips[ $name ] );
1921
+		echo ' title="' . esc_attr( $tooltips[$name] );
1922 1922
 
1923 1923
 		if ( 'open' != $class ) {
1924 1924
 			echo '"';
@@ -1971,13 +1971,13 @@  discard block
 block discarded – undo
1971 1971
 	}
1972 1972
 
1973 1973
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1974
-		if ( ! isset( $post_content[ $key ] ) ) {
1974
+		if ( ! isset( $post_content[$key] ) ) {
1975 1975
 			return;
1976 1976
 		}
1977 1977
 
1978 1978
 		if ( is_array( $val ) ) {
1979 1979
 			foreach ( $val as $k1 => $v1 ) {
1980
-				self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] );
1980
+				self::prepare_action_slashes( $v1, $k1, $post_content[$key] );
1981 1981
 				unset( $k1, $v1 );
1982 1982
 			}
1983 1983
 		} else {
@@ -1985,7 +1985,7 @@  discard block
 block discarded – undo
1985 1985
 			$val = stripslashes( $val );
1986 1986
 
1987 1987
 			// Add backslashes before double quotes and forward slashes only
1988
-			$post_content[ $key ] = addcslashes( $val, '"\\/' );
1988
+			$post_content[$key] = addcslashes( $val, '"\\/' );
1989 1989
 		}
1990 1990
 	}
1991 1991
 
@@ -2044,14 +2044,14 @@  discard block
 block discarded – undo
2044 2044
 				continue;
2045 2045
 			}
2046 2046
 			$key = $input['name'];
2047
-			if ( isset( $formatted[ $key ] ) ) {
2048
-				if ( is_array( $formatted[ $key ] ) ) {
2049
-					$formatted[ $key ][] = $input['value'];
2047
+			if ( isset( $formatted[$key] ) ) {
2048
+				if ( is_array( $formatted[$key] ) ) {
2049
+					$formatted[$key][] = $input['value'];
2050 2050
 				} else {
2051
-					$formatted[ $key ] = array( $formatted[ $key ], $input['value'] );
2051
+					$formatted[$key] = array( $formatted[$key], $input['value'] );
2052 2052
 				}
2053 2053
 			} else {
2054
-				$formatted[ $key ] = $input['value'];
2054
+				$formatted[$key] = $input['value'];
2055 2055
 			}
2056 2056
 		}
2057 2057
 
Please login to merge, or discard this patch.
Doc Comments   +24 added lines patch added patch discarded remove patch
@@ -69,6 +69,9 @@  discard block
 block discarded – undo
69 69
 		return $url;
70 70
 	}
71 71
 
72
+	/**
73
+	 * @return string
74
+	 */
72 75
 	public static function get_affiliate() {
73 76
 		return absint( apply_filters( 'frm_affiliate_id', 0 ) );
74 77
 	}
@@ -134,6 +137,9 @@  discard block
 block discarded – undo
134 137
 		return $frm_settings;
135 138
 	}
136 139
 
140
+	/**
141
+	 * @return string
142
+	 */
137 143
 	public static function get_menu_name() {
138 144
 		$frm_settings = self::get_settings();
139 145
 
@@ -1116,6 +1122,8 @@  discard block
 block discarded – undo
1116 1122
 	 * This is for reverse compatibility with switching 3 params to 1.
1117 1123
 	 *
1118 1124
 	 * @since 4.03.06
1125
+	 * @param string $page_id
1126
+	 * @param boolean $truncate
1119 1127
 	 */
1120 1128
 	private static function prep_page_dropdown_params( $page_id, $truncate, &$args ) {
1121 1129
 		if ( ! is_array( $args ) ) {
@@ -1353,6 +1361,9 @@  discard block
 block discarded – undo
1353 1361
 		return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current );
1354 1362
 	}
1355 1363
 
1364
+	/**
1365
+	 * @param string $function
1366
+	 */
1356 1367
 	public static function recursive_function_map( $value, $function ) {
1357 1368
 		if ( is_array( $value ) ) {
1358 1369
 			$original_function = $function;
@@ -1401,6 +1412,9 @@  discard block
 block discarded – undo
1401 1412
 		return $return;
1402 1413
 	}
1403 1414
 
1415
+	/**
1416
+	 * @return string
1417
+	 */
1404 1418
 	public static function esc_textarea( $text, $is_rich_text = false ) {
1405 1419
 		$safe_text = str_replace( '&quot;', '"', $text );
1406 1420
 		if ( ! $is_rich_text ) {
@@ -1613,6 +1627,9 @@  discard block
 block discarded – undo
1613 1627
 		return $values;
1614 1628
 	}
1615 1629
 
1630
+	/**
1631
+	 * @param string $fields
1632
+	 */
1616 1633
 	private static function prepare_field_arrays( $fields, $record, array &$values, $args ) {
1617 1634
 		if ( ! empty( $fields ) ) {
1618 1635
 			foreach ( (array) $fields as $field ) {
@@ -1816,6 +1833,9 @@  discard block
 block discarded – undo
1816 1833
 		return $sub . ( ( $len < $original_len ) ? $continue : '' );
1817 1834
 	}
1818 1835
 
1836
+	/**
1837
+	 * @param string[] $function_names
1838
+	 */
1819 1839
 	public static function mb_function( $function_names, $args ) {
1820 1840
 		$mb_function_name = $function_names[0];
1821 1841
 		$function_name    = $function_names[1];
@@ -1850,6 +1870,9 @@  discard block
 block discarded – undo
1850 1870
 		return $formatted;
1851 1871
 	}
1852 1872
 
1873
+	/**
1874
+	 * @param string $time_format
1875
+	 */
1853 1876
 	private static function add_time_to_date( $time_format, $date ) {
1854 1877
 		if ( empty( $time_format ) ) {
1855 1878
 			$time_format = get_option( 'time_format' );
@@ -2337,6 +2360,7 @@  discard block
 block discarded – undo
2337 2360
 	 * If Pro is far outdated, show a message.
2338 2361
 	 *
2339 2362
 	 * @since 4.0.01
2363
+	 * @param string $min_version
2340 2364
 	 */
2341 2365
 	public static function min_pro_version_notice( $min_version ) {
2342 2366
 		if ( ! self::is_formidable_admin() ) {
Please login to merge, or discard this patch.
classes/helpers/FrmFormsHelper.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 			'class'        => '',
29 29
 			'inc_children' => 'exclude',
30 30
 		);
31
-		$args     = wp_parse_args( $args, $defaults );
31
+		$args = wp_parse_args( $args, $defaults );
32 32
 
33 33
 		if ( ! $args['field_id'] ) {
34 34
 			$args['field_id'] = $field_name;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public static function add_html_attr( $class, $param, &$add_html ) {
72 72
 		if ( ! empty( $class ) ) {
73
-			$add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
73
+			$add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
74 74
 		}
75 75
 	}
76 76
 
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
 			'description' => '',
277 277
 		);
278 278
 		foreach ( $defaults as $var => $default ) {
279
-			if ( ! isset( $values[ $var ] ) ) {
280
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
279
+			if ( ! isset( $values[$var] ) ) {
280
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
281 281
 			}
282 282
 		}
283 283
 
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 			'parent_form_id' => 0,
293 293
 		);
294 294
 		foreach ( $defaults as $var => $default ) {
295
-			if ( ! isset( $values[ $var ] ) ) {
296
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
295
+			if ( ! isset( $values[$var] ) ) {
296
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
297 297
 			}
298 298
 		}
299 299
 		unset( $defaults );
@@ -330,16 +330,16 @@  discard block
 block discarded – undo
330 330
 		$defaults = self::get_default_opts();
331 331
 		foreach ( $defaults as $var => $default ) {
332 332
 			if ( is_array( $default ) ) {
333
-				if ( ! isset( $values[ $var ] ) ) {
334
-					$values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array();
333
+				if ( ! isset( $values[$var] ) ) {
334
+					$values[$var] = ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : array();
335 335
 				}
336 336
 
337 337
 				foreach ( $default as $k => $v ) {
338
-					$values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v );
338
+					$values[$var][$k] = ( $post_values && isset( $post_values[$var][$k] ) ) ? $post_values[$var][$k] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ) ? $record->options[$var][$k] : $v );
339 339
 
340 340
 					if ( is_array( $v ) ) {
341 341
 						foreach ( $v as $k1 => $v1 ) {
342
-							$values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 );
342
+							$values[$var][$k][$k1] = ( $post_values && isset( $post_values[$var][$k][$k1] ) ) ? $post_values[$var][$k][$k1] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ) ? $record->options[$var][$k][$k1] : $v1 );
343 343
 							unset( $k1, $v1 );
344 344
 						}
345 345
 					}
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 					unset( $k, $v );
348 348
 				}
349 349
 			} else {
350
-				$values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default );
350
+				$values[$var] = ( $post_values && isset( $post_values['options'][$var] ) ) ? $post_values['options'][$var] : ( ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : $default );
351 351
 			}
352 352
 
353 353
 			unset( $var, $default );
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	public static function fill_form_options( &$options, $values ) {
386 386
 		$defaults = self::get_default_opts();
387 387
 		foreach ( $defaults as $var => $default ) {
388
-			$options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default;
388
+			$options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default;
389 389
 			unset( $var, $default );
390 390
 		}
391 391
 	}
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 	public static function insert_opt_html( $args ) {
542 542
 		$class  = isset( $args['class'] ) ? $args['class'] : '';
543 543
 		$fields = FrmField::all_field_selection();
544
-		$field  = isset( $fields[ $args['type'] ] ) ? $fields[ $args['type'] ] : array();
544
+		$field  = isset( $fields[$args['type']] ) ? $fields[$args['type']] : array();
545 545
 
546 546
 		self::prepare_field_type( $field );
547 547
 
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 			FrmField::update( $field->id, array( 'field_order' => $field->field_order + 2 ) );
694 694
 		}
695 695
 
696
-		$add_order    += 2;
696
+		$add_order += 2;
697 697
 		$open         = false;
698 698
 		$reset_fields = true;
699 699
 	}
@@ -1045,10 +1045,10 @@  discard block
 block discarded – undo
1045 1045
 				$link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"';
1046 1046
 			}
1047 1047
 
1048
-			$label = ( isset( $link_details[ $length ] ) ? $link_details[ $length ] : $link_details['label'] );
1049
-			if ( $length == 'icon' && isset( $link_details[ $length ] ) ) {
1048
+			$label = ( isset( $link_details[$length] ) ? $link_details[$length] : $link_details['label'] );
1049
+			if ( $length == 'icon' && isset( $link_details[$length] ) ) {
1050 1050
 				$label = '<span class="' . $label . '" title="' . esc_attr( $link_details['label'] ) . '" aria-hidden="true"></span>';
1051
-				$link  .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"';
1051
+				$link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"';
1052 1052
 			}
1053 1053
 
1054 1054
 			$link .= '>' . $label . '</a>';
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 			$status = 'publish';
1197 1197
 		}
1198 1198
 
1199
-		$name = $nice_names[ $status ];
1199
+		$name = $nice_names[$status];
1200 1200
 
1201 1201
 		return $name;
1202 1202
 	}
@@ -1223,11 +1223,11 @@  discard block
 block discarded – undo
1223 1223
 
1224 1224
 		if ( count( $categories ) === 1 ) {
1225 1225
 			$category = reset( $categories );
1226
-			$icon     = isset( $icons[ $category ] ) ? $icons[ $category ] : $icon;
1226
+			$icon     = isset( $icons[$category] ) ? $icons[$category] : $icon;
1227 1227
 		} elseif ( ! empty( $categories ) ) {
1228 1228
 			foreach ( $icons as $cat => $icon ) {
1229 1229
 				if ( ! in_array( $cat, $categories ) ) {
1230
-					unset( $icons[ $cat ] );
1230
+					unset( $icons[$cat] );
1231 1231
 				}
1232 1232
 			}
1233 1233
 			$icon = reset( $icons );
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 
1354 1354
 		foreach ( $item['categories'] as $k => $category ) {
1355 1355
 			if ( in_array( $category, $plans ) ) {
1356
-				unset( $item['categories'][ $k ] );
1356
+				unset( $item['categories'][$k] );
1357 1357
 				return $category;
1358 1358
 			}
1359 1359
 		}
Please login to merge, or discard this patch.
Doc Comments   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -219,6 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
 	/**
221 221
 	 * @since 3.0
222
+	 * @return string
222 223
 	 */
223 224
 	public static function get_field_link_icon( $field_type ) {
224 225
 		if ( is_array( $field_type ) && isset( $field_type['icon'] ) ) {
@@ -698,6 +699,9 @@  discard block
 block discarded – undo
698 699
 		$reset_fields = true;
699 700
 	}
700 701
 
702
+	/**
703
+	 * @return string
704
+	 */
701 705
 	public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) {
702 706
 		$codes = array(
703 707
 			'form_name'        => $title,
@@ -858,7 +862,7 @@  discard block
 block discarded – undo
858 862
 	}
859 863
 
860 864
 	/**
861
-	 * @param object|string|boolean $form
865
+	 * @param string|boolean $form
862 866
 	 *
863 867
 	 * @return string
864 868
 	 */
@@ -1389,7 +1393,7 @@  discard block
 block discarded – undo
1389 1393
 	 *
1390 1394
 	 * @param array $values The $_POST array, which contains the values submitted in a form.
1391 1395
 	 *
1392
-	 * @return bool|string A warning message about unsafe params or false.
1396
+	 * @return false|string A warning message about unsafe params or false.
1393 1397
 	 */
1394 1398
 	private static function check_redirect_url_for_unsafe_params( $values ) {
1395 1399
 		if ( ! isset( $values['options'] ) ) {
@@ -1434,7 +1438,7 @@  discard block
 block discarded – undo
1434 1438
 	 *
1435 1439
 	 * @param array $unsafe_params_in_redirect Array of params from the redirect URL whose names are reserved words.
1436 1440
 	 *
1437
-	 * @return bool|string A string with an unsafe param message or false.
1441
+	 * @return false|string A string with an unsafe param message or false.
1438 1442
 	 */
1439 1443
 	private static function create_unsafe_param_warning( $unsafe_params_in_redirect ) {
1440 1444
 		$count                = count( $unsafe_params_in_redirect );
@@ -1465,7 +1469,7 @@  discard block
 block discarded – undo
1465 1469
 	 *
1466 1470
 	 * @since 4.04
1467 1471
 	 *
1468
-	 * @return array Array of WordPress reserved words.
1472
+	 * @return string[] Array of WordPress reserved words.
1469 1473
 	 */
1470 1474
 	public static function reserved_words() {
1471 1475
 		return array(
Please login to merge, or discard this patch.
classes/models/fields/FrmFieldUserID.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	protected function get_field_value( $args ) {
50 50
 		$user_ID      = get_current_user_id();
51 51
 		$user_ID      = ( $user_ID ? $user_ID : '' );
52
-		$posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // WPCS: CSRF ok.
52
+		$posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][$this->field['id']] ) ); // WPCS: CSRF ok.
53 53
 		$action       = ( isset( $args['action'] ) ? $args['action'] : ( isset( $args['form_action'] ) ? $args['form_action'] : '' ) );
54 54
 		$updating     = $action == 'update';
55 55
 		return ( is_numeric( $this->field['value'] ) || $posted_value || $updating ) ? $this->field['value'] : $user_ID;
Please login to merge, or discard this patch.
classes/views/frm-forms/add_field_links.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,10 +49,10 @@
 block discarded – undo
49 49
 foreach ( $pro_fields as $field_key => $field_type ) {
50 50
 
51 51
 	if ( isset( $field_type['section'] ) ) {
52
-		if ( ! isset( $field_sections[ $field_type['section'] ] ) ) {
53
-			$field_sections[ $field_type['section'] ] = array();
52
+		if ( ! isset( $field_sections[$field_type['section']] ) ) {
53
+			$field_sections[$field_type['section']] = array();
54 54
 		}
55
-		$field_sections[ $field_type['section'] ][ $field_key ] = $field_type;
55
+		$field_sections[$field_type['section']][$field_key] = $field_type;
56 56
 		continue;
57 57
 	}
58 58
 
Please login to merge, or discard this patch.
classes/models/FrmField.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		$new_values['field_key'] = FrmAppHelper::get_unique_key( $key, $wpdb->prefix . 'frm_fields', 'field_key' );
218 218
 
219 219
 		foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) {
220
-			$new_values[ $col ] = $values[ $col ];
220
+			$new_values[$col] = $values[$col];
221 221
 		}
222 222
 
223 223
 		$new_values['options'] = $values['options'];
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		$new_values['created_at']    = current_time( 'mysql', 1 );
230 230
 
231 231
 		if ( isset( $values['id'] ) ) {
232
-			$frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key'];
232
+			$frm_duplicate_ids[$values['field_key']] = $new_values['field_key'];
233 233
 			$new_values                                = apply_filters( 'frm_duplicated_field', $new_values );
234 234
 		}
235 235
 
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 		foreach ( $new_values as $k => $v ) {
239 239
 			if ( is_array( $v ) ) {
240 240
 				if ( $k === 'default_value' ) {
241
-					$new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v );
241
+					$new_values[$k] = FrmAppHelper::maybe_json_encode( $v );
242 242
 				} else {
243
-					$new_values[ $k ] = serialize( $v );
243
+					$new_values[$k] = serialize( $v );
244 244
 				}
245 245
 			}
246 246
 			unset( $k, $v );
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
 		if ( $query_results ) {
264 264
 			if ( isset( $values['id'] ) ) {
265
-				$frm_duplicate_ids[ $values['id'] ] = $new_id;
265
+				$frm_duplicate_ids[$values['id']] = $new_id;
266 266
 			}
267 267
 
268 268
 			return $new_id;
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) {
275 275
 		global $frm_duplicate_ids;
276 276
 
277
-		$where  = array(
277
+		$where = array(
278 278
 			array(
279 279
 				'or'                => 1,
280 280
 				'fi.form_id'        => $old_form_id,
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 
321 321
 			$values                                 = apply_filters( 'frm_duplicated_field', $values );
322 322
 			$new_id                                 = self::create( $values );
323
-			$frm_duplicate_ids[ $field->id ]        = $new_id;
324
-			$frm_duplicate_ids[ $field->field_key ] = $new_id;
323
+			$frm_duplicate_ids[$field->id]        = $new_id;
324
+			$frm_duplicate_ids[$field->field_key] = $new_id;
325 325
 			unset( $field );
326 326
 		}
327 327
 	}
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
 
353 353
 		// serialize array values
354 354
 		foreach ( array( 'field_options', 'options' ) as $opt ) {
355
-			if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) {
356
-				$values[ $opt ] = serialize( $values[ $opt ] );
355
+			if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) {
356
+				$values[$opt] = serialize( $values[$opt] );
357 357
 			}
358 358
 		}
359 359
 		if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) {
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 				'id'        => $id,
506 506
 				'field_key' => $id,
507 507
 			);
508
-			$type  = FrmDb::get_var( 'frm_fields', $where, $col );
508
+			$type = FrmDb::get_var( 'frm_fields', $where, $col );
509 509
 		}
510 510
 
511 511
 		return $type;
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 					continue;
532 532
 				}
533 533
 
534
-				$fields[ $result->id ] = $result;
534
+				$fields[$result->id] = $result;
535 535
 				$count ++;
536 536
 				if ( $limit == 1 ) {
537 537
 					$fields = $result;
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 			$count  = 0;
578 578
 			foreach ( $results as $result ) {
579 579
 				$count ++;
580
-				$fields[ $result->id ] = $result;
580
+				$fields[$result->id] = $result;
581 581
 				if ( ! empty( $limit ) && $count >= $limit ) {
582 582
 					break;
583 583
 				}
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 			}
647 647
 
648 648
 			if ( ! empty( $sub_fields ) ) {
649
-				$index        = $k + $index_offset;
649
+				$index = $k + $index_offset;
650 650
 				$index_offset += count( $sub_fields );
651 651
 				array_splice( $results, $index, 0, $sub_fields );
652 652
 			}
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 		$query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results';
692 692
 
693 693
 		if ( is_array( $where ) ) {
694
-			$args    = array(
694
+			$args = array(
695 695
 				'order_by' => $order_by,
696 696
 				'limit'    => $limit,
697 697
 			);
@@ -722,9 +722,9 @@  discard block
 block discarded – undo
722 722
 				FrmDb::set_cache( $result->field_key, $result, 'frm_field' );
723 723
 
724 724
 				self::prepare_options( $result );
725
-				$results[ $r_key ]->field_options = $result->field_options;
726
-				$results[ $r_key ]->options       = $result->options;
727
-				$results[ $r_key ]->default_value = $result->default_value;
725
+				$results[$r_key]->field_options = $result->field_options;
726
+				$results[$r_key]->options       = $result->options;
727
+				$results[$r_key]->default_value = $result->default_value;
728 728
 
729 729
 				unset( $r_key, $result );
730 730
 			}
@@ -926,23 +926,23 @@  discard block
 block discarded – undo
926 926
 	}
927 927
 
928 928
 	public static function is_option_true_in_array( $field, $option ) {
929
-		return isset( $field[ $option ] ) && $field[ $option ];
929
+		return isset( $field[$option] ) && $field[$option];
930 930
 	}
931 931
 
932 932
 	public static function is_option_true_in_object( $field, $option ) {
933
-		return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ];
933
+		return isset( $field->field_options[$option] ) && $field->field_options[$option];
934 934
 	}
935 935
 
936 936
 	public static function is_option_empty_in_array( $field, $option ) {
937
-		return ! isset( $field[ $option ] ) || empty( $field[ $option ] );
937
+		return ! isset( $field[$option] ) || empty( $field[$option] );
938 938
 	}
939 939
 
940 940
 	public static function is_option_empty_in_object( $field, $option ) {
941
-		return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] );
941
+		return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] );
942 942
 	}
943 943
 
944 944
 	public static function is_option_value_in_object( $field, $option ) {
945
-		return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != '';
945
+		return isset( $field->field_options[$option] ) && $field->field_options[$option] != '';
946 946
 	}
947 947
 
948 948
 	/**
@@ -960,10 +960,10 @@  discard block
 block discarded – undo
960 960
 
961 961
 	public static function get_option_in_array( $field, $option ) {
962 962
 
963
-		if ( isset( $field[ $option ] ) ) {
964
-			$this_option = $field[ $option ];
965
-		} elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) {
966
-			$this_option = $field['field_options'][ $option ];
963
+		if ( isset( $field[$option] ) ) {
964
+			$this_option = $field[$option];
965
+		} elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) {
966
+			$this_option = $field['field_options'][$option];
967 967
 		} else {
968 968
 			$this_option = '';
969 969
 		}
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 	}
973 973
 
974 974
 	public static function get_option_in_object( $field, $option ) {
975
-		return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : '';
975
+		return isset( $field->field_options[$option] ) ? $field->field_options[$option] : '';
976 976
 	}
977 977
 
978 978
 	/**
Please login to merge, or discard this patch.