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 (#29)
by
unknown
01:55
created
gravityforms-multiple-form-instances.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function __construct() {
29 29
 		// hook the HTML ID string find & replace functionality
30
-		add_filter( 'gform_get_form_filter', array( $this, 'gform_get_form_filter' ), 10, 2 );
31
-		add_filter( 'gform_confirmation', array( $this, 'gform_get_form_filter' ), 10, 2 );
30
+		add_filter('gform_get_form_filter', array($this, 'gform_get_form_filter'), 10, 2);
31
+		add_filter('gform_confirmation', array($this, 'gform_get_form_filter'), 10, 2);
32 32
 	}
33 33
 
34 34
 	/**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 * @param array $form Array with the form settings.
43 43
 	 * @return string $form_string The modified form HTML string.
44 44
 	 */
45
-	public function gform_get_form_filter( $form_string, $form ) {
45
+	public function gform_get_form_filter($form_string, $form) {
46 46
 		
47 47
 		global $_POST;
48 48
 
@@ -50,35 +50,35 @@  discard block
 block discarded – undo
50 50
 
51 51
 		//	Keep track of the instance number for each form type 
52 52
 		if (!array_key_exists($form['id'], $this->instance_count)) {
53
-			$this->instance_count[ $form['id'] ] = 1;
53
+			$this->instance_count[$form['id']] = 1;
54 54
 		} else {
55
-			$this->instance_count[ $form['id'] ] = $this->instance_count[ $form['id'] ] + 1;
55
+			$this->instance_count[$form['id']] = $this->instance_count[$form['id']] + 1;
56 56
 		}
57 57
 
58 58
 		//	Get the instance number for this particular form 
59
-		$instance_number = $this->instance_count[ $form['id'] ];
59
+		$instance_number = $this->instance_count[$form['id']];
60 60
 
61 61
 		//	Are we processing after a form has just been submitted?
62
-		if ( isset( $_POST['gform_random_id'] )) {
62
+		if (isset($_POST['gform_random_id'])) {
63 63
 
64 64
 			//	Is it of the same type as the form we're currently modifying? 
65
-			if ((isset( $_POST['gform_original_id'] ) && $_POST['gform_original_id'] == $form['id'] )) {
65
+			if ((isset($_POST['gform_original_id']) && $_POST['gform_original_id'] == $form['id'])) {
66 66
 
67 67
 				//	Is it an ajax submission? 
68 68
 				if (array_key_exists('gform_ajax', $_POST)) {
69 69
 
70 70
 					//	Yes, use the previous random ID
71
-					$random_id = absint( $_POST['gform_random_id'] );
71
+					$random_id = absint($_POST['gform_random_id']);
72 72
 
73 73
 					//	Also use the previous instance ID
74
-					$instance_number = absint( $_POST['gform_instance_number'] );
74
+					$instance_number = absint($_POST['gform_instance_number']);
75 75
 				}
76 76
 				
77 77
 				//	Is it the same instance of the form?
78
-				else if (isset( $_POST['gform_instance_number'] ) && $_POST['gform_instance_number'] == $instance_number ) {
78
+				else if (isset($_POST['gform_instance_number']) && $_POST['gform_instance_number'] == $instance_number) {
79 79
 
80 80
 					//	Yes, use the previous random ID
81
-					$random_id = absint( $_POST['gform_random_id'] );
81
+					$random_id = absint($_POST['gform_random_id']);
82 82
 				
83 83
 				}
84 84
 			}
@@ -94,58 +94,58 @@  discard block
 block discarded – undo
94 94
 
95 95
 		// define all occurences of the original form ID that wont hurt the form input
96 96
 		$strings = array(
97
-			' gform_wrapper'                                                   => ' gform_wrapper gform_wrapper_original_id_' . $form['id'],
98
-			"for='choice_"                                                      => "for='choice_" . $random_id . '_',
99
-			"id='label_"                                                        => "id='label_" . $random_id . '_',
100
-			"'gform_wrapper_" . $form['id'] . "'"                               => "'gform_wrapper_" . $random_id . "'",
101
-			"'gf_" . $form['id'] . "'"                                          => "'gf_" . $random_id . "'",
102
-			"'gform_" . $form['id'] . "'"                                       => "'gform_" . $random_id . "'",
103
-			"'gform_ajax_frame_" . $form['id'] . "'"                            => "'gform_ajax_frame_" . $random_id . "'",
104
-			'#gf_' . $form['id'] . "'"                                          => '#gf_' . $random_id . "'",
105
-			"'gform_fields_" . $form['id'] . "'"                                => "'gform_fields_" . $random_id . "'",
106
-			"id='field_" . $form['id'] . '_'                                    => "id='field_" . $random_id . '_',
107
-			"for='input_" . $form['id'] . '_'                                   => "for='input_" . $random_id . '_',
108
-			"id='input_" . $form['id'] . '_'                                    => "id='input_" . $random_id . '_',
109
-			"id='choice_" . $form['id'] . '_'                                   => "id='choice_" . $random_id . '_',
110
-			"'gform_submit_button_" . $form['id'] . "'"                         => "'gform_submit_button_" . $random_id . "'",
111
-			'"gf_submitting_' . $form['id'] . '"'                               => '"gf_submitting_' . $random_id . '"',
112
-			"'gf_submitting_" . $form['id'] . "'"                               => "'gf_submitting_" . $random_id . "'",
113
-			'#gform_ajax_frame_' . $form['id']                                  => '#gform_ajax_frame_' . $random_id,
114
-			'#gform_wrapper_' . $form['id']                                     => '#gform_wrapper_' . $random_id,
115
-			'#gform_' . $form['id']                                             => '#gform_' . $random_id,
116
-			"trigger('gform_post_render', [" . $form['id']                      => "trigger('gform_post_render', [" . $random_id,
117
-			'gformInitSpinner( ' . $form['id'] . ','                            => 'gformInitSpinner( ' . $random_id . ',',
118
-			"trigger('gform_page_loaded', [" . $form['id']                      => "trigger('gform_page_loaded', [" . $random_id,
119
-			"'gform_confirmation_loaded', [" . $form['id'] . ']'                => "'gform_confirmation_loaded', [" . $random_id . ']',
120
-			'gf_apply_rules(' . $form['id'] . ','                               => 'gf_apply_rules(' . $random_id . ',',
121
-			'gform_confirmation_wrapper_' . $form['id']                         => 'gform_confirmation_wrapper_' . $random_id,
122
-			'gforms_confirmation_message_' . $form['id']                        => 'gforms_confirmation_message_' . $random_id,
123
-			'gform_confirmation_message_' . $form['id']                         => 'gform_confirmation_message_' . $random_id,
124
-			'if(formId == ' . $form['id'] . ')'                                 => 'if(formId == ' . $random_id . ')',
125
-			"window['gf_form_conditional_logic'][" . $form['id'] . ']'          => "window['gf_form_conditional_logic'][" . $random_id . ']',
126
-			"trigger('gform_post_conditional_logic', [" . $form['id'] . ','     => "trigger('gform_post_conditional_logic', [" . $random_id . ',',
127
-			'gformShowPasswordStrength("input_' . $form['id'] . '_'             => 'gformShowPasswordStrength("input_' . $random_id . '_',
128
-			"gformInitChosenFields('#input_" . $form['id'] . '_'                => "gformInitChosenFields('#input_" . $random_id . '_',
129
-			"jQuery('#input_" . $form['id'] . '_'                               => "jQuery('#input_" . $random_id . '_',
130
-			'gforms_calendar_icon_input_' . $form['id'] . '_'                   => 'gforms_calendar_icon_input_' . $random_id . '_',
131
-			"id='ginput_base_price_" . $form['id'] . '_'                        => "id='ginput_base_price_" . $random_id . '_',
132
-			"id='ginput_quantity_" . $form['id'] . '_'                          => "id='ginput_quantity_" . $random_id . '_',
133
-			'gfield_price_' . $form['id'] . '_'                                 => 'gfield_price_' . $random_id . '_',
134
-			'gfield_quantity_' . $form['id'] . '_'                              => 'gfield_quantity_' . $random_id . '_',
135
-			'gfield_product_' . $form['id'] . '_'                               => 'gfield_product_' . $random_id . '_',
136
-			'ginput_total_' . $form['id']                                       => 'ginput_total_' . $random_id,
137
-			'GFCalc(' . $form['id'] . ','                                       => 'GFCalc(' . $random_id . ',',
138
-			'gf_global["number_formats"][' . $form['id'] . ']'                  => 'gf_global["number_formats"][' . $random_id . ']',
139
-			'gform_next_button_' . $form['id'] . '_'                            => 'gform_next_button_' . $random_id . '_',
140
-			$hidden_field                                                       => "<input type='hidden' name='gform_instance_count' value='" . $instance_number . "' /><input type='hidden' name='gform_original_id' value='" . $form['id'] . "' /><input type='hidden' name='gform_random_id' value='" . $random_id . "' />" . $hidden_field,
97
+			' gform_wrapper'                                                   => ' gform_wrapper gform_wrapper_original_id_'.$form['id'],
98
+			"for='choice_"                                                      => "for='choice_".$random_id.'_',
99
+			"id='label_"                                                        => "id='label_".$random_id.'_',
100
+			"'gform_wrapper_".$form['id']."'"                               => "'gform_wrapper_".$random_id."'",
101
+			"'gf_".$form['id']."'"                                          => "'gf_".$random_id."'",
102
+			"'gform_".$form['id']."'"                                       => "'gform_".$random_id."'",
103
+			"'gform_ajax_frame_".$form['id']."'"                            => "'gform_ajax_frame_".$random_id."'",
104
+			'#gf_'.$form['id']."'"                                          => '#gf_'.$random_id."'",
105
+			"'gform_fields_".$form['id']."'"                                => "'gform_fields_".$random_id."'",
106
+			"id='field_".$form['id'].'_'                                    => "id='field_".$random_id.'_',
107
+			"for='input_".$form['id'].'_'                                   => "for='input_".$random_id.'_',
108
+			"id='input_".$form['id'].'_'                                    => "id='input_".$random_id.'_',
109
+			"id='choice_".$form['id'].'_'                                   => "id='choice_".$random_id.'_',
110
+			"'gform_submit_button_".$form['id']."'"                         => "'gform_submit_button_".$random_id."'",
111
+			'"gf_submitting_'.$form['id'].'"'                               => '"gf_submitting_'.$random_id.'"',
112
+			"'gf_submitting_".$form['id']."'"                               => "'gf_submitting_".$random_id."'",
113
+			'#gform_ajax_frame_'.$form['id']                                  => '#gform_ajax_frame_'.$random_id,
114
+			'#gform_wrapper_'.$form['id']                                     => '#gform_wrapper_'.$random_id,
115
+			'#gform_'.$form['id']                                             => '#gform_'.$random_id,
116
+			"trigger('gform_post_render', [".$form['id']                      => "trigger('gform_post_render', [".$random_id,
117
+			'gformInitSpinner( '.$form['id'].','                            => 'gformInitSpinner( '.$random_id.',',
118
+			"trigger('gform_page_loaded', [".$form['id']                      => "trigger('gform_page_loaded', [".$random_id,
119
+			"'gform_confirmation_loaded', [".$form['id'].']'                => "'gform_confirmation_loaded', [".$random_id.']',
120
+			'gf_apply_rules('.$form['id'].','                               => 'gf_apply_rules('.$random_id.',',
121
+			'gform_confirmation_wrapper_'.$form['id']                         => 'gform_confirmation_wrapper_'.$random_id,
122
+			'gforms_confirmation_message_'.$form['id']                        => 'gforms_confirmation_message_'.$random_id,
123
+			'gform_confirmation_message_'.$form['id']                         => 'gform_confirmation_message_'.$random_id,
124
+			'if(formId == '.$form['id'].')'                                 => 'if(formId == '.$random_id.')',
125
+			"window['gf_form_conditional_logic'][".$form['id'].']'          => "window['gf_form_conditional_logic'][".$random_id.']',
126
+			"trigger('gform_post_conditional_logic', [".$form['id'].','     => "trigger('gform_post_conditional_logic', [".$random_id.',',
127
+			'gformShowPasswordStrength("input_'.$form['id'].'_'             => 'gformShowPasswordStrength("input_'.$random_id.'_',
128
+			"gformInitChosenFields('#input_".$form['id'].'_'                => "gformInitChosenFields('#input_".$random_id.'_',
129
+			"jQuery('#input_".$form['id'].'_'                               => "jQuery('#input_".$random_id.'_',
130
+			'gforms_calendar_icon_input_'.$form['id'].'_'                   => 'gforms_calendar_icon_input_'.$random_id.'_',
131
+			"id='ginput_base_price_".$form['id'].'_'                        => "id='ginput_base_price_".$random_id.'_',
132
+			"id='ginput_quantity_".$form['id'].'_'                          => "id='ginput_quantity_".$random_id.'_',
133
+			'gfield_price_'.$form['id'].'_'                                 => 'gfield_price_'.$random_id.'_',
134
+			'gfield_quantity_'.$form['id'].'_'                              => 'gfield_quantity_'.$random_id.'_',
135
+			'gfield_product_'.$form['id'].'_'                               => 'gfield_product_'.$random_id.'_',
136
+			'ginput_total_'.$form['id']                                       => 'ginput_total_'.$random_id,
137
+			'GFCalc('.$form['id'].','                                       => 'GFCalc('.$random_id.',',
138
+			'gf_global["number_formats"]['.$form['id'].']'                  => 'gf_global["number_formats"]['.$random_id.']',
139
+			'gform_next_button_'.$form['id'].'_'                            => 'gform_next_button_'.$random_id.'_',
140
+			$hidden_field                                                       => "<input type='hidden' name='gform_instance_count' value='".$instance_number."' /><input type='hidden' name='gform_original_id' value='".$form['id']."' /><input type='hidden' name='gform_random_id' value='".$random_id."' />".$hidden_field,
141 141
 		);
142 142
 
143 143
 		// allow addons & plugins to add additional find & replace strings
144
-		$strings = apply_filters( 'gform_multiple_instances_strings', $strings, $form['id'], $random_id );
144
+		$strings = apply_filters('gform_multiple_instances_strings', $strings, $form['id'], $random_id);
145 145
 
146 146
 		// replace all occurences with the new unique ID
147
-		foreach ( $strings as $find => $replace ) {
148
-			$form_string = str_replace( $find, $replace, $form_string );
147
+		foreach ($strings as $find => $replace) {
148
+			$form_string = str_replace($find, $replace, $form_string);
149 149
 		}
150 150
 
151 151
 		return $form_string;
Please login to merge, or discard this patch.