Completed
Pull Request — master (#2513)
by
unknown
46s
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.