Completed
Push — staging ( 5eea33...8ae341 )
by Evan
35:11 queued 15:14
created
public/partials/shortcodes/process/process_form_submission_ajax.php 2 patches
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -5,34 +5,34 @@  discard block
 block discarded – undo
5 5
 */
6 6
 
7 7
 // parse our form data
8
-parse_str( $_POST['form_data'], $data );
8
+parse_str( $_POST[ 'form_data' ], $data );
9 9
 // store the form ID to use in our hooks and filters
10
-$form = $_POST['form_id'];
10
+$form = $_POST[ 'form_id' ];
11 11
 
12 12
 // Retreive the form data from the database instead of posting it with the form-submission
13 13
 global $wpdb;
14 14
 // return it as an array, so we can work with it to build our form below
15 15
 $form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form . '', ARRAY_A );
16 16
 
17
-if( $form_results ) {
18
-	$form_data = $form_results[0];
17
+if ( $form_results ) {
18
+	$form_data = $form_results[ 0 ];
19 19
 	// List ID
20
-	$list_id = $form_data['list_id'];
20
+	$list_id = $form_data[ 'list_id' ];
21 21
 	// decode our submission settings
22
-	$submission_settings = json_decode( stripslashes( $form_data['submission_settings'] ), true );
22
+	$submission_settings = json_decode( stripslashes( $form_data[ 'submission_settings' ] ), true );
23 23
 	// decode our optin settings
24
-	$optin_settings = json_decode( stripslashes( $form_data['optin_settings'] ), true );
24
+	$optin_settings = json_decode( stripslashes( $form_data[ 'optin_settings' ] ), true );
25 25
 	// decode our fields
26
-	$form_fields = json_decode( stripslashes( $form_data['fields'] ), true );
26
+	$form_fields = json_decode( stripslashes( $form_data[ 'fields' ] ), true );
27 27
 	/*	Decode our error messages
28 28
 	*	Workaround for international characters (cyrillic etc)
29 29
 	* 	See: https://wordpress.org/support/topic/custom-messages-do-not-support-cyrillic-characters?replies=11#post-7629620
30 30
 	*/
31
-	$error_messages = ( get_magic_quotes_gpc() ) ? json_decode( stripslashes( $form_data['error_messages'] ), true ) : json_decode( $form_data['error_messages'], true );
31
+	$error_messages = ( get_magic_quotes_gpc() ) ? json_decode( stripslashes( $form_data[ 'error_messages' ] ), true ) : json_decode( $form_data[ 'error_messages' ], true );
32 32
 	/** Submit Process **/
33
-	$notifications = json_decode( stripslashes( $form_data['custom_notifications'] ), true );
33
+	$notifications = json_decode( stripslashes( $form_data[ 'custom_notifications' ] ), true );
34 34
 	/* Page Data */
35
-	$page_data = $_POST['page_data'];
35
+	$page_data = $_POST[ 'page_data' ];
36 36
 }
37 37
 
38 38
 // Empty array to build up merge variables
@@ -42,39 +42,39 @@  discard block
 block discarded – undo
42 42
 $error = 0;
43 43
 
44 44
 /* Check for Honeypot filled */
45
-$honey_pot_filled = ( isset( $data['yikes-mailchimp-honeypot'] ) && $data['yikes-mailchimp-honeypot'] != '' ) ? true : false;
45
+$honey_pot_filled = ( isset( $data[ 'yikes-mailchimp-honeypot' ] ) && $data[ 'yikes-mailchimp-honeypot' ] != '' ) ? true : false;
46 46
 // if it was filled out, return an error...
47
-if( $honey_pot_filled ) {
47
+if ( $honey_pot_filled ) {
48 48
 	wp_send_json_error( array(
49 49
 		'hide' => '0',
50 50
 		'error' => 1,
51
-		'response' => __( "Error: It looks like the honeypot was filled out and the form was not properly be submitted." , 'yikes-inc-easy-mailchimp-extender' )
51
+		'response' => __( "Error: It looks like the honeypot was filled out and the form was not properly be submitted.", 'yikes-inc-easy-mailchimp-extender' )
52 52
 	) );
53 53
 	return;
54 54
 }
55 55
 
56 56
 // Check reCAPTCHA Response was submitted with the form data
57
-if( isset( $data['g-recaptcha-response'] ) ) {
58
-	$url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key' , '' ) . '&response=' . $data['g-recaptcha-response'] . '&remoteip=' . $_SERVER["REMOTE_ADDR"] );
57
+if ( isset( $data[ 'g-recaptcha-response' ] ) ) {
58
+	$url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $data[ 'g-recaptcha-response' ] . '&remoteip=' . $_SERVER[ "REMOTE_ADDR" ] );
59 59
 	$response = wp_remote_get( $url );
60
-	$response_body = json_decode( $response['body'] , true );
60
+	$response_body = json_decode( $response[ 'body' ], true );
61 61
 	// if we've hit an error, lets return the error!
62
-	if( $response_body['success'] != 1 ) {
62
+	if ( $response_body[ 'success' ] != 1 ) {
63 63
 		$error_messages = array(); // empty array to store error messages
64
-		if( isset( $response_body['error-codes'] ) ) {
65
-			foreach( $response_body['error-codes'] as $error_code ) {
66
-				if( $error_code == 'missing-input-response' ) {
64
+		if ( isset( $response_body[ 'error-codes' ] ) ) {
65
+			foreach ( $response_body[ 'error-codes' ] as $error_code ) {
66
+				if ( $error_code == 'missing-input-response' ) {
67 67
 					$error_code = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' );
68 68
 				}
69
-				$error_messages[] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code;
69
+				$error_messages[ ] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code;
70 70
 			}
71 71
 		} else {
72
-			$error_messages[] = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' );
72
+			$error_messages[ ] = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' );
73 73
 		}
74 74
 		$error = 1;
75 75
 		wp_send_json_error( array(
76 76
 			'hide' => '0',
77
-			'error' => $error ,
77
+			'error' => $error,
78 78
 			'response' => apply_filters( 'yikes-mailchimp-recaptcha-required-error', implode( ' ', $error_messages ) ),
79 79
 		) );
80 80
 		exit();
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 
84 84
 // loop to push variables to our array
85 85
 foreach ( $data as $merge_tag => $value ) {
86
-	if( $merge_tag != 'yikes_easy_mc_new_subscriber' && $merge_tag != '_wp_http_referer' ) {
86
+	if ( $merge_tag != 'yikes_easy_mc_new_subscriber' && $merge_tag != '_wp_http_referer' ) {
87 87
 		// check if the current iteration has a 'date_format' key set
88 88
 		// (aka - date/birthday fields)
89
-		if( isset( $form_fields[$merge_tag]['date_format'] ) ) {
89
+		if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) {
90 90
 			// check if EU date format
91
-			if( $form_fields[$merge_tag]['date_format'] == 'DD/MM/YYYY' ) {
91
+			if ( $form_fields[ $merge_tag ][ 'date_format' ] == 'DD/MM/YYYY' ) {
92 92
 				// convert '/' to '.' and to UNIX timestamp
93 93
 				$value = date( 'Y-m-d', strtotime( str_replace( '/', '.', $value ) ) );
94 94
 			} else {
@@ -96,22 +96,22 @@  discard block
 block discarded – undo
96 96
 				$value = date( 'Y-m-d', strtotime( $value ) );
97 97
 			}
98 98
 		}
99
-		if( is_numeric( $merge_tag ) ) { // this is is an interest group!
100
-			$merge_variables['groupings'][] = array( 'id' => $merge_tag , 'groups' => ( is_array( $value ) ) ? $value : array( $value ) );
99
+		if ( is_numeric( $merge_tag ) ) { // this is is an interest group!
100
+			$merge_variables[ 'groupings' ][ ] = array( 'id' => $merge_tag, 'groups' => ( is_array( $value ) ) ? $value : array( $value ) );
101 101
 		} else { // or else it's just a standard merge variable
102
-			$merge_variables[$merge_tag] = $value;
102
+			$merge_variables[ $merge_tag ] = $value;
103 103
 		}
104 104
 	}
105 105
 }
106 106
 // store the opt-in time
107
-$merge_variables['optin_time'] = current_time( 'Y-m-d H:i:s', 1 );
107
+$merge_variables[ 'optin_time' ] = current_time( 'Y-m-d H:i:s', 1 );
108 108
 
109 109
 // Submit our form data
110
-$api_key = trim( get_option( 'yikes-mc-api-key' , '' ) );
110
+$api_key = trim( get_option( 'yikes-mc-api-key', '' ) );
111 111
 $dash_position = strpos( $api_key, '-' );
112 112
 
113 113
 // setup the end point
114
-if( $dash_position !== false ) {
114
+if ( $dash_position !== false ) {
115 115
 	$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/subscribe.json';
116 116
 }
117 117
 
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 *	Allow users to check for submit value
138 138
 *	and pass back an error to the user
139 139
 */
140
-if( isset( $merge_variables['error'] ) ) {
140
+if ( isset( $merge_variables[ 'error' ] ) ) {
141 141
 	// send our error response back
142
-	wp_send_json_error( array( 'hide' => '0', 'error' => $merge_variables['error']  , 'response' => $merge_variables['message']  ) );
142
+	wp_send_json_error( array( 'hide' => '0', 'error' => $merge_variables[ 'error' ], 'response' => $merge_variables[ 'message' ] ) );
143 143
 	return;
144 144
 }
145 145
 
@@ -149,72 +149,72 @@  discard block
 block discarded – undo
149 149
 		'body' => apply_filters( 'yikes-mailchimp-user-subscribe-api-request', array(
150 150
 			'apikey' => $api_key,
151 151
 			'id' => $list_id,
152
-			'email' => array( 'email' => sanitize_email( $data['EMAIL'] ) ),
152
+			'email' => array( 'email' => sanitize_email( $data[ 'EMAIL' ] ) ),
153 153
 			'merge_vars' => $merge_variables,
154
-			'double_optin' => $optin_settings['optin'],
154
+			'double_optin' => $optin_settings[ 'optin' ],
155 155
 			'update_existing' => 0, // always set to 0 (when 0, users cannot update. when 1, users can click a link to send an email where they can then update their details)
156
-			'send_welcome' => $optin_settings['send_welcome_email'],
157
-			'replace_interests' => ( isset( $submission_settings['replace_interests'] ) ) ? $submission_settings['replace_interests'] : 1, // defaults to replace
158
-		), $form, $list_id, $data['EMAIL'] ),
156
+			'send_welcome' => $optin_settings[ 'send_welcome_email' ],
157
+			'replace_interests' => ( isset( $submission_settings[ 'replace_interests' ] ) ) ? $submission_settings[ 'replace_interests' ] : 1, // defaults to replace
158
+		), $form, $list_id, $data[ 'EMAIL' ] ),
159 159
 		'timeout' => 10,
160 160
 		'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
161 161
 	) );
162 162
 
163 163
 	$subscribe_response = json_decode( wp_remote_retrieve_body( $subscribe_response ), true );
164 164
 
165
-	if( isset( $subscribe_response['error'] ) ) {
165
+	if ( isset( $subscribe_response[ 'error' ] ) ) {
166 166
 
167
-		if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
167
+		if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
168 168
 			require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
169 169
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
170
-			$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribe_response['error'], __( "Subscribe New User" , 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission_ajax.php" );
170
+			$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribe_response[ 'error' ], __( "Subscribe New User", 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission_ajax.php" );
171 171
 		}
172 172
 
173 173
 		$update_account_details_link = '';
174 174
 		$error = 1;
175
-		switch( $subscribe_response['code'] ) {
175
+		switch ( $subscribe_response[ 'code' ] ) {
176 176
 			// user already subscribed
177 177
 			case '214':
178
-				$update_account_details_link = ( $optin_settings['update_existing_user'] == 1 ) ? apply_filters( 'yikes-easy-mailchimp-update-existing-subscriber-text', sprintf( __( ' To update your MailChimp profile, please %s.', 'yikes-inc-easy-mailchimp-extender' ), '<a class="send-update-email" data-list-id="' . $list_id . '" data-user-email="' . sanitize_email( $data['EMAIL'] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ) ) : false;
179
-				if( ! empty( $error_messages['already-subscribed'] ) ) {
180
-					$error_response = $error_messages['already-subscribed'] . ' ' . $update_account_details_link;
178
+				$update_account_details_link = ( $optin_settings[ 'update_existing_user' ] == 1 ) ? apply_filters( 'yikes-easy-mailchimp-update-existing-subscriber-text', sprintf( __( ' To update your MailChimp profile, please %s.', 'yikes-inc-easy-mailchimp-extender' ), '<a class="send-update-email" data-list-id="' . $list_id . '" data-user-email="' . sanitize_email( $data[ 'EMAIL' ] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ) ) : false;
179
+				if ( ! empty( $error_messages[ 'already-subscribed' ] ) ) {
180
+					$error_response = $error_messages[ 'already-subscribed' ] . ' ' . $update_account_details_link;
181 181
 				} else {
182
-					$error_response = $subscribe_response['error'] . ' ' . $update_account_details_link;
182
+					$error_response = $subscribe_response[ 'error' ] . ' ' . $update_account_details_link;
183 183
 				}
184 184
 				break;
185 185
 			// missing a required field
186 186
 			case '250':
187 187
 					// get all merge variables in array, loop and str_replace error code with field name
188
-					$api_key = trim( get_option( 'yikes-mc-api-key' , '' ) );
188
+					$api_key = trim( get_option( 'yikes-mc-api-key', '' ) );
189 189
 					$dash_position = strpos( $api_key, '-' );
190
-					if( $dash_position !== false ) {
190
+					if ( $dash_position !== false ) {
191 191
 						$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json';
192 192
 					}
193 193
 					$merge_variables = wp_remote_post( $api_endpoint, array(
194 194
 						'body' => array(
195 195
 							'apikey' => $api_key,
196
-							'id' => array( $list_id ) ,
196
+							'id' => array( $list_id ),
197 197
 						),
198 198
 						'timeout' => 10,
199 199
 						'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
200 200
 					) );
201 201
 					$merge_variables = json_decode( wp_remote_retrieve_body( $merge_variables ), true );
202
-					if( is_wp_error( $merge_variables ) || isset( $merge_variables['error'] ) ) {
203
-						if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
202
+					if ( is_wp_error( $merge_variables ) || isset( $merge_variables[ 'error' ] ) ) {
203
+						if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
204 204
 							require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
205 205
 							$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
206
-							$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission_ajax.php" );
206
+							$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission_ajax.php" );
207 207
 						}
208 208
 					}
209 209
 					// re-store our data
210
-					$merge_variables = $merge_variables['data'][0]['merge_vars'];
210
+					$merge_variables = $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ];
211 211
 					$merge_variable_name_array = array();
212
-					foreach( $merge_variables as $merge_var ) {
213
-						$merge_variables_name_array[$merge_var['tag']] = $merge_var['name'];
212
+					foreach ( $merge_variables as $merge_var ) {
213
+						$merge_variables_name_array[ $merge_var[ 'tag' ] ] = $merge_var[ 'name' ];
214 214
 					}
215
-					$error_message = $subscribe_response['error'];
215
+					$error_message = $subscribe_response[ 'error' ];
216 216
 					// replace tag with name in the error message.
217
-					foreach( $merge_variables_name_array as $tag => $name ) {
217
+					foreach ( $merge_variables_name_array as $tag => $name ) {
218 218
 						$error_message = str_replace( $tag, $name, $error_message );
219 219
 					}
220 220
 					$error_response = $error_message;
@@ -222,14 +222,14 @@  discard block
 block discarded – undo
222 222
 			// [email protected] is not allowed
223 223
 			case '-99':
224 224
 				// generic error
225
-				$error_response = str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response['error'] ) );
225
+				$error_response = str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response[ 'error' ] ) );
226 226
 				break;
227 227
 			// invalid email (or no email at all)
228 228
 				case '-100':
229
-					$error_response = ( ! empty( $error_messages['invalid-email'] ) ) ? $error_messages['invalid-email'] : __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' );
229
+					$error_response = ( ! empty( $error_messages[ 'invalid-email' ] ) ) ? $error_messages[ 'invalid-email' ] : __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' );
230 230
 					break;
231 231
 			default:
232
-				$error_response = ( ! empty( $error_messages['general-error'] ) ) ? $error_messages['general-error'] : $subscribe_response['error'];
232
+				$error_response = ( ! empty( $error_messages[ 'general-error' ] ) ) ? $error_messages[ 'general-error' ] : $subscribe_response[ 'error' ];
233 233
 				break;
234 234
 		}
235 235
 		// send the response
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 	/*
248 248
 	*	Successful form submission redirect
249 249
 	*/
250
-	if( $submission_settings['redirect_on_submission'] == '1' ) {
250
+	if ( $submission_settings[ 'redirect_on_submission' ] == '1' ) {
251 251
 		$redirection = '1';
252
-		$redirect_url = ( 'custom_url' != $submission_settings['redirect_page'] ) ? get_permalink( $submission_settings['redirect_page'] ) : $submission_settings['custom_redirect_url'];
252
+		$redirect_url = ( 'custom_url' != $submission_settings[ 'redirect_page' ] ) ? get_permalink( $submission_settings[ 'redirect_page' ] ) : $submission_settings[ 'custom_redirect_url' ];
253 253
 		$redirect = '<script type="text/javascript">setTimeout(function() { window.location="' . apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_url ), $form, $page_data ) . '"; }, ' . apply_filters( 'yikes-mailchimp-redirect-timer', 1500 ) . ');</script>';
254 254
 	}
255 255
 
@@ -265,16 +265,16 @@  discard block
 block discarded – undo
265 265
 	do_action( 'yikes-mailchimp-after-submission-' . $form, $merge_variables );
266 266
 
267 267
 	// send our notifications if setup (must go before wp_send_json())
268
-	do_action( 'yikes-mailchimp-form-submission' , sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications );
269
-	do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications );
268
+	do_action( 'yikes-mailchimp-form-submission', sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications );
269
+	do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications );
270 270
 
271
-	$default_success_response = ( 1 === $optin_settings['optin'] ) ? __( "Thank you for subscribing! Check your email for the confirmation message." , 'yikes-inc-easy-mailchimp-extender' ) : __( "Thank you for subscribing!" , 'yikes-inc-easy-mailchimp-extender' );
271
+	$default_success_response = ( 1 === $optin_settings[ 'optin' ] ) ? __( "Thank you for subscribing! Check your email for the confirmation message.", 'yikes-inc-easy-mailchimp-extender' ) : __( "Thank you for subscribing!", 'yikes-inc-easy-mailchimp-extender' );
272 272
 
273 273
 	wp_send_json_success(
274 274
 		array(
275
-			'hide' => $submission_settings['hide_form_post_signup'],
275
+			'hide' => $submission_settings[ 'hide_form_post_signup' ],
276 276
 			'error' => $error,
277
-			'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages['success'] ) ? $error_messages['success'] : $default_success_response ), $form, $merge_variables ),
277
+			'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages[ 'success' ] ) ? $error_messages[ 'success' ] : $default_success_response ), $form, $merge_variables ),
278 278
 			'redirection' => isset( $redirection ) ? '1' : '0',
279 279
 			'redirect' => isset( $redirect ) ? $redirect : '',
280 280
 		)
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,9 +96,11 @@
 block discarded – undo
96 96
 				$value = date( 'Y-m-d', strtotime( $value ) );
97 97
 			}
98 98
 		}
99
-		if( is_numeric( $merge_tag ) ) { // this is is an interest group!
99
+		if( is_numeric( $merge_tag ) ) {
100
+// this is is an interest group!
100 101
 			$merge_variables['groupings'][] = array( 'id' => $merge_tag , 'groups' => ( is_array( $value ) ) ? $value : array( $value ) );
101
-		} else { // or else it's just a standard merge variable
102
+		} else {
103
+// or else it's just a standard merge variable
102 104
 			$merge_variables[$merge_tag] = $value;
103 105
 		}
104 106
 	}
Please login to merge, or discard this patch.
public/partials/shortcodes/process/process_form_submission.php 3 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,9 +92,11 @@
 block discarded – undo
92 92
 					$value = ( '' != $value ) ? date( 'Y-m-d', strtotime( $value ) ) : '';
93 93
 				}
94 94
 			}
95
-			if( is_numeric( $merge_tag ) ) { // this is is an interest group!
95
+			if( is_numeric( $merge_tag ) ) {
96
+// this is is an interest group!
96 97
 				$merge_variables['groupings'][] = array( 'id' => $merge_tag , 'groups' => ( is_array( $value ) ) ? $value : array( $value ) );
97
-			} else { // or else it's just a standard merge variable
98
+			} else {
99
+// or else it's just a standard merge variable
98 100
 				$merge_variables[$merge_tag] = $value;
99 101
 			}
100 102
 		}
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 // Process our form submissions (non ajax forms)
19 19
 if ( ! isset( $_POST['yikes_easy_mc_new_subscriber'] ) || ! wp_verify_nonce( $_POST['yikes_easy_mc_new_subscriber'], 'yikes_easy_mc_form_submit' ) ) {
20 20
 
21
-    $process_submission_response = '<p><small class="form_submission_error">' . __( "Error : Sorry, the nonce security check didn't pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt." , 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
21
+	 $process_submission_response = '<p><small class="form_submission_error">' . __( "Error : Sorry, the nonce security check didn't pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt." , 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
22 22
 	return;
23 23
 
24 24
 } else {
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 	$merge_variables = apply_filters( 'yikes-mailchimp-before-submission-' . $form_id, $merge_variables );
125 125
 
126 126
 	/**
127
-	* Action hooks fired before API request
128
-	* @since 6.0.5.5
129
-	* @param $merge_variables 	array 	Array of merge variable to use
130
-	* @param $form_id						integer	The form ID to target (eg: 1, 2 etc.)
131
-	*/
127
+	 * Action hooks fired before API request
128
+	 * @since 6.0.5.5
129
+	 * @param $merge_variables 	array 	Array of merge variable to use
130
+	 * @param $form_id						integer	The form ID to target (eg: 1, 2 etc.)
131
+	 */
132 132
 	do_action( 'yikes-mailchimp-before-submission', $merge_variables );
133 133
 	do_action( 'yikes-mailchimp-before-submission-' . $form_id, $merge_variables );
134 134
 
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -8,45 +8,45 @@  discard block
 block discarded – undo
8 8
 global $form_submitted, $process_submission_response;
9 9
 
10 10
 // confirm we have a form id to work with
11
-$form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? $_POST['yikes-mailchimp-submitted-form'] : false;
12
-if( ! $form_id ) {
11
+$form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? $_POST[ 'yikes-mailchimp-submitted-form' ] : false;
12
+if ( ! $form_id ) {
13 13
 	return;
14 14
 }
15 15
 
16
-$form_settings = Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $_POST['yikes-mailchimp-submitted-form'] );
16
+$form_settings = Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $_POST[ 'yikes-mailchimp-submitted-form' ] );
17 17
 
18 18
 // Process our form submissions (non ajax forms)
19
-if ( ! isset( $_POST['yikes_easy_mc_new_subscriber'] ) || ! wp_verify_nonce( $_POST['yikes_easy_mc_new_subscriber'], 'yikes_easy_mc_form_submit' ) ) {
19
+if ( ! isset( $_POST[ 'yikes_easy_mc_new_subscriber' ] ) || ! wp_verify_nonce( $_POST[ 'yikes_easy_mc_new_subscriber' ], 'yikes_easy_mc_form_submit' ) ) {
20 20
 
21
-    $process_submission_response = '<p><small class="form_submission_error">' . __( "Error : Sorry, the nonce security check didn't pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt." , 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
21
+    $process_submission_response = '<p><small class="form_submission_error">' . __( "Error : Sorry, the nonce security check didn't pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.", 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
22 22
 	return;
23 23
 
24 24
 } else {
25 25
 
26 26
 	/* Check for Honeypot filled */
27
-	$honey_pot_filled = ( isset( $_POST['yikes-mailchimp-honeypot'] ) && $_POST['yikes-mailchimp-honeypot'] != '' ) ? true : false;
27
+	$honey_pot_filled = ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $_POST[ 'yikes-mailchimp-honeypot' ] != '' ) ? true : false;
28 28
 	// if it was filled out, return an error...
29 29
 	if ( $honey_pot_filled ) {
30
-		$process_submission_response = '<p><small class="form_submission_error">' . __( "Error: It looks like the honeypot was filled out and the form was not properly be submitted." , 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
30
+		$process_submission_response = '<p><small class="form_submission_error">' . __( "Error: It looks like the honeypot was filled out and the form was not properly be submitted.", 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
31 31
 		return;
32 32
 	}
33 33
 
34 34
 	// Check reCAPTCHA Response
35
-	if( isset( $_POST['g-recaptcha-response'] ) ) {
36
-		$url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key' , '' ) . '&response=' . $_POST['g-recaptcha-response'] . '&remoteip=' . $_SERVER["REMOTE_ADDR"] );
35
+	if ( isset( $_POST[ 'g-recaptcha-response' ] ) ) {
36
+		$url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $_POST[ 'g-recaptcha-response' ] . '&remoteip=' . $_SERVER[ "REMOTE_ADDR" ] );
37 37
 		$response = wp_remote_get( $url );
38
-		$response_body = json_decode( $response['body'] , true );
38
+		$response_body = json_decode( $response[ 'body' ], true );
39 39
 
40 40
 		// if we've hit an error, lets return the error!
41
-		if( $response_body['success'] != 1 ) {
41
+		if ( $response_body[ 'success' ] != 1 ) {
42 42
 			$recaptcha_error = array(); // empty array to store error messages
43
-			foreach( $response_body['error-codes'] as $error_code ) {
44
-				if( $error_code == 'missing-input-response' ) {
43
+			foreach ( $response_body[ 'error-codes' ] as $error_code ) {
44
+				if ( $error_code == 'missing-input-response' ) {
45 45
 					$error_code = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' );
46 46
 				}
47
-				$recaptcha_error[] = $error_code;
47
+				$recaptcha_error[ ] = $error_code;
48 48
 			}
49
-			$process_submission_response .= "<p class='yikes-easy-mc-error-message'>" . apply_filters( 'yikes-mailchimp-recaptcha-required-error', __( 'Error' , 'yikes-inc-easy-mailchimp-extender' )  . ': ' . implode( ' ' , $recaptcha_error ) ) . "</p>";
49
+			$process_submission_response .= "<p class='yikes-easy-mc-error-message'>" . apply_filters( 'yikes-mailchimp-recaptcha-required-error', __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . implode( ' ', $recaptcha_error ) ) . "</p>";
50 50
 			return;
51 51
 		}
52 52
 	}
@@ -56,20 +56,20 @@  discard block
 block discarded – undo
56 56
 	*	No HTML5 validation, and don't want to use jQuery for non-ajax forms
57 57
 	*/
58 58
 	$missing_required_checkbox_interest_groups = array();
59
-	foreach( $form_settings['fields'] as $merge_tag => $field_data ) {
60
-		if( is_numeric( $merge_tag ) ) {
59
+	foreach ( $form_settings[ 'fields' ] as $merge_tag => $field_data ) {
60
+		if ( is_numeric( $merge_tag ) ) {
61 61
 			// check if the checkbox group was set to required, if so return an error
62
-			if( isset( $field_data['require'] ) && $field_data['require'] == 1 ) {
63
-				if( $field_data['type'] == 'checkboxes' ) {
64
-					if( ! isset( $_POST[$merge_tag] ) ) {
65
-						$missing_required_checkbox_interest_groups[] = $merge_tag;
62
+			if ( isset( $field_data[ 'require' ] ) && $field_data[ 'require' ] == 1 ) {
63
+				if ( $field_data[ 'type' ] == 'checkboxes' ) {
64
+					if ( ! isset( $_POST[ $merge_tag ] ) ) {
65
+						$missing_required_checkbox_interest_groups[ ] = $merge_tag;
66 66
 					}
67 67
 				}
68 68
 			}
69 69
 		}
70 70
 	}
71 71
 
72
-	if( ! empty( $missing_required_checkbox_interest_groups ) ) {
72
+	if ( ! empty( $missing_required_checkbox_interest_groups ) ) {
73 73
 		$process_submission_response = '<p class="yikes-easy-mc-error-message">' . apply_filters( 'yikes-mailchimp-interest-group-required-top-error', sprintf( _n( 'It looks like you forgot to fill in a required field.', 'It looks like you forgot to fill in %s required fields.', count( $missing_required_checkbox_interest_groups ), 'yikes-inc-easy-mailchimp-extender' ), count( $missing_required_checkbox_interest_groups ) ), count( $missing_required_checkbox_interest_groups ), $form_id ) . '</p>';
74 74
 		return;
75 75
 	}
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 
80 80
 	// loop to push variables to our array
81 81
 	foreach ( $_POST as $merge_tag => $value ) {
82
-		if( $merge_tag != 'yikes_easy_mc_new_subscriber' && $merge_tag != '_wp_http_referer' ) {
82
+		if ( $merge_tag != 'yikes_easy_mc_new_subscriber' && $merge_tag != '_wp_http_referer' ) {
83 83
 			// check if the current iteration has a 'date_format' key set
84 84
 			// (aka - date/birthday fields)
85
-			if( isset( $form_settings['fields'][$merge_tag]['date_format'] ) ) {
85
+			if ( isset( $form_settings[ 'fields' ][ $merge_tag ][ 'date_format' ] ) ) {
86 86
 				// check if EU date format
87
-				if( $form_settings['fields'][$merge_tag]['date_format'] == 'DD/MM/YYYY' ) {
87
+				if ( $form_settings[ 'fields' ][ $merge_tag ][ 'date_format' ] == 'DD/MM/YYYY' ) {
88 88
 					// convert '/' to '.' and to UNIX timestamp
89 89
 					$value = ( '' != $value ) ? date( 'Y-m-d', strtotime( str_replace( '/', '.', $value ) ) ) : '';
90 90
 				} else {
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
 					$value = ( '' != $value ) ? date( 'Y-m-d', strtotime( $value ) ) : '';
93 93
 				}
94 94
 			}
95
-			if( is_numeric( $merge_tag ) ) { // this is is an interest group!
96
-				$merge_variables['groupings'][] = array( 'id' => $merge_tag , 'groups' => ( is_array( $value ) ) ? $value : array( $value ) );
95
+			if ( is_numeric( $merge_tag ) ) { // this is is an interest group!
96
+				$merge_variables[ 'groupings' ][ ] = array( 'id' => $merge_tag, 'groups' => ( is_array( $value ) ) ? $value : array( $value ) );
97 97
 			} else { // or else it's just a standard merge variable
98
-				$merge_variables[$merge_tag] = $value;
98
+				$merge_variables[ $merge_tag ] = $value;
99 99
 			}
100 100
 		}
101 101
 	}
102 102
 
103 103
 	// store the opt-in time
104
-	$merge_variables['optin_time'] = current_time( 'Y-m-d H:i:s', 1 );
104
+	$merge_variables[ 'optin_time' ] = current_time( 'Y-m-d H:i:s', 1 );
105 105
 
106 106
 	// Submit our form data
107
-	$api_key = trim( get_option( 'yikes-mc-api-key' , '' ) );
107
+	$api_key = trim( get_option( 'yikes-mc-api-key', '' ) );
108 108
 	$dash_position = strpos( $api_key, '-' );
109 109
 
110 110
 	// setup the end point
111
-	if( $dash_position !== false ) {
111
+	if ( $dash_position !== false ) {
112 112
 		$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/subscribe.json';
113 113
 	}
114 114
 
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 	*	Allow users to check for submit value
137 137
 	*	and pass back an error to the user
138 138
 	*/
139
-	if( isset( $merge_variables['error'] ) ) {
140
-		$process_submission_response = apply_filters( 'yikes-mailchimp-frontend-content' , $merge_variables['message'] );
139
+	if ( isset( $merge_variables[ 'error' ] ) ) {
140
+		$process_submission_response = apply_filters( 'yikes-mailchimp-frontend-content', $merge_variables[ 'message' ] );
141 141
 		return;
142 142
 	}
143 143
 
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 		$subscribe_response = wp_remote_post( $api_endpoint, array(
147 147
 			'body' => apply_filters( 'yikes-mailchimp-user-subscribe-api-request', array(
148 148
 				'apikey' => $api_key,
149
-				'id' => $_POST['yikes-mailchimp-associated-list-id'],
150
-				'email' => array( 'email' => sanitize_email( $_POST['EMAIL'] ) ),
149
+				'id' => $_POST[ 'yikes-mailchimp-associated-list-id' ],
150
+				'email' => array( 'email' => sanitize_email( $_POST[ 'EMAIL' ] ) ),
151 151
 				'merge_vars' => $merge_variables,
152
-				'double_optin' => $form_settings['optin_settings']['optin'],
152
+				'double_optin' => $form_settings[ 'optin_settings' ][ 'optin' ],
153 153
 				'update_existing' => 0, // always set to 0 (when 0, users cannot update. when 1, users can click a link to send an email where they can then update their details)
154
-				'send_welcome' => $form_settings['optin_settings']['send_welcome_email'],
155
-				'replace_interests' => ( isset( $form_settings['submission_settings']['replace_interests'] ) ) ? $form_settings['submission_settings']['replace_interests'] : 1, // defaults to replace
156
-			), $form_id, $_POST['yikes-mailchimp-associated-list-id'], $_POST['EMAIL'] ),
154
+				'send_welcome' => $form_settings[ 'optin_settings' ][ 'send_welcome_email' ],
155
+				'replace_interests' => ( isset( $form_settings[ 'submission_settings' ][ 'replace_interests' ] ) ) ? $form_settings[ 'submission_settings' ][ 'replace_interests' ] : 1, // defaults to replace
156
+			), $form_id, $_POST[ 'yikes-mailchimp-associated-list-id' ], $_POST[ 'EMAIL' ] ),
157 157
 			'timeout' => 10,
158 158
 			'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
159 159
 		) );
@@ -161,66 +161,66 @@  discard block
 block discarded – undo
161 161
 		$subscribe_response = json_decode( wp_remote_retrieve_body( $subscribe_response ), true );
162 162
 
163 163
 		// check for any errors
164
-		if( isset( $subscribe_response['error'] ) ) {
164
+		if ( isset( $subscribe_response[ 'error' ] ) ) {
165 165
 
166
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
166
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
167 167
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
168 168
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
169
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribe_response['error'], __( "Subscribe New User" , 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission.php" );
169
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribe_response[ 'error' ], __( "Subscribe New User", 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission.php" );
170 170
 			}
171 171
 
172 172
 			$update_account_details_link = '';
173
-			switch( $subscribe_response['code'] ) {
173
+			switch ( $subscribe_response[ 'code' ] ) {
174 174
 				// user already subscribed
175 175
 				case '214':
176
-					$update_account_details_link = ( $form_settings['optin_settings']['update_existing_user'] == 1 ) ? apply_filters( 'yikes-easy-mailchimp-update-existing-subscriber-text', sprintf( __( ' To update your MailChimp profile, please %s.', 'yikes-inc-easy-mailchimp-extender' ), '<a class="send-update-email" data-list-id="' . $_POST['yikes-mailchimp-associated-list-id'] . '" data-user-email="' . sanitize_email( $_POST['EMAIL'] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ), '<a class="send-update-email" data-list-id="' . $_POST['yikes-mailchimp-associated-list-id'] . '" data-user-email="' . sanitize_email( $_POST['EMAIL'] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ) : false;
177
-					if( $update_account_details_link ) {
176
+					$update_account_details_link = ( $form_settings[ 'optin_settings' ][ 'update_existing_user' ] == 1 ) ? apply_filters( 'yikes-easy-mailchimp-update-existing-subscriber-text', sprintf( __( ' To update your MailChimp profile, please %s.', 'yikes-inc-easy-mailchimp-extender' ), '<a class="send-update-email" data-list-id="' . $_POST[ 'yikes-mailchimp-associated-list-id' ] . '" data-user-email="' . sanitize_email( $_POST[ 'EMAIL' ] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ), '<a class="send-update-email" data-list-id="' . $_POST[ 'yikes-mailchimp-associated-list-id' ] . '" data-user-email="' . sanitize_email( $_POST[ 'EMAIL' ] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ) : false;
177
+					if ( $update_account_details_link ) {
178 178
 						// if update account details is set, we need to include our script to send out the update email
179
-						wp_enqueue_script( 'update-existing-subscriber.js', YIKES_MC_URL . 'public/js/yikes-update-existing-subscriber.js' , array( 'jquery' ), 'all' );
179
+						wp_enqueue_script( 'update-existing-subscriber.js', YIKES_MC_URL . 'public/js/yikes-update-existing-subscriber.js', array( 'jquery' ), 'all' );
180 180
 						wp_localize_script( 'update-existing-subscriber.js', 'update_subscriber_details_data', array(
181 181
 							'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
182 182
 							'preloader_url' => apply_filters( 'yikes-mailchimp-preloader', esc_url_raw( admin_url( 'images/wpspin_light.gif' ) ) ),
183 183
 						) );
184 184
 					}
185
-					if( ! empty( $form_settings['error_messages']['already-subscribed'] ) ) {
186
-						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $form_settings['error_messages']['already-subscribed'] . ' ' . $update_account_details_link . '</p>';
185
+					if ( ! empty( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) ) {
186
+						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $form_settings[ 'error_messages' ][ 'already-subscribed' ] . ' ' . $update_account_details_link . '</p>';
187 187
 					} else {
188
-						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $subscribe_response['error'] . ' ' . $update_account_details_link . '</p>';
188
+						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $subscribe_response[ 'error' ] . ' ' . $update_account_details_link . '</p>';
189 189
 					}
190 190
 					break;
191 191
 				// missing a required field
192 192
 				case '250':
193 193
 						// get all merge variables in array, loop and str_replace error code with field name
194
-						$api_key = trim( get_option( 'yikes-mc-api-key' , '' ) );
194
+						$api_key = trim( get_option( 'yikes-mc-api-key', '' ) );
195 195
 						$dash_position = strpos( $api_key, '-' );
196
-						if( $dash_position !== false ) {
196
+						if ( $dash_position !== false ) {
197 197
 							$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json';
198 198
 						}
199 199
 						$merge_variables = wp_remote_post( $api_endpoint, array(
200 200
 							'body' => array(
201 201
 								'apikey' => $api_key,
202
-								'id' => array( $_POST['yikes-mailchimp-associated-list-id'] ) ,
202
+								'id' => array( $_POST[ 'yikes-mailchimp-associated-list-id' ] ),
203 203
 							),
204 204
 							'timeout' => 10,
205 205
 							'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
206 206
 						) );
207 207
 						$merge_variables = json_decode( wp_remote_retrieve_body( $merge_variables ), true );
208
-						if( isset( $merge_variables['error'] ) ) {
209
-							if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
208
+						if ( isset( $merge_variables[ 'error' ] ) ) {
209
+							if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
210 210
 								require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
211 211
 								$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
212
-								$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission.php" );
212
+								$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission.php" );
213 213
 							}
214 214
 						}
215 215
 						// re-store our data
216
-						$merge_variables = $merge_variables['data'][0]['merge_vars'];
216
+						$merge_variables = $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ];
217 217
 						$merge_variable_name_array = array();
218
-						foreach( $merge_variables as $merge_var ) {
219
-							$merge_variables_name_array[$merge_var['tag']] = $merge_var['name'];
218
+						foreach ( $merge_variables as $merge_var ) {
219
+							$merge_variables_name_array[ $merge_var[ 'tag' ] ] = $merge_var[ 'name' ];
220 220
 						}
221
-						$error_message = $subscribe_response['error'];
221
+						$error_message = $subscribe_response[ 'error' ];
222 222
 						// replace tag with name in the error message.
223
-						foreach( $merge_variables_name_array as $tag => $name ) {
223
+						foreach ( $merge_variables_name_array as $tag => $name ) {
224 224
 							$error_message = str_replace( $tag, $name, $error_message );
225 225
 						}
226 226
 						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $error_message . '.</p>';
@@ -228,18 +228,18 @@  discard block
 block discarded – undo
228 228
 				// [email protected] is not allowed
229 229
 				case '-99':
230 230
 					// generic error
231
-					$process_submission_response = '<p class="yikes-easy-mc-error-message">' .  str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response['error'] ) ) . '</p>';
231
+					$process_submission_response = '<p class="yikes-easy-mc-error-message">' . str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response[ 'error' ] ) ) . '</p>';
232 232
 					break;
233 233
 				// invalid email (or no email at all)
234 234
 				case '-100':
235
-					$process_submission_response = ( ! empty( $form_settings['error_messages']['invalid-email'] ) ) ? '<p class="yikes-easy-mc-error-message">' . $form_settings['error_messages']['invalid-email'] . '</p>' : '<p class="yikes-easy-mc-error-message">' . __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
235
+					$process_submission_response = ( ! empty( $form_settings[ 'error_messages' ][ 'invalid-email' ] ) ) ? '<p class="yikes-easy-mc-error-message">' . $form_settings[ 'error_messages' ][ 'invalid-email' ] . '</p>' : '<p class="yikes-easy-mc-error-message">' . __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
236 236
 					break;
237 237
 				default:
238 238
 					// generic error
239
-					if( ! empty( $form_settings['error_messages']['general-error'] ) ) {
240
-						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $form_settings['error_messages']['general-error'] . '</p>';
239
+					if ( ! empty( $form_settings[ 'error_messages' ][ 'general-error' ] ) ) {
240
+						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $form_settings[ 'error_messages' ][ 'general-error' ] . '</p>';
241 241
 					} else {
242
-						$process_submission_response = '<p class="yikes-easy-mc-error-message">' .  $subscribe_response['error'] . '</p>';
242
+						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $subscribe_response[ 'error' ] . '</p>';
243 243
 					}
244 244
 					break;
245 245
 			}
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 		$form_submitted = 1;
251 251
 
252 252
 		// Display the success message
253
-		if( ! empty( $form_settings['error_messages']['success'] ) ) {
254
-			$process_submission_response = '<p class="yikes-easy-mc-success-message">' . apply_filters( 'yikes-mailchimp-success-response', stripslashes( esc_html( $form_settings['error_messages']['success'] ) ), $form_id, $merge_variables ) . '</p>';
253
+		if ( ! empty( $form_settings[ 'error_messages' ][ 'success' ] ) ) {
254
+			$process_submission_response = '<p class="yikes-easy-mc-success-message">' . apply_filters( 'yikes-mailchimp-success-response', stripslashes( esc_html( $form_settings[ 'error_messages' ][ 'success' ] ) ), $form_id, $merge_variables ) . '</p>';
255 255
 			// echo stripslashes( esc_html( $error_messages['success'] ) );
256 256
 		} else {
257
-			$default_success_response = ( 1 === $form_settings['optin_settings']['optin'] ) ? __( 'Thank you for subscribing! Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' ) : __( 'Thank you for subscribing!' , 'yikes-inc-easy-mailchimp-extender' );
257
+			$default_success_response = ( 1 === $form_settings[ 'optin_settings' ][ 'optin' ] ) ? __( 'Thank you for subscribing! Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' ) : __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' );
258 258
 			$process_submission_response = '<p class="yikes-easy-mc-success-message">' . apply_filters( 'yikes-mailchimp-success-response', $default_success_response, $form_id, $merge_variables ) . '</p>';
259 259
 			// echo $default_success_response;
260 260
 		}
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
 		* 	optional @form - the ID of the form to filter
268 268
 		*	@since 6.0.0
269 269
 		*/
270
-		do_action( 'yikes-mailchimp-after-submission' , $merge_variables );
271
-		do_action( 'yikes-mailchimp-after-submission-' . $form_id , $merge_variables );
270
+		do_action( 'yikes-mailchimp-after-submission', $merge_variables );
271
+		do_action( 'yikes-mailchimp-after-submission-' . $form_id, $merge_variables );
272 272
 
273 273
 		/*
274 274
 		*	Non-AJAX redirects now handled in class-yikes-inc-easy-mailchimp-extender-public.php
@@ -286,23 +286,23 @@  discard block
 block discarded – undo
286 286
 		*	@$notifications - the notification array
287 287
 		*	@since 6.0.0
288 288
 		*/
289
-		do_action( 'yikes-mailchimp-form-submission' , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] );
290
-		do_action( 'yikes-mailchimp-form-submission-' . $form_id , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] );
289
+		do_action( 'yikes-mailchimp-form-submission', $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] );
290
+		do_action( 'yikes-mailchimp-form-submission-' . $form_id, $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] );
291 291
 
292 292
 		/*
293 293
 		*	Increase the submission count for this form
294 294
 		*	on a successful submission
295 295
 		*	@since 6.0.0
296 296
 		*/
297
-		$form_settings['submissions']++;
297
+		$form_settings[ 'submissions' ]++;
298 298
 		$wpdb->update(
299 299
 			$wpdb->prefix . 'yikes_easy_mc_forms',
300 300
 			array(
301
-				'submissions' => $form_settings['submissions'],
301
+				'submissions' => $form_settings[ 'submissions' ],
302 302
 			),
303 303
 			array( 'ID' => $form_id ),
304 304
 			array(
305
-				'%d',	// send welcome email
305
+				'%d', // send welcome email
306 306
 			),
307 307
 			array( '%d' )
308 308
 		);
Please login to merge, or discard this patch.
public/partials/ajax/class.public_ajax.php 2 patches
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -11,16 +11,16 @@  discard block
 block discarded – undo
11 11
 		 */
12 12
 		public function __construct() {
13 13
 			// ajax process form submission
14
-			add_action( 'wp_ajax_nopriv_process_form_submission', array( $this , 'process_form_submission' ), 10 );
15
-			add_action( 'wp_ajax_process_form_submission', array( $this , 'process_form_submission' ), 10 );
14
+			add_action( 'wp_ajax_nopriv_process_form_submission', array( $this, 'process_form_submission' ), 10 );
15
+			add_action( 'wp_ajax_process_form_submission', array( $this, 'process_form_submission' ), 10 );
16 16
 
17 17
 			// ajax send update emails
18
-			add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 );
19
-			add_action( 'wp_ajax_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 );
18
+			add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 );
19
+			add_action( 'wp_ajax_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 );
20 20
 
21 21
 			// increase submission count for a given form on successful submit
22
-			add_action( 'wp_ajax_nopriv_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 );
23
-			add_action( 'wp_ajax_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 );
22
+			add_action( 'wp_ajax_nopriv_increase_submission_count', array( $this, 'increase_submission_count' ), 10 );
23
+			add_action( 'wp_ajax_increase_submission_count', array( $this, 'increase_submission_count' ), 10 );
24 24
 		}
25 25
 
26 26
 		/*
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
 		*/
41 41
 		public function increase_submission_count() {
42 42
 			// store our posted form ID
43
-			$form_id = $_POST['form_id'];
43
+			$form_id = $_POST[ 'form_id' ];
44 44
 			global $wpdb;
45 45
 			// query the form
46 46
 			$form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form_id . '', ARRAY_A );
47
-			$form_data = $form_results[0];
47
+			$form_data = $form_results[ 0 ];
48 48
 			// increase the submission
49
-			$form_data['submissions']++;
49
+			$form_data[ 'submissions' ]++;
50 50
 			// update the value in the database
51 51
 			$wpdb->update(
52 52
 				$wpdb->prefix . 'yikes_easy_mc_forms',
53 53
 					array(
54
-						'submissions' => $form_data['submissions'],
54
+						'submissions' => $form_data[ 'submissions' ],
55 55
 					),
56 56
 					array( 'ID' => $form_id ),
57 57
 					array(
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
 			@since v6.0.4.1
69 69
 		*/
70 70
 		public function sendUpdateProfileEmail() {
71
-			$user_email = $_POST['user_email'];
72
-			$list_id = $_POST['list_id'];
71
+			$user_email = $_POST[ 'user_email' ];
72
+			$list_id = $_POST[ 'list_id' ];
73 73
 
74
-			$api_key = trim( get_option( 'yikes-mc-api-key' , '' ) );
74
+			$api_key = trim( get_option( 'yikes-mc-api-key', '' ) );
75 75
 			$dash_position = strpos( $api_key, '-' );
76
-			$explode_key = explode( '-' , $api_key );
77
-			$data_center = $explode_key[1];
78
-			$full_site_url = get_bloginfo('url');
76
+			$explode_key = explode( '-', $api_key );
77
+			$data_center = $explode_key[ 1 ];
78
+			$full_site_url = get_bloginfo( 'url' );
79 79
 
80 80
 			// list details api call
81
-			if( $dash_position !== false ) {
81
+			if ( $dash_position !== false ) {
82 82
 				$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json';
83 83
 			}
84 84
 			$list_details = wp_remote_post( $api_endpoint, array(
@@ -92,16 +92,16 @@  discard block
 block discarded – undo
92 92
 				'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
93 93
 			) );
94 94
 			$list_details = json_decode( wp_remote_retrieve_body( $list_details ), true );
95
-			if( isset( $list_details['error'] ) ) {
96
-				if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
95
+			if ( isset( $list_details[ 'error' ] ) ) {
96
+				if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
97 97
 					require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
98 98
 					$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
99
-					$error_logging->yikes_easy_mailchimp_write_to_error_log( $list_details['error'], __( "Send Update Profile Email - Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
99
+					$error_logging->yikes_easy_mailchimp_write_to_error_log( $list_details[ 'error' ], __( "Send Update Profile Email - Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
100 100
 				}
101 101
 			}
102 102
 
103 103
 			// account details api call
104
-			if( $dash_position !== false ) {
104
+			if ( $dash_position !== false ) {
105 105
 				$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/helper/account-details.json';
106 106
 			}
107 107
 			$account_details = wp_remote_post( $api_endpoint, array(
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
 				'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
113 113
 			) );
114 114
 			$account_details = json_decode( wp_remote_retrieve_body( $account_details ), true );
115
-			if( isset( $account_details['error'] ) ) {
116
-				if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
115
+			if ( isset( $account_details[ 'error' ] ) ) {
116
+				if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
117 117
 					require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
118 118
 					$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
119
-					$error_logging->yikes_easy_mailchimp_write_to_error_log( $account_details['error'], __( "Send Update Profile Email - Get Account Details" , 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
119
+					$error_logging->yikes_easy_mailchimp_write_to_error_log( $account_details[ 'error' ], __( "Send Update Profile Email - Get Account Details", 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
120 120
 				}
121 121
 			}
122 122
 
123 123
 			// subscriber details api call
124
-			if( $dash_position !== false ) {
124
+			if ( $dash_position !== false ) {
125 125
 				$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/member-info.json';
126 126
 			}
127 127
 			$subscriber_account_details = wp_remote_post( $api_endpoint, array(
@@ -136,27 +136,27 @@  discard block
 block discarded – undo
136 136
 				'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
137 137
 			) );
138 138
 			$subscriber_account_details = json_decode( wp_remote_retrieve_body( $subscriber_account_details ), true );
139
-			if( isset( $subscriber_account_details['error'] ) ) {
140
-				if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
139
+			if ( isset( $subscriber_account_details[ 'error' ] ) ) {
140
+				if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
141 141
 					require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
142 142
 					$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
143
-					$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscriber_account_details['error'], __( "Send Update Profile Email - Get Member Info." , 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
143
+					$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscriber_account_details[ 'error' ], __( "Send Update Profile Email - Get Member Info.", 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
144 144
 				}
145 145
 			}
146 146
 
147 147
 			// check for errors in any of the calls
148
-			if( isset( $list_details['error'] ) || isset( $account_details['error'] ) || isset( $subscriber_account_details['error'] ) ) {
149
-				$error_message = ( isset( $list_details['error'] ) ) ? $list_details['error'] : false;
150
-				if( ! $error_message ) {
151
-					$error_message = ( isset( $account_details['error'] ) ) ? $account_details['error'] : false;
152
-					if( ! $error_message ) {
153
-						$error_message = ( isset( $subscriber_account_details['error'] ) ) ? $subscriber_account_details['error'] : false;
154
-						if( ! $error_message ) {
148
+			if ( isset( $list_details[ 'error' ] ) || isset( $account_details[ 'error' ] ) || isset( $subscriber_account_details[ 'error' ] ) ) {
149
+				$error_message = ( isset( $list_details[ 'error' ] ) ) ? $list_details[ 'error' ] : false;
150
+				if ( ! $error_message ) {
151
+					$error_message = ( isset( $account_details[ 'error' ] ) ) ? $account_details[ 'error' ] : false;
152
+					if ( ! $error_message ) {
153
+						$error_message = ( isset( $subscriber_account_details[ 'error' ] ) ) ? $subscriber_account_details[ 'error' ] : false;
154
+						if ( ! $error_message ) {
155 155
 							$error_message = '';
156 156
 						}
157 157
 					}
158 158
 				}
159
-				$errorMessage = sprintf( __( 'Error sending update profile email. <strong>Error: %s</strong>. Please contact the site administrator.' , 'yikes-inc-easy-mailchimp-extender' ), $error_message );
159
+				$errorMessage = sprintf( __( 'Error sending update profile email. <strong>Error: %s</strong>. Please contact the site administrator.', 'yikes-inc-easy-mailchimp-extender' ), $error_message );
160 160
 				wp_send_json_error(
161 161
 					array(
162 162
 						'response_text' => '<div class="yikes-easy-mc-error-message">&#10005; ' . $errorMessage . '</div>',
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
 			}
167 167
 
168 168
 			// send the email!
169
-			$subscriber_id = $subscriber_account_details['data'][0]['id'];
170
-			$explode_url = explode( '.' , $account_details['contact']['url'] );
171
-			$update_link_href = 'http://' . $explode_url[1] . '.' . $data_center . '.list-manage1.com/profile?u=' . $account_details['user_id'] . '&id=' . $list_id .'&e=' . $subscriber_id;
169
+			$subscriber_id = $subscriber_account_details[ 'data' ][ 0 ][ 'id' ];
170
+			$explode_url = explode( '.', $account_details[ 'contact' ][ 'url' ] );
171
+			$update_link_href = 'http://' . $explode_url[ 1 ] . '.' . $data_center . '.list-manage1.com/profile?u=' . $account_details[ 'user_id' ] . '&id=' . $list_id . '&e=' . $subscriber_id;
172 172
 			$subject = 'MailChimp Profile Update';
173
-			$headers = 'From: ' . $list_details['data'][0]['default_from_name'] . ' <' . $list_details['data'][0]['default_from_email'] . '>' . "\r\n";
173
+			$headers = 'From: ' . $list_details[ 'data' ][ 0 ][ 'default_from_name' ] . ' <' . $list_details[ 'data' ][ 0 ][ 'default_from_email' ] . '>' . "\r\n";
174 174
 			$headers .= 'Content-type: text/html';
175 175
 				$email_content = '<p>Greetings,</p> <p>A request has been made to update your MailChimp account profile information. To do so please use the following link: <a href="' . $update_link_href . '" title="Update MailChimp Profile">Update MailChimp Profile Info.</a>';
176 176
 				$email_content .= "<p>If you did not request this update, please disregard this email.</p>";
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 			if ( wp_mail( $user_email, apply_filters( 'yikes-mailchimp-update-email-subject', $subject ), apply_filters( 'yikes-mailchimp-update-email-content', $email_content, $update_link_href ), $headers ) ) {
184 184
 				wp_send_json_success(
185 185
 					array(
186
-						'response_text' => '<div class="yikes-easy-mc-success-message">' . sprintf( __( '%s Update email successfully sent. Please check your inbox for the message.' , 'yikes-inc-easy-mailchimp-extender' ), '&#10004;' ) . '</div>',
186
+						'response_text' => '<div class="yikes-easy-mc-success-message">' . sprintf( __( '%s Update email successfully sent. Please check your inbox for the message.', 'yikes-inc-easy-mailchimp-extender' ), '&#10004;' ) . '</div>',
187 187
 					)
188 188
 				);
189 189
 				exit;
190 190
 			} else {
191 191
 				wp_send_json_error(
192 192
 					array(
193
-						'response_text' => '<div class="yikes-easy-mc-error-message">' . sprintf( __( '%s Email failed to send. Please contact the site administrator.' , 'yikes-inc-easy-mailchimp-extender' ), '&#10005;' ) . '</div>',
193
+						'response_text' => '<div class="yikes-easy-mc-error-message">' . sprintf( __( '%s Email failed to send. Please contact the site administrator.', 'yikes-inc-easy-mailchimp-extender' ), '&#10005;' ) . '</div>',
194 194
 					)
195 195
 				);
196 196
 				exit;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-	class YIKES_Inc_Easy_MailChimp_Public_Ajax
3
-	{
2
+	class YIKES_Inc_Easy_MailChimp_Public_Ajax {
4 3
 
5 4
 		/**
6 5
 		 * Thetext domain of this plugin
Please login to merge, or discard this patch.
public/classes/checkbox-integrations/class.comment_form-checkbox.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 			
25 25
 		
26 26
 		/**
27
-		* Outputs a checkbox, if user is not already subscribed
28
-		*/
27
+		 * Outputs a checkbox, if user is not already subscribed
28
+		 */
29 29
 		public function output_checkbox( $comment_field ) {
30 30
 			if( $this->is_user_already_subscribed( $this->type ) == '1' ) {
31 31
 				return $comment_field;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		 *	a new comment is submitted
41 41
 		 *
42 42
 		 *	@since 6.0.0
43
-		**/
43
+		 **/
44 44
 		public function subscribe_from_comment( $comment_id , $comment_approved ) {	
45 45
 			// was sign-up checkbox checked?
46 46
 			if ( $this->was_checkbox_checked( $this->type ) === false ) {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 	*/
7 7
 	
8 8
 	// Prevent direct access to the file
9
-	defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) );
9
+	defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) );
10 10
 	
11 11
 	class Yikes_Easy_MC_Comment_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class {
12 12
 	
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 		* Outputs a checkbox, if user is not already subscribed
28 28
 		*/
29 29
 		public function output_checkbox( $comment_field ) {
30
-			if( $this->is_user_already_subscribed( $this->type ) == '1' ) {
30
+			if ( $this->is_user_already_subscribed( $this->type ) == '1' ) {
31 31
 				return $comment_field;
32 32
 			}
33
-				echo do_action( 'yikes-mailchimp-before-checkbox' , $this->type );
33
+				echo do_action( 'yikes-mailchimp-before-checkbox', $this->type );
34 34
 					echo $comment_field . $this->yikes_get_checkbox();
35
-				echo do_action( 'yikes-mailchimp-after-checkbox' , $this->type );
35
+				echo do_action( 'yikes-mailchimp-after-checkbox', $this->type );
36 36
 		}		
37 37
 	
38 38
 		/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		 *
42 42
 		 *	@since 6.0.0
43 43
 		**/
44
-		public function subscribe_from_comment( $comment_id , $comment_approved ) {	
44
+		public function subscribe_from_comment( $comment_id, $comment_approved ) {	
45 45
 			// was sign-up checkbox checked?
46 46
 			if ( $this->was_checkbox_checked( $this->type ) === false ) {
47 47
 				return false;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 				'OPTIN_IP' => $comment_data->comment_author_IP,
59 59
 			);
60 60
 			// subscribe the user 
61
-			$this->subscribe_user_integration( sanitize_email( $comment_data->comment_author_email ) , $this->type , $merge_vars );
61
+			$this->subscribe_user_integration( sanitize_email( $comment_data->comment_author_email ), $this->type, $merge_vars );
62 62
 		}
63 63
 		
64 64
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 		// declare our integration type
14 14
 		protected $type = 'comment_form';
15 15
 	
16
-		public function __construct() {	
16
+		public function __construct() {
17 17
 			// hooks for outputting the checkbox
18 18
 			add_action( 'thesis_hook_after_comment_box', array( $this, 'output_checkbox' ), 10 );
19 19
 			add_action( 'comment_form_field_comment', array( $this, 'output_checkbox' ), 10 );
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		 *
42 42
 		 *	@since 6.0.0
43 43
 		**/
44
-		public function subscribe_from_comment( $comment_id , $comment_approved ) {	
44
+		public function subscribe_from_comment( $comment_id , $comment_approved ) {
45 45
 			// was sign-up checkbox checked?
46 46
 			if ( $this->was_checkbox_checked( $this->type ) === false ) {
47 47
 				return false;
Please login to merge, or discard this patch.
classes/checkbox-integrations/class.woocommerce_checkout_form-checkbox.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -65,17 +65,17 @@
 block discarded – undo
65 65
 	}
66 66
 	
67 67
 	/**
68
-	* @param int $order_id
69
-	*/
68
+	 * @param int $order_id
69
+	 */
70 70
 	public function save_woocommerce_checkout_checkbox_value( $order_id ) {
71 71
 		// update the order post meta
72 72
 		update_post_meta( $order_id, 'yikes_easy_mailchimp_optin', $this->was_checkbox_checked( $this->type ) );
73 73
 	}
74 74
 	
75 75
 	/**
76
-	* @param int $order_id
77
-	* @return boolean
78
-	*/
76
+	 * @param int $order_id
77
+	 * @return boolean
78
+	 */
79 79
 	public function subscribe_from_woocommerce_checkout( $order_id ) {
80 80
 		$do_optin = get_post_meta( $order_id, 'yikes_easy_mailchimp_optin', true );
81 81
 		if( $do_optin == '1' ) {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 */
9 9
 
10 10
 // Prevent direct access to the file
11
-defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) );
11
+defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) );
12 12
 
13 13
 class Yikes_Easy_MC_WooCommerce_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class {
14 14
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function get_position() {
34 34
 		$opts = $this->get_options();
35
-		return $opts['woocommerce_position'];
35
+		return $opts[ 'woocommerce_position' ];
36 36
 	}
37 37
 	
38 38
 	/**
@@ -42,22 +42,22 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function add_checkout_field( $fields ) {
44 44
 		// get checkbox data
45
-		$checkbox_options = get_option( 'optin-checkbox-init' , '' );
45
+		$checkbox_options = get_option( 'optin-checkbox-init', '' );
46 46
 		// only display the field if a list is set
47
-		if( isset( $checkbox_options ) && $checkbox_options[$this->type]['associated-list'] != '-' ) {
48
-			if( $this->is_user_already_subscribed( $this->type ) == '1' ) {
47
+		if ( isset( $checkbox_options ) && $checkbox_options[ $this->type ][ 'associated-list' ] != '-' ) {
48
+			if ( $this->is_user_already_subscribed( $this->type ) == '1' ) {
49 49
 				return $fields;
50 50
 			}
51
-			if( isset( $checkbox_options[$this->type]['precheck'] ) && $checkbox_options[$this->type]['precheck'] == 'true' ) {
51
+			if ( isset( $checkbox_options[ $this->type ][ 'precheck' ] ) && $checkbox_options[ $this->type ][ 'precheck' ] == 'true' ) {
52 52
 				$precheck = '1';
53 53
 			} else {
54 54
 				$precheck = '0';
55 55
 			}
56
-			$fields[ 'billing' ]['yikes_mailchimp_checkbox_'.$this->type] = array(
57
-				'id' => 'yikes_mailchimp_checkbox_'.$this->type,
56
+			$fields[ 'billing' ][ 'yikes_mailchimp_checkbox_' . $this->type ] = array(
57
+				'id' => 'yikes_mailchimp_checkbox_' . $this->type,
58 58
 				'type'    => 'checkbox',
59 59
 				'class' => array(),
60
-				'label'   => $checkbox_options[$this->type]['label'],
60
+				'label'   => $checkbox_options[ $this->type ][ 'label' ],
61 61
 				'default' => $precheck,
62 62
 			);
63 63
 		}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	*/
79 79
 	public function subscribe_from_woocommerce_checkout( $order_id ) {
80 80
 		$do_optin = get_post_meta( $order_id, 'yikes_easy_mailchimp_optin', true );
81
-		if( $do_optin == '1' ) {
81
+		if ( $do_optin == '1' ) {
82 82
 			$order = new WC_Order( $order_id );
83 83
 			$email = $order->billing_email;
84 84
 			$merge_vars = array(
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 				'LNAME' => $order->billing_last_name,
88 88
 			);
89 89
 			// subscribe the user
90
-			$this->subscribe_user_integration( sanitize_email( $email ) , $this->type , $merge_vars );
90
+			$this->subscribe_user_integration( sanitize_email( $email ), $this->type, $merge_vars );
91 91
 		}
92 92
 		return false;
93 93
 	}
Please login to merge, or discard this patch.
public/classes/checkbox-integrations/class.contact_form_7-checkbox.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 	}
31 31
 	
32 32
 	/**
33
-	* Registers the CF7 shortcode
33
+	 * Registers the CF7 shortcode
34 34
 	 *
35
-	* @return boolean
36
-	*/
35
+	 * @return boolean
36
+	 */
37 37
 	public function init() {
38 38
 		if( ! function_exists( 'wpcf7_add_shortcode' ) ) {
39 39
 			return false;
@@ -43,21 +43,21 @@  discard block
 block discarded – undo
43 43
 	}
44 44
 	
45 45
 	/**
46
-	* Alter Contact Form 7 data.
47
-	*
48
-	* Adds yikes_mailchimp_checkbox to post data so users can use `yikes_mailchimp_checkbox` in their email templates
49
-	*
50
-	* @param array $data
51
-	* @return array
52
-	*/
46
+	 * Alter Contact Form 7 data.
47
+	 *
48
+	 * Adds yikes_mailchimp_checkbox to post data so users can use `yikes_mailchimp_checkbox` in their email templates
49
+	 *
50
+	 * @param array $data
51
+	 * @return array
52
+	 */
53 53
 	public function alter_cf7_data( $data = array() ) {
54 54
 		$data['yikes_mailchimp_checkbox'] = $this->was_checkbox_checked( $this->type ) ? __( 'Yes', 'yikes-inc-easy-mailchimp-extender' ) : __( 'No', 'yikes-inc-easy-mailchimp-extender' );
55 55
 		return $data;
56 56
 	}
57 57
 	
58 58
 	/**
59
-	* Subscribe from Contact Form 7 Forms
60
-	*/
59
+	 * Subscribe from Contact Form 7 Forms
60
+	 */
61 61
 	public function new_cf7_subscription( $contact_form ) {
62 62
 		// was sign-up checkbox checked?
63 63
 		if ( $this->was_checkbox_checked( $this->type ) === false ) {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 */
12 12
 	
13 13
 // Prevent direct access to the file
14
-defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) );
14
+defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) );
15 15
 
16 16
 class Yikes_Easy_MC_CF7_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class {
17 17
 	/**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		// initialize
27 27
 		$this->init();
28 28
 		add_action( 'wpcf7_mail_sent', array( $this, 'new_cf7_subscription' ) );
29
-		add_action( 'wpcf7_posted_data', array( $this, 'alter_cf7_data') );
29
+		add_action( 'wpcf7_posted_data', array( $this, 'alter_cf7_data' ) );
30 30
 	}
31 31
 	
32 32
 	/**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	* @return boolean
36 36
 	*/
37 37
 	public function init() {
38
-		if( ! function_exists( 'wpcf7_add_shortcode' ) ) {
38
+		if ( ! function_exists( 'wpcf7_add_shortcode' ) ) {
39 39
 			return false;
40 40
 		}
41 41
 		wpcf7_add_shortcode( 'yikes_mailchimp_checkbox', array( $this, 'yikes_get_checkbox' ) );
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	* @return array
52 52
 	*/
53 53
 	public function alter_cf7_data( $data = array() ) {
54
-		$data['yikes_mailchimp_checkbox'] = $this->was_checkbox_checked( $this->type ) ? __( 'Yes', 'yikes-inc-easy-mailchimp-extender' ) : __( 'No', 'yikes-inc-easy-mailchimp-extender' );
54
+		$data[ 'yikes_mailchimp_checkbox' ] = $this->was_checkbox_checked( $this->type ) ? __( 'Yes', 'yikes-inc-easy-mailchimp-extender' ) : __( 'No', 'yikes-inc-easy-mailchimp-extender' );
55 55
 		return $data;
56 56
 	}
57 57
 	
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			return false;
65 65
 		}
66 66
 		// get the integration options
67
-		$integration_options = get_option( 'optin-checkbox-init' , '' );
67
+		$integration_options = get_option( 'optin-checkbox-init', '' );
68 68
 		// get the contact form 7 submission instance
69 69
 		$submission = WPCF7_Submission::get_instance();
70 70
 		// confirm the submission was received
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			// get the submission data
73 73
 			$posted_data = $submission->get_posted_data();
74 74
 			// store the email -- this needs to be more dynamic (find string with containing string email?)
75
-			$email = ( isset( $posted_data['your-email'] ) ) ? $posted_data['your-email'] : '';
75
+			$email = ( isset( $posted_data[ 'your-email' ] ) ) ? $posted_data[ 'your-email' ] : '';
76 76
 			// submit this subscriber
77 77
 			return $this->subscribe_user_integration( $email, $this->type, apply_filters( 'yikes-mailchimp-contact-form-7', array(), $posted_data ) );
78 78
 		}
Please login to merge, or discard this patch.
public/class-yikes-inc-easy-mailchimp-extender-public.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 	}
74 74
 	
75 75
 	/**
76
-	*	Create our own custom the_content(); filter to prevent plugins and such from hooking in where not wanted
77
-	*
78
-	*	@since 6.0.3
79
-	*/
76
+	 *	Create our own custom the_content(); filter to prevent plugins and such from hooking in where not wanted
77
+	 *
78
+	 *	@since 6.0.3
79
+	 */
80 80
 	public function yikes_custom_frontend_content_filter() {
81 81
 		add_filter( 'yikes-mailchimp-frontend-content', 'wptexturize' );
82 82
 		add_filter( 'yikes-mailchimp-frontend-content', 'convert_smilies' );
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 *	load our checkbox classes
94 94
 	 *
95 95
 	 *	@since 6.0.0
96
-	**/
96
+	 **/
97 97
 	public function load_checkbox_integration_classes() {
98 98
 		// store our options
99 99
 		$integrations = get_option( 'optin-checkbox-init' , '' );
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		 * 	@since 6.0.0
47 47
 		 */
48 48
 		if ( ! defined( 'YIKES_MC_VERSION' ) ) {
49
-			define( 'YIKES_MC_VERSION' , $version );
49
+			define( 'YIKES_MC_VERSION', $version );
50 50
 		}
51 51
 		/*
52 52
 		*	Include our helper functions
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 		// include our ajax processing class
64 64
 		require_once( YIKES_MC_PATH . 'public/partials/ajax/class.public_ajax.php' );
65 65
 		// Include our error logging class
66
-		add_action( 'init' , array( $this , 'load_error_logging_class' ) , 1 );
66
+		add_action( 'init', array( $this, 'load_error_logging_class' ), 1 );
67 67
 		// load our checkbox classes
68
-		add_action( 'init' , array( $this , 'load_checkbox_integration_classes' ) , 1 );
68
+		add_action( 'init', array( $this, 'load_checkbox_integration_classes' ), 1 );
69 69
 		// custom front end filter
70 70
 		add_action( 'init', array( $this, 'yikes_custom_frontend_content_filter' ) );
71 71
 		// Process non-ajax forms in the header
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
 	**/
97 97
 	public function load_checkbox_integration_classes() {
98 98
 		// store our options
99
-		$integrations = get_option( 'optin-checkbox-init' , '' );
100
-		if( !empty( $integrations ) ) {
99
+		$integrations = get_option( 'optin-checkbox-init', '' );
100
+		if ( ! empty( $integrations ) ) {
101 101
 			// load our mail integrations class
102 102
 			require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations.php';
103 103
 			// loop over selected classes and load them up!
104
-			foreach( $integrations as $integration => $value ) {	
105
-				if( isset( $value['value'] ) && $value['value'] == 'on' ) {
104
+			foreach ( $integrations as $integration => $value ) {	
105
+				if ( isset( $value[ 'value' ] ) && $value[ 'value' ] == 'on' ) {
106 106
 					// load our class extensions
107
-					require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.'.$integration.'-checkbox.php';
107
+					require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.' . $integration . '-checkbox.php';
108 108
 				}
109 109
 			}
110 110
 		}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @since 6.0.0
119 119
 	 */
120 120
 	public function load_error_logging_class() {
121
-		if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
121
+		if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
122 122
 			// if error logging is enabled we should include our error logging class
123 123
 			require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
124 124
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging;
@@ -131,18 +131,18 @@  discard block
 block discarded – undo
131 131
 	*	@since 6.0.3.4
132 132
 	*/
133 133
 	public function yikes_process_non_ajax_forms( $form_submitted ) {
134
-		global $wpdb,$post;
135
-		$form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? (int) $_POST['yikes-mailchimp-submitted-form'] : false; // store form id
136
-		if( $form_id ) {
134
+		global $wpdb, $post;
135
+		$form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? (int) $_POST[ 'yikes-mailchimp-submitted-form' ] : false; // store form id
136
+		if ( $form_id ) {
137 137
 			$form_settings = self::yikes_retrieve_form_settings( $form_id );
138
-			if( isset( $_POST ) && !empty( $_POST ) && isset( $form_id ) && $form_settings['submission_settings']['ajax'] == 0 ) {
139
-				if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { // ensure we only process the form that was submitted
138
+			if ( isset( $_POST ) && ! empty( $_POST ) && isset( $form_id ) && $form_settings[ 'submission_settings' ][ 'ajax' ] == 0 ) {
139
+				if ( $_POST[ 'yikes-mailchimp-submitted-form' ] == $form_id ) { // ensure we only process the form that was submitted
140 140
 					// lets include our form processing file
141 141
 					include_once( YIKES_MC_PATH . 'public/partials/shortcodes/process/process_form_submission.php' );
142
-					if( $form_settings['submission_settings']['redirect_on_submission'] == '1' ) {
143
-						if( $form_submitted == 1 ) {
142
+					if ( $form_settings[ 'submission_settings' ][ 'redirect_on_submission' ] == '1' ) {
143
+						if ( $form_submitted == 1 ) {
144 144
 							// decode our settings
145
-							$redirect_page = ( 'custom_url' != $form_settings['submission_settings']['redirect_page'] ) ? get_permalink( (int) $form_settings['submission_settings']['redirect_page'] ) : $form_settings['submission_settings']['custom_redirect_url'];
145
+							$redirect_page = ( 'custom_url' != $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) ? get_permalink( (int) $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) : $form_settings[ 'submission_settings' ][ 'custom_redirect_url' ];
146 146
 							wp_redirect( apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_page ), $form_id, $post ) );
147 147
 							exit;
148 148
 						}
@@ -158,27 +158,27 @@  discard block
 block discarded – undo
158 158
 	*/
159 159
 	public static function yikes_retrieve_form_settings( $form_id ) {
160 160
 		// if no form id, abort
161
-		if( ! $form_id ) {
161
+		if ( ! $form_id ) {
162 162
 			return;
163 163
 		}
164 164
 		global $wpdb;
165 165
 		$form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form_id . '', ARRAY_A ); // query for our form data
166
-		if( $form_results ) {
166
+		if ( $form_results ) {
167 167
 			// empty array, to populate with form settings
168 168
 			$form_settings = array();
169
-			$form_data = $form_results[0]; // store the results
169
+			$form_data = $form_results[ 0 ]; // store the results
170 170
 			// store the settings in our array
171
-			$form_settings['list_id'] = sanitize_key( $form_data['list_id'] ); // associated list id (users who fill out the form will be subscribed to this list)
172
-			$form_settings['form_name'] = esc_attr( $form_data['form_name'] ); // form name
173
-			$form_settings['form_description'] = esc_attr( stripslashes( $form_data['form_description'] ) );
174
-			$form_settings['fields'] = json_decode( $form_data['fields'] , true );
175
-			$form_settings['styles'] = json_decode( stripslashes( $form_data['custom_styles'] ) , true );
176
-			$form_settings['send_welcome'] = $form_data['send_welcome_email'];
177
-			$form_settings['submission_settings'] = json_decode( stripslashes( $form_data['submission_settings'] ) , true );
178
-			$form_settings['optin_settings'] = json_decode( stripslashes( $form_data['optin_settings'] ) , true );
179
-			$form_settings['error_messages'] = json_decode( $form_data['error_messages'] , true );	
180
-			$form_settings['notifications'] = isset( $form_data['custom_notifications'] ) ? json_decode( stripslashes( $form_data['custom_notifications'] ) , true ) : '';
181
-			$form_settings['submissions'] = $form_data['submissions'];
171
+			$form_settings[ 'list_id' ] = sanitize_key( $form_data[ 'list_id' ] ); // associated list id (users who fill out the form will be subscribed to this list)
172
+			$form_settings[ 'form_name' ] = esc_attr( $form_data[ 'form_name' ] ); // form name
173
+			$form_settings[ 'form_description' ] = esc_attr( stripslashes( $form_data[ 'form_description' ] ) );
174
+			$form_settings[ 'fields' ] = json_decode( $form_data[ 'fields' ], true );
175
+			$form_settings[ 'styles' ] = json_decode( stripslashes( $form_data[ 'custom_styles' ] ), true );
176
+			$form_settings[ 'send_welcome' ] = $form_data[ 'send_welcome_email' ];
177
+			$form_settings[ 'submission_settings' ] = json_decode( stripslashes( $form_data[ 'submission_settings' ] ), true );
178
+			$form_settings[ 'optin_settings' ] = json_decode( stripslashes( $form_data[ 'optin_settings' ] ), true );
179
+			$form_settings[ 'error_messages' ] = json_decode( $form_data[ 'error_messages' ], true );	
180
+			$form_settings[ 'notifications' ] = isset( $form_data[ 'custom_notifications' ] ) ? json_decode( stripslashes( $form_data[ 'custom_notifications' ] ), true ) : '';
181
+			$form_settings[ 'submissions' ] = $form_data[ 'submissions' ];
182 182
 			// return the given form settings in an array
183 183
 			return $form_settings;
184 184
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 			// load our mail integrations class
102 102
 			require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations.php';
103 103
 			// loop over selected classes and load them up!
104
-			foreach( $integrations as $integration => $value ) {	
104
+			foreach( $integrations as $integration => $value ) {
105 105
 				if( isset( $value['value'] ) && $value['value'] == 'on' ) {
106 106
 					// load our class extensions
107 107
 					require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.'.$integration.'-checkbox.php';
@@ -136,7 +136,8 @@  discard block
 block discarded – undo
136 136
 		if( $form_id ) {
137 137
 			$form_settings = self::yikes_retrieve_form_settings( $form_id );
138 138
 			if( isset( $_POST ) && !empty( $_POST ) && isset( $form_id ) && $form_settings['submission_settings']['ajax'] == 0 ) {
139
-				if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { // ensure we only process the form that was submitted
139
+				if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) {
140
+// ensure we only process the form that was submitted
140 141
 					// lets include our form processing file
141 142
 					include_once( YIKES_MC_PATH . 'public/partials/shortcodes/process/process_form_submission.php' );
142 143
 					if( $form_settings['submission_settings']['redirect_on_submission'] == '1' ) {
Please login to merge, or discard this patch.
public/helpers.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 *	
12 12
 *	@since 6.0.0
13 13
 */
14
-function yksemeProcessSnippet( $list=false, $submit_text ) {
14
+function yksemeProcessSnippet( $list = false, $submit_text ) {
15 15
 	$submit_text = ( isset( $submit_text ) ) ? 'submit="' . $submit_text . '"' : '';
16 16
 	return do_shortcode( '[yikes-mailchimp form="' . $list . '" ' . $submit_text . ']' );
17 17
 }
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 *	@since 6.0.3.4
22 22
 */
23 23
 function yikes_get_form_data( $form_id ) {
24
-	if( ! $form_id ) {
24
+	if ( ! $form_id ) {
25 25
 		return __( 'Whoops, you forgot to specify a form ID.', 'yikes-inc-easy-mailchimp-extender' );
26 26
 	}
27 27
 	return Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $form_id );
Please login to merge, or discard this patch.
includes/class-yikes-inc-easy-mailchimp-extender-uninstall.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 		if ( function_exists( 'is_multisite' ) && is_multisite() ) {
9 9
 			// users can only unisntall a plugin from the network dashboard page
10 10
 			// Get all blog ids
11
-			$blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
11
+			$blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
12 12
 			foreach ( $blogids as $blog_id ) {
13 13
 				switch_to_blog( $blog_id );
14 14
 				self::_uninstall_yikes_easy_mailchimp( $wpdb );
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
 	 * @since    6.0.0
29 29
 	 */
30 30
 	static function _uninstall_yikes_easy_mailchimp( $wpdb ) {
31
-		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
31
+		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
32 32
 		/* Clean up and delete our custom table from the databse */
33
-		$table = $wpdb->prefix."yikes_easy_mc_forms";
33
+		$table = $wpdb->prefix . "yikes_easy_mc_forms";
34 34
 		$sql = 'DROP TABLE IF EXISTS ' . $table;
35 35
 		//Delete any options thats stored also?
36 36
 		$wpdb->query( $sql );
37
-		dbDelta($sql);
37
+		dbDelta( $sql );
38 38
 		/* Clear All Transient Data */
39 39
 		// Delete list data transient data
40 40
 		delete_transient( 'yikes-easy-mailchimp-list-data' );
Please login to merge, or discard this patch.