forked from bosunolanrewaju/WooCommerce-Rave-Payment-Gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwoocommerce-rave.php
64 lines (46 loc) · 1.6 KB
/
woocommerce-rave.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
<?php
/*
Plugin Name: WooCommerce Rave Payment Gateway
Plugin URI: https://rave.flutterwave.com/
Description: WooCommerce payment gateway for Rave.
Version: 1.0.0
Author: Bosun Olanrewaju
Author URI: http://twitter.com/bosunolanrewaju
License: MIT License
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'FLW_WC_PLUGIN_FILE', __FILE__ );
define( 'FLW_WC_DIR_PATH', plugin_dir_path( FLW_WC_PLUGIN_FILE ) );
add_action('plugins_loaded', 'flw_woocommerce_rave_init', 0);
function flw_woocommerce_rave_init() {
if ( !class_exists( 'WC_Payment_Gateway' ) ) return;
require_once( FLW_WC_DIR_PATH . 'includes/class.flw_wc_payment_gateway.php' );
add_filter('woocommerce_payment_gateways', 'flw_woocommerce_add_rave_gateway' );
/**
* Add the Settings link to the plugin
*
* @param Array $links Existing links on the plugin page
*
* @return Array Existing links with our settings link added
*/
function flw_plugin_action_links( $links ) {
$rave_settings_url = esc_url( get_admin_url( null, 'admin.php?page=wc-settings&tab=checkout§ion=rave' ) );
array_unshift( $links, "<a title='Rave Settings Page' href='$rave_settings_url'>Settings</a>" );
return $links;
}
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'flw_plugin_action_links' );
/**
* Add the Gateway to WooCommerce
*
* @param Array $methods Existing gateways in WooCommerce
*
* @return Array Gateway list with our gateway added
*/
function flw_woocommerce_add_rave_gateway($methods) {
$methods[] = 'FLW_WC_Payment_Gateway';
return $methods;
}
}
?>