-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwoocommerce-flatratepay-gateway.php
54 lines (43 loc) · 1.42 KB
/
woocommerce-flatratepay-gateway.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
<?php
/**
* Plugin Name: FlatRatePay Payment Gateway For WooCommerce
* Description: Extends WooCommerce to Process Payments with the GivePay Gateway
* Version: 1.2.1
* Plugin URI: https://flatratepay.com/
* Author: William Ward, GivePay Commerce, LLC
* Author URI: https://flatratepay.com/
* License: Under GPL2
* WC tested up to: 3.6.4
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
final class WC_GPG_Loader {
/**
* @var WC_GPG_Loader singleton instance
*/
private static $instance;
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
protected function __construct() {
add_action( 'plugins_loaded', array( $this, 'load' ) );
}
public function load() {
if ( ! class_exists( 'WC_Payment_Gateway_CC' ) ) {
return;
}
require_once( __DIR__ . '/vendor/autoload.php' );
require_once( __DIR__ . '/FlatRatePay/FlatRatePayWooCommerceGateway.php' );
load_plugin_textdomain( 'wc-givepay-gateway', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
add_filter( 'woocommerce_payment_gateways', array( $this, 'woocommerce_add_gpg' ) );
}
public function woocommerce_add_gpg( $methods ) {
$methods[] = '\FlatRatePay\FlatRatePayWooCommerceGateway';
return $methods;
}
}
$GLOBALS['wc_givepay_gateway_loader'] = WC_GPG_Loader::get_instance();