PluginProbe
WPIDE – File Manager & Code Editor / trunk
WPIDE – File Manager & Code Editor vtrunk
3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 3.3 3.4 All 54 releases
← All changes | App/Kernel/Request.php +35 -0 3.1trunk View file →
@@ -19,8 +19,43 @@
19 19
20 20 return $value;
21 21 }
22 22
23 + public function textInput($key, $default = null):? string
24 + {
25 +
26 + $value = $this->input($key, $default);
27 + return $value ? sanitize_text_field($value) : $value;
28 + }
29 +
30 + public function boolInput($key, $default = null):? bool
31 + {
32 +
33 + $value = $this->input($key, $default);
34 + return $value ? (bool) $value : $value;
35 + }
36 +
37 + public function intInput($key, $default = null):? int
38 + {
39 +
40 + $value = $this->input($key, $default);
41 + return $value ? intval($value) : $value;
42 + }
43 +
44 + public function floatInput($key, $default = null):? float
45 + {
46 +
47 + $value = $this->input($key, $default);
48 + return $value ? floatval($value) : $value;
49 + }
50 +
51 + public function enumInput($key, $enumValues = [], $default = null):? string
52 + {
53 +
54 + $value = $this->textInput($key, $default);
55 + return in_array($value, $enumValues) ? $value : null;
56 + }
57 +
23 58 public function all(): array
24 59 {
25 60 $params = [];
26 61