diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2014-07-12 16:39:31 +0200 |
---|---|---|
committer | Nicolas Lœuillet <nicolas@loeuillet.org> | 2014-07-12 16:39:31 +0200 |
commit | 26b77483ee7545c0e4f8eeb205a5743bf3589adb (patch) | |
tree | 4a1da42493bcf2f16ef6373d7955dad5ff5eda45 /inc/3rdparty/PicoFarad/Request.php | |
parent | b3cda72e93fff3a4c3476e9e7e78ef2b2a3f02b9 (diff) | |
download | wallabag-26b77483ee7545c0e4f8eeb205a5743bf3589adb.tar.gz wallabag-26b77483ee7545c0e4f8eeb205a5743bf3589adb.tar.zst wallabag-26b77483ee7545c0e4f8eeb205a5743bf3589adb.zip |
remove PicoFarad
I’ll implement it an other day.
Diffstat (limited to 'inc/3rdparty/PicoFarad/Request.php')
-rw-r--r-- | inc/3rdparty/PicoFarad/Request.php | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/inc/3rdparty/PicoFarad/Request.php b/inc/3rdparty/PicoFarad/Request.php deleted file mode 100644 index 46c82bca..00000000 --- a/inc/3rdparty/PicoFarad/Request.php +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace PicoFarad\Request; | ||
4 | |||
5 | |||
6 | function param($name, $default_value = null) | ||
7 | { | ||
8 | return isset($_GET[$name]) ? $_GET[$name] : $default_value; | ||
9 | } | ||
10 | |||
11 | |||
12 | function int_param($name, $default_value = 0) | ||
13 | { | ||
14 | return isset($_GET[$name]) && ctype_digit($_GET[$name]) ? (int) $_GET[$name] : $default_value; | ||
15 | } | ||
16 | |||
17 | |||
18 | function value($name) | ||
19 | { | ||
20 | $values = values(); | ||
21 | return isset($values[$name]) ? $values[$name] : null; | ||
22 | } | ||
23 | |||
24 | |||
25 | function values() | ||
26 | { | ||
27 | if (! empty($_POST)) { | ||
28 | |||
29 | return $_POST; | ||
30 | } | ||
31 | |||
32 | $result = json_decode(body(), true); | ||
33 | |||
34 | if ($result) { | ||
35 | return $result; | ||
36 | } | ||
37 | |||
38 | return array(); | ||
39 | } | ||
40 | |||
41 | |||
42 | function body() | ||
43 | { | ||
44 | return file_get_contents('php://input'); | ||
45 | } | ||
46 | |||
47 | |||
48 | function file_content($field) | ||
49 | { | ||
50 | if (isset($_FILES[$field])) { | ||
51 | return file_get_contents($_FILES[$field]['tmp_name']); | ||
52 | } | ||
53 | |||
54 | return ''; | ||
55 | } | ||
56 | |||
57 | |||
58 | function file_info($field) | ||
59 | { | ||
60 | if (isset($_FILES[$field])) { | ||
61 | return array( | ||
62 | 'name' => $_FILES[$field]['name'], | ||
63 | 'mimetype' => $_FILES[$field]['type'], | ||
64 | 'size' => $_FILES[$field]['size'], | ||
65 | ); | ||
66 | } | ||
67 | |||
68 | return false; | ||
69 | } | ||
70 | |||
71 | |||
72 | function file_move($field, $destination) | ||
73 | { | ||
74 | if (isset($_FILES[$field]) && ! file_exists($destination)) { | ||
75 | @mkdir(dirname($destination), 0777, true); | ||
76 | move_uploaded_file($_FILES[$field]['tmp_name'], $destination); | ||
77 | } | ||
78 | } \ No newline at end of file | ||