PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 3.5.0
GiveWP – Donation Plugin and Fundraising Platform v3.5.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 / includes / deprecated / deprecated-functions.php
give / includes / deprecated Last commit date
deprecated-actions.php 4 years ago deprecated-classes.php 8 years ago deprecated-filters.php 4 years ago deprecated-functions.php 3 years ago
deprecated-functions.php
1242 lines
1 <?php
2 /**
3 * Deprecated Functions
4 *
5 * All functions that have been deprecated.
6 *
7 * @package Give
8 * @subpackage Deprecated
9 * @copyright Copyright (c) 2016, GiveWP
10 * @license https://opensource.org/licenses/gpl-license GNU Public License
11 * @since 1.4.1
12 */
13
14 // Exit if accessed directly.
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit;
17 }
18
19 /**
20 * Deprecated global variables.
21 *
22 * @since 2.0
23 */
24 function _give_load_deprecated_global_params( $give_object ) {
25 $GLOBALS['give_logs'] = Give()->logs;
26 $GLOBALS['give_cron'] = Give_Cron::get_instance();
27 }
28
29 add_action( 'give_init', '_give_load_deprecated_global_params' );
30
31
32 /**
33 * Checks if Guest checkout is enabled for a particular donation form
34 *
35 * @since 1.0
36 * @deprecated 1.4.1
37 *
38 * @param int $form_id
39 *
40 * @return bool $ret True if guest checkout is enabled, false otherwise
41 */
42 function give_no_guest_checkout( $form_id ) {
43
44 $backtrace = debug_backtrace();
45
46 _give_deprecated_function( __FUNCTION__, '1.4.1', null, $backtrace );
47
48 $ret = give_get_meta( $form_id, '_give_logged_in_only', true );
49
50 return (bool) apply_filters( 'give_no_guest_checkout', give_is_setting_enabled( $ret ) );
51 }
52
53
54 /**
55 * Default Log Views
56 *
57 * @since 1.0
58 * @deprecated 1.8
59 * @return array $views Log Views
60 */
61 function give_log_default_views() {
62
63 $backtrace = debug_backtrace();
64
65 _give_deprecated_function( __FUNCTION__, '1.8', null, $backtrace );
66
67 $views = [
68 'sales' => __( 'Donations', 'give' ),
69 'gateway_errors' => __( 'Payment Errors', 'give' ),
70 'api_requests' => __( 'API Requests', 'give' ),
71 ];
72
73 $views = apply_filters( 'give_log_views', $views );
74
75 return $views;
76 }
77
78 /**
79 * Donation form validate agree to "Terms and Conditions".
80 *
81 * @since 1.0
82 * @deprecated 1.8.8
83 */
84 function give_purchase_form_validate_agree_to_terms() {
85
86 $backtrace = debug_backtrace();
87
88 _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_agree_to_terms', $backtrace );
89
90 // Call new renamed function.
91 give_donation_form_validate_agree_to_terms();
92
93 }
94
95 /**
96 * Donation Form Validate Logged In User.
97 *
98 * @since 1.0
99 * @deprecated 1.8.8
100 */
101 function give_purchase_form_validate_logged_in_user() {
102
103 $backtrace = debug_backtrace();
104
105 _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_logged_in_user', $backtrace );
106
107 // Call new renamed function.
108 give_donation_form_validate_logged_in_user();
109
110 }
111
112 /**
113 * Donation Form Validate Logged In User.
114 *
115 * @since 1.0
116 * @deprecated 1.8.8
117 */
118 function give_purchase_form_validate_gateway() {
119
120 $backtrace = debug_backtrace();
121
122 _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_gateway', $backtrace );
123
124 // Call new renamed function.
125 give_donation_form_validate_gateway();
126
127 }
128
129 /**
130 * Donation Form Validate Fields.
131 *
132 * @since 1.0
133 * @deprecated 1.8.8
134 */
135 function give_purchase_form_validate_fields() {
136
137 $backtrace = debug_backtrace();
138
139 _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_fields', $backtrace );
140
141 // Call new renamed function.
142 give_donation_form_validate_fields();
143
144 }
145
146 /**
147 * Validates the credit card info.
148 *
149 * @since 1.0
150 * @deprecated 1.8.8
151 */
152 function give_purchase_form_validate_cc() {
153
154 $backtrace = debug_backtrace();
155
156 _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_cc', $backtrace );
157
158 // Call new renamed function.
159 give_donation_form_validate_cc();
160
161 }
162
163 /**
164 * Validates the credit card info.
165 *
166 * @since 1.0
167 * @deprecated 1.8.8
168 */
169 function give_get_purchase_cc_info() {
170
171 $backtrace = debug_backtrace();
172
173 _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_get_donation_cc_info', $backtrace );
174
175 // Call new renamed function.
176 give_get_donation_cc_info();
177
178 }
179
180
181 /**
182 * Validates the credit card info.
183 *
184 * @since 1.0
185 * @deprecated 1.8.8
186 *
187 * @param int $zip
188 * @param string $country_code
189 */
190 function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
191
192 $backtrace = debug_backtrace();
193
194 _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_cc_zip', $backtrace );
195
196 // Call new renamed function.
197 give_donation_form_validate_cc_zip( $zip, $country_code );
198
199 }
200
201 /**
202 * Donation form validate user login.
203 *
204 * @since 1.0
205 * @deprecated 1.8.8
206 */
207 function give_purchase_form_validate_user_login() {
208
209 $backtrace = debug_backtrace();
210
211 _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_user_login', $backtrace );
212
213 // Call new renamed function.
214 give_donation_form_validate_user_login();
215
216 }
217
218 /**
219 * Donation Form Validate Guest User
220 *
221 * @since 1.0
222 * @deprecated 1.8.8
223 */
224 function give_purchase_form_validate_guest_user() {
225
226 $backtrace = debug_backtrace();
227
228 _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_guest_user', $backtrace );
229
230 // Call new renamed function.
231 give_donation_form_validate_guest_user();
232
233 }
234
235 /**
236 * Donate Form Validate New User
237 *
238 * @since 1.0
239 * @deprecated 1.8.8
240 */
241 function give_purchase_form_validate_new_user() {
242
243 $backtrace = debug_backtrace();
244
245 _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_new_user', $backtrace );
246
247 // Call new renamed function.
248 give_donation_form_validate_new_user();
249
250 }
251
252
253 /**
254 * Get Donation Form User
255 *
256 * @since 1.0
257 * @deprecated 1.8.8
258 *
259 * @param array $valid_data
260 */
261 function give_get_purchase_form_user( $valid_data = [] ) {
262
263 $backtrace = debug_backtrace();
264
265 _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_get_donation_form_user', $backtrace );
266
267 // Call new renamed function.
268 give_get_donation_form_user( $valid_data );
269
270 }
271
272 /**
273 * Give Checkout Button.
274 *
275 * Renders the button on the Checkout.
276 *
277 * @since 1.0
278 * @deprecated 1.8.8
279 *
280 * @param int $form_id The form ID.
281 *
282 * @return string
283 */
284 function give_checkout_button_purchase( $form_id ) {
285 $backtrace = debug_backtrace();
286
287 _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_get_donation_form_submit_button', $backtrace );
288
289 return give_get_donation_form_submit_button( $form_id );
290
291 }
292
293 /**
294 * Get the donor ID associated with a payment.
295 *
296 * @since 1.0
297 *
298 * @param int $payment_id Payment ID.
299 *
300 * @return int $customer_id Customer ID.
301 */
302 function give_get_payment_customer_id( $payment_id ) {
303
304 $backtrace = debug_backtrace();
305
306 _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_get_payment_donor_id', $backtrace );
307
308 return give_get_payment_donor_id( $payment_id );
309 }
310
311
312 /**
313 * Get Total Donations.
314 *
315 * @since 1.0
316 *
317 * @return int $count Total sales.
318 */
319 function give_get_total_sales() {
320
321 $backtrace = debug_backtrace();
322
323 _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_get_total_donations', $backtrace );
324
325 return give_get_total_donations();
326 }
327
328
329 /**
330 * Count number of donations of a donor.
331 *
332 * Returns total number of donations a donor has made.
333 *
334 * @access public
335 * @since 1.0
336 *
337 * @param int|string $user The ID or email of the donor.
338 *
339 * @return int The total number of donations
340 */
341 function give_count_purchases_of_customer( $user = null ) {
342
343 $backtrace = debug_backtrace();
344
345 _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_count_donations_of_donor', $backtrace );
346
347 return give_count_donations_of_donor( $user );
348 }
349
350
351 /**
352 * Get Donation Status for User.
353 *
354 * Retrieves the donation count and the total amount spent for a specific user.
355 *
356 * @access public
357 * @since 1.0
358 *
359 * @param int|string $user The ID or email of the donor to retrieve stats for.
360 *
361 * @return array
362 */
363 function give_get_purchase_stats_by_user( $user = '' ) {
364
365 $backtrace = debug_backtrace();
366
367 _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_get_donation_stats_by_user', $backtrace );
368
369 return give_get_donation_stats_by_user( $user );
370
371 }
372
373 /**
374 * Get Users Donations
375 *
376 * Retrieves a list of all donations by a specific user.
377 *
378 * @since 1.0
379 *
380 * @param int $user User ID or email address
381 * @param int $number Number of donations to retrieve
382 * @param bool $pagination
383 * @param string $status
384 *
385 * @return bool|object List of all user donations
386 */
387 function give_get_users_purchases( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) {
388
389 $backtrace = debug_backtrace();
390
391 _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_get_users_donations', $backtrace );
392
393 return give_get_users_donations( $user, $number, $pagination, $status );
394
395 }
396
397
398 /**
399 * Has donations
400 *
401 * Checks to see if a user has donated to at least one form.
402 *
403 * @access public
404 * @since 1.0
405 *
406 * @param int $user_id The ID of the user to check.
407 *
408 * @return bool True if has donated, false other wise.
409 */
410 function give_has_purchases( $user_id = null ) {
411
412 $backtrace = debug_backtrace();
413
414 _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_has_donations', $backtrace );
415
416 return give_has_donations( $user_id );
417 }
418
419 /**
420 * Counts the total number of donors.
421 *
422 * @access public
423 * @since 1.0
424 *
425 * @return int The total number of donors.
426 */
427 function give_count_total_customers() {
428 $backtrace = debug_backtrace();
429
430 _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_count_total_donors', $backtrace );
431
432 return give_count_total_donors();
433 }
434
435 /**
436 * Calculates the total amount spent by a user.
437 *
438 * @access public
439 * @since 1.0
440 *
441 * @param int|string $user The ID or email of the donor.
442 *
443 * @return float The total amount the user has spent
444 */
445 function give_purchase_total_of_user( $user = null ) {
446
447 $backtrace = debug_backtrace();
448
449 _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_donation_total_of_user', $backtrace );
450
451 return give_donation_total_of_user( $user );
452 }
453
454 /**
455 * Deletes a Donation
456 *
457 * @since 1.0
458 *
459 * @param int $payment_id Payment ID (default: 0).
460 * @param bool $update_customer If we should update the customer stats (default:true).
461 *
462 * @return void
463 */
464 function give_delete_purchase( $payment_id = 0, $update_customer = true ) {
465
466 $backtrace = debug_backtrace();
467
468 _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_delete_donation', $backtrace );
469
470 give_delete_donation( $payment_id, $update_customer );
471
472 }
473
474
475 /**
476 * Undo Donation
477 *
478 * Undoes a donation, including the decrease of donations and earning stats.
479 * Used for when refunding or deleting a donation.
480 *
481 * @since 1.0
482 *
483 * @param int|bool $form_id Form ID (default: false).
484 * @param int $payment_id Payment ID.
485 *
486 * @return void
487 */
488 function give_undo_purchase( $form_id, $payment_id ) {
489
490 $backtrace = debug_backtrace();
491
492 _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_undo_donation', $backtrace );
493
494 give_undo_donation( $payment_id );
495 }
496
497
498 /**
499 * Trigger a Donation Deletion.
500 *
501 * @since 1.0
502 *
503 * @param array $data Arguments passed.
504 *
505 * @return void
506 */
507 function give_trigger_purchase_delete( $data ) {
508 $backtrace = debug_backtrace();
509
510 _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_trigger_donation_delete', $backtrace );
511
512 give_trigger_donation_delete( $data );
513 }
514
515
516 /**
517 * Increases the donation total count of a donation form.
518 *
519 * @since 1.0
520 *
521 * @param int $form_id Give Form ID
522 * @param int $quantity Quantity to increase donation count by
523 *
524 * @return bool|int
525 */
526 function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) {
527 $backtrace = debug_backtrace();
528
529 _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_increase_donation_count', $backtrace );
530
531 give_increase_donation_count( $form_id, $quantity );
532 }
533
534
535 /**
536 * Record Donation In Log
537 *
538 * Stores log information for a donation.
539 *
540 * @since 1.0
541 *
542 * @param int $give_form_id Give Form ID.
543 * @param int $payment_id Payment ID.
544 * @param bool|int $price_id Price ID, if any.
545 * @param string|null $sale_date The date of the sale.
546 *
547 * @return void
548 */
549 function give_record_sale_in_log( $give_form_id, $payment_id, $price_id = false, $sale_date = null ) {
550 $backtrace = debug_backtrace();
551
552 _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_record_donation_in_log', $backtrace );
553
554 give_record_donation_in_log( $give_form_id, $payment_id, $price_id, $sale_date );
555 }
556
557 /**
558 * Print Errors
559 *
560 * Prints all stored errors. Ensures errors show up on the appropriate form;
561 * For use during donation process. If errors exist, they are returned.
562 *
563 * @since 1.0
564 * @uses give_get_errors()
565 * @uses give_clear_errors()
566 *
567 * @param int $form_id Form ID.
568 *
569 * @return void
570 */
571 function give_print_errors( $form_id ) {
572 $backtrace = debug_backtrace();
573
574 _give_deprecated_function( __FUNCTION__, '1.8.9', 'Give_Notice::print_frontend_errors', $backtrace );
575
576 do_action( 'give_frontend_notices', $form_id );
577 }
578
579 /**
580 * Give Output Error
581 *
582 * Helper function to easily output an error message properly wrapped; used commonly with shortcodes
583 *
584 * @since 1.3
585 *
586 * @param string $message Message to store with the error.
587 * @param bool $echo Flag to print or return output.
588 * @param string $error_id ID of the error being set.
589 *
590 * @return string $error
591 */
592 function give_output_error( $message, $echo = true, $error_id = 'warning' ) {
593 $backtrace = debug_backtrace();
594
595 _give_deprecated_function( __FUNCTION__, '1.8.9', 'Give_Notice::print_frontend_notice', $backtrace );
596
597 Give_Notices::print_frontend_notice( $message, $echo, $error_id );
598 }
599
600
601 /**
602 * Get Donation Summary
603 *
604 * Retrieves the donation summary.
605 *
606 * @since 1.0
607 *
608 * @param array $purchase_data
609 * @param bool $email
610 *
611 * @return string
612 */
613 function give_get_purchase_summary( $purchase_data, $email = true ) {
614
615 $backtrace = debug_backtrace();
616
617 _give_deprecated_function( __FUNCTION__, '1.8.12', 'give_payment_gateway_donation_summary', $backtrace );
618
619 give_payment_gateway_donation_summary( $purchase_data, $email );
620
621 }
622
623 /**
624 * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings).
625 *
626 * @since 1.0
627 * @deprecated 2.0
628 *
629 * @return mixed
630 */
631 function give_get_admin_notice_emails() {
632
633 $email_option = give_get_option( 'admin_notice_emails' );
634
635 $emails = ! empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' );
636 $emails = array_map( 'trim', explode( "\n", $emails ) );
637
638 return apply_filters( 'give_admin_notice_emails', $emails );
639 }
640
641 /**
642 * Checks whether admin donation notices are disabled
643 *
644 * @since 1.0
645 * @deprecated 2.0
646 *
647 * @param int $payment_id
648 *
649 * @return mixed
650 */
651 function give_admin_notices_disabled( $payment_id = 0 ) {
652 return apply_filters(
653 'give_admin_notices_disabled',
654 ! give_is_setting_enabled( Give_Email_Notification::get_instance( 'new-donation' )->get_notification_status() ),
655 $payment_id
656 );
657 }
658
659
660 /** Generate Item Title for Payment Gateway
661 *
662 * @param array $payment_data Payment Data.
663 *
664 * @since 1.8.14
665 *
666 * @return string
667 */
668 function give_build_paypal_item_title( $payment_data ) {
669
670 $backtrace = debug_backtrace();
671
672 _give_deprecated_function( __FUNCTION__, '1.8.14', 'give_payment_gateway_item_title', $backtrace );
673
674 return give_payment_gateway_item_title( $payment_data );
675
676 }
677
678
679 /**
680 * Set the number of decimal places per currency
681 *
682 * @since 1.0
683 * @since 1.6 $decimals parameter removed from function params
684 * @deprecated 1.8.15
685 * *
686 * @return int $decimals
687 */
688 function give_currency_decimal_filter() {
689 // Set default number of decimals.
690 $decimals = give_get_price_decimals();
691
692 // Get number of decimals with backward compatibility ( version < 1.6 )
693 if ( 1 <= func_num_args() ) {
694 $decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) );
695 }
696
697 $currency = give_get_currency();
698
699 switch ( $currency ) {
700 // case 'RIAL' :
701 case 'JPY':
702 case 'KRW':
703 // case 'TWD' :
704 // case 'HUF' :
705
706 $decimals = 0;
707 break;
708 }
709
710 return apply_filters( 'give_currency_decimal_count', $decimals, $currency );
711 }
712
713
714 /**
715 * Get field custom attributes as string.
716 *
717 * @since 1.8
718 * @deprecated 1.8.17
719 *
720 * @param $field
721 *
722 * @return string
723 */
724 function give_get_custom_attributes( $field ) {
725 // Custom attribute handling
726 $custom_attributes = '';
727
728 if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) {
729 $custom_attributes = give_get_attribute_str( $field['attributes'] );
730 }
731
732 return $custom_attributes;
733 }
734
735
736 /**
737 * Get Payment Amount
738 *
739 * Get the fully formatted payment amount which is sent through give_currency_filter()
740 * and give_format_amount() to format the amount correctly.
741 *
742 * @param int $payment_id Payment ID.
743 *
744 * @since 1.0
745 * @deprecated 1.8.17
746 *
747 * @return string $amount Fully formatted payment amount.
748 */
749 function give_payment_amount( $payment_id ) {
750 return give_donation_amount( $payment_id );
751 }
752
753 /**
754 * Get Payment Amount
755 *
756 * Get the fully formatted payment amount which is sent through give_currency_filter()
757 * and give_format_amount() to format the amount correctly.
758 *
759 * @param int $payment_id Payment ID.
760 *
761 * @since 1.0
762 * @deprecated 1.8.17
763 *
764 * @return string $amount Fully formatted payment amount.
765 */
766 function give_get_payment_amount( $payment_id ) {
767 return give_donation_amount( $payment_id );
768 }
769
770 /**
771 * Decrease form earnings.
772 *
773 * @deprecated 1.8.17
774 *
775 * @param int $form_id
776 * @param $amount
777 *
778 * @return bool|int
779 */
780 function give_decrease_earnings( $form_id, $amount ) {
781 return give_decrease_form_earnings( $form_id, $amount );
782 }
783
784 /**
785 * Retrieve the donation ID based on the key
786 *
787 * @param string $key the key to search for.
788 *
789 * @since 1.0
790 * @deprecated 1.8.18
791 *
792 * @return int $purchase Donation ID.
793 */
794 function give_get_purchase_id_by_key( $key ) {
795 return give_get_donation_id_by_key( $key );
796 }
797
798 /**
799 * Retrieve Donation Form Title with/without Donation Levels.
800 *
801 * @param array $meta List of Donation Meta.
802 * @param bool $only_level True/False, whether to show only level or not.
803 * @param string $separator Display separator symbol to separate the form title and donation level.
804 *
805 * @since 2.0
806 *
807 * @return string
808 */
809 function give_get_payment_form_title( $meta, $only_level = false, $separator = '' ) {
810
811 _give_deprecated_function(
812 __FUNCTION__,
813 '2.0',
814 'give_get_donation_form_title'
815 );
816
817 $donation = '';
818 if ( is_array( $meta ) && ! empty( $meta['key'] ) ) {
819 $donation = give_get_payment_by( 'key', $meta['key'] );
820 }
821
822 $args = [
823 'only_level' => $only_level,
824 'separator' => $separator,
825 ];
826
827 return give_get_donation_form_title( $donation, $args );
828 }
829
830 /**
831 * This function is used to delete donor for bulk actions on donor listing page.
832 *
833 * @param array $args List of arguments to delete donor.
834 *
835 * @since 2.2
836 */
837 function give_delete_donor( $args ) {
838
839 _give_deprecated_function(
840 __FUNCTION__,
841 '2.2',
842 'give_process_donor_deletion'
843 );
844
845 give_process_donor_deletion( $args );
846 }
847
848
849 /**
850 * Retrieve all donor comment attached to a donation
851 *
852 * Note: currently donor can only add one comment per donation
853 *
854 * @param int $donor_id The donor ID to retrieve comment for.
855 * @param array $comment_args
856 * @param string $search Search for comment that contain a search term.
857 *
858 * @since 2.2.0
859 * @deprecated 2.3.0
860 *
861 * @return array
862 */
863 function give_get_donor_donation_comments( $donor_id, $comment_args = [], $search = '' ) {
864 _give_deprecated_function(
865 __FUNCTION__,
866 '2.3.0',
867 'Give()->comment->db'
868 );
869
870 $comments = Give_Comment::get(
871 $donor_id,
872 'payment',
873 $comment_args,
874 $search
875 );
876
877 return ( ! empty( $comments ) ? $comments : [] );
878 }
879
880 /**
881 * Converts a PHP date format for use in JavaScript.
882 *
883 * @since 2.2.0
884 * @deprecated 2.3.0
885 *
886 * @param string $php_format The PHP date format.
887 *
888 * @return string The JS date format.
889 */
890 function give_convert_php_date_format_to_js( $php_format ) {
891
892 $backtrace = debug_backtrace();
893
894 _give_deprecated_function( __FUNCTION__, '2.3.0', null, $backtrace );
895
896 $js_format = $php_format;
897
898 switch ( $php_format ) {
899 case 'F j, Y':
900 $js_format = 'MM dd, yy';
901 break;
902 case 'Y-m-d':
903 $js_format = 'yy-mm-dd';
904 break;
905 case 'm/d/Y':
906 $js_format = 'mm/dd/yy';
907 break;
908 case 'd/m/Y':
909 $js_format = 'dd/mm/yy';
910 break;
911 }
912
913 /**
914 * Filters the date format for use in JavaScript.
915 *
916 * @since 2.2.0
917 *
918 * @param string $js_format The JS date format.
919 * @param string $php_format The PHP date format.
920 */
921 $js_format = apply_filters( 'give_js_date_format', $js_format, $php_format );
922
923 return $js_format;
924 }
925
926 /**
927 * Get localized date format for use in JavaScript.
928 *
929 * @since 2.2.0
930 * @deprecated 2.3.0
931 *
932 * @return string.
933 */
934 function give_get_localized_date_format_to_js() {
935 $backtrace = debug_backtrace();
936
937 _give_deprecated_function( __FUNCTION__, '2.3.0', null, $backtrace );
938
939 return give_convert_php_date_format_to_js( get_option( 'date_format' ) );
940 }
941
942 /**
943 * Get donor latest comment
944 *
945 * @since 2.2.0
946 * @deprecated 2.3.0
947 *
948 * @param int $donor_id
949 * @param int $form_id
950 *
951 * @return WP_Comment/stdClass/array
952 */
953 function give_get_donor_latest_comment( $donor_id, $form_id = 0 ) {
954 global $wpdb;
955
956 _give_deprecated_function(
957 __FUNCTION__,
958 '2.3.0',
959 'Give()->comment->db'
960 );
961
962 // Backward compatibility.
963 if ( ! give_has_upgrade_completed( 'v230_move_donor_note' ) ) {
964
965 $comment_args = [
966 'post_id' => 0,
967 'orderby' => 'comment_ID',
968 'order' => 'DESC',
969 'number' => 1,
970 'meta_query' => [
971 'related' => 'AND',
972 [
973 'key' => '_give_donor_id',
974 'value' => $donor_id,
975 ],
976 [
977 'key' => '_give_anonymous_donation',
978 'value' => 0,
979 ],
980 ],
981 ];
982
983 // Get donor donation comment for specific form.
984 if ( $form_id ) {
985 $comment_args['parent'] = $form_id;
986 }
987
988 $comment = current( give_get_donor_donation_comments( $donor_id, $comment_args ) );
989
990 return $comment;
991 }
992
993 $comment_args = [
994 'orderby' => 'comment_ID',
995 'order' => 'DESC',
996 'number' => 1,
997 'meta_query' => [
998 'relation' => 'AND',
999 [
1000 'key' => '_give_anonymous_donation',
1001 'value' => 0,
1002 ],
1003 [
1004 'key' => '_give_donor_id',
1005 'value' => $donor_id,
1006 ],
1007 ],
1008 ];
1009
1010 // Get donor donation comment for specific form.
1011 if ( $form_id ) {
1012 $comment_args['meta_query'][] = [
1013 'key' => '_give_form_id',
1014 'value' => $form_id,
1015 ];
1016 }
1017
1018 $sql = Give()->comment->db->get_sql( $comment_args );
1019
1020 $comment = current( $wpdb->get_results( $sql ) );
1021
1022 return $comment;
1023 }
1024
1025 /**
1026 * Email template tag: {receipt_id}
1027 *
1028 * @since 1.0
1029 * @deprecated 2.4.0
1030 *
1031 * @param array $tag_args
1032 *
1033 * @return string receipt_id
1034 */
1035 function give_email_tag_receipt_id( $tag_args ) {
1036 $receipt_id = '';
1037 // Backward compatibility.
1038 $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1039 switch ( true ) {
1040 case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1041 $receipt_id = give_get_payment_key( $tag_args['payment_id'] );
1042 break;
1043 }
1044
1045 /**
1046 * Filter the {receipt_id} email template tag output.
1047 *
1048 * @since 2.0
1049 *
1050 * @param string $receipt_id
1051 * @param array $tag_args
1052 */
1053 return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args );
1054 }
1055
1056
1057 /**
1058 * Check site host
1059 *
1060 * @since 1.0
1061 *
1062 * @param bool /string $host The host to check
1063 *
1064 * @return bool true if host matches, false if not
1065 */
1066 function give_is_host( $host = false ) {
1067
1068 _give_deprecated_function(
1069 __FUNCTION__,
1070 '2.4.2',
1071 'give_get_host'
1072 );
1073
1074 $return = false;
1075
1076 if ( $host ) {
1077 $host = str_replace( ' ', '', strtolower( $host ) );
1078
1079 switch ( $host ) {
1080 case 'wpengine':
1081 if ( defined( 'WPE_APIKEY' ) ) {
1082 $return = true;
1083 }
1084 break;
1085 case 'pagely':
1086 if ( defined( 'PAGELYBIN' ) ) {
1087 $return = true;
1088 }
1089 break;
1090 case 'icdsoft':
1091 if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
1092 $return = true;
1093 }
1094 break;
1095 case 'networksolutions':
1096 if ( DB_HOST == 'mysqlv5' ) {
1097 $return = true;
1098 }
1099 break;
1100 case 'ipage':
1101 if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
1102 $return = true;
1103 }
1104 break;
1105 case 'ipower':
1106 if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
1107 $return = true;
1108 }
1109 break;
1110 case 'mediatemplegrid':
1111 if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
1112 $return = true;
1113 }
1114 break;
1115 case 'pairnetworks':
1116 if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
1117 $return = true;
1118 }
1119 break;
1120 case 'rackspacecloud':
1121 if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
1122 $return = true;
1123 }
1124 break;
1125 case 'sysfix.eu':
1126 case 'sysfix.eupowerhosting':
1127 if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
1128 $return = true;
1129 }
1130 break;
1131 case 'flywheel':
1132 if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
1133 $return = true;
1134 }
1135 break;
1136 default:
1137 $return = false;
1138 }// End switch().
1139 }// End if().
1140
1141 return $return;
1142 }
1143
1144 /**
1145 * Get list of premium add-ons
1146 *
1147 * @since 2.5.0
1148 * @deprecated 2.9.2
1149 *
1150 * @return array
1151 *
1152 */
1153 function give_get_premium_add_ons() {
1154 $list = wp_extract_urls( give_add_ons_feed( 'addons-directory', false ) );
1155 $list = array_values(
1156 array_filter(
1157 $list,
1158 static function ( $url ) {
1159 return false !== strpos( $url, 'givewp.com/addons' );
1160 }
1161 )
1162 );
1163
1164 return array_map(
1165 static function ( $url ) {
1166 $path = wp_parse_url( untrailingslashit( $url ) )['path'];
1167
1168 return str_replace( '/addons/', '', $path );
1169 },
1170 $list
1171 );
1172 }
1173
1174 /**
1175 * Displays Stripe Connect Button.
1176 *
1177 * @since 2.5.0
1178 * @deprecated 2.20.2
1179 *
1180 * @return string
1181 */
1182 function give_stripe_connect_button() {
1183 _give_deprecated_function(
1184 __FUNCTION__,
1185 '2.13.0'
1186 );
1187
1188 // Prepare Stripe Connect URL.
1189 $link = add_query_arg(
1190 [
1191 'stripe_action' => 'connect',
1192 'mode' => give_is_test_mode() ? 'test' : 'live',
1193 'return_url' => rawurlencode( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=stripe-settings' ) ),
1194 'website_url' => get_bloginfo( 'url' ),
1195 'give_stripe_connected' => '0',
1196 ],
1197 'https://connect.givewp.com/stripe/connect.php'
1198 );
1199
1200 return sprintf(
1201 '<a href="%1$s" class="give-stripe-connect"><span>%2$s</span></a>',
1202 esc_url( $link ),
1203 esc_html__( 'Connect with Stripe', 'give' )
1204 );
1205 }
1206
1207 /**
1208 * Stripe Disconnect URL.
1209 *
1210 * @param string $account_id Stripe Account ID.
1211 * @param string $account_name Stripe Account Name.
1212 *
1213 * @since 2.5.0
1214 * @deprecated 2.13.0
1215 *
1216 * @return string
1217 */
1218 function give_stripe_disconnect_url( $account_id = '', $account_name = '' ) {
1219 _give_deprecated_function(
1220 __FUNCTION__,
1221 '2.13.0'
1222 );
1223
1224 $args = [
1225 'stripe_action' => 'disconnect',
1226 'mode' => give_is_test_mode() ? 'test' : 'live',
1227 'stripe_user_id' => $account_id,
1228 'return_url' => rawurlencode( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=stripe-settings' ) ),
1229 ];
1230
1231 // Send Account Name.
1232 if ( ! empty( $account_name ) ) {
1233 $args['account_name'] = $account_name;
1234 }
1235
1236 // Prepare Stripe Disconnect URL.
1237 return esc_url_raw( add_query_arg(
1238 $args,
1239 'https://connect.givewp.com/stripe/connect.php'
1240 ) );
1241 }
1242