Completed
Push — staging ( 68fed3...485a71 )
by Evan
04:30
created
public/partials/shortcodes/process_form_shortcode.php 1 patch
Spacing   +300 added lines, -300 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
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	*	to exclude styles from loading, add `define( 'YIKES_MAILCHIMP_EXCLUDE_STYLES', true );` to functions.php
220 220
 	*	@since 6.0.3.8
221 221
 	*/
222
-	if( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
222
+	if ( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
223 223
 		// enqueue the form styles
224 224
 		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 ) );
225 225
 	}
@@ -227,19 +227,19 @@  discard block
 block discarded – undo
227 227
 	/**
228 228
 	*	Check for form inline parameter
229 229
 	*/
230
-	$form_inline = ( $atts['inline'] == 1 || $atts['inline'] == 'true' );
230
+	$form_inline = ( $atts[ 'inline' ] == 1 || $atts[ 'inline' ] == 'true' );
231 231
 	// recheck from our form options
232 232
 	if ( ! $form_inline ) {
233
-		$form_inline = (bool) $additional_form_settings['yikes-easy-mc-inline-form'];
233
+		$form_inline = (bool) $additional_form_settings[ 'yikes-easy-mc-inline-form' ];
234 234
 	}
235 235
 
236 236
 	/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
237
-	if( is_user_logged_in() ) {
238
-		if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
237
+	if ( is_user_logged_in() ) {
238
+		if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
239 239
 			$edit_form_link = '<span class="edit-link">';
240
-			$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>';
240
+			$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>';
241 241
 			$edit_form_link .= '</span>';
242
-			$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts['form'], ucwords( $form_data['form_name'] ) );
242
+			$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts[ 'form' ], ucwords( $form_data[ 'form_name' ] ) );
243 243
 		} else {
244 244
 			$edit_form_link = '';
245 245
 		}
@@ -249,16 +249,16 @@  discard block
 block discarded – undo
249 249
 	// or else MailChimp throws errors at you
250 250
 	// extract our array keys
251 251
 	// @todo Remove array_keys() and in_array() usage here.
252
-	if( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) {
253
-		$array_keys = array_keys( $form_data['fields'] );
252
+	if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) {
253
+		$array_keys = array_keys( $form_data[ 'fields' ] );
254 254
 		// check for EMAIL in that array
255
-		if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) {
256
-			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>';
255
+		if ( ! in_array( 'EMAIL', $array_keys ) && ! in_array( 'email', $array_keys ) ) {
256
+			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>';
257 257
 		}
258 258
 	} else {
259
-		$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
260
-		if( is_user_logged_in() ) {
261
-			if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
259
+		$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
260
+		if ( is_user_logged_in() ) {
261
+			if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
262 262
 				return $error . $edit_form_link;
263 263
 			}
264 264
 		} else {
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 		}
267 267
 	}
268 268
 
269
-	if( $form_inline ) {
269
+	if ( $form_inline ) {
270 270
 		$field_width = (float) ( 100 / $field_count );
271 271
 		$submit_button_width = (float) ( 20 / $field_count );
272 272
 		/*
@@ -303,17 +303,17 @@  discard block
 block discarded – undo
303 303
 		*	Set a custom title using custom_title="lorem ipsum" parameter in the shortcode
304 304
 		*	- This takes precedence over the title set
305 305
 		*/
306
-		if ( $atts['title'] ) {
307
-			if ( ! empty( $atts['custom_title'] ) ) {
306
+		if ( $atts[ 'title' ] ) {
307
+			if ( ! empty( $atts[ 'custom_title' ] ) ) {
308 308
 				/**
309 309
 				 * Filter the title that is displayed through the shortcode.
310 310
 				 *
311 311
 				 * @param string $title   The title to display.
312 312
 				 * @param int    $form_id The form ID.
313 313
 				 */
314
-				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts['custom_title'] ), $form_id );
314
+				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts[ 'custom_title' ] ), $form_id );
315 315
 			} else {
316
-				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data['form_name'] ), $form_id );
316
+				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data[ 'form_name' ] ), $form_id );
317 317
 			}
318 318
 
319 319
 			echo sprintf( '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-%1$s">%2$s</h3>', $form_id, $title );
@@ -323,26 +323,26 @@  discard block
 block discarded – undo
323 323
 		*	Allow users to specify a custom description for this form, no html support
324 324
 		*	@since 6.0.3.8
325 325
 		*/
326
-		if ( $atts['description'] ) {
327
-			if ( ! empty( $atts['custom_description'] ) ) {
326
+		if ( $atts[ 'description' ] ) {
327
+			if ( ! empty( $atts[ 'custom_description' ] ) ) {
328 328
 				/**
329 329
 				 * Filter the description that is displayed through the shortcode.
330 330
 				 *
331 331
 				 * @param string $title   The title to display.
332 332
 				 * @param int    $form_id The form ID.
333 333
 				 */
334
-				$description = apply_filters( 'yikes-mailchimp-form-description', $atts['custom_description'], $form_id );
334
+				$description = apply_filters( 'yikes-mailchimp-form-description', $atts[ 'custom_description' ], $form_id );
335 335
 			} else {
336
-				$description = apply_filters( 'yikes-mailchimp-form-description', $form_data['form_description'], $form_id );
336
+				$description = apply_filters( 'yikes-mailchimp-form-description', $form_data[ 'form_description' ], $form_id );
337 337
 			}
338 338
 
339 339
 			echo sprintf( '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-%1$s">%2$s</section>', $form_id, $description );
340 340
 		}
341 341
 
342 342
 		// Check for AJAX
343
-		if( ( ! empty( $atts['ajax'] ) && $atts['ajax'] == 1 ) || $form_data['submission_settings']['ajax'] == 1 ) {
343
+		if ( ( ! empty( $atts[ 'ajax' ] ) && $atts[ 'ajax' ] == 1 ) || $form_data[ 'submission_settings' ][ 'ajax' ] == 1 ) {
344 344
 			// enqueue our ajax script
345
-			wp_enqueue_script( 'yikes-easy-mc-ajax' , YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js' , array( 'jquery' ) , YIKES_MC_VERSION, false );
345
+			wp_enqueue_script( 'yikes-easy-mc-ajax', YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js', array( 'jquery' ), YIKES_MC_VERSION, false );
346 346
 			wp_localize_script( 'yikes-easy-mc-ajax', 'yikes_mailchimp_ajax', array(
347 347
 				'ajax_url'                      => esc_url( admin_url( 'admin-ajax.php' ) ),
348 348
 				'page_data'                     => $page_data,
@@ -361,67 +361,67 @@  discard block
 block discarded – undo
361 361
 
362 362
 		// render the form!
363 363
 		?>
364
-			<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; ?>">
364
+			<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; ?>">
365 365
 
366 366
 				<?php
367 367
 				// Set a default constant for hidden fields
368 368
 				$hidden_label_count = 0;
369 369
 
370 370
 				// Loop over our form fields
371
-				foreach( $form_data['fields'] as $field ) {
371
+				foreach ( $form_data[ 'fields' ] as $field ) {
372 372
 						// input array
373 373
 						$field_array = array();
374 374
 						// label array
375 375
 						$label_array = array();
376 376
 						// label classes array
377 377
 						$label_class_array = array();
378
-						if( $field['additional-classes'] != '' ) {
378
+						if ( $field[ 'additional-classes' ] != '' ) {
379 379
 							// split custom classes at spaces
380
-							$custom_classes = explode( ' ' , $field['additional-classes'] );
380
+							$custom_classes = explode( ' ', $field[ 'additional-classes' ] );
381 381
 							// check our custom class array for field-left/field-right
382 382
 							// if it's set we need to assign it to our label and remove it from the field classes
383 383
 							 // input half left
384
-							if( in_array( 'field-left-half' , $custom_classes ) ) {
384
+							if ( in_array( 'field-left-half', $custom_classes ) ) {
385 385
 								// $label_array['class'] = 'class="field-left-half"';
386
-								$label_class_array[] = 'field-left-half';
387
-								$key = array_search( 'field-left-half' , $custom_classes );
388
-								unset( $custom_classes[$key] );
386
+								$label_class_array[ ] = 'field-left-half';
387
+								$key = array_search( 'field-left-half', $custom_classes );
388
+								unset( $custom_classes[ $key ] );
389 389
 							} // input half right
390
-							if( in_array( 'field-right-half' , $custom_classes ) ) {
390
+							if ( in_array( 'field-right-half', $custom_classes ) ) {
391 391
 								// $label_array['class'] = 'class="field-right-half"';
392
-								$label_class_array[] = 'field-right-half';
393
-								$key = array_search( 'field-right-half' , $custom_classes );
394
-								unset( $custom_classes[$key] );
392
+								$label_class_array[ ] = 'field-right-half';
393
+								$key = array_search( 'field-right-half', $custom_classes );
394
+								unset( $custom_classes[ $key ] );
395 395
 							} // input thirds (1/3 width, floated left)
396
-							if( in_array( 'field-third' , $custom_classes ) ) {
396
+							if ( in_array( 'field-third', $custom_classes ) ) {
397 397
 								// $label_array['class'] = 'class="field-third"';
398
-								$label_class_array[] = 'field-third';
399
-								$key = array_search( 'field-third' , $custom_classes );
400
-								unset( $custom_classes[$key] );
398
+								$label_class_array[ ] = 'field-third';
399
+								$key = array_search( 'field-third', $custom_classes );
400
+								unset( $custom_classes[ $key ] );
401 401
 							} // 2 column radio
402
-							if( in_array( 'option-2-col' , $custom_classes ) ) {
402
+							if ( in_array( 'option-2-col', $custom_classes ) ) {
403 403
 								// $label_array['class'] = 'class="option-2-col"';
404
-								$label_class_array[] = 'option-2-col';
405
-								$key = array_search( 'option-2-col' , $custom_classes );
406
-								unset( $custom_classes[$key] );
404
+								$label_class_array[ ] = 'option-2-col';
405
+								$key = array_search( 'option-2-col', $custom_classes );
406
+								unset( $custom_classes[ $key ] );
407 407
 							} // 3 column radio
408
-							if( in_array( 'option-3-col' , $custom_classes ) ) {
408
+							if ( in_array( 'option-3-col', $custom_classes ) ) {
409 409
 								// $label_array['class'] = 'class="option-3-col"';
410
-								$label_class_array[] = 'option-3-col';
411
-								$key = array_search( 'option-3-col' , $custom_classes );
412
-								unset( $custom_classes[$key] );
410
+								$label_class_array[ ] = 'option-3-col';
411
+								$key = array_search( 'option-3-col', $custom_classes );
412
+								unset( $custom_classes[ $key ] );
413 413
 							} // 4 column radio
414
-							if( in_array( 'option-4-col' , $custom_classes ) ) {
414
+							if ( in_array( 'option-4-col', $custom_classes ) ) {
415 415
 								// $label_array['class'] = 'class="option-4-col"';
416
-								$label_class_array[] = 'option-4-col';
417
-								$key = array_search( 'option-4-col' , $custom_classes );
418
-								unset( $custom_classes[$key] );
416
+								$label_class_array[ ] = 'option-4-col';
417
+								$key = array_search( 'option-4-col', $custom_classes );
418
+								unset( $custom_classes[ $key ] );
419 419
 							} // inline radio & checkboxes etc
420
-							if( in_array( 'option-inline' , $custom_classes ) ) {
420
+							if ( in_array( 'option-inline', $custom_classes ) ) {
421 421
 								// $label_array['class'] = 'class="option-inline"';
422
-								$label_class_array[] = 'option-inline';
423
-								$key = array_search( 'option-inline' , $custom_classes );
424
-								unset( $custom_classes[$key] );
422
+								$label_class_array[ ] = 'option-inline';
423
+								$key = array_search( 'option-inline', $custom_classes );
424
+								unset( $custom_classes[ $key ] );
425 425
 							}
426 426
 						} else {
427 427
 							$custom_classes = array();
@@ -429,19 +429,19 @@  discard block
 block discarded – undo
429 429
 
430 430
 						// if the form is set to inline, add the inline class to our labels
431 431
 						// since @6.0.3.8
432
-						if( $form_inline ) {
433
-							$label_class_array[] = 'label-inline';
432
+						if ( $form_inline ) {
433
+							$label_class_array[ ] = 'label-inline';
434 434
 						}
435 435
 
436
-						if( isset( $field['hide-label'] ) ) {
437
-							if( absint( $field['hide-label'] ) === 1 ) {
436
+						if ( isset( $field[ 'hide-label' ] ) ) {
437
+							if ( absint( $field[ 'hide-label' ] ) === 1 ) {
438 438
 								$hidden_label_count++;
439
-								$custom_classes[] = 'field-no-label';
439
+								$custom_classes[ ] = 'field-no-label';
440 440
 							}
441 441
 						}
442 442
 
443 443
 					/* Store tag variable based on field type */
444
-					if( isset( $field['merge'] ) ) {
444
+					if ( isset( $field[ 'merge' ] ) ) {
445 445
 						$group = '';
446 446
 						$tag = 'merge';
447 447
 					} else {
@@ -450,49 +450,49 @@  discard block
 block discarded – undo
450 450
 					}
451 451
 
452 452
 					// build up our array
453
-					$field_array['id'] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[$tag] ) . '" ';
454
-					$field_array['name'] = 'name="' . $group . esc_attr( $field[ $tag ] ) . '" ';
455
-					$field_array['placeholder'] = isset( $field['placeholder'] ) ? 'placeholder="' . esc_attr( stripslashes( $field['placeholder'] ) ) . '" ' : '';
456
-					$field_array['classes'] = 'class="yikes-easy-mc-'.$field['type'] . ' ' .  esc_attr( trim( implode( ' ' , $custom_classes ) ) ) . '" ';
453
+					$field_array[ 'id' ] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[ $tag ] ) . '" ';
454
+					$field_array[ 'name' ] = 'name="' . $group . esc_attr( $field[ $tag ] ) . '" ';
455
+					$field_array[ 'placeholder' ] = isset( $field[ 'placeholder' ] ) ? 'placeholder="' . esc_attr( stripslashes( $field[ 'placeholder' ] ) ) . '" ' : '';
456
+					$field_array[ 'classes' ] = 'class="yikes-easy-mc-' . $field[ 'type' ] . ' ' . esc_attr( trim( implode( ' ', $custom_classes ) ) ) . '" ';
457 457
 
458 458
 					// email must always be required and visible
459
-					if( $field['type'] == 'email' ) {
460
-						$field_array['required'] = 'required="required"';
461
-						$label_array['visible'] = '';
459
+					if ( $field[ 'type' ] == 'email' ) {
460
+						$field_array[ 'required' ] = 'required="required"';
461
+						$label_array[ 'visible' ] = '';
462 462
 						// $label_array['required'] = 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"';
463
-						$label_class_array[] = $field['merge'] . '-label';
464
-						$label_class_array[] = 'yikes-mailchimp-field-required';
463
+						$label_class_array[ ] = $field[ 'merge' ] . '-label';
464
+						$label_class_array[ ] = 'yikes-mailchimp-field-required';
465 465
 					} else {
466
-						if( $tag == 'merge' ) {
467
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
468
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
466
+						if ( $tag == 'merge' ) {
467
+							$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
468
+							$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
469 469
 							// $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['merge'] . '-label"';
470
-							$label_class_array[] = isset( $field['require'] ) ? $field['merge'] . '-label yikes-mailchimp-field-required' : $field['merge'] . '-label';
470
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'merge' ] . '-label yikes-mailchimp-field-required' : $field[ 'merge' ] . '-label';
471 471
 						} else {
472
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
473
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
472
+							$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
473
+							$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
474 474
 							// $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['group_id'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['group_id'] . '-label"';
475
-							$label_class_array[] = isset( $field['require'] ) ? $field['group_id'] . '-label yikes-mailchimp-field-required' : $field['group_id'] . '-label';
475
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'group_id' ] . '-label yikes-mailchimp-field-required' : $field[ 'group_id' ] . '-label';
476 476
 						}
477 477
 					}
478 478
 
479 479
 					// if both hide label and hide field are checked, we gotta hide the field!
480
-					if( isset( $field['hide' ] ) && $field['hide'] == 1 ) {
481
-						if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) {
482
-							$field_array['visible'] = 'style="display:none;"';
480
+					if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) {
481
+						if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) {
482
+							$field_array[ 'visible' ] = 'style="display:none;"';
483 483
 						}
484 484
 					}
485 485
 
486
-					$label_array['classes'] = 'class="' . implode( ' ', $label_class_array ) . '"';
486
+					$label_array[ 'classes' ] = 'class="' . implode( ' ', $label_class_array ) . '"';
487 487
 
488 488
 					// filter the field array data
489 489
 					$field_array = apply_filters( 'yikes-mailchimp-field-data', $field_array, $field, $form_id );
490 490
 
491 491
 					/* Loop Over Standard Fields (aka merge variables) */
492
-					if( isset( $field['merge'] ) ) {
492
+					if ( isset( $field[ 'merge' ] ) ) {
493 493
 
494 494
 						// loop over our fields by Type
495
-						switch ( $field['type'] ) {
495
+						switch ( $field[ 'type' ] ) {
496 496
 
497 497
 							default:
498 498
 							case 'email':
@@ -500,25 +500,25 @@  discard block
 block discarded – undo
500 500
 							case 'number':
501 501
 
502 502
 								// pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type)
503
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
503
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
504 504
 								$default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value );
505 505
 									?>
506
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
506
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
507 507
 
508 508
 										<!-- dictate label visibility -->
509
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
510
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
511
-												<?php if( ! isset( $field['hide-label'] ) ) { echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ), $form_id ); } ?>
509
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
510
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
511
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ), $form_id ); } ?>
512 512
 											</span>
513 513
 										<?php } ?>
514 514
 
515
-										<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 ); } ?>">
515
+										<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 ); } ?>">
516 516
 
517 517
 										<!-- description -->
518
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
518
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
519 519
 											<p class="form-field-description">
520 520
 												<small>
521
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
521
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
522 522
 												</small>
523 523
 											</p>
524 524
 										<?php } ?>
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 
531 531
 							case 'url':
532 532
 							case 'imageurl':
533
-								$default_value = ( isset( $field['default'] ) ) ? $field['default'] : '';
533
+								$default_value = ( isset( $field[ 'default' ] ) ) ? $field[ 'default' ] : '';
534 534
 									?>
535 535
 
536 536
 									<script type="text/javascript">
@@ -545,22 +545,22 @@  discard block
 block discarded – undo
545 545
 										}
546 546
 									</script>
547 547
 
548
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
548
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
549 549
 
550 550
 										<!-- dictate label visibility -->
551
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
552
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
553
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
551
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
552
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
553
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
554 554
 											</span>
555 555
 										<?php } ?>
556 556
 
557
-										<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;">
557
+										<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;">
558 558
 
559 559
 										<!-- description -->
560
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
560
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
561 561
 											<p class="form-field-description">
562 562
 												<small>
563
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
563
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
564 564
 												</small>
565 565
 											</p>
566 566
 										<?php } ?>
@@ -571,8 +571,8 @@  discard block
 block discarded – undo
571 571
 							break;
572 572
 
573 573
 							case 'phone':
574
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
575
-								$phone_format = $field['phone_format'];
574
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
575
+								$phone_format = $field[ 'phone_format' ];
576 576
 								?>
577 577
 									<script type="text/javascript">
578 578
 										/* Replace incorrect values and format it correctly for MailChimp API */
@@ -585,22 +585,22 @@  discard block
 block discarded – undo
585 585
 										}
586 586
 									</script>
587 587
 
588
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
588
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
589 589
 
590 590
 										<!-- dictate label visibility -->
591
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
592
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
593
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
591
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
592
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
593
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
594 594
 											</span>
595 595
 										<?php } ?>
596 596
 
597
-										<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 ); } ?>">
597
+										<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 ); } ?>">
598 598
 
599 599
 										<!-- description -->
600
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
600
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
601 601
 											<p class="form-field-description">
602 602
 												<small>
603
-													<?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field['merge'] ) . '-description', stripslashes( $field['description'] ), $form_id ); ?>
603
+													<?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field[ 'merge' ] ) . '-description', stripslashes( $field[ 'description' ] ), $form_id ); ?>
604 604
 												</small>
605 605
 											</p>
606 606
 										<?php } ?>
@@ -610,25 +610,25 @@  discard block
 block discarded – undo
610 610
 							break;
611 611
 
612 612
 							case 'zip':
613
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
613
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
614 614
 
615 615
 									?>
616
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
616
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
617 617
 
618 618
 									<!-- dictate label visibility -->
619
-									<?php if( ! isset( $field['hide-label'] ) ) { ?>
620
-										<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
621
-											<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
619
+									<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
620
+										<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
621
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
622 622
 										</span>
623 623
 									<?php } ?>
624 624
 
625
-									<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 ); } ?>">
625
+									<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 ); } ?>">
626 626
 
627 627
 									<!-- description -->
628
-									<?php if( isset( $field['description'] ) ) { ?>
628
+									<?php if ( isset( $field[ 'description' ] ) ) { ?>
629 629
 										<p class="form-field-description">
630 630
 											<small>
631
-												<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
631
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
632 632
 											</small>
633 633
 										</p>
634 634
 									<?php } ?>
@@ -640,28 +640,28 @@  discard block
 block discarded – undo
640 640
 
641 641
 							case 'address':
642 642
 								// required fields
643
-								$required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' );
643
+								$required_fields = array( 'addr1' => 'address', 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip', 'country' => 'country' );
644 644
 
645 645
 								// setup the default country value
646 646
 								$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
647 647
 
648 648
 								// store number for looping
649 649
 								$x = 1;
650
-								foreach( $required_fields as $type => $label ) {
650
+								foreach ( $required_fields as $type => $label ) {
651 651
 
652 652
 									// set the field names for the addrress fields
653
-									$field_array['name'] = 'name="'.$field[$tag].'['.$type.']'.'"';
653
+									$field_array[ 'name' ] = 'name="' . $field[ $tag ] . '[' . $type . ']' . '"';
654 654
 
655 655
 									// reset the label classes for left-half/right-half for addresses
656
-									if( isset( $label_array['class'] ) ) {
656
+									if ( isset( $label_array[ 'class' ] ) ) {
657 657
 										if ( $x % 2 == 0 ) {
658
-											$label_array['class'] = str_replace( 'field-left-half', 'field-right-half', $label_array['class'] );
658
+											$label_array[ 'class' ] = str_replace( 'field-left-half', 'field-right-half', $label_array[ 'class' ] );
659 659
 										} else {
660
-											$label_array['class'] = str_replace( 'field-right-half', 'field-left-half', $label_array['class'] );
660
+											$label_array[ 'class' ] = str_replace( 'field-right-half', 'field-left-half', $label_array[ 'class' ] );
661 661
 										}
662 662
 									}
663 663
 
664
-									switch( $type ) {
664
+									switch ( $type ) {
665 665
 
666 666
 										default:
667 667
 										case 'addr1':
@@ -670,17 +670,17 @@  discard block
 block discarded – undo
670 670
 
671 671
 
672 672
 											?>
673
-											<label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
673
+											<label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>>
674 674
 
675 675
 												<!-- dictate label visibility -->
676
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
677
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
678
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
676
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
677
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
678
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
679 679
 													</span>
680 680
 												<?php } ?>
681 681
 
682 682
 
683
-												<input <?php echo implode( ' ' , $field_array ); ?> type="text"  value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } ?>">
683
+												<input <?php echo implode( ' ', $field_array ); ?> type="text"  value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } ?>">
684 684
 
685 685
 											</label>
686 686
 											<?php
@@ -690,16 +690,16 @@  discard block
 block discarded – undo
690 690
 										case 'state':
691 691
 
692 692
 											?>
693
-											<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 } ?>>
693
+											<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 } ?>>
694 694
 
695 695
 												<!-- dictate label visibility -->
696
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
697
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
698
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
696
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
697
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
698
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
699 699
 													</span>
700 700
 												<?php } ?>
701 701
 
702
-												<select <?php echo implode( ' ' , $field_array ); ?>>
702
+												<select <?php echo implode( ' ', $field_array ); ?>>
703 703
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-dropdown.php' ); ?>
704 704
 												</select>
705 705
 
@@ -712,29 +712,29 @@  discard block
 block discarded – undo
712 712
 										case 'zip':
713 713
 
714 714
 											?>
715
-											<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 } ?>>
715
+											<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 } ?>>
716 716
 
717
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
718
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
719
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
717
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
718
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
719
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
720 720
 													</span>
721 721
 												<?php } ?>
722 722
 
723 723
 												<?php 
724 724
 													// If zip lookup plugin is installed, the ZIP field comes back as an array and we need to handle it differently...
725 725
 													$zip_value_to_echo = '';
726
-													if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) {
727
-														if ( is_array( $_POST[$field['merge']] ) && isset( $_POST[$field['merge']]['zip'] ) ) {
728
-															$zip_value_to_echo = $_POST[$field['merge']]['zip'];
726
+													if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) {
727
+														if ( is_array( $_POST[ $field[ 'merge' ] ] ) && isset( $_POST[ $field[ 'merge' ] ][ 'zip' ] ) ) {
728
+															$zip_value_to_echo = $_POST[ $field[ 'merge' ] ][ 'zip' ];
729 729
 														} else {
730
-															$zip_value_to_echo = $_POST[$field['merge']]; 
730
+															$zip_value_to_echo = $_POST[ $field[ 'merge' ] ]; 
731 731
 														}
732 732
 													} else { 
733 733
 														$zip_value_to_echo = esc_attr( $default_value ); 
734 734
 													}
735 735
 												?>
736 736
 
737
-												<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 echo $zip_value_to_echo ?>">
737
+												<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 echo $zip_value_to_echo ?>">
738 738
 
739 739
 											</label>
740 740
 											<?php
@@ -772,16 +772,16 @@  discard block
 block discarded – undo
772 772
 												$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
773 773
 											?>
774 774
 
775
-											<label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
775
+											<label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>>
776 776
 
777 777
 												<!-- dictate label visibility -->
778
-												<?php if( !isset( $field['hide-label'] ) ) { ?>
779
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
780
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
778
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
779
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
780
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
781 781
 													</span>
782 782
 												<?php } ?>
783 783
 
784
-												<select <?php echo implode( ' ' , $field_array ); ?> onchange="checkCountry(this);return false;">
784
+												<select <?php echo implode( ' ', $field_array ); ?> onchange="checkCountry(this);return false;">
785 785
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/country-dropdown.php' ); ?>
786 786
 												</select>
787 787
 											</label>
@@ -792,10 +792,10 @@  discard block
 block discarded – undo
792 792
 								}
793 793
 
794 794
 								// description
795
-								if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
795
+								if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
796 796
 									<p class="form-field-description">
797 797
 										<small>
798
-											<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
798
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
799 799
 										</small>
800 800
 									</p>
801 801
 									<?php }
@@ -805,19 +805,19 @@  discard block
 block discarded – undo
805 805
 							case 'birthday':
806 806
 
807 807
 								// bootstrap datepicker requirements
808
-								wp_enqueue_script( 'bootstrap-hover-dropdown' , YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js' , array( 'jquery' ) );
809
-								wp_enqueue_script( 'bootstrap-datepicker-script' , YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js' , array( 'jquery' , 'bootstrap-hover-dropdown' ) );
810
-								wp_enqueue_style( 'bootstrap-datepicker-styles' , YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
811
-								wp_enqueue_style( 'override-datepicker-styles' , YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css' , array( 'bootstrap-datepicker-styles' ) );
808
+								wp_enqueue_script( 'bootstrap-hover-dropdown', YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js', array( 'jquery' ) );
809
+								wp_enqueue_script( 'bootstrap-datepicker-script', YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js', array( 'jquery', 'bootstrap-hover-dropdown' ) );
810
+								wp_enqueue_style( 'bootstrap-datepicker-styles', YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
811
+								wp_enqueue_style( 'override-datepicker-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css', array( 'bootstrap-datepicker-styles' ) );
812 812
 
813
-								switch ( $field['type'] ) {
813
+								switch ( $field[ 'type' ] ) {
814 814
 									default:
815 815
 									case 'date':
816
-										$date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd';
816
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd';
817 817
 										break;
818 818
 
819 819
 									case 'birthday':
820
-										$date_format = ( isset( $field['date_format'] ) ) ? strtolower( $field['date_format'] ) : 'mm/dd';
820
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? strtolower( $field[ 'date_format' ] ) : 'mm/dd';
821 821
 										break;
822 822
 								}
823 823
 								// initialize the datepicker
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 											padding: .85em .5em !important;
829 829
 										}
830 830
 										<?php
831
-											if( wp_is_mobile() ) {
831
+											if ( wp_is_mobile() ) {
832 832
 												?>
833 833
 												.datepicker-dropdown {
834 834
 													margin-top: 0px;
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
 											$day_names = array_values( $wp_locale->weekday );
845 845
 											$day_names_short = array_values( $wp_locale->weekday_abbrev );
846 846
 											$day_names_min = array_values( $wp_locale->weekday_initial );
847
-											$date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field['type'] );
847
+											$date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field[ 'type' ] );
848 848
 											$first_day = get_option( 'start_of_week' );
849 849
 											$isRTL = $wp_locale->is_rtl();
850 850
 										?>
@@ -865,10 +865,10 @@  discard block
 block discarded – undo
865 865
 												numberOfMonths: 1,
866 866
 												today: '<?php _e( 'Today', 'yikes-inc-easy-mailchimp-extender' ); ?>'
867 867
 											};
868
-											jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').datepicker().on( 'show', function( e ) {
869
-												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'height' );
868
+											jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').datepicker().on( 'show', function( e ) {
869
+												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'height' );
870 870
 												date_picker_height = parseInt( date_picker_height.replace( 'px', '' ) ) + parseInt( 15 ) + 'px';
871
-												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'width' ).replace( 'px', '' );
871
+												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'width' ).replace( 'px', '' );
872 872
 												if( date_picker_width > 500 ) {
873 873
 													date_picker_width = 500;
874 874
 												}
@@ -878,27 +878,27 @@  discard block
 block discarded – undo
878 878
 									</script>
879 879
 								<?php
880 880
 
881
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
881
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
882 882
 								// store empty number for looping
883 883
 								$x = 0;
884 884
 
885 885
 								?>
886
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
886
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
887 887
 
888 888
 										<!-- dictate label visibility -->
889
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
890
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
891
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
889
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
890
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
891
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
892 892
 											</span>
893 893
 										<?php } ?>
894 894
 
895
-										<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 ); } ?>">
895
+										<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 ); } ?>">
896 896
 
897 897
 										<!-- description -->
898
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
898
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
899 899
 											<p class="form-field-description">
900 900
 												<small>
901
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
901
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
902 902
 												</small>
903 903
 											</p>
904 904
 										<?php } ?>
@@ -909,36 +909,36 @@  discard block
 block discarded – undo
909 909
 							break;
910 910
 
911 911
 							case 'dropdown':
912
-								$default_value = $field['default_choice'];
912
+								$default_value = $field[ 'default_choice' ];
913 913
 								// store empty number for looping
914 914
 								$x = 0;
915 915
 								// hidden labels
916 916
 
917 917
 									?>
918
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
918
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
919 919
 										<!-- dictate label visibility -->
920
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
921
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
922
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
920
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
921
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
922
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
923 923
 											</span>
924 924
 										<?php } ?>
925 925
 
926
-										<select <?php echo implode( ' ' , $field_array ); ?>>
926
+										<select <?php echo implode( ' ', $field_array ); ?>>
927 927
 											<?php
928 928
 												// decode for looping
929
-												$choices = json_decode( $field['choices'], true );
930
-												foreach( $choices as $choice ) {
931
-													?><option value="<?php echo $choice; ?>" <?php selected( $default_value , $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
929
+												$choices = json_decode( $field[ 'choices' ], true );
930
+												foreach ( $choices as $choice ) {
931
+													?><option value="<?php echo $choice; ?>" <?php selected( $default_value, $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
932 932
 													$x++;
933 933
 												}
934 934
 											?>
935 935
 										</select>
936 936
 
937 937
 										<!-- description -->
938
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
938
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
939 939
 											<p class="form-field-description">
940 940
 												<small>
941
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
941
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
942 942
 												</small>
943 943
 											</p>
944 944
 										<?php } ?>
@@ -952,13 +952,13 @@  discard block
 block discarded – undo
952 952
 							case 'radio':
953 953
 							case 'checkbox':
954 954
 								// remove the ID (as to not assign the same ID to every radio button)
955
-								unset( $field_array['id'] );
956
-								$choices = json_decode( $field['choices'], true );
955
+								unset( $field_array[ 'id' ] );
956
+								$choices = json_decode( $field[ 'choices' ], true );
957 957
 								// assign a default choice
958
-								$default_value = ( isset( $field['default_choice'] ) && $field['default_choice'] != '' ) ? $field['default_choice'] : $choices[0];
958
+								$default_value = ( isset( $field[ 'default_choice' ] ) && $field[ 'default_choice' ] != '' ) ? $field[ 'default_choice' ] : $choices[ 0 ];
959 959
 								// if the form was submit, but failed, let's reset the post data
960
-								if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) {
961
-									$default_value = $_POST[$field['merge']];
960
+								if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) {
961
+									$default_value = $_POST[ $field[ 'merge' ] ];
962 962
 								}
963 963
 								$count = count( $choices );
964 964
 								$i = 1;
@@ -967,20 +967,20 @@  discard block
 block discarded – undo
967 967
 								// hidden labels
968 968
 
969 969
 									?>
970
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
970
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
971 971
 
972 972
 										<!-- dictate label visibility -->
973
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
974
-											<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?> checkbox-parent-label">
975
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
973
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
974
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?> checkbox-parent-label">
975
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
976 976
 											</span>
977 977
 										<?php }
978 978
 
979
-										foreach( $choices as $choice ) {
979
+										foreach ( $choices as $choice ) {
980 980
 											?>
981
-											<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']; } ?>>
982
-												<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 ); ?>">
983
-												<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
981
+											<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' ]; } ?>>
982
+												<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 ); ?>">
983
+												<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
984 984
 											</label>
985 985
 											<?php
986 986
 											$i++;
@@ -988,10 +988,10 @@  discard block
 block discarded – undo
988 988
 										}
989 989
 
990 990
 										// description
991
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
991
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
992 992
 											<p class="form-field-description">
993 993
 												<small>
994
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
994
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
995 995
 												</small>
996 996
 											</p>
997 997
 										<?php } ?>
@@ -1007,26 +1007,26 @@  discard block
 block discarded – undo
1007 1007
 
1008 1008
 
1009 1009
 						// store default choice
1010
-						$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'] : '' );
1010
+						$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' ] : '' );
1011 1011
 
1012 1012
 						// if the form was submit, but failed, let's reset the post data
1013
-						if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
1014
-							$default_choice = $_POST[$field['group_id']];
1013
+						if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
1014
+							$default_choice = $_POST[ $field[ 'group_id' ] ];
1015 1015
 						}
1016 1016
 
1017 1017
 						// get our groups
1018
-						$groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( $field['groups'], true ) : array();
1018
+						$groups = ( isset( $field[ 'groups' ] ) && ! empty( $field[ 'groups' ] ) ) ? json_decode( $field[ 'groups' ], true ) : array();
1019 1019
 
1020 1020
 						$count = count( $groups );
1021 1021
 
1022
-						if( $field['type'] == 'checkboxes' ) {
1022
+						if ( $field[ 'type' ] == 'checkboxes' ) {
1023 1023
 							$type = 'checkbox';
1024
-						} else if( $field['type'] == 'radio' ) {
1024
+						} else if ( $field[ 'type' ] == 'radio' ) {
1025 1025
 							$type = 'radio';
1026 1026
 						}
1027 1027
 
1028 1028
 						// loop over the interest group field types
1029
-						switch ( $field['type'] ) {
1029
+						switch ( $field[ 'type' ] ) {
1030 1030
 
1031 1031
 							case 'checkboxes':
1032 1032
 							case 'radio':
@@ -1034,18 +1034,18 @@  discard block
 block discarded – undo
1034 1034
 								$x = 1; // used to find the last item of our array
1035 1035
 
1036 1036
 									?>
1037
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1038
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1037
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1038
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1039 1039
 											<!-- dictate label visibility -->
1040
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label">
1041
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1040
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label">
1041
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
1042 1042
 											</span>
1043 1043
 									<?php
1044 1044
 										}
1045 1045
 
1046 1046
 										// Display Submission Errors
1047
-										if( ! empty( $missing_required_checkbox_interest_groups ) ) {
1048
-											if( in_array( $field['group_id'], $missing_required_checkbox_interest_groups ) ) {
1047
+										if ( ! empty( $missing_required_checkbox_interest_groups ) ) {
1048
+											if ( in_array( $field[ 'group_id' ], $missing_required_checkbox_interest_groups ) ) {
1049 1049
 												?>
1050 1050
 													<p class="yikes-mailchimp-required-interest-group-error">
1051 1051
 														<?php echo apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); ?>
@@ -1056,24 +1056,24 @@  discard block
 block discarded – undo
1056 1056
 
1057 1057
 										foreach ( $groups as $group_id => $name ) {
1058 1058
 
1059
-											if( $field['type'] == 'checkboxes' ) {
1059
+											if ( $field[ 'type' ] == 'checkboxes' ) {
1060 1060
 
1061 1061
 												/* Setup the defaults for this field - varies if the field was previously submitted */
1062
-												if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
1062
+												if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
1063 1063
 
1064
-													$default_choice = $_POST[$field['group_id']];
1064
+													$default_choice = $_POST[ $field[ 'group_id' ] ];
1065 1065
 
1066
-												} elseif( ( ! isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted != 1 ) || ( isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted == 1 ) ) {
1066
+												} elseif ( ( ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 ) || ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 ) ) {
1067 1067
 
1068
-													$default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : array();
1068
+													$default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : array();
1069 1069
 
1070 1070
 												}
1071 1071
 
1072 1072
 											}
1073 1073
 
1074 1074
 											?>
1075
-											<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 } ?>">
1076
-												<input <?php if( isset( $field['require'] ) && $field['require'] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="group-<?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 $group_id; ?>">
1075
+											<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 } ?>">
1076
+												<input <?php if ( isset( $field[ 'require' ] ) && $field[ 'require' ] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="group-<?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 $group_id; ?>">
1077 1077
 												<?php echo $name; ?>
1078 1078
 											</label>
1079 1079
 											<?php
@@ -1082,10 +1082,10 @@  discard block
 block discarded – undo
1082 1082
 										}
1083 1083
 
1084 1084
 										// description
1085
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1085
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1086 1086
 											<p class="form-field-description">
1087 1087
 												<small>
1088
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1088
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1089 1089
 												</small>
1090 1090
 											</p>
1091 1091
 										<?php } ?>
@@ -1099,28 +1099,28 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
 									?>
1101 1101
 
1102
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1102
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1103 1103
 										<!-- dictate label visibility -->
1104
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1105
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>">
1106
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1104
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1105
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?>">
1106
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
1107 1107
 											</span>
1108 1108
 										<?php } ?>
1109 1109
 
1110
-										<select <?php echo implode( ' ' , $field_array ); ?>>
1110
+										<select <?php echo implode( ' ', $field_array ); ?>>
1111 1111
 											<?php
1112 1112
 												$i = 0;
1113
-												foreach( $groups as $group_id => $name ) {
1114
-													?><option <?php selected( $i , $default_choice ); ?> value="<?php echo $group_id; ?>"><?php echo esc_attr( $name ); ?></option><?php
1113
+												foreach ( $groups as $group_id => $name ) {
1114
+													?><option <?php selected( $i, $default_choice ); ?> value="<?php echo $group_id; ?>"><?php echo esc_attr( $name ); ?></option><?php
1115 1115
 													$i++;
1116 1116
 												}
1117 1117
 											?>
1118 1118
 										</select>
1119 1119
 
1120
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1120
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1121 1121
 											<p class="form-field-description">
1122 1122
 												<small>
1123
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1123
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1124 1124
 												</small>
1125 1125
 											</p>
1126 1126
 										<?php } ?>
@@ -1137,21 +1137,21 @@  discard block
 block discarded – undo
1137 1137
 
1138 1138
 									?>
1139 1139
 
1140
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1140
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1141 1141
 
1142 1142
 										<!-- dictate label visibility -->
1143
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1144
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1145
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
1143
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1144
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1145
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
1146 1146
 											</span>
1147 1147
 										<?php }
1148 1148
 
1149 1149
 
1150
-										foreach( $groups as $group ) {
1150
+										foreach ( $groups as $group ) {
1151 1151
 											?>
1152
-											<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;">
1153
-												<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'] ); ?>">
1154
-												<?php echo esc_attr( stripslashes( str_replace( '' , '\'', $group['name'] ) ) ); ?>
1152
+											<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;">
1153
+												<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' ] ); ?>">
1154
+												<?php echo esc_attr( stripslashes( str_replace( '', '\'', $group[ 'name' ] ) ) ); ?>
1155 1155
 											</label>
1156 1156
 											<?php
1157 1157
 											$i++;
@@ -1159,10 +1159,10 @@  discard block
 block discarded – undo
1159 1159
 										}
1160 1160
 
1161 1161
 										// description
1162
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1162
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1163 1163
 											<p class="form-field-description">
1164 1164
 												<small>
1165
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
1165
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
1166 1166
 												</small>
1167 1167
 											</p>
1168 1168
 										<?php }
@@ -1179,11 +1179,11 @@  discard block
 block discarded – undo
1179 1179
 				do_action( 'yikes-mailchimp-additional-form-fields', $form_data );
1180 1180
 
1181 1181
 				/* if we've enabled reCAPTCHA protection */
1182
-				if( isset( $recaptcha_box ) ) {
1182
+				if ( isset( $recaptcha_box ) ) {
1183 1183
 					echo $recaptcha_box;
1184 1184
 				}
1185
-				if( is_user_logged_in() ) {
1186
-					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1185
+				if ( is_user_logged_in() ) {
1186
+					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1187 1187
 				} else {
1188 1188
 					$admin_class = '';
1189 1189
 				}
@@ -1193,29 +1193,29 @@  discard block
 block discarded – undo
1193 1193
 				<input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot" value="">
1194 1194
 
1195 1195
 				<!-- List ID -->
1196
-				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_data['list_id']; ?>">
1196
+				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_data[ 'list_id' ]; ?>">
1197 1197
 
1198 1198
 				<!-- Form that is being submitted! Used to display error/success messages above the correct form -->
1199 1199
 				<input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form" value="<?php echo $form_id; ?>">
1200 1200
 
1201 1201
 				<!-- Submit Button -->
1202 1202
 				<?php
1203
-					if( $form_inline ) {
1203
+					if ( $form_inline ) {
1204 1204
 						$submit_button_label_classes = array( 'empty-label' );
1205 1205
 						// If the number of fields, is equal to the hidden label count, add our class
1206 1206
 						// eg: All field labels are set to hidden.
1207 1207
 						if ( absint( $field_count ) === absint( $hidden_label_count ) ) {
1208
-							$submit_button_label_classes[] = 'labels-hidden';
1208
+							$submit_button_label_classes[ ] = 'labels-hidden';
1209 1209
 						}
1210 1210
 						echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="' . implode( ' ', $submit_button_label_classes ) . '">&nbsp;</span>';
1211 1211
 					}
1212 1212
 					// display the image or text based button
1213
-					if( $submit_button_type == 'text' ) {
1214
-						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'] );
1213
+					if ( $submit_button_type == 'text' ) {
1214
+						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' ] );
1215 1215
 					} else {
1216
-						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'] );
1216
+						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' ] );
1217 1217
 					}
1218
-					if( $form_inline ) {
1218
+					if ( $form_inline ) {
1219 1219
 						echo '</label>';
1220 1220
 					}
1221 1221
 				?>
@@ -1227,8 +1227,8 @@  discard block
 block discarded – undo
1227 1227
 
1228 1228
 		<?php
1229 1229
 			/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
1230
-			if( is_user_logged_in() ) {
1231
-				if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
1230
+			if ( is_user_logged_in() ) {
1231
+				if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
1232 1232
 					echo $edit_form_link;
1233 1233
 				}
1234 1234
 			}
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 		*	for non-admins
1245 1245
 		*/
1246 1246
 		if ( ! current_user_can( 'manage_options' ) ) {
1247
-			$impressions = $form_data['impressions'] + 1;
1247
+			$impressions = $form_data[ 'impressions' ] + 1;
1248 1248
 			$interface->update_form_field( $form_id, 'impressions', $impressions );
1249 1249
 		}
1250 1250
 
Please login to merge, or discard this patch.