Completed
Pull Request — master (#2570)
by
unknown
45s
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
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 			foreach ( $opts as $opt_key => $opt ) {
285 285
 				if ( strpos( $opt, '|' ) !== false ) {
286 286
 					$vals             = explode( '|', $opt );
287
-					$opts[ $opt_key ] = array(
287
+					$opts[$opt_key] = array(
288 288
 						'label' => trim( $vals[0] ),
289 289
 						'value' => trim( $vals[1] ),
290 290
 					);
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 			$other_array = array();
300 300
 			foreach ( $field['options'] as $opt_key => $opt ) {
301 301
 				if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
302
-					$other_array[ $opt_key ] = $opt;
302
+					$other_array[$opt_key] = $opt;
303 303
 				}
304 304
 				unset( $opt_key, $opt );
305 305
 			}
@@ -343,18 +343,18 @@  discard block
 block discarded – undo
343 343
 		$frm_settings         = FrmAppHelper::get_settings();
344 344
 		$field_types          = FrmFieldTypeOptionData::get_field_types( $field['type'] );
345 345
 
346
-		if ( ! isset( $all_field_types[ $field['type'] ] ) ) {
346
+		if ( ! isset( $all_field_types[$field['type']] ) ) {
347 347
 			// Add fallback for an add-on field type that has been deactivated.
348
-			$all_field_types[ $field['type'] ] = array(
348
+			$all_field_types[$field['type']] = array(
349 349
 				'name' => ucfirst( $field['type'] ),
350 350
 				'icon' => 'frm_icon_font frm_pencil_icon',
351 351
 			);
352
-		} elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) {
352
+		} elseif ( ! is_array( $all_field_types[$field['type']] ) ) {
353 353
 			// Fallback for fields added in a more basic way.
354
-			FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] );
354
+			FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] );
355 355
 		}
356 356
 
357
-		$type_name = $all_field_types[ $field['type'] ]['name'];
357
+		$type_name = $all_field_types[$field['type']]['name'];
358 358
 		if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) {
359 359
 			$type_name = $all_field_types['divider|repeat']['name'];
360 360
 		}
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 		$no_allow         = ! $pro_is_installed ? 'frm_noallow' : '';
372 372
 
373 373
 		if ( ! $pro_is_installed ) {
374
-			$field_has_unique_option                = in_array(
374
+			$field_has_unique_option = in_array(
375 375
 				$field['type'],
376 376
 				array( 'address', 'checkbox', 'email', 'name', 'number', 'phone', 'radio', 'text', 'textarea', 'url' ),
377 377
 				true
@@ -452,14 +452,14 @@  discard block
 block discarded – undo
452 452
 
453 453
 		if ( FrmAppHelper::pro_is_connected() ) {
454 454
 			foreach ( $settings as $type ) {
455
-				if ( ! empty( $field[ $type ] ) ) {
455
+				if ( ! empty( $field[$type] ) ) {
456 456
 					$active = $type;
457 457
 				}
458 458
 			}
459 459
 		}
460 460
 
461
-		$types[ $active ]['class']  .= ' current';
462
-		$types[ $active ]['current'] = true;
461
+		$types[$active]['class']  .= ' current';
462
+		$types[$active]['current'] = true;
463 463
 
464 464
 		return $types;
465 465
 	}
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
 			'website' => 'url',
479 479
 			'image'   => 'url',
480 480
 		);
481
-		if ( isset( $type_switch[ $type ] ) ) {
482
-			$type = $type_switch[ $type ];
481
+		if ( isset( $type_switch[$type] ) ) {
482
+			$type = $type_switch[$type];
483 483
 		}
484 484
 
485 485
 		$pro_fields = FrmField::pro_field_selection();
@@ -644,11 +644,11 @@  discard block
 block discarded – undo
644 644
 		// include "col" for valid html
645 645
 		$unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) );
646 646
 
647
-		if ( ! isset( $calc[ $unit ] ) ) {
647
+		if ( ! isset( $calc[$unit] ) ) {
648 648
 			return;
649 649
 		}
650 650
 
651
-		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ];
651
+		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit];
652 652
 
653 653
 		$add_html['cols'] = 'cols="' . absint( $size ) . '"';
654 654
 	}
@@ -898,11 +898,11 @@  discard block
 block discarded – undo
898 898
 	private static function get_form_for_js_validation( $field ) {
899 899
 		global $frm_vars;
900 900
 		if ( ! empty( $frm_vars['js_validate_forms'] ) ) {
901
-			if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) {
902
-				return $frm_vars['js_validate_forms'][ $field['form_id'] ];
901
+			if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) {
902
+				return $frm_vars['js_validate_forms'][$field['form_id']];
903 903
 			}
904
-			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) {
905
-				return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ];
904
+			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) {
905
+				return $frm_vars['js_validate_forms'][$field['parent_form_id']];
906 906
 			}
907 907
 		}
908 908
 		return false;
@@ -993,13 +993,13 @@  discard block
 block discarded – undo
993 993
 		foreach ( $field['shortcodes'] as $k => $v ) {
994 994
 			if ( isset( $field['subfield_name'] ) && 0 === strpos( $k, 'aria-invalid' ) ) {
995 995
 				$subfield_name = $field['subfield_name'];
996
-				if ( ! isset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] ) ) {
996
+				if ( ! isset( $field['shortcodes']['aria-invalid-' . $subfield_name] ) ) {
997 997
 					continue;
998 998
 				}
999 999
 				// Change the key to the correct aria-invalid value so that $add_html is set correctly for the current subfield of a combo field.
1000 1000
 				$k = 'aria-invalid';
1001
-				$v = $field['shortcodes'][ 'aria-invalid-' . $subfield_name ];
1002
-				unset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] );
1001
+				$v = $field['shortcodes']['aria-invalid-' . $subfield_name];
1002
+				unset( $field['shortcodes']['aria-invalid-' . $subfield_name] );
1003 1003
 			}
1004 1004
 			if ( 'opt' === $k || ! self::should_allow_input_attribute( $k ) ) {
1005 1005
 				continue;
@@ -1007,10 +1007,10 @@  discard block
 block discarded – undo
1007 1007
 
1008 1008
 			if ( is_numeric( $k ) && strpos( $v, '=' ) ) {
1009 1009
 				$add_html[] = $v;
1010
-			} elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
1011
-				$add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] );
1010
+			} elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) {
1011
+				$add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] );
1012 1012
 			} else {
1013
-				$add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"';
1013
+				$add_html[$k] = $k . '="' . esc_attr( $v ) . '"';
1014 1014
 			}
1015 1015
 
1016 1016
 			unset( $k, $v );
Please login to merge, or discard this patch.