-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
wx-subscribe.php
154 lines (136 loc) · 3.61 KB
/
wx-subscribe.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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
/*
Plugin Name: WX Subscribe
Plugin URI: https://www.ixiqin.com/wx-subscribe
Description: 微信支付订阅插件,用户通过微信支付进行订阅的支付,实现订阅才能查看付费文章的功能。同时,还提供了短代码对部分内容进行隐藏(<code>[subscribe]</code>)
Version: 1.2
Author: Bestony
Author URI: https://www.ixiqin.com/
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
/* Copyright 2018 Bestony (email : xiqingongzi@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* 引入变量的定义
*/
include 'libs/variable.php';
/**
* 引入自定义函数
*/
include 'libs/utils.php';
/**
* 引入 PayJS
*/
if (!class_exists('Pay')) {
include 'libs/payjs.php';
}
/**
* 引入安装函数:数据库初始化
*/
include 'libs/install.php';
/**
* 引入激活函数:角色创建与删除
*/
include 'libs/activation.php';
/**
* 管理后台提醒设置
*/
include 'admin/notices.php';
/**
* 后台仪表盘设置
*/
include 'admin/dashboard.php';
/**
* 文章后台设置
*/
include 'admin/post.php';
/**
* 插件设置页面
*/
include 'admin/plugin-option.php';
/**
* 插件订单页面
*/
include 'admin/plugin-order.php';
/**
* 用户端内容过滤器
*/
include 'user/content.php';
/**
* 用户端 shortcode && Qtags
*/
include 'admin/shortcode.php';
/**
* payjs 调用
*/
include 'admin/payjs.php';
/**
* 用户详情页设置
*/
include 'admin/userprofile.php';
/**
* 插件首页显示
*/
include 'admin/plugin-home.php';
/**
* 帮助中心
*/
include 'admin/plugin-helpcenter.php';
/**
* 菜单部分
*/
add_action('admin_menu', 'wxs_plugin_menu', 10);
function wxs_plugin_menu() {
/**
* 添加后台菜单
* @version 1.0.0
*/
add_menu_page("微信订阅", "微信订阅", "manage_options", "wxs-plugin-admin", 'wxs_plugin_home', '', 99);
/**
* 创建配置页面,并获取到 Hook
* @var hook
* @version 1.0.0
*/
$hook_suffix = add_submenu_page('wxs-plugin-admin', "微信订阅插件配置", "插件配置", "manage_options", "wxs-options-list", 'wxs_plugin_options');
/**
* 添加页面加载的监听,页面加载完成后,跳转到详情页
*/
add_action('load-' . $hook_suffix, 'wxs_hide_admin_notices');
if (wxs_assert_plugin_config()) {
add_submenu_page('wxs-plugin-admin', "支付订单管理", "订单管理", "manage_options", 'wxs-order-list', 'wxs_plugin_orders');
add_submenu_page('wxs-plugin-admin', "帮助中心", "帮助中心", "manage_options", 'wxs-help-center', 'wxs_plugin_helpcenter');
}
}
/**
* 初始化数据库
*/
register_activation_hook(__FILE__, 'wxs_install');
/**
* 插入演示数据
*/
register_activation_hook(__FILE__, 'wxs_install_data');
/**
* 添加新的角色
*/
register_activation_hook(__FILE__, 'wxs_add_roles_on_plugin_activation');
/**
* 删除角色
*/
register_deactivation_hook(__FILE__, 'wxs_del_roles_on_plugin_activation');
/**
* TODO List
* @todo 添加 Cron ,一年后自动为用户移除角色
*
*/