24 foreach ( $values as $key => $value ) {
25 $accessor=
"set" . ucfirst($key);
26 if (method_exists($object, $accessor)) {
27 $object->$accessor($value);
28 $object->_rest[$key]=$value;
38 public static function getPost($function=
"htmlentities") {
39 return array_map($function, $_POST);
47 \parse_str(\file_get_contents(
'php://input'), $put);
56 $method=\strtolower($_SERVER[
'REQUEST_METHOD']);
63 return self::getInput();
72 $headers=getallheaders();
73 if (isset($headers[
"content-type"])) {
74 return $headers[
"content-type"];
84 return (isset($_SERVER[
'HTTP_X_REQUESTED_WITH']) && !empty($_SERVER[
'HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER[
'HTTP_X_REQUESTED_WITH']) ==
'xmlhttprequest');
92 return $_SERVER[
'REQUEST_METHOD'] ===
'POST';
100 return stripos($_SERVER[
'HTTP_REFERER'], $_SERVER[
'SERVER_NAME']) === FALSE;
108 $contentType=self::getContentType();
109 return \stripos($contentType,
"json") !==
false;
118 public static function get($key, $default=NULL) {
119 return isset($_GET[$key]) ? $_GET[$key] : $default;
128 public static function post($key, $default=NULL) {
129 return isset($_POST[$key]) ? $_POST[$key] : $default;
134 $siteUrl=\rtrim($config[
"siteUrl"],
'/');
138 return $siteUrl . $url;
142 return \explode(
"/", $_GET[
"c"]);
150 return \strtolower($_SERVER[
'REQUEST_METHOD']);
static setValuesToObject($object, $values=null)
Affects member to member the values of the associative array $values to the members of the object $ob...
static getDatas()
Returns the query data, regardless of the method.
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 isCrossSite()
Returns true if the request is cross site.
static getMethod()
Returns the http method.
static isPost()
Returns true if the request is sent by the POST method.
static isJSON()
Returns true if request contentType is set to json.
static getPost($function="htmlentities")
Call a cleaning function on the post.
static getContentType()
Returns the request content-type header.
static isAjax()
Returns true if the request is an Ajax request.
static startswith($hay, $needle)
static getInput()
Returns the query data, for PUT, DELETE PATCH methods.