init.php
1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* LearnDash payment gateways.
*
* @since 4.5.0
*
* @package LearnDash
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
const LEARNDASH_GATEWAYS_PATH = LEARNDASH_LMS_PLUGIN_DIR . 'includes/payments/gateways/';
require_once LEARNDASH_GATEWAYS_PATH . 'class-learndash-payment-gateway.php';
// Requires all gateways. Please don't forget to create an instance of the gateways below.
require_once LEARNDASH_GATEWAYS_PATH . 'class-learndash-unknown-gateway.php';
require_once LEARNDASH_GATEWAYS_PATH . 'class-learndash-paypal-ipn-gateway.php';
require_once LEARNDASH_GATEWAYS_PATH . 'class-learndash-stripe-gateway.php';
require_once LEARNDASH_GATEWAYS_PATH . 'class-learndash-razorpay-gateway.php';
add_action(
'init',
function () {
/**
* Filters the list of payment gateways.
*
* @since 4.5.0
*
* @param Learndash_Payment_Gateway[] $gateways List of payment gateway instances.
*
* @return Learndash_Payment_Gateway[] List of payment gateway instances.
*/
$gateways = apply_filters(
'learndash_payment_gateways',
array(
// gateways instances initialization.
new Learndash_Unknown_Gateway(),
new Learndash_Paypal_IPN_Gateway(),
new Learndash_Stripe_Gateway(),
new Learndash_Razorpay_Gateway(),
)
);
foreach ( $gateways as $gateway ) {
if ( ! $gateway instanceof Learndash_Payment_Gateway ) {
continue;
}
$gateway->init();
}
}
);