Completed
Pull Request — master (#2454)
by
unknown
43s
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
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 			return $field_error_messages;
284 284
 		}
285 285
 		$field_ids  = array_map(
286
-			function ( $field_plus_id ) {
286
+			function( $field_plus_id ) {
287 287
 				$field_id = str_replace( 'field', '', $field_plus_id );
288 288
 				if ( strpos( $field_id, '-' ) !== false ) {
289 289
 					$field_id = explode( '-', $field_id )[0];
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
 			if ( false === $index ) {
308 308
 				continue;
309 309
 			}
310
-			$html_id = 'field_' . $field_keys[ $index ]->field_key . $row;
311
-			if ( in_array( $field_keys[ $index ]->type, array( 'checkbox', 'radio' ), true ) ) {
310
+			$html_id = 'field_' . $field_keys[$index]->field_key . $row;
311
+			if ( in_array( $field_keys[$index]->type, array( 'checkbox', 'radio' ), true ) ) {
312 312
 				// Needed to focus on the first option when error link is clicked.
313 313
 				$html_id .= '-0';
314 314
 			}
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
 			'description' => '',
374 374
 		);
375 375
 		foreach ( $defaults as $var => $default ) {
376
-			if ( ! isset( $values[ $var ] ) ) {
377
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
376
+			if ( ! isset( $values[$var] ) ) {
377
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
378 378
 			}
379 379
 		}
380 380
 
@@ -389,8 +389,8 @@  discard block
 block discarded – undo
389 389
 			'parent_form_id' => 0,
390 390
 		);
391 391
 		foreach ( $defaults as $var => $default ) {
392
-			if ( ! isset( $values[ $var ] ) ) {
393
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
392
+			if ( ! isset( $values[$var] ) ) {
393
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
394 394
 			}
395 395
 		}
396 396
 		unset( $defaults );
@@ -427,16 +427,16 @@  discard block
 block discarded – undo
427 427
 		$defaults = self::get_default_opts();
428 428
 		foreach ( $defaults as $var => $default ) {
429 429
 			if ( is_array( $default ) ) {
430
-				if ( ! isset( $values[ $var ] ) ) {
431
-					$values[ $var ] = $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : array();
430
+				if ( ! isset( $values[$var] ) ) {
431
+					$values[$var] = $record && isset( $record->options[$var] ) ? $record->options[$var] : array();
432 432
 				}
433 433
 
434 434
 				foreach ( $default as $k => $v ) {
435
-					$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 );
435
+					$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 );
436 436
 
437 437
 					if ( is_array( $v ) ) {
438 438
 						foreach ( $v as $k1 => $v1 ) {
439
-							$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 );
439
+							$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 );
440 440
 							unset( $k1, $v1 );
441 441
 						}
442 442
 					}
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 					unset( $k, $v );
445 445
 				}
446 446
 			} else {
447
-				$values[ $var ] = $post_values && isset( $post_values['options'][ $var ] ) ? $post_values['options'][ $var ] : ( $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : $default );
447
+				$values[$var] = $post_values && isset( $post_values['options'][$var] ) ? $post_values['options'][$var] : ( $record && isset( $record->options[$var] ) ? $record->options[$var] : $default );
448 448
 			}
449 449
 
450 450
 			unset( $var, $default );
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	public static function fill_form_options( &$options, $values ) {
490 490
 		$defaults = self::get_default_opts();
491 491
 		foreach ( $defaults as $var => $default ) {
492
-			$options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default;
492
+			$options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default;
493 493
 			unset( $var, $default );
494 494
 		}
495 495
 	}
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	public static function insert_opt_html( $args ) {
667 667
 		$class  = isset( $args['class'] ) ? $args['class'] : '';
668 668
 		$fields = self::get_field_type_data_for_insert_opt_html();
669
-		$field  = isset( $fields[ $args['type'] ] ) ? $fields[ $args['type'] ] : array();
669
+		$field  = isset( $fields[$args['type']] ) ? $fields[$args['type']] : array();
670 670
 
671 671
 		self::prepare_field_type( $field );
672 672
 
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 		$last_field         = false;
799 799
 		foreach ( $fields as $field ) {
800 800
 			if ( $prev_order === $field->field_order ) {
801
-				++$add_order;
801
+				++ $add_order;
802 802
 			}
803 803
 
804 804
 			if ( $add_order ) {
@@ -1272,8 +1272,8 @@  discard block
 block discarded – undo
1272 1272
 				$link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"';
1273 1273
 			}
1274 1274
 
1275
-			$label = ( isset( $link_details[ $length ] ) ? $link_details[ $length ] : $link_details['label'] );
1276
-			if ( $length === 'icon' && isset( $link_details[ $length ] ) ) {
1275
+			$label = ( isset( $link_details[$length] ) ? $link_details[$length] : $link_details['label'] );
1276
+			if ( $length === 'icon' && isset( $link_details[$length] ) ) {
1277 1277
 				$label = '<span class="' . $label . '" title="' . esc_attr( $link_details['label'] ) . '" aria-hidden="true"></span>';
1278 1278
 				$link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"';
1279 1279
 			}
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
 			$status = 'publish';
1421 1421
 		}
1422 1422
 
1423
-		$name = $nice_names[ $status ];
1423
+		$name = $nice_names[$status];
1424 1424
 
1425 1425
 		return $name;
1426 1426
 	}
@@ -1484,7 +1484,7 @@  discard block
 block discarded – undo
1484 1484
 		$icon = $icons[''];
1485 1485
 		if ( count( $categories ) === 1 ) {
1486 1486
 			$category = reset( $categories );
1487
-			$icon     = isset( $icons[ $category ] ) ? $icons[ $category ] : $icon;
1487
+			$icon     = isset( $icons[$category] ) ? $icons[$category] : $icon;
1488 1488
 		} elseif ( ! empty( $categories ) ) {
1489 1489
 			$icons = array_intersect_key( $icons, array_flip( $categories ) );
1490 1490
 			$icon  = reset( $icons );
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
 
1607 1607
 		foreach ( $item['categories'] as $k => $category ) {
1608 1608
 			if ( in_array( $category, $plans, true ) ) {
1609
-				unset( $item['categories'][ $k ] );
1609
+				unset( $item['categories'][$k] );
1610 1610
 
1611 1611
 				$category = self::convert_legacy_package_names( $category );
1612 1612
 
@@ -1645,7 +1645,7 @@  discard block
 block discarded – undo
1645 1645
 			'include_all' => true,
1646 1646
 			'case_lower'  => false,
1647 1647
 		);
1648
-		$args     = wp_parse_args( $args, $defaults );
1648
+		$args = wp_parse_args( $args, $defaults );
1649 1649
 
1650 1650
 		$license_types = array( 'Basic', 'Plus', 'Business', 'Elite' );
1651 1651
 
@@ -1848,9 +1848,9 @@  discard block
 block discarded – undo
1848 1848
 		}
1849 1849
 
1850 1850
 		foreach ( $shortcodes[0] as $key => $shortcode ) {
1851
-			$options = trim( $shortcodes[3][ $key ] );
1851
+			$options = trim( $shortcodes[3][$key] );
1852 1852
 
1853
-			if ( in_array( $shortcodes[1][ $key ], array( 'if ' ), true ) ) {
1853
+			if ( in_array( $shortcodes[1][$key], array( 'if ' ), true ) ) {
1854 1854
 				// Skip if shortcodes.
1855 1855
 				continue;
1856 1856
 			}
@@ -1860,7 +1860,7 @@  discard block
 block discarded – undo
1860 1860
 				continue;
1861 1861
 			}
1862 1862
 
1863
-			$new_shortcode = '[' . $shortcodes[2][ $key ];
1863
+			$new_shortcode = '[' . $shortcodes[2][$key];
1864 1864
 			if ( $options ) {
1865 1865
 				$new_shortcode .= ' ' . $options;
1866 1866
 			}
Please login to merge, or discard this patch.