Completed
Pull Request — master (#1038)
by Stephanie
36s
created
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
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -84,21 +84,21 @@  discard block
 block discarded – undo
84 84
 			$default_settings = $this->get_defaults();
85 85
 
86 86
 			foreach ( $default_settings as $setting => $default ) {
87
-				if ( ! isset( $new_instance['post_content'][ $setting ] ) ) {
88
-					$new_instance['post_content'][ $setting ] = $default;
87
+				if ( ! isset( $new_instance['post_content'][$setting] ) ) {
88
+					$new_instance['post_content'][$setting] = $default;
89 89
 				}
90 90
 
91 91
 				if ( $this->is_color( $setting ) ) {
92
-					$color_val = $new_instance['post_content'][ $setting ];
92
+					$color_val = $new_instance['post_content'][$setting];
93 93
 					if ( $color_val !== '' && 0 === strpos( $color_val, 'rgb' ) ) {
94 94
 						// maybe sanitize if invalid rgba value is entered
95 95
 						$this->maybe_sanitize_rgba_value( $color_val );
96 96
 					}
97
-					$new_instance['post_content'][ $setting ] = str_replace( '#', '', $color_val );
98
-				} elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ), true ) && ! isset( $new_instance['post_content'][ $setting ] ) ) {
99
-					$new_instance['post_content'][ $setting ] = 0;
97
+					$new_instance['post_content'][$setting] = str_replace( '#', '', $color_val );
98
+				} elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ), true ) && ! isset( $new_instance['post_content'][$setting] ) ) {
99
+					$new_instance['post_content'][$setting] = 0;
100 100
 				} elseif ( $setting === 'font' ) {
101
-					$new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] );
101
+					$new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] );
102 102
 				}
103 103
 			}
104 104
 
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
 		$valid_keys         = array_keys( $defaults );
212 212
 		$sanitized_settings = array();
213 213
 		foreach ( $valid_keys as $key ) {
214
-			if ( isset( $settings[ $key ] ) ) {
215
-				$sanitized_settings[ $key ] = sanitize_textarea_field( $settings[ $key ] );
214
+			if ( isset( $settings[$key] ) ) {
215
+				$sanitized_settings[$key] = sanitize_textarea_field( $settings[$key] );
216 216
 			} else {
217
-				$sanitized_settings[ $key ] = $defaults[ $key ];
217
+				$sanitized_settings[$key] = $defaults[$key];
218 218
 			}
219 219
 		}
220 220
 		return $sanitized_settings;
@@ -381,13 +381,13 @@  discard block
 block discarded – undo
381 381
 			$style->post_content = $this->override_defaults( $style->post_content );
382 382
 			$style->post_content = wp_parse_args( $style->post_content, $default_values );
383 383
 
384
-			$styles[ $style->ID ] = $style;
384
+			$styles[$style->ID] = $style;
385 385
 		}
386 386
 
387 387
 		if ( ! $default_style ) {
388 388
 			$default_style = reset( $styles );
389 389
 
390
-			$styles[ $default_style->ID ]->menu_order = 1;
390
+			$styles[$default_style->ID]->menu_order = 1;
391 391
 		}
392 392
 
393 393
 		return $styles;
Please login to merge, or discard this patch.
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.
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
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 				'-' => 'down',
136 136
 				'+' => 'up',
137 137
 			);
138
-			$class = 'frm_arrow' . $arrow[ $icon ];
138
+			$class = 'frm_arrow' . $arrow[$icon];
139 139
 		} else {
140 140
 			//frm_minus1_icon
141 141
 			$key   = str_replace( 'p', '', $key );
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 				'-' => 'minus',
144 144
 				'+' => 'plus',
145 145
 			);
146
-			$class = 'frm_' . $plus[ $icon ];
146
+			$class = 'frm_' . $plus[$icon];
147 147
 		}
148 148
 
149 149
 		if ( $key ) {
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 		?>
170 170
 		<div class="btn-group" id="frm_<?php echo esc_attr( $name ); ?>_select">
171 171
 			<button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button">
172
-				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ); ?>
173
-				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ); ?>
172
+				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '+', $type ) ); ?>
173
+				<?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '-', $type ) ); ?>
174 174
 				<b class="caret"></b>
175 175
 			</button>
176 176
 			<ul class="multiselect-container frm-dropdown-menu">
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 					<li <?php echo ( $style->post_content['collapse_icon'] == $key ) ? 'class="active"' : ''; ?>>
179 179
 						<a href="javascript:void(0);">
180 180
 							<label>
181
-								<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 ); ?> />
181
+								<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 ); ?> />
182 182
 								<span>
183 183
 									<?php
184 184
 									FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '+', $type ) );
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
 		$vars   = array_diff( $vars, $remove );
272 272
 
273 273
 		foreach ( $vars as $var ) {
274
-			if ( ! isset( $settings[ $var ] ) ) {
274
+			if ( ! isset( $settings[$var] ) ) {
275 275
 				continue;
276 276
 			}
277
-			if ( ! isset( $defaults[ $var ] ) ) {
278
-				$defaults[ $var ] = '';
277
+			if ( ! isset( $defaults[$var] ) ) {
278
+				$defaults[$var] = '';
279 279
 			}
280
-			$show = empty( $defaults ) || ( $settings[ $var ] !== '' && $settings[ $var ] !== $defaults[ $var ] );
280
+			$show = empty( $defaults ) || ( $settings[$var] !== '' && $settings[$var] !== $defaults[$var] );
281 281
 			if ( $show ) {
282
-				echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[ $var ] ) : esc_html( $settings[ $var ] ) ) . ';'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
282
+				echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[$var] ) : esc_html( $settings[$var] ) ) . ';'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
283 283
 			}
284 284
 		}
285 285
 	}
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 
329 329
 		$checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' );
330 330
 		foreach ( $checkbox_opts as $opt ) {
331
-			if ( ! isset( $settings[ $opt ] ) ) {
332
-				$settings[ $opt ] = 0;
331
+			if ( ! isset( $settings[$opt] ) ) {
332
+				$settings[$opt] = 0;
333 333
 			}
334 334
 		}
335 335
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 				$css = '';
358 358
 			}
359 359
 			foreach ( $opts as $opt ) {
360
-				self::get_color_output( $css, $settings[ $opt ] );
360
+				self::get_color_output( $css, $settings[$opt] );
361 361
 			}
362 362
 		}
363 363
 	}
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   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 					),
197 197
 					'/style-templates/' . $style['slug'],
198 198
 				);
199
-				$params['data-requires']    = FrmFormsHelper::get_plan_required( $style );
199
+				$params['data-requires'] = FrmFormsHelper::get_plan_required( $style );
200 200
 				return $params;
201 201
 			};
202 202
 		} else {
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 				continue;
247 247
 			}
248 248
 
249
-			$value = $style->post_content[ $key ];
249
+			$value = $style->post_content[$key];
250 250
 
251 251
 			if ( in_array( $key, $color_settings, true ) && $value && '#' !== $value[0] && false === strpos( $value, 'rgb' ) ) {
252 252
 				$value = '#' . $value;
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
 				$hidden = $count > ( self::PAGE_SIZE - 1 );
377 377
 				if ( $this->echo_card_template( $style, $hidden ) ) {
378
-					++$count;
378
+					++ $count;
379 379
 				}
380 380
 			}
381 381
 		);
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 			function( $style ) use ( &$count ) {
403 403
 				$hidden = $count > ( self::PAGE_SIZE - 1 );
404 404
 				$this->echo_style_card( $style, $hidden );
405
-				++$count;
405
+				++ $count;
406 406
 			}
407 407
 		);
408 408
 
Please login to merge, or discard this patch.
classes/controllers/FrmFormsController.php 2 patches
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1697,7 +1697,8 @@  discard block
 block discarded – undo
1697 1697
 		$vars   = array();
1698 1698
 		FrmAppHelper::include_svg();
1699 1699
 
1700
-		if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1700
+		if ( isset( $_POST['frm_compact_fields'] ) ) {
1701
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
1701 1702
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
1702 1703
 
1703 1704
 			// Javascript needs to be allowed in some field settings.
@@ -2007,7 +2008,8 @@  discard block
 block discarded – undo
2007 2008
 	private static function maybe_get_form_to_show( $id ) {
2008 2009
 		$form = false;
2009 2010
 
2010
-		if ( ! empty( $id ) ) { // form id or key is set
2011
+		if ( ! empty( $id ) ) {
2012
+// form id or key is set
2011 2013
 			$form = FrmForm::getOne( $id );
2012 2014
 			if ( ! $form || $form->parent_form_id || $form->status === 'trash' ) {
2013 2015
 				$form = false;
@@ -2090,7 +2092,8 @@  discard block
 block discarded – undo
2090 2092
 	private static function get_saved_errors( $form, $params ) {
2091 2093
 		global $frm_vars;
2092 2094
 
2093
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2095
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) {
2096
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
2094 2097
 			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
2095 2098
 		} else {
2096 2099
 			$errors = array();
@@ -2243,7 +2246,8 @@  discard block
 block discarded – undo
2243 2246
 			}
2244 2247
 
2245 2248
 			if ( 'redirect' === FrmOnSubmitHelper::get_action_type( $action ) ) {
2246
-				if ( $has_redirect ) { // Do not process because we run the first redirect action only.
2249
+				if ( $has_redirect ) {
2250
+// Do not process because we run the first redirect action only.
2247 2251
 					continue;
2248 2252
 				}
2249 2253
 
@@ -2402,12 +2406,14 @@  discard block
 block discarded – undo
2402 2406
 
2403 2407
 		$doing_ajax = FrmAppHelper::doing_ajax();
2404 2408
 
2405
-		if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) { // Is AJAX submit and there is just one Redirect action runs.
2409
+		if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) {
2410
+// Is AJAX submit and there is just one Redirect action runs.
2406 2411
 			echo json_encode( array( 'redirect' => $success_url ) );
2407 2412
 			wp_die();
2408 2413
 		}
2409 2414
 
2410
-		if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { // Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2415
+		if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) {
2416
+// Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2411 2417
 			wp_redirect( esc_url_raw( $success_url ) );
2412 2418
 			die(); // do not use wp_die or redirect fails
2413 2419
 		}
@@ -2432,7 +2438,8 @@  discard block
 block discarded – undo
2432 2438
 
2433 2439
 		echo FrmAppHelper::maybe_kses( $redirect_msg ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2434 2440
 		echo '<script>';
2435
-		if ( empty( $args['doing_ajax'] ) ) { // Not AJAX submit, delay JS until window.load.
2441
+		if ( empty( $args['doing_ajax'] ) ) {
2442
+// Not AJAX submit, delay JS until window.load.
2436 2443
 			echo 'window.onload=function(){';
2437 2444
 		}
2438 2445
 		echo 'setTimeout(function(){window.location="' . esc_url_raw( $args['success_url'] ) . '";}, ' . intval( $delay_time ) . ');';
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -511,11 +511,11 @@  discard block
 block discarded – undo
511 511
 			),
512 512
 		);
513 513
 
514
-		if ( ! isset( $available_status[ $status ] ) ) {
514
+		if ( ! isset( $available_status[$status] ) ) {
515 515
 			return;
516 516
 		}
517 517
 
518
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
518
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
519 519
 
520 520
 		$params = FrmForm::list_page_params();
521 521
 
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 		check_admin_referer( $status . '_form_' . $params['id'] );
524 524
 
525 525
 		$count = 0;
526
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
526
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
527 527
 			$count ++;
528 528
 		}
529 529
 
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 		/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
541 541
 		$available_status['trash']['message']   = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type=' . $form_type . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
542 542
 
543
-		$message = $available_status[ $status ]['message'];
543
+		$message = $available_status[$status]['message'];
544 544
 
545 545
 		self::display_forms_list( $params, $message );
546 546
 	}
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 				'type'  => 'request',
562 562
 			)
563 563
 		);
564
-		$message      = sprintf(
564
+		$message = sprintf(
565 565
 			/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
566 566
 			_n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ),
567 567
 			$count,
@@ -1000,11 +1000,11 @@  discard block
 block discarded – undo
1000 1000
 			}
1001 1001
 
1002 1002
 			foreach ( $template['categories'] as $category ) {
1003
-				if ( ! isset( $templates_by_category[ $category ] ) ) {
1004
-					$templates_by_category[ $category ] = array();
1003
+				if ( ! isset( $templates_by_category[$category] ) ) {
1004
+					$templates_by_category[$category] = array();
1005 1005
 				}
1006 1006
 
1007
-				$templates_by_category[ $category ][] = $template;
1007
+				$templates_by_category[$category][] = $template;
1008 1008
 			}
1009 1009
 		}
1010 1010
 		unset( $template );
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 		$forms                    = FrmForm::get_published_forms( $where );
1034 1034
 		$view_path                = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/';
1035 1035
 
1036
-		$templates_by_category[ $my_templates_translation ] = $custom_templates;
1036
+		$templates_by_category[$my_templates_translation] = $custom_templates;
1037 1037
 
1038 1038
 		unset( $pricing, $license_type, $where );
1039 1039
 		wp_enqueue_script( 'accordion' ); // register accordion for template groups
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
 
1277 1277
 		foreach ( array( 'landing', 'chat' ) as $feature ) {
1278 1278
 			if ( ! FrmAppHelper::show_new_feature( $feature ) ) {
1279
-				unset( $sections[ $feature ] );
1279
+				unset( $sections[$feature] );
1280 1280
 			}
1281 1281
 		}
1282 1282
 
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
 				$section['id'] = $section['anchor'];
1310 1310
 			}
1311 1311
 
1312
-			$sections[ $key ] = $section;
1312
+			$sections[$key] = $section;
1313 1313
 		}
1314 1314
 
1315 1315
 		return $sections;
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
 		if ( ! empty( $user_fields ) ) {
1428 1428
 			$user_helpers = array();
1429 1429
 			foreach ( $user_fields as $uk => $uf ) {
1430
-				$user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
1430
+				$user_helpers['|user_id| show="' . $uk . '"'] = $uf;
1431 1431
 				unset( $uk, $uf );
1432 1432
 			}
1433 1433
 
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 		if ( ! isset( $frm_vars['js_validate_forms'] ) ) {
1560 1560
 			$frm_vars['js_validate_forms'] = array();
1561 1561
 		}
1562
-		$frm_vars['js_validate_forms'][ $form->id ] = $form;
1562
+		$frm_vars['js_validate_forms'][$form->id] = $form;
1563 1563
 	}
1564 1564
 
1565 1565
 	public static function get_email_html() {
@@ -1714,7 +1714,7 @@  discard block
 block discarded – undo
1714 1714
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1715 1715
 			} else {
1716 1716
 				$vars   = FrmAppHelper::json_to_array( $json_vars );
1717
-				$action = $vars[ $action ];
1717
+				$action = $vars[$action];
1718 1718
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1719 1719
 				$_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1720 1720
 				$_POST    = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
 		$actions = array();
1849 1849
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
1850 1850
 			if ( is_object( $form ) ) {
1851
-				$actions[ $form->id ] = $form->name;
1851
+				$actions[$form->id] = $form->name;
1852 1852
 			}
1853 1853
 			unset( $form );
1854 1854
 		}
@@ -2090,8 +2090,8 @@  discard block
 block discarded – undo
2090 2090
 	private static function get_saved_errors( $form, $params ) {
2091 2091
 		global $frm_vars;
2092 2092
 
2093
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2094
-			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
2093
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2094
+			$errors = $frm_vars['created_entries'][$form->id]['errors'];
2095 2095
 		} else {
2096 2096
 			$errors = array();
2097 2097
 		}
@@ -2113,7 +2113,7 @@  discard block
 block discarded – undo
2113 2113
 	public static function just_created_entry( $form_id ) {
2114 2114
 		global $frm_vars;
2115 2115
 
2116
-		return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form_id ] ) && isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) ? $frm_vars['created_entries'][ $form_id ]['entry_id'] : 0;
2116
+		return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form_id] ) && isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) ? $frm_vars['created_entries'][$form_id]['entry_id'] : 0;
2117 2117
 	}
2118 2118
 
2119 2119
 	/**
@@ -2137,7 +2137,7 @@  discard block
 block discarded – undo
2137 2137
 		}
2138 2138
 
2139 2139
 		$opt    = 'success_action';
2140
-		$method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message';
2140
+		$method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message';
2141 2141
 		$method = apply_filters( 'frm_success_filter', $method, $atts['form'], 'create' );
2142 2142
 
2143 2143
 		if ( $method != 'message' && ( ! $atts['entry_id'] || ! is_numeric( $atts['entry_id'] ) ) ) {
@@ -2150,7 +2150,7 @@  discard block
 block discarded – undo
2150 2150
 	public static function maybe_trigger_redirect( $form, $params, $args ) {
2151 2151
 		if ( ! isset( $params['id'] ) ) {
2152 2152
 			global $frm_vars;
2153
-			$params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
2153
+			$params['id'] = $frm_vars['created_entries'][$form->id]['entry_id'];
2154 2154
 		}
2155 2155
 
2156 2156
 		$conf_method = self::get_confirmation_method(
@@ -2209,7 +2209,7 @@  discard block
 block discarded – undo
2209 2209
 		$args['success_opt'] = $opt;
2210 2210
 		$args['ajax']        = ! empty( $frm_vars['ajax'] );
2211 2211
 
2212
-		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) {
2212
+		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) {
2213 2213
 			self::load_page_after_submit( $args );
2214 2214
 		} elseif ( $args['conf_method'] === 'redirect' ) {
2215 2215
 			self::redirect_after_submit( $args );
@@ -2351,7 +2351,7 @@  discard block
 block discarded – undo
2351 2351
 
2352 2352
 		$opt = 'update' === $args['action'] ? 'edit_' : 'success_';
2353 2353
 
2354
-		$new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ];
2354
+		$new_args['conf_method'] = $new_args['form']->options[$opt . 'action'];
2355 2355
 
2356 2356
 		/**
2357 2357
 		 * Filters the run success action args.
@@ -2371,8 +2371,8 @@  discard block
 block discarded – undo
2371 2371
 	private static function load_page_after_submit( $args ) {
2372 2372
 		global $post;
2373 2373
 		$opt = $args['success_opt'];
2374
-		if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
2375
-			$page     = get_post( $args['form']->options[ $opt . '_page_id' ] );
2374
+		if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) {
2375
+			$page     = get_post( $args['form']->options[$opt . '_page_id'] );
2376 2376
 			$old_post = $post;
2377 2377
 			$post     = $page;
2378 2378
 			$content  = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] );
@@ -2389,7 +2389,7 @@  discard block
 block discarded – undo
2389 2389
 		add_filter( 'frm_use_wpautop', '__return_false' );
2390 2390
 
2391 2391
 		$opt         = $args['success_opt'];
2392
-		$success_url = trim( $args['form']->options[ $opt . '_url' ] );
2392
+		$success_url = trim( $args['form']->options[$opt . '_url'] );
2393 2393
 		$success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] );
2394 2394
 		$success_url = do_shortcode( $success_url );
2395 2395
 
@@ -2561,7 +2561,7 @@  discard block
 block discarded – undo
2561 2561
 			'description' => false,
2562 2562
 			'reset'       => false,
2563 2563
 		);
2564
-		$args     = wp_parse_args( $args, $defaults );
2564
+		$args = wp_parse_args( $args, $defaults );
2565 2565
 	}
2566 2566
 
2567 2567
 	/**
@@ -2813,7 +2813,7 @@  discard block
 block discarded – undo
2813 2813
 
2814 2814
 		check_ajax_referer( 'frm_ajax', 'nonce' );
2815 2815
 
2816
-		$html             = FrmAppHelper::clip(
2816
+		$html = FrmAppHelper::clip(
2817 2817
 			function() {
2818 2818
 				FrmAppHelper::maybe_autocomplete_pages_options(
2819 2819
 					array(
@@ -2884,25 +2884,25 @@  discard block
 block discarded – undo
2884 2884
 	public static function populate_on_submit_data( &$form_options, $action = null, $event = 'create' ) {
2885 2885
 		$opt = 'update' === $event ? 'edit_' : 'success_';
2886 2886
 		if ( ! $action || ! is_object( $action ) ) {
2887
-			$form_options[ $opt . 'action' ] = FrmOnSubmitHelper::get_default_action_type();
2888
-			$form_options[ $opt . 'msg' ]    = FrmOnSubmitHelper::get_default_msg();
2887
+			$form_options[$opt . 'action'] = FrmOnSubmitHelper::get_default_action_type();
2888
+			$form_options[$opt . 'msg']    = FrmOnSubmitHelper::get_default_msg();
2889 2889
 			return;
2890 2890
 		}
2891 2891
 
2892
-		$form_options[ $opt . 'action' ] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message';
2892
+		$form_options[$opt . 'action'] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message';
2893 2893
 
2894
-		switch ( $form_options[ $opt . 'action' ] ) {
2894
+		switch ( $form_options[$opt . 'action'] ) {
2895 2895
 			case 'redirect':
2896
-				$form_options[ $opt . 'url' ] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : '';
2896
+				$form_options[$opt . 'url'] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : '';
2897 2897
 				break;
2898 2898
 
2899 2899
 			case 'page':
2900
-				$form_options[ $opt . 'page_id' ] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : '';
2900
+				$form_options[$opt . 'page_id'] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : '';
2901 2901
 				break;
2902 2902
 
2903 2903
 			default:
2904
-				$form_options[ $opt . 'msg' ] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : FrmOnSubmitHelper::get_default_msg();
2905
-				$form_options['show_form']   = ! empty( $action->post_content['show_form'] );
2904
+				$form_options[$opt . 'msg'] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : FrmOnSubmitHelper::get_default_msg();
2905
+				$form_options['show_form'] = ! empty( $action->post_content['show_form'] );
2906 2906
 		}
2907 2907
 	}
2908 2908
 
@@ -2980,20 +2980,20 @@  discard block
 block discarded – undo
2980 2980
 	private static function get_on_submit_action_data_from_form_options( $form_options, $event = 'create' ) {
2981 2981
 		$opt  = 'update' === $event ? 'edit_' : 'success_';
2982 2982
 		$data = array(
2983
-			'success_action' => $form_options[ $opt . 'action' ],
2983
+			'success_action' => $form_options[$opt . 'action'],
2984 2984
 		);
2985 2985
 
2986
-		switch ( $form_options[ $opt . 'action' ] ) {
2986
+		switch ( $form_options[$opt . 'action'] ) {
2987 2987
 			case 'redirect':
2988
-				$data['success_url'] = isset( $form_options[ $opt . 'url' ] ) ? $form_options[ $opt . 'url' ] : '';
2988
+				$data['success_url'] = isset( $form_options[$opt . 'url'] ) ? $form_options[$opt . 'url'] : '';
2989 2989
 				break;
2990 2990
 
2991 2991
 			case 'page':
2992
-				$data['success_page_id'] = isset( $form_options[ $opt . 'page_id' ] ) ? $form_options[ $opt . 'page_id' ] : '';
2992
+				$data['success_page_id'] = isset( $form_options[$opt . 'page_id'] ) ? $form_options[$opt . 'page_id'] : '';
2993 2993
 				break;
2994 2994
 
2995 2995
 			default:
2996
-				$data['success_msg'] = isset( $form_options[ $opt . 'msg' ] ) ? $form_options[ $opt . 'msg' ] : FrmOnSubmitHelper::get_default_msg();
2996
+				$data['success_msg'] = isset( $form_options[$opt . 'msg'] ) ? $form_options[$opt . 'msg'] : FrmOnSubmitHelper::get_default_msg();
2997 2997
 				$data['show_form']   = ! empty( $form_options['show_form'] );
2998 2998
 		}
2999 2999
 
@@ -3028,8 +3028,8 @@  discard block
 block discarded – undo
3028 3028
 		}
3029 3029
 
3030 3030
 		foreach ( $options as $name ) {
3031
-			if ( isset( $form->options[ $name ] ) ) {
3032
-				unset( $form->options[ $name ] );
3031
+			if ( isset( $form->options[$name] ) ) {
3032
+				unset( $form->options[$name] );
3033 3033
 			}
3034 3034
 		}
3035 3035
 
Please login to merge, or discard this patch.
classes/helpers/FrmAppHelper.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 			'fill'   => '#4d4d4d',
163 163
 			'orange' => '#f05a24',
164 164
 		);
165
-		$atts     = array_merge( $defaults, $atts );
165
+		$atts = array_merge( $defaults, $atts );
166 166
 
167 167
 		return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 599.68 601.37" width="' . esc_attr( $atts['width'] ) . '" height="' . esc_attr( $atts['height'] ) . '">
168 168
 			<path fill="' . esc_attr( $atts['orange'] ) . '" d="M289.6 384h140v76h-140z"/>
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 	 * @return string
370 370
 	 */
371 371
 	public static function get_server_value( $value ) {
372
-		return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : '';
372
+		return isset( $_SERVER[$value] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[$value] ) ) : '';
373 373
 	}
374 374
 
375 375
 	/**
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 		);
393 393
 		$ip = '';
394 394
 		foreach ( $ip_options as $key ) {
395
-			if ( ! isset( $_SERVER[ $key ] ) ) {
395
+			if ( ! isset( $_SERVER[$key] ) ) {
396 396
 				continue;
397 397
 			}
398 398
 
@@ -416,10 +416,10 @@  discard block
 block discarded – undo
416 416
 		}
417 417
 
418 418
 		if ( $src === 'get' ) {
419
-			$value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
420
-			if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
419
+			$value = isset( $_POST[$param] ) ? wp_unslash( $_POST[$param] ) : ( isset( $_GET[$param] ) ? wp_unslash( $_GET[$param] ) : $default ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
420
+			if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
421 421
 				// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
422
-				$value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) );
422
+				$value = htmlspecialchars_decode( wp_unslash( $_GET[$param] ) );
423 423
 			}
424 424
 			self::sanitize_value( $sanitize, $value );
425 425
 		} else {
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 				}
441 441
 
442 442
 				$p     = trim( $p, ']' );
443
-				$value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
443
+				$value = isset( $value[$p] ) ? $value[$p] : $default;
444 444
 			}
445 445
 		}
446 446
 
@@ -496,26 +496,26 @@  discard block
 block discarded – undo
496 496
 			'sanitize' => 'sanitize_text_field',
497 497
 			'serialized' => false,
498 498
 		);
499
-		$args     = wp_parse_args( $args, $defaults );
499
+		$args = wp_parse_args( $args, $defaults );
500 500
 
501 501
 		$value = $args['default'];
502 502
 		if ( $args['type'] == 'get' ) {
503
-			if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
503
+			if ( $_GET && isset( $_GET[$args['param']] ) ) {
504 504
 				// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
505
-				$value = wp_unslash( $_GET[ $args['param'] ] );
505
+				$value = wp_unslash( $_GET[$args['param']] );
506 506
 			}
507 507
 		} elseif ( $args['type'] == 'post' ) {
508
-			if ( isset( $_POST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
508
+			if ( isset( $_POST[$args['param']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
509 509
 				// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
510
-				$value = wp_unslash( $_POST[ $args['param'] ] );
510
+				$value = wp_unslash( $_POST[$args['param']] );
511 511
 				if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) {
512 512
 					self::unserialize_or_decode( $value );
513 513
 				}
514 514
 			}
515 515
 		} else {
516
-			if ( isset( $_REQUEST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
516
+			if ( isset( $_REQUEST[$args['param']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
517 517
 				// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
518
-				$value = wp_unslash( $_REQUEST[ $args['param'] ] );
518
+				$value = wp_unslash( $_REQUEST[$args['param']] );
519 519
 			}
520 520
 		}
521 521
 
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 			if ( is_array( $value ) ) {
548 548
 				$temp_values = $value;
549 549
 				foreach ( $temp_values as $k => $v ) {
550
-					self::sanitize_value( $sanitize, $value[ $k ] );
550
+					self::sanitize_value( $sanitize, $value[$k] );
551 551
 				}
552 552
 			} else {
553 553
 				$value = call_user_func( $sanitize, $value );
@@ -558,8 +558,8 @@  discard block
 block discarded – undo
558 558
 	public static function sanitize_request( $sanitize_method, &$values ) {
559 559
 		$temp_values = $values;
560 560
 		foreach ( $temp_values as $k => $val ) {
561
-			if ( isset( $sanitize_method[ $k ] ) ) {
562
-				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
561
+			if ( isset( $sanitize_method[$k] ) ) {
562
+				$values[$k] = call_user_func( $sanitize_method[$k], $val );
563 563
 			}
564 564
 		}
565 565
 	}
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 		if ( is_array( $value ) ) {
583 583
 			$temp_values = $value;
584 584
 			foreach ( $temp_values as $k => $v ) {
585
-				self::decode_specialchars( $value[ $k ] );
585
+				self::decode_specialchars( $value[$k] );
586 586
 			}
587 587
 		} else {
588 588
 			self::decode_amp( $value );
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	 * @return array
703 703
 	 */
704 704
 	public static function add_allowed_submit_button_tags( $allowed_html ) {
705
-		$allowed_html['input']                    = array(
705
+		$allowed_html['input'] = array(
706 706
 			'type'           => true,
707 707
 			'value'          => true,
708 708
 			'formnovalidate' => true,
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 			$allowed_html = $html;
726 726
 		} elseif ( ! empty( $allowed ) ) {
727 727
 			foreach ( (array) $allowed as $a ) {
728
-				$allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array();
728
+				$allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array();
729 729
 			}
730 730
 		}
731 731
 
@@ -904,8 +904,8 @@  discard block
 block discarded – undo
904 904
 		}
905 905
 
906 906
 		global $wp_query;
907
-		if ( isset( $wp_query->query_vars[ $param ] ) ) {
908
-			$value = $wp_query->query_vars[ $param ];
907
+		if ( isset( $wp_query->query_vars[$param] ) ) {
908
+			$value = $wp_query->query_vars[$param];
909 909
 		}
910 910
 
911 911
 		return $value;
@@ -932,9 +932,9 @@  discard block
 block discarded – undo
932 932
 		$deprecated = array(
933 933
 			'frm_clone_solid_icon' => 'frm_clone_icon',
934 934
 		);
935
-		if ( isset( $deprecated[ $icon ] ) ) {
936
-			$icon = $deprecated[ $icon ];
937
-			$class = str_replace( $icon, $deprecated[ $icon ], $class );
935
+		if ( isset( $deprecated[$icon] ) ) {
936
+			$icon = $deprecated[$icon];
937
+			$class = str_replace( $icon, $deprecated[$icon], $class );
938 938
 		}
939 939
 
940 940
 		if ( $icon === $class ) {
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 				'new_file_path' => self::plugin_path() . '/js',
1256 1256
 			)
1257 1257
 		);
1258
-		$new_file  = new FrmCreateFile( $file_atts );
1258
+		$new_file = new FrmCreateFile( $file_atts );
1259 1259
 
1260 1260
 		$files = array(
1261 1261
 			self::plugin_path() . '/js/formidable.min.js',
@@ -1717,8 +1717,8 @@  discard block
 block discarded – undo
1717 1717
 			return $error;
1718 1718
 		}
1719 1719
 
1720
-		$nonce_value = ( $_REQUEST && isset( $_REQUEST[ $nonce_name ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $nonce_name ] ) ) : '';
1721
-		if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) {
1720
+		$nonce_value = ( $_REQUEST && isset( $_REQUEST[$nonce_name] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[$nonce_name] ) ) : '';
1721
+		if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) {
1722 1722
 			$frm_settings = self::get_settings();
1723 1723
 			$error        = $frm_settings->admin_permission;
1724 1724
 		}
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
 			} else {
1754 1754
 				foreach ( $value as $k => $v ) {
1755 1755
 					if ( ! is_array( $v ) ) {
1756
-						$value[ $k ] = call_user_func( $original_function, $v );
1756
+						$value[$k] = call_user_func( $original_function, $v );
1757 1757
 					}
1758 1758
 				}
1759 1759
 			}
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
1779 1779
 			} else {
1780 1780
 				if ( $keys == 'keep' ) {
1781
-					$return[ $key ] = $value;
1781
+					$return[$key] = $value;
1782 1782
 				} else {
1783 1783
 					$return[] = $value;
1784 1784
 				}
@@ -1831,11 +1831,11 @@  discard block
 block discarded – undo
1831 1831
 		}
1832 1832
 
1833 1833
 		$ver = $default;
1834
-		if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
1834
+		if ( ! isset( $wp_scripts->registered[$handle] ) ) {
1835 1835
 			return $ver;
1836 1836
 		}
1837 1837
 
1838
-		$query = $wp_scripts->registered[ $handle ];
1838
+		$query = $wp_scripts->registered[$handle];
1839 1839
 		if ( is_object( $query ) && ! empty( $query->ver ) ) {
1840 1840
 			$ver = $query->ver;
1841 1841
 		}
@@ -1941,7 +1941,7 @@  discard block
 block discarded – undo
1941 1941
 			$suffix = 2;
1942 1942
 			do {
1943 1943
 				$key_check = $key . $separator . $suffix;
1944
-				++$suffix;
1944
+				++ $suffix;
1945 1945
 			} while ( in_array( $key_check, $similar_keys, true ) );
1946 1946
 
1947 1947
 			$key = $key_check;
@@ -2042,7 +2042,7 @@  discard block
 block discarded – undo
2042 2042
 
2043 2043
 		foreach ( array( 'name', 'description' ) as $var ) {
2044 2044
 			$default_val    = isset( $record->{$var} ) ? $record->{$var} : '';
2045
-			$values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
2045
+			$values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' );
2046 2046
 			unset( $var, $default_val );
2047 2047
 		}
2048 2048
 
@@ -2100,9 +2100,9 @@  discard block
 block discarded – undo
2100 2100
 			}
2101 2101
 		}
2102 2102
 
2103
-		$field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type;
2104
-		if ( isset( $post_values['item_meta'][ $field->id ] ) ) {
2105
-			$new_value = $post_values['item_meta'][ $field->id ];
2103
+		$field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type;
2104
+		if ( isset( $post_values['item_meta'][$field->id] ) ) {
2105
+			$new_value = $post_values['item_meta'][$field->id];
2106 2106
 			self::unserialize_or_decode( $new_value );
2107 2107
 		} else {
2108 2108
 			$new_value = $meta_value;
@@ -2123,7 +2123,7 @@  discard block
 block discarded – undo
2123 2123
 
2124 2124
 		$field_array = array_merge( (array) $field->field_options, $field_array );
2125 2125
 
2126
-		$values['fields'][ $field->id ] = $field_array;
2126
+		$values['fields'][$field->id] = $field_array;
2127 2127
 	}
2128 2128
 
2129 2129
 	/**
@@ -2170,11 +2170,11 @@  discard block
 block discarded – undo
2170 2170
 		}
2171 2171
 
2172 2172
 		foreach ( $form->options as $opt => $value ) {
2173
-			if ( isset( $post_values[ $opt ] ) ) {
2174
-				$values[ $opt ] = $post_values[ $opt ];
2175
-				self::unserialize_or_decode( $values[ $opt ] );
2173
+			if ( isset( $post_values[$opt] ) ) {
2174
+				$values[$opt] = $post_values[$opt];
2175
+				self::unserialize_or_decode( $values[$opt] );
2176 2176
 			} else {
2177
-				$values[ $opt ] = $value;
2177
+				$values[$opt] = $value;
2178 2178
 			}
2179 2179
 		}
2180 2180
 
@@ -2188,8 +2188,8 @@  discard block
 block discarded – undo
2188 2188
 		$form_defaults = FrmFormsHelper::get_default_opts();
2189 2189
 
2190 2190
 		foreach ( $form_defaults as $opt => $default ) {
2191
-			if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
2192
-				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
2191
+			if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) {
2192
+				$values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default;
2193 2193
 			}
2194 2194
 
2195 2195
 			unset( $opt, $default );
@@ -2200,8 +2200,8 @@  discard block
 block discarded – undo
2200 2200
 		}
2201 2201
 
2202 2202
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
2203
-			if ( ! isset( $values[ $h . '_html' ] ) ) {
2204
-				$values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
2203
+			if ( ! isset( $values[$h . '_html'] ) ) {
2204
+				$values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) );
2205 2205
 			}
2206 2206
 			unset( $h );
2207 2207
 		}
@@ -2353,25 +2353,25 @@  discard block
 block discarded – undo
2353 2353
 		if ( ! is_numeric( $levels ) ) {
2354 2354
 			// Show time in specified unit.
2355 2355
 			$levels = self::get_unit( $levels );
2356
-			if ( isset( $time_strings[ $levels ] ) ) {
2356
+			if ( isset( $time_strings[$levels] ) ) {
2357 2357
 				$diff = array(
2358 2358
 					$levels => self::time_format( $levels, $diff ),
2359 2359
 				);
2360 2360
 				$time_strings = array(
2361
-					$levels => $time_strings[ $levels ],
2361
+					$levels => $time_strings[$levels],
2362 2362
 				);
2363 2363
 			}
2364 2364
 			$levels = 1;
2365 2365
 		}
2366 2366
 
2367 2367
 		foreach ( $time_strings as $k => $v ) {
2368
-			if ( isset( $diff[ $k ] ) && $diff[ $k ] ) {
2369
-				$time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] );
2370
-			} elseif ( isset( $diff[ $k ] ) && count( $time_strings ) === 1 ) {
2368
+			if ( isset( $diff[$k] ) && $diff[$k] ) {
2369
+				$time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] );
2370
+			} elseif ( isset( $diff[$k] ) && count( $time_strings ) === 1 ) {
2371 2371
 				// Account for 0.
2372
-				$time_strings[ $k ] = $diff[ $k ] . ' ' . $v[1];
2372
+				$time_strings[$k] = $diff[$k] . ' ' . $v[1];
2373 2373
 			} else {
2374
-				unset( $time_strings[ $k ] );
2374
+				unset( $time_strings[$k] );
2375 2375
 			}
2376 2376
 		}
2377 2377
 
@@ -2390,8 +2390,8 @@  discard block
 block discarded – undo
2390 2390
 			'y' => 'y',
2391 2391
 			'd' => 'days',
2392 2392
 		);
2393
-		if ( isset( $return[ $unit ] ) ) {
2394
-			return $diff[ $return[ $unit ] ];
2393
+		if ( isset( $return[$unit] ) ) {
2394
+			return $diff[$return[$unit]];
2395 2395
 		}
2396 2396
 
2397 2397
 		$total = $diff['days'] * self::convert_time( 'd', $unit );
@@ -2399,11 +2399,11 @@  discard block
 block discarded – undo
2399 2399
 		$times = array( 'h', 'i', 's' );
2400 2400
 
2401 2401
 		foreach ( $times as $time ) {
2402
-			if ( ! isset( $diff[ $time ] ) ) {
2402
+			if ( ! isset( $diff[$time] ) ) {
2403 2403
 				continue;
2404 2404
 			}
2405 2405
 
2406
-			$total += $diff[ $time ] * self::convert_time( $time, $unit );
2406
+			$total += $diff[$time] * self::convert_time( $time, $unit );
2407 2407
 		}
2408 2408
 
2409 2409
 		return floor( $total );
@@ -2423,7 +2423,7 @@  discard block
 block discarded – undo
2423 2423
 			'y' => DAY_IN_SECONDS * 365.25,
2424 2424
 		);
2425 2425
 
2426
-		return $convert[ $from ] / $convert[ $to ];
2426
+		return $convert[$from] / $convert[$to];
2427 2427
 	}
2428 2428
 
2429 2429
 	/**
@@ -2431,7 +2431,7 @@  discard block
 block discarded – undo
2431 2431
 	 */
2432 2432
 	private static function get_unit( $unit ) {
2433 2433
 		$units = self::get_time_strings();
2434
-		if ( isset( $units[ $unit ] ) || is_numeric( $unit ) ) {
2434
+		if ( isset( $units[$unit] ) || is_numeric( $unit ) ) {
2435 2435
 			return $unit;
2436 2436
 		}
2437 2437
 
@@ -2542,17 +2542,17 @@  discard block
 block discarded – undo
2542 2542
 
2543 2543
 					case 1:
2544 2544
 						$l2 = $name;
2545
-						self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
2545
+						self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] );
2546 2546
 						break;
2547 2547
 
2548 2548
 					case 2:
2549 2549
 						$l3 = $name;
2550
-						self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
2550
+						self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] );
2551 2551
 						break;
2552 2552
 
2553 2553
 					case 3:
2554 2554
 						$l4 = $name;
2555
-						self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
2555
+						self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] );
2556 2556
 				}
2557 2557
 
2558 2558
 				unset( $this_val, $n );
@@ -2571,8 +2571,8 @@  discard block
 block discarded – undo
2571 2571
 	public static function add_value_to_array( $name, $l1, $val, &$vars ) {
2572 2572
 		if ( $name == '' ) {
2573 2573
 			$vars[] = $val;
2574
-		} elseif ( ! isset( $vars[ $l1 ] ) ) {
2575
-			$vars[ $l1 ] = $val;
2574
+		} elseif ( ! isset( $vars[$l1] ) ) {
2575
+			$vars[$l1] = $val;
2576 2576
 		}
2577 2577
 	}
2578 2578
 
@@ -2588,7 +2588,7 @@  discard block
 block discarded – undo
2588 2588
 			'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
2589 2589
 		);
2590 2590
 
2591
-		if ( ! isset( $tooltips[ $name ] ) ) {
2591
+		if ( ! isset( $tooltips[$name] ) ) {
2592 2592
 			return;
2593 2593
 		}
2594 2594
 
@@ -2598,7 +2598,7 @@  discard block
 block discarded – undo
2598 2598
 			echo ' class="frm_help"';
2599 2599
 		}
2600 2600
 
2601
-		echo ' title="' . esc_attr( $tooltips[ $name ] );
2601
+		echo ' title="' . esc_attr( $tooltips[$name] );
2602 2602
 
2603 2603
 		if ( 'open' != $class ) {
2604 2604
 			echo '"';
@@ -2657,13 +2657,13 @@  discard block
 block discarded – undo
2657 2657
 	}
2658 2658
 
2659 2659
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
2660
-		if ( ! isset( $post_content[ $key ] ) || is_numeric( $val ) ) {
2660
+		if ( ! isset( $post_content[$key] ) || is_numeric( $val ) ) {
2661 2661
 			return;
2662 2662
 		}
2663 2663
 
2664 2664
 		if ( is_array( $val ) ) {
2665 2665
 			foreach ( $val as $k1 => $v1 ) {
2666
-				self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] );
2666
+				self::prepare_action_slashes( $v1, $k1, $post_content[$key] );
2667 2667
 				unset( $k1, $v1 );
2668 2668
 			}
2669 2669
 		} else {
@@ -2671,7 +2671,7 @@  discard block
 block discarded – undo
2671 2671
 			$val = stripslashes( $val );
2672 2672
 
2673 2673
 			// Add backslashes before double quotes and forward slashes only
2674
-			$post_content[ $key ] = addcslashes( $val, '"\\/' );
2674
+			$post_content[$key] = addcslashes( $val, '"\\/' );
2675 2675
 		}
2676 2676
 	}
2677 2677
 
@@ -2734,14 +2734,14 @@  discard block
 block discarded – undo
2734 2734
 				continue;
2735 2735
 			}
2736 2736
 			$key = $input['name'];
2737
-			if ( isset( $formatted[ $key ] ) ) {
2738
-				if ( is_array( $formatted[ $key ] ) ) {
2739
-					$formatted[ $key ][] = $input['value'];
2737
+			if ( isset( $formatted[$key] ) ) {
2738
+				if ( is_array( $formatted[$key] ) ) {
2739
+					$formatted[$key][] = $input['value'];
2740 2740
 				} else {
2741
-					$formatted[ $key ] = array( $formatted[ $key ], $input['value'] );
2741
+					$formatted[$key] = array( $formatted[$key], $input['value'] );
2742 2742
 				}
2743 2743
 			} else {
2744
-				$formatted[ $key ] = $input['value'];
2744
+				$formatted[$key] = $input['value'];
2745 2745
 			}
2746 2746
 		}
2747 2747
 
@@ -3403,8 +3403,8 @@  discard block
 block discarded – undo
3403 3403
 		}
3404 3404
 
3405 3405
 		foreach ( $keys as $key ) {
3406
-			if ( isset( $values[ $key ] ) ) {
3407
-				$values[ $key ] = self::kses( $values[ $key ], 'all' );
3406
+			if ( isset( $values[$key] ) ) {
3407
+				$values[$key] = self::kses( $values[$key], 'all' );
3408 3408
 			}
3409 3409
 		}
3410 3410
 
@@ -3563,7 +3563,7 @@  discard block
 block discarded – undo
3563 3563
 			return 0;
3564 3564
 		}
3565 3565
 
3566
-		return strlen( $parts[ count( $parts ) - 1 ] );
3566
+		return strlen( $parts[count( $parts ) - 1] );
3567 3567
 	}
3568 3568
 
3569 3569
 	/**
Please login to merge, or discard this patch.
classes/views/styles/_style-card.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 				$style->post_content['text_color'],
40 40
 				$style->post_content['submit_bg_color'],
41 41
 			);
42
-			foreach( $colors as $index => $color ) {
42
+			foreach ( $colors as $index => $color ) {
43 43
 				if ( 0 !== strpos( $color, 'rgb' ) ) {
44 44
 					$color = '#' . $color;
45 45
 				}
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.