PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 1.9.0
GiveWP – Donation Plugin and Fundraising Platform v1.9.0
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 6 years ago global 6 years ago receipt 7 years ago single-give-form 6 years ago email-login-form.php 6 years ago history-donations.php 6 years ago payment-processing.php 6 years ago shortcode-donor-wall.php 5 years ago shortcode-form-grid.php 6 years ago shortcode-goal.php 6 years ago shortcode-login.php 6 years ago shortcode-profile-editor.php 6 years ago shortcode-receipt.php 5 years ago shortcode-register.php 8 years ago shortcode-totals-progress.php 6 years ago single-give-form.php 6 years ago
shortcode-receipt.php
322 lines
1 <?php
2 /**
3 * This template is used to display the donation summary with [give_receipt]
4 */
5
6 global $give_receipt_args, $donation;
7
8 // Validation: Ensure $donation var is set.
9 if ( empty( $donation ) ) {
10 $donation = ! empty( $give_receipt_args['id'] ) ? get_post( $give_receipt_args['id'] ) : 0;
11 }
12
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' ) );
16 return;
17 }
18
19 $donation_id = $donation->ID;
20 $donation_number = Give()->seq_donation_number->get_serial_code( $donation_id );
21 $form_id = give_get_payment_meta( $donation_id, '_give_payment_form_id', true );
22 $form_name = give_get_donation_form_title( $donation_id );
23 $user = give_get_payment_meta_user_info( $donation_id );
24 $email = give_get_payment_user_email( $donation_id );
25 $status = $donation->post_status;
26 $status_label = give_get_payment_status( $donation_id, true );
27 $company_name = give_get_payment_meta( $donation_id, '_give_donation_company', true );
28
29 // 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']}" );
31
32 /**
33 * Generate Donation Receipt Arguments.
34 *
35 * Added donation receipt array to global variable $give_receipt_args to
36 * manage it from single variable
37 *
38 * @since 1.8.8
39 */
40 $give_receipt_args['donation_receipt']['donor'] = [
41 'name' => __( 'Donor', 'give' ),
42 'value' => $full_name,
43 'display' => $give_receipt_args['donor'],
44 ];
45
46 /**
47 * Show Company name on Donation receipt Page
48 *
49 * @since 2.0.7
50 *
51 * @param bool show/hide company name in donation receipt page.
52 *
53 * @return bool show/hide company name in donation receipt page.
54 */
55 $give_receipt_args['donation_receipt']['company_name'] = [
56 'name' => __( 'Company Name', 'give' ),
57 'value' => esc_attr( $company_name ),
58 // Do not show company field if empty
59 'display' => empty( $company_name ) ? false : $give_receipt_args['company_name'],
60 ];
61
62 $give_receipt_args['donation_receipt']['date'] = [
63 'name' => __( 'Date', 'give' ),
64 'value' => date_i18n( give_date_format(), strtotime( give_get_payment_completed_date( $donation_id ) ) ),
65 'display' => $give_receipt_args['date'],
66 ];
67
68 $give_receipt_args['donation_receipt']['total_donation'] = [
69 'name' => __( 'Total Donation', 'give' ),
70 'value' => give_donation_amount(
71 $donation_id,
72 [
73 'currency' => true,
74 'amount' => true,
75 'type' => 'receipt',
76 ]
77 ),
78 'display' => $give_receipt_args['price'],
79 ];
80
81 $give_receipt_args['donation_receipt']['donation'] = [
82 'name' => __( 'Donation', 'give' ),
83 'value' => $form_name,
84 'display' => true,
85 ];
86
87 $give_receipt_args['donation_receipt']['donation_status'] = [
88 'name' => __( 'Donation Status', 'give' ),
89 'value' => esc_attr( $status_label ),
90 'display' => $give_receipt_args['payment_status'],
91 ];
92
93 $give_receipt_args['donation_receipt']['donation_id'] = [
94 'name' => __( 'Donation ID', 'give' ),
95 'value' => $donation_number,
96 'display' => $give_receipt_args['payment_id'],
97 ];
98
99 $give_receipt_args['donation_receipt']['payment_method'] = [
100 'name' => __( 'Payment Method', 'give' ),
101 'value' => give_get_gateway_checkout_label( give_get_payment_gateway( $donation_id ) ),
102 'display' => $give_receipt_args['payment_method'],
103 ];
104
105 /**
106 * Extend Give Donation Receipt
107 *
108 * You can easily extend the donation receipt argument using the filter give_donation_receipt_args
109 *
110 * @params array $give_receipt_args['donation_receipt'] Array of arguments for Donation Receipt.
111 * @params int $donation_id Donation ID.
112 * @params int $form_id Donation Form ID.
113 *
114 * @since 1.8.8
115 */
116 $give_receipt_args['donation_receipt'] = apply_filters( 'give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id );
117
118 // When the donation were made through offline donation, We won't show receipt and payment status though.
119 if ( 'offline' === give_get_payment_gateway( $donation_id ) && 'pending' === $status ) {
120
121 /**
122 * Before the offline donation receipt content starts.
123 *
124 * @since 1.8.14
125 *
126 * @param Give_Payment $donation Donation object.
127 * @param array $give_receipt_args Receipt Arguments.
128 */
129 do_action( 'give_receipt_before_offline_payment', $donation, $give_receipt_args );
130 ?>
131 <h2><?php echo apply_filters( 'give_receipt_offline_payment_heading', __( 'Your Donation is Almost Complete!', 'give' ) ); ?></h2>
132 <div id="give_donation_receipt" class="<?php echo esc_attr( apply_filters( 'give_receipt_offline_payment_classes', 'give_receipt_offline_payment' ) ); ?>">
133 <?php
134 // Instruction for offline donation.
135 $offline_instruction = give_get_offline_payment_instruction( $form_id, true );
136
137 /**
138 * Instruction for the offline donation.
139 *
140 * @since 1.8.14
141 *
142 * @param string $offline_instruction Offline instruction content.
143 * @param Give_Payment $donation Donation object.
144 * @param integer $form_id Donation form id.
145 */
146 echo apply_filters( 'give_receipt_offline_payment_instruction', $offline_instruction, $donation, $form_id );
147 ?>
148 </div>
149 <?php
150 /**
151 * After the offline donation content ends.
152 *
153 * @since 1.8.14
154 *
155 * @param Give_Payment $donation Donation object.
156 * @param array $give_receipt_args Receipt Arguments.
157 */
158 do_action( 'give_receipt_after_offline_payment', $donation, $give_receipt_args );
159
160 return;
161 }
162
163 // Show payment status notice based on shortcode attribute.
164 if ( filter_var( $give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN ) ) {
165 $notice_message = '';
166 $notice_type = 'warning';
167
168 switch ( $status ) {
169 case 'publish':
170 $notice_message = __( 'Payment Complete: Thank you for your donation.', 'give' );
171 $notice_type = 'success';
172 break;
173 case 'pending':
174 $notice_message = __( 'Payment Pending: Your donation is currently processing.', 'give' );
175 $notice_type = 'warning';
176 break;
177 case 'refunded':
178 $notice_message = __( 'Payment Refunded: Your donation has been refunded.', 'give' );
179 $notice_type = 'warning';
180 break;
181 case 'preapproval':
182 $notice_message = __( 'Payment Preapproved: Thank you for your donation.', 'give' );
183 $notice_type = 'warning';
184 break;
185 case 'failed':
186 $notice_message = __( 'Payment Failed: Please contact the site owner for assistance.', 'give' );
187 $notice_type = 'error';
188 break;
189 case 'cancelled':
190 $notice_message = __( 'Payment Cancelled: Your donation has been cancelled.', 'give' );
191 $notice_type = 'error';
192 break;
193 case 'abandoned':
194 $notice_message = __( 'Payment Abandoned: This donation has not been completed.', 'give' );
195 $notice_type = 'error';
196 break;
197 case 'revoked':
198 $notice_message = __( 'Payment Revoked: Please contact the site owner for assistance.', 'give' );
199 $notice_type = 'error';
200 break;
201 }
202
203 /**
204 * Filters payment status notice for receipts.
205 *
206 * By default, a success, warning, or error notice appears on the receipt
207 * with payment status. This filter allows the HTML markup
208 * and messaging for that notice to be customized.
209 *
210 * @since 1.0
211 *
212 * @param string $notice HTML markup for the default notice.
213 * @param int $id Post ID where the notice is displayed.
214 * @param string $status Payment status.
215 * @param int $donation_id Donation ID.
216 */
217 echo apply_filters( 'give_receipt_status_notice', Give_Notices::print_frontend_notice( $notice_message, false, $notice_type ), $id, $status, $donation_id );
218
219 }// End if().
220
221 /**
222 * Fires in the donation receipt shortcode, before the receipt main table.
223 *
224 * Allows you to add elements before the table.
225 *
226 * @since 1.0
227 *
228 * @param object $donation Donation object.
229 * @param array $give_receipt_args Receipt_argument.
230 */
231 do_action( 'give_payment_receipt_before_table', $donation, $give_receipt_args );
232 ?>
233
234 <table id="give_donation_receipt" class="give-table">
235 <thead>
236 <?php
237 /**
238 * Fires in the donation receipt shortcode, before the receipt first header item.
239 *
240 * Allows you to add new <th> elements before the receipt first header item.
241 *
242 * @since 1.7
243 *
244 * @param object $donation Donation object.
245 * @param array $give_receipt_args Receipt_argument.
246 */
247 do_action( 'give_payment_receipt_header_before', $donation, $give_receipt_args );
248 ?>
249 <tr>
250 <th scope="colgroup" colspan="2">
251 <span class="give-receipt-thead-text"><?php esc_html_e( 'Donation Receipt', 'give' ); ?></span>
252 </th>
253 </tr>
254 <?php
255 /**
256 * Fires in the donation receipt shortcode, after the receipt last header item.
257 *
258 * Allows you to add new <th> elements after the receipt last header item.
259 *
260 * @since 1.7
261 *
262 * @param object $donation Donation object.
263 * @param array $give_receipt_args Receipt_argument.
264 */
265 do_action( 'give_payment_receipt_header_after', $donation, $give_receipt_args );
266 ?>
267 </thead>
268
269 <tbody>
270 <?php
271 /**
272 * Fires in the donation receipt shortcode, before the receipt first item.
273 *
274 * Allows you to add new <td> elements before the receipt first item.
275 *
276 * @since 1.7
277 *
278 * @param object $donation Donation object.
279 * @param array $give_receipt_args Receipt_argument.
280 */
281 do_action( 'give_payment_receipt_before', $donation, $give_receipt_args );
282 ?>
283
284 <?php foreach ( $give_receipt_args['donation_receipt'] as $receipt_item ) { ?>
285 <?php if ( filter_var( $receipt_item['display'], FILTER_VALIDATE_BOOLEAN ) ) : ?>
286 <tr>
287 <td scope="row"><strong><?php echo $receipt_item['name']; ?></strong></td>
288 <td><?php echo $receipt_item['value']; ?></td>
289 </tr>
290 <?php endif; ?>
291 <?php } ?>
292
293 <?php
294 /**
295 * Fires in the donation receipt shortcode, after the receipt last item.
296 *
297 * Allows you to add new <td> elements after the receipt last item.
298 *
299 * @since 1.7
300 *
301 * @param object $donation Donation object.
302 * @param array $give_receipt_args Receipt_argument.
303 */
304 do_action( 'give_payment_receipt_after', $donation, $give_receipt_args );
305 ?>
306 </tbody>
307 </table>
308
309 <?php
310 /**
311 * Fires in the donation receipt shortcode, after the receipt main table.
312 *
313 * Allows you to add elements after the table.
314 *
315 * @since 1.7
316 *
317 * @param object $donation Donation object.
318 * @param array $give_receipt_args Receipt_argument.
319 */
320 do_action( 'give_payment_receipt_after_table', $donation, $give_receipt_args );
321 ?>
322