Completed
Push — staging ( 112ef9...7a9dad )
by Evan
63:44 queued 43:40
created
admin/partials/menu/add-ons.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@
 block discarded – undo
7 7
 <div class="wrap">
8 8
 
9 9
 	<!-- Freddie Logo -->
10
-	<img src="<?php echo esc_url( YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png' ); ?>" alt="<?php esc_attr_e( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" />
10
+	<img src="<?php echo esc_url( YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png' ); ?>" alt="<?php esc_attr_e( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" />
11 11
 
12
-	<h1>YIKES Easy Forms for MailChimp | <?php echo esc_attr__( 'Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?> &nbsp; <a href="https://yikesplugins.com/plugins/?plugins=MailChimp" target="_blank" class="button-primary coming-soon-button" title="<?php esc_attr_e( 'View All Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php esc_attr_e( 'View All Add-Ons' , 'yikes-inc-easy-mailchimp-extender' ); ?> <span class="dashicons dashicons-external"></span></a></h1>
12
+	<h1>YIKES Easy Forms for MailChimp | <?php echo esc_attr__( 'Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?> &nbsp; <a href="https://yikesplugins.com/plugins/?plugins=MailChimp" target="_blank" class="button-primary coming-soon-button" title="<?php esc_attr_e( 'View All Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php esc_attr_e( 'View All Add-Ons', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class="dashicons dashicons-external"></span></a></h1>
13 13
 
14 14
 	<!-- Addons Page Description -->
15
-	<p class="yikes-easy-mc-about-text about-text"><?php esc_attr_e( "Below you'll find a list of add-ons available for YIKES Easy Forms for MailChimp. Each add-on extends the base functionality of the free plugin." , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
15
+	<p class="yikes-easy-mc-about-text about-text"><?php esc_attr_e( "Below you'll find a list of add-ons available for YIKES Easy Forms for MailChimp. Each add-on extends the base functionality of the free plugin.", 'yikes-inc-easy-mailchimp-extender' ); ?></p>
16 16
 
17 17
 	<!-- Add-On Container -->
18 18
 	<section id="add-ons">
Please login to merge, or discard this patch.
includes/add_ons/popups.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 
33 33
 	<div class="addon-footer-wrap give-clearfix">
34 34
 		<a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank">
35
-			<?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?>
35
+			<?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?>
36 36
 		<span class="dashicons dashicons-external"></span></a>
37 37
 	</div>
38 38
 
Please login to merge, or discard this patch.
includes/add_ons/eu-compliance.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 
33 33
 	<div class="addon-footer-wrap give-clearfix">
34 34
 		<a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank">
35
-			<?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?>
35
+			<?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?>
36 36
 		<span class="dashicons dashicons-external"></span></a>
37 37
 	</div>
38 38
 
Please login to merge, or discard this patch.
includes/add_ons/customizer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 
33 33
 	<div class="addon-footer-wrap give-clearfix">
34 34
 		<a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank">
35
-			<?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?>
35
+			<?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?>
36 36
 		<span class="dashicons dashicons-external"></span></a>
37 37
 	</div>
38 38
 
Please login to merge, or discard this patch.
includes/add_ons/incentives.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 
33 33
 	<div class="addon-footer-wrap give-clearfix">
34 34
 		<a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank">
35
-			<?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?>
35
+			<?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?>
36 36
 		<span class="dashicons dashicons-external"></span></a>
37 37
 	</div>
38 38
 
Please login to merge, or discard this patch.
admin/partials/helpers/knowledge-base-article-links.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 	printf( '<h2>' . esc_attr__( 'Popular Knowledge Base Articles', 'yikes-inc-easy-mailchimp-extender' ) . '</h2>' );
31 31
 	printf( '<ol>' );
32 32
 	foreach ( $knowledge_base_links as $kb_link ) {
33
-		echo wp_kses_post( '<li><a href="' . esc_url( $kb_link['href'] ) . '" title="' . esc_attr( $kb_link['title'] ) . '" target="_blank">' . esc_attr( $kb_link['title'] ) . '</a></li>' );
33
+		echo wp_kses_post( '<li><a href="' . esc_url( $kb_link[ 'href' ] ) . '" title="' . esc_attr( $kb_link[ 'title' ] ) . '" target="_blank">' . esc_attr( $kb_link[ 'title' ] ) . '</a></li>' );
34 34
 	}
35 35
 	printf( '</ol>' );
36 36
 }
Please login to merge, or discard this patch.
public/class-yikes-inc-easy-mailchimp-extender-public.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		 * 	@since 6.0.0
47 47
 		 */
48 48
 		if ( ! defined( 'YIKES_MC_VERSION' ) ) {
49
-			define( 'YIKES_MC_VERSION' , $version );
49
+			define( 'YIKES_MC_VERSION', $version );
50 50
 		}
51 51
 		/*
52 52
 		*	Include our helper functions
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 		// include our ajax processing class
64 64
 		require_once( YIKES_MC_PATH . 'public/partials/ajax/class.public_ajax.php' );
65 65
 		// Include our error logging class
66
-		add_action( 'init' , array( $this , 'load_error_logging_class' ) , 1 );
66
+		add_action( 'init', array( $this, 'load_error_logging_class' ), 1 );
67 67
 		// load our checkbox classes
68
-		add_action( 'init' , array( $this , 'load_checkbox_integration_classes' ) , 1 );
68
+		add_action( 'init', array( $this, 'load_checkbox_integration_classes' ), 1 );
69 69
 		// custom front end filter
70 70
 		add_action( 'init', array( $this, 'yikes_custom_frontend_content_filter' ) );
71 71
 		// Process non-ajax forms in the header
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
 	**/
101 101
 	public function load_checkbox_integration_classes() {
102 102
 		// store our options
103
-		$integrations = get_option( 'optin-checkbox-init' , '' );
104
-		if( !empty( $integrations ) ) {
103
+		$integrations = get_option( 'optin-checkbox-init', '' );
104
+		if ( ! empty( $integrations ) ) {
105 105
 			// load our mail integrations class
106 106
 			require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations.php';
107 107
 			// loop over selected classes and load them up!
108
-			foreach( $integrations as $integration => $value ) {
109
-				if( isset( $value['value'] ) && $value['value'] == 'on' ) {
108
+			foreach ( $integrations as $integration => $value ) {
109
+				if ( isset( $value[ 'value' ] ) && $value[ 'value' ] == 'on' ) {
110 110
 					// load our class extensions
111
-					require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.'.$integration.'-checkbox.php';
111
+					require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.' . $integration . '-checkbox.php';
112 112
 				}
113 113
 			}
114 114
 		}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 * @since 6.0.0
123 123
 	 */
124 124
 	public function load_error_logging_class() {
125
-		if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
125
+		if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
126 126
 			// if error logging is enabled we should include our error logging class
127 127
 			require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
128 128
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging;
@@ -135,18 +135,18 @@  discard block
 block discarded – undo
135 135
 	*	@since 6.0.3.4
136 136
 	*/
137 137
 	public function yikes_process_non_ajax_forms( $form_submitted ) {
138
-		global $wpdb,$post;
139
-		$form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? (int) $_POST['yikes-mailchimp-submitted-form'] : false; // store form id
140
-		if( $form_id ) {
138
+		global $wpdb, $post;
139
+		$form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? (int) $_POST[ 'yikes-mailchimp-submitted-form' ] : false; // store form id
140
+		if ( $form_id ) {
141 141
 			$form_settings = self::yikes_retrieve_form_settings( $form_id );
142
-			if( isset( $_POST ) && !empty( $_POST ) && isset( $form_id ) && $form_settings['submission_settings']['ajax'] == 0 ) {
143
-				if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { // ensure we only process the form that was submitted
142
+			if ( isset( $_POST ) && ! empty( $_POST ) && isset( $form_id ) && $form_settings[ 'submission_settings' ][ 'ajax' ] == 0 ) {
143
+				if ( $_POST[ 'yikes-mailchimp-submitted-form' ] == $form_id ) { // ensure we only process the form that was submitted
144 144
 					// lets include our form processing file
145 145
 					include_once( YIKES_MC_PATH . 'public/partials/shortcodes/process/process_form_submission.php' );
146
-					if( $form_settings['submission_settings']['redirect_on_submission'] == '1' ) {
147
-						if( $form_submitted == 1 ) {
146
+					if ( $form_settings[ 'submission_settings' ][ 'redirect_on_submission' ] == '1' ) {
147
+						if ( $form_submitted == 1 ) {
148 148
 							// decode our settings
149
-							$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'];
149
+							$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' ];
150 150
 							wp_redirect( apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_page ), $form_id, $post ) );
151 151
 							exit;
152 152
 						}
@@ -162,27 +162,27 @@  discard block
 block discarded – undo
162 162
 	*/
163 163
 	public static function yikes_retrieve_form_settings( $form_id ) {
164 164
 		// if no form id, abort
165
-		if( ! $form_id ) {
165
+		if ( ! $form_id ) {
166 166
 			return;
167 167
 		}
168 168
 		global $wpdb;
169 169
 		$form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form_id . '', ARRAY_A ); // query for our form data
170
-		if( $form_results ) {
170
+		if ( $form_results ) {
171 171
 			// empty array, to populate with form settings
172 172
 			$form_settings = array();
173
-			$form_data = $form_results[0]; // store the results
173
+			$form_data = $form_results[ 0 ]; // store the results
174 174
 			// store the settings in our array
175
-			$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)
176
-			$form_settings['form_name'] = esc_attr( $form_data['form_name'] ); // form name
177
-			$form_settings['form_description'] = esc_attr( stripslashes( $form_data['form_description'] ) );
178
-			$form_settings['fields'] = json_decode( $form_data['fields'] , true );
179
-			$form_settings['styles'] = json_decode( stripslashes( $form_data['custom_styles'] ) , true );
180
-			$form_settings['send_welcome'] = $form_data['send_welcome_email'];
181
-			$form_settings['submission_settings'] = json_decode( stripslashes( $form_data['submission_settings'] ) , true );
182
-			$form_settings['optin_settings'] = json_decode( stripslashes( $form_data['optin_settings'] ) , true );
183
-			$form_settings['error_messages'] = json_decode( $form_data['error_messages'] , true );
184
-			$form_settings['notifications'] = isset( $form_data['custom_notifications'] ) ? json_decode( stripslashes( $form_data['custom_notifications'] ) , true ) : '';
185
-			$form_settings['submissions'] = $form_data['submissions'];
175
+			$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)
176
+			$form_settings[ 'form_name' ] = esc_attr( $form_data[ 'form_name' ] ); // form name
177
+			$form_settings[ 'form_description' ] = esc_attr( stripslashes( $form_data[ 'form_description' ] ) );
178
+			$form_settings[ 'fields' ] = json_decode( $form_data[ 'fields' ], true );
179
+			$form_settings[ 'styles' ] = json_decode( stripslashes( $form_data[ 'custom_styles' ] ), true );
180
+			$form_settings[ 'send_welcome' ] = $form_data[ 'send_welcome_email' ];
181
+			$form_settings[ 'submission_settings' ] = json_decode( stripslashes( $form_data[ 'submission_settings' ] ), true );
182
+			$form_settings[ 'optin_settings' ] = json_decode( stripslashes( $form_data[ 'optin_settings' ] ), true );
183
+			$form_settings[ 'error_messages' ] = json_decode( $form_data[ 'error_messages' ], true );
184
+			$form_settings[ 'notifications' ] = isset( $form_data[ 'custom_notifications' ] ) ? json_decode( stripslashes( $form_data[ 'custom_notifications' ] ), true ) : '';
185
+			$form_settings[ 'submissions' ] = $form_data[ 'submissions' ];
186 186
 			// return the given form settings in an array
187 187
 			return $form_settings;
188 188
 		}
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
 			return;
210 210
 		}
211 211
 		// trim trailing period
212
-		if ( isset( $form_settings['error_messages']['update-link'] ) && ! empty( $form_settings['error_messages']['update-link'] ) ) {
213
-			$response_text = $form_settings['error_messages']['update-link'];
212
+		if ( isset( $form_settings[ 'error_messages' ][ 'update-link' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'update-link' ] ) ) {
213
+			$response_text = $form_settings[ 'error_messages' ][ 'update-link' ];
214 214
 			// extract the link text
215 215
 			preg_match( '/\[link].*?\[\/link\]/', $response_text, $link_text );
216 216
 			if ( $link_text && ! empty( $link_text ) ) {
217 217
 				// Extract the custom link text ([link]*[/link])
218
-				$custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[0], $link ) ) );
218
+				$custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[ 0 ], $link ) ) );
219 219
 				// Replace the link text, with our custom link text
220 220
 				$response_text = str_replace( $link_text, $custom_link_text, $response_text );
221 221
 			}
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
 			return;
243 243
 		}
244 244
 		// trim trailing period
245
-		if ( isset( $form_settings['error_messages']['already-subscribed'] ) && ! empty( $form_settings['error_messages']['already-subscribed'] ) ) {
246
-			$response_text = str_replace( '[email]', $email, $form_settings['error_messages']['already-subscribed'] );
245
+		if ( isset( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) ) {
246
+			$response_text = str_replace( '[email]', $email, $form_settings[ 'error_messages' ][ 'already-subscribed' ] );
247 247
 		}
248 248
 		// Return our new string
249 249
 		return $response_text;
Please login to merge, or discard this patch.
public/partials/shortcodes/process_form_shortcode.php 1 patch
Spacing   +305 added lines, -305 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 			'recaptcha_data_callback' => '', // set a custom js callback function to run after a successful recaptcha response - default none
22 22
 			'recaptcha_expired_callback' => '', // set a custom js callback function to run after the recaptcha has expired - default none
23 23
 			'inline' => '0',
24
-		), $atts , 'yikes-mailchimp' )
24
+		), $atts, 'yikes-mailchimp' )
25 25
 	);
26 26
 
27 27
 	// set globals
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	$form_submitted = isset( $form_submitted ) ? $form_submitted : 0;
32 32
 
33 33
 	/* If the user hasn't authenticated yet, lets kill off */
34
-	if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) {
35
-		return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key." , 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
34
+	if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) {
35
+		return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key.", 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
36 36
 	}
37 37
 
38 38
 	// if the user forgot to specify a form ID, lets kill of and warn them.
39
-	if( ! $form ) {
39
+	if ( ! $form ) {
40 40
 		return __( 'Whoops, it looks like you forgot to specify a form to display.', 'yikes-inc-easy-mailchimp-extender' );
41 41
 	}
42 42
 
@@ -45,39 +45,39 @@  discard block
 block discarded – undo
45 45
 	$form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form . '', ARRAY_A );
46 46
 
47 47
 	// confirm we have some results, or return an error
48
-	if( !$form_results ) {
49
-		return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form." , 'yikes-inc-easy-mailchimp-extender' );
48
+	if ( ! $form_results ) {
49
+		return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form.", 'yikes-inc-easy-mailchimp-extender' );
50 50
 	}
51 51
 
52 52
 	/*
53 53
 	*	Check if the user wants to use reCAPTCHA Spam Prevention
54 54
 	*/
55
-	if( get_option( 'yikes-mc-recaptcha-status' , '' ) == '1' ) {
55
+	if ( get_option( 'yikes-mc-recaptcha-status', '' ) == '1' ) {
56 56
 		// allow users to manually set recaptcha (instead of globally - recaptcha="1"/recaptcha="0" - but still needs to be globally enabled on the settings page)
57
-		if( ! isset( $atts['recaptcha'] ) || ( isset( $atts['recaptcha'] ) && $atts['recaptcha'] == '1' ) ) {
57
+		if ( ! isset( $atts[ 'recaptcha' ] ) || ( isset( $atts[ 'recaptcha' ] ) && $atts[ 'recaptcha' ] == '1' ) ) {
58 58
 			// if either of the Private the Secret key is left blank, we should display an error back to the user
59
-			if( get_option( 'yikes-mc-recaptcha-site-key' , '' ) == '' ) {
60
-				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
59
+			if ( get_option( 'yikes-mc-recaptcha-site-key', '' ) == '' ) {
60
+				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
61 61
 			}
62
-			if( get_option( 'yikes-mc-recaptcha-secret-key' , '' ) == '' ) {
63
-				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
62
+			if ( get_option( 'yikes-mc-recaptcha-secret-key', '' ) == '' ) {
63
+				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
64 64
 			}
65 65
 
66
-			if( ! empty( $atts['recaptcha_type'] ) ) {
67
-				echo $atts['recaptcha_type'];
66
+			if ( ! empty( $atts[ 'recaptcha_type' ] ) ) {
67
+				echo $atts[ 'recaptcha_type' ];
68 68
 			}
69 69
 
70 70
 			// Store the site language (to load recaptcha in a specific language)
71 71
 			$locale = get_locale();
72 72
 			$locale_split = explode( '_', $locale );
73 73
 			// Setup reCAPTCHA parameters
74
-			$lang = ( isset( $locale_split ) ? $locale_split[0] : $locale );
75
-			$lang = ( isset( $atts['recaptcha_lang'] ) ) ? $atts['recaptcha_lang'] : $locale_split[0];
76
-			$type = ( isset( $atts['recaptcha_type'] ) ) ? strtolower( $atts['recaptcha_type'] ) : 'image'; // setup recaptcha type
77
-			$theme= ( isset( $atts['recaptcha_theme'] ) ) ? strtolower( $atts['recaptcha_theme'] ) : 'light'; // setup recaptcha theme
78
-			$size = ( isset( $atts['recaptcha_size'] ) ) ? strtolower( $atts['recaptcha_size'] ) : 'normal'; // setup recaptcha size
79
-			$data_callback = ( isset( $atts['recaptcha_data_callback'] ) ) ? $atts['recaptcha_data_callback'] : false; // setup recaptcha size
80
-			$expired_callback = ( isset( $atts['recaptcha_expired_callback'] ) ) ? $atts['recaptcha_expired_callback'] : false; // setup recaptcha size
74
+			$lang = ( isset( $locale_split ) ? $locale_split[ 0 ] : $locale );
75
+			$lang = ( isset( $atts[ 'recaptcha_lang' ] ) ) ? $atts[ 'recaptcha_lang' ] : $locale_split[ 0 ];
76
+			$type = ( isset( $atts[ 'recaptcha_type' ] ) ) ? strtolower( $atts[ 'recaptcha_type' ] ) : 'image'; // setup recaptcha type
77
+			$theme = ( isset( $atts[ 'recaptcha_theme' ] ) ) ? strtolower( $atts[ 'recaptcha_theme' ] ) : 'light'; // setup recaptcha theme
78
+			$size = ( isset( $atts[ 'recaptcha_size' ] ) ) ? strtolower( $atts[ 'recaptcha_size' ] ) : 'normal'; // setup recaptcha size
79
+			$data_callback = ( isset( $atts[ 'recaptcha_data_callback' ] ) ) ? $atts[ 'recaptcha_data_callback' ] : false; // setup recaptcha size
80
+			$expired_callback = ( isset( $atts[ 'recaptcha_expired_callback' ] ) ) ? $atts[ 'recaptcha_expired_callback' ] : false; // setup recaptcha size
81 81
 			// Pass the shortcode parameters through a filter
82 82
 			$recaptcha_shortcode_params = apply_filters( 'yikes-mailchimp-recaptcha-parameters', array(
83 83
 				'language' => $lang,
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 				'expired_callback' => $expired_callback,
89 89
 			), $form );
90 90
 			// enqueue Google recaptcha JS
91
-			wp_register_script( 'google-recaptcha-js' , 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params['language'] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ) , 'all' );
91
+			wp_register_script( 'google-recaptcha-js', 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params[ 'language' ] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ), 'all' );
92 92
 			wp_enqueue_script( 'google-recaptcha-js' );
93
-			$recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key' , '' );
94
-			$recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params['theme'] . '" data-type="' . $recaptcha_shortcode_params['type'] . '" data-size="' . $recaptcha_shortcode_params['size'] . '" data-callback="' . $recaptcha_shortcode_params['success_callback'] . '" data-expired-callback="' . $recaptcha_shortcode_params['expired_callback'] . '"></div>';
93
+			$recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key', '' );
94
+			$recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params[ 'theme' ] . '" data-type="' . $recaptcha_shortcode_params[ 'type' ] . '" data-size="' . $recaptcha_shortcode_params[ 'size' ] . '" data-callback="' . $recaptcha_shortcode_params[ 'success_callback' ] . '" data-expired-callback="' . $recaptcha_shortcode_params[ 'expired_callback' ] . '"></div>';
95 95
 			?>
96 96
 			<script type="text/javascript">
97 97
 				/* Script Callback to init. multiple recaptchas on a single page */
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	}
119 119
 
120 120
 	// place our results into a seperate variable for easy looping
121
-	$form_data = $form_results[0];
121
+	$form_data = $form_results[ 0 ];
122 122
 
123 123
 	// store our variables
124
-	$form_id = (int) $form_data['id']; // form id (the id of the form in the database)
124
+	$form_id = (int) $form_data[ 'id' ]; // form id (the id of the form in the database)
125 125
 
126 126
 	/*
127 127
 	*	Get the stored form settings
@@ -130,32 +130,32 @@  discard block
 block discarded – undo
130 130
 	*/
131 131
 	$form_settings = Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $form_id );
132 132
 
133
-	$additional_form_settings = ( isset( $form_data['form_settings'] ) ) ? json_decode( $form_data['form_settings'], true ) : false;
133
+	$additional_form_settings = ( isset( $form_data[ 'form_settings' ] ) ) ? json_decode( $form_data[ 'form_settings' ], true ) : false;
134 134
 	// store our options from the additional form settings array
135
-	$form_classes = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-class-names'] : '';
136
-	$inline_form = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-inline-form'] : '';
137
-	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-submit-button-type'] : 'text';
138
-	$submit_button_text = ( $additional_form_settings && $additional_form_settings['yikes-easy-mc-submit-button-text'] != '' ) ? esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-text'] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' );
139
-	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings['yikes-easy-mc-submit-button-image'] ) : '';
140
-	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-classes'] ) : '';
135
+	$form_classes = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-class-names' ] : '';
136
+	$inline_form = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-inline-form' ] : '';
137
+	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-submit-button-type' ] : 'text';
138
+	$submit_button_text = ( $additional_form_settings && $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] != '' ) ? esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' );
139
+	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings[ 'yikes-easy-mc-submit-button-image' ] ) : '';
140
+	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-classes' ] ) : '';
141 141
 	// scheuldes
142
-	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-schedule'] : false;
143
-	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-start'] : '';;
144
-	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-end'] : '';
145
-	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-pending-message'] : '';
146
-	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-expired-message'] : '';
142
+	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-schedule' ] : false;
143
+	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-start' ] : ''; ;
144
+	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-end' ] : '';
145
+	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ] : '';
146
+	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ] : '';
147 147
 	// register required
148
-	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-login-required'] : false;
149
-	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-login-message'] : '';
148
+	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-login-required' ] : false;
149
+	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-login-message' ] : '';
150 150
 	// store number of fields
151
-	$field_count = (int) count( $form_settings['fields'] );
151
+	$field_count = (int) count( $form_settings[ 'fields' ] );
152 152
 
153 153
 	// confirm we actually have fields, before looping
154
-	if( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) {
154
+	if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) {
155 155
 		// loop over each field, if it's set to hidden -- subtract it from the field count
156 156
 		// this throws off the layout for inline forms setup below
157
-		foreach( json_decode( $form_data['fields'] ) as $form_field ) {
158
-			if( isset( $form_field->hide ) && $form_field->hide == 1 ) {
157
+		foreach ( json_decode( $form_data[ 'fields' ] ) as $form_field ) {
158
+			if ( isset( $form_field->hide ) && $form_field->hide == 1 ) {
159 159
 				$field_count--;
160 160
 			}
161 161
 		}
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
 	*	If login is required, abort
166 166
 	*	@since 6.0.3.8
167 167
 	*/
168
-	if( $form_login_required ) {
169
-		if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
168
+	if ( $form_login_required ) {
169
+		if ( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
170 170
 			ob_start();
171 171
 				?>
172 172
 					<div class="yikes-mailchimp-login-required yikes-mailchimp-form-<?php echo $form_id; ?>-login-required">
@@ -182,19 +182,19 @@  discard block
 block discarded – undo
182 182
 	*	Check if schedule is set for this form
183 183
 	*	@since 6.0.3.8
184 184
 	*/
185
-	if( $form_schedule_state ) {
185
+	if ( $form_schedule_state ) {
186 186
 		// store current date
187 187
 		$current_date = strtotime( current_time( 'm/d/Y g:iA' ) );
188 188
 
189 189
 		// the the current date is less than the form scheduled start date
190
-		if( $current_date < $form_schedule_start ) {
190
+		if ( $current_date < $form_schedule_start ) {
191 191
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_pending_message );
192 192
 			return;
193 193
 			// abort
194 194
 		}
195 195
 
196 196
 		// The current date is past or equal to the end date, aka form has now expired
197
-		if( $current_date >= $form_schedule_end ) {
197
+		if ( $current_date >= $form_schedule_end ) {
198 198
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_expired_message );
199 199
 			return;
200 200
 			// abort
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
 
204 204
 	// setup the submit button text
205 205
 	// shortcode parameter takes precedence over option
206
-	if( isset( $atts['submit'] ) ) {
207
-		$submit = $atts['submit'];
206
+	if ( isset( $atts[ 'submit' ] ) ) {
207
+		$submit = $atts[ 'submit' ];
208 208
 	} else {
209 209
 		$submit = $submit_button_text;
210 210
 	}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	$page_data = $post;
215 215
 
216 216
 	// Remove the post_password from this for security
217
-	if( isset( $page_data->post_password ) ) {
217
+	if ( isset( $page_data->post_password ) ) {
218 218
 		unset( $page_data->post_password );
219 219
 	}
220 220
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	*	to exclude styles from loading, add `define( 'YIKES_MAILCHIMP_EXCLUDE_STYLES', true );` to functions.php
229 229
 	*	@since 6.0.3.8
230 230
 	*/
231
-	if( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
231
+	if ( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
232 232
 		// enqueue the form styles
233 233
 		wp_enqueue_style( 'yikes-inc-easy-mailchimp-public-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-extender-public.min.css', array( $last_key ) );
234 234
 	}
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 	/**
237 237
 	*	Check for form inline parameter
238 238
 	*/
239
-	$form_inline = ( isset( $atts['inline'] ) && ( $atts['inline'] == 1 || $atts['inline'] == 'true' ) ) ? true : false;
239
+	$form_inline = ( isset( $atts[ 'inline' ] ) && ( $atts[ 'inline' ] == 1 || $atts[ 'inline' ] == 'true' ) ) ? true : false;
240 240
 	// recheck from our form options
241
-	if( ! $form_inline ) {
242
-		$form_inline = ( isset( $additional_form_settings['yikes-easy-mc-inline-form'] ) && $additional_form_settings['yikes-easy-mc-inline-form'] == 1 ) ? true : false;
241
+	if ( ! $form_inline ) {
242
+		$form_inline = ( isset( $additional_form_settings[ 'yikes-easy-mc-inline-form' ] ) && $additional_form_settings[ 'yikes-easy-mc-inline-form' ] == 1 ) ? true : false;
243 243
 	}
244
-	if( $form_inline ) {
244
+	if ( $form_inline ) {
245 245
 		$field_width = (float) ( 100 / $field_count );
246 246
 		$submit_button_width = (float) ( 20 / $field_count );
247 247
 		/*
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 	<?php
271 271
 
272 272
 		/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
273
-		if( is_user_logged_in() ) {
274
-			if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
273
+		if ( is_user_logged_in() ) {
274
+			if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
275 275
 				$edit_form_link = '<span class="edit-link">';
276
-					$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_settings['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
276
+					$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $form ) ) . '" title="' . __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_settings[ 'form_name' ] ) . '">' . __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
277 277
 				$edit_form_link .= '</span>';
278
-				$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $form, ucwords( $form_settings['form_name'] ) );
278
+				$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $form, ucwords( $form_settings[ 'form_name' ] ) );
279 279
 			} else {
280 280
 				$edit_form_link = '';
281 281
 			}
@@ -284,16 +284,16 @@  discard block
 block discarded – undo
284 284
 		// ensure there is an 'email' field the user can fill out
285 285
 		// or else MailChimp throws errors at you
286 286
 			// extract our array keys
287
-			if( isset( $form_settings['fields'] ) && ! empty( $form_settings['fields'] ) ) {
288
-				$array_keys = array_keys( $form_settings['fields'] );
287
+			if ( isset( $form_settings[ 'fields' ] ) && ! empty( $form_settings[ 'fields' ] ) ) {
288
+				$array_keys = array_keys( $form_settings[ 'fields' ] );
289 289
 				// check for EMAIL in that array
290
-				if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) {
291
-					return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>';
290
+				if ( ! in_array( 'EMAIL', $array_keys ) && ! in_array( 'email', $array_keys ) ) {
291
+					return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>';
292 292
 				}
293 293
 			} else {
294
-				$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
295
-				if( is_user_logged_in() ) {
296
-					if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
294
+				$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
295
+				if ( is_user_logged_in() ) {
296
+					if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
297 297
 						return $error . $edit_form_link;
298 298
 					}
299 299
 				} else {
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
 		*	Set a custom title using custom_title="lorem ipsum" parameter in the shortcode
312 312
 		*	- This takes precedence over the title set
313 313
 		*/
314
-		if( ! empty( $title ) && $title == 1 && isset( $atts['custom_title'] ) ) {
315
-			echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts['custom_title'] ), $form_id ) . '</h3>';
314
+		if ( ! empty( $title ) && $title == 1 && isset( $atts[ 'custom_title' ] ) ) {
315
+			echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts[ 'custom_title' ] ), $form_id ) . '</h3>';
316 316
 		} else {
317 317
 			// display the form description if the user
318 318
 			// has specified to do so
319
-			if( ! empty( $title ) && $title == 1 ) {
320
-				echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_settings['form_name'] ), $form_id ) . '</h3>';
319
+			if ( ! empty( $title ) && $title == 1 ) {
320
+				echo '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_settings[ 'form_name' ] ), $form_id ) . '</h3>';
321 321
 			}
322 322
 		}
323 323
 
@@ -325,21 +325,21 @@  discard block
 block discarded – undo
325 325
 		*	Allow users to specify a custom description for this form, no html support
326 326
 		*	@since 6.0.3.8
327 327
 		*/
328
-		if( ! empty( $description ) && $description == 1 && isset( $atts['custom_description'] ) ) {
329
-			echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $atts['custom_description'], $form_id ) ) . '</section>';
328
+		if ( ! empty( $description ) && $description == 1 && isset( $atts[ 'custom_description' ] ) ) {
329
+			echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $atts[ 'custom_description' ], $form_id ) ) . '</section>';
330 330
 		} else {
331 331
 			// display the form description if the user
332 332
 			// has specified to do so
333
-			if( ! empty( $description ) && $description == 1 ) {
334
-				echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-'.$form_id.'">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $form_settings['form_description'], $form_id ) ) . '</section>';
333
+			if ( ! empty( $description ) && $description == 1 ) {
334
+				echo '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-' . $form_id . '">' . apply_filters( 'yikes-mailchimp-frontend-content', apply_filters( 'yikes-mailchimp-form-description', $form_settings[ 'form_description' ], $form_id ) ) . '</section>';
335 335
 			}
336 336
 		}
337 337
 
338 338
 		// Check for AJAX
339
-		if( ( ! empty( $atts['ajax'] ) && $atts['ajax'] == 1 ) || $form_settings['submission_settings']['ajax'] == 1 ) {
339
+		if ( ( ! empty( $atts[ 'ajax' ] ) && $atts[ 'ajax' ] == 1 ) || $form_settings[ 'submission_settings' ][ 'ajax' ] == 1 ) {
340 340
 			// enqueue our ajax script
341
-			wp_register_script( 'yikes-easy-mc-ajax' , YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js' , array( 'jquery' ) , 'yikes-inc-easy-mailchimp-extender', false );
342
-			wp_localize_script( 'yikes-easy-mc-ajax' , 'object' , array(
341
+			wp_register_script( 'yikes-easy-mc-ajax', YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js', array( 'jquery' ), 'yikes-inc-easy-mailchimp-extender', false );
342
+			wp_localize_script( 'yikes-easy-mc-ajax', 'object', array(
343 343
 				'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
344 344
 				'page_data' => $page_data,
345 345
 				'interest_group_checkbox_error' => apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ),
@@ -358,63 +358,63 @@  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
-				foreach( $form_settings['fields'] as $field ) {
364
+				foreach ( $form_settings[ 'fields' ] as $field ) {
365 365
 						// input array
366 366
 						$field_array = array();
367 367
 						// label array
368 368
 						$label_array = array();
369 369
 						// label classes array
370 370
 						$label_class_array = array();
371
-						if( $field['additional-classes'] != '' ) {
371
+						if ( $field[ 'additional-classes' ] != '' ) {
372 372
 							// split custom classes at spaces
373
-							$custom_classes = explode( ' ' , $field['additional-classes'] );
373
+							$custom_classes = explode( ' ', $field[ 'additional-classes' ] );
374 374
 							// check our custom class array for field-left/field-right
375 375
 							// if it's set we need to assign it to our label and remove it from the field classes
376 376
 							 // input half left
377
-							if( in_array( 'field-left-half' , $custom_classes ) ) {
377
+							if ( in_array( 'field-left-half', $custom_classes ) ) {
378 378
 								// $label_array['class'] = 'class="field-left-half"';
379
-								$label_class_array[] = 'field-left-half';
380
-								$key = array_search( 'field-left-half' , $custom_classes );
381
-								unset( $custom_classes[$key] );
379
+								$label_class_array[ ] = 'field-left-half';
380
+								$key = array_search( 'field-left-half', $custom_classes );
381
+								unset( $custom_classes[ $key ] );
382 382
 							} // input half right
383
-							if( in_array( 'field-right-half' , $custom_classes ) ) {
383
+							if ( in_array( 'field-right-half', $custom_classes ) ) {
384 384
 								// $label_array['class'] = 'class="field-right-half"';
385
-								$label_class_array[] = 'field-right-half';
386
-								$key = array_search( 'field-right-half' , $custom_classes );
387
-								unset( $custom_classes[$key] );
385
+								$label_class_array[ ] = 'field-right-half';
386
+								$key = array_search( 'field-right-half', $custom_classes );
387
+								unset( $custom_classes[ $key ] );
388 388
 							} // input thirds (1/3 width, floated left)
389
-							if( in_array( 'field-third' , $custom_classes ) ) {
389
+							if ( in_array( 'field-third', $custom_classes ) ) {
390 390
 								// $label_array['class'] = 'class="field-third"';
391
-								$label_class_array[] = 'field-third';
392
-								$key = array_search( 'field-third' , $custom_classes );
393
-								unset( $custom_classes[$key] );
391
+								$label_class_array[ ] = 'field-third';
392
+								$key = array_search( 'field-third', $custom_classes );
393
+								unset( $custom_classes[ $key ] );
394 394
 							} // 2 column radio
395
-							if( in_array( 'option-2-col' , $custom_classes ) ) {
395
+							if ( in_array( 'option-2-col', $custom_classes ) ) {
396 396
 								// $label_array['class'] = 'class="option-2-col"';
397
-								$label_class_array[] = 'option-2-col';
398
-								$key = array_search( 'option-2-col' , $custom_classes );
399
-								unset( $custom_classes[$key] );
397
+								$label_class_array[ ] = 'option-2-col';
398
+								$key = array_search( 'option-2-col', $custom_classes );
399
+								unset( $custom_classes[ $key ] );
400 400
 							} // 3 column radio
401
-							if( in_array( 'option-3-col' , $custom_classes ) ) {
401
+							if ( in_array( 'option-3-col', $custom_classes ) ) {
402 402
 								// $label_array['class'] = 'class="option-3-col"';
403
-								$label_class_array[] = 'option-3-col';
404
-								$key = array_search( 'option-3-col' , $custom_classes );
405
-								unset( $custom_classes[$key] );
403
+								$label_class_array[ ] = 'option-3-col';
404
+								$key = array_search( 'option-3-col', $custom_classes );
405
+								unset( $custom_classes[ $key ] );
406 406
 							} // 4 column radio
407
-							if( in_array( 'option-4-col' , $custom_classes ) ) {
407
+							if ( in_array( 'option-4-col', $custom_classes ) ) {
408 408
 								// $label_array['class'] = 'class="option-4-col"';
409
-								$label_class_array[] = 'option-4-col';
410
-								$key = array_search( 'option-4-col' , $custom_classes );
411
-								unset( $custom_classes[$key] );
409
+								$label_class_array[ ] = 'option-4-col';
410
+								$key = array_search( 'option-4-col', $custom_classes );
411
+								unset( $custom_classes[ $key ] );
412 412
 							} // inline radio & checkboxes etc
413
-							if( in_array( 'option-inline' , $custom_classes ) ) {
413
+							if ( in_array( 'option-inline', $custom_classes ) ) {
414 414
 								// $label_array['class'] = 'class="option-inline"';
415
-								$label_class_array[] = 'option-inline';
416
-								$key = array_search( 'option-inline' , $custom_classes );
417
-								unset( $custom_classes[$key] );
415
+								$label_class_array[ ] = 'option-inline';
416
+								$key = array_search( 'option-inline', $custom_classes );
417
+								unset( $custom_classes[ $key ] );
418 418
 							}
419 419
 						} else {
420 420
 							$custom_classes = array();
@@ -422,67 +422,67 @@  discard block
 block discarded – undo
422 422
 
423 423
 						// if the form is set to inline, add the inline class to our labels
424 424
 						// since @6.0.3.8
425
-						if( $form_inline ) {
426
-							$label_class_array[] = 'label-inline';
425
+						if ( $form_inline ) {
426
+							$label_class_array[ ] = 'label-inline';
427 427
 						}
428 428
 
429
-						if( isset( $field['hide-label'] ) ) {
430
-							if( $field['hide-label'] == 1 ) {
431
-								$custom_classes[] = 'field-no-label';
429
+						if ( isset( $field[ 'hide-label' ] ) ) {
430
+							if ( $field[ 'hide-label' ] == 1 ) {
431
+								$custom_classes[ ] = 'field-no-label';
432 432
 							}
433 433
 						}
434 434
 
435 435
 					/* Store tag variable based on field type */
436
-					if( isset( $field['merge'] ) ) {
436
+					if ( isset( $field[ 'merge' ] ) ) {
437 437
 						$tag = 'merge';
438 438
 					} else {
439 439
 						$tag = 'group_id';
440 440
 					}
441 441
 
442 442
 					// build up our array
443
-					$field_array['id'] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[$tag] ) . '" ';
444
-					$field_array['name'] = 'name="' . esc_attr( $field[$tag] ) . '" ';
445
-					$field_array['placeholder'] = isset( $field['placeholder'] ) ? 'placeholder="' . esc_attr( stripslashes( $field['placeholder'] ) ) . '" ' : '';
446
-					$field_array['classes'] = 'class="yikes-easy-mc-'.$field['type'] . ' ' .  esc_attr( trim( implode( ' ' , $custom_classes ) ) ) . '" ';
443
+					$field_array[ 'id' ] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[ $tag ] ) . '" ';
444
+					$field_array[ 'name' ] = 'name="' . esc_attr( $field[ $tag ] ) . '" ';
445
+					$field_array[ 'placeholder' ] = isset( $field[ 'placeholder' ] ) ? 'placeholder="' . esc_attr( stripslashes( $field[ 'placeholder' ] ) ) . '" ' : '';
446
+					$field_array[ 'classes' ] = 'class="yikes-easy-mc-' . $field[ 'type' ] . ' ' . esc_attr( trim( implode( ' ', $custom_classes ) ) ) . '" ';
447 447
 
448 448
 					// email must always be required and visible
449
-					if( $field['type'] == 'email' ) {
450
-						$field_array['required'] = 'required="required"';
451
-						$label_array['visible'] = '';
449
+					if ( $field[ 'type' ] == 'email' ) {
450
+						$field_array[ 'required' ] = 'required="required"';
451
+						$label_array[ 'visible' ] = '';
452 452
 						// $label_array['required'] = 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"';
453
-						$label_class_array[] = $field['merge'] . '-label';
454
-						$label_class_array[] = 'yikes-mailchimp-field-required';
453
+						$label_class_array[ ] = $field[ 'merge' ] . '-label';
454
+						$label_class_array[ ] = 'yikes-mailchimp-field-required';
455 455
 					} else {
456
-						if( $tag == 'merge' ) {
457
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
458
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
456
+						if ( $tag == 'merge' ) {
457
+							$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
458
+							$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
459 459
 							// $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['merge'] . '-label"';
460
-							$label_class_array[] = isset( $field['require'] ) ? $field['merge'] . '-label yikes-mailchimp-field-required' : $field['merge'] . '-label';
460
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'merge' ] . '-label yikes-mailchimp-field-required' : $field[ 'merge' ] . '-label';
461 461
 						} else {
462
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
463
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
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['group_id'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['group_id'] . '-label"';
465
-							$label_class_array[] = isset( $field['require'] ) ? $field['group_id'] . '-label yikes-mailchimp-field-required' : $field['group_id'] . '-label';
465
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'group_id' ] . '-label yikes-mailchimp-field-required' : $field[ 'group_id' ] . '-label';
466 466
 						}
467 467
 					}
468 468
 
469 469
 					// if both hide label and hide field are checked, we gotta hide the field!
470
-					if( isset( $field['hide' ] ) && $field['hide'] == 1 ) {
471
-						if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) {
472
-							$field_array['visible'] = 'style="display:none;"';
470
+					if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) {
471
+						if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) {
472
+							$field_array[ 'visible' ] = 'style="display:none;"';
473 473
 						}
474 474
 					}
475 475
 
476
-					$label_array['classes'] = 'class="' . implode( ' ', $label_class_array ) . '"';
476
+					$label_array[ 'classes' ] = 'class="' . implode( ' ', $label_class_array ) . '"';
477 477
 
478 478
 					// filter the field array data
479 479
 					$field_array = apply_filters( 'yikes-mailchimp-field-data', $field_array, $field, $form_id );
480 480
 
481 481
 					/* Loop Over Standard Fields (aka merge variables) */
482
-					if( isset( $field['merge'] ) ) {
482
+					if ( isset( $field[ 'merge' ] ) ) {
483 483
 
484 484
 						// loop over our fields by Type
485
-						switch ( $field['type'] ) {
485
+						switch ( $field[ 'type' ] ) {
486 486
 
487 487
 							default:
488 488
 							case 'email':
@@ -490,25 +490,25 @@  discard block
 block discarded – undo
490 490
 							case 'number':
491 491
 
492 492
 								// pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type)
493
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
493
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
494 494
 								$default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value );
495 495
 									?>
496
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
496
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
497 497
 
498 498
 										<!-- dictate label visibility -->
499
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
500
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
501
-												<?php if( ! isset( $field['hide-label'] ) ) { echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ), $form_id ); } ?>
499
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
500
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
501
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ), $form_id ); } ?>
502 502
 											</span>
503 503
 										<?php } ?>
504 504
 
505
-										<input <?php echo implode( ' ' , $field_array ); if( $field['type'] != 'email' && $field['type'] != 'number' ) { ?> type="text" <?php } else if( $field['type'] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
505
+										<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 ); } ?>">
506 506
 
507 507
 										<!-- description -->
508
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
508
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
509 509
 											<p class="form-field-description">
510 510
 												<small>
511
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
511
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
512 512
 												</small>
513 513
 											</p>
514 514
 										<?php } ?>
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 
521 521
 							case 'url':
522 522
 							case 'imageurl':
523
-								$default_value = ( isset( $field['default'] ) ) ? $field['default'] : '';
523
+								$default_value = ( isset( $field[ 'default' ] ) ) ? $field[ 'default' ] : '';
524 524
 									?>
525 525
 
526 526
 									<script type="text/javascript">
@@ -532,22 +532,22 @@  discard block
 block discarded – undo
532 532
 										}
533 533
 									</script>
534 534
 
535
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
535
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
536 536
 
537 537
 										<!-- dictate label visibility -->
538
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
539
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
540
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
538
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
539
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
540
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
541 541
 											</span>
542 542
 										<?php } ?>
543 543
 
544
-										<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;">
544
+										<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;">
545 545
 
546 546
 										<!-- description -->
547
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
547
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
548 548
 											<p class="form-field-description">
549 549
 												<small>
550
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
550
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
551 551
 												</small>
552 552
 											</p>
553 553
 										<?php } ?>
@@ -558,8 +558,8 @@  discard block
 block discarded – undo
558 558
 							break;
559 559
 
560 560
 							case 'phone':
561
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
562
-								$phone_format = $field['phone_format'];
561
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
562
+								$phone_format = $field[ 'phone_format' ];
563 563
 								?>
564 564
 									<script type="text/javascript">
565 565
 										/* Replace incorrect values and format it correctly for MailChimp API */
@@ -572,22 +572,22 @@  discard block
 block discarded – undo
572 572
 										}
573 573
 									</script>
574 574
 
575
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
575
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
576 576
 
577 577
 										<!-- dictate label visibility -->
578
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
579
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
580
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
578
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
579
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
580
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
581 581
 											</span>
582 582
 										<?php } ?>
583 583
 
584
-										<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 ); } ?>">
584
+										<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 ); } ?>">
585 585
 
586 586
 										<!-- description -->
587
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
587
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
588 588
 											<p class="form-field-description">
589 589
 												<small>
590
-													<?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field['merge'] ) . '-description', stripslashes( $field['description'] ), $form_id ); ?>
590
+													<?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field[ 'merge' ] ) . '-description', stripslashes( $field[ 'description' ] ), $form_id ); ?>
591 591
 												</small>
592 592
 											</p>
593 593
 										<?php } ?>
@@ -597,25 +597,25 @@  discard block
 block discarded – undo
597 597
 							break;
598 598
 
599 599
 							case 'zip':
600
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
600
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
601 601
 
602 602
 									?>
603
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
603
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
604 604
 
605 605
 									<!-- dictate label visibility -->
606
-									<?php if( ! isset( $field['hide-label'] ) ) { ?>
607
-										<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
608
-											<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
606
+									<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
607
+										<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
608
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
609 609
 										</span>
610 610
 									<?php } ?>
611 611
 
612
-									<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 ); } ?>">
612
+									<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 ); } ?>">
613 613
 
614 614
 									<!-- description -->
615
-									<?php if( isset( $field['description'] ) ) { ?>
615
+									<?php if ( isset( $field[ 'description' ] ) ) { ?>
616 616
 										<p class="form-field-description">
617 617
 											<small>
618
-												<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
618
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
619 619
 											</small>
620 620
 										</p>
621 621
 									<?php } ?>
@@ -627,28 +627,28 @@  discard block
 block discarded – undo
627 627
 
628 628
 							case 'address':
629 629
 								// required fields
630
-								$required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' );
630
+								$required_fields = array( 'addr1' => 'address', 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip', 'country' => 'country' );
631 631
 
632 632
 								// setup the default country value
633 633
 								$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
634 634
 
635 635
 								// store number for looping
636 636
 								$x = 1;
637
-								foreach( $required_fields as $type => $label ) {
637
+								foreach ( $required_fields as $type => $label ) {
638 638
 
639 639
 									// set the field names for the addrress fields
640
-									$field_array['name'] = 'name="'.$field[$tag].'['.$type.']'.'"';
640
+									$field_array[ 'name' ] = 'name="' . $field[ $tag ] . '[' . $type . ']' . '"';
641 641
 
642 642
 									// reset the label classes for left-half/right-half for addresses
643
-									if( isset( $label_array['class'] ) ) {
643
+									if ( isset( $label_array[ 'class' ] ) ) {
644 644
 										if ( $x % 2 == 0 ) {
645
-											$label_array['class'] = str_replace( 'field-left-half', 'field-right-half', $label_array['class'] );
645
+											$label_array[ 'class' ] = str_replace( 'field-left-half', 'field-right-half', $label_array[ 'class' ] );
646 646
 										} else {
647
-											$label_array['class'] = str_replace( 'field-right-half', 'field-left-half', $label_array['class'] );
647
+											$label_array[ 'class' ] = str_replace( 'field-right-half', 'field-left-half', $label_array[ 'class' ] );
648 648
 										}
649 649
 									}
650 650
 
651
-									switch( $type ) {
651
+									switch ( $type ) {
652 652
 
653 653
 										default:
654 654
 										case 'addr1':
@@ -657,17 +657,17 @@  discard block
 block discarded – undo
657 657
 
658 658
 
659 659
 											?>
660
-											<label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
660
+											<label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>>
661 661
 
662 662
 												<!-- dictate label visibility -->
663
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
664
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
665
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
663
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
664
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
665
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
666 666
 													</span>
667 667
 												<?php } ?>
668 668
 
669 669
 
670
-												<input <?php echo implode( ' ' , $field_array ); ?> type="text"  value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } ?>">
670
+												<input <?php echo implode( ' ', $field_array ); ?> type="text"  value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } ?>">
671 671
 
672 672
 											</label>
673 673
 											<?php
@@ -677,16 +677,16 @@  discard block
 block discarded – undo
677 677
 										case 'state':
678 678
 
679 679
 											?>
680
-											<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 } ?>>
680
+											<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 } ?>>
681 681
 
682 682
 												<!-- dictate label visibility -->
683
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
684
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
685
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
683
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
684
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
685
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
686 686
 													</span>
687 687
 												<?php } ?>
688 688
 
689
-												<select <?php echo implode( ' ' , $field_array ); ?>>
689
+												<select <?php echo implode( ' ', $field_array ); ?>>
690 690
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-dropdown.php' ); ?>
691 691
 												</select>
692 692
 
@@ -699,15 +699,15 @@  discard block
 block discarded – undo
699 699
 										case 'zip':
700 700
 
701 701
 											?>
702
-											<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 } ?>>
702
+											<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 } ?>>
703 703
 
704
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
705
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
706
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
704
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
705
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
706
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
707 707
 													</span>
708 708
 												<?php } ?>
709 709
 
710
-												<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 ); } ?>">
710
+												<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 ); } ?>">
711 711
 
712 712
 											</label>
713 713
 											<?php
@@ -745,16 +745,16 @@  discard block
 block discarded – undo
745 745
 												$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
746 746
 											?>
747 747
 
748
-											<label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
748
+											<label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>>
749 749
 
750 750
 												<!-- dictate label visibility -->
751
-												<?php if( !isset( $field['hide-label'] ) ) { ?>
752
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
753
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
751
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
752
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
753
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
754 754
 													</span>
755 755
 												<?php } ?>
756 756
 
757
-												<select <?php echo implode( ' ' , $field_array ); ?> onchange="checkCountry(this);return false;">
757
+												<select <?php echo implode( ' ', $field_array ); ?> onchange="checkCountry(this);return false;">
758 758
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/country-dropdown.php' ); ?>
759 759
 												</select>
760 760
 											</label>
@@ -765,10 +765,10 @@  discard block
 block discarded – undo
765 765
 								}
766 766
 
767 767
 								// description
768
-								if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
768
+								if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
769 769
 									<p class="form-field-description">
770 770
 										<small>
771
-											<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
771
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
772 772
 										</small>
773 773
 									</p>
774 774
 									<?php }
@@ -778,19 +778,19 @@  discard block
 block discarded – undo
778 778
 							case 'birthday':
779 779
 
780 780
 								// bootstrap datepicker requirements
781
-								wp_enqueue_script( 'bootstrap-hover-dropdown' , YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js' , array( 'jquery' ) );
782
-								wp_enqueue_script( 'bootstrap-datepicker-script' , YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js' , array( 'jquery' , 'bootstrap-hover-dropdown' ) );
783
-								wp_enqueue_style( 'bootstrap-datepicker-styles' , YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
784
-								wp_enqueue_style( 'override-datepicker-styles' , YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css' , array( 'bootstrap-datepicker-styles' ) );
781
+								wp_enqueue_script( 'bootstrap-hover-dropdown', YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js', array( 'jquery' ) );
782
+								wp_enqueue_script( 'bootstrap-datepicker-script', YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js', array( 'jquery', 'bootstrap-hover-dropdown' ) );
783
+								wp_enqueue_style( 'bootstrap-datepicker-styles', YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
784
+								wp_enqueue_style( 'override-datepicker-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css', array( 'bootstrap-datepicker-styles' ) );
785 785
 
786
-								switch ( $field['type'] ) {
786
+								switch ( $field[ 'type' ] ) {
787 787
 									default:
788 788
 									case 'date':
789
-										$date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd/yy';
789
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd/yy';
790 790
 										break;
791 791
 
792 792
 									case 'birthday':
793
-										$date_format = ( isset( $field['date_format'] ) ) ? strtolower( $field['date_format'] ) : 'mm/dd';
793
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? strtolower( $field[ 'date_format' ] ) : 'mm/dd';
794 794
 										break;
795 795
 								}
796 796
 								// initialize the datepicker
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 											padding: .85em .5em !important;
802 802
 										}
803 803
 										<?php
804
-											if( wp_is_mobile() ) {
804
+											if ( wp_is_mobile() ) {
805 805
 												?>
806 806
 												.datepicker-dropdown {
807 807
 													margin-top: 0px;
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 											$day_names = $admin_class->yikes_jQuery_datepicker_strip_array_indices( $wp_locale->weekday );
817 817
 											$day_names_short = $admin_class->yikes_jQuery_datepicker_strip_array_indices( $wp_locale->weekday_abbrev );
818 818
 											$day_names_min = $admin_class->yikes_jQuery_datepicker_strip_array_indices( $wp_locale->weekday_initial );
819
-											$date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field['type'] );
819
+											$date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field[ 'type' ] );
820 820
 											$first_day = get_option( 'start_of_week' );
821 821
 											$isRTL = $wp_locale->is_rtl();
822 822
 										?>
@@ -837,10 +837,10 @@  discard block
 block discarded – undo
837 837
 												numberOfMonths: 1,
838 838
 												today: '<?php _e( 'Today', 'yikes-inc-easy-mailchimp-extender' ); ?>'
839 839
 											};
840
-											jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').datepicker().on( 'show', function( e ) {
841
-												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'height' );
840
+											jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').datepicker().on( 'show', function( e ) {
841
+												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'height' );
842 842
 												date_picker_height = parseInt( date_picker_height.replace( 'px', '' ) ) + parseInt( 15 ) + 'px';
843
-												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'width' ).replace( 'px', '' );
843
+												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'width' ).replace( 'px', '' );
844 844
 												if( date_picker_width > 500 ) {
845 845
 													date_picker_width = 500;
846 846
 												}
@@ -850,27 +850,27 @@  discard block
 block discarded – undo
850 850
 									</script>
851 851
 								<?php
852 852
 
853
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
853
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
854 854
 								// store empty number for looping
855 855
 								$x = 0;
856 856
 
857 857
 								?>
858
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
858
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
859 859
 
860 860
 										<!-- dictate label visibility -->
861
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
862
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
863
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
861
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
862
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
863
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
864 864
 											</span>
865 865
 										<?php } ?>
866 866
 
867
-										<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 ); } ?>">
867
+										<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 ); } ?>">
868 868
 
869 869
 										<!-- description -->
870
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
870
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
871 871
 											<p class="form-field-description">
872 872
 												<small>
873
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
873
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
874 874
 												</small>
875 875
 											</p>
876 876
 										<?php } ?>
@@ -881,36 +881,36 @@  discard block
 block discarded – undo
881 881
 							break;
882 882
 
883 883
 							case 'dropdown':
884
-								$default_value = $field['default_choice'];
884
+								$default_value = $field[ 'default_choice' ];
885 885
 								// store empty number for looping
886 886
 								$x = 0;
887 887
 								// hidden labels
888 888
 
889 889
 									?>
890
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
890
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
891 891
 										<!-- dictate label visibility -->
892
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
893
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
894
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
892
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
893
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
894
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
895 895
 											</span>
896 896
 										<?php } ?>
897 897
 
898
-										<select <?php echo implode( ' ' , $field_array ); ?>>
898
+										<select <?php echo implode( ' ', $field_array ); ?>>
899 899
 											<?php
900 900
 												// decode for looping
901
-												$choices = json_decode( $field['choices'], true );
902
-												foreach( $choices as $choice ) {
903
-													?><option value="<?php echo $choice; ?>" <?php selected( $default_value , $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
901
+												$choices = json_decode( $field[ 'choices' ], true );
902
+												foreach ( $choices as $choice ) {
903
+													?><option value="<?php echo $choice; ?>" <?php selected( $default_value, $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
904 904
 													$x++;
905 905
 												}
906 906
 											?>
907 907
 										</select>
908 908
 
909 909
 										<!-- description -->
910
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
910
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
911 911
 											<p class="form-field-description">
912 912
 												<small>
913
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
913
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
914 914
 												</small>
915 915
 											</p>
916 916
 										<?php } ?>
@@ -924,13 +924,13 @@  discard block
 block discarded – undo
924 924
 							case 'radio':
925 925
 							case 'checkbox':
926 926
 								// remove the ID (as to not assign the same ID to every radio button)
927
-								unset( $field_array['id'] );
928
-								$choices = json_decode( $field['choices'], true );
927
+								unset( $field_array[ 'id' ] );
928
+								$choices = json_decode( $field[ 'choices' ], true );
929 929
 								// assign a default choice
930
-								$default_value = ( isset( $field['default_choice'] ) && $field['default_choice'] != '' ) ? $field['default_choice'] : $choices[0];
930
+								$default_value = ( isset( $field[ 'default_choice' ] ) && $field[ 'default_choice' ] != '' ) ? $field[ 'default_choice' ] : $choices[ 0 ];
931 931
 								// if the form was submit, but failed, let's reset the post data
932
-								if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) {
933
-									$default_value = $_POST[$field['merge']];
932
+								if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) {
933
+									$default_value = $_POST[ $field[ 'merge' ] ];
934 934
 								}
935 935
 								$count = count( $choices );
936 936
 								$i = 1;
@@ -939,20 +939,20 @@  discard block
 block discarded – undo
939 939
 								// hidden labels
940 940
 
941 941
 									?>
942
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
942
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
943 943
 
944 944
 										<!-- dictate label visibility -->
945
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
946
-											<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?> checkbox-parent-label">
947
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
945
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
946
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?> checkbox-parent-label">
947
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
948 948
 											</span>
949 949
 										<?php }
950 950
 
951
-										foreach( $choices as $choice ) {
951
+										foreach ( $choices as $choice ) {
952 952
 											?>
953
-											<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']; } ?>>
954
-												<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 ); ?>">
955
-												<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
953
+											<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' ]; } ?>>
954
+												<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 ); ?>">
955
+												<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
956 956
 											</label>
957 957
 											<?php
958 958
 											$i++;
@@ -960,10 +960,10 @@  discard block
 block discarded – undo
960 960
 										}
961 961
 
962 962
 										// description
963
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
963
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
964 964
 											<p class="form-field-description">
965 965
 												<small>
966
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
966
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
967 967
 												</small>
968 968
 											</p>
969 969
 										<?php } ?>
@@ -979,26 +979,26 @@  discard block
 block discarded – undo
979 979
 
980 980
 
981 981
 						// store default choice
982
-						$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'] : '' );
982
+						$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' ] : '' );
983 983
 
984 984
 						// if the form was submit, but failed, let's reset the post data
985
-						if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
986
-							$default_choice = $_POST[$field['group_id']];
985
+						if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
986
+							$default_choice = $_POST[ $field[ 'group_id' ] ];
987 987
 						}
988 988
 
989 989
 						// get our groups
990
-						$groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( $field['groups'], true ) : array();
990
+						$groups = ( isset( $field[ 'groups' ] ) && ! empty( $field[ 'groups' ] ) ) ? json_decode( $field[ 'groups' ], true ) : array();
991 991
 
992 992
 						$count = count( $groups );
993 993
 
994
-						if( $field['type'] == 'checkboxes' ) {
994
+						if ( $field[ 'type' ] == 'checkboxes' ) {
995 995
 							$type = 'checkbox';
996
-						} else if( $field['type'] == 'radio' ) {
996
+						} else if ( $field[ 'type' ] == 'radio' ) {
997 997
 							$type = 'radio';
998 998
 						}
999 999
 
1000 1000
 						// loop over the interest group field types
1001
-						switch ( $field['type'] ) {
1001
+						switch ( $field[ 'type' ] ) {
1002 1002
 
1003 1003
 							case 'checkboxes':
1004 1004
 							case 'radio':
@@ -1006,18 +1006,18 @@  discard block
 block discarded – undo
1006 1006
 								$x = 1; // used to find the last item of our array
1007 1007
 
1008 1008
 									?>
1009
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1010
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1009
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1010
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1011 1011
 											<!-- dictate label visibility -->
1012
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label">
1013
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1012
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label">
1013
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
1014 1014
 											</span>
1015 1015
 									<?php
1016 1016
 										}
1017 1017
 
1018 1018
 										// Display Submission Errors
1019
-										if( ! empty( $missing_required_checkbox_interest_groups ) ) {
1020
-											if( in_array( $field['group_id'], $missing_required_checkbox_interest_groups ) ) {
1019
+										if ( ! empty( $missing_required_checkbox_interest_groups ) ) {
1020
+											if ( in_array( $field[ 'group_id' ], $missing_required_checkbox_interest_groups ) ) {
1021 1021
 												?>
1022 1022
 													<p class="yikes-mailchimp-required-interest-group-error">
1023 1023
 														<?php echo apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); ?>
@@ -1028,19 +1028,19 @@  discard block
 block discarded – undo
1028 1028
 
1029 1029
 
1030 1030
 
1031
-										foreach( $groups as $group ) {
1032
-											if( $field['type'] == 'checkboxes' ) {
1031
+										foreach ( $groups as $group ) {
1032
+											if ( $field[ 'type' ] == 'checkboxes' ) {
1033 1033
 												/* Setup the defaults for this field - varies if the field was previously submitted */
1034
-												if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
1035
-													$default_choice = $_POST[$field['group_id']];
1036
-												} elseif( ( ! isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted != 1 ) || ( isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted == 1 ) ) {
1037
-													$default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : array();
1034
+												if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
1035
+													$default_choice = $_POST[ $field[ 'group_id' ] ];
1036
+												} elseif ( ( ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 ) || ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 ) ) {
1037
+													$default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : array();
1038 1038
 												}
1039 1039
 											}
1040 1040
 											?>
1041
-											<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 } ?>">
1042
-												<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'] ); ?>">
1043
-												<?php echo $group['name']; ?>
1041
+											<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 } ?>">
1042
+												<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' ] ); ?>">
1043
+												<?php echo $group[ 'name' ]; ?>
1044 1044
 											</label>
1045 1045
 											<?php
1046 1046
 											$i++;
@@ -1048,10 +1048,10 @@  discard block
 block discarded – undo
1048 1048
 										}
1049 1049
 
1050 1050
 										// description
1051
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1051
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1052 1052
 											<p class="form-field-description">
1053 1053
 												<small>
1054
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1054
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1055 1055
 												</small>
1056 1056
 											</p>
1057 1057
 										<?php } ?>
@@ -1065,28 +1065,28 @@  discard block
 block discarded – undo
1065 1065
 
1066 1066
 									?>
1067 1067
 
1068
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1068
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1069 1069
 										<!-- dictate label visibility -->
1070
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1071
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>">
1072
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1070
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1071
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?>">
1072
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
1073 1073
 											</span>
1074 1074
 										<?php } ?>
1075 1075
 
1076
-										<select <?php echo implode( ' ' , $field_array ); ?>>
1076
+										<select <?php echo implode( ' ', $field_array ); ?>>
1077 1077
 											<?php
1078 1078
 												$i = 0;
1079
-												foreach( $groups as $group ) {
1080
-													?><option <?php selected( $i , $default_choice ); ?> value="<?php echo $group['name']; ?>"><?php echo esc_attr( $group['name'] ); ?></option><?php
1079
+												foreach ( $groups as $group ) {
1080
+													?><option <?php selected( $i, $default_choice ); ?> value="<?php echo $group[ 'name' ]; ?>"><?php echo esc_attr( $group[ 'name' ] ); ?></option><?php
1081 1081
 													$i++;
1082 1082
 												}
1083 1083
 											?>
1084 1084
 										</select>
1085 1085
 
1086
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1086
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1087 1087
 											<p class="form-field-description">
1088 1088
 												<small>
1089
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1089
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1090 1090
 												</small>
1091 1091
 											</p>
1092 1092
 										<?php } ?>
@@ -1103,21 +1103,21 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
 									?>
1105 1105
 
1106
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1106
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1107 1107
 
1108 1108
 										<!-- dictate label visibility -->
1109
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1110
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1111
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
1109
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1110
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1111
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
1112 1112
 											</span>
1113 1113
 										<?php }
1114 1114
 
1115 1115
 
1116
-										foreach( $groups as $group ) {
1116
+										foreach ( $groups as $group ) {
1117 1117
 											?>
1118
-											<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;">
1119
-												<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'] ); ?>">
1120
-												<?php echo esc_attr( stripslashes( str_replace( '' , '\'', $group['name'] ) ) ); ?>
1118
+											<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;">
1119
+												<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' ] ); ?>">
1120
+												<?php echo esc_attr( stripslashes( str_replace( '', '\'', $group[ 'name' ] ) ) ); ?>
1121 1121
 											</label>
1122 1122
 											<?php
1123 1123
 											$i++;
@@ -1125,10 +1125,10 @@  discard block
 block discarded – undo
1125 1125
 										}
1126 1126
 
1127 1127
 										// description
1128
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1128
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1129 1129
 											<p class="form-field-description">
1130 1130
 												<small>
1131
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
1131
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
1132 1132
 												</small>
1133 1133
 											</p>
1134 1134
 										<?php }
@@ -1145,11 +1145,11 @@  discard block
 block discarded – undo
1145 1145
 				do_action( 'yikes-mailchimp-additional-form-fields', $form_data );
1146 1146
 
1147 1147
 				/* if we've enabled reCAPTCHA protection */
1148
-				if( isset( $recaptcha_box ) ) {
1148
+				if ( isset( $recaptcha_box ) ) {
1149 1149
 					echo $recaptcha_box;
1150 1150
 				}
1151
-				if( is_user_logged_in() ) {
1152
-					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1151
+				if ( is_user_logged_in() ) {
1152
+					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1153 1153
 				} else {
1154 1154
 					$admin_class = '';
1155 1155
 				}
@@ -1159,23 +1159,23 @@  discard block
 block discarded – undo
1159 1159
 				<input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot" value="">
1160 1160
 
1161 1161
 				<!-- List ID -->
1162
-				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_settings['list_id']; ?>">
1162
+				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_settings[ 'list_id' ]; ?>">
1163 1163
 
1164 1164
 				<!-- Form that is being submitted! Used to display error/success messages above the correct form -->
1165 1165
 				<input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form" value="<?php echo $form_id; ?>">
1166 1166
 
1167 1167
 				<!-- Submit Button -->
1168 1168
 				<?php
1169
-					if( $form_inline ) {
1169
+					if ( $form_inline ) {
1170 1170
 						echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="empty-label">&nbsp;</span>';
1171 1171
 					}
1172 1172
 					// display the image or text based button
1173
-					if( $submit_button_type == 'text' ) {
1174
-						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'] );
1173
+					if ( $submit_button_type == 'text' ) {
1174
+						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' ] );
1175 1175
 					} else {
1176
-						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'] );
1176
+						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' ] );
1177 1177
 					}
1178
-					if( $form_inline ) {
1178
+					if ( $form_inline ) {
1179 1179
 						echo '</label>';
1180 1180
 					}
1181 1181
 				?>
@@ -1187,8 +1187,8 @@  discard block
 block discarded – undo
1187 1187
 
1188 1188
 		<?php
1189 1189
 			/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
1190
-			if( is_user_logged_in() ) {
1191
-				if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
1190
+			if ( is_user_logged_in() ) {
1191
+				if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
1192 1192
 					echo $edit_form_link;
1193 1193
 				}
1194 1194
 			}
@@ -1203,16 +1203,16 @@  discard block
 block discarded – undo
1203 1203
 		*	Update the impressions count
1204 1204
 		*	for non-admins
1205 1205
 		*/
1206
-		if( !current_user_can( 'manage_options' ) ) {
1207
-			$form_data['impressions']++;
1206
+		if ( ! current_user_can( 'manage_options' ) ) {
1207
+			$form_data[ 'impressions' ]++;
1208 1208
 			$wpdb->update(
1209 1209
 				$wpdb->prefix . 'yikes_easy_mc_forms',
1210 1210
 					array(
1211
-						'impressions' => $form_data['impressions'],
1211
+						'impressions' => $form_data[ 'impressions' ],
1212 1212
 					),
1213 1213
 					array( 'ID' => $form ),
1214 1214
 					array(
1215
-						'%d',	// send welcome email
1215
+						'%d', // send welcome email
1216 1216
 					),
1217 1217
 					array( '%d' )
1218 1218
 				);
Please login to merge, or discard this patch.
public/partials/shortcodes/process/process_form_submission_ajax.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -5,34 +5,34 @@  discard block
 block discarded – undo
5 5
 */
6 6
 
7 7
 // parse our form data
8
-parse_str( $_POST['form_data'], $data );
8
+parse_str( $_POST[ 'form_data' ], $data );
9 9
 // store the form ID to use in our hooks and filters
10
-$form = $_POST['form_id'];
10
+$form = $_POST[ 'form_id' ];
11 11
 
12 12
 // Retreive the form data from the database instead of posting it with the form-submission
13 13
 global $wpdb;
14 14
 // return it as an array, so we can work with it to build our form below
15 15
 $form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form . '', ARRAY_A );
16 16
 
17
-if( $form_results ) {
18
-	$form_data = $form_results[0];
17
+if ( $form_results ) {
18
+	$form_data = $form_results[ 0 ];
19 19
 	// List ID
20
-	$list_id = $form_data['list_id'];
20
+	$list_id = $form_data[ 'list_id' ];
21 21
 	// decode our submission settings
22
-	$submission_settings = json_decode( stripslashes( $form_data['submission_settings'] ), true );
22
+	$submission_settings = json_decode( stripslashes( $form_data[ 'submission_settings' ] ), true );
23 23
 	// decode our optin settings
24
-	$optin_settings = json_decode( stripslashes( $form_data['optin_settings'] ), true );
24
+	$optin_settings = json_decode( stripslashes( $form_data[ 'optin_settings' ] ), true );
25 25
 	// decode our fields
26
-	$form_fields = json_decode( stripslashes( $form_data['fields'] ), true );
26
+	$form_fields = json_decode( stripslashes( $form_data[ 'fields' ] ), true );
27 27
 	/*	Decode our error messages
28 28
 	*	Workaround for international characters (cyrillic etc)
29 29
 	* 	See: https://wordpress.org/support/topic/custom-messages-do-not-support-cyrillic-characters?replies=11#post-7629620
30 30
 	*/
31
-	$error_messages = ( get_magic_quotes_gpc() ) ? json_decode( stripslashes( $form_data['error_messages'] ), true ) : json_decode( $form_data['error_messages'], true );
31
+	$error_messages = ( get_magic_quotes_gpc() ) ? json_decode( stripslashes( $form_data[ 'error_messages' ] ), true ) : json_decode( $form_data[ 'error_messages' ], true );
32 32
 	/** Submit Process **/
33
-	$notifications = json_decode( stripslashes( $form_data['custom_notifications'] ), true );
33
+	$notifications = json_decode( stripslashes( $form_data[ 'custom_notifications' ] ), true );
34 34
 	/* Page Data */
35
-	$page_data = $_POST['page_data'];
35
+	$page_data = $_POST[ 'page_data' ];
36 36
 }
37 37
 
38 38
 // Empty array to build up merge variables
@@ -42,39 +42,39 @@  discard block
 block discarded – undo
42 42
 $error = 0;
43 43
 
44 44
 /* Check for Honeypot filled */
45
-$honey_pot_filled = ( isset( $data['yikes-mailchimp-honeypot'] ) && $data['yikes-mailchimp-honeypot'] != '' ) ? true : false;
45
+$honey_pot_filled = ( isset( $data[ 'yikes-mailchimp-honeypot' ] ) && $data[ 'yikes-mailchimp-honeypot' ] != '' ) ? true : false;
46 46
 // if it was filled out, return an error...
47
-if( $honey_pot_filled ) {
47
+if ( $honey_pot_filled ) {
48 48
 	wp_send_json_error( array(
49 49
 		'hide' => '0',
50 50
 		'error' => 1,
51
-		'response' => __( "Error: It looks like the honeypot was filled out and the form was not properly be submitted." , 'yikes-inc-easy-mailchimp-extender' )
51
+		'response' => __( "Error: It looks like the honeypot was filled out and the form was not properly be submitted.", 'yikes-inc-easy-mailchimp-extender' )
52 52
 	) );
53 53
 	return;
54 54
 }
55 55
 
56 56
 // Check reCAPTCHA Response was submitted with the form data
57
-if( isset( $data['g-recaptcha-response'] ) ) {
58
-	$url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key' , '' ) . '&response=' . $data['g-recaptcha-response'] . '&remoteip=' . $_SERVER["REMOTE_ADDR"] );
57
+if ( isset( $data[ 'g-recaptcha-response' ] ) ) {
58
+	$url = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $data[ 'g-recaptcha-response' ] . '&remoteip=' . $_SERVER[ "REMOTE_ADDR" ] );
59 59
 	$response = wp_remote_get( $url );
60
-	$response_body = json_decode( $response['body'] , true );
60
+	$response_body = json_decode( $response[ 'body' ], true );
61 61
 	// if we've hit an error, lets return the error!
62
-	if( $response_body['success'] != 1 ) {
62
+	if ( $response_body[ 'success' ] != 1 ) {
63 63
 		$error_messages = array(); // empty array to store error messages
64
-		if( isset( $response_body['error-codes'] ) ) {
65
-			foreach( $response_body['error-codes'] as $error_code ) {
66
-				if( $error_code == 'missing-input-response' ) {
64
+		if ( isset( $response_body[ 'error-codes' ] ) ) {
65
+			foreach ( $response_body[ 'error-codes' ] as $error_code ) {
66
+				if ( $error_code == 'missing-input-response' ) {
67 67
 					$error_code = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' );
68 68
 				}
69
-				$error_messages[] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code;
69
+				$error_messages[ ] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code;
70 70
 			}
71 71
 		} else {
72
-			$error_messages[] = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' );
72
+			$error_messages[ ] = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' );
73 73
 		}
74 74
 		$error = 1;
75 75
 		wp_send_json_error( array(
76 76
 			'hide' => '0',
77
-			'error' => $error ,
77
+			'error' => $error,
78 78
 			'response' => apply_filters( 'yikes-mailchimp-recaptcha-required-error', implode( ' ', $error_messages ) ),
79 79
 		) );
80 80
 		exit();
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 
84 84
 // loop to push variables to our array
85 85
 foreach ( $data as $merge_tag => $value ) {
86
-	if( $merge_tag != 'yikes_easy_mc_new_subscriber' && $merge_tag != '_wp_http_referer' ) {
86
+	if ( $merge_tag != 'yikes_easy_mc_new_subscriber' && $merge_tag != '_wp_http_referer' ) {
87 87
 		// check if the current iteration has a 'date_format' key set
88 88
 		// (aka - date/birthday fields)
89
-		if( isset( $form_fields[$merge_tag]['date_format'] ) ) {
89
+		if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) {
90 90
 			// check if EU date format
91
-			if( $form_fields[$merge_tag]['date_format'] == 'DD/MM/YYYY' ) {
91
+			if ( $form_fields[ $merge_tag ][ 'date_format' ] == 'DD/MM/YYYY' ) {
92 92
 				// convert '/' to '.' and to UNIX timestamp
93 93
 				$value = date( 'Y-m-d', strtotime( str_replace( '/', '.', $value ) ) );
94 94
 			} else {
@@ -96,22 +96,22 @@  discard block
 block discarded – undo
96 96
 				$value = date( 'Y-m-d', strtotime( $value ) );
97 97
 			}
98 98
 		}
99
-		if( is_numeric( $merge_tag ) ) { // this is is an interest group!
100
-			$merge_variables['groupings'][] = array( 'id' => $merge_tag , 'groups' => ( is_array( $value ) ) ? $value : array( $value ) );
99
+		if ( is_numeric( $merge_tag ) ) { // this is is an interest group!
100
+			$merge_variables[ 'groupings' ][ ] = array( 'id' => $merge_tag, 'groups' => ( is_array( $value ) ) ? $value : array( $value ) );
101 101
 		} else { // or else it's just a standard merge variable
102
-			$merge_variables[$merge_tag] = $value;
102
+			$merge_variables[ $merge_tag ] = $value;
103 103
 		}
104 104
 	}
105 105
 }
106 106
 // store the opt-in time
107
-$merge_variables['optin_time'] = current_time( 'Y-m-d H:i:s', 1 );
107
+$merge_variables[ 'optin_time' ] = current_time( 'Y-m-d H:i:s', 1 );
108 108
 
109 109
 // Submit our form data
110 110
 $api_key = yikes_get_mc_api_key();
111 111
 $dash_position = strpos( $api_key, '-' );
112 112
 
113 113
 // setup the end point
114
-if( $dash_position !== false ) {
114
+if ( $dash_position !== false ) {
115 115
 	$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/subscribe.json';
116 116
 }
117 117
 
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 *	Allow users to check for submit value
138 138
 *	and pass back an error to the user
139 139
 */
140
-if( isset( $merge_variables['error'] ) ) {
140
+if ( isset( $merge_variables[ 'error' ] ) ) {
141 141
 	// send our error response back
142
-	wp_send_json_error( array( 'hide' => '0', 'error' => $merge_variables['error']  , 'response' => $merge_variables['message']  ) );
142
+	wp_send_json_error( array( 'hide' => '0', 'error' => $merge_variables[ 'error' ], 'response' => $merge_variables[ 'message' ] ) );
143 143
 	return;
144 144
 }
145 145
 
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
  * Setup whether or not we should update the user, or display the error with email generation
148 148
  * @since 6.1
149 149
  */
150
-if ( isset( $optin_settings['update_existing_user'] ) && 1 === absint( $optin_settings['update_existing_user'] ) ) {
150
+if ( isset( $optin_settings[ 'update_existing_user' ] ) && 1 === absint( $optin_settings[ 'update_existing_user' ] ) ) {
151 151
 	// Should we send the update email
152
-	if ( isset( $optin_settings['send_update_email'] ) && 1 === absint( $optin_settings['send_update_email'] ) ) {
152
+	if ( isset( $optin_settings[ 'send_update_email' ] ) && 1 === absint( $optin_settings[ 'send_update_email' ] ) ) {
153 153
 		$update_existing_user = 0;
154 154
 	} else {
155 155
 		$update_existing_user = 1;
@@ -164,38 +164,38 @@  discard block
 block discarded – undo
164 164
 		'body' => apply_filters( 'yikes-mailchimp-user-subscribe-api-request', array(
165 165
 			'apikey' => $api_key,
166 166
 			'id' => $list_id,
167
-			'email' => array( 'email' => sanitize_email( $data['EMAIL'] ) ),
167
+			'email' => array( 'email' => sanitize_email( $data[ 'EMAIL' ] ) ),
168 168
 			'merge_vars' => $merge_variables,
169
-			'double_optin' => $optin_settings['optin'],
169
+			'double_optin' => $optin_settings[ 'optin' ],
170 170
 			'update_existing' => $update_existing_user, // Decide if we should update the user or not
171
-			'send_welcome' => $optin_settings['send_welcome_email'],
172
-			'replace_interests' => ( isset( $submission_settings['replace_interests'] ) ) ? $submission_settings['replace_interests'] : 1, // defaults to replace
173
-		), $form, $list_id, $data['EMAIL'] ),
171
+			'send_welcome' => $optin_settings[ 'send_welcome_email' ],
172
+			'replace_interests' => ( isset( $submission_settings[ 'replace_interests' ] ) ) ? $submission_settings[ 'replace_interests' ] : 1, // defaults to replace
173
+		), $form, $list_id, $data[ 'EMAIL' ] ),
174 174
 		'timeout' => 10,
175 175
 		'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
176 176
 	) );
177 177
 
178 178
 	$subscribe_response = json_decode( wp_remote_retrieve_body( $subscribe_response ), true );
179 179
 
180
-	if( isset( $subscribe_response['error'] ) ) {
180
+	if ( isset( $subscribe_response[ 'error' ] ) ) {
181 181
 
182
-		if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
182
+		if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
183 183
 			require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
184 184
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
185
-			$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribe_response['error'], __( "Subscribe New User" , 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission_ajax.php" );
185
+			$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribe_response[ 'error' ], __( "Subscribe New User", 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission_ajax.php" );
186 186
 		}
187 187
 
188 188
 		$update_account_details_link = '';
189 189
 		$error = 1;
190
-		switch( $subscribe_response['code'] ) {
190
+		switch ( $subscribe_response[ 'code' ] ) {
191 191
 			// user already subscribed
192 192
 			case '214':
193
-				$custom_already_subscribed_text = apply_filters( 'yikes-easy-mailchimp-update-existing-subscriber-text', sprintf( __( ' To update your MailChimp profile, please %s.', 'yikes-inc-easy-mailchimp-extender' ), '<a class="send-update-email" data-list-id="' . $list_id . '" data-user-email="' . sanitize_email( $data['EMAIL'] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ), $form, '<a class="send-update-email" data-list-id="' . $_POST['yikes-mailchimp-associated-list-id'] . '" data-user-email="' . sanitize_email( $data['EMAIL'] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );
194
-				$update_account_details_link = ( 1 === absint( $optin_settings['update_existing_user'] ) && 1 === absint( $optin_settings['send_update_email'] ) ) ? $custom_already_subscribed_text : false;
195
-				if( ! empty( $error_messages['already-subscribed'] ) ) {
196
-					$error_response = apply_filters( 'yikes-easy-mailchimp-user-already-subscribed-text', $error_messages['already-subscribed'] , $form, $data['EMAIL'] ) . ' ' . $update_account_details_link;
193
+				$custom_already_subscribed_text = apply_filters( 'yikes-easy-mailchimp-update-existing-subscriber-text', sprintf( __( ' To update your MailChimp profile, please %s.', 'yikes-inc-easy-mailchimp-extender' ), '<a class="send-update-email" data-list-id="' . $list_id . '" data-user-email="' . sanitize_email( $data[ 'EMAIL' ] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ), $form, '<a class="send-update-email" data-list-id="' . $_POST[ 'yikes-mailchimp-associated-list-id' ] . '" data-user-email="' . sanitize_email( $data[ 'EMAIL' ] ) . '" href="#">' . __( 'click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );
194
+				$update_account_details_link = ( 1 === absint( $optin_settings[ 'update_existing_user' ] ) && 1 === absint( $optin_settings[ 'send_update_email' ] ) ) ? $custom_already_subscribed_text : false;
195
+				if ( ! empty( $error_messages[ 'already-subscribed' ] ) ) {
196
+					$error_response = apply_filters( 'yikes-easy-mailchimp-user-already-subscribed-text', $error_messages[ 'already-subscribed' ], $form, $data[ 'EMAIL' ] ) . ' ' . $update_account_details_link;
197 197
 				} else {
198
-					$error_response = $subscribe_response['error'] . ' ' . $update_account_details_link;
198
+					$error_response = $subscribe_response[ 'error' ] . ' ' . $update_account_details_link;
199 199
 				}
200 200
 				break;
201 201
 			// missing a required field
@@ -203,34 +203,34 @@  discard block
 block discarded – undo
203 203
 					// get all merge variables in array, loop and str_replace error code with field name
204 204
 					$api_key = yikes_get_mc_api_key();
205 205
 					$dash_position = strpos( $api_key, '-' );
206
-					if( $dash_position !== false ) {
206
+					if ( $dash_position !== false ) {
207 207
 						$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json';
208 208
 					}
209 209
 					$merge_variables = wp_remote_post( $api_endpoint, array(
210 210
 						'body' => array(
211 211
 							'apikey' => $api_key,
212
-							'id' => array( $list_id ) ,
212
+							'id' => array( $list_id ),
213 213
 						),
214 214
 						'timeout' => 10,
215 215
 						'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
216 216
 					) );
217 217
 					$merge_variables = json_decode( wp_remote_retrieve_body( $merge_variables ), true );
218
-					if( is_wp_error( $merge_variables ) || isset( $merge_variables['error'] ) ) {
219
-						if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
218
+					if ( is_wp_error( $merge_variables ) || isset( $merge_variables[ 'error' ] ) ) {
219
+						if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
220 220
 							require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
221 221
 							$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
222
-							$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission_ajax.php" );
222
+							$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), "process_form_submission_ajax.php" );
223 223
 						}
224 224
 					}
225 225
 					// re-store our data
226
-					$merge_variables = $merge_variables['data'][0]['merge_vars'];
226
+					$merge_variables = $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ];
227 227
 					$merge_variable_name_array = array();
228
-					foreach( $merge_variables as $merge_var ) {
229
-						$merge_variables_name_array[$merge_var['tag']] = $merge_var['name'];
228
+					foreach ( $merge_variables as $merge_var ) {
229
+						$merge_variables_name_array[ $merge_var[ 'tag' ] ] = $merge_var[ 'name' ];
230 230
 					}
231
-					$error_message = $subscribe_response['error'];
231
+					$error_message = $subscribe_response[ 'error' ];
232 232
 					// replace tag with name in the error message.
233
-					foreach( $merge_variables_name_array as $tag => $name ) {
233
+					foreach ( $merge_variables_name_array as $tag => $name ) {
234 234
 						$error_message = str_replace( $tag, $name, $error_message );
235 235
 					}
236 236
 					$error_response = $error_message;
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
 			// [email protected] is not allowed
239 239
 			case '-99':
240 240
 				// generic error
241
-				$error_response = str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response['error'] ) );
241
+				$error_response = str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response[ 'error' ] ) );
242 242
 				break;
243 243
 			// invalid email (or no email at all)
244 244
 				case '-100':
245
-					$error_response = ( ! empty( $error_messages['invalid-email'] ) ) ? $error_messages['invalid-email'] : __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' );
245
+					$error_response = ( ! empty( $error_messages[ 'invalid-email' ] ) ) ? $error_messages[ 'invalid-email' ] : __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' );
246 246
 					break;
247 247
 			default:
248
-				$error_response = ( ! empty( $error_messages['general-error'] ) ) ? $error_messages['general-error'] : $subscribe_response['error'];
248
+				$error_response = ( ! empty( $error_messages[ 'general-error' ] ) ) ? $error_messages[ 'general-error' ] : $subscribe_response[ 'error' ];
249 249
 				break;
250 250
 		}
251 251
 		// send the response
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 	/*
264 264
 	*	Successful form submission redirect
265 265
 	*/
266
-	if( $submission_settings['redirect_on_submission'] == '1' ) {
266
+	if ( $submission_settings[ 'redirect_on_submission' ] == '1' ) {
267 267
 		$redirection = '1';
268
-		$redirect_url = ( 'custom_url' != $submission_settings['redirect_page'] ) ? get_permalink( $submission_settings['redirect_page'] ) : $submission_settings['custom_redirect_url'];
268
+		$redirect_url = ( 'custom_url' != $submission_settings[ 'redirect_page' ] ) ? get_permalink( $submission_settings[ 'redirect_page' ] ) : $submission_settings[ 'custom_redirect_url' ];
269 269
 		$redirect = '<script type="text/javascript">setTimeout(function() { window.location="' . apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_url ), $form, $page_data ) . '"; }, ' . apply_filters( 'yikes-mailchimp-redirect-timer', 1500 ) . ');</script>';
270 270
 	}
271 271
 
@@ -281,16 +281,16 @@  discard block
 block discarded – undo
281 281
 	do_action( 'yikes-mailchimp-after-submission-' . $form, $merge_variables );
282 282
 
283 283
 	// send our notifications if setup (must go before wp_send_json())
284
-	do_action( 'yikes-mailchimp-form-submission' , sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications );
285
-	do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications );
284
+	do_action( 'yikes-mailchimp-form-submission', sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications );
285
+	do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications );
286 286
 
287
-	$default_success_response = ( 1 === $optin_settings['optin'] ) ? __( "Thank you for subscribing! Check your email for the confirmation message." , 'yikes-inc-easy-mailchimp-extender' ) : __( "Thank you for subscribing!" , 'yikes-inc-easy-mailchimp-extender' );
287
+	$default_success_response = ( 1 === $optin_settings[ 'optin' ] ) ? __( "Thank you for subscribing! Check your email for the confirmation message.", 'yikes-inc-easy-mailchimp-extender' ) : __( "Thank you for subscribing!", 'yikes-inc-easy-mailchimp-extender' );
288 288
 
289 289
 	wp_send_json_success(
290 290
 		array(
291
-			'hide' => $submission_settings['hide_form_post_signup'],
291
+			'hide' => $submission_settings[ 'hide_form_post_signup' ],
292 292
 			'error' => $error,
293
-			'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages['success'] ) ? $error_messages['success'] : $default_success_response ), $form, $merge_variables ),
293
+			'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages[ 'success' ] ) ? $error_messages[ 'success' ] : $default_success_response ), $form, $merge_variables ),
294 294
 			'redirection' => isset( $redirection ) ? '1' : '0',
295 295
 			'redirect' => isset( $redirect ) ? $redirect : '',
296 296
 		)
Please login to merge, or discard this patch.