PluginProbe
The Innovative Form Builder – IvyForms / 0.5
The Innovative Form Builder – IvyForms v0.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 / Confirmation / Confirmation.php

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

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