PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 2.0.2
GiveWP – Donation Plugin and Fundraising Platform v2.0.2
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 2.31.0 2.31.1 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / templates / shortcode-receipt.php
give / templates Last commit date
emails 8 years ago global 9 years ago single-give-form 9 years ago email-login-form.php 8 years ago give-rtl.css 8 years ago give-rtl.min.css 8 years ago give.css 8 years ago give.min.css 8 years ago history-donations.php 8 years ago payment-processing.php 9 years ago shortcode-goal.php 8 years ago shortcode-login.php 8 years ago shortcode-profile-editor.php 8 years ago shortcode-receipt.php 8 years ago shortcode-register.php 9 years ago single-give-form.php 9 years ago
shortcode-receipt.php
303 lines
1 <?php
2 /**
3 * This template is used to display the donation summary with [give_receipt]
4 */
5
6 global $give_receipt_args, $payment;
7
8 // Validation: Ensure $payment var is set.
9 if ( empty( $payment ) ) {
10 $payment = ! empty( $give_receipt_args['id'] ) ? get_post( $give_receipt_args['id'] ) : 0;
11 }
12
13 // Double-Validation: Check for $payment global.
14 if ( empty( $payment ) ) {
15 Give()->notices->print_frontend_notice( __( 'The specified receipt ID appears to be invalid.', 'give' ) );
16
17 return;
18 }
19
20 $donation_id = $payment->ID;
21 $form_id = give_get_payment_meta( $donation_id, '_give_payment_form_id', true );
22 $meta = give_get_payment_meta( $donation_id );
23 $donation = give_get_donation_form_title( $donation_id );
24 $user = give_get_payment_meta_user_info( $donation_id );
25 $email = give_get_payment_user_email( $donation_id );
26 $status = $payment->post_status;
27 $status_label = give_get_payment_status( $payment, true );
28
29 /**
30 * Generate Donation Receipt Arguments.
31 *
32 * Added donation receipt array to global variable $give_receipt_args to
33 * manage it from single variable
34 *
35 * @since 1.8.8
36 */
37 $give_receipt_args['donation_receipt']['donor'] = array(
38 'name' => __( 'Donor', 'give' ),
39 'value' => $user['first_name'] . ' ' . $user['last_name'],
40 'display' => $give_receipt_args['donor'],
41 );
42
43 $give_receipt_args['donation_receipt']['date'] = array(
44 'name' => __( 'Date', 'give' ),
45 'value' => date_i18n( give_date_format(), strtotime( $meta['date'] ) ),
46 'display' => $give_receipt_args['date'],
47 );
48
49 $give_receipt_args['donation_receipt']['total_donation'] = array(
50 'name' => __( 'Total Donation', 'give' ),
51 'value' => give_donation_amount( $donation_id, array( 'currency' => true, 'amount' => true, 'type' => 'receipt' ) ),
52 'display' => $give_receipt_args['price'],
53 );
54
55 $give_receipt_args['donation_receipt']['donation'] = array(
56 'name' => __( 'Donation', 'give' ),
57 'value' => $donation,
58 'display' => true,
59 );
60
61 $give_receipt_args['donation_receipt']['donation_status'] = array(
62 'name' => __( 'Donation Status', 'give' ),
63 'value' => esc_attr( $status_label ),
64 'display' => $give_receipt_args['payment_status'],
65 );
66
67 $give_receipt_args['donation_receipt']['donation_id'] = array(
68 'name' => __( 'Donation ID', 'give' ),
69 'value' => $donation_id,
70 'display' => $give_receipt_args['payment_id'],
71 );
72
73 $give_receipt_args['donation_receipt']['payment_key'] = array(
74 'name' => __( 'Payment Key', 'give' ),
75 'value' => get_post_meta( $donation_id, '_give_payment_purchase_key', true ),
76 'display' => $give_receipt_args['payment_key'],
77 );
78
79 $give_receipt_args['donation_receipt']['payment_method'] = array(
80 'name' => __( 'Payment Method', 'give' ),
81 'value' => give_get_gateway_checkout_label( give_get_payment_gateway( $donation_id ) ),
82 'display' => $give_receipt_args['payment_method'],
83 );
84
85 /**
86 * Extend Give Donation Receipt
87 *
88 * You can easily extend the donation receipt argument using the filter give_donation_receipt_args
89 *
90 * @params array $give_receipt_args['donation_receipt'] Array of arguments for Donation Receipt.
91 * @params int $donation_id Donation ID.
92 * @params int $form_id Donation Form ID.
93 *
94 * @since 1.8.8
95 */
96 $give_receipt_args['donation_receipt'] = apply_filters( 'give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id );
97
98 // When the donation were made through offline donation, We won't show receipt and payment status though.
99 if ( 'offline' === give_get_payment_gateway( $payment->ID ) && 'pending' === $status ) {
100
101 /**
102 * Before the offline donation receipt content starts.
103 *
104 * @since 1.8.14
105 *
106 * @param Give_Payment $payment Donation payment object.
107 * @param array $give_receipt_args Receipt Arguments.
108 */
109 do_action( 'give_receipt_before_offline_payment', $payment, $give_receipt_args );
110 ?>
111 <h2><?php echo apply_filters( 'give_receipt_offline_payment_heading', __( 'Your Donation is Almost Complete!', 'give' ) ); ?></h2>
112 <div id="give_donation_receipt" class="<?php echo esc_attr( apply_filters( 'give_receipt_offline_payment_classes', 'give_receipt_offline_payment' ) ); ?>">
113 <?php
114 // Instruction for offline donation.
115 $offline_instruction = give_get_offline_payment_instruction( $form_id, true );
116
117 /**
118 * Instruction for the offline donation.
119 *
120 * @since 1.8.14
121 *
122 * @param string $offline_instruction Offline instruction content.
123 * @param Give_Payment $payment Payment object.
124 * @param integer $form_id Donation form id.
125 */
126 echo apply_filters( 'give_receipt_offline_payment_instruction', $offline_instruction, $payment, $form_id );
127 ?>
128 </div>
129 <?php
130 /**
131 * After the offline donation content ends.
132 *
133 * @since 1.8.14
134 *
135 * @param Give_Payment $payment Donation payment object.
136 * @param array $give_receipt_args Receipt Arguments.
137 */
138 do_action( 'give_receipt_after_offline_payment', $payment, $give_receipt_args );
139
140 return;
141 }
142
143 // Show payment status notice based on shortcode attribute.
144 if ( filter_var( $give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN ) ) {
145 $notice_message = '';
146 $notice_type = 'warning';
147
148 switch ( $status ) {
149 case 'publish':
150 $notice_message = __( 'Payment Complete: Thank you for your donation.', 'give' );
151 $notice_type = 'success';
152 break;
153 case 'pending':
154 $notice_message = __( 'Payment Pending: Your donation is currently processing.', 'give' );
155 $notice_type = 'warning';
156 break;
157 case 'refunded':
158 $notice_message = __( 'Payment Refunded: Your donation has been refunded.', 'give' );
159 $notice_type = 'warning';
160 break;
161 case 'preapproval':
162 $notice_message = __( 'Payment Preapproved: Thank you for your donation.', 'give' );
163 $notice_type = 'warning';
164 break;
165 case 'failed':
166 $notice_message = __( 'Payment Failed: Please contact the site owner for assistance.', 'give' );
167 $notice_type = 'error';
168 break;
169 case 'cancelled':
170 $notice_message = __( 'Payment Cancelled: Your donation has been cancelled.', 'give' );
171 $notice_type = 'error';
172 break;
173 case 'abandoned':
174 $notice_message = __( 'Payment Abandoned: This donation has not been completed.', 'give' );
175 $notice_type = 'error';
176 break;
177 case 'revoked':
178 $notice_message = __( 'Payment Revoked: Please contact the site owner for assistance.', 'give' );
179 $notice_type = 'error';
180 break;
181 }
182
183 if ( ! empty( $notice_message ) ) {
184 /**
185 * Filters payment status notice for receipts.
186 *
187 * By default, a success, warning, or error notice appears on the receipt
188 * with payment status. This filter allows the HTML markup
189 * and messaging for that notice to be customized.
190 *
191 * @since 1.0
192 *
193 * @param string $notice HTML markup for the default notice.
194 * @param int $id Post ID where the notice is displayed.
195 * @param string $status Payment status.
196 * @param array $meta Array of meta data related to the payment.
197 */
198 echo apply_filters( 'give_receipt_status_notice', Give()->notices->print_frontend_notice( $notice_message, false, $notice_type ), $id, $status, $meta );
199 }
200 }// End if().
201
202 /**
203 * Fires in the payment receipt shortcode, before the receipt main table.
204 *
205 * Allows you to add elements before the table.
206 *
207 * @since 1.0
208 *
209 * @param object $payment The payment object.
210 * @param array $give_receipt_args Receipt_argument.
211 */
212 do_action( 'give_payment_receipt_before_table', $payment, $give_receipt_args );
213 ?>
214
215 <table id="give_donation_receipt" class="give-table">
216 <thead>
217 <?php
218 /**
219 * Fires in the payment receipt shortcode, before the receipt first header item.
220 *
221 * Allows you to add new <th> elements before the receipt first header item.
222 *
223 * @since 1.7
224 *
225 * @param object $payment The payment object.
226 * @param array $give_receipt_args Receipt_argument.
227 */
228 do_action( 'give_payment_receipt_header_before', $payment, $give_receipt_args );
229 ?>
230 <tr>
231 <th scope="colgroup" colspan="2">
232 <span class="give-receipt-thead-text"><?php esc_html_e( 'Donation Receipt', 'give' ) ?></span>
233 </th>
234 </tr>
235 <?php
236 /**
237 * Fires in the payment receipt shortcode, after the receipt last header item.
238 *
239 * Allows you to add new <th> elements after the receipt last header item.
240 *
241 * @since 1.7
242 *
243 * @param object $payment The payment object.
244 * @param array $give_receipt_args Receipt_argument.
245 */
246 do_action( 'give_payment_receipt_header_after', $payment, $give_receipt_args );
247 ?>
248 </thead>
249
250 <tbody>
251 <?php
252 /**
253 * Fires in the payment receipt shortcode, before the receipt first item.
254 *
255 * Allows you to add new <td> elements before the receipt first item.
256 *
257 * @since 1.7
258 *
259 * @param object $payment The payment object.
260 * @param array $give_receipt_args Receipt_argument.
261 */
262 do_action( 'give_payment_receipt_before', $payment, $give_receipt_args );
263 ?>
264
265 <?php foreach ( $give_receipt_args['donation_receipt'] as $receipt_item ) { ?>
266 <?php if ( filter_var( $receipt_item['display'], FILTER_VALIDATE_BOOLEAN ) ) : ?>
267 <tr>
268 <td scope="row"><strong><?php echo $receipt_item['name']; ?></strong></td>
269 <td><?php echo $receipt_item['value']; ?></td>
270 </tr>
271 <?php endif; ?>
272 <?php } ?>
273
274 <?php
275 /**
276 * Fires in the payment receipt shortcode, after the receipt last item.
277 *
278 * Allows you to add new <td> elements after the receipt last item.
279 *
280 * @since 1.7
281 *
282 * @param object $payment The payment object.
283 * @param array $give_receipt_args Receipt_argument.
284 */
285 do_action( 'give_payment_receipt_after', $payment, $give_receipt_args );
286 ?>
287 </tbody>
288 </table>
289
290 <?php
291 /**
292 * Fires in the payment receipt shortcode, after the receipt main table.
293 *
294 * Allows you to add elements after the table.
295 *
296 * @since 1.7
297 *
298 * @param object $payment The payment object.
299 * @param array $give_receipt_args Receipt_argument.
300 */
301 do_action( 'give_payment_receipt_after_table', $payment, $give_receipt_args );
302 ?>
303