Completed
Push — master ( cbfad0...1d76cf )
by Devin
67:21 queued 47:22
created
includes/gateways/offline-donations.php 1 patch
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return array
20 20
  */
21
-function give_offline_register_gateway( $gateways ) {
21
+function give_offline_register_gateway($gateways) {
22 22
 	// Format: ID => Name
23 23
 	$gateways['offline'] = array(
24
-		'admin_label'    => esc_attr__( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_attr__( 'Offline Donation', 'give' )
24
+		'admin_label'    => esc_attr__('Offline Donation', 'give'),
25
+		'checkout_label' => esc_attr__('Offline Donation', 'give')
26 26
 	);
27 27
 
28 28
 	return $gateways;
29 29
 }
30 30
 
31
-add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 );
31
+add_filter('give_payment_gateways', 'give_offline_register_gateway', 1);
32 32
 
33 33
 
34 34
 /**
@@ -40,56 +40,56 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return void
42 42
  */
43
-function give_offline_payment_cc_form( $form_id ) {
43
+function give_offline_payment_cc_form($form_id) {
44 44
 
45
-	$post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
46
-	$post_offline_instructions         = get_post_meta( $form_id, '_give_offline_checkout_notes', true );
47
-	$global_offline_instruction        = give_get_option( 'global_offline_donation_content' );
45
+	$post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
46
+	$post_offline_instructions         = get_post_meta($form_id, '_give_offline_checkout_notes', true);
47
+	$global_offline_instruction        = give_get_option('global_offline_donation_content');
48 48
 	$offline_instructions              = $global_offline_instruction;
49 49
 
50
-	if ( $post_offline_customization_option == 'yes' ) {
50
+	if ($post_offline_customization_option == 'yes') {
51 51
 		$offline_instructions = $post_offline_instructions;
52 52
 	}
53 53
 
54 54
 
55 55
 	ob_start(); ?>
56
-	<?php do_action( 'give_before_offline_info_fields', $form_id ); ?>
56
+	<?php do_action('give_before_offline_info_fields', $form_id); ?>
57 57
 	<fieldset id="give_offline_payment_info">
58 58
 		<?php
59
-		$settings_url         = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' );
59
+		$settings_url         = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
60 60
 		/* translators: %s: form settings url */
61
-		$offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url );
62
-		echo wpautop( stripslashes( $offline_instructions ) );
61
+		$offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url);
62
+		echo wpautop(stripslashes($offline_instructions));
63 63
 		?>
64 64
 	</fieldset>
65
-	<?php do_action( 'give_after_offline_info_fields', $form_id ); ?>
65
+	<?php do_action('give_after_offline_info_fields', $form_id); ?>
66 66
 	<?php
67 67
 	echo ob_get_clean();
68 68
 }
69 69
 
70
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
70
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
71 71
 
72 72
 /**
73 73
  * Give Offline Billing Field
74 74
  *
75 75
  * @param $form_id
76 76
  */
77
-function give_offline_billing_fields( $form_id ) {
77
+function give_offline_billing_fields($form_id) {
78 78
 	//Enable Default CC fields (billing info)
79
-	$post_offline_cc_fields        = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
80
-	$post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
79
+	$post_offline_cc_fields        = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
80
+	$post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
81 81
 
82
-	$global_offline_cc_fields      = give_get_option( 'give_offline_donation_enable_billing_fields' );
82
+	$global_offline_cc_fields      = give_get_option('give_offline_donation_enable_billing_fields');
83 83
 
84 84
 	//Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options
85
-	if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) {
86
-		give_default_cc_address_fields( $form_id );
87
-	} elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
88
-		give_default_cc_address_fields( $form_id );
85
+	if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') {
86
+		give_default_cc_address_fields($form_id);
87
+	} elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
88
+		give_default_cc_address_fields($form_id);
89 89
 	}
90 90
 }
91 91
 
92
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
92
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
93 93
 
94 94
 /**
95 95
  * Process the payment
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
  *
101 101
  * @return void
102 102
  */
103
-function give_offline_process_payment( $purchase_data ) {
103
+function give_offline_process_payment($purchase_data) {
104 104
 
105
-	$purchase_summary = give_get_purchase_summary( $purchase_data );
105
+	$purchase_summary = give_get_purchase_summary($purchase_data);
106 106
 
107 107
 	// setup the payment details
108 108
 	$payment_data = array(
109 109
 		'price'           => $purchase_data['price'],
110 110
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
111
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
112
-		'give_price_id'   => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '',
111
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
112
+		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
113 113
 		'date'            => $purchase_data['date'],
114 114
 		'user_email'      => $purchase_data['user_email'],
115 115
 		'purchase_key'    => $purchase_data['purchase_key'],
@@ -121,20 +121,20 @@  discard block
 block discarded – undo
121 121
 
122 122
 
123 123
 	// record the pending payment
124
-	$payment = give_insert_payment( $payment_data );
124
+	$payment = give_insert_payment($payment_data);
125 125
 
126
-	if ( $payment ) {
127
-		give_offline_send_admin_notice( $payment );
128
-		give_offline_send_donor_instructions( $payment );
126
+	if ($payment) {
127
+		give_offline_send_admin_notice($payment);
128
+		give_offline_send_donor_instructions($payment);
129 129
 		give_send_to_success_page();
130 130
 	} else {
131 131
 		// if errors are present, send the user back to the donation form so they can be corrected
132
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
132
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
133 133
 	}
134 134
 
135 135
 }
136 136
 
137
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
137
+add_action('give_gateway_offline', 'give_offline_process_payment');
138 138
 
139 139
 
140 140
 /**
@@ -147,47 +147,47 @@  discard block
 block discarded – undo
147 147
  * @since       1.0
148 148
  * @return void
149 149
  */
150
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
150
+function give_offline_send_donor_instructions($payment_id = 0) {
151 151
 
152
-	$payment_data                      = give_get_payment_meta( $payment_id );
153
-	$post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
152
+	$payment_data                      = give_get_payment_meta($payment_id);
153
+	$post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
154 154
 
155 155
 	//Customize email content depending on whether the single form has been customized
156
-	$email_content = give_get_option( 'global_offline_donation_email' );
156
+	$email_content = give_get_option('global_offline_donation_email');
157 157
 
158
-	if ( $post_offline_customization_option === 'yes' ) {
159
-		$email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
158
+	if ($post_offline_customization_option === 'yes') {
159
+		$email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true);
160 160
 	}
161 161
 
162
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
163
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
162
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
163
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
164 164
 
165
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
166
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
165
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
166
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
167 167
 
168
-	$to_email = give_get_payment_user_email( $payment_id );
168
+	$to_email = give_get_payment_user_email($payment_id);
169 169
 
170
-	$subject = give_get_option( 'offline_donation_subject', esc_html__( 'Offline Donation Instructions', 'give' ) );
171
-	if ( $post_offline_customization_option === 'yes' ) {
172
-		$subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
170
+	$subject = give_get_option('offline_donation_subject', esc_html__('Offline Donation Instructions', 'give'));
171
+	if ($post_offline_customization_option === 'yes') {
172
+		$subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
173 173
 	}
174 174
 
175
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
176
-	$subject = give_do_email_tags( $subject, $payment_id );
175
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
176
+	$subject = give_do_email_tags($subject, $payment_id);
177 177
 
178
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
179
-	$message     = give_do_email_tags( $email_content, $payment_id );
178
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
179
+	$message     = give_do_email_tags($email_content, $payment_id);
180 180
 
181 181
 	$emails = Give()->emails;
182 182
 
183
-	$emails->__set( 'from_name', $from_name );
184
-	$emails->__set( 'from_email', $from_email );
185
-	$emails->__set( 'heading', esc_html__( 'Offline Donation Instructions', 'give' ) );
183
+	$emails->__set('from_name', $from_name);
184
+	$emails->__set('from_email', $from_email);
185
+	$emails->__set('heading', esc_html__('Offline Donation Instructions', 'give'));
186 186
 
187
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
188
-	$emails->__set( 'headers', $headers );
187
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
188
+	$emails->__set('headers', $headers);
189 189
 
190
-	$emails->send( $to_email, $subject, $message, $attachments );
190
+	$emails->send($to_email, $subject, $message, $attachments);
191 191
 
192 192
 }
193 193
 
@@ -204,52 +204,52 @@  discard block
 block discarded – undo
204 204
  * @return void
205 205
  *
206 206
  */
207
-function give_offline_send_admin_notice( $payment_id = 0 ) {
207
+function give_offline_send_admin_notice($payment_id = 0) {
208 208
 
209 209
 	/* Send an email notification to the admin */
210 210
 	$admin_email = give_get_admin_notice_emails();
211
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
211
+	$user_info   = give_get_payment_meta_user_info($payment_id);
212 212
 
213
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
214
-		$user_data = get_userdata( $user_info['id'] );
213
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
214
+		$user_data = get_userdata($user_info['id']);
215 215
 		$name      = $user_data->display_name;
216
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
217
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
216
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
217
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
218 218
 	} else {
219 219
 		$name = $user_info['email'];
220 220
 	}
221 221
 
222
-	$amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) );
222
+	$amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
223 223
 
224
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_attr__( 'New Pending Donation', 'give' ), $payment_id );
224
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id);
225 225
 
226
-	$admin_message = esc_attr__( 'Dear Admin,', 'give' ) . "\n\n";
227
-	$admin_message .= esc_attr__( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' ';
228
-	$admin_message .= esc_attr__( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
226
+	$admin_message = esc_attr__('Dear Admin,', 'give')."\n\n";
227
+	$admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' ';
228
+	$admin_message .= esc_attr__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
229 229
 
230 230
 
231
-	$admin_message .= '<strong>' . esc_attr__( 'Donor: ', 'give' ) . '</strong>' . '{fullname}' . "\n";
232
-	$admin_message .= '<strong>' . esc_attr__( 'Amount: ', 'give' ) . '</strong>' . '{price}' . "\n\n";
231
+	$admin_message .= '<strong>'.esc_attr__('Donor: ', 'give').'</strong>'.'{fullname}'."\n";
232
+	$admin_message .= '<strong>'.esc_attr__('Amount: ', 'give').'</strong>'.'{price}'."\n\n";
233 233
 
234 234
 	$admin_message .= sprintf(
235 235
 		'<a href="%1$s">%2$s</a>',
236
-		admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ),
237
-		esc_html__( 'Click Here to View and/or Update Donation Details', 'give' )
238
-	) . "\n\n";
236
+		admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id),
237
+		esc_html__('Click Here to View and/or Update Donation Details', 'give')
238
+	)."\n\n";
239 239
 
240
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
241
-	$admin_message = give_do_email_tags( $admin_message, $payment_id );
240
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
241
+	$admin_message = give_do_email_tags($admin_message, $payment_id);
242 242
 
243
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
244
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
243
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
244
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
245 245
 
246 246
 	//Send Email
247 247
 	$emails = Give()->emails;
248
-	if ( ! empty( $admin_headers ) ) {
249
-		$emails->__set( 'headers', $admin_headers );
248
+	if ( ! empty($admin_headers)) {
249
+		$emails->__set('headers', $admin_headers);
250 250
 	}
251 251
 
252
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
252
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
253 253
 
254 254
 }
255 255
 
@@ -260,15 +260,15 @@  discard block
 block discarded – undo
260 260
  * @since  1.0
261 261
  * @return array
262 262
  */
263
-function give_offline_add_settings( $settings ) {
263
+function give_offline_add_settings($settings) {
264 264
 
265 265
 	//Vars
266 266
 	$prefix = '_give_';
267 267
 
268
-	$is_gateway_active = give_is_gateway_active( 'offline' );
268
+	$is_gateway_active = give_is_gateway_active('offline');
269 269
 
270 270
 	//this gateway isn't active
271
-	if ( ! $is_gateway_active ) {
271
+	if ( ! $is_gateway_active) {
272 272
 		//return settings and bounce
273 273
 		return $settings;
274 274
 	}
@@ -277,27 +277,27 @@  discard block
 block discarded – undo
277 277
 	$check_settings = array(
278 278
 
279 279
 		array(
280
-			'name'    => esc_attr__( 'Customize Offline Donations', 'give' ),
281
-			'desc'    => esc_attr__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ),
282
-			'id'      => $prefix . 'customize_offline_donations',
280
+			'name'    => esc_attr__('Customize Offline Donations', 'give'),
281
+			'desc'    => esc_attr__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'),
282
+			'id'      => $prefix.'customize_offline_donations',
283 283
 			'type'    => 'radio_inline',
284 284
 			'default' => 'no',
285 285
 			'options' => array(
286
-				'yes' => esc_attr__( 'Yes', 'give' ),
287
-				'no'  => esc_attr__( 'No', 'give' ),
286
+				'yes' => esc_attr__('Yes', 'give'),
287
+				'no'  => esc_attr__('No', 'give'),
288 288
 			),
289 289
 		),
290 290
 		array(
291
-			'name'        => esc_attr__( 'Request Billing Information', 'give' ),
292
-			'desc'        => esc_attr__( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ),
293
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
291
+			'name'        => esc_attr__('Request Billing Information', 'give'),
292
+			'desc'        => esc_attr__('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'),
293
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
294 294
 			'row_classes' => 'give-subfield',
295 295
 			'type'        => 'checkbox'
296 296
 		),
297 297
 		array(
298
-			'id'          => $prefix . 'offline_checkout_notes',
299
-			'name'        => esc_attr__( 'Offline Donation Instructions', 'give' ),
300
-			'desc'        => esc_attr__( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
298
+			'id'          => $prefix.'offline_checkout_notes',
299
+			'name'        => esc_attr__('Offline Donation Instructions', 'give'),
300
+			'desc'        => esc_attr__('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
301 301
 			'default'     => give_get_default_offline_donation_content(),
302 302
 			'type'        => 'wysiwyg',
303 303
 			'row_classes' => 'give-subfield',
@@ -306,17 +306,17 @@  discard block
 block discarded – undo
306 306
 			)
307 307
 		),
308 308
 		array(
309
-			'id'          => $prefix . 'offline_donation_subject',
310
-			'name'        => esc_attr__( 'Offline Donation Email Instructions Subject', 'give' ),
311
-			'desc'        => esc_attr__( 'Enter the subject line for the donation receipt email.', 'give' ),
312
-			'default'     => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
309
+			'id'          => $prefix.'offline_donation_subject',
310
+			'name'        => esc_attr__('Offline Donation Email Instructions Subject', 'give'),
311
+			'desc'        => esc_attr__('Enter the subject line for the donation receipt email.', 'give'),
312
+			'default'     => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
313 313
 			'row_classes' => 'give-subfield',
314 314
 			'type'        => 'text'
315 315
 		),
316 316
 		array(
317
-			'id'          => $prefix . 'offline_donation_email',
318
-			'name'        => esc_attr__( 'Offline Donation Email Instructions', 'give' ),
319
-			'desc'        => esc_attr__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
317
+			'id'          => $prefix.'offline_donation_email',
318
+			'name'        => esc_attr__('Offline Donation Email Instructions', 'give'),
319
+			'desc'        => esc_attr__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
320 320
 			'default'     => give_get_default_offline_donation_email_content(),
321 321
 			'type'        => 'wysiwyg',
322 322
 			'row_classes' => 'give-subfield',
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
 		)
327 327
 	);
328 328
 
329
-	return array_merge( $settings, $check_settings );
329
+	return array_merge($settings, $check_settings);
330 330
 }
331 331
 
332
-add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' );
332
+add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings');
333 333
 
334 334
 
335 335
 /**
@@ -341,32 +341,32 @@  discard block
 block discarded – undo
341 341
  */
342 342
 function give_get_default_offline_donation_content() {
343 343
 
344
-	$sitename = get_bloginfo( 'sitename' );
344
+	$sitename = get_bloginfo('sitename');
345 345
 
346
-	$default_text = '<p>' . esc_attr__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
346
+	$default_text = '<p>'.esc_attr__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
347 347
 	$default_text .= '<ol>';
348 348
 	$default_text .= '<li>';
349 349
 	$default_text .= sprintf(
350 350
 		/* translators: %s: site name */
351
-		esc_html__( 'Make a check payable to "%s"', 'give' ),
351
+		esc_html__('Make a check payable to "%s"', 'give'),
352 352
 		$sitename
353 353
 	);
354 354
 	$default_text .= '</li>';
355 355
 	$default_text .= '<li>';
356 356
 	$default_text .= sprintf(
357 357
 		/* translators: %s: site name */
358
-		esc_html__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
358
+		esc_html__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
359 359
 		$sitename
360 360
 	);
361 361
 	$default_text .= '</li>';
362
-	$default_text .= '<li>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>';
362
+	$default_text .= '<li>'.esc_html__('Please mail your check to:', 'give').'</li>';
363 363
 	$default_text .= '</ol>';
364
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
364
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
365 365
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
366 366
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
367
-	$default_text .= '<p>' . esc_attr__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
367
+	$default_text .= '<p>'.esc_attr__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
368 368
 
369
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
369
+	return apply_filters('give_default_offline_donation_content', $default_text);
370 370
 
371 371
 }
372 372
 
@@ -379,33 +379,33 @@  discard block
 block discarded – undo
379 379
  */
380 380
 function give_get_default_offline_donation_email_content() {
381 381
 
382
-	$sitename      = get_bloginfo( 'sitename' );
383
-	$default_text  = '<p>' . esc_html__( 'Dear {name},', 'give' ) . '</p>';
384
-	$default_text .= '<p>' . esc_html__( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>';
382
+	$sitename      = get_bloginfo('sitename');
383
+	$default_text  = '<p>'.esc_html__('Dear {name},', 'give').'</p>';
384
+	$default_text .= '<p>'.esc_html__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>';
385 385
 	$default_text .= '<ol>';
386 386
 	$default_text .= '<li>';
387 387
 	$default_text .= sprintf(
388 388
 		/* translators: %s: site name */
389
-		esc_html__( 'Make a check payable to "%s"', 'give' ),
389
+		esc_html__('Make a check payable to "%s"', 'give'),
390 390
 		$sitename
391 391
 	);
392 392
 	$default_text .= '</li>';
393 393
 	$default_text .= '<li>';
394 394
 	$default_text .= sprintf(
395 395
 		/* translators: %s: site name */
396
-		esc_html__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
396
+		esc_html__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
397 397
 		$sitename
398 398
 	);
399 399
 	$default_text .= '</li>';
400
-	$default_text .= '<li>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>';
400
+	$default_text .= '<li>'.esc_html__('Please mail your check to:', 'give').'</li>';
401 401
 	$default_text .= '</ol>';
402
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
402
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
403 403
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
404 404
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
405
-	$default_text .= '<p>' . esc_html__( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>';
406
-	$default_text .= '<p>' . esc_html__( 'Sincerely,', 'give' ) . '</p>';
407
-	$default_text .= '<p>' . $sitename . '</p>';
405
+	$default_text .= '<p>'.esc_html__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>';
406
+	$default_text .= '<p>'.esc_html__('Sincerely,', 'give').'</p>';
407
+	$default_text .= '<p>'.$sitename.'</p>';
408 408
 
409
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
409
+	return apply_filters('give_default_offline_donation_content', $default_text);
410 410
 
411 411
 }
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateway-error-logs-list-table.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct() {
46 46
 		// Set parent defaults.
47
-		parent::__construct( array(
48
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
49
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records.
47
+		parent::__construct(array(
48
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
49
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
50 50
 			'ajax'     => false                        // Does this table support ajax?.
51
-		) );
51
+		));
52 52
 	}
53 53
 
54 54
 	/**
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string Column Name
64 64
 	 */
65
-	public function column_default( $item, $column_name ) {
65
+	public function column_default($item, $column_name) {
66 66
 
67
-		switch ( $column_name ) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'payment_id' :
71
-				return empty( $item->payment_id ) ? esc_html__( 'n/a', 'give' ) : $item->payment_id;
71
+				return empty($item->payment_id) ? esc_html__('n/a', 'give') : $item->payment_id;
72 72
 			case 'gateway' :
73
-				return empty( $item->gateway ) ? esc_html__( 'n/a', 'give' ) : $item->gateway;
73
+				return empty($item->gateway) ? esc_html__('n/a', 'give') : $item->gateway;
74 74
 			case 'error' :
75
-				return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' );
75
+				return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give');
76 76
 			default:
77
-				return $item[ $column_name ];
77
+				return $item[$column_name];
78 78
 		}
79 79
 	}
80 80
 
@@ -88,27 +88,27 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return void
90 90
 	 */
91
-	public function column_message( $item ) { ?>
92
-		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a>
91
+	public function column_message($item) { ?>
92
+		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a>
93 93
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
94 94
 			<?php
95 95
 
96
-			$log_message = get_post_field( 'post_content', $item['ID'] );
96
+			$log_message = get_post_field('post_content', $item['ID']);
97 97
 
98
-			$serialized = strpos( $log_message, '{"' );
98
+			$serialized = strpos($log_message, '{"');
99 99
 
100 100
 			// Check to see if the log message contains serialized information
101
-			if ( $serialized !== false ) {
102
-				$length = strlen( $log_message ) - $serialized;
103
-				$intro  = substr( $log_message, 0, - $length );
104
-				$data   = substr( $log_message, $serialized, strlen( $log_message ) - 1 );
101
+			if ($serialized !== false) {
102
+				$length = strlen($log_message) - $serialized;
103
+				$intro  = substr($log_message, 0, - $length);
104
+				$data   = substr($log_message, $serialized, strlen($log_message) - 1);
105 105
 
106
-				echo wpautop( $intro );
107
-				echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' );
108
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
106
+				echo wpautop($intro);
107
+				echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>');
108
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
109 109
 			} else {
110 110
 				// No serialized data found
111
-				echo wpautop( $log_message );
111
+				echo wpautop($log_message);
112 112
 			}
113 113
 			?>
114 114
 		</div>
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function get_columns() {
126 126
 		$columns = array(
127
-			'ID'         => esc_html__( 'Log ID', 'give' ),
128
-			'error'      => esc_html__( 'Error', 'give' ),
129
-			'gateway'    => esc_html__( 'Gateway', 'give' ),
130
-			'payment_id' => esc_html__( 'Payment ID', 'give' ),
131
-			'date'       => esc_html__( 'Date', 'give' ),
132
-			'message'    => esc_html__( 'Details', 'give' )
127
+			'ID'         => esc_html__('Log ID', 'give'),
128
+			'error'      => esc_html__('Error', 'give'),
129
+			'gateway'    => esc_html__('Gateway', 'give'),
130
+			'payment_id' => esc_html__('Payment ID', 'give'),
131
+			'date'       => esc_html__('Date', 'give'),
132
+			'message'    => esc_html__('Details', 'give')
133 133
 		);
134 134
 
135 135
 		return $columns;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @return int Current page number
144 144
 	 */
145 145
 	public function get_paged() {
146
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
146
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
147 147
 	}
148 148
 
149 149
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @since  1.0
154 154
 	 * @return void
155 155
 	 */
156
-	public function bulk_actions( $which = '' ) {
156
+	public function bulk_actions($which = '') {
157 157
 		give_log_views();
158 158
 	}
159 159
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 		// Prevent the queries from getting cached.
173 173
 		// Without this there are occasional memory issues for some installs.
174
-		wp_suspend_cache_addition( true );
174
+		wp_suspend_cache_addition(true);
175 175
 
176 176
 		$logs_data = array();
177 177
 		$paged     = $this->get_paged();
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
 			'paged'    => $paged
181 181
 		);
182 182
 
183
-		$logs = $give_logs->get_connected_logs( $log_query );
183
+		$logs = $give_logs->get_connected_logs($log_query);
184 184
 
185
-		if ( $logs ) {
186
-			foreach ( $logs as $log ) {
185
+		if ($logs) {
186
+			foreach ($logs as $log) {
187 187
 
188 188
 				$logs_data[] = array(
189 189
 					'ID'         => $log->ID,
190
-					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
190
+					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
191 191
 					'payment_id' => $log->post_parent,
192 192
 					'error'      => 'error',
193
-					'gateway'    => give_get_payment_gateway( $log->post_parent ),
193
+					'gateway'    => give_get_payment_gateway($log->post_parent),
194 194
 					'date'       => $log->post_date
195 195
 				);
196 196
 			}
@@ -212,19 +212,19 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @param string $which
214 214
 	 */
215
-	protected function display_tablenav( $which ) {
216
-		if ( 'top' === $which ) {
217
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
215
+	protected function display_tablenav($which) {
216
+		if ('top' === $which) {
217
+			wp_nonce_field('bulk-'.$this->_args['plural']);
218 218
 		}
219 219
 		?>
220
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
220
+		<div class="tablenav <?php echo esc_attr($which); ?>">
221 221
 
222 222
 			<div class="alignleft actions bulkactions">
223
-				<?php $this->bulk_actions( $which ); ?>
223
+				<?php $this->bulk_actions($which); ?>
224 224
 			</div>
225 225
 			<?php
226
-			$this->extra_tablenav( $which );
227
-			$this->pagination( $which );
226
+			$this->extra_tablenav($which);
227
+			$this->pagination($which);
228 228
 			?>
229 229
 
230 230
 			<br class="clear"/>
@@ -251,14 +251,14 @@  discard block
 block discarded – undo
251 251
 		$columns               = $this->get_columns();
252 252
 		$hidden                = array(); // No hidden columns
253 253
 		$sortable              = $this->get_sortable_columns();
254
-		$this->_column_headers = array( $columns, $hidden, $sortable );
254
+		$this->_column_headers = array($columns, $hidden, $sortable);
255 255
 		$this->items           = $this->get_logs();
256
-		$total_items           = $give_logs->get_log_count( 0, 'gateway_error' );
256
+		$total_items           = $give_logs->get_log_count(0, 'gateway_error');
257 257
 
258
-		$this->set_pagination_args( array(
258
+		$this->set_pagination_args(array(
259 259
 				'total_items' => $total_items,
260 260
 				'per_page'    => $this->per_page,
261
-				'total_pages' => ceil( $total_items / $this->per_page )
261
+				'total_pages' => ceil($total_items / $this->per_page)
262 262
 			)
263 263
 		);
264 264
 	}
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -10,61 +10,61 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
+if ( ! defined('WP_UNINSTALL_PLUGIN')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load Give file.
18
-include_once( 'give.php' );
18
+include_once('give.php');
19 19
 
20 20
 global $wpdb, $wp_roles;
21 21
 
22 22
 
23
-if ( give_get_option( 'uninstall_on_delete' ) === 'on' ) {
23
+if (give_get_option('uninstall_on_delete') === 'on') {
24 24
 
25 25
 	// Delete All the Custom Post Types.
26
-	$give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type' );
27
-	$give_post_types = array( 'give_forms', 'give_payment', 'give_log' );
28
-	foreach ( $give_post_types as $post_type ) {
26
+	$give_taxonomies = array('form_category', 'form_tag', 'give_log_type');
27
+	$give_post_types = array('give_forms', 'give_payment', 'give_log');
28
+	foreach ($give_post_types as $post_type) {
29 29
 
30
-		$give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) );
31
-		$items           = get_posts( array(
30
+		$give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type));
31
+		$items           = get_posts(array(
32 32
 			'post_type'   => $post_type,
33 33
 			'post_status' => 'any',
34
-			'numberposts' => - 1,
34
+			'numberposts' => -1,
35 35
 			'fields'      => 'ids',
36
-		) );
36
+		));
37 37
 
38
-		if ( $items ) {
39
-			foreach ( $items as $item ) {
40
-				wp_delete_post( $item, true );
38
+		if ($items) {
39
+			foreach ($items as $item) {
40
+				wp_delete_post($item, true);
41 41
 			}
42 42
 		}
43 43
 	}
44 44
 
45 45
 	// Delete All the Terms & Taxonomies.
46
-	foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) {
46
+	foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) {
47 47
 
48
-		$terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) );
48
+		$terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy));
49 49
 
50 50
 		// Delete Terms.
51
-		if ( $terms ) {
52
-			foreach ( $terms as $term ) {
53
-				$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) );
54
-				$wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) );
51
+		if ($terms) {
52
+			foreach ($terms as $term) {
53
+				$wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id));
54
+				$wpdb->delete($wpdb->terms, array('term_id' => $term->term_id));
55 55
 			}
56 56
 		}
57 57
 
58 58
 		// Delete Taxonomies.
59
-		$wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) );
59
+		$wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s'));
60 60
 	}
61 61
 
62 62
 	// Delete the Plugin Pages.
63
-	$give_created_pages = array( 'success_page', 'failure_page', 'history_page' );
64
-	foreach ( $give_created_pages as $p ) {
65
-		$page = give_get_option( $p, false );
66
-		if ( $page ) {
67
-			wp_delete_post( $page, true );
63
+	$give_created_pages = array('success_page', 'failure_page', 'history_page');
64
+	foreach ($give_created_pages as $p) {
65
+		$page = give_get_option($p, false);
66
+		if ($page) {
67
+			wp_delete_post($page, true);
68 68
 		}
69 69
 	}
70 70
 
@@ -72,20 +72,20 @@  discard block
 block discarded – undo
72 72
 	Give()->roles->remove_caps();
73 73
 
74 74
 	// Delete the Roles.
75
-	$give_roles = array( 'give_manager', 'give_accountant', 'give_worker' );
76
-	foreach ( $give_roles as $role ) {
77
-		remove_role( $role );
75
+	$give_roles = array('give_manager', 'give_accountant', 'give_worker');
76
+	foreach ($give_roles as $role) {
77
+		remove_role($role);
78 78
 	}
79 79
 
80 80
 	// Remove all database tables.
81
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' );
82
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' );
83
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' );
81
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors');
82
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers');
83
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta');
84 84
 
85 85
 	// Cleanup Cron Events.
86
-	wp_clear_scheduled_hook( 'give_daily_scheduled_events' );
87
-	wp_clear_scheduled_hook( 'give_daily_cron' );
88
-	wp_clear_scheduled_hook( 'give_weekly_cron' );
86
+	wp_clear_scheduled_hook('give_daily_scheduled_events');
87
+	wp_clear_scheduled_hook('give_daily_cron');
88
+	wp_clear_scheduled_hook('give_weekly_cron');
89 89
 
90 90
 	// Get all options.
91 91
 	$give_option_names = $wpdb->get_results(
@@ -96,24 +96,24 @@  discard block
 block discarded – undo
96 96
 		ARRAY_A
97 97
 	);
98 98
 
99
-	if ( ! empty( $give_option_names ) ) {
99
+	if ( ! empty($give_option_names)) {
100 100
 		// Convert option name to transient or option name.
101 101
 		$new_give_option_names = array();
102 102
 
103
-		foreach ( $give_option_names as $option ) {
104
-			$new_give_option_names[] = ( false !== strpos( $option['option_name'], '_transient_' ) )
105
-				? str_replace( '_transient_', '', $option['option_name'] )
103
+		foreach ($give_option_names as $option) {
104
+			$new_give_option_names[] = (false !== strpos($option['option_name'], '_transient_'))
105
+				? str_replace('_transient_', '', $option['option_name'])
106 106
 				: $option['option_name'];
107 107
 		}
108 108
 
109 109
 		$give_option_names = $new_give_option_names;
110 110
 
111 111
 		// Delete all the Plugin Options.
112
-		foreach ( $give_option_names as $option ) {
113
-			if ( false !== strpos( $option, '_transient_' ) ) {
114
-				delete_transient( $option );
112
+		foreach ($give_option_names as $option) {
113
+			if (false !== strpos($option, '_transient_')) {
114
+				delete_transient($option);
115 115
 			} else {
116
-				delete_option( $option );
116
+				delete_option($option);
117 117
 			}
118 118
 		}
119 119
 	}
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 1 patch
Spacing   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @access private
22 22
  * @since  1.0
23 23
  */
24
-add_action( 'give_paypal_cc_form', '__return_false' );
24
+add_action('give_paypal_cc_form', '__return_false');
25 25
 
26 26
 /**
27 27
  * Process PayPal Purchase.
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_process_paypal_purchase( $purchase_data ) {
35
+function give_process_paypal_purchase($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 
41
-	$form_id  = intval( $purchase_data['post_data']['give-form-id'] );
42
-	$price_id = isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '';
41
+	$form_id  = intval($purchase_data['post_data']['give-form-id']);
42
+	$price_id = isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '';
43 43
 
44 44
 	// Collect payment data.
45 45
 	$payment_data = array(
@@ -57,69 +57,69 @@  discard block
 block discarded – undo
57 57
 	);
58 58
 
59 59
 	// Record the pending payment.
60
-	$payment = give_insert_payment( $payment_data );
60
+	$payment = give_insert_payment($payment_data);
61 61
 
62 62
 	// Check payment.
63
-	if ( ! $payment ) {
63
+	if ( ! $payment) {
64 64
 		// Record the error.
65 65
 		give_record_gateway_error(
66
-			esc_html__( 'Payment Error', 'give' ),
66
+			esc_html__('Payment Error', 'give'),
67 67
 			sprintf(
68 68
 			/* translators: %s: payment data */
69
-				esc_html__( 'Payment creation failed before sending buyer to PayPal. Payment data: %s', 'give' ),
70
-				json_encode( $payment_data )
69
+				esc_html__('Payment creation failed before sending buyer to PayPal. Payment data: %s', 'give'),
70
+				json_encode($payment_data)
71 71
 			),
72 72
 			$payment
73 73
 		);
74 74
 		// Problems? Send back.
75
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
75
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
76 76
 
77 77
 	} else {
78 78
 
79 79
 		// Only send to PayPal if the pending payment is created successfully.
80
-		$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
80
+		$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
81 81
 
82 82
 		// Get the success url
83
-		$return_url = add_query_arg( array(
83
+		$return_url = add_query_arg(array(
84 84
 			'payment-confirmation' => 'paypal',
85 85
 			'payment-id'           => $payment
86 86
 
87
-		), get_permalink( give_get_option( 'success_page' ) ) );
87
+		), get_permalink(give_get_option('success_page')));
88 88
 
89 89
 		// Get the PayPal redirect uri
90
-		$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
90
+		$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
91 91
 
92 92
 		//Item name - pass level name if variable priced
93 93
 		$item_name = $purchase_data['post_data']['give-form-title'];
94 94
 
95 95
 		//Verify has variable prices
96
-		if ( give_has_variable_prices( $form_id ) && isset( $purchase_data['post_data']['give-price-id'] ) ) {
96
+		if (give_has_variable_prices($form_id) && isset($purchase_data['post_data']['give-price-id'])) {
97 97
 
98
-			$item_price_level_text = give_get_price_option_name( $form_id, $purchase_data['post_data']['give-price-id'] );
98
+			$item_price_level_text = give_get_price_option_name($form_id, $purchase_data['post_data']['give-price-id']);
99 99
 
100
-			$price_level_amount = give_get_price_option_amount( $form_id, $purchase_data['post_data']['give-price-id'] );
100
+			$price_level_amount = give_get_price_option_amount($form_id, $purchase_data['post_data']['give-price-id']);
101 101
 
102 102
 			//Donation given doesn't match selected level (must be a custom amount)
103
-			if ( $price_level_amount != give_sanitize_amount( $purchase_data['price'] ) ) {
104
-				$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
103
+			if ($price_level_amount != give_sanitize_amount($purchase_data['price'])) {
104
+				$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
105 105
 				//user custom amount text if any, fallback to default if not
106
-				$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
106
+				$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
107 107
 
108 108
 			} //Is there any donation level text?
109
-			elseif ( ! empty( $item_price_level_text ) ) {
110
-				$item_name .= ' - ' . $item_price_level_text;
109
+			elseif ( ! empty($item_price_level_text)) {
110
+				$item_name .= ' - '.$item_price_level_text;
111 111
 			}
112 112
 
113 113
 		} //Single donation: Custom Amount
114
-		elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $purchase_data['price'] ) ) {
115
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
114
+		elseif (give_get_form_price($form_id) !== give_sanitize_amount($purchase_data['price'])) {
115
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
116 116
 			//user custom amount text if any, fallback to default if not
117
-			$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
117
+			$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
118 118
 		}
119 119
 
120 120
 		// Setup PayPal arguments
121 121
 		$paypal_args = array(
122
-			'business'      => give_get_option( 'paypal_email', false ),
122
+			'business'      => give_get_option('paypal_email', false),
123 123
 			'email'         => $purchase_data['user_email'],
124 124
 			'invoice'       => $purchase_data['purchase_key'],
125 125
 			'amount'        => $purchase_data['price'],
@@ -130,25 +130,25 @@  discard block
 block discarded – undo
130 130
 			'shipping'      => '0',
131 131
 			'no_note'       => '1',
132 132
 			'currency_code' => give_get_currency(),
133
-			'charset'       => get_bloginfo( 'charset' ),
133
+			'charset'       => get_bloginfo('charset'),
134 134
 			'custom'        => $payment,
135 135
 			'rm'            => '2',
136 136
 			'return'        => $return_url,
137
-			'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment ),
137
+			'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment),
138 138
 			'notify_url'    => $listener_url,
139 139
 			'page_style'    => give_get_paypal_page_style(),
140
-			'cbt'           => get_bloginfo( 'name' ),
140
+			'cbt'           => get_bloginfo('name'),
141 141
 			'bn'            => 'givewp_SP'
142 142
 		);
143 143
 
144
-		if ( ! empty( $purchase_data['user_info']['address'] ) ) {
144
+		if ( ! empty($purchase_data['user_info']['address'])) {
145 145
 			$paypal_args['address1'] = $purchase_data['user_info']['address']['line1'];
146 146
 			$paypal_args['address2'] = $purchase_data['user_info']['address']['line2'];
147 147
 			$paypal_args['city']     = $purchase_data['user_info']['address']['city'];
148 148
 			$paypal_args['country']  = $purchase_data['user_info']['address']['country'];
149 149
 		}
150 150
 
151
-		if ( give_get_option( 'paypal_button_type' ) === 'standard' ) {
151
+		if (give_get_option('paypal_button_type') === 'standard') {
152 152
 			$paypal_extra_args = array(
153 153
 				'cmd' => '_xclick',
154 154
 			);
@@ -158,23 +158,23 @@  discard block
 block discarded – undo
158 158
 			);
159 159
 		}
160 160
 
161
-		$paypal_args = array_merge( $paypal_extra_args, $paypal_args );
162
-		$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $purchase_data );
161
+		$paypal_args = array_merge($paypal_extra_args, $paypal_args);
162
+		$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $purchase_data);
163 163
 
164 164
 		// Build query
165
-		$paypal_redirect .= http_build_query( $paypal_args );
165
+		$paypal_redirect .= http_build_query($paypal_args);
166 166
 
167 167
 		// Fix for some sites that encode the entities
168
-		$paypal_redirect = str_replace( '&amp;', '&', $paypal_redirect );
168
+		$paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
169 169
 
170 170
 		// Redirect to PayPal
171
-		wp_redirect( $paypal_redirect );
171
+		wp_redirect($paypal_redirect);
172 172
 		exit;
173 173
 	}
174 174
 
175 175
 }
176 176
 
177
-add_action( 'give_gateway_paypal', 'give_process_paypal_purchase' );
177
+add_action('give_gateway_paypal', 'give_process_paypal_purchase');
178 178
 
179 179
 /**
180 180
  * Listens for a PayPal IPN requests and then sends to the processing function
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
  */
185 185
 function give_listen_for_paypal_ipn() {
186 186
 	// Regular PayPal IPN
187
-	if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) {
188
-		do_action( 'give_verify_paypal_ipn' );
187
+	if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') {
188
+		do_action('give_verify_paypal_ipn');
189 189
 	}
190 190
 }
191 191
 
192
-add_action( 'init', 'give_listen_for_paypal_ipn' );
192
+add_action('init', 'give_listen_for_paypal_ipn');
193 193
 
194 194
 /**
195 195
  * Process PayPal IPN
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 function give_process_paypal_ipn() {
201 201
 
202 202
 	// Check the request method is POST
203
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) {
203
+	if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') {
204 204
 		return;
205 205
 	}
206 206
 
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 	$post_data = '';
209 209
 
210 210
 	// Fallback just in case post_max_size is lower than needed
211
-	if ( ini_get( 'allow_url_fopen' ) ) {
212
-		$post_data = file_get_contents( 'php://input' );
211
+	if (ini_get('allow_url_fopen')) {
212
+		$post_data = file_get_contents('php://input');
213 213
 	} else {
214 214
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough
215
-		ini_set( 'post_max_size', '12M' );
215
+		ini_set('post_max_size', '12M');
216 216
 	}
217 217
 	// Start the encoded data collection with notification command
218 218
 	$encoded_data = 'cmd=_notify-validate';
@@ -221,40 +221,40 @@  discard block
 block discarded – undo
221 221
 	$arg_separator = give_get_php_arg_separator_output();
222 222
 
223 223
 	// Verify there is a post_data
224
-	if ( $post_data || strlen( $post_data ) > 0 ) {
224
+	if ($post_data || strlen($post_data) > 0) {
225 225
 		// Append the data
226
-		$encoded_data .= $arg_separator . $post_data;
226
+		$encoded_data .= $arg_separator.$post_data;
227 227
 	} else {
228 228
 		// Check if POST is empty
229
-		if ( empty( $_POST ) ) {
229
+		if (empty($_POST)) {
230 230
 			// Nothing to do
231 231
 			return;
232 232
 		} else {
233 233
 			// Loop through each POST
234
-			foreach ( $_POST as $key => $value ) {
234
+			foreach ($_POST as $key => $value) {
235 235
 				// Encode the value and append the data
236
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
236
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
237 237
 			}
238 238
 		}
239 239
 	}
240 240
 
241 241
 	// Convert collected post data to an array
242
-	parse_str( $encoded_data, $encoded_data_array );
242
+	parse_str($encoded_data, $encoded_data_array);
243 243
 
244
-	foreach ( $encoded_data_array as $key => $value ) {
244
+	foreach ($encoded_data_array as $key => $value) {
245 245
 
246
-		if ( false !== strpos( $key, 'amp;' ) ) {
247
-			$new_key = str_replace( '&amp;', '&', $key );
248
-			$new_key = str_replace( 'amp;', '&', $new_key );
246
+		if (false !== strpos($key, 'amp;')) {
247
+			$new_key = str_replace('&amp;', '&', $key);
248
+			$new_key = str_replace('amp;', '&', $new_key);
249 249
 
250
-			unset( $encoded_data_array[ $key ] );
251
-			$encoded_data_array[ $new_key ] = $value;
250
+			unset($encoded_data_array[$key]);
251
+			$encoded_data_array[$new_key] = $value;
252 252
 		}
253 253
 
254 254
 	}
255 255
 
256 256
 	//Validate IPN request w/ PayPal if user hasn't disabled this security measure
257
-	if ( ! give_get_option( 'disable_paypal_verification' ) ) {
257
+	if ( ! give_get_option('disable_paypal_verification')) {
258 258
 
259 259
 		$remote_post_vars = array(
260 260
 			'method'      => 'POST',
@@ -274,28 +274,28 @@  discard block
 block discarded – undo
274 274
 		);
275 275
 
276 276
 		// Validate the IPN
277
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
277
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
278 278
 
279
-		if ( is_wp_error( $api_response ) ) {
279
+		if (is_wp_error($api_response)) {
280 280
 			give_record_gateway_error(
281
-				esc_html__( 'IPN Error', 'give' ),
281
+				esc_html__('IPN Error', 'give'),
282 282
 				sprintf(
283 283
 				/* translators: %s: Paypal IPN response */
284
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
285
-					json_encode( $api_response )
284
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
285
+					json_encode($api_response)
286 286
 				)
287 287
 			);
288 288
 
289 289
 			return; // Something went wrong
290 290
 		}
291 291
 
292
-		if ( $api_response['body'] !== 'VERIFIED' && give_get_option( 'disable_paypal_verification', false ) ) {
292
+		if ($api_response['body'] !== 'VERIFIED' && give_get_option('disable_paypal_verification', false)) {
293 293
 			give_record_gateway_error(
294
-				esc_html__( 'IPN Error', 'give' ),
294
+				esc_html__('IPN Error', 'give'),
295 295
 				sprintf(
296 296
 				/* translators: %s: Paypal IPN response */
297
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
298
-					json_encode( $api_response )
297
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
298
+					json_encode($api_response)
299 299
 				)
300 300
 			);
301 301
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	}
306 306
 
307 307
 	// Check if $post_data_array has been populated
308
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
308
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
309 309
 		return;
310 310
 	}
311 311
 
@@ -314,21 +314,21 @@  discard block
 block discarded – undo
314 314
 		'payment_status' => ''
315 315
 	);
316 316
 
317
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
317
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
318 318
 
319
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
319
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
320 320
 
321
-	if ( has_action( 'give_paypal_' . $encoded_data_array['txn_type'] ) ) {
321
+	if (has_action('give_paypal_'.$encoded_data_array['txn_type'])) {
322 322
 		// Allow PayPal IPN types to be processed separately
323
-		do_action( 'give_paypal_' . $encoded_data_array['txn_type'], $encoded_data_array, $payment_id );
323
+		do_action('give_paypal_'.$encoded_data_array['txn_type'], $encoded_data_array, $payment_id);
324 324
 	} else {
325 325
 		// Fallback to web accept just in case the txn_type isn't present
326
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
326
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
327 327
 	}
328 328
 	exit;
329 329
 }
330 330
 
331
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
331
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
332 332
 
333 333
 /**
334 334
  * Process web accept (one time) payment IPNs
@@ -339,224 +339,224 @@  discard block
 block discarded – undo
339 339
  *
340 340
  * @return void
341 341
  */
342
-function give_process_paypal_web_accept_and_cart( $data, $payment_id ) {
342
+function give_process_paypal_web_accept_and_cart($data, $payment_id) {
343 343
 
344
-	if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded' ) {
344
+	if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') {
345 345
 		return;
346 346
 	}
347 347
 
348
-	if ( empty( $payment_id ) ) {
348
+	if (empty($payment_id)) {
349 349
 		return;
350 350
 	}
351 351
 
352 352
 	// Collect payment details
353
-	$purchase_key   = isset( $data['invoice'] ) ? $data['invoice'] : $data['item_number'];
353
+	$purchase_key   = isset($data['invoice']) ? $data['invoice'] : $data['item_number'];
354 354
 	$paypal_amount  = $data['mc_gross'];
355
-	$payment_status = strtolower( $data['payment_status'] );
356
-	$currency_code  = strtolower( $data['mc_currency'] );
357
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
358
-	$payment_meta   = give_get_payment_meta( $payment_id );
355
+	$payment_status = strtolower($data['payment_status']);
356
+	$currency_code  = strtolower($data['mc_currency']);
357
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
358
+	$payment_meta   = give_get_payment_meta($payment_id);
359 359
 
360 360
 
361
-	if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) {
361
+	if (give_get_payment_gateway($payment_id) != 'paypal') {
362 362
 		return; // this isn't a PayPal standard IPN
363 363
 	}
364 364
 
365 365
 	// Verify payment recipient
366
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) {
366
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) {
367 367
 
368 368
 		give_record_gateway_error(
369
-			esc_html__( 'IPN Error', 'give' ),
369
+			esc_html__('IPN Error', 'give'),
370 370
 			sprintf(
371 371
 			/* translators: %s: Paypal IPN response */
372
-				esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ),
373
-				json_encode( $data )
372
+				esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'),
373
+				json_encode($data)
374 374
 			),
375 375
 			$payment_id
376 376
 		);
377
-		give_update_payment_status( $payment_id, 'failed' );
378
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) );
377
+		give_update_payment_status($payment_id, 'failed');
378
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give'));
379 379
 
380 380
 		return;
381 381
 	}
382 382
 
383 383
 	// Verify payment currency
384
-	if ( $currency_code != strtolower( $payment_meta['currency'] ) ) {
384
+	if ($currency_code != strtolower($payment_meta['currency'])) {
385 385
 
386 386
 		give_record_gateway_error(
387
-			esc_html__( 'IPN Error', 'give' ),
387
+			esc_html__('IPN Error', 'give'),
388 388
 			sprintf(
389 389
 			/* translators: %s: Paypal IPN response */
390
-				esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ),
391
-				json_encode( $data )
390
+				esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'),
391
+				json_encode($data)
392 392
 			),
393 393
 			$payment_id
394 394
 		);
395
-		give_update_payment_status( $payment_id, 'failed' );
396
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
395
+		give_update_payment_status($payment_id, 'failed');
396
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give'));
397 397
 
398 398
 		return;
399 399
 	}
400 400
 
401
-	if ( ! give_get_payment_user_email( $payment_id ) ) {
401
+	if ( ! give_get_payment_user_email($payment_id)) {
402 402
 
403 403
 		// No email associated with purchase, so store from PayPal
404
-		give_update_payment_meta( $payment_id, '_give_payment_user_email', $data['payer_email'] );
404
+		give_update_payment_meta($payment_id, '_give_payment_user_email', $data['payer_email']);
405 405
 
406 406
 		// Setup and store the donors's details
407 407
 		$address            = array();
408
-		$address['line1']   = ! empty( $data['address_street'] ) ? sanitize_text_field( $data['address_street'] ) : false;
409
-		$address['city']    = ! empty( $data['address_city'] ) ? sanitize_text_field( $data['address_city'] ) : false;
410
-		$address['state']   = ! empty( $data['address_state'] ) ? sanitize_text_field( $data['address_state'] ) : false;
411
-		$address['country'] = ! empty( $data['address_country_code'] ) ? sanitize_text_field( $data['address_country_code'] ) : false;
412
-		$address['zip']     = ! empty( $data['address_zip'] ) ? sanitize_text_field( $data['address_zip'] ) : false;
408
+		$address['line1']   = ! empty($data['address_street']) ? sanitize_text_field($data['address_street']) : false;
409
+		$address['city']    = ! empty($data['address_city']) ? sanitize_text_field($data['address_city']) : false;
410
+		$address['state']   = ! empty($data['address_state']) ? sanitize_text_field($data['address_state']) : false;
411
+		$address['country'] = ! empty($data['address_country_code']) ? sanitize_text_field($data['address_country_code']) : false;
412
+		$address['zip']     = ! empty($data['address_zip']) ? sanitize_text_field($data['address_zip']) : false;
413 413
 
414 414
 		$user_info = array(
415 415
 			'id'         => '-1',
416
-			'email'      => sanitize_text_field( $data['payer_email'] ),
417
-			'first_name' => sanitize_text_field( $data['first_name'] ),
418
-			'last_name'  => sanitize_text_field( $data['last_name'] ),
416
+			'email'      => sanitize_text_field($data['payer_email']),
417
+			'first_name' => sanitize_text_field($data['first_name']),
418
+			'last_name'  => sanitize_text_field($data['last_name']),
419 419
 			'discount'   => '',
420 420
 			'address'    => $address
421 421
 		);
422 422
 
423 423
 		$payment_meta['user_info'] = $user_info;
424
-		give_update_payment_meta( $payment_id, '_give_payment_meta', $payment_meta );
424
+		give_update_payment_meta($payment_id, '_give_payment_meta', $payment_meta);
425 425
 	}
426 426
 
427
-	if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) {
427
+	if ($payment_status == 'refunded' || $payment_status == 'reversed') {
428 428
 
429 429
 		// Process a refund
430
-		give_process_paypal_refund( $data, $payment_id );
430
+		give_process_paypal_refund($data, $payment_id);
431 431
 
432 432
 	} else {
433 433
 
434
-		if ( get_post_status( $payment_id ) == 'publish' ) {
434
+		if (get_post_status($payment_id) == 'publish') {
435 435
 			return; // Only complete payments once
436 436
 		}
437 437
 
438 438
 		// Retrieve the total purchase amount (before PayPal)
439
-		$payment_amount = give_get_payment_amount( $payment_id );
439
+		$payment_amount = give_get_payment_amount($payment_id);
440 440
 
441
-		if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
441
+		if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
442 442
 			// The prices don't match
443 443
 			give_record_gateway_error(
444
-				esc_html__( 'IPN Error', 'give' ),
444
+				esc_html__('IPN Error', 'give'),
445 445
 				sprintf(
446 446
 				/* translators: %s: Paypal IPN response */
447
-					esc_html__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ),
448
-					json_encode( $data )
447
+					esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'),
448
+					json_encode($data)
449 449
 				),
450 450
 				$payment_id
451 451
 			);
452
-			give_update_payment_status( $payment_id, 'failed' );
453
-			give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
452
+			give_update_payment_status($payment_id, 'failed');
453
+			give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give'));
454 454
 
455 455
 			return;
456 456
 		}
457
-		if ( $purchase_key != give_get_payment_key( $payment_id ) ) {
457
+		if ($purchase_key != give_get_payment_key($payment_id)) {
458 458
 			// Purchase keys don't match
459 459
 			give_record_gateway_error(
460
-				esc_html__( 'IPN Error', 'give' ),
460
+				esc_html__('IPN Error', 'give'),
461 461
 				sprintf(
462 462
 				/* translators: %s: Paypal IPN response */
463
-					esc_html__( 'Invalid purchase key in IPN response. IPN data: %s', 'give' ),
464
-					json_encode( $data )
463
+					esc_html__('Invalid purchase key in IPN response. IPN data: %s', 'give'),
464
+					json_encode($data)
465 465
 				),
466 466
 				$payment_id
467 467
 			);
468
-			give_update_payment_status( $payment_id, 'failed' );
469
-			give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid purchase key in PayPal IPN.', 'give' ) );
468
+			give_update_payment_status($payment_id, 'failed');
469
+			give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid purchase key in PayPal IPN.', 'give'));
470 470
 
471 471
 			return;
472 472
 		}
473 473
 
474
-		if ( $payment_status == 'completed' || give_is_test_mode() ) {
474
+		if ($payment_status == 'completed' || give_is_test_mode()) {
475 475
 			give_insert_payment_note(
476 476
 				$payment_id,
477 477
 				sprintf(
478 478
 				/* translators: %s: Paypal transaction ID */
479
-					esc_html__( 'PayPal Transaction ID: %s', 'give' ),
479
+					esc_html__('PayPal Transaction ID: %s', 'give'),
480 480
 					$data['txn_id']
481 481
 				)
482 482
 			);
483
-			give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
484
-			give_update_payment_status( $payment_id, 'publish' );
485
-		} else if ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) {
483
+			give_set_payment_transaction_id($payment_id, $data['txn_id']);
484
+			give_update_payment_status($payment_id, 'publish');
485
+		} else if ('pending' == $payment_status && isset($data['pending_reason'])) {
486 486
 
487 487
 			// Look for possible pending reasons, such as an echeck
488 488
 
489 489
 			$note = '';
490 490
 
491
-			switch ( strtolower( $data['pending_reason'] ) ) {
491
+			switch (strtolower($data['pending_reason'])) {
492 492
 
493 493
 				case 'echeck' :
494 494
 
495
-					$note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
495
+					$note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
496 496
 
497 497
 					break;
498 498
 
499 499
 				case 'address' :
500 500
 
501
-					$note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
501
+					$note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
502 502
 
503 503
 					break;
504 504
 
505 505
 				case 'intl' :
506 506
 
507
-					$note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
507
+					$note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
508 508
 
509 509
 					break;
510 510
 
511 511
 				case 'multi-currency' :
512 512
 
513
-					$note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
513
+					$note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
514 514
 
515 515
 					break;
516 516
 
517 517
 				case 'paymentreview' :
518 518
 				case 'regulatory_review' :
519 519
 
520
-					$note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
520
+					$note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
521 521
 
522 522
 					break;
523 523
 
524 524
 				case 'unilateral' :
525 525
 
526
-					$note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
526
+					$note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give');
527 527
 
528 528
 					break;
529 529
 
530 530
 				case 'upgrade' :
531 531
 
532
-					$note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
532
+					$note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give');
533 533
 
534 534
 					break;
535 535
 
536 536
 				case 'verify' :
537 537
 
538
-					$note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this payment.', 'give' );
538
+					$note = esc_html__('PayPal account is not verified. Verify account in order to accept this payment.', 'give');
539 539
 
540 540
 					break;
541 541
 
542 542
 				case 'other' :
543 543
 
544
-					$note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
544
+					$note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
545 545
 
546 546
 					break;
547 547
 
548 548
 			}
549 549
 
550
-			if ( ! empty( $note ) ) {
550
+			if ( ! empty($note)) {
551 551
 
552
-				give_insert_payment_note( $payment_id, $note );
552
+				give_insert_payment_note($payment_id, $note);
553 553
 
554 554
 			}
555 555
 		}
556 556
 	}
557 557
 }
558 558
 
559
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 );
559
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2);
560 560
 
561 561
 /**
562 562
  * Process PayPal IPN Refunds
@@ -567,28 +567,28 @@  discard block
 block discarded – undo
567 567
  *
568 568
  * @return void
569 569
  */
570
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
570
+function give_process_paypal_refund($data, $payment_id = 0) {
571 571
 
572 572
 	// Collect payment details
573 573
 
574
-	if ( empty( $payment_id ) ) {
574
+	if (empty($payment_id)) {
575 575
 		return;
576 576
 	}
577 577
 
578
-	if ( get_post_status( $payment_id ) == 'refunded' ) {
578
+	if (get_post_status($payment_id) == 'refunded') {
579 579
 		return; // Only refund payments once
580 580
 	}
581 581
 
582
-	$payment_amount = give_get_payment_amount( $payment_id );
582
+	$payment_amount = give_get_payment_amount($payment_id);
583 583
 	$refund_amount  = $data['payment_gross'] * - 1;
584 584
 
585
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
585
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
586 586
 
587 587
 		give_insert_payment_note(
588 588
 			$payment_id,
589 589
 			sprintf(
590 590
 			/* translators: %s: Paypal parent transaction ID */
591
-				esc_html__( 'Partial PayPal refund processed: %s', 'give' ),
591
+				esc_html__('Partial PayPal refund processed: %s', 'give'),
592 592
 				$data['parent_txn_id']
593 593
 			)
594 594
 		);
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		$payment_id,
602 602
 		sprintf(
603 603
 		/* translators: %s: Paypal parent transaction ID */
604
-			esc_html__( 'PayPal Payment #%s Refunded for reason: %s', 'give' ),
604
+			esc_html__('PayPal Payment #%s Refunded for reason: %s', 'give'),
605 605
 			$data['parent_txn_id'], $data['reason_code']
606 606
 		)
607 607
 	);
@@ -609,11 +609,11 @@  discard block
 block discarded – undo
609 609
 		$payment_id,
610 610
 		sprintf(
611 611
 		/* translators: %s: Paypal transaction ID */
612
-			esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ),
612
+			esc_html__('PayPal Refund Transaction ID: %s', 'give'),
613 613
 			$data['txn_id']
614 614
 		)
615 615
 	);
616
-	give_update_payment_status( $payment_id, 'refunded' );
616
+	give_update_payment_status($payment_id, 'refunded');
617 617
 }
618 618
 
619 619
 /**
@@ -625,24 +625,24 @@  discard block
 block discarded – undo
625 625
  *
626 626
  * @return string
627 627
  */
628
-function give_get_paypal_redirect( $ssl_check = false ) {
628
+function give_get_paypal_redirect($ssl_check = false) {
629 629
 
630
-	if ( is_ssl() || ! $ssl_check ) {
630
+	if (is_ssl() || ! $ssl_check) {
631 631
 		$protocal = 'https://';
632 632
 	} else {
633 633
 		$protocal = 'http://';
634 634
 	}
635 635
 
636 636
 	// Check the current payment mode
637
-	if ( give_is_test_mode() ) {
637
+	if (give_is_test_mode()) {
638 638
 		// Test mode
639
-		$paypal_uri = $protocal . 'www.sandbox.paypal.com/cgi-bin/webscr';
639
+		$paypal_uri = $protocal.'www.sandbox.paypal.com/cgi-bin/webscr';
640 640
 	} else {
641 641
 		// Live mode
642
-		$paypal_uri = $protocal . 'www.paypal.com/cgi-bin/webscr';
642
+		$paypal_uri = $protocal.'www.paypal.com/cgi-bin/webscr';
643 643
 	}
644 644
 
645
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
645
+	return apply_filters('give_paypal_uri', $paypal_uri);
646 646
 }
647 647
 
648 648
 /**
@@ -652,9 +652,9 @@  discard block
 block discarded – undo
652 652
  * @return string
653 653
  */
654 654
 function give_get_paypal_page_style() {
655
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
655
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
656 656
 
657
-	return apply_filters( 'give_paypal_page_style', $page_style );
657
+	return apply_filters('give_paypal_page_style', $page_style);
658 658
 }
659 659
 
660 660
 /**
@@ -669,27 +669,27 @@  discard block
 block discarded – undo
669 669
  * @return string
670 670
  *
671 671
  */
672
-function give_paypal_success_page_content( $content ) {
672
+function give_paypal_success_page_content($content) {
673 673
 
674
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
674
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
675 675
 		return $content;
676 676
 	}
677 677
 
678
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
678
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
679 679
 
680
-	if ( ! $payment_id ) {
680
+	if ( ! $payment_id) {
681 681
 		$session    = give_get_purchase_session();
682
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
682
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
683 683
 	}
684 684
 
685
-	$payment = get_post( $payment_id );
685
+	$payment = get_post($payment_id);
686 686
 
687
-	if ( $payment && 'pending' == $payment->post_status ) {
687
+	if ($payment && 'pending' == $payment->post_status) {
688 688
 
689 689
 		// Payment is still pending so show processing indicator to fix the Race Condition
690 690
 		ob_start();
691 691
 
692
-		give_get_template_part( 'payment', 'processing' );
692
+		give_get_template_part('payment', 'processing');
693 693
 
694 694
 		$content = ob_get_clean();
695 695
 
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 
700 700
 }
701 701
 
702
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
702
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
703 703
 
704 704
 /**
705 705
  * Given a Payment ID, extract the transaction ID
@@ -710,22 +710,22 @@  discard block
 block discarded – undo
710 710
  *
711 711
  * @return string                   Transaction ID
712 712
  */
713
-function give_paypal_get_payment_transaction_id( $payment_id ) {
713
+function give_paypal_get_payment_transaction_id($payment_id) {
714 714
 
715 715
 	$transaction_id = '';
716
-	$notes          = give_get_payment_notes( $payment_id );
716
+	$notes          = give_get_payment_notes($payment_id);
717 717
 
718
-	foreach ( $notes as $note ) {
719
-		if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
718
+	foreach ($notes as $note) {
719
+		if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) {
720 720
 			$transaction_id = $match[1];
721 721
 			continue;
722 722
 		}
723 723
 	}
724 724
 
725
-	return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id );
725
+	return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id);
726 726
 }
727 727
 
728
-add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 );
728
+add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1);
729 729
 
730 730
 /**
731 731
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -737,13 +737,13 @@  discard block
 block discarded – undo
737 737
  *
738 738
  * @return string                 A link to the PayPal transaction details
739 739
  */
740
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
740
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
741 741
 
742 742
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
743
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
743
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
744 744
 
745
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
745
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
746 746
 
747 747
 }
748 748
 
749
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
749
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  */
41 41
 
42 42
 // Exit if accessed directly.
43
-if ( ! defined( 'ABSPATH' ) ) {
43
+if ( ! defined('ABSPATH')) {
44 44
 	exit;
45 45
 }
46 46
 
47
-if ( ! class_exists( 'Give' ) ) :
47
+if ( ! class_exists('Give')) :
48 48
 
49 49
 	/**
50 50
 	 * Main Give Class
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 		 * @return    Give
196 196
 		 */
197 197
 		public static function instance() {
198
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
198
+			if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
199 199
 				self::$instance = new Give;
200 200
 				self::$instance->setup_constants();
201 201
 
202
-				add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
202
+				add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
203 203
 
204 204
 				self::$instance->includes();
205 205
 				self::$instance->roles           = new Give_Roles();
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		 */
233 233
 		public function __clone() {
234 234
 			// Cloning instances of the class is forbidden
235
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
235
+			_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin&#8217; huh?', 'give'), '1.0');
236 236
 		}
237 237
 
238 238
 		/**
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		 */
246 246
 		public function __wakeup() {
247 247
 			// Unserializing instances of the class is forbidden.
248
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
248
+			_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin&#8217; huh?', 'give'), '1.0');
249 249
 		}
250 250
 
251 251
 		/**
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
 		private function setup_constants() {
260 260
 
261 261
 			// Plugin version
262
-			if ( ! defined( 'GIVE_VERSION' ) ) {
263
-				define( 'GIVE_VERSION', '1.6.1' );
262
+			if ( ! defined('GIVE_VERSION')) {
263
+				define('GIVE_VERSION', '1.6.1');
264 264
 			}
265 265
 
266 266
 			// Plugin Folder Path
267
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
268
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
267
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
268
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
269 269
 			}
270 270
 
271 271
 			// Plugin Folder URL
272
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
273
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
272
+			if ( ! defined('GIVE_PLUGIN_URL')) {
273
+				define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
274 274
 			}
275 275
 
276 276
 			// Plugin Basename aka: "give/give.php"
277
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
278
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
277
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
278
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
279 279
 			}
280 280
 
281 281
 			// Plugin Root File
282
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
283
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
282
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
283
+				define('GIVE_PLUGIN_FILE', __FILE__);
284 284
 			}
285 285
 
286 286
 			// Make sure CAL_GREGORIAN is defined
287
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
288
-				define( 'CAL_GREGORIAN', 1 );
287
+			if ( ! defined('CAL_GREGORIAN')) {
288
+				define('CAL_GREGORIAN', 1);
289 289
 			}
290 290
 		}
291 291
 
@@ -300,110 +300,110 @@  discard block
 block discarded – undo
300 300
 		private function includes() {
301 301
 			global $give_options;
302 302
 
303
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
303
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
304 304
 			$give_options = give_get_settings();
305 305
 
306
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
307
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
308
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
309
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
310
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
311
-
312
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
313
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
314
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
315
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
316
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php';
317
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php';
318
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php';
319
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
320
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
321
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
322
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
323
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
324
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
325
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
326
-
327
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
328
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
329
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
330
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
331
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
332
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
333
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
334
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
335
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
336
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
337
-			require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php';
338
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
339
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
340
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
341
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php';
342
-
343
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
344
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
345
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
346
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
347
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
348
-
349
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
350
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
351
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
352
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
353
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
354
-
355
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
356
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
357
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
358
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
359
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
360
-
361
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
362
-
363
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
364
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
365
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
366
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
367
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
368
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
369
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
370
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
371
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
372
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
373
-
374
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
375
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
376
-
377
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
378
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
379
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
380
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
381
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
382
-
383
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php';
384
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
385
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php';
386
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php';
387
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
388
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
389
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
390
-
391
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
392
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
393
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
394
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
395
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
396
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
397
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
398
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
399
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
400
-
401
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
402
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php';
306
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
307
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
308
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
309
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
310
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
311
+
312
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
313
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
314
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
315
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
316
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php';
317
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php';
318
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php';
319
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
320
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
321
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
322
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
323
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
324
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
325
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
326
+
327
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
328
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
329
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
330
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
331
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
332
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
333
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
334
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
335
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
336
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
337
+			require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php';
338
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
339
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
340
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
341
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php';
342
+
343
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
344
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
345
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
346
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
347
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
348
+
349
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
350
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
351
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
352
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
353
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
354
+
355
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
356
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
357
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
358
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
359
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
360
+
361
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
362
+
363
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
364
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
365
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
366
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php';
367
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
368
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
369
+				require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php';
370
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
371
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
372
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
373
+
374
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
375
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
376
+
377
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php';
378
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php';
379
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php';
380
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
381
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
382
+
383
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php';
384
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php';
385
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php';
386
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php';
387
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php';
388
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php';
389
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php';
390
+
391
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
392
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
393
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
394
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
395
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
396
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
397
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
398
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
399
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
400
+
401
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
402
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php';
403 403
 
404 404
 			}
405 405
 
406
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
406
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
407 407
 
408 408
 		}
409 409
 
@@ -417,26 +417,26 @@  discard block
 block discarded – undo
417 417
 		 */
418 418
 		public function load_textdomain() {
419 419
 			// Set filter for Give's languages directory
420
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
421
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
420
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
421
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
422 422
 
423 423
 			// Traditional WordPress plugin locale filter
424
-			$locale = apply_filters( 'plugin_locale', get_locale(), 'give' );
425
-			$mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale );
424
+			$locale = apply_filters('plugin_locale', get_locale(), 'give');
425
+			$mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
426 426
 
427 427
 			// Setup paths to current locale file
428
-			$mofile_local  = $give_lang_dir . $mofile;
429
-			$mofile_global = WP_LANG_DIR . '/give/' . $mofile;
428
+			$mofile_local  = $give_lang_dir.$mofile;
429
+			$mofile_global = WP_LANG_DIR.'/give/'.$mofile;
430 430
 
431
-			if ( file_exists( $mofile_global ) ) {
431
+			if (file_exists($mofile_global)) {
432 432
 				// Look in global /wp-content/languages/give folder
433
-				load_textdomain( 'give', $mofile_global );
434
-			} elseif ( file_exists( $mofile_local ) ) {
433
+				load_textdomain('give', $mofile_global);
434
+			} elseif (file_exists($mofile_local)) {
435 435
 				// Look in local location from filter `give_languages_directory`
436
-				load_textdomain( 'give', $mofile_local );
436
+				load_textdomain('give', $mofile_local);
437 437
 			} else {
438 438
 				// Load the default language files packaged up w/ Give
439
-				load_plugin_textdomain( 'give', false, $give_lang_dir );
439
+				load_plugin_textdomain('give', false, $give_lang_dir);
440 440
 			}
441 441
 		}
442 442
 
Please login to merge, or discard this patch.
includes/install.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
24 24
  * @global $wp_version
25 25
  * @return void
26 26
  */
27
-function give_install( $network_wide = false ) {
27
+function give_install($network_wide = false) {
28 28
 
29 29
 	global $wpdb;
30 30
 
31
-	if ( is_multisite() && $network_wide ) {
31
+	if (is_multisite() && $network_wide) {
32 32
 
33
-		foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) {
33
+		foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) {
34 34
 
35
-			switch_to_blog( $blog_id );
35
+			switch_to_blog($blog_id);
36 36
 			give_run_install();
37 37
 			restore_current_blog();
38 38
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 }
48 48
 
49
-register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
49
+register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
50 50
 
51 51
 /**
52 52
  * Run the Give Install process.
@@ -62,24 +62,24 @@  discard block
 block discarded – undo
62 62
 	give_setup_post_types();
63 63
 
64 64
 	// Clear the permalinks.
65
-	flush_rewrite_rules( false );
65
+	flush_rewrite_rules(false);
66 66
 
67 67
 	// Add Upgraded From Option.
68
-	$current_version = get_option( 'give_version' );
69
-	if ( $current_version ) {
70
-		update_option( 'give_version_upgraded_from', $current_version );
68
+	$current_version = get_option('give_version');
69
+	if ($current_version) {
70
+		update_option('give_version_upgraded_from', $current_version);
71 71
 	}
72 72
 
73 73
 	// Setup some default options.
74 74
 	$options = array();
75 75
 
76 76
 	// Checks if the Success Page option exists AND that the page exists.
77
-	if ( ! get_post( give_get_option( 'success_page' ) ) ) {
77
+	if ( ! get_post(give_get_option('success_page'))) {
78 78
 
79 79
 		// Donations Confirmation (Success) Page.
80 80
 		$success = wp_insert_post(
81 81
 			array(
82
-				'post_title'     => esc_html__( 'Donation Confirmation', 'give' ),
82
+				'post_title'     => esc_html__('Donation Confirmation', 'give'),
83 83
 				'post_content'   => '[give_receipt]',
84 84
 				'post_status'    => 'publish',
85 85
 				'post_author'    => 1,
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 
95 95
 	// Checks if the Failure Page option exists AND that the page exists.
96
-	if ( ! get_post( give_get_option( 'failure_page' ) ) ) {
96
+	if ( ! get_post(give_get_option('failure_page'))) {
97 97
 
98 98
 		// Failed Donation Page.
99 99
 		$failed = wp_insert_post(
100 100
 			array(
101
-				'post_title'     => esc_html__( 'Transaction Failed', 'give' ),
102
-				'post_content'   => esc_html__( 'We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give' ),
101
+				'post_title'     => esc_html__('Transaction Failed', 'give'),
102
+				'post_content'   => esc_html__('We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give'),
103 103
 				'post_status'    => 'publish',
104 104
 				'post_author'    => 1,
105 105
 				'post_type'      => 'page',
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 	}
112 112
 
113 113
 	// Checks if the History Page option exists AND that the page exists.
114
-	if ( ! get_post( give_get_option( 'history_page' ) ) ) {
114
+	if ( ! get_post(give_get_option('history_page'))) {
115 115
 		// Purchase History (History) Page.
116 116
 		$history = wp_insert_post(
117 117
 			array(
118
-				'post_title'     => esc_html__( 'Donation History', 'give' ),
118
+				'post_title'     => esc_html__('Donation History', 'give'),
119 119
 				'post_content'   => '[donation_history]',
120 120
 				'post_status'    => 'publish',
121 121
 				'post_author'    => 1,
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	}
129 129
 
130 130
 	//Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency.
131
-	if ( empty( $current_version ) ) {
131
+	if (empty($current_version)) {
132 132
 		$options['base_country']       = 'US';
133 133
 		$options['test_mode']          = 1;
134 134
 		$options['currency']           = 'USD';
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	}
153 153
 
154 154
 	// Populate the default values.
155
-	update_option( 'give_settings', array_merge( $give_options, $options ) );
156
-	update_option( 'give_version', GIVE_VERSION );
155
+	update_option('give_settings', array_merge($give_options, $options));
156
+	update_option('give_version', GIVE_VERSION);
157 157
 
158 158
 	// Create Give roles.
159 159
 	$roles = new Give_Roles();
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	$roles->add_caps();
162 162
 
163 163
 	$api = new Give_API();
164
-	update_option( 'give_default_api_version', 'v' . $api->get_version() );
164
+	update_option('give_default_api_version', 'v'.$api->get_version());
165 165
 
166 166
 	// Create the customers databases.
167 167
 	@Give()->customers->create_table();
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	Give()->session->use_php_sessions();
172 172
 
173 173
 	// Add a temporary option to note that Give pages have been created.
174
-	set_transient( '_give_installed', $options, 30 );
174
+	set_transient('_give_installed', $options, 30);
175 175
 
176
-	if ( ! $current_version ) {
176
+	if ( ! $current_version) {
177 177
 
178
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
178
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
179 179
 
180 180
 		// When new upgrade routines are added, mark them as complete on fresh install.
181 181
 		$upgrade_routines = array(
@@ -184,22 +184,22 @@  discard block
 block discarded – undo
184 184
 			'upgrade_give_offline_status'
185 185
 		);
186 186
 
187
-		foreach ( $upgrade_routines as $upgrade ) {
188
-			give_set_upgrade_complete( $upgrade );
187
+		foreach ($upgrade_routines as $upgrade) {
188
+			give_set_upgrade_complete($upgrade);
189 189
 		}
190 190
 	}
191 191
 
192 192
 	// Bail if activating from network, or bulk.
193
-	if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
193
+	if (is_network_admin() || isset($_GET['activate-multi'])) {
194 194
 		return;
195 195
 	}
196 196
 
197 197
 	// Add the transient to redirect.
198
-	set_transient( '_give_activation_redirect', true, 30 );
198
+	set_transient('_give_activation_redirect', true, 30);
199 199
 
200 200
 }
201 201
 
202
-register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
202
+register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
203 203
 
204 204
 /**
205 205
  * Network Activated New Site Setup.
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
  * @param  int    $site_id The Site ID.
216 216
  * @param  array  $meta Blog Meta.
217 217
  */
218
-function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
218
+function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
219 219
 
220
-	if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) {
220
+	if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) {
221 221
 
222
-		switch_to_blog( $blog_id );
222
+		switch_to_blog($blog_id);
223 223
 		give_install();
224 224
 		restore_current_blog();
225 225
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
 }
229 229
 
230
-add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 );
230
+add_action('wpmu_new_blog', 'on_create_blog', 10, 6);
231 231
 
232 232
 
233 233
 /**
@@ -240,13 +240,13 @@  discard block
 block discarded – undo
240 240
  *
241 241
  * @return array          The tables to drop.
242 242
  */
243
-function give_wpmu_drop_tables( $tables, $blog_id ) {
243
+function give_wpmu_drop_tables($tables, $blog_id) {
244 244
 
245
-	switch_to_blog( $blog_id );
245
+	switch_to_blog($blog_id);
246 246
 	$customers_db     = new Give_DB_Customers();
247 247
 	$customer_meta_db = new Give_DB_Customer_Meta();
248 248
 
249
-	if ( $customers_db->installed() ) {
249
+	if ($customers_db->installed()) {
250 250
 		$tables[] = $customers_db->table_name;
251 251
 		$tables[] = $customer_meta_db->table_name;
252 252
 	}
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
 }
258 258
 
259
-add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 );
259
+add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2);
260 260
 
261 261
 /**
262 262
  * Post-installation
@@ -268,16 +268,16 @@  discard block
 block discarded – undo
268 268
  */
269 269
 function give_after_install() {
270 270
 
271
-	if ( ! is_admin() ) {
271
+	if ( ! is_admin()) {
272 272
 		return;
273 273
 	}
274 274
 
275
-	$give_options     = get_transient( '_give_installed' );
276
-	$give_table_check = get_option( '_give_table_check', false );
275
+	$give_options     = get_transient('_give_installed');
276
+	$give_table_check = get_option('_give_table_check', false);
277 277
 
278
-	if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) {
278
+	if (false === $give_table_check || current_time('timestamp') > $give_table_check) {
279 279
 
280
-		if ( ! @Give()->customer_meta->installed() ) {
280
+		if ( ! @Give()->customer_meta->installed()) {
281 281
 
282 282
 			// Create the customer meta database
283 283
 			// (this ensures it creates it on multisite instances where it is network activated).
@@ -285,27 +285,27 @@  discard block
 block discarded – undo
285 285
 
286 286
 		}
287 287
 
288
-		if ( ! @Give()->customers->installed() ) {
288
+		if ( ! @Give()->customers->installed()) {
289 289
 			// Create the customers database
290 290
 			// (this ensures it creates it on multisite instances where it is network activated).
291 291
 			@Give()->customers->create_table();
292 292
 
293
-			do_action( 'give_after_install', $give_options );
293
+			do_action('give_after_install', $give_options);
294 294
 		}
295 295
 
296
-		update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) );
296
+		update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS));
297 297
 
298 298
 	}
299 299
 
300 300
 	// Delete the transient
301
-	if ( false !== $give_options ) {
302
-		delete_transient( '_give_installed' );
301
+	if (false !== $give_options) {
302
+		delete_transient('_give_installed');
303 303
 	}
304 304
 
305 305
 
306 306
 }
307 307
 
308
-add_action( 'admin_init', 'give_after_install' );
308
+add_action('admin_init', 'give_after_install');
309 309
 
310 310
 
311 311
 /**
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
 
321 321
 	global $wp_roles;
322 322
 
323
-	if ( ! is_object( $wp_roles ) ) {
323
+	if ( ! is_object($wp_roles)) {
324 324
 		return;
325 325
 	}
326 326
 
327
-	if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) {
327
+	if ( ! array_key_exists('give_manager', $wp_roles->roles)) {
328 328
 
329 329
 		// Create Give plugin roles
330 330
 		$roles = new Give_Roles();
@@ -335,4 +335,4 @@  discard block
 block discarded – undo
335 335
 
336 336
 }
337 337
 
338
-add_action( 'admin_init', 'give_install_roles_on_network' );
339 338
\ No newline at end of file
339
+add_action('admin_init', 'give_install_roles_on_network');
340 340
\ No newline at end of file
Please login to merge, or discard this patch.