Completed
Pull Request — master (#1456)
by Stephanie
52s
created
classes/models/fields/FrmFieldCaptcha.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
 
202 202
 		if ( is_wp_error( $resp ) ) {
203 203
 			$error_string                     = $resp->get_error_message();
204
-			$errors[ 'field' . $args['id'] ]  = __( 'There was a problem verifying your captcha', 'formidable' );
205
-			$errors[ 'field' . $args['id'] ] .= ' ' . $error_string;
204
+			$errors['field' . $args['id']]  = __( 'There was a problem verifying your captcha', 'formidable' );
205
+			$errors['field' . $args['id']] .= ' ' . $error_string;
206 206
 			return $errors;
207 207
 		}
208 208
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			if ( $invalid_message === __( 'The reCAPTCHA was not entered correctly', 'formidable' ) ) {
230 230
 				$invalid_message = '';
231 231
 			}
232
-			$errors[ 'field' . $args['id'] ] = ( $invalid_message === '' ? $frm_settings->re_msg : $invalid_message );
232
+			$errors['field' . $args['id']] = ( $invalid_message === '' ? $frm_settings->re_msg : $invalid_message );
233 233
 		}
234 234
 
235 235
 		return $errors;
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
 			$frm_vars['captcha_scores'] = array();
246 246
 		}
247 247
 		$form_id = is_object( $this->field ) ? $this->field->form_id : $this->field['form_id'];
248
-		if ( ! isset( $frm_vars['captcha_scores'][ $form_id ] ) ) {
249
-			$frm_vars['captcha_scores'][ $form_id ] = $score;
248
+		if ( ! isset( $frm_vars['captcha_scores'][$form_id] ) ) {
249
+			$frm_vars['captcha_scores'][$form_id] = $score;
250 250
 		}
251 251
 	}
252 252
 
Please login to merge, or discard this patch.
classes/controllers/FrmStylesController.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -119,7 +119,8 @@
 block discarded – undo
119 119
 	 * @return void
120 120
 	 */
121 121
 	private static function maybe_hook_into_global_settings_save() {
122
-		if ( empty( $_POST ) || ! isset( $_POST['style'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
122
+		if ( empty( $_POST ) || ! isset( $_POST['style'] ) ) {
123
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
123 124
 			// Avoid changing any style data if the style array is not sent in the request.
124 125
 			return;
125 126
 		}
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 		}
652 652
 
653 653
 		parse_str( $query, $parsed_query );
654
-		$form_id      = ! empty( $parsed_query['form'] ) ? absint( $parsed_query['form'] ) : 0;
654
+		$form_id = ! empty( $parsed_query['form'] ) ? absint( $parsed_query['form'] ) : 0;
655 655
 
656 656
 		$style     = new stdClass();
657 657
 		$style->ID = end( $ids );
@@ -689,8 +689,8 @@  discard block
 block discarded – undo
689 689
 
690 690
 		$forms = FrmForm::get_published_forms();
691 691
 		foreach ( $forms as $form ) {
692
-			$new_style      = ( isset( $_POST['style'] ) && isset( $_POST['style'][ $form->id ] ) ) ? sanitize_text_field( wp_unslash( $_POST['style'][ $form->id ] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
693
-			$previous_style = ( isset( $_POST['prev_style'] ) && isset( $_POST['prev_style'][ $form->id ] ) ) ? sanitize_text_field( wp_unslash( $_POST['prev_style'][ $form->id ] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
692
+			$new_style      = ( isset( $_POST['style'] ) && isset( $_POST['style'][$form->id] ) ) ? sanitize_text_field( wp_unslash( $_POST['style'][$form->id] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
693
+			$previous_style = ( isset( $_POST['prev_style'] ) && isset( $_POST['prev_style'][$form->id] ) ) ? sanitize_text_field( wp_unslash( $_POST['prev_style'][$form->id] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
694 694
 			if ( $new_style == $previous_style ) {
695 695
 				continue;
696 696
 			}
@@ -1064,8 +1064,8 @@  discard block
 block discarded – undo
1064 1064
 	 */
1065 1065
 	public static function get_style_val( $val, $form = 'default' ) {
1066 1066
 		$style = self::get_form_style( $form );
1067
-		if ( $style && isset( $style->post_content[ $val ] ) ) {
1068
-			return $style->post_content[ $val ];
1067
+		if ( $style && isset( $style->post_content[$val] ) ) {
1068
+			return $style->post_content[$val];
1069 1069
 		}
1070 1070
 	}
1071 1071
 
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
 			} elseif ( 'alt_bg_color' == $name ) {
1085 1085
 				$setting = 'bg_color_active';
1086 1086
 			}
1087
-			$default_styles[ $name ] = $style->post_content[ $setting ];
1087
+			$default_styles[$name] = $style->post_content[$setting];
1088 1088
 			unset( $name, $val );
1089 1089
 		}
1090 1090
 
Please login to merge, or discard this patch.
classes/models/FrmStyle.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,8 @@
 block discarded – undo
67 67
 			$new_instance = (array) $new_instance;
68 68
 			$this->id     = $new_instance['ID'];
69 69
 
70
-			if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
70
+			if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) {
71
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
71 72
 				// Don't continue if not saving this style.
72 73
 				continue;
73 74
 			}
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -102,21 +102,21 @@  discard block
 block discarded – undo
102 102
 			$default_settings = $this->get_defaults();
103 103
 
104 104
 			foreach ( $default_settings as $setting => $default ) {
105
-				if ( ! isset( $new_instance['post_content'][ $setting ] ) ) {
106
-					$new_instance['post_content'][ $setting ] = $default;
105
+				if ( ! isset( $new_instance['post_content'][$setting] ) ) {
106
+					$new_instance['post_content'][$setting] = $default;
107 107
 				}
108 108
 
109 109
 				if ( $this->is_color( $setting ) ) {
110
-					$color_val = $new_instance['post_content'][ $setting ];
110
+					$color_val = $new_instance['post_content'][$setting];
111 111
 					if ( $color_val !== '' && false !== strpos( $color_val, 'rgb' ) ) {
112 112
 						// Maybe sanitize if invalid rgba value is entered.
113 113
 						$this->maybe_sanitize_rgba_value( $color_val );
114 114
 					}
115
-					$new_instance['post_content'][ $setting ] = str_replace( '#', '', $color_val );
116
-				} elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ), true ) && ! isset( $new_instance['post_content'][ $setting ] ) ) {
117
-					$new_instance['post_content'][ $setting ] = 0;
115
+					$new_instance['post_content'][$setting] = str_replace( '#', '', $color_val );
116
+				} elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ), true ) && ! isset( $new_instance['post_content'][$setting] ) ) {
117
+					$new_instance['post_content'][$setting] = 0;
118 118
 				} elseif ( $setting === 'font' ) {
119
-					$new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] );
119
+					$new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] );
120 120
 				}
121 121
 			}
122 122
 
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
 		$valid_keys         = array_keys( $defaults );
237 237
 		$sanitized_settings = array();
238 238
 		foreach ( $valid_keys as $key ) {
239
-			if ( isset( $settings[ $key ] ) ) {
240
-				$sanitized_settings[ $key ] = sanitize_textarea_field( $settings[ $key ] );
239
+			if ( isset( $settings[$key] ) ) {
240
+				$sanitized_settings[$key] = sanitize_textarea_field( $settings[$key] );
241 241
 			} else {
242
-				$sanitized_settings[ $key ] = $defaults[ $key ];
242
+				$sanitized_settings[$key] = $defaults[$key];
243 243
 			}
244 244
 			
245 245
 			if ( 'custom_css' !== $key ) {
246
-				$sanitized_settings[ $key ] = $this->strip_invalid_characters( $sanitized_settings[ $key ] );
246
+				$sanitized_settings[$key] = $this->strip_invalid_characters( $sanitized_settings[$key] );
247 247
 			}
248 248
 		}
249 249
 		return $sanitized_settings;
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
 			$style->post_content = $this->override_defaults( $style->post_content );
494 494
 			$style->post_content = wp_parse_args( $style->post_content, $default_values );
495 495
 
496
-			$styles[ $style->ID ] = $style;
496
+			$styles[$style->ID] = $style;
497 497
 		}
498 498
 
499 499
 		if ( ! $default_style ) {
500 500
 			$default_style = reset( $styles );
501 501
 
502
-			$styles[ $default_style->ID ]->menu_order = 1;
502
+			$styles[$default_style->ID]->menu_order = 1;
503 503
 		}
504 504
 
505 505
 		return $styles;
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 				continue;
744 744
 			}
745 745
 
746
-			if ( $value && $char === $value[ strlen( $value ) - 1 ] ) {
746
+			if ( $value && $char === $value[strlen( $value ) - 1] ) {
747 747
 				$value = $char . $value;
748 748
 			} else {
749 749
 				$value .= $char;
Please login to merge, or discard this patch.
classes/helpers/FrmStylesHelper.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -285,7 +285,8 @@
 block discarded – undo
285 285
 	public static function get_settings_for_output( $style ) {
286 286
 		if ( self::previewing_style() ) {
287 287
 			$frm_style = new FrmStyle();
288
-			if ( isset( $_POST['frm_style_setting'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
288
+			if ( isset( $_POST['frm_style_setting'] ) ) {
289
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
289 290
 
290 291
 				// Sanitizing is done later.
291 292
 				$posted = wp_unslash( $_POST['frm_style_setting'] ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 				'-' => 'down',
127 127
 				'+' => 'up',
128 128
 			);
129
-			$class = 'frm_arrow' . $arrow[ $icon ];
129
+			$class = 'frm_arrow' . $arrow[$icon];
130 130
 		} else {
131 131
 			// frm_minus1_icon.
132 132
 			$key   = str_replace( 'p', '', $key );
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 				'-' => 'minus',
135 135
 				'+' => 'plus',
136 136
 			);
137
-			$class = 'frm_' . $plus[ $icon ];
137
+			$class = 'frm_' . $plus[$icon];
138 138
 		}
139 139
 
140 140
 		if ( $key ) {
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 		?>
161 161
 		<div class="btn-group" id="frm_<?php echo esc_attr( $name ); ?>_select">
162 162
 			<button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button">
163
-				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ); ?>
164
-				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ); ?>
163
+				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '+', $type ) ); ?>
164
+				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '-', $type ) ); ?>
165 165
 				<b class="caret"></b>
166 166
 			</button>
167 167
 			<ul class="multiselect-container frm-dropdown-menu">
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 					<li <?php echo ( $style->post_content['collapse_icon'] == $key ) ? 'class="active"' : ''; ?>>
170 170
 						<a href="javascript:void(0);">
171 171
 							<label>
172
-								<input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[ $name ], $key ); ?> />
172
+								<input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[$name], $key ); ?> />
173 173
 								<span>
174 174
 									<?php
175 175
 									FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '+', $type ) );
@@ -306,15 +306,15 @@  discard block
 block discarded – undo
306 306
 		$vars   = array_diff( $vars, $remove );
307 307
 
308 308
 		foreach ( $vars as $var ) {
309
-			if ( ! isset( $settings[ $var ] ) ) {
309
+			if ( ! isset( $settings[$var] ) ) {
310 310
 				continue;
311 311
 			}
312
-			if ( ! isset( $defaults[ $var ] ) ) {
313
-				$defaults[ $var ] = '';
312
+			if ( ! isset( $defaults[$var] ) ) {
313
+				$defaults[$var] = '';
314 314
 			}
315
-			$show = empty( $defaults ) || ( $settings[ $var ] !== '' && $settings[ $var ] !== $defaults[ $var ] );
315
+			$show = empty( $defaults ) || ( $settings[$var] !== '' && $settings[$var] !== $defaults[$var] );
316 316
 			if ( $show ) {
317
-				echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[ $var ] ) : esc_html( $settings[ $var ] ) ) . ';'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
317
+				echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[$var] ) : esc_html( $settings[$var] ) ) . ';'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
318 318
 			}
319 319
 		}
320 320
 	}
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
 
364 364
 		$checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' );
365 365
 		foreach ( $checkbox_opts as $opt ) {
366
-			if ( ! isset( $settings[ $opt ] ) ) {
367
-				$settings[ $opt ] = 0;
366
+			if ( ! isset( $settings[$opt] ) ) {
367
+				$settings[$opt] = 0;
368 368
 			}
369 369
 		}
370 370
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 				$css = '';
393 393
 			}
394 394
 			foreach ( $opts as $opt ) {
395
-				self::get_color_output( $css, $settings[ $opt ] );
395
+				self::get_color_output( $css, $settings[$opt] );
396 396
 			}
397 397
 		}
398 398
 	}
Please login to merge, or discard this patch.
classes/helpers/FrmStylesPreviewHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@
 block discarded – undo
168 168
 			return;
169 169
 		}
170 170
 
171
-		unset( $dependencies[ $index ] );
171
+		unset( $dependencies[$index] );
172 172
 		$dependencies = array_values( $dependencies );
173 173
 
174 174
 		$styles->registered['wp-admin']->deps = $dependencies;
Please login to merge, or discard this patch.
classes/helpers/FrmStylesCardHelper.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -349,12 +349,12 @@
 block discarded – undo
349 349
 		array_walk(
350 350
 			$styles,
351 351
 			/**
352
-			* Echo a style card for a single style in the $styles array.
353
-			*
354
-			* @param WP_Post $style
355
-			* @param int     $count Used for pagination.
356
-			* @return void
357
-			*/
352
+			 * Echo a style card for a single style in the $styles array.
353
+			 *
354
+			 * @param WP_Post $style
355
+			 * @param int     $count Used for pagination.
356
+			 * @return void
357
+			 */
358 358
 			function( $style ) use ( &$count ) {
359 359
 				$hidden = $count > ( self::PAGE_SIZE - 1 );
360 360
 				$this->echo_style_card( $style, $hidden );
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 	private static function has_dark_background( $style ) {
131 131
 		$key = 'fieldset_bg_color';
132 132
 
133
-		if ( empty( $style->post_content[ $key ] ) ) {
133
+		if ( empty( $style->post_content[$key] ) ) {
134 134
 			return false;
135 135
 		}
136 136
 
137
-		$color = $style->post_content[ $key ];
137
+		$color = $style->post_content[$key];
138 138
 
139 139
 		if ( 0 === strpos( $color, 'rgba' ) ) {
140 140
 			preg_match_all( '/([\\d.]+)/', $color, $matches );
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 					),
205 205
 					'/style-templates/' . $style['slug']
206 206
 				);
207
-				$params['data-requires']    = FrmFormsHelper::get_plan_required( $style );
207
+				$params['data-requires'] = FrmFormsHelper::get_plan_required( $style );
208 208
 				return $params;
209 209
 			};
210 210
 		} else {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 				continue;
266 266
 			}
267 267
 
268
-			$value = $style->post_content[ $key ];
268
+			$value = $style->post_content[$key];
269 269
 
270 270
 			$is_hex = in_array( $key, $color_settings, true ) && $value && '#' !== $value[0] && false === strpos( $value, 'rgb' ) && $value !== 'transparent';
271 271
 			if ( $is_hex ) {
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 			function( $style ) use ( &$count ) {
414 414
 				$hidden = $count > ( self::PAGE_SIZE - 1 );
415 415
 				$this->echo_style_card( $style, $hidden );
416
-				++$count;
416
+				++ $count;
417 417
 			}
418 418
 		);
419 419
 
Please login to merge, or discard this patch.
classes/models/FrmStyleApi.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 		// Remove 'Styling Template' from titles.
51 51
 		foreach ( $api_info as $id => $template ) {
52 52
 			if ( isset( $template['name'] ) ) {
53
-				$api_info[ $id ]['name'] = preg_replace( '/(\sStyle|Styling)?(\sTemplate)?$/', '', $template['name'] );
53
+				$api_info[$id]['name'] = preg_replace( '/(\sStyle|Styling)?(\sTemplate)?$/', '', $template['name'] );
54 54
 			}
55 55
 		}
56 56
 
Please login to merge, or discard this patch.
classes/views/styles/_style-card.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 				'text-color'      => $style->post_content['text_color'],
41 41
 				'submit-bg-color' => $style->post_content['submit_bg_color'],
42 42
 			);
43
-			$index  = 0;
43
+			$index = 0;
44 44
 			foreach ( $colors as $css_var_name => $color ) {
45 45
 				if ( 0 !== strpos( $color, 'rgb' ) ) {
46 46
 					$color = '#' . $color;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 					'style' => 'background-color: var(--' . $css_var_name . ')',
52 52
 				);
53 53
 
54
-				++$index;
54
+				++ $index;
55 55
 				?>
56 56
 				<div <?php FrmAppHelper::array_to_html_params( $circle_params, true ); ?>></div>
57 57
 				<?php
Please login to merge, or discard this patch.
classes/models/FrmFormApi.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 			if ( isset( $addon['categories'] ) ) {
106 106
 				$cats = array_intersect( $this->skip_categories(), $addon['categories'] );
107 107
 				if ( ! empty( $cats ) ) {
108
-					unset( $addons[ $k ] );
108
+					unset( $addons[$k] );
109 109
 					continue;
110 110
 				}
111 111
 			}
112 112
 
113 113
 			if ( ! array_key_exists( 'is_new', $addon ) && array_key_exists( 'released', $addon ) ) {
114
-				$addons[ $k ]['is_new'] = $this->is_new( $addon );
114
+				$addons[$k]['is_new'] = $this->is_new( $addon );
115 115
 			}
116 116
 		}
117 117
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 					return $addon;
154 154
 				}
155 155
 			}
156
-		} elseif ( isset( $addons[ $download_id ] ) ) {
157
-			$plugin = $addons[ $download_id ];
156
+		} elseif ( isset( $addons[$download_id] ) ) {
157
+			$plugin = $addons[$download_id];
158 158
 		}
159 159
 
160 160
 		return $plugin;
Please login to merge, or discard this patch.