-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathplugin.php
More file actions
113 lines (92 loc) · 2.88 KB
/
plugin.php
File metadata and controls
113 lines (92 loc) · 2.88 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/**
* Plugin Name: WooCommerce Steem
* Plugin URI: https://github.com/recrypto/woocommerce-steem
* Description: Accept Steem payments directly to your shop (Currencies: STEEM, SBD).
* Version: 1.0.5
* Author: ReCrypto
* Author URI: https://steemit.com/@recrypto
* Requires at least: 4.1
* Tested up to: 4.7.5
*
* Text Domain: wc-steem
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
define('WC_STEEM_VERSION', '1.0.5');
define('WC_STEEM_DIR_PATH', trailingslashit(plugin_dir_path(__FILE__)));
define('WC_STEEM_DIR_URL', trailingslashit(plugin_dir_url(__FILE__)));
register_activation_hook(__FILE__, 'wc_steem_activate');
register_deactivation_hook(__FILE__, 'wc_steem_deactivate');
/**
* Plugin activation
*
* @since 1.0.0
*/
function wc_steem_activate() {
do_action('wc_steem_activated');
$settings = get_option('woocommerce_wc_steem_settings', array());
if ( ! isset($settings['accepted_currencies'])) {
$settings['accepted_currencies'] = array(
'STEEM',
'SBD',
);
}
update_option('woocommerce_wc_steem_settings', $settings);
// Make sure to have fresh currency rates
update_option('wc_steem_rates', array());
}
/**
* Plugin deactivation
*
* @since 1.0.0
*/
function wc_steem_deactivate() {
do_action('wc_steem_deactivated');
// Make sure to have fresh currency rates
update_option('wc_steem_rates', array());
}
/**
* Plugin init
*
* @since 1.0.0
*/
function wc_steem_init() {
/**
* Fires before including the files
*
* @since 1.0.0
*/
do_action('wc_steem_pre_init');
require_once(WC_STEEM_DIR_PATH . 'libraries/wordpress.php');
require_once(WC_STEEM_DIR_PATH . 'libraries/woocommerce.php');
require_once(WC_STEEM_DIR_PATH . 'includes/wc-steem-functions.php');
require_once(WC_STEEM_DIR_PATH . 'includes/class-wc-steem.php');
require_once(WC_STEEM_DIR_PATH . 'includes/class-wc-steem-transaction-transfer.php');
require_once(WC_STEEM_DIR_PATH . 'includes/class-wc-gateway-steem.php');
require_once(WC_STEEM_DIR_PATH . 'includes/wc-steem-handler.php');
require_once(WC_STEEM_DIR_PATH . 'includes/wc-steem-cart-handler.php');
require_once(WC_STEEM_DIR_PATH . 'includes/wc-steem-checkout-handler.php');
require_once(WC_STEEM_DIR_PATH . 'includes/wc-steem-order-handler.php');
require_once(WC_STEEM_DIR_PATH . 'includes/wc-steem-product-handler.php');
/**
* Fires after including the files
*
* @since 1.0.0
*/
do_action('wc_steem_init');
}
add_action('plugins_loaded', 'wc_steem_init');
/**
* Register "WooCommerce Steem" as payment gateway in WooCommerce
*
* @since 1.0.0
*
* @param array $gateways
* @return array $gateways
*/
function wc_steem_register_gateway($gateways) {
$gateways[] = 'WC_Gateway_Steem';
return $gateways;
}
add_filter('woocommerce_payment_gateways', 'wc_steem_register_gateway');