Completed
Pull Request — master (#1045)
by Stephanie
26s
created
classes/models/FrmSolution.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function add_settings( $sections ) {
161 161
 		wp_enqueue_style( 'formidable-pro-fields' );
162
-		$sections[ $this->plugin_slug ] = array(
162
+		$sections[$this->plugin_slug] = array(
163 163
 			'class'    => $this,
164 164
 			'function' => 'settings_page',
165 165
 			'name'     => $this->plugin_name(),
@@ -316,9 +316,9 @@  discard block
 block discarded – undo
316 316
 			// Set the current step.
317 317
 			if ( ! isset( $step['current'] ) ) {
318 318
 				if ( $step['complete'] ) {
319
-					$steps[ $k ]['current'] = false;
319
+					$steps[$k]['current'] = false;
320 320
 				} else {
321
-					$steps[ $k ]['current'] = ! $has_current;
321
+					$steps[$k]['current'] = ! $has_current;
322 322
 					$has_current = true;
323 323
 				}
324 324
 			} elseif ( $step['current'] ) {
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
 			// Set disabled buttons.
329 329
 			$class = isset( $step['button_class'] ) ? $step['button_class'] : '';
330 330
 			$class .= ' button-primary frm-button-primary';
331
-			if ( ! $steps[ $k ]['current'] ) {
331
+			if ( ! $steps[$k]['current'] ) {
332 332
 				$class .= ' frm_grey disabled';
333 333
 			}
334
-			$steps[ $k ]['button_class'] = $class;
334
+			$steps[$k]['button_class'] = $class;
335 335
 		}
336 336
 
337 337
 		return $steps;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 			if ( $plugin['status'] === 'active' ) {
354 354
 				continue;
355 355
 			}
356
-			$links[ $plugin_key ] = $plugin;
356
+			$links[$plugin_key] = $plugin;
357 357
 			if ( isset( $plugin['url'] ) ) {
358 358
 				$rel[] = $plugin['url'];
359 359
 			} else {
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 		$addons = $api->get_api_info();
469 469
 
470 470
 		$id = $this->download_id();
471
-		$has_file = isset( $addons[ $id ] ) && isset( $addons[ $id ]['beta'] );
471
+		$has_file = isset( $addons[$id] ) && isset( $addons[$id]['beta'] );
472 472
 
473 473
 		if ( ! $step['current'] ) {
474 474
 			?>
@@ -483,10 +483,10 @@  discard block
 block discarded – undo
483 483
 
484 484
 		if ( ! $has_file ) {
485 485
 			echo '<p class="frm_error_style">' . esc_html__( 'We didn\'t find anything to import. Please contact our team.', 'formidable' ) . '</p>';
486
-		} elseif ( ! isset( $addons[ $id ]['beta']['package'] ) ) {
486
+		} elseif ( ! isset( $addons[$id]['beta']['package'] ) ) {
487 487
 			echo '<p class="frm_error_style">' . esc_html__( 'Looks like you may not have a current subscription for this solution. Please check your account.', 'formidable' ) . '</p>';
488 488
 		} else {
489
-			$xml = $addons[ $id ]['beta']['package'];
489
+			$xml = $addons[$id]['beta']['package'];
490 490
 			if ( is_array( $xml ) ) {
491 491
 				$xml = reset( $xml );
492 492
 			}
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 		foreach ( $forms as $form ) {
625 625
 			$was_imported = isset( $form['form'] ) ? FrmForm::get_id_by_key( $form['form'] ) : false;
626 626
 			if ( $was_imported ) {
627
-				$imported[ $form['form'] ] = $was_imported;
627
+				$imported[$form['form']] = $was_imported;
628 628
 			}
629 629
 		}
630 630
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@
 block discarded – undo
42 42
 		}
43 43
 
44 44
 		// Only do this for single site installs.
45
-		if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
45
+		if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) {
46
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
46 47
 			return;
47 48
 		}
48 49
 
Please login to merge, or discard this patch.
classes/controllers/FrmXMLController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 			return;
122 122
 		}
123 123
 
124
-		$selected_xml  = isset( $form['xml'] ) && isset( $form['xml'][ $selected_form ] ) ? $form['xml'][ $selected_form ] : '';
124
+		$selected_xml = isset( $form['xml'] ) && isset( $form['xml'][$selected_form] ) ? $form['xml'][$selected_form] : '';
125 125
 		if ( empty( $selected_xml ) || strpos( $selected_xml, 'http' ) !== 0 ) {
126 126
 			return;
127 127
 		}
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @since 4.06.02
134 134
 	 */
135 135
 	private static function get_selected_in_form( $form, $value = 'form' ) {
136
-		if ( ! empty( $form ) && isset( $form[ $value ] ) && ! empty( $form[ $value ] ) ) {
137
-			return $form[ $value ];
136
+		if ( ! empty( $form ) && isset( $form[$value] ) && ! empty( $form[$value] ) ) {
137
+			return $form[$value];
138 138
 		}
139 139
 
140 140
 		return '';
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 			}
164 164
 
165 165
 			if ( $for === 'view' ) {
166
-				$item_key  = is_array( $view_keys ) ? $view_keys[ $form_key ] : $view_keys;
166
+				$item_key  = is_array( $view_keys ) ? $view_keys[$form_key] : $view_keys;
167 167
 				$shortcode = '[display-frm-data id=%1$s filter=limited]';
168 168
 			} elseif ( $for === 'form' ) {
169 169
 				$item_key = $form_key;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 				continue;
179 179
 			}
180 180
 
181
-			$page_ids[ $for ] = wp_insert_post(
181
+			$page_ids[$for] = wp_insert_post(
182 182
 				array(
183 183
 					'post_title'   => $name,
184 184
 					'post_type'    => 'page',
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
320 320
 		$file_type = sanitize_option( 'upload_path', $_FILES['frm_import_file']['name'] );
321 321
 		$file_type = strtolower( pathinfo( $file_type, PATHINFO_EXTENSION ) );
322
-		if ( 'xml' !== $file_type && isset( $export_format[ $file_type ] ) ) {
322
+		if ( 'xml' !== $file_type && isset( $export_format[$file_type] ) ) {
323 323
 			// allow other file types to be imported
324 324
 			do_action( 'frm_before_import_' . $file_type );
325 325
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 		foreach ( $type as $tb_type ) {
403 403
 			$where = array();
404 404
 			$join  = '';
405
-			$table = $tables[ $tb_type ];
405
+			$table = $tables[$tb_type];
406 406
 
407 407
 			$select     = $table . '.id';
408 408
 			$query_vars = array();
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 							$table . '.parent_form_id' => $args['ids'],
418 418
 						);
419 419
 					} else {
420
-						$where[ $table . '.status !' ] = 'draft';
420
+						$where[$table . '.status !'] = 'draft';
421 421
 					}
422 422
 					break;
423 423
 				case 'actions':
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 				case 'items':
431 431
 					// $join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
432 432
 					if ( $args['ids'] ) {
433
-						$where[ $table . '.form_id' ] = $args['ids'];
433
+						$where[$table . '.form_id'] = $args['ids'];
434 434
 					}
435 435
 					break;
436 436
 				case 'styles':
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 					}
472 472
 			}
473 473
 
474
-			$records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select );
474
+			$records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select );
475 475
 			unset( $tb_type );
476 476
 		}
477 477
 
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 		$no_export_fields = FrmField::no_save_fields();
617 617
 		foreach ( $csv_fields as $k => $f ) {
618 618
 			if ( in_array( $f->type, $no_export_fields, true ) ) {
619
-				unset( $csv_fields[ $k ] );
619
+				unset( $csv_fields[$k] );
620 620
 			}
621 621
 		}
622 622
 
Please login to merge, or discard this patch.
classes/views/frm-fields/back-end/field-multiple.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,6 +9,6 @@
 block discarded – undo
9 9
 	$type = $field['type'];
10 10
 	do_action( 'frm_after_checkbox', compact( 'field', 'field_name', 'type' ) );
11 11
 } else {
12
-	$read_only  = $field['read_only'];
12
+	$read_only = $field['read_only'];
13 13
 	include dirname( __FILE__ ) . '/' . $field['type'] . '-field.php';
14 14
 }
Please login to merge, or discard this patch.
classes/controllers/FrmAppController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@
 block discarded – undo
283 283
 				'content' => 'upgrade',
284 284
 			)
285 285
 		);
286
-		$renew_link       = FrmAppHelper::admin_upgrade_link(
286
+		$renew_link = FrmAppHelper::admin_upgrade_link(
287 287
 			array(
288 288
 				'medium'  => 'new-template',
289 289
 				'content' => 'renew',
Please login to merge, or discard this patch.
classes/helpers/FrmEntriesListHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 			$s_query['it.form_id'] = $form_id;
26 26
 			$join_form_in_query    = false;
27 27
 		} else {
28
-			$s_query[]          = array(
28
+			$s_query[] = array(
29 29
 				'or'               => 1,
30 30
 				'parent_form_id'   => null,
31 31
 				'parent_form_id <' => 1,
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 		if ( strpos( $orderby, 'meta' ) !== false ) {
58 58
 			$order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) );
59
-			$orderby          .= in_array( $order_field_type, array( 'number', 'scale', 'star' ) ) ? '+0' : '';
59
+			$orderby .= in_array( $order_field_type, array( 'number', 'scale', 'star' ) ) ? '+0' : '';
60 60
 		}
61 61
 
62 62
 		$order = self::get_param(
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
 		$r = "<tr id='item-action-{$item->id}'$style>";
191 191
 
192
-		list( $columns, $hidden, , $primary ) = $this->get_column_info();
192
+		list( $columns, $hidden,, $primary ) = $this->get_column_info();
193 193
 		$action_col                           = false;
194 194
 		$action_columns                       = $this->get_action_columns();
195 195
 
Please login to merge, or discard this patch.
classes/models/FrmFormTemplateApi.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 
6 6
 class FrmFormTemplateApi extends FrmFormApi {
7 7
 
8
-	protected static $code_option_name  = 'frm_free_license_code';
8
+	protected static $code_option_name = 'frm_free_license_code';
9 9
 
10 10
 	private static $base_api_url = 'https://formidableforms.com/wp-json/form-templates/v1/';
11 11
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 		$templates    = $this->get_api_info();
78 78
 		$contact_form = 20872734;
79
-		return isset( $templates[ $contact_form ] ) && ! empty( $templates[ $contact_form ]['url'] );
79
+		return isset( $templates[$contact_form] ) && ! empty( $templates[$contact_form]['url'] );
80 80
 	}
81 81
 
82 82
 	/**
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
 					continue;
138 138
 				}
139 139
 
140
-				$data['urlByKey'][ $template['key'] ] = $template['url'];
140
+				$data['urlByKey'][$template['key']] = $template['url'];
141 141
 			}
142 142
 
143
-			if ( ! isset( $data['urlByKey'][ $key ] ) ) {
143
+			if ( ! isset( $data['urlByKey'][$key] ) ) {
144 144
 				$error = new WP_Error( 400, 'We were unable to retrieve the template' );
145 145
 				wp_send_json_error( $error );
146 146
 			}
147 147
 
148
-			$data['url'] = $data['urlByKey'][ $key ];
148
+			$data['url'] = $data['urlByKey'][$key];
149 149
 		}
150 150
 
151 151
 		wp_send_json_success( $data );
Please login to merge, or discard this patch.
classes/factories/FrmFieldFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
 			'name'     => 'FrmFieldName',
103 103
 		);
104 104
 
105
-		$class = isset( $type_classes[ $field_type ] ) ? $type_classes[ $field_type ] : '';
105
+		$class = isset( $type_classes[$field_type] ) ? $type_classes[$field_type] : '';
106 106
 
107 107
 		return apply_filters( 'frm_get_field_type_class', $class, $field_type );
108 108
 	}
Please login to merge, or discard this patch.
classes/models/fields/FrmFieldCombo.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,8 @@
 block discarded – undo
39 39
 			}
40 40
 
41 41
 			foreach ( $sub_field['options'] as $option ) {
42
-				if ( 'default_value' === $option ) { // We parse default value from field column.
42
+				if ( 'default_value' === $option ) {
43
+// We parse default value from field column.
43 44
 					continue;
44 45
 				}
45 46
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
 			if ( is_array( $sub_field ) ) {
60 60
 				$sub_field                 = wp_parse_args( $sub_field, $defaults );
61 61
 				$sub_field['name']         = $name;
62
-				$this->sub_fields[ $name ] = $sub_field;
62
+				$this->sub_fields[$name] = $sub_field;
63 63
 				continue;
64 64
 			}
65 65
 
66 66
 			if ( is_string( $sub_field ) ) {
67
-				$this->sub_fields[ $name ] = wp_parse_args(
67
+				$this->sub_fields[$name] = wp_parse_args(
68 68
 					array(
69 69
 						'name'  => $name,
70 70
 						'label' => $sub_field,
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 				}
117 117
 
118 118
 				if ( is_string( $option ) ) {
119
-					$extra_options[ $key . '_' . $option ] = '';
119
+					$extra_options[$key . '_' . $option] = '';
120 120
 				} elseif ( ! empty( $option['name'] ) ) {
121
-					$extra_options[ $key . '_' . $option['name'] ] = '';
121
+					$extra_options[$key . '_' . $option['name']] = '';
122 122
 				}
123 123
 			}
124 124
 		}
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		foreach ( $this->sub_fields as $name => $sub_field ) {
142 142
 			$sub_field['name'] = $name;
143 143
 			$wrapper_classes   = 'frm_grid_container frm_sub_field_options frm_sub_field_options-' . $sub_field['name'];
144
-			if ( ! isset( $processed_sub_fields[ $name ] ) ) {
144
+			if ( ! isset( $processed_sub_fields[$name] ) ) {
145 145
 				// Options for this subfield should be hidden.
146 146
 				$wrapper_classes .= ' frm_hidden';
147 147
 			}
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 			$default_value = array();
172 172
 
173 173
 			foreach ( $this->sub_fields as $name => $sub_field ) {
174
-				$default_value[ $name ] = '';
174
+				$default_value[$name] = '';
175 175
 			}
176 176
 
177 177
 			return $default_value;
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
 		// Placeholder.
344 344
 		if ( in_array( 'placeholder', $sub_field['options'], true ) ) {
345 345
 			$placeholders = FrmField::get_option( $field, 'placeholder' );
346
-			if ( ! empty( $placeholders[ $sub_field['name'] ] ) ) {
347
-				$field['placeholder'] = $placeholders[ $sub_field['name'] ];
346
+			if ( ! empty( $placeholders[$sub_field['name']] ) ) {
347
+				$field['placeholder'] = $placeholders[$sub_field['name']];
348 348
 			}
349 349
 		}
350 350
 
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
 
402 402
 		// Validate not empty.
403 403
 		foreach ( $sub_fields as $name => $sub_field ) {
404
-			if ( empty( $sub_field['optional'] ) && empty( $args['value'][ $name ] ) ) {
405
-				$errors[ 'field' . $args['id'] . '-' . $name ] = '';
406
-				$errors[ 'field' . $args['id'] ]               = $blank_msg;
404
+			if ( empty( $sub_field['optional'] ) && empty( $args['value'][$name] ) ) {
405
+				$errors['field' . $args['id'] . '-' . $name] = '';
406
+				$errors['field' . $args['id']]               = $blank_msg;
407 407
 			}
408 408
 		}
409 409
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 		$field_key  = isset( $this->field->field_key ) ? $this->field->field_key : $this->field['field_key'];
423 423
 		$sub_fields = $this->get_processed_sub_fields();
424 424
 		foreach ( $sub_fields as $name => $sub_field ) {
425
-			$headings[ $field_id . '_' . $name ] = $field_name . ' (' . $field_key . ') - ' . $sub_field['label'];
425
+			$headings[$field_id . '_' . $name] = $field_name . ' (' . $field_key . ') - ' . $sub_field['label'];
426 426
 		}
427 427
 
428 428
 		return $headings;
Please login to merge, or discard this patch.
classes/views/frm-fields/back-end/combo-field/sub-field-options.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 							type="text"
52 52
 							name="<?php echo esc_attr( $input_name ); ?>"
53 53
 							id="<?php echo esc_attr( $input_id ); ?>"
54
-							value="<?php echo esc_attr( isset( $default_value[ $sub_field['name'] ] ) ? $default_value[ $sub_field['name'] ] : '' ); ?>"
54
+							value="<?php echo esc_attr( isset( $default_value[$sub_field['name']] ) ? $default_value[$sub_field['name']] : '' ); ?>"
55 55
 							data-changeme="field_<?php echo esc_attr( $field_key . '_' . $sub_field['name'] ); ?>"
56 56
 							data-changeatt="value"
57 57
 						/>
58 58
 					</span>
59 59
 					<label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>">
60
-						<?php echo esc_html( $labels[ $option ] ); ?>
60
+						<?php echo esc_html( $labels[$option] ); ?>
61 61
 					</label>
62 62
 				</p>
63 63
 				<?php
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 						type="text"
75 75
 						name="<?php echo esc_attr( $input_name ); ?>"
76 76
 						id="<?php echo esc_attr( $input_id ); ?>"
77
-						value="<?php echo esc_attr( isset( $input_value[ $sub_field['name'] ] ) ? $input_value[ $sub_field['name'] ] : '' ); ?>"
77
+						value="<?php echo esc_attr( isset( $input_value[$sub_field['name']] ) ? $input_value[$sub_field['name']] : '' ); ?>"
78 78
 						data-changeme="field_<?php echo esc_attr( $field_key . '_' . $sub_field['name'] ); ?>"
79 79
 						data-changeatt="<?php echo esc_attr( $option ); ?>"
80 80
 					/>
81 81
 					<label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>">
82
-						<?php echo esc_html( $labels[ $option ] ); ?>
82
+						<?php echo esc_html( $labels[$option] ); ?>
83 83
 					</label>
84 84
 				</p>
85 85
 				<?php
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 						data-changeme="frm_field_<?php echo esc_attr( $field_id . '_' . $sub_field['name'] ); ?>_desc"
101 101
 					/>
102 102
 					<label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>">
103
-						<?php echo esc_html( $labels[ $option ] ); ?>
103
+						<?php echo esc_html( $labels[$option] ); ?>
104 104
 					</label>
105 105
 				</p>
106 106
 				<?php
Please login to merge, or discard this patch.