Completed
Push — staging ( 99a46e...288ed8 )
by Evan
13:10
created
public/partials/shortcodes/process_form_shortcode.php 1 patch
Spacing   +300 added lines, -300 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 			'recaptcha_data_callback' => '', // set a custom js callback function to run after a successful recaptcha response - default none
22 22
 			'recaptcha_expired_callback' => '', // set a custom js callback function to run after the recaptcha has expired - default none
23 23
 			'inline' => '0',
24
-		), $atts , 'yikes-mailchimp' )
24
+		), $atts, 'yikes-mailchimp' )
25 25
 	);
26 26
 
27 27
 	// set globals
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	$form_submitted = isset( $form_submitted ) ? $form_submitted : 0;
32 32
 
33 33
 	/* If the user hasn't authenticated yet, lets kill off */
34
-	if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) {
35
-		return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key." , 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
34
+	if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) {
35
+		return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key.", 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
36 36
 	}
37 37
 
38 38
 	// if the user forgot to specify a form ID, lets kill of and warn them.
39
-	if( ! $form ) {
39
+	if ( ! $form ) {
40 40
 		return __( 'Whoops, it looks like you forgot to specify a form to display.', 'yikes-inc-easy-mailchimp-extender' );
41 41
 	}
42 42
 
@@ -45,39 +45,39 @@  discard block
 block discarded – undo
45 45
 	$form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form . '', ARRAY_A );
46 46
 
47 47
 	// confirm we have some results, or return an error
48
-	if( !$form_results ) {
49
-		return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form." , 'yikes-inc-easy-mailchimp-extender' );
48
+	if ( ! $form_results ) {
49
+		return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form.", 'yikes-inc-easy-mailchimp-extender' );
50 50
 	}
51 51
 
52 52
 	/*
53 53
 	*	Check if the user wants to use reCAPTCHA Spam Prevention
54 54
 	*/
55
-	if( get_option( 'yikes-mc-recaptcha-status' , '' ) == '1' ) {
55
+	if ( get_option( 'yikes-mc-recaptcha-status', '' ) == '1' ) {
56 56
 		// allow users to manually set recaptcha (instead of globally - recaptcha="1"/recaptcha="0" - but still needs to be globally enabled on the settings page)
57
-		if( ! isset( $atts['recaptcha'] ) || ( isset( $atts['recaptcha'] ) && $atts['recaptcha'] == '1' ) ) {
57
+		if ( ! isset( $atts[ 'recaptcha' ] ) || ( isset( $atts[ 'recaptcha' ] ) && $atts[ 'recaptcha' ] == '1' ) ) {
58 58
 			// if either of the Private the Secret key is left blank, we should display an error back to the user
59
-			if( get_option( 'yikes-mc-recaptcha-site-key' , '' ) == '' ) {
60
-				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
59
+			if ( get_option( 'yikes-mc-recaptcha-site-key', '' ) == '' ) {
60
+				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
61 61
 			}
62
-			if( get_option( 'yikes-mc-recaptcha-secret-key' , '' ) == '' ) {
63
-				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
62
+			if ( get_option( 'yikes-mc-recaptcha-secret-key', '' ) == '' ) {
63
+				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
64 64
 			}
65 65
 
66
-			if( ! empty( $atts['recaptcha_type'] ) ) {
67
-				echo $atts['recaptcha_type'];
66
+			if ( ! empty( $atts[ 'recaptcha_type' ] ) ) {
67
+				echo $atts[ 'recaptcha_type' ];
68 68
 			}
69 69
 
70 70
 			// Store the site language (to load recaptcha in a specific language)
71 71
 			$locale = get_locale();
72 72
 			$locale_split = explode( '_', $locale );
73 73
 			// Setup reCAPTCHA parameters
74
-			$lang = ( isset( $locale_split ) ? $locale_split[0] : $locale );
75
-			$lang = ( isset( $atts['recaptcha_lang'] ) ) ? $atts['recaptcha_lang'] : $locale_split[0];
76
-			$type = ( isset( $atts['recaptcha_type'] ) ) ? strtolower( $atts['recaptcha_type'] ) : 'image'; // setup recaptcha type
77
-			$theme= ( isset( $atts['recaptcha_theme'] ) ) ? strtolower( $atts['recaptcha_theme'] ) : 'light'; // setup recaptcha theme
78
-			$size = ( isset( $atts['recaptcha_size'] ) ) ? strtolower( $atts['recaptcha_size'] ) : 'normal'; // setup recaptcha size
79
-			$data_callback = ( isset( $atts['recaptcha_data_callback'] ) ) ? $atts['recaptcha_data_callback'] : false; // setup recaptcha size
80
-			$expired_callback = ( isset( $atts['recaptcha_expired_callback'] ) ) ? $atts['recaptcha_expired_callback'] : false; // setup recaptcha size
74
+			$lang = ( isset( $locale_split ) ? $locale_split[ 0 ] : $locale );
75
+			$lang = ( isset( $atts[ 'recaptcha_lang' ] ) ) ? $atts[ 'recaptcha_lang' ] : $locale_split[ 0 ];
76
+			$type = ( isset( $atts[ 'recaptcha_type' ] ) ) ? strtolower( $atts[ 'recaptcha_type' ] ) : 'image'; // setup recaptcha type
77
+			$theme = ( isset( $atts[ 'recaptcha_theme' ] ) ) ? strtolower( $atts[ 'recaptcha_theme' ] ) : 'light'; // setup recaptcha theme
78
+			$size = ( isset( $atts[ 'recaptcha_size' ] ) ) ? strtolower( $atts[ 'recaptcha_size' ] ) : 'normal'; // setup recaptcha size
79
+			$data_callback = ( isset( $atts[ 'recaptcha_data_callback' ] ) ) ? $atts[ 'recaptcha_data_callback' ] : false; // setup recaptcha size
80
+			$expired_callback = ( isset( $atts[ 'recaptcha_expired_callback' ] ) ) ? $atts[ 'recaptcha_expired_callback' ] : false; // setup recaptcha size
81 81
 			// Pass the shortcode parameters through a filter
82 82
 			$recaptcha_shortcode_params = apply_filters( 'yikes-mailchimp-recaptcha-parameters', array(
83 83
 				'language' => $lang,
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 				'expired_callback' => $expired_callback,
89 89
 			), $form );
90 90
 			// enqueue Google recaptcha JS
91
-			wp_register_script( 'google-recaptcha-js' , 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params['language'] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ) , 'all' );
91
+			wp_register_script( 'google-recaptcha-js', 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params[ 'language' ] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ), 'all' );
92 92
 			wp_enqueue_script( 'google-recaptcha-js' );
93
-			$recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key' , '' );
94
-			$recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params['theme'] . '" data-type="' . $recaptcha_shortcode_params['type'] . '" data-size="' . $recaptcha_shortcode_params['size'] . '" data-callback="' . $recaptcha_shortcode_params['success_callback'] . '" data-expired-callback="' . $recaptcha_shortcode_params['expired_callback'] . '"></div>';
93
+			$recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key', '' );
94
+			$recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params[ 'theme' ] . '" data-type="' . $recaptcha_shortcode_params[ 'type' ] . '" data-size="' . $recaptcha_shortcode_params[ 'size' ] . '" data-callback="' . $recaptcha_shortcode_params[ 'success_callback' ] . '" data-expired-callback="' . $recaptcha_shortcode_params[ 'expired_callback' ] . '"></div>';
95 95
 			?>
96 96
 			<script type="text/javascript">
97 97
 				/* Script Callback to init. multiple recaptchas on a single page */
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	}
119 119
 
120 120
 	// place our results into a seperate variable for easy looping
121
-	$form_data = $form_results[0];
121
+	$form_data = $form_results[ 0 ];
122 122
 
123 123
 	// store our variables
124
-	$form_id = (int) $form_data['id']; // form id (the id of the form in the database)
124
+	$form_id = (int) $form_data[ 'id' ]; // form id (the id of the form in the database)
125 125
 
126 126
 	/*
127 127
 	*	Get the stored form settings
@@ -130,32 +130,32 @@  discard block
 block discarded – undo
130 130
 	*/
131 131
 	$form_settings = Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $form_id );
132 132
 
133
-	$additional_form_settings = ( isset( $form_data['form_settings'] ) ) ? json_decode( $form_data['form_settings'], true ) : false;
133
+	$additional_form_settings = ( isset( $form_data[ 'form_settings' ] ) ) ? json_decode( $form_data[ 'form_settings' ], true ) : false;
134 134
 	// store our options from the additional form settings array
135
-	$form_classes = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-class-names'] : '';
136
-	$inline_form = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-inline-form'] : '';
137
-	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-submit-button-type'] : 'text';
138
-	$submit_button_text = ( $additional_form_settings && $additional_form_settings['yikes-easy-mc-submit-button-text'] != '' ) ? esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-text'] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' );
139
-	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings['yikes-easy-mc-submit-button-image'] ) : '';
140
-	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-classes'] ) : '';
135
+	$form_classes = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-class-names' ] : '';
136
+	$inline_form = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-inline-form' ] : '';
137
+	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-submit-button-type' ] : 'text';
138
+	$submit_button_text = ( $additional_form_settings && $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] != '' ) ? esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' );
139
+	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings[ 'yikes-easy-mc-submit-button-image' ] ) : '';
140
+	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-classes' ] ) : '';
141 141
 	// scheuldes
142
-	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-schedule'] : false;
143
-	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-start'] : '';;
144
-	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-end'] : '';
145
-	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-pending-message'] : '';
146
-	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-expired-message'] : '';
142
+	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-schedule' ] : false;
143
+	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-start' ] : ''; ;
144
+	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-end' ] : '';
145
+	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ] : '';
146
+	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ] : '';
147 147
 	// register required
148
-	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-login-required'] : false;
149
-	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-login-message'] : '';
148
+	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-login-required' ] : false;
149
+	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-login-message' ] : '';
150 150
 	// store number of fields
151
-	$field_count = (int) count( $form_settings['fields'] );
151
+	$field_count = (int) count( $form_settings[ 'fields' ] );
152 152
 
153 153
 	// confirm we actually have fields, before looping
154
-	if( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) {
154
+	if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) {
155 155
 		// loop over each field, if it's set to hidden -- subtract it from the field count
156 156
 		// this throws off the layout for inline forms setup below
157
-		foreach( json_decode( $form_data['fields'] ) as $form_field ) {
158
-			if( isset( $form_field->hide ) && $form_field->hide == 1 ) {
157
+		foreach ( json_decode( $form_data[ 'fields' ] ) as $form_field ) {
158
+			if ( isset( $form_field->hide ) && $form_field->hide == 1 ) {
159 159
 				$field_count--;
160 160
 			}
161 161
 		}
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
 	*	If login is required, abort
166 166
 	*	@since 6.0.3.8
167 167
 	*/
168
-	if( $form_login_required ) {
169
-		if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
168
+	if ( $form_login_required ) {
169
+		if ( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
170 170
 			ob_start();
171 171
 				?>
172 172
 					<div class="yikes-mailchimp-login-required yikes-mailchimp-form-<?php echo $form_id; ?>-login-required">
@@ -182,19 +182,19 @@  discard block
 block discarded – undo
182 182
 	*	Check if schedule is set for this form
183 183
 	*	@since 6.0.3.8
184 184
 	*/
185
-	if( $form_schedule_state ) {
185
+	if ( $form_schedule_state ) {
186 186
 		// store current date
187 187
 		$current_date = strtotime( current_time( 'm/d/Y g:iA' ) );
188 188
 
189 189
 		// the the current date is less than the form scheduled start date
190
-		if( $current_date < $form_schedule_start ) {
190
+		if ( $current_date < $form_schedule_start ) {
191 191
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_pending_message );
192 192
 			return;
193 193
 			// abort
194 194
 		}
195 195
 
196 196
 		// The current date is past or equal to the end date, aka form has now expired
197
-		if( $current_date >= $form_schedule_end ) {
197
+		if ( $current_date >= $form_schedule_end ) {
198 198
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_expired_message );
199 199
 			return;
200 200
 			// abort
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
 
204 204
 	// setup the submit button text
205 205
 	// shortcode parameter takes precedence over option
206
-	if( isset( $atts['submit'] ) ) {
207
-		$submit = $atts['submit'];
206
+	if ( isset( $atts[ 'submit' ] ) ) {
207
+		$submit = $atts[ 'submit' ];
208 208
 	} else {
209 209
 		$submit = $submit_button_text;
210 210
 	}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	$page_data = $post;
215 215
 
216 216
 	// Remove the post_password from this for security
217
-	if( isset( $page_data->post_password ) ) {
217
+	if ( isset( $page_data->post_password ) ) {
218 218
 		unset( $page_data->post_password );
219 219
 	}
220 220
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	*	to exclude styles from loading, add `define( 'YIKES_MAILCHIMP_EXCLUDE_STYLES', true );` to functions.php
229 229
 	*	@since 6.0.3.8
230 230
 	*/
231
-	if( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
231
+	if ( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
232 232
 		// enqueue the form styles
233 233
 		wp_enqueue_style( 'yikes-inc-easy-mailchimp-public-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-extender-public.min.css', array( $last_key ) );
234 234
 	}
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 	/**
237 237
 	*	Check for form inline parameter
238 238
 	*/
239
-	$form_inline = ( isset( $atts['inline'] ) && ( $atts['inline'] == 1 || $atts['inline'] == 'true' ) ) ? true : false;
239
+	$form_inline = ( isset( $atts[ 'inline' ] ) && ( $atts[ 'inline' ] == 1 || $atts[ 'inline' ] == 'true' ) ) ? true : false;
240 240
 	// recheck from our form options
241
-	if( ! $form_inline ) {
242
-		$form_inline = ( isset( $additional_form_settings['yikes-easy-mc-inline-form'] ) && $additional_form_settings['yikes-easy-mc-inline-form'] == 1 ) ? true : false;
241
+	if ( ! $form_inline ) {
242
+		$form_inline = ( isset( $additional_form_settings[ 'yikes-easy-mc-inline-form' ] ) && $additional_form_settings[ 'yikes-easy-mc-inline-form' ] == 1 ) ? true : false;
243 243
 	}
244
-	if( $form_inline ) {
244
+	if ( $form_inline ) {
245 245
 		$field_width = (float) ( 100 / $field_count );
246 246
 		$submit_button_width = (float) ( 20 / $field_count );
247 247
 		/*
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 	<?php
271 271
 
272 272
 		/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
273
-		if( is_user_logged_in() ) {
274
-			if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
273
+		if ( is_user_logged_in() ) {
274
+			if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
275 275
 				$edit_form_link = '<span class="edit-link">';
276
-					$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_settings['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
276
+					$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form ) ) . '" title="' . __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_settings[ 'form_name' ] ) . '">' . __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
277 277
 				$edit_form_link .= '</span>';
278
-				$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $form, ucwords( $form_settings['form_name'] ) );
278
+				$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $form, ucwords( $form_settings[ 'form_name' ] ) );
279 279
 			} else {
280 280
 				$edit_form_link = '';
281 281
 			}
@@ -284,16 +284,16 @@  discard block
 block discarded – undo
284 284
 		// ensure there is an 'email' field the user can fill out
285 285
 		// or else MailChimp throws errors at you
286 286
 			// extract our array keys
287
-			if( isset( $form_settings['fields'] ) && ! empty( $form_settings['fields'] ) ) {
288
-				$array_keys = array_keys( $form_settings['fields'] );
287
+			if ( isset( $form_settings[ 'fields' ] ) && ! empty( $form_settings[ 'fields' ] ) ) {
288
+				$array_keys = array_keys( $form_settings[ 'fields' ] );
289 289
 				// check for EMAIL in that array
290
-				if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) {
291
-					return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>';
290
+				if ( ! in_array( 'EMAIL', $array_keys ) && ! in_array( 'email', $array_keys ) ) {
291
+					return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>';
292 292
 				}
293 293
 			} else {
294
-				$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
295
-				if( is_user_logged_in() ) {
296
-					if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
294
+				$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
295
+				if ( is_user_logged_in() ) {
296
+					if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
297 297
 						return $error . $edit_form_link;
298 298
 					}
299 299
 				} else {
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
 		*	Set a custom title using custom_title="lorem ipsum" parameter in the shortcode
312 312
 		*	- This takes precedence over the title set
313 313
 		*/
314
-		if( ! empty( $title ) && $title == 1 && isset( $atts['custom_title'] ) ) {
315
-			echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts['custom_title'] ), $form_id ) . '</h3>';
314
+		if ( ! empty( $title ) && $title == 1 && isset( $atts[ 'custom_title' ] ) ) {
315
+			echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts[ 'custom_title' ] ), $form_id ) . '</h3>';
316 316
 		} else {
317 317
 			// display the form description if the user
318 318
 			// has specified to do so
319
-			if( ! empty( $title ) && $title == 1 ) {
320
-				echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_settings['form_name'] ), $form_id ) . '</h3>';
319
+			if ( ! empty( $title ) && $title == 1 ) {
320
+				echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_settings[ 'form_name' ] ), $form_id ) . '</h3>';
321 321
 			}
322 322
 		}
323 323
 
@@ -325,21 +325,21 @@  discard block
 block discarded – undo
325 325
 		*	Allow users to specify a custom description for this form, no html support
326 326
 		*	@since 6.0.3.8
327 327
 		*/
328
-		if( ! empty( $description ) && $description == 1 && isset( $atts['custom_description'] ) ) {
329
-			echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $atts['custom_description'], $form_id ) ) . '</section>';
328
+		if ( ! empty( $description ) && $description == 1 && isset( $atts[ 'custom_description' ] ) ) {
329
+			echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $atts[ 'custom_description' ], $form_id ) ) . '</section>';
330 330
 		} else {
331 331
 			// display the form description if the user
332 332
 			// has specified to do so
333
-			if( ! empty( $description ) && $description == 1 ) {
334
-				echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $form_settings['form_description'], $form_id ) ) . '</section>';
333
+			if ( ! empty( $description ) && $description == 1 ) {
334
+				echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $form_settings[ 'form_description' ], $form_id ) ) . '</section>';
335 335
 			}
336 336
 		}
337 337
 
338 338
 		// Check for AJAX
339
-		if( ( ! empty( $atts['ajax'] ) && $atts['ajax'] == 1 ) || $form_settings['submission_settings']['ajax'] == 1 ) {
339
+		if ( ( ! empty( $atts[ 'ajax' ] ) && $atts[ 'ajax' ] == 1 ) || $form_settings[ 'submission_settings' ][ 'ajax' ] == 1 ) {
340 340
 			// enqueue our ajax script
341
-			wp_register_script( 'yikes-easy-mc-ajax' , YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js' , array( 'jquery' ) , 'yikes-inc-easy-mailchimp-extender', false );
342
-			wp_localize_script( 'yikes-easy-mc-ajax' , 'object' , array(
341
+			wp_register_script( 'yikes-easy-mc-ajax', YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js', array( 'jquery' ), 'yikes-inc-easy-mailchimp-extender', false );
342
+			wp_localize_script( 'yikes-easy-mc-ajax', 'object', array(
343 343
 				'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
344 344
 				'page_data' => $page_data,
345 345
 				'interest_group_checkbox_error' => apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ),
@@ -357,63 +357,63 @@  discard block
 block discarded – undo
357 357
 
358 358
 		// render the form!
359 359
 		?>
360
-			<form id="<?php echo sanitize_title( $form_settings['form_name'] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline )  { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if( !empty( $_POST ) && $form_submitted == 1 && $form_settings['submission_settings']['hide_form_post_signup'] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>">
360
+			<form id="<?php echo sanitize_title( $form_settings[ 'form_name' ] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if ( ! empty( $_POST ) && $form_submitted == 1 && $form_settings[ 'submission_settings' ][ 'hide_form_post_signup' ] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>">
361 361
 
362 362
 				<?php
363
-				foreach( $form_settings['fields'] as $field ) {
363
+				foreach ( $form_settings[ 'fields' ] as $field ) {
364 364
 						// input array
365 365
 						$field_array = array();
366 366
 						// label array
367 367
 						$label_array = array();
368 368
 						// label classes array
369 369
 						$label_class_array = array();
370
-						if( $field['additional-classes'] != '' ) {
370
+						if ( $field[ 'additional-classes' ] != '' ) {
371 371
 							// split custom classes at spaces
372
-							$custom_classes = explode( ' ' , $field['additional-classes'] );
372
+							$custom_classes = explode( ' ', $field[ 'additional-classes' ] );
373 373
 							// check our custom class array for field-left/field-right
374 374
 							// if it's set we need to assign it to our label and remove it from the field classes
375 375
 							 // input half left
376
-							if( in_array( 'field-left-half' , $custom_classes ) ) {
376
+							if ( in_array( 'field-left-half', $custom_classes ) ) {
377 377
 								// $label_array['class'] = 'class="field-left-half"';
378
-								$label_class_array[] = 'field-left-half';
379
-								$key = array_search( 'field-left-half' , $custom_classes );
380
-								unset( $custom_classes[$key] );
378
+								$label_class_array[ ] = 'field-left-half';
379
+								$key = array_search( 'field-left-half', $custom_classes );
380
+								unset( $custom_classes[ $key ] );
381 381
 							} // input half right
382
-							if( in_array( 'field-right-half' , $custom_classes ) ) {
382
+							if ( in_array( 'field-right-half', $custom_classes ) ) {
383 383
 								// $label_array['class'] = 'class="field-right-half"';
384
-								$label_class_array[] = 'field-right-half';
385
-								$key = array_search( 'field-right-half' , $custom_classes );
386
-								unset( $custom_classes[$key] );
384
+								$label_class_array[ ] = 'field-right-half';
385
+								$key = array_search( 'field-right-half', $custom_classes );
386
+								unset( $custom_classes[ $key ] );
387 387
 							} // input thirds (1/3 width, floated left)
388
-							if( in_array( 'field-third' , $custom_classes ) ) {
388
+							if ( in_array( 'field-third', $custom_classes ) ) {
389 389
 								// $label_array['class'] = 'class="field-third"';
390
-								$label_class_array[] = 'field-third';
391
-								$key = array_search( 'field-third' , $custom_classes );
392
-								unset( $custom_classes[$key] );
390
+								$label_class_array[ ] = 'field-third';
391
+								$key = array_search( 'field-third', $custom_classes );
392
+								unset( $custom_classes[ $key ] );
393 393
 							} // 2 column radio
394
-							if( in_array( 'option-2-col' , $custom_classes ) ) {
394
+							if ( in_array( 'option-2-col', $custom_classes ) ) {
395 395
 								// $label_array['class'] = 'class="option-2-col"';
396
-								$label_class_array[] = 'option-2-col';
397
-								$key = array_search( 'option-2-col' , $custom_classes );
398
-								unset( $custom_classes[$key] );
396
+								$label_class_array[ ] = 'option-2-col';
397
+								$key = array_search( 'option-2-col', $custom_classes );
398
+								unset( $custom_classes[ $key ] );
399 399
 							} // 3 column radio
400
-							if( in_array( 'option-3-col' , $custom_classes ) ) {
400
+							if ( in_array( 'option-3-col', $custom_classes ) ) {
401 401
 								// $label_array['class'] = 'class="option-3-col"';
402
-								$label_class_array[] = 'option-3-col';
403
-								$key = array_search( 'option-3-col' , $custom_classes );
404
-								unset( $custom_classes[$key] );
402
+								$label_class_array[ ] = 'option-3-col';
403
+								$key = array_search( 'option-3-col', $custom_classes );
404
+								unset( $custom_classes[ $key ] );
405 405
 							} // 4 column radio
406
-							if( in_array( 'option-4-col' , $custom_classes ) ) {
406
+							if ( in_array( 'option-4-col', $custom_classes ) ) {
407 407
 								// $label_array['class'] = 'class="option-4-col"';
408
-								$label_class_array[] = 'option-4-col';
409
-								$key = array_search( 'option-4-col' , $custom_classes );
410
-								unset( $custom_classes[$key] );
408
+								$label_class_array[ ] = 'option-4-col';
409
+								$key = array_search( 'option-4-col', $custom_classes );
410
+								unset( $custom_classes[ $key ] );
411 411
 							} // inline radio & checkboxes etc
412
-							if( in_array( 'option-inline' , $custom_classes ) ) {
412
+							if ( in_array( 'option-inline', $custom_classes ) ) {
413 413
 								// $label_array['class'] = 'class="option-inline"';
414
-								$label_class_array[] = 'option-inline';
415
-								$key = array_search( 'option-inline' , $custom_classes );
416
-								unset( $custom_classes[$key] );
414
+								$label_class_array[ ] = 'option-inline';
415
+								$key = array_search( 'option-inline', $custom_classes );
416
+								unset( $custom_classes[ $key ] );
417 417
 							}
418 418
 						} else {
419 419
 							$custom_classes = array();
@@ -421,67 +421,67 @@  discard block
 block discarded – undo
421 421
 
422 422
 						// if the form is set to inline, add the inline class to our labels
423 423
 						// since @6.0.3.8
424
-						if( $form_inline ) {
425
-							$label_class_array[] = 'label-inline';
424
+						if ( $form_inline ) {
425
+							$label_class_array[ ] = 'label-inline';
426 426
 						}
427 427
 
428
-						if( isset( $field['hide-label'] ) ) {
429
-							if( $field['hide-label'] == 1 ) {
430
-								$custom_classes[] = 'field-no-label';
428
+						if ( isset( $field[ 'hide-label' ] ) ) {
429
+							if ( $field[ 'hide-label' ] == 1 ) {
430
+								$custom_classes[ ] = 'field-no-label';
431 431
 							}
432 432
 						}
433 433
 
434 434
 					/* Store tag variable based on field type */
435
-					if( isset( $field['merge'] ) ) {
435
+					if ( isset( $field[ 'merge' ] ) ) {
436 436
 						$tag = 'merge';
437 437
 					} else {
438 438
 						$tag = 'group_id';
439 439
 					}
440 440
 
441 441
 					// build up our array
442
-					$field_array['id'] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[$tag] ) . '" ';
443
-					$field_array['name'] = 'name="' . esc_attr( $field[$tag] ) . '" ';
444
-					$field_array['placeholder'] = isset( $field['placeholder'] ) ? 'placeholder="' . esc_attr( stripslashes( $field['placeholder'] ) ) . '" ' : '';
445
-					$field_array['classes'] = 'class="yikes-easy-mc-'.$field['type'] . ' ' .  esc_attr( trim( implode( ' ' , $custom_classes ) ) ) . '" ';
442
+					$field_array[ 'id' ] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[ $tag ] ) . '" ';
443
+					$field_array[ 'name' ] = 'name="' . esc_attr( $field[ $tag ] ) . '" ';
444
+					$field_array[ 'placeholder' ] = isset( $field[ 'placeholder' ] ) ? 'placeholder="' . esc_attr( stripslashes( $field[ 'placeholder' ] ) ) . '" ' : '';
445
+					$field_array[ 'classes' ] = 'class="yikes-easy-mc-' . $field[ 'type' ] . ' ' . esc_attr( trim( implode( ' ', $custom_classes ) ) ) . '" ';
446 446
 
447 447
 					// email must always be required and visible
448
-					if( $field['type'] == 'email' ) {
449
-						$field_array['required'] = 'required="required"';
450
-						$label_array['visible'] = '';
448
+					if ( $field[ 'type' ] == 'email' ) {
449
+						$field_array[ 'required' ] = 'required="required"';
450
+						$label_array[ 'visible' ] = '';
451 451
 						// $label_array['required'] = 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"';
452
-						$label_class_array[] = $field['merge'] . '-label';
453
-						$label_class_array[] = 'yikes-mailchimp-field-required';
452
+						$label_class_array[ ] = $field[ 'merge' ] . '-label';
453
+						$label_class_array[ ] = 'yikes-mailchimp-field-required';
454 454
 					} else {
455
-						if( $tag == 'merge' ) {
456
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
457
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
455
+						if ( $tag == 'merge' ) {
456
+							$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
457
+							$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
458 458
 							// $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['merge'] . '-label"';
459
-							$label_class_array[] = isset( $field['require'] ) ? $field['merge'] . '-label yikes-mailchimp-field-required' : $field['merge'] . '-label';
459
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'merge' ] . '-label yikes-mailchimp-field-required' : $field[ 'merge' ] . '-label';
460 460
 						} else {
461
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
462
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
461
+							$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
462
+							$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
463 463
 							// $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['group_id'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['group_id'] . '-label"';
464
-							$label_class_array[] = isset( $field['require'] ) ? $field['group_id'] . '-label yikes-mailchimp-field-required' : $field['group_id'] . '-label';
464
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'group_id' ] . '-label yikes-mailchimp-field-required' : $field[ 'group_id' ] . '-label';
465 465
 						}
466 466
 					}
467 467
 
468 468
 					// if both hide label and hide field are checked, we gotta hide the field!
469
-					if( isset( $field['hide' ] ) && $field['hide'] == 1 ) {
470
-						if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) {
471
-							$field_array['visible'] = 'style="display:none;"';
469
+					if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) {
470
+						if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) {
471
+							$field_array[ 'visible' ] = 'style="display:none;"';
472 472
 						}
473 473
 					}
474 474
 
475
-					$label_array['classes'] = 'class="' . implode( ' ', $label_class_array ) . '"';
475
+					$label_array[ 'classes' ] = 'class="' . implode( ' ', $label_class_array ) . '"';
476 476
 
477 477
 					// filter the field array data
478 478
 					$field_array = apply_filters( 'yikes-mailchimp-field-data', $field_array, $field, $form_id );
479 479
 
480 480
 					/* Loop Over Standard Fields (aka merge variables) */
481
-					if( isset( $field['merge'] ) ) {
481
+					if ( isset( $field[ 'merge' ] ) ) {
482 482
 
483 483
 						// loop over our fields by Type
484
-						switch ( $field['type'] ) {
484
+						switch ( $field[ 'type' ] ) {
485 485
 
486 486
 							default:
487 487
 							case 'email':
@@ -489,22 +489,22 @@  discard block
 block discarded – undo
489 489
 							case 'number':
490 490
 
491 491
 								// pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type)
492
-								$default_value = esc_attr( apply_filters( 'yikes-mailchimp-process-default-tag' , $field['default'] ) );
492
+								$default_value = esc_attr( apply_filters( 'yikes-mailchimp-process-default-tag', $field[ 'default' ] ) );
493 493
 
494 494
 									?>
495
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
495
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
496 496
 
497 497
 										<!-- dictate label visibility -->
498
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
499
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
500
-												<?php if( ! isset( $field['hide-label'] ) ) { echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ), $form_id ); } ?>
498
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
499
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
500
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ), $form_id ); } ?>
501 501
 											</span>
502 502
 										<?php } ?>
503 503
 
504
-										<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 ); } ?>">
504
+										<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 ); } ?>">
505 505
 
506 506
 										<!-- description -->
507
-										<?php if( isset( $field['description'] ) ) { ?><p class="form-field-description"><small><?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?></small></p><?php } ?>
507
+										<?php if ( isset( $field[ 'description' ] ) ) { ?><p class="form-field-description"><small><?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?></small></p><?php } ?>
508 508
 
509 509
 									</label>
510 510
 									<?php
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 
514 514
 							case 'url':
515 515
 							case 'imageurl':
516
-								$default_value = $field['default'];
516
+								$default_value = $field[ 'default' ];
517 517
 									?>
518 518
 
519 519
 									<script type="text/javascript">
@@ -525,19 +525,19 @@  discard block
 block discarded – undo
525 525
 										}
526 526
 									</script>
527 527
 
528
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
528
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
529 529
 
530 530
 										<!-- dictate label visibility -->
531
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
532
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
533
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
531
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
532
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
533
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
534 534
 											</span>
535 535
 										<?php } ?>
536 536
 
537
-										<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;">
537
+										<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;">
538 538
 
539 539
 										<!-- description -->
540
-										<?php if( isset( $field['description'] ) ) { ?><p class="form-field-description"><small><?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?></small></p><?php } ?>
540
+										<?php if ( isset( $field[ 'description' ] ) ) { ?><p class="form-field-description"><small><?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?></small></p><?php } ?>
541 541
 
542 542
 									</label>
543 543
 									<?php
@@ -545,53 +545,53 @@  discard block
 block discarded – undo
545 545
 							break;
546 546
 
547 547
 							case 'phone':
548
-								$default_value = $field['default'];
549
-								$phone_format = $field['phone_format'];
548
+								$default_value = $field[ 'default' ];
549
+								$phone_format = $field[ 'phone_format' ];
550 550
 								?>
551 551
 									<script type="text/javascript">
552 552
 										/* Replace incorrect values and format it correctly for MailChimp API */
553 553
 										function formatUSPhoneNumber( e ) {
554 554
 											var phone_number = e.value;
555 555
 											var new_phone_number = phone_number.trim().replace( '(' , '' ).replace( ')', '-' ).replace(/(\d\d\d)(\d\d\d)(\d\d\d\d)/, "$1-$2-$3");
556
-											jQuery( '.<?php echo "yikes-easy-mc-".$field['type']; ?>' ).val( new_phone_number );
556
+											jQuery( '.<?php echo "yikes-easy-mc-" . $field[ 'type' ]; ?>' ).val( new_phone_number );
557 557
 										}
558 558
 									</script>
559 559
 
560
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
560
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
561 561
 
562 562
 										<!-- dictate label visibility -->
563
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
564
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
565
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
563
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
564
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
565
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
566 566
 											</span>
567 567
 										<?php } ?>
568 568
 
569
-										<input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $phone_format != 'US' ) { ?>  title="<?php _e( 'International Phone number (eg: #-###-###-####)' , '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 ); } ?>">
569
+										<input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $phone_format != 'US' ) { ?>  title="<?php _e( 'International Phone number (eg: #-###-###-####)', '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 ); } ?>">
570 570
 
571 571
 										<!-- description -->
572
-										<?php if( isset( $field['description'] ) ) { ?><p class="form-field-description"><small><?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', stripslashes( $field['description'] ), $form_id ); ?></small></p><?php } ?>
572
+										<?php if ( isset( $field[ 'description' ] ) ) { ?><p class="form-field-description"><small><?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', stripslashes( $field[ 'description' ] ), $form_id ); ?></small></p><?php } ?>
573 573
 
574 574
 									</label>
575 575
 									<?php
576 576
 							break;
577 577
 
578 578
 							case 'zip':
579
-								$default_value = $field['default'];
579
+								$default_value = $field[ 'default' ];
580 580
 
581 581
 									?>
582
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
582
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
583 583
 
584 584
 									<!-- dictate label visibility -->
585
-									<?php if( ! isset( $field['hide-label'] ) ) { ?>
586
-										<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
587
-											<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
585
+									<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
586
+										<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
587
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
588 588
 										</span>
589 589
 									<?php } ?>
590 590
 
591
-									<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 ); } ?>">
591
+									<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 ); } ?>">
592 592
 
593 593
 									<!-- description -->
594
-									<?php if( isset( $field['description'] ) ) { ?><p class="form-field-description"><small><?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?></small></p><?php } ?>
594
+									<?php if ( isset( $field[ 'description' ] ) ) { ?><p class="form-field-description"><small><?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?></small></p><?php } ?>
595 595
 
596 596
 									</label>
597 597
 									<?php
@@ -600,28 +600,28 @@  discard block
 block discarded – undo
600 600
 
601 601
 							case 'address':
602 602
 								// required fields
603
-								$required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' );
603
+								$required_fields = array( 'addr1' => 'address', 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip', 'country' => 'country' );
604 604
 
605 605
 								// setup the default country value
606 606
 								$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
607 607
 
608 608
 								// store number for looping
609 609
 								$x = 1;
610
-								foreach( $required_fields as $type => $label ) {
610
+								foreach ( $required_fields as $type => $label ) {
611 611
 
612 612
 									// set the field names for the addrress fields
613
-									$field_array['name'] = 'name="'.$field[$tag].'['.$type.']'.'"';
613
+									$field_array[ 'name' ] = 'name="' . $field[ $tag ] . '[' . $type . ']' . '"';
614 614
 
615 615
 									// reset the label classes for left-half/right-half for addresses
616
-									if( isset( $label_array['class'] ) ) {
616
+									if ( isset( $label_array[ 'class' ] ) ) {
617 617
 										if ( $x % 2 == 0 ) {
618
-											$label_array['class'] = str_replace( 'field-left-half', 'field-right-half', $label_array['class'] );
618
+											$label_array[ 'class' ] = str_replace( 'field-left-half', 'field-right-half', $label_array[ 'class' ] );
619 619
 										} else {
620
-											$label_array['class'] = str_replace( 'field-right-half', 'field-left-half', $label_array['class'] );
620
+											$label_array[ 'class' ] = str_replace( 'field-right-half', 'field-left-half', $label_array[ 'class' ] );
621 621
 										}
622 622
 									}
623 623
 
624
-									switch( $type ) {
624
+									switch ( $type ) {
625 625
 
626 626
 										default:
627 627
 										case 'addr1':
@@ -630,17 +630,17 @@  discard block
 block discarded – undo
630 630
 
631 631
 
632 632
 											?>
633
-											<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
633
+											<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
634 634
 
635 635
 												<!-- dictate label visibility -->
636
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
637
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
638
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
636
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
637
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
638
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
639 639
 													</span>
640 640
 												<?php } ?>
641 641
 
642 642
 
643
-												<input <?php echo implode( ' ' , $field_array ); ?> type="text"  value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } ?>">
643
+												<input <?php echo implode( ' ', $field_array ); ?> type="text"  value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } ?>">
644 644
 
645 645
 											</label>
646 646
 											<?php
@@ -650,16 +650,16 @@  discard block
 block discarded – undo
650 650
 										case 'state':
651 651
 
652 652
 											?>
653
-											<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 } ?>>
653
+											<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 } ?>>
654 654
 
655 655
 												<!-- dictate label visibility -->
656
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
657
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
658
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
656
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
657
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
658
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
659 659
 													</span>
660 660
 												<?php } ?>
661 661
 
662
-												<select <?php echo implode( ' ' , $field_array ); ?>>
662
+												<select <?php echo implode( ' ', $field_array ); ?>>
663 663
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-dropdown.php' ); ?>
664 664
 												</select>
665 665
 
@@ -672,15 +672,15 @@  discard block
 block discarded – undo
672 672
 										case 'zip':
673 673
 
674 674
 											?>
675
-											<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 } ?>>
675
+											<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 } ?>>
676 676
 
677
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
678
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
679
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
677
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
678
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
679
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
680 680
 													</span>
681 681
 												<?php } ?>
682 682
 
683
-												<input <?php echo implode( ' ' , $field_array ); ?> type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?' ); ?>" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
683
+												<input <?php echo implode( ' ', $field_array ); ?> type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?' ); ?>" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
684 684
 
685 685
 											</label>
686 686
 											<?php
@@ -718,16 +718,16 @@  discard block
 block discarded – undo
718 718
 												$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
719 719
 											?>
720 720
 
721
-											<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
721
+											<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
722 722
 
723 723
 												<!-- dictate label visibility -->
724
-												<?php if( !isset( $field['hide-label'] ) ) { ?>
725
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
726
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
724
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
725
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
726
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
727 727
 													</span>
728 728
 												<?php } ?>
729 729
 
730
-												<select <?php echo implode( ' ' , $field_array ); ?> onchange="checkCountry(this);return false;">
730
+												<select <?php echo implode( ' ', $field_array ); ?> onchange="checkCountry(this);return false;">
731 731
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/country-dropdown.php' ); ?>
732 732
 												</select>
733 733
 											</label>
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 								}
739 739
 
740 740
 								// description
741
-								if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?><p class="form-field-description"><small><?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?></small></p><?php }
741
+								if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?><p class="form-field-description"><small><?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?></small></p><?php }
742 742
 
743 743
 								break;
744 744
 
@@ -746,19 +746,19 @@  discard block
 block discarded – undo
746 746
 							case 'birthday':
747 747
 
748 748
 								// bootstrap datepicker requirements
749
-								wp_enqueue_script( 'bootstrap-hover-dropdown' , YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js' , array( 'jquery' ) );
750
-								wp_enqueue_script( 'bootstrap-datepicker-script' , YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js' , array( 'jquery' , 'bootstrap-hover-dropdown' ) );
751
-								wp_enqueue_style( 'bootstrap-datepicker-styles' , YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
752
-								wp_enqueue_style( 'override-datepicker-styles' , YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css' , array( 'bootstrap-datepicker-styles' ) );
749
+								wp_enqueue_script( 'bootstrap-hover-dropdown', YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js', array( 'jquery' ) );
750
+								wp_enqueue_script( 'bootstrap-datepicker-script', YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js', array( 'jquery', 'bootstrap-hover-dropdown' ) );
751
+								wp_enqueue_style( 'bootstrap-datepicker-styles', YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
752
+								wp_enqueue_style( 'override-datepicker-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css', array( 'bootstrap-datepicker-styles' ) );
753 753
 
754
-								switch ( $field['type'] ) {
754
+								switch ( $field[ 'type' ] ) {
755 755
 									default:
756 756
 									case 'date':
757
-										$date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd/yy';
757
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd/yy';
758 758
 										break;
759 759
 
760 760
 									case 'birthday':
761
-										$date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd';
761
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd';
762 762
 										break;
763 763
 								}
764 764
 								// initialize the datepicker
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
 											padding: .85em .5em !important;
770 770
 										}
771 771
 										<?php
772
-											if( wp_is_mobile() ) {
772
+											if ( wp_is_mobile() ) {
773 773
 												?>
774 774
 												.datepicker-dropdown {
775 775
 													margin-top: 0px;
@@ -805,10 +805,10 @@  discard block
 block discarded – undo
805 805
 												numberOfMonths: 1,
806 806
 												today: '<?php _e( 'Today', 'yikes-inc-easy-mailchimp-extender' ); ?>'
807 807
 											};
808
-											jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').datepicker().on( 'show', function( e ) {
809
-												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'height' );
808
+											jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').datepicker().on( 'show', function( e ) {
809
+												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'height' );
810 810
 												date_picker_height = parseInt( date_picker_height.replace( 'px', '' ) ) + parseInt( 15 ) + 'px';
811
-												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'width' ).replace( 'px', '' );
811
+												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'width' ).replace( 'px', '' );
812 812
 												if( date_picker_width > 500 ) {
813 813
 													date_picker_width = 500;
814 814
 												}
@@ -818,27 +818,27 @@  discard block
 block discarded – undo
818 818
 									</script>
819 819
 								<?php
820 820
 
821
-								$default_value = ( isset( $field_default ) ? esc_attr( $field['default'] ) : '' );
821
+								$default_value = ( isset( $field_default ) ? esc_attr( $field[ 'default' ] ) : '' );
822 822
 								// store empty number for looping
823 823
 								$x = 0;
824 824
 
825 825
 								?>
826
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
826
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
827 827
 
828 828
 										<!-- dictate label visibility -->
829
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
830
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
831
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
829
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
830
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
831
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
832 832
 											</span>
833 833
 										<?php } ?>
834 834
 
835
-										<input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $field['type'] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> placeholder="<?php echo esc_attr( $field['placeholder'] ); ?>" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $field['default'] ); } ?>">
835
+										<input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $field[ 'type' ] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> placeholder="<?php echo esc_attr( $field[ 'placeholder' ] ); ?>" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $field[ 'default' ] ); } ?>">
836 836
 
837 837
 										<!-- description -->
838
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
838
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
839 839
 											<p class="form-field-description">
840 840
 												<small>
841
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
841
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
842 842
 												</small>
843 843
 											</p>
844 844
 										<?php } ?>
@@ -849,36 +849,36 @@  discard block
 block discarded – undo
849 849
 							break;
850 850
 
851 851
 							case 'dropdown':
852
-								$default_value = $field['default_choice'];
852
+								$default_value = $field[ 'default_choice' ];
853 853
 								// store empty number for looping
854 854
 								$x = 0;
855 855
 								// hidden labels
856 856
 
857 857
 									?>
858
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
858
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
859 859
 										<!-- dictate label visibility -->
860
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
861
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
862
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
860
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
861
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
862
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
863 863
 											</span>
864 864
 										<?php } ?>
865 865
 
866
-										<select <?php echo implode( ' ' , $field_array ); ?>>
866
+										<select <?php echo implode( ' ', $field_array ); ?>>
867 867
 											<?php
868 868
 												// decode for looping
869
-												$choices = json_decode( $field['choices'], true );
870
-												foreach( $choices as $choice ) {
871
-													?><option value="<?php echo $choice; ?>" <?php selected( $default_value , $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
869
+												$choices = json_decode( $field[ 'choices' ], true );
870
+												foreach ( $choices as $choice ) {
871
+													?><option value="<?php echo $choice; ?>" <?php selected( $default_value, $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
872 872
 													$x++;
873 873
 												}
874 874
 											?>
875 875
 										</select>
876 876
 
877 877
 										<!-- description -->
878
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
878
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
879 879
 											<p class="form-field-description">
880 880
 												<small>
881
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
881
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
882 882
 												</small>
883 883
 											</p>
884 884
 										<?php } ?>
@@ -892,13 +892,13 @@  discard block
 block discarded – undo
892 892
 							case 'radio':
893 893
 							case 'checkbox':
894 894
 								// remove the ID (as to not assign the same ID to every radio button)
895
-								unset( $field_array['id'] );
896
-								$choices = json_decode( $field['choices'], true );
895
+								unset( $field_array[ 'id' ] );
896
+								$choices = json_decode( $field[ 'choices' ], true );
897 897
 								// assign a default choice
898
-								$default_value = ( isset( $field['default_choice'] ) && $field['default_choice'] != '' ) ? $field['default_choice'] : $choices[0];
898
+								$default_value = ( isset( $field[ 'default_choice' ] ) && $field[ 'default_choice' ] != '' ) ? $field[ 'default_choice' ] : $choices[ 0 ];
899 899
 								// if the form was submit, but failed, let's reset the post data
900
-								if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) {
901
-									$default_value = $_POST[$field['merge']];
900
+								if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) {
901
+									$default_value = $_POST[ $field[ 'merge' ] ];
902 902
 								}
903 903
 								$count = count( $choices );
904 904
 								$i = 1;
@@ -907,20 +907,20 @@  discard block
 block discarded – undo
907 907
 								// hidden labels
908 908
 
909 909
 									?>
910
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
910
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
911 911
 
912 912
 										<!-- dictate label visibility -->
913
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
914
-											<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?> checkbox-parent-label">
915
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
913
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
914
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?> checkbox-parent-label">
915
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
916 916
 											</span>
917 917
 										<?php }
918 918
 
919
-										foreach( $choices as $choice ) {
919
+										foreach ( $choices as $choice ) {
920 920
 											?>
921
-											<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']; } ?>>
922
-												<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 ); ?>">
923
-												<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
921
+											<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' ]; } ?>>
922
+												<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 ); ?>">
923
+												<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
924 924
 											</label>
925 925
 											<?php
926 926
 											$i++;
@@ -928,10 +928,10 @@  discard block
 block discarded – undo
928 928
 										}
929 929
 
930 930
 										// description
931
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
931
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
932 932
 											<p class="form-field-description">
933 933
 												<small>
934
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
934
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
935 935
 												</small>
936 936
 											</p>
937 937
 										<?php } ?>
@@ -947,26 +947,26 @@  discard block
 block discarded – undo
947 947
 
948 948
 
949 949
 						// store default choice
950
-						$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'] : '' );
950
+						$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' ] : '' );
951 951
 
952 952
 						// if the form was submit, but failed, let's reset the post data
953
-						if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
954
-							$default_choice = $_POST[$field['group_id']];
953
+						if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
954
+							$default_choice = $_POST[ $field[ 'group_id' ] ];
955 955
 						}
956 956
 
957 957
 						// get our groups
958
-						$groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( $field['groups'], true ) : array();
958
+						$groups = ( isset( $field[ 'groups' ] ) && ! empty( $field[ 'groups' ] ) ) ? json_decode( $field[ 'groups' ], true ) : array();
959 959
 
960 960
 						$count = count( $groups );
961 961
 
962
-						if( $field['type'] == 'checkboxes' ) {
962
+						if ( $field[ 'type' ] == 'checkboxes' ) {
963 963
 							$type = 'checkbox';
964
-						} else if( $field['type'] == 'radio' ) {
964
+						} else if ( $field[ 'type' ] == 'radio' ) {
965 965
 							$type = 'radio';
966 966
 						}
967 967
 
968 968
 						// loop over the interest group field types
969
-						switch ( $field['type'] ) {
969
+						switch ( $field[ 'type' ] ) {
970 970
 
971 971
 							case 'checkboxes':
972 972
 							case 'radio':
@@ -974,18 +974,18 @@  discard block
 block discarded – undo
974 974
 								$x = 1; // used to find the last item of our array
975 975
 
976 976
 									?>
977
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
978
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
977
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
978
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
979 979
 											<!-- dictate label visibility -->
980
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label">
981
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
980
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label">
981
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
982 982
 											</span>
983 983
 									<?php
984 984
 										}
985 985
 
986 986
 										// Display Submission Errors
987
-										if( ! empty( $missing_required_checkbox_interest_groups ) ) {
988
-											if( in_array( $field['group_id'], $missing_required_checkbox_interest_groups ) ) {
987
+										if ( ! empty( $missing_required_checkbox_interest_groups ) ) {
988
+											if ( in_array( $field[ 'group_id' ], $missing_required_checkbox_interest_groups ) ) {
989 989
 												?>
990 990
 													<p class="yikes-mailchimp-required-interest-group-error">
991 991
 														<?php echo apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); ?>
@@ -996,19 +996,19 @@  discard block
 block discarded – undo
996 996
 
997 997
 
998 998
 
999
-										foreach( $groups as $group ) {
1000
-											if( $field['type'] == 'checkboxes' ) {
999
+										foreach ( $groups as $group ) {
1000
+											if ( $field[ 'type' ] == 'checkboxes' ) {
1001 1001
 												/* Setup the defaults for this field - varies if the field was previously submitted */
1002
-												if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
1003
-													$default_choice = $_POST[$field['group_id']];
1004
-												} elseif( ( ! isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted != 1 ) || ( isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted == 1 ) ) {
1005
-													$default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : array();
1002
+												if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
1003
+													$default_choice = $_POST[ $field[ 'group_id' ] ];
1004
+												} elseif ( ( ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 ) || ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 ) ) {
1005
+													$default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : array();
1006 1006
 												}
1007 1007
 											}
1008 1008
 											?>
1009
-											<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 } ?>">
1010
-												<input <?php if( isset( $field['require'] ) && $field['require'] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="<?php echo $field['group_id']; ?>[]" id="<?php echo $field['group_id'] . '-' . $i; ?>" <?php if( $field['type'] == 'checkboxes' ) { if( ( ( isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i , $default_choice )) || ! isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i , $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[$field['group_id']] ) ) && in_array( esc_attr( $group['name'] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[0] : $default_choice , $i ); } ?> value="<?php echo esc_attr( $group['name'] ); ?>">
1011
-												<?php echo $group['name']; ?>
1009
+											<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 } ?>">
1010
+												<input <?php if ( isset( $field[ 'require' ] ) && $field[ 'require' ] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="<?php echo $field[ 'group_id' ]; ?>[]" id="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" <?php if ( $field[ 'type' ] == 'checkboxes' ) { if ( ( ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i, $default_choice ) ) || ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i, $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[ $field[ 'group_id' ] ] ) ) && in_array( esc_attr( $group[ 'name' ] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[ 0 ] : $default_choice, $i ); } ?> value="<?php echo esc_attr( $group[ 'name' ] ); ?>">
1011
+												<?php echo $group[ 'name' ]; ?>
1012 1012
 											</label>
1013 1013
 											<?php
1014 1014
 											$i++;
@@ -1016,10 +1016,10 @@  discard block
 block discarded – undo
1016 1016
 										}
1017 1017
 
1018 1018
 										// description
1019
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1019
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1020 1020
 											<p class="form-field-description">
1021 1021
 												<small>
1022
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1022
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1023 1023
 												</small>
1024 1024
 											</p>
1025 1025
 										<?php } ?>
@@ -1033,28 +1033,28 @@  discard block
 block discarded – undo
1033 1033
 
1034 1034
 									?>
1035 1035
 
1036
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1036
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1037 1037
 										<!-- dictate label visibility -->
1038
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1039
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>">
1040
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1038
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1039
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?>">
1040
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
1041 1041
 											</span>
1042 1042
 										<?php } ?>
1043 1043
 
1044
-										<select <?php echo implode( ' ' , $field_array ); ?>>
1044
+										<select <?php echo implode( ' ', $field_array ); ?>>
1045 1045
 											<?php
1046 1046
 												$i = 0;
1047
-												foreach( $groups as $group ) {
1048
-													?><option <?php selected( $i , $default_choice ); ?> value="<?php echo $group['name']; ?>"><?php echo esc_attr( $group['name'] ); ?></option><?php
1047
+												foreach ( $groups as $group ) {
1048
+													?><option <?php selected( $i, $default_choice ); ?> value="<?php echo $group[ 'name' ]; ?>"><?php echo esc_attr( $group[ 'name' ] ); ?></option><?php
1049 1049
 													$i++;
1050 1050
 												}
1051 1051
 											?>
1052 1052
 										</select>
1053 1053
 
1054
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1054
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1055 1055
 											<p class="form-field-description">
1056 1056
 												<small>
1057
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1057
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1058 1058
 												</small>
1059 1059
 											</p>
1060 1060
 										<?php } ?>
@@ -1071,21 +1071,21 @@  discard block
 block discarded – undo
1071 1071
 
1072 1072
 									?>
1073 1073
 
1074
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1074
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1075 1075
 
1076 1076
 										<!-- dictate label visibility -->
1077
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1078
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1079
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
1077
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1078
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1079
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
1080 1080
 											</span>
1081 1081
 										<?php }
1082 1082
 
1083 1083
 
1084
-										foreach( $groups as $group ) {
1084
+										foreach ( $groups as $group ) {
1085 1085
 											?>
1086
-											<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;">
1087
-												<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'] ); ?>">
1088
-												<?php echo esc_attr( stripslashes( str_replace( '~' , '\'', $group['name'] ) ) ); ?>
1086
+											<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;">
1087
+												<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' ] ); ?>">
1088
+												<?php echo esc_attr( stripslashes( str_replace( '~', '\'', $group[ 'name' ] ) ) ); ?>
1089 1089
 											</label>
1090 1090
 											<?php
1091 1091
 											$i++;
@@ -1093,10 +1093,10 @@  discard block
 block discarded – undo
1093 1093
 										}
1094 1094
 
1095 1095
 										// description
1096
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1096
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1097 1097
 											<p class="form-field-description">
1098 1098
 												<small>
1099
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
1099
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
1100 1100
 												</small>
1101 1101
 											</p>
1102 1102
 										<?php }
@@ -1113,11 +1113,11 @@  discard block
 block discarded – undo
1113 1113
 				do_action( 'yikes-mailchimp-additional-form-fields', $form_data );
1114 1114
 
1115 1115
 				/* if we've enabled reCAPTCHA protection */
1116
-				if( isset( $recaptcha_box ) ) {
1116
+				if ( isset( $recaptcha_box ) ) {
1117 1117
 					echo $recaptcha_box;
1118 1118
 				}
1119
-				if( is_user_logged_in() ) {
1120
-					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1119
+				if ( is_user_logged_in() ) {
1120
+					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1121 1121
 				} else {
1122 1122
 					$admin_class = '';
1123 1123
 				}
@@ -1127,23 +1127,23 @@  discard block
 block discarded – undo
1127 1127
 				<input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot" value="">
1128 1128
 
1129 1129
 				<!-- List ID -->
1130
-				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_settings['list_id']; ?>">
1130
+				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_settings[ 'list_id' ]; ?>">
1131 1131
 
1132 1132
 				<!-- Form that is being submitted! Used to display error/success messages above the correct form -->
1133 1133
 				<input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form" value="<?php echo $form_id; ?>">
1134 1134
 
1135 1135
 				<!-- Submit Button -->
1136 1136
 				<?php
1137
-					if( $form_inline ) {
1137
+					if ( $form_inline ) {
1138 1138
 						echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="empty-label">&nbsp;</span>';
1139 1139
 					}
1140 1140
 					// display the image or text based button
1141
-					if( $submit_button_type == 'text' ) {
1142
-						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'] );
1141
+					if ( $submit_button_type == 'text' ) {
1142
+						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' ] );
1143 1143
 					} else {
1144
-						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'] );
1144
+						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' ] );
1145 1145
 					}
1146
-					if( $form_inline ) {
1146
+					if ( $form_inline ) {
1147 1147
 						echo '</label>';
1148 1148
 					}
1149 1149
 				?>
@@ -1155,8 +1155,8 @@  discard block
 block discarded – undo
1155 1155
 
1156 1156
 		<?php
1157 1157
 			/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
1158
-			if( is_user_logged_in() ) {
1159
-				if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
1158
+			if ( is_user_logged_in() ) {
1159
+				if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
1160 1160
 					echo $edit_form_link;
1161 1161
 				}
1162 1162
 			}
@@ -1171,16 +1171,16 @@  discard block
 block discarded – undo
1171 1171
 		*	Update the impressions count
1172 1172
 		*	for non-admins
1173 1173
 		*/
1174
-		if( !current_user_can( 'manage_options' ) ) {
1175
-			$form_data['impressions']++;
1174
+		if ( ! current_user_can( 'manage_options' ) ) {
1175
+			$form_data[ 'impressions' ]++;
1176 1176
 			$wpdb->update(
1177 1177
 				$wpdb->prefix . 'yikes_easy_mc_forms',
1178 1178
 					array(
1179
-						'impressions' => $form_data['impressions'],
1179
+						'impressions' => $form_data[ 'impressions' ],
1180 1180
 					),
1181 1181
 					array( 'ID' => $form ),
1182 1182
 					array(
1183
-						'%d',	// send welcome email
1183
+						'%d', // send welcome email
1184 1184
 					),
1185 1185
 					array( '%d' )
1186 1186
 				);
Please login to merge, or discard this patch.