Completed
Pull Request — master (#607)
by Viktor
04:04
created
public/partials/shortcodes/process_form_shortcode.php 1 patch
Spacing   +298 added lines, -298 removed lines patch added patch discarded remove patch
@@ -30,54 +30,54 @@  discard block
 block discarded – undo
30 30
 	$form_submitted = isset( $form_submitted ) ? $form_submitted : 0;
31 31
 
32 32
 	/* If the user hasn't authenticated yet, lets kill off */
33
-	if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) {
34
-		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>';
33
+	if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) {
34
+		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>';
35 35
 	}
36 36
 
37 37
 	// if the user forgot to specify a form ID, lets kill of and warn them.
38
-	if( ! $atts['form'] ) {
38
+	if ( ! $atts[ 'form' ] ) {
39 39
 		return __( 'Whoops, it looks like you forgot to specify a form to display.', 'yikes-inc-easy-mailchimp-extender' );
40 40
 	}
41 41
 
42 42
 	// store our variables
43
-	$form_id = (int) $atts['form']; // form id (the id of the form in the database)
43
+	$form_id = (int) $atts[ 'form' ]; // form id (the id of the form in the database)
44 44
 	$interface = yikes_easy_mailchimp_extender_get_form_interface();
45 45
 	$form_data = $interface->get_form( $form_id );
46 46
 
47 47
 	// confirm we have some results, or return an error
48 48
 	if ( empty( $form_data ) ) {
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' );
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 ( $atts['recaptcha'] != '0' ) {
57
+		if ( $atts[ 'recaptcha' ] != '0' ) {
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 = ( ! empty( $locale_split ) ? $locale_split[0] : $locale );
75
-			$lang = ( ! empty( $atts['recaptcha_lang'] ) ) ? $atts['recaptcha_lang'] : $lang;
76
-			$type = ( ! empty( $atts['recaptcha_type'] ) ) ? strtolower( $atts['recaptcha_type'] ) : 'image'; // setup recaptcha type
77
-			$theme= ( ! empty( $atts['recaptcha_theme'] ) ) ? strtolower( $atts['recaptcha_theme'] ) : 'light'; // setup recaptcha theme
78
-			$size = ( ! empty( $atts['recaptcha_size'] ) ) ? strtolower( $atts['recaptcha_size'] ) : 'normal'; // setup recaptcha size
79
-			$data_callback = ( ! empty( $atts['recaptcha_data_callback'] ) ) ? $atts['recaptcha_data_callback'] : false; // setup recaptcha size
80
-			$expired_callback = ( ! empty( $atts['recaptcha_expired_callback'] ) ) ? $atts['recaptcha_expired_callback'] : false; // setup recaptcha size
74
+			$lang = ( ! empty( $locale_split ) ? $locale_split[ 0 ] : $locale );
75
+			$lang = ( ! empty( $atts[ 'recaptcha_lang' ] ) ) ? $atts[ 'recaptcha_lang' ] : $lang;
76
+			$type = ( ! empty( $atts[ 'recaptcha_type' ] ) ) ? strtolower( $atts[ 'recaptcha_type' ] ) : 'image'; // setup recaptcha type
77
+			$theme = ( ! empty( $atts[ 'recaptcha_theme' ] ) ) ? strtolower( $atts[ 'recaptcha_theme' ] ) : 'light'; // setup recaptcha theme
78
+			$size = ( ! empty( $atts[ 'recaptcha_size' ] ) ) ? strtolower( $atts[ 'recaptcha_size' ] ) : 'normal'; // setup recaptcha size
79
+			$data_callback = ( ! empty( $atts[ 'recaptcha_data_callback' ] ) ) ? $atts[ 'recaptcha_data_callback' ] : false; // setup recaptcha size
80
+			$expired_callback = ( ! empty( $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,
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 				'size' => $size,
87 87
 				'success_callback' => $data_callback,
88 88
 				'expired_callback' => $expired_callback,
89
-			), $atts['form'] );
89
+			), $atts[ '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,36 +118,36 @@  discard block
 block discarded – undo
118 118
 	}
119 119
 
120 120
 	// place our results into a seperate variable for easy looping
121
-	$additional_form_settings = ( isset( $form_data['form_settings'] ) ) ? $form_data['form_settings'] : false;
121
+	$additional_form_settings = ( isset( $form_data[ 'form_settings' ] ) ) ? $form_data[ 'form_settings' ] : false;
122 122
 	// store our options from the additional form settings array
123
-	$form_classes = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-class-names'] : '';
124
-	$inline_form = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-inline-form'] : '';
125
-	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-submit-button-type'] : 'text';
126
-	$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' );
127
-	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings['yikes-easy-mc-submit-button-image'] ) : '';
128
-	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-classes'] ) : '';
123
+	$form_classes = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-class-names' ] : '';
124
+	$inline_form = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-inline-form' ] : '';
125
+	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-submit-button-type' ] : 'text';
126
+	$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' );
127
+	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings[ 'yikes-easy-mc-submit-button-image' ] ) : '';
128
+	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-classes' ] ) : '';
129 129
 
130 130
 	// scheuldes
131
-	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-schedule'] : false;
132
-	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-start'] : '';;
133
-	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-end'] : '';
134
-	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-pending-message'] : '';
135
-	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-expired-message'] : '';
131
+	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-schedule' ] : false;
132
+	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-start' ] : ''; ;
133
+	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-end' ] : '';
134
+	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ] : '';
135
+	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ] : '';
136 136
 
137 137
 	// register required
138
-	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-login-required'] : false;
139
-	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-login-message'] : '';
138
+	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-login-required' ] : false;
139
+	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-login-message' ] : '';
140 140
 
141 141
 	// store number of fields
142
-	$field_count = (int) count( $form_data['fields'] );
142
+	$field_count = (int) count( $form_data[ 'fields' ] );
143 143
 
144 144
 	// confirm we actually have fields, before looping
145
-	if ( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) {
145
+	if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) {
146 146
 		// loop over each field, if it's set to hidden -- subtract it from the field count
147 147
 		// this throws off the layout for inline forms setup below
148
-		foreach ( $form_data['fields'] as $form_field ) {
148
+		foreach ( $form_data[ 'fields' ] as $form_field ) {
149 149
 			if ( isset( $form_field->hide ) && $form_field->hide == 1 ) {
150
-				$field_count --;
150
+				$field_count--;
151 151
 			}
152 152
 		}
153 153
 	}
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 	*	If login is required, abort
157 157
 	*	@since 6.0.3.8
158 158
 	*/
159
-	if( $form_login_required ) {
160
-		if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
159
+	if ( $form_login_required ) {
160
+		if ( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
161 161
 			ob_start();
162 162
 				?>
163 163
 					<div class="yikes-mailchimp-login-required yikes-mailchimp-form-<?php echo $form_id; ?>-login-required">
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
 	*	Check if schedule is set for this form
174 174
 	*	@since 6.0.3.8
175 175
 	*/
176
-	if( $form_schedule_state ) {
176
+	if ( $form_schedule_state ) {
177 177
 		// store current date
178 178
 		$current_date = strtotime( current_time( 'm/d/Y g:iA' ) );
179 179
 
180 180
 		// the the current date is less than the form scheduled start date
181
-		if( $current_date < $form_schedule_start ) {
181
+		if ( $current_date < $form_schedule_start ) {
182 182
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_pending_message );
183 183
 			return;
184 184
 			// abort
185 185
 		}
186 186
 
187 187
 		// The current date is past or equal to the end date, aka form has now expired
188
-		if( $current_date >= $form_schedule_end ) {
188
+		if ( $current_date >= $form_schedule_end ) {
189 189
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_expired_message );
190 190
 			return;
191 191
 			// abort
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 
195 195
 	// setup the submit button text
196 196
 	// shortcode parameter takes precedence over option
197
-	$submit = ( ! empty( $atts['submit'] ) ) ? $atts['submit'] : $submit_button_text;
197
+	$submit = ( ! empty( $atts[ 'submit' ] ) ) ? $atts[ 'submit' ] : $submit_button_text;
198 198
 
199 199
 	// used in yikes-mailchimp-redirect-url filter
200 200
 	global $post;
201 201
 	$page_data = $post;
202 202
 
203 203
 	// Remove the post_password from this for security
204
-	if( isset( $page_data->post_password ) ) {
204
+	if ( isset( $page_data->post_password ) ) {
205 205
 		unset( $page_data->post_password );
206 206
 	}
207 207
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	*	to exclude styles from loading, add `define( 'YIKES_MAILCHIMP_EXCLUDE_STYLES', true );` to functions.php
216 216
 	*	@since 6.0.3.8
217 217
 	*/
218
-	if( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
218
+	if ( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
219 219
 		// enqueue the form styles
220 220
 		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 ) );
221 221
 	}
@@ -223,19 +223,19 @@  discard block
 block discarded – undo
223 223
 	/**
224 224
 	*	Check for form inline parameter
225 225
 	*/
226
-	$form_inline = ( $atts['inline'] == 1 || $atts['inline'] == 'true' );
226
+	$form_inline = ( $atts[ 'inline' ] == 1 || $atts[ 'inline' ] == 'true' );
227 227
 	// recheck from our form options
228 228
 	if ( ! $form_inline ) {
229
-		$form_inline = (bool) $additional_form_settings['yikes-easy-mc-inline-form'];
229
+		$form_inline = (bool) $additional_form_settings[ 'yikes-easy-mc-inline-form' ];
230 230
 	}
231 231
 
232 232
 	/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
233
-	if( is_user_logged_in() ) {
234
-		if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
233
+	if ( is_user_logged_in() ) {
234
+		if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
235 235
 			$edit_form_link = '<span class="edit-link">';
236
-			$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts['form'] ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
236
+			$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts[ 'form' ] ) ) . '" title="' . __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data[ 'form_name' ] ) . '">' . __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
237 237
 			$edit_form_link .= '</span>';
238
-			$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts['form'], ucwords( $form_data['form_name'] ) );
238
+			$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts[ 'form' ], ucwords( $form_data[ 'form_name' ] ) );
239 239
 		} else {
240 240
 			$edit_form_link = '';
241 241
 		}
@@ -245,16 +245,16 @@  discard block
 block discarded – undo
245 245
 	// or else MailChimp throws errors at you
246 246
 	// extract our array keys
247 247
 	// @todo Remove array_keys() and in_array() usage here.
248
-	if( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) {
249
-		$array_keys = array_keys( $form_data['fields'] );
248
+	if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) {
249
+		$array_keys = array_keys( $form_data[ 'fields' ] );
250 250
 		// check for EMAIL in that array
251
-		if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) {
252
-			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>';
251
+		if ( ! in_array( 'EMAIL', $array_keys ) && ! in_array( 'email', $array_keys ) ) {
252
+			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>';
253 253
 		}
254 254
 	} else {
255
-		$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
256
-		if( is_user_logged_in() ) {
257
-			if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
255
+		$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
256
+		if ( is_user_logged_in() ) {
257
+			if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
258 258
 				return $error . $edit_form_link;
259 259
 			}
260 260
 		} else {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 		}
263 263
 	}
264 264
 
265
-	if( $form_inline ) {
265
+	if ( $form_inline ) {
266 266
 		$field_width = (float) ( 100 / $field_count );
267 267
 		$submit_button_width = (float) ( 20 / $field_count );
268 268
 		/*
@@ -299,17 +299,17 @@  discard block
 block discarded – undo
299 299
 		*	Set a custom title using custom_title="lorem ipsum" parameter in the shortcode
300 300
 		*	- This takes precedence over the title set
301 301
 		*/
302
-		if ( $atts['title'] ) {
303
-			if ( ! empty( $atts['custom_title'] ) ) {
302
+		if ( $atts[ 'title' ] ) {
303
+			if ( ! empty( $atts[ 'custom_title' ] ) ) {
304 304
 				/**
305 305
 				 * Filter the title that is displayed through the shortcode.
306 306
 				 *
307 307
 				 * @param string $title   The title to display.
308 308
 				 * @param int    $form_id The form ID.
309 309
 				 */
310
-				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts['custom_title'] ), $form_id );
310
+				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts[ 'custom_title' ] ), $form_id );
311 311
 			} else {
312
-				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data['form_name'] ), $form_id );
312
+				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data[ 'form_name' ] ), $form_id );
313 313
 			}
314 314
 
315 315
 			echo sprintf( '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-%1$s">%2$s</h3>', $form_id, $title );
@@ -319,26 +319,26 @@  discard block
 block discarded – undo
319 319
 		*	Allow users to specify a custom description for this form, no html support
320 320
 		*	@since 6.0.3.8
321 321
 		*/
322
-		if ( $atts['description'] ) {
323
-			if ( ! empty( $atts['custom_description'] ) ) {
322
+		if ( $atts[ 'description' ] ) {
323
+			if ( ! empty( $atts[ 'custom_description' ] ) ) {
324 324
 				/**
325 325
 				 * Filter the description that is displayed through the shortcode.
326 326
 				 *
327 327
 				 * @param string $title   The title to display.
328 328
 				 * @param int    $form_id The form ID.
329 329
 				 */
330
-				$description = apply_filters( 'yikes-mailchimp-form-description', $atts['custom_description'], $form_id );
330
+				$description = apply_filters( 'yikes-mailchimp-form-description', $atts[ 'custom_description' ], $form_id );
331 331
 			} else {
332
-				$description = apply_filters( 'yikes-mailchimp-form-description', $form_data['form_description'], $form_id );
332
+				$description = apply_filters( 'yikes-mailchimp-form-description', $form_data[ 'form_description' ], $form_id );
333 333
 			}
334 334
 
335 335
 			echo sprintf( '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-%1$s">%2$s</section>', $form_id, $description );
336 336
 		}
337 337
 
338 338
 		// Check for AJAX
339
-		if( ( ! empty( $atts['ajax'] ) && $atts['ajax'] == 1 ) || $form_data['submission_settings']['ajax'] == 1 ) {
339
+		if ( ( ! empty( $atts[ 'ajax' ] ) && $atts[ 'ajax' ] == 1 ) || $form_data[ 'submission_settings' ][ 'ajax' ] == 1 ) {
340 340
 			// enqueue our ajax script
341
-			wp_enqueue_script( 'yikes-easy-mc-ajax' , YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js' , array( 'jquery' ) , YIKES_MC_VERSION, false );
341
+			wp_enqueue_script( 'yikes-easy-mc-ajax', YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js', array( 'jquery' ), YIKES_MC_VERSION, false );
342 342
 			wp_localize_script( 'yikes-easy-mc-ajax', 'yikes_mailchimp_ajax', array(
343 343
 				'ajax_url'                      => esc_url( admin_url( 'admin-ajax.php' ) ),
344 344
 				'page_data'                     => $page_data,
@@ -357,67 +357,67 @@  discard block
 block discarded – undo
357 357
 
358 358
 		// render the form!
359 359
 		?>
360
-			<form id="<?php echo sanitize_title( $form_data['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_data['submission_settings']['hide_form_post_signup'] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>">
360
+			<form id="<?php echo sanitize_title( $form_data[ '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_data[ '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 361
 
362 362
 				<?php
363 363
 				// Set a default constant for hidden fields
364 364
 				$hidden_label_count = 0;
365 365
 
366 366
 				// Loop over our form fields
367
-				foreach( $form_data['fields'] as $field ) {
367
+				foreach ( $form_data[ 'fields' ] as $field ) {
368 368
 						// input array
369 369
 						$field_array = array();
370 370
 						// label array
371 371
 						$label_array = array();
372 372
 						// label classes array
373 373
 						$label_class_array = array();
374
-						if( $field['additional-classes'] != '' ) {
374
+						if ( $field[ 'additional-classes' ] != '' ) {
375 375
 							// split custom classes at spaces
376
-							$custom_classes = explode( ' ' , $field['additional-classes'] );
376
+							$custom_classes = explode( ' ', $field[ 'additional-classes' ] );
377 377
 							// check our custom class array for field-left/field-right
378 378
 							// if it's set we need to assign it to our label and remove it from the field classes
379 379
 							 // input half left
380
-							if( in_array( 'field-left-half' , $custom_classes ) ) {
380
+							if ( in_array( 'field-left-half', $custom_classes ) ) {
381 381
 								// $label_array['class'] = 'class="field-left-half"';
382
-								$label_class_array[] = 'field-left-half';
383
-								$key = array_search( 'field-left-half' , $custom_classes );
384
-								unset( $custom_classes[$key] );
382
+								$label_class_array[ ] = 'field-left-half';
383
+								$key = array_search( 'field-left-half', $custom_classes );
384
+								unset( $custom_classes[ $key ] );
385 385
 							} // input half right
386
-							if( in_array( 'field-right-half' , $custom_classes ) ) {
386
+							if ( in_array( 'field-right-half', $custom_classes ) ) {
387 387
 								// $label_array['class'] = 'class="field-right-half"';
388
-								$label_class_array[] = 'field-right-half';
389
-								$key = array_search( 'field-right-half' , $custom_classes );
390
-								unset( $custom_classes[$key] );
388
+								$label_class_array[ ] = 'field-right-half';
389
+								$key = array_search( 'field-right-half', $custom_classes );
390
+								unset( $custom_classes[ $key ] );
391 391
 							} // input thirds (1/3 width, floated left)
392
-							if( in_array( 'field-third' , $custom_classes ) ) {
392
+							if ( in_array( 'field-third', $custom_classes ) ) {
393 393
 								// $label_array['class'] = 'class="field-third"';
394
-								$label_class_array[] = 'field-third';
395
-								$key = array_search( 'field-third' , $custom_classes );
396
-								unset( $custom_classes[$key] );
394
+								$label_class_array[ ] = 'field-third';
395
+								$key = array_search( 'field-third', $custom_classes );
396
+								unset( $custom_classes[ $key ] );
397 397
 							} // 2 column radio
398
-							if( in_array( 'option-2-col' , $custom_classes ) ) {
398
+							if ( in_array( 'option-2-col', $custom_classes ) ) {
399 399
 								// $label_array['class'] = 'class="option-2-col"';
400
-								$label_class_array[] = 'option-2-col';
401
-								$key = array_search( 'option-2-col' , $custom_classes );
402
-								unset( $custom_classes[$key] );
400
+								$label_class_array[ ] = 'option-2-col';
401
+								$key = array_search( 'option-2-col', $custom_classes );
402
+								unset( $custom_classes[ $key ] );
403 403
 							} // 3 column radio
404
-							if( in_array( 'option-3-col' , $custom_classes ) ) {
404
+							if ( in_array( 'option-3-col', $custom_classes ) ) {
405 405
 								// $label_array['class'] = 'class="option-3-col"';
406
-								$label_class_array[] = 'option-3-col';
407
-								$key = array_search( 'option-3-col' , $custom_classes );
408
-								unset( $custom_classes[$key] );
406
+								$label_class_array[ ] = 'option-3-col';
407
+								$key = array_search( 'option-3-col', $custom_classes );
408
+								unset( $custom_classes[ $key ] );
409 409
 							} // 4 column radio
410
-							if( in_array( 'option-4-col' , $custom_classes ) ) {
410
+							if ( in_array( 'option-4-col', $custom_classes ) ) {
411 411
 								// $label_array['class'] = 'class="option-4-col"';
412
-								$label_class_array[] = 'option-4-col';
413
-								$key = array_search( 'option-4-col' , $custom_classes );
414
-								unset( $custom_classes[$key] );
412
+								$label_class_array[ ] = 'option-4-col';
413
+								$key = array_search( 'option-4-col', $custom_classes );
414
+								unset( $custom_classes[ $key ] );
415 415
 							} // inline radio & checkboxes etc
416
-							if( in_array( 'option-inline' , $custom_classes ) ) {
416
+							if ( in_array( 'option-inline', $custom_classes ) ) {
417 417
 								// $label_array['class'] = 'class="option-inline"';
418
-								$label_class_array[] = 'option-inline';
419
-								$key = array_search( 'option-inline' , $custom_classes );
420
-								unset( $custom_classes[$key] );
418
+								$label_class_array[ ] = 'option-inline';
419
+								$key = array_search( 'option-inline', $custom_classes );
420
+								unset( $custom_classes[ $key ] );
421 421
 							}
422 422
 						} else {
423 423
 							$custom_classes = array();
@@ -425,68 +425,68 @@  discard block
 block discarded – undo
425 425
 
426 426
 						// if the form is set to inline, add the inline class to our labels
427 427
 						// since @6.0.3.8
428
-						if( $form_inline ) {
429
-							$label_class_array[] = 'label-inline';
428
+						if ( $form_inline ) {
429
+							$label_class_array[ ] = 'label-inline';
430 430
 						}
431 431
 
432
-						if( isset( $field['hide-label'] ) ) {
433
-							if( absint( $field['hide-label'] ) === 1 ) {
432
+						if ( isset( $field[ 'hide-label' ] ) ) {
433
+							if ( absint( $field[ 'hide-label' ] ) === 1 ) {
434 434
 								$hidden_label_count++;
435
-								$custom_classes[] = 'field-no-label';
435
+								$custom_classes[ ] = 'field-no-label';
436 436
 							}
437 437
 						}
438 438
 
439 439
 					/* Store tag variable based on field type */
440
-					if( isset( $field['merge'] ) ) {
440
+					if ( isset( $field[ 'merge' ] ) ) {
441 441
 						$tag = 'merge';
442 442
 					} else {
443 443
 						$tag = 'group_id';
444 444
 					}
445 445
 
446 446
 					// build up our array
447
-					$field_array['id'] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[$tag] ) . '" ';
448
-					$field_array['name'] = 'name="' . esc_attr( $field[$tag] ) . '" ';
449
-					$field_array['placeholder'] = isset( $field['placeholder'] ) ? 'placeholder="' . esc_attr( stripslashes( $field['placeholder'] ) ) . '" ' : '';
450
-					$field_array['classes'] = 'class="yikes-easy-mc-'.$field['type'] . ' ' .  esc_attr( trim( implode( ' ' , $custom_classes ) ) ) . '" ';
447
+					$field_array[ 'id' ] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[ $tag ] ) . '" ';
448
+					$field_array[ 'name' ] = 'name="' . esc_attr( $field[ $tag ] ) . '" ';
449
+					$field_array[ 'placeholder' ] = isset( $field[ 'placeholder' ] ) ? 'placeholder="' . esc_attr( stripslashes( $field[ 'placeholder' ] ) ) . '" ' : '';
450
+					$field_array[ 'classes' ] = 'class="yikes-easy-mc-' . $field[ 'type' ] . ' ' . esc_attr( trim( implode( ' ', $custom_classes ) ) ) . '" ';
451 451
 
452 452
 					// email must always be required and visible
453
-					if( $field['type'] == 'email' ) {
454
-						$field_array['required'] = 'required="required"';
455
-						$label_array['visible'] = '';
453
+					if ( $field[ 'type' ] == 'email' ) {
454
+						$field_array[ 'required' ] = 'required="required"';
455
+						$label_array[ 'visible' ] = '';
456 456
 						// $label_array['required'] = 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"';
457
-						$label_class_array[] = $field['merge'] . '-label';
458
-						$label_class_array[] = 'yikes-mailchimp-field-required';
457
+						$label_class_array[ ] = $field[ 'merge' ] . '-label';
458
+						$label_class_array[ ] = 'yikes-mailchimp-field-required';
459 459
 					} else {
460
-						if( $tag == 'merge' ) {
461
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
462
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
460
+						if ( $tag == 'merge' ) {
461
+							$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
462
+							$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
463 463
 							// $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['merge'] . '-label"';
464
-							$label_class_array[] = isset( $field['require'] ) ? $field['merge'] . '-label yikes-mailchimp-field-required' : $field['merge'] . '-label';
464
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'merge' ] . '-label yikes-mailchimp-field-required' : $field[ 'merge' ] . '-label';
465 465
 						} else {
466
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
467
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
466
+							$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
467
+							$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
468 468
 							// $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['group_id'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['group_id'] . '-label"';
469
-							$label_class_array[] = isset( $field['require'] ) ? $field['group_id'] . '-label yikes-mailchimp-field-required' : $field['group_id'] . '-label';
469
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'group_id' ] . '-label yikes-mailchimp-field-required' : $field[ 'group_id' ] . '-label';
470 470
 						}
471 471
 					}
472 472
 
473 473
 					// if both hide label and hide field are checked, we gotta hide the field!
474
-					if( isset( $field['hide' ] ) && $field['hide'] == 1 ) {
475
-						if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) {
476
-							$field_array['visible'] = 'style="display:none;"';
474
+					if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) {
475
+						if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) {
476
+							$field_array[ 'visible' ] = 'style="display:none;"';
477 477
 						}
478 478
 					}
479 479
 
480
-					$label_array['classes'] = 'class="' . implode( ' ', $label_class_array ) . '"';
480
+					$label_array[ 'classes' ] = 'class="' . implode( ' ', $label_class_array ) . '"';
481 481
 
482 482
 					// filter the field array data
483 483
 					$field_array = apply_filters( 'yikes-mailchimp-field-data', $field_array, $field, $form_id );
484 484
 
485 485
 					/* Loop Over Standard Fields (aka merge variables) */
486
-					if( isset( $field['merge'] ) ) {
486
+					if ( isset( $field[ 'merge' ] ) ) {
487 487
 
488 488
 						// loop over our fields by Type
489
-						switch ( $field['type'] ) {
489
+						switch ( $field[ 'type' ] ) {
490 490
 
491 491
 							default:
492 492
 							case 'email':
@@ -494,25 +494,25 @@  discard block
 block discarded – undo
494 494
 							case 'number':
495 495
 
496 496
 								// pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type)
497
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
497
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
498 498
 								$default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value );
499 499
 									?>
500
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
500
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
501 501
 
502 502
 										<!-- dictate label visibility -->
503
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
504
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
505
-												<?php if( ! isset( $field['hide-label'] ) ) { echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ), $form_id ); } ?>
503
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
504
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
505
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ), $form_id ); } ?>
506 506
 											</span>
507 507
 										<?php } ?>
508 508
 
509
-										<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
+										<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 ); } ?>">
510 510
 
511 511
 										<!-- description -->
512
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
512
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
513 513
 											<p class="form-field-description">
514 514
 												<small>
515
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
515
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
516 516
 												</small>
517 517
 											</p>
518 518
 										<?php } ?>
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 
525 525
 							case 'url':
526 526
 							case 'imageurl':
527
-								$default_value = ( isset( $field['default'] ) ) ? $field['default'] : '';
527
+								$default_value = ( isset( $field[ 'default' ] ) ) ? $field[ 'default' ] : '';
528 528
 									?>
529 529
 
530 530
 									<script type="text/javascript">
@@ -536,22 +536,22 @@  discard block
 block discarded – undo
536 536
 										}
537 537
 									</script>
538 538
 
539
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
539
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
540 540
 
541 541
 										<!-- dictate label visibility -->
542
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
543
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
544
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
542
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
543
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
544
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
545 545
 											</span>
546 546
 										<?php } ?>
547 547
 
548
-										<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
+										<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;">
549 549
 
550 550
 										<!-- description -->
551
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
551
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
552 552
 											<p class="form-field-description">
553 553
 												<small>
554
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
554
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
555 555
 												</small>
556 556
 											</p>
557 557
 										<?php } ?>
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 							break;
563 563
 
564 564
 							case 'phone':
565
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
566
-								$phone_format = $field['phone_format'];
565
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
566
+								$phone_format = $field[ 'phone_format' ];
567 567
 								?>
568 568
 									<script type="text/javascript">
569 569
 										/* Replace incorrect values and format it correctly for MailChimp API */
@@ -576,22 +576,22 @@  discard block
 block discarded – undo
576 576
 										}
577 577
 									</script>
578 578
 
579
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
579
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
580 580
 
581 581
 										<!-- dictate label visibility -->
582
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
583
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
584
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
582
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
583
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
584
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
585 585
 											</span>
586 586
 										<?php } ?>
587 587
 
588
-										<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
+										<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 ); } ?>">
589 589
 
590 590
 										<!-- description -->
591
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
591
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
592 592
 											<p class="form-field-description">
593 593
 												<small>
594
-													<?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field['merge'] ) . '-description', stripslashes( $field['description'] ), $form_id ); ?>
594
+													<?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field[ 'merge' ] ) . '-description', stripslashes( $field[ 'description' ] ), $form_id ); ?>
595 595
 												</small>
596 596
 											</p>
597 597
 										<?php } ?>
@@ -601,25 +601,25 @@  discard block
 block discarded – undo
601 601
 							break;
602 602
 
603 603
 							case 'zip':
604
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
604
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
605 605
 
606 606
 									?>
607
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
607
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
608 608
 
609 609
 									<!-- dictate label visibility -->
610
-									<?php if( ! isset( $field['hide-label'] ) ) { ?>
611
-										<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
612
-											<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
610
+									<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
611
+										<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
612
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
613 613
 										</span>
614 614
 									<?php } ?>
615 615
 
616
-									<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
+									<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 ); } ?>">
617 617
 
618 618
 									<!-- description -->
619
-									<?php if( isset( $field['description'] ) ) { ?>
619
+									<?php if ( isset( $field[ 'description' ] ) ) { ?>
620 620
 										<p class="form-field-description">
621 621
 											<small>
622
-												<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
622
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
623 623
 											</small>
624 624
 										</p>
625 625
 									<?php } ?>
@@ -631,28 +631,28 @@  discard block
 block discarded – undo
631 631
 
632 632
 							case 'address':
633 633
 								// required fields
634
-								$required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' );
634
+								$required_fields = array( 'addr1' => 'address', 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip', 'country' => 'country' );
635 635
 
636 636
 								// setup the default country value
637 637
 								$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
638 638
 
639 639
 								// store number for looping
640 640
 								$x = 1;
641
-								foreach( $required_fields as $type => $label ) {
641
+								foreach ( $required_fields as $type => $label ) {
642 642
 
643 643
 									// set the field names for the addrress fields
644
-									$field_array['name'] = 'name="'.$field[$tag].'['.$type.']'.'"';
644
+									$field_array[ 'name' ] = 'name="' . $field[ $tag ] . '[' . $type . ']' . '"';
645 645
 
646 646
 									// reset the label classes for left-half/right-half for addresses
647
-									if( isset( $label_array['class'] ) ) {
647
+									if ( isset( $label_array[ 'class' ] ) ) {
648 648
 										if ( $x % 2 == 0 ) {
649
-											$label_array['class'] = str_replace( 'field-left-half', 'field-right-half', $label_array['class'] );
649
+											$label_array[ 'class' ] = str_replace( 'field-left-half', 'field-right-half', $label_array[ 'class' ] );
650 650
 										} else {
651
-											$label_array['class'] = str_replace( 'field-right-half', 'field-left-half', $label_array['class'] );
651
+											$label_array[ 'class' ] = str_replace( 'field-right-half', 'field-left-half', $label_array[ 'class' ] );
652 652
 										}
653 653
 									}
654 654
 
655
-									switch( $type ) {
655
+									switch ( $type ) {
656 656
 
657 657
 										default:
658 658
 										case 'addr1':
@@ -661,17 +661,17 @@  discard block
 block discarded – undo
661 661
 
662 662
 
663 663
 											?>
664
-											<label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
664
+											<label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>>
665 665
 
666 666
 												<!-- dictate label visibility -->
667
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
668
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
669
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
667
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
668
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
669
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
670 670
 													</span>
671 671
 												<?php } ?>
672 672
 
673 673
 
674
-												<input <?php echo implode( ' ' , $field_array ); ?> type="text"  value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } ?>">
674
+												<input <?php echo implode( ' ', $field_array ); ?> type="text"  value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } ?>">
675 675
 
676 676
 											</label>
677 677
 											<?php
@@ -681,16 +681,16 @@  discard block
 block discarded – undo
681 681
 										case 'state':
682 682
 
683 683
 											?>
684
-											<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
+											<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 } ?>>
685 685
 
686 686
 												<!-- dictate label visibility -->
687
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
688
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
689
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
687
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
688
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
689
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
690 690
 													</span>
691 691
 												<?php } ?>
692 692
 
693
-												<select <?php echo implode( ' ' , $field_array ); ?>>
693
+												<select <?php echo implode( ' ', $field_array ); ?>>
694 694
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-dropdown.php' ); ?>
695 695
 												</select>
696 696
 
@@ -703,15 +703,15 @@  discard block
 block discarded – undo
703 703
 										case 'zip':
704 704
 
705 705
 											?>
706
-											<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
+											<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 } ?>>
707 707
 
708
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
709
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
710
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
708
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
709
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
710
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
711 711
 													</span>
712 712
 												<?php } ?>
713 713
 
714
-												<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
+												<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 ); } ?>">
715 715
 
716 716
 											</label>
717 717
 											<?php
@@ -749,16 +749,16 @@  discard block
 block discarded – undo
749 749
 												$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
750 750
 											?>
751 751
 
752
-											<label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
752
+											<label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>>
753 753
 
754 754
 												<!-- dictate label visibility -->
755
-												<?php if( !isset( $field['hide-label'] ) ) { ?>
756
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
757
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
755
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
756
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
757
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
758 758
 													</span>
759 759
 												<?php } ?>
760 760
 
761
-												<select <?php echo implode( ' ' , $field_array ); ?> onchange="checkCountry(this);return false;">
761
+												<select <?php echo implode( ' ', $field_array ); ?> onchange="checkCountry(this);return false;">
762 762
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/country-dropdown.php' ); ?>
763 763
 												</select>
764 764
 											</label>
@@ -769,10 +769,10 @@  discard block
 block discarded – undo
769 769
 								}
770 770
 
771 771
 								// description
772
-								if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
772
+								if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
773 773
 									<p class="form-field-description">
774 774
 										<small>
775
-											<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
775
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
776 776
 										</small>
777 777
 									</p>
778 778
 									<?php }
@@ -782,19 +782,19 @@  discard block
 block discarded – undo
782 782
 							case 'birthday':
783 783
 
784 784
 								// bootstrap datepicker requirements
785
-								wp_enqueue_script( 'bootstrap-hover-dropdown' , YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js' , array( 'jquery' ) );
786
-								wp_enqueue_script( 'bootstrap-datepicker-script' , YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js' , array( 'jquery' , 'bootstrap-hover-dropdown' ) );
787
-								wp_enqueue_style( 'bootstrap-datepicker-styles' , YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
788
-								wp_enqueue_style( 'override-datepicker-styles' , YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css' , array( 'bootstrap-datepicker-styles' ) );
785
+								wp_enqueue_script( 'bootstrap-hover-dropdown', YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js', array( 'jquery' ) );
786
+								wp_enqueue_script( 'bootstrap-datepicker-script', YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js', array( 'jquery', 'bootstrap-hover-dropdown' ) );
787
+								wp_enqueue_style( 'bootstrap-datepicker-styles', YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
788
+								wp_enqueue_style( 'override-datepicker-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css', array( 'bootstrap-datepicker-styles' ) );
789 789
 
790
-								switch ( $field['type'] ) {
790
+								switch ( $field[ 'type' ] ) {
791 791
 									default:
792 792
 									case 'date':
793
-										$date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd/yy';
793
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd/yy';
794 794
 										break;
795 795
 
796 796
 									case 'birthday':
797
-										$date_format = ( isset( $field['date_format'] ) ) ? strtolower( $field['date_format'] ) : 'mm/dd';
797
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? strtolower( $field[ 'date_format' ] ) : 'mm/dd';
798 798
 										break;
799 799
 								}
800 800
 								// initialize the datepicker
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 											padding: .85em .5em !important;
806 806
 										}
807 807
 										<?php
808
-											if( wp_is_mobile() ) {
808
+											if ( wp_is_mobile() ) {
809 809
 												?>
810 810
 												.datepicker-dropdown {
811 811
 													margin-top: 0px;
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 											$day_names = array_values( $wp_locale->weekday );
822 822
 											$day_names_short = array_values( $wp_locale->weekday_abbrev );
823 823
 											$day_names_min = array_values( $wp_locale->weekday_initial );
824
-											$date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field['type'] );
824
+											$date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field[ 'type' ] );
825 825
 											$first_day = get_option( 'start_of_week' );
826 826
 											$isRTL = $wp_locale->is_rtl();
827 827
 										?>
@@ -842,10 +842,10 @@  discard block
 block discarded – undo
842 842
 												numberOfMonths: 1,
843 843
 												today: '<?php _e( 'Today', 'yikes-inc-easy-mailchimp-extender' ); ?>'
844 844
 											};
845
-											jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').datepicker().on( 'show', function( e ) {
846
-												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'height' );
845
+											jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').datepicker().on( 'show', function( e ) {
846
+												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'height' );
847 847
 												date_picker_height = parseInt( date_picker_height.replace( 'px', '' ) ) + parseInt( 15 ) + 'px';
848
-												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'width' ).replace( 'px', '' );
848
+												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'width' ).replace( 'px', '' );
849 849
 												if( date_picker_width > 500 ) {
850 850
 													date_picker_width = 500;
851 851
 												}
@@ -855,27 +855,27 @@  discard block
 block discarded – undo
855 855
 									</script>
856 856
 								<?php
857 857
 
858
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
858
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
859 859
 								// store empty number for looping
860 860
 								$x = 0;
861 861
 
862 862
 								?>
863
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
863
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
864 864
 
865 865
 										<!-- dictate label visibility -->
866
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
867
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
868
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
866
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
867
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
868
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
869 869
 											</span>
870 870
 										<?php } ?>
871 871
 
872
-										<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 ); } ?>">
872
+										<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 ); } ?>">
873 873
 
874 874
 										<!-- description -->
875
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
875
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
876 876
 											<p class="form-field-description">
877 877
 												<small>
878
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
878
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
879 879
 												</small>
880 880
 											</p>
881 881
 										<?php } ?>
@@ -886,36 +886,36 @@  discard block
 block discarded – undo
886 886
 							break;
887 887
 
888 888
 							case 'dropdown':
889
-								$default_value = $field['default_choice'];
889
+								$default_value = $field[ 'default_choice' ];
890 890
 								// store empty number for looping
891 891
 								$x = 0;
892 892
 								// hidden labels
893 893
 
894 894
 									?>
895
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
895
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
896 896
 										<!-- dictate label visibility -->
897
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
898
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
899
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
897
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
898
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
899
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
900 900
 											</span>
901 901
 										<?php } ?>
902 902
 
903
-										<select <?php echo implode( ' ' , $field_array ); ?>>
903
+										<select <?php echo implode( ' ', $field_array ); ?>>
904 904
 											<?php
905 905
 												// decode for looping
906
-												$choices = json_decode( $field['choices'], true );
907
-												foreach( $choices as $choice ) {
908
-													?><option value="<?php echo $choice; ?>" <?php selected( $default_value , $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
906
+												$choices = json_decode( $field[ 'choices' ], true );
907
+												foreach ( $choices as $choice ) {
908
+													?><option value="<?php echo $choice; ?>" <?php selected( $default_value, $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
909 909
 													$x++;
910 910
 												}
911 911
 											?>
912 912
 										</select>
913 913
 
914 914
 										<!-- description -->
915
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
915
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
916 916
 											<p class="form-field-description">
917 917
 												<small>
918
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
918
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
919 919
 												</small>
920 920
 											</p>
921 921
 										<?php } ?>
@@ -929,13 +929,13 @@  discard block
 block discarded – undo
929 929
 							case 'radio':
930 930
 							case 'checkbox':
931 931
 								// remove the ID (as to not assign the same ID to every radio button)
932
-								unset( $field_array['id'] );
933
-								$choices = json_decode( $field['choices'], true );
932
+								unset( $field_array[ 'id' ] );
933
+								$choices = json_decode( $field[ 'choices' ], true );
934 934
 								// assign a default choice
935
-								$default_value = ( isset( $field['default_choice'] ) && $field['default_choice'] != '' ) ? $field['default_choice'] : $choices[0];
935
+								$default_value = ( isset( $field[ 'default_choice' ] ) && $field[ 'default_choice' ] != '' ) ? $field[ 'default_choice' ] : $choices[ 0 ];
936 936
 								// if the form was submit, but failed, let's reset the post data
937
-								if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) {
938
-									$default_value = $_POST[$field['merge']];
937
+								if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) {
938
+									$default_value = $_POST[ $field[ 'merge' ] ];
939 939
 								}
940 940
 								$count = count( $choices );
941 941
 								$i = 1;
@@ -944,20 +944,20 @@  discard block
 block discarded – undo
944 944
 								// hidden labels
945 945
 
946 946
 									?>
947
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
947
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
948 948
 
949 949
 										<!-- dictate label visibility -->
950
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
951
-											<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?> checkbox-parent-label">
952
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
950
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
951
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?> checkbox-parent-label">
952
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
953 953
 											</span>
954 954
 										<?php }
955 955
 
956
-										foreach( $choices as $choice ) {
956
+										foreach ( $choices as $choice ) {
957 957
 											?>
958
-											<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']; } ?>>
959
-												<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 ); ?>">
960
-												<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
958
+											<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' ]; } ?>>
959
+												<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 ); ?>">
960
+												<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
961 961
 											</label>
962 962
 											<?php
963 963
 											$i++;
@@ -965,10 +965,10 @@  discard block
 block discarded – undo
965 965
 										}
966 966
 
967 967
 										// description
968
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
968
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
969 969
 											<p class="form-field-description">
970 970
 												<small>
971
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
971
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
972 972
 												</small>
973 973
 											</p>
974 974
 										<?php } ?>
@@ -984,26 +984,26 @@  discard block
 block discarded – undo
984 984
 
985 985
 
986 986
 						// store default choice
987
-						$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'] : '' );
987
+						$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' ] : '' );
988 988
 
989 989
 						// if the form was submit, but failed, let's reset the post data
990
-						if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
991
-							$default_choice = $_POST[$field['group_id']];
990
+						if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
991
+							$default_choice = $_POST[ $field[ 'group_id' ] ];
992 992
 						}
993 993
 
994 994
 						// get our groups
995
-						$groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( $field['groups'], true ) : array();
995
+						$groups = ( isset( $field[ 'groups' ] ) && ! empty( $field[ 'groups' ] ) ) ? json_decode( $field[ 'groups' ], true ) : array();
996 996
 
997 997
 						$count = count( $groups );
998 998
 
999
-						if( $field['type'] == 'checkboxes' ) {
999
+						if ( $field[ 'type' ] == 'checkboxes' ) {
1000 1000
 							$type = 'checkbox';
1001
-						} else if( $field['type'] == 'radio' ) {
1001
+						} else if ( $field[ 'type' ] == 'radio' ) {
1002 1002
 							$type = 'radio';
1003 1003
 						}
1004 1004
 
1005 1005
 						// loop over the interest group field types
1006
-						switch ( $field['type'] ) {
1006
+						switch ( $field[ 'type' ] ) {
1007 1007
 
1008 1008
 							case 'checkboxes':
1009 1009
 							case 'radio':
@@ -1011,18 +1011,18 @@  discard block
 block discarded – undo
1011 1011
 								$x = 1; // used to find the last item of our array
1012 1012
 
1013 1013
 									?>
1014
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1015
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1014
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1015
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1016 1016
 											<!-- dictate label visibility -->
1017
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label">
1018
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1017
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label">
1018
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
1019 1019
 											</span>
1020 1020
 									<?php
1021 1021
 										}
1022 1022
 
1023 1023
 										// Display Submission Errors
1024
-										if( ! empty( $missing_required_checkbox_interest_groups ) ) {
1025
-											if( in_array( $field['group_id'], $missing_required_checkbox_interest_groups ) ) {
1024
+										if ( ! empty( $missing_required_checkbox_interest_groups ) ) {
1025
+											if ( in_array( $field[ 'group_id' ], $missing_required_checkbox_interest_groups ) ) {
1026 1026
 												?>
1027 1027
 													<p class="yikes-mailchimp-required-interest-group-error">
1028 1028
 														<?php echo apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); ?>
@@ -1033,19 +1033,19 @@  discard block
 block discarded – undo
1033 1033
 
1034 1034
 
1035 1035
 
1036
-										foreach( $groups as $group ) {
1037
-											if( $field['type'] == 'checkboxes' ) {
1036
+										foreach ( $groups as $group ) {
1037
+											if ( $field[ 'type' ] == 'checkboxes' ) {
1038 1038
 												/* Setup the defaults for this field - varies if the field was previously submitted */
1039
-												if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
1040
-													$default_choice = $_POST[$field['group_id']];
1041
-												} elseif( ( ! isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted != 1 ) || ( isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted == 1 ) ) {
1042
-													$default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : array();
1039
+												if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
1040
+													$default_choice = $_POST[ $field[ 'group_id' ] ];
1041
+												} elseif ( ( ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 ) || ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 ) ) {
1042
+													$default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : array();
1043 1043
 												}
1044 1044
 											}
1045 1045
 											?>
1046
-											<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 } ?>">
1047
-												<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'] ); ?>">
1048
-												<?php echo $group['name']; ?>
1046
+											<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 } ?>">
1047
+												<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' ] ); ?>">
1048
+												<?php echo $group[ 'name' ]; ?>
1049 1049
 											</label>
1050 1050
 											<?php
1051 1051
 											$i++;
@@ -1053,10 +1053,10 @@  discard block
 block discarded – undo
1053 1053
 										}
1054 1054
 
1055 1055
 										// description
1056
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1056
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1057 1057
 											<p class="form-field-description">
1058 1058
 												<small>
1059
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1059
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1060 1060
 												</small>
1061 1061
 											</p>
1062 1062
 										<?php } ?>
@@ -1070,28 +1070,28 @@  discard block
 block discarded – undo
1070 1070
 
1071 1071
 									?>
1072 1072
 
1073
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1073
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1074 1074
 										<!-- dictate label visibility -->
1075
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1076
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>">
1077
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1075
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1076
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?>">
1077
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
1078 1078
 											</span>
1079 1079
 										<?php } ?>
1080 1080
 
1081
-										<select <?php echo implode( ' ' , $field_array ); ?>>
1081
+										<select <?php echo implode( ' ', $field_array ); ?>>
1082 1082
 											<?php
1083 1083
 												$i = 0;
1084
-												foreach( $groups as $group ) {
1085
-													?><option <?php selected( $i , $default_choice ); ?> value="<?php echo $group['name']; ?>"><?php echo esc_attr( $group['name'] ); ?></option><?php
1084
+												foreach ( $groups as $group ) {
1085
+													?><option <?php selected( $i, $default_choice ); ?> value="<?php echo $group[ 'name' ]; ?>"><?php echo esc_attr( $group[ 'name' ] ); ?></option><?php
1086 1086
 													$i++;
1087 1087
 												}
1088 1088
 											?>
1089 1089
 										</select>
1090 1090
 
1091
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1091
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1092 1092
 											<p class="form-field-description">
1093 1093
 												<small>
1094
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1094
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1095 1095
 												</small>
1096 1096
 											</p>
1097 1097
 										<?php } ?>
@@ -1108,21 +1108,21 @@  discard block
 block discarded – undo
1108 1108
 
1109 1109
 									?>
1110 1110
 
1111
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1111
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1112 1112
 
1113 1113
 										<!-- dictate label visibility -->
1114
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1115
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1116
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
1114
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1115
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1116
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
1117 1117
 											</span>
1118 1118
 										<?php }
1119 1119
 
1120 1120
 
1121
-										foreach( $groups as $group ) {
1121
+										foreach ( $groups as $group ) {
1122 1122
 											?>
1123
-											<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;">
1124
-												<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'] ); ?>">
1125
-												<?php echo esc_attr( stripslashes( str_replace( '' , '\'', $group['name'] ) ) ); ?>
1123
+											<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;">
1124
+												<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' ] ); ?>">
1125
+												<?php echo esc_attr( stripslashes( str_replace( '', '\'', $group[ 'name' ] ) ) ); ?>
1126 1126
 											</label>
1127 1127
 											<?php
1128 1128
 											$i++;
@@ -1130,10 +1130,10 @@  discard block
 block discarded – undo
1130 1130
 										}
1131 1131
 
1132 1132
 										// description
1133
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1133
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1134 1134
 											<p class="form-field-description">
1135 1135
 												<small>
1136
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
1136
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
1137 1137
 												</small>
1138 1138
 											</p>
1139 1139
 										<?php }
@@ -1150,11 +1150,11 @@  discard block
 block discarded – undo
1150 1150
 				do_action( 'yikes-mailchimp-additional-form-fields', $form_data );
1151 1151
 
1152 1152
 				/* if we've enabled reCAPTCHA protection */
1153
-				if( isset( $recaptcha_box ) ) {
1153
+				if ( isset( $recaptcha_box ) ) {
1154 1154
 					echo $recaptcha_box;
1155 1155
 				}
1156
-				if( is_user_logged_in() ) {
1157
-					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1156
+				if ( is_user_logged_in() ) {
1157
+					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1158 1158
 				} else {
1159 1159
 					$admin_class = '';
1160 1160
 				}
@@ -1164,29 +1164,29 @@  discard block
 block discarded – undo
1164 1164
 				<input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot" value="">
1165 1165
 
1166 1166
 				<!-- List ID -->
1167
-				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_data['list_id']; ?>">
1167
+				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_data[ 'list_id' ]; ?>">
1168 1168
 
1169 1169
 				<!-- Form that is being submitted! Used to display error/success messages above the correct form -->
1170 1170
 				<input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form" value="<?php echo $form_id; ?>">
1171 1171
 
1172 1172
 				<!-- Submit Button -->
1173 1173
 				<?php
1174
-					if( $form_inline ) {
1174
+					if ( $form_inline ) {
1175 1175
 						$submit_button_label_classes = array( 'empty-label' );
1176 1176
 						// If the number of fields, is equal to the hidden label count, add our class
1177 1177
 						// eg: All field labels are set to hidden.
1178 1178
 						if ( absint( $field_count ) === absint( $hidden_label_count ) ) {
1179
-							$submit_button_label_classes[] = 'labels-hidden';
1179
+							$submit_button_label_classes[ ] = 'labels-hidden';
1180 1180
 						}
1181 1181
 						echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="' . implode( ' ', $submit_button_label_classes ) . '">&nbsp;</span>';
1182 1182
 					}
1183 1183
 					// display the image or text based button
1184
-					if( $submit_button_type == 'text' ) {
1185
-						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'] );
1184
+					if ( $submit_button_type == 'text' ) {
1185
+						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' ] );
1186 1186
 					} else {
1187
-						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'] );
1187
+						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' ] );
1188 1188
 					}
1189
-					if( $form_inline ) {
1189
+					if ( $form_inline ) {
1190 1190
 						echo '</label>';
1191 1191
 					}
1192 1192
 				?>
@@ -1198,8 +1198,8 @@  discard block
 block discarded – undo
1198 1198
 
1199 1199
 		<?php
1200 1200
 			/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
1201
-			if( is_user_logged_in() ) {
1202
-				if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
1201
+			if ( is_user_logged_in() ) {
1202
+				if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
1203 1203
 					echo $edit_form_link;
1204 1204
 				}
1205 1205
 			}
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
 		*	for non-admins
1216 1216
 		*/
1217 1217
 		if ( ! current_user_can( 'manage_options' ) ) {
1218
-			$impressions = $form_data['impressions'] + 1;
1218
+			$impressions = $form_data[ 'impressions' ] + 1;
1219 1219
 			$interface->update_form_field( $form_id, 'impressions', $impressions );
1220 1220
 		}
1221 1221
 
Please login to merge, or discard this patch.