Completed
Push — master ( 03b80c...c67b70 )
by
unknown
20s
created
classes/controllers/FrmFieldsController.php 1 patch
Spacing   +26 added lines, -26 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_clean();
53
+			$field_html[absint( $field->id )] = ob_get_clean();
54 54
 		}//end foreach
55 55
 
56 56
 		echo json_encode( $field_html );
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 			foreach ( $opts as $opt_key => $opt ) {
284 284
 				if ( str_contains( $opt, '|' ) ) {
285 285
 					$vals             = explode( '|', $opt );
286
-					$opts[ $opt_key ] = array(
286
+					$opts[$opt_key] = array(
287 287
 						'label' => trim( $vals[0] ),
288 288
 						'value' => trim( $vals[1] ),
289 289
 					);
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 
301 301
 			foreach ( $field['options'] as $opt_key => $opt ) {
302 302
 				if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
303
-					$other_array[ $opt_key ] = $opt;
303
+					$other_array[$opt_key] = $opt;
304 304
 				}
305 305
 				unset( $opt_key, $opt );
306 306
 			}
@@ -345,18 +345,18 @@  discard block
 block discarded – undo
345 345
 		$frm_settings         = FrmAppHelper::get_settings();
346 346
 		$field_types          = FrmFieldTypeOptionData::get_field_types( $field['type'] );
347 347
 
348
-		if ( ! isset( $all_field_types[ $field['type'] ] ) ) {
348
+		if ( ! isset( $all_field_types[$field['type']] ) ) {
349 349
 			// Add fallback for an add-on field type that has been deactivated.
350
-			$all_field_types[ $field['type'] ] = array(
350
+			$all_field_types[$field['type']] = array(
351 351
 				'name' => ucfirst( $field['type'] ),
352 352
 				'icon' => 'frmfont frm_pencil_icon',
353 353
 			);
354
-		} elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) {
354
+		} elseif ( ! is_array( $all_field_types[$field['type']] ) ) {
355 355
 			// Fallback for fields added in a more basic way.
356
-			FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] );
356
+			FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] );
357 357
 		}
358 358
 
359
-		$type_name = $all_field_types[ $field['type'] ]['name'];
359
+		$type_name = $all_field_types[$field['type']]['name'];
360 360
 
361 361
 		if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) {
362 362
 			$type_name = $all_field_types['divider|repeat']['name'];
@@ -435,14 +435,14 @@  discard block
 block discarded – undo
435 435
 
436 436
 		if ( FrmAppHelper::pro_is_connected() ) {
437 437
 			foreach ( $settings as $type ) {
438
-				if ( ! empty( $field[ $type ] ) ) {
438
+				if ( ! empty( $field[$type] ) ) {
439 439
 					$active = $type;
440 440
 				}
441 441
 			}
442 442
 		}
443 443
 
444
-		$types[ $active ]['class']  .= ' current';
445
-		$types[ $active ]['current'] = true;
444
+		$types[$active]['class']  .= ' current';
445
+		$types[$active]['current'] = true;
446 446
 
447 447
 		return $types;
448 448
 	}
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
 			'image'   => 'url',
463 463
 		);
464 464
 
465
-		if ( isset( $type_switch[ $type ] ) ) {
466
-			$type = $type_switch[ $type ];
465
+		if ( isset( $type_switch[$type] ) ) {
466
+			$type = $type_switch[$type];
467 467
 		}
468 468
 
469 469
 		$pro_fields = FrmField::pro_field_selection();
@@ -628,11 +628,11 @@  discard block
 block discarded – undo
628 628
 		// include "col" for valid html
629 629
 		$unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) );
630 630
 
631
-		if ( ! isset( $calc[ $unit ] ) ) {
631
+		if ( ! isset( $calc[$unit] ) ) {
632 632
 			return;
633 633
 		}
634 634
 
635
-		$size             = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ];
635
+		$size             = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit];
636 636
 		$add_html['cols'] = 'cols="' . absint( $size ) . '"';
637 637
 	}
638 638
 
@@ -889,12 +889,12 @@  discard block
 block discarded – undo
889 889
 		global $frm_vars;
890 890
 
891 891
 		if ( ! empty( $frm_vars['js_validate_forms'] ) ) {
892
-			if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) {
893
-				return $frm_vars['js_validate_forms'][ $field['form_id'] ];
892
+			if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) {
893
+				return $frm_vars['js_validate_forms'][$field['form_id']];
894 894
 			}
895 895
 
896
-			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) {
897
-				return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ];
896
+			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) {
897
+				return $frm_vars['js_validate_forms'][$field['parent_form_id']];
898 898
 			}
899 899
 		}
900 900
 
@@ -984,13 +984,13 @@  discard block
 block discarded – undo
984 984
 			if ( isset( $field['subfield_name'] ) && str_starts_with( $k, 'aria-invalid' ) ) {
985 985
 				$subfield_name = $field['subfield_name'];
986 986
 
987
-				if ( ! isset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] ) ) {
987
+				if ( ! isset( $field['shortcodes']['aria-invalid-' . $subfield_name] ) ) {
988 988
 					continue;
989 989
 				}
990 990
 				// Change the key to the correct aria-invalid value so that $add_html is set correctly for the current subfield of a combo field.
991 991
 				$k = 'aria-invalid';
992
-				$v = $field['shortcodes'][ 'aria-invalid-' . $subfield_name ];
993
-				unset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] );
992
+				$v = $field['shortcodes']['aria-invalid-' . $subfield_name];
993
+				unset( $field['shortcodes']['aria-invalid-' . $subfield_name] );
994 994
 			}
995 995
 
996 996
 			if ( 'opt' === $k || ! self::should_allow_input_attribute( $k ) ) {
@@ -999,10 +999,10 @@  discard block
 block discarded – undo
999 999
 
1000 1000
 			if ( is_numeric( $k ) && str_contains( $v, '=' ) ) {
1001 1001
 				$add_html[] = $v;
1002
-			} elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
1003
-				$add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] );
1002
+			} elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) {
1003
+				$add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] );
1004 1004
 			} else {
1005
-				$add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"';
1005
+				$add_html[$k] = $k . '="' . esc_attr( $v ) . '"';
1006 1006
 			}
1007 1007
 
1008 1008
 			unset( $k, $v );
Please login to merge, or discard this patch.
phpcs-sniffs/Formidable/Sniffs/CodeAnalysis/PreferObGetCleanSniff.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$tokens = $phpcsFile->getTokens();
43 43
 
44 44
 		// Check if this is ob_get_contents.
45
-		if ( strtolower( $tokens[ $stackPtr ]['content'] ) !== 'ob_get_contents' ) {
45
+		if ( strtolower( $tokens[$stackPtr]['content'] ) !== 'ob_get_contents' ) {
46 46
 			return;
47 47
 		}
48 48
 
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 		}
62 62
 
63 63
 		// Check if the next statement is ob_end_clean().
64
-		if ( $tokens[ $nextToken ]['code'] !== T_STRING ) {
64
+		if ( $tokens[$nextToken]['code'] !== T_STRING ) {
65 65
 			return;
66 66
 		}
67 67
 
68
-		if ( strtolower( $tokens[ $nextToken ]['content'] ) !== 'ob_end_clean' ) {
68
+		if ( strtolower( $tokens[$nextToken]['content'] ) !== 'ob_end_clean' ) {
69 69
 			return;
70 70
 		}
71 71
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 			$phpcsFile->fixer->replaceToken( $stackPtr, 'ob_get_clean' );
91 91
 
92 92
 			// Remove everything from after the first semicolon to the second semicolon (inclusive).
93
-			for ( $i = $semicolon + 1; $i <= $endCleanSemicolon; $i++ ) {
93
+			for ( $i = $semicolon + 1; $i <= $endCleanSemicolon; $i ++ ) {
94 94
 				$phpcsFile->fixer->replaceToken( $i, '' );
95 95
 			}
96 96
 
Please login to merge, or discard this patch.