PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Routes / Feedback / Feedback.php

Feedback.php in The Innovative Form Builder – IvyForms 1.5, at backend/src/Routes/Feedback/Feedback.php

59 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IvyForms\Routes\Feedback;
4
5 use IvyForms\Services\Permissions\IvyFormsAccess;
6 use IvyForms\Vendor\DI\Container;
7 use IvyForms\Vendor\DI\DependencyException;
8 use IvyForms\Vendor\DI\NotFoundException;
9 use IvyForms\Controllers\Deactivation\SubmitDeactivationFeedbackController;
10 use WP_REST_Server;
11
12 /**
13 * Class Feedback
14 *
15 * @package IvyForms\Routes\Feedback
16 */
17 class Feedback
18 {
19 /**
20 * @throws DependencyException
21 * @throws NotFoundException
22 */
23 public static function registerRoutes(Container $container, string $routeNamespace): void
24 {
25 // Register deactivation feedback endpoint
26 register_rest_route(
27 $routeNamespace,
28 '/deactivation-feedback',
29 [
30 'methods' => WP_REST_Server::CREATABLE,
31 'callback' => $container->get(SubmitDeactivationFeedbackController::class),
32 'permission_callback' => function () {
33 return IvyFormsAccess::canAccessPluginAdminRoutes();
34 },
35 'args' => [
36 'api_version' => [
37 'required' => false,
38 'validate_callback' => function ($param) {
39 return is_string($param);
40 }
41 ],
42 'feedback_key' => [
43 'required' => true,
44 'validate_callback' => function ($param) {
45 return is_string($param) && !empty($param);
46 }
47 ],
48 'feedback' => [
49 'required' => false,
50 'validate_callback' => function ($param) {
51 return is_string($param);
52 }
53 ]
54 ]
55 ]
56 );
57 }
58 }
59