Completed
Pull Request — master (#2454)
by
unknown
47s
created
classes/helpers/FrmFormsHelper.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			'class'        => '',
38 38
 			'inc_children' => 'exclude',
39 39
 		);
40
-		$args     = wp_parse_args( $args, $defaults );
40
+		$args = wp_parse_args( $args, $defaults );
41 41
 
42 42
 		if ( ! $args['field_id'] ) {
43 43
 			$args['field_id'] = $field_name;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public static function add_html_attr( $class, $param, &$add_html ) {
80 80
 		if ( ! empty( $class ) ) {
81
-			$add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
81
+			$add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
82 82
 		}
83 83
 	}
84 84
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 			return $field_error_messages;
281 281
 		}
282 282
 		$field_ids  = array_map(
283
-			function ( $field_plus_id ) {
283
+			function( $field_plus_id ) {
284 284
 				$field_id = str_replace( 'field', '', $field_plus_id );
285 285
 				if ( strpos( $field_id, '-' ) !== false ) {
286 286
 					$field_id = explode( '-', $field_id )[0];
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 			if ( false === $index ) {
305 305
 				continue;
306 306
 			}
307
-			$html_id = 'field_' . $field_keys[ $index ]->field_key . $row;
308
-			if ( in_array( $field_keys[ $index ]->type, array( 'checkbox', 'radio' ), true ) ) {
307
+			$html_id = 'field_' . $field_keys[$index]->field_key . $row;
308
+			if ( in_array( $field_keys[$index]->type, array( 'checkbox', 'radio' ), true ) ) {
309 309
 				// Focus on the first option.
310 310
 				$html_id .= '-0';
311 311
 			}
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 			'description' => '',
371 371
 		);
372 372
 		foreach ( $defaults as $var => $default ) {
373
-			if ( ! isset( $values[ $var ] ) ) {
374
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
373
+			if ( ! isset( $values[$var] ) ) {
374
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
375 375
 			}
376 376
 		}
377 377
 
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
 			'parent_form_id' => 0,
387 387
 		);
388 388
 		foreach ( $defaults as $var => $default ) {
389
-			if ( ! isset( $values[ $var ] ) ) {
390
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
389
+			if ( ! isset( $values[$var] ) ) {
390
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
391 391
 			}
392 392
 		}
393 393
 		unset( $defaults );
@@ -424,16 +424,16 @@  discard block
 block discarded – undo
424 424
 		$defaults = self::get_default_opts();
425 425
 		foreach ( $defaults as $var => $default ) {
426 426
 			if ( is_array( $default ) ) {
427
-				if ( ! isset( $values[ $var ] ) ) {
428
-					$values[ $var ] = $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : array();
427
+				if ( ! isset( $values[$var] ) ) {
428
+					$values[$var] = $record && isset( $record->options[$var] ) ? $record->options[$var] : array();
429 429
 				}
430 430
 
431 431
 				foreach ( $default as $k => $v ) {
432
-					$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 );
432
+					$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 );
433 433
 
434 434
 					if ( is_array( $v ) ) {
435 435
 						foreach ( $v as $k1 => $v1 ) {
436
-							$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 );
436
+							$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 );
437 437
 							unset( $k1, $v1 );
438 438
 						}
439 439
 					}
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 					unset( $k, $v );
442 442
 				}
443 443
 			} else {
444
-				$values[ $var ] = $post_values && isset( $post_values['options'][ $var ] ) ? $post_values['options'][ $var ] : ( $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : $default );
444
+				$values[$var] = $post_values && isset( $post_values['options'][$var] ) ? $post_values['options'][$var] : ( $record && isset( $record->options[$var] ) ? $record->options[$var] : $default );
445 445
 			}
446 446
 
447 447
 			unset( $var, $default );
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 	public static function fill_form_options( &$options, $values ) {
487 487
 		$defaults = self::get_default_opts();
488 488
 		foreach ( $defaults as $var => $default ) {
489
-			$options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default;
489
+			$options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default;
490 490
 			unset( $var, $default );
491 491
 		}
492 492
 	}
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	public static function insert_opt_html( $args ) {
664 664
 		$class  = isset( $args['class'] ) ? $args['class'] : '';
665 665
 		$fields = self::get_field_type_data_for_insert_opt_html();
666
-		$field  = isset( $fields[ $args['type'] ] ) ? $fields[ $args['type'] ] : array();
666
+		$field  = isset( $fields[$args['type']] ) ? $fields[$args['type']] : array();
667 667
 
668 668
 		self::prepare_field_type( $field );
669 669
 
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 		$last_field         = false;
796 796
 		foreach ( $fields as $field ) {
797 797
 			if ( $prev_order === $field->field_order ) {
798
-				++$add_order;
798
+				++ $add_order;
799 799
 			}
800 800
 
801 801
 			if ( $add_order ) {
@@ -1269,8 +1269,8 @@  discard block
 block discarded – undo
1269 1269
 				$link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"';
1270 1270
 			}
1271 1271
 
1272
-			$label = ( isset( $link_details[ $length ] ) ? $link_details[ $length ] : $link_details['label'] );
1273
-			if ( $length === 'icon' && isset( $link_details[ $length ] ) ) {
1272
+			$label = ( isset( $link_details[$length] ) ? $link_details[$length] : $link_details['label'] );
1273
+			if ( $length === 'icon' && isset( $link_details[$length] ) ) {
1274 1274
 				$label = '<span class="' . $label . '" title="' . esc_attr( $link_details['label'] ) . '" aria-hidden="true"></span>';
1275 1275
 				$link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"';
1276 1276
 			}
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 			$status = 'publish';
1418 1418
 		}
1419 1419
 
1420
-		$name = $nice_names[ $status ];
1420
+		$name = $nice_names[$status];
1421 1421
 
1422 1422
 		return $name;
1423 1423
 	}
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
 		$icon = $icons[''];
1482 1482
 		if ( count( $categories ) === 1 ) {
1483 1483
 			$category = reset( $categories );
1484
-			$icon     = isset( $icons[ $category ] ) ? $icons[ $category ] : $icon;
1484
+			$icon     = isset( $icons[$category] ) ? $icons[$category] : $icon;
1485 1485
 		} elseif ( ! empty( $categories ) ) {
1486 1486
 			$icons = array_intersect_key( $icons, array_flip( $categories ) );
1487 1487
 			$icon  = reset( $icons );
@@ -1603,7 +1603,7 @@  discard block
 block discarded – undo
1603 1603
 
1604 1604
 		foreach ( $item['categories'] as $k => $category ) {
1605 1605
 			if ( in_array( $category, $plans, true ) ) {
1606
-				unset( $item['categories'][ $k ] );
1606
+				unset( $item['categories'][$k] );
1607 1607
 
1608 1608
 				$category = self::convert_legacy_package_names( $category );
1609 1609
 
@@ -1642,7 +1642,7 @@  discard block
 block discarded – undo
1642 1642
 			'include_all' => true,
1643 1643
 			'case_lower'  => false,
1644 1644
 		);
1645
-		$args     = wp_parse_args( $args, $defaults );
1645
+		$args = wp_parse_args( $args, $defaults );
1646 1646
 
1647 1647
 		$license_types = array( 'Basic', 'Plus', 'Business', 'Elite' );
1648 1648
 
@@ -1845,9 +1845,9 @@  discard block
 block discarded – undo
1845 1845
 		}
1846 1846
 
1847 1847
 		foreach ( $shortcodes[0] as $key => $shortcode ) {
1848
-			$options = trim( $shortcodes[3][ $key ] );
1848
+			$options = trim( $shortcodes[3][$key] );
1849 1849
 
1850
-			if ( in_array( $shortcodes[1][ $key ], array( 'if ' ), true ) ) {
1850
+			if ( in_array( $shortcodes[1][$key], array( 'if ' ), true ) ) {
1851 1851
 				// Skip if shortcodes.
1852 1852
 				continue;
1853 1853
 			}
@@ -1857,7 +1857,7 @@  discard block
 block discarded – undo
1857 1857
 				continue;
1858 1858
 			}
1859 1859
 
1860
-			$new_shortcode = '[' . $shortcodes[2][ $key ];
1860
+			$new_shortcode = '[' . $shortcodes[2][$key];
1861 1861
 			if ( $options ) {
1862 1862
 				$new_shortcode .= ' ' . $options;
1863 1863
 			}
Please login to merge, or discard this patch.