Test Failed
Pull Request — master (#2199)
by Ravinder
04:54
created
includes/admin/payments/actions.php 1 patch
Spacing   +124 added lines, -124 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,52 +25,52 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return      void
27 27
  */
28
-function give_update_payment_details( $data ) {
28
+function give_update_payment_details($data) {
29 29
 
30
-	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
31
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) {
31
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	check_admin_referer( 'give_update_payment_details_nonce' );
34
+	check_admin_referer('give_update_payment_details_nonce');
35 35
 
36 36
 	// Retrieve the payment ID.
37
-	$payment_id = absint( $data['give_payment_id'] );
37
+	$payment_id = absint($data['give_payment_id']);
38 38
 
39 39
 	/* @var Give_Payment $payment */
40
-	$payment = new Give_Payment( $payment_id );
40
+	$payment = new Give_Payment($payment_id);
41 41
 
42 42
 	// Retrieve existing payment meta.
43 43
 	$meta      = $payment->get_meta();
44 44
 	$user_info = $payment->user_info;
45 45
 
46 46
 	$status = $data['give-payment-status'];
47
-	$date   = sanitize_text_field( $data['give-payment-date'] );
48
-	$hour   = sanitize_text_field( $data['give-payment-time-hour'] );
47
+	$date   = sanitize_text_field($data['give-payment-date']);
48
+	$hour   = sanitize_text_field($data['give-payment-time-hour']);
49 49
 
50 50
 	// Restrict to our high and low.
51
-	if ( $hour > 23 ) {
51
+	if ($hour > 23) {
52 52
 		$hour = 23;
53
-	} elseif ( $hour < 0 ) {
53
+	} elseif ($hour < 0) {
54 54
 		$hour = 00;
55 55
 	}
56 56
 
57
-	$minute = sanitize_text_field( $data['give-payment-time-min'] );
57
+	$minute = sanitize_text_field($data['give-payment-time-min']);
58 58
 
59 59
 	// Restrict to our high and low.
60
-	if ( $minute > 59 ) {
60
+	if ($minute > 59) {
61 61
 		$minute = 59;
62
-	} elseif ( $minute < 0 ) {
62
+	} elseif ($minute < 0) {
63 63
 		$minute = 00;
64 64
 	}
65 65
 
66
-	$address = array_map( 'trim', $data['give-payment-address'][0] );
66
+	$address = array_map('trim', $data['give-payment-address'][0]);
67 67
 
68 68
 	$curr_total = $payment->total;
69
-	$new_total  = give_maybe_sanitize_amount( $data['give-payment-total'] );
70
-	$date       = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00';
69
+	$new_total  = give_maybe_sanitize_amount($data['give-payment-total']);
70
+	$date       = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00';
71 71
 
72
-	$curr_donor_id = sanitize_text_field( $data['give-current-donor'] );
73
-	$new_donor_id  = sanitize_text_field( $data['donor-id'] );
72
+	$curr_donor_id = sanitize_text_field($data['give-current-donor']);
73
+	$new_donor_id  = sanitize_text_field($data['donor-id']);
74 74
 
75 75
 	/**
76 76
 	 * Fires before updating edited donation.
@@ -80,98 +80,98 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param int $payment_id The ID of the payment.
82 82
 	 */
83
-	do_action( 'give_update_edited_donation', $payment_id );
83
+	do_action('give_update_edited_donation', $payment_id);
84 84
 
85 85
 	$payment->date = $date;
86 86
 	$updated       = $payment->save();
87 87
 
88
-	if ( 0 === $updated ) {
89
-		wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
88
+	if (0 === $updated) {
89
+		wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
90 90
 	}
91 91
 
92 92
 	$donor_changed = false;
93 93
 
94
-	if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) {
94
+	if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') {
95 95
 
96
-		$email = isset( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : '';
97
-		$names = isset( $data['give-new-donor-name'] ) ? sanitize_text_field( $data['give-new-donor-name'] ) : '';
96
+		$email = isset($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : '';
97
+		$names = isset($data['give-new-donor-name']) ? sanitize_text_field($data['give-new-donor-name']) : '';
98 98
 
99
-		if ( empty( $email ) || empty( $names ) ) {
100
-			wp_die( esc_html__( 'New donors require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
99
+		if (empty($email) || empty($names)) {
100
+			wp_die(esc_html__('New donors require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
101 101
 		}
102 102
 
103
-		$donor = new Give_Donor( $email );
104
-		if ( empty( $donor->id ) ) {
105
-			$donor_data = array( 'name' => $names, 'email' => $email );
106
-			$user_id       = email_exists( $email );
107
-			if ( false !== $user_id ) {
103
+		$donor = new Give_Donor($email);
104
+		if (empty($donor->id)) {
105
+			$donor_data = array('name' => $names, 'email' => $email);
106
+			$user_id = email_exists($email);
107
+			if (false !== $user_id) {
108 108
 				$donor_data['user_id'] = $user_id;
109 109
 			}
110 110
 
111
-			if ( ! $donor->create( $donor_data ) ) {
111
+			if ( ! $donor->create($donor_data)) {
112 112
 				// Failed to crete the new donor, assume the previous donor.
113 113
 				$donor_changed = false;
114
-				$donor         = new Give_Donor( $curr_donor_id );
115
-				give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) );
114
+				$donor         = new Give_Donor($curr_donor_id);
115
+				give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give'));
116 116
 			}
117 117
 		}
118 118
 
119 119
 		$new_donor_id = $donor->id;
120 120
 
121
-		$previous_donor = new Give_Donor( $curr_donor_id );
121
+		$previous_donor = new Give_Donor($curr_donor_id);
122 122
 
123 123
 		$donor_changed = true;
124 124
 
125
-	} elseif ( $curr_donor_id !== $new_donor_id ) {
125
+	} elseif ($curr_donor_id !== $new_donor_id) {
126 126
 
127
-		$donor = new Give_Donor( $new_donor_id );
127
+		$donor = new Give_Donor($new_donor_id);
128 128
 		$email    = $donor->email;
129 129
 		$names    = $donor->name;
130 130
 
131
-		$previous_donor = new Give_Donor( $curr_donor_id );
131
+		$previous_donor = new Give_Donor($curr_donor_id);
132 132
 
133 133
 		$donor_changed = true;
134 134
 
135 135
 	} else {
136 136
 
137
-		$donor = new Give_Donor( $curr_donor_id );
137
+		$donor = new Give_Donor($curr_donor_id);
138 138
 		$email    = $donor->email;
139 139
 		$names    = $donor->name;
140 140
 
141 141
 	}
142 142
 
143 143
 	// Setup first and last name from input values.
144
-	$names      = explode( ' ', $names );
145
-	$first_name = ! empty( $names[0] ) ? $names[0] : '';
144
+	$names      = explode(' ', $names);
145
+	$first_name = ! empty($names[0]) ? $names[0] : '';
146 146
 	$last_name  = '';
147
-	if ( ! empty( $names[1] ) ) {
148
-		unset( $names[0] );
149
-		$last_name = implode( ' ', $names );
147
+	if ( ! empty($names[1])) {
148
+		unset($names[0]);
149
+		$last_name = implode(' ', $names);
150 150
 	}
151 151
 
152
-	if ( $donor_changed ) {
152
+	if ($donor_changed) {
153 153
 
154 154
 		// Remove the stats and payment from the previous donor and attach it to the new donor.
155
-		$previous_donor->remove_payment( $payment_id, false );
156
-		$donor->attach_payment( $payment_id, false );
155
+		$previous_donor->remove_payment($payment_id, false);
156
+		$donor->attach_payment($payment_id, false);
157 157
 
158
-		if ( 'publish' == $status ) {
158
+		if ('publish' == $status) {
159 159
 
160 160
 			// Reduce previous user donation count and amount.
161 161
 			$previous_donor->decrease_donation_count();
162
-			$previous_donor->decrease_value( $curr_total );
162
+			$previous_donor->decrease_value($curr_total);
163 163
 
164 164
 			// If donation was completed adjust stats of new donors.
165 165
 			$donor->increase_purchase_count();
166
-			$donor->increase_value( $new_total );
166
+			$donor->increase_value($new_total);
167 167
 		}
168 168
 
169 169
 		$payment->customer_id = $donor->id;
170 170
 	} else {
171 171
 
172
-		if ( 'publish' === $status ) {
172
+		if ('publish' === $status) {
173 173
 			// Update user donation stat.
174
-			$donor->update_donation_value( $curr_total, $new_total );
174
+			$donor->update_donation_value($curr_total, $new_total);
175 175
 		}
176 176
 	}
177 177
 
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 	$payment->total      = $new_total;
185 185
 
186 186
 	// Check for payment notes.
187
-	if ( ! empty( $data['give-payment-note'] ) ) {
187
+	if ( ! empty($data['give-payment-note'])) {
188 188
 
189
-		$note = wp_kses( $data['give-payment-note'], array() );
190
-		give_insert_payment_note( $payment_id, $note );
189
+		$note = wp_kses($data['give-payment-note'], array());
190
+		give_insert_payment_note($payment_id, $note);
191 191
 
192 192
 	}
193 193
 
@@ -195,17 +195,17 @@  discard block
 block discarded – undo
195 195
 	$payment->status = $status;
196 196
 
197 197
 	// Adjust total store earnings if the payment total has been changed.
198
-	if ( $new_total !== $curr_total && 'publish' == $status ) {
198
+	if ($new_total !== $curr_total && 'publish' == $status) {
199 199
 
200
-		if ( $new_total > $curr_total ) {
200
+		if ($new_total > $curr_total) {
201 201
 			// Increase if our new total is higher.
202 202
 			$difference = $new_total - $curr_total;
203
-			give_increase_total_earnings( $difference );
203
+			give_increase_total_earnings($difference);
204 204
 
205
-		} elseif ( $curr_total > $new_total ) {
205
+		} elseif ($curr_total > $new_total) {
206 206
 			// Decrease if our new total is lower.
207 207
 			$difference = $curr_total - $new_total;
208
-			give_decrease_total_earnings( $difference );
208
+			give_decrease_total_earnings($difference);
209 209
 
210 210
 		}
211 211
 	}
@@ -213,16 +213,16 @@  discard block
 block discarded – undo
213 213
 	$payment->save();
214 214
 
215 215
 	// Get new give form ID.
216
-	$new_form_id     = absint( $data['give-payment-form-select'] );
217
-	$current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
216
+	$new_form_id     = absint($data['give-payment-form-select']);
217
+	$current_form_id = absint($payment->get_meta('_give_payment_form_id'));
218 218
 
219 219
 	// We are adding payment transfer code in last to remove any conflict with above functionality.
220 220
 	// For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
221 221
 	// Check if user want to transfer current payment to new give form id.
222
-	if ( $new_form_id != $current_form_id ) {
222
+	if ($new_form_id != $current_form_id) {
223 223
 
224 224
 		// Get new give form title.
225
-		$new_form_title = get_the_title( $new_form_id );
225
+		$new_form_title = get_the_title($new_form_id);
226 226
 
227 227
 		// Update new give form data in payment data.
228 228
 		$payment_meta               = $payment->get_meta();
@@ -230,43 +230,43 @@  discard block
 block discarded – undo
230 230
 		$payment_meta['form_id']    = $new_form_id;
231 231
 
232 232
 		// Update price id post meta data for set donation form.
233
-		if ( ! give_has_variable_prices( $new_form_id ) ) {
233
+		if ( ! give_has_variable_prices($new_form_id)) {
234 234
 			$payment_meta['price_id'] = '';
235 235
 		}
236 236
 
237 237
 		// Update payment give form meta data.
238
-		$payment->update_meta( '_give_payment_form_id', $new_form_id );
239
-		$payment->update_meta( '_give_payment_form_title', $new_form_title );
240
-		$payment->update_meta( '_give_payment_meta', $payment_meta );
238
+		$payment->update_meta('_give_payment_form_id', $new_form_id);
239
+		$payment->update_meta('_give_payment_form_title', $new_form_title);
240
+		$payment->update_meta('_give_payment_meta', $payment_meta);
241 241
 
242 242
 		// Update price id payment metadata.
243
-		if ( ! give_has_variable_prices( $new_form_id ) ) {
244
-			$payment->update_meta( '_give_payment_price_id', '' );
243
+		if ( ! give_has_variable_prices($new_form_id)) {
244
+			$payment->update_meta('_give_payment_price_id', '');
245 245
 		}
246 246
 
247 247
 		// If donation was completed, adjust stats of forms.
248
-		if ( 'publish' == $status ) {
248
+		if ('publish' == $status) {
249 249
 
250 250
 			// Decrease sale of old give form. For other payment status.
251
-			$current_form = new Give_Donate_Form( $current_form_id );
251
+			$current_form = new Give_Donate_Form($current_form_id);
252 252
 			$current_form->decrease_sales();
253
-			$current_form->decrease_earnings( $curr_total );
253
+			$current_form->decrease_earnings($curr_total);
254 254
 
255 255
 			// Increase sale of new give form.
256
-			$new_form = new Give_Donate_Form( $new_form_id );
256
+			$new_form = new Give_Donate_Form($new_form_id);
257 257
 			$new_form->increase_sales();
258
-			$new_form->increase_earnings( $new_total );
258
+			$new_form->increase_earnings($new_total);
259 259
 		}
260 260
 
261 261
 		// Re setup payment to update new meta value in object.
262
-		$payment->update_payment_setup( $payment->ID );
262
+		$payment->update_payment_setup($payment->ID);
263 263
 	}
264 264
 
265 265
 	// Update price id if current form is variable form.
266 266
 	/* @var Give_Donate_Form $form */
267
-	$form = new Give_Donate_Form( $payment->form_id );
267
+	$form = new Give_Donate_Form($payment->form_id);
268 268
 
269
-	if ( isset( $data['give-variable-price'] ) && $form->has_variable_prices() ) {
269
+	if (isset($data['give-variable-price']) && $form->has_variable_prices()) {
270 270
 
271 271
 		// Get payment meta data.
272 272
 		$payment_meta = $payment->get_meta();
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 		$price_id = '';
276 276
 
277 277
 		// Get price info
278
-		if( 0 <= $data['give-variable-price'] ) {
279
-			foreach ( $form->prices as $variable_price ) {
280
-				if( $new_total === give_maybe_sanitize_amount( $variable_price['_give_amount'] ) ) {
278
+		if (0 <= $data['give-variable-price']) {
279
+			foreach ($form->prices as $variable_price) {
280
+				if ($new_total === give_maybe_sanitize_amount($variable_price['_give_amount'])) {
281 281
 					$price_info = $variable_price;
282 282
 					break;
283 283
 				}
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
 		}
286 286
 
287 287
 		// Set price id.
288
-		if( ! empty( $price_info ) ) {
288
+		if ( ! empty($price_info)) {
289 289
 			$price_id = $data['give-variable-price'];
290 290
 
291
-			if( $data['give-variable-price'] !== $price_info['_give_id']['level_id'] ) {
291
+			if ($data['give-variable-price'] !== $price_info['_give_id']['level_id']) {
292 292
 				// Set price id to amount match.
293 293
 				$price_id = $price_info['_give_id']['level_id'];
294 294
 			}
295 295
 
296
-		} elseif( $form->is_custom_price_mode() ){
296
+		} elseif ($form->is_custom_price_mode()) {
297 297
 			$price_id = 'custom';
298 298
 		}
299 299
 
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
 		$payment_meta['price_id'] = $price_id;
302 302
 
303 303
 		// Update payment give form meta data.
304
-		$payment->update_meta( '_give_payment_price_id', $price_id );
305
-		$payment->update_meta( '_give_payment_meta', $payment_meta );
304
+		$payment->update_meta('_give_payment_price_id', $price_id);
305
+		$payment->update_meta('_give_payment_meta', $payment_meta);
306 306
 
307 307
 		// Re setup payment to update new meta value in object.
308
-		$payment->update_payment_setup( $payment->ID );
308
+		$payment->update_payment_setup($payment->ID);
309 309
 	}
310 310
 
311 311
 	/**
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
 	 *
317 317
 	 * @param int $payment_id The ID of the payment.
318 318
 	 */
319
-	do_action( 'give_updated_edited_donation', $payment_id );
319
+	do_action('give_updated_edited_donation', $payment_id);
320 320
 
321
-	wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id=' . $payment_id ) );
321
+	wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id='.$payment_id));
322 322
 	exit;
323 323
 }
324 324
 
325
-add_action( 'give_update_payment_details', 'give_update_payment_details' );
325
+add_action('give_update_payment_details', 'give_update_payment_details');
326 326
 
327 327
 /**
328 328
  * Trigger a Donation Deletion.
@@ -333,48 +333,48 @@  discard block
 block discarded – undo
333 333
  *
334 334
  * @return void
335 335
  */
336
-function give_trigger_donation_delete( $data ) {
337
-	if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) {
336
+function give_trigger_donation_delete($data) {
337
+	if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) {
338 338
 
339
-		$payment_id = absint( $data['purchase_id'] );
339
+		$payment_id = absint($data['purchase_id']);
340 340
 
341
-		if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
342
-			wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
341
+		if ( ! current_user_can('edit_give_payments', $payment_id)) {
342
+			wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
343 343
 		}
344 344
 
345
-		give_delete_donation( $payment_id );
346
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) );
345
+		give_delete_donation($payment_id);
346
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted'));
347 347
 		give_die();
348 348
 	}
349 349
 }
350 350
 
351
-add_action( 'give_delete_payment', 'give_trigger_donation_delete' );
351
+add_action('give_delete_payment', 'give_trigger_donation_delete');
352 352
 
353 353
 /**
354 354
  * AJAX Store Donation Note
355 355
  */
356 356
 function give_ajax_store_payment_note() {
357 357
 
358
-	$payment_id = absint( $_POST['payment_id'] );
359
-	$note       = wp_kses( $_POST['note'], array() );
358
+	$payment_id = absint($_POST['payment_id']);
359
+	$note       = wp_kses($_POST['note'], array());
360 360
 
361
-	if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
362
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
361
+	if ( ! current_user_can('edit_give_payments', $payment_id)) {
362
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
363 363
 	}
364 364
 
365
-	if ( empty( $payment_id ) ) {
366
-		die( '-1' );
365
+	if (empty($payment_id)) {
366
+		die('-1');
367 367
 	}
368 368
 
369
-	if ( empty( $note ) ) {
370
-		die( '-1' );
369
+	if (empty($note)) {
370
+		die('-1');
371 371
 	}
372 372
 
373
-	$note_id = give_insert_payment_note( $payment_id, $note );
374
-	die( give_get_payment_note_html( $note_id ) );
373
+	$note_id = give_insert_payment_note($payment_id, $note);
374
+	die(give_get_payment_note_html($note_id));
375 375
 }
376 376
 
377
-add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' );
377
+add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note');
378 378
 
379 379
 /**
380 380
  * Triggers a donation note deletion without ajax
@@ -385,24 +385,24 @@  discard block
 block discarded – undo
385 385
  *
386 386
  * @return void
387 387
  */
388
-function give_trigger_payment_note_deletion( $data ) {
388
+function give_trigger_payment_note_deletion($data) {
389 389
 
390
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) {
390
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) {
391 391
 		return;
392 392
 	}
393 393
 
394
-	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
395
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
394
+	if ( ! current_user_can('edit_give_payments', $data['payment_id'])) {
395
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
396 396
 	}
397 397
 
398
-	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) );
398
+	$edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id='.absint($data['payment_id']));
399 399
 
400
-	give_delete_payment_note( $data['note_id'], $data['payment_id'] );
400
+	give_delete_payment_note($data['note_id'], $data['payment_id']);
401 401
 
402
-	wp_redirect( $edit_order_url );
402
+	wp_redirect($edit_order_url);
403 403
 }
404 404
 
405
-add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' );
405
+add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion');
406 406
 
407 407
 /**
408 408
  * Delete a payment note deletion with ajax
@@ -413,16 +413,16 @@  discard block
 block discarded – undo
413 413
  */
414 414
 function give_ajax_delete_payment_note() {
415 415
 
416
-	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
417
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
416
+	if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) {
417
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
418 418
 	}
419 419
 
420
-	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
421
-		die( '1' );
420
+	if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) {
421
+		die('1');
422 422
 	} else {
423
-		die( '-1' );
423
+		die('-1');
424 424
 	}
425 425
 
426 426
 }
427 427
 
428
-add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' );
428
+add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note');
Please login to merge, or discard this patch.
templates/emails/header-default.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@  discard block
 block discarded – undo
6 6
  * @version     1.0
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 } // Exit if accessed directly.
12 12
 
13 13
 // For gmail compatibility, including CSS styles in head/body are stripped out therefore styles need to be inline. These variables contain rules which are added to the template inline. !important; is a gmail hack to prevent styles being stripped if it doesn't like something.
14
-$body               = "
14
+$body = "
15 15
 	background-color: #f6f6f6;
16 16
 	font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
17 17
 ";
18
-$wrapper            = "
18
+$wrapper = "
19 19
 	width:100%;
20 20
 	-webkit-text-size-adjust:none !important;
21 21
 	margin:0;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	text-align: center;
43 43
 	vertical-align:middle;
44 44
 ";
45
-$body_content       = "
45
+$body_content = "
46 46
 	border-radius:3px !important;
47 47
 	font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
48 48
 ";
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	line-height:150%;
54 54
 	text-align:left;
55 55
 ";
56
-$header_content_h1  = "
56
+$header_content_h1 = "
57 57
 	color: #000000;
58 58
 	margin:0;
59 59
 	padding: 28px 24px;
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	font-weight: 500;
64 64
 	line-height: 1.2;
65 65
 ";
66
-$header_img         = give_get_option( 'email_logo', '' );
66
+$header_img = give_get_option('email_logo', '');
67 67
 ?>
68 68
 <!DOCTYPE html>
69 69
 <html>
70 70
 <head>
71 71
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
72
-	<title><?php echo get_bloginfo( 'name' ); ?></title>
72
+	<title><?php echo get_bloginfo('name'); ?></title>
73 73
 </head>
74 74
 <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="<?php echo $body; ?>">
75 75
 <div style="<?php echo $wrapper; ?>">
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 		<tr>
78 78
 			<td align="center" valign="top">
79 79
 				<?php
80
-				if ( ! empty( $header_img ) ) : ?>
80
+				if ( ! empty($header_img)) : ?>
81 81
 					<div id="template_header_image">
82
-						<?php echo '<p style="margin-top:0;"><img style="' . $template_image . '" src="' . esc_url( $header_img ) . '" alt="' . get_bloginfo( 'name' ) . '" /></p>'; ?>
82
+						<?php echo '<p style="margin-top:0;"><img style="'.$template_image.'" src="'.esc_url($header_img).'" alt="'.get_bloginfo('name').'" /></p>'; ?>
83 83
 					</div>
84 84
 				<?php endif; ?>
85 85
 				<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_container" style="<?php echo $template_container; ?>">
Please login to merge, or discard this patch.
templates/emails/body.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @version     1.0
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
9
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly.
10 10
 
11 11
 // {email} is replaced by the content entered in Donations > Settings > Emails
12 12
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,10 @@
 block discarded – undo
6 6
  * @version     1.0
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
9
+if ( ! defined( 'ABSPATH' ) ) {
10
+	exit;
11
+}
12
+// Exit if accessed directly.
10 13
 
11 14
 // {email} is replaced by the content entered in Donations > Settings > Emails
12 15
 
Please login to merge, or discard this patch.
includes/plugin-compatibility.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@
 block discarded – undo
39 39
 	}
40 40
 
41 41
 	if ( ( is_plugin_active( 'wordpress-seo/wp-seo.php' )
42
-	       || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) )
43
-	     && class_exists( 'WPSEO_Sitemaps_Cache' )
42
+		   || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) )
43
+		 && class_exists( 'WPSEO_Sitemaps_Cache' )
44 44
 	) {
45 45
 
46 46
 		$forms_singular_option = give_get_option( 'forms_singular' );
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
  * @return void
20 20
  */
21 21
 function give_disable_mandrill_nl2br() {
22
-	add_filter( 'mandrill_nl2br', '__return_false' );
22
+	add_filter('mandrill_nl2br', '__return_false');
23 23
 }
24 24
 
25
-add_action( 'give_email_send_before', 'give_disable_mandrill_nl2br' );
25
+add_action('give_email_send_before', 'give_disable_mandrill_nl2br');
26 26
 
27 27
 
28 28
 /**
@@ -34,30 +34,30 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function give_clear_seo_sitemap_cache_on_settings_change() {
36 36
 	// Load required file if the fn 'is_plugin_active' doesn't exists.
37
-	if ( ! function_exists( 'is_plugin_active' ) ) {
38
-		require_once ABSPATH . 'wp-admin/includes/plugin.php';
37
+	if ( ! function_exists('is_plugin_active')) {
38
+		require_once ABSPATH.'wp-admin/includes/plugin.php';
39 39
 	}
40 40
 
41
-	if ( ( is_plugin_active( 'wordpress-seo/wp-seo.php' )
42
-	       || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) )
43
-	     && class_exists( 'WPSEO_Sitemaps_Cache' )
41
+	if ((is_plugin_active('wordpress-seo/wp-seo.php')
42
+	       || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php'))
43
+	     && class_exists('WPSEO_Sitemaps_Cache')
44 44
 	) {
45 45
 
46
-		$forms_singular_option = give_get_option( 'forms_singular' );
47
-		$forms_archive_option  = give_get_option( 'forms_singular' );
46
+		$forms_singular_option = give_get_option('forms_singular');
47
+		$forms_archive_option  = give_get_option('forms_singular');
48 48
 
49 49
 		// If there is change detected for Single Form View and Form Archives options then proceed.
50 50
 		if (
51
-			( isset( $_POST['forms_singular'] ) && $_POST['forms_singular'] !== $forms_singular_option ) ||
52
-			( isset( $_POST['forms_archives'] ) && $_POST['forms_archives'] !== $forms_archive_option )
51
+			(isset($_POST['forms_singular']) && $_POST['forms_singular'] !== $forms_singular_option) ||
52
+			(isset($_POST['forms_archives']) && $_POST['forms_archives'] !== $forms_archive_option)
53 53
 		) {
54 54
 			// If Yoast SEO or Yoast SEO Premium plugin exists, then update seo sitemap cache.
55 55
 			$yoast_sitemaps_cache = new WPSEO_Sitemaps_Cache();
56
-			if ( method_exists( $yoast_sitemaps_cache, 'clear' ) ) {
56
+			if (method_exists($yoast_sitemaps_cache, 'clear')) {
57 57
 				WPSEO_Sitemaps_Cache::clear();
58 58
 			}
59 59
 		}
60 60
 	}
61 61
 }
62 62
 
63
-add_action( 'give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change' );
63
+add_action('give-settings_save_display', 'give_clear_seo_sitemap_cache_on_settings_change');
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +148 added lines, -148 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,36 +23,36 @@  discard block
 block discarded – undo
23 23
 function give_setup_post_types() {
24 24
 
25 25
 	// Give Forms single post and archive options.
26
-	$give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular' ) );
27
-	$give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives' ) );
26
+	$give_forms_singular = give_is_setting_enabled(give_get_option('forms_singular'));
27
+	$give_forms_archives = give_is_setting_enabled(give_get_option('forms_archives'));
28 28
 
29
-	$give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
29
+	$give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
30 30
 	// Support for old 'GIVE_FORMS_SLUG' constant
31
-	if ( defined( 'GIVE_FORMS_SLUG' ) ) {
31
+	if (defined('GIVE_FORMS_SLUG')) {
32 32
 		$give_forms_slug = GIVE_FORMS_SLUG;
33 33
 	}
34 34
 
35
-	$give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array(
35
+	$give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array(
36 36
 		'slug'       => $give_forms_slug,
37 37
 		'with_front' => false,
38 38
 	);
39 39
 
40
-	$give_forms_labels = apply_filters( 'give_forms_labels', array(
41
-		'name'               => __( 'Donation Forms', 'give' ),
42
-		'singular_name'      => __( 'Form', 'give' ),
43
-		'add_new'            => __( 'Add Form', 'give' ),
44
-		'add_new_item'       => __( 'Add New Donation Form', 'give' ),
45
-		'edit_item'          => __( 'Edit Donation Form', 'give' ),
46
-		'new_item'           => __( 'New Form', 'give' ),
47
-		'all_items'          => __( 'All Forms', 'give' ),
48
-		'view_item'          => __( 'View Form', 'give' ),
49
-		'search_items'       => __( 'Search Forms', 'give' ),
50
-		'not_found'          => __( 'No forms found.', 'give' ),
51
-		'not_found_in_trash' => __( 'No forms found in Trash.', 'give' ),
40
+	$give_forms_labels = apply_filters('give_forms_labels', array(
41
+		'name'               => __('Donation Forms', 'give'),
42
+		'singular_name'      => __('Form', 'give'),
43
+		'add_new'            => __('Add Form', 'give'),
44
+		'add_new_item'       => __('Add New Donation Form', 'give'),
45
+		'edit_item'          => __('Edit Donation Form', 'give'),
46
+		'new_item'           => __('New Form', 'give'),
47
+		'all_items'          => __('All Forms', 'give'),
48
+		'view_item'          => __('View Form', 'give'),
49
+		'search_items'       => __('Search Forms', 'give'),
50
+		'not_found'          => __('No forms found.', 'give'),
51
+		'not_found_in_trash' => __('No forms found in Trash.', 'give'),
52 52
 		'parent_item_colon'  => '',
53
-		'menu_name'          => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ),
54
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ),
55
-	) );
53
+		'menu_name'          => apply_filters('give_menu_name', __('Donations', 'give')),
54
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give')),
55
+	));
56 56
 
57 57
 	// Default give_forms supports.
58 58
 	$give_form_supports = array(
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 	);
65 65
 
66 66
 	// Has the user disabled the excerpt?
67
-	if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) {
68
-		unset( $give_form_supports[2] );
67
+	if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) {
68
+		unset($give_form_supports[2]);
69 69
 	}
70 70
 
71 71
 	// Has user disabled the featured image?
72
-	if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
73
-		unset( $give_form_supports[1] );
74
-		remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
72
+	if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) {
73
+		unset($give_form_supports[1]);
74
+		remove_action('give_before_single_form_summary', 'give_show_form_images');
75 75
 	}
76 76
 
77 77
 	$give_forms_args = array(
@@ -86,42 +86,42 @@  discard block
 block discarded – undo
86 86
 		'has_archive'        => $give_forms_archives,
87 87
 		'menu_icon'          => 'dashicons-give',
88 88
 		'hierarchical'       => false,
89
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
89
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
90 90
 	);
91
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
91
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
92 92
 
93 93
 	/** Donation Post Type */
94 94
 	$payment_labels = array(
95
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
96
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
97
-		'add_new'            => __( 'Add New', 'give' ),
98
-		'add_new_item'       => __( 'Add New Donation', 'give' ),
99
-		'edit_item'          => __( 'Edit Donation', 'give' ),
100
-		'new_item'           => __( 'New Donation', 'give' ),
101
-		'all_items'          => __( 'All Donations', 'give' ),
102
-		'view_item'          => __( 'View Donation', 'give' ),
103
-		'search_items'       => __( 'Search Donations', 'give' ),
104
-		'not_found'          => __( 'No donations found.', 'give' ),
105
-		'not_found_in_trash' => __( 'No donations found in Trash.', 'give' ),
95
+		'name'               => _x('Donations', 'post type general name', 'give'),
96
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
97
+		'add_new'            => __('Add New', 'give'),
98
+		'add_new_item'       => __('Add New Donation', 'give'),
99
+		'edit_item'          => __('Edit Donation', 'give'),
100
+		'new_item'           => __('New Donation', 'give'),
101
+		'all_items'          => __('All Donations', 'give'),
102
+		'view_item'          => __('View Donation', 'give'),
103
+		'search_items'       => __('Search Donations', 'give'),
104
+		'not_found'          => __('No donations found.', 'give'),
105
+		'not_found_in_trash' => __('No donations found in Trash.', 'give'),
106 106
 		'parent_item_colon'  => '',
107
-		'menu_name'          => __( 'Donations', 'give' ),
107
+		'menu_name'          => __('Donations', 'give'),
108 108
 	);
109 109
 
110 110
 	$payment_args = array(
111
-		'labels'          => apply_filters( 'give_payment_labels', $payment_labels ),
111
+		'labels'          => apply_filters('give_payment_labels', $payment_labels),
112 112
 		'public'          => false,
113 113
 		'query_var'       => false,
114 114
 		'rewrite'         => false,
115 115
 		'map_meta_cap'    => true,
116 116
 		'capability_type' => 'give_payment',
117
-		'supports'        => array( 'title' ),
117
+		'supports'        => array('title'),
118 118
 		'can_export'      => true,
119 119
 	);
120
-	register_post_type( 'give_payment', $payment_args );
120
+	register_post_type('give_payment', $payment_args);
121 121
 
122 122
 }
123 123
 
124
-add_action( 'init', 'give_setup_post_types', 1 );
124
+add_action('init', 'give_setup_post_types', 1);
125 125
 
126 126
 
127 127
 /**
@@ -134,30 +134,30 @@  discard block
 block discarded – undo
134 134
  */
135 135
 function give_setup_taxonomies() {
136 136
 
137
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
137
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
138 138
 
139 139
 	/** Categories */
140 140
 	$category_labels = array(
141
-		'name'              => _x( 'Form Categories', 'taxonomy general name', 'give' ),
142
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
143
-		'search_items'      => __( 'Search Categories', 'give' ),
144
-		'all_items'         => __( 'All Categories', 'give' ),
145
-		'parent_item'       => __( 'Parent Category', 'give' ),
146
-		'parent_item_colon' => __( 'Parent Category:', 'give' ),
147
-		'edit_item'         => __( 'Edit Category', 'give' ),
148
-		'update_item'       => __( 'Update Category', 'give' ),
149
-		'add_new_item'      => __( 'Add New Category', 'give' ),
150
-		'new_item_name'     => __( 'New Category Name', 'give' ),
151
-		'menu_name'         => __( 'Categories', 'give' ),
141
+		'name'              => _x('Form Categories', 'taxonomy general name', 'give'),
142
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
143
+		'search_items'      => __('Search Categories', 'give'),
144
+		'all_items'         => __('All Categories', 'give'),
145
+		'parent_item'       => __('Parent Category', 'give'),
146
+		'parent_item_colon' => __('Parent Category:', 'give'),
147
+		'edit_item'         => __('Edit Category', 'give'),
148
+		'update_item'       => __('Update Category', 'give'),
149
+		'add_new_item'      => __('Add New Category', 'give'),
150
+		'new_item_name'     => __('New Category Name', 'give'),
151
+		'menu_name'         => __('Categories', 'give'),
152 152
 	);
153 153
 
154
-	$category_args = apply_filters( 'give_forms_category_args', array(
154
+	$category_args = apply_filters('give_forms_category_args', array(
155 155
 			'hierarchical' => true,
156
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
156
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
157 157
 			'show_ui'      => true,
158 158
 			'query_var'    => 'give_forms_category',
159 159
 			'rewrite'      => array(
160
-				'slug'         => $slug . '/category',
160
+				'slug'         => $slug.'/category',
161 161
 				'with_front'   => false,
162 162
 				'hierarchical' => true,
163 163
 			),
@@ -171,33 +171,33 @@  discard block
 block discarded – undo
171 171
 	);
172 172
 
173 173
 	// Does the user want categories?
174
-	if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
175
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
176
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
174
+	if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
175
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
176
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
177 177
 	}
178 178
 
179 179
 	/** Tags */
180 180
 	$tag_labels = array(
181
-		'name'                  => _x( 'Form Tags', 'taxonomy general name', 'give' ),
182
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
183
-		'search_items'          => __( 'Search Tags', 'give' ),
184
-		'all_items'             => __( 'All Tags', 'give' ),
185
-		'parent_item'           => __( 'Parent Tag', 'give' ),
186
-		'parent_item_colon'     => __( 'Parent Tag:', 'give' ),
187
-		'edit_item'             => __( 'Edit Tag', 'give' ),
188
-		'update_item'           => __( 'Update Tag', 'give' ),
189
-		'add_new_item'          => __( 'Add New Tag', 'give' ),
190
-		'new_item_name'         => __( 'New Tag Name', 'give' ),
191
-		'menu_name'             => __( 'Tags', 'give' ),
192
-		'choose_from_most_used' => __( 'Choose from most used tags.', 'give' ),
181
+		'name'                  => _x('Form Tags', 'taxonomy general name', 'give'),
182
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
183
+		'search_items'          => __('Search Tags', 'give'),
184
+		'all_items'             => __('All Tags', 'give'),
185
+		'parent_item'           => __('Parent Tag', 'give'),
186
+		'parent_item_colon'     => __('Parent Tag:', 'give'),
187
+		'edit_item'             => __('Edit Tag', 'give'),
188
+		'update_item'           => __('Update Tag', 'give'),
189
+		'add_new_item'          => __('Add New Tag', 'give'),
190
+		'new_item_name'         => __('New Tag Name', 'give'),
191
+		'menu_name'             => __('Tags', 'give'),
192
+		'choose_from_most_used' => __('Choose from most used tags.', 'give'),
193 193
 	);
194 194
 
195
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
195
+	$tag_args = apply_filters('give_forms_tag_args', array(
196 196
 			'hierarchical' => false,
197
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
197
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
198 198
 			'show_ui'      => true,
199 199
 			'query_var'    => 'give_forms_tag',
200
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
200
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
201 201
 			'capabilities' => array(
202 202
 				'manage_terms' => 'manage_give_form_terms',
203 203
 				'edit_terms'   => 'edit_give_form_terms',
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
 		)
208 208
 	);
209 209
 
210
-	if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
211
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
212
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
210
+	if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
211
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
212
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
213 213
 	}
214 214
 
215 215
 }
216 216
 
217
-add_action( 'init', 'give_setup_taxonomies', 0 );
217
+add_action('init', 'give_setup_taxonomies', 0);
218 218
 
219 219
 
220 220
 /**
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
  */
226 226
 function give_get_default_form_labels() {
227 227
 	$defaults = array(
228
-		'singular' => __( 'Form', 'give' ),
229
-		'plural'   => __( 'Forms', 'give' ),
228
+		'singular' => __('Form', 'give'),
229
+		'plural'   => __('Forms', 'give'),
230 230
 	);
231 231
 
232
-	return apply_filters( 'give_default_form_name', $defaults );
232
+	return apply_filters('give_default_form_name', $defaults);
233 233
 }
234 234
 
235 235
 /**
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
  *
242 242
  * @return string $defaults['singular'] Singular label
243 243
  */
244
-function give_get_forms_label_singular( $lowercase = false ) {
244
+function give_get_forms_label_singular($lowercase = false) {
245 245
 	$defaults = give_get_default_form_labels();
246 246
 
247
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
247
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
248 248
 }
249 249
 
250 250
 /**
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
  * @since 1.0
254 254
  * @return string $defaults['plural'] Plural label
255 255
  */
256
-function give_get_forms_label_plural( $lowercase = false ) {
256
+function give_get_forms_label_plural($lowercase = false) {
257 257
 	$defaults = give_get_default_form_labels();
258 258
 
259
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
259
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
260 260
 }
261 261
 
262 262
 /**
@@ -268,24 +268,24 @@  discard block
 block discarded – undo
268 268
  *
269 269
  * @return string $title New placeholder text
270 270
  */
271
-function give_change_default_title( $title ) {
271
+function give_change_default_title($title) {
272 272
 	// If a frontend plugin uses this filter (check extensions before changing this function)
273
-	if ( ! is_admin() ) {
274
-		$title = __( 'Enter form title here', 'give' );
273
+	if ( ! is_admin()) {
274
+		$title = __('Enter form title here', 'give');
275 275
 
276 276
 		return $title;
277 277
 	}
278 278
 
279 279
 	$screen = get_current_screen();
280 280
 
281
-	if ( 'give_forms' == $screen->post_type ) {
282
-		$title = __( 'Enter form title here', 'give' );
281
+	if ('give_forms' == $screen->post_type) {
282
+		$title = __('Enter form title here', 'give');
283 283
 	}
284 284
 
285 285
 	return $title;
286 286
 }
287 287
 
288
-add_filter( 'enter_title_here', 'give_change_default_title' );
288
+add_filter('enter_title_here', 'give_change_default_title');
289 289
 
290 290
 /**
291 291
  * Registers Custom Post Statuses which are used by the Payments
@@ -295,67 +295,67 @@  discard block
 block discarded – undo
295 295
  */
296 296
 function give_register_post_type_statuses() {
297 297
 	// Payment Statuses
298
-	register_post_status( 'refunded', array(
299
-		'label'                     => __( 'Refunded', 'give' ),
298
+	register_post_status('refunded', array(
299
+		'label'                     => __('Refunded', 'give'),
300 300
 		'public'                    => true,
301 301
 		'exclude_from_search'       => false,
302 302
 		'show_in_admin_all_list'    => true,
303 303
 		'show_in_admin_status_list' => true,
304
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ),
305
-	) );
306
-	register_post_status( 'failed', array(
307
-		'label'                     => __( 'Failed', 'give' ),
304
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give'),
305
+	));
306
+	register_post_status('failed', array(
307
+		'label'                     => __('Failed', 'give'),
308 308
 		'public'                    => true,
309 309
 		'exclude_from_search'       => false,
310 310
 		'show_in_admin_all_list'    => true,
311 311
 		'show_in_admin_status_list' => true,
312
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ),
313
-	) );
314
-	register_post_status( 'revoked', array(
315
-		'label'                     => __( 'Revoked', 'give' ),
312
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give'),
313
+	));
314
+	register_post_status('revoked', array(
315
+		'label'                     => __('Revoked', 'give'),
316 316
 		'public'                    => true,
317 317
 		'exclude_from_search'       => false,
318 318
 		'show_in_admin_all_list'    => true,
319 319
 		'show_in_admin_status_list' => true,
320
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ),
321
-	) );
322
-	register_post_status( 'cancelled', array(
323
-		'label'                     => __( 'Cancelled', 'give' ),
320
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give'),
321
+	));
322
+	register_post_status('cancelled', array(
323
+		'label'                     => __('Cancelled', 'give'),
324 324
 		'public'                    => true,
325 325
 		'exclude_from_search'       => false,
326 326
 		'show_in_admin_all_list'    => true,
327 327
 		'show_in_admin_status_list' => true,
328
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ),
329
-	) );
330
-	register_post_status( 'abandoned', array(
331
-		'label'                     => __( 'Abandoned', 'give' ),
328
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give'),
329
+	));
330
+	register_post_status('abandoned', array(
331
+		'label'                     => __('Abandoned', 'give'),
332 332
 		'public'                    => true,
333 333
 		'exclude_from_search'       => false,
334 334
 		'show_in_admin_all_list'    => true,
335 335
 		'show_in_admin_status_list' => true,
336
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ),
337
-	) );
338
-	register_post_status( 'processing', array(
339
-		'label'                     => _x( 'Processing', 'Processing payment status', 'give' ),
336
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give'),
337
+	));
338
+	register_post_status('processing', array(
339
+		'label'                     => _x('Processing', 'Processing payment status', 'give'),
340 340
 		'public'                    => true,
341 341
 		'exclude_from_search'       => false,
342 342
 		'show_in_admin_all_list'    => true,
343 343
 		'show_in_admin_status_list' => true,
344
-		'label_count'               => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give' )
345
-	)  );
344
+		'label_count'               => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give')
345
+	));
346 346
 
347
-	register_post_status( 'preapproval', array(
348
-		'label'                     => _x( 'Preapproval', 'Preapproval payment status', 'give' ),
347
+	register_post_status('preapproval', array(
348
+		'label'                     => _x('Preapproval', 'Preapproval payment status', 'give'),
349 349
 		'public'                    => true,
350 350
 		'exclude_from_search'       => false,
351 351
 		'show_in_admin_all_list'    => true,
352 352
 		'show_in_admin_status_list' => true,
353
-		'label_count'               => _n_noop( 'Preapproval <span class="count">(%s)</span>', 'Preapproval <span class="count">(%s)</span>', 'give' ),
354
-	) );
353
+		'label_count'               => _n_noop('Preapproval <span class="count">(%s)</span>', 'Preapproval <span class="count">(%s)</span>', 'give'),
354
+	));
355 355
 
356 356
 }
357 357
 
358
-add_action( 'init', 'give_register_post_type_statuses' );
358
+add_action('init', 'give_register_post_type_statuses');
359 359
 
360 360
 /**
361 361
  * Updated Messages
@@ -368,27 +368,27 @@  discard block
 block discarded – undo
368 368
  *
369 369
  * @return array $messages New post updated messages
370 370
  */
371
-function give_updated_messages( $messages ) {
371
+function give_updated_messages($messages) {
372 372
 	global $post, $post_ID;
373 373
 
374
-	if ( ! give_is_setting_enabled( give_get_option( 'forms_singular' ) ) ) {
374
+	if ( ! give_is_setting_enabled(give_get_option('forms_singular'))) {
375 375
 
376 376
 		$messages['give_forms'] = array(
377
-			1 => __( 'Form updated.', 'give' ),
378
-			4 => __( 'Form updated.', 'give' ),
379
-			6 => __( 'Form published.', 'give' ),
380
-			7 => __( 'Form saved.', 'give' ),
381
-			8 => __( 'Form submitted.', 'give' ),
377
+			1 => __('Form updated.', 'give'),
378
+			4 => __('Form updated.', 'give'),
379
+			6 => __('Form published.', 'give'),
380
+			7 => __('Form saved.', 'give'),
381
+			8 => __('Form submitted.', 'give'),
382 382
 		);
383 383
 
384 384
 	} else {
385 385
 
386 386
 		$messages['give_forms'] = array(
387
-			1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
388
-			4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
389
-			6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form published.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
390
-			7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form saved.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
391
-			8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form submitted.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ),
387
+			1 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
388
+			4 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
389
+			6 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form published.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
390
+			7 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form saved.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
391
+			8 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form submitted.', 'give'), get_permalink($post_ID), __('View Form', 'give')),
392 392
 		);
393 393
 
394 394
 	}
@@ -396,24 +396,24 @@  discard block
 block discarded – undo
396 396
 	return $messages;
397 397
 }
398 398
 
399
-add_filter( 'post_updated_messages', 'give_updated_messages' );
399
+add_filter('post_updated_messages', 'give_updated_messages');
400 400
 
401 401
 /**
402 402
  * Ensure post thumbnail support is turned on
403 403
  */
404 404
 function give_add_thumbnail_support() {
405
-	if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
405
+	if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) {
406 406
 		return;
407 407
 	}
408 408
 
409
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
410
-		add_theme_support( 'post-thumbnails' );
409
+	if ( ! current_theme_supports('post-thumbnails')) {
410
+		add_theme_support('post-thumbnails');
411 411
 	}
412 412
 
413
-	add_post_type_support( 'give_forms', 'thumbnail' );
413
+	add_post_type_support('give_forms', 'thumbnail');
414 414
 }
415 415
 
416
-add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
416
+add_action('after_setup_theme', 'give_add_thumbnail_support', 10);
417 417
 
418 418
 /**
419 419
  * Give Sidebars
@@ -424,21 +424,21 @@  discard block
 block discarded – undo
424 424
 
425 425
 	// Single Give Forms (disabled if single turned off in settings)
426 426
 	if (
427
-		give_is_setting_enabled( give_get_option( 'forms_singular' ) )
428
-		&& give_is_setting_enabled( give_get_option( 'form_sidebar' ) )
427
+		give_is_setting_enabled(give_get_option('forms_singular'))
428
+		&& give_is_setting_enabled(give_get_option('form_sidebar'))
429 429
 	) {
430 430
 
431
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
432
-			'name'          => __( 'Give Single Form Sidebar', 'give' ),
431
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
432
+			'name'          => __('Give Single Form Sidebar', 'give'),
433 433
 			'id'            => 'give-forms-sidebar',
434
-			'description'   => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
434
+			'description'   => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
435 435
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
436 436
 			'after_widget'  => '</div>',
437 437
 			'before_title'  => '<h3 class="widgettitle widget-title">',
438 438
 			'after_title'   => '</h3>',
439
-		) ) );
439
+		)));
440 440
 
441 441
 	}
442 442
 }
443 443
 
444
-add_action( 'widgets_init', 'give_widgets_init', 999 );
444
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -49,45 +49,45 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function admin_menus() {
52
-		list( $display_version ) = explode( '-', GIVE_VERSION );
52
+		list($display_version) = explode('-', GIVE_VERSION);
53 53
 
54 54
 		// About Page
55 55
 		add_dashboard_page(
56 56
 		/* translators: %s: Give version */
57
-			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
-			esc_html__( 'Welcome to Give', 'give' ),
57
+			sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version),
58
+			esc_html__('Welcome to Give', 'give'),
59 59
 			$this->minimum_capability,
60 60
 			'give-about',
61
-			array( $this, 'about_screen' )
61
+			array($this, 'about_screen')
62 62
 		);
63 63
 
64 64
 		// Changelog Page
65 65
 		add_dashboard_page(
66
-			esc_html__( 'Give Changelog', 'give' ),
67
-			esc_html__( 'Give Changelog', 'give' ),
66
+			esc_html__('Give Changelog', 'give'),
67
+			esc_html__('Give Changelog', 'give'),
68 68
 			$this->minimum_capability,
69 69
 			'give-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Getting Started Page
74 74
 		add_dashboard_page(
75 75
 		/* translators: %s: Give version */
76
-			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
-			esc_html__( 'Getting started with Give', 'give' ),
76
+			sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version),
77
+			esc_html__('Getting started with Give', 'give'),
78 78
 			$this->minimum_capability,
79 79
 			'give-getting-started',
80
-			array( $this, 'getting_started_screen' )
80
+			array($this, 'getting_started_screen')
81 81
 		);
82 82
 
83 83
 		// Credits Page
84 84
 		add_dashboard_page(
85 85
 		/* translators: %s: Give version */
86
-			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
-			esc_html__( 'The people that build Give', 'give' ),
86
+			sprintf(esc_html__('Give %s - Credits', 'give'), $display_version),
87
+			esc_html__('The people that build Give', 'give'),
88 88
 			$this->minimum_capability,
89 89
 			'give-credits',
90
-			array( $this, 'credits_screen' )
90
+			array($this, 'credits_screen')
91 91
 		);
92 92
 	}
93 93
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function admin_head() {
102 102
 
103
-		remove_submenu_page( 'index.php', 'give-about' );
104
-		remove_submenu_page( 'index.php', 'give-changelog' );
105
-		remove_submenu_page( 'index.php', 'give-getting-started' );
106
-		remove_submenu_page( 'index.php', 'give-credits' );
103
+		remove_submenu_page('index.php', 'give-about');
104
+		remove_submenu_page('index.php', 'give-changelog');
105
+		remove_submenu_page('index.php', 'give-getting-started');
106
+		remove_submenu_page('index.php', 'give-credits');
107 107
 
108 108
 	}
109 109
 
@@ -115,24 +115,24 @@  discard block
 block discarded – undo
115 115
 	 * @return void
116 116
 	 */
117 117
 	public function tabs() {
118
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
118
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
119 119
 		?>
120 120
         <h2 class="nav-tab-wrapper">
121 121
             <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>"
122
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
123
-				<?php esc_html_e( 'About Give', 'give' ); ?>
122
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
123
+				<?php esc_html_e('About Give', 'give'); ?>
124 124
             </a>
125 125
             <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>"
126
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
127
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
126
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
127
+				<?php esc_html_e('Getting Started', 'give'); ?>
128 128
             </a>
129 129
             <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>"
130
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
131
-				<?php esc_html_e( 'Credits', 'give' ); ?>
130
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
131
+				<?php esc_html_e('Credits', 'give'); ?>
132 132
             </a>
133 133
             <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>"
134
-               href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
135
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
134
+               href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>">
135
+				<?php esc_html_e('Add-ons', 'give'); ?>
136 136
             </a>
137 137
         </h2>
138 138
 		<?php
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return void
147 147
 	 */
148 148
 	public function about_screen() {
149
-		list( $display_version ) = explode( '-', GIVE_VERSION );
149
+		list($display_version) = explode('-', GIVE_VERSION);
150 150
 		?>
151 151
         <div class="wrap about-wrap">
152 152
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
             <p class="about-text"><?php
156 156
 				printf(
157 157
 				/* translators: %s: https://givewp.com/documenation/ */
158
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
159
-					esc_url( 'https://givewp.com/documenation/' )
158
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
159
+					esc_url('https://givewp.com/documenation/')
160 160
 				);
161 161
 				?></p>
162 162
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             <div class="give-badge"><?php
166 166
 				printf(
167 167
 				/* translators: %s: Give version */
168
-					esc_html__( 'Version %s', 'give' ),
168
+					esc_html__('Version %s', 'give'),
169 169
 					$display_version
170 170
 				);
171 171
 				?></div>
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
             <div class="feature-section clearfix introduction">
176 176
 
177 177
                 <div class="video feature-section-item">
178
-                    <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>"
179
-                         alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
178
+                    <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>"
179
+                         alt="<?php esc_attr_e('Give', 'give'); ?>">
180 180
                 </div>
181 181
 
182 182
                 <div class="content feature-section-item last-feature">
183 183
 
184
-                    <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
184
+                    <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
185 185
 
186
-                    <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
186
+                    <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
187 187
                     <a href="https://givewp.com" target="_blank" class="button-secondary">
188
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
188
+						<?php esc_html_e('Learn More', 'give'); ?>
189 189
                         <span class="dashicons dashicons-external"></span>
190 190
                     </a>
191 191
 
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 
199 199
                 <div class="content feature-section-item">
200 200
 
201
-                    <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
201
+                    <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
202 202
 
203
-                    <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
203
+                    <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
204 204
 
205 205
                     <h4>Find Out More:</h4>
206 206
                     <ul class="ul-disc">
207
-                        <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li>
208
-                        <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li>
209
-                        <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li>
207
+                        <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li>
208
+                        <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li>
209
+                        <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li>
210 210
                     </ul>
211 211
 
212 212
                 </div>
213 213
 
214 214
                 <div class="content  feature-section-item last-feature">
215
-                    <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/admin/give-form-mockup.png' ?>"
216
-                         alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
215
+                    <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/admin/give-form-mockup.png' ?>"
216
+                         alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
217 217
                 </div>
218 218
 
219 219
             </div>
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @return void
233 233
 	 */
234 234
 	public function changelog_screen() {
235
-		list( $display_version ) = explode( '-', GIVE_VERSION );
235
+		list($display_version) = explode('-', GIVE_VERSION);
236 236
 		?>
237 237
         <div class="wrap about-wrap">
238 238
             <h1><?php echo get_admin_page_title(); ?></h1>
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
             <p class="about-text"><?php
241 241
 				printf(
242 242
 				/* translators: %s: Give version */
243
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
243
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
244 244
 					$display_version
245 245
 				);
246 246
 				?></p>
247 247
             <div class="give-badge"><?php
248 248
 				printf(
249 249
 				/* translators: %s: Give version */
250
-					esc_html__( 'Version %s', 'give' ),
250
+					esc_html__('Version %s', 'give'),
251 251
 					$display_version
252 252
 				);
253 253
 				?></div>
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			<?php $this->tabs(); ?>
256 256
 
257 257
             <div class="changelog">
258
-                <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
258
+                <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
259 259
 
260 260
                 <div class="feature-section">
261 261
 					<?php echo $this->parse_readme(); ?>
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
             </div>
264 264
 
265 265
             <div class="return-to-dashboard">
266
-                <a href="<?php echo esc_url( admin_url( add_query_arg( array(
266
+                <a href="<?php echo esc_url(admin_url(add_query_arg(array(
267 267
 					'post_type' => 'give_forms',
268 268
 					'page'      => 'give-settings'
269
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
269
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
270 270
             </div>
271 271
         </div>
272 272
 		<?php
@@ -280,36 +280,36 @@  discard block
 block discarded – undo
280 280
 	 * @return void
281 281
 	 */
282 282
 	public function getting_started_screen() {
283
-		list( $display_version ) = explode( '-', GIVE_VERSION );
283
+		list($display_version) = explode('-', GIVE_VERSION);
284 284
 		?>
285 285
         <div class="wrap about-wrap get-started">
286 286
 
287 287
 			<?php $this->get_welcome_header() ?>
288 288
 
289
-            <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
289
+            <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
290 290
 
291 291
 			<?php give_get_newsletter(); ?>
292 292
 
293 293
             <div class="give-badge"><?php
294 294
 				printf(
295 295
 				/* translators: %s: Give version */
296
-					esc_html__( 'Version %s', 'give' ),
296
+					esc_html__('Version %s', 'give'),
297 297
 					$display_version
298 298
 				);
299 299
 				?></div>
300 300
 
301 301
 			<?php $this->tabs(); ?>
302 302
 
303
-            <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p>
303
+            <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p>
304 304
 
305 305
             <div class="feature-section clearfix">
306 306
 
307 307
                 <div class="content feature-section-item">
308
-                    <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
308
+                    <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
309 309
 
310
-                    <p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p>
310
+                    <p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p>
311 311
 
312
-                    <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p>
312
+                    <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p>
313 313
                 </div>
314 314
 
315 315
                 <div class="content feature-section-item last-feature">
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
                 </div>
327 327
 
328 328
                 <div class="content feature-section-item last-feature">
329
-                    <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3>
329
+                    <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3>
330 330
 
331
-                    <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p>
331
+                    <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p>
332 332
                 </div>
333 333
 
334 334
             </div>
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
             <div class="feature-section clearfix">
338 338
 
339 339
                 <div class="content feature-section-item add-content">
340
-                    <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3>
340
+                    <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3>
341 341
 
342
-                    <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p>
342
+                    <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p>
343 343
 
344
-                    <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
344
+                    <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
345 345
                 </div>
346 346
 
347 347
                 <div class="content feature-section-item last-feature">
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
                 </div>
359 359
 
360 360
                 <div class="content feature-section-item last-feature">
361
-                    <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
361
+                    <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
362 362
 
363
-                    <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p>
363
+                    <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p>
364 364
                 </div>
365 365
 
366 366
 
@@ -380,20 +380,20 @@  discard block
 block discarded – undo
380 380
 	 * @return void
381 381
 	 */
382 382
 	public function credits_screen() {
383
-		list( $display_version ) = explode( '-', GIVE_VERSION );
383
+		list($display_version) = explode('-', GIVE_VERSION);
384 384
 		?>
385 385
         <div class="wrap about-wrap">
386 386
 
387 387
 			<?php $this->get_welcome_header() ?>
388 388
 
389
-            <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
389
+            <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
390 390
 
391 391
 			<?php give_get_newsletter(); ?>
392 392
 
393 393
             <div class="give-badge"><?php
394 394
 				printf(
395 395
 				/* translators: %s: Give version */
396
-					esc_html__( 'Version %s', 'give' ),
396
+					esc_html__('Version %s', 'give'),
397 397
 					$display_version
398 398
 				);
399 399
 				?></div>
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
             <p class="about-description"><?php
404 404
 				printf(
405 405
 				/* translators: %s: https://github.com/WordImpress/give */
406
-					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
407
-					esc_url( 'https://github.com/WordImpress/give' )
406
+					__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'),
407
+					esc_url('https://github.com/WordImpress/give')
408 408
 				);
409 409
 				?></p>
410 410
 
@@ -421,21 +421,21 @@  discard block
 block discarded – undo
421 421
 	 * @return string $readme HTML formatted readme file
422 422
 	 */
423 423
 	public function parse_readme() {
424
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
424
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
425 425
 
426
-		if ( ! $file ) {
427
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
426
+		if ( ! $file) {
427
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
428 428
 		} else {
429
-			$readme = file_get_contents( $file );
430
-			$readme = nl2br( esc_html( $readme ) );
431
-			$readme = explode( '== Changelog ==', $readme );
432
-			$readme = end( $readme );
433
-
434
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
435
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
436
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
437
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
438
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
429
+			$readme = file_get_contents($file);
430
+			$readme = nl2br(esc_html($readme));
431
+			$readme = explode('== Changelog ==', $readme);
432
+			$readme = end($readme);
433
+
434
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
435
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
436
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
437
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
438
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
439 439
 		}
440 440
 
441 441
 		return $readme;
@@ -452,24 +452,24 @@  discard block
 block discarded – undo
452 452
 	public function contributors() {
453 453
 		$contributors = $this->get_contributors();
454 454
 
455
-		if ( empty( $contributors ) ) {
455
+		if (empty($contributors)) {
456 456
 			return '';
457 457
 		}
458 458
 
459 459
 		$contributor_list = '<ul class="wp-people-group">';
460 460
 
461
-		foreach ( $contributors as $contributor ) {
461
+		foreach ($contributors as $contributor) {
462 462
 			$contributor_list .= '<li class="wp-person">';
463 463
 			$contributor_list .= sprintf(
464 464
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
465
-				esc_url( 'https://github.com/' . $contributor->login ),
466
-				esc_url( $contributor->avatar_url ),
467
-				esc_attr( $contributor->login )
465
+				esc_url('https://github.com/'.$contributor->login),
466
+				esc_url($contributor->avatar_url),
467
+				esc_attr($contributor->login)
468 468
 			);
469 469
 			$contributor_list .= sprintf(
470 470
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
471
-				esc_url( 'https://github.com/' . $contributor->login ),
472
-				esc_html( $contributor->login )
471
+				esc_url('https://github.com/'.$contributor->login),
472
+				esc_html($contributor->login)
473 473
 			);
474 474
 			$contributor_list .= '</li>';
475 475
 		}
@@ -487,25 +487,25 @@  discard block
 block discarded – undo
487 487
 	 * @return array $contributors List of contributors
488 488
 	 */
489 489
 	public function get_contributors() {
490
-		$contributors = Give_Cache::get( 'give_contributors', true );
490
+		$contributors = Give_Cache::get('give_contributors', true);
491 491
 
492
-		if ( false !== $contributors ) {
492
+		if (false !== $contributors) {
493 493
 			return $contributors;
494 494
 		}
495 495
 
496
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
496
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
497 497
 
498
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
498
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
499 499
 			return array();
500 500
 		}
501 501
 
502
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
502
+		$contributors = json_decode(wp_remote_retrieve_body($response));
503 503
 
504
-		if ( ! is_array( $contributors ) ) {
504
+		if ( ! is_array($contributors)) {
505 505
 			return array();
506 506
 		}
507 507
 
508
-		Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
508
+		Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true);
509 509
 
510 510
 		return $contributors;
511 511
 	}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	public function get_welcome_header() {
519 519
 		// Badge for welcome page
520
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
520
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
521 521
 		?>
522 522
         <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
523 523
 		<?php $this->social_media_elements(); ?>
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
             <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php
611 611
 				printf(
612 612
 				/* translators: %s: Give twitter user @givewp */
613
-					esc_html_e( 'Follow %s', 'give' ),
613
+					esc_html_e('Follow %s', 'give'),
614 614
 					'@givewp'
615 615
 				);
616 616
 				?></a>
@@ -644,27 +644,27 @@  discard block
 block discarded – undo
644 644
 	public function welcome() {
645 645
 
646 646
 		// Bail if no activation redirect
647
-		if ( ! Give_Cache::get( '_give_activation_redirect', true ) ) {
647
+		if ( ! Give_Cache::get('_give_activation_redirect', true)) {
648 648
 			return;
649 649
 		}
650 650
 
651 651
 		// Delete the redirect transient
652
-		Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) );
652
+		Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect'));
653 653
 
654 654
 		// Bail if activating from network, or bulk
655
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
655
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
656 656
 			return;
657 657
 		}
658 658
 
659
-		$upgrade = get_option( 'give_version_upgraded_from' );
659
+		$upgrade = get_option('give_version_upgraded_from');
660 660
 
661
-		if ( ! $upgrade ) { // First time install
662
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
661
+		if ( ! $upgrade) { // First time install
662
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
663 663
 			exit;
664
-		} elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings
664
+		} elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings
665 665
 
666 666
 		} else { // Welcome is NOT disabled in settings
667
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
667
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
668 668
 			exit;
669 669
 		}
670 670
 	}
Please login to merge, or discard this patch.
includes/class-give-stats.php 1 patch
Spacing   +106 added lines, -106 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
 
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function get_predefined_dates() {
95 95
 		$predefined = array(
96
-			'today'        => esc_html__( 'Today', 'give' ),
97
-			'yesterday'    => esc_html__( 'Yesterday', 'give' ),
98
-			'this_week'    => esc_html__( 'This Week', 'give' ),
99
-			'last_week'    => esc_html__( 'Last Week', 'give' ),
100
-			'this_month'   => esc_html__( 'This Month', 'give' ),
101
-			'last_month'   => esc_html__( 'Last Month', 'give' ),
102
-			'this_quarter' => esc_html__( 'This Quarter', 'give' ),
103
-			'last_quarter' => esc_html__( 'Last Quarter', 'give' ),
104
-			'this_year'    => esc_html__( 'This Year', 'give' ),
105
-			'last_year'    => esc_html__( 'Last Year', 'give' ),
96
+			'today'        => esc_html__('Today', 'give'),
97
+			'yesterday'    => esc_html__('Yesterday', 'give'),
98
+			'this_week'    => esc_html__('This Week', 'give'),
99
+			'last_week'    => esc_html__('Last Week', 'give'),
100
+			'this_month'   => esc_html__('This Month', 'give'),
101
+			'last_month'   => esc_html__('Last Month', 'give'),
102
+			'this_quarter' => esc_html__('This Quarter', 'give'),
103
+			'last_quarter' => esc_html__('Last Quarter', 'give'),
104
+			'this_year'    => esc_html__('This Year', 'give'),
105
+			'last_year'    => esc_html__('Last Year', 'give'),
106 106
 		);
107 107
 
108
-		return apply_filters( 'give_stats_predefined_dates', $predefined );
108
+		return apply_filters('give_stats_predefined_dates', $predefined);
109 109
 	}
110 110
 
111 111
 	/**
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @return void
123 123
 	 */
124
-	public function setup_dates( $_start_date = 'this_month', $_end_date = false ) {
124
+	public function setup_dates($_start_date = 'this_month', $_end_date = false) {
125 125
 
126
-		if ( empty( $_start_date ) ) {
126
+		if (empty($_start_date)) {
127 127
 			$_start_date = 'this_month';
128 128
 		}
129 129
 
130
-		if ( empty( $_end_date ) ) {
130
+		if (empty($_end_date)) {
131 131
 			$_end_date = $_start_date;
132 132
 		}
133 133
 
134
-		$this->start_date = $this->convert_date( $_start_date );
135
-		$this->end_date   = $this->convert_date( $_end_date, true );
134
+		$this->start_date = $this->convert_date($_start_date);
135
+		$this->end_date   = $this->convert_date($_end_date, true);
136 136
 	}
137 137
 
138 138
 	/**
@@ -148,26 +148,26 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @return array|WP_Error   If the date is invalid, a WP_Error object will be returned.
150 150
 	 */
151
-	public function convert_date( $date, $end_date = false ) {
151
+	public function convert_date($date, $end_date = false) {
152 152
 
153 153
 		$this->timestamp = false;
154 154
 		$second          = $end_date ? 59 : 0;
155 155
 		$minute          = $end_date ? 59 : 0;
156 156
 		$hour            = $end_date ? 23 : 0;
157 157
 		$day             = 1;
158
-		$month           = date( 'n', current_time( 'timestamp' ) );
159
-		$year            = date( 'Y', current_time( 'timestamp' ) );
158
+		$month           = date('n', current_time('timestamp'));
159
+		$year            = date('Y', current_time('timestamp'));
160 160
 
161
-		if ( array_key_exists( (string) $date, $this->get_predefined_dates() ) ) {
161
+		if (array_key_exists((string) $date, $this->get_predefined_dates())) {
162 162
 
163 163
 			// This is a predefined date rate, such as last_week
164
-			switch ( $date ) {
164
+			switch ($date) {
165 165
 
166 166
 				case 'this_month' :
167 167
 
168
-					if ( $end_date ) {
168
+					if ($end_date) {
169 169
 
170
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
170
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
171 171
 						$hour   = 23;
172 172
 						$minute = 59;
173 173
 						$second = 59;
@@ -177,28 +177,28 @@  discard block
 block discarded – undo
177 177
 
178 178
 				case 'last_month' :
179 179
 
180
-					if ( $month == 1 ) {
180
+					if ($month == 1) {
181 181
 
182 182
 						$month = 12;
183
-						$year --;
183
+						$year--;
184 184
 
185 185
 					} else {
186 186
 
187
-						$month --;
187
+						$month--;
188 188
 
189 189
 					}
190 190
 
191
-					if ( $end_date ) {
192
-						$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
191
+					if ($end_date) {
192
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
193 193
 					}
194 194
 
195 195
 					break;
196 196
 
197 197
 				case 'today' :
198 198
 
199
-					$day = date( 'd', current_time( 'timestamp' ) );
199
+					$day = date('d', current_time('timestamp'));
200 200
 
201
-					if ( $end_date ) {
201
+					if ($end_date) {
202 202
 						$hour   = 23;
203 203
 						$minute = 59;
204 204
 						$second = 59;
@@ -208,23 +208,23 @@  discard block
 block discarded – undo
208 208
 
209 209
 				case 'yesterday' :
210 210
 
211
-					$day = date( 'd', current_time( 'timestamp' ) ) - 1;
211
+					$day = date('d', current_time('timestamp')) - 1;
212 212
 
213 213
 					// Check if Today is the first day of the month (meaning subtracting one will get us 0)
214
-					if ( $day < 1 ) {
214
+					if ($day < 1) {
215 215
 
216 216
 						// If current month is 1
217
-						if ( 1 == $month ) {
217
+						if (1 == $month) {
218 218
 
219 219
 							$year -= 1; // Today is January 1, so skip back to last day of December
220 220
 							$month = 12;
221
-							$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
221
+							$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
222 222
 
223 223
 						} else {
224 224
 
225 225
 							// Go back one month and get the last day of the month
226 226
 							$month -= 1;
227
-							$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
227
+							$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
228 228
 
229 229
 						}
230 230
 					}
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 
234 234
 				case 'this_week' :
235 235
 
236
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
237
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
236
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
237
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
238 238
 
239
-					if ( $today < $days_to_week_start ) {
239
+					if ($today < $days_to_week_start) {
240 240
 
241
-						if ( $month > 1 ) {
241
+						if ($month > 1) {
242 242
 							$month -= 1;
243 243
 						} else {
244 244
 							$month = 12;
@@ -246,19 +246,19 @@  discard block
 block discarded – undo
246 246
 
247 247
 					}
248 248
 
249
-					if ( ! $end_date ) {
249
+					if ( ! $end_date) {
250 250
 
251 251
 						// Getting the start day
252 252
 
253
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
254
-						$day += get_option( 'start_of_week' );
253
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
254
+						$day += get_option('start_of_week');
255 255
 
256 256
 					} else {
257 257
 
258 258
 						// Getting the end day
259 259
 
260
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
261
-						$day += get_option( 'start_of_week' ) + 6;
260
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
261
+						$day += get_option('start_of_week') + 6;
262 262
 
263 263
 					}
264 264
 
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
 
267 267
 				case 'last_week' :
268 268
 
269
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
270
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
269
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
270
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
271 271
 
272
-					if ( $today < $days_to_week_start ) {
272
+					if ($today < $days_to_week_start) {
273 273
 
274
-						if ( $month > 1 ) {
274
+						if ($month > 1) {
275 275
 							$month -= 1;
276 276
 						} else {
277 277
 							$month = 12;
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
 
280 280
 					}
281 281
 
282
-					if ( ! $end_date ) {
282
+					if ( ! $end_date) {
283 283
 
284 284
 						// Getting the start day
285 285
 
286
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
287
-						$day += get_option( 'start_of_week' );
286
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
287
+						$day += get_option('start_of_week');
288 288
 
289 289
 					} else {
290 290
 
291 291
 						// Getting the end day
292 292
 
293
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
294
-						$day += get_option( 'start_of_week' ) + 6;
293
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
294
+						$day += get_option('start_of_week') + 6;
295 295
 
296 296
 					}
297 297
 
@@ -299,39 +299,39 @@  discard block
 block discarded – undo
299 299
 
300 300
 				case 'this_quarter' :
301 301
 
302
-					$month_now = date( 'n', current_time( 'timestamp' ) );
302
+					$month_now = date('n', current_time('timestamp'));
303 303
 
304
-					if ( $month_now <= 3 ) {
304
+					if ($month_now <= 3) {
305 305
 
306
-						if ( ! $end_date ) {
306
+						if ( ! $end_date) {
307 307
 							$month = 1;
308 308
 						} else {
309 309
 							$month  = 3;
310
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
310
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
311 311
 							$hour   = 23;
312 312
 							$minute = 59;
313 313
 							$second = 59;
314 314
 						}
315 315
 
316
-					} else if ( $month_now <= 6 ) {
316
+					} else if ($month_now <= 6) {
317 317
 
318
-						if ( ! $end_date ) {
318
+						if ( ! $end_date) {
319 319
 							$month = 4;
320 320
 						} else {
321 321
 							$month  = 6;
322
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
322
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
323 323
 							$hour   = 23;
324 324
 							$minute = 59;
325 325
 							$second = 59;
326 326
 						}
327 327
 
328
-					} else if ( $month_now <= 9 ) {
328
+					} else if ($month_now <= 9) {
329 329
 
330
-						if ( ! $end_date ) {
330
+						if ( ! $end_date) {
331 331
 							$month = 7;
332 332
 						} else {
333 333
 							$month  = 9;
334
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
334
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
335 335
 							$hour   = 23;
336 336
 							$minute = 59;
337 337
 							$second = 59;
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 
340 340
 					} else {
341 341
 
342
-						if ( ! $end_date ) {
342
+						if ( ! $end_date) {
343 343
 							$month = 10;
344 344
 						} else {
345 345
 							$month  = 12;
346
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
346
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
347 347
 							$hour   = 23;
348 348
 							$minute = 59;
349 349
 							$second = 59;
@@ -355,40 +355,40 @@  discard block
 block discarded – undo
355 355
 
356 356
 				case 'last_quarter' :
357 357
 
358
-					$month_now = date( 'n', current_time( 'timestamp' ) );
358
+					$month_now = date('n', current_time('timestamp'));
359 359
 
360
-					if ( $month_now <= 3 ) {
360
+					if ($month_now <= 3) {
361 361
 
362
-						if ( ! $end_date ) {
362
+						if ( ! $end_date) {
363 363
 							$month = 10;
364 364
 						} else {
365 365
 							$year -= 1;
366 366
 							$month  = 12;
367
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
367
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
368 368
 							$hour   = 23;
369 369
 							$minute = 59;
370 370
 							$second = 59;
371 371
 						}
372 372
 
373
-					} else if ( $month_now <= 6 ) {
373
+					} else if ($month_now <= 6) {
374 374
 
375
-						if ( ! $end_date ) {
375
+						if ( ! $end_date) {
376 376
 							$month = 1;
377 377
 						} else {
378 378
 							$month  = 3;
379
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
379
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
380 380
 							$hour   = 23;
381 381
 							$minute = 59;
382 382
 							$second = 59;
383 383
 						}
384 384
 
385
-					} else if ( $month_now <= 9 ) {
385
+					} else if ($month_now <= 9) {
386 386
 
387
-						if ( ! $end_date ) {
387
+						if ( ! $end_date) {
388 388
 							$month = 4;
389 389
 						} else {
390 390
 							$month  = 6;
391
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
391
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
392 392
 							$hour   = 23;
393 393
 							$minute = 59;
394 394
 							$second = 59;
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
 
397 397
 					} else {
398 398
 
399
-						if ( ! $end_date ) {
399
+						if ( ! $end_date) {
400 400
 							$month = 7;
401 401
 						} else {
402 402
 							$month  = 9;
403
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
403
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
404 404
 							$hour   = 23;
405 405
 							$minute = 59;
406 406
 							$second = 59;
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 
413 413
 				case 'this_year' :
414 414
 
415
-					if ( ! $end_date ) {
415
+					if ( ! $end_date) {
416 416
 						$month = 1;
417 417
 					} else {
418 418
 						$month  = 12;
419
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
419
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
420 420
 						$hour   = 23;
421 421
 						$minute = 59;
422 422
 						$second = 59;
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
 				case 'last_year' :
428 428
 
429 429
 					$year -= 1;
430
-					if ( ! $end_date ) {
430
+					if ( ! $end_date) {
431 431
 						$month = 1;
432 432
 					} else {
433 433
 						$month  = 12;
434
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
434
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
435 435
 						$hour   = 23;
436 436
 						$minute = 59;
437 437
 						$second = 59;
@@ -442,30 +442,30 @@  discard block
 block discarded – undo
442 442
 			}
443 443
 
444 444
 
445
-		} else if ( is_numeric( $date ) ) {
445
+		} else if (is_numeric($date)) {
446 446
 
447 447
 			// return $date unchanged since it is a timestamp
448 448
 			$this->timestamp = true;
449 449
 
450
-		} else if ( false !== strtotime( $date ) ) {
450
+		} else if (false !== strtotime($date)) {
451 451
 
452
-			$date  = strtotime( $date, current_time( 'timestamp' ) );
453
-			$year  = date( 'Y', $date );
454
-			$month = date( 'm', $date );
455
-			$day   = date( 'd', $date );
452
+			$date  = strtotime($date, current_time('timestamp'));
453
+			$year  = date('Y', $date);
454
+			$month = date('m', $date);
455
+			$day   = date('d', $date);
456 456
 
457 457
 		} else {
458 458
 
459
-			return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) );
459
+			return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give'));
460 460
 
461 461
 		}
462 462
 
463
-		if ( false === $this->timestamp ) {
463
+		if (false === $this->timestamp) {
464 464
 			// Create an exact timestamp
465
-			$date = mktime( $hour, $minute, $second, $month, $day, $year );
465
+			$date = mktime($hour, $minute, $second, $month, $day, $year);
466 466
 		}
467 467
 
468
-		return apply_filters( 'give_stats_date', $date, $end_date, $this );
468
+		return apply_filters('give_stats_date', $date, $end_date, $this);
469 469
 
470 470
 	}
471 471
 
@@ -481,33 +481,33 @@  discard block
 block discarded – undo
481 481
 	 * 
482 482
 	 * @return string
483 483
 	 */
484
-	public function count_where( $where = '' ) {
484
+	public function count_where($where = '') {
485 485
 		// Only get payments in our date range
486 486
 
487 487
 		$start_where = '';
488 488
 		$end_where   = '';
489 489
 
490
-		if ( $this->start_date ) {
490
+		if ($this->start_date) {
491 491
 
492
-			if ( $this->timestamp ) {
492
+			if ($this->timestamp) {
493 493
 				$format = 'Y-m-d H:i:s';
494 494
 			} else {
495 495
 				$format = 'Y-m-d 00:00:00';
496 496
 			}
497 497
 
498
-			$start_date  = date( $format, $this->start_date );
498
+			$start_date  = date($format, $this->start_date);
499 499
 			$start_where = " AND p.post_date >= '{$start_date}'";
500 500
 		}
501 501
 
502
-		if ( $this->end_date ) {
502
+		if ($this->end_date) {
503 503
 
504
-			if ( $this->timestamp ) {
504
+			if ($this->timestamp) {
505 505
 				$format = 'Y-m-d H:i:s';
506 506
 			} else {
507 507
 				$format = 'Y-m-d 23:59:59';
508 508
 			}
509 509
 
510
-			$end_date = date( $format, $this->end_date );
510
+			$end_date = date($format, $this->end_date);
511 511
 
512 512
 			$end_where = " AND p.post_date <= '{$end_date}'";
513 513
 		}
@@ -529,34 +529,34 @@  discard block
 block discarded – undo
529 529
 	 *
530 530
 	 * @return string
531 531
 	 */
532
-	public function payments_where( $where = '' ) {
532
+	public function payments_where($where = '') {
533 533
 
534 534
 		global $wpdb;
535 535
 
536 536
 		$start_where = '';
537 537
 		$end_where   = '';
538 538
 
539
-		if ( ! is_wp_error( $this->start_date ) ) {
539
+		if ( ! is_wp_error($this->start_date)) {
540 540
 
541
-			if ( $this->timestamp ) {
541
+			if ($this->timestamp) {
542 542
 				$format = 'Y-m-d H:i:s';
543 543
 			} else {
544 544
 				$format = 'Y-m-d 00:00:00';
545 545
 			}
546 546
 
547
-			$start_date  = date( $format, $this->start_date );
547
+			$start_date  = date($format, $this->start_date);
548 548
 			$start_where = " AND $wpdb->posts.post_date >= '{$start_date}'";
549 549
 		}
550 550
 
551
-		if ( ! is_wp_error( $this->end_date ) ) {
551
+		if ( ! is_wp_error($this->end_date)) {
552 552
 
553
-			if ( $this->timestamp ) {
553
+			if ($this->timestamp) {
554 554
 				$format = 'Y-m-d H:i:s';
555 555
 			} else {
556 556
 				$format = 'Y-m-d 23:59:59';
557 557
 			}
558 558
 
559
-			$end_date = date( $format, $this->end_date );
559
+			$end_date = date($format, $this->end_date);
560 560
 
561 561
 			$end_where = " AND $wpdb->posts.post_date <= '{$end_date}'";
562 562
 		}
Please login to merge, or discard this patch.
includes/payments/class-give-payment.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 	 *
370 370
 	 * @param  int|bool $payment_id A given payment
371 371
 	 *
372
-	 * @return mixed void|false
372
+	 * @return false|null void|false
373 373
 	 */
374 374
 	public function __construct( $payment_id = false ) {
375 375
 
@@ -1088,7 +1088,7 @@  discard block
 block discarded – undo
1088 1088
 	 *
1089 1089
 	 * @param  string $note The note to add
1090 1090
 	 *
1091
-	 * @return bool           If the note was specified or not
1091
+	 * @return false|null           If the note was specified or not
1092 1092
 	 */
1093 1093
 	public function add_note( $note = false ) {
1094 1094
 		// Bail if no note specified.
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1012,7 +1012,7 @@
 block discarded – undo
1012 1012
 					// Find a match between price_id and level_id.
1013 1013
 					// First verify array keys exists THEN make the match.
1014 1014
 					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1015
-					     && $args['price_id'] == $price['_give_id']['level_id']
1015
+						 && $args['price_id'] == $price['_give_id']['level_id']
1016 1016
 					) {
1017 1017
 						$donation_amount = $price['_give_amount'];
1018 1018
 					}
Please login to merge, or discard this patch.
Spacing   +287 added lines, -287 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
 
@@ -392,13 +392,13 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @return mixed void|false
394 394
 	 */
395
-	public function __construct( $payment_id = false ) {
395
+	public function __construct($payment_id = false) {
396 396
 
397
-		if ( empty( $payment_id ) ) {
397
+		if (empty($payment_id)) {
398 398
 			return false;
399 399
 		}
400 400
 
401
-		$this->setup_payment( $payment_id );
401
+		$this->setup_payment($payment_id);
402 402
 	}
403 403
 
404 404
 	/**
@@ -411,11 +411,11 @@  discard block
 block discarded – undo
411 411
 	 *
412 412
 	 * @return mixed        The value.
413 413
 	 */
414
-	public function __get( $key ) {
414
+	public function __get($key) {
415 415
 
416
-		if ( method_exists( $this, 'get_' . $key ) ) {
416
+		if (method_exists($this, 'get_'.$key)) {
417 417
 
418
-			$value = call_user_func( array( $this, 'get_' . $key ) );
418
+			$value = call_user_func(array($this, 'get_'.$key));
419 419
 
420 420
 		} else {
421 421
 
@@ -437,18 +437,18 @@  discard block
 block discarded – undo
437 437
 	 * @param  string $key   The property name
438 438
 	 * @param  mixed  $value The value of the property
439 439
 	 */
440
-	public function __set( $key, $value ) {
441
-		$ignore = array( '_ID' );
440
+	public function __set($key, $value) {
441
+		$ignore = array('_ID');
442 442
 
443
-		if ( 'status' === $key ) {
443
+		if ('status' === $key) {
444 444
 			$this->old_status = $this->status;
445 445
 		}
446 446
 
447
-		if ( ! in_array( $key, $ignore ) ) {
448
-			$this->pending[ $key ] = $value;
447
+		if ( ! in_array($key, $ignore)) {
448
+			$this->pending[$key] = $value;
449 449
 		}
450 450
 
451
-		if ( '_ID' !== $key ) {
451
+		if ('_ID' !== $key) {
452 452
 			$this->$key = $value;
453 453
 		}
454 454
 	}
@@ -463,9 +463,9 @@  discard block
 block discarded – undo
463 463
 	 *
464 464
 	 * @return boolean|null       If the item is set or not
465 465
 	 */
466
-	public function __isset( $name ) {
467
-		if ( property_exists( $this, $name ) ) {
468
-			return false === empty( $this->$name );
466
+	public function __isset($name) {
467
+		if (property_exists($this, $name)) {
468
+			return false === empty($this->$name);
469 469
 		} else {
470 470
 			return null;
471 471
 		}
@@ -481,20 +481,20 @@  discard block
 block discarded – undo
481 481
 	 *
482 482
 	 * @return bool            If the setup was successful or not
483 483
 	 */
484
-	private function setup_payment( $payment_id ) {
484
+	private function setup_payment($payment_id) {
485 485
 		$this->pending = array();
486 486
 
487
-		if ( empty( $payment_id ) ) {
487
+		if (empty($payment_id)) {
488 488
 			return false;
489 489
 		}
490 490
 
491
-		$payment = get_post( $payment_id );
491
+		$payment = get_post($payment_id);
492 492
 
493
-		if ( ! $payment || is_wp_error( $payment ) ) {
493
+		if ( ! $payment || is_wp_error($payment)) {
494 494
 			return false;
495 495
 		}
496 496
 
497
-		if ( 'give_payment' !== $payment->post_type ) {
497
+		if ('give_payment' !== $payment->post_type) {
498 498
 			return false;
499 499
 		}
500 500
 
@@ -508,13 +508,13 @@  discard block
 block discarded – undo
508 508
 		 * @param Give_Payment $this       Payment object.
509 509
 		 * @param int          $payment_id The ID of the payment.
510 510
 		 */
511
-		do_action( 'give_pre_setup_payment', $this, $payment_id );
511
+		do_action('give_pre_setup_payment', $this, $payment_id);
512 512
 
513 513
 		// Primary Identifier.
514
-		$this->ID = absint( $payment_id );
514
+		$this->ID = absint($payment_id);
515 515
 
516 516
 		// Protected ID that can never be changed.
517
-		$this->_ID = absint( $payment_id );
517
+		$this->_ID = absint($payment_id);
518 518
 
519 519
 		// We have a payment, get the generic payment_meta item to reduce calls to it.
520 520
 		$this->payment_meta = $this->get_meta();
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 		$this->parent_payment = $payment->post_parent;
531 531
 
532 532
 		$all_payment_statuses  = give_get_payment_statuses();
533
-		$this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status );
533
+		$this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status);
534 534
 
535 535
 		// Currency Based.
536 536
 		$this->total    = $this->setup_total();
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 		 * @param Give_Payment $this       Payment object.
569 569
 		 * @param int          $payment_id The ID of the payment.
570 570
 		 */
571
-		do_action( 'give_setup_payment', $this, $payment_id );
571
+		do_action('give_setup_payment', $this, $payment_id);
572 572
 
573 573
 		return true;
574 574
 	}
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
 	 *
587 587
 	 * @return void
588 588
 	 */
589
-	public function update_payment_setup( $payment_id ) {
590
-		$this->setup_payment( $payment_id );
589
+	public function update_payment_setup($payment_id) {
590
+		$this->setup_payment($payment_id);
591 591
 	}
592 592
 
593 593
 	/**
@@ -602,24 +602,24 @@  discard block
 block discarded – undo
602 602
 
603 603
 		// Construct the payment title.
604 604
 		$payment_title = '';
605
-		if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) {
606
-			$payment_title = $this->first_name . ' ' . $this->last_name;
607
-		} elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) {
605
+		if ( ! empty($this->first_name) && ! empty($this->last_name)) {
606
+			$payment_title = $this->first_name.' '.$this->last_name;
607
+		} elseif ( ! empty($this->first_name) && empty($this->last_name)) {
608 608
 			$payment_title = $this->first_name;
609
-		} elseif ( ! empty( $this->email ) && is_email( $this->email ) ) {
609
+		} elseif ( ! empty($this->email) && is_email($this->email)) {
610 610
 			$payment_title = $this->email;
611 611
 		}
612 612
 
613 613
 		// Set Key.
614
-		if ( empty( $this->key ) ) {
614
+		if (empty($this->key)) {
615 615
 
616
-			$auth_key             = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
617
-			$this->key            = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );  // Unique key
616
+			$auth_key             = defined('AUTH_KEY') ? AUTH_KEY : '';
617
+			$this->key            = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key
618 618
 			$this->pending['key'] = $this->key;
619 619
 		}
620 620
 
621 621
 		// Set IP.
622
-		if ( empty( $this->ip ) ) {
622
+		if (empty($this->ip)) {
623 623
 
624 624
 			$this->ip            = give_get_ip();
625 625
 			$this->pending['ip'] = $this->ip;
@@ -646,19 +646,19 @@  discard block
 block discarded – undo
646 646
 			'status'       => $this->status,
647 647
 		);
648 648
 
649
-		$args = apply_filters( 'give_insert_payment_args', array(
649
+		$args = apply_filters('give_insert_payment_args', array(
650 650
 			'post_title'    => $payment_title,
651 651
 			'post_status'   => $this->status,
652 652
 			'post_type'     => 'give_payment',
653
-			'post_date'     => ! empty( $this->date ) ? $this->date : null,
654
-			'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null,
653
+			'post_date'     => ! empty($this->date) ? $this->date : null,
654
+			'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null,
655 655
 			'post_parent'   => $this->parent_payment,
656
-		), $payment_data );
656
+		), $payment_data);
657 657
 
658 658
 		// Create a blank payment
659
-		$payment_id = wp_insert_post( $args );
659
+		$payment_id = wp_insert_post($args);
660 660
 
661
-		if ( ! empty( $payment_id ) ) {
661
+		if ( ! empty($payment_id)) {
662 662
 
663 663
 			$this->ID  = $payment_id;
664 664
 			$this->_ID = $payment_id;
@@ -670,40 +670,40 @@  discard block
 block discarded – undo
670 670
 			 *
671 671
 			 * @since 1.8.13
672 672
 			 */
673
-			$donor = apply_filters( 'give_update_donor_information', $donor, $payment_id, $payment_data, $args );
673
+			$donor = apply_filters('give_update_donor_information', $donor, $payment_id, $payment_data, $args);
674 674
 
675
-			if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) {
676
-				$donor = new Give_Donor( get_current_user_id(), true );
675
+			if (did_action('give_pre_process_donation') && is_user_logged_in()) {
676
+				$donor = new Give_Donor(get_current_user_id(), true);
677 677
 
678 678
 				// Donor is logged in but used a different email to purchase with so assign to their donor record.
679
-				if ( ! empty( $donor->id ) && $this->email !== $donor->email ) {
680
-					$donor->add_email( $this->email );
679
+				if ( ! empty($donor->id) && $this->email !== $donor->email) {
680
+					$donor->add_email($this->email);
681 681
 				}
682 682
 			}
683 683
 
684
-			if ( empty( $donor->id ) ) {
685
-				$donor = new Give_Donor( $this->email );
684
+			if (empty($donor->id)) {
685
+				$donor = new Give_Donor($this->email);
686 686
 			}
687 687
 
688
-			if ( empty( $donor->id ) ) {
688
+			if (empty($donor->id)) {
689 689
 
690 690
 				$donor_data = array(
691
-					'name'    => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '',
691
+					'name'    => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '',
692 692
 					'email'   => $this->email,
693 693
 					'user_id' => $this->user_id,
694 694
 				);
695 695
 
696
-				$donor->create( $donor_data );
696
+				$donor->create($donor_data);
697 697
 
698 698
 			}
699 699
 
700 700
 			$this->customer_id            = $donor->id;
701 701
 			$this->pending['customer_id'] = $this->customer_id;
702
-			$donor->attach_payment( $this->ID, false );
702
+			$donor->attach_payment($this->ID, false);
703 703
 
704
-			$this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data );
704
+			$this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data);
705 705
 
706
-			$this->update_meta( '_give_payment_meta', $this->payment_meta );
706
+			$this->update_meta('_give_payment_meta', $this->payment_meta);
707 707
 			$this->new = true;
708 708
 		}// End if().
709 709
 
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 		$saved = false;
726 726
 
727 727
 		// Must have an ID.
728
-		if ( empty( $this->ID ) ) {
728
+		if (empty($this->ID)) {
729 729
 
730 730
 			$payment_id = $this->insert_payment();
731 731
 
732
-			if ( false === $payment_id ) {
732
+			if (false === $payment_id) {
733 733
 				$saved = false;
734 734
 			} else {
735 735
 				$this->ID = $payment_id;
@@ -737,42 +737,42 @@  discard block
 block discarded – undo
737 737
 		}
738 738
 
739 739
 		// Set ID if not matching.
740
-		if ( $this->ID !== $this->_ID ) {
740
+		if ($this->ID !== $this->_ID) {
741 741
 			$this->ID = $this->_ID;
742 742
 		}
743 743
 
744 744
 		// If we have something pending, let's save it.
745
-		if ( ! empty( $this->pending ) ) {
745
+		if ( ! empty($this->pending)) {
746 746
 
747 747
 			$total_increase = 0;
748 748
 			$total_decrease = 0;
749 749
 
750
-			foreach ( $this->pending as $key => $value ) {
750
+			foreach ($this->pending as $key => $value) {
751 751
 
752
-				switch ( $key ) {
752
+				switch ($key) {
753 753
 
754 754
 					case 'donations':
755 755
 						// Update totals for pending donations.
756
-						foreach ( $this->pending[ $key ] as $item ) {
756
+						foreach ($this->pending[$key] as $item) {
757 757
 
758
-							$quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1;
759
-							$price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0;
758
+							$quantity = isset($item['quantity']) ? $item['quantity'] : 1;
759
+							$price_id = isset($item['price_id']) ? $item['price_id'] : 0;
760 760
 
761
-							switch ( $item['action'] ) {
761
+							switch ($item['action']) {
762 762
 
763 763
 								case 'add':
764 764
 
765 765
 									$price = $item['price'];
766 766
 
767
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
767
+									if ('publish' === $this->status || 'complete' === $this->status) {
768 768
 
769 769
 										// Add donation to logs.
770
-										$log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) );
771
-										give_record_donation_in_log( $item['id'], $this->ID, $price_id, $log_date );
770
+										$log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp'));
771
+										give_record_donation_in_log($item['id'], $this->ID, $price_id, $log_date);
772 772
 
773
-										$form = new Give_Donate_Form( $item['id'] );
774
-										$form->increase_sales( $quantity );
775
-										$form->increase_earnings( $price );
773
+										$form = new Give_Donate_Form($item['id']);
774
+										$form->increase_sales($quantity);
775
+										$form->increase_earnings($price);
776 776
 
777 777
 										$total_increase += $price;
778 778
 									}
@@ -797,15 +797,15 @@  discard block
 block discarded – undo
797 797
 										),
798 798
 									);
799 799
 
800
-									$found_logs = get_posts( $log_args );
801
-									foreach ( $found_logs as $log ) {
802
-										wp_delete_post( $log->ID, true );
800
+									$found_logs = get_posts($log_args);
801
+									foreach ($found_logs as $log) {
802
+										wp_delete_post($log->ID, true);
803 803
 									}
804 804
 
805
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
806
-										$form = new Give_Donate_Form( $item['id'] );
807
-										$form->decrease_sales( $quantity );
808
-										$form->decrease_earnings( $item['amount'] );
805
+									if ('publish' === $this->status || 'complete' === $this->status) {
806
+										$form = new Give_Donate_Form($item['id']);
807
+										$form->decrease_sales($quantity);
808
+										$form->decrease_earnings($item['amount']);
809 809
 
810 810
 										$total_decrease += $item['amount'];
811 811
 									}
@@ -816,44 +816,44 @@  discard block
 block discarded – undo
816 816
 						break;
817 817
 
818 818
 					case 'status':
819
-						$this->update_status( $this->status );
819
+						$this->update_status($this->status);
820 820
 						break;
821 821
 
822 822
 					case 'gateway':
823
-						$this->update_meta( '_give_payment_gateway', $this->gateway );
823
+						$this->update_meta('_give_payment_gateway', $this->gateway);
824 824
 						break;
825 825
 
826 826
 					case 'mode':
827
-						$this->update_meta( '_give_payment_mode', $this->mode );
827
+						$this->update_meta('_give_payment_mode', $this->mode);
828 828
 						break;
829 829
 
830 830
 					case 'transaction_id':
831
-						$this->update_meta( '_give_payment_transaction_id', $this->transaction_id );
831
+						$this->update_meta('_give_payment_transaction_id', $this->transaction_id);
832 832
 						break;
833 833
 
834 834
 					case 'ip':
835
-						$this->update_meta( '_give_payment_user_ip', $this->ip );
835
+						$this->update_meta('_give_payment_user_ip', $this->ip);
836 836
 						break;
837 837
 
838 838
 					case 'customer_id':
839
-						$this->update_meta( '_give_payment_customer_id', $this->customer_id );
839
+						$this->update_meta('_give_payment_customer_id', $this->customer_id);
840 840
 						break;
841 841
 
842 842
 					case 'user_id':
843
-						$this->update_meta( '_give_payment_user_id', $this->user_id );
843
+						$this->update_meta('_give_payment_user_id', $this->user_id);
844 844
 						$this->user_info['id'] = $this->user_id;
845 845
 						break;
846 846
 
847 847
 					case 'form_title':
848
-						$this->update_meta( '_give_payment_form_title', $this->form_title );
848
+						$this->update_meta('_give_payment_form_title', $this->form_title);
849 849
 						break;
850 850
 
851 851
 					case 'form_id':
852
-						$this->update_meta( '_give_payment_form_id', $this->form_id );
852
+						$this->update_meta('_give_payment_form_id', $this->form_id);
853 853
 						break;
854 854
 
855 855
 					case 'price_id':
856
-						$this->update_meta( '_give_payment_price_id', $this->price_id );
856
+						$this->update_meta('_give_payment_price_id', $this->price_id);
857 857
 						break;
858 858
 
859 859
 					case 'first_name':
@@ -869,15 +869,15 @@  discard block
 block discarded – undo
869 869
 						break;
870 870
 
871 871
 					case 'email':
872
-						$this->update_meta( '_give_payment_user_email', $this->email );
872
+						$this->update_meta('_give_payment_user_email', $this->email);
873 873
 						break;
874 874
 
875 875
 					case 'key':
876
-						$this->update_meta( '_give_payment_purchase_key', $this->key );
876
+						$this->update_meta('_give_payment_purchase_key', $this->key);
877 877
 						break;
878 878
 
879 879
 					case 'number':
880
-						$this->update_meta( '_give_payment_number', $this->number );
880
+						$this->update_meta('_give_payment_number', $this->number);
881 881
 						break;
882 882
 
883 883
 					case 'date':
@@ -887,11 +887,11 @@  discard block
 block discarded – undo
887 887
 							'edit_date' => true,
888 888
 						);
889 889
 
890
-						wp_update_post( $args );
890
+						wp_update_post($args);
891 891
 						break;
892 892
 
893 893
 					case 'completed_date':
894
-						$this->update_meta( '_give_completed_date', $this->completed_date );
894
+						$this->update_meta('_give_completed_date', $this->completed_date);
895 895
 						break;
896 896
 
897 897
 					case 'parent_payment':
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 							'post_parent' => $this->parent_payment,
901 901
 						);
902 902
 
903
-						wp_update_post( $args );
903
+						wp_update_post($args);
904 904
 						break;
905 905
 
906 906
 					default:
@@ -911,33 +911,33 @@  discard block
 block discarded – undo
911 911
 						 *
912 912
 						 * @param Give_Payment $this Payment object.
913 913
 						 */
914
-						do_action( 'give_payment_save', $this, $key );
914
+						do_action('give_payment_save', $this, $key);
915 915
 						break;
916 916
 				}// End switch().
917 917
 			}// End foreach().
918 918
 
919
-			if ( 'pending' !== $this->status ) {
919
+			if ('pending' !== $this->status) {
920 920
 
921
-				$donor = new Give_Donor( $this->customer_id );
921
+				$donor = new Give_Donor($this->customer_id);
922 922
 
923 923
 				$total_change = $total_increase - $total_decrease;
924
-				if ( $total_change < 0 ) {
924
+				if ($total_change < 0) {
925 925
 
926
-					$total_change = - ( $total_change );
926
+					$total_change = - ($total_change);
927 927
 					// Decrease the donor's donation stats.
928
-					$donor->decrease_value( $total_change );
929
-					give_decrease_total_earnings( $total_change );
928
+					$donor->decrease_value($total_change);
929
+					give_decrease_total_earnings($total_change);
930 930
 
931
-				} elseif ( $total_change > 0 ) {
931
+				} elseif ($total_change > 0) {
932 932
 
933 933
 					// Increase the donor's donation stats.
934
-					$donor->increase_value( $total_change );
935
-					give_increase_total_earnings( $total_change );
934
+					$donor->increase_value($total_change);
935
+					give_increase_total_earnings($total_change);
936 936
 
937 937
 				}
938 938
 			}
939 939
 
940
-			$this->update_meta( '_give_payment_total', give_sanitize_amount_for_db( $this->total ) );
940
+			$this->update_meta('_give_payment_total', give_sanitize_amount_for_db($this->total));
941 941
 
942 942
 			$new_meta = array(
943 943
 				'form_title' => $this->form_title,
@@ -948,12 +948,12 @@  discard block
 block discarded – undo
948 948
 			);
949 949
 
950 950
 			$meta        = $this->get_meta();
951
-			$merged_meta = array_merge( $meta, $new_meta );
951
+			$merged_meta = array_merge($meta, $new_meta);
952 952
 
953 953
 			// Only save the payment meta if it's changed.
954
-			if ( md5( serialize( $meta ) ) !== md5( serialize( $merged_meta ) ) ) {
955
-				$updated = $this->update_meta( '_give_payment_meta', $merged_meta );
956
-				if ( false !== $updated ) {
954
+			if (md5(serialize($meta)) !== md5(serialize($merged_meta))) {
955
+				$updated = $this->update_meta('_give_payment_meta', $merged_meta);
956
+				if (false !== $updated) {
957 957
 					$saved = true;
958 958
 				}
959 959
 			}
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 			$saved         = true;
963 963
 		}// End if().
964 964
 
965
-		if ( true === $saved ) {
966
-			$this->setup_payment( $this->ID );
965
+		if (true === $saved) {
966
+			$this->setup_payment($this->ID);
967 967
 		}
968 968
 
969 969
 		return $saved;
@@ -981,12 +981,12 @@  discard block
 block discarded – undo
981 981
 	 *
982 982
 	 * @return bool           True when successful, false otherwise
983 983
 	 */
984
-	public function add_donation( $form_id = 0, $args = array(), $options = array() ) {
984
+	public function add_donation($form_id = 0, $args = array(), $options = array()) {
985 985
 
986
-		$donation = new Give_Donate_Form( $form_id );
986
+		$donation = new Give_Donate_Form($form_id);
987 987
 
988 988
 		// Bail if this post isn't a give donation form.
989
-		if ( ! $donation || $donation->post_type !== 'give_forms' ) {
989
+		if ( ! $donation || $donation->post_type !== 'give_forms') {
990 990
 			return false;
991 991
 		}
992 992
 
@@ -996,59 +996,59 @@  discard block
 block discarded – undo
996 996
 			'price_id' => false,
997 997
 		);
998 998
 
999
-		$args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults );
999
+		$args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults);
1000 1000
 
1001 1001
 		// Allow overriding the price.
1002
-		if ( false !== $args['price'] ) {
1002
+		if (false !== $args['price']) {
1003 1003
 			$donation_amount = $args['price'];
1004 1004
 		} else {
1005 1005
 
1006 1006
 			// Deal with variable pricing.
1007
-			if ( give_has_variable_prices( $donation->ID ) ) {
1008
-				$prices          = give_get_meta( $form_id, '_give_donation_levels', true );
1007
+			if (give_has_variable_prices($donation->ID)) {
1008
+				$prices          = give_get_meta($form_id, '_give_donation_levels', true);
1009 1009
 				$donation_amount = '';
1010 1010
 				// Loop through prices.
1011
-				foreach ( $prices as $price ) {
1011
+				foreach ($prices as $price) {
1012 1012
 					// Find a match between price_id and level_id.
1013 1013
 					// First verify array keys exists THEN make the match.
1014
-					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1014
+					if ((isset($args['price_id']) && isset($price['_give_id']['level_id']))
1015 1015
 					     && $args['price_id'] == $price['_give_id']['level_id']
1016 1016
 					) {
1017 1017
 						$donation_amount = $price['_give_amount'];
1018 1018
 					}
1019 1019
 				}
1020 1020
 				// Fallback to the lowest price point.
1021
-				if ( $donation_amount == '' ) {
1022
-					$donation_amount  = give_get_lowest_price_option( $donation->ID );
1023
-					$args['price_id'] = give_get_lowest_price_id( $donation->ID );
1021
+				if ($donation_amount == '') {
1022
+					$donation_amount  = give_get_lowest_price_option($donation->ID);
1023
+					$args['price_id'] = give_get_lowest_price_id($donation->ID);
1024 1024
 				}
1025 1025
 			} else {
1026 1026
 				// Simple form price.
1027
-				$donation_amount = give_get_form_price( $donation->ID );
1027
+				$donation_amount = give_get_form_price($donation->ID);
1028 1028
 			}
1029 1029
 		}
1030 1030
 
1031 1031
 		// Sanitizing the price here so we don't have a dozen calls later.
1032
-		$donation_amount = give_maybe_sanitize_amount( $donation_amount );
1033
-		$total           = round( $donation_amount, give_currency_decimal_filter() );
1032
+		$donation_amount = give_maybe_sanitize_amount($donation_amount);
1033
+		$total           = round($donation_amount, give_currency_decimal_filter());
1034 1034
 
1035 1035
 		// Add Options.
1036 1036
 		$default_options = array();
1037
-		if ( false !== $args['price_id'] ) {
1037
+		if (false !== $args['price_id']) {
1038 1038
 			$default_options['price_id'] = (int) $args['price_id'];
1039 1039
 		}
1040
-		$options = wp_parse_args( $options, $default_options );
1040
+		$options = wp_parse_args($options, $default_options);
1041 1041
 
1042 1042
 		// Do not allow totals to go negative.
1043
-		if ( $total < 0 ) {
1043
+		if ($total < 0) {
1044 1044
 			$total = 0;
1045 1045
 		}
1046 1046
 
1047 1047
 		$donation = array(
1048 1048
 			'name'     => $donation->post_title,
1049 1049
 			'id'       => $donation->ID,
1050
-			'price'    => round( $total, give_currency_decimal_filter() ),
1051
-			'subtotal' => round( $total, give_currency_decimal_filter() ),
1050
+			'price'    => round($total, give_currency_decimal_filter()),
1051
+			'subtotal' => round($total, give_currency_decimal_filter()),
1052 1052
 			'price_id' => $args['price_id'],
1053 1053
 			'action'   => 'add',
1054 1054
 			'options'  => $options,
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 
1057 1057
 		$this->pending['donations'][] = $donation;
1058 1058
 
1059
-		$this->increase_subtotal( $total );
1059
+		$this->increase_subtotal($total);
1060 1060
 
1061 1061
 		return true;
1062 1062
 
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 	 *
1074 1074
 	 * @return bool           If the item was removed or not
1075 1075
 	 */
1076
-	public function remove_donation( $form_id, $args = array() ) {
1076
+	public function remove_donation($form_id, $args = array()) {
1077 1077
 
1078 1078
 		// Set some defaults.
1079 1079
 		$defaults = array(
@@ -1081,12 +1081,12 @@  discard block
 block discarded – undo
1081 1081
 			'price'    => false,
1082 1082
 			'price_id' => false,
1083 1083
 		);
1084
-		$args     = wp_parse_args( $args, $defaults );
1084
+		$args = wp_parse_args($args, $defaults);
1085 1085
 
1086
-		$form = new Give_Donate_Form( $form_id );
1086
+		$form = new Give_Donate_Form($form_id);
1087 1087
 
1088 1088
 		// Bail if this post isn't a valid give donation form.
1089
-		if ( ! $form || $form->post_type !== 'give_forms' ) {
1089
+		if ( ! $form || $form->post_type !== 'give_forms') {
1090 1090
 			return false;
1091 1091
 		}
1092 1092
 
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
 		$this->pending['donations'][] = $pending_args;
1101 1101
 
1102
-		$this->decrease_subtotal( $this->total );
1102
+		$this->decrease_subtotal($this->total);
1103 1103
 
1104 1104
 		return true;
1105 1105
 	}
@@ -1115,13 +1115,13 @@  discard block
 block discarded – undo
1115 1115
 	 *
1116 1116
 	 * @return bool           If the note was specified or not
1117 1117
 	 */
1118
-	public function add_note( $note = false ) {
1118
+	public function add_note($note = false) {
1119 1119
 		// Bail if no note specified.
1120
-		if ( ! $note ) {
1120
+		if ( ! $note) {
1121 1121
 			return false;
1122 1122
 		}
1123 1123
 
1124
-		give_insert_payment_note( $this->ID, $note );
1124
+		give_insert_payment_note($this->ID, $note);
1125 1125
 	}
1126 1126
 
1127 1127
 	/**
@@ -1134,8 +1134,8 @@  discard block
 block discarded – undo
1134 1134
 	 *
1135 1135
 	 * @return void
1136 1136
 	 */
1137
-	private function increase_subtotal( $amount = 0.00 ) {
1138
-		$amount         = (float) $amount;
1137
+	private function increase_subtotal($amount = 0.00) {
1138
+		$amount = (float) $amount;
1139 1139
 		$this->subtotal += $amount;
1140 1140
 
1141 1141
 		$this->recalculate_total();
@@ -1151,11 +1151,11 @@  discard block
 block discarded – undo
1151 1151
 	 *
1152 1152
 	 * @return void
1153 1153
 	 */
1154
-	private function decrease_subtotal( $amount = 0.00 ) {
1155
-		$amount         = (float) $amount;
1154
+	private function decrease_subtotal($amount = 0.00) {
1155
+		$amount = (float) $amount;
1156 1156
 		$this->subtotal -= $amount;
1157 1157
 
1158
-		if ( $this->subtotal < 0 ) {
1158
+		if ($this->subtotal < 0) {
1159 1159
 			$this->subtotal = 0;
1160 1160
 		}
1161 1161
 
@@ -1184,24 +1184,24 @@  discard block
 block discarded – undo
1184 1184
 	 *
1185 1185
 	 * @return bool   $updated Returns if the status was successfully updated.
1186 1186
 	 */
1187
-	public function update_status( $status = false ) {
1187
+	public function update_status($status = false) {
1188 1188
 
1189 1189
 		// standardize the 'complete(d)' status.
1190
-		if ( $status == 'completed' || $status == 'complete' ) {
1190
+		if ($status == 'completed' || $status == 'complete') {
1191 1191
 			$status = 'publish';
1192 1192
 		}
1193 1193
 
1194
-		$old_status = ! empty( $this->old_status ) ? $this->old_status : false;
1194
+		$old_status = ! empty($this->old_status) ? $this->old_status : false;
1195 1195
 
1196
-		if ( $old_status === $status ) {
1196
+		if ($old_status === $status) {
1197 1197
 			return false; // Don't permit status changes that aren't changes.
1198 1198
 		}
1199 1199
 
1200
-		$do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status );
1200
+		$do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status);
1201 1201
 
1202 1202
 		$updated = false;
1203 1203
 
1204
-		if ( $do_change ) {
1204
+		if ($do_change) {
1205 1205
 
1206 1206
 			/**
1207 1207
 			 * Fires before changing payment status.
@@ -1212,21 +1212,21 @@  discard block
 block discarded – undo
1212 1212
 			 * @param string $status     The new status.
1213 1213
 			 * @param string $old_status The old status.
1214 1214
 			 */
1215
-			do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status );
1215
+			do_action('give_before_payment_status_change', $this->ID, $status, $old_status);
1216 1216
 
1217 1217
 			$update_fields = array(
1218 1218
 				'ID'          => $this->ID,
1219 1219
 				'post_status' => $status,
1220
-				'edit_date'   => current_time( 'mysql' ),
1220
+				'edit_date'   => current_time('mysql'),
1221 1221
 			);
1222 1222
 
1223
-			$updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) );
1223
+			$updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields));
1224 1224
 
1225 1225
 			$all_payment_statuses  = give_get_payment_statuses();
1226
-			$this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status );
1226
+			$this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status);
1227 1227
 
1228 1228
 			// Process any specific status functions.
1229
-			switch ( $status ) {
1229
+			switch ($status) {
1230 1230
 				case 'refunded':
1231 1231
 					$this->process_refund();
1232 1232
 					break;
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
 			 * @param string $status     The new status.
1254 1254
 			 * @param string $old_status The old status.
1255 1255
 			 */
1256
-			do_action( 'give_update_payment_status', $this->ID, $status, $old_status );
1256
+			do_action('give_update_payment_status', $this->ID, $status, $old_status);
1257 1257
 
1258 1258
 		}// End if().
1259 1259
 
@@ -1288,41 +1288,41 @@  discard block
 block discarded – undo
1288 1288
 	 *
1289 1289
 	 * @return mixed             The value from the post meta
1290 1290
 	 */
1291
-	public function get_meta( $meta_key = '_give_payment_meta', $single = true ) {
1291
+	public function get_meta($meta_key = '_give_payment_meta', $single = true) {
1292 1292
 
1293
-		$meta = give_get_meta( $this->ID, $meta_key, $single );
1293
+		$meta = give_get_meta($this->ID, $meta_key, $single);
1294 1294
 
1295
-		if ( $meta_key === '_give_payment_meta' ) {
1295
+		if ($meta_key === '_give_payment_meta') {
1296 1296
 			$meta = (array) $meta;
1297 1297
 
1298
-			if ( empty( $meta['key'] ) ) {
1298
+			if (empty($meta['key'])) {
1299 1299
 				$meta['key'] = $this->setup_payment_key();
1300 1300
 			}
1301 1301
 
1302
-			if ( empty( $meta['form_title'] ) ) {
1302
+			if (empty($meta['form_title'])) {
1303 1303
 				$meta['form_title'] = $this->setup_form_title();
1304 1304
 			}
1305 1305
 
1306
-			if ( empty( $meta['email'] ) ) {
1306
+			if (empty($meta['email'])) {
1307 1307
 				$meta['email'] = $this->setup_email();
1308 1308
 			}
1309 1309
 
1310
-			if ( empty( $meta['date'] ) ) {
1311
-				$meta['date'] = get_post_field( 'post_date', $this->ID );
1310
+			if (empty($meta['date'])) {
1311
+				$meta['date'] = get_post_field('post_date', $this->ID);
1312 1312
 			}
1313 1313
 		}
1314 1314
 
1315
-		$meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID );
1315
+		$meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID);
1316 1316
 
1317 1317
 		// Security check.
1318
-		if ( is_serialized( $meta ) ) {
1319
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches );
1320
-			if ( ! empty( $matches ) ) {
1318
+		if (is_serialized($meta)) {
1319
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches);
1320
+			if ( ! empty($matches)) {
1321 1321
 				$meta = array();
1322 1322
 			}
1323 1323
 		}
1324 1324
 
1325
-		return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key );
1325
+		return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key);
1326 1326
 	}
1327 1327
 
1328 1328
 	/**
@@ -1337,23 +1337,23 @@  discard block
 block discarded – undo
1337 1337
 	 *
1338 1338
 	 * @return int|bool           Meta ID if the key didn't exist, true on successful update, false on failure
1339 1339
 	 */
1340
-	public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) {
1341
-		if ( empty( $meta_key ) ) {
1340
+	public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') {
1341
+		if (empty($meta_key)) {
1342 1342
 			return false;
1343 1343
 		}
1344 1344
 
1345
-		if ( $meta_key == 'key' || $meta_key == 'date' ) {
1345
+		if ($meta_key == 'key' || $meta_key == 'date') {
1346 1346
 
1347 1347
 			$current_meta              = $this->get_meta();
1348
-			$current_meta[ $meta_key ] = $meta_value;
1348
+			$current_meta[$meta_key] = $meta_value;
1349 1349
 
1350 1350
 			$meta_key   = '_give_payment_meta';
1351 1351
 			$meta_value = $current_meta;
1352 1352
 
1353
-		} elseif ( $meta_key == 'email' || $meta_key == '_give_payment_user_email' ) {
1353
+		} elseif ($meta_key == 'email' || $meta_key == '_give_payment_user_email') {
1354 1354
 
1355
-			$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1356
-			give_update_meta( $this->ID, '_give_payment_user_email', $meta_value );
1355
+			$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1356
+			give_update_meta($this->ID, '_give_payment_user_email', $meta_value);
1357 1357
 
1358 1358
 			$current_meta                       = $this->get_meta();
1359 1359
 			$current_meta['user_info']['email'] = $meta_value;
@@ -1363,9 +1363,9 @@  discard block
 block discarded – undo
1363 1363
 
1364 1364
 		}
1365 1365
 
1366
-		$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1366
+		$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1367 1367
 
1368
-		return give_update_meta( $this->ID, $meta_key, $meta_value, $prev_value );
1368
+		return give_update_meta($this->ID, $meta_key, $meta_value, $prev_value);
1369 1369
 	}
1370 1370
 
1371 1371
 	/**
@@ -1380,14 +1380,14 @@  discard block
 block discarded – undo
1380 1380
 		$process_refund = true;
1381 1381
 
1382 1382
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1383
-		if ( 'publish' != $this->old_status || 'refunded' != $this->status ) {
1383
+		if ('publish' != $this->old_status || 'refunded' != $this->status) {
1384 1384
 			$process_refund = false;
1385 1385
 		}
1386 1386
 
1387 1387
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1388
-		$process_refund = apply_filters( 'give_should_process_refund', $process_refund, $this );
1388
+		$process_refund = apply_filters('give_should_process_refund', $process_refund, $this);
1389 1389
 
1390
-		if ( false === $process_refund ) {
1390
+		if (false === $process_refund) {
1391 1391
 			return;
1392 1392
 		}
1393 1393
 
@@ -1398,13 +1398,13 @@  discard block
 block discarded – undo
1398 1398
 		 *
1399 1399
 		 * @param Give_Payment $this Payment object.
1400 1400
 		 */
1401
-		do_action( 'give_pre_refund_payment', $this );
1401
+		do_action('give_pre_refund_payment', $this);
1402 1402
 
1403
-		$decrease_earnings       = apply_filters( 'give_decrease_store_earnings_on_refund', true, $this );
1404
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_refund', true, $this );
1405
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_refund', true, $this );
1403
+		$decrease_earnings       = apply_filters('give_decrease_store_earnings_on_refund', true, $this);
1404
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_refund', true, $this);
1405
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_refund', true, $this);
1406 1406
 
1407
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_customer_value, $decrease_purchase_count );
1407
+		$this->maybe_alter_stats($decrease_earnings, $decrease_customer_value, $decrease_purchase_count);
1408 1408
 		$this->delete_sales_logs();
1409 1409
 
1410 1410
 		// @todo: Refresh only range related stat cache
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 		 *
1418 1418
 		 * @param Give_Payment $this Payment object.
1419 1419
 		 */
1420
-		do_action( 'give_post_refund_payment', $this );
1420
+		do_action('give_post_refund_payment', $this);
1421 1421
 	}
1422 1422
 
1423 1423
 	/**
@@ -1444,26 +1444,26 @@  discard block
 block discarded – undo
1444 1444
 		$process_pending = true;
1445 1445
 
1446 1446
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1447
-		if ( 'publish' != $this->old_status || 'pending' != $this->status ) {
1447
+		if ('publish' != $this->old_status || 'pending' != $this->status) {
1448 1448
 			$process_pending = false;
1449 1449
 		}
1450 1450
 
1451 1451
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1452
-		$process_pending = apply_filters( 'give_should_process_pending', $process_pending, $this );
1452
+		$process_pending = apply_filters('give_should_process_pending', $process_pending, $this);
1453 1453
 
1454
-		if ( false === $process_pending ) {
1454
+		if (false === $process_pending) {
1455 1455
 			return;
1456 1456
 		}
1457 1457
 
1458
-		$decrease_earnings       = apply_filters( 'give_decrease_earnings_on_pending', true, $this );
1459
-		$decrease_donor_value    = apply_filters( 'give_decrease_donor_value_on_pending', true, $this );
1460
-		$decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_pending', true, $this );
1458
+		$decrease_earnings       = apply_filters('give_decrease_earnings_on_pending', true, $this);
1459
+		$decrease_donor_value    = apply_filters('give_decrease_donor_value_on_pending', true, $this);
1460
+		$decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_pending', true, $this);
1461 1461
 
1462
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1462
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1463 1463
 		$this->delete_sales_logs();
1464 1464
 
1465 1465
 		$this->completed_date = false;
1466
-		$this->update_meta( '_give_completed_date', '' );
1466
+		$this->update_meta('_give_completed_date', '');
1467 1467
 
1468 1468
 		// @todo: Refresh only range related stat cache
1469 1469
 		give_delete_donation_stats();
@@ -1481,26 +1481,26 @@  discard block
 block discarded – undo
1481 1481
 		$process_cancelled = true;
1482 1482
 
1483 1483
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1484
-		if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) {
1484
+		if ('publish' != $this->old_status || 'cancelled' != $this->status) {
1485 1485
 			$process_cancelled = false;
1486 1486
 		}
1487 1487
 
1488 1488
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1489
-		$process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this );
1489
+		$process_cancelled = apply_filters('give_should_process_cancelled', $process_cancelled, $this);
1490 1490
 
1491
-		if ( false === $process_cancelled ) {
1491
+		if (false === $process_cancelled) {
1492 1492
 			return;
1493 1493
 		}
1494 1494
 
1495
-		$decrease_earnings       = apply_filters( 'give_decrease_earnings_on_cancelled', true, $this );
1496
-		$decrease_donor_value    = apply_filters( 'give_decrease_donor_value_on_cancelled', true, $this );
1497
-		$decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_cancelled', true, $this );
1495
+		$decrease_earnings       = apply_filters('give_decrease_earnings_on_cancelled', true, $this);
1496
+		$decrease_donor_value    = apply_filters('give_decrease_donor_value_on_cancelled', true, $this);
1497
+		$decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_cancelled', true, $this);
1498 1498
 
1499
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1499
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1500 1500
 		$this->delete_sales_logs();
1501 1501
 
1502 1502
 		$this->completed_date = false;
1503
-		$this->update_meta( '_give_completed_date', '' );
1503
+		$this->update_meta('_give_completed_date', '');
1504 1504
 
1505 1505
 		// @todo: Refresh only range related stat cache
1506 1506
 		give_delete_donation_stats();
@@ -1516,26 +1516,26 @@  discard block
 block discarded – undo
1516 1516
 		$process_revoked = true;
1517 1517
 
1518 1518
 		// If the payment was not in publish, don't decrement stats as they were never incremented.
1519
-		if ( 'publish' != $this->old_status || 'revoked' != $this->status ) {
1519
+		if ('publish' != $this->old_status || 'revoked' != $this->status) {
1520 1520
 			$process_revoked = false;
1521 1521
 		}
1522 1522
 
1523 1523
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1524
-		$process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this );
1524
+		$process_revoked = apply_filters('give_should_process_revoked', $process_revoked, $this);
1525 1525
 
1526
-		if ( false === $process_revoked ) {
1526
+		if (false === $process_revoked) {
1527 1527
 			return;
1528 1528
 		}
1529 1529
 
1530
-		$decrease_earnings       = apply_filters( 'give_decrease_earnings_on_revoked', true, $this );
1531
-		$decrease_donor_value    = apply_filters( 'give_decrease_donor_value_on_revoked', true, $this );
1532
-		$decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_revoked', true, $this );
1530
+		$decrease_earnings       = apply_filters('give_decrease_earnings_on_revoked', true, $this);
1531
+		$decrease_donor_value    = apply_filters('give_decrease_donor_value_on_revoked', true, $this);
1532
+		$decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_revoked', true, $this);
1533 1533
 
1534
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1534
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1535 1535
 		$this->delete_sales_logs();
1536 1536
 
1537 1537
 		$this->completed_date = false;
1538
-		$this->update_meta( '_give_completed_date', '' );
1538
+		$this->update_meta('_give_completed_date', '');
1539 1539
 
1540 1540
 		// @todo: Refresh only range related stat cache
1541 1541
 		give_delete_donation_stats();
@@ -1553,25 +1553,25 @@  discard block
 block discarded – undo
1553 1553
 	 *
1554 1554
 	 * @return void
1555 1555
 	 */
1556
-	private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) {
1556
+	private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) {
1557 1557
 
1558
-		give_undo_donation( $this->ID );
1558
+		give_undo_donation($this->ID);
1559 1559
 
1560 1560
 		// Decrease store earnings.
1561
-		if ( true === $alter_store_earnings ) {
1562
-			give_decrease_total_earnings( $this->total );
1561
+		if (true === $alter_store_earnings) {
1562
+			give_decrease_total_earnings($this->total);
1563 1563
 		}
1564 1564
 
1565 1565
 		// Decrement the stats for the donor.
1566
-		if ( ! empty( $this->customer_id ) ) {
1566
+		if ( ! empty($this->customer_id)) {
1567 1567
 
1568
-			$donor = new Give_Donor( $this->customer_id );
1568
+			$donor = new Give_Donor($this->customer_id);
1569 1569
 
1570
-			if ( true === $alter_customer_value ) {
1571
-				$donor->decrease_value( $this->total );
1570
+			if (true === $alter_customer_value) {
1571
+				$donor->decrease_value($this->total);
1572 1572
 			}
1573 1573
 
1574
-			if ( true === $alter_customer_purchase_count ) {
1574
+			if (true === $alter_customer_purchase_count) {
1575 1575
 				$donor->decrease_donation_count();
1576 1576
 			}
1577 1577
 		}
@@ -1620,13 +1620,13 @@  discard block
 block discarded – undo
1620 1620
 	 * @return string The date the payment was completed
1621 1621
 	 */
1622 1622
 	private function setup_completed_date() {
1623
-		$payment = get_post( $this->ID );
1623
+		$payment = get_post($this->ID);
1624 1624
 
1625
-		if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) {
1625
+		if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) {
1626 1626
 			return false; // This payment was never completed.
1627 1627
 		}
1628 1628
 
1629
-		$date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date;
1629
+		$date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date;
1630 1630
 
1631 1631
 		return $date;
1632 1632
 	}
@@ -1640,7 +1640,7 @@  discard block
 block discarded – undo
1640 1640
 	 * @return string The payment mode
1641 1641
 	 */
1642 1642
 	private function setup_mode() {
1643
-		return $this->get_meta( '_give_payment_mode' );
1643
+		return $this->get_meta('_give_payment_mode');
1644 1644
 	}
1645 1645
 
1646 1646
 	/**
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 	 * @return bool The payment import
1653 1653
 	 */
1654 1654
 	private function setup_import() {
1655
-		return (bool) $this->get_meta( '_give_payment_import' );
1655
+		return (bool) $this->get_meta('_give_payment_import');
1656 1656
 	}
1657 1657
 
1658 1658
 	/**
@@ -1664,18 +1664,18 @@  discard block
 block discarded – undo
1664 1664
 	 * @return float The payment total
1665 1665
 	 */
1666 1666
 	private function setup_total() {
1667
-		$amount = $this->get_meta( '_give_payment_total', true );
1667
+		$amount = $this->get_meta('_give_payment_total', true);
1668 1668
 
1669
-		if ( empty( $amount ) && '0.00' != $amount ) {
1670
-			$meta = $this->get_meta( '_give_payment_meta', true );
1671
-			$meta = maybe_unserialize( $meta );
1669
+		if (empty($amount) && '0.00' != $amount) {
1670
+			$meta = $this->get_meta('_give_payment_meta', true);
1671
+			$meta = maybe_unserialize($meta);
1672 1672
 
1673
-			if ( isset( $meta['amount'] ) ) {
1673
+			if (isset($meta['amount'])) {
1674 1674
 				$amount = $meta['amount'];
1675 1675
 			}
1676 1676
 		}
1677 1677
 
1678
-		return round( floatval( $amount ), give_currency_decimal_filter() );
1678
+		return round(floatval($amount), give_currency_decimal_filter());
1679 1679
 	}
1680 1680
 
1681 1681
 	/**
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
 	 * @return string The currency for the payment
1702 1702
 	 */
1703 1703
 	private function setup_currency() {
1704
-		$currency = isset( $this->payment_meta['currency'] ) ? $this->payment_meta['currency'] : apply_filters( 'give_payment_currency_default', give_get_currency(), $this );
1704
+		$currency = isset($this->payment_meta['currency']) ? $this->payment_meta['currency'] : apply_filters('give_payment_currency_default', give_get_currency(), $this);
1705 1705
 
1706 1706
 		return $currency;
1707 1707
 	}
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
 	 * @return string The gateway
1716 1716
 	 */
1717 1717
 	private function setup_gateway() {
1718
-		$gateway = $this->get_meta( '_give_payment_gateway', true );
1718
+		$gateway = $this->get_meta('_give_payment_gateway', true);
1719 1719
 
1720 1720
 		return $gateway;
1721 1721
 	}
@@ -1729,11 +1729,11 @@  discard block
 block discarded – undo
1729 1729
 	 * @return string The donation ID
1730 1730
 	 */
1731 1731
 	private function setup_transaction_id() {
1732
-		$transaction_id = $this->get_meta( '_give_payment_transaction_id', true );
1732
+		$transaction_id = $this->get_meta('_give_payment_transaction_id', true);
1733 1733
 
1734
-		if ( empty( $transaction_id ) ) {
1734
+		if (empty($transaction_id)) {
1735 1735
 			$gateway        = $this->gateway;
1736
-			$transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID );
1736
+			$transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID);
1737 1737
 		}
1738 1738
 
1739 1739
 		return $transaction_id;
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 	 * @return string The IP address for the payment
1749 1749
 	 */
1750 1750
 	private function setup_ip() {
1751
-		$ip = $this->get_meta( '_give_payment_user_ip', true );
1751
+		$ip = $this->get_meta('_give_payment_user_ip', true);
1752 1752
 
1753 1753
 		return $ip;
1754 1754
 	}
@@ -1762,7 +1762,7 @@  discard block
 block discarded – undo
1762 1762
 	 * @return int The Donor ID.
1763 1763
 	 */
1764 1764
 	private function setup_donor_id() {
1765
-		$customer_id = $this->get_meta( '_give_payment_customer_id', true );
1765
+		$customer_id = $this->get_meta('_give_payment_customer_id', true);
1766 1766
 
1767 1767
 		return $customer_id;
1768 1768
 	}
@@ -1776,7 +1776,7 @@  discard block
 block discarded – undo
1776 1776
 	 * @return int The User ID
1777 1777
 	 */
1778 1778
 	private function setup_user_id() {
1779
-		$user_id = $this->get_meta( '_give_payment_user_id', true );
1779
+		$user_id = $this->get_meta('_give_payment_user_id', true);
1780 1780
 
1781 1781
 		return $user_id;
1782 1782
 	}
@@ -1790,10 +1790,10 @@  discard block
 block discarded – undo
1790 1790
 	 * @return string The email address for the payment.
1791 1791
 	 */
1792 1792
 	private function setup_email() {
1793
-		$email = $this->get_meta( '_give_payment_user_email', true );
1793
+		$email = $this->get_meta('_give_payment_user_email', true);
1794 1794
 
1795
-		if ( empty( $email ) && $this->customer_id ) {
1796
-			$email = Give()->donors->get_column( 'email', $this->customer_id );
1795
+		if (empty($email) && $this->customer_id) {
1796
+			$email = Give()->donors->get_column('email', $this->customer_id);
1797 1797
 		}
1798 1798
 
1799 1799
 		return $email;
@@ -1813,23 +1813,23 @@  discard block
 block discarded – undo
1813 1813
 			'last_name'  => $this->last_name,
1814 1814
 		);
1815 1815
 
1816
-		$user_info = isset( $this->payment_meta['user_info'] ) ? $this->payment_meta['user_info'] : array();
1816
+		$user_info = isset($this->payment_meta['user_info']) ? $this->payment_meta['user_info'] : array();
1817 1817
 
1818
-		if ( is_serialized( $user_info ) ) {
1819
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches );
1820
-			if ( ! empty( $matches ) ) {
1818
+		if (is_serialized($user_info)) {
1819
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches);
1820
+			if ( ! empty($matches)) {
1821 1821
 				$user_info = array();
1822 1822
 			}
1823 1823
 		}
1824 1824
 
1825
-		$user_info = wp_parse_args( $user_info, $defaults );
1825
+		$user_info = wp_parse_args($user_info, $defaults);
1826 1826
 
1827
-		if ( empty( $user_info ) ) {
1827
+		if (empty($user_info)) {
1828 1828
 			// Get the donor, but only if it's been created.
1829
-			$donor = new Give_Donor( $this->customer_id );
1829
+			$donor = new Give_Donor($this->customer_id);
1830 1830
 
1831
-			if ( $donor->id > 0 ) {
1832
-				$name      = explode( ' ', $donor->name, 2 );
1831
+			if ($donor->id > 0) {
1832
+				$name      = explode(' ', $donor->name, 2);
1833 1833
 				$user_info = array(
1834 1834
 					'first_name' => $name[0],
1835 1835
 					'last_name'  => $name[1],
@@ -1839,29 +1839,29 @@  discard block
 block discarded – undo
1839 1839
 			}
1840 1840
 		} else {
1841 1841
 			// Get the donor, but only if it's been created.
1842
-			$donor = new Give_Donor( $this->customer_id );
1843
-			if ( $donor->id > 0 ) {
1844
-				foreach ( $user_info as $key => $value ) {
1845
-					if ( ! empty( $value ) ) {
1842
+			$donor = new Give_Donor($this->customer_id);
1843
+			if ($donor->id > 0) {
1844
+				foreach ($user_info as $key => $value) {
1845
+					if ( ! empty($value)) {
1846 1846
 						continue;
1847 1847
 					}
1848 1848
 
1849
-					switch ( $key ) {
1849
+					switch ($key) {
1850 1850
 						case 'first_name':
1851
-							$name = explode( ' ', $donor->name, 2 );
1851
+							$name = explode(' ', $donor->name, 2);
1852 1852
 
1853
-							$user_info[ $key ] = $name[0];
1853
+							$user_info[$key] = $name[0];
1854 1854
 							break;
1855 1855
 
1856 1856
 						case 'last_name':
1857
-							$name      = explode( ' ', $donor->name, 2 );
1858
-							$last_name = ! empty( $name[1] ) ? $name[1] : '';
1857
+							$name      = explode(' ', $donor->name, 2);
1858
+							$last_name = ! empty($name[1]) ? $name[1] : '';
1859 1859
 
1860
-							$user_info[ $key ] = $last_name;
1860
+							$user_info[$key] = $last_name;
1861 1861
 							break;
1862 1862
 
1863 1863
 						case 'email':
1864
-							$user_info[ $key ] = $donor->email;
1864
+							$user_info[$key] = $donor->email;
1865 1865
 							break;
1866 1866
 					}
1867 1867
 				}
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
 	 */
1883 1883
 	private function setup_address() {
1884 1884
 
1885
-		$address = ! empty( $this->payment_meta['user_info']['address'] ) ? $this->payment_meta['user_info']['address'] : array(
1885
+		$address = ! empty($this->payment_meta['user_info']['address']) ? $this->payment_meta['user_info']['address'] : array(
1886 1886
 			'line1'   => '',
1887 1887
 			'line2'   => '',
1888 1888
 			'city'    => '',
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
 	 */
1905 1905
 	private function setup_form_title() {
1906 1906
 
1907
-		$form_id = $this->get_meta( '_give_payment_form_title', true );
1907
+		$form_id = $this->get_meta('_give_payment_form_title', true);
1908 1908
 
1909 1909
 		return $form_id;
1910 1910
 	}
@@ -1919,7 +1919,7 @@  discard block
 block discarded – undo
1919 1919
 	 */
1920 1920
 	private function setup_form_id() {
1921 1921
 
1922
-		$form_id = $this->get_meta( '_give_payment_form_id', true );
1922
+		$form_id = $this->get_meta('_give_payment_form_id', true);
1923 1923
 
1924 1924
 		return $form_id;
1925 1925
 	}
@@ -1933,7 +1933,7 @@  discard block
 block discarded – undo
1933 1933
 	 * @return int The Form Price ID.
1934 1934
 	 */
1935 1935
 	private function setup_price_id() {
1936
-		$price_id = $this->get_meta( '_give_payment_price_id', true );
1936
+		$price_id = $this->get_meta('_give_payment_price_id', true);
1937 1937
 
1938 1938
 		return $price_id;
1939 1939
 	}
@@ -1947,7 +1947,7 @@  discard block
 block discarded – undo
1947 1947
 	 * @return string The Payment Key.
1948 1948
 	 */
1949 1949
 	private function setup_payment_key() {
1950
-		$key = $this->get_meta( '_give_payment_purchase_key', true );
1950
+		$key = $this->get_meta('_give_payment_purchase_key', true);
1951 1951
 
1952 1952
 		return $key;
1953 1953
 	}
@@ -1963,11 +1963,11 @@  discard block
 block discarded – undo
1963 1963
 	private function setup_payment_number() {
1964 1964
 		$number = $this->ID;
1965 1965
 
1966
-		if ( give_get_option( 'enable_sequential' ) ) {
1966
+		if (give_get_option('enable_sequential')) {
1967 1967
 
1968
-			$number = $this->get_meta( '_give_payment_number', true );
1968
+			$number = $this->get_meta('_give_payment_number', true);
1969 1969
 
1970
-			if ( ! $number ) {
1970
+			if ( ! $number) {
1971 1971
 
1972 1972
 				$number = $this->ID;
1973 1973
 
@@ -1985,7 +1985,7 @@  discard block
 block discarded – undo
1985 1985
 	 * @return array The payment object as an array.
1986 1986
 	 */
1987 1987
 	public function array_convert() {
1988
-		return get_object_vars( $this );
1988
+		return get_object_vars($this);
1989 1989
 	}
1990 1990
 
1991 1991
 
@@ -1998,7 +1998,7 @@  discard block
 block discarded – undo
1998 1998
 	 * @return bool
1999 1999
 	 */
2000 2000
 	public function is_completed() {
2001
-		return ( 'publish' === $this->status && $this->completed_date );
2001
+		return ('publish' === $this->status && $this->completed_date);
2002 2002
 	}
2003 2003
 
2004 2004
 	/**
@@ -2010,7 +2010,7 @@  discard block
 block discarded – undo
2010 2010
 	 * @return string Date payment was completed.
2011 2011
 	 */
2012 2012
 	private function get_completed_date() {
2013
-		return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this );
2013
+		return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this);
2014 2014
 	}
2015 2015
 
2016 2016
 	/**
@@ -2022,7 +2022,7 @@  discard block
 block discarded – undo
2022 2022
 	 * @return float Payment subtotal.
2023 2023
 	 */
2024 2024
 	private function get_subtotal() {
2025
-		return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this );
2025
+		return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this);
2026 2026
 	}
2027 2027
 
2028 2028
 	/**
@@ -2034,7 +2034,7 @@  discard block
 block discarded – undo
2034 2034
 	 * @return string Payment currency code.
2035 2035
 	 */
2036 2036
 	private function get_currency() {
2037
-		return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this );
2037
+		return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this);
2038 2038
 	}
2039 2039
 
2040 2040
 	/**
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
 	 * @return string Gateway used.
2047 2047
 	 */
2048 2048
 	private function get_gateway() {
2049
-		return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this );
2049
+		return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this);
2050 2050
 	}
2051 2051
 
2052 2052
 	/**
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
 	 * @return string Donation ID from merchant processor.
2059 2059
 	 */
2060 2060
 	private function get_transaction_id() {
2061
-		return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this );
2061
+		return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this);
2062 2062
 	}
2063 2063
 
2064 2064
 	/**
@@ -2070,7 +2070,7 @@  discard block
 block discarded – undo
2070 2070
 	 * @return string Payment IP address
2071 2071
 	 */
2072 2072
 	private function get_ip() {
2073
-		return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this );
2073
+		return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this);
2074 2074
 	}
2075 2075
 
2076 2076
 	/**
@@ -2082,7 +2082,7 @@  discard block
 block discarded – undo
2082 2082
 	 * @return int Payment donor ID.
2083 2083
 	 */
2084 2084
 	private function get_donor_id() {
2085
-		return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this );
2085
+		return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this);
2086 2086
 	}
2087 2087
 
2088 2088
 	/**
@@ -2094,7 +2094,7 @@  discard block
 block discarded – undo
2094 2094
 	 * @return int Payment user ID.
2095 2095
 	 */
2096 2096
 	private function get_user_id() {
2097
-		return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this );
2097
+		return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this);
2098 2098
 	}
2099 2099
 
2100 2100
 	/**
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
 	 * @return string Payment donor email.
2107 2107
 	 */
2108 2108
 	private function get_email() {
2109
-		return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this );
2109
+		return apply_filters('give_payment_user_email', $this->email, $this->ID, $this);
2110 2110
 	}
2111 2111
 
2112 2112
 	/**
@@ -2118,7 +2118,7 @@  discard block
 block discarded – undo
2118 2118
 	 * @return array Payment user info.
2119 2119
 	 */
2120 2120
 	private function get_user_info() {
2121
-		return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this );
2121
+		return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this);
2122 2122
 	}
2123 2123
 
2124 2124
 	/**
@@ -2130,7 +2130,7 @@  discard block
 block discarded – undo
2130 2130
 	 * @return array Payment billing address.
2131 2131
 	 */
2132 2132
 	private function get_address() {
2133
-		return apply_filters( 'give_payment_address', $this->address, $this->ID, $this );
2133
+		return apply_filters('give_payment_address', $this->address, $this->ID, $this);
2134 2134
 	}
2135 2135
 
2136 2136
 	/**
@@ -2142,7 +2142,7 @@  discard block
 block discarded – undo
2142 2142
 	 * @return string Payment key.
2143 2143
 	 */
2144 2144
 	private function get_key() {
2145
-		return apply_filters( 'give_payment_key', $this->key, $this->ID, $this );
2145
+		return apply_filters('give_payment_key', $this->key, $this->ID, $this);
2146 2146
 	}
2147 2147
 
2148 2148
 	/**
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
 	 * @return string Payment form id
2155 2155
 	 */
2156 2156
 	private function get_form_id() {
2157
-		return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this );
2157
+		return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this);
2158 2158
 	}
2159 2159
 
2160 2160
 	/**
@@ -2166,7 +2166,7 @@  discard block
 block discarded – undo
2166 2166
 	 * @return int|string Payment number
2167 2167
 	 */
2168 2168
 	private function get_number() {
2169
-		return apply_filters( 'give_payment_number', $this->number, $this->ID, $this );
2169
+		return apply_filters('give_payment_number', $this->number, $this->ID, $this);
2170 2170
 	}
2171 2171
 
2172 2172
 }
Please login to merge, or discard this patch.
includes/class-give-cli-commands.php 1 patch
Spacing   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // Exit if accessed directly.
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if ( ! defined('ABSPATH')) {
11 11
 	exit;
12 12
 }
13 13
 
14 14
 // Add give command.
15
-WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' );
15
+WP_CLI::add_command('give', 'GIVE_CLI_COMMAND');
16 16
 
17 17
 
18 18
 /**
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @subcommand    logo
70 70
 	 */
71
-	public function ascii( $args, $assoc_args ) {
72
-		WP_CLI::log( file_get_contents( GIVE_PLUGIN_DIR . 'assets/images/give-ascii-logo.txt' ) );
71
+	public function ascii($args, $assoc_args) {
72
+		WP_CLI::log(file_get_contents(GIVE_PLUGIN_DIR.'assets/images/give-ascii-logo.txt'));
73 73
 	}
74 74
 
75 75
 
@@ -94,54 +94,54 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @subcommand    details
96 96
 	 */
97
-	public function details( $args, $assoc_args ) {
97
+	public function details($args, $assoc_args) {
98 98
 
99 99
 		/**
100 100
 		 * Plugin Information
101 101
 		 */
102
-		WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION );
102
+		WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION);
103 103
 
104 104
 		/**
105 105
 		 * General Information.
106 106
 		 */
107
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'General information', 'give' ) ) . '   ####' );
107
+		WP_CLI::log("\n####   ".$this->color_message(__('General information', 'give')).'   ####');
108 108
 
109
-		$success_page = give_get_option( 'success_page' );
110
-		$failure_page = give_get_option( 'failure_page' );
111
-		$history_page = give_get_option( 'history_page' );
109
+		$success_page = give_get_option('success_page');
110
+		$failure_page = give_get_option('failure_page');
111
+		$history_page = give_get_option('history_page');
112 112
 
113
-		WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) );
114
-		WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) );
115
-		WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) );
116
-		WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() );
113
+		WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give')));
114
+		WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give')));
115
+		WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give')));
116
+		WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country());
117 117
 
118 118
 		/**
119 119
 		 * Currency Information.
120 120
 		 */
121
-		$default_gateway = give_get_option( 'default_gateway' );
121
+		$default_gateway = give_get_option('default_gateway');
122 122
 
123
-		WP_CLI::log( "\n####   " . $this->color_message( __( 'Currency Information', 'give' ) ) . '   ####' );
123
+		WP_CLI::log("\n####   ".$this->color_message(__('Currency Information', 'give')).'   ####');
124 124
 
125
-		WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) );
126
-		WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) );
127
-		WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) );
128
-		WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) );
129
-		WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) );
130
-		WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) );
131
-		WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) );
125
+		WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency()));
126
+		WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position()));
127
+		WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator()));
128
+		WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator()));
129
+		WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals()));
130
+		WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give'))));
131
+		WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give'))));
132 132
 
133 133
 		// Payment gateways Information.
134
-		$gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() );
135
-		WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) );
134
+		$gateways = give_get_ordered_payment_gateways(give_get_payment_gateways());
135
+		WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give')));
136 136
 
137
-		if ( ! empty( $gateways ) ) {
137
+		if ( ! empty($gateways)) {
138 138
 			self::$counter = 1;
139
-			foreach ( $gateways as $gateway ) {
140
-				WP_CLI::log( '  ' . $this->color_message( self::$counter, $gateway['admin_label'] ) );
141
-				self::$counter ++;
139
+			foreach ($gateways as $gateway) {
140
+				WP_CLI::log('  '.$this->color_message(self::$counter, $gateway['admin_label']));
141
+				self::$counter++;
142 142
 			}
143 143
 		} else {
144
-			WP_CLI::log( __( 'Not any payment gateways found', 'give' ) );
144
+			WP_CLI::log(__('Not any payment gateways found', 'give'));
145 145
 		}
146 146
 	}
147 147
 
@@ -173,15 +173,15 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @subcommand    forms
175 175
 	 */
176
-	public function forms( $args, $assoc_args ) {
176
+	public function forms($args, $assoc_args) {
177 177
 		global $wp_query;
178
-		$form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false;
179
-		$number  = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10;
178
+		$form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
179
+		$number  = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10;
180 180
 		$start   = time();
181 181
 
182 182
 		// Cache previous number query var.
183 183
 		$is_set_number = $cache_per_page = false;
184
-		if ( isset( $wp_query->query_vars['number'] ) ) {
184
+		if (isset($wp_query->query_vars['number'])) {
185 185
 			$cache_per_page = $wp_query->query_vars['number'];
186 186
 			$is_set_number  = true;
187 187
 		}
@@ -190,22 +190,22 @@  discard block
 block discarded – undo
190 190
 		$wp_query->query_vars['number'] = $number;
191 191
 
192 192
 		// Get forms.
193
-		$forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms();
193
+		$forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms();
194 194
 
195 195
 		// Reset number query var.
196
-		if ( $is_set_number ) {
196
+		if ($is_set_number) {
197 197
 			$wp_query->query_vars['number'] = $cache_per_page;
198 198
 		}
199 199
 
200 200
 		// Bailout.
201
-		if ( array_key_exists( 'error', $forms ) ) {
201
+		if (array_key_exists('error', $forms)) {
202 202
 
203
-			WP_CLI::warning( $forms['error'] );
203
+			WP_CLI::warning($forms['error']);
204 204
 
205 205
 			return;
206
-		} elseif ( empty( $forms['forms'] ) ) {
206
+		} elseif (empty($forms['forms'])) {
207 207
 
208
-			WP_CLI::error( __( 'No forms found.', 'give' ) );
208
+			WP_CLI::error(__('No forms found.', 'give'));
209 209
 
210 210
 			return;
211 211
 		}
@@ -213,25 +213,25 @@  discard block
 block discarded – undo
213 213
 		// Param to check if form typeis already showed or not.
214 214
 		$is_show_form_type = false;
215 215
 
216
-		if ( 1 === count( $forms ) && $form_id ) {
216
+		if (1 === count($forms) && $form_id) {
217 217
 			// Show single form.
218
-			foreach ( $forms['forms'][0] as $key => $info ) {
219
-				switch ( $key ) {
218
+			foreach ($forms['forms'][0] as $key => $info) {
219
+				switch ($key) {
220 220
 					case 'stats':
221
-						$this->color_main_heading( ucfirst( $key ) );
221
+						$this->color_main_heading(ucfirst($key));
222 222
 
223
-						foreach ( $info as $heading => $data ) {
224
-							$this->color_sub_heading( ucfirst( $heading ) );
225
-							switch ( $heading ) {
223
+						foreach ($info as $heading => $data) {
224
+							$this->color_sub_heading(ucfirst($heading));
225
+							switch ($heading) {
226 226
 								default:
227
-									foreach ( $data as $subheading => $subdata ) {
227
+									foreach ($data as $subheading => $subdata) {
228 228
 
229
-										switch ( $subheading ) {
229
+										switch ($subheading) {
230 230
 											case 'earnings':
231
-												WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) );
231
+												WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata)));
232 232
 												break;
233 233
 											default:
234
-												WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) );
234
+												WP_CLI::log($this->color_message($subheading.': ', $subdata));
235 235
 										}
236 236
 									}
237 237
 							}
@@ -241,26 +241,26 @@  discard block
 block discarded – undo
241 241
 					case 'pricing':
242 242
 					case 'info':
243 243
 					default:
244
-						$this->color_main_heading( ucfirst( $key ) );
244
+						$this->color_main_heading(ucfirst($key));
245 245
 
246 246
 						// Show form type.
247
-						if ( ! $is_show_form_type ) {
248
-							$form              = new Give_Donate_Form( $form_id );
247
+						if ( ! $is_show_form_type) {
248
+							$form              = new Give_Donate_Form($form_id);
249 249
 							$is_show_form_type = true;
250 250
 
251
-							WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) );
251
+							WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type()));
252 252
 						}
253 253
 
254
-						foreach ( $info as $heading => $data ) {
254
+						foreach ($info as $heading => $data) {
255 255
 
256
-							switch ( $heading ) {
256
+							switch ($heading) {
257 257
 								case 'id':
258
-									WP_CLI::log( $this->color_message( $heading, $data ) );
258
+									WP_CLI::log($this->color_message($heading, $data));
259 259
 									break;
260 260
 
261 261
 								default:
262
-									$data = empty( $data ) ? __( 'Not set', 'give' ) : $data;
263
-									WP_CLI::log( $this->color_message( $heading, $data ) );
262
+									$data = empty($data) ? __('Not set', 'give') : $data;
263
+									WP_CLI::log($this->color_message($heading, $data));
264 264
 							}
265 265
 						}
266 266
 				}// End switch().
@@ -271,37 +271,37 @@  discard block
 block discarded – undo
271 271
 			$is_table_first_row_set = false;
272 272
 			$table_column_count     = 0;
273 273
 
274
-			WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) );
274
+			WP_CLI::line($this->color_message(sprintf(__('%d donation forms found', 'give'), count($forms['forms'])), '', false));
275 275
 
276
-			foreach ( $forms['forms'] as $index => $form_data ) {
276
+			foreach ($forms['forms'] as $index => $form_data) {
277 277
 
278 278
 				// Default table data.
279 279
 				$table_first_row = array();
280 280
 				$table_row       = array();
281 281
 
282
-				foreach ( $form_data['info'] as $key => $form ) {
282
+				foreach ($form_data['info'] as $key => $form) {
283 283
 
284 284
 					// Do not show thumbnail, content and link in table.
285
-					if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) {
285
+					if (in_array($key, array('content', 'thumbnail', 'link'), true)) {
286 286
 						continue;
287 287
 					}
288 288
 
289
-					if ( ! $is_table_first_row_set ) {
289
+					if ( ! $is_table_first_row_set) {
290 290
 						$table_first_row[] = $key;
291 291
 					}
292 292
 
293 293
 					$table_row[] = $form;
294 294
 
295
-					if ( 'status' === $key ) {
295
+					if ('status' === $key) {
296 296
 						// First array item will be an form id in our case.
297
-						$form = new Give_Donate_Form( absint( $table_row[0] ) );
297
+						$form = new Give_Donate_Form(absint($table_row[0]));
298 298
 
299 299
 						$table_row[] = $form->get_type();
300 300
 					}
301 301
 				}
302 302
 
303 303
 				// Set table first row.
304
-				if ( ! $is_table_first_row_set ) {
304
+				if ( ! $is_table_first_row_set) {
305 305
 
306 306
 					// Add extra column to table.
307 307
 					$table_first_row[] = 'type';
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 				$table_data[] = $table_row;
315 315
 			}// End foreach().
316 316
 
317
-			$this->display_table( $table_data );
317
+			$this->display_table($table_data);
318 318
 		}// End if().
319 319
 	}
320 320
 
@@ -367,37 +367,37 @@  discard block
 block discarded – undo
367 367
 	 *
368 368
 	 * @subcommand    donors
369 369
 	 */
370
-	public function donors( $args, $assoc_args ) {
370
+	public function donors($args, $assoc_args) {
371 371
 		global $wp_query;
372
-		$donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false;
373
-		$email    = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false;
374
-		$name     = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : '';
375
-		$create   = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false;
376
-		$number   = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
377
-		$form_id  = isset( $assoc_args ) && array_key_exists( 'form-id', $assoc_args ) ? $assoc_args['form-id'] : 0;
378
-		$format   = isset( $assoc_args ) && array_key_exists( 'format', $assoc_args ) ? $assoc_args['format'] : 'table';
372
+		$donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false;
373
+		$email    = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false;
374
+		$name     = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : '';
375
+		$create   = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false;
376
+		$number   = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
377
+		$form_id  = isset($assoc_args) && array_key_exists('form-id', $assoc_args) ? $assoc_args['form-id'] : 0;
378
+		$format   = isset($assoc_args) && array_key_exists('format', $assoc_args) ? $assoc_args['format'] : 'table';
379 379
 		$start    = time();
380 380
 
381
-		if ( $create ) {
381
+		if ($create) {
382 382
 			$number = 1;
383 383
 
384
-			if ( isset( $assoc_args['email'] ) && ! is_email( $email ) ) {
385
-				WP_CLI::warning( 'Wrong email address provided.', 'give' );
384
+			if (isset($assoc_args['email']) && ! is_email($email)) {
385
+				WP_CLI::warning('Wrong email address provided.', 'give');
386 386
 
387 387
 				return;
388 388
 			}
389 389
 
390 390
 			// Create one or more donors.
391
-			if ( ! $email ) {
391
+			if ( ! $email) {
392 392
 				// If no email is specified, look to see if we are generating arbitrary donor accounts.
393
-				$number = is_numeric( $create ) ? absint( $create ) : 1;
393
+				$number = is_numeric($create) ? absint($create) : 1;
394 394
 			}
395 395
 
396
-			for ( $i = 0; $i < $number; $i ++ ) {
397
-				if ( ! $email ) {
396
+			for ($i = 0; $i < $number; $i++) {
397
+				if ( ! $email) {
398 398
 
399 399
 					// Generate fake email.
400
-					$email = 'customer-' . uniqid() . '@test.com';
400
+					$email = 'customer-'.uniqid().'@test.com';
401 401
 				}
402 402
 
403 403
 				$args = array(
@@ -405,19 +405,19 @@  discard block
 block discarded – undo
405 405
 					'name'  => $name,
406 406
 				);
407 407
 
408
-				$donor_id = Give()->donors->add( $args );
408
+				$donor_id = Give()->donors->add($args);
409 409
 
410
-				if ( $donor_id ) {
411
-					WP_CLI::line( $this->color_message( sprintf( __( 'Donor #%d created successfully', 'give' ), $donor_id ) ) );
410
+				if ($donor_id) {
411
+					WP_CLI::line($this->color_message(sprintf(__('Donor #%d created successfully', 'give'), $donor_id)));
412 412
 				} else {
413
-					WP_CLI::error( __( 'Failed to create donor', 'give' ) );
413
+					WP_CLI::error(__('Failed to create donor', 'give'));
414 414
 				}
415 415
 
416 416
 				// Reset email to false so it is generated on the next loop (if creating donors).
417 417
 				$email = false;
418 418
 			}
419 419
 
420
-			WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) );
420
+			WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start)));
421 421
 
422 422
 		} else {
423 423
 			// Counter.
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 			 */
432 432
 			// Cache previous number query var.
433 433
 			$is_set_number = $cache_per_page = false;
434
-			if ( isset( $wp_query->query_vars['number'] ) ) {
434
+			if (isset($wp_query->query_vars['number'])) {
435 435
 				$cache_per_page = $wp_query->query_vars['number'];
436 436
 				$is_set_number  = true;
437 437
 			}
@@ -440,24 +440,24 @@  discard block
 block discarded – undo
440 440
 			$wp_query->query_vars['number'] = $number;
441 441
 
442 442
 			// Get donors.
443
-			if ( $form_id ) {
443
+			if ($form_id) {
444 444
 				// @TODO: Allow user to get a list of donors by donation status.
445
-				$donors = $this->get_donors_by_form_id( $form_id );
445
+				$donors = $this->get_donors_by_form_id($form_id);
446 446
 			} else {
447
-				$donors = $this->api->get_donors( $search );
447
+				$donors = $this->api->get_donors($search);
448 448
 			}
449 449
 
450 450
 			// Reset number query var.
451
-			if ( $is_set_number ) {
451
+			if ($is_set_number) {
452 452
 				$wp_query->query_vars['number'] = $cache_per_page;
453 453
 			}
454 454
 
455
-			if ( isset( $donors['error'] ) ) {
456
-				WP_CLI::error( $donors['error'] );
455
+			if (isset($donors['error'])) {
456
+				WP_CLI::error($donors['error']);
457 457
 			}
458 458
 
459
-			if ( empty( $donors ) ) {
460
-				WP_CLI::error( __( 'No donors found.', 'give' ) );
459
+			if (empty($donors)) {
460
+				WP_CLI::error(__('No donors found.', 'give'));
461 461
 
462 462
 				return;
463 463
 			}
@@ -465,24 +465,24 @@  discard block
 block discarded – undo
465 465
 			$table_data             = array();
466 466
 			$is_table_first_row_set = false;
467 467
 
468
-			foreach ( $donors['donors'] as $donor_data ) {
468
+			foreach ($donors['donors'] as $donor_data) {
469 469
 				// Set default table row data.
470
-				$table_first_row = array( __( 's_no', 'give' ) );
471
-				$table_row       = array( self::$counter );
470
+				$table_first_row = array(__('s_no', 'give'));
471
+				$table_row       = array(self::$counter);
472 472
 
473
-				foreach ( $donor_data as $key => $donor ) {
474
-					switch ( $key ) {
473
+				foreach ($donor_data as $key => $donor) {
474
+					switch ($key) {
475 475
 						case 'stats':
476
-							foreach ( $donor as $heading => $data ) {
476
+							foreach ($donor as $heading => $data) {
477 477
 
478 478
 								// Get first row.
479
-								if ( ! $is_table_first_row_set ) {
479
+								if ( ! $is_table_first_row_set) {
480 480
 									$table_first_row[] = $heading;
481 481
 								}
482 482
 
483
-								switch ( $heading ) {
483
+								switch ($heading) {
484 484
 									case 'total_spent':
485
-										$table_row[] = give_currency_filter( $data );
485
+										$table_row[] = give_currency_filter($data);
486 486
 										break;
487 487
 
488 488
 									default:
@@ -493,10 +493,10 @@  discard block
 block discarded – undo
493 493
 
494 494
 						case 'info':
495 495
 						default:
496
-							foreach ( $donor as $heading => $data ) {
496
+							foreach ($donor as $heading => $data) {
497 497
 
498 498
 								// Get first row.
499
-								if ( ! $is_table_first_row_set ) {
499
+								if ( ! $is_table_first_row_set) {
500 500
 									$table_first_row[] = $heading;
501 501
 								}
502 502
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 				}
507 507
 
508 508
 				// Add first row data to table data.
509
-				if ( ! $is_table_first_row_set ) {
509
+				if ( ! $is_table_first_row_set) {
510 510
 					$table_data[]           = $table_first_row;
511 511
 					$is_table_first_row_set = true;
512 512
 				}
@@ -515,44 +515,44 @@  discard block
 block discarded – undo
515 515
 				$table_data[] = $table_row;
516 516
 
517 517
 				// Increase counter.
518
-				self::$counter ++;
518
+				self::$counter++;
519 519
 			}// End foreach().
520 520
 
521
-			switch ( $format ) {
521
+			switch ($format) {
522 522
 				case 'json':
523 523
 					$table_column_name = $table_data[0];
524
-					unset( $table_data[0] );
524
+					unset($table_data[0]);
525 525
 
526 526
 					$new_table_data = array();
527
-					foreach ( $table_data as $index => $data ) {
528
-						foreach ( $data as $key => $value ) {
529
-							$new_table_data[ $index ][ $table_column_name[ $key ] ] = $value;
527
+					foreach ($table_data as $index => $data) {
528
+						foreach ($data as $key => $value) {
529
+							$new_table_data[$index][$table_column_name[$key]] = $value;
530 530
 						}
531 531
 					}
532 532
 
533
-					WP_CLI::log( json_encode( $new_table_data ) );
533
+					WP_CLI::log(json_encode($new_table_data));
534 534
 					break;
535 535
 
536 536
 				case 'csv':
537
-					$file_path = trailingslashit( WP_CONTENT_DIR ) . 'uploads/give_donors_' . date( 'Y_m_d_s', current_time( 'timestamp' ) ) . '.csv';
538
-					$fp        = fopen( $file_path, 'w' );
537
+					$file_path = trailingslashit(WP_CONTENT_DIR).'uploads/give_donors_'.date('Y_m_d_s', current_time('timestamp')).'.csv';
538
+					$fp        = fopen($file_path, 'w');
539 539
 
540
-					if ( is_writable( $file_path ) ) {
541
-						foreach ( $table_data as $fields ) {
542
-							fputcsv( $fp, $fields );
540
+					if (is_writable($file_path)) {
541
+						foreach ($table_data as $fields) {
542
+							fputcsv($fp, $fields);
543 543
 						}
544 544
 
545
-						fclose( $fp );
545
+						fclose($fp);
546 546
 
547
-						WP_CLI::success( "Donors list csv created successfully: {$file_path}" );
547
+						WP_CLI::success("Donors list csv created successfully: {$file_path}");
548 548
 					} else {
549
-						WP_CLI::warning( "Unable to create donors list csv file: {$file_path} (May folder do not have write permission)" );
549
+						WP_CLI::warning("Unable to create donors list csv file: {$file_path} (May folder do not have write permission)");
550 550
 					}
551 551
 
552 552
 					break;
553 553
 
554 554
 				default:
555
-					$this->display_table( $table_data );
555
+					$this->display_table($table_data);
556 556
 			}// End switch().
557 557
 		}// End if().
558 558
 	}
@@ -582,13 +582,13 @@  discard block
 block discarded – undo
582 582
 	 *
583 583
 	 * @subcommand    donations
584 584
 	 */
585
-	public function donations( $args, $assoc_args ) {
585
+	public function donations($args, $assoc_args) {
586 586
 		global $wp_query;
587
-		$number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10;
587
+		$number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10;
588 588
 
589 589
 		// Cache previous number query var.
590 590
 		$is_set_number = $cache_per_page = false;
591
-		if ( isset( $wp_query->query_vars['number'] ) ) {
591
+		if (isset($wp_query->query_vars['number'])) {
592 592
 			$cache_per_page = $wp_query->query_vars['number'];
593 593
 			$is_set_number  = true;
594 594
 		}
@@ -600,46 +600,46 @@  discard block
 block discarded – undo
600 600
 		$donations = $this->api->get_recent_donations();
601 601
 
602 602
 		// Reset number query var.
603
-		if ( $is_set_number ) {
603
+		if ($is_set_number) {
604 604
 			$wp_query->query_vars['number'] = $cache_per_page;
605 605
 		}
606 606
 
607
-		if ( empty( $donations ) ) {
608
-			WP_CLI::error( __( 'No donations found.', 'give' ) );
607
+		if (empty($donations)) {
608
+			WP_CLI::error(__('No donations found.', 'give'));
609 609
 
610 610
 			return;
611 611
 		}
612 612
 
613 613
 		self::$counter = 1;
614 614
 
615
-		foreach ( $donations['donations'] as $key => $donation ) {
616
-			$this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' );
617
-			self::$counter ++;
615
+		foreach ($donations['donations'] as $key => $donation) {
616
+			$this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y');
617
+			self::$counter++;
618 618
 
619
-			foreach ( $donation as $column => $data ) {
619
+			foreach ($donation as $column => $data) {
620 620
 
621
-				if ( is_array( $data ) ) {
622
-					$this->color_sub_heading( $column );
623
-					foreach ( $data as $subcolumn => $subdata ) {
621
+				if (is_array($data)) {
622
+					$this->color_sub_heading($column);
623
+					foreach ($data as $subcolumn => $subdata) {
624 624
 
625 625
 						// Decode html codes.
626
-						switch ( $subcolumn ) {
626
+						switch ($subcolumn) {
627 627
 							case 'name':
628
-								$subdata = html_entity_decode( $subdata );
628
+								$subdata = html_entity_decode($subdata);
629 629
 								break;
630 630
 						}
631 631
 
632 632
 						// @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta.
633
-						if ( is_array( $subdata ) ) {
633
+						if (is_array($subdata)) {
634 634
 							continue;
635 635
 						}
636 636
 
637
-						WP_CLI::log( $this->color_message( $subcolumn, $subdata ) );
637
+						WP_CLI::log($this->color_message($subcolumn, $subdata));
638 638
 					}
639 639
 					continue;
640 640
 				}
641 641
 
642
-				WP_CLI::log( $this->color_message( $column, $data ) );
642
+				WP_CLI::log($this->color_message($column, $data));
643 643
 			}
644 644
 		}
645 645
 	}
@@ -679,27 +679,27 @@  discard block
 block discarded – undo
679 679
 	 *
680 680
 	 * @return        void
681 681
 	 */
682
-	public function report( $args, $assoc_args ) {
682
+	public function report($args, $assoc_args) {
683 683
 		$stats      = new Give_Payment_Stats();
684
-		$date       = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false;
685
-		$start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false;
686
-		$end_date   = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false;
687
-		$form_id    = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0;
684
+		$date       = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false;
685
+		$start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false;
686
+		$end_date   = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false;
687
+		$form_id    = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0;
688 688
 
689
-		if ( ! empty( $date ) ) {
689
+		if ( ! empty($date)) {
690 690
 			$start_date = $date;
691 691
 			$end_date   = false;
692
-		} elseif ( empty( $date ) && empty( $start_date ) ) {
692
+		} elseif (empty($date) && empty($start_date)) {
693 693
 			$start_date = 'this_month';
694 694
 			$end_date   = false;
695 695
 		}
696 696
 
697 697
 		// Get stats.
698
-		$earnings = $stats->get_earnings( $form_id, $start_date, $end_date );
699
-		$sales    = $stats->get_sales( $form_id, $start_date, $end_date );
698
+		$earnings = $stats->get_earnings($form_id, $start_date, $end_date);
699
+		$sales    = $stats->get_sales($form_id, $start_date, $end_date);
700 700
 
701
-		WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings ) ) );
702
-		WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) );
701
+		WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings)));
702
+		WP_CLI::line($this->color_message(__('Sales', 'give'), $sales));
703 703
 	}
704 704
 
705 705
 
@@ -726,27 +726,27 @@  discard block
 block discarded – undo
726 726
 	 *
727 727
 	 * @subcommand    cache
728 728
 	 */
729
-	public function cache( $args, $assoc_args ) {
730
-		$action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false;
729
+	public function cache($args, $assoc_args) {
730
+		$action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false;
731 731
 
732 732
 		// Bailout.
733
-		if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) {
734
-			WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) );
733
+		if ( ! $action || ! in_array($action, array('delete'), true)) {
734
+			WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give'));
735 735
 
736 736
 			return;
737 737
 		}
738 738
 
739
-		switch ( $action ) {
739
+		switch ($action) {
740 740
 			case 'delete' :
741 741
 				// Reset counter.
742 742
 				self::$counter = 1;
743 743
 
744
-				if ( $this->delete_stats_transients() ) {
744
+				if ($this->delete_stats_transients()) {
745 745
 					// Report .eading.
746
-					WP_CLI::success( 'Give cache deleted.' );
746
+					WP_CLI::success('Give cache deleted.');
747 747
 				} else {
748 748
 					// Report .eading.
749
-					WP_CLI::warning( 'We did not find any Give plugin cache to delete :)' );
749
+					WP_CLI::warning('We did not find any Give plugin cache to delete :)');
750 750
 				}
751 751
 				break;
752 752
 		}
@@ -775,27 +775,27 @@  discard block
 block discarded – undo
775 775
 			ARRAY_A
776 776
 		);
777 777
 
778
-		if ( ! empty( $stat_option_names ) ) {
778
+		if ( ! empty($stat_option_names)) {
779 779
 
780
-			foreach ( $stat_option_names as $option_name ) {
780
+			foreach ($stat_option_names as $option_name) {
781 781
 				$error       = false;
782 782
 				$option_name = $option_name['option_name'];
783 783
 
784
-				switch ( true ) {
785
-					case ( false !== strpos( $option_name, 'transient' ) ):
786
-						$option_name = str_replace( '_transient_', '', $option_name );
787
-						$error       = delete_transient( $option_name );
784
+				switch (true) {
785
+					case (false !== strpos($option_name, 'transient')):
786
+						$option_name = str_replace('_transient_', '', $option_name);
787
+						$error       = delete_transient($option_name);
788 788
 						break;
789 789
 
790 790
 					default:
791
-						$error = delete_option( $option_name );
791
+						$error = delete_option($option_name);
792 792
 				}
793 793
 
794
-				if ( $error ) {
795
-					WP_CLI::log( $this->color_message( self::$counter, $option_name ) );
796
-					self::$counter ++;
794
+				if ($error) {
795
+					WP_CLI::log($this->color_message(self::$counter, $option_name));
796
+					self::$counter++;
797 797
 				} else {
798
-					WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) );
798
+					WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name));
799 799
 				}
800 800
 			}
801 801
 
@@ -816,13 +816,13 @@  discard block
 block discarded – undo
816 816
 	 *
817 817
 	 * @return   string
818 818
 	 */
819
-	private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) {
819
+	private function color_message($heading, $message = '', $colon = true, $color = 'g') {
820 820
 		// Add colon.
821
-		if ( $colon ) {
822
-			$heading = $heading . ': ';
821
+		if ($colon) {
822
+			$heading = $heading.': ';
823 823
 		}
824 824
 
825
-		return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message;
825
+		return WP_CLI::colorize("%{$color}".$heading.'%n').$message;
826 826
 	}
827 827
 
828 828
 
@@ -837,8 +837,8 @@  discard block
 block discarded – undo
837 837
 	 *
838 838
 	 * @return    void
839 839
 	 */
840
-	private function color_main_heading( $heading, $color = 'g' ) {
841
-		WP_CLI::log( "\n######   " . $this->color_message( $heading, '', false, $color ) . '   ######' );
840
+	private function color_main_heading($heading, $color = 'g') {
841
+		WP_CLI::log("\n######   ".$this->color_message($heading, '', false, $color).'   ######');
842 842
 	}
843 843
 
844 844
 	/**
@@ -851,8 +851,8 @@  discard block
 block discarded – undo
851 851
 	 *
852 852
 	 * @return    void
853 853
 	 */
854
-	private function color_sub_heading( $subheading ) {
855
-		WP_CLI::log( "\n--->" . $subheading . '', '', false );
854
+	private function color_sub_heading($subheading) {
855
+		WP_CLI::log("\n--->".$subheading.'', '', false);
856 856
 	}
857 857
 
858 858
 
@@ -866,17 +866,17 @@  discard block
 block discarded – undo
866 866
 	 *
867 867
 	 * @return    void
868 868
 	 */
869
-	private function display_table( $data ) {
869
+	private function display_table($data) {
870 870
 		$table = new \cli\Table();
871 871
 
872 872
 		// Set table header.
873
-		$table->setHeaders( $data[0] );
873
+		$table->setHeaders($data[0]);
874 874
 
875 875
 		// Remove table header.
876
-		unset( $data[0] );
876
+		unset($data[0]);
877 877
 
878 878
 		// Set table data.
879
-		$table->setRows( $data );
879
+		$table->setRows($data);
880 880
 
881 881
 		// Display table.
882 882
 		$table->display();
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
 	 * @return array
894 894
 	 */
895 895
 
896
-	private function get_donors_by_form_id( $form_id ) {
896
+	private function get_donors_by_form_id($form_id) {
897 897
 		$donors = array();
898 898
 
899 899
 		$donations = new Give_Payments_Query(
900 900
 			array(
901
-				'give_forms' => array( $form_id ),
902
-				'number'     => - 1,
903
-				'status'     => array( 'publish' ),
901
+				'give_forms' => array($form_id),
902
+				'number'     => -1,
903
+				'status'     => array('publish'),
904 904
 			)
905 905
 		);
906 906
 
@@ -908,16 +908,16 @@  discard block
 block discarded – undo
908 908
 		$skip_donors = array();
909 909
 
910 910
 		/* @var Give_Payment|object $donation Payment object. */
911
-		foreach ( $donations as $donation ) {
911
+		foreach ($donations as $donation) {
912 912
 
913
-			if ( in_array( $donation->customer_id, $skip_donors ,true ) ) {
913
+			if (in_array($donation->customer_id, $skip_donors, true)) {
914 914
 				continue;
915 915
 			}
916 916
 
917
-			if ( ! empty( $donors ) ) {
918
-				$donors['donors'][] = current( current( $this->api->get_donors( (int) $donation->customer_id ) ) );
917
+			if ( ! empty($donors)) {
918
+				$donors['donors'][] = current(current($this->api->get_donors((int) $donation->customer_id)));
919 919
 			} else {
920
-				$donors = array_merge( $donors, $this->api->get_donors( (int) $donation->customer_id ) );
920
+				$donors = array_merge($donors, $this->api->get_donors((int) $donation->customer_id));
921 921
 			}
922 922
 
923 923
 			$skip_donors[] = $donation->customer_id;
Please login to merge, or discard this patch.