Completed
Push — master ( ed9e0f...db8711 )
by Stephanie
16s queued 12s
created
classes/helpers/FrmSerializedStringParserHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,12 +65,12 @@
 block discarded – undo
65 65
 				$string->read( 1 );
66 66
 
67 67
 				$val = array();
68
-				for ( $i = 0; $i < $count; $i++ ) {
68
+				for ( $i = 0; $i < $count; $i ++ ) {
69 69
 					$array_key   = $this->do_parse( $string );
70 70
 					$array_value = $this->do_parse( $string );
71 71
 
72 72
 					if ( ! is_array( $array_key ) ) {
73
-						$val[ $array_key ] = $array_value;
73
+						$val[$array_key] = $array_value;
74 74
 					}
75 75
 				}
76 76
 
Please login to merge, or discard this patch.
classes/helpers/FrmOnSubmitHelper.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -240,26 +240,26 @@  discard block
 block discarded – undo
240 240
 	public static function populate_on_submit_data( &$form_options, $action = null, $event = 'create' ) {
241 241
 		$opt = 'update' === $event ? 'edit_' : 'success_';
242 242
 		if ( ! $action || ! is_object( $action ) ) {
243
-			$form_options[ $opt . 'action' ] = self::get_default_action_type();
244
-			$form_options[ $opt . 'msg' ]    = self::get_default_msg();
243
+			$form_options[$opt . 'action'] = self::get_default_action_type();
244
+			$form_options[$opt . 'msg']    = self::get_default_msg();
245 245
 
246 246
 			return;
247 247
 		}
248 248
 
249
-		$form_options[ $opt . 'action' ] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message';
249
+		$form_options[$opt . 'action'] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message';
250 250
 
251
-		switch ( $form_options[ $opt . 'action' ] ) {
251
+		switch ( $form_options[$opt . 'action'] ) {
252 252
 			case 'redirect':
253
-				$form_options[ $opt . 'url' ]    = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : '';
253
+				$form_options[$opt . 'url']    = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : '';
254 254
 				$form_options['open_in_new_tab'] = ! empty( $action->post_content['open_in_new_tab'] );
255 255
 				break;
256 256
 
257 257
 			case 'page':
258
-				$form_options[ $opt . 'page_id' ] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : '';
258
+				$form_options[$opt . 'page_id'] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : '';
259 259
 				break;
260 260
 
261 261
 			default:
262
-				$form_options[ $opt . 'msg' ] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg();
262
+				$form_options[$opt . 'msg'] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg();
263 263
 				$form_options['show_form']    = ! empty( $action->post_content['show_form'] );
264 264
 		}
265 265
 	}
@@ -348,20 +348,20 @@  discard block
 block discarded – undo
348 348
 	private static function get_on_submit_action_data_from_form_options( $form_options, $event = 'create' ) {
349 349
 		$opt  = 'update' === $event ? 'edit_' : 'success_';
350 350
 		$data = array(
351
-			'success_action' => isset( $form_options[ $opt . 'action' ] ) ? $form_options[ $opt . 'action' ] : self::get_default_action_type(),
351
+			'success_action' => isset( $form_options[$opt . 'action'] ) ? $form_options[$opt . 'action'] : self::get_default_action_type(),
352 352
 		);
353 353
 
354 354
 		switch ( $data['success_action'] ) {
355 355
 			case 'redirect':
356
-				$data['success_url'] = isset( $form_options[ $opt . 'url' ] ) ? $form_options[ $opt . 'url' ] : '';
356
+				$data['success_url'] = isset( $form_options[$opt . 'url'] ) ? $form_options[$opt . 'url'] : '';
357 357
 				break;
358 358
 
359 359
 			case 'page':
360
-				$data['success_page_id'] = isset( $form_options[ $opt . 'page_id' ] ) ? $form_options[ $opt . 'page_id' ] : '';
360
+				$data['success_page_id'] = isset( $form_options[$opt . 'page_id'] ) ? $form_options[$opt . 'page_id'] : '';
361 361
 				break;
362 362
 
363 363
 			default:
364
-				$data['success_msg'] = isset( $form_options[ $opt . 'msg' ] ) ? $form_options[ $opt . 'msg' ] : self::get_default_msg();
364
+				$data['success_msg'] = isset( $form_options[$opt . 'msg'] ) ? $form_options[$opt . 'msg'] : self::get_default_msg();
365 365
 				$data['show_form']   = ! empty( $form_options['show_form'] );
366 366
 		}
367 367
 
Please login to merge, or discard this patch.
classes/models/FrmForm.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			}
210 210
 
211 211
 			if ( $new_val !== $value ) {
212
-				$new_values[ $key ] = $new_val;
212
+				$new_values[$key] = $new_val;
213 213
 			}
214 214
 		}
215 215
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 		foreach ( $values as $value_key => $value ) {
242 242
 			if ( $value_key && in_array( $value_key, $form_fields ) ) {
243
-				$new_values[ $value_key ] = $value;
243
+				$new_values[$value_key] = $value;
244 244
 			}
245 245
 		}
246 246
 
@@ -323,15 +323,15 @@  discard block
 block discarded – undo
323 323
 		$existing_keys = array_keys( $values['item_meta'] );
324 324
 		foreach ( $all_fields as $fid ) {
325 325
 			if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) {
326
-				$values['item_meta'][ $fid->id ] = '';
326
+				$values['item_meta'][$fid->id] = '';
327 327
 			}
328
-			$field_array[ $fid->id ] = $fid;
328
+			$field_array[$fid->id] = $fid;
329 329
 		}
330 330
 		unset( $all_fields );
331 331
 
332 332
 		foreach ( $values['item_meta'] as $field_id => $default_value ) {
333
-			if ( isset( $field_array[ $field_id ] ) ) {
334
-				$field = $field_array[ $field_id ];
333
+			if ( isset( $field_array[$field_id] ) ) {
334
+				$field = $field_array[$field_id];
335 335
 			} else {
336 336
 				$field = FrmField::getOne( $field_id );
337 337
 			}
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 				continue;
341 341
 			}
342 342
 
343
-			$is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) );
343
+			$is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) );
344 344
 			if ( $is_settings_page ) {
345 345
 				self::get_settings_page_html( $values, $field );
346 346
 
@@ -355,22 +355,22 @@  discard block
 block discarded – undo
355 355
 			$update_options = apply_filters( 'frm_field_options_to_update', $update_options );
356 356
 
357 357
 			foreach ( $update_options as $opt => $default ) {
358
-				$field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default;
359
-				self::sanitize_field_opt( $opt, $field->field_options[ $opt ] );
358
+				$field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default;
359
+				self::sanitize_field_opt( $opt, $field->field_options[$opt] );
360 360
 			}
361 361
 
362 362
 			$field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values );
363 363
 
364 364
 			$new_field = array(
365 365
 				'field_options' => $field->field_options,
366
-				'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '',
366
+				'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '',
367 367
 			);
368 368
 
369
-			if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) {
370
-				foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) {
369
+			if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) {
370
+				foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) {
371 371
 					if ( is_array( $option ) ) {
372 372
 						foreach ( $option as $key => $item ) {
373
-							$values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' );
373
+							$values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' );
374 374
 						}
375 375
 					}
376 376
 				}
@@ -458,11 +458,11 @@  discard block
 block discarded – undo
458 458
 	 * Updating the settings page
459 459
 	 */
460 460
 	private static function get_settings_page_html( $values, &$field ) {
461
-		if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) {
461
+		if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) {
462 462
 			$prev_opts     = array();
463 463
 			$fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type );
464 464
 
465
-			$field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html;
465
+			$field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html;
466 466
 		} elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) {
467 467
 			$prev_opts = $field->field_options;
468 468
 		}
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 		foreach ( $field_cols as $col => $default ) {
489 489
 			$default = ( $default === '' ) ? $field->{$col} : $default;
490 490
 
491
-			$new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default;
491
+			$new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default;
492 492
 		}
493 493
 
494 494
 		// Don't save the template option.
@@ -910,8 +910,8 @@  discard block
 block discarded – undo
910 910
 			self::maybe_get_form( $form );
911 911
 		}
912 912
 
913
-		if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) {
914
-			return $frm_vars['form_params'][ $form->id ];
913
+		if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) {
914
+			return $frm_vars['form_params'][$form->id];
915 915
 		}
916 916
 
917 917
 		$action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing
@@ -940,15 +940,15 @@  discard block
 block discarded – undo
940 940
 			//if there are two forms on the same page, make sure not to submit both
941 941
 			foreach ( $default_values as $var => $default ) {
942 942
 				if ( $var == 'action' ) {
943
-					$values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' );
943
+					$values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' );
944 944
 				} else {
945
-					$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
945
+					$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
946 946
 				}
947 947
 				unset( $var, $default );
948 948
 			}
949 949
 		} else {
950 950
 			foreach ( $default_values as $var => $default ) {
951
-				$values[ $var ] = $default;
951
+				$values[$var] = $default;
952 952
 				unset( $var, $default );
953 953
 			}
954 954
 		}
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
 			'sdir'     => '',
975 975
 		);
976 976
 		foreach ( $defaults as $var => $default ) {
977
-			$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
977
+			$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
978 978
 		}
979 979
 
980 980
 		return $values;
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 			'keep_post' => '',
1003 1003
 		);
1004 1004
 		foreach ( $defaults as $var => $default ) {
1005
-			$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1005
+			$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1006 1006
 		}
1007 1007
 
1008 1008
 		return $values;
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 		$form = $atts['form'];
1106 1106
 		$default = isset( $atts['default'] ) ? $atts['default'] : '';
1107 1107
 
1108
-		return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default;
1108
+		return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default;
1109 1109
 	}
1110 1110
 
1111 1111
 	/**
Please login to merge, or discard this patch.
classes/controllers/FrmFormsController.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 			),
531 531
 		);
532 532
 
533
-		if ( ! isset( $available_status[ $status ] ) ) {
533
+		if ( ! isset( $available_status[$status] ) ) {
534 534
 			return;
535 535
 		}
536 536
 
537
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
537
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
538 538
 
539 539
 		$params = FrmForm::list_page_params();
540 540
 
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 		check_admin_referer( $status . '_form_' . $params['id'] );
543 543
 
544 544
 		$count = 0;
545
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
545
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
546 546
 			$count ++;
547 547
 		}
548 548
 
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 		/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
560 560
 		$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>' );
561 561
 
562
-		$message = $available_status[ $status ]['message'];
562
+		$message = $available_status[$status]['message'];
563 563
 
564 564
 		self::display_forms_list( $params, $message );
565 565
 	}
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 				'type'  => 'request',
581 581
 			)
582 582
 		);
583
-		$message      = sprintf(
583
+		$message = sprintf(
584 584
 			/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
585 585
 			_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' ),
586 586
 			$count,
@@ -1004,11 +1004,11 @@  discard block
 block discarded – undo
1004 1004
 			}
1005 1005
 
1006 1006
 			foreach ( $template['categories'] as $category ) {
1007
-				if ( ! isset( $templates_by_category[ $category ] ) ) {
1008
-					$templates_by_category[ $category ] = array();
1007
+				if ( ! isset( $templates_by_category[$category] ) ) {
1008
+					$templates_by_category[$category] = array();
1009 1009
 				}
1010 1010
 
1011
-				$templates_by_category[ $category ][] = $template;
1011
+				$templates_by_category[$category][] = $template;
1012 1012
 			}
1013 1013
 		}
1014 1014
 		unset( $template );
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 		$forms                    = FrmForm::get_published_forms( $where );
1038 1038
 		$view_path                = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/';
1039 1039
 
1040
-		$templates_by_category[ $my_templates_translation ] = $custom_templates;
1040
+		$templates_by_category[$my_templates_translation] = $custom_templates;
1041 1041
 
1042 1042
 		unset( $pricing, $license_type, $where );
1043 1043
 		wp_enqueue_script( 'accordion' ); // register accordion for template groups
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
 
1281 1281
 		foreach ( array( 'landing', 'chat' ) as $feature ) {
1282 1282
 			if ( ! FrmAppHelper::show_new_feature( $feature ) ) {
1283
-				unset( $sections[ $feature ] );
1283
+				unset( $sections[$feature] );
1284 1284
 			}
1285 1285
 		}
1286 1286
 
@@ -1313,7 +1313,7 @@  discard block
 block discarded – undo
1313 1313
 				$section['id'] = $section['anchor'];
1314 1314
 			}
1315 1315
 
1316
-			$sections[ $key ] = $section;
1316
+			$sections[$key] = $section;
1317 1317
 		}
1318 1318
 
1319 1319
 		return $sections;
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 		if ( ! empty( $user_fields ) ) {
1432 1432
 			$user_helpers = array();
1433 1433
 			foreach ( $user_fields as $uk => $uf ) {
1434
-				$user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
1434
+				$user_helpers['|user_id| show="' . $uk . '"'] = $uf;
1435 1435
 				unset( $uk, $uf );
1436 1436
 			}
1437 1437
 
@@ -1570,7 +1570,7 @@  discard block
 block discarded – undo
1570 1570
 		if ( ! isset( $frm_vars['js_validate_forms'] ) ) {
1571 1571
 			$frm_vars['js_validate_forms'] = array();
1572 1572
 		}
1573
-		$frm_vars['js_validate_forms'][ $form->id ] = $form;
1573
+		$frm_vars['js_validate_forms'][$form->id] = $form;
1574 1574
 	}
1575 1575
 
1576 1576
 	public static function get_email_html() {
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1726 1726
 			} else {
1727 1727
 				$vars   = FrmAppHelper::json_to_array( $json_vars );
1728
-				$action = $vars[ $action ];
1728
+				$action = $vars[$action];
1729 1729
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1730 1730
 				$_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1731 1731
 				$_POST    = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
 		$actions = array();
1860 1860
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
1861 1861
 			if ( is_object( $form ) ) {
1862
-				$actions[ $form->id ] = $form->name;
1862
+				$actions[$form->id] = $form->name;
1863 1863
 			}
1864 1864
 			unset( $form );
1865 1865
 		}
@@ -2103,8 +2103,8 @@  discard block
 block discarded – undo
2103 2103
 	private static function get_saved_errors( $form, $params ) {
2104 2104
 		global $frm_vars;
2105 2105
 
2106
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2107
-			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
2106
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2107
+			$errors = $frm_vars['created_entries'][$form->id]['errors'];
2108 2108
 		} else {
2109 2109
 			$errors = array();
2110 2110
 		}
@@ -2126,7 +2126,7 @@  discard block
 block discarded – undo
2126 2126
 	public static function just_created_entry( $form_id ) {
2127 2127
 		global $frm_vars;
2128 2128
 
2129
-		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;
2129
+		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;
2130 2130
 	}
2131 2131
 
2132 2132
 	/**
@@ -2146,7 +2146,7 @@  discard block
 block discarded – undo
2146 2146
 	private static function get_confirmation_method( $atts ) {
2147 2147
 		$action = FrmOnSubmitHelper::current_event( $atts );
2148 2148
 		$opt    = 'update' === $action ? 'edit_action' : 'success_action';
2149
-		$method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message';
2149
+		$method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message';
2150 2150
 
2151 2151
 		if ( ! empty( $atts['entry_id'] ) ) {
2152 2152
 			$met_actions = self::get_met_on_submit_actions( $atts, $action );
@@ -2167,7 +2167,7 @@  discard block
 block discarded – undo
2167 2167
 	public static function maybe_trigger_redirect( $form, $params, $args ) {
2168 2168
 		if ( ! isset( $params['id'] ) ) {
2169 2169
 			global $frm_vars;
2170
-			$params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
2170
+			$params['id'] = $frm_vars['created_entries'][$form->id]['entry_id'];
2171 2171
 		}
2172 2172
 
2173 2173
 		$conf_method = self::get_confirmation_method(
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
 		$args['success_opt'] = $opt;
2250 2250
 		$args['ajax']        = ! empty( $frm_vars['ajax'] );
2251 2251
 
2252
-		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) {
2252
+		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) {
2253 2253
 			self::load_page_after_submit( $args );
2254 2254
 		} elseif ( $args['conf_method'] === 'redirect' ) {
2255 2255
 			self::redirect_after_submit( $args );
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
 		}
2274 2274
 
2275 2275
 		// If a redirect action has already opened the URL in a new tab, we show the default message in the currect tab.
2276
-		if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) {
2276
+		if ( ! empty( self::$redirected_in_new_tab[$args['form']->id] ) ) {
2277 2277
 			return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) );
2278 2278
 		}
2279 2279
 
@@ -2460,7 +2460,7 @@  discard block
 block discarded – undo
2460 2460
 
2461 2461
 		$opt = 'update' === $args['action'] ? 'edit_' : 'success_';
2462 2462
 
2463
-		$new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ];
2463
+		$new_args['conf_method'] = $new_args['form']->options[$opt . 'action'];
2464 2464
 
2465 2465
 		/**
2466 2466
 		 * Filters the run success action args.
@@ -2480,8 +2480,8 @@  discard block
 block discarded – undo
2480 2480
 	private static function load_page_after_submit( $args ) {
2481 2481
 		global $post;
2482 2482
 		$opt = $args['success_opt'];
2483
-		if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
2484
-			$page     = get_post( $args['form']->options[ $opt . '_page_id' ] );
2483
+		if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) {
2484
+			$page     = get_post( $args['form']->options[$opt . '_page_id'] );
2485 2485
 			$old_post = $post;
2486 2486
 			$post     = $page;
2487 2487
 			$content  = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] );
@@ -2511,7 +2511,7 @@  discard block
 block discarded – undo
2511 2511
 		add_filter( 'frm_use_wpautop', '__return_false' );
2512 2512
 
2513 2513
 		$opt         = $args['success_opt'];
2514
-		$success_url = trim( $args['form']->options[ $opt . '_url' ] );
2514
+		$success_url = trim( $args['form']->options[$opt . '_url'] );
2515 2515
 		$success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] );
2516 2516
 		$success_url = do_shortcode( $success_url );
2517 2517
 
@@ -2531,7 +2531,7 @@  discard block
 block discarded – undo
2531 2531
 		if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { // Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2532 2532
 			if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
2533 2533
 				self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args );
2534
-				self::$redirected_in_new_tab[ $args['form']->id ] = 1;
2534
+				self::$redirected_in_new_tab[$args['form']->id] = 1;
2535 2535
 				return;
2536 2536
 			}
2537 2537
 
@@ -2790,7 +2790,7 @@  discard block
 block discarded – undo
2790 2790
 			'description' => false,
2791 2791
 			'reset'       => false,
2792 2792
 		);
2793
-		$args     = wp_parse_args( $args, $defaults );
2793
+		$args = wp_parse_args( $args, $defaults );
2794 2794
 	}
2795 2795
 
2796 2796
 	/**
@@ -2828,7 +2828,7 @@  discard block
 block discarded – undo
2828 2828
 		$opt          = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success';
2829 2829
 
2830 2830
 		if ( $entry_id && is_numeric( $entry_id ) ) {
2831
-			$message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg;
2831
+			$message = isset( $form->options[$opt . '_msg'] ) ? $form->options[$opt . '_msg'] : $frm_settings->success_msg;
2832 2832
 			$class   = 'frm_message';
2833 2833
 		} else {
2834 2834
 			$message = $frm_settings->failed_msg;
@@ -3052,7 +3052,7 @@  discard block
 block discarded – undo
3052 3052
 
3053 3053
 		check_ajax_referer( 'frm_ajax', 'nonce' );
3054 3054
 
3055
-		$html             = FrmAppHelper::clip(
3055
+		$html = FrmAppHelper::clip(
3056 3056
 			function() {
3057 3057
 				FrmAppHelper::maybe_autocomplete_pages_options(
3058 3058
 					array(
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1708,7 +1708,8 @@  discard block
 block discarded – undo
1708 1708
 		$vars   = array();
1709 1709
 		FrmAppHelper::include_svg();
1710 1710
 
1711
-		if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
1711
+		if ( isset( $_POST['frm_compact_fields'] ) ) {
1712
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
1712 1713
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
1713 1714
 
1714 1715
 			// Javascript needs to be allowed in some field settings.
@@ -2018,7 +2019,8 @@  discard block
 block discarded – undo
2018 2019
 	private static function maybe_get_form_to_show( $id ) {
2019 2020
 		$form = false;
2020 2021
 
2021
-		if ( ! empty( $id ) ) { // form id or key is set
2022
+		if ( ! empty( $id ) ) {
2023
+// form id or key is set
2022 2024
 			$form = FrmForm::getOne( $id );
2023 2025
 			if ( ! $form || $form->parent_form_id || $form->status === 'trash' ) {
2024 2026
 				$form = false;
@@ -2103,7 +2105,8 @@  discard block
 block discarded – undo
2103 2105
 	private static function get_saved_errors( $form, $params ) {
2104 2106
 		global $frm_vars;
2105 2107
 
2106
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2108
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) {
2109
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
2107 2110
 			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
2108 2111
 		} else {
2109 2112
 			$errors = array();
@@ -2294,7 +2297,8 @@  discard block
 block discarded – undo
2294 2297
 			$action_type = FrmOnSubmitHelper::get_action_type( $action );
2295 2298
 
2296 2299
 			if ( 'redirect' === $action_type ) {
2297
-				if ( $has_redirect ) { // Do not process because we run the first redirect action only.
2300
+				if ( $has_redirect ) {
2301
+// Do not process because we run the first redirect action only.
2298 2302
 					continue;
2299 2303
 				}
2300 2304
 			}
@@ -2523,12 +2527,14 @@  discard block
 block discarded – undo
2523 2527
 
2524 2528
 		$doing_ajax = FrmAppHelper::doing_ajax();
2525 2529
 
2526
-		if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) { // Is AJAX submit and there is just one Redirect action runs.
2530
+		if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) {
2531
+// Is AJAX submit and there is just one Redirect action runs.
2527 2532
 			echo json_encode( self::get_ajax_redirect_response_data( $args + compact( 'success_url' ) ) );
2528 2533
 			wp_die();
2529 2534
 		}
2530 2535
 
2531
-		if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { // Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2536
+		if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) {
2537
+// Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2532 2538
 			if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
2533 2539
 				self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args );
2534 2540
 				self::$redirected_in_new_tab[ $args['form']->id ] = 1;
@@ -2628,7 +2634,8 @@  discard block
 block discarded – undo
2628 2634
 
2629 2635
 		echo FrmAppHelper::maybe_kses( $redirect_msg ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2630 2636
 		echo '<script>';
2631
-		if ( empty( $args['doing_ajax'] ) ) { // Not AJAX submit, delay JS until window.load.
2637
+		if ( empty( $args['doing_ajax'] ) ) {
2638
+// Not AJAX submit, delay JS until window.load.
2632 2639
 			echo 'window.onload=function(){';
2633 2640
 		}
2634 2641
 		echo 'setTimeout(function(){' . $redirect_js . '}, ' . intval( $delay_time ) . ');'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
Please login to merge, or discard this patch.
classes/controllers/FrmSimpleBlocksController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
 			return false;
77 77
 		}
78 78
 
79
-		return $addons[ $addon_id ];
79
+		return $addons[$addon_id];
80 80
 	}
81 81
 
82 82
 	/**
Please login to merge, or discard this patch.
classes/controllers/FrmAddonsController.php 1 patch
Spacing   +14 added lines, -14 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
 	}
@@ -352,16 +352,16 @@  discard block
 block discarded – undo
352 352
 				continue;
353 353
 			}
354 354
 
355
-			$wp_plugin  = isset( $wp_plugins[ $folder ] ) ? $wp_plugins[ $folder ] : array();
355
+			$wp_plugin  = isset( $wp_plugins[$folder] ) ? $wp_plugins[$folder] : array();
356 356
 			$wp_version = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0';
357 357
 
358 358
 			if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) {
359 359
 				$slug                           = explode( '/', $folder );
360 360
 				$plugin->slug                   = $slug[0];
361
-				$transient->response[ $folder ] = $plugin;
361
+				$transient->response[$folder] = $plugin;
362 362
 			}
363 363
 
364
-			$transient->checked[ $folder ] = $wp_version;
364
+			$transient->checked[$folder] = $wp_version;
365 365
 
366 366
 		}
367 367
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 	 */
395 395
 	protected static function is_installed( $plugin ) {
396 396
 		$all_plugins = self::get_plugins();
397
-		return isset( $all_plugins[ $plugin ] );
397
+		return isset( $all_plugins[$plugin] );
398 398
 	}
399 399
 
400 400
 	/**
@@ -433,13 +433,13 @@  discard block
 block discarded – undo
433 433
 			}
434 434
 
435 435
 			$download_id = isset( $plugin['id'] ) ? $plugin['id'] : 0;
436
-			if ( ! empty( $download_id ) && ! isset( $version_info[ $download_id ]['package'] ) ) {
436
+			if ( ! empty( $download_id ) && ! isset( $version_info[$download_id]['package'] ) ) {
437 437
 				// if this addon is using its own license, get the update url
438 438
 				$addon_info = $api->get_api_info();
439 439
 
440
-				$version_info[ $download_id ] = $addon_info[ $download_id ];
440
+				$version_info[$download_id] = $addon_info[$download_id];
441 441
 				if ( isset( $addon_info['error'] ) ) {
442
-					$version_info[ $download_id ]['error'] = array(
442
+					$version_info[$download_id]['error'] = array(
443 443
 						'message' => $addon_info['error']['message'],
444 444
 						'code'    => $addon_info['error']['code'],
445 445
 					);
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
 					return $addon;
539 539
 				}
540 540
 			}
541
-		} elseif ( isset( $addons[ $download_id ] ) ) {
542
-			$plugin = $addons[ $download_id ];
541
+		} elseif ( isset( $addons[$download_id] ) ) {
542
+			$plugin = $addons[$download_id];
543 543
 		}
544 544
 
545 545
 		return $plugin;
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 			self::prepare_addon_link( $addon['link'] );
604 604
 
605 605
 			self::set_addon_status( $addon );
606
-			$addons[ $id ] = $addon;
606
+			$addons[$id] = $addon;
607 607
 		}
608 608
 	}
609 609
 
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 			'utm_medium'   => 'addons',
645 645
 			'utm_campaign' => 'liteplugin',
646 646
 		);
647
-		$link       = add_query_arg( $query_args, $link );
647
+		$link = add_query_arg( $query_args, $link );
648 648
 	}
649 649
 
650 650
 	/**
@@ -1365,7 +1365,7 @@  discard block
 block discarded – undo
1365 1365
 		$addons = $api->get_api_info();
1366 1366
 
1367 1367
 		if ( is_array( $addons ) && array_key_exists( $addon_id, $addons ) ) {
1368
-			$dates    = $addons[ $addon_id ];
1368
+			$dates    = $addons[$addon_id];
1369 1369
 			$requires = FrmFormsHelper::get_plan_required( $dates );
1370 1370
 		}
1371 1371
 
Please login to merge, or discard this patch.
classes/factories/FrmFieldFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
 			'credit_card' => 'FrmFieldCreditCard',
109 109
 		);
110 110
 
111
-		$class = isset( $type_classes[ $field_type ] ) ? $type_classes[ $field_type ] : '';
111
+		$class = isset( $type_classes[$field_type] ) ? $type_classes[$field_type] : '';
112 112
 
113 113
 		return apply_filters( 'frm_get_field_type_class', $class, $field_type );
114 114
 	}
Please login to merge, or discard this patch.
classes/models/FrmField.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		$values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) );
273 273
 
274 274
 		foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) {
275
-			$new_values[ $col ] = $values[ $col ];
275
+			$new_values[$col] = $values[$col];
276 276
 		}
277 277
 
278 278
 		$new_values['options']       = self::maybe_filter_options( $values['options'] );
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		$new_values['created_at']    = current_time( 'mysql', 1 );
284 284
 
285 285
 		if ( isset( $values['id'] ) ) {
286
-			$frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key'];
286
+			$frm_duplicate_ids[$values['field_key']] = $new_values['field_key'];
287 287
 			$new_values                                = apply_filters( 'frm_duplicated_field', $new_values );
288 288
 		}
289 289
 
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 		foreach ( $new_values as $k => $v ) {
293 293
 			if ( is_array( $v ) ) {
294 294
 				if ( $k === 'default_value' ) {
295
-					$new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v );
295
+					$new_values[$k] = FrmAppHelper::maybe_json_encode( $v );
296 296
 				} else {
297
-					$new_values[ $k ] = serialize( $v );
297
+					$new_values[$k] = serialize( $v );
298 298
 				}
299 299
 			}
300 300
 			unset( $k, $v );
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		}
315 315
 
316 316
 		if ( isset( $values['id'] ) ) {
317
-			$frm_duplicate_ids[ $values['id'] ] = $new_id;
317
+			$frm_duplicate_ids[$values['id']] = $new_id;
318 318
 		}
319 319
 
320 320
 		return $new_id;
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) {
375 375
 		global $frm_duplicate_ids;
376 376
 
377
-		$where  = array(
377
+		$where = array(
378 378
 			array(
379 379
 				'or'                => 1,
380 380
 				'fi.form_id'        => $old_form_id,
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 
421 421
 			$values                                 = apply_filters( 'frm_duplicated_field', $values );
422 422
 			$new_id                                 = self::create( $values );
423
-			$frm_duplicate_ids[ $field->id ]        = $new_id;
424
-			$frm_duplicate_ids[ $field->field_key ] = $new_id;
423
+			$frm_duplicate_ids[$field->id]        = $new_id;
424
+			$frm_duplicate_ids[$field->field_key] = $new_id;
425 425
 			unset( $field );
426 426
 		}
427 427
 	}
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
 
454 454
 		// serialize array values
455 455
 		foreach ( array( 'field_options', 'options' ) as $opt ) {
456
-			if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) {
456
+			if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) {
457 457
 				if ( 'field_options' === $opt ) {
458
-					$values[ $opt ] = self::maybe_filter_options( $values[ $opt ] );
458
+					$values[$opt] = self::maybe_filter_options( $values[$opt] );
459 459
 				}
460
-				$values[ $opt ] = serialize( $values[ $opt ] );
460
+				$values[$opt] = serialize( $values[$opt] );
461 461
 			}
462 462
 		}
463 463
 		if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) {
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 				'id'        => $id,
610 610
 				'field_key' => $id,
611 611
 			);
612
-			$type  = FrmDb::get_var( 'frm_fields', $where, $col );
612
+			$type = FrmDb::get_var( 'frm_fields', $where, $col );
613 613
 		}
614 614
 
615 615
 		return $type;
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 					continue;
636 636
 				}
637 637
 
638
-				$fields[ $result->id ] = $result;
638
+				$fields[$result->id] = $result;
639 639
 				$count ++;
640 640
 				if ( $limit == 1 ) {
641 641
 					$fields = $result;
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 			$count  = 0;
682 682
 			foreach ( $results as $result ) {
683 683
 				$count ++;
684
-				$fields[ $result->id ] = $result;
684
+				$fields[$result->id] = $result;
685 685
 				if ( ! empty( $limit ) && $count >= $limit ) {
686 686
 					break;
687 687
 				}
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 			}
751 751
 
752 752
 			if ( ! empty( $sub_fields ) ) {
753
-				$index        = $k + $index_offset;
753
+				$index = $k + $index_offset;
754 754
 				$index_offset += count( $sub_fields );
755 755
 				array_splice( $results, $index, 0, $sub_fields );
756 756
 			}
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 		$query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results';
796 796
 
797 797
 		if ( is_array( $where ) ) {
798
-			$args    = array(
798
+			$args = array(
799 799
 				'order_by' => $order_by,
800 800
 				'limit'    => $limit,
801 801
 			);
@@ -826,9 +826,9 @@  discard block
 block discarded – undo
826 826
 				FrmDb::set_cache( $result->field_key, $result, 'frm_field' );
827 827
 
828 828
 				self::prepare_options( $result );
829
-				$results[ $r_key ]->field_options = $result->field_options;
830
-				$results[ $r_key ]->options       = $result->options;
831
-				$results[ $r_key ]->default_value = $result->default_value;
829
+				$results[$r_key]->field_options = $result->field_options;
830
+				$results[$r_key]->options       = $result->options;
831
+				$results[$r_key]->default_value = $result->default_value;
832 832
 
833 833
 				unset( $r_key, $result );
834 834
 			}
@@ -1030,23 +1030,23 @@  discard block
 block discarded – undo
1030 1030
 	}
1031 1031
 
1032 1032
 	public static function is_option_true_in_array( $field, $option ) {
1033
-		return isset( $field[ $option ] ) && $field[ $option ];
1033
+		return isset( $field[$option] ) && $field[$option];
1034 1034
 	}
1035 1035
 
1036 1036
 	public static function is_option_true_in_object( $field, $option ) {
1037
-		return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ];
1037
+		return isset( $field->field_options[$option] ) && $field->field_options[$option];
1038 1038
 	}
1039 1039
 
1040 1040
 	public static function is_option_empty_in_array( $field, $option ) {
1041
-		return ! isset( $field[ $option ] ) || empty( $field[ $option ] );
1041
+		return ! isset( $field[$option] ) || empty( $field[$option] );
1042 1042
 	}
1043 1043
 
1044 1044
 	public static function is_option_empty_in_object( $field, $option ) {
1045
-		return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] );
1045
+		return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] );
1046 1046
 	}
1047 1047
 
1048 1048
 	public static function is_option_value_in_object( $field, $option ) {
1049
-		return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != '';
1049
+		return isset( $field->field_options[$option] ) && $field->field_options[$option] != '';
1050 1050
 	}
1051 1051
 
1052 1052
 	/**
@@ -1064,10 +1064,10 @@  discard block
 block discarded – undo
1064 1064
 
1065 1065
 	public static function get_option_in_array( $field, $option ) {
1066 1066
 
1067
-		if ( isset( $field[ $option ] ) ) {
1068
-			$this_option = $field[ $option ];
1069
-		} elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) {
1070
-			$this_option = $field['field_options'][ $option ];
1067
+		if ( isset( $field[$option] ) ) {
1068
+			$this_option = $field[$option];
1069
+		} elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) {
1070
+			$this_option = $field['field_options'][$option];
1071 1071
 		} else {
1072 1072
 			$this_option = '';
1073 1073
 		}
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 	}
1077 1077
 
1078 1078
 	public static function get_option_in_object( $field, $option ) {
1079
-		return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : '';
1079
+		return isset( $field->field_options[$option] ) ? $field->field_options[$option] : '';
1080 1080
 	}
1081 1081
 
1082 1082
 	/**
Please login to merge, or discard this patch.
classes/models/FrmFormAction.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -5,15 +5,15 @@  discard block
 block discarded – undo
5 5
 
6 6
 class FrmFormAction {
7 7
 
8
-	public $id_base;         // Root id for all actions of this type.
9
-	public $name;            // Name for this action type.
8
+	public $id_base; // Root id for all actions of this type.
9
+	public $name; // Name for this action type.
10 10
 	public $option_name;
11
-	public $action_options;  // Option array passed to wp_register_sidebar_widget()
11
+	public $action_options; // Option array passed to wp_register_sidebar_widget()
12 12
 	public $control_options; // Option array passed to wp_register_widget_control()
13 13
 
14
-	public $form_id;         // The ID of the form to evaluate
15
-	public $number = false;  // Unique ID number of the current instance.
16
-	public $id = '';         // Unique ID string of the current instance (id_base-number)
14
+	public $form_id; // The ID of the form to evaluate
15
+	public $number = false; // Unique ID number of the current instance.
16
+	public $id = ''; // Unique ID string of the current instance (id_base-number)
17 17
 	public $updated = false; // Set true when we update the data after a POST submit - makes sure we don't do it twice.
18 18
 
19 19
 	// Member functions that you must over-ride.
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 		$groups = FrmFormActionsController::form_action_groups();
157 157
 		$group  = 'misc';
158 158
 
159
-		if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) {
159
+		if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) {
160 160
 			$group = $action_options['group'];
161
-		} elseif ( isset( $groups[ $this->id_base ] ) ) {
161
+		} elseif ( isset( $groups[$this->id_base] ) ) {
162 162
 			$group = $this->id_base;
163 163
 		} else {
164 164
 			foreach ( $groups as $name => $check_group ) {
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 			}
170 170
 		}
171 171
 
172
-		$groups[ $group ]['id'] = $group;
173
-		return $groups[ $group ];
172
+		$groups[$group]['id'] = $group;
173
+		return $groups[$group];
174 174
 	}
175 175
 
176 176
 	/**
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 * @return integer $post_id
281 281
 	 */
282 282
 	public function maybe_create_action( $action, $forms ) {
283
-		if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) {
283
+		if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) {
284 284
 			// Update action only
285 285
 			$action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] );
286 286
 			$post_id                = $this->save_settings( $action );
@@ -303,18 +303,18 @@  discard block
 block discarded – undo
303 303
 		$switch             = $this->get_global_switch_fields();
304 304
 
305 305
 		foreach ( (array) $action->post_content as $key => $val ) {
306
-			if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) {
307
-				$action->post_content[ $key ] = $frm_duplicate_ids[ $val ];
306
+			if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) {
307
+				$action->post_content[$key] = $frm_duplicate_ids[$val];
308 308
 			} elseif ( ! is_array( $val ) ) {
309
-				$action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val );
310
-			} elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) {
309
+				$action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val );
310
+			} elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) {
311 311
 				// loop through each value if empty
312
-				if ( empty( $switch[ $key ] ) ) {
313
-					$switch[ $key ] = array_keys( $val );
312
+				if ( empty( $switch[$key] ) ) {
313
+					$switch[$key] = array_keys( $val );
314 314
 				}
315 315
 
316
-				foreach ( $switch[ $key ] as $subkey ) {
317
-					$action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val );
316
+				foreach ( $switch[$key] as $subkey ) {
317
+					$action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val );
318 318
 				}
319 319
 			}
320 320
 
@@ -332,20 +332,20 @@  discard block
 block discarded – undo
332 332
 			foreach ( $subkey as $subkey2 ) {
333 333
 				foreach ( (array) $val as $ck => $cv ) {
334 334
 					if ( is_array( $cv ) ) {
335
-						$action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv );
336
-					} elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) {
337
-						$action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ];
335
+						$action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv );
336
+					} elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) {
337
+						$action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]];
338 338
 					}
339 339
 				}
340 340
 			}
341 341
 		} else {
342 342
 			foreach ( (array) $val as $ck => $cv ) {
343 343
 				if ( is_array( $cv ) ) {
344
-					$action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv );
345
-				} elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) {
346
-					$action[ $ck ] = $frm_duplicate_ids[ $cv ];
344
+					$action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv );
345
+				} elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) {
346
+					$action[$ck] = $frm_duplicate_ids[$cv];
347 347
 				} elseif ( $ck == $subkey ) {
348
-					$action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] );
348
+					$action[$ck] = $this->maybe_switch_field_ids( $action[$ck] );
349 349
 				}
350 350
 			}
351 351
 		}
@@ -369,10 +369,10 @@  discard block
 block discarded – undo
369 369
 		}
370 370
 
371 371
 		// phpcs:ignore WordPress.Security.NonceVerification.Missing
372
-		if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) {
372
+		if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) {
373 373
 			// Sanitizing removes scripts and <email> type of values.
374 374
 			// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
375
-			$settings = wp_unslash( $_POST[ $this->option_name ] );
375
+			$settings = wp_unslash( $_POST[$this->option_name] );
376 376
 		} else {
377 377
 			return;
378 378
 		}
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 		foreach ( $settings as $number => $new_instance ) {
383 383
 			$this->_set( $number );
384 384
 
385
-			$old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array();
385
+			$old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array();
386 386
 
387 387
 			if ( ! isset( $new_instance['post_status'] ) ) {
388 388
 				$new_instance['post_status'] = 'draft';
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 			$instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this );
422 422
 
423 423
 			if ( false !== $instance ) {
424
-				$all_instances[ $number ] = $instance;
424
+				$all_instances[$number] = $instance;
425 425
 			}
426 426
 
427 427
 			$action_ids[] = $this->save_settings( $instance );
@@ -503,12 +503,12 @@  discard block
 block discarded – undo
503 503
 			// some plugins/themes are formatting the post_excerpt
504 504
 			$action->post_excerpt = sanitize_title( $action->post_excerpt );
505 505
 
506
-			if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) {
506
+			if ( ! isset( $action_controls[$action->post_excerpt] ) ) {
507 507
 				continue;
508 508
 			}
509 509
 
510
-			$action                  = $action_controls[ $action->post_excerpt ]->prepare_action( $action );
511
-			$settings[ $action->ID ] = $action;
510
+			$action                  = $action_controls[$action->post_excerpt]->prepare_action( $action );
511
+			$settings[$action->ID] = $action;
512 512
 
513 513
 			if ( count( $settings ) >= $limit ) {
514 514
 				break;
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 			'limit'       => 99,
542 542
 			'post_status' => $default_status,
543 543
 		);
544
-		$args     = wp_parse_args( $args, $defaults );
544
+		$args = wp_parse_args( $args, $defaults );
545 545
 	}
546 546
 
547 547
 	/**
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 
608 608
 			$action = $this->prepare_action( $action );
609 609
 
610
-			$settings[ $action->ID ] = $action;
610
+			$settings[$action->ID] = $action;
611 611
 		}
612 612
 
613 613
 		if ( 1 === $limit ) {
@@ -650,10 +650,10 @@  discard block
 block discarded – undo
650 650
 
651 651
 		foreach ( $default_values as $k => $vals ) {
652 652
 			if ( is_array( $vals ) && ! empty( $vals ) ) {
653
-				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) {
653
+				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) {
654 654
 					continue;
655 655
 				}
656
-				$action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals );
656
+				$action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals );
657 657
 			}
658 658
 		}
659 659
 
@@ -736,14 +736,14 @@  discard block
 block discarded – undo
736 736
 	 * Migrate settings from form->options into new action.
737 737
 	 */
738 738
 	public function migrate_to_2( $form, $update = 'update' ) {
739
-		$action        = $this->prepare_new( $form->id );
739
+		$action = $this->prepare_new( $form->id );
740 740
 		FrmAppHelper::unserialize_or_decode( $form->options );
741 741
 
742 742
 		// fill with existing options
743 743
 		foreach ( $action->post_content as $name => $val ) {
744
-			if ( isset( $form->options[ $name ] ) ) {
745
-				$action->post_content[ $name ] = $form->options[ $name ];
746
-				unset( $form->options[ $name ] );
744
+			if ( isset( $form->options[$name] ) ) {
745
+				$action->post_content[$name] = $form->options[$name];
746
+				unset( $form->options[$name] );
747 747
 			}
748 748
 		}
749 749
 
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 				$stop = $stop ? false : true;
810 810
 			}
811 811
 
812
-			$met[ $stop ] = $stop;
812
+			$met[$stop] = $stop;
813 813
 		}
814 814
 
815 815
 		if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) {
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
 	private static function get_value_from_entry( $entry, $field_id ) {
864 864
 		$observed_value = '';
865 865
 
866
-		if ( isset( $entry->metas[ $field_id ] ) ) {
867
-			$observed_value = $entry->metas[ $field_id ];
866
+		if ( isset( $entry->metas[$field_id] ) ) {
867
+			$observed_value = $entry->metas[$field_id];
868 868
 		} elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) {
869 869
 			$field          = FrmField::getOne( $field_id );
870 870
 			$observed_value = FrmProEntryMetaHelper::get_post_or_meta_value(
Please login to merge, or discard this patch.