Completed
Push — master ( 3450a6...75f6d6 )
by Evan
29:34 queued 10:24
created
yikes-inc-easy-mailchimp-extender.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
  *	@return void
44 44
  */
45 45
 if ( ! defined( 'YIKES_MC_VERSION' ) ) {
46
-	define( 'YIKES_MC_VERSION' , '6.1.3' );
46
+	define( 'YIKES_MC_VERSION', '6.1.3' );
47 47
 }
48 48
 
49 49
 /**
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
  *	@return void
54 54
  */
55 55
 if ( ! defined( 'YIKES_MC_PATH' ) ) {
56
-	define( 'YIKES_MC_PATH' , plugin_dir_path( __FILE__ ) );
56
+	define( 'YIKES_MC_PATH', plugin_dir_path( __FILE__ ) );
57 57
 }
58 58
 
59 59
 /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
  *	@return void
64 64
  */
65 65
 if ( ! defined( 'YIKES_MC_URL' ) ) {
66
-	define( 'YIKES_MC_URL' , plugin_dir_url( __FILE__ ) );
66
+	define( 'YIKES_MC_URL', plugin_dir_url( __FILE__ ) );
67 67
 }
68 68
 
69 69
 /**
Please login to merge, or discard this patch.
public/class-yikes-inc-easy-mailchimp-extender-public.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 		// include our ajax processing class
57 57
 		require_once( YIKES_MC_PATH . 'public/partials/ajax/class.public_ajax.php' );
58 58
 		// Include our error logging class
59
-		add_action( 'init' , array( $this , 'load_error_logging_class' ) , 1 );
59
+		add_action( 'init', array( $this, 'load_error_logging_class' ), 1 );
60 60
 		// load our checkbox classes
61
-		add_action( 'init' , array( $this , 'load_checkbox_integration_classes' ) , 1 );
61
+		add_action( 'init', array( $this, 'load_checkbox_integration_classes' ), 1 );
62 62
 		// custom front end filter
63 63
 		add_action( 'init', array( $this, 'yikes_custom_frontend_content_filter' ) );
64 64
 		// Process non-ajax forms in the header
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 	**/
94 94
 	public function load_checkbox_integration_classes() {
95 95
 		// store our options
96
-		$integrations = get_option( 'optin-checkbox-init' , '' );
97
-		if( !empty( $integrations ) ) {
96
+		$integrations = get_option( 'optin-checkbox-init', '' );
97
+		if ( ! empty( $integrations ) ) {
98 98
 			// load our mail integrations class
99 99
 			require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations.php';
100 100
 			// loop over selected classes and load them up!
101
-			foreach( $integrations as $integration => $value ) {
102
-				if( isset( $value['value'] ) && $value['value'] == 'on' ) {
101
+			foreach ( $integrations as $integration => $value ) {
102
+				if ( isset( $value[ 'value' ] ) && $value[ 'value' ] == 'on' ) {
103 103
 					// load our class extensions
104
-					require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.'.$integration.'-checkbox.php';
104
+					require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.' . $integration . '-checkbox.php';
105 105
 				}
106 106
 			}
107 107
 		}
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @since 6.0.0
116 116
 	 */
117 117
 	public function load_error_logging_class() {
118
-		if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
118
+		if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
119 119
 			// if error logging is enabled we should include our error logging class
120 120
 			require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
121 121
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging;
@@ -128,18 +128,18 @@  discard block
 block discarded – undo
128 128
 	*	@since 6.0.3.4
129 129
 	*/
130 130
 	public function yikes_process_non_ajax_forms( $form_submitted ) {
131
-		global $wpdb,$post;
132
-		$form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? (int) $_POST['yikes-mailchimp-submitted-form'] : false; // store form id
133
-		if( $form_id ) {
131
+		global $wpdb, $post;
132
+		$form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? (int) $_POST[ 'yikes-mailchimp-submitted-form' ] : false; // store form id
133
+		if ( $form_id ) {
134 134
 			$form_settings = self::yikes_retrieve_form_settings( $form_id );
135
-			if( isset( $_POST ) && !empty( $_POST ) && isset( $form_id ) && $form_settings['submission_settings']['ajax'] == 0 ) {
136
-				if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { // ensure we only process the form that was submitted
135
+			if ( isset( $_POST ) && ! empty( $_POST ) && isset( $form_id ) && $form_settings[ 'submission_settings' ][ 'ajax' ] == 0 ) {
136
+				if ( $_POST[ 'yikes-mailchimp-submitted-form' ] == $form_id ) { // ensure we only process the form that was submitted
137 137
 					// lets include our form processing file
138 138
 					include_once( YIKES_MC_PATH . 'public/partials/shortcodes/process/process_form_submission.php' );
139
-					if( $form_settings['submission_settings']['redirect_on_submission'] == '1' ) {
140
-						if( $form_submitted == 1 ) {
139
+					if ( $form_settings[ 'submission_settings' ][ 'redirect_on_submission' ] == '1' ) {
140
+						if ( $form_submitted == 1 ) {
141 141
 							// decode our settings
142
-							$redirect_page = ( 'custom_url' != $form_settings['submission_settings']['redirect_page'] ) ? get_permalink( (int) $form_settings['submission_settings']['redirect_page'] ) : $form_settings['submission_settings']['custom_redirect_url'];
142
+							$redirect_page = ( 'custom_url' != $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) ? get_permalink( (int) $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) : $form_settings[ 'submission_settings' ][ 'custom_redirect_url' ];
143 143
 							wp_redirect( apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_page ), $form_id, $post ) );
144 144
 							exit;
145 145
 						}
@@ -155,27 +155,27 @@  discard block
 block discarded – undo
155 155
 	*/
156 156
 	public static function yikes_retrieve_form_settings( $form_id ) {
157 157
 		// if no form id, abort
158
-		if( ! $form_id ) {
158
+		if ( ! $form_id ) {
159 159
 			return;
160 160
 		}
161 161
 		global $wpdb;
162 162
 		$form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form_id . '', ARRAY_A ); // query for our form data
163
-		if( $form_results ) {
163
+		if ( $form_results ) {
164 164
 			// empty array, to populate with form settings
165 165
 			$form_settings = array();
166
-			$form_data = $form_results[0]; // store the results
166
+			$form_data = $form_results[ 0 ]; // store the results
167 167
 			// store the settings in our array
168
-			$form_settings['list_id'] = sanitize_key( $form_data['list_id'] ); // associated list id (users who fill out the form will be subscribed to this list)
169
-			$form_settings['form_name'] = esc_attr( $form_data['form_name'] ); // form name
170
-			$form_settings['form_description'] = esc_attr( stripslashes( $form_data['form_description'] ) );
171
-			$form_settings['fields'] = json_decode( $form_data['fields'] , true );
172
-			$form_settings['styles'] = json_decode( stripslashes( $form_data['custom_styles'] ) , true );
173
-			$form_settings['send_welcome'] = $form_data['send_welcome_email'];
174
-			$form_settings['submission_settings'] = json_decode( stripslashes( $form_data['submission_settings'] ) , true );
175
-			$form_settings['optin_settings'] = json_decode( stripslashes( $form_data['optin_settings'] ) , true );
176
-			$form_settings['error_messages'] = json_decode( $form_data['error_messages'] , true );
177
-			$form_settings['notifications'] = isset( $form_data['custom_notifications'] ) ? json_decode( stripslashes( $form_data['custom_notifications'] ) , true ) : '';
178
-			$form_settings['submissions'] = $form_data['submissions'];
168
+			$form_settings[ 'list_id' ] = sanitize_key( $form_data[ 'list_id' ] ); // associated list id (users who fill out the form will be subscribed to this list)
169
+			$form_settings[ 'form_name' ] = esc_attr( $form_data[ 'form_name' ] ); // form name
170
+			$form_settings[ 'form_description' ] = esc_attr( stripslashes( $form_data[ 'form_description' ] ) );
171
+			$form_settings[ 'fields' ] = json_decode( $form_data[ 'fields' ], true );
172
+			$form_settings[ 'styles' ] = json_decode( stripslashes( $form_data[ 'custom_styles' ] ), true );
173
+			$form_settings[ 'send_welcome' ] = $form_data[ 'send_welcome_email' ];
174
+			$form_settings[ 'submission_settings' ] = json_decode( stripslashes( $form_data[ 'submission_settings' ] ), true );
175
+			$form_settings[ 'optin_settings' ] = json_decode( stripslashes( $form_data[ 'optin_settings' ] ), true );
176
+			$form_settings[ 'error_messages' ] = json_decode( $form_data[ 'error_messages' ], true );
177
+			$form_settings[ 'notifications' ] = isset( $form_data[ 'custom_notifications' ] ) ? json_decode( stripslashes( $form_data[ 'custom_notifications' ] ), true ) : '';
178
+			$form_settings[ 'submissions' ] = $form_data[ 'submissions' ];
179 179
 			// return the given form settings in an array
180 180
 			return $form_settings;
181 181
 		}
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
 			return;
203 203
 		}
204 204
 		// trim trailing period
205
-		if ( isset( $form_settings['error_messages']['update-link'] ) && ! empty( $form_settings['error_messages']['update-link'] ) ) {
206
-			$response_text = $form_settings['error_messages']['update-link'];
205
+		if ( isset( $form_settings[ 'error_messages' ][ 'update-link' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'update-link' ] ) ) {
206
+			$response_text = $form_settings[ 'error_messages' ][ 'update-link' ];
207 207
 			// extract the link text
208 208
 			preg_match( '/\[link].*?\[\/link\]/', $response_text, $link_text );
209 209
 			if ( $link_text && ! empty( $link_text ) ) {
210 210
 				// Extract the custom link text ([link]*[/link])
211
-				$custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[0], $link ) ) );
211
+				$custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[ 0 ], $link ) ) );
212 212
 				// Replace the link text, with our custom link text
213 213
 				$response_text = str_replace( $link_text, $custom_link_text, $response_text );
214 214
 			}
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 			return;
236 236
 		}
237 237
 		// trim trailing period
238
-		if ( isset( $form_settings['error_messages']['already-subscribed'] ) && ! empty( $form_settings['error_messages']['already-subscribed'] ) ) {
239
-			$response_text = str_replace( '[email]', $email, $form_settings['error_messages']['already-subscribed'] );
238
+		if ( isset( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) ) {
239
+			$response_text = str_replace( '[email]', $email, $form_settings[ 'error_messages' ][ 'already-subscribed' ] );
240 240
 		}
241 241
 		// Return our new string
242 242
 		return $response_text;
Please login to merge, or discard this patch.
admin/partials/menu/options.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 */
6 6
 
7 7
 	/* Get and Store Option Values */
8
-	if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) === 'valid_api_key' ) {
9
-		$api_connection = '<span id="connection-container" class="api-connected" title="' . __( "Your site is currently connected to the MailChimp API" , "yikes-inc-easy-mailchimp-extender" ) . '"><span class="dashicons dashicons-yes yikes-mc-api-connected"></span> ' . __( "Connected" , 'yikes-inc-easy-mailchimp-extender' ) . '</span>';
8
+	if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) === 'valid_api_key' ) {
9
+		$api_connection = '<span id="connection-container" class="api-connected" title="' . __( "Your site is currently connected to the MailChimp API", "yikes-inc-easy-mailchimp-extender" ) . '"><span class="dashicons dashicons-yes yikes-mc-api-connected"></span> ' . __( "Connected", 'yikes-inc-easy-mailchimp-extender' ) . '</span>';
10 10
 		$api_error_response = '';
11 11
 	} else {
12
-		$api_connection = '<span id="connection-container" class="api-not-connected"><span class="dashicons dashicons-no-alt yikes-mc-api-not-connected"></span>  ' . __( "Not Connected" , 'yikes-inc-easy-mailchimp-extender' ) . '</span>';
13
-		if( get_option( 'yikes-mc-api-invalid-key-response' , '' ) != '' ) {
14
-			$api_error_response = '<p><small><i class="dashicons dashicons-no-alt"></i> ' . get_option( 'yikes-mc-api-invalid-key-response' , '' ) . '</small></p>';
12
+		$api_connection = '<span id="connection-container" class="api-not-connected"><span class="dashicons dashicons-no-alt yikes-mc-api-not-connected"></span>  ' . __( "Not Connected", 'yikes-inc-easy-mailchimp-extender' ) . '</span>';
13
+		if ( get_option( 'yikes-mc-api-invalid-key-response', '' ) != '' ) {
14
+			$api_error_response = '<p><small><i class="dashicons dashicons-no-alt"></i> ' . get_option( 'yikes-mc-api-invalid-key-response', '' ) . '</small></p>';
15 15
 		} else {
16 16
 			$api_error_response = '';
17 17
 		}
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 	<div class="wrap">
26 26
 
27 27
 		<!-- Freddie Logo -->
28
-		<img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" />
28
+		<img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" />
29 29
 
30
-		<h1>YIKES Easy Forms for MailChimp | <?php if ( isset( $_REQUEST['section'] ) ) { echo ucwords( str_replace( '-', ' ', $_REQUEST['section'] ) ); } else { echo __( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ); } ?></h1>
30
+		<h1>YIKES Easy Forms for MailChimp | <?php if ( isset( $_REQUEST[ 'section' ] ) ) { echo ucwords( str_replace( '-', ' ', $_REQUEST[ 'section' ] ) ); } else { echo __( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); } ?></h1>
31 31
 
32 32
 		<!-- Settings Page Description -->
33
-		<p class="yikes-easy-mc-about-text about-text"><?php _e( 'Easy Forms for MailChimp allows you to painlessly add MailChimp sign up forms to your WordPress site and track user activity with interactive reports.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
33
+		<p class="yikes-easy-mc-about-text about-text"><?php _e( 'Easy Forms for MailChimp allows you to painlessly add MailChimp sign up forms to your WordPress site and track user activity with interactive reports.', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
34 34
 		<?php
35 35
 			/* Success Messages on Options Updated */
36
-			if( isset( $_REQUEST['settings-updated'] ) && $_REQUEST['settings-updated'] == 'true' ) {
36
+			if ( isset( $_REQUEST[ 'settings-updated' ] ) && $_REQUEST[ 'settings-updated' ] == 'true' ) {
37 37
 				?>
38 38
 				<div class="updated manage-form-admin-notice">
39 39
 					<p><?php _e( 'Settings successfully updated.', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 				<?php
42 42
 			}
43 43
 			/* MailChimp API Cleared Successfully message */
44
-			if( isset( $_REQUEST['transient-cleared'] ) && $_REQUEST['transient-cleared'] == 'true' ) {
44
+			if ( isset( $_REQUEST[ 'transient-cleared' ] ) && $_REQUEST[ 'transient-cleared' ] == 'true' ) {
45 45
 				?>
46 46
 				<div class="updated manage-form-admin-notice">
47 47
 					<p><?php _e( 'MailChimp API Cache successfully cleared.', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 			}
51 51
 			/* Error Log Clear Messages */
52 52
 				/* Success Messages on Options Updated */
53
-				if( isset( $_REQUEST['error-log-cleared'] ) && $_REQUEST['error-log-cleared'] == 'true' ) {
53
+				if ( isset( $_REQUEST[ 'error-log-cleared' ] ) && $_REQUEST[ 'error-log-cleared' ] == 'true' ) {
54 54
 					?>
55 55
 					<div class="updated manage-form-admin-notice">
56 56
 						<p><?php _e( 'Error log successfully cleared.', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 					<?php
59 59
 				}
60 60
 				/* MailChimp API Cleared Successfully message */
61
-				if( isset( $_REQUEST['error-log-cleared'] ) && $_REQUEST['error-log-cleared'] == 'false' ) {
61
+				if ( isset( $_REQUEST[ 'error-log-cleared' ] ) && $_REQUEST[ 'error-log-cleared' ] == 'false' ) {
62 62
 					?>
63 63
 					<div class="error manage-form-admin-notice">
64 64
 						<p><?php _e( "Whoops! We've encountered an error while trying to clear the error log. Please refresh the page and try again. If the error persists please get in touch with the YIKES Inc. support team.", 'yikes-inc-easy-mailchimp-extender' ); ?></p>
@@ -67,28 +67,28 @@  discard block
 block discarded – undo
67 67
 				}
68 68
 
69 69
 				/* Display a success message if our error log was sucessfully created, or display an error if not */
70
-				if( isset( $_GET['error_log_created'] ) && $_GET['error_log_created'] == 'true' ) {
70
+				if ( isset( $_GET[ 'error_log_created' ] ) && $_GET[ 'error_log_created' ] == 'true' ) {
71 71
 					?>
72 72
 					<div class="updated">
73 73
 						<p><?php _e( 'Error log successfully created. You may now start logging errors.', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
74 74
 					</div>
75 75
 					<?php
76
-				} else if( isset( $_GET['error_log_created'] ) && $_GET['error_log_created'] == 'false' ) {
76
+				} else if ( isset( $_GET[ 'error_log_created' ] ) && $_GET[ 'error_log_created' ] == 'false' ) {
77 77
 					?>
78 78
 					<div class="error">
79
-						<p><?php echo esc_attr( urldecode( $_GET['error_message'] ) , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
79
+						<p><?php echo esc_attr( urldecode( $_GET[ 'error_message' ] ), 'yikes-inc-easy-mailchimp-extender' ); ?></p>
80 80
 					</div>
81 81
 					<?php
82 82
 				}
83 83
 
84 84
 				/* Display a success message if the user successfully imported some forms */
85
-				if( isset( $_GET['section'] ) && $_GET['section'] == 'import-export-forms' && isset( $_GET['import-forms'] ) && $_GET['import-forms'] == 'true' ) {
85
+				if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'import-export-forms' && isset( $_GET[ 'import-forms' ] ) && $_GET[ 'import-forms' ] == 'true' ) {
86 86
 					?>
87 87
 					<div class="updated">
88 88
 						<p><?php printf( __( 'Opt-in forms successfully imported. <a href="%s" title="View Forms">View Forms</a>', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?></p>
89 89
 					</div>
90 90
 					<?php
91
-				} elseif( isset( $_GET['section'] ) && $_GET['section'] == 'import-export-forms' && isset( $_GET['import-settings'] ) && $_GET['import-settings'] == 'true' ) {
91
+				} elseif ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'import-export-forms' && isset( $_GET[ 'import-settings' ] ) && $_GET[ 'import-settings' ] == 'true' ) {
92 92
 					?>
93 93
 					<div class="updated">
94 94
 						<p><?php printf( __( 'YIKES Easy Forms for MailChimp settings successfully imported.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?></p>
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 
110 110
 						<div class="postbox yikes-easy-mc-postbox">
111 111
 
112
-							<?php if( !isset( $_REQUEST['section'] ) || $_REQUEST['section'] == '' ) {
112
+							<?php if ( ! isset( $_REQUEST[ 'section' ] ) || $_REQUEST[ 'section' ] == '' ) {
113 113
 								include YIKES_MC_PATH . 'admin/partials/menu/options-sections/general-settings.php';
114 114
 							} else {
115
-								if( isset( $_REQUEST['addon'] ) && $_REQUEST['addon'] == 'true' ) {
116
-									include apply_filters( 'yikes-mailchimp-'.$_REQUEST['section'].'-options-path' , '' );
115
+								if ( isset( $_REQUEST[ 'addon' ] ) && $_REQUEST[ 'addon' ] == 'true' ) {
116
+									include apply_filters( 'yikes-mailchimp-' . $_REQUEST[ 'section' ] . '-options-path', '' );
117 117
 								} else {
118 118
 									// White list a set of files that are allowed to be included here
119 119
 									$file_base = 'admin/partials/menu/options-sections/';
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 										$file_base . 'recaptcha-settings.php',
127 127
 									);
128 128
 									// Ensure the included file is allowed and whitelisted above, before including it
129
-									if ( 0 === validate_file( 'admin/partials/menu/options-sections/' . $_REQUEST['section'] . '.php', $acceptable_files ) ) {
130
-										include YIKES_MC_PATH . 'admin/partials/menu/options-sections/' . $_REQUEST['section'] . '.php';
129
+									if ( 0 === validate_file( 'admin/partials/menu/options-sections/' . $_REQUEST[ 'section' ] . '.php', $acceptable_files ) ) {
130
+										include YIKES_MC_PATH . 'admin/partials/menu/options-sections/' . $_REQUEST[ 'section' ] . '.php';
131 131
 									} else {
132 132
 										wp_die( esc_attr__( 'Invalid file. If this error persists, please contact support.', 'yikes-inc-easy-mailchimp' ) );
133 133
 									}
Please login to merge, or discard this patch.
public/partials/shortcodes/process_form_shortcode.php 1 patch
Spacing   +306 added lines, -306 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 			'recaptcha_data_callback' => '', // set a custom js callback function to run after a successful recaptcha response - default none
22 22
 			'recaptcha_expired_callback' => '', // set a custom js callback function to run after the recaptcha has expired - default none
23 23
 			'inline' => '0',
24
-		), $atts , 'yikes-mailchimp' )
24
+		), $atts, 'yikes-mailchimp' )
25 25
 	);
26 26
 
27 27
 	// set globals
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	$form_submitted = isset( $form_submitted ) ? $form_submitted : 0;
32 32
 
33 33
 	/* If the user hasn't authenticated yet, lets kill off */
34
-	if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) {
35
-		return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key." , 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
34
+	if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) {
35
+		return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key.", 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
36 36
 	}
37 37
 
38 38
 	// if the user forgot to specify a form ID, lets kill of and warn them.
39
-	if( ! $form ) {
39
+	if ( ! $form ) {
40 40
 		return __( 'Whoops, it looks like you forgot to specify a form to display.', 'yikes-inc-easy-mailchimp-extender' );
41 41
 	}
42 42
 
@@ -45,39 +45,39 @@  discard block
 block discarded – undo
45 45
 	$form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form . '', ARRAY_A );
46 46
 
47 47
 	// confirm we have some results, or return an error
48
-	if( !$form_results ) {
49
-		return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form." , 'yikes-inc-easy-mailchimp-extender' );
48
+	if ( ! $form_results ) {
49
+		return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form.", 'yikes-inc-easy-mailchimp-extender' );
50 50
 	}
51 51
 
52 52
 	/*
53 53
 	*	Check if the user wants to use reCAPTCHA Spam Prevention
54 54
 	*/
55
-	if( get_option( 'yikes-mc-recaptcha-status' , '' ) == '1' ) {
55
+	if ( get_option( 'yikes-mc-recaptcha-status', '' ) == '1' ) {
56 56
 		// allow users to manually set recaptcha (instead of globally - recaptcha="1"/recaptcha="0" - but still needs to be globally enabled on the settings page)
57
-		if( ! isset( $atts['recaptcha'] ) || ( isset( $atts['recaptcha'] ) && $atts['recaptcha'] == '1' ) ) {
57
+		if ( ! isset( $atts[ 'recaptcha' ] ) || ( isset( $atts[ 'recaptcha' ] ) && $atts[ 'recaptcha' ] == '1' ) ) {
58 58
 			// if either of the Private the Secret key is left blank, we should display an error back to the user
59
-			if( get_option( 'yikes-mc-recaptcha-site-key' , '' ) == '' ) {
60
-				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
59
+			if ( get_option( 'yikes-mc-recaptcha-site-key', '' ) == '' ) {
60
+				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
61 61
 			}
62
-			if( get_option( 'yikes-mc-recaptcha-secret-key' , '' ) == '' ) {
63
-				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
62
+			if ( get_option( 'yikes-mc-recaptcha-secret-key', '' ) == '' ) {
63
+				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
64 64
 			}
65 65
 
66
-			if( ! empty( $atts['recaptcha_type'] ) ) {
67
-				echo $atts['recaptcha_type'];
66
+			if ( ! empty( $atts[ 'recaptcha_type' ] ) ) {
67
+				echo $atts[ 'recaptcha_type' ];
68 68
 			}
69 69
 
70 70
 			// Store the site language (to load recaptcha in a specific language)
71 71
 			$locale = get_locale();
72 72
 			$locale_split = explode( '_', $locale );
73 73
 			// Setup reCAPTCHA parameters
74
-			$lang = ( isset( $locale_split ) ? $locale_split[0] : $locale );
75
-			$lang = ( isset( $atts['recaptcha_lang'] ) ) ? $atts['recaptcha_lang'] : $locale_split[0];
76
-			$type = ( isset( $atts['recaptcha_type'] ) ) ? strtolower( $atts['recaptcha_type'] ) : 'image'; // setup recaptcha type
77
-			$theme= ( isset( $atts['recaptcha_theme'] ) ) ? strtolower( $atts['recaptcha_theme'] ) : 'light'; // setup recaptcha theme
78
-			$size = ( isset( $atts['recaptcha_size'] ) ) ? strtolower( $atts['recaptcha_size'] ) : 'normal'; // setup recaptcha size
79
-			$data_callback = ( isset( $atts['recaptcha_data_callback'] ) ) ? $atts['recaptcha_data_callback'] : false; // setup recaptcha size
80
-			$expired_callback = ( isset( $atts['recaptcha_expired_callback'] ) ) ? $atts['recaptcha_expired_callback'] : false; // setup recaptcha size
74
+			$lang = ( isset( $locale_split ) ? $locale_split[ 0 ] : $locale );
75
+			$lang = ( isset( $atts[ 'recaptcha_lang' ] ) ) ? $atts[ 'recaptcha_lang' ] : $locale_split[ 0 ];
76
+			$type = ( isset( $atts[ 'recaptcha_type' ] ) ) ? strtolower( $atts[ 'recaptcha_type' ] ) : 'image'; // setup recaptcha type
77
+			$theme = ( isset( $atts[ 'recaptcha_theme' ] ) ) ? strtolower( $atts[ 'recaptcha_theme' ] ) : 'light'; // setup recaptcha theme
78
+			$size = ( isset( $atts[ 'recaptcha_size' ] ) ) ? strtolower( $atts[ 'recaptcha_size' ] ) : 'normal'; // setup recaptcha size
79
+			$data_callback = ( isset( $atts[ 'recaptcha_data_callback' ] ) ) ? $atts[ 'recaptcha_data_callback' ] : false; // setup recaptcha size
80
+			$expired_callback = ( isset( $atts[ 'recaptcha_expired_callback' ] ) ) ? $atts[ 'recaptcha_expired_callback' ] : false; // setup recaptcha size
81 81
 			// Pass the shortcode parameters through a filter
82 82
 			$recaptcha_shortcode_params = apply_filters( 'yikes-mailchimp-recaptcha-parameters', array(
83 83
 				'language' => $lang,
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 				'expired_callback' => $expired_callback,
89 89
 			), $form );
90 90
 			// enqueue Google recaptcha JS
91
-			wp_register_script( 'google-recaptcha-js' , 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params['language'] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ) , 'all' );
91
+			wp_register_script( 'google-recaptcha-js', 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params[ 'language' ] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ), 'all' );
92 92
 			wp_enqueue_script( 'google-recaptcha-js' );
93
-			$recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key' , '' );
94
-			$recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params['theme'] . '" data-type="' . $recaptcha_shortcode_params['type'] . '" data-size="' . $recaptcha_shortcode_params['size'] . '" data-callback="' . $recaptcha_shortcode_params['success_callback'] . '" data-expired-callback="' . $recaptcha_shortcode_params['expired_callback'] . '"></div>';
93
+			$recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key', '' );
94
+			$recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params[ 'theme' ] . '" data-type="' . $recaptcha_shortcode_params[ 'type' ] . '" data-size="' . $recaptcha_shortcode_params[ 'size' ] . '" data-callback="' . $recaptcha_shortcode_params[ 'success_callback' ] . '" data-expired-callback="' . $recaptcha_shortcode_params[ 'expired_callback' ] . '"></div>';
95 95
 			?>
96 96
 			<script type="text/javascript">
97 97
 				/* Script Callback to init. multiple recaptchas on a single page */
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	}
119 119
 
120 120
 	// place our results into a seperate variable for easy looping
121
-	$form_data = $form_results[0];
121
+	$form_data = $form_results[ 0 ];
122 122
 
123 123
 	// store our variables
124
-	$form_id = (int) $form_data['id']; // form id (the id of the form in the database)
124
+	$form_id = (int) $form_data[ 'id' ]; // form id (the id of the form in the database)
125 125
 
126 126
 	/*
127 127
 	*	Get the stored form settings
@@ -130,32 +130,32 @@  discard block
 block discarded – undo
130 130
 	*/
131 131
 	$form_settings = Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $form_id );
132 132
 
133
-	$additional_form_settings = ( isset( $form_data['form_settings'] ) ) ? json_decode( $form_data['form_settings'], true ) : false;
133
+	$additional_form_settings = ( isset( $form_data[ 'form_settings' ] ) ) ? json_decode( $form_data[ 'form_settings' ], true ) : false;
134 134
 	// store our options from the additional form settings array
135
-	$form_classes = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-class-names'] : '';
136
-	$inline_form = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-inline-form'] : '';
137
-	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-submit-button-type'] : 'text';
138
-	$submit_button_text = ( $additional_form_settings && $additional_form_settings['yikes-easy-mc-submit-button-text'] != '' ) ? esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-text'] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' );
139
-	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings['yikes-easy-mc-submit-button-image'] ) : '';
140
-	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-classes'] ) : '';
135
+	$form_classes = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-class-names' ] : '';
136
+	$inline_form = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-inline-form' ] : '';
137
+	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-submit-button-type' ] : 'text';
138
+	$submit_button_text = ( $additional_form_settings && $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] != '' ) ? esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' );
139
+	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings[ 'yikes-easy-mc-submit-button-image' ] ) : '';
140
+	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-classes' ] ) : '';
141 141
 	// scheuldes
142
-	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-schedule'] : false;
143
-	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-start'] : '';;
144
-	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-end'] : '';
145
-	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-pending-message'] : '';
146
-	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-expired-message'] : '';
142
+	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-schedule' ] : false;
143
+	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-start' ] : ''; ;
144
+	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-end' ] : '';
145
+	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ] : '';
146
+	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ] : '';
147 147
 	// register required
148
-	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-login-required'] : false;
149
-	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-login-message'] : '';
148
+	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-login-required' ] : false;
149
+	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-login-message' ] : '';
150 150
 	// store number of fields
151
-	$field_count = (int) count( $form_settings['fields'] );
151
+	$field_count = (int) count( $form_settings[ 'fields' ] );
152 152
 
153 153
 	// confirm we actually have fields, before looping
154
-	if( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) {
154
+	if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) {
155 155
 		// loop over each field, if it's set to hidden -- subtract it from the field count
156 156
 		// this throws off the layout for inline forms setup below
157
-		foreach( json_decode( $form_data['fields'] ) as $form_field ) {
158
-			if( isset( $form_field->hide ) && $form_field->hide == 1 ) {
157
+		foreach ( json_decode( $form_data[ 'fields' ] ) as $form_field ) {
158
+			if ( isset( $form_field->hide ) && $form_field->hide == 1 ) {
159 159
 				$field_count--;
160 160
 			}
161 161
 		}
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
 	*	If login is required, abort
166 166
 	*	@since 6.0.3.8
167 167
 	*/
168
-	if( $form_login_required ) {
169
-		if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
168
+	if ( $form_login_required ) {
169
+		if ( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
170 170
 			ob_start();
171 171
 				?>
172 172
 					<div class="yikes-mailchimp-login-required yikes-mailchimp-form-<?php echo $form_id; ?>-login-required">
@@ -182,19 +182,19 @@  discard block
 block discarded – undo
182 182
 	*	Check if schedule is set for this form
183 183
 	*	@since 6.0.3.8
184 184
 	*/
185
-	if( $form_schedule_state ) {
185
+	if ( $form_schedule_state ) {
186 186
 		// store current date
187 187
 		$current_date = strtotime( current_time( 'm/d/Y g:iA' ) );
188 188
 
189 189
 		// the the current date is less than the form scheduled start date
190
-		if( $current_date < $form_schedule_start ) {
190
+		if ( $current_date < $form_schedule_start ) {
191 191
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_pending_message );
192 192
 			return;
193 193
 			// abort
194 194
 		}
195 195
 
196 196
 		// The current date is past or equal to the end date, aka form has now expired
197
-		if( $current_date >= $form_schedule_end ) {
197
+		if ( $current_date >= $form_schedule_end ) {
198 198
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_expired_message );
199 199
 			return;
200 200
 			// abort
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
 
204 204
 	// setup the submit button text
205 205
 	// shortcode parameter takes precedence over option
206
-	if( isset( $atts['submit'] ) ) {
207
-		$submit = $atts['submit'];
206
+	if ( isset( $atts[ 'submit' ] ) ) {
207
+		$submit = $atts[ 'submit' ];
208 208
 	} else {
209 209
 		$submit = $submit_button_text;
210 210
 	}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	$page_data = $post;
215 215
 
216 216
 	// Remove the post_password from this for security
217
-	if( isset( $page_data->post_password ) ) {
217
+	if ( isset( $page_data->post_password ) ) {
218 218
 		unset( $page_data->post_password );
219 219
 	}
220 220
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	*	to exclude styles from loading, add `define( 'YIKES_MAILCHIMP_EXCLUDE_STYLES', true );` to functions.php
229 229
 	*	@since 6.0.3.8
230 230
 	*/
231
-	if( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
231
+	if ( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
232 232
 		// enqueue the form styles
233 233
 		wp_enqueue_style( 'yikes-inc-easy-mailchimp-public-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-extender-public.min.css', array( $last_key ) );
234 234
 	}
@@ -236,19 +236,19 @@  discard block
 block discarded – undo
236 236
 	/**
237 237
 	*	Check for form inline parameter
238 238
 	*/
239
-	$form_inline = ( isset( $atts['inline'] ) && ( $atts['inline'] == 1 || $atts['inline'] == 'true' ) ) ? true : false;
239
+	$form_inline = ( isset( $atts[ 'inline' ] ) && ( $atts[ 'inline' ] == 1 || $atts[ 'inline' ] == 'true' ) ) ? true : false;
240 240
 	// recheck from our form options
241
-	if( ! $form_inline ) {
242
-		$form_inline = ( isset( $additional_form_settings['yikes-easy-mc-inline-form'] ) && $additional_form_settings['yikes-easy-mc-inline-form'] == 1 ) ? true : false;
241
+	if ( ! $form_inline ) {
242
+		$form_inline = ( isset( $additional_form_settings[ 'yikes-easy-mc-inline-form' ] ) && $additional_form_settings[ 'yikes-easy-mc-inline-form' ] == 1 ) ? true : false;
243 243
 	}
244 244
 
245 245
 	/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
246
-	if( is_user_logged_in() ) {
247
-		if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
246
+	if ( is_user_logged_in() ) {
247
+		if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
248 248
 			$edit_form_link = '<span class="edit-link">';
249
-				$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_settings['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
249
+				$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form ) ) . '" title="' . __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_settings[ 'form_name' ] ) . '">' . __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
250 250
 			$edit_form_link .= '</span>';
251
-			$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $form, ucwords( $form_settings['form_name'] ) );
251
+			$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $form, ucwords( $form_settings[ 'form_name' ] ) );
252 252
 		} else {
253 253
 			$edit_form_link = '';
254 254
 		}
@@ -257,16 +257,16 @@  discard block
 block discarded – undo
257 257
 	// ensure there is an 'email' field the user can fill out
258 258
 	// or else MailChimp throws errors at you
259 259
 	// extract our array keys
260
-	if( isset( $form_settings['fields'] ) && ! empty( $form_settings['fields'] ) ) {
261
-		$array_keys = array_keys( $form_settings['fields'] );
260
+	if ( isset( $form_settings[ 'fields' ] ) && ! empty( $form_settings[ 'fields' ] ) ) {
261
+		$array_keys = array_keys( $form_settings[ 'fields' ] );
262 262
 		// check for EMAIL in that array
263
-		if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) {
264
-			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>';
263
+		if ( ! in_array( 'EMAIL', $array_keys ) && ! in_array( 'email', $array_keys ) ) {
264
+			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>';
265 265
 		}
266 266
 	} else {
267
-		$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
268
-		if( is_user_logged_in() ) {
269
-			if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
267
+		$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
268
+		if ( is_user_logged_in() ) {
269
+			if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
270 270
 				return $error . $edit_form_link;
271 271
 			}
272 272
 		} else {
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 		}
275 275
 	}
276 276
 
277
-	if( $form_inline ) {
277
+	if ( $form_inline ) {
278 278
 		$field_width = (float) ( 100 / $field_count );
279 279
 		$submit_button_width = (float) ( 20 / $field_count );
280 280
 		/*
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
 		*	Set a custom title using custom_title="lorem ipsum" parameter in the shortcode
312 312
 		*	- This takes precedence over the title set
313 313
 		*/
314
-		if( ! empty( $title ) && $title == 1 && isset( $atts['custom_title'] ) ) {
315
-			echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts['custom_title'] ), $form_id ) . '</h3>';
314
+		if ( ! empty( $title ) && $title == 1 && isset( $atts[ 'custom_title' ] ) ) {
315
+			echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts[ 'custom_title' ] ), $form_id ) . '</h3>';
316 316
 		} else {
317 317
 			// display the form description if the user
318 318
 			// has specified to do so
319
-			if( ! empty( $title ) && $title == 1 ) {
320
-				echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_settings['form_name'] ), $form_id ) . '</h3>';
319
+			if ( ! empty( $title ) && $title == 1 ) {
320
+				echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_settings[ 'form_name' ] ), $form_id ) . '</h3>';
321 321
 			}
322 322
 		}
323 323
 
@@ -325,21 +325,21 @@  discard block
 block discarded – undo
325 325
 		*	Allow users to specify a custom description for this form, no html support
326 326
 		*	@since 6.0.3.8
327 327
 		*/
328
-		if( ! empty( $description ) && $description == 1 && isset( $atts['custom_description'] ) ) {
329
-			echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $atts['custom_description'], $form_id ) ) . '</section>';
328
+		if ( ! empty( $description ) && $description == 1 && isset( $atts[ 'custom_description' ] ) ) {
329
+			echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $atts[ 'custom_description' ], $form_id ) ) . '</section>';
330 330
 		} else {
331 331
 			// display the form description if the user
332 332
 			// has specified to do so
333
-			if( ! empty( $description ) && $description == 1 ) {
334
-				echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $form_settings['form_description'], $form_id ) ) . '</section>';
333
+			if ( ! empty( $description ) && $description == 1 ) {
334
+				echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $form_settings[ 'form_description' ], $form_id ) ) . '</section>';
335 335
 			}
336 336
 		}
337 337
 
338 338
 		// Check for AJAX
339
-		if( ( ! empty( $atts['ajax'] ) && $atts['ajax'] == 1 ) || $form_settings['submission_settings']['ajax'] == 1 ) {
339
+		if ( ( ! empty( $atts[ 'ajax' ] ) && $atts[ 'ajax' ] == 1 ) || $form_settings[ 'submission_settings' ][ 'ajax' ] == 1 ) {
340 340
 			// enqueue our ajax script
341
-			wp_register_script( 'yikes-easy-mc-ajax' , YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js' , array( 'jquery' ) , 'yikes-inc-easy-mailchimp-extender', false );
342
-			wp_localize_script( 'yikes-easy-mc-ajax' , 'object' , array(
341
+			wp_register_script( 'yikes-easy-mc-ajax', YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js', array( 'jquery' ), 'yikes-inc-easy-mailchimp-extender', false );
342
+			wp_localize_script( 'yikes-easy-mc-ajax', 'object', array(
343 343
 				'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
344 344
 				'page_data' => $page_data,
345 345
 				'interest_group_checkbox_error' => apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ),
@@ -358,67 +358,67 @@  discard block
 block discarded – undo
358 358
 
359 359
 		// render the form!
360 360
 		?>
361
-			<form id="<?php echo sanitize_title( $form_settings['form_name'] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline )  { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if( !empty( $_POST ) && $form_submitted == 1 && $form_settings['submission_settings']['hide_form_post_signup'] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>">
361
+			<form id="<?php echo sanitize_title( $form_settings[ 'form_name' ] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if ( ! empty( $_POST ) && $form_submitted == 1 && $form_settings[ 'submission_settings' ][ 'hide_form_post_signup' ] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>">
362 362
 
363 363
 				<?php
364 364
 				// Set a default constant for hidden fields
365 365
 				$hidden_label_count = 0;
366 366
 
367 367
 				// Loop over our form fields
368
-				foreach( $form_settings['fields'] as $field ) {
368
+				foreach ( $form_settings[ 'fields' ] as $field ) {
369 369
 						// input array
370 370
 						$field_array = array();
371 371
 						// label array
372 372
 						$label_array = array();
373 373
 						// label classes array
374 374
 						$label_class_array = array();
375
-						if( $field['additional-classes'] != '' ) {
375
+						if ( $field[ 'additional-classes' ] != '' ) {
376 376
 							// split custom classes at spaces
377
-							$custom_classes = explode( ' ' , $field['additional-classes'] );
377
+							$custom_classes = explode( ' ', $field[ 'additional-classes' ] );
378 378
 							// check our custom class array for field-left/field-right
379 379
 							// if it's set we need to assign it to our label and remove it from the field classes
380 380
 							 // input half left
381
-							if( in_array( 'field-left-half' , $custom_classes ) ) {
381
+							if ( in_array( 'field-left-half', $custom_classes ) ) {
382 382
 								// $label_array['class'] = 'class="field-left-half"';
383
-								$label_class_array[] = 'field-left-half';
384
-								$key = array_search( 'field-left-half' , $custom_classes );
385
-								unset( $custom_classes[$key] );
383
+								$label_class_array[ ] = 'field-left-half';
384
+								$key = array_search( 'field-left-half', $custom_classes );
385
+								unset( $custom_classes[ $key ] );
386 386
 							} // input half right
387
-							if( in_array( 'field-right-half' , $custom_classes ) ) {
387
+							if ( in_array( 'field-right-half', $custom_classes ) ) {
388 388
 								// $label_array['class'] = 'class="field-right-half"';
389
-								$label_class_array[] = 'field-right-half';
390
-								$key = array_search( 'field-right-half' , $custom_classes );
391
-								unset( $custom_classes[$key] );
389
+								$label_class_array[ ] = 'field-right-half';
390
+								$key = array_search( 'field-right-half', $custom_classes );
391
+								unset( $custom_classes[ $key ] );
392 392
 							} // input thirds (1/3 width, floated left)
393
-							if( in_array( 'field-third' , $custom_classes ) ) {
393
+							if ( in_array( 'field-third', $custom_classes ) ) {
394 394
 								// $label_array['class'] = 'class="field-third"';
395
-								$label_class_array[] = 'field-third';
396
-								$key = array_search( 'field-third' , $custom_classes );
397
-								unset( $custom_classes[$key] );
395
+								$label_class_array[ ] = 'field-third';
396
+								$key = array_search( 'field-third', $custom_classes );
397
+								unset( $custom_classes[ $key ] );
398 398
 							} // 2 column radio
399
-							if( in_array( 'option-2-col' , $custom_classes ) ) {
399
+							if ( in_array( 'option-2-col', $custom_classes ) ) {
400 400
 								// $label_array['class'] = 'class="option-2-col"';
401
-								$label_class_array[] = 'option-2-col';
402
-								$key = array_search( 'option-2-col' , $custom_classes );
403
-								unset( $custom_classes[$key] );
401
+								$label_class_array[ ] = 'option-2-col';
402
+								$key = array_search( 'option-2-col', $custom_classes );
403
+								unset( $custom_classes[ $key ] );
404 404
 							} // 3 column radio
405
-							if( in_array( 'option-3-col' , $custom_classes ) ) {
405
+							if ( in_array( 'option-3-col', $custom_classes ) ) {
406 406
 								// $label_array['class'] = 'class="option-3-col"';
407
-								$label_class_array[] = 'option-3-col';
408
-								$key = array_search( 'option-3-col' , $custom_classes );
409
-								unset( $custom_classes[$key] );
407
+								$label_class_array[ ] = 'option-3-col';
408
+								$key = array_search( 'option-3-col', $custom_classes );
409
+								unset( $custom_classes[ $key ] );
410 410
 							} // 4 column radio
411
-							if( in_array( 'option-4-col' , $custom_classes ) ) {
411
+							if ( in_array( 'option-4-col', $custom_classes ) ) {
412 412
 								// $label_array['class'] = 'class="option-4-col"';
413
-								$label_class_array[] = 'option-4-col';
414
-								$key = array_search( 'option-4-col' , $custom_classes );
415
-								unset( $custom_classes[$key] );
413
+								$label_class_array[ ] = 'option-4-col';
414
+								$key = array_search( 'option-4-col', $custom_classes );
415
+								unset( $custom_classes[ $key ] );
416 416
 							} // inline radio & checkboxes etc
417
-							if( in_array( 'option-inline' , $custom_classes ) ) {
417
+							if ( in_array( 'option-inline', $custom_classes ) ) {
418 418
 								// $label_array['class'] = 'class="option-inline"';
419
-								$label_class_array[] = 'option-inline';
420
-								$key = array_search( 'option-inline' , $custom_classes );
421
-								unset( $custom_classes[$key] );
419
+								$label_class_array[ ] = 'option-inline';
420
+								$key = array_search( 'option-inline', $custom_classes );
421
+								unset( $custom_classes[ $key ] );
422 422
 							}
423 423
 						} else {
424 424
 							$custom_classes = array();
@@ -426,68 +426,68 @@  discard block
 block discarded – undo
426 426
 
427 427
 						// if the form is set to inline, add the inline class to our labels
428 428
 						// since @6.0.3.8
429
-						if( $form_inline ) {
430
-							$label_class_array[] = 'label-inline';
429
+						if ( $form_inline ) {
430
+							$label_class_array[ ] = 'label-inline';
431 431
 						}
432 432
 
433
-						if( isset( $field['hide-label'] ) ) {
434
-							if( absint( $field['hide-label'] ) === 1 ) {
433
+						if ( isset( $field[ 'hide-label' ] ) ) {
434
+							if ( absint( $field[ 'hide-label' ] ) === 1 ) {
435 435
 								$hidden_label_count++;
436
-								$custom_classes[] = 'field-no-label';
436
+								$custom_classes[ ] = 'field-no-label';
437 437
 							}
438 438
 						}
439 439
 
440 440
 					/* Store tag variable based on field type */
441
-					if( isset( $field['merge'] ) ) {
441
+					if ( isset( $field[ 'merge' ] ) ) {
442 442
 						$tag = 'merge';
443 443
 					} else {
444 444
 						$tag = 'group_id';
445 445
 					}
446 446
 
447 447
 					// build up our array
448
-					$field_array['id'] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[$tag] ) . '" ';
449
-					$field_array['name'] = 'name="' . esc_attr( $field[$tag] ) . '" ';
450
-					$field_array['placeholder'] = isset( $field['placeholder'] ) ? 'placeholder="' . esc_attr( stripslashes( $field['placeholder'] ) ) . '" ' : '';
451
-					$field_array['classes'] = 'class="yikes-easy-mc-'.$field['type'] . ' ' .  esc_attr( trim( implode( ' ' , $custom_classes ) ) ) . '" ';
448
+					$field_array[ 'id' ] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[ $tag ] ) . '" ';
449
+					$field_array[ 'name' ] = 'name="' . esc_attr( $field[ $tag ] ) . '" ';
450
+					$field_array[ 'placeholder' ] = isset( $field[ 'placeholder' ] ) ? 'placeholder="' . esc_attr( stripslashes( $field[ 'placeholder' ] ) ) . '" ' : '';
451
+					$field_array[ 'classes' ] = 'class="yikes-easy-mc-' . $field[ 'type' ] . ' ' . esc_attr( trim( implode( ' ', $custom_classes ) ) ) . '" ';
452 452
 
453 453
 					// email must always be required and visible
454
-					if( $field['type'] == 'email' ) {
455
-						$field_array['required'] = 'required="required"';
456
-						$label_array['visible'] = '';
454
+					if ( $field[ 'type' ] == 'email' ) {
455
+						$field_array[ 'required' ] = 'required="required"';
456
+						$label_array[ 'visible' ] = '';
457 457
 						// $label_array['required'] = 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"';
458
-						$label_class_array[] = $field['merge'] . '-label';
459
-						$label_class_array[] = 'yikes-mailchimp-field-required';
458
+						$label_class_array[ ] = $field[ 'merge' ] . '-label';
459
+						$label_class_array[ ] = 'yikes-mailchimp-field-required';
460 460
 					} else {
461
-						if( $tag == 'merge' ) {
462
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
463
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
461
+						if ( $tag == 'merge' ) {
462
+							$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
463
+							$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
464 464
 							// $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['merge'] . '-label"';
465
-							$label_class_array[] = isset( $field['require'] ) ? $field['merge'] . '-label yikes-mailchimp-field-required' : $field['merge'] . '-label';
465
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'merge' ] . '-label yikes-mailchimp-field-required' : $field[ 'merge' ] . '-label';
466 466
 						} else {
467
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
468
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
467
+							$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
468
+							$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
469 469
 							// $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['group_id'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['group_id'] . '-label"';
470
-							$label_class_array[] = isset( $field['require'] ) ? $field['group_id'] . '-label yikes-mailchimp-field-required' : $field['group_id'] . '-label';
470
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'group_id' ] . '-label yikes-mailchimp-field-required' : $field[ 'group_id' ] . '-label';
471 471
 						}
472 472
 					}
473 473
 
474 474
 					// if both hide label and hide field are checked, we gotta hide the field!
475
-					if( isset( $field['hide' ] ) && $field['hide'] == 1 ) {
476
-						if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) {
477
-							$field_array['visible'] = 'style="display:none;"';
475
+					if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) {
476
+						if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) {
477
+							$field_array[ 'visible' ] = 'style="display:none;"';
478 478
 						}
479 479
 					}
480 480
 
481
-					$label_array['classes'] = 'class="' . implode( ' ', $label_class_array ) . '"';
481
+					$label_array[ 'classes' ] = 'class="' . implode( ' ', $label_class_array ) . '"';
482 482
 
483 483
 					// filter the field array data
484 484
 					$field_array = apply_filters( 'yikes-mailchimp-field-data', $field_array, $field, $form_id );
485 485
 
486 486
 					/* Loop Over Standard Fields (aka merge variables) */
487
-					if( isset( $field['merge'] ) ) {
487
+					if ( isset( $field[ 'merge' ] ) ) {
488 488
 
489 489
 						// loop over our fields by Type
490
-						switch ( $field['type'] ) {
490
+						switch ( $field[ 'type' ] ) {
491 491
 
492 492
 							default:
493 493
 							case 'email':
@@ -495,25 +495,25 @@  discard block
 block discarded – undo
495 495
 							case 'number':
496 496
 
497 497
 								// pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type)
498
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
498
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
499 499
 								$default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value );
500 500
 									?>
501
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
501
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
502 502
 
503 503
 										<!-- dictate label visibility -->
504
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
505
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
506
-												<?php if( ! isset( $field['hide-label'] ) ) { echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ), $form_id ); } ?>
504
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
505
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
506
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ), $form_id ); } ?>
507 507
 											</span>
508 508
 										<?php } ?>
509 509
 
510
-										<input <?php echo implode( ' ' , $field_array ); if( $field['type'] != 'email' && $field['type'] != 'number' ) { ?> type="text" <?php } else if( $field['type'] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
510
+										<input <?php echo implode( ' ', $field_array ); if ( $field[ 'type' ] != 'email' && $field[ 'type' ] != 'number' ) { ?> type="text" <?php } else if ( $field[ 'type' ] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
511 511
 
512 512
 										<!-- description -->
513
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
513
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
514 514
 											<p class="form-field-description">
515 515
 												<small>
516
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
516
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
517 517
 												</small>
518 518
 											</p>
519 519
 										<?php } ?>
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 
526 526
 							case 'url':
527 527
 							case 'imageurl':
528
-								$default_value = ( isset( $field['default'] ) ) ? $field['default'] : '';
528
+								$default_value = ( isset( $field[ 'default' ] ) ) ? $field[ 'default' ] : '';
529 529
 									?>
530 530
 
531 531
 									<script type="text/javascript">
@@ -537,22 +537,22 @@  discard block
 block discarded – undo
537 537
 										}
538 538
 									</script>
539 539
 
540
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
540
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
541 541
 
542 542
 										<!-- dictate label visibility -->
543
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
544
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
545
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
543
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
544
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
545
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
546 546
 											</span>
547 547
 										<?php } ?>
548 548
 
549
-										<input <?php echo implode( ' ' , $field_array ); ?> type="url" <?php if( $field['type'] == 'url' ) { ?> title="<?php _e( 'Please enter a valid URL to the website.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } else { ?> title="<?php _e( 'Please enter a valid URL to the image.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>" onblur="properlyFormatURLField(this);return false;">
549
+										<input <?php echo implode( ' ', $field_array ); ?> type="url" <?php if ( $field[ 'type' ] == 'url' ) { ?> title="<?php _e( 'Please enter a valid URL to the website.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } else { ?> title="<?php _e( 'Please enter a valid URL to the image.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>" onblur="properlyFormatURLField(this);return false;">
550 550
 
551 551
 										<!-- description -->
552
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
552
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
553 553
 											<p class="form-field-description">
554 554
 												<small>
555
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
555
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
556 556
 												</small>
557 557
 											</p>
558 558
 										<?php } ?>
@@ -563,8 +563,8 @@  discard block
 block discarded – undo
563 563
 							break;
564 564
 
565 565
 							case 'phone':
566
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
567
-								$phone_format = $field['phone_format'];
566
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
567
+								$phone_format = $field[ 'phone_format' ];
568 568
 								?>
569 569
 									<script type="text/javascript">
570 570
 										/* Replace incorrect values and format it correctly for MailChimp API */
@@ -577,22 +577,22 @@  discard block
 block discarded – undo
577 577
 										}
578 578
 									</script>
579 579
 
580
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
580
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
581 581
 
582 582
 										<!-- dictate label visibility -->
583
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
584
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
585
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
583
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
584
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
585
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
586 586
 											</span>
587 587
 										<?php } ?>
588 588
 
589
-										<input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $phone_format != 'US' ) { ?>  title="<?php _e( 'International Phone Number' , 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern' , '[0-9,-]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####' , 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern' , '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" onblur="formatUSPhoneNumber(this);"<?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
589
+										<input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $phone_format != 'US' ) { ?>  title="<?php _e( 'International Phone Number', 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern', '[0-9,-]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####', 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern', '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" onblur="formatUSPhoneNumber(this);"<?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
590 590
 
591 591
 										<!-- description -->
592
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
592
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
593 593
 											<p class="form-field-description">
594 594
 												<small>
595
-													<?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field['merge'] ) . '-description', stripslashes( $field['description'] ), $form_id ); ?>
595
+													<?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field[ 'merge' ] ) . '-description', stripslashes( $field[ 'description' ] ), $form_id ); ?>
596 596
 												</small>
597 597
 											</p>
598 598
 										<?php } ?>
@@ -602,25 +602,25 @@  discard block
 block discarded – undo
602 602
 							break;
603 603
 
604 604
 							case 'zip':
605
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
605
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
606 606
 
607 607
 									?>
608
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
608
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
609 609
 
610 610
 									<!-- dictate label visibility -->
611
-									<?php if( ! isset( $field['hide-label'] ) ) { ?>
612
-										<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
613
-											<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
611
+									<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
612
+										<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
613
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
614 614
 										</span>
615 615
 									<?php } ?>
616 616
 
617
-									<input <?php echo implode( ' ' , $field_array ); ?> type="text" pattern="\d{5,5}(-\d{4,4})?" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
617
+									<input <?php echo implode( ' ', $field_array ); ?> type="text" pattern="\d{5,5}(-\d{4,4})?" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
618 618
 
619 619
 									<!-- description -->
620
-									<?php if( isset( $field['description'] ) ) { ?>
620
+									<?php if ( isset( $field[ 'description' ] ) ) { ?>
621 621
 										<p class="form-field-description">
622 622
 											<small>
623
-												<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
623
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
624 624
 											</small>
625 625
 										</p>
626 626
 									<?php } ?>
@@ -632,28 +632,28 @@  discard block
 block discarded – undo
632 632
 
633 633
 							case 'address':
634 634
 								// required fields
635
-								$required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' );
635
+								$required_fields = array( 'addr1' => 'address', 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip', 'country' => 'country' );
636 636
 
637 637
 								// setup the default country value
638 638
 								$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
639 639
 
640 640
 								// store number for looping
641 641
 								$x = 1;
642
-								foreach( $required_fields as $type => $label ) {
642
+								foreach ( $required_fields as $type => $label ) {
643 643
 
644 644
 									// set the field names for the addrress fields
645
-									$field_array['name'] = 'name="'.$field[$tag].'['.$type.']'.'"';
645
+									$field_array[ 'name' ] = 'name="' . $field[ $tag ] . '[' . $type . ']' . '"';
646 646
 
647 647
 									// reset the label classes for left-half/right-half for addresses
648
-									if( isset( $label_array['class'] ) ) {
648
+									if ( isset( $label_array[ 'class' ] ) ) {
649 649
 										if ( $x % 2 == 0 ) {
650
-											$label_array['class'] = str_replace( 'field-left-half', 'field-right-half', $label_array['class'] );
650
+											$label_array[ 'class' ] = str_replace( 'field-left-half', 'field-right-half', $label_array[ 'class' ] );
651 651
 										} else {
652
-											$label_array['class'] = str_replace( 'field-right-half', 'field-left-half', $label_array['class'] );
652
+											$label_array[ 'class' ] = str_replace( 'field-right-half', 'field-left-half', $label_array[ 'class' ] );
653 653
 										}
654 654
 									}
655 655
 
656
-									switch( $type ) {
656
+									switch ( $type ) {
657 657
 
658 658
 										default:
659 659
 										case 'addr1':
@@ -662,17 +662,17 @@  discard block
 block discarded – undo
662 662
 
663 663
 
664 664
 											?>
665
-											<label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
665
+											<label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>>
666 666
 
667 667
 												<!-- dictate label visibility -->
668
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
669
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
670
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
668
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
669
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
670
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
671 671
 													</span>
672 672
 												<?php } ?>
673 673
 
674 674
 
675
-												<input <?php echo implode( ' ' , $field_array ); ?> type="text"  value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } ?>">
675
+												<input <?php echo implode( ' ', $field_array ); ?> type="text"  value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } ?>">
676 676
 
677 677
 											</label>
678 678
 											<?php
@@ -682,16 +682,16 @@  discard block
 block discarded – undo
682 682
 										case 'state':
683 683
 
684 684
 											?>
685
-											<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="state-dropdown"<?php if( ! in_array( $default_country, array( 'US' ) ) ) { ?> style="display: none;"<?php } ?>>
685
+											<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="state-dropdown"<?php if ( ! in_array( $default_country, array( 'US' ) ) ) { ?> style="display: none;"<?php } ?>>
686 686
 
687 687
 												<!-- dictate label visibility -->
688
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
689
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
690
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
688
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
689
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
690
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
691 691
 													</span>
692 692
 												<?php } ?>
693 693
 
694
-												<select <?php echo implode( ' ' , $field_array ); ?>>
694
+												<select <?php echo implode( ' ', $field_array ); ?>>
695 695
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-dropdown.php' ); ?>
696 696
 												</select>
697 697
 
@@ -704,15 +704,15 @@  discard block
 block discarded – undo
704 704
 										case 'zip':
705 705
 
706 706
 											?>
707
-											<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="zip-input"<?php if( ! in_array( $default_country, array( 'US', 'GB' ) ) ) { ?> style="display: none;"<?php } ?>>
707
+											<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="zip-input"<?php if ( ! in_array( $default_country, array( 'US', 'GB' ) ) ) { ?> style="display: none;"<?php } ?>>
708 708
 
709
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
710
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
711
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
709
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
710
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
711
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
712 712
 													</span>
713 713
 												<?php } ?>
714 714
 
715
-												<input <?php echo implode( ' ' , $field_array ); ?> type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?' ); ?>" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
715
+												<input <?php echo implode( ' ', $field_array ); ?> type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?' ); ?>" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
716 716
 
717 717
 											</label>
718 718
 											<?php
@@ -750,16 +750,16 @@  discard block
 block discarded – undo
750 750
 												$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
751 751
 											?>
752 752
 
753
-											<label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
753
+											<label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>>
754 754
 
755 755
 												<!-- dictate label visibility -->
756
-												<?php if( !isset( $field['hide-label'] ) ) { ?>
757
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
758
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
756
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
757
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
758
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
759 759
 													</span>
760 760
 												<?php } ?>
761 761
 
762
-												<select <?php echo implode( ' ' , $field_array ); ?> onchange="checkCountry(this);return false;">
762
+												<select <?php echo implode( ' ', $field_array ); ?> onchange="checkCountry(this);return false;">
763 763
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/country-dropdown.php' ); ?>
764 764
 												</select>
765 765
 											</label>
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
 								}
771 771
 
772 772
 								// description
773
-								if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
773
+								if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
774 774
 									<p class="form-field-description">
775 775
 										<small>
776
-											<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
776
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
777 777
 										</small>
778 778
 									</p>
779 779
 									<?php }
@@ -783,19 +783,19 @@  discard block
 block discarded – undo
783 783
 							case 'birthday':
784 784
 
785 785
 								// bootstrap datepicker requirements
786
-								wp_enqueue_script( 'bootstrap-hover-dropdown' , YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js' , array( 'jquery' ) );
787
-								wp_enqueue_script( 'bootstrap-datepicker-script' , YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js' , array( 'jquery' , 'bootstrap-hover-dropdown' ) );
788
-								wp_enqueue_style( 'bootstrap-datepicker-styles' , YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
789
-								wp_enqueue_style( 'override-datepicker-styles' , YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css' , array( 'bootstrap-datepicker-styles' ) );
786
+								wp_enqueue_script( 'bootstrap-hover-dropdown', YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js', array( 'jquery' ) );
787
+								wp_enqueue_script( 'bootstrap-datepicker-script', YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js', array( 'jquery', 'bootstrap-hover-dropdown' ) );
788
+								wp_enqueue_style( 'bootstrap-datepicker-styles', YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
789
+								wp_enqueue_style( 'override-datepicker-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css', array( 'bootstrap-datepicker-styles' ) );
790 790
 
791
-								switch ( $field['type'] ) {
791
+								switch ( $field[ 'type' ] ) {
792 792
 									default:
793 793
 									case 'date':
794
-										$date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd/yy';
794
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd/yy';
795 795
 										break;
796 796
 
797 797
 									case 'birthday':
798
-										$date_format = ( isset( $field['date_format'] ) ) ? strtolower( $field['date_format'] ) : 'mm/dd';
798
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? strtolower( $field[ 'date_format' ] ) : 'mm/dd';
799 799
 										break;
800 800
 								}
801 801
 								// initialize the datepicker
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 											padding: .85em .5em !important;
807 807
 										}
808 808
 										<?php
809
-											if( wp_is_mobile() ) {
809
+											if ( wp_is_mobile() ) {
810 810
 												?>
811 811
 												.datepicker-dropdown {
812 812
 													margin-top: 0px;
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 											$day_names = $admin_class->yikes_jQuery_datepicker_strip_array_indices( $wp_locale->weekday );
822 822
 											$day_names_short = $admin_class->yikes_jQuery_datepicker_strip_array_indices( $wp_locale->weekday_abbrev );
823 823
 											$day_names_min = $admin_class->yikes_jQuery_datepicker_strip_array_indices( $wp_locale->weekday_initial );
824
-											$date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field['type'] );
824
+											$date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field[ 'type' ] );
825 825
 											$first_day = get_option( 'start_of_week' );
826 826
 											$isRTL = $wp_locale->is_rtl();
827 827
 										?>
@@ -842,10 +842,10 @@  discard block
 block discarded – undo
842 842
 												numberOfMonths: 1,
843 843
 												today: '<?php _e( 'Today', 'yikes-inc-easy-mailchimp-extender' ); ?>'
844 844
 											};
845
-											jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').datepicker().on( 'show', function( e ) {
846
-												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'height' );
845
+											jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').datepicker().on( 'show', function( e ) {
846
+												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'height' );
847 847
 												date_picker_height = parseInt( date_picker_height.replace( 'px', '' ) ) + parseInt( 15 ) + 'px';
848
-												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'width' ).replace( 'px', '' );
848
+												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'width' ).replace( 'px', '' );
849 849
 												if( date_picker_width > 500 ) {
850 850
 													date_picker_width = 500;
851 851
 												}
@@ -855,27 +855,27 @@  discard block
 block discarded – undo
855 855
 									</script>
856 856
 								<?php
857 857
 
858
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
858
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
859 859
 								// store empty number for looping
860 860
 								$x = 0;
861 861
 
862 862
 								?>
863
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
863
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
864 864
 
865 865
 										<!-- dictate label visibility -->
866
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
867
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
868
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
866
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
867
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
868
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
869 869
 											</span>
870 870
 										<?php } ?>
871 871
 
872
-										<input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $field['type'] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
872
+										<input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $field[ 'type' ] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
873 873
 
874 874
 										<!-- description -->
875
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
875
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
876 876
 											<p class="form-field-description">
877 877
 												<small>
878
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
878
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
879 879
 												</small>
880 880
 											</p>
881 881
 										<?php } ?>
@@ -886,36 +886,36 @@  discard block
 block discarded – undo
886 886
 							break;
887 887
 
888 888
 							case 'dropdown':
889
-								$default_value = $field['default_choice'];
889
+								$default_value = $field[ 'default_choice' ];
890 890
 								// store empty number for looping
891 891
 								$x = 0;
892 892
 								// hidden labels
893 893
 
894 894
 									?>
895
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
895
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
896 896
 										<!-- dictate label visibility -->
897
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
898
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
899
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
897
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
898
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
899
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
900 900
 											</span>
901 901
 										<?php } ?>
902 902
 
903
-										<select <?php echo implode( ' ' , $field_array ); ?>>
903
+										<select <?php echo implode( ' ', $field_array ); ?>>
904 904
 											<?php
905 905
 												// decode for looping
906
-												$choices = json_decode( $field['choices'], true );
907
-												foreach( $choices as $choice ) {
908
-													?><option value="<?php echo $choice; ?>" <?php selected( $default_value , $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
906
+												$choices = json_decode( $field[ 'choices' ], true );
907
+												foreach ( $choices as $choice ) {
908
+													?><option value="<?php echo $choice; ?>" <?php selected( $default_value, $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
909 909
 													$x++;
910 910
 												}
911 911
 											?>
912 912
 										</select>
913 913
 
914 914
 										<!-- description -->
915
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
915
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
916 916
 											<p class="form-field-description">
917 917
 												<small>
918
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
918
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
919 919
 												</small>
920 920
 											</p>
921 921
 										<?php } ?>
@@ -929,13 +929,13 @@  discard block
 block discarded – undo
929 929
 							case 'radio':
930 930
 							case 'checkbox':
931 931
 								// remove the ID (as to not assign the same ID to every radio button)
932
-								unset( $field_array['id'] );
933
-								$choices = json_decode( $field['choices'], true );
932
+								unset( $field_array[ 'id' ] );
933
+								$choices = json_decode( $field[ 'choices' ], true );
934 934
 								// assign a default choice
935
-								$default_value = ( isset( $field['default_choice'] ) && $field['default_choice'] != '' ) ? $field['default_choice'] : $choices[0];
935
+								$default_value = ( isset( $field[ 'default_choice' ] ) && $field[ 'default_choice' ] != '' ) ? $field[ 'default_choice' ] : $choices[ 0 ];
936 936
 								// if the form was submit, but failed, let's reset the post data
937
-								if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) {
938
-									$default_value = $_POST[$field['merge']];
937
+								if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) {
938
+									$default_value = $_POST[ $field[ 'merge' ] ];
939 939
 								}
940 940
 								$count = count( $choices );
941 941
 								$i = 1;
@@ -944,20 +944,20 @@  discard block
 block discarded – undo
944 944
 								// hidden labels
945 945
 
946 946
 									?>
947
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
947
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
948 948
 
949 949
 										<!-- dictate label visibility -->
950
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
951
-											<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?> checkbox-parent-label">
952
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
950
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
951
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?> checkbox-parent-label">
952
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
953 953
 											</span>
954 954
 										<?php }
955 955
 
956
-										foreach( $choices as $choice ) {
956
+										foreach ( $choices as $choice ) {
957 957
 											?>
958
-											<label for="<?php echo esc_attr( $field['merge'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $i === $count ) { ?> last-selection<?php } ?>" <?php if( $i == 1 ) { echo $field_array['required']; } ?>>
959
-												<input type="<?php echo esc_attr( $field['type'] ); ?>" name="<?php echo $field['merge']; ?>" id="<?php echo $field['merge'] . '-' . $i; ?>" <?php checked( $default_value , $x ); ?> value="<?php echo esc_attr( $choice ); ?>">
960
-												<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
958
+											<label for="<?php echo esc_attr( $field[ 'merge' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $i === $count ) { ?> last-selection<?php } ?>" <?php if ( $i == 1 ) { echo $field_array[ 'required' ]; } ?>>
959
+												<input type="<?php echo esc_attr( $field[ 'type' ] ); ?>" name="<?php echo $field[ 'merge' ]; ?>" id="<?php echo $field[ 'merge' ] . '-' . $i; ?>" <?php checked( $default_value, $x ); ?> value="<?php echo esc_attr( $choice ); ?>">
960
+												<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
961 961
 											</label>
962 962
 											<?php
963 963
 											$i++;
@@ -965,10 +965,10 @@  discard block
 block discarded – undo
965 965
 										}
966 966
 
967 967
 										// description
968
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
968
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
969 969
 											<p class="form-field-description">
970 970
 												<small>
971
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
971
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
972 972
 												</small>
973 973
 											</p>
974 974
 										<?php } ?>
@@ -984,26 +984,26 @@  discard block
 block discarded – undo
984 984
 
985 985
 
986 986
 						// store default choice
987
-						$default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : ( isset( $field['default_choice'] ) ? $field['default_choice'] : '' );
987
+						$default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : ( isset( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : '' );
988 988
 
989 989
 						// if the form was submit, but failed, let's reset the post data
990
-						if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
991
-							$default_choice = $_POST[$field['group_id']];
990
+						if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
991
+							$default_choice = $_POST[ $field[ 'group_id' ] ];
992 992
 						}
993 993
 
994 994
 						// get our groups
995
-						$groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( $field['groups'], true ) : array();
995
+						$groups = ( isset( $field[ 'groups' ] ) && ! empty( $field[ 'groups' ] ) ) ? json_decode( $field[ 'groups' ], true ) : array();
996 996
 
997 997
 						$count = count( $groups );
998 998
 
999
-						if( $field['type'] == 'checkboxes' ) {
999
+						if ( $field[ 'type' ] == 'checkboxes' ) {
1000 1000
 							$type = 'checkbox';
1001
-						} else if( $field['type'] == 'radio' ) {
1001
+						} else if ( $field[ 'type' ] == 'radio' ) {
1002 1002
 							$type = 'radio';
1003 1003
 						}
1004 1004
 
1005 1005
 						// loop over the interest group field types
1006
-						switch ( $field['type'] ) {
1006
+						switch ( $field[ 'type' ] ) {
1007 1007
 
1008 1008
 							case 'checkboxes':
1009 1009
 							case 'radio':
@@ -1011,18 +1011,18 @@  discard block
 block discarded – undo
1011 1011
 								$x = 1; // used to find the last item of our array
1012 1012
 
1013 1013
 									?>
1014
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1015
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1014
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1015
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1016 1016
 											<!-- dictate label visibility -->
1017
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label">
1018
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1017
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label">
1018
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
1019 1019
 											</span>
1020 1020
 									<?php
1021 1021
 										}
1022 1022
 
1023 1023
 										// Display Submission Errors
1024
-										if( ! empty( $missing_required_checkbox_interest_groups ) ) {
1025
-											if( in_array( $field['group_id'], $missing_required_checkbox_interest_groups ) ) {
1024
+										if ( ! empty( $missing_required_checkbox_interest_groups ) ) {
1025
+											if ( in_array( $field[ 'group_id' ], $missing_required_checkbox_interest_groups ) ) {
1026 1026
 												?>
1027 1027
 													<p class="yikes-mailchimp-required-interest-group-error">
1028 1028
 														<?php echo apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); ?>
@@ -1033,19 +1033,19 @@  discard block
 block discarded – undo
1033 1033
 
1034 1034
 
1035 1035
 
1036
-										foreach( $groups as $group ) {
1037
-											if( $field['type'] == 'checkboxes' ) {
1036
+										foreach ( $groups as $group ) {
1037
+											if ( $field[ 'type' ] == 'checkboxes' ) {
1038 1038
 												/* Setup the defaults for this field - varies if the field was previously submitted */
1039
-												if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
1040
-													$default_choice = $_POST[$field['group_id']];
1041
-												} elseif( ( ! isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted != 1 ) || ( isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted == 1 ) ) {
1042
-													$default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : array();
1039
+												if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
1040
+													$default_choice = $_POST[ $field[ 'group_id' ] ];
1041
+												} elseif ( ( ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 ) || ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 ) ) {
1042
+													$default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : array();
1043 1043
 												}
1044 1044
 											}
1045 1045
 											?>
1046
-											<label for="<?php echo $field['group_id'] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>">
1047
-												<input <?php if( isset( $field['require'] ) && $field['require'] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="<?php echo $field['group_id']; ?>[]" id="<?php echo $field['group_id'] . '-' . $i; ?>" <?php if( $field['type'] == 'checkboxes' ) { if( ( ( isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i , $default_choice )) || ! isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i , $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[$field['group_id']] ) ) && in_array( esc_attr( $group['name'] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[0] : $default_choice , $i ); } ?> value="<?php echo esc_attr( $group['name'] ); ?>">
1048
-												<?php echo $group['name']; ?>
1046
+											<label for="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>">
1047
+												<input <?php if ( isset( $field[ 'require' ] ) && $field[ 'require' ] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="<?php echo $field[ 'group_id' ]; ?>[]" id="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" <?php if ( $field[ 'type' ] == 'checkboxes' ) { if ( ( ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i, $default_choice ) ) || ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i, $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[ $field[ 'group_id' ] ] ) ) && in_array( esc_attr( $group[ 'name' ] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[ 0 ] : $default_choice, $i ); } ?> value="<?php echo esc_attr( $group[ 'name' ] ); ?>">
1048
+												<?php echo $group[ 'name' ]; ?>
1049 1049
 											</label>
1050 1050
 											<?php
1051 1051
 											$i++;
@@ -1053,10 +1053,10 @@  discard block
 block discarded – undo
1053 1053
 										}
1054 1054
 
1055 1055
 										// description
1056
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1056
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1057 1057
 											<p class="form-field-description">
1058 1058
 												<small>
1059
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1059
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1060 1060
 												</small>
1061 1061
 											</p>
1062 1062
 										<?php } ?>
@@ -1070,28 +1070,28 @@  discard block
 block discarded – undo
1070 1070
 
1071 1071
 									?>
1072 1072
 
1073
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1073
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1074 1074
 										<!-- dictate label visibility -->
1075
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1076
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>">
1077
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1075
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1076
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?>">
1077
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
1078 1078
 											</span>
1079 1079
 										<?php } ?>
1080 1080
 
1081
-										<select <?php echo implode( ' ' , $field_array ); ?>>
1081
+										<select <?php echo implode( ' ', $field_array ); ?>>
1082 1082
 											<?php
1083 1083
 												$i = 0;
1084
-												foreach( $groups as $group ) {
1085
-													?><option <?php selected( $i , $default_choice ); ?> value="<?php echo $group['name']; ?>"><?php echo esc_attr( $group['name'] ); ?></option><?php
1084
+												foreach ( $groups as $group ) {
1085
+													?><option <?php selected( $i, $default_choice ); ?> value="<?php echo $group[ 'name' ]; ?>"><?php echo esc_attr( $group[ 'name' ] ); ?></option><?php
1086 1086
 													$i++;
1087 1087
 												}
1088 1088
 											?>
1089 1089
 										</select>
1090 1090
 
1091
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1091
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1092 1092
 											<p class="form-field-description">
1093 1093
 												<small>
1094
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1094
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1095 1095
 												</small>
1096 1096
 											</p>
1097 1097
 										<?php } ?>
@@ -1108,21 +1108,21 @@  discard block
 block discarded – undo
1108 1108
 
1109 1109
 									?>
1110 1110
 
1111
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1111
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1112 1112
 
1113 1113
 										<!-- dictate label visibility -->
1114
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1115
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1116
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
1114
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1115
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1116
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
1117 1117
 											</span>
1118 1118
 										<?php }
1119 1119
 
1120 1120
 
1121
-										foreach( $groups as $group ) {
1121
+										foreach ( $groups as $group ) {
1122 1122
 											?>
1123
-											<label for="<?php echo $field['group_id'] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>" style="display:none;">
1124
-												<input type="radio" name="<?php echo $field['group_id']; ?>[]" id="<?php echo $field['group_id'] . '-' . $i; ?>" <?php if( $field['type'] == 'checkboxes' ) { if( in_array( $i , $default_choice ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[0] : $default_choice , $i ); } ?> value="<?php echo esc_attr( $group['name'] ); ?>">
1125
-												<?php echo esc_attr( stripslashes( str_replace( '' , '\'', $group['name'] ) ) ); ?>
1123
+											<label for="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>" style="display:none;">
1124
+												<input type="radio" name="<?php echo $field[ 'group_id' ]; ?>[]" id="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" <?php if ( $field[ 'type' ] == 'checkboxes' ) { if ( in_array( $i, $default_choice ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[ 0 ] : $default_choice, $i ); } ?> value="<?php echo esc_attr( $group[ 'name' ] ); ?>">
1125
+												<?php echo esc_attr( stripslashes( str_replace( '', '\'', $group[ 'name' ] ) ) ); ?>
1126 1126
 											</label>
1127 1127
 											<?php
1128 1128
 											$i++;
@@ -1130,10 +1130,10 @@  discard block
 block discarded – undo
1130 1130
 										}
1131 1131
 
1132 1132
 										// description
1133
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1133
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1134 1134
 											<p class="form-field-description">
1135 1135
 												<small>
1136
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
1136
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
1137 1137
 												</small>
1138 1138
 											</p>
1139 1139
 										<?php }
@@ -1150,11 +1150,11 @@  discard block
 block discarded – undo
1150 1150
 				do_action( 'yikes-mailchimp-additional-form-fields', $form_data );
1151 1151
 
1152 1152
 				/* if we've enabled reCAPTCHA protection */
1153
-				if( isset( $recaptcha_box ) ) {
1153
+				if ( isset( $recaptcha_box ) ) {
1154 1154
 					echo $recaptcha_box;
1155 1155
 				}
1156
-				if( is_user_logged_in() ) {
1157
-					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1156
+				if ( is_user_logged_in() ) {
1157
+					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1158 1158
 				} else {
1159 1159
 					$admin_class = '';
1160 1160
 				}
@@ -1164,29 +1164,29 @@  discard block
 block discarded – undo
1164 1164
 				<input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot" value="">
1165 1165
 
1166 1166
 				<!-- List ID -->
1167
-				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_settings['list_id']; ?>">
1167
+				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_settings[ 'list_id' ]; ?>">
1168 1168
 
1169 1169
 				<!-- Form that is being submitted! Used to display error/success messages above the correct form -->
1170 1170
 				<input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form" value="<?php echo $form_id; ?>">
1171 1171
 
1172 1172
 				<!-- Submit Button -->
1173 1173
 				<?php
1174
-					if( $form_inline ) {
1174
+					if ( $form_inline ) {
1175 1175
 						$submit_button_label_classes = array( 'empty-label' );
1176 1176
 						// If the number of fields, is equal to the hidden label count, add our class
1177 1177
 						// eg: All field labels are set to hidden.
1178 1178
 						if ( absint( $field_count ) === absint( $hidden_label_count ) ) {
1179
-							$submit_button_label_classes[] = 'labels-hidden';
1179
+							$submit_button_label_classes[ ] = 'labels-hidden';
1180 1180
 						}
1181 1181
 						echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="' . implode( ' ', $submit_button_label_classes ) . '">&nbsp;</span>';
1182 1182
 					}
1183 1183
 					// display the image or text based button
1184
-					if( $submit_button_type == 'text' ) {
1185
-						echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '">' .  apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '</button>', $form_data['id'] );
1184
+					if ( $submit_button_type == 'text' ) {
1185
+						echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data[ 'id' ] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data[ 'id' ] ) . '">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '</button>', $form_data[ 'id' ] );
1186 1186
 					} else {
1187
-						echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '">', $form_data['id'] );
1187
+						echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data[ 'id' ] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data[ 'id' ] ) . '">', $form_data[ 'id' ] );
1188 1188
 					}
1189
-					if( $form_inline ) {
1189
+					if ( $form_inline ) {
1190 1190
 						echo '</label>';
1191 1191
 					}
1192 1192
 				?>
@@ -1198,8 +1198,8 @@  discard block
 block discarded – undo
1198 1198
 
1199 1199
 		<?php
1200 1200
 			/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
1201
-			if( is_user_logged_in() ) {
1202
-				if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
1201
+			if ( is_user_logged_in() ) {
1202
+				if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
1203 1203
 					echo $edit_form_link;
1204 1204
 				}
1205 1205
 			}
@@ -1214,16 +1214,16 @@  discard block
 block discarded – undo
1214 1214
 		*	Update the impressions count
1215 1215
 		*	for non-admins
1216 1216
 		*/
1217
-		if( !current_user_can( 'manage_options' ) ) {
1218
-			$form_data['impressions']++;
1217
+		if ( ! current_user_can( 'manage_options' ) ) {
1218
+			$form_data[ 'impressions' ]++;
1219 1219
 			$wpdb->update(
1220 1220
 				$wpdb->prefix . 'yikes_easy_mc_forms',
1221 1221
 					array(
1222
-						'impressions' => $form_data['impressions'],
1222
+						'impressions' => $form_data[ 'impressions' ],
1223 1223
 					),
1224 1224
 					array( 'ID' => $form ),
1225 1225
 					array(
1226
-						'%d',	// send welcome email
1226
+						'%d', // send welcome email
1227 1227
 					),
1228 1228
 					array( '%d' )
1229 1229
 				);
Please login to merge, or discard this patch.