Completed
Push — master ( dbdf52...ba6bfe )
by Stephanie
17s queued 13s
created
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.