views
5 months ago
MediaAccessControl.php
3 hours ago
MediaHandler.php
4 years ago
RestAPI.php
4 years ago
RestAPI.php
58 lines
| 1 | <?php |
| 2 | /** |
| 3 | * User: shahnuralam |
| 4 | * Date: 8/12/18 |
| 5 | * Time: 2:17 AM |
| 6 | */ |
| 7 | |
| 8 | namespace WPDM\MediaLibrary; |
| 9 | |
| 10 | |
| 11 | class RestAPI |
| 12 | { |
| 13 | function __construct() |
| 14 | { |
| 15 | add_action('rest_api_init', array($this, 'introduceEndpoints')); |
| 16 | } |
| 17 | |
| 18 | function introduceEndpoints() |
| 19 | { |
| 20 | |
| 21 | //wpdm/v1/search-package |
| 22 | register_rest_route('wpdm', '/media-access', array( |
| 23 | 'methods' => 'GET', |
| 24 | 'callback' => [$this, 'mediaAccess'], |
| 25 | 'permission_callback' => function () { |
| 26 | return current_user_can(WPDM_ADMIN_CAP); |
| 27 | } |
| 28 | )); |
| 29 | |
| 30 | /*register_rest_route('wpdm/v1', '/create-term', array( |
| 31 | 'methods' => 'GET', |
| 32 | 'callback' => [$this, 'createTerm'], |
| 33 | 'permission_callback' => function () { |
| 34 | return current_user_can(WPDM_ADMIN_CAP); |
| 35 | } |
| 36 | ));*/ |
| 37 | |
| 38 | /*//wpdm/v1/link-templates |
| 39 | register_rest_route( 'wpdm/v1', '/link-templates', array( |
| 40 | 'methods' => 'GET', |
| 41 | 'callback' => array($this, 'linkTemplates'), |
| 42 | ) ); |
| 43 | |
| 44 | //wpdm/v1/categories |
| 45 | register_rest_route( 'wpdm/v1', '/categories', array( |
| 46 | 'methods' => 'GET', |
| 47 | 'callback' => array($this, 'categories'), |
| 48 | ) );*/ |
| 49 | } |
| 50 | |
| 51 | function mediaAccess() |
| 52 | { |
| 53 | if (wpdm_query_var('mediaid', 'int') > 0) { |
| 54 | |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 |