Completed
Pull Request — master (#1749)
by Devin
06:21
created
includes/admin/customers/customer-actions.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
  * and redirect back to the donor interface for feedback
528 528
  *
529 529
  * @since  1.7
530
- * @return bool|null
530
+ * @return false|null
531 531
  */
532 532
 function give_remove_donor_email() {
533 533
 	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
  * and redirect back to the donor interface for feedback
569 569
  *
570 570
  * @since  1.7
571
- * @return bool|null
571
+ * @return false|null
572 572
  */
573 573
 function give_set_donor_primary_email() {
574 574
 	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 
50 50
 	$donor = new Give_Customer( $donor_id );
51 51
 
52
-    if ( empty( $donor->id ) ) {
52
+	if ( empty( $donor->id ) ) {
53 53
 		return false;
54 54
 	}
55 55
 
Please login to merge, or discard this patch.
Spacing   +195 added lines, -195 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
 
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array|bool $output Response messages
25 25
  */
26
-function give_edit_donor( $args ) {
26
+function give_edit_donor($args) {
27 27
 
28
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
28
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
29 29
 
30
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
31
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
30
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
31
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
32 32
 			'response' => 403,
33
-		) );
33
+		));
34 34
 	}
35 35
 
36
-	if ( empty( $args ) ) {
36
+	if (empty($args)) {
37 37
 		return false;
38 38
 	}
39 39
 
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 	$donor_id   = (int) $args['customerinfo']['id'];
42 42
 	$nonce      = $args['_wpnonce'];
43 43
 
44
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
45
-		wp_die( __( 'Cheatin’ uh?', 'give' ), __( 'Error', 'give' ), array(
44
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
45
+		wp_die(__('Cheatin’ uh?', 'give'), __('Error', 'give'), array(
46 46
 			'response' => 400,
47
-		) );
47
+		));
48 48
 	}
49 49
 
50
-	$donor = new Give_Customer( $donor_id );
50
+	$donor = new Give_Customer($donor_id);
51 51
 
52
-    if ( empty( $donor->id ) ) {
52
+    if (empty($donor->id)) {
53 53
 		return false;
54 54
 	}
55 55
 
@@ -58,70 +58,70 @@  discard block
 block discarded – undo
58 58
 		'user_id' => 0,
59 59
 	);
60 60
 
61
-	$donor_info = wp_parse_args( $donor_info, $defaults );
61
+	$donor_info = wp_parse_args($donor_info, $defaults);
62 62
 
63
-	if ( (int) $donor_info['user_id'] !== (int) $donor->user_id ) {
63
+	if ((int) $donor_info['user_id'] !== (int) $donor->user_id) {
64 64
 
65 65
 		// Make sure we don't already have this user attached to a donor.
66
-		if ( ! empty( $donor_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $donor_info['user_id'] ) ) {
67
-			give_set_error( 'give-invalid-customer-user_id', sprintf( __( 'The User ID #%d is already associated with a different donor.', 'give' ), $donor_info['user_id'] ) );
66
+		if ( ! empty($donor_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $donor_info['user_id'])) {
67
+			give_set_error('give-invalid-customer-user_id', sprintf(__('The User ID #%d is already associated with a different donor.', 'give'), $donor_info['user_id']));
68 68
 		}
69 69
 
70 70
 		// Make sure it's actually a user.
71
-		$user = get_user_by( 'id', $donor_info['user_id'] );
72
-		if ( ! empty( $donor_info['user_id'] ) && false === $user ) {
73
-			give_set_error( 'give-invalid-user_id', sprintf( __( 'The User ID #%d does not exist. Please assign an existing user.', 'give' ), $donor_info['user_id'] ) );
71
+		$user = get_user_by('id', $donor_info['user_id']);
72
+		if ( ! empty($donor_info['user_id']) && false === $user) {
73
+			give_set_error('give-invalid-user_id', sprintf(__('The User ID #%d does not exist. Please assign an existing user.', 'give'), $donor_info['user_id']));
74 74
 		}
75 75
 	}
76 76
 
77 77
 	// Record this for later.
78 78
 	$previous_user_id = $donor->user_id;
79 79
 
80
-	if ( give_get_errors() ) {
80
+	if (give_get_errors()) {
81 81
 		return false;
82 82
 	}
83 83
 
84 84
 	// Setup the donor address, if present.
85 85
 	$address = array();
86
-	if ( intval( $donor_info['user_id'] ) > 0 ) {
86
+	if (intval($donor_info['user_id']) > 0) {
87 87
 
88
-		$current_address = get_user_meta( $donor_info['user_id'], '_give_user_address', true );
88
+		$current_address = get_user_meta($donor_info['user_id'], '_give_user_address', true);
89 89
 
90
-		if ( false === $current_address ) {
91
-			$address['line1']   = isset( $donor_info['line1'] ) ? $donor_info['line1'] : '';
92
-			$address['line2']   = isset( $donor_info['line2'] ) ? $donor_info['line2'] : '';
93
-			$address['city']    = isset( $donor_info['city'] ) ? $donor_info['city'] : '';
94
-			$address['country'] = isset( $donor_info['country'] ) ? $donor_info['country'] : '';
95
-			$address['zip']     = isset( $donor_info['zip'] ) ? $donor_info['zip'] : '';
96
-			$address['state']   = isset( $donor_info['state'] ) ? $donor_info['state'] : '';
90
+		if (false === $current_address) {
91
+			$address['line1']   = isset($donor_info['line1']) ? $donor_info['line1'] : '';
92
+			$address['line2']   = isset($donor_info['line2']) ? $donor_info['line2'] : '';
93
+			$address['city']    = isset($donor_info['city']) ? $donor_info['city'] : '';
94
+			$address['country'] = isset($donor_info['country']) ? $donor_info['country'] : '';
95
+			$address['zip']     = isset($donor_info['zip']) ? $donor_info['zip'] : '';
96
+			$address['state']   = isset($donor_info['state']) ? $donor_info['state'] : '';
97 97
 		} else {
98
-			$current_address    = wp_parse_args( $current_address, array(
98
+			$current_address    = wp_parse_args($current_address, array(
99 99
 				'line1',
100 100
 				'line2',
101 101
 				'city',
102 102
 				'zip',
103 103
 				'state',
104 104
 				'country',
105
-			) );
106
-			$address['line1']   = isset( $donor_info['line1'] ) ? $donor_info['line1'] : $current_address['line1'];
107
-			$address['line2']   = isset( $donor_info['line2'] ) ? $donor_info['line2'] : $current_address['line2'];
108
-			$address['city']    = isset( $donor_info['city'] ) ? $donor_info['city'] : $current_address['city'];
109
-			$address['country'] = isset( $donor_info['country'] ) ? $donor_info['country'] : $current_address['country'];
110
-			$address['zip']     = isset( $donor_info['zip'] ) ? $donor_info['zip'] : $current_address['zip'];
111
-			$address['state']   = isset( $donor_info['state'] ) ? $donor_info['state'] : $current_address['state'];
105
+			));
106
+			$address['line1']   = isset($donor_info['line1']) ? $donor_info['line1'] : $current_address['line1'];
107
+			$address['line2']   = isset($donor_info['line2']) ? $donor_info['line2'] : $current_address['line2'];
108
+			$address['city']    = isset($donor_info['city']) ? $donor_info['city'] : $current_address['city'];
109
+			$address['country'] = isset($donor_info['country']) ? $donor_info['country'] : $current_address['country'];
110
+			$address['zip']     = isset($donor_info['zip']) ? $donor_info['zip'] : $current_address['zip'];
111
+			$address['state']   = isset($donor_info['state']) ? $donor_info['state'] : $current_address['state'];
112 112
 		}
113 113
 	}
114 114
 
115 115
 	// Sanitize the inputs
116 116
 	$donor_data            = array();
117
-	$donor_data['name']    = strip_tags( stripslashes( $donor_info['name'] ) );
117
+	$donor_data['name']    = strip_tags(stripslashes($donor_info['name']));
118 118
 	$donor_data['user_id'] = $donor_info['user_id'];
119 119
 
120
-	$donor_data = apply_filters( 'give_edit_donor_info', $donor_data, $donor_id );
121
-	$address    = apply_filters( 'give_edit_donor_address', $address, $donor_id );
120
+	$donor_data = apply_filters('give_edit_donor_info', $donor_data, $donor_id);
121
+	$address    = apply_filters('give_edit_donor_address', $address, $donor_id);
122 122
 
123
-	$donor_data = array_map( 'sanitize_text_field', $donor_data );
124
-	$address    = array_map( 'sanitize_text_field', $address );
123
+	$donor_data = array_map('sanitize_text_field', $donor_data);
124
+	$address    = array_map('sanitize_text_field', $address);
125 125
 
126 126
 	/**
127 127
 	 * Fires before editing a donor.
@@ -132,27 +132,27 @@  discard block
 block discarded – undo
132 132
 	 * @param array $donor_data The donor data.
133 133
 	 * @param array $address The donor's address.
134 134
 	 */
135
-	do_action( 'give_pre_edit_donor', $donor_id, $donor_data, $address );
135
+	do_action('give_pre_edit_donor', $donor_id, $donor_data, $address);
136 136
 
137 137
 	$output = array();
138 138
 
139
-	if ( $donor->update( $donor_data ) ) {
139
+	if ($donor->update($donor_data)) {
140 140
 
141
-		if ( ! empty( $donor->user_id ) && $donor->user_id > 0 ) {
142
-			update_user_meta( $donor->user_id, '_give_user_address', $address );
141
+		if ( ! empty($donor->user_id) && $donor->user_id > 0) {
142
+			update_user_meta($donor->user_id, '_give_user_address', $address);
143 143
 		}
144 144
 
145 145
 		// Update some donation meta if we need to.
146
-		$payments_array = explode( ',', $donor->payment_ids );
146
+		$payments_array = explode(',', $donor->payment_ids);
147 147
 
148
-		if ( $donor->user_id != $previous_user_id ) {
149
-			foreach ( $payments_array as $payment_id ) {
150
-				give_update_payment_meta( $payment_id, '_give_payment_user_id', $donor->user_id );
148
+		if ($donor->user_id != $previous_user_id) {
149
+			foreach ($payments_array as $payment_id) {
150
+				give_update_payment_meta($payment_id, '_give_payment_user_id', $donor->user_id);
151 151
 			}
152 152
 		}
153 153
 
154 154
 		$output['success']       = true;
155
-		$donor_data              = array_merge( $donor_data, $address );
155
+		$donor_data              = array_merge($donor_data, $address);
156 156
 		$output['customer_info'] = $donor_data;
157 157
 
158 158
 	} else {
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
 	 * @param int $donor_id The ID of the donor.
170 170
 	 * @param array $donor_data The donor data.
171 171
 	 */
172
-	do_action( 'give_post_edit_donor', $donor_id, $donor_data );
172
+	do_action('give_post_edit_donor', $donor_id, $donor_data);
173 173
 
174
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
175
-		header( 'Content-Type: application/json' );
176
-		echo json_encode( $output );
174
+	if (defined('DOING_AJAX') && DOING_AJAX) {
175
+		header('Content-Type: application/json');
176
+		echo json_encode($output);
177 177
 		wp_die();
178 178
 	}
179 179
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
 }
183 183
 
184
-add_action( 'give_edit-customer', 'give_edit_donor', 10, 1 );
184
+add_action('give_edit-customer', 'give_edit_donor', 10, 1);
185 185
 
186 186
 /**
187 187
  * Save a customer note being added
@@ -192,40 +192,40 @@  discard block
 block discarded – undo
192 192
  *
193 193
  * @return int         The Note ID that was saved, or 0 if nothing was saved
194 194
  */
195
-function give_customer_save_note( $args ) {
195
+function give_customer_save_note($args) {
196 196
 
197
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
197
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
198 198
 
199
-	if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) {
200
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array(
199
+	if ( ! is_admin() || ! current_user_can($customer_view_role)) {
200
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array(
201 201
 			'response' => 403,
202
-		) );
202
+		));
203 203
 	}
204 204
 
205
-	if ( empty( $args ) ) {
205
+	if (empty($args)) {
206 206
 		return;
207 207
 	}
208 208
 
209
-	$customer_note = trim( sanitize_text_field( $args['customer_note'] ) );
209
+	$customer_note = trim(sanitize_text_field($args['customer_note']));
210 210
 	$customer_id   = (int) $args['customer_id'];
211 211
 	$nonce         = $args['add_customer_note_nonce'];
212 212
 
213
-	if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) {
214
-		wp_die( esc_html__( 'Cheatin’ uh?', 'give' ), esc_html__( 'Error', 'give' ), array(
213
+	if ( ! wp_verify_nonce($nonce, 'add-customer-note')) {
214
+		wp_die(esc_html__('Cheatin’ uh?', 'give'), esc_html__('Error', 'give'), array(
215 215
 			'response' => 400,
216
-		) );
216
+		));
217 217
 	}
218 218
 
219
-	if ( empty( $customer_note ) ) {
220
-		give_set_error( 'empty-customer-note', esc_html__( 'A note is required.', 'give' ) );
219
+	if (empty($customer_note)) {
220
+		give_set_error('empty-customer-note', esc_html__('A note is required.', 'give'));
221 221
 	}
222 222
 
223
-	if ( give_get_errors() ) {
223
+	if (give_get_errors()) {
224 224
 		return;
225 225
 	}
226 226
 
227
-	$customer = new Give_Customer( $customer_id );
228
-	$new_note = $customer->add_note( $customer_note );
227
+	$customer = new Give_Customer($customer_id);
228
+	$new_note = $customer->add_note($customer_note);
229 229
 
230 230
 	/**
231 231
 	 * Fires before inserting customer note.
@@ -235,22 +235,22 @@  discard block
 block discarded – undo
235 235
 	 * @param int $customer_id The ID of the customer.
236 236
 	 * @param string $new_note Note content.
237 237
 	 */
238
-	do_action( 'give_pre_insert_customer_note', $customer_id, $new_note );
238
+	do_action('give_pre_insert_customer_note', $customer_id, $new_note);
239 239
 
240
-	if ( ! empty( $new_note ) && ! empty( $customer->id ) ) {
240
+	if ( ! empty($new_note) && ! empty($customer->id)) {
241 241
 
242 242
 		ob_start();
243 243
 		?>
244 244
 		<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
245 245
 			<span class="note-content-wrap">
246
-				<?php echo stripslashes( $new_note ); ?>
246
+				<?php echo stripslashes($new_note); ?>
247 247
 			</span>
248 248
 		</div>
249 249
 		<?php
250 250
 		$output = ob_get_contents();
251 251
 		ob_end_clean();
252 252
 
253
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
253
+		if (defined('DOING_AJAX') && DOING_AJAX) {
254 254
 			echo $output;
255 255
 			exit;
256 256
 		}
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
 }
265 265
 
266
-add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 );
266
+add_action('give_add-customer-note', 'give_customer_save_note', 10, 1);
267 267
 
268 268
 /**
269 269
  * Delete a customer
@@ -274,41 +274,41 @@  discard block
 block discarded – undo
274 274
  *
275 275
  * @return int Whether it was a successful deletion
276 276
  */
277
-function give_customer_delete( $args ) {
277
+function give_customer_delete($args) {
278 278
 
279
-	$customer_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
279
+	$customer_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
280 280
 
281
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
282
-		wp_die( esc_html__( 'You do not have permission to delete donors.', 'give' ), esc_html__( 'Error', 'give' ), array(
281
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
282
+		wp_die(esc_html__('You do not have permission to delete donors.', 'give'), esc_html__('Error', 'give'), array(
283 283
 			'response' => 403,
284
-		) );
284
+		));
285 285
 	}
286 286
 
287
-	if ( empty( $args ) ) {
287
+	if (empty($args)) {
288 288
 		return;
289 289
 	}
290 290
 
291 291
 	$customer_id = (int) $args['customer_id'];
292
-	$confirm     = ! empty( $args['give-customer-delete-confirm'] ) ? true : false;
293
-	$remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false;
292
+	$confirm     = ! empty($args['give-customer-delete-confirm']) ? true : false;
293
+	$remove_data = ! empty($args['give-customer-delete-records']) ? true : false;
294 294
 	$nonce       = $args['_wpnonce'];
295 295
 
296
-	if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) {
297
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array(
296
+	if ( ! wp_verify_nonce($nonce, 'delete-customer')) {
297
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array(
298 298
 			'response' => 400,
299
-		) );
299
+		));
300 300
 	}
301 301
 
302
-	if ( ! $confirm ) {
303
-		give_set_error( 'customer-delete-no-confirm', esc_html__( 'Please confirm you want to delete this donor.', 'give' ) );
302
+	if ( ! $confirm) {
303
+		give_set_error('customer-delete-no-confirm', esc_html__('Please confirm you want to delete this donor.', 'give'));
304 304
 	}
305 305
 
306
-	if ( give_get_errors() ) {
307
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) );
306
+	if (give_get_errors()) {
307
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id));
308 308
 		exit;
309 309
 	}
310 310
 
311
-	$customer = new Give_Customer( $customer_id );
311
+	$customer = new Give_Customer($customer_id);
312 312
 
313 313
 	/**
314 314
 	 * Fires before deleting customer.
@@ -319,50 +319,50 @@  discard block
 block discarded – undo
319 319
 	 * @param bool $confirm Delete confirmation.
320 320
 	 * @param bool $remove_data Records delete confirmation.
321 321
 	 */
322
-	do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data );
322
+	do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data);
323 323
 
324
-	if ( $customer->id > 0 ) {
324
+	if ($customer->id > 0) {
325 325
 
326
-		$payments_array = explode( ',', $customer->payment_ids );
327
-		$success        = Give()->customers->delete( $customer->id );
326
+		$payments_array = explode(',', $customer->payment_ids);
327
+		$success        = Give()->customers->delete($customer->id);
328 328
 
329
-		if ( $success ) {
329
+		if ($success) {
330 330
 
331
-			if ( $remove_data ) {
331
+			if ($remove_data) {
332 332
 
333 333
 				// Remove all donations, logs, etc
334
-				foreach ( $payments_array as $payment_id ) {
335
-					give_delete_purchase( $payment_id );
334
+				foreach ($payments_array as $payment_id) {
335
+					give_delete_purchase($payment_id);
336 336
 				}
337 337
 			} else {
338 338
 
339 339
 				// Just set the donations to customer_id of 0
340
-				foreach ( $payments_array as $payment_id ) {
341
-					give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 );
340
+				foreach ($payments_array as $payment_id) {
341
+					give_update_payment_meta($payment_id, '_give_payment_customer_id', 0);
342 342
 				}
343 343
 			}
344 344
 
345
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' );
345
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted');
346 346
 
347 347
 		} else {
348 348
 
349
-			give_set_error( 'give-donor-delete-failed', esc_html__( 'Error deleting donor.', 'give' ) );
350
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id );
349
+			give_set_error('give-donor-delete-failed', esc_html__('Error deleting donor.', 'give'));
350
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id);
351 351
 
352 352
 		}
353 353
 	} else {
354 354
 
355
-		give_set_error( 'give-customer-delete-invalid-id', esc_html__( 'Invalid Donor ID.', 'give' ) );
356
-		$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' );
355
+		give_set_error('give-customer-delete-invalid-id', esc_html__('Invalid Donor ID.', 'give'));
356
+		$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors');
357 357
 
358 358
 	}
359 359
 
360
-	wp_redirect( $redirect );
360
+	wp_redirect($redirect);
361 361
 	exit;
362 362
 
363 363
 }
364 364
 
365
-add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 );
365
+add_action('give_delete-customer', 'give_customer_delete', 10, 1);
366 366
 
367 367
 /**
368 368
  * Disconnect a user ID from a donor
@@ -373,32 +373,32 @@  discard block
 block discarded – undo
373 373
  *
374 374
  * @return bool|array        If the disconnect was successful.
375 375
  */
376
-function give_disconnect_donor_user_id( $args ) {
376
+function give_disconnect_donor_user_id($args) {
377 377
 
378
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
378
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
379 379
 
380
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
381
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
380
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
381
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
382 382
 			'response' => 403,
383
-		) );
383
+		));
384 384
 	}
385 385
 
386
-	if ( empty( $args ) ) {
386
+	if (empty($args)) {
387 387
 		return false;
388 388
 	}
389 389
 
390 390
 	$donor_id = (int) $args['customer_id'];
391 391
 
392
-	$nonce       = $args['_wpnonce'];
392
+	$nonce = $args['_wpnonce'];
393 393
 
394
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
395
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
394
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
395
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
396 396
 			'response' => 400,
397
-		) );
397
+		));
398 398
 	}
399 399
 
400
-	$donor = new Give_Customer( $donor_id );
401
-	if ( empty( $donor->id ) ) {
400
+	$donor = new Give_Customer($donor_id);
401
+	if (empty($donor->id)) {
402 402
 		return false;
403 403
 	}
404 404
 
@@ -412,18 +412,18 @@  discard block
 block discarded – undo
412 412
 	 * @param int $donor_id The ID of the donor.
413 413
 	 * @param int $user_id The ID of the user.
414 414
 	 */
415
-	do_action( 'give_pre_donor_disconnect_user_id', $donor_id, $user_id );
415
+	do_action('give_pre_donor_disconnect_user_id', $donor_id, $user_id);
416 416
 
417
-	$output        = array();
417
+	$output = array();
418 418
 	$donor_args = array(
419 419
 		'user_id' => 0,
420 420
 	);
421 421
 
422
-	if ( $donor->update( $donor_args ) ) {
422
+	if ($donor->update($donor_args)) {
423 423
 		global $wpdb;
424 424
 
425
-		if ( ! empty( $donor->payment_ids ) ) {
426
-			$wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $donor->payment_ids )" );
425
+		if ( ! empty($donor->payment_ids)) {
426
+			$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $donor->payment_ids )");
427 427
 		}
428 428
 
429 429
 		$output['success'] = true;
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	} else {
432 432
 
433 433
 		$output['success'] = false;
434
-		give_set_error( 'give-disconnect-user-fail', __( 'Failed to disconnect user from donor.', 'give' ) );
434
+		give_set_error('give-disconnect-user-fail', __('Failed to disconnect user from donor.', 'give'));
435 435
 	}
436 436
 
437 437
 	/**
@@ -441,11 +441,11 @@  discard block
 block discarded – undo
441 441
 	 *
442 442
 	 * @param int $donor_id The ID of the donor.
443 443
 	 */
444
-	do_action( 'give_post_donor_disconnect_user_id', $donor_id );
444
+	do_action('give_post_donor_disconnect_user_id', $donor_id);
445 445
 
446
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
447
-		header( 'Content-Type: application/json' );
448
-		echo json_encode( $output );
446
+	if (defined('DOING_AJAX') && DOING_AJAX) {
447
+		header('Content-Type: application/json');
448
+		echo json_encode($output);
449 449
 		wp_die();
450 450
 	}
451 451
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 
454 454
 }
455 455
 
456
-add_action( 'give_disconnect-userid', 'give_disconnect_donor_user_id', 10, 1 );
456
+add_action('give_disconnect-userid', 'give_disconnect_donor_user_id', 10, 1);
457 457
 
458 458
 /**
459 459
  * Add an email address to the donor from within the admin and log a donor note
@@ -464,82 +464,82 @@  discard block
 block discarded – undo
464 464
  *
465 465
  * @return mixed        If DOING_AJAX echos out JSON, otherwise returns array of success (bool) and message (string)
466 466
  */
467
-function give_add_donor_email( $args ) {
468
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
467
+function give_add_donor_email($args) {
468
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
469 469
 
470
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
471
-		wp_die( __( 'You do not have permission to edit this donor.', 'edit' ) );
470
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
471
+		wp_die(__('You do not have permission to edit this donor.', 'edit'));
472 472
 	}
473 473
 
474 474
 	$output = array();
475
-	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {
475
+	if (empty($args) || empty($args['email']) || empty($args['customer_id'])) {
476 476
 		$output['success'] = false;
477
-		if ( empty( $args['email'] ) ) {
478
-			$output['message'] = __( 'Email address is required.', 'give' );
479
-		} elseif ( empty( $args['customer_id'] ) ) {
480
-			$output['message'] = __( 'Donor ID is required.', 'give' );
477
+		if (empty($args['email'])) {
478
+			$output['message'] = __('Email address is required.', 'give');
479
+		} elseif (empty($args['customer_id'])) {
480
+			$output['message'] = __('Donor ID is required.', 'give');
481 481
 		} else {
482
-			$output['message'] = __( 'An error has occurred. Please try again.', 'give' );
482
+			$output['message'] = __('An error has occurred. Please try again.', 'give');
483 483
 		}
484
-	} elseif ( ! wp_verify_nonce( $args['_wpnonce'], 'give_add_donor_email' ) ) {
484
+	} elseif ( ! wp_verify_nonce($args['_wpnonce'], 'give_add_donor_email')) {
485 485
 		$output = array(
486 486
 			'success' => false,
487
-			'message' => esc_html__( 'Nonce verification failed.', 'give' ),
487
+			'message' => esc_html__('Nonce verification failed.', 'give'),
488 488
 		);
489
-	} elseif ( ! is_email( $args['email'] ) ) {
489
+	} elseif ( ! is_email($args['email'])) {
490 490
 		$output = array(
491 491
 			'success' => false,
492
-			'message' => esc_html__( 'Invalid email.', 'give' ),
492
+			'message' => esc_html__('Invalid email.', 'give'),
493 493
 		);
494 494
 	} else {
495
-		$email       = sanitize_email( $args['email'] );
495
+		$email       = sanitize_email($args['email']);
496 496
 		$customer_id = (int) $args['customer_id'];
497 497
 		$primary     = 'true' === $args['primary'] ? true : false;
498
-		$customer    = new Give_Customer( $customer_id );
499
-		if ( false === $customer->add_email( $email, $primary ) ) {
500
-			if ( in_array( $email, $customer->emails ) ) {
498
+		$customer    = new Give_Customer($customer_id);
499
+		if (false === $customer->add_email($email, $primary)) {
500
+			if (in_array($email, $customer->emails)) {
501 501
 				$output = array(
502 502
 					'success' => false,
503
-					'message' => __( 'Email already associated with this donor.', 'give' ),
503
+					'message' => __('Email already associated with this donor.', 'give'),
504 504
 				);
505 505
 			} else {
506 506
 				$output = array(
507 507
 					'success' => false,
508
-					'message' => __( 'Email address is already associated with another donor.', 'give' ),
508
+					'message' => __('Email address is already associated with another donor.', 'give'),
509 509
 				);
510 510
 			}
511 511
 		} else {
512
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id . '&give-message=email-added' );
512
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id.'&give-message=email-added');
513 513
 			$output   = array(
514 514
 				'success'  => true,
515
-				'message'  => __( 'Email successfully added to donor.', 'give' ),
515
+				'message'  => __('Email successfully added to donor.', 'give'),
516 516
 				'redirect' => $redirect,
517 517
 			);
518 518
 
519 519
 			$user          = wp_get_current_user();
520
-			$user_login    = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' );
521
-			$customer_note = sprintf( __( 'Email address %1$s added by %2$s', 'give' ), $email, $user_login );
522
-			$customer->add_note( $customer_note );
520
+			$user_login    = ! empty($user->user_login) ? $user->user_login : __('System', 'give');
521
+			$customer_note = sprintf(__('Email address %1$s added by %2$s', 'give'), $email, $user_login);
522
+			$customer->add_note($customer_note);
523 523
 
524
-			if ( $primary ) {
525
-				$customer_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $email, $user_login );
526
-				$customer->add_note( $customer_note );
524
+			if ($primary) {
525
+				$customer_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $email, $user_login);
526
+				$customer->add_note($customer_note);
527 527
 			}
528 528
 		}
529 529
 	}// End if().
530 530
 
531
-	do_action( 'give_post_add_customer_email', $customer_id, $args );
531
+	do_action('give_post_add_customer_email', $customer_id, $args);
532 532
 
533
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
534
-		header( 'Content-Type: application/json' );
535
-		echo json_encode( $output );
533
+	if (defined('DOING_AJAX') && DOING_AJAX) {
534
+		header('Content-Type: application/json');
535
+		echo json_encode($output);
536 536
 		wp_die();
537 537
 	}
538 538
 
539 539
 	return $output;
540 540
 }
541 541
 
542
-add_action( 'give_add_donor_email', 'give_add_donor_email', 10, 1 );
542
+add_action('give_add_donor_email', 'give_add_donor_email', 10, 1);
543 543
 
544 544
 
545 545
 /**
@@ -550,39 +550,39 @@  discard block
 block discarded – undo
550 550
  * @return bool|null
551 551
  */
552 552
 function give_remove_donor_email() {
553
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
553
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
554 554
 		return false;
555 555
 	}
556
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
556
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
557 557
 		return false;
558 558
 	}
559
-	if ( empty( $_GET['_wpnonce'] ) ) {
559
+	if (empty($_GET['_wpnonce'])) {
560 560
 		return false;
561 561
 	}
562 562
 
563 563
 	$nonce = $_GET['_wpnonce'];
564
-	if ( ! wp_verify_nonce( $nonce, 'give-remove-donor-email' ) ) {
565
-		wp_die( esc_html__( 'Nonce verification failed', 'give' ), esc_html__( 'Error', 'give' ), array(
564
+	if ( ! wp_verify_nonce($nonce, 'give-remove-donor-email')) {
565
+		wp_die(esc_html__('Nonce verification failed', 'give'), esc_html__('Error', 'give'), array(
566 566
 			'response' => 403,
567
-		) );
567
+		));
568 568
 	}
569 569
 
570
-	$customer = new Give_Customer( $_GET['id'] );
571
-	if ( $customer->remove_email( $_GET['email'] ) ) {
572
-		$url           = add_query_arg( 'give-message', 'email-removed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ) );
570
+	$customer = new Give_Customer($_GET['id']);
571
+	if ($customer->remove_email($_GET['email'])) {
572
+		$url           = add_query_arg('give-message', 'email-removed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id));
573 573
 		$user          = wp_get_current_user();
574
-		$user_login    = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
575
-		$customer_note = sprintf( __( 'Email address %1$s removed by %2$s', 'give' ), $_GET['email'], $user_login );
576
-		$customer->add_note( $customer_note );
574
+		$user_login    = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
575
+		$customer_note = sprintf(__('Email address %1$s removed by %2$s', 'give'), $_GET['email'], $user_login);
576
+		$customer->add_note($customer_note);
577 577
 	} else {
578
-		$url = add_query_arg( 'give-message', 'email-remove-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ) );
578
+		$url = add_query_arg('give-message', 'email-remove-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id));
579 579
 	}
580 580
 
581
-	wp_safe_redirect( $url );
581
+	wp_safe_redirect($url);
582 582
 	exit;
583 583
 }
584 584
 
585
-add_action( 'give_remove_donor_email', 'give_remove_donor_email', 10 );
585
+add_action('give_remove_donor_email', 'give_remove_donor_email', 10);
586 586
 
587 587
 
588 588
 /**
@@ -593,41 +593,41 @@  discard block
 block discarded – undo
593 593
  * @return bool|null
594 594
  */
595 595
 function give_set_donor_primary_email() {
596
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
596
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
597 597
 		return false;
598 598
 	}
599 599
 
600
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
600
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
601 601
 		return false;
602 602
 	}
603 603
 
604
-	if ( empty( $_GET['_wpnonce'] ) ) {
604
+	if (empty($_GET['_wpnonce'])) {
605 605
 		return false;
606 606
 	}
607 607
 
608 608
 	$nonce = $_GET['_wpnonce'];
609 609
 
610
-	if ( ! wp_verify_nonce( $nonce, 'give-set-donor-primary-email' ) ) {
611
-		wp_die( esc_html__( 'Nonce verification failed', 'give' ), esc_html__( 'Error', 'give' ), array(
610
+	if ( ! wp_verify_nonce($nonce, 'give-set-donor-primary-email')) {
611
+		wp_die(esc_html__('Nonce verification failed', 'give'), esc_html__('Error', 'give'), array(
612 612
 			'response' => 403,
613
-		) );
613
+		));
614 614
 	}
615 615
 
616
-	$donor = new Give_Customer( $_GET['id'] );
616
+	$donor = new Give_Customer($_GET['id']);
617 617
 
618
-	if ( $donor->set_primary_email( $_GET['email'] ) ) {
619
-		$url        = add_query_arg( 'give-message', 'primary-email-updated', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
618
+	if ($donor->set_primary_email($_GET['email'])) {
619
+		$url        = add_query_arg('give-message', 'primary-email-updated', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
620 620
 		$user       = wp_get_current_user();
621
-		$user_login = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
622
-		$donor_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $_GET['email'], $user_login );
621
+		$user_login = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
622
+		$donor_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $_GET['email'], $user_login);
623 623
 
624
-		$donor->add_note( $donor_note );
624
+		$donor->add_note($donor_note);
625 625
 	} else {
626
-		$url = add_query_arg( 'give-message', 'primary-email-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
626
+		$url = add_query_arg('give-message', 'primary-email-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
627 627
 	}
628 628
 
629
-	wp_safe_redirect( $url );
629
+	wp_safe_redirect($url);
630 630
 	exit;
631 631
 }
632 632
 
633
-add_action( 'give_set_donor_primary_email', 'give_set_donor_primary_email', 10 );
633
+add_action('give_set_donor_primary_email', 'give_set_donor_primary_email', 10);
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
  *
566 566
  * @since 1.6.3
567 567
  *
568
- * @param $pending_reason
568
+ * @param string $pending_reason
569 569
  *
570 570
  * @return string
571 571
  */
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
  * @param int   $payment_id   Payment ID
643 643
  * @param array $payment_data Array of payment data.
644 644
  *
645
- * @return mixed|string
645
+ * @return string
646 646
  */
647 647
 function give_build_paypal_url( $payment_id, $payment_data ) {
648 648
 	// Only send to PayPal if the pending payment is created successfully.
Please login to merge, or discard this patch.
Spacing   +168 added lines, -168 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
 
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @return bool
24 24
  */
25
-function give_paypal_standard_billing_fields( $form_id ) {
25
+function give_paypal_standard_billing_fields($form_id) {
26 26
 
27
-	if ( give_is_setting_enabled( give_get_option( 'paypal_standard_billing_details' ) ) ) {
28
-		give_default_cc_address_fields( $form_id );
27
+	if (give_is_setting_enabled(give_get_option('paypal_standard_billing_details'))) {
28
+		give_default_cc_address_fields($form_id);
29 29
 
30 30
 		return true;
31 31
 	}
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 }
36 36
 
37
-add_action( 'give_paypal_cc_form', 'give_paypal_standard_billing_fields');
37
+add_action('give_paypal_cc_form', 'give_paypal_standard_billing_fields');
38 38
 
39 39
 /**
40 40
  * Process PayPal Payment.
@@ -45,34 +45,34 @@  discard block
 block discarded – undo
45 45
  *
46 46
  * @return void
47 47
  */
48
-function give_process_paypal_payment( $payment_data ) {
48
+function give_process_paypal_payment($payment_data) {
49 49
 
50 50
 	// Validate nonce.
51
-	give_validate_nonce( $payment_data['gateway_nonce'], 'give-gateway' );
52
-	$payment_id = give_create_payment( $payment_data );
51
+	give_validate_nonce($payment_data['gateway_nonce'], 'give-gateway');
52
+	$payment_id = give_create_payment($payment_data);
53 53
 
54 54
 	// Check payment.
55
-	if ( empty( $payment_id ) ) {
55
+	if (empty($payment_id)) {
56 56
 		// Record the error.
57 57
 		give_record_gateway_error(
58
-			esc_html__( 'Payment Error', 'give' ),
58
+			esc_html__('Payment Error', 'give'),
59 59
 			sprintf(
60 60
 			/* translators: %s: payment data */
61
-				esc_html__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ),
62
-				json_encode( $payment_data )
61
+				esc_html__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'),
62
+				json_encode($payment_data)
63 63
 			),
64 64
 			$payment_id
65 65
 		);
66 66
 		// Problems? Send back.
67
-		give_send_back_to_checkout( '?payment-mode=' . $payment_data['post_data']['give-gateway'] );
67
+		give_send_back_to_checkout('?payment-mode='.$payment_data['post_data']['give-gateway']);
68 68
 	}
69 69
 
70 70
 	// Redirect to PayPal.
71
-	wp_redirect( give_build_paypal_url( $payment_id, $payment_data ) );
71
+	wp_redirect(give_build_paypal_url($payment_id, $payment_data));
72 72
 	exit;
73 73
 }
74 74
 
75
-add_action( 'give_gateway_paypal', 'give_process_paypal_payment' );
75
+add_action('give_gateway_paypal', 'give_process_paypal_payment');
76 76
 
77 77
 /**
78 78
  * Listens for a PayPal IPN requests and then sends to the processing function
@@ -82,17 +82,17 @@  discard block
 block discarded – undo
82 82
  */
83 83
 function give_listen_for_paypal_ipn() {
84 84
 	// Regular PayPal IPN
85
-	if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) {
85
+	if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') {
86 86
 		/**
87 87
 		 * Fires while verifying PayPal IPN
88 88
 		 *
89 89
 		 * @since 1.0
90 90
 		 */
91
-		do_action( 'give_verify_paypal_ipn' );
91
+		do_action('give_verify_paypal_ipn');
92 92
 	}
93 93
 }
94 94
 
95
-add_action( 'init', 'give_listen_for_paypal_ipn' );
95
+add_action('init', 'give_listen_for_paypal_ipn');
96 96
 
97 97
 /**
98 98
  * Process PayPal IPN
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 function give_process_paypal_ipn() {
104 104
 
105 105
 	// Check the request method is POST
106
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) {
106
+	if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') {
107 107
 		return;
108 108
 	}
109 109
 
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 	$post_data = '';
112 112
 
113 113
 	// Fallback just in case post_max_size is lower than needed
114
-	if ( ini_get( 'allow_url_fopen' ) ) {
115
-		$post_data = file_get_contents( 'php://input' );
114
+	if (ini_get('allow_url_fopen')) {
115
+		$post_data = file_get_contents('php://input');
116 116
 	} else {
117 117
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough
118
-		ini_set( 'post_max_size', '12M' );
118
+		ini_set('post_max_size', '12M');
119 119
 	}
120 120
 	// Start the encoded data collection with notification command
121 121
 	$encoded_data = 'cmd=_notify-validate';
@@ -124,39 +124,39 @@  discard block
 block discarded – undo
124 124
 	$arg_separator = give_get_php_arg_separator_output();
125 125
 
126 126
 	// Verify there is a post_data
127
-	if ( $post_data || strlen( $post_data ) > 0 ) {
127
+	if ($post_data || strlen($post_data) > 0) {
128 128
 		// Append the data
129
-		$encoded_data .= $arg_separator . $post_data;
129
+		$encoded_data .= $arg_separator.$post_data;
130 130
 	} else {
131 131
 		// Check if POST is empty
132
-		if ( empty( $_POST ) ) {
132
+		if (empty($_POST)) {
133 133
 			// Nothing to do
134 134
 			return;
135 135
 		} else {
136 136
 			// Loop through each POST
137
-			foreach ( $_POST as $key => $value ) {
137
+			foreach ($_POST as $key => $value) {
138 138
 				// Encode the value and append the data.
139
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
139
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
140 140
 			}
141 141
 		}
142 142
 	}
143 143
 
144 144
 	// Convert collected post data to an array.
145
-	parse_str( $encoded_data, $encoded_data_array );
145
+	parse_str($encoded_data, $encoded_data_array);
146 146
 
147
-	foreach ( $encoded_data_array as $key => $value ) {
147
+	foreach ($encoded_data_array as $key => $value) {
148 148
 
149
-		if ( false !== strpos( $key, 'amp;' ) ) {
150
-			$new_key = str_replace( '&amp;', '&', $key );
151
-			$new_key = str_replace( 'amp;', '&', $new_key );
149
+		if (false !== strpos($key, 'amp;')) {
150
+			$new_key = str_replace('&amp;', '&', $key);
151
+			$new_key = str_replace('amp;', '&', $new_key);
152 152
 
153
-			unset( $encoded_data_array[ $key ] );
154
-			$encoded_data_array[ $new_key ] = $value;
153
+			unset($encoded_data_array[$key]);
154
+			$encoded_data_array[$new_key] = $value;
155 155
 		}
156 156
 	}
157 157
 
158 158
 	// Validate IPN request w/ PayPal if user hasn't disabled this security measure
159
-	if ( give_is_setting_enabled( give_get_option( 'paypal_verification' ) ) ) {
159
+	if (give_is_setting_enabled(give_get_option('paypal_verification'))) {
160 160
 
161 161
 		$remote_post_vars = array(
162 162
 			'method'      => 'POST',
@@ -176,28 +176,28 @@  discard block
 block discarded – undo
176 176
 		);
177 177
 
178 178
 		// Validate the IPN.
179
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
179
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
180 180
 
181
-		if ( is_wp_error( $api_response ) ) {
181
+		if (is_wp_error($api_response)) {
182 182
 			give_record_gateway_error(
183
-				esc_html__( 'IPN Error', 'give' ),
183
+				esc_html__('IPN Error', 'give'),
184 184
 				sprintf(
185 185
 				/* translators: %s: Paypal IPN response */
186
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
187
-					json_encode( $api_response )
186
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
187
+					json_encode($api_response)
188 188
 				)
189 189
 			);
190 190
 
191 191
 			return; // Something went wrong
192 192
 		}
193 193
 
194
-		if ( $api_response['body'] !== 'VERIFIED' ) {
194
+		if ($api_response['body'] !== 'VERIFIED') {
195 195
 			give_record_gateway_error(
196
-				esc_html__( 'IPN Error', 'give' ),
196
+				esc_html__('IPN Error', 'give'),
197 197
 				sprintf(
198 198
 				/* translators: %s: Paypal IPN response */
199
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
200
-					json_encode( $api_response )
199
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
200
+					json_encode($api_response)
201 201
 				)
202 202
 			);
203 203
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	}
207 207
 
208 208
 	// Check if $post_data_array has been populated
209
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
209
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
210 210
 		return;
211 211
 	}
212 212
 
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 		'payment_status' => '',
216 216
 	);
217 217
 
218
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
218
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
219 219
 
220
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
220
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
221 221
 	$txn_type   = $encoded_data_array['txn_type'];
222 222
 
223
-	if ( has_action( 'give_paypal_' . $txn_type ) ) {
223
+	if (has_action('give_paypal_'.$txn_type)) {
224 224
 		/**
225 225
 		 * Fires while processing PayPal IPN $txn_type.
226 226
 		 *
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		 * @param array $encoded_data_array Encoded data.
232 232
 		 * @param int   $payment_id         Payment id.
233 233
 		 */
234
-		do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id );
234
+		do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id);
235 235
 	} else {
236 236
 		/**
237 237
 		 * Fires while process PayPal IPN.
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
 		 * @param array $encoded_data_array Encoded data.
244 244
 		 * @param int   $payment_id         Payment id.
245 245
 		 */
246
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
246
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
247 247
 	}
248 248
 	exit;
249 249
 }
250 250
 
251
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
251
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
252 252
 
253 253
 /**
254 254
  * Process web accept (one time) payment IPNs.
@@ -260,128 +260,128 @@  discard block
 block discarded – undo
260 260
  *
261 261
  * @return void
262 262
  */
263
-function give_process_paypal_web_accept_and_cart( $data, $payment_id ) {
263
+function give_process_paypal_web_accept_and_cart($data, $payment_id) {
264 264
 
265 265
 	// Only allow through these transaction types.
266
-	if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower( $data['payment_status'] ) != 'refunded' ) {
266
+	if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower($data['payment_status']) != 'refunded') {
267 267
 		return;
268 268
 	}
269 269
 
270 270
 	// Need $payment_id to continue.
271
-	if ( empty( $payment_id ) ) {
271
+	if (empty($payment_id)) {
272 272
 		return;
273 273
 	}
274 274
 
275 275
 	// Collect donation payment details.
276 276
 	$paypal_amount  = $data['mc_gross'];
277
-	$payment_status = strtolower( $data['payment_status'] );
278
-	$currency_code  = strtolower( $data['mc_currency'] );
279
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
280
-	$payment_meta   = give_get_payment_meta( $payment_id );
277
+	$payment_status = strtolower($data['payment_status']);
278
+	$currency_code  = strtolower($data['mc_currency']);
279
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
280
+	$payment_meta   = give_get_payment_meta($payment_id);
281 281
 
282 282
 	// Must be a PayPal standard IPN.
283
-	if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) {
283
+	if (give_get_payment_gateway($payment_id) != 'paypal') {
284 284
 		return;
285 285
 	}
286 286
 
287 287
 	// Verify payment recipient
288
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) {
288
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) {
289 289
 
290 290
 		give_record_gateway_error(
291
-			esc_html__( 'IPN Error', 'give' ),
291
+			esc_html__('IPN Error', 'give'),
292 292
 			sprintf(
293 293
 			/* translators: %s: Paypal IPN response */
294
-				esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ),
295
-				json_encode( $data )
294
+				esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'),
295
+				json_encode($data)
296 296
 			),
297 297
 			$payment_id
298 298
 		);
299
-		give_update_payment_status( $payment_id, 'failed' );
300
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) );
299
+		give_update_payment_status($payment_id, 'failed');
300
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give'));
301 301
 
302 302
 		return;
303 303
 	}
304 304
 
305 305
 	// Verify payment currency.
306
-	if ( $currency_code != strtolower( $payment_meta['currency'] ) ) {
306
+	if ($currency_code != strtolower($payment_meta['currency'])) {
307 307
 
308 308
 		give_record_gateway_error(
309
-			esc_html__( 'IPN Error', 'give' ),
309
+			esc_html__('IPN Error', 'give'),
310 310
 			sprintf(
311 311
 			/* translators: %s: Paypal IPN response */
312
-				esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ),
313
-				json_encode( $data )
312
+				esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'),
313
+				json_encode($data)
314 314
 			),
315 315
 			$payment_id
316 316
 		);
317
-		give_update_payment_status( $payment_id, 'failed' );
318
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
317
+		give_update_payment_status($payment_id, 'failed');
318
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give'));
319 319
 
320 320
 		return;
321 321
 	}
322 322
 
323 323
 	// Process refunds & reversed.
324
-	if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) {
325
-		give_process_paypal_refund( $data, $payment_id );
324
+	if ($payment_status == 'refunded' || $payment_status == 'reversed') {
325
+		give_process_paypal_refund($data, $payment_id);
326 326
 
327 327
 		return;
328 328
 	}
329 329
 
330 330
 	// Only complete payments once.
331
-	if ( get_post_status( $payment_id ) == 'publish' ) {
331
+	if (get_post_status($payment_id) == 'publish') {
332 332
 		return;
333 333
 	}
334 334
 
335 335
 	// Retrieve the total donation amount (before PayPal).
336
-	$payment_amount = give_get_payment_amount( $payment_id );
336
+	$payment_amount = give_get_payment_amount($payment_id);
337 337
 
338 338
 	// Check that the donation PP and local db amounts match.
339
-	if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
339
+	if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
340 340
 		// The prices don't match
341 341
 		give_record_gateway_error(
342
-			esc_html__( 'IPN Error', 'give' ),
342
+			esc_html__('IPN Error', 'give'),
343 343
 			sprintf(
344 344
 			/* translators: %s: Paypal IPN response */
345
-				esc_html__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ),
346
-				json_encode( $data )
345
+				esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'),
346
+				json_encode($data)
347 347
 			),
348 348
 			$payment_id
349 349
 		);
350
-		give_update_payment_status( $payment_id, 'failed' );
351
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
350
+		give_update_payment_status($payment_id, 'failed');
351
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give'));
352 352
 
353 353
 		return;
354 354
 	}
355 355
 
356 356
 	// Process completed donations.
357
-	if ( $payment_status == 'completed' || give_is_test_mode() ) {
357
+	if ($payment_status == 'completed' || give_is_test_mode()) {
358 358
 
359 359
 		give_insert_payment_note(
360 360
 			$payment_id,
361 361
 			sprintf(
362 362
 			/* translators: %s: Paypal transaction ID */
363
-				esc_html__( 'PayPal Transaction ID: %s', 'give' ),
363
+				esc_html__('PayPal Transaction ID: %s', 'give'),
364 364
 				$data['txn_id']
365 365
 			)
366 366
 		);
367
-		give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
368
-		give_update_payment_status( $payment_id, 'publish' );
367
+		give_set_payment_transaction_id($payment_id, $data['txn_id']);
368
+		give_update_payment_status($payment_id, 'publish');
369 369
 
370
-	} elseif ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) {
370
+	} elseif ('pending' == $payment_status && isset($data['pending_reason'])) {
371 371
 
372 372
 		// Look for possible pending reasons, such as an echeck.
373
-		$note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) );
373
+		$note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason']));
374 374
 
375
-		if ( ! empty( $note ) ) {
375
+		if ( ! empty($note)) {
376 376
 
377
-			give_insert_payment_note( $payment_id, $note );
377
+			give_insert_payment_note($payment_id, $note);
378 378
 
379 379
 		}
380 380
 	}
381 381
 
382 382
 }
383 383
 
384
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 );
384
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2);
385 385
 
386 386
 /**
387 387
  * Process PayPal IPN Refunds
@@ -393,27 +393,27 @@  discard block
 block discarded – undo
393 393
  *
394 394
  * @return void
395 395
  */
396
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
396
+function give_process_paypal_refund($data, $payment_id = 0) {
397 397
 
398 398
 	// Collect payment details
399
-	if ( empty( $payment_id ) ) {
399
+	if (empty($payment_id)) {
400 400
 		return;
401 401
 	}
402 402
 
403
-	if ( get_post_status( $payment_id ) == 'refunded' ) {
403
+	if (get_post_status($payment_id) == 'refunded') {
404 404
 		return; // Only refund payments once
405 405
 	}
406 406
 
407
-	$payment_amount = give_get_payment_amount( $payment_id );
407
+	$payment_amount = give_get_payment_amount($payment_id);
408 408
 	$refund_amount  = $data['payment_gross'] * - 1;
409 409
 
410
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
410
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
411 411
 
412 412
 		give_insert_payment_note(
413 413
 			$payment_id,
414 414
 			sprintf(
415 415
 			/* translators: %s: Paypal parent transaction ID */
416
-				esc_html__( 'Partial PayPal refund processed: %s', 'give' ),
416
+				esc_html__('Partial PayPal refund processed: %s', 'give'),
417 417
 				$data['parent_txn_id']
418 418
 			)
419 419
 		);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 		$payment_id,
427 427
 		sprintf(
428 428
 		/* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
429
-			esc_html__( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ),
429
+			esc_html__('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'),
430 430
 			$data['parent_txn_id'],
431 431
 			$data['reason_code']
432 432
 		)
@@ -435,11 +435,11 @@  discard block
 block discarded – undo
435 435
 		$payment_id,
436 436
 		sprintf(
437 437
 		/* translators: %s: Paypal transaction ID */
438
-			esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ),
438
+			esc_html__('PayPal Refund Transaction ID: %s', 'give'),
439 439
 			$data['txn_id']
440 440
 		)
441 441
 	);
442
-	give_update_payment_status( $payment_id, 'refunded' );
442
+	give_update_payment_status($payment_id, 'refunded');
443 443
 }
444 444
 
445 445
 /**
@@ -451,24 +451,24 @@  discard block
 block discarded – undo
451 451
  *
452 452
  * @return string
453 453
  */
454
-function give_get_paypal_redirect( $ssl_check = false ) {
454
+function give_get_paypal_redirect($ssl_check = false) {
455 455
 
456
-	if ( is_ssl() || ! $ssl_check ) {
456
+	if (is_ssl() || ! $ssl_check) {
457 457
 		$protocol = 'https://';
458 458
 	} else {
459 459
 		$protocol = 'http://';
460 460
 	}
461 461
 
462 462
 	// Check the current payment mode
463
-	if ( give_is_test_mode() ) {
463
+	if (give_is_test_mode()) {
464 464
 		// Test mode
465
-		$paypal_uri = $protocol . 'www.sandbox.paypal.com/cgi-bin/webscr';
465
+		$paypal_uri = $protocol.'www.sandbox.paypal.com/cgi-bin/webscr';
466 466
 	} else {
467 467
 		// Live mode
468
-		$paypal_uri = $protocol . 'www.paypal.com/cgi-bin/webscr';
468
+		$paypal_uri = $protocol.'www.paypal.com/cgi-bin/webscr';
469 469
 	}
470 470
 
471
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
471
+	return apply_filters('give_paypal_uri', $paypal_uri);
472 472
 }
473 473
 
474 474
 /**
@@ -478,9 +478,9 @@  discard block
 block discarded – undo
478 478
  * @return string
479 479
  */
480 480
 function give_get_paypal_page_style() {
481
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
481
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
482 482
 
483
-	return apply_filters( 'give_paypal_page_style', $page_style );
483
+	return apply_filters('give_paypal_page_style', $page_style);
484 484
 }
485 485
 
486 486
 /**
@@ -494,26 +494,26 @@  discard block
 block discarded – undo
494 494
  *
495 495
  * @return string
496 496
  */
497
-function give_paypal_success_page_content( $content ) {
497
+function give_paypal_success_page_content($content) {
498 498
 
499
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
499
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
500 500
 		return $content;
501 501
 	}
502 502
 
503
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
503
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
504 504
 
505
-	if ( ! $payment_id ) {
505
+	if ( ! $payment_id) {
506 506
 		$session    = give_get_purchase_session();
507
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
507
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
508 508
 	}
509 509
 
510
-	$payment = get_post( $payment_id );
511
-	if ( $payment && 'pending' == $payment->post_status ) {
510
+	$payment = get_post($payment_id);
511
+	if ($payment && 'pending' == $payment->post_status) {
512 512
 
513 513
 		// Payment is still pending so show processing indicator to fix the race condition.
514 514
 		ob_start();
515 515
 
516
-		give_get_template_part( 'payment', 'processing' );
516
+		give_get_template_part('payment', 'processing');
517 517
 
518 518
 		$content = ob_get_clean();
519 519
 
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 
524 524
 }
525 525
 
526
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
526
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
527 527
 
528 528
 /**
529 529
  * Given a Payment ID, extract the transaction ID
@@ -534,22 +534,22 @@  discard block
 block discarded – undo
534 534
  *
535 535
  * @return string                   Transaction ID
536 536
  */
537
-function give_paypal_get_payment_transaction_id( $payment_id ) {
537
+function give_paypal_get_payment_transaction_id($payment_id) {
538 538
 
539 539
 	$transaction_id = '';
540
-	$notes          = give_get_payment_notes( $payment_id );
540
+	$notes          = give_get_payment_notes($payment_id);
541 541
 
542
-	foreach ( $notes as $note ) {
543
-		if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
542
+	foreach ($notes as $note) {
543
+		if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) {
544 544
 			$transaction_id = $match[1];
545 545
 			continue;
546 546
 		}
547 547
 	}
548 548
 
549
-	return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id );
549
+	return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id);
550 550
 }
551 551
 
552
-add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 );
552
+add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1);
553 553
 
554 554
 /**
555 555
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -561,16 +561,16 @@  discard block
 block discarded – undo
561 561
  *
562 562
  * @return string                 A link to the PayPal transaction details
563 563
  */
564
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
564
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
565 565
 
566 566
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
567
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
567
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
568 568
 
569
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
569
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
570 570
 
571 571
 }
572 572
 
573
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
573
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
574 574
 
575 575
 
576 576
 /**
@@ -582,64 +582,64 @@  discard block
 block discarded – undo
582 582
  *
583 583
  * @return string
584 584
  */
585
-function give_paypal_get_pending_donation_note( $pending_reason ) {
585
+function give_paypal_get_pending_donation_note($pending_reason) {
586 586
 
587 587
 	$note = '';
588 588
 
589
-	switch ( $pending_reason ) {
589
+	switch ($pending_reason) {
590 590
 
591 591
 		case 'echeck' :
592 592
 
593
-			$note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
593
+			$note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
594 594
 
595 595
 			break;
596 596
 
597 597
 		case 'address' :
598 598
 
599
-			$note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
599
+			$note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
600 600
 
601 601
 			break;
602 602
 
603 603
 		case 'intl' :
604 604
 
605
-			$note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
605
+			$note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
606 606
 
607 607
 			break;
608 608
 
609 609
 		case 'multi-currency' :
610 610
 
611
-			$note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
611
+			$note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
612 612
 
613 613
 			break;
614 614
 
615 615
 		case 'paymentreview' :
616 616
 		case 'regulatory_review' :
617 617
 
618
-			$note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
618
+			$note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
619 619
 
620 620
 			break;
621 621
 
622 622
 		case 'unilateral' :
623 623
 
624
-			$note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
624
+			$note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give');
625 625
 
626 626
 			break;
627 627
 
628 628
 		case 'upgrade' :
629 629
 
630
-			$note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
630
+			$note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give');
631 631
 
632 632
 			break;
633 633
 
634 634
 		case 'verify' :
635 635
 
636
-			$note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' );
636
+			$note = esc_html__('PayPal account is not verified. Verify account in order to accept this donation.', 'give');
637 637
 
638 638
 			break;
639 639
 
640 640
 		case 'other' :
641 641
 
642
-			$note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
642
+			$note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
643 643
 
644 644
 			break;
645 645
 
@@ -657,49 +657,49 @@  discard block
 block discarded – undo
657 657
  *
658 658
  * @return mixed|string
659 659
  */
660
-function give_build_paypal_url( $payment_id, $payment_data ) {
660
+function give_build_paypal_url($payment_id, $payment_data) {
661 661
 	// Only send to PayPal if the pending payment is created successfully.
662
-	$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
662
+	$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
663 663
 
664 664
 	// Get the success url.
665
-	$return_url = add_query_arg( array(
665
+	$return_url = add_query_arg(array(
666 666
 		'payment-confirmation' => 'paypal',
667 667
 		'payment-id'           => $payment_id,
668 668
 
669
-	), get_permalink( give_get_option( 'success_page' ) ) );
669
+	), get_permalink(give_get_option('success_page')));
670 670
 
671 671
 	// Get the PayPal redirect uri.
672
-	$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
672
+	$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
673 673
 
674 674
 	// Item name.
675
-	$item_name = give_build_paypal_item_title( $payment_data );
675
+	$item_name = give_build_paypal_item_title($payment_data);
676 676
 
677 677
 	// Setup PayPal API params.
678 678
 	$paypal_args = array(
679
-		'business'      => give_get_option( 'paypal_email', false ),
679
+		'business'      => give_get_option('paypal_email', false),
680 680
 		'first_name'    => $payment_data['user_info']['first_name'],
681 681
 		'last_name'     => $payment_data['user_info']['last_name'],
682 682
 		'email'         => $payment_data['user_email'],
683 683
 		'invoice'       => $payment_data['purchase_key'],
684 684
 		'amount'        => $payment_data['price'],
685
-		'item_name'     => stripslashes( $item_name ),
685
+		'item_name'     => stripslashes($item_name),
686 686
 		'no_shipping'   => '1',
687 687
 		'shipping'      => '0',
688 688
 		'no_note'       => '1',
689 689
 		'currency_code' => give_get_currency(),
690
-		'charset'       => get_bloginfo( 'charset' ),
690
+		'charset'       => get_bloginfo('charset'),
691 691
 		'custom'        => $payment_id,
692 692
 		'rm'            => '2',
693 693
 		'return'        => $return_url,
694
-		'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ),
694
+		'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id),
695 695
 		'notify_url'    => $listener_url,
696 696
 		'page_style'    => give_get_paypal_page_style(),
697
-		'cbt'           => get_bloginfo( 'name' ),
697
+		'cbt'           => get_bloginfo('name'),
698 698
 		'bn'            => 'givewp_SP',
699 699
 	);
700 700
 
701 701
 	// Add user address if present.
702
-	if ( ! empty( $payment_data['user_info']['address'] ) ) {
702
+	if ( ! empty($payment_data['user_info']['address'])) {
703 703
 		$default_address = array(
704 704
 			'line1'   => '',
705 705
 			'line2'   => '',
@@ -709,13 +709,13 @@  discard block
 block discarded – undo
709 709
 			'country' => '',
710 710
 		);
711 711
 
712
-		$address = wp_parse_args( $payment_data['user_info']['address'], $default_address );
712
+		$address = wp_parse_args($payment_data['user_info']['address'], $default_address);
713 713
 
714 714
 		$paypal_args['address1'] = $address['line1'];
715 715
 		$paypal_args['address2'] = $address['line2'];
716 716
 		$paypal_args['city']     = $address['city'];
717 717
 		$paypal_args['state']    = $address['state'];
718
-		$paypal_args['zip']    = $address['zip'];
718
+		$paypal_args['zip'] = $address['zip'];
719 719
 		$paypal_args['country']  = $address['country'];
720 720
 	}
721 721
 
@@ -730,13 +730,13 @@  discard block
 block discarded – undo
730 730
 	 * @param array $paypal_args
731 731
 	 * @param array $payment_data
732 732
 	 */
733
-	$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data );
733
+	$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data);
734 734
 
735 735
 	// Build query.
736
-	$paypal_redirect .= http_build_query( $paypal_args );
736
+	$paypal_redirect .= http_build_query($paypal_args);
737 737
 
738 738
 	// Fix for some sites that encode the entities.
739
-	$paypal_redirect = str_replace( '&amp;', '&', $paypal_redirect );
739
+	$paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
740 740
 
741 741
 	return $paypal_redirect;
742 742
 }
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
 function give_get_paypal_button_type() {
752 752
 	// paypal_button_type can be donation or standard.
753 753
 	$paypal_button_type = '_donations';
754
-	if ( give_get_option( 'paypal_button_type' ) === 'standard' ) {
754
+	if (give_get_option('paypal_button_type') === 'standard') {
755 755
 		$paypal_button_type = '_xclick';
756 756
 	}
757 757
 
@@ -768,32 +768,32 @@  discard block
 block discarded – undo
768 768
  *
769 769
  * @return string
770 770
  */
771
-function give_build_paypal_item_title( $payment_data ) {
772
-	$form_id   = intval( $payment_data['post_data']['give-form-id'] );
771
+function give_build_paypal_item_title($payment_data) {
772
+	$form_id   = intval($payment_data['post_data']['give-form-id']);
773 773
 	$item_name = $payment_data['post_data']['give-form-title'];
774 774
 
775 775
 	// Verify has variable prices.
776
-	if ( give_has_variable_prices( $form_id ) && isset( $payment_data['post_data']['give-price-id'] ) ) {
776
+	if (give_has_variable_prices($form_id) && isset($payment_data['post_data']['give-price-id'])) {
777 777
 
778
-		$item_price_level_text = give_get_price_option_name( $form_id, $payment_data['post_data']['give-price-id'] );
779
-		$price_level_amount    = give_get_price_option_amount( $form_id, $payment_data['post_data']['give-price-id'] );
778
+		$item_price_level_text = give_get_price_option_name($form_id, $payment_data['post_data']['give-price-id']);
779
+		$price_level_amount    = give_get_price_option_amount($form_id, $payment_data['post_data']['give-price-id']);
780 780
 
781 781
 		// Donation given doesn't match selected level (must be a custom amount).
782
-		if ( $price_level_amount != give_sanitize_amount( $payment_data['price'] ) ) {
783
-			$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
782
+		if ($price_level_amount != give_sanitize_amount($payment_data['price'])) {
783
+			$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
784 784
 			// user custom amount text if any, fallback to default if not.
785
-			$item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', esc_html__( 'Custom Amount', 'give' ) );
785
+			$item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', esc_html__('Custom Amount', 'give'));
786 786
 
787 787
 		} //Is there any donation level text?
788
-		elseif ( ! empty( $item_price_level_text ) ) {
789
-			$item_name .= ' - ' . $item_price_level_text;
788
+		elseif ( ! empty($item_price_level_text)) {
789
+			$item_name .= ' - '.$item_price_level_text;
790 790
 		}
791 791
 
792 792
 	} //Single donation: Custom Amount.
793
-	elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $payment_data['price'] ) ) {
794
-		$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
793
+	elseif (give_get_form_price($form_id) !== give_sanitize_amount($payment_data['price'])) {
794
+		$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
795 795
 		// user custom amount text if any, fallback to default if not.
796
-		$item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', esc_html__( 'Custom Amount', 'give' ) );
796
+		$item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', esc_html__('Custom Amount', 'give'));
797 797
 	}
798 798
 
799 799
 	return $item_name;
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-license.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_License' ) ) :
16
+if ( ! class_exists('Give_Settings_License')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_License.
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'licenses';
46
-			$this->label = esc_html__( 'Licenses', 'give' );
46
+			$this->label = esc_html__('Licenses', 'give');
47 47
 
48
-			add_filter( 'give-settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-settings_settings_{$this->id}_page", array( $this, 'output' ) );
48
+			add_filter('give-settings_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-settings_settings_{$this->id}_page", array($this, 'output'));
50 50
 		}
51 51
 
52 52
 		/**
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
 		 * @param  array $pages Lst of pages.
57 57
 		 * @return array
58 58
 		 */
59
-		public function add_settings_page( $pages ) {
59
+		public function add_settings_page($pages) {
60 60
 			$setting = $this->get_settings();
61 61
 			// Bailout: Do not add licenses setting tab if it does not contain any setting fields.
62
-			if( ! empty( $setting ) ) {
63
-				$pages[ $this->id ] = $this->label;
62
+			if ( ! empty($setting)) {
63
+				$pages[$this->id] = $this->label;
64 64
 			}
65 65
 
66 66
 			return $pages;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 			 * Filter the licenses settings.
80 80
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
81 81
 			 */
82
-			$settings = apply_filters( 'give_settings_licenses', $settings );
82
+			$settings = apply_filters('give_settings_licenses', $settings);
83 83
 
84 84
 			/**
85 85
 			 * Filter the settings.
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 			 * @since  1.8
88 88
 			 * @param  array $settings
89 89
 			 */
90
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
90
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
91 91
 
92 92
 			// Output.
93 93
 			return $settings;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		public function output() {
103 103
 			$settings = $this->get_settings();
104 104
 
105
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
105
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
106 106
 		}
107 107
 	}
108 108
 
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-addon.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Addon' ) ) :
16
+if ( ! class_exists('Give_Settings_Addon')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Addon.
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		 */
27 27
 		public function __construct() {
28 28
 			$this->id    = 'addons';
29
-			$this->label = esc_html__( 'Add-ons', 'give' );
29
+			$this->label = esc_html__('Add-ons', 'give');
30 30
 
31 31
 			parent::__construct();
32 32
 		}
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 		 * @param  $setting_tab
39 39
 		 * @return string
40 40
 		 */
41
-		function set_default_setting_tab( $setting_tab ) {
41
+		function set_default_setting_tab($setting_tab) {
42 42
 			$default_tab = '';
43 43
 
44 44
 			// Set default tab to first setting tab.
45
-			if( $sections = array_keys( $this->get_sections() ) ) {
46
-				$default_tab = current( $sections );
45
+			if ($sections = array_keys($this->get_sections())) {
46
+				$default_tab = current($sections);
47 47
 			}
48 48
 			return $default_tab;
49 49
 		}
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 		 * @param  array $pages Lst of pages.
56 56
 		 * @return array
57 57
 		 */
58
-		public function add_settings_page( $pages ) {
58
+		public function add_settings_page($pages) {
59 59
 			$setting = $this->get_settings();
60 60
 			// Bailout: Do not add addons setting tab if it does not contain any setting fields.
61
-			if( ! empty( $setting ) ) {
62
-				$pages[ $this->id ] = $this->label;
61
+			if ( ! empty($setting)) {
62
+				$pages[$this->id] = $this->label;
63 63
 			}
64 64
 
65 65
 			return $pages;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			 * Filter the addons settings.
79 79
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
80 80
 			 */
81
-			$settings = apply_filters( 'give_settings_addons', $settings );
81
+			$settings = apply_filters('give_settings_addons', $settings);
82 82
 
83 83
 			/**
84 84
 			 * Filter the settings.
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @since  1.8
87 87
 			 * @param  array $settings
88 88
 			 */
89
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
89
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
90 90
 
91 91
 			// Output.
92 92
 			return $settings;
Please login to merge, or discard this patch.
includes/admin/admin-filters.php 1 patch
Spacing   +4 added lines, -4 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
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return  mixed
28 28
  */
29
-function _give_sanitize_number_decimals_setting_field( $value ) {
30
-	return absint( $value );
29
+function _give_sanitize_number_decimals_setting_field($value) {
30
+	return absint($value);
31 31
 }
32
-add_filter( 'give_admin_settings_sanitize_option_number_decimals', '_give_sanitize_number_decimals_setting_field', 10 );
33 32
\ No newline at end of file
33
+add_filter('give_admin_settings_sanitize_option_number_decimals', '_give_sanitize_number_decimals_setting_field', 10);
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/forms/metabox.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -22,19 +22,19 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_add_shortcode_to_publish_metabox() {
24 24
 
25
-	if ( 'give_forms' !== get_post_type() ) {
25
+	if ('give_forms' !== get_post_type()) {
26 26
 		return false;
27 27
 	}
28 28
 	global $post;
29 29
 
30 30
 	//Only enqueue scripts for CPT on post type screen
31
-	if ( 'give_forms' === $post->post_type ) {
31
+	if ('give_forms' === $post->post_type) {
32 32
 		//Shortcode column with select all input
33
-		$shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' );
34
-		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>';
33
+		$shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
34
+		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
35 35
 
36 36
 	}
37 37
 
38 38
 }
39 39
 
40
-add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' );
40
+add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
Please login to merge, or discard this patch.
includes/admin/admin-footer.php 1 patch
Spacing   +6 added lines, -6 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,14 +24,14 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return      string
26 26
  */
27
-function give_admin_rate_us( $footer_text ) {
27
+function give_admin_rate_us($footer_text) {
28 28
 	global $typenow;
29 29
 
30
-	if ( $typenow == 'give_forms' ) {
30
+	if ($typenow == 'give_forms') {
31 31
 		$rate_text = sprintf(
32 32
 			/* translators: %s: Link to 5 star rating */
33
-			__( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ),
34
-			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
33
+			__('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'),
34
+			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="'.esc_attr__('Thanks :)', 'give').'">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
35 35
 		);
36 36
 
37 37
 		return $rate_text;
@@ -40,4 +40,4 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 }
42 42
 
43
-add_filter( 'admin_footer_text', 'give_admin_rate_us' );
43
+add_filter('admin_footer_text', 'give_admin_rate_us');
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
  *
99 99
  * @since 1.8
100 100
  *
101
- * @return bool
101
+ * @return false|null
102 102
  */
103 103
 function give_redirect_to_clean_url_admin_pages() {
104 104
 	// Give admin pages.
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -158,20 +158,20 @@
 block discarded – undo
158 158
 
159 159
 	$current_user = wp_get_current_user();
160 160
 
161
-    // Get notice id.
162
-    $notice_id = sanitize_text_field( $_POST['_give_hide_license_notices_shortly'] );
161
+	// Get notice id.
162
+	$notice_id = sanitize_text_field( $_POST['_give_hide_license_notices_shortly'] );
163 163
 
164
-    // Transient key name.
165
-    $transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
164
+	// Transient key name.
165
+	$transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
166 166
 
167
-    if ( Give_Cache::get( $transient_key, true ) ) {
168
-        return;
169
-    }
167
+	if ( Give_Cache::get( $transient_key, true ) ) {
168
+		return;
169
+	}
170 170
 
171
-    // Hide notice for 24 hours.
172
-    Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true );
171
+	// Hide notice for 24 hours.
172
+	Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true );
173 173
 
174
-    die();
174
+	die();
175 175
 
176 176
 }
177 177
 
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 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,53 +24,53 @@  discard block
 block discarded – undo
24 24
 function give_hide_subscription_notices() {
25 25
 
26 26
 	// Hide subscription notices permanently.
27
-	if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) {
27
+	if ( ! empty($_GET['_give_hide_license_notices_permanently'])) {
28 28
 		$current_user = wp_get_current_user();
29 29
 
30 30
 		// check previously disabled notice ids.
31
-		$already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
31
+		$already_dismiss_notices = ($already_dismiss_notices = get_user_meta($current_user->ID, '_give_hide_license_notices_permanently', true))
32 32
 			? $already_dismiss_notices
33 33
 			: array();
34 34
 
35 35
 		// Get notice id.
36
-		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] );
36
+		$notice_id = sanitize_text_field($_GET['_give_hide_license_notices_permanently']);
37 37
 
38
-		if ( ! in_array( $notice_id, $already_dismiss_notices ) ) {
38
+		if ( ! in_array($notice_id, $already_dismiss_notices)) {
39 39
 			$already_dismiss_notices[] = $notice_id;
40 40
 		}
41 41
 
42 42
 		// Store subscription ids.
43
-		update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices );
43
+		update_user_meta($current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices);
44 44
 
45 45
 		// Redirect user.
46
-		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) );
46
+		wp_safe_redirect(remove_query_arg('_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI']));
47 47
 		exit();
48 48
 	}
49 49
 
50 50
 	// Hide subscription notices shortly.
51
-	if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) {
51
+	if ( ! empty($_GET['_give_hide_license_notices_shortly'])) {
52 52
 		$current_user = wp_get_current_user();
53 53
 
54 54
 		// Get notice id.
55
-		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] );
55
+		$notice_id = sanitize_text_field($_GET['_give_hide_license_notices_shortly']);
56 56
 
57 57
 		// Transient key name.
58 58
 		$transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
59 59
 
60
-		if ( Give_Cache::get( $transient_key, true ) ) {
60
+		if (Give_Cache::get($transient_key, true)) {
61 61
 			return;
62 62
 		}
63 63
 
64 64
 		// Hide notice for 24 hours.
65
-		Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true );
65
+		Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true);
66 66
 
67 67
 		// Redirect user.
68
-		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
68
+		wp_safe_redirect(remove_query_arg('_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI']));
69 69
 		exit();
70 70
 	}
71 71
 }
72 72
 
73
-add_action( 'admin_init', 'give_hide_subscription_notices' );
73
+add_action('admin_init', 'give_hide_subscription_notices');
74 74
 
75 75
 /**
76 76
  * Load wp editor by ajax.
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
  * @since 1.8
79 79
  */
80 80
 function give_load_wp_editor() {
81
-	if ( ! isset( $_POST['wp_editor'] ) ) {
81
+	if ( ! isset($_POST['wp_editor'])) {
82 82
 		die();
83 83
 	}
84 84
 
85
-	$wp_editor                     = json_decode( base64_decode( $_POST['wp_editor'] ), true );
85
+	$wp_editor                     = json_decode(base64_decode($_POST['wp_editor']), true);
86 86
 	$wp_editor[2]['textarea_name'] = $_POST['textarea_name'];
87 87
 
88
-	wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] );
88
+	wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]);
89 89
 
90 90
 	die();
91 91
 }
92 92
 
93
-add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' );
93
+add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor');
94 94
 
95 95
 
96 96
 /**
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 	);
110 110
 
111 111
 	// Get current page.
112
-	$current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : '';
112
+	$current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : '';
113 113
 
114 114
 	// Bailout.
115 115
 	if (
116
-		empty( $current_page )
117
-		|| empty( $_GET['_wp_http_referer'] )
118
-		|| ! in_array( $current_page, $give_pages )
116
+		empty($current_page)
117
+		|| empty($_GET['_wp_http_referer'])
118
+		|| ! in_array($current_page, $give_pages)
119 119
 	) {
120 120
 		return false;
121 121
 	}
@@ -125,21 +125,21 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @since 1.8
127 127
 	 */
128
-	$redirect = apply_filters( "give_validate_{$current_page}", true );
128
+	$redirect = apply_filters("give_validate_{$current_page}", true);
129 129
 
130
-	if ( $redirect ) {
130
+	if ($redirect) {
131 131
 		// Redirect.
132 132
 		wp_redirect(
133 133
 			remove_query_arg(
134
-				array( '_wp_http_referer', '_wpnonce' ),
135
-				wp_unslash( $_SERVER['REQUEST_URI'] )
134
+				array('_wp_http_referer', '_wpnonce'),
135
+				wp_unslash($_SERVER['REQUEST_URI'])
136 136
 			)
137 137
 		);
138 138
 		exit;
139 139
 	}
140 140
 }
141 141
 
142
-add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' );
142
+add_action('admin_init', 'give_redirect_to_clean_url_admin_pages');
143 143
 
144 144
 /**
145 145
  * Hide License Notice Shortly.
@@ -152,27 +152,27 @@  discard block
 block discarded – undo
152 152
  */
153 153
 function give_hide_license_notice() {
154 154
 
155
-	if ( ! isset( $_POST['_give_hide_license_notices_shortly'] ) ) {
155
+	if ( ! isset($_POST['_give_hide_license_notices_shortly'])) {
156 156
 		die();
157 157
 	}
158 158
 
159 159
 	$current_user = wp_get_current_user();
160 160
 
161 161
     // Get notice id.
162
-    $notice_id = sanitize_text_field( $_POST['_give_hide_license_notices_shortly'] );
162
+    $notice_id = sanitize_text_field($_POST['_give_hide_license_notices_shortly']);
163 163
 
164 164
     // Transient key name.
165 165
     $transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
166 166
 
167
-    if ( Give_Cache::get( $transient_key, true ) ) {
167
+    if (Give_Cache::get($transient_key, true)) {
168 168
         return;
169 169
     }
170 170
 
171 171
     // Hide notice for 24 hours.
172
-    Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true );
172
+    Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true);
173 173
 
174 174
     die();
175 175
 
176 176
 }
177 177
 
178
-add_action( 'wp_ajax_give_hide_license_notice', 'give_hide_license_notice' );
178
+add_action('wp_ajax_give_hide_license_notice', 'give_hide_license_notice');
Please login to merge, or discard this patch.
includes/admin/class-admin-notices.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	 *
50 50
 	 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference.
51 51
 	 *
52
-	 * @return bool
52
+	 * @return false|null
53 53
 	 */
54 54
 	public function give_admin_bar_menu( $wp_admin_bar ) {
55 55
 
Please login to merge, or discard this patch.
Spacing   +68 added lines, -68 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
 
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	 * @since 1.0
34 34
 	 */
35 35
 	public function __construct() {
36
-		add_action( 'admin_notices', array( $this, 'show_notices' ) );
37
-		add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) );
38
-		add_action( 'admin_bar_menu', array( $this, 'give_admin_bar_menu' ), 1000, 1 );
36
+		add_action('admin_notices', array($this, 'show_notices'));
37
+		add_action('give_dismiss_notices', array($this, 'dismiss_notices'));
38
+		add_action('admin_bar_menu', array($this, 'give_admin_bar_menu'), 1000, 1);
39 39
 
40 40
 		$this->notices = array(
41 41
 			'updated' => array(),
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @return bool
53 53
 	 */
54
-	public function give_admin_bar_menu( $wp_admin_bar ) {
54
+	public function give_admin_bar_menu($wp_admin_bar) {
55 55
 
56
-		if ( ! give_is_test_mode() || ! current_user_can( 'view_give_reports' ) ) {
56
+		if ( ! give_is_test_mode() || ! current_user_can('view_give_reports')) {
57 57
 			return false;
58 58
 		}
59 59
 
60 60
 		// Add the main siteadmin menu item.
61
-		$wp_admin_bar->add_menu( array(
61
+		$wp_admin_bar->add_menu(array(
62 62
 			'id'     => 'give-test-notice',
63
-			'href'   => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ),
63
+			'href'   => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'),
64 64
 			'parent' => 'top-secondary',
65
-			'title'  => esc_html__( 'Give Test Mode Active', 'give' ),
66
-			'meta'   => array( 'class' => 'give-test-mode-active' ),
67
-		) );
65
+			'title'  => esc_html__('Give Test Mode Active', 'give'),
66
+			'meta'   => array('class' => 'give-test-mode-active'),
67
+		));
68 68
 
69 69
 	}
70 70
 
@@ -75,100 +75,100 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function show_notices() {
77 77
 
78
-		if ( ! give_test_ajax_works() && ! get_user_meta( get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true ) && current_user_can( 'manage_give_settings' ) ) {
78
+		if ( ! give_test_ajax_works() && ! get_user_meta(get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true) && current_user_can('manage_give_settings')) {
79 79
 			echo '<div class="error">';
80
-			echo '<p>' . __( 'Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give' ) . '</p>';
80
+			echo '<p>'.__('Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give').'</p>';
81 81
 			/* translators: %s: http://docs.givewp.com/ajax-blocked */
82
-			echo '<p>' . sprintf( __( 'Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give' ), esc_url( 'http://docs.givewp.com/ajax-blocked' ) ) . '</p>';
83
-			echo '<p><a href="' . add_query_arg( array(
82
+			echo '<p>'.sprintf(__('Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give'), esc_url('http://docs.givewp.com/ajax-blocked')).'</p>';
83
+			echo '<p><a href="'.add_query_arg(array(
84 84
 					'give_action' => 'dismiss_notices',
85 85
 					'give_notice' => 'admin_ajax_inaccessible',
86
-				) ) . '">' . __( 'Dismiss Notice', 'give' ) . '</a></p>';
86
+				)).'">'.__('Dismiss Notice', 'give').'</a></p>';
87 87
 			echo '</div>';
88 88
 		}
89 89
 
90
-		if ( isset( $_GET['give-message'] ) ) {
90
+		if (isset($_GET['give-message'])) {
91 91
 
92 92
 			// Donation reports errors.
93
-			if ( current_user_can( 'view_give_reports' ) ) {
94
-				switch ( $_GET['give-message'] ) {
93
+			if (current_user_can('view_give_reports')) {
94
+				switch ($_GET['give-message']) {
95 95
 					case 'donation_deleted' :
96
-						$this->notices['updated']['give-donation-deleted'] = __( 'The donation has been deleted.', 'give' );
96
+						$this->notices['updated']['give-donation-deleted'] = __('The donation has been deleted.', 'give');
97 97
 						break;
98 98
 					case 'email_sent' :
99
-						$this->notices['updated']['give-payment-sent'] = __( 'The donation receipt has been resent.', 'give' );
99
+						$this->notices['updated']['give-payment-sent'] = __('The donation receipt has been resent.', 'give');
100 100
 						break;
101 101
 					case 'refreshed-reports' :
102
-						$this->notices['updated']['give-refreshed-reports'] = __( 'The reports cache has been cleared.', 'give' );
102
+						$this->notices['updated']['give-refreshed-reports'] = __('The reports cache has been cleared.', 'give');
103 103
 						break;
104 104
 					case 'donation-note-deleted' :
105
-						$this->notices['updated']['give-donation-note-deleted'] = __( 'The donation note has been deleted.', 'give' );
105
+						$this->notices['updated']['give-donation-note-deleted'] = __('The donation note has been deleted.', 'give');
106 106
 						break;
107 107
 				}
108 108
 			}
109 109
 
110 110
 			// Give settings notices and errors.
111
-			if ( current_user_can( 'manage_give_settings' ) ) {
112
-				switch ( $_GET['give-message'] ) {
111
+			if (current_user_can('manage_give_settings')) {
112
+				switch ($_GET['give-message']) {
113 113
 					case 'settings-imported' :
114
-						$this->notices['updated']['give-settings-imported'] = __( 'The settings have been imported.', 'give' );
114
+						$this->notices['updated']['give-settings-imported'] = __('The settings have been imported.', 'give');
115 115
 						break;
116 116
 					case 'api-key-generated' :
117
-						$this->notices['updated']['give-api-key-generated'] = __( 'API keys have been generated.', 'give' );
117
+						$this->notices['updated']['give-api-key-generated'] = __('API keys have been generated.', 'give');
118 118
 						break;
119 119
 					case 'api-key-exists' :
120
-						$this->notices['error']['give-api-key-exists'] = __( 'The specified user already has API keys.', 'give' );
120
+						$this->notices['error']['give-api-key-exists'] = __('The specified user already has API keys.', 'give');
121 121
 						break;
122 122
 					case 'api-key-regenerated' :
123
-						$this->notices['updated']['give-api-key-regenerated'] = __( 'API keys have been regenerated.', 'give' );
123
+						$this->notices['updated']['give-api-key-regenerated'] = __('API keys have been regenerated.', 'give');
124 124
 						break;
125 125
 					case 'api-key-revoked' :
126
-						$this->notices['updated']['give-api-key-revoked'] = __( 'API keys have been revoked.', 'give' );
126
+						$this->notices['updated']['give-api-key-revoked'] = __('API keys have been revoked.', 'give');
127 127
 						break;
128 128
 					case 'sent-test-email' :
129
-						$this->notices['updated']['give-sent-test-email'] = __( 'The test email has been sent.', 'give' );
129
+						$this->notices['updated']['give-sent-test-email'] = __('The test email has been sent.', 'give');
130 130
 						break;
131 131
 					case 'matched-success-failure-page':
132
-						$this->notices['updated']['give-matched-success-failure-page'] = __( 'You cannot set the success and failed pages to the same page', 'give' );
132
+						$this->notices['updated']['give-matched-success-failure-page'] = __('You cannot set the success and failed pages to the same page', 'give');
133 133
 				}
134 134
 			}
135 135
 			// Payments errors.
136
-			if ( current_user_can( 'edit_give_payments' ) ) {
137
-				switch ( $_GET['give-message'] ) {
136
+			if (current_user_can('edit_give_payments')) {
137
+				switch ($_GET['give-message']) {
138 138
 					case 'note-added' :
139
-						$this->notices['updated']['give-note-added'] = __( 'The donation note has been added.', 'give' );
139
+						$this->notices['updated']['give-note-added'] = __('The donation note has been added.', 'give');
140 140
 						break;
141 141
 					case 'payment-updated' :
142
-						$this->notices['updated']['give-payment-updated'] = __( 'The donation has been updated.', 'give' );
142
+						$this->notices['updated']['give-payment-updated'] = __('The donation has been updated.', 'give');
143 143
 						break;
144 144
 				}
145 145
 			}
146 146
 
147 147
 			// Customer Notices.
148
-			if ( current_user_can( 'edit_give_payments' ) ) {
149
-				switch ( $_GET['give-message'] ) {
148
+			if (current_user_can('edit_give_payments')) {
149
+				switch ($_GET['give-message']) {
150 150
 					case 'customer-deleted' :
151
-						$this->notices['updated']['give-customer-deleted'] = __( 'The donor has been deleted.', 'give' );
151
+						$this->notices['updated']['give-customer-deleted'] = __('The donor has been deleted.', 'give');
152 152
 						break;
153 153
 
154 154
 					case 'email-added' :
155
-						$this->notices['updated']['give-customer-email-added'] = __( 'Donor email added', 'give' );
155
+						$this->notices['updated']['give-customer-email-added'] = __('Donor email added', 'give');
156 156
 						break;
157 157
 
158 158
 					case 'email-removed' :
159
-						$this->notices['updated']['give-customer-email-removed'] = __( 'Donor email removed', 'give' );
159
+						$this->notices['updated']['give-customer-email-removed'] = __('Donor email removed', 'give');
160 160
 						break;
161 161
 
162 162
 					case 'email-remove-failed' :
163
-						$this->notices['error']['give-customer-email-remove-failed'] = __( 'Failed to remove donor email', 'give' );
163
+						$this->notices['error']['give-customer-email-remove-failed'] = __('Failed to remove donor email', 'give');
164 164
 						break;
165 165
 
166 166
 					case 'primary-email-updated' :
167
-						$this->notices['updated']['give-customer-primary-email-updated'] = __( 'Primary email updated for donor', 'give' );
167
+						$this->notices['updated']['give-customer-primary-email-updated'] = __('Primary email updated for donor', 'give');
168 168
 						break;
169 169
 
170 170
 					case 'primary-email-failed' :
171
-						$this->notices['error']['give-customer-primary-email-failed'] = __( 'Failed to set primary email', 'give' );
171
+						$this->notices['error']['give-customer-primary-email-failed'] = __('Failed to set primary email', 'give');
172 172
 
173 173
 				}
174 174
 			}
@@ -176,19 +176,19 @@  discard block
 block discarded – undo
176 176
 
177 177
 		$this->add_payment_bulk_action_notice();
178 178
 
179
-		if ( count( $this->notices['updated'] ) > 0 ) {
180
-			foreach ( $this->notices['updated'] as $notice => $message ) {
181
-				add_settings_error( 'give-notices', $notice, $message, 'updated' );
179
+		if (count($this->notices['updated']) > 0) {
180
+			foreach ($this->notices['updated'] as $notice => $message) {
181
+				add_settings_error('give-notices', $notice, $message, 'updated');
182 182
 			}
183 183
 		}
184 184
 
185
-		if ( count( $this->notices['error'] ) > 0 ) {
186
-			foreach ( $this->notices['error'] as $notice => $message ) {
187
-				add_settings_error( 'give-notices', $notice, $message, 'error' );
185
+		if (count($this->notices['error']) > 0) {
186
+			foreach ($this->notices['error'] as $notice => $message) {
187
+				add_settings_error('give-notices', $notice, $message, 'error');
188 188
 			}
189 189
 		}
190 190
 
191
-		settings_errors( 'give-notices' );
191
+		settings_errors('give-notices');
192 192
 
193 193
 	}
194 194
 
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 	 * @return void
201 201
 	 */
202 202
 	function give_admin_addons_notices() {
203
-		add_settings_error( 'give-notices', 'give-addons-feed-error', __( 'There seems to be an issue with the server. Please try again in a few minutes.', 'give' ), 'error' );
204
-		settings_errors( 'give-notices' );
203
+		add_settings_error('give-notices', 'give-addons-feed-error', __('There seems to be an issue with the server. Please try again in a few minutes.', 'give'), 'error');
204
+		settings_errors('give-notices');
205 205
 	}
206 206
 
207 207
 
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 	 * @return void
213 213
 	 */
214 214
 	function dismiss_notices() {
215
-		if ( isset( $_GET['give_notice'] ) ) {
216
-			update_user_meta( get_current_user_id(), '_give_' . $_GET['give_notice'] . '_dismissed', 1 );
217
-			wp_redirect( remove_query_arg( array( 'give_action', 'give_notice' ) ) );
215
+		if (isset($_GET['give_notice'])) {
216
+			update_user_meta(get_current_user_id(), '_give_'.$_GET['give_notice'].'_dismissed', 1);
217
+			wp_redirect(remove_query_arg(array('give_action', 'give_notice')));
218 218
 			exit;
219 219
 		}
220 220
 	}
@@ -229,24 +229,24 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	function add_payment_bulk_action_notice() {
231 231
 		if (
232
-			current_user_can( 'edit_give_payments' )
233
-			&& isset( $_GET['action'] )
234
-			&& ! empty( $_GET['action'] )
235
-			&& isset( $_GET['payment'] )
236
-			&& ! empty( $_GET['payment'] )
232
+			current_user_can('edit_give_payments')
233
+			&& isset($_GET['action'])
234
+			&& ! empty($_GET['action'])
235
+			&& isset($_GET['payment'])
236
+			&& ! empty($_GET['payment'])
237 237
 		) {
238
-			$payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0;
238
+			$payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0;
239 239
 
240
-			switch ( $_GET['action'] ) {
240
+			switch ($_GET['action']) {
241 241
 				case 'delete':
242
-					if ( $payment_count ) {
243
-						$this->notices['updated']['bulk_action_delete'] = sprintf( _n( 'Successfully deleted only one transaction.', 'Successfully deleted %d number of transactions.', $payment_count, 'give' ), $payment_count );
242
+					if ($payment_count) {
243
+						$this->notices['updated']['bulk_action_delete'] = sprintf(_n('Successfully deleted only one transaction.', 'Successfully deleted %d number of transactions.', $payment_count, 'give'), $payment_count);
244 244
 					}
245 245
 					break;
246 246
 
247 247
 				case 'resend-receipt':
248
-					if ( $payment_count ) {
249
-						$this->notices['updated']['bulk_action_resend_receipt'] = sprintf( _n( 'Successfully send email receipt to only one recipient.', 'Successfully send email receipts to %d recipients.', $payment_count, 'give' ), $payment_count );
248
+					if ($payment_count) {
249
+						$this->notices['updated']['bulk_action_resend_receipt'] = sprintf(_n('Successfully send email receipt to only one recipient.', 'Successfully send email receipts to %d recipients.', $payment_count, 'give'), $payment_count);
250 250
 					}
251 251
 					break;
252 252
 			}
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @return string
269 269
 	 */
270
-	public static function notice_html( $message, $type = 'updated' ) {
270
+	public static function notice_html($message, $type = 'updated') {
271 271
 		ob_start();
272 272
 		?>
273 273
 		<div class="<?php echo $type; ?> notice">
Please login to merge, or discard this patch.