Completed
Pull Request — master (#1517)
by Stephanie
34s
created
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.
classes/models/FrmApplicationTemplate.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		 *
38 38
 		 * @param array $keys
39 39
 		 */
40
-		self::$keys             = apply_filters(
40
+		self::$keys = apply_filters(
41 41
 			'frm_application_data_keys',
42 42
 			array( 'key', 'name', 'description', 'link', 'categories', 'views', 'forms' )
43 43
 		);
@@ -115,17 +115,17 @@  discard block
 block discarded – undo
115 115
 	public function as_js_object() {
116 116
 		$application = array();
117 117
 		foreach ( self::$keys as $key ) {
118
-			if ( ! isset( $this->api_data[ $key ] ) ) {
118
+			if ( ! isset( $this->api_data[$key] ) ) {
119 119
 				continue;
120 120
 			}
121 121
 
122
-			$value = $this->api_data[ $key ];
122
+			$value = $this->api_data[$key];
123 123
 
124 124
 			if ( 'icon' === $key ) {
125 125
 				// Icon is an array. The first array item is the image URL.
126
-				$application[ $key ] = reset( $value );
126
+				$application[$key] = reset( $value );
127 127
 			} elseif ( 'categories' === $key ) {
128
-				$application[ $key ] = array_values(
128
+				$application[$key] = array_values(
129 129
 					array_filter(
130 130
 						$value,
131 131
 						function( $category ) {
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 					// Strip off the " Template" text at the end of the name as it takes up space.
145 145
 					$value = substr( $value, 0, -9 );
146 146
 				}
147
-				$application[ $key ] = $value;
147
+				$application[$key] = $value;
148 148
 			}//end if
149 149
 		}//end foreach
150 150
 
Please login to merge, or discard this patch.
classes/models/FrmFormAction.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 		$groups = FrmFormActionsController::form_action_groups();
209 209
 		$group  = 'misc';
210 210
 
211
-		if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) {
211
+		if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) {
212 212
 			$group = $action_options['group'];
213
-		} elseif ( isset( $groups[ $this->id_base ] ) ) {
213
+		} elseif ( isset( $groups[$this->id_base] ) ) {
214 214
 			$group = $this->id_base;
215 215
 		} else {
216 216
 			foreach ( $groups as $name => $check_group ) {
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 			}
222 222
 		}
223 223
 
224
-		$groups[ $group ]['id'] = $group;
225
-		return $groups[ $group ];
224
+		$groups[$group]['id'] = $group;
225
+		return $groups[$group];
226 226
 	}
227 227
 
228 228
 	/**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	 * @return integer $post_id
334 334
 	 */
335 335
 	public function maybe_create_action( $action, $forms ) {
336
-		if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) {
336
+		if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) {
337 337
 			// Update action only
338 338
 			$action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] );
339 339
 			$post_id                = $this->save_settings( $action );
@@ -356,18 +356,18 @@  discard block
 block discarded – undo
356 356
 		$switch             = $this->get_global_switch_fields();
357 357
 
358 358
 		foreach ( (array) $action->post_content as $key => $val ) {
359
-			if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) {
360
-				$action->post_content[ $key ] = $frm_duplicate_ids[ $val ];
359
+			if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) {
360
+				$action->post_content[$key] = $frm_duplicate_ids[$val];
361 361
 			} elseif ( ! is_array( $val ) ) {
362
-				$action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val );
363
-			} elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) {
362
+				$action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val );
363
+			} elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) {
364 364
 				// loop through each value if empty
365
-				if ( empty( $switch[ $key ] ) ) {
366
-					$switch[ $key ] = array_keys( $val );
365
+				if ( empty( $switch[$key] ) ) {
366
+					$switch[$key] = array_keys( $val );
367 367
 				}
368 368
 
369
-				foreach ( $switch[ $key ] as $subkey ) {
370
-					$action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val );
369
+				foreach ( $switch[$key] as $subkey ) {
370
+					$action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val );
371 371
 				}
372 372
 			}
373 373
 
@@ -385,20 +385,20 @@  discard block
 block discarded – undo
385 385
 			foreach ( $subkey as $subkey2 ) {
386 386
 				foreach ( (array) $val as $ck => $cv ) {
387 387
 					if ( is_array( $cv ) ) {
388
-						$action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv );
389
-					} elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) {
390
-						$action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ];
388
+						$action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv );
389
+					} elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) {
390
+						$action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]];
391 391
 					}
392 392
 				}
393 393
 			}
394 394
 		} else {
395 395
 			foreach ( (array) $val as $ck => $cv ) {
396 396
 				if ( is_array( $cv ) ) {
397
-					$action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv );
398
-				} elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) {
399
-					$action[ $ck ] = $frm_duplicate_ids[ $cv ];
397
+					$action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv );
398
+				} elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) {
399
+					$action[$ck] = $frm_duplicate_ids[$cv];
400 400
 				} elseif ( $ck == $subkey ) {
401
-					$action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] );
401
+					$action[$ck] = $this->maybe_switch_field_ids( $action[$ck] );
402 402
 				}
403 403
 			}
404 404
 		}//end if
@@ -422,10 +422,10 @@  discard block
 block discarded – undo
422 422
 		}
423 423
 
424 424
 		// phpcs:ignore WordPress.Security.NonceVerification.Missing
425
-		if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) {
425
+		if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) {
426 426
 			// Sanitizing removes scripts and <email> type of values.
427 427
 			// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
428
-			$settings = wp_unslash( $_POST[ $this->option_name ] );
428
+			$settings = wp_unslash( $_POST[$this->option_name] );
429 429
 		} else {
430 430
 			return;
431 431
 		}
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 		foreach ( $settings as $number => $new_instance ) {
436 436
 			$this->_set( $number );
437 437
 
438
-			$old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array();
438
+			$old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array();
439 439
 
440 440
 			if ( ! isset( $new_instance['post_status'] ) ) {
441 441
 				$new_instance['post_status'] = 'draft';
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 			$instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this );
474 474
 
475 475
 			if ( false !== $instance ) {
476
-				$all_instances[ $number ] = $instance;
476
+				$all_instances[$number] = $instance;
477 477
 			}
478 478
 
479 479
 			$action_ids[] = $this->save_settings( $instance );
@@ -555,12 +555,12 @@  discard block
 block discarded – undo
555 555
 			// some plugins/themes are formatting the post_excerpt
556 556
 			$action->post_excerpt = sanitize_title( $action->post_excerpt );
557 557
 
558
-			if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) {
558
+			if ( ! isset( $action_controls[$action->post_excerpt] ) ) {
559 559
 				continue;
560 560
 			}
561 561
 
562
-			$action                  = $action_controls[ $action->post_excerpt ]->prepare_action( $action );
563
-			$settings[ $action->ID ] = $action;
562
+			$action                  = $action_controls[$action->post_excerpt]->prepare_action( $action );
563
+			$settings[$action->ID] = $action;
564 564
 
565 565
 			if ( count( $settings ) >= $limit ) {
566 566
 				break;
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 			'limit'       => 99,
594 594
 			'post_status' => $default_status,
595 595
 		);
596
-		$args     = wp_parse_args( $args, $defaults );
596
+		$args = wp_parse_args( $args, $defaults );
597 597
 	}
598 598
 
599 599
 	/**
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 
660 660
 			$action = $this->prepare_action( $action );
661 661
 
662
-			$settings[ $action->ID ] = $action;
662
+			$settings[$action->ID] = $action;
663 663
 		}
664 664
 
665 665
 		if ( 1 === $limit ) {
@@ -702,10 +702,10 @@  discard block
 block discarded – undo
702 702
 
703 703
 		foreach ( $default_values as $k => $vals ) {
704 704
 			if ( is_array( $vals ) && ! empty( $vals ) ) {
705
-				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) {
705
+				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) {
706 706
 					continue;
707 707
 				}
708
-				$action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals );
708
+				$action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals );
709 709
 			}
710 710
 		}
711 711
 
@@ -788,14 +788,14 @@  discard block
 block discarded – undo
788 788
 	 * Migrate settings from form->options into new action.
789 789
 	 */
790 790
 	public function migrate_to_2( $form, $update = 'update' ) {
791
-		$action        = $this->prepare_new( $form->id );
791
+		$action = $this->prepare_new( $form->id );
792 792
 		FrmAppHelper::unserialize_or_decode( $form->options );
793 793
 
794 794
 		// fill with existing options
795 795
 		foreach ( $action->post_content as $name => $val ) {
796
-			if ( isset( $form->options[ $name ] ) ) {
797
-				$action->post_content[ $name ] = $form->options[ $name ];
798
-				unset( $form->options[ $name ] );
796
+			if ( isset( $form->options[$name] ) ) {
797
+				$action->post_content[$name] = $form->options[$name];
798
+				unset( $form->options[$name] );
799 799
 			}
800 800
 		}
801 801
 
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 				$stop = $stop ? false : true;
862 862
 			}
863 863
 
864
-			$met[ $stop ] = $stop;
864
+			$met[$stop] = $stop;
865 865
 		}//end foreach
866 866
 
867 867
 		if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) {
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
 	private static function get_value_from_entry( $entry, $field_id ) {
916 916
 		$observed_value = '';
917 917
 
918
-		if ( isset( $entry->metas[ $field_id ] ) ) {
919
-			$observed_value = $entry->metas[ $field_id ];
918
+		if ( isset( $entry->metas[$field_id] ) ) {
919
+			$observed_value = $entry->metas[$field_id];
920 920
 		} elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) {
921 921
 			$field          = FrmField::getOne( $field_id );
922 922
 			$observed_value = FrmProEntryMetaHelper::get_post_or_meta_value(
Please login to merge, or discard this patch.
classes/models/FrmEmailStats.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 * @param array $stats Statistics section data.
141 141
 	 */
142 142
 	protected function add_payments_data( &$stats ) {
143
-		$payment_data  = FrmEmailSummaryHelper::get_payments_data( $this->from_date, $this->to_date );
143
+		$payment_data = FrmEmailSummaryHelper::get_payments_data( $this->from_date, $this->to_date );
144 144
 		$stats['payments_count'] = array(
145 145
 			'label'   => __( 'Payments collected', 'formidable' ),
146 146
 			'count'   => $payment_data['count'],
@@ -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,
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		}
160 160
 
161 161
 		if ( $this->has_comparison ) {
162
-			$prev_payment_data  = FrmEmailSummaryHelper::get_payments_data( $this->prev_from_date, $this->prev_to_date );
162
+			$prev_payment_data = FrmEmailSummaryHelper::get_payments_data( $this->prev_from_date, $this->prev_to_date );
163 163
 
164 164
 			if ( ! $payment_data['count'] && ! $prev_payment_data['count'] ) {
165 165
 				// Maybe this site doesn't collect payment, hide these sections.
@@ -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   +12 added lines, -12 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
 
@@ -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.