Test Failed
Push — master ( 7fe983...516c23 )
by Devin
08:07 queued 03:09
created
includes/shortcodes.php 1 patch
Spacing   +100 added lines, -100 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,15 +26,15 @@  discard block
 block discarded – undo
26 26
 function give_donation_history() {
27 27
 
28 28
 	// If payment_key query arg exists, return receipt instead of donation history.
29
-	if ( isset( $_GET['payment_key'] ) ) {
29
+	if (isset($_GET['payment_key'])) {
30 30
 		ob_start();
31
-		echo give_receipt_shortcode( array() );
32
-		echo '<a href="' . esc_url( give_get_history_page_uri() ) . '">&laquo; ' . __( 'Return to All Donations', 'give' ) . '</a>';
31
+		echo give_receipt_shortcode(array());
32
+		echo '<a href="'.esc_url(give_get_history_page_uri()).'">&laquo; '.__('Return to All Donations', 'give').'</a>';
33 33
 
34 34
 		return ob_get_clean();
35 35
 	}
36 36
 
37
-	$email_access = give_get_option( 'email_access' );
37
+	$email_access = give_get_option('email_access');
38 38
 
39 39
 	/**
40 40
 	 * Determine access
@@ -44,30 +44,30 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	if (
46 46
 		is_user_logged_in() || false !== Give()->session->get_session_expiration()
47
-		|| ( give_is_setting_enabled( $email_access ) && Give()->email_access->token_exists )
47
+		|| (give_is_setting_enabled($email_access) && Give()->email_access->token_exists)
48 48
 	) {
49 49
 		ob_start();
50
-		give_get_template_part( 'history', 'donations' );
50
+		give_get_template_part('history', 'donations');
51 51
 
52 52
 		return ob_get_clean();
53 53
 
54
-	} elseif ( give_is_setting_enabled( $email_access ) ) {
54
+	} elseif (give_is_setting_enabled($email_access)) {
55 55
 		// Is Email-based access enabled?
56 56
 		ob_start();
57
-		give_get_template_part( 'email', 'login-form' );
57
+		give_get_template_part('email', 'login-form');
58 58
 
59 59
 		return ob_get_clean();
60 60
 
61 61
 	} else {
62 62
 
63
-		$output = 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 ) );
64
-		$output .= do_shortcode( '[give_login]' );
63
+		$output = 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));
64
+		$output .= do_shortcode('[give_login]');
65 65
 
66 66
 		return $output;
67 67
 	}
68 68
 }
69 69
 
70
-add_shortcode( 'donation_history', 'give_donation_history' );
70
+add_shortcode('donation_history', 'give_donation_history');
71 71
 
72 72
 /**
73 73
  * Donation Form Shortcode
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
  *
81 81
  * @return string
82 82
  */
83
-function give_form_shortcode( $atts ) {
84
-	$atts = shortcode_atts( array(
83
+function give_form_shortcode($atts) {
84
+	$atts = shortcode_atts(array(
85 85
 		'id'                    => '',
86 86
 		'show_title'            => true,
87 87
 		'show_goal'             => true,
@@ -89,21 +89,21 @@  discard block
 block discarded – undo
89 89
 		'float_labels'          => '',
90 90
 		'display_style'         => '',
91 91
 		'continue_button_title' => '',
92
-	), $atts, 'give_form' );
92
+	), $atts, 'give_form');
93 93
 
94 94
 	// Convert string to bool.
95
-	$atts['show_title'] = filter_var( $atts['show_title'], FILTER_VALIDATE_BOOLEAN );
96
-	$atts['show_goal']  = filter_var( $atts['show_goal'], FILTER_VALIDATE_BOOLEAN );
95
+	$atts['show_title'] = filter_var($atts['show_title'], FILTER_VALIDATE_BOOLEAN);
96
+	$atts['show_goal']  = filter_var($atts['show_goal'], FILTER_VALIDATE_BOOLEAN);
97 97
 
98 98
 	//get the Give Form
99 99
 	ob_start();
100
-	give_get_donation_form( $atts );
100
+	give_get_donation_form($atts);
101 101
 	$final_output = ob_get_clean();
102 102
 
103
-	return apply_filters( 'give_donate_form', $final_output, $atts );
103
+	return apply_filters('give_donate_form', $final_output, $atts);
104 104
 }
105 105
 
106
-add_shortcode( 'give_form', 'give_form_shortcode' );
106
+add_shortcode('give_form', 'give_form_shortcode');
107 107
 
108 108
 /**
109 109
  * Donation Form Goal Shortcode.
@@ -116,37 +116,37 @@  discard block
 block discarded – undo
116 116
  *
117 117
  * @return string
118 118
  */
119
-function give_goal_shortcode( $atts ) {
120
-	$atts = shortcode_atts( array(
119
+function give_goal_shortcode($atts) {
120
+	$atts = shortcode_atts(array(
121 121
 		'id'        => '',
122 122
 		'show_text' => true,
123 123
 		'show_bar'  => true,
124
-	), $atts, 'give_goal' );
124
+	), $atts, 'give_goal');
125 125
 
126 126
 
127 127
 	//get the Give Form.
128 128
 	ob_start();
129 129
 
130 130
 	//Sanity check 1: ensure there is an ID Provided.
131
-	if ( empty( $atts['id'] ) ) {
132
-		Give()->notices->print_frontend_notice( __( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true );
131
+	if (empty($atts['id'])) {
132
+		Give()->notices->print_frontend_notice(__('The shortcode is missing Donation Form ID attribute.', 'give'), true);
133 133
 	}
134 134
 
135 135
 	//Sanity check 2: Check the form even has Goals enabled.
136
-	if ( ! give_is_setting_enabled( give_get_meta( $atts['id'], '_give_goal_option', true ) ) ) {
136
+	if ( ! give_is_setting_enabled(give_get_meta($atts['id'], '_give_goal_option', true))) {
137 137
 
138
-		Give()->notices->print_frontend_notice( __( 'The form does not have Goals enabled.', 'give' ), true );
138
+		Give()->notices->print_frontend_notice(__('The form does not have Goals enabled.', 'give'), true);
139 139
 	} else {
140 140
 		//Passed all sanity checks: output Goal.
141
-		give_show_goal_progress( $atts['id'], $atts );
141
+		give_show_goal_progress($atts['id'], $atts);
142 142
 	}
143 143
 
144 144
 	$final_output = ob_get_clean();
145 145
 
146
-	return apply_filters( 'give_goal_shortcode_output', $final_output, $atts );
146
+	return apply_filters('give_goal_shortcode_output', $final_output, $atts);
147 147
 }
148 148
 
149
-add_shortcode( 'give_goal', 'give_goal_shortcode' );
149
+add_shortcode('give_goal', 'give_goal_shortcode');
150 150
 
151 151
 
152 152
 /**
@@ -163,22 +163,22 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return string
165 165
  */
166
-function give_login_form_shortcode( $atts ) {
167
-	$atts = shortcode_atts( array(
166
+function give_login_form_shortcode($atts) {
167
+	$atts = shortcode_atts(array(
168 168
 		// Add backward compatibility for redirect attribute.
169 169
 		'redirect' => '',
170 170
 
171 171
 		'login-redirect'  => '',
172 172
 		'logout-redirect' => '',
173
-	), $atts, 'give_login' );
173
+	), $atts, 'give_login');
174 174
 
175 175
 	// 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.
176
-	$atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' );
176
+	$atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : '');
177 177
 
178
-	return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] );
178
+	return give_login_form($atts['login-redirect'], $atts['logout-redirect']);
179 179
 }
180 180
 
181
-add_shortcode( 'give_login', 'give_login_form_shortcode' );
181
+add_shortcode('give_login', 'give_login_form_shortcode');
182 182
 
183 183
 /**
184 184
  * Register Shortcode.
@@ -193,15 +193,15 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @return string
195 195
  */
196
-function give_register_form_shortcode( $atts ) {
197
-	$atts = shortcode_atts( array(
196
+function give_register_form_shortcode($atts) {
197
+	$atts = shortcode_atts(array(
198 198
 		'redirect' => '',
199
-	), $atts, 'give_register' );
199
+	), $atts, 'give_register');
200 200
 
201
-	return give_register_form( $atts['redirect'] );
201
+	return give_register_form($atts['redirect']);
202 202
 }
203 203
 
204
-add_shortcode( 'give_register', 'give_register_form_shortcode' );
204
+add_shortcode('give_register', 'give_register_form_shortcode');
205 205
 
206 206
 /**
207 207
  * Receipt Shortcode.
@@ -214,12 +214,12 @@  discard block
 block discarded – undo
214 214
  *
215 215
  * @return string
216 216
  */
217
-function give_receipt_shortcode( $atts ) {
217
+function give_receipt_shortcode($atts) {
218 218
 
219 219
 	global $give_receipt_args, $payment;
220 220
 
221
-	$give_receipt_args = shortcode_atts( array(
222
-		'error'          => __( 'You are missing the payment key to view this donation receipt.', 'give' ),
221
+	$give_receipt_args = shortcode_atts(array(
222
+		'error'          => __('You are missing the payment key to view this donation receipt.', 'give'),
223 223
 		'price'          => true,
224 224
 		'donor'          => true,
225 225
 		'date'           => true,
@@ -228,50 +228,50 @@  discard block
 block discarded – undo
228 228
 		'payment_id'     => true,
229 229
 		'payment_status' => false,
230 230
 		'status_notice'  => true,
231
-	), $atts, 'give_receipt' );
231
+	), $atts, 'give_receipt');
232 232
 
233 233
 	//set $session var
234 234
 	$session = give_get_purchase_session();
235 235
 
236 236
 	//set payment key var
237
-	if ( isset( $_GET['payment_key'] ) ) {
238
-		$payment_key = urldecode( $_GET['payment_key'] );
239
-	} elseif ( $session ) {
237
+	if (isset($_GET['payment_key'])) {
238
+		$payment_key = urldecode($_GET['payment_key']);
239
+	} elseif ($session) {
240 240
 		$payment_key = $session['purchase_key'];
241
-	} elseif ( $give_receipt_args['payment_key'] ) {
241
+	} elseif ($give_receipt_args['payment_key']) {
242 242
 		$payment_key = $give_receipt_args['payment_key'];
243 243
 	}
244 244
 
245
-	$email_access = give_get_option( 'email_access' );
245
+	$email_access = give_get_option('email_access');
246 246
 
247 247
 	// No payment_key found & Email Access is Turned on:
248
-	if ( ! isset( $payment_key ) && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
248
+	if ( ! isset($payment_key) && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
249 249
 
250 250
 		ob_start();
251 251
 
252
-		give_get_template_part( 'email-login-form' );
252
+		give_get_template_part('email-login-form');
253 253
 
254 254
 		return ob_get_clean();
255 255
 
256
-	} elseif ( ! isset( $payment_key ) ) {
256
+	} elseif ( ! isset($payment_key)) {
257 257
 
258
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
258
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
259 259
 
260 260
 	}
261 261
 
262
-	$payment_id    = give_get_purchase_id_by_key( $payment_key );
263
-	$user_can_view = give_can_view_receipt( $payment_key );
262
+	$payment_id    = give_get_purchase_id_by_key($payment_key);
263
+	$user_can_view = give_can_view_receipt($payment_key);
264 264
 
265 265
 	// Key was provided, but user is logged out. Offer them the ability to login and view the receipt.
266
-	if ( ! $user_can_view && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
266
+	if ( ! $user_can_view && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
267 267
 
268 268
 		ob_start();
269 269
 
270
-		give_get_template_part( 'email-login-form' );
270
+		give_get_template_part('email-login-form');
271 271
 
272 272
 		return ob_get_clean();
273 273
 
274
-	} elseif ( ! $user_can_view ) {
274
+	} elseif ( ! $user_can_view) {
275 275
 
276 276
 		global $give_login_redirect;
277 277
 
@@ -279,9 +279,9 @@  discard block
 block discarded – undo
279 279
 
280 280
 		ob_start();
281 281
 
282
-		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' ) ) );
282
+		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')));
283 283
 
284
-		give_get_template_part( 'shortcode', 'login' );
284
+		give_get_template_part('shortcode', 'login');
285 285
 
286 286
 		$login_form = ob_get_clean();
287 287
 
@@ -296,20 +296,20 @@  discard block
 block discarded – undo
296 296
 	 * or if user is logged in and the user can view sensitive shop data.
297 297
 	 *
298 298
 	 */
299
-	if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) {
300
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
299
+	if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) {
300
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
301 301
 	}
302 302
 
303 303
 	ob_start();
304 304
 
305
-	give_get_template_part( 'shortcode', 'receipt' );
305
+	give_get_template_part('shortcode', 'receipt');
306 306
 
307 307
 	$display = ob_get_clean();
308 308
 
309 309
 	return $display;
310 310
 }
311 311
 
312
-add_shortcode( 'give_receipt', 'give_receipt_shortcode' );
312
+add_shortcode('give_receipt', 'give_receipt_shortcode');
313 313
 
314 314
 /**
315 315
  * Profile Editor Shortcode.
@@ -328,18 +328,18 @@  discard block
 block discarded – undo
328 328
  *
329 329
  * @return string Output generated from the profile editor
330 330
  */
331
-function give_profile_editor_shortcode( $atts ) {
331
+function give_profile_editor_shortcode($atts) {
332 332
 
333 333
 	ob_start();
334 334
 
335
-	give_get_template_part( 'shortcode', 'profile-editor' );
335
+	give_get_template_part('shortcode', 'profile-editor');
336 336
 
337 337
 	$display = ob_get_clean();
338 338
 
339 339
 	return $display;
340 340
 }
341 341
 
342
-add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' );
342
+add_shortcode('give_profile_editor', 'give_profile_editor_shortcode');
343 343
 
344 344
 /**
345 345
  * Process Profile Updater Form.
@@ -352,30 +352,30 @@  discard block
 block discarded – undo
352 352
  *
353 353
  * @return bool
354 354
  */
355
-function give_process_profile_editor_updates( $data ) {
355
+function give_process_profile_editor_updates($data) {
356 356
 	// Profile field change request
357
-	if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) {
357
+	if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) {
358 358
 		return false;
359 359
 	}
360 360
 
361 361
 	// Nonce security
362
-	if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) {
362
+	if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) {
363 363
 		return false;
364 364
 	}
365 365
 
366 366
 	$user_id       = get_current_user_id();
367
-	$old_user_data = get_userdata( $user_id );
368
-
369
-	$display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name;
370
-	$first_name   = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name;
371
-	$last_name    = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name;
372
-	$email        = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email;
373
-	$line1        = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' );
374
-	$line2        = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' );
375
-	$city         = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' );
376
-	$state        = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' );
377
-	$zip          = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' );
378
-	$country      = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' );
367
+	$old_user_data = get_userdata($user_id);
368
+
369
+	$display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name;
370
+	$first_name   = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name;
371
+	$last_name    = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name;
372
+	$email        = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email;
373
+	$line1        = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : '');
374
+	$line2        = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : '');
375
+	$city         = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : '');
376
+	$state        = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : '');
377
+	$zip          = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : '');
378
+	$country      = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : '');
379 379
 
380 380
 	$userdata = array(
381 381
 		'ID'           => $user_id,
@@ -403,40 +403,40 @@  discard block
 block discarded – undo
403 403
 	 * @param int $user_id The ID of the user.
404 404
 	 * @param array $userdata User info, including ID, first name, last name, display name and email.
405 405
 	 */
406
-	do_action( 'give_pre_update_user_profile', $user_id, $userdata );
406
+	do_action('give_pre_update_user_profile', $user_id, $userdata);
407 407
 
408 408
 	// Make sure to validate passwords for existing Donors
409
-	give_validate_user_password( $data['give_new_user_pass1'], $data['give_new_user_pass2'] );
409
+	give_validate_user_password($data['give_new_user_pass1'], $data['give_new_user_pass2']);
410 410
 
411
-	if ( empty( $email ) ) {
411
+	if (empty($email)) {
412 412
 		// Make sure email should not be empty.
413
-		give_set_error( 'email_empty', __( 'The email you entered is empty.', 'give' ) );
413
+		give_set_error('email_empty', __('The email you entered is empty.', 'give'));
414 414
 
415
-	} else if ( ! is_email( $email ) ) {
415
+	} else if ( ! is_email($email)) {
416 416
 		// Make sure email should be valid.
417
-		give_set_error( 'email_not_valid', __( 'The email you entered is not valid. Please use another', 'give' ) );
417
+		give_set_error('email_not_valid', __('The email you entered is not valid. Please use another', 'give'));
418 418
 
419
-	} else if ( $email != $old_user_data->user_email ) {
419
+	} else if ($email != $old_user_data->user_email) {
420 420
 		// Make sure the new email doesn't belong to another user
421
-		if ( email_exists( $email ) ) {
422
-			give_set_error( 'email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) );
421
+		if (email_exists($email)) {
422
+			give_set_error('email_exists', __('The email you entered belongs to another user. Please use another.', 'give'));
423 423
 		}
424 424
 	}
425 425
 
426 426
 	// Check for errors
427 427
 	$errors = give_get_errors();
428 428
 
429
-	if ( $errors ) {
429
+	if ($errors) {
430 430
 		// Send back to the profile editor if there are errors
431
-		wp_redirect( $data['give_redirect'] );
431
+		wp_redirect($data['give_redirect']);
432 432
 		give_die();
433 433
 	}
434 434
 
435 435
 	// Update the user
436
-	$meta    = update_user_meta( $user_id, '_give_user_address', $address );
437
-	$updated = wp_update_user( $userdata );
436
+	$meta    = update_user_meta($user_id, '_give_user_address', $address);
437
+	$updated = wp_update_user($userdata);
438 438
 
439
-	if ( $updated ) {
439
+	if ($updated) {
440 440
 
441 441
 		/**
442 442
 		 * Fires after updating user profile.
@@ -446,12 +446,12 @@  discard block
 block discarded – undo
446 446
 		 * @param int $user_id The ID of the user.
447 447
 		 * @param array $userdata User info, including ID, first name, last name, display name and email.
448 448
 		 */
449
-		do_action( 'give_user_profile_updated', $user_id, $userdata );
450
-		wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) );
449
+		do_action('give_user_profile_updated', $user_id, $userdata);
450
+		wp_redirect(add_query_arg('updated', 'true', $data['give_redirect']));
451 451
 		give_die();
452 452
 	}
453 453
 
454 454
 	return false;
455 455
 }
456 456
 
457
-add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' );
457
+add_action('give_edit_user_profile', 'give_process_profile_editor_updates');
Please login to merge, or discard this patch.
includes/admin/tools/export/export-actions.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @license     https://opensource.org/licenses/gpl-license GNU Public License
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_process_batch_export_form() {
24 24
 
25
-	if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) {
26
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array(
25
+	if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) {
26
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array(
27 27
 			'response' => 403,
28
-		) );
28
+		));
29 29
 	}
30 30
 
31
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php';
31
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php';
32 32
 
33 33
 	/**
34 34
 	 * Fires before batch export.
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param string $class Export class.
39 39
 	 */
40
-	do_action( 'give_batch_export_class_include', $_REQUEST['class'] );
40
+	do_action('give_batch_export_class_include', $_REQUEST['class']);
41 41
 
42 42
 	$export = new $_REQUEST['class'];
43 43
 	$export->export();
44 44
 
45 45
 }
46 46
 
47
-add_action( 'give_form_batch_export', 'give_process_batch_export_form' );
47
+add_action('give_form_batch_export', 'give_process_batch_export_form');
48 48
 
49 49
 /**
50 50
  * Exports earnings for a specified time period.
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
  * @return void
56 56
  */
57 57
 function give_export_earnings() {
58
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export-earnings.php';
58
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export-earnings.php';
59 59
 
60 60
 	$earnings_export = new Give_Earnings_Export();
61 61
 
62 62
 	$earnings_export->export();
63 63
 }
64 64
 
65
-add_action( 'give_earnings_export', 'give_export_earnings' );
65
+add_action('give_earnings_export', 'give_export_earnings');
66 66
 
67 67
 
68 68
 /**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
  * @return void
73 73
  */
74 74
 function give_register_batch_exporters() {
75
-	if ( is_admin() ) {
75
+	if (is_admin()) {
76 76
 		/**
77 77
 		 * Fires in the admin, while plugins loaded.
78 78
 		 *
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 		 *
83 83
 		 * @param string $class Export class.
84 84
 		 */
85
-		do_action( 'give_register_batch_exporter' );
85
+		do_action('give_register_batch_exporter');
86 86
 	}
87 87
 }
88 88
 
89
-add_action( 'plugins_loaded', 'give_register_batch_exporters' );
89
+add_action('plugins_loaded', 'give_register_batch_exporters');
90 90
 
91 91
 /**
92 92
  * Register the payments batch exporter
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
  * @since  1.5
95 95
  */
96 96
 function give_register_payments_batch_export() {
97
-	add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 );
97
+	add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1);
98 98
 }
99 99
 
100
-add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 );
100
+add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10);
101 101
 
102 102
 /**
103 103
  * Loads the payments batch process if needed
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
  *
109 109
  * @return void
110 110
  */
111
-function give_include_payments_batch_processor( $class ) {
111
+function give_include_payments_batch_processor($class) {
112 112
 
113
-	if ( 'Give_Batch_Payments_Export' === $class ) {
114
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-payments.php';
113
+	if ('Give_Batch_Payments_Export' === $class) {
114
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-payments.php';
115 115
 	}
116 116
 
117 117
 }
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
  * @since  1.5.2
123 123
  */
124 124
 function give_register_donors_batch_export() {
125
-	add_action( 'give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1 );
125
+	add_action('give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1);
126 126
 }
127 127
 
128
-add_action( 'give_register_batch_exporter', 'give_register_donors_batch_export', 10 );
128
+add_action('give_register_batch_exporter', 'give_register_donors_batch_export', 10);
129 129
 
130 130
 /**
131 131
  * Loads the donors batch process if needed.
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
  *
137 137
  * @return void
138 138
  */
139
-function give_include_donors_batch_processor( $class ) {
139
+function give_include_donors_batch_processor($class) {
140 140
 
141
-	if ( 'Give_Batch_Donors_Export' === $class ) {
142
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-donors.php';
141
+	if ('Give_Batch_Donors_Export' === $class) {
142
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-donors.php';
143 143
 	}
144 144
 
145 145
 }
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
  * @since  1.5
151 151
  */
152 152
 function give_register_forms_batch_export() {
153
-	add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 );
153
+	add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1);
154 154
 }
155 155
 
156
-add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 );
156
+add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10);
157 157
 
158 158
 /**
159 159
  * Loads the file downloads batch process if needed
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
  *
165 165
  * @return void
166 166
  */
167
-function give_include_forms_batch_processor( $class ) {
167
+function give_include_forms_batch_processor($class) {
168 168
 
169
-	if ( 'Give_Batch_Forms_Export' === $class ) {
170
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-forms.php';
169
+	if ('Give_Batch_Forms_Export' === $class) {
170
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-forms.php';
171 171
 	}
172 172
 
173 173
 }
Please login to merge, or discard this patch.
includes/admin/tools/export/export-functions.php 1 patch
Spacing   +27 added lines, -28 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_ajax_export() {
27 27
 
28
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php';
28
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php';
29 29
 
30
-	parse_str( $_POST['form'], $form );
30
+	parse_str($_POST['form'], $form);
31 31
 
32 32
 	$_REQUEST = $form = (array) $form;
33 33
 
34
-	if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) {
35
-		die( '-2' );
34
+	if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) {
35
+		die('-2');
36 36
 	}
37 37
 
38 38
 	/**
@@ -42,28 +42,28 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @param string $class Export class.
44 44
 	 */
45
-	do_action( 'give_batch_export_class_include', $form['give-export-class'] );
45
+	do_action('give_batch_export_class_include', $form['give-export-class']);
46 46
 
47
-	$step   = absint( $_POST['step'] );
48
-	$class  = sanitize_text_field( $form['give-export-class'] );
47
+	$step   = absint($_POST['step']);
48
+	$class  = sanitize_text_field($form['give-export-class']);
49 49
 
50 50
 	/* @var Give_Batch_Export $export */
51
-	$export = new $class( $step );
51
+	$export = new $class($step);
52 52
 
53
-	if ( ! $export->can_export() ) {
54
-		die( '-1' );
53
+	if ( ! $export->can_export()) {
54
+		die('-1');
55 55
 	}
56 56
 
57
-	if ( ! $export->is_writable ) {
57
+	if ( ! $export->is_writable) {
58 58
 		$json_args = array(
59 59
 			'error'   => true,
60
-			'message' => esc_html__( 'Export location or file not writable.', 'give' )
60
+			'message' => esc_html__('Export location or file not writable.', 'give')
61 61
 		);
62 62
 		echo json_encode($json_args);
63 63
 		exit;
64 64
 	}
65 65
 
66
-	$export->set_properties( give_clean( $_REQUEST ) );
66
+	$export->set_properties(give_clean($_REQUEST));
67 67
 
68 68
 	$export->pre_fetch();
69 69
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 	$percentage = $export->get_percentage_complete();
73 73
 
74
-	if ( $ret ) {
74
+	if ($ret) {
75 75
 
76 76
 		$step += 1;
77 77
 		$json_data = array(
@@ -79,18 +79,17 @@  discard block
 block discarded – undo
79 79
 			'percentage' => $percentage
80 80
 		);
81 81
 
82
-	} elseif ( true === $export->is_empty ) {
82
+	} elseif (true === $export->is_empty) {
83 83
 
84 84
 		$json_data = array(
85 85
 			'error'   => true,
86
-			'message' => esc_html__( 'No data found for export parameters.', 'give' )
86
+			'message' => esc_html__('No data found for export parameters.', 'give')
87 87
 		);
88 88
 
89
-	} elseif ( true === $export->done && true === $export->is_void ) {
89
+	} elseif (true === $export->done && true === $export->is_void) {
90 90
 
91
-		$message = ! empty( $export->message ) ?
92
-			$export->message :
93
-			esc_html__( 'Batch Processing Complete', 'give' );
91
+		$message = ! empty($export->message) ?
92
+			$export->message : esc_html__('Batch Processing Complete', 'give');
94 93
 
95 94
 		$json_data = array(
96 95
 			'success' => true,
@@ -99,23 +98,23 @@  discard block
 block discarded – undo
99 98
 
100 99
 	} else {
101 100
 		
102
-		$args = array_merge( $_REQUEST, array(
101
+		$args = array_merge($_REQUEST, array(
103 102
 			'step'        => $step,
104 103
 			'class'       => $class,
105
-			'nonce'       => wp_create_nonce( 'give-batch-export' ),
104
+			'nonce'       => wp_create_nonce('give-batch-export'),
106 105
 			'give_action' => 'form_batch_export',
107
-		) );
106
+		));
108 107
 
109 108
 		$json_data = array(
110 109
 			'step' => 'done',
111
-			'url' => add_query_arg( $args, admin_url() )
110
+			'url' => add_query_arg($args, admin_url())
112 111
 		);
113 112
 
114 113
 	}
115 114
 
116
-	$export->unset_properties( give_clean( $_REQUEST ), $export );
117
-	echo json_encode( $json_data );
115
+	$export->unset_properties(give_clean($_REQUEST), $export);
116
+	echo json_encode($json_data);
118 117
 	exit;
119 118
 }
120 119
 
121
-add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' );
120
+add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export');
Please login to merge, or discard this patch.
includes/admin/tools/export/class-batch-export-donors.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@
 block discarded – undo
245 245
 
246 246
 					// Continue if donor already included.
247 247
 					if ( empty( $payment->customer_id ) ||
248
-					     in_array( $payment->customer_id, $cached_donor_ids )
248
+						 in_array( $payment->customer_id, $cached_donor_ids )
249 249
 					) {
250 250
 						continue;
251 251
 					}
Please login to merge, or discard this patch.
Spacing   +102 added lines, -104 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
 
@@ -70,23 +70,23 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @param array $request The Form Data passed into the batch processing
72 72
 	 */
73
-	public function set_properties( $request ) {
73
+	public function set_properties($request) {
74 74
 
75 75
 		// Set data from form submission
76
-		if ( isset( $_POST['form'] ) ) {
77
-			parse_str( $_POST['form'], $this->data );
76
+		if (isset($_POST['form'])) {
77
+			parse_str($_POST['form'], $this->data);
78 78
 		}
79 79
 
80 80
 		$this->form = $this->data['forms'];
81 81
 
82 82
 		// Setup donor ids cache.
83
-		if ( ! empty( $this->form ) ) {
83
+		if ( ! empty($this->form)) {
84 84
 			// Cache donor ids to output unique list of donor.
85
-			$this->query_id = give_clean( $_REQUEST['give_export_option']['query_id'] );
85
+			$this->query_id = give_clean($_REQUEST['give_export_option']['query_id']);
86 86
 			$this->cache_donor_ids();
87 87
 		}
88 88
 
89
-		$this->price_id = ! empty( $request['give_price_option'] ) && 'all' !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null;
89
+		$this->price_id = ! empty($request['give_price_option']) && 'all' !== $request['give_price_option'] ? absint($request['give_price_option']) : null;
90 90
 
91 91
 	}
92 92
 
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 		// Fetch already cached donor ids.
102 102
 		$donor_ids = $this->donor_ids;
103 103
 
104
-		if ( $cached_donor_ids = Give_Cache::get( $this->query_id, true ) ) {
105
-			$donor_ids = array_unique( array_merge( $cached_donor_ids, $this->donor_ids ) );
104
+		if ($cached_donor_ids = Give_Cache::get($this->query_id, true)) {
105
+			$donor_ids = array_unique(array_merge($cached_donor_ids, $this->donor_ids));
106 106
 		}
107 107
 
108
-		$donor_ids = array_values( $donor_ids );
109
-		Give_Cache::set( $this->query_id, $donor_ids, HOUR_IN_SECONDS, true );
108
+		$donor_ids = array_values($donor_ids);
109
+		Give_Cache::set($this->query_id, $donor_ids, HOUR_IN_SECONDS, true);
110 110
 	}
111 111
 
112 112
 	/**
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	public function csv_cols() {
120 120
 
121
-		$columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array();
121
+		$columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array();
122 122
 
123 123
 		// We need columns.
124
-		if ( empty( $columns ) ) {
124
+		if (empty($columns)) {
125 125
 			return false;
126 126
 		}
127 127
 
128
-		$cols = $this->get_cols( $columns );
128
+		$cols = $this->get_cols($columns);
129 129
 
130 130
 		return $cols;
131 131
 	}
@@ -137,41 +137,41 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @return array
139 139
 	 */
140
-	private function get_cols( $columns ) {
140
+	private function get_cols($columns) {
141 141
 
142 142
 		$cols = array();
143 143
 
144
-		foreach ( $columns as $key => $value ) {
144
+		foreach ($columns as $key => $value) {
145 145
 
146
-			switch ( $key ) {
146
+			switch ($key) {
147 147
 				case 'full_name' :
148
-					$cols['full_name'] = esc_html__( 'Full Name', 'give' );
148
+					$cols['full_name'] = esc_html__('Full Name', 'give');
149 149
 					break;
150 150
 				case 'email' :
151
-					$cols['email'] = esc_html__( 'Email Address', 'give' );
151
+					$cols['email'] = esc_html__('Email Address', 'give');
152 152
 					break;
153 153
 				case 'address' :
154
-					$cols['address_line1']   = esc_html__( 'Address', 'give' );
155
-					$cols['address_line2']   = esc_html__( 'Address 2', 'give' );
156
-					$cols['address_city']    = esc_html__( 'City', 'give' );
157
-					$cols['address_state']   = esc_html__( 'State', 'give' );
158
-					$cols['address_zip']     = esc_html__( 'Zip', 'give' );
159
-					$cols['address_country'] = esc_html__( 'Country', 'give' );
154
+					$cols['address_line1']   = esc_html__('Address', 'give');
155
+					$cols['address_line2']   = esc_html__('Address 2', 'give');
156
+					$cols['address_city']    = esc_html__('City', 'give');
157
+					$cols['address_state']   = esc_html__('State', 'give');
158
+					$cols['address_zip']     = esc_html__('Zip', 'give');
159
+					$cols['address_country'] = esc_html__('Country', 'give');
160 160
 					break;
161 161
 				case 'userid' :
162
-					$cols['userid'] = esc_html__( 'User ID', 'give' );
162
+					$cols['userid'] = esc_html__('User ID', 'give');
163 163
 					break;
164 164
 				case 'donation_form' :
165
-					$cols['donation_form'] = esc_html__( 'Donation Form', 'give' );
165
+					$cols['donation_form'] = esc_html__('Donation Form', 'give');
166 166
 					break;
167 167
 				case 'date_first_donated' :
168
-					$cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' );
168
+					$cols['date_first_donated'] = esc_html__('First Donation Date', 'give');
169 169
 					break;
170 170
 				case 'donations' :
171
-					$cols['donations'] = esc_html__( 'Number of Donations', 'give' );
171
+					$cols['donations'] = esc_html__('Number of Donations', 'give');
172 172
 					break;
173 173
 				case 'donation_sum' :
174
-					$cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' );
174
+					$cols['donation_sum'] = esc_html__('Sum of Donations', 'give');
175 175
 					break;
176 176
 			}
177 177
 		}
@@ -192,29 +192,29 @@  discard block
 block discarded – undo
192 192
 		$i = 0;
193 193
 
194 194
 		$data             = array();
195
-		$cached_donor_ids = Give_Cache::get( $this->query_id, true );
195
+		$cached_donor_ids = Give_Cache::get($this->query_id, true);
196 196
 
197
-		if ( ! empty( $this->form ) ) {
197
+		if ( ! empty($this->form)) {
198 198
 
199 199
 			// Export donors for a specific donation form and also within specified timeframe
200 200
 			$args = array(
201 201
 				'output'     => 'payments', // Use 'posts' to get standard post objects
202
-				'post_type'  => array( 'give_payment' ),
202
+				'post_type'  => array('give_payment'),
203 203
 				'number'     => 30,
204 204
 				'paged'      => $this->step,
205 205
 				'status'     => 'publish',
206 206
 				'meta_key'   => '_give_payment_form_id',
207
-				'meta_value' => absint( $this->form ),
207
+				'meta_value' => absint($this->form),
208 208
 			);
209 209
 
210 210
 			// Check for date option filter
211
-			if ( ! empty( $this->data['donor_export_start_date'] ) || ! empty( $this->data['donor_export_end_date'] ) ) {
212
-				$args['start_date'] = ! empty( $this->data['donor_export_start_date'] ) ? date( 'Y-n-d 00:00:00', strtotime( $this->data['donor_export_start_date'] ) ) : date( 'Y-n-d 23:59:59', '1970-1-01 00:00:00' );
213
-				$args['end_date']   = ! empty( $this->data['donor_export_end_date'] ) ? date( 'Y-n-d 23:59:59', strtotime( $this->data['donor_export_end_date'] ) ) : date( 'Y-n-d 23:59:59', current_time( 'timestamp' ) );
211
+			if ( ! empty($this->data['donor_export_start_date']) || ! empty($this->data['donor_export_end_date'])) {
212
+				$args['start_date'] = ! empty($this->data['donor_export_start_date']) ? date('Y-n-d 00:00:00', strtotime($this->data['donor_export_start_date'])) : date('Y-n-d 23:59:59', '1970-1-01 00:00:00');
213
+				$args['end_date']   = ! empty($this->data['donor_export_end_date']) ? date('Y-n-d 23:59:59', strtotime($this->data['donor_export_end_date'])) : date('Y-n-d 23:59:59', current_time('timestamp'));
214 214
 			}
215 215
 
216 216
 			// Check for price option.
217
-			if ( null !== $this->price_id ) {
217
+			if (null !== $this->price_id) {
218 218
 				$args['meta_query'] = array(
219 219
 					array(
220 220
 						'key'   => '_give_payment_price_id',
@@ -223,45 +223,43 @@  discard block
 block discarded – undo
223 223
 				);
224 224
 			}
225 225
 
226
-			$payments_query = new Give_Payments_Query( $args );
226
+			$payments_query = new Give_Payments_Query($args);
227 227
 			$payments       = $payments_query->get_payments();
228 228
 
229
-			if ( $payments ) {
229
+			if ($payments) {
230 230
 				/* @var Give_Payment $payment */
231
-				foreach ( $payments as $payment ) {
231
+				foreach ($payments as $payment) {
232 232
 					// Set donation sum.
233
-					$this->payment_stats[ $payment->customer_id ]['donation_sum'] = isset( $this->payment_stats[ $payment->customer_id ]['donation_sum'] ) ?
234
-						$this->payment_stats[ $payment->customer_id ]['donation_sum'] :
235
-						0;
236
-					$this->payment_stats[ $payment->customer_id ]['donation_sum'] += $payment->total;
233
+					$this->payment_stats[$payment->customer_id]['donation_sum'] = isset($this->payment_stats[$payment->customer_id]['donation_sum']) ?
234
+						$this->payment_stats[$payment->customer_id]['donation_sum'] : 0;
235
+					$this->payment_stats[$payment->customer_id]['donation_sum'] += $payment->total;
237 236
 
238 237
 					// Set donation count.
239
-					$this->payment_stats[ $payment->customer_id ]['donations'] = isset( $this->payment_stats[ $payment->customer_id ]['donations'] ) ?
240
-						++ $this->payment_stats[ $payment->customer_id ]['donations'] :
241
-						1;
238
+					$this->payment_stats[$payment->customer_id]['donations'] = isset($this->payment_stats[$payment->customer_id]['donations']) ?
239
+						++$this->payment_stats[$payment->customer_id]['donations'] : 1;
242 240
 
243 241
 					// Set donation form name.
244
-					$this->payment_stats[ $payment->customer_id ]['form_title'] = $payment->form_title;
242
+					$this->payment_stats[$payment->customer_id]['form_title'] = $payment->form_title;
245 243
 
246 244
 					// Continue if donor already included.
247
-					if ( empty( $payment->customer_id ) ||
248
-					     in_array( $payment->customer_id, $cached_donor_ids )
245
+					if (empty($payment->customer_id) ||
246
+					     in_array($payment->customer_id, $cached_donor_ids)
249 247
 					) {
250 248
 						continue;
251 249
 					}
252 250
 
253 251
 					$this->donor_ids[] = $cached_donor_ids[] = $payment->customer_id;
254 252
 
255
-					$i ++;
253
+					$i++;
256 254
 				}
257 255
 
258
-				if ( ! empty( $this->donor_ids ) ) {
259
-					foreach ( $this->donor_ids as $donor_id ) {
260
-						$donor                      = Give()->donors->get_donor_by( 'id', $donor_id );
261
-						$donor->donation_form_title = $this->payment_stats[ $donor_id ]['form_title'];
262
-						$donor->purchase_count      = $this->payment_stats[ $donor_id ]['donations'];
263
-						$donor->purchase_value      = $this->payment_stats[ $donor_id ]['donation_sum'];
264
-						$data[]                     = $this->set_donor_data( $i, $data, $donor );
256
+				if ( ! empty($this->donor_ids)) {
257
+					foreach ($this->donor_ids as $donor_id) {
258
+						$donor                      = Give()->donors->get_donor_by('id', $donor_id);
259
+						$donor->donation_form_title = $this->payment_stats[$donor_id]['form_title'];
260
+						$donor->purchase_count      = $this->payment_stats[$donor_id]['donations'];
261
+						$donor->purchase_value      = $this->payment_stats[$donor_id]['donation_sum'];
262
+						$data[]                     = $this->set_donor_data($i, $data, $donor);
265 263
 					}
266 264
 
267 265
 					// Cache donor ids only if admin export donor for specific form.
@@ -271,7 +269,7 @@  discard block
 block discarded – undo
271 269
 		} else {
272 270
 
273 271
 			// Export all donors.
274
-			$offset = 30 * ( $this->step - 1 );
272
+			$offset = 30 * ($this->step - 1);
275 273
 
276 274
 			$args = array(
277 275
 				'number' => 30,
@@ -279,31 +277,31 @@  discard block
 block discarded – undo
279 277
 			);
280 278
 
281 279
 			// Check for date option filter
282
-			if ( ! empty( $this->data['donor_export_start_date'] ) || ! empty( $this->data['donor_export_end_date'] ) ) {
280
+			if ( ! empty($this->data['donor_export_start_date']) || ! empty($this->data['donor_export_end_date'])) {
283 281
 				$args['date'] = array(
284
-					'start' => ! empty( $this->data['donor_export_start_date'] ) ? date( 'Y-n-d 00:00:00', strtotime( $this->data['donor_export_start_date'] ) ) : date( 'Y-n-d 23:59:59', '1970-1-01 00:00:00' ),
285
-					'end'   => ! empty( $this->data['donor_export_end_date'] ) ? date( 'Y-n-d 23:59:59', strtotime( $this->data['donor_export_end_date'] ) ) : date( 'Y-n-d 23:59:59', current_time( 'timestamp' ) ),
282
+					'start' => ! empty($this->data['donor_export_start_date']) ? date('Y-n-d 00:00:00', strtotime($this->data['donor_export_start_date'])) : date('Y-n-d 23:59:59', '1970-1-01 00:00:00'),
283
+					'end'   => ! empty($this->data['donor_export_end_date']) ? date('Y-n-d 23:59:59', strtotime($this->data['donor_export_end_date'])) : date('Y-n-d 23:59:59', current_time('timestamp')),
286 284
 				);
287 285
 			}
288 286
 
289
-			$donors = Give()->donors->get_donors( $args );
287
+			$donors = Give()->donors->get_donors($args);
290 288
 
291
-			foreach ( $donors as $donor ) {
289
+			foreach ($donors as $donor) {
292 290
 
293 291
 				// Continue if donor already included.
294
-				if ( empty( $donor->id ) || empty( $donor->payment_ids ) ) {
292
+				if (empty($donor->id) || empty($donor->payment_ids)) {
295 293
 					continue;
296 294
 				}
297 295
 
298
-				$payment                    = new Give_Payment( $donor->payment_ids );
296
+				$payment                    = new Give_Payment($donor->payment_ids);
299 297
 				$donor->donation_form_title = $payment->form_title;
300
-				$data[]                     = $this->set_donor_data( $i, $data, $donor );
301
-				$i ++;
298
+				$data[]                     = $this->set_donor_data($i, $data, $donor);
299
+				$i++;
302 300
 			}
303 301
 		}// End if().
304 302
 
305
-		$data = apply_filters( 'give_export_get_data', $data );
306
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
303
+		$data = apply_filters('give_export_get_data', $data);
304
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
307 305
 
308 306
 		return $data;
309 307
 	}
@@ -319,18 +317,18 @@  discard block
 block discarded – undo
319 317
 		$percentage = 0;
320 318
 
321 319
 		// We can't count the number when getting them for a specific form.
322
-		if ( empty( $this->form ) ) {
320
+		if (empty($this->form)) {
323 321
 
324 322
 			$total = Give()->donors->count();
325 323
 
326
-			if ( $total > 0 ) {
324
+			if ($total > 0) {
327 325
 
328
-				$percentage = ( ( 30 * $this->step ) / $total ) * 100;
326
+				$percentage = ((30 * $this->step) / $total) * 100;
329 327
 
330 328
 			}
331 329
 		}
332 330
 
333
-		if ( $percentage > 100 ) {
331
+		if ($percentage > 100) {
334 332
 			$percentage = 100;
335 333
 		}
336 334
 
@@ -346,49 +344,49 @@  discard block
 block discarded – undo
346 344
 	 *
347 345
 	 * @return mixed
348 346
 	 */
349
-	private function set_donor_data( $i, $data, $donor ) {
347
+	private function set_donor_data($i, $data, $donor) {
350 348
 
351 349
 		$columns = $this->csv_cols();
352 350
 
353 351
 		// Set address variable
354 352
 		$address = '';
355
-		if ( isset( $donor->user_id ) && $donor->user_id > 0 ) {
356
-			$address = give_get_donor_address( $donor->user_id );
353
+		if (isset($donor->user_id) && $donor->user_id > 0) {
354
+			$address = give_get_donor_address($donor->user_id);
357 355
 		}
358 356
 
359 357
 		// Set columns
360
-		if ( ! empty( $columns['full_name'] ) ) {
361
-			$data[ $i ]['full_name'] = $donor->name;
358
+		if ( ! empty($columns['full_name'])) {
359
+			$data[$i]['full_name'] = $donor->name;
362 360
 		}
363
-		if ( ! empty( $columns['email'] ) ) {
364
-			$data[ $i ]['email'] = $donor->email;
361
+		if ( ! empty($columns['email'])) {
362
+			$data[$i]['email'] = $donor->email;
365 363
 		}
366
-		if ( ! empty( $columns['address_line1'] ) ) {
367
-
368
-			$data[ $i ]['address_line1']   = isset( $address['line1'] ) ? $address['line1'] : '';
369
-			$data[ $i ]['address_line2']   = isset( $address['line2'] ) ? $address['line2'] : '';
370
-			$data[ $i ]['address_city']    = isset( $address['city'] ) ? $address['city'] : '';
371
-			$data[ $i ]['address_state']   = isset( $address['state'] ) ? $address['state'] : '';
372
-			$data[ $i ]['address_zip']     = isset( $address['zip'] ) ? $address['zip'] : '';
373
-			$data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : '';
364
+		if ( ! empty($columns['address_line1'])) {
365
+
366
+			$data[$i]['address_line1']   = isset($address['line1']) ? $address['line1'] : '';
367
+			$data[$i]['address_line2']   = isset($address['line2']) ? $address['line2'] : '';
368
+			$data[$i]['address_city']    = isset($address['city']) ? $address['city'] : '';
369
+			$data[$i]['address_state']   = isset($address['state']) ? $address['state'] : '';
370
+			$data[$i]['address_zip']     = isset($address['zip']) ? $address['zip'] : '';
371
+			$data[$i]['address_country'] = isset($address['country']) ? $address['country'] : '';
374 372
 		}
375
-		if ( ! empty( $columns['userid'] ) ) {
376
-			$data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : '';
373
+		if ( ! empty($columns['userid'])) {
374
+			$data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : '';
377 375
 		}
378
-		if ( ! empty( $columns['donation_form'] ) ) {
379
-			$data[ $i ]['donation_form'] = ! empty( $donor->donation_form_title ) ? $donor->donation_form_title : '';
376
+		if ( ! empty($columns['donation_form'])) {
377
+			$data[$i]['donation_form'] = ! empty($donor->donation_form_title) ? $donor->donation_form_title : '';
380 378
 		}
381
-		if ( ! empty( $columns['date_first_donated'] ) ) {
382
-			$data[ $i ]['date_first_donated'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) );
379
+		if ( ! empty($columns['date_first_donated'])) {
380
+			$data[$i]['date_first_donated'] = date_i18n(give_date_format(), strtotime($donor->date_created));
383 381
 		}
384
-		if ( ! empty( $columns['donations'] ) ) {
385
-			$data[ $i ]['donations'] = $donor->purchase_count;
382
+		if ( ! empty($columns['donations'])) {
383
+			$data[$i]['donations'] = $donor->purchase_count;
386 384
 		}
387
-		if ( ! empty( $columns['donation_sum'] ) ) {
388
-			$data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value, array( 'sanitize' => false ) );
385
+		if ( ! empty($columns['donation_sum'])) {
386
+			$data[$i]['donation_sum'] = give_format_amount($donor->purchase_value, array('sanitize' => false));
389 387
 		}
390 388
 
391
-		return $data[ $i ];
389
+		return $data[$i];
392 390
 
393 391
 	}
394 392
 
@@ -398,9 +396,9 @@  discard block
 block discarded – undo
398 396
 	 * @param array             $request
399 397
 	 * @param Give_Batch_Export $export
400 398
 	 */
401
-	public function unset_properties( $request, $export ) {
402
-		if ( $export->done ) {
403
-			Give_Cache::delete( "give_cache_{$this->query_id}" );
399
+	public function unset_properties($request, $export) {
400
+		if ($export->done) {
401
+			Give_Cache::delete("give_cache_{$this->query_id}");
404 402
 		}
405 403
 	}
406 404
 }
407 405
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/tools/export/class-batch-export.php 1 patch
Spacing   +38 added lines, -38 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
 
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @param int $_step
120 120
 	 */
121
-	public function __construct( $_step = 1 ) {
121
+	public function __construct($_step = 1) {
122 122
 
123 123
 		$upload_dir     = wp_upload_dir();
124 124
 		$this->filetype = '.csv';
125
-		$this->filename = 'give-' . $this->export_type . $this->filetype;
126
-		$this->file     = trailingslashit( $upload_dir['basedir'] ) . $this->filename;
125
+		$this->filename = 'give-'.$this->export_type.$this->filetype;
126
+		$this->file     = trailingslashit($upload_dir['basedir']).$this->filename;
127 127
 
128
-		if ( ! is_writeable( $upload_dir['basedir'] ) ) {
128
+		if ( ! is_writeable($upload_dir['basedir'])) {
129 129
 			$this->is_writable = false;
130 130
 		}
131 131
 
@@ -141,22 +141,22 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function process_step() {
143 143
 
144
-		if ( ! $this->can_export() ) {
145
-			wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array(
144
+		if ( ! $this->can_export()) {
145
+			wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array(
146 146
 				'response' => 403,
147
-			) );
147
+			));
148 148
 		}
149 149
 
150
-		if ( $this->step < 2 ) {
150
+		if ($this->step < 2) {
151 151
 
152 152
 			// Make sure we start with a fresh file on step 1.
153
-			@unlink( $this->file );
153
+			@unlink($this->file);
154 154
 			$this->print_csv_cols();
155 155
 		}
156 156
 
157 157
 		$rows = $this->print_csv_rows();
158 158
 
159
-		if ( $rows ) {
159
+		if ($rows) {
160 160
 			return true;
161 161
 		} else {
162 162
 			return false;
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 		$col_data = '';
177 177
 		$cols     = $this->get_csv_cols();
178 178
 		$i        = 1;
179
-		foreach ( $cols as $col_id => $column ) {
180
-			$col_data .= '"' . addslashes( $column ) . '"';
181
-			$col_data .= $i == count( $cols ) ? '' : ',';
182
-			$i ++;
179
+		foreach ($cols as $col_id => $column) {
180
+			$col_data .= '"'.addslashes($column).'"';
181
+			$col_data .= $i == count($cols) ? '' : ',';
182
+			$i++;
183 183
 		}
184 184
 		$col_data .= "\r\n";
185 185
 
186
-		$this->stash_step_data( $col_data );
186
+		$this->stash_step_data($col_data);
187 187
 
188 188
 		return $col_data;
189 189
 
@@ -202,23 +202,23 @@  discard block
 block discarded – undo
202 202
 		$data     = $this->get_data();
203 203
 		$cols     = $this->get_csv_cols();
204 204
 
205
-		if ( $data ) {
205
+		if ($data) {
206 206
 
207 207
 			// Output each row
208
-			foreach ( $data as $row ) {
208
+			foreach ($data as $row) {
209 209
 				$i = 1;
210
-				foreach ( $row as $col_id => $column ) {
210
+				foreach ($row as $col_id => $column) {
211 211
 					// Make sure the column is valid
212
-					if ( array_key_exists( $col_id, $cols ) ) {
213
-						$row_data .= '"' . addslashes( preg_replace( '/"/', "'", $column ) ) . '"';
214
-						$row_data .= $i == count( $cols ) ? '' : ',';
215
-						$i ++;
212
+					if (array_key_exists($col_id, $cols)) {
213
+						$row_data .= '"'.addslashes(preg_replace('/"/', "'", $column)).'"';
214
+						$row_data .= $i == count($cols) ? '' : ',';
215
+						$i++;
216 216
 					}
217 217
 				}
218 218
 				$row_data .= "\r\n";
219 219
 			}
220 220
 
221
-			$this->stash_step_data( $row_data );
221
+			$this->stash_step_data($row_data);
222 222
 
223 223
 			return $row_data;
224 224
 		}
@@ -246,18 +246,18 @@  discard block
 block discarded – undo
246 246
 
247 247
 		$file = '';
248 248
 
249
-		if ( @file_exists( $this->file ) ) {
249
+		if (@file_exists($this->file)) {
250 250
 
251
-			if ( ! is_writeable( $this->file ) ) {
251
+			if ( ! is_writeable($this->file)) {
252 252
 				$this->is_writable = false;
253 253
 			}
254 254
 
255
-			$file = @file_get_contents( $this->file );
255
+			$file = @file_get_contents($this->file);
256 256
 
257 257
 		} else {
258 258
 
259
-			@file_put_contents( $this->file, '' );
260
-			@chmod( $this->file, 0664 );
259
+			@file_put_contents($this->file, '');
260
+			@chmod($this->file, 0664);
261 261
 
262 262
 		}
263 263
 
@@ -273,18 +273,18 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @return void
275 275
 	 */
276
-	protected function stash_step_data( $data = '' ) {
276
+	protected function stash_step_data($data = '') {
277 277
 
278 278
 		$file = $this->get_file();
279 279
 		$file .= $data;
280
-		@file_put_contents( $this->file, $file );
280
+		@file_put_contents($this->file, $file);
281 281
 
282 282
 		// If we have no rows after this step, mark it as an empty export.
283
-		$file_rows    = file( $this->file, FILE_SKIP_EMPTY_LINES );
283
+		$file_rows    = file($this->file, FILE_SKIP_EMPTY_LINES);
284 284
 		$default_cols = $this->get_csv_cols();
285
-		$default_cols = empty( $default_cols ) ? 0 : 1;
285
+		$default_cols = empty($default_cols) ? 0 : 1;
286 286
 
287
-		$this->is_empty = count( $file_rows ) == $default_cols ? true : false;
287
+		$this->is_empty = count($file_rows) == $default_cols ? true : false;
288 288
 
289 289
 	}
290 290
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
 		$file = $this->get_file();
304 304
 
305
-		@unlink( $this->file );
305
+		@unlink($this->file);
306 306
 
307 307
 		echo $file;
308 308
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		 *
312 312
 		 * @since 1.8
313 313
 		 */
314
-		do_action( 'give_file_export_complete', $_REQUEST );
314
+		do_action('give_file_export_complete', $_REQUEST);
315 315
 
316 316
 		give_die();
317 317
 	}
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	 *
324 324
 	 * @param array $request The Form Data passed into the batch processing.
325 325
 	 */
326
-	public function set_properties( $request ) {
326
+	public function set_properties($request) {
327 327
 	}
328 328
 
329 329
 	/**
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	 * @param array             $request The Form Data passed into the batch processing.
335 335
 	 * @param Give_Batch_Export $export
336 336
 	 */
337
-	public function unset_properties( $request, $export ) {
337
+	public function unset_properties($request, $export) {
338 338
 	}
339 339
 
340 340
 	/**
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-exports.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Admin View: Exports
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 } ?>
9 9
 
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 				 *
19 19
 				 * @since 1.0
20 20
 				 */
21
-				do_action( 'give_tools_tab_export_content_top' );
21
+				do_action('give_tools_tab_export_content_top');
22 22
 				?>
23 23
 
24 24
 				<table class="widefat export-options-table give-table">
25 25
 					<thead>
26 26
 					<tr>
27
-						<th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th>
28
-						<th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th>
27
+						<th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th>
28
+						<th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th>
29 29
 					</tr>
30 30
 					</thead>
31 31
 					<tbody>
@@ -38,42 +38,42 @@  discard block
 block discarded – undo
38 38
 					 *
39 39
 					 * @since 1.0
40 40
 					 */
41
-					do_action( 'give_tools_tab_export_table_top' );
41
+					do_action('give_tools_tab_export_table_top');
42 42
 					?>
43 43
 					<tr class="give-export-pdf-sales-earnings">
44 44
 						<td scope="row" class="row-title">
45 45
 							<h3>
46
-								<span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span>
46
+								<span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span>
47 47
 							</h3>
48
-							<p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p>
48
+							<p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p>
49 49
 						</td>
50 50
 						<td>
51
-							<a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>">
52
-								<?php esc_html_e( 'Generate PDF', 'give' ); ?>
51
+							<a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>">
52
+								<?php esc_html_e('Generate PDF', 'give'); ?>
53 53
 							</a>
54 54
 						</td>
55 55
 					</tr>
56 56
 					<tr class="alternate give-export-sales-earnings">
57 57
 						<td scope="row" class="row-title">
58 58
 							<h3>
59
-								<span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span>
59
+								<span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span>
60 60
 							</h3>
61
-							<p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p>
61
+							<p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p>
62 62
 						</td>
63 63
 						<td>
64 64
 							<form method="post">
65 65
 								<?php
66 66
 								printf(
67 67
 								/* translators: 1: start date dropdown 2: end date dropdown */
68
-									esc_html__( '%1$s to %2$s', 'give' ),
69
-									Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ),
70
-									Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' )
68
+									esc_html__('%1$s to %2$s', 'give'),
69
+									Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'),
70
+									Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month')
71 71
 								);
72 72
 								?>
73 73
 								<input type="hidden" name="give-action"
74 74
 								       value="earnings_export"/>
75 75
 								<input type="submit"
76
-								       value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>"
76
+								       value="<?php esc_attr_e('Generate CSV', 'give'); ?>"
77 77
 								       class="button-secondary"/>
78 78
 							</form>
79 79
 						</td>
@@ -81,37 +81,37 @@  discard block
 block discarded – undo
81 81
 					<tr class="give-export-payment-history">
82 82
 						<td scope="row" class="row-title">
83 83
 							<h3>
84
-								<span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span>
84
+								<span><?php esc_html_e('Export Donation History', 'give'); ?></span>
85 85
 							</h3>
86
-							<p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p>
86
+							<p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p>
87 87
 						</td>
88 88
 						<td>
89 89
 							<form id="give-export-payments"
90 90
 							      class="give-export-form" method="post">
91 91
 								<?php
92
-								echo Give()->html->date_field( array(
92
+								echo Give()->html->date_field(array(
93 93
 									'id'          => 'give-payment-export-start',
94 94
 									'name'        => 'start',
95
-									'placeholder' => esc_attr__( 'Start date', 'give' ),
96
-								) );
95
+									'placeholder' => esc_attr__('Start date', 'give'),
96
+								));
97 97
 
98
-								echo Give()->html->date_field( array(
98
+								echo Give()->html->date_field(array(
99 99
 									'id'          => 'give-payment-export-end',
100 100
 									'name'        => 'end',
101
-									'placeholder' => esc_attr__( 'End date', 'give' ),
102
-								) );
101
+									'placeholder' => esc_attr__('End date', 'give'),
102
+								));
103 103
 								?>
104 104
 								<select name="status">
105
-									<option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option>
105
+									<option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option>
106 106
 									<?php
107 107
 									$statuses = give_get_payment_statuses();
108
-									foreach ( $statuses as $status => $label ) {
109
-										echo '<option value="' . $status . '">' . $label . '</option>';
108
+									foreach ($statuses as $status => $label) {
109
+										echo '<option value="'.$status.'">'.$label.'</option>';
110 110
 									}
111 111
 									?>
112 112
 								</select>
113 113
 								<?php
114
-								if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) {
114
+								if (give_is_setting_enabled(give_get_option('categories'))) {
115 115
 									echo Give()->html->category_dropdown(
116 116
 										'give_forms_categories[]',
117 117
 										0,
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 											'multiple'        => true,
122 122
 											'selected'        => array(),
123 123
 											'show_option_all' => false,
124
-											'placeholder'     => __( 'Choose one or more from categories', 'give' ),
124
+											'placeholder'     => __('Choose one or more from categories', 'give'),
125 125
 										)
126 126
 									);
127 127
 								}
128 128
 
129
-								if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) {
129
+								if (give_is_setting_enabled(give_get_option('tags'))) {
130 130
 									echo Give()->html->tags_dropdown(
131 131
 										'give_forms_tags[]',
132 132
 										0,
@@ -136,18 +136,18 @@  discard block
 block discarded – undo
136 136
 											'multiple'        => true,
137 137
 											'selected'        => array(),
138 138
 											'show_option_all' => false,
139
-											'placeholder'     => __( 'Choose one or more from tags', 'give' ),
139
+											'placeholder'     => __('Choose one or more from tags', 'give'),
140 140
 										)
141 141
 									);
142 142
 								}
143 143
 
144
-								wp_nonce_field( 'give_ajax_export', 'give_ajax_export' );
144
+								wp_nonce_field('give_ajax_export', 'give_ajax_export');
145 145
 								?>
146 146
 								<input type="hidden" name="give-export-class"
147 147
 								       value="Give_Batch_Payments_Export"/>
148 148
 								<span>
149 149
 									<input type="submit"
150
-									       value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>"
150
+									       value="<?php esc_attr_e('Generate CSV', 'give'); ?>"
151 151
 									       class="button-secondary"/>
152 152
 									<span class="spinner"></span>
153 153
 								</span>
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 					<tr class="alternate give-export-donors">
158 158
 						<td scope="row" class="row-title">
159 159
 							<h3>
160
-								<span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span>
160
+								<span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span>
161 161
 							</h3>
162
-							<p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p>
162
+							<p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p>
163 163
 						</td>
164 164
 						<td>
165 165
 							<form method="post" id="give_donor_export"
@@ -167,99 +167,99 @@  discard block
 block discarded – undo
167 167
 
168 168
 								<?php
169 169
 								// Start Date form field for donors
170
-								echo Give()->html->date_field( array(
170
+								echo Give()->html->date_field(array(
171 171
 									'id'          => 'give_donor_export_start_date',
172 172
 									'name'        => 'donor_export_start_date',
173
-									'placeholder' => esc_attr__( 'Start date', 'give' ),
174
-								) );
173
+									'placeholder' => esc_attr__('Start date', 'give'),
174
+								));
175 175
 
176 176
 								// End Date form field for donors
177
-								echo Give()->html->date_field( array(
177
+								echo Give()->html->date_field(array(
178 178
 									'id'          => 'give_donor_export_end_date',
179 179
 									'name'        => 'donor_export_end_date',
180
-									'placeholder' => esc_attr__( 'End date', 'give' ),
181
-								) );
180
+									'placeholder' => esc_attr__('End date', 'give'),
181
+								));
182 182
 
183 183
 								// Donation forms dropdown for donors export
184
-								echo Give()->html->forms_dropdown( array(
184
+								echo Give()->html->forms_dropdown(array(
185 185
 									'name'   => 'forms',
186 186
 									'id'     => 'give_donor_export_form',
187 187
 									'chosen' => true,
188
-								) );
188
+								));
189 189
 								?>
190 190
 
191 191
 								<input type="submit"
192
-								       value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>"
192
+								       value="<?php esc_attr_e('Generate CSV', 'give'); ?>"
193 193
 								       class="button-secondary"/>
194 194
 
195 195
 								<div id="export-donor-options-wrap"
196 196
 								     class="give-clearfix">
197
-									<p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p>
197
+									<p><?php esc_html_e('Export Columns:', 'give'); ?></p>
198 198
 									<ul id="give-export-option-ul">
199 199
 										<li>
200 200
 											<label for="give-export-fullname">
201 201
 												<input type="checkbox" checked
202 202
 												       name="give_export_option[full_name]"
203
-												       id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?>
203
+												       id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?>
204 204
 											</label>
205 205
 										</li>
206 206
 										<li>
207 207
 											<label for="give-export-email">
208 208
 												<input type="checkbox" checked
209 209
 												       name="give_export_option[email]"
210
-												       id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?>
210
+												       id="give-export-email"><?php esc_html_e('Email', 'give'); ?>
211 211
 											</label>
212 212
 										</li>
213 213
 										<li>
214 214
 											<label for="give-export-address">
215 215
 												<input type="checkbox" checked
216 216
 												       name="give_export_option[address]"
217
-												       id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?>
217
+												       id="give-export-address"><?php esc_html_e('Address', 'give'); ?>
218 218
 											</label>
219 219
 										</li>
220 220
 										<li>
221 221
 											<label for="give-export-userid">
222 222
 												<input type="checkbox" checked
223 223
 												       name="give_export_option[userid]"
224
-												       id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?>
224
+												       id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?>
225 225
 											</label>
226 226
 										</li>
227 227
 										<li>
228 228
 											<label for="give-export-donation-form">
229 229
 												<input type="checkbox" checked
230 230
 												       name="give_export_option[donation_form]"
231
-												       id="give-export-donation-form"><?php esc_html_e( 'Donation Form', 'give' ); ?>
231
+												       id="give-export-donation-form"><?php esc_html_e('Donation Form', 'give'); ?>
232 232
 											</label>
233 233
 										</li>
234 234
 										<li>
235 235
 											<label for="give-export-first-donation-date">
236 236
 												<input type="checkbox" checked
237 237
 												       name="give_export_option[date_first_donated]"
238
-												       id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?>
238
+												       id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?>
239 239
 											</label>
240 240
 										</li>
241 241
 										<li>
242 242
 											<label for="give-export-donation-number">
243 243
 												<input type="checkbox" checked
244 244
 												       name="give_export_option[donations]"
245
-												       id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?>
245
+												       id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?>
246 246
 											</label>
247 247
 										</li>
248 248
 										<li>
249 249
 											<label for="give-export-donation-sum">
250 250
 												<input type="checkbox" checked
251 251
 												       name="give_export_option[donation_sum]"
252
-												       id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?>
252
+												       id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?>
253 253
 											</label>
254 254
 										</li>
255 255
 									</ul>
256 256
 								</div>
257
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
257
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
258 258
 								<input type="hidden" name="give-export-class"
259 259
 								       value="Give_Batch_Donors_Export"/>
260 260
 								<input type="hidden"
261 261
 								       name="give_export_option[query_id]"
262
-								       value="<?php echo uniqid( 'give_' ); ?>"/>
262
+								       value="<?php echo uniqid('give_'); ?>"/>
263 263
 							</form>
264 264
 						</td>
265 265
 					</tr>
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 					 *
273 273
 					 * @since 1.0
274 274
 					 */
275
-					do_action( 'give_tools_tab_export_table_bottom' );
275
+					do_action('give_tools_tab_export_table_bottom');
276 276
 					?>
277 277
 					</tbody>
278 278
 				</table>
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 				 *
284 284
 				 * @since 1.0
285 285
 				 */
286
-				do_action( 'give_tools_tab_export_content_bottom' );
286
+				do_action('give_tools_tab_export_content_bottom');
287 287
 				?>
288 288
 
289 289
 			</div>
Please login to merge, or discard this patch.
includes/admin/payments/view-payment-details.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -514,16 +514,16 @@
 block discarded – undo
514 514
 											<p>
515 515
 												<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
516 516
 												<?php
517
-                                                $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
518
-                                                $donor_name = give_get_donor_name_by( $donor_id, 'donor' );
519
-
520
-                                                // Check whether the donor name and WP_User name is same or not.
521
-                                                if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){
522
-                                                    echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)';
523
-                                                }else{
524
-                                                    echo $donor_name;
525
-                                                }
526
-                                                ?>
517
+												$donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
518
+												$donor_name = give_get_donor_name_by( $donor_id, 'donor' );
519
+
520
+												// Check whether the donor name and WP_User name is same or not.
521
+												if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){
522
+													echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)';
523
+												}else{
524
+													echo $donor_name;
525
+												}
526
+												?>
527 527
 											</p>
528 528
 											<p>
529 529
 												<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -520,7 +520,7 @@
 block discarded – undo
520 520
                                                 // Check whether the donor name and WP_User name is same or not.
521 521
                                                 if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){
522 522
                                                     echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)';
523
-                                                }else{
523
+                                                } else{
524 524
                                                     echo $donor_name;
525 525
                                                 }
526 526
                                                 ?>
Please login to merge, or discard this patch.
Spacing   +143 added lines, -143 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
 
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
24
-	wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
23
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
24
+	wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
25 25
 }
26 26
 
27 27
 // Setup the variables
28
-$payment_id = absint( $_GET['id'] );
29
-$payment    = new Give_Payment( $payment_id );
28
+$payment_id = absint($_GET['id']);
29
+$payment    = new Give_Payment($payment_id);
30 30
 
31 31
 // Sanity check... fail if donation ID is invalid
32 32
 $payment_exists = $payment->ID;
33
-if ( empty( $payment_exists ) ) {
34
-	wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
33
+if (empty($payment_exists)) {
34
+	wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
35 35
 }
36 36
 
37 37
 $number         = $payment->number;
38 38
 $payment_meta   = $payment->get_meta();
39
-$transaction_id = esc_attr( $payment->transaction_id );
39
+$transaction_id = esc_attr($payment->transaction_id);
40 40
 $user_id        = $payment->user_id;
41 41
 $donor_id       = $payment->customer_id;
42
-$payment_date   = strtotime( $payment->date );
43
-$user_info      = give_get_payment_meta_user_info( $payment_id );
42
+$payment_date   = strtotime($payment->date);
43
+$user_info      = give_get_payment_meta_user_info($payment_id);
44 44
 $address        = $payment->address;
45 45
 $currency_code  = $payment->currency;
46 46
 $gateway        = $payment->gateway;
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	<h1 id="transaction-details-heading"><?php
53 53
 		printf(
54 54
 			/* translators: %s: donation number */
55
-			esc_html__( 'Donation %s', 'give' ),
55
+			esc_html__('Donation %s', 'give'),
56 56
 			$number
57 57
 		);
58
-		if ( $payment_mode == 'test' ) {
59
-			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>';
58
+		if ($payment_mode == 'test') {
59
+			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>';
60 60
 		}
61 61
 		?></h1>
62 62
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @param int $payment_id Payment id.
70 70
 	 */
71
-	do_action( 'give_view_order_details_before', $payment_id );
71
+	do_action('give_view_order_details_before', $payment_id);
72 72
 	?>
73 73
 	<form id="give-edit-order-form" method="post">
74 74
 		<?php
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		 *
80 80
 		 * @param int $payment_id Payment id.
81 81
 		 */
82
-		do_action( 'give_view_order_details_form_top', $payment_id );
82
+		do_action('give_view_order_details_form_top', $payment_id);
83 83
 		?>
84 84
 		<div id="poststuff">
85 85
 			<div id="give-dashboard-widgets-wrap">
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 							 *
96 96
 							 * @param int $payment_id Payment id.
97 97
 							 */
98
-							do_action( 'give_view_order_details_sidebar_before', $payment_id );
98
+							do_action('give_view_order_details_sidebar_before', $payment_id);
99 99
 							?>
100 100
 
101 101
 							<div id="give-order-update" class="postbox give-order-data">
102 102
 
103
-								<h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3>
103
+								<h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3>
104 104
 
105 105
 								<div class="inside">
106 106
 									<div class="give-admin-box">
@@ -113,33 +113,33 @@  discard block
 block discarded – undo
113 113
 										 *
114 114
 										 * @param int $payment_id Payment id.
115 115
 										 */
116
-										do_action( 'give_view_order_details_totals_before', $payment_id );
116
+										do_action('give_view_order_details_totals_before', $payment_id);
117 117
 										?>
118 118
 
119 119
 										<div class="give-admin-box-inside">
120 120
 											<p>
121
-												<label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label>&nbsp;
121
+												<label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label>&nbsp;
122 122
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
123
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
124
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
123
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
124
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
125 125
 													<?php endforeach; ?>
126 126
 												</select>
127
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
127
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
128 128
 											</p>
129 129
 										</div>
130 130
 
131 131
 										<div class="give-admin-box-inside">
132 132
 											<p>
133
-												<label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label>&nbsp;
134
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
133
+												<label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label>&nbsp;
134
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
135 135
 											</p>
136 136
 										</div>
137 137
 
138 138
 										<div class="give-admin-box-inside">
139 139
 											<p>
140
-												<label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label>&nbsp;
141
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
142
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
140
+												<label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label>&nbsp;
141
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
142
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
143 143
 											</p>
144 144
 										</div>
145 145
 
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
 										 *
154 154
 										 * @param int $payment_id Payment id.
155 155
 										 */
156
-										do_action( 'give_view_order_details_update_inner', $payment_id ); ?>
156
+										do_action('give_view_order_details_update_inner', $payment_id); ?>
157 157
 
158 158
 										<div class="give-order-payment give-admin-box-inside">
159 159
 											<p>
160
-												<label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label>&nbsp;
161
-												<?php echo give_currency_symbol( $payment->currency ); ?>
162
-												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ), false, false ) ); ?>"/>
160
+												<label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label>&nbsp;
161
+												<?php echo give_currency_symbol($payment->currency); ?>
162
+												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id), false, false)); ?>"/>
163 163
 											</p>
164 164
 										</div>
165 165
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 										 *
172 172
 										 * @param int $payment_id Payment id.
173 173
 										 */
174
-										do_action( 'give_view_order_details_totals_after', $payment_id );
174
+										do_action('give_view_order_details_totals_after', $payment_id);
175 175
 										?>
176 176
 
177 177
 									</div>
@@ -189,17 +189,17 @@  discard block
 block discarded – undo
189 189
 									 *
190 190
 									 * @param int $payment_id Payment id.
191 191
 									 */
192
-									do_action( 'give_view_order_details_update_before', $payment_id );
192
+									do_action('give_view_order_details_update_before', $payment_id);
193 193
 									?>
194 194
 
195 195
 									<div id="major-publishing-actions">
196 196
 										<div id="publishing-action">
197
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
198
-											<?php if ( give_is_payment_complete( $payment_id ) ) : ?>
199
-												<a href="<?php echo esc_url( add_query_arg( array(
197
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/>
198
+											<?php if (give_is_payment_complete($payment_id)) : ?>
199
+												<a href="<?php echo esc_url(add_query_arg(array(
200 200
 													'give-action' => 'email_links',
201 201
 													'purchase_id' => $payment_id,
202
-												) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a>
202
+												))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a>
203 203
 											<?php endif; ?>
204 204
 										</div>
205 205
 										<div class="clear"></div>
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 									 *
214 214
 									 * @param int $payment_id Payment id.
215 215
 									 */
216
-									do_action( 'give_view_order_details_update_after', $payment_id );
216
+									do_action('give_view_order_details_update_after', $payment_id);
217 217
 									?>
218 218
 
219 219
 								</div>
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
 							<div id="give-order-details" class="postbox give-order-data">
226 226
 
227
-								<h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3>
227
+								<h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3>
228 228
 
229 229
 								<div class="inside">
230 230
 									<div class="give-admin-box">
@@ -237,44 +237,44 @@  discard block
 block discarded – undo
237 237
 										 *
238 238
 										 * @param int $payment_id Payment id.
239 239
 										 */
240
-										do_action( 'give_view_order_details_payment_meta_before', $payment_id );
240
+										do_action('give_view_order_details_payment_meta_before', $payment_id);
241 241
 
242
-										$gateway = give_get_payment_gateway( $payment_id );
243
-										if ( $gateway ) : ?>
242
+										$gateway = give_get_payment_gateway($payment_id);
243
+										if ($gateway) : ?>
244 244
 											<div class="give-order-gateway give-admin-box-inside">
245 245
 												<p>
246
-													<strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong>&nbsp;
247
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
246
+													<strong><?php esc_html_e('Gateway:', 'give'); ?></strong>&nbsp;
247
+													<?php echo give_get_gateway_admin_label($gateway); ?>
248 248
 												</p>
249 249
 											</div>
250 250
 										<?php endif; ?>
251 251
 
252 252
 										<div class="give-order-payment-key give-admin-box-inside">
253 253
 											<p>
254
-												<strong><?php esc_html_e( 'Key:', 'give' ); ?></strong>&nbsp;
255
-												<?php echo give_get_payment_key( $payment_id ); ?>
254
+												<strong><?php esc_html_e('Key:', 'give'); ?></strong>&nbsp;
255
+												<?php echo give_get_payment_key($payment_id); ?>
256 256
 											</p>
257 257
 										</div>
258 258
 
259 259
 										<div class="give-order-ip give-admin-box-inside">
260 260
 											<p>
261
-												<strong><?php esc_html_e( 'IP:', 'give' ); ?></strong>&nbsp;
262
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
261
+												<strong><?php esc_html_e('IP:', 'give'); ?></strong>&nbsp;
262
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
263 263
 											</p>
264 264
 										</div>
265 265
 
266
-										<?php if ( $transaction_id ) : ?>
266
+										<?php if ($transaction_id) : ?>
267 267
 											<div class="give-order-tx-id give-admin-box-inside">
268 268
 												<p>
269
-													<strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong>&nbsp;
270
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
269
+													<strong><?php esc_html_e('Donation ID:', 'give'); ?></strong>&nbsp;
270
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
271 271
 												</p>
272 272
 											</div>
273 273
 										<?php endif; ?>
274 274
 
275 275
 										<div class="give-admin-box-inside">
276
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?>
277
-												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
276
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?>
277
+												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor &raquo;', 'give'); ?></a>
278 278
 											</p>
279 279
 										</div>
280 280
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 										 *
287 287
 										 * @param int $payment_id Payment id.
288 288
 										 */
289
-										do_action( 'give_view_order_details_payment_meta_after', $payment_id );
289
+										do_action('give_view_order_details_payment_meta_after', $payment_id);
290 290
 										?>
291 291
 
292 292
 									</div>
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 							 *
307 307
 							 * @param int $payment_id Payment id.
308 308
 							 */
309
-							do_action( 'give_view_order_details_sidebar_after', $payment_id );
309
+							do_action('give_view_order_details_sidebar_after', $payment_id);
310 310
 							?>
311 311
 
312 312
 						</div>
@@ -326,56 +326,56 @@  discard block
 block discarded – undo
326 326
 							 *
327 327
 							 * @param int $payment_id Payment id.
328 328
 							 */
329
-							do_action( 'give_view_order_details_main_before', $payment_id );
329
+							do_action('give_view_order_details_main_before', $payment_id);
330 330
 							?>
331 331
 
332 332
 							<?php $column_count = 'columns-3'; ?>
333 333
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
334
-								<h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3>
334
+								<h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3>
335 335
 
336 336
 								<div class="inside">
337 337
 
338 338
 									<div class="column-container">
339 339
 										<div class="column">
340 340
 											<p>
341
-												<strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br>
341
+												<strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br>
342 342
 												<?php
343
-												if ( $payment_meta['form_id'] ) :
343
+												if ($payment_meta['form_id']) :
344 344
 													printf(
345 345
 														'<a href="%1$s">#%2$s</a>',
346
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
346
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
347 347
 														$payment_meta['form_id']
348 348
 													);
349 349
 												endif;
350 350
 												?>
351 351
 											</p>
352 352
 											<p>
353
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
354
-												<?php echo Give()->html->forms_dropdown( array(
353
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
354
+												<?php echo Give()->html->forms_dropdown(array(
355 355
 													'selected' => $payment_meta['form_id'],
356 356
 													'name'   => 'give-payment-form-select',
357 357
 													'id'     => 'give-payment-form-select',
358 358
 													'chosen' => true,
359
-												) ); ?>
359
+												)); ?>
360 360
 											</p>
361 361
 										</div>
362 362
 										<div class="column">
363 363
 											<p>
364
-												<strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br>
365
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
364
+												<strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br>
365
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
366 366
 											</p>
367 367
 											<p>
368
-												<strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br>
368
+												<strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br>
369 369
 												<span class="give-donation-level">
370 370
 													<?php
371
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
372
-													if ( empty( $var_prices ) ) {
373
-														esc_html_e( 'n/a', 'give' );
371
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
372
+													if (empty($var_prices)) {
373
+														esc_html_e('n/a', 'give');
374 374
 													} else {
375 375
 														$prices_atts = '';
376
-														if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) {
377
-															foreach ( $variable_prices as $variable_price ) {
378
-																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
376
+														if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) {
377
+															foreach ($variable_prices as $variable_price) {
378
+																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false));
379 379
 															}
380 380
 														}
381 381
 														// Variable price dropdown options.
@@ -384,12 +384,12 @@  discard block
 block discarded – undo
384 384
 															'name'             => 'give-variable-price',
385 385
 															'chosen'           => true,
386 386
 															'show_option_all'  => '',
387
-															'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' )  : '' ),
388
-															'select_atts'      => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ),
387
+															'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''),
388
+															'select_atts'      => 'data-prices='.esc_attr(json_encode($prices_atts)),
389 389
 															'selected'         => $payment_meta['price_id'],
390 390
 														);
391 391
 														// Render variable prices select tag html.
392
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
392
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
393 393
 													}
394 394
 													?>
395 395
 												</span>
@@ -397,8 +397,8 @@  discard block
 block discarded – undo
397 397
 										</div>
398 398
 										<div class="column">
399 399
 											<p>
400
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
401
-												<?php echo give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment->ID ) ); ?>
400
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
401
+												<?php echo give_currency_filter(give_format_amount($payment->total, array('sanitize' => false)), give_get_payment_currency_code($payment->ID)); ?>
402 402
 											</p>
403 403
 											<p>
404 404
 												<?php
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 												 *
412 412
 												 * @param int $payment_id Payment id.
413 413
 												 */
414
-												do_action( 'give_donation_details_thead_before', $payment_id );
414
+												do_action('give_donation_details_thead_before', $payment_id);
415 415
 
416 416
 
417 417
 												/**
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 												 *
424 424
 												 * @param int $payment_id Payment id.
425 425
 												 */
426
-												do_action( 'give_donation_details_thead_after', $payment_id );
426
+												do_action('give_donation_details_thead_after', $payment_id);
427 427
 
428 428
 												/**
429 429
 												 * Fires in order details page, in the donation-information metabox, before the body elements.
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 												 *
435 435
 												 * @param int $payment_id Payment id.
436 436
 												 */
437
-												do_action( 'give_donation_details_tbody_before', $payment_id );
437
+												do_action('give_donation_details_tbody_before', $payment_id);
438 438
 
439 439
 												/**
440 440
 												 * Fires in order details page, in the donation-information metabox, after the body elements.
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 												 *
446 446
 												 * @param int $payment_id Payment id.
447 447
 												 */
448
-												do_action( 'give_donation_details_tbody_after', $payment_id );
448
+												do_action('give_donation_details_tbody_after', $payment_id);
449 449
 												?>
450 450
 											</p>
451 451
 										</div>
@@ -465,67 +465,67 @@  discard block
 block discarded – undo
465 465
 							 *
466 466
 							 * @param int $payment_id Payment id.
467 467
 							 */
468
-							do_action( 'give_view_order_details_files_after', $payment_id );
468
+							do_action('give_view_order_details_files_after', $payment_id);
469 469
 							?>
470 470
 
471 471
 							<div id="give-donor-details" class="postbox">
472
-								<h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3>
472
+								<h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3>
473 473
 
474 474
 								<div class="inside">
475 475
 
476
-									<?php $donor = new Give_Donor( $donor_id ); ?>
476
+									<?php $donor = new Give_Donor($donor_id); ?>
477 477
 
478 478
 									<div class="column-container donor-info">
479 479
 										<div class="column">
480 480
 											<p>
481
-												<strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
481
+												<strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br>
482 482
 												<?php
483
-												if ( ! empty( $donor->id ) ) {
483
+												if ( ! empty($donor->id)) {
484 484
 													printf(
485 485
 														'<a href="%1$s">#%2$s</a>',
486
-														admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ),
486
+														admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id),
487 487
 														$donor->id
488 488
 													);
489 489
 												}
490 490
 												?>
491 491
 											</p>
492 492
 											<p>
493
-												<strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br>
494
-												<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?>
493
+												<strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br>
494
+												<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?>
495 495
 											</p>
496 496
 										</div>
497 497
 										<div class="column">
498 498
 											<p>
499
-												<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
499
+												<strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br>
500 500
 												<?php
501
-                                                $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
502
-                                                $donor_name = give_get_donor_name_by( $donor_id, 'donor' );
501
+                                                $donor_billing_name = give_get_donor_name_by($payment_id, 'donation');
502
+                                                $donor_name = give_get_donor_name_by($donor_id, 'donor');
503 503
 
504 504
                                                 // Check whether the donor name and WP_User name is same or not.
505
-                                                if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){
506
-                                                    echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)';
507
-                                                }else{
505
+                                                if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
506
+                                                    echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)';
507
+                                                } else {
508 508
                                                     echo $donor_name;
509 509
                                                 }
510 510
                                                 ?>
511 511
 											</p>
512 512
 											<p>
513
-												<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
513
+												<strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br>
514 514
 												<?php echo $donor->email; ?>
515 515
 											</p>
516 516
 										</div>
517 517
 										<div class="column">
518 518
 											<p>
519
-												<strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
519
+												<strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br>
520 520
 												<?php
521
-												echo Give()->html->donor_dropdown( array(
521
+												echo Give()->html->donor_dropdown(array(
522 522
 													'selected' => $donor->id,
523 523
 													'name'     => 'donor-id',
524
-												) );
524
+												));
525 525
 												?>
526 526
 											</p>
527 527
 											<p>
528
-												<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>
528
+												<a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a>
529 529
 											</p>
530 530
 										</div>
531 531
 									</div>
@@ -533,13 +533,13 @@  discard block
 block discarded – undo
533 533
 									<div class="column-container new-donor" style="display: none">
534 534
 										<div class="column">
535 535
 											<p>
536
-												<label for="give-new-donor-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label>
536
+												<label for="give-new-donor-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label>
537 537
 												<input id="give-new-donor-name" type="text" name="give-new-donor-name" value="" class="medium-text"/>
538 538
 											</p>
539 539
 										</div>
540 540
 										<div class="column">
541 541
 											<p>
542
-												<label for="give-new-donor-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label>
542
+												<label for="give-new-donor-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label>
543 543
 												<input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/>
544 544
 											</p>
545 545
 										</div>
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
 											<p>
548 548
 												<input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/>
549 549
 												<input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/>
550
-												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
550
+												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a>
551 551
 												<br>
552
-												<em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
552
+												<em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em>
553 553
 											</p>
554 554
 										</div>
555 555
 									</div>
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 									 * @param array $payment_meta Payment meta.
566 566
 									 * @param array $user_info    User information.
567 567
 									 */
568
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
568
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
569 569
 
570 570
 									/**
571 571
 									 * Fires on the donation details page, in the donor-details metabox.
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 									 *
575 575
 									 * @param int $payment_id Payment id.
576 576
 									 */
577
-									do_action( 'give_payment_view_details', $payment_id );
577
+									do_action('give_payment_view_details', $payment_id);
578 578
 									?>
579 579
 
580 580
 								</div>
@@ -590,11 +590,11 @@  discard block
 block discarded – undo
590 590
 							 *
591 591
 							 * @param int $payment_id Payment id.
592 592
 							 */
593
-							do_action( 'give_view_order_details_billing_before', $payment_id );
593
+							do_action('give_view_order_details_billing_before', $payment_id);
594 594
 							?>
595 595
 
596 596
 							<div id="give-billing-details" class="postbox">
597
-								<h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3>
597
+								<h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3>
598 598
 
599 599
 								<div class="inside">
600 600
 
@@ -604,59 +604,59 @@  discard block
 block discarded – undo
604 604
 											<div class="data column-container">
605 605
 												<div class="column">
606 606
 													<div class="give-wrap-address-line1">
607
-														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label>
608
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
607
+														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label>
608
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
609 609
 													</div>
610 610
 													<div class="give-wrap-address-line2">
611
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label>
612
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
611
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label>
612
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
613 613
 													</div>
614 614
 												</div>
615 615
 												<div class="column">
616 616
 													<div class="give-wrap-address-city">
617
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
618
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
617
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
618
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
619 619
 													</div>
620 620
 													<div class="give-wrap-address-zip">
621
-														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label>
622
-														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
621
+														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label>
622
+														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
623 623
 
624 624
 													</div>
625 625
 												</div>
626 626
 												<div class="column">
627 627
 													<div id="give-order-address-country-wrap">
628
-														<label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label>
628
+														<label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label>
629 629
 														<?php
630
-														echo Give()->html->select( array(
630
+														echo Give()->html->select(array(
631 631
 															'options'          => give_get_country_list(),
632 632
 															'name'             => 'give-payment-address[0][country]',
633 633
 															'selected'         => $address['country'],
634 634
 															'show_option_all'  => false,
635 635
 															'show_option_none' => false,
636 636
 															'chosen'           => true,
637
-															'placeholder'      => esc_attr__( 'Select a country', 'give' ),
638
-															'data'             => array( 'search-type' => 'no_ajax' ),
639
-														) );
637
+															'placeholder'      => esc_attr__('Select a country', 'give'),
638
+															'data'             => array('search-type' => 'no_ajax'),
639
+														));
640 640
 														?>
641 641
 													</div>
642 642
 													<div id="give-order-address-state-wrap">
643
-														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
643
+														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label>
644 644
 														<?php
645
-														$states = give_get_states( $address['country'] );
646
-														if ( ! empty( $states ) ) {
647
-															echo Give()->html->select( array(
645
+														$states = give_get_states($address['country']);
646
+														if ( ! empty($states)) {
647
+															echo Give()->html->select(array(
648 648
 																'options'          => $states,
649 649
 																'name'             => 'give-payment-address[0][state]',
650 650
 																'selected'         => $address['state'],
651 651
 																'show_option_all'  => false,
652 652
 																'show_option_none' => false,
653 653
 																'chosen'           => true,
654
-																'placeholder'      => esc_attr__( 'Select a state', 'give' ),
655
-																'data'             => array( 'search-type' => 'no_ajax' ),
656
-															) );
654
+																'placeholder'      => esc_attr__('Select a state', 'give'),
655
+																'data'             => array('search-type' => 'no_ajax'),
656
+															));
657 657
 														} else {
658 658
 															?>
659
-															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
659
+															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
660 660
 															<?php
661 661
 														} ?>
662 662
 													</div>
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 									 *
677 677
 									 * @param int $payment_id Payment id.
678 678
 									 */
679
-									do_action( 'give_payment_billing_details', $payment_id );
679
+									do_action('give_payment_billing_details', $payment_id);
680 680
 									?>
681 681
 
682 682
 								</div>
@@ -692,32 +692,32 @@  discard block
 block discarded – undo
692 692
 							 *
693 693
 							 * @param int $payment_id Payment id.
694 694
 							 */
695
-							do_action( 'give_view_order_details_billing_after', $payment_id );
695
+							do_action('give_view_order_details_billing_after', $payment_id);
696 696
 							?>
697 697
 
698 698
 							<div id="give-payment-notes" class="postbox">
699
-								<h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3>
699
+								<h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3>
700 700
 
701 701
 								<div class="inside">
702 702
 									<div id="give-payment-notes-inner">
703 703
 										<?php
704
-										$notes = give_get_payment_notes( $payment_id );
705
-										if ( ! empty( $notes ) ) {
704
+										$notes = give_get_payment_notes($payment_id);
705
+										if ( ! empty($notes)) {
706 706
 											$no_notes_display = ' style="display:none;"';
707
-											foreach ( $notes as $note ) :
707
+											foreach ($notes as $note) :
708 708
 
709
-												echo give_get_payment_note_html( $note, $payment_id );
709
+												echo give_get_payment_note_html($note, $payment_id);
710 710
 
711 711
 											endforeach;
712 712
 										} else {
713 713
 											$no_notes_display = '';
714 714
 										}
715
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?>
715
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?>
716 716
 									</div>
717 717
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
718 718
 
719 719
 									<div class="give-clearfix">
720
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button>
720
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button>
721 721
 									</div>
722 722
 
723 723
 								</div>
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 							 *
734 734
 							 * @param int $payment_id Payment id.
735 735
 							 */
736
-							do_action( 'give_view_order_details_main_after', $payment_id );
736
+							do_action('give_view_order_details_main_after', $payment_id);
737 737
 							?>
738 738
 
739 739
 						</div>
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 		 *
756 756
 		 * @param int $payment_id Payment id.
757 757
 		 */
758
-		do_action( 'give_view_order_details_form_bottom', $payment_id );
758
+		do_action('give_view_order_details_form_bottom', $payment_id);
759 759
 
760
-		wp_nonce_field( 'give_update_payment_details_nonce' );
760
+		wp_nonce_field('give_update_payment_details_nonce');
761 761
 		?>
762
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
762
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
763 763
 		<input type="hidden" name="give_action" value="update_payment_details"/>
764 764
 	</form>
765 765
 	<?php
@@ -770,6 +770,6 @@  discard block
 block discarded – undo
770 770
 	 *
771 771
 	 * @param int $payment_id Payment id.
772 772
 	 */
773
-	do_action( 'give_view_order_details_after', $payment_id );
773
+	do_action('give_view_order_details_after', $payment_id);
774 774
 	?>
775 775
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/payments/payments-history.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 */
26 26
 function give_payment_history_page() {
27 27
 
28
-	$give_payment = get_post_type_object( 'give_payment' );
28
+	$give_payment = get_post_type_object('give_payment');
29 29
 
30
-	if ( isset( $_GET['view'] ) && 'view-payment-details' == $_GET['view'] ) {
31
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-payment-details.php';
30
+	if (isset($_GET['view']) && 'view-payment-details' == $_GET['view']) {
31
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-payment-details.php';
32 32
 	} else {
33
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php';
33
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php';
34 34
 		$payments_table = new Give_Payment_History_Table();
35 35
 		$payments_table->prepare_items();
36 36
 	?>
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
 		 *
45 45
 		 * @since 1.7
46 46
 		 */
47
-		do_action( 'give_payments_page_top' );
47
+		do_action('give_payments_page_top');
48 48
 		?>
49 49
 
50
-		<form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
50
+		<form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>">
51 51
 			<input type="hidden" name="post_type" value="give_forms" />
52 52
 			<input type="hidden" name="page" value="give-payment-history" />
53 53
 			<?php $payments_table->views() ?>
54 54
 			<?php $payments_table->advanced_filters(); ?>
55 55
 		</form>
56 56
 
57
-		<form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
57
+		<form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>">
58 58
 			<input type="hidden" name="post_type" value="give_forms" />
59 59
 			<input type="hidden" name="page" value="give-payment-history" />
60 60
 			<?php $payments_table->display() ?>
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		 *
67 67
 		 * @since 1.7
68 68
 		 */
69
-		do_action( 'give_payments_page_bottom' );
69
+		do_action('give_payments_page_bottom');
70 70
 		?>
71 71
 
72 72
 	</div>
@@ -83,29 +83,29 @@  discard block
 block discarded – undo
83 83
  * @param $title
84 84
  * @return string
85 85
  */
86
-function give_view_order_details_title( $admin_title, $title ) {
86
+function give_view_order_details_title($admin_title, $title) {
87 87
 
88
-	if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) {
88
+	if ('give_forms_page_give-payment-history' != get_current_screen()->base) {
89 89
 		return $admin_title;
90 90
 	}
91 91
 
92
-	if( ! isset( $_GET['give-action'] ) ) {
92
+	if ( ! isset($_GET['give-action'])) {
93 93
 		return $admin_title;
94 94
 	}
95 95
 
96
-	switch( $_GET['give-action'] ) :
96
+	switch ($_GET['give-action']) :
97 97
 
98 98
 		case 'view-payment-details' :
99 99
 			$title = sprintf(
100 100
 				/* translators: %s: admin title */
101
-				esc_html__( 'View Donation Details - %s', 'give' ),
101
+				esc_html__('View Donation Details - %s', 'give'),
102 102
 				$admin_title
103 103
 			);
104 104
 			break;
105 105
 		case 'edit-payment' :
106 106
 			$title = sprintf(
107 107
 				/* translators: %s: admin title */
108
-				esc_html__( 'Edit Donation - %s', 'give' ),
108
+				esc_html__('Edit Donation - %s', 'give'),
109 109
 				$admin_title
110 110
 			);
111 111
 			break;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
 	return $title;
118 118
 }
119
-add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 );
119
+add_filter('admin_title', 'give_view_order_details_title', 10, 2);
120 120
 
121 121
 /**
122 122
  * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen.
@@ -128,20 +128,20 @@  discard block
 block discarded – undo
128 128
  * @param $context
129 129
  * @return string
130 130
  */
131
-function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) {
131
+function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) {
132 132
 
133
-	$post = get_post( $post_id );
133
+	$post = get_post($post_id);
134 134
 
135
-	if( ! $post ) {
135
+	if ( ! $post) {
136 136
 		return $url;
137 137
 	}
138 138
 
139
-	if( 'give_payment' != $post->post_type ) {
139
+	if ('give_payment' != $post->post_type) {
140 140
 		return $url;
141 141
 	}
142 142
 
143
-	$url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $post_id );
143
+	$url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$post_id);
144 144
 
145 145
 	return $url;
146 146
 }
147
-add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 );
147
+add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3);
Please login to merge, or discard this patch.
includes/admin/donors/donor-functions.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array        The altered list of views.
25 25
  */
26
-function give_register_default_donor_views( $views ) {
26
+function give_register_default_donor_views($views) {
27 27
 
28 28
 	$default_views = array(
29 29
 		'overview' => 'give_donor_view',
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		'notes'    => 'give_donor_notes_view',
32 32
 	);
33 33
 
34
-	return array_merge( $views, $default_views );
34
+	return array_merge($views, $default_views);
35 35
 
36 36
 }
37 37
 
38
-add_filter( 'give_donor_views', 'give_register_default_donor_views', 1, 1 );
38
+add_filter('give_donor_views', 'give_register_default_donor_views', 1, 1);
39 39
 
40 40
 /**
41 41
  * Register a tab for the single donor view.
@@ -46,23 +46,23 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @return array       The altered list of tabs
48 48
  */
49
-function give_register_default_donor_tabs( $tabs ) {
49
+function give_register_default_donor_tabs($tabs) {
50 50
 
51 51
 	$default_tabs = array(
52 52
 		'overview' => array(
53 53
 			'dashicon' => 'dashicons-admin-users',
54
-			'title' => __( 'Donor Profile', 'give' ),
54
+			'title' => __('Donor Profile', 'give'),
55 55
 		),
56 56
 		'notes'    => array(
57 57
 			'dashicon' => 'dashicons-admin-comments',
58
-			'title' => __( 'Donor Notes', 'give' ),
58
+			'title' => __('Donor Notes', 'give'),
59 59
 		),
60 60
 	);
61 61
 
62
-	return array_merge( $tabs, $default_tabs );
62
+	return array_merge($tabs, $default_tabs);
63 63
 }
64 64
 
65
-add_filter( 'give_donor_tabs', 'give_register_default_donor_tabs', 1, 1 );
65
+add_filter('give_donor_tabs', 'give_register_default_donor_tabs', 1, 1);
66 66
 
67 67
 /**
68 68
  * Register the Delete icon as late as possible so it's at the bottom.
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
  *
74 74
  * @return array       The altered list of tabs, with 'delete' at the bottom.
75 75
  */
76
-function give_register_delete_donor_tab( $tabs ) {
76
+function give_register_delete_donor_tab($tabs) {
77 77
 
78 78
 	$tabs['delete'] = array(
79 79
 		'dashicon' => 'dashicons-trash',
80
-		'title' => esc_html__( 'Delete Donor', 'give' ),
80
+		'title' => esc_html__('Delete Donor', 'give'),
81 81
 	);
82 82
 
83 83
 	return $tabs;
84 84
 }
85 85
 
86
-add_filter( 'give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1 );
86
+add_filter('give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1);
Please login to merge, or discard this patch.