Completed
Push — master ( 039ccc...41d4a3 )
by
unknown
18s
created
classes/controllers/FrmFormsController.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 			 * @param string|null $src
740 740
 			 * @return string
741 741
 			 */
742
-			function ( $src ) {
742
+			function( $src ) {
743 743
 				if ( is_null( $src ) ) {
744 744
 					$src = '';
745 745
 				}
@@ -804,11 +804,11 @@  discard block
 block discarded – undo
804 804
 			),
805 805
 		);
806 806
 
807
-		if ( ! isset( $available_status[ $status ] ) ) {
807
+		if ( ! isset( $available_status[$status] ) ) {
808 808
 			return;
809 809
 		}
810 810
 
811
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
811
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
812 812
 
813 813
 		$params = FrmForm::list_page_params();
814 814
 
@@ -816,8 +816,8 @@  discard block
 block discarded – undo
816 816
 		check_admin_referer( $status . '_form_' . $params['id'] );
817 817
 
818 818
 		$count = 0;
819
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
820
-			++$count;
819
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
820
+			++ $count;
821 821
 		}
822 822
 
823 823
 		$form_type = FrmAppHelper::get_simple_request(
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 		/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
834 834
 		$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>' );
835 835
 
836
-		$message = $available_status[ $status ]['message'];
836
+		$message = $available_status[$status]['message'];
837 837
 
838 838
 		self::display_forms_list( $params, $message );
839 839
 	}
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 		$count = 0;
849 849
 		foreach ( $ids as $id ) {
850 850
 			if ( FrmForm::trash( $id ) ) {
851
-				++$count;
851
+				++ $count;
852 852
 			}
853 853
 		}
854 854
 
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 				'type'  => 'request',
863 863
 			)
864 864
 		);
865
-		$message      = sprintf(
865
+		$message = sprintf(
866 866
 			/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
867 867
 			_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' ),
868 868
 			$count,
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 
884 884
 		$count = 0;
885 885
 		if ( FrmForm::destroy( $params['id'] ) ) {
886
-			++$count;
886
+			++ $count;
887 887
 		}
888 888
 
889 889
 		/* translators: %1$s: Number of forms */
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 		foreach ( $ids as $id ) {
904 904
 			$d = FrmForm::destroy( $id );
905 905
 			if ( $d ) {
906
-				++$count;
906
+				++ $count;
907 907
 			}
908 908
 		}
909 909
 
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
 
1405 1405
 		add_action(
1406 1406
 			'wp_enqueue_editor',
1407
-			function () {
1407
+			function() {
1408 1408
 				wp_print_media_templates();
1409 1409
 			}
1410 1410
 		);
@@ -1535,7 +1535,7 @@  discard block
 block discarded – undo
1535 1535
 				$section['id'] = $section['anchor'];
1536 1536
 			}
1537 1537
 
1538
-			$sections[ $key ] = $section;
1538
+			$sections[$key] = $section;
1539 1539
 		}//end foreach
1540 1540
 
1541 1541
 		return $sections;
@@ -1658,7 +1658,7 @@  discard block
 block discarded – undo
1658 1658
 		if ( $user_fields ) {
1659 1659
 			$user_helpers = array();
1660 1660
 			foreach ( $user_fields as $uk => $uf ) {
1661
-				$user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
1661
+				$user_helpers['|user_id| show="' . $uk . '"'] = $uf;
1662 1662
 				unset( $uk, $uf );
1663 1663
 			}
1664 1664
 
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
 		if ( ! isset( $frm_vars['js_validate_forms'] ) ) {
1793 1793
 			$frm_vars['js_validate_forms'] = array();
1794 1794
 		}
1795
-		$frm_vars['js_validate_forms'][ $form->id ] = $form;
1795
+		$frm_vars['js_validate_forms'][$form->id] = $form;
1796 1796
 	}
1797 1797
 
1798 1798
 	public static function get_email_html() {
@@ -1976,7 +1976,7 @@  discard block
 block discarded – undo
1976 1976
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1977 1977
 			} else {
1978 1978
 				$vars   = FrmAppHelper::json_to_array( $json_vars );
1979
-				$action = $vars[ $action ];
1979
+				$action = $vars[$action];
1980 1980
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1981 1981
 				$_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1982 1982
 				$_POST    = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
@@ -2159,7 +2159,7 @@  discard block
 block discarded – undo
2159 2159
 		$actions = array();
2160 2160
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
2161 2161
 			if ( is_object( $form ) ) {
2162
-				$actions[ $form->id ] = $form->name;
2162
+				$actions[$form->id] = $form->name;
2163 2163
 			}
2164 2164
 			unset( $form );
2165 2165
 		}
@@ -2404,8 +2404,8 @@  discard block
 block discarded – undo
2404 2404
 	private static function get_saved_errors( $form, $params ) {
2405 2405
 		global $frm_vars;
2406 2406
 
2407
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2408
-			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
2407
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2408
+			$errors = $frm_vars['created_entries'][$form->id]['errors'];
2409 2409
 		} else {
2410 2410
 			$errors = array();
2411 2411
 		}
@@ -2427,7 +2427,7 @@  discard block
 block discarded – undo
2427 2427
 	public static function just_created_entry( $form_id ) {
2428 2428
 		global $frm_vars;
2429 2429
 
2430
-		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;
2430
+		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;
2431 2431
 	}
2432 2432
 
2433 2433
 	/**
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
 	private static function get_confirmation_method( $atts ) {
2448 2448
 		$action = FrmOnSubmitHelper::current_event( $atts );
2449 2449
 		$opt    = 'update' === $action ? 'edit_action' : 'success_action';
2450
-		$method = ! empty( $atts['form']->options[ $opt ] ) ? $atts['form']->options[ $opt ] : 'message';
2450
+		$method = ! empty( $atts['form']->options[$opt] ) ? $atts['form']->options[$opt] : 'message';
2451 2451
 
2452 2452
 		if ( ! empty( $atts['entry_id'] ) ) {
2453 2453
 			$met_actions = self::get_met_on_submit_actions( $atts, $action );
@@ -2468,7 +2468,7 @@  discard block
 block discarded – undo
2468 2468
 	public static function maybe_trigger_redirect( $form, $params, $args ) {
2469 2469
 		if ( ! isset( $params['id'] ) ) {
2470 2470
 			global $frm_vars;
2471
-			$params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
2471
+			$params['id'] = $frm_vars['created_entries'][$form->id]['entry_id'];
2472 2472
 		}
2473 2473
 
2474 2474
 		$conf_method = self::get_confirmation_method(
@@ -2550,7 +2550,7 @@  discard block
 block discarded – undo
2550 2550
 		$args['success_opt'] = $opt;
2551 2551
 		$args['ajax']        = ! empty( $frm_vars['ajax'] );
2552 2552
 
2553
-		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) {
2553
+		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) {
2554 2554
 			self::load_page_after_submit( $args );
2555 2555
 		} elseif ( $args['conf_method'] === 'redirect' ) {
2556 2556
 			self::redirect_after_submit( $args );
@@ -2574,7 +2574,7 @@  discard block
 block discarded – undo
2574 2574
 		}
2575 2575
 
2576 2576
 		// If a redirect action has already opened the URL in a new tab, we show the default message in the current tab.
2577
-		if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) {
2577
+		if ( ! empty( self::$redirected_in_new_tab[$args['form']->id] ) ) {
2578 2578
 			return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) );
2579 2579
 		}
2580 2580
 
@@ -2762,7 +2762,7 @@  discard block
 block discarded – undo
2762 2762
 
2763 2763
 		$opt = 'update' === $args['action'] ? 'edit_' : 'success_';
2764 2764
 
2765
-		$new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ];
2765
+		$new_args['conf_method'] = $new_args['form']->options[$opt . 'action'];
2766 2766
 
2767 2767
 		/**
2768 2768
 		 * Filters the run success action args.
@@ -2782,8 +2782,8 @@  discard block
 block discarded – undo
2782 2782
 	private static function load_page_after_submit( $args ) {
2783 2783
 		global $post;
2784 2784
 		$opt = $args['success_opt'];
2785
-		if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
2786
-			$page     = get_post( $args['form']->options[ $opt . '_page_id' ] );
2785
+		if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) {
2786
+			$page     = get_post( $args['form']->options[$opt . '_page_id'] );
2787 2787
 			$old_post = $post;
2788 2788
 			$post     = $page;
2789 2789
 			$content  = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] );
@@ -2813,7 +2813,7 @@  discard block
 block discarded – undo
2813 2813
 		add_filter( 'frm_use_wpautop', '__return_false' );
2814 2814
 
2815 2815
 		$opt         = $args['success_opt'];
2816
-		$success_url = trim( $args['form']->options[ $opt . '_url' ] );
2816
+		$success_url = trim( $args['form']->options[$opt . '_url'] );
2817 2817
 		$success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] );
2818 2818
 		$success_url = do_shortcode( $success_url );
2819 2819
 
@@ -2835,7 +2835,7 @@  discard block
 block discarded – undo
2835 2835
 			// Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2836 2836
 			if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
2837 2837
 				self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args );
2838
-				self::$redirected_in_new_tab[ $args['form']->id ] = 1;
2838
+				self::$redirected_in_new_tab[$args['form']->id] = 1;
2839 2839
 				return;
2840 2840
 			}
2841 2841
 
@@ -3115,7 +3115,7 @@  discard block
 block discarded – undo
3115 3115
 			'description' => false,
3116 3116
 			'reset'       => false,
3117 3117
 		);
3118
-		$args     = wp_parse_args( $args, $defaults );
3118
+		$args = wp_parse_args( $args, $defaults );
3119 3119
 	}
3120 3120
 
3121 3121
 	/**
@@ -3153,7 +3153,7 @@  discard block
 block discarded – undo
3153 3153
 		$opt          = $args['success_opt'] ?? 'success';
3154 3154
 
3155 3155
 		if ( $entry_id && is_numeric( $entry_id ) ) {
3156
-			$message = $form->options[ $opt . '_msg' ] ?? $frm_settings->success_msg;
3156
+			$message = $form->options[$opt . '_msg'] ?? $frm_settings->success_msg;
3157 3157
 			$class   = 'frm_message';
3158 3158
 		} else {
3159 3159
 			$message = $frm_settings->failed_msg;
@@ -3378,8 +3378,8 @@  discard block
 block discarded – undo
3378 3378
 
3379 3379
 		check_ajax_referer( 'frm_ajax', 'nonce' );
3380 3380
 
3381
-		$html             = FrmAppHelper::clip(
3382
-			function () {
3381
+		$html = FrmAppHelper::clip(
3382
+			function() {
3383 3383
 				FrmAppHelper::maybe_autocomplete_pages_options(
3384 3384
 					array(
3385 3385
 						'field_name'  => 'frm_page_dropdown',
Please login to merge, or discard this patch.