PluginProbe
The Innovative Form Builder – IvyForms / 1.0
The Innovative Form Builder – IvyForms v1.0
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.0, at backend/src/Routes/Feedback/Feedback.php

59 lines 1.9 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\Vendor\DI\Container;
6 use IvyForms\Vendor\DI\DependencyException;
7 use IvyForms\Vendor\DI\NotFoundException;
8 use IvyForms\Controllers\Deactivation\SubmitDeactivationFeedbackController;
9 use WP_REST_Server;
10
11 /**
12 * Class Feedback
13 *
14 * @package IvyForms\Routes\Feedback
15 */
16 class Feedback
17 {
18 /**
19 * @throws DependencyException
20 * @throws NotFoundException
21 */
22 public static function registerRoutes(Container $container, string $routeNamespace): void
23 {
24 // Register deactivation feedback endpoint
25 register_rest_route(
26 $routeNamespace,
27 '/deactivation-feedback',
28 [
29 'methods' => WP_REST_Server::CREATABLE,
30 'callback' => $container->get(SubmitDeactivationFeedbackController::class),
31 'permission_callback' => function () {
32 // Require admin capabilities for deactivation feedback
33 return current_user_can('manage_options');
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