Issues (4335)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

includes/admin/payments/view-payment-details.php (39 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, GiveWP
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
if ( ! current_user_can( 'view_give_payments' ) ) {
18
	wp_die(
19
		__( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array(
20
			'response' => 403,
21
		)
22
	);
23
}
24
25
/**
26
 * View donation details page
27
 *
28
 * @since 1.0
29
 * @return void
30
 */
31
if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
0 ignored issues
show
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
Detected usage of a non-sanitized input variable: $_GET
Loading history...
32
	wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
33
}
34
35
// Setup the variables
36
$payment_id = absint( $_GET['id'] );
0 ignored issues
show
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
37
$payment    = new Give_Payment( $payment_id );
38
39
// Sanity check... fail if donation ID is invalid
40
$payment_exists = $payment->ID;
41 View Code Duplication
if ( empty( $payment_exists ) ) {
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...
42
	wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
43
}
44
45
$number       = $payment->number;
46
$payment_meta = $payment->get_meta();
47
48
$company_name   = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : '';
49
$transaction_id = esc_attr( $payment->transaction_id );
50
$user_id        = $payment->user_id;
51
$donor_id       = $payment->customer_id;
52
$payment_date   = strtotime( $payment->date );
53
$user_info      = give_get_payment_meta_user_info( $payment_id );
54
$address        = $payment->address;
55
$currency_code  = $payment->currency;
56
$gateway        = $payment->gateway;
57
$currency_code  = $payment->currency;
58
$payment_mode   = $payment->mode;
59
$base_url       = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
60
61
?>
62
<div class="wrap give-wrap">
63
64
	<h1 id="transaction-details-heading" class="wp-heading-inline">
65
		<?php
66
		printf(
67
		/* translators: %s: donation number */
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 8.
Loading history...
68
			esc_html__( 'Donation %s', 'give' ),
69
			$number
70
		);
71
		if ( $payment_mode == 'test' ) {
0 ignored issues
show
Found "== '". Use Yoda Condition checks, you must
Loading history...
72
			echo Give()->tooltips->render_span(array(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'Give'
Loading history...
73
				'label' => __( 'This donation was made in test mode.', 'give' ),
74
				'tag_content' => __( 'Test Donation', 'give' ),
75
				'position'=> 'right',
0 ignored issues
show
Expected 1 space before "=>"; 0 found
Loading history...
76
				'attributes' => array(
77
					'id' => 'test-payment-label',
78
					'class' => 'give-item-label give-item-label-orange'
79
				)
80
			));
81
		}
82
		?>
83
	</h1>
84
85
	<?php
86
	/**
87
	 * Fires in donation details page, before the page content and after the H1 title output.
88
	 *
89
	 * @since 1.0
90
	 *
91
	 * @param int $payment_id Payment id.
92
	 */
93
	do_action( 'give_view_donation_details_before', $payment_id );
94
	?>
95
96
	<hr class="wp-header-end">
97
98
	<form id="give-edit-order-form" method="post">
99
		<?php
100
		/**
101
		 * Fires in donation details page, in the form before the order details.
102
		 *
103
		 * @since 1.0
104
		 *
105
		 * @param int $payment_id Payment id.
106
		 */
107
		do_action( 'give_view_donation_details_form_top', $payment_id );
108
		?>
109
		<div id="poststuff">
110
			<div id="give-dashboard-widgets-wrap">
111
				<div id="post-body" class="metabox-holder columns-2">
112
					<div id="postbox-container-1" class="postbox-container">
113
						<div id="side-sortables" class="meta-box-sortables ui-sortable">
114
115
							<?php
116
							/**
117
							 * Fires in donation details page, before the sidebar.
118
							 *
119
							 * @since 1.0
120
							 *
121
							 * @param int $payment_id Payment id.
122
							 */
123
							do_action( 'give_view_donation_details_sidebar_before', $payment_id );
124
							?>
125
126
							<div id="give-order-update" class="postbox give-order-data">
127
128
								<div class="give-order-top">
129
									<h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3>
130
131
									<?php
132
									if ( current_user_can( 'view_give_payments' ) ) {
133
										echo sprintf(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'sprintf'
Loading history...
134
											'<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>',
135
											$payment_id,
136
											wp_nonce_url(
137
												add_query_arg(
138
													array(
139
														'give-action' => 'delete_payment',
140
														'purchase_id' => $payment_id,
141
													), $base_url
142
												), 'give_donation_nonce'
143
											),
144
											sprintf( __( 'Delete Donation %s', 'give' ), $payment_id )
145
										);
146
									}
147
									?>
148
								</div>
149
150
								<div class="inside">
151
									<div class="give-admin-box">
152
153
										<?php
154
										/**
155
										 * Fires in donation details page, before the sidebar update-payment metabox.
156
										 *
157
										 * @since 1.0
158
										 *
159
										 * @param int $payment_id Payment id.
160
										 */
161
										do_action( 'give_view_donation_details_totals_before', $payment_id );
162
										?>
163
164
										<div class="give-admin-box-inside">
165
											<p>
166
												<label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label>&nbsp;
167
												<select id="give-payment-status" name="give-payment-status" class="medium-text">
168
													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
169
														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
170
													<?php endforeach; ?>
171
												</select>
172
												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
173
											</p>
174
										</div>
175
176
										<div class="give-admin-box-inside">
177
											<?php $date_format = give_date_format(); ?>
178
											<p>
179
												<label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label>&nbsp;
180
												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( $date_format, $payment_date ) ); ?>" autocomplete="off" class="medium-text give_datepicker" placeholder="<?php _e( 'Date', 'give' ); ?>"/>
181
											</p>
182
										</div>
183
184
										<div class="give-admin-box-inside">
185
											<p>
186
												<label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label>&nbsp;
187
												<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;
188
												<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"/>
189
											</p>
190
										</div>
191
192
										<?php
193
										/**
194
										 * Fires in donation details page, in the sidebar update-payment metabox.
195
										 *
196
										 * Allows you to add new inner items.
197
										 *
198
										 * @since 1.0
199
										 *
200
										 * @param int $payment_id Payment id.
201
										 */
202
										do_action( 'give_view_donation_details_update_inner', $payment_id );
203
										?>
204
205
										<div class="give-order-payment give-admin-box-inside">
206
											<p>
207
												<label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label>&nbsp;
208
												<?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...
209
												&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( array( 'donation_id' => $payment_id ) ) ); ?>"/>
210
											</p>
211
										</div>
212
213
										<?php
214
										/**
215
										 * Fires in donation details page, after the sidebar update-donation metabox.
216
										 *
217
										 * @since 1.0
218
										 *
219
										 * @param int $payment_id Payment id.
220
										 */
221
										do_action( 'give_view_donation_details_totals_after', $payment_id );
222
										?>
223
224
									</div>
225
									<!-- /.give-admin-box -->
226
227
								</div>
228
								<!-- /.inside -->
229
230
								<div class="give-order-update-box give-admin-box">
231
									<?php
232
									/**
233
									 * Fires in donation details page, before the sidebar update-payment metabox actions buttons.
234
									 *
235
									 * @since 1.0
236
									 *
237
									 * @param int $payment_id Payment id.
238
									 */
239
									do_action( 'give_view_donation_details_update_before', $payment_id );
240
									?>
241
242
									<div id="major-publishing-actions">
243
										<div id="publishing-action">
244
											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
245
											<?php
246
											if ( give_is_payment_complete( $payment_id ) ) {
247
												$url = add_query_arg(
248
													array(
249
														'give-action' => 'email_links',
250
														'purchase_id' => $payment_id,
251
													),
252
													admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id )
253
												);
254
255
												echo sprintf(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'sprintf'
Loading history...
256
													'<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>',
257
													esc_url( $url ),
258
													esc_html__( 'Resend Receipt', 'give' )
259
												);
260
											}
261
											?>
262
										</div>
263
										<div class="clear"></div>
264
									</div>
265
									<?php
266
									/**
267
									 * Fires in donation details page, after the sidebar update-payment metabox actions buttons.
268
									 *
269
									 * @since 1.0
270
									 *
271
									 * @param int $payment_id Payment id.
272
									 */
273
									do_action( 'give_view_donation_details_update_after', $payment_id );
274
									?>
275
276
								</div>
277
								<!-- /.give-order-update-box -->
278
279
							</div>
280
							<!-- /#give-order-data -->
281
282
							<div id="give-order-details" class="postbox give-order-data">
283
284
								<h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3>
285
286
								<div class="inside">
287
									<div class="give-admin-box">
288
289
										<?php
290
										/**
291
										 * Fires in donation details page, before the donation-meta metabox.
292
										 *
293
										 * @since 1.0
294
										 *
295
										 * @param int $payment_id Payment id.
296
										 */
297
										do_action( 'give_view_donation_details_payment_meta_before', $payment_id );
298
299
										$gateway = give_get_payment_gateway( $payment_id );
300
										if ( $gateway ) :
301
											?>
302
											<div class="give-order-gateway give-admin-box-inside">
303
												<p>
304
													<strong><?php _e( 'Gateway:', 'give' ); ?></strong>&nbsp;
305
													<?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...
306
												</p>
307
											</div>
308
										<?php endif; ?>
309
310
										<div class="give-order-payment-key give-admin-box-inside">
311
											<p>
312
												<strong><?php _e( 'Key:', 'give' ); ?></strong>&nbsp;
313
												<?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...
314
											</p>
315
										</div>
316
317
										<div class="give-order-ip give-admin-box-inside">
318
											<p>
319
												<strong><?php _e( 'IP:', 'give' ); ?></strong>&nbsp;
320
												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
321
											</p>
322
										</div>
323
324
										<?php
325
										// Display the transaction ID present.
326
										// The transaction ID is the charge ID from the gateway.
327
										// For instance, stripe "ch_BzvwYCchqOy5Nt".
328
										if ( $transaction_id != $payment_id ) : ?>
329
											<div class="give-order-tx-id give-admin-box-inside">
330
												<p>
331
													<strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question"  data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong>&nbsp;
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'sprintf'
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
332
													<?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...
333
												</p>
334
											</div>
335
										<?php endif; ?>
336
337
										<?php
338
										/**
339
										 * Fires in donation details page, after the donation-meta metabox.
340
										 *
341
										 * @since 1.0
342
										 *
343
										 * @param int $payment_id Payment id.
344
										 */
345
										do_action( 'give_view_donation_details_payment_meta_after', $payment_id );
346
										?>
347
348
										<div class="give-admin-box-inside">
349
											<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 ) ) ); ?>
350
												<a href="<?php echo $purchase_url; ?>"><?php _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...
351
											</p>
352
										</div>
353
										
354
									</div>
355
									<!-- /.column-container -->
356
357
								</div>
358
								<!-- /.inside -->
359
360
							</div>
361
							<!-- /#give-order-data -->
362
363
							<?php
364
							/**
365
							 * Fires in donation details page, after the sidebar.
366
							 *
367
							 * @since 1.0
368
							 *
369
							 * @param int $payment_id Payment id.
370
							 */
371
							do_action( 'give_view_donation_details_sidebar_after', $payment_id );
372
							?>
373
374
						</div>
375
						<!-- /#side-sortables -->
376
					</div>
377
					<!-- /#postbox-container-1 -->
378
379
					<div id="postbox-container-2" class="postbox-container">
380
381
						<div id="normal-sortables" class="meta-box-sortables ui-sortable">
382
383
							<?php
384
							/**
385
							 * Fires in donation details page, before the main area.
386
							 *
387
							 * @since 1.0
388
							 *
389
							 * @param int $payment_id Payment id.
390
							 */
391
							do_action( 'give_view_donation_details_main_before', $payment_id );
392
							?>
393
394
							<?php $column_count = 'columns-3'; ?>
395
							<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...
396
								<h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3>
397
398
								<div class="inside">
399
400
									<div class="column-container">
401
										<div class="column">
402
											<p>
403
												<strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br>
404
												<?php
405
												if ( $payment->form_id ) :
406
													printf(
407
														'<a href="%1$s">%2$s</a>',
408
														admin_url( 'post.php?action=edit&post=' . $payment->form_id ),
409
														$payment->form_id
410
													);
411
												endif;
412
												?>
413
											</p>
414
											<p>
415
												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
416
												<?php
417
												echo Give()->html->forms_dropdown(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'Give'
Loading history...
418
													array(
419
														'selected' => $payment->form_id,
420
														'name' => 'give-payment-form-select',
421
														'id'   => 'give-payment-form-select',
422
														'chosen' => true,
423
														'placeholder' => '',
424
													)
425
												);
426
												?>
427
											</p>
428
										</div>
429
										<div class="column">
430
											<p>
431
												<strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br>
432
												<?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...
433
											</p>
434
											<p>
435
												<strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br>
436
												<span class="give-donation-level">
437
													<?php
438
													$var_prices = give_has_variable_prices( $payment->form_id );
439
													if ( empty( $var_prices ) ) {
440
														_e( 'n/a', 'give' );
441
													} else {
442
														$prices_atts = array();
443 View Code Duplication
														if ( $variable_prices = give_get_variable_prices( $payment->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...
444
															foreach ( $variable_prices as $variable_price ) {
445
																$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
446
															}
447
														}
448
														// Variable price dropdown options.
449
														$variable_price_dropdown_option = array(
450
															'id'               => $payment->form_id,
451
															'name'             => 'give-variable-price',
452
															'chosen'           => true,
453
															'show_option_all'  => '',
454
															'show_option_none' => ( '' === $payment->price_id ? __( 'None', 'give' ) : '' ),
455
															'select_atts'      => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ),
456
															'selected'         => $payment->price_id,
457
														);
458
														// Render variable prices select tag html.
459
														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
460
													}
461
													?>
462
												</span>
463
											</p>
464
										</div>
465
										<div class="column">
466
											<p>
467
												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
468
												<?php echo give_donation_amount( $payment, true ); ?>
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'give_donation_amount'
Loading history...
469
											</p>
470
471
											<?php if ( give_is_anonymous_donation_field_enabled( $payment->form_id ) ):  ?>
472
												<div>
473
													<strong><?php esc_html_e( 'Anonymous Donation:', 'give' ); ?></strong>
474
													<ul class="give-radio-inline">
475
														<li>
476
															<label>
477
																<input
478
																	name="give_anonymous_donation"
479
																	value="1"
480
																	type="radio"
481
																	<?php checked( 1, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?>
482
																><?php _e( 'Yes', 'give' ); ?>
483
															</label>
484
														</li>
485
														<li>
486
															<label>
487
																<input
488
																	name="give_anonymous_donation"
489
																	value="0"
490
																	type="radio"
491
																	<?php checked( 0, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?>
492
																><?php _e( 'No', 'give' ); ?>
493
															</label>
494
														</li>
495
													</ul>
496
												</div>
497
											<?php endif; ?>
498
											<p>
499
												<?php
500
												/**
501
												 * Fires in donation details page, in the donation-information metabox, before the head elements.
502
												 *
503
												 * Allows you to add new TH elements at the beginning.
504
												 *
505
												 * @since 1.0
506
												 *
507
												 * @param int $payment_id Payment id.
508
												 */
509
												do_action( 'give_donation_details_thead_before', $payment_id );
510
511
512
												/**
513
												 * Fires in donation details page, in the donation-information metabox, after the head elements.
514
												 *
515
												 * Allows you to add new TH elements at the end.
516
												 *
517
												 * @since 1.0
518
												 *
519
												 * @param int $payment_id Payment id.
520
												 */
521
												do_action( 'give_donation_details_thead_after', $payment_id );
522
523
												/**
524
												 * Fires in donation details page, in the donation-information metabox, before the body elements.
525
												 *
526
												 * Allows you to add new TD elements at the beginning.
527
												 *
528
												 * @since 1.0
529
												 *
530
												 * @param int $payment_id Payment id.
531
												 */
532
												do_action( 'give_donation_details_tbody_before', $payment_id );
533
534
												/**
535
												 * Fires in donation details page, in the donation-information metabox, after the body elements.
536
												 *
537
												 * Allows you to add new TD elements at the end.
538
												 *
539
												 * @since 1.0
540
												 *
541
												 * @param int $payment_id Payment id.
542
												 */
543
												do_action( 'give_donation_details_tbody_after', $payment_id );
544
												?>
545
											</p>
546
										</div>
547
									</div>
548
549
								</div>
550
								<!-- /.inside -->
551
552
							</div>
553
							<!-- /#give-donation-overview -->
554
555
							<?php
556
							/**
557
							 * Fires on the donation details page.
558
							 *
559
							 * @since 1.0
560
							 *
561
							 * @param int $payment_id Payment id.
562
							 */
563
							do_action( 'give_view_donation_details_donor_detail_before', $payment_id );
564
							?>
565
566
							<div id="give-donor-details" class="postbox">
567
								<h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3>
568
569
								<div class="inside">
570
571
									<?php $donor = new Give_Donor( $donor_id ); ?>
572
573
									<div class="column-container donor-info">
574
										<div class="column">
575
											<p>
576
												<strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
577
												<?php
578
												if ( ! empty( $donor->id ) ) {
579
													printf(
580
														'<a href="%1$s">%2$s</a>',
581
														esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ),
582
														intval( $donor->id )
583
													);
584
												}
585
												?>
586
												<span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>)</span>
587
											</p>
588
											<p>
589
												<strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br>
590
												<?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...
591
											</p>
592
										</div>
593
										<div class="column">
594
											<p>
595
												<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
596
												<?php
597
												$donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
598
												$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
599
600
												// Check whether the donor name and WP_User name is same or not.
601
												if ( $donor_billing_name !== $donor_name ) {
602
													echo sprintf(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'sprintf'
Loading history...
603
														'%1$s (<a href="%2$s" target="_blank">%3$s</a>)',
604
														esc_html( $donor_billing_name ),
605
														esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ),
606
														esc_html( $donor_name )
607
													);
608
												} else {
609
													echo esc_html( $donor_name );
610
												}
611
												?>
612
											</p>
613
											<p>
614
												<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
615
												<?php
616
												// Show Donor donation email first and Primary email on parenthesis if not match both email.
617
												echo hash_equals( $donor->email, $payment->email )
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'hash_equals'
Loading history...
618
													? $payment->email
619
													: sprintf(
620
														'%1$s (<a href="%2$s" target="_blank">%3$s</a>)',
621
														$payment->email,
622
														esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ),
623
														$donor->email
624
													);
625
												?>
626
											</p>
627
										</div>
628
										<div class="column">
629
											<p>
630
												<strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
631
												<?php
632
												echo Give()->html->donor_dropdown(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'Give'
Loading history...
633
													array(
634
														'selected' => $donor->id,
635
														'name' => 'donor-id',
636
													)
637
												);
638
												?>
639
											</p>
640
											<p>
641
												<?php if ( ! empty( $company_name ) ) {
642
													?>
643
													<strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br>
644
													<?php
645
													echo $company_name;
0 ignored issues
show
Expected next thing to be a escaping function, not '$company_name'
Loading history...
646
												} ?>
647
											</p>
648
										</div>
649
									</div>
650
651
									<div class="column-container new-donor" style="display: none">
652
										<div class="column">
653
											<p>
654
												<label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label>
655
												<input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/>
656
											</p>
657
										</div>
658
										<div class="column">
659
											<p>
660
												<label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label>
661
												<input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/>
662
											</p>
663
										</div>
664
										<div class="column">
665
											<p>
666
												<label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label>
667
												<input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/>
668
											</p>
669
										</div>
670
										<div class="column">
671
											<p>
672
												<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...
673
												<input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/>
674
												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a>
675
												<br>
676
												<em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
677
											</p>
678
										</div>
679
									</div>
680
									<?php
681
									/**
682
									 * Fires on the donation details page, in the donor-details metabox.
683
									 *
684
									 * The hook is left here for backwards compatibility.
685
									 *
686
									 * @since 1.7
687
									 *
688
									 * @param array $payment_meta Payment meta.
689
									 * @param array $user_info    User information.
690
									 */
691
									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
692
693
									/**
694
									 * Fires on the donation details page, in the donor-details metabox.
695
									 *
696
									 * @since 1.7
697
									 *
698
									 * @param int $payment_id Payment id.
699
									 */
700
									do_action( 'give_payment_view_details', $payment_id );
701
									?>
702
703
								</div>
704
								<!-- /.inside -->
705
							</div>
706
							<!-- /#give-donor-details -->
707
708
							<?php
709
							/**
710
							 * Fires on the donation details page, before the billing metabox.
711
							 *
712
							 * @since 1.0
713
							 *
714
							 * @param int $payment_id Payment id.
715
							 */
716
							do_action( 'give_view_donation_details_billing_before', $payment_id );
717
							?>
718
719
							<div id="give-billing-details" class="postbox">
720
								<h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3>
721
722
								<div class="inside">
723
724
									<div id="give-order-address">
725
726
										<div class="order-data-address">
727
											<div class="data column-container">
728
729
												<?php
730
												$address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() );
731
732
												$address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' );
733
734
												// Get the country list that does not have any states init.
735
												$no_states_country = give_no_states_country_list();
736
												?>
737
738
												<div class="row">
739
													<div id="give-order-address-country-wrap">
740
														<label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label>
741
														<?php
742
														echo Give()->html->select(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'Give'
Loading history...
743
															array(
744
																'options'          => give_get_country_list(),
745
																'name'             => 'give-payment-address[0][country]',
746
																'selected'         => $address['country'],
747
																'show_option_all'  => false,
748
																'show_option_none' => false,
749
																'chosen'           => true,
750
																'placeholder'      => esc_attr__( 'Select a country', 'give' ),
751
																'data'             => array( 'search-type' => 'no_ajax' ),
752
															)
753
														);
754
														?>
755
													</div>
756
												</div>
757
758
												<div class="row">
759
													<div class="give-wrap-address-line1">
760
														<label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label>
761
														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
762
													</div>
763
												</div>
764
765
												<div class="row">
766
													<div class="give-wrap-address-line2">
767
														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label>
768
														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
769
													</div>
770
												</div>
771
772
												<div class="row">
773
													<div class="give-wrap-address-city">
774
														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
775
														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
776
													</div>
777
												</div>
778
779
												<?php
780
												$state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false );
781
												?>
782
												<div class="row">
783
													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state">
0 ignored issues
show
Expected next thing to be a escaping function, not '('
Loading history...
784
														<div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>">
0 ignored issues
show
Expected next thing to be a escaping function, not '('
Loading history...
785
															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
786
															<?php
787
															$states = give_get_states( $address['country'] );
788
															if ( ! empty( $states ) ) {
789
																echo Give()->html->select(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'Give'
Loading history...
790
																	array(
791
																		'options'          => $states,
792
																		'name'             => 'give-payment-address[0][state]',
793
																		'selected'         => $address['state'],
794
																		'show_option_all'  => false,
795
																		'show_option_none' => false,
796
																		'chosen'           => true,
797
																		'placeholder'      => esc_attr__( 'Select a state', 'give' ),
798
																		'data'             => array( 'search-type' => 'no_ajax' ),
799
																	)
800
																);
801
															} else {
802
																?>
803
																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
804
																<?php
805
															}
806
															?>
807
														</div>
808
													</div>
809
810
													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip">
0 ignored issues
show
Expected next thing to be a escaping function, not '('
Loading history...
811
														<div class="give-wrap-address-zip">
812
															<label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label>
813
															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
814
														</div>
815
													</div>
816
												</div>
817
											</div>
818
										</div>
819
									</div>
820
									<!-- /#give-order-address -->
821
822
									<?php
823
									/**
824
									 * Fires in donation details page, in the billing metabox, after all the fields.
825
									 *
826
									 * Allows you to insert new billing address fields.
827
									 *
828
									 * @since 1.7
829
									 *
830
									 * @param int $payment_id Payment id.
831
									 */
832
									do_action( 'give_payment_billing_details', $payment_id );
833
									?>
834
835
								</div>
836
								<!-- /.inside -->
837
							</div>
838
							<!-- /#give-billing-details -->
839
840
							<?php
841
							/**
842
							 * Fires on the donation details page, after the billing metabox.
843
							 *
844
							 * @since 1.0
845
							 *
846
							 * @param int $payment_id Payment id.
847
							 */
848
							do_action( 'give_view_donation_details_billing_after', $payment_id );
849
							?>
850
851
							<div id="give-payment-notes" class="postbox">
852
								<h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3>
853
854
								<div class="inside">
855
									<div id="give-payment-notes-inner">
856
										<?php
857
										$notes = give_get_payment_notes( $payment_id );
858
										if ( ! empty( $notes ) ) {
859
											$no_notes_display = ' style="display:none;"';
860
											foreach ( $notes as $note ) :
861
862
												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...
863
864
											endforeach;
865
										} else {
866
											$no_notes_display = '';
867
										}
868
869
										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...
870
										?>
871
									</div>
872
									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
873
874
									<div class="give-clearfix">
875
										<p>
876
											<label for="donation_note_type" class="screen-reader-text"><?php _e( 'Note type', 'give' ); ?></label>
877
											<select name="donation_note_type" id="donation_note_type">
878
												<option value=""><?php _e( 'Private note', 'give' ); ?></option>
879
												<option value="donor"><?php _e( 'Note to donor', 'give' ); ?></option>
880
											</select>
881
											<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button>
882
										</p>
883
									</div>
884
885
								</div>
886
								<!-- /.inside -->
887
							</div>
888
							<!-- /#give-payment-notes -->
889
890
							<?php
891
							/**
892
							 * Fires on the donation details page, after the main area.
893
							 *
894
							 * @since 1.0
895
							 *
896
							 * @param int $payment_id Payment id.
897
							 */
898
							do_action( 'give_view_donation_details_main_after', $payment_id );
899
							?>
900
901
							<?php if ( give_is_donor_comment_field_enabled( $payment->form_id ) ) : ?>
902
								<div id="give-payment-donor-comment" class="postbox">
903
									<h3 class="hndle"><?php _e( 'Donor Comment', 'give' ); ?></h3>
904
905
									<div class="inside">
906
										<div id="give-payment-donor-comment-inner">
907
											<p>
908
												<?php
909
												$donor_comment = give_get_donor_donation_comment( $payment_id, $payment->donor_id );
910
911
												echo sprintf(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'sprintf'
Loading history...
912
													'<input type="hidden" name="give_comment_id" value="%s">',
913
													$donor_comment instanceof WP_Comment // Backward compatibility.
0 ignored issues
show
The class WP_Comment does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
914
														|| $donor_comment instanceof stdClass
915
															? $donor_comment->comment_ID : 0
916
												);
917
918
												echo sprintf(
0 ignored issues
show
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'sprintf'
Loading history...
919
													'<textarea name="give_comment" id="give_comment" placeholder="%s" class="large-text">%s</textarea>',
920
													__( 'Add a comment', 'give' ),
921
													$donor_comment instanceof WP_Comment // Backward compatibility.
0 ignored issues
show
The class WP_Comment does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
922
													|| $donor_comment instanceof stdClass
923
														? $donor_comment->comment_content : ''
924
												);
925
												?>
926
											</p>
927
										</div>
928
929
									</div>
930
									<!-- /.inside -->
931
								</div>
932
							<?php endif; ?>
933
							<!-- /#give-payment-notes -->
934
935
							<?php
936
							/**
937
							 * Fires on the donation details page, after the main area.
938
							 *
939
							 * @since 1.0
940
							 *
941
							 * @param int $payment_id Payment id.
942
							 */
943
							do_action( 'give_view_donation_details_main_after', $payment_id );
944
							?>
945
946
						</div>
947
						<!-- /#normal-sortables -->
948
					</div>
949
					<!-- #postbox-container-2 -->
950
				</div>
951
				<!-- /#post-body -->
952
			</div>
953
			<!-- #give-dashboard-widgets-wrap -->
954
		</div>
955
		<!-- /#post-stuff -->
956
957
		<?php
958
		/**
959
		 * Fires in donation details page, in the form after the order details.
960
		 *
961
		 * @since 1.0
962
		 *
963
		 * @param int $payment_id Payment id.
964
		 */
965
		do_action( 'give_view_donation_details_form_bottom', $payment_id );
966
967
		wp_nonce_field( 'give_update_payment_details_nonce' );
968
		?>
969
		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
970
		<input type="hidden" name="give_action" value="update_payment_details"/>
971
	</form>
972
	<?php
973
	/**
974
	 * Fires in donation details page, after the order form.
975
	 *
976
	 * @since 1.0
977
	 *
978
	 * @param int $payment_id Payment id.
979
	 */
980
	do_action( 'give_view_donation_details_after', $payment_id );
981
	?>
982
</div><!-- /.wrap -->
983