Test Failed
Push — master ( f5256c...25a383 )
by Devin
07:02
created
includes/shortcodes.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -789,7 +789,7 @@
 block discarded – undo
789 789
  * @type string $display_style       How the form is displayed, either in new page or modal popup.
790 790
  *                                       Default 'redirect'. Accepts 'redirect', 'modal'.
791 791
  * }
792
- * @return string|bool The markup of the form grid or false.
792
+ * @return string|null The markup of the form grid or false.
793 793
  */
794 794
 function give_form_grid_shortcode( $atts ) {
795 795
 
Please login to merge, or discard this patch.
Spacing   +213 added lines, -213 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,42 +26,42 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return string|bool
28 28
  */
29
-function give_donation_history( $atts, $content = false ) {
29
+function give_donation_history($atts, $content = false) {
30 30
 
31
-	$donation_history_args = shortcode_atts( array(
31
+	$donation_history_args = shortcode_atts(array(
32 32
 		'id'             => true,
33 33
 		'date'           => true,
34 34
 		'donor'          => false,
35 35
 		'amount'         => true,
36 36
 		'status'         => false,
37 37
 		'payment_method' => false,
38
-	), $atts, 'donation_history' );
38
+	), $atts, 'donation_history');
39 39
 
40 40
 	// Always show receipt link.
41 41
 	$donation_history_args['details'] = true;
42 42
 
43 43
 	// Set Donation History Shortcode Arguments in session variable.
44
-	Give()->session->set( 'give_donation_history_args', $donation_history_args );
44
+	Give()->session->set('give_donation_history_args', $donation_history_args);
45 45
 
46 46
 	// If payment_key query arg exists, return receipt instead of donation history.
47
-	if ( isset( $_GET['payment_key'] ) ) {
47
+	if (isset($_GET['payment_key'])) {
48 48
 		ob_start();
49 49
 
50
-		echo give_receipt_shortcode( array() );
50
+		echo give_receipt_shortcode(array());
51 51
 
52 52
 		// Display donation history link only if Receipt Access Session is available.
53
-		if ( give_get_receipt_session() ) {
53
+		if (give_get_receipt_session()) {
54 54
 			echo sprintf(
55 55
 				'<a href="%s">%s</a>',
56
-				esc_url( give_get_history_page_uri() ),
57
-				__( '&laquo; Return to All Donations', 'give' )
56
+				esc_url(give_get_history_page_uri()),
57
+				__('&laquo; Return to All Donations', 'give')
58 58
 			);
59 59
 		}
60 60
 
61 61
 		return ob_get_clean();
62 62
 	}
63 63
 
64
-	$email_access = give_get_option( 'email_access' );
64
+	$email_access = give_get_option('email_access');
65 65
 
66 66
 	ob_start();
67 67
 
@@ -74,23 +74,23 @@  discard block
 block discarded – undo
74 74
 	if (
75 75
 		is_user_logged_in()
76 76
 		|| false !== Give()->session->get_session_expiration()
77
-		|| ( give_is_setting_enabled( $email_access ) && Give()->email_access->token_exists )
77
+		|| (give_is_setting_enabled($email_access) && Give()->email_access->token_exists)
78 78
 		|| true === give_get_history_session()
79 79
 	) {
80
-		give_get_template_part( 'history', 'donations' );
80
+		give_get_template_part('history', 'donations');
81 81
 
82
-		if ( ! empty( $content ) ) {
83
-			echo do_shortcode( $content );
82
+		if ( ! empty($content)) {
83
+			echo do_shortcode($content);
84 84
 		}
85 85
 
86
-	} elseif ( give_is_setting_enabled( $email_access ) ) {
86
+	} elseif (give_is_setting_enabled($email_access)) {
87 87
 		// Is Email-based access enabled?
88
-		give_get_template_part( 'email', 'login-form' );
88
+		give_get_template_part('email', 'login-form');
89 89
 
90 90
 	} else {
91 91
 
92
-		echo apply_filters( 'give_donation_history_nonuser_message', Give()->notices->print_frontend_notice( __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ), false ) );
93
-		echo do_shortcode( '[give_login]' );
92
+		echo apply_filters('give_donation_history_nonuser_message', Give()->notices->print_frontend_notice(__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'), false));
93
+		echo do_shortcode('[give_login]');
94 94
 	}
95 95
 
96 96
 	/**
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return string HTML content
106 106
 	 */
107
-	return apply_filters( 'give_donation_history_shortcode_html', ob_get_clean(), $atts, $content );
107
+	return apply_filters('give_donation_history_shortcode_html', ob_get_clean(), $atts, $content);
108 108
 }
109 109
 
110
-add_shortcode( 'donation_history', 'give_donation_history' );
110
+add_shortcode('donation_history', 'give_donation_history');
111 111
 
112 112
 /**
113 113
  * Donation Form Shortcode
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string
122 122
  */
123
-function give_form_shortcode( $atts ) {
124
-	$atts = shortcode_atts( array(
123
+function give_form_shortcode($atts) {
124
+	$atts = shortcode_atts(array(
125 125
 		'id'                    => '',
126 126
 		'show_title'            => true,
127 127
 		'show_goal'             => true,
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
 		'float_labels'          => '',
130 130
 		'display_style'         => '',
131 131
 		'continue_button_title' => '',
132
-	), $atts, 'give_form' );
132
+	), $atts, 'give_form');
133 133
 
134 134
 	// Convert string to bool.
135
-	$atts['show_title'] = filter_var( $atts['show_title'], FILTER_VALIDATE_BOOLEAN );
136
-	$atts['show_goal']  = filter_var( $atts['show_goal'], FILTER_VALIDATE_BOOLEAN );
135
+	$atts['show_title'] = filter_var($atts['show_title'], FILTER_VALIDATE_BOOLEAN);
136
+	$atts['show_goal']  = filter_var($atts['show_goal'], FILTER_VALIDATE_BOOLEAN);
137 137
 
138 138
 	// get the Give Form
139 139
 	ob_start();
140
-	give_get_donation_form( $atts );
140
+	give_get_donation_form($atts);
141 141
 	$final_output = ob_get_clean();
142 142
 
143
-	return apply_filters( 'give_donate_form', $final_output, $atts );
143
+	return apply_filters('give_donate_form', $final_output, $atts);
144 144
 }
145 145
 
146
-add_shortcode( 'give_form', 'give_form_shortcode' );
146
+add_shortcode('give_form', 'give_form_shortcode');
147 147
 
148 148
 /**
149 149
  * Donation Form Goal Shortcode.
@@ -156,36 +156,36 @@  discard block
 block discarded – undo
156 156
  *
157 157
  * @return string
158 158
  */
159
-function give_goal_shortcode( $atts ) {
160
-	$atts = shortcode_atts( array(
159
+function give_goal_shortcode($atts) {
160
+	$atts = shortcode_atts(array(
161 161
 		'id'        => '',
162 162
 		'show_text' => true,
163 163
 		'show_bar'  => true,
164
-	), $atts, 'give_goal' );
164
+	), $atts, 'give_goal');
165 165
 
166 166
 	// get the Give Form.
167 167
 	ob_start();
168 168
 
169 169
 	// Sanity check 1: ensure there is an ID Provided.
170
-	if ( empty( $atts['id'] ) ) {
171
-		Give()->notices->print_frontend_notice( __( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true );
170
+	if (empty($atts['id'])) {
171
+		Give()->notices->print_frontend_notice(__('The shortcode is missing Donation Form ID attribute.', 'give'), true);
172 172
 	}
173 173
 
174 174
 	// Sanity check 2: Check the form even has Goals enabled.
175
-	if ( ! give_is_setting_enabled( give_get_meta( $atts['id'], '_give_goal_option', true ) ) ) {
175
+	if ( ! give_is_setting_enabled(give_get_meta($atts['id'], '_give_goal_option', true))) {
176 176
 
177
-		Give()->notices->print_frontend_notice( __( 'The form does not have Goals enabled.', 'give' ), true );
177
+		Give()->notices->print_frontend_notice(__('The form does not have Goals enabled.', 'give'), true);
178 178
 	} else {
179 179
 		// Passed all sanity checks: output Goal.
180
-		give_show_goal_progress( $atts['id'], $atts );
180
+		give_show_goal_progress($atts['id'], $atts);
181 181
 	}
182 182
 
183 183
 	$final_output = ob_get_clean();
184 184
 
185
-	return apply_filters( 'give_goal_shortcode_output', $final_output, $atts );
185
+	return apply_filters('give_goal_shortcode_output', $final_output, $atts);
186 186
 }
187 187
 
188
-add_shortcode( 'give_goal', 'give_goal_shortcode' );
188
+add_shortcode('give_goal', 'give_goal_shortcode');
189 189
 
190 190
 
191 191
 /**
@@ -202,22 +202,22 @@  discard block
 block discarded – undo
202 202
  *
203 203
  * @return string
204 204
  */
205
-function give_login_form_shortcode( $atts ) {
205
+function give_login_form_shortcode($atts) {
206 206
 
207
-	$atts = shortcode_atts( array(
207
+	$atts = shortcode_atts(array(
208 208
 		// Add backward compatibility for redirect attribute.
209 209
 		'redirect'        => '',
210 210
 		'login-redirect'  => '',
211 211
 		'logout-redirect' => '',
212
-	), $atts, 'give_login' );
212
+	), $atts, 'give_login');
213 213
 
214 214
 	// Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
215
-	$atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' );
215
+	$atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : '');
216 216
 
217
-	return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] );
217
+	return give_login_form($atts['login-redirect'], $atts['logout-redirect']);
218 218
 }
219 219
 
220
-add_shortcode( 'give_login', 'give_login_form_shortcode' );
220
+add_shortcode('give_login', 'give_login_form_shortcode');
221 221
 
222 222
 /**
223 223
  * Register Shortcode.
@@ -232,15 +232,15 @@  discard block
 block discarded – undo
232 232
  *
233 233
  * @return string
234 234
  */
235
-function give_register_form_shortcode( $atts ) {
236
-	$atts = shortcode_atts( array(
235
+function give_register_form_shortcode($atts) {
236
+	$atts = shortcode_atts(array(
237 237
 		'redirect' => '',
238
-	), $atts, 'give_register' );
238
+	), $atts, 'give_register');
239 239
 
240
-	return give_register_form( $atts['redirect'] );
240
+	return give_register_form($atts['redirect']);
241 241
 }
242 242
 
243
-add_shortcode( 'give_register', 'give_register_form_shortcode' );
243
+add_shortcode('give_register', 'give_register_form_shortcode');
244 244
 
245 245
 /**
246 246
  * Receipt Shortcode.
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string
255 255
  */
256
-function give_receipt_shortcode( $atts ) {
256
+function give_receipt_shortcode($atts) {
257 257
 
258 258
 	global $give_receipt_args;
259 259
 
260
-	$give_receipt_args = shortcode_atts( array(
261
-		'error'          => __( 'You are missing the payment key to view this donation receipt.', 'give' ),
260
+	$give_receipt_args = shortcode_atts(array(
261
+		'error'          => __('You are missing the payment key to view this donation receipt.', 'give'),
262 262
 		'price'          => true,
263 263
 		'donor'          => true,
264 264
 		'date'           => true,
@@ -268,16 +268,16 @@  discard block
 block discarded – undo
268 268
 		'payment_status' => false,
269 269
 		'company_name'   => false,
270 270
 		'status_notice'  => true,
271
-	), $atts, 'give_receipt' );
271
+	), $atts, 'give_receipt');
272 272
 
273
-	if( ! wp_doing_ajax() ) {
273
+	if ( ! wp_doing_ajax()) {
274 274
 		ob_start();
275
-		give_get_template_part( 'receipt/placeholder' );
275
+		give_get_template_part('receipt/placeholder');
276 276
 		$placeholder = ob_get_clean();
277 277
 
278 278
 		return sprintf(
279 279
 			'<div id="give-receipt" data-shortcode="%s">%s</div>',
280
-			urlencode_deep( wp_json_encode( $atts ) ),
280
+			urlencode_deep(wp_json_encode($atts)),
281 281
 			$placeholder
282 282
 		);
283 283
 	}
@@ -286,43 +286,43 @@  discard block
 block discarded – undo
286 286
 	$session = give_get_purchase_session();
287 287
 
288 288
 	// set payment key var
289
-	if ( isset( $_GET['payment_key'] ) ) {
290
-		$payment_key = urldecode( $_GET['payment_key'] );
291
-	} elseif ( $session ) {
289
+	if (isset($_GET['payment_key'])) {
290
+		$payment_key = urldecode($_GET['payment_key']);
291
+	} elseif ($session) {
292 292
 		$payment_key = $session['purchase_key'];
293
-	} elseif ( $give_receipt_args['payment_key'] ) {
293
+	} elseif ($give_receipt_args['payment_key']) {
294 294
 		$payment_key = $give_receipt_args['payment_key'];
295 295
 	}
296 296
 
297
-	$email_access = give_get_option( 'email_access' );
297
+	$email_access = give_get_option('email_access');
298 298
 
299 299
 	// No payment_key found & Email Access is Turned on.
300
-	if ( ! isset( $payment_key ) && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
300
+	if ( ! isset($payment_key) && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
301 301
 
302 302
 		ob_start();
303 303
 
304
-		give_get_template_part( 'email-login-form' );
304
+		give_get_template_part('email-login-form');
305 305
 
306 306
 		return ob_get_clean();
307 307
 
308
-	} elseif ( ! isset( $payment_key ) ) {
308
+	} elseif ( ! isset($payment_key)) {
309 309
 
310
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
310
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
311 311
 
312 312
 	}
313 313
 
314
-	$user_can_view = give_can_view_receipt( $payment_key );
314
+	$user_can_view = give_can_view_receipt($payment_key);
315 315
 
316 316
 	// Key was provided, but user is logged out. Offer them the ability to login and view the receipt.
317
-	if ( ! $user_can_view && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
317
+	if ( ! $user_can_view && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
318 318
 
319 319
 		ob_start();
320 320
 
321
-		give_get_template_part( 'email-login-form' );
321
+		give_get_template_part('email-login-form');
322 322
 
323 323
 		return ob_get_clean();
324 324
 
325
-	} elseif ( ! $user_can_view ) {
325
+	} elseif ( ! $user_can_view) {
326 326
 
327 327
 		global $give_login_redirect;
328 328
 
@@ -330,9 +330,9 @@  discard block
 block discarded – undo
330 330
 
331 331
 		ob_start();
332 332
 
333
-		Give()->notices->print_frontend_notice( apply_filters( 'give_must_be_logged_in_error_message', __( 'You must be logged in to view this donation receipt.', 'give' ) ) );
333
+		Give()->notices->print_frontend_notice(apply_filters('give_must_be_logged_in_error_message', __('You must be logged in to view this donation receipt.', 'give')));
334 334
 
335
-		give_get_template_part( 'shortcode', 'login' );
335
+		give_get_template_part('shortcode', 'login');
336 336
 
337 337
 		$login_form = ob_get_clean();
338 338
 
@@ -346,20 +346,20 @@  discard block
 block discarded – undo
346 346
 	 * or if user is logged out and donation was made as a guest, the donation session is checked for
347 347
 	 * or if user is logged in and the user can view sensitive shop data.
348 348
 	 */
349
-	if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) {
350
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
349
+	if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) {
350
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
351 351
 	}
352 352
 
353 353
 	ob_start();
354 354
 
355
-	give_get_template_part( 'shortcode', 'receipt' );
355
+	give_get_template_part('shortcode', 'receipt');
356 356
 
357 357
 	$display = ob_get_clean();
358 358
 
359 359
 	return $display;
360 360
 }
361 361
 
362
-add_shortcode( 'give_receipt', 'give_receipt_shortcode' );
362
+add_shortcode('give_receipt', 'give_receipt_shortcode');
363 363
 
364 364
 /**
365 365
  * Profile Editor Shortcode.
@@ -378,26 +378,26 @@  discard block
 block discarded – undo
378 378
  *
379 379
  * @return string Output generated from the profile editor
380 380
  */
381
-function give_profile_editor_shortcode( $atts ) {
381
+function give_profile_editor_shortcode($atts) {
382 382
 
383 383
 	ob_start();
384 384
 
385 385
 	// Restrict access to donor profile, if donor and user are disconnected.
386
-	$is_donor_disconnected = get_user_meta( get_current_user_id(), '_give_is_donor_disconnected', true );
387
-	if ( is_user_logged_in() && $is_donor_disconnected ) {
388
-		Give()->notices->print_frontend_notice( __( 'Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give' ), true, 'error' );
386
+	$is_donor_disconnected = get_user_meta(get_current_user_id(), '_give_is_donor_disconnected', true);
387
+	if (is_user_logged_in() && $is_donor_disconnected) {
388
+		Give()->notices->print_frontend_notice(__('Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give'), true, 'error');
389 389
 
390 390
 		return false;
391 391
 	}
392 392
 
393
-	give_get_template_part( 'shortcode', 'profile-editor' );
393
+	give_get_template_part('shortcode', 'profile-editor');
394 394
 
395 395
 	$display = ob_get_clean();
396 396
 
397 397
 	return $display;
398 398
 }
399 399
 
400
-add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' );
400
+add_shortcode('give_profile_editor', 'give_profile_editor_shortcode');
401 401
 
402 402
 /**
403 403
  * Process Profile Updater Form.
@@ -410,31 +410,31 @@  discard block
 block discarded – undo
410 410
  *
411 411
  * @return bool
412 412
  */
413
-function give_process_profile_editor_updates( $data ) {
413
+function give_process_profile_editor_updates($data) {
414 414
 	// Profile field change request.
415
-	if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) {
415
+	if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) {
416 416
 		return false;
417 417
 	}
418 418
 
419 419
 	// Nonce security.
420
-	if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) {
420
+	if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) {
421 421
 		return false;
422 422
 	}
423 423
 
424 424
 	$user_id       = get_current_user_id();
425
-	$old_user_data = get_userdata( $user_id );
425
+	$old_user_data = get_userdata($user_id);
426 426
 
427 427
 	/* @var Give_Donor $donor */
428
-	$donor            = new Give_Donor( $user_id, true );
428
+	$donor            = new Give_Donor($user_id, true);
429 429
 	$old_company_name = $donor->get_company_name();
430 430
 
431
-	$display_name     = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name;
432
-	$first_name       = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name;
433
-	$last_name        = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name;
434
-	$company_name     = ! empty( $data['give_company_name'] ) ? sanitize_text_field( $data['give_company_name'] ) : $old_company_name;
435
-	$email            = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email;
436
-	$password         = ! empty( $data['give_new_user_pass1'] ) ? $data['give_new_user_pass1'] : '';
437
-	$confirm_password = ! empty( $data['give_new_user_pass2'] ) ? $data['give_new_user_pass2'] : '';
431
+	$display_name     = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name;
432
+	$first_name       = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name;
433
+	$last_name        = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name;
434
+	$company_name     = ! empty($data['give_company_name']) ? sanitize_text_field($data['give_company_name']) : $old_company_name;
435
+	$email            = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email;
436
+	$password         = ! empty($data['give_new_user_pass1']) ? $data['give_new_user_pass1'] : '';
437
+	$confirm_password = ! empty($data['give_new_user_pass2']) ? $data['give_new_user_pass2'] : '';
438 438
 
439 439
 	$userdata = array(
440 440
 		'ID'           => $user_id,
@@ -454,60 +454,60 @@  discard block
 block discarded – undo
454 454
 	 * @param int   $user_id  The ID of the user.
455 455
 	 * @param array $userdata User info, including ID, first name, last name, display name and email.
456 456
 	 */
457
-	do_action( 'give_pre_update_user_profile', $user_id, $userdata );
457
+	do_action('give_pre_update_user_profile', $user_id, $userdata);
458 458
 
459 459
 	// Make sure to validate first name of existing donors.
460
-	if ( empty( $first_name ) ) {
460
+	if (empty($first_name)) {
461 461
 		// Empty First Name.
462
-		give_set_error( 'empty_first_name', __( 'Please enter your first name.', 'give' ) );
462
+		give_set_error('empty_first_name', __('Please enter your first name.', 'give'));
463 463
 	}
464 464
 
465 465
 	// Make sure to validate passwords for existing Donors.
466
-	give_validate_user_password( $password, $confirm_password );
466
+	give_validate_user_password($password, $confirm_password);
467 467
 
468
-	if ( empty( $email ) ) {
468
+	if (empty($email)) {
469 469
 		// Make sure email should not be empty.
470
-		give_set_error( 'email_empty', __( 'The email you entered is empty.', 'give' ) );
470
+		give_set_error('email_empty', __('The email you entered is empty.', 'give'));
471 471
 
472
-	} elseif ( ! is_email( $email ) ) {
472
+	} elseif ( ! is_email($email)) {
473 473
 		// Make sure email should be valid.
474
-		give_set_error( 'email_not_valid', __( 'The email you entered is not valid. Please use another', 'give' ) );
474
+		give_set_error('email_not_valid', __('The email you entered is not valid. Please use another', 'give'));
475 475
 
476
-	} elseif ( $email != $old_user_data->user_email ) {
476
+	} elseif ($email != $old_user_data->user_email) {
477 477
 		// Make sure the new email doesn't belong to another user.
478
-		if ( email_exists( $email ) ) {
479
-			give_set_error( 'user_email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) );
480
-		} elseif ( Give()->donors->get_donor_by( 'email', $email ) ) {
478
+		if (email_exists($email)) {
479
+			give_set_error('user_email_exists', __('The email you entered belongs to another user. Please use another.', 'give'));
480
+		} elseif (Give()->donors->get_donor_by('email', $email)) {
481 481
 			// Make sure the new email doesn't belong to another user.
482
-			give_set_error( 'donor_email_exists', __( 'The email you entered belongs to another donor. Please use another.', 'give' ) );
482
+			give_set_error('donor_email_exists', __('The email you entered belongs to another donor. Please use another.', 'give'));
483 483
 		}
484 484
 	}
485 485
 
486 486
 	// Check for errors.
487 487
 	$errors = give_get_errors();
488 488
 
489
-	if ( $errors ) {
489
+	if ($errors) {
490 490
 		// Send back to the profile editor if there are errors.
491
-		wp_redirect( $data['give_redirect'] );
491
+		wp_redirect($data['give_redirect']);
492 492
 		give_die();
493 493
 	}
494 494
 
495 495
 	// Update Donor First Name and Last Name.
496
-	Give()->donors->update( $donor->id, array(
497
-		'name' => trim( "{$first_name} {$last_name}" ),
498
-	) );
499
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_first_name', $first_name );
500
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_last_name', $last_name );
501
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_company', $company_name );
496
+	Give()->donors->update($donor->id, array(
497
+		'name' => trim("{$first_name} {$last_name}"),
498
+	));
499
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_first_name', $first_name);
500
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_last_name', $last_name);
501
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_company', $company_name);
502 502
 
503 503
 	$current_user = wp_get_current_user();
504 504
 
505 505
 	// Compares new values with old values to detect change in values.
506
-	$email_update        = ( $email !== $current_user->user_email ) ? true : false;
507
-	$display_name_update = ( $display_name !== $current_user->display_name ) ? true : false;
508
-	$first_name_update   = ( $first_name !== $current_user->first_name ) ? true : false;
509
-	$last_name_update    = ( $last_name !== $current_user->last_name ) ? true : false;
510
-	$company_name_update = ( $company_name !== $old_company_name ) ? true : false;
506
+	$email_update        = ($email !== $current_user->user_email) ? true : false;
507
+	$display_name_update = ($display_name !== $current_user->display_name) ? true : false;
508
+	$first_name_update   = ($first_name !== $current_user->first_name) ? true : false;
509
+	$last_name_update    = ($last_name !== $current_user->last_name) ? true : false;
510
+	$company_name_update = ($company_name !== $old_company_name) ? true : false;
511 511
 	$update_code         = 0;
512 512
 
513 513
 	/**
@@ -515,35 +515,35 @@  discard block
 block discarded – undo
515 515
 	 *
516 516
 	 * @var boolean
517 517
 	 */
518
-	$profile_update = ( $email_update || $display_name_update || $first_name_update || $last_name_update || $company_name_update );
518
+	$profile_update = ($email_update || $display_name_update || $first_name_update || $last_name_update || $company_name_update);
519 519
 
520 520
 	/**
521 521
 	 * True if password fields are filled.
522 522
 	 *
523 523
 	 * @var boolean
524 524
 	 */
525
-	$password_update = ( ! empty( $password ) && ! empty( $confirm_password ) );
525
+	$password_update = ( ! empty($password) && ! empty($confirm_password));
526 526
 
527
-	if ( $profile_update ) {
527
+	if ($profile_update) {
528 528
 
529 529
 		// If only profile fields are updated.
530 530
 		$update_code = '1';
531 531
 
532
-		if ( $password_update ) {
532
+		if ($password_update) {
533 533
 
534 534
 			// If profile fields AND password both are updated.
535 535
 			$update_code = '2';
536 536
 		}
537
-	} elseif ( $password_update ) {
537
+	} elseif ($password_update) {
538 538
 
539 539
 		// If only password is updated.
540 540
 		$update_code = '3';
541 541
 	}
542 542
 
543 543
 	// Update the user.
544
-	$updated = wp_update_user( $userdata );
544
+	$updated = wp_update_user($userdata);
545 545
 
546
-	if ( $updated ) {
546
+	if ($updated) {
547 547
 
548 548
 		/**
549 549
 		 * Fires after updating user profile.
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 		 * @param int   $user_id  The ID of the user.
554 554
 		 * @param array $userdata User info, including ID, first name, last name, display name and email.
555 555
 		 */
556
-		do_action( 'give_user_profile_updated', $user_id, $userdata );
556
+		do_action('give_user_profile_updated', $user_id, $userdata);
557 557
 
558 558
 		$profile_edit_redirect_args = array(
559 559
 			'updated'     => 'true',
@@ -564,10 +564,10 @@  discard block
 block discarded – undo
564 564
 		 * Update codes '2' and '3' indicate a password change.
565 565
 		 * If the password is changed, then logout and redirect to the same page.
566 566
 		 */
567
-		if ( '2' === $update_code || '3' === $update_code ) {
568
-			wp_logout( wp_redirect( add_query_arg( $profile_edit_redirect_args, $data['give_redirect'] ) ) );
567
+		if ('2' === $update_code || '3' === $update_code) {
568
+			wp_logout(wp_redirect(add_query_arg($profile_edit_redirect_args, $data['give_redirect'])));
569 569
 		} else {
570
-			wp_redirect( add_query_arg( $profile_edit_redirect_args, $data['give_redirect'] ) );
570
+			wp_redirect(add_query_arg($profile_edit_redirect_args, $data['give_redirect']));
571 571
 		}
572 572
 
573 573
 		give_die();
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	return false;
577 577
 }
578 578
 
579
-add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' );
579
+add_action('give_edit_user_profile', 'give_process_profile_editor_updates');
580 580
 
581 581
 /**
582 582
  * Give totals Shortcode.
@@ -589,24 +589,24 @@  discard block
 block discarded – undo
589 589
  *
590 590
  * @return string
591 591
  */
592
-function give_totals_shortcode( $atts ) {
593
-	$total = get_option( 'give_earnings_total', false );
592
+function give_totals_shortcode($atts) {
593
+	$total = get_option('give_earnings_total', false);
594 594
 
595
-	$message = apply_filters( 'give_totals_message', __( 'Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give' ) );
595
+	$message = apply_filters('give_totals_message', __('Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give'));
596 596
 
597
-	$atts = shortcode_atts( array(
597
+	$atts = shortcode_atts(array(
598 598
 		'total_goal'   => 0, // integer
599 599
 		'ids'          => 0, // integer|array
600 600
 		'cats'         => 0, // integer|array
601 601
 		'tags'         => 0, // integer|array
602 602
 		'message'      => $message,
603 603
 		'link'         => '', // URL
604
-		'link_text'    => __( 'Donate Now', 'give' ), // string,
604
+		'link_text'    => __('Donate Now', 'give'), // string,
605 605
 		'progress_bar' => true, // boolean
606
-	), $atts, 'give_totals' );
606
+	), $atts, 'give_totals');
607 607
 
608 608
 	// Total Goal.
609
-	$total_goal = give_maybe_sanitize_amount( $atts['total_goal'] );
609
+	$total_goal = give_maybe_sanitize_amount($atts['total_goal']);
610 610
 
611 611
 	/**
612 612
 	 * Give Action fire before the shortcode is rendering is started.
@@ -615,14 +615,14 @@  discard block
 block discarded – undo
615 615
 	 *
616 616
 	 * @param array $atts shortcode attribute.
617 617
 	 */
618
-	do_action( 'give_totals_goal_shortcode_before_render', $atts );
618
+	do_action('give_totals_goal_shortcode_before_render', $atts);
619 619
 
620 620
 	// Build query based on cat, tag and Form ids.
621
-	if ( ! empty( $atts['cats'] ) || ! empty( $atts['tags'] ) || ! empty( $atts['ids'] ) ) {
621
+	if ( ! empty($atts['cats']) || ! empty($atts['tags']) || ! empty($atts['ids'])) {
622 622
 
623 623
 		$form_ids = array();
624
-		if ( ! empty( $atts['ids'] ) ) {
625
-			$form_ids = array_filter( array_map( 'trim', explode( ',', $atts['ids'] ) ) );
624
+		if ( ! empty($atts['ids'])) {
625
+			$form_ids = array_filter(array_map('trim', explode(',', $atts['ids'])));
626 626
 		}
627 627
 
628 628
 		/**
@@ -636,23 +636,23 @@  discard block
 block discarded – undo
636 636
 			'post_type'        => 'give_forms',
637 637
 			'post_status'      => 'publish',
638 638
 			'post__in'         => $form_ids,
639
-			'posts_per_page'   => - 1,
639
+			'posts_per_page'   => -1,
640 640
 			'fields'           => 'ids',
641 641
 			'tax_query'        => array(
642 642
 				'relation' => 'AND',
643 643
 			),
644 644
 		);
645 645
 
646
-		if ( ! empty( $atts['cats'] ) ) {
647
-			$cats                     = array_filter( array_map( 'trim', explode( ',', $atts['cats'] ) ) );
646
+		if ( ! empty($atts['cats'])) {
647
+			$cats                     = array_filter(array_map('trim', explode(',', $atts['cats'])));
648 648
 			$form_args['tax_query'][] = array(
649 649
 				'taxonomy' => 'give_forms_category',
650 650
 				'terms'    => $cats,
651 651
 			);
652 652
 		}
653 653
 
654
-		if ( ! empty( $atts['tags'] ) ) {
655
-			$tags                     = array_filter( array_map( 'trim', explode( ',', $atts['tags'] ) ) );
654
+		if ( ! empty($atts['tags'])) {
655
+			$tags                     = array_filter(array_map('trim', explode(',', $atts['tags'])));
656 656
 			$form_args['tax_query'][] = array(
657 657
 				'taxonomy' => 'give_forms_tag',
658 658
 				'terms'    => $tags,
@@ -668,15 +668,15 @@  discard block
 block discarded – undo
668 668
 		 *
669 669
 		 * @return array $form_args WP query argument for Total Goal.
670 670
 		 */
671
-		$form_args = (array) apply_filters( 'give_totals_goal_shortcode_query_args', $form_args );
671
+		$form_args = (array) apply_filters('give_totals_goal_shortcode_query_args', $form_args);
672 672
 
673
-		$forms = new WP_Query( $form_args );
673
+		$forms = new WP_Query($form_args);
674 674
 
675
-		if ( isset( $forms->posts ) ) {
675
+		if (isset($forms->posts)) {
676 676
 			$total = 0;
677
-			foreach ( $forms->posts as $post ) {
678
-				$form_earning = give_get_meta( $post, '_give_form_earnings', true );
679
-				$form_earning = ! empty( $form_earning ) ? $form_earning : 0;
677
+			foreach ($forms->posts as $post) {
678
+				$form_earning = give_get_meta($post, '_give_form_earnings', true);
679
+				$form_earning = ! empty($form_earning) ? $form_earning : 0;
680 680
 
681 681
 				/**
682 682
 				 * Update Form earnings.
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 				 * @param int $post Form ID.
687 687
 				 * @param string $form_earning Total earning of Form.
688 688
 				 */
689
-				$total += apply_filters( 'give_totals_form_earning', $form_earning, $post );
689
+				$total += apply_filters('give_totals_form_earning', $form_earning, $post);
690 690
 			}
691 691
 		}
692 692
 
@@ -694,23 +694,23 @@  discard block
 block discarded – undo
694 694
 
695 695
 	// Append link with text.
696 696
 	$donate_link = '';
697
-	if ( ! empty( $atts['link'] ) ) {
698
-		$donate_link = sprintf( ' <a class="give-totals-text-link" href="%1$s">%2$s</a>', esc_url( $atts['link'] ), esc_html( $atts['link_text'] ) );
697
+	if ( ! empty($atts['link'])) {
698
+		$donate_link = sprintf(' <a class="give-totals-text-link" href="%1$s">%2$s</a>', esc_url($atts['link']), esc_html($atts['link_text']));
699 699
 	}
700 700
 
701 701
 	// Replace {total} in message.
702
-	$message = str_replace( '{total}', give_currency_filter(
703
-		give_format_amount( $total,
704
-			array( 'sanitize' => false )
702
+	$message = str_replace('{total}', give_currency_filter(
703
+		give_format_amount($total,
704
+			array('sanitize' => false)
705 705
 		)
706
-	), esc_html( $atts['message'] ) );
706
+	), esc_html($atts['message']));
707 707
 
708 708
 	// Replace {total_goal} in message.
709
-	$message = str_replace( '{total_goal}', give_currency_filter(
710
-		give_format_amount( $total_goal,
711
-			array( 'sanitize' => true )
709
+	$message = str_replace('{total_goal}', give_currency_filter(
710
+		give_format_amount($total_goal,
711
+			array('sanitize' => true)
712 712
 		)
713
-	), $message );
713
+	), $message);
714 714
 
715 715
 	/**
716 716
 	 * Update Give totals shortcode output.
@@ -720,19 +720,19 @@  discard block
 block discarded – undo
720 720
 	 * @param string $message Shortcode Message.
721 721
 	 * @param array $atts ShortCode attributes.
722 722
 	 */
723
-	$message = apply_filters( 'give_totals_shortcode_message', $message, $atts );
723
+	$message = apply_filters('give_totals_shortcode_message', $message, $atts);
724 724
 
725 725
 	ob_start();
726 726
 	?>
727 727
 	<div class="give-totals-shortcode-wrap">
728 728
 		<?php
729 729
 		// Show Progress Bar if progress_bar set true.
730
-		$show_progress_bar = isset( $atts['progress_bar'] ) ? filter_var( $atts['progress_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
731
-		if ( $show_progress_bar ) {
732
-			give_show_goal_totals_progress( $total, $total_goal );
730
+		$show_progress_bar = isset($atts['progress_bar']) ? filter_var($atts['progress_bar'], FILTER_VALIDATE_BOOLEAN) : true;
731
+		if ($show_progress_bar) {
732
+			give_show_goal_totals_progress($total, $total_goal);
733 733
 		}
734 734
 
735
-		echo sprintf( $message ) . $donate_link;
735
+		echo sprintf($message).$donate_link;
736 736
 		?>
737 737
 	</div>
738 738
 	<?php
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 	 * @param array  $atts               shortcode attribute.
748 748
 	 * @param string $give_totals_output shortcode output.
749 749
 	 */
750
-	do_action( 'give_totals_goal_shortcode_after_render', $atts, $give_totals_output );
750
+	do_action('give_totals_goal_shortcode_after_render', $atts, $give_totals_output);
751 751
 
752 752
 	/**
753 753
 	 * Give Totals Shortcode output.
@@ -756,11 +756,11 @@  discard block
 block discarded – undo
756 756
 	 *
757 757
 	 * @param string $give_totals_output
758 758
 	 */
759
-	return apply_filters( 'give_totals_shortcode_output', $give_totals_output );
759
+	return apply_filters('give_totals_shortcode_output', $give_totals_output);
760 760
 
761 761
 }
762 762
 
763
-add_shortcode( 'give_totals', 'give_totals_shortcode' );
763
+add_shortcode('give_totals', 'give_totals_shortcode');
764 764
 
765 765
 
766 766
 /**
@@ -791,11 +791,11 @@  discard block
 block discarded – undo
791 791
  * }
792 792
  * @return string|bool The markup of the form grid or false.
793 793
  */
794
-function give_form_grid_shortcode( $atts ) {
794
+function give_form_grid_shortcode($atts) {
795 795
 
796 796
 	$give_settings = give_get_settings();
797 797
 
798
-	$atts = shortcode_atts( array(
798
+	$atts = shortcode_atts(array(
799 799
 		'forms_per_page'      => 12,
800 800
 		'paged'               => true,
801 801
 		'ids'                 => '',
@@ -812,11 +812,11 @@  discard block
 block discarded – undo
812 812
 		'excerpt_length'      => 16,
813 813
 		'display_style'       => 'modal_reveal',
814 814
 		'status'              => '', // open or closed
815
-	), $atts );
815
+	), $atts);
816 816
 
817 817
 	// Validate integer attributes.
818
-	$atts['forms_per_page'] = intval( $atts['forms_per_page'] );
819
-	$atts['excerpt_length'] = intval( $atts['excerpt_length'] );
818
+	$atts['forms_per_page'] = intval($atts['forms_per_page']);
819
+	$atts['excerpt_length'] = intval($atts['excerpt_length']);
820 820
 
821 821
 	// Validate boolean attributes.
822 822
 	$boolean_attributes = array(
@@ -827,8 +827,8 @@  discard block
 block discarded – undo
827 827
 		'show_featured_image',
828 828
 	);
829 829
 
830
-	foreach ( $boolean_attributes as $att ) {
831
-		$atts[ $att ] = filter_var( $atts[ $att ], FILTER_VALIDATE_BOOLEAN );
830
+	foreach ($boolean_attributes as $att) {
831
+		$atts[$att] = filter_var($atts[$att], FILTER_VALIDATE_BOOLEAN);
832 832
 	}
833 833
 
834 834
 	// Set default form query args.
@@ -842,9 +842,9 @@  discard block
 block discarded – undo
842 842
 	);
843 843
 
844 844
 	// Filter results of form grid based on form status.
845
-	$form_closed_status = trim( $atts['status'] );
845
+	$form_closed_status = trim($atts['status']);
846 846
 
847
-	if ( ! empty( $form_closed_status ) ) {
847
+	if ( ! empty($form_closed_status)) {
848 848
 		$form_args['meta_query'] = array(
849 849
 			array(
850 850
 				'key'   => '_give_form_status',
@@ -854,25 +854,25 @@  discard block
 block discarded – undo
854 854
 	}
855 855
 
856 856
 	// Maybe add pagination.
857
-	if ( true === $atts['paged'] ) {
858
-		$form_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
857
+	if (true === $atts['paged']) {
858
+		$form_args['paged'] = get_query_var('paged') ? get_query_var('paged') : 1;
859 859
 	}
860 860
 
861 861
 	// Maybe filter forms by IDs.
862
-	if ( ! empty( $atts['ids'] ) ) {
863
-		$form_args['post__in'] = array_filter( array_map( 'trim', explode( ',', $atts['ids'] ) ) );
862
+	if ( ! empty($atts['ids'])) {
863
+		$form_args['post__in'] = array_filter(array_map('trim', explode(',', $atts['ids'])));
864 864
 	}
865 865
 
866 866
 	// Convert comma-separated form IDs into array.
867
-	if ( ! empty( $atts['exclude'] ) ) {
868
-		$form_args['post__not_in'] = array_filter( array_map( function( $item ) {
869
-			return intval( trim( $item ) );
870
-		}, explode( ',', $atts['exclude'] ) ) );
867
+	if ( ! empty($atts['exclude'])) {
868
+		$form_args['post__not_in'] = array_filter(array_map(function($item) {
869
+			return intval(trim($item));
870
+		}, explode(',', $atts['exclude'])));
871 871
 	}
872 872
 
873 873
 	// Maybe filter by form category.
874
-	if ( ! empty( $atts['cats'] ) ) {
875
-		$cats                     = array_filter( array_map( 'trim', explode( ',', $atts['cats'] ) ) );
874
+	if ( ! empty($atts['cats'])) {
875
+		$cats                     = array_filter(array_map('trim', explode(',', $atts['cats'])));
876 876
 		$tax_query                = array(
877 877
 			'taxonomy' => 'give_forms_category',
878 878
 			'terms'    => $cats,
@@ -881,8 +881,8 @@  discard block
 block discarded – undo
881 881
 	}
882 882
 
883 883
 	// Maybe filter by form tag.
884
-	if ( ! empty( $atts['tags'] ) ) {
885
-		$tags                     = array_filter( array_map( 'trim', explode( ',', $atts['tags'] ) ) );
884
+	if ( ! empty($atts['tags'])) {
885
+		$tags                     = array_filter(array_map('trim', explode(',', $atts['tags'])));
886 886
 		$tax_query                = array(
887 887
 			'taxonomy' => 'give_forms_tag',
888 888
 			'terms'    => $tags,
@@ -891,24 +891,24 @@  discard block
 block discarded – undo
891 891
 	}
892 892
 
893 893
 	// Query to output donation forms.
894
-	$form_query = new WP_Query( $form_args );
894
+	$form_query = new WP_Query($form_args);
895 895
 
896
-	if ( $form_query->have_posts() ) {
896
+	if ($form_query->have_posts()) {
897 897
 		ob_start();
898 898
 
899
-		add_filter( 'add_give_goal_progress_class', 'add_give_goal_progress_class', 10, 1 );
900
-		add_filter( 'add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class', 10, 1 );
901
-		add_filter( 'give_form_wrap_classes', 'add_class_for_form_grid', 10, 3 );
902
-		add_action( 'give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10, 3 );
899
+		add_filter('add_give_goal_progress_class', 'add_give_goal_progress_class', 10, 1);
900
+		add_filter('add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class', 10, 1);
901
+		add_filter('give_form_wrap_classes', 'add_class_for_form_grid', 10, 3);
902
+		add_action('give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10, 3);
903 903
 
904 904
 		echo '<div class="give-wrap">';
905
-		echo '<div class="give-grid give-grid--' . esc_attr( $atts['columns'] ) . '">';
905
+		echo '<div class="give-grid give-grid--'.esc_attr($atts['columns']).'">';
906 906
 
907
-		while ( $form_query->have_posts() ) {
907
+		while ($form_query->have_posts()) {
908 908
 			$form_query->the_post();
909 909
 
910 910
 			// Give/templates/shortcode-form-grid.php.
911
-			give_get_template( 'shortcode-form-grid', array( $give_settings, $atts ) );
911
+			give_get_template('shortcode-form-grid', array($give_settings, $atts));
912 912
 
913 913
 		}
914 914
 
@@ -916,28 +916,28 @@  discard block
 block discarded – undo
916 916
 
917 917
 		echo '</div><!-- .give-grid -->';
918 918
 
919
-		remove_filter( 'add_give_goal_progress_class', 'add_give_goal_progress_class' );
920
-		remove_filter( 'add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class' );
921
-		remove_filter( 'give_form_wrap_classes', 'add_class_for_form_grid', 10 );
922
-		remove_action( 'give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10 );
919
+		remove_filter('add_give_goal_progress_class', 'add_give_goal_progress_class');
920
+		remove_filter('add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class');
921
+		remove_filter('give_form_wrap_classes', 'add_class_for_form_grid', 10);
922
+		remove_action('give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10);
923 923
 
924
-		if ( false !== $atts['paged'] ) {
924
+		if (false !== $atts['paged']) {
925 925
 			$paginate_args = array(
926
-				'current'   => max( 1, get_query_var( 'paged' ) ),
926
+				'current'   => max(1, get_query_var('paged')),
927 927
 				'total'     => $form_query->max_num_pages,
928 928
 				'show_all'  => false,
929 929
 				'end_size'  => 1,
930 930
 				'mid_size'  => 2,
931 931
 				'prev_next' => true,
932
-				'prev_text' => __( '« Previous', 'give' ),
933
-				'next_text' => __( 'Next »', 'give' ),
932
+				'prev_text' => __('« Previous', 'give'),
933
+				'next_text' => __('Next »', 'give'),
934 934
 				'type'      => 'plain',
935 935
 				'add_args'  => false,
936 936
 			);
937 937
 
938 938
 			printf(
939 939
 				'<div class="give-page-numbers">%s</div>',
940
-				paginate_links( $paginate_args )
940
+				paginate_links($paginate_args)
941 941
 			);
942 942
 		}
943 943
 		echo '</div><!-- .give-wrap -->';
@@ -946,4 +946,4 @@  discard block
 block discarded – undo
946 946
 	}
947 947
 }
948 948
 
949
-add_shortcode( 'give_form_grid', 'give_form_grid_shortcode' );
949
+add_shortcode('give_form_grid', 'give_form_grid_shortcode');
Please login to merge, or discard this patch.
templates/shortcode-receipt.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -6,29 +6,29 @@  discard block
 block discarded – undo
6 6
 global $give_receipt_args, $payment;
7 7
 
8 8
 // Validation: Ensure $payment var is set.
9
-if ( empty( $payment ) ) {
10
-	$payment = ! empty( $give_receipt_args['id'] ) ? get_post( $give_receipt_args['id'] ) : 0;
9
+if (empty($payment)) {
10
+	$payment = ! empty($give_receipt_args['id']) ? get_post($give_receipt_args['id']) : 0;
11 11
 }
12 12
 
13 13
 // Double-Validation: Check for $payment global.
14
-if ( empty( $payment ) ) {
15
-	Give()->notices->print_frontend_notice( __( 'The specified receipt ID appears to be invalid.', 'give' ) );
14
+if (empty($payment)) {
15
+	Give()->notices->print_frontend_notice(__('The specified receipt ID appears to be invalid.', 'give'));
16 16
 
17 17
 	return;
18 18
 }
19 19
 
20 20
 $donation_id  = $payment->ID;
21
-$donation_number = Give()->seq_donation_number->get_serial_code( $payment->ID );
22
-$form_id      = give_get_payment_meta( $donation_id, '_give_payment_form_id', true );
23
-$donation     = give_get_donation_form_title( $donation_id );
24
-$user         = give_get_payment_meta_user_info( $donation_id );
25
-$email        = give_get_payment_user_email( $donation_id );
21
+$donation_number = Give()->seq_donation_number->get_serial_code($payment->ID);
22
+$form_id      = give_get_payment_meta($donation_id, '_give_payment_form_id', true);
23
+$donation     = give_get_donation_form_title($donation_id);
24
+$user         = give_get_payment_meta_user_info($donation_id);
25
+$email        = give_get_payment_user_email($donation_id);
26 26
 $status       = $payment->post_status;
27
-$status_label = give_get_payment_status( $payment, true );
28
-$company_name = give_get_payment_meta( $donation_id, '_give_donation_company', true );
27
+$status_label = give_get_payment_status($payment, true);
28
+$company_name = give_get_payment_meta($donation_id, '_give_donation_company', true);
29 29
 
30 30
 // Update donor name, if title prefix is set.
31
-$full_name    = give_get_donor_name_with_title_prefixes( $user['title'], "{$user['first_name']} {$user['last_name']}" );
31
+$full_name    = give_get_donor_name_with_title_prefixes($user['title'], "{$user['first_name']} {$user['last_name']}");
32 32
 
33 33
 /**
34 34
  * Generate Donation Receipt Arguments.
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
  * @since 1.8.8
40 40
  */
41 41
 $give_receipt_args['donation_receipt']['donor'] = array(
42
-	'name'    => __( 'Donor', 'give' ),
42
+	'name'    => __('Donor', 'give'),
43 43
 	'value'   => $full_name,
44 44
 	'display' => $give_receipt_args['donor'],
45 45
 );
@@ -54,51 +54,51 @@  discard block
 block discarded – undo
54 54
  * @return bool show/hide company name in donation receipt page.
55 55
  */
56 56
 $give_receipt_args['donation_receipt']['company_name'] = array(
57
-	'name'    => __( 'Company Name', 'give' ),
58
-	'value'   => esc_attr( $company_name ),
57
+	'name'    => __('Company Name', 'give'),
58
+	'value'   => esc_attr($company_name),
59 59
 	// Do not show company field if empty
60
-	'display' => empty( $company_name ) ? false : $give_receipt_args['company_name'],
60
+	'display' => empty($company_name) ? false : $give_receipt_args['company_name'],
61 61
 );
62 62
 
63 63
 $give_receipt_args['donation_receipt']['date'] = array(
64
-	'name'    => __( 'Date', 'give' ),
65
-	'value'   => date_i18n( give_date_format(), strtotime( give_get_payment_completed_date( $donation_id ) ) ),
64
+	'name'    => __('Date', 'give'),
65
+	'value'   => date_i18n(give_date_format(), strtotime(give_get_payment_completed_date($donation_id))),
66 66
 	'display' => $give_receipt_args['date'],
67 67
 );
68 68
 
69 69
 $give_receipt_args['donation_receipt']['total_donation'] = array(
70
-	'name'    => __( 'Total Donation', 'give' ),
71
-	'value'   => give_donation_amount( $donation_id, array( 'currency' => true, 'amount' => true, 'type' => 'receipt' ) ),
70
+	'name'    => __('Total Donation', 'give'),
71
+	'value'   => give_donation_amount($donation_id, array('currency' => true, 'amount' => true, 'type' => 'receipt')),
72 72
 	'display' => $give_receipt_args['price'],
73 73
 );
74 74
 
75 75
 $give_receipt_args['donation_receipt']['donation'] = array(
76
-	'name'    => __( 'Donation', 'give' ),
76
+	'name'    => __('Donation', 'give'),
77 77
 	'value'   => $donation,
78 78
 	'display' => true,
79 79
 );
80 80
 
81 81
 $give_receipt_args['donation_receipt']['donation_status'] = array(
82
-	'name'    => __( 'Donation Status', 'give' ),
83
-	'value'   => esc_attr( $status_label ),
82
+	'name'    => __('Donation Status', 'give'),
83
+	'value'   => esc_attr($status_label),
84 84
 	'display' => $give_receipt_args['payment_status'],
85 85
 );
86 86
 
87 87
 $give_receipt_args['donation_receipt']['donation_id'] = array(
88
-	'name'    => __( 'Donation ID', 'give' ),
88
+	'name'    => __('Donation ID', 'give'),
89 89
 	'value'   => $donation_number,
90 90
 	'display' => $give_receipt_args['payment_id'],
91 91
 );
92 92
 
93 93
 $give_receipt_args['donation_receipt']['payment_key'] = array(
94
-	'name'    => __( 'Payment Key', 'give' ),
95
-	'value'   => get_post_meta( $donation_id, '_give_payment_purchase_key', true ),
94
+	'name'    => __('Payment Key', 'give'),
95
+	'value'   => get_post_meta($donation_id, '_give_payment_purchase_key', true),
96 96
 	'display' => $give_receipt_args['payment_key'],
97 97
 );
98 98
 
99 99
 $give_receipt_args['donation_receipt']['payment_method'] = array(
100
-	'name'    => __( 'Payment Method', 'give' ),
101
-	'value'   => give_get_gateway_checkout_label( give_get_payment_gateway( $donation_id ) ),
100
+	'name'    => __('Payment Method', 'give'),
101
+	'value'   => give_get_gateway_checkout_label(give_get_payment_gateway($donation_id)),
102 102
 	'display' => $give_receipt_args['payment_method'],
103 103
 );
104 104
 
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @since 1.8.8
115 115
  */
116
-$give_receipt_args['donation_receipt'] = apply_filters( 'give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id );
116
+$give_receipt_args['donation_receipt'] = apply_filters('give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id);
117 117
 
118 118
 // When the donation were made through offline donation, We won't show receipt and payment status though.
119
-if ( 'offline' === give_get_payment_gateway( $payment->ID ) && 'pending' === $status ) {
119
+if ('offline' === give_get_payment_gateway($payment->ID) && 'pending' === $status) {
120 120
 
121 121
 	/**
122 122
 	 * Before the offline donation receipt content starts.
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
 	 * @param Give_Payment $payment           Donation payment object.
127 127
 	 * @param array        $give_receipt_args Receipt Arguments.
128 128
 	 */
129
-	do_action( 'give_receipt_before_offline_payment', $payment, $give_receipt_args );
129
+	do_action('give_receipt_before_offline_payment', $payment, $give_receipt_args);
130 130
 	?>
131
-	<h2><?php echo apply_filters( 'give_receipt_offline_payment_heading', __( 'Your Donation is Almost Complete!', 'give' ) ); ?></h2>
132
-	<div id="give_donation_receipt" class="<?php echo esc_attr( apply_filters( 'give_receipt_offline_payment_classes', 'give_receipt_offline_payment' ) ); ?>">
131
+	<h2><?php echo apply_filters('give_receipt_offline_payment_heading', __('Your Donation is Almost Complete!', 'give')); ?></h2>
132
+	<div id="give_donation_receipt" class="<?php echo esc_attr(apply_filters('give_receipt_offline_payment_classes', 'give_receipt_offline_payment')); ?>">
133 133
 		<?php
134 134
 		// Instruction for offline donation.
135
-		$offline_instruction = give_get_offline_payment_instruction( $form_id, true );
135
+		$offline_instruction = give_get_offline_payment_instruction($form_id, true);
136 136
 
137 137
 		/**
138 138
 		 * Instruction for the offline donation.
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		 * @param Give_Payment $payment             Payment object.
144 144
 		 * @param integer      $form_id             Donation form id.
145 145
 		 */
146
-		echo apply_filters( 'give_receipt_offline_payment_instruction', $offline_instruction, $payment, $form_id );
146
+		echo apply_filters('give_receipt_offline_payment_instruction', $offline_instruction, $payment, $form_id);
147 147
 		?>
148 148
 	</div>
149 149
 	<?php
@@ -155,52 +155,52 @@  discard block
 block discarded – undo
155 155
 	 * @param Give_Payment $payment           Donation payment object.
156 156
 	 * @param array        $give_receipt_args Receipt Arguments.
157 157
 	 */
158
-	do_action( 'give_receipt_after_offline_payment', $payment, $give_receipt_args );
158
+	do_action('give_receipt_after_offline_payment', $payment, $give_receipt_args);
159 159
 
160 160
 	return;
161 161
 }
162 162
 
163 163
 // Show payment status notice based on shortcode attribute.
164
-if ( filter_var( $give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN ) ) {
164
+if (filter_var($give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN)) {
165 165
 	$notice_message = '';
166 166
 	$notice_type    = 'warning';
167 167
 
168
-	switch ( $status ) {
168
+	switch ($status) {
169 169
 		case 'publish':
170
-			$notice_message = __( 'Payment Complete: Thank you for your donation.', 'give' );
170
+			$notice_message = __('Payment Complete: Thank you for your donation.', 'give');
171 171
 			$notice_type    = 'success';
172 172
 			break;
173 173
 		case 'pending':
174
-			$notice_message = __( 'Payment Pending: Your donation is currently processing.', 'give' );
174
+			$notice_message = __('Payment Pending: Your donation is currently processing.', 'give');
175 175
 			$notice_type    = 'warning';
176 176
 			break;
177 177
 		case 'refunded':
178
-			$notice_message = __( 'Payment Refunded: Your donation has been refunded.', 'give' );
178
+			$notice_message = __('Payment Refunded: Your donation has been refunded.', 'give');
179 179
 			$notice_type    = 'warning';
180 180
 			break;
181 181
 		case 'preapproval':
182
-			$notice_message = __( 'Payment Preapproved: Thank you for your donation.', 'give' );
182
+			$notice_message = __('Payment Preapproved: Thank you for your donation.', 'give');
183 183
 			$notice_type    = 'warning';
184 184
 			break;
185 185
 		case 'failed':
186
-			$notice_message = __( 'Payment Failed: Please contact the site owner for assistance.', 'give' );
186
+			$notice_message = __('Payment Failed: Please contact the site owner for assistance.', 'give');
187 187
 			$notice_type    = 'error';
188 188
 			break;
189 189
 		case 'cancelled':
190
-			$notice_message = __( 'Payment Cancelled: Your donation has been cancelled.', 'give' );
190
+			$notice_message = __('Payment Cancelled: Your donation has been cancelled.', 'give');
191 191
 			$notice_type    = 'error';
192 192
 			break;
193 193
 		case 'abandoned':
194
-			$notice_message = __( 'Payment Abandoned: This donation has not been completed.', 'give' );
194
+			$notice_message = __('Payment Abandoned: This donation has not been completed.', 'give');
195 195
 			$notice_type    = 'error';
196 196
 			break;
197 197
 		case 'revoked':
198
-			$notice_message = __( 'Payment Revoked: Please contact the site owner for assistance.', 'give' );
198
+			$notice_message = __('Payment Revoked: Please contact the site owner for assistance.', 'give');
199 199
 			$notice_type    = 'error';
200 200
 			break;
201 201
 	}
202 202
 
203
-	if ( ! empty( $notice_message ) ) {
203
+	if ( ! empty($notice_message)) {
204 204
 		/**
205 205
 		 * Filters payment status notice for receipts.
206 206
 		 *
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		 * @param string $status Payment status.
216 216
 		 * @param int $donation_id Donation ID.
217 217
 		 */
218
-		echo apply_filters( 'give_receipt_status_notice', Give()->notices->print_frontend_notice( $notice_message, false, $notice_type ), $id, $status, $donation_id );
218
+		echo apply_filters('give_receipt_status_notice', Give()->notices->print_frontend_notice($notice_message, false, $notice_type), $id, $status, $donation_id);
219 219
 	}
220 220
 }// End if().
221 221
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
  * @param object $payment           The payment object.
230 230
  * @param array  $give_receipt_args Receipt_argument.
231 231
  */
232
-do_action( 'give_payment_receipt_before_table', $payment, $give_receipt_args );
232
+do_action('give_payment_receipt_before_table', $payment, $give_receipt_args);
233 233
 ?>
234 234
 
235 235
 <table id="give_donation_receipt" class="give-table">
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 	 * @param object $payment           The payment object.
246 246
 	 * @param array  $give_receipt_args Receipt_argument.
247 247
 	 */
248
-	do_action( 'give_payment_receipt_header_before', $payment, $give_receipt_args );
248
+	do_action('give_payment_receipt_header_before', $payment, $give_receipt_args);
249 249
 	?>
250 250
 	<tr>
251 251
 		<th scope="colgroup" colspan="2">
252
-			<span class="give-receipt-thead-text"><?php esc_html_e( 'Donation Receipt', 'give' ) ?></span>
252
+			<span class="give-receipt-thead-text"><?php esc_html_e('Donation Receipt', 'give') ?></span>
253 253
 		</th>
254 254
 	</tr>
255 255
 	<?php
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 * @param object $payment           The payment object.
264 264
 	 * @param array  $give_receipt_args Receipt_argument.
265 265
 	 */
266
-	do_action( 'give_payment_receipt_header_after', $payment, $give_receipt_args );
266
+	do_action('give_payment_receipt_header_after', $payment, $give_receipt_args);
267 267
 	?>
268 268
 	</thead>
269 269
 
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
 	 * @param object $payment           The payment object.
280 280
 	 * @param array  $give_receipt_args Receipt_argument.
281 281
 	 */
282
-	do_action( 'give_payment_receipt_before', $payment, $give_receipt_args );
282
+	do_action('give_payment_receipt_before', $payment, $give_receipt_args);
283 283
 	?>
284 284
 
285
-	<?php foreach ( $give_receipt_args['donation_receipt'] as $receipt_item ) { ?>
286
-		<?php if ( filter_var( $receipt_item['display'], FILTER_VALIDATE_BOOLEAN ) ) : ?>
285
+	<?php foreach ($give_receipt_args['donation_receipt'] as $receipt_item) { ?>
286
+		<?php if (filter_var($receipt_item['display'], FILTER_VALIDATE_BOOLEAN)) : ?>
287 287
 			<tr>
288 288
 				<td scope="row"><strong><?php echo $receipt_item['name']; ?></strong></td>
289 289
 				<td><?php echo $receipt_item['value']; ?></td>
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 * @param object $payment           The payment object.
303 303
 	 * @param array  $give_receipt_args Receipt_argument.
304 304
 	 */
305
-	do_action( 'give_payment_receipt_after', $payment, $give_receipt_args );
305
+	do_action('give_payment_receipt_after', $payment, $give_receipt_args);
306 306
 	?>
307 307
 	</tbody>
308 308
 </table>
@@ -318,5 +318,5 @@  discard block
 block discarded – undo
318 318
  * @param object $payment           The payment object.
319 319
  * @param array  $give_receipt_args Receipt_argument.
320 320
  */
321
-do_action( 'give_payment_receipt_after_table', $payment, $give_receipt_args );
321
+do_action('give_payment_receipt_after_table', $payment, $give_receipt_args);
322 322
 ?>
Please login to merge, or discard this patch.
templates/shortcode-goal.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -3,46 +3,46 @@  discard block
 block discarded – undo
3 3
  * This template is used to display the goal with [give_goal]
4 4
  */
5 5
 
6
-$form        = new Give_Donate_Form( $form_id );
7
-$goal_option = give_get_meta( $form->ID, '_give_goal_option', true );
6
+$form        = new Give_Donate_Form($form_id);
7
+$goal_option = give_get_meta($form->ID, '_give_goal_option', true);
8 8
 
9 9
 // Sanity check - ensure form has pass all condition to show goal.
10
-if ( ( isset( $args['show_goal'] ) && ! filter_var( $args['show_goal'], FILTER_VALIDATE_BOOLEAN ) )
11
-     || empty( $form->ID )
12
-     || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) )
13
-     || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) {
10
+if ((isset($args['show_goal']) && ! filter_var($args['show_goal'], FILTER_VALIDATE_BOOLEAN))
11
+     || empty($form->ID)
12
+     || (is_singular('give_forms') && ! give_is_setting_enabled($goal_option))
13
+     || ! give_is_setting_enabled($goal_option) || 0 === $form->goal) {
14 14
 	return false;
15 15
 }
16 16
 
17
-$goal_format         = give_get_form_goal_format( $form_id );
18
-$price               = give_get_meta( $form_id, '_give_set_price', true );
19
-$color               = give_get_meta( $form_id, '_give_goal_color', true );
20
-$show_text           = isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true;
21
-$show_bar            = isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
22
-$goal_progress_stats = give_goal_progress_stats( $form );
17
+$goal_format         = give_get_form_goal_format($form_id);
18
+$price               = give_get_meta($form_id, '_give_set_price', true);
19
+$color               = give_get_meta($form_id, '_give_goal_color', true);
20
+$show_text           = isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true;
21
+$show_bar            = isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true;
22
+$goal_progress_stats = give_goal_progress_stats($form);
23 23
 
24 24
 $income = $goal_progress_stats['raw_actual'];
25 25
 $goal   = $goal_progress_stats['raw_goal'];
26 26
 
27
-switch ( $goal_format ) {
27
+switch ($goal_format) {
28 28
 
29 29
 	case 'donation':
30
-		$progress           = $goal ? round( ( $income / $goal ) * 100, 2 ) : 0;
30
+		$progress           = $goal ? round(($income / $goal) * 100, 2) : 0;
31 31
 		$progress_bar_value = $income >= $goal ? 100 : $progress;
32 32
 		break;
33 33
 
34 34
 	case 'donors':
35
-		$progress_bar_value = $goal ? round( ( $income / $goal ) * 100, 2 ) : 0;
35
+		$progress_bar_value = $goal ? round(($income / $goal) * 100, 2) : 0;
36 36
 		$progress           = $progress_bar_value;
37 37
 		break;
38 38
 
39 39
 	case 'percentage':
40
-		$progress           = $goal ? round( ( $income / $goal ) * 100, 2 ) : 0;
40
+		$progress           = $goal ? round(($income / $goal) * 100, 2) : 0;
41 41
 		$progress_bar_value = $income >= $goal ? 100 : $progress;
42 42
 		break;
43 43
 
44 44
 	default:
45
-		$progress           = $goal ? round( ( $income / $goal ) * 100, 2 ) : 0;
45
+		$progress           = $goal ? round(($income / $goal) * 100, 2) : 0;
46 46
 		$progress_bar_value = $income >= $goal ? 100 : $progress;
47 47
 		break;
48 48
 
@@ -53,64 +53,64 @@  discard block
 block discarded – undo
53 53
  *
54 54
  * @since 1.8.8
55 55
  */
56
-$progress = apply_filters( 'give_goal_amount_funded_percentage_output', $progress, $form_id, $form );
56
+$progress = apply_filters('give_goal_amount_funded_percentage_output', $progress, $form_id, $form);
57 57
 ?>
58 58
 <div class="give-goal-progress">
59
-	<?php if ( ! empty( $show_text ) ) : ?>
59
+	<?php if ( ! empty($show_text)) : ?>
60 60
         <div class="raised">
61 61
 			<?php
62
-			if ( 'amount' === $goal_format ) :
62
+			if ('amount' === $goal_format) :
63 63
 
64 64
 				/**
65 65
 				 * Filter the give currency.
66 66
 				 *
67 67
 				 * @since 1.8.17
68 68
 				 */
69
-				$form_currency = apply_filters( 'give_goal_form_currency', give_get_currency( $form_id ), $form_id );
69
+				$form_currency = apply_filters('give_goal_form_currency', give_get_currency($form_id), $form_id);
70 70
 
71 71
 				/**
72 72
 				 * Filter the income formatting arguments.
73 73
 				 *
74 74
 				 * @since 1.8.17
75 75
 				 */
76
-				$income_format_args = apply_filters( 'give_goal_income_format_args', array(
76
+				$income_format_args = apply_filters('give_goal_income_format_args', array(
77 77
 					'sanitize' => false,
78 78
 					'currency' => $form_currency,
79 79
 					'decimal'  => false,
80
-				), $form_id );
80
+				), $form_id);
81 81
 
82 82
 				/**
83 83
 				 * Filter the goal formatting arguments.
84 84
 				 *
85 85
 				 * @since 1.8.17
86 86
 				 */
87
-				$goal_format_args = apply_filters( 'give_goal_amount_format_args', array(
87
+				$goal_format_args = apply_filters('give_goal_amount_format_args', array(
88 88
 					'sanitize' => false,
89 89
 					'currency' => $form_currency,
90 90
 					'decimal'  => false,
91
-				), $form_id );
91
+				), $form_id);
92 92
 
93 93
 				// Get formatted amount.
94
-				$income = give_human_format_large_amount( give_format_amount( $income, $income_format_args ), array( 'currency' => $form_currency ) );
95
-				$goal   = give_human_format_large_amount( give_format_amount( $goal, $goal_format_args ), array( 'currency' => $form_currency ) );
94
+				$income = give_human_format_large_amount(give_format_amount($income, $income_format_args), array('currency' => $form_currency));
95
+				$goal   = give_human_format_large_amount(give_format_amount($goal, $goal_format_args), array('currency' => $form_currency));
96 96
 
97 97
 				echo sprintf( /* translators: 1: amount of income raised 2: goal target amount. */
98
-					__( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give' ), give_currency_filter( $income, array( 'form_id' => $form_id ) ), give_currency_filter( $goal, array( 'form_id' => $form_id ) ) );
98
+					__('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give'), give_currency_filter($income, array('form_id' => $form_id)), give_currency_filter($goal, array('form_id' => $form_id)) );
99 99
 
100
-            elseif ( 'percentage' === $goal_format ) :
100
+            elseif ('percentage' === $goal_format) :
101 101
 
102 102
 				echo sprintf( /* translators: %s: percentage of the amount raised compared to the goal target */
103
-					__( '<span class="give-percentage">%s%%</span> funded', 'give' ), round( $progress ) );
103
+					__('<span class="give-percentage">%s%%</span> funded', 'give'), round($progress) );
104 104
 
105
-            elseif ( 'donation' === $goal_format ) :
105
+            elseif ('donation' === $goal_format) :
106 106
 
107 107
 				echo sprintf( /* translators: 1: total number of donations completed 2: total number of donations set as goal */
108
-					_n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give' ), $income, $goal );
108
+					_n('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give'), $income, $goal );
109 109
 
110
-            elseif ( 'donors' === $goal_format ) :
110
+            elseif ('donors' === $goal_format) :
111 111
 
112 112
 				echo sprintf( /* translators: 1: total number of donors completed 2: total number of donors set as goal */
113
-					_n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give' ), $income, $goal );
113
+					_n('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give'), $income, $goal );
114 114
 
115 115
 			endif;
116 116
 			?>
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
 	<?php endif; ?>
119 119
 
120 120
 
121
-	<?php if ( ! empty( $show_bar ) ) : ?>
121
+	<?php if ( ! empty($show_bar)) : ?>
122 122
         <div class="give-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100"
123
-             aria-valuenow="<?php echo esc_attr( $progress_bar_value ); ?>">
124
-			<span style="width: <?php echo esc_attr( $progress_bar_value ); ?>%;<?php if ( ! empty( $color ) ) {
125
-				echo 'background-color:' . $color;
123
+             aria-valuenow="<?php echo esc_attr($progress_bar_value); ?>">
124
+			<span style="width: <?php echo esc_attr($progress_bar_value); ?>%;<?php if ( ! empty($color)) {
125
+				echo 'background-color:'.$color;
126 126
 			} ?>"></span>
127 127
         </div><!-- /.give-progress-bar -->
128 128
 	<?php endif; ?>
Please login to merge, or discard this patch.
templates/shortcode-donor-wall.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@  discard block
 block discarded – undo
4 4
  */
5 5
 
6 6
 // Exit if accessed directly.
7
-if ( ! defined( 'ABSPATH' ) ) {
7
+if ( ! defined('ABSPATH')) {
8 8
 	exit;
9 9
 }
10 10
 
11 11
 /** @var $donor Give_Donor */
12 12
 $donor = $args[0];
13
-$donor = new Give_Donor( $donor->id );
13
+$donor = new Give_Donor($donor->id);
14 14
 
15 15
 $give_settings = $args[1]; // Give settings.
16 16
 $atts          = $args[2]; // Shortcode attributes.
@@ -20,24 +20,24 @@  discard block
 block discarded – undo
20 20
 	<div class="give-donor__header">
21 21
 		<?php
22 22
 		// Maybe display the Avatar.
23
-		if ( true === $atts['show_avatar'] ) {
24
-			echo give_get_donor_avatar( $donor );
23
+		if (true === $atts['show_avatar']) {
24
+			echo give_get_donor_avatar($donor);
25 25
 		}
26 26
 		?>
27 27
 
28 28
 		<div class="give-donor__details">
29
-			<?php if ( true === $atts['show_name'] ) : ?>
30
-				<h3 class="give-donor__name"><?php esc_html_e( $donor->name ); ?></h3>
29
+			<?php if (true === $atts['show_name']) : ?>
30
+				<h3 class="give-donor__name"><?php esc_html_e($donor->name); ?></h3>
31 31
 			<?php endif; ?>
32 32
 
33
-			<?php if ( true === $atts['show_total'] ) : ?>
33
+			<?php if (true === $atts['show_total']) : ?>
34 34
 				<span class="give-donor__total">
35 35
 					<?php
36 36
 					// If not filtered by form ID then display total donations
37 37
 					// Else filtered by form ID, only display donations made for this form.
38 38
 					$donated_amount = $donor->purchase_value;
39 39
 
40
-					if ( ! empty( $atts['form_id'] ) ) {
40
+					if ( ! empty($atts['form_id'])) {
41 41
 						$donated_amount = Give_Donor_Stats::donated(
42 42
 							array(
43 43
 								'donor'      => $donor->id,
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
 						);
47 47
 					}
48 48
 
49
-					echo give_currency_filter( give_format_amount( $donated_amount, array( 'sanitize' => false ) ) );
49
+					echo give_currency_filter(give_format_amount($donated_amount, array('sanitize' => false)));
50 50
 					?>
51 51
 				</span>
52 52
 			<?php endif; ?>
53 53
 
54
-			<?php if ( true === $atts['show_time'] ) : ?>
54
+			<?php if (true === $atts['show_time']) : ?>
55 55
 				<span class="give-donor__timestamp">
56 56
 					<?php
57 57
 					// If not filtered by form ID then display the "Donor Since" text.
58 58
 					// If filtered by form ID then display the last donation date.
59
-					echo $donor->get_last_donation_date( true );
59
+					echo $donor->get_last_donation_date(true);
60 60
 					?>
61 61
 				</span>
62 62
 			<?php endif; ?>
@@ -64,25 +64,25 @@  discard block
 block discarded – undo
64 64
 	</div>
65 65
 
66 66
 	<?php
67
-	$comment = give_get_donor_latest_comment( $donor->id, $atts['form_id'] );
67
+	$comment = give_get_donor_latest_comment($donor->id, $atts['form_id']);
68 68
 
69
-	if ( true === $atts['show_comments'] && absint( $atts['comment_length'] ) && $comment instanceof WP_Comment ) :
69
+	if (true === $atts['show_comments'] && absint($atts['comment_length']) && $comment instanceof WP_Comment) :
70 70
 	?>
71 71
 		<div class="give-donor__content">
72 72
 				<?php
73
-				if ( $atts['comment_length'] < strlen( $comment->comment_content ) ) {
73
+				if ($atts['comment_length'] < strlen($comment->comment_content)) {
74 74
 					echo sprintf(
75 75
 						'<p class="give-donor__comment_excerpt">%s&hellip;<span>&nbsp;<a class="give-donor__read-more">%s</a></span></p>',
76
-						substr( $comment->comment_content, 0, $atts['comment_length'] ),
76
+						substr($comment->comment_content, 0, $atts['comment_length']),
77 77
 						$atts['readmore_text']
78 78
 					);
79 79
 
80 80
 					echo sprintf(
81 81
 						'<div class="give-donor__comment" style="display: none">%s</div>',
82
-						apply_filters( 'the_content', $comment->comment_content )
82
+						apply_filters('the_content', $comment->comment_content)
83 83
 					);
84 84
 				} else {
85
-					echo apply_filters( 'the_content', $comment->comment_content );
85
+					echo apply_filters('the_content', $comment->comment_content);
86 86
 				}
87 87
 				?>
88 88
 		</div>
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
  */
40 40
 
41 41
 // Exit if accessed directly.
42
-if ( ! defined( 'ABSPATH' ) ) {
42
+if ( ! defined('ABSPATH')) {
43 43
 	exit;
44 44
 }
45 45
 
46
-if ( ! class_exists( 'Give' ) ) :
46
+if ( ! class_exists('Give')) :
47 47
 
48 48
 	/**
49 49
 	 * Main Give Class
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 		 * @return    Give
281 281
 		 */
282 282
 		public static function instance() {
283
-			if ( is_null( self::$_instance ) ) {
283
+			if (is_null(self::$_instance)) {
284 284
 				self::$_instance = new self();
285 285
 			}
286 286
 
@@ -292,13 +292,13 @@  discard block
 block discarded – undo
292 292
 		 */
293 293
 		public function __construct() {
294 294
 			// PHP version
295
-			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
296
-				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
295
+			if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) {
296
+				define('GIVE_REQUIRED_PHP_VERSION', '5.3');
297 297
 			}
298 298
 
299 299
 			// Bailout: Need minimum php version to load plugin.
300
-			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
301
-				add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) );
300
+			if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
301
+				add_action('admin_notices', array($this, 'minimum_phpversion_notice'));
302 302
 
303 303
 				return;
304 304
 			}
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 			$this->includes();
308 308
 			$this->init_hooks();
309 309
 
310
-			do_action( 'give_loaded' );
310
+			do_action('give_loaded');
311 311
 		}
312 312
 
313 313
 		/**
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 		 * @since  1.8.9
317 317
 		 */
318 318
 		private function init_hooks() {
319
-			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
320
-			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
319
+			register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
320
+			add_action('plugins_loaded', array($this, 'init'), 0);
321 321
 
322 322
 			// Set up localization on init Hook.
323
-			add_action( 'init', array( $this, 'load_textdomain' ), 0 );
323
+			add_action('init', array($this, 'load_textdomain'), 0);
324 324
 		}
325 325
 
326 326
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 			 *
337 337
 			 * @since 1.8.9
338 338
 			 */
339
-			do_action( 'before_give_init' );
339
+			do_action('before_give_init');
340 340
 
341 341
 			// Set up localization.
342 342
 			$this->load_textdomain();
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 			 *
372 372
 			 * @since 1.8.7
373 373
 			 */
374
-			do_action( 'give_init', $this );
374
+			do_action('give_init', $this);
375 375
 
376 376
 		}
377 377
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 		 */
389 389
 		public function __clone() {
390 390
 			// Cloning instances of the class is forbidden.
391
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
391
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
392 392
 		}
393 393
 
394 394
 		/**
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 		 */
402 402
 		public function __wakeup() {
403 403
 			// Unserializing instances of the class is forbidden.
404
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
404
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
405 405
 		}
406 406
 
407 407
 		/**
@@ -415,33 +415,33 @@  discard block
 block discarded – undo
415 415
 		private function setup_constants() {
416 416
 
417 417
 			// Plugin version
418
-			if ( ! defined( 'GIVE_VERSION' ) ) {
419
-				define( 'GIVE_VERSION', '2.2.0' );
418
+			if ( ! defined('GIVE_VERSION')) {
419
+				define('GIVE_VERSION', '2.2.0');
420 420
 			}
421 421
 
422 422
 			// Plugin Root File
423
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
424
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
423
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
424
+				define('GIVE_PLUGIN_FILE', __FILE__);
425 425
 			}
426 426
 
427 427
 			// Plugin Folder Path
428
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
429
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
428
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
429
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE));
430 430
 			}
431 431
 
432 432
 			// Plugin Folder URL
433
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
434
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
433
+			if ( ! defined('GIVE_PLUGIN_URL')) {
434
+				define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE));
435 435
 			}
436 436
 
437 437
 			// Plugin Basename aka: "give/give.php"
438
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
439
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
438
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
439
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE));
440 440
 			}
441 441
 
442 442
 			// Make sure CAL_GREGORIAN is defined
443
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
444
-				define( 'CAL_GREGORIAN', 1 );
443
+			if ( ! defined('CAL_GREGORIAN')) {
444
+				define('CAL_GREGORIAN', 1);
445 445
 			}
446 446
 		}
447 447
 
@@ -459,170 +459,170 @@  discard block
 block discarded – undo
459 459
 			/**
460 460
 			 * Load libraries.
461 461
 			 */
462
-			if ( ! class_exists( 'WP_Async_Request' ) ) {
463
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
462
+			if ( ! class_exists('WP_Async_Request')) {
463
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php');
464 464
 			}
465 465
 
466
-			if ( ! class_exists( 'WP_Background_Process' ) ) {
467
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
466
+			if ( ! class_exists('WP_Background_Process')) {
467
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php');
468 468
 			}
469 469
 
470 470
 			/**
471 471
 			 * Load plugin files
472 472
 			 */
473
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
474
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
473
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
474
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
475 475
 			$give_options = give_get_settings();
476 476
 
477
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
478
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
479
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
480
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
481
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
482
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
483
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
484
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
485
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
486
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-v2.php';
487
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
488
-			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
489
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
490
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-readme-parser.php';
491
-
492
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php';
493
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
494
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
495
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
496
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
497
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
498
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
499
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
500
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
501
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sequential-ordering.php';
502
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
503
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor-wall-widget.php';
504
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
505
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sessions.php';
506
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
507
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
508
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
509
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
510
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
511
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
512
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-comment.php';
513
-
514
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
515
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
516
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
517
-			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
518
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
519
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
520
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
521
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
522
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
523
-			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
524
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
525
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
526
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
527
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
528
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
529
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
530
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
531
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
532
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
533
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
534
-
535
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
536
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
537
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
538
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
539
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
540
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
541
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-sequential-donation-number.php';
542
-
543
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
544
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
545
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
546
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
547
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
548
-
549
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
550
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
551
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
552
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
553
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
554
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
555
-
556
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
557
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donor-wall.php';
558
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donor-stats.php';
559
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
560
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/frontend-donor-functions.php';
561
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/actions.php';
562
-
563
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
564
-
565
-			require_once GIVE_PLUGIN_DIR . 'blocks/load.php';
566
-
567
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
568
-				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
477
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
478
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php';
479
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
480
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php';
481
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
482
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
483
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
484
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
485
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
486
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-v2.php';
487
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php';
488
+			require_once GIVE_PLUGIN_DIR.'includes/class-notices.php';
489
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php';
490
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-readme-parser.php';
491
+
492
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-scripts.php';
493
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
494
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
495
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
496
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
497
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php';
498
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php';
499
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php';
500
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php';
501
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sequential-ordering.php';
502
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php';
503
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor-wall-widget.php';
504
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
505
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sessions.php';
506
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
507
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
508
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
509
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
510
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
511
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php';
512
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-comment.php';
513
+
514
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
515
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
516
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
517
+			require_once GIVE_PLUGIN_DIR.'includes/import-functions.php';
518
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
519
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
520
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
521
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
522
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
523
+			require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php';
524
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
525
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
526
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
527
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
528
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
529
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
530
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php';
531
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
532
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
533
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
534
+
535
+			require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php';
536
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
537
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
538
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
539
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
540
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
541
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-sequential-donation-number.php';
542
+
543
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
544
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
545
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
546
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
547
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
548
+
549
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
550
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
551
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php';
552
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
553
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
554
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
555
+
556
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php';
557
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donor-wall.php';
558
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donor-stats.php';
559
+			require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php';
560
+			require_once GIVE_PLUGIN_DIR.'includes/donors/frontend-donor-functions.php';
561
+			require_once GIVE_PLUGIN_DIR.'includes/donors/actions.php';
562
+
563
+			require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php';
564
+
565
+			require_once GIVE_PLUGIN_DIR.'blocks/load.php';
566
+
567
+			if (defined('WP_CLI') && WP_CLI) {
568
+				require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
569 569
 			}
570 570
 
571
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
572
-
573
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
574
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
575
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
576
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
577
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
578
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
579
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
580
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
581
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
582
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
583
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
584
-
585
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
586
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
587
-
588
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
589
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
590
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
591
-
592
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
593
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-give-form-duplicator.php';
594
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
595
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
596
-
597
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
598
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
599
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
600
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
601
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-functions.php';
602
-
603
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
604
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
605
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
606
-
607
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
608
-
609
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
610
-
611
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
612
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
613
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
614
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
615
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
616
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
617
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
618
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-grid.php';
619
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
620
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
621
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php';
622
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donor-wall.php';
571
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
572
+
573
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
574
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
575
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
576
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
577
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
578
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
579
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
580
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
581
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
582
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
583
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php';
584
+
585
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
586
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
587
+
588
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php';
589
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php';
590
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php';
591
+
592
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
593
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-give-form-duplicator.php';
594
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
595
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
596
+
597
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php';
598
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php';
599
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php';
600
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php';
601
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-functions.php';
602
+
603
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php';
604
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php';
605
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php';
606
+
607
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php';
608
+
609
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php';
610
+
611
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
612
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
613
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
614
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
615
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
616
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
617
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
618
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-grid.php';
619
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
620
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
621
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-totals.php';
622
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donor-wall.php';
623 623
 			}// End if().
624 624
 
625
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
625
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
626 626
 
627 627
 		}
628 628
 
@@ -637,16 +637,16 @@  discard block
 block discarded – undo
637 637
 		public function load_textdomain() {
638 638
 
639 639
 			// Set filter for Give's languages directory
640
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
641
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
640
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
641
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
642 642
 
643 643
 			// Traditional WordPress plugin locale filter.
644
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
645
-			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
644
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
645
+			$locale = apply_filters('plugin_locale', $locale, 'give');
646 646
 
647
-			unload_textdomain( 'give' );
648
-			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
649
-			load_plugin_textdomain( 'give', false, $give_lang_dir );
647
+			unload_textdomain('give');
648
+			load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo');
649
+			load_plugin_textdomain('give', false, $give_lang_dir);
650 650
 
651 651
 		}
652 652
 
@@ -659,21 +659,21 @@  discard block
 block discarded – undo
659 659
 		 */
660 660
 		public function minimum_phpversion_notice() {
661 661
 			// Bailout.
662
-			if ( ! is_admin() ) {
662
+			if ( ! is_admin()) {
663 663
 				return;
664 664
 			}
665 665
 
666
-			$notice_desc  = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
667
-			$notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>';
668
-			$notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>';
669
-			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
670
-			$notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>';
671
-			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
672
-			$notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>';
666
+			$notice_desc  = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
667
+			$notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>';
668
+			$notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>';
669
+			$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
670
+			$notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>';
671
+			$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
672
+			$notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>';
673 673
 
674 674
 			echo sprintf(
675 675
 				'<div class="notice notice-error">%1$s</div>',
676
-				wp_kses_post( $notice_desc )
676
+				wp_kses_post($notice_desc)
677 677
 			);
678 678
 		}
679 679
 
Please login to merge, or discard this patch.
includes/emails/functions.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_email_donation_receipt( $payment_id, $admin_notice = true ) {
29
+function give_email_donation_receipt($payment_id, $admin_notice = true) {
30 30
 	/**
31 31
 	 * Fire the action
32 32
 	 */
33
-	do_action( 'give_donation-receipt_email_notification', $payment_id );
33
+	do_action('give_donation-receipt_email_notification', $payment_id);
34 34
 
35 35
 	// If admin notifications are on, send the admin notice.
36
-	if ( $admin_notice && give_is_setting_enabled( Give_Email_Notification::get_instance('new-donation' )->get_notification_status() ) ) {
36
+	if ($admin_notice && give_is_setting_enabled(Give_Email_Notification::get_instance('new-donation')->get_notification_status())) {
37 37
 		/**
38 38
 		 * Fires in the donation email receipt.
39 39
 		 *
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		 * @param int   $payment_id   Payment id.
45 45
 		 * @param mixed $payment_data Payment meta data.
46 46
 		 */
47
-		do_action( 'give_new-donation_email_notification', $payment_id, give_get_payment_meta( $payment_id ) );
47
+		do_action('give_new-donation_email_notification', $payment_id, give_get_payment_meta($payment_id));
48 48
 	}
49 49
 }
50 50
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
  *
58 58
  * @return void
59 59
  */
60
-function give_admin_email_notice( $payment_id ) {
60
+function give_admin_email_notice($payment_id) {
61 61
 	/**
62 62
 	 * Fires in the donation email receipt.
63 63
 	 *
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 	 * @param int   $payment_id   Payment id.
69 69
 	 * @param mixed $payment_data Payment meta data.
70 70
 	 */
71
-	do_action( 'give_new-donation_email_notification', $payment_id );
71
+	do_action('give_new-donation_email_notification', $payment_id);
72 72
 }
73 73
 
74
-add_action( 'give_admin_donation_email', 'give_admin_email_notice' );
74
+add_action('give_admin_donation_email', 'give_admin_email_notice');
75 75
 
76 76
 
77 77
 /**
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
  */
85 85
 function give_get_default_donation_notification_email() {
86 86
 
87
-	$default_email_body = __( 'Hi there,', 'give' ) . "\n\n";
88
-	$default_email_body .= __( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' {site_url}' . ".\n\n";
89
-	$default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {name}' . "\n";
90
-	$default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
91
-	$default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n";
92
-	$default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n";
93
-	$default_email_body .= __( 'Thank you,', 'give' ) . "\n\n";
94
-	$default_email_body .= '{sitename}' . "\n";
87
+	$default_email_body = __('Hi there,', 'give')."\n\n";
88
+	$default_email_body .= __('This email is to inform you that a new donation has been made on your website:', 'give').' {site_url}'.".\n\n";
89
+	$default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {name}'."\n";
90
+	$default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n";
91
+	$default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n";
92
+	$default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n";
93
+	$default_email_body .= __('Thank you,', 'give')."\n\n";
94
+	$default_email_body .= '{sitename}'."\n";
95 95
 
96
-	return apply_filters( 'give_default_donation_notification_email', $default_email_body );
96
+	return apply_filters('give_default_donation_notification_email', $default_email_body);
97 97
 }
98 98
 
99 99
 
@@ -107,21 +107,21 @@  discard block
 block discarded – undo
107 107
  */
108 108
 function give_get_default_donation_receipt_email() {
109 109
 
110
-	$default_email_body = __( 'Dear', 'give' ) . " {name},\n\n";
111
-	$default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n";
112
-	$default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
113
-	$default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
114
-	$default_email_body .= '<strong>' . __( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n";
115
-	$default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n";
116
-	$default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n";
117
-	$default_email_body .= '<strong>' . __( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n";
118
-	$default_email_body .= '<strong>' . __( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n";
119
-	$default_email_body .= '{receipt_link}' . "\n\n";
110
+	$default_email_body = __('Dear', 'give')." {name},\n\n";
111
+	$default_email_body .= __('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n";
112
+	$default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
113
+	$default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n";
114
+	$default_email_body .= '<strong>'.__('Donation Date:', 'give').'</strong> {date}'."\n";
115
+	$default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n";
116
+	$default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n";
117
+	$default_email_body .= '<strong>'.__('Payment ID:', 'give').'</strong> {payment_id}'."\n";
118
+	$default_email_body .= '<strong>'.__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n";
119
+	$default_email_body .= '{receipt_link}'."\n\n";
120 120
 	$default_email_body .= "\n\n";
121
-	$default_email_body .= __( 'Sincerely,', 'give' ) . "\n";
122
-	$default_email_body .= '{sitename}' . "\n";
121
+	$default_email_body .= __('Sincerely,', 'give')."\n";
122
+	$default_email_body .= '{sitename}'."\n";
123 123
 
124
-	return apply_filters( 'give_default_donation_receipt_email', $default_email_body );
124
+	return apply_filters('give_default_donation_receipt_email', $default_email_body);
125 125
 }
126 126
 
127 127
 /**
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
  *
135 135
  * @return array $email_names
136 136
  */
137
-function give_get_email_names( $user_info, $payment = false ) {
137
+function give_get_email_names($user_info, $payment = false) {
138 138
 	$email_names = array();
139 139
 
140
-	if ( is_a( $payment, 'Give_Payment' ) ) {
140
+	if (is_a($payment, 'Give_Payment')) {
141 141
 
142
-		if ( $payment->user_id > 0 ) {
142
+		if ($payment->user_id > 0) {
143 143
 
144
-			$user_data               = get_userdata( $payment->user_id );
144
+			$user_data               = get_userdata($payment->user_id);
145 145
 			$email_names['name']     = $payment->first_name;
146
-			$email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name );
146
+			$email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name);
147 147
 			$email_names['username'] = $user_data->user_login;
148 148
 
149
-		} elseif ( ! empty( $payment->first_name ) ) {
149
+		} elseif ( ! empty($payment->first_name)) {
150 150
 
151 151
 			$email_names['name']     = $payment->first_name;
152
-			$email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name );
152
+			$email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name);
153 153
 			$email_names['username'] = $payment->first_name;
154 154
 
155 155
 		} else {
@@ -161,29 +161,29 @@  discard block
 block discarded – undo
161 161
 	} else {
162 162
 
163 163
 		// Support for old serialized data.
164
-		if ( is_serialized( $user_info ) ) {
164
+		if (is_serialized($user_info)) {
165 165
 
166 166
 			// Security check.
167
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches );
168
-			if ( ! empty( $matches ) ) {
167
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches);
168
+			if ( ! empty($matches)) {
169 169
 				return array(
170 170
 					'name'     => '',
171 171
 					'fullname' => '',
172 172
 					'username' => '',
173 173
 				);
174 174
 			} else {
175
-				$user_info = maybe_unserialize( $user_info );
175
+				$user_info = maybe_unserialize($user_info);
176 176
 			}
177 177
 		}
178 178
 
179
-		if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) {
180
-			$user_data               = get_userdata( $user_info['id'] );
179
+		if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
180
+			$user_data               = get_userdata($user_info['id']);
181 181
 			$email_names['name']     = $user_info['first_name'];
182
-			$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
182
+			$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
183 183
 			$email_names['username'] = $user_data->user_login;
184
-		} elseif ( isset( $user_info['first_name'] ) ) {
184
+		} elseif (isset($user_info['first_name'])) {
185 185
 			$email_names['name']     = $user_info['first_name'];
186
-			$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
186
+			$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
187 187
 			$email_names['username'] = $user_info['first_name'];
188 188
 		} else {
189 189
 			$email_names['name']     = $user_info['email'];
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
 	} // End if().
193 193
 
194 194
 	// Set title prefix to name, if non empty.
195
-	if ( ! empty( $user_info['title'] ) && ! empty( $user_info['last_name'] ) ) {
196
-		$email_names['name'] = give_get_donor_name_with_title_prefixes( $user_info['title'], $user_info['last_name'] );
195
+	if ( ! empty($user_info['title']) && ! empty($user_info['last_name'])) {
196
+		$email_names['name'] = give_get_donor_name_with_title_prefixes($user_info['title'], $user_info['last_name']);
197 197
 	}
198 198
 
199 199
 	// Set title prefix to fullname, if non empty.
200
-	if ( ! empty( $user_info['title'] ) && ! empty( $email_names['fullname'] ) ) {
201
-		$email_names['fullname'] = give_get_donor_name_with_title_prefixes( $user_info['title'], $email_names['fullname'] );
200
+	if ( ! empty($user_info['title']) && ! empty($email_names['fullname'])) {
201
+		$email_names['fullname'] = give_get_donor_name_with_title_prefixes($user_info['title'], $email_names['fullname']);
202 202
 	}
203 203
 
204 204
 	return $email_names;
@@ -212,37 +212,37 @@  discard block
 block discarded – undo
212 212
  *
213 213
  * @since 1.8.14
214 214
  */
215
-function give_admin_email_user_donor_disconnection( $user_id, $donor_id ) {
215
+function give_admin_email_user_donor_disconnection($user_id, $donor_id) {
216 216
 
217
-	$user_id  = absint( $user_id );
218
-	$donor_id = absint( $donor_id );
217
+	$user_id  = absint($user_id);
218
+	$donor_id = absint($donor_id);
219 219
 
220 220
 	// Bail Out, if user id doesn't exists.
221
-	if ( empty( $user_id ) ) {
221
+	if (empty($user_id)) {
222 222
 		return;
223 223
 	}
224 224
 
225 225
 	// Bail Out, if donor id doesn't exists.
226
-	if ( empty( $donor_id ) ) {
226
+	if (empty($donor_id)) {
227 227
 		return;
228 228
 	}
229 229
 
230
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
230
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
231 231
 
232
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
232
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
233 233
 
234 234
 	/* translators: %s: payment id */
235
-	$subject = __( 'Attention: User tries to login whose Donor profile is disconnected!', 'give' );
235
+	$subject = __('Attention: User tries to login whose Donor profile is disconnected!', 'give');
236 236
 
237 237
 	/**
238 238
 	 * Filters the Donor-User Disconnection notification subject.
239 239
 	 *
240 240
 	 * @since 1.8.14
241 241
 	 */
242
-	$subject = apply_filters( 'give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags( $subject ) );
242
+	$subject = apply_filters('give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags($subject));
243 243
 
244
-	$headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
245
-	$headers .= "Reply-To: " . $from_email . "\r\n";
244
+	$headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n";
245
+	$headers .= "Reply-To: ".$from_email."\r\n";
246 246
 	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
247 247
 
248 248
 	/**
@@ -250,25 +250,25 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @since 1.8.14
252 252
 	 */
253
-	$headers = apply_filters( 'give_admin_donor_user_disconnection_notification_headers', $headers );
253
+	$headers = apply_filters('give_admin_donor_user_disconnection_notification_headers', $headers);
254 254
 
255
-	$message = __( 'Hi Admin,', 'give' ) . "\n\n";
256
-	$message .= __( 'This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give' ) . "\n\n";
257
-	$message .= __( 'Do you want to reconnect User and Donor profile again?', 'give' ) . "\n\n";
255
+	$message = __('Hi Admin,', 'give')."\n\n";
256
+	$message .= __('This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give')."\n\n";
257
+	$message .= __('Do you want to reconnect User and Donor profile again?', 'give')."\n\n";
258 258
 	$message .= sprintf(
259 259
 		'<a href="%1$s">%2$s</a>',
260
-		esc_url( admin_url() . 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id . '&user_id=' . $user_id . '&give-messages[]=reconnect-user' ),
261
-		__( 'Reconnect User', 'give' ) . "\n\n"
260
+		esc_url(admin_url().'edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id.'&user_id='.$user_id.'&give-messages[]=reconnect-user'),
261
+		__('Reconnect User', 'give')."\n\n"
262 262
 	);
263
-	$message .= __( 'Thank you,', 'give' ) . "\n\n";
264
-	$message .= '{sitename}' . "\n";
263
+	$message .= __('Thank you,', 'give')."\n\n";
264
+	$message .= '{sitename}'."\n";
265 265
 
266 266
 	$emails = Give()->emails;
267
-	$emails->__set( 'from_name', $from_name );
268
-	$emails->__set( 'from_email', $from_email );
269
-	$emails->__set( 'headers', $headers );
270
-	$emails->__set( 'heading', __( 'User - Donor Profile Disconnection', 'give' ) );
267
+	$emails->__set('from_name', $from_name);
268
+	$emails->__set('from_email', $from_email);
269
+	$emails->__set('headers', $headers);
270
+	$emails->__set('heading', __('User - Donor Profile Disconnection', 'give'));
271 271
 
272
-	$emails->send( give_get_admin_notice_emails(), $subject, give_do_email_tags( $message ) );
272
+	$emails->send(give_get_admin_notice_emails(), $subject, give_do_email_tags($message));
273 273
 
274 274
 }
Please login to merge, or discard this patch.
includes/emails/class-give-email-tags.php 1 patch
Spacing   +286 added lines, -286 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 // Exit if accessed directly.
26
-if ( ! defined( 'ABSPATH' ) ) {
26
+if ( ! defined('ABSPATH')) {
27 27
 	exit;
28 28
 }
29 29
 
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	 * @param callable $func        Hook to run when email tag is found
57 57
 	 * @param string   $context     Email tag category
58 58
 	 */
59
-	public function add( $tag, $description, $func, $context = '' ) {
60
-		if ( is_callable( $func ) ) {
61
-			$this->tags[ $tag ] = array(
59
+	public function add($tag, $description, $func, $context = '') {
60
+		if (is_callable($func)) {
61
+			$this->tags[$tag] = array(
62 62
 				'tag'         => $tag,
63 63
 				'description' => $description,
64 64
 				'func'        => $func,
65
-				'context'     => give_check_variable( $context, 'empty', 'general' ),
65
+				'context'     => give_check_variable($context, 'empty', 'general'),
66 66
 			);
67 67
 		}
68 68
 	}
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @param string $tag Email tag to remove hook from
76 76
 	 */
77
-	public function remove( $tag ) {
78
-		unset( $this->tags[ $tag ] );
77
+	public function remove($tag) {
78
+		unset($this->tags[$tag]);
79 79
 	}
80 80
 
81 81
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return bool
89 89
 	 */
90
-	public function email_tag_exists( $tag ) {
91
-		return array_key_exists( $tag, $this->tags );
90
+	public function email_tag_exists($tag) {
91
+		return array_key_exists($tag, $this->tags);
92 92
 	}
93 93
 
94 94
 	/**
@@ -102,23 +102,23 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @return array
104 104
 	 */
105
-	public function get_tags( $context_type = 'all', $field = '' ) {
105
+	public function get_tags($context_type = 'all', $field = '') {
106 106
 		$tags = $this->tags;
107 107
 
108
-		if ( 'all' !== $context_type ) {
108
+		if ('all' !== $context_type) {
109 109
 			$tags = array();
110 110
 
111
-			foreach ( $this->tags as $tag ) {
112
-				if ( empty( $tag['context'] ) || $context_type !== $tag['context'] ) {
111
+			foreach ($this->tags as $tag) {
112
+				if (empty($tag['context']) || $context_type !== $tag['context']) {
113 113
 					continue;
114 114
 				}
115 115
 
116
-				$tags[ $tag['tag'] ] = $tag;
116
+				$tags[$tag['tag']] = $tag;
117 117
 			}
118 118
 		}
119 119
 
120
-		if ( ! empty( $tags ) && ! empty( $field ) ) {
121
-			$tags = wp_list_pluck( $tags, $field );
120
+		if ( ! empty($tags) && ! empty($field)) {
121
+			$tags = wp_list_pluck($tags, $field);
122 122
 		}
123 123
 
124 124
 		return $tags;
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @return string Content with email tags filtered out.
138 138
 	 */
139
-	public function do_tags( $content, $tag_args ) {
139
+	public function do_tags($content, $tag_args) {
140 140
 
141 141
 		// Check if there is at least one tag added.
142
-		if ( empty( $this->tags ) || ! is_array( $this->tags ) ) {
142
+		if (empty($this->tags) || ! is_array($this->tags)) {
143 143
 			return $content;
144 144
 		}
145 145
 
146 146
 		$this->tag_args = $tag_args;
147 147
 
148
-		$new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content );
148
+		$new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content);
149 149
 
150 150
 		$this->tag_args = null;
151 151
 
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @return mixed
163 163
 	 */
164
-	public function do_tag( $m ) {
164
+	public function do_tag($m) {
165 165
 
166 166
 		// Get tag
167 167
 		$tag = $m[1];
168 168
 
169 169
 		// Return tag if tag not set
170
-		if ( ! $this->email_tag_exists( $tag ) ) {
170
+		if ( ! $this->email_tag_exists($tag)) {
171 171
 			return $m[0];
172 172
 		}
173 173
 
174
-		return call_user_func( $this->tags[ $tag ]['func'], $this->tag_args, $tag );
174
+		return call_user_func($this->tags[$tag]['func'], $this->tag_args, $tag);
175 175
 	}
176 176
 
177 177
 }
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
  * @param callable $func        Hook to run when email tag is found
187 187
  * @param string   $context     Email tag category
188 188
  */
189
-function give_add_email_tag( $tag, $description, $func, $context = '' ) {
190
-	Give()->email_tags->add( $tag, $description, $func, $context );
189
+function give_add_email_tag($tag, $description, $func, $context = '') {
190
+	Give()->email_tags->add($tag, $description, $func, $context);
191 191
 }
192 192
 
193 193
 /**
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
  *
198 198
  * @param string $tag Email tag to remove hook from
199 199
  */
200
-function give_remove_email_tag( $tag ) {
201
-	Give()->email_tags->remove( $tag );
200
+function give_remove_email_tag($tag) {
201
+	Give()->email_tags->remove($tag);
202 202
 }
203 203
 
204 204
 /**
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
  *
211 211
  * @return bool
212 212
  */
213
-function give_email_tag_exists( $tag ) {
214
-	return Give()->email_tags->email_tag_exists( $tag );
213
+function give_email_tag_exists($tag) {
214
+	return Give()->email_tags->email_tag_exists($tag);
215 215
 }
216 216
 
217 217
 /**
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 	$email_tags = give_get_email_tags();
239 239
 
240 240
 	ob_start();
241
-	if ( count( $email_tags ) > 0 ) : ?>
241
+	if (count($email_tags) > 0) : ?>
242 242
 		<div class="give-email-tags-wrap">
243
-			<?php foreach ( $email_tags as $email_tag ) : ?>
243
+			<?php foreach ($email_tags as $email_tag) : ?>
244 244
 				<span class="give_<?php echo $email_tag['tag']; ?>_tag">
245 245
 					<code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?>
246 246
 				</span>
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
  *
265 265
  * @return string Content with email tags filtered out.
266 266
  */
267
-function give_do_email_tags( $content, $tag_args ) {
267
+function give_do_email_tags($content, $tag_args) {
268 268
 	// Backward compatibility < 2.0
269
-	if ( ! is_array( $tag_args ) && is_numeric( $tag_args ) ) {
270
-		$tag_args = array( 'payment_id' => $tag_args );
269
+	if ( ! is_array($tag_args) && is_numeric($tag_args)) {
270
+		$tag_args = array('payment_id' => $tag_args);
271 271
 	}
272 272
 
273 273
 	$email_tags = Give()->email_tags instanceof Give_Email_Template_Tags
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		: new Give_Email_Template_Tags();
276 276
 
277 277
 	// Replace all tags
278
-	$content = $email_tags->do_tags( $content, $tag_args );
278
+	$content = $email_tags->do_tags($content, $tag_args);
279 279
 
280 280
 	/**
281 281
 	 * Filter the filtered content text.
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 * @since 1.0
284 284
 	 * @since 2.0 $payment_meta, $payment_id removed and $tag_args added.
285 285
 	 */
286
-	$content = apply_filters( 'give_email_template_tags', $content, $tag_args );
286
+	$content = apply_filters('give_email_template_tags', $content, $tag_args);
287 287
 
288 288
 	// Return content
289 289
 	return $content;
@@ -302,10 +302,10 @@  discard block
 block discarded – undo
302 302
 	 *
303 303
 	 * @since 1.0
304 304
 	 */
305
-	do_action( 'give_add_email_tags' );
305
+	do_action('give_add_email_tags');
306 306
 }
307 307
 
308
-add_action( 'init', 'give_load_email_tags', - 999 );
308
+add_action('init', 'give_load_email_tags', - 999);
309 309
 
310 310
 
311 311
 /**
@@ -320,67 +320,67 @@  discard block
 block discarded – undo
320 320
 		/*	Donation Payment */
321 321
 		array(
322 322
 			'tag'         => 'donation',
323
-			'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ),
323
+			'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'),
324 324
 			'function'    => 'give_email_tag_donation',
325 325
 			'context'     => 'donation',
326 326
 		),
327 327
 		array(
328 328
 			'tag'         => 'amount',
329
-			'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
329
+			'description' => esc_html__('The total donation amount with currency sign.', 'give'),
330 330
 			'function'    => 'give_email_tag_amount',
331 331
 			'context'     => 'donation',
332 332
 		),
333 333
 		array(
334 334
 			'tag'         => 'price',
335
-			'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
335
+			'description' => esc_html__('The total donation amount with currency sign.', 'give'),
336 336
 			'function'    => 'give_email_tag_price',
337 337
 			'context'     => 'donation',
338 338
 		),
339 339
 		array(
340 340
 			'tag'         => 'billing_address',
341
-			'description' => esc_html__( 'The donor\'s billing address.', 'give' ),
341
+			'description' => esc_html__('The donor\'s billing address.', 'give'),
342 342
 			'function'    => 'give_email_tag_billing_address',
343 343
 			'context'     => 'donation',
344 344
 		),
345 345
 		array(
346 346
 			'tag'         => 'date',
347
-			'description' => esc_html__( 'The date of the donation.', 'give' ),
347
+			'description' => esc_html__('The date of the donation.', 'give'),
348 348
 			'function'    => 'give_email_tag_date',
349 349
 			'context'     => 'donation',
350 350
 		),
351 351
 		array(
352 352
 			'tag'         => 'payment_id',
353
-			'description' => esc_html__( 'The unique ID number for this donation.', 'give' ),
353
+			'description' => esc_html__('The unique ID number for this donation.', 'give'),
354 354
 			'function'    => 'give_email_tag_payment_id',
355 355
 			'context'     => 'donation',
356 356
 		),
357 357
 		array(
358 358
 			'tag'         => 'payment_method',
359
-			'description' => esc_html__( 'The method of payment used for this donation.', 'give' ),
359
+			'description' => esc_html__('The method of payment used for this donation.', 'give'),
360 360
 			'function'    => 'give_email_tag_payment_method',
361 361
 			'context'     => 'donation',
362 362
 		),
363 363
 		array(
364 364
 			'tag'         => 'payment_total',
365
-			'description' => esc_html__( 'The payment total for this donation.', 'give' ),
365
+			'description' => esc_html__('The payment total for this donation.', 'give'),
366 366
 			'function'    => 'give_email_tag_payment_total',
367 367
 			'context'     => 'donation',
368 368
 		),
369 369
 		array(
370 370
 			'tag'         => 'receipt_id',
371
-			'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ),
371
+			'description' => esc_html__('The unique ID number for this donation receipt.', 'give'),
372 372
 			'function'    => 'give_email_tag_receipt_id',
373 373
 			'context'     => 'donation',
374 374
 		),
375 375
 		array(
376 376
 			'tag'         => 'receipt_link',
377
-			'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ),
377
+			'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'),
378 378
 			'function'    => 'give_email_tag_receipt_link',
379 379
 			'context'     => 'donation',
380 380
 		),
381 381
 		array(
382 382
 			'tag'         => 'receipt_link_url',
383
-			'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ),
383
+			'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'),
384 384
 			'function'    => 'give_email_tag_receipt_link_url',
385 385
 			'context'     => 'donation',
386 386
 		),
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 		/* Donation Form */
389 389
 		array(
390 390
 			'tag'         => 'form_title',
391
-			'description' => esc_html__( 'The donation form name.', 'give' ),
391
+			'description' => esc_html__('The donation form name.', 'give'),
392 392
 			'function'    => 'give_email_tag_form_title',
393 393
 			'context'     => 'form',
394 394
 		),
@@ -396,37 +396,37 @@  discard block
 block discarded – undo
396 396
 		/* Donor */
397 397
 		array(
398 398
 			'tag'         => 'name',
399
-			'description' => esc_html__( 'The donor\'s first name.', 'give' ),
399
+			'description' => esc_html__('The donor\'s first name.', 'give'),
400 400
 			'function'    => 'give_email_tag_first_name',
401 401
 			'context'     => 'donor',
402 402
 		),
403 403
 		array(
404 404
 			'tag'         => 'fullname',
405
-			'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ),
405
+			'description' => esc_html__('The donor\'s full name, first and last.', 'give'),
406 406
 			'function'    => 'give_email_tag_fullname',
407 407
 			'context'     => 'donor',
408 408
 		),
409 409
 		array(
410 410
 			'tag'         => 'username',
411
-			'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ),
411
+			'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'),
412 412
 			'function'    => 'give_email_tag_username',
413 413
 			'context'     => 'donor',
414 414
 		),
415 415
 		array(
416 416
 			'tag'         => 'company_name',
417
-			'description' => esc_html__( 'Company name.', 'give' ),
417
+			'description' => esc_html__('Company name.', 'give'),
418 418
 			'function'    => 'give_email_tag_company_name',
419 419
 			'context'     => 'donation',
420 420
 		),
421 421
 		array(
422 422
 			'tag'         => 'user_email',
423
-			'description' => esc_html__( 'The donor\'s email address.', 'give' ),
423
+			'description' => esc_html__('The donor\'s email address.', 'give'),
424 424
 			'function'    => 'give_email_tag_user_email',
425 425
 			'context'     => 'donor',
426 426
 		),
427 427
 		array(
428 428
 			'tag'         => 'email_access_link',
429
-			'description' => esc_html__( 'The donor\'s email access link.', 'give' ),
429
+			'description' => esc_html__('The donor\'s email access link.', 'give'),
430 430
 			'function'    => 'give_email_tag_email_access_link',
431 431
 			'context'     => 'donor',
432 432
 		),
@@ -434,35 +434,35 @@  discard block
 block discarded – undo
434 434
 		/* General */
435 435
 		array(
436 436
 			'tag'         => 'sitename',
437
-			'description' => esc_html__( 'The name of your site.', 'give' ),
437
+			'description' => esc_html__('The name of your site.', 'give'),
438 438
 			'function'    => 'give_email_tag_sitename',
439 439
 			'context'     => 'general',
440 440
 		),
441 441
 
442 442
 		array(
443 443
 			'tag'         => 'reset_password_link',
444
-			'description' => esc_html__( 'The reset password link for user.', 'give' ),
444
+			'description' => esc_html__('The reset password link for user.', 'give'),
445 445
 			'function'    => 'give_email_tag_reset_password_link',
446 446
 			'context'     => 'general',
447 447
 		),
448 448
 
449 449
 		array(
450 450
 			'tag'         => 'admin_email',
451
-			'description' => esc_html__( 'The custom admin email which is set inside Emails > Contact Information. By default this tag will use your WordPress admin email.', 'give' ),
451
+			'description' => esc_html__('The custom admin email which is set inside Emails > Contact Information. By default this tag will use your WordPress admin email.', 'give'),
452 452
 			'function'    => 'give_email_admin_email',
453 453
 			'context'     => 'general',
454 454
 		),
455 455
 
456 456
 		array(
457 457
 			'tag'         => 'site_url',
458
-			'description' => esc_html__( 'The website URL.', 'give' ),
458
+			'description' => esc_html__('The website URL.', 'give'),
459 459
 			'function'    => 'give_email_site_url',
460 460
 			'context'     => 'general',
461 461
 		),
462 462
 
463 463
 		array(
464 464
 			'tag'         => 'offline_mailing_address',
465
-			'description' => esc_html__( 'The Offline Mailing Address which is used for the Offline Donations Payment Gateway.', 'give' ),
465
+			'description' => esc_html__('The Offline Mailing Address which is used for the Offline Donations Payment Gateway.', 'give'),
466 466
 			'function'    => 'give_email_offline_mailing_address',
467 467
 			'context'     => 'general',
468 468
 		),
@@ -470,21 +470,21 @@  discard block
 block discarded – undo
470 470
 	);
471 471
 
472 472
 	// Apply give_email_tags filter
473
-	$email_tags = apply_filters( 'give_email_tags', $email_tags );
473
+	$email_tags = apply_filters('give_email_tags', $email_tags);
474 474
 
475 475
 	// Add email tags
476
-	foreach ( $email_tags as $email_tag ) {
476
+	foreach ($email_tags as $email_tag) {
477 477
 		give_add_email_tag(
478 478
 			$email_tag['tag'],
479 479
 			$email_tag['description'],
480 480
 			$email_tag['function'],
481
-			( ! empty( $email_tag['context'] ) ? $email_tag['context'] : '' )
481
+			( ! empty($email_tag['context']) ? $email_tag['context'] : '')
482 482
 		);
483 483
 	}
484 484
 
485 485
 }
486 486
 
487
-add_action( 'give_add_email_tags', 'give_setup_email_tags' );
487
+add_action('give_add_email_tags', 'give_setup_email_tags');
488 488
 
489 489
 
490 490
 /**
@@ -496,24 +496,24 @@  discard block
 block discarded – undo
496 496
  *
497 497
  * @return string $firstname
498 498
  */
499
-function give_email_tag_first_name( $tag_args ) {
499
+function give_email_tag_first_name($tag_args) {
500 500
 	$user_info = array();
501 501
 	$firstname = '';
502 502
 
503 503
 	// Backward compatibility.
504
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
504
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
505 505
 
506
-	switch ( true ) {
507
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
508
-			$donor_info  = give_get_payment_meta_user_info( $tag_args['payment_id'] );
509
-			$email_names = give_get_email_names( $donor_info );
506
+	switch (true) {
507
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
508
+			$donor_info  = give_get_payment_meta_user_info($tag_args['payment_id']);
509
+			$email_names = give_get_email_names($donor_info);
510 510
 			$firstname   = $email_names['name'];
511 511
 
512 512
 			break;
513 513
 
514
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
514
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
515 515
 			$firstname = Give()->donor_meta->get_meta(
516
-				Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ),
516
+				Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']),
517 517
 				'_give_donor_first_name',
518 518
 				true
519 519
 			);
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
 		 *
525 525
 		 * @since 2.0
526 526
 		 */
527
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
528
-			$firstname = Give()->donor_meta->get_meta( $tag_args['donor_id'], '_give_donor_first_name', true );
527
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
528
+			$firstname = Give()->donor_meta->get_meta($tag_args['donor_id'], '_give_donor_first_name', true);
529 529
 			break;
530 530
 	}
531 531
 
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 	 * @param string $firstname
538 538
 	 * @param array  $tag_args
539 539
 	 */
540
-	$firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args );
540
+	$firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args);
541 541
 
542 542
 	return $firstname;
543 543
 }
@@ -551,21 +551,21 @@  discard block
 block discarded – undo
551 551
  *
552 552
  * @return string $fullname
553 553
  */
554
-function give_email_tag_fullname( $tag_args ) {
554
+function give_email_tag_fullname($tag_args) {
555 555
 	$fullname = '';
556 556
 
557 557
 	// Backward compatibility.
558
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
558
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
559 559
 
560
-	switch ( true ) {
561
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
562
-			$donor_info  = give_get_payment_meta_user_info( $tag_args['payment_id'] );
563
-			$email_names = give_get_email_names( $donor_info );
560
+	switch (true) {
561
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
562
+			$donor_info  = give_get_payment_meta_user_info($tag_args['payment_id']);
563
+			$email_names = give_get_email_names($donor_info);
564 564
 			$fullname    = $email_names['fullname'];
565 565
 			break;
566 566
 
567
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
568
-			$fullname = Give()->donors->get_column_by( 'name', 'user_id', $tag_args['user_id'] );
567
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
568
+			$fullname = Give()->donors->get_column_by('name', 'user_id', $tag_args['user_id']);
569 569
 			break;
570 570
 
571 571
 		/**
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 		 *
574 574
 		 * @since 2.0
575 575
 		 */
576
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
577
-			$fullname = Give()->donors->get_column( 'name', $tag_args['donor_id'] );
576
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
577
+			$fullname = Give()->donors->get_column('name', $tag_args['donor_id']);
578 578
 			break;
579 579
 	}
580 580
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 	 * @param string $fullname
587 587
 	 * @param array  $tag_args
588 588
 	 */
589
-	$fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args );
589
+	$fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args);
590 590
 
591 591
 	return $fullname;
592 592
 }
@@ -600,21 +600,21 @@  discard block
 block discarded – undo
600 600
  *
601 601
  * @return string username.
602 602
  */
603
-function give_email_tag_username( $tag_args ) {
603
+function give_email_tag_username($tag_args) {
604 604
 	$username = '';
605 605
 
606 606
 	// Backward compatibility.
607
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
607
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
608 608
 
609
-	switch ( true ) {
610
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
611
-			$donor_info  = give_get_payment_meta_user_info( $tag_args['payment_id'] );
612
-			$email_names = give_get_email_names( $donor_info );
609
+	switch (true) {
610
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
611
+			$donor_info  = give_get_payment_meta_user_info($tag_args['payment_id']);
612
+			$email_names = give_get_email_names($donor_info);
613 613
 			$username    = $email_names['username'];
614 614
 			break;
615 615
 
616
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
617
-			$user_info = get_user_by( 'id', $tag_args['user_id'] );
616
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
617
+			$user_info = get_user_by('id', $tag_args['user_id']);
618 618
 			$username  = $user_info->user_login;
619 619
 			break;
620 620
 
@@ -623,9 +623,9 @@  discard block
 block discarded – undo
623 623
 		 *
624 624
 		 * @since 2.0
625 625
 		 */
626
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
627
-			if ( $user_id = Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ) {
628
-				$user_info = get_user_by( 'id', $user_id );
626
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
627
+			if ($user_id = Give()->donors->get_column('user_id', $tag_args['donor_id'])) {
628
+				$user_info = get_user_by('id', $user_id);
629 629
 				$username  = $user_info->user_login;
630 630
 			}
631 631
 			break;
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 	 * @param string $username
640 640
 	 * @param array  $tag_args
641 641
 	 */
642
-	$username = apply_filters( 'give_email_tag_username', $username, $tag_args );
642
+	$username = apply_filters('give_email_tag_username', $username, $tag_args);
643 643
 
644 644
 	return $username;
645 645
 }
@@ -653,19 +653,19 @@  discard block
 block discarded – undo
653 653
  *
654 654
  * @return string user_email
655 655
  */
656
-function give_email_tag_user_email( $tag_args ) {
656
+function give_email_tag_user_email($tag_args) {
657 657
 	$email = '';
658 658
 
659 659
 	// Backward compatibility.
660
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
660
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
661 661
 
662
-	switch ( true ) {
663
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
664
-			$email = give_get_donation_donor_email( $tag_args['payment_id'] );
662
+	switch (true) {
663
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
664
+			$email = give_get_donation_donor_email($tag_args['payment_id']);
665 665
 			break;
666 666
 
667
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
668
-			$user_info = get_user_by( 'id', $tag_args['user_id'] );
667
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
668
+			$user_info = get_user_by('id', $tag_args['user_id']);
669 669
 			$email     = $user_info->user_email;
670 670
 			break;
671 671
 
@@ -674,8 +674,8 @@  discard block
 block discarded – undo
674 674
 		 *
675 675
 		 * @since 2.0
676 676
 		 */
677
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
678
-			$email = Give()->donors->get_column( 'email', $tag_args['donor_id'] );
677
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
678
+			$email = Give()->donors->get_column('email', $tag_args['donor_id']);
679 679
 			break;
680 680
 	}
681 681
 
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 	 * @param string $email
688 688
 	 * @param array  $tag_args
689 689
 	 */
690
-	$email = apply_filters( 'give_email_tag_user_email', $email, $tag_args );
690
+	$email = apply_filters('give_email_tag_user_email', $email, $tag_args);
691 691
 
692 692
 	return $email;
693 693
 }
@@ -701,22 +701,22 @@  discard block
 block discarded – undo
701 701
  *
702 702
  * @return string billing_address
703 703
  */
704
-function give_email_tag_billing_address( $tag_args ) {
704
+function give_email_tag_billing_address($tag_args) {
705 705
 	$address = '';
706 706
 
707 707
 	// Backward compatibility.
708
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
708
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
709 709
 
710
-	switch ( true ) {
711
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
712
-			$donation_address = give_get_donation_address( $tag_args['payment_id'] );
710
+	switch (true) {
711
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
712
+			$donation_address = give_get_donation_address($tag_args['payment_id']);
713 713
 
714 714
 			$billing_address                   = array();
715 715
 			$billing_address['street_address'] = '';
716 716
 			$billing_address['street_address'] .= $donation_address['line1'];
717 717
 
718
-			if ( ! empty( $donation_address['line2'] ) ) {
719
-				$billing_address['street_address'] .= "\n" . $donation_address['line2'];
718
+			if ( ! empty($donation_address['line2'])) {
719
+				$billing_address['street_address'] .= "\n".$donation_address['line2'];
720 720
 			}
721 721
 
722 722
 			$billing_address['city']        = $donation_address['city'];
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 			$billing_address['postal_code'] = $donation_address['zip'];
725 725
 			$billing_address['country']     = $donation_address['country'];
726 726
 
727
-			$address = give_get_formatted_address( $billing_address );
727
+			$address = give_get_formatted_address($billing_address);
728 728
 
729 729
 			break;
730 730
 	}
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 	 * @param string $address
738 738
 	 * @param array  $tag_args
739 739
 	 */
740
-	$address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args );
740
+	$address = apply_filters('give_email_tag_billing_address', $address, $tag_args);
741 741
 
742 742
 	return $address;
743 743
 }
@@ -751,15 +751,15 @@  discard block
 block discarded – undo
751 751
  *
752 752
  * @return string $date Post Date.
753 753
  */
754
-function give_email_tag_date( $tag_args ) {
754
+function give_email_tag_date($tag_args) {
755 755
 	$date = '';
756 756
 
757 757
 	// Backward compatibility.
758
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
758
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
759 759
 
760
-	switch ( true ) {
761
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
762
-			$date = date_i18n( give_date_format(), get_the_date( 'U', $tag_args['payment_id'] ) );
760
+	switch (true) {
761
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
762
+			$date = date_i18n(give_date_format(), get_the_date('U', $tag_args['payment_id']));
763 763
 			break;
764 764
 	}
765 765
 
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 	 * @param string $date
772 772
 	 * @param array $tag_args
773 773
 	 */
774
-	$date = apply_filters( 'give_email_tag_date', $date, $tag_args );
774
+	$date = apply_filters('give_email_tag_date', $date, $tag_args);
775 775
 
776 776
 	return $date;
777 777
 }
@@ -785,16 +785,16 @@  discard block
 block discarded – undo
785 785
  *
786 786
  * @return string amount
787 787
  */
788
-function give_email_tag_amount( $tag_args ) {
788
+function give_email_tag_amount($tag_args) {
789 789
 	$amount = '';
790 790
 
791 791
 	// Backward compatibility.
792
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
792
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
793 793
 
794
-	switch ( true ) {
795
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
796
-			$give_amount = give_donation_amount( $tag_args['payment_id'], true );
797
-			$amount      = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' );
794
+	switch (true) {
795
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
796
+			$give_amount = give_donation_amount($tag_args['payment_id'], true);
797
+			$amount      = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8');
798 798
 			break;
799 799
 	}
800 800
 
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 	 * @param string $amount
807 807
 	 * @param array  $tag_args
808 808
 	 */
809
-	$amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args );
809
+	$amount = apply_filters('give_email_tag_amount', $amount, $tag_args);
810 810
 
811 811
 	return $amount;
812 812
 }
@@ -820,8 +820,8 @@  discard block
 block discarded – undo
820 820
  *
821 821
  * @return string price
822 822
  */
823
-function give_email_tag_price( $tag_args ) {
824
-	return give_email_tag_amount( $tag_args );
823
+function give_email_tag_price($tag_args) {
824
+	return give_email_tag_amount($tag_args);
825 825
 }
826 826
 
827 827
 /**
@@ -833,15 +833,15 @@  discard block
 block discarded – undo
833 833
  *
834 834
  * @return int payment_id
835 835
  */
836
-function give_email_tag_payment_id( $tag_args ) {
836
+function give_email_tag_payment_id($tag_args) {
837 837
 	$payment_id = '';
838 838
 
839 839
 	// Backward compatibility.
840
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
840
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
841 841
 
842
-	switch ( true ) {
843
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
844
-			$payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] );
842
+	switch (true) {
843
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
844
+			$payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']);
845 845
 			break;
846 846
 	}
847 847
 
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 	 * @param string $payment_id
854 854
 	 * @param array  $tag_args
855 855
 	 */
856
-	return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args );
856
+	return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args);
857 857
 }
858 858
 
859 859
 /**
@@ -865,15 +865,15 @@  discard block
 block discarded – undo
865 865
  *
866 866
  * @return string receipt_id
867 867
  */
868
-function give_email_tag_receipt_id( $tag_args ) {
868
+function give_email_tag_receipt_id($tag_args) {
869 869
 	$receipt_id = '';
870 870
 
871 871
 	// Backward compatibility.
872
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
872
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
873 873
 
874
-	switch ( true ) {
875
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
876
-			$receipt_id = give_get_payment_key( $tag_args['payment_id'] );
874
+	switch (true) {
875
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
876
+			$receipt_id = give_get_payment_key($tag_args['payment_id']);
877 877
 			break;
878 878
 	}
879 879
 
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 	 * @param string $receipt_id
886 886
 	 * @param array  $tag_args
887 887
 	 */
888
-	return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args );
888
+	return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args);
889 889
 }
890 890
 
891 891
 /**
@@ -897,21 +897,21 @@  discard block
 block discarded – undo
897 897
  *
898 898
  * @return string $form_title
899 899
  */
900
-function give_email_tag_donation( $tag_args ) {
900
+function give_email_tag_donation($tag_args) {
901 901
 	$donation_form_title = '';
902 902
 
903 903
 	// Backward compatibility.
904
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
904
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
905 905
 
906
-	switch ( true ) {
907
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
908
-			$level_title         = give_has_variable_prices( give_get_payment_form_id( $tag_args['payment_id'] ) );
906
+	switch (true) {
907
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
908
+			$level_title         = give_has_variable_prices(give_get_payment_form_id($tag_args['payment_id']));
909 909
 			$separator           = $level_title ? '-' : '';
910 910
 			$donation_form_title = strip_tags(
911 911
 				give_check_variable(
912 912
 					give_get_donation_form_title(
913 913
 						$tag_args['payment_id'],
914
-						array( 'separator' => $separator, )
914
+						array('separator' => $separator,)
915 915
 					),
916 916
 					'empty',
917 917
 					''
@@ -944,15 +944,15 @@  discard block
 block discarded – undo
944 944
  *
945 945
  * @return string $form_title
946 946
  */
947
-function give_email_tag_form_title( $tag_args ) {
947
+function give_email_tag_form_title($tag_args) {
948 948
 	$donation_form_title = '';
949 949
 
950 950
 	// Backward compatibility.
951
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
951
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
952 952
 
953
-	switch ( true ) {
954
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
955
-			$donation_form_title = give_get_payment_meta( $tag_args['payment_id'], '_give_payment_form_title' );
953
+	switch (true) {
954
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
955
+			$donation_form_title = give_get_payment_meta($tag_args['payment_id'], '_give_payment_form_title');
956 956
 			break;
957 957
 	}
958 958
 
@@ -981,15 +981,15 @@  discard block
 block discarded – undo
981 981
  *
982 982
  * @return string $company_name
983 983
  */
984
-function give_email_tag_company_name( $tag_args ) {
984
+function give_email_tag_company_name($tag_args) {
985 985
 	$company_name = '';
986 986
 
987 987
 	// Backward compatibility.
988
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
988
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
989 989
 
990
-	switch ( true ) {
991
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
992
-			$company_name = give_get_payment_meta( $tag_args['payment_id'], '_give_donation_company', true );
990
+	switch (true) {
991
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
992
+			$company_name = give_get_payment_meta($tag_args['payment_id'], '_give_donation_company', true);
993 993
 			break;
994 994
 	}
995 995
 
@@ -1017,18 +1017,18 @@  discard block
 block discarded – undo
1017 1017
  *
1018 1018
  * @return string gateway
1019 1019
  */
1020
-function give_email_tag_payment_method( $tag_args ) {
1020
+function give_email_tag_payment_method($tag_args) {
1021 1021
 	$payment_method = '';
1022 1022
 
1023 1023
 	// Backward compatibility.
1024
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1024
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1025 1025
 
1026 1026
 	// Backward compatibility.
1027
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1027
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1028 1028
 
1029
-	switch ( true ) {
1030
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1031
-			$payment_method = give_get_gateway_checkout_label( give_get_payment_gateway( $tag_args['payment_id'] ) );
1029
+	switch (true) {
1030
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1031
+			$payment_method = give_get_gateway_checkout_label(give_get_payment_gateway($tag_args['payment_id']));
1032 1032
 			break;
1033 1033
 	}
1034 1034
 
@@ -1059,15 +1059,15 @@  discard block
 block discarded – undo
1059 1059
  *
1060 1060
  * @return string
1061 1061
  */
1062
-function give_email_tag_payment_total( $tag_args ) {
1062
+function give_email_tag_payment_total($tag_args) {
1063 1063
 	$payment_total = '';
1064 1064
 
1065 1065
 	// Backward compatibility.
1066
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1066
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1067 1067
 
1068
-	switch ( true ) {
1069
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1070
-			$payment_total = give_currency_filter( give_get_payment_total( $tag_args['payment_id'] ) );
1068
+	switch (true) {
1069
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1070
+			$payment_total = give_currency_filter(give_get_payment_total($tag_args['payment_id']));
1071 1071
 			break;
1072 1072
 	}
1073 1073
 
@@ -1095,11 +1095,11 @@  discard block
 block discarded – undo
1095 1095
  *
1096 1096
  * @return string
1097 1097
  */
1098
-function give_email_tag_sitename( $tag_args = array() ) {
1099
-	$sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
1098
+function give_email_tag_sitename($tag_args = array()) {
1099
+	$sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
1100 1100
 
1101 1101
 	// Backward compatibility.
1102
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1102
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1103 1103
 
1104 1104
 	/**
1105 1105
 	 * Filter the {sitename} email template tag output.
@@ -1125,26 +1125,26 @@  discard block
 block discarded – undo
1125 1125
  *
1126 1126
  * @return string receipt_link
1127 1127
  */
1128
-function give_email_tag_receipt_link( $tag_args ) {
1128
+function give_email_tag_receipt_link($tag_args) {
1129 1129
 	// Backward compatibility.
1130
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1130
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1131 1131
 
1132
-	$receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) );
1132
+	$receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id'));
1133 1133
 
1134 1134
 	// Bailout.
1135
-	if ( give_get_option( 'email_template' ) === 'none' ) {
1135
+	if (give_get_option('email_template') === 'none') {
1136 1136
 		return $receipt_url;
1137 1137
 	}
1138 1138
 
1139 1139
 
1140
-	$receipt_url = esc_url( add_query_arg( array(
1141
-		'payment_key' => give_get_payment_key( $tag_args['payment_id'] ),
1142
-	), give_get_history_page_uri() ) );
1140
+	$receipt_url = esc_url(add_query_arg(array(
1141
+		'payment_key' => give_get_payment_key($tag_args['payment_id']),
1142
+	), give_get_history_page_uri()));
1143 1143
 
1144 1144
 	$formatted = sprintf(
1145 1145
 		'<a href="%1$s">%2$s</a>',
1146 1146
 		$receipt_url,
1147
-		__( 'View it in your browser &raquo;', 'give' )
1147
+		__('View it in your browser &raquo;', 'give')
1148 1148
 	);
1149 1149
 
1150 1150
 	/**
@@ -1173,11 +1173,11 @@  discard block
 block discarded – undo
1173 1173
  *
1174 1174
  * @return string receipt_url
1175 1175
  */
1176
-function give_email_tag_receipt_link_url( $tag_args ) {
1176
+function give_email_tag_receipt_link_url($tag_args) {
1177 1177
 	// Backward compatibility.
1178
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1178
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1179 1179
 
1180
-	$receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) );
1180
+	$receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id'));
1181 1181
 
1182 1182
 	/**
1183 1183
 	 * Filter the {receipt_link_url} email template tag output.
@@ -1204,13 +1204,13 @@  discard block
 block discarded – undo
1204 1204
  *
1205 1205
  * @return string
1206 1206
  */
1207
-function give_get_receipt_url( $payment_id ) {
1207
+function give_get_receipt_url($payment_id) {
1208 1208
 	$receipt_url = '';
1209 1209
 
1210
-	if ( $payment_id ) {
1211
-		$receipt_url = esc_url( add_query_arg( array(
1212
-			'payment_key' => give_get_payment_key( $payment_id ),
1213
-		), give_get_history_page_uri() ) );
1210
+	if ($payment_id) {
1211
+		$receipt_url = esc_url(add_query_arg(array(
1212
+			'payment_key' => give_get_payment_key($payment_id),
1213
+		), give_get_history_page_uri()));
1214 1214
 	}
1215 1215
 
1216 1216
 	return $receipt_url;
@@ -1226,22 +1226,22 @@  discard block
 block discarded – undo
1226 1226
  *
1227 1227
  * @return string
1228 1228
  */
1229
-function give_email_tag_email_access_link( $tag_args ) {
1229
+function give_email_tag_email_access_link($tag_args) {
1230 1230
 	$donor_id          = 0;
1231 1231
 	$donor             = array();
1232 1232
 	$email_access_link = '';
1233 1233
 
1234 1234
 	// Backward compatibility.
1235
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1235
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1236 1236
 
1237
-	switch ( true ) {
1238
-		case ! empty( $tag_args['donor_id'] ):
1237
+	switch (true) {
1238
+		case ! empty($tag_args['donor_id']):
1239 1239
 			$donor_id = $tag_args['donor_id'];
1240
-			$donor    = Give()->donors->get_by( 'id', $tag_args['donor_id'] );
1240
+			$donor    = Give()->donors->get_by('id', $tag_args['donor_id']);
1241 1241
 			break;
1242 1242
 
1243
-		case ! empty( $tag_args['user_id'] ):
1244
-			$donor    = Give()->donors->get_by( 'user_id', $tag_args['user_id'] );
1243
+		case ! empty($tag_args['user_id']):
1244
+			$donor    = Give()->donors->get_by('user_id', $tag_args['user_id']);
1245 1245
 			$donor_id = $donor->id;
1246 1246
 			break;
1247 1247
 
@@ -1250,11 +1250,11 @@  discard block
 block discarded – undo
1250 1250
 	}
1251 1251
 
1252 1252
 	// Set email access link if donor exist.
1253
-	if ( $donor_id ) {
1254
-		$verify_key = wp_generate_password( 20, false );
1253
+	if ($donor_id) {
1254
+		$verify_key = wp_generate_password(20, false);
1255 1255
 
1256 1256
 		// Generate a new verify key
1257
-		Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key );
1257
+		Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key);
1258 1258
 		// update verify key in email tags.
1259 1259
 		$tag_args['verify_key'] = $verify_key;
1260 1260
 
@@ -1269,28 +1269,28 @@  discard block
 block discarded – undo
1269 1269
 		);
1270 1270
 
1271 1271
 		// Add Payment Key to email access url, if it exists.
1272
-		if ( ! empty( $_GET['payment_key'] ) ) {
1272
+		if ( ! empty($_GET['payment_key'])) {
1273 1273
 			$access_url = add_query_arg(
1274 1274
 				array(
1275
-					'payment_key' => give_clean( $_GET['payment_key'] ),
1275
+					'payment_key' => give_clean($_GET['payment_key']),
1276 1276
 				),
1277 1277
 				$access_url
1278 1278
 			);
1279 1279
 		}
1280 1280
 
1281
-		if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) {
1281
+		if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) {
1282 1282
 			$email_access_link = sprintf(
1283 1283
 				'<a href="%1$s" target="_blank">%2$s</a>',
1284
-				esc_url( $access_url ),
1285
-				__( 'View your donation history &raquo;', 'give' )
1284
+				esc_url($access_url),
1285
+				__('View your donation history &raquo;', 'give')
1286 1286
 			);
1287 1287
 
1288 1288
 		} else {
1289 1289
 
1290 1290
 			$email_access_link = sprintf(
1291 1291
 				'%1$s: %2$s',
1292
-				__( 'View your donation history', 'give' ),
1293
-				esc_url( $access_url )
1292
+				__('View your donation history', 'give'),
1293
+				esc_url($access_url)
1294 1294
 			);
1295 1295
 		}
1296 1296
 	}
@@ -1322,23 +1322,23 @@  discard block
 block discarded – undo
1322 1322
  *
1323 1323
  * @return array
1324 1324
  */
1325
-function __give_20_bc_str_type_email_tag_param( $tag_args ) {
1326
-	if ( ! is_array( $tag_args ) ) {
1327
-		switch ( true ) {
1328
-			case ( 'give_payment' === get_post_type( $tag_args ) ):
1329
-				$tag_args = array( 'payment_id' => $tag_args );
1325
+function __give_20_bc_str_type_email_tag_param($tag_args) {
1326
+	if ( ! is_array($tag_args)) {
1327
+		switch (true) {
1328
+			case ('give_payment' === get_post_type($tag_args)):
1329
+				$tag_args = array('payment_id' => $tag_args);
1330 1330
 				break;
1331 1331
 
1332
-			case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ):
1333
-				$tag_args = array( 'user_id' => $tag_args );
1332
+			case ( ! is_wp_error(get_user_by('id', $tag_args))):
1333
+				$tag_args = array('user_id' => $tag_args);
1334 1334
 				break;
1335 1335
 
1336
-			case ( Give()->donors->get_by( 'id', $tag_args ) ):
1337
-				$tag_args = array( 'donor_id' => $tag_args );
1336
+			case (Give()->donors->get_by('id', $tag_args)):
1337
+				$tag_args = array('donor_id' => $tag_args);
1338 1338
 				break;
1339 1339
 
1340
-			case ( Give()->donors->get_by( 'user_id', $tag_args ) ):
1341
-				$tag_args = array( 'user_id' => $tag_args );
1340
+			case (Give()->donors->get_by('user_id', $tag_args)):
1341
+				$tag_args = array('user_id' => $tag_args);
1342 1342
 				break;
1343 1343
 		}
1344 1344
 	}
@@ -1356,36 +1356,36 @@  discard block
 block discarded – undo
1356 1356
  *
1357 1357
  * @return array
1358 1358
  */
1359
-function give_email_tag_reset_password_link( $tag_args, $payment_id ) {
1359
+function give_email_tag_reset_password_link($tag_args, $payment_id) {
1360 1360
 
1361 1361
 	$reset_password_url = '';
1362 1362
 
1363
-	switch ( true ) {
1364
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1365
-			$payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] );
1363
+	switch (true) {
1364
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1365
+			$payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']);
1366 1366
 			break;
1367 1367
 
1368
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
1369
-			$reset_password_url = give_get_reset_password_url( $tag_args['user_id'] );
1368
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
1369
+			$reset_password_url = give_get_reset_password_url($tag_args['user_id']);
1370 1370
 			break;
1371 1371
 
1372
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
1373
-			$reset_password_url = give_get_reset_password_url( Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) );
1372
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
1373
+			$reset_password_url = give_get_reset_password_url(Give()->donors->get_column('user_id', $tag_args['donor_id']));
1374 1374
 			break;
1375 1375
 	}
1376 1376
 
1377
-	if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) {
1377
+	if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) {
1378 1378
 		// Generate link, if Email content type is html.
1379 1379
 		$reset_password_link = sprintf(
1380 1380
 			'<a href="%1$s" target="_blank">%2$s</a>',
1381
-			esc_url( $reset_password_url ),
1382
-			__( 'Reset your password &raquo;', 'give' )
1381
+			esc_url($reset_password_url),
1382
+			__('Reset your password &raquo;', 'give')
1383 1383
 		);
1384 1384
 	} else {
1385 1385
 		$reset_password_link = sprintf(
1386 1386
 			'%1$s: %2$s',
1387
-			__( 'Reset your password', 'give' ),
1388
-			esc_url( $reset_password_url )
1387
+			__('Reset your password', 'give'),
1388
+			esc_url($reset_password_url)
1389 1389
 		);
1390 1390
 	}
1391 1391
 
@@ -1414,21 +1414,21 @@  discard block
 block discarded – undo
1414 1414
  *
1415 1415
  * @return mixed|string
1416 1416
  */
1417
-function give_get_reset_password_url( $user_id ) {
1417
+function give_get_reset_password_url($user_id) {
1418 1418
 	$reset_password_url = '';
1419 1419
 
1420 1420
 	// Proceed further only, if user_id exists.
1421
-	if ( $user_id ) {
1421
+	if ($user_id) {
1422 1422
 
1423 1423
 		// Get User Object Details.
1424
-		$user = get_user_by( 'ID', $user_id );
1424
+		$user = get_user_by('ID', $user_id);
1425 1425
 
1426 1426
 		// Prepare Reset Password URL.
1427
-		$reset_password_url = esc_url( add_query_arg( array(
1427
+		$reset_password_url = esc_url(add_query_arg(array(
1428 1428
 			'action' => 'rp',
1429
-			'key'    => get_password_reset_key( $user ),
1429
+			'key'    => get_password_reset_key($user),
1430 1430
 			'login'  => $user->user_login,
1431
-		), wp_login_url() ) );
1431
+		), wp_login_url()));
1432 1432
 	}
1433 1433
 
1434 1434
 	return $reset_password_url;
@@ -1443,15 +1443,15 @@  discard block
 block discarded – undo
1443 1443
  */
1444 1444
 function give_email_admin_email() {
1445 1445
 
1446
-	$admin_email = give_get_option( 'contact_admin_email' );
1446
+	$admin_email = give_get_option('contact_admin_email');
1447 1447
 
1448
-	if ( empty( $admin_email ) ) {
1449
-		give_delete_option( 'contact_admin_email' );
1448
+	if (empty($admin_email)) {
1449
+		give_delete_option('contact_admin_email');
1450 1450
 	}
1451 1451
 
1452
-	return ( ! empty( $admin_email ) )
1452
+	return ( ! empty($admin_email))
1453 1453
 		? $admin_email
1454
-		: get_bloginfo( 'admin_email' );
1454
+		: get_bloginfo('admin_email');
1455 1455
 }
1456 1456
 
1457 1457
 /**
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
  * @return string
1463 1463
  */
1464 1464
 function give_email_site_url() {
1465
-	return get_bloginfo( 'url' );
1465
+	return get_bloginfo('url');
1466 1466
 }
1467 1467
 
1468 1468
 
@@ -1474,10 +1474,10 @@  discard block
 block discarded – undo
1474 1474
  * @return string
1475 1475
  */
1476 1476
 function give_email_offline_mailing_address() {
1477
-	$offline_address = give_get_option( 'contact_offline_mailing_address' );
1477
+	$offline_address = give_get_option('contact_offline_mailing_address');
1478 1478
 
1479
-	if ( false === $offline_address ) {
1480
-		return sprintf( '&nbsp;&nbsp;&nbsp;&nbsp;<em>%s</em></em><br>&nbsp;&nbsp;&nbsp;&nbsp;<em>111 Not A Real St.</em><br>&nbsp;&nbsp;&nbsp;&nbsp;<em>Anytown, CA 12345 </em><br>', get_bloginfo( 'sitename' ) );
1479
+	if (false === $offline_address) {
1480
+		return sprintf('&nbsp;&nbsp;&nbsp;&nbsp;<em>%s</em></em><br>&nbsp;&nbsp;&nbsp;&nbsp;<em>111 Not A Real St.</em><br>&nbsp;&nbsp;&nbsp;&nbsp;<em>Anytown, CA 12345 </em><br>', get_bloginfo('sitename'));
1481 1481
 	}
1482 1482
 
1483 1483
 	return $offline_address;
@@ -1495,94 +1495,94 @@  discard block
 block discarded – undo
1495 1495
  *
1496 1496
  * @return mixed
1497 1497
  */
1498
-function __give_render_metadata_email_tag( $content, $tag_args ) {
1499
-	preg_match_all( "/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches );
1498
+function __give_render_metadata_email_tag($content, $tag_args) {
1499
+	preg_match_all("/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches);
1500 1500
 
1501
-	if ( ! empty( $matches[0] ) ) {
1501
+	if ( ! empty($matches[0])) {
1502 1502
 		$search = $replace = array();
1503
-		foreach ( $matches[0] as $index => $meta_tag ) {
1504
-			if ( in_array( $meta_tag, $search ) ) {
1503
+		foreach ($matches[0] as $index => $meta_tag) {
1504
+			if (in_array($meta_tag, $search)) {
1505 1505
 				continue;
1506 1506
 			}
1507 1507
 
1508 1508
 			$search[] = $meta_tag;
1509 1509
 
1510
-			$meta_tag     = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag );
1511
-			$meta_tag_arr = array_map( 'trim', explode( ' ', $meta_tag, 2 ) );
1512
-			$meta_tag     = current( $meta_tag_arr );
1510
+			$meta_tag     = str_replace(array('{', 'meta_', '}'), '', $meta_tag);
1511
+			$meta_tag_arr = array_map('trim', explode(' ', $meta_tag, 2));
1512
+			$meta_tag     = current($meta_tag_arr);
1513 1513
 
1514
-			$meta_tag  = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag );
1515
-			$type      = current( explode( '_', $meta_tag, 2 ) );
1516
-			$meta_name = preg_replace( "/^{$type}_/", '', $meta_tag );
1514
+			$meta_tag  = str_replace(array('{', 'meta_', '}'), '', $meta_tag);
1515
+			$type      = current(explode('_', $meta_tag, 2));
1516
+			$meta_name = preg_replace("/^{$type}_/", '', $meta_tag);
1517 1517
 
1518
-			switch ( $type ) {
1518
+			switch ($type) {
1519 1519
 				case 'donation':
1520 1520
 
1521 1521
 					//Bailout.
1522
-					if ( ! isset( $tag_args['payment_id'] ) ) {
1522
+					if ( ! isset($tag_args['payment_id'])) {
1523 1523
 						$replace[] = '';
1524 1524
 						continue;
1525 1525
 					}
1526 1526
 
1527
-					$meta_data = give_get_meta( absint( $tag_args['payment_id'] ), $meta_name, true, '' );
1527
+					$meta_data = give_get_meta(absint($tag_args['payment_id']), $meta_name, true, '');
1528 1528
 
1529
-					if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) {
1529
+					if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) {
1530 1530
 						$replace[] = $meta_data;
1531
-					} elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) {
1532
-						$replace[] = $meta_data[ $meta_tag_arr[1] ];
1531
+					} elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) {
1532
+						$replace[] = $meta_data[$meta_tag_arr[1]];
1533 1533
 					}
1534 1534
 
1535 1535
 					break;
1536 1536
 
1537 1537
 				case 'form':
1538
-					$form_id = isset( $tag_args['form_id'] ) ? absint( $tag_args['form_id'] ) : 0;
1538
+					$form_id = isset($tag_args['form_id']) ? absint($tag_args['form_id']) : 0;
1539 1539
 
1540 1540
 					// Bailout.
1541
-					if ( ! $form_id && isset( $tag_args['payment_id'] ) ) {
1542
-						$form_id = give_get_payment_form_id( $tag_args['payment_id'] );
1541
+					if ( ! $form_id && isset($tag_args['payment_id'])) {
1542
+						$form_id = give_get_payment_form_id($tag_args['payment_id']);
1543 1543
 					}
1544 1544
 
1545
-					$meta_data = give_get_meta( $form_id, $meta_name, true, '' );
1546
-					if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) {
1545
+					$meta_data = give_get_meta($form_id, $meta_name, true, '');
1546
+					if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) {
1547 1547
 						$replace[] = $meta_data;
1548
-					} elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) {
1549
-						$replace[] = $meta_data[ $meta_tag_arr[1] ];
1548
+					} elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) {
1549
+						$replace[] = $meta_data[$meta_tag_arr[1]];
1550 1550
 					}
1551 1551
 					break;
1552 1552
 
1553 1553
 				case 'donor':
1554
-					$donor_id = isset( $tag_args['donor_id'] ) ? absint( $tag_args['donor_id'] ) : 0;
1554
+					$donor_id = isset($tag_args['donor_id']) ? absint($tag_args['donor_id']) : 0;
1555 1555
 
1556 1556
 					// Bailout.
1557
-					if ( ! $donor_id ) {
1558
-						if ( isset( $tag_args['payment_id'] ) ) {
1559
-							$donor_id = give_get_payment_donor_id( $tag_args['payment_id'] );
1560
-						} elseif ( isset( $tag_args['user_id'] ) ) {
1561
-							$donor_id = Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] );
1557
+					if ( ! $donor_id) {
1558
+						if (isset($tag_args['payment_id'])) {
1559
+							$donor_id = give_get_payment_donor_id($tag_args['payment_id']);
1560
+						} elseif (isset($tag_args['user_id'])) {
1561
+							$donor_id = Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']);
1562 1562
 						}
1563 1563
 					}
1564 1564
 
1565
-					$meta_data = Give()->donor_meta->get_meta( $donor_id, $meta_name, true );
1565
+					$meta_data = Give()->donor_meta->get_meta($donor_id, $meta_name, true);
1566 1566
 
1567
-					if( empty( $meta_data ) && in_array( $meta_name, array_keys( Give()->donors->get_columns() ) ) ) {
1568
-						$meta_data = Give()->donors->get_column_by( $meta_name, 'id', $donor_id );
1567
+					if (empty($meta_data) && in_array($meta_name, array_keys(Give()->donors->get_columns()))) {
1568
+						$meta_data = Give()->donors->get_column_by($meta_name, 'id', $donor_id);
1569 1569
 					}
1570 1570
 
1571
-					if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) {
1571
+					if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) {
1572 1572
 						$replace[] = $meta_data;
1573
-					} elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) {
1574
-						$replace[] = $meta_data[ $meta_tag_arr[1] ];
1573
+					} elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) {
1574
+						$replace[] = $meta_data[$meta_tag_arr[1]];
1575 1575
 					}
1576 1576
 
1577 1577
 					break;
1578 1578
 
1579 1579
 				default:
1580
-					$replace[] = end( $search );
1580
+					$replace[] = end($search);
1581 1581
 			}
1582 1582
 		}
1583 1583
 
1584
-		if ( ! empty( $search ) && ! empty( $replace ) ) {
1585
-			$content = str_replace( $search, $replace, $content );
1584
+		if ( ! empty($search) && ! empty($replace)) {
1585
+			$content = str_replace($search, $replace, $content);
1586 1586
 		}
1587 1587
 	}
1588 1588
 
@@ -1590,4 +1590,4 @@  discard block
 block discarded – undo
1590 1590
 	return $content;
1591 1591
 }
1592 1592
 
1593
-add_filter( 'give_email_template_tags', '__give_render_metadata_email_tag', 10, 2 );
1593
+add_filter('give_email_template_tags', '__give_render_metadata_email_tag', 10, 2);
Please login to merge, or discard this patch.
includes/ajax-functions.php 1 patch
Spacing   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -26,31 +26,31 @@  discard block
 block discarded – undo
26 26
  */
27 27
 function give_test_ajax_works() {
28 28
 	// Handle ajax.
29
-	if ( doing_action( 'wp_ajax_nopriv_give_test_ajax' ) ) {
30
-		wp_die( 0, 200 );
29
+	if (doing_action('wp_ajax_nopriv_give_test_ajax')) {
30
+		wp_die(0, 200);
31 31
 	}
32 32
 
33 33
 	// Check if the Airplane Mode plugin is installed.
34
-	if ( class_exists( 'Airplane_Mode_Core' ) ) {
34
+	if (class_exists('Airplane_Mode_Core')) {
35 35
 
36 36
 		$airplane = Airplane_Mode_Core::getInstance();
37 37
 
38
-		if ( method_exists( $airplane, 'enabled' ) ) {
38
+		if (method_exists($airplane, 'enabled')) {
39 39
 
40
-			if ( $airplane->enabled() ) {
40
+			if ($airplane->enabled()) {
41 41
 				return true;
42 42
 			}
43 43
 		} else {
44 44
 
45
-			if ( 'on' === $airplane->check_status() ) {
45
+			if ('on' === $airplane->check_status()) {
46 46
 				return true;
47 47
 			}
48 48
 		}
49 49
 	}
50 50
 
51
-	add_filter( 'block_local_requests', '__return_false' );
51
+	add_filter('block_local_requests', '__return_false');
52 52
 
53
-	if ( Give_Cache::get( '_give_ajax_works', true ) ) {
53
+	if (Give_Cache::get('_give_ajax_works', true)) {
54 54
 		return true;
55 55
 	}
56 56
 
@@ -62,41 +62,41 @@  discard block
 block discarded – undo
62 62
 		),
63 63
 	);
64 64
 
65
-	$ajax = wp_remote_post( give_get_ajax_url(), $params );
65
+	$ajax = wp_remote_post(give_get_ajax_url(), $params);
66 66
 
67 67
 	$works = true;
68 68
 
69
-	if ( is_wp_error( $ajax ) ) {
69
+	if (is_wp_error($ajax)) {
70 70
 
71 71
 		$works = false;
72 72
 
73 73
 	} else {
74 74
 
75
-		if ( empty( $ajax['response'] ) ) {
75
+		if (empty($ajax['response'])) {
76 76
 			$works = false;
77 77
 		}
78 78
 
79
-		if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) {
79
+		if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) {
80 80
 			$works = false;
81 81
 		}
82 82
 
83
-		if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) {
83
+		if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) {
84 84
 			$works = false;
85 85
 		}
86 86
 
87
-		if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) {
87
+		if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) {
88 88
 			$works = false;
89 89
 		}
90 90
 	}
91 91
 
92
-	if ( $works ) {
93
-		Give_Cache::set( '_give_ajax_works', '1', DAY_IN_SECONDS, true );
92
+	if ($works) {
93
+		Give_Cache::set('_give_ajax_works', '1', DAY_IN_SECONDS, true);
94 94
 	}
95 95
 
96
-	return apply_filters( 'give_test_ajax_works', $works );
96
+	return apply_filters('give_test_ajax_works', $works);
97 97
 }
98 98
 
99
-add_action( 'wp_ajax_nopriv_give_test_ajax', 'give_test_ajax_works' );
99
+add_action('wp_ajax_nopriv_give_test_ajax', 'give_test_ajax_works');
100 100
 
101 101
 /**
102 102
  * Get AJAX URL
@@ -107,21 +107,21 @@  discard block
 block discarded – undo
107 107
  *
108 108
  * @return string
109 109
  */
110
-function give_get_ajax_url( $query = array() ) {
111
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
110
+function give_get_ajax_url($query = array()) {
111
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
112 112
 
113 113
 	$current_url = give_get_current_page_url();
114
-	$ajax_url    = admin_url( 'admin-ajax.php', $scheme );
114
+	$ajax_url    = admin_url('admin-ajax.php', $scheme);
115 115
 
116
-	if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) {
117
-		$ajax_url = preg_replace( '/^http/', 'https', $ajax_url );
116
+	if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) {
117
+		$ajax_url = preg_replace('/^http/', 'https', $ajax_url);
118 118
 	}
119 119
 
120
-	if ( ! empty( $query ) ) {
121
-		$ajax_url = add_query_arg( $query, $ajax_url );
120
+	if ( ! empty($query)) {
121
+		$ajax_url = add_query_arg($query, $ajax_url);
122 122
 	}
123 123
 
124
-	return apply_filters( 'give_ajax_url', $ajax_url );
124
+	return apply_filters('give_ajax_url', $ajax_url);
125 125
 }
126 126
 
127 127
 /**
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @since 1.7
139 139
 	 */
140
-	do_action( 'give_donation_form_login_fields' );
140
+	do_action('give_donation_form_login_fields');
141 141
 
142 142
 	give_die();
143 143
 }
144 144
 
145
-add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' );
145
+add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields');
146 146
 
147 147
 /**
148 148
  * Load Checkout Fields
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
  * @return void
153 153
  */
154 154
 function give_load_checkout_fields() {
155
-	$form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : '';
155
+	$form_id = isset($_POST['form_id']) ? $_POST['form_id'] : '';
156 156
 
157 157
 	ob_start();
158 158
 
@@ -161,18 +161,18 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @since 1.7
163 163
 	 */
164
-	do_action( 'give_donation_form_register_login_fields', $form_id );
164
+	do_action('give_donation_form_register_login_fields', $form_id);
165 165
 
166 166
 	$fields = ob_get_clean();
167 167
 
168
-	wp_send_json( array(
169
-		'fields' => wp_json_encode( $fields ),
170
-		'submit' => wp_json_encode( give_get_donation_form_submit_button( $form_id ) ),
171
-	) );
168
+	wp_send_json(array(
169
+		'fields' => wp_json_encode($fields),
170
+		'submit' => wp_json_encode(give_get_donation_form_submit_button($form_id)),
171
+	));
172 172
 }
173 173
 
174
-add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' );
175
-add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' );
174
+add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields');
175
+add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields');
176 176
 
177 177
 /**
178 178
  * Get Form Title via AJAX (used only in WordPress Admin)
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
  * @return void
183 183
  */
184 184
 function give_ajax_get_form_title() {
185
-	if ( isset( $_POST['form_id'] ) ) {
186
-		$title = get_the_title( $_POST['form_id'] );
187
-		if ( $title ) {
185
+	if (isset($_POST['form_id'])) {
186
+		$title = get_the_title($_POST['form_id']);
187
+		if ($title) {
188 188
 			echo $title;
189 189
 		} else {
190 190
 			echo 'fail';
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 	give_die();
194 194
 }
195 195
 
196
-add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' );
197
-add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' );
196
+add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title');
197
+add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title');
198 198
 
199 199
 /**
200 200
  * Retrieve a states drop down
@@ -208,41 +208,41 @@  discard block
 block discarded – undo
208 208
 	$show_field     = true;
209 209
 	$states_require = true;
210 210
 	// Get the Country code from the $_POST.
211
-	$country = sanitize_text_field( $_POST['country'] );
211
+	$country = sanitize_text_field($_POST['country']);
212 212
 
213 213
 	// Get the field name from the $_POST.
214
-	$field_name = sanitize_text_field( $_POST['field_name'] );
214
+	$field_name = sanitize_text_field($_POST['field_name']);
215 215
 
216
-	$label        = __( 'State', 'give' );
216
+	$label        = __('State', 'give');
217 217
 	$states_label = give_get_states_label();
218 218
 
219 219
 	$default_state = '';
220
-	if ( $country === give_get_country() ) {
220
+	if ($country === give_get_country()) {
221 221
 		$default_state = give_get_state();
222 222
 	}
223 223
 
224 224
 	// Check if $country code exists in the array key for states label.
225
-	if ( array_key_exists( $country, $states_label ) ) {
226
-		$label = $states_label[ $country ];
225
+	if (array_key_exists($country, $states_label)) {
226
+		$label = $states_label[$country];
227 227
 	}
228 228
 
229
-	if ( empty( $country ) ) {
229
+	if (empty($country)) {
230 230
 		$country = give_get_country();
231 231
 	}
232 232
 
233
-	$states = give_get_states( $country );
234
-	if ( ! empty( $states ) ) {
235
-		$args         = array(
233
+	$states = give_get_states($country);
234
+	if ( ! empty($states)) {
235
+		$args = array(
236 236
 			'name'             => $field_name,
237 237
 			'id'               => $field_name,
238
-			'class'            => $field_name . '  give-select',
238
+			'class'            => $field_name.'  give-select',
239 239
 			'options'          => $states,
240 240
 			'show_option_all'  => false,
241 241
 			'show_option_none' => false,
242 242
 			'placeholder'      => $label,
243 243
 			'selected'         => $default_state,
244 244
 		);
245
-		$data         = Give()->html->select( $args );
245
+		$data         = Give()->html->select($args);
246 246
 		$states_found = true;
247 247
 	} else {
248 248
 		$data = 'nostates';
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 		$no_states_country = give_no_states_country_list();
252 252
 
253 253
 		// Check if $country code exists in the array key.
254
-		if ( array_key_exists( $country, $no_states_country ) ) {
254
+		if (array_key_exists($country, $no_states_country)) {
255 255
 			$show_field = false;
256 256
 		}
257 257
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		$states_not_required_country_list = give_states_not_required_country_list();
260 260
 
261 261
 		// Check if $country code exists in the array key.
262
-		if ( array_key_exists( $country, $states_not_required_country_list ) ) {
262
+		if (array_key_exists($country, $states_not_required_country_list)) {
263 263
 			$states_require = false;
264 264
 		}
265 265
 	}
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 		'data'           => $data,
273 273
 		'default_state'  => $default_state,
274 274
 	);
275
-	wp_send_json( $response );
275
+	wp_send_json($response);
276 276
 }
277 277
 
278
-add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' );
279
-add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' );
278
+add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field');
279
+add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field');
280 280
 
281 281
 /**
282 282
  * Retrieve donation forms via AJAX for chosen dropdown search field.
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
  */
288 288
 function give_ajax_form_search() {
289 289
 	$results = array();
290
-	$search  = esc_sql( sanitize_text_field( $_POST['s'] ) );
290
+	$search  = esc_sql(sanitize_text_field($_POST['s']));
291 291
 
292 292
 	$args = array(
293 293
 		'post_type'              => 'give_forms',
@@ -308,12 +308,12 @@  discard block
 block discarded – undo
308 308
 	 *
309 309
 	 * @return array $args Query argument for WP_query
310 310
 	 */
311
-	$args = (array) apply_filters( 'give_ajax_form_search_args', $args );
311
+	$args = (array) apply_filters('give_ajax_form_search_args', $args);
312 312
 
313 313
 	// get all the donation form.
314
-	$query = new WP_Query( $args );
315
-	if ( $query->have_posts() ) {
316
-		while ( $query->have_posts() ) {
314
+	$query = new WP_Query($args);
315
+	if ($query->have_posts()) {
316
+		while ($query->have_posts()) {
317 317
 			$query->the_post();
318 318
 			global $post;
319 319
 
@@ -334,13 +334,13 @@  discard block
 block discarded – undo
334 334
 	 *
335 335
 	 * @return array $results Contain the Donation Form id
336 336
 	 */
337
-	$results = (array) apply_filters( 'give_ajax_form_search_responce', $results );
337
+	$results = (array) apply_filters('give_ajax_form_search_responce', $results);
338 338
 
339
-	wp_send_json( $results );
339
+	wp_send_json($results);
340 340
 }
341 341
 
342
-add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' );
343
-add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' );
342
+add_action('wp_ajax_give_form_search', 'give_ajax_form_search');
343
+add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search');
344 344
 
345 345
 /**
346 346
  * Search the donors database via Ajax
@@ -352,28 +352,28 @@  discard block
 block discarded – undo
352 352
 function give_ajax_donor_search() {
353 353
 	global $wpdb;
354 354
 
355
-	$search  = esc_sql( sanitize_text_field( $_POST['s'] ) );
355
+	$search  = esc_sql(sanitize_text_field($_POST['s']));
356 356
 	$results = array();
357
-	if ( ! current_user_can( 'view_give_reports' ) ) {
357
+	if ( ! current_user_can('view_give_reports')) {
358 358
 		$donors = array();
359 359
 	} else {
360
-		$donors = $wpdb->get_results( "SELECT id,name,email FROM $wpdb->donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" );
360
+		$donors = $wpdb->get_results("SELECT id,name,email FROM $wpdb->donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
361 361
 	}
362 362
 
363
-	if ( $donors ) {
364
-		foreach ( $donors as $donor ) {
363
+	if ($donors) {
364
+		foreach ($donors as $donor) {
365 365
 
366 366
 			$results[] = array(
367 367
 				'id'   => $donor->id,
368
-				'name' => $donor->name . ' (' . $donor->email . ')',
368
+				'name' => $donor->name.' ('.$donor->email.')',
369 369
 			);
370 370
 		}
371 371
 	}
372 372
 
373
-	wp_send_json( $results );
373
+	wp_send_json($results);
374 374
 }
375 375
 
376
-add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' );
376
+add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search');
377 377
 
378 378
 
379 379
 /**
@@ -386,37 +386,37 @@  discard block
 block discarded – undo
386 386
 function give_ajax_search_users() {
387 387
 	$results = array();
388 388
 
389
-	if ( current_user_can( 'manage_give_settings' ) ) {
389
+	if (current_user_can('manage_give_settings')) {
390 390
 
391
-		$search = esc_sql( sanitize_text_field( $_POST['s'] ) );
391
+		$search = esc_sql(sanitize_text_field($_POST['s']));
392 392
 
393 393
 		$get_users_args = array(
394 394
 			'number' => 9999,
395
-			'search' => $search . '*',
395
+			'search' => $search.'*',
396 396
 		);
397 397
 
398
-		$get_users_args = apply_filters( 'give_search_users_args', $get_users_args );
398
+		$get_users_args = apply_filters('give_search_users_args', $get_users_args);
399 399
 
400
-		$found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search );
400
+		$found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search);
401 401
 		$results     = array();
402 402
 
403
-		if ( $found_users ) {
403
+		if ($found_users) {
404 404
 
405
-			foreach ( $found_users as $user ) {
405
+			foreach ($found_users as $user) {
406 406
 
407 407
 				$results[] = array(
408 408
 					'id'   => $user->ID,
409
-					'name' => esc_html( $user->user_login . ' (' . $user->user_email . ')' ),
409
+					'name' => esc_html($user->user_login.' ('.$user->user_email.')'),
410 410
 				);
411 411
 			}
412 412
 		}
413 413
 	}// End if().
414 414
 
415
-	wp_send_json( $results );
415
+	wp_send_json($results);
416 416
 
417 417
 }
418 418
 
419
-add_action( 'wp_ajax_give_user_search', 'give_ajax_search_users' );
419
+add_action('wp_ajax_give_user_search', 'give_ajax_search_users');
420 420
 
421 421
 
422 422
 /**
@@ -432,14 +432,14 @@  discard block
 block discarded – undo
432 432
 	$data = array();
433 433
 	$args = array(
434 434
 		'post_type' => 'page',
435
-		's'         => give_clean( $_POST['s'] ),
435
+		's'         => give_clean($_POST['s']),
436 436
 	);
437 437
 
438
-	$query = new WP_Query( $args );
438
+	$query = new WP_Query($args);
439 439
 
440 440
 	// Query posts by title.
441
-	if ( $query->have_posts() ) {
442
-		while ( $query->have_posts() ) {
441
+	if ($query->have_posts()) {
442
+		while ($query->have_posts()) {
443 443
 			$query->the_post();
444 444
 
445 445
 			$data[] = array(
@@ -449,10 +449,10 @@  discard block
 block discarded – undo
449 449
 		}
450 450
 	}
451 451
 
452
-	wp_send_json( $data );
452
+	wp_send_json($data);
453 453
 }
454 454
 
455
-add_action( 'wp_ajax_give_pages_search', 'give_ajax_pages_search' );
455
+add_action('wp_ajax_give_pages_search', 'give_ajax_pages_search');
456 456
 
457 457
 /**
458 458
  * Retrieve Categories via AJAX for chosen dropdown search field.
@@ -473,14 +473,14 @@  discard block
 block discarded – undo
473 473
 	 *
474 474
 	 * @return array $args argument for get_terms
475 475
 	 */
476
-	$args = (array) apply_filters( 'give_forms_categories_dropdown_args', array(
476
+	$args = (array) apply_filters('give_forms_categories_dropdown_args', array(
477 477
 		'number'     => 30,
478
-		'name__like' => esc_sql( sanitize_text_field( $_POST['s'] ) )
479
-	) );
478
+		'name__like' => esc_sql(sanitize_text_field($_POST['s']))
479
+	));
480 480
 
481
-	$categories = get_terms( 'give_forms_category', $args );
481
+	$categories = get_terms('give_forms_category', $args);
482 482
 
483
-	foreach ( $categories as $category ) {
483
+	foreach ($categories as $category) {
484 484
 		$results[] = array(
485 485
 			'id'   => $category->term_id,
486 486
 			'name' => $category->name,
@@ -496,12 +496,12 @@  discard block
 block discarded – undo
496 496
 	 *
497 497
 	 * @return array $results Contain the categories id and name
498 498
 	 */
499
-	$results = (array) apply_filters( 'give_forms_categories_dropdown_responce', $results );
499
+	$results = (array) apply_filters('give_forms_categories_dropdown_responce', $results);
500 500
 
501
-	wp_send_json( $results );
501
+	wp_send_json($results);
502 502
 }
503 503
 
504
-add_action( 'wp_ajax_give_categories_search', 'give_ajax_categories_search' );
504
+add_action('wp_ajax_give_categories_search', 'give_ajax_categories_search');
505 505
 
506 506
 /**
507 507
  * Retrieve Tags via AJAX for chosen dropdown search field.
@@ -522,14 +522,14 @@  discard block
 block discarded – undo
522 522
 	 *
523 523
 	 * @return array $args argument for get_terms
524 524
 	 */
525
-	$args = (array) apply_filters( 'give_forms_tags_dropdown_args', array(
525
+	$args = (array) apply_filters('give_forms_tags_dropdown_args', array(
526 526
 		'number'     => 30,
527
-		'name__like' => esc_sql( sanitize_text_field( $_POST['s'] ) )
528
-	) );
527
+		'name__like' => esc_sql(sanitize_text_field($_POST['s']))
528
+	));
529 529
 
530
-	$categories = get_terms( 'give_forms_tag', $args );
530
+	$categories = get_terms('give_forms_tag', $args);
531 531
 
532
-	foreach ( $categories as $category ) {
532
+	foreach ($categories as $category) {
533 533
 		$results[] = array(
534 534
 			'id'   => $category->term_id,
535 535
 			'name' => $category->name,
@@ -545,12 +545,12 @@  discard block
 block discarded – undo
545 545
 	 *
546 546
 	 * @return array $results Contain the tags id and name
547 547
 	 */
548
-	$results = (array) apply_filters( 'give_forms_tags_dropdown_responce', $results );
548
+	$results = (array) apply_filters('give_forms_tags_dropdown_responce', $results);
549 549
 
550
-	wp_send_json( $results );
550
+	wp_send_json($results);
551 551
 }
552 552
 
553
-add_action( 'wp_ajax_give_tags_search', 'give_ajax_tags_search' );
553
+add_action('wp_ajax_give_tags_search', 'give_ajax_tags_search');
554 554
 
555 555
 /**
556 556
  * Check for Price Variations (Multi-level donation forms)
@@ -561,32 +561,32 @@  discard block
 block discarded – undo
561 561
  */
562 562
 function give_check_for_form_price_variations() {
563 563
 
564
-	if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
565
-		die( '-1' );
564
+	if ( ! current_user_can('edit_give_forms', get_current_user_id())) {
565
+		die('-1');
566 566
 	}
567 567
 
568
-	$form_id = intval( $_POST['form_id'] );
569
-	$form    = get_post( $form_id );
568
+	$form_id = intval($_POST['form_id']);
569
+	$form    = get_post($form_id);
570 570
 
571
-	if ( 'give_forms' !== $form->post_type ) {
572
-		die( '-2' );
571
+	if ('give_forms' !== $form->post_type) {
572
+		die('-2');
573 573
 	}
574 574
 
575
-	if ( give_has_variable_prices( $form_id ) ) {
576
-		$variable_prices = give_get_variable_prices( $form_id );
575
+	if (give_has_variable_prices($form_id)) {
576
+		$variable_prices = give_get_variable_prices($form_id);
577 577
 
578
-		if ( $variable_prices ) {
578
+		if ($variable_prices) {
579 579
 			$ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">';
580 580
 
581
-			if ( isset( $_POST['all_prices'] ) ) {
582
-				$ajax_response .= '<option value="all">' . esc_html__( 'All Levels', 'give' ) . '</option>';
581
+			if (isset($_POST['all_prices'])) {
582
+				$ajax_response .= '<option value="all">'.esc_html__('All Levels', 'give').'</option>';
583 583
 			}
584 584
 
585
-			foreach ( $variable_prices as $key => $price ) {
585
+			foreach ($variable_prices as $key => $price) {
586 586
 
587
-				$level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) );
587
+				$level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)));
588 588
 
589
-				$ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>';
589
+				$ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>';
590 590
 			}
591 591
 			$ajax_response .= '</select>';
592 592
 			echo $ajax_response;
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 	give_die();
597 597
 }
598 598
 
599
-add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' );
599
+add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations');
600 600
 
601 601
 
602 602
 /**
@@ -607,28 +607,28 @@  discard block
 block discarded – undo
607 607
  * @return void
608 608
  */
609 609
 function give_check_for_form_price_variations_html() {
610
-	if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) {
610
+	if ( ! current_user_can('edit_give_payments', get_current_user_id())) {
611 611
 		wp_die();
612 612
 	}
613 613
 
614
-	$form_id    = ! empty( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : false;
615
-	$payment_id = ! empty( $_POST['payment_id'] ) ? intval( $_POST['payment_id'] ) : false;
616
-	if ( empty( $form_id ) || empty( $payment_id ) ) {
614
+	$form_id    = ! empty($_POST['form_id']) ? intval($_POST['form_id']) : false;
615
+	$payment_id = ! empty($_POST['payment_id']) ? intval($_POST['payment_id']) : false;
616
+	if (empty($form_id) || empty($payment_id)) {
617 617
 		wp_die();
618 618
 	}
619 619
 
620
-	$form = get_post( $form_id );
621
-	if ( ! empty( $form->post_type ) && 'give_forms' !== $form->post_type ) {
620
+	$form = get_post($form_id);
621
+	if ( ! empty($form->post_type) && 'give_forms' !== $form->post_type) {
622 622
 		wp_die();
623 623
 	}
624 624
 
625
-	if ( ! give_has_variable_prices( $form_id ) || ! $form_id ) {
626
-		esc_html_e( 'n/a', 'give' );
625
+	if ( ! give_has_variable_prices($form_id) || ! $form_id) {
626
+		esc_html_e('n/a', 'give');
627 627
 	} else {
628 628
 		$prices_atts = array();
629
-		if ( $variable_prices = give_get_variable_prices( $form_id ) ) {
630
-			foreach ( $variable_prices as $variable_price ) {
631
-				$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
629
+		if ($variable_prices = give_get_variable_prices($form_id)) {
630
+			foreach ($variable_prices as $variable_price) {
631
+				$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false));
632 632
 			}
633 633
 		}
634 634
 
@@ -639,12 +639,12 @@  discard block
 block discarded – undo
639 639
 			'chosen'           => true,
640 640
 			'show_option_all'  => '',
641 641
 			'show_option_none' => '',
642
-			'select_atts'      => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ),
642
+			'select_atts'      => 'data-prices='.esc_attr(json_encode($prices_atts)),
643 643
 		);
644 644
 
645
-		if ( $payment_id ) {
645
+		if ($payment_id) {
646 646
 			// Payment object.
647
-			$payment = new Give_Payment( $payment_id );
647
+			$payment = new Give_Payment($payment_id);
648 648
 
649 649
 			// Payment meta.
650 650
 			$payment_meta                               = $payment->get_meta();
@@ -652,13 +652,13 @@  discard block
 block discarded – undo
652 652
 		}
653 653
 
654 654
 		// Render variable prices select tag html.
655
-		give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
655
+		give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
656 656
 	}
657 657
 
658 658
 	give_die();
659 659
 }
660 660
 
661
-add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
661
+add_action('wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html');
662 662
 
663 663
 /**
664 664
  * Send Confirmation Email For Complete Donation History Access.
@@ -670,30 +670,30 @@  discard block
 block discarded – undo
670 670
 function give_confirm_email_for_donation_access() {
671 671
 
672 672
 	// Verify Security using Nonce.
673
-	if ( ! check_ajax_referer( 'give_ajax_nonce', 'nonce' ) ) {
673
+	if ( ! check_ajax_referer('give_ajax_nonce', 'nonce')) {
674 674
 		return false;
675 675
 	}
676 676
 
677 677
 	// Bail Out, if email is empty.
678
-	if ( empty( $_POST['email'] ) ) {
678
+	if (empty($_POST['email'])) {
679 679
 		return false;
680 680
 	}
681 681
 
682
-	$donor = Give()->donors->get_donor_by( 'email', give_clean( $_POST['email'] ) );
683
-	if ( Give()->email_access->can_send_email( $donor->id ) ) {
682
+	$donor = Give()->donors->get_donor_by('email', give_clean($_POST['email']));
683
+	if (Give()->email_access->can_send_email($donor->id)) {
684 684
 		$return     = array();
685
-		$email_sent = Give()->email_access->send_email( $donor->id, $donor->email );
685
+		$email_sent = Give()->email_access->send_email($donor->id, $donor->email);
686 686
 
687
-		if ( ! $email_sent ) {
687
+		if ( ! $email_sent) {
688 688
 			$return['status']  = 'error';
689 689
 			$return['message'] = Give()->notices->print_frontend_notice(
690
-				__( 'Unable to send email. Please try again.', 'give' ),
690
+				__('Unable to send email. Please try again.', 'give'),
691 691
 				false,
692 692
 				'error'
693 693
 			);
694 694
 		}
695 695
 
696
-		$return['status']  = 'success';
696
+		$return['status'] = 'success';
697 697
 
698 698
 		/**
699 699
 		 * Filter to modify access mail send notice
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 		 *
705 705
 		 * @return  string $message Send notice message for email access.
706 706
 		 */
707
-		$message = (string) apply_filters( 'give_email_access_mail_send_notice', __( 'Please check your email and click on the link to access your complete donation history.', 'give' ) );
707
+		$message = (string) apply_filters('give_email_access_mail_send_notice', __('Please check your email and click on the link to access your complete donation history.', 'give'));
708 708
 
709 709
 		$return['message'] = Give()->notices->print_frontend_notice(
710 710
 			$message,
@@ -730,8 +730,8 @@  discard block
 block discarded – undo
730 730
 		$message = (string) apply_filters(
731 731
 			'give_email_access_requests_exceed_notice',
732 732
 			sprintf(
733
-				__( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ),
734
-				sprintf( _n( '%s minute', '%s minutes', $value, 'give' ), $value )
733
+				__('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'),
734
+				sprintf(_n('%s minute', '%s minutes', $value, 'give'), $value)
735 735
 			),
736 736
 			$value
737 737
 		);
@@ -743,11 +743,11 @@  discard block
 block discarded – undo
743 743
 		);
744 744
 	}
745 745
 
746
-	echo json_encode( $return );
746
+	echo json_encode($return);
747 747
 	give_die();
748 748
 }
749 749
 
750
-add_action( 'wp_ajax_nopriv_give_confirm_email_for_donations_access', 'give_confirm_email_for_donation_access' );
750
+add_action('wp_ajax_nopriv_give_confirm_email_for_donations_access', 'give_confirm_email_for_donation_access');
751 751
 
752 752
 /**
753 753
  * Render receipt by ajax
@@ -755,15 +755,15 @@  discard block
 block discarded – undo
755 755
  *
756 756
  * @since 2.2.0
757 757
  */
758
-function __give_get_receipt(){
759
-	if( ! isset( $_POST['shortcode_atts'] ) ) {
758
+function __give_get_receipt() {
759
+	if ( ! isset($_POST['shortcode_atts'])) {
760 760
 		give_die();
761 761
 	}
762 762
 
763
-	$atts = urldecode_deep( give_clean( $_POST['shortcode_atts'] ) );
764
-	$data = give_receipt_shortcode( $atts );
763
+	$atts = urldecode_deep(give_clean($_POST['shortcode_atts']));
764
+	$data = give_receipt_shortcode($atts);
765 765
 
766
-	wp_send_json( $data );
766
+	wp_send_json($data);
767 767
 }
768
-add_action( 'wp_ajax_get_receipt', '__give_get_receipt' );
769
-add_action( 'wp_ajax_nopriv_get_receipt', '__give_get_receipt' );
768
+add_action('wp_ajax_get_receipt', '__give_get_receipt');
769
+add_action('wp_ajax_nopriv_get_receipt', '__give_get_receipt');
Please login to merge, or discard this patch.
includes/api/class-give-api.php 1 patch
Spacing   +534 added lines, -534 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -141,27 +141,27 @@  discard block
 block discarded – undo
141 141
 			'v1' => 'GIVE_API_V1',
142 142
 		);
143 143
 
144
-		foreach ( $this->get_versions() as $version => $class ) {
145
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-' . $version . '.php';
144
+		foreach ($this->get_versions() as $version => $class) {
145
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-'.$version.'.php';
146 146
 		}
147 147
 
148
-		add_action( 'init', array( $this, 'add_endpoint' ) );
149
-		add_action( 'wp', array( $this, 'process_query' ), - 1 );
150
-		add_filter( 'query_vars', array( $this, 'query_vars' ) );
151
-		add_action( 'show_user_profile', array( $this, 'user_key_field' ) );
152
-		add_action( 'edit_user_profile', array( $this, 'user_key_field' ) );
153
-		add_action( 'personal_options_update', array( $this, 'generate_api_key' ) );
154
-		add_action( 'edit_user_profile_update', array( $this, 'generate_api_key' ) );
155
-		add_action( 'give_process_api_key', array( $this, 'process_api_key' ) );
148
+		add_action('init', array($this, 'add_endpoint'));
149
+		add_action('wp', array($this, 'process_query'), - 1);
150
+		add_filter('query_vars', array($this, 'query_vars'));
151
+		add_action('show_user_profile', array($this, 'user_key_field'));
152
+		add_action('edit_user_profile', array($this, 'user_key_field'));
153
+		add_action('personal_options_update', array($this, 'generate_api_key'));
154
+		add_action('edit_user_profile_update', array($this, 'generate_api_key'));
155
+		add_action('give_process_api_key', array($this, 'process_api_key'));
156 156
 
157 157
 		// Setup a backwards compatibility check for user API Keys
158
-		add_filter( 'get_user_metadata', array( $this, 'api_key_backwards_compat' ), 10, 4 );
158
+		add_filter('get_user_metadata', array($this, 'api_key_backwards_compat'), 10, 4);
159 159
 
160 160
 		// Determine if JSON_PRETTY_PRINT is available
161
-		$this->pretty_print = defined( 'JSON_PRETTY_PRINT' ) ? JSON_PRETTY_PRINT : null;
161
+		$this->pretty_print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : null;
162 162
 
163 163
 		// Allow API request logging to be turned off
164
-		$this->log_requests = apply_filters( 'give_api_log_requests', $this->log_requests );
164
+		$this->log_requests = apply_filters('give_api_log_requests', $this->log_requests);
165 165
 
166 166
 		// Setup Give_Payment_Stats instance
167 167
 		$this->stats = new Give_Payment_Stats();
@@ -179,17 +179,17 @@  discard block
 block discarded – undo
179 179
 	 *
180 180
 	 * @return mixed
181 181
 	 */
182
-	public function __call( $name, $arguments ) {
182
+	public function __call($name, $arguments) {
183 183
 		$deprecated_function_arr = array(
184 184
 			'get_customers',
185 185
 		);
186 186
 
187
-		if ( in_array( $name, $deprecated_function_arr, true ) ) {
188
-			switch ( $name ) {
187
+		if (in_array($name, $deprecated_function_arr, true)) {
188
+			switch ($name) {
189 189
 				case 'get_customers':
190
-					$args = ! empty( $arguments[0] ) ? $arguments[0] : array();
190
+					$args = ! empty($arguments[0]) ? $arguments[0] : array();
191 191
 
192
-					return $this->get_donors( $args );
192
+					return $this->get_donors($args);
193 193
 			}
194 194
 		}
195 195
 	}
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * @since  1.1
203 203
 	 */
204 204
 	public function add_endpoint() {
205
-		add_rewrite_endpoint( 'give-api', EP_ALL );
205
+		add_rewrite_endpoint('give-api', EP_ALL);
206 206
 	}
207 207
 
208 208
 	/**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 *
216 216
 	 * @return string[] $vars New query vars
217 217
 	 */
218
-	public function query_vars( $vars ) {
218
+	public function query_vars($vars) {
219 219
 
220 220
 		$vars[] = 'token';
221 221
 		$vars[] = 'key';
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	public function get_default_version() {
268 268
 
269
-		$version = get_option( 'give_default_api_version' );
269
+		$version = get_option('give_default_api_version');
270 270
 
271
-		if ( defined( 'GIVE_API_VERSION' ) ) {
271
+		if (defined('GIVE_API_VERSION')) {
272 272
 			$version = GIVE_API_VERSION;
273
-		} elseif ( ! $version ) {
273
+		} elseif ( ! $version) {
274 274
 			$version = 'v1';
275 275
 		}
276 276
 
@@ -291,14 +291,14 @@  discard block
 block discarded – undo
291 291
 
292 292
 		$version = $wp_query->query_vars['give-api'];
293 293
 
294
-		if ( strpos( $version, '/' ) ) {
294
+		if (strpos($version, '/')) {
295 295
 
296
-			$version = explode( '/', $version );
297
-			$version = strtolower( $version[0] );
296
+			$version = explode('/', $version);
297
+			$version = strtolower($version[0]);
298 298
 
299
-			$wp_query->query_vars['give-api'] = str_replace( $version . '/', '', $wp_query->query_vars['give-api'] );
299
+			$wp_query->query_vars['give-api'] = str_replace($version.'/', '', $wp_query->query_vars['give-api']);
300 300
 
301
-			if ( array_key_exists( $version, $this->versions ) ) {
301
+			if (array_key_exists($version, $this->versions)) {
302 302
 
303 303
 				$this->queried_version = $version;
304 304
 
@@ -334,16 +334,16 @@  discard block
 block discarded – undo
334 334
 		$this->override = false;
335 335
 
336 336
 		// Make sure we have both user and api key
337
-		if ( ! empty( $wp_query->query_vars['give-api'] ) && ( $wp_query->query_vars['give-api'] !== 'forms' || ! empty( $wp_query->query_vars['token'] ) ) ) {
337
+		if ( ! empty($wp_query->query_vars['give-api']) && ($wp_query->query_vars['give-api'] !== 'forms' || ! empty($wp_query->query_vars['token']))) {
338 338
 
339
-			if ( empty( $wp_query->query_vars['token'] ) || empty( $wp_query->query_vars['key'] ) ) {
339
+			if (empty($wp_query->query_vars['token']) || empty($wp_query->query_vars['key'])) {
340 340
 				$this->missing_auth();
341 341
 
342 342
 				return false;
343 343
 			}
344 344
 
345 345
 			// Retrieve the user by public API key and ensure they exist
346
-			if ( ! ( $user = $this->get_user( $wp_query->query_vars['key'] ) ) ) {
346
+			if ( ! ($user = $this->get_user($wp_query->query_vars['key']))) {
347 347
 
348 348
 				$this->invalid_key();
349 349
 
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
 
352 352
 			} else {
353 353
 
354
-				$token  = urldecode( $wp_query->query_vars['token'] );
355
-				$secret = $this->get_user_secret_key( $user );
356
-				$public = urldecode( $wp_query->query_vars['key'] );
354
+				$token  = urldecode($wp_query->query_vars['token']);
355
+				$secret = $this->get_user_secret_key($user);
356
+				$public = urldecode($wp_query->query_vars['key']);
357 357
 
358
-				if ( hash_equals( md5( $secret . $public ), $token ) ) {
358
+				if (hash_equals(md5($secret.$public), $token)) {
359 359
 					$this->is_valid_request = true;
360 360
 				} else {
361 361
 					$this->invalid_auth();
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
 				}
365 365
 
366 366
 			}
367
-		} elseif ( ! empty( $wp_query->query_vars['give-api'] ) && $wp_query->query_vars['give-api'] === 'forms' ) {
367
+		} elseif ( ! empty($wp_query->query_vars['give-api']) && $wp_query->query_vars['give-api'] === 'forms') {
368 368
 			$this->is_valid_request = true;
369
-			$wp_query->set( 'key', 'public' );
369
+			$wp_query->set('key', 'public');
370 370
 		}
371 371
 	}
372 372
 
@@ -382,25 +382,25 @@  discard block
 block discarded – undo
382 382
 	 *
383 383
 	 * @return bool if user ID is found, false otherwise
384 384
 	 */
385
-	public function get_user( $key = '' ) {
385
+	public function get_user($key = '') {
386 386
 		global $wpdb, $wp_query;
387 387
 
388
-		if ( empty( $key ) ) {
389
-			$key = urldecode( $wp_query->query_vars['key'] );
388
+		if (empty($key)) {
389
+			$key = urldecode($wp_query->query_vars['key']);
390 390
 		}
391 391
 
392
-		if ( empty( $key ) ) {
392
+		if (empty($key)) {
393 393
 			return false;
394 394
 		}
395 395
 
396
-		$user = Give_Cache::get( md5( 'give_api_user_' . $key ), true );
396
+		$user = Give_Cache::get(md5('give_api_user_'.$key), true);
397 397
 
398
-		if ( false === $user ) {
399
-			$user = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s LIMIT 1", $key ) );
400
-			Give_Cache::set( md5( 'give_api_user_' . $key ), $user, DAY_IN_SECONDS, true );
398
+		if (false === $user) {
399
+			$user = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s LIMIT 1", $key));
400
+			Give_Cache::set(md5('give_api_user_'.$key), $user, DAY_IN_SECONDS, true);
401 401
 		}
402 402
 
403
-		if ( $user != null ) {
403
+		if ($user != null) {
404 404
 			$this->user_id = $user;
405 405
 
406 406
 			return $user;
@@ -416,19 +416,19 @@  discard block
 block discarded – undo
416 416
 	 *
417 417
 	 * @return mixed|null|string
418 418
 	 */
419
-	public function get_user_public_key( $user_id = 0 ) {
419
+	public function get_user_public_key($user_id = 0) {
420 420
 		global $wpdb;
421 421
 
422
-		if ( empty( $user_id ) ) {
422
+		if (empty($user_id)) {
423 423
 			return '';
424 424
 		}
425 425
 
426
-		$cache_key       = md5( 'give_api_user_public_key' . $user_id );
427
-		$user_public_key = Give_Cache::get( $cache_key, true );
426
+		$cache_key       = md5('give_api_user_public_key'.$user_id);
427
+		$user_public_key = Give_Cache::get($cache_key, true);
428 428
 
429
-		if ( empty( $user_public_key ) ) {
430
-			$user_public_key = $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_public_key' AND user_id = %d", $user_id ) );
431
-			Give_Cache::set( $cache_key, $user_public_key, HOUR_IN_SECONDS, true );
429
+		if (empty($user_public_key)) {
430
+			$user_public_key = $wpdb->get_var($wpdb->prepare("SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_public_key' AND user_id = %d", $user_id));
431
+			Give_Cache::set($cache_key, $user_public_key, HOUR_IN_SECONDS, true);
432 432
 		}
433 433
 
434 434
 		return $user_public_key;
@@ -441,19 +441,19 @@  discard block
 block discarded – undo
441 441
 	 *
442 442
 	 * @return mixed|null|string
443 443
 	 */
444
-	public function get_user_secret_key( $user_id = 0 ) {
444
+	public function get_user_secret_key($user_id = 0) {
445 445
 		global $wpdb;
446 446
 
447
-		if ( empty( $user_id ) ) {
447
+		if (empty($user_id)) {
448 448
 			return '';
449 449
 		}
450 450
 
451
-		$cache_key       = md5( 'give_api_user_secret_key' . $user_id );
452
-		$user_secret_key = Give_Cache::get( $cache_key, true );
451
+		$cache_key       = md5('give_api_user_secret_key'.$user_id);
452
+		$user_secret_key = Give_Cache::get($cache_key, true);
453 453
 
454
-		if ( empty( $user_secret_key ) ) {
455
-			$user_secret_key = $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_secret_key' AND user_id = %d", $user_id ) );
456
-			Give_Cache::set( $cache_key, $user_secret_key, HOUR_IN_SECONDS, true );
454
+		if (empty($user_secret_key)) {
455
+			$user_secret_key = $wpdb->get_var($wpdb->prepare("SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_secret_key' AND user_id = %d", $user_id));
456
+			Give_Cache::set($cache_key, $user_secret_key, HOUR_IN_SECONDS, true);
457 457
 		}
458 458
 
459 459
 		return $user_secret_key;
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 	 */
470 470
 	private function missing_auth() {
471 471
 		$error          = array();
472
-		$error['error'] = __( 'You must specify both a token and API key.', 'give' );
472
+		$error['error'] = __('You must specify both a token and API key.', 'give');
473 473
 
474 474
 		$this->data = $error;
475
-		$this->output( 401 );
475
+		$this->output(401);
476 476
 	}
477 477
 
478 478
 	/**
@@ -486,10 +486,10 @@  discard block
 block discarded – undo
486 486
 	 */
487 487
 	private function invalid_auth() {
488 488
 		$error          = array();
489
-		$error['error'] = __( 'Your request could not be authenticated.', 'give' );
489
+		$error['error'] = __('Your request could not be authenticated.', 'give');
490 490
 
491 491
 		$this->data = $error;
492
-		$this->output( 403 );
492
+		$this->output(403);
493 493
 	}
494 494
 
495 495
 	/**
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
 	 */
504 504
 	private function invalid_key() {
505 505
 		$error          = array();
506
-		$error['error'] = __( 'Invalid API key.', 'give' );
506
+		$error['error'] = __('Invalid API key.', 'give');
507 507
 
508 508
 		$this->data = $error;
509
-		$this->output( 403 );
509
+		$this->output(403);
510 510
 	}
511 511
 
512 512
 	/**
@@ -519,10 +519,10 @@  discard block
 block discarded – undo
519 519
 	 */
520 520
 	private function invalid_version() {
521 521
 		$error          = array();
522
-		$error['error'] = __( 'Invalid API version.', 'give' );
522
+		$error['error'] = __('Invalid API version.', 'give');
523 523
 
524 524
 		$this->data = $error;
525
-		$this->output( 404 );
525
+		$this->output(404);
526 526
 	}
527 527
 
528 528
 	/**
@@ -538,10 +538,10 @@  discard block
 block discarded – undo
538 538
 		global $wp_query;
539 539
 
540 540
 		// Start logging how long the request takes for logging
541
-		$before = microtime( true );
541
+		$before = microtime(true);
542 542
 
543 543
 		// Check for give-api var. Get out if not present
544
-		if ( empty( $wp_query->query_vars['give-api'] ) ) {
544
+		if (empty($wp_query->query_vars['give-api'])) {
545 545
 			return;
546 546
 		}
547 547
 
@@ -555,45 +555,45 @@  discard block
 block discarded – undo
555 555
 		$this->validate_request();
556 556
 
557 557
 		// Only proceed if no errors have been noted
558
-		if ( ! $this->is_valid_request ) {
558
+		if ( ! $this->is_valid_request) {
559 559
 			return;
560 560
 		}
561 561
 
562
-		if ( ! defined( 'GIVE_DOING_API' ) ) {
563
-			define( 'GIVE_DOING_API', true );
562
+		if ( ! defined('GIVE_DOING_API')) {
563
+			define('GIVE_DOING_API', true);
564 564
 		}
565 565
 
566 566
 		$data         = array();
567 567
 		$this->routes = new $this->versions[$this->get_queried_version()];
568 568
 		$this->routes->validate_request();
569 569
 
570
-		switch ( $this->endpoint ) :
570
+		switch ($this->endpoint) :
571 571
 
572 572
 			case 'stats' :
573 573
 
574
-				$data = $this->routes->get_stats( array(
575
-					'type'      => isset( $wp_query->query_vars['type'] ) ? $wp_query->query_vars['type'] : null,
576
-					'form'      => isset( $wp_query->query_vars['form'] ) ? $wp_query->query_vars['form'] : null,
577
-					'date'      => isset( $wp_query->query_vars['date'] ) ? $wp_query->query_vars['date'] : null,
578
-					'startdate' => isset( $wp_query->query_vars['startdate'] ) ? $wp_query->query_vars['startdate'] : null,
579
-					'enddate'   => isset( $wp_query->query_vars['enddate'] ) ? $wp_query->query_vars['enddate'] : null,
580
-				) );
574
+				$data = $this->routes->get_stats(array(
575
+					'type'      => isset($wp_query->query_vars['type']) ? $wp_query->query_vars['type'] : null,
576
+					'form'      => isset($wp_query->query_vars['form']) ? $wp_query->query_vars['form'] : null,
577
+					'date'      => isset($wp_query->query_vars['date']) ? $wp_query->query_vars['date'] : null,
578
+					'startdate' => isset($wp_query->query_vars['startdate']) ? $wp_query->query_vars['startdate'] : null,
579
+					'enddate'   => isset($wp_query->query_vars['enddate']) ? $wp_query->query_vars['enddate'] : null,
580
+				));
581 581
 
582 582
 				break;
583 583
 
584 584
 			case 'forms' :
585 585
 
586
-				$form = isset( $wp_query->query_vars['form'] ) ? $wp_query->query_vars['form'] : null;
586
+				$form = isset($wp_query->query_vars['form']) ? $wp_query->query_vars['form'] : null;
587 587
 
588
-				$data = $this->routes->get_forms( $form );
588
+				$data = $this->routes->get_forms($form);
589 589
 
590 590
 				break;
591 591
 
592 592
 			case 'donors' :
593 593
 
594
-				$donor = isset( $wp_query->query_vars['donor'] ) ? $wp_query->query_vars['donor'] : null;
594
+				$donor = isset($wp_query->query_vars['donor']) ? $wp_query->query_vars['donor'] : null;
595 595
 
596
-				$data = $this->routes->get_donors( $donor );
596
+				$data = $this->routes->get_donors($donor);
597 597
 
598 598
 				break;
599 599
 
@@ -606,26 +606,26 @@  discard block
 block discarded – undo
606 606
 				 * @params date startdate | required when date = range and format to be YYYYMMDD (i.e. 20170524)
607 607
 				 * @params date enddate | required when date = range and format to be YYYYMMDD (i.e. 20170524)
608 608
 				 */
609
-				$data = $this->routes->get_recent_donations( array(
610
-					'id'        => isset( $wp_query->query_vars['id'] ) ? $wp_query->query_vars['id'] : null,
611
-					'date'      => isset( $wp_query->query_vars['date'] ) ? $wp_query->query_vars['date'] : null,
612
-					'startdate' => isset( $wp_query->query_vars['startdate'] ) ? $wp_query->query_vars['startdate'] : null,
613
-					'enddate'   => isset( $wp_query->query_vars['enddate'] ) ? $wp_query->query_vars['enddate'] : null,
614
-				) );
609
+				$data = $this->routes->get_recent_donations(array(
610
+					'id'        => isset($wp_query->query_vars['id']) ? $wp_query->query_vars['id'] : null,
611
+					'date'      => isset($wp_query->query_vars['date']) ? $wp_query->query_vars['date'] : null,
612
+					'startdate' => isset($wp_query->query_vars['startdate']) ? $wp_query->query_vars['startdate'] : null,
613
+					'enddate'   => isset($wp_query->query_vars['enddate']) ? $wp_query->query_vars['enddate'] : null,
614
+				));
615 615
 
616 616
 				break;
617 617
 
618 618
 		endswitch;
619 619
 
620 620
 		// Allow extensions to setup their own return data
621
-		$this->data = apply_filters( 'give_api_output_data', $data, $this->endpoint, $this );
621
+		$this->data = apply_filters('give_api_output_data', $data, $this->endpoint, $this);
622 622
 
623
-		$after                       = microtime( true );
624
-		$request_time                = ( $after - $before );
623
+		$after                       = microtime(true);
624
+		$request_time                = ($after - $before);
625 625
 		$this->data['request_speed'] = $request_time;
626 626
 
627 627
 		// Log this API request, if enabled. We log it here because we have access to errors.
628
-		$this->log_request( $this->data );
628
+		$this->log_request($this->data);
629 629
 
630 630
 		// Send out data to the output function
631 631
 		$this->output();
@@ -655,25 +655,25 @@  discard block
 block discarded – undo
655 655
 		global $wp_query;
656 656
 
657 657
 		// Whitelist our query options
658
-		$accepted = apply_filters( 'give_api_valid_query_modes', array(
658
+		$accepted = apply_filters('give_api_valid_query_modes', array(
659 659
 			'stats',
660 660
 			'forms',
661 661
 			'donors',
662 662
 			'donations',
663
-		) );
663
+		));
664 664
 
665
-		$query = isset( $wp_query->query_vars['give-api'] ) ? $wp_query->query_vars['give-api'] : null;
666
-		$query = str_replace( $this->queried_version . '/', '', $query );
665
+		$query = isset($wp_query->query_vars['give-api']) ? $wp_query->query_vars['give-api'] : null;
666
+		$query = str_replace($this->queried_version.'/', '', $query);
667 667
 
668 668
 		$error = array();
669 669
 
670 670
 		// Make sure our query is valid
671
-		if ( ! in_array( $query, $accepted ) ) {
672
-			$error['error'] = __( 'Invalid query.', 'give' );
671
+		if ( ! in_array($query, $accepted)) {
672
+			$error['error'] = __('Invalid query.', 'give');
673 673
 
674 674
 			$this->data = $error;
675 675
 			// 400 is Bad Request
676
-			$this->output( 400 );
676
+			$this->output(400);
677 677
 		}
678 678
 
679 679
 		$this->endpoint = $query;
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 	public function get_paged() {
691 691
 		global $wp_query;
692 692
 
693
-		return isset( $wp_query->query_vars['page'] ) ? $wp_query->query_vars['page'] : 1;
693
+		return isset($wp_query->query_vars['page']) ? $wp_query->query_vars['page'] : 1;
694 694
 	}
695 695
 
696 696
 
@@ -705,13 +705,13 @@  discard block
 block discarded – undo
705 705
 	public function per_page() {
706 706
 		global $wp_query;
707 707
 
708
-		$per_page = isset( $wp_query->query_vars['number'] ) ? $wp_query->query_vars['number'] : 10;
708
+		$per_page = isset($wp_query->query_vars['number']) ? $wp_query->query_vars['number'] : 10;
709 709
 
710
-		if ( $per_page < 0 && $this->get_query_mode() == 'donors' ) {
710
+		if ($per_page < 0 && $this->get_query_mode() == 'donors') {
711 711
 			$per_page = 99999999;
712 712
 		} // End if().
713 713
 
714
-		return apply_filters( 'give_api_results_per_page', $per_page );
714
+		return apply_filters('give_api_results_per_page', $per_page);
715 715
 	}
716 716
 
717 717
 	/**
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 	 *
725 725
 	 * @return array $dates
726 726
 	 */
727
-	public function get_dates( $args = array() ) {
727
+	public function get_dates($args = array()) {
728 728
 		$dates = array();
729 729
 
730 730
 		$defaults = array(
@@ -735,60 +735,60 @@  discard block
 block discarded – undo
735 735
 			'enddate'   => null,
736 736
 		);
737 737
 
738
-		$args = wp_parse_args( $args, $defaults );
738
+		$args = wp_parse_args($args, $defaults);
739 739
 
740
-		$current_time = current_time( 'timestamp' );
740
+		$current_time = current_time('timestamp');
741 741
 
742
-		if ( 'range' === $args['date'] ) {
743
-			$startdate          = strtotime( $args['startdate'] );
744
-			$enddate            = strtotime( $args['enddate'] );
745
-			$dates['day_start'] = date( 'd', $startdate );
746
-			$dates['day_end']   = date( 'd', $enddate );
747
-			$dates['m_start']   = date( 'n', $startdate );
748
-			$dates['m_end']     = date( 'n', $enddate );
749
-			$dates['year']      = date( 'Y', $startdate );
750
-			$dates['year_end']  = date( 'Y', $enddate );
742
+		if ('range' === $args['date']) {
743
+			$startdate          = strtotime($args['startdate']);
744
+			$enddate            = strtotime($args['enddate']);
745
+			$dates['day_start'] = date('d', $startdate);
746
+			$dates['day_end']   = date('d', $enddate);
747
+			$dates['m_start']   = date('n', $startdate);
748
+			$dates['m_end']     = date('n', $enddate);
749
+			$dates['year']      = date('Y', $startdate);
750
+			$dates['year_end']  = date('Y', $enddate);
751 751
 		} else {
752 752
 			// Modify dates based on predefined ranges
753
-			switch ( $args['date'] ) :
753
+			switch ($args['date']) :
754 754
 
755 755
 				case 'this_month' :
756 756
 					$dates['day']     = null;
757
-					$dates['m_start'] = date( 'n', $current_time );
758
-					$dates['m_end']   = date( 'n', $current_time );
759
-					$dates['year']    = date( 'Y', $current_time );
757
+					$dates['m_start'] = date('n', $current_time);
758
+					$dates['m_end']   = date('n', $current_time);
759
+					$dates['year']    = date('Y', $current_time);
760 760
 					break;
761 761
 
762 762
 				case 'last_month' :
763 763
 					$dates['day']     = null;
764
-					$dates['m_start'] = date( 'n', $current_time ) == 1 ? 12 : date( 'n', $current_time ) - 1;
764
+					$dates['m_start'] = date('n', $current_time) == 1 ? 12 : date('n', $current_time) - 1;
765 765
 					$dates['m_end']   = $dates['m_start'];
766
-					$dates['year']    = date( 'n', $current_time ) == 1 ? date( 'Y', $current_time ) - 1 : date( 'Y', $current_time );
766
+					$dates['year']    = date('n', $current_time) == 1 ? date('Y', $current_time) - 1 : date('Y', $current_time);
767 767
 					break;
768 768
 
769 769
 				case 'today' :
770
-					$dates['day']     = date( 'd', $current_time );
771
-					$dates['m_start'] = date( 'n', $current_time );
772
-					$dates['m_end']   = date( 'n', $current_time );
773
-					$dates['year']    = date( 'Y', $current_time );
770
+					$dates['day']     = date('d', $current_time);
771
+					$dates['m_start'] = date('n', $current_time);
772
+					$dates['m_end']   = date('n', $current_time);
773
+					$dates['year']    = date('Y', $current_time);
774 774
 					break;
775 775
 
776 776
 				case 'yesterday' :
777 777
 
778
-					$year  = date( 'Y', $current_time );
779
-					$month = date( 'n', $current_time );
780
-					$day   = date( 'd', $current_time );
778
+					$year  = date('Y', $current_time);
779
+					$month = date('n', $current_time);
780
+					$day   = date('d', $current_time);
781 781
 
782
-					if ( $month == 1 && $day == 1 ) {
782
+					if ($month == 1 && $day == 1) {
783 783
 
784
-						$year  -= 1;
784
+						$year -= 1;
785 785
 						$month = 12;
786
-						$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
786
+						$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
787 787
 
788
-					} elseif ( $month > 1 && $day == 1 ) {
788
+					} elseif ($month > 1 && $day == 1) {
789 789
 
790 790
 						$month -= 1;
791
-						$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
791
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
792 792
 
793 793
 					} else {
794 794
 
@@ -804,65 +804,65 @@  discard block
 block discarded – undo
804 804
 					break;
805 805
 
806 806
 				case 'this_quarter' :
807
-					$month_now = date( 'n', $current_time );
807
+					$month_now = date('n', $current_time);
808 808
 
809 809
 					$dates['day'] = null;
810 810
 
811
-					if ( $month_now <= 3 ) {
811
+					if ($month_now <= 3) {
812 812
 
813 813
 						$dates['m_start'] = 1;
814 814
 						$dates['m_end']   = 3;
815
-						$dates['year']    = date( 'Y', $current_time );
815
+						$dates['year']    = date('Y', $current_time);
816 816
 
817
-					} elseif ( $month_now <= 6 ) {
817
+					} elseif ($month_now <= 6) {
818 818
 
819 819
 						$dates['m_start'] = 4;
820 820
 						$dates['m_end']   = 6;
821
-						$dates['year']    = date( 'Y', $current_time );
821
+						$dates['year']    = date('Y', $current_time);
822 822
 
823
-					} elseif ( $month_now <= 9 ) {
823
+					} elseif ($month_now <= 9) {
824 824
 
825 825
 						$dates['m_start'] = 7;
826 826
 						$dates['m_end']   = 9;
827
-						$dates['year']    = date( 'Y', $current_time );
827
+						$dates['year']    = date('Y', $current_time);
828 828
 
829 829
 					} else {
830 830
 
831 831
 						$dates['m_start'] = 10;
832 832
 						$dates['m_end']   = 12;
833
-						$dates['year']    = date( 'Y', $current_time );
833
+						$dates['year']    = date('Y', $current_time);
834 834
 
835 835
 					}
836 836
 					break;
837 837
 
838 838
 				case 'last_quarter' :
839
-					$month_now = date( 'n', $current_time );
839
+					$month_now = date('n', $current_time);
840 840
 
841 841
 					$dates['day'] = null;
842 842
 
843
-					if ( $month_now <= 3 ) {
843
+					if ($month_now <= 3) {
844 844
 
845 845
 						$dates['m_start'] = 10;
846 846
 						$dates['m_end']   = 12;
847
-						$dates['year']    = date( 'Y', $current_time ) - 1; // Previous year
847
+						$dates['year']    = date('Y', $current_time) - 1; // Previous year
848 848
 
849
-					} elseif ( $month_now <= 6 ) {
849
+					} elseif ($month_now <= 6) {
850 850
 
851 851
 						$dates['m_start'] = 1;
852 852
 						$dates['m_end']   = 3;
853
-						$dates['year']    = date( 'Y', $current_time );
853
+						$dates['year']    = date('Y', $current_time);
854 854
 
855
-					} elseif ( $month_now <= 9 ) {
855
+					} elseif ($month_now <= 9) {
856 856
 
857 857
 						$dates['m_start'] = 4;
858 858
 						$dates['m_end']   = 6;
859
-						$dates['year']    = date( 'Y', $current_time );
859
+						$dates['year']    = date('Y', $current_time);
860 860
 
861 861
 					} else {
862 862
 
863 863
 						$dates['m_start'] = 7;
864 864
 						$dates['m_end']   = 9;
865
-						$dates['year']    = date( 'Y', $current_time );
865
+						$dates['year']    = date('Y', $current_time);
866 866
 
867 867
 					}
868 868
 					break;
@@ -871,14 +871,14 @@  discard block
 block discarded – undo
871 871
 					$dates['day']     = null;
872 872
 					$dates['m_start'] = null;
873 873
 					$dates['m_end']   = null;
874
-					$dates['year']    = date( 'Y', $current_time );
874
+					$dates['year']    = date('Y', $current_time);
875 875
 					break;
876 876
 
877 877
 				case 'last_year' :
878 878
 					$dates['day']     = null;
879 879
 					$dates['m_start'] = null;
880 880
 					$dates['m_end']   = null;
881
-					$dates['year']    = date( 'Y', $current_time ) - 1;
881
+					$dates['year']    = date('Y', $current_time) - 1;
882 882
 					break;
883 883
 
884 884
 			endswitch;
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 		 *
892 892
 		 * @param array $dates The dates used for retrieving earnings.
893 893
 		 */
894
-		return apply_filters( 'give_api_stat_dates', $dates );
894
+		return apply_filters('give_api_stat_dates', $dates);
895 895
 	}
896 896
 
897 897
 	/**
@@ -905,86 +905,86 @@  discard block
 block discarded – undo
905 905
 	 *
906 906
 	 * @return array $donors Multidimensional array of the donors.
907 907
 	 */
908
-	public function get_donors( $donor = null ) {
908
+	public function get_donors($donor = null) {
909 909
 
910 910
 		$donors = array();
911 911
 		$error  = array();
912
-		if ( ! user_can( $this->user_id, 'view_give_sensitive_data' ) && ! $this->override ) {
912
+		if ( ! user_can($this->user_id, 'view_give_sensitive_data') && ! $this->override) {
913 913
 			return $donors;
914 914
 		}
915 915
 
916 916
 		$paged    = $this->get_paged();
917 917
 		$per_page = $this->per_page();
918
-		$offset   = $per_page * ( $paged - 1 );
918
+		$offset   = $per_page * ($paged - 1);
919 919
 
920
-		if ( is_numeric( $donor ) ) {
920
+		if (is_numeric($donor)) {
921 921
 			$field = 'id';
922 922
 		} else {
923 923
 			$field = 'email';
924 924
 		}
925 925
 
926
-		$donor_query = Give()->donors->get_donors( array(
926
+		$donor_query = Give()->donors->get_donors(array(
927 927
 			'number' => $per_page,
928 928
 			'offset' => $offset,
929 929
 			$field   => $donor,
930
-		) );
930
+		));
931 931
 		$donor_count = 0;
932 932
 
933
-		if ( $donor_query ) {
933
+		if ($donor_query) {
934 934
 
935
-			foreach ( $donor_query as $donor_obj ) {
935
+			foreach ($donor_query as $donor_obj) {
936 936
 
937
-				$names      = explode( ' ', $donor_obj->name );
938
-				$first_name = ! empty( $names[0] ) ? $names[0] : '';
937
+				$names      = explode(' ', $donor_obj->name);
938
+				$first_name = ! empty($names[0]) ? $names[0] : '';
939 939
 				$last_name  = '';
940
-				if ( ! empty( $names[1] ) ) {
941
-					unset( $names[0] );
942
-					$last_name = implode( ' ', $names );
940
+				if ( ! empty($names[1])) {
941
+					unset($names[0]);
942
+					$last_name = implode(' ', $names);
943 943
 				}
944 944
 
945
-				$title_prefix = Give()->donor_meta->get_meta( $donor_obj->id, '_give_donor_title_prefix', true );
945
+				$title_prefix = Give()->donor_meta->get_meta($donor_obj->id, '_give_donor_title_prefix', true);
946 946
 
947 947
 				// Set title prefix empty, if not available in db.
948
-				if ( empty( $title_prefix ) ) {
948
+				if (empty($title_prefix)) {
949 949
 					$title_prefix = '';
950 950
 				}
951 951
 
952
-				$donors['donors'][ $donor_count ]['info']['user_id']      = '';
953
-				$donors['donors'][ $donor_count ]['info']['username']     = '';
954
-				$donors['donors'][ $donor_count ]['info']['display_name'] = '';
955
-				$donors['donors'][ $donor_count ]['info']['donor_id']     = $donor_obj->id;
956
-				$donors['donors'][ $donor_count ]['info']['title_prefix'] = $title_prefix;
957
-				$donors['donors'][ $donor_count ]['info']['first_name']   = $first_name;
958
-				$donors['donors'][ $donor_count ]['info']['last_name']    = $last_name;
959
-				$donors['donors'][ $donor_count ]['info']['email']        = $donor_obj->email;
952
+				$donors['donors'][$donor_count]['info']['user_id']      = '';
953
+				$donors['donors'][$donor_count]['info']['username']     = '';
954
+				$donors['donors'][$donor_count]['info']['display_name'] = '';
955
+				$donors['donors'][$donor_count]['info']['donor_id']     = $donor_obj->id;
956
+				$donors['donors'][$donor_count]['info']['title_prefix'] = $title_prefix;
957
+				$donors['donors'][$donor_count]['info']['first_name']   = $first_name;
958
+				$donors['donors'][$donor_count]['info']['last_name']    = $last_name;
959
+				$donors['donors'][$donor_count]['info']['email']        = $donor_obj->email;
960 960
 
961
-				if ( ! empty( $donor_obj->user_id ) ) {
961
+				if ( ! empty($donor_obj->user_id)) {
962 962
 
963
-					$user_data = get_userdata( $donor_obj->user_id );
963
+					$user_data = get_userdata($donor_obj->user_id);
964 964
 
965 965
 					// Donor with registered account.
966
-					$donors['donors'][ $donor_count ]['info']['user_id']      = $donor_obj->user_id;
967
-					$donors['donors'][ $donor_count ]['info']['username']     = $user_data->user_login;
968
-					$donors['donors'][ $donor_count ]['info']['display_name'] = $user_data->display_name;
966
+					$donors['donors'][$donor_count]['info']['user_id']      = $donor_obj->user_id;
967
+					$donors['donors'][$donor_count]['info']['username']     = $user_data->user_login;
968
+					$donors['donors'][$donor_count]['info']['display_name'] = $user_data->display_name;
969 969
 
970 970
 				}
971 971
 
972
-				$donors['donors'][ $donor_count ]['stats']['total_donations'] = $donor_obj->purchase_count;
973
-				$donors['donors'][ $donor_count ]['stats']['total_spent']     = $donor_obj->purchase_value;
972
+				$donors['donors'][$donor_count]['stats']['total_donations'] = $donor_obj->purchase_count;
973
+				$donors['donors'][$donor_count]['stats']['total_spent']     = $donor_obj->purchase_value;
974 974
 
975
-				$donor = new Give_Donor( $donor_obj->id );
975
+				$donor = new Give_Donor($donor_obj->id);
976 976
 
977 977
 				// Get donor's addresses.
978
-				$donors['donors'][ $donor_count ]['address'] = $donor->address;
978
+				$donors['donors'][$donor_count]['address'] = $donor->address;
979 979
 
980
-				$donor_count ++;
980
+				$donor_count++;
981 981
 
982 982
 			} // End foreach().
983
-		} elseif ( $donor ) {
983
+		} elseif ($donor) {
984 984
 
985 985
 			$error['error'] = sprintf(
986 986
 				/* translators: %s: donor */
987
-				__( 'Donor %s not found.', 'give' ),
987
+				__('Donor %s not found.', 'give'),
988 988
 				$donor
989 989
 			);
990 990
 
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 
993 993
 		} else {
994 994
 
995
-			$error['error'] = __( 'No donors found.', 'give' );
995
+			$error['error'] = __('No donors found.', 'give');
996 996
 
997 997
 			return $error;
998 998
 
@@ -1011,37 +1011,37 @@  discard block
 block discarded – undo
1011 1011
 	 *
1012 1012
 	 * @return array $donors Multidimensional array of the forms.
1013 1013
 	 */
1014
-	public function get_forms( $form = null ) {
1014
+	public function get_forms($form = null) {
1015 1015
 
1016 1016
 		$forms = array();
1017 1017
 		$error = array();
1018 1018
 
1019
-		if ( $form == null ) {
1019
+		if ($form == null) {
1020 1020
 			$forms['forms'] = array();
1021 1021
 
1022
-			$form_list = get_posts( array(
1022
+			$form_list = get_posts(array(
1023 1023
 				'post_type'        => 'give_forms',
1024 1024
 				'posts_per_page'   => $this->per_page(),
1025 1025
 				'suppress_filters' => true,
1026 1026
 				'paged'            => $this->get_paged(),
1027
-			) );
1027
+			));
1028 1028
 
1029
-			if ( $form_list ) {
1029
+			if ($form_list) {
1030 1030
 				$i = 0;
1031
-				foreach ( $form_list as $form_info ) {
1032
-					$forms['forms'][ $i ] = $this->get_form_data( $form_info );
1033
-					$i ++;
1031
+				foreach ($form_list as $form_info) {
1032
+					$forms['forms'][$i] = $this->get_form_data($form_info);
1033
+					$i++;
1034 1034
 				}
1035 1035
 			}
1036 1036
 		} else {
1037
-			if ( get_post_type( $form ) == 'give_forms' ) {
1038
-				$form_info = get_post( $form );
1037
+			if (get_post_type($form) == 'give_forms') {
1038
+				$form_info = get_post($form);
1039 1039
 
1040
-				$forms['forms'][0] = $this->get_form_data( $form_info );
1040
+				$forms['forms'][0] = $this->get_form_data($form_info);
1041 1041
 
1042 1042
 			} else {
1043 1043
 				$error['error'] = sprintf( /* translators: %s: form */
1044
-					__( 'Form %s not found.', 'give' ), $form );
1044
+					__('Form %s not found.', 'give'), $form );
1045 1045
 
1046 1046
 				return $error;
1047 1047
 			}
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
 	 *
1060 1060
 	 * @return array                Array of post data to return back in the API.
1061 1061
 	 */
1062
-	private function get_form_data( $form_info ) {
1062
+	private function get_form_data($form_info) {
1063 1063
 
1064 1064
 		$form = array();
1065 1065
 
@@ -1069,60 +1069,60 @@  discard block
 block discarded – undo
1069 1069
 		$form['info']['create_date']   = $form_info->post_date;
1070 1070
 		$form['info']['modified_date'] = $form_info->post_modified;
1071 1071
 		$form['info']['status']        = $form_info->post_status;
1072
-		$form['info']['link']          = html_entity_decode( $form_info->guid );
1073
-		$form['info']['content']       = give_get_meta( $form_info->ID, '_give_form_content', true );
1074
-		$form['info']['thumbnail']     = wp_get_attachment_url( get_post_thumbnail_id( $form_info->ID ) );
1072
+		$form['info']['link']          = html_entity_decode($form_info->guid);
1073
+		$form['info']['content']       = give_get_meta($form_info->ID, '_give_form_content', true);
1074
+		$form['info']['thumbnail']     = wp_get_attachment_url(get_post_thumbnail_id($form_info->ID));
1075 1075
 
1076
-		if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
1077
-			$form['info']['category'] = get_the_terms( $form_info, 'give_forms_category' );
1078
-			$form['info']['tags']     = get_the_terms( $form_info, 'give_forms_tag' );
1076
+		if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
1077
+			$form['info']['category'] = get_the_terms($form_info, 'give_forms_category');
1078
+			$form['info']['tags']     = get_the_terms($form_info, 'give_forms_tag');
1079 1079
 		}
1080
-		if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
1081
-			$form['info']['tags'] = get_the_terms( $form_info, 'give_forms_tag' );
1080
+		if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
1081
+			$form['info']['tags'] = get_the_terms($form_info, 'give_forms_tag');
1082 1082
 		}
1083 1083
 
1084 1084
 		// Check whether any goal is to be achieved for the donation form.
1085
-		$goal_option = give_get_meta( $form_info->ID, '_give_goal_option', true );
1086
-		$goal_amount = give_get_meta( $form_info->ID, '_give_set_goal', true );
1087
-		if ( give_is_setting_enabled( $goal_option ) && $goal_amount ) {
1088
-			$total_income                         = give_get_form_earnings_stats( $form_info->ID );
1089
-			$goal_percentage_completed            = ( $total_income < $goal_amount ) ? round( ( $total_income / $goal_amount ) * 100, 2 ) : 100;
1090
-			$form['goal']['amount']               = isset( $goal_amount ) ? $goal_amount : '';
1091
-			$form['goal']['percentage_completed'] = isset( $goal_percentage_completed ) ? $goal_percentage_completed : '';
1085
+		$goal_option = give_get_meta($form_info->ID, '_give_goal_option', true);
1086
+		$goal_amount = give_get_meta($form_info->ID, '_give_set_goal', true);
1087
+		if (give_is_setting_enabled($goal_option) && $goal_amount) {
1088
+			$total_income                         = give_get_form_earnings_stats($form_info->ID);
1089
+			$goal_percentage_completed            = ($total_income < $goal_amount) ? round(($total_income / $goal_amount) * 100, 2) : 100;
1090
+			$form['goal']['amount']               = isset($goal_amount) ? $goal_amount : '';
1091
+			$form['goal']['percentage_completed'] = isset($goal_percentage_completed) ? $goal_percentage_completed : '';
1092 1092
 		}
1093 1093
 
1094
-		if ( user_can( $this->user_id, 'view_give_reports' ) || $this->override ) {
1095
-			$form['stats']['total']['donations']           = give_get_form_sales_stats( $form_info->ID );
1096
-			$form['stats']['total']['earnings']            = give_get_form_earnings_stats( $form_info->ID );
1097
-			$form['stats']['monthly_average']['donations'] = give_get_average_monthly_form_sales( $form_info->ID );
1098
-			$form['stats']['monthly_average']['earnings']  = give_get_average_monthly_form_earnings( $form_info->ID );
1094
+		if (user_can($this->user_id, 'view_give_reports') || $this->override) {
1095
+			$form['stats']['total']['donations']           = give_get_form_sales_stats($form_info->ID);
1096
+			$form['stats']['total']['earnings']            = give_get_form_earnings_stats($form_info->ID);
1097
+			$form['stats']['monthly_average']['donations'] = give_get_average_monthly_form_sales($form_info->ID);
1098
+			$form['stats']['monthly_average']['earnings']  = give_get_average_monthly_form_earnings($form_info->ID);
1099 1099
 		}
1100 1100
 
1101 1101
 		$counter = 0;
1102
-		if ( give_has_variable_prices( $form_info->ID ) ) {
1103
-			foreach ( give_get_variable_prices( $form_info->ID ) as $price ) {
1104
-				$counter ++;
1102
+		if (give_has_variable_prices($form_info->ID)) {
1103
+			foreach (give_get_variable_prices($form_info->ID) as $price) {
1104
+				$counter++;
1105 1105
 				// multi-level item
1106
-				$level                                     = isset( $price['_give_text'] ) ? $price['_give_text'] : 'level-' . $counter;
1107
-				$form['pricing'][ sanitize_key( $level ) ] = $price['_give_amount'];
1106
+				$level                                     = isset($price['_give_text']) ? $price['_give_text'] : 'level-'.$counter;
1107
+				$form['pricing'][sanitize_key($level)] = $price['_give_amount'];
1108 1108
 
1109 1109
 			}
1110 1110
 		} else {
1111
-			$form['pricing']['amount'] = give_get_form_price( $form_info->ID );
1111
+			$form['pricing']['amount'] = give_get_form_price($form_info->ID);
1112 1112
 		}
1113 1113
 
1114
-		if ( user_can( $this->user_id, 'view_give_sensitive_data' ) || $this->override ) {
1114
+		if (user_can($this->user_id, 'view_give_sensitive_data') || $this->override) {
1115 1115
 
1116 1116
 			/**
1117 1117
 			 * Fires when generating API sensitive data.
1118 1118
 			 *
1119 1119
 			 * @since 1.1
1120 1120
 			 */
1121
-			do_action( 'give_api_sensitive_data' );
1121
+			do_action('give_api_sensitive_data');
1122 1122
 
1123 1123
 		}
1124 1124
 
1125
-		return apply_filters( 'give_api_forms_form', $form );
1125
+		return apply_filters('give_api_forms_form', $form);
1126 1126
 
1127 1127
 	}
1128 1128
 
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
 	 *
1138 1138
 	 * @return array
1139 1139
 	 */
1140
-	public function get_stats( $args = array() ) {
1140
+	public function get_stats($args = array()) {
1141 1141
 		$defaults = array(
1142 1142
 			'type'      => null,
1143 1143
 			'form'      => null,
@@ -1146,9 +1146,9 @@  discard block
 block discarded – undo
1146 1146
 			'enddate'   => null,
1147 1147
 		);
1148 1148
 
1149
-		$args = wp_parse_args( $args, $defaults );
1149
+		$args = wp_parse_args($args, $defaults);
1150 1150
 
1151
-		$dates = $this->get_dates( $args );
1151
+		$dates = $this->get_dates($args);
1152 1152
 
1153 1153
 		$stats     = array();
1154 1154
 		$earnings  = array(
@@ -1159,40 +1159,40 @@  discard block
 block discarded – undo
1159 1159
 		);
1160 1160
 		$error     = array();
1161 1161
 
1162
-		if ( ! user_can( $this->user_id, 'view_give_reports' ) && ! $this->override ) {
1162
+		if ( ! user_can($this->user_id, 'view_give_reports') && ! $this->override) {
1163 1163
 			return $stats;
1164 1164
 		}
1165 1165
 
1166
-		if ( $args['type'] == 'donations' ) {
1166
+		if ($args['type'] == 'donations') {
1167 1167
 
1168
-			if ( $args['form'] == null ) {
1169
-				if ( $args['date'] == null ) {
1168
+			if ($args['form'] == null) {
1169
+				if ($args['date'] == null) {
1170 1170
 					$donations = $this->get_default_sales_stats();
1171
-				} elseif ( $args['date'] === 'range' ) {
1171
+				} elseif ($args['date'] === 'range') {
1172 1172
 					// Return donations for a date range.
1173 1173
 					// Ensure the end date is later than the start date.
1174
-					if ( $args['enddate'] < $args['startdate'] ) {
1175
-						$error['error'] = __( 'The end date must be later than the start date.', 'give' );
1174
+					if ($args['enddate'] < $args['startdate']) {
1175
+						$error['error'] = __('The end date must be later than the start date.', 'give');
1176 1176
 					}
1177 1177
 
1178 1178
 					// Ensure both the start and end date are specified
1179
-					if ( empty( $args['startdate'] ) || empty( $args['enddate'] ) ) {
1180
-						$error['error'] = __( 'Invalid or no date range specified.', 'give' );
1179
+					if (empty($args['startdate']) || empty($args['enddate'])) {
1180
+						$error['error'] = __('Invalid or no date range specified.', 'give');
1181 1181
 					}
1182 1182
 
1183 1183
 					$total = 0;
1184 1184
 
1185 1185
 					// Loop through the years
1186 1186
 					$y = $dates['year'];
1187
-					while ( $y <= $dates['year_end'] ) :
1187
+					while ($y <= $dates['year_end']) :
1188 1188
 
1189
-						if ( $dates['year'] == $dates['year_end'] ) {
1189
+						if ($dates['year'] == $dates['year_end']) {
1190 1190
 							$month_start = $dates['m_start'];
1191 1191
 							$month_end   = $dates['m_end'];
1192
-						} elseif ( $y == $dates['year'] && $dates['year_end'] > $dates['year'] ) {
1192
+						} elseif ($y == $dates['year'] && $dates['year_end'] > $dates['year']) {
1193 1193
 							$month_start = $dates['m_start'];
1194 1194
 							$month_end   = 12;
1195
-						} elseif ( $y == $dates['year_end'] ) {
1195
+						} elseif ($y == $dates['year_end']) {
1196 1196
 							$month_start = 1;
1197 1197
 							$month_end   = $dates['m_end'];
1198 1198
 						} else {
@@ -1201,132 +1201,132 @@  discard block
 block discarded – undo
1201 1201
 						}
1202 1202
 
1203 1203
 						$i = $month_start;
1204
-						while ( $i <= $month_end ) :
1204
+						while ($i <= $month_end) :
1205 1205
 
1206
-							if ( $i == $dates['m_start'] ) {
1206
+							if ($i == $dates['m_start']) {
1207 1207
 								$d = $dates['day_start'];
1208 1208
 							} else {
1209 1209
 								$d = 1;
1210 1210
 							}
1211 1211
 
1212
-							if ( $i == $dates['m_end'] ) {
1212
+							if ($i == $dates['m_end']) {
1213 1213
 								$num_of_days = $dates['day_end'];
1214 1214
 							} else {
1215
-								$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
1215
+								$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
1216 1216
 							}
1217 1217
 
1218
-							while ( $d <= $num_of_days ) :
1219
-								$sale_count = give_get_sales_by_date( $d, $i, $y );
1220
-								$date_key   = date( 'Ymd', strtotime( $y . '/' . $i . '/' . $d ) );
1221
-								if ( ! isset( $donations['sales'][ $date_key ] ) ) {
1222
-									$donations['sales'][ $date_key ] = 0;
1218
+							while ($d <= $num_of_days) :
1219
+								$sale_count = give_get_sales_by_date($d, $i, $y);
1220
+								$date_key   = date('Ymd', strtotime($y.'/'.$i.'/'.$d));
1221
+								if ( ! isset($donations['sales'][$date_key])) {
1222
+									$donations['sales'][$date_key] = 0;
1223 1223
 								}
1224
-								$donations['sales'][ $date_key ] += $sale_count;
1224
+								$donations['sales'][$date_key] += $sale_count;
1225 1225
 								$total                           += $sale_count;
1226
-								$d ++;
1226
+								$d++;
1227 1227
 							endwhile;
1228
-							$i ++;
1228
+							$i++;
1229 1229
 						endwhile;
1230 1230
 
1231
-						$y ++;
1231
+						$y++;
1232 1232
 					endwhile;
1233 1233
 
1234 1234
 					$donations['totals'] = $total;
1235 1235
 				} else {
1236
-					if ( $args['date'] == 'this_quarter' || $args['date'] == 'last_quarter' ) {
1236
+					if ($args['date'] == 'this_quarter' || $args['date'] == 'last_quarter') {
1237 1237
 						$donations_count = 0;
1238 1238
 
1239 1239
 						// Loop through the months
1240 1240
 						$month = $dates['m_start'];
1241 1241
 
1242
-						while ( $month <= $dates['m_end'] ) :
1243
-							$donations_count += give_get_sales_by_date( null, $month, $dates['year'] );
1244
-							$month ++;
1242
+						while ($month <= $dates['m_end']) :
1243
+							$donations_count += give_get_sales_by_date(null, $month, $dates['year']);
1244
+							$month++;
1245 1245
 						endwhile;
1246 1246
 
1247
-						$donations['donations'][ $args['date'] ] = $donations_count;
1247
+						$donations['donations'][$args['date']] = $donations_count;
1248 1248
 					} else {
1249
-						$donations['donations'][ $args['date'] ] = give_get_sales_by_date( $dates['day'], $dates['m_start'], $dates['year'] );
1249
+						$donations['donations'][$args['date']] = give_get_sales_by_date($dates['day'], $dates['m_start'], $dates['year']);
1250 1250
 					}
1251 1251
 				}// End if().
1252
-			} elseif ( $args['form'] == 'all' ) {
1253
-				$forms = get_posts( array(
1252
+			} elseif ($args['form'] == 'all') {
1253
+				$forms = get_posts(array(
1254 1254
 					'post_type' => 'give_forms',
1255 1255
 					'nopaging'  => true,
1256
-				) );
1257
-				$i     = 0;
1258
-				foreach ( $forms as $form_info ) {
1259
-					$donations['donations'][ $i ] = array(
1256
+				));
1257
+				$i = 0;
1258
+				foreach ($forms as $form_info) {
1259
+					$donations['donations'][$i] = array(
1260 1260
 						$form_info->post_name => $this->stats->get_sales(
1261 1261
 							$form_info->ID,
1262
-							is_numeric( $args['startdate'] )
1263
-								? strtotime( $args['startdate'] )
1262
+							is_numeric($args['startdate'])
1263
+								? strtotime($args['startdate'])
1264 1264
 								: $args['startdate'],
1265
-							is_numeric( $args['enddate'] )
1266
-								? strtotime( $args['enddate'] )
1265
+							is_numeric($args['enddate'])
1266
+								? strtotime($args['enddate'])
1267 1267
 								: $args['enddate']
1268 1268
 						),
1269 1269
 					);
1270
-					$i ++;
1270
+					$i++;
1271 1271
 				}
1272 1272
 			} else {
1273
-				if ( get_post_type( $args['form'] ) == 'give_forms' ) {
1274
-					$form_info                 = get_post( $args['form'] );
1273
+				if (get_post_type($args['form']) == 'give_forms') {
1274
+					$form_info                 = get_post($args['form']);
1275 1275
 					$donations['donations'][0] = array(
1276 1276
 						$form_info->post_name => $this->stats->get_sales(
1277 1277
 							$args['form'],
1278
-							is_numeric( $args['startdate'] )
1279
-								? strtotime( $args['startdate'] )
1278
+							is_numeric($args['startdate'])
1279
+								? strtotime($args['startdate'])
1280 1280
 								: $args['startdate'],
1281
-							is_numeric( $args['enddate'] )
1282
-								? strtotime( $args['enddate'] )
1281
+							is_numeric($args['enddate'])
1282
+								? strtotime($args['enddate'])
1283 1283
 								: $args['enddate']
1284 1284
 						),
1285 1285
 					);
1286 1286
 				} else {
1287 1287
 					$error['error'] = sprintf( /* translators: %s: form */
1288
-						__( 'Form %s not found.', 'give' ), $args['form'] );
1288
+						__('Form %s not found.', 'give'), $args['form'] );
1289 1289
 				}
1290 1290
 			}// End if().
1291 1291
 
1292
-			if ( ! empty( $error ) ) {
1292
+			if ( ! empty($error)) {
1293 1293
 				return $error;
1294 1294
 			}
1295 1295
 
1296 1296
 			return $donations;
1297 1297
 
1298
-		} elseif ( $args['type'] == 'earnings' ) {
1299
-			if ( $args['form'] == null ) {
1300
-				if ( $args['date'] == null ) {
1298
+		} elseif ($args['type'] == 'earnings') {
1299
+			if ($args['form'] == null) {
1300
+				if ($args['date'] == null) {
1301 1301
 					$earnings = $this->get_default_earnings_stats();
1302
-				} elseif ( $args['date'] === 'range' ) {
1302
+				} elseif ($args['date'] === 'range') {
1303 1303
 					// Return sales for a date range
1304 1304
 					// Ensure the end date is later than the start date
1305
-					if ( $args['enddate'] < $args['startdate'] ) {
1306
-						$error['error'] = __( 'The end date must be later than the start date.', 'give' );
1305
+					if ($args['enddate'] < $args['startdate']) {
1306
+						$error['error'] = __('The end date must be later than the start date.', 'give');
1307 1307
 					}
1308 1308
 
1309 1309
 					// Ensure both the start and end date are specified
1310
-					if ( empty( $args['startdate'] ) || empty( $args['enddate'] ) ) {
1311
-						$error['error'] = __( 'Invalid or no date range specified.', 'give' );
1310
+					if (empty($args['startdate']) || empty($args['enddate'])) {
1311
+						$error['error'] = __('Invalid or no date range specified.', 'give');
1312 1312
 					}
1313 1313
 
1314 1314
 					$total = (float) 0.00;
1315 1315
 
1316 1316
 					// Loop through the years
1317 1317
 					$y = $dates['year'];
1318
-					if ( ! isset( $earnings['earnings'] ) ) {
1318
+					if ( ! isset($earnings['earnings'])) {
1319 1319
 						$earnings['earnings'] = array();
1320 1320
 					}
1321
-					while ( $y <= $dates['year_end'] ) :
1321
+					while ($y <= $dates['year_end']) :
1322 1322
 
1323
-						if ( $dates['year'] == $dates['year_end'] ) {
1323
+						if ($dates['year'] == $dates['year_end']) {
1324 1324
 							$month_start = $dates['m_start'];
1325 1325
 							$month_end   = $dates['m_end'];
1326
-						} elseif ( $y == $dates['year'] && $dates['year_end'] > $dates['year'] ) {
1326
+						} elseif ($y == $dates['year'] && $dates['year_end'] > $dates['year']) {
1327 1327
 							$month_start = $dates['m_start'];
1328 1328
 							$month_end   = 12;
1329
-						} elseif ( $y == $dates['year_end'] ) {
1329
+						} elseif ($y == $dates['year_end']) {
1330 1330
 							$month_start = 1;
1331 1331
 							$month_end   = $dates['m_end'];
1332 1332
 						} else {
@@ -1335,102 +1335,102 @@  discard block
 block discarded – undo
1335 1335
 						}
1336 1336
 
1337 1337
 						$i = $month_start;
1338
-						while ( $i <= $month_end ) :
1338
+						while ($i <= $month_end) :
1339 1339
 
1340
-							if ( $i == $dates['m_start'] ) {
1340
+							if ($i == $dates['m_start']) {
1341 1341
 								$d = $dates['day_start'];
1342 1342
 							} else {
1343 1343
 								$d = 1;
1344 1344
 							}
1345 1345
 
1346
-							if ( $i == $dates['m_end'] ) {
1346
+							if ($i == $dates['m_end']) {
1347 1347
 								$num_of_days = $dates['day_end'];
1348 1348
 							} else {
1349
-								$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
1349
+								$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
1350 1350
 							}
1351 1351
 
1352
-							while ( $d <= $num_of_days ) :
1353
-								$earnings_stat = give_get_earnings_by_date( $d, $i, $y );
1354
-								$date_key      = date( 'Ymd', strtotime( $y . '/' . $i . '/' . $d ) );
1355
-								if ( ! isset( $earnings['earnings'][ $date_key ] ) ) {
1356
-									$earnings['earnings'][ $date_key ] = 0;
1352
+							while ($d <= $num_of_days) :
1353
+								$earnings_stat = give_get_earnings_by_date($d, $i, $y);
1354
+								$date_key      = date('Ymd', strtotime($y.'/'.$i.'/'.$d));
1355
+								if ( ! isset($earnings['earnings'][$date_key])) {
1356
+									$earnings['earnings'][$date_key] = 0;
1357 1357
 								}
1358
-								$earnings['earnings'][ $date_key ] += $earnings_stat;
1358
+								$earnings['earnings'][$date_key] += $earnings_stat;
1359 1359
 								$total                             += $earnings_stat;
1360
-								$d ++;
1360
+								$d++;
1361 1361
 							endwhile;
1362 1362
 
1363
-							$i ++;
1363
+							$i++;
1364 1364
 						endwhile;
1365 1365
 
1366
-						$y ++;
1366
+						$y++;
1367 1367
 					endwhile;
1368 1368
 
1369 1369
 					$earnings['totals'] = $total;
1370 1370
 				} else {
1371
-					if ( $args['date'] == 'this_quarter' || $args['date'] == 'last_quarter' ) {
1371
+					if ($args['date'] == 'this_quarter' || $args['date'] == 'last_quarter') {
1372 1372
 						$earnings_count = (float) 0.00;
1373 1373
 
1374 1374
 						// Loop through the months
1375 1375
 						$month = $dates['m_start'];
1376 1376
 
1377
-						while ( $month <= $dates['m_end'] ) :
1378
-							$earnings_count += give_get_earnings_by_date( null, $month, $dates['year'] );
1379
-							$month ++;
1377
+						while ($month <= $dates['m_end']) :
1378
+							$earnings_count += give_get_earnings_by_date(null, $month, $dates['year']);
1379
+							$month++;
1380 1380
 						endwhile;
1381 1381
 
1382
-						$earnings['earnings'][ $args['date'] ] = $earnings_count;
1382
+						$earnings['earnings'][$args['date']] = $earnings_count;
1383 1383
 					} else {
1384
-						$earnings['earnings'][ $args['date'] ] = give_get_earnings_by_date( $dates['day'], $dates['m_start'], $dates['year'] );
1384
+						$earnings['earnings'][$args['date']] = give_get_earnings_by_date($dates['day'], $dates['m_start'], $dates['year']);
1385 1385
 					}
1386 1386
 				}// End if().
1387
-			} elseif ( $args['form'] == 'all' ) {
1388
-				$forms = get_posts( array(
1387
+			} elseif ($args['form'] == 'all') {
1388
+				$forms = get_posts(array(
1389 1389
 					'post_type' => 'give_forms',
1390 1390
 					'nopaging'  => true,
1391
-				) );
1391
+				));
1392 1392
 
1393 1393
 				$i = 0;
1394
-				foreach ( $forms as $form_info ) {
1395
-					$earnings['earnings'][ $i ] = array(
1396
-						$form_info->post_name => give_get_form_earnings_stats( $form_info->ID ),
1394
+				foreach ($forms as $form_info) {
1395
+					$earnings['earnings'][$i] = array(
1396
+						$form_info->post_name => give_get_form_earnings_stats($form_info->ID),
1397 1397
 					);
1398
-					$i ++;
1398
+					$i++;
1399 1399
 				}
1400 1400
 			} else {
1401
-				if ( get_post_type( $args['form'] ) == 'give_forms' ) {
1402
-					$form_info               = get_post( $args['form'] );
1401
+				if (get_post_type($args['form']) == 'give_forms') {
1402
+					$form_info               = get_post($args['form']);
1403 1403
 					$earnings['earnings'][0] = array(
1404 1404
 						$form_info->post_name => $this->stats->get_earnings(
1405 1405
 								$args['form'],
1406
-								is_numeric( $args['startdate'] )
1407
-									? strtotime( $args['startdate'] )
1406
+								is_numeric($args['startdate'])
1407
+									? strtotime($args['startdate'])
1408 1408
 									: $args['startdate'],
1409
-								is_numeric( $args['enddate'] )
1410
-									? strtotime( $args['enddate'] )
1409
+								is_numeric($args['enddate'])
1410
+									? strtotime($args['enddate'])
1411 1411
 									: $args['enddate']
1412 1412
 						),
1413 1413
 					);
1414 1414
 				} else {
1415 1415
 					$error['error'] = sprintf( /* translators: %s: form */
1416
-						__( 'Form %s not found.', 'give' ), $args['form'] );
1416
+						__('Form %s not found.', 'give'), $args['form'] );
1417 1417
 				}
1418 1418
 			}// End if().
1419 1419
 
1420
-			if ( ! empty( $error ) ) {
1420
+			if ( ! empty($error)) {
1421 1421
 				return $error;
1422 1422
 			}
1423 1423
 
1424 1424
 			return $earnings;
1425
-		} elseif ( $args['type'] == 'donors' ) {
1425
+		} elseif ($args['type'] == 'donors') {
1426 1426
 			$donors                             = new Give_DB_Donors();
1427 1427
 			$stats['donations']['total_donors'] = $donors->count();
1428 1428
 
1429 1429
 			return $stats;
1430 1430
 
1431
-		} elseif ( empty( $args['type'] ) ) {
1432
-			$stats = array_merge( $stats, $this->get_default_sales_stats() );
1433
-			$stats = array_merge( $stats, $this->get_default_earnings_stats() );
1431
+		} elseif (empty($args['type'])) {
1432
+			$stats = array_merge($stats, $this->get_default_sales_stats());
1433
+			$stats = array_merge($stats, $this->get_default_earnings_stats());
1434 1434
 
1435 1435
 			return array(
1436 1436
 				'stats' => $stats,
@@ -1448,7 +1448,7 @@  discard block
 block discarded – undo
1448 1448
 	 *
1449 1449
 	 * @return array
1450 1450
 	 */
1451
-	public function get_recent_donations( $args = array() ) {
1451
+	public function get_recent_donations($args = array()) {
1452 1452
 		global $wp_query;
1453 1453
 
1454 1454
 		$defaults = array(
@@ -1458,33 +1458,33 @@  discard block
 block discarded – undo
1458 1458
 			'enddate'   => null,
1459 1459
 		);
1460 1460
 
1461
-		$args = wp_parse_args( $args, $defaults );
1461
+		$args = wp_parse_args($args, $defaults);
1462 1462
 
1463 1463
 		$donations = array();
1464 1464
 
1465
-		if ( ! user_can( $this->user_id, 'view_give_reports' ) && ! $this->override ) {
1465
+		if ( ! user_can($this->user_id, 'view_give_reports') && ! $this->override) {
1466 1466
 			return $donations;
1467 1467
 		}
1468 1468
 
1469
-		if ( isset( $wp_query->query_vars['id'] ) ) {
1469
+		if (isset($wp_query->query_vars['id'])) {
1470 1470
 			$query   = array();
1471
-			$query[] = new Give_Payment( $wp_query->query_vars['id'] );
1472
-		} elseif ( isset( $wp_query->query_vars['purchasekey'] ) ) {
1471
+			$query[] = new Give_Payment($wp_query->query_vars['id']);
1472
+		} elseif (isset($wp_query->query_vars['purchasekey'])) {
1473 1473
 			$query   = array();
1474
-			$query[] = give_get_payment_by( 'key', $wp_query->query_vars['purchasekey'] );
1475
-		} elseif ( isset( $wp_query->query_vars['email'] ) ) {
1476
-			$args  = array(
1474
+			$query[] = give_get_payment_by('key', $wp_query->query_vars['purchasekey']);
1475
+		} elseif (isset($wp_query->query_vars['email'])) {
1476
+			$args = array(
1477 1477
 				'fields'     => 'ids',
1478 1478
 				'meta_key'   => '_give_payment_donor_email',
1479 1479
 				'meta_value' => $wp_query->query_vars['email'],
1480 1480
 				'number'     => $this->per_page(),
1481 1481
 				'page'       => $this->get_paged(),
1482 1482
 			);
1483
-			$query = give_get_payments( $args );
1484
-		} elseif ( isset( $wp_query->query_vars['date'] ) ) {
1483
+			$query = give_get_payments($args);
1484
+		} elseif (isset($wp_query->query_vars['date'])) {
1485 1485
 
1486
-			$current_time = current_time( 'timestamp' );
1487
-			$dates        = $this->get_dates( $args );
1486
+			$current_time = current_time('timestamp');
1487
+			$dates        = $this->get_dates($args);
1488 1488
 			$start_date   = '';
1489 1489
 			$end_date     = '';
1490 1490
 
@@ -1497,27 +1497,27 @@  discard block
 block discarded – undo
1497 1497
 			 * @params date startdate | required when date = range and format to be YYYYMMDD (i.e. 20170524)
1498 1498
 			 * @params date enddate | required when date = range and format to be YYYYMMDD (i.e. 20170524)
1499 1499
 			 */
1500
-			switch ( $wp_query->query_vars['date'] ) {
1500
+			switch ($wp_query->query_vars['date']) {
1501 1501
 
1502 1502
 				case 'today':
1503 1503
 
1504 1504
 					// Set and Format Start and End Date to be date of today.
1505
-					$start_date = $end_date = date( 'Y/m/d', $current_time );
1505
+					$start_date = $end_date = date('Y/m/d', $current_time);
1506 1506
 
1507 1507
 					break;
1508 1508
 
1509 1509
 				case 'yesterday':
1510 1510
 
1511 1511
 					// Set and Format Start and End Date to be date of yesterday.
1512
-					$start_date = $end_date = date( 'Y/m', $current_time ) . '/' . ( date( 'd', $current_time ) - 1 );
1512
+					$start_date = $end_date = date('Y/m', $current_time).'/'.(date('d', $current_time) - 1);
1513 1513
 
1514 1514
 					break;
1515 1515
 
1516 1516
 				case 'range':
1517 1517
 
1518 1518
 					// Format Start Date and End Date for filtering payment based on date range.
1519
-					$start_date = $dates['year'] . '/' . $dates['m_start'] . '/' . $dates['day_start'];
1520
-					$end_date   = $dates['year_end'] . '/' . $dates['m_end'] . '/' . $dates['day_end'];
1519
+					$start_date = $dates['year'].'/'.$dates['m_start'].'/'.$dates['day_start'];
1520
+					$end_date   = $dates['year_end'].'/'.$dates['m_end'].'/'.$dates['day_end'];
1521 1521
 
1522 1522
 					break;
1523 1523
 
@@ -1531,22 +1531,22 @@  discard block
 block discarded – undo
1531 1531
 				'page'       => $this->get_paged(),
1532 1532
 			);
1533 1533
 
1534
-			$query = give_get_payments( $args );
1534
+			$query = give_get_payments($args);
1535 1535
 		} else {
1536 1536
 			$args  = array(
1537 1537
 				'fields' => 'ids',
1538 1538
 				'number' => $this->per_page(),
1539 1539
 				'page'   => $this->get_paged(),
1540 1540
 			);
1541
-			$query = give_get_payments( $args );
1541
+			$query = give_get_payments($args);
1542 1542
 		}// End if().
1543 1543
 
1544
-		if ( $query ) {
1544
+		if ($query) {
1545 1545
 			$i = 0;
1546
-			foreach ( $query as $payment ) {
1546
+			foreach ($query as $payment) {
1547 1547
 
1548
-				if ( is_numeric( $payment ) ) {
1549
-					$payment      = new Give_Payment( $payment );
1548
+				if (is_numeric($payment)) {
1549
+					$payment      = new Give_Payment($payment);
1550 1550
 					$payment_meta = $payment->get_meta();
1551 1551
 					$user_info    = $payment->user_info;
1552 1552
 				}
@@ -1554,44 +1554,44 @@  discard block
 block discarded – undo
1554 1554
 				$payment_meta = $payment->get_meta();
1555 1555
 				$user_info    = $payment->user_info;
1556 1556
 
1557
-				$first_name = isset( $user_info['first_name'] ) ? $user_info['first_name'] : '';
1558
-				$last_name  = isset( $user_info['last_name'] ) ? $user_info['last_name'] : '';
1559
-
1560
-				$donations['donations'][ $i ]['ID']             = $payment->ID;
1561
-				$donations['donations'][ $i ]['number']         = $payment->number;
1562
-				$donations['donations'][ $i ]['transaction_id'] = $payment->transaction_id;
1563
-				$donations['donations'][ $i ]['key']            = $payment->key;
1564
-				$donations['donations'][ $i ]['total']          = $payment->total;
1565
-				$donations['donations'][ $i ]['status']         = give_get_payment_status( $payment, true );
1566
-				$donations['donations'][ $i ]['gateway']        = $payment->gateway;
1567
-				$donations['donations'][ $i ]['name']           = $first_name . ' ' . $last_name;
1568
-				$donations['donations'][ $i ]['fname']          = $first_name;
1569
-				$donations['donations'][ $i ]['lname']          = $last_name;
1570
-				$donations['donations'][ $i ]['email']          = $payment->email;
1571
-				$donations['donations'][ $i ]['date']           = $payment->date;
1572
-				$donations['donations'][ $i ]['payment_meta']   = array();
1573
-
1574
-				$form_id  = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : $payment_meta;
1575
-				$price    = isset( $payment_meta['form_id'] ) ? give_get_form_price( $payment_meta['form_id'] ) : false;
1576
-				$price_id = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null;
1577
-
1578
-				$donations['donations'][ $i ]['form']['id']    = $form_id;
1579
-				$donations['donations'][ $i ]['form']['name']  = get_the_title( $payment_meta['form_id'] );
1580
-				$donations['donations'][ $i ]['form']['price'] = $price;
1581
-
1582
-				if ( give_has_variable_prices( $form_id ) ) {
1583
-					if ( isset( $payment_meta['price_id'] ) ) {
1584
-						$price_name                                         = give_get_price_option_name( $form_id, $payment_meta['price_id'], $payment->ID );
1585
-						$donations['donations'][ $i ]['form']['price_name'] = $price_name;
1586
-						$donations['donations'][ $i ]['form']['price_id']   = $price_id;
1587
-						$donations['donations'][ $i ]['form']['price']      = give_get_price_option_amount( $form_id, $price_id );
1557
+				$first_name = isset($user_info['first_name']) ? $user_info['first_name'] : '';
1558
+				$last_name  = isset($user_info['last_name']) ? $user_info['last_name'] : '';
1559
+
1560
+				$donations['donations'][$i]['ID']             = $payment->ID;
1561
+				$donations['donations'][$i]['number']         = $payment->number;
1562
+				$donations['donations'][$i]['transaction_id'] = $payment->transaction_id;
1563
+				$donations['donations'][$i]['key']            = $payment->key;
1564
+				$donations['donations'][$i]['total']          = $payment->total;
1565
+				$donations['donations'][$i]['status']         = give_get_payment_status($payment, true);
1566
+				$donations['donations'][$i]['gateway']        = $payment->gateway;
1567
+				$donations['donations'][$i]['name']           = $first_name.' '.$last_name;
1568
+				$donations['donations'][$i]['fname']          = $first_name;
1569
+				$donations['donations'][$i]['lname']          = $last_name;
1570
+				$donations['donations'][$i]['email']          = $payment->email;
1571
+				$donations['donations'][$i]['date']           = $payment->date;
1572
+				$donations['donations'][$i]['payment_meta']   = array();
1573
+
1574
+				$form_id  = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : $payment_meta;
1575
+				$price    = isset($payment_meta['form_id']) ? give_get_form_price($payment_meta['form_id']) : false;
1576
+				$price_id = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
1577
+
1578
+				$donations['donations'][$i]['form']['id']    = $form_id;
1579
+				$donations['donations'][$i]['form']['name']  = get_the_title($payment_meta['form_id']);
1580
+				$donations['donations'][$i]['form']['price'] = $price;
1581
+
1582
+				if (give_has_variable_prices($form_id)) {
1583
+					if (isset($payment_meta['price_id'])) {
1584
+						$price_name                                         = give_get_price_option_name($form_id, $payment_meta['price_id'], $payment->ID);
1585
+						$donations['donations'][$i]['form']['price_name'] = $price_name;
1586
+						$donations['donations'][$i]['form']['price_id']   = $price_id;
1587
+						$donations['donations'][$i]['form']['price']      = give_get_price_option_amount($form_id, $price_id);
1588 1588
 
1589 1589
 					}
1590 1590
 				}
1591 1591
 
1592
-				if( ! empty( $payment_meta ) ) {
1592
+				if ( ! empty($payment_meta)) {
1593 1593
 					// Add custom meta to API
1594
-					foreach ( $payment_meta as $meta_key => $meta_value ) {
1594
+					foreach ($payment_meta as $meta_key => $meta_value) {
1595 1595
 
1596 1596
 						$exceptions = array(
1597 1597
 							'form_title',
@@ -1604,20 +1604,20 @@  discard block
 block discarded – undo
1604 1604
 						);
1605 1605
 
1606 1606
 						// Don't clutter up results with dupes
1607
-						if ( in_array( $meta_key, $exceptions ) ) {
1607
+						if (in_array($meta_key, $exceptions)) {
1608 1608
 							continue;
1609 1609
 						}
1610 1610
 
1611
-						$donations['donations'][ $i ]['payment_meta'][ $meta_key ] = $meta_value;
1611
+						$donations['donations'][$i]['payment_meta'][$meta_key] = $meta_value;
1612 1612
 
1613 1613
 					}
1614 1614
 				}
1615 1615
 
1616
-				$i ++;
1616
+				$i++;
1617 1617
 			}// End foreach().
1618 1618
 		}// End if().
1619 1619
 
1620
-		return apply_filters( 'give_api_donations_endpoint', $donations );
1620
+		return apply_filters('give_api_donations_endpoint', $donations);
1621 1621
 	}
1622 1622
 
1623 1623
 	/**
@@ -1633,9 +1633,9 @@  discard block
 block discarded – undo
1633 1633
 	public function get_output_format() {
1634 1634
 		global $wp_query;
1635 1635
 
1636
-		$format = isset( $wp_query->query_vars['format'] ) ? $wp_query->query_vars['format'] : 'json';
1636
+		$format = isset($wp_query->query_vars['format']) ? $wp_query->query_vars['format'] : 'json';
1637 1637
 
1638
-		return apply_filters( 'give_api_output_format', $format );
1638
+		return apply_filters('give_api_output_format', $format);
1639 1639
 	}
1640 1640
 
1641 1641
 
@@ -1651,8 +1651,8 @@  discard block
 block discarded – undo
1651 1651
 	 *
1652 1652
 	 * @return void
1653 1653
 	 */
1654
-	private function log_request( $data = array() ) {
1655
-		if ( ! $this->log_requests ) {
1654
+	private function log_request($data = array()) {
1655
+		if ( ! $this->log_requests) {
1656 1656
 			return;
1657 1657
 		}
1658 1658
 
@@ -1663,37 +1663,37 @@  discard block
 block discarded – undo
1663 1663
 
1664 1664
 		$query = array(
1665 1665
 			'give-api'    => $wp_query->query_vars['give-api'],
1666
-			'key'         => isset( $wp_query->query_vars['key'] ) ? $wp_query->query_vars['key'] : null,
1667
-			'token'       => isset( $wp_query->query_vars['token'] ) ? $wp_query->query_vars['token'] : null,
1668
-			'query'       => isset( $wp_query->query_vars['query'] ) ? $wp_query->query_vars['query'] : null,
1669
-			'type'        => isset( $wp_query->query_vars['type'] ) ? $wp_query->query_vars['type'] : null,
1670
-			'form'        => isset( $wp_query->query_vars['form'] ) ? $wp_query->query_vars['form'] : null,
1671
-			'donor'       => isset( $wp_query->query_vars['donor'] ) ? $wp_query->query_vars['donor'] : null,
1672
-			'date'        => isset( $wp_query->query_vars['date'] ) ? $wp_query->query_vars['date'] : null,
1673
-			'startdate'   => isset( $wp_query->query_vars['startdate'] ) ? $wp_query->query_vars['startdate'] : null,
1674
-			'enddate'     => isset( $wp_query->query_vars['enddate'] ) ? $wp_query->query_vars['enddate'] : null,
1675
-			'id'          => isset( $wp_query->query_vars['id'] ) ? $wp_query->query_vars['id'] : null,
1676
-			'purchasekey' => isset( $wp_query->query_vars['purchasekey'] ) ? $wp_query->query_vars['purchasekey'] : null,
1677
-			'email'       => isset( $wp_query->query_vars['email'] ) ? $wp_query->query_vars['email'] : null,
1666
+			'key'         => isset($wp_query->query_vars['key']) ? $wp_query->query_vars['key'] : null,
1667
+			'token'       => isset($wp_query->query_vars['token']) ? $wp_query->query_vars['token'] : null,
1668
+			'query'       => isset($wp_query->query_vars['query']) ? $wp_query->query_vars['query'] : null,
1669
+			'type'        => isset($wp_query->query_vars['type']) ? $wp_query->query_vars['type'] : null,
1670
+			'form'        => isset($wp_query->query_vars['form']) ? $wp_query->query_vars['form'] : null,
1671
+			'donor'       => isset($wp_query->query_vars['donor']) ? $wp_query->query_vars['donor'] : null,
1672
+			'date'        => isset($wp_query->query_vars['date']) ? $wp_query->query_vars['date'] : null,
1673
+			'startdate'   => isset($wp_query->query_vars['startdate']) ? $wp_query->query_vars['startdate'] : null,
1674
+			'enddate'     => isset($wp_query->query_vars['enddate']) ? $wp_query->query_vars['enddate'] : null,
1675
+			'id'          => isset($wp_query->query_vars['id']) ? $wp_query->query_vars['id'] : null,
1676
+			'purchasekey' => isset($wp_query->query_vars['purchasekey']) ? $wp_query->query_vars['purchasekey'] : null,
1677
+			'email'       => isset($wp_query->query_vars['email']) ? $wp_query->query_vars['email'] : null,
1678 1678
 		);
1679 1679
 
1680 1680
 		$log_data = array(
1681 1681
 			'log_type'     => 'api_request',
1682
-			'post_excerpt' => http_build_query( $query ),
1683
-			'post_content' => ! empty( $data['error'] ) ? $data['error'] : '',
1682
+			'post_excerpt' => http_build_query($query),
1683
+			'post_content' => ! empty($data['error']) ? $data['error'] : '',
1684 1684
 		);
1685 1685
 
1686 1686
 		$log_meta = array(
1687
-			'api_query'  => http_build_query( $query ),
1687
+			'api_query'  => http_build_query($query),
1688 1688
 			'request_ip' => give_get_ip(),
1689 1689
 			'user'       => $this->user_id,
1690
-			'key'        => isset( $wp_query->query_vars['key'] ) ? $wp_query->query_vars['key'] : null,
1691
-			'token'      => isset( $wp_query->query_vars['token'] ) ? $wp_query->query_vars['token'] : null,
1690
+			'key'        => isset($wp_query->query_vars['key']) ? $wp_query->query_vars['key'] : null,
1691
+			'token'      => isset($wp_query->query_vars['token']) ? $wp_query->query_vars['token'] : null,
1692 1692
 			'time'       => $data['request_speed'],
1693 1693
 			'version'    => $this->get_queried_version(),
1694 1694
 		);
1695 1695
 
1696
-		Give()->logs->insert_log( $log_data, $log_meta );
1696
+		Give()->logs->insert_log($log_data, $log_meta);
1697 1697
 	}
1698 1698
 
1699 1699
 
@@ -1717,11 +1717,11 @@  discard block
 block discarded – undo
1717 1717
 	 *
1718 1718
 	 * @param int       $status_code
1719 1719
 	 */
1720
-	public function output( $status_code = 200 ) {
1720
+	public function output($status_code = 200) {
1721 1721
 
1722 1722
 		$format = $this->get_output_format();
1723 1723
 
1724
-		status_header( $status_code );
1724
+		status_header($status_code);
1725 1725
 
1726 1726
 		/**
1727 1727
 		 * Fires before outputting the API.
@@ -1732,25 +1732,25 @@  discard block
 block discarded – undo
1732 1732
 		 * @param Give_API $this   The Give_API object.
1733 1733
 		 * @param string   $format Output format, XML or JSON. Default is JSON.
1734 1734
 		 */
1735
-		do_action( 'give_api_output_before', $this->data, $this, $format );
1735
+		do_action('give_api_output_before', $this->data, $this, $format);
1736 1736
 
1737
-		switch ( $format ) :
1737
+		switch ($format) :
1738 1738
 
1739 1739
 			case 'xml' :
1740 1740
 
1741
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/array2xml.php';
1742
-				$xml = Array2XML::createXML( 'give', $this->data );
1741
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/array2xml.php';
1742
+				$xml = Array2XML::createXML('give', $this->data);
1743 1743
 				echo $xml->saveXML();
1744 1744
 
1745 1745
 				break;
1746 1746
 
1747 1747
 			case 'json' :
1748 1748
 
1749
-				header( 'Content-Type: application/json' );
1750
-				if ( ! empty( $this->pretty_print ) ) {
1751
-					echo json_encode( $this->data, $this->pretty_print );
1749
+				header('Content-Type: application/json');
1750
+				if ( ! empty($this->pretty_print)) {
1751
+					echo json_encode($this->data, $this->pretty_print);
1752 1752
 				} else {
1753
-					echo json_encode( $this->data );
1753
+					echo json_encode($this->data);
1754 1754
 				}
1755 1755
 
1756 1756
 				break;
@@ -1765,7 +1765,7 @@  discard block
 block discarded – undo
1765 1765
 				 * @param array    $data Response data to return.
1766 1766
 				 * @param Give_API $this The Give_API object.
1767 1767
 				 */
1768
-				do_action( "give_api_output_{$format}", $this->data, $this );
1768
+				do_action("give_api_output_{$format}", $this->data, $this);
1769 1769
 
1770 1770
 				break;
1771 1771
 
@@ -1780,7 +1780,7 @@  discard block
 block discarded – undo
1780 1780
 		 * @param Give_API $this   The Give_API object.
1781 1781
 		 * @param string   $format Output format, XML or JSON. Default is JSON.
1782 1782
 		 */
1783
-		do_action( 'give_api_output_after', $this->data, $this, $format );
1783
+		do_action('give_api_output_after', $this->data, $this, $format);
1784 1784
 
1785 1785
 		give_die();
1786 1786
 	}
@@ -1797,41 +1797,41 @@  discard block
 block discarded – undo
1797 1797
 	 *
1798 1798
 	 * @return void
1799 1799
 	 */
1800
-	function user_key_field( $user ) {
1800
+	function user_key_field($user) {
1801 1801
 
1802
-		if ( ( give_get_option( 'api_allow_user_keys', false ) || current_user_can( 'manage_give_settings' ) ) && current_user_can( 'edit_user', $user->ID ) ) {
1802
+		if ((give_get_option('api_allow_user_keys', false) || current_user_can('manage_give_settings')) && current_user_can('edit_user', $user->ID)) {
1803 1803
 
1804
-			$user = get_userdata( $user->ID );
1804
+			$user = get_userdata($user->ID);
1805 1805
 			?>
1806 1806
 			<table class="form-table">
1807 1807
 				<tbody>
1808 1808
 				<tr>
1809 1809
 					<th>
1810
-						<?php _e( 'Give API Keys', 'give' ); ?>
1810
+						<?php _e('Give API Keys', 'give'); ?>
1811 1811
 					</th>
1812 1812
 					<td>
1813 1813
 						<?php
1814
-						$public_key = $this->get_user_public_key( $user->ID );
1815
-						$secret_key = $this->get_user_secret_key( $user->ID );
1814
+						$public_key = $this->get_user_public_key($user->ID);
1815
+						$secret_key = $this->get_user_secret_key($user->ID);
1816 1816
 						?>
1817
-						<?php if ( empty( $user->give_user_public_key ) ) { ?>
1817
+						<?php if (empty($user->give_user_public_key)) { ?>
1818 1818
 							<input name="give_set_api_key" type="checkbox" id="give_set_api_key" />
1819
-							<span class="description"><?php _e( 'Generate API Key', 'give' ); ?></span>
1819
+							<span class="description"><?php _e('Generate API Key', 'give'); ?></span>
1820 1820
 						<?php } else { ?>
1821
-							<strong style="display:inline-block; width: 125px;"><?php _e( 'Public key:', 'give' ); ?>
1821
+							<strong style="display:inline-block; width: 125px;"><?php _e('Public key:', 'give'); ?>
1822 1822
 								&nbsp;</strong>
1823
-							<input type="text" disabled="disabled" class="regular-text" id="publickey" value="<?php echo esc_attr( $public_key ); ?>" />
1823
+							<input type="text" disabled="disabled" class="regular-text" id="publickey" value="<?php echo esc_attr($public_key); ?>" />
1824 1824
 							<br />
1825
-							<strong style="display:inline-block; width: 125px;"><?php _e( 'Secret key:', 'give' ); ?>
1825
+							<strong style="display:inline-block; width: 125px;"><?php _e('Secret key:', 'give'); ?>
1826 1826
 								&nbsp;</strong>
1827
-							<input type="text" disabled="disabled" class="regular-text" id="privatekey" value="<?php echo esc_attr( $secret_key ); ?>" />
1827
+							<input type="text" disabled="disabled" class="regular-text" id="privatekey" value="<?php echo esc_attr($secret_key); ?>" />
1828 1828
 							<br />
1829
-							<strong style="display:inline-block; width: 125px;"><?php _e( 'Token:', 'give' ); ?>
1829
+							<strong style="display:inline-block; width: 125px;"><?php _e('Token:', 'give'); ?>
1830 1830
 								&nbsp;</strong>
1831
-							<input type="text" disabled="disabled" class="regular-text" id="token" value="<?php echo esc_attr( $this->get_token( $user->ID ) ); ?>" />
1831
+							<input type="text" disabled="disabled" class="regular-text" id="token" value="<?php echo esc_attr($this->get_token($user->ID)); ?>" />
1832 1832
 							<br />
1833 1833
 							<input name="give_revoke_api_key" type="checkbox" id="give_revoke_api_key" />
1834
-							<span class="description"><label for="give_revoke_api_key"><?php _e( 'Revoke API Keys', 'give' ); ?></label></span>
1834
+							<span class="description"><label for="give_revoke_api_key"><?php _e('Revoke API Keys', 'give'); ?></label></span>
1835 1835
 						<?php } ?>
1836 1836
 					</td>
1837 1837
 				</tr>
@@ -1850,61 +1850,61 @@  discard block
 block discarded – undo
1850 1850
 	 *
1851 1851
 	 * @return void
1852 1852
 	 */
1853
-	public function process_api_key( $args ) {
1853
+	public function process_api_key($args) {
1854 1854
 
1855
-		if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'give-api-nonce' ) ) {
1856
-			wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array(
1855
+		if ( ! wp_verify_nonce($_REQUEST['_wpnonce'], 'give-api-nonce')) {
1856
+			wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array(
1857 1857
 				'response' => 403,
1858
-			) );
1858
+			));
1859 1859
 		}
1860 1860
 
1861
-		if ( empty( $args['user_id'] ) ) {
1862
-			wp_die( __( 'User ID Required.', 'give' ), __( 'Error', 'give' ), array(
1861
+		if (empty($args['user_id'])) {
1862
+			wp_die(__('User ID Required.', 'give'), __('Error', 'give'), array(
1863 1863
 				'response' => 401,
1864
-			) );
1864
+			));
1865 1865
 		}
1866 1866
 
1867
-		if ( is_numeric( $args['user_id'] ) ) {
1868
-			$user_id = isset( $args['user_id'] ) ? absint( $args['user_id'] ) : get_current_user_id();
1867
+		if (is_numeric($args['user_id'])) {
1868
+			$user_id = isset($args['user_id']) ? absint($args['user_id']) : get_current_user_id();
1869 1869
 		} else {
1870
-			$userdata = get_user_by( 'login', $args['user_id'] );
1870
+			$userdata = get_user_by('login', $args['user_id']);
1871 1871
 			$user_id  = $userdata->ID;
1872 1872
 		}
1873
-		$process = isset( $args['give_api_process'] ) ? strtolower( $args['give_api_process'] ) : false;
1873
+		$process = isset($args['give_api_process']) ? strtolower($args['give_api_process']) : false;
1874 1874
 
1875
-		if ( $user_id == get_current_user_id() && ! give_get_option( 'allow_user_api_keys' ) && ! current_user_can( 'manage_give_settings' ) ) {
1876
-			wp_die( sprintf( /* translators: %s: process */
1877
-				__( 'You do not have permission to %s API keys for this user.', 'give' ), $process ), __( 'Error', 'give' ), array(
1875
+		if ($user_id == get_current_user_id() && ! give_get_option('allow_user_api_keys') && ! current_user_can('manage_give_settings')) {
1876
+			wp_die(sprintf( /* translators: %s: process */
1877
+				__('You do not have permission to %s API keys for this user.', 'give'), $process ), __('Error', 'give'), array(
1878 1878
 				'response' => 403,
1879
-			) );
1880
-		} elseif ( ! current_user_can( 'manage_give_settings' ) ) {
1881
-			wp_die( sprintf( /* translators: %s: process */
1882
-				__( 'You do not have permission to %s API keys for this user.', 'give' ), $process ), __( 'Error', 'give' ), array(
1879
+			));
1880
+		} elseif ( ! current_user_can('manage_give_settings')) {
1881
+			wp_die(sprintf( /* translators: %s: process */
1882
+				__('You do not have permission to %s API keys for this user.', 'give'), $process ), __('Error', 'give'), array(
1883 1883
 				'response' => 403,
1884
-			) );
1884
+			));
1885 1885
 		}
1886 1886
 
1887
-		switch ( $process ) {
1887
+		switch ($process) {
1888 1888
 			case 'generate':
1889
-				if ( $this->generate_api_key( $user_id ) ) {
1890
-					Give_Cache::delete( Give_Cache::get_key( 'give_total_api_keys' ) );
1891
-					wp_redirect( add_query_arg( 'give-messages[]', 'api-key-generated', 'edit.php?post_type=give_forms&page=give-tools&tab=api' ) );
1889
+				if ($this->generate_api_key($user_id)) {
1890
+					Give_Cache::delete(Give_Cache::get_key('give_total_api_keys'));
1891
+					wp_redirect(add_query_arg('give-messages[]', 'api-key-generated', 'edit.php?post_type=give_forms&page=give-tools&tab=api'));
1892 1892
 					exit();
1893 1893
 				} else {
1894
-					wp_redirect( add_query_arg( 'give-messages[]', 'api-key-failed', 'edit.php?post_type=give_forms&page=give-tools&tab=api' ) );
1894
+					wp_redirect(add_query_arg('give-messages[]', 'api-key-failed', 'edit.php?post_type=give_forms&page=give-tools&tab=api'));
1895 1895
 					exit();
1896 1896
 				}
1897 1897
 				break;
1898 1898
 			case 'regenerate':
1899
-				$this->generate_api_key( $user_id, true );
1900
-				Give_Cache::delete( Give_Cache::get_key( 'give_total_api_keys' ) );
1901
-				wp_redirect( add_query_arg( 'give-messages[]', 'api-key-regenerated', 'edit.php?post_type=give_forms&page=give-tools&tab=api' ) );
1899
+				$this->generate_api_key($user_id, true);
1900
+				Give_Cache::delete(Give_Cache::get_key('give_total_api_keys'));
1901
+				wp_redirect(add_query_arg('give-messages[]', 'api-key-regenerated', 'edit.php?post_type=give_forms&page=give-tools&tab=api'));
1902 1902
 				exit();
1903 1903
 				break;
1904 1904
 			case 'revoke':
1905
-				$this->revoke_api_key( $user_id );
1906
-				Give_Cache::delete( Give_Cache::get_key( 'give_total_api_keys' ) );
1907
-				wp_redirect( add_query_arg( 'give-messages[]', 'api-key-revoked', 'edit.php?post_type=give_forms&page=give-tools&tab=api' ) );
1905
+				$this->revoke_api_key($user_id);
1906
+				Give_Cache::delete(Give_Cache::get_key('give_total_api_keys'));
1907
+				wp_redirect(add_query_arg('give-messages[]', 'api-key-revoked', 'edit.php?post_type=give_forms&page=give-tools&tab=api'));
1908 1908
 				exit();
1909 1909
 				break;
1910 1910
 			default;
@@ -1923,59 +1923,59 @@  discard block
 block discarded – undo
1923 1923
 	 *
1924 1924
 	 * @return boolean True if (re)generated successfully, false otherwise.
1925 1925
 	 */
1926
-	public function generate_api_key( $user_id = 0, $regenerate = false ) {
1926
+	public function generate_api_key($user_id = 0, $regenerate = false) {
1927 1927
 
1928 1928
 		// Bail out, if user doesn't exists.
1929
-		if ( empty( $user_id ) ) {
1929
+		if (empty($user_id)) {
1930 1930
 			return false;
1931 1931
 		}
1932 1932
 
1933
-		$user = get_userdata( $user_id );
1933
+		$user = get_userdata($user_id);
1934 1934
 
1935 1935
 		// Bail Out, if user object doesn't exists.
1936
-		if ( ! $user ) {
1936
+		if ( ! $user) {
1937 1937
 			return false;
1938 1938
 		}
1939 1939
 
1940 1940
 		$new_public_key = '';
1941 1941
 		$new_secret_key = '';
1942 1942
 
1943
-		if( ! empty( $_POST['from'] ) && 'profile' === $_POST['from'] ) {
1943
+		if ( ! empty($_POST['from']) && 'profile' === $_POST['from']) {
1944 1944
 			// For User Profile Page.
1945
-			if( ! empty( $_POST['give_set_api_key'] ) ) {
1945
+			if ( ! empty($_POST['give_set_api_key'])) {
1946 1946
 				// Generate API Key from User Profile page.
1947
-				$new_public_key = $this->generate_public_key( $user->user_email );
1948
-				$new_secret_key = $this->generate_private_key( $user->ID );
1949
-			} elseif ( ! empty( $_POST['give_revoke_api_key'] ) ) {
1947
+				$new_public_key = $this->generate_public_key($user->user_email);
1948
+				$new_secret_key = $this->generate_private_key($user->ID);
1949
+			} elseif ( ! empty($_POST['give_revoke_api_key'])) {
1950 1950
 				// Revoke API Key from User Profile page.
1951
-				$this->revoke_api_key( $user->ID );
1951
+				$this->revoke_api_key($user->ID);
1952 1952
 			} else {
1953 1953
 				return false;
1954 1954
 			}
1955 1955
 		} else {
1956 1956
 			// For Tools > API page.
1957
-			$public_key = $this->get_user_public_key( $user_id );
1957
+			$public_key = $this->get_user_public_key($user_id);
1958 1958
 
1959
-			if ( empty( $public_key ) && ! $regenerate ) {
1959
+			if (empty($public_key) && ! $regenerate) {
1960 1960
 				// Generating API for first time.
1961
-				$new_public_key = $this->generate_public_key( $user->user_email );
1962
-				$new_secret_key = $this->generate_private_key( $user->ID );
1963
-			} elseif ( $public_key && $regenerate ) {
1961
+				$new_public_key = $this->generate_public_key($user->user_email);
1962
+				$new_secret_key = $this->generate_private_key($user->ID);
1963
+			} elseif ($public_key && $regenerate) {
1964 1964
 				// API Key already exists and Regenerating API Key.
1965
-				$this->revoke_api_key( $user->ID );
1966
-				$new_public_key = $this->generate_public_key( $user->user_email );
1967
-				$new_secret_key = $this->generate_private_key( $user->ID );
1968
-			} elseif ( ! empty( $public_key ) && ! $regenerate ) {
1965
+				$this->revoke_api_key($user->ID);
1966
+				$new_public_key = $this->generate_public_key($user->user_email);
1967
+				$new_secret_key = $this->generate_private_key($user->ID);
1968
+			} elseif ( ! empty($public_key) && ! $regenerate) {
1969 1969
 				// Doing nothing, when API Key exists but still try to generate again instead of regenerating.
1970 1970
 				return false;
1971 1971
 			} else {
1972 1972
 				// Revoke API Key.
1973
-				$this->revoke_api_key( $user->ID );
1973
+				$this->revoke_api_key($user->ID);
1974 1974
 			}
1975 1975
 		}
1976 1976
 
1977
-		update_user_meta( $user_id, $new_public_key, 'give_user_public_key' );
1978
-		update_user_meta( $user_id, $new_secret_key, 'give_user_secret_key' );
1977
+		update_user_meta($user_id, $new_public_key, 'give_user_public_key');
1978
+		update_user_meta($user_id, $new_secret_key, 'give_user_secret_key');
1979 1979
 
1980 1980
 		return true;
1981 1981
 	}
@@ -1990,26 +1990,26 @@  discard block
 block discarded – undo
1990 1990
 	 *
1991 1991
 	 * @return bool
1992 1992
 	 */
1993
-	public function revoke_api_key( $user_id = 0 ) {
1993
+	public function revoke_api_key($user_id = 0) {
1994 1994
 
1995
-		if ( empty( $user_id ) ) {
1995
+		if (empty($user_id)) {
1996 1996
 			return false;
1997 1997
 		}
1998 1998
 
1999
-		$user = get_userdata( $user_id );
1999
+		$user = get_userdata($user_id);
2000 2000
 
2001
-		if ( ! $user ) {
2001
+		if ( ! $user) {
2002 2002
 			return false;
2003 2003
 		}
2004 2004
 
2005
-		$public_key = $this->get_user_public_key( $user_id );
2006
-		$secret_key = $this->get_user_secret_key( $user_id );
2007
-		if ( ! empty( $public_key ) ) {
2008
-			Give_Cache::delete( Give_Cache::get_key( md5( 'give_api_user_' . $public_key ) ) );
2009
-			Give_Cache::delete( Give_Cache::get_key( md5( 'give_api_user_public_key' . $user_id ) ) );
2010
-			Give_Cache::delete( Give_Cache::get_key( md5( 'give_api_user_secret_key' . $user_id ) ) );
2011
-			delete_user_meta( $user_id, $public_key );
2012
-			delete_user_meta( $user_id, $secret_key );
2005
+		$public_key = $this->get_user_public_key($user_id);
2006
+		$secret_key = $this->get_user_secret_key($user_id);
2007
+		if ( ! empty($public_key)) {
2008
+			Give_Cache::delete(Give_Cache::get_key(md5('give_api_user_'.$public_key)));
2009
+			Give_Cache::delete(Give_Cache::get_key(md5('give_api_user_public_key'.$user_id)));
2010
+			Give_Cache::delete(Give_Cache::get_key(md5('give_api_user_secret_key'.$user_id)));
2011
+			delete_user_meta($user_id, $public_key);
2012
+			delete_user_meta($user_id, $secret_key);
2013 2013
 		} else {
2014 2014
 			return false;
2015 2015
 		}
@@ -2031,9 +2031,9 @@  discard block
 block discarded – undo
2031 2031
 	 *
2032 2032
 	 * @return string
2033 2033
 	 */
2034
-	private function generate_public_key( $user_email = '' ) {
2035
-		$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
2036
-		$public   = hash( 'md5', $user_email . $auth_key . date( 'U' ) );
2034
+	private function generate_public_key($user_email = '') {
2035
+		$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
2036
+		$public   = hash('md5', $user_email.$auth_key.date('U'));
2037 2037
 
2038 2038
 		return $public;
2039 2039
 	}
@@ -2048,9 +2048,9 @@  discard block
 block discarded – undo
2048 2048
 	 *
2049 2049
 	 * @return string
2050 2050
 	 */
2051
-	private function generate_private_key( $user_id = 0 ) {
2052
-		$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
2053
-		$secret   = hash( 'md5', $user_id . $auth_key . date( 'U' ) );
2051
+	private function generate_private_key($user_id = 0) {
2052
+		$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
2053
+		$secret   = hash('md5', $user_id.$auth_key.date('U'));
2054 2054
 
2055 2055
 		return $secret;
2056 2056
 	}
@@ -2065,8 +2065,8 @@  discard block
 block discarded – undo
2065 2065
 	 *
2066 2066
 	 * @return string
2067 2067
 	 */
2068
-	public function get_token( $user_id = 0 ) {
2069
-		return hash( 'md5', $this->get_user_secret_key( $user_id ) . $this->get_user_public_key( $user_id ) );
2068
+	public function get_token($user_id = 0) {
2069
+		return hash('md5', $this->get_user_secret_key($user_id).$this->get_user_public_key($user_id));
2070 2070
 	}
2071 2071
 
2072 2072
 	/**
@@ -2080,9 +2080,9 @@  discard block
 block discarded – undo
2080 2080
 
2081 2081
 		// Default sales return
2082 2082
 		$donations                               = array();
2083
-		$donations['donations']['today']         = $this->stats->get_sales( 0, 'today' );
2084
-		$donations['donations']['current_month'] = $this->stats->get_sales( 0, 'this_month' );
2085
-		$donations['donations']['last_month']    = $this->stats->get_sales( 0, 'last_month' );
2083
+		$donations['donations']['today']         = $this->stats->get_sales(0, 'today');
2084
+		$donations['donations']['current_month'] = $this->stats->get_sales(0, 'this_month');
2085
+		$donations['donations']['last_month']    = $this->stats->get_sales(0, 'last_month');
2086 2086
 		$donations['donations']['totals']        = give_get_total_donations();
2087 2087
 
2088 2088
 		return $donations;
@@ -2099,9 +2099,9 @@  discard block
 block discarded – undo
2099 2099
 
2100 2100
 		// Default earnings return
2101 2101
 		$earnings                              = array();
2102
-		$earnings['earnings']['today']         = $this->stats->get_earnings( 0, 'today' );
2103
-		$earnings['earnings']['current_month'] = $this->stats->get_earnings( 0, 'this_month' );
2104
-		$earnings['earnings']['last_month']    = $this->stats->get_earnings( 0, 'last_month' );
2102
+		$earnings['earnings']['today']         = $this->stats->get_earnings(0, 'today');
2103
+		$earnings['earnings']['current_month'] = $this->stats->get_earnings(0, 'this_month');
2104
+		$earnings['earnings']['last_month']    = $this->stats->get_earnings(0, 'last_month');
2105 2105
 		$earnings['earnings']['totals']        = give_get_total_earnings();
2106 2106
 
2107 2107
 		return $earnings;
@@ -2121,25 +2121,25 @@  discard block
 block discarded – undo
2121 2121
 	 *
2122 2122
 	 * @return string            The API key/secret for the user supplied
2123 2123
 	 */
2124
-	public function api_key_backwards_compat( $check, $object_id, $meta_key, $single ) {
2124
+	public function api_key_backwards_compat($check, $object_id, $meta_key, $single) {
2125 2125
 
2126
-		if ( $meta_key !== 'give_user_public_key' && $meta_key !== 'give_user_secret_key' ) {
2126
+		if ($meta_key !== 'give_user_public_key' && $meta_key !== 'give_user_secret_key') {
2127 2127
 			return $check;
2128 2128
 		}
2129 2129
 
2130 2130
 		$return = $check;
2131 2131
 
2132
-		switch ( $meta_key ) {
2132
+		switch ($meta_key) {
2133 2133
 			case 'give_user_public_key':
2134
-				$return = Give()->api->get_user_public_key( $object_id );
2134
+				$return = Give()->api->get_user_public_key($object_id);
2135 2135
 				break;
2136 2136
 			case 'give_user_secret_key':
2137
-				$return = Give()->api->get_user_secret_key( $object_id );
2137
+				$return = Give()->api->get_user_secret_key($object_id);
2138 2138
 				break;
2139 2139
 		}
2140 2140
 
2141
-		if ( ! $single ) {
2142
-			$return = array( $return );
2141
+		if ( ! $single) {
2142
+			$return = array($return);
2143 2143
 		}
2144 2144
 
2145 2145
 		return $return;
Please login to merge, or discard this patch.