PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / trunk
Fluent Support – Helpdesk & Customer Support Ticket System vtrunk
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 1.5.6 All 67 releases
fluent-support / app / Http / Requests / TicketResponseRequest.php

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

58 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 TicketResponseRequest extends RequestGuard
8 {
9 /**
10 * @return array
11 */
12 public function rules()
13 {
14 return [
15 'content' => 'required'
16 ];
17 }
18
19 /**
20 * @return array
21 */
22 public function messages()
23 {
24 return [
25 'content.required' => __('Reply content is required', 'fluent-support')
26 ];
27 }
28
29 public function sanitize()
30 {
31 $data = $this->all();
32
33 $sanitizeRules = [
34 'content' => 'wp_kses_post',
35 'conversation_type' => 'sanitize_text_field',
36 'close_ticket' => 'sanitize_text_field',
37 'ticket_id' => 'intval',
38 'informational_reply' => 'rest_sanitize_boolean'
39 ];
40
41 if( $data && is_array($data) ) {
42 foreach ($data as $dataKey => $dataItem) {
43 $sanitizeFunc = isset($sanitizeRules[$dataKey]) ? $sanitizeRules[$dataKey]: 'sanitize_text_field';
44
45 if(is_array($dataItem)) {
46 $data[$dataKey] = map_deep($dataItem, $sanitizeFunc);
47 } else {
48 $data[$dataKey] = $sanitizeFunc($dataItem);
49 }
50 }
51
52 return $data;
53 }
54
55 return sanitize_text_field($data);
56 }
57 }
58