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
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		$contextual_shortcodes = self::get_contextual_shortcodes();
75 75
 		$result                = array();
76 76
 		foreach ( $contextual_shortcodes as $type => $shortcodes ) {
77
-			$result[ $type ] = array_keys( $shortcodes );
77
+			$result[$type] = array_keys( $shortcodes );
78 78
 		}
79 79
 		return $result;
80 80
 	}
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 		}
114 114
 
115 115
 		$with_tags = $args['conditional_check'] ? 3 : 2;
116
-		if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
117
-			$tag  = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
116
+		if ( ! empty( $shortcodes[$with_tags][$short_key] ) ) {
117
+			$tag  = str_replace( '[' . $prefix, '', $shortcodes[0][$short_key] );
118 118
 			$tag  = str_replace( ']', '', $tag );
119 119
 			$tag  = str_replace( chr( 194 ) . chr( 160 ), ' ', $tag );
120 120
 			$tags = preg_split( '/\s+/', $tag, 2 );
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 				$tag = $tags[0];
123 123
 			}
124 124
 		} else {
125
-			$tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
125
+			$tag = $shortcodes[$with_tags - 1][$short_key];
126 126
 		}
127 127
 
128 128
 		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,7 +1648,7 @@  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
 		}
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 		// if ( $settings_tab ) {
1657 1657
 		// 	$entry_shortcodes['form_name']       = __( 'Form Name', 'formidable' );
1658 1658
 		// }
1659
-		$entry_shortcodes['form_name']       = __( 'Form Name', 'formidable' );
1659
+		$entry_shortcodes['form_name'] = __( 'Form Name', 'formidable' );
1660 1660
 
1661 1661
 		/**
1662 1662
 		 * Use this hook to add or remove buttons in the helpers section
@@ -1700,7 +1700,7 @@  discard block
 block discarded – undo
1700 1700
 		if ( ! isset( $frm_vars['js_validate_forms'] ) ) {
1701 1701
 			$frm_vars['js_validate_forms'] = array();
1702 1702
 		}
1703
-		$frm_vars['js_validate_forms'][ $form->id ] = $form;
1703
+		$frm_vars['js_validate_forms'][$form->id] = $form;
1704 1704
 	}
1705 1705
 
1706 1706
 	public static function get_email_html() {
@@ -1871,7 +1871,7 @@  discard block
 block discarded – undo
1871 1871
 				add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
1872 1872
 			} else {
1873 1873
 				$vars   = FrmAppHelper::json_to_array( $json_vars );
1874
-				$action = $vars[ $action ];
1874
+				$action = $vars[$action];
1875 1875
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1876 1876
 				$_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
1877 1877
 				$_POST    = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
@@ -2044,7 +2044,7 @@  discard block
 block discarded – undo
2044 2044
 		$actions = array();
2045 2045
 		foreach ( $frm_vars['forms_loaded'] as $form ) {
2046 2046
 			if ( is_object( $form ) ) {
2047
-				$actions[ $form->id ] = $form->name;
2047
+				$actions[$form->id] = $form->name;
2048 2048
 			}
2049 2049
 			unset( $form );
2050 2050
 		}
@@ -2289,8 +2289,8 @@  discard block
 block discarded – undo
2289 2289
 	private static function get_saved_errors( $form, $params ) {
2290 2290
 		global $frm_vars;
2291 2291
 
2292
-		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2293
-			$errors = $frm_vars['created_entries'][ $form->id ]['errors'];
2292
+		if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
2293
+			$errors = $frm_vars['created_entries'][$form->id]['errors'];
2294 2294
 		} else {
2295 2295
 			$errors = array();
2296 2296
 		}
@@ -2312,7 +2312,7 @@  discard block
 block discarded – undo
2312 2312
 	public static function just_created_entry( $form_id ) {
2313 2313
 		global $frm_vars;
2314 2314
 
2315
-		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
+		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;
2316 2316
 	}
2317 2317
 
2318 2318
 	/**
@@ -2332,7 +2332,7 @@  discard block
 block discarded – undo
2332 2332
 	private static function get_confirmation_method( $atts ) {
2333 2333
 		$action = FrmOnSubmitHelper::current_event( $atts );
2334 2334
 		$opt    = 'update' === $action ? 'edit_action' : 'success_action';
2335
-		$method = ! empty( $atts['form']->options[ $opt ] ) ? $atts['form']->options[ $opt ] : 'message';
2335
+		$method = ! empty( $atts['form']->options[$opt] ) ? $atts['form']->options[$opt] : 'message';
2336 2336
 
2337 2337
 		if ( ! empty( $atts['entry_id'] ) ) {
2338 2338
 			$met_actions = self::get_met_on_submit_actions( $atts, $action );
@@ -2353,7 +2353,7 @@  discard block
 block discarded – undo
2353 2353
 	public static function maybe_trigger_redirect( $form, $params, $args ) {
2354 2354
 		if ( ! isset( $params['id'] ) ) {
2355 2355
 			global $frm_vars;
2356
-			$params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id'];
2356
+			$params['id'] = $frm_vars['created_entries'][$form->id]['entry_id'];
2357 2357
 		}
2358 2358
 
2359 2359
 		$conf_method = self::get_confirmation_method(
@@ -2435,7 +2435,7 @@  discard block
 block discarded – undo
2435 2435
 		$args['success_opt'] = $opt;
2436 2436
 		$args['ajax']        = ! empty( $frm_vars['ajax'] );
2437 2437
 
2438
-		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) {
2438
+		if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) {
2439 2439
 			self::load_page_after_submit( $args );
2440 2440
 		} elseif ( $args['conf_method'] === 'redirect' ) {
2441 2441
 			self::redirect_after_submit( $args );
@@ -2459,7 +2459,7 @@  discard block
 block discarded – undo
2459 2459
 		}
2460 2460
 
2461 2461
 		// If a redirect action has already opened the URL in a new tab, we show the default message in the current tab.
2462
-		if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) {
2462
+		if ( ! empty( self::$redirected_in_new_tab[$args['form']->id] ) ) {
2463 2463
 			return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) );
2464 2464
 		}
2465 2465
 
@@ -2647,7 +2647,7 @@  discard block
 block discarded – undo
2647 2647
 
2648 2648
 		$opt = 'update' === $args['action'] ? 'edit_' : 'success_';
2649 2649
 
2650
-		$new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ];
2650
+		$new_args['conf_method'] = $new_args['form']->options[$opt . 'action'];
2651 2651
 
2652 2652
 		/**
2653 2653
 		 * Filters the run success action args.
@@ -2667,8 +2667,8 @@  discard block
 block discarded – undo
2667 2667
 	private static function load_page_after_submit( $args ) {
2668 2668
 		global $post;
2669 2669
 		$opt = $args['success_opt'];
2670
-		if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) {
2671
-			$page     = get_post( $args['form']->options[ $opt . '_page_id' ] );
2670
+		if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) {
2671
+			$page     = get_post( $args['form']->options[$opt . '_page_id'] );
2672 2672
 			$old_post = $post;
2673 2673
 			$post     = $page;
2674 2674
 			$content  = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] );
@@ -2698,7 +2698,7 @@  discard block
 block discarded – undo
2698 2698
 		add_filter( 'frm_use_wpautop', '__return_false' );
2699 2699
 
2700 2700
 		$opt         = $args['success_opt'];
2701
-		$success_url = trim( $args['form']->options[ $opt . '_url' ] );
2701
+		$success_url = trim( $args['form']->options[$opt . '_url'] );
2702 2702
 		$success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] );
2703 2703
 		$success_url = do_shortcode( $success_url );
2704 2704
 
@@ -2720,7 +2720,7 @@  discard block
 block discarded – undo
2720 2720
 			// Not AJAX submit, no headers sent, and there is just one Redirect action runs.
2721 2721
 			if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) {
2722 2722
 				self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args );
2723
-				self::$redirected_in_new_tab[ $args['form']->id ] = 1;
2723
+				self::$redirected_in_new_tab[$args['form']->id] = 1;
2724 2724
 				return;
2725 2725
 			}
2726 2726
 
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
 			'description' => false,
2981 2981
 			'reset'       => false,
2982 2982
 		);
2983
-		$args     = wp_parse_args( $args, $defaults );
2983
+		$args = wp_parse_args( $args, $defaults );
2984 2984
 	}
2985 2985
 
2986 2986
 	/**
@@ -3018,7 +3018,7 @@  discard block
 block discarded – undo
3018 3018
 		$opt          = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success';
3019 3019
 
3020 3020
 		if ( $entry_id && is_numeric( $entry_id ) ) {
3021
-			$message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg;
3021
+			$message = isset( $form->options[$opt . '_msg'] ) ? $form->options[$opt . '_msg'] : $frm_settings->success_msg;
3022 3022
 			$class   = 'frm_message';
3023 3023
 		} else {
3024 3024
 			$message = $frm_settings->failed_msg;
@@ -3241,8 +3241,8 @@  discard block
 block discarded – undo
3241 3241
 
3242 3242
 		check_ajax_referer( 'frm_ajax', 'nonce' );
3243 3243
 
3244
-		$html             = FrmAppHelper::clip(
3245
-			function () {
3244
+		$html = FrmAppHelper::clip(
3245
+			function() {
3246 3246
 				FrmAppHelper::maybe_autocomplete_pages_options(
3247 3247
 					array(
3248 3248
 						'field_name'  => 'frm_page_dropdown',
Please login to merge, or discard this patch.