Completed
Push — staging ( 68fed3...485a71 )
by Evan
04:30
created
public/classes/checkbox-integrations/class.registration_form-checkbox.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 */
9 9
 
10 10
 // Prevent direct access to the file
11
-defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) );
11
+defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) );
12 12
 	
13 13
 class Yikes_Easy_MC_Registration_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class {
14 14
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		add_action( 'register_form', array( $this, 'output_checkbox' ), 20 );
21 21
 		add_action( 'user_register', array( $this, 'subscribe_from_registration' ), 90, 1 );
22 22
 		// alter the error message, if there was an error with the users email address
23
-		add_filter( 'wp_login_errors', array( $this , 'yikes_reg_complete_msg' ), 10,  2 );
23
+		add_filter( 'wp_login_errors', array( $this, 'yikes_reg_complete_msg' ), 10, 2 );
24 24
 	}
25 25
 	
26 26
 	/**
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 		// build our merge vars
52 52
 		$merge_variables = $this->user_merge_vars( $user );
53 53
 		// only subscribe the user if they aren't already on the list
54
-		if ( $this->is_user_already_subscribed( 'registration_form', $user->user_email )) {
55
-			$this->subscribe_user_integration( sanitize_email( $user->user_email ) , $this->type , $merge_variables );
54
+		if ( $this->is_user_already_subscribed( 'registration_form', $user->user_email ) ) {
55
+			$this->subscribe_user_integration( sanitize_email( $user->user_email ), $this->type, $merge_variables );
56 56
 		} else {
57 57
 			// add a temporary option to pass our email address and let the user know they are already subscribed
58
-			$user_already_subscirbed_message = sprintf( __( "You have not been subscribed to our mailing list. %s is already subscribed to this list.", "yikes-inc-easy-mailchimp-extender" ), $user->user_email  );
59
-			add_option( 'yikes_register_subscription_error' , $user_already_subscirbed_message );
58
+			$user_already_subscirbed_message = sprintf( __( "You have not been subscribed to our mailing list. %s is already subscribed to this list.", "yikes-inc-easy-mailchimp-extender" ), $user->user_email );
59
+			add_option( 'yikes_register_subscription_error', $user_already_subscirbed_message );
60 60
 		}
61 61
 	}
62 62
 	
Please login to merge, or discard this patch.
public/classes/checkbox-integrations/class.buddypress_form-checkbox.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 	*/
7 7
 	
8 8
 	// Prevent direct access to the file
9
-	defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) );
9
+	defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) );
10 10
 	
11 11
 	class Yikes_Easy_MC_BuddyPress_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class {
12 12
 		
Please login to merge, or discard this patch.
classes/checkbox-integrations/class.woocommerce_checkout_form-checkbox.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 */
9 9
 
10 10
 // Prevent direct access to the file
11
-defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) );
11
+defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) );
12 12
 
13 13
 class Yikes_Easy_MC_WooCommerce_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class {
14 14
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function get_position() {
34 34
 		$opts = $this->get_options();
35
-		return $opts['woocommerce_position'];
35
+		return $opts[ 'woocommerce_position' ];
36 36
 	}
37 37
 	
38 38
 	/**
@@ -42,22 +42,22 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function add_checkout_field( $fields ) {
44 44
 		// get checkbox data
45
-		$checkbox_options = get_option( 'optin-checkbox-init' , '' );
45
+		$checkbox_options = get_option( 'optin-checkbox-init', '' );
46 46
 		// only display the field if a list is set
47
-		if( isset( $checkbox_options ) && $checkbox_options[$this->type]['associated-list'] != '-' ) {
48
-			if( $this->is_user_already_subscribed( $this->type ) ) {
47
+		if ( isset( $checkbox_options ) && $checkbox_options[ $this->type ][ 'associated-list' ] != '-' ) {
48
+			if ( $this->is_user_already_subscribed( $this->type ) ) {
49 49
 				return $fields;
50 50
 			}
51
-			if( isset( $checkbox_options[$this->type]['precheck'] ) && $checkbox_options[$this->type]['precheck'] == 'true' ) {
51
+			if ( isset( $checkbox_options[ $this->type ][ 'precheck' ] ) && $checkbox_options[ $this->type ][ 'precheck' ] == 'true' ) {
52 52
 				$precheck = '1';
53 53
 			} else {
54 54
 				$precheck = '0';
55 55
 			}
56
-			$fields[ 'billing' ]['yikes_mailchimp_checkbox_'.$this->type] = array(
57
-				'id' => 'yikes_mailchimp_checkbox_'.$this->type,
56
+			$fields[ 'billing' ][ 'yikes_mailchimp_checkbox_' . $this->type ] = array(
57
+				'id' => 'yikes_mailchimp_checkbox_' . $this->type,
58 58
 				'type'    => 'checkbox',
59 59
 				'class' => array(),
60
-				'label'   => $checkbox_options[$this->type]['label'],
60
+				'label'   => $checkbox_options[ $this->type ][ 'label' ],
61 61
 				'default' => $precheck,
62 62
 			);
63 63
 		}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	*/
79 79
 	public function subscribe_from_woocommerce_checkout( $order_id ) {
80 80
 		$do_optin = get_post_meta( $order_id, 'yikes_easy_mailchimp_optin', true );
81
-		if( $do_optin == '1' ) {
81
+		if ( $do_optin == '1' ) {
82 82
 			$order = new WC_Order( $order_id );
83 83
 			$email = $order->billing_email;
84 84
 			$merge_vars = array(
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 				'LNAME' => $order->billing_last_name,
88 88
 			);
89 89
 			// subscribe the user
90
-			$this->subscribe_user_integration( sanitize_email( $email ) , $this->type , $merge_vars );
90
+			$this->subscribe_user_integration( sanitize_email( $email ), $this->type, $merge_vars );
91 91
 		}
92 92
 		return false;
93 93
 	}
Please login to merge, or discard this patch.
public/classes/checkbox-integrations/class.bbpress_forms-checkbox.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 	*/
7 7
 	
8 8
 	// Prevent direct access to the file
9
-	defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) );
9
+	defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) );
10 10
 	
11 11
 	class Yikes_Easy_MC_bbPress_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class {
12 12
 	
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		 */
46 46
 		public function subscribe_from_bbpress( $anonymous_data, $user_id, $trigger ) {
47 47
 			$user_data = get_userdata( $user_id );
48
-			return $this->subscribe_user_integration( $user_data->user_email, $this->type , array(
48
+			return $this->subscribe_user_integration( $user_data->user_email, $this->type, array(
49 49
 				'FNAME' => $user_data->first_name,
50 50
 				'LNAME' => $user_data->last_name,
51 51
 				'NAE' => $user_data->first_name,
Please login to merge, or discard this patch.
public/classes/checkbox-integrations/class.comment_form-checkbox.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 	*/
7 7
 	
8 8
 	// Prevent direct access to the file
9
-	defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) );
9
+	defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) );
10 10
 	
11 11
 	class Yikes_Easy_MC_Comment_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class {
12 12
 	
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		 *
43 43
 		 *	@since 6.0.0
44 44
 		**/
45
-		public function subscribe_from_comment( $comment_id , $comment_approved ) {	
45
+		public function subscribe_from_comment( $comment_id, $comment_approved ) {	
46 46
 			// was sign-up checkbox checked?
47 47
 			if ( $this->was_checkbox_checked( $this->type ) === false ) {
48 48
 				return false;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 				'OPTIN_IP' => $comment_data->comment_author_IP,
60 60
 			);
61 61
 			// subscribe the user 
62
-			$this->subscribe_user_integration( sanitize_email( $comment_data->comment_author_email ) , $this->type , $merge_vars );
62
+			$this->subscribe_user_integration( sanitize_email( $comment_data->comment_author_email ), $this->type, $merge_vars );
63 63
 		}
64 64
 		
65 65
 	}
Please login to merge, or discard this patch.
class.easy_digital_downloads_checkout_form-checkbox.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 	*/
8 8
 	
9 9
 	// Prevent direct access to the file
10
-	defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) );
10
+	defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) );
11 11
 
12 12
 	class Yikes_Easy_MC_EDD_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class {
13 13
 	
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 		 */
22 22
 		public function __construct() {
23 23
 			add_action( 'edd_purchase_form_user_info_fields', array( $this, 'output_checkbox' ) );
24
-			add_action( 'edd_insert_payment', array( $this, 'update_payment_post_meta' ) , 99999 );
25
-			add_action( 'edd_complete_purchase', array( $this, 'subscribe_from_edd_purchase'), 50 );
24
+			add_action( 'edd_insert_payment', array( $this, 'update_payment_post_meta' ), 99999 );
25
+			add_action( 'edd_complete_purchase', array( $this, 'subscribe_from_edd_purchase' ), 50 );
26 26
 		}
27 27
 		
28 28
 		
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		 */
49 49
 		public function update_payment_post_meta( $payment_id = 0, $payment_data = array() ) {
50 50
 			// don't save anything if the checkbox was not checked
51
-			if( ! $this->was_checkbox_checked( $this->type ) ) {
51
+			if ( ! $this->was_checkbox_checked( $this->type ) ) {
52 52
 				update_post_meta( $payment_id, '_yikes_easy_mc_optin', '0' );
53 53
 				return;
54 54
 			}
@@ -61,25 +61,25 @@  discard block
 block discarded – undo
61 61
 		 * @return bool|string
62 62
 		 */
63 63
 		public function subscribe_from_edd_purchase( $payment_id ) {
64
-			$meta = get_post_meta( $payment_id , '_yikes_easy_mc_optin' , true );
65
-			if( $meta == '0' ) {
64
+			$meta = get_post_meta( $payment_id, '_yikes_easy_mc_optin', true );
65
+			if ( $meta == '0' ) {
66 66
 				return false;
67 67
 			}
68 68
 			$email = (string) edd_get_payment_user_email( $payment_id );
69 69
 			$merge_vars = array();
70 70
 			// add first and last name to merge vars, if given
71 71
 			$user_info = (array) edd_get_payment_meta_user_info( $payment_id );
72
-			if( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
73
-				$merge_vars['NAME'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
72
+			if ( isset( $user_info[ 'first_name' ] ) && isset( $user_info[ 'last_name' ] ) ) {
73
+				$merge_vars[ 'NAME' ] = $user_info[ 'first_name' ] . ' ' . $user_info[ 'last_name' ];
74 74
 			}
75
-			if( isset( $user_info['first_name'] ) ) {
76
-				$merge_vars['FNAME'] = $user_info['first_name'];
75
+			if ( isset( $user_info[ 'first_name' ] ) ) {
76
+				$merge_vars[ 'FNAME' ] = $user_info[ 'first_name' ];
77 77
 			}
78
-			if( isset( $user_info['last_name'] ) ) {
79
-				$merge_vars['LNAME'] = $user_info['last_name'];
78
+			if ( isset( $user_info[ 'last_name' ] ) ) {
79
+				$merge_vars[ 'LNAME' ] = $user_info[ 'last_name' ];
80 80
 			}
81 81
 			// subscribe the user
82
-			$this->subscribe_user_integration( sanitize_email( $email ) , $this->type , $merge_vars );
82
+			$this->subscribe_user_integration( sanitize_email( $email ), $this->type, $merge_vars );
83 83
 		}
84 84
 	
85 85
 	}
Please login to merge, or discard this patch.
public/partials/ajax/class.public_ajax.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,16 +11,16 @@  discard block
 block discarded – undo
11 11
 	 */
12 12
 	public function __construct() {
13 13
 		// ajax process form submission
14
-		add_action( 'wp_ajax_nopriv_process_form_submission', array( $this , 'process_form_submission' ), 10 );
15
-		add_action( 'wp_ajax_process_form_submission', array( $this , 'process_form_submission' ), 10 );
14
+		add_action( 'wp_ajax_nopriv_process_form_submission', array( $this, 'process_form_submission' ), 10 );
15
+		add_action( 'wp_ajax_process_form_submission', array( $this, 'process_form_submission' ), 10 );
16 16
 
17 17
 		// ajax send update emails
18
-		add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 );
19
-		add_action( 'wp_ajax_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 );
18
+		add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 );
19
+		add_action( 'wp_ajax_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 );
20 20
 
21 21
 		// increase submission count for a given form on successful submit
22
-		add_action( 'wp_ajax_nopriv_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 );
23
-		add_action( 'wp_ajax_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 );
22
+		add_action( 'wp_ajax_nopriv_increase_submission_count', array( $this, 'increase_submission_count' ), 10 );
23
+		add_action( 'wp_ajax_increase_submission_count', array( $this, 'increase_submission_count' ), 10 );
24 24
 	}
25 25
 
26 26
 	/*
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * Increase the submission count for a given form.
38 38
 	 */
39 39
 	public function increase_submission_count() {
40
-		$form_id   = intval( $_POST['form_id'] );
40
+		$form_id   = intval( $_POST[ 'form_id' ] );
41 41
 		$interface = yikes_easy_mailchimp_extender_get_form_interface();
42 42
 		$form      = $interface->get_form( $form_id );
43 43
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		}
48 48
 
49 49
 		// Update the form.
50
-		$submission_count = isset( $form['submissions'] ) ? $form['submissions'] + 1 : 1;
50
+		$submission_count = isset( $form[ 'submissions' ] ) ? $form[ 'submissions' ] + 1 : 1;
51 51
 		$interface->update_form_field( $form_id, 'submissions', $submission_count );
52 52
 
53 53
 		exit();
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 		@since v6.0.4.1
59 59
 	*/
60 60
 	public function sendUpdateProfileEmail() {
61
-		$user_email    = $_POST['user_email'];
61
+		$user_email    = $_POST[ 'user_email' ];
62 62
 		$user_id       = md5( $user_email );
63
-		$list_id       = $_POST['list_id'];
63
+		$list_id       = $_POST[ 'list_id' ];
64 64
 		$full_site_url = get_bloginfo( 'url' );
65 65
 		$manager       = yikes_get_mc_api_manager();
66 66
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 				"class.public_ajax.php"
78 78
 			);
79 79
 			$is_error = true;
80
-			$errors[] = $list_details->get_error_message();
80
+			$errors[ ] = $list_details->get_error_message();
81 81
 		}
82 82
 
83 83
 		// account details api call
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
87 87
 			$error_logging->maybe_write_to_log( $account_details->get_error_code(), __( "Send Update Profile Email - Get Account Details", 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
88 88
 			$is_error = true;
89
-			$errors[] = $account_details->get_error_message();
89
+			$errors[ ] = $account_details->get_error_message();
90 90
 		}
91 91
 
92 92
 		// subscriber details api call
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
96 96
 			$error_logging->maybe_write_to_log( $subscriber_account_details->get_error_code(), __( "Send Update Profile Email - Get Member Info.", 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
97 97
 			$is_error = true;
98
-			$errors[] = $subscriber_account_details->get_error_message();
98
+			$errors[ ] = $subscriber_account_details->get_error_message();
99 99
 		}
100 100
 
101 101
 		// check for errors in any of the calls
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
 		}
113 113
 
114 114
 		// send the email!
115
-		$subscriber_id = $subscriber_account_details['unique_email_id'];
116
-		$update_link_href = str_replace( '/subscribe', '/profile', $list_details['subscribe_url_long'] );
115
+		$subscriber_id = $subscriber_account_details[ 'unique_email_id' ];
116
+		$update_link_href = str_replace( '/subscribe', '/profile', $list_details[ 'subscribe_url_long' ] );
117 117
 		$update_link_href = add_query_arg( 'e', $subscriber_id, $update_link_href );
118 118
 		$subject          = 'MailChimp Profile Update';
119
-		$headers          = 'From: ' . $list_details['campaign_defaults']['from_name'] . ' <' . $list_details['campaign_defaults']['from_email'] . '>' . "\r\n";
119
+		$headers          = 'From: ' . $list_details[ 'campaign_defaults' ][ 'from_name' ] . ' <' . $list_details[ 'campaign_defaults' ][ 'from_email' ] . '>' . "\r\n";
120 120
 		$headers .= 'Content-type: text/html';
121 121
 		$email_content = '<p>Greetings,</p> <p>A request has been made to update your MailChimp account profile information. To do so please use the following link: <a href="' . $update_link_href . '" title="Update MailChimp Profile">Update MailChimp Profile Info.</a>';
122 122
 		$email_content .= "<p>If you did not request this update, please disregard this email.</p>";
Please login to merge, or discard this patch.
public/partials/shortcodes/process/process_form_submission.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -192,11 +192,11 @@
 block discarded – undo
192 192
 	$merge_variables = apply_filters( 'yikes-mailchimp-before-submission-' . $form_id, $merge_variables );
193 193
 
194 194
 	/**
195
-	* Action hooks fired before API request
196
-	* @since 6.0.5.5
197
-	* @param $merge_variables 	array 	Array of merge variable to use
198
-	* @param $form_id						integer	The form ID to target (eg: 1, 2 etc.)
199
-	*/
195
+	 * Action hooks fired before API request
196
+	 * @since 6.0.5.5
197
+	 * @param $merge_variables 	array 	Array of merge variable to use
198
+	 * @param $form_id						integer	The form ID to target (eg: 1, 2 etc.)
199
+	 */
200 200
 	do_action( 'yikes-mailchimp-before-submission', $merge_variables );
201 201
 	do_action( 'yikes-mailchimp-before-submission-' . $form_id, $merge_variables );
202 202
 
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 global $form_submitted, $process_submission_response;
9 9
 
10 10
 // confirm we have a form id to work with
11
-$form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? $_POST['yikes-mailchimp-submitted-form'] : false;
11
+$form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? $_POST[ 'yikes-mailchimp-submitted-form' ] : false;
12 12
 
13 13
 if ( ! $form_id ) {
14 14
 
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
 
17 17
 }
18 18
 
19
-$list_id = $_POST['yikes-mailchimp-associated-list-id'];
19
+$list_id = $_POST[ 'yikes-mailchimp-associated-list-id' ];
20 20
 
21
-$form_settings = Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $_POST['yikes-mailchimp-submitted-form'] );
21
+$form_settings = Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $_POST[ 'yikes-mailchimp-submitted-form' ] );
22 22
 
23
-$replace_interests    = isset( $form_settings['submission_settings']['replace_interests'] ) ? (bool) $form_settings['submission_settings']['replace_interests'] : true;
23
+$replace_interests = isset( $form_settings[ 'submission_settings' ][ 'replace_interests' ] ) ? (bool) $form_settings[ 'submission_settings' ][ 'replace_interests' ] : true;
24 24
 
25 25
 $groups = array();
26 26
 
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 
30 30
 	$list_handler = yikes_get_mc_api_manager()->get_list_handler();
31 31
 
32
-	$interest_groupings = $list_handler->get_interest_categories( $_POST['yikes-mailchimp-associated-list-id'] );
32
+	$interest_groupings = $list_handler->get_interest_categories( $_POST[ 'yikes-mailchimp-associated-list-id' ] );
33 33
 
34 34
 	foreach ( $interest_groupings as $group_id => $group_data ) {
35 35
 
36
-		foreach ( $group_data['items'] as $item_id => $item_data ) {
36
+		foreach ( $group_data[ 'items' ] as $item_id => $item_data ) {
37 37
 
38 38
 			$groups[ $item_id ] = false;
39 39
 
@@ -42,39 +42,39 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 // Process our form submissions (non ajax forms)
45
-if ( ! isset( $_POST['yikes_easy_mc_new_subscriber'] ) || ! wp_verify_nonce( $_POST['yikes_easy_mc_new_subscriber'], 'yikes_easy_mc_form_submit' ) ) {
45
+if ( ! isset( $_POST[ 'yikes_easy_mc_new_subscriber' ] ) || ! wp_verify_nonce( $_POST[ 'yikes_easy_mc_new_subscriber' ], 'yikes_easy_mc_form_submit' ) ) {
46 46
 
47
-	$process_submission_response = '<p><small class="form_submission_error">' . __( "Error : Sorry, the nonce security check didn't pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt." , 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
47
+	$process_submission_response = '<p><small class="form_submission_error">' . __( "Error : Sorry, the nonce security check didn't pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.", 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
48 48
 
49 49
 	return;
50 50
 
51 51
 } else {
52 52
 
53 53
 	/* Check for Honeypot filled */
54
-	$honey_pot_filled = ( isset( $_POST['yikes-mailchimp-honeypot'] ) && '' !== $_POST['yikes-mailchimp-honeypot'] ) ? true : false;
54
+	$honey_pot_filled = ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && '' !== $_POST[ 'yikes-mailchimp-honeypot' ] ) ? true : false;
55 55
 
56 56
 	// if it was filled out, return an error...
57 57
 	if ( $honey_pot_filled ) {
58 58
 
59
-		$process_submission_response = '<p><small class="form_submission_error">' . __( 'Error: It looks like the honeypot was filled out and the form was not properly be submitted.' , 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
59
+		$process_submission_response = '<p><small class="form_submission_error">' . __( 'Error: It looks like the honeypot was filled out and the form was not properly be submitted.', 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
60 60
 
61 61
 		return;
62 62
 
63 63
 	}
64 64
 
65 65
 	// Check reCAPTCHA Response
66
-	if ( isset( $_POST['g-recaptcha-response'] ) ) {
66
+	if ( isset( $_POST[ 'g-recaptcha-response' ] ) ) {
67 67
 
68
-		$url           = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key' , '' ) . '&response=' . $_POST['g-recaptcha-response'] . '&remoteip=' . $_SERVER['REMOTE_ADDR'] );
68
+		$url           = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $_POST[ 'g-recaptcha-response' ] . '&remoteip=' . $_SERVER[ 'REMOTE_ADDR' ] );
69 69
 		$response      = wp_remote_get( $url );
70
-		$response_body = json_decode( $response['body'] , true );
70
+		$response_body = json_decode( $response[ 'body' ], true );
71 71
 
72 72
 		// if we've hit an error, lets return the error!
73
-		if ( 1 !== $response_body['success'] ) {
73
+		if ( 1 !== $response_body[ 'success' ] ) {
74 74
 
75 75
 			$recaptcha_error = array(); // empty array to store error messages
76 76
 
77
-			foreach ( $response_body['error-codes'] as $error_code ) {
77
+			foreach ( $response_body[ 'error-codes' ] as $error_code ) {
78 78
 
79 79
 				if ( 'missing-input-response' === $error_code ) {
80 80
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 
83 83
 				}
84 84
 
85
-				$recaptcha_error[] = $error_code;
85
+				$recaptcha_error[ ] = $error_code;
86 86
 
87 87
 			}
88 88
 
89
-			$process_submission_response .= "<p class='yikes-easy-mc-error-message'>" . apply_filters( 'yikes-mailchimp-recaptcha-required-error', __( 'Error' , 'yikes-inc-easy-mailchimp-extender' ) . ': ' . implode( ' ' , $recaptcha_error ) ) . '</p>';
89
+			$process_submission_response .= "<p class='yikes-easy-mc-error-message'>" . apply_filters( 'yikes-mailchimp-recaptcha-required-error', __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . implode( ' ', $recaptcha_error ) ) . '</p>';
90 90
 
91 91
 			return;
92 92
 
@@ -98,18 +98,18 @@  discard block
 block discarded – undo
98 98
 	*	No HTML5 validation, and don't want to use jQuery for non-ajax forms
99 99
 	*/
100 100
 	$missing_required_checkbox_interest_groups = array();
101
-	foreach ( $form_settings['fields'] as $merge_tag => $field_data ) {
101
+	foreach ( $form_settings[ 'fields' ] as $merge_tag => $field_data ) {
102 102
 
103
-		if ( isset( $field_data['group_id'] ) ) {
103
+		if ( isset( $field_data[ 'group_id' ] ) ) {
104 104
 
105 105
 			// check if the checkbox group was set to required, if so return an error
106
-			if ( isset( $field_data['require'] ) && 1 === $field_data['require'] ) {
106
+			if ( isset( $field_data[ 'require' ] ) && 1 === $field_data[ 'require' ] ) {
107 107
 
108
-				if ( 'checkboxes' === $field_data['type'] ) {
108
+				if ( 'checkboxes' === $field_data[ 'type' ] ) {
109 109
 
110 110
 					if ( ! isset( $_POST[ $merge_tag ] ) ) {
111 111
 
112
-						$missing_required_checkbox_interest_groups[] = $merge_tag;
112
+						$missing_required_checkbox_interest_groups[ ] = $merge_tag;
113 113
 
114 114
 					}
115 115
 				}
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 
136 136
 			// check if the current iteration has a 'date_format' key set
137 137
 			// (aka - date/birthday fields)
138
-			if ( isset( $form_settings['fields'][ $merge_tag ]['date_format'] ) ) {
138
+			if ( isset( $form_settings[ 'fields' ][ $merge_tag ][ 'date_format' ] ) ) {
139 139
 
140 140
 				// check if EU date format
141
-				if ( 'DD/MM/YYYY' === $form_settings['fields'][ $merge_tag ]['date_format'] || 'DD/MM' === $form_settings['fields'][ $merge_tag ]['date_format'] ) {
141
+				if ( 'DD/MM/YYYY' === $form_settings[ 'fields' ][ $merge_tag ][ 'date_format' ] || 'DD/MM' === $form_settings[ 'fields' ][ $merge_tag ][ 'date_format' ] ) {
142 142
 
143 143
 					// convert '/' to '.' and to UNIX timestamp
144 144
 					$value = ( '' != $value ) ? str_replace( '/', '.', $value ) : '';
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	}
179 179
 
180 180
 	// store the opt-in time
181
-	$merge_variables['optin_time'] = current_time( 'Y-m-d H:i:s', 1 );
181
+	$merge_variables[ 'optin_time' ] = current_time( 'Y-m-d H:i:s', 1 );
182 182
 
183 183
 	/*
184 184
 	*	yikes-mailchimp-before-submission
@@ -204,22 +204,22 @@  discard block
 block discarded – undo
204 204
 	*	Allow users to check for submit value
205 205
 	*	and pass back an error to the user
206 206
 	*/
207
-	if ( isset( $merge_variables['error'] ) ) {
207
+	if ( isset( $merge_variables[ 'error' ] ) ) {
208 208
 
209
-		$process_submission_response = apply_filters( 'yikes-mailchimp-frontend-content' , $merge_variables['message'] );
209
+		$process_submission_response = apply_filters( 'yikes-mailchimp-frontend-content', $merge_variables[ 'message' ] );
210 210
 
211 211
 		return;
212 212
 
213 213
 	}
214 214
 
215 215
 	$member_data = array(
216
-		'email_address' => sanitize_email( $_POST['EMAIL'] ),
216
+		'email_address' => sanitize_email( $_POST[ 'EMAIL' ] ),
217 217
 		'merge_fields'  => $merge_variables,
218 218
 		'interests'     => $groups,
219 219
 		'status'        => 'subscribed',
220 220
 	);
221 221
 
222
-	$subscribe_response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, md5( strtolower( sanitize_email( $_POST['EMAIL'] ) ) ), $member_data );
222
+	$subscribe_response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, md5( strtolower( sanitize_email( $_POST[ 'EMAIL' ] ) ) ), $member_data );
223 223
 
224 224
 	if ( is_wp_error( $subscribe_response ) ) {
225 225
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
229 229
 
230
-		$error_logging->maybe_write_to_log( $error_message, __( 'New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ), 'process_form_submission.php' );
230
+		$error_logging->maybe_write_to_log( $error_message, __( 'New Subscriber', 'yikes-inc-easy-mailchimp-extender' ), 'process_form_submission.php' );
231 231
 
232 232
 		$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $error_message . '</p>';
233 233
 
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
 	$form_submitted = 1;
240 240
 
241 241
 	// Display the success message
242
-	if ( ! empty( $form_settings['error_messages']['success'] ) ) {
242
+	if ( ! empty( $form_settings[ 'error_messages' ][ 'success' ] ) ) {
243 243
 
244
-		$process_submission_response = '<p class="yikes-easy-mc-success-message">' . apply_filters( 'yikes-mailchimp-success-response', stripslashes( esc_html( $form_settings['error_messages']['success'] ) ), $form_id, $merge_variables ) . '</p>';
244
+		$process_submission_response = '<p class="yikes-easy-mc-success-message">' . apply_filters( 'yikes-mailchimp-success-response', stripslashes( esc_html( $form_settings[ 'error_messages' ][ 'success' ] ) ), $form_id, $merge_variables ) . '</p>';
245 245
 
246 246
 	} else {
247 247
 
248
-		$default_success_response    = ( 1 === $form_settings['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' );
248
+		$default_success_response    = ( 1 === $form_settings[ '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' );
249 249
 		$process_submission_response = '<p class="yikes-easy-mc-success-message">' . apply_filters( 'yikes-mailchimp-success-response', $default_success_response, $form_id, $merge_variables ) . '</p>';
250 250
 
251 251
 	}
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 	* 	optional @form - the ID of the form to filter
259 259
 	*	@since 6.0.0
260 260
 	*/
261
-	do_action( 'yikes-mailchimp-after-submission' , $merge_variables );
262
-	do_action( 'yikes-mailchimp-after-submission-' . $form_id , $merge_variables );
261
+	do_action( 'yikes-mailchimp-after-submission', $merge_variables );
262
+	do_action( 'yikes-mailchimp-after-submission-' . $form_id, $merge_variables );
263 263
 
264 264
 	/*
265 265
 	*	Non-AJAX redirects now handled in class-yikes-inc-easy-mailchimp-extender-public.php
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 	*	@$notifications - the notification array
278 278
 	*	@since 6.0.0
279 279
 	*/
280
-	do_action( 'yikes-mailchimp-form-submission' , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] );
281
-	do_action( 'yikes-mailchimp-form-submission-' . $form_id , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] );
280
+	do_action( 'yikes-mailchimp-form-submission', $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] );
281
+	do_action( 'yikes-mailchimp-form-submission-' . $form_id, $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] );
282 282
 
283 283
 	/*
284 284
 		*	yikes-mailchimp-after-submission
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 		* 	optional @form - the ID of the form to filter
289 289
 		*	@since 6.0.0
290 290
 		*/
291
-		do_action( 'yikes-mailchimp-after-submission' , $merge_variables );
292
-		do_action( 'yikes-mailchimp-after-submission-' . $form_id , $merge_variables );
291
+		do_action( 'yikes-mailchimp-after-submission', $merge_variables );
292
+		do_action( 'yikes-mailchimp-after-submission-' . $form_id, $merge_variables );
293 293
 		/*
294 294
 		*	Non-AJAX redirects now handled in class-yikes-inc-easy-mailchimp-extender-public.php
295 295
 		*	function: redirect_user_non_ajax_forms
@@ -305,15 +305,15 @@  discard block
 block discarded – undo
305 305
 		*	@$notifications - the notification array
306 306
 		*	@since 6.0.0
307 307
 		*/
308
-		do_action( 'yikes-mailchimp-form-submission' , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] );
309
-		do_action( 'yikes-mailchimp-form-submission-' . $form_id , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] );
308
+		do_action( 'yikes-mailchimp-form-submission', $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] );
309
+		do_action( 'yikes-mailchimp-form-submission-' . $form_id, $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] );
310 310
 		/*
311 311
 		*	Increase the submission count for this form
312 312
 		*	on a successful submission
313 313
 		*	@since 6.0.0
314 314
 		*/
315 315
 		$interface   = yikes_easy_mailchimp_extender_get_form_interface();
316
-		$submissions = $form_settings['submissions'] + 1;
316
+		$submissions = $form_settings[ 'submissions' ] + 1;
317 317
 		$interface->update_form_field( $form_id, 'submissions', $submissions );
318 318
 
319 319
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -151,7 +151,8 @@  discard block
 block discarded – undo
151 151
 				}
152 152
 			}
153 153
 
154
-			if ( strpos( $merge_tag, 'group-' ) !== false ) { // this is is an interest group!
154
+			if ( strpos( $merge_tag, 'group-' ) !== false ) {
155
+// this is is an interest group!
155 156
 
156 157
 				$tag = str_replace( 'group-', '', $merge_tag );
157 158
 
@@ -169,7 +170,8 @@  discard block
 block discarded – undo
169 170
 
170 171
 				$groups[ $value ] = true;
171 172
 
172
-			} else { // or else it's just a standard merge variable
173
+			} else {
174
+// or else it's just a standard merge variable
173 175
 
174 176
 				$merge_variables[ $merge_tag ] = $value;
175 177
 
Please login to merge, or discard this patch.
public/partials/shortcodes/process/process_form_submission_ajax.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@  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
 
10 10
 // store the form ID to use in our hooks and filters
11
-$form = $_POST['form_id'];
11
+$form = $_POST[ 'form_id' ];
12 12
 
13 13
 $interface = yikes_easy_mailchimp_extender_get_form_interface();
14 14
 $form_data = $interface->get_form( $form );
@@ -16,29 +16,29 @@  discard block
 block discarded – undo
16 16
 if ( $form_data ) {
17 17
 
18 18
 	// List ID
19
-	$list_id = $form_data['list_id'];
19
+	$list_id = $form_data[ 'list_id' ];
20 20
 
21 21
 	// decode our submission settings
22
-	$submission_settings = $form_data['submission_settings'];
22
+	$submission_settings = $form_data[ 'submission_settings' ];
23 23
 
24 24
 	// decode our optin settings
25
-	$optin_settings = $form_data['optin_settings'];
25
+	$optin_settings = $form_data[ 'optin_settings' ];
26 26
 
27 27
 	// decode our fields
28
-	$form_fields = $form_data['fields'];
28
+	$form_fields = $form_data[ 'fields' ];
29 29
 
30 30
 	/**
31 31
 	 * Decode our error messages
32 32
 	 * Workaround for international characters (cyrillic etc)
33 33
 	 * See: https://wordpress.org/support/topic/custom-messages-do-not-support-cyrillic-characters?replies=11#post-7629620
34 34
 	 */
35
-	$error_messages = $form_data['error_messages'];
35
+	$error_messages = $form_data[ 'error_messages' ];
36 36
 
37 37
 	/** Submit Process **/
38
-	$notifications = isset( $form_data['custom_notifications'] ) ? $form_data['custom_notifications'] : array();
38
+	$notifications = isset( $form_data[ 'custom_notifications' ] ) ? $form_data[ 'custom_notifications' ] : array();
39 39
 
40 40
 	/* Page Data */
41
-	$page_data = $_POST['page_data'];
41
+	$page_data = $_POST[ 'page_data' ];
42 42
 
43 43
 }
44 44
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 $error = 0;
50 50
 
51 51
 /* Check for Honeypot filled */
52
-$honey_pot_filled = ( isset( $data['yikes-mailchimp-honeypot'] ) && '' !== $data['yikes-mailchimp-honeypot'] ) ? true : false;
52
+$honey_pot_filled = ( isset( $data[ 'yikes-mailchimp-honeypot' ] ) && '' !== $data[ 'yikes-mailchimp-honeypot' ] ) ? true : false;
53 53
 
54 54
 // if it was filled out, return an error...
55 55
 if ( $honey_pot_filled ) {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	wp_send_json_error( array(
58 58
 		'hide' => '0',
59 59
 		'error' => 1,
60
-		'response' => __( 'Error: It looks like the honeypot was filled out and the form was not properly submitted.' , 'yikes-inc-easy-mailchimp-extender' ),
60
+		'response' => __( 'Error: It looks like the honeypot was filled out and the form was not properly submitted.', 'yikes-inc-easy-mailchimp-extender' ),
61 61
 	) );
62 62
 
63 63
 	return;
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
 }
66 66
 
67 67
 // Check reCAPTCHA Response was submitted with the form data
68
-if ( isset( $data['g-recaptcha-response'] ) ) {
68
+if ( isset( $data[ 'g-recaptcha-response' ] ) ) {
69 69
 
70
-	$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'] );
70
+	$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' ] );
71 71
 	$response      = wp_remote_get( $url );
72
-	$response_body = json_decode( $response['body'] , true );
72
+	$response_body = json_decode( $response[ 'body' ], true );
73 73
 
74 74
 	// if we've hit an error, lets return the error!
75
-	if ( 1 !== $response_body['success'] ) {
75
+	if ( 1 !== $response_body[ 'success' ] ) {
76 76
 
77 77
 		$error_messages = array(); // empty array to store error messages
78 78
 
79
-		if ( isset( $response_body['error-codes'] ) ) {
79
+		if ( isset( $response_body[ 'error-codes' ] ) ) {
80 80
 
81
-			foreach ( $response_body['error-codes'] as $error_code ) {
81
+			foreach ( $response_body[ 'error-codes' ] as $error_code ) {
82 82
 
83 83
 				if ( 'missing-input-response' === $error_code ) {
84 84
 
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 
87 87
 				}
88 88
 
89
-				$error_messages[] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code;
89
+				$error_messages[ ] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code;
90 90
 
91 91
 			}
92 92
 		} else {
93 93
 
94
-			$error_messages[] = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' );
94
+			$error_messages[ ] = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' );
95 95
 
96 96
 		}
97 97
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	}
109 109
 }
110 110
 
111
-$replace_interests = isset( $submission_settings['replace_interests'] ) ? (bool) $submission_settings['replace_interests'] : true;
111
+$replace_interests = isset( $submission_settings[ 'replace_interests' ] ) ? (bool) $submission_settings[ 'replace_interests' ] : true;
112 112
 
113 113
 $groups = array();
114 114
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 	foreach ( $interest_groupings as $group_id => $group_data ) {
123 123
 
124
-		foreach ( $group_data['items'] as $item_id => $item_data ) {
124
+		foreach ( $group_data[ 'items' ] as $item_id => $item_data ) {
125 125
 
126 126
 			$groups[ $item_id ] = false;
127 127
 
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
 
137 137
 		// check if the current iteration has a 'date_format' key set
138 138
 		// (aka - date/birthday fields)
139
-		if ( isset( $form_fields[ $merge_tag ]['date_format'] ) ) {
139
+		if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) {
140 140
 
141 141
 			// check if EU date format
142
-			if ( 'DD/MM/YYYY' === $form_fields[ $merge_tag ]['date_format'] || 'DD/MM' === $form_fields[ $merge_tag ]['date_format'] ) {
142
+			if ( 'DD/MM/YYYY' === $form_fields[ $merge_tag ][ 'date_format' ] || 'DD/MM' === $form_fields[ $merge_tag ][ 'date_format' ] ) {
143 143
 
144 144
 				// convert '/' to '.' and to UNIX timestamp
145 145
 				$value = ( '' != $value ) ? str_replace( '/', '.', $value ) : '';
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	}
180 180
 }
181 181
 // store the opt-in time
182
-$merge_variables['timestamp_opt'] = current_time( 'Y-m-d H:i:s', 1 );
182
+$merge_variables[ 'timestamp_opt' ] = current_time( 'Y-m-d H:i:s', 1 );
183 183
 
184 184
 /*
185 185
 *	yikes-mailchimp-before-submission
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
 *	Allow users to check for submit value
204 204
 *	and pass back an error to the user
205 205
 */
206
-if ( isset( $merge_variables['error'] ) ) {
206
+if ( isset( $merge_variables[ 'error' ] ) ) {
207 207
 
208 208
 	// send our error response back
209 209
 	wp_send_json_error(
210 210
 		array(
211 211
 			'hide'     => '0',
212
-			'error'    => $merge_variables['error'],
213
-			'response' => $merge_variables['message'],
212
+			'error'    => $merge_variables[ 'error' ],
213
+			'response' => $merge_variables[ 'message' ],
214 214
 		)
215 215
 	);
216 216
 
@@ -219,13 +219,13 @@  discard block
 block discarded – undo
219 219
 }
220 220
 
221 221
 $member_data = array(
222
-	'email_address' => sanitize_email( $data['EMAIL'] ),
222
+	'email_address' => sanitize_email( $data[ 'EMAIL' ] ),
223 223
 	'merge_fields'  => $merge_variables,
224 224
 	'interests'     => $groups,
225 225
 	'status'        => 'subscribed',
226 226
 );
227 227
 
228
-$subscribe_response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, md5( strtolower( sanitize_email( $data['EMAIL'] ) ) ), $member_data );
228
+$subscribe_response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, md5( strtolower( sanitize_email( $data[ 'EMAIL' ] ) ) ), $member_data );
229 229
 
230 230
 if ( is_wp_error( $subscribe_response ) ) {
231 231
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
235 235
 
236
-	$error_logging->maybe_write_to_log( $error_message, __( 'New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ), 'process_form_submission.php' );
236
+	$error_logging->maybe_write_to_log( $error_message, __( 'New Subscriber', 'yikes-inc-easy-mailchimp-extender' ), 'process_form_submission.php' );
237 237
 
238 238
 	$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $error_message . '</p>';
239 239
 
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
 /*
256 256
 *	Successful form submission redirect
257 257
 */
258
-if ( '1' === $submission_settings['redirect_on_submission'] ) {
258
+if ( '1' === $submission_settings[ 'redirect_on_submission' ] ) {
259 259
 
260 260
 	$redirection = '1';
261 261
 
262
-	$redirect_url = ( 'custom_url' != $submission_settings['redirect_page'] ) ? get_permalink( $submission_settings['redirect_page'] ) : $submission_settings['custom_redirect_url'];
262
+	$redirect_url = ( 'custom_url' != $submission_settings[ 'redirect_page' ] ) ? get_permalink( $submission_settings[ 'redirect_page' ] ) : $submission_settings[ 'custom_redirect_url' ];
263 263
 
264 264
 	$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>';
265 265
 
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
 do_action( 'yikes-mailchimp-after-submission-' . $form, $merge_variables );
278 278
 
279 279
 // send our notifications if setup (must go before wp_send_json())
280
-do_action( 'yikes-mailchimp-form-submission' , sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications );
281
-do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications );
280
+do_action( 'yikes-mailchimp-form-submission', sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications );
281
+do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications );
282 282
 
283
-$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' );
283
+$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' );
284 284
 
285 285
 wp_send_json_success(
286 286
 	array(
287
-		'hide' => $submission_settings['hide_form_post_signup'],
287
+		'hide' => $submission_settings[ 'hide_form_post_signup' ],
288 288
 		'error' => $error,
289
-		'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages['success'] ) ? $error_messages['success'] : $default_success_response ), $form, $merge_variables ),
289
+		'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages[ 'success' ] ) ? $error_messages[ 'success' ] : $default_success_response ), $form, $merge_variables ),
290 290
 		'redirection' => isset( $redirection ) ? '1' : '0',
291 291
 		'redirect' => isset( $redirect ) ? $redirect : '',
292 292
 	)
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -153,7 +153,8 @@  discard block
 block discarded – undo
153 153
 
154 154
 		}
155 155
 
156
-		if ( strpos( $merge_tag, 'group-' ) !== false ) { // this is is an interest group!
156
+		if ( strpos( $merge_tag, 'group-' ) !== false ) {
157
+// this is is an interest group!
157 158
 
158 159
 			$tag = str_replace( 'group-', '', $merge_tag );
159 160
 
@@ -171,7 +172,8 @@  discard block
 block discarded – undo
171 172
 
172 173
 			$groups[ $value ] = true;
173 174
 
174
-		} else { // or else it's just a standard merge variable
175
+		} else {
176
+// or else it's just a standard merge variable
175 177
 
176 178
 			$merge_variables[ $merge_tag ] = $value;
177 179
 
Please login to merge, or discard this patch.