Completed
Push — staging ( 78e662...0f9e2f )
by
unknown
05:16
created
includes/third-party-integrations/third-party-init.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 		// required..*
18 18
 		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
19 19
 		/* Visual Composer */
20
-		if( is_plugin_active( 'js_composer/js_composer.php' ) ) {
20
+		if ( is_plugin_active( 'js_composer/js_composer.php' ) ) {
21 21
 			new YIKES_Mailchimp_Visual_Composer_Extension();
22 22
 		}
23 23
 	}
Please login to merge, or discard this patch.
public/partials/ajax/class.public_ajax.php 1 patch
Spacing   +34 added lines, -34 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,11 +58,11 @@  discard block
 block discarded – undo
58 58
 		@since v6.0.4.1
59 59
 	*/
60 60
 	public function sendUpdateProfileEmail() {
61
-		$user_email    = filter_var( $_POST['user_email'], FILTER_SANITIZE_STRING );
61
+		$user_email    = filter_var( $_POST[ 'user_email' ], FILTER_SANITIZE_STRING );
62 62
 		$user_id       = md5( $user_email );
63
-		$list_id       = filter_var( $_POST['list_id'], FILTER_SANITIZE_STRING );
64
-		$form_id       = filter_var( $_POST['form_id'], FILTER_SANITIZE_NUMBER_INT );
65
-		$page_id       = filter_var( $_POST['page_id'], FILTER_SANITIZE_NUMBER_INT );
63
+		$list_id       = filter_var( $_POST[ 'list_id' ], FILTER_SANITIZE_STRING );
64
+		$form_id       = filter_var( $_POST[ 'form_id' ], FILTER_SANITIZE_NUMBER_INT );
65
+		$page_id       = filter_var( $_POST[ 'page_id' ], FILTER_SANITIZE_NUMBER_INT );
66 66
 		$full_site_url = get_bloginfo( 'url' );
67 67
 		$manager       = yikes_get_mc_api_manager();
68 68
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 				'class.public_ajax.php'
80 80
 			);
81 81
 			$is_error = true;
82
-			$errors[] = $list_details->get_error_message();
82
+			$errors[ ] = $list_details->get_error_message();
83 83
 		}
84 84
 
85 85
 		// Subscriber details API call.
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
89 89
 			$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' );
90 90
 			$is_error = true;
91
-			$errors[] = $subscriber_account_details->get_error_message();
91
+			$errors[ ] = $subscriber_account_details->get_error_message();
92 92
 		}
93 93
 
94 94
 		// Form details API call.
@@ -96,22 +96,22 @@  discard block
 block discarded – undo
96 96
 		if ( ! empty( $interface ) && method_exists( $interface, 'get_form' ) && ! empty( $form_id ) ) {
97 97
 			$form_data = $interface->get_form( $form_id );
98 98
 			if ( ! empty( $form_data ) ) {
99
-				if ( isset( $form_data['error_messages'] ) ) {
99
+				if ( isset( $form_data[ 'error_messages' ] ) ) {
100 100
 
101
-					if ( isset( $form_data['error_messages']['email-body'] ) && ! empty( $form_data['error_messages']['email-body'] ) ) {
102
-						$email_body = apply_filters( 'the_content', $form_data['error_messages']['email-body'] );
101
+					if ( isset( $form_data[ 'error_messages' ][ 'email-body' ] ) && ! empty( $form_data[ 'error_messages' ][ 'email-body' ] ) ) {
102
+						$email_body = apply_filters( 'the_content', $form_data[ 'error_messages' ][ 'email-body' ] );
103 103
 					}
104 104
 
105
-					if ( isset( $form_data['error_messages']['email-subject'] ) && ! empty( $form_data['error_messages']['email-subject'] ) ) {
106
-						$email_subject = $form_data['error_messages']['email-subject'];
105
+					if ( isset( $form_data[ 'error_messages' ][ 'email-subject' ] ) && ! empty( $form_data[ 'error_messages' ][ 'email-subject' ] ) ) {
106
+						$email_subject = $form_data[ 'error_messages' ][ 'email-subject' ];
107 107
 					}
108 108
 
109
-					if ( isset( $form_data['error_messages']['update-email-success'] ) && ! empty( $form_data['error_messages']['update-email-success'] ) ) {
110
-						$update_email_success_message = $form_data['error_messages']['update-email-success'];
109
+					if ( isset( $form_data[ 'error_messages' ][ 'update-email-success' ] ) && ! empty( $form_data[ 'error_messages' ][ 'update-email-success' ] ) ) {
110
+						$update_email_success_message = $form_data[ 'error_messages' ][ 'update-email-success' ];
111 111
 					}
112 112
 
113
-					if ( isset( $form_data['error_messages']['update-email-failure'] ) && ! empty( $form_data['error_messages']['update-email-failure'] ) ) {
114
-						$update_email_failed_message = $form_data['error_messages']['update-email-failure'];
113
+					if ( isset( $form_data[ 'error_messages' ][ 'update-email-failure' ] ) && ! empty( $form_data[ 'error_messages' ][ 'update-email-failure' ] ) ) {
114
+						$update_email_failed_message = $form_data[ 'error_messages' ][ 'update-email-failure' ];
115 115
 					}
116 116
 				}
117 117
 			}
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 		}
133 133
 
134 134
 		// Construct the headers & email message content.
135
-		$subscriber_id    = $subscriber_account_details['unique_email_id'];
136
-		$update_link_href = str_replace( '/subscribe', '/profile', $list_details['subscribe_url_long'] );
135
+		$subscriber_id    = $subscriber_account_details[ 'unique_email_id' ];
136
+		$update_link_href = str_replace( '/subscribe', '/profile', $list_details[ 'subscribe_url_long' ] );
137 137
 		$update_link_href = add_query_arg( 'e', $subscriber_id, $update_link_href );
138 138
 		$update_link_tag  = '<a href="' . $update_link_href . '">';
139
-		$headers          = 'From: ' . $list_details['campaign_defaults']['from_name'] . ' <' . $list_details['campaign_defaults']['from_email'] . '>' . "\r\n";
139
+		$headers          = 'From: ' . $list_details[ 'campaign_defaults' ][ 'from_name' ] . ' <' . $list_details[ 'campaign_defaults' ][ 'from_email' ] . '>' . "\r\n";
140 140
 		$headers         .= 'Content-type: text/html';
141 141
 
142 142
 		if ( ! isset( $email_subject ) ) {
@@ -178,26 +178,26 @@  discard block
 block discarded – undo
178 178
 		$email_body = str_replace( array( '[subscriber_id]', '[SUBSCRIBER_ID]' ), $subscriber_id, $email_body );
179 179
 
180 180
 		// We let the user use [form_name] for the form's name so replace [form_name] with the form's name.
181
-		$email_body = str_replace( array( '[form_name]', '[FORM_NAME]' ), $form_data['form_name'], $email_body );
181
+		$email_body = str_replace( array( '[form_name]', '[FORM_NAME]' ), $form_data[ 'form_name' ], $email_body );
182 182
 
183 183
 		// We let the user use [fname] and [lname] so replace those.
184
-		$email_body = str_replace( array( '[fname]', '[FNAME]' ), isset( $subscriber_account_details['merge_fields']['FNAME'] ) ? $subscriber_account_details['merge_fields']['FNAME'] : '', $email_body );
185
-		$email_body = str_replace( array( '[lname]', '[LNAME]' ), isset( $subscriber_account_details['merge_fields']['LNAME'] ) ? $subscriber_account_details['merge_fields']['LNAME'] : '', $email_body );
184
+		$email_body = str_replace( array( '[fname]', '[FNAME]' ), isset( $subscriber_account_details[ 'merge_fields' ][ 'FNAME' ] ) ? $subscriber_account_details[ 'merge_fields' ][ 'FNAME' ] : '', $email_body );
185
+		$email_body = str_replace( array( '[lname]', '[LNAME]' ), isset( $subscriber_account_details[ 'merge_fields' ][ 'LNAME' ] ) ? $subscriber_account_details[ 'merge_fields' ][ 'LNAME' ] : '', $email_body );
186 186
 
187 187
 		/* Confirm that the email was sent */
188 188
 		if ( wp_mail( $user_email, apply_filters( 'yikes-mailchimp-update-email-subject', $email_subject ), apply_filters( 'yikes-mailchimp-update-email-content', $email_body, $update_link_href ), $headers ) ) {
189 189
 
190 190
 			$update_email_success_message = apply_filters( 'yikes-mailchimp-update-email-success-message', $update_email_success_message, $form_id, $user_email );
191
-			$submission_settings          = isset( $form_data['submission_settings'] ) ? $form_data['submission_settings'] : null;
191
+			$submission_settings          = isset( $form_data[ 'submission_settings' ] ) ? $form_data[ 'submission_settings' ] : null;
192 192
 			$redirect_settings            = Yikes_Inc_Easy_Mailchimp_Extender_Process_Submission_Handler::handle_submission_response_success_redirect( $form_id, $submission_settings, $page_id );
193 193
 
194 194
 			wp_send_json_success(
195 195
 				array(
196 196
 					'response_text'  => '<div class="yikes-easy-mc-success-message">' . $update_email_success_message . '</div>',
197
-					'redirection'    => $redirect_settings['redirection'],
198
-					'redirect'       => $redirect_settings['redirect'],
199
-					'redirect_timer' => $redirect_settings['redirect_timer'],
200
-					'new_window'     => $redirect_settings['new_window'],
197
+					'redirection'    => $redirect_settings[ 'redirection' ],
198
+					'redirect'       => $redirect_settings[ 'redirect' ],
199
+					'redirect_timer' => $redirect_settings[ 'redirect_timer' ],
200
+					'new_window'     => $redirect_settings[ 'new_window' ],
201 201
 				)
202 202
 			);
203 203
 		} else {
Please login to merge, or discard this patch.
public/partials/shortcodes/process/process_form_submission_ajax.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@  discard block
 block discarded – undo
8 8
 $submission_handler = new Yikes_Inc_Easy_Mailchimp_Extender_Process_Submission_Handler( $is_ajax = true );
9 9
 
10 10
 // parse our form data
11
-parse_str( $_POST['form_data'], $data );
11
+parse_str( $_POST[ 'form_data' ], $data );
12 12
 
13 13
 // Get the form_id
14
-$form_id   = absint( $_POST['form_id'] );
14
+$form_id = absint( $_POST[ 'form_id' ] );
15 15
 
16 16
 // Send an error if for some reason we can't find the $form_id
17 17
 $submission_handler->handle_empty_form_id( $form_id );
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 $submission_handler->set_form_id( $form_id ); 
21 21
 
22 22
 // Check our nonce
23
-$submission_handler->handle_nonce( $_POST['ajax_security_nonce'], 'yikes_mc_form_submission_security_nonce' );
23
+$submission_handler->handle_nonce( $_POST[ 'ajax_security_nonce' ], 'yikes_mc_form_submission_security_nonce' );
24 24
 
25 25
 // Get the form data
26 26
 $interface = yikes_easy_mailchimp_extender_get_form_interface();
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 $submission_handler->handle_empty_form( $form_data ); 
31 31
 
32 32
 // Set up some variables from the form data -- these are required
33
-$list_id             = isset( $form_data['list_id'] ) ? $form_data['list_id'] : null;
34
-$submission_settings = isset( $form_data['submission_settings'] ) ? $form_data['submission_settings'] : null;
35
-$optin_settings      = isset( $form_data['optin_settings'] ) ? $form_data['optin_settings'] : null;
36
-$form_fields         = isset( $form_data['fields'] ) ? $form_data['fields'] : null;
33
+$list_id             = isset( $form_data[ 'list_id' ] ) ? $form_data[ 'list_id' ] : null;
34
+$submission_settings = isset( $form_data[ 'submission_settings' ] ) ? $form_data[ 'submission_settings' ] : null;
35
+$optin_settings      = isset( $form_data[ 'optin_settings' ] ) ? $form_data[ 'optin_settings' ] : null;
36
+$form_fields         = isset( $form_data[ 'fields' ] ) ? $form_data[ 'fields' ] : null;
37 37
 
38 38
 // Send an error if for some reason we can't find the required form data
39 39
 $submission_handler->handle_empty_fields_generic( array( $list_id, $submission_settings, $optin_settings, $form_fields ) );
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 $submission_handler->check_for_required_interest_groups( $data, $form_fields );
48 48
 
49 49
 // Set up some variables from the form data -- these are not required
50
-$error_messages      = isset( $form_data['error_messages'] ) ? $form_data['error_messages'] : array();
51
-$notifications       = isset( $form_data['custom_notifications'] ) ? $form_data['custom_notifications'] : array();
50
+$error_messages      = isset( $form_data[ 'error_messages' ] ) ? $form_data[ 'error_messages' ] : array();
51
+$notifications       = isset( $form_data[ 'custom_notifications' ] ) ? $form_data[ 'custom_notifications' ] : array();
52 52
 
53 53
 // Set the error messages in our class
54 54
 $submission_handler->set_error_messages( $error_messages );
55 55
 
56 56
 // Some other variables we'll need.
57
-$page_data       = isset( $_POST['page_data'] ) ? $_POST['page_data'] : '';
57
+$page_data       = isset( $_POST[ 'page_data' ] ) ? $_POST[ 'page_data' ] : '';
58 58
 $merge_variables = array();
59 59
 $error           = 0;
60 60
 $list_handler    = yikes_get_mc_api_manager()->get_list_handler();
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 // As of 6.4 we no longer pass the post object, only the ID.
63 63
 // For any users relying on the $post object for their `yikes-mailchimp-redirect-url` filter we'll grab the post object here.
64 64
 // Eventually we should just pass the $post_id into the filter instead of the whole object.
65
-$page_data       = ! empty( $page_data ) ? get_post( $page_data ) : '';
65
+$page_data = ! empty( $page_data ) ? get_post( $page_data ) : '';
66 66
 
67 67
 // Send an error if for some reason we can't find the list_handler
68 68
 $submission_handler->handle_empty_list_handler( $list_handler ); 
69 69
 
70 70
 // Get, sanitize and lowercasify the email
71
-$submitted_email = isset( $data['EMAIL'] ) ? $data['EMAIL'] : '';
71
+$submitted_email = isset( $data[ 'EMAIL' ] ) ? $data[ 'EMAIL' ] : '';
72 72
 $sanitized_email = $submission_handler->get_sanitized_email( $submitted_email ); 
73 73
 $submission_handler->set_email( $sanitized_email );
74 74
 
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
 $submission_handler->handle_empty_email( $sanitized_email );
77 77
 
78 78
 // Check for Honeypot filled
79
-$honey_pot_filled = ( isset( $data['yikes-mailchimp-honeypot'] ) && '' !== $data['yikes-mailchimp-honeypot'] ) ? true : false;
79
+$honey_pot_filled = ( isset( $data[ 'yikes-mailchimp-honeypot' ] ) && '' !== $data[ 'yikes-mailchimp-honeypot' ] ) ? true : false;
80 80
 
81 81
 // Send an error if honey pot is not empty
82 82
 $submission_handler->handle_non_empty_honeypot( $honey_pot_filled ); 
83 83
 
84 84
 // Check if reCAPTCHA Response was submitted with the form data, and handle it if needed
85
-if ( isset( $data['g-recaptcha-response'] ) ) {
86
-	$recaptcha_response = $data['g-recaptcha-response'];
85
+if ( isset( $data[ 'g-recaptcha-response' ] ) ) {
86
+	$recaptcha_response = $data[ 'g-recaptcha-response' ];
87 87
 	$submission_handler->handle_recaptcha( $recaptcha_response );
88 88
 }
89 89
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 $merge_variables = $submission_handler->get_submitted_merge_values( $data, $form_fields );
92 92
 
93 93
 // Submission Setting: Replace interest groups or update interest groups
94
-$replace_interests = isset( $submission_settings['replace_interests'] ) ? (bool) $submission_settings['replace_interests'] : true;
94
+$replace_interests = isset( $submission_settings[ 'replace_interests' ] ) ? (bool) $submission_settings[ 'replace_interests' ] : true;
95 95
 
96 96
 // Get the default groups
97 97
 $groups = $submission_handler->get_default_interest_groups( $replace_interests, $list_handler );
@@ -106,15 +106,15 @@  discard block
 block discarded – undo
106 106
  *
107 107
  * @param $merge_variables array Array of merge variable to use
108 108
  */
109
-do_action( 'yikes-mailchimp-before-submission',            $merge_variables );
109
+do_action( 'yikes-mailchimp-before-submission', $merge_variables );
110 110
 do_action( "yikes-mailchimp-before-submission-{$form_id}", $merge_variables );
111 111
 
112 112
 // Allow users to check for form values (using the `yikes-mailchimp-filter-before-submission` filter hook in function `get_submitted_merge_values`) 
113 113
 // and pass back an error and message to the user
114 114
 // If error is set and no message, default to our class variable's default error message
115
-if ( isset( $merge_variables['error'] ) ) {
116
-	$merge_error_message = isset( $merge_variables['message'] ) ? $merge_variables['message'] : $submission_handler->default_error_response_message;
117
-	$submission_handler->handle_merge_variables_error( $merge_variables['error'], $merge_error_message );
115
+if ( isset( $merge_variables[ 'error' ] ) ) {
116
+	$merge_error_message = isset( $merge_variables[ 'message' ] ) ? $merge_variables[ 'message' ] : $submission_handler->default_error_response_message;
117
+	$submission_handler->handle_merge_variables_error( $merge_variables[ 'error' ], $merge_error_message );
118 118
 }
119 119
 
120 120
 // This is the array we're going to pass through to the Mailchimp API
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 // Only add groups if they exist
128 128
 if ( ! empty( $groups ) ) {
129
-	$member_data['interests'] = $groups;
129
+	$member_data[ 'interests' ] = $groups;
130 130
 }
131 131
 
132 132
 // Check if this member already exists
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 // Likewise, if this member exists but their status is 'pending' it means we're dealing with a double opt-in list and they never confirmed
137 137
 // Or, if this member but their status is 'unsubscribed' it means we're dealing with someone who unsubscribed and they need to re-subscribe
138 138
 // Continue as if they're a new member to force another double opt-in email
139
-$double_optin_resubscribe = is_array( $member_exists ) && isset( $member_exists['status'] ) && ( $member_exists['status'] === 'pending' || $member_exists['status'] === 'unsubscribed' );
139
+$double_optin_resubscribe = is_array( $member_exists ) && isset( $member_exists[ 'status' ] ) && ( $member_exists[ 'status' ] === 'pending' || $member_exists[ 'status' ] === 'unsubscribed' );
140 140
 
141 141
 if ( is_wp_error( $member_exists ) || $double_optin_resubscribe === true ) {
142 142
 
@@ -144,23 +144,23 @@  discard block
 block discarded – undo
144 144
 
145 145
 	// Check the opt-in value - is it double or single?
146 146
 	// Double opt-in means 'status_if_new' => 'pending'
147
-	$double_optin = isset( $optin_settings['optin'] ) ? (int) $optin_settings['optin'] : 0;
147
+	$double_optin = isset( $optin_settings[ 'optin' ] ) ? (int) $optin_settings[ 'optin' ] : 0;
148 148
 
149 149
 	// If the user was unsubscribed and is re-subscribing, we set the status to 'pending', which
150 150
 	// causes Mailchimp to send them a confirmation email.  This is the only way Mailchimp will
151 151
 	// allow us to re-subscribe the user.
152
-	$was_unsubscribed = is_array( $member_exists ) && isset( $member_exists['status'] ) && $member_exists['status'] === 'unsubscribed';
152
+	$was_unsubscribed = is_array( $member_exists ) && isset( $member_exists[ 'status' ] ) && $member_exists[ 'status' ] === 'unsubscribed';
153 153
 
154 154
 	if ( $double_optin === 1 || $was_unsubscribed === true ) {
155 155
 
156 156
 		// Double opt-in
157
-		$member_data['status_if_new'] = 'pending';
158
-		$member_data['status']        = 'pending';
157
+		$member_data[ 'status_if_new' ] = 'pending';
158
+		$member_data[ 'status' ]        = 'pending';
159 159
 	} else {
160 160
 
161 161
 		// Single opt-in
162
-		$member_data['status_if_new'] = 'subscribed';
163
-		$member_data['status']        = 'subscribed';
162
+		$member_data[ 'status_if_new' ] = 'subscribed';
163
+		$member_data[ 'status' ]        = 'subscribed';
164 164
 	}
165 165
 	
166 166
 } else {
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 
170 170
 	// But first let's set our flag, and set the Mailchimp status flag
171 171
 	$new_subscriber = false;
172
-	$member_data['status'] = 'subscribed';
172
+	$member_data[ 'status' ] = 'subscribed';
173 173
 
174 174
 	// Check our update_existing_user optin setting
175
-	$update_existing_user = ( $optin_settings['update_existing_user'] === '1' ) ? true : false;
175
+	$update_existing_user = ( $optin_settings[ 'update_existing_user' ] === '1' ) ? true : false;
176 176
 
177 177
 	// If update_existing_user is false (not allowed) then simply fail and return a response message
178 178
 	if ( $update_existing_user === false ) {
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	}
181 181
 
182 182
 	// If update_existing_user is true, we need to check our 'send_update_email' option
183
-	$send_update_email = ( $optin_settings['send_update_email'] === '1' ) ? true : false;
183
+	$send_update_email = ( $optin_settings[ 'send_update_email' ] === '1' ) ? true : false;
184 184
 
185 185
 	// If $send_update_email is true (we send the email) then we need to fire off the 'send update email' logic
186 186
 	if ( $send_update_email === true ) {
Please login to merge, or discard this patch.
public/class-yikes-inc-easy-mailchimp-extender-public.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 		new YIKES_Inc_Easy_Mailchimp_Public_Ajax();
58 58
 
59 59
 		// Include our error logging class
60
-		add_action( 'init' , array( $this , 'load_error_logging_class' ) , 1 );
60
+		add_action( 'init', array( $this, 'load_error_logging_class' ), 1 );
61 61
 		// load our checkbox classes
62
-		add_action( 'init' , array( $this , 'load_checkbox_integration_classes' ) , 1 );
62
+		add_action( 'init', array( $this, 'load_checkbox_integration_classes' ), 1 );
63 63
 		// custom front end filter
64 64
 		add_action( 'init', array( $this, 'yikes_custom_frontend_content_filter' ) );
65 65
 		// Process non-ajax forms in the header
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
 	**/
95 95
 	public function load_checkbox_integration_classes() {
96 96
 		// store our options
97
-		$integrations = get_option( 'optin-checkbox-init' , array() );
98
-		if( ! empty( $integrations ) && is_array( $integrations ) ) {
97
+		$integrations = get_option( 'optin-checkbox-init', array() );
98
+		if ( ! empty( $integrations ) && is_array( $integrations ) ) {
99 99
 			// load our mail integrations class
100 100
 			require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations.php';
101 101
 			// loop over selected classes and load them up!
102
-			foreach( $integrations as $integration => $value ) {
103
-				if( isset( $value['value'] ) && $value['value'] == 'on' ) {
102
+			foreach ( $integrations as $integration => $value ) {
103
+				if ( isset( $value[ 'value' ] ) && $value[ 'value' ] == 'on' ) {
104 104
 					// load our class extensions
105
-					require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.'.$integration.'-checkbox.php';
105
+					require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.' . $integration . '-checkbox.php';
106 106
 				}
107 107
 			}
108 108
 		}
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @since 6.0.0
117 117
 	 */
118 118
 	public function load_error_logging_class() {
119
-		if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) {
119
+		if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) {
120 120
 			// if error logging is enabled we should include our error logging class
121 121
 			require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php';
122 122
 			$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging;
@@ -129,19 +129,19 @@  discard block
 block discarded – undo
129 129
 	*	@since 6.0.3.4
130 130
 	*/
131 131
 	public function yikes_process_non_ajax_forms( $form_submitted ) {
132
-		global $wpdb,$post;
133
-		$form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? (int) $_POST['yikes-mailchimp-submitted-form'] : false; // store form id
134
-		if( $form_id ) {
132
+		global $wpdb, $post;
133
+		$form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? (int) $_POST[ 'yikes-mailchimp-submitted-form' ] : false; // store form id
134
+		if ( $form_id ) {
135 135
 			$form_settings = self::yikes_retrieve_form_settings( $form_id );
136
-			if( isset( $_POST ) && !empty( $_POST ) && isset( $form_id ) && $form_settings['submission_settings']['ajax'] == 0 ) {
137
-				if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { // ensure we only process the form that was submitted
136
+			if ( isset( $_POST ) && ! empty( $_POST ) && isset( $form_id ) && $form_settings[ 'submission_settings' ][ 'ajax' ] == 0 ) {
137
+				if ( $_POST[ 'yikes-mailchimp-submitted-form' ] == $form_id ) { // ensure we only process the form that was submitted
138 138
 
139 139
 					// Lets include our form processing file
140 140
 					include_once( YIKES_MC_PATH . 'public/partials/shortcodes/process/process_form_submission.php' );
141
-					if( $form_settings['submission_settings']['redirect_on_submission'] == '1' ) {
142
-						if( $form_submitted == 1 ) {
141
+					if ( $form_settings[ 'submission_settings' ][ 'redirect_on_submission' ] == '1' ) {
142
+						if ( $form_submitted == 1 ) {
143 143
 							// decode our settings
144
-							$redirect_page = ( 'custom_url' != $form_settings['submission_settings']['redirect_page'] ) ? get_permalink( (int) $form_settings['submission_settings']['redirect_page'] ) : $form_settings['submission_settings']['custom_redirect_url'];
144
+							$redirect_page = ( 'custom_url' != $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) ? get_permalink( (int) $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) : $form_settings[ 'submission_settings' ][ 'custom_redirect_url' ];
145 145
 							wp_redirect( apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_page ), $form_id, $post ) );
146 146
 							exit;
147 147
 						}
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	public static function yikes_retrieve_form_settings( $form_id ) {
171 171
 		// if no form id, abort
172
-		if( ! $form_id ) {
172
+		if ( ! $form_id ) {
173 173
 			return array();
174 174
 		}
175 175
 
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 			return;
199 199
 		}
200 200
 		// trim trailing period
201
-		if ( isset( $form_settings['error_messages']['update-link'] ) && ! empty( $form_settings['error_messages']['update-link'] ) ) {
202
-			$response_text = $form_settings['error_messages']['update-link'];
201
+		if ( isset( $form_settings[ 'error_messages' ][ 'update-link' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'update-link' ] ) ) {
202
+			$response_text = $form_settings[ 'error_messages' ][ 'update-link' ];
203 203
 			// extract the link text
204 204
 			preg_match( '/\[link].*?\[\/link\]/', $response_text, $link_text );
205 205
 			if ( $link_text && ! empty( $link_text ) ) {
206 206
 				// Extract the custom link text ([link]*[/link])
207
-				$custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[0], $link ) ) );
207
+				$custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[ 0 ], $link ) ) );
208 208
 				// Replace the link text, with our custom link text
209 209
 				$response_text = str_replace( $link_text, $custom_link_text, $response_text );
210 210
 			}
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 		}
234 234
 
235 235
 		// trim trailing period
236
-		if ( isset( $form_settings['error_messages']['already-subscribed'] ) && ! empty( $form_settings['error_messages']['already-subscribed'] ) ) {
237
-			$response_text = str_replace( '[email]', $email, $form_settings['error_messages']['already-subscribed'] );
236
+		if ( isset( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) ) {
237
+			$response_text = str_replace( '[email]', $email, $form_settings[ 'error_messages' ][ 'already-subscribed' ] );
238 238
 		}
239 239
 		// Return our new string
240 240
 		return $response_text;
Please login to merge, or discard this patch.