Completed
Pull Request — master (#2454)
by
unknown
44s
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
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 			return $field_error_messages;
321 321
 		}
322 322
 		$field_ids  = array_map(
323
-			function ( $field_plus_id ) {
323
+			function( $field_plus_id ) {
324 324
 				$field_id = str_replace( 'field', '', $field_plus_id );
325 325
 				if ( strpos( $field_id, '-' ) !== false ) {
326 326
 					$field_id = explode( '-', $field_id )[0];
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 			if ( false === $index ) {
345 345
 				continue;
346 346
 			}
347
-			$html_id = 'field_' . $field_keys[ $index ]->field_key . $row;
348
-			if ( in_array( $field_keys[ $index ]->type, array( 'checkbox', 'radio' ), true ) ) {
347
+			$html_id = 'field_' . $field_keys[$index]->field_key . $row;
348
+			if ( in_array( $field_keys[$index]->type, array( 'checkbox', 'radio' ), true ) ) {
349 349
 				// Needed to focus on the first option when error link is clicked.
350 350
 				$html_id .= '-0';
351 351
 			}
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
 		);
417 417
 
418 418
 		foreach ( $defaults as $var => $default ) {
419
-			if ( ! isset( $values[ $var ] ) ) {
420
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
419
+			if ( ! isset( $values[$var] ) ) {
420
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
421 421
 			}
422 422
 		}
423 423
 
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 		);
434 434
 
435 435
 		foreach ( $defaults as $var => $default ) {
436
-			if ( ! isset( $values[ $var ] ) ) {
437
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
436
+			if ( ! isset( $values[$var] ) ) {
437
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
438 438
 			}
439 439
 		}
440 440
 		unset( $defaults );
@@ -485,16 +485,16 @@  discard block
 block discarded – undo
485 485
 
486 486
 		foreach ( $defaults as $var => $default ) {
487 487
 			if ( is_array( $default ) ) {
488
-				if ( ! isset( $values[ $var ] ) ) {
489
-					$values[ $var ] = $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : array();
488
+				if ( ! isset( $values[$var] ) ) {
489
+					$values[$var] = $record && isset( $record->options[$var] ) ? $record->options[$var] : array();
490 490
 				}
491 491
 
492 492
 				foreach ( $default as $k => $v ) {
493
-					$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 );
493
+					$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 );
494 494
 
495 495
 					if ( is_array( $v ) ) {
496 496
 						foreach ( $v as $k1 => $v1 ) {
497
-							$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 );
497
+							$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 );
498 498
 							unset( $k1, $v1 );
499 499
 						}
500 500
 					}
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 					unset( $k, $v );
503 503
 				}
504 504
 			} else {
505
-				$values[ $var ] = $post_values && isset( $post_values['options'][ $var ] ) ? $post_values['options'][ $var ] : ( $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : $default );
505
+				$values[$var] = $post_values && isset( $post_values['options'][$var] ) ? $post_values['options'][$var] : ( $record && isset( $record->options[$var] ) ? $record->options[$var] : $default );
506 506
 			}
507 507
 
508 508
 			unset( $var, $default );
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 		$defaults = self::get_default_opts();
552 552
 
553 553
 		foreach ( $defaults as $var => $default ) {
554
-			$options[ $var ] = $values['options'][ $var ] ?? $default;
554
+			$options[$var] = $values['options'][$var] ?? $default;
555 555
 			unset( $var, $default );
556 556
 		}
557 557
 	}
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 	public static function insert_opt_html( $args ) {
751 751
 		$class  = $args['class'] ?? '';
752 752
 		$fields = self::get_field_type_data_for_insert_opt_html();
753
-		$field  = $fields[ $args['type'] ] ?? array();
753
+		$field  = $fields[$args['type']] ?? array();
754 754
 
755 755
 		self::prepare_field_type( $field );
756 756
 
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 
892 892
 		foreach ( $fields as $field ) {
893 893
 			if ( $prev_order === $field->field_order ) {
894
-				++$add_order;
894
+				++ $add_order;
895 895
 			}
896 896
 
897 897
 			if ( $add_order ) {
@@ -1442,9 +1442,9 @@  discard block
 block discarded – undo
1442 1442
 				$link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"';
1443 1443
 			}
1444 1444
 
1445
-			$label = ( $link_details[ $length ] ?? $link_details['label'] );
1445
+			$label = ( $link_details[$length] ?? $link_details['label'] );
1446 1446
 
1447
-			if ( $length === 'icon' && isset( $link_details[ $length ] ) ) {
1447
+			if ( $length === 'icon' && isset( $link_details[$length] ) ) {
1448 1448
 				$label = '<span class="' . $label . '" title="' . esc_attr( $link_details['label'] ) . '" aria-hidden="true"></span>';
1449 1449
 				$link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"';
1450 1450
 			}
@@ -1616,7 +1616,7 @@  discard block
 block discarded – undo
1616 1616
 			$status = 'publish';
1617 1617
 		}
1618 1618
 
1619
-		$name = $nice_names[ $status ];
1619
+		$name = $nice_names[$status];
1620 1620
 
1621 1621
 		return $name;
1622 1622
 	}
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
 
1683 1683
 		if ( count( $categories ) === 1 ) {
1684 1684
 			$category = reset( $categories );
1685
-			$icon     = $icons[ $category ] ?? $icon;
1685
+			$icon     = $icons[$category] ?? $icon;
1686 1686
 		} elseif ( ! empty( $categories ) ) {
1687 1687
 			$icons = array_intersect_key( $icons, array_flip( $categories ) );
1688 1688
 			$icon  = reset( $icons );
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
 
1815 1815
 		foreach ( $item['categories'] as $k => $category ) {
1816 1816
 			if ( in_array( $category, $plans, true ) ) {
1817
-				unset( $item['categories'][ $k ] );
1817
+				unset( $item['categories'][$k] );
1818 1818
 
1819 1819
 				$category = self::convert_legacy_package_names( $category );
1820 1820
 
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
 			'include_all' => true,
1857 1857
 			'case_lower'  => false,
1858 1858
 		);
1859
-		$args     = wp_parse_args( $args, $defaults );
1859
+		$args = wp_parse_args( $args, $defaults );
1860 1860
 
1861 1861
 		$license_types = array( 'Basic', 'Plus', 'Business', 'Elite' );
1862 1862
 
@@ -2063,9 +2063,9 @@  discard block
 block discarded – undo
2063 2063
 		}
2064 2064
 
2065 2065
 		foreach ( $shortcodes[0] as $key => $shortcode ) {
2066
-			$options = trim( $shortcodes[3][ $key ] );
2066
+			$options = trim( $shortcodes[3][$key] );
2067 2067
 
2068
-			if ( in_array( $shortcodes[1][ $key ], array( 'if ' ), true ) ) {
2068
+			if ( in_array( $shortcodes[1][$key], array( 'if ' ), true ) ) {
2069 2069
 				// Skip if shortcodes.
2070 2070
 				continue;
2071 2071
 			}
@@ -2075,7 +2075,7 @@  discard block
 block discarded – undo
2075 2075
 				continue;
2076 2076
 			}
2077 2077
 
2078
-			$new_shortcode = '[' . $shortcodes[2][ $key ];
2078
+			$new_shortcode = '[' . $shortcodes[2][$key];
2079 2079
 
2080 2080
 			if ( $options ) {
2081 2081
 				$new_shortcode .= ' ' . $options;
Please login to merge, or discard this patch.