23 foreach ( $values as $key => $value ) {
24 $accessor=
"set" . ucfirst($key);
25 if (method_exists($object, $accessor)) {
26 $object->$accessor($value);
27 $object->_rest[$key]=$value;
37 public static function getPost($function=
"htmlentities") {
38 return array_map($function, $_POST);
46 \parse_str(\file_get_contents(
'php://input'), $put);
55 $method=\strtolower($_SERVER[
'REQUEST_METHOD']);
62 return self::getInput();
71 $headers=getallheaders();
72 if(isset($headers[
"content-type"])){
73 return $headers[
"content-type"];
83 return (isset($_SERVER[
'HTTP_X_REQUESTED_WITH']) && !empty($_SERVER[
'HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER[
'HTTP_X_REQUESTED_WITH']) ==
'xmlhttprequest');
91 return $_SERVER[
'REQUEST_METHOD'] ===
'POST';
99 return stripos($_SERVER[
'HTTP_REFERER'],$_SERVER[
'SERVER_NAME'])===FALSE;
107 $contentType=self::getContentType();
108 return \stripos($contentType,
"json")!==
false;
117 public static function get($key, $default=NULL) {
118 return isset($_GET[$key]) ? $_GET[$key] : $default;
127 public static function post($key, $default=NULL) {
128 return isset($_POST[$key]) ? $_POST[$key] : $default;
136 return $config[
"siteUrl"] . $url;
140 return \explode(
"/", $_GET[
"c"]);
148 return \strtolower($_SERVER[
'REQUEST_METHOD']);
static isJSON()
Returns true if request contentType is set to json.
static isPost()
Returns true if the request is sent by the POST method.
static getContentType()
Returns the request content-type header.
static getPost($function="htmlentities")
Call a cleaning function on the post.
static isCrossSite()
Returns true if the request is cross site.
static post($key, $default=NULL)
Returns the value of the $key variable passed by the post method or $default if the $key variable doe...
static setValuesToObject($object, $values=null)
Affects member to member the values of the associative array $values to the members of the object $ob...
static isAjax()
Returns true if the request is an Ajax request.
static getDatas()
Returns the query data, regardless of the method.
static startswith($hay, $needle)
static getMethod()
Returns the http method.
static getInput()
Returns the query data, for PUT, DELETE PATCH methods.