Commit 5b6a48a63b762086eeaeace691f6ffde7b12b947
- Diff rendering mode:
- inline
- side by side
Request.php
(21 / 1)
|   | |||
| 20 | 20 | $_method, | |
| 21 | 21 | $_xhr, | |
| 22 | 22 | $_reload, | |
| 23 | $_fromElsewhere; | ||
| 23 | $_fromElsewhere, | ||
| 24 | $_headers, | ||
| 25 | $_body; | ||
| 24 | 26 | ||
| 25 | 27 | public static function getInstance () | |
| 26 | 28 | { | |
| … | … | ||
| 64 | 64 | $this->_xhr = null; | |
| 65 | 65 | $this->_reload = null; | |
| 66 | 66 | $this->_fromElsewhere = null; | |
| 67 | $this->_headers = null; | ||
| 68 | $this->_body = null; | ||
| 67 | 69 | } | |
| 68 | 70 | ||
| 69 | 71 | public function getController () | |
| … | … | ||
| 184 | 184 | $this->_fromElsewhere = (!isset($_SERVER['HTTP_REFERER']) || | |
| 185 | 185 | strpos($_SERVER['HTTP_REFERER'], 'http://'.$_SERVER['HTTP_HOST']) === false); | |
| 186 | 186 | return $this->_fromElsewhere; | |
| 187 | } | ||
| 188 | |||
| 189 | public function getHeaders () | ||
| 190 | { | ||
| 191 | if ($this->_headers === null) | ||
| 192 | foreach ($_SERVER as $k => $v) | ||
| 193 | if (substr($k, 0, 5) == 'HTTP_') | ||
| 194 | $this->_headers[substr($k, 5)] = $v; | ||
| 195 | return $this->_headers; | ||
| 196 | } | ||
| 197 | |||
| 198 | public function getBody () | ||
| 199 | { | ||
| 200 | if ($this->_body === null) | ||
| 201 | $this->_body = file_get_contents('php://input'); | ||
| 202 | return $this->_body; | ||
| 187 | 203 | } | |
| 188 | 204 | ||
| 189 | 205 | } |

