GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#36)
by Arron
02:04
created
gravityforms-multiple-form-instances.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function __construct() {
27 27
 		// hook the HTML ID string find & replace functionality
28
-		add_filter( 'gform_get_form_filter', array( $this, 'gform_get_form_filter' ), 10, 2 );
29
-		add_filter( 'gform_confirmation', array( $this, 'gform_get_form_filter' ), 10, 2 );
28
+		add_filter('gform_get_form_filter', array($this, 'gform_get_form_filter'), 10, 2);
29
+		add_filter('gform_confirmation', array($this, 'gform_get_form_filter'), 10, 2);
30 30
 	}
31 31
 
32 32
 	/**
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 	 * @param array $form Array with the form settings.
41 41
 	 * @return string $form_string The modified form HTML string.
42 42
 	 */
43
-	public function gform_get_form_filter( $form_string, $form ) {
43
+	public function gform_get_form_filter($form_string, $form) {
44 44
 		// if form has been submitted, use the submitted ID, otherwise generate a new unique ID
45
-		if ( isset( $_POST['gform_random_id'] ) ) {
46
-			$random_id = absint( $_POST['gform_random_id'] ); // Input var okay.
45
+		if (isset($_POST['gform_random_id'])) {
46
+			$random_id = absint($_POST['gform_random_id']); // Input var okay.
47 47
 		} else {
48 48
 			$random_id = mt_rand();
49 49
 		}
@@ -53,59 +53,59 @@  discard block
 block discarded – undo
53 53
 
54 54
 		// define all occurences of the original form ID that wont hurt the form input
55 55
 		$strings = array(
56
-			' gform_wrapper'                                                   => ' gform_wrapper gform_wrapper_original_id_' . $form['id'],
57
-			"for='choice_"                                                      => "for='choice_" . $random_id . '_',
58
-			"id='label_"                                                        => "id='label_" . $random_id . '_',
59
-			"'gform_wrapper_" . $form['id'] . "'"                               => "'gform_wrapper_" . $random_id . "'",
60
-			"'gf_" . $form['id'] . "'"                                          => "'gf_" . $random_id . "'",
61
-			"'gform_" . $form['id'] . "'"                                       => "'gform_" . $random_id . "'",
62
-			"'gform_ajax_frame_" . $form['id'] . "'"                            => "'gform_ajax_frame_" . $random_id . "'",
63
-			'#gf_' . $form['id'] . "'"                                          => '#gf_' . $random_id . "'",
64
-			"'gform_fields_" . $form['id'] . "'"                                => "'gform_fields_" . $random_id . "'",
65
-			"id='field_" . $form['id'] . '_'                                    => "id='field_" . $random_id . '_',
66
-			"for='input_" . $form['id'] . '_'                                   => "for='input_" . $random_id . '_',
67
-			"id='input_" . $form['id'] . '_'                                    => "id='input_" . $random_id . '_',
68
-			"id='choice_" . $form['id'] . '_'                                   => "id='choice_" . $random_id . '_',
69
-			"'gform_submit_button_" . $form['id'] . "'"                         => "'gform_submit_button_" . $random_id . "'",
70
-			"\"gform_submit_button_" . $form['id'] . "\""                         => "\"gform_submit_button_" . $random_id . "\"",
71
-			'"gf_submitting_' . $form['id'] . '"'                               => '"gf_submitting_' . $random_id . '"',
72
-			"'gf_submitting_" . $form['id'] . "'"                               => "'gf_submitting_" . $random_id . "'",
73
-			'#gform_ajax_frame_' . $form['id']                                  => '#gform_ajax_frame_' . $random_id,
74
-			'#gform_wrapper_' . $form['id']                                     => '#gform_wrapper_' . $random_id,
75
-			'#gform_' . $form['id']                                             => '#gform_' . $random_id,
76
-			"trigger('gform_post_render', [" . $form['id']                      => "trigger('gform_post_render', [" . $random_id,
77
-			'gformInitSpinner( ' . $form['id'] . ','                            => 'gformInitSpinner( ' . $random_id . ',',
78
-			"trigger('gform_page_loaded', [" . $form['id']                      => "trigger('gform_page_loaded', [" . $random_id,
79
-			"'gform_confirmation_loaded', [" . $form['id'] . ']'                => "'gform_confirmation_loaded', [" . $random_id . ']',
80
-			'gf_apply_rules(' . $form['id'] . ','                               => 'gf_apply_rules(' . $random_id . ',',
81
-			'gform_confirmation_wrapper_' . $form['id']                         => 'gform_confirmation_wrapper_' . $random_id,
82
-			'gforms_confirmation_message_' . $form['id']                        => 'gforms_confirmation_message_' . $random_id,
83
-			'gform_confirmation_message_' . $form['id']                         => 'gform_confirmation_message_' . $random_id,
84
-			'if(formId == ' . $form['id'] . ')'                                 => 'if(formId == ' . $random_id . ')',
85
-			"window['gf_form_conditional_logic'][" . $form['id'] . ']'          => "window['gf_form_conditional_logic'][" . $random_id . ']',
86
-			"trigger('gform_post_conditional_logic', [" . $form['id'] . ','     => "trigger('gform_post_conditional_logic', [" . $random_id . ',',
87
-			'gformShowPasswordStrength("input_' . $form['id'] . '_'             => 'gformShowPasswordStrength("input_' . $random_id . '_',
88
-			"gformInitChosenFields('#input_" . $form['id'] . '_'                => "gformInitChosenFields('#input_" . $random_id . '_',
89
-			"jQuery('#input_" . $form['id'] . '_'                               => "jQuery('#input_" . $random_id . '_',
90
-			'gforms_calendar_icon_input_' . $form['id'] . '_'                   => 'gforms_calendar_icon_input_' . $random_id . '_',
91
-			"id='ginput_base_price_" . $form['id'] . '_'                        => "id='ginput_base_price_" . $random_id . '_',
92
-			"id='ginput_quantity_" . $form['id'] . '_'                          => "id='ginput_quantity_" . $random_id . '_',
93
-			'gfield_price_' . $form['id'] . '_'                                 => 'gfield_price_' . $random_id . '_',
94
-			'gfield_quantity_' . $form['id'] . '_'                              => 'gfield_quantity_' . $random_id . '_',
95
-			'gfield_product_' . $form['id'] . '_'                               => 'gfield_product_' . $random_id . '_',
96
-			'ginput_total_' . $form['id']                                       => 'ginput_total_' . $random_id,
97
-			'GFCalc(' . $form['id'] . ','                                       => 'GFCalc(' . $random_id . ',',
98
-			'gf_global["number_formats"][' . $form['id'] . ']'                  => 'gf_global["number_formats"][' . $random_id . ']',
99
-			'gform_next_button_' . $form['id'] . '_'                            => 'gform_next_button_' . $random_id . '_',
100
-			$hidden_field                                                       => "<input type='hidden' name='gform_random_id' value='" . $random_id . "' />" . $hidden_field,
56
+			' gform_wrapper'                                                   => ' gform_wrapper gform_wrapper_original_id_'.$form['id'],
57
+			"for='choice_"                                                      => "for='choice_".$random_id.'_',
58
+			"id='label_"                                                        => "id='label_".$random_id.'_',
59
+			"'gform_wrapper_".$form['id']."'"                               => "'gform_wrapper_".$random_id."'",
60
+			"'gf_".$form['id']."'"                                          => "'gf_".$random_id."'",
61
+			"'gform_".$form['id']."'"                                       => "'gform_".$random_id."'",
62
+			"'gform_ajax_frame_".$form['id']."'"                            => "'gform_ajax_frame_".$random_id."'",
63
+			'#gf_'.$form['id']."'"                                          => '#gf_'.$random_id."'",
64
+			"'gform_fields_".$form['id']."'"                                => "'gform_fields_".$random_id."'",
65
+			"id='field_".$form['id'].'_'                                    => "id='field_".$random_id.'_',
66
+			"for='input_".$form['id'].'_'                                   => "for='input_".$random_id.'_',
67
+			"id='input_".$form['id'].'_'                                    => "id='input_".$random_id.'_',
68
+			"id='choice_".$form['id'].'_'                                   => "id='choice_".$random_id.'_',
69
+			"'gform_submit_button_".$form['id']."'"                         => "'gform_submit_button_".$random_id."'",
70
+			"\"gform_submit_button_".$form['id']."\""                         => "\"gform_submit_button_".$random_id."\"",
71
+			'"gf_submitting_'.$form['id'].'"'                               => '"gf_submitting_'.$random_id.'"',
72
+			"'gf_submitting_".$form['id']."'"                               => "'gf_submitting_".$random_id."'",
73
+			'#gform_ajax_frame_'.$form['id']                                  => '#gform_ajax_frame_'.$random_id,
74
+			'#gform_wrapper_'.$form['id']                                     => '#gform_wrapper_'.$random_id,
75
+			'#gform_'.$form['id']                                             => '#gform_'.$random_id,
76
+			"trigger('gform_post_render', [".$form['id']                      => "trigger('gform_post_render', [".$random_id,
77
+			'gformInitSpinner( '.$form['id'].','                            => 'gformInitSpinner( '.$random_id.',',
78
+			"trigger('gform_page_loaded', [".$form['id']                      => "trigger('gform_page_loaded', [".$random_id,
79
+			"'gform_confirmation_loaded', [".$form['id'].']'                => "'gform_confirmation_loaded', [".$random_id.']',
80
+			'gf_apply_rules('.$form['id'].','                               => 'gf_apply_rules('.$random_id.',',
81
+			'gform_confirmation_wrapper_'.$form['id']                         => 'gform_confirmation_wrapper_'.$random_id,
82
+			'gforms_confirmation_message_'.$form['id']                        => 'gforms_confirmation_message_'.$random_id,
83
+			'gform_confirmation_message_'.$form['id']                         => 'gform_confirmation_message_'.$random_id,
84
+			'if(formId == '.$form['id'].')'                                 => 'if(formId == '.$random_id.')',
85
+			"window['gf_form_conditional_logic'][".$form['id'].']'          => "window['gf_form_conditional_logic'][".$random_id.']',
86
+			"trigger('gform_post_conditional_logic', [".$form['id'].','     => "trigger('gform_post_conditional_logic', [".$random_id.',',
87
+			'gformShowPasswordStrength("input_'.$form['id'].'_'             => 'gformShowPasswordStrength("input_'.$random_id.'_',
88
+			"gformInitChosenFields('#input_".$form['id'].'_'                => "gformInitChosenFields('#input_".$random_id.'_',
89
+			"jQuery('#input_".$form['id'].'_'                               => "jQuery('#input_".$random_id.'_',
90
+			'gforms_calendar_icon_input_'.$form['id'].'_'                   => 'gforms_calendar_icon_input_'.$random_id.'_',
91
+			"id='ginput_base_price_".$form['id'].'_'                        => "id='ginput_base_price_".$random_id.'_',
92
+			"id='ginput_quantity_".$form['id'].'_'                          => "id='ginput_quantity_".$random_id.'_',
93
+			'gfield_price_'.$form['id'].'_'                                 => 'gfield_price_'.$random_id.'_',
94
+			'gfield_quantity_'.$form['id'].'_'                              => 'gfield_quantity_'.$random_id.'_',
95
+			'gfield_product_'.$form['id'].'_'                               => 'gfield_product_'.$random_id.'_',
96
+			'ginput_total_'.$form['id']                                       => 'ginput_total_'.$random_id,
97
+			'GFCalc('.$form['id'].','                                       => 'GFCalc('.$random_id.',',
98
+			'gf_global["number_formats"]['.$form['id'].']'                  => 'gf_global["number_formats"]['.$random_id.']',
99
+			'gform_next_button_'.$form['id'].'_'                            => 'gform_next_button_'.$random_id.'_',
100
+			$hidden_field                                                       => "<input type='hidden' name='gform_random_id' value='".$random_id."' />".$hidden_field,
101 101
 		);
102 102
 
103 103
 		// allow addons & plugins to add additional find & replace strings
104
-		$strings = apply_filters( 'gform_multiple_instances_strings', $strings, $form['id'], $random_id );
104
+		$strings = apply_filters('gform_multiple_instances_strings', $strings, $form['id'], $random_id);
105 105
 
106 106
 		// replace all occurences with the new unique ID
107
-		foreach ( $strings as $find => $replace ) {
108
-			$form_string = str_replace( $find, $replace, $form_string );
107
+		foreach ($strings as $find => $replace) {
108
+			$form_string = str_replace($find, $replace, $form_string);
109 109
 		}
110 110
 
111 111
 		return $form_string;
Please login to merge, or discard this patch.