PluginProbe
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce / 1.3.13
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce v1.3.13
1.17.9 1.17.8 1.17.7 1.17.6 1.17.5 1.17.4 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.3.0 1.3.1 1.3.11 1.3.12 1.3.13 1.3.14 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 All 143 releases
erp / includes / api / class-utility-controller.php

class-utility-controller.php in ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce 1.3.13, at includes/api/class-utility-controller.php

55 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WeDevs\ERP\API;
3
4 use WP_Error;
5 use WP_REST_Response;
6 use WP_REST_Server;
7 class Utility_Controller extends REST_Controller {
8 /**
9 * Endpoint namespace.
10 *
11 * @var string
12 */
13 protected $namespace = 'erp/v1';
14
15 /**
16 * Route base.
17 *
18 * @var string
19 */
20 protected $rest_base = 'utility';
21
22 /**
23 * Register the routes for the objects of the controller.
24 */
25 public function register_routes() {
26 register_rest_route( $this->namespace, '/' . $this->rest_base .'/get-active-plugins', [
27 [
28 'methods' => WP_REST_Server::READABLE,
29 'callback' => [ $this, 'get_active_plugins' ],
30 'args' => $this->get_collection_params(),
31 'permission_callback' => function ( $request ) {
32 return current_user_can('erp_view_list' );
33 },
34 ],
35 'schema' => [ $this, 'get_public_item_schema' ],
36 ] );
37 }
38
39 /**
40 * Get the list of active plugins
41 *
42 * @since 1.3.0
43 *
44 * @param $request
45 *
46 * @return mixed|WP_REST_Response
47 */
48 public function get_active_plugins( $request ){
49 $active_plugins = get_option('active_plugins');
50 $response = rest_ensure_response( $active_plugins );
51
52 return $response;
53 }
54 }
55