Completed
Pull Request — master (#1412)
by Ravinder
17:25
created
includes/admin/shortcodes/shortcode-give-profile-editor.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' );
24
+		$this->shortcode['label'] = esc_html__('Profile Editor', 'give');
25 25
 
26
-		parent::__construct( 'give_profile_editor' );
26
+		parent::__construct('give_profile_editor');
27 27
 	}
28 28
 }
29 29
 
Please login to merge, or discard this patch.
includes/admin/add-ons.php 1 patch
Spacing   +11 added lines, -11 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,11 +26,11 @@  discard block
 block discarded – undo
26 26
 	ob_start(); ?>
27 27
 	<div class="wrap" id="give-add-ons">
28 28
 		<h1><?php echo get_admin_page_title(); ?>
29
-			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?>
29
+			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?>
30 30
 				<span class="dashicons dashicons-external"></span></a>
31 31
 		</h1>
32 32
 
33
-		<p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p>
33
+		<p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p>
34 34
 		<?php echo give_add_ons_get_feed(); ?>
35 35
 	</div>
36 36
 	<?php
@@ -48,18 +48,18 @@  discard block
 block discarded – undo
48 48
 function give_add_ons_get_feed() {
49 49
 
50 50
 	$addons_debug = false; //set to true to debug
51
-	$cache        = get_transient( 'give_add_ons_feed' );
51
+	$cache        = get_transient('give_add_ons_feed');
52 52
 
53
-	if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) {
54
-		$feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) );
53
+	if ($cache === false || $addons_debug === true && WP_DEBUG === true) {
54
+		$feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false));
55 55
 
56
-		if ( ! is_wp_error( $feed ) ) {
57
-			if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
58
-				$cache = wp_remote_retrieve_body( $feed );
59
-				set_transient( 'give_add_ons_feed', $cache, 3600 );
56
+		if ( ! is_wp_error($feed)) {
57
+			if (isset($feed['body']) && strlen($feed['body']) > 0) {
58
+				$cache = wp_remote_retrieve_body($feed);
59
+				set_transient('give_add_ons_feed', $cache, 3600);
60 60
 			}
61 61
 		} else {
62
-			$cache = '<div class="error"><p>' . esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>';
62
+			$cache = '<div class="error"><p>'.esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>';
63 63
 		}
64 64
 	}
65 65
 
Please login to merge, or discard this patch.
includes/admin/plugins.php 1 patch
Spacing   +16 added lines, -16 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,19 +23,19 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array An array of updated action links.
25 25
  */
26
-function give_plugin_action_links( $actions ) {
26
+function give_plugin_action_links($actions) {
27 27
 	$new_actions = array(
28 28
 		'settings' => sprintf(
29 29
 			'<a href="%1$s">%2$s</a>',
30
-			admin_url( 'edit.php?post_type=give_forms&page=give-settings' ),
31
-			esc_html__( 'Settings', 'give' )
30
+			admin_url('edit.php?post_type=give_forms&page=give-settings'),
31
+			esc_html__('Settings', 'give')
32 32
 		),
33 33
 	);
34 34
 
35
-	return array_merge( $new_actions, $actions );
35
+	return array_merge($new_actions, $actions);
36 36
 }
37 37
 
38
-add_filter( 'plugin_action_links_' . GIVE_PLUGIN_BASENAME, 'give_plugin_action_links' );
38
+add_filter('plugin_action_links_'.GIVE_PLUGIN_BASENAME, 'give_plugin_action_links');
39 39
 
40 40
 
41 41
 /**
@@ -48,35 +48,35 @@  discard block
 block discarded – undo
48 48
  *
49 49
  * @return array
50 50
  */
51
-function give_plugin_row_meta( $plugin_meta, $plugin_file ) {
52
-	if ( $plugin_file != GIVE_PLUGIN_BASENAME ) {
51
+function give_plugin_row_meta($plugin_meta, $plugin_file) {
52
+	if ($plugin_file != GIVE_PLUGIN_BASENAME) {
53 53
 		return $plugin_meta;
54 54
 	}
55 55
 
56 56
 	$new_meta_links = array(
57 57
 		sprintf(
58 58
 			'<a href="%1$s" target="_blank">%2$s</a>',
59
-			esc_url( add_query_arg( array(
59
+			esc_url(add_query_arg(array(
60 60
 					'utm_source'   => 'plugins-page',
61 61
 					'utm_medium'   => 'plugin-row',
62 62
 					'utm_campaign' => 'admin',
63
-				), 'https://givewp.com/documentation/' )
63
+				), 'https://givewp.com/documentation/')
64 64
 			),
65
-			esc_html__( 'Documentation', 'give' )
65
+			esc_html__('Documentation', 'give')
66 66
 		),
67 67
 		sprintf(
68 68
 			'<a href="%1$s" target="_blank">%2$s</a>',
69
-			esc_url( add_query_arg( array(
69
+			esc_url(add_query_arg(array(
70 70
 					'utm_source'   => 'plugins-page',
71 71
 					'utm_medium'   => 'plugin-row',
72 72
 					'utm_campaign' => 'admin',
73
-				), 'https://givewp.com/addons/' )
73
+				), 'https://givewp.com/addons/')
74 74
 			),
75
-			esc_html__( 'Add-ons', 'give' )
75
+			esc_html__('Add-ons', 'give')
76 76
 		),
77 77
 	);
78 78
 
79
-	return array_merge( $plugin_meta, $new_meta_links );
79
+	return array_merge($plugin_meta, $new_meta_links);
80 80
 }
81 81
 
82
-add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 );
82
+add_filter('plugin_row_meta', 'give_plugin_row_meta', 10, 2);
Please login to merge, or discard this patch.
includes/payments/functions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
  *
327 327
  * @since  1.0
328 328
  *
329
- * @param  int|bool $form_id    Form ID (default: false).
329
+ * @param  boolean $form_id    Form ID (default: false).
330 330
  * @param  int      $payment_id Payment ID.
331 331
  *
332 332
  * @return void
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
  * @param  int $year      Year number. Default is null.
645 645
  * @param  int $hour      Hour number. Default is null.
646 646
  *
647
- * @return int $earnings  Earnings
647
+ * @return double $earnings  Earnings
648 648
  */
649 649
 function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
650 650
 
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
  *
960 960
  * @param int $payment_id Payment ID.
961 961
  *
962
- * @return int $form_id Form ID.
962
+ * @return string $form_id Form ID.
963 963
  */
964 964
 function give_get_payment_form_id( $payment_id ) {
965 965
 	$payment = new Give_Payment( $payment_id );
Please login to merge, or discard this patch.
Spacing   +400 added lines, -400 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
 
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
  *
44 44
  * @return object $payments Payments retrieved from the database
45 45
  */
46
-function give_get_payments( $args = array() ) {
46
+function give_get_payments($args = array()) {
47 47
 
48 48
 	// Fallback to post objects to ensure backwards compatibility.
49
-	if ( ! isset( $args['output'] ) ) {
49
+	if ( ! isset($args['output'])) {
50 50
 		$args['output'] = 'posts';
51 51
 	}
52 52
 
53
-	$args     = apply_filters( 'give_get_payments_args', $args );
54
-	$payments = new Give_Payments_Query( $args );
53
+	$args     = apply_filters('give_get_payments_args', $args);
54
+	$payments = new Give_Payments_Query($args);
55 55
 
56 56
 	return $payments->get_payments();
57 57
 }
@@ -66,48 +66,48 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return mixed
68 68
  */
69
-function give_get_payment_by( $field = '', $value = '' ) {
69
+function give_get_payment_by($field = '', $value = '') {
70 70
 
71
-	if ( empty( $field ) || empty( $value ) ) {
71
+	if (empty($field) || empty($value)) {
72 72
 		return false;
73 73
 	}
74 74
 
75
-	switch ( strtolower( $field ) ) {
75
+	switch (strtolower($field)) {
76 76
 
77 77
 		case 'id':
78
-			$payment = new Give_Payment( $value );
78
+			$payment = new Give_Payment($value);
79 79
 			$id      = $payment->ID;
80 80
 
81
-			if ( empty( $id ) ) {
81
+			if (empty($id)) {
82 82
 				return false;
83 83
 			}
84 84
 
85 85
 			break;
86 86
 
87 87
 		case 'key':
88
-			$payment = give_get_payments( array(
88
+			$payment = give_get_payments(array(
89 89
 				'meta_key'       => '_give_payment_purchase_key',
90 90
 				'meta_value'     => $value,
91 91
 				'posts_per_page' => 1,
92 92
 				'fields'         => 'ids',
93
-			) );
93
+			));
94 94
 
95
-			if ( $payment ) {
96
-				$payment = new Give_Payment( $payment[0] );
95
+			if ($payment) {
96
+				$payment = new Give_Payment($payment[0]);
97 97
 			}
98 98
 
99 99
 			break;
100 100
 
101 101
 		case 'payment_number':
102
-			$payment = give_get_payments( array(
102
+			$payment = give_get_payments(array(
103 103
 				'meta_key'       => '_give_payment_number',
104 104
 				'meta_value'     => $value,
105 105
 				'posts_per_page' => 1,
106 106
 				'fields'         => 'ids',
107
-			) );
107
+			));
108 108
 
109
-			if ( $payment ) {
110
-				$payment = new Give_Payment( $payment[0] );
109
+			if ($payment) {
110
+				$payment = new Give_Payment($payment[0]);
111 111
 			}
112 112
 
113 113
 			break;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 			return false;
117 117
 	}
118 118
 
119
-	if ( $payment ) {
119
+	if ($payment) {
120 120
 		return $payment;
121 121
 	}
122 122
 
@@ -132,23 +132,23 @@  discard block
 block discarded – undo
132 132
  *
133 133
  * @return int|bool Payment ID if payment is inserted, false otherwise.
134 134
  */
135
-function give_insert_payment( $payment_data = array() ) {
135
+function give_insert_payment($payment_data = array()) {
136 136
 
137
-	if ( empty( $payment_data ) ) {
137
+	if (empty($payment_data)) {
138 138
 		return false;
139 139
 	}
140 140
 
141 141
 	$payment    = new Give_Payment();
142
-	$gateway    = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : '';
143
-	$gateway    = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway;
144
-	$form_id    = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0;
145
-	$price_id   = isset( $payment_data['give_price_id'] ) ? $payment_data['give_price_id'] : give_get_price_id( $payment_data['give_form_id'], $payment_data['price'] );
146
-	$form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id );
142
+	$gateway    = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : '';
143
+	$gateway    = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway;
144
+	$form_id    = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0;
145
+	$price_id   = isset($payment_data['give_price_id']) ? $payment_data['give_price_id'] : give_get_price_id($payment_data['give_form_id'], $payment_data['price']);
146
+	$form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id);
147 147
 
148 148
 	// Set properties.
149 149
 	$payment->total          = $payment_data['price'];
150
-	$payment->status         = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending';
151
-	$payment->currency       = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency();
150
+	$payment->status         = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending';
151
+	$payment->currency       = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency();
152 152
 	$payment->user_info      = $payment_data['user_info'];
153 153
 	$payment->gateway        = $gateway;
154 154
 	$payment->form_title     = $form_title;
@@ -162,31 +162,31 @@  discard block
 block discarded – undo
162 162
 	$payment->ip             = give_get_ip();
163 163
 	$payment->key            = $payment_data['purchase_key'];
164 164
 	$payment->mode           = give_is_test_mode() ? 'test' : 'live';
165
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
165
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
166 166
 
167 167
 	// Add the donation.
168 168
 	$args = array(
169 169
 		'price'    => $payment->total,
170 170
 		'price_id' => $payment->price_id,
171
-		'fees'     => isset( $payment_data['fees'] ) ? $payment_data['fees'] : array(),
171
+		'fees'     => isset($payment_data['fees']) ? $payment_data['fees'] : array(),
172 172
 	);
173 173
 
174
-	$payment->add_donation( $payment->form_id, $args );
174
+	$payment->add_donation($payment->form_id, $args);
175 175
 
176 176
 	// Set date if present.
177
-	if ( isset( $payment_data['post_date'] ) ) {
177
+	if (isset($payment_data['post_date'])) {
178 178
 		$payment->date = $payment_data['post_date'];
179 179
 	}
180 180
 
181 181
 	// Handle sequential payments.
182
-	if ( give_get_option( 'enable_sequential' ) ) {
182
+	if (give_get_option('enable_sequential')) {
183 183
 		$number          = give_get_next_payment_number();
184
-		$payment->number = give_format_payment_number( $number );
185
-		update_option( 'give_last_payment_number', $number );
184
+		$payment->number = give_format_payment_number($number);
185
+		update_option('give_last_payment_number', $number);
186 186
 	}
187 187
 
188 188
 	// Clear the user's donation cache.
189
-	delete_transient( 'give_user_' . $payment_data['user_info']['id'] . '_purchases' );
189
+	delete_transient('give_user_'.$payment_data['user_info']['id'].'_purchases');
190 190
 
191 191
 	// Save payment.
192 192
 	$payment->save();
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 	 * @param int   $payment_id   The payment ID.
200 200
 	 * @param array $payment_data Arguments passed.
201 201
 	 */
202
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
202
+	do_action('give_insert_payment', $payment->ID, $payment_data);
203 203
 
204 204
 	// Return payment ID upon success.
205
-	if ( ! empty( $payment->ID ) ) {
205
+	if ( ! empty($payment->ID)) {
206 206
 		return $payment->ID;
207 207
 	}
208 208
 
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
  *
219 219
  * @return bool|int
220 220
  */
221
-function give_create_payment( $payment_data ) {
221
+function give_create_payment($payment_data) {
222 222
 
223
-	$form_id  = intval( $payment_data['post_data']['give-form-id'] );
224
-	$price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
223
+	$form_id  = intval($payment_data['post_data']['give-form-id']);
224
+	$price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
225 225
 
226 226
 	// Collect payment data.
227 227
 	$insert_payment_data = array(
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @param array $insert_payment_data
247 247
 	 */
248
-	$insert_payment_data = apply_filters( 'give_create_payment', $insert_payment_data );
248
+	$insert_payment_data = apply_filters('give_create_payment', $insert_payment_data);
249 249
 
250 250
 	// Record the pending payment.
251
-	return give_insert_payment( $insert_payment_data );
251
+	return give_insert_payment($insert_payment_data);
252 252
 }
253 253
 
254 254
 /**
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
  *
262 262
  * @return bool
263 263
  */
264
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
264
+function give_update_payment_status($payment_id, $new_status = 'publish') {
265 265
 
266
-	$payment         = new Give_Payment( $payment_id );
266
+	$payment         = new Give_Payment($payment_id);
267 267
 	$payment->status = $new_status;
268 268
 	$updated         = $payment->save();
269 269
 
@@ -282,37 +282,37 @@  discard block
 block discarded – undo
282 282
  *
283 283
  * @return void
284 284
  */
285
-function give_delete_purchase( $payment_id = 0, $update_customer = true ) {
285
+function give_delete_purchase($payment_id = 0, $update_customer = true) {
286 286
 	global $give_logs;
287 287
 
288
-	$payment     = new Give_Payment( $payment_id );
289
-	$amount      = give_get_payment_amount( $payment_id );
288
+	$payment     = new Give_Payment($payment_id);
289
+	$amount      = give_get_payment_amount($payment_id);
290 290
 	$status      = $payment->post_status;
291
-	$customer_id = give_get_payment_customer_id( $payment_id );
292
-	$customer    = new Give_Customer( $customer_id );
291
+	$customer_id = give_get_payment_customer_id($payment_id);
292
+	$customer    = new Give_Customer($customer_id);
293 293
 
294 294
 	// Only undo donations that aren't these statuses.
295
-	$dont_undo_statuses = apply_filters( 'give_undo_purchase_statuses', array(
295
+	$dont_undo_statuses = apply_filters('give_undo_purchase_statuses', array(
296 296
 		'pending',
297 297
 		'cancelled',
298
-	) );
298
+	));
299 299
 
300
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
301
-		give_undo_purchase( false, $payment_id );
300
+	if ( ! in_array($status, $dont_undo_statuses)) {
301
+		give_undo_purchase(false, $payment_id);
302 302
 	}
303 303
 
304
-	if ( $status == 'publish' ) {
304
+	if ($status == 'publish') {
305 305
 
306 306
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment).
307
-		give_decrease_total_earnings( $amount );
307
+		give_decrease_total_earnings($amount);
308 308
 		// Clear the This Month earnings (this_monththis_month is NOT a typo).
309
-		delete_transient( md5( 'give_earnings_this_monththis_month' ) );
309
+		delete_transient(md5('give_earnings_this_monththis_month'));
310 310
 
311
-		if ( $customer->id && $update_customer ) {
311
+		if ($customer->id && $update_customer) {
312 312
 
313 313
 			// Decrement the stats for the donor.
314 314
 			$customer->decrease_purchase_count();
315
-			$customer->decrease_value( $amount );
315
+			$customer->decrease_value($amount);
316 316
 
317 317
 		}
318 318
 	}
@@ -324,17 +324,17 @@  discard block
 block discarded – undo
324 324
 	 *
325 325
 	 * @param int $payment_id Payment ID.
326 326
 	 */
327
-	do_action( 'give_payment_delete', $payment_id );
327
+	do_action('give_payment_delete', $payment_id);
328 328
 
329
-	if ( $customer->id && $update_customer ) {
329
+	if ($customer->id && $update_customer) {
330 330
 
331 331
 		// Remove the payment ID from the donor.
332
-		$customer->remove_payment( $payment_id );
332
+		$customer->remove_payment($payment_id);
333 333
 
334 334
 	}
335 335
 
336 336
 	// Remove the payment.
337
-	wp_delete_post( $payment_id, true );
337
+	wp_delete_post($payment_id, true);
338 338
 
339 339
 	// Remove related sale log entries.
340 340
 	$give_logs->delete_logs(
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 *
356 356
 	 * @param int $payment_id Payment ID.
357 357
 	 */
358
-	do_action( 'give_payment_deleted', $payment_id );
358
+	do_action('give_payment_deleted', $payment_id);
359 359
 }
360 360
 
361 361
 /**
@@ -371,25 +371,25 @@  discard block
 block discarded – undo
371 371
  *
372 372
  * @return void
373 373
  */
374
-function give_undo_purchase( $form_id = false, $payment_id ) {
374
+function give_undo_purchase($form_id = false, $payment_id) {
375 375
 
376
-	if ( ! empty( $form_id ) ) {
376
+	if ( ! empty($form_id)) {
377 377
 		$form_id = false;
378
-		_give_deprected_argument( 'form_id', 'give_undo_purchase', '1.5' );
378
+		_give_deprected_argument('form_id', 'give_undo_purchase', '1.5');
379 379
 	}
380 380
 
381
-	$payment = new Give_Payment( $payment_id );
381
+	$payment = new Give_Payment($payment_id);
382 382
 
383
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
384
-	if ( true === $maybe_decrease_earnings ) {
383
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
384
+	if (true === $maybe_decrease_earnings) {
385 385
 		// Decrease earnings.
386
-		give_decrease_earnings( $payment->form_id, $payment->total );
386
+		give_decrease_earnings($payment->form_id, $payment->total);
387 387
 	}
388 388
 
389
-	$maybe_decrease_sales = apply_filters( 'give_decrease_sales_on_undo', true, $payment, $payment->form_id );
390
-	if ( true === $maybe_decrease_sales ) {
389
+	$maybe_decrease_sales = apply_filters('give_decrease_sales_on_undo', true, $payment, $payment->form_id);
390
+	if (true === $maybe_decrease_sales) {
391 391
 		// Decrease donation count.
392
-		give_decrease_purchase_count( $payment->form_id );
392
+		give_decrease_purchase_count($payment->form_id);
393 393
 	}
394 394
 
395 395
 }
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
  *
407 407
  * @return array $count Number of payments sorted by payment status.
408 408
  */
409
-function give_count_payments( $args = array() ) {
409
+function give_count_payments($args = array()) {
410 410
 
411 411
 	global $wpdb;
412 412
 
@@ -418,18 +418,18 @@  discard block
 block discarded – undo
418 418
 		'form_id'    => null,
419 419
 	);
420 420
 
421
-	$args = wp_parse_args( $args, $defaults );
421
+	$args = wp_parse_args($args, $defaults);
422 422
 
423 423
 	$select = 'SELECT p.post_status,count( * ) AS num_posts';
424 424
 	$join   = '';
425 425
 	$where  = "WHERE p.post_type = 'give_payment'";
426 426
 
427 427
 	// Count payments for a specific user.
428
-	if ( ! empty( $args['user'] ) ) {
428
+	if ( ! empty($args['user'])) {
429 429
 
430
-		if ( is_email( $args['user'] ) ) {
430
+		if (is_email($args['user'])) {
431 431
 			$field = 'email';
432
-		} elseif ( is_numeric( $args['user'] ) ) {
432
+		} elseif (is_numeric($args['user'])) {
433 433
 			$field = 'id';
434 434
 		} else {
435 435
 			$field = '';
@@ -437,105 +437,105 @@  discard block
 block discarded – undo
437 437
 
438 438
 		$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
439 439
 
440
-		if ( ! empty( $field ) ) {
440
+		if ( ! empty($field)) {
441 441
 			$where .= "
442 442
 				AND m.meta_key = '_give_payment_user_{$field}'
443 443
 				AND m.meta_value = '{$args['user']}'";
444 444
 		}
445 445
 
446 446
 		// Count payments for a search.
447
-	} elseif ( ! empty( $args['s'] ) ) {
447
+	} elseif ( ! empty($args['s'])) {
448 448
 
449
-		if ( is_email( $args['s'] ) || strlen( $args['s'] ) == 32 ) {
449
+		if (is_email($args['s']) || strlen($args['s']) == 32) {
450 450
 
451
-			if ( is_email( $args['s'] ) ) {
451
+			if (is_email($args['s'])) {
452 452
 				$field = '_give_payment_user_email';
453 453
 			} else {
454 454
 				$field = '_give_payment_purchase_key';
455 455
 			}
456 456
 
457 457
 			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
458
-			$where .= $wpdb->prepare( '
458
+			$where .= $wpdb->prepare('
459 459
                 AND m.meta_key = %s
460 460
                 AND m.meta_value = %s',
461 461
 				$field,
462 462
 				$args['s']
463 463
 			);
464 464
 
465
-		} elseif ( '#' == substr( $args['s'], 0, 1 ) ) {
465
+		} elseif ('#' == substr($args['s'], 0, 1)) {
466 466
 
467
-			$search = str_replace( '#:', '', $args['s'] );
468
-			$search = str_replace( '#', '', $search );
467
+			$search = str_replace('#:', '', $args['s']);
468
+			$search = str_replace('#', '', $search);
469 469
 
470 470
 			$select = 'SELECT p2.post_status,count( * ) AS num_posts ';
471 471
 			$join   = "LEFT JOIN $wpdb->postmeta m ON m.meta_key = '_give_log_payment_id' AND m.post_id = p.ID ";
472 472
 			$join .= "INNER JOIN $wpdb->posts p2 ON m.meta_value = p2.ID ";
473 473
 			$where = "WHERE p.post_type = 'give_log' ";
474
-			$where .= $wpdb->prepare( 'AND p.post_parent = %d} ', $search );
474
+			$where .= $wpdb->prepare('AND p.post_parent = %d} ', $search);
475 475
 
476
-		} elseif ( is_numeric( $args['s'] ) ) {
476
+		} elseif (is_numeric($args['s'])) {
477 477
 
478 478
 			$join = "LEFT JOIN $wpdb->postmeta m ON (p.ID = m.post_id)";
479
-			$where .= $wpdb->prepare( "
479
+			$where .= $wpdb->prepare("
480 480
 				AND m.meta_key = '_give_payment_user_id'
481 481
 				AND m.meta_value = %d",
482 482
 				$args['s']
483 483
 			);
484 484
 
485 485
 		} else {
486
-			$search = $wpdb->esc_like( $args['s'] );
487
-			$search = '%' . $search . '%';
486
+			$search = $wpdb->esc_like($args['s']);
487
+			$search = '%'.$search.'%';
488 488
 
489
-			$where .= $wpdb->prepare( 'AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))', $search, $search );
489
+			$where .= $wpdb->prepare('AND ((p.post_title LIKE %s) OR (p.post_content LIKE %s))', $search, $search);
490 490
 		}
491 491
 	}
492 492
 
493
-	if ( ! empty( $args['form_id'] ) && is_numeric( $args['form_id'] ) ) {
493
+	if ( ! empty($args['form_id']) && is_numeric($args['form_id'])) {
494 494
 
495
-		$where .= $wpdb->prepare( ' AND p.post_parent = %d', $args['form_id'] );
495
+		$where .= $wpdb->prepare(' AND p.post_parent = %d', $args['form_id']);
496 496
 
497 497
 	}
498 498
 	// Limit payments count by date.
499
-	if ( ! empty( $args['start-date'] ) && false !== strpos( $args['start-date'], '/' ) ) {
499
+	if ( ! empty($args['start-date']) && false !== strpos($args['start-date'], '/')) {
500 500
 
501
-		$date_parts = explode( '/', $args['start-date'] );
502
-		$month      = ! empty( $date_parts[0] ) && is_numeric( $date_parts[0] ) ? $date_parts[0] : 0;
503
-		$day        = ! empty( $date_parts[1] ) && is_numeric( $date_parts[1] ) ? $date_parts[1] : 0;
504
-		$year       = ! empty( $date_parts[2] ) && is_numeric( $date_parts[2] ) ? $date_parts[2] : 0;
501
+		$date_parts = explode('/', $args['start-date']);
502
+		$month      = ! empty($date_parts[0]) && is_numeric($date_parts[0]) ? $date_parts[0] : 0;
503
+		$day        = ! empty($date_parts[1]) && is_numeric($date_parts[1]) ? $date_parts[1] : 0;
504
+		$year       = ! empty($date_parts[2]) && is_numeric($date_parts[2]) ? $date_parts[2] : 0;
505 505
 
506
-		$is_date = checkdate( $month, $day, $year );
507
-		if ( false !== $is_date ) {
506
+		$is_date = checkdate($month, $day, $year);
507
+		if (false !== $is_date) {
508 508
 
509
-			$date = new DateTime( $args['start-date'] );
510
-			$where .= $wpdb->prepare( " AND p.post_date >= '%s'", $date->format( 'Y-m-d' ) );
509
+			$date = new DateTime($args['start-date']);
510
+			$where .= $wpdb->prepare(" AND p.post_date >= '%s'", $date->format('Y-m-d'));
511 511
 
512 512
 		}
513 513
 
514 514
 		// Fixes an issue with the payments list table counts when no end date is specified (partiy with stats class).
515
-		if ( empty( $args['end-date'] ) ) {
515
+		if (empty($args['end-date'])) {
516 516
 			$args['end-date'] = $args['start-date'];
517 517
 		}
518 518
 	}
519 519
 
520
-	if ( ! empty( $args['end-date'] ) && false !== strpos( $args['end-date'], '/' ) ) {
520
+	if ( ! empty($args['end-date']) && false !== strpos($args['end-date'], '/')) {
521 521
 
522
-		$date_parts = explode( '/', $args['end-date'] );
522
+		$date_parts = explode('/', $args['end-date']);
523 523
 
524
-		$month = ! empty( $date_parts[0] ) ? $date_parts[0] : 0;
525
-		$day   = ! empty( $date_parts[1] ) ? $date_parts[1] : 0;
526
-		$year  = ! empty( $date_parts[2] ) ? $date_parts[2] : 0;
524
+		$month = ! empty($date_parts[0]) ? $date_parts[0] : 0;
525
+		$day   = ! empty($date_parts[1]) ? $date_parts[1] : 0;
526
+		$year  = ! empty($date_parts[2]) ? $date_parts[2] : 0;
527 527
 
528
-		$is_date = checkdate( $month, $day, $year );
529
-		if ( false !== $is_date ) {
528
+		$is_date = checkdate($month, $day, $year);
529
+		if (false !== $is_date) {
530 530
 
531
-			$date = new DateTime( $args['end-date'] );
532
-			$where .= $wpdb->prepare( " AND p.post_date <= '%s'", $date->format( 'Y-m-d' ) );
531
+			$date = new DateTime($args['end-date']);
532
+			$where .= $wpdb->prepare(" AND p.post_date <= '%s'", $date->format('Y-m-d'));
533 533
 
534 534
 		}
535 535
 	}
536 536
 
537
-	$where = apply_filters( 'give_count_payments_where', $where );
538
-	$join  = apply_filters( 'give_count_payments_join', $join );
537
+	$where = apply_filters('give_count_payments_where', $where);
538
+	$join  = apply_filters('give_count_payments_join', $join);
539 539
 
540 540
 	$query = "$select
541 541
 		FROM $wpdb->posts p
@@ -544,36 +544,36 @@  discard block
 block discarded – undo
544 544
 		GROUP BY p.post_status
545 545
 	";
546 546
 
547
-	$cache_key = md5( $query );
547
+	$cache_key = md5($query);
548 548
 
549
-	$count = wp_cache_get( $cache_key, 'counts' );
550
-	if ( false !== $count ) {
549
+	$count = wp_cache_get($cache_key, 'counts');
550
+	if (false !== $count) {
551 551
 		return $count;
552 552
 	}
553 553
 
554
-	$count = $wpdb->get_results( $query, ARRAY_A );
554
+	$count = $wpdb->get_results($query, ARRAY_A);
555 555
 
556 556
 	$stats    = array();
557 557
 	$statuses = get_post_stati();
558
-	if ( isset( $statuses['private'] ) && empty( $args['s'] ) ) {
559
-		unset( $statuses['private'] );
558
+	if (isset($statuses['private']) && empty($args['s'])) {
559
+		unset($statuses['private']);
560 560
 	}
561 561
 
562
-	foreach ( $statuses as $state ) {
563
-		$stats[ $state ] = 0;
562
+	foreach ($statuses as $state) {
563
+		$stats[$state] = 0;
564 564
 	}
565 565
 
566
-	foreach ( (array) $count as $row ) {
566
+	foreach ((array) $count as $row) {
567 567
 
568
-		if ( 'private' == $row['post_status'] && empty( $args['s'] ) ) {
568
+		if ('private' == $row['post_status'] && empty($args['s'])) {
569 569
 			continue;
570 570
 		}
571 571
 
572
-		$stats[ $row['post_status'] ] = $row['num_posts'];
572
+		$stats[$row['post_status']] = $row['num_posts'];
573 573
 	}
574 574
 
575 575
 	$stats = (object) $stats;
576
-	wp_cache_set( $cache_key, $stats, 'counts' );
576
+	wp_cache_set($cache_key, $stats, 'counts');
577 577
 
578 578
 	return $stats;
579 579
 }
@@ -588,11 +588,11 @@  discard block
 block discarded – undo
588 588
  *
589 589
  * @return bool $exists True if payment exists, false otherwise.
590 590
  */
591
-function give_check_for_existing_payment( $payment_id ) {
591
+function give_check_for_existing_payment($payment_id) {
592 592
 	$exists  = false;
593
-	$payment = new Give_Payment( $payment_id );
593
+	$payment = new Give_Payment($payment_id);
594 594
 
595
-	if ( $payment_id === $payment->ID && 'publish' === $payment->status ) {
595
+	if ($payment_id === $payment->ID && 'publish' === $payment->status) {
596 596
 		$exists = true;
597 597
 	}
598 598
 
@@ -610,31 +610,31 @@  discard block
 block discarded – undo
610 610
  *
611 611
  * @return bool|mixed True if payment status exists, false otherwise.
612 612
  */
613
-function give_get_payment_status( $payment, $return_label = false ) {
613
+function give_get_payment_status($payment, $return_label = false) {
614 614
 
615
-	if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) {
615
+	if ( ! is_object($payment) || ! isset($payment->post_status)) {
616 616
 		return false;
617 617
 	}
618 618
 
619 619
 	$statuses = give_get_payment_statuses();
620 620
 
621
-	if ( ! is_array( $statuses ) || empty( $statuses ) ) {
621
+	if ( ! is_array($statuses) || empty($statuses)) {
622 622
 		return false;
623 623
 	}
624 624
 
625 625
 	// Get payment object if no already given.
626
-	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment( $payment->ID );
626
+	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment($payment->ID);
627 627
 
628
-	if ( array_key_exists( $payment->status, $statuses ) ) {
629
-		if ( true === $return_label ) {
628
+	if (array_key_exists($payment->status, $statuses)) {
629
+		if (true === $return_label) {
630 630
 			// Return translated status label.
631
-			return $statuses[ $payment->status ];
631
+			return $statuses[$payment->status];
632 632
 		} else {
633 633
 			// Account that our 'publish' status is labeled 'Complete'
634 634
 			$post_status = 'publish' == $payment->status ? 'Complete' : $payment->post_status;
635 635
 
636 636
 			// Make sure we're matching cases, since they matter
637
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
637
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
638 638
 		}
639 639
 	}
640 640
 
@@ -650,17 +650,17 @@  discard block
 block discarded – undo
650 650
  */
651 651
 function give_get_payment_statuses() {
652 652
 	$payment_statuses = array(
653
-		'pending'     => __( 'Pending', 'give' ),
654
-		'publish'     => __( 'Complete', 'give' ),
655
-		'refunded'    => __( 'Refunded', 'give' ),
656
-		'failed'      => __( 'Failed', 'give' ),
657
-		'cancelled'   => __( 'Cancelled', 'give' ),
658
-		'abandoned'   => __( 'Abandoned', 'give' ),
659
-		'preapproval' => __( 'Pre-Approved', 'give' ),
660
-		'revoked'     => __( 'Revoked', 'give' ),
653
+		'pending'     => __('Pending', 'give'),
654
+		'publish'     => __('Complete', 'give'),
655
+		'refunded'    => __('Refunded', 'give'),
656
+		'failed'      => __('Failed', 'give'),
657
+		'cancelled'   => __('Cancelled', 'give'),
658
+		'abandoned'   => __('Abandoned', 'give'),
659
+		'preapproval' => __('Pre-Approved', 'give'),
660
+		'revoked'     => __('Revoked', 'give'),
661 661
 	);
662 662
 
663
-	return apply_filters( 'give_payment_statuses', $payment_statuses );
663
+	return apply_filters('give_payment_statuses', $payment_statuses);
664 664
 }
665 665
 
666 666
 /**
@@ -673,10 +673,10 @@  discard block
 block discarded – undo
673 673
  * @return array $payment_status All the available payment statuses.
674 674
  */
675 675
 function give_get_payment_status_keys() {
676
-	$statuses = array_keys( give_get_payment_statuses() );
677
-	asort( $statuses );
676
+	$statuses = array_keys(give_get_payment_statuses());
677
+	asort($statuses);
678 678
 
679
-	return array_values( $statuses );
679
+	return array_values($statuses);
680 680
 }
681 681
 
682 682
 /**
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
  *
692 692
  * @return int $earnings  Earnings
693 693
  */
694
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
694
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
695 695
 
696 696
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
697 697
 	global $wpdb;
@@ -701,41 +701,41 @@  discard block
 block discarded – undo
701 701
 		'nopaging'               => true,
702 702
 		'year'                   => $year,
703 703
 		'monthnum'               => $month_num,
704
-		'post_status'            => array( 'publish' ),
704
+		'post_status'            => array('publish'),
705 705
 		'fields'                 => 'ids',
706 706
 		'update_post_term_cache' => false,
707 707
 	);
708
-	if ( ! empty( $day ) ) {
708
+	if ( ! empty($day)) {
709 709
 		$args['day'] = $day;
710 710
 	}
711 711
 
712
-	if ( ! empty( $hour ) ) {
712
+	if ( ! empty($hour)) {
713 713
 		$args['hour'] = $hour;
714 714
 	}
715 715
 
716
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
717
-	$key  = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 );
716
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
717
+	$key  = 'give_stats_'.substr(md5(serialize($args)), 0, 15);
718 718
 
719
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
719
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
720 720
 		$earnings = false;
721 721
 	} else {
722
-		$earnings = get_transient( $key );
722
+		$earnings = get_transient($key);
723 723
 	}
724 724
 
725
-	if ( false === $earnings ) {
726
-		$sales    = get_posts( $args );
725
+	if (false === $earnings) {
726
+		$sales    = get_posts($args);
727 727
 		$earnings = 0;
728
-		if ( $sales ) {
729
-			$sales = implode( ',', $sales );
728
+		if ($sales) {
729
+			$sales = implode(',', $sales);
730 730
 
731
-			$earnings = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})" );
731
+			$earnings = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$sales})");
732 732
 
733 733
 		}
734 734
 		// Cache the results for one hour.
735
-		set_transient( $key, $earnings, HOUR_IN_SECONDS );
735
+		set_transient($key, $earnings, HOUR_IN_SECONDS);
736 736
 	}
737 737
 
738
-	return round( $earnings, 2 );
738
+	return round($earnings, 2);
739 739
 }
740 740
 
741 741
 /**
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
  *
751 751
  * @return int $count     Sales
752 752
  */
753
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
753
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
754 754
 
755 755
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead.
756 756
 	$args = array(
@@ -758,14 +758,14 @@  discard block
 block discarded – undo
758 758
 		'nopaging'               => true,
759 759
 		'year'                   => $year,
760 760
 		'fields'                 => 'ids',
761
-		'post_status'            => array( 'publish' ),
761
+		'post_status'            => array('publish'),
762 762
 		'update_post_meta_cache' => false,
763 763
 		'update_post_term_cache' => false,
764 764
 	);
765 765
 
766
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
766
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
767 767
 
768
-	if ( false === $show_free ) {
768
+	if (false === $show_free) {
769 769
 		$args['meta_query'] = array(
770 770
 			array(
771 771
 				'key'     => '_give_payment_total',
@@ -776,33 +776,33 @@  discard block
 block discarded – undo
776 776
 		);
777 777
 	}
778 778
 
779
-	if ( ! empty( $month_num ) ) {
779
+	if ( ! empty($month_num)) {
780 780
 		$args['monthnum'] = $month_num;
781 781
 	}
782 782
 
783
-	if ( ! empty( $day ) ) {
783
+	if ( ! empty($day)) {
784 784
 		$args['day'] = $day;
785 785
 	}
786 786
 
787
-	if ( ! empty( $hour ) ) {
787
+	if ( ! empty($hour)) {
788 788
 		$args['hour'] = $hour;
789 789
 	}
790 790
 
791
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
791
+	$args = apply_filters('give_get_sales_by_date_args', $args);
792 792
 
793
-	$key = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 );
793
+	$key = 'give_stats_'.substr(md5(serialize($args)), 0, 15);
794 794
 
795
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
795
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
796 796
 		$count = false;
797 797
 	} else {
798
-		$count = get_transient( $key );
798
+		$count = get_transient($key);
799 799
 	}
800 800
 
801
-	if ( false === $count ) {
802
-		$sales = new WP_Query( $args );
801
+	if (false === $count) {
802
+		$sales = new WP_Query($args);
803 803
 		$count = (int) $sales->post_count;
804 804
 		// Cache the results for one hour.
805
-		set_transient( $key, $count, HOUR_IN_SECONDS );
805
+		set_transient($key, $count, HOUR_IN_SECONDS);
806 806
 	}
807 807
 
808 808
 	return $count;
@@ -817,19 +817,19 @@  discard block
 block discarded – undo
817 817
  *
818 818
  * @return bool $ret True if complete, false otherwise.
819 819
  */
820
-function give_is_payment_complete( $payment_id ) {
821
-	$payment = new Give_Payment( $payment_id );
820
+function give_is_payment_complete($payment_id) {
821
+	$payment = new Give_Payment($payment_id);
822 822
 
823 823
 	$ret = false;
824 824
 
825
-	if ( $payment->ID > 0 ) {
825
+	if ($payment->ID > 0) {
826 826
 
827
-		if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) {
827
+		if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) {
828 828
 			$ret = true;
829 829
 		}
830 830
 	}
831 831
 
832
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status );
832
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status);
833 833
 }
834 834
 
835 835
 /**
@@ -855,57 +855,57 @@  discard block
 block discarded – undo
855 855
  */
856 856
 function give_get_total_earnings() {
857 857
 
858
-	$total = get_option( 'give_earnings_total', false );
858
+	$total = get_option('give_earnings_total', false);
859 859
 
860 860
 	// If no total stored in DB, use old method of calculating total earnings.
861
-	if ( false === $total ) {
861
+	if (false === $total) {
862 862
 
863 863
 		global $wpdb;
864 864
 
865
-		$total = get_transient( 'give_earnings_total' );
865
+		$total = get_transient('give_earnings_total');
866 866
 
867
-		if ( false === $total ) {
867
+		if (false === $total) {
868 868
 
869 869
 			$total = (float) 0;
870 870
 
871
-			$args = apply_filters( 'give_get_total_earnings_args', array(
871
+			$args = apply_filters('give_get_total_earnings_args', array(
872 872
 				'offset' => 0,
873
-				'number' => - 1,
874
-				'status' => array( 'publish' ),
873
+				'number' => -1,
874
+				'status' => array('publish'),
875 875
 				'fields' => 'ids',
876
-			) );
876
+			));
877 877
 
878
-			$payments = give_get_payments( $args );
879
-			if ( $payments ) {
878
+			$payments = give_get_payments($args);
879
+			if ($payments) {
880 880
 
881 881
 				/**
882 882
 				 * If performing a donation, we need to skip the very last payment in the database,
883 883
 				 * since it calls give_increase_total_earnings() on completion,
884 884
 				 * which results in duplicated earnings for the very first donation.
885 885
 				 */
886
-				if ( did_action( 'give_update_payment_status' ) ) {
887
-					array_pop( $payments );
886
+				if (did_action('give_update_payment_status')) {
887
+					array_pop($payments);
888 888
 				}
889 889
 
890
-				if ( ! empty( $payments ) ) {
891
-					$payments = implode( ',', $payments );
892
-					$total += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})" );
890
+				if ( ! empty($payments)) {
891
+					$payments = implode(',', $payments);
892
+					$total += $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})");
893 893
 				}
894 894
 			}
895 895
 
896 896
 			// Cache results for 1 day. This cache is cleared automatically when a payment is made.
897
-			set_transient( 'give_earnings_total', $total, 86400 );
897
+			set_transient('give_earnings_total', $total, 86400);
898 898
 
899 899
 			// Store the total for the first time.
900
-			update_option( 'give_earnings_total', $total );
900
+			update_option('give_earnings_total', $total);
901 901
 		}
902 902
 	}
903 903
 
904
-	if ( $total < 0 ) {
904
+	if ($total < 0) {
905 905
 		$total = 0; // Don't ever show negative earnings.
906 906
 	}
907 907
 
908
-	return apply_filters( 'give_total_earnings', round( $total, give_currency_decimal_filter() ) );
908
+	return apply_filters('give_total_earnings', round($total, give_currency_decimal_filter()));
909 909
 }
910 910
 
911 911
 /**
@@ -918,10 +918,10 @@  discard block
 block discarded – undo
918 918
  *
919 919
  * @return float $total  Total earnings.
920 920
  */
921
-function give_increase_total_earnings( $amount = 0 ) {
921
+function give_increase_total_earnings($amount = 0) {
922 922
 	$total = give_get_total_earnings();
923 923
 	$total += $amount;
924
-	update_option( 'give_earnings_total', $total );
924
+	update_option('give_earnings_total', $total);
925 925
 
926 926
 	return $total;
927 927
 }
@@ -935,13 +935,13 @@  discard block
 block discarded – undo
935 935
  *
936 936
  * @return float $total Total earnings.
937 937
  */
938
-function give_decrease_total_earnings( $amount = 0 ) {
938
+function give_decrease_total_earnings($amount = 0) {
939 939
 	$total = give_get_total_earnings();
940 940
 	$total -= $amount;
941
-	if ( $total < 0 ) {
941
+	if ($total < 0) {
942 942
 		$total = 0;
943 943
 	}
944
-	update_option( 'give_earnings_total', $total );
944
+	update_option('give_earnings_total', $total);
945 945
 
946 946
 	return $total;
947 947
 }
@@ -957,10 +957,10 @@  discard block
 block discarded – undo
957 957
  *
958 958
  * @return mixed $meta Payment Meta.
959 959
  */
960
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
961
-	$payment = new Give_Payment( $payment_id );
960
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
961
+	$payment = new Give_Payment($payment_id);
962 962
 
963
-	return $payment->get_meta( $meta_key, $single );
963
+	return $payment->get_meta($meta_key, $single);
964 964
 }
965 965
 
966 966
 /**
@@ -973,10 +973,10 @@  discard block
 block discarded – undo
973 973
  *
974 974
  * @return mixed Meta ID if successful, false if unsuccessful.
975 975
  */
976
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
977
-	$payment = new Give_Payment( $payment_id );
976
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
977
+	$payment = new Give_Payment($payment_id);
978 978
 
979
-	return $payment->update_meta( $meta_key, $meta_value, $prev_value );
979
+	return $payment->update_meta($meta_key, $meta_value, $prev_value);
980 980
 }
981 981
 
982 982
 /**
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
  *
989 989
  * @return string $user_info User Info Meta Values.
990 990
  */
991
-function give_get_payment_meta_user_info( $payment_id ) {
992
-	$payment = new Give_Payment( $payment_id );
991
+function give_get_payment_meta_user_info($payment_id) {
992
+	$payment = new Give_Payment($payment_id);
993 993
 
994 994
 	return $payment->user_info;
995 995
 }
@@ -1005,8 +1005,8 @@  discard block
 block discarded – undo
1005 1005
  *
1006 1006
  * @return int $form_id Form ID.
1007 1007
  */
1008
-function give_get_payment_form_id( $payment_id ) {
1009
-	$payment = new Give_Payment( $payment_id );
1008
+function give_get_payment_form_id($payment_id) {
1009
+	$payment = new Give_Payment($payment_id);
1010 1010
 
1011 1011
 	return $payment->form_id;
1012 1012
 }
@@ -1020,8 +1020,8 @@  discard block
 block discarded – undo
1020 1020
  *
1021 1021
  * @return string $email User email.
1022 1022
  */
1023
-function give_get_payment_user_email( $payment_id ) {
1024
-	$payment = new Give_Payment( $payment_id );
1023
+function give_get_payment_user_email($payment_id) {
1024
+	$payment = new Give_Payment($payment_id);
1025 1025
 
1026 1026
 	return $payment->email;
1027 1027
 }
@@ -1035,11 +1035,11 @@  discard block
 block discarded – undo
1035 1035
  *
1036 1036
  * @return bool $is_guest_payment If the payment is associated with a user (false) or not (true)
1037 1037
  */
1038
-function give_is_guest_payment( $payment_id ) {
1039
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
1040
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
1038
+function give_is_guest_payment($payment_id) {
1039
+	$payment_user_id  = give_get_payment_user_id($payment_id);
1040
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
1041 1041
 
1042
-	return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id );
1042
+	return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id);
1043 1043
 }
1044 1044
 
1045 1045
 /**
@@ -1051,8 +1051,8 @@  discard block
 block discarded – undo
1051 1051
  *
1052 1052
  * @return int $user_id User ID.
1053 1053
  */
1054
-function give_get_payment_user_id( $payment_id ) {
1055
-	$payment = new Give_Payment( $payment_id );
1054
+function give_get_payment_user_id($payment_id) {
1055
+	$payment = new Give_Payment($payment_id);
1056 1056
 
1057 1057
 	return $payment->user_id;
1058 1058
 }
@@ -1066,8 +1066,8 @@  discard block
 block discarded – undo
1066 1066
  *
1067 1067
  * @return int $customer_id Customer ID.
1068 1068
  */
1069
-function give_get_payment_customer_id( $payment_id ) {
1070
-	$payment = new Give_Payment( $payment_id );
1069
+function give_get_payment_customer_id($payment_id) {
1070
+	$payment = new Give_Payment($payment_id);
1071 1071
 
1072 1072
 	return $payment->customer_id;
1073 1073
 }
@@ -1081,8 +1081,8 @@  discard block
 block discarded – undo
1081 1081
  *
1082 1082
  * @return string $ip User IP.
1083 1083
  */
1084
-function give_get_payment_user_ip( $payment_id ) {
1085
-	$payment = new Give_Payment( $payment_id );
1084
+function give_get_payment_user_ip($payment_id) {
1085
+	$payment = new Give_Payment($payment_id);
1086 1086
 
1087 1087
 	return $payment->ip;
1088 1088
 }
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
  *
1097 1097
  * @return string $date The date the payment was completed.
1098 1098
  */
1099
-function give_get_payment_completed_date( $payment_id = 0 ) {
1100
-	$payment = new Give_Payment( $payment_id );
1099
+function give_get_payment_completed_date($payment_id = 0) {
1100
+	$payment = new Give_Payment($payment_id);
1101 1101
 
1102 1102
 	return $payment->completed_date;
1103 1103
 }
@@ -1111,8 +1111,8 @@  discard block
 block discarded – undo
1111 1111
  *
1112 1112
  * @return string $gateway Gateway.
1113 1113
  */
1114
-function give_get_payment_gateway( $payment_id ) {
1115
-	$payment = new Give_Payment( $payment_id );
1114
+function give_get_payment_gateway($payment_id) {
1115
+	$payment = new Give_Payment($payment_id);
1116 1116
 
1117 1117
 	return $payment->gateway;
1118 1118
 }
@@ -1126,8 +1126,8 @@  discard block
 block discarded – undo
1126 1126
  *
1127 1127
  * @return string $currency The currency code.
1128 1128
  */
1129
-function give_get_payment_currency_code( $payment_id = 0 ) {
1130
-	$payment = new Give_Payment( $payment_id );
1129
+function give_get_payment_currency_code($payment_id = 0) {
1130
+	$payment = new Give_Payment($payment_id);
1131 1131
 
1132 1132
 	return $payment->currency;
1133 1133
 }
@@ -1141,10 +1141,10 @@  discard block
 block discarded – undo
1141 1141
  *
1142 1142
  * @return string $currency The currency name.
1143 1143
  */
1144
-function give_get_payment_currency( $payment_id = 0 ) {
1145
-	$currency = give_get_payment_currency_code( $payment_id );
1144
+function give_get_payment_currency($payment_id = 0) {
1145
+	$currency = give_get_payment_currency_code($payment_id);
1146 1146
 
1147
-	return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id );
1147
+	return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id);
1148 1148
 }
1149 1149
 
1150 1150
 /**
@@ -1156,8 +1156,8 @@  discard block
 block discarded – undo
1156 1156
  *
1157 1157
  * @return string $key Donation key.
1158 1158
  */
1159
-function give_get_payment_key( $payment_id = 0 ) {
1160
-	$payment = new Give_Payment( $payment_id );
1159
+function give_get_payment_key($payment_id = 0) {
1160
+	$payment = new Give_Payment($payment_id);
1161 1161
 
1162 1162
 	return $payment->key;
1163 1163
 }
@@ -1173,8 +1173,8 @@  discard block
 block discarded – undo
1173 1173
  *
1174 1174
  * @return string $number Payment order number.
1175 1175
  */
1176
-function give_get_payment_number( $payment_id = 0 ) {
1177
-	$payment = new Give_Payment( $payment_id );
1176
+function give_get_payment_number($payment_id = 0) {
1177
+	$payment = new Give_Payment($payment_id);
1178 1178
 
1179 1179
 	return $payment->number;
1180 1180
 }
@@ -1188,23 +1188,23 @@  discard block
 block discarded – undo
1188 1188
  *
1189 1189
  * @return string      The formatted payment number.
1190 1190
  */
1191
-function give_format_payment_number( $number ) {
1191
+function give_format_payment_number($number) {
1192 1192
 
1193
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1193
+	if ( ! give_get_option('enable_sequential')) {
1194 1194
 		return $number;
1195 1195
 	}
1196 1196
 
1197
-	if ( ! is_numeric( $number ) ) {
1197
+	if ( ! is_numeric($number)) {
1198 1198
 		return $number;
1199 1199
 	}
1200 1200
 
1201
-	$prefix  = give_get_option( 'sequential_prefix' );
1202
-	$number  = absint( $number );
1203
-	$postfix = give_get_option( 'sequential_postfix' );
1201
+	$prefix  = give_get_option('sequential_prefix');
1202
+	$number  = absint($number);
1203
+	$postfix = give_get_option('sequential_postfix');
1204 1204
 
1205
-	$formatted_number = $prefix . $number . $postfix;
1205
+	$formatted_number = $prefix.$number.$postfix;
1206 1206
 
1207
-	return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix );
1207
+	return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix);
1208 1208
 }
1209 1209
 
1210 1210
 /**
@@ -1217,17 +1217,17 @@  discard block
 block discarded – undo
1217 1217
  */
1218 1218
 function give_get_next_payment_number() {
1219 1219
 
1220
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1220
+	if ( ! give_get_option('enable_sequential')) {
1221 1221
 		return false;
1222 1222
 	}
1223 1223
 
1224
-	$number           = get_option( 'give_last_payment_number' );
1225
-	$start            = give_get_option( 'sequential_start', 1 );
1224
+	$number           = get_option('give_last_payment_number');
1225
+	$start            = give_get_option('sequential_start', 1);
1226 1226
 	$increment_number = true;
1227 1227
 
1228
-	if ( false !== $number ) {
1228
+	if (false !== $number) {
1229 1229
 
1230
-		if ( empty( $number ) ) {
1230
+		if (empty($number)) {
1231 1231
 
1232 1232
 			$number           = $start;
1233 1233
 			$increment_number = false;
@@ -1236,24 +1236,24 @@  discard block
 block discarded – undo
1236 1236
 	} else {
1237 1237
 
1238 1238
 		// This case handles the first addition of the new option, as well as if it get's deleted for any reason.
1239
-		$payments     = new Give_Payments_Query( array(
1239
+		$payments = new Give_Payments_Query(array(
1240 1240
 			'number'  => 1,
1241 1241
 			'order'   => 'DESC',
1242 1242
 			'orderby' => 'ID',
1243 1243
 			'output'  => 'posts',
1244 1244
 			'fields'  => 'ids',
1245
-		) );
1245
+		));
1246 1246
 		$last_payment = $payments->get_payments();
1247 1247
 
1248
-		if ( ! empty( $last_payment ) ) {
1248
+		if ( ! empty($last_payment)) {
1249 1249
 
1250
-			$number = give_get_payment_number( $last_payment[0] );
1250
+			$number = give_get_payment_number($last_payment[0]);
1251 1251
 
1252 1252
 		}
1253 1253
 
1254
-		if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) {
1254
+		if ( ! empty($number) && $number !== (int) $last_payment[0]) {
1255 1255
 
1256
-			$number = give_remove_payment_prefix_postfix( $number );
1256
+			$number = give_remove_payment_prefix_postfix($number);
1257 1257
 
1258 1258
 		} else {
1259 1259
 
@@ -1262,13 +1262,13 @@  discard block
 block discarded – undo
1262 1262
 		}
1263 1263
 	}
1264 1264
 
1265
-	$increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number );
1265
+	$increment_number = apply_filters('give_increment_payment_number', $increment_number, $number);
1266 1266
 
1267
-	if ( $increment_number ) {
1268
-		$number ++;
1267
+	if ($increment_number) {
1268
+		$number++;
1269 1269
 	}
1270 1270
 
1271
-	return apply_filters( 'give_get_next_payment_number', $number );
1271
+	return apply_filters('give_get_next_payment_number', $number);
1272 1272
 }
1273 1273
 
1274 1274
 /**
@@ -1280,25 +1280,25 @@  discard block
 block discarded – undo
1280 1280
  *
1281 1281
  * @return string The new Payment number without prefix and postfix.
1282 1282
  */
1283
-function give_remove_payment_prefix_postfix( $number ) {
1283
+function give_remove_payment_prefix_postfix($number) {
1284 1284
 
1285
-	$prefix  = give_get_option( 'sequential_prefix' );
1286
-	$postfix = give_get_option( 'sequential_postfix' );
1285
+	$prefix  = give_get_option('sequential_prefix');
1286
+	$postfix = give_get_option('sequential_postfix');
1287 1287
 
1288 1288
 	// Remove prefix.
1289
-	$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
1289
+	$number = preg_replace('/'.$prefix.'/', '', $number, 1);
1290 1290
 
1291 1291
 	// Remove the postfix.
1292
-	$length      = strlen( $number );
1293
-	$postfix_pos = strrpos( $number, $postfix );
1294
-	if ( false !== $postfix_pos ) {
1295
-		$number = substr_replace( $number, '', $postfix_pos, $length );
1292
+	$length      = strlen($number);
1293
+	$postfix_pos = strrpos($number, $postfix);
1294
+	if (false !== $postfix_pos) {
1295
+		$number = substr_replace($number, '', $postfix_pos, $length);
1296 1296
 	}
1297 1297
 
1298 1298
 	// Ensure it's a whole number.
1299
-	$number = intval( $number );
1299
+	$number = intval($number);
1300 1300
 
1301
-	return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix );
1301
+	return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix);
1302 1302
 
1303 1303
 }
1304 1304
 
@@ -1314,10 +1314,10 @@  discard block
 block discarded – undo
1314 1314
  *
1315 1315
  * @return string $amount Fully formatted payment amount.
1316 1316
  */
1317
-function give_payment_amount( $payment_id = 0 ) {
1318
-	$amount = give_get_payment_amount( $payment_id );
1317
+function give_payment_amount($payment_id = 0) {
1318
+	$amount = give_get_payment_amount($payment_id);
1319 1319
 
1320
-	return give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment_id ) );
1320
+	return give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment_id));
1321 1321
 }
1322 1322
 
1323 1323
 /**
@@ -1330,11 +1330,11 @@  discard block
 block discarded – undo
1330 1330
  *
1331 1331
  * @return mixed|void
1332 1332
  */
1333
-function give_get_payment_amount( $payment_id ) {
1333
+function give_get_payment_amount($payment_id) {
1334 1334
 
1335
-	$payment = new Give_Payment( $payment_id );
1335
+	$payment = new Give_Payment($payment_id);
1336 1336
 
1337
-	return apply_filters( 'give_payment_amount', floatval( $payment->total ), $payment_id );
1337
+	return apply_filters('give_payment_amount', floatval($payment->total), $payment_id);
1338 1338
 }
1339 1339
 
1340 1340
 /**
@@ -1350,10 +1350,10 @@  discard block
 block discarded – undo
1350 1350
  *
1351 1351
  * @return array Fully formatted payment subtotal.
1352 1352
  */
1353
-function give_payment_subtotal( $payment_id = 0 ) {
1354
-	$subtotal = give_get_payment_subtotal( $payment_id );
1353
+function give_payment_subtotal($payment_id = 0) {
1354
+	$subtotal = give_get_payment_subtotal($payment_id);
1355 1355
 
1356
-	return give_currency_filter( give_format_amount( $subtotal ), give_get_payment_currency_code( $payment_id ) );
1356
+	return give_currency_filter(give_format_amount($subtotal), give_get_payment_currency_code($payment_id));
1357 1357
 }
1358 1358
 
1359 1359
 /**
@@ -1367,8 +1367,8 @@  discard block
 block discarded – undo
1367 1367
  *
1368 1368
  * @return float $subtotal Subtotal for payment (non formatted).
1369 1369
  */
1370
-function give_get_payment_subtotal( $payment_id = 0 ) {
1371
-	$payment = new G_Payment( $payment_id );
1370
+function give_get_payment_subtotal($payment_id = 0) {
1371
+	$payment = new G_Payment($payment_id);
1372 1372
 
1373 1373
 	return $payment->subtotal;
1374 1374
 }
@@ -1383,10 +1383,10 @@  discard block
 block discarded – undo
1383 1383
  *
1384 1384
  * @return mixed array if payment fees found, false otherwise.
1385 1385
  */
1386
-function give_get_payment_fees( $payment_id = 0, $type = 'all' ) {
1387
-	$payment = new Give_Payment( $payment_id );
1386
+function give_get_payment_fees($payment_id = 0, $type = 'all') {
1387
+	$payment = new Give_Payment($payment_id);
1388 1388
 
1389
-	return $payment->get_fees( $type );
1389
+	return $payment->get_fees($type);
1390 1390
 }
1391 1391
 
1392 1392
 /**
@@ -1398,8 +1398,8 @@  discard block
 block discarded – undo
1398 1398
  *
1399 1399
  * @return string The donation ID.
1400 1400
  */
1401
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1402
-	$payment = new Give_Payment( $payment_id );
1401
+function give_get_payment_transaction_id($payment_id = 0) {
1402
+	$payment = new Give_Payment($payment_id);
1403 1403
 
1404 1404
 	return $payment->transaction_id;
1405 1405
 }
@@ -1414,15 +1414,15 @@  discard block
 block discarded – undo
1414 1414
  *
1415 1415
  * @return bool|mixed
1416 1416
  */
1417
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1417
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1418 1418
 
1419
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1419
+	if (empty($payment_id) || empty($transaction_id)) {
1420 1420
 		return false;
1421 1421
 	}
1422 1422
 
1423
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1423
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1424 1424
 
1425
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1425
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1426 1426
 }
1427 1427
 
1428 1428
 /**
@@ -1435,12 +1435,12 @@  discard block
 block discarded – undo
1435 1435
  *
1436 1436
  * @return int $purchase Donation ID.
1437 1437
  */
1438
-function give_get_purchase_id_by_key( $key ) {
1438
+function give_get_purchase_id_by_key($key) {
1439 1439
 	global $wpdb;
1440 1440
 
1441
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key ) );
1441
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_purchase_key' AND meta_value = %s LIMIT 1", $key));
1442 1442
 
1443
-	if ( $purchase != null ) {
1443
+	if ($purchase != null) {
1444 1444
 		return $purchase;
1445 1445
 	}
1446 1446
 
@@ -1458,12 +1458,12 @@  discard block
 block discarded – undo
1458 1458
  *
1459 1459
  * @return int $purchase Donation ID.
1460 1460
  */
1461
-function give_get_purchase_id_by_transaction_id( $key ) {
1461
+function give_get_purchase_id_by_transaction_id($key) {
1462 1462
 	global $wpdb;
1463 1463
 
1464
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
1464
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key));
1465 1465
 
1466
-	if ( $purchase != null ) {
1466
+	if ($purchase != null) {
1467 1467
 		return $purchase;
1468 1468
 	}
1469 1469
 
@@ -1480,19 +1480,19 @@  discard block
 block discarded – undo
1480 1480
  *
1481 1481
  * @return array $notes Donation Notes
1482 1482
  */
1483
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1483
+function give_get_payment_notes($payment_id = 0, $search = '') {
1484 1484
 
1485
-	if ( empty( $payment_id ) && empty( $search ) ) {
1485
+	if (empty($payment_id) && empty($search)) {
1486 1486
 		return false;
1487 1487
 	}
1488 1488
 
1489
-	remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1490
-	remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 );
1489
+	remove_action('pre_get_comments', 'give_hide_payment_notes', 10);
1490
+	remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10);
1491 1491
 
1492
-	$notes = get_comments( array( 'post_id' => $payment_id, 'order' => 'ASC', 'search' => $search ) );
1492
+	$notes = get_comments(array('post_id' => $payment_id, 'order' => 'ASC', 'search' => $search));
1493 1493
 
1494
-	add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1495
-	add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1494
+	add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1495
+	add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1496 1496
 
1497 1497
 	return $notes;
1498 1498
 }
@@ -1508,8 +1508,8 @@  discard block
 block discarded – undo
1508 1508
  *
1509 1509
  * @return int The new note ID
1510 1510
  */
1511
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1512
-	if ( empty( $payment_id ) ) {
1511
+function give_insert_payment_note($payment_id = 0, $note = '') {
1512
+	if (empty($payment_id)) {
1513 1513
 		return false;
1514 1514
 	}
1515 1515
 
@@ -1521,14 +1521,14 @@  discard block
 block discarded – undo
1521 1521
 	 * @param int    $payment_id Payment ID.
1522 1522
 	 * @param string $note       The note.
1523 1523
 	 */
1524
-	do_action( 'give_pre_insert_payment_note', $payment_id, $note );
1524
+	do_action('give_pre_insert_payment_note', $payment_id, $note);
1525 1525
 
1526
-	$note_id = wp_insert_comment( wp_filter_comment( array(
1526
+	$note_id = wp_insert_comment(wp_filter_comment(array(
1527 1527
 		'comment_post_ID'      => $payment_id,
1528 1528
 		'comment_content'      => $note,
1529 1529
 		'user_id'              => is_admin() ? get_current_user_id() : 0,
1530
-		'comment_date'         => current_time( 'mysql' ),
1531
-		'comment_date_gmt'     => current_time( 'mysql', 1 ),
1530
+		'comment_date'         => current_time('mysql'),
1531
+		'comment_date_gmt'     => current_time('mysql', 1),
1532 1532
 		'comment_approved'     => 1,
1533 1533
 		'comment_parent'       => 0,
1534 1534
 		'comment_author'       => '',
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 		'comment_author_email' => '',
1538 1538
 		'comment_type'         => 'give_payment_note',
1539 1539
 
1540
-	) ) );
1540
+	)));
1541 1541
 
1542 1542
 	/**
1543 1543
 	 * Fires after payment note inserted.
@@ -1548,7 +1548,7 @@  discard block
 block discarded – undo
1548 1548
 	 * @param int    $payment_id Payment ID.
1549 1549
 	 * @param string $note       The note.
1550 1550
 	 */
1551
-	do_action( 'give_insert_payment_note', $note_id, $payment_id, $note );
1551
+	do_action('give_insert_payment_note', $note_id, $payment_id, $note);
1552 1552
 
1553 1553
 	return $note_id;
1554 1554
 }
@@ -1563,8 +1563,8 @@  discard block
 block discarded – undo
1563 1563
  *
1564 1564
  * @return bool True on success, false otherwise.
1565 1565
  */
1566
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1567
-	if ( empty( $comment_id ) ) {
1566
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1567
+	if (empty($comment_id)) {
1568 1568
 		return false;
1569 1569
 	}
1570 1570
 
@@ -1576,9 +1576,9 @@  discard block
 block discarded – undo
1576 1576
 	 * @param int $comment_id Note ID.
1577 1577
 	 * @param int $payment_id Payment ID.
1578 1578
 	 */
1579
-	do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id );
1579
+	do_action('give_pre_delete_payment_note', $comment_id, $payment_id);
1580 1580
 
1581
-	$ret = wp_delete_comment( $comment_id, true );
1581
+	$ret = wp_delete_comment($comment_id, true);
1582 1582
 
1583 1583
 	/**
1584 1584
 	 * Fires after donation note deleted.
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
 	 * @param int $comment_id Note ID.
1589 1589
 	 * @param int $payment_id Payment ID.
1590 1590
 	 */
1591
-	do_action( 'give_post_delete_payment_note', $comment_id, $payment_id );
1591
+	do_action('give_post_delete_payment_note', $comment_id, $payment_id);
1592 1592
 
1593 1593
 	return $ret;
1594 1594
 }
@@ -1603,34 +1603,34 @@  discard block
 block discarded – undo
1603 1603
  *
1604 1604
  * @return string
1605 1605
  */
1606
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1606
+function give_get_payment_note_html($note, $payment_id = 0) {
1607 1607
 
1608
-	if ( is_numeric( $note ) ) {
1609
-		$note = get_comment( $note );
1608
+	if (is_numeric($note)) {
1609
+		$note = get_comment($note);
1610 1610
 	}
1611 1611
 
1612
-	if ( ! empty( $note->user_id ) ) {
1613
-		$user = get_userdata( $note->user_id );
1612
+	if ( ! empty($note->user_id)) {
1613
+		$user = get_userdata($note->user_id);
1614 1614
 		$user = $user->display_name;
1615 1615
 	} else {
1616
-		$user = esc_html__( 'System', 'give' );
1616
+		$user = esc_html__('System', 'give');
1617 1617
 	}
1618 1618
 
1619
-	$date_format = give_date_format() . ', ' . get_option( 'time_format' );
1619
+	$date_format = give_date_format().', '.get_option('time_format');
1620 1620
 
1621
-	$delete_note_url = wp_nonce_url( add_query_arg( array(
1621
+	$delete_note_url = wp_nonce_url(add_query_arg(array(
1622 1622
 		'give-action' => 'delete_payment_note',
1623 1623
 		'note_id'     => $note->comment_ID,
1624 1624
 		'payment_id'  => $payment_id,
1625
-	) ),
1626
-		'give_delete_payment_note_' . $note->comment_ID
1625
+	)),
1626
+		'give_delete_payment_note_'.$note->comment_ID
1627 1627
 	);
1628 1628
 
1629
-	$note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1629
+	$note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1630 1630
 	$note_html .= '<p>';
1631
-	$note_html .= '<strong>' . $user . '</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>';
1631
+	$note_html .= '<strong>'.$user.'</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>';
1632 1632
 	$note_html .= $note->comment_content;
1633
-	$note_html .= '&nbsp;&ndash;&nbsp;<a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" aria-label="' . esc_attr__( 'Delete this donation note.', 'give' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>';
1633
+	$note_html .= '&nbsp;&ndash;&nbsp;<a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" aria-label="'.esc_attr__('Delete this donation note.', 'give').'">'.esc_html__('Delete', 'give').'</a>';
1634 1634
 	$note_html .= '</p>';
1635 1635
 	$note_html .= '</div>';
1636 1636
 
@@ -1648,18 +1648,18 @@  discard block
 block discarded – undo
1648 1648
  *
1649 1649
  * @return void
1650 1650
  */
1651
-function give_hide_payment_notes( $query ) {
1652
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '>=' ) ) {
1653
-		$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
1654
-		if ( ! is_array( $types ) ) {
1655
-			$types = array( $types );
1651
+function give_hide_payment_notes($query) {
1652
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '>=')) {
1653
+		$types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array();
1654
+		if ( ! is_array($types)) {
1655
+			$types = array($types);
1656 1656
 		}
1657 1657
 		$types[]                           = 'give_payment_note';
1658 1658
 		$query->query_vars['type__not_in'] = $types;
1659 1659
 	}
1660 1660
 }
1661 1661
 
1662
-add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1662
+add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1663 1663
 
1664 1664
 /**
1665 1665
  * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets
@@ -1671,15 +1671,15 @@  discard block
 block discarded – undo
1671 1671
  *
1672 1672
  * @return array $clauses Updated comment clauses.
1673 1673
  */
1674
-function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
1675
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '<' ) ) {
1674
+function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) {
1675
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '<')) {
1676 1676
 		$clauses['where'] .= ' AND comment_type != "give_payment_note"';
1677 1677
 	}
1678 1678
 
1679 1679
 	return $clauses;
1680 1680
 }
1681 1681
 
1682
-add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1682
+add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1683 1683
 
1684 1684
 
1685 1685
 /**
@@ -1692,15 +1692,15 @@  discard block
 block discarded – undo
1692 1692
  *
1693 1693
  * @return string $where
1694 1694
  */
1695
-function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1695
+function give_hide_payment_notes_from_feeds($where, $wp_comment_query) {
1696 1696
 	global $wpdb;
1697 1697
 
1698
-	$where .= $wpdb->prepare( ' AND comment_type != %s', 'give_payment_note' );
1698
+	$where .= $wpdb->prepare(' AND comment_type != %s', 'give_payment_note');
1699 1699
 
1700 1700
 	return $where;
1701 1701
 }
1702 1702
 
1703
-add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 );
1703
+add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2);
1704 1704
 
1705 1705
 
1706 1706
 /**
@@ -1714,32 +1714,32 @@  discard block
 block discarded – undo
1714 1714
  *
1715 1715
  * @return array Array of comment counts.
1716 1716
  */
1717
-function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) {
1717
+function give_remove_payment_notes_in_comment_counts($stats, $post_id) {
1718 1718
 	global $wpdb, $pagenow;
1719 1719
 
1720
-	if ( 'index.php' != $pagenow ) {
1720
+	if ('index.php' != $pagenow) {
1721 1721
 		return $stats;
1722 1722
 	}
1723 1723
 
1724 1724
 	$post_id = (int) $post_id;
1725 1725
 
1726
-	if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
1726
+	if (apply_filters('give_count_payment_notes_in_comments', false)) {
1727 1727
 		return $stats;
1728 1728
 	}
1729 1729
 
1730
-	$stats = wp_cache_get( "comments-{$post_id}", 'counts' );
1730
+	$stats = wp_cache_get("comments-{$post_id}", 'counts');
1731 1731
 
1732
-	if ( false !== $stats ) {
1732
+	if (false !== $stats) {
1733 1733
 		return $stats;
1734 1734
 	}
1735 1735
 
1736 1736
 	$where = 'WHERE comment_type != "give_payment_note"';
1737 1737
 
1738
-	if ( $post_id > 0 ) {
1739
-		$where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id );
1738
+	if ($post_id > 0) {
1739
+		$where .= $wpdb->prepare(' AND comment_post_ID = %d', $post_id);
1740 1740
 	}
1741 1741
 
1742
-	$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1742
+	$count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A);
1743 1743
 
1744 1744
 	$total    = 0;
1745 1745
 	$approved = array(
@@ -1749,30 +1749,30 @@  discard block
 block discarded – undo
1749 1749
 		'trash'        => 'trash',
1750 1750
 		'post-trashed' => 'post-trashed',
1751 1751
 	);
1752
-	foreach ( (array) $count as $row ) {
1752
+	foreach ((array) $count as $row) {
1753 1753
 		// Don't count post-trashed toward totals.
1754
-		if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1754
+		if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
1755 1755
 			$total += $row['num_comments'];
1756 1756
 		}
1757
-		if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1758
-			$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1757
+		if (isset($approved[$row['comment_approved']])) {
1758
+			$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1759 1759
 		}
1760 1760
 	}
1761 1761
 
1762 1762
 	$stats['total_comments'] = $total;
1763
-	foreach ( $approved as $key ) {
1764
-		if ( empty( $stats[ $key ] ) ) {
1765
-			$stats[ $key ] = 0;
1763
+	foreach ($approved as $key) {
1764
+		if (empty($stats[$key])) {
1765
+			$stats[$key] = 0;
1766 1766
 		}
1767 1767
 	}
1768 1768
 
1769 1769
 	$stats = (object) $stats;
1770
-	wp_cache_set( "comments-{$post_id}", $stats, 'counts' );
1770
+	wp_cache_set("comments-{$post_id}", $stats, 'counts');
1771 1771
 
1772 1772
 	return $stats;
1773 1773
 }
1774 1774
 
1775
-add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 );
1775
+add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2);
1776 1776
 
1777 1777
 
1778 1778
 /**
@@ -1785,9 +1785,9 @@  discard block
 block discarded – undo
1785 1785
  *
1786 1786
  * @return string $where Modified where clause.
1787 1787
  */
1788
-function give_filter_where_older_than_week( $where = '' ) {
1788
+function give_filter_where_older_than_week($where = '') {
1789 1789
 	// Payments older than one week.
1790
-	$start = date( 'Y-m-d', strtotime( '-7 days' ) );
1790
+	$start = date('Y-m-d', strtotime('-7 days'));
1791 1791
 	$where .= " AND post_date <= '{$start}'";
1792 1792
 
1793 1793
 	return $where;
@@ -1807,38 +1807,38 @@  discard block
 block discarded – undo
1807 1807
  *
1808 1808
  * @return string $form_title Returns the full title if $only_level is false, otherwise returns the levels title.
1809 1809
  */
1810
-function give_get_payment_form_title( $payment_meta, $only_level = false, $separator = '' ) {
1810
+function give_get_payment_form_title($payment_meta, $only_level = false, $separator = '') {
1811 1811
 
1812
-	$form_id    = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0;
1813
-	$price_id   = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null;
1814
-	$form_title = isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '';
1812
+	$form_id    = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0;
1813
+	$price_id   = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
1814
+	$form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '';
1815 1815
 
1816
-	if ( $only_level == true ) {
1816
+	if ($only_level == true) {
1817 1817
 		$form_title = '';
1818 1818
 	}
1819 1819
 
1820 1820
 	//If multi-level, append to the form title.
1821
-	if ( give_has_variable_prices( $form_id ) ) {
1821
+	if (give_has_variable_prices($form_id)) {
1822 1822
 
1823 1823
 		//Only add separator if there is a form title.
1824
-		if ( ! empty( $form_title ) ) {
1825
-			$form_title .= ' ' . $separator . ' ';
1824
+		if ( ! empty($form_title)) {
1825
+			$form_title .= ' '.$separator.' ';
1826 1826
 		}
1827 1827
 
1828 1828
 		$form_title .= '<span class="donation-level-text-wrap">';
1829 1829
 
1830
-		if ( $price_id == 'custom' ) {
1831
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
1832
-			$form_title .= ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' );
1830
+		if ($price_id == 'custom') {
1831
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
1832
+			$form_title .= ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give');
1833 1833
 		} else {
1834
-			$form_title .= give_get_price_option_name( $form_id, $price_id );
1834
+			$form_title .= give_get_price_option_name($form_id, $price_id);
1835 1835
 		}
1836 1836
 
1837 1837
 		$form_title .= '</span>';
1838 1838
 
1839 1839
 	}
1840 1840
 
1841
-	return apply_filters( 'give_get_payment_form_title', $form_title, $payment_meta );
1841
+	return apply_filters('give_get_payment_form_title', $form_title, $payment_meta);
1842 1842
 
1843 1843
 }
1844 1844
 
@@ -1852,20 +1852,20 @@  discard block
 block discarded – undo
1852 1852
  *
1853 1853
  * @return string $price_id
1854 1854
  */
1855
-function give_get_price_id( $form_id, $price ) {
1855
+function give_get_price_id($form_id, $price) {
1856 1856
 
1857 1857
 	$price_id = 0;
1858 1858
 
1859
-	if ( give_has_variable_prices( $form_id ) ) {
1859
+	if (give_has_variable_prices($form_id)) {
1860 1860
 
1861
-		$levels = maybe_unserialize( get_post_meta( $form_id, '_give_donation_levels', true ) );
1861
+		$levels = maybe_unserialize(get_post_meta($form_id, '_give_donation_levels', true));
1862 1862
 
1863
-		foreach ( $levels as $level ) {
1863
+		foreach ($levels as $level) {
1864 1864
 
1865
-			$level_amount = (float) give_sanitize_amount( $level['_give_amount'] );
1865
+			$level_amount = (float) give_sanitize_amount($level['_give_amount']);
1866 1866
 
1867 1867
 			// Check that this indeed the recurring price.
1868
-			if ( $level_amount == $price ) {
1868
+			if ($level_amount == $price) {
1869 1869
 
1870 1870
 				$price_id = $level['_give_id']['level_id'];
1871 1871
 
@@ -1890,10 +1890,10 @@  discard block
 block discarded – undo
1890 1890
  *
1891 1891
  * @return string|void
1892 1892
  */
1893
-function give_get_form_dropdown( $args = array(), $echo = false ) {
1894
-	$form_dropdown_html = Give()->html->forms_dropdown( $args );
1893
+function give_get_form_dropdown($args = array(), $echo = false) {
1894
+	$form_dropdown_html = Give()->html->forms_dropdown($args);
1895 1895
 
1896
-	if ( ! $echo ) {
1896
+	if ( ! $echo) {
1897 1897
 		return $form_dropdown_html;
1898 1898
 	}
1899 1899
 
@@ -1910,17 +1910,17 @@  discard block
 block discarded – undo
1910 1910
  *
1911 1911
  * @return string|bool
1912 1912
  */
1913
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) {
1913
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1914 1914
 
1915 1915
 	// Check for give form id.
1916
-	if ( empty( $args['id'] ) ) {
1916
+	if (empty($args['id'])) {
1917 1917
 		return false;
1918 1918
 	}
1919 1919
 
1920
-	$form = new Give_Donate_Form( $args['id'] );
1920
+	$form = new Give_Donate_Form($args['id']);
1921 1921
 
1922 1922
 	// Check if form has variable prices or not.
1923
-	if ( ! $form->ID || ! $form->has_variable_prices() ) {
1923
+	if ( ! $form->ID || ! $form->has_variable_prices()) {
1924 1924
 		return false;
1925 1925
 	}
1926 1926
 
@@ -1928,22 +1928,22 @@  discard block
 block discarded – undo
1928 1928
 	$variable_price_options = array();
1929 1929
 
1930 1930
 	// Check if multi donation form support custom donation or not.
1931
-	if ( $form->is_custom_price_mode() ) {
1932
-		$variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' );
1931
+	if ($form->is_custom_price_mode()) {
1932
+		$variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1933 1933
 	}
1934 1934
 
1935 1935
 	// Get variable price and ID from variable price array.
1936
-	foreach ( $variable_prices as $variable_price ) {
1937
-		$variable_price_options[ $variable_price['_give_id']['level_id'] ] = ! empty( $variable_price['_give_text'] ) ? $variable_price['_give_text'] : give_currency_filter( give_format_amount( $variable_price['_give_amount'] ) );
1936
+	foreach ($variable_prices as $variable_price) {
1937
+		$variable_price_options[$variable_price['_give_id']['level_id']] = ! empty($variable_price['_give_text']) ? $variable_price['_give_text'] : give_currency_filter(give_format_amount($variable_price['_give_amount']));
1938 1938
 	}
1939 1939
 
1940 1940
 	// Update options.
1941
-	$args = array_merge( $args, array( 'options' => $variable_price_options ) );
1941
+	$args = array_merge($args, array('options' => $variable_price_options));
1942 1942
 
1943 1943
 	// Generate select html.
1944
-	$form_dropdown_html = Give()->html->select( $args );
1944
+	$form_dropdown_html = Give()->html->select($args);
1945 1945
 
1946
-	if ( ! $echo ) {
1946
+	if ( ! $echo) {
1947 1947
 		return $form_dropdown_html;
1948 1948
 	}
1949 1949
 
Please login to merge, or discard this patch.
includes/actions.php 1 patch
Spacing   +32 added lines, -32 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
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_get_actions() {
27 27
 
28
-	$_get_action = ! empty( $_GET['give_action'] ) ? $_GET['give_action'] : null;
28
+	$_get_action = ! empty($_GET['give_action']) ? $_GET['give_action'] : null;
29 29
 
30 30
 	// Add backward compatibility to give-action param ( $_GET or $_POST )
31
-	if(  doing_action( 'admin_init' ) && empty( $_get_action ) ) {
32
-		$_get_action = ! empty( $_GET['give-action'] ) ? $_GET['give-action'] : null;
31
+	if (doing_action('admin_init') && empty($_get_action)) {
32
+		$_get_action = ! empty($_GET['give-action']) ? $_GET['give-action'] : null;
33 33
 	}
34 34
 
35
-	if ( isset( $_get_action ) ) {
35
+	if (isset($_get_action)) {
36 36
 		/**
37 37
 		 * Fires in WordPress init or admin init, when give_action is present in $_GET.
38 38
 		 *
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 		 *
41 41
 		 * @param array $_GET Array of HTTP GET variables.
42 42
 		 */
43
-		do_action( "give_{$_get_action}", $_GET );
43
+		do_action("give_{$_get_action}", $_GET);
44 44
 	}
45 45
 
46 46
 }
47 47
 
48
-add_action( 'init', 'give_get_actions' );
49
-add_action( 'admin_init', 'give_get_actions' );
48
+add_action('init', 'give_get_actions');
49
+add_action('admin_init', 'give_get_actions');
50 50
 
51 51
 /**
52 52
  * Hooks Give actions, when present in the $_POST superglobal. Every give_action
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
  */
60 60
 function give_post_actions() {
61 61
 
62
-	$_post_action = ! empty( $_POST['give_action'] ) ? $_POST['give_action'] : null;
62
+	$_post_action = ! empty($_POST['give_action']) ? $_POST['give_action'] : null;
63 63
 
64 64
 
65 65
 	// Add backward compatibility to give-action param ( $_GET or $_POST )
66
-	if(  doing_action( 'admin_init' ) && empty( $_post_action ) ) {
67
-		$_post_action = ! empty( $_POST['give-action'] ) ? $_POST['give-action'] : null;
66
+	if (doing_action('admin_init') && empty($_post_action)) {
67
+		$_post_action = ! empty($_POST['give-action']) ? $_POST['give-action'] : null;
68 68
 	}
69 69
 
70
-	if ( isset( $_post_action ) ) {
70
+	if (isset($_post_action)) {
71 71
 		/**
72 72
 		 * Fires in WordPress init or admin init, when give_action is present in $_POST.
73 73
 		 *
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
 		 *
76 76
 		 * @param array $_POST Array of HTTP POST variables.
77 77
 		 */
78
-		do_action( "give_{$_post_action}", $_POST );
78
+		do_action("give_{$_post_action}", $_POST);
79 79
 	}
80 80
 
81 81
 }
82 82
 
83
-add_action( 'init', 'give_post_actions' );
84
-add_action( 'admin_init', 'give_post_actions' );
83
+add_action('init', 'give_post_actions');
84
+add_action('admin_init', 'give_post_actions');
85 85
 
86 86
 /**
87 87
  * Connect WordPress user with Donor.
@@ -91,27 +91,27 @@  discard block
 block discarded – undo
91 91
  * @param  array $user_data User Data
92 92
  * @return void
93 93
  */
94
-function give_connect_donor_to_wpuser( $user_id, $user_data ){
95
-	$donor = new Give_Customer( $user_data['user_email'] );
94
+function give_connect_donor_to_wpuser($user_id, $user_data) {
95
+	$donor = new Give_Customer($user_data['user_email']);
96 96
 
97 97
 	// Validate donor id and check if do nor is already connect to wp user or not.
98
-	if( $donor->id && ! $donor->user_id ) {
98
+	if ($donor->id && ! $donor->user_id) {
99 99
 
100 100
 		// Update donor user_id.
101
-		if( $donor->update( array( 'user_id' => $user_id ) ) ) {
102
-			$donor_note = sprintf( esc_html__( 'WordPress user #%d is connected to #%d', 'give' ), $user_id, $donor->id );
103
-			$donor->add_note( $donor_note );
101
+		if ($donor->update(array('user_id' => $user_id))) {
102
+			$donor_note = sprintf(esc_html__('WordPress user #%d is connected to #%d', 'give'), $user_id, $donor->id);
103
+			$donor->add_note($donor_note);
104 104
 
105 105
 			// Update user_id meta in payments.
106
-			if( ! empty( $donor->payment_ids ) && ( $donations = explode( ',', $donor->payment_ids ) ) ) {
107
-				foreach ( $donations as $donation  ) {
108
-					update_post_meta( $donation, '_give_payment_user_id', $user_id );
106
+			if ( ! empty($donor->payment_ids) && ($donations = explode(',', $donor->payment_ids))) {
107
+				foreach ($donations as $donation) {
108
+					update_post_meta($donation, '_give_payment_user_id', $user_id);
109 109
 				}
110 110
 			}
111 111
 		}
112 112
 	}
113 113
 }
114
-add_action( 'give_insert_user', 'give_connect_donor_to_wpuser', 10, 2 );
114
+add_action('give_insert_user', 'give_connect_donor_to_wpuser', 10, 2);
115 115
 
116 116
 
117 117
 /**
@@ -125,21 +125,21 @@  discard block
 block discarded – undo
125 125
 function give_validate_license_when_site_migrated() {
126 126
 	// Store current site address if not already stored.
127 127
 	$homeurl = home_url();
128
-	if( ! get_option( 'give_site_address_before_migrate' ) ) {
128
+	if ( ! get_option('give_site_address_before_migrate')) {
129 129
 		// Update site address.
130
-		update_option( 'give_site_address_before_migrate', $homeurl );
130
+		update_option('give_site_address_before_migrate', $homeurl);
131 131
 
132 132
 		return;
133 133
 	}
134 134
 
135
-	if( $homeurl !== get_option( 'give_site_address_before_migrate' ) ) {
135
+	if ($homeurl !== get_option('give_site_address_before_migrate')) {
136 136
 		// Immediately run cron.
137
-		wp_schedule_single_event( time() , 'give_validate_license_when_site_migrated' );
137
+		wp_schedule_single_event(time(), 'give_validate_license_when_site_migrated');
138 138
 
139 139
 		// Update site address.
140
-		update_option( 'give_site_address_before_migrate', home_url() );
140
+		update_option('give_site_address_before_migrate', home_url());
141 141
 	}
142 142
 
143 143
 }
144
-add_action( 'init', 'give_validate_license_when_site_migrated' );
145
-add_action( 'admin_init', 'give_validate_license_when_site_migrated' );
144
+add_action('init', 'give_validate_license_when_site_migrated');
145
+add_action('admin_init', 'give_validate_license_when_site_migrated');
Please login to merge, or discard this patch.
includes/admin/dashboard-widgets.php 1 patch
Spacing   +32 added lines, -32 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
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  */
23 23
 function give_register_dashboard_widgets() {
24
-	if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
25
-		wp_add_dashboard_widget( 'give_dashboard_sales', esc_html__( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' );
24
+	if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
25
+		wp_add_dashboard_widget('give_dashboard_sales', esc_html__('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget');
26 26
 	}
27 27
 }
28 28
 
29
-add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 );
29
+add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10);
30 30
 
31 31
 /**
32 32
  * Sales Summary Dashboard Widget
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  */
39 39
 function give_dashboard_sales_widget() {
40 40
 
41
-	if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
41
+	if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
42 42
 		return;
43 43
 	}
44 44
 	$stats = new Give_Payment_Stats; ?>
@@ -46,27 +46,27 @@  discard block
 block discarded – undo
46 46
 	<div class="give-dashboard-widget">
47 47
 
48 48
 		<div class="give-dashboard-today give-clearfix">
49
-			<h3 class="give-dashboard-date-today"><?php echo date( _x( 'F j, Y', 'dashboard widget', 'give' ) ); ?></h3>
49
+			<h3 class="give-dashboard-date-today"><?php echo date(_x('F j, Y', 'dashboard widget', 'give')); ?></h3>
50 50
 
51 51
 			<p class="give-dashboard-happy-day"><?php
52 52
 				printf(
53 53
 				/* translators: %s: day of the week */
54
-					esc_html__( 'Happy %s!', 'give' ),
55
-					date( 'l', current_time( 'timestamp' ) )
54
+					esc_html__('Happy %s!', 'give'),
55
+					date('l', current_time('timestamp'))
56 56
 				);
57 57
 			?></p>
58 58
 
59 59
 			<p class="give-dashboard-today-earnings"><?php
60
-				$earnings_today = $stats->get_earnings( 0, 'today', false );
61
-				echo give_currency_filter( give_format_amount( $earnings_today ) );
60
+				$earnings_today = $stats->get_earnings(0, 'today', false);
61
+				echo give_currency_filter(give_format_amount($earnings_today));
62 62
 			?></p>
63 63
 
64 64
 			<p class="give-orders-today"><?php
65
-				$donations_today = $stats->get_sales( 0, 'today', false );
65
+				$donations_today = $stats->get_sales(0, 'today', false);
66 66
 				printf(
67 67
 					/* translators: %s: daily donation count */
68
-					esc_html__( '%s donations today', 'give' ),
69
-					give_format_amount( $donations_today, false )
68
+					esc_html__('%s donations today', 'give'),
69
+					give_format_amount($donations_today, false)
70 70
 				);
71 71
 			?></p>
72 72
 
@@ -76,34 +76,34 @@  discard block
 block discarded – undo
76 76
 		<table class="give-table-stats">
77 77
 			<thead style="display: none;">
78 78
 			<tr>
79
-				<th><?php esc_html_e( 'This Week', 'give' ); ?></th>
80
-				<th><?php esc_html_e( 'This Month', 'give' ); ?></th>
81
-				<th><?php esc_html_e( 'Past 30 Days', 'give' ); ?></th>
79
+				<th><?php esc_html_e('This Week', 'give'); ?></th>
80
+				<th><?php esc_html_e('This Month', 'give'); ?></th>
81
+				<th><?php esc_html_e('Past 30 Days', 'give'); ?></th>
82 82
 			</tr>
83 83
 			</thead>
84 84
 			<tbody>
85 85
 			<tr id="give-table-stats-tr-1">
86 86
 				<td>
87
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ) ) ); ?></p>
87
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'))); ?></p>
88 88
 
89
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Week', 'give' ); ?></p>
89
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Week', 'give'); ?></p>
90 90
 				</td>
91 91
 				<td>
92
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ); ?></p>
92
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'))); ?></p>
93 93
 
94
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Month', 'give' ); ?></p>
94
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Month', 'give'); ?></p>
95 95
 				</td>
96 96
 			</tr>
97 97
 			<tr id="give-table-stats-tr-2">
98 98
 				<td>
99
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ) ) ) ?></p>
99
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'))) ?></p>
100 100
 
101
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'Last Month', 'give' ); ?></p>
101
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('Last Month', 'give'); ?></p>
102 102
 				</td>
103 103
 				<td>
104
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ) ) ) ?></p>
104
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false))) ?></p>
105 105
 
106
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Year', 'give' ); ?></p>
106
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Year', 'give'); ?></p>
107 107
 				</td>
108 108
 			</tr>
109 109
 			</tbody>
@@ -123,23 +123,23 @@  discard block
 block discarded – undo
123 123
  *
124 124
  * @return array
125 125
  */
126
-function give_dashboard_at_a_glance_widget( $items ) {
127
-	$num_posts = wp_count_posts( 'give_forms' );
126
+function give_dashboard_at_a_glance_widget($items) {
127
+	$num_posts = wp_count_posts('give_forms');
128 128
 
129
-	if ( $num_posts && $num_posts->publish ) {
129
+	if ($num_posts && $num_posts->publish) {
130 130
 
131 131
 		$text = sprintf(
132 132
 			/* translators: %s: number of posts published */
133
-			_n( '%s Give Form', '%s Give Forms', $num_posts->publish, 'give' ),
133
+			_n('%s Give Form', '%s Give Forms', $num_posts->publish, 'give'),
134 134
 			$num_posts->publish
135 135
 		);
136 136
 
137
-		$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
137
+		$text = sprintf($text, number_format_i18n($num_posts->publish));
138 138
 
139
-		if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
139
+		if (current_user_can('edit_give_forms', get_current_user_id())) {
140 140
 			$text = sprintf(
141 141
 				'<a class="give-forms-count" href="%1$s">%2$s</a>',
142
-				admin_url( 'edit.php?post_type=give_forms' ),
142
+				admin_url('edit.php?post_type=give_forms'),
143 143
 				$text
144 144
 			);
145 145
 		} else {
@@ -155,4 +155,4 @@  discard block
 block discarded – undo
155 155
 	return $items;
156 156
 }
157 157
 
158
-add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1 );
158
+add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1);
Please login to merge, or discard this patch.
includes/admin/class-i18n-module.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -66,23 +66,23 @@  discard block
 block discarded – undo
66 66
 	 * @param $args
67 67
 	 *
68 68
 	 */
69
-	public function __construct( $args ) {
69
+	public function __construct($args) {
70 70
 
71 71
 		//Only for admins.
72
-		if ( ! is_admin() ) {
72
+		if ( ! is_admin()) {
73 73
 			return;
74 74
 		}
75 75
 
76 76
 		//This plugin is en_US native.
77 77
 		$this->locale = get_locale();
78
-		if ( 'en_US' === $this->locale ) {
78
+		if ('en_US' === $this->locale) {
79 79
 			return;
80 80
 		}
81 81
 
82
-		$this->init( $args );
82
+		$this->init($args);
83 83
 
84
-		if ( ! $this->hide_promo() ) {
85
-			add_action( $this->hook, array( $this, 'promo' ) );
84
+		if ( ! $this->hide_promo()) {
85
+			add_action($this->hook, array($this, 'promo'));
86 86
 		}
87 87
 	}
88 88
 
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @param array $args
95 95
 	 */
96
-	private function init( $args ) {
97
-		foreach ( $args as $key => $arg ) {
96
+	private function init($args) {
97
+		foreach ($args as $key => $arg) {
98 98
 			$this->$key = $arg;
99 99
 		}
100 100
 
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 * @return bool
109 109
 	 */
110 110
 	private function hide_promo() {
111
-		$hide_promo = get_transient( 'give_i18n_give_promo_hide' );
112
-		if ( ! $hide_promo ) {
113
-			if ( filter_input( INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT ) === 1 ) {
111
+		$hide_promo = get_transient('give_i18n_give_promo_hide');
112
+		if ( ! $hide_promo) {
113
+			if (filter_input(INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT) === 1) {
114 114
 				// No expiration time, so this would normally not expire, but it wouldn't be copied to other sites etc.
115
-				set_transient( 'give_i18n_give_promo_hide', true );
115
+				set_transient('give_i18n_give_promo_hide', true);
116 116
 				$hide_promo = true;
117 117
 			}
118 118
 		}
@@ -131,20 +131,20 @@  discard block
 block discarded – undo
131 131
 		$message = false;
132 132
 
133 133
 		//Using a translation less than 90% complete.
134
-		if ( $this->translation_exists && $this->translation_loaded && $this->percent_translated < 90 ) {
135
-			$message = __( 'As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give' );
136
-		} elseif ( ! $this->translation_loaded && $this->translation_exists ) {
137
-			$message = __( 'You\'re using WordPress in %1$s. While %2$s has been translated to %1$s for %3$d%%, it\'s not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give' );
138
-		} elseif ( ! $this->translation_exists ) {
139
-			$message = __( 'You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give' );
134
+		if ($this->translation_exists && $this->translation_loaded && $this->percent_translated < 90) {
135
+			$message = __('As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give');
136
+		} elseif ( ! $this->translation_loaded && $this->translation_exists) {
137
+			$message = __('You\'re using WordPress in %1$s. While %2$s has been translated to %1$s for %3$d%%, it\'s not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give');
138
+		} elseif ( ! $this->translation_exists) {
139
+			$message = __('You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give');
140 140
 		}
141 141
 
142 142
 		//Links.
143
-		$registration_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__( 'WordPress.org', 'give' ) );
144
-		$translations_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__( 'complete the translation', 'give' ) );
143
+		$registration_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__('WordPress.org', 'give'));
144
+		$translations_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__('complete the translation', 'give'));
145 145
 
146 146
 		//Message.
147
-		$message = sprintf( $message, esc_html( $this->locale_name ), esc_html( 'Give' ), $this->percent_translated, $registration_link, $translations_link );
147
+		$message = sprintf($message, esc_html($this->locale_name), esc_html('Give'), $this->percent_translated, $registration_link, $translations_link);
148 148
 
149 149
 
150 150
 		return $message;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		$this->translation_details();
160 160
 		$message = $this->promo_message();
161 161
 
162
-		if ( $message ) { ?>
162
+		if ($message) { ?>
163 163
 
164 164
 			<style>
165 165
 				/* Banner specific styles */
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
 				<a href="https://wordpress.org/support/register.php" class="alignleft give-i18n-icon" style="margin:0" target="_blank"><span class="dashicons dashicons-translation" style="font-size: 110px; text-decoration: none;"></span></a>
213 213
 
214 214
 				<div class="give-i18n-notice-content">
215
-					<a href="<?php echo esc_url( add_query_arg( array( 'remove_i18n_promo' => '1' ) ) ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
215
+					<a href="<?php echo esc_url(add_query_arg(array('remove_i18n_promo' => '1'))); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
216 216
 
217
-					<h2 style="margin: 10px 0;"><?php printf( esc_html__( 'Help Translate Give to %s', 'give' ), $this->locale_name ); ?></h2>
217
+					<h2 style="margin: 10px 0;"><?php printf(esc_html__('Help Translate Give to %s', 'give'), $this->locale_name); ?></h2>
218 218
 					<p><?php echo $message; ?></p>
219 219
 					<p>
220
-						<a href="https://wordpress.org/support/register.php" target="_blank"><?php _e( 'Register now &raquo;', 'give' ); ?></a>
220
+						<a href="https://wordpress.org/support/register.php" target="_blank"><?php _e('Register now &raquo;', 'give'); ?></a>
221 221
 					</p>
222 222
 				</div>
223 223
 			</div>
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 	 */
235 235
 	private function find_or_initialize_translation_details() {
236 236
 
237
-		$set = get_transient( 'give_i18n_give_' . $this->locale );
237
+		$set = get_transient('give_i18n_give_'.$this->locale);
238 238
 
239
-		if ( ! $set ) {
239
+		if ( ! $set) {
240 240
 			$set = $this->retrieve_translation_details();
241
-			set_transient( 'give_i18n_give_' . $this->locale, $set, DAY_IN_SECONDS );
241
+			set_transient('give_i18n_give_'.$this->locale, $set, DAY_IN_SECONDS);
242 242
 		}
243 243
 
244 244
 		return $set;
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 	private function translation_details() {
253 253
 		$set = $this->find_or_initialize_translation_details();
254 254
 
255
-		$this->translation_exists = ! is_null( $set );
256
-		$this->translation_loaded = is_textdomain_loaded( 'give' );
255
+		$this->translation_exists = ! is_null($set);
256
+		$this->translation_loaded = is_textdomain_loaded('give');
257 257
 
258
-		$this->parse_translation_set( $set );
258
+		$this->parse_translation_set($set);
259 259
 	}
260 260
 
261 261
 	/**
@@ -267,26 +267,26 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	private function retrieve_translation_details() {
269 269
 
270
-		$api_url = trailingslashit( $this->glotpress_url );
270
+		$api_url = trailingslashit($this->glotpress_url);
271 271
 
272
-		$resp = wp_remote_get( $api_url );
272
+		$resp = wp_remote_get($api_url);
273 273
 
274
-		if ( is_wp_error( $resp ) || wp_remote_retrieve_response_code( $resp ) === '404' ) {
274
+		if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) === '404') {
275 275
 			return null;
276 276
 		}
277 277
 
278
-		$body = wp_remote_retrieve_body( $resp );
279
-		unset( $resp );
278
+		$body = wp_remote_retrieve_body($resp);
279
+		unset($resp);
280 280
 
281
-		if ( $body ) {
282
-			$body = json_decode( $body );
281
+		if ($body) {
282
+			$body = json_decode($body);
283 283
 
284
-			foreach ( $body->translation_sets as $set ) {
285
-				if ( ! property_exists( $set, 'wp_locale' ) ) {
284
+			foreach ($body->translation_sets as $set) {
285
+				if ( ! property_exists($set, 'wp_locale')) {
286 286
 					continue;
287 287
 				}
288 288
 
289
-				if ( $this->locale == $set->wp_locale ) {
289
+				if ($this->locale == $set->wp_locale) {
290 290
 					return $set;
291 291
 				}
292 292
 			}
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 	 *
303 303
 	 * @access private
304 304
 	 */
305
-	private function parse_translation_set( $set ) {
306
-		if ( $this->translation_exists && is_object( $set ) ) {
305
+	private function parse_translation_set($set) {
306
+		if ($this->translation_exists && is_object($set)) {
307 307
 			$this->locale_name        = $set->name;
308 308
 			$this->percent_translated = $set->percent_translated;
309 309
 		} else {
Please login to merge, or discard this patch.
includes/admin/customers/class-customer-table.php 2 patches
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	public function __construct() {
62 62
 
63 63
 		// Set parent defaults
64
-		parent::__construct( array(
65
-			'singular' => esc_html__( 'Donor', 'give' ),     // Singular name of the listed records
66
-			'plural'   => esc_html__( 'Donors', 'give' ),    // Plural name of the listed records
64
+		parent::__construct(array(
65
+			'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records
66
+			'plural'   => esc_html__('Donors', 'give'), // Plural name of the listed records
67 67
 			'ajax'     => false                       // Does this table support ajax?
68
-		) );
68
+		));
69 69
 
70 70
 	}
71 71
 
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return void
82 82
 	 */
83
-	public function search_box( $text, $input_id ) {
84
-		$input_id = $input_id . '-search-input';
83
+	public function search_box($text, $input_id) {
84
+		$input_id = $input_id.'-search-input';
85 85
 
86
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
87
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
86
+		if ( ! empty($_REQUEST['orderby'])) {
87
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
88 88
 		}
89
-		if ( ! empty( $_REQUEST['order'] ) ) {
90
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
89
+		if ( ! empty($_REQUEST['order'])) {
90
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
91 91
 		}
92 92
 		?>
93 93
 		<p class="search-box" role="search">
94 94
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
95 95
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
96
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
96
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
97 97
 		</p>
98 98
 		<?php
99 99
 	}
@@ -109,29 +109,29 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return string Column Name.
111 111
 	 */
112
-	public function column_default( $item, $column_name ) {
113
-		switch ( $column_name ) {
112
+	public function column_default($item, $column_name) {
113
+		switch ($column_name) {
114 114
 
115 115
 			case 'num_purchases' :
116
-				$value = '<a href="' .
117
-				         admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
118
-				         ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
116
+				$value = '<a href="'.
117
+				         admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email'])
118
+				         ).'">'.esc_html($item['num_purchases']).'</a>';
119 119
 				break;
120 120
 
121 121
 			case 'amount_spent' :
122
-				$value = give_currency_filter( give_format_amount( $item[ $column_name ] ) );
122
+				$value = give_currency_filter(give_format_amount($item[$column_name]));
123 123
 				break;
124 124
 
125 125
 			case 'date_created' :
126
-				$value = date_i18n( give_date_format(), strtotime( $item['date_created'] ) );
126
+				$value = date_i18n(give_date_format(), strtotime($item['date_created']));
127 127
 				break;
128 128
 
129 129
 			default:
130
-				$value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null;
130
+				$value = isset($item[$column_name]) ? $item[$column_name] : null;
131 131
 				break;
132 132
 		}
133 133
 
134
-		return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] );
134
+		return apply_filters("give_report_column_{$column_name}", $value, $item['id']);
135 135
 
136 136
 	}
137 137
 
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @return string
144 144
 	 */
145
-	public function column_name( $item ) {
146
-		$name = '#' . $item['id'] . ' ';
147
-		$name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>';
148
-		$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] );
149
-		$actions  = $this->get_row_actions( $item );
145
+	public function column_name($item) {
146
+		$name = '#'.$item['id'].' ';
147
+		$name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>';
148
+		$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']);
149
+		$actions  = $this->get_row_actions($item);
150 150
 
151
-		return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions );
151
+		return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions);
152 152
 	}
153 153
 
154 154
 	/**
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function get_columns() {
162 162
 		$columns = array(
163
-			'name'          => esc_html__( 'Name', 'give' ),
164
-			'email'         => esc_html__( 'Email', 'give' ),
165
-			'num_purchases' => esc_html__( 'Donations', 'give' ),
166
-			'amount_spent'  => esc_html__( 'Total Donated', 'give' ),
167
-			'date_created'  => esc_html__( 'Date Created', 'give' )
163
+			'name'          => esc_html__('Name', 'give'),
164
+			'email'         => esc_html__('Email', 'give'),
165
+			'num_purchases' => esc_html__('Donations', 'give'),
166
+			'amount_spent'  => esc_html__('Total Donated', 'give'),
167
+			'date_created'  => esc_html__('Date Created', 'give')
168 168
 		);
169 169
 
170
-		return apply_filters( 'give_report_customer_columns', $columns );
170
+		return apply_filters('give_report_customer_columns', $columns);
171 171
 
172 172
 	}
173 173
 
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function get_sortable_columns() {
182 182
 		return array(
183
-			'date_created'  => array( 'date_created', true ),
184
-			'name'          => array( 'name', true ),
185
-			'num_purchases' => array( 'purchase_count', false ),
186
-			'amount_spent'  => array( 'purchase_value', false ),
183
+			'date_created'  => array('date_created', true),
184
+			'name'          => array('name', true),
185
+			'num_purchases' => array('purchase_count', false),
186
+			'amount_spent'  => array('purchase_value', false),
187 187
 		);
188 188
 	}
189 189
 
@@ -195,34 +195,34 @@  discard block
 block discarded – undo
195 195
 	 *
196 196
 	 * @return array An array of action links.
197 197
 	 */
198
-	public function get_row_actions( $item ) {
198
+	public function get_row_actions($item) {
199 199
 
200 200
 		$actions = array(
201 201
 
202 202
 			'view' => sprintf(
203 203
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
204
-				admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ),
205
-				sprintf( esc_attr__( 'View "%s"', 'give' ), $item['name'] ),
206
-				esc_html__( 'View Donor', 'give' )
204
+				admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']),
205
+				sprintf(esc_attr__('View "%s"', 'give'), $item['name']),
206
+				esc_html__('View Donor', 'give')
207 207
 			),
208 208
 
209 209
 			'notes' => sprintf(
210 210
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
211
-				admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $item['id'] ),
212
-				sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $item['name'] ),
213
-				esc_html__( 'Notes', 'give' )
211
+				admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$item['id']),
212
+				sprintf(esc_attr__('Notes for "%s"', 'give'), $item['name']),
213
+				esc_html__('Notes', 'give')
214 214
 			),
215 215
 
216 216
 			'delete' => sprintf(
217 217
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
218
-				admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ),
219
-				sprintf( esc_attr__( 'Delete "%s"', 'give' ), $item['name'] ),
220
-				esc_html__( 'Delete', 'give' )
218
+				admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id']),
219
+				sprintf(esc_attr__('Delete "%s"', 'give'), $item['name']),
220
+				esc_html__('Delete', 'give')
221 221
 			)
222 222
 
223 223
 		);
224 224
 
225
-		return apply_filters( 'give_donor_row_actions', $actions, $item );
225
+		return apply_filters('give_donor_row_actions', $actions, $item);
226 226
 
227 227
 	}
228 228
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 * @since  1.0
234 234
 	 * @return void
235 235
 	 */
236
-	public function bulk_actions( $which = '' ) {
236
+	public function bulk_actions($which = '') {
237 237
 		// These aren't really bulk actions but this outputs the markup in the right place.
238 238
 	}
239 239
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @return int Current page number.
246 246
 	 */
247 247
 	public function get_paged() {
248
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
248
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
249 249
 	}
250 250
 
251 251
 	/**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @return mixed string If search is present, false otherwise.
257 257
 	 */
258 258
 	public function get_search() {
259
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
259
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
260 260
 	}
261 261
 
262 262
 	/**
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$data    = array();
275 275
 		$paged   = $this->get_paged();
276
-		$offset  = $this->per_page * ( $paged - 1 );
276
+		$offset  = $this->per_page * ($paged - 1);
277 277
 		$search  = $this->get_search();
278
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
279
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
278
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
279
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
280 280
 
281 281
 		$args = array(
282 282
 			'number'  => $this->per_page,
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
 			'orderby' => $orderby
286 286
 		);
287 287
 
288
-		if ( is_email( $search ) ) {
288
+		if (is_email($search)) {
289 289
 			$args['email'] = $search;
290
-		} elseif ( is_numeric( $search ) ) {
290
+		} elseif (is_numeric($search)) {
291 291
 			$args['id'] = $search;
292 292
 		} else {
293 293
 			$args['name'] = $search;
294 294
 		}
295 295
 
296
-		$customers = Give()->customers->get_customers( $args );
296
+		$customers = Give()->customers->get_customers($args);
297 297
 
298
-		if ( $customers ) {
298
+		if ($customers) {
299 299
 
300
-			foreach ( $customers as $customer ) {
300
+			foreach ($customers as $customer) {
301 301
 
302
-				$user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0;
302
+				$user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0;
303 303
 
304 304
 				$data[] = array(
305 305
 					'id'            => $customer->id,
@@ -333,16 +333,16 @@  discard block
 block discarded – undo
333 333
 		$hidden   = array(); // No hidden columns
334 334
 		$sortable = $this->get_sortable_columns();
335 335
 
336
-		$this->_column_headers = array( $columns, $hidden, $sortable );
336
+		$this->_column_headers = array($columns, $hidden, $sortable);
337 337
 
338 338
 		$this->items = $this->reports_data();
339 339
 
340 340
 		$this->total = give_count_total_customers();
341 341
 
342
-		$this->set_pagination_args( array(
342
+		$this->set_pagination_args(array(
343 343
 			'total_items' => $this->total,
344 344
 			'per_page'    => $this->per_page,
345
-			'total_pages' => ceil( $this->total / $this->per_page )
346
-		) );
345
+			'total_pages' => ceil($this->total / $this->per_page)
346
+		));
347 347
 	}
348 348
 }
349 349
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -173,8 +173,8 @@
 block discarded – undo
173 173
 
174 174
 			case 'num_purchases' :
175 175
 				$value = '<a href="' .
176
-				         admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
177
-				         ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
176
+						 admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
177
+						 ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
178 178
 				break;
179 179
 
180 180
 			case 'amount_spent' :
Please login to merge, or discard this patch.
includes/admin/customers/customers.php 1 patch
Spacing   +157 added lines, -157 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,9 +24,9 @@  discard block
 block discarded – undo
24 24
  */
25 25
 function give_customers_page() {
26 26
 	$default_views  = give_customer_views();
27
-	$requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'customers';
28
-	if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) {
29
-		give_render_customer_view( $requested_view, $default_views );
27
+	$requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'customers';
28
+	if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) {
29
+		give_render_customer_view($requested_view, $default_views);
30 30
 	} else {
31 31
 		give_customers_list();
32 32
 	}
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 	$views = array();
44 44
 
45
-	return apply_filters( 'give_customer_views', $views );
45
+	return apply_filters('give_customer_views', $views);
46 46
 
47 47
 }
48 48
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 	$tabs = array();
58 58
 
59
-	return apply_filters( 'give_customer_tabs', $tabs );
59
+	return apply_filters('give_customer_tabs', $tabs);
60 60
 
61 61
 }
62 62
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
  * @return void
68 68
  */
69 69
 function give_customers_list() {
70
-	include( dirname( __FILE__ ) . '/class-customer-table.php' );
70
+	include(dirname(__FILE__).'/class-customer-table.php');
71 71
 
72 72
 	$customers_table = new Give_Customer_Reports_Table();
73 73
 	$customers_table->prepare_items();
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 		 *
81 81
 		 * @since 1.0
82 82
 		 */
83
-		do_action( 'give_donors_table_top' );
83
+		do_action('give_donors_table_top');
84 84
 		?>
85
-		<form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>">
85
+		<form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>">
86 86
 			<?php
87
-			$customers_table->search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors' );
87
+			$customers_table->search_box(esc_html__('Search Donors', 'give'), 'give-donors');
88 88
 			$customers_table->display();
89 89
 			?>
90 90
 			<input type="hidden" name="post_type" value="give_forms" />
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		 *
98 98
 		 * @since 1.0
99 99
 		 */
100
-		do_action( 'give_donors_table_bottom' );
100
+		do_action('give_donors_table_bottom');
101 101
 		?>
102 102
 	</div>
103 103
 	<?php
@@ -113,27 +113,27 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return void
115 115
  */
116
-function give_render_customer_view( $view, $callbacks ) {
116
+function give_render_customer_view($view, $callbacks) {
117 117
 
118 118
 	$render = true;
119 119
 
120
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
120
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
121 121
 
122
-	if ( ! current_user_can( $customer_view_role ) ) {
123
-		give_set_error( 'give-no-access', esc_html__( 'You are not permitted to view this data.', 'give' ) );
122
+	if ( ! current_user_can($customer_view_role)) {
123
+		give_set_error('give-no-access', esc_html__('You are not permitted to view this data.', 'give'));
124 124
 		$render = false;
125 125
 	}
126 126
  
127
-	if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
128
-		give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID.', 'give' ) );
127
+	if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
128
+		give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', 'give'));
129 129
 		$render = false;
130 130
 	}
131 131
 
132 132
 	$customer_id = (int) $_GET['id'];
133
-	$customer    = new Give_Customer( $customer_id );
133
+	$customer    = new Give_Customer($customer_id);
134 134
 
135
-	if ( empty( $customer->id ) ) {
136
-		give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID.', 'give' ) );
135
+	if (empty($customer->id)) {
136
+		give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', 'give'));
137 137
 		$render = false;
138 138
 	}
139 139
 
@@ -142,34 +142,34 @@  discard block
 block discarded – undo
142 142
 
143 143
 	<div class='wrap'>
144 144
 
145
-		<?php if ( give_get_errors() ) : ?>
145
+		<?php if (give_get_errors()) : ?>
146 146
 			<div class="error settings-error">
147
-				<?php give_print_errors( 0 ); ?>
147
+				<?php give_print_errors(0); ?>
148 148
 			</div>
149 149
 		<?php endif; ?>
150 150
 
151
-		<h1 class="screen-reader-text"><?php esc_html_e( 'Donor', 'give' ); ?></h1>
151
+		<h1 class="screen-reader-text"><?php esc_html_e('Donor', 'give'); ?></h1>
152 152
 
153
-		<?php if ( $customer && $render ) : ?>
153
+		<?php if ($customer && $render) : ?>
154 154
 
155 155
 			<h2 class="nav-tab-wrapper">
156 156
 			<?php
157
-			foreach ( $customer_tabs as $key => $tab ) :
157
+			foreach ($customer_tabs as $key => $tab) :
158 158
 				$active = $key === $view ? true : false;
159 159
 				$class = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
160 160
 				printf(
161 161
 					'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n",
162
-					esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ),
163
-					esc_attr( $class ),
164
-					sanitize_html_class( $tab['dashicon'] ),
165
-					esc_html( $tab['title'] )
162
+					esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)),
163
+					esc_attr($class),
164
+					sanitize_html_class($tab['dashicon']),
165
+					esc_html($tab['title'])
166 166
 				);
167 167
 			endforeach;
168 168
 			?>
169 169
 			</h2>
170 170
 
171 171
 			<div id="give-customer-card-wrapper">
172
-				<?php $callbacks[ $view ]( $customer ) ?>
172
+				<?php $callbacks[$view]($customer) ?>
173 173
 			</div>
174 174
 
175 175
 		<?php endif; ?>
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
  *
190 190
  * @return void
191 191
  */
192
-function give_customers_view( $customer ) {
192
+function give_customers_view($customer) {
193 193
 
194
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
194
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
195 195
 
196 196
 	/**
197 197
 	 * Fires in donor profile screen, above the donor card.
@@ -200,32 +200,32 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @param object $customer The customer object being displayed.
202 202
 	 */
203
-	do_action( 'give_donor_card_top', $customer );
203
+	do_action('give_donor_card_top', $customer);
204 204
 	?>
205 205
 
206 206
 	<div id="donor-summary" class="info-wrapper customer-section postbox">
207 207
 
208
-		<form id="edit-customer-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>">
208
+		<form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>">
209 209
 
210 210
 			<div class="customer-info">
211 211
 
212 212
 				<div class="donor-bio-header clearfix">
213 213
 
214 214
 					<div class="avatar-wrap left" id="customer-avatar">
215
-						<?php echo get_avatar( $customer->email ); ?>
215
+						<?php echo get_avatar($customer->email); ?>
216 216
 					</div>
217 217
 
218 218
 					<div id="customer-name-wrap" class="left">
219 219
 						<span class="customer-id">#<?php echo $customer->id; ?></span>
220
-						<span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $customer->name ); ?>" placeholder="<?php esc_attr_e( 'Donor Name', 'give' ); ?>" /></span>
220
+						<span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($customer->name); ?>" placeholder="<?php esc_attr_e('Donor Name', 'give'); ?>" /></span>
221 221
 						<span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span>
222 222
 					</div>
223 223
 					<p class="customer-since info-item">
224
-						<?php esc_html_e( 'Donor since', 'give' ); ?>
225
-						<?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?>
224
+						<?php esc_html_e('Donor since', 'give'); ?>
225
+						<?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?>
226 226
 					</p>
227
-					<?php if ( current_user_can( $customer_edit_role ) ): ?>
228
-						<a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a>
227
+					<?php if (current_user_can($customer_edit_role)): ?>
228
+						<a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e('Edit Donor', 'give'); ?></a>
229 229
 					<?php endif; ?>
230 230
 				</div>
231 231
 				<!-- /donor-bio-header -->
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 					<table class="widefat">
236 236
 						<tbody>
237 237
 						<tr class="alternate">
238
-							<th scope="col"><label for="tablecell"><?php esc_html_e( 'User ID:', 'give' ); ?></label></th>
238
+							<th scope="col"><label for="tablecell"><?php esc_html_e('User ID:', 'give'); ?></label></th>
239 239
 							<td class="row-title">
240 240
 								<span class="customer-user-id info-item edit-item">
241 241
 									<?php
@@ -251,38 +251,38 @@  discard block
 block discarded – undo
251 251
 										'data'  => $data_atts,
252 252
 									);
253 253
 
254
-									if ( ! empty( $user_id ) ) {
255
-										$userdata           = get_userdata( $user_id );
254
+									if ( ! empty($user_id)) {
255
+										$userdata           = get_userdata($user_id);
256 256
 										$user_args['value'] = $userdata->user_login;
257 257
 									}
258 258
 
259
-									echo Give()->html->ajax_user_search( $user_args );
259
+									echo Give()->html->ajax_user_search($user_args);
260 260
 									?>
261 261
 									<input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" />
262 262
 								</span>
263 263
 			
264 264
 								<span class="customer-user-id info-item editable">
265
-									<?php if ( intval( $customer->user_id ) > 0 ) { ?>
265
+									<?php if (intval($customer->user_id) > 0) { ?>
266 266
 										<span data-key="user_id"><?php echo $customer->user_id; ?></span>
267 267
 									<?php } else { ?>
268
-										<span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span>
268
+										<span data-key="user_id"><?php esc_html_e('None', 'give'); ?></span>
269 269
 									<?php } ?>
270
-									<?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) { ?>
271
-										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" aria-label="<?php esc_attr_e( 'Disconnects the current user ID from this customer record.', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span>
270
+									<?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) { ?>
271
+										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" aria-label="<?php esc_attr_e('Disconnects the current user ID from this customer record.', 'give'); ?>"><?php esc_html_e('Disconnect User', 'give'); ?></a></span>
272 272
 									<?php } ?>
273 273
 								</span>
274 274
 							</td>
275 275
 						</tr>
276
-						<?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?>
276
+						<?php if (isset($customer->user_id) && $customer->user_id > 0) : ?>
277 277
 
278 278
 							<tr>
279
-								<th scope="col"><?php esc_html_e( 'Address:', 'give' ); ?></th>
279
+								<th scope="col"><?php esc_html_e('Address:', 'give'); ?></th>
280 280
 								<td class="row-title">
281 281
 
282 282
 									<div class="customer-address-wrapper">
283 283
 
284 284
 										<?php
285
-										$address  = get_user_meta( $customer->user_id, '_give_user_address', true );
285
+										$address  = get_user_meta($customer->user_id, '_give_user_address', true);
286 286
 										$defaults = array(
287 287
 											'line1'   => '',
288 288
 											'line2'   => '',
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 											'zip'     => ''
293 293
 										);
294 294
 
295
-										$address = wp_parse_args( $address, $defaults );
295
+										$address = wp_parse_args($address, $defaults);
296 296
 										?>
297 297
 
298
-										<?php if ( ! empty( $address ) ) { ?>
298
+										<?php if ( ! empty($address)) { ?>
299 299
 											<span class="customer-address info-item editable">
300 300
 												<span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span>
301 301
 												<span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span>
@@ -306,43 +306,43 @@  discard block
 block discarded – undo
306 306
 											</span>
307 307
 										<?php } ?>
308 308
 										<span class="customer-address info-item edit-item">
309
-											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" />
310
-											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" />
311
-											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" />
309
+											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" />
310
+											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" />
311
+											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" />
312 312
 											<select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item">
313 313
 												<?php
314 314
 
315 315
 												$selected_country = $address['country'];
316 316
 
317 317
 												$countries = give_get_country_list();
318
-												foreach ( $countries as $country_code => $country ) {
319
-													echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
318
+												foreach ($countries as $country_code => $country) {
319
+													echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
320 320
 												}
321 321
 												?>
322 322
 											</select>
323 323
 											<?php
324 324
 											$selected_state = give_get_state();
325
-											$states         = give_get_states( $selected_country );
325
+											$states         = give_get_states($selected_country);
326 326
 
327
-											$selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state;
327
+											$selected_state = isset($address['state']) ? $address['state'] : $selected_state;
328 328
 
329
-											if ( ! empty( $states ) ) {
329
+											if ( ! empty($states)) {
330 330
 												?>
331 331
 												<select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item">
332 332
 													<?php
333
-													foreach ( $states as $state_code => $state ) {
334
-														echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
333
+													foreach ($states as $state_code => $state) {
334
+														echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
335 335
 													}
336 336
 													?>
337 337
 												</select>
338 338
 												<?php
339 339
 											} else {
340 340
 												?>
341
-												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>" />
341
+												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>" />
342 342
 												<?php
343 343
 											}
344 344
 											?>
345
-											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" />
345
+											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" />
346 346
 										</span>
347 347
 
348 348
 									</div>
@@ -358,10 +358,10 @@  discard block
 block discarded – undo
358 358
 
359 359
 			<span id="customer-edit-actions" class="edit-item">
360 360
 				<input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" />
361
-				<?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?>
361
+				<?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?>
362 362
 				<input type="hidden" name="give_action" value="edit-customer" />
363
-				<input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e( 'Update Donor', 'give' ); ?>" />
364
-				<a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
363
+				<input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" />
364
+				<a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a>
365 365
 			</span>
366 366
 
367 367
 		</form>
@@ -376,24 +376,24 @@  discard block
 block discarded – undo
376 376
 	 *
377 377
 	 * @param object $customer The customer object being displayed.
378 378
 	 */
379
-	do_action( 'give_donor_before_stats', $customer );
379
+	do_action('give_donor_before_stats', $customer);
380 380
 	?>
381 381
 
382 382
 	<div id="customer-stats-wrapper" class="customer-section postbox clear">
383 383
 		<ul>
384 384
 			<li>
385
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>">
385
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>">
386 386
 					<span class="dashicons dashicons-heart"></span>
387 387
 					<?php
388 388
 					//Completed Donations
389
-					$completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count );
390
-					echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer );
389
+					$completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count);
390
+					echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer);
391 391
 					?>
392 392
 				</a>
393 393
 			</li>
394 394
 			<li>
395 395
 				<span class="dashicons dashicons-chart-area"></span>
396
-				<?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php esc_html_e( 'Lifetime Donations', 'give' ); ?>
396
+				<?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php esc_html_e('Lifetime Donations', 'give'); ?>
397 397
 			</li>
398 398
 			<?php
399 399
 			/**
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 			 *
406 406
 			 * @param object $customer The customer object being displayed.
407 407
 			 */
408
-			do_action( 'give_donor_stats_list', $customer );
408
+			do_action('give_donor_stats_list', $customer);
409 409
 			?>
410 410
 		</ul>
411 411
 	</div>
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	 *
419 419
 	 * @param object $customer The customer object being displayed.
420 420
 	 */
421
-	do_action( 'give_donor_before_tables_wrapper', $customer );
421
+	do_action('give_donor_before_tables_wrapper', $customer);
422 422
 	?>
423 423
 
424 424
 	<div id="customer-tables-wrapper" class="customer-section">
@@ -431,40 +431,40 @@  discard block
 block discarded – undo
431 431
 		 *
432 432
 		 * @param object $customer The customer object being displayed.
433 433
 		 */
434
-		do_action( 'give_donor_before_tables', $customer );
434
+		do_action('give_donor_before_tables', $customer);
435 435
 		?>
436 436
 
437
-		<h3><?php _e( 'Donor Emails', 'give' ); ?></h3>
437
+		<h3><?php _e('Donor Emails', 'give'); ?></h3>
438 438
 
439 439
 		<table class="wp-list-table widefat striped emails">
440 440
 			<thead>
441 441
 				<tr>
442
-					<th><?php _e( 'Email', 'give' ); ?></th>
443
-					<th><?php _e( 'Actions', 'give' ); ?></th>
442
+					<th><?php _e('Email', 'give'); ?></th>
443
+					<th><?php _e('Actions', 'give'); ?></th>
444 444
 				</tr>
445 445
 			</thead>
446 446
 
447 447
 			<tbody>
448
-				<?php if ( ! empty( $customer->emails ) ) { ?>
448
+				<?php if ( ! empty($customer->emails)) { ?>
449 449
 
450
-					<?php foreach ( $customer->emails as $key => $email ) : ?>
450
+					<?php foreach ($customer->emails as $key => $email) : ?>
451 451
 						<tr data-key="<?php echo $key; ?>">
452 452
 							<td>
453 453
 								<?php echo $email; ?>
454
-								<?php if ( 'primary' === $key ) : ?>
454
+								<?php if ('primary' === $key) : ?>
455 455
 									<span class="dashicons dashicons-star-filled primary-email-icon"></span>
456 456
 								<?php endif; ?>
457 457
 							</td>
458 458
 							<td>
459
-								<?php if ( 'primary' !== $key ) : ?>
459
+								<?php if ('primary' !== $key) : ?>
460 460
 									<?php
461
-									$base_url    = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id );
462
-									$promote_url = wp_nonce_url( add_query_arg( array( 'email' => rawurlencode( $email ), 'give_action' => 'set_donor_primary_email'), $base_url ), 'give-set-donor-primary-email' );
463
-									$remove_url  = wp_nonce_url( add_query_arg( array( 'email' => rawurlencode( $email ), 'give_action' => 'remove_donor_email' ), $base_url ), 'give-remove-donor-email'      );
461
+									$base_url    = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id);
462
+									$promote_url = wp_nonce_url(add_query_arg(array('email' => rawurlencode($email), 'give_action' => 'set_donor_primary_email'), $base_url), 'give-set-donor-primary-email');
463
+									$remove_url  = wp_nonce_url(add_query_arg(array('email' => rawurlencode($email), 'give_action' => 'remove_donor_email'), $base_url), 'give-remove-donor-email');
464 464
 									?>
465
-									<a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a>
465
+									<a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a>
466 466
 									&nbsp;|&nbsp;
467
-									<a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a>
467
+									<a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a>
468 468
 								<?php endif; ?>
469 469
 							</td>
470 470
 						</tr>
@@ -474,56 +474,56 @@  discard block
 block discarded – undo
474 474
 						<td colspan="2" class="add-customer-email-td">
475 475
 							<div class="add-customer-email-wrapper">
476 476
 								<input type="hidden" name="customer-id" value="<?php echo $customer->id; ?>" />
477
-								<?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?>
478
-								<input type="email" name="additional-email" value="" placeholder="<?php _e( 'Email Address', 'give' ); ?>" />&nbsp;
479
-								<input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" />&nbsp;<label for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label>
480
-								<button class="button-secondary give-add-customer-email" id="add-customer-email"><?php _e( 'Add Email', 'give' ); ?></button>
477
+								<?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?>
478
+								<input type="email" name="additional-email" value="" placeholder="<?php _e('Email Address', 'give'); ?>" />&nbsp;
479
+								<input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" />&nbsp;<label for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label>
480
+								<button class="button-secondary give-add-customer-email" id="add-customer-email"><?php _e('Add Email', 'give'); ?></button>
481 481
 								<span class="spinner"></span>
482 482
 							</div>
483 483
 							<div class="notice-wrap"></div>
484 484
 						</td>
485 485
 					</tr>
486 486
 				<?php } else { ?>
487
-					<tr><td colspan="2"><?php _e( 'No Emails Found', 'easy-digital-downloads' ); ?></td></tr>
487
+					<tr><td colspan="2"><?php _e('No Emails Found', 'easy-digital-downloads'); ?></td></tr>
488 488
 				<?php } ?>
489 489
 			</tbody>
490 490
 		</table>
491 491
 
492
-		<h3><?php esc_html_e( 'Recent Donations', 'give' ); ?></h3>
492
+		<h3><?php esc_html_e('Recent Donations', 'give'); ?></h3>
493 493
 		<?php
494
-		$payment_ids = explode( ',', $customer->payment_ids );
495
-		$payments    = give_get_payments( array( 'post__in' => $payment_ids ) );
496
-		$payments    = array_slice( $payments, 0, 10 );
494
+		$payment_ids = explode(',', $customer->payment_ids);
495
+		$payments    = give_get_payments(array('post__in' => $payment_ids));
496
+		$payments    = array_slice($payments, 0, 10);
497 497
 		?>
498 498
 		<table class="wp-list-table widefat striped payments">
499 499
 			<thead>
500 500
 			<tr>
501
-				<th scope="col"><?php esc_html_e( 'ID', 'give' ); ?></th>
502
-				<th scope="col"><?php esc_html_e( 'Amount', 'give' ); ?></th>
503
-				<th scope="col"><?php esc_html_e( 'Date', 'give' ); ?></th>
504
-				<th scope="col"><?php esc_html_e( 'Status', 'give' ); ?></th>
505
-				<th scope="col"><?php esc_html_e( 'Actions', 'give' ); ?></th>
501
+				<th scope="col"><?php esc_html_e('ID', 'give'); ?></th>
502
+				<th scope="col"><?php esc_html_e('Amount', 'give'); ?></th>
503
+				<th scope="col"><?php esc_html_e('Date', 'give'); ?></th>
504
+				<th scope="col"><?php esc_html_e('Status', 'give'); ?></th>
505
+				<th scope="col"><?php esc_html_e('Actions', 'give'); ?></th>
506 506
 			</tr>
507 507
 			</thead>
508 508
 			<tbody>
509
-			<?php if ( ! empty( $payments ) ) { ?>
510
-				<?php foreach ( $payments as $payment ) : ?>
509
+			<?php if ( ! empty($payments)) { ?>
510
+				<?php foreach ($payments as $payment) : ?>
511 511
 					<tr>
512 512
 						<td><?php echo $payment->ID; ?></td>
513
-						<td><?php echo give_payment_amount( $payment->ID ); ?></td>
514
-						<td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td>
515
-						<td><?php echo give_get_payment_status( $payment, true ); ?></td>
513
+						<td><?php echo give_payment_amount($payment->ID); ?></td>
514
+						<td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td>
515
+						<td><?php echo give_get_payment_status($payment, true); ?></td>
516 516
 						<td>
517 517
 							<?php
518 518
 							printf(
519 519
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
520
-								admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ),
520
+								admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID),
521 521
 								sprintf(
522 522
 									/* translators: %s: Donation ID */
523
-									esc_attr__( 'View Donation %s.', 'give' ),
523
+									esc_attr__('View Donation %s.', 'give'),
524 524
 									$payment->ID
525 525
 								),
526
-								esc_html__( 'View Donation', 'give' )
526
+								esc_html__('View Donation', 'give')
527 527
 							);
528 528
 							?>
529 529
 
@@ -538,46 +538,46 @@  discard block
 block discarded – undo
538 538
 							 * @param object $customer The customer object being displayed.
539 539
 							 * @param object $payment  The payment object being displayed.
540 540
 							 */
541
-							do_action( 'give_donor_recent_purchases_actions', $customer, $payment );
541
+							do_action('give_donor_recent_purchases_actions', $customer, $payment);
542 542
 							?>
543 543
 						</td>
544 544
 					</tr>
545 545
 				<?php endforeach; ?>
546 546
 			<?php } else { ?>
547 547
 				<tr>
548
-					<td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); ?></td>
548
+					<td colspan="5"><?php esc_html_e('No donations found.', 'give'); ?></td>
549 549
 				</tr>
550 550
 			<?php } ?>
551 551
 			</tbody>
552 552
 		</table>
553 553
 
554
-		<h3><?php esc_html_e( 'Completed Forms', 'give' ); ?></h3>
554
+		<h3><?php esc_html_e('Completed Forms', 'give'); ?></h3>
555 555
 		<?php
556
-		$donations = give_get_users_completed_donations( $customer->email );
556
+		$donations = give_get_users_completed_donations($customer->email);
557 557
 		?>
558 558
 		<table class="wp-list-table widefat striped donations">
559 559
 			<thead>
560 560
 			<tr>
561
-				<th scope="col"><?php esc_html_e( 'Form', 'give' ); ?></th>
562
-				<th scope="col" width="120px"><?php esc_html_e( 'Actions', 'give' ); ?></th>
561
+				<th scope="col"><?php esc_html_e('Form', 'give'); ?></th>
562
+				<th scope="col" width="120px"><?php esc_html_e('Actions', 'give'); ?></th>
563 563
 			</tr>
564 564
 			</thead>
565 565
 			<tbody>
566
-			<?php if ( ! empty( $donations ) ) { ?>
567
-				<?php foreach ( $donations as $donation ) : ?>
566
+			<?php if ( ! empty($donations)) { ?>
567
+				<?php foreach ($donations as $donation) : ?>
568 568
 					<tr>
569 569
 						<td><?php echo $donation->post_title; ?></td>
570 570
 						<td>
571 571
 							<?php
572 572
 							printf(
573 573
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
574
-								esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ),
574
+								esc_url(admin_url('post.php?action=edit&post='.$donation->ID)),
575 575
 								sprintf(
576 576
 									/* translators: %s: form name */
577
-									esc_attr__( 'View Form %s.', 'give' ),
577
+									esc_attr__('View Form %s.', 'give'),
578 578
 									$donation->post_title
579 579
 								),
580
-								esc_html__( 'View Form', 'give' )
580
+								esc_html__('View Form', 'give')
581 581
 							);
582 582
 							?>
583 583
 						</td>
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 				<?php endforeach; ?>
586 586
 			<?php } else { ?>
587 587
 				<tr>
588
-					<td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' ); ?></td>
588
+					<td colspan="2"><?php esc_html_e('No completed donations found.', 'give'); ?></td>
589 589
 				</tr>
590 590
 			<?php } ?>
591 591
 			</tbody>
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 		 *
600 600
 		 * @param object $customer The customer object being displayed.
601 601
 		 */
602
-		do_action( 'give_donor_after_tables', $customer );
602
+		do_action('give_donor_after_tables', $customer);
603 603
 		?>
604 604
 
605 605
 	</div>
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 	 *
613 613
 	 * @param object $customer The customer object being displayed.
614 614
 	 */
615
-	do_action( 'give_donor_card_bottom', $customer );
615
+	do_action('give_donor_card_bottom', $customer);
616 616
 
617 617
 }
618 618
 
@@ -625,30 +625,30 @@  discard block
 block discarded – undo
625 625
  *
626 626
  * @return void
627 627
  */
628
-function give_customer_notes_view( $customer ) {
628
+function give_customer_notes_view($customer) {
629 629
 
630
-	$paged          = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
631
-	$paged          = absint( $paged );
630
+	$paged          = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1;
631
+	$paged          = absint($paged);
632 632
 	$note_count     = $customer->get_notes_count();
633
-	$per_page       = apply_filters( 'give_customer_notes_per_page', 20 );
634
-	$total_pages    = ceil( $note_count / $per_page );
635
-	$customer_notes = $customer->get_notes( $per_page, $paged );
633
+	$per_page       = apply_filters('give_customer_notes_per_page', 20);
634
+	$total_pages    = ceil($note_count / $per_page);
635
+	$customer_notes = $customer->get_notes($per_page, $paged);
636 636
 	?>
637 637
 
638 638
 	<div id="customer-notes-wrapper">
639 639
 		<div class="customer-notes-header">
640
-			<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
640
+			<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
641 641
 		</div>
642
-		<h3><?php esc_html_e( 'Notes', 'give' ); ?></h3>
642
+		<h3><?php esc_html_e('Notes', 'give'); ?></h3>
643 643
 
644
-		<?php if ( 1 == $paged ) : ?>
644
+		<?php if (1 == $paged) : ?>
645 645
 			<div style="display: block; margin-bottom: 55px;">
646
-				<form id="give-add-customer-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $customer->id ); ?>">
646
+				<form id="give-add-customer-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$customer->id); ?>">
647 647
 					<textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea>
648 648
 					<br />
649 649
 					<input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" />
650 650
 					<input type="hidden" name="give_action" value="add-customer-note" />
651
-					<?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?>
651
+					<?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?>
652 652
 					<input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" />
653 653
 				</form>
654 654
 			</div>
@@ -663,26 +663,26 @@  discard block
 block discarded – undo
663 663
 			'show_all' => true
664 664
 		);
665 665
 
666
-		echo paginate_links( $pagination_args );
666
+		echo paginate_links($pagination_args);
667 667
 		?>
668 668
 
669 669
 		<div id="give-customer-notes" class="postbox">
670
-			<?php if ( count( $customer_notes ) > 0 ) { ?>
671
-				<?php foreach ( $customer_notes as $key => $note ) : ?>
670
+			<?php if (count($customer_notes) > 0) { ?>
671
+				<?php foreach ($customer_notes as $key => $note) : ?>
672 672
 					<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
673 673
 					<span class="note-content-wrap">
674
-						<?php echo stripslashes( $note ); ?>
674
+						<?php echo stripslashes($note); ?>
675 675
 					</span>
676 676
 					</div>
677 677
 				<?php endforeach; ?>
678 678
 			<?php } else { ?>
679 679
 				<div class="give-no-customer-notes">
680
-					<?php esc_html_e( 'No donor notes found.', 'give' ); ?>
680
+					<?php esc_html_e('No donor notes found.', 'give'); ?>
681 681
 				</div>
682 682
 			<?php } ?>
683 683
 		</div>
684 684
 
685
-		<?php echo paginate_links( $pagination_args ); ?>
685
+		<?php echo paginate_links($pagination_args); ?>
686 686
 
687 687
 	</div>
688 688
 
@@ -698,9 +698,9 @@  discard block
 block discarded – undo
698 698
  *
699 699
  * @return void
700 700
  */
701
-function give_customers_delete_view( $customer ) {
701
+function give_customers_delete_view($customer) {
702 702
 
703
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
703
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
704 704
 
705 705
 	/**
706 706
 	 * Fires in donor delete screen, above the content.
@@ -709,15 +709,15 @@  discard block
 block discarded – undo
709 709
 	 *
710 710
 	 * @param object $customer The customer object being displayed.
711 711
 	 */
712
-	do_action( 'give_customer_delete_top', $customer );
712
+	do_action('give_customer_delete_top', $customer);
713 713
 	?>
714 714
 
715 715
 	<div class="info-wrapper customer-section">
716 716
 
717
-		<form id="delete-customer" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer->id ); ?>">
717
+		<form id="delete-customer" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer->id); ?>">
718 718
 
719 719
 			<div class="customer-notes-header">
720
-				<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
720
+				<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
721 721
 			</div>
722 722
 
723 723
 
@@ -725,16 +725,16 @@  discard block
 block discarded – undo
725 725
 
726 726
 				<span class="delete-customer-options">
727 727
 					<p>
728
-						<?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?>
729
-						<label for="give-customer-delete-confirm"><?php esc_html_e( 'Are you sure you want to delete this donor?', 'give' ); ?></label>
728
+						<?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?>
729
+						<label for="give-customer-delete-confirm"><?php esc_html_e('Are you sure you want to delete this donor?', 'give'); ?></label>
730 730
 					</p>
731 731
 
732 732
 					<p>
733
-						<?php echo Give()->html->checkbox( array(
733
+						<?php echo Give()->html->checkbox(array(
734 734
 							'name'    => 'give-customer-delete-records',
735
-							'options' => array( 'disabled' => true )
736
-						) ); ?>
737
-						<label for="give-customer-delete-records"><?php esc_html_e( 'Delete all associated donations and records?', 'give' ); ?></label>
735
+							'options' => array('disabled' => true)
736
+						)); ?>
737
+						<label for="give-customer-delete-records"><?php esc_html_e('Delete all associated donations and records?', 'give'); ?></label>
738 738
 					</p>
739 739
 
740 740
 					<?php
@@ -747,16 +747,16 @@  discard block
 block discarded – undo
747 747
 					 *
748 748
 					 * @param object $customer The customer object being displayed.
749 749
 					 */
750
-					do_action( 'give_customer_delete_inputs', $customer );
750
+					do_action('give_customer_delete_inputs', $customer);
751 751
 					?>
752 752
 				</span>
753 753
 
754 754
 				<span id="customer-edit-actions">
755 755
 					<input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" />
756
-					<?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?>
756
+					<?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?>
757 757
 					<input type="hidden" name="give_action" value="delete-customer" />
758
-					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e( 'Delete Donor', 'give' ); ?>" />
759
-					<a id="give-delete-customer-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
758
+					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e('Delete Donor', 'give'); ?>" />
759
+					<a id="give-delete-customer-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a>
760 760
 				</span>
761 761
 
762 762
 			</div>
@@ -772,5 +772,5 @@  discard block
 block discarded – undo
772 772
 	 *
773 773
 	 * @param object $customer The customer object being displayed.
774 774
 	 */
775
-	do_action( 'give_customer_delete_bottom', $customer );
775
+	do_action('give_customer_delete_bottom', $customer);
776 776
 }
Please login to merge, or discard this patch.