Completed
Push — staging ( 28ad9c...434281 )
by
unknown
07:22
created
classes/checkbox-integrations/class.woocommerce_checkout_form-checkbox.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
 			$precheck = isset( $checkbox_options[ $this->type ]['precheck'] ) && 'true' === $checkbox_options[ $this->type ]['precheck'] ? '1' : '0';
73 73
 
74 74
 			/**
75
-			* Filter where the checkbox goes.
76
-			*
77
-			* See this WooCo article for possible values: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
78
-			*
79
-			* @param string | Which set of fields the checkbox should go into
80
-			*/
75
+			 * Filter where the checkbox goes.
76
+			 *
77
+			 * See this WooCo article for possible values: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
78
+			 *
79
+			 * @param string | Which set of fields the checkbox should go into
80
+			 */
81 81
 			$field_placement = apply_filters( 'yikes-mailchimp-wooco-integration-checkbox-placement', 'billing' );
82 82
 
83 83
 			$yikes_checkbox = array(
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 			);
90 90
 
91 91
 			/**
92
-			* Filter the checkbox data.
93
-			*
94
-			* See this WooCo article for possible values: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
95
-			*
96
-			* @param  array $yikes_checkbox The checkbox's fields.
97
-			* @return array $yikes_checkbox The checkbox's fields.
98
-			*/
92
+			 * Filter the checkbox data.
93
+			 *
94
+			 * See this WooCo article for possible values: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
95
+			 *
96
+			 * @param  array $yikes_checkbox The checkbox's fields.
97
+			 * @return array $yikes_checkbox The checkbox's fields.
98
+			 */
99 99
 			$yikes_checkbox = apply_filters( 'yikes_mailchimp_wooco_integration_checkbox_field', $yikes_checkbox, $checkbox_options[ $this->type ] );
100 100
 
101 101
 			$fields[ $field_placement ][ 'yikes_mailchimp_checkbox_' . $this->type ] = $yikes_checkbox;
Please login to merge, or discard this patch.
public/classes/checkbox-integrations.php 1 patch
Braces   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 /**
10 10
  * Main Checkbox Integration class.
11 11
  */
12
-class Yikes_Easy_MC_Checkbox_Integration_Class {
12
+class Yikes_Easy_MC_Checkbox_Integration_Class {
13 13
 
14 14
 	/**
15 15
 	 * The integration type.
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @return bool Whether the current user is subscribed to a list.
30 30
 	 */
31
-	public function is_user_already_subscribed( $type, $email = '' ) {
31
+	public function is_user_already_subscribed( $type, $email = '' ) {
32 32
 		// Make sure we have an email address to use.
33
-		if ( empty( $email ) ) {
34
-			if ( ! is_user_logged_in() ) {
33
+		if ( empty( $email ) ) {
34
+			if ( ! is_user_logged_in() ) {
35 35
 				return false;
36 36
 			}
37 37
 
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 		}
41 41
 
42 42
 		// Ensure we have a valid email.
43
-		if ( ! is_email( $email ) ) {
43
+		if ( ! is_email( $email ) ) {
44 44
 			return false;
45 45
 		}
46 46
 
47 47
 		// Convert the integration type to a list ID.
48 48
 		$checkbox_options = get_option( 'optin-checkbox-init', '' );
49
-		if ( empty( $checkbox_options ) || ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ]['associated-list'] ) ) {
49
+		if ( empty( $checkbox_options ) || ! isset( $checkbox_options[ $type ] ) || ! isset( $checkbox_options[ $type ]['associated-list'] ) ) {
50 50
 			return false;
51 51
 		}
52 52
 
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 		$list_ids = is_array( $list_ids ) ? $list_ids : array( $list_ids );
55 55
 
56 56
 		// Go through each list...
57
-		foreach ( $list_ids as $list_id ) {
58
-			if ( ! $this->is_user_subscribed( $email, $list_id, $type ) ) {
57
+		foreach ( $list_ids as $list_id ) {
58
+			if ( ! $this->is_user_subscribed( $email, $list_id, $type ) ) {
59 59
 				return false;
60 60
 			}
61 61
 		}
@@ -74,18 +74,18 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return bool Whether the email is subscribed to the list.
76 76
 	 */
77
-	public function is_user_subscribed( $email, $list_id, $type ) {
77
+	public function is_user_subscribed( $email, $list_id, $type ) {
78 78
 		$email_hash = md5( $email );
79 79
 
80 80
 		// Check the API to see the status.
81 81
 		$response = yikes_get_mc_api_manager()->get_list_handler()->get_member( $list_id, $email_hash, false );
82
-		if ( is_wp_error( $response ) ) {
82
+		if ( is_wp_error( $response ) ) {
83 83
 			$data = $response->get_error_data();
84 84
 
85 85
 			// If the error response is a 404, they are not subscribed.
86
-			if ( isset( $data['status'] ) && 404 === (int) $data['status'] ) {
86
+			if ( isset( $data['status'] ) && 404 === (int) $data['status'] ) {
87 87
 				return false;
88
-			} else {
88
+			} else {
89 89
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
90 90
 				$error_logging->maybe_write_to_log(
91 91
 					$response->get_error_code(),
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return string The HTML for the checkbox.
111 111
 	 */
112
-	public function yikes_get_checkbox() {
112
+	public function yikes_get_checkbox() {
113 113
 
114 114
 		// Enqueue our checkbox styles whenever the checkbox is displayed.
115 115
 		wp_enqueue_style( 'yikes-easy-mailchimp-checkbox-integration-styles', plugin_dir_url( __FILE__ ) . '../css/yikes-inc-easy-mailchimp-checkbox-integration.min.css' );
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		$has_list_ids     = isset( $checkbox_options[ $this->type ]['associated-list'] ) && '-' !== $checkbox_options[ $this->type ]['associated-list'];
120 120
 		$has_list_ids     = $has_list_ids && ! in_array( '-', $checkbox_options[ $this->type ]['associated-list'], true );
121 121
 
122
-		if ( $has_list_ids ) {
122
+		if ( $has_list_ids ) {
123 123
 			$checked  = 'true' === $checkbox_options[ $this->type ]['precheck'] ? 'checked="checked"' : '';
124 124
 			$before   = apply_filters( 'yikes-mailchimp-before-checkbox-html', '' );
125 125
 			$content  = '<p id="yikes-easy-mailchimp-' . esc_attr( $this->type ) . '-checkbox" class="yikes-easy-mailchimp-' . esc_attr( $this->type ) . '-checkbox">';
@@ -145,18 +145,18 @@  discard block
 block discarded – undo
145 145
 	 * @param string $type       The integration type.
146 146
 	 * @param array  $merge_vars The array of form data to send.
147 147
 	 */
148
-	public function subscribe_user_integration( $email, $type, $merge_vars ) {
148
+	public function subscribe_user_integration( $email, $type, $merge_vars ) {
149 149
 		$options = get_option( 'optin-checkbox-init', '' );
150 150
 
151 151
 		// Make sure we have a list ID.
152
-		if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ]['associated-list'] ) ) {
152
+		if ( ! isset( $options[ $type ] ) || ! isset( $options[ $type ]['associated-list'] ) ) {
153 153
 			// @todo: Throw some kind of error?
154 154
 			return;
155 155
 		}
156 156
 
157 157
 		// Check for an IP address.
158 158
 		$user_ip = sanitize_text_field( $_SERVER['REMOTE_ADDR'] );
159
-		if ( isset( $merge_vars['OPTIN_IP'] ) ) {
159
+		if ( isset( $merge_vars['OPTIN_IP'] ) ) {
160 160
 			$user_ip = sanitize_text_field( $merge_vars['OPTIN_IP'] );
161 161
 		}
162 162
 
@@ -172,19 +172,19 @@  discard block
 block discarded – undo
172 172
 			'ip_signup'     => $user_ip,
173 173
 		);
174 174
 
175
-		foreach ( $list_ids as $list_id ) {
175
+		foreach ( $list_ids as $list_id ) {
176 176
 
177 177
 			$interests = isset( $options[ $type ]['interest-groups'] ) ? $options[ $type ]['interest-groups'] : array();
178 178
 			$interests = isset( $interests[ $list_id ] ) ? $interests[ $list_id ] : $interests;
179 179
 
180 180
 			// Only re-format and add interest groups if not empty.
181
-			if ( ! empty( $interests ) ) {
181
+			if ( ! empty( $interests ) ) {
182 182
 				$groups = array();
183 183
 
184 184
 				// Need to reformat interest groups array as $interest_group_ID => true.
185
-				foreach ( $interests as $interest ) {
186
-					if ( is_array( $interest ) ) {
187
-						foreach ( $interest as $group_id ) {
185
+				foreach ( $interests as $interest ) {
186
+					if ( is_array( $interest ) ) {
187
+						foreach ( $interest as $group_id ) {
188 188
 							$groups[ $group_id ] = true;
189 189
 						}
190 190
 					}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
 			// Subscribe the user to the list via the API.
219 219
 			$response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, $id, $data );
220
-			if ( is_wp_error( $response ) ) {
220
+			if ( is_wp_error( $response ) ) {
221 221
 				$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
222 222
 				$error_logging->maybe_write_to_log(
223 223
 					$response->get_error_code(),
@@ -235,15 +235,15 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @param WP_User $user A WP User.
237 237
 	 */
238
-	public function user_merge_vars( WP_User $user ) {
238
+	public function user_merge_vars( WP_User $user ) {
239 239
 
240 240
 		// Setup our array.
241 241
 		$merge_vars = array();
242 242
 		
243
-		if ( ! empty( $user->first_name ) ) {
243
+		if ( ! empty( $user->first_name ) ) {
244 244
 			$merge_vars['FNAME'] = $user->first_name;
245 245
 		}
246
-		if ( ! empty( $user->last_name ) ) {
246
+		if ( ! empty( $user->last_name ) ) {
247 247
 			$merge_vars['LNAME'] = $user->last_name;
248 248
 		}
249 249
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @return bool True if the checkbox was checked.
269 269
 	 */
270
-	public function was_checkbox_checked( $type ) {
270
+	public function was_checkbox_checked( $type ) {
271 271
 		return isset( $_POST[ 'yikes_mailchimp_checkbox_' . $type ] ) && '1' === (string) filter_var( $_POST[ 'yikes_mailchimp_checkbox_' . $type ], FILTER_SANITIZE_STRING );
272 272
 	}
273 273
 }
Please login to merge, or discard this patch.
public/classes/process/class.process_form_submission_handler.php 2 patches
Indentation   +539 added lines, -539 removed lines patch added patch discarded remove patch
@@ -3,234 +3,234 @@  discard block
 block discarded – undo
3 3
 class Yikes_Inc_Easy_MailChimp_Extender_Process_Submission_Handler {
4 4
 
5 5
 	/**
6
-	* A flag signifying whether we're dealing with an AJAX submission or standard form submission
7
-	* 
8
-	* @since 6.3.0
9
-	* @access protected
10
-	* @var bool | $is_ajax
11
-	*/
6
+	 * A flag signifying whether we're dealing with an AJAX submission or standard form submission
7
+	 * 
8
+	 * @since 6.3.0
9
+	 * @access protected
10
+	 * @var bool | $is_ajax
11
+	 */
12 12
 	protected $is_ajax;
13 13
 
14 14
 	/**** Hardcoded Internal Variables ****/
15 15
 
16 16
 	/**
17
-	* An array of form fields we don't process
18
-	* 
19
-	* @since 6.3.0
20
-	* @access protected
21
-	* @var array | $skipped_form_fields
22
-	*/
17
+	 * An array of form fields we don't process
18
+	 * 
19
+	 * @since 6.3.0
20
+	 * @access protected
21
+	 * @var array | $skipped_form_fields
22
+	 */
23 23
 	protected $skipped_form_fields;
24 24
 
25 25
 	/**** Form Variables ****/
26 26
 
27 27
 	/**
28
-	* The ID of the corresponding YIKES MailChimp form
29
-	* 
30
-	* @since 6.3.0
31
-	* @access public
32
-	* @var int | $form_id
33
-	*/
28
+	 * The ID of the corresponding YIKES MailChimp form
29
+	 * 
30
+	 * @since 6.3.0
31
+	 * @access public
32
+	 * @var int | $form_id
33
+	 */
34 34
 	public $form_id;
35 35
 
36 36
 	/**
37
-	* The ID of the corresponding MailChimp list
38
-	* 
39
-	* @since 6.3.0
40
-	* @access public
41
-	* @var int | $list_id
42
-	*/
37
+	 * The ID of the corresponding MailChimp list
38
+	 * 
39
+	 * @since 6.3.0
40
+	 * @access public
41
+	 * @var int | $list_id
42
+	 */
43 43
 	public $list_id;
44 44
 
45 45
 	/**
46
-	* The submitted email
47
-	* 
48
-	* @since 6.3.0
49
-	* @access public
50
-	* @var string | $email
51
-	*/
46
+	 * The submitted email
47
+	 * 
48
+	 * @since 6.3.0
49
+	 * @access public
50
+	 * @var string | $email
51
+	 */
52 52
 	public $email;
53 53
 
54 54
 	/**
55
-	* The array of error messages defined by the user and attached to this form
56
-	* 
57
-	* @since 6.3.0
58
-	* @access public
59
-	* @var array | $error_messages
60
-	*/
55
+	 * The array of error messages defined by the user and attached to this form
56
+	 * 
57
+	 * @since 6.3.0
58
+	 * @access public
59
+	 * @var array | $error_messages
60
+	 */
61 61
 	public $error_messages;
62 62
 
63 63
 	/**** Default Error Messages ****/
64 64
 
65 65
 	/**
66
-	* The error message for no form ID
67
-	* 
68
-	* @since 6.3.0
69
-	* @access public
70
-	* @var string | $handle_empty_form_id_message
71
-	*/
66
+	 * The error message for no form ID
67
+	 * 
68
+	 * @since 6.3.0
69
+	 * @access public
70
+	 * @var string | $handle_empty_form_id_message
71
+	 */
72 72
 	public $handle_empty_form_id_message;
73 73
 
74 74
 	/**
75
-	* The error message for no form found
76
-	* 
77
-	* @since 6.3.0
78
-	* @access public
79
-	* @var string | $handle_empty_form_message
80
-	*/
75
+	 * The error message for no form found
76
+	 * 
77
+	 * @since 6.3.0
78
+	 * @access public
79
+	 * @var string | $handle_empty_form_message
80
+	 */
81 81
 	public $handle_empty_form_message;
82 82
 
83 83
 	/**
84
-	* The error message for missing form fields
85
-	* 
86
-	* @since 6.3.0
87
-	* @access public
88
-	* @var string | $handle_empty_fields_generic_message
89
-	*/
84
+	 * The error message for missing form fields
85
+	 * 
86
+	 * @since 6.3.0
87
+	 * @access public
88
+	 * @var string | $handle_empty_fields_generic_message
89
+	 */
90 90
 	public $handle_empty_fields_generic_message;
91 91
 
92 92
 	/**
93
-	* The error message for missing $list_handler class
94
-	* 
95
-	* @since 6.3.0
96
-	* @access public
97
-	* @var string | $handle_empty_list_handler_message
98
-	*/
93
+	 * The error message for missing $list_handler class
94
+	 * 
95
+	 * @since 6.3.0
96
+	 * @access public
97
+	 * @var string | $handle_empty_list_handler_message
98
+	 */
99 99
 	public $handle_empty_list_handler_message;
100 100
 
101 101
 	/**
102
-	* The error message for no email
103
-	* 
104
-	* @since 6.3.0
105
-	* @access public
106
-	* @var string | $handle_empty_email_message
107
-	*/
102
+	 * The error message for no email
103
+	 * 
104
+	 * @since 6.3.0
105
+	 * @access public
106
+	 * @var string | $handle_empty_email_message
107
+	 */
108 108
 	public $handle_empty_email_message;
109 109
 
110 110
 	/**
111
-	* The error message for a filled in honeypot
112
-	* 
113
-	* @since 6.3.0
114
-	* @access public
115
-	* @var string | $handle_non_empty_honeypot_message
116
-	*/
111
+	 * The error message for a filled in honeypot
112
+	 * 
113
+	 * @since 6.3.0
114
+	 * @access public
115
+	 * @var string | $handle_non_empty_honeypot_message
116
+	 */
117 117
 	public $handle_non_empty_honeypot_message;
118 118
 
119 119
 	/**
120
-	* The error message for existing users trying to update when it's disallowed
121
-	* 
122
-	* @since 6.3.0
123
-	* @access public
124
-	* @var string | $handle_disallowed_existing_user_update_message
125
-	*/
120
+	 * The error message for existing users trying to update when it's disallowed
121
+	 * 
122
+	 * @since 6.3.0
123
+	 * @access public
124
+	 * @var string | $handle_disallowed_existing_user_update_message
125
+	 */
126 126
 	public $handle_disallowed_existing_user_update_message;
127 127
 
128 128
 	/**
129
-	* The first half of the error message for updating an existing user when it's done via a profile link
130
-	* 
131
-	* @since 6.3.0
132
-	* @access public
133
-	* @var string | $handle_updating_existing_user_message
134
-	*/
129
+	 * The first half of the error message for updating an existing user when it's done via a profile link
130
+	 * 
131
+	 * @since 6.3.0
132
+	 * @access public
133
+	 * @var string | $handle_updating_existing_user_message
134
+	 */
135 135
 	public $handle_updating_existing_user_message;
136 136
 
137 137
 	/**
138
-	* The second half of the error message (the link) for updating an existing user when it's done via a profile link
139
-	* 
140
-	* @since 6.3.0
141
-	* @access public
142
-	* @var string | $handle_updating_existing_user_link_message
143
-	*/
138
+	 * The second half of the error message (the link) for updating an existing user when it's done via a profile link
139
+	 * 
140
+	 * @since 6.3.0
141
+	 * @access public
142
+	 * @var string | $handle_updating_existing_user_link_message
143
+	 */
144 144
 	public $handle_updating_existing_user_link_message;
145 145
 
146 146
 	/**
147
-	* A default, generic error message
148
-	* 
149
-	* @since 6.3.0
150
-	* @access public
151
-	* @var string | $default_error_response_message
152
-	*/
147
+	 * A default, generic error message
148
+	 * 
149
+	 * @since 6.3.0
150
+	 * @access public
151
+	 * @var string | $default_error_response_message
152
+	 */
153 153
 	public $default_error_response_message;
154 154
 
155 155
 	/**
156
-	* The error message for not filling out a required form field
157
-	* 
158
-	* @since 6.3.0
159
-	* @access public
160
-	* @var string | $handle_empty_required_field_message
161
-	*/
156
+	 * The error message for not filling out a required form field
157
+	 * 
158
+	 * @since 6.3.0
159
+	 * @access public
160
+	 * @var string | $handle_empty_required_field_message
161
+	 */
162 162
 	public $handle_empty_required_field_message;
163 163
 
164 164
 	/**
165
-	* The error message for not filling out a required interest group
166
-	* 
167
-	* @since 6.3.0
168
-	* @access public
169
-	* @var string | $handle_empty_required_interest_group_message
170
-	*/
165
+	 * The error message for not filling out a required interest group
166
+	 * 
167
+	 * @since 6.3.0
168
+	 * @access public
169
+	 * @var string | $handle_empty_required_interest_group_message
170
+	 */
171 171
 	public $handle_empty_required_interest_group_message;
172 172
 
173 173
 	/**
174
-	* The error message for nonce failures
175
-	* 
176
-	* @since 6.3.0
177
-	* @access public
178
-	* @var string | $handle_nonce_message
179
-	*/
174
+	 * The error message for nonce failures
175
+	 * 
176
+	 * @since 6.3.0
177
+	 * @access public
178
+	 * @var string | $handle_nonce_message
179
+	 */
180 180
 	public $handle_nonce_message;
181 181
 
182 182
 	/**
183
-	* The error message for a recaptcha that is not checked/filled out
184
-	* 
185
-	* @since 6.3.0
186
-	* @access public
187
-	* @var string | $handle_nonce_message
188
-	*/
183
+	 * The error message for a recaptcha that is not checked/filled out
184
+	 * 
185
+	 * @since 6.3.0
186
+	 * @access public
187
+	 * @var string | $handle_nonce_message
188
+	 */
189 189
 	public $handle_non_filled_recaptcha_message_message;
190 190
 
191 191
 	/**
192
-	* The error message for recaptcha errors that we're not sure of
193
-	* 
194
-	* @since 6.3.0
195
-	* @access public
196
-	* @var string | $handle_nonce_message
197
-	*/
192
+	 * The error message for recaptcha errors that we're not sure of
193
+	 * 
194
+	 * @since 6.3.0
195
+	 * @access public
196
+	 * @var string | $handle_nonce_message
197
+	 */
198 198
 	public $generic_recaptcha_error_message;
199 199
 
200 200
 	/**** Default Success Messages ****/
201 201
 
202 202
 	/**
203
-	* The success message for single-optin forms
204
-	* 
205
-	* @since 6.3.0
206
-	* @access public
207
-	* @var string | $default_response_single_optin_success_message
208
-	*/
203
+	 * The success message for single-optin forms
204
+	 * 
205
+	 * @since 6.3.0
206
+	 * @access public
207
+	 * @var string | $default_response_single_optin_success_message
208
+	 */
209 209
 	public $default_response_single_optin_success_message;
210 210
 
211 211
 	/**
212
-	* The default success message for double-optin forms
213
-	* 
214
-	* @since 6.3.0
215
-	* @access public
216
-	* @var string | $default_response_double_optin_success_message
217
-	*/
212
+	 * The default success message for double-optin forms
213
+	 * 
214
+	 * @since 6.3.0
215
+	 * @access public
216
+	 * @var string | $default_response_double_optin_success_message
217
+	 */
218 218
 	public $default_response_double_optin_success_message;
219 219
 
220 220
 	/**
221
-	* The default success message for already subscribed users re-subscribing
222
-	* 
223
-	* @since 6.3.0
224
-	* @access public
225
-	* @var string | $existing_subscriber_profile_update_message
226
-	*/
221
+	 * The default success message for already subscribed users re-subscribing
222
+	 * 
223
+	 * @since 6.3.0
224
+	 * @access public
225
+	 * @var string | $existing_subscriber_profile_update_message
226
+	 */
227 227
 	public $existing_subscriber_profile_update_message;
228 228
 
229 229
 	/**
230
-	* The construct function - sets all of our hardcoded variables
231
-	*
232
-	* @param bool | $is_ajax | Flag signifying whether this submission request is coming from an AJAX response or basic form submission
233
-	*/
230
+	 * The construct function - sets all of our hardcoded variables
231
+	 *
232
+	 * @param bool | $is_ajax | Flag signifying whether this submission request is coming from an AJAX response or basic form submission
233
+	 */
234 234
 	public function __construct( $is_ajax ) {
235 235
 
236 236
 		// Set up our variables
@@ -268,45 +268,45 @@  discard block
 block discarded – undo
268 268
 	/**** Setters for our Form Variables ****/
269 269
 
270 270
 	/**
271
-	* Set the form ID class property
272
-	*
273
-	* @since 6.3.0
274
-	*
275
-	* @param int | $form_id | ID of the corresponding YIKES MailChimp form
276
-	*/
271
+	 * Set the form ID class property
272
+	 *
273
+	 * @since 6.3.0
274
+	 *
275
+	 * @param int | $form_id | ID of the corresponding YIKES MailChimp form
276
+	 */
277 277
 	public function set_form_id( $form_id ) {
278 278
 		$this->form_id = $form_id;
279 279
 	}
280 280
 
281 281
 	/**
282
-	* Set the list ID class property
283
-	*
284
-	* @since 6.3.0
285
-	*
286
-	* @param int | $list_id | ID of the corresponding MailChimp list
287
-	*/
282
+	 * Set the list ID class property
283
+	 *
284
+	 * @since 6.3.0
285
+	 *
286
+	 * @param int | $list_id | ID of the corresponding MailChimp list
287
+	 */
288 288
 	public function set_list_id( $list_id ) {
289 289
 		$this->list_id = $list_id;
290 290
 	}
291 291
 
292 292
 	/**
293
-	* Set the email class property
294
-	*
295
-	* @since 6.3.0
296
-	*
297
-	* @param string | $sanitized_email | The sanitized email
298
-	*/
293
+	 * Set the email class property
294
+	 *
295
+	 * @since 6.3.0
296
+	 *
297
+	 * @param string | $sanitized_email | The sanitized email
298
+	 */
299 299
 	public function set_email( $sanitized_email ) {
300 300
 		$this->email = $sanitized_email;
301 301
 	}
302 302
 
303 303
 	/**
304
-	* Set the $error_messages class property
305
-	*
306
-	* @since 6.3.0
307
-	*
308
-	* @param array | $error_messages | The array of user-defined error messages for this form
309
-	*/
304
+	 * Set the $error_messages class property
305
+	 *
306
+	 * @since 6.3.0
307
+	 *
308
+	 * @param array | $error_messages | The array of user-defined error messages for this form
309
+	 */
310 310
 	public function set_error_messages( $error_messages ) {
311 311
 		$this->error_messages = $error_messages;
312 312
 	}
@@ -315,24 +315,24 @@  discard block
 block discarded – undo
315 315
 	/**** Simple Return Functions ****/
316 316
 
317 317
 	/**
318
-	* Return a sanitized email
319
-	*
320
-	* @since 6.3.0
321
-	*
322
-	* @param string | $email | The user's email
323
-	* @return string| $email | The user's email, lowercased and sanitized
324
-	*/
318
+	 * Return a sanitized email
319
+	 *
320
+	 * @since 6.3.0
321
+	 *
322
+	 * @param string | $email | The user's email
323
+	 * @return string| $email | The user's email, lowercased and sanitized
324
+	 */
325 325
 	public function get_sanitized_email( $email ) {
326 326
 		return sanitize_email( strtolower( $email ) );
327 327
 	}
328 328
 
329 329
 	/**
330
-	* Return the class property $skipped_form_fields
331
-	*
332
-	* @since 6.3.0
333
-	*
334
-	* @return array | $skipped_form_fields
335
-	*/
330
+	 * Return the class property $skipped_form_fields
331
+	 *
332
+	 * @since 6.3.0
333
+	 *
334
+	 * @return array | $skipped_form_fields
335
+	 */
336 336
 	protected function get_skipped_merge_tags() {
337 337
 		return $this->skipped_form_fields;
338 338
 	}
@@ -341,14 +341,14 @@  discard block
 block discarded – undo
341 341
 	/**** Collection of functions handling the incoming form and interest group data ****/
342 342
 
343 343
 	/**
344
-	* Loop through form data to sanitize, format, filter, and return.
345
-	*
346
-	* @since 6.3.0
347
-	*
348
-	* @param array | $data 			 | The array of user-submitted form values
349
-	* @param array | $form_fields	 | The array of form field definitions for this YIKES MailChimp form
350
-	* @return array| $merge_variables| The array of sanitized and formatted form values
351
-	*/
344
+	 * Loop through form data to sanitize, format, filter, and return.
345
+	 *
346
+	 * @since 6.3.0
347
+	 *
348
+	 * @param array | $data 			 | The array of user-submitted form values
349
+	 * @param array | $form_fields	 | The array of form field definitions for this YIKES MailChimp form
350
+	 * @return array| $merge_variables| The array of sanitized and formatted form values
351
+	 */
352 352
 	public function get_submitted_merge_values( $data, $form_fields ) {
353 353
 
354 354
 		// Array to return
@@ -386,13 +386,13 @@  discard block
 block discarded – undo
386 386
 		}
387 387
 
388 388
 		/**
389
-		*	yikes-mailchimp-filter-before-submission || yikes-mailchimp-filter-before-submission-{$form_id}
390
-		*
391
-		*	Catch the merge variables before they get sent over to MailChimp
392
-		*	@since 6.0.0
393
-		*
394
-		*	@param array | $merge_variables | The user submitted form data
395
-		*/
389
+		 *	yikes-mailchimp-filter-before-submission || yikes-mailchimp-filter-before-submission-{$form_id}
390
+		 *
391
+		 *	Catch the merge variables before they get sent over to MailChimp
392
+		 *	@since 6.0.0
393
+		 *
394
+		 *	@param array | $merge_variables | The user submitted form data
395
+		 */
396 396
 		$merge_variables = apply_filters( 'yikes-mailchimp-filter-before-submission', $merge_variables );
397 397
 		$merge_variables = apply_filters( "yikes-mailchimp-filter-before-submission-{$this->form_id}", $merge_variables );
398 398
 
@@ -400,14 +400,14 @@  discard block
 block discarded – undo
400 400
 	}
401 401
 
402 402
 	/**
403
-	* Sanitize form values and return them
404
-	*
405
-	* @since 6.3.0
406
-	* 
407
-	* @param string | $key		 | The MERGE/Field-name for this value
408
-	* @param mixed  | $value	 | The form value - this could be an array or a string
409
-	* @return mixed | $sanitized | The $value sanitized
410
-	*/ 
403
+	 * Sanitize form values and return them
404
+	 *
405
+	 * @since 6.3.0
406
+	 * 
407
+	 * @param string | $key		 | The MERGE/Field-name for this value
408
+	 * @param mixed  | $value	 | The form value - this could be an array or a string
409
+	 * @return mixed | $sanitized | The $value sanitized
410
+	 */ 
411 411
 	protected function sanitize_form_values( $key, $value ) {
412 412
 		if ( is_scalar( $value ) ) {
413 413
 			$sanitized = sanitize_text_field( $value );
@@ -421,14 +421,14 @@  discard block
 block discarded – undo
421 421
 	}
422 422
 
423 423
 	/**
424
-	* Check a date field's date format and pass it along to the appropriate function
425
-	*
426
-	* @since 6.3.0
427
-	* 
428
-	* @param string | $date			| The unformatted date value
429
-	* @param string | $date_format	| The date format
430
-	* @return string| $date			| The date formatted according to the $date_format
431
-	*/ 
424
+	 * Check a date field's date format and pass it along to the appropriate function
425
+	 *
426
+	 * @since 6.3.0
427
+	 * 
428
+	 * @param string | $date			| The unformatted date value
429
+	 * @param string | $date_format	| The date format
430
+	 * @return string| $date			| The date formatted according to the $date_format
431
+	 */ 
432 432
 	protected function handle_date_format_merge_values( $date, $date_format ) {
433 433
 		// Check if EU date format (for dates: 'DD/MM/YYYY', for birthdays: 'DD/MM')
434 434
 		if ( 'DD/MM/YYYY' === $date_format ) {
@@ -441,13 +441,13 @@  discard block
 block discarded – undo
441 441
 	}
442 442
 
443 443
 	/**
444
-	* Format a date field whose date format is dd/mm/yyyy
445
-	*
446
-	* @since 6.3.0
447
-	*
448
-	* @param string | $date | A date in the format dd/mm/yyyy
449
-	* @return string| $date | A date in the format mm/dd/yyyy
450
-	*/
444
+	 * Format a date field whose date format is dd/mm/yyyy
445
+	 *
446
+	 * @since 6.3.0
447
+	 *
448
+	 * @param string | $date | A date in the format dd/mm/yyyy
449
+	 * @return string| $date | A date in the format mm/dd/yyyy
450
+	 */
451 451
 	protected function handle_dd_mm_yyyy_date( $date ) {
452 452
 
453 453
 		// MailChimp wants the dates as 'MM/DD/YYYY' regardless of user-specified format, so convert
@@ -466,13 +466,13 @@  discard block
 block discarded – undo
466 466
 	}
467 467
 
468 468
 	/**
469
-	* Format a birthday field whose date format is dd/mm
470
-	*
471
-	* @since 6.3.0
472
-	*
473
-	* @param string | $birthday | A date in the format dd/mm
474
-	* @return string| $birthday | A date in the format mm/dd
475
-	*/
469
+	 * Format a birthday field whose date format is dd/mm
470
+	 *
471
+	 * @since 6.3.0
472
+	 *
473
+	 * @param string | $birthday | A date in the format dd/mm
474
+	 * @return string| $birthday | A date in the format mm/dd
475
+	 */
476 476
 	protected function handle_dd_mm_birthday( $birthday ) {
477 477
 
478 478
 		// MailChimp wants the birthdays as 'MM/DD' regardless of user-specified format, so convert
@@ -492,14 +492,14 @@  discard block
 block discarded – undo
492 492
 
493 493
 
494 494
 	/**
495
-	* Create an array of available interest groups based on the $replace_interests flag
496
-	*
497
-	* @since 6.3.0
498
-	*
499
-	* @param bool	| $replace_interests| True if we're replacing interest groups, false if updating interest groups
500
-	* @param class 	| $list_class		| Class for interacting with the current list
501
-	* @return array | $groups			| Array of interest groups 
502
-	*/
495
+	 * Create an array of available interest groups based on the $replace_interests flag
496
+	 *
497
+	 * @since 6.3.0
498
+	 *
499
+	 * @param bool	| $replace_interests| True if we're replacing interest groups, false if updating interest groups
500
+	 * @param class 	| $list_class		| Class for interacting with the current list
501
+	 * @return array | $groups			| Array of interest groups 
502
+	 */
503 503
 	public function get_default_interest_groups( $replace_interests, $list_class ) {
504 504
 
505 505
 		// If $replace_interests flag is true then loop through interest groups and set them all to false to start.
@@ -533,15 +533,15 @@  discard block
 block discarded – undo
533 533
 
534 534
 
535 535
 	/**
536
-	* Loop through the interest group form data to sanitize, format, filter, and return.
537
-	*
538
-	* @since 6.3.0
539
-	*
540
-	* @param array | $data			| The array of user-submitted form values
541
-	* @param array | $form_fields	| The array of form field definitions for this YIKES MailChimp form
542
-	* @param array | $groups		| The array of interest groups created by `get_default_interest_groups()`
543
-	* @return array| $groups		| The array of sanitized and formatted form values
544
-	*/
536
+	 * Loop through the interest group form data to sanitize, format, filter, and return.
537
+	 *
538
+	 * @since 6.3.0
539
+	 *
540
+	 * @param array | $data			| The array of user-submitted form values
541
+	 * @param array | $form_fields	| The array of form field definitions for this YIKES MailChimp form
542
+	 * @param array | $groups		| The array of interest groups created by `get_default_interest_groups()`
543
+	 * @return array| $groups		| The array of sanitized and formatted form values
544
+	 */
545 545
 	public function get_submitted_interest_groups( $data, $form_fields, $groups ) {
546 546
 
547 547
 		// loop to push variables to our array
@@ -570,13 +570,13 @@  discard block
 block discarded – undo
570 570
 		}
571 571
 
572 572
 		/**
573
-		*	yikes-mailchimp-filter-groups-before-submission
574
-		*
575
-		*	Catch the interest groups before they get sent over to MailChimp
576
-		*	@param array | $groups | User submitted interest group data
577
-		*	@optional int| $form_id| the ID of the form to filter
578
-		*	@since 6.3.0
579
-		*/
573
+		 *	yikes-mailchimp-filter-groups-before-submission
574
+		 *
575
+		 *	Catch the interest groups before they get sent over to MailChimp
576
+		 *	@param array | $groups | User submitted interest group data
577
+		 *	@optional int| $form_id| the ID of the form to filter
578
+		 *	@since 6.3.0
579
+		 */
580 580
 		$groups = apply_filters( 'yikes-mailchimp-filter-groups-before-submission', $groups, $this->form_id );
581 581
 		$groups = apply_filters( 'yikes-mailchimp-filter-groups-before-submission-{$this->form_id}', $groups, $this->form_id );
582 582
 
@@ -587,17 +587,17 @@  discard block
 block discarded – undo
587 587
 	/**** Functions to Handle Subscribe API Response ****/
588 588
 
589 589
 	/**
590
-	* Handle the response to a successful subscribe request
591
-	*
592
-	* @since 6.3.0
593
-	*
594
-	* @param array | $submission_settings	| Array of the form's submission settings
595
-	* @param array | $page_data				| Array of the page data
596
-	* @param array | $merge_variables		| Array of the submitted form variables
597
-	* @param array | $notifications			| Literally don't know what this is yet.
598
-	* @param array | $optin_settings 		| Array of the form's optin settings
599
-	* @param bool  | $new_subscriber 		| True if a new subscriber, false if an existing one
600
-	*/
590
+	 * Handle the response to a successful subscribe request
591
+	 *
592
+	 * @since 6.3.0
593
+	 *
594
+	 * @param array | $submission_settings	| Array of the form's submission settings
595
+	 * @param array | $page_data				| Array of the page data
596
+	 * @param array | $merge_variables		| Array of the submitted form variables
597
+	 * @param array | $notifications			| Literally don't know what this is yet.
598
+	 * @param array | $optin_settings 		| Array of the form's optin settings
599
+	 * @param bool  | $new_subscriber 		| True if a new subscriber, false if an existing one
600
+	 */
601 601
 	public function handle_submission_response_success( $submission_settings, $page_data, $merge_variables, $notifications, $optin_settings, $new_subscriber ) {
602 602
 
603 603
 		// Check if we should redirect, and collect the redirect info in an array
@@ -606,27 +606,27 @@  discard block
 block discarded – undo
606 606
 		// Fire off our actions
607 607
 
608 608
 		/**
609
-		*	yikes-mailchimp-after-submission || yikes-mailchimp-after-submission-{$form_id}
610
-		*
611
-		*	Catch the merge variables after they've been sent over to MailChimp
612
-		*	@since 6.0.0
613
-		*
614
-		*	@param array | $merge_variables | The array of user submitted form data
615
-		*/
609
+		 *	yikes-mailchimp-after-submission || yikes-mailchimp-after-submission-{$form_id}
610
+		 *
611
+		 *	Catch the merge variables after they've been sent over to MailChimp
612
+		 *	@since 6.0.0
613
+		 *
614
+		 *	@param array | $merge_variables | The array of user submitted form data
615
+		 */
616 616
 		do_action( 'yikes-mailchimp-after-submission', $merge_variables, $this->form_id );
617 617
 		do_action( "yikes-mailchimp-after-submission-{$this->form_id}", $merge_variables, $this->form_id );
618 618
 
619 619
 		/**
620
-		*	yikes-mailchimp-form-submission || yikes-mailchimp-form-submission-{$form_id}
621
-		*
622
-		*	Catch our notifications and other form data
623
-		*
624
-		*	@param string | $email			 | The user's email
625
-		*	@param array  | $merge_variables | The array of user submitted form data
626
-		*	@param string | $form_id		 | The form ID
627
-		* 	@param array  | $notifications	 | Array of notification messages
628
-		*
629
-		*/
620
+		 *	yikes-mailchimp-form-submission || yikes-mailchimp-form-submission-{$form_id}
621
+		 *
622
+		 *	Catch our notifications and other form data
623
+		 *
624
+		 *	@param string | $email			 | The user's email
625
+		 *	@param array  | $merge_variables | The array of user submitted form data
626
+		 *	@param string | $form_id		 | The form ID
627
+		 * 	@param array  | $notifications	 | Array of notification messages
628
+		 *
629
+		 */
630 630
 		do_action( 'yikes-mailchimp-form-submission', $this->email, $merge_variables, $this->form_id, $notifications );
631 631
 		do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications );
632 632
 
@@ -648,15 +648,15 @@  discard block
 block discarded – undo
648 648
 		$default_response = ( $new_subscriber === false ) ? $this->check_for_user_defined_response_message( 'success-resubscribed', $this->existing_subscriber_profile_update_message ) : $default_response;
649 649
 
650 650
 		/**
651
-		*	yikes-mailchimp-success-response
652
-		*
653
-		*	Filter the success message displayed to the user
654
-		*
655
-		*	@param string | $default_response	| The response message that will be shown to the user if unchanged (see above for logic)
656
-		*	@param string | $form_id		 	| The form ID
657
-		*	@param array  | $merge_variables 	| The array of user submitted form data
658
-		*
659
-		*/
651
+		 *	yikes-mailchimp-success-response
652
+		 *
653
+		 *	Filter the success message displayed to the user
654
+		 *
655
+		 *	@param string | $default_response	| The response message that will be shown to the user if unchanged (see above for logic)
656
+		 *	@param string | $form_id		 	| The form ID
657
+		 *	@param array  | $merge_variables 	| The array of user submitted form data
658
+		 *
659
+		 */
660 660
 		$response_message = apply_filters( 'yikes-mailchimp-success-response', $default_response, $this->form_id, $merge_variables );
661 661
 
662 662
 		// Construct our success array variables
@@ -675,13 +675,13 @@  discard block
 block discarded – undo
675 675
 	}
676 676
 
677 677
 	/**
678
-	* Handle an unsuccessful/error subscribe request
679
-	*
680
-	* @since 6.3.0
681
-	*
682
-	* @param object | $subscribe_response	| The response from the API
683
-	* @param array  | $form_fields			| The array of form field definitions for this YIKES MailChimp form
684
-	*/
678
+	 * Handle an unsuccessful/error subscribe request
679
+	 *
680
+	 * @since 6.3.0
681
+	 *
682
+	 * @param object | $subscribe_response	| The response from the API
683
+	 * @param array  | $form_fields			| The array of form field definitions for this YIKES MailChimp form
684
+	 */
685 685
 	public function handle_submission_response_error( $subscribe_response, $form_fields ) {
686 686
 
687 687
 		// Get the error data
@@ -723,13 +723,13 @@  discard block
 block discarded – undo
723 723
 	// Note: All of these functions return `return $this->yikes_fail()`. Check function for more info.
724 724
 
725 725
 	/**
726
-	* Check if the submitted form data is missing any required fields
727
-	*
728
-	* @since 6.3.0
729
-	*
730
-	* @param array | $data 			 | The array of user-submitted form values
731
-	* @param array | $form_fields	 | The array of form field definitions for this YIKES MailChimp form
732
-	*/
726
+	 * Check if the submitted form data is missing any required fields
727
+	 *
728
+	 * @since 6.3.0
729
+	 *
730
+	 * @param array | $data 			 | The array of user-submitted form values
731
+	 * @param array | $form_fields	 | The array of form field definitions for this YIKES MailChimp form
732
+	 */
733 733
 	public function check_for_required_form_fields( $data, $form_fields ) {
734 734
 
735 735
 		// Set up our defaults
@@ -754,15 +754,15 @@  discard block
 block discarded – undo
754 754
 					foreach( $value as $field => $val ) {
755 755
 
756 756
 						/**
757
-						*	'yikes-mailchimp-ignore-required-array-field'
758
-						*
759
-						* 	Filter the default array of fields we're ignoring. As of now, this is only for address fields because no other field is an array.
760
-						*
761
-						*	@param array | Array of fields to ignore. Key of the array should be the field name.
762
-						*	@param int   | $form_id
763
-						*
764
-						*	@return Array of fields to ignore.
765
-						*/
757
+						 *	'yikes-mailchimp-ignore-required-array-field'
758
+						 *
759
+						 * 	Filter the default array of fields we're ignoring. As of now, this is only for address fields because no other field is an array.
760
+						 *
761
+						 *	@param array | Array of fields to ignore. Key of the array should be the field name.
762
+						 *	@param int   | $form_id
763
+						 *
764
+						 *	@return Array of fields to ignore.
765
+						 */
766 766
 						$ignored_fields = apply_filters( 'yikes-mailchimp-ignore-required-array-field', array( 'addr2' => true ), $this->form_id );
767 767
 
768 768
 						if ( empty( $val ) && ! isset( $ignored_fields[ $field ] ) ) {
@@ -793,14 +793,14 @@  discard block
 block discarded – undo
793 793
 			);
794 794
 
795 795
 			/**
796
-			*	yikes-mailchimp-required-form-field-missing
797
-			*
798
-			*	Alter the response message shown to the user for missing required form fields
799
-			*
800
-			*	@param string | $handle_empty_required_field_message	| The default message displayed to the user
801
-			*	@param int	  | $form_id 								| The ID of the form
802
-			*	@param array  | $missing_fields							| Array of the missing required fields
803
-			*/
796
+			 *	yikes-mailchimp-required-form-field-missing
797
+			 *
798
+			 *	Alter the response message shown to the user for missing required form fields
799
+			 *
800
+			 *	@param string | $handle_empty_required_field_message	| The default message displayed to the user
801
+			 *	@param int	  | $form_id 								| The ID of the form
802
+			 *	@param array  | $missing_fields							| Array of the missing required fields
803
+			 */
804 804
 			$default_response = apply_filters( 'yikes-mailchimp-required-form-field-missing', $this->handle_empty_required_field_message, $this->form_id, $missing_fields );
805 805
 
806 806
 			// If we've found a missing field, return the array of field data
@@ -809,13 +809,13 @@  discard block
 block discarded – undo
809 809
 	}
810 810
 
811 811
 	/**
812
-	* Check if the submitted form interest group data is missing any required fields
813
-	*
814
-	* @since 6.3.0
815
-	*
816
-	* @param array | $data 			 | The array of user-submitted form values
817
-	* @param array | $form_fields	 | The array of form field definitions for this YIKES MailChimp form
818
-	*/
812
+	 * Check if the submitted form interest group data is missing any required fields
813
+	 *
814
+	 * @since 6.3.0
815
+	 *
816
+	 * @param array | $data 			 | The array of user-submitted form values
817
+	 * @param array | $form_fields	 | The array of form field definitions for this YIKES MailChimp form
818
+	 */
819 819
 	public function check_for_required_interest_groups( $data, $form_fields ) {
820 820
 
821 821
 		// Set up our defaults
@@ -849,14 +849,14 @@  discard block
 block discarded – undo
849 849
 			);
850 850
 
851 851
 			/**
852
-			*	yikes-mailchimp-required-interest-group-missing
853
-			*
854
-			*	Alter the response message shown to the user for missing required form fields
855
-			*
856
-			*	@param string | $handle_empty_required_interest_group_message	| The default message displayed to the user
857
-			*	@param int	  | $form_id 										| The ID of the form
858
-			*	@param array  | $missing_fields									| Array of the missing required fields
859
-			*/
852
+			 *	yikes-mailchimp-required-interest-group-missing
853
+			 *
854
+			 *	Alter the response message shown to the user for missing required form fields
855
+			 *
856
+			 *	@param string | $handle_empty_required_interest_group_message	| The default message displayed to the user
857
+			 *	@param int	  | $form_id 										| The ID of the form
858
+			 *	@param array  | $missing_fields									| Array of the missing required fields
859
+			 */
860 860
 			$default_response = apply_filters( 'yikes-mailchimp-required-interest-group-missing', $this->handle_empty_required_interest_group_message, $this->form_id, $missing_fields );
861 861
 
862 862
 			// If we find a required interest group with an empty value, send an error
@@ -865,12 +865,12 @@  discard block
 block discarded – undo
865 865
 	}
866 866
 
867 867
 	/**
868
-	* Handle the reCAPTCHA
869
-	*
870
-	* @since 6.3.0
871
-	*
872
-	* @param string | $recaptcha_response | The form value of the recaptcha field
873
-	*/
868
+	 * Handle the reCAPTCHA
869
+	 *
870
+	 * @since 6.3.0
871
+	 *
872
+	 * @param string | $recaptcha_response | The form value of the recaptcha field
873
+	 */
874 874
 	public function handle_recaptcha( $recaptcha_response ) {
875 875
 
876 876
 		// Before we the hit the API, let's check that we actually got a response.
@@ -878,11 +878,11 @@  discard block
 block discarded – undo
878 878
 		if ( empty( $recaptcha_response ) ) {
879 879
 
880 880
 			/**
881
-			*	yikes-mailchimp-recaptcha-required-error
882
-			*
883
-			*	Catch the recaptcha errors before they're returned to the user
884
-			*	@param string | $recaptcha_errors | A string of recaptcha errors separated by a space
885
-			*/
881
+			 *	yikes-mailchimp-recaptcha-required-error
882
+			 *
883
+			 *	Catch the recaptcha errors before they're returned to the user
884
+			 *	@param string | $recaptcha_errors | A string of recaptcha errors separated by a space
885
+			 */
886 886
 			$response = apply_filters( 'yikes-mailchimp-recaptcha-required-error', $this->handle_non_filled_recaptcha_message_message, $this->form_id );
887 887
 			return $this->yikes_fail( $hide = 0, $error = 1, $response, array(), $return_response_non_ajax = true );
888 888
 		}
@@ -915,40 +915,40 @@  discard block
 block discarded – undo
915 915
 			}
916 916
 
917 917
 			/**
918
-			*	yikes-mailchimp-recaptcha-required-error
919
-			*
920
-			*	Catch the recaptcha errors before they're returned to the user
921
-			*	@param string | $recaptcha_errors | A string of recaptcha errors separated by a space
922
-			*/
918
+			 *	yikes-mailchimp-recaptcha-required-error
919
+			 *
920
+			 *	Catch the recaptcha errors before they're returned to the user
921
+			 *	@param string | $recaptcha_errors | A string of recaptcha errors separated by a space
922
+			 */
923 923
 			$response = apply_filters( 'yikes-mailchimp-recaptcha-required-error', implode( ' ', $recaptcha_errors ), $this->form_id );
924 924
 			return $this->yikes_fail( $hide = 0, $error = 1, $response, array(), $return_response_non_ajax = true );
925 925
 		}
926 926
 	}
927 927
 
928 928
 	/**
929
-	* Handle the nonce field
930
-	*
931
-	* @since 6.3.0
932
-	*
933
-	* @param string | $nonce_value | The form value of the nonce
934
-	* @param string | $nonce_name  | The name of the nonce
935
-	*/
929
+	 * Handle the nonce field
930
+	 *
931
+	 * @since 6.3.0
932
+	 *
933
+	 * @param string | $nonce_value | The form value of the nonce
934
+	 * @param string | $nonce_name  | The name of the nonce
935
+	 */
936 936
 	public function handle_nonce( $nonce_value, $nonce_name ) {
937 937
 
938 938
 		// First, check our option - this is set in the general settings page
939 939
 		if ( get_option( 'yikes-mailchimp-use-nonce' ) === '1' ) {
940 940
 
941 941
 			/**
942
-			*	yikes-mailchimp-use-nonce-verification
943
-			*
944
-			*	Decide if we're going to check the nonce value.
945
-			*	The reason we filter this is that some users are experiencing nonce issues repeatedly.
946
-			*	The default will always be to use the nonce.
947
-			*
948
-			*	@param  int  | $form_id  | The form id
949
-			*
950
-			*	@return bool | True if we should check the nonce
951
-			*/
942
+			 *	yikes-mailchimp-use-nonce-verification
943
+			 *
944
+			 *	Decide if we're going to check the nonce value.
945
+			 *	The reason we filter this is that some users are experiencing nonce issues repeatedly.
946
+			 *	The default will always be to use the nonce.
947
+			 *
948
+			 *	@param  int  | $form_id  | The form id
949
+			 *
950
+			 *	@return bool | True if we should check the nonce
951
+			 */
952 952
 			$use_nonce = apply_filters( 'yikes-mailchimp-use-nonce-verification', true, $this->form_id );
953 953
 
954 954
 			// We let the filter override the option because the filter is on a per-form basis 
@@ -961,24 +961,24 @@  discard block
 block discarded – undo
961 961
 	}
962 962
 
963 963
 	/**
964
-	* Handle a merge_variables error
965
-	*
966
-	* @since 6.3.0
967
-	*
968
-	* @param int	| $error	| Int $error = 1 if an error
969
-	* @param string | $message  | The message shown to the user
970
-	*/
964
+	 * Handle a merge_variables error
965
+	 *
966
+	 * @since 6.3.0
967
+	 *
968
+	 * @param int	| $error	| Int $error = 1 if an error
969
+	 * @param string | $message  | The message shown to the user
970
+	 */
971 971
 	public function handle_merge_variables_error( $error, $message ) {
972 972
 		return $this->yikes_fail( $hide = 0, $error, $message, array(), $return_response_non_ajax = true );
973 973
 	}
974 974
 
975 975
 	/**
976
-	* Handle an empty email field and return the corresponding error message
977
-	*
978
-	* @since 6.3.0
979
-	*
980
-	* @param string | $email
981
-	*/
976
+	 * Handle an empty email field and return the corresponding error message
977
+	 *
978
+	 * @since 6.3.0
979
+	 *
980
+	 * @param string | $email
981
+	 */
982 982
 	public function handle_empty_email( $email ) {
983 983
 		if ( empty( $email ) ) {
984 984
 			return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_email_message );
@@ -986,12 +986,12 @@  discard block
 block discarded – undo
986 986
 	}
987 987
 
988 988
 	/**
989
-	* Check if the form is empty and return the corresponding error message
990
-	*
991
-	* @since 6.3.0
992
-	*
993
-	* @param array | $form_data
994
-	*/
989
+	 * Check if the form is empty and return the corresponding error message
990
+	 *
991
+	 * @since 6.3.0
992
+	 *
993
+	 * @param array | $form_data
994
+	 */
995 995
 	public function handle_empty_form( $form_data ) {
996 996
 		if ( empty( $form_data ) ) {
997 997
 			return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_form_message );
@@ -999,12 +999,12 @@  discard block
 block discarded – undo
999 999
 	}
1000 1000
 
1001 1001
 	/**
1002
-	* Check if the honeypot is NOT empty and return the corresponding error message
1003
-	*
1004
-	* @since 6.3.0
1005
-	*
1006
-	* @param bool | $honey_pot_filled | True if the honeypot was filled out
1007
-	*/
1002
+	 * Check if the honeypot is NOT empty and return the corresponding error message
1003
+	 *
1004
+	 * @since 6.3.0
1005
+	 *
1006
+	 * @param bool | $honey_pot_filled | True if the honeypot was filled out
1007
+	 */
1008 1008
 	public function handle_non_empty_honeypot( $honey_pot_filled ) {
1009 1009
 		if ( $honey_pot_filled === true ) {
1010 1010
 			return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_non_empty_honeypot_message );
@@ -1012,12 +1012,12 @@  discard block
 block discarded – undo
1012 1012
 	}
1013 1013
 
1014 1014
 	/**
1015
-	* Loop through fields looking for null and return the corresponding error message
1016
-	*
1017
-	* @since 6.3.0
1018
-	*
1019
-	* @param array | $fields_array | An array of fields to loop through and make sure they're not null
1020
-	*/
1015
+	 * Loop through fields looking for null and return the corresponding error message
1016
+	 *
1017
+	 * @since 6.3.0
1018
+	 *
1019
+	 * @param array | $fields_array | An array of fields to loop through and make sure they're not null
1020
+	 */
1021 1021
 	public function handle_empty_fields_generic( $fields_array ) {
1022 1022
 		foreach( $fields_array as $field ) {
1023 1023
 			if ( $field === null ) {
@@ -1027,12 +1027,12 @@  discard block
 block discarded – undo
1027 1027
 	}
1028 1028
 
1029 1029
 	/**
1030
-	* Check if the list handler is empty and return the corresponding error message
1031
-	*
1032
-	* @since 6.3.0
1033
-	*
1034
-	* @param class | $list_handler | A class that handles list functions
1035
-	*/
1030
+	 * Check if the list handler is empty and return the corresponding error message
1031
+	 *
1032
+	 * @since 6.3.0
1033
+	 *
1034
+	 * @param class | $list_handler | A class that handles list functions
1035
+	 */
1036 1036
 	public function handle_empty_list_handler( $list_handler ) {
1037 1037
 		if ( empty( $list_handler ) ) {
1038 1038
 			return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_list_handler_message );
@@ -1040,12 +1040,12 @@  discard block
 block discarded – undo
1040 1040
 	}
1041 1041
 
1042 1042
 	/**
1043
-	* Check if the form id is empty and return the corresponding error message
1044
-	*
1045
-	* @since 6.3.0
1046
-	*
1047
-	* @param int | $form_id | The form ID
1048
-	*/
1043
+	 * Check if the form id is empty and return the corresponding error message
1044
+	 *
1045
+	 * @since 6.3.0
1046
+	 *
1047
+	 * @param int | $form_id | The form ID
1048
+	 */
1049 1049
 	public function handle_empty_form_id( $form_id ) {
1050 1050
 		if ( empty( $form_id ) ) {
1051 1051
 			return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_form_id_message );
@@ -1053,10 +1053,10 @@  discard block
 block discarded – undo
1053 1053
 	}
1054 1054
 
1055 1055
 	/**
1056
-	* Construct and filter the error message related to user's re-subscribing when it's not allowed
1057
-	*
1058
-	* @since 6.3.0
1059
-	*/
1056
+	 * Construct and filter the error message related to user's re-subscribing when it's not allowed
1057
+	 *
1058
+	 * @since 6.3.0
1059
+	 */
1060 1060
 	public function handle_disallowed_existing_user_update() {
1061 1061
 
1062 1062
 		// Get the default response
@@ -1069,10 +1069,10 @@  discard block
 block discarded – undo
1069 1069
 	}
1070 1070
 
1071 1071
 	/**
1072
-	* Construct and filter the error message related to the profile link to update user's profile
1073
-	*
1074
-	* @since 6.3.0
1075
-	*/
1072
+	 * Construct and filter the error message related to the profile link to update user's profile
1073
+	 *
1074
+	 * @since 6.3.0
1075
+	 */
1076 1076
 	public function handle_updating_existing_user() {
1077 1077
 
1078 1078
 		// Get the first half of the message
@@ -1097,15 +1097,15 @@  discard block
 block discarded – undo
1097 1097
 	/**** Helper Functions ****/
1098 1098
 
1099 1099
 	/**
1100
-	* Check the user-defined $error_messages array for a message, filter it, and return it. These messages overwrite the defaults.
1101
-	*
1102
-	* @since 6.3.0
1103
-	*
1104
-	* @param string | $slug 		| The type of message we're looking for
1105
-	* @param string | $response_text| The default response message
1106
-	* @param array  | $data			| An array of data that may be needed to construct the user's error message
1107
-	* @return string| $response_text| The $response_text (after it's potentially been changed)
1108
-	*/
1100
+	 * Check the user-defined $error_messages array for a message, filter it, and return it. These messages overwrite the defaults.
1101
+	 *
1102
+	 * @since 6.3.0
1103
+	 *
1104
+	 * @param string | $slug 		| The type of message we're looking for
1105
+	 * @param string | $response_text| The default response message
1106
+	 * @param array  | $data			| An array of data that may be needed to construct the user's error message
1107
+	 * @return string| $response_text| The $response_text (after it's potentially been changed)
1108
+	 */
1109 1109
 	protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) {
1110 1110
 
1111 1111
 		switch( $slug ) {
@@ -1119,13 +1119,13 @@  discard block
 block discarded – undo
1119 1119
 				}
1120 1120
 
1121 1121
 				/**
1122
-				*	yikes-easy-mailchimp-user-already-subscribed-text
1123
-				*
1124
-				*	Catch the message for user's already subscrbed before we show it to the user
1125
-				*	@param string | $message  | The response message
1126
-				*	@param int	  | $form_id  | The form id
1127
-				*	@param string | $email	  | The user's email
1128
-				*/
1122
+				 *	yikes-easy-mailchimp-user-already-subscribed-text
1123
+				 *
1124
+				 *	Catch the message for user's already subscrbed before we show it to the user
1125
+				 *	@param string | $message  | The response message
1126
+				 *	@param int	  | $form_id  | The form id
1127
+				 *	@param string | $email	  | The user's email
1128
+				 */
1129 1129
 				$response_text = apply_filters( 'yikes-mailchimp-user-already-subscribed-text', $response_text, $this->form_id, $this->email );
1130 1130
 
1131 1131
 				return $response_text;
@@ -1144,13 +1144,13 @@  discard block
 block discarded – undo
1144 1144
 				}
1145 1145
 
1146 1146
 				/**
1147
-				*	yikes-easy-mailchimp-user-already-subscribed-link-text
1148
-				*
1149
-				*	Catch the message for user's already subscrbed link text before we show it to the user
1150
-				*
1151
-				*	@param string | $response_text	| The response message that will be shown to the user
1152
-				*	@param string | $form_id		| The form ID
1153
-				*/
1147
+				 *	yikes-easy-mailchimp-user-already-subscribed-link-text
1148
+				 *
1149
+				 *	Catch the message for user's already subscrbed link text before we show it to the user
1150
+				 *
1151
+				 *	@param string | $response_text	| The response message that will be shown to the user
1152
+				 *	@param string | $form_id		| The form ID
1153
+				 */
1154 1154
 				$response_text = apply_filters( 'yikes-mailchimp-user-already-subscribed-link-text', $response_text, $this->form_id );
1155 1155
 
1156 1156
 				return $response_text;
@@ -1164,14 +1164,14 @@  discard block
 block discarded – undo
1164 1164
 				}
1165 1165
 
1166 1166
 				/**
1167
-				*	yikes-mailchimp-success-double-optin-response
1168
-				*
1169
-				*	Filter the success message displayed to the user
1170
-				*
1171
-				*	@param string | $response_text	| The response message that will be shown to the user
1172
-				*	@param string | $form_id		| The form ID
1173
-				*
1174
-				*/
1167
+				 *	yikes-mailchimp-success-double-optin-response
1168
+				 *
1169
+				 *	Filter the success message displayed to the user
1170
+				 *
1171
+				 *	@param string | $response_text	| The response message that will be shown to the user
1172
+				 *	@param string | $form_id		| The form ID
1173
+				 *
1174
+				 */
1175 1175
 				$response_text = apply_filters( 'yikes-mailchimp-success-double-optin-response', $response_text, $this->form_id );
1176 1176
 
1177 1177
 				return $response_text;
@@ -1184,14 +1184,14 @@  discard block
 block discarded – undo
1184 1184
 				}
1185 1185
 
1186 1186
 				/**
1187
-				*	yikes-mailchimp-success-single-optin-response
1188
-				*
1189
-				*	Filter the success message displayed to the user
1190
-				*
1191
-				*	@param string | $response_text	| The response message that will be shown to the user
1192
-				*	@param string | $form_id		| The form ID
1193
-				*
1194
-				*/
1187
+				 *	yikes-mailchimp-success-single-optin-response
1188
+				 *
1189
+				 *	Filter the success message displayed to the user
1190
+				 *
1191
+				 *	@param string | $response_text	| The response message that will be shown to the user
1192
+				 *	@param string | $form_id		| The form ID
1193
+				 *
1194
+				 */
1195 1195
 				$response_text = apply_filters( 'yikes-mailchimp-success-single-optin-response', $response_text, $this->form_id );
1196 1196
 
1197 1197
 				return $response_text;
@@ -1204,14 +1204,14 @@  discard block
 block discarded – undo
1204 1204
 				}
1205 1205
 
1206 1206
 				/**
1207
-				*	yikes-mailchimp-success-resubscribed-response
1208
-				*
1209
-				*	Filter the success message displayed to the user
1210
-				*
1211
-				*	@param string | $response_text	| The response message that will be shown to the user
1212
-				*	@param string | $form_id 		| The form ID
1213
-				*
1214
-				*/
1207
+				 *	yikes-mailchimp-success-resubscribed-response
1208
+				 *
1209
+				 *	Filter the success message displayed to the user
1210
+				 *
1211
+				 *	@param string | $response_text	| The response message that will be shown to the user
1212
+				 *	@param string | $form_id 		| The form ID
1213
+				 *
1214
+				 */
1215 1215
 				$response_text = apply_filters( 'yikes-mailchimp-success-resubscribed-response', $response_text, $this->form_id );
1216 1216
 
1217 1217
 				return $response_text;
@@ -1227,16 +1227,16 @@  discard block
 block discarded – undo
1227 1227
 				}
1228 1228
 
1229 1229
 				/**
1230
-				*	yikes-mailchimp-general-error-response
1231
-				*
1232
-				*	Filter the error message displayed to the user
1233
-				*
1234
-				*	@param string | $original_response_text     | The original response message returned from the API
1235
-				*	@param string | $user_defined_response_text | The response message defined by the user
1236
-				*	@param string | $form_id                    | The form ID
1237
-				*
1238
-				* 	@return string | $response_text | The message that will be shown to the user 
1239
-				*/
1230
+				 *	yikes-mailchimp-general-error-response
1231
+				 *
1232
+				 *	Filter the error message displayed to the user
1233
+				 *
1234
+				 *	@param string | $original_response_text     | The original response message returned from the API
1235
+				 *	@param string | $user_defined_response_text | The response message defined by the user
1236
+				 *	@param string | $form_id                    | The form ID
1237
+				 *
1238
+				 * 	@return string | $response_text | The message that will be shown to the user 
1239
+				 */
1240 1240
 				$response_text = apply_filters( 'yikes-mailchimp-general-error-response', $original_response_text, $user_defined_response_text, $this->form_id );
1241 1241
 
1242 1242
 				return $response_text;
@@ -1250,14 +1250,14 @@  discard block
 block discarded – undo
1250 1250
 	}
1251 1251
 
1252 1252
 	/**
1253
-	* Wrap the response message in HTML for Non-AJAX form submissions
1254
-	*
1255
-	* @since 6.3.0
1256
-	*
1257
-	* @param string | $message		| The response message
1258
-	* @param bool	| $is_success	| Boolean signifying if we're returning a success message or an error message
1259
-	* @return string| The $message wrapping in HTML
1260
-	*/
1253
+	 * Wrap the response message in HTML for Non-AJAX form submissions
1254
+	 *
1255
+	 * @since 6.3.0
1256
+	 *
1257
+	 * @param string | $message		| The response message
1258
+	 * @param bool	| $is_success	| Boolean signifying if we're returning a success message or an error message
1259
+	 * @return string| The $message wrapping in HTML
1260
+	 */
1261 1261
 	public function wrap_form_submission_response( $message, $is_success ) {
1262 1262
 
1263 1263
 		// If we're successful, we wrap the $message differently
@@ -1271,14 +1271,14 @@  discard block
 block discarded – undo
1271 1271
 	/**** Returning Success / Failure Functions ****/
1272 1272
 
1273 1273
 	/**
1274
-	* Return success. Method of returning success based on the $is_ajax flag
1275
-	*
1276
-	* @since 6.3.0
1277
-	*
1278
-	* @param array | $success_array | Array of success values to return
1279
-	*
1280
-	* @return If AJAX, return wp_send_json_success(). If not AJAX, set the global $process_submission_response variable and simply `return`.
1281
-	*/
1274
+	 * Return success. Method of returning success based on the $is_ajax flag
1275
+	 *
1276
+	 * @since 6.3.0
1277
+	 *
1278
+	 * @param array | $success_array | Array of success values to return
1279
+	 *
1280
+	 * @return If AJAX, return wp_send_json_success(). If not AJAX, set the global $process_submission_response variable and simply `return`.
1281
+	 */
1282 1282
 	protected function yikes_success( $success_array ) {
1283 1283
 		if ( $this->is_ajax === true ) {
1284 1284
 			wp_send_json_success( $success_array );
@@ -1291,18 +1291,18 @@  discard block
 block discarded – undo
1291 1291
 	}
1292 1292
 
1293 1293
 	/**
1294
-	* Return failure. Method of returning failure based on the $is_ajax flag
1295
-	*
1296
-	* @since 6.3.0
1297
-	*
1298
-	* @param int	| $hide						| Flag whether to hide the form (1 = hide, 0 = do not hide)
1299
-	* @param int	| $error					| Flag whether this is an error (1 = error, 0 = no error)
1300
-	* @param string | $response					| The response message to display to the user
1301
-	* @param array  | $additional_fields		| An array of additional fields to return
1302
-	* @param bool	| $return_response_non_ajax | Boolean deciding if we need to return a message
1303
-	*
1304
-	* @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false.
1305
-	*/	
1294
+	 * Return failure. Method of returning failure based on the $is_ajax flag
1295
+	 *
1296
+	 * @since 6.3.0
1297
+	 *
1298
+	 * @param int	| $hide						| Flag whether to hide the form (1 = hide, 0 = do not hide)
1299
+	 * @param int	| $error					| Flag whether this is an error (1 = error, 0 = no error)
1300
+	 * @param string | $response					| The response message to display to the user
1301
+	 * @param array  | $additional_fields		| An array of additional fields to return
1302
+	 * @param bool	| $return_response_non_ajax | Boolean deciding if we need to return a message
1303
+	 *
1304
+	 * @return If AJAX, return $this->yikes_send_json_error(). If not AJAX, return an array || false.
1305
+	 */	
1306 1306
 	protected function yikes_fail( $hide, $error, $response, $additional_fields = array(), $return_response_non_ajax = false ) {
1307 1307
 		if ( $this->is_ajax === true ) {
1308 1308
 			$this->yikes_send_json_error( $hide, $error, $response, $additional_fields );
@@ -1315,17 +1315,17 @@  discard block
 block discarded – undo
1315 1315
 	}
1316 1316
 
1317 1317
 	/**
1318
-	* Wrapper function for wp_send_json_error()
1319
-	*
1320
-	* @since 6.3.0
1321
-	*
1322
-	* @param int	| $hide						| Flag whether to hide the form (1 = hide, 0 = do not hide)
1323
-	* @param int	| $error					| Flag whether this is an error (1 = error, 0 = no error)
1324
-	* @param string | $translated_string		| The response message to display to the user
1325
-	* @param array  | $additional_fields		| An array of additional fields to return
1326
-	*
1327
-	* @return func  | wp_send_json_error()
1328
-	*/
1318
+	 * Wrapper function for wp_send_json_error()
1319
+	 *
1320
+	 * @since 6.3.0
1321
+	 *
1322
+	 * @param int	| $hide						| Flag whether to hide the form (1 = hide, 0 = do not hide)
1323
+	 * @param int	| $error					| Flag whether this is an error (1 = error, 0 = no error)
1324
+	 * @param string | $translated_string		| The response message to display to the user
1325
+	 * @param array  | $additional_fields		| An array of additional fields to return
1326
+	 *
1327
+	 * @return func  | wp_send_json_error()
1328
+	 */
1329 1329
 	protected function yikes_send_json_error( $hide, $error, $translated_string, $additional_fields = array() ) {
1330 1330
 
1331 1331
 		// Default response array
@@ -1349,14 +1349,14 @@  discard block
 block discarded – undo
1349 1349
 	/** Static functions used in other places **/
1350 1350
 
1351 1351
 	/**
1352
-	* Handle the redirect logic for successful submissions
1353
-	*
1354
-	* @since 6.3.0
1355
-	*
1356
-	* @param array | $submission_settings	| Array of the form's submission settings
1357
-	* @param array | $page_data				| Page ID
1358
-	* @return array| $redirect_array		| Array with two values: Redirection flag, Redirect URL
1359
-	*/
1352
+	 * Handle the redirect logic for successful submissions
1353
+	 *
1354
+	 * @since 6.3.0
1355
+	 *
1356
+	 * @param array | $submission_settings	| Array of the form's submission settings
1357
+	 * @param array | $page_data				| Page ID
1358
+	 * @return array| $redirect_array		| Array with two values: Redirection flag, Redirect URL
1359
+	 */
1360 1360
 	public static function handle_submission_response_success_redirect( $form_id, $submission_settings, $page_data ) {
1361 1361
 
1362 1362
 		$default_redirect_time_ms = 1500;
@@ -1389,23 +1389,23 @@  discard block
 block discarded – undo
1389 1389
 			$redirect_url = 'custom_url' !== $redirect_page_setting ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting;
1390 1390
 
1391 1391
 			/**
1392
-			*	yikes-mailchimp-redirect-url
1393
-			*
1394
-			*	Catch the redirect URL before it's shown to the user
1395
-			*
1396
-			*	@param string | $redirect_url	| The URL that we will redirect to
1397
-			*	@param string | $form_id		| The ID of the current form being subscribed to
1398
-			*	@param array  | $page_data		| An array of data related to the page the form is on
1399
-			*/
1392
+			 *	yikes-mailchimp-redirect-url
1393
+			 *
1394
+			 *	Catch the redirect URL before it's shown to the user
1395
+			 *
1396
+			 *	@param string | $redirect_url	| The URL that we will redirect to
1397
+			 *	@param string | $form_id		| The ID of the current form being subscribed to
1398
+			 *	@param array  | $page_data		| An array of data related to the page the form is on
1399
+			 */
1400 1400
 			$redirect_url = apply_filters( 'yikes-mailchimp-redirect-url', $redirect_url, $form_id, $page_data );
1401 1401
 
1402 1402
 			/**
1403
-			*	yikes-mailchimp-redirect-timer
1404
-			*
1405
-			*	Catch the redirect timer before it's sent to the JavaScript file
1406
-			*
1407
-			*	@param int | $default_redirect_time_ms | The default time (1500 milliseconds) to wait before redirecting
1408
-			*/
1403
+			 *	yikes-mailchimp-redirect-timer
1404
+			 *
1405
+			 *	Catch the redirect timer before it's sent to the JavaScript file
1406
+			 *
1407
+			 *	@param int | $default_redirect_time_ms | The default time (1500 milliseconds) to wait before redirecting
1408
+			 */
1409 1409
 			$redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $default_redirect_time_ms, $form_id, $page_data );
1410 1410
 
1411 1411
 			$redirect_array['redirect_timer'] = $redirect_timer;
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
 		$this->handle_updating_existing_user_link_message     = __( 'To update your MailChimp profile, please click to send yourself an update link', 'yikes-inc-easy-mailchimp-extender' );
256 256
 		$this->handle_empty_required_field_message            = __( 'A required field is missing.', 'yikes-inc-easy-mailchimp-extender' );
257 257
 		$this->handle_empty_required_interest_group_message   = __( 'A required interest group is missing.', 'yikes-inc-easy-mailchimp-extender' );
258
-		$this->handle_nonce_message                           = __( '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' );
258
+		$this->handle_nonce_message                           = __( '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' );
259 259
 		$this->handle_non_filled_recaptcha_message_message    = __( 'Please check the reCAPTCHA field.', 'yikes-inc-easy-mailchimp-extender' );
260 260
 		$this->generic_recaptcha_error_message                = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' );
261 261
 
262 262
 		// Define our success messages
263
-		$this->default_response_single_optin_success_message  = __( 'Thank you for subscribing!' , 'yikes-inc-easy-mailchimp-extender' );
264
-		$this->default_response_double_optin_success_message  = __( 'Thank you for subscribing. Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' );
263
+		$this->default_response_single_optin_success_message  = __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' );
264
+		$this->default_response_double_optin_success_message  = __( 'Thank you for subscribing. Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' );
265 265
 		$this->existing_subscriber_profile_update_message     = __( 'Thank you for already being a subscriber! Your profile info has been updated.', 'yikes-inc-easy-mailchimp-extender' );
266 266
 	}
267 267
 
@@ -373,16 +373,16 @@  discard block
 block discarded – undo
373 373
 			}
374 374
 
375 375
 			// Check if the current iteration has a 'date_format' key set (i.e. date/birthday fields)
376
-			if ( isset( $form_fields[ $merge_tag ]['date_format'] ) ) {
377
-				$sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ]['date_format'] );
376
+			if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) {
377
+				$sanitized = $this->handle_date_format_merge_values( $sanitized, $form_fields[ $merge_tag ][ 'date_format' ] );
378 378
 			}
379 379
 
380 380
 			$merge_variables[ $merge_tag ] = $sanitized;
381 381
 		}
382 382
 
383 383
 		// Make sure we send the lower-cased, sanitized email so it matches the one we're sending in the body of the request.
384
-		if ( isset( $merge_variables['EMAIL'] ) ) {
385
-			$merge_variables['EMAIL'] = $this->email;
384
+		if ( isset( $merge_variables[ 'EMAIL' ] ) ) {
385
+			$merge_variables[ 'EMAIL' ] = $this->email;
386 386
 		}
387 387
 
388 388
 		/**
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 		if ( count( $pieces ) === 3 ) {
460 460
 
461 461
 			// $pieces[1] = MM. $pieces[0] = DD. $date = MM/DD/YYYY
462
-			$date = $pieces[1] . '/' . $pieces[0] . '/' . $pieces[2];
462
+			$date = $pieces[ 1 ] . '/' . $pieces[ 0 ] . '/' . $pieces[ 2 ];
463 463
 		}
464 464
 
465 465
 		return $date;
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 		if ( count( $pieces ) === 2 ) {
485 485
 
486 486
 			// $pieces[1] = MM. $pieces[0] = DD. $birthday = MM/DD
487
-			$birthday = $pieces[1] . '/' . $pieces[0];
487
+			$birthday = $pieces[ 1 ] . '/' . $pieces[ 0 ];
488 488
 		}
489 489
 
490 490
 		return $birthday;
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 			// Loop through the interest groups and create a single array like {group_id} => false
518 518
 			foreach ( $interest_groupings as $group_data ) {
519 519
 
520
-				foreach ( $group_data['items'] as $item ) {
521
-					$groups[$item['id']] = false;
520
+				foreach ( $group_data[ 'items' ] as $item ) {
521
+					$groups[ $item[ 'id' ] ] = false;
522 522
 				}
523 523
 
524 524
 			}
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 		do_action( "yikes-mailchimp-form-submission-{$this->form_id}", $this->email, $merge_variables, $this->form_id, $notifications );
632 632
 
633 633
 		// Get the optin value
634
-		$optin = isset( $optin_settings['optin'] ) ? (int) $optin_settings['optin'] : 0;
634
+		$optin = isset( $optin_settings[ 'optin' ] ) ? (int) $optin_settings[ 'optin' ] : 0;
635 635
 
636 636
 		if ( 1 === $optin ) {
637 637
 
@@ -661,13 +661,13 @@  discard block
 block discarded – undo
661 661
 
662 662
 		// Construct our success array variables
663 663
 		$return_success_array = array(
664
-			'hide'        		=> $submission_settings['hide_form_post_signup'],
664
+			'hide'        		=> $submission_settings[ 'hide_form_post_signup' ],
665 665
 			'error'       		=> 0,
666 666
 			'response'    		=> $response_message,
667
-			'redirection' 		=> $redirect_array['redirection'],
668
-			'redirect'    		=> $redirect_array['redirect'],
669
-			'new_window' 		=> $redirect_array['new_window'],
670
-			'redirect_timer'	=> $redirect_array['redirect_timer'],
667
+			'redirection' 		=> $redirect_array[ 'redirection' ],
668
+			'redirect'    		=> $redirect_array[ 'redirect' ],
669
+			'new_window' 		=> $redirect_array[ 'new_window' ],
670
+			'redirect_timer'	=> $redirect_array[ 'redirect_timer' ],
671 671
 		);
672 672
 
673 673
 		// Return success array
@@ -689,12 +689,12 @@  discard block
 block discarded – undo
689 689
 		$details    = '';
690 690
 
691 691
 		// Loop through the error data and retrieve any fields and messages
692
-		if ( isset( $error_data['data'] ) ) {
693
-			foreach ( $error_data['data'] as $datum ) {
694
-				if ( ! isset( $datum['field'], $datum['message'] ) ) {
692
+		if ( isset( $error_data[ 'data' ] ) ) {
693
+			foreach ( $error_data[ 'data' ] as $datum ) {
694
+				if ( ! isset( $datum[ 'field' ], $datum[ 'message' ] ) ) {
695 695
 					continue;
696 696
 				}
697
-				$details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum['field'] ]['label'], $datum['message'] );
697
+				$details .= sprintf( '<br>Error with %1$s field: <strong>%2$s</strong>', $form_fields[ $datum[ 'field' ] ][ 'label' ], $datum[ 'message' ] );
698 698
 			}
699 699
 		}
700 700
 
@@ -737,21 +737,21 @@  discard block
 block discarded – undo
737 737
 		$missing_fields = array();
738 738
 
739 739
 		// Loop through submitted form data
740
-		foreach( $data as $merge_tag => $value ) {
740
+		foreach ( $data as $merge_tag => $value ) {
741 741
 
742 742
 			// Skip interest groups
743
-			if ( isset( $form_fields[ $merge_tag ]['group_id'] ) ) {
743
+			if ( isset( $form_fields[ $merge_tag ][ 'group_id' ] ) ) {
744 744
 				continue;
745 745
 			}
746 746
 
747 747
 			// check if this field is required
748
-			if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ]['require'] ) && $form_fields[ $merge_tag ]['require'] === '1' ) {
748
+			if ( isset( $form_fields[ $merge_tag ] ) && isset( $form_fields[ $merge_tag ][ 'require' ] ) && $form_fields[ $merge_tag ][ 'require' ] === '1' ) {
749 749
 
750 750
 				// Check if the field(s) are empty
751 751
 				if ( is_array( $value ) ) {
752 752
 
753 753
 					// Loop through the data and check if any are empty
754
-					foreach( $value as $field => $val ) {
754
+					foreach ( $value as $field => $val ) {
755 755
 
756 756
 						/**
757 757
 						*	'yikes-mailchimp-ignore-required-array-field'
@@ -770,13 +770,13 @@  discard block
 block discarded – undo
770 770
 
771 771
 							// Set the merge label (e.g. MMERGE6) as the key so we don't get the same field multiple times
772 772
 							// (e.g. For arrays, like an address, where multiple address fields are empty)
773
-							$missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ];
773
+							$missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ];
774 774
 						}
775 775
 					}
776 776
 
777 777
 				} else if ( empty( $value ) ) {
778 778
 					$field_is_missing = true;
779
-					$missing_fields[ $form_fields[ $merge_tag ]['merge'] ] = $form_fields[ $merge_tag ];
779
+					$missing_fields[ $form_fields[ $merge_tag ][ 'merge' ] ] = $form_fields[ $merge_tag ];
780 780
 				}
781 781
 			}
782 782
 		}
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 		foreach ( $form_fields as $merge_tag => $field_data ) {
827 827
 
828 828
 			// If an interest group and it's required
829
-			if ( isset( $field_data['group_id'] ) && isset( $field_data['require'] ) && $field_data['require'] === '1' ) {
829
+			if ( isset( $field_data[ 'group_id' ] ) && isset( $field_data[ 'require' ] ) && $field_data[ 'require' ] === '1' ) {
830 830
 				
831 831
 				// Check if it was submitted (meaning, check if it's set in our $data array)
832 832
 				if ( ! isset( $data[ 'group-' . $merge_tag ] ) ) {
@@ -888,30 +888,30 @@  discard block
 block discarded – undo
888 888
 		}
889 889
 
890 890
 		// Construct the API URL
891
-		$url           = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER['REMOTE_ADDR'] );
891
+		$url           = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $recaptcha_response . '&remoteip=' . $_SERVER[ 'REMOTE_ADDR' ] );
892 892
 		$response      = wp_remote_get( $url );
893
-		$response_body = json_decode( $response['body'], true );
893
+		$response_body = json_decode( $response[ 'body' ], true );
894 894
 
895 895
 		// Set up errors array
896 896
 		$recaptcha_errors = array();
897 897
 
898 898
 		// if we've hit an error, lets return the error!
899
-		if ( true !== $response_body['success'] ) {
899
+		if ( true !== $response_body[ 'success' ] ) {
900 900
 
901
-			if( isset( $response_body['error-codes'] ) ) {
901
+			if ( isset( $response_body[ 'error-codes' ] ) ) {
902 902
 
903 903
 				// Loop through response error codes
904
-				foreach ( $response_body['error-codes'] as $error_code ) {
904
+				foreach ( $response_body[ 'error-codes' ] as $error_code ) {
905 905
 					if ( 'missing-input-response' === $error_code ) {
906 906
 						$error_code = $this->handle_non_filled_recaptcha_message;
907 907
 					}
908 908
 
909 909
 					// Add our error_code to the errors array
910
-					$recaptcha_errors[] = $error_code;
910
+					$recaptcha_errors[ ] = $error_code;
911 911
 				}
912 912
 
913 913
 			} else {
914
-				$recaptcha_errors[] = $this->generic_recaptcha_error_message;
914
+				$recaptcha_errors[ ] = $this->generic_recaptcha_error_message;
915 915
 			}
916 916
 
917 917
 			/**
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 	* @param array | $fields_array | An array of fields to loop through and make sure they're not null
1020 1020
 	*/
1021 1021
 	public function handle_empty_fields_generic( $fields_array ) {
1022
-		foreach( $fields_array as $field ) {
1022
+		foreach ( $fields_array as $field ) {
1023 1023
 			if ( $field === null ) {
1024 1024
 				return $this->yikes_fail( $hide = 0, $error = 1, $this->handle_empty_fields_generic_message );
1025 1025
 			}
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 
1086 1086
 		// Append our 'send-update-email' link and text
1087 1087
 		$response .= $link_start_tag;
1088
-		$response .= 	$this->handle_updating_existing_user_link_message;
1088
+		$response .= $this->handle_updating_existing_user_link_message;
1089 1089
 		$response .= $link_close_tag;
1090 1090
 
1091 1091
 		// Check for a user-defined message
@@ -1108,14 +1108,14 @@  discard block
 block discarded – undo
1108 1108
 	*/
1109 1109
 	protected function check_for_user_defined_response_message( $slug, $response_text, $data = false ) {
1110 1110
 
1111
-		switch( $slug ) {
1111
+		switch ( $slug ) {
1112 1112
 			case 'already-subscribed':
1113 1113
 
1114 1114
 				// Check if this error message exists
1115
-				if ( isset( $this->error_messages['already-subscribed'] ) && ! empty( $this->error_messages['already-subscribed'] ) ) {
1115
+				if ( isset( $this->error_messages[ 'already-subscribed' ] ) && ! empty( $this->error_messages[ 'already-subscribed' ] ) ) {
1116 1116
 
1117 1117
 					// Check if the substring (that we replace) '[email]' is located in the string and replace it
1118
-					$response_text = str_replace( '[email]', $this->email, $this->error_messages['already-subscribed'] );
1118
+					$response_text = str_replace( '[email]', $this->email, $this->error_messages[ 'already-subscribed' ] );
1119 1119
 				}
1120 1120
 
1121 1121
 				/**
@@ -1134,13 +1134,13 @@  discard block
 block discarded – undo
1134 1134
 			case 'update-link':
1135 1135
 
1136 1136
 				// Check if this error message exists
1137
-				if ( $data !== false && isset( $this->error_messages['update-link'] ) && ! empty( $this->error_messages['update-link'] ) ) {
1137
+				if ( $data !== false && isset( $this->error_messages[ 'update-link' ] ) && ! empty( $this->error_messages[ 'update-link' ] ) ) {
1138 1138
 
1139 1139
 					// Check if the substring (that we replace) '[link]' is located in the string and replace it
1140
-					$response_text = str_replace( '[link]', $data['link_start_tag'], $this->error_messages['update-link'] );
1140
+					$response_text = str_replace( '[link]', $data[ 'link_start_tag' ], $this->error_messages[ 'update-link' ] );
1141 1141
 
1142 1142
 					// Remove [/link]
1143
-					$response_text = str_replace( '[/link]', $data['link_close_tag'], $response_text );
1143
+					$response_text = str_replace( '[/link]', $data[ 'link_close_tag' ], $response_text );
1144 1144
 				}
1145 1145
 
1146 1146
 				/**
@@ -1159,8 +1159,8 @@  discard block
 block discarded – undo
1159 1159
 			case 'success':
1160 1160
 
1161 1161
 				// 'success' is the user-defined success message for double opt-in
1162
-				if ( isset( $this->error_messages['success'] ) && ! empty( $this->error_messages['success'] ) ) {
1163
-					$response_text = $this->error_messages['success'];
1162
+				if ( isset( $this->error_messages[ 'success' ] ) && ! empty( $this->error_messages[ 'success' ] ) ) {
1163
+					$response_text = $this->error_messages[ 'success' ];
1164 1164
 				}
1165 1165
 
1166 1166
 				/**
@@ -1179,8 +1179,8 @@  discard block
 block discarded – undo
1179 1179
 
1180 1180
 			case 'success-single-optin':
1181 1181
 
1182
-				if ( isset( $this->error_messages['success-single-optin'] ) && ! empty( $this->error_messages['success-single-optin'] ) ) {
1183
-					$response_text = $this->error_messages['success-single-optin'];
1182
+				if ( isset( $this->error_messages[ 'success-single-optin' ] ) && ! empty( $this->error_messages[ 'success-single-optin' ] ) ) {
1183
+					$response_text = $this->error_messages[ 'success-single-optin' ];
1184 1184
 				}
1185 1185
 
1186 1186
 				/**
@@ -1199,8 +1199,8 @@  discard block
 block discarded – undo
1199 1199
 
1200 1200
 			case 'success-resubscribed':
1201 1201
 
1202
-				if ( isset( $this->error_messages['success-resubscribed'] ) && ! empty( $this->error_messages['success-resubscribed'] ) ) {
1203
-					$response_text = $this->error_messages['success-resubscribed'];
1202
+				if ( isset( $this->error_messages[ 'success-resubscribed' ] ) && ! empty( $this->error_messages[ 'success-resubscribed' ] ) ) {
1203
+					$response_text = $this->error_messages[ 'success-resubscribed' ];
1204 1204
 				}
1205 1205
 
1206 1206
 				/**
@@ -1222,8 +1222,8 @@  discard block
 block discarded – undo
1222 1222
 				$original_response_text     = $response_text;
1223 1223
 				$user_defined_response_text = '';
1224 1224
 
1225
-				if ( isset( $this->error_messages['general-error'] ) && ! empty( $this->error_messages['general-error'] ) ) {
1226
-					$user_defined_response_text = $this->error_messages['general-error'];
1225
+				if ( isset( $this->error_messages[ 'general-error' ] ) && ! empty( $this->error_messages[ 'general-error' ] ) ) {
1226
+					$user_defined_response_text = $this->error_messages[ 'general-error' ];
1227 1227
 				}
1228 1228
 
1229 1229
 				/**
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
 		} else {
1286 1286
 			global $process_submission_response;
1287 1287
 
1288
-			$process_submission_response = isset( $success_array['response'] ) ? $success_array['response'] : ''; // DEFAULT SUCCESS?
1288
+			$process_submission_response = isset( $success_array[ 'response' ] ) ? $success_array[ 'response' ] : ''; // DEFAULT SUCCESS?
1289 1289
 			$process_submission_response = $this->wrap_form_submission_response( $process_submission_response, $is_success = true );
1290 1290
 		}
1291 1291
 	}
@@ -1338,8 +1338,8 @@  discard block
 block discarded – undo
1338 1338
 		// Add additional fields we've been supplied
1339 1339
 		if ( ! empty( $additional_fields ) ) {
1340 1340
 
1341
-			foreach( $additional_fields as $key => $value ) {
1342
-				$response_array[$key] = $value;
1341
+			foreach ( $additional_fields as $key => $value ) {
1342
+				$response_array[ $key ] = $value;
1343 1343
 			}
1344 1344
 		}
1345 1345
 
@@ -1370,20 +1370,20 @@  discard block
 block discarded – undo
1370 1370
 		);
1371 1371
 
1372 1372
 		// Let's confirm we have a value before trying to use it
1373
-		$redirect_setting = isset( $submission_settings['redirect_on_submission'] ) ? $submission_settings['redirect_on_submission'] : false;
1373
+		$redirect_setting = isset( $submission_settings[ 'redirect_on_submission' ] ) ? $submission_settings[ 'redirect_on_submission' ] : false;
1374 1374
 
1375 1375
 		// Check the redirect flag
1376 1376
 		if ( '1' === $redirect_setting ) {
1377 1377
 
1378 1378
 			// Supply return array with default value of 1
1379
-			$redirect_array['redirection']	= apply_filters( 'yikes-mailchimp-redirection', 1, $form_id, $page_data );
1379
+			$redirect_array[ 'redirection' ] = apply_filters( 'yikes-mailchimp-redirection', 1, $form_id, $page_data );
1380 1380
 
1381 1381
 			// Let's confirm we have redirect_page/custom_redirect_url/new_window values
1382
-			$redirect_page_setting	 = isset( $submission_settings['redirect_page'] ) ? $submission_settings['redirect_page'] : false;
1383
-			$custom_redirect_setting = isset( $submission_settings['custom_redirect_url'] ) ? $submission_settings['custom_redirect_url'] : false;
1384
-			$redirect_new_window	 = isset( $submission_settings['redirect_new_window'] ) ? $submission_settings['redirect_new_window'] : false;
1382
+			$redirect_page_setting = isset( $submission_settings[ 'redirect_page' ] ) ? $submission_settings[ 'redirect_page' ] : false;
1383
+			$custom_redirect_setting = isset( $submission_settings[ 'custom_redirect_url' ] ) ? $submission_settings[ 'custom_redirect_url' ] : false;
1384
+			$redirect_new_window = isset( $submission_settings[ 'redirect_new_window' ] ) ? $submission_settings[ 'redirect_new_window' ] : false;
1385 1385
 
1386
-			$redirect_array['new_window'] = apply_filters( 'yikes-mailchimp-redirect-new-window', $redirect_new_window, $form_id, $page_data );
1386
+			$redirect_array[ 'new_window' ] = apply_filters( 'yikes-mailchimp-redirect-new-window', $redirect_new_window, $form_id, $page_data );
1387 1387
 
1388 1388
 			// Check if we're redirecting to a custom_url or just the redirect_page
1389 1389
 			$redirect_url = 'custom_url' !== $redirect_page_setting ? get_permalink( $redirect_page_setting ) : $custom_redirect_setting;
@@ -1408,9 +1408,9 @@  discard block
 block discarded – undo
1408 1408
 			*/
1409 1409
 			$redirect_timer = apply_filters( 'yikes-mailchimp-redirect-timer', $default_redirect_time_ms, $form_id, $page_data );
1410 1410
 
1411
-			$redirect_array['redirect_timer'] = $redirect_timer;
1411
+			$redirect_array[ 'redirect_timer' ] = $redirect_timer;
1412 1412
 
1413
-			$redirect_array['redirect'] = $redirect_url;
1413
+			$redirect_array[ 'redirect' ] = $redirect_url;
1414 1414
 		}
1415 1415
 
1416 1416
 		return $redirect_array;
Please login to merge, or discard this patch.