PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.15.5
GiveWP – Donation Plugin and Fundraising Platform v4.15.5
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / FormBuilder / EmailPreview / Routes / routes.php

routes.php in GiveWP – Donation Plugin and Fundraising Platform 4.15.5, at src/FormBuilder/EmailPreview/Routes/routes.php

63 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 use Give\FormBuilder\EmailPreview\Controllers\SendEmailPreview;
4 use Give\FormBuilder\EmailPreview\Controllers\ShowEmailPreview;
5 use Give\Framework\Permissions\Facades\UserPermissions;
6
7 return [
8
9 /*
10 |--------------------------------------------------------------------------
11 | Show the HTML of the email preview
12 |--------------------------------------------------------------------------
13 |
14 */
15
16 'show' => [
17 'methods' => WP_REST_Server::CREATABLE,
18 'callback' => [give(ShowEmailPreview::class), '__invoke'],
19 'permission_callback' => function () {
20 return UserPermissions::donationForms()->canEdit();
21 },
22 'args' => [
23 'email_type' => [
24 'required' => true,
25 'type' => 'string',
26 'sanitize_callback' => 'sanitize_text_field',
27 ],
28 'form_id' => [
29 'required' => true,
30 'type' => 'string',
31 'sanitize_callback' => 'absint',
32 ],
33 ],
34 ],
35
36 /*
37 |--------------------------------------------------------------------------
38 | Send the email preview to a specified address
39 |--------------------------------------------------------------------------
40 |
41 */
42
43 'send' => [
44 'methods' => WP_REST_Server::CREATABLE,
45 'callback' => [give(SendEmailPreview::class), '__invoke'],
46 'permission_callback' => function () {
47 return UserPermissions::donationForms()->canEdit();
48 },
49 'args' => [
50 'email_type' => [
51 'required' => true,
52 'type' => 'string',
53 'sanitize_callback' => 'sanitize_text_field',
54 ],
55 'email_address' => [
56 'required' => true,
57 'type' => 'string',
58 'sanitize_callback' => 'sanitize_email',
59 ],
60 ],
61 ],
62 ];
63