PluginProbe
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets / 4.1.0
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets v4.1.0
4.9.5 4.9.4 4.9.3 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 All 85 releases
shopengine / libs / license / license-route.php
license-route.php
84 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 }
13
14
15 /**
16 * /shopengine-builder/v1/license/deactive
17 *
18 * http://localhost/shopengine/pro/wp-json/shopengine-builder/v1/license/post_deactive
19 */
20 public function post_deactive() {
21
22 $res = Helper::instance()->deactivate();
23
24 //wp_redirect('https://account.wpmet.com/?wpmet-screen=products'); exit;
25
26 return [
27 'success' => 'ok',
28 'msg' => esc_html__('Successfully deactivated', 'shopengine'),
29 ];
30 }
31
32 /**
33 * /shopengine-builder/v1/license/activate
34 *
35 * http://localhost/shopengine/pro/wp-json/shopengine-builder/v1/license/activate
36 */
37 public function post_activate() {
38
39 $data = json_decode($this->request->get_body(), true);
40
41 if(empty($data['license_key'])) {
42
43 return [
44 'success' => 'danger',
45 'dt' => $data,
46 'msg' => esc_html__('License key is empty', 'shopengine'),
47 ];
48 }
49
50 $res = Helper::instance()->activate($data['license_key']);
51
52 if(!empty($res->is_activated)) {
53
54 return [
55 'success' => 'ok',
56 'dt' => $res,
57 'msg' => esc_html__('Successfully activated', 'shopengine'),
58 ];
59 }
60
61 if(!empty($res->error)) {
62 return [
63 'success' => 'danger',
64 'msg' => $res->message,
65 ];
66 }
67
68 return [
69 'success' => 'danger',
70 'msg' => esc_html__('Unsupported pro version', 'shopengine'),
71 ];
72 }
73
74 /**
75 * /shopengine-builder/v1/license/test
76 *
77 * http://localhost/shopengine/pro/wp-json/shopengine-builder/v1/license/test
78 */
79 public function get_test() {
80
81 echo 'hello....';
82 }
83 }
84