PluginProbe
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More / 2.1.0
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More v2.1.0
2.3.0 2.2.0 2.1.1 2.1.0 2.0.0 1.10.0 1.9.1 1.9.0 1.2.1 1.2.2 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 All 59 releases
storeengine / includes / api.php

api.php in StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More 2.1.0, at includes/api.php

56 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace StoreEngine;
4
5 use StoreEngine;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly.
9 }
10
11
12 class API {
13
14 public static function init() {
15 $self = new self();
16
17 API\Product::init();
18 API\Orders::init();
19 API\cart::init();
20 API\MiniCart::init();
21 API\Payment::init();
22 API\Analytics::init();
23 API\Customer::init();
24 API\Settings::init();
25 API\Taxes::init();
26 API\Shipping::init();
27 API\Coupon::init();
28 API\Logs::init();
29 API\EmailLog::init();
30 API\Checkout::init();
31 API\PaymentMethods::init();
32 API\StorefrontAuth::init();
33 API\Me::init();
34 API\MeSubscriptions::init();
35 API\BundleSync::init();
36
37
38 add_filter( 'rest_api_init', [ $self, 'api_init' ] );
39 add_filter( 'user_has_cap', array( $self, 'update_user_cap' ), 10, 3 );
40 }
41
42 public function api_init() {
43 // @TODO move to specific api where cart is needed.
44 StoreEngine::init()->load_cart();
45 }
46
47 public function update_user_cap( $all_caps, $cap, $args ) {
48 if ( isset( $all_caps['edit_posts'] ) && $all_caps['edit_posts'] ) {
49 $all_caps['edit_post_meta'] = true;
50 $all_caps['delete_post_meta'] = true;
51 }
52
53 return $all_caps;
54 }
55 }
56