Completed
Pull Request — master (#1842)
by Viktor
35s
created
classes/views/frm-forms/form.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
 			$grid_helper     = new FrmFieldGridHelper();
53 53
 			$values['count'] = 0;
54 54
 			foreach ( $values['fields'] as $field ) {
55
-				++$values['count'];
55
+				++ $values['count'];
56 56
 				$grid_helper->set_field( $field );
57 57
 				$grid_helper->maybe_begin_field_wrapper();
58 58
 				FrmFieldsController::load_single_field( $field, $values );
Please login to merge, or discard this patch.
classes/controllers/FrmFormTemplatesController.php 1 patch
Spacing   +12 added lines, -14 removed lines patch added patch discarded remove patch
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
 
329 329
 		// Perform add or remove operation.
330 330
 		if ( 'add' === $operation ) {
331
-			self::$favorite_templates[ $key ][] = $template_id;
331
+			self::$favorite_templates[$key][] = $template_id;
332 332
 		} elseif ( 'remove' === $operation ) {
333
-			$position = array_search( $template_id, self::$favorite_templates[ $key ], true );
333
+			$position = array_search( $template_id, self::$favorite_templates[$key], true );
334 334
 			if ( $position !== false ) {
335
-				unset( self::$favorite_templates[ $key ][ $position ] );
335
+				unset( self::$favorite_templates[$key][$position] );
336 336
 			}
337 337
 		}
338 338
 
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 		foreach ( self::$templates as $key => &$template ) {
462 462
 			// Skip the template if the categories are not set.
463 463
 			if ( ! isset( $template['categories'] ) ) {
464
-				unset( self::$templates[ $key ] );
464
+				unset( self::$templates[$key] );
465 465
 				continue;
466 466
 			}
467 467
 
@@ -475,14 +475,12 @@  discard block
 block discarded – undo
475 475
 				// Add the slug to the new array.
476 476
 				$template['category_slugs'][] = $category_slug;
477 477
 
478
-				if ( ! isset( self::$categories[ $category_slug ] ) ) {
479
-					self::$categories[ $category_slug ] = array(
478
+				if ( ! isset( self::$categories[$category_slug] ) ) {
479
+					self::$categories[$category_slug] = array(
480 480
 						'name'  => $category,
481 481
 						'count' => 0,
482 482
 					);
483
-				}
484
-
485
-				++self::$categories[ $category_slug ]['count'];
483
+				} ++self::$categories[$category_slug]['count'];
486 484
 			}
487 485
 
488 486
 			// Mark the template as favorite if it's in the favorite templates list.
@@ -497,7 +495,7 @@  discard block
 block discarded – undo
497 495
 		$redundant_cats = array_merge( array( 'PayPal', 'Stripe', 'Twilio' ), FrmFormsHelper::ignore_template_categories() );
498 496
 		foreach ( $redundant_cats as $redundant_cat ) {
499 497
 			$category_slug = sanitize_title( $redundant_cat );
500
-			unset( self::$categories[ $category_slug ] );
498
+			unset( self::$categories[$category_slug] );
501 499
 		}
502 500
 
503 501
 		// Sort the categories by keys alphabetically.
@@ -522,7 +520,7 @@  discard block
 block discarded – undo
522 520
 				'count' => 0,
523 521
 			);
524 522
 		}
525
-		$special_categories['all-templates']  = array(
523
+		$special_categories['all-templates'] = array(
526 524
 			'name'  => __( 'All Templates', 'formidable' ),
527 525
 			'count' => self::get_template_count(),
528 526
 		);
@@ -550,9 +548,9 @@  discard block
 block discarded – undo
550 548
 	 */
551 549
 	private static function assign_featured_templates() {
552 550
 		foreach ( self::FEATURED_TEMPLATES_KEYS as $key ) {
553
-			if ( isset( self::$templates[ $key ] ) ) {
554
-				self::$templates[ $key ]['is_featured'] = true;
555
-				self::$featured_templates[]             = self::$templates[ $key ];
551
+			if ( isset( self::$templates[$key] ) ) {
552
+				self::$templates[$key]['is_featured'] = true;
553
+				self::$featured_templates[]             = self::$templates[$key];
556 554
 			}
557 555
 		}
558 556
 	}
Please login to merge, or discard this patch.
classes/controllers/FrmAddonsController.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			unset( $addons['error'] );
60 60
 		}
61 61
 
62
-		$pro    = array(
62
+		$pro = array(
63 63
 			'pro' => array(
64 64
 				'title'    => 'Formidable Forms Pro',
65 65
 				'slug'     => 'formidable-pro',
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		} else {
105 105
 			foreach ( $addons as $k => $addon ) {
106 106
 				if ( empty( $addon['excerpt'] ) && $k !== 'error' ) {
107
-					unset( $addons[ $k ] );
107
+					unset( $addons[$k] );
108 108
 				}
109 109
 			}
110 110
 		}
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
 		foreach ( $list as $k => $info ) {
220 220
 			$info['slug'] = $k;
221
-			$list[ $k ]   = array_merge( $defaults, $info );
221
+			$list[$k]   = array_merge( $defaults, $info );
222 222
 		}
223 223
 		return $list;
224 224
 	}
@@ -382,17 +382,17 @@  discard block
 block discarded – undo
382 382
 				continue;
383 383
 			}
384 384
 
385
-			$wp_plugin    = isset( $wp_plugins[ $folder ] ) ? $wp_plugins[ $folder ] : array();
385
+			$wp_plugin    = isset( $wp_plugins[$folder] ) ? $wp_plugins[$folder] : array();
386 386
 			$wp_version   = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0';
387 387
 			$plugin->slug = explode( '/', $folder )[0];
388 388
 
389 389
 			if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) {
390
-				$transient->response[ $folder ] = $plugin;
390
+				$transient->response[$folder] = $plugin;
391 391
 			} else {
392
-				$transient->no_update[ $folder ] = $plugin;
392
+				$transient->no_update[$folder] = $plugin;
393 393
 			}
394 394
 
395
-			$transient->checked[ $folder ] = $wp_version;
395
+			$transient->checked[$folder] = $wp_version;
396 396
 
397 397
 		}//end foreach
398 398
 
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 	 */
426 426
 	protected static function is_installed( $plugin ) {
427 427
 		$all_plugins = self::get_plugins();
428
-		return isset( $all_plugins[ $plugin ] );
428
+		return isset( $all_plugins[$plugin] );
429 429
 	}
430 430
 
431 431
 	/**
@@ -464,13 +464,13 @@  discard block
 block discarded – undo
464 464
 			}
465 465
 
466 466
 			$download_id = isset( $plugin['id'] ) ? $plugin['id'] : 0;
467
-			if ( ! empty( $download_id ) && ! isset( $version_info[ $download_id ]['package'] ) ) {
467
+			if ( ! empty( $download_id ) && ! isset( $version_info[$download_id]['package'] ) ) {
468 468
 				// if this addon is using its own license, get the update url
469 469
 				$addon_info = $api->get_api_info();
470 470
 
471
-				$version_info[ $download_id ] = $addon_info[ $download_id ];
471
+				$version_info[$download_id] = $addon_info[$download_id];
472 472
 				if ( isset( $addon_info['error'] ) ) {
473
-					$version_info[ $download_id ]['error'] = array(
473
+					$version_info[$download_id]['error'] = array(
474 474
 						'message' => $addon_info['error']['message'],
475 475
 						'code'    => $addon_info['error']['code'],
476 476
 					);
@@ -569,8 +569,8 @@  discard block
 block discarded – undo
569 569
 					return $addon;
570 570
 				}
571 571
 			}
572
-		} elseif ( isset( $addons[ $download_id ] ) ) {
573
-			$plugin = $addons[ $download_id ];
572
+		} elseif ( isset( $addons[$download_id] ) ) {
573
+			$plugin = $addons[$download_id];
574 574
 		}
575 575
 
576 576
 		return $plugin;
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 			self::prepare_addon_link( $addon['link'] );
635 635
 
636 636
 			self::set_addon_status( $addon );
637
-			$addons[ $id ] = $addon;
637
+			$addons[$id] = $addon;
638 638
 		}//end foreach
639 639
 	}
640 640
 
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 			'utm_medium'   => 'addons',
676 676
 			'utm_campaign' => 'liteplugin',
677 677
 		);
678
-		$link       = add_query_arg( $query_args, $link );
678
+		$link = add_query_arg( $query_args, $link );
679 679
 	}
680 680
 
681 681
 	/**
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	 */
1106 1106
 	public static function ajax_activate_addon() {
1107 1107
 		self::process_addon_action(
1108
-			function ( $plugin ) {
1108
+			function( $plugin ) {
1109 1109
 				return self::handle_addon_action( $plugin, 'activate' );
1110 1110
 			},
1111 1111
 			array( 'FrmAddonsController', 'get_addon_activation_response' )
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 	 */
1131 1131
 	public static function ajax_deactivate_addon() {
1132 1132
 		self::process_addon_action(
1133
-			function ( $plugin ) {
1133
+			function( $plugin ) {
1134 1134
 				return self::handle_addon_action( $plugin, 'deactivate' );
1135 1135
 			}
1136 1136
 		);
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
 	 */
1146 1146
 	public static function ajax_uninstall_addon() {
1147 1147
 		self::process_addon_action(
1148
-			function ( $plugin ) {
1148
+			function( $plugin ) {
1149 1149
 				return self::handle_addon_action( $plugin, 'uninstall' );
1150 1150
 			}
1151 1151
 		);
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
 		$addons = $api->get_api_info();
1543 1543
 
1544 1544
 		if ( is_array( $addons ) && array_key_exists( $addon_id, $addons ) ) {
1545
-			$dates    = $addons[ $addon_id ];
1545
+			$dates    = $addons[$addon_id];
1546 1546
 			$requires = FrmFormsHelper::get_plan_required( $dates );
1547 1547
 		}
1548 1548
 
Please login to merge, or discard this patch.
classes/helpers/FrmFieldGridHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@
 block discarded – undo
217 217
 		}
218 218
 
219 219
 		if ( false !== $this->parent_li ) {
220
-			++$this->current_field_count;
220
+			++ $this->current_field_count;
221 221
 			$this->current_list_size += $this->active_field_size;
222 222
 			if ( 12 === $this->current_list_size ) {
223 223
 				$this->close_field_wrapper();
Please login to merge, or discard this patch.
classes/helpers/FrmEntriesListHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 			$form_ids              = $this->get_form_ids( $form_id );
135 135
 			$s_query['it.form_id'] = count( $form_ids ) > 1 ? $form_ids : $form_ids[0];
136 136
 		} else {
137
-			$s_query[]          = array(
137
+			$s_query[] = array(
138 138
 				'or'               => 1,
139 139
 				'parent_form_id'   => null,
140 140
 				'parent_form_id <' => 1,
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
 		$r = "<tr id='item-action-{$item->id}'$style>";
285 285
 
286
-		list( $columns, $hidden, , $primary ) = $this->get_column_info();
286
+		list( $columns, $hidden,, $primary ) = $this->get_column_info();
287 287
 		$action_col                           = false;
288 288
 		$action_columns                       = $this->get_action_columns();
289 289
 
Please login to merge, or discard this patch.
classes/helpers/FrmOnboardingWizardHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
 			'secondary-button-role'      => 'button',
101 101
 			'secondary-button-skip-step' => true,
102 102
 		);
103
-		$args     = wp_parse_args( $args, $defaults );
103
+		$args = wp_parse_args( $args, $defaults );
104 104
 
105 105
 		// Set the primary button attributes.
106 106
 		$primary_button_attributes          = array(
Please login to merge, or discard this patch.
classes/models/FrmEmailStats.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 		// Build total for each currency.
151 151
 		foreach ( $payment_data['total'] as $currency => $amount ) {
152
-			$stats[ 'payments_total_' . $currency ] = array(
152
+			$stats['payments_total_' . $currency] = array(
153 153
 				// translators: currency name.
154 154
 				'label'   => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ),
155 155
 				'count'   => $amount,
@@ -171,23 +171,23 @@  discard block
 block discarded – undo
171 171
 
172 172
 			// Compare total for each currency.
173 173
 			foreach ( $payment_data['total'] as $currency => $amount ) {
174
-				if ( ! isset( $prev_payment_data['total'][ $currency ] ) ) {
175
-					$stats[ 'payments_total_' . $currency ]['compare'] = 1;
174
+				if ( ! isset( $prev_payment_data['total'][$currency] ) ) {
175
+					$stats['payments_total_' . $currency]['compare'] = 1;
176 176
 					continue;
177 177
 				}
178 178
 
179
-				$stats[ 'payments_total_' . $currency ]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][ $currency ] );
180
-				unset( $prev_payment_data['total'][ $currency ] );
179
+				$stats['payments_total_' . $currency]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][$currency] );
180
+				unset( $prev_payment_data['total'][$currency] );
181 181
 			}
182 182
 
183 183
 			// If prev month has more currencies.
184 184
 			foreach ( $prev_payment_data['total'] as $currency => $amount ) {
185
-				$stats[ 'payments_total_' . $currency ] = array(
185
+				$stats['payments_total_' . $currency] = array(
186 186
 					// translators: currency name.
187 187
 					'label'   => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ),
188 188
 					'count'   => 0,
189 189
 					'display' => $this->get_formatted_price( 0, $currency ),
190
-					'compare' => -1,
190
+					'compare' => - 1,
191 191
 				);
192 192
 			}
193 193
 		}//end if
Please login to merge, or discard this patch.
classes/models/FrmFieldFormHtml.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param array  $atts
45 45
 	 */
46 46
 	private function _set( $param, $atts ) {
47
-		if ( isset( $atts[ $param ] ) ) {
48
-			$this->{$param} = $atts[ $param ];
47
+		if ( isset( $atts[$param] ) ) {
48
+			$this->{$param} = $atts[$param];
49 49
 		}
50 50
 	}
51 51
 
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 
90 90
 		$exclude = array( 'field_obj', 'html' );
91 91
 		foreach ( $exclude as $ex ) {
92
-			if ( isset( $atts[ $ex ] ) ) {
93
-				unset( $this->pass_args[ $ex ] );
92
+			if ( isset( $atts[$ex] ) ) {
93
+				unset( $this->pass_args[$ex] );
94 94
 			}
95 95
 		}
96 96
 	}
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 * @param array $set
103 103
 	 */
104 104
 	private function set_from_field( $atts, $set ) {
105
-		if ( isset( $atts[ $set['param'] ] ) ) {
106
-			$this->{$set['param']} = $atts[ $set['param'] ];
105
+		if ( isset( $atts[$set['param']] ) ) {
106
+			$this->{$set['param']} = $atts[$set['param']];
107 107
 		} else {
108 108
 			$this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] );
109 109
 		}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	private function replace_error_shortcode() {
232 232
 		$this->maybe_add_error_id();
233
-		$error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false;
233
+		$error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false;
234 234
 
235 235
 		if ( ! empty( $error ) && false === strpos( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) {
236 236
 			$error_body = self::get_error_body( $this->html );
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @since 3.06.02
272 272
 	 */
273 273
 	private function maybe_add_error_id() {
274
-		if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) {
274
+		if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) {
275 275
 			return;
276 276
 		}
277 277
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER );
352 352
 
353 353
 		foreach ( $shortcodes[0] as $short_key => $tag ) {
354
-			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
354
+			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
355 355
 			$tag            = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key );
356 356
 
357 357
 			$replace_with = '';
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 				$replace_with = $this->replace_input_shortcode( $shortcode_atts );
363 363
 			}
364 364
 
365
-			$this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html );
365
+			$this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html );
366 366
 		}
367 367
 	}
368 368
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	 */
385 385
 	private function prepare_input_shortcode_atts( $shortcode_atts ) {
386 386
 		if ( isset( $shortcode_atts['opt'] ) ) {
387
-			--$shortcode_atts['opt'];
387
+			-- $shortcode_atts['opt'];
388 388
 		}
389 389
 
390 390
 		$field_class = isset( $shortcode_atts['class'] ) ? $shortcode_atts['class'] : '';
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 			unset( $shortcode_atts['class'] );
395 395
 		}
396 396
 
397
-		$shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false';
397
+		$shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? 'true' : 'false';
398 398
 
399 399
 		$this->field_obj->set_field_column( 'shortcodes', $shortcode_atts );
400 400
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 	 */
447 447
 	private function get_field_div_classes() {
448 448
 		// Add error class
449
-		$classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : '';
449
+		$classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : '';
450 450
 
451 451
 		// Add label position class
452 452
 		$settings = $this->field_obj->display_field_settings();
Please login to merge, or discard this patch.
classes/models/FrmUsage.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 		foreach ( $pass_settings as $setting ) {
146 146
 			if ( isset( $settings_list->$setting ) ) {
147
-				$settings[ $setting ] = $this->maybe_json( $settings_list->$setting );
147
+				$settings[$setting] = $this->maybe_json( $settings_list->$setting );
148 148
 			}
149 149
 		}
150 150
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
 		$message_settings = array();
180 180
 		foreach ( $messages as $message ) {
181
-			$message_settings[ $message ] = $settings_list->$message;
181
+			$message_settings[$message] = $settings_list->$message;
182 182
 		}
183 183
 
184 184
 		return $message_settings;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
 		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
200 200
 			if ( isset( $settings_list->$frm_role ) ) {
201
-				$permissions[ $frm_role ] = $settings_list->$frm_role;
201
+				$permissions[$frm_role] = $settings_list->$frm_role;
202 202
 			}
203 203
 		}
204 204
 
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
 			);
269 269
 
270 270
 			foreach ( $settings as $setting ) {
271
-				if ( isset( $form->options[ $setting ] ) ) {
272
-					$new_form[ $setting ] = $this->maybe_json( $form->options[ $setting ] );
271
+				if ( isset( $form->options[$setting] ) ) {
272
+					$new_form[$setting] = $this->maybe_json( $form->options[$setting] );
273 273
 				}
274 274
 			}
275 275
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		$fields = FrmDb::get_results( 'frm_fields', array(), 'form_id, name, type, field_options', $args );
329 329
 		foreach ( $fields as $k => $field ) {
330 330
 			FrmAppHelper::unserialize_or_decode( $field->field_options );
331
-			$fields[ $k ]->field_options = json_encode( $field->field_options );
331
+			$fields[$k]->field_options = json_encode( $field->field_options );
332 332
 		}
333 333
 		return $fields;
334 334
 	}
Please login to merge, or discard this patch.