Completed
Pull Request — master (#2570)
by
unknown
48s
created
classes/controllers/FrmFieldsController.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 		$_GET['page'] = 'formidable';
28 28
 
29
-		$values     = array(
29
+		$values = array(
30 30
 			'id'         => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
31 31
 			'doing_ajax' => true,
32 32
 		);
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 			ob_start();
52 52
 			self::load_single_field( $field, $values );
53
-			$field_html[ absint( $field->id ) ] = ob_get_contents();
53
+			$field_html[absint( $field->id )] = ob_get_contents();
54 54
 			ob_end_clean();
55 55
 		}//end foreach
56 56
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 			foreach ( $opts as $opt_key => $opt ) {
289 289
 				if ( strpos( $opt, '|' ) !== false ) {
290 290
 					$vals             = explode( '|', $opt );
291
-					$opts[ $opt_key ] = array(
291
+					$opts[$opt_key] = array(
292 292
 						'label' => trim( $vals[0] ),
293 293
 						'value' => trim( $vals[1] ),
294 294
 					);
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 
305 305
 			foreach ( $field['options'] as $opt_key => $opt ) {
306 306
 				if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
307
-					$other_array[ $opt_key ] = $opt;
307
+					$other_array[$opt_key] = $opt;
308 308
 				}
309 309
 				unset( $opt_key, $opt );
310 310
 			}
@@ -349,18 +349,18 @@  discard block
 block discarded – undo
349 349
 		$frm_settings         = FrmAppHelper::get_settings();
350 350
 		$field_types          = FrmFieldTypeOptionData::get_field_types( $field['type'] );
351 351
 
352
-		if ( ! isset( $all_field_types[ $field['type'] ] ) ) {
352
+		if ( ! isset( $all_field_types[$field['type']] ) ) {
353 353
 			// Add fallback for an add-on field type that has been deactivated.
354
-			$all_field_types[ $field['type'] ] = array(
354
+			$all_field_types[$field['type']] = array(
355 355
 				'name' => ucfirst( $field['type'] ),
356 356
 				'icon' => 'frm_icon_font frm_pencil_icon',
357 357
 			);
358
-		} elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) {
358
+		} elseif ( ! is_array( $all_field_types[$field['type']] ) ) {
359 359
 			// Fallback for fields added in a more basic way.
360
-			FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] );
360
+			FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] );
361 361
 		}
362 362
 
363
-		$type_name = $all_field_types[ $field['type'] ]['name'];
363
+		$type_name = $all_field_types[$field['type']]['name'];
364 364
 
365 365
 		if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) {
366 366
 			$type_name = $all_field_types['divider|repeat']['name'];
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 		$pro_is_installed = FrmAppHelper::pro_is_installed();
378 378
 
379 379
 		if ( ! $pro_is_installed ) {
380
-			$show_upsell_for_unique_value          = in_array(
380
+			$show_upsell_for_unique_value = in_array(
381 381
 				$field['type'],
382 382
 				array( 'address', 'checkbox', 'email', 'name', 'number', 'phone', 'radio', 'text', 'textarea', 'url' ),
383 383
 				true
@@ -508,14 +508,14 @@  discard block
 block discarded – undo
508 508
 
509 509
 		if ( FrmAppHelper::pro_is_connected() ) {
510 510
 			foreach ( $settings as $type ) {
511
-				if ( ! empty( $field[ $type ] ) ) {
511
+				if ( ! empty( $field[$type] ) ) {
512 512
 					$active = $type;
513 513
 				}
514 514
 			}
515 515
 		}
516 516
 
517
-		$types[ $active ]['class']  .= ' current';
518
-		$types[ $active ]['current'] = true;
517
+		$types[$active]['class']  .= ' current';
518
+		$types[$active]['current'] = true;
519 519
 
520 520
 		return $types;
521 521
 	}
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
 			'image'   => 'url',
536 536
 		);
537 537
 
538
-		if ( isset( $type_switch[ $type ] ) ) {
539
-			$type = $type_switch[ $type ];
538
+		if ( isset( $type_switch[$type] ) ) {
539
+			$type = $type_switch[$type];
540 540
 		}
541 541
 
542 542
 		$pro_fields = FrmField::pro_field_selection();
@@ -701,11 +701,11 @@  discard block
 block discarded – undo
701 701
 		// include "col" for valid html
702 702
 		$unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) );
703 703
 
704
-		if ( ! isset( $calc[ $unit ] ) ) {
704
+		if ( ! isset( $calc[$unit] ) ) {
705 705
 			return;
706 706
 		}
707 707
 
708
-		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ];
708
+		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit];
709 709
 
710 710
 		$add_html['cols'] = 'cols="' . absint( $size ) . '"';
711 711
 	}
@@ -959,12 +959,12 @@  discard block
 block discarded – undo
959 959
 		global $frm_vars;
960 960
 
961 961
 		if ( ! empty( $frm_vars['js_validate_forms'] ) ) {
962
-			if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) {
963
-				return $frm_vars['js_validate_forms'][ $field['form_id'] ];
962
+			if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) {
963
+				return $frm_vars['js_validate_forms'][$field['form_id']];
964 964
 			}
965 965
 
966
-			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) {
967
-				return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ];
966
+			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) {
967
+				return $frm_vars['js_validate_forms'][$field['parent_form_id']];
968 968
 			}
969 969
 		}
970 970
 		return false;
@@ -1058,13 +1058,13 @@  discard block
 block discarded – undo
1058 1058
 			if ( isset( $field['subfield_name'] ) && 0 === strpos( $k, 'aria-invalid' ) ) {
1059 1059
 				$subfield_name = $field['subfield_name'];
1060 1060
 
1061
-				if ( ! isset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] ) ) {
1061
+				if ( ! isset( $field['shortcodes']['aria-invalid-' . $subfield_name] ) ) {
1062 1062
 					continue;
1063 1063
 				}
1064 1064
 				// Change the key to the correct aria-invalid value so that $add_html is set correctly for the current subfield of a combo field.
1065 1065
 				$k = 'aria-invalid';
1066
-				$v = $field['shortcodes'][ 'aria-invalid-' . $subfield_name ];
1067
-				unset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] );
1066
+				$v = $field['shortcodes']['aria-invalid-' . $subfield_name];
1067
+				unset( $field['shortcodes']['aria-invalid-' . $subfield_name] );
1068 1068
 			}
1069 1069
 
1070 1070
 			if ( 'opt' === $k || ! self::should_allow_input_attribute( $k ) ) {
@@ -1073,10 +1073,10 @@  discard block
 block discarded – undo
1073 1073
 
1074 1074
 			if ( is_numeric( $k ) && strpos( $v, '=' ) ) {
1075 1075
 				$add_html[] = $v;
1076
-			} elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
1077
-				$add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] );
1076
+			} elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) {
1077
+				$add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] );
1078 1078
 			} else {
1079
-				$add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"';
1079
+				$add_html[$k] = $k . '="' . esc_attr( $v ) . '"';
1080 1080
 			}
1081 1081
 
1082 1082
 			unset( $k, $v );
Please login to merge, or discard this patch.