-
Notifications
You must be signed in to change notification settings - Fork 12
/
woocommerce-payforpayment.php
70 lines (58 loc) · 2.38 KB
/
woocommerce-payforpayment.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
<?php
/*
Plugin Name: Pay for Payment for WooCommerce
Plugin URI: https://kybernaut.cz/pluginy/woocommerce-pay-for-payment/
Description: Setup individual charges for each payment method in WooCommerce.
Version: 2.1.8
Author: Karolína Vyskočilová
Author URI: https://kybernaut.cz
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Text Domain: woocommerce-pay-for-payment
Domain Path: /languages
WC requires at least: 2.6
WC tested up to: 8.0.0
*/
/**
* Check if WooCommerce is active.
*
* @return void
*/
add_action( 'plugins_loaded', 'pay4payment_plugin_init' );
function pay4payment_plugin_init() {
if ( current_user_can( 'activate_plugins' ) && ! class_exists( 'woocommerce' ) ) {
add_action( 'admin_notices', 'pay4payment_admin_notice' );
} else {
require_once plugin_dir_path( __FILE__ ) . '/inc/class-pay4pay.php';
Pay4Pay::instance();
// Integrations.
include_once plugin_dir_path( __FILE__ ) . '/inc/class-pay4pay-price-based-country.php';
include_once plugin_dir_path( __FILE__ ) . '/inc/class-pay4pay-woocommerce-multicurrency.php';
include_once plugin_dir_path( __FILE__ ) . '/inc/class-pay4pay-woo-multi-currency.php';
include_once plugin_dir_path( __FILE__ ) . '/inc/class-pay4pay-wcml.php';
include_once plugin_dir_path( __FILE__ ) . '/inc/class-pay4pay-woocs.php';
if ( is_admin() )
require_once plugin_dir_path( __FILE__ ) . '/inc/class-pay4pay-admin.php';
}
}
/**
* Display an alert to inform the admin why the plugin didn't activate
*
* @return void
*/
function pay4payment_admin_notice() {
$pay4payment_plugin = __( 'Pay for Payment for WooCommerce', 'woocommerce-pay-for-payment' );
$woocommerce_plugin = __( 'WooCommerce', 'woocommerce-pay-for-payment' );
echo '<div class="error"><p>'
. sprintf( __( '%1$s requires %2$s. Please activate %2$s before activation of %1$s. This plugin has been deactivated.', 'woocommerce-pay-for-payment' ), '<strong>' . esc_html( $pay4payment_plugin ) . '</strong>', '<strong>' . esc_html( $woocommerce_plugin ) . '</strong>' )
. '</p></div>';
if ( isset( $_GET['activate'] ) ) {
unset( $_GET['activate'] );
}
}
// Declare compatibility with HPOS.
add_action( 'before_woocommerce_init', function() {
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
}
} );