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 (#24)
by
unknown
08:06
created
gravityforms-multiple-form-instances.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  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 );
28
+		add_filter('gform_get_form_filter', array($this, 'gform_get_form_filter'), 10, 2);
29 29
 		// hook the multifile upload script replace functionality
30
-		add_filter( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
30
+		add_filter('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
31 31
 	}
32 32
 
33 33
 	/**
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 	 * @param array $form Array with the form settings.
42 42
 	 * @return string $form_string The modified form HTML string.
43 43
 	 */
44
-	public function gform_get_form_filter( $form_string, $form ) {
44
+	public function gform_get_form_filter($form_string, $form) {
45 45
 		// if form has been submitted, use the submitted ID, otherwise generate a new unique ID
46
-		if ( isset( $_POST['gform_random_id'] ) ) {
47
-			$random_id = absint( $_POST['gform_random_id'] ); // Input var okay.
46
+		if (isset($_POST['gform_random_id'])) {
47
+			$random_id = absint($_POST['gform_random_id']); // Input var okay.
48 48
 		} else {
49 49
 			$random_id = mt_rand();	
50 50
 		}
@@ -54,66 +54,66 @@  discard block
 block discarded – undo
54 54
 
55 55
 		// define all occurences of the original form ID that wont hurt the form input
56 56
 		$strings = array(
57
-			' gform_wrapper '                                                   => ' gform_wrapper gform_wrapper_original_id_' . $form['id'] . ' ',
58
-			"for='choice_"                                                      => "for='choice_" . $random_id . '_',
59
-			"id='label_"                                                        => "id='label_" . $random_id . '_',
60
-			"'gform_wrapper_" . $form['id'] . "'"                               => "'gform_wrapper_" . $random_id . "'",
61
-			"'gf_" . $form['id'] . "'"                                          => "'gf_" . $random_id . "'",
62
-			"'gform_" . $form['id'] . "'"                                       => "'gform_" . $random_id . "'",
63
-			"'gform_ajax_frame_" . $form['id'] . "'"                            => "'gform_ajax_frame_" . $random_id . "'",
64
-			'#gf_' . $form['id'] . "'"                                          => '#gf_' . $random_id . "'",
65
-			"'gform_fields_" . $form['id'] . "'"                                => "'gform_fields_" . $random_id . "'",
66
-			"id='field_" . $form['id'] . '_'                                    => "id='field_" . $random_id . '_',
67
-			"for='input_" . $form['id'] . '_'                                   => "for='input_" . $random_id . '_',
68
-			"id='input_" . $form['id'] . '_'                                    => "id='input_" . $random_id . '_',
69
-			"id='choice_" . $form['id'] . '_'                                   => "id='choice_" . $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
-			'multipart_params":{"form_id"'                       => 'multipart_params":{"random_id":' . $random_id . ',"form_id"',
101
-			'gform_multifile_upload_' . $form['id'] . '_'                       => 'gform_multifile_upload_' . $random_id . '_',
102
-			'gform_drag_drop_area_' . $form['id'] . '_'                         => 'gform_drag_drop_area_' . $random_id . '_',
103
-			'gform_browse_button_' . $form['id'] . '_'                          => 'gform_browse_button_' . $random_id . '_',
104
-			'gform_preview_' . $form['id'] . '_'                                => 'gform_preview_' . $random_id . '_',
105
-			'gform_multifile_messages_' . $form['id'] . '_'                     => 'gform_multifile_messages_' . $random_id . '_',
106
-			'gform_uploaded_files_' . $form['id']                               => 'gform_uploaded_files_' . $random_id,
107
-			'gformDeleteUploadedFile(' . $form['id'] . ','                      => 'gformDeleteUploadedFile(' . $random_id . ',',
108
-			$hidden_field                                                       => "<input type='hidden' name='gform_random_id' value='" . $random_id . "' />" . $hidden_field,
57
+			' gform_wrapper '                                                   => ' gform_wrapper gform_wrapper_original_id_'.$form['id'].' ',
58
+			"for='choice_"                                                      => "for='choice_".$random_id.'_',
59
+			"id='label_"                                                        => "id='label_".$random_id.'_',
60
+			"'gform_wrapper_".$form['id']."'"                               => "'gform_wrapper_".$random_id."'",
61
+			"'gf_".$form['id']."'"                                          => "'gf_".$random_id."'",
62
+			"'gform_".$form['id']."'"                                       => "'gform_".$random_id."'",
63
+			"'gform_ajax_frame_".$form['id']."'"                            => "'gform_ajax_frame_".$random_id."'",
64
+			'#gf_'.$form['id']."'"                                          => '#gf_'.$random_id."'",
65
+			"'gform_fields_".$form['id']."'"                                => "'gform_fields_".$random_id."'",
66
+			"id='field_".$form['id'].'_'                                    => "id='field_".$random_id.'_',
67
+			"for='input_".$form['id'].'_'                                   => "for='input_".$random_id.'_',
68
+			"id='input_".$form['id'].'_'                                    => "id='input_".$random_id.'_',
69
+			"id='choice_".$form['id'].'_'                                   => "id='choice_".$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
+			'multipart_params&quot;:{&quot;form_id&quot;'                       => 'multipart_params&quot;:{&quot;random_id&quot;:'.$random_id.',&quot;form_id&quot;',
101
+			'gform_multifile_upload_'.$form['id'].'_'                       => 'gform_multifile_upload_'.$random_id.'_',
102
+			'gform_drag_drop_area_'.$form['id'].'_'                         => 'gform_drag_drop_area_'.$random_id.'_',
103
+			'gform_browse_button_'.$form['id'].'_'                          => 'gform_browse_button_'.$random_id.'_',
104
+			'gform_preview_'.$form['id'].'_'                                => 'gform_preview_'.$random_id.'_',
105
+			'gform_multifile_messages_'.$form['id'].'_'                     => 'gform_multifile_messages_'.$random_id.'_',
106
+			'gform_uploaded_files_'.$form['id']                               => 'gform_uploaded_files_'.$random_id,
107
+			'gformDeleteUploadedFile('.$form['id'].','                      => 'gformDeleteUploadedFile('.$random_id.',',
108
+			$hidden_field                                                       => "<input type='hidden' name='gform_random_id' value='".$random_id."' />".$hidden_field,
109 109
 		);
110 110
 
111 111
 		// allow addons & plugins to add additional find & replace strings
112
-		$strings = apply_filters( 'gform_multiple_instances_strings', $strings, $form['id'], $random_id );
112
+		$strings = apply_filters('gform_multiple_instances_strings', $strings, $form['id'], $random_id);
113 113
 
114 114
 		// replace all occurences with the new unique ID
115
-		foreach ( $strings as $find => $replace ) {
116
-			$form_string = str_replace( $find, $replace, $form_string );
115
+		foreach ($strings as $find => $replace) {
116
+			$form_string = str_replace($find, $replace, $form_string);
117 117
 		}
118 118
 
119 119
 		return $form_string;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @return void
128 128
 	 */
129 129
 	public function enqueue_scripts() {
130
-		wp_enqueue_script( 'gform_mfi_multifile', plugin_dir_url( __FILE__ ) . 'js/gravityforms-mfi-multifile.js', array( 'jquery', 'gform_gravityforms' ) );
130
+		wp_enqueue_script('gform_mfi_multifile', plugin_dir_url(__FILE__).'js/gravityforms-mfi-multifile.js', array('jquery', 'gform_gravityforms'));
131 131
 	}
132 132
 
133 133
 }
Please login to merge, or discard this patch.