PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution / 4.9.2
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution v4.9.2
4.9.2 4.9.1 4.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.3.0 4.3.1 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.6.8 4.6.9 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 4.8.7 4.8.8 4.8.9 trunk 0.1.2-beta 0.1.3-beta 0.1.4-beta 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.8.0 1.8.1 1.9.0
shopengine / libs / license / license-route.php
shopengine / libs / license Last commit date
helper.php 4 years ago license-route.php 5 days ago
license-route.php
101 lines
1 <?php
2
3 namespace ShopEngine\Libs\License;
4
5
6 class License_Route extends \ShopEngine\Base\Api {
7
8 public function config() {
9
10 $this->prefix = 'license';
11 $this->param = "";
12 $this->only_admin = true;
13 }
14
15
16 /**
17 * /shopengine-builder/v1/license/deactive
18 *
19 * http://localhost/shopengine/pro/wp-json/shopengine-builder/v1/license/post_deactive
20 */
21 public function post_deactive() {
22
23 // Check if user has administrator capabilities
24 if (!current_user_can('manage_options')) {
25 return [
26 'Status' => 'Fail',
27 'msg' => esc_html__('Sorry, you are not allowed to deactivate licenses.', 'shopengine'),
28 ];
29 }
30
31 $res = Helper::instance()->deactivate();
32
33 //wp_redirect('https://account.wpmet.com/?wpmet-screen=products'); exit;
34
35 return [
36 'success' => 'ok',
37 'msg' => esc_html__('Successfully deactivated', 'shopengine'),
38 ];
39 }
40
41 /**
42 * /shopengine-builder/v1/license/activate
43 *
44 * http://localhost/shopengine/pro/wp-json/shopengine-builder/v1/license/activate
45 */
46 public function post_activate() {
47
48 // Check if user has administrator capabilities
49 if (!current_user_can('manage_options')) {
50 return [
51 'Status' => 'Fail',
52 'msg' => esc_html__('Sorry, you are not allowed to activate licenses.', 'shopengine'),
53 ];
54 }
55
56 $data = json_decode($this->request->get_body(), true);
57
58 if(empty($data['license_key'])) {
59
60 return [
61 'success' => 'danger',
62 'dt' => $data,
63 'msg' => esc_html__('License key is empty', 'shopengine'),
64 ];
65 }
66
67 $res = Helper::instance()->activate($data['license_key']);
68
69 if(!empty($res->is_activated)) {
70
71 return [
72 'success' => 'ok',
73 'dt' => $res,
74 'msg' => esc_html__('Successfully activated', 'shopengine'),
75 ];
76 }
77
78 if(!empty($res->error)) {
79 return [
80 'success' => 'danger',
81 'msg' => $res->message,
82 ];
83 }
84
85 return [
86 'success' => 'danger',
87 'msg' => esc_html__('Unsupported pro version', 'shopengine'),
88 ];
89 }
90
91 /**
92 * /shopengine-builder/v1/license/test
93 *
94 * http://localhost/shopengine/pro/wp-json/shopengine-builder/v1/license/test
95 */
96 public function get_test() {
97
98 echo 'hello....';
99 }
100 }
101