-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwc-cointopay.php
75 lines (63 loc) · 2.08 KB
/
wc-cointopay.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
<?php
/**
* Plugin Name: WooCommerce Cointopay.com
* Description: Extends WooCommerce with crypto payments gateway.
* Version: 1.4.1
* Author: Cointopay
*
* @author Cointopay <info@cointopay.com>
* @link cointopay.com
*/
defined('ABSPATH') || exit;
require_once plugin_dir_path( __FILE__ ) . 'hooks/get_merchant_coins.php';
add_filter( 'woocommerce_payment_gateways', 'wc_cointopay_gateway_class' );
function wc_cointopay_gateway_class( $gateways ) {
$gateways[] = 'WC_Cointopay_Gateway'; // your class name is here
return $gateways;
}
add_action( 'plugins_loaded', 'woocommerce_cointopay_init' );
function woocommerce_cointopay_init() {
require_once plugin_dir_path( __FILE__ ) . 'classes/wc_cointopay_gateway.php';
}
class WC_Cointopay_Payments {
/**
* Plugin bootstrapping.
*/
public static function init() {
// Registers WooCommerce Blocks integration.
add_action( 'woocommerce_blocks_loaded', array( __CLASS__, 'woocommerce_gateway_cointopay_woocommerce_block_support' ) );
}
/**
* Plugin url.
*
* @return string
*/
public static function plugin_url() {
return untrailingslashit( plugins_url( '/', __FILE__ ) );
}
/**
* Plugin url.
*
* @return string
*/
public static function plugin_abspath() {
return trailingslashit( plugin_dir_path( __FILE__ ) );
}
/**
* Registers WooCommerce Blocks integration.
*
*/
public static function woocommerce_gateway_cointopay_woocommerce_block_support() {
if ( class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) {
require_once 'classes/wc_cointopay_block_support.php';
add_action(
'woocommerce_blocks_payment_method_type_registration',
function( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) {
$payment_method_registry->register( new WC_Cointopay_Block_support() );
}
);
}
}
}
WC_Cointopay_Payments::init();
?>