-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwkgb-lite-pay.php
More file actions
79 lines (66 loc) · 2.38 KB
/
Copy pathwkgb-lite-pay.php
File metadata and controls
79 lines (66 loc) · 2.38 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
<?php
/**
* Plugin Name: WKGB 轻量会员下载
* Description: 易支付积分充值、会员开通和收费下载。
* Plugin URI: https://github.com/wxcydzcc/wkgb-lite-pay
* Version: 1.1.1
* Author: WKGB
* Author URI: https://github.com/wxcydzcc
* Requires at least: 6.8
* Requires PHP: 8.0
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wkgb-lite-pay
* Domain Path: /languages
*/
if (!defined('ABSPATH')) {
exit;
}
define('WKGB_PAY_VERSION', '1.1.1');
define('WKGB_PAY_FILE', __FILE__);
define('WKGB_PAY_DIR', plugin_dir_path(__FILE__));
define('WKGB_PAY_URL', plugin_dir_url(__FILE__));
require_once WKGB_PAY_DIR . 'includes/class-wkgb-pay-db.php';
require_once WKGB_PAY_DIR . 'includes/class-wkgb-pay-payment.php';
require_once WKGB_PAY_DIR . 'includes/class-wkgb-pay-frontend.php';
require_once WKGB_PAY_DIR . 'includes/class-wkgb-pay-admin.php';
final class WKGB_Lite_Pay {
private static $instance;
public static function instance() {
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
private function __construct() {
add_action('plugins_loaded', array($this, 'load_textdomain'));
add_action('init', array($this, 'register_routes'));
add_filter('query_vars', array($this, 'query_vars'));
WKGB_Pay_Payment::init();
WKGB_Pay_Frontend::init();
WKGB_Pay_Admin::init();
}
public function load_textdomain() {
load_plugin_textdomain('wkgb-lite-pay', false, dirname(plugin_basename(WKGB_PAY_FILE)) . '/languages');
}
public function register_routes() {
add_rewrite_rule('^wkgb-pay/notify/?$', 'index.php?wkgb_pay_notify=1', 'top');
add_rewrite_rule('^wkgb-pay/return/?$', 'index.php?wkgb_pay_return=1', 'top');
}
public function query_vars($vars) {
$vars[] = 'wkgb_pay_notify';
$vars[] = 'wkgb_pay_return';
return $vars;
}
public static function activate() {
WKGB_Pay_DB::install();
self::instance()->register_routes();
flush_rewrite_rules(false);
}
public static function deactivate() {
flush_rewrite_rules(false);
}
}
register_activation_hook(__FILE__, array('WKGB_Lite_Pay', 'activate'));
register_deactivation_hook(__FILE__, array('WKGB_Lite_Pay', 'deactivate'));
WKGB_Lite_Pay::instance();