| 1 |
<?php |
| 2 |
/** |
| 3 |
* Stripe core functions. |
| 4 |
* |
| 5 |
* @package Charitable Stripe/Functions/Core |
| 6 |
* @author David Bisset |
| 7 |
* @copyright Copyright (c) 2021-2022, David Bisset |
| 8 |
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License |
| 9 |
* @since 1.3.0 |
| 10 |
* @version 1.3.0 |
| 11 |
*/ |
| 12 |
|
| 13 |
// Exit if accessed directly. |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Return the instance of `Charitable_Stripe`. |
| 20 |
* |
| 21 |
* @since 1.3.0 |
| 22 |
* |
| 23 |
* @return Charitable_Stripe |
| 24 |
*/ |
| 25 |
function charitable_stripe() { |
| 26 |
return Charitable::get_instance(); |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* This returns the Charitable_Stripe_Deprecated object. |
| 31 |
* |
| 32 |
* @since 1.4.0 |
| 33 |
* |
| 34 |
* @return Charitable_Stripe_Deprecated |
| 35 |
*/ |
| 36 |
function charitable_stripe_deprecated() { |
| 37 |
return Charitable_Stripe_Deprecated::get_instance(); |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* Check whether webhooks should be set up. |
| 42 |
* |
| 43 |
* @since 1.3.0 |
| 44 |
* |
| 45 |
* @return boolean |
| 46 |
*/ |
| 47 |
function charitable_stripe_should_setup_webhooks() { |
| 48 |
/** |
| 49 |
* Filter whether webhooks should be set up for this site. |
| 50 |
* |
| 51 |
* By default, this will return true unless this is localhost. |
| 52 |
* |
| 53 |
* @since 1.3.0 |
| 54 |
* |
| 55 |
* @param boolean $should Whether the webhooks should be set up. |
| 56 |
*/ |
| 57 |
return apply_filters( |
| 58 |
'charitable_stripe_setup_webhooks', |
| 59 |
! charitable_is_localhost() |
| 60 |
); |
| 61 |
} |
| 62 |
|