Completed
Pull Request — master (#2563)
by
unknown
42s
created
classes/models/FrmFieldFormHtml.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	 * @return void
47 47
 	 */
48 48
 	private function _set( $param, $atts ) {
49
-		if ( isset( $atts[ $param ] ) ) {
50
-			$this->{$param} = $atts[ $param ];
49
+		if ( isset( $atts[$param] ) ) {
50
+			$this->{$param} = $atts[$param];
51 51
 		}
52 52
 	}
53 53
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 
98 98
 		$exclude = array( 'field_obj', 'html' );
99 99
 		foreach ( $exclude as $ex ) {
100
-			if ( isset( $atts[ $ex ] ) ) {
101
-				unset( $this->pass_args[ $ex ] );
100
+			if ( isset( $atts[$ex] ) ) {
101
+				unset( $this->pass_args[$ex] );
102 102
 			}
103 103
 		}
104 104
 	}
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 * @return void
113 113
 	 */
114 114
 	private function set_from_field( $atts, $set ) {
115
-		if ( isset( $atts[ $set['param'] ] ) ) {
116
-			$this->{$set['param']} = $atts[ $set['param'] ];
115
+		if ( isset( $atts[$set['param']] ) ) {
116
+			$this->{$set['param']} = $atts[$set['param']];
117 117
 		} else {
118 118
 			$this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] );
119 119
 		}
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	private function replace_error_shortcode() {
266 266
 		$this->maybe_add_error_id();
267
-		$error = $this->pass_args['errors'][ 'field' . $this->field_id ] ?? false;
267
+		$error = $this->pass_args['errors']['field' . $this->field_id] ?? false;
268 268
 
269 269
 		if ( ! empty( $error ) && false === strpos( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) {
270 270
 			$error_body = self::get_error_body( $this->html );
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 * @return void
308 308
 	 */
309 309
 	private function maybe_add_error_id() {
310
-		if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) {
310
+		if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) {
311 311
 			return;
312 312
 		}
313 313
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 		preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER );
400 400
 
401 401
 		foreach ( $shortcodes[0] as $short_key => $tag ) {
402
-			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
402
+			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
403 403
 			$tag            = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key );
404 404
 
405 405
 			$replace_with = '';
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 				$replace_with = $this->replace_input_shortcode( $shortcode_atts );
411 411
 			}
412 412
 
413
-			$this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html );
413
+			$this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html );
414 414
 		}
415 415
 	}
416 416
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	 */
433 433
 	private function prepare_input_shortcode_atts( $shortcode_atts ) {
434 434
 		if ( isset( $shortcode_atts['opt'] ) ) {
435
-			--$shortcode_atts['opt'];
435
+			-- $shortcode_atts['opt'];
436 436
 		}
437 437
 
438 438
 		$field_class = $shortcode_atts['class'] ?? '';
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	 */
503 503
 	private function get_field_div_classes() {
504 504
 		// Add error class
505
-		$classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : '';
505
+		$classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : '';
506 506
 
507 507
 		// Add label position class
508 508
 		$settings = $this->field_obj->display_field_settings();
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 		}
584 584
 
585 585
 		// Add 'aria-invalid' attribute to the group if there are errors.
586
-		if ( isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) {
586
+		if ( isset( $this->pass_args['errors']['field' . $this->field_id] ) ) {
587 587
 			$attributes['aria-invalid'] = 'true';
588 588
 		}
589 589
 
Please login to merge, or discard this patch.
classes/models/FrmEntryFormatter.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 
170 170
 		$conditionally_add = array( 'include_fields', 'fields', 'exclude_fields', 'entry' );
171 171
 		foreach ( $conditionally_add as $index ) {
172
-			if ( isset( $atts[ $index ] ) ) {
173
-				$entry_atts[ $index ] = $atts[ $index ];
172
+			if ( isset( $atts[$index] ) ) {
173
+				$entry_atts[$index] = $atts[$index];
174 174
 			}
175 175
 		}
176 176
 
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 
377 377
 		$unset = array( 'id', 'form_id', 'format' );
378 378
 		foreach ( $unset as $param ) {
379
-			if ( isset( $atts[ $param ] ) ) {
380
-				unset( $atts[ $param ] );
379
+			if ( isset( $atts[$param] ) ) {
380
+				unset( $atts[$param] );
381 381
 			}
382 382
 		}
383 383
 
@@ -553,11 +553,11 @@  discard block
 block discarded – undo
553 553
 
554 554
 			$displayed_value = $this->prepare_display_value_for_array( $field_value->get_displayed_value() );
555 555
 
556
-			$output[ $this->get_key_or_id( $field_value ) ] = $displayed_value;
556
+			$output[$this->get_key_or_id( $field_value )] = $displayed_value;
557 557
 
558 558
 			$has_separate_value = (bool) $field_value->get_field_option( 'separate_value' );
559 559
 			if ( $has_separate_value || $displayed_value !== $field_value->get_saved_value() ) {
560
-				$output[ $this->get_key_or_id( $field_value ) . '-value' ] = $field_value->get_saved_value();
560
+				$output[$this->get_key_or_id( $field_value ) . '-value'] = $field_value->get_saved_value();
561 561
 			}
562 562
 		}
563 563
 	}
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
 		if ( $this->is_plain_text ) {
976 976
 			if ( is_array( $value ) ) {
977 977
 				foreach ( $value as $key => $single_value ) {
978
-					$value[ $key ] = $this->strip_html( $single_value );
978
+					$value[$key] = $this->strip_html( $single_value );
979 979
 				}
980 980
 			} elseif ( $this->is_plain_text && ! is_array( $value ) ) {
981 981
 				if ( strpos( $value, '<img' ) !== false ) {
Please login to merge, or discard this patch.
classes/helpers/FrmTipsHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 			'page'  => '',
46 46
 			'class' => 'frm-mt-0',
47 47
 		);
48
-		$tip      = array_merge( $defaults, $tip );
48
+		$tip = array_merge( $defaults, $tip );
49 49
 
50 50
 		if ( isset( $tip['link'] ) && ! isset( $tip['link']['medium'] ) ) {
51 51
 			$tip['link']['medium'] = 'tip';
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 		}
403 403
 
404 404
 		$random = random_int( 0, $count - 1 );
405
-		return $tips[ $random ];
405
+		return $tips[$random];
406 406
 	}
407 407
 
408 408
 	/**
Please login to merge, or discard this patch.
stripe/controllers/FrmStrpLiteAppController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
 
153 153
 		$is_setup_intent = 0 === strpos( $intent->id, 'seti_' );
154 154
 		if ( $is_setup_intent ) {
155
-			$errors[ 'field' . $cc_field_id ] = is_object( $intent->last_setup_error ) ? $intent->last_setup_error->message : '';
155
+			$errors['field' . $cc_field_id] = is_object( $intent->last_setup_error ) ? $intent->last_setup_error->message : '';
156 156
 		} else {
157
-			$errors[ 'field' . $cc_field_id ] = is_object( $intent->last_payment_error ) ? $intent->last_payment_error->message : '';
157
+			$errors['field' . $cc_field_id] = is_object( $intent->last_payment_error ) ? $intent->last_payment_error->message : '';
158 158
 		}
159 159
 
160
-		if ( ! $errors[ 'field' . $cc_field_id ] ) {
161
-			$errors[ 'field' . $cc_field_id ] = 'Payment was not successfully processed.';
160
+		if ( ! $errors['field' . $cc_field_id] ) {
161
+			$errors['field' . $cc_field_id] = 'Payment was not successfully processed.';
162 162
 		}
163 163
 
164 164
 		global $frm_vars;
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
 		$save_draft = ! empty( $form->options['save_draft'] );
188 188
 
189 189
 		global $frm_vars;
190
-		$frm_vars['created_entries'][ $form_id ]['errors'] = $errors;
190
+		$frm_vars['created_entries'][$form_id]['errors'] = $errors;
191 191
 
192 192
 		// Set to true to get FrmProFieldsHelper::get_page_with_error() run.
193
-		$_POST[ 'frm_page_order_' . $form_id ] = true;
193
+		$_POST['frm_page_order_' . $form_id] = true;
194 194
 
195 195
 		if ( ! $save_draft ) {
196 196
 			// If draft saving is not on, delete the entry.
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		}
200 200
 
201 201
 		// If draft saving is on, load the draft entry.
202
-		$frm_vars['created_entries'][ $form_id ]['entry_id'] = $entry_id;
202
+		$frm_vars['created_entries'][$form_id]['entry_id'] = $entry_id;
203 203
 		add_action(
204 204
 			'frm_filter_final_form',
205 205
 			/**
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			 *
211 211
 			 * @return string
212 212
 			 */
213
-			function ( $html ) use ( $entry_id ) {
213
+			function( $html ) use ( $entry_id ) {
214 214
 				global $wpdb;
215 215
 				$wpdb->update( $wpdb->prefix . 'frm_items', array( 'is_draft' => 1 ), array( 'id' => $entry_id ) );
216 216
 				return $html;
Please login to merge, or discard this patch.
stripe/controllers/FrmStrpLiteSettingsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 			 *
27 27
 			 * @return void
28 28
 			 */
29
-			function ( $frm_settings ) {
29
+			function( $frm_settings ) {
30 30
 				$stripe_settings = FrmStrpLiteAppHelper::get_settings()->settings;
31 31
 				require FrmStrpLiteAppHelper::plugin_path() . '/views/settings/messages.php';
32 32
 			}
Please login to merge, or discard this patch.
classes/helpers/FrmStylesPreviewHelper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			 *
78 78
 			 * @return string
79 79
 			 */
80
-			function ( $position, $field ) {
80
+			function( $position, $field ) {
81 81
 				if ( is_array( $field ) ) {
82 82
 					$this->default_label_position_field_ids[] = (int) $field['id'];
83 83
 				}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 			 *
96 96
 			 * @return string
97 97
 			 */
98
-			function ( $classes, $field ) {
98
+			function( $classes, $field ) {
99 99
 				if ( is_array( $field ) && in_array( (int) $field['id'], $this->default_label_position_field_ids, true ) ) {
100 100
 					$classes .= ' frm-default-label-position';
101 101
 				}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 			 *
124 124
 			 * @return bool
125 125
 			 */
126
-			function ( $show, $field_type ) {
126
+			function( $show, $field_type ) {
127 127
 				if ( 'captcha' === $field_type ) {
128 128
 					$show = false;
129 129
 				}
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 			 *
153 153
 			 * @return stdClass|null
154 154
 			 */
155
-			function ( $form ) {
155
+			function( $form ) {
156 156
 				if ( is_object( $form ) && is_array( $form->options ) ) {
157 157
 					$form->options['js_validate'] = false;
158 158
 				}
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
 		$frm_settings = FrmAppHelper::get_settings();
204 204
 		if ( 'none' === $frm_settings->load_style ) {
205
-			$notes[] = function () {
205
+			$notes[] = function() {
206 206
 				printf(
207 207
 					// translators: %1$s: Anchor tag open, %2$s: Anchor tag close.
208 208
 					esc_html__( 'Formidable styles are disabled. This needs to be enabled in %1$sGlobal Settings%2$s.', 'formidable' ),
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 			return;
394 394
 		}
395 395
 
396
-		unset( $dependencies[ $index ] );
396
+		unset( $dependencies[$index] );
397 397
 		$dependencies = array_values( $dependencies );
398 398
 
399 399
 		$styles->registered['wp-admin']->deps = $dependencies;
Please login to merge, or discard this patch.
Formidable/Sniffs/WhiteSpace/BlankLineAfterClosingBraceSniff.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
 			T_COALESCE_EQUAL,
76 76
 		);
77 77
 
78
-		if ( ! in_array( $tokens[ $nextToken ]['code'], $assignmentTokens, true ) ) {
78
+		if ( ! in_array( $tokens[$nextToken]['code'], $assignmentTokens, true ) ) {
79 79
 			return;
80 80
 		}
81 81
 
82 82
 		// Find the first token on the current line.
83 83
 		$firstOnLine = $stackPtr;
84
-		for ( $i = $stackPtr - 1; $i >= 0; $i-- ) {
85
-			if ( $tokens[ $i ]['line'] < $tokens[ $stackPtr ]['line'] ) {
84
+		for ( $i = $stackPtr - 1; $i >= 0; $i -- ) {
85
+			if ( $tokens[$i]['line'] < $tokens[$stackPtr]['line'] ) {
86 86
 				break;
87 87
 			}
88 88
 			$firstOnLine = $i;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		}
96 96
 
97 97
 		// Now find what's on the previous line.
98
-		$currentLine  = $tokens[ $stackPtr ]['line'];
98
+		$currentLine  = $tokens[$stackPtr]['line'];
99 99
 		$previousLine = $currentLine - 1;
100 100
 
101 101
 		if ( $previousLine < 1 ) {
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 
105 105
 		// Find the last non-whitespace token on the previous line.
106 106
 		$lastTokenOnPrevLine = null;
107
-		for ( $i = $stackPtr - 1; $i >= 0; $i-- ) {
108
-			if ( $tokens[ $i ]['line'] < $previousLine ) {
107
+		for ( $i = $stackPtr - 1; $i >= 0; $i -- ) {
108
+			if ( $tokens[$i]['line'] < $previousLine ) {
109 109
 				break;
110 110
 			}
111
-			if ( $tokens[ $i ]['line'] === $previousLine && $tokens[ $i ]['code'] !== T_WHITESPACE ) {
111
+			if ( $tokens[$i]['line'] === $previousLine && $tokens[$i]['code'] !== T_WHITESPACE ) {
112 112
 				$lastTokenOnPrevLine = $i;
113 113
 				break;
114 114
 			}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		}
122 122
 
123 123
 		// Check if the last token on the previous line is a closing brace.
124
-		if ( $tokens[ $lastTokenOnPrevLine ]['code'] !== T_CLOSE_CURLY_BRACKET ) {
124
+		if ( $tokens[$lastTokenOnPrevLine]['code'] !== T_CLOSE_CURLY_BRACKET ) {
125 125
 			return;
126 126
 		}
127 127
 
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
@@ -25,8 +25,8 @@
 block discarded – undo
25 25
 		$input_params['checked'] = 'checked';
26 26
 	}
27 27
 
28
-	$other_section_selectors      = array_map(
29
-		function ( $section ) {
28
+	$other_section_selectors = array_map(
29
+		function( $section ) {
30 30
 			return "#frm_{$section}_settings_section";
31 31
 		},
32 32
 		array_diff( array_keys( $payment_sections ), array( $key ) )
Please login to merge, or discard this patch.
classes/models/fields/FrmFieldEmail.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 
53 53
 		$errors = array();
54 54
 		if ( false !== strpos( $args['value'], '.@' ) || ! is_email( $args['value'] ) ) {
55
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
55
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' );
56 56
 		}
57 57
 		return $errors;
58 58
 	}
Please login to merge, or discard this patch.