-
Notifications
You must be signed in to change notification settings - Fork 4
/
woo-vipps-recurring.php
executable file
·87 lines (71 loc) · 2.67 KB
/
woo-vipps-recurring.php
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* Plugin Name: Vipps/MobilePay recurring payments for WooCommerce
* Description: Offer recurring payments with Vipps MobilePay for WooCommerce Subscriptions
* Author: Everyday AS
* Author URI: https://everyday.no
* Version: 2.0.8
* Requires Plugins: woocommerce
* Requires at least: 6.1
* Tested up to: 6.7
* WC tested up to: 9.3
* Text Domain: vipps-recurring-payments-gateway-for-woocommerce
* Domain Path: /languages
*/
defined( 'ABSPATH' ) || exit;
// phpcs:disable WordPress.Files.FileName
define( 'WC_VIPPS_RECURRING_VERSION', '2.0.8' );
/**
* Polyfills
*/
if ( ! function_exists( 'array_key_first' ) ) {
function array_key_first( array $arr ) {
foreach ( $arr as $key => $unused ) {
return $key;
}
return null;
}
}
if ( ! function_exists( 'array_key_last' ) ) {
function array_key_last( array $array ) {
end( $array );
return key( $array );
}
}
$active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
$active_site_plugins = apply_filters( 'active_sitewide_plugins', get_site_option( 'active_sitewide_plugins' ) );
if ( $active_site_plugins ) {
$active_plugins = array_merge( $active_plugins, array_keys( $active_site_plugins ) );
}
if ( in_array( 'woocommerce/woocommerce.php', $active_plugins, true ) ) {
require_once __DIR__ . '/includes/wc-vipps-recurring-helper.php';
require_once __DIR__ . '/includes/wc-vipps-recurring-logger.php';
require_once __DIR__ . '/includes/wc-vipps-recurring-admin-notices.php';
require_once __DIR__ . '/includes/wc-vipps-recurring.php';
/*
* Required minimums and constants
*/
define( 'WC_VIPPS_RECURRING_MIN_PHP_VER', '7.4.0' );
define( 'WC_VIPPS_RECURRING_MIN_WC_VER', '3.0.0' );
define( 'WC_VIPPS_RECURRING_MAIN_FILE', __FILE__ );
define( 'WC_VIPPS_RECURRING_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
define( 'WC_VIPPS_RECURRING_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
/*
* Amount of days to retry a payment when creating a charge in the Vipps/MobilePay API
*/
if ( ! defined( 'WC_VIPPS_RECURRING_RETRY_DAYS' ) ) {
define( 'WC_VIPPS_RECURRING_RETRY_DAYS', 4 );
}
/*
* Whether to put the plugin into test mode. This is only useful for developers.
*/
if ( ! defined( 'WC_VIPPS_RECURRING_TEST_MODE' ) ) {
define( 'WC_VIPPS_RECURRING_TEST_MODE', false );
}
WC_Vipps_Recurring::register_hooks();
if ( get_option( WC_Vipps_Recurring_Helper::OPTION_CHECKOUT_ENABLED, false ) ) {
require_once __DIR__ . '/includes/wc-vipps-recurring-checkout.php';
WC_Vipps_Recurring_Checkout::register_hooks();
}
require_once __DIR__ . '/includes/wc-vipps-recurring-compatibility.php';
}