|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* Copyright © 2021 ExacTI Technology Solutions. All rights reserved.
|
|
|
|
* GPLv3 General License.
|
|
|
|
* https://exacti.com.br
|
|
|
|
* Phacil PHP Framework - https://github.com/exacti/phacil-framework
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Phacil\Framework;
|
|
|
|
|
|
|
|
final class Request {
|
PHP SESSION Prefix and IP check, engine constants and user_constants as a function for better memory usage, add SQLite 3 driver, new loader for aditional database method, new REST HTPP method check, updated template engines: Mustache 2.13, Smarty 3.1.34, Twig 1.42.5, Twig 2.12.5, add Twig 3 support to PHP 7.2+, define Dwoo template as deprecated, Caches and captcha bugfix in PHP 5.4.x
5 years ago
|
|
|
public $get = array();
|
|
|
|
public $post = array();
|
|
|
|
public $cookie = array();
|
|
|
|
public $files = array();
|
|
|
|
public $server = array();
|
|
|
|
public $method;
|
|
|
|
|
PHP SESSION Prefix and IP check, engine constants and user_constants as a function for better memory usage, add SQLite 3 driver, new loader for aditional database method, new REST HTPP method check, updated template engines: Mustache 2.13, Smarty 3.1.34, Twig 1.42.5, Twig 2.12.5, add Twig 3 support to PHP 7.2+, define Dwoo template as deprecated, Caches and captcha bugfix in PHP 5.4.x
5 years ago
|
|
|
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;
|
|
|
|
$this->method = (isset($this->server['REQUEST_METHOD'])) ? $this->clean($this->server['REQUEST_METHOD']) : false;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isPOST() {
|
|
|
|
return $this->is('POST');
|
|
|
|
}
|
|
|
|
public function isGET() {
|
|
|
|
return $this->is('GET');
|
|
|
|
}
|
|
|
|
public function isHEAD() {
|
|
|
|
return $this->is('HEAD');
|
|
|
|
}
|
|
|
|
public function isPUT() {
|
|
|
|
return $this->is('PUT');
|
|
|
|
}
|
|
|
|
public function isDELETE() {
|
|
|
|
return $this->is('DELETE');
|
|
|
|
}
|
|
|
|
public function isCONNECT() {
|
|
|
|
return $this->is('CONNECT') ;
|
|
|
|
}
|
|
|
|
public function isOPTIONS() {
|
|
|
|
return $this->is('OPTIONS') ;
|
|
|
|
}
|
|
|
|
public function isTRACE() {
|
|
|
|
return $this->is('TRACE');
|
|
|
|
}
|
|
|
|
public function isPATCH() {
|
|
|
|
return $this->is('PATCH');
|
|
|
|
}
|
|
|
|
public function is($method){
|
|
|
|
return ($this->method == $method) ? true : false;
|
|
|
|
}
|
|
|
|
}
|