Completed
Push — master ( 359baa...f4b3c0 )
by
unknown
01:21 queued 37s
created
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 int $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';
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 			$instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this );
475 475
 
476 476
 			if ( false !== $instance ) {
477
-				$all_instances[ $number ] = $instance;
477
+				$all_instances[$number] = $instance;
478 478
 			}
479 479
 
480 480
 			$action_ids[] = $this->save_settings( $instance );
@@ -560,12 +560,12 @@  discard block
 block discarded – undo
560 560
 			// some plugins/themes are formatting the post_excerpt
561 561
 			$action->post_excerpt = sanitize_title( $action->post_excerpt );
562 562
 
563
-			if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) {
563
+			if ( ! isset( $action_controls[$action->post_excerpt] ) ) {
564 564
 				continue;
565 565
 			}
566 566
 
567
-			$action                  = $action_controls[ $action->post_excerpt ]->prepare_action( $action );
568
-			$settings[ $action->ID ] = $action;
567
+			$action                  = $action_controls[$action->post_excerpt]->prepare_action( $action );
568
+			$settings[$action->ID] = $action;
569 569
 
570 570
 			if ( count( $settings ) >= $limit ) {
571 571
 				break;
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 	 * @return int The filtered limit value.
592 592
 	 */
593 593
 	public static function get_action_limit( $form_id, $limit = 99 ) {
594
-		$type  = 'all';
594
+		$type = 'all';
595 595
 		return (int) apply_filters( 'frm_form_action_limit', (int) $limit, compact( 'type', 'form_id' ) );
596 596
 	}
597 597
 
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 			'limit'       => 99,
615 615
 			'post_status' => $default_status,
616 616
 		);
617
-		$args     = wp_parse_args( $args, $defaults );
617
+		$args = wp_parse_args( $args, $defaults );
618 618
 	}
619 619
 
620 620
 	/**
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 
685 685
 			$action = $this->prepare_action( $action );
686 686
 
687
-			$settings[ $action->ID ] = $action;
687
+			$settings[$action->ID] = $action;
688 688
 		}
689 689
 
690 690
 		if ( 1 === $limit ) {
@@ -727,10 +727,10 @@  discard block
 block discarded – undo
727 727
 
728 728
 		foreach ( $default_values as $k => $vals ) {
729 729
 			if ( is_array( $vals ) && ! empty( $vals ) ) {
730
-				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) {
730
+				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) {
731 731
 					continue;
732 732
 				}
733
-				$action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals );
733
+				$action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals );
734 734
 			}
735 735
 		}
736 736
 
@@ -818,9 +818,9 @@  discard block
 block discarded – undo
818 818
 
819 819
 		// fill with existing options
820 820
 		foreach ( $action->post_content as $name => $val ) {
821
-			if ( isset( $form->options[ $name ] ) ) {
822
-				$action->post_content[ $name ] = $form->options[ $name ];
823
-				unset( $form->options[ $name ] );
821
+			if ( isset( $form->options[$name] ) ) {
822
+				$action->post_content[$name] = $form->options[$name];
823
+				unset( $form->options[$name] );
824 824
 			}
825 825
 		}
826 826
 
@@ -906,8 +906,8 @@  discard block
 block discarded – undo
906 906
 	private static function get_value_from_entry( $entry, $field_id ) {
907 907
 		$observed_value = '';
908 908
 
909
-		if ( isset( $entry->metas[ $field_id ] ) ) {
910
-			$observed_value = $entry->metas[ $field_id ];
909
+		if ( isset( $entry->metas[$field_id] ) ) {
910
+			$observed_value = $entry->metas[$field_id];
911 911
 		} elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) {
912 912
 			$field          = FrmField::getOne( $field_id );
913 913
 			$observed_value = FrmProEntryMetaHelper::get_post_or_meta_value(
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 		$form_fields = FrmField::get_all_for_form( $form_id, '', 'include' );
982 982
 		return array_filter(
983 983
 			$form_fields,
984
-			function ( $form_field ) {
984
+			function( $form_field ) {
985 985
 				return ! FrmField::is_no_save_field( $form_field->type );
986 986
 			}
987 987
 		);
Please login to merge, or discard this patch.