PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.7.7
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.7.7
2.11.0 2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 All 78 releases
fluent-community / vendor / wpfluent / framework / src / WPFluent / Http / Request / InteractsWithCleaningTrait.php

InteractsWithCleaningTrait.php in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses 2.7.7, at vendor/wpfluent/framework/src/WPFluent/Http/Request/InteractsWithCleaningTrait.php

61 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCommunity\Framework\Http\Request;
4
5 trait InteractsWithCleaningTrait
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
58 return stripslashes_deep($value);
59 }
60 }
61