PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.4
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.4
1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk 1.2.0 All 47 releases
fluent-cart / app / Http / Requests / EmailSettingsRequest.php

EmailSettingsRequest.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.4, at app/Http/Requests/EmailSettingsRequest.php

58 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 FluentCart\App\Http\Requests;
4
5 use FluentCart\Framework\Foundation\RequestGuard;
6
7 class EmailSettingsRequest extends RequestGuard
8 {
9 public function rules(): array
10 {
11 return [
12 'from_name' => 'required|sanitizeText|maxLength:255',
13 'from_email' => 'required|email|maxLength:255',
14 'reply_to_name' => 'nullable|sanitizeText|maxLength:255',
15 'reply_to_email' => 'nullable|email|maxLength:255',
16 'email_footer' => 'nullable|string',
17 'admin_email' => 'required|string',
18 'show_email_footer' => 'nullable|string',
19 ];
20 }
21
22 public function messages(): array
23 {
24 return [
25 'from_name.required' => __('From Name field is required.', 'fluent-cart'),
26 'from_email.required' => __('From Email field is required.', 'fluent-cart'),
27 'from_email.email' => __('From Email must be a valid email address.', 'fluent-cart'),
28 'reply_to_email.email' => __('Reply To Email must be a valid email address.', 'fluent-cart'),
29 'admin_email.required' => __('Admin Email field is required.', 'fluent-cart')
30 ];
31 }
32
33 public function sanitize(): array
34 {
35 return [
36 'from_name' => 'sanitize_text_field',
37 'from_email' => function ($value) {
38 if(empty($value)) {
39 return '';
40 }
41
42 return sanitize_email($value);
43 },
44 'reply_to_name' => 'sanitize_text_field',
45 'reply_to_email' => function ($value) {
46 if(empty($value)) {
47 return '';
48 }
49
50 return sanitize_email($value);
51 },
52 'email_footer' => 'wp_kses_post',
53 'admin_email' => 'sanitize_text_field',
54 'show_email_footer' => 'sanitize_text_field',
55 ];
56 }
57 }
58