Completed
Pull Request — master (#2052)
by
unknown
39s
created
classes/helpers/FrmShortcodeHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		$contextual_shortcodes = self::get_contextual_shortcodes();
61 61
 		$result = array();
62 62
 		foreach ( $contextual_shortcodes as $type => $shortcodes ) {
63
-			$result[ $type ] = array_keys( $shortcodes );
63
+			$result[$type] = array_keys( $shortcodes );
64 64
 		}
65 65
 		return $result;
66 66
 	}
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 		}
100 100
 
101 101
 		$with_tags = $args['conditional_check'] ? 3 : 2;
102
-		if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
103
-			$tag  = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
102
+		if ( ! empty( $shortcodes[$with_tags][$short_key] ) ) {
103
+			$tag  = str_replace( '[' . $prefix, '', $shortcodes[0][$short_key] );
104 104
 			$tag  = str_replace( ']', '', $tag );
105 105
 			$tag  = str_replace( chr( 194 ) . chr( 160 ), ' ', $tag );
106 106
 			$tags = preg_split( '/\s+/', $tag, 2 );
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 				$tag = $tags[0];
109 109
 			}
110 110
 		} else {
111
-			$tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
111
+			$tag = $shortcodes[$with_tags - 1][$short_key];
112 112
 		}
113 113
 
114 114
 		return $tag;
Please login to merge, or discard this patch.
classes/controllers/FrmFormsController.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 			 * @param string|null $src
654 654
 			 * @return string
655 655
 			 */
656
-			function ( $src ) {
656
+			function( $src ) {
657 657
 				if ( is_null( $src ) ) {
658 658
 					$src = '';
659 659
 				}
@@ -718,11 +718,11 @@  discard block
 block discarded – undo
718 718
 			),
719 719
 		);
720 720
 
721
-		if ( ! isset( $available_status[ $status ] ) ) {
721
+		if ( ! isset( $available_status[$status] ) ) {
722 722
 			return;
723 723
 		}
724 724
 
725
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
725
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
726 726
 
727 727
 		$params = FrmForm::list_page_params();
728 728
 
@@ -730,8 +730,8 @@  discard block
 block discarded – undo
730 730
 		check_admin_referer( $status . '_form_' . $params['id'] );
731 731
 
732 732
 		$count = 0;
733
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
734
-			++$count;
733
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
734
+			++ $count;
735 735
 		}
736 736
 
737 737
 		$form_type = FrmAppHelper::get_simple_request(
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 		/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
748 748
 		$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>' );
749 749
 
750
-		$message = $available_status[ $status ]['message'];
750
+		$message = $available_status[$status]['message'];
751 751
 
752 752
 		self::display_forms_list( $params, $message );
753 753
 	}
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 		$count = 0;
763 763
 		foreach ( $ids as $id ) {
764 764
 			if ( FrmForm::trash( $id ) ) {
765
-				++$count;
765
+				++ $count;
766 766
 			}
767 767
 		}
768 768
 
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 				'type'  => 'request',
773 773
 			)
774 774
 		);
775
-		$message      = sprintf(
775
+		$message = sprintf(
776 776
 			/* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */
777 777
 			_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' ),
778 778
 			$count,
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
 
794 794
 		$count = 0;
795 795
 		if ( FrmForm::destroy( $params['id'] ) ) {
796
-			++$count;
796
+			++ $count;
797 797
 		}
798 798
 
799 799
 		/* translators: %1$s: Number of forms */
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 		foreach ( $ids as $id ) {
814 814
 			$d = FrmForm::destroy( $id );
815 815
 			if ( $d ) {
816
-				++$count;
816
+				++ $count;
817 817
 			}
818 818
 		}
819 819
 
@@ -1306,7 +1306,7 @@  discard block
 block discarded – undo
1306 1306
 
1307 1307
 		add_action(
1308 1308
 			'wp_enqueue_editor',
1309
-			function () {
1309
+			function() {
1310 1310
 				wp_print_media_templates();
1311 1311
 			}
1312 1312
 		);
@@ -1411,7 +1411,7 @@  discard block
 block discarded – undo
1411 1411
 
1412 1412
 		foreach ( array( 'landing', 'chat', 'abandonment' ) as $feature ) {
1413 1413
 			if ( ! FrmAppHelper::show_new_feature( $feature ) ) {
1414
-				unset( $sections[ $feature ] );
1414
+				unset( $sections[$feature] );
1415 1415
 			}
1416 1416
 		}
1417 1417
 
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
 				$section['id'] = $section['anchor'];
1440 1440
 			}
1441 1441
 
1442
-			$sections[ $key ] = $section;
1442
+			$sections[$key] = $section;
1443 1443
 		}//end foreach
1444 1444
 
1445 1445
 		return $sections;
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
 		if ( $user_fields ) {
1563 1563
 			$user_helpers = array();
1564 1564
 			foreach ( $user_fields as $uk => $uf ) {
1565
-				$user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf;
1565
+				$user_helpers['|user_id| show="' . $uk . '"'] = $uf;
1566 1566
 				unset( $uk, $uf );
1567 1567
 			}
1568 1568
 
@@ -1648,13 +1648,13 @@  discard block
 block discarded – undo
1648 1648
 			'sitename'   => __( 'Site Name', 'formidable' ),
1649 1649
 		);
1650 1650
 
1651
-		$entry_shortcodes      = array_merge( FrmShortcodeHelper::get_contextual_shortcode_values(), $entry_shortcodes );
1651
+		$entry_shortcodes = array_merge( FrmShortcodeHelper::get_contextual_shortcode_values(), $entry_shortcodes );
1652 1652
 		if ( ! FrmAppHelper::pro_is_installed() ) {
1653 1653
 			unset( $entry_shortcodes['post_id'] );
1654 1654
 		}
1655 1655
 
1656 1656
 		if ( $settings_tab ) {
1657
-			$entry_shortcodes['form_name']       = __( 'Form Name', 'formidable' );
1657
+			$entry_shortcodes['form_name'] = __( 'Form Name', 'formidable' );
1658 1658
 		}
1659 1659
 
1660 1660
 		/**
@@ -1699,7 +1699,7 @@  discard block
 block discarded – undo
1699 1699
 		if ( ! isset( $frm_vars['js_validate_forms'] ) ) {
1700 1700
 			$frm_vars['js_validate_forms'] = array();
1701 1701
 		}
1702
-		$frm_vars['js_validate_forms'][ $form->id ] = $form;
1702
+		$frm_vars['js_validate_forms'][$form->id] = $form;
1703 1703
 	}
1704 1704
 
1705 1705
 	public static function get_email_html() {
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1871 1871
 			} else {
1872 1872
 				$vars   = FrmAppHelper::json_to_array( $json_vars );
1873
-				$action = $vars[ $action ];
1873
+				$action = $vars[$action];
1874 1874
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1875 1875
 				$_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1876 1876
 				$_POST    = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
@@ -2043,7 +2043,7 @@  discard block
 block discarded – undo
2043 2043
 		$actions = array();
2044 2044
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
2045 2045
 			if ( is_object( $form ) ) {
2046
-				$actions[ $form->id ] = $form->name;
2046
+				$actions[$form->id] = $form->name;
2047 2047
 			}
2048 2048
 			unset( $form );
2049 2049
 		}
@@ -2288,8 +2288,8 @@  discard block
 block discarded – undo
2288 2288
 	private static function get_saved_errors( $form, $params ) {
2289 2289
 		global $frm_vars;
2290 2290
 
2291
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2292
-			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
2291
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2292
+			$errors = $frm_vars['created_entries'][$form->id]['errors'];
2293 2293
 		} else {
2294 2294
 			$errors = array();
2295 2295
 		}
@@ -2311,7 +2311,7 @@  discard block
 block discarded – undo
2311 2311
 	public static function just_created_entry( $form_id ) {
2312 2312
 		global $frm_vars;
2313 2313
 
2314
-		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;
2314
+		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;
2315 2315
 	}
2316 2316
 
2317 2317
 	/**
@@ -2331,7 +2331,7 @@  discard block
 block discarded – undo
2331 2331
 	private static function get_confirmation_method( $atts ) {
2332 2332
 		$action = FrmOnSubmitHelper::current_event( $atts );
2333 2333
 		$opt    = 'update' === $action ? 'edit_action' : 'success_action';
2334
-		$method = ! empty( $atts['form']->options[ $opt ] ) ? $atts['form']->options[ $opt ] : 'message';
2334
+		$method = ! empty( $atts['form']->options[$opt] ) ? $atts['form']->options[$opt] : 'message';
2335 2335
 
2336 2336
 		if ( ! empty( $atts['entry_id'] ) ) {
2337 2337
 			$met_actions = self::get_met_on_submit_actions( $atts, $action );
@@ -2352,7 +2352,7 @@  discard block
 block discarded – undo
2352 2352
 	public static function maybe_trigger_redirect( $form, $params, $args ) {
2353 2353
 		if ( ! isset( $params['id'] ) ) {
2354 2354
 			global $frm_vars;
2355
-			$params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
2355
+			$params['id'] = $frm_vars['created_entries'][$form->id]['entry_id'];
2356 2356
 		}
2357 2357
 
2358 2358
 		$conf_method = self::get_confirmation_method(
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
 		$args['success_opt'] = $opt;
2435 2435
 		$args['ajax']        = ! empty( $frm_vars['ajax'] );
2436 2436
 
2437
-		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) {
2437
+		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) {
2438 2438
 			self::load_page_after_submit( $args );
2439 2439
 		} elseif ( $args['conf_method'] === 'redirect' ) {
2440 2440
 			self::redirect_after_submit( $args );
@@ -2458,7 +2458,7 @@  discard block
 block discarded – undo
2458 2458
 		}
2459 2459
 
2460 2460
 		// If a redirect action has already opened the URL in a new tab, we show the default message in the current tab.
2461
-		if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) {
2461
+		if ( ! empty( self::$redirected_in_new_tab[$args['form']->id] ) ) {
2462 2462
 			return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) );
2463 2463
 		}
2464 2464
 
@@ -2646,7 +2646,7 @@  discard block
 block discarded – undo
2646 2646
 
2647 2647
 		$opt = 'update' === $args['action'] ? 'edit_' : 'success_';
2648 2648
 
2649
-		$new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ];
2649
+		$new_args['conf_method'] = $new_args['form']->options[$opt . 'action'];
2650 2650
 
2651 2651
 		/**
2652 2652
 		 * Filters the run success action args.
@@ -2666,8 +2666,8 @@  discard block
 block discarded – undo
2666 2666
 	private static function load_page_after_submit( $args ) {
2667 2667
 		global $post;
2668 2668
 		$opt = $args['success_opt'];
2669
-		if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
2670
-			$page     = get_post( $args['form']->options[ $opt . '_page_id' ] );
2669
+		if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) {
2670
+			$page     = get_post( $args['form']->options[$opt . '_page_id'] );
2671 2671
 			$old_post = $post;
2672 2672
 			$post     = $page;
2673 2673
 			$content  = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] );
@@ -2697,7 +2697,7 @@  discard block
 block discarded – undo
2697 2697
 		add_filter( 'frm_use_wpautop', '__return_false' );
2698 2698
 
2699 2699
 		$opt         = $args['success_opt'];
2700
-		$success_url = trim( $args['form']->options[ $opt . '_url' ] );
2700
+		$success_url = trim( $args['form']->options[$opt . '_url'] );
2701 2701
 		$success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] );
2702 2702
 		$success_url = do_shortcode( $success_url );
2703 2703
 
@@ -2719,7 +2719,7 @@  discard block
 block discarded – undo
2719 2719
 			// Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2720 2720
 			if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
2721 2721
 				self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args );
2722
-				self::$redirected_in_new_tab[ $args['form']->id ] = 1;
2722
+				self::$redirected_in_new_tab[$args['form']->id] = 1;
2723 2723
 				return;
2724 2724
 			}
2725 2725
 
@@ -2979,7 +2979,7 @@  discard block
 block discarded – undo
2979 2979
 			'description' => false,
2980 2980
 			'reset'       => false,
2981 2981
 		);
2982
-		$args     = wp_parse_args( $args, $defaults );
2982
+		$args = wp_parse_args( $args, $defaults );
2983 2983
 	}
2984 2984
 
2985 2985
 	/**
@@ -3017,7 +3017,7 @@  discard block
 block discarded – undo
3017 3017
 		$opt          = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success';
3018 3018
 
3019 3019
 		if ( $entry_id && is_numeric( $entry_id ) ) {
3020
-			$message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg;
3020
+			$message = isset( $form->options[$opt . '_msg'] ) ? $form->options[$opt . '_msg'] : $frm_settings->success_msg;
3021 3021
 			$class   = 'frm_message';
3022 3022
 		} else {
3023 3023
 			$message = $frm_settings->failed_msg;
@@ -3240,8 +3240,8 @@  discard block
 block discarded – undo
3240 3240
 
3241 3241
 		check_ajax_referer( 'frm_ajax', 'nonce' );
3242 3242
 
3243
-		$html             = FrmAppHelper::clip(
3244
-			function () {
3243
+		$html = FrmAppHelper::clip(
3244
+			function() {
3245 3245
 				FrmAppHelper::maybe_autocomplete_pages_options(
3246 3246
 					array(
3247 3247
 						'field_name'  => 'frm_page_dropdown',
Please login to merge, or discard this patch.