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 / ProductDownloadable / ProductDownloadableBulkFileRequest.php

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

72 lines 3.1 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\ProductDownloadable;
4
5 use FluentCart\Framework\Foundation\RequestGuard;
6
7 class ProductDownloadableBulkFileRequest extends RequestGuard
8 {
9
10 /**
11 * @return array
12 */
13 public function rules(): array
14 {
15
16 return [
17 'downloadable_files' => 'nullable|array',
18 'downloadable_files.*.title' => 'required|sanitizeText|maxLength:160',
19 'downloadable_files.*.type' => 'required|sanitizeText|maxLength:100',
20 'downloadable_files.*.driver' => 'required|sanitizeText|maxLength:60',
21 'downloadable_files.*.file_name' => 'required|sanitizeText|maxLength:185',
22 'downloadable_files.*.file_path' => 'required|sanitizeText|maxLength:185',
23 'downloadable_files.*.file_url' => 'nullable|sanitizeText|maxLength:200',
24 'downloadable_files.*.settings.download_limit' => 'nullable|numeric',
25 'downloadable_files.*.settings.download_expiry' => 'nullable|numeric',
26 ];
27 }
28
29
30 /**
31 * @return array
32 */
33 public function messages(): array
34 {
35 return [
36 'downloadable_files.*.title.required' => esc_html__('Title is required.', 'fluent-cart'),
37 'downloadable_files.*.type.required' => esc_html__('Type is required.', 'fluent-cart'),
38 'downloadable_files.*.driver.required' => esc_html__('Driver is required.', 'fluent-cart'),
39 'downloadable_files.*.file_name.required' => esc_html__('File Name is required.', 'fluent-cart'),
40 'downloadable_files.*.file_path.required' => esc_html__('File Path is required.', 'fluent-cart'),
41 ];
42 }
43
44
45 /**
46 * @return array
47 */
48 public function sanitize()
49 {
50
51 return [
52 'downloadable_files.*.id' => 'intval',
53 //'downloadable_files.*.post_id' => 'intval',
54 'downloadable_files.*.product_variation_id' => 'sanitize_text_field',
55 //'downloadable_files.*.download_identifier' => 'sanitize_text_field',
56 'downloadable_files.*.title' => 'sanitize_text_field',
57 'downloadable_files.*.type' => 'sanitize_text_field',
58 'downloadable_files.*.driver' => 'sanitize_text_field',
59 'downloadable_files.*.bucket' => 'sanitize_text_field',
60 'downloadable_files.*.file_name' => 'sanitize_text_field',
61 'downloadable_files.*.file_path' => 'sanitize_text_field',
62 'downloadable_files.*.file_url' => 'sanitize_text_field',
63 'downloadable_files.*.file_size' => 'sanitize_text_field',
64 'downloadable_files.*.settings' => 'wp_kses_post',
65 'downloadable_files.*.serial' => 'intval',
66 //'downloadable_files.*.created_at' => 'sanitize_text_field',
67 //'downloadable_files.*.updated_at' => 'sanitize_text_field',
68 ];
69
70 }
71 }
72