Completed
Pull Request — master (#1864)
by
unknown
40s
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
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 			foreach ( $opts as $opt_key => $opt ) {
264 264
 				if ( strpos( $opt, '|' ) !== false ) {
265 265
 					$vals             = explode( '|', $opt );
266
-					$opts[ $opt_key ] = array(
266
+					$opts[$opt_key] = array(
267 267
 						'label' => trim( $vals[0] ),
268 268
 						'value' => trim( $vals[1] ),
269 269
 					);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			$other_array = array();
279 279
 			foreach ( $field['options'] as $opt_key => $opt ) {
280 280
 				if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
281
-					$other_array[ $opt_key ] = $opt;
281
+					$other_array[$opt_key] = $opt;
282 282
 				}
283 283
 				unset( $opt_key, $opt );
284 284
 			}
@@ -321,18 +321,18 @@  discard block
 block discarded – undo
321 321
 		$frm_settings         = FrmAppHelper::get_settings();
322 322
 		$field_types          = FrmFieldTypeOptionData::get_field_types( $field['type'] );
323 323
 
324
-		if ( ! isset( $all_field_types[ $field['type'] ] ) ) {
324
+		if ( ! isset( $all_field_types[$field['type']] ) ) {
325 325
 			// Add fallback for an add-on field type that has been deactivated.
326
-			$all_field_types[ $field['type'] ] = array(
326
+			$all_field_types[$field['type']] = array(
327 327
 				'name' => ucfirst( $field['type'] ),
328 328
 				'icon' => 'frm_icon_font frm_pencil_icon',
329 329
 			);
330
-		} elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) {
330
+		} elseif ( ! is_array( $all_field_types[$field['type']] ) ) {
331 331
 			// Fallback for fields added in a more basic way.
332
-			FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] );
332
+			FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] );
333 333
 		}
334 334
 
335
-		$type_name = $all_field_types[ $field['type'] ]['name'];
335
+		$type_name = $all_field_types[$field['type']]['name'];
336 336
 		if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) {
337 337
 			$type_name = $all_field_types['divider|repeat']['name'];
338 338
 		}
@@ -406,13 +406,13 @@  discard block
 block discarded – undo
406 406
 		$active   = 'default_value';
407 407
 
408 408
 		foreach ( $settings as $type ) {
409
-			if ( ! empty( $field[ $type ] ) ) {
409
+			if ( ! empty( $field[$type] ) ) {
410 410
 				$active = $type;
411 411
 			}
412 412
 		}
413 413
 
414
-		$types[ $active ]['class']  .= ' current';
415
-		$types[ $active ]['current'] = true;
414
+		$types[$active]['class']  .= ' current';
415
+		$types[$active]['current'] = true;
416 416
 
417 417
 		return $types;
418 418
 	}
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 			'website' => 'url',
431 431
 			'image'   => 'url',
432 432
 		);
433
-		if ( isset( $type_switch[ $type ] ) ) {
434
-			$type = $type_switch[ $type ];
433
+		if ( isset( $type_switch[$type] ) ) {
434
+			$type = $type_switch[$type];
435 435
 		}
436 436
 
437 437
 		$pro_fields = FrmField::pro_field_selection();
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 	 * @return void
474 474
 	 */
475 475
 	public static function show_format_option( $field, $is_hidden = false ) {
476
-		$attributes          = array(
476
+		$attributes = array(
477 477
 			'class' => 'frm-has-modal',
478 478
 			'id'    => 'frm-field-format-custom-' . $field['id'],
479 479
 		);
@@ -586,11 +586,11 @@  discard block
 block discarded – undo
586 586
 		// include "col" for valid html
587 587
 		$unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) );
588 588
 
589
-		if ( ! isset( $calc[ $unit ] ) ) {
589
+		if ( ! isset( $calc[$unit] ) ) {
590 590
 			return;
591 591
 		}
592 592
 
593
-		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ];
593
+		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit];
594 594
 
595 595
 		$add_html['cols'] = 'cols="' . absint( $size ) . '"';
596 596
 	}
@@ -823,11 +823,11 @@  discard block
 block discarded – undo
823 823
 	private static function get_form_for_js_validation( $field ) {
824 824
 		global $frm_vars;
825 825
 		if ( ! empty( $frm_vars['js_validate_forms'] ) ) {
826
-			if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) {
827
-				return $frm_vars['js_validate_forms'][ $field['form_id'] ];
826
+			if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) {
827
+				return $frm_vars['js_validate_forms'][$field['form_id']];
828 828
 			}
829
-			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) {
830
-				return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ];
829
+			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) {
830
+				return $frm_vars['js_validate_forms'][$field['parent_form_id']];
831 831
 			}
832 832
 		}
833 833
 		return false;
@@ -914,13 +914,13 @@  discard block
 block discarded – undo
914 914
 		foreach ( $field['shortcodes'] as $k => $v ) {
915 915
 			if ( isset( $field['subfield_name'] ) && 0 === strpos( $k, 'aria-invalid' ) ) {
916 916
 				$subfield_name = $field['subfield_name'];
917
-				if ( ! isset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] ) ) {
917
+				if ( ! isset( $field['shortcodes']['aria-invalid-' . $subfield_name] ) ) {
918 918
 					continue;
919 919
 				}
920 920
 				// Change the key to the correct aria-invalid value so that $add_html is set correctly for the current subfield of a combo field.
921 921
 				$k = 'aria-invalid';
922
-				$v = $field['shortcodes'][ 'aria-invalid-' . $subfield_name ];
923
-				unset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] );
922
+				$v = $field['shortcodes']['aria-invalid-' . $subfield_name];
923
+				unset( $field['shortcodes']['aria-invalid-' . $subfield_name] );
924 924
 			}
925 925
 			if ( 'opt' === $k || ! self::should_allow_input_attribute( $k ) ) {
926 926
 				continue;
@@ -928,10 +928,10 @@  discard block
 block discarded – undo
928 928
 
929 929
 			if ( is_numeric( $k ) && strpos( $v, '=' ) ) {
930 930
 				$add_html[] = $v;
931
-			} elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
932
-				$add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] );
931
+			} elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) {
932
+				$add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] );
933 933
 			} else {
934
-				$add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"';
934
+				$add_html[$k] = $k . '="' . esc_attr( $v ) . '"';
935 935
 			}
936 936
 
937 937
 			unset( $k, $v );
Please login to merge, or discard this patch.