PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.15.2
GiveWP – Donation Plugin and Fundraising Platform v4.15.2
4.18.0.1 4.18.0 4.17.0 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 All 258 releases
give / includes / gateways / stripe / includes / admin / admin-helpers.php

admin-helpers.php in GiveWP – Donation Plugin and Fundraising Platform 4.15.2, at includes/gateways/stripe/includes/admin/admin-helpers.php

85 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Give - Stripe Core Admin Helper Functions.
4 *
5 * @since 2.5.4
6 *
7 * @package Give
8 * @subpackage Stripe Core
9 * @copyright Copyright (c) 2019, GiveWP
10 * @license https://opensource.org/licenses/gpl-license GNU Public License
11 */
12
13 // Exit, if accessed directly.
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit;
17 }
18
19 /**
20 * This function is used to get a list of slug which are supported by payment gateways.
21 *
22 * @since 2.27.0 add filter for the array of supported stripe gateways.
23 * @since 2.5.5
24 *
25 * @return array
26 */
27 function give_stripe_supported_payment_methods()
28 {
29 return apply_filters('give_stripe_supported_payment_methods', [
30 'stripe',
31 'stripe_ach',
32 'stripe_ideal',
33 'stripe_google_pay',
34 'stripe_apple_pay',
35 'stripe_checkout',
36 'stripe_sepa',
37 'stripe_becs',
38 ]);
39 }
40
41 /**
42 * This function is used to check whether a payment method supported by Stripe with Give is active or not.
43 *
44 * @since 2.5.5
45 *
46 * @return bool
47 */
48 function give_stripe_is_any_payment_method_active()
49 {
50 $settings = give_get_settings();
51 $gateways = $settings['gateways'] ?? [];
52 $stripePaymentMethods = give_stripe_supported_payment_methods();
53
54 $active = false;
55 foreach (array_keys($gateways) as $gateway) {
56 // Return true, if even single payment method is active.
57 if ( in_array( $gateway, $stripePaymentMethods, true ) ) {
58 $active = true;
59 }
60 }
61
62 /**
63 * @since 3.0.0
64 */
65 return apply_filters('give_stripe_is_any_payment_method_active', $active, $gateways, $stripePaymentMethods);
66 }
67
68 /**
69 * This helper function is used to convert slug into name of Stripe connection.
70 *
71 * @param string $slug Connection Type Slug.
72 *
73 * @since 2.7.0
74 *
75 * @return string
76 */
77 function give_stripe_connection_type_name( $slug = 'connect' ) {
78 $names = [
79 'manual' => esc_html__( 'API Keys', 'give' ),
80 'connect' => esc_html__( 'Stripe Connect', 'give' ),
81 ];
82
83 return $names[ $slug ];
84 }
85