Completed
Pull Request — master (#2443)
by
unknown
40s
created
classes/views/test-mode/pagination-buttons.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 $number_of_pages_to_show = 4;
14 14
 ?>
15 15
 <div id="frm_test_mode_pagination">
16
-	<?php for ( $i = 1; $i <= $number_of_pages_to_show; $i++ ) : ?>
16
+	<?php for ( $i = 1; $i <= $number_of_pages_to_show; $i ++ ) : ?>
17 17
 		<input type="button" class="frm_noallow <?php echo $i === 1 ? 'frm_test_mode_active_page' : ''; ?>" value="<?php echo esc_attr( $i ); ?>"/>
18 18
 	<?php endfor; ?>
19 19
 </div>
Please login to merge, or discard this patch.
classes/controllers/FrmTestModeController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
 	 */
66 66
 	private static function get_testing_mode_container() {
67 67
 		return FrmAppHelper::clip(
68
-			function () {
68
+			function() {
69 69
 				$enabled                              = function_exists( 'load_formidable_test_mode' );
70 70
 				$ai_enabled                           = class_exists( 'FrmAIAppHelper' );
71 71
 				$roles                                = self::get_roles();
Please login to merge, or discard this patch.
classes/views/test-mode/container.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,10 @@
 block discarded – undo
42 42
 			<?php
43 43
 			$form_actions         = FrmFormAction::get_action_for_form( $form_id );
44 44
 			$enabled_form_actions = wp_list_pluck( $form_actions, 'ID' );
45
-			if ( $enabled && ! empty( $_POST ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
46
-				if ( ! empty( $_POST['frm_testmode']['enabled_form_actions'] ) && is_array( $_POST['frm_testmode']['enabled_form_actions'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
45
+			if ( $enabled && ! empty( $_POST ) ) {
46
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
47
+				if ( ! empty( $_POST['frm_testmode']['enabled_form_actions'] ) && is_array( $_POST['frm_testmode']['enabled_form_actions'] ) ) {
48
+// phpcs:ignore WordPress.Security.NonceVerification.Missing
47 49
 					$enabled_form_actions = array_map( 'absint', $_POST['frm_testmode']['enabled_form_actions'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
48 50
 				} else {
49 51
 					$enabled_form_actions = array();
Please login to merge, or discard this patch.
classes/controllers/FrmFormsController.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 		if ( FrmTestModeController::should_add_test_mode_container() ) {
439 439
 			add_action(
440 440
 				'wp_enqueue_scripts',
441
-				function () {
441
+				function() {
442 442
 					// Enqueue multiselect dropdown requirements.
443 443
 					$plugin_url = FrmAppHelper::plugin_url();
444 444
 					$version    = FrmAppHelper::plugin_version();
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 			 * @param string|null $src
742 742
 			 * @return string
743 743
 			 */
744
-			function ( $src ) {
744
+			function( $src ) {
745 745
 				if ( is_null( $src ) ) {
746 746
 					$src = '';
747 747
 				}
@@ -806,11 +806,11 @@  discard block
 block discarded – undo
806 806
 			),
807 807
 		);
808 808
 
809
-		if ( ! isset( $available_status[ $status ] ) ) {
809
+		if ( ! isset( $available_status[$status] ) ) {
810 810
 			return;
811 811
 		}
812 812
 
813
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
813
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
814 814
 
815 815
 		$params = FrmForm::list_page_params();
816 816
 
@@ -818,8 +818,8 @@  discard block
 block discarded – undo
818 818
 		check_admin_referer( $status . '_form_' . $params['id'] );
819 819
 
820 820
 		$count = 0;
821
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
822
-			++$count;
821
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
822
+			++ $count;
823 823
 		}
824 824
 
825 825
 		$form_type = FrmAppHelper::get_simple_request(
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 		/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
836 836
 		$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>' );
837 837
 
838
-		$message = $available_status[ $status ]['message'];
838
+		$message = $available_status[$status]['message'];
839 839
 
840 840
 		self::display_forms_list( $params, $message );
841 841
 	}
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
 		$count = 0;
851 851
 		foreach ( $ids as $id ) {
852 852
 			if ( FrmForm::trash( $id ) ) {
853
-				++$count;
853
+				++ $count;
854 854
 			}
855 855
 		}
856 856
 
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 				'type'  => 'request',
865 865
 			)
866 866
 		);
867
-		$message      = sprintf(
867
+		$message = sprintf(
868 868
 			/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
869 869
 			_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' ),
870 870
 			$count,
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 
886 886
 		$count = 0;
887 887
 		if ( FrmForm::destroy( $params['id'] ) ) {
888
-			++$count;
888
+			++ $count;
889 889
 		}
890 890
 
891 891
 		/* translators: %1$s: Number of forms */
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
 		foreach ( $ids as $id ) {
906 906
 			$d = FrmForm::destroy( $id );
907 907
 			if ( $d ) {
908
-				++$count;
908
+				++ $count;
909 909
 			}
910 910
 		}
911 911
 
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
 
1407 1407
 		add_action(
1408 1408
 			'wp_enqueue_editor',
1409
-			function () {
1409
+			function() {
1410 1410
 				wp_print_media_templates();
1411 1411
 			}
1412 1412
 		);
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
 
1516 1516
 		foreach ( array( 'landing', 'chat', 'abandonment' ) as $feature ) {
1517 1517
 			if ( ! FrmAppHelper::show_new_feature( $feature ) ) {
1518
-				unset( $sections[ $feature ] );
1518
+				unset( $sections[$feature] );
1519 1519
 			}
1520 1520
 		}
1521 1521
 
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
 				$section['id'] = $section['anchor'];
1544 1544
 			}
1545 1545
 
1546
-			$sections[ $key ] = $section;
1546
+			$sections[$key] = $section;
1547 1547
 		}//end foreach
1548 1548
 
1549 1549
 		return $sections;
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
 		if ( $user_fields ) {
1667 1667
 			$user_helpers = array();
1668 1668
 			foreach ( $user_fields as $uk => $uf ) {
1669
-				$user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
1669
+				$user_helpers['|user_id| show="' . $uk . '"'] = $uf;
1670 1670
 				unset( $uk, $uf );
1671 1671
 			}
1672 1672
 
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 		if ( ! isset( $frm_vars['js_validate_forms'] ) ) {
1801 1801
 			$frm_vars['js_validate_forms'] = array();
1802 1802
 		}
1803
-		$frm_vars['js_validate_forms'][ $form->id ] = $form;
1803
+		$frm_vars['js_validate_forms'][$form->id] = $form;
1804 1804
 	}
1805 1805
 
1806 1806
 	public static function get_email_html() {
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1985 1985
 			} else {
1986 1986
 				$vars   = FrmAppHelper::json_to_array( $json_vars );
1987
-				$action = $vars[ $action ];
1987
+				$action = $vars[$action];
1988 1988
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1989 1989
 				$_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1990 1990
 				$_POST    = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
@@ -2147,7 +2147,7 @@  discard block
 block discarded – undo
2147 2147
 		$actions = array();
2148 2148
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
2149 2149
 			if ( is_object( $form ) ) {
2150
-				$actions[ $form->id ] = $form->name;
2150
+				$actions[$form->id] = $form->name;
2151 2151
 			}
2152 2152
 			unset( $form );
2153 2153
 		}
@@ -2392,8 +2392,8 @@  discard block
 block discarded – undo
2392 2392
 	private static function get_saved_errors( $form, $params ) {
2393 2393
 		global $frm_vars;
2394 2394
 
2395
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2396
-			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
2395
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2396
+			$errors = $frm_vars['created_entries'][$form->id]['errors'];
2397 2397
 		} else {
2398 2398
 			$errors = array();
2399 2399
 		}
@@ -2415,7 +2415,7 @@  discard block
 block discarded – undo
2415 2415
 	public static function just_created_entry( $form_id ) {
2416 2416
 		global $frm_vars;
2417 2417
 
2418
-		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;
2418
+		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;
2419 2419
 	}
2420 2420
 
2421 2421
 	/**
@@ -2435,7 +2435,7 @@  discard block
 block discarded – undo
2435 2435
 	private static function get_confirmation_method( $atts ) {
2436 2436
 		$action = FrmOnSubmitHelper::current_event( $atts );
2437 2437
 		$opt    = 'update' === $action ? 'edit_action' : 'success_action';
2438
-		$method = ! empty( $atts['form']->options[ $opt ] ) ? $atts['form']->options[ $opt ] : 'message';
2438
+		$method = ! empty( $atts['form']->options[$opt] ) ? $atts['form']->options[$opt] : 'message';
2439 2439
 
2440 2440
 		if ( ! empty( $atts['entry_id'] ) ) {
2441 2441
 			$met_actions = self::get_met_on_submit_actions( $atts, $action );
@@ -2456,7 +2456,7 @@  discard block
 block discarded – undo
2456 2456
 	public static function maybe_trigger_redirect( $form, $params, $args ) {
2457 2457
 		if ( ! isset( $params['id'] ) ) {
2458 2458
 			global $frm_vars;
2459
-			$params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
2459
+			$params['id'] = $frm_vars['created_entries'][$form->id]['entry_id'];
2460 2460
 		}
2461 2461
 
2462 2462
 		$conf_method = self::get_confirmation_method(
@@ -2538,7 +2538,7 @@  discard block
 block discarded – undo
2538 2538
 		$args['success_opt'] = $opt;
2539 2539
 		$args['ajax']        = ! empty( $frm_vars['ajax'] );
2540 2540
 
2541
-		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) {
2541
+		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) {
2542 2542
 			self::load_page_after_submit( $args );
2543 2543
 		} elseif ( $args['conf_method'] === 'redirect' ) {
2544 2544
 			self::redirect_after_submit( $args );
@@ -2562,7 +2562,7 @@  discard block
 block discarded – undo
2562 2562
 		}
2563 2563
 
2564 2564
 		// If a redirect action has already opened the URL in a new tab, we show the default message in the current tab.
2565
-		if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) {
2565
+		if ( ! empty( self::$redirected_in_new_tab[$args['form']->id] ) ) {
2566 2566
 			return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) );
2567 2567
 		}
2568 2568
 
@@ -2750,7 +2750,7 @@  discard block
 block discarded – undo
2750 2750
 
2751 2751
 		$opt = 'update' === $args['action'] ? 'edit_' : 'success_';
2752 2752
 
2753
-		$new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ];
2753
+		$new_args['conf_method'] = $new_args['form']->options[$opt . 'action'];
2754 2754
 
2755 2755
 		/**
2756 2756
 		 * Filters the run success action args.
@@ -2770,8 +2770,8 @@  discard block
 block discarded – undo
2770 2770
 	private static function load_page_after_submit( $args ) {
2771 2771
 		global $post;
2772 2772
 		$opt = $args['success_opt'];
2773
-		if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
2774
-			$page     = get_post( $args['form']->options[ $opt . '_page_id' ] );
2773
+		if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) {
2774
+			$page     = get_post( $args['form']->options[$opt . '_page_id'] );
2775 2775
 			$old_post = $post;
2776 2776
 			$post     = $page;
2777 2777
 			$content  = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] );
@@ -2801,7 +2801,7 @@  discard block
 block discarded – undo
2801 2801
 		add_filter( 'frm_use_wpautop', '__return_false' );
2802 2802
 
2803 2803
 		$opt         = $args['success_opt'];
2804
-		$success_url = trim( $args['form']->options[ $opt . '_url' ] );
2804
+		$success_url = trim( $args['form']->options[$opt . '_url'] );
2805 2805
 		$success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] );
2806 2806
 		$success_url = do_shortcode( $success_url );
2807 2807
 
@@ -2823,7 +2823,7 @@  discard block
 block discarded – undo
2823 2823
 			// Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2824 2824
 			if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
2825 2825
 				self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args );
2826
-				self::$redirected_in_new_tab[ $args['form']->id ] = 1;
2826
+				self::$redirected_in_new_tab[$args['form']->id] = 1;
2827 2827
 				return;
2828 2828
 			}
2829 2829
 
@@ -3103,7 +3103,7 @@  discard block
 block discarded – undo
3103 3103
 			'description' => false,
3104 3104
 			'reset'       => false,
3105 3105
 		);
3106
-		$args     = wp_parse_args( $args, $defaults );
3106
+		$args = wp_parse_args( $args, $defaults );
3107 3107
 	}
3108 3108
 
3109 3109
 	/**
@@ -3141,7 +3141,7 @@  discard block
 block discarded – undo
3141 3141
 		$opt          = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success';
3142 3142
 
3143 3143
 		if ( $entry_id && is_numeric( $entry_id ) ) {
3144
-			$message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg;
3144
+			$message = isset( $form->options[$opt . '_msg'] ) ? $form->options[$opt . '_msg'] : $frm_settings->success_msg;
3145 3145
 			$class   = 'frm_message';
3146 3146
 		} else {
3147 3147
 			$message = $frm_settings->failed_msg;
@@ -3366,8 +3366,8 @@  discard block
 block discarded – undo
3366 3366
 
3367 3367
 		check_ajax_referer( 'frm_ajax', 'nonce' );
3368 3368
 
3369
-		$html             = FrmAppHelper::clip(
3370
-			function () {
3369
+		$html = FrmAppHelper::clip(
3370
+			function() {
3371 3371
 				FrmAppHelper::maybe_autocomplete_pages_options(
3372 3372
 					array(
3373 3373
 						'field_name'  => 'frm_page_dropdown',
Please login to merge, or discard this patch.