Test Failed
Push — release/1.8.12 ( b58a2f...d255b1 )
by Ravinder
375:09 queued 372:17
created

includes/admin/payments/view-payment-details.php (34 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * View Donation Details
4
 *
5
 * @package     Give
6
 * @subpackage  Admin/Payments
7
 * @copyright   Copyright (c) 2016, WordImpress
8
 * @license     https://opensource.org/licenses/gpl-license GNU Public License
9
 * @since       1.0
10
 */
11
12
// Exit if accessed directly.
13
if ( ! defined( 'ABSPATH' ) ) {
14
	exit;
15
}
16
17
/**
18
 * View Order Details Page
19
 *
20
 * @since 1.0
21
 * @return void
22
 */
23 View Code Duplication
if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
Detected usage of a non-sanitized input variable: $_GET
Loading history...
24
	wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
25
}
26
27
// Setup the variables
28
$payment_id = absint( $_GET['id'] );
0 ignored issues
show
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
29
$payment    = new Give_Payment( $payment_id );
30
31
// Sanity check... fail if donation ID is invalid
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 ) );
35
}
36
37
$number         = $payment->number;
38
$payment_meta   = $payment->get_meta();
39
$transaction_id = esc_attr( $payment->transaction_id );
40
$user_id        = $payment->user_id;
41
$donor_id       = $payment->customer_id;
42
$payment_date   = strtotime( $payment->date );
43
$user_info      = give_get_payment_meta_user_info( $payment_id );
44
$address        = $payment->address;
45
$currency_code  = $payment->currency;
46
$gateway        = $payment->gateway;
47
$currency_code  = $payment->currency;
48
$payment_mode   = $payment->mode;
49
?>
50
<div class="wrap give-wrap">
51
52
	<h1 id="transaction-details-heading"><?php
53
		printf(
54
			/* translators: %s: donation number */
55
			esc_html__( 'Donation %s', 'give' ),
56
			$number
57
		);
58
		if ( $payment_mode == 'test' ) {
0 ignored issues
show
Found "== '". Use Yoda Condition checks, you must
Loading history...
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
		}
61
		?></h1>
62
63
	<?php
64
	/**
65
	 * Fires in order details page, before the order form.
66
	 *
67
	 * @since 1.0
68
	 *
69
	 * @param int $payment_id Payment id.
70
	 */
71
	do_action( 'give_view_order_details_before', $payment_id );
72
	?>
73
	<form id="give-edit-order-form" method="post">
74
		<?php
75
		/**
76
		 * Fires in order details page, in the form before the order details.
77
		 *
78
		 * @since 1.0
79
		 *
80
		 * @param int $payment_id Payment id.
81
		 */
82
		do_action( 'give_view_order_details_form_top', $payment_id );
83
		?>
84
		<div id="poststuff">
85
			<div id="give-dashboard-widgets-wrap">
86
				<div id="post-body" class="metabox-holder columns-2">
87
					<div id="postbox-container-1" class="postbox-container">
88
						<div id="side-sortables" class="meta-box-sortables ui-sortable">
89
90
							<?php
91
							/**
92
							 * Fires in order details page, before the sidebar.
93
							 *
94
							 * @since 1.0
95
							 *
96
							 * @param int $payment_id Payment id.
97
							 */
98
							do_action( 'give_view_order_details_sidebar_before', $payment_id );
99
							?>
100
101
							<div id="give-order-update" class="postbox give-order-data">
102
103
								<h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3>
104
105
								<div class="inside">
106
									<div class="give-admin-box">
107
108
										<?php
109
										/**
110
										 * Fires in order details page, before the sidebar update-payment metabox.
111
										 *
112
										 * @since 1.0
113
										 *
114
										 * @param int $payment_id Payment id.
115
										 */
116
										do_action( 'give_view_order_details_totals_before', $payment_id );
117
										?>
118
119
										<div class="give-admin-box-inside">
120
											<p>
121
												<label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label>&nbsp;
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>
125
													<?php endforeach; ?>
126
												</select>
127
												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
128
											</p>
129
										</div>
130
131
										<div class="give-admin-box-inside">
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"/>
135
											</p>
136
										</div>
137
138
										<div class="give-admin-box-inside">
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"/>
143
											</p>
144
										</div>
145
146
										<?php
147
										/**
148
										 * Fires in order details page, in the sidebar update-payment metabox.
149
										 *
150
										 * Allows you to add new inner items.
151
										 *
152
										 * @since 1.0
153
										 *
154
										 * @param int $payment_id Payment id.
155
										 */
156
										do_action( 'give_view_order_details_update_inner', $payment_id ); ?>
157
158
										<div class="give-order-payment give-admin-box-inside">
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 ); ?>
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'give_currency_symbol'
Loading history...
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
											</p>
164
										</div>
165
166
										<?php
167
										/**
168
										 * Fires in order details page, after the sidebar update-donation metabox.
169
										 *
170
										 * @since 1.0
171
										 *
172
										 * @param int $payment_id Payment id.
173
										 */
174
										do_action( 'give_view_order_details_totals_after', $payment_id );
175
										?>
176
177
									</div>
178
									<!-- /.give-admin-box -->
179
180
								</div>
181
								<!-- /.inside -->
182
183
								<div class="give-order-update-box give-admin-box">
184
									<?php
185
									/**
186
									 * Fires in order details page, before the sidebar update-peyment metabox actions buttons.
187
									 *
188
									 * @since 1.0
189
									 *
190
									 * @param int $payment_id Payment id.
191
									 */
192
									do_action( 'give_view_order_details_update_before', $payment_id );
193
									?>
194
195
									<div id="major-publishing-actions">
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(
200
													'give-action' => 'email_links',
201
													'purchase_id' => $payment_id,
202
												) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a>
203
											<?php endif; ?>
204
										</div>
205
										<div class="clear"></div>
206
									</div>
207
208
									<?php
209
									/**
210
									 * Fires in order details page, after the sidebar update-peyment metabox actions buttons.
211
									 *
212
									 * @since 1.0
213
									 *
214
									 * @param int $payment_id Payment id.
215
									 */
216
									do_action( 'give_view_order_details_update_after', $payment_id );
217
									?>
218
219
								</div>
220
								<!-- /.give-order-update-box -->
221
222
							</div>
223
							<!-- /#give-order-data -->
224
225
							<div id="give-order-details" class="postbox give-order-data">
226
227
								<h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3>
228
229
								<div class="inside">
230
									<div class="give-admin-box">
231
232
										<?php
233
										/**
234
										 * Fires in order details page, before the donation-meta metabox.
235
										 *
236
										 * @since 1.0
237
										 *
238
										 * @param int $payment_id Payment id.
239
										 */
240
										do_action( 'give_view_order_details_payment_meta_before', $payment_id );
241
242
										$gateway = give_get_payment_gateway( $payment_id );
243
										if ( $gateway ) : ?>
244
											<div class="give-order-gateway give-admin-box-inside">
245
												<p>
246
													<strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong>&nbsp;
247
													<?php echo give_get_gateway_admin_label( $gateway ); ?>
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'give_get_gateway_admin_label'
Loading history...
248
												</p>
249
											</div>
250
										<?php endif; ?>
251
252
										<div class="give-order-payment-key give-admin-box-inside">
253
											<p>
254
												<strong><?php esc_html_e( 'Key:', 'give' ); ?></strong>&nbsp;
255
												<?php echo give_get_payment_key( $payment_id ); ?>
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'give_get_payment_key'
Loading history...
256
											</p>
257
										</div>
258
259
										<div class="give-order-ip give-admin-box-inside">
260
											<p>
261
												<strong><?php esc_html_e( 'IP:', 'give' ); ?></strong>&nbsp;
262
												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
263
											</p>
264
										</div>
265
266
										<?php if ( $transaction_id ) : ?>
267
											<div class="give-order-tx-id give-admin-box-inside">
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 ); ?>
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'apply_filters'
Loading history...
271
												</p>
272
											</div>
273
										<?php endif; ?>
274
275
										<div class="give-admin-box-inside">
276
											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?>
277
												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
0 ignored issues
show
Expected next thing to be a escaping function, not '$purchase_url'
Loading history...
278
											</p>
279
										</div>
280
281
										<?php
282
										/**
283
										 * Fires in order details page, after the donation-meta metabox.
284
										 *
285
										 * @since 1.0
286
										 *
287
										 * @param int $payment_id Payment id.
288
										 */
289
										do_action( 'give_view_order_details_payment_meta_after', $payment_id );
290
										?>
291
292
									</div>
293
									<!-- /.column-container -->
294
295
								</div>
296
								<!-- /.inside -->
297
298
							</div>
299
							<!-- /#give-order-data -->
300
301
							<?php
302
							/**
303
							 * Fires in order details page, after the sidebar.
304
							 *
305
							 * @since 1.0
306
							 *
307
							 * @param int $payment_id Payment id.
308
							 */
309
							do_action( 'give_view_order_details_sidebar_after', $payment_id );
310
							?>
311
312
						</div>
313
						<!-- /#side-sortables -->
314
					</div>
315
					<!-- /#postbox-container-1 -->
316
317
					<div id="postbox-container-2" class="postbox-container">
318
319
						<div id="normal-sortables" class="meta-box-sortables ui-sortable">
320
321
							<?php
322
							/**
323
							 * Fires in order details page, before the main area.
324
							 *
325
							 * @since 1.0
326
							 *
327
							 * @param int $payment_id Payment id.
328
							 */
329
							do_action( 'give_view_order_details_main_before', $payment_id );
330
							?>
331
332
							<?php $column_count = 'columns-3'; ?>
333
							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
0 ignored issues
show
Expected next thing to be a escaping function, not '$column_count'
Loading history...
334
								<h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3>
335
336
								<div class="inside">
337
338
									<div class="column-container">
339
										<div class="column">
340
											<p>
341
												<strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br>
342
												<?php
343
												if ( $payment_meta['form_id'] ) :
344
													printf(
345
														'<a href="%1$s" target="_blank">#%2$s</a>',
346
														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
347
														$payment_meta['form_id']
348
													);
349
												endif;
350
												?>
351
											</p>
352
											<p>
353
												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
354
												<?php echo Give()->html->forms_dropdown( array(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'Give'
Loading history...
355
													'selected' => $payment_meta['form_id'],
356
													'name'   => 'give-payment-form-select',
357
													'id'     => 'give-payment-form-select',
358
													'chosen' => true,
359
												) ); ?>
360
											</p>
361
										</div>
362
										<div class="column">
363
											<p>
364
												<strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br>
365
												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'date_i18n'
Loading history...
366
											</p>
367
											<p>
368
												<strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br>
369
												<span class="give-donation-level">
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' );
374
													} else {
375
														$prices_atts = '';
376 View Code Duplication
														if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Space after opening control structure is required
Loading history...
No space before opening parenthesis is prohibited
Loading history...
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 ) );
0 ignored issues
show
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
379
															}
380
														}
381
														// Variable price dropdown options.
382
														$variable_price_dropdown_option = array(
383
															'id'               => $payment_meta['form_id'],
384
															'name'             => 'give-variable-price',
385
															'chosen'           => true,
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 ) ),
389
															'selected'         => $payment_meta['price_id'],
390
														);
391
														// Render variable prices select tag html.
392
														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
393
													}
394
													?>
395
												</span>
396
											</p>
397
										</div>
398
										<div class="column">
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 ) ); ?>
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'give_currency_filter'
Loading history...
402
											</p>
403
											<p>
404
												<?php
405
												/**
406
												 * Fires in order details page, in the donation-information metabox, before the head elements.
407
												 *
408
												 * Allows you to add new TH elements at the beginning.
409
												 *
410
												 * @since 1.0
411
												 *
412
												 * @param int $payment_id Payment id.
413
												 */
414
												do_action( 'give_donation_details_thead_before', $payment_id );
415
416
417
												/**
418
												 * Fires in order details page, in the donation-information metabox, after the head elements.
419
												 *
420
												 * Allows you to add new TH elements at the end.
421
												 *
422
												 * @since 1.0
423
												 *
424
												 * @param int $payment_id Payment id.
425
												 */
426
												do_action( 'give_donation_details_thead_after', $payment_id );
427
428
												/**
429
												 * Fires in order details page, in the donation-information metabox, before the body elements.
430
												 *
431
												 * Allows you to add new TD elements at the beginning.
432
												 *
433
												 * @since 1.0
434
												 *
435
												 * @param int $payment_id Payment id.
436
												 */
437
												do_action( 'give_donation_details_tbody_before', $payment_id );
438
439
												/**
440
												 * Fires in order details page, in the donation-information metabox, after the body elements.
441
												 *
442
												 * Allows you to add new TD elements at the end.
443
												 *
444
												 * @since 1.0
445
												 *
446
												 * @param int $payment_id Payment id.
447
												 */
448
												do_action( 'give_donation_details_tbody_after', $payment_id );
449
												?>
450
											</p>
451
										</div>
452
									</div>
453
454
								</div>
455
								<!-- /.inside -->
456
457
							</div>
458
							<!-- /#give-donation-overview -->
459
460
							<?php
461
							/**
462
							 * Fires in order details page, after the files metabox.
463
							 *
464
							 * @since 1.0
465
							 *
466
							 * @param int $payment_id Payment id.
467
							 */
468
							do_action( 'give_view_order_details_files_after', $payment_id );
469
							?>
470
471
							<div id="give-donor-details" class="postbox">
472
								<h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3>
473
474
								<div class="inside">
475
476
									<?php $donor = new Give_Donor( $donor_id ); ?>
0 ignored issues
show
$donor_id is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
477
478
									<div class="column-container donor-info">
479
										<div class="column">
480
											<p>
481
												<strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
482
												<?php
483
												if ( ! empty( $donor->id ) ) {
484
													printf(
485
														'<a href="%1$s" target="_blank">#%2$s</a>',
486
														admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ),
487
														$donor->id
488
													);
489
												}
490
												?>
491
											</p>
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 ) ) ?>
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'date_i18n'
Loading history...
495
											</p>
496
										</div>
497
										<div class="column">
498
											<p>
499
												<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
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' );
503
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 ) ){
0 ignored issues
show
Space after opening control structure is required
Loading history...
No space before opening parenthesis is prohibited
Loading history...
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>)';
0 ignored issues
show
Expected next thing to be a escaping function, not '$donor_billing_name'
Loading history...
Expected next thing to be a escaping function, not '$donor_name'
Loading history...
507
                                                }else{
0 ignored issues
show
Space after opening control structure is required
Loading history...
No space before opening parenthesis is prohibited
Loading history...
508
                                                    echo $donor_name;
0 ignored issues
show
Expected next thing to be a escaping function, not '$donor_name'
Loading history...
509
                                                }
510
                                                ?>
511
											</p>
512
											<p>
513
												<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
514
												<?php echo $donor->email; ?>
0 ignored issues
show
Expected next thing to be a escaping function, not '$donor'
Loading history...
515
											</p>
516
										</div>
517
										<div class="column">
518
											<p>
519
												<strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
520
												<?php
521
												echo Give()->html->donor_dropdown( array(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'Give'
Loading history...
522
													'selected' => $donor->id,
523
													'name'     => 'donor-id',
524
												) );
525
												?>
526
											</p>
527
											<p>
528
												<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>
529
											</p>
530
										</div>
531
									</div>
532
533
									<div class="column-container new-donor" style="display: none">
534
										<div class="column">
535
											<p>
536
												<label for="give-new-donor-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label>
537
												<input id="give-new-donor-name" type="text" name="give-new-donor-name" value="" class="medium-text"/>
538
											</p>
539
										</div>
540
										<div class="column">
541
											<p>
542
												<label for="give-new-donor-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label>
543
												<input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/>
544
											</p>
545
										</div>
546
										<div class="column">
547
											<p>
548
												<input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/>
0 ignored issues
show
Expected next thing to be a escaping function, not '$donor'
Loading history...
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>
551
												<br>
552
												<em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
553
											</p>
554
										</div>
555
									</div>
556
557
									<?php
558
									/**
559
									 * Fires on the donation details page, in the donor-details metabox.
560
									 *
561
									 * The hook is left here for backwards compatibility.
562
									 *
563
									 * @since 1.7
564
									 *
565
									 * @param array $payment_meta Payment meta.
566
									 * @param array $user_info    User information.
567
									 */
568
									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
569
570
									/**
571
									 * Fires on the donation details page, in the donor-details metabox.
572
									 *
573
									 * @since 1.7
574
									 *
575
									 * @param int $payment_id Payment id.
576
									 */
577
									do_action( 'give_payment_view_details', $payment_id );
578
									?>
579
580
								</div>
581
								<!-- /.inside -->
582
							</div>
583
							<!-- /#give-donor-details -->
584
585
							<?php
586
							/**
587
							 * Fires in order details page, before the billing metabox.
588
							 *
589
							 * @since 1.0
590
							 *
591
							 * @param int $payment_id Payment id.
592
							 */
593
							do_action( 'give_view_order_details_billing_before', $payment_id );
594
							?>
595
596
							<div id="give-billing-details" class="postbox">
597
								<h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3>
598
599
								<div class="inside">
600
601
									<div id="give-order-address">
602
603
										<div class="order-data-address">
604
											<div class="data column-container">
605
												<div class="column">
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"/>
609
													</div>
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"/>
613
													</div>
614
												</div>
615
												<div class="column">
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"/>
619
													</div>
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"/>
623
624
													</div>
625
												</div>
626
												<div class="column">
627
													<div id="give-order-address-country-wrap">
628
														<label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label>
629
														<?php
630
														echo Give()->html->select( array(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'Give'
Loading history...
631
															'options'          => give_get_country_list(),
632
															'name'             => 'give-payment-address[0][country]',
633
															'selected'         => $address['country'],
634
															'show_option_all'  => false,
635
															'show_option_none' => false,
636
															'chosen'           => true,
637
															'placeholder'      => esc_attr__( 'Select a country', 'give' ),
638
															'data'             => array( 'search-type' => 'no_ajax' ),
639
														) );
640
														?>
641
													</div>
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>
644
														<?php
645
														$states = give_get_states( $address['country'] );
646
														if ( ! empty( $states ) ) {
647
															echo Give()->html->select( array(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'Give'
Loading history...
648
																'options'          => $states,
649
																'name'             => 'give-payment-address[0][state]',
650
																'selected'         => $address['state'],
651
																'show_option_all'  => false,
652
																'show_option_none' => false,
653
																'chosen'           => true,
654
																'placeholder'      => esc_attr__( 'Select a state', 'give' ),
655
																'data'             => array( 'search-type' => 'no_ajax' ),
656
															) );
657
														} else {
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"/>
660
															<?php
661
														} ?>
662
													</div>
663
												</div>
664
											</div>
665
										</div>
666
									</div>
667
									<!-- /#give-order-address -->
668
669
									<?php
670
									/**
671
									 * Fires in order details page, in the billing metabox, after all the fields.
672
									 *
673
									 * Allows you to insert new billing address fields.
674
									 *
675
									 * @since 1.7
676
									 *
677
									 * @param int $payment_id Payment id.
678
									 */
679
									do_action( 'give_payment_billing_details', $payment_id );
680
									?>
681
682
								</div>
683
								<!-- /.inside -->
684
							</div>
685
							<!-- /#give-billing-details -->
686
687
							<?php
688
							/**
689
							 * Fires in order details page, after the billing metabox.
690
							 *
691
							 * @since 1.0
692
							 *
693
							 * @param int $payment_id Payment id.
694
							 */
695
							do_action( 'give_view_order_details_billing_after', $payment_id );
696
							?>
697
698
							<div id="give-payment-notes" class="postbox">
699
								<h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3>
700
701
								<div class="inside">
702
									<div id="give-payment-notes-inner">
703
										<?php
704
										$notes = give_get_payment_notes( $payment_id );
705
										if ( ! empty( $notes ) ) {
706
											$no_notes_display = ' style="display:none;"';
707
											foreach ( $notes as $note ) :
708
709
												echo give_get_payment_note_html( $note, $payment_id );
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'give_get_payment_note_html'
Loading history...
710
711
											endforeach;
712
										} else {
713
											$no_notes_display = '';
714
										}
715
										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?>
0 ignored issues
show
Expected next thing to be a escaping function, not '$no_notes_display'
Loading history...
716
									</div>
717
									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
718
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>
721
									</div>
722
723
								</div>
724
								<!-- /.inside -->
725
							</div>
726
							<!-- /#give-payment-notes -->
727
728
							<?php
729
							/**
730
							 * Fires in order details page, after the main area.
731
							 *
732
							 * @since 1.0
733
							 *
734
							 * @param int $payment_id Payment id.
735
							 */
736
							do_action( 'give_view_order_details_main_after', $payment_id );
737
							?>
738
739
						</div>
740
						<!-- /#normal-sortables -->
741
					</div>
742
					<!-- #postbox-container-2 -->
743
				</div>
744
				<!-- /#post-body -->
745
			</div>
746
			<!-- #give-dashboard-widgets-wrap -->
747
		</div>
748
		<!-- /#post-stuff -->
749
750
		<?php
751
		/**
752
		 * Fires in order details page, in the form after the order details.
753
		 *
754
		 * @since 1.0
755
		 *
756
		 * @param int $payment_id Payment id.
757
		 */
758
		do_action( 'give_view_order_details_form_bottom', $payment_id );
759
760
		wp_nonce_field( 'give_update_payment_details_nonce' );
761
		?>
762
		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
763
		<input type="hidden" name="give_action" value="update_payment_details"/>
764
	</form>
765
	<?php
766
	/**
767
	 * Fires in order details page, after the order form.
768
	 *
769
	 * @since 1.0
770
	 *
771
	 * @param int $payment_id Payment id.
772
	 */
773
	do_action( 'give_view_order_details_after', $payment_id );
774
	?>
775
</div><!-- /.wrap -->
776