Completed
Push — staging ( 8d1e38...561133 )
by Evan
17:42
created
public/partials/ajax/class.public_ajax.php 1 patch
Spacing   +42 added lines, -42 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
 		/*
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
 		*/
41 41
 		public function increase_submission_count() {
42 42
 			// store our posted form ID
43
-			$form_id = $_POST['form_id'];
43
+			$form_id = $_POST[ 'form_id' ];
44 44
 			global $wpdb;
45 45
 			// query the form
46 46
 			$form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms WHERE id = ' . $form_id . '', ARRAY_A );
47
-			$form_data = $form_results[0];
47
+			$form_data = $form_results[ 0 ];
48 48
 			// increase the submission
49
-			$form_data['submissions']++;
49
+			$form_data[ 'submissions' ]++;
50 50
 			// update the value in the database
51 51
 			$wpdb->update(
52 52
 				$wpdb->prefix . 'yikes_easy_mc_forms',
53 53
 					array(
54
-						'submissions' => $form_data['submissions'],
54
+						'submissions' => $form_data[ 'submissions' ],
55 55
 					),
56 56
 					array( 'ID' => $form_id ),
57 57
 					array(
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
 			@since v6.0.4.1
69 69
 		*/
70 70
 		public function sendUpdateProfileEmail() {
71
-			$user_email = $_POST['user_email'];
72
-			$list_id = $_POST['list_id'];
71
+			$user_email = $_POST[ 'user_email' ];
72
+			$list_id = $_POST[ 'list_id' ];
73 73
 
74
-			$api_key = trim( get_option( 'yikes-mc-api-key' , '' ) );
74
+			$api_key = trim( get_option( 'yikes-mc-api-key', '' ) );
75 75
 			$dash_position = strpos( $api_key, '-' );
76
-			$explode_key = explode( '-' , $api_key );
77
-			$data_center = $explode_key[1];
78
-			$full_site_url = get_bloginfo('url');
76
+			$explode_key = explode( '-', $api_key );
77
+			$data_center = $explode_key[ 1 ];
78
+			$full_site_url = get_bloginfo( 'url' );
79 79
 
80 80
 			// list details api call
81
-			if( $dash_position !== false ) {
81
+			if ( $dash_position !== false ) {
82 82
 				$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json';
83 83
 			}
84 84
 			$list_details = wp_remote_post( $api_endpoint, array(
@@ -92,16 +92,16 @@  discard block
 block discarded – undo
92 92
 				'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
93 93
 			) );
94 94
 			$list_details = json_decode( wp_remote_retrieve_body( $list_details ), true );
95
-			if( isset( $list_details['error'] ) ) {
96
-				if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
95
+			if ( isset( $list_details[ 'error' ] ) ) {
96
+				if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
97 97
 					require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
98 98
 					$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
99
-					$error_logging->yikes_easy_mailchimp_write_to_error_log( $list_details['error'], __( "Send Update Profile Email - Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
99
+					$error_logging->yikes_easy_mailchimp_write_to_error_log( $list_details[ 'error' ], __( "Send Update Profile Email - Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
100 100
 				}
101 101
 			}
102 102
 
103 103
 			// account details api call
104
-			if( $dash_position !== false ) {
104
+			if ( $dash_position !== false ) {
105 105
 				$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/helper/account-details.json';
106 106
 			}
107 107
 			$account_details = wp_remote_post( $api_endpoint, array(
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
 				'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
113 113
 			) );
114 114
 			$account_details = json_decode( wp_remote_retrieve_body( $account_details ), true );
115
-			if( isset( $account_details['error'] ) ) {
116
-				if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
115
+			if ( isset( $account_details[ 'error' ] ) ) {
116
+				if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
117 117
 					require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
118 118
 					$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
119
-					$error_logging->yikes_easy_mailchimp_write_to_error_log( $account_details['error'], __( "Send Update Profile Email - Get Account Details" , 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
119
+					$error_logging->yikes_easy_mailchimp_write_to_error_log( $account_details[ 'error' ], __( "Send Update Profile Email - Get Account Details", 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
120 120
 				}
121 121
 			}
122 122
 
123 123
 			// subscriber details api call
124
-			if( $dash_position !== false ) {
124
+			if ( $dash_position !== false ) {
125 125
 				$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/member-info.json';
126 126
 			}
127 127
 			$subscriber_account_details = wp_remote_post( $api_endpoint, array(
@@ -136,27 +136,27 @@  discard block
 block discarded – undo
136 136
 				'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
137 137
 			) );
138 138
 			$subscriber_account_details = json_decode( wp_remote_retrieve_body( $subscriber_account_details ), true );
139
-			if( isset( $subscriber_account_details['error'] ) ) {
140
-				if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
139
+			if ( isset( $subscriber_account_details[ 'error' ] ) ) {
140
+				if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
141 141
 					require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
142 142
 					$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
143
-					$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscriber_account_details['error'], __( "Send Update Profile Email - Get Member Info." , 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
143
+					$error_logging->yikes_easy_mailchimp_write_to_error_log( $subscriber_account_details[ 'error' ], __( "Send Update Profile Email - Get Member Info.", 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
144 144
 				}
145 145
 			}
146 146
 
147 147
 			// check for errors in any of the calls
148
-			if( isset( $list_details['error'] ) || isset( $account_details['error'] ) || isset( $subscriber_account_details['error'] ) ) {
149
-				$error_message = ( isset( $list_details['error'] ) ) ? $list_details['error'] : false;
150
-				if( ! $error_message ) {
151
-					$error_message = ( isset( $account_details['error'] ) ) ? $account_details['error'] : false;
152
-					if( ! $error_message ) {
153
-						$error_message = ( isset( $subscriber_account_details['error'] ) ) ? $subscriber_account_details['error'] : false;
154
-						if( ! $error_message ) {
148
+			if ( isset( $list_details[ 'error' ] ) || isset( $account_details[ 'error' ] ) || isset( $subscriber_account_details[ 'error' ] ) ) {
149
+				$error_message = ( isset( $list_details[ 'error' ] ) ) ? $list_details[ 'error' ] : false;
150
+				if ( ! $error_message ) {
151
+					$error_message = ( isset( $account_details[ 'error' ] ) ) ? $account_details[ 'error' ] : false;
152
+					if ( ! $error_message ) {
153
+						$error_message = ( isset( $subscriber_account_details[ 'error' ] ) ) ? $subscriber_account_details[ 'error' ] : false;
154
+						if ( ! $error_message ) {
155 155
 							$error_message = '';
156 156
 						}
157 157
 					}
158 158
 				}
159
-				$errorMessage = sprintf( __( 'Error sending update profile email. <strong>Error: %s</strong>. Please contact the site administrator.' , 'yikes-inc-easy-mailchimp-extender' ), $error_message );
159
+				$errorMessage = sprintf( __( 'Error sending update profile email. <strong>Error: %s</strong>. Please contact the site administrator.', 'yikes-inc-easy-mailchimp-extender' ), $error_message );
160 160
 				wp_send_json_error(
161 161
 					array(
162 162
 						'response_text' => '<div class="yikes-easy-mc-error-message">&#10005; ' . $errorMessage . '</div>',
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
 			}
167 167
 
168 168
 			// send the email!
169
-			$subscriber_id = $subscriber_account_details['data'][0]['id'];
170
-			$explode_url = explode( '.' , $account_details['contact']['url'] );
171
-			$update_link_href = 'http://' . $explode_url[1] . '.' . $data_center . '.list-manage1.com/profile?u=' . $account_details['user_id'] . '&id=' . $list_id .'&e=' . $subscriber_id;
169
+			$subscriber_id = $subscriber_account_details[ 'data' ][ 0 ][ 'id' ];
170
+			$explode_url = explode( '.', $account_details[ 'contact' ][ 'url' ] );
171
+			$update_link_href = 'http://' . $explode_url[ 1 ] . '.' . $data_center . '.list-manage1.com/profile?u=' . $account_details[ 'user_id' ] . '&id=' . $list_id . '&e=' . $subscriber_id;
172 172
 			$subject = 'MailChimp Profile Update';
173
-			$headers = 'From: ' . $list_details['data'][0]['default_from_name'] . ' <' . $list_details['data'][0]['default_from_email'] . '>' . "\r\n";
173
+			$headers = 'From: ' . $list_details[ 'data' ][ 0 ][ 'default_from_name' ] . ' <' . $list_details[ 'data' ][ 0 ][ 'default_from_email' ] . '>' . "\r\n";
174 174
 			$headers .= 'Content-type: text/html';
175 175
 				$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>';
176 176
 				$email_content .= "<p>If you did not request this update, please disregard this email.</p>";
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 			if ( wp_mail( $user_email, apply_filters( 'yikes-mailchimp-update-email-subject', $subject ), apply_filters( 'yikes-mailchimp-update-email-content', $email_content, $update_link_href ), $headers ) ) {
184 184
 				wp_send_json_success(
185 185
 					array(
186
-						'response_text' => '<div class="yikes-easy-mc-success-message">' . sprintf( __( '%s Update email successfully sent. Please check your inbox for the message.' , 'yikes-inc-easy-mailchimp-extender' ), '&#10004;' ) . '</div>',
186
+						'response_text' => '<div class="yikes-easy-mc-success-message">' . sprintf( __( '%s Update email successfully sent. Please check your inbox for the message.', 'yikes-inc-easy-mailchimp-extender' ), '&#10004;' ) . '</div>',
187 187
 					)
188 188
 				);
189 189
 				exit;
190 190
 			} else {
191 191
 				wp_send_json_error(
192 192
 					array(
193
-						'response_text' => '<div class="yikes-easy-mc-error-message">' . sprintf( __( '%s Email failed to send. Please contact the site administrator.' , 'yikes-inc-easy-mailchimp-extender' ), '&#10005;' ) . '</div>',
193
+						'response_text' => '<div class="yikes-easy-mc-error-message">' . sprintf( __( '%s Email failed to send. Please contact the site administrator.', 'yikes-inc-easy-mailchimp-extender' ), '&#10005;' ) . '</div>',
194 194
 					)
195 195
 				);
196 196
 				exit;
Please login to merge, or discard this patch.
public/classes/checkbox-integrations.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 	*/
6 6
 	
7 7
 	// Prevent direct access to the file
8
-	defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) );
8
+	defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) );
9 9
 	
10 10
 	class Yikes_Easy_MC_Checkbox_Integration_Class {
11 11
 	
@@ -25,35 +25,35 @@  discard block
 block discarded – undo
25 25
 		*/
26 26
 		public function is_user_already_subscribed( $integration_type ) {
27 27
 			// first check if the user is logged in
28
-			if( is_user_logged_in() ) {
29
-				$checkbox_options = get_option( 'optin-checkbox-init' , '' );
28
+			if ( is_user_logged_in() ) {
29
+				$checkbox_options = get_option( 'optin-checkbox-init', '' );
30 30
 				$current_user = wp_get_current_user();
31 31
 				$email = $current_user->user_email;
32 32
 
33
-				$api_key = trim( get_option( 'yikes-mc-api-key' , '' ) );
33
+				$api_key = trim( get_option( 'yikes-mc-api-key', '' ) );
34 34
 				$dash_position = strpos( $api_key, '-' );
35
-				if( $dash_position !== false ) {
35
+				if ( $dash_position !== false ) {
36 36
 					$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/member-info.json';
37 37
 				}
38 38
 				$already_subscribed = wp_remote_post( $api_endpoint, array( 
39 39
 					'body' => array( 
40 40
 						'apikey' => $api_key, 
41
-						'id' => $checkbox_options[$integration_type]['associated-list'],
41
+						'id' => $checkbox_options[ $integration_type ][ 'associated-list' ],
42 42
 						'emails' => array( array( 'email' => sanitize_email( $email ) ) )
43 43
 					),
44 44
 					'timeout' => 10,
45 45
 					'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
46 46
 				) );
47 47
 				$already_subscribed = json_decode( wp_remote_retrieve_body( $already_subscribed ), true );	
48
-				if( isset( $already_subscribed['error'] ) ) {	
49
-					if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
48
+				if ( isset( $already_subscribed[ 'error' ] ) ) {	
49
+					if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
50 50
 						require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
51 51
 						$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
52
-						$error_logging->yikes_easy_mailchimp_write_to_error_log( $already_subscribed['error'], __( "Get Member Info" , 'yikes-inc-easy-mailchimp-extender' ), "Checkbox Integrations Page" );
52
+						$error_logging->yikes_easy_mailchimp_write_to_error_log( $already_subscribed[ 'error' ], __( "Get Member Info", 'yikes-inc-easy-mailchimp-extender' ), "Checkbox Integrations Page" );
53 53
 					}
54 54
 				}
55
-				if( ! Isset( $already_subscribed['error'] ) ) {
56
-					return $already_subscribed['success_count'];
55
+				if ( ! Isset( $already_subscribed[ 'error' ] ) ) {
56
+					return $already_subscribed[ 'success_count' ];
57 57
 				}
58 58
 			} else {
59 59
 				// if the user isn't logged in
@@ -69,33 +69,33 @@  discard block
 block discarded – undo
69 69
 		*	@$email - users email address entered into the form
70 70
 		*	@$integration_type - pass in the type of checkbox integration
71 71
 		*/
72
-		public function is_new_registration_already_subscribed( $email , $integration_type ) {
72
+		public function is_new_registration_already_subscribed( $email, $integration_type ) {
73 73
 			// first check if the user is logged in
74
-			$checkbox_options = get_option( 'optin-checkbox-init' , '' );
74
+			$checkbox_options = get_option( 'optin-checkbox-init', '' );
75 75
 			try {
76
-				$api_key = trim( get_option( 'yikes-mc-api-key' , '' ) );
76
+				$api_key = trim( get_option( 'yikes-mc-api-key', '' ) );
77 77
 				$dash_position = strpos( $api_key, '-' );
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/member-info.json';
80 80
 				}
81 81
 				$already_subscribed = wp_remote_post( $api_endpoint, array( 
82 82
 					'body' => array( 
83 83
 						'apikey' => $api_key, 
84
-						'id' => $checkbox_options[$integration_type]['associated-list'],
84
+						'id' => $checkbox_options[ $integration_type ][ 'associated-list' ],
85 85
 						'emails' => array( array( 'email' => sanitize_email( $email ) ) )
86 86
 					),
87 87
 					'timeout' => 10,
88 88
 					'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
89 89
 				) );
90 90
 				$already_subscribed = json_decode( wp_remote_retrieve_body( $already_subscribed ), true );
91
-				if( isset( $already_subscribed['error'] ) ) {	
92
-					if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
91
+				if ( isset( $already_subscribed[ 'error' ] ) ) {	
92
+					if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
93 93
 						require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
94 94
 						$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
95
-						$error_logging->yikes_easy_mailchimp_write_to_error_log( $already_subscribed['error'], __( "Get Member Info" , 'yikes-inc-easy-mailchimp-extender' ), "Checkbox Integrations Page" );
95
+						$error_logging->yikes_easy_mailchimp_write_to_error_log( $already_subscribed[ 'error' ], __( "Get Member Info", 'yikes-inc-easy-mailchimp-extender' ), "Checkbox Integrations Page" );
96 96
 					}
97 97
 				}				
98
-				return $already_subscribed['success_count'];
98
+				return $already_subscribed[ 'success_count' ];
99 99
 			} catch ( Exception $error ) {
100 100
 				return $error->getMessage();
101 101
 			}
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
 			// enqueue our checkbox styles whenever the checkbox is displayed
111 111
 			wp_enqueue_style( 'yikes-easy-mailchimp-checkbox-integration-styles', plugin_dir_url( __FILE__ ) . '../css/yikes-inc-easy-mailchimp-checkbox-integration.min.css' );
112 112
 			// store our options
113
-			$checkbox_options = get_option( 'optin-checkbox-init' , '' );
114
-			if( isset( $checkbox_options[$this->type]['associated-list'] ) && $checkbox_options[$this->type]['associated-list'] != '-' ) {
115
-				$checked = ( $checkbox_options[$this->type]['precheck'] == 'true' ) ? 'checked' : '';
113
+			$checkbox_options = get_option( 'optin-checkbox-init', '' );
114
+			if ( isset( $checkbox_options[ $this->type ][ 'associated-list' ] ) && $checkbox_options[ $this->type ][ 'associated-list' ] != '-' ) {
115
+				$checked = ( $checkbox_options[ $this->type ][ 'precheck' ] == 'true' ) ? 'checked' : '';
116 116
 				// before checkbox HTML (comment, ...)
117 117
 				$before = '<!-- Easy Forms for MailChimp by YIKES, Inc. - https://www.yikesinc.com/ -->';
118 118
 				$before .= apply_filters( 'yikes-mailchimp-before-checkbox-html', '' );
119 119
 				// checkbox
120 120
 				$content = '<p id="yikes-easy-mailchimp-' . $this->type . '-checkbox" class="yikes-easy-mailchimp-' . $this->type . '-checkbox">';
121 121
 					$content .= '<label>';
122
-						$content .= '<input type="checkbox" name="yikes_mailchimp_checkbox_' . $this->type . '" value="1" '. $checked . ' /> ';
123
-						$content .= ( isset( $checkbox_options[$this->type]['label'] ) && trim( $checkbox_options[$this->type]['label'] ) != '' ) ? trim( $checkbox_options[$this->type]['label'] ) : __( 'Sign me up for your mailing list.', 'yikes-inc-easy-mailchimp-extender' );
122
+						$content .= '<input type="checkbox" name="yikes_mailchimp_checkbox_' . $this->type . '" value="1" ' . $checked . ' /> ';
123
+						$content .= ( isset( $checkbox_options[ $this->type ][ 'label' ] ) && trim( $checkbox_options[ $this->type ][ 'label' ] ) != '' ) ? trim( $checkbox_options[ $this->type ][ 'label' ] ) : __( 'Sign me up for your mailing list.', 'yikes-inc-easy-mailchimp-extender' );
124 124
 					$content .= '</label>';
125 125
 				$content .= '</p>';
126 126
 				// after checkbox HTML (..., honeypot, closing comment)
@@ -138,43 +138,43 @@  discard block
 block discarded – undo
138 138
 		**/
139 139
 		public function subscribe_user_integration( $email, $type, $merge_vars ) {			
140 140
 			// get checkbox data
141
-			$checkbox_options = get_option( 'optin-checkbox-init' , '' );
142
-			if( $type != 'registration_form' ) {
141
+			$checkbox_options = get_option( 'optin-checkbox-init', '' );
142
+			if ( $type != 'registration_form' ) {
143 143
 				$update = '1';
144 144
 			} else {
145 145
 				$update = '0';
146 146
 			}
147 147
 			// set ip address
148
-			if( ! isset( $merge_vars['OPTIN_IP'] ) && isset( $_SERVER['REMOTE_ADDR'] ) ) {
149
-				$merge_vars['OPTIN_IP'] = sanitize_text_field( $_SERVER['REMOTE_ADDR'] );
148
+			if ( ! isset( $merge_vars[ 'OPTIN_IP' ] ) && isset( $_SERVER[ 'REMOTE_ADDR' ] ) ) {
149
+				$merge_vars[ 'OPTIN_IP' ] = sanitize_text_field( $_SERVER[ 'REMOTE_ADDR' ] );
150 150
 			}
151 151
 			// set the optin time
152
-			$merge_vars['OPTIN_TIME'] = current_time( 'Y-m-d H:i:s', 1 );
152
+			$merge_vars[ 'OPTIN_TIME' ] = current_time( 'Y-m-d H:i:s', 1 );
153 153
 			// check for interest groups
154
-			$interest_groups = ( isset( $checkbox_options[$type]['interest-groups'] ) ) ? $checkbox_options[$type]['interest-groups'] : false;
154
+			$interest_groups = ( isset( $checkbox_options[ $type ][ 'interest-groups' ] ) ) ? $checkbox_options[ $type ][ 'interest-groups' ] : false;
155 155
 			// if interest groups were found, push them to the merge variable array
156
-			if( $interest_groups ) {
157
-				$merge_vars['groupings'] = array();
158
-				foreach( $interest_groups as $interest_group_id => $interest_group_selections ) {
156
+			if ( $interest_groups ) {
157
+				$merge_vars[ 'groupings' ] = array();
158
+				foreach ( $interest_groups as $interest_group_id => $interest_group_selections ) {
159 159
 					// merge variable interest groups array
160
-					$merge_vars['groupings'][] = array(
160
+					$merge_vars[ 'groupings' ][ ] = array(
161 161
 						'id' => $interest_group_id,
162 162
 						'groups' => $interest_group_selections,
163 163
 					); 	
164 164
 				}
165 165
 				// replace the interest groups - to avoid any errors thrown if the admin switches lists, or interest groups
166
-				$merge_vars['replace_interests'] = 1;
166
+				$merge_vars[ 'replace_interests' ] = 1;
167 167
 			}
168 168
 			// initialize MailChimp API
169
-			$api_key = trim( get_option( 'yikes-mc-api-key' , '' ) );
169
+			$api_key = trim( get_option( 'yikes-mc-api-key', '' ) );
170 170
 			$dash_position = strpos( $api_key, '-' );
171
-			if( $dash_position !== false ) {
171
+			if ( $dash_position !== false ) {
172 172
 				$api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/subscribe.json';
173 173
 			}
174 174
 			$subscribe_response = wp_remote_post( $api_endpoint, array( 
175 175
 				'body' => apply_filters( 'yikes-mailchimp-checkbox-integration-subscribe-api-request', array( 
176
-					'apikey' => get_option( 'yikes-mc-api-key' , '' ),
177
-					'id' => $checkbox_options[$type]['associated-list'],
176
+					'apikey' => get_option( 'yikes-mc-api-key', '' ),
177
+					'id' => $checkbox_options[ $type ][ 'associated-list' ],
178 178
 					'email' => array( 'email' => sanitize_email( $email ) ),
179 179
 					'merge_vars' => apply_filters( 'yikes-mailchimp-checkbox-integration-merge-variables', $merge_vars, $type ), // filter merge variables
180 180
 					'double_optin' => 1,
@@ -184,13 +184,13 @@  discard block
 block discarded – undo
184 184
 				'timeout' => 10,
185 185
 				'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true )
186 186
 			) );
187
-			if( ! Is_wp_error( $subscribe_response ) ) {
187
+			if ( ! Is_wp_error( $subscribe_response ) ) {
188 188
 				$response_body = json_decode( wp_remote_retrieve_body( $subscribe_response ), true );
189
-				if( WP_DEBUG || isset( $response_body['error'] ) ) {	
190
-					if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
189
+				if ( WP_DEBUG || isset( $response_body[ 'error' ] ) ) {	
190
+					if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
191 191
 						require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
192 192
 						$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
193
-						$error_logging->yikes_easy_mailchimp_write_to_error_log( $response_body['error'], __( "Checkbox Integration Subscribe User" , 'yikes-inc-easy-mailchimp-extender' ), "Checkbox Integrations" );
193
+						$error_logging->yikes_easy_mailchimp_write_to_error_log( $response_body[ 'error' ], __( "Checkbox Integration Subscribe User", 'yikes-inc-easy-mailchimp-extender' ), "Checkbox Integrations" );
194 194
 					}
195 195
 				}		
196 196
 			}
@@ -206,15 +206,15 @@  discard block
 block discarded – undo
206 206
 			$merge_vars = array(
207 207
 				'NAME' => $user->user_login,
208 208
 			);
209
-			if( '' !== $user->first_name ) {
210
-				$merge_vars['NAME'] = $user->first_name;
211
-				$merge_vars['FNAME'] = $user->first_name;
209
+			if ( '' !== $user->first_name ) {
210
+				$merge_vars[ 'NAME' ] = $user->first_name;
211
+				$merge_vars[ 'FNAME' ] = $user->first_name;
212 212
 			}
213
-			if( '' !== $user->last_name ) {
214
-				$merge_vars['LNAME'] = $user->last_name;
213
+			if ( '' !== $user->last_name ) {
214
+				$merge_vars[ 'LNAME' ] = $user->last_name;
215 215
 			}
216
-			if( '' !== $user->first_name && '' !== $user->last_name ) {
217
-				$merge_vars['NAME'] = sprintf( '%s %s', $user->first_name, $user->last_name );
216
+			if ( '' !== $user->first_name && '' !== $user->last_name ) {
217
+				$merge_vars[ 'NAME' ] = sprintf( '%s %s', $user->first_name, $user->last_name );
218 218
 			}
219 219
 			/**
220 220
 			 * @filter `yikes-mailchimp-user-merge-vars`
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		*/
236 236
 		public function was_checkbox_checked( $type ) {
237 237
 			// was sign-up checkbox checked - return the value
238
-			return ( isset( $_POST[ 'yikes_mailchimp_checkbox_'.$type ] ) && $_POST[ 'yikes_mailchimp_checkbox_'.$type ] == 1 );
238
+			return ( isset( $_POST[ 'yikes_mailchimp_checkbox_' . $type ] ) && $_POST[ 'yikes_mailchimp_checkbox_' . $type ] == 1 );
239 239
 		}
240 240
 		
241 241
 		
@@ -245,15 +245,15 @@  discard block
 block discarded – undo
245 245
 		* 	@since 6.0.0
246 246
 		**/
247 247
 		public function yikes_reg_complete_msg( $errors, $redirect_to ) {
248
-			if( isset( $errors->errors['registered'] ) ) {
249
-				$email_error = get_option( 'yikes_register_subscription_error' , '' );
250
-				if( isset( $email_error ) && $email_error != '' ) {	
248
+			if ( isset( $errors->errors[ 'registered' ] ) ) {
249
+				$email_error = get_option( 'yikes_register_subscription_error', '' );
250
+				if ( isset( $email_error ) && $email_error != '' ) {	
251 251
 					// Use the magic __get method to retrieve the errors array:
252 252
 					$tmp = $errors->errors; 
253 253
 					$old = 'Registration complete. Please check your e-mail.';
254
-					foreach( $tmp['registered'] as $index => $msg ) {
255
-						if( $msg === $old ) {
256
-							$tmp['registered'][$index] = $old . ' <p class="message"><strong>' . __( 'Note' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong>: ' . $email_error . '</p>';        
254
+					foreach ( $tmp[ 'registered' ] as $index => $msg ) {
255
+						if ( $msg === $old ) {
256
+							$tmp[ 'registered' ][ $index ] = $old . ' <p class="message"><strong>' . __( 'Note', 'yikes-inc-easy-mailchimp-extender' ) . '</strong>: ' . $email_error . '</p>';        
257 257
 						}
258 258
 					}
259 259
 					// Use the magic __set method to override the errors property:
Please login to merge, or discard this patch.
public/classes/checkbox-integrations/class.bbpress_forms-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_bbPress_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class {
12 12
 	
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		*/
32 32
 		public function output_checkbox() {
33 33
 			// if the user is already subscribed, abort and don't render the checkbox
34
-			if( $this->is_user_already_subscribed( $this->type ) == '1' ) {
34
+			if ( $this->is_user_already_subscribed( $this->type ) == '1' ) {
35 35
 				return;
36 36
 			}
37 37
 			echo $this->yikes_get_checkbox();
@@ -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.
class.easy_digital_downloads_checkout_form-checkbox.php 1 patch
Spacing   +16 added lines, -16 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
 		
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 		* Outputs a checkbox
31 31
 		*/
32 32
 		public function output_checkbox() {
33
-			if( $this->is_user_already_subscribed( $this->type ) == '1' ) {
33
+			if ( $this->is_user_already_subscribed( $this->type ) == '1' ) {
34 34
 				return;
35 35
 			}
36 36
 			// render our field if the user isn't current subscribed
37
-			echo do_action( 'yikes-mailchimp-before-checkbox' , $this->type );
37
+			echo do_action( 'yikes-mailchimp-before-checkbox', $this->type );
38 38
 				echo $this->yikes_get_checkbox();
39
-			echo do_action( 'yikes-mailchimp-after-checkbox' , $this->type );
39
+			echo do_action( 'yikes-mailchimp-after-checkbox', $this->type );
40 40
 		}	
41 41
 		
42 42
 		
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		 */
48 48
 		public function update_payment_post_meta( $payment_id = 0, $payment_data = array() ) {
49 49
 			// don't save anything if the checkbox was not checked
50
-			if( ! $this->was_checkbox_checked( $this->type ) ) {
50
+			if ( ! $this->was_checkbox_checked( $this->type ) ) {
51 51
 				update_post_meta( $payment_id, '_yikes_easy_mc_optin', '0' );
52 52
 				return;
53 53
 			}
@@ -60,25 +60,25 @@  discard block
 block discarded – undo
60 60
 		 * @return bool|string
61 61
 		 */
62 62
 		public function subscribe_from_edd_purchase( $payment_id ) {
63
-			$meta = get_post_meta( $payment_id , '_yikes_easy_mc_optin' , true );
64
-			if( $meta == '0' ) {
63
+			$meta = get_post_meta( $payment_id, '_yikes_easy_mc_optin', true );
64
+			if ( $meta == '0' ) {
65 65
 				return false;
66 66
 			}
67 67
 			$email = (string) edd_get_payment_user_email( $payment_id );
68 68
 			$merge_vars = array();
69 69
 			// add first and last name to merge vars, if given
70 70
 			$user_info = (array) edd_get_payment_meta_user_info( $payment_id );
71
-			if( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
72
-				$merge_vars['NAME'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
71
+			if ( isset( $user_info[ 'first_name' ] ) && isset( $user_info[ 'last_name' ] ) ) {
72
+				$merge_vars[ 'NAME' ] = $user_info[ 'first_name' ] . ' ' . $user_info[ 'last_name' ];
73 73
 			}
74
-			if( isset( $user_info['first_name'] ) ) {
75
-				$merge_vars['FNAME'] = $user_info['first_name'];
74
+			if ( isset( $user_info[ 'first_name' ] ) ) {
75
+				$merge_vars[ 'FNAME' ] = $user_info[ 'first_name' ];
76 76
 			}
77
-			if( isset( $user_info['last_name'] ) ) {
78
-				$merge_vars['LNAME'] = $user_info['last_name'];
77
+			if ( isset( $user_info[ 'last_name' ] ) ) {
78
+				$merge_vars[ 'LNAME' ] = $user_info[ 'last_name' ];
79 79
 			}
80 80
 			// subscribe the user
81
-			$this->subscribe_user_integration( sanitize_email( $email ) , $this->type , $merge_vars );
81
+			$this->subscribe_user_integration( sanitize_email( $email ), $this->type, $merge_vars );
82 82
 		}
83 83
 	
84 84
 	}
Please login to merge, or discard this patch.
public/classes/checkbox-integrations/class.comment_form-checkbox.php 1 patch
Spacing   +6 added lines, -6 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
 	
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 		* Outputs a checkbox, if user is not already subscribed
28 28
 		*/
29 29
 		public function output_checkbox( $comment_field ) {
30
-			if( $this->is_user_already_subscribed( $this->type ) == '1' ) {
30
+			if ( $this->is_user_already_subscribed( $this->type ) == '1' ) {
31 31
 				return $comment_field;
32 32
 			}
33
-				echo do_action( 'yikes-mailchimp-before-checkbox' , $this->type );
33
+				echo do_action( 'yikes-mailchimp-before-checkbox', $this->type );
34 34
 					echo $comment_field . $this->yikes_get_checkbox();
35
-				echo do_action( 'yikes-mailchimp-after-checkbox' , $this->type );
35
+				echo do_action( 'yikes-mailchimp-after-checkbox', $this->type );
36 36
 		}		
37 37
 	
38 38
 		/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		 *
42 42
 		 *	@since 6.0.0
43 43
 		**/
44
-		public function subscribe_from_comment( $comment_id , $comment_approved ) {	
44
+		public function subscribe_from_comment( $comment_id, $comment_approved ) {	
45 45
 			// was sign-up checkbox checked?
46 46
 			if ( $this->was_checkbox_checked( $this->type ) === false ) {
47 47
 				return false;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 				'OPTIN_IP' => $comment_data->comment_author_IP,
59 59
 			);
60 60
 			// subscribe the user 
61
-			$this->subscribe_user_integration( sanitize_email( $comment_data->comment_author_email ) , $this->type , $merge_vars );
61
+			$this->subscribe_user_integration( sanitize_email( $comment_data->comment_author_email ), $this->type, $merge_vars );
62 62
 		}
63 63
 		
64 64
 	}
Please login to merge, or discard this patch.
public/classes/checkbox-integrations/class.buddypress_form-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_BuddyPress_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class {
12 12
 		
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		* Outputs a checkbox, if user is not already subscribed
22 22
 		*/
23 23
 		public function output_checkbox() {
24
-			if( $this->is_user_already_subscribed( $this->type ) == '1' ) {
24
+			if ( $this->is_user_already_subscribed( $this->type ) == '1' ) {
25 25
 				return;
26 26
 			}
27 27
 			?>
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 ) == '1' ) {
47
+		if ( isset( $checkbox_options ) && $checkbox_options[ $this->type ][ 'associated-list' ] != '-' ) {
48
+			if ( $this->is_user_already_subscribed( $this->type ) == '1' ) {
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.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_new_registration_already_subscribed( $user->user_email , 'registration_form' ) != '1' ) {
55
-			$this->subscribe_user_integration( sanitize_email( $user->user_email ) , $this->type , $merge_variables );
54
+		if ( $this->is_new_registration_already_subscribed( $user->user_email, 'registration_form' ) != '1' ) {
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.contact_form_7-checkbox.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 */
12 12
 	
13 13
 // Prevent direct access to the file
14
-defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) );
14
+defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) );
15 15
 
16 16
 class Yikes_Easy_MC_CF7_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class {
17 17
 	/**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		// initialize
27 27
 		$this->init();
28 28
 		add_action( 'wpcf7_mail_sent', array( $this, 'new_cf7_subscription' ) );
29
-		add_action( 'wpcf7_posted_data', array( $this, 'alter_cf7_data') );
29
+		add_action( 'wpcf7_posted_data', array( $this, 'alter_cf7_data' ) );
30 30
 	}
31 31
 	
32 32
 	/**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	* @return boolean
36 36
 	*/
37 37
 	public function init() {
38
-		if( ! function_exists( 'wpcf7_add_shortcode' ) ) {
38
+		if ( ! function_exists( 'wpcf7_add_shortcode' ) ) {
39 39
 			return false;
40 40
 		}
41 41
 		wpcf7_add_shortcode( 'yikes_mailchimp_checkbox', array( $this, 'yikes_get_checkbox' ) );
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	* @return array
52 52
 	*/
53 53
 	public function alter_cf7_data( $data = array() ) {
54
-		$data['yikes_mailchimp_checkbox'] = $this->was_checkbox_checked( $this->type ) ? __( 'Yes', 'yikes-inc-easy-mailchimp-extender' ) : __( 'No', 'yikes-inc-easy-mailchimp-extender' );
54
+		$data[ 'yikes_mailchimp_checkbox' ] = $this->was_checkbox_checked( $this->type ) ? __( 'Yes', 'yikes-inc-easy-mailchimp-extender' ) : __( 'No', 'yikes-inc-easy-mailchimp-extender' );
55 55
 		return $data;
56 56
 	}
57 57
 	
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			return false;
65 65
 		}
66 66
 		// get the integration options
67
-		$integration_options = get_option( 'optin-checkbox-init' , '' );
67
+		$integration_options = get_option( 'optin-checkbox-init', '' );
68 68
 		// get the contact form 7 submission instance
69 69
 		$submission = WPCF7_Submission::get_instance();
70 70
 		// confirm the submission was received
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			// get the submission data
73 73
 			$posted_data = $submission->get_posted_data();
74 74
 			// store the email -- this needs to be more dynamic (find string with containing string email?)
75
-			$email = ( isset( $posted_data['your-email'] ) ) ? $posted_data['your-email'] : '';
75
+			$email = ( isset( $posted_data[ 'your-email' ] ) ) ? $posted_data[ 'your-email' ] : '';
76 76
 			// submit this subscriber
77 77
 			return $this->subscribe_user_integration( $email, $this->type, apply_filters( 'yikes-mailchimp-contact-form-7', array(), $posted_data ) );
78 78
 		}
Please login to merge, or discard this patch.