Completed
Pull Request — master (#1356)
by Stephanie
01:05
created
classes/views/frm-fields/front-end/combo-field/combo-field.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			$sub_field_class   = "frm_form_field form-field frm_form_subfield-{$name} {$sub_field['wrapper_classes']}";
42 42
 			$sub_field_desc    = FrmField::get_option( $field, $name . '_desc' );
43 43
 
44
-			if ( isset( $errors[ 'field' . $field_id . '-' . $name ] ) ) {
44
+			if ( isset( $errors['field' . $field_id . '-' . $name] ) ) {
45 45
 				$sub_field_class .= ' frm_blank_field';
46 46
 			}
47 47
 			?>
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 						<input
62 62
 							type="<?php echo esc_attr( $sub_field['type'] ); ?>"
63 63
 							id="<?php echo esc_attr( $html_id . '_' . $name ); ?>"
64
-							value="<?php echo esc_attr( isset( $field_value[ $name ] ) ? $field_value[ $name ] : '' ); ?>"
64
+							value="<?php echo esc_attr( isset( $field_value[$name] ) ? $field_value[$name] : '' ); ?>"
65 65
 							<?php
66
-							if ( ! empty( $field_value[ $name ] ) ) {
67
-								echo 'data-frmval="' . esc_attr( $field_value[ $name ] ) . '" ';
66
+							if ( ! empty( $field_value[$name] ) ) {
67
+								echo 'data-frmval="' . esc_attr( $field_value[$name] ) . '" ';
68 68
 							}
69 69
 							if ( empty( $args['remove_names'] ) ) {
70 70
 								echo 'name="' . esc_attr( $field_name ) . '[' . esc_attr( $name ) . ']" ';
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 				}
82 82
 
83 83
 				// Don't show individual field errors when there is a combo field error.
84
-				if ( ! empty( $errors ) && isset( $errors[ 'field' . $field_id . '-' . $name ] ) && ! isset( $errors[ 'field' . $field_id ] ) ) {
84
+				if ( ! empty( $errors ) && isset( $errors['field' . $field_id . '-' . $name] ) && ! isset( $errors['field' . $field_id] ) ) {
85 85
 					?>
86
-					<div class="frm_error" role="alert"><?php echo esc_html( $errors[ 'field' . $field_id . '-' . $name ] ); ?></div>
86
+					<div class="frm_error" role="alert"><?php echo esc_html( $errors['field' . $field_id . '-' . $name] ); ?></div>
87 87
 				<?php } ?>
88 88
 			</div>
89 89
 			<?php
Please login to merge, or discard this patch.
classes/controllers/FrmAddonsController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		} else {
102 102
 			foreach ( $addons as $k => $addon ) {
103 103
 				if ( empty( $addon['excerpt'] ) && $k !== 'error' ) {
104
-					unset( $addons[ $k ] );
104
+					unset( $addons[$k] );
105 105
 				}
106 106
 			}
107 107
 		}
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
 		foreach ( $list as $k => $info ) {
204 204
 			$info['slug'] = $k;
205
-			$list[ $k ]   = array_merge( $defaults, $info );
205
+			$list[$k]   = array_merge( $defaults, $info );
206 206
 		}
207 207
 		return $list;
208 208
 	}
@@ -353,17 +353,17 @@  discard block
 block discarded – undo
353 353
 				continue;
354 354
 			}
355 355
 
356
-			$wp_plugin    = isset( $wp_plugins[ $folder ] ) ? $wp_plugins[ $folder ] : array();
356
+			$wp_plugin    = isset( $wp_plugins[$folder] ) ? $wp_plugins[$folder] : array();
357 357
 			$wp_version   = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0';
358 358
 			$plugin->slug = explode( '/', $folder )[0];
359 359
 
360 360
 			if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) {
361
-				$transient->response[ $folder ] = $plugin;
361
+				$transient->response[$folder] = $plugin;
362 362
 			} else {
363
-				$transient->no_update[ $folder ] = $plugin;
363
+				$transient->no_update[$folder] = $plugin;
364 364
 			}
365 365
 
366
-			$transient->checked[ $folder ] = $wp_version;
366
+			$transient->checked[$folder] = $wp_version;
367 367
 
368 368
 		}//end foreach
369 369
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	 */
397 397
 	protected static function is_installed( $plugin ) {
398 398
 		$all_plugins = self::get_plugins();
399
-		return isset( $all_plugins[ $plugin ] );
399
+		return isset( $all_plugins[$plugin] );
400 400
 	}
401 401
 
402 402
 	/**
@@ -435,13 +435,13 @@  discard block
 block discarded – undo
435 435
 			}
436 436
 
437 437
 			$download_id = isset( $plugin['id'] ) ? $plugin['id'] : 0;
438
-			if ( ! empty( $download_id ) && ! isset( $version_info[ $download_id ]['package'] ) ) {
438
+			if ( ! empty( $download_id ) && ! isset( $version_info[$download_id]['package'] ) ) {
439 439
 				// if this addon is using its own license, get the update url
440 440
 				$addon_info = $api->get_api_info();
441 441
 
442
-				$version_info[ $download_id ] = $addon_info[ $download_id ];
442
+				$version_info[$download_id] = $addon_info[$download_id];
443 443
 				if ( isset( $addon_info['error'] ) ) {
444
-					$version_info[ $download_id ]['error'] = array(
444
+					$version_info[$download_id]['error'] = array(
445 445
 						'message' => $addon_info['error']['message'],
446 446
 						'code'    => $addon_info['error']['code'],
447 447
 					);
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
 					return $addon;
541 541
 				}
542 542
 			}
543
-		} elseif ( isset( $addons[ $download_id ] ) ) {
544
-			$plugin = $addons[ $download_id ];
543
+		} elseif ( isset( $addons[$download_id] ) ) {
544
+			$plugin = $addons[$download_id];
545 545
 		}
546 546
 
547 547
 		return $plugin;
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 			self::prepare_addon_link( $addon['link'] );
606 606
 
607 607
 			self::set_addon_status( $addon );
608
-			$addons[ $id ] = $addon;
608
+			$addons[$id] = $addon;
609 609
 		}//end foreach
610 610
 	}
611 611
 
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 			'utm_medium'   => 'addons',
647 647
 			'utm_campaign' => 'liteplugin',
648 648
 		);
649
-		$link       = add_query_arg( $query_args, $link );
649
+		$link = add_query_arg( $query_args, $link );
650 650
 	}
651 651
 
652 652
 	/**
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 		$addons = $api->get_api_info();
1390 1390
 
1391 1391
 		if ( is_array( $addons ) && array_key_exists( $addon_id, $addons ) ) {
1392
-			$dates    = $addons[ $addon_id ];
1392
+			$dates    = $addons[$addon_id];
1393 1393
 			$requires = FrmFormsHelper::get_plan_required( $dates );
1394 1394
 		}
1395 1395
 
Please login to merge, or discard this patch.
classes/controllers/FrmFormActionsController.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 		}
109 109
 
110 110
 		foreach ( $action_controls as $action ) {
111
-			if ( isset( $groups[ $action->id_base ] ) || in_array( $action->id_base, $grouped ) ) {
111
+			if ( isset( $groups[$action->id_base] ) || in_array( $action->id_base, $grouped ) ) {
112 112
 				continue;
113 113
 			}
114 114
 
115 115
 			$this_group = $action->action_options['group'];
116
-			if ( ! isset( $groups[ $this_group ] ) ) {
116
+			if ( ! isset( $groups[$this_group] ) ) {
117 117
 				$this_group = 'misc';
118 118
 			}
119 119
 
120
-			if ( ! isset( $groups[ $this_group ]['actions'] ) ) {
121
-				$groups[ $this_group ]['actions'] = array();
120
+			if ( ! isset( $groups[$this_group]['actions'] ) ) {
121
+				$groups[$this_group]['actions'] = array();
122 122
 			}
123
-			$groups[ $this_group ]['actions'][] = $action->id_base;
123
+			$groups[$this_group]['actions'][] = $action->id_base;
124 124
 
125 125
 			unset( $action );
126 126
 		}
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 				return $a;
271 271
 			}
272 272
 
273
-			$actions[ $a->id_base ] = $a;
273
+			$actions[$a->id_base] = $a;
274 274
 		}
275 275
 
276 276
 		return $actions;
@@ -301,16 +301,16 @@  discard block
 block discarded – undo
301 301
 		$action_map = array();
302 302
 
303 303
 		foreach ( $action_controls as $key => $control ) {
304
-			$action_map[ $control->id_base ] = $key;
304
+			$action_map[$control->id_base] = $key;
305 305
 		}
306 306
 
307 307
 		foreach ( $form_actions as $action ) {
308
-			if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
308
+			if ( ! isset( $action_map[$action->post_excerpt] ) ) {
309 309
 				// don't try and show settings if action no longer exists
310 310
 				continue;
311 311
 			}
312 312
 
313
-			self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
313
+			self::action_control( $action, $form, $action->ID, $action_controls[$action_map[$action->post_excerpt]], $values );
314 314
 		}
315 315
 	}
316 316
 
@@ -539,8 +539,8 @@  discard block
 block discarded – undo
539 539
 			}
540 540
 
541 541
 			// Store actions so they can be triggered with the correct priority.
542
-			$stored_actions[ $action->ID ]  = $action;
543
-			$action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
542
+			$stored_actions[$action->ID]  = $action;
543
+			$action_priority[$action->ID] = $link_settings[$action->post_excerpt]->action_options['priority'];
544 544
 
545 545
 			unset( $action );
546 546
 		}//end foreach
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 			new FrmNotification();
553 553
 
554 554
 			foreach ( $action_priority as $action_id => $priority ) {
555
-				$action = $stored_actions[ $action_id ];
555
+				$action = $stored_actions[$action_id];
556 556
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
557 557
 				do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
558 558
 
@@ -599,12 +599,12 @@  discard block
 block discarded – undo
599 599
 	}
600 600
 
601 601
 	public function register( $action_class ) {
602
-		$this->actions[ $action_class ] = new $action_class();
602
+		$this->actions[$action_class] = new $action_class();
603 603
 	}
604 604
 
605 605
 	public function unregister( $action_class ) {
606
-		if ( isset( $this->actions[ $action_class ] ) ) {
607
-			unset( $this->actions[ $action_class ] );
606
+		if ( isset( $this->actions[$action_class] ) ) {
607
+			unset( $this->actions[$action_class] );
608 608
 		}
609 609
 	}
610 610
 
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
 
614 614
 		foreach ( $keys as $key ) {
615 615
 			// don't register new action if old action with the same id is already registered
616
-			if ( ! isset( $this->actions[ $key ] ) ) {
617
-				$this->actions[ $key ]->_register();
616
+			if ( ! isset( $this->actions[$key] ) ) {
617
+				$this->actions[$key]->_register();
618 618
 			}
619 619
 		}
620 620
 	}
Please login to merge, or discard this patch.
classes/controllers/FrmSettingsController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 				$section['function'] = $original;
159 159
 			}
160 160
 
161
-			$sections[ $key ] = $section;
161
+			$sections[$key] = $section;
162 162
 		}//end foreach
163 163
 
164 164
 		return $sections;
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$section  = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' );
172 172
 		$sections = self::get_settings_tabs();
173
-		if ( ! isset( $sections[ $section ] ) ) {
173
+		if ( ! isset( $sections[$section] ) ) {
174 174
 			wp_die();
175 175
 		}
176 176
 
177
-		$section = $sections[ $section ];
177
+		$section = $sections[$section];
178 178
 
179 179
 		if ( isset( $section['class'] ) ) {
180 180
 			call_user_func( array( $section['class'], $section['function'] ) );
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
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 			return;
164 164
 		}
165 165
 
166
-		$selected_xml  = isset( $form['xml'] ) && isset( $form['xml'][ $selected_form ] ) ? $form['xml'][ $selected_form ] : '';
166
+		$selected_xml = isset( $form['xml'] ) && isset( $form['xml'][$selected_form] ) ? $form['xml'][$selected_form] : '';
167 167
 		if ( empty( $selected_xml ) || strpos( $selected_xml, 'http' ) !== 0 ) {
168 168
 			return;
169 169
 		}
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 	 * @param string $value
179 179
 	 */
180 180
 	private static function get_selected_in_form( $form, $value = 'form' ) {
181
-		if ( ! empty( $form ) && isset( $form[ $value ] ) && ! empty( $form[ $value ] ) ) {
182
-			return $form[ $value ];
181
+		if ( ! empty( $form ) && isset( $form[$value] ) && ! empty( $form[$value] ) ) {
182
+			return $form[$value];
183 183
 		}
184 184
 
185 185
 		return '';
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			}
209 209
 
210 210
 			if ( $for === 'view' ) {
211
-				$item_key  = is_array( $view_keys ) ? $view_keys[ $form_key ] : $view_keys;
211
+				$item_key  = is_array( $view_keys ) ? $view_keys[$form_key] : $view_keys;
212 212
 				$shortcode = '[display-frm-data id=%1$s filter=limited]';
213 213
 			} elseif ( $for === 'form' ) {
214 214
 				$item_key = $form_key;
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 				continue;
224 224
 			}
225 225
 
226
-			$page_ids[ $for ] = wp_insert_post(
226
+			$page_ids[$for] = wp_insert_post(
227 227
 				array(
228 228
 					'post_title'   => $name,
229 229
 					'post_type'    => 'page',
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 		// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
378 378
 		$file_type = sanitize_option( 'upload_path', $_FILES['frm_import_file']['name'] );
379 379
 		$file_type = strtolower( pathinfo( $file_type, PATHINFO_EXTENSION ) );
380
-		if ( 'xml' !== $file_type && isset( $export_format[ $file_type ] ) ) {
380
+		if ( 'xml' !== $file_type && isset( $export_format[$file_type] ) ) {
381 381
 			// allow other file types to be imported
382 382
 			do_action( 'frm_before_import_' . $file_type );
383 383
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 		foreach ( $type as $tb_type ) {
472 472
 			$where = array();
473 473
 			$join  = '';
474
-			$table = $tables[ $tb_type ];
474
+			$table = $tables[$tb_type];
475 475
 
476 476
 			$select     = $table . '.id';
477 477
 			$query_vars = array();
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 							$table . '.parent_form_id' => $args['ids'],
487 487
 						);
488 488
 					} else {
489
-						$where[ $table . '.status !' ] = 'draft';
489
+						$where[$table . '.status !'] = 'draft';
490 490
 					}
491 491
 					break;
492 492
 				case 'actions':
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 				case 'items':
500 500
 					// $join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
501 501
 					if ( $args['ids'] ) {
502
-						$where[ $table . '.form_id' ] = $args['ids'];
502
+						$where[$table . '.form_id'] = $args['ids'];
503 503
 					}
504 504
 					break;
505 505
 				case 'styles':
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 					}
541 541
 			}//end switch
542 542
 
543
-			$records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select );
543
+			$records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select );
544 544
 			unset( $tb_type );
545 545
 		}//end foreach
546 546
 
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 		$no_export_fields = FrmField::no_save_fields();
713 713
 		foreach ( $csv_fields as $k => $f ) {
714 714
 			if ( in_array( $f->type, $no_export_fields, true ) ) {
715
-				unset( $csv_fields[ $k ] );
715
+				unset( $csv_fields[$k] );
716 716
 			}
717 717
 		}
718 718
 
Please login to merge, or discard this patch.
classes/controllers/FrmFormsController.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -552,11 +552,11 @@  discard block
 block discarded – undo
552 552
 			),
553 553
 		);
554 554
 
555
-		if ( ! isset( $available_status[ $status ] ) ) {
555
+		if ( ! isset( $available_status[$status] ) ) {
556 556
 			return;
557 557
 		}
558 558
 
559
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
559
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
560 560
 
561 561
 		$params = FrmForm::list_page_params();
562 562
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 		check_admin_referer( $status . '_form_' . $params['id'] );
565 565
 
566 566
 		$count = 0;
567
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
567
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
568 568
 			$count ++;
569 569
 		}
570 570
 
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 		/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
582 582
 		$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>' );
583 583
 
584
-		$message = $available_status[ $status ]['message'];
584
+		$message = $available_status[$status]['message'];
585 585
 
586 586
 		self::display_forms_list( $params, $message );
587 587
 	}
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 				'type'  => 'request',
603 603
 			)
604 604
 		);
605
-		$message      = sprintf(
605
+		$message = sprintf(
606 606
 			/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
607 607
 			_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' ),
608 608
 			$count,
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 
1185 1185
 		foreach ( array( 'landing', 'chat', 'abandonment' ) as $feature ) {
1186 1186
 			if ( ! FrmAppHelper::show_new_feature( $feature ) ) {
1187
-				unset( $sections[ $feature ] );
1187
+				unset( $sections[$feature] );
1188 1188
 			}
1189 1189
 		}
1190 1190
 
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 				$section['id'] = $section['anchor'];
1218 1218
 			}
1219 1219
 
1220
-			$sections[ $key ] = $section;
1220
+			$sections[$key] = $section;
1221 1221
 		}//end foreach
1222 1222
 
1223 1223
 		return $sections;
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 		if ( ! empty( $user_fields ) ) {
1336 1336
 			$user_helpers = array();
1337 1337
 			foreach ( $user_fields as $uk => $uf ) {
1338
-				$user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
1338
+				$user_helpers['|user_id| show="' . $uk . '"'] = $uf;
1339 1339
 				unset( $uk, $uf );
1340 1340
 			}
1341 1341
 
@@ -1474,7 +1474,7 @@  discard block
 block discarded – undo
1474 1474
 		if ( ! isset( $frm_vars['js_validate_forms'] ) ) {
1475 1475
 			$frm_vars['js_validate_forms'] = array();
1476 1476
 		}
1477
-		$frm_vars['js_validate_forms'][ $form->id ] = $form;
1477
+		$frm_vars['js_validate_forms'][$form->id] = $form;
1478 1478
 	}
1479 1479
 
1480 1480
 	public static function get_email_html() {
@@ -1633,7 +1633,7 @@  discard block
 block discarded – undo
1633 1633
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1634 1634
 			} else {
1635 1635
 				$vars   = FrmAppHelper::json_to_array( $json_vars );
1636
-				$action = $vars[ $action ];
1636
+				$action = $vars[$action];
1637 1637
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1638 1638
 				$_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1639 1639
 				$_POST    = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
@@ -1801,7 +1801,7 @@  discard block
 block discarded – undo
1801 1801
 		$actions = array();
1802 1802
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
1803 1803
 			if ( is_object( $form ) ) {
1804
-				$actions[ $form->id ] = $form->name;
1804
+				$actions[$form->id] = $form->name;
1805 1805
 			}
1806 1806
 			unset( $form );
1807 1807
 		}
@@ -2046,8 +2046,8 @@  discard block
 block discarded – undo
2046 2046
 	private static function get_saved_errors( $form, $params ) {
2047 2047
 		global $frm_vars;
2048 2048
 
2049
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2050
-			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
2049
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2050
+			$errors = $frm_vars['created_entries'][$form->id]['errors'];
2051 2051
 		} else {
2052 2052
 			$errors = array();
2053 2053
 		}
@@ -2069,7 +2069,7 @@  discard block
 block discarded – undo
2069 2069
 	public static function just_created_entry( $form_id ) {
2070 2070
 		global $frm_vars;
2071 2071
 
2072
-		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;
2072
+		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;
2073 2073
 	}
2074 2074
 
2075 2075
 	/**
@@ -2089,7 +2089,7 @@  discard block
 block discarded – undo
2089 2089
 	private static function get_confirmation_method( $atts ) {
2090 2090
 		$action = FrmOnSubmitHelper::current_event( $atts );
2091 2091
 		$opt    = 'update' === $action ? 'edit_action' : 'success_action';
2092
-		$method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message';
2092
+		$method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message';
2093 2093
 
2094 2094
 		if ( ! empty( $atts['entry_id'] ) ) {
2095 2095
 			$met_actions = self::get_met_on_submit_actions( $atts, $action );
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
 	public static function maybe_trigger_redirect( $form, $params, $args ) {
2111 2111
 		if ( ! isset( $params['id'] ) ) {
2112 2112
 			global $frm_vars;
2113
-			$params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
2113
+			$params['id'] = $frm_vars['created_entries'][$form->id]['entry_id'];
2114 2114
 		}
2115 2115
 
2116 2116
 		$conf_method = self::get_confirmation_method(
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
 		$args['success_opt'] = $opt;
2193 2193
 		$args['ajax']        = ! empty( $frm_vars['ajax'] );
2194 2194
 
2195
-		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) {
2195
+		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) {
2196 2196
 			self::load_page_after_submit( $args );
2197 2197
 		} elseif ( $args['conf_method'] === 'redirect' ) {
2198 2198
 			self::redirect_after_submit( $args );
@@ -2216,7 +2216,7 @@  discard block
 block discarded – undo
2216 2216
 		}
2217 2217
 
2218 2218
 		// If a redirect action has already opened the URL in a new tab, we show the default message in the currect tab.
2219
-		if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) {
2219
+		if ( ! empty( self::$redirected_in_new_tab[$args['form']->id] ) ) {
2220 2220
 			return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) );
2221 2221
 		}
2222 2222
 
@@ -2404,7 +2404,7 @@  discard block
 block discarded – undo
2404 2404
 
2405 2405
 		$opt = 'update' === $args['action'] ? 'edit_' : 'success_';
2406 2406
 
2407
-		$new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ];
2407
+		$new_args['conf_method'] = $new_args['form']->options[$opt . 'action'];
2408 2408
 
2409 2409
 		/**
2410 2410
 		 * Filters the run success action args.
@@ -2424,8 +2424,8 @@  discard block
 block discarded – undo
2424 2424
 	private static function load_page_after_submit( $args ) {
2425 2425
 		global $post;
2426 2426
 		$opt = $args['success_opt'];
2427
-		if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
2428
-			$page     = get_post( $args['form']->options[ $opt . '_page_id' ] );
2427
+		if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) {
2428
+			$page     = get_post( $args['form']->options[$opt . '_page_id'] );
2429 2429
 			$old_post = $post;
2430 2430
 			$post     = $page;
2431 2431
 			$content  = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] );
@@ -2455,7 +2455,7 @@  discard block
 block discarded – undo
2455 2455
 		add_filter( 'frm_use_wpautop', '__return_false' );
2456 2456
 
2457 2457
 		$opt         = $args['success_opt'];
2458
-		$success_url = trim( $args['form']->options[ $opt . '_url' ] );
2458
+		$success_url = trim( $args['form']->options[$opt . '_url'] );
2459 2459
 		$success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] );
2460 2460
 		$success_url = do_shortcode( $success_url );
2461 2461
 
@@ -2477,7 +2477,7 @@  discard block
 block discarded – undo
2477 2477
 			// Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2478 2478
 			if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
2479 2479
 				self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args );
2480
-				self::$redirected_in_new_tab[ $args['form']->id ] = 1;
2480
+				self::$redirected_in_new_tab[$args['form']->id] = 1;
2481 2481
 				return;
2482 2482
 			}
2483 2483
 
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
 			'description' => false,
2740 2740
 			'reset'       => false,
2741 2741
 		);
2742
-		$args     = wp_parse_args( $args, $defaults );
2742
+		$args = wp_parse_args( $args, $defaults );
2743 2743
 	}
2744 2744
 
2745 2745
 	/**
@@ -2777,7 +2777,7 @@  discard block
 block discarded – undo
2777 2777
 		$opt          = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success';
2778 2778
 
2779 2779
 		if ( $entry_id && is_numeric( $entry_id ) ) {
2780
-			$message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg;
2780
+			$message = isset( $form->options[$opt . '_msg'] ) ? $form->options[$opt . '_msg'] : $frm_settings->success_msg;
2781 2781
 			$class   = 'frm_message';
2782 2782
 		} else {
2783 2783
 			$message = $frm_settings->failed_msg;
@@ -3000,7 +3000,7 @@  discard block
 block discarded – undo
3000 3000
 
3001 3001
 		check_ajax_referer( 'frm_ajax', 'nonce' );
3002 3002
 
3003
-		$html             = FrmAppHelper::clip(
3003
+		$html = FrmAppHelper::clip(
3004 3004
 			function() {
3005 3005
 				FrmAppHelper::maybe_autocomplete_pages_options(
3006 3006
 					array(
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1616,7 +1616,8 @@  discard block
 block discarded – undo
1616 1616
 		$vars   = array();
1617 1617
 		FrmAppHelper::include_svg();
1618 1618
 
1619
-		if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1619
+		if ( isset( $_POST['frm_compact_fields'] ) ) {
1620
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
1620 1621
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
1621 1622
 
1622 1623
 			// Javascript needs to be allowed in some field settings.
@@ -2046,7 +2047,8 @@  discard block
 block discarded – undo
2046 2047
 	private static function get_saved_errors( $form, $params ) {
2047 2048
 		global $frm_vars;
2048 2049
 
2049
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2050
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) {
2051
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
2050 2052
 			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
2051 2053
 		} else {
2052 2054
 			$errors = array();
Please login to merge, or discard this patch.
classes/helpers/FrmCSVExportHelper.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
 		unset( $filename );
131 131
 
132
-		$comment_count       = FrmDb::get_count(
132
+		$comment_count = FrmDb::get_count(
133 133
 			'frm_item_metas',
134 134
 			array(
135 135
 				'item_id'         => $atts['entry_ids'],
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	private static function prepare_csv_headings() {
225 225
 		$headings = array();
226 226
 		self::csv_headings( $headings );
227
-		$headings       = apply_filters(
227
+		$headings = apply_filters(
228 228
 			'frm_csv_columns',
229 229
 			$headings,
230 230
 			self::$form_id,
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 		$field_headings  = array();
249 249
 		$separate_values = array( 'user_id', 'file', 'data', 'date' );
250 250
 		if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) {
251
-			$field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) );
251
+			$field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) );
252 252
 		}
253 253
 
254
-		$field_headings[ $col->id ] = strip_tags( $col->name );
254
+		$field_headings[$col->id] = strip_tags( $col->name );
255 255
 		$field_headings             = apply_filters(
256 256
 			'frm_csv_field_columns',
257 257
 			$field_headings,
@@ -272,14 +272,14 @@  discard block
 block discarded – undo
272 272
 			if ( self::is_the_child_of_a_repeater( $col ) ) {
273 273
 				$repeater_id = $col->field_options['in_section'];
274 274
 				// Set a placeholder to maintain order for repeater fields.
275
-				$headings[ 'repeater' . $repeater_id ] = array();
275
+				$headings['repeater' . $repeater_id] = array();
276 276
 
277
-				if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) {
278
-					$fields_by_repeater_id[ $repeater_id ] = array();
277
+				if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) {
278
+					$fields_by_repeater_id[$repeater_id] = array();
279 279
 					$repeater_ids[]                        = $repeater_id;
280 280
 				}
281 281
 
282
-				$fields_by_repeater_id[ $repeater_id ][] = $col;
282
+				$fields_by_repeater_id[$repeater_id][] = $col;
283 283
 
284 284
 				continue;
285 285
 			}
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
 				$end    = strpos( $row->meta_value, ':{' );
299 299
 				$length = substr( $row->meta_value, $start, $end - $start );
300 300
 
301
-				if ( $length > $max[ $row->field_id ] ) {
302
-					$max[ $row->field_id ] = $length;
301
+				if ( $length > $max[$row->field_id] ) {
302
+					$max[$row->field_id] = $length;
303 303
 				}
304 304
 			}
305 305
 			unset( $start, $end, $length, $row, $repeater_meta, $where );
@@ -310,17 +310,17 @@  discard block
 block discarded – undo
310 310
 					$repeater_id = str_replace( 'repeater', '', $key );
311 311
 
312 312
 					$repeater_headings = array();
313
-					foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) {
313
+					foreach ( $fields_by_repeater_id[$repeater_id] as $col ) {
314 314
 						$repeater_headings += self::field_headings( $col );
315 315
 					}
316 316
 
317
-					for ( $i = 0; $i < $max[ $repeater_id ]; $i ++ ) {
317
+					for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) {
318 318
 						foreach ( $repeater_headings as $repeater_key => $repeater_name ) {
319
-							$flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name;
319
+							$flat[$repeater_key . '[' . $i . ']'] = $repeater_name;
320 320
 						}
321 321
 					}
322 322
 				} else {
323
-					$flat[ $key ] = $heading;
323
+					$flat[$key] = $heading;
324 324
 				}
325 325
 			}
326 326
 
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
 
335 335
 		if ( self::$comment_count ) {
336 336
 			for ( $i = 0; $i < self::$comment_count; $i ++ ) {
337
-				$headings[ 'comment' . $i ]            = __( 'Comment', 'formidable' );
338
-				$headings[ 'comment_user_id' . $i ]    = __( 'Comment User', 'formidable' );
339
-				$headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' );
337
+				$headings['comment' . $i]            = __( 'Comment', 'formidable' );
338
+				$headings['comment_user_id' . $i]    = __( 'Comment User', 'formidable' );
339
+				$headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' );
340 340
 			}
341 341
 			unset( $i );
342 342
 		}
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 
382 382
 	private static function prepare_next_csv_rows( $next_set ) {
383 383
 		// order by parent_item_id so children will be first
384
-		$where   = array(
384
+		$where = array(
385 385
 			'or'             => 1,
386 386
 			'id'             => $next_set,
387 387
 			'parent_item_id' => $next_set,
@@ -427,32 +427,32 @@  discard block
 block discarded – undo
427 427
 					continue;
428 428
 				}
429 429
 
430
-				if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) {
431
-					$entries[ self::$entry->parent_item_id ]        = new stdClass();
432
-					$entries[ self::$entry->parent_item_id ]->metas = array();
430
+				if ( ! isset( $entries[self::$entry->parent_item_id] ) ) {
431
+					$entries[self::$entry->parent_item_id]        = new stdClass();
432
+					$entries[self::$entry->parent_item_id]->metas = array();
433 433
 				}
434 434
 
435
-				if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) {
436
-					$entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array();
437
-				} elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) {
435
+				if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) {
436
+					$entries[self::$entry->parent_item_id]->metas[$meta_id] = array();
437
+				} elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) {
438 438
 					// if the data is here, it should be an array but if this field has collected data
439 439
 					// both while inside and outside of the repeating section, it's possible this is a string.
440
-					$entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ];
440
+					$entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id];
441 441
 				}
442 442
 
443 443
 				// Add the repeated values.
444
-				$entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value;
444
+				$entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value;
445 445
 			}//end foreach
446 446
 
447 447
 			self::$entry->metas                              = self::fill_missing_repeater_metas( self::$entry->metas, $entries );
448
-			$entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas;
448
+			$entries[self::$entry->parent_item_id]->metas += self::$entry->metas;
449 449
 		}//end if
450 450
 
451 451
 		// add the embedded form id
452
-		if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) {
453
-			$entries[ self::$entry->parent_item_id ]->embedded_fields = array();
452
+		if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) {
453
+			$entries[self::$entry->parent_item_id]->embedded_fields = array();
454 454
 		}
455
-		$entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id;
455
+		$entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id;
456 456
 	}
457 457
 
458 458
 	/**
@@ -473,19 +473,19 @@  discard block
 block discarded – undo
473 473
 		}
474 474
 
475 475
 		$repeater_id = $field->field_options['in_section'];
476
-		if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) {
476
+		if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) {
477 477
 			return $metas;
478 478
 		}
479 479
 
480
-		foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) {
481
-			if ( ! isset( $metas[ $repeater_child->id ] ) ) {
482
-				$metas[ $repeater_child->id ] = '';
480
+		foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) {
481
+			if ( ! isset( $metas[$repeater_child->id] ) ) {
482
+				$metas[$repeater_child->id] = '';
483 483
 
484
-				if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) {
485
-					$entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array();
484
+				if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) {
485
+					$entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array();
486 486
 				}
487 487
 
488
-				$entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = '';
488
+				$entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = '';
489 489
 			}
490 490
 		}
491 491
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 
505 505
 	private static function add_field_values_to_csv( &$row ) {
506 506
 		foreach ( self::$fields as $col ) {
507
-			$field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false;
507
+			$field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false;
508 508
 
509 509
 			FrmFieldsHelper::prepare_field_value( $field_value, $col->type );
510 510
 			self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) );
@@ -523,20 +523,20 @@  discard block
 block discarded – undo
523 523
 			if ( ! empty( $col->field_options['separate_value'] ) ) {
524 524
 				$label_key = $col->id . '_label';
525 525
 				if ( self::is_the_child_of_a_repeater( $col ) ) {
526
-					$row[ $label_key ] = array();
526
+					$row[$label_key] = array();
527 527
 
528 528
 					if ( is_array( $field_value ) ) {
529 529
 						foreach ( $field_value as $value ) {
530
-							$row[ $label_key ][] = self::get_separate_value_label( $value, $col );
530
+							$row[$label_key][] = self::get_separate_value_label( $value, $col );
531 531
 						}
532 532
 					}
533 533
 				} else {
534
-					$row[ $label_key ] = self::get_separate_value_label( $field_value, $col );
534
+					$row[$label_key] = self::get_separate_value_label( $field_value, $col );
535 535
 				}
536 536
 				unset( $label_key );
537 537
 			}
538 538
 
539
-			$row[ $col->id ] = $field_value;
539
+			$row[$col->id] = $field_value;
540 540
 
541 541
 			unset( $col, $field_value );
542 542
 		}//end foreach
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 				'show_icon'         => false,
560 560
 				'entry_id'          => self::$entry->id,
561 561
 				'sep'               => self::$separator,
562
-				'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0,
562
+				'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0,
563 563
 			)
564 564
 		);
565 565
 	}
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
 					// This is combo field inside repeater. The heading key has this format: [86_first[0]].
575 575
 					foreach ( $sub_value as $sub_key => $sub_sub_value ) {
576 576
 						$column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']';
577
-						if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) {
578
-							$row[ $column_key ] = $sub_sub_value;
577
+						if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) {
578
+							$row[$column_key] = $sub_sub_value;
579 579
 						}
580 580
 					}
581 581
 
@@ -583,8 +583,8 @@  discard block
 block discarded – undo
583 583
 				}
584 584
 
585 585
 				$column_key = $atts['col']->id . '_' . $key;
586
-				if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) {
587
-					$row[ $column_key ] = $sub_value;
586
+				if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) {
587
+					$row[$column_key] = $sub_value;
588 588
 				}
589 589
 			}
590 590
 		}
@@ -609,18 +609,18 @@  discard block
 block discarded – undo
609 609
 		$echo = 'echo' === self::$mode;
610 610
 
611 611
 		foreach ( self::$headings as $k => $heading ) {
612
-			if ( isset( $rows[ $k ] ) ) {
613
-				$row = $rows[ $k ];
612
+			if ( isset( $rows[$k] ) ) {
613
+				$row = $rows[$k];
614 614
 			} else {
615 615
 				$row = '';
616 616
 				// array indexed data is not at $rows[ $k ]
617
-				if ( $k[ strlen( $k ) - 1 ] === ']' ) {
617
+				if ( $k[strlen( $k ) - 1] === ']' ) {
618 618
 					$start = strrpos( $k, '[' );
619 619
 					$key   = substr( $k, 0, $start ++ );
620 620
 					$index = substr( $k, $start, strlen( $k ) - 1 - $start );
621 621
 
622
-					if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) {
623
-						$row = $rows[ $key ][ $index ];
622
+					if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) {
623
+						$row = $rows[$key][$index];
624 624
 					}
625 625
 
626 626
 					unset( $start, $key, $index );
Please login to merge, or discard this patch.
classes/helpers/FrmFieldsHelper.php 2 patches
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 			if ( in_array( $type, array( 'data', 'lookup' ), true ) ) {
32 32
 				$values['field_options']['data_type'] = $setting;
33 33
 			} else {
34
-				$values['field_options'][ $setting ] = 1;
34
+				$values['field_options'][$setting] = 1;
35 35
 			}
36 36
 		}
37 37
 
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 		}
139 139
 
140 140
 		foreach ( $defaults as $opt => $default ) {
141
-			$values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default;
141
+			$values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default;
142 142
 
143 143
 			if ( $check_post ) {
144
-				self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] );
144
+				self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] );
145 145
 			}
146 146
 
147 147
 			unset( $opt, $default );
@@ -185,18 +185,18 @@  discard block
 block discarded – undo
185 185
 	 * @param mixed  $value
186 186
 	 */
187 187
 	private static function get_posted_field_setting( $setting, &$value ) {
188
-		if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
188
+		if ( ! isset( $_POST['field_options'][$setting] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
189 189
 			return;
190 190
 		}
191 191
 
192 192
 		if ( strpos( $setting, 'html' ) !== false ) {
193 193
 			// Strip slashes from HTML but not regex or script tags.
194
-			$value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
194
+			$value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
195 195
 		} elseif ( strpos( $setting, 'format_' ) === 0 ) {
196 196
 			// TODO: Remove stripslashes on output, and use on input only.
197
-			$value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing
197
+			$value = sanitize_text_field( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing
198 198
 		} else {
199
-			$value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
199
+			$value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
200 200
 			FrmAppHelper::sanitize_value( 'wp_kses_post', $value );
201 201
 		}
202 202
 	}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		$values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value );
270 270
 
271 271
 		foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
272
-			$values[ $col ] = $field->{$col};
272
+			$values[$col] = $field->{$col};
273 273
 		}
274 274
 	}
275 275
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		);
310 310
 
311 311
 		$msg = FrmField::get_option( $field, $error );
312
-		$msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg;
312
+		$msg = empty( $msg ) ? $defaults[$error]['part'] : $msg;
313 313
 		$msg = do_shortcode( $msg );
314 314
 
315 315
 		return $msg;
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		}
420 420
 
421 421
 		$base_name = 'default_value_' . $field['id'];
422
-		$html_id    = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field );
422
+		$html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field );
423 423
 
424 424
 		$default_type = self::get_default_value_type( $field );
425 425
 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 				continue;
750 750
 			}
751 751
 
752
-			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
752
+			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] );
753 753
 			$tag  = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key );
754 754
 
755 755
 			$atts['entry'] = $entry;
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 			if ( $replace_with !== null ) {
760 760
 				$replace_with = self::trigger_shortcode_atts( $replace_with, $atts );
761 761
 				self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with );
762
-				$content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
762
+				$content = str_replace( $shortcodes[0][$short_key], $replace_with, $content );
763 763
 			}
764 764
 
765 765
 			unset( $atts, $replace_with );
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 		$supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' );
778 778
 		$included_atts  = array_intersect( $supported_atts, array_keys( $atts ) );
779 779
 		foreach ( $included_atts as $included_att ) {
780
-			if ( '0' === $atts[ $included_att ] ) {
780
+			if ( '0' === $atts[$included_att] ) {
781 781
 				// Skip any option that uses 0 so sanitize_url=0 does not encode.
782 782
 				continue;
783 783
 			}
@@ -850,8 +850,8 @@  discard block
 block discarded – undo
850 850
 
851 851
 		$dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' );
852 852
 
853
-		if ( isset( $shortcode_values[ $atts['tag'] ] ) ) {
854
-			$replace_with = $shortcode_values[ $atts['tag'] ];
853
+		if ( isset( $shortcode_values[$atts['tag']] ) ) {
854
+			$replace_with = $shortcode_values[$atts['tag']];
855 855
 		} elseif ( in_array( $atts['tag'], $dynamic_default ) ) {
856 856
 			$replace_with = self::dynamic_default_values( $atts['tag'], $atts );
857 857
 		} elseif ( $clean_tag === 'user_agent' ) {
@@ -1062,8 +1062,8 @@  discard block
 block discarded – undo
1062 1062
 			self::field_types_for_input( $single_input, $field_selection, $field_types );
1063 1063
 		} elseif ( in_array( $type, $multiple_input ) ) {
1064 1064
 			self::field_types_for_input( $multiple_input, $field_selection, $field_types );
1065
-		} elseif ( isset( $field_selection[ $type ] ) ) {
1066
-			$field_types[ $type ] = $field_selection[ $type ];
1065
+		} elseif ( isset( $field_selection[$type] ) ) {
1066
+			$field_types[$type] = $field_selection[$type];
1067 1067
 		}
1068 1068
 
1069 1069
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) );
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 
1097 1097
 	private static function field_types_for_input( $inputs, $fields, &$field_types ) {
1098 1098
 		foreach ( $inputs as $input ) {
1099
-			$field_types[ $input ] = $fields[ $input ];
1099
+			$field_types[$input] = $fields[$input];
1100 1100
 			unset( $input );
1101 1101
 		}
1102 1102
 	}
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 			'parent'  => false,
1129 1129
 			'pointer' => false,
1130 1130
 		);
1131
-		$args     = wp_parse_args( $args, $defaults );
1131
+		$args = wp_parse_args( $args, $defaults );
1132 1132
 
1133 1133
 		$opt_key   = $args['opt_key'];
1134 1134
 		$field     = $args['field'];
@@ -1144,24 +1144,24 @@  discard block
 block discarded – undo
1144 1144
 
1145 1145
 		// Check posted vals before checking saved values
1146 1146
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
1147
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1147
+		if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1148 1148
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
1149 1149
 				// phpcs:ignore WordPress.Security.NonceVerification.Missing
1150
-				$other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : '';
1150
+				$other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ) : '';
1151 1151
 			} else {
1152
-				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1152
+				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1153 1153
 			}
1154 1154
 
1155 1155
 			return $other_val;
1156 1156
 
1157
-		} elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1157
+		} elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1158 1158
 			// For normal fields
1159 1159
 
1160 1160
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
1161 1161
 				// phpcs:ignore WordPress.Security.NonceVerification.Missing
1162
-				$other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : '';
1162
+				$other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : '';
1163 1163
 			} else {
1164
-				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1164
+				$other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1165 1165
 			}
1166 1166
 
1167 1167
 			return $other_val;
@@ -1171,8 +1171,8 @@  discard block
 block discarded – undo
1171 1171
 		if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) {
1172 1172
 			// Check if there is an "other" val in saved value and make sure the
1173 1173
 			// "other" val is not equal to the Other checkbox option
1174
-			if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
1175
-				$other_val = $field['value'][ $opt_key ];
1174
+			if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) {
1175
+				$other_val = $field['value'][$opt_key];
1176 1176
 			}
1177 1177
 		} else {
1178 1178
 			/**
@@ -1184,8 +1184,8 @@  discard block
 block discarded – undo
1184 1184
 				// Multi-select dropdowns - key is not preserved
1185 1185
 				if ( is_array( $field['value'] ) ) {
1186 1186
 					$o_key = array_search( $temp_val, $field['value'] );
1187
-					if ( isset( $field['value'][ $o_key ] ) ) {
1188
-						unset( $field['value'][ $o_key ], $o_key );
1187
+					if ( isset( $field['value'][$o_key] ) ) {
1188
+						unset( $field['value'][$o_key], $o_key );
1189 1189
 					}
1190 1190
 				} elseif ( $temp_val == $field['value'] ) {
1191 1191
 					// For radio and regular dropdowns
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 			return $other_args;
1228 1228
 		}
1229 1229
 
1230
-		$other_opt  = true;
1230
+		$other_opt = true;
1231 1231
 
1232 1232
 		self::set_other_name( $args, $other_args );
1233 1233
 		self::set_other_value( $args, $other_args );
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
 		if ( is_array( $val ) ) {
1396 1396
 			foreach ( $val as $k => $v ) {
1397 1397
 				if ( is_string( $v ) ) {
1398
-					$val[ $k ] = str_replace( $replace, $replace_with, $v );
1398
+					$val[$k] = str_replace( $replace, $replace_with, $v );
1399 1399
 					unset( $k, $v );
1400 1400
 				}
1401 1401
 			}
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 			$countries['class'] = 'frm-countries-opts';
1749 1749
 		}
1750 1750
 
1751
-		$prepop[ __( 'Countries', 'formidable' ) ] = $countries;
1751
+		$prepop[__( 'Countries', 'formidable' )] = $countries;
1752 1752
 
1753 1753
 		// State abv.
1754 1754
 		$states    = self::get_us_states();
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 			$state_abv['class'] = 'frm-state-abv-opts';
1759 1759
 		}
1760 1760
 
1761
-		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1761
+		$prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv;
1762 1762
 
1763 1763
 		// States.
1764 1764
 		$states = array_values( $states );
@@ -1767,7 +1767,7 @@  discard block
 block discarded – undo
1767 1767
 			$states['class'] = 'frm-states-opts';
1768 1768
 		}
1769 1769
 
1770
-		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1770
+		$prepop[__( 'U.S. States', 'formidable' )] = $states;
1771 1771
 		unset( $state_abv, $states );
1772 1772
 
1773 1773
 		// Age.
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
 			$ages['class'] = 'frm-age-opts';
1786 1786
 		}
1787 1787
 
1788
-		$prepop[ __( 'Age', 'formidable' ) ] = $ages;
1788
+		$prepop[__( 'Age', 'formidable' )] = $ages;
1789 1789
 
1790 1790
 		// Satisfaction.
1791 1791
 		$satisfaction = array(
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 			$satisfaction['class'] = 'frm-satisfaction-opts';
1801 1801
 		}
1802 1802
 
1803
-		$prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction;
1803
+		$prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction;
1804 1804
 
1805 1805
 		// Importance.
1806 1806
 		$importance = array(
@@ -1815,7 +1815,7 @@  discard block
 block discarded – undo
1815 1815
 			$importance['class'] = 'frm-importance-opts';
1816 1816
 		}
1817 1817
 
1818
-		$prepop[ __( 'Importance', 'formidable' ) ] = $importance;
1818
+		$prepop[__( 'Importance', 'formidable' )] = $importance;
1819 1819
 
1820 1820
 		// Agreement.
1821 1821
 		$agreement = array(
@@ -1830,7 +1830,7 @@  discard block
 block discarded – undo
1830 1830
 			$agreement['class'] = 'frm-agreement-opts';
1831 1831
 		}
1832 1832
 
1833
-		$prepop[ __( 'Agreement', 'formidable' ) ] = $agreement;
1833
+		$prepop[__( 'Agreement', 'formidable' )] = $agreement;
1834 1834
 
1835 1835
 		// Likely.
1836 1836
 		$likely = array(
@@ -1845,7 +1845,7 @@  discard block
 block discarded – undo
1845 1845
 			$likely['class'] = 'frm-likely-opts';
1846 1846
 		}
1847 1847
 
1848
-		$prepop[ __( 'Likely', 'formidable' ) ] = $likely;
1848
+		$prepop[__( 'Likely', 'formidable' )] = $likely;
1849 1849
 
1850 1850
 		$prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1851 1851
 	}
@@ -2052,16 +2052,16 @@  discard block
 block discarded – undo
2052 2052
 	 */
2053 2053
 	private static function fill_image_setting_options( $options, &$args ) {
2054 2054
 		foreach ( $options as $key => $option ) {
2055
-			$args['options'][ $key ] = $option;
2055
+			$args['options'][$key] = $option;
2056 2056
 
2057 2057
 			if ( ! empty( $option['addon'] ) ) {
2058
-				$args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option );
2058
+				$args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option );
2059 2059
 			}
2060 2060
 
2061
-			unset( $args['options'][ $key ]['addon'] );
2061
+			unset( $args['options'][$key]['addon'] );
2062 2062
 			$fill = array( 'upgrade', 'message', 'content' );
2063 2063
 			foreach ( $fill as $f ) {
2064
-				unset( $args['options'][ $key ][ $f ], $f );
2064
+				unset( $args['options'][$key][$f], $f );
2065 2065
 			}
2066 2066
 		}
2067 2067
 	}
@@ -2082,8 +2082,8 @@  discard block
 block discarded – undo
2082 2082
 
2083 2083
 		$fill = array( 'upgrade', 'message', 'content' );
2084 2084
 		foreach ( $fill as $f ) {
2085
-			if ( isset( $option[ $f ] ) ) {
2086
-				$custom_attrs[ 'data-' . $f ] = $option[ $f ];
2085
+			if ( isset( $option[$f] ) ) {
2086
+				$custom_attrs['data-' . $f] = $option[$f];
2087 2087
 			}
2088 2088
 		}
2089 2089
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -185,7 +185,8 @@  discard block
 block discarded – undo
185 185
 	 * @param mixed  $value
186 186
 	 */
187 187
 	private static function get_posted_field_setting( $setting, &$value ) {
188
-		if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
188
+		if ( ! isset( $_POST['field_options'][ $setting ] ) ) {
189
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
189 190
 			return;
190 191
 		}
191 192
 
@@ -1144,7 +1145,8 @@  discard block
 block discarded – undo
1144 1145
 
1145 1146
 		// Check posted vals before checking saved values
1146 1147
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
1147
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1148
+		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
1149
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
1148 1150
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
1149 1151
 				// phpcs:ignore WordPress.Security.NonceVerification.Missing
1150 1152
 				$other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : '';
@@ -1154,7 +1156,8 @@  discard block
 block discarded – undo
1154 1156
 
1155 1157
 			return $other_val;
1156 1158
 
1157
-		} elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1159
+		} elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) {
1160
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
1158 1161
 			// For normal fields
1159 1162
 
1160 1163
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
Please login to merge, or discard this patch.
classes/models/FrmEntryValidate.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 			return $errors;
21 21
 		}
22 22
 
23
-		if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) {
23
+		if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values['frm_submit_entry_' . $values['form_id']] ) || ! wp_verify_nonce( $values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce' ) ) ) {
24 24
 			$frm_settings   = FrmAppHelper::get_settings();
25 25
 			$errors['form'] = $frm_settings->admin_permission;
26 26
 		}
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 			'exclude'         => array(),
121 121
 
122 122
 		);
123
-		$args     = wp_parse_args( $args, $defaults );
123
+		$args = wp_parse_args( $args, $defaults );
124 124
 
125 125
 		if ( empty( $args['parent_field_id'] ) ) {
126
-			$value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : '';
126
+			$value = isset( $values['item_meta'][$args['id']] ) ? $values['item_meta'][$args['id']] : '';
127 127
 		} else {
128 128
 			// value is from a nested form
129 129
 			$value = $values;
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		}
145 145
 
146 146
 		if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) {
147
-			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
147
+			$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
148 148
 		} elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
149 149
 			self::maybe_add_item_name( $value, $posted_field );
150 150
 		}
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			$pattern = self::phone_format( $field );
223 223
 
224 224
 			if ( ! preg_match( $pattern, $value ) ) {
225
-				$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
225
+				$errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' );
226 226
 			}
227 227
 		}
228 228
 	}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 */
333 333
 	private static function form_is_in_progress( $values ) {
334 334
 		return FrmAppHelper::pro_is_installed() &&
335
-			( isset( $values[ 'frm_page_order_' . $values['form_id'] ] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) &&
335
+			( isset( $values['frm_page_order_' . $values['form_id']] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) &&
336 336
 			FrmField::get_all_types_in_form( $values['form_id'], 'break' );
337 337
 	}
338 338
 
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 			foreach ( $datas['missing_keys'] as $key_index => $key ) {
577 577
 				$found = self::is_akismet_guest_info_value( $key, $value, $field_id, $datas['name_field_ids'] );
578 578
 				if ( $found ) {
579
-					$datas[ $key ]             = $value;
579
+					$datas[$key]             = $value;
580 580
 					$datas['frm_duplicated'][] = $field_id;
581
-					unset( $datas['missing_keys'][ $key_index ] );
581
+					unset( $datas['missing_keys'][$key_index] );
582 582
 				}
583 583
 			}
584 584
 		}//end foreach
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 
625 625
 			// Send any potentially useful $_SERVER vars, but avoid sending junk we don't need.
626 626
 			if ( $include_value ) {
627
-				$datas[ $key ] = $value;
627
+				$datas[$key] = $value;
628 628
 			}
629 629
 			unset( $key, $value );
630 630
 		}
@@ -641,10 +641,10 @@  discard block
 block discarded – undo
641 641
 	private static function add_comment_content_to_akismet( &$datas, $values ) {
642 642
 		if ( isset( $datas['frm_duplicated'] ) ) {
643 643
 			foreach ( $datas['frm_duplicated'] as $index ) {
644
-				if ( isset( $values['item_meta'][ $index ] ) ) {
645
-					unset( $values['item_meta'][ $index ] );
644
+				if ( isset( $values['item_meta'][$index] ) ) {
645
+					unset( $values['item_meta'][$index] );
646 646
 				} else {
647
-					unset( $values[ $index ] );
647
+					unset( $values[$index] );
648 648
 				}
649 649
 			}
650 650
 			unset( $datas['frm_duplicated'] );
@@ -665,14 +665,14 @@  discard block
 block discarded – undo
665 665
 	private static function skip_adding_values_to_akismet( &$values ) {
666 666
 		$skipped_fields = self::get_akismet_skipped_field_ids( $values );
667 667
 		foreach ( $skipped_fields as $skipped_field ) {
668
-			if ( ! isset( $values['item_meta'][ $skipped_field->id ] ) ) {
668
+			if ( ! isset( $values['item_meta'][$skipped_field->id] ) ) {
669 669
 				continue;
670 670
 			}
671 671
 
672 672
 			if ( self::should_really_skip_field( $skipped_field, $values ) ) {
673
-				unset( $values['item_meta'][ $skipped_field->id ] );
674
-				if ( isset( $values['item_meta']['other'][ $skipped_field->id ] ) ) {
675
-					unset( $values['item_meta']['other'][ $skipped_field->id ] );
673
+				unset( $values['item_meta'][$skipped_field->id] );
674
+				if ( isset( $values['item_meta']['other'][$skipped_field->id] ) ) {
675
+					unset( $values['item_meta']['other'][$skipped_field->id] );
676 676
 				}
677 677
 			}
678 678
 		}
@@ -708,14 +708,14 @@  discard block
 block discarded – undo
708 708
 		}
709 709
 
710 710
 		// If a choice field has Other option, but Other is not selected.
711
-		if ( empty( $values['item_meta']['other'][ $field_data->id ] ) ) {
711
+		if ( empty( $values['item_meta']['other'][$field_data->id] ) ) {
712 712
 			return true;
713 713
 		}
714 714
 
715 715
 		// Check if submitted value is same as one of field option.
716 716
 		foreach ( $field_data->options as $option ) {
717 717
 			$option_value = ! is_array( $option ) ? $option : ( isset( $option['value'] ) ? $option['value'] : '' );
718
-			if ( $values['item_meta']['other'][ $field_data->id ] === $option_value ) {
718
+			if ( $values['item_meta']['other'][$field_data->id] === $option_value ) {
719 719
 				return true;
720 720
 			}
721 721
 		}
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 
787 787
 			// Convert name array to string.
788 788
 			if ( isset( $value['first'] ) && isset( $value['last'] ) ) {
789
-				$values['item_meta'][ $field_id ] = trim( implode( ' ', $value ) );
789
+				$values['item_meta'][$field_id] = trim( implode( ' ', $value ) );
790 790
 				$values['name_field_ids'][]       = $field_id;
791 791
 				continue;
792 792
 			}
@@ -807,8 +807,8 @@  discard block
 block discarded – undo
807 807
 						continue;
808 808
 					}
809 809
 
810
-					if ( ! isset( $values['item_meta'][ $subsubindex ] ) ) {
811
-						$values['item_meta'][ $subsubindex ] = array();
810
+					if ( ! isset( $values['item_meta'][$subsubindex] ) ) {
811
+						$values['item_meta'][$subsubindex] = array();
812 812
 					}
813 813
 
814 814
 					// Convert name array to string.
@@ -818,11 +818,11 @@  discard block
 block discarded – undo
818 818
 						$values['name_field_ids'][] = $subsubindex;
819 819
 					}
820 820
 
821
-					$values['item_meta'][ $subsubindex ][] = $subsubvalue;
821
+					$values['item_meta'][$subsubindex][] = $subsubvalue;
822 822
 				}
823 823
 			}//end foreach
824 824
 
825
-			unset( $values['item_meta'][ $field_id ] );
825
+			unset( $values['item_meta'][$field_id] );
826 826
 		}//end foreach
827 827
 
828 828
 		return $form_ids;
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -145,7 +145,8 @@
 block discarded – undo
145 145
 
146 146
 		if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) {
147 147
 			$errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' );
148
-		} elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
148
+		} elseif ( ! isset( $_POST['item_name'] ) ) {
149
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
149 150
 			self::maybe_add_item_name( $value, $posted_field );
150 151
 		}
151 152
 
Please login to merge, or discard this patch.