PluginProbe
The Innovative Form Builder – IvyForms / 1.1
The Innovative Form Builder – IvyForms v1.1
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 / Confirmation / Confirmation.php

Confirmation.php in The Innovative Form Builder – IvyForms 1.1, at backend/src/Routes/Confirmation/Confirmation.php

71 lines 2.3 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\Confirmation;
4
5 use IvyForms\Vendor\DI\Container;
6 use IvyForms\Vendor\DI\DependencyException;
7 use IvyForms\Vendor\DI\NotFoundException;
8 use IvyForms\Controllers\Confirmation\AddConfirmationController;
9 use IvyForms\Controllers\Confirmation\GetConfirmationsController;
10 use IvyForms\Controllers\Confirmation\GetConformationController;
11 use IvyForms\Controllers\Confirmation\UpdateConfirmationController;
12 use WP_REST_Server;
13
14 class Confirmation
15 {
16 /**
17 * @throws DependencyException
18 * @throws NotFoundException
19 */
20 public static function registerRoutes(Container $container, string $routeNamespace): void
21 {
22 register_rest_route(
23 $routeNamespace,
24 '/confirmation/(?P<id>\d+)',
25 [
26 'methods' => WP_REST_Server::READABLE,
27 'callback' => $container->get(GetConformationController::class),
28 'permission_callback' => function () {
29 return current_user_can('manage_options');
30 },
31 ]
32 );
33
34 register_rest_route(
35 $routeNamespace,
36 '/confirmations/(?P<id>\d+)',
37 [
38 'methods' => WP_REST_Server::READABLE,
39 'callback' => $container->get(GetConfirmationsController::class),
40 'permission_callback' => function () {
41 return current_user_can('manage_options');
42 },
43 ]
44 );
45
46 register_rest_route(
47 $routeNamespace,
48 '/confirmation/add/',
49 [
50 'methods' => WP_REST_Server::CREATABLE,
51 'callback' => $container->get(AddConfirmationController::class),
52 'permission_callback' => function () {
53 return current_user_can('manage_options');
54 }
55 ]
56 );
57
58 register_rest_route(
59 $routeNamespace,
60 '/confirmation/update/(?P<id>\d+)',
61 [
62 'methods' => WP_REST_Server::CREATABLE,
63 'callback' => $container->get(UpdateConfirmationController::class),
64 'permission_callback' => function () {
65 return current_user_can('manage_options');
66 }
67 ]
68 );
69 }
70 }
71