PluginProbe
Pay with Vipps and MobilePay for WooCommerce / trunk
Pay with Vipps and MobilePay for WooCommerce vtrunk
6.2.0 6.1.10 6.1.9 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1.0 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 6.0.0 5.4.3 5.4.2 5.4.1 5.4.0 5.3.4 trunk 1.10.0 All 182 releases
woo-vipps / recurring / recurring.php

recurring.php in Pay with Vipps and MobilePay for WooCommerce trunk, at recurring/recurring.php

81 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) || exit;
3
4 // phpcs:disable WordPress.Files.FileName
5
6 define( 'WC_VIPPS_RECURRING_VERSION', '2.2.18' );
7
8 /**
9 * Polyfills
10 */
11 if ( ! function_exists( 'array_key_first' ) ) {
12 function array_key_first( array $arr ) {
13 foreach ( $arr as $key => $unused ) {
14 return $key;
15 }
16
17 return null;
18 }
19 }
20
21 if ( ! function_exists( 'array_key_last' ) ) {
22 function array_key_last( array $array ) {
23 end( $array );
24
25 return key( $array );
26 }
27 }
28
29 require_once __DIR__ . '/includes/wc-vipps-recurring-helper.php';
30 require_once __DIR__ . '/includes/wc-vipps-recurring-logger.php';
31 require_once __DIR__ . '/includes/wc-vipps-recurring-admin-notices.php';
32 require_once __DIR__ . '/includes/wc-vipps-recurring.php';
33
34 /*
35 * Required minimums and constants
36 */
37 define( 'WC_VIPPS_RECURRING_MIN_PHP_VER', '7.4.0' );
38 define( 'WC_VIPPS_RECURRING_MIN_WC_VER', '3.0.0' );
39 define( 'WC_VIPPS_RECURRING_MAIN_FILE', __FILE__ );
40 #define( 'WC_VIPPS_RECURRING_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
41 define( 'WC_VIPPS_RECURRING_PLUGIN_URL', plugins_url("", __FILE__));
42 define( 'WC_VIPPS_RECURRING_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
43
44 /* Note that this is the integrated version of the plugin IOK 2025-01-06*/
45 define( 'WC_VIPPS_RECURRING_INTEGRATED', true);
46
47 /*
48 * Amount of days to retry a payment when creating a charge in the Vipps/MobilePay API
49 */
50 if ( ! defined( 'WC_VIPPS_RECURRING_RETRY_DAYS' ) ) {
51 $wc_vipps_recurring_retry_days = 2;
52 $wc_vipps_recurring_wcs_retries_enabled = 'yes' === get_option( 'woocommerce_subscriptions_enable_retry', 'no' );
53
54 if ( apply_filters( 'wcs_is_retry_enabled', $wc_vipps_recurring_wcs_retries_enabled ) ) {
55 $wc_vipps_recurring_retry_days = 0;
56 }
57
58 define( 'WC_VIPPS_RECURRING_RETRY_DAYS', $wc_vipps_recurring_retry_days );
59 unset( $wc_vipps_recurring_retry_days );
60 unset( $wc_vipps_recurring_wcs_retries_enabled );
61 }
62
63 /*
64 * Whether to put the plugin into test mode. This is only useful for developers.
65 */
66 if ( ! defined( 'WC_VIPPS_RECURRING_TEST_MODE' ) ) {
67 define( 'WC_VIPPS_RECURRING_TEST_MODE', false );
68 }
69
70 if ( ! defined( 'WC_VIPPS_RECURRING_ALLOW_CHECKOUT_OPTION' ) ) {
71 define( 'WC_VIPPS_RECURRING_ALLOW_CHECKOUT_OPTION', false );
72 }
73
74 WC_Vipps_Recurring::register_hooks();
75 if ( get_option( WC_Vipps_Recurring_Helper::OPTION_CHECKOUT_ENABLED, false ) ) {
76 require_once __DIR__ . '/includes/wc-vipps-recurring-checkout.php';
77 WC_Vipps_Recurring_Checkout::register_hooks();
78 }
79
80 require_once __DIR__ . '/includes/wc-vipps-recurring-compatibility.php';
81