Completed
Pull Request — master (#2453)
by
unknown
36s
created
classes/controllers/FrmFieldsController.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 		$_GET['page'] = 'formidable';
27 27
 
28
-		$values     = array(
28
+		$values = array(
29 29
 			'id'         => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
30 30
 			'doing_ajax' => true,
31 31
 		);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 			ob_start();
50 50
 			self::load_single_field( $field, $values );
51
-			$field_html[ absint( $field->id ) ] = ob_get_contents();
51
+			$field_html[absint( $field->id )] = ob_get_contents();
52 52
 			ob_end_clean();
53 53
 		}
54 54
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 			foreach ( $opts as $opt_key => $opt ) {
264 264
 				if ( strpos( $opt, '|' ) !== false ) {
265 265
 					$vals             = explode( '|', $opt );
266
-					$opts[ $opt_key ] = array(
266
+					$opts[$opt_key] = array(
267 267
 						'label' => trim( $vals[0] ),
268 268
 						'value' => trim( $vals[1] ),
269 269
 					);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			$other_array = array();
279 279
 			foreach ( $field['options'] as $opt_key => $opt ) {
280 280
 				if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
281
-					$other_array[ $opt_key ] = $opt;
281
+					$other_array[$opt_key] = $opt;
282 282
 				}
283 283
 				unset( $opt_key, $opt );
284 284
 			}
@@ -321,18 +321,18 @@  discard block
 block discarded – undo
321 321
 		$frm_settings         = FrmAppHelper::get_settings();
322 322
 		$field_types          = FrmFieldTypeOptionData::get_field_types( $field['type'] );
323 323
 
324
-		if ( ! isset( $all_field_types[ $field['type'] ] ) ) {
324
+		if ( ! isset( $all_field_types[$field['type']] ) ) {
325 325
 			// Add fallback for an add-on field type that has been deactivated.
326
-			$all_field_types[ $field['type'] ] = array(
326
+			$all_field_types[$field['type']] = array(
327 327
 				'name' => ucfirst( $field['type'] ),
328 328
 				'icon' => 'frm_icon_font frm_pencil_icon',
329 329
 			);
330
-		} elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) {
330
+		} elseif ( ! is_array( $all_field_types[$field['type']] ) ) {
331 331
 			// Fallback for fields added in a more basic way.
332
-			FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] );
332
+			FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] );
333 333
 		}
334 334
 
335
-		$type_name = $all_field_types[ $field['type'] ]['name'];
335
+		$type_name = $all_field_types[$field['type']]['name'];
336 336
 		if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) {
337 337
 			$type_name = $all_field_types['divider|repeat']['name'];
338 338
 		}
@@ -409,14 +409,14 @@  discard block
 block discarded – undo
409 409
 
410 410
 		if ( FrmAppHelper::pro_is_connected() ) {
411 411
 			foreach ( $settings as $type ) {
412
-				if ( ! empty( $field[ $type ] ) ) {
412
+				if ( ! empty( $field[$type] ) ) {
413 413
 					$active = $type;
414 414
 				}
415 415
 			}
416 416
 		}
417 417
 
418
-		$types[ $active ]['class']  .= ' current';
419
-		$types[ $active ]['current'] = true;
418
+		$types[$active]['class']  .= ' current';
419
+		$types[$active]['current'] = true;
420 420
 
421 421
 		return $types;
422 422
 	}
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 			'website' => 'url',
435 435
 			'image'   => 'url',
436 436
 		);
437
-		if ( isset( $type_switch[ $type ] ) ) {
438
-			$type = $type_switch[ $type ];
437
+		if ( isset( $type_switch[$type] ) ) {
438
+			$type = $type_switch[$type];
439 439
 		}
440 440
 
441 441
 		$pro_fields = FrmField::pro_field_selection();
@@ -590,11 +590,11 @@  discard block
 block discarded – undo
590 590
 		// include "col" for valid html
591 591
 		$unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) );
592 592
 
593
-		if ( ! isset( $calc[ $unit ] ) ) {
593
+		if ( ! isset( $calc[$unit] ) ) {
594 594
 			return;
595 595
 		}
596 596
 
597
-		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ];
597
+		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit];
598 598
 
599 599
 		$add_html['cols'] = 'cols="' . absint( $size ) . '"';
600 600
 	}
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
 	private static function get_form_for_js_validation( $field ) {
828 828
 		global $frm_vars;
829 829
 		if ( ! empty( $frm_vars['js_validate_forms'] ) ) {
830
-			if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) {
831
-				return $frm_vars['js_validate_forms'][ $field['form_id'] ];
830
+			if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) {
831
+				return $frm_vars['js_validate_forms'][$field['form_id']];
832 832
 			}
833
-			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) {
834
-				return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ];
833
+			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) {
834
+				return $frm_vars['js_validate_forms'][$field['parent_form_id']];
835 835
 			}
836 836
 		}
837 837
 		return false;
@@ -918,13 +918,13 @@  discard block
 block discarded – undo
918 918
 		foreach ( $field['shortcodes'] as $k => $v ) {
919 919
 			if ( isset( $field['subfield_name'] ) && 0 === strpos( $k, 'aria-invalid' ) ) {
920 920
 				$subfield_name = $field['subfield_name'];
921
-				if ( ! isset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] ) ) {
921
+				if ( ! isset( $field['shortcodes']['aria-invalid-' . $subfield_name] ) ) {
922 922
 					continue;
923 923
 				}
924 924
 				// Change the key to the correct aria-invalid value so that $add_html is set correctly for the current subfield of a combo field.
925 925
 				$k = 'aria-invalid';
926
-				$v = $field['shortcodes'][ 'aria-invalid-' . $subfield_name ];
927
-				unset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] );
926
+				$v = $field['shortcodes']['aria-invalid-' . $subfield_name];
927
+				unset( $field['shortcodes']['aria-invalid-' . $subfield_name] );
928 928
 			}
929 929
 			if ( 'opt' === $k || ! self::should_allow_input_attribute( $k ) ) {
930 930
 				continue;
@@ -932,10 +932,10 @@  discard block
 block discarded – undo
932 932
 
933 933
 			if ( is_numeric( $k ) && strpos( $v, '=' ) ) {
934 934
 				$add_html[] = $v;
935
-			} elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
936
-				$add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] );
935
+			} elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) {
936
+				$add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] );
937 937
 			} else {
938
-				$add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"';
938
+				$add_html[$k] = $k . '="' . esc_attr( $v ) . '"';
939 939
 			}
940 940
 
941 941
 			unset( $k, $v );
Please login to merge, or discard this patch.
classes/views/frm-settings/payments.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@
 block discarded – undo
31 31
 	if ( $is_active ) {
32 32
 		$input_params['checked'] = 'checked';
33 33
 	}
34
-	$other_section_selectors      = array_map(
35
-		function ( $section ) {
34
+	$other_section_selectors = array_map(
35
+		function( $section ) {
36 36
 			return "#frm_{$section}_settings_section";
37 37
 		},
38 38
 		array_diff( array_keys( $payment_sections ), array( $key ) )
Please login to merge, or discard this patch.
classes/views/frm-fields/front-end/combo-field/combo-field.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			$sub_field_class   = "frm_form_field form-field frm_form_subfield-{$name} {$sub_field['wrapper_classes']}";
42 42
 			$sub_field_desc    = FrmField::get_option( $field, $name . '_desc' );
43 43
 
44
-			if ( isset( $errors[ 'field' . $field_id . '-' . $name ] ) ) {
44
+			if ( isset( $errors['field' . $field_id . '-' . $name] ) ) {
45 45
 				$sub_field_class .= ' frm_blank_field';
46 46
 			}
47 47
 			?>
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 						$attrs = array(
61 61
 							'type'  => $sub_field['type'],
62 62
 							'id'    => $html_id . '_' . $name,
63
-							'value' => isset( $field_value[ $name ] ) ? $field_value[ $name ] : '',
63
+							'value' => isset( $field_value[$name] ) ? $field_value[$name] : '',
64 64
 						);
65 65
 
66
-						if ( ! empty( $field_value[ $name ] ) ) {
67
-							$attrs['data-frmval'] = $field_value[ $name ];
66
+						if ( ! empty( $field_value[$name] ) ) {
67
+							$attrs['data-frmval'] = $field_value[$name];
68 68
 						}
69 69
 						if ( empty( $args['remove_names'] ) ) {
70 70
 							$attrs['name'] = $field_name . '[' . $name . ']';
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 				}
82 82
 
83 83
 				// Don't show individual field errors when there is a combo field error.
84
-				if ( ! empty( $errors ) && isset( $errors[ 'field' . $field_id . '-' . $name ] ) && ! isset( $errors[ 'field' . $field_id ] ) ) {
84
+				if ( ! empty( $errors ) && isset( $errors['field' . $field_id . '-' . $name] ) && ! isset( $errors['field' . $field_id] ) ) {
85 85
 					?>
86
-					<div class="frm_error" role="alert"><?php echo esc_html( $errors[ 'field' . $field_id . '-' . $name ] ); ?></div>
86
+					<div class="frm_error" role="alert"><?php echo esc_html( $errors['field' . $field_id . '-' . $name] ); ?></div>
87 87
 				<?php } ?>
88 88
 			</div>
89 89
 			<?php
Please login to merge, or discard this patch.
classes/views/frm-fields/back-end/html-content.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 		<?php esc_html_e( 'Content', 'formidable' ); ?>
9 9
 	</label>
10 10
 	<?php
11
-	$e_args  = array(
11
+	$e_args = array(
12 12
 		'textarea_name' => 'field_options[description_' . absint( $field['id'] ) . ']',
13 13
 		'textarea_rows' => 7,
14 14
 	);
Please login to merge, or discard this patch.
classes/views/frm-fields/back-end/combo-field/sub-field-options.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 				?>
41 41
 				<p class="frm6 frm_form_field">
42 42
 					<label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>">
43
-						<?php echo esc_html( $labels[ $option ] ); ?>
43
+						<?php echo esc_html( $labels[$option] ); ?>
44 44
 					</label>
45 45
 					<span class="frm-with-right-icon">
46 46
 						<?php
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 							type="text"
56 56
 							name="<?php echo esc_attr( $input_name ); ?>"
57 57
 							id="<?php echo esc_attr( $input_id ); ?>"
58
-							value="<?php echo esc_attr( isset( $default_value[ $sub_field['name'] ] ) ? $default_value[ $sub_field['name'] ] : '' ); ?>"
58
+							value="<?php echo esc_attr( isset( $default_value[$sub_field['name']] ) ? $default_value[$sub_field['name']] : '' ); ?>"
59 59
 							data-changeme="field_<?php echo esc_attr( $field_key . '_' . $sub_field['name'] ); ?>"
60 60
 							data-changeatt="value"
61 61
 						/>
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 				?>
73 73
 				<p class="frm6 frm_form_field">
74 74
 					<label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>">
75
-						<?php echo esc_html( $labels[ $option ] ); ?>
75
+						<?php echo esc_html( $labels[$option] ); ?>
76 76
 					</label>
77 77
 					<input
78 78
 						type="text"
79 79
 						name="<?php echo esc_attr( $input_name ); ?>"
80 80
 						id="<?php echo esc_attr( $input_id ); ?>"
81
-						value="<?php echo esc_attr( isset( $input_value[ $sub_field['name'] ] ) ? $input_value[ $sub_field['name'] ] : '' ); ?>"
81
+						value="<?php echo esc_attr( isset( $input_value[$sub_field['name']] ) ? $input_value[$sub_field['name']] : '' ); ?>"
82 82
 						data-changeme="field_<?php echo esc_attr( $field_key . '_' . $sub_field['name'] ); ?>"
83 83
 						data-changeatt="<?php echo esc_attr( $option ); ?>"
84 84
 					/>
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 				?>
95 95
 				<p class="frm_form_field frm-flex-col">
96 96
 					<label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>">
97
-						<?php echo esc_html( $labels[ $option ] ); ?>
97
+						<?php echo esc_html( $labels[$option] ); ?>
98 98
 					</label>
99 99
 					<textarea
100 100
 						name="<?php echo esc_attr( $input_name ); ?>"
Please login to merge, or discard this patch.
classes/views/frm-fields/back-end/settings.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 						if ( FrmAppHelper::pro_is_connected() && ! is_callable( array( 'FrmProHtmlHelper', 'echo_radio_group' ) ) ) {
190 190
 							switch ( $type ) {
191 191
 								case 'calc':
192
-									$default_value_type['data']  = array(
192
+									$default_value_type['data'] = array(
193 193
 										'show'    => '#calc-for-{id}',
194 194
 										'disable' => '#default-value-for-{id}',
195 195
 									);
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 						);
217 217
 
218 218
 						foreach ( $default_value_type['data'] as $data_key => $data_value ) {
219
-							$toggle_args['input_html'][ 'data-' . $data_key ] = $data_value . ( substr( $data_value, -1 ) === '-' ? $field['id'] : '' );
219
+							$toggle_args['input_html']['data-' . $data_key] = $data_value . ( substr( $data_value, -1 ) === '-' ? $field['id'] : '' );
220 220
 						}
221 221
 
222 222
 						?>
Please login to merge, or discard this patch.
classes/controllers/FrmFormTemplatesController.php 1 patch
Spacing   +13 added lines, -15 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 					'description'        => esc_html__( 'Just add your email address and you\'ll get 30+ free form templates to your account.', 'formidable' ),
233 233
 					'submit_button_text' => esc_html_x( 'Get Templates', 'get free templates modal submit button text', 'formidable' ),
234 234
 				);
235
-				$view_parts[]     = 'modals/leave-email-modal.php';
235
+				$view_parts[] = 'modals/leave-email-modal.php';
236 236
 			}
237 237
 
238 238
 			// Add 'upgrade' modal view for non-elite users.
@@ -331,11 +331,11 @@  discard block
 block discarded – undo
331 331
 
332 332
 		// Perform add or remove operation.
333 333
 		if ( 'add' === $operation ) {
334
-			self::$favorite_templates[ $key ][] = $template_id;
334
+			self::$favorite_templates[$key][] = $template_id;
335 335
 		} elseif ( 'remove' === $operation ) {
336
-			$position = array_search( $template_id, self::$favorite_templates[ $key ], true );
336
+			$position = array_search( $template_id, self::$favorite_templates[$key], true );
337 337
 			if ( $position !== false ) {
338
-				unset( self::$favorite_templates[ $key ][ $position ] );
338
+				unset( self::$favorite_templates[$key][$position] );
339 339
 			}
340 340
 		}
341 341
 
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 		foreach ( self::$templates as $key => &$template ) {
487 487
 			// Skip the template if the categories are not set.
488 488
 			if ( ! isset( $template['categories'] ) || ! isset( $template['id'] ) ) {
489
-				unset( self::$templates[ $key ] );
489
+				unset( self::$templates[$key] );
490 490
 				continue;
491 491
 			}
492 492
 
@@ -500,14 +500,12 @@  discard block
 block discarded – undo
500 500
 				// Add the slug to the new array.
501 501
 				$template['category_slugs'][] = $category_slug;
502 502
 
503
-				if ( ! isset( self::$categories[ $category_slug ] ) ) {
504
-					self::$categories[ $category_slug ] = array(
503
+				if ( ! isset( self::$categories[$category_slug] ) ) {
504
+					self::$categories[$category_slug] = array(
505 505
 						'name'  => $category,
506 506
 						'count' => 0,
507 507
 					);
508
-				}
509
-
510
-				++self::$categories[ $category_slug ]['count'];
508
+				} ++self::$categories[$category_slug]['count'];
511 509
 			}
512 510
 
513 511
 			// Mark the template as favorite if it's in the favorite templates list.
@@ -522,7 +520,7 @@  discard block
 block discarded – undo
522 520
 		$redundant_cats = array_merge( array( 'PayPal', 'Stripe', 'Twilio' ), FrmFormsHelper::get_license_types() );
523 521
 		foreach ( $redundant_cats as $redundant_cat ) {
524 522
 			$category_slug = sanitize_title( $redundant_cat );
525
-			unset( self::$categories[ $category_slug ] );
523
+			unset( self::$categories[$category_slug] );
526 524
 		}
527 525
 
528 526
 		// Sort the categories by keys alphabetically.
@@ -547,7 +545,7 @@  discard block
 block discarded – undo
547 545
 				'count' => 0,
548 546
 			);
549 547
 		}
550
-		$special_categories['all-items']      = array(
548
+		$special_categories['all-items'] = array(
551 549
 			'name'  => __( 'All Templates', 'formidable' ),
552 550
 			'count' => self::get_template_count(),
553 551
 		);
@@ -570,9 +568,9 @@  discard block
 block discarded – undo
570 568
 	 */
571 569
 	private static function assign_featured_templates() {
572 570
 		foreach ( self::FEATURED_TEMPLATES_KEYS as $key ) {
573
-			if ( isset( self::$templates[ $key ] ) ) {
574
-				self::$templates[ $key ]['is_featured'] = true;
575
-				self::$featured_templates[]             = self::$templates[ $key ];
571
+			if ( isset( self::$templates[$key] ) ) {
572
+				self::$templates[$key]['is_featured'] = true;
573
+				self::$featured_templates[]             = self::$templates[$key];
576 574
 			}
577 575
 		}
578 576
 	}
Please login to merge, or discard this patch.
classes/helpers/FrmDashboardHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 	public function __construct( $data ) {
90 90
 		$sections = array( 'counters', 'license', 'get_free_templates', 'payments', 'entries', 'inbox', 'video', 'payments' );
91 91
 		foreach ( $sections as $section ) {
92
-			if ( isset( $data[ $section ] ) ) {
93
-				$this->view[ $section ] = $data[ $section ];
92
+			if ( isset( $data[$section] ) ) {
93
+				$this->view[$section] = $data[$section];
94 94
 			}
95 95
 		}
96 96
 	}
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	private static function load_entries_list_template( $template ) {
366 366
 		add_filter(
367 367
 			'formidable_page_formidable_entries_per_page',
368
-			function () {
368
+			function() {
369 369
 				return 7;
370 370
 			}
371 371
 		);
Please login to merge, or discard this patch.
classes/helpers/FrmHtmlHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		wp_enqueue_script( 'formidable_settings' );
29 29
 		return FrmAppHelper::clip(
30 30
 			// @phpstan-ignore-next-line
31
-			function () use ( $id, $name, $args ) {
31
+			function() use ( $id, $name, $args ) {
32 32
 				require FrmAppHelper::plugin_path() . '/classes/views/shared/toggle.php';
33 33
 			},
34 34
 			isset( $args['echo'] ) ? $args['echo'] : false
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			}
98 98
 		}
99 99
 
100
-		$input_number_attrs          = array_merge(
100
+		$input_number_attrs = array_merge(
101 101
 			$args['input_number_attrs'],
102 102
 			array(
103 103
 				'type'  => ! empty( $selected_unit ) ? 'number' : 'text',
Please login to merge, or discard this patch.