Completed
Pull Request — master (#2239)
by
unknown
35s
created
classes/controllers/FrmFormsController.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 			 * @param string|null $src
667 667
 			 * @return string
668 668
 			 */
669
-			function ( $src ) {
669
+			function( $src ) {
670 670
 				if ( is_null( $src ) ) {
671 671
 					$src = '';
672 672
 				}
@@ -731,11 +731,11 @@  discard block
 block discarded – undo
731 731
 			),
732 732
 		);
733 733
 
734
-		if ( ! isset( $available_status[ $status ] ) ) {
734
+		if ( ! isset( $available_status[$status] ) ) {
735 735
 			return;
736 736
 		}
737 737
 
738
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
738
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
739 739
 
740 740
 		$params = FrmForm::list_page_params();
741 741
 
@@ -743,8 +743,8 @@  discard block
 block discarded – undo
743 743
 		check_admin_referer( $status . '_form_' . $params['id'] );
744 744
 
745 745
 		$count = 0;
746
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
747
-			++$count;
746
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
747
+			++ $count;
748 748
 		}
749 749
 
750 750
 		$form_type = FrmAppHelper::get_simple_request(
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 		/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
761 761
 		$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>' );
762 762
 
763
-		$message = $available_status[ $status ]['message'];
763
+		$message = $available_status[$status]['message'];
764 764
 
765 765
 		self::display_forms_list( $params, $message );
766 766
 	}
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 		$count = 0;
776 776
 		foreach ( $ids as $id ) {
777 777
 			if ( FrmForm::trash( $id ) ) {
778
-				++$count;
778
+				++ $count;
779 779
 			}
780 780
 		}
781 781
 
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 				'type'  => 'request',
790 790
 			)
791 791
 		);
792
-		$message      = sprintf(
792
+		$message = sprintf(
793 793
 			/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
794 794
 			_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' ),
795 795
 			$count,
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 
811 811
 		$count = 0;
812 812
 		if ( FrmForm::destroy( $params['id'] ) ) {
813
-			++$count;
813
+			++ $count;
814 814
 		}
815 815
 
816 816
 		/* translators: %1$s: Number of forms */
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 		foreach ( $ids as $id ) {
831 831
 			$d = FrmForm::destroy( $id );
832 832
 			if ( $d ) {
833
-				++$count;
833
+				++ $count;
834 834
 			}
835 835
 		}
836 836
 
@@ -1323,7 +1323,7 @@  discard block
 block discarded – undo
1323 1323
 
1324 1324
 		add_action(
1325 1325
 			'wp_enqueue_editor',
1326
-			function () {
1326
+			function() {
1327 1327
 				wp_print_media_templates();
1328 1328
 			}
1329 1329
 		);
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
 
1433 1433
 		foreach ( array( 'landing', 'chat', 'abandonment' ) as $feature ) {
1434 1434
 			if ( ! FrmAppHelper::show_new_feature( $feature ) ) {
1435
-				unset( $sections[ $feature ] );
1435
+				unset( $sections[$feature] );
1436 1436
 			}
1437 1437
 		}
1438 1438
 
@@ -1460,7 +1460,7 @@  discard block
 block discarded – undo
1460 1460
 				$section['id'] = $section['anchor'];
1461 1461
 			}
1462 1462
 
1463
-			$sections[ $key ] = $section;
1463
+			$sections[$key] = $section;
1464 1464
 		}//end foreach
1465 1465
 
1466 1466
 		return $sections;
@@ -1583,7 +1583,7 @@  discard block
 block discarded – undo
1583 1583
 		if ( $user_fields ) {
1584 1584
 			$user_helpers = array();
1585 1585
 			foreach ( $user_fields as $uk => $uf ) {
1586
-				$user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
1586
+				$user_helpers['|user_id| show="' . $uk . '"'] = $uf;
1587 1587
 				unset( $uk, $uf );
1588 1588
 			}
1589 1589
 
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 		if ( ! isset( $frm_vars['js_validate_forms'] ) ) {
1718 1718
 			$frm_vars['js_validate_forms'] = array();
1719 1719
 		}
1720
-		$frm_vars['js_validate_forms'][ $form->id ] = $form;
1720
+		$frm_vars['js_validate_forms'][$form->id] = $form;
1721 1721
 	}
1722 1722
 
1723 1723
 	public static function get_email_html() {
@@ -1888,7 +1888,7 @@  discard block
 block discarded – undo
1888 1888
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1889 1889
 			} else {
1890 1890
 				$vars   = FrmAppHelper::json_to_array( $json_vars );
1891
-				$action = $vars[ $action ];
1891
+				$action = $vars[$action];
1892 1892
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1893 1893
 				$_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1894 1894
 				$_POST    = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
@@ -2051,7 +2051,7 @@  discard block
 block discarded – undo
2051 2051
 		$actions = array();
2052 2052
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
2053 2053
 			if ( is_object( $form ) ) {
2054
-				$actions[ $form->id ] = $form->name;
2054
+				$actions[$form->id] = $form->name;
2055 2055
 			}
2056 2056
 			unset( $form );
2057 2057
 		}
@@ -2296,8 +2296,8 @@  discard block
 block discarded – undo
2296 2296
 	private static function get_saved_errors( $form, $params ) {
2297 2297
 		global $frm_vars;
2298 2298
 
2299
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2300
-			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
2299
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2300
+			$errors = $frm_vars['created_entries'][$form->id]['errors'];
2301 2301
 		} else {
2302 2302
 			$errors = array();
2303 2303
 		}
@@ -2319,7 +2319,7 @@  discard block
 block discarded – undo
2319 2319
 	public static function just_created_entry( $form_id ) {
2320 2320
 		global $frm_vars;
2321 2321
 
2322
-		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;
2322
+		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;
2323 2323
 	}
2324 2324
 
2325 2325
 	/**
@@ -2339,7 +2339,7 @@  discard block
 block discarded – undo
2339 2339
 	private static function get_confirmation_method( $atts ) {
2340 2340
 		$action = FrmOnSubmitHelper::current_event( $atts );
2341 2341
 		$opt    = 'update' === $action ? 'edit_action' : 'success_action';
2342
-		$method = ! empty( $atts['form']->options[ $opt ] ) ? $atts['form']->options[ $opt ] : 'message';
2342
+		$method = ! empty( $atts['form']->options[$opt] ) ? $atts['form']->options[$opt] : 'message';
2343 2343
 
2344 2344
 		if ( ! empty( $atts['entry_id'] ) ) {
2345 2345
 			$met_actions = self::get_met_on_submit_actions( $atts, $action );
@@ -2360,7 +2360,7 @@  discard block
 block discarded – undo
2360 2360
 	public static function maybe_trigger_redirect( $form, $params, $args ) {
2361 2361
 		if ( ! isset( $params['id'] ) ) {
2362 2362
 			global $frm_vars;
2363
-			$params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
2363
+			$params['id'] = $frm_vars['created_entries'][$form->id]['entry_id'];
2364 2364
 		}
2365 2365
 
2366 2366
 		$conf_method = self::get_confirmation_method(
@@ -2442,7 +2442,7 @@  discard block
 block discarded – undo
2442 2442
 		$args['success_opt'] = $opt;
2443 2443
 		$args['ajax']        = ! empty( $frm_vars['ajax'] );
2444 2444
 
2445
-		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) {
2445
+		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) {
2446 2446
 			self::load_page_after_submit( $args );
2447 2447
 		} elseif ( $args['conf_method'] === 'redirect' ) {
2448 2448
 			self::redirect_after_submit( $args );
@@ -2466,7 +2466,7 @@  discard block
 block discarded – undo
2466 2466
 		}
2467 2467
 
2468 2468
 		// If a redirect action has already opened the URL in a new tab, we show the default message in the current tab.
2469
-		if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) {
2469
+		if ( ! empty( self::$redirected_in_new_tab[$args['form']->id] ) ) {
2470 2470
 			return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) );
2471 2471
 		}
2472 2472
 
@@ -2532,7 +2532,7 @@  discard block
 block discarded – undo
2532 2532
 	 * @return void
2533 2533
 	 */
2534 2534
 	public static function dismiss_default_email_message() {
2535
-		check_ajax_referer( 'frm_ajax',  'nonce' );
2535
+		check_ajax_referer( 'frm_ajax', 'nonce' );
2536 2536
 		update_user_meta( wp_get_current_user()->ID, 'frm_dismiss_default_email_message', 1 );
2537 2537
 	}
2538 2538
 
@@ -2666,7 +2666,7 @@  discard block
 block discarded – undo
2666 2666
 
2667 2667
 		$opt = 'update' === $args['action'] ? 'edit_' : 'success_';
2668 2668
 
2669
-		$new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ];
2669
+		$new_args['conf_method'] = $new_args['form']->options[$opt . 'action'];
2670 2670
 
2671 2671
 		/**
2672 2672
 		 * Filters the run success action args.
@@ -2686,8 +2686,8 @@  discard block
 block discarded – undo
2686 2686
 	private static function load_page_after_submit( $args ) {
2687 2687
 		global $post;
2688 2688
 		$opt = $args['success_opt'];
2689
-		if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
2690
-			$page     = get_post( $args['form']->options[ $opt . '_page_id' ] );
2689
+		if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) {
2690
+			$page     = get_post( $args['form']->options[$opt . '_page_id'] );
2691 2691
 			$old_post = $post;
2692 2692
 			$post     = $page;
2693 2693
 			$content  = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] );
@@ -2717,7 +2717,7 @@  discard block
 block discarded – undo
2717 2717
 		add_filter( 'frm_use_wpautop', '__return_false' );
2718 2718
 
2719 2719
 		$opt         = $args['success_opt'];
2720
-		$success_url = trim( $args['form']->options[ $opt . '_url' ] );
2720
+		$success_url = trim( $args['form']->options[$opt . '_url'] );
2721 2721
 		$success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] );
2722 2722
 		$success_url = do_shortcode( $success_url );
2723 2723
 
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
 			// Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2740 2740
 			if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
2741 2741
 				self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args );
2742
-				self::$redirected_in_new_tab[ $args['form']->id ] = 1;
2742
+				self::$redirected_in_new_tab[$args['form']->id] = 1;
2743 2743
 				return;
2744 2744
 			}
2745 2745
 
@@ -3019,7 +3019,7 @@  discard block
 block discarded – undo
3019 3019
 			'description' => false,
3020 3020
 			'reset'       => false,
3021 3021
 		);
3022
-		$args     = wp_parse_args( $args, $defaults );
3022
+		$args = wp_parse_args( $args, $defaults );
3023 3023
 	}
3024 3024
 
3025 3025
 	/**
@@ -3057,7 +3057,7 @@  discard block
 block discarded – undo
3057 3057
 		$opt          = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success';
3058 3058
 
3059 3059
 		if ( $entry_id && is_numeric( $entry_id ) ) {
3060
-			$message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg;
3060
+			$message = isset( $form->options[$opt . '_msg'] ) ? $form->options[$opt . '_msg'] : $frm_settings->success_msg;
3061 3061
 			$class   = 'frm_message';
3062 3062
 		} else {
3063 3063
 			$message = $frm_settings->failed_msg;
@@ -3280,8 +3280,8 @@  discard block
 block discarded – undo
3280 3280
 
3281 3281
 		check_ajax_referer( 'frm_ajax', 'nonce' );
3282 3282
 
3283
-		$html             = FrmAppHelper::clip(
3284
-			function () {
3283
+		$html = FrmAppHelper::clip(
3284
+			function() {
3285 3285
 				FrmAppHelper::maybe_autocomplete_pages_options(
3286 3286
 					array(
3287 3287
 						'field_name'  => 'frm_page_dropdown',
Please login to merge, or discard this patch.