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 (#32)
by
unknown
01:34
created
gravityforms-multiple-form-instances.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function __construct() {
31 31
 		// hook the HTML ID string find & replace functionality
32
-		add_filter( 'gform_get_form_filter', array( $this, 'gform_get_form_filter' ), 10, 2 );
33
-		add_filter( 'gform_confirmation', array( $this, 'gform_get_form_filter' ), 10, 2 );
32
+		add_filter('gform_get_form_filter', array($this, 'gform_get_form_filter'), 10, 2);
33
+		add_filter('gform_confirmation', array($this, 'gform_get_form_filter'), 10, 2);
34 34
 	}
35 35
 
36 36
 	/**
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	 * @param array $form Array with the form settings.
45 45
 	 * @return string $form_string The modified form HTML string.
46 46
 	 */
47
-	public function gform_get_form_filter( $form_string, $form ) {
47
+	public function gform_get_form_filter($form_string, $form) {
48 48
 		// if form has been submitted, use the submitted ID, otherwise generate a new unique ID
49
-		if ( isset( $_POST['gform_random_id'] ) ) {
50
-			$random_id = absint( $_POST['gform_random_id'] ); // Input var okay.
51
-		} elseif ( !in_array($form['id'], $this->previous_forms) ) {
49
+		if (isset($_POST['gform_random_id'])) {
50
+			$random_id = absint($_POST['gform_random_id']); // Input var okay.
51
+		} elseif (!in_array($form['id'], $this->previous_forms)) {
52 52
 			// if this is the first time we are seeing this form id then don't change the id
53 53
 			// this allows for add-ons like Stripe to still work since their JS depends on
54 54
 			// the form id.
@@ -63,60 +63,60 @@  discard block
 block discarded – undo
63 63
 
64 64
 		// define all occurences of the original form ID that wont hurt the form input
65 65
 		$strings = array(
66
-			' gform_wrapper'                                                   => ' gform_wrapper gform_wrapper_original_id_' . $form['id'],
67
-			"for='choice_"                                                      => "for='choice_" . $random_id . '_',
68
-			"id='label_"                                                        => "id='label_" . $random_id . '_',
69
-			"'gform_wrapper_" . $form['id'] . "'"                               => "'gform_wrapper_" . $random_id . "'",
70
-			"'gf_" . $form['id'] . "'"                                          => "'gf_" . $random_id . "'",
71
-			"'gform_" . $form['id'] . "'"                                       => "'gform_" . $random_id . "'",
72
-			"'gform_ajax_frame_" . $form['id'] . "'"                            => "'gform_ajax_frame_" . $random_id . "'",
73
-			'#gf_' . $form['id'] . "'"                                          => '#gf_' . $random_id . "'",
74
-			"'gform_fields_" . $form['id'] . "'"                                => "'gform_fields_" . $random_id . "'",
75
-			"id='field_" . $form['id'] . '_'                                    => "id='field_" . $random_id . '_',
76
-			"for='input_" . $form['id'] . '_'                                   => "for='input_" . $random_id . '_',
77
-			"id='input_" . $form['id'] . '_'                                    => "id='input_" . $random_id . '_',
78
-			"id='choice_" . $form['id'] . '_'                                   => "id='choice_" . $random_id . '_',
79
-			"'gform_submit_button_" . $form['id'] . "'"                         => "'gform_submit_button_" . $random_id . "'",
80
-			'"gf_submitting_' . $form['id'] . '"'                               => '"gf_submitting_' . $random_id . '"',
81
-			"'gf_submitting_" . $form['id'] . "'"                               => "'gf_submitting_" . $random_id . "'",
82
-			'#gform_ajax_frame_' . $form['id']                                  => '#gform_ajax_frame_' . $random_id,
83
-			'#gform_wrapper_' . $form['id']                                     => '#gform_wrapper_' . $random_id,
84
-			'#gform_' . $form['id']                                             => '#gform_' . $random_id,
85
-			"trigger('gform_post_render', [" . $form['id']                      => "trigger('gform_post_render', [" . $random_id,
86
-			'gformInitSpinner( ' . $form['id'] . ','                            => 'gformInitSpinner( ' . $random_id . ',',
87
-			"trigger('gform_page_loaded', [" . $form['id']                      => "trigger('gform_page_loaded', [" . $random_id,
88
-			"'gform_confirmation_loaded', [" . $form['id'] . ']'                => "'gform_confirmation_loaded', [" . $random_id . ']',
89
-			'gf_apply_rules(' . $form['id'] . ','                               => 'gf_apply_rules(' . $random_id . ',',
90
-			'gform_confirmation_wrapper_' . $form['id']                         => 'gform_confirmation_wrapper_' . $random_id,
91
-			'gforms_confirmation_message_' . $form['id']                        => 'gforms_confirmation_message_' . $random_id,
92
-			'gform_confirmation_message_' . $form['id']                         => 'gform_confirmation_message_' . $random_id,
93
-			'if(formId == ' . $form['id'] . ')'                                 => 'if(formId == ' . $random_id . ')',
94
-			"window['gf_form_conditional_logic'][" . $form['id'] . ']'          => "window['gf_form_conditional_logic'][" . $random_id . ']',
95
-			"trigger('gform_post_conditional_logic', [" . $form['id'] . ','     => "trigger('gform_post_conditional_logic', [" . $random_id . ',',
96
-			'gformShowPasswordStrength("input_' . $form['id'] . '_'             => 'gformShowPasswordStrength("input_' . $random_id . '_',
97
-			"gformInitChosenFields('#input_" . $form['id'] . '_'                => "gformInitChosenFields('#input_" . $random_id . '_',
98
-			"jQuery('#input_" . $form['id'] . '_'                               => "jQuery('#input_" . $random_id . '_',
99
-			'gforms_calendar_icon_input_' . $form['id'] . '_'                   => 'gforms_calendar_icon_input_' . $random_id . '_',
100
-			"id='ginput_base_price_" . $form['id'] . '_'                        => "id='ginput_base_price_" . $random_id . '_',
101
-			"id='ginput_quantity_" . $form['id'] . '_'                          => "id='ginput_quantity_" . $random_id . '_',
102
-			'gfield_price_' . $form['id'] . '_'                                 => 'gfield_price_' . $random_id . '_',
103
-			'gfield_quantity_' . $form['id'] . '_'                              => 'gfield_quantity_' . $random_id . '_',
104
-			'gfield_product_' . $form['id'] . '_'                               => 'gfield_product_' . $random_id . '_',
105
-			'ginput_total_' . $form['id']                                       => 'ginput_total_' . $random_id,
106
-			'GFCalc(' . $form['id'] . ','                                       => 'GFCalc(' . $random_id . ',',
107
-			'gf_global["number_formats"][' . $form['id'] . ']'                  => 'gf_global["number_formats"][' . $random_id . ']',
108
-			'gform_next_button_' . $form['id'] . '_'                            => 'gform_next_button_' . $random_id . '_',
109
-			'gform_source_page_number_' . $form['id']                           => 'gform_source_page_number_' . $random_id,
110
-			'gform_target_page_number_' . $form['id']                           => 'gform_target_page_number_' . $random_id,
111
-			$hidden_field                                                       => "<input type='hidden' name='gform_random_id' value='" . $random_id . "' />" . $hidden_field,
66
+			' gform_wrapper'                                                   => ' gform_wrapper gform_wrapper_original_id_'.$form['id'],
67
+			"for='choice_"                                                      => "for='choice_".$random_id.'_',
68
+			"id='label_"                                                        => "id='label_".$random_id.'_',
69
+			"'gform_wrapper_".$form['id']."'"                               => "'gform_wrapper_".$random_id."'",
70
+			"'gf_".$form['id']."'"                                          => "'gf_".$random_id."'",
71
+			"'gform_".$form['id']."'"                                       => "'gform_".$random_id."'",
72
+			"'gform_ajax_frame_".$form['id']."'"                            => "'gform_ajax_frame_".$random_id."'",
73
+			'#gf_'.$form['id']."'"                                          => '#gf_'.$random_id."'",
74
+			"'gform_fields_".$form['id']."'"                                => "'gform_fields_".$random_id."'",
75
+			"id='field_".$form['id'].'_'                                    => "id='field_".$random_id.'_',
76
+			"for='input_".$form['id'].'_'                                   => "for='input_".$random_id.'_',
77
+			"id='input_".$form['id'].'_'                                    => "id='input_".$random_id.'_',
78
+			"id='choice_".$form['id'].'_'                                   => "id='choice_".$random_id.'_',
79
+			"'gform_submit_button_".$form['id']."'"                         => "'gform_submit_button_".$random_id."'",
80
+			'"gf_submitting_'.$form['id'].'"'                               => '"gf_submitting_'.$random_id.'"',
81
+			"'gf_submitting_".$form['id']."'"                               => "'gf_submitting_".$random_id."'",
82
+			'#gform_ajax_frame_'.$form['id']                                  => '#gform_ajax_frame_'.$random_id,
83
+			'#gform_wrapper_'.$form['id']                                     => '#gform_wrapper_'.$random_id,
84
+			'#gform_'.$form['id']                                             => '#gform_'.$random_id,
85
+			"trigger('gform_post_render', [".$form['id']                      => "trigger('gform_post_render', [".$random_id,
86
+			'gformInitSpinner( '.$form['id'].','                            => 'gformInitSpinner( '.$random_id.',',
87
+			"trigger('gform_page_loaded', [".$form['id']                      => "trigger('gform_page_loaded', [".$random_id,
88
+			"'gform_confirmation_loaded', [".$form['id'].']'                => "'gform_confirmation_loaded', [".$random_id.']',
89
+			'gf_apply_rules('.$form['id'].','                               => 'gf_apply_rules('.$random_id.',',
90
+			'gform_confirmation_wrapper_'.$form['id']                         => 'gform_confirmation_wrapper_'.$random_id,
91
+			'gforms_confirmation_message_'.$form['id']                        => 'gforms_confirmation_message_'.$random_id,
92
+			'gform_confirmation_message_'.$form['id']                         => 'gform_confirmation_message_'.$random_id,
93
+			'if(formId == '.$form['id'].')'                                 => 'if(formId == '.$random_id.')',
94
+			"window['gf_form_conditional_logic'][".$form['id'].']'          => "window['gf_form_conditional_logic'][".$random_id.']',
95
+			"trigger('gform_post_conditional_logic', [".$form['id'].','     => "trigger('gform_post_conditional_logic', [".$random_id.',',
96
+			'gformShowPasswordStrength("input_'.$form['id'].'_'             => 'gformShowPasswordStrength("input_'.$random_id.'_',
97
+			"gformInitChosenFields('#input_".$form['id'].'_'                => "gformInitChosenFields('#input_".$random_id.'_',
98
+			"jQuery('#input_".$form['id'].'_'                               => "jQuery('#input_".$random_id.'_',
99
+			'gforms_calendar_icon_input_'.$form['id'].'_'                   => 'gforms_calendar_icon_input_'.$random_id.'_',
100
+			"id='ginput_base_price_".$form['id'].'_'                        => "id='ginput_base_price_".$random_id.'_',
101
+			"id='ginput_quantity_".$form['id'].'_'                          => "id='ginput_quantity_".$random_id.'_',
102
+			'gfield_price_'.$form['id'].'_'                                 => 'gfield_price_'.$random_id.'_',
103
+			'gfield_quantity_'.$form['id'].'_'                              => 'gfield_quantity_'.$random_id.'_',
104
+			'gfield_product_'.$form['id'].'_'                               => 'gfield_product_'.$random_id.'_',
105
+			'ginput_total_'.$form['id']                                       => 'ginput_total_'.$random_id,
106
+			'GFCalc('.$form['id'].','                                       => 'GFCalc('.$random_id.',',
107
+			'gf_global["number_formats"]['.$form['id'].']'                  => 'gf_global["number_formats"]['.$random_id.']',
108
+			'gform_next_button_'.$form['id'].'_'                            => 'gform_next_button_'.$random_id.'_',
109
+			'gform_source_page_number_'.$form['id']                           => 'gform_source_page_number_'.$random_id,
110
+			'gform_target_page_number_'.$form['id']                           => 'gform_target_page_number_'.$random_id,
111
+			$hidden_field                                                       => "<input type='hidden' name='gform_random_id' value='".$random_id."' />".$hidden_field,
112 112
 		);
113 113
 
114 114
 		// allow addons & plugins to add additional find & replace strings
115
-		$strings = apply_filters( 'gform_multiple_instances_strings', $strings, $form['id'], $random_id );
115
+		$strings = apply_filters('gform_multiple_instances_strings', $strings, $form['id'], $random_id);
116 116
 
117 117
 		// replace all occurences with the new unique ID
118
-		foreach ( $strings as $find => $replace ) {
119
-			$form_string = str_replace( $find, $replace, $form_string );
118
+		foreach ($strings as $find => $replace) {
119
+			$form_string = str_replace($find, $replace, $form_string);
120 120
 		}
121 121
 
122 122
 		return $form_string;
Please login to merge, or discard this patch.