Add poll system for Patrons Circle

This commit is contained in:
Alex Cabal 2022-06-29 16:51:45 -05:00
parent 3555d53615
commit 2ef5ce6551
44 changed files with 717 additions and 98 deletions

View file

@ -1,5 +1,30 @@
<?
use function Safe\preg_match;
class HttpInput{
public static function RequestMethod(): int{
$method = $_POST['_method'] ?? $_SERVER['REQUEST_METHOD'];
switch($method){
case 'POST':
return HTTP_POST;
case 'PUT':
return HTTP_PUT;
case 'DELETE':
return HTTP_DELETE;
case 'PATCH':
return HTTP_PATCH;
case 'HEAD':
return HTTP_HEAD;
}
return HTTP_GET;
}
public static function RequestType(): int{
return preg_match('/\btext\/html\b/ius', $_SERVER['HTTP_ACCEPT']) ? WEB : REST;
}
public static function Str(string $type, string $variable, bool $allowEmptyString = true, string $default = null): ?string{
$var = self::GetHttpVar($variable, HTTP_VAR_STR, $type, $default);