PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.3.2
Fluent Support – Helpdesk & Customer Support Ticket System v2.3.2
2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 68 releases
fluent-support / app / Http / Requests / TicketCreateCustomerPortalRequest.php

TicketCreateCustomerPortalRequest.php in Fluent Support – Helpdesk & Customer Support Ticket System 2.3.2, at app/Http/Requests/TicketCreateCustomerPortalRequest.php

56 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentSupport\App\Http\Requests;
4
5 use FluentSupport\Framework\Foundation\RequestGuard;
6
7 class TicketCreateCustomerPortalRequest extends RequestGuard
8 {
9 /**
10 * @return array
11 */
12 public function rules()
13 {
14 return [
15 'title' => 'required',
16 'content' => 'required'
17 ];
18 }
19
20 /**
21 * @return array
22 */
23 public function messages()
24 {
25 return [
26 'title.required' => __('Ticket title is required', 'fluent-support'),
27 'content.required' => __('Ticket content is required', 'fluent-support')
28 ];
29 }
30
31 public function sanitize()
32 {
33 $data = $this->all();
34
35 $sanitizeRules = [
36 'title' => 'sanitize_text_field',
37 'content' => 'wp_kses_post',
38 'product_id' => 'intval',
39 'client_priority' => 'sanitize_text_field'
40 ];
41
42 if( $data && is_array($data) ) {
43 foreach ($data as $dataKey => $dataItem) {
44 $sanitizeFunc = isset($sanitizeRules[$dataKey]) ? $sanitizeRules[$dataKey]: 'sanitize_text_field';
45 if(is_array($dataItem)) {
46 $data[$dataKey] = map_deep($dataItem, $sanitizeFunc);
47 } else {
48 $data[$dataKey] = $sanitizeFunc($dataItem);
49 }
50 }
51 }
52
53 return $data;
54 }
55 }
56