Completed
Pull Request — master (#2513)
by
unknown
43s
created
classes/controllers/FrmFieldsController.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 		$_GET['page'] = 'formidable';
27 27
 
28
-		$values     = array(
28
+		$values = array(
29 29
 			'id'         => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
30 30
 			'doing_ajax' => true,
31 31
 		);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 			ob_start();
50 50
 			self::load_single_field( $field, $values );
51
-			$field_html[ absint( $field->id ) ] = ob_get_contents();
51
+			$field_html[absint( $field->id )] = ob_get_contents();
52 52
 			ob_end_clean();
53 53
 		}
54 54
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 			foreach ( $opts as $opt_key => $opt ) {
281 281
 				if ( strpos( $opt, '|' ) !== false ) {
282 282
 					$vals             = explode( '|', $opt );
283
-					$opts[ $opt_key ] = array(
283
+					$opts[$opt_key] = array(
284 284
 						'label' => trim( $vals[0] ),
285 285
 						'value' => trim( $vals[1] ),
286 286
 					);
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 			$other_array = array();
296 296
 			foreach ( $field['options'] as $opt_key => $opt ) {
297 297
 				if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
298
-					$other_array[ $opt_key ] = $opt;
298
+					$other_array[$opt_key] = $opt;
299 299
 				}
300 300
 				unset( $opt_key, $opt );
301 301
 			}
@@ -338,18 +338,18 @@  discard block
 block discarded – undo
338 338
 		$frm_settings         = FrmAppHelper::get_settings();
339 339
 		$field_types          = FrmFieldTypeOptionData::get_field_types( $field['type'] );
340 340
 
341
-		if ( ! isset( $all_field_types[ $field['type'] ] ) ) {
341
+		if ( ! isset( $all_field_types[$field['type']] ) ) {
342 342
 			// Add fallback for an add-on field type that has been deactivated.
343
-			$all_field_types[ $field['type'] ] = array(
343
+			$all_field_types[$field['type']] = array(
344 344
 				'name' => ucfirst( $field['type'] ),
345 345
 				'icon' => 'frm_icon_font frm_pencil_icon',
346 346
 			);
347
-		} elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) {
347
+		} elseif ( ! is_array( $all_field_types[$field['type']] ) ) {
348 348
 			// Fallback for fields added in a more basic way.
349
-			FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] );
349
+			FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] );
350 350
 		}
351 351
 
352
-		$type_name = $all_field_types[ $field['type'] ]['name'];
352
+		$type_name = $all_field_types[$field['type']]['name'];
353 353
 		if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) {
354 354
 			$type_name = $all_field_types['divider|repeat']['name'];
355 355
 		}
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	public static function get_choices_limit_reached_statuses( $field ) {
434 434
 		$choices_limit_reached_statuses = array();
435 435
 		foreach ( $field['options'] as $opt_key => $opt ) {
436
-			$choices_limit_reached_statuses[ $opt_key ] = self::choice_limit_reached( $field, $opt_key );
436
+			$choices_limit_reached_statuses[$opt_key] = self::choice_limit_reached( $field, $opt_key );
437 437
 		}
438 438
 		return $choices_limit_reached_statuses;
439 439
 	}
@@ -487,14 +487,14 @@  discard block
 block discarded – undo
487 487
 
488 488
 		if ( FrmAppHelper::pro_is_connected() ) {
489 489
 			foreach ( $settings as $type ) {
490
-				if ( ! empty( $field[ $type ] ) ) {
490
+				if ( ! empty( $field[$type] ) ) {
491 491
 					$active = $type;
492 492
 				}
493 493
 			}
494 494
 		}
495 495
 
496
-		$types[ $active ]['class']  .= ' current';
497
-		$types[ $active ]['current'] = true;
496
+		$types[$active]['class']  .= ' current';
497
+		$types[$active]['current'] = true;
498 498
 
499 499
 		return $types;
500 500
 	}
@@ -512,8 +512,8 @@  discard block
 block discarded – undo
512 512
 			'website' => 'url',
513 513
 			'image'   => 'url',
514 514
 		);
515
-		if ( isset( $type_switch[ $type ] ) ) {
516
-			$type = $type_switch[ $type ];
515
+		if ( isset( $type_switch[$type] ) ) {
516
+			$type = $type_switch[$type];
517 517
 		}
518 518
 
519 519
 		$pro_fields = FrmField::pro_field_selection();
@@ -668,11 +668,11 @@  discard block
 block discarded – undo
668 668
 		// include "col" for valid html
669 669
 		$unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) );
670 670
 
671
-		if ( ! isset( $calc[ $unit ] ) ) {
671
+		if ( ! isset( $calc[$unit] ) ) {
672 672
 			return;
673 673
 		}
674 674
 
675
-		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ];
675
+		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit];
676 676
 
677 677
 		$add_html['cols'] = 'cols="' . absint( $size ) . '"';
678 678
 	}
@@ -905,11 +905,11 @@  discard block
 block discarded – undo
905 905
 	private static function get_form_for_js_validation( $field ) {
906 906
 		global $frm_vars;
907 907
 		if ( ! empty( $frm_vars['js_validate_forms'] ) ) {
908
-			if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) {
909
-				return $frm_vars['js_validate_forms'][ $field['form_id'] ];
908
+			if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) {
909
+				return $frm_vars['js_validate_forms'][$field['form_id']];
910 910
 			}
911
-			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) {
912
-				return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ];
911
+			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) {
912
+				return $frm_vars['js_validate_forms'][$field['parent_form_id']];
913 913
 			}
914 914
 		}
915 915
 		return false;
@@ -996,13 +996,13 @@  discard block
 block discarded – undo
996 996
 		foreach ( $field['shortcodes'] as $k => $v ) {
997 997
 			if ( isset( $field['subfield_name'] ) && 0 === strpos( $k, 'aria-invalid' ) ) {
998 998
 				$subfield_name = $field['subfield_name'];
999
-				if ( ! isset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] ) ) {
999
+				if ( ! isset( $field['shortcodes']['aria-invalid-' . $subfield_name] ) ) {
1000 1000
 					continue;
1001 1001
 				}
1002 1002
 				// Change the key to the correct aria-invalid value so that $add_html is set correctly for the current subfield of a combo field.
1003 1003
 				$k = 'aria-invalid';
1004
-				$v = $field['shortcodes'][ 'aria-invalid-' . $subfield_name ];
1005
-				unset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] );
1004
+				$v = $field['shortcodes']['aria-invalid-' . $subfield_name];
1005
+				unset( $field['shortcodes']['aria-invalid-' . $subfield_name] );
1006 1006
 			}
1007 1007
 			if ( 'opt' === $k || ! self::should_allow_input_attribute( $k ) ) {
1008 1008
 				continue;
@@ -1010,10 +1010,10 @@  discard block
 block discarded – undo
1010 1010
 
1011 1011
 			if ( is_numeric( $k ) && strpos( $v, '=' ) ) {
1012 1012
 				$add_html[] = $v;
1013
-			} elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
1014
-				$add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] );
1013
+			} elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) {
1014
+				$add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] );
1015 1015
 			} else {
1016
-				$add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"';
1016
+				$add_html[$k] = $k . '="' . esc_attr( $v ) . '"';
1017 1017
 			}
1018 1018
 
1019 1019
 			unset( $k, $v );
Please login to merge, or discard this patch.
classes/views/frm-fields/front-end/dropdown-field.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 		$opt       = FrmFieldsHelper::get_label_from_array( $opt, $opt_key, $field );
63 63
 		$selected  = FrmAppHelper::check_selected( $field['value'], $field_val );
64 64
 
65
-		$choice_limit_reached = $field_choices_limit_reached_statuses[ $opt_key ];
65
+		$choice_limit_reached = $field_choices_limit_reached_statuses[$opt_key];
66 66
 		$atts                 = isset( $shortcode_atts ) && is_array( $shortcode_atts ) ? $shortcode_atts : array();
67 67
 		if ( FrmFieldsController::should_hide_field_choice( $choice_limit_reached, $atts, $opt_key, $field['form_id'] ) ) {
68 68
 			continue;
Please login to merge, or discard this patch.
classes/views/frm-fields/front-end/checkbox-field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 	$option_index = 0;
26 26
 	foreach ( $field['options'] as $opt_key => $opt ) {
27
-		$choice_limit_reached = $field_choices_limit_reached_statuses[ $opt_key ] ?? false;
27
+		$choice_limit_reached = $field_choices_limit_reached_statuses[$opt_key] ?? false;
28 28
 
29 29
 		$atts = isset( $shortcode_atts ) && is_array( $shortcode_atts ) ? $shortcode_atts : array();
30 30
 		if ( FrmFieldsController::should_hide_field_choice( $choice_limit_reached, $atts, $opt_key, $field['form_id'] ) ) {
@@ -109,6 +109,6 @@  discard block
 block discarded – undo
109 109
 
110 110
 		?></div>
111 111
 <?php
112
-		++$option_index;
112
+		++ $option_index;
113 113
 	}//end foreach
114 114
 }//end if
Please login to merge, or discard this patch.
classes/views/frm-fields/front-end/radio-field.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 	}
24 24
 
25 25
 	foreach ( $field['options'] as $opt_key => $opt ) {
26
-		$choice_limit_reached = $field_choices_limit_reached_statuses[ $opt_key ] ?? false;
26
+		$choice_limit_reached = $field_choices_limit_reached_statuses[$opt_key] ?? false;
27 27
 
28 28
 		$atts = isset( $shortcode_atts ) && is_array( $shortcode_atts ) ? $shortcode_atts : array();
29 29
 		if ( FrmFieldsController::should_hide_field_choice( $choice_limit_reached, $atts, $opt_key, $field['form_id'] ) ) {
Please login to merge, or discard this patch.
classes/helpers/FrmFieldsHelper.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			if ( in_array( $type, array( 'data', 'lookup' ), true ) ) {
39 39
 				$values['field_options']['data_type'] = $setting;
40 40
 			} else {
41
-				$values['field_options'][ $setting ] = 1;
41
+				$values['field_options'][$setting] = 1;
42 42
 			}
43 43
 		}
44 44
 
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 		}
165 165
 
166 166
 		foreach ( $defaults as $opt => $default ) {
167
-			$values[ $opt ] = $field->field_options[ $opt ] ?? $default;
167
+			$values[$opt] = $field->field_options[$opt] ?? $default;
168 168
 
169 169
 			if ( $check_post ) {
170
-				self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] );
170
+				self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] );
171 171
 			}
172 172
 		}
173 173
 	}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			return self::$context_is_safe_to_load_field_options_from_request_data;
185 185
 		}
186 186
 
187
-		$function = function () {
187
+		$function = function() {
188 188
 			if ( ! FrmAppHelper::is_admin_page() ) {
189 189
 				return false;
190 190
 			}
@@ -292,12 +292,12 @@  discard block
 block discarded – undo
292 292
 	 * @param mixed  $value
293 293
 	 */
294 294
 	private static function get_posted_field_setting( $setting, &$value ) {
295
-		if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
295
+		if ( ! isset( $_POST['field_options'][$setting] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
296 296
 			return;
297 297
 		}
298 298
 
299 299
 		if ( strpos( $setting, 'html' ) !== false ) {
300
-			$value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
300
+			$value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
301 301
 
302 302
 			// Conditionally strip script tags if the user sending $_POST data is not allowed to use unfiltered HTML.
303 303
 			if ( ! FrmAppHelper::allow_unfiltered_html() ) {
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
 			}
306 306
 		} elseif ( strpos( $setting, 'format_' ) === 0 ) {
307 307
 			// TODO: Remove stripslashes on output, and use on input only.
308
-			$value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing
308
+			$value = sanitize_text_field( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing
309 309
 		} else {
310
-			$value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
310
+			$value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
311 311
 			FrmAppHelper::sanitize_value( 'wp_kses_post', $value );
312 312
 		}
313 313
 	}
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 		$values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value );
381 381
 
382 382
 		foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
383
-			$values[ $col ] = $field->{$col};
383
+			$values[$col] = $field->{$col};
384 384
 		}
385 385
 	}
386 386
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		$defaults = apply_filters( 'frm_default_field_validation_messages', $defaults );
425 425
 
426 426
 		$msg = FrmField::get_option( $field, $error );
427
-		$msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg;
427
+		$msg = empty( $msg ) ? $defaults[$error]['part'] : $msg;
428 428
 		$msg = do_shortcode( $msg );
429 429
 
430 430
 		$msg = self::maybe_replace_substrings_with_field_name( $msg, $error, $field );
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 			'inside_class' => 'inside',
695 695
 			'dismiss-icon' => true,
696 696
 		);
697
-		$args     = array_merge( $defaults, $args );
697
+		$args = array_merge( $defaults, $args );
698 698
 
699 699
 		include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/inline-modal.php';
700 700
 	}
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 				continue;
933 933
 			}
934 934
 
935
-			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
935
+			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] );
936 936
 			$tag  = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key );
937 937
 
938 938
 			$atts['entry'] = $entry;
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 			if ( $replace_with !== null ) {
943 943
 				$replace_with = self::trigger_shortcode_atts( $replace_with, $atts );
944 944
 				self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with );
945
-				$content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
945
+				$content = str_replace( $shortcodes[0][$short_key], $replace_with, $content );
946 946
 			}
947 947
 
948 948
 			unset( $atts, $replace_with );
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 		$supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' );
961 961
 		$included_atts  = array_intersect( $supported_atts, array_keys( $atts ) );
962 962
 		foreach ( $included_atts as $included_att ) {
963
-			if ( '0' === $atts[ $included_att ] ) {
963
+			if ( '0' === $atts[$included_att] ) {
964 964
 				// Skip any option that uses 0 so sanitize_url=0 does not encode.
965 965
 				continue;
966 966
 			}
@@ -1038,8 +1038,8 @@  discard block
 block discarded – undo
1038 1038
 
1039 1039
 		$dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get', 'default-email', 'default-from-email' );
1040 1040
 
1041
-		if ( isset( $shortcode_values[ $atts['tag'] ] ) ) {
1042
-			$replace_with = $shortcode_values[ $atts['tag'] ];
1041
+		if ( isset( $shortcode_values[$atts['tag']] ) ) {
1042
+			$replace_with = $shortcode_values[$atts['tag']];
1043 1043
 		} elseif ( in_array( $atts['tag'], $dynamic_default, true ) ) {
1044 1044
 			$replace_with = self::dynamic_default_values( $atts['tag'], $atts );
1045 1045
 		} elseif ( $clean_tag === 'user_agent' ) {
@@ -1263,8 +1263,8 @@  discard block
 block discarded – undo
1263 1263
 			self::field_types_for_input( $single_input, $field_selection, $field_types );
1264 1264
 		} elseif ( in_array( $type, $multiple_input, true ) ) {
1265 1265
 			self::field_types_for_input( $multiple_input, $field_selection, $field_types );
1266
-		} elseif ( isset( $field_selection[ $type ] ) ) {
1267
-			$field_types[ $type ] = $field_selection[ $type ];
1266
+		} elseif ( isset( $field_selection[$type] ) ) {
1267
+			$field_types[$type] = $field_selection[$type];
1268 1268
 		}
1269 1269
 
1270 1270
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) );
@@ -1306,7 +1306,7 @@  discard block
 block discarded – undo
1306 1306
 		foreach ( $inputs as $input ) {
1307 1307
 			// This may not be set if a field type was removed using the frm_available_fields or frm_pro_available_fields filters.
1308 1308
 			if ( array_key_exists( $input, $fields ) ) {
1309
-				$field_types[ $input ] = $fields[ $input ];
1309
+				$field_types[$input] = $fields[$input];
1310 1310
 			}
1311 1311
 			unset( $input );
1312 1312
 		}
@@ -1339,7 +1339,7 @@  discard block
 block discarded – undo
1339 1339
 			'parent'  => false,
1340 1340
 			'pointer' => false,
1341 1341
 		);
1342
-		$args     = wp_parse_args( $args, $defaults );
1342
+		$args = wp_parse_args( $args, $defaults );
1343 1343
 
1344 1344
 		$opt_key   = $args['opt_key'];
1345 1345
 		$field     = $args['field'];
@@ -1355,25 +1355,25 @@  discard block
 block discarded – undo
1355 1355
 
1356 1356
 		// Check posted vals before checking saved values
1357 1357
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
1358
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1358
+		if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1359 1359
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
1360 1360
 				// phpcs:ignore WordPress.Security.NonceVerification.Missing
1361
-				$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 ] ) ) : '';
1361
+				$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] ) ) : '';
1362 1362
 			} else {
1363
-				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1363
+				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1364 1364
 			}
1365 1365
 
1366 1366
 			return $other_val;
1367 1367
 		}
1368 1368
 
1369
-		if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1369
+		if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1370 1370
 			// For normal fields
1371 1371
 
1372 1372
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
1373 1373
 				// phpcs:ignore WordPress.Security.NonceVerification.Missing
1374
-				$other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : '';
1374
+				$other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : '';
1375 1375
 			} else {
1376
-				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1376
+				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1377 1377
 			}
1378 1378
 
1379 1379
 			return $other_val;
@@ -1383,8 +1383,8 @@  discard block
 block discarded – undo
1383 1383
 		if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) {
1384 1384
 			// Check if there is an "other" val in saved value and make sure the
1385 1385
 			// "other" val is not equal to the Other checkbox option
1386
-			if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
1387
-				$other_val = $field['value'][ $opt_key ];
1386
+			if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) {
1387
+				$other_val = $field['value'][$opt_key];
1388 1388
 			}
1389 1389
 		} else {
1390 1390
 			/**
@@ -1396,8 +1396,8 @@  discard block
 block discarded – undo
1396 1396
 				// Multi-select dropdowns - key is not preserved
1397 1397
 				if ( is_array( $field['value'] ) ) {
1398 1398
 					$o_key = array_search( $temp_val, $field['value'] );
1399
-					if ( isset( $field['value'][ $o_key ] ) ) {
1400
-						unset( $field['value'][ $o_key ], $o_key );
1399
+					if ( isset( $field['value'][$o_key] ) ) {
1400
+						unset( $field['value'][$o_key], $o_key );
1401 1401
 					}
1402 1402
 				} elseif ( $temp_val == $field['value'] ) {
1403 1403
 					// For radio and regular dropdowns
@@ -1608,11 +1608,11 @@  discard block
 block discarded – undo
1608 1608
 			foreach ( $val as $k => $v ) {
1609 1609
 				if ( is_string( $v ) ) {
1610 1610
 					if ( 'custom_html' === $k ) {
1611
-						$val[ $k ] = self::switch_ids_except_strings( $replace, $replace_with, array( '[if description]', '[description]', '[/if description]' ), $v );
1611
+						$val[$k] = self::switch_ids_except_strings( $replace, $replace_with, array( '[if description]', '[description]', '[/if description]' ), $v );
1612 1612
 						unset( $k, $v );
1613 1613
 						continue;
1614 1614
 					}
1615
-					$val[ $k ] = str_replace( $replace, $replace_with, $v );
1615
+					$val[$k] = str_replace( $replace, $replace_with, $v );
1616 1616
 					unset( $k, $v );
1617 1617
 				}
1618 1618
 			}
@@ -1641,8 +1641,8 @@  discard block
 block discarded – undo
1641 1641
 			if ( false === $index ) {
1642 1642
 				continue;
1643 1643
 			}
1644
-			unset( $replace[ $index ] );
1645
-			unset( $replace_with[ $index ] );
1644
+			unset( $replace[$index] );
1645
+			unset( $replace_with[$index] );
1646 1646
 		}
1647 1647
 		$value = str_replace( $replace, $replace_with, $value );
1648 1648
 		return $value;
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
 			$countries['class'] = 'frm-countries-opts';
1991 1991
 		}
1992 1992
 
1993
-		$prepop[ __( 'Countries', 'formidable' ) ] = $countries;
1993
+		$prepop[__( 'Countries', 'formidable' )] = $countries;
1994 1994
 
1995 1995
 		// State abv.
1996 1996
 		$states    = self::get_us_states();
@@ -2000,7 +2000,7 @@  discard block
 block discarded – undo
2000 2000
 			$state_abv['class'] = 'frm-state-abv-opts';
2001 2001
 		}
2002 2002
 
2003
-		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
2003
+		$prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv;
2004 2004
 
2005 2005
 		// States.
2006 2006
 		$states = array_values( $states );
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
 			$states['class'] = 'frm-states-opts';
2010 2010
 		}
2011 2011
 
2012
-		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
2012
+		$prepop[__( 'U.S. States', 'formidable' )] = $states;
2013 2013
 		unset( $state_abv, $states );
2014 2014
 
2015 2015
 		// Age.
@@ -2027,7 +2027,7 @@  discard block
 block discarded – undo
2027 2027
 			$ages['class'] = 'frm-age-opts';
2028 2028
 		}
2029 2029
 
2030
-		$prepop[ __( 'Age', 'formidable' ) ] = $ages;
2030
+		$prepop[__( 'Age', 'formidable' )] = $ages;
2031 2031
 
2032 2032
 		// Satisfaction.
2033 2033
 		$satisfaction = array(
@@ -2042,7 +2042,7 @@  discard block
 block discarded – undo
2042 2042
 			$satisfaction['class'] = 'frm-satisfaction-opts';
2043 2043
 		}
2044 2044
 
2045
-		$prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction;
2045
+		$prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction;
2046 2046
 
2047 2047
 		// Importance.
2048 2048
 		$importance = array(
@@ -2057,7 +2057,7 @@  discard block
 block discarded – undo
2057 2057
 			$importance['class'] = 'frm-importance-opts';
2058 2058
 		}
2059 2059
 
2060
-		$prepop[ __( 'Importance', 'formidable' ) ] = $importance;
2060
+		$prepop[__( 'Importance', 'formidable' )] = $importance;
2061 2061
 
2062 2062
 		// Agreement.
2063 2063
 		$agreement = array(
@@ -2072,7 +2072,7 @@  discard block
 block discarded – undo
2072 2072
 			$agreement['class'] = 'frm-agreement-opts';
2073 2073
 		}
2074 2074
 
2075
-		$prepop[ __( 'Agreement', 'formidable' ) ] = $agreement;
2075
+		$prepop[__( 'Agreement', 'formidable' )] = $agreement;
2076 2076
 
2077 2077
 		// Likely.
2078 2078
 		$likely = array(
@@ -2087,7 +2087,7 @@  discard block
 block discarded – undo
2087 2087
 			$likely['class'] = 'frm-likely-opts';
2088 2088
 		}
2089 2089
 
2090
-		$prepop[ __( 'Likely', 'formidable' ) ] = $likely;
2090
+		$prepop[__( 'Likely', 'formidable' )] = $likely;
2091 2091
 
2092 2092
 		$prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
2093 2093
 	}
@@ -2308,16 +2308,16 @@  discard block
 block discarded – undo
2308 2308
 	 */
2309 2309
 	private static function fill_image_setting_options( $options, &$args ) {
2310 2310
 		foreach ( $options as $key => $option ) {
2311
-			$args['options'][ $key ] = $option;
2311
+			$args['options'][$key] = $option;
2312 2312
 
2313 2313
 			if ( ! empty( $option['addon'] ) ) {
2314
-				$args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option );
2314
+				$args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option );
2315 2315
 			}
2316 2316
 
2317
-			unset( $args['options'][ $key ]['addon'] );
2317
+			unset( $args['options'][$key]['addon'] );
2318 2318
 			$fill = array( 'upgrade', 'message', 'content' );
2319 2319
 			foreach ( $fill as $f ) {
2320
-				unset( $args['options'][ $key ][ $f ], $f );
2320
+				unset( $args['options'][$key][$f], $f );
2321 2321
 			}
2322 2322
 		}
2323 2323
 	}
@@ -2338,8 +2338,8 @@  discard block
 block discarded – undo
2338 2338
 
2339 2339
 		$fill = array( 'upgrade', 'message', 'content' );
2340 2340
 		foreach ( $fill as $f ) {
2341
-			if ( isset( $option[ $f ] ) ) {
2342
-				$custom_attrs[ 'data-' . $f ] = $option[ $f ];
2341
+			if ( isset( $option[$f] ) ) {
2342
+				$custom_attrs['data-' . $f] = $option[$f];
2343 2343
 			}
2344 2344
 		}
2345 2345
 
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
 
2406 2406
 		return array_filter(
2407 2407
 			$rows,
2408
-			function ( $row ) {
2408
+			function( $row ) {
2409 2409
 				FrmAppHelper::unserialize_or_decode( $row->field_options );
2410 2410
 				return is_array( $row->field_options ) && ! empty( $row->field_options['draft'] );
2411 2411
 			}
@@ -2468,7 +2468,7 @@  discard block
 block discarded – undo
2468 2468
 		if ( empty( $attributes['data-fid'] ) ) {
2469 2469
 			unset( $data['plugin-status'] );
2470 2470
 			foreach ( $data as $key => $value ) {
2471
-				$attributes[ 'data-' . $key ] = $value;
2471
+				$attributes['data-' . $key] = $value;
2472 2472
 			}
2473 2473
 		}
2474 2474
 
Please login to merge, or discard this patch.