PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
← All changes | templates/shortcode-receipt.php +38 -25 2.3.14.16.9 View file →
@@ -2,8 +2,10 @@
2 2 /**
3 3 * This template is used to display the donation summary with [give_receipt]
4 4 */
5 5
6 +use Give\Helpers\Frontend\Shortcode as ShortcodeUtils;
7 +
6 8 global $give_receipt_args, $donation;
7 9
8 10 // Validation: Ensure $donation var is set.
9 11 if ( empty( $donation ) ) {
@@ -9,11 +11,15 @@
9 11 if ( empty( $donation ) ) {
10 12 $donation = ! empty( $give_receipt_args['id'] ) ? get_post( $give_receipt_args['id'] ) : 0;
11 13 }
12 14
13 -// Double-Validation: Check for $donation global.
14 -if ( empty( $donation ) ) {
15 - Give()->notices->print_frontend_notice( __( 'The specified receipt ID appears to be invalid.', 'give' ) );
15 +/**
16 + * Double-Validation: Check for $donation global.
17 + *
18 + * @since 3.4.0 Add additional validations to check if the form is valid and has the 'published' status.
19 + */
20 +if ( ! is_object($donation) || ! ShortcodeUtils::isValidDonation($donation->ID)) {
21 + Give_Notices::print_frontend_notice( __( 'The specified receipt ID appears to be invalid.', 'give' ) );
16 22 return;
17 23 }
18 24
19 25 $donation_id = $donation->ID;
@@ -26,9 +32,9 @@
26 32 $status_label = give_get_payment_status( $donation_id, true );
27 33 $company_name = give_get_payment_meta( $donation_id, '_give_donation_company', true );
28 34
29 35 // Update donor name, if title prefix is set.
30 -$full_name = give_get_donor_name_with_title_prefixes( $user['title'], "{$user['first_name']} {$user['last_name']}" );
36 +$full_name = give_get_donor_name_with_title_prefixes( $user['title'], "{$user['first_name']} {$user['last_name']}" );
31 37
32 38 /**
33 39 * Generate Donation Receipt Arguments.
34 40 *
@@ -36,13 +42,13 @@
36 42 * manage it from single variable
37 43 *
38 44 * @since 1.8.8
39 45 */
40 -$give_receipt_args['donation_receipt']['donor'] = array(
46 +$give_receipt_args['donation_receipt']['donor'] = [
41 47 'name' => __( 'Donor', 'give' ),
42 - 'value' => $full_name,
48 + 'value' => esc_html( give_strip_shortcodes_deep( $full_name ) ),
43 49 'display' => $give_receipt_args['donor'],
44 -);
50 +];
45 51
46 52 /**
47 53 * Show Company name on Donation receipt Page
48 54 *
@@ -51,50 +57,57 @@
51 57 * @param bool show/hide company name in donation receipt page.
52 58 *
53 59 * @return bool show/hide company name in donation receipt page.
54 60 */
55 -$give_receipt_args['donation_receipt']['company_name'] = array(
61 +$give_receipt_args['donation_receipt']['company_name'] = [
56 62 'name' => __( 'Company Name', 'give' ),
57 - 'value' => esc_attr( $company_name ),
63 + 'value' => esc_html( give_strip_shortcodes_deep( $company_name ) ),
58 64 // Do not show company field if empty
59 65 'display' => empty( $company_name ) ? false : $give_receipt_args['company_name'],
60 -);
66 +];
61 67
62 -$give_receipt_args['donation_receipt']['date'] = array(
68 +$give_receipt_args['donation_receipt']['date'] = [
63 69 'name' => __( 'Date', 'give' ),
64 70 'value' => date_i18n( give_date_format(), strtotime( give_get_payment_completed_date( $donation_id ) ) ),
65 71 'display' => $give_receipt_args['date'],
66 -);
72 +];
67 73
68 -$give_receipt_args['donation_receipt']['total_donation'] = array(
74 +$give_receipt_args['donation_receipt']['total_donation'] = [
69 75 'name' => __( 'Total Donation', 'give' ),
70 - 'value' => give_donation_amount( $donation_id, array( 'currency' => true, 'amount' => true, 'type' => 'receipt' ) ),
76 + 'value' => give_donation_amount(
77 + $donation_id,
78 + [
79 + 'currency' => true,
80 + 'amount' => true,
81 + 'type' => 'receipt',
82 + ]
83 + ),
71 84 'display' => $give_receipt_args['price'],
72 -);
85 +];
73 86
74 -$give_receipt_args['donation_receipt']['donation'] = array(
87 +$give_receipt_args['donation_receipt']['donation'] = [
75 88 'name' => __( 'Donation', 'give' ),
76 89 'value' => $form_name,
77 90 'display' => true,
78 -);
91 +];
79 92
80 -$give_receipt_args['donation_receipt']['donation_status'] = array(
93 +$give_receipt_args['donation_receipt']['donation_status'] = [
81 94 'name' => __( 'Donation Status', 'give' ),
82 95 'value' => esc_attr( $status_label ),
83 96 'display' => $give_receipt_args['payment_status'],
84 -);
97 +];
85 98
86 -$give_receipt_args['donation_receipt']['donation_id'] = array(
99 +$give_receipt_args['donation_receipt']['donation_id'] = [
87 100 'name' => __( 'Donation ID', 'give' ),
88 101 'value' => $donation_number,
89 102 'display' => $give_receipt_args['payment_id'],
90 -);
103 +];
91 104
92 -$give_receipt_args['donation_receipt']['payment_method'] = array(
105 +$give_receipt_args['donation_receipt']['payment_method'] = [
93 106 'name' => __( 'Payment Method', 'give' ),
94 107 'value' => give_get_gateway_checkout_label( give_get_payment_gateway( $donation_id ) ),
95 108 'display' => $give_receipt_args['payment_method'],
96 -);
109 +];
97 110
98 111 /**
99 112 * Extend Give Donation Receipt
100 113 *
@@ -206,9 +219,9 @@
206 219 * @param int $id Post ID where the notice is displayed.
207 220 * @param string $status Payment status.
208 221 * @param int $donation_id Donation ID.
209 222 */
210 - echo apply_filters( 'give_receipt_status_notice', Give()->notices->print_frontend_notice( $notice_message, false, $notice_type ), $id, $status, $donation_id );
223 + echo apply_filters( 'give_receipt_status_notice', Give_Notices::print_frontend_notice( $notice_message, false, $notice_type ), $id, $status, $donation_id );
211 224
212 225 }// End if().
213 226
214 227 /**
@@ -240,9 +253,9 @@
240 253 do_action( 'give_payment_receipt_header_before', $donation, $give_receipt_args );
241 254 ?>
242 255 <tr>
243 256 <th scope="colgroup" colspan="2">
244 - <span class="give-receipt-thead-text"><?php esc_html_e( 'Donation Receipt', 'give' ) ?></span>
257 + <span class="give-receipt-thead-text"><?php esc_html_e( 'Donation Receipt', 'give' ); ?></span>
245 258 </th>
246 259 </tr>
247 260 <?php
248 261 /**