]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - inc/3rdparty/PicoFarad/Request.php
3 namespace PicoFarad\Request
;
6 function param($name, $default_value = null)
8 return isset($_GET[$name]) ? $_GET[$name] : $default_value;
12 function int_param($name, $default_value = 0)
14 return isset($_GET[$name]) && ctype_digit($_GET[$name]) ? (int) $_GET[$name] : $default_value;
21 return isset($values[$name]) ? $values[$name] : null;
27 if (! empty($_POST)) {
32 $result = json_decode(body(), true);
44 return file_get_contents('php://input');
48 function file_content($field)
50 if (isset($_FILES[$field])) {
51 return file_get_contents($_FILES[$field]['tmp_name']);
58 function file_info($field)
60 if (isset($_FILES[$field])) {
62 'name' => $_FILES[$field]['name'],
63 'mimetype' => $_FILES[$field]['type'],
64 'size' => $_FILES[$field]['size'],
72 function file_move($field, $destination)
74 if (isset($_FILES[$field]) && ! file_exists($destination)) {
75 @mkdir(dirname($destination), 0777, true);
76 move_uploaded_file($_FILES[$field]['tmp_name'], $destination);