Completed
Pull Request — master (#2454)
by
unknown
46s
created
classes/helpers/FrmFormsHelper.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			'class'        => '',
53 53
 			'inc_children' => 'exclude',
54 54
 		);
55
-		$args     = wp_parse_args( $args, $defaults );
55
+		$args = wp_parse_args( $args, $defaults );
56 56
 
57 57
 		if ( ! $args['field_id'] ) {
58 58
 			$args['field_id'] = $field_name;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public static function add_html_attr( $class, $param, &$add_html ) {
99 99
 		if ( ! empty( $class ) ) {
100
-			$add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
100
+			$add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
101 101
 		}
102 102
 	}
103 103
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		}
324 324
 
325 325
 		$field_ids  = array_map(
326
-			function ( $field_plus_id ) {
326
+			function( $field_plus_id ) {
327 327
 				$field_id = str_replace( 'field', '', $field_plus_id );
328 328
 
329 329
 				if ( strpos( $field_id, '-' ) !== false ) {
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 				continue;
355 355
 			}
356 356
 
357
-			$html_id = 'field_' . $field_keys[ $index ]->field_key . $row;
357
+			$html_id = 'field_' . $field_keys[$index]->field_key . $row;
358 358
 
359
-			if ( in_array( $field_keys[ $index ]->type, array( 'checkbox', 'radio' ), true ) ) {
359
+			if ( in_array( $field_keys[$index]->type, array( 'checkbox', 'radio' ), true ) ) {
360 360
 				// Needed to focus on the first option when error link is clicked.
361 361
 				$html_id .= '-0';
362 362
 			}
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 		);
429 429
 
430 430
 		foreach ( $defaults as $var => $default ) {
431
-			if ( ! isset( $values[ $var ] ) ) {
432
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
431
+			if ( ! isset( $values[$var] ) ) {
432
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
433 433
 			}
434 434
 		}
435 435
 
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 		);
446 446
 
447 447
 		foreach ( $defaults as $var => $default ) {
448
-			if ( ! isset( $values[ $var ] ) ) {
449
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
448
+			if ( ! isset( $values[$var] ) ) {
449
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
450 450
 			}
451 451
 		}
452 452
 		unset( $defaults );
@@ -497,16 +497,16 @@  discard block
 block discarded – undo
497 497
 
498 498
 		foreach ( $defaults as $var => $default ) {
499 499
 			if ( is_array( $default ) ) {
500
-				if ( ! isset( $values[ $var ] ) ) {
501
-					$values[ $var ] = $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : array();
500
+				if ( ! isset( $values[$var] ) ) {
501
+					$values[$var] = $record && isset( $record->options[$var] ) ? $record->options[$var] : array();
502 502
 				}
503 503
 
504 504
 				foreach ( $default as $k => $v ) {
505
-					$values[ $var ][ $k ] = $post_values && isset( $post_values[ $var ][ $k ] ) ? $post_values[ $var ][ $k ] : ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ? $record->options[ $var ][ $k ] : $v );
505
+					$values[$var][$k] = $post_values && isset( $post_values[$var][$k] ) ? $post_values[$var][$k] : ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ? $record->options[$var][$k] : $v );
506 506
 
507 507
 					if ( is_array( $v ) ) {
508 508
 						foreach ( $v as $k1 => $v1 ) {
509
-							$values[ $var ][ $k ][ $k1 ] = $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ? $post_values[ $var ][ $k ][ $k1 ] : ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 );
509
+							$values[$var][$k][$k1] = $post_values && isset( $post_values[$var][$k][$k1] ) ? $post_values[$var][$k][$k1] : ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ? $record->options[$var][$k][$k1] : $v1 );
510 510
 							unset( $k1, $v1 );
511 511
 						}
512 512
 					}
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 					unset( $k, $v );
515 515
 				}
516 516
 			} else {
517
-				$values[ $var ] = $post_values && isset( $post_values['options'][ $var ] ) ? $post_values['options'][ $var ] : ( $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : $default );
517
+				$values[$var] = $post_values && isset( $post_values['options'][$var] ) ? $post_values['options'][$var] : ( $record && isset( $record->options[$var] ) ? $record->options[$var] : $default );
518 518
 			}
519 519
 
520 520
 			unset( $var, $default );
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 		$defaults = self::get_default_opts();
564 564
 
565 565
 		foreach ( $defaults as $var => $default ) {
566
-			$options[ $var ] = $values['options'][ $var ] ?? $default;
566
+			$options[$var] = $values['options'][$var] ?? $default;
567 567
 			unset( $var, $default );
568 568
 		}
569 569
 	}
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 	public static function insert_opt_html( $args ) {
763 763
 		$class  = $args['class'] ?? '';
764 764
 		$fields = self::get_field_type_data_for_insert_opt_html();
765
-		$field  = $fields[ $args['type'] ] ?? array();
765
+		$field  = $fields[$args['type']] ?? array();
766 766
 
767 767
 		self::prepare_field_type( $field );
768 768
 
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 
904 904
 		foreach ( $fields as $field ) {
905 905
 			if ( $prev_order === $field->field_order ) {
906
-				++$add_order;
906
+				++ $add_order;
907 907
 			}
908 908
 
909 909
 			if ( $add_order ) {
@@ -1454,9 +1454,9 @@  discard block
 block discarded – undo
1454 1454
 				$link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"';
1455 1455
 			}
1456 1456
 
1457
-			$label = ( $link_details[ $length ] ?? $link_details['label'] );
1457
+			$label = ( $link_details[$length] ?? $link_details['label'] );
1458 1458
 
1459
-			if ( $length === 'icon' && isset( $link_details[ $length ] ) ) {
1459
+			if ( $length === 'icon' && isset( $link_details[$length] ) ) {
1460 1460
 				$label = '<span class="' . $label . '" title="' . esc_attr( $link_details['label'] ) . '" aria-hidden="true"></span>';
1461 1461
 				$link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"';
1462 1462
 			}
@@ -1628,7 +1628,7 @@  discard block
 block discarded – undo
1628 1628
 			$status = 'publish';
1629 1629
 		}
1630 1630
 
1631
-		$name = $nice_names[ $status ];
1631
+		$name = $nice_names[$status];
1632 1632
 
1633 1633
 		return $name;
1634 1634
 	}
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
 
1695 1695
 		if ( count( $categories ) === 1 ) {
1696 1696
 			$category = reset( $categories );
1697
-			$icon     = $icons[ $category ] ?? $icon;
1697
+			$icon     = $icons[$category] ?? $icon;
1698 1698
 		} elseif ( ! empty( $categories ) ) {
1699 1699
 			$icons = array_intersect_key( $icons, array_flip( $categories ) );
1700 1700
 			$icon  = reset( $icons );
@@ -1826,7 +1826,7 @@  discard block
 block discarded – undo
1826 1826
 
1827 1827
 		foreach ( $item['categories'] as $k => $category ) {
1828 1828
 			if ( in_array( $category, $plans, true ) ) {
1829
-				unset( $item['categories'][ $k ] );
1829
+				unset( $item['categories'][$k] );
1830 1830
 
1831 1831
 				$category = self::convert_legacy_package_names( $category );
1832 1832
 
@@ -1868,7 +1868,7 @@  discard block
 block discarded – undo
1868 1868
 			'include_all' => true,
1869 1869
 			'case_lower'  => false,
1870 1870
 		);
1871
-		$args     = wp_parse_args( $args, $defaults );
1871
+		$args = wp_parse_args( $args, $defaults );
1872 1872
 
1873 1873
 		$license_types = array( 'Basic', 'Plus', 'Business', 'Elite' );
1874 1874
 
@@ -2075,9 +2075,9 @@  discard block
 block discarded – undo
2075 2075
 		}
2076 2076
 
2077 2077
 		foreach ( $shortcodes[0] as $key => $shortcode ) {
2078
-			$options = trim( $shortcodes[3][ $key ] );
2078
+			$options = trim( $shortcodes[3][$key] );
2079 2079
 
2080
-			if ( in_array( $shortcodes[1][ $key ], array( 'if ' ), true ) ) {
2080
+			if ( in_array( $shortcodes[1][$key], array( 'if ' ), true ) ) {
2081 2081
 				// Skip if shortcodes.
2082 2082
 				continue;
2083 2083
 			}
@@ -2087,7 +2087,7 @@  discard block
 block discarded – undo
2087 2087
 				continue;
2088 2088
 			}
2089 2089
 
2090
-			$new_shortcode = '[' . $shortcodes[2][ $key ];
2090
+			$new_shortcode = '[' . $shortcodes[2][$key];
2091 2091
 
2092 2092
 			if ( $options ) {
2093 2093
 				$new_shortcode .= ' ' . $options;
Please login to merge, or discard this patch.