PluginProbe
WPIDE – File Manager & Code Editor / 3.3
WPIDE – File Manager & Code Editor v3.3
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
wpide / App / Kernel / Request.php

Request.php in WPIDE – File Manager & Code Editor 3.3, at App/Kernel/Request.php

48 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 WPIDE\App\Kernel;
4
5 use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
6
7 class Request extends SymfonyRequest
8 {
9 public function input($key, $default = null)
10 {
11 // first try GET, then POST
12 $value = $this->get($key, $this->query->get($key));
13
14 // then look into JSON content, fallback to default
15 if ($value === null) {
16 $content = json_decode((string) $this->getContent());
17 $value = isset($content->{$key}) ? $content->{$key} : $default;
18 }
19
20 return $value;
21 }
22
23 public function all(): array
24 {
25 $params = [];
26
27 // first look into JSON content
28 $content = json_decode((string) $this->getContent());
29 if (! empty($content)) {
30 foreach ($content as $key => $param) {
31 $params[$key] = $param;
32 }
33 }
34
35 // then try (and override) with POST
36 foreach ($this->request as $key => $param) {
37 $params[$key] = $param;
38 }
39
40 // finally try (and override) with GET
41 foreach ($this->query as $key => $param) {
42 $params[$key] = $param;
43 }
44
45 return $params;
46 }
47 }
48