PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.3
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.3
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / vendor / wpfluent / framework / src / WPFluent / Request / Cleaner.php

Cleaner.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.3, at vendor/wpfluent/framework/src/WPFluent/Request/Cleaner.php

65 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\Framework\Request;
4
5 trait Cleaner
6 {
7 /**
8 * Clean up the request data.
9 *
10 * @param array $data
11 * @return array
12 */
13 public function clean($data)
14 {
15 return $this->cleanArray($data);
16 }
17
18 /**
19 * Clean the data in the given array.
20 *
21 * @param array $data
22 * @return array
23 */
24 protected function cleanArray(array $data)
25 {
26 return array_map(function ($value) {
27 return $this->cleanValue($value);
28 }, $data);
29 }
30
31 /**
32 * Clean the given value.
33 *
34 * @param mixed $value
35 * @return mixed
36 */
37 protected function cleanValue($value)
38 {
39 if (is_array($value)) {
40 return $this->cleanArray($value);
41 }
42
43 return $this->transform($value);
44 }
45
46 /**
47 * Transform the given value.
48 *
49 * @param mixed $value
50 * @return mixed
51 */
52 protected function transform($value)
53 {
54 if (is_string($value)) {
55 $value = trim($value);
56
57 if ($value === '') {
58 $value = null;
59 }
60 }
61
62 return stripslashes_deep($value);
63 }
64 }
65