Completed
Push — staging ( 69b5b7...e62b8b )
by Evan
06:26
created
admin/partials/view-list.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 									?></ul><?php
357 357
 								}
358 358
 								/**
359
-								*	Custom action hook for our add-ons to hook into
360
-								*	@since 6.0.3.8
361
-								*/
359
+								 *	Custom action hook for our add-ons to hook into
360
+								 *	@since 6.0.3.8
361
+								 */
362 362
 								do_action( 'yikes-mailchimp-list-form-fields-metabox' );
363 363
 							?>
364 364
 							
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
 									<?php
386 386
 								}
387 387
 								/**
388
-								*	Custom action hook for our add-ons to hook into
389
-								*	@since 6.0.3.8
390
-								*/
388
+								 *	Custom action hook for our add-ons to hook into
389
+								 *	@since 6.0.3.8
390
+								 */
391 391
 								do_action( 'yikes-mailchimp-list-interest-groups-metabox' );
392 392
 							?>
393 393
 							
Please login to merge, or discard this patch.
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2
-	if( isset( $_REQUEST['list-id'] ) ) {
3
-		$list_id = sanitize_key( $_REQUEST['list-id'] );
2
+	if ( isset( $_REQUEST[ 'list-id' ] ) ) {
3
+		$list_id = sanitize_key( $_REQUEST[ 'list-id' ] );
4 4
 		$api_key = yikes_get_mc_api_key();		
5 5
 		$dash_position = strpos( $api_key, '-' );
6
-		if( $dash_position !== false ) {
6
+		if ( $dash_position !== false ) {
7 7
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json';
8 8
 		}
9 9
 		$list_data = wp_remote_post( $api_endpoint, array(
@@ -15,40 +15,40 @@  discard block
 block discarded – undo
15 15
 			'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
16 16
 		) );
17 17
 		$list_data = json_decode( wp_remote_retrieve_body( $list_data ), true );
18
-		if( isset( $list_data['error'] ) ) {
19
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
18
+		if ( isset( $list_data[ 'error' ] ) ) {
19
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
20 20
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
21 21
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
22
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
22
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
23 23
 			}
24 24
 		}
25 25
 		// reset our data so we can easily use it
26
-		$list_data = $list_data['data'][0];
26
+		$list_data = $list_data[ 'data' ][ 0 ];
27 27
 
28
-		if( $dash_position !== false ) {
28
+		if ( $dash_position !== false ) {
29 29
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json';
30 30
 		}
31 31
 		$merge_variables = wp_remote_post( $api_endpoint, array(
32 32
 			'body' => array(
33 33
 				'apikey' => $api_key,
34
-				'id' => array( $list_id ) ,
34
+				'id' => array( $list_id ),
35 35
 			),
36 36
 			'timeout' => 10,
37 37
 			'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
38 38
 		) );
39 39
 		$merge_variables = json_decode( wp_remote_retrieve_body( $merge_variables ), true );
40
-		if( isset( $merge_variables['error'] ) ) {
41
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
40
+		if ( isset( $merge_variables[ 'error' ] ) ) {
41
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
42 42
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
43 43
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
44
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
44
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
45 45
 			}
46 46
 		}
47 47
 		// re-store our data
48
-		$merge_variables = $merge_variables['data'][0]['merge_vars'];
48
+		$merge_variables = $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ];
49 49
 
50 50
 		// get the interest group data
51
-		if( $dash_position !== false ) {
51
+		if ( $dash_position !== false ) {
52 52
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/interest-groupings.json';
53 53
 		}
54 54
 		$interest_groupings = wp_remote_post( $api_endpoint, array(
@@ -62,20 +62,20 @@  discard block
 block discarded – undo
62 62
 		) );
63 63
 		$interest_groupings = json_decode( wp_remote_retrieve_body( $interest_groupings ), true );
64 64
 
65
-		if( isset( $interest_groupings['error'] ) ) {
66
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
65
+		if ( isset( $interest_groupings[ 'error' ] ) ) {
66
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
67 67
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
68 68
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
69
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $interest_groupings['error'], __( "Get Interest Groups" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
69
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $interest_groupings[ 'error' ], __( "Get Interest Groups", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
70 70
 			}
71 71
 		}
72 72
 
73 73
 		$no_interest_groupings = '<p class="description">' . __( 'Interest groups are not enabled for this list.', 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
74 74
 
75 75
 
76
-		$no_segments = __( 'No segments set up for this list.' , 'yikes-inc-easy-mailchimp-extender' );
76
+		$no_segments = __( 'No segments set up for this list.', 'yikes-inc-easy-mailchimp-extender' );
77 77
 		// get the segment data
78
-		if( $dash_position !== false ) {
78
+		if ( $dash_position !== false ) {
79 79
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/segments.json';
80 80
 		}
81 81
 		$segments = wp_remote_post( $api_endpoint, array(
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 
91 91
 
92 92
 		// setup pagination variables
93
-		$paged = isset( $_REQUEST['paged'] ) ? $_REQUEST['paged'] : '0';
93
+		$paged = isset( $_REQUEST[ 'paged' ] ) ? $_REQUEST[ 'paged' ] : '0';
94 94
 
95
-		$limit = apply_filters( 'yikes_admin_list_subscriber_limit' , '20' );
95
+		$limit = apply_filters( 'yikes_admin_list_subscriber_limit', '20' );
96 96
 
97
-		$sort_dir = isset( $_REQUEST['sort'] ) ? $_REQUEST['sort'] : 'DESC';
98
-		$column = isset( $_REQUEST['column'] ) ? $_REQUEST['column'] : 'optin_time';
97
+		$sort_dir = isset( $_REQUEST[ 'sort' ] ) ? $_REQUEST[ 'sort' ] : 'DESC';
98
+		$column = isset( $_REQUEST[ 'column' ] ) ? $_REQUEST[ 'column' ] : 'optin_time';
99 99
 
100
-		if( $sort_dir == 'DESC' ) {
100
+		if ( $sort_dir == 'DESC' ) {
101 101
 			$opposite_sort_dir = 'ASC';
102 102
 			$icon = '<span class="dashicons dashicons-arrow-down"></span>';
103 103
 		} else {
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
 			$icon = '<span class="dashicons dashicons-arrow-up"></span>';
106 106
 		}
107 107
 
108
-		if( !isset( $_REQUEST['sort'] ) ) {
108
+		if ( ! isset( $_REQUEST[ 'sort' ] ) ) {
109 109
 			$icon = '';
110 110
 		}
111 111
 
112 112
 		// get all subscribed members
113
-		if( $dash_position !== false ) {
113
+		if ( $dash_position !== false ) {
114 114
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/members.json';
115 115
 		}
116 116
 		$subscribers_list = wp_remote_post( $api_endpoint, array(
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 			'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
129 129
 		) );
130 130
 		$subscribers_list = json_decode( wp_remote_retrieve_body( $subscribers_list ), true );
131
-		if( isset( $subscribers_list['error'] ) ) {
132
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
131
+		if ( isset( $subscribers_list[ 'error' ] ) ) {
132
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
133 133
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
134 134
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
135
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribers_list['error'], __( "Get Subscriber Count" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
135
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribers_list[ 'error' ], __( "Get Subscriber Count", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
136 136
 			}
137 137
 		}
138 138
 
139
-		$total_pages = ceil( $subscribers_list['total'] / $limit );
140
-		if( $total_pages == 0 ) {
139
+		$total_pages = ceil( $subscribers_list[ 'total' ] / $limit );
140
+		if ( $total_pages == 0 ) {
141 141
 			$total_pages = '1';
142 142
 		}
143 143
 
@@ -146,25 +146,25 @@  discard block
 block discarded – undo
146 146
 ?>
147 147
 <div class="wrap">
148 148
 	<!-- Freddie Logo -->
149
-	<img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" />
149
+	<img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" />
150 150
 
151
-	<h1>YIKES Easy Forms for MailChimp | <?php echo $list_data['name']; ?></h1>
151
+	<h1>YIKES Easy Forms for MailChimp | <?php echo $list_data[ 'name' ]; ?></h1>
152 152
 
153 153
 	<!-- Settings Page Description -->
154
-	<p class="yikes-easy-mc-about-text about-text"><?php _e( 'View all subscribers below. View additional subscriber info, or add additional fields to this list.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
155
-	<!-- <p class="add-new-subscriber-button"><a href="#" onclick="jQuery(this).parent().next().slideToggle();" class="add-new-h2"><?php _e( 'New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> -->
154
+	<p class="yikes-easy-mc-about-text about-text"><?php _e( 'View all subscribers below. View additional subscriber info, or add additional fields to this list.', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
155
+	<!-- <p class="add-new-subscriber-button"><a href="#" onclick="jQuery(this).parent().next().slideToggle();" class="add-new-h2"><?php _e( 'New Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> -->
156 156
 
157 157
 	<?php
158 158
 		/* Display our admin notices here */
159 159
 		// Unsubscribe user confirmation message
160
-		if( isset( $_REQUEST['user-unsubscribed'] ) && $_REQUEST['user-unsubscribed'] == 'true' ) {
160
+		if ( isset( $_REQUEST[ 'user-unsubscribed' ] ) && $_REQUEST[ 'user-unsubscribed' ] == 'true' ) {
161 161
 			?>
162 162
 			<div class="updated manage-form-admin-notice">
163 163
 				<p><?php _e( 'User successfully unsubscribed.', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
164 164
 			</div>
165 165
 			<?php
166 166
 		}
167
-		if( isset( $_REQUEST['user-unsubscribed'] ) && $_REQUEST['user-unsubscribed'] == 'false' ) {
167
+		if ( isset( $_REQUEST[ 'user-unsubscribed' ] ) && $_REQUEST[ 'user-unsubscribed' ] == 'false' ) {
168 168
 			?>
169 169
 			<div class="error manage-form-admin-notice">
170 170
 				<p><?php _e( "We've encountered an error trying to remove the subscriber. Please try again. If the error persists please get in contact with the YIKES Inc. support staff.", 'yikes-inc-easy-mailchimp-extender' ); ?></p>
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 	?>
175 175
 
176 176
 	<section class="add-new-subscriber-form-container">
177
-		<h4><?php _e( 'Add New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ); ?></h4>
177
+		<h4><?php _e( 'Add New Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?></h4>
178 178
 		<form id="add-new-subcscriber">
179
-			<input type="text" class="regular-text" placeholder="<?php _e( 'User Email Address' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p>
179
+			<input type="text" class="regular-text" placeholder="<?php _e( 'User Email Address', 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p>
180 180
 			<p><?php echo submit_button( 'Add Subscriber' ); ?></p>
181 181
 		</form>
182 182
 	</section>
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 									<!-- TABLE HEAD -->
199 199
 									<thead>
200 200
 										<tr>
201
-											<th id="user-email columnname" class="manage-column column-columnname" scope="col"><a id="user-email-sort" href="<?php echo esc_url_raw( add_query_arg( array( 'column' => 'email' , 'sort' => $opposite_sort_dir ) ) ); ?>"><?php _e( 'User Email' , 'yikes-inc-easy-mailchimp-extender' ); echo $icon;?></a></th>
202
-											<th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client' , 'yikes-inc-easy-mailchimp-extender' ); ?></th>
201
+											<th id="user-email columnname" class="manage-column column-columnname" scope="col"><a id="user-email-sort" href="<?php echo esc_url_raw( add_query_arg( array( 'column' => 'email', 'sort' => $opposite_sort_dir ) ) ); ?>"><?php _e( 'User Email', 'yikes-inc-easy-mailchimp-extender' ); echo $icon; ?></a></th>
202
+											<th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client', 'yikes-inc-easy-mailchimp-extender' ); ?></th>
203 203
 										</tr>
204 204
 									</thead>
205 205
 									<!-- end header -->
@@ -207,38 +207,38 @@  discard block
 block discarded – undo
207 207
 									<!-- FOOTER -->
208 208
 									<tfoot>
209 209
 										<tr>
210
-											<th class="manage-column column-columnname" scope="col"><?php _e( 'User Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></th>
211
-											<th class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client' , 'yikes-inc-easy-mailchimp-extender' ); ?></th>
210
+											<th class="manage-column column-columnname" scope="col"><?php _e( 'User Email', 'yikes-inc-easy-mailchimp-extender' ); ?></th>
211
+											<th class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client', 'yikes-inc-easy-mailchimp-extender' ); ?></th>
212 212
 										</tr>
213 213
 									</tfoot>
214 214
 									<!-- end footer -->
215 215
 
216 216
 									<!-- TABLE BODY -->
217 217
 									<tbody>
218
-										<?php if( $subscribers_list['total'] > 0 ) {
218
+										<?php if ( $subscribers_list[ 'total' ] > 0 ) {
219 219
 												$i = 1;
220
-												foreach( $subscribers_list['data'] as $subscriber ) {
221
-													$user_id = $subscriber['leid'];
220
+												foreach ( $subscribers_list[ 'data' ] as $subscriber ) {
221
+													$user_id = $subscriber[ 'leid' ];
222 222
 													// setup the email client name and icon
223
-													if( !empty( $subscriber['clients'] ) ) {
224
-														$user_email_client_name = $subscriber['clients']['name'];
225
-														$user_email_client_icon = "<img src='" . esc_url_raw( $subscriber['clients']['icon_url'] ) . "' alt=" . $user_email_client_name . " title=" . $user_email_client_name . ">";
223
+													if ( ! empty( $subscriber[ 'clients' ] ) ) {
224
+														$user_email_client_name = $subscriber[ 'clients' ][ 'name' ];
225
+														$user_email_client_icon = "<img src='" . esc_url_raw( $subscriber[ 'clients' ][ 'icon_url' ] ) . "' alt=" . $user_email_client_name . " title=" . $user_email_client_name . ">";
226 226
 													} else {
227 227
 														$path = YIKES_MC_URL . "includes/images/na.png";
228
-														$user_email_client_icon = "<img width='35' src='" . $path . "' alt='" . __( 'not set' , 'yikes-inc-easy-mailchimp-extender' ) . "' title='" .  __( 'not set' , 'yikes-inc-easy-mailchimp-extender' ) . "'>";
228
+														$user_email_client_icon = "<img width='35' src='" . $path . "' alt='" . __( 'not set', 'yikes-inc-easy-mailchimp-extender' ) . "' title='" . __( 'not set', 'yikes-inc-easy-mailchimp-extender' ) . "'>";
229 229
 													}
230 230
 
231 231
 										?>
232
-											<tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>">
232
+											<tr class="<?php if ( $i % 2 == 0 ) { echo 'alternate'; } ?>">
233 233
 												<td class="column-columnname">
234
-													<a class="user-email row-title" href="mailto:<?php echo sanitize_email( $subscriber['email'] ); ?>">
235
-														<?php echo sanitize_email( $subscriber['email'] ); ?>
234
+													<a class="user-email row-title" href="mailto:<?php echo sanitize_email( $subscriber[ 'email' ] ); ?>">
235
+														<?php echo sanitize_email( $subscriber[ 'email' ] ); ?>
236 236
 													</a>
237 237
 													<div class="row-actions">
238
-														<?php $view_user_info_url = esc_url_raw( add_query_arg( array( 'mailchimp-list' => $list_id , 'email-id' => $user_id ), admin_url() . 'admin.php?page=yikes-mailchimp-view-user' ) ); ?>
239
-														<span><a href="<?php echo $view_user_info_url; ?>"><?php _e( "View Info." , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span>
240
-														<?php $url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-unsubscribe-user', 'mailchimp-list' => $list_id , 'nonce' => wp_create_nonce( 'unsubscribe-user-'.$user_id ), 'email_id' => $user_id ) ) ); ?>
241
-														<span><a href="<?php echo $url; ?>" onclick="return confirm('<?php printf( __( "Are you sure you want to unsubscribe %s from this mailing list?" , 'yikes-inc-easy-mailchimp-extender' ), sanitize_email( $subscriber['email'] ) ); ?>');" class="yikes-delete-subscriber"><?php _e( "Unsubscribe" , 'yikes-inc-easy-mailchimp-extender' ); ?></a>
238
+														<?php $view_user_info_url = esc_url_raw( add_query_arg( array( 'mailchimp-list' => $list_id, 'email-id' => $user_id ), admin_url() . 'admin.php?page=yikes-mailchimp-view-user' ) ); ?>
239
+														<span><a href="<?php echo $view_user_info_url; ?>"><?php _e( "View Info.", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span>
240
+														<?php $url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-unsubscribe-user', 'mailchimp-list' => $list_id, 'nonce' => wp_create_nonce( 'unsubscribe-user-' . $user_id ), 'email_id' => $user_id ) ) ); ?>
241
+														<span><a href="<?php echo $url; ?>" onclick="return confirm('<?php printf( __( "Are you sure you want to unsubscribe %s from this mailing list?", 'yikes-inc-easy-mailchimp-extender' ), sanitize_email( $subscriber[ 'email' ] ) ); ?>');" class="yikes-delete-subscriber"><?php _e( "Unsubscribe", 'yikes-inc-easy-mailchimp-extender' ); ?></a>
242 242
 													</div>
243 243
 												</td>
244 244
 												<td class="column-columnname num"><?php echo $user_email_client_icon; ?></td>
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 												}
249 249
 											} else { ?>
250 250
 											<tr class="no-items">
251
-												<td class="colspanchange no-current-subscriber-notice" colspan="2"><em><?php _e( 'No one is currently subscribed to this list.' , 'yikes-inc-easy-mailchimp-extender' ); ?></em></td>
251
+												<td class="colspanchange no-current-subscriber-notice" colspan="2"><em><?php _e( 'No one is currently subscribed to this list.', 'yikes-inc-easy-mailchimp-extender' ); ?></em></td>
252 252
 											</tr>
253 253
 										<?php } ?>
254 254
 									</tbody>
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 						<!-- pagination -->
261 261
 						<div class="tablenav">
262 262
 							<div class="tablenav-pages">
263
-								<a class='first-page <?php if( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the first page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => 0 ) ) ); ?>'>&laquo;</a>
264
-								<a class='prev-page <?php if( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the previous page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged - 1 ) ) ) ); ?>'>&lsaquo;</a>
265
-								<span class="paging-input"><input class='current-page' title='<?php _e( "Current page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' type='text' name='paged' value='<?php if( $paged == 0 ) { echo '1'; } else { echo intval( $paged + 1 ); } ?>' size='1' /> <?php _e( 'of', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class='total-pages'><?php echo $total_pages; ?></span></span>
266
-								<a class='next-page <?php if( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the next page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged + 1 ) ) ) ); ?>'>&rsaquo;</a>
267
-								<a class='last-page <?php if( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the last page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $total_pages - 1 ) ) ) ); ?>'>&raquo;</a>
263
+								<a class='first-page <?php if ( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the first page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => 0 ) ) ); ?>'>&laquo;</a>
264
+								<a class='prev-page <?php if ( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the previous page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged - 1 ) ) ) ); ?>'>&lsaquo;</a>
265
+								<span class="paging-input"><input class='current-page' title='<?php _e( "Current page", 'yikes-inc-easy-mailchimp-extender' ); ?>' type='text' name='paged' value='<?php if ( $paged == 0 ) { echo '1'; } else { echo intval( $paged + 1 ); } ?>' size='1' /> <?php _e( 'of', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class='total-pages'><?php echo $total_pages; ?></span></span>
266
+								<a class='next-page <?php if ( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the next page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged + 1 ) ) ) ); ?>'>&rsaquo;</a>
267
+								<a class='last-page <?php if ( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the last page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $total_pages - 1 ) ) ) ); ?>'>&raquo;</a>
268 268
 							</div>
269 269
 						</div>
270 270
 
@@ -279,21 +279,21 @@  discard block
 block discarded – undo
279 279
 
280 280
 						<div class="postbox yikes-easy-mc-postbox">
281 281
 
282
-							<h3><?php _e( 'List Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
282
+							<h3><?php _e( 'List Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
283 283
 
284 284
 							<?php
285 285
 								// store list rating
286
-								$list_rating = $list_data['list_rating'];
287
-								if( $list_rating > 0 ) {
288
-									$list_rating_explosion = explode( '.' , $list_rating );
286
+								$list_rating = $list_data[ 'list_rating' ];
287
+								if ( $list_rating > 0 ) {
288
+									$list_rating_explosion = explode( '.', $list_rating );
289 289
 									$star_array = array();
290 290
 									$x = 1;
291
-									while( $list_rating_explosion[0] >= $x ) {
292
-										$star_array[] = '<span class="dashicons dashicons-star-filled list-rating-star"></span>';
291
+									while ( $list_rating_explosion[ 0 ] >= $x ) {
292
+										$star_array[ ] = '<span class="dashicons dashicons-star-filled list-rating-star"></span>';
293 293
 										$x++;
294 294
 									}
295
-									if( $list_rating_explosion[1] == '5' ) {
296
-										$star_array[] = '<span class="dashicons dashicons-star-half list-rating-star"></span>';
295
+									if ( $list_rating_explosion[ 1 ] == '5' ) {
296
+										$star_array[ ] = '<span class="dashicons dashicons-star-half list-rating-star"></span>';
297 297
 									}
298 298
 								} else {
299 299
 									$star_array = array( 'n/a' );
@@ -301,40 +301,40 @@  discard block
 block discarded – undo
301 301
 							?>
302 302
 							<table class="form-table">
303 303
 								<tr valign="top">
304
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'List Rating' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
305
-									<td><?php echo implode( ' ' , $star_array ); ?></td>
304
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'List Rating', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
305
+									<td><?php echo implode( ' ', $star_array ); ?></td>
306 306
 								</tr>
307 307
 								<tr valign="top">
308
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Average Subscribers' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
309
-									<td><?php echo $list_data['stats']['avg_sub_rate']; ?><small> / <?php  _e( 'month' , 'yikes-inc-easy-mailchimp-extender' ); ?></small></td>
308
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Average Subscribers', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
309
+									<td><?php echo $list_data[ 'stats' ][ 'avg_sub_rate' ]; ?><small> / <?php  _e( 'month', 'yikes-inc-easy-mailchimp-extender' ); ?></small></td>
310 310
 								</tr>
311 311
 								<tr valign="top">
312
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
313
-									<td><?php echo intval( $list_data['stats']['member_count'] ); ?></td>
312
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
313
+									<td><?php echo intval( $list_data[ 'stats' ][ 'member_count' ] ); ?></td>
314 314
 								</tr>
315 315
 								<tr valign="top">
316
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'New Since Last Campaign' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
317
-									<td><?php echo intval( $list_data['stats']['member_count_since_send'] ); ?></td>
316
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'New Since Last Campaign', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
317
+									<td><?php echo intval( $list_data[ 'stats' ][ 'member_count_since_send' ] ); ?></td>
318 318
 								</tr>
319 319
 								<tr valign="top">
320
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Created' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
321
-									<td><?php echo date( get_option('date_format') , strtotime( $list_data['date_created'] ) ); ?></td>
320
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Created', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
321
+									<td><?php echo date( get_option( 'date_format' ), strtotime( $list_data[ 'date_created' ] ) ); ?></td>
322 322
 								</tr>
323 323
 								<tr valign="top">
324
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'List Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
325
-									<td><?php echo intval( $list_data['stats']['merge_var_count'] + 1 ); // add 1 for our email field.. ?></td>
324
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'List Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
325
+									<td><?php echo intval( $list_data[ 'stats' ][ 'merge_var_count' ] + 1 ); // add 1 for our email field.. ?></td>
326 326
 								</tr>
327 327
 								<tr valign="top">
328
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Short Signup URL' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
329
-									<td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo esc_url_raw( $list_data['subscribe_url_short'] ); ?>" readonly onclick="jQuery(this).select();"></td>
328
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Short Signup URL', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
329
+									<td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo esc_url_raw( $list_data[ 'subscribe_url_short' ] ); ?>" readonly onclick="jQuery(this).select();"></td>
330 330
 								</tr>
331 331
 								<tr valign="top">
332
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Default From Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
333
-									<td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo sanitize_email( $list_data['default_from_email'] ); ?>" readonly onclick="jQuery(this).select();"></td>
332
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Default From Email', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
333
+									<td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo sanitize_email( $list_data[ 'default_from_email' ] ); ?>" readonly onclick="jQuery(this).select();"></td>
334 334
 								</tr>
335 335
 								<tr valign="top">
336
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Default From Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
337
-									<td><?php echo $list_data['default_from_name']; ?></td>
336
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Default From Name', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
337
+									<td><?php echo $list_data[ 'default_from_name' ]; ?></td>
338 338
 								</tr>
339 339
 							</table>
340 340
 
@@ -344,14 +344,14 @@  discard block
 block discarded – undo
344 344
 						<!-- Merge Field Info -->
345 345
 						<div class="postbox yikes-easy-mc-postbox">
346 346
 
347
-							<h3><?php _e( 'Form Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
347
+							<h3><?php _e( 'Form Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
348 348
 							<?php
349
-								if( count( $merge_variables ) >= 1 ) {
349
+								if ( count( $merge_variables ) >= 1 ) {
350 350
 									?><ul class="merge-variable-ul"><?php
351 351
 										echo '<li class="interest-group-count">' . sprintf( _n( '%d Field', '%d Fields', intval( count( $merge_variables ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $merge_variables ) ) ) . '</li>';
352
-										foreach( $merge_variables as $merge_variable ) {
352
+										foreach ( $merge_variables as $merge_variable ) {
353 353
 											// new action hook @since 6.0.3.8
354
-											echo '<li class="' . $merge_variable['tag'] . '"><span class="dashicons dashicons-marker"></span>' . $merge_variable['name'] . ' ' . do_action( 'yikes-mailchimp-list-field', $merge_variable ) . '</li>';
354
+											echo '<li class="' . $merge_variable[ 'tag' ] . '"><span class="dashicons dashicons-marker"></span>' . $merge_variable[ 'name' ] . ' ' . do_action( 'yikes-mailchimp-list-field', $merge_variable ) . '</li>';
355 355
 										}
356 356
 									?></ul><?php
357 357
 								}
@@ -368,13 +368,13 @@  discard block
 block discarded – undo
368 368
 						<div class="postbox yikes-easy-mc-postbox">
369 369
 
370 370
 
371
-							<h3><?php _e( 'Interest Groups Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
371
+							<h3><?php _e( 'Interest Groups Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
372 372
 							<?php
373
-								if( isset( $interest_groupings ) && ! isset( $interest_groupings['error'] ) ) {
373
+								if ( isset( $interest_groupings ) && ! isset( $interest_groupings[ 'error' ] ) ) {
374 374
 									?><ul class="interest-group-ul"><?php
375 375
 										echo '<li class="interest-group-count">' . sprintf( _n( '%d Interest Group', '%d Interest Groups', intval( count( $interest_groupings ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $interest_groupings ) ) ) . '</li>';
376
-									foreach( $interest_groupings as $interest_group ) {
377
-										echo '<li><span class="dashicons dashicons-marker"></span>' . $interest_group['name'] . '<span class="interest-group-title"></span><small title="' . $interest_group['groups'][0]['subscribers'] . ' ' . __( "subscribers assigned to this group" , 'yikes-inc-easy-mailchimp-extender' ) . '">(' . $interest_group['groups'][0]['subscribers'] . ')</small></li>';
376
+									foreach ( $interest_groupings as $interest_group ) {
377
+										echo '<li><span class="dashicons dashicons-marker"></span>' . $interest_group[ 'name' ] . '<span class="interest-group-title"></span><small title="' . $interest_group[ 'groups' ][ 0 ][ 'subscribers' ] . ' ' . __( "subscribers assigned to this group", 'yikes-inc-easy-mailchimp-extender' ) . '">(' . $interest_group[ 'groups' ][ 0 ][ 'subscribers' ] . ')</small></li>';
378 378
 									}
379 379
 									?></ul><?php
380 380
 								} else {
@@ -397,17 +397,17 @@  discard block
 block discarded – undo
397 397
 						<div class="postbox yikes-easy-mc-postbox">
398 398
 
399 399
 
400
-							<h3><?php _e( 'Segments Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
400
+							<h3><?php _e( 'Segments Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
401 401
 							<?php
402
-								if( isset( $segments['saved'] ) && count( $segments['saved'] ) >= 1 ) {
402
+								if ( isset( $segments[ 'saved' ] ) && count( $segments[ 'saved' ] ) >= 1 ) {
403 403
 									$i = 1;
404 404
 									?><ul class="segment-ul"><?php
405
-										echo '<li class="segment-group-count">' . sprintf( _n( '%d Segment', '%d Segments', intval( count( $segments['saved'] ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $segments['saved'] ) ) ) . '</li>';
406
-									foreach( $segments['saved'] as $segment ) {
407
-										echo '<li><span class="dashicons dashicons-arrow-right"></span>' . $segment['name'] . ' <small><a href="#" onclick="jQuery(this).parent().parent().next().slideToggle();jQuery(this).toggleText();return false;" data-alt-text="' . __( 'hide conditions' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( "view conditions" , 'yikes-inc-easy-mailchimp-extender' ) . '</a></small></li>';
405
+										echo '<li class="segment-group-count">' . sprintf( _n( '%d Segment', '%d Segments', intval( count( $segments[ 'saved' ] ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $segments[ 'saved' ] ) ) ) . '</li>';
406
+									foreach ( $segments[ 'saved' ] as $segment ) {
407
+										echo '<li><span class="dashicons dashicons-arrow-right"></span>' . $segment[ 'name' ] . ' <small><a href="#" onclick="jQuery(this).parent().parent().next().slideToggle();jQuery(this).toggleText();return false;" data-alt-text="' . __( 'hide conditions', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( "view conditions", 'yikes-inc-easy-mailchimp-extender' ) . '</a></small></li>';
408 408
 										?><div class="conditionals yikes-easy-mc-hidden"><?php
409
-										foreach( $segment['segment_opts']['conditions'] as $condition ) {
410
-											echo '<li><small>' . sprintf( __( 'condition #%s : If %s %s %s', 'yikes-inc-easy-mailchimp-extender' ), intval( $i ), $condition['field'],  $condition['op'], $condition['value'] ) . '</small></li>';
409
+										foreach ( $segment[ 'segment_opts' ][ 'conditions' ] as $condition ) {
410
+											echo '<li><small>' . sprintf( __( 'condition #%s : If %s %s %s', 'yikes-inc-easy-mailchimp-extender' ), intval( $i ), $condition[ 'field' ], $condition[ 'op' ], $condition[ 'value' ] ) . '</small></li>';
411 411
 											$i++;
412 412
 										}
413 413
 										?></div><?php
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
 								}
423 423
 							?>
424 424
 							<!--
425
-								<a class="edit-segments-button" href="#" onclick="return false;" class="button-primary"><?php _e( 'Edit Segments' , 'yikes-inc-easy-mailchimp-extender' ); ?></a>
425
+								<a class="edit-segments-button" href="#" onclick="return false;" class="button-primary"><?php _e( 'Edit Segments', 'yikes-inc-easy-mailchimp-extender' ); ?></a>
426 426
 							-->
427
-							<p class="description edit-segment-description"><?php _e( 'To edit this lists segments, head over to' , 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.MailChimp.com" target="_blank">MailChimp</a></p>
427
+							<p class="description edit-segment-description"><?php _e( 'To edit this lists segments, head over to', 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.MailChimp.com" target="_blank">MailChimp</a></p>
428 428
 
429 429
 						</div>
430 430
 
Please login to merge, or discard this patch.
admin/partials/upgrade-helpers/upgrade-migrate-options.php 2 patches
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -9,30 +9,30 @@  discard block
 block discarded – undo
9 9
 	*/
10 10
 		
11 11
 	// enqueue the styles for our migration page..
12
-	wp_enqueue_style( 'yikes_mc_migrate_option_styles' , YIKES_MC_URL . 'admin/css/yikes-inc-easy-mailchimp-migrate-option-styles.css' );
13
-	wp_enqueue_style( 'animate-css' , YIKES_MC_URL . 'admin/css/animate.min.css' );
12
+	wp_enqueue_style( 'yikes_mc_migrate_option_styles', YIKES_MC_URL . 'admin/css/yikes-inc-easy-mailchimp-migrate-option-styles.css' );
13
+	wp_enqueue_style( 'animate-css', YIKES_MC_URL . 'admin/css/animate.min.css' );
14 14
 	
15 15
 	// store our old options
16 16
 	$old_plugin_options = get_option( 'ykseme_storage' );
17 17
 	
18 18
 	$global_error_messages = array(
19
-		'success' => __( $old_plugin_options['single-optin-message'] , 'yikes-inc-easy-mailchimp-extender' ),
20
-		'general-error' => __( "Whoops! It looks like something went wrong. Please try again." , 'yikes-inc-easy-mailchimp-extender' ),
21
-		'invalid-email' => __( "Please provide a valid email address." , 'yikes-inc-easy-mailchimp-extender' ),
22
-		'email-exists-error' => __( "The provided email is already subscribed to this list." , 'yikes-inc-easy-mailchimp-extender' )
19
+		'success' => __( $old_plugin_options[ 'single-optin-message' ], 'yikes-inc-easy-mailchimp-extender' ),
20
+		'general-error' => __( "Whoops! It looks like something went wrong. Please try again.", 'yikes-inc-easy-mailchimp-extender' ),
21
+		'invalid-email' => __( "Please provide a valid email address.", 'yikes-inc-easy-mailchimp-extender' ),
22
+		'email-exists-error' => __( "The provided email is already subscribed to this list.", 'yikes-inc-easy-mailchimp-extender' )
23 23
 	);
24 24
 	
25 25
 	// if old options are defined...
26
-	if( $old_plugin_options ) {
26
+	if ( $old_plugin_options ) {
27 27
 		
28 28
 		// Verify the NONCE is valid
29
-		check_admin_referer( 'yikes-mc-migrate-options' , 'migrate_options_nonce' );
29
+		check_admin_referer( 'yikes-mc-migrate-options', 'migrate_options_nonce' );
30 30
 		
31 31
 		?>
32 32
 			
33 33
 		<div class="wrap" style="text-align:center;">
34
-			<h3><?php _e( 'Migrating old plugin options' , 'yikes-inc-easy-mailchimp-extender' ); ?><span class="upgrading-ellipse-one">.</span><span class="upgrading-ellipse-two">.</span><span class="upgrading-ellipse-three">.</h3>
35
-			<p><?php _e( 'please be patient while your options are updated and the process has completed' , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
34
+			<h3><?php _e( 'Migrating old plugin options', 'yikes-inc-easy-mailchimp-extender' ); ?><span class="upgrading-ellipse-one">.</span><span class="upgrading-ellipse-two">.</span><span class="upgrading-ellipse-three">.</h3>
35
+			<p><?php _e( 'please be patient while your options are updated and the process has completed', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
36 36
 			<!-- empty list, populate when options  get updated -->
37 37
 			<ul id="options-updated" class="yikes-easy-mc-hidden">
38 38
 				<hr />
@@ -46,82 +46,82 @@  discard block
 block discarded – undo
46 46
 				
47 47
 					// loop over our old options, and store them in a new option value
48 48
 					$do_not_migrate_options = array(
49
-						'ssl_verify_peer', 'api_validation' , 'widget_yikes_mc_widget' , 'flavor' , 'single-optin-message' , 'double-optin-message' ,
50
-						'mailchimp-optIn-default-list' , 'version' , 'yks-mailchimp-jquery-datepicker' , 'ssl_verify_peer' , 'optIn-checkbox' , 'yks-mailchimp-optin-checkbox-text',
51
-						'yks-mailchimp-required-text' , 'optin'
49
+						'ssl_verify_peer', 'api_validation', 'widget_yikes_mc_widget', 'flavor', 'single-optin-message', 'double-optin-message',
50
+						'mailchimp-optIn-default-list', 'version', 'yks-mailchimp-jquery-datepicker', 'ssl_verify_peer', 'optIn-checkbox', 'yks-mailchimp-optin-checkbox-text',
51
+						'yks-mailchimp-required-text', 'optin'
52 52
 					);
53 53
 							
54
-					foreach( $old_plugin_options as $option_name => $option_value ) {
54
+					foreach ( $old_plugin_options as $option_name => $option_value ) {
55 55
 												
56
-						if( ! in_array( $option_name , $do_not_migrate_options ) ) {
56
+						if ( ! in_array( $option_name, $do_not_migrate_options ) ) {
57 57
 							// ajax request to update our options one by one..
58 58
 							// if its an array, we need to json encode it
59
-							if( is_array( $option_value ) ) {
59
+							if ( is_array( $option_value ) ) {
60 60
 								
61
-								if( $option_name == 'lists' ) {
61
+								if ( $option_name == 'lists' ) {
62 62
 																	
63
-									if( ! empty( $option_value ) ) {
63
+									if ( ! empty( $option_value ) ) {
64 64
 										$settings = 1;
65 65
 										$form_length = count( $option_value );
66
-										foreach( $option_value as $mailchimp_form ) {
66
+										foreach ( $option_value as $mailchimp_form ) {
67 67
 											// update and pass our placeholder value
68 68
 											reset( $mailchimp_form );
69
-											$form_id = $mailchimp_form['id'];
69
+											$form_id = $mailchimp_form[ 'id' ];
70 70
 											
71
-											$fields = $mailchimp_form['fields'];	
71
+											$fields = $mailchimp_form[ 'fields' ];	
72 72
 											reset( $fields );
73 73
 											$first_field_key = key( $fields );
74 74
 											$array_keys = array_keys( $fields );
75 75
 											
76 76
 											$x = 1;								
77 77
 					
78
-											foreach( $array_keys as $parent_key ) {
78
+											foreach ( $array_keys as $parent_key ) {
79 79
 												
80 80
 												// alter the field keys so they show up after an import
81 81
 												$split_parent_key = explode( '-', $parent_key );
82 82
 
83
-												$new_parent_key = ( isset( $split_parent_key[1] ) ) ? strtoupper( $split_parent_key[1] ) : $parent_key;
83
+												$new_parent_key = ( isset( $split_parent_key[ 1 ] ) ) ? strtoupper( $split_parent_key[ 1 ] ) : $parent_key;
84 84
 
85
-												$mailchimp_form['fields'][$new_parent_key] = $mailchimp_form['fields'][$parent_key];
85
+												$mailchimp_form[ 'fields' ][ $new_parent_key ] = $mailchimp_form[ 'fields' ][ $parent_key ];
86 86
 
87
-												unset( $mailchimp_form['fields'][$parent_key] );			
87
+												unset( $mailchimp_form[ 'fields' ][ $parent_key ] );			
88 88
 										
89 89
 												// update our placeholder key to be 'placeholder'
90
-												$mailchimp_form['fields'][$new_parent_key]['placeholder'] = isset( $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] ) ? $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] : '';
90
+												$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] : '';
91 91
 												// update field classes
92
-												$mailchimp_form['fields'][$new_parent_key]['additional-classes'] = isset( $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] ) ? $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] : '';
92
+												$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'additional-classes' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] : '';
93 93
 												// update help field - populate description
94
-												$mailchimp_form['fields'][$new_parent_key]['description'] = isset( $mailchimp_form['fields'][$new_parent_key]['help'] ) ? $mailchimp_form['fields'][$new_parent_key]['help'] : ''; 
94
+												$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'description' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] : ''; 
95 95
 												// remove the old placeholder structure
96
-												unset( $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] );
96
+												unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] );
97 97
 												// remove old custom class structure
98
-												unset( $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] );
98
+												unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] );
99 99
 												// remove old help/description 
100
-												unset( $mailchimp_form['fields'][$new_parent_key]['help'] );
100
+												unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] );
101 101
 																							
102 102
 												// check if choices is set, and encode them
103
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['choices'] ) && ! empty( $mailchimp_form['fields'][$new_parent_key]['choices'] ) ) {
104
-													$mailchimp_form['fields'][$new_parent_key]['choices'] = addslashes( addslashes( json_encode( $mailchimp_form['fields'][$new_parent_key]['choices'] ) ) );
103
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) && ! empty( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) ) {
104
+													$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] = addslashes( addslashes( json_encode( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) ) );
105 105
 												}	
106 106
 
107 107
 												// update 'default' to 'default-choice' for radio/dropdown
108
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'radio', 'dropdown' ) ) ) {
109
-													$mailchimp_form['fields'][$new_parent_key]['default_choice'] = $mailchimp_form['fields'][$new_parent_key]['default'];
110
-													unset( $mailchimp_form['fields'][$new_parent_key]['default'] );
108
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'radio', 'dropdown' ) ) ) {
109
+													$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default_choice' ] = $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default' ];
110
+													unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default' ] );
111 111
 												}
112 112
 												
113 113
 												// update 'date_format' on 'birthday' and 'date' fields
114
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'date', 'birthday' ) ) ) {
115
-													if( $mailchimp_form['fields'][$new_parent_key]['type'] == 'date' ) { // date
116
-														$mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD'; // mailchimp default (can be altered)
114
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'date', 'birthday' ) ) ) {
115
+													if ( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] == 'date' ) { // date
116
+														$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'date_format' ] = 'MM/DD'; // mailchimp default (can be altered)
117 117
 													} else { // birthday 
118
-														$mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD/YYYY'; // mailchimp default (can be altered)
118
+														$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'date_format' ] = 'MM/DD/YYYY'; // mailchimp default (can be altered)
119 119
 													}
120 120
 												}
121 121
 												
122 122
 												// update 'phone_format' on 'phone'
123
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'phone' ) ) ) {
124
-													$mailchimp_form['fields'][$new_parent_key]['phone_format'] = 'phone_format '; // phone format
123
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'phone' ) ) ) {
124
+													$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'phone_format' ] = 'phone_format '; // phone format
125 125
 												}
126 126
 												
127 127
 												$x++;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 																								
139 139
 												$.post( ajaxurl, mc_data, function(response) {
140 140
 													jQuery( '#options-updated' ).show();
141
-													jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>'; ?>' + response.form_name + '<?php echo '</strong> ' . __( "successfully imported." , 'yikes-inc-easy-mailchimp-extender' ); ?></li>' );	
141
+													jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>'; ?>' + response.form_name + '<?php echo '</strong> ' . __( "successfully imported.", 'yikes-inc-easy-mailchimp-extender' ); ?></li>' );	
142 142
 													if( response.completed_import ) {
143 143
 														setTimeout( function() {
144 144
 															// finished with the loop...lets let the user know....and then redirect them....
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
 															jQuery( '.upgrading-ellipse-two' ).remove();
148 148
 															jQuery( '.upgrading-ellipse-three' ).remove();
149 149
 															jQuery( '.wrap' ).find( 'h3' ).next().fadeOut();
150
-															jQuery( '#options-updated' ).append( '<li class="animated fadeInDown migration-complete-notification"><em><?php _e( "Migration Complete. Please wait..." , 'yikes-inc-easy-mailchimp-extender' ); ?> </em> <img src="<?php echo esc_url_raw( admin_url( "images/wpspin_light.gif" ) ); ?>" /></li>' );
150
+															jQuery( '#options-updated' ).append( '<li class="animated fadeInDown migration-complete-notification"><em><?php _e( "Migration Complete. Please wait...", 'yikes-inc-easy-mailchimp-extender' ); ?> </em> <img src="<?php echo esc_url_raw( admin_url( "images/wpspin_light.gif" ) ); ?>" /></li>' );
151 151
 															// redirect our user to the main plugin page...
152 152
 															setTimeout( function() {
153 153
 																<?php 
154 154
 																	// migrate options that didnt make it (they were never stored in the 'ykseme_storage' options array)
155
-																	add_option( 'yikes-mc-api-validation' , get_option( 'api_validation' , 'invalid_api_key' ) );
156
-																	add_option( 'yikes-mc-error-messages' , $global_error_messages );
155
+																	add_option( 'yikes-mc-api-validation', get_option( 'api_validation', 'invalid_api_key' ) );
156
+																	add_option( 'yikes-mc-error-messages', $global_error_messages );
157 157
 																	// delete our old options after a successful migration (and some new ones that are no longer needed)
158 158
 																	delete_option( 'widget_yikes_mc_widget' );
159 159
 																	delete_option( 'api_validation' );
@@ -174,26 +174,26 @@  discard block
 block discarded – undo
174 174
 							}
175 175
 							/* Rename our ReCaptcha Options */
176 176
 								/* Public Site Key */
177
-								if( $option_name == 'recaptcha-api-key' ) {
177
+								if ( $option_name == 'recaptcha-api-key' ) {
178 178
 									$option_name = 'recaptcha-site-key';
179 179
 								}
180 180
 								/* Private Key */
181
-								if( $option_name == 'recaptcha-private-api-key'  ) {
181
+								if ( $option_name == 'recaptcha-private-api-key' ) {
182 182
 									$option_name = 'recaptcha-secret-key';
183 183
 								}
184 184
 								/* Change 'recaptcha-setting' to 'recaptcha-status' */
185 185
 								/* Status */
186
-								if( $option_name == 'recaptcha-setting' ) {
186
+								if ( $option_name == 'recaptcha-setting' ) {
187 187
 									$option_name = 'recaptcha-status';
188 188
 								}
189 189
 							/* End  re-name ReCaptcha options */
190 190
 							
191 191
 
192
-							if( is_array( $option_value ) ) {
192
+							if ( is_array( $option_value ) ) {
193 193
 								$option_value = json_encode( $option_value );
194 194
 							}
195 195
 							// do noit migrate the lists option, it's not useful to us
196
-							if( $option_name != 'lists' ) {
196
+							if ( $option_name != 'lists' ) {
197 197
 								?>
198 198
 									var data = {
199 199
 										'action': 'migrate_old_plugin_settings',
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 													
204 204
 									$.post( ajaxurl, data, function(response) {
205 205
 										jQuery( '#options-updated' ).show();
206
-										jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>' . ucwords( str_replace( '_' , ' ' , str_replace( '-' , ' ' , $option_name ) ) ) . '</strong> ' . __( "successfully imported." , 'yikes-inc-easy-mailchimp-extender' ); ?></li>' );	
206
+										jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>' . ucwords( str_replace( '_', ' ', str_replace( '-', ' ', $option_name ) ) ) . '</strong> ' . __( "successfully imported.", 'yikes-inc-easy-mailchimp-extender' ); ?></li>' );	
207 207
 									});
208 208
 								<?php
209 209
 								
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 					}, 2000 );
228 228
 			</script>
229 229
 		<?php
230
-			wp_die( '<strong>' . __( 'Old plugin options do not exist. Redirecting you...' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong>' , 500 );
230
+			wp_die( '<strong>' . __( 'Old plugin options do not exist. Redirecting you...', 'yikes-inc-easy-mailchimp-extender' ) . '</strong>', 500 );
231 231
 		?>
232 232
 		</div>
233 233
 		<?php
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -112,9 +112,11 @@
 block discarded – undo
112 112
 												
113 113
 												// update 'date_format' on 'birthday' and 'date' fields
114 114
 												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'date', 'birthday' ) ) ) {
115
-													if( $mailchimp_form['fields'][$new_parent_key]['type'] == 'date' ) { // date
115
+													if( $mailchimp_form['fields'][$new_parent_key]['type'] == 'date' ) {
116
+// date
116 117
 														$mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD'; // mailchimp default (can be altered)
117
-													} else { // birthday 
118
+													} else {
119
+// birthday 
118 120
 														$mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD/YYYY'; // mailchimp default (can be altered)
119 121
 													}
120 122
 												}
Please login to merge, or discard this patch.
public/partials/shortcodes/process_form_shortcode.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 	}
163 163
 
164 164
 	/**
165
-	*	If login is required, abort
166
-	*	@since 6.0.3.8
167
-	*/
165
+	 *	If login is required, abort
166
+	 *	@since 6.0.3.8
167
+	 */
168 168
 	if( $form_login_required ) {
169 169
 		if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
170 170
 			ob_start();
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 	}
180 180
 
181 181
 	/**
182
-	*	Check if schedule is set for this form
183
-	*	@since 6.0.3.8
184
-	*/
182
+	 *	Check if schedule is set for this form
183
+	 *	@since 6.0.3.8
184
+	 */
185 185
 	if( $form_schedule_state ) {
186 186
 		// store current date
187 187
 		$current_date = strtotime( current_time( 'm/d/Y g:iA' ) );
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 	}
235 235
 
236 236
 	/**
237
-	*	Check for form inline parameter
238
-	*/
237
+	 *	Check for form inline parameter
238
+	 */
239 239
 	$form_inline = ( isset( $atts['inline'] ) && ( $atts['inline'] == 1 || $atts['inline'] == 'true' ) ) ? true : false;
240 240
 	// recheck from our form options
241 241
 	if( ! $form_inline ) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -943,7 +943,8 @@
 block discarded – undo
943 943
 
944 944
 						}
945 945
 
946
-					} else { // loop over interest groups
946
+					} else {
947
+// loop over interest groups
947 948
 
948 949
 
949 950
 						// store default choice
Please login to merge, or discard this patch.
Spacing   +306 added lines, -306 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 			'recaptcha_data_callback' => '', // set a custom js callback function to run after a successful recaptcha response - default none
22 22
 			'recaptcha_expired_callback' => '', // set a custom js callback function to run after the recaptcha has expired - default none
23 23
 			'inline' => '0',
24
-		), $atts , 'yikes-mailchimp' )
24
+		), $atts, 'yikes-mailchimp' )
25 25
 	);
26 26
 
27 27
 	// set globals
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	$form_submitted = isset( $form_submitted ) ? $form_submitted : 0;
32 32
 
33 33
 	/* If the user hasn't authenticated yet, lets kill off */
34
-	if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) {
35
-		return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key." , 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
34
+	if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) {
35
+		return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key.", 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
36 36
 	}
37 37
 
38 38
 	// if the user forgot to specify a form ID, lets kill of and warn them.
39
-	if( ! $form ) {
39
+	if ( ! $form ) {
40 40
 		return __( 'Whoops, it looks like you forgot to specify a form to display.', 'yikes-inc-easy-mailchimp-extender' );
41 41
 	}
42 42
 
@@ -45,39 +45,39 @@  discard block
 block discarded – undo
45 45
 	$form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form . '', ARRAY_A );
46 46
 
47 47
 	// confirm we have some results, or return an error
48
-	if( !$form_results ) {
49
-		return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form." , 'yikes-inc-easy-mailchimp-extender' );
48
+	if ( ! $form_results ) {
49
+		return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form.", 'yikes-inc-easy-mailchimp-extender' );
50 50
 	}
51 51
 
52 52
 	/*
53 53
 	*	Check if the user wants to use reCAPTCHA Spam Prevention
54 54
 	*/
55
-	if( get_option( 'yikes-mc-recaptcha-status' , '' ) == '1' ) {
55
+	if ( get_option( 'yikes-mc-recaptcha-status', '' ) == '1' ) {
56 56
 		// allow users to manually set recaptcha (instead of globally - recaptcha="1"/recaptcha="0" - but still needs to be globally enabled on the settings page)
57
-		if( ! isset( $atts['recaptcha'] ) || ( isset( $atts['recaptcha'] ) && $atts['recaptcha'] == '1' ) ) {
57
+		if ( ! isset( $atts[ 'recaptcha' ] ) || ( isset( $atts[ 'recaptcha' ] ) && $atts[ 'recaptcha' ] == '1' ) ) {
58 58
 			// if either of the Private the Secret key is left blank, we should display an error back to the user
59
-			if( get_option( 'yikes-mc-recaptcha-site-key' , '' ) == '' ) {
60
-				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
59
+			if ( get_option( 'yikes-mc-recaptcha-site-key', '' ) == '' ) {
60
+				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
61 61
 			}
62
-			if( get_option( 'yikes-mc-recaptcha-secret-key' , '' ) == '' ) {
63
-				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
62
+			if ( get_option( 'yikes-mc-recaptcha-secret-key', '' ) == '' ) {
63
+				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
64 64
 			}
65 65
 
66
-			if( ! empty( $atts['recaptcha_type'] ) ) {
67
-				echo $atts['recaptcha_type'];
66
+			if ( ! empty( $atts[ 'recaptcha_type' ] ) ) {
67
+				echo $atts[ 'recaptcha_type' ];
68 68
 			}
69 69
 
70 70
 			// Store the site language (to load recaptcha in a specific language)
71 71
 			$locale = get_locale();
72 72
 			$locale_split = explode( '_', $locale );
73 73
 			// Setup reCAPTCHA parameters
74
-			$lang = ( isset( $locale_split ) ? $locale_split[0] : $locale );
75
-			$lang = ( isset( $atts['recaptcha_lang'] ) ) ? $atts['recaptcha_lang'] : $locale_split[0];
76
-			$type = ( isset( $atts['recaptcha_type'] ) ) ? strtolower( $atts['recaptcha_type'] ) : 'image'; // setup recaptcha type
77
-			$theme= ( isset( $atts['recaptcha_theme'] ) ) ? strtolower( $atts['recaptcha_theme'] ) : 'light'; // setup recaptcha theme
78
-			$size = ( isset( $atts['recaptcha_size'] ) ) ? strtolower( $atts['recaptcha_size'] ) : 'normal'; // setup recaptcha size
79
-			$data_callback = ( isset( $atts['recaptcha_data_callback'] ) ) ? $atts['recaptcha_data_callback'] : false; // setup recaptcha size
80
-			$expired_callback = ( isset( $atts['recaptcha_expired_callback'] ) ) ? $atts['recaptcha_expired_callback'] : false; // setup recaptcha size
74
+			$lang = ( isset( $locale_split ) ? $locale_split[ 0 ] : $locale );
75
+			$lang = ( isset( $atts[ 'recaptcha_lang' ] ) ) ? $atts[ 'recaptcha_lang' ] : $locale_split[ 0 ];
76
+			$type = ( isset( $atts[ 'recaptcha_type' ] ) ) ? strtolower( $atts[ 'recaptcha_type' ] ) : 'image'; // setup recaptcha type
77
+			$theme = ( isset( $atts[ 'recaptcha_theme' ] ) ) ? strtolower( $atts[ 'recaptcha_theme' ] ) : 'light'; // setup recaptcha theme
78
+			$size = ( isset( $atts[ 'recaptcha_size' ] ) ) ? strtolower( $atts[ 'recaptcha_size' ] ) : 'normal'; // setup recaptcha size
79
+			$data_callback = ( isset( $atts[ 'recaptcha_data_callback' ] ) ) ? $atts[ 'recaptcha_data_callback' ] : false; // setup recaptcha size
80
+			$expired_callback = ( isset( $atts[ 'recaptcha_expired_callback' ] ) ) ? $atts[ 'recaptcha_expired_callback' ] : false; // setup recaptcha size
81 81
 			// Pass the shortcode parameters through a filter
82 82
 			$recaptcha_shortcode_params = apply_filters( 'yikes-mailchimp-recaptcha-parameters', array(
83 83
 				'language' => $lang,
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 				'expired_callback' => $expired_callback,
89 89
 			), $form );
90 90
 			// enqueue Google recaptcha JS
91
-			wp_register_script( 'google-recaptcha-js' , 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params['language'] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ) , 'all' );
91
+			wp_register_script( 'google-recaptcha-js', 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params[ 'language' ] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ), 'all' );
92 92
 			wp_enqueue_script( 'google-recaptcha-js' );
93
-			$recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key' , '' );
94
-			$recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params['theme'] . '" data-type="' . $recaptcha_shortcode_params['type'] . '" data-size="' . $recaptcha_shortcode_params['size'] . '" data-callback="' . $recaptcha_shortcode_params['success_callback'] . '" data-expired-callback="' . $recaptcha_shortcode_params['expired_callback'] . '"></div>';
93
+			$recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key', '' );
94
+			$recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params[ 'theme' ] . '" data-type="' . $recaptcha_shortcode_params[ 'type' ] . '" data-size="' . $recaptcha_shortcode_params[ 'size' ] . '" data-callback="' . $recaptcha_shortcode_params[ 'success_callback' ] . '" data-expired-callback="' . $recaptcha_shortcode_params[ 'expired_callback' ] . '"></div>';
95 95
 			?>
96 96
 			<script type="text/javascript">
97 97
 				/* Script Callback to init. multiple recaptchas on a single page */
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	}
119 119
 
120 120
 	// place our results into a seperate variable for easy looping
121
-	$form_data = $form_results[0];
121
+	$form_data = $form_results[ 0 ];
122 122
 
123 123
 	// store our variables
124
-	$form_id = (int) $form_data['id']; // form id (the id of the form in the database)
124
+	$form_id = (int) $form_data[ 'id' ]; // form id (the id of the form in the database)
125 125
 
126 126
 	/*
127 127
 	*	Get the stored form settings
@@ -130,32 +130,32 @@  discard block
 block discarded – undo
130 130
 	*/
131 131
 	$form_settings = Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $form_id );
132 132
 
133
-	$additional_form_settings = ( isset( $form_data['form_settings'] ) ) ? json_decode( $form_data['form_settings'], true ) : false;
133
+	$additional_form_settings = ( isset( $form_data[ 'form_settings' ] ) ) ? json_decode( $form_data[ 'form_settings' ], true ) : false;
134 134
 	// store our options from the additional form settings array
135
-	$form_classes = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-class-names'] : '';
136
-	$inline_form = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-inline-form'] : '';
137
-	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-submit-button-type'] : 'text';
138
-	$submit_button_text = ( $additional_form_settings && $additional_form_settings['yikes-easy-mc-submit-button-text'] != '' ) ? esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-text'] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' );
139
-	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings['yikes-easy-mc-submit-button-image'] ) : '';
140
-	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-classes'] ) : '';
135
+	$form_classes = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-class-names' ] : '';
136
+	$inline_form = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-inline-form' ] : '';
137
+	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-submit-button-type' ] : 'text';
138
+	$submit_button_text = ( $additional_form_settings && $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] != '' ) ? esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' );
139
+	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings[ 'yikes-easy-mc-submit-button-image' ] ) : '';
140
+	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-classes' ] ) : '';
141 141
 	// scheuldes
142
-	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-schedule'] : false;
143
-	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-start'] : '';;
144
-	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-end'] : '';
145
-	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-pending-message'] : '';
146
-	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-expired-message'] : '';
142
+	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-schedule' ] : false;
143
+	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-start' ] : ''; ;
144
+	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-end' ] : '';
145
+	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ] : '';
146
+	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ] : '';
147 147
 	// register required
148
-	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-login-required'] : false;
149
-	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-login-message'] : '';
148
+	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-login-required' ] : false;
149
+	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-login-message' ] : '';
150 150
 	// store number of fields
151
-	$field_count = (int) count( $form_settings['fields'] );
151
+	$field_count = (int) count( $form_settings[ 'fields' ] );
152 152
 
153 153
 	// confirm we actually have fields, before looping
154
-	if( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) {
154
+	if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) {
155 155
 		// loop over each field, if it's set to hidden -- subtract it from the field count
156 156
 		// this throws off the layout for inline forms setup below
157
-		foreach( json_decode( $form_data['fields'] ) as $form_field ) {
158
-			if( isset( $form_field->hide ) && $form_field->hide == 1 ) {
157
+		foreach ( json_decode( $form_data[ 'fields' ] ) as $form_field ) {
158
+			if ( isset( $form_field->hide ) && $form_field->hide == 1 ) {
159 159
 				$field_count--;
160 160
 			}
161 161
 		}
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
 	*	If login is required, abort
166 166
 	*	@since 6.0.3.8
167 167
 	*/
168
-	if( $form_login_required ) {
169
-		if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
168
+	if ( $form_login_required ) {
169
+		if ( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
170 170
 			ob_start();
171 171
 				?>
172 172
 					<div class="yikes-mailchimp-login-required yikes-mailchimp-form-<?php echo $form_id; ?>-login-required">
@@ -182,19 +182,19 @@  discard block
 block discarded – undo
182 182
 	*	Check if schedule is set for this form
183 183
 	*	@since 6.0.3.8
184 184
 	*/
185
-	if( $form_schedule_state ) {
185
+	if ( $form_schedule_state ) {
186 186
 		// store current date
187 187
 		$current_date = strtotime( current_time( 'm/d/Y g:iA' ) );
188 188
 
189 189
 		// the the current date is less than the form scheduled start date
190
-		if( $current_date < $form_schedule_start ) {
190
+		if ( $current_date < $form_schedule_start ) {
191 191
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_pending_message );
192 192
 			return;
193 193
 			// abort
194 194
 		}
195 195
 
196 196
 		// The current date is past or equal to the end date, aka form has now expired
197
-		if( $current_date >= $form_schedule_end ) {
197
+		if ( $current_date >= $form_schedule_end ) {
198 198
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_expired_message );
199 199
 			return;
200 200
 			// abort
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
 
204 204
 	// setup the submit button text
205 205
 	// shortcode parameter takes precedence over option
206
-	if( isset( $atts['submit'] ) ) {
207
-		$submit = $atts['submit'];
206
+	if ( isset( $atts[ 'submit' ] ) ) {
207
+		$submit = $atts[ 'submit' ];
208 208
 	} else {
209 209
 		$submit = $submit_button_text;
210 210
 	}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	$page_data = $post;
215 215
 
216 216
 	// Remove the post_password from this for security
217
-	if( isset( $page_data->post_password ) ) {
217
+	if ( isset( $page_data->post_password ) ) {
218 218
 		unset( $page_data->post_password );
219 219
 	}
220 220
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	*	to exclude styles from loading, add `define( 'YIKES_MAILCHIMP_EXCLUDE_STYLES', true );` to functions.php
229 229
 	*	@since 6.0.3.8
230 230
 	*/
231
-	if( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
231
+	if ( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
232 232
 		// enqueue the form styles
233 233
 		wp_enqueue_style( 'yikes-inc-easy-mailchimp-public-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-extender-public.min.css', array( $last_key ) );
234 234
 	}
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 	/**
237 237
 	*	Check for form inline parameter
238 238
 	*/
239
-	$form_inline = ( isset( $atts['inline'] ) && ( $atts['inline'] == 1 || $atts['inline'] == 'true' ) ) ? true : false;
239
+	$form_inline = ( isset( $atts[ 'inline' ] ) && ( $atts[ 'inline' ] == 1 || $atts[ 'inline' ] == 'true' ) ) ? true : false;
240 240
 	// recheck from our form options
241
-	if( ! $form_inline ) {
242
-		$form_inline = ( isset( $additional_form_settings['yikes-easy-mc-inline-form'] ) && $additional_form_settings['yikes-easy-mc-inline-form'] == 1 ) ? true : false;
241
+	if ( ! $form_inline ) {
242
+		$form_inline = ( isset( $additional_form_settings[ 'yikes-easy-mc-inline-form' ] ) && $additional_form_settings[ 'yikes-easy-mc-inline-form' ] == 1 ) ? true : false;
243 243
 	}
244
-	if( $form_inline ) {
244
+	if ( $form_inline ) {
245 245
 		$field_width = (float) ( 100 / $field_count );
246 246
 		$submit_button_width = (float) ( 20 / $field_count );
247 247
 		/*
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 	<?php
271 271
 
272 272
 		/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
273
-		if( is_user_logged_in() ) {
274
-			if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
273
+		if ( is_user_logged_in() ) {
274
+			if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
275 275
 				$edit_form_link = '<span class="edit-link">';
276
-					$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_settings['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
276
+					$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form ) ) . '" title="' . __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_settings[ 'form_name' ] ) . '">' . __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
277 277
 				$edit_form_link .= '</span>';
278
-				$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $form, ucwords( $form_settings['form_name'] ) );
278
+				$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $form, ucwords( $form_settings[ 'form_name' ] ) );
279 279
 			} else {
280 280
 				$edit_form_link = '';
281 281
 			}
@@ -284,16 +284,16 @@  discard block
 block discarded – undo
284 284
 		// ensure there is an 'email' field the user can fill out
285 285
 		// or else MailChimp throws errors at you
286 286
 			// extract our array keys
287
-			if( isset( $form_settings['fields'] ) && ! empty( $form_settings['fields'] ) ) {
288
-				$array_keys = array_keys( $form_settings['fields'] );
287
+			if ( isset( $form_settings[ 'fields' ] ) && ! empty( $form_settings[ 'fields' ] ) ) {
288
+				$array_keys = array_keys( $form_settings[ 'fields' ] );
289 289
 				// check for EMAIL in that array
290
-				if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) {
291
-					return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>';
290
+				if ( ! in_array( 'EMAIL', $array_keys ) && ! in_array( 'email', $array_keys ) ) {
291
+					return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>';
292 292
 				}
293 293
 			} else {
294
-				$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
295
-				if( is_user_logged_in() ) {
296
-					if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
294
+				$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
295
+				if ( is_user_logged_in() ) {
296
+					if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
297 297
 						return $error . $edit_form_link;
298 298
 					}
299 299
 				} else {
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
 		*	Set a custom title using custom_title="lorem ipsum" parameter in the shortcode
312 312
 		*	- This takes precedence over the title set
313 313
 		*/
314
-		if( ! empty( $title ) && $title == 1 && isset( $atts['custom_title'] ) ) {
315
-			echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts['custom_title'] ), $form_id ) . '</h3>';
314
+		if ( ! empty( $title ) && $title == 1 && isset( $atts[ 'custom_title' ] ) ) {
315
+			echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts[ 'custom_title' ] ), $form_id ) . '</h3>';
316 316
 		} else {
317 317
 			// display the form description if the user
318 318
 			// has specified to do so
319
-			if( ! empty( $title ) && $title == 1 ) {
320
-				echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_settings['form_name'] ), $form_id ) . '</h3>';
319
+			if ( ! empty( $title ) && $title == 1 ) {
320
+				echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_settings[ 'form_name' ] ), $form_id ) . '</h3>';
321 321
 			}
322 322
 		}
323 323
 
@@ -325,21 +325,21 @@  discard block
 block discarded – undo
325 325
 		*	Allow users to specify a custom description for this form, no html support
326 326
 		*	@since 6.0.3.8
327 327
 		*/
328
-		if( ! empty( $description ) && $description == 1 && isset( $atts['custom_description'] ) ) {
329
-			echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $atts['custom_description'], $form_id ) ) . '</section>';
328
+		if ( ! empty( $description ) && $description == 1 && isset( $atts[ 'custom_description' ] ) ) {
329
+			echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $atts[ 'custom_description' ], $form_id ) ) . '</section>';
330 330
 		} else {
331 331
 			// display the form description if the user
332 332
 			// has specified to do so
333
-			if( ! empty( $description ) && $description == 1 ) {
334
-				echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $form_settings['form_description'], $form_id ) ) . '</section>';
333
+			if ( ! empty( $description ) && $description == 1 ) {
334
+				echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $form_settings[ 'form_description' ], $form_id ) ) . '</section>';
335 335
 			}
336 336
 		}
337 337
 
338 338
 		// Check for AJAX
339
-		if( ( ! empty( $atts['ajax'] ) && $atts['ajax'] == 1 ) || $form_settings['submission_settings']['ajax'] == 1 ) {
339
+		if ( ( ! empty( $atts[ 'ajax' ] ) && $atts[ 'ajax' ] == 1 ) || $form_settings[ 'submission_settings' ][ 'ajax' ] == 1 ) {
340 340
 			// enqueue our ajax script
341
-			wp_register_script( 'yikes-easy-mc-ajax' , YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js' , array( 'jquery' ) , 'yikes-inc-easy-mailchimp-extender', false );
342
-			wp_localize_script( 'yikes-easy-mc-ajax' , 'object' , array(
341
+			wp_register_script( 'yikes-easy-mc-ajax', YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js', array( 'jquery' ), 'yikes-inc-easy-mailchimp-extender', false );
342
+			wp_localize_script( 'yikes-easy-mc-ajax', 'object', array(
343 343
 				'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
344 344
 				'page_data' => $page_data,
345 345
 				'interest_group_checkbox_error' => apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ),
@@ -358,10 +358,10 @@  discard block
 block discarded – undo
358 358
 
359 359
 		// render the form!
360 360
 		?>
361
-			<form id="<?php echo sanitize_title( $form_settings['form_name'] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline )  { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if( !empty( $_POST ) && $form_submitted == 1 && $form_settings['submission_settings']['hide_form_post_signup'] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>">
361
+			<form id="<?php echo sanitize_title( $form_settings[ 'form_name' ] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if ( ! empty( $_POST ) && $form_submitted == 1 && $form_settings[ 'submission_settings' ][ 'hide_form_post_signup' ] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>">
362 362
 
363 363
 				<?php
364
-				foreach( $form_settings['fields'] as $field ) {
364
+				foreach ( $form_settings[ 'fields' ] as $field ) {
365 365
 						// input array
366 366
 						$field_array = array();
367 367
 						// label array
@@ -370,53 +370,53 @@  discard block
 block discarded – undo
370 370
 						$hidden_label = false;
371 371
 						// label classes array
372 372
 						$label_class_array = array();
373
-						if( $field['additional-classes'] != '' ) {
373
+						if ( $field[ 'additional-classes' ] != '' ) {
374 374
 							// split custom classes at spaces
375
-							$custom_classes = explode( ' ' , $field['additional-classes'] );
375
+							$custom_classes = explode( ' ', $field[ 'additional-classes' ] );
376 376
 							// check our custom class array for field-left/field-right
377 377
 							// if it's set we need to assign it to our label and remove it from the field classes
378 378
 							 // input half left
379
-							if( in_array( 'field-left-half' , $custom_classes ) ) {
379
+							if ( in_array( 'field-left-half', $custom_classes ) ) {
380 380
 								// $label_array['class'] = 'class="field-left-half"';
381
-								$label_class_array[] = 'field-left-half';
382
-								$key = array_search( 'field-left-half' , $custom_classes );
383
-								unset( $custom_classes[$key] );
381
+								$label_class_array[ ] = 'field-left-half';
382
+								$key = array_search( 'field-left-half', $custom_classes );
383
+								unset( $custom_classes[ $key ] );
384 384
 							} // input half right
385
-							if( in_array( 'field-right-half' , $custom_classes ) ) {
385
+							if ( in_array( 'field-right-half', $custom_classes ) ) {
386 386
 								// $label_array['class'] = 'class="field-right-half"';
387
-								$label_class_array[] = 'field-right-half';
388
-								$key = array_search( 'field-right-half' , $custom_classes );
389
-								unset( $custom_classes[$key] );
387
+								$label_class_array[ ] = 'field-right-half';
388
+								$key = array_search( 'field-right-half', $custom_classes );
389
+								unset( $custom_classes[ $key ] );
390 390
 							} // input thirds (1/3 width, floated left)
391
-							if( in_array( 'field-third' , $custom_classes ) ) {
391
+							if ( in_array( 'field-third', $custom_classes ) ) {
392 392
 								// $label_array['class'] = 'class="field-third"';
393
-								$label_class_array[] = 'field-third';
394
-								$key = array_search( 'field-third' , $custom_classes );
395
-								unset( $custom_classes[$key] );
393
+								$label_class_array[ ] = 'field-third';
394
+								$key = array_search( 'field-third', $custom_classes );
395
+								unset( $custom_classes[ $key ] );
396 396
 							} // 2 column radio
397
-							if( in_array( 'option-2-col' , $custom_classes ) ) {
397
+							if ( in_array( 'option-2-col', $custom_classes ) ) {
398 398
 								// $label_array['class'] = 'class="option-2-col"';
399
-								$label_class_array[] = 'option-2-col';
400
-								$key = array_search( 'option-2-col' , $custom_classes );
401
-								unset( $custom_classes[$key] );
399
+								$label_class_array[ ] = 'option-2-col';
400
+								$key = array_search( 'option-2-col', $custom_classes );
401
+								unset( $custom_classes[ $key ] );
402 402
 							} // 3 column radio
403
-							if( in_array( 'option-3-col' , $custom_classes ) ) {
403
+							if ( in_array( 'option-3-col', $custom_classes ) ) {
404 404
 								// $label_array['class'] = 'class="option-3-col"';
405
-								$label_class_array[] = 'option-3-col';
406
-								$key = array_search( 'option-3-col' , $custom_classes );
407
-								unset( $custom_classes[$key] );
405
+								$label_class_array[ ] = 'option-3-col';
406
+								$key = array_search( 'option-3-col', $custom_classes );
407
+								unset( $custom_classes[ $key ] );
408 408
 							} // 4 column radio
409
-							if( in_array( 'option-4-col' , $custom_classes ) ) {
409
+							if ( in_array( 'option-4-col', $custom_classes ) ) {
410 410
 								// $label_array['class'] = 'class="option-4-col"';
411
-								$label_class_array[] = 'option-4-col';
412
-								$key = array_search( 'option-4-col' , $custom_classes );
413
-								unset( $custom_classes[$key] );
411
+								$label_class_array[ ] = 'option-4-col';
412
+								$key = array_search( 'option-4-col', $custom_classes );
413
+								unset( $custom_classes[ $key ] );
414 414
 							} // inline radio & checkboxes etc
415
-							if( in_array( 'option-inline' , $custom_classes ) ) {
415
+							if ( in_array( 'option-inline', $custom_classes ) ) {
416 416
 								// $label_array['class'] = 'class="option-inline"';
417
-								$label_class_array[] = 'option-inline';
418
-								$key = array_search( 'option-inline' , $custom_classes );
419
-								unset( $custom_classes[$key] );
417
+								$label_class_array[ ] = 'option-inline';
418
+								$key = array_search( 'option-inline', $custom_classes );
419
+								unset( $custom_classes[ $key ] );
420 420
 							}
421 421
 						} else {
422 422
 							$custom_classes = array();
@@ -424,68 +424,68 @@  discard block
 block discarded – undo
424 424
 
425 425
 						// if the form is set to inline, add the inline class to our labels
426 426
 						// since @6.0.3.8
427
-						if( $form_inline ) {
428
-							$label_class_array[] = 'label-inline';
427
+						if ( $form_inline ) {
428
+							$label_class_array[ ] = 'label-inline';
429 429
 						}
430 430
 
431
-						if( isset( $field['hide-label'] ) ) {
432
-							if( $field['hide-label'] == 1 ) {
431
+						if ( isset( $field[ 'hide-label' ] ) ) {
432
+							if ( $field[ 'hide-label' ] == 1 ) {
433 433
 								$hidden_label = true;
434
-								$custom_classes[] = 'field-no-label';
434
+								$custom_classes[ ] = 'field-no-label';
435 435
 							}
436 436
 						}
437 437
 
438 438
 					/* Store tag variable based on field type */
439
-					if( isset( $field['merge'] ) ) {
439
+					if ( isset( $field[ 'merge' ] ) ) {
440 440
 						$tag = 'merge';
441 441
 					} else {
442 442
 						$tag = 'group_id';
443 443
 					}
444 444
 
445 445
 					// build up our array
446
-					$field_array['id'] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[$tag] ) . '" ';
447
-					$field_array['name'] = 'name="' . esc_attr( $field[$tag] ) . '" ';
448
-					$field_array['placeholder'] = isset( $field['placeholder'] ) ? 'placeholder="' . esc_attr( stripslashes( $field['placeholder'] ) ) . '" ' : '';
449
-					$field_array['classes'] = 'class="yikes-easy-mc-'.$field['type'] . ' ' .  esc_attr( trim( implode( ' ' , $custom_classes ) ) ) . '" ';
446
+					$field_array[ 'id' ] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[ $tag ] ) . '" ';
447
+					$field_array[ 'name' ] = 'name="' . esc_attr( $field[ $tag ] ) . '" ';
448
+					$field_array[ 'placeholder' ] = isset( $field[ 'placeholder' ] ) ? 'placeholder="' . esc_attr( stripslashes( $field[ 'placeholder' ] ) ) . '" ' : '';
449
+					$field_array[ 'classes' ] = 'class="yikes-easy-mc-' . $field[ 'type' ] . ' ' . esc_attr( trim( implode( ' ', $custom_classes ) ) ) . '" ';
450 450
 
451 451
 					// email must always be required and visible
452
-					if( $field['type'] == 'email' ) {
453
-						$field_array['required'] = 'required="required"';
454
-						$label_array['visible'] = '';
452
+					if ( $field[ 'type' ] == 'email' ) {
453
+						$field_array[ 'required' ] = 'required="required"';
454
+						$label_array[ 'visible' ] = '';
455 455
 						// $label_array['required'] = 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"';
456
-						$label_class_array[] = $field['merge'] . '-label';
457
-						$label_class_array[] = 'yikes-mailchimp-field-required';
456
+						$label_class_array[ ] = $field[ 'merge' ] . '-label';
457
+						$label_class_array[ ] = 'yikes-mailchimp-field-required';
458 458
 					} else {
459
-						if( $tag == 'merge' ) {
460
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
461
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
459
+						if ( $tag == 'merge' ) {
460
+							$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
461
+							$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
462 462
 							// $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['merge'] . '-label"';
463
-							$label_class_array[] = isset( $field['require'] ) ? $field['merge'] . '-label yikes-mailchimp-field-required' : $field['merge'] . '-label';
463
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'merge' ] . '-label yikes-mailchimp-field-required' : $field[ 'merge' ] . '-label';
464 464
 						} else {
465
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
466
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
465
+							$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
466
+							$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
467 467
 							// $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['group_id'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['group_id'] . '-label"';
468
-							$label_class_array[] = isset( $field['require'] ) ? $field['group_id'] . '-label yikes-mailchimp-field-required' : $field['group_id'] . '-label';
468
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'group_id' ] . '-label yikes-mailchimp-field-required' : $field[ 'group_id' ] . '-label';
469 469
 						}
470 470
 					}
471 471
 
472 472
 					// if both hide label and hide field are checked, we gotta hide the field!
473
-					if( isset( $field['hide' ] ) && $field['hide'] == 1 ) {
474
-						if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) {
475
-							$field_array['visible'] = 'style="display:none;"';
473
+					if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) {
474
+						if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) {
475
+							$field_array[ 'visible' ] = 'style="display:none;"';
476 476
 						}
477 477
 					}
478 478
 
479
-					$label_array['classes'] = 'class="' . implode( ' ', $label_class_array ) . '"';
479
+					$label_array[ 'classes' ] = 'class="' . implode( ' ', $label_class_array ) . '"';
480 480
 
481 481
 					// filter the field array data
482 482
 					$field_array = apply_filters( 'yikes-mailchimp-field-data', $field_array, $field, $form_id );
483 483
 
484 484
 					/* Loop Over Standard Fields (aka merge variables) */
485
-					if( isset( $field['merge'] ) ) {
485
+					if ( isset( $field[ 'merge' ] ) ) {
486 486
 
487 487
 						// loop over our fields by Type
488
-						switch ( $field['type'] ) {
488
+						switch ( $field[ 'type' ] ) {
489 489
 
490 490
 							default:
491 491
 							case 'email':
@@ -493,25 +493,25 @@  discard block
 block discarded – undo
493 493
 							case 'number':
494 494
 
495 495
 								// pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type)
496
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
496
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
497 497
 								$default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value );
498 498
 									?>
499
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
499
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
500 500
 
501 501
 										<!-- dictate label visibility -->
502
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
503
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
504
-												<?php if( ! isset( $field['hide-label'] ) ) { echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ), $form_id ); } ?>
502
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
503
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
504
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ), $form_id ); } ?>
505 505
 											</span>
506 506
 										<?php } ?>
507 507
 
508
-										<input <?php echo implode( ' ' , $field_array ); if( $field['type'] != 'email' && $field['type'] != 'number' ) { ?> type="text" <?php } else if( $field['type'] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
508
+										<input <?php echo implode( ' ', $field_array ); if ( $field[ 'type' ] != 'email' && $field[ 'type' ] != 'number' ) { ?> type="text" <?php } else if ( $field[ 'type' ] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
509 509
 
510 510
 										<!-- description -->
511
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
511
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
512 512
 											<p class="form-field-description">
513 513
 												<small>
514
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
514
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
515 515
 												</small>
516 516
 											</p>
517 517
 										<?php } ?>
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 
524 524
 							case 'url':
525 525
 							case 'imageurl':
526
-								$default_value = ( isset( $field['default'] ) ) ? $field['default'] : '';
526
+								$default_value = ( isset( $field[ 'default' ] ) ) ? $field[ 'default' ] : '';
527 527
 									?>
528 528
 
529 529
 									<script type="text/javascript">
@@ -535,22 +535,22 @@  discard block
 block discarded – undo
535 535
 										}
536 536
 									</script>
537 537
 
538
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
538
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
539 539
 
540 540
 										<!-- dictate label visibility -->
541
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
542
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
543
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
541
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
542
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
543
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
544 544
 											</span>
545 545
 										<?php } ?>
546 546
 
547
-										<input <?php echo implode( ' ' , $field_array ); ?> type="url" <?php if( $field['type'] == 'url' ) { ?> title="<?php _e( 'Please enter a valid URL to the website.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } else { ?> title="<?php _e( 'Please enter a valid URL to the image.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>" onblur="properlyFormatURLField(this);return false;">
547
+										<input <?php echo implode( ' ', $field_array ); ?> type="url" <?php if ( $field[ 'type' ] == 'url' ) { ?> title="<?php _e( 'Please enter a valid URL to the website.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } else { ?> title="<?php _e( 'Please enter a valid URL to the image.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>" onblur="properlyFormatURLField(this);return false;">
548 548
 
549 549
 										<!-- description -->
550
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
550
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
551 551
 											<p class="form-field-description">
552 552
 												<small>
553
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
553
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
554 554
 												</small>
555 555
 											</p>
556 556
 										<?php } ?>
@@ -561,8 +561,8 @@  discard block
 block discarded – undo
561 561
 							break;
562 562
 
563 563
 							case 'phone':
564
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
565
-								$phone_format = $field['phone_format'];
564
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
565
+								$phone_format = $field[ 'phone_format' ];
566 566
 								?>
567 567
 									<script type="text/javascript">
568 568
 										/* Replace incorrect values and format it correctly for MailChimp API */
@@ -575,22 +575,22 @@  discard block
 block discarded – undo
575 575
 										}
576 576
 									</script>
577 577
 
578
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
578
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
579 579
 
580 580
 										<!-- dictate label visibility -->
581
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
582
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
583
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
581
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
582
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
583
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
584 584
 											</span>
585 585
 										<?php } ?>
586 586
 
587
-										<input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $phone_format != 'US' ) { ?>  title="<?php _e( 'International Phone Number' , 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern' , '[0-9,-]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####' , 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern' , '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" onblur="formatUSPhoneNumber(this);"<?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
587
+										<input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $phone_format != 'US' ) { ?>  title="<?php _e( 'International Phone Number', 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern', '[0-9,-]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####', 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern', '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" onblur="formatUSPhoneNumber(this);"<?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
588 588
 
589 589
 										<!-- description -->
590
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
590
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
591 591
 											<p class="form-field-description">
592 592
 												<small>
593
-													<?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field['merge'] ) . '-description', stripslashes( $field['description'] ), $form_id ); ?>
593
+													<?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field[ 'merge' ] ) . '-description', stripslashes( $field[ 'description' ] ), $form_id ); ?>
594 594
 												</small>
595 595
 											</p>
596 596
 										<?php } ?>
@@ -600,25 +600,25 @@  discard block
 block discarded – undo
600 600
 							break;
601 601
 
602 602
 							case 'zip':
603
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
603
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
604 604
 
605 605
 									?>
606
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
606
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
607 607
 
608 608
 									<!-- dictate label visibility -->
609
-									<?php if( ! isset( $field['hide-label'] ) ) { ?>
610
-										<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
611
-											<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
609
+									<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
610
+										<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
611
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
612 612
 										</span>
613 613
 									<?php } ?>
614 614
 
615
-									<input <?php echo implode( ' ' , $field_array ); ?> type="text" pattern="\d{5,5}(-\d{4,4})?" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
615
+									<input <?php echo implode( ' ', $field_array ); ?> type="text" pattern="\d{5,5}(-\d{4,4})?" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
616 616
 
617 617
 									<!-- description -->
618
-									<?php if( isset( $field['description'] ) ) { ?>
618
+									<?php if ( isset( $field[ 'description' ] ) ) { ?>
619 619
 										<p class="form-field-description">
620 620
 											<small>
621
-												<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
621
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
622 622
 											</small>
623 623
 										</p>
624 624
 									<?php } ?>
@@ -630,28 +630,28 @@  discard block
 block discarded – undo
630 630
 
631 631
 							case 'address':
632 632
 								// required fields
633
-								$required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' );
633
+								$required_fields = array( 'addr1' => 'address', 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip', 'country' => 'country' );
634 634
 
635 635
 								// setup the default country value
636 636
 								$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
637 637
 
638 638
 								// store number for looping
639 639
 								$x = 1;
640
-								foreach( $required_fields as $type => $label ) {
640
+								foreach ( $required_fields as $type => $label ) {
641 641
 
642 642
 									// set the field names for the addrress fields
643
-									$field_array['name'] = 'name="'.$field[$tag].'['.$type.']'.'"';
643
+									$field_array[ 'name' ] = 'name="' . $field[ $tag ] . '[' . $type . ']' . '"';
644 644
 
645 645
 									// reset the label classes for left-half/right-half for addresses
646
-									if( isset( $label_array['class'] ) ) {
646
+									if ( isset( $label_array[ 'class' ] ) ) {
647 647
 										if ( $x % 2 == 0 ) {
648
-											$label_array['class'] = str_replace( 'field-left-half', 'field-right-half', $label_array['class'] );
648
+											$label_array[ 'class' ] = str_replace( 'field-left-half', 'field-right-half', $label_array[ 'class' ] );
649 649
 										} else {
650
-											$label_array['class'] = str_replace( 'field-right-half', 'field-left-half', $label_array['class'] );
650
+											$label_array[ 'class' ] = str_replace( 'field-right-half', 'field-left-half', $label_array[ 'class' ] );
651 651
 										}
652 652
 									}
653 653
 
654
-									switch( $type ) {
654
+									switch ( $type ) {
655 655
 
656 656
 										default:
657 657
 										case 'addr1':
@@ -660,17 +660,17 @@  discard block
 block discarded – undo
660 660
 
661 661
 
662 662
 											?>
663
-											<label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
663
+											<label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>>
664 664
 
665 665
 												<!-- dictate label visibility -->
666
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
667
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
668
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
666
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
667
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
668
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
669 669
 													</span>
670 670
 												<?php } ?>
671 671
 
672 672
 
673
-												<input <?php echo implode( ' ' , $field_array ); ?> type="text"  value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } ?>">
673
+												<input <?php echo implode( ' ', $field_array ); ?> type="text"  value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } ?>">
674 674
 
675 675
 											</label>
676 676
 											<?php
@@ -680,16 +680,16 @@  discard block
 block discarded – undo
680 680
 										case 'state':
681 681
 
682 682
 											?>
683
-											<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="state-dropdown"<?php if( ! in_array( $default_country, array( 'US' ) ) ) { ?> style="display: none;"<?php } ?>>
683
+											<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="state-dropdown"<?php if ( ! in_array( $default_country, array( 'US' ) ) ) { ?> style="display: none;"<?php } ?>>
684 684
 
685 685
 												<!-- dictate label visibility -->
686
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
687
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
688
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
686
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
687
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
688
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
689 689
 													</span>
690 690
 												<?php } ?>
691 691
 
692
-												<select <?php echo implode( ' ' , $field_array ); ?>>
692
+												<select <?php echo implode( ' ', $field_array ); ?>>
693 693
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-dropdown.php' ); ?>
694 694
 												</select>
695 695
 
@@ -702,15 +702,15 @@  discard block
 block discarded – undo
702 702
 										case 'zip':
703 703
 
704 704
 											?>
705
-											<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="zip-input"<?php if( ! in_array( $default_country, array( 'US', 'GB' ) ) ) { ?> style="display: none;"<?php } ?>>
705
+											<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="zip-input"<?php if ( ! in_array( $default_country, array( 'US', 'GB' ) ) ) { ?> style="display: none;"<?php } ?>>
706 706
 
707
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
708
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
709
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
707
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
708
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
709
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
710 710
 													</span>
711 711
 												<?php } ?>
712 712
 
713
-												<input <?php echo implode( ' ' , $field_array ); ?> type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?' ); ?>" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
713
+												<input <?php echo implode( ' ', $field_array ); ?> type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?' ); ?>" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
714 714
 
715 715
 											</label>
716 716
 											<?php
@@ -748,16 +748,16 @@  discard block
 block discarded – undo
748 748
 												$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
749 749
 											?>
750 750
 
751
-											<label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
751
+											<label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>>
752 752
 
753 753
 												<!-- dictate label visibility -->
754
-												<?php if( !isset( $field['hide-label'] ) ) { ?>
755
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
756
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
754
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
755
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
756
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
757 757
 													</span>
758 758
 												<?php } ?>
759 759
 
760
-												<select <?php echo implode( ' ' , $field_array ); ?> onchange="checkCountry(this);return false;">
760
+												<select <?php echo implode( ' ', $field_array ); ?> onchange="checkCountry(this);return false;">
761 761
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/country-dropdown.php' ); ?>
762 762
 												</select>
763 763
 											</label>
@@ -768,10 +768,10 @@  discard block
 block discarded – undo
768 768
 								}
769 769
 
770 770
 								// description
771
-								if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
771
+								if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
772 772
 									<p class="form-field-description">
773 773
 										<small>
774
-											<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
774
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
775 775
 										</small>
776 776
 									</p>
777 777
 									<?php }
@@ -781,19 +781,19 @@  discard block
 block discarded – undo
781 781
 							case 'birthday':
782 782
 
783 783
 								// bootstrap datepicker requirements
784
-								wp_enqueue_script( 'bootstrap-hover-dropdown' , YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js' , array( 'jquery' ) );
785
-								wp_enqueue_script( 'bootstrap-datepicker-script' , YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js' , array( 'jquery' , 'bootstrap-hover-dropdown' ) );
786
-								wp_enqueue_style( 'bootstrap-datepicker-styles' , YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
787
-								wp_enqueue_style( 'override-datepicker-styles' , YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css' , array( 'bootstrap-datepicker-styles' ) );
784
+								wp_enqueue_script( 'bootstrap-hover-dropdown', YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js', array( 'jquery' ) );
785
+								wp_enqueue_script( 'bootstrap-datepicker-script', YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js', array( 'jquery', 'bootstrap-hover-dropdown' ) );
786
+								wp_enqueue_style( 'bootstrap-datepicker-styles', YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
787
+								wp_enqueue_style( 'override-datepicker-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css', array( 'bootstrap-datepicker-styles' ) );
788 788
 
789
-								switch ( $field['type'] ) {
789
+								switch ( $field[ 'type' ] ) {
790 790
 									default:
791 791
 									case 'date':
792
-										$date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd/yy';
792
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd/yy';
793 793
 										break;
794 794
 
795 795
 									case 'birthday':
796
-										$date_format = ( isset( $field['date_format'] ) ) ? strtolower( $field['date_format'] ) : 'mm/dd';
796
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? strtolower( $field[ 'date_format' ] ) : 'mm/dd';
797 797
 										break;
798 798
 								}
799 799
 								// initialize the datepicker
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 											padding: .85em .5em !important;
805 805
 										}
806 806
 										<?php
807
-											if( wp_is_mobile() ) {
807
+											if ( wp_is_mobile() ) {
808 808
 												?>
809 809
 												.datepicker-dropdown {
810 810
 													margin-top: 0px;
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 											$day_names = $admin_class->yikes_jQuery_datepicker_strip_array_indices( $wp_locale->weekday );
820 820
 											$day_names_short = $admin_class->yikes_jQuery_datepicker_strip_array_indices( $wp_locale->weekday_abbrev );
821 821
 											$day_names_min = $admin_class->yikes_jQuery_datepicker_strip_array_indices( $wp_locale->weekday_initial );
822
-											$date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field['type'] );
822
+											$date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field[ 'type' ] );
823 823
 											$first_day = get_option( 'start_of_week' );
824 824
 											$isRTL = $wp_locale->is_rtl();
825 825
 										?>
@@ -840,10 +840,10 @@  discard block
 block discarded – undo
840 840
 												numberOfMonths: 1,
841 841
 												today: '<?php _e( 'Today', 'yikes-inc-easy-mailchimp-extender' ); ?>'
842 842
 											};
843
-											jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').datepicker().on( 'show', function( e ) {
844
-												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'height' );
843
+											jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').datepicker().on( 'show', function( e ) {
844
+												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'height' );
845 845
 												date_picker_height = parseInt( date_picker_height.replace( 'px', '' ) ) + parseInt( 15 ) + 'px';
846
-												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'width' ).replace( 'px', '' );
846
+												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'width' ).replace( 'px', '' );
847 847
 												if( date_picker_width > 500 ) {
848 848
 													date_picker_width = 500;
849 849
 												}
@@ -853,27 +853,27 @@  discard block
 block discarded – undo
853 853
 									</script>
854 854
 								<?php
855 855
 
856
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
856
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
857 857
 								// store empty number for looping
858 858
 								$x = 0;
859 859
 
860 860
 								?>
861
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
861
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
862 862
 
863 863
 										<!-- dictate label visibility -->
864
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
865
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
866
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
864
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
865
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
866
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
867 867
 											</span>
868 868
 										<?php } ?>
869 869
 
870
-										<input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $field['type'] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
870
+										<input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $field[ 'type' ] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
871 871
 
872 872
 										<!-- description -->
873
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
873
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
874 874
 											<p class="form-field-description">
875 875
 												<small>
876
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
876
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
877 877
 												</small>
878 878
 											</p>
879 879
 										<?php } ?>
@@ -884,36 +884,36 @@  discard block
 block discarded – undo
884 884
 							break;
885 885
 
886 886
 							case 'dropdown':
887
-								$default_value = $field['default_choice'];
887
+								$default_value = $field[ 'default_choice' ];
888 888
 								// store empty number for looping
889 889
 								$x = 0;
890 890
 								// hidden labels
891 891
 
892 892
 									?>
893
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
893
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
894 894
 										<!-- dictate label visibility -->
895
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
896
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
897
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
895
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
896
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
897
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
898 898
 											</span>
899 899
 										<?php } ?>
900 900
 
901
-										<select <?php echo implode( ' ' , $field_array ); ?>>
901
+										<select <?php echo implode( ' ', $field_array ); ?>>
902 902
 											<?php
903 903
 												// decode for looping
904
-												$choices = json_decode( $field['choices'], true );
905
-												foreach( $choices as $choice ) {
906
-													?><option value="<?php echo $choice; ?>" <?php selected( $default_value , $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
904
+												$choices = json_decode( $field[ 'choices' ], true );
905
+												foreach ( $choices as $choice ) {
906
+													?><option value="<?php echo $choice; ?>" <?php selected( $default_value, $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
907 907
 													$x++;
908 908
 												}
909 909
 											?>
910 910
 										</select>
911 911
 
912 912
 										<!-- description -->
913
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
913
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
914 914
 											<p class="form-field-description">
915 915
 												<small>
916
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
916
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
917 917
 												</small>
918 918
 											</p>
919 919
 										<?php } ?>
@@ -927,13 +927,13 @@  discard block
 block discarded – undo
927 927
 							case 'radio':
928 928
 							case 'checkbox':
929 929
 								// remove the ID (as to not assign the same ID to every radio button)
930
-								unset( $field_array['id'] );
931
-								$choices = json_decode( $field['choices'], true );
930
+								unset( $field_array[ 'id' ] );
931
+								$choices = json_decode( $field[ 'choices' ], true );
932 932
 								// assign a default choice
933
-								$default_value = ( isset( $field['default_choice'] ) && $field['default_choice'] != '' ) ? $field['default_choice'] : $choices[0];
933
+								$default_value = ( isset( $field[ 'default_choice' ] ) && $field[ 'default_choice' ] != '' ) ? $field[ 'default_choice' ] : $choices[ 0 ];
934 934
 								// if the form was submit, but failed, let's reset the post data
935
-								if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) {
936
-									$default_value = $_POST[$field['merge']];
935
+								if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) {
936
+									$default_value = $_POST[ $field[ 'merge' ] ];
937 937
 								}
938 938
 								$count = count( $choices );
939 939
 								$i = 1;
@@ -942,20 +942,20 @@  discard block
 block discarded – undo
942 942
 								// hidden labels
943 943
 
944 944
 									?>
945
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
945
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
946 946
 
947 947
 										<!-- dictate label visibility -->
948
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
949
-											<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?> checkbox-parent-label">
950
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
948
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
949
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?> checkbox-parent-label">
950
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
951 951
 											</span>
952 952
 										<?php }
953 953
 
954
-										foreach( $choices as $choice ) {
954
+										foreach ( $choices as $choice ) {
955 955
 											?>
956
-											<label for="<?php echo esc_attr( $field['merge'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $i === $count ) { ?> last-selection<?php } ?>" <?php if( $i == 1 ) { echo $field_array['required']; } ?>>
957
-												<input type="<?php echo esc_attr( $field['type'] ); ?>" name="<?php echo $field['merge']; ?>" id="<?php echo $field['merge'] . '-' . $i; ?>" <?php checked( $default_value , $x ); ?> value="<?php echo esc_attr( $choice ); ?>">
958
-												<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
956
+											<label for="<?php echo esc_attr( $field[ 'merge' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $i === $count ) { ?> last-selection<?php } ?>" <?php if ( $i == 1 ) { echo $field_array[ 'required' ]; } ?>>
957
+												<input type="<?php echo esc_attr( $field[ 'type' ] ); ?>" name="<?php echo $field[ 'merge' ]; ?>" id="<?php echo $field[ 'merge' ] . '-' . $i; ?>" <?php checked( $default_value, $x ); ?> value="<?php echo esc_attr( $choice ); ?>">
958
+												<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
959 959
 											</label>
960 960
 											<?php
961 961
 											$i++;
@@ -963,10 +963,10 @@  discard block
 block discarded – undo
963 963
 										}
964 964
 
965 965
 										// description
966
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
966
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
967 967
 											<p class="form-field-description">
968 968
 												<small>
969
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
969
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
970 970
 												</small>
971 971
 											</p>
972 972
 										<?php } ?>
@@ -982,26 +982,26 @@  discard block
 block discarded – undo
982 982
 
983 983
 
984 984
 						// store default choice
985
-						$default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : ( isset( $field['default_choice'] ) ? $field['default_choice'] : '' );
985
+						$default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : ( isset( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : '' );
986 986
 
987 987
 						// if the form was submit, but failed, let's reset the post data
988
-						if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
989
-							$default_choice = $_POST[$field['group_id']];
988
+						if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
989
+							$default_choice = $_POST[ $field[ 'group_id' ] ];
990 990
 						}
991 991
 
992 992
 						// get our groups
993
-						$groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( $field['groups'], true ) : array();
993
+						$groups = ( isset( $field[ 'groups' ] ) && ! empty( $field[ 'groups' ] ) ) ? json_decode( $field[ 'groups' ], true ) : array();
994 994
 
995 995
 						$count = count( $groups );
996 996
 
997
-						if( $field['type'] == 'checkboxes' ) {
997
+						if ( $field[ 'type' ] == 'checkboxes' ) {
998 998
 							$type = 'checkbox';
999
-						} else if( $field['type'] == 'radio' ) {
999
+						} else if ( $field[ 'type' ] == 'radio' ) {
1000 1000
 							$type = 'radio';
1001 1001
 						}
1002 1002
 
1003 1003
 						// loop over the interest group field types
1004
-						switch ( $field['type'] ) {
1004
+						switch ( $field[ 'type' ] ) {
1005 1005
 
1006 1006
 							case 'checkboxes':
1007 1007
 							case 'radio':
@@ -1009,18 +1009,18 @@  discard block
 block discarded – undo
1009 1009
 								$x = 1; // used to find the last item of our array
1010 1010
 
1011 1011
 									?>
1012
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1013
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1012
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1013
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1014 1014
 											<!-- dictate label visibility -->
1015
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label">
1016
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1015
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label">
1016
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
1017 1017
 											</span>
1018 1018
 									<?php
1019 1019
 										}
1020 1020
 
1021 1021
 										// Display Submission Errors
1022
-										if( ! empty( $missing_required_checkbox_interest_groups ) ) {
1023
-											if( in_array( $field['group_id'], $missing_required_checkbox_interest_groups ) ) {
1022
+										if ( ! empty( $missing_required_checkbox_interest_groups ) ) {
1023
+											if ( in_array( $field[ 'group_id' ], $missing_required_checkbox_interest_groups ) ) {
1024 1024
 												?>
1025 1025
 													<p class="yikes-mailchimp-required-interest-group-error">
1026 1026
 														<?php echo apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); ?>
@@ -1031,19 +1031,19 @@  discard block
 block discarded – undo
1031 1031
 
1032 1032
 
1033 1033
 
1034
-										foreach( $groups as $group ) {
1035
-											if( $field['type'] == 'checkboxes' ) {
1034
+										foreach ( $groups as $group ) {
1035
+											if ( $field[ 'type' ] == 'checkboxes' ) {
1036 1036
 												/* Setup the defaults for this field - varies if the field was previously submitted */
1037
-												if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
1038
-													$default_choice = $_POST[$field['group_id']];
1039
-												} elseif( ( ! isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted != 1 ) || ( isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted == 1 ) ) {
1040
-													$default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : array();
1037
+												if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
1038
+													$default_choice = $_POST[ $field[ 'group_id' ] ];
1039
+												} elseif ( ( ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 ) || ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 ) ) {
1040
+													$default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : array();
1041 1041
 												}
1042 1042
 											}
1043 1043
 											?>
1044
-											<label for="<?php echo $field['group_id'] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>">
1045
-												<input <?php if( isset( $field['require'] ) && $field['require'] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="<?php echo $field['group_id']; ?>[]" id="<?php echo $field['group_id'] . '-' . $i; ?>" <?php if( $field['type'] == 'checkboxes' ) { if( ( ( isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i , $default_choice )) || ! isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i , $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[$field['group_id']] ) ) && in_array( esc_attr( $group['name'] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[0] : $default_choice , $i ); } ?> value="<?php echo esc_attr( $group['name'] ); ?>">
1046
-												<?php echo $group['name']; ?>
1044
+											<label for="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>">
1045
+												<input <?php if ( isset( $field[ 'require' ] ) && $field[ 'require' ] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="<?php echo $field[ 'group_id' ]; ?>[]" id="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" <?php if ( $field[ 'type' ] == 'checkboxes' ) { if ( ( ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i, $default_choice ) ) || ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i, $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[ $field[ 'group_id' ] ] ) ) && in_array( esc_attr( $group[ 'name' ] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[ 0 ] : $default_choice, $i ); } ?> value="<?php echo esc_attr( $group[ 'name' ] ); ?>">
1046
+												<?php echo $group[ 'name' ]; ?>
1047 1047
 											</label>
1048 1048
 											<?php
1049 1049
 											$i++;
@@ -1051,10 +1051,10 @@  discard block
 block discarded – undo
1051 1051
 										}
1052 1052
 
1053 1053
 										// description
1054
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1054
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1055 1055
 											<p class="form-field-description">
1056 1056
 												<small>
1057
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1057
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1058 1058
 												</small>
1059 1059
 											</p>
1060 1060
 										<?php } ?>
@@ -1068,28 +1068,28 @@  discard block
 block discarded – undo
1068 1068
 
1069 1069
 									?>
1070 1070
 
1071
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1071
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1072 1072
 										<!-- dictate label visibility -->
1073
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1074
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>">
1075
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1073
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1074
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?>">
1075
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
1076 1076
 											</span>
1077 1077
 										<?php } ?>
1078 1078
 
1079
-										<select <?php echo implode( ' ' , $field_array ); ?>>
1079
+										<select <?php echo implode( ' ', $field_array ); ?>>
1080 1080
 											<?php
1081 1081
 												$i = 0;
1082
-												foreach( $groups as $group ) {
1083
-													?><option <?php selected( $i , $default_choice ); ?> value="<?php echo $group['name']; ?>"><?php echo esc_attr( $group['name'] ); ?></option><?php
1082
+												foreach ( $groups as $group ) {
1083
+													?><option <?php selected( $i, $default_choice ); ?> value="<?php echo $group[ 'name' ]; ?>"><?php echo esc_attr( $group[ 'name' ] ); ?></option><?php
1084 1084
 													$i++;
1085 1085
 												}
1086 1086
 											?>
1087 1087
 										</select>
1088 1088
 
1089
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1089
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1090 1090
 											<p class="form-field-description">
1091 1091
 												<small>
1092
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1092
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1093 1093
 												</small>
1094 1094
 											</p>
1095 1095
 										<?php } ?>
@@ -1106,21 +1106,21 @@  discard block
 block discarded – undo
1106 1106
 
1107 1107
 									?>
1108 1108
 
1109
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1109
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1110 1110
 
1111 1111
 										<!-- dictate label visibility -->
1112
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1113
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1114
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
1112
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1113
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1114
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
1115 1115
 											</span>
1116 1116
 										<?php }
1117 1117
 
1118 1118
 
1119
-										foreach( $groups as $group ) {
1119
+										foreach ( $groups as $group ) {
1120 1120
 											?>
1121
-											<label for="<?php echo $field['group_id'] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>" style="display:none;">
1122
-												<input type="radio" name="<?php echo $field['group_id']; ?>[]" id="<?php echo $field['group_id'] . '-' . $i; ?>" <?php if( $field['type'] == 'checkboxes' ) { if( in_array( $i , $default_choice ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[0] : $default_choice , $i ); } ?> value="<?php echo esc_attr( $group['name'] ); ?>">
1123
-												<?php echo esc_attr( stripslashes( str_replace( '' , '\'', $group['name'] ) ) ); ?>
1121
+											<label for="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>" style="display:none;">
1122
+												<input type="radio" name="<?php echo $field[ 'group_id' ]; ?>[]" id="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" <?php if ( $field[ 'type' ] == 'checkboxes' ) { if ( in_array( $i, $default_choice ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[ 0 ] : $default_choice, $i ); } ?> value="<?php echo esc_attr( $group[ 'name' ] ); ?>">
1123
+												<?php echo esc_attr( stripslashes( str_replace( '', '\'', $group[ 'name' ] ) ) ); ?>
1124 1124
 											</label>
1125 1125
 											<?php
1126 1126
 											$i++;
@@ -1128,10 +1128,10 @@  discard block
 block discarded – undo
1128 1128
 										}
1129 1129
 
1130 1130
 										// description
1131
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1131
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1132 1132
 											<p class="form-field-description">
1133 1133
 												<small>
1134
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
1134
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
1135 1135
 												</small>
1136 1136
 											</p>
1137 1137
 										<?php }
@@ -1148,11 +1148,11 @@  discard block
 block discarded – undo
1148 1148
 				do_action( 'yikes-mailchimp-additional-form-fields', $form_data );
1149 1149
 
1150 1150
 				/* if we've enabled reCAPTCHA protection */
1151
-				if( isset( $recaptcha_box ) ) {
1151
+				if ( isset( $recaptcha_box ) ) {
1152 1152
 					echo $recaptcha_box;
1153 1153
 				}
1154
-				if( is_user_logged_in() ) {
1155
-					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1154
+				if ( is_user_logged_in() ) {
1155
+					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1156 1156
 				} else {
1157 1157
 					$admin_class = '';
1158 1158
 				}
@@ -1162,27 +1162,27 @@  discard block
 block discarded – undo
1162 1162
 				<input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot" value="">
1163 1163
 
1164 1164
 				<!-- List ID -->
1165
-				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_settings['list_id']; ?>">
1165
+				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_settings[ 'list_id' ]; ?>">
1166 1166
 
1167 1167
 				<!-- Form that is being submitted! Used to display error/success messages above the correct form -->
1168 1168
 				<input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form" value="<?php echo $form_id; ?>">
1169 1169
 
1170 1170
 				<!-- Submit Button -->
1171 1171
 				<?php
1172
-					if( $form_inline ) {
1172
+					if ( $form_inline ) {
1173 1173
 						$submit_button_label_classes = array( 'empty-label' );
1174 1174
 						if ( $hidden_label ) {
1175
-							$submit_button_label_classes[] = 'labels-hidden';
1175
+							$submit_button_label_classes[ ] = 'labels-hidden';
1176 1176
 						}
1177 1177
 						echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="' . explode( ' ', $submit_button_label_classes ) . '">&nbsp;</span>';
1178 1178
 					}
1179 1179
 					// display the image or text based button
1180
-					if( $submit_button_type == 'text' ) {
1181
-						echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '">' .  apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '</button>', $form_data['id'] );
1180
+					if ( $submit_button_type == 'text' ) {
1181
+						echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data[ 'id' ] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data[ 'id' ] ) . '">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '</button>', $form_data[ 'id' ] );
1182 1182
 					} else {
1183
-						echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '">', $form_data['id'] );
1183
+						echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data[ 'id' ] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data[ 'id' ] ) . '">', $form_data[ 'id' ] );
1184 1184
 					}
1185
-					if( $form_inline ) {
1185
+					if ( $form_inline ) {
1186 1186
 						echo '</label>';
1187 1187
 					}
1188 1188
 				?>
@@ -1194,8 +1194,8 @@  discard block
 block discarded – undo
1194 1194
 
1195 1195
 		<?php
1196 1196
 			/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
1197
-			if( is_user_logged_in() ) {
1198
-				if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
1197
+			if ( is_user_logged_in() ) {
1198
+				if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
1199 1199
 					echo $edit_form_link;
1200 1200
 				}
1201 1201
 			}
@@ -1210,16 +1210,16 @@  discard block
 block discarded – undo
1210 1210
 		*	Update the impressions count
1211 1211
 		*	for non-admins
1212 1212
 		*/
1213
-		if( !current_user_can( 'manage_options' ) ) {
1214
-			$form_data['impressions']++;
1213
+		if ( ! current_user_can( 'manage_options' ) ) {
1214
+			$form_data[ 'impressions' ]++;
1215 1215
 			$wpdb->update(
1216 1216
 				$wpdb->prefix . 'yikes_easy_mc_forms',
1217 1217
 					array(
1218
-						'impressions' => $form_data['impressions'],
1218
+						'impressions' => $form_data[ 'impressions' ],
1219 1219
 					),
1220 1220
 					array( 'ID' => $form ),
1221 1221
 					array(
1222
-						'%d',	// send welcome email
1222
+						'%d', // send welcome email
1223 1223
 					),
1224 1224
 					array( '%d' )
1225 1225
 				);
Please login to merge, or discard this patch.
public/partials/shortcodes/process_form_shortcode_depracated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 		), $atts )
19 19
 	);
20 20
 	
21
-	return '<p><em>' . __( 'This MailChimp shortcode is now deprecated. Please insert the new shortcode to display this form.' , 'yikes-inc-easy-mailchimp-extender' ) . '</em></p>';
21
+	return '<p><em>' . __( 'This MailChimp shortcode is now deprecated. Please insert the new shortcode to display this form.', 'yikes-inc-easy-mailchimp-extender' ) . '</em></p>';
22 22
 	
23 23
 }
24 24
 add_shortcode( 'yks-mailchimp-list', 'process_depracated_mailchimp_shortcode' ); ?>
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
public/partials/shortcodes/process/process_form_submission_ajax.php 2 patches
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.
Spacing   +70 added lines, -70 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 110
 $api_key = yikes_get_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
 
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
  * Setup whether or not we should update the user, or display the error with email generation
148 148
  * @since 6.1
149 149
  */
150
-if ( isset( $optin_settings['update_existing_user'] ) && 1 === absint( $optin_settings['update_existing_user'] ) ) {
150
+if ( isset( $optin_settings[ 'update_existing_user' ] ) && 1 === absint( $optin_settings[ 'update_existing_user' ] ) ) {
151 151
 	// Should we send the update email
152
-	if ( isset( $optin_settings['send_update_email'] ) && 1 === absint( $optin_settings['send_update_email'] ) ) {
152
+	if ( isset( $optin_settings[ 'send_update_email' ] ) && 1 === absint( $optin_settings[ 'send_update_email' ] ) ) {
153 153
 		$update_existing_user = 0;
154 154
 	} else {
155 155
 		$update_existing_user = 1;
@@ -164,38 +164,38 @@  discard block
 block discarded – undo
164 164
 		'body' => apply_filters( 'yikes-mailchimp-user-subscribe-api-request', array(
165 165
 			'apikey' => $api_key,
166 166
 			'id' => $list_id,
167
-			'email' => array( 'email' => sanitize_email( $data['EMAIL'] ) ),
167
+			'email' => array( 'email' => sanitize_email( $data[ 'EMAIL' ] ) ),
168 168
 			'merge_vars' => $merge_variables,
169
-			'double_optin' => $optin_settings['optin'],
169
+			'double_optin' => $optin_settings[ 'optin' ],
170 170
 			'update_existing' => $update_existing_user, // Decide if we should update the user or not
171
-			'send_welcome' => $optin_settings['send_welcome_email'],
172
-			'replace_interests' => ( isset( $submission_settings['replace_interests'] ) ) ? $submission_settings['replace_interests'] : 1, // defaults to replace
173
-		), $form, $list_id, $data['EMAIL'] ),
171
+			'send_welcome' => $optin_settings[ 'send_welcome_email' ],
172
+			'replace_interests' => ( isset( $submission_settings[ 'replace_interests' ] ) ) ? $submission_settings[ 'replace_interests' ] : 1, // defaults to replace
173
+		), $form, $list_id, $data[ 'EMAIL' ] ),
174 174
 		'timeout' => 10,
175 175
 		'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
176 176
 	) );
177 177
 
178 178
 	$subscribe_response = json_decode( wp_remote_retrieve_body( $subscribe_response ), true );
179 179
 
180
-	if( isset( $subscribe_response['error'] ) ) {
180
+	if ( isset( $subscribe_response[ 'error' ] ) ) {
181 181
 
182
-		if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
182
+		if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
183 183
 			require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
184 184
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
185
-			$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" );
185
+			$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" );
186 186
 		}
187 187
 
188 188
 		$update_account_details_link = '';
189 189
 		$error = 1;
190
-		switch( $subscribe_response['code'] ) {
190
+		switch ( $subscribe_response[ 'code' ] ) {
191 191
 			// user already subscribed
192 192
 			case '214':
193
-				$custom_already_subscribed_text = 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>' ), $form, '<a class="send-update-email" data-list-id="' . $_POST['yikes-mailchimp-associated-list-id'] . '" data-user-email="' . sanitize_email( $data['EMAIL'] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );
194
-				$update_account_details_link = ( 1 === absint( $optin_settings['update_existing_user'] ) && 1 === absint( $optin_settings['send_update_email'] ) ) ? $custom_already_subscribed_text : false;
195
-				if( ! empty( $error_messages['already-subscribed'] ) ) {
196
-					$error_response = apply_filters( 'yikes-easy-mailchimp-user-already-subscribed-text', $error_messages['already-subscribed'] , $form, $data['EMAIL'] ) . ' ' . $update_account_details_link;
193
+				$custom_already_subscribed_text = 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>' ), $form, '<a class="send-update-email" data-list-id="' . $_POST[ 'yikes-mailchimp-associated-list-id' ] . '" data-user-email="' . sanitize_email( $data[ 'EMAIL' ] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );
194
+				$update_account_details_link = ( 1 === absint( $optin_settings[ 'update_existing_user' ] ) && 1 === absint( $optin_settings[ 'send_update_email' ] ) ) ? $custom_already_subscribed_text : false;
195
+				if ( ! empty( $error_messages[ 'already-subscribed' ] ) ) {
196
+					$error_response = apply_filters( 'yikes-easy-mailchimp-user-already-subscribed-text', $error_messages[ 'already-subscribed' ], $form, $data[ 'EMAIL' ] ) . ' ' . $update_account_details_link;
197 197
 				} else {
198
-					$error_response = $subscribe_response['error'] . ' ' . $update_account_details_link;
198
+					$error_response = $subscribe_response[ 'error' ] . ' ' . $update_account_details_link;
199 199
 				}
200 200
 				break;
201 201
 			// missing a required field
@@ -203,34 +203,34 @@  discard block
 block discarded – undo
203 203
 					// get all merge variables in array, loop and str_replace error code with field name
204 204
 					$api_key = yikes_get_mc_api_key();
205 205
 					$dash_position = strpos( $api_key, '-' );
206
-					if( $dash_position !== false ) {
206
+					if ( $dash_position !== false ) {
207 207
 						$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json';
208 208
 					}
209 209
 					$merge_variables = wp_remote_post( $api_endpoint, array(
210 210
 						'body' => array(
211 211
 							'apikey' => $api_key,
212
-							'id' => array( $list_id ) ,
212
+							'id' => array( $list_id ),
213 213
 						),
214 214
 						'timeout' => 10,
215 215
 						'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
216 216
 					) );
217 217
 					$merge_variables = json_decode( wp_remote_retrieve_body( $merge_variables ), true );
218
-					if( is_wp_error( $merge_variables ) || isset( $merge_variables['error'] ) ) {
219
-						if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
218
+					if ( is_wp_error( $merge_variables ) || isset( $merge_variables[ 'error' ] ) ) {
219
+						if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
220 220
 							require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
221 221
 							$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
222
-							$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" );
222
+							$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" );
223 223
 						}
224 224
 					}
225 225
 					// re-store our data
226
-					$merge_variables = $merge_variables['data'][0]['merge_vars'];
226
+					$merge_variables = $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ];
227 227
 					$merge_variable_name_array = array();
228
-					foreach( $merge_variables as $merge_var ) {
229
-						$merge_variables_name_array[$merge_var['tag']] = $merge_var['name'];
228
+					foreach ( $merge_variables as $merge_var ) {
229
+						$merge_variables_name_array[ $merge_var[ 'tag' ] ] = $merge_var[ 'name' ];
230 230
 					}
231
-					$error_message = $subscribe_response['error'];
231
+					$error_message = $subscribe_response[ 'error' ];
232 232
 					// replace tag with name in the error message.
233
-					foreach( $merge_variables_name_array as $tag => $name ) {
233
+					foreach ( $merge_variables_name_array as $tag => $name ) {
234 234
 						$error_message = str_replace( $tag, $name, $error_message );
235 235
 					}
236 236
 					$error_response = $error_message;
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
 			// [email protected] is not allowed
239 239
 			case '-99':
240 240
 				// generic error
241
-				$error_response = str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response['error'] ) );
241
+				$error_response = str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response[ 'error' ] ) );
242 242
 				break;
243 243
 			// invalid email (or no email at all)
244 244
 				case '-100':
245
-					$error_response = ( ! empty( $error_messages['invalid-email'] ) ) ? $error_messages['invalid-email'] : __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' );
245
+					$error_response = ( ! empty( $error_messages[ 'invalid-email' ] ) ) ? $error_messages[ 'invalid-email' ] : __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' );
246 246
 					break;
247 247
 			default:
248
-				$error_response = ( ! empty( $error_messages['general-error'] ) ) ? $error_messages['general-error'] : $subscribe_response['error'];
248
+				$error_response = ( ! empty( $error_messages[ 'general-error' ] ) ) ? $error_messages[ 'general-error' ] : $subscribe_response[ 'error' ];
249 249
 				break;
250 250
 		}
251 251
 		// send the response
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 	/*
264 264
 	*	Successful form submission redirect
265 265
 	*/
266
-	if( $submission_settings['redirect_on_submission'] == '1' ) {
266
+	if ( $submission_settings[ 'redirect_on_submission' ] == '1' ) {
267 267
 		$redirection = '1';
268
-		$redirect_url = ( 'custom_url' != $submission_settings['redirect_page'] ) ? get_permalink( $submission_settings['redirect_page'] ) : $submission_settings['custom_redirect_url'];
268
+		$redirect_url = ( 'custom_url' != $submission_settings[ 'redirect_page' ] ) ? get_permalink( $submission_settings[ 'redirect_page' ] ) : $submission_settings[ 'custom_redirect_url' ];
269 269
 		$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>';
270 270
 	}
271 271
 
@@ -281,16 +281,16 @@  discard block
 block discarded – undo
281 281
 	do_action( 'yikes-mailchimp-after-submission-' . $form, $merge_variables );
282 282
 
283 283
 	// send our notifications if setup (must go before wp_send_json())
284
-	do_action( 'yikes-mailchimp-form-submission' , sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications );
285
-	do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications );
284
+	do_action( 'yikes-mailchimp-form-submission', sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications );
285
+	do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications );
286 286
 
287
-	$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' );
287
+	$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' );
288 288
 
289 289
 	wp_send_json_success(
290 290
 		array(
291
-			'hide' => $submission_settings['hide_form_post_signup'],
291
+			'hide' => $submission_settings[ 'hide_form_post_signup' ],
292 292
 			'error' => $error,
293
-			'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages['success'] ) ? $error_messages['success'] : $default_success_response ), $form, $merge_variables ),
293
+			'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages[ 'success' ] ) ? $error_messages[ 'success' ] : $default_success_response ), $form, $merge_variables ),
294 294
 			'redirection' => isset( $redirection ) ? '1' : '0',
295 295
 			'redirect' => isset( $redirect ) ? $redirect : '',
296 296
 		)
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   +76 added lines, -76 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 107
 	$api_key = yikes_get_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
 
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
 	 * Setup whether or not we should update the user, or display the error with email generation
146 146
 	 * @since 6.1
147 147
 	 */
148
-	if ( isset( $form_settings['optin_settings']['update_existing_user'] ) && 1 === absint( $form_settings['optin_settings']['update_existing_user'] ) ) {
148
+	if ( isset( $form_settings[ 'optin_settings' ][ 'update_existing_user' ] ) && 1 === absint( $form_settings[ 'optin_settings' ][ 'update_existing_user' ] ) ) {
149 149
 		$update_existing_user = 1;
150 150
 		// Should we send the update email
151
-		if ( isset( $form_settings['optin_settings']['send_update_email'] ) && 1 === absint( $form_settings['optin_settings']['send_update_email'] ) ) {
151
+		if ( isset( $form_settings[ 'optin_settings' ][ 'send_update_email' ] ) && 1 === absint( $form_settings[ 'optin_settings' ][ 'send_update_email' ] ) ) {
152 152
 			$update_existing_user = 0;
153 153
 		}
154 154
 	} else {
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
 		$subscribe_response = wp_remote_post( $api_endpoint, array(
161 161
 			'body' => apply_filters( 'yikes-mailchimp-user-subscribe-api-request', array(
162 162
 				'apikey' => $api_key,
163
-				'id' => $_POST['yikes-mailchimp-associated-list-id'],
164
-				'email' => array( 'email' => sanitize_email( $_POST['EMAIL'] ) ),
163
+				'id' => $_POST[ 'yikes-mailchimp-associated-list-id' ],
164
+				'email' => array( 'email' => sanitize_email( $_POST[ 'EMAIL' ] ) ),
165 165
 				'merge_vars' => $merge_variables,
166
-				'double_optin' => $form_settings['optin_settings']['optin'],
166
+				'double_optin' => $form_settings[ 'optin_settings' ][ 'optin' ],
167 167
 				'update_existing' => $update_existing_user, // Decide if we should update the user or not
168
-				'send_welcome' => $form_settings['optin_settings']['send_welcome_email'],
169
-				'replace_interests' => ( isset( $form_settings['submission_settings']['replace_interests'] ) ) ? $form_settings['submission_settings']['replace_interests'] : 1, // defaults to replace
170
-			), $form_id, $_POST['yikes-mailchimp-associated-list-id'], $_POST['EMAIL'] ),
168
+				'send_welcome' => $form_settings[ 'optin_settings' ][ 'send_welcome_email' ],
169
+				'replace_interests' => ( isset( $form_settings[ 'submission_settings' ][ 'replace_interests' ] ) ) ? $form_settings[ 'submission_settings' ][ 'replace_interests' ] : 1, // defaults to replace
170
+			), $form_id, $_POST[ 'yikes-mailchimp-associated-list-id' ], $_POST[ 'EMAIL' ] ),
171 171
 			'timeout' => 10,
172 172
 			'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
173 173
 		) );
@@ -175,32 +175,32 @@  discard block
 block discarded – undo
175 175
 		$subscribe_response = json_decode( wp_remote_retrieve_body( $subscribe_response ), true );
176 176
 
177 177
 		// check for any errors
178
-		if( isset( $subscribe_response['error'] ) ) {
178
+		if ( isset( $subscribe_response[ 'error' ] ) ) {
179 179
 
180
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
180
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
181 181
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
182 182
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
183
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribe_response['error'], __( "Subscribe New User" , 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission.php" );
183
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribe_response[ 'error' ], __( "Subscribe New User", 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission.php" );
184 184
 			}
185 185
 
186 186
 			$update_account_details_link = '';
187
-			switch( $subscribe_response['code'] ) {
187
+			switch ( $subscribe_response[ 'code' ] ) {
188 188
 				// user already subscribed
189 189
 				case '214':
190
-					$custom_already_subscribed_text = 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>' ), $form_id, '<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>' );
191
-					$update_account_details_link = ( 1 === absint( $form_settings['optin_settings']['update_existing_user'] ) && 1 === absint( $form_settings['optin_settings']['send_update_email'] ) ) ? $custom_already_subscribed_text : false;
192
-					if( $update_account_details_link ) {
190
+					$custom_already_subscribed_text = 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>' ), $form_id, '<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>' );
191
+					$update_account_details_link = ( 1 === absint( $form_settings[ 'optin_settings' ][ 'update_existing_user' ] ) && 1 === absint( $form_settings[ 'optin_settings' ][ 'send_update_email' ] ) ) ? $custom_already_subscribed_text : false;
192
+					if ( $update_account_details_link ) {
193 193
 						// if update account details is set, we need to include our script to send out the update email
194
-						wp_enqueue_script( 'update-existing-subscriber.js', YIKES_MC_URL . 'public/js/yikes-update-existing-subscriber.js' , array( 'jquery' ), 'all' );
194
+						wp_enqueue_script( 'update-existing-subscriber.js', YIKES_MC_URL . 'public/js/yikes-update-existing-subscriber.js', array( 'jquery' ), 'all' );
195 195
 						wp_localize_script( 'update-existing-subscriber.js', 'update_subscriber_details_data', array(
196 196
 							'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
197 197
 							'preloader_url' => apply_filters( 'yikes-mailchimp-preloader', esc_url_raw( admin_url( 'images/wpspin_light.gif' ) ) ),
198 198
 						) );
199 199
 					}
200
-					if( ! empty( $form_settings['error_messages']['already-subscribed'] ) ) {
201
-						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . apply_filters( 'yikes-easy-mailchimp-user-already-subscribed-text', $form_settings['error_messages']['already-subscribed'], $form_id, $_POST['EMAIL'] ) . ' ' . $update_account_details_link . '</p>';
200
+					if ( ! empty( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) ) {
201
+						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . apply_filters( 'yikes-easy-mailchimp-user-already-subscribed-text', $form_settings[ 'error_messages' ][ 'already-subscribed' ], $form_id, $_POST[ 'EMAIL' ] ) . ' ' . $update_account_details_link . '</p>';
202 202
 					} else {
203
-						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $subscribe_response['error'] . ' ' . $update_account_details_link . '</p>';
203
+						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $subscribe_response[ 'error' ] . ' ' . $update_account_details_link . '</p>';
204 204
 					}
205 205
 					break;
206 206
 				// missing a required field
@@ -208,34 +208,34 @@  discard block
 block discarded – undo
208 208
 						// get all merge variables in array, loop and str_replace error code with field name
209 209
 						$api_key = yikes_get_mc_api_key();
210 210
 						$dash_position = strpos( $api_key, '-' );
211
-						if( $dash_position !== false ) {
211
+						if ( $dash_position !== false ) {
212 212
 							$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json';
213 213
 						}
214 214
 						$merge_variables = wp_remote_post( $api_endpoint, array(
215 215
 							'body' => array(
216 216
 								'apikey' => $api_key,
217
-								'id' => array( $_POST['yikes-mailchimp-associated-list-id'] ) ,
217
+								'id' => array( $_POST[ 'yikes-mailchimp-associated-list-id' ] ),
218 218
 							),
219 219
 							'timeout' => 10,
220 220
 							'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
221 221
 						) );
222 222
 						$merge_variables = json_decode( wp_remote_retrieve_body( $merge_variables ), true );
223
-						if( isset( $merge_variables['error'] ) ) {
224
-							if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
223
+						if ( isset( $merge_variables[ 'error' ] ) ) {
224
+							if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
225 225
 								require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
226 226
 								$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
227
-								$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission.php" );
227
+								$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission.php" );
228 228
 							}
229 229
 						}
230 230
 						// re-store our data
231
-						$merge_variables = $merge_variables['data'][0]['merge_vars'];
231
+						$merge_variables = $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ];
232 232
 						$merge_variable_name_array = array();
233
-						foreach( $merge_variables as $merge_var ) {
234
-							$merge_variables_name_array[$merge_var['tag']] = $merge_var['name'];
233
+						foreach ( $merge_variables as $merge_var ) {
234
+							$merge_variables_name_array[ $merge_var[ 'tag' ] ] = $merge_var[ 'name' ];
235 235
 						}
236
-						$error_message = $subscribe_response['error'];
236
+						$error_message = $subscribe_response[ 'error' ];
237 237
 						// replace tag with name in the error message.
238
-						foreach( $merge_variables_name_array as $tag => $name ) {
238
+						foreach ( $merge_variables_name_array as $tag => $name ) {
239 239
 							$error_message = str_replace( $tag, $name, $error_message );
240 240
 						}
241 241
 						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $error_message . '.</p>';
@@ -243,18 +243,18 @@  discard block
 block discarded – undo
243 243
 				// [email protected] is not allowed
244 244
 				case '-99':
245 245
 					// generic error
246
-					$process_submission_response = '<p class="yikes-easy-mc-error-message">' .  str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response['error'] ) ) . '</p>';
246
+					$process_submission_response = '<p class="yikes-easy-mc-error-message">' . str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response[ 'error' ] ) ) . '</p>';
247 247
 					break;
248 248
 				// invalid email (or no email at all)
249 249
 				case '-100':
250
-					$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>';
250
+					$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>';
251 251
 					break;
252 252
 				default:
253 253
 					// generic error
254
-					if( ! empty( $form_settings['error_messages']['general-error'] ) ) {
255
-						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $form_settings['error_messages']['general-error'] . '</p>';
254
+					if ( ! empty( $form_settings[ 'error_messages' ][ 'general-error' ] ) ) {
255
+						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $form_settings[ 'error_messages' ][ 'general-error' ] . '</p>';
256 256
 					} else {
257
-						$process_submission_response = '<p class="yikes-easy-mc-error-message">' .  $subscribe_response['error'] . '</p>';
257
+						$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $subscribe_response[ 'error' ] . '</p>';
258 258
 					}
259 259
 					break;
260 260
 			}
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 		$form_submitted = 1;
266 266
 
267 267
 		// Display the success message
268
-		if( ! empty( $form_settings['error_messages']['success'] ) ) {
269
-			$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>';
268
+		if ( ! empty( $form_settings[ 'error_messages' ][ 'success' ] ) ) {
269
+			$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>';
270 270
 			// echo stripslashes( esc_html( $error_messages['success'] ) );
271 271
 		} else {
272
-			$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' );
272
+			$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' );
273 273
 			$process_submission_response = '<p class="yikes-easy-mc-success-message">' . apply_filters( 'yikes-mailchimp-success-response', $default_success_response, $form_id, $merge_variables ) . '</p>';
274 274
 			// echo $default_success_response;
275 275
 		}
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 		* 	optional @form - the ID of the form to filter
283 283
 		*	@since 6.0.0
284 284
 		*/
285
-		do_action( 'yikes-mailchimp-after-submission' , $merge_variables );
286
-		do_action( 'yikes-mailchimp-after-submission-' . $form_id , $merge_variables );
285
+		do_action( 'yikes-mailchimp-after-submission', $merge_variables );
286
+		do_action( 'yikes-mailchimp-after-submission-' . $form_id, $merge_variables );
287 287
 
288 288
 		/*
289 289
 		*	Non-AJAX redirects now handled in class-yikes-inc-easy-mailchimp-extender-public.php
@@ -301,23 +301,23 @@  discard block
 block discarded – undo
301 301
 		*	@$notifications - the notification array
302 302
 		*	@since 6.0.0
303 303
 		*/
304
-		do_action( 'yikes-mailchimp-form-submission' , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] );
305
-		do_action( 'yikes-mailchimp-form-submission-' . $form_id , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] );
304
+		do_action( 'yikes-mailchimp-form-submission', $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] );
305
+		do_action( 'yikes-mailchimp-form-submission-' . $form_id, $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] );
306 306
 
307 307
 		/*
308 308
 		*	Increase the submission count for this form
309 309
 		*	on a successful submission
310 310
 		*	@since 6.0.0
311 311
 		*/
312
-		$form_settings['submissions']++;
312
+		$form_settings[ 'submissions' ]++;
313 313
 		$wpdb->update(
314 314
 			$wpdb->prefix . 'yikes_easy_mc_forms',
315 315
 			array(
316
-				'submissions' => $form_settings['submissions'],
316
+				'submissions' => $form_settings[ 'submissions' ],
317 317
 			),
318 318
 			array( 'ID' => $form_id ),
319 319
 			array(
320
-				'%d',	// send welcome email
320
+				'%d', // send welcome email
321 321
 			),
322 322
 			array( '%d' )
323 323
 		);
Please login to merge, or discard this patch.
public/partials/ajax/class.public_ajax.php 2 patches
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.
Spacing   +41 added lines, -41 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 74
 			$api_key = yikes_get_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.
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.