views
2 days ago
FileList.php
4 years ago
Hooks.php
3 years ago
Package.php
1 year ago
PackageController.php
6 months ago
PackageLocks.php
5 months ago
PackageTemplate.php
4 years ago
RestAPI.php
3 years ago
Shortcodes.php
2 days ago
RestAPI.php
44 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace WPDM\Package; |
| 5 | |
| 6 | |
| 7 | class RestAPI |
| 8 | { |
| 9 | |
| 10 | function __construct() |
| 11 | { |
| 12 | add_action('rest_api_init', array($this, 'introduceEndpoints')); |
| 13 | } |
| 14 | |
| 15 | function introduceEndpoints() |
| 16 | { |
| 17 | |
| 18 | register_rest_route('wpdm', '/validate-captcha', array( |
| 19 | 'methods' => 'POST', |
| 20 | 'callback' => [new PackageLocks(), 'validateCaptcha'], |
| 21 | 'permission_callback' => '__return_true' |
| 22 | )); |
| 23 | |
| 24 | register_rest_route('wpdm', '/validate-password', array( |
| 25 | 'methods' => 'POST', |
| 26 | 'callback' => [new PackageLocks(), 'validatePassword'], |
| 27 | 'permission_callback' => '__return_true' |
| 28 | )); |
| 29 | |
| 30 | register_rest_route('wpdm', '/search', array( |
| 31 | 'methods' => 'GET', |
| 32 | 'callback' => [new PackageController(), 'search'], |
| 33 | 'permission_callback' => '__return_true' |
| 34 | )); |
| 35 | |
| 36 | register_rest_route('wpdm', '/view-count', array( |
| 37 | 'methods' => 'POST', |
| 38 | 'callback' => [new PackageController(), 'addViewCount'], |
| 39 | 'permission_callback' => '__return_true' |
| 40 | )); |
| 41 | |
| 42 | } |
| 43 | } |
| 44 |