Completed
Push — staging ( d90c8e...d11d64 )
by
unknown
04:15
created
public/classes/process/class.process_form_submission_handler.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
 		$this->handle_updating_existing_user_link_message     = __( 'To update your MailChimp profile, please click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' );
256 256
 		$this->handle_empty_required_field_message            = __( 'A required field is missing.', 'yikes-inc-easy-mailchimp-extender' );
257 257
 		$this->handle_empty_required_interest_group_message   = __( 'A required interest group is missing.', 'yikes-inc-easy-mailchimp-extender' );
258
-		$this->handle_nonce_message                           = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.' , 'yikes-inc-easy-mailchimp-extender' );
258
+		$this->handle_nonce_message                           = __( 'Error: Sorry, the nonce security check didn\'t pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.', 'yikes-inc-easy-mailchimp-extender' );
259 259
 		$this->handle_non_filled_recaptcha_message_message    = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' );
260 260
 		$this->generic_recaptcha_error_message                = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' );
261 261
 
262 262
 		// Define our success messages
263
-		$this->default_response_single_optin_success_message  = __( 'Thank you for subscribing!' , 'yikes-inc-easy-mailchimp-extender' );
264
-		$this->default_response_double_optin_success_message  = __( 'Thank you for subscribing. Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' );
263
+		$this->default_response_single_optin_success_message  = __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' );
264
+		$this->default_response_double_optin_success_message  = __( 'Thank you for subscribing. Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' );
265 265
 		$this->existing_subscriber_profile_update_message     = __( 'Thank you for already being a subscriber! Your profile info has been updated.', 'yikes-inc-easy-mailchimp-extender' );
266 266
 	}
267 267
 
@@ -373,16 +373,16 @@  discard block
 block discarded – undo
373 373
 			}
374 374
 
375 375
 			// Check if the current iteration has a 'date_format' key set (i.e. date/birthday fields)
376
-			if ( isset( $form_fields[ $merge_tag ]['date_format'] ) ) {
377
-				$sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ]['date_format'] );
376
+			if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) {
377
+				$sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ][ 'date_format' ] );
378 378
 			}
379 379
 
380 380
 			$merge_variables[ $merge_tag ] = $sanitized;
381 381
 		}
382 382
 
383 383
 		// Make sure we send the lower-cased, sanitized email so it matches the one we're sending in the body of the request.
384
-		if ( isset( $merge_variables['EMAIL'] ) ) {
385
-			$merge_variables['EMAIL'] = $this->email;
384
+		if ( isset( $merge_variables[ 'EMAIL' ] ) ) {
385
+			$merge_variables[ 'EMAIL' ] = $this->email;
386 386
 		}
387 387
 
388 388
 		/**
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 		if ( count( $pieces ) === 3 ) {
460 460
 
461 461
 			// $pieces[1] = MM. $pieces[0] = DD. $date = MM/DD/YYYY
462
-			$date = $pieces[1] . '/' . $pieces[0] . '/' . $pieces[2];
462
+			$date = $pieces[ 1 ] . '/' . $pieces[ 0 ] . '/' . $pieces[ 2 ];
463 463
 		}
464 464
 
465 465
 		return $date;
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 		if ( count( $pieces ) === 2 ) {
485 485
 
486 486
 			// $pieces[1] = MM. $pieces[0] = DD. $birthday = MM/DD
487
-			$birthday = $pieces[1] . '/' . $pieces[0];
487
+			$birthday = $pieces[ 1 ] . '/' . $pieces[ 0 ];
488 488
 		}
489 489
 
490 490
 		return $birthday;
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 			// Loop through the interest groups and create a single array like {group_id} => false
518 518
 			foreach ( $interest_groupings as $group_data ) {
519 519
 
520
-				foreach ( $group_data['items'] as $item ) {
521
-					$groups[$item['id']] = false;
520
+				foreach ( $group_data[ 'items' ] as $item ) {
521
+					$groups[ $item[ 'id' ] ] = false;
522 522
 				}
523 523
 
524 524
 			}
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 		do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications );
632 632
 
633 633
 		// Get the optin value
634
-		$optin = isset( $optin_settings['optin'] ) ? (int) $optin_settings['optin'] : 0;
634
+		$optin = isset( $optin_settings[ 'optin' ] ) ? (int) $optin_settings[ 'optin' ] : 0;
635 635
 
636 636
 		if ( 1 === $optin ) {
637 637
 
@@ -661,13 +661,13 @@  discard block
 block discarded – undo
661 661
 
662 662
 		// Construct our success array variables
663 663
 		$return_success_array = array(
664
-			'hide'        		=> $submission_settings['hide_form_post_signup'],
664
+			'hide'        		=> $submission_settings[ 'hide_form_post_signup' ],
665 665
 			'error'       		=> 0,
666 666
 			'response'    		=> $response_message,
667
-			'redirection' 		=> $redirect_array['redirection'],
668
-			'redirect'    		=> $redirect_array['redirect'],
669
-			'new_window' 		=> $redirect_array['new_window'],
670
-			'redirect_timer'	=> $redirect_array['redirect_timer'],
667
+			'redirection' 		=> $redirect_array[ 'redirection' ],
668
+			'redirect'    		=> $redirect_array[ 'redirect' ],
669
+			'new_window' 		=> $redirect_array[ 'new_window' ],
670
+			'redirect_timer'	=> $redirect_array[ 'redirect_timer' ],
671 671
 		);
672 672
 
673 673
 		// Return success array
@@ -689,12 +689,12 @@  discard block
 block discarded – undo
689 689
 		$details    = '';
690 690
 
691 691
 		// Loop through the error data and retrieve any fields and messages
692
-		if ( isset( $error_data['data'] ) ) {
693
-			foreach ( $error_data['data'] as $datum ) {
694
-				if ( ! isset( $datum['field'], $datum['message'] ) ) {
692
+		if ( isset( $error_data[ 'data' ] ) ) {
693
+			foreach ( $error_data[ 'data' ] as $datum ) {
694
+				if ( ! isset( $datum[ 'field' ], $datum[ 'message' ] ) ) {
695 695
 					continue;
696 696
 				}
697
-				$details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum['field'] ]['label'], $datum['message'] );
697
+				$details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum[ 'field' ] ][ 'label' ], $datum[ 'message' ] );
698 698
 			}
699 699
 		}
700 700
 
@@ -737,21 +737,21 @@  discard block
 block discarded – undo
737 737
 		$missing_fields = array();
738 738
 
739 739
 		// Loop through submitted form data
740
-		foreach( $data as $merge_tag => $value ) {
740
+		foreach ( $data as $merge_tag => $value ) {
741 741
 
742 742
 			// Skip interest groups
743
-			if ( isset( $form_fields[ $merge_tag ]['group_id'] ) ) {
743
+			if ( isset( $form_fields[ $merge_tag ][ 'group_id' ] ) ) {
744 744
 				continue;
745 745
 			}
746 746
 
747 747
 			// check if this field is required
748
-			if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ]['require'] ) && $form_fields[ $merge_tag ]['require'] === '1' ) {
748
+			if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ][ 'require' ] ) && $form_fields[ $merge_tag ][ 'require' ] === '1' ) {
749 749
 
750 750
 				// Check if the field(s) are empty
751 751
 				if ( is_array( $value ) ) {
752 752
 
753 753
 					// Loop through the data and check if any are empty
754
-					foreach( $value as $field => $val ) {
754
+					foreach ( $value as $field => $val ) {
755 755
 
756 756
 						/**
757 757
 						*	'yikes-mailchimp-ignore-required-array-field'
@@ -770,13 +770,13 @@  discard block
 block discarded – undo
770 770
 
771 771
 							// Set the merge label (e.g. MMERGE6) as the key so we don't get the same field multiple times
772 772
 							// (e.g. For arrays, like an address, where multiple address fields are empty)
773
-							$missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ];
773
+							$missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ];
774 774
 						}
775 775
 					}
776 776
 
777 777
 				} else if ( empty( $value ) ) {
778 778
 					$field_is_missing = true;
779
-					$missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ];
779
+					$missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ];
780 780
 				}
781 781
 			}
782 782
 		}
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 		foreach ( $form_fields as $merge_tag => $field_data ) {
827 827
 
828 828
 			// If an interest group and it's required
829
-			if ( isset( $field_data['group_id'] ) && isset( $field_data['require'] ) && $field_data['require'] === '1' ) {
829
+			if ( isset( $field_data[ 'group_id' ] ) && isset( $field_data[ 'require' ] ) && $field_data[ 'require' ] === '1' ) {
830 830
 				
831 831
 				// Check if it was submitted (meaning, check if it's set in our $data array)
832 832
 				if ( ! isset( $data[ 'group-' . $merge_tag ] ) ) {
@@ -888,30 +888,30 @@  discard block
 block discarded – undo
888 888
 		}
889 889
 
890 890
 		// Construct the API URL
891
-		$url           = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER['REMOTE_ADDR'] );
891
+		$url           = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER[ 'REMOTE_ADDR' ] );
892 892
 		$response      = wp_remote_get( $url );
893
-		$response_body = json_decode( $response['body'], true );
893
+		$response_body = json_decode( $response[ 'body' ], true );
894 894
 
895 895
 		// Set up errors array
896 896
 		$recaptcha_errors = array();
897 897
 
898 898
 		// if we've hit an error, lets return the error!
899
-		if ( true !== $response_body['success'] ) {
899
+		if ( true !== $response_body[ 'success' ] ) {
900 900
 
901
-			if( isset( $response_body['error-codes'] ) ) {
901
+			if ( isset( $response_body[ 'error-codes' ] ) ) {
902 902
 
903 903
 				// Loop through response error codes
904
-				foreach ( $response_body['error-codes'] as $error_code ) {
904
+				foreach ( $response_body[ 'error-codes' ] as $error_code ) {
905 905
 					if ( 'missing-input-response' === $error_code ) {
906 906
 						$error_code = $this->handle_non_filled_recaptcha_message;
907 907
 					}
908 908
 
909 909
 					// Add our error_code to the errors array
910
-					$recaptcha_errors[] = $error_code;
910
+					$recaptcha_errors[ ] = $error_code;
911 911
 				}
912 912
 
913 913
 			} else {
914
-				$recaptcha_errors[] = $this->generic_recaptcha_error_message;
914
+				$recaptcha_errors[ ] = $this->generic_recaptcha_error_message;
915 915
 			}
916 916
 
917 917
 			/**
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 	* @param array | $fields_array | An array of fields to loop through and make sure they're not null
1020 1020
 	*/
1021 1021
 	public function handle_empty_fields_generic( $fields_array ) {
1022
-		foreach( $fields_array as $field ) {
1022
+		foreach ( $fields_array as $field ) {
1023 1023
 			if ( $field === null ) {
1024 1024
 				return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_fields_generic_message );
1025 1025
 			}
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 
1086 1086
 		// Append our 'send-update-email' link and text
1087 1087
 		$response .= $link_start_tag;
1088
-		$response .= 	$this->handle_updating_existing_user_link_message;
1088
+		$response .= $this->handle_updating_existing_user_link_message;
1089 1089
 		$response .= $link_close_tag;
1090 1090
 
1091 1091
 		// Check for a user-defined message
@@ -1108,14 +1108,14 @@  discard block
 block discarded – undo
1108 1108
 	*/
1109 1109
 	protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) {
1110 1110
 
1111
-		switch( $slug ) {
1111
+		switch ( $slug ) {
1112 1112
 			case 'already-subscribed':
1113 1113
 
1114 1114
 				// Check if this error message exists
1115
-				if ( isset( $this->error_messages['already-subscribed'] ) && ! empty( $this->error_messages['already-subscribed'] ) ) {
1115
+				if ( isset( $this->error_messages[ 'already-subscribed' ] ) && ! empty( $this->error_messages[ 'already-subscribed' ] ) ) {
1116 1116
 
1117 1117
 					// Check if the substring (that we replace) '[email]' is located in the string and replace it
1118
-					$response_text = str_replace( '[email]', $this->email, $this->error_messages['already-subscribed'] );
1118
+					$response_text = str_replace( '[email]', $this->email, $this->error_messages[ 'already-subscribed' ] );
1119 1119
 				}
1120 1120
 
1121 1121
 				/**
@@ -1134,13 +1134,13 @@  discard block
 block discarded – undo
1134 1134
 			case 'update-link':
1135 1135
 
1136 1136
 				// Check if this error message exists
1137
-				if ( $data !== false && isset( $this->error_messages['update-link'] ) && ! empty( $this->error_messages['update-link'] ) ) {
1137
+				if ( $data !== false && isset( $this->error_messages[ 'update-link' ] ) && ! empty( $this->error_messages[ 'update-link' ] ) ) {
1138 1138
 
1139 1139
 					// Check if the substring (that we replace) '[link]' is located in the string and replace it
1140
-					$response_text = str_replace( '[link]', $data['link_start_tag'], $this->error_messages['update-link'] );
1140
+					$response_text = str_replace( '[link]', $data[ 'link_start_tag' ], $this->error_messages[ 'update-link' ] );
1141 1141
 
1142 1142
 					// Remove [/link]
1143
-					$response_text = str_replace( '[/link]', $data['link_close_tag'], $response_text );
1143
+					$response_text = str_replace( '[/link]', $data[ 'link_close_tag' ], $response_text );
1144 1144
 				}
1145 1145
 
1146 1146
 				/**
@@ -1159,8 +1159,8 @@  discard block
 block discarded – undo
1159 1159
 			case 'success':
1160 1160
 
1161 1161
 				// 'success' is the user-defined success message for double opt-in
1162
-				if ( isset( $this->error_messages['success'] ) && ! empty( $this->error_messages['success'] ) ) {
1163
-					$response_text = $this->error_messages['success'];
1162
+				if ( isset( $this->error_messages[ 'success' ] ) && ! empty( $this->error_messages[ 'success' ] ) ) {
1163
+					$response_text = $this->error_messages[ 'success' ];
1164 1164
 				}
1165 1165
 
1166 1166
 				/**
@@ -1179,8 +1179,8 @@  discard block
 block discarded – undo
1179 1179
 
1180 1180
 			case 'success-single-optin':
1181 1181
 
1182
-				if ( isset( $this->error_messages['success-single-optin'] ) && ! empty( $this->error_messages['success-single-optin'] ) ) {
1183
-					$response_text = $this->error_messages['success-single-optin'];
1182
+				if ( isset( $this->error_messages[ 'success-single-optin' ] ) && ! empty( $this->error_messages[ 'success-single-optin' ] ) ) {
1183
+					$response_text = $this->error_messages[ 'success-single-optin' ];
1184 1184
 				}
1185 1185
 
1186 1186
 				/**
@@ -1199,8 +1199,8 @@  discard block
 block discarded – undo
1199 1199
 
1200 1200
 			case 'success-resubscribed':
1201 1201
 
1202
-				if ( isset( $this->error_messages['success-resubscribed'] ) && ! empty( $this->error_messages['success-resubscribed'] ) ) {
1203
-					$response_text = $this->error_messages['success-resubscribed'];
1202
+				if ( isset( $this->error_messages[ 'success-resubscribed' ] ) && ! empty( $this->error_messages[ 'success-resubscribed' ] ) ) {
1203
+					$response_text = $this->error_messages[ 'success-resubscribed' ];
1204 1204
 				}
1205 1205
 
1206 1206
 				/**
@@ -1222,8 +1222,8 @@  discard block
 block discarded – undo
1222 1222
 				$original_response_text     = $response_text;
1223 1223
 				$user_defined_response_text = '';
1224 1224
 
1225
-				if ( isset( $this->error_messages['general-error'] ) && ! empty( $this->error_messages['general-error'] ) ) {
1226
-					$user_defined_response_text = $this->error_messages['general-error'];
1225
+				if ( isset( $this->error_messages[ 'general-error' ] ) && ! empty( $this->error_messages[ 'general-error' ] ) ) {
1226
+					$user_defined_response_text = $this->error_messages[ 'general-error' ];
1227 1227
 				}
1228 1228
 
1229 1229
 				/**
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
 		} else {
1286 1286
 			global $process_submission_response;
1287 1287
 
1288
-			$process_submission_response = isset( $success_array['response'] ) ? $success_array['response'] : ''; // DEFAULT SUCCESS?
1288
+			$process_submission_response = isset( $success_array[ 'response' ] ) ? $success_array[ 'response' ] : ''; // DEFAULT SUCCESS?
1289 1289
 			$process_submission_response = $this->wrap_form_submission_response( $process_submission_response, $is_success = true );
1290 1290
 		}
1291 1291
 	}
@@ -1338,8 +1338,8 @@  discard block
 block discarded – undo
1338 1338
 		// Add additional fields we've been supplied
1339 1339
 		if ( ! empty( $additional_fields ) ) {
1340 1340
 
1341
-			foreach( $additional_fields as $key => $value ) {
1342
-				$response_array[$key] = $value;
1341
+			foreach ( $additional_fields as $key => $value ) {
1342
+				$response_array[ $key ] = $value;
1343 1343
 			}
1344 1344
 		}
1345 1345
 
@@ -1370,20 +1370,20 @@  discard block
 block discarded – undo
1370 1370
 		);
1371 1371
 
1372 1372
 		// Let's confirm we have a value before trying to use it
1373
-		$redirect_setting = isset( $submission_settings['redirect_on_submission'] ) ? $submission_settings['redirect_on_submission'] : false;
1373
+		$redirect_setting = isset( $submission_settings[ 'redirect_on_submission' ] ) ? $submission_settings[ 'redirect_on_submission' ] : false;
1374 1374
 
1375 1375
 		// Check the redirect flag
1376 1376
 		if ( '1' === $redirect_setting ) {
1377 1377
 
1378 1378
 			// Supply return array with default value of 1
1379
-			$redirect_array['redirection']	= 1;
1379
+			$redirect_array[ 'redirection' ] = 1;
1380 1380
 
1381 1381
 			// Let's confirm we have redirect_page/custom_redirect_url/new_window values
1382
-			$redirect_page_setting	 = isset( $submission_settings['redirect_page'] ) ? $submission_settings['redirect_page'] : false;
1383
-			$custom_redirect_setting = isset( $submission_settings['custom_redirect_url'] ) ? $submission_settings['custom_redirect_url'] : false;
1384
-			$redirect_new_window	 = isset( $submission_settings['redirect_new_window'] ) ? $submission_settings['redirect_new_window'] : false;
1382
+			$redirect_page_setting = isset( $submission_settings[ 'redirect_page' ] ) ? $submission_settings[ 'redirect_page' ] : false;
1383
+			$custom_redirect_setting = isset( $submission_settings[ 'custom_redirect_url' ] ) ? $submission_settings[ 'custom_redirect_url' ] : false;
1384
+			$redirect_new_window = isset( $submission_settings[ 'redirect_new_window' ] ) ? $submission_settings[ 'redirect_new_window' ] : false;
1385 1385
 
1386
-			$redirect_array['new_window'] = $redirect_new_window;
1386
+			$redirect_array[ 'new_window' ] = $redirect_new_window;
1387 1387
 
1388 1388
 			// Check if we're redirecting to a custom_url or just the redirect_page
1389 1389
 			$redirect_url = ( 'custom_url' !== $redirect_page_setting ) ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting;
@@ -1408,9 +1408,9 @@  discard block
 block discarded – undo
1408 1408
 			*/
1409 1409
 			$redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $default_redirect_time_ms, $form_id );
1410 1410
 
1411
-			$redirect_array['redirect_timer'] = $redirect_timer;
1411
+			$redirect_array[ 'redirect_timer' ] = $redirect_timer;
1412 1412
 
1413
-			$redirect_array['redirect'] = $redirect_url;
1413
+			$redirect_array[ 'redirect' ] = $redirect_url;
1414 1414
 		}
1415 1415
 
1416 1416
 		return $redirect_array;
Please login to merge, or discard this patch.
public/partials/shortcodes/process_form_shortcode.php 1 patch
Spacing   +285 added lines, -285 removed lines patch added patch discarded remove patch
@@ -30,39 +30,39 @@  discard block
 block discarded – undo
30 30
 	$form_submitted = isset( $form_submitted ) ? $form_submitted : 0;
31 31
 
32 32
 	/* If the user hasn't authenticated yet, lets kill off */
33
-	if ( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) {
34
-		return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key." , 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
33
+	if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) {
34
+		return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key.", 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
35 35
 	}
36 36
 
37 37
 	// if the user forgot to specify a form ID, lets kill of and warn them.
38
-	if( ! $atts['form'] ) {
38
+	if ( ! $atts[ 'form' ] ) {
39 39
 		return __( 'Whoops, it looks like you forgot to specify a form to display.', 'yikes-inc-easy-mailchimp-extender' );
40 40
 	}
41 41
 
42 42
 	// store our variables
43
-	$form_id   = (int) $atts['form']; // form id (the id of the form in the database)
43
+	$form_id   = (int) $atts[ 'form' ]; // form id (the id of the form in the database)
44 44
 	$interface = yikes_easy_mailchimp_extender_get_form_interface();
45 45
 	$form_data = $interface->get_form( $form_id );
46 46
 
47 47
 	// confirm we have some results, or return an error
48 48
 	if ( empty( $form_data ) ) {
49
-		return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form." , 'yikes-inc-easy-mailchimp-extender' );
49
+		return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form.", 'yikes-inc-easy-mailchimp-extender' );
50 50
 	}
51 51
 
52 52
 	/*
53 53
 	*	Check if the user wants to use reCAPTCHA Spam Prevention
54 54
 	*/
55
-	if ( get_option( 'yikes-mc-recaptcha-status' , '' ) == '1' ) {
55
+	if ( get_option( 'yikes-mc-recaptcha-status', '' ) == '1' ) {
56 56
 
57 57
 		// Allow users to manually set recaptcha (instead of globally - recaptcha="1"/recaptcha="0" - but still needs to be globally enabled on the settings page).
58
-		if ( $atts['recaptcha'] != '0' ) {
58
+		if ( $atts[ 'recaptcha' ] != '0' ) {
59 59
 
60 60
 			// If either of the Private the Secret key is left blank, we should display an error back to the user.
61
-			if ( get_option( 'yikes-mc-recaptcha-site-key' , '' ) == '' ) {
62
-				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
+			if ( get_option( 'yikes-mc-recaptcha-site-key', '' ) == '' ) {
62
+				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>';
63 63
 			}
64
-			if ( get_option( 'yikes-mc-recaptcha-secret-key' , '' ) == '' ) {
65
-				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
+			if ( get_option( 'yikes-mc-recaptcha-secret-key', '' ) == '' ) {
65
+				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>';
66 66
 			}
67 67
 
68 68
 			$has_recaptcha = true;
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 			$locale_split = explode( '_', $locale );
73 73
 
74 74
 			// Setup reCAPTCHA parameters.
75
-			$lang       = ! empty( $locale_split ) ? $locale_split[0] : $locale;
76
-			$lang       = ! empty( $atts['recaptcha_lang'] ) ? $atts['recaptcha_lang'] : $lang;
77
-			$type       = ! empty( $atts['recaptcha_type'] ) ? strtolower( $atts['recaptcha_type'] ) : 'image'; // setup recaptcha type
78
-			$theme      = ! empty( $atts['recaptcha_theme'] ) ? strtolower( $atts['recaptcha_theme'] ) : 'light'; // setup recaptcha theme
79
-			$size       = ! empty( $atts['recaptcha_size'] ) ? strtolower( $atts['recaptcha_size'] ) : 'normal'; // setup recaptcha size
80
-			$data_cb    = ! empty( $atts['recaptcha_data_callback'] ) ? $atts['recaptcha_data_callback'] : false; // setup recaptcha size
81
-			$expired_cb = ! empty( $atts['recaptcha_expired_callback'] ) ? $atts['recaptcha_expired_callback'] : false; // setup recaptcha size
75
+			$lang       = ! empty( $locale_split ) ? $locale_split[ 0 ] : $locale;
76
+			$lang       = ! empty( $atts[ 'recaptcha_lang' ] ) ? $atts[ 'recaptcha_lang' ] : $lang;
77
+			$type       = ! empty( $atts[ 'recaptcha_type' ] ) ? strtolower( $atts[ 'recaptcha_type' ] ) : 'image'; // setup recaptcha type
78
+			$theme      = ! empty( $atts[ 'recaptcha_theme' ] ) ? strtolower( $atts[ 'recaptcha_theme' ] ) : 'light'; // setup recaptcha theme
79
+			$size       = ! empty( $atts[ 'recaptcha_size' ] ) ? strtolower( $atts[ 'recaptcha_size' ] ) : 'normal'; // setup recaptcha size
80
+			$data_cb    = ! empty( $atts[ 'recaptcha_data_callback' ] ) ? $atts[ 'recaptcha_data_callback' ] : false; // setup recaptcha size
81
+			$expired_cb = ! empty( $atts[ 'recaptcha_expired_callback' ] ) ? $atts[ 'recaptcha_expired_callback' ] : false; // setup recaptcha size
82 82
 
83 83
 			// Pass the shortcode parameters through a filter.
84 84
 			$recaptcha_shortcode_params = apply_filters( 'yikes-mailchimp-recaptcha-parameters', array(
@@ -88,49 +88,49 @@  discard block
 block discarded – undo
88 88
 				'size'             => $size,
89 89
 				'success_callback' => $data_cb,
90 90
 				'expired_callback' => $expired_cb,
91
-			), $atts['form'] );
91
+			), $atts[ 'form' ] );
92 92
 
93 93
 			// Enqueue Google recaptcha JS.
94
-			wp_register_script( 'google-recaptcha-js' , 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params['language'] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery', 'form-submission-helpers' ) , 'all' );
94
+			wp_register_script( 'google-recaptcha-js', 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params[ 'language' ] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery', 'form-submission-helpers' ), 'all' );
95 95
 			wp_enqueue_script( 'google-recaptcha-js' );
96 96
 
97
-			$recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key' , '' );
98
-			$recaptcha_box      = '<div class="g-recaptcha" data-sitekey="' . esc_attr( $recaptcha_site_key ) . '" data-theme="' . esc_attr( $recaptcha_shortcode_params['theme'] ) . '" data-type="' . esc_attr( $recaptcha_shortcode_params['type'] ) . '" data-size="' . esc_attr( $recaptcha_shortcode_params['size'] ) . '" data-callback="' . esc_attr( $recaptcha_shortcode_params['success_callback'] ) . '" data-expired-callback="' . esc_attr( $recaptcha_shortcode_params['expired_callback'] ) . '"></div>';
97
+			$recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key', '' );
98
+			$recaptcha_box      = '<div class="g-recaptcha" data-sitekey="' . esc_attr( $recaptcha_site_key ) . '" data-theme="' . esc_attr( $recaptcha_shortcode_params[ 'theme' ] ) . '" data-type="' . esc_attr( $recaptcha_shortcode_params[ 'type' ] ) . '" data-size="' . esc_attr( $recaptcha_shortcode_params[ 'size' ] ) . '" data-callback="' . esc_attr( $recaptcha_shortcode_params[ 'success_callback' ] ) . '" data-expired-callback="' . esc_attr( $recaptcha_shortcode_params[ 'expired_callback' ] ) . '"></div>';
99 99
 		}
100 100
 	}
101 101
 
102 102
 	// place our results into a separate variable for easy looping
103
-	$additional_form_settings = ( isset( $form_data['form_settings'] ) ) ? $form_data['form_settings'] : false;
103
+	$additional_form_settings = ( isset( $form_data[ 'form_settings' ] ) ) ? $form_data[ 'form_settings' ] : false;
104 104
 	
105 105
 	// store our options from the additional form settings array
106
-	$form_classes = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-class-names'] : '';
107
-	$inline_form = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-inline-form'] : '';
108
-	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-submit-button-type'] : 'text';
109
-	$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' );
110
-	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings['yikes-easy-mc-submit-button-image'] ) : '';
111
-	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-classes'] ) : '';
106
+	$form_classes = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-class-names' ] : '';
107
+	$inline_form = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-inline-form' ] : '';
108
+	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-submit-button-type' ] : 'text';
109
+	$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' );
110
+	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings[ 'yikes-easy-mc-submit-button-image' ] ) : '';
111
+	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-classes' ] ) : '';
112 112
 
113 113
 	// scheuldes
114
-	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-schedule'] : false;
115
-	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-start'] : '';;
116
-	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-end'] : '';
117
-	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-pending-message'] : '';
118
-	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-expired-message'] : '';
114
+	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-schedule' ] : false;
115
+	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-start' ] : ''; ;
116
+	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-end' ] : '';
117
+	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ] : '';
118
+	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ] : '';
119 119
 
120 120
 	// register required
121
-	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-login-required'] : false;
122
-	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-login-message'] : '';
121
+	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-login-required' ] : false;
122
+	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-login-message' ] : '';
123 123
 
124 124
 	// store number of fields
125
-	$field_count = (int) count( $form_data['fields'] );
125
+	$field_count = (int) count( $form_data[ 'fields' ] );
126 126
 
127 127
 	// confirm we actually have fields, before looping
128
-	if ( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) {
128
+	if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) {
129 129
 		// loop over each field, if it's set to hidden -- subtract it from the field count
130 130
 		// this throws off the layout for inline forms setup below
131
-		foreach ( $form_data['fields'] as $form_field ) {
132
-			if ( isset( $form_field['hide'] ) && (string) $form_field['hide'] === '1' ) {
133
-				$field_count --;
131
+		foreach ( $form_data[ 'fields' ] as $form_field ) {
132
+			if ( isset( $form_field[ 'hide' ] ) && (string) $form_field[ 'hide' ] === '1' ) {
133
+				$field_count--;
134 134
 			}
135 135
 		}
136 136
 	}
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 	*	If login is required, abort
140 140
 	*	@since 6.0.3.8
141 141
 	*/
142
-	if( $form_login_required ) {
143
-		if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
142
+	if ( $form_login_required ) {
143
+		if ( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
144 144
 			ob_start();
145 145
 				?>
146 146
 					<div class="yikes-mailchimp-login-required yikes-mailchimp-form-<?php echo $form_id; ?>-login-required">
@@ -156,19 +156,19 @@  discard block
 block discarded – undo
156 156
 	*	Check if schedule is set for this form
157 157
 	*	@since 6.0.3.8
158 158
 	*/
159
-	if( $form_schedule_state ) {
159
+	if ( $form_schedule_state ) {
160 160
 		// store current date
161 161
 		$current_date = strtotime( current_time( 'm/d/Y g:iA' ) );
162 162
 
163 163
 		// the the current date is less than the form scheduled start date
164
-		if( $current_date < $form_schedule_start ) {
164
+		if ( $current_date < $form_schedule_start ) {
165 165
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_pending_message, $form_id, $form_schedule_start );
166 166
 			return;
167 167
 			// abort
168 168
 		}
169 169
 
170 170
 		// The current date is past or equal to the end date, aka form has now expired
171
-		if( $current_date >= $form_schedule_end ) {
171
+		if ( $current_date >= $form_schedule_end ) {
172 172
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_expired_message, $form_id, $form_schedule_end );
173 173
 			return;
174 174
 			// abort
@@ -177,14 +177,14 @@  discard block
 block discarded – undo
177 177
 
178 178
 	// setup the submit button text
179 179
 	// shortcode parameter takes precedence over option
180
-	$submit = ( ! empty( $atts['submit'] ) ) ? $atts['submit'] : $submit_button_text;
180
+	$submit = ( ! empty( $atts[ 'submit' ] ) ) ? $atts[ 'submit' ] : $submit_button_text;
181 181
 
182 182
 	/*
183 183
 	*	Check for the constant to prevent styles from loading
184 184
 	*	to exclude styles from loading, add `define( 'YIKES_MAILCHIMP_EXCLUDE_STYLES', true );` to functions.php
185 185
 	*	@since 6.0.3.8
186 186
 	*/
187
-	if( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
187
+	if ( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
188 188
 		// enqueue the form styles
189 189
 		wp_enqueue_style( 'yikes-inc-easy-mailchimp-public-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-extender-public.min.css' );
190 190
 	}
@@ -192,19 +192,19 @@  discard block
 block discarded – undo
192 192
 	/**
193 193
 	*	Check for form inline parameter
194 194
 	*/
195
-	$form_inline = ( $atts['inline'] == 1 || $atts['inline'] == 'true' || get_theme_mod( 'form-inline-' . $form_id, '' ) === true ); // form-inline-{$form_id} comes from customizer extension
195
+	$form_inline = ( $atts[ 'inline' ] == 1 || $atts[ 'inline' ] == 'true' || get_theme_mod( 'form-inline-' . $form_id, '' ) === true ); // form-inline-{$form_id} comes from customizer extension
196 196
 	// recheck from our form options
197 197
 	if ( ! $form_inline ) {
198
-		$form_inline = (bool) $additional_form_settings['yikes-easy-mc-inline-form'];
198
+		$form_inline = (bool) $additional_form_settings[ 'yikes-easy-mc-inline-form' ];
199 199
 	}
200 200
 
201 201
 	/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
202
-	if( is_user_logged_in() ) {
203
-		if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
202
+	if ( is_user_logged_in() ) {
203
+		if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
204 204
 			$edit_form_link = '<span class="edit-link">';
205
-			$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts['form'] ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
205
+			$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts[ 'form' ] ) ) . '" title="' . __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data[ 'form_name' ] ) . '">' . __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
206 206
 			$edit_form_link .= '</span>';
207
-			$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts['form'], ucwords( $form_data['form_name'] ) );
207
+			$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts[ 'form' ], ucwords( $form_data[ 'form_name' ] ) );
208 208
 		} else {
209 209
 			$edit_form_link = '';
210 210
 		}
@@ -214,16 +214,16 @@  discard block
 block discarded – undo
214 214
 	// or else MailChimp throws errors at you
215 215
 	// extract our array keys
216 216
 	// @todo Remove array_keys() and in_array() usage here.
217
-	if( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) {
218
-		$array_keys = array_keys( $form_data['fields'] );
217
+	if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) {
218
+		$array_keys = array_keys( $form_data[ 'fields' ] );
219 219
 		// check for EMAIL in that array
220
-		if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) {
221
-			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>';
220
+		if ( ! in_array( 'EMAIL', $array_keys ) && ! in_array( 'email', $array_keys ) ) {
221
+			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>';
222 222
 		}
223 223
 	} else {
224
-		$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
225
-		if( is_user_logged_in() ) {
226
-			if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
224
+		$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
225
+		if ( is_user_logged_in() ) {
226
+			if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
227 227
 				return $error . $edit_form_link;
228 228
 			}
229 229
 		} else {
@@ -316,17 +316,17 @@  discard block
 block discarded – undo
316 316
 		*	Set a custom title using custom_title="lorem ipsum" parameter in the shortcode
317 317
 		*	- This takes precedence over the title set
318 318
 		*/
319
-		if ( $atts['title'] ) {
320
-			if ( ! empty( $atts['custom_title'] ) ) {
319
+		if ( $atts[ 'title' ] ) {
320
+			if ( ! empty( $atts[ 'custom_title' ] ) ) {
321 321
 				/**
322 322
 				 * Filter the title that is displayed through the shortcode.
323 323
 				 *
324 324
 				 * @param string $title   The title to display.
325 325
 				 * @param int    $form_id The form ID.
326 326
 				 */
327
-				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts['custom_title'] ), $form_id );
327
+				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts[ 'custom_title' ] ), $form_id );
328 328
 			} else {
329
-				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data['form_name'] ), $form_id );
329
+				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data[ 'form_name' ] ), $form_id );
330 330
 			}
331 331
 
332 332
 			echo sprintf( '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-%1$s">%2$s</h3>', $form_id, $title );
@@ -336,17 +336,17 @@  discard block
 block discarded – undo
336 336
 		*	Allow users to specify a custom description for this form, no html support
337 337
 		*	@since 6.0.3.8
338 338
 		*/
339
-		if ( $atts['description'] ) {
340
-			if ( ! empty( $atts['custom_description'] ) ) {
339
+		if ( $atts[ 'description' ] ) {
340
+			if ( ! empty( $atts[ 'custom_description' ] ) ) {
341 341
 				/**
342 342
 				 * Filter the description that is displayed through the shortcode.
343 343
 				 *
344 344
 				 * @param string $title   The title to display.
345 345
 				 * @param int    $form_id The form ID.
346 346
 				 */
347
-				$description = apply_filters( 'yikes-mailchimp-form-description', $atts['custom_description'], $form_id );
347
+				$description = apply_filters( 'yikes-mailchimp-form-description', $atts[ 'custom_description' ], $form_id );
348 348
 			} else {
349
-				$description = apply_filters( 'yikes-mailchimp-form-description', $form_data['form_description'], $form_id );
349
+				$description = apply_filters( 'yikes-mailchimp-form-description', $form_data[ 'form_description' ], $form_id );
350 350
 			}
351 351
 
352 352
 			echo sprintf( '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-%1$s">%2$s</section>', $form_id, $description );
@@ -361,10 +361,10 @@  discard block
 block discarded – undo
361 361
 		$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
362 362
 
363 363
 		// Check for AJAX
364
-		if( ( ! empty( $atts['ajax'] ) && $atts['ajax'] == 1 ) || $form_data['submission_settings']['ajax'] == 1 ) {
364
+		if ( ( ! empty( $atts[ 'ajax' ] ) && $atts[ 'ajax' ] == 1 ) || $form_data[ 'submission_settings' ][ 'ajax' ] == 1 ) {
365 365
 
366 366
 			// Enqueue our ajax script
367
-			wp_enqueue_script( 'yikes-easy-mc-ajax' , YIKES_MC_URL . "public/js/yikes-mc-ajax-forms{$min}.js" , array( 'jquery' ), YIKES_MC_VERSION, false );
367
+			wp_enqueue_script( 'yikes-easy-mc-ajax', YIKES_MC_URL . "public/js/yikes-mc-ajax-forms{$min}.js", array( 'jquery' ), YIKES_MC_VERSION, false );
368 368
 			wp_localize_script( 'yikes-easy-mc-ajax', 'yikes_mailchimp_ajax', array(
369 369
 				'ajax_url'                      => esc_url( admin_url( 'admin-ajax.php' ) ),
370 370
 				'page_data'                     => $page_data,
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		}
377 377
 
378 378
 		// Generic JavaScript functions for interacting with the form
379
-		wp_enqueue_script( 'form-submission-helpers', YIKES_MC_URL . "public/js/form-submission-helpers{$min}.js" , array( 'jquery' ), YIKES_MC_VERSION, false );
379
+		wp_enqueue_script( 'form-submission-helpers', YIKES_MC_URL . "public/js/form-submission-helpers{$min}.js", array( 'jquery' ), YIKES_MC_VERSION, false );
380 380
 		wp_localize_script( 'form-submission-helpers', 'form_submission_helpers', array(
381 381
 			'ajax_url'           => esc_url( admin_url( 'admin-ajax.php' ) ),
382 382
 			'preloader_url'      => apply_filters( 'yikes-mailchimp-preloader', esc_url_raw( admin_url( 'images/wpspin_light.gif' ) ) ),
@@ -395,67 +395,67 @@  discard block
 block discarded – undo
395 395
 
396 396
 		// render the form!
397 397
 		?>
398
-			<form id="<?php echo sanitize_title( $form_data['form_name'] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline )  { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if( !empty( $_POST ) && $form_submitted == 1 && $form_data['submission_settings']['hide_form_post_signup'] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" method="POST" data-attr-form-id="<?php echo esc_attr( $form_id ); ?>">
398
+			<form id="<?php echo sanitize_title( $form_data[ 'form_name' ] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if ( ! empty( $_POST ) && $form_submitted == 1 && $form_data[ 'submission_settings' ][ 'hide_form_post_signup' ] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" method="POST" data-attr-form-id="<?php echo esc_attr( $form_id ); ?>">
399 399
 
400 400
 				<?php
401 401
 				// Set a default constant for hidden fields
402 402
 				$hidden_label_count = 0;
403 403
 
404 404
 				// Loop over our form fields
405
-				foreach( $form_data['fields'] as $field ) {
405
+				foreach ( $form_data[ 'fields' ] as $field ) {
406 406
 						// input array
407 407
 						$field_array = array();
408 408
 						// label array
409 409
 						$label_array = array();
410 410
 						// label classes array
411 411
 						$label_class_array = array();
412
-						if( $field['additional-classes'] != '' ) {
412
+						if ( $field[ 'additional-classes' ] != '' ) {
413 413
 							// split custom classes at spaces
414
-							$custom_classes = explode( ' ' , $field['additional-classes'] );
414
+							$custom_classes = explode( ' ', $field[ 'additional-classes' ] );
415 415
 							// check our custom class array for field-left/field-right
416 416
 							// if it's set we need to assign it to our label and remove it from the field classes
417 417
 							 // input half left
418
-							if( in_array( 'field-left-half' , $custom_classes ) ) {
418
+							if ( in_array( 'field-left-half', $custom_classes ) ) {
419 419
 								// $label_array['class'] = 'class="field-left-half"';
420
-								$label_class_array[] = 'field-left-half';
421
-								$key = array_search( 'field-left-half' , $custom_classes );
422
-								unset( $custom_classes[$key] );
420
+								$label_class_array[ ] = 'field-left-half';
421
+								$key = array_search( 'field-left-half', $custom_classes );
422
+								unset( $custom_classes[ $key ] );
423 423
 							} // input half right
424
-							if( in_array( 'field-right-half' , $custom_classes ) ) {
424
+							if ( in_array( 'field-right-half', $custom_classes ) ) {
425 425
 								// $label_array['class'] = 'class="field-right-half"';
426
-								$label_class_array[] = 'field-right-half';
427
-								$key = array_search( 'field-right-half' , $custom_classes );
428
-								unset( $custom_classes[$key] );
426
+								$label_class_array[ ] = 'field-right-half';
427
+								$key = array_search( 'field-right-half', $custom_classes );
428
+								unset( $custom_classes[ $key ] );
429 429
 							} // input thirds (1/3 width, floated left)
430
-							if( in_array( 'field-third' , $custom_classes ) ) {
430
+							if ( in_array( 'field-third', $custom_classes ) ) {
431 431
 								// $label_array['class'] = 'class="field-third"';
432
-								$label_class_array[] = 'field-third';
433
-								$key = array_search( 'field-third' , $custom_classes );
434
-								unset( $custom_classes[$key] );
432
+								$label_class_array[ ] = 'field-third';
433
+								$key = array_search( 'field-third', $custom_classes );
434
+								unset( $custom_classes[ $key ] );
435 435
 							} // 2 column radio
436
-							if( in_array( 'option-2-col' , $custom_classes ) ) {
436
+							if ( in_array( 'option-2-col', $custom_classes ) ) {
437 437
 								// $label_array['class'] = 'class="option-2-col"';
438
-								$label_class_array[] = 'option-2-col';
439
-								$key = array_search( 'option-2-col' , $custom_classes );
440
-								unset( $custom_classes[$key] );
438
+								$label_class_array[ ] = 'option-2-col';
439
+								$key = array_search( 'option-2-col', $custom_classes );
440
+								unset( $custom_classes[ $key ] );
441 441
 							} // 3 column radio
442
-							if( in_array( 'option-3-col' , $custom_classes ) ) {
442
+							if ( in_array( 'option-3-col', $custom_classes ) ) {
443 443
 								// $label_array['class'] = 'class="option-3-col"';
444
-								$label_class_array[] = 'option-3-col';
445
-								$key = array_search( 'option-3-col' , $custom_classes );
446
-								unset( $custom_classes[$key] );
444
+								$label_class_array[ ] = 'option-3-col';
445
+								$key = array_search( 'option-3-col', $custom_classes );
446
+								unset( $custom_classes[ $key ] );
447 447
 							} // 4 column radio
448
-							if( in_array( 'option-4-col' , $custom_classes ) ) {
448
+							if ( in_array( 'option-4-col', $custom_classes ) ) {
449 449
 								// $label_array['class'] = 'class="option-4-col"';
450
-								$label_class_array[] = 'option-4-col';
451
-								$key = array_search( 'option-4-col' , $custom_classes );
452
-								unset( $custom_classes[$key] );
450
+								$label_class_array[ ] = 'option-4-col';
451
+								$key = array_search( 'option-4-col', $custom_classes );
452
+								unset( $custom_classes[ $key ] );
453 453
 							} // inline radio & checkboxes etc
454
-							if( in_array( 'option-inline' , $custom_classes ) ) {
454
+							if ( in_array( 'option-inline', $custom_classes ) ) {
455 455
 								// $label_array['class'] = 'class="option-inline"';
456
-								$label_class_array[] = 'option-inline';
457
-								$key = array_search( 'option-inline' , $custom_classes );
458
-								unset( $custom_classes[$key] );
456
+								$label_class_array[ ] = 'option-inline';
457
+								$key = array_search( 'option-inline', $custom_classes );
458
+								unset( $custom_classes[ $key ] );
459 459
 							}
460 460
 						} else {
461 461
 							$custom_classes = array();
@@ -463,19 +463,19 @@  discard block
 block discarded – undo
463 463
 
464 464
 						// if the form is set to inline, add the inline class to our labels
465 465
 						// since @6.0.3.8
466
-						if( $form_inline ) {
467
-							$label_class_array[] = 'label-inline';
466
+						if ( $form_inline ) {
467
+							$label_class_array[ ] = 'label-inline';
468 468
 						}
469 469
 
470
-						if( isset( $field['hide-label'] ) ) {
471
-							if( absint( $field['hide-label'] ) === 1 ) {
470
+						if ( isset( $field[ 'hide-label' ] ) ) {
471
+							if ( absint( $field[ 'hide-label' ] ) === 1 ) {
472 472
 								$hidden_label_count++;
473
-								$custom_classes[] = 'field-no-label';
473
+								$custom_classes[ ] = 'field-no-label';
474 474
 							}
475 475
 						}
476 476
 
477 477
 					/* Store tag variable based on field type */
478
-					if( isset( $field['merge'] ) ) {
478
+					if ( isset( $field[ 'merge' ] ) ) {
479 479
 						$group = '';
480 480
 						$tag = 'merge';
481 481
 					} else {
@@ -485,28 +485,28 @@  discard block
 block discarded – undo
485 485
 
486 486
 					// build up our array
487 487
 					$field_id_string   = 'yikes-easy-mc-form-' . $form_id . '-' . $field[ $tag ];
488
-					$field_array['id'] = 'id="' . esc_attr( $field_id_string ) . '" ';
489
-					$field_array['name'] = 'name="' . $group . esc_attr( $field[ $tag ] ) . '" ';
490
-					$field_array['placeholder'] = isset( $field['placeholder'] ) ? 'placeholder="' . esc_attr( stripslashes( $field['placeholder'] ) ) . '" ' : '';
491
-					$field_array['classes'] = 'class="yikes-easy-mc-'.$field['type'] . ' ' .  esc_attr( trim( implode( ' ' , $custom_classes ) ) ) . '" ';
488
+					$field_array[ 'id' ] = 'id="' . esc_attr( $field_id_string ) . '" ';
489
+					$field_array[ 'name' ] = 'name="' . $group . esc_attr( $field[ $tag ] ) . '" ';
490
+					$field_array[ 'placeholder' ] = isset( $field[ 'placeholder' ] ) ? 'placeholder="' . esc_attr( stripslashes( $field[ 'placeholder' ] ) ) . '" ' : '';
491
+					$field_array[ 'classes' ] = 'class="yikes-easy-mc-' . $field[ 'type' ] . ' ' . esc_attr( trim( implode( ' ', $custom_classes ) ) ) . '" ';
492 492
 
493 493
 					// email must always be required and visible
494
-					if( $field['type'] == 'email' ) {
495
-						$field_array['required'] = 'required="required"';
496
-						$label_array['visible'] = '';
497
-						$label_class_array[] = $field['merge'] . '-label';
498
-						$label_class_array[] = 'yikes-mailchimp-field-required';
494
+					if ( $field[ 'type' ] == 'email' ) {
495
+						$field_array[ 'required' ] = 'required="required"';
496
+						$label_array[ 'visible' ] = '';
497
+						$label_class_array[ ] = $field[ 'merge' ] . '-label';
498
+						$label_class_array[ ] = 'yikes-mailchimp-field-required';
499 499
 					} else {
500
-						$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
501
-						$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
502
-						$label_class_array[] = ( $tag === 'merge' ) ? $field['merge'] . '-label' : $field['group_id'] . '-label';
503
-						if ( isset( $field['require'] ) ) $label_class_array[] = 'yikes-mailchimp-field-required';
500
+						$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
501
+						$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
502
+						$label_class_array[ ] = ( $tag === 'merge' ) ? $field[ 'merge' ] . '-label' : $field[ 'group_id' ] . '-label';
503
+						if ( isset( $field[ 'require' ] ) ) $label_class_array[ ] = 'yikes-mailchimp-field-required';
504 504
 					}
505 505
 
506 506
 					// if both hide label and hide field are checked, we gotta hide the field!
507
-					if( isset( $field['hide' ] ) && $field['hide'] == 1 ) {
508
-						if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) {
509
-							$field_array['visible'] = 'style="display:none;"';
507
+					if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) {
508
+						if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) {
509
+							$field_array[ 'visible' ] = 'style="display:none;"';
510 510
 						}
511 511
 					}
512 512
 
@@ -514,20 +514,20 @@  discard block
 block discarded – undo
514 514
 					$label_class_array = function_exists( 'sanitize_html_class' ) ? array_map( 'sanitize_html_class', $label_class_array ) : $label_class_array;
515 515
 
516 516
 					// Turn the clases into a string
517
-					$label_array['classes'] = 'class="' . implode( ' ', $label_class_array ) . ' "';
517
+					$label_array[ 'classes' ] = 'class="' . implode( ' ', $label_class_array ) . ' "';
518 518
 
519 519
 					// Filter the field array data
520 520
 					$field_array = apply_filters( 'yikes-mailchimp-field-data', $field_array, $field, $form_id );
521 521
 
522 522
 					/* Loop Over Standard Fields (aka merge variables) */
523
-					if( isset( $field['merge'] ) ) {
523
+					if ( isset( $field[ 'merge' ] ) ) {
524 524
 
525 525
 						// Handle the Description logic in one spot, here:
526
-						$show_description = isset( $field['description'] ) && trim( $field['description'] ) !== '' ? true : false;
527
-						$description_above = isset( $field['description_above'] ) && $field['description_above'] === '1' ? true : false;
526
+						$show_description = isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) !== '' ? true : false;
527
+						$description_above = isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? true : false;
528 528
 						if ( $show_description === true ) {
529
-							$description = '<p class="form-field-description" id="form-field-description-' . $field['merge'] . '">';
530
-							$description .= apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id );
529
+							$description = '<p class="form-field-description" id="form-field-description-' . $field[ 'merge' ] . '">';
530
+							$description .= apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id );
531 531
 							$description .= '</p>';
532 532
 
533 533
 							/**
@@ -539,11 +539,11 @@  discard block
 block discarded – undo
539 539
 							*	@param string | $field['description']	| The field's description text
540 540
 							*	@param int	  | $form_id
541 541
 							*/
542
-							$description = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description-html', $description, esc_attr( stripslashes( $field['description'] ) ), $form_id );
542
+							$description = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description-html', $description, esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id );
543 543
 						}
544 544
 
545 545
 						// loop over our fields by Type
546
-						switch ( $field['type'] ) {
546
+						switch ( $field[ 'type' ] ) {
547 547
 
548 548
 							default:
549 549
 							case 'email':
@@ -551,24 +551,24 @@  discard block
 block discarded – undo
551 551
 							case 'number':
552 552
 
553 553
 								// pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type)
554
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
554
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
555 555
 								$default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value );
556
-								$default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id );
556
+								$default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id );
557 557
 
558 558
 									?>
559
-									<label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
559
+									<label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>>
560 560
 
561 561
 										<!-- dictate label visibility -->
562
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
563
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
564
-												<?php if( ! isset( $field['hide-label'] ) ) { echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ), $form_id ); } ?>
562
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
563
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
564
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ), $form_id ); } ?>
565 565
 											</span>
566 566
 										<?php } ?>
567 567
 
568 568
 										<!-- Description Above -->
569 569
 										<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?>
570 570
 
571
-										<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 esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>">
571
+										<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 esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>">
572 572
 
573 573
 										<!-- Description Below -->
574 574
 										<?php if ( $show_description === true && $description_above === false ) { echo $description; } ?>
@@ -580,23 +580,23 @@  discard block
 block discarded – undo
580 580
 
581 581
 							case 'url':
582 582
 							case 'imageurl':
583
-								$default_value = ( isset( $field['default'] ) ) ? $field['default'] : '';
584
-								$default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id );
583
+								$default_value = ( isset( $field[ 'default' ] ) ) ? $field[ 'default' ] : '';
584
+								$default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id );
585 585
 									?>
586 586
 
587
-									<label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
587
+									<label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>>
588 588
 
589 589
 										<!-- dictate label visibility -->
590
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
591
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
592
-												<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
590
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
591
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
592
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
593 593
 											</span>
594 594
 										<?php } ?>
595 595
 
596 596
 										<!-- Description Above -->
597 597
 										<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?>
598 598
 
599
-										<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 esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>" >
599
+										<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 esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>" >
600 600
 
601 601
 										<!-- Description Below -->
602 602
 										<?php if ( $show_description === true && $description_above === false ) { echo $description; } ?>
@@ -607,24 +607,24 @@  discard block
 block discarded – undo
607 607
 							break;
608 608
 
609 609
 							case 'phone':
610
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
611
-								$default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id );
612
-								$phone_format = $field['phone_format'];
610
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
611
+								$default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id );
612
+								$phone_format = $field[ 'phone_format' ];
613 613
 								?>
614 614
 
615
-									<label for="<?php echo esc_attr( $field_id_string ) ?>" <?php echo implode( ' ' , $label_array ); ?>>
615
+									<label for="<?php echo esc_attr( $field_id_string ) ?>" <?php echo implode( ' ', $label_array ); ?>>
616 616
 
617 617
 										<!-- dictate label visibility -->
618
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
619
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
620
-												<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
618
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
619
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
620
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
621 621
 											</span>
622 622
 										<?php } ?>
623 623
 
624 624
 										<!-- Description Above -->
625 625
 										<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?>
626 626
 
627
-										<input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $phone_format != 'US' ) { ?> data-phone-type="international" title="<?php _e( 'International Phone Number' , 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern' , '[0-9,-,+]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####' , 'yikes-inc-easy-mailchimp-extender' ); ?>" data-phone-type="us" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern' , '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>">
627
+										<input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $phone_format != 'US' ) { ?> data-phone-type="international" title="<?php _e( 'International Phone Number', 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern', '[0-9,-,+]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####', 'yikes-inc-easy-mailchimp-extender' ); ?>" data-phone-type="us" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern', '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>">
628 628
 
629 629
 										<!-- Description Below -->
630 630
 										<?php if ( $show_description === true && $description_above === false ) { echo $description; } ?>
@@ -634,23 +634,23 @@  discard block
 block discarded – undo
634 634
 							break;
635 635
 
636 636
 							case 'zip':
637
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
638
-								$default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id );
637
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
638
+								$default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id );
639 639
 
640 640
 									?>
641
-									<label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
641
+									<label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>>
642 642
 
643 643
 									<!-- dictate label visibility -->
644
-									<?php if( ! isset( $field['hide-label'] ) ) { ?>
645
-										<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
646
-											<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
644
+									<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
645
+										<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
646
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
647 647
 										</span>
648 648
 									<?php } ?>
649 649
 
650 650
 									<!-- Description Above -->
651 651
 									<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?>
652 652
 
653
-									<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 esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>">
653
+									<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 esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>">
654 654
 
655 655
 									<!-- Description Below -->
656 656
 									<?php if ( $show_description === true && $description_above === false ) { echo $description; } ?>
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 							case 'address':
664 664
 
665 665
 								// required fields
666
-								$required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' );
666
+								$required_fields = array( 'addr1' => 'address', 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip', 'country' => 'country' );
667 667
 
668 668
 								/**
669 669
 								* Filter to control the default country (the option pre-selected in the country dropdown).
@@ -679,55 +679,55 @@  discard block
 block discarded – undo
679 679
 								if ( $show_description === true && $description_above === true ) { echo $description; }
680 680
 
681 681
 								// Placeholder logic
682
-								if ( ! empty( $field_array['placeholder'] ) ) {
682
+								if ( ! empty( $field_array[ 'placeholder' ] ) ) {
683 683
 									
684 684
 									$use_address_placeholder = true;
685 685
 
686 686
 									// Don't use the address field's array placeholder - use the custom placeholder
687
-									unset( $field_array['placeholder'] );
687
+									unset( $field_array[ 'placeholder' ] );
688 688
 								}
689 689
 
690 690
 								// store number for looping
691 691
 								$x = 1;
692
-								foreach( $required_fields as $type => $label ) {
692
+								foreach ( $required_fields as $type => $label ) {
693 693
 
694 694
 									// set the field names for the address fields
695
-									$field_array['name'] = 'name="' . $field[$tag] . '[' . $type . ']' . '"';
695
+									$field_array[ 'name' ] = 'name="' . $field[ $tag ] . '[' . $type . ']' . '"';
696 696
 
697 697
 									// Set the placeholder value if we need to
698 698
 									$placeholder = isset( $use_address_placeholder ) ? apply_filters( 'yikes-mailchimp-address-' . $type . '-placeholder', ucwords( $label ) ) : '';
699 699
 
700 700
 									// reset the label classes for left-half/right-half for addresses
701
-									if( isset( $label_array['class'] ) ) {
701
+									if ( isset( $label_array[ 'class' ] ) ) {
702 702
 										if ( $x % 2 == 0 ) {
703
-											$label_array['class'] = str_replace( 'field-left-half', 'field-right-half', $label_array['class'] );
703
+											$label_array[ 'class' ] = str_replace( 'field-left-half', 'field-right-half', $label_array[ 'class' ] );
704 704
 										} else {
705
-											$label_array['class'] = str_replace( 'field-right-half', 'field-left-half', $label_array['class'] );
705
+											$label_array[ 'class' ] = str_replace( 'field-right-half', 'field-left-half', $label_array[ 'class' ] );
706 706
 										}
707 707
 									}
708 708
 
709 709
 									// Never force addr2 to be required
710 710
 									if ( $type === 'addr2' ) {
711
-										$field_array['required'] = apply_filters( 'yikes-mailchimp-address-2-required', '', $form_id );
711
+										$field_array[ 'required' ] = apply_filters( 'yikes-mailchimp-address-2-required', '', $form_id );
712 712
 									}
713 713
 
714
-									switch( $type ) {
714
+									switch ( $type ) {
715 715
 
716 716
 										default:
717 717
 										case 'addr1':
718 718
 										case 'addr2':
719 719
 										case 'city':
720 720
 											?>
721
-											<label for="<?php echo esc_attr( $field['merge'] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
721
+											<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?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 ), $form_id ) ); ?>
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 ), $form_id ) ); ?>
727 727
 													</span>
728 728
 												<?php } ?>
729 729
 												
730
-												<input <?php echo implode( ' ' , $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" value="<?php if( isset( $_POST[$field['merge']][$type] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']][$type] ); } ?>">
730
+												<input <?php echo implode( ' ', $field_array ); ?> placeholder="<?php echo $placeholder; ?>" type="text" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ][ $type ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ][ $type ] ); } ?>">
731 731
 
732 732
 											</label>
733 733
 											<?php
@@ -736,16 +736,16 @@  discard block
 block discarded – undo
736 736
 
737 737
 										case 'state':
738 738
 											?>
739
-											<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="state-dropdown">
739
+											<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="state-dropdown">
740 740
 
741 741
 												<!-- dictate label visibility -->
742
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
743
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
744
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?>
742
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
743
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
744
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?>
745 745
 													</span>
746 746
 												<?php } ?>
747 747
 
748
-													<select <?php echo implode( ' ' , $field_array ); ?>>
748
+													<select <?php echo implode( ' ', $field_array ); ?>>
749 749
 														<?php
750 750
 															$state_and_province_list = file_get_contents( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-and-province-dropdown.php' ); 
751 751
 															/**
@@ -771,21 +771,21 @@  discard block
 block discarded – undo
771 771
 										case 'zip':
772 772
 
773 773
 											?>
774
-											<label for="<?php echo esc_attr( $field['merge'] ); ?>"  placeholder="<?php echo $placeholder; ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="zip-input"<?php if ( ! isset( $countries_with_zip_code_field[ $default_country ] ) ) { ?> style="display: none;"<?php } ?>>
774
+											<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>"  placeholder="<?php echo $placeholder; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="zip-input"<?php if ( ! isset( $countries_with_zip_code_field[ $default_country ] ) ) { ?> style="display: none;"<?php } ?>>
775 775
 
776
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
777
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
778
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?>
776
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
777
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
778
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?>
779 779
 													</span>
780 780
 												<?php } ?>
781 781
 
782 782
 												<?php 
783 783
 													// If zip lookup plugin is installed, the ZIP field comes back as an array and we need to handle it differently...
784
-													if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) {
785
-														if ( is_array( $_POST[$field['merge']] ) && isset( $_POST[$field['merge']]['zip'] ) ) {
786
-															$zip_value = $_POST[$field['merge']]['zip'];
784
+													if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) {
785
+														if ( is_array( $_POST[ $field[ 'merge' ] ] ) && isset( $_POST[ $field[ 'merge' ] ][ 'zip' ] ) ) {
786
+															$zip_value = $_POST[ $field[ 'merge' ] ][ 'zip' ];
787 787
 														} else {
788
-															$zip_value = $_POST[$field['merge']]; 
788
+															$zip_value = $_POST[ $field[ 'merge' ] ]; 
789 789
 														}
790 790
 													} else { 
791 791
 
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 													}
806 806
 												?>
807 807
 
808
-												<input <?php echo implode( ' ' , $field_array ); ?>  placeholder="<?php echo $placeholder; ?>" type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?', $form_id ); ?>" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php echo esc_attr( $zip_value ); ?>">
808
+												<input <?php echo implode( ' ', $field_array ); ?>  placeholder="<?php echo $placeholder; ?>" type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?', $form_id ); ?>" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php echo esc_attr( $zip_value ); ?>">
809 809
 
810 810
 											</label>
811 811
 											<?php
@@ -815,16 +815,16 @@  discard block
 block discarded – undo
815 815
 										case 'country':
816 816
 											?>
817 817
 
818
-											<label for="<?php echo esc_attr( $field['merge'] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
818
+											<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>>
819 819
 
820 820
 												<!-- dictate label visibility -->
821
-												<?php if( !isset( $field['hide-label'] ) ) { ?>
822
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
823
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label' , esc_attr( $label ), $form_id ) ); ?>
821
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
822
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
823
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ), $form_id ) ); ?>
824 824
 													</span>
825 825
 												<?php } ?>
826 826
 
827
-												<select <?php echo implode( ' ' , $field_array ); ?> data-country="true">
827
+												<select <?php echo implode( ' ', $field_array ); ?> data-country="true">
828 828
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/country-dropdown.php' ); ?>
829 829
 												</select>
830 830
 											</label>
@@ -870,40 +870,40 @@  discard block
 block discarded – undo
870 870
 								wp_register_script( 'yikes-datepicker-scripts', YIKES_MC_URL . 'public/js/yikes-datepicker-scripts.min.js', array( 'jquery-ui-datepicker' ), YIKES_MC_VERSION, false );
871 871
 								wp_localize_script( 'yikes-datepicker-scripts', 'datepicker_settings', $datepicker_options );
872 872
 								wp_enqueue_script( 'yikes-datepicker-scripts' );
873
-								wp_enqueue_style( 'jquery-datepicker-styles' , YIKES_MC_URL . 'public/css/jquery-ui.min.css' );
874
-								wp_enqueue_style( 'yikes-datepicker-styles' , YIKES_MC_URL . 'public/css/yikes-datepicker-styles.min.css' );
873
+								wp_enqueue_style( 'jquery-datepicker-styles', YIKES_MC_URL . 'public/css/jquery-ui.min.css' );
874
+								wp_enqueue_style( 'yikes-datepicker-styles', YIKES_MC_URL . 'public/css/yikes-datepicker-styles.min.css' );
875 875
 
876
-								switch ( $field['type'] ) {
876
+								switch ( $field[ 'type' ] ) {
877 877
 									default:
878 878
 									case 'date':
879
-										$date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd/yyyy';
879
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd/yyyy';
880 880
 										break;
881 881
 
882 882
 									case 'birthday':
883
-										$date_format = ( isset( $field['date_format'] ) ) ? strtolower( $field['date_format'] ) : 'mm/dd';
883
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? strtolower( $field[ 'date_format' ] ) : 'mm/dd';
884 884
 										break;
885 885
 								}
886 886
 
887
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
888
-								$default_value = apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-default-value', $default_value, $field, $form_id );
887
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
888
+								$default_value = apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-default-value', $default_value, $field, $form_id );
889 889
 								
890 890
 								// store empty number for looping
891 891
 								$x = 0;
892 892
 
893 893
 								?>
894
-									<label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
894
+									<label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>>
895 895
 
896 896
 										<!-- dictate label visibility -->
897
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
898
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
899
-												<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
897
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
898
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
899
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
900 900
 											</span>
901 901
 										<?php } ?>
902 902
 
903 903
 										<!-- Description Above -->
904 904
 										<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?>
905 905
 
906
-										<input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $field['type'] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[$field['merge']] ); } else { echo esc_attr( $default_value ); } ?>" data-date-format="<?php echo esc_attr( strtolower( $date_format ) ); ?>">
906
+										<input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $field[ 'type' ] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo esc_attr( $_POST[ $field[ 'merge' ] ] ); } else { echo esc_attr( $default_value ); } ?>" data-date-format="<?php echo esc_attr( strtolower( $date_format ) ); ?>">
907 907
 
908 908
 										<!-- Description Below -->
909 909
 										<?php if ( $show_description === true && $description_above === false ) { echo $description; } ?>
@@ -914,26 +914,26 @@  discard block
 block discarded – undo
914 914
 							break;
915 915
 
916 916
 							case 'dropdown':
917
-								$no_default     = $field['default_choice'] === 'no-default' || isset( $field['default_choice'][0] ) && $field['default_choice'][0] === 'no-default';
918
-								$default_choice = is_array( $field['default_choice'] ) ? $field['default_choice'] : array( $field['default_choice'] );
917
+								$no_default     = $field[ 'default_choice' ] === 'no-default' || isset( $field[ 'default_choice' ][ 0 ] ) && $field[ 'default_choice' ][ 0 ] === 'no-default';
918
+								$default_choice = is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : array( $field[ 'default_choice' ] );
919 919
 
920 920
 								// store empty number for looping
921 921
 								$x = 0;
922 922
 									?>
923
-									<label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
923
+									<label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>>
924 924
 										<!-- dictate label visibility -->
925
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
926
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
927
-												<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
925
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
926
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
927
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
928 928
 											</span>
929 929
 										<?php }
930 930
 
931 931
 											// decode for looping
932
-											$choices = json_decode( $field['choices'], true );
932
+											$choices = json_decode( $field[ 'choices' ], true );
933 933
 
934 934
 											// If the form was submitted, but failed, let's default to the chosen option
935
-											if( isset( $_POST[ $field['merge'] ] ) && $form_submitted === 0 ) {
936
-												$default_choice = is_array( $_POST[ $field['merge'] ] ) ? $_POST[ $field['merge'] ] : array( $_POST[ $field['merge'] ] );
935
+											if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted === 0 ) {
936
+												$default_choice = is_array( $_POST[ $field[ 'merge' ] ] ) ? $_POST[ $field[ 'merge' ] ] : array( $_POST[ $field[ 'merge' ] ] );
937 937
 											}
938 938
 
939 939
 										?>
@@ -941,11 +941,11 @@  discard block
 block discarded – undo
941 941
 										<!-- Description Above -->
942 942
 										<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?>
943 943
 
944
-										<select <?php echo implode( ' ' , $field_array ); ?>>
944
+										<select <?php echo implode( ' ', $field_array ); ?>>
945 945
 											<?php
946 946
 												$no_default_name = apply_filters( 'yikes-mailchimp-dropdown-field-no-default-option-name', __( 'Select...', 'yikes-inc-easy-mailchimp-extender' ), $form_id );
947 947
 												echo $no_default === true ? '<option value="">' . $no_default_name . '</option>' : '';
948
-												foreach( $choices as $choice ) { ?>
948
+												foreach ( $choices as $choice ) { ?>
949 949
 													<option 
950 950
 														value="<?php echo esc_attr( $choice ); ?>"
951 951
 														<?php if ( $no_default !== true && in_array( $x, $default_choice ) || in_array( $choice, $default_choice, true ) ) { echo 'selected="selected"'; } ?>>
@@ -968,17 +968,17 @@  discard block
 block discarded – undo
968 968
 							case 'radio':
969 969
 							case 'checkbox':
970 970
 								// remove the ID (as to not assign the same ID to every radio button)
971
-								unset( $field_array['id'] );
972
-								$choices = json_decode( $field['choices'], true );
971
+								unset( $field_array[ 'id' ] );
972
+								$choices = json_decode( $field[ 'choices' ], true );
973 973
 
974 974
 								// assign a default choice
975
-								$no_default     = $field['default_choice'] === 'no-default' || isset( $field['default_choice'][0] ) && $field['default_choice'][0] === 'no-default';
976
-								$default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? $field['default_choice'] : $choices[0];
975
+								$no_default     = $field[ 'default_choice' ] === 'no-default' || isset( $field[ 'default_choice' ][ 0 ] ) && $field[ 'default_choice' ][ 0 ] === 'no-default';
976
+								$default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? $field[ 'default_choice' ] : $choices[ 0 ];
977 977
 								$default_choice = ( is_array( $default_choice ) ) ? $default_choice : array( $default_choice );
978 978
 
979 979
 								// If the form was submitted, but failed, let's default to the chosen option
980
-								if( isset( $_POST[ $field['merge'] ] ) && $form_submitted === 0 ) {
981
-									$default_choice = is_array( $_POST[ $field['merge'] ] ) ? $_POST[ $field['merge'] ] : array( $_POST[ $field['merge'] ] );
980
+								if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted === 0 ) {
981
+									$default_choice = is_array( $_POST[ $field[ 'merge' ] ] ) ? $_POST[ $field[ 'merge' ] ] : array( $_POST[ $field[ 'merge' ] ] );
982 982
 								}
983 983
 
984 984
 								$count = count( $choices );
@@ -986,29 +986,29 @@  discard block
 block discarded – undo
986 986
 								$x = 0;
987 987
 
988 988
 								?>
989
-								<label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
989
+								<label for="<?php echo esc_attr( $field_id_string ); ?>" <?php echo implode( ' ', $label_array ); ?>>
990 990
 
991 991
 									<!-- dictate label visibility -->
992
-									<?php if( ! isset( $field['hide-label'] ) ) { ?>
993
-										<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?> checkbox-parent-label">
994
-											<?php echo esc_attr( apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label', stripslashes( $field['label'] ) ) ); ?>
992
+									<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
993
+										<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?> checkbox-parent-label">
994
+											<?php echo esc_attr( apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', stripslashes( $field[ 'label' ] ) ) ); ?>
995 995
 										</span>
996 996
 									<?php }
997 997
 
998 998
 									// <!-- Description Above -->
999 999
 									if ( $show_description === true && $description_above === true ) { echo $description; }
1000 1000
 
1001
-									foreach( $choices as $choice ) {
1001
+									foreach ( $choices as $choice ) {
1002 1002
 										?>
1003
-										<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 } ?>">
1003
+										<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 } ?>">
1004 1004
 											<input 
1005
-												type="<?php echo esc_attr( $field['type'] ); ?>" 
1006
-												name="<?php echo esc_attr( $field['merge'] ); ?>" 
1007
-												id="<?php echo esc_attr( $field['merge'] . '-' . $i ); ?>" 
1005
+												type="<?php echo esc_attr( $field[ 'type' ] ); ?>" 
1006
+												name="<?php echo esc_attr( $field[ 'merge' ] ); ?>" 
1007
+												id="<?php echo esc_attr( $field[ 'merge' ] . '-' . $i ); ?>" 
1008 1008
 												<?php if ( $no_default !== true && in_array( $x, $default_choice ) || in_array( $choice, $default_choice, true ) ) { echo 'checked="checked"'; } ?>
1009
-												<?php echo $field_array['required']; ?>
1009
+												<?php echo $field_array[ 'required' ]; ?>
1010 1010
 												value="<?php echo esc_attr( $choice ); ?>">
1011
-											<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
1011
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
1012 1012
 										</label>
1013 1013
 										<?php
1014 1014
 										$i++;
@@ -1029,11 +1029,11 @@  discard block
 block discarded – undo
1029 1029
 						/**** Interest Groups ****/
1030 1030
 
1031 1031
 						// Handle the Description logic in one spot, here:
1032
-						$show_description = isset( $field['description'] ) && trim( $field['description'] ) !== '' ? true : false;
1033
-						$description_above = isset( $field['description_above'] ) && $field['description_above'] === '1' ? true : false;
1032
+						$show_description = isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) !== '' ? true : false;
1033
+						$description_above = isset( $field[ 'description_above' ] ) && $field[ 'description_above' ] === '1' ? true : false;
1034 1034
 						if ( $show_description === true ) {
1035
-							$description = '<p class="form-field-description" id="form-field-description-' . $field['group_id'] . '">';
1036
-							$description .= apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id );
1035
+							$description = '<p class="form-field-description" id="form-field-description-' . $field[ 'group_id' ] . '">';
1036
+							$description .= apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id );
1037 1037
 							$description .= '</p>';
1038 1038
 
1039 1039
 							/**
@@ -1045,28 +1045,28 @@  discard block
 block discarded – undo
1045 1045
 							*	@param string | $field['description']	| The field's description text
1046 1046
 							*	@param int	  | $form_id
1047 1047
 							*/
1048
-							$description = apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description-html', $description, esc_attr( stripslashes( $field['description'] ) ), $form_id );
1048
+							$description = apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description-html', $description, esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id );
1049 1049
 						}
1050 1050
 
1051 1051
 						// Get our groups
1052
-						$groups = isset( $field['groups'] ) && ! empty( $field['groups'] ) ? json_decode( $field['groups'], true ) : array();
1052
+						$groups = isset( $field[ 'groups' ] ) && ! empty( $field[ 'groups' ] ) ? json_decode( $field[ 'groups' ], true ) : array();
1053 1053
 
1054 1054
 						// Get the default choice(s) from the field settings and turn them into an array if not already
1055
-						$default_choice = isset( $field['default_choice'] ) ? $field['default_choice'] : '';
1055
+						$default_choice = isset( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : '';
1056 1056
 						$default_choice = is_array( $default_choice ) ? $default_choice : array( $default_choice );
1057
-						$default_choice = apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-default', $default_choice, $groups, $field, $form_id );
1057
+						$default_choice = apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-default', $default_choice, $groups, $field, $form_id );
1058 1058
 						
1059 1059
 
1060 1060
 						$count = count( $groups );
1061 1061
 
1062
-						if( $field['type'] === 'checkboxes' ) {
1062
+						if ( $field[ 'type' ] === 'checkboxes' ) {
1063 1063
 							$type = 'checkbox';
1064
-						} else if( $field['type'] === 'radio' ) {
1064
+						} else if ( $field[ 'type' ] === 'radio' ) {
1065 1065
 							$type = 'radio';
1066 1066
 						}
1067 1067
 
1068 1068
 						// loop over the interest group field types
1069
-						switch ( $field['type'] ) {
1069
+						switch ( $field[ 'type' ] ) {
1070 1070
 
1071 1071
 							case 'checkboxes':
1072 1072
 							case 'radio':
@@ -1074,11 +1074,11 @@  discard block
 block discarded – undo
1074 1074
 								$x = 1; // used to find the last item of our array
1075 1075
 
1076 1076
 									?>
1077
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1078
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1077
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1078
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1079 1079
 											<!-- dictate label visibility -->
1080
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label">
1081
-												<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
1080
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label">
1081
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
1082 1082
 											</span>
1083 1083
 									<?php
1084 1084
 										}
@@ -1088,7 +1088,7 @@  discard block
 block discarded – undo
1088 1088
 
1089 1089
 										// Display Submission Errors
1090 1090
 										if ( ! empty( $missing_required_checkbox_interest_groups ) ) {
1091
-											if( in_array( $field['group_id'], $missing_required_checkbox_interest_groups ) ) {
1091
+											if ( in_array( $field[ 'group_id' ], $missing_required_checkbox_interest_groups ) ) {
1092 1092
 												?>
1093 1093
 													<p class="yikes-mailchimp-required-interest-group-error">
1094 1094
 														<?php echo apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); ?>
@@ -1100,20 +1100,20 @@  discard block
 block discarded – undo
1100 1100
 										foreach ( $groups as $group_id => $name ) {
1101 1101
 
1102 1102
 											// If the form was submitted and failed, set the submitted/chosen values as the default
1103
-											if ( isset( $_POST[ 'group-' . $field['group_id'] ] ) && $form_submitted === 0 ) {
1103
+											if ( isset( $_POST[ 'group-' . $field[ 'group_id' ] ] ) && $form_submitted === 0 ) {
1104 1104
 
1105 1105
 												// Format default choice as array
1106
-												$default_choice = ( is_array( $_POST[ 'group-' . $field['group_id'] ] ) ) ? $_POST[ 'group-' . $field['group_id'] ] : array( $_POST[ 'group-' . $field['group_id'] ] );
1106
+												$default_choice = ( is_array( $_POST[ 'group-' . $field[ 'group_id' ] ] ) ) ? $_POST[ 'group-' . $field[ 'group_id' ] ] : array( $_POST[ 'group-' . $field[ 'group_id' ] ] );
1107 1107
 											}
1108 1108
 
1109 1109
 											?>
1110
-											<label for="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>">
1110
+											<label for="<?php echo esc_attr( $field[ 'group_id' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>">
1111 1111
 												<input 
1112
-													<?php if( isset( $field['require'] ) && $field['require'] == 1 ) { if ( $field['type'] !== 'checkboxes' ) { ?> required="required" <?php } ?> 
1112
+													<?php if ( isset( $field[ 'require' ] ) && $field[ 'require' ] == 1 ) { if ( $field[ 'type' ] !== 'checkboxes' ) { ?> required="required" <?php } ?> 
1113 1113
 													class="yikes-interest-group-required" <?php } ?> 
1114 1114
 													type="<?php echo esc_attr( $type ); ?>"
1115
-													name="group-<?php echo esc_attr( $field['group_id'] ); ?>[]" 
1116
-													id="<?php echo esc_attr( $field['group_id'] . '-' . $i ); ?>"
1115
+													name="group-<?php echo esc_attr( $field[ 'group_id' ] ); ?>[]" 
1116
+													id="<?php echo esc_attr( $field[ 'group_id' ] . '-' . $i ); ?>"
1117 1117
 													<?php if ( in_array( $group_id, $default_choice ) ) { echo 'checked="checked"'; } ?> 
1118 1118
 													value="<?php echo esc_attr( $group_id ); ?>">
1119 1119
 													<?php echo esc_attr( $name ); ?>
@@ -1135,32 +1135,32 @@  discard block
 block discarded – undo
1135 1135
 
1136 1136
 									?>
1137 1137
 
1138
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1138
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1139 1139
 										<!-- dictate label visibility -->
1140
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1141
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>">
1142
-												<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
1140
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1141
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?>">
1142
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
1143 1143
 											</span>
1144 1144
 										<?php } ?>
1145 1145
 
1146 1146
 										<!-- Description Above -->
1147 1147
 										<?php if ( $show_description === true && $description_above === true ) { echo $description; } ?>
1148 1148
 
1149
-										<select <?php echo implode( ' ' , $field_array ); ?>>
1149
+										<select <?php echo implode( ' ', $field_array ); ?>>
1150 1150
 
1151 1151
 											<?php
1152
-												$no_default      = $field['default_choice'] === 'no-default' || isset( $field['default_choice'][0] ) && $field['default_choice'][0] === 'no-default';
1152
+												$no_default      = $field[ 'default_choice' ] === 'no-default' || isset( $field[ 'default_choice' ][ 0 ] ) && $field[ 'default_choice' ][ 0 ] === 'no-default';
1153 1153
 												$no_default_name = apply_filters( 'yikes-mailchimp-dropdown-ig-no-default-option-name', __( 'Select...', 'yikes-inc-easy-mailchimp-extender' ), $form_id );
1154 1154
 												echo $no_default === true ? '<option value="">' . $no_default_name . '</option>' : '';
1155 1155
 
1156 1156
 												$i = 0;
1157
-												foreach( $groups as $group_id => $name ) { 
1157
+												foreach ( $groups as $group_id => $name ) { 
1158 1158
 
1159 1159
 													// If the form was submitted and failed, set the submitted/chosen values as the default
1160
-													if( isset( $_POST[ 'group-' . $field['group_id'] ] ) && $form_submitted === 0 ) {
1160
+													if ( isset( $_POST[ 'group-' . $field[ 'group_id' ] ] ) && $form_submitted === 0 ) {
1161 1161
 
1162 1162
 														// Format default choice as array
1163
-														$default_choice = ( is_array( $_POST[ 'group-' . $field['group_id'] ] ) ) ? $_POST[ 'group-' . $field['group_id'] ] : array( $_POST[ 'group-' . $field['group_id'] ] );
1163
+														$default_choice = ( is_array( $_POST[ 'group-' . $field[ 'group_id' ] ] ) ) ? $_POST[ 'group-' . $field[ 'group_id' ] ] : array( $_POST[ 'group-' . $field[ 'group_id' ] ] );
1164 1164
 													}
1165 1165
 											?>
1166 1166
 													<option 
@@ -1188,12 +1188,12 @@  discard block
 block discarded – undo
1188 1188
 
1189 1189
 									?>
1190 1190
 
1191
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1191
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1192 1192
 
1193 1193
 										<!-- dictate label visibility -->
1194
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1195
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1196
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
1194
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1195
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1196
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
1197 1197
 											</span>
1198 1198
 										<?php }
1199 1199
 
@@ -1203,17 +1203,17 @@  discard block
 block discarded – undo
1203 1203
 										// Turn $default_choice into an array if it isn't already
1204 1204
 										$default_choice = ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice : array( $default_choice );
1205 1205
 
1206
-										foreach( $groups as $group_id => $name ) { 
1206
+										foreach ( $groups as $group_id => $name ) { 
1207 1207
 											?>
1208
-											<label for="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if ( $x === $count ) { echo ' last-selection'; } ?>" style="display:none;">
1208
+											<label for="<?php echo esc_attr( $field[ 'group_id' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { echo ' last-selection'; } ?>" style="display:none;">
1209 1209
 												<input 
1210 1210
 													type="checkbox" 
1211
-													name="group-<?php echo esc_attr( $field['group_id'] ); ?>[]" 
1212
-													id="<?php echo esc_attr( $field['group_id'] ) . '-' . $i; ?>"
1211
+													name="group-<?php echo esc_attr( $field[ 'group_id' ] ); ?>[]" 
1212
+													id="<?php echo esc_attr( $field[ 'group_id' ] ) . '-' . $i; ?>"
1213 1213
 													value="<?php echo esc_attr( $group_id ) ?>"
1214 1214
 													<?php if ( in_array( $group_id, $default_choice ) ) { echo 'checked="checked"'; } ?>
1215 1215
 												>
1216
-												<?php echo esc_attr( stripslashes( str_replace( '' , '\'', $name ) ) ); ?>
1216
+												<?php echo esc_attr( stripslashes( str_replace( '', '\'', $name ) ) ); ?>
1217 1217
 											</label>
1218 1218
 											<?php
1219 1219
 											$i++;
@@ -1238,14 +1238,14 @@  discard block
 block discarded – undo
1238 1238
 					echo $recaptcha_box;
1239 1239
 				}
1240 1240
 
1241
-				$admin_class = is_user_logged_in() && current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ? ' admin-logged-in' : '';
1241
+				$admin_class = is_user_logged_in() && current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ? ' admin-logged-in' : '';
1242 1242
 				?>
1243 1243
 
1244 1244
 				<!-- Honeypot Trap -->
1245 1245
 				<input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot-<?php echo esc_attr( $form_id ); ?>" value="">
1246 1246
 
1247 1247
 				<!-- List ID -->
1248
-				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id-<?php echo esc_attr( $form_id ); ?>" value="<?php echo esc_attr( $form_data['list_id'] ); ?>">
1248
+				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id-<?php echo esc_attr( $form_id ); ?>" value="<?php echo esc_attr( $form_data[ 'list_id' ] ); ?>">
1249 1249
 
1250 1250
 				<!-- The form that is being submitted! Used to display error/success messages above the correct form -->
1251 1251
 				<input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form-<?php echo esc_attr( $form_id ); ?>" value="<?php echo esc_attr( $form_id ); ?>">
@@ -1259,15 +1259,15 @@  discard block
 block discarded – undo
1259 1259
 						// If the number of fields, is equal to the hidden label count, add our class
1260 1260
 						// eg: All field labels are set to hidden.
1261 1261
 						if ( absint( $field_count ) === absint( $hidden_label_count ) ) {
1262
-							$submit_button_label_classes[] = 'labels-hidden';
1262
+							$submit_button_label_classes[ ] = 'labels-hidden';
1263 1263
 						}
1264 1264
 						echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="' . implode( ' ', $submit_button_label_classes ) . '">&nbsp;</span>';
1265 1265
 					}
1266 1266
 					// Display the image or text based button.
1267 1267
 					if ( $submit_button_type === 'text' ) {
1268
-						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'] ) . '"> <span class="yikes-mailchimp-submit-button-span-text">' .  apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '</span></button>', $form_data['id'] );
1268
+						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' ] ) . '"> <span class="yikes-mailchimp-submit-button-span-text">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '</span></button>', $form_data[ 'id' ] );
1269 1269
 					} else {
1270
-						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'] );
1270
+						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' ] );
1271 1271
 					}
1272 1272
 					if ( $form_inline && ! $inline_form_override ) {
1273 1273
 						echo '</label>';
@@ -1282,8 +1282,8 @@  discard block
 block discarded – undo
1282 1282
 
1283 1283
 		<?php
1284 1284
 			/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
1285
-			if( is_user_logged_in() ) {
1286
-				if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
1285
+			if ( is_user_logged_in() ) {
1286
+				if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
1287 1287
 					echo $edit_form_link;
1288 1288
 				}
1289 1289
 			}
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 		*	for non-admins
1300 1300
 		*/
1301 1301
 		if ( ! current_user_can( 'manage_options' ) ) {
1302
-			$impressions = $form_data['impressions'] + 1;
1302
+			$impressions = $form_data[ 'impressions' ] + 1;
1303 1303
 			$interface->update_form_field( $form_id, 'impressions', $impressions );
1304 1304
 		}
1305 1305
 
Please login to merge, or discard this patch.