Completed
Push — staging ( 68fed3...485a71 )
by Evan
04:30
created
includes/api/class-yikes-inc-easy-mailchimp-api-manager.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 
97 97
 		$this->api_key = $api_key;
98 98
 		$parts         = $this->get_api_key_parts();
99
-		$this->key     = $parts['key'];
100
-		$this->dc      = $parts['dc'];
99
+		$this->key     = $parts[ 'key' ];
100
+		$this->dc      = $parts[ 'dc' ];
101 101
 	}
102 102
 
103 103
 	/**
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 		$parts = explode( '-', $this->api_key );
123 123
 
124 124
 		return array(
125
-			'key' => $parts[0],
126
-			'dc'  => isset( $parts[1] ) ? $parts[1] : '',
125
+			'key' => $parts[ 0 ],
126
+			'dc'  => isset( $parts[ 1 ] ) ? $parts[ 1 ] : '',
127 127
 		);
128 128
 	}
129 129
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @return Yikes_Inc_Easy_MailChimp_API
168 168
 	 */
169 169
 	public function get_api( $version = '' ) {
170
-		$version = $version ?: $this->get_default_api_version();
170
+		$version = $version ? : $this->get_default_api_version();
171 171
 
172 172
 		if ( ! array_key_exists( $version, $this->api ) || null === $this->api[ $version ] ) {
173 173
 			$this->api[ $version ] = new Yikes_Inc_Easy_MailChimp_API( $this->get_datacenter(), $this->get_api_key(), $version );
Please login to merge, or discard this patch.
yikes-inc-easy-mailchimp-extender.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  * 	@since 6.1.3
43 43
  */
44 44
 if ( ! defined( 'YIKES_MC_VERSION' ) ) {
45
-	define( 'YIKES_MC_VERSION' , '6.2.4' );
45
+	define( 'YIKES_MC_VERSION', '6.2.4' );
46 46
 }
47 47
 
48 48
 /**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
  * 	@since 6.0.0
52 52
  */
53 53
 if ( ! defined( 'YIKES_MC_PATH' ) ) {
54
-	define( 'YIKES_MC_PATH' , plugin_dir_path( __FILE__ ) );
54
+	define( 'YIKES_MC_PATH', plugin_dir_path( __FILE__ ) );
55 55
 }
56 56
 
57 57
 /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
  * 	@since 6.0.0
61 61
  */
62 62
 if ( ! defined( 'YIKES_MC_URL' ) ) {
63
-	define( 'YIKES_MC_URL' , plugin_dir_url( __FILE__ ) );
63
+	define( 'YIKES_MC_URL', plugin_dir_url( __FILE__ ) );
64 64
 }
65 65
 
66 66
 // Include our autoloader
Please login to merge, or discard this patch.
public/partials/ajax/class.public_ajax.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,16 +11,16 @@  discard block
 block discarded – undo
11 11
 	 */
12 12
 	public function __construct() {
13 13
 		// ajax process form submission
14
-		add_action( 'wp_ajax_nopriv_process_form_submission', array( $this , 'process_form_submission' ), 10 );
15
-		add_action( 'wp_ajax_process_form_submission', array( $this , 'process_form_submission' ), 10 );
14
+		add_action( 'wp_ajax_nopriv_process_form_submission', array( $this, 'process_form_submission' ), 10 );
15
+		add_action( 'wp_ajax_process_form_submission', array( $this, 'process_form_submission' ), 10 );
16 16
 
17 17
 		// ajax send update emails
18
-		add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 );
19
-		add_action( 'wp_ajax_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 );
18
+		add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 );
19
+		add_action( 'wp_ajax_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 );
20 20
 
21 21
 		// increase submission count for a given form on successful submit
22
-		add_action( 'wp_ajax_nopriv_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 );
23
-		add_action( 'wp_ajax_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 );
22
+		add_action( 'wp_ajax_nopriv_increase_submission_count', array( $this, 'increase_submission_count' ), 10 );
23
+		add_action( 'wp_ajax_increase_submission_count', array( $this, 'increase_submission_count' ), 10 );
24 24
 	}
25 25
 
26 26
 	/*
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * Increase the submission count for a given form.
38 38
 	 */
39 39
 	public function increase_submission_count() {
40
-		$form_id   = intval( $_POST['form_id'] );
40
+		$form_id   = intval( $_POST[ 'form_id' ] );
41 41
 		$interface = yikes_easy_mailchimp_extender_get_form_interface();
42 42
 		$form      = $interface->get_form( $form_id );
43 43
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		}
48 48
 
49 49
 		// Update the form.
50
-		$submission_count = isset( $form['submissions'] ) ? $form['submissions'] + 1 : 1;
50
+		$submission_count = isset( $form[ 'submissions' ] ) ? $form[ 'submissions' ] + 1 : 1;
51 51
 		$interface->update_form_field( $form_id, 'submissions', $submission_count );
52 52
 
53 53
 		exit();
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 		@since v6.0.4.1
59 59
 	*/
60 60
 	public function sendUpdateProfileEmail() {
61
-		$user_email    = $_POST['user_email'];
61
+		$user_email    = $_POST[ 'user_email' ];
62 62
 		$user_id       = md5( $user_email );
63
-		$list_id       = $_POST['list_id'];
63
+		$list_id       = $_POST[ 'list_id' ];
64 64
 		$full_site_url = get_bloginfo( 'url' );
65 65
 		$manager       = yikes_get_mc_api_manager();
66 66
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 				"class.public_ajax.php"
78 78
 			);
79 79
 			$is_error = true;
80
-			$errors[] = $list_details->get_error_message();
80
+			$errors[ ] = $list_details->get_error_message();
81 81
 		}
82 82
 
83 83
 		// account details api call
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
87 87
 			$error_logging->maybe_write_to_log( $account_details->get_error_code(), __( "Send Update Profile Email - Get Account Details", 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
88 88
 			$is_error = true;
89
-			$errors[] = $account_details->get_error_message();
89
+			$errors[ ] = $account_details->get_error_message();
90 90
 		}
91 91
 
92 92
 		// subscriber details api call
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
96 96
 			$error_logging->maybe_write_to_log( $subscriber_account_details->get_error_code(), __( "Send Update Profile Email - Get Member Info.", 'yikes-inc-easy-mailchimp-extender' ), "class.public_ajax.php" );
97 97
 			$is_error = true;
98
-			$errors[] = $subscriber_account_details->get_error_message();
98
+			$errors[ ] = $subscriber_account_details->get_error_message();
99 99
 		}
100 100
 
101 101
 		// check for errors in any of the calls
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
 		}
113 113
 
114 114
 		// send the email!
115
-		$subscriber_id = $subscriber_account_details['unique_email_id'];
116
-		$update_link_href = str_replace( '/subscribe', '/profile', $list_details['subscribe_url_long'] );
115
+		$subscriber_id = $subscriber_account_details[ 'unique_email_id' ];
116
+		$update_link_href = str_replace( '/subscribe', '/profile', $list_details[ 'subscribe_url_long' ] );
117 117
 		$update_link_href = add_query_arg( 'e', $subscriber_id, $update_link_href );
118 118
 		$subject          = 'MailChimp Profile Update';
119
-		$headers          = 'From: ' . $list_details['campaign_defaults']['from_name'] . ' <' . $list_details['campaign_defaults']['from_email'] . '>' . "\r\n";
119
+		$headers          = 'From: ' . $list_details[ 'campaign_defaults' ][ 'from_name' ] . ' <' . $list_details[ 'campaign_defaults' ][ 'from_email' ] . '>' . "\r\n";
120 120
 		$headers .= 'Content-type: text/html';
121 121
 		$email_content = '<p>Greetings,</p> <p>A request has been made to update your MailChimp account profile information. To do so please use the following link: <a href="' . $update_link_href . '" title="Update MailChimp Profile">Update MailChimp Profile Info.</a>';
122 122
 		$email_content .= "<p>If you did not request this update, please disregard this email.</p>";
Please login to merge, or discard this patch.
public/partials/shortcodes/process/process_form_submission.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -192,11 +192,11 @@
 block discarded – undo
192 192
 	$merge_variables = apply_filters( 'yikes-mailchimp-before-submission-' . $form_id, $merge_variables );
193 193
 
194 194
 	/**
195
-	* Action hooks fired before API request
196
-	* @since 6.0.5.5
197
-	* @param $merge_variables 	array 	Array of merge variable to use
198
-	* @param $form_id						integer	The form ID to target (eg: 1, 2 etc.)
199
-	*/
195
+	 * Action hooks fired before API request
196
+	 * @since 6.0.5.5
197
+	 * @param $merge_variables 	array 	Array of merge variable to use
198
+	 * @param $form_id						integer	The form ID to target (eg: 1, 2 etc.)
199
+	 */
200 200
 	do_action( 'yikes-mailchimp-before-submission', $merge_variables );
201 201
 	do_action( 'yikes-mailchimp-before-submission-' . $form_id, $merge_variables );
202 202
 
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 global $form_submitted, $process_submission_response;
9 9
 
10 10
 // confirm we have a form id to work with
11
-$form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? $_POST['yikes-mailchimp-submitted-form'] : false;
11
+$form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? $_POST[ 'yikes-mailchimp-submitted-form' ] : false;
12 12
 
13 13
 if ( ! $form_id ) {
14 14
 
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
 
17 17
 }
18 18
 
19
-$list_id = $_POST['yikes-mailchimp-associated-list-id'];
19
+$list_id = $_POST[ 'yikes-mailchimp-associated-list-id' ];
20 20
 
21
-$form_settings = Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $_POST['yikes-mailchimp-submitted-form'] );
21
+$form_settings = Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $_POST[ 'yikes-mailchimp-submitted-form' ] );
22 22
 
23
-$replace_interests    = isset( $form_settings['submission_settings']['replace_interests'] ) ? (bool) $form_settings['submission_settings']['replace_interests'] : true;
23
+$replace_interests = isset( $form_settings[ 'submission_settings' ][ 'replace_interests' ] ) ? (bool) $form_settings[ 'submission_settings' ][ 'replace_interests' ] : true;
24 24
 
25 25
 $groups = array();
26 26
 
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 
30 30
 	$list_handler = yikes_get_mc_api_manager()->get_list_handler();
31 31
 
32
-	$interest_groupings = $list_handler->get_interest_categories( $_POST['yikes-mailchimp-associated-list-id'] );
32
+	$interest_groupings = $list_handler->get_interest_categories( $_POST[ 'yikes-mailchimp-associated-list-id' ] );
33 33
 
34 34
 	foreach ( $interest_groupings as $group_id => $group_data ) {
35 35
 
36
-		foreach ( $group_data['items'] as $item_id => $item_data ) {
36
+		foreach ( $group_data[ 'items' ] as $item_id => $item_data ) {
37 37
 
38 38
 			$groups[ $item_id ] = false;
39 39
 
@@ -42,39 +42,39 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 // Process our form submissions (non ajax forms)
45
-if ( ! isset( $_POST['yikes_easy_mc_new_subscriber'] ) || ! wp_verify_nonce( $_POST['yikes_easy_mc_new_subscriber'], 'yikes_easy_mc_form_submit' ) ) {
45
+if ( ! isset( $_POST[ 'yikes_easy_mc_new_subscriber' ] ) || ! wp_verify_nonce( $_POST[ 'yikes_easy_mc_new_subscriber' ], 'yikes_easy_mc_form_submit' ) ) {
46 46
 
47
-	$process_submission_response = '<p><small class="form_submission_error">' . __( "Error : Sorry, the nonce security check didn't pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt." , 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
47
+	$process_submission_response = '<p><small class="form_submission_error">' . __( "Error : Sorry, the nonce security check didn't pass. Please reload the page and try again. You may want to try clearing your browser cache as a last attempt.", 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
48 48
 
49 49
 	return;
50 50
 
51 51
 } else {
52 52
 
53 53
 	/* Check for Honeypot filled */
54
-	$honey_pot_filled = ( isset( $_POST['yikes-mailchimp-honeypot'] ) && '' !== $_POST['yikes-mailchimp-honeypot'] ) ? true : false;
54
+	$honey_pot_filled = ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && '' !== $_POST[ 'yikes-mailchimp-honeypot' ] ) ? true : false;
55 55
 
56 56
 	// if it was filled out, return an error...
57 57
 	if ( $honey_pot_filled ) {
58 58
 
59
-		$process_submission_response = '<p><small class="form_submission_error">' . __( 'Error: It looks like the honeypot was filled out and the form was not properly be submitted.' , 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
59
+		$process_submission_response = '<p><small class="form_submission_error">' . __( 'Error: It looks like the honeypot was filled out and the form was not properly be submitted.', 'yikes-inc-easy-mailchimp-extender' ) . '</small></p>';
60 60
 
61 61
 		return;
62 62
 
63 63
 	}
64 64
 
65 65
 	// Check reCAPTCHA Response
66
-	if ( isset( $_POST['g-recaptcha-response'] ) ) {
66
+	if ( isset( $_POST[ 'g-recaptcha-response' ] ) ) {
67 67
 
68
-		$url           = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key' , '' ) . '&response=' . $_POST['g-recaptcha-response'] . '&remoteip=' . $_SERVER['REMOTE_ADDR'] );
68
+		$url           = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $_POST[ 'g-recaptcha-response' ] . '&remoteip=' . $_SERVER[ 'REMOTE_ADDR' ] );
69 69
 		$response      = wp_remote_get( $url );
70
-		$response_body = json_decode( $response['body'] , true );
70
+		$response_body = json_decode( $response[ 'body' ], true );
71 71
 
72 72
 		// if we've hit an error, lets return the error!
73
-		if ( 1 !== $response_body['success'] ) {
73
+		if ( 1 !== $response_body[ 'success' ] ) {
74 74
 
75 75
 			$recaptcha_error = array(); // empty array to store error messages
76 76
 
77
-			foreach ( $response_body['error-codes'] as $error_code ) {
77
+			foreach ( $response_body[ 'error-codes' ] as $error_code ) {
78 78
 
79 79
 				if ( 'missing-input-response' === $error_code ) {
80 80
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 
83 83
 				}
84 84
 
85
-				$recaptcha_error[] = $error_code;
85
+				$recaptcha_error[ ] = $error_code;
86 86
 
87 87
 			}
88 88
 
89
-			$process_submission_response .= "<p class='yikes-easy-mc-error-message'>" . apply_filters( 'yikes-mailchimp-recaptcha-required-error', __( 'Error' , 'yikes-inc-easy-mailchimp-extender' ) . ': ' . implode( ' ' , $recaptcha_error ) ) . '</p>';
89
+			$process_submission_response .= "<p class='yikes-easy-mc-error-message'>" . apply_filters( 'yikes-mailchimp-recaptcha-required-error', __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . implode( ' ', $recaptcha_error ) ) . '</p>';
90 90
 
91 91
 			return;
92 92
 
@@ -98,18 +98,18 @@  discard block
 block discarded – undo
98 98
 	*	No HTML5 validation, and don't want to use jQuery for non-ajax forms
99 99
 	*/
100 100
 	$missing_required_checkbox_interest_groups = array();
101
-	foreach ( $form_settings['fields'] as $merge_tag => $field_data ) {
101
+	foreach ( $form_settings[ 'fields' ] as $merge_tag => $field_data ) {
102 102
 
103
-		if ( isset( $field_data['group_id'] ) ) {
103
+		if ( isset( $field_data[ 'group_id' ] ) ) {
104 104
 
105 105
 			// check if the checkbox group was set to required, if so return an error
106
-			if ( isset( $field_data['require'] ) && 1 === $field_data['require'] ) {
106
+			if ( isset( $field_data[ 'require' ] ) && 1 === $field_data[ 'require' ] ) {
107 107
 
108
-				if ( 'checkboxes' === $field_data['type'] ) {
108
+				if ( 'checkboxes' === $field_data[ 'type' ] ) {
109 109
 
110 110
 					if ( ! isset( $_POST[ $merge_tag ] ) ) {
111 111
 
112
-						$missing_required_checkbox_interest_groups[] = $merge_tag;
112
+						$missing_required_checkbox_interest_groups[ ] = $merge_tag;
113 113
 
114 114
 					}
115 115
 				}
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 
136 136
 			// check if the current iteration has a 'date_format' key set
137 137
 			// (aka - date/birthday fields)
138
-			if ( isset( $form_settings['fields'][ $merge_tag ]['date_format'] ) ) {
138
+			if ( isset( $form_settings[ 'fields' ][ $merge_tag ][ 'date_format' ] ) ) {
139 139
 
140 140
 				// check if EU date format
141
-				if ( 'DD/MM/YYYY' === $form_settings['fields'][ $merge_tag ]['date_format'] || 'DD/MM' === $form_settings['fields'][ $merge_tag ]['date_format'] ) {
141
+				if ( 'DD/MM/YYYY' === $form_settings[ 'fields' ][ $merge_tag ][ 'date_format' ] || 'DD/MM' === $form_settings[ 'fields' ][ $merge_tag ][ 'date_format' ] ) {
142 142
 
143 143
 					// convert '/' to '.' and to UNIX timestamp
144 144
 					$value = ( '' != $value ) ? str_replace( '/', '.', $value ) : '';
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	}
179 179
 
180 180
 	// store the opt-in time
181
-	$merge_variables['optin_time'] = current_time( 'Y-m-d H:i:s', 1 );
181
+	$merge_variables[ 'optin_time' ] = current_time( 'Y-m-d H:i:s', 1 );
182 182
 
183 183
 	/*
184 184
 	*	yikes-mailchimp-before-submission
@@ -204,22 +204,22 @@  discard block
 block discarded – undo
204 204
 	*	Allow users to check for submit value
205 205
 	*	and pass back an error to the user
206 206
 	*/
207
-	if ( isset( $merge_variables['error'] ) ) {
207
+	if ( isset( $merge_variables[ 'error' ] ) ) {
208 208
 
209
-		$process_submission_response = apply_filters( 'yikes-mailchimp-frontend-content' , $merge_variables['message'] );
209
+		$process_submission_response = apply_filters( 'yikes-mailchimp-frontend-content', $merge_variables[ 'message' ] );
210 210
 
211 211
 		return;
212 212
 
213 213
 	}
214 214
 
215 215
 	$member_data = array(
216
-		'email_address' => sanitize_email( $_POST['EMAIL'] ),
216
+		'email_address' => sanitize_email( $_POST[ 'EMAIL' ] ),
217 217
 		'merge_fields'  => $merge_variables,
218 218
 		'interests'     => $groups,
219 219
 		'status'        => 'subscribed',
220 220
 	);
221 221
 
222
-	$subscribe_response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, md5( strtolower( sanitize_email( $_POST['EMAIL'] ) ) ), $member_data );
222
+	$subscribe_response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, md5( strtolower( sanitize_email( $_POST[ 'EMAIL' ] ) ) ), $member_data );
223 223
 
224 224
 	if ( is_wp_error( $subscribe_response ) ) {
225 225
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
229 229
 
230
-		$error_logging->maybe_write_to_log( $error_message, __( 'New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ), 'process_form_submission.php' );
230
+		$error_logging->maybe_write_to_log( $error_message, __( 'New Subscriber', 'yikes-inc-easy-mailchimp-extender' ), 'process_form_submission.php' );
231 231
 
232 232
 		$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $error_message . '</p>';
233 233
 
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
 	$form_submitted = 1;
240 240
 
241 241
 	// Display the success message
242
-	if ( ! empty( $form_settings['error_messages']['success'] ) ) {
242
+	if ( ! empty( $form_settings[ 'error_messages' ][ 'success' ] ) ) {
243 243
 
244
-		$process_submission_response = '<p class="yikes-easy-mc-success-message">' . apply_filters( 'yikes-mailchimp-success-response', stripslashes( esc_html( $form_settings['error_messages']['success'] ) ), $form_id, $merge_variables ) . '</p>';
244
+		$process_submission_response = '<p class="yikes-easy-mc-success-message">' . apply_filters( 'yikes-mailchimp-success-response', stripslashes( esc_html( $form_settings[ 'error_messages' ][ 'success' ] ) ), $form_id, $merge_variables ) . '</p>';
245 245
 
246 246
 	} else {
247 247
 
248
-		$default_success_response    = ( 1 === $form_settings['optin_settings']['optin'] ) ? __( 'Thank you for subscribing! Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' ) : __( 'Thank you for subscribing!' , 'yikes-inc-easy-mailchimp-extender' );
248
+		$default_success_response    = ( 1 === $form_settings[ 'optin_settings' ][ 'optin' ] ) ? __( 'Thank you for subscribing! Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' ) : __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' );
249 249
 		$process_submission_response = '<p class="yikes-easy-mc-success-message">' . apply_filters( 'yikes-mailchimp-success-response', $default_success_response, $form_id, $merge_variables ) . '</p>';
250 250
 
251 251
 	}
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 	* 	optional @form - the ID of the form to filter
259 259
 	*	@since 6.0.0
260 260
 	*/
261
-	do_action( 'yikes-mailchimp-after-submission' , $merge_variables );
262
-	do_action( 'yikes-mailchimp-after-submission-' . $form_id , $merge_variables );
261
+	do_action( 'yikes-mailchimp-after-submission', $merge_variables );
262
+	do_action( 'yikes-mailchimp-after-submission-' . $form_id, $merge_variables );
263 263
 
264 264
 	/*
265 265
 	*	Non-AJAX redirects now handled in class-yikes-inc-easy-mailchimp-extender-public.php
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 	*	@$notifications - the notification array
278 278
 	*	@since 6.0.0
279 279
 	*/
280
-	do_action( 'yikes-mailchimp-form-submission' , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] );
281
-	do_action( 'yikes-mailchimp-form-submission-' . $form_id , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] );
280
+	do_action( 'yikes-mailchimp-form-submission', $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] );
281
+	do_action( 'yikes-mailchimp-form-submission-' . $form_id, $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] );
282 282
 
283 283
 	/*
284 284
 		*	yikes-mailchimp-after-submission
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 		* 	optional @form - the ID of the form to filter
289 289
 		*	@since 6.0.0
290 290
 		*/
291
-		do_action( 'yikes-mailchimp-after-submission' , $merge_variables );
292
-		do_action( 'yikes-mailchimp-after-submission-' . $form_id , $merge_variables );
291
+		do_action( 'yikes-mailchimp-after-submission', $merge_variables );
292
+		do_action( 'yikes-mailchimp-after-submission-' . $form_id, $merge_variables );
293 293
 		/*
294 294
 		*	Non-AJAX redirects now handled in class-yikes-inc-easy-mailchimp-extender-public.php
295 295
 		*	function: redirect_user_non_ajax_forms
@@ -305,15 +305,15 @@  discard block
 block discarded – undo
305 305
 		*	@$notifications - the notification array
306 306
 		*	@since 6.0.0
307 307
 		*/
308
-		do_action( 'yikes-mailchimp-form-submission' , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] );
309
-		do_action( 'yikes-mailchimp-form-submission-' . $form_id , $_POST['EMAIL'] , $merge_variables , $form_id , $form_settings['notifications'] );
308
+		do_action( 'yikes-mailchimp-form-submission', $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] );
309
+		do_action( 'yikes-mailchimp-form-submission-' . $form_id, $_POST[ 'EMAIL' ], $merge_variables, $form_id, $form_settings[ 'notifications' ] );
310 310
 		/*
311 311
 		*	Increase the submission count for this form
312 312
 		*	on a successful submission
313 313
 		*	@since 6.0.0
314 314
 		*/
315 315
 		$interface   = yikes_easy_mailchimp_extender_get_form_interface();
316
-		$submissions = $form_settings['submissions'] + 1;
316
+		$submissions = $form_settings[ 'submissions' ] + 1;
317 317
 		$interface->update_form_field( $form_id, 'submissions', $submissions );
318 318
 
319 319
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -151,7 +151,8 @@  discard block
 block discarded – undo
151 151
 				}
152 152
 			}
153 153
 
154
-			if ( strpos( $merge_tag, 'group-' ) !== false ) { // this is is an interest group!
154
+			if ( strpos( $merge_tag, 'group-' ) !== false ) {
155
+// this is is an interest group!
155 156
 
156 157
 				$tag = str_replace( 'group-', '', $merge_tag );
157 158
 
@@ -169,7 +170,8 @@  discard block
 block discarded – undo
169 170
 
170 171
 				$groups[ $value ] = true;
171 172
 
172
-			} else { // or else it's just a standard merge variable
173
+			} else {
174
+// or else it's just a standard merge variable
173 175
 
174 176
 				$merge_variables[ $merge_tag ] = $value;
175 177
 
Please login to merge, or discard this patch.
public/partials/shortcodes/process/process_form_submission_ajax.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@  discard block
 block discarded – undo
5 5
 */
6 6
 
7 7
 // parse our form data
8
-parse_str( $_POST['form_data'], $data );
8
+parse_str( $_POST[ 'form_data' ], $data );
9 9
 
10 10
 // store the form ID to use in our hooks and filters
11
-$form = $_POST['form_id'];
11
+$form = $_POST[ 'form_id' ];
12 12
 
13 13
 $interface = yikes_easy_mailchimp_extender_get_form_interface();
14 14
 $form_data = $interface->get_form( $form );
@@ -16,29 +16,29 @@  discard block
 block discarded – undo
16 16
 if ( $form_data ) {
17 17
 
18 18
 	// List ID
19
-	$list_id = $form_data['list_id'];
19
+	$list_id = $form_data[ 'list_id' ];
20 20
 
21 21
 	// decode our submission settings
22
-	$submission_settings = $form_data['submission_settings'];
22
+	$submission_settings = $form_data[ 'submission_settings' ];
23 23
 
24 24
 	// decode our optin settings
25
-	$optin_settings = $form_data['optin_settings'];
25
+	$optin_settings = $form_data[ 'optin_settings' ];
26 26
 
27 27
 	// decode our fields
28
-	$form_fields = $form_data['fields'];
28
+	$form_fields = $form_data[ 'fields' ];
29 29
 
30 30
 	/**
31 31
 	 * Decode our error messages
32 32
 	 * Workaround for international characters (cyrillic etc)
33 33
 	 * See: https://wordpress.org/support/topic/custom-messages-do-not-support-cyrillic-characters?replies=11#post-7629620
34 34
 	 */
35
-	$error_messages = $form_data['error_messages'];
35
+	$error_messages = $form_data[ 'error_messages' ];
36 36
 
37 37
 	/** Submit Process **/
38
-	$notifications = isset( $form_data['custom_notifications'] ) ? $form_data['custom_notifications'] : array();
38
+	$notifications = isset( $form_data[ 'custom_notifications' ] ) ? $form_data[ 'custom_notifications' ] : array();
39 39
 
40 40
 	/* Page Data */
41
-	$page_data = $_POST['page_data'];
41
+	$page_data = $_POST[ 'page_data' ];
42 42
 
43 43
 }
44 44
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 $error = 0;
50 50
 
51 51
 /* Check for Honeypot filled */
52
-$honey_pot_filled = ( isset( $data['yikes-mailchimp-honeypot'] ) && '' !== $data['yikes-mailchimp-honeypot'] ) ? true : false;
52
+$honey_pot_filled = ( isset( $data[ 'yikes-mailchimp-honeypot' ] ) && '' !== $data[ 'yikes-mailchimp-honeypot' ] ) ? true : false;
53 53
 
54 54
 // if it was filled out, return an error...
55 55
 if ( $honey_pot_filled ) {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	wp_send_json_error( array(
58 58
 		'hide' => '0',
59 59
 		'error' => 1,
60
-		'response' => __( 'Error: It looks like the honeypot was filled out and the form was not properly submitted.' , 'yikes-inc-easy-mailchimp-extender' ),
60
+		'response' => __( 'Error: It looks like the honeypot was filled out and the form was not properly submitted.', 'yikes-inc-easy-mailchimp-extender' ),
61 61
 	) );
62 62
 
63 63
 	return;
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
 }
66 66
 
67 67
 // Check reCAPTCHA Response was submitted with the form data
68
-if ( isset( $data['g-recaptcha-response'] ) ) {
68
+if ( isset( $data[ 'g-recaptcha-response' ] ) ) {
69 69
 
70
-	$url           = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key' , '' ) . '&response=' . $data['g-recaptcha-response'] . '&remoteip=' . $_SERVER['REMOTE_ADDR'] );
70
+	$url           = esc_url_raw( 'https://www.google.com/recaptcha/api/siteverify?secret=' . get_option( 'yikes-mc-recaptcha-secret-key', '' ) . '&response=' . $data[ 'g-recaptcha-response' ] . '&remoteip=' . $_SERVER[ 'REMOTE_ADDR' ] );
71 71
 	$response      = wp_remote_get( $url );
72
-	$response_body = json_decode( $response['body'] , true );
72
+	$response_body = json_decode( $response[ 'body' ], true );
73 73
 
74 74
 	// if we've hit an error, lets return the error!
75
-	if ( 1 !== $response_body['success'] ) {
75
+	if ( 1 !== $response_body[ 'success' ] ) {
76 76
 
77 77
 		$error_messages = array(); // empty array to store error messages
78 78
 
79
-		if ( isset( $response_body['error-codes'] ) ) {
79
+		if ( isset( $response_body[ 'error-codes' ] ) ) {
80 80
 
81
-			foreach ( $response_body['error-codes'] as $error_code ) {
81
+			foreach ( $response_body[ 'error-codes' ] as $error_code ) {
82 82
 
83 83
 				if ( 'missing-input-response' === $error_code ) {
84 84
 
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 
87 87
 				}
88 88
 
89
-				$error_messages[] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code;
89
+				$error_messages[ ] = __( 'Error', 'yikes-inc-easy-mailchimp-extender' ) . ': ' . $error_code;
90 90
 
91 91
 			}
92 92
 		} else {
93 93
 
94
-			$error_messages[] = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' );
94
+			$error_messages[ ] = __( 'Please refresh the page and try again.', 'yikes-inc-easy-mailchimp-extender' );
95 95
 
96 96
 		}
97 97
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	}
109 109
 }
110 110
 
111
-$replace_interests = isset( $submission_settings['replace_interests'] ) ? (bool) $submission_settings['replace_interests'] : true;
111
+$replace_interests = isset( $submission_settings[ 'replace_interests' ] ) ? (bool) $submission_settings[ 'replace_interests' ] : true;
112 112
 
113 113
 $groups = array();
114 114
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 	foreach ( $interest_groupings as $group_id => $group_data ) {
123 123
 
124
-		foreach ( $group_data['items'] as $item_id => $item_data ) {
124
+		foreach ( $group_data[ 'items' ] as $item_id => $item_data ) {
125 125
 
126 126
 			$groups[ $item_id ] = false;
127 127
 
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
 
137 137
 		// check if the current iteration has a 'date_format' key set
138 138
 		// (aka - date/birthday fields)
139
-		if ( isset( $form_fields[ $merge_tag ]['date_format'] ) ) {
139
+		if ( isset( $form_fields[ $merge_tag ][ 'date_format' ] ) ) {
140 140
 
141 141
 			// check if EU date format
142
-			if ( 'DD/MM/YYYY' === $form_fields[ $merge_tag ]['date_format'] || 'DD/MM' === $form_fields[ $merge_tag ]['date_format'] ) {
142
+			if ( 'DD/MM/YYYY' === $form_fields[ $merge_tag ][ 'date_format' ] || 'DD/MM' === $form_fields[ $merge_tag ][ 'date_format' ] ) {
143 143
 
144 144
 				// convert '/' to '.' and to UNIX timestamp
145 145
 				$value = ( '' != $value ) ? str_replace( '/', '.', $value ) : '';
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	}
180 180
 }
181 181
 // store the opt-in time
182
-$merge_variables['timestamp_opt'] = current_time( 'Y-m-d H:i:s', 1 );
182
+$merge_variables[ 'timestamp_opt' ] = current_time( 'Y-m-d H:i:s', 1 );
183 183
 
184 184
 /*
185 185
 *	yikes-mailchimp-before-submission
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
 *	Allow users to check for submit value
204 204
 *	and pass back an error to the user
205 205
 */
206
-if ( isset( $merge_variables['error'] ) ) {
206
+if ( isset( $merge_variables[ 'error' ] ) ) {
207 207
 
208 208
 	// send our error response back
209 209
 	wp_send_json_error(
210 210
 		array(
211 211
 			'hide'     => '0',
212
-			'error'    => $merge_variables['error'],
213
-			'response' => $merge_variables['message'],
212
+			'error'    => $merge_variables[ 'error' ],
213
+			'response' => $merge_variables[ 'message' ],
214 214
 		)
215 215
 	);
216 216
 
@@ -219,13 +219,13 @@  discard block
 block discarded – undo
219 219
 }
220 220
 
221 221
 $member_data = array(
222
-	'email_address' => sanitize_email( $data['EMAIL'] ),
222
+	'email_address' => sanitize_email( $data[ 'EMAIL' ] ),
223 223
 	'merge_fields'  => $merge_variables,
224 224
 	'interests'     => $groups,
225 225
 	'status'        => 'subscribed',
226 226
 );
227 227
 
228
-$subscribe_response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, md5( strtolower( sanitize_email( $data['EMAIL'] ) ) ), $member_data );
228
+$subscribe_response = yikes_get_mc_api_manager()->get_list_handler()->member_subscribe( $list_id, md5( strtolower( sanitize_email( $data[ 'EMAIL' ] ) ) ), $member_data );
229 229
 
230 230
 if ( is_wp_error( $subscribe_response ) ) {
231 231
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
235 235
 
236
-	$error_logging->maybe_write_to_log( $error_message, __( 'New Subscriber' , 'yikes-inc-easy-mailchimp-extender' ), 'process_form_submission.php' );
236
+	$error_logging->maybe_write_to_log( $error_message, __( 'New Subscriber', 'yikes-inc-easy-mailchimp-extender' ), 'process_form_submission.php' );
237 237
 
238 238
 	$process_submission_response = '<p class="yikes-easy-mc-error-message">' . $error_message . '</p>';
239 239
 
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
 /*
256 256
 *	Successful form submission redirect
257 257
 */
258
-if ( '1' === $submission_settings['redirect_on_submission'] ) {
258
+if ( '1' === $submission_settings[ 'redirect_on_submission' ] ) {
259 259
 
260 260
 	$redirection = '1';
261 261
 
262
-	$redirect_url = ( 'custom_url' != $submission_settings['redirect_page'] ) ? get_permalink( $submission_settings['redirect_page'] ) : $submission_settings['custom_redirect_url'];
262
+	$redirect_url = ( 'custom_url' != $submission_settings[ 'redirect_page' ] ) ? get_permalink( $submission_settings[ 'redirect_page' ] ) : $submission_settings[ 'custom_redirect_url' ];
263 263
 
264 264
 	$redirect = '<script type="text/javascript">setTimeout(function() { window.location="' . apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_url ), $form, $page_data ) . '"; }, ' . apply_filters( 'yikes-mailchimp-redirect-timer', 1500 ) . ');</script>';
265 265
 
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
 do_action( 'yikes-mailchimp-after-submission-' . $form, $merge_variables );
278 278
 
279 279
 // send our notifications if setup (must go before wp_send_json())
280
-do_action( 'yikes-mailchimp-form-submission' , sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications );
281
-do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data['EMAIL'] ), $merge_variables , $form , $notifications );
280
+do_action( 'yikes-mailchimp-form-submission', sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications );
281
+do_action( 'yikes-mailchimp-form-submission-' . $form, sanitize_email( $data[ 'EMAIL' ] ), $merge_variables, $form, $notifications );
282 282
 
283
-$default_success_response = ( 1 === $optin_settings['optin'] ) ? __( 'Thank you for subscribing! Check your email for the confirmation message.' , 'yikes-inc-easy-mailchimp-extender' ) : __( 'Thank you for subscribing!' , 'yikes-inc-easy-mailchimp-extender' );
283
+$default_success_response = ( 1 === $optin_settings[ 'optin' ] ) ? __( 'Thank you for subscribing! Check your email for the confirmation message.', 'yikes-inc-easy-mailchimp-extender' ) : __( 'Thank you for subscribing!', 'yikes-inc-easy-mailchimp-extender' );
284 284
 
285 285
 wp_send_json_success(
286 286
 	array(
287
-		'hide' => $submission_settings['hide_form_post_signup'],
287
+		'hide' => $submission_settings[ 'hide_form_post_signup' ],
288 288
 		'error' => $error,
289
-		'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages['success'] ) ? $error_messages['success'] : $default_success_response ), $form, $merge_variables ),
289
+		'response' => apply_filters( 'yikes-mailchimp-success-response', ( ! empty( $error_messages[ 'success' ] ) ? $error_messages[ 'success' ] : $default_success_response ), $form, $merge_variables ),
290 290
 		'redirection' => isset( $redirection ) ? '1' : '0',
291 291
 		'redirect' => isset( $redirect ) ? $redirect : '',
292 292
 	)
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -153,7 +153,8 @@  discard block
 block discarded – undo
153 153
 
154 154
 		}
155 155
 
156
-		if ( strpos( $merge_tag, 'group-' ) !== false ) { // this is is an interest group!
156
+		if ( strpos( $merge_tag, 'group-' ) !== false ) {
157
+// this is is an interest group!
157 158
 
158 159
 			$tag = str_replace( 'group-', '', $merge_tag );
159 160
 
@@ -171,7 +172,8 @@  discard block
 block discarded – undo
171 172
 
172 173
 			$groups[ $value ] = true;
173 174
 
174
-		} else { // or else it's just a standard merge variable
175
+		} else {
176
+// or else it's just a standard merge variable
175 177
 
176 178
 			$merge_variables[ $merge_tag ] = $value;
177 179
 
Please login to merge, or discard this patch.
public/partials/shortcodes/yikes-mailchimp-subscriber-count.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 		return '';
27 27
 	}
28 28
 
29
-	$form    = ( ! empty( $attributes['form'] ) ) ? str_replace( '&quot;', '', $attributes['form'] ) : false;
30
-	$list_id = ( ! empty( $attributes['list'] ) ) ? $attributes['list'] : false;
29
+	$form    = ( ! empty( $attributes[ 'form' ] ) ) ? str_replace( '&quot;', '', $attributes[ 'form' ] ) : false;
30
+	$list_id = ( ! empty( $attributes[ 'list' ] ) ) ? $attributes[ 'list' ] : false;
31 31
 
32 32
 	/* If no list ID was passed into the shortcode - bail */
33 33
 	if ( ! $list_id && ! $form ) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			return '';
53 53
 		}
54 54
 
55
-		$list_id = sanitize_key( $form_data['list_id'] ); // associated list id (users who fill out the form will be subscribed to this list)
55
+		$list_id = sanitize_key( $form_data[ 'list_id' ] ); // associated list id (users who fill out the form will be subscribed to this list)
56 56
 	}
57 57
 
58 58
 	// object buffer
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	}
72 72
 
73 73
 	/* type cast the returned value as an integer */
74
-	echo (int) apply_filters( 'yikes-mailchimp-subscriber-count-value', $list_data['stats']['member_count'] );
74
+	echo (int) apply_filters( 'yikes-mailchimp-subscriber-count-value', $list_data[ 'stats' ][ 'member_count' ] );
75 75
 
76 76
 	return ob_get_clean();
77 77
 
Please login to merge, or discard this patch.