A super easy PHP Framework for web development!
https://github.com/exacti/phacil-framework
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
896 B
39 lines
896 B
6 years ago
|
<?php
|
||
|
final class Request {
|
||
|
public $get = array();
|
||
|
public $post = array();
|
||
|
public $cookie = array();
|
||
|
public $files = array();
|
||
|
public $server = array();
|
||
|
|
||
|
public function __construct() {
|
||
|
$_GET = $this->clean($_GET);
|
||
|
$_POST = $this->clean($_POST);
|
||
|
$_REQUEST = $this->clean($_REQUEST);
|
||
|
$_COOKIE = $this->clean($_COOKIE);
|
||
|
$_FILES = $this->clean($_FILES);
|
||
|
$_SERVER = $this->clean($_SERVER);
|
||
|
|
||
|
$this->get = $_GET;
|
||
|
$this->post = $_POST;
|
||
|
$this->request = $_REQUEST;
|
||
|
$this->cookie = $_COOKIE;
|
||
|
$this->files = $_FILES;
|
||
|
$this->server = $_SERVER;
|
||
|
}
|
||
|
|
||
|
public function clean($data) {
|
||
|
if (is_array($data)) {
|
||
|
foreach ($data as $key => $value) {
|
||
|
unset($data[$key]);
|
||
|
|
||
|
$data[$this->clean($key)] = $this->clean($value);
|
||
|
}
|
||
|
} else {
|
||
|
$data = htmlspecialchars($data, ENT_COMPAT);
|
||
|
}
|
||
|
|
||
|
return $data;
|
||
|
}
|
||
|
}
|
||
|
?>
|