Completed
Push — staging ( 57798f...9e32c1 )
by Evan
20:30
created
admin/partials/helpers/fields/yikes-mailchimp-select-field.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,21 +5,21 @@
 block discarded – undo
5 5
 	*	For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/]
6 6
 	* 	@since 6.0
7 7
 	*/
8
-	$field_data = json_decode( $form_data['custom_fields'] , true ); 
8
+	$field_data = json_decode( $form_data[ 'custom_fields' ], true ); 
9 9
 ?>
10 10
 <div class="custom-field-section">
11 11
 	<!-- title -->
12
-	<strong><?php echo $field['label']; ?></strong>
12
+	<strong><?php echo $field[ 'label' ]; ?></strong>
13 13
 	
14 14
 	<!-- Dropdown -->
15
-	<select class="custom-select-field" name="custom-field[<?php echo $field['id']; ?>]">
16
-		<?php foreach( $field['options'] as $value => $label ) { ?>
17
-			<option value="<?php echo $value; ?>" <?php if( isset( $field_data[$field['id']] ) ) { selected( $field_data[$field['id']] , $value ); } ?>><?php echo $label; ?></option>
15
+	<select class="custom-select-field" name="custom-field[<?php echo $field[ 'id' ]; ?>]">
16
+		<?php foreach ( $field[ 'options' ] as $value => $label ) { ?>
17
+			<option value="<?php echo $value; ?>" <?php if ( isset( $field_data[ $field[ 'id' ] ] ) ) { selected( $field_data[ $field[ 'id' ] ], $value ); } ?>><?php echo $label; ?></option>
18 18
 		<?php } ?>
19 19
 	</select>
20 20
 	
21 21
 	<!-- description -->
22
-	<?php if( isset( $field['description'] ) && $field['description'] != '' ) { ?>
23
-		<p class="description"><?php echo $field['description']; ?></p>
22
+	<?php if ( isset( $field[ 'description' ] ) && $field[ 'description' ] != '' ) { ?>
23
+		<p class="description"><?php echo $field[ 'description' ]; ?></p>
24 24
 	<?php } ?>
25 25
 </div>
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
admin/partials/helpers/fields/yikes-mailchimp-wysiwyg-field.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@
 block discarded – undo
6 6
 	*	For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/]
7 7
 	* 	@since 6.0
8 8
 	*/
9
-	$field_data = json_decode( $form_data['custom_fields'] , true ); 
10
-	$content = ( isset( $field_data[$field['id']] ) ) ? $field_data[$field['id']] : ( isset( $field['default'] ) ? $field['default'] : '' );
11
-	$wysiwyg_id = 'custom-field['.$field['id'].']';
9
+	$field_data = json_decode( $form_data[ 'custom_fields' ], true ); 
10
+	$content = ( isset( $field_data[ $field[ 'id' ] ] ) ) ? $field_data[ $field[ 'id' ] ] : ( isset( $field[ 'default' ] ) ? $field[ 'default' ] : '' );
11
+	$wysiwyg_id = 'custom-field[' . $field[ 'id' ] . ']';
12 12
 ?>
13 13
 
14 14
 <div class="yikes-mailchimp-wysiwyg-field">
15
-    <label for="image_url" class="widefat"><strong><?php echo $field['label']; ?></strong></label>
16
-    <?php wp_editor( $content, $field['id'], array( 'textarea_name' => $wysiwyg_id ) ); ?>
17
-    <p class="description"><?php echo $field['description']; ?></p>
15
+    <label for="image_url" class="widefat"><strong><?php echo $field[ 'label' ]; ?></strong></label>
16
+    <?php wp_editor( $content, $field[ 'id' ], array( 'textarea_name' => $wysiwyg_id ) ); ?>
17
+    <p class="description"><?php echo $field[ 'description' ]; ?></p>
18 18
 </div>
Please login to merge, or discard this patch.
admin/partials/helpers/fields/yikes-mailchimp-radio-field.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,22 +5,22 @@
 block discarded – undo
5 5
 	*	For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/]
6 6
 	* 	@since 6.0
7 7
 	*/
8
-	$field_data = json_decode( $form_data['custom_fields'] , true ); 
8
+	$field_data = json_decode( $form_data[ 'custom_fields' ], true ); 
9 9
 ?>
10 10
 <div class="custom-field-section">
11 11
 	<!-- title -->
12
-	<strong><?php echo $field['label']; ?></strong>
12
+	<strong><?php echo $field[ 'label' ]; ?></strong>
13 13
 	<!-- radio buttons -->
14 14
 	<section class="custom-radio-holder">
15
-		<?php foreach( $field['options'] as $value => $label ) { ?>
15
+		<?php foreach ( $field[ 'options' ] as $value => $label ) { ?>
16 16
 			<label class="custom-radio-label">
17
-				<input type="radio" name="custom-field[<?php echo $field['id']; ?>][]" id="custom-field" value="<?php echo $value; ?>" <?php if( isset( $field_data[$field['id']] ) ) { checked( $field_data[$field['id']] , $value ); } ?>>
17
+				<input type="radio" name="custom-field[<?php echo $field[ 'id' ]; ?>][]" id="custom-field" value="<?php echo $value; ?>" <?php if ( isset( $field_data[ $field[ 'id' ] ] ) ) { checked( $field_data[ $field[ 'id' ] ], $value ); } ?>>
18 18
 				<?php echo $label; ?>
19 19
 			</label>
20 20
 		<?php } ?>
21 21
 	</section>
22 22
 	<!-- description -->
23
-	<?php if( isset( $field['description'] ) && $field['description'] != '' ) { ?>
24
-		<p class="description"><?php echo $field['description']; ?></p>
23
+	<?php if ( isset( $field[ 'description' ] ) && $field[ 'description' ] != '' ) { ?>
24
+		<p class="description"><?php echo $field[ 'description' ]; ?></p>
25 25
 	<?php } ?>
26 26
 </div>
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
admin/partials/helpers/fields/yikes-mailchimp-file-field.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,33 +5,33 @@
 block discarded – undo
5 5
 	*	For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/]
6 6
 	* 	@since 6.0
7 7
 	*/
8
-	$field_data = json_decode( $form_data['custom_fields'] , true ); 
8
+	$field_data = json_decode( $form_data[ 'custom_fields' ], true ); 
9 9
 	// This will enqueue the Media Uploader script
10 10
 	wp_enqueue_media();
11 11
 	// And let's not forget the script we wrote earlier
12 12
 	wp_enqueue_script( 'yikes-mailchimp-file-field-script', plugin_dir_url( __FILE__ ) . 'js/yikes-mc-file-upload.js', array( 'jquery' ), '1.0', false );
13 13
 	// print_r( $field_data );
14
-	wp_localize_script( 'yikes-mailchimp-file-field-script' , 'additional_data' , array(
14
+	wp_localize_script( 'yikes-mailchimp-file-field-script', 'additional_data', array(
15 15
 		'wp_includes_image_url' => includes_url() . 'images/media/'
16 16
 	) );
17 17
 	$i = 1;
18 18
 	// create an single item array when nothing is stored yet, loop for one field 
19
-	$field_data['incentive-attachment'] = ( isset( $field_data['incentive-attachment'] ) && !empty( $field_data['incentive-attachment'] ) )  ? $field_data['incentive-attachment'] : array( '' );
19
+	$field_data[ 'incentive-attachment' ] = ( isset( $field_data[ 'incentive-attachment' ] ) && ! empty( $field_data[ 'incentive-attachment' ] ) ) ? $field_data[ 'incentive-attachment' ] : array( '' );
20 20
 ?>
21 21
 	
22 22
 	<div class="yikes-mailchimp-file-field">
23
-		<label for="image_url" class="widefat"><strong><?php echo $field['label']; ?></strong></label>
24
-		<?php foreach( $field_data['incentive-attachment'] as $attachment ) { ?>
25
-			<input type="text" name="custom-field[<?php echo $field['id']; ?>][<?php echo $i; ?>]" id="custom-field[<?php echo $field['id']; ?>][<?php echo $i; ?>]" class="file-attachment" value="<?php echo isset( $field_data[$field['id']][$i] ) ? $field_data[$field['id']][$i] : ''; ?>">
26
-			<input type="button" name="upload-btn" id="upload-btn" class="button-secondary" data-attr-position="<?php echo $i; ?>" value="<?php _e( 'Upload File' , 'yikes-inc-easy-mailchimp-extender' ); ?>">
23
+		<label for="image_url" class="widefat"><strong><?php echo $field[ 'label' ]; ?></strong></label>
24
+		<?php foreach ( $field_data[ 'incentive-attachment' ] as $attachment ) { ?>
25
+			<input type="text" name="custom-field[<?php echo $field[ 'id' ]; ?>][<?php echo $i; ?>]" id="custom-field[<?php echo $field[ 'id' ]; ?>][<?php echo $i; ?>]" class="file-attachment" value="<?php echo isset( $field_data[ $field[ 'id' ] ][ $i ] ) ? $field_data[ $field[ 'id' ] ][ $i ] : ''; ?>">
26
+			<input type="button" name="upload-btn" id="upload-btn" class="button-secondary" data-attr-position="<?php echo $i; ?>" value="<?php _e( 'Upload File', 'yikes-inc-easy-mailchimp-extender' ); ?>">
27 27
 			<div class="file-container">
28 28
 				<p class="file-remove-wrapper">
29
-					<a href="#" class="remove-file-button" data-attr-position="<?php echo $i; ?>"><?php _e( 'Remove File' , 'yikes-inc-easy-mailchimp-extender' ); ?></a>
29
+					<a href="#" class="remove-file-button" data-attr-position="<?php echo $i; ?>"><?php _e( 'Remove File', 'yikes-inc-easy-mailchimp-extender' ); ?></a>
30 30
 				</p>
31 31
 			</div>
32 32
 		<?php $i++; } ?>
33
-		<?php if( isset( $field['repeat'] ) ) { ?>
33
+		<?php if ( isset( $field[ 'repeat' ] ) ) { ?>
34 34
 			<a href="#" class="button-secondary add-new-incentive-attachment" data-attr-position="<?php echo $i; ?>"><span class="dashicons dashicons-plus"></span></a>
35 35
 		<?php } ?>
36
-		<p class="description"><?php echo $field['description']; ?></p>
36
+		<p class="description"><?php echo $field[ 'description' ]; ?></p>
37 37
 	</div>
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
admin/partials/helpers/edit-form-hidden-section-template.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -8,28 +8,28 @@  discard block
 block discarded – undo
8 8
 		// grab our global form_data;
9 9
 		global $form_data;
10 10
 	?>
11
-	<label class="hidden-setting-label yikes-easy-mc-hidden" for="form" id=<?php esc_attr_e( $section_data['id'] ); ?>>
11
+	<label class="hidden-setting-label yikes-easy-mc-hidden" for="form" id=<?php esc_attr_e( $section_data[ 'id' ] ); ?>>
12 12
 		<div id="poststuff">
13
-			<div id="post-body" class="metabox-holder <?php if( self::is_custom_section_two_column( $section_data ) ) { ?> columns-2 <?php } else { ?> columns-1 <?php } ?>">
13
+			<div id="post-body" class="metabox-holder <?php if ( self::is_custom_section_two_column( $section_data ) ) { ?> columns-2 <?php } else { ?> columns-1 <?php } ?>">
14 14
 				<div id="post-body-content">
15 15
 					<div class="meta-box-sortables ui-sortable">
16 16
 						<div class="postbox yikes-easy-mc-postbox">
17
-							<h3 class="edit-form-title"><span><?php echo $section_data['main_title']; ?></span></h3>
18
-								<div class="inside <?php esc_attr_e( $section_data['id'] ); ?>-container">
17
+							<h3 class="edit-form-title"><span><?php echo $section_data[ 'main_title' ]; ?></span></h3>
18
+								<div class="inside <?php esc_attr_e( $section_data[ 'id' ] ); ?>-container">
19 19
 									<?php 
20
-										if( isset( $section_data['main_description'] ) && $section_data['main_description'] != '' ) {
20
+										if ( isset( $section_data[ 'main_description' ] ) && $section_data[ 'main_description' ] != '' ) {
21 21
 											?>
22
-												<p><?php echo $section_data['main_description']; ?></p>
22
+												<p><?php echo $section_data[ 'main_description' ]; ?></p>
23 23
 											<?php
24 24
 										}
25
-										$main_field_data = $section_data['main_fields'];
26
-										foreach( $main_field_data as $field ) { 
27
-											if( $field['type'] == 'custom' ) {
25
+										$main_field_data = $section_data[ 'main_fields' ];
26
+										foreach ( $main_field_data as $field ) { 
27
+											if ( $field[ 'type' ] == 'custom' ) {
28 28
 												// execute the custom callback
29
-												$field['callback']();
29
+												$field[ 'callback' ]();
30 30
 											} else {
31 31
 												// include our field files
32
-												include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field['type'] . '-field.php' );
32
+												include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field[ 'type' ] . '-field.php' );
33 33
 											}
34 34
 										}
35 35
 									?>
@@ -39,27 +39,27 @@  discard block
 block discarded – undo
39 39
 					</div>
40 40
 					
41 41
 					<!-- check for single/double box -->
42
-					<?php if( self::is_custom_section_two_column( $section_data ) ) { ?>
42
+					<?php if ( self::is_custom_section_two_column( $section_data ) ) { ?>
43 43
 						<!-- begin sidebar -->
44 44
 						<div id="postbox-container-1" class="postbox-container">
45 45
 							<div class="meta-box-sortables">
46 46
 								<div class="postbox yikes-easy-mc-postbox">
47
-									<h3 class="edit-form-title"><span><?php echo $section_data['sidebar_title']; ?></span></h3>
48
-									<div class="inside <?php esc_attr_e( $section_data['id'] ); ?>-sidebar-container"> 
47
+									<h3 class="edit-form-title"><span><?php echo $section_data[ 'sidebar_title' ]; ?></span></h3>
48
+									<div class="inside <?php esc_attr_e( $section_data[ 'id' ] ); ?>-sidebar-container"> 
49 49
 										<?php
50
-											if( isset( $section_data['sidebar_description'] ) && $section_data['sidebar_description'] != '' ) {
50
+											if ( isset( $section_data[ 'sidebar_description' ] ) && $section_data[ 'sidebar_description' ] != '' ) {
51 51
 												?>
52
-													<p><?php echo $section_data['sidebar_description']; ?></p>
52
+													<p><?php echo $section_data[ 'sidebar_description' ]; ?></p>
53 53
 												<?php
54 54
 											}
55
-											$sidebar_field_data = $section_data['sidebar_fields'];
56
-											foreach( $sidebar_field_data as $field ) { 
57
-												if( $field['type'] == 'custom' ) {
55
+											$sidebar_field_data = $section_data[ 'sidebar_fields' ];
56
+											foreach ( $sidebar_field_data as $field ) { 
57
+												if ( $field[ 'type' ] == 'custom' ) {
58 58
 													// execute the custom callback
59
-													$field['callback']();
59
+													$field[ 'callback' ]();
60 60
 												} else {
61 61
 													// include our field files
62
-													include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field['type'] . '-field.php' );
62
+													include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field[ 'type' ] . '-field.php' );
63 63
 												}
64 64
 											}
65 65
 										?>
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 											<?php
24 24
 										}
25 25
 										$main_field_data = $section_data['main_fields'];
26
-										foreach( $main_field_data as $field ) { 
26
+										foreach( $main_field_data as $field ) {
27 27
 											if( $field['type'] == 'custom' ) {
28 28
 												// execute the custom callback
29 29
 												$field['callback']();
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 												<?php
54 54
 											}
55 55
 											$sidebar_field_data = $section_data['sidebar_fields'];
56
-											foreach( $sidebar_field_data as $field ) { 
56
+											foreach( $sidebar_field_data as $field ) {
57 57
 												if( $field['type'] == 'custom' ) {
58 58
 													// execute the custom callback
59 59
 													$field['callback']();
Please login to merge, or discard this patch.
admin/partials/view-list.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 									?></ul><?php
357 357
 								}
358 358
 								/**
359
-								*	Custom action hook for our add-ons to hook into
360
-								*	@since 6.0.3.8
361
-								*/
359
+								 *	Custom action hook for our add-ons to hook into
360
+								 *	@since 6.0.3.8
361
+								 */
362 362
 								do_action( 'yikes-mailchimp-list-form-fields-metabox' );
363 363
 							?>
364 364
 							
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
 									<?php
386 386
 								}
387 387
 								/**
388
-								*	Custom action hook for our add-ons to hook into
389
-								*	@since 6.0.3.8
390
-								*/
388
+								 *	Custom action hook for our add-ons to hook into
389
+								 *	@since 6.0.3.8
390
+								 */
391 391
 								do_action( 'yikes-mailchimp-list-interest-groups-metabox' );
392 392
 							?>
393 393
 							
Please login to merge, or discard this patch.
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2
-	if( isset( $_REQUEST['list-id'] ) ) {
3
-		$list_id = sanitize_key( $_REQUEST['list-id'] );
2
+	if ( isset( $_REQUEST[ 'list-id' ] ) ) {
3
+		$list_id = sanitize_key( $_REQUEST[ 'list-id' ] );
4 4
 		$api_key = yikes_get_mc_api_key();		
5 5
 		$dash_position = strpos( $api_key, '-' );
6
-		if( $dash_position !== false ) {
6
+		if ( $dash_position !== false ) {
7 7
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json';
8 8
 		}
9 9
 		$list_data = wp_remote_post( $api_endpoint, array(
@@ -15,40 +15,40 @@  discard block
 block discarded – undo
15 15
 			'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
16 16
 		) );
17 17
 		$list_data = json_decode( wp_remote_retrieve_body( $list_data ), true );
18
-		if( isset( $list_data['error'] ) ) {
19
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
18
+		if ( isset( $list_data[ 'error' ] ) ) {
19
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
20 20
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
21 21
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
22
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
22
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
23 23
 			}
24 24
 		}
25 25
 		// reset our data so we can easily use it
26
-		$list_data = $list_data['data'][0];
26
+		$list_data = $list_data[ 'data' ][ 0 ];
27 27
 
28
-		if( $dash_position !== false ) {
28
+		if ( $dash_position !== false ) {
29 29
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json';
30 30
 		}
31 31
 		$merge_variables = wp_remote_post( $api_endpoint, array(
32 32
 			'body' => array(
33 33
 				'apikey' => $api_key,
34
-				'id' => array( $list_id ) ,
34
+				'id' => array( $list_id ),
35 35
 			),
36 36
 			'timeout' => 10,
37 37
 			'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
38 38
 		) );
39 39
 		$merge_variables = json_decode( wp_remote_retrieve_body( $merge_variables ), true );
40
-		if( isset( $merge_variables['error'] ) ) {
41
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
40
+		if ( isset( $merge_variables[ 'error' ] ) ) {
41
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
42 42
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
43 43
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
44
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
44
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
45 45
 			}
46 46
 		}
47 47
 		// re-store our data
48
-		$merge_variables = $merge_variables['data'][0]['merge_vars'];
48
+		$merge_variables = $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ];
49 49
 
50 50
 		// get the interest group data
51
-		if( $dash_position !== false ) {
51
+		if ( $dash_position !== false ) {
52 52
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/interest-groupings.json';
53 53
 		}
54 54
 		$interest_groupings = wp_remote_post( $api_endpoint, array(
@@ -62,20 +62,20 @@  discard block
 block discarded – undo
62 62
 		) );
63 63
 		$interest_groupings = json_decode( wp_remote_retrieve_body( $interest_groupings ), true );
64 64
 
65
-		if( isset( $interest_groupings['error'] ) ) {
66
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
65
+		if ( isset( $interest_groupings[ 'error' ] ) ) {
66
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
67 67
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
68 68
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
69
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $interest_groupings['error'], __( "Get Interest Groups" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
69
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $interest_groupings[ 'error' ], __( "Get Interest Groups", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
70 70
 			}
71 71
 		}
72 72
 
73 73
 		$no_interest_groupings = '<p class="description">' . __( 'Interest groups are not enabled for this list.', 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
74 74
 
75 75
 
76
-		$no_segments = __( 'No segments set up for this list.' , 'yikes-inc-easy-mailchimp-extender' );
76
+		$no_segments = __( 'No segments set up for this list.', 'yikes-inc-easy-mailchimp-extender' );
77 77
 		// get the segment data
78
-		if( $dash_position !== false ) {
78
+		if ( $dash_position !== false ) {
79 79
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/segments.json';
80 80
 		}
81 81
 		$segments = wp_remote_post( $api_endpoint, array(
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 
91 91
 
92 92
 		// setup pagination variables
93
-		$paged = isset( $_REQUEST['paged'] ) ? $_REQUEST['paged'] : '0';
93
+		$paged = isset( $_REQUEST[ 'paged' ] ) ? $_REQUEST[ 'paged' ] : '0';
94 94
 
95
-		$limit = apply_filters( 'yikes_admin_list_subscriber_limit' , '20' );
95
+		$limit = apply_filters( 'yikes_admin_list_subscriber_limit', '20' );
96 96
 
97
-		$sort_dir = isset( $_REQUEST['sort'] ) ? $_REQUEST['sort'] : 'DESC';
98
-		$column = isset( $_REQUEST['column'] ) ? $_REQUEST['column'] : 'optin_time';
97
+		$sort_dir = isset( $_REQUEST[ 'sort' ] ) ? $_REQUEST[ 'sort' ] : 'DESC';
98
+		$column = isset( $_REQUEST[ 'column' ] ) ? $_REQUEST[ 'column' ] : 'optin_time';
99 99
 
100
-		if( $sort_dir == 'DESC' ) {
100
+		if ( $sort_dir == 'DESC' ) {
101 101
 			$opposite_sort_dir = 'ASC';
102 102
 			$icon = '<span class="dashicons dashicons-arrow-down"></span>';
103 103
 		} else {
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
 			$icon = '<span class="dashicons dashicons-arrow-up"></span>';
106 106
 		}
107 107
 
108
-		if( !isset( $_REQUEST['sort'] ) ) {
108
+		if ( ! isset( $_REQUEST[ 'sort' ] ) ) {
109 109
 			$icon = '';
110 110
 		}
111 111
 
112 112
 		// get all subscribed members
113
-		if( $dash_position !== false ) {
113
+		if ( $dash_position !== false ) {
114 114
 			$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/members.json';
115 115
 		}
116 116
 		$subscribers_list = wp_remote_post( $api_endpoint, array(
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 			'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
129 129
 		) );
130 130
 		$subscribers_list = json_decode( wp_remote_retrieve_body( $subscribers_list ), true );
131
-		if( isset( $subscribers_list['error'] ) ) {
132
-			if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
131
+		if ( isset( $subscribers_list[ 'error' ] ) ) {
132
+			if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
133 133
 				require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
134 134
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
135
-				$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribers_list['error'], __( "Get Subscriber Count" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
135
+				$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscribers_list[ 'error' ], __( "Get Subscriber Count", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" );
136 136
 			}
137 137
 		}
138 138
 
139
-		$total_pages = ceil( $subscribers_list['total'] / $limit );
140
-		if( $total_pages == 0 ) {
139
+		$total_pages = ceil( $subscribers_list[ 'total' ] / $limit );
140
+		if ( $total_pages == 0 ) {
141 141
 			$total_pages = '1';
142 142
 		}
143 143
 
@@ -146,25 +146,25 @@  discard block
 block discarded – undo
146 146
 ?>
147 147
 <div class="wrap">
148 148
 	<!-- Freddie Logo -->
149
-	<img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" />
149
+	<img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" />
150 150
 
151
-	<h1>YIKES Easy Forms for MailChimp | <?php echo $list_data['name']; ?></h1>
151
+	<h1>YIKES Easy Forms for MailChimp | <?php echo $list_data[ 'name' ]; ?></h1>
152 152
 
153 153
 	<!-- Settings Page Description -->
154
-	<p class="yikes-easy-mc-about-text about-text"><?php _e( 'View all subscribers below. View additional subscriber info, or add additional fields to this list.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
155
-	<!-- <p class="add-new-subscriber-button"><a href="#" onclick="jQuery(this).parent().next().slideToggle();" class="add-new-h2"><?php _e( 'New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> -->
154
+	<p class="yikes-easy-mc-about-text about-text"><?php _e( 'View all subscribers below. View additional subscriber info, or add additional fields to this list.', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
155
+	<!-- <p class="add-new-subscriber-button"><a href="#" onclick="jQuery(this).parent().next().slideToggle();" class="add-new-h2"><?php _e( 'New Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> -->
156 156
 
157 157
 	<?php
158 158
 		/* Display our admin notices here */
159 159
 		// Unsubscribe user confirmation message
160
-		if( isset( $_REQUEST['user-unsubscribed'] ) && $_REQUEST['user-unsubscribed'] == 'true' ) {
160
+		if ( isset( $_REQUEST[ 'user-unsubscribed' ] ) && $_REQUEST[ 'user-unsubscribed' ] == 'true' ) {
161 161
 			?>
162 162
 			<div class="updated manage-form-admin-notice">
163 163
 				<p><?php _e( 'User successfully unsubscribed.', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
164 164
 			</div>
165 165
 			<?php
166 166
 		}
167
-		if( isset( $_REQUEST['user-unsubscribed'] ) && $_REQUEST['user-unsubscribed'] == 'false' ) {
167
+		if ( isset( $_REQUEST[ 'user-unsubscribed' ] ) && $_REQUEST[ 'user-unsubscribed' ] == 'false' ) {
168 168
 			?>
169 169
 			<div class="error manage-form-admin-notice">
170 170
 				<p><?php _e( "We've encountered an error trying to remove the subscriber. Please try again. If the error persists please get in contact with the YIKES Inc. support staff.", 'yikes-inc-easy-mailchimp-extender' ); ?></p>
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 	?>
175 175
 
176 176
 	<section class="add-new-subscriber-form-container">
177
-		<h4><?php _e( 'Add New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ); ?></h4>
177
+		<h4><?php _e( 'Add New Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?></h4>
178 178
 		<form id="add-new-subcscriber">
179
-			<input type="text" class="regular-text" placeholder="<?php _e( 'User Email Address' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p>
179
+			<input type="text" class="regular-text" placeholder="<?php _e( 'User Email Address', 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p>
180 180
 			<p><?php echo submit_button( 'Add Subscriber' ); ?></p>
181 181
 		</form>
182 182
 	</section>
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 									<!-- TABLE HEAD -->
199 199
 									<thead>
200 200
 										<tr>
201
-											<th id="user-email columnname" class="manage-column column-columnname" scope="col"><a id="user-email-sort" href="<?php echo esc_url_raw( add_query_arg( array( 'column' => 'email' , 'sort' => $opposite_sort_dir ) ) ); ?>"><?php _e( 'User Email' , 'yikes-inc-easy-mailchimp-extender' ); echo $icon;?></a></th>
202
-											<th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client' , 'yikes-inc-easy-mailchimp-extender' ); ?></th>
201
+											<th id="user-email columnname" class="manage-column column-columnname" scope="col"><a id="user-email-sort" href="<?php echo esc_url_raw( add_query_arg( array( 'column' => 'email', 'sort' => $opposite_sort_dir ) ) ); ?>"><?php _e( 'User Email', 'yikes-inc-easy-mailchimp-extender' ); echo $icon; ?></a></th>
202
+											<th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client', 'yikes-inc-easy-mailchimp-extender' ); ?></th>
203 203
 										</tr>
204 204
 									</thead>
205 205
 									<!-- end header -->
@@ -207,38 +207,38 @@  discard block
 block discarded – undo
207 207
 									<!-- FOOTER -->
208 208
 									<tfoot>
209 209
 										<tr>
210
-											<th class="manage-column column-columnname" scope="col"><?php _e( 'User Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></th>
211
-											<th class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client' , 'yikes-inc-easy-mailchimp-extender' ); ?></th>
210
+											<th class="manage-column column-columnname" scope="col"><?php _e( 'User Email', 'yikes-inc-easy-mailchimp-extender' ); ?></th>
211
+											<th class="manage-column column-columnname num" scope="col"><?php _e( 'Email Client', 'yikes-inc-easy-mailchimp-extender' ); ?></th>
212 212
 										</tr>
213 213
 									</tfoot>
214 214
 									<!-- end footer -->
215 215
 
216 216
 									<!-- TABLE BODY -->
217 217
 									<tbody>
218
-										<?php if( $subscribers_list['total'] > 0 ) {
218
+										<?php if ( $subscribers_list[ 'total' ] > 0 ) {
219 219
 												$i = 1;
220
-												foreach( $subscribers_list['data'] as $subscriber ) {
221
-													$user_id = $subscriber['leid'];
220
+												foreach ( $subscribers_list[ 'data' ] as $subscriber ) {
221
+													$user_id = $subscriber[ 'leid' ];
222 222
 													// setup the email client name and icon
223
-													if( !empty( $subscriber['clients'] ) ) {
224
-														$user_email_client_name = $subscriber['clients']['name'];
225
-														$user_email_client_icon = "<img src='" . esc_url_raw( $subscriber['clients']['icon_url'] ) . "' alt=" . $user_email_client_name . " title=" . $user_email_client_name . ">";
223
+													if ( ! empty( $subscriber[ 'clients' ] ) ) {
224
+														$user_email_client_name = $subscriber[ 'clients' ][ 'name' ];
225
+														$user_email_client_icon = "<img src='" . esc_url_raw( $subscriber[ 'clients' ][ 'icon_url' ] ) . "' alt=" . $user_email_client_name . " title=" . $user_email_client_name . ">";
226 226
 													} else {
227 227
 														$path = YIKES_MC_URL . "includes/images/na.png";
228
-														$user_email_client_icon = "<img width='35' src='" . $path . "' alt='" . __( 'not set' , 'yikes-inc-easy-mailchimp-extender' ) . "' title='" .  __( 'not set' , 'yikes-inc-easy-mailchimp-extender' ) . "'>";
228
+														$user_email_client_icon = "<img width='35' src='" . $path . "' alt='" . __( 'not set', 'yikes-inc-easy-mailchimp-extender' ) . "' title='" . __( 'not set', 'yikes-inc-easy-mailchimp-extender' ) . "'>";
229 229
 													}
230 230
 
231 231
 										?>
232
-											<tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>">
232
+											<tr class="<?php if ( $i % 2 == 0 ) { echo 'alternate'; } ?>">
233 233
 												<td class="column-columnname">
234
-													<a class="user-email row-title" href="mailto:<?php echo sanitize_email( $subscriber['email'] ); ?>">
235
-														<?php echo sanitize_email( $subscriber['email'] ); ?>
234
+													<a class="user-email row-title" href="mailto:<?php echo sanitize_email( $subscriber[ 'email' ] ); ?>">
235
+														<?php echo sanitize_email( $subscriber[ 'email' ] ); ?>
236 236
 													</a>
237 237
 													<div class="row-actions">
238
-														<?php $view_user_info_url = esc_url_raw( add_query_arg( array( 'mailchimp-list' => $list_id , 'email-id' => $user_id ), admin_url() . 'admin.php?page=yikes-mailchimp-view-user' ) ); ?>
239
-														<span><a href="<?php echo $view_user_info_url; ?>"><?php _e( "View Info." , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span>
240
-														<?php $url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-unsubscribe-user', 'mailchimp-list' => $list_id , 'nonce' => wp_create_nonce( 'unsubscribe-user-'.$user_id ), 'email_id' => $user_id ) ) ); ?>
241
-														<span><a href="<?php echo $url; ?>" onclick="return confirm('<?php printf( __( "Are you sure you want to unsubscribe %s from this mailing list?" , 'yikes-inc-easy-mailchimp-extender' ), sanitize_email( $subscriber['email'] ) ); ?>');" class="yikes-delete-subscriber"><?php _e( "Unsubscribe" , 'yikes-inc-easy-mailchimp-extender' ); ?></a>
238
+														<?php $view_user_info_url = esc_url_raw( add_query_arg( array( 'mailchimp-list' => $list_id, 'email-id' => $user_id ), admin_url() . 'admin.php?page=yikes-mailchimp-view-user' ) ); ?>
239
+														<span><a href="<?php echo $view_user_info_url; ?>"><?php _e( "View Info.", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span>
240
+														<?php $url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-unsubscribe-user', 'mailchimp-list' => $list_id, 'nonce' => wp_create_nonce( 'unsubscribe-user-' . $user_id ), 'email_id' => $user_id ) ) ); ?>
241
+														<span><a href="<?php echo $url; ?>" onclick="return confirm('<?php printf( __( "Are you sure you want to unsubscribe %s from this mailing list?", 'yikes-inc-easy-mailchimp-extender' ), sanitize_email( $subscriber[ 'email' ] ) ); ?>');" class="yikes-delete-subscriber"><?php _e( "Unsubscribe", 'yikes-inc-easy-mailchimp-extender' ); ?></a>
242 242
 													</div>
243 243
 												</td>
244 244
 												<td class="column-columnname num"><?php echo $user_email_client_icon; ?></td>
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 												}
249 249
 											} else { ?>
250 250
 											<tr class="no-items">
251
-												<td class="colspanchange no-current-subscriber-notice" colspan="2"><em><?php _e( 'No one is currently subscribed to this list.' , 'yikes-inc-easy-mailchimp-extender' ); ?></em></td>
251
+												<td class="colspanchange no-current-subscriber-notice" colspan="2"><em><?php _e( 'No one is currently subscribed to this list.', 'yikes-inc-easy-mailchimp-extender' ); ?></em></td>
252 252
 											</tr>
253 253
 										<?php } ?>
254 254
 									</tbody>
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 						<!-- pagination -->
261 261
 						<div class="tablenav">
262 262
 							<div class="tablenav-pages">
263
-								<a class='first-page <?php if( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the first page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => 0 ) ) ); ?>'>&laquo;</a>
264
-								<a class='prev-page <?php if( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the previous page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged - 1 ) ) ) ); ?>'>&lsaquo;</a>
265
-								<span class="paging-input"><input class='current-page' title='<?php _e( "Current page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' type='text' name='paged' value='<?php if( $paged == 0 ) { echo '1'; } else { echo intval( $paged + 1 ); } ?>' size='1' /> <?php _e( 'of', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class='total-pages'><?php echo $total_pages; ?></span></span>
266
-								<a class='next-page <?php if( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the next page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged + 1 ) ) ) ); ?>'>&rsaquo;</a>
267
-								<a class='last-page <?php if( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the last page" , 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $total_pages - 1 ) ) ) ); ?>'>&raquo;</a>
263
+								<a class='first-page <?php if ( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the first page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => 0 ) ) ); ?>'>&laquo;</a>
264
+								<a class='prev-page <?php if ( $paged == 0 ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the previous page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged - 1 ) ) ) ); ?>'>&lsaquo;</a>
265
+								<span class="paging-input"><input class='current-page' title='<?php _e( "Current page", 'yikes-inc-easy-mailchimp-extender' ); ?>' type='text' name='paged' value='<?php if ( $paged == 0 ) { echo '1'; } else { echo intval( $paged + 1 ); } ?>' size='1' /> <?php _e( 'of', 'yikes-inc-easy-mailchimp-extender' ); ?> <span class='total-pages'><?php echo $total_pages; ?></span></span>
266
+								<a class='next-page <?php if ( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the next page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $paged + 1 ) ) ) ); ?>'>&rsaquo;</a>
267
+								<a class='last-page <?php if ( $paged == intval( $total_pages - 1 ) ) { echo 'disabled'; } ?>' title='<?php _e( "Go to the last page", 'yikes-inc-easy-mailchimp-extender' ); ?>' href='<?php echo esc_url_raw( add_query_arg( array( "paged" => intval( $total_pages - 1 ) ) ) ); ?>'>&raquo;</a>
268 268
 							</div>
269 269
 						</div>
270 270
 
@@ -279,21 +279,21 @@  discard block
 block discarded – undo
279 279
 
280 280
 						<div class="postbox yikes-easy-mc-postbox">
281 281
 
282
-							<h3><?php _e( 'List Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
282
+							<h3><?php _e( 'List Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
283 283
 
284 284
 							<?php
285 285
 								// store list rating
286
-								$list_rating = $list_data['list_rating'];
287
-								if( $list_rating > 0 ) {
288
-									$list_rating_explosion = explode( '.' , $list_rating );
286
+								$list_rating = $list_data[ 'list_rating' ];
287
+								if ( $list_rating > 0 ) {
288
+									$list_rating_explosion = explode( '.', $list_rating );
289 289
 									$star_array = array();
290 290
 									$x = 1;
291
-									while( $list_rating_explosion[0] >= $x ) {
292
-										$star_array[] = '<span class="dashicons dashicons-star-filled list-rating-star"></span>';
291
+									while ( $list_rating_explosion[ 0 ] >= $x ) {
292
+										$star_array[ ] = '<span class="dashicons dashicons-star-filled list-rating-star"></span>';
293 293
 										$x++;
294 294
 									}
295
-									if( $list_rating_explosion[1] == '5' ) {
296
-										$star_array[] = '<span class="dashicons dashicons-star-half list-rating-star"></span>';
295
+									if ( $list_rating_explosion[ 1 ] == '5' ) {
296
+										$star_array[ ] = '<span class="dashicons dashicons-star-half list-rating-star"></span>';
297 297
 									}
298 298
 								} else {
299 299
 									$star_array = array( 'n/a' );
@@ -301,40 +301,40 @@  discard block
 block discarded – undo
301 301
 							?>
302 302
 							<table class="form-table">
303 303
 								<tr valign="top">
304
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'List Rating' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
305
-									<td><?php echo implode( ' ' , $star_array ); ?></td>
304
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'List Rating', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
305
+									<td><?php echo implode( ' ', $star_array ); ?></td>
306 306
 								</tr>
307 307
 								<tr valign="top">
308
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Average Subscribers' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
309
-									<td><?php echo $list_data['stats']['avg_sub_rate']; ?><small> / <?php  _e( 'month' , 'yikes-inc-easy-mailchimp-extender' ); ?></small></td>
308
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Average Subscribers', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
309
+									<td><?php echo $list_data[ 'stats' ][ 'avg_sub_rate' ]; ?><small> / <?php  _e( 'month', 'yikes-inc-easy-mailchimp-extender' ); ?></small></td>
310 310
 								</tr>
311 311
 								<tr valign="top">
312
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
313
-									<td><?php echo intval( $list_data['stats']['member_count'] ); ?></td>
312
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
313
+									<td><?php echo intval( $list_data[ 'stats' ][ 'member_count' ] ); ?></td>
314 314
 								</tr>
315 315
 								<tr valign="top">
316
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'New Since Last Campaign' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
317
-									<td><?php echo intval( $list_data['stats']['member_count_since_send'] ); ?></td>
316
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'New Since Last Campaign', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
317
+									<td><?php echo intval( $list_data[ 'stats' ][ 'member_count_since_send' ] ); ?></td>
318 318
 								</tr>
319 319
 								<tr valign="top">
320
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Created' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
321
-									<td><?php echo date( get_option('date_format') , strtotime( $list_data['date_created'] ) ); ?></td>
320
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Created', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
321
+									<td><?php echo date( get_option( 'date_format' ), strtotime( $list_data[ 'date_created' ] ) ); ?></td>
322 322
 								</tr>
323 323
 								<tr valign="top">
324
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'List Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
325
-									<td><?php echo intval( $list_data['stats']['merge_var_count'] + 1 ); // add 1 for our email field.. ?></td>
324
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'List Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
325
+									<td><?php echo intval( $list_data[ 'stats' ][ 'merge_var_count' ] + 1 ); // add 1 for our email field.. ?></td>
326 326
 								</tr>
327 327
 								<tr valign="top">
328
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Short Signup URL' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
329
-									<td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo esc_url_raw( $list_data['subscribe_url_short'] ); ?>" readonly onclick="jQuery(this).select();"></td>
328
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Short Signup URL', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
329
+									<td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo esc_url_raw( $list_data[ 'subscribe_url_short' ] ); ?>" readonly onclick="jQuery(this).select();"></td>
330 330
 								</tr>
331 331
 								<tr valign="top">
332
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Default From Email' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
333
-									<td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo sanitize_email( $list_data['default_from_email'] ); ?>" readonly onclick="jQuery(this).select();"></td>
332
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Default From Email', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
333
+									<td><input type="text" class="widefat view-list-sidebar-input" value="<?php echo sanitize_email( $list_data[ 'default_from_email' ] ); ?>" readonly onclick="jQuery(this).select();"></td>
334 334
 								</tr>
335 335
 								<tr valign="top">
336
-									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Default From Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
337
-									<td><?php echo $list_data['default_from_name']; ?></td>
336
+									<td scope="row"><label for="tablecell"><strong><?php  _e( 'Default From Name', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></label></td>
337
+									<td><?php echo $list_data[ 'default_from_name' ]; ?></td>
338 338
 								</tr>
339 339
 							</table>
340 340
 
@@ -344,14 +344,14 @@  discard block
 block discarded – undo
344 344
 						<!-- Merge Field Info -->
345 345
 						<div class="postbox yikes-easy-mc-postbox">
346 346
 
347
-							<h3><?php _e( 'Form Fields' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
347
+							<h3><?php _e( 'Form Fields', 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
348 348
 							<?php
349
-								if( count( $merge_variables ) >= 1 ) {
349
+								if ( count( $merge_variables ) >= 1 ) {
350 350
 									?><ul class="merge-variable-ul"><?php
351 351
 										echo '<li class="interest-group-count">' . sprintf( _n( '%d Field', '%d Fields', intval( count( $merge_variables ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $merge_variables ) ) ) . '</li>';
352
-										foreach( $merge_variables as $merge_variable ) {
352
+										foreach ( $merge_variables as $merge_variable ) {
353 353
 											// new action hook @since 6.0.3.8
354
-											echo '<li class="' . $merge_variable['tag'] . '"><span class="dashicons dashicons-marker"></span>' . $merge_variable['name'] . ' ' . do_action( 'yikes-mailchimp-list-field', $merge_variable ) . '</li>';
354
+											echo '<li class="' . $merge_variable[ 'tag' ] . '"><span class="dashicons dashicons-marker"></span>' . $merge_variable[ 'name' ] . ' ' . do_action( 'yikes-mailchimp-list-field', $merge_variable ) . '</li>';
355 355
 										}
356 356
 									?></ul><?php
357 357
 								}
@@ -368,13 +368,13 @@  discard block
 block discarded – undo
368 368
 						<div class="postbox yikes-easy-mc-postbox">
369 369
 
370 370
 
371
-							<h3><?php _e( 'Interest Groups Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
371
+							<h3><?php _e( 'Interest Groups Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
372 372
 							<?php
373
-								if( isset( $interest_groupings ) && ! isset( $interest_groupings['error'] ) ) {
373
+								if ( isset( $interest_groupings ) && ! isset( $interest_groupings[ 'error' ] ) ) {
374 374
 									?><ul class="interest-group-ul"><?php
375 375
 										echo '<li class="interest-group-count">' . sprintf( _n( '%d Interest Group', '%d Interest Groups', intval( count( $interest_groupings ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $interest_groupings ) ) ) . '</li>';
376
-									foreach( $interest_groupings as $interest_group ) {
377
-										echo '<li><span class="dashicons dashicons-marker"></span>' . $interest_group['name'] . '<span class="interest-group-title"></span><small title="' . $interest_group['groups'][0]['subscribers'] . ' ' . __( "subscribers assigned to this group" , 'yikes-inc-easy-mailchimp-extender' ) . '">(' . $interest_group['groups'][0]['subscribers'] . ')</small></li>';
376
+									foreach ( $interest_groupings as $interest_group ) {
377
+										echo '<li><span class="dashicons dashicons-marker"></span>' . $interest_group[ 'name' ] . '<span class="interest-group-title"></span><small title="' . $interest_group[ 'groups' ][ 0 ][ 'subscribers' ] . ' ' . __( "subscribers assigned to this group", 'yikes-inc-easy-mailchimp-extender' ) . '">(' . $interest_group[ 'groups' ][ 0 ][ 'subscribers' ] . ')</small></li>';
378 378
 									}
379 379
 									?></ul><?php
380 380
 								} else {
@@ -397,17 +397,17 @@  discard block
 block discarded – undo
397 397
 						<div class="postbox yikes-easy-mc-postbox">
398 398
 
399 399
 
400
-							<h3><?php _e( 'Segments Overview' , 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
400
+							<h3><?php _e( 'Segments Overview', 'yikes-inc-easy-mailchimp-extender' ); ?></h3>
401 401
 							<?php
402
-								if( isset( $segments['saved'] ) && count( $segments['saved'] ) >= 1 ) {
402
+								if ( isset( $segments[ 'saved' ] ) && count( $segments[ 'saved' ] ) >= 1 ) {
403 403
 									$i = 1;
404 404
 									?><ul class="segment-ul"><?php
405
-										echo '<li class="segment-group-count">' . sprintf( _n( '%d Segment', '%d Segments', intval( count( $segments['saved'] ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $segments['saved'] ) ) ) . '</li>';
406
-									foreach( $segments['saved'] as $segment ) {
407
-										echo '<li><span class="dashicons dashicons-arrow-right"></span>' . $segment['name'] . ' <small><a href="#" onclick="jQuery(this).parent().parent().next().slideToggle();jQuery(this).toggleText();return false;" data-alt-text="' . __( 'hide conditions' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( "view conditions" , 'yikes-inc-easy-mailchimp-extender' ) . '</a></small></li>';
405
+										echo '<li class="segment-group-count">' . sprintf( _n( '%d Segment', '%d Segments', intval( count( $segments[ 'saved' ] ) ), 'yikes-inc-easy-mailchimp-extender' ), intval( count( $segments[ 'saved' ] ) ) ) . '</li>';
406
+									foreach ( $segments[ 'saved' ] as $segment ) {
407
+										echo '<li><span class="dashicons dashicons-arrow-right"></span>' . $segment[ 'name' ] . ' <small><a href="#" onclick="jQuery(this).parent().parent().next().slideToggle();jQuery(this).toggleText();return false;" data-alt-text="' . __( 'hide conditions', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( "view conditions", 'yikes-inc-easy-mailchimp-extender' ) . '</a></small></li>';
408 408
 										?><div class="conditionals yikes-easy-mc-hidden"><?php
409
-										foreach( $segment['segment_opts']['conditions'] as $condition ) {
410
-											echo '<li><small>' . sprintf( __( 'condition #%s : If %s %s %s', 'yikes-inc-easy-mailchimp-extender' ), intval( $i ), $condition['field'],  $condition['op'], $condition['value'] ) . '</small></li>';
409
+										foreach ( $segment[ 'segment_opts' ][ 'conditions' ] as $condition ) {
410
+											echo '<li><small>' . sprintf( __( 'condition #%s : If %s %s %s', 'yikes-inc-easy-mailchimp-extender' ), intval( $i ), $condition[ 'field' ], $condition[ 'op' ], $condition[ 'value' ] ) . '</small></li>';
411 411
 											$i++;
412 412
 										}
413 413
 										?></div><?php
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
 								}
423 423
 							?>
424 424
 							<!--
425
-								<a class="edit-segments-button" href="#" onclick="return false;" class="button-primary"><?php _e( 'Edit Segments' , 'yikes-inc-easy-mailchimp-extender' ); ?></a>
425
+								<a class="edit-segments-button" href="#" onclick="return false;" class="button-primary"><?php _e( 'Edit Segments', 'yikes-inc-easy-mailchimp-extender' ); ?></a>
426 426
 							-->
427
-							<p class="description edit-segment-description"><?php _e( 'To edit this lists segments, head over to' , 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.MailChimp.com" target="_blank">MailChimp</a></p>
427
+							<p class="description edit-segment-description"><?php _e( 'To edit this lists segments, head over to', 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="http://www.MailChimp.com" target="_blank">MailChimp</a></p>
428 428
 
429 429
 						</div>
430 430
 
Please login to merge, or discard this patch.
admin/partials/upgrade-helpers/upgrade-migrate-options.php 2 patches
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -9,30 +9,30 @@  discard block
 block discarded – undo
9 9
 	*/
10 10
 		
11 11
 	// enqueue the styles for our migration page..
12
-	wp_enqueue_style( 'yikes_mc_migrate_option_styles' , YIKES_MC_URL . 'admin/css/yikes-inc-easy-mailchimp-migrate-option-styles.css' );
13
-	wp_enqueue_style( 'animate-css' , YIKES_MC_URL . 'admin/css/animate.min.css' );
12
+	wp_enqueue_style( 'yikes_mc_migrate_option_styles', YIKES_MC_URL . 'admin/css/yikes-inc-easy-mailchimp-migrate-option-styles.css' );
13
+	wp_enqueue_style( 'animate-css', YIKES_MC_URL . 'admin/css/animate.min.css' );
14 14
 	
15 15
 	// store our old options
16 16
 	$old_plugin_options = get_option( 'ykseme_storage' );
17 17
 	
18 18
 	$global_error_messages = array(
19
-		'success' => __( $old_plugin_options['single-optin-message'] , 'yikes-inc-easy-mailchimp-extender' ),
20
-		'general-error' => __( "Whoops! It looks like something went wrong. Please try again." , 'yikes-inc-easy-mailchimp-extender' ),
21
-		'invalid-email' => __( "Please provide a valid email address." , 'yikes-inc-easy-mailchimp-extender' ),
22
-		'email-exists-error' => __( "The provided email is already subscribed to this list." , 'yikes-inc-easy-mailchimp-extender' )
19
+		'success' => __( $old_plugin_options[ 'single-optin-message' ], 'yikes-inc-easy-mailchimp-extender' ),
20
+		'general-error' => __( "Whoops! It looks like something went wrong. Please try again.", 'yikes-inc-easy-mailchimp-extender' ),
21
+		'invalid-email' => __( "Please provide a valid email address.", 'yikes-inc-easy-mailchimp-extender' ),
22
+		'email-exists-error' => __( "The provided email is already subscribed to this list.", 'yikes-inc-easy-mailchimp-extender' )
23 23
 	);
24 24
 	
25 25
 	// if old options are defined...
26
-	if( $old_plugin_options ) {
26
+	if ( $old_plugin_options ) {
27 27
 		
28 28
 		// Verify the NONCE is valid
29
-		check_admin_referer( 'yikes-mc-migrate-options' , 'migrate_options_nonce' );
29
+		check_admin_referer( 'yikes-mc-migrate-options', 'migrate_options_nonce' );
30 30
 		
31 31
 		?>
32 32
 			
33 33
 		<div class="wrap" style="text-align:center;">
34
-			<h3><?php _e( 'Migrating old plugin options' , 'yikes-inc-easy-mailchimp-extender' ); ?><span class="upgrading-ellipse-one">.</span><span class="upgrading-ellipse-two">.</span><span class="upgrading-ellipse-three">.</h3>
35
-			<p><?php _e( 'please be patient while your options are updated and the process has completed' , 'yikes-inc-easy-mailchimp-extender' ); ?></p>
34
+			<h3><?php _e( 'Migrating old plugin options', 'yikes-inc-easy-mailchimp-extender' ); ?><span class="upgrading-ellipse-one">.</span><span class="upgrading-ellipse-two">.</span><span class="upgrading-ellipse-three">.</h3>
35
+			<p><?php _e( 'please be patient while your options are updated and the process has completed', 'yikes-inc-easy-mailchimp-extender' ); ?></p>
36 36
 			<!-- empty list, populate when options  get updated -->
37 37
 			<ul id="options-updated" class="yikes-easy-mc-hidden">
38 38
 				<hr />
@@ -46,82 +46,82 @@  discard block
 block discarded – undo
46 46
 				
47 47
 					// loop over our old options, and store them in a new option value
48 48
 					$do_not_migrate_options = array(
49
-						'ssl_verify_peer', 'api_validation' , 'widget_yikes_mc_widget' , 'flavor' , 'single-optin-message' , 'double-optin-message' ,
50
-						'mailchimp-optIn-default-list' , 'version' , 'yks-mailchimp-jquery-datepicker' , 'ssl_verify_peer' , 'optIn-checkbox' , 'yks-mailchimp-optin-checkbox-text',
51
-						'yks-mailchimp-required-text' , 'optin'
49
+						'ssl_verify_peer', 'api_validation', 'widget_yikes_mc_widget', 'flavor', 'single-optin-message', 'double-optin-message',
50
+						'mailchimp-optIn-default-list', 'version', 'yks-mailchimp-jquery-datepicker', 'ssl_verify_peer', 'optIn-checkbox', 'yks-mailchimp-optin-checkbox-text',
51
+						'yks-mailchimp-required-text', 'optin'
52 52
 					);
53 53
 							
54
-					foreach( $old_plugin_options as $option_name => $option_value ) {
54
+					foreach ( $old_plugin_options as $option_name => $option_value ) {
55 55
 												
56
-						if( ! in_array( $option_name , $do_not_migrate_options ) ) {
56
+						if ( ! in_array( $option_name, $do_not_migrate_options ) ) {
57 57
 							// ajax request to update our options one by one..
58 58
 							// if its an array, we need to json encode it
59
-							if( is_array( $option_value ) ) {
59
+							if ( is_array( $option_value ) ) {
60 60
 								
61
-								if( $option_name == 'lists' ) {
61
+								if ( $option_name == 'lists' ) {
62 62
 																	
63
-									if( ! empty( $option_value ) ) {
63
+									if ( ! empty( $option_value ) ) {
64 64
 										$settings = 1;
65 65
 										$form_length = count( $option_value );
66
-										foreach( $option_value as $mailchimp_form ) {
66
+										foreach ( $option_value as $mailchimp_form ) {
67 67
 											// update and pass our placeholder value
68 68
 											reset( $mailchimp_form );
69
-											$form_id = $mailchimp_form['id'];
69
+											$form_id = $mailchimp_form[ 'id' ];
70 70
 											
71
-											$fields = $mailchimp_form['fields'];	
71
+											$fields = $mailchimp_form[ 'fields' ];	
72 72
 											reset( $fields );
73 73
 											$first_field_key = key( $fields );
74 74
 											$array_keys = array_keys( $fields );
75 75
 											
76 76
 											$x = 1;								
77 77
 					
78
-											foreach( $array_keys as $parent_key ) {
78
+											foreach ( $array_keys as $parent_key ) {
79 79
 												
80 80
 												// alter the field keys so they show up after an import
81 81
 												$split_parent_key = explode( '-', $parent_key );
82 82
 
83
-												$new_parent_key = ( isset( $split_parent_key[1] ) ) ? strtoupper( $split_parent_key[1] ) : $parent_key;
83
+												$new_parent_key = ( isset( $split_parent_key[ 1 ] ) ) ? strtoupper( $split_parent_key[ 1 ] ) : $parent_key;
84 84
 
85
-												$mailchimp_form['fields'][$new_parent_key] = $mailchimp_form['fields'][$parent_key];
85
+												$mailchimp_form[ 'fields' ][ $new_parent_key ] = $mailchimp_form[ 'fields' ][ $parent_key ];
86 86
 
87
-												unset( $mailchimp_form['fields'][$parent_key] );			
87
+												unset( $mailchimp_form[ 'fields' ][ $parent_key ] );			
88 88
 										
89 89
 												// update our placeholder key to be 'placeholder'
90
-												$mailchimp_form['fields'][$new_parent_key]['placeholder'] = isset( $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] ) ? $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] : '';
90
+												$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] : '';
91 91
 												// update field classes
92
-												$mailchimp_form['fields'][$new_parent_key]['additional-classes'] = isset( $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] ) ? $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] : '';
92
+												$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'additional-classes' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] : '';
93 93
 												// update help field - populate description
94
-												$mailchimp_form['fields'][$new_parent_key]['description'] = isset( $mailchimp_form['fields'][$new_parent_key]['help'] ) ? $mailchimp_form['fields'][$new_parent_key]['help'] : ''; 
94
+												$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'description' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] : ''; 
95 95
 												// remove the old placeholder structure
96
-												unset( $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] );
96
+												unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] );
97 97
 												// remove old custom class structure
98
-												unset( $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] );
98
+												unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] );
99 99
 												// remove old help/description 
100
-												unset( $mailchimp_form['fields'][$new_parent_key]['help'] );
100
+												unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] );
101 101
 																							
102 102
 												// check if choices is set, and encode them
103
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['choices'] ) && ! empty( $mailchimp_form['fields'][$new_parent_key]['choices'] ) ) {
104
-													$mailchimp_form['fields'][$new_parent_key]['choices'] = addslashes( addslashes( json_encode( $mailchimp_form['fields'][$new_parent_key]['choices'] ) ) );
103
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) && ! empty( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) ) {
104
+													$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] = addslashes( addslashes( json_encode( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) ) );
105 105
 												}	
106 106
 
107 107
 												// update 'default' to 'default-choice' for radio/dropdown
108
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'radio', 'dropdown' ) ) ) {
109
-													$mailchimp_form['fields'][$new_parent_key]['default_choice'] = $mailchimp_form['fields'][$new_parent_key]['default'];
110
-													unset( $mailchimp_form['fields'][$new_parent_key]['default'] );
108
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'radio', 'dropdown' ) ) ) {
109
+													$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default_choice' ] = $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default' ];
110
+													unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default' ] );
111 111
 												}
112 112
 												
113 113
 												// update 'date_format' on 'birthday' and 'date' fields
114
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'date', 'birthday' ) ) ) {
115
-													if( $mailchimp_form['fields'][$new_parent_key]['type'] == 'date' ) { // date
116
-														$mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD'; // mailchimp default (can be altered)
114
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'date', 'birthday' ) ) ) {
115
+													if ( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] == 'date' ) { // date
116
+														$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'date_format' ] = 'MM/DD'; // mailchimp default (can be altered)
117 117
 													} else { // birthday 
118
-														$mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD/YYYY'; // mailchimp default (can be altered)
118
+														$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'date_format' ] = 'MM/DD/YYYY'; // mailchimp default (can be altered)
119 119
 													}
120 120
 												}
121 121
 												
122 122
 												// update 'phone_format' on 'phone'
123
-												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'phone' ) ) ) {
124
-													$mailchimp_form['fields'][$new_parent_key]['phone_format'] = 'phone_format '; // phone format
123
+												if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'phone' ) ) ) {
124
+													$mailchimp_form[ 'fields' ][ $new_parent_key ][ 'phone_format' ] = 'phone_format '; // phone format
125 125
 												}
126 126
 												
127 127
 												$x++;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 																								
139 139
 												$.post( ajaxurl, mc_data, function(response) {
140 140
 													jQuery( '#options-updated' ).show();
141
-													jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>'; ?>' + response.form_name + '<?php echo '</strong> ' . __( "successfully imported." , 'yikes-inc-easy-mailchimp-extender' ); ?></li>' );	
141
+													jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>'; ?>' + response.form_name + '<?php echo '</strong> ' . __( "successfully imported.", 'yikes-inc-easy-mailchimp-extender' ); ?></li>' );	
142 142
 													if( response.completed_import ) {
143 143
 														setTimeout( function() {
144 144
 															// finished with the loop...lets let the user know....and then redirect them....
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
 															jQuery( '.upgrading-ellipse-two' ).remove();
148 148
 															jQuery( '.upgrading-ellipse-three' ).remove();
149 149
 															jQuery( '.wrap' ).find( 'h3' ).next().fadeOut();
150
-															jQuery( '#options-updated' ).append( '<li class="animated fadeInDown migration-complete-notification"><em><?php _e( "Migration Complete. Please wait..." , 'yikes-inc-easy-mailchimp-extender' ); ?> </em> <img src="<?php echo esc_url_raw( admin_url( "images/wpspin_light.gif" ) ); ?>" /></li>' );
150
+															jQuery( '#options-updated' ).append( '<li class="animated fadeInDown migration-complete-notification"><em><?php _e( "Migration Complete. Please wait...", 'yikes-inc-easy-mailchimp-extender' ); ?> </em> <img src="<?php echo esc_url_raw( admin_url( "images/wpspin_light.gif" ) ); ?>" /></li>' );
151 151
 															// redirect our user to the main plugin page...
152 152
 															setTimeout( function() {
153 153
 																<?php 
154 154
 																	// migrate options that didnt make it (they were never stored in the 'ykseme_storage' options array)
155
-																	add_option( 'yikes-mc-api-validation' , get_option( 'api_validation' , 'invalid_api_key' ) );
156
-																	add_option( 'yikes-mc-error-messages' , $global_error_messages );
155
+																	add_option( 'yikes-mc-api-validation', get_option( 'api_validation', 'invalid_api_key' ) );
156
+																	add_option( 'yikes-mc-error-messages', $global_error_messages );
157 157
 																	// delete our old options after a successful migration (and some new ones that are no longer needed)
158 158
 																	delete_option( 'widget_yikes_mc_widget' );
159 159
 																	delete_option( 'api_validation' );
@@ -174,26 +174,26 @@  discard block
 block discarded – undo
174 174
 							}
175 175
 							/* Rename our ReCaptcha Options */
176 176
 								/* Public Site Key */
177
-								if( $option_name == 'recaptcha-api-key' ) {
177
+								if ( $option_name == 'recaptcha-api-key' ) {
178 178
 									$option_name = 'recaptcha-site-key';
179 179
 								}
180 180
 								/* Private Key */
181
-								if( $option_name == 'recaptcha-private-api-key'  ) {
181
+								if ( $option_name == 'recaptcha-private-api-key' ) {
182 182
 									$option_name = 'recaptcha-secret-key';
183 183
 								}
184 184
 								/* Change 'recaptcha-setting' to 'recaptcha-status' */
185 185
 								/* Status */
186
-								if( $option_name == 'recaptcha-setting' ) {
186
+								if ( $option_name == 'recaptcha-setting' ) {
187 187
 									$option_name = 'recaptcha-status';
188 188
 								}
189 189
 							/* End  re-name ReCaptcha options */
190 190
 							
191 191
 
192
-							if( is_array( $option_value ) ) {
192
+							if ( is_array( $option_value ) ) {
193 193
 								$option_value = json_encode( $option_value );
194 194
 							}
195 195
 							// do noit migrate the lists option, it's not useful to us
196
-							if( $option_name != 'lists' ) {
196
+							if ( $option_name != 'lists' ) {
197 197
 								?>
198 198
 									var data = {
199 199
 										'action': 'migrate_old_plugin_settings',
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 													
204 204
 									$.post( ajaxurl, data, function(response) {
205 205
 										jQuery( '#options-updated' ).show();
206
-										jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>' . ucwords( str_replace( '_' , ' ' , str_replace( '-' , ' ' , $option_name ) ) ) . '</strong> ' . __( "successfully imported." , 'yikes-inc-easy-mailchimp-extender' ); ?></li>' );	
206
+										jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>' . ucwords( str_replace( '_', ' ', str_replace( '-', ' ', $option_name ) ) ) . '</strong> ' . __( "successfully imported.", 'yikes-inc-easy-mailchimp-extender' ); ?></li>' );	
207 207
 									});
208 208
 								<?php
209 209
 								
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 					}, 2000 );
228 228
 			</script>
229 229
 		<?php
230
-			wp_die( '<strong>' . __( 'Old plugin options do not exist. Redirecting you...' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong>' , 500 );
230
+			wp_die( '<strong>' . __( 'Old plugin options do not exist. Redirecting you...', 'yikes-inc-easy-mailchimp-extender' ) . '</strong>', 500 );
231 231
 		?>
232 232
 		</div>
233 233
 		<?php
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -112,9 +112,11 @@
 block discarded – undo
112 112
 												
113 113
 												// update 'date_format' on 'birthday' and 'date' fields
114 114
 												if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'date', 'birthday' ) ) ) {
115
-													if( $mailchimp_form['fields'][$new_parent_key]['type'] == 'date' ) { // date
115
+													if( $mailchimp_form['fields'][$new_parent_key]['type'] == 'date' ) {
116
+// date
116 117
 														$mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD'; // mailchimp default (can be altered)
117
-													} else { // birthday 
118
+													} else {
119
+// birthday 
118 120
 														$mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD/YYYY'; // mailchimp default (can be altered)
119 121
 													}
120 122
 												}
Please login to merge, or discard this patch.
public/partials/shortcodes/process_form_shortcode.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 	}
163 163
 
164 164
 	/**
165
-	*	If login is required, abort
166
-	*	@since 6.0.3.8
167
-	*/
165
+	 *	If login is required, abort
166
+	 *	@since 6.0.3.8
167
+	 */
168 168
 	if( $form_login_required ) {
169 169
 		if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
170 170
 			ob_start();
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 	}
180 180
 
181 181
 	/**
182
-	*	Check if schedule is set for this form
183
-	*	@since 6.0.3.8
184
-	*/
182
+	 *	Check if schedule is set for this form
183
+	 *	@since 6.0.3.8
184
+	 */
185 185
 	if( $form_schedule_state ) {
186 186
 		// store current date
187 187
 		$current_date = strtotime( current_time( 'm/d/Y g:iA' ) );
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 	}
235 235
 
236 236
 	/**
237
-	*	Check for form inline parameter
238
-	*/
237
+	 *	Check for form inline parameter
238
+	 */
239 239
 	$form_inline = ( isset( $atts['inline'] ) && ( $atts['inline'] == 1 || $atts['inline'] == 'true' ) ) ? true : false;
240 240
 	// recheck from our form options
241 241
 	if( ! $form_inline ) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -943,7 +943,8 @@
 block discarded – undo
943 943
 
944 944
 						}
945 945
 
946
-					} else { // loop over interest groups
946
+					} else {
947
+// loop over interest groups
947 948
 
948 949
 
949 950
 						// store default choice
Please login to merge, or discard this patch.
Spacing   +298 added lines, -298 removed lines patch added patch discarded remove patch
@@ -30,54 +30,54 @@  discard block
 block discarded – undo
30 30
 	$form_submitted = isset( $form_submitted ) ? $form_submitted : 0;
31 31
 
32 32
 	/* If the user hasn't authenticated yet, lets kill off */
33
-	if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) {
34
-		return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key." , 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
33
+	if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) {
34
+		return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key.", 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>';
35 35
 	}
36 36
 
37 37
 	// if the user forgot to specify a form ID, lets kill of and warn them.
38
-	if( ! $atts['form'] ) {
38
+	if ( ! $atts[ 'form' ] ) {
39 39
 		return __( 'Whoops, it looks like you forgot to specify a form to display.', 'yikes-inc-easy-mailchimp-extender' );
40 40
 	}
41 41
 
42 42
 	// store our variables
43
-	$form_id = (int) $atts['form']; // form id (the id of the form in the database)
43
+	$form_id = (int) $atts[ 'form' ]; // form id (the id of the form in the database)
44 44
 	$interface = yikes_easy_mailchimp_extender_get_form_interface();
45 45
 	$form_data = $interface->get_form( $form_id );
46 46
 
47 47
 	// confirm we have some results, or return an error
48 48
 	if ( empty( $form_data ) ) {
49
-		return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form." , 'yikes-inc-easy-mailchimp-extender' );
49
+		return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form.", 'yikes-inc-easy-mailchimp-extender' );
50 50
 	}
51 51
 
52 52
 	/*
53 53
 	*	Check if the user wants to use reCAPTCHA Spam Prevention
54 54
 	*/
55
-	if ( get_option( 'yikes-mc-recaptcha-status' , '' ) == '1' ) {
55
+	if ( get_option( 'yikes-mc-recaptcha-status', '' ) == '1' ) {
56 56
 		// allow users to manually set recaptcha (instead of globally - recaptcha="1"/recaptcha="0" - but still needs to be globally enabled on the settings page)
57
-		if ( $atts['recaptcha'] != '0' ) {
57
+		if ( $atts[ 'recaptcha' ] != '0' ) {
58 58
 			// if either of the Private the Secret key is left blank, we should display an error back to the user
59
-			if( get_option( 'yikes-mc-recaptcha-site-key' , '' ) == '' ) {
60
-				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
59
+			if ( get_option( 'yikes-mc-recaptcha-site-key', '' ) == '' ) {
60
+				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
61 61
 			}
62
-			if( get_option( 'yikes-mc-recaptcha-secret-key' , '' ) == '' ) {
63
-				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
62
+			if ( get_option( 'yikes-mc-recaptcha-secret-key', '' ) == '' ) {
63
+				return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings&section=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>';
64 64
 			}
65 65
 
66
-			if( ! empty( $atts['recaptcha_type'] ) ) {
67
-				echo $atts['recaptcha_type'];
66
+			if ( ! empty( $atts[ 'recaptcha_type' ] ) ) {
67
+				echo $atts[ 'recaptcha_type' ];
68 68
 			}
69 69
 
70 70
 			// Store the site language (to load recaptcha in a specific language)
71 71
 			$locale = get_locale();
72 72
 			$locale_split = explode( '_', $locale );
73 73
 			// Setup reCAPTCHA parameters
74
-			$lang = ( ! empty( $locale_split ) ? $locale_split[0] : $locale );
75
-			$lang = ( ! empty( $atts['recaptcha_lang'] ) ) ? $atts['recaptcha_lang'] : $lang;
76
-			$type = ( ! empty( $atts['recaptcha_type'] ) ) ? strtolower( $atts['recaptcha_type'] ) : 'image'; // setup recaptcha type
77
-			$theme= ( ! empty( $atts['recaptcha_theme'] ) ) ? strtolower( $atts['recaptcha_theme'] ) : 'light'; // setup recaptcha theme
78
-			$size = ( ! empty( $atts['recaptcha_size'] ) ) ? strtolower( $atts['recaptcha_size'] ) : 'normal'; // setup recaptcha size
79
-			$data_callback = ( ! empty( $atts['recaptcha_data_callback'] ) ) ? $atts['recaptcha_data_callback'] : false; // setup recaptcha size
80
-			$expired_callback = ( ! empty( $atts['recaptcha_expired_callback'] ) ) ? $atts['recaptcha_expired_callback'] : false; // setup recaptcha size
74
+			$lang = ( ! empty( $locale_split ) ? $locale_split[ 0 ] : $locale );
75
+			$lang = ( ! empty( $atts[ 'recaptcha_lang' ] ) ) ? $atts[ 'recaptcha_lang' ] : $lang;
76
+			$type = ( ! empty( $atts[ 'recaptcha_type' ] ) ) ? strtolower( $atts[ 'recaptcha_type' ] ) : 'image'; // setup recaptcha type
77
+			$theme = ( ! empty( $atts[ 'recaptcha_theme' ] ) ) ? strtolower( $atts[ 'recaptcha_theme' ] ) : 'light'; // setup recaptcha theme
78
+			$size = ( ! empty( $atts[ 'recaptcha_size' ] ) ) ? strtolower( $atts[ 'recaptcha_size' ] ) : 'normal'; // setup recaptcha size
79
+			$data_callback = ( ! empty( $atts[ 'recaptcha_data_callback' ] ) ) ? $atts[ 'recaptcha_data_callback' ] : false; // setup recaptcha size
80
+			$expired_callback = ( ! empty( $atts[ 'recaptcha_expired_callback' ] ) ) ? $atts[ 'recaptcha_expired_callback' ] : false; // setup recaptcha size
81 81
 			// Pass the shortcode parameters through a filter
82 82
 			$recaptcha_shortcode_params = apply_filters( 'yikes-mailchimp-recaptcha-parameters', array(
83 83
 				'language' => $lang,
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 				'size' => $size,
87 87
 				'success_callback' => $data_callback,
88 88
 				'expired_callback' => $expired_callback,
89
-			), $atts['form'] );
89
+			), $atts[ 'form' ] );
90 90
 			// enqueue Google recaptcha JS
91
-			wp_register_script( 'google-recaptcha-js' , 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params['language'] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ) , 'all' );
91
+			wp_register_script( 'google-recaptcha-js', 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params[ 'language' ] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ), 'all' );
92 92
 			wp_enqueue_script( 'google-recaptcha-js' );
93
-			$recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key' , '' );
94
-			$recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params['theme'] . '" data-type="' . $recaptcha_shortcode_params['type'] . '" data-size="' . $recaptcha_shortcode_params['size'] . '" data-callback="' . $recaptcha_shortcode_params['success_callback'] . '" data-expired-callback="' . $recaptcha_shortcode_params['expired_callback'] . '"></div>';
93
+			$recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key', '' );
94
+			$recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params[ 'theme' ] . '" data-type="' . $recaptcha_shortcode_params[ 'type' ] . '" data-size="' . $recaptcha_shortcode_params[ 'size' ] . '" data-callback="' . $recaptcha_shortcode_params[ 'success_callback' ] . '" data-expired-callback="' . $recaptcha_shortcode_params[ 'expired_callback' ] . '"></div>';
95 95
 			?>
96 96
 			<script type="text/javascript">
97 97
 				/* Script Callback to init. multiple recaptchas on a single page */
@@ -118,36 +118,36 @@  discard block
 block discarded – undo
118 118
 	}
119 119
 
120 120
 	// place our results into a seperate variable for easy looping
121
-	$additional_form_settings = ( isset( $form_data['form_settings'] ) ) ? $form_data['form_settings'] : false;
121
+	$additional_form_settings = ( isset( $form_data[ 'form_settings' ] ) ) ? $form_data[ 'form_settings' ] : false;
122 122
 	// store our options from the additional form settings array
123
-	$form_classes = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-class-names'] : '';
124
-	$inline_form = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-inline-form'] : '';
125
-	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-submit-button-type'] : 'text';
126
-	$submit_button_text = ( $additional_form_settings && $additional_form_settings['yikes-easy-mc-submit-button-text'] != '' ) ? esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-text'] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' );
127
-	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings['yikes-easy-mc-submit-button-image'] ) : '';
128
-	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-classes'] ) : '';
123
+	$form_classes = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-class-names' ] : '';
124
+	$inline_form = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-inline-form' ] : '';
125
+	$submit_button_type = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-submit-button-type' ] : 'text';
126
+	$submit_button_text = ( $additional_form_settings && $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] != '' ) ? esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' );
127
+	$submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings[ 'yikes-easy-mc-submit-button-image' ] ) : '';
128
+	$submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-classes' ] ) : '';
129 129
 
130 130
 	// scheuldes
131
-	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-schedule'] : false;
132
-	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-start'] : '';;
133
-	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-end'] : '';
134
-	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-pending-message'] : '';
135
-	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-expired-message'] : '';
131
+	$form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-schedule' ] : false;
132
+	$form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-start' ] : ''; ;
133
+	$form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-end' ] : '';
134
+	$form_pending_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ] : '';
135
+	$form_expired_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ] : '';
136 136
 
137 137
 	// register required
138
-	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-login-required'] : false;
139
-	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-login-message'] : '';
138
+	$form_login_required = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-login-required' ] : false;
139
+	$form_login_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-login-message' ] : '';
140 140
 
141 141
 	// store number of fields
142
-	$field_count = (int) count( $form_data['fields'] );
142
+	$field_count = (int) count( $form_data[ 'fields' ] );
143 143
 
144 144
 	// confirm we actually have fields, before looping
145
-	if ( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) {
145
+	if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) {
146 146
 		// loop over each field, if it's set to hidden -- subtract it from the field count
147 147
 		// this throws off the layout for inline forms setup below
148
-		foreach ( $form_data['fields'] as $form_field ) {
148
+		foreach ( $form_data[ 'fields' ] as $form_field ) {
149 149
 			if ( isset( $form_field->hide ) && $form_field->hide == 1 ) {
150
-				$field_count --;
150
+				$field_count--;
151 151
 			}
152 152
 		}
153 153
 	}
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 	*	If login is required, abort
157 157
 	*	@since 6.0.3.8
158 158
 	*/
159
-	if( $form_login_required ) {
160
-		if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
159
+	if ( $form_login_required ) {
160
+		if ( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) {
161 161
 			ob_start();
162 162
 				?>
163 163
 					<div class="yikes-mailchimp-login-required yikes-mailchimp-form-<?php echo $form_id; ?>-login-required">
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
 	*	Check if schedule is set for this form
174 174
 	*	@since 6.0.3.8
175 175
 	*/
176
-	if( $form_schedule_state ) {
176
+	if ( $form_schedule_state ) {
177 177
 		// store current date
178 178
 		$current_date = strtotime( current_time( 'm/d/Y g:iA' ) );
179 179
 
180 180
 		// the the current date is less than the form scheduled start date
181
-		if( $current_date < $form_schedule_start ) {
181
+		if ( $current_date < $form_schedule_start ) {
182 182
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_pending_message );
183 183
 			return;
184 184
 			// abort
185 185
 		}
186 186
 
187 187
 		// The current date is past or equal to the end date, aka form has now expired
188
-		if( $current_date >= $form_schedule_end ) {
188
+		if ( $current_date >= $form_schedule_end ) {
189 189
 			echo apply_filters( 'yikes-mailchimp-frontend-content', $form_expired_message );
190 190
 			return;
191 191
 			// abort
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 
195 195
 	// setup the submit button text
196 196
 	// shortcode parameter takes precedence over option
197
-	$submit = ( ! empty( $atts['submit'] ) ) ? $atts['submit'] : $submit_button_text;
197
+	$submit = ( ! empty( $atts[ 'submit' ] ) ) ? $atts[ 'submit' ] : $submit_button_text;
198 198
 
199 199
 	// used in yikes-mailchimp-redirect-url filter
200 200
 	global $post;
201 201
 	$page_data = $post;
202 202
 
203 203
 	// Remove the post_password from this for security
204
-	if( isset( $page_data->post_password ) ) {
204
+	if ( isset( $page_data->post_password ) ) {
205 205
 		unset( $page_data->post_password );
206 206
 	}
207 207
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	*	to exclude styles from loading, add `define( 'YIKES_MAILCHIMP_EXCLUDE_STYLES', true );` to functions.php
216 216
 	*	@since 6.0.3.8
217 217
 	*/
218
-	if( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
218
+	if ( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) {
219 219
 		// enqueue the form styles
220 220
 		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 ) );
221 221
 	}
@@ -223,19 +223,19 @@  discard block
 block discarded – undo
223 223
 	/**
224 224
 	*	Check for form inline parameter
225 225
 	*/
226
-	$form_inline = ( $atts['inline'] == 1 || $atts['inline'] == 'true' );
226
+	$form_inline = ( $atts[ 'inline' ] == 1 || $atts[ 'inline' ] == 'true' );
227 227
 	// recheck from our form options
228 228
 	if ( ! $form_inline ) {
229
-		$form_inline = (bool) $additional_form_settings['yikes-easy-mc-inline-form'];
229
+		$form_inline = (bool) $additional_form_settings[ 'yikes-easy-mc-inline-form' ];
230 230
 	}
231 231
 
232 232
 	/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
233
-	if( is_user_logged_in() ) {
234
-		if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
233
+	if ( is_user_logged_in() ) {
234
+		if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
235 235
 			$edit_form_link = '<span class="edit-link">';
236
-			$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts['form'] ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
236
+			$edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts[ 'form' ] ) ) . '" title="' . __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data[ 'form_name' ] ) . '">' . __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ) . '</a>';
237 237
 			$edit_form_link .= '</span>';
238
-			$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts['form'], ucwords( $form_data['form_name'] ) );
238
+			$edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts[ 'form' ], ucwords( $form_data[ 'form_name' ] ) );
239 239
 		} else {
240 240
 			$edit_form_link = '';
241 241
 		}
@@ -245,16 +245,16 @@  discard block
 block discarded – undo
245 245
 	// or else MailChimp throws errors at you
246 246
 	// extract our array keys
247 247
 	// @todo Remove array_keys() and in_array() usage here.
248
-	if( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) {
249
-		$array_keys = array_keys( $form_data['fields'] );
248
+	if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) {
249
+		$array_keys = array_keys( $form_data[ 'fields' ] );
250 250
 		// check for EMAIL in that array
251
-		if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) {
252
-			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>';
251
+		if ( ! in_array( 'EMAIL', $array_keys ) && ! in_array( 'email', $array_keys ) ) {
252
+			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>';
253 253
 		}
254 254
 	} else {
255
-		$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
256
-		if( is_user_logged_in() ) {
257
-			if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
255
+		$error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>';
256
+		if ( is_user_logged_in() ) {
257
+			if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
258 258
 				return $error . $edit_form_link;
259 259
 			}
260 260
 		} else {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 		}
263 263
 	}
264 264
 
265
-	if( $form_inline ) {
265
+	if ( $form_inline ) {
266 266
 		$field_width = (float) ( 100 / $field_count );
267 267
 		$submit_button_width = (float) ( 20 / $field_count );
268 268
 		/*
@@ -299,17 +299,17 @@  discard block
 block discarded – undo
299 299
 		*	Set a custom title using custom_title="lorem ipsum" parameter in the shortcode
300 300
 		*	- This takes precedence over the title set
301 301
 		*/
302
-		if ( $atts['title'] ) {
303
-			if ( ! empty( $atts['custom_title'] ) ) {
302
+		if ( $atts[ 'title' ] ) {
303
+			if ( ! empty( $atts[ 'custom_title' ] ) ) {
304 304
 				/**
305 305
 				 * Filter the title that is displayed through the shortcode.
306 306
 				 *
307 307
 				 * @param string $title   The title to display.
308 308
 				 * @param int    $form_id The form ID.
309 309
 				 */
310
-				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts['custom_title'] ), $form_id );
310
+				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts[ 'custom_title' ] ), $form_id );
311 311
 			} else {
312
-				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data['form_name'] ), $form_id );
312
+				$title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data[ 'form_name' ] ), $form_id );
313 313
 			}
314 314
 
315 315
 			echo sprintf( '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-%1$s">%2$s</h3>', $form_id, $title );
@@ -319,26 +319,26 @@  discard block
 block discarded – undo
319 319
 		*	Allow users to specify a custom description for this form, no html support
320 320
 		*	@since 6.0.3.8
321 321
 		*/
322
-		if ( $atts['description'] ) {
323
-			if ( ! empty( $atts['custom_description'] ) ) {
322
+		if ( $atts[ 'description' ] ) {
323
+			if ( ! empty( $atts[ 'custom_description' ] ) ) {
324 324
 				/**
325 325
 				 * Filter the description that is displayed through the shortcode.
326 326
 				 *
327 327
 				 * @param string $title   The title to display.
328 328
 				 * @param int    $form_id The form ID.
329 329
 				 */
330
-				$description = apply_filters( 'yikes-mailchimp-form-description', $atts['custom_description'], $form_id );
330
+				$description = apply_filters( 'yikes-mailchimp-form-description', $atts[ 'custom_description' ], $form_id );
331 331
 			} else {
332
-				$description = apply_filters( 'yikes-mailchimp-form-description', $form_data['form_description'], $form_id );
332
+				$description = apply_filters( 'yikes-mailchimp-form-description', $form_data[ 'form_description' ], $form_id );
333 333
 			}
334 334
 
335 335
 			echo sprintf( '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-%1$s">%2$s</section>', $form_id, $description );
336 336
 		}
337 337
 
338 338
 		// Check for AJAX
339
-		if( ( ! empty( $atts['ajax'] ) && $atts['ajax'] == 1 ) || $form_data['submission_settings']['ajax'] == 1 ) {
339
+		if ( ( ! empty( $atts[ 'ajax' ] ) && $atts[ 'ajax' ] == 1 ) || $form_data[ 'submission_settings' ][ 'ajax' ] == 1 ) {
340 340
 			// enqueue our ajax script
341
-			wp_enqueue_script( 'yikes-easy-mc-ajax' , YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js' , array( 'jquery' ) , 'yikes-inc-easy-mailchimp-extender', false );
341
+			wp_enqueue_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 342
 			wp_localize_script( 'yikes-easy-mc-ajax', 'yikes_mailchimp_ajax', array(
343 343
 				'ajax_url'                      => esc_url( admin_url( 'admin-ajax.php' ) ),
344 344
 				'page_data'                     => $page_data,
@@ -357,67 +357,67 @@  discard block
 block discarded – undo
357 357
 
358 358
 		// render the form!
359 359
 		?>
360
-			<form id="<?php echo sanitize_title( $form_data['form_name'] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline )  { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if( !empty( $_POST ) && $form_submitted == 1 && $form_data['submission_settings']['hide_form_post_signup'] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>">
360
+			<form id="<?php echo sanitize_title( $form_data[ 'form_name' ] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if ( ! empty( $_POST ) && $form_submitted == 1 && $form_data[ 'submission_settings' ][ 'hide_form_post_signup' ] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>">
361 361
 
362 362
 				<?php
363 363
 				// Set a default constant for hidden fields
364 364
 				$hidden_label_count = 0;
365 365
 
366 366
 				// Loop over our form fields
367
-				foreach( $form_data['fields'] as $field ) {
367
+				foreach ( $form_data[ 'fields' ] as $field ) {
368 368
 						// input array
369 369
 						$field_array = array();
370 370
 						// label array
371 371
 						$label_array = array();
372 372
 						// label classes array
373 373
 						$label_class_array = array();
374
-						if( $field['additional-classes'] != '' ) {
374
+						if ( $field[ 'additional-classes' ] != '' ) {
375 375
 							// split custom classes at spaces
376
-							$custom_classes = explode( ' ' , $field['additional-classes'] );
376
+							$custom_classes = explode( ' ', $field[ 'additional-classes' ] );
377 377
 							// check our custom class array for field-left/field-right
378 378
 							// if it's set we need to assign it to our label and remove it from the field classes
379 379
 							 // input half left
380
-							if( in_array( 'field-left-half' , $custom_classes ) ) {
380
+							if ( in_array( 'field-left-half', $custom_classes ) ) {
381 381
 								// $label_array['class'] = 'class="field-left-half"';
382
-								$label_class_array[] = 'field-left-half';
383
-								$key = array_search( 'field-left-half' , $custom_classes );
384
-								unset( $custom_classes[$key] );
382
+								$label_class_array[ ] = 'field-left-half';
383
+								$key = array_search( 'field-left-half', $custom_classes );
384
+								unset( $custom_classes[ $key ] );
385 385
 							} // input half right
386
-							if( in_array( 'field-right-half' , $custom_classes ) ) {
386
+							if ( in_array( 'field-right-half', $custom_classes ) ) {
387 387
 								// $label_array['class'] = 'class="field-right-half"';
388
-								$label_class_array[] = 'field-right-half';
389
-								$key = array_search( 'field-right-half' , $custom_classes );
390
-								unset( $custom_classes[$key] );
388
+								$label_class_array[ ] = 'field-right-half';
389
+								$key = array_search( 'field-right-half', $custom_classes );
390
+								unset( $custom_classes[ $key ] );
391 391
 							} // input thirds (1/3 width, floated left)
392
-							if( in_array( 'field-third' , $custom_classes ) ) {
392
+							if ( in_array( 'field-third', $custom_classes ) ) {
393 393
 								// $label_array['class'] = 'class="field-third"';
394
-								$label_class_array[] = 'field-third';
395
-								$key = array_search( 'field-third' , $custom_classes );
396
-								unset( $custom_classes[$key] );
394
+								$label_class_array[ ] = 'field-third';
395
+								$key = array_search( 'field-third', $custom_classes );
396
+								unset( $custom_classes[ $key ] );
397 397
 							} // 2 column radio
398
-							if( in_array( 'option-2-col' , $custom_classes ) ) {
398
+							if ( in_array( 'option-2-col', $custom_classes ) ) {
399 399
 								// $label_array['class'] = 'class="option-2-col"';
400
-								$label_class_array[] = 'option-2-col';
401
-								$key = array_search( 'option-2-col' , $custom_classes );
402
-								unset( $custom_classes[$key] );
400
+								$label_class_array[ ] = 'option-2-col';
401
+								$key = array_search( 'option-2-col', $custom_classes );
402
+								unset( $custom_classes[ $key ] );
403 403
 							} // 3 column radio
404
-							if( in_array( 'option-3-col' , $custom_classes ) ) {
404
+							if ( in_array( 'option-3-col', $custom_classes ) ) {
405 405
 								// $label_array['class'] = 'class="option-3-col"';
406
-								$label_class_array[] = 'option-3-col';
407
-								$key = array_search( 'option-3-col' , $custom_classes );
408
-								unset( $custom_classes[$key] );
406
+								$label_class_array[ ] = 'option-3-col';
407
+								$key = array_search( 'option-3-col', $custom_classes );
408
+								unset( $custom_classes[ $key ] );
409 409
 							} // 4 column radio
410
-							if( in_array( 'option-4-col' , $custom_classes ) ) {
410
+							if ( in_array( 'option-4-col', $custom_classes ) ) {
411 411
 								// $label_array['class'] = 'class="option-4-col"';
412
-								$label_class_array[] = 'option-4-col';
413
-								$key = array_search( 'option-4-col' , $custom_classes );
414
-								unset( $custom_classes[$key] );
412
+								$label_class_array[ ] = 'option-4-col';
413
+								$key = array_search( 'option-4-col', $custom_classes );
414
+								unset( $custom_classes[ $key ] );
415 415
 							} // inline radio & checkboxes etc
416
-							if( in_array( 'option-inline' , $custom_classes ) ) {
416
+							if ( in_array( 'option-inline', $custom_classes ) ) {
417 417
 								// $label_array['class'] = 'class="option-inline"';
418
-								$label_class_array[] = 'option-inline';
419
-								$key = array_search( 'option-inline' , $custom_classes );
420
-								unset( $custom_classes[$key] );
418
+								$label_class_array[ ] = 'option-inline';
419
+								$key = array_search( 'option-inline', $custom_classes );
420
+								unset( $custom_classes[ $key ] );
421 421
 							}
422 422
 						} else {
423 423
 							$custom_classes = array();
@@ -425,68 +425,68 @@  discard block
 block discarded – undo
425 425
 
426 426
 						// if the form is set to inline, add the inline class to our labels
427 427
 						// since @6.0.3.8
428
-						if( $form_inline ) {
429
-							$label_class_array[] = 'label-inline';
428
+						if ( $form_inline ) {
429
+							$label_class_array[ ] = 'label-inline';
430 430
 						}
431 431
 
432
-						if( isset( $field['hide-label'] ) ) {
433
-							if( absint( $field['hide-label'] ) === 1 ) {
432
+						if ( isset( $field[ 'hide-label' ] ) ) {
433
+							if ( absint( $field[ 'hide-label' ] ) === 1 ) {
434 434
 								$hidden_label_count++;
435
-								$custom_classes[] = 'field-no-label';
435
+								$custom_classes[ ] = 'field-no-label';
436 436
 							}
437 437
 						}
438 438
 
439 439
 					/* Store tag variable based on field type */
440
-					if( isset( $field['merge'] ) ) {
440
+					if ( isset( $field[ 'merge' ] ) ) {
441 441
 						$tag = 'merge';
442 442
 					} else {
443 443
 						$tag = 'group_id';
444 444
 					}
445 445
 
446 446
 					// build up our array
447
-					$field_array['id'] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[$tag] ) . '" ';
448
-					$field_array['name'] = 'name="' . esc_attr( $field[$tag] ) . '" ';
449
-					$field_array['placeholder'] = isset( $field['placeholder'] ) ? 'placeholder="' . esc_attr( stripslashes( $field['placeholder'] ) ) . '" ' : '';
450
-					$field_array['classes'] = 'class="yikes-easy-mc-'.$field['type'] . ' ' .  esc_attr( trim( implode( ' ' , $custom_classes ) ) ) . '" ';
447
+					$field_array[ 'id' ] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[ $tag ] ) . '" ';
448
+					$field_array[ 'name' ] = 'name="' . esc_attr( $field[ $tag ] ) . '" ';
449
+					$field_array[ 'placeholder' ] = isset( $field[ 'placeholder' ] ) ? 'placeholder="' . esc_attr( stripslashes( $field[ 'placeholder' ] ) ) . '" ' : '';
450
+					$field_array[ 'classes' ] = 'class="yikes-easy-mc-' . $field[ 'type' ] . ' ' . esc_attr( trim( implode( ' ', $custom_classes ) ) ) . '" ';
451 451
 
452 452
 					// email must always be required and visible
453
-					if( $field['type'] == 'email' ) {
454
-						$field_array['required'] = 'required="required"';
455
-						$label_array['visible'] = '';
453
+					if ( $field[ 'type' ] == 'email' ) {
454
+						$field_array[ 'required' ] = 'required="required"';
455
+						$label_array[ 'visible' ] = '';
456 456
 						// $label_array['required'] = 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"';
457
-						$label_class_array[] = $field['merge'] . '-label';
458
-						$label_class_array[] = 'yikes-mailchimp-field-required';
457
+						$label_class_array[ ] = $field[ 'merge' ] . '-label';
458
+						$label_class_array[ ] = 'yikes-mailchimp-field-required';
459 459
 					} else {
460
-						if( $tag == 'merge' ) {
461
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
462
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
460
+						if ( $tag == 'merge' ) {
461
+							$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
462
+							$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
463 463
 							// $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['merge'] . '-label"';
464
-							$label_class_array[] = isset( $field['require'] ) ? $field['merge'] . '-label yikes-mailchimp-field-required' : $field['merge'] . '-label';
464
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'merge' ] . '-label yikes-mailchimp-field-required' : $field[ 'merge' ] . '-label';
465 465
 						} else {
466
-							$field_array['required'] = isset( $field['require'] ) ? 'required="required"' : '';
467
-							$label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : '';
466
+							$field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : '';
467
+							$label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : '';
468 468
 							// $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['group_id'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['group_id'] . '-label"';
469
-							$label_class_array[] = isset( $field['require'] ) ? $field['group_id'] . '-label yikes-mailchimp-field-required' : $field['group_id'] . '-label';
469
+							$label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'group_id' ] . '-label yikes-mailchimp-field-required' : $field[ 'group_id' ] . '-label';
470 470
 						}
471 471
 					}
472 472
 
473 473
 					// if both hide label and hide field are checked, we gotta hide the field!
474
-					if( isset( $field['hide' ] ) && $field['hide'] == 1 ) {
475
-						if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) {
476
-							$field_array['visible'] = 'style="display:none;"';
474
+					if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) {
475
+						if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) {
476
+							$field_array[ 'visible' ] = 'style="display:none;"';
477 477
 						}
478 478
 					}
479 479
 
480
-					$label_array['classes'] = 'class="' . implode( ' ', $label_class_array ) . '"';
480
+					$label_array[ 'classes' ] = 'class="' . implode( ' ', $label_class_array ) . '"';
481 481
 
482 482
 					// filter the field array data
483 483
 					$field_array = apply_filters( 'yikes-mailchimp-field-data', $field_array, $field, $form_id );
484 484
 
485 485
 					/* Loop Over Standard Fields (aka merge variables) */
486
-					if( isset( $field['merge'] ) ) {
486
+					if ( isset( $field[ 'merge' ] ) ) {
487 487
 
488 488
 						// loop over our fields by Type
489
-						switch ( $field['type'] ) {
489
+						switch ( $field[ 'type' ] ) {
490 490
 
491 491
 							default:
492 492
 							case 'email':
@@ -494,25 +494,25 @@  discard block
 block discarded – undo
494 494
 							case 'number':
495 495
 
496 496
 								// pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type)
497
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
497
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
498 498
 								$default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value );
499 499
 									?>
500
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
500
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
501 501
 
502 502
 										<!-- dictate label visibility -->
503
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
504
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
505
-												<?php if( ! isset( $field['hide-label'] ) ) { echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ), $form_id ); } ?>
503
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
504
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
505
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ), $form_id ); } ?>
506 506
 											</span>
507 507
 										<?php } ?>
508 508
 
509
-										<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 ); } ?>">
509
+										<input <?php echo implode( ' ', $field_array ); if ( $field[ 'type' ] != 'email' && $field[ 'type' ] != 'number' ) { ?> type="text" <?php } else if ( $field[ 'type' ] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
510 510
 
511 511
 										<!-- description -->
512
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
512
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
513 513
 											<p class="form-field-description">
514 514
 												<small>
515
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
515
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
516 516
 												</small>
517 517
 											</p>
518 518
 										<?php } ?>
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 
525 525
 							case 'url':
526 526
 							case 'imageurl':
527
-								$default_value = ( isset( $field['default'] ) ) ? $field['default'] : '';
527
+								$default_value = ( isset( $field[ 'default' ] ) ) ? $field[ 'default' ] : '';
528 528
 									?>
529 529
 
530 530
 									<script type="text/javascript">
@@ -536,22 +536,22 @@  discard block
 block discarded – undo
536 536
 										}
537 537
 									</script>
538 538
 
539
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
539
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
540 540
 
541 541
 										<!-- dictate label visibility -->
542
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
543
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
544
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
542
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
543
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
544
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
545 545
 											</span>
546 546
 										<?php } ?>
547 547
 
548
-										<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;">
548
+										<input <?php echo implode( ' ', $field_array ); ?> type="url" <?php if ( $field[ 'type' ] == 'url' ) { ?> title="<?php _e( 'Please enter a valid URL to the website.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } else { ?> title="<?php _e( 'Please enter a valid URL to the image.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>" onblur="properlyFormatURLField(this);return false;">
549 549
 
550 550
 										<!-- description -->
551
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
551
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
552 552
 											<p class="form-field-description">
553 553
 												<small>
554
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
554
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
555 555
 												</small>
556 556
 											</p>
557 557
 										<?php } ?>
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 							break;
563 563
 
564 564
 							case 'phone':
565
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
566
-								$phone_format = $field['phone_format'];
565
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
566
+								$phone_format = $field[ 'phone_format' ];
567 567
 								?>
568 568
 									<script type="text/javascript">
569 569
 										/* Replace incorrect values and format it correctly for MailChimp API */
@@ -576,22 +576,22 @@  discard block
 block discarded – undo
576 576
 										}
577 577
 									</script>
578 578
 
579
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
579
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
580 580
 
581 581
 										<!-- dictate label visibility -->
582
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
583
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
584
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
582
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
583
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
584
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
585 585
 											</span>
586 586
 										<?php } ?>
587 587
 
588
-										<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 ); } ?>">
588
+										<input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $phone_format != 'US' ) { ?>  title="<?php _e( 'International Phone Number', 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern', '[0-9,-]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####', 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern', '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" onblur="formatUSPhoneNumber(this);"<?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
589 589
 
590 590
 										<!-- description -->
591
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
591
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
592 592
 											<p class="form-field-description">
593 593
 												<small>
594
-													<?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field['merge'] ) . '-description', stripslashes( $field['description'] ), $form_id ); ?>
594
+													<?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field[ 'merge' ] ) . '-description', stripslashes( $field[ 'description' ] ), $form_id ); ?>
595 595
 												</small>
596 596
 											</p>
597 597
 										<?php } ?>
@@ -601,25 +601,25 @@  discard block
 block discarded – undo
601 601
 							break;
602 602
 
603 603
 							case 'zip':
604
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
604
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
605 605
 
606 606
 									?>
607
-									<label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>>
607
+									<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>>
608 608
 
609 609
 									<!-- dictate label visibility -->
610
-									<?php if( ! isset( $field['hide-label'] ) ) { ?>
611
-										<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
612
-											<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
610
+									<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
611
+										<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
612
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
613 613
 										</span>
614 614
 									<?php } ?>
615 615
 
616
-									<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 ); } ?>">
616
+									<input <?php echo implode( ' ', $field_array ); ?> type="text" pattern="\d{5,5}(-\d{4,4})?" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
617 617
 
618 618
 									<!-- description -->
619
-									<?php if( isset( $field['description'] ) ) { ?>
619
+									<?php if ( isset( $field[ 'description' ] ) ) { ?>
620 620
 										<p class="form-field-description">
621 621
 											<small>
622
-												<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?>
622
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?>
623 623
 											</small>
624 624
 										</p>
625 625
 									<?php } ?>
@@ -631,28 +631,28 @@  discard block
 block discarded – undo
631 631
 
632 632
 							case 'address':
633 633
 								// required fields
634
-								$required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' );
634
+								$required_fields = array( 'addr1' => 'address', 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip', 'country' => 'country' );
635 635
 
636 636
 								// setup the default country value
637 637
 								$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
638 638
 
639 639
 								// store number for looping
640 640
 								$x = 1;
641
-								foreach( $required_fields as $type => $label ) {
641
+								foreach ( $required_fields as $type => $label ) {
642 642
 
643 643
 									// set the field names for the addrress fields
644
-									$field_array['name'] = 'name="'.$field[$tag].'['.$type.']'.'"';
644
+									$field_array[ 'name' ] = 'name="' . $field[ $tag ] . '[' . $type . ']' . '"';
645 645
 
646 646
 									// reset the label classes for left-half/right-half for addresses
647
-									if( isset( $label_array['class'] ) ) {
647
+									if ( isset( $label_array[ 'class' ] ) ) {
648 648
 										if ( $x % 2 == 0 ) {
649
-											$label_array['class'] = str_replace( 'field-left-half', 'field-right-half', $label_array['class'] );
649
+											$label_array[ 'class' ] = str_replace( 'field-left-half', 'field-right-half', $label_array[ 'class' ] );
650 650
 										} else {
651
-											$label_array['class'] = str_replace( 'field-right-half', 'field-left-half', $label_array['class'] );
651
+											$label_array[ 'class' ] = str_replace( 'field-right-half', 'field-left-half', $label_array[ 'class' ] );
652 652
 										}
653 653
 									}
654 654
 
655
-									switch( $type ) {
655
+									switch ( $type ) {
656 656
 
657 657
 										default:
658 658
 										case 'addr1':
@@ -661,17 +661,17 @@  discard block
 block discarded – undo
661 661
 
662 662
 
663 663
 											?>
664
-											<label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
664
+											<label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>>
665 665
 
666 666
 												<!-- dictate label visibility -->
667
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
668
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
669
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
667
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
668
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
669
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
670 670
 													</span>
671 671
 												<?php } ?>
672 672
 
673 673
 
674
-												<input <?php echo implode( ' ' , $field_array ); ?> type="text"  value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } ?>">
674
+												<input <?php echo implode( ' ', $field_array ); ?> type="text"  value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } ?>">
675 675
 
676 676
 											</label>
677 677
 											<?php
@@ -681,16 +681,16 @@  discard block
 block discarded – undo
681 681
 										case 'state':
682 682
 
683 683
 											?>
684
-											<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 } ?>>
684
+											<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="state-dropdown"<?php if ( ! in_array( $default_country, array( 'US' ) ) ) { ?> style="display: none;"<?php } ?>>
685 685
 
686 686
 												<!-- dictate label visibility -->
687
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
688
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
689
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
687
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
688
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
689
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
690 690
 													</span>
691 691
 												<?php } ?>
692 692
 
693
-												<select <?php echo implode( ' ' , $field_array ); ?>>
693
+												<select <?php echo implode( ' ', $field_array ); ?>>
694 694
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-dropdown.php' ); ?>
695 695
 												</select>
696 696
 
@@ -703,15 +703,15 @@  discard block
 block discarded – undo
703 703
 										case 'zip':
704 704
 
705 705
 											?>
706
-											<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 } ?>>
706
+											<label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="zip-input"<?php if ( ! in_array( $default_country, array( 'US', 'GB' ) ) ) { ?> style="display: none;"<?php } ?>>
707 707
 
708
-												<?php if( ! isset( $field['hide-label'] ) ) { ?>
709
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
710
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
708
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
709
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
710
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
711 711
 													</span>
712 712
 												<?php } ?>
713 713
 
714
-												<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 ); } ?>">
714
+												<input <?php echo implode( ' ', $field_array ); ?> type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?' ); ?>" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
715 715
 
716 716
 											</label>
717 717
 											<?php
@@ -749,16 +749,16 @@  discard block
 block discarded – undo
749 749
 												$default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' );
750 750
 											?>
751 751
 
752
-											<label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>>
752
+											<label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>>
753 753
 
754 754
 												<!-- dictate label visibility -->
755
-												<?php if( !isset( $field['hide-label'] ) ) { ?>
756
-													<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
757
-														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?>
755
+												<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
756
+													<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
757
+														<?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?>
758 758
 													</span>
759 759
 												<?php } ?>
760 760
 
761
-												<select <?php echo implode( ' ' , $field_array ); ?> onchange="checkCountry(this);return false;">
761
+												<select <?php echo implode( ' ', $field_array ); ?> onchange="checkCountry(this);return false;">
762 762
 													<?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/country-dropdown.php' ); ?>
763 763
 												</select>
764 764
 											</label>
@@ -769,10 +769,10 @@  discard block
 block discarded – undo
769 769
 								}
770 770
 
771 771
 								// description
772
-								if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
772
+								if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
773 773
 									<p class="form-field-description">
774 774
 										<small>
775
-											<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
775
+											<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
776 776
 										</small>
777 777
 									</p>
778 778
 									<?php }
@@ -782,19 +782,19 @@  discard block
 block discarded – undo
782 782
 							case 'birthday':
783 783
 
784 784
 								// bootstrap datepicker requirements
785
-								wp_enqueue_script( 'bootstrap-hover-dropdown' , YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js' , array( 'jquery' ) );
786
-								wp_enqueue_script( 'bootstrap-datepicker-script' , YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js' , array( 'jquery' , 'bootstrap-hover-dropdown' ) );
787
-								wp_enqueue_style( 'bootstrap-datepicker-styles' , YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
788
-								wp_enqueue_style( 'override-datepicker-styles' , YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css' , array( 'bootstrap-datepicker-styles' ) );
785
+								wp_enqueue_script( 'bootstrap-hover-dropdown', YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js', array( 'jquery' ) );
786
+								wp_enqueue_script( 'bootstrap-datepicker-script', YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js', array( 'jquery', 'bootstrap-hover-dropdown' ) );
787
+								wp_enqueue_style( 'bootstrap-datepicker-styles', YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' );
788
+								wp_enqueue_style( 'override-datepicker-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css', array( 'bootstrap-datepicker-styles' ) );
789 789
 
790
-								switch ( $field['type'] ) {
790
+								switch ( $field[ 'type' ] ) {
791 791
 									default:
792 792
 									case 'date':
793
-										$date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd/yy';
793
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd/yy';
794 794
 										break;
795 795
 
796 796
 									case 'birthday':
797
-										$date_format = ( isset( $field['date_format'] ) ) ? strtolower( $field['date_format'] ) : 'mm/dd';
797
+										$date_format = ( isset( $field[ 'date_format' ] ) ) ? strtolower( $field[ 'date_format' ] ) : 'mm/dd';
798 798
 										break;
799 799
 								}
800 800
 								// initialize the datepicker
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 											padding: .85em .5em !important;
806 806
 										}
807 807
 										<?php
808
-											if( wp_is_mobile() ) {
808
+											if ( wp_is_mobile() ) {
809 809
 												?>
810 810
 												.datepicker-dropdown {
811 811
 													margin-top: 0px;
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 											$day_names = array_values( $wp_locale->weekday );
822 822
 											$day_names_short = array_values( $wp_locale->weekday_abbrev );
823 823
 											$day_names_min = array_values( $wp_locale->weekday_initial );
824
-											$date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field['type'] );
824
+											$date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field[ 'type' ] );
825 825
 											$first_day = get_option( 'start_of_week' );
826 826
 											$isRTL = $wp_locale->is_rtl();
827 827
 										?>
@@ -842,10 +842,10 @@  discard block
 block discarded – undo
842 842
 												numberOfMonths: 1,
843 843
 												today: '<?php _e( 'Today', 'yikes-inc-easy-mailchimp-extender' ); ?>'
844 844
 											};
845
-											jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').datepicker().on( 'show', function( e ) {
846
-												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'height' );
845
+											jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').datepicker().on( 'show', function( e ) {
846
+												var date_picker_height = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'height' );
847 847
 												date_picker_height = parseInt( date_picker_height.replace( 'px', '' ) ) + parseInt( 15 ) + 'px';
848
-												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'width' ).replace( 'px', '' );
848
+												var date_picker_width = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'width' ).replace( 'px', '' );
849 849
 												if( date_picker_width > 500 ) {
850 850
 													date_picker_width = 500;
851 851
 												}
@@ -855,27 +855,27 @@  discard block
 block discarded – undo
855 855
 									</script>
856 856
 								<?php
857 857
 
858
-								$default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' );
858
+								$default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' );
859 859
 								// store empty number for looping
860 860
 								$x = 0;
861 861
 
862 862
 								?>
863
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
863
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
864 864
 
865 865
 										<!-- dictate label visibility -->
866
-										<?php if( !isset( $field['hide-label'] ) ) { ?>
867
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
868
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
866
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
867
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
868
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
869 869
 											</span>
870 870
 										<?php } ?>
871 871
 
872
-										<input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $field['type'] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>">
872
+										<input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $field[ 'type' ] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>">
873 873
 
874 874
 										<!-- description -->
875
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
875
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
876 876
 											<p class="form-field-description">
877 877
 												<small>
878
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
878
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
879 879
 												</small>
880 880
 											</p>
881 881
 										<?php } ?>
@@ -886,36 +886,36 @@  discard block
 block discarded – undo
886 886
 							break;
887 887
 
888 888
 							case 'dropdown':
889
-								$default_value = $field['default_choice'];
889
+								$default_value = $field[ 'default_choice' ];
890 890
 								// store empty number for looping
891 891
 								$x = 0;
892 892
 								// hidden labels
893 893
 
894 894
 									?>
895
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
895
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
896 896
 										<!-- dictate label visibility -->
897
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
898
-											<span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>">
899
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
897
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
898
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>">
899
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
900 900
 											</span>
901 901
 										<?php } ?>
902 902
 
903
-										<select <?php echo implode( ' ' , $field_array ); ?>>
903
+										<select <?php echo implode( ' ', $field_array ); ?>>
904 904
 											<?php
905 905
 												// decode for looping
906
-												$choices = json_decode( $field['choices'], true );
907
-												foreach( $choices as $choice ) {
908
-													?><option value="<?php echo $choice; ?>" <?php selected( $default_value , $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
906
+												$choices = json_decode( $field[ 'choices' ], true );
907
+												foreach ( $choices as $choice ) {
908
+													?><option value="<?php echo $choice; ?>" <?php selected( $default_value, $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php
909 909
 													$x++;
910 910
 												}
911 911
 											?>
912 912
 										</select>
913 913
 
914 914
 										<!-- description -->
915
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
915
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
916 916
 											<p class="form-field-description">
917 917
 												<small>
918
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
918
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
919 919
 												</small>
920 920
 											</p>
921 921
 										<?php } ?>
@@ -929,13 +929,13 @@  discard block
 block discarded – undo
929 929
 							case 'radio':
930 930
 							case 'checkbox':
931 931
 								// remove the ID (as to not assign the same ID to every radio button)
932
-								unset( $field_array['id'] );
933
-								$choices = json_decode( $field['choices'], true );
932
+								unset( $field_array[ 'id' ] );
933
+								$choices = json_decode( $field[ 'choices' ], true );
934 934
 								// assign a default choice
935
-								$default_value = ( isset( $field['default_choice'] ) && $field['default_choice'] != '' ) ? $field['default_choice'] : $choices[0];
935
+								$default_value = ( isset( $field[ 'default_choice' ] ) && $field[ 'default_choice' ] != '' ) ? $field[ 'default_choice' ] : $choices[ 0 ];
936 936
 								// if the form was submit, but failed, let's reset the post data
937
-								if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) {
938
-									$default_value = $_POST[$field['merge']];
937
+								if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) {
938
+									$default_value = $_POST[ $field[ 'merge' ] ];
939 939
 								}
940 940
 								$count = count( $choices );
941 941
 								$i = 1;
@@ -944,20 +944,20 @@  discard block
 block discarded – undo
944 944
 								// hidden labels
945 945
 
946 946
 									?>
947
-									<label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
947
+									<label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
948 948
 
949 949
 										<!-- dictate label visibility -->
950
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
951
-											<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?> checkbox-parent-label">
952
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
950
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
951
+											<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?> checkbox-parent-label">
952
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
953 953
 											</span>
954 954
 										<?php }
955 955
 
956
-										foreach( $choices as $choice ) {
956
+										foreach ( $choices as $choice ) {
957 957
 											?>
958
-											<label for="<?php echo esc_attr( $field['merge'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $i === $count ) { ?> last-selection<?php } ?>" <?php if( $i == 1 ) { echo $field_array['required']; } ?>>
959
-												<input type="<?php echo esc_attr( $field['type'] ); ?>" name="<?php echo $field['merge']; ?>" id="<?php echo $field['merge'] . '-' . $i; ?>" <?php checked( $default_value , $x ); ?> value="<?php echo esc_attr( $choice ); ?>">
960
-												<span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
958
+											<label for="<?php echo esc_attr( $field[ 'merge' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $i === $count ) { ?> last-selection<?php } ?>" <?php if ( $i == 1 ) { echo $field_array[ 'required' ]; } ?>>
959
+												<input type="<?php echo esc_attr( $field[ 'type' ] ); ?>" name="<?php echo $field[ 'merge' ]; ?>" id="<?php echo $field[ 'merge' ] . '-' . $i; ?>" <?php checked( $default_value, $x ); ?> value="<?php echo esc_attr( $choice ); ?>">
960
+												<span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"><?php echo stripslashes( $choice ); ?></span>
961 961
 											</label>
962 962
 											<?php
963 963
 											$i++;
@@ -965,10 +965,10 @@  discard block
 block discarded – undo
965 965
 										}
966 966
 
967 967
 										// description
968
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
968
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
969 969
 											<p class="form-field-description">
970 970
 												<small>
971
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
971
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
972 972
 												</small>
973 973
 											</p>
974 974
 										<?php } ?>
@@ -984,26 +984,26 @@  discard block
 block discarded – undo
984 984
 
985 985
 
986 986
 						// store default choice
987
-						$default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : ( isset( $field['default_choice'] ) ? $field['default_choice'] : '' );
987
+						$default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : ( isset( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : '' );
988 988
 
989 989
 						// if the form was submit, but failed, let's reset the post data
990
-						if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
991
-							$default_choice = $_POST[$field['group_id']];
990
+						if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
991
+							$default_choice = $_POST[ $field[ 'group_id' ] ];
992 992
 						}
993 993
 
994 994
 						// get our groups
995
-						$groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( $field['groups'], true ) : array();
995
+						$groups = ( isset( $field[ 'groups' ] ) && ! empty( $field[ 'groups' ] ) ) ? json_decode( $field[ 'groups' ], true ) : array();
996 996
 
997 997
 						$count = count( $groups );
998 998
 
999
-						if( $field['type'] == 'checkboxes' ) {
999
+						if ( $field[ 'type' ] == 'checkboxes' ) {
1000 1000
 							$type = 'checkbox';
1001
-						} else if( $field['type'] == 'radio' ) {
1001
+						} else if ( $field[ 'type' ] == 'radio' ) {
1002 1002
 							$type = 'radio';
1003 1003
 						}
1004 1004
 
1005 1005
 						// loop over the interest group field types
1006
-						switch ( $field['type'] ) {
1006
+						switch ( $field[ 'type' ] ) {
1007 1007
 
1008 1008
 							case 'checkboxes':
1009 1009
 							case 'radio':
@@ -1011,18 +1011,18 @@  discard block
 block discarded – undo
1011 1011
 								$x = 1; // used to find the last item of our array
1012 1012
 
1013 1013
 									?>
1014
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1015
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1014
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1015
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1016 1016
 											<!-- dictate label visibility -->
1017
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label">
1018
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1017
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label">
1018
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
1019 1019
 											</span>
1020 1020
 									<?php
1021 1021
 										}
1022 1022
 
1023 1023
 										// Display Submission Errors
1024
-										if( ! empty( $missing_required_checkbox_interest_groups ) ) {
1025
-											if( in_array( $field['group_id'], $missing_required_checkbox_interest_groups ) ) {
1024
+										if ( ! empty( $missing_required_checkbox_interest_groups ) ) {
1025
+											if ( in_array( $field[ 'group_id' ], $missing_required_checkbox_interest_groups ) ) {
1026 1026
 												?>
1027 1027
 													<p class="yikes-mailchimp-required-interest-group-error">
1028 1028
 														<?php echo apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); ?>
@@ -1033,19 +1033,19 @@  discard block
 block discarded – undo
1033 1033
 
1034 1034
 
1035 1035
 
1036
-										foreach( $groups as $group ) {
1037
-											if( $field['type'] == 'checkboxes' ) {
1036
+										foreach ( $groups as $group ) {
1037
+											if ( $field[ 'type' ] == 'checkboxes' ) {
1038 1038
 												/* Setup the defaults for this field - varies if the field was previously submitted */
1039
-												if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) {
1040
-													$default_choice = $_POST[$field['group_id']];
1041
-												} elseif( ( ! isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted != 1 ) || ( isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted == 1 ) ) {
1042
-													$default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : array();
1039
+												if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) {
1040
+													$default_choice = $_POST[ $field[ 'group_id' ] ];
1041
+												} elseif ( ( ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 ) || ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 ) ) {
1042
+													$default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : array();
1043 1043
 												}
1044 1044
 											}
1045 1045
 											?>
1046
-											<label for="<?php echo $field['group_id'] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>">
1047
-												<input <?php if( isset( $field['require'] ) && $field['require'] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="<?php echo $field['group_id']; ?>[]" id="<?php echo $field['group_id'] . '-' . $i; ?>" <?php if( $field['type'] == 'checkboxes' ) { if( ( ( isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i , $default_choice )) || ! isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i , $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[$field['group_id']] ) ) && in_array( esc_attr( $group['name'] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[0] : $default_choice , $i ); } ?> value="<?php echo esc_attr( $group['name'] ); ?>">
1048
-												<?php echo $group['name']; ?>
1046
+											<label for="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>">
1047
+												<input <?php if ( isset( $field[ 'require' ] ) && $field[ 'require' ] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="<?php echo $field[ 'group_id' ]; ?>[]" id="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" <?php if ( $field[ 'type' ] == 'checkboxes' ) { if ( ( ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i, $default_choice ) ) || ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i, $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[ $field[ 'group_id' ] ] ) ) && in_array( esc_attr( $group[ 'name' ] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[ 0 ] : $default_choice, $i ); } ?> value="<?php echo esc_attr( $group[ 'name' ] ); ?>">
1048
+												<?php echo $group[ 'name' ]; ?>
1049 1049
 											</label>
1050 1050
 											<?php
1051 1051
 											$i++;
@@ -1053,10 +1053,10 @@  discard block
 block discarded – undo
1053 1053
 										}
1054 1054
 
1055 1055
 										// description
1056
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1056
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1057 1057
 											<p class="form-field-description">
1058 1058
 												<small>
1059
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1059
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1060 1060
 												</small>
1061 1061
 											</p>
1062 1062
 										<?php } ?>
@@ -1070,28 +1070,28 @@  discard block
 block discarded – undo
1070 1070
 
1071 1071
 									?>
1072 1072
 
1073
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1073
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1074 1074
 										<!-- dictate label visibility -->
1075
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1076
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>">
1077
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?>
1075
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1076
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?>">
1077
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?>
1078 1078
 											</span>
1079 1079
 										<?php } ?>
1080 1080
 
1081
-										<select <?php echo implode( ' ' , $field_array ); ?>>
1081
+										<select <?php echo implode( ' ', $field_array ); ?>>
1082 1082
 											<?php
1083 1083
 												$i = 0;
1084
-												foreach( $groups as $group ) {
1085
-													?><option <?php selected( $i , $default_choice ); ?> value="<?php echo $group['name']; ?>"><?php echo esc_attr( $group['name'] ); ?></option><?php
1084
+												foreach ( $groups as $group ) {
1085
+													?><option <?php selected( $i, $default_choice ); ?> value="<?php echo $group[ 'name' ]; ?>"><?php echo esc_attr( $group[ 'name' ] ); ?></option><?php
1086 1086
 													$i++;
1087 1087
 												}
1088 1088
 											?>
1089 1089
 										</select>
1090 1090
 
1091
-										<?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1091
+										<?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1092 1092
 											<p class="form-field-description">
1093 1093
 												<small>
1094
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?>
1094
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?>
1095 1095
 												</small>
1096 1096
 											</p>
1097 1097
 										<?php } ?>
@@ -1108,21 +1108,21 @@  discard block
 block discarded – undo
1108 1108
 
1109 1109
 									?>
1110 1110
 
1111
-									<label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>>
1111
+									<label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>>
1112 1112
 
1113 1113
 										<!-- dictate label visibility -->
1114
-										<?php if( ! isset( $field['hide-label'] ) ) { ?>
1115
-											<span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1116
-												<?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?>
1114
+										<?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?>
1115
+											<span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label" style="display:none;">
1116
+												<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?>
1117 1117
 											</span>
1118 1118
 										<?php }
1119 1119
 
1120 1120
 
1121
-										foreach( $groups as $group ) {
1121
+										foreach ( $groups as $group ) {
1122 1122
 											?>
1123
-											<label for="<?php echo $field['group_id'] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>" style="display:none;">
1124
-												<input type="radio" name="<?php echo $field['group_id']; ?>[]" id="<?php echo $field['group_id'] . '-' . $i; ?>" <?php if( $field['type'] == 'checkboxes' ) { if( in_array( $i , $default_choice ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[0] : $default_choice , $i ); } ?> value="<?php echo esc_attr( $group['name'] ); ?>">
1125
-												<?php echo esc_attr( stripslashes( str_replace( '' , '\'', $group['name'] ) ) ); ?>
1123
+											<label for="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>" style="display:none;">
1124
+												<input type="radio" name="<?php echo $field[ 'group_id' ]; ?>[]" id="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" <?php if ( $field[ 'type' ] == 'checkboxes' ) { if ( in_array( $i, $default_choice ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[ 0 ] : $default_choice, $i ); } ?> value="<?php echo esc_attr( $group[ 'name' ] ); ?>">
1125
+												<?php echo esc_attr( stripslashes( str_replace( '', '\'', $group[ 'name' ] ) ) ); ?>
1126 1126
 											</label>
1127 1127
 											<?php
1128 1128
 											$i++;
@@ -1130,10 +1130,10 @@  discard block
 block discarded – undo
1130 1130
 										}
1131 1131
 
1132 1132
 										// description
1133
-										if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?>
1133
+										if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?>
1134 1134
 											<p class="form-field-description">
1135 1135
 												<small>
1136
-													<?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?>
1136
+													<?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?>
1137 1137
 												</small>
1138 1138
 											</p>
1139 1139
 										<?php }
@@ -1150,11 +1150,11 @@  discard block
 block discarded – undo
1150 1150
 				do_action( 'yikes-mailchimp-additional-form-fields', $form_data );
1151 1151
 
1152 1152
 				/* if we've enabled reCAPTCHA protection */
1153
-				if( isset( $recaptcha_box ) ) {
1153
+				if ( isset( $recaptcha_box ) ) {
1154 1154
 					echo $recaptcha_box;
1155 1155
 				}
1156
-				if( is_user_logged_in() ) {
1157
-					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1156
+				if ( is_user_logged_in() ) {
1157
+					$admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ? ' admin-logged-in' : '';
1158 1158
 				} else {
1159 1159
 					$admin_class = '';
1160 1160
 				}
@@ -1164,29 +1164,29 @@  discard block
 block discarded – undo
1164 1164
 				<input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot" value="">
1165 1165
 
1166 1166
 				<!-- List ID -->
1167
-				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_data['list_id']; ?>">
1167
+				<input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_data[ 'list_id' ]; ?>">
1168 1168
 
1169 1169
 				<!-- Form that is being submitted! Used to display error/success messages above the correct form -->
1170 1170
 				<input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form" value="<?php echo $form_id; ?>">
1171 1171
 
1172 1172
 				<!-- Submit Button -->
1173 1173
 				<?php
1174
-					if( $form_inline ) {
1174
+					if ( $form_inline ) {
1175 1175
 						$submit_button_label_classes = array( 'empty-label' );
1176 1176
 						// If the number of fields, is equal to the hidden label count, add our class
1177 1177
 						// eg: All field labels are set to hidden.
1178 1178
 						if ( absint( $field_count ) === absint( $hidden_label_count ) ) {
1179
-							$submit_button_label_classes[] = 'labels-hidden';
1179
+							$submit_button_label_classes[ ] = 'labels-hidden';
1180 1180
 						}
1181 1181
 						echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="' . implode( ' ', $submit_button_label_classes ) . '">&nbsp;</span>';
1182 1182
 					}
1183 1183
 					// display the image or text based button
1184
-					if( $submit_button_type == 'text' ) {
1185
-						echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '">' .  apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '</button>', $form_data['id'] );
1184
+					if ( $submit_button_type == 'text' ) {
1185
+						echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data[ 'id' ] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data[ 'id' ] ) . '">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '</button>', $form_data[ 'id' ] );
1186 1186
 					} else {
1187
-						echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '">', $form_data['id'] );
1187
+						echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data[ 'id' ] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data[ 'id' ] ) . '">', $form_data[ 'id' ] );
1188 1188
 					}
1189
-					if( $form_inline ) {
1189
+					if ( $form_inline ) {
1190 1190
 						echo '</label>';
1191 1191
 					}
1192 1192
 				?>
@@ -1198,8 +1198,8 @@  discard block
 block discarded – undo
1198 1198
 
1199 1199
 		<?php
1200 1200
 			/* If the current user is logged in, and an admin...lets display our 'Edit Form' link */
1201
-			if( is_user_logged_in() ) {
1202
-				if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) {
1201
+			if ( is_user_logged_in() ) {
1202
+				if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) {
1203 1203
 					echo $edit_form_link;
1204 1204
 				}
1205 1205
 			}
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
 		*	for non-admins
1216 1216
 		*/
1217 1217
 		if ( ! current_user_can( 'manage_options' ) ) {
1218
-			$impressions = $form_data['impressions'] + 1;
1218
+			$impressions = $form_data[ 'impressions' ] + 1;
1219 1219
 			$interface->update_form_field( $form_id, 'impressions', $impressions );
1220 1220
 		}
1221 1221
 
Please login to merge, or discard this patch.
public/partials/shortcodes/process/process_form_submission_ajax.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,9 +96,11 @@
 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!
99
+		if( is_numeric( $merge_tag ) ) {
100
+// this is is an interest group!
100 101
 			$merge_variables['groupings'][] = array( 'id' => $merge_tag , 'groups' => ( is_array( $value ) ) ? $value : array( $value ) );
101
-		} else { // or else it's just a standard merge variable
102
+		} else {
103
+// or else it's just a standard merge variable
102 104
 			$merge_variables[$merge_tag] = $value;
103 105
 		}
104 106
 	}
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -5,35 +5,35 @@  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
 $interface = yikes_easy_mailchimp_extender_get_form_interface();
13 13
 $form_data = $interface->get_form( $form );
14 14
 
15
-if( $form_data ) {
15
+if ( $form_data ) {
16 16
 	// List ID
17
-	$list_id = $form_data['list_id'];
17
+	$list_id = $form_data[ 'list_id' ];
18 18
 
19 19
 	// decode our submission settings
20
-	$submission_settings = $form_data['submission_settings'];
20
+	$submission_settings = $form_data[ 'submission_settings' ];
21 21
 
22 22
 	// decode our optin settings
23
-	$optin_settings = $form_data['optin_settings'];
23
+	$optin_settings = $form_data[ 'optin_settings' ];
24 24
 
25 25
 	// decode our fields
26
-	$form_fields = $form_data['fields'];
26
+	$form_fields = $form_data[ 'fields' ];
27 27
 
28 28
 	/*	Decode our error messages
29 29
 	*	Workaround for international characters (cyrillic etc)
30 30
 	* 	See: https://wordpress.org/support/topic/custom-messages-do-not-support-cyrillic-characters?replies=11#post-7629620
31 31
 	*/
32
-	$error_messages = $form_data['error_messages'];
32
+	$error_messages = $form_data[ 'error_messages' ];
33 33
 	/** Submit Process **/
34
-	$notifications = isset( $form_data['custom_notifications'] ) ? $form_data['custom_notifications'] : array();
34
+	$notifications = isset( $form_data[ 'custom_notifications' ] ) ? $form_data[ 'custom_notifications' ] : array();
35 35
 	/* Page Data */
36
-	$page_data = $_POST['page_data'];
36
+	$page_data = $_POST[ 'page_data' ];
37 37
 }
38 38
 
39 39
 // Empty array to build up merge variables
@@ -43,39 +43,39 @@  discard block
 block discarded – undo
43 43
 $error = 0;
44 44
 
45 45
 /* Check for Honeypot filled */
46
-$honey_pot_filled = ( isset( $data['yikes-mailchimp-honeypot'] ) && $data['yikes-mailchimp-honeypot'] != '' ) ? true : false;
46
+$honey_pot_filled = ( isset( $data[ 'yikes-mailchimp-honeypot' ] ) && $data[ 'yikes-mailchimp-honeypot' ] != '' ) ? true : false;
47 47
 // if it was filled out, return an error...
48
-if( $honey_pot_filled ) {
48
+if ( $honey_pot_filled ) {
49 49
 	wp_send_json_error( array(
50 50
 		'hide' => '0',
51 51
 		'error' => 1,
52
-		'response' => __( "Error: It looks like the honeypot was filled out and the form was not properly be submitted." , 'yikes-inc-easy-mailchimp-extender' )
52
+		'response' => __( "Error: It looks like the honeypot was filled out and the form was not properly be submitted.", 'yikes-inc-easy-mailchimp-extender' )
53 53
 	) );
54 54
 	return;
55 55
 }
56 56
 
57 57
 // Check reCAPTCHA Response was submitted with the form data
58
-if( isset( $data['g-recaptcha-response'] ) ) {
59
-	$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"] );
58
+if ( isset( $data[ 'g-recaptcha-response' ] ) ) {
59
+	$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" ] );
60 60
 	$response = wp_remote_get( $url );
61
-	$response_body = json_decode( $response['body'] , true );
61
+	$response_body = json_decode( $response[ 'body' ], true );
62 62
 	// if we've hit an error, lets return the error!
63
-	if( $response_body['success'] != 1 ) {
63
+	if ( $response_body[ 'success' ] != 1 ) {
64 64
 		$error_messages = array(); // empty array to store error messages
65
-		if( isset( $response_body['error-codes'] ) ) {
66
-			foreach( $response_body['error-codes'] as $error_code ) {
67
-				if( $error_code == 'missing-input-response' ) {
65
+		if ( isset( $response_body[ 'error-codes' ] ) ) {
66
+			foreach ( $response_body[ 'error-codes' ] as $error_code ) {
67
+				if ( $error_code == 'missing-input-response' ) {
68 68
 					$error_code = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' );
69 69
 				}
70
-				$error_messages[] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code;
70
+				$error_messages[ ] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code;
71 71
 			}
72 72
 		} else {
73
-			$error_messages[] = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' );
73
+			$error_messages[ ] = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' );
74 74
 		}
75 75
 		$error = 1;
76 76
 		wp_send_json_error( array(
77 77
 			'hide' => '0',
78
-			'error' => $error ,
78
+			'error' => $error,
79 79
 			'response' => apply_filters( 'yikes-mailchimp-recaptcha-required-error', implode( ' ', $error_messages ) ),
80 80
 		) );
81 81
 		exit();
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
 
85 85
 // loop to push variables to our array
86 86
 foreach ( $data as $merge_tag => $value ) {
87
-	if( $merge_tag != 'yikes_easy_mc_new_subscriber' && $merge_tag != '_wp_http_referer' ) {
87
+	if ( $merge_tag != 'yikes_easy_mc_new_subscriber' && $merge_tag != '_wp_http_referer' ) {
88 88
 		// check if the current iteration has a 'date_format' key set
89 89
 		// (aka - date/birthday fields)
90
-		if( isset( $form_fields[$merge_tag]['date_format'] ) ) {
90
+		if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) {
91 91
 			// check if EU date format
92
-			if( $form_fields[$merge_tag]['date_format'] == 'DD/MM/YYYY' ) {
92
+			if ( $form_fields[ $merge_tag ][ 'date_format' ] == 'DD/MM/YYYY' ) {
93 93
 				// convert '/' to '.' and to UNIX timestamp
94 94
 				$value = date( 'Y-m-d', strtotime( str_replace( '/', '.', $value ) ) );
95 95
 			} else {
@@ -97,22 +97,22 @@  discard block
 block discarded – undo
97 97
 				$value = date( 'Y-m-d', strtotime( $value ) );
98 98
 			}
99 99
 		}
100
-		if( is_numeric( $merge_tag ) ) { // this is is an interest group!
101
-			$merge_variables['groupings'][] = array( 'id' => $merge_tag , 'groups' => ( is_array( $value ) ) ? $value : array( $value ) );
100
+		if ( is_numeric( $merge_tag ) ) { // this is is an interest group!
101
+			$merge_variables[ 'groupings' ][ ] = array( 'id' => $merge_tag, 'groups' => ( is_array( $value ) ) ? $value : array( $value ) );
102 102
 		} else { // or else it's just a standard merge variable
103
-			$merge_variables[$merge_tag] = $value;
103
+			$merge_variables[ $merge_tag ] = $value;
104 104
 		}
105 105
 	}
106 106
 }
107 107
 // store the opt-in time
108
-$merge_variables['optin_time'] = current_time( 'Y-m-d H:i:s', 1 );
108
+$merge_variables[ 'optin_time' ] = current_time( 'Y-m-d H:i:s', 1 );
109 109
 
110 110
 // Submit our form data
111 111
 $api_key = yikes_get_mc_api_key();
112 112
 $dash_position = strpos( $api_key, '-' );
113 113
 
114 114
 // setup the end point
115
-if( $dash_position !== false ) {
115
+if ( $dash_position !== false ) {
116 116
 	$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/subscribe.json';
117 117
 }
118 118
 
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 *	Allow users to check for submit value
139 139
 *	and pass back an error to the user
140 140
 */
141
-if( isset( $merge_variables['error'] ) ) {
141
+if ( isset( $merge_variables[ 'error' ] ) ) {
142 142
 	// send our error response back
143
-	wp_send_json_error( array( 'hide' => '0', 'error' => $merge_variables['error']  , 'response' => $merge_variables['message']  ) );
143
+	wp_send_json_error( array( 'hide' => '0', 'error' => $merge_variables[ 'error' ], 'response' => $merge_variables[ 'message' ] ) );
144 144
 	return;
145 145
 }
146 146
 
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
  * Setup whether or not we should update the user, or display the error with email generation
149 149
  * @since 6.1
150 150
  */
151
-if ( isset( $optin_settings['update_existing_user'] ) && 1 === absint( $optin_settings['update_existing_user'] ) ) {
151
+if ( isset( $optin_settings[ 'update_existing_user' ] ) && 1 === absint( $optin_settings[ 'update_existing_user' ] ) ) {
152 152
 	// Should we send the update email
153
-	if ( isset( $optin_settings['send_update_email'] ) && 1 === absint( $optin_settings['send_update_email'] ) ) {
153
+	if ( isset( $optin_settings[ 'send_update_email' ] ) && 1 === absint( $optin_settings[ 'send_update_email' ] ) ) {
154 154
 		$update_existing_user = 0;
155 155
 	} else {
156 156
 		$update_existing_user = 1;
@@ -165,38 +165,38 @@  discard block
 block discarded – undo
165 165
 		'body' => apply_filters( 'yikes-mailchimp-user-subscribe-api-request', array(
166 166
 			'apikey' => $api_key,
167 167
 			'id' => $list_id,
168
-			'email' => array( 'email' => sanitize_email( $data['EMAIL'] ) ),
168
+			'email' => array( 'email' => sanitize_email( $data[ 'EMAIL' ] ) ),
169 169
 			'merge_vars' => $merge_variables,
170
-			'double_optin' => $optin_settings['optin'],
170
+			'double_optin' => $optin_settings[ 'optin' ],
171 171
 			'update_existing' => $update_existing_user, // Decide if we should update the user or not
172
-			'send_welcome' => $optin_settings['send_welcome_email'],
173
-			'replace_interests' => ( isset( $submission_settings['replace_interests'] ) ) ? $submission_settings['replace_interests'] : 1, // defaults to replace
174
-		), $form, $list_id, $data['EMAIL'] ),
172
+			'send_welcome' => $optin_settings[ 'send_welcome_email' ],
173
+			'replace_interests' => ( isset( $submission_settings[ 'replace_interests' ] ) ) ? $submission_settings[ 'replace_interests' ] : 1, // defaults to replace
174
+		), $form, $list_id, $data[ 'EMAIL' ] ),
175 175
 		'timeout' => 10,
176 176
 		'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
177 177
 	) );
178 178
 
179 179
 	$subscribe_response = json_decode( wp_remote_retrieve_body( $subscribe_response ), true );
180 180
 
181
-	if( isset( $subscribe_response['error'] ) ) {
181
+	if ( isset( $subscribe_response[ 'error' ] ) ) {
182 182
 
183
-		if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
183
+		if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
184 184
 			require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
185 185
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
186
-			$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
+			$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" );
187 187
 		}
188 188
 
189 189
 		$update_account_details_link = '';
190 190
 		$error = 1;
191
-		switch( $subscribe_response['code'] ) {
191
+		switch ( $subscribe_response[ 'code' ] ) {
192 192
 			// user already subscribed
193 193
 			case '214':
194
-				$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>' );
195
-				$update_account_details_link = ( 1 === absint( $optin_settings['update_existing_user'] ) && 1 === absint( $optin_settings['send_update_email'] ) ) ? $custom_already_subscribed_text : false;
196
-				if( ! empty( $error_messages['already-subscribed'] ) ) {
197
-					$error_response = apply_filters( 'yikes-easy-mailchimp-user-already-subscribed-text', $error_messages['already-subscribed'] , $form, $data['EMAIL'] ) . ' ' . $update_account_details_link;
194
+				$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>' );
195
+				$update_account_details_link = ( 1 === absint( $optin_settings[ 'update_existing_user' ] ) && 1 === absint( $optin_settings[ 'send_update_email' ] ) ) ? $custom_already_subscribed_text : false;
196
+				if ( ! empty( $error_messages[ 'already-subscribed' ] ) ) {
197
+					$error_response = apply_filters( 'yikes-easy-mailchimp-user-already-subscribed-text', $error_messages[ 'already-subscribed' ], $form, $data[ 'EMAIL' ] ) . ' ' . $update_account_details_link;
198 198
 				} else {
199
-					$error_response = $subscribe_response['error'] . ' ' . $update_account_details_link;
199
+					$error_response = $subscribe_response[ 'error' ] . ' ' . $update_account_details_link;
200 200
 				}
201 201
 				break;
202 202
 			// missing a required field
@@ -204,34 +204,34 @@  discard block
 block discarded – undo
204 204
 					// get all merge variables in array, loop and str_replace error code with field name
205 205
 					$api_key = yikes_get_mc_api_key();
206 206
 					$dash_position = strpos( $api_key, '-' );
207
-					if( $dash_position !== false ) {
207
+					if ( $dash_position !== false ) {
208 208
 						$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json';
209 209
 					}
210 210
 					$merge_variables = wp_remote_post( $api_endpoint, array(
211 211
 						'body' => array(
212 212
 							'apikey' => $api_key,
213
-							'id' => array( $list_id ) ,
213
+							'id' => array( $list_id ),
214 214
 						),
215 215
 						'timeout' => 10,
216 216
 						'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ),
217 217
 					) );
218 218
 					$merge_variables = json_decode( wp_remote_retrieve_body( $merge_variables ), true );
219
-					if( is_wp_error( $merge_variables ) || isset( $merge_variables['error'] ) ) {
220
-						if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
219
+					if ( is_wp_error( $merge_variables ) || isset( $merge_variables[ 'error' ] ) ) {
220
+						if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
221 221
 							require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
222 222
 							$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
223
-							$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
+							$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" );
224 224
 						}
225 225
 					}
226 226
 					// re-store our data
227
-					$merge_variables = $merge_variables['data'][0]['merge_vars'];
227
+					$merge_variables = $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ];
228 228
 					$merge_variable_name_array = array();
229
-					foreach( $merge_variables as $merge_var ) {
230
-						$merge_variables_name_array[$merge_var['tag']] = $merge_var['name'];
229
+					foreach ( $merge_variables as $merge_var ) {
230
+						$merge_variables_name_array[ $merge_var[ 'tag' ] ] = $merge_var[ 'name' ];
231 231
 					}
232
-					$error_message = $subscribe_response['error'];
232
+					$error_message = $subscribe_response[ 'error' ];
233 233
 					// replace tag with name in the error message.
234
-					foreach( $merge_variables_name_array as $tag => $name ) {
234
+					foreach ( $merge_variables_name_array as $tag => $name ) {
235 235
 						$error_message = str_replace( $tag, $name, $error_message );
236 236
 					}
237 237
 					$error_response = $error_message;
@@ -239,14 +239,14 @@  discard block
 block discarded – undo
239 239
 			// [email protected] is not allowed
240 240
 			case '-99':
241 241
 				// generic error
242
-				$error_response = str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response['error'] ) );
242
+				$error_response = str_replace( ' and cannot be imported', '', str_replace( 'List_RoleEmailMember:', '', $subscribe_response[ 'error' ] ) );
243 243
 				break;
244 244
 			// invalid email (or no email at all)
245 245
 				case '-100':
246
-					$error_response = ( ! empty( $error_messages['invalid-email'] ) ) ? $error_messages['invalid-email'] : __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' );
246
+					$error_response = ( ! empty( $error_messages[ 'invalid-email' ] ) ) ? $error_messages[ 'invalid-email' ] : __( 'Please provide a valid email address.', 'yikes-inc-easy-mailchimp-extender' );
247 247
 					break;
248 248
 			default:
249
-				$error_response = ( ! empty( $error_messages['general-error'] ) ) ? $error_messages['general-error'] : $subscribe_response['error'];
249
+				$error_response = ( ! empty( $error_messages[ 'general-error' ] ) ) ? $error_messages[ 'general-error' ] : $subscribe_response[ 'error' ];
250 250
 				break;
251 251
 		}
252 252
 		// send the response
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 	/*
265 265
 	*	Successful form submission redirect
266 266
 	*/
267
-	if( $submission_settings['redirect_on_submission'] == '1' ) {
267
+	if ( $submission_settings[ 'redirect_on_submission' ] == '1' ) {
268 268
 		$redirection = '1';
269
-		$redirect_url = ( 'custom_url' != $submission_settings['redirect_page'] ) ? get_permalink( $submission_settings['redirect_page'] ) : $submission_settings['custom_redirect_url'];
269
+		$redirect_url = ( 'custom_url' != $submission_settings[ 'redirect_page' ] ) ? get_permalink( $submission_settings[ 'redirect_page' ] ) : $submission_settings[ 'custom_redirect_url' ];
270 270
 		$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>';
271 271
 	}
272 272
 
@@ -282,16 +282,16 @@  discard block
 block discarded – undo
282 282
 	do_action( 'yikes-mailchimp-after-submission-' . $form, $merge_variables );
283 283
 
284 284
 	// send our notifications if setup (must go before wp_send_json())
285
-	do_action( 'yikes-mailchimp-form-submission' , sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications );
286
-	do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications );
285
+	do_action( 'yikes-mailchimp-form-submission', sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications );
286
+	do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications );
287 287
 
288
-	$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
+	$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' );
289 289
 
290 290
 	wp_send_json_success(
291 291
 		array(
292
-			'hide' => $submission_settings['hide_form_post_signup'],
292
+			'hide' => $submission_settings[ 'hide_form_post_signup' ],
293 293
 			'error' => $error,
294
-			'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages['success'] ) ? $error_messages['success'] : $default_success_response ), $form, $merge_variables ),
294
+			'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages[ 'success' ] ) ? $error_messages[ 'success' ] : $default_success_response ), $form, $merge_variables ),
295 295
 			'redirection' => isset( $redirection ) ? '1' : '0',
296 296
 			'redirect' => isset( $redirect ) ? $redirect : '',
297 297
 		)
Please login to merge, or discard this patch.