corrade-http-templates – Diff between revs 1 and 73
?pathlinks?
Rev 1 | Rev 73 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | <?php |
1 | <?php |
|
Line 2... | Line -... | |||
2 | |
- | ||
3 | ########################################################################### |
- | ||
4 | ## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ## |
- | ||
5 | ########################################################################### |
2 | |
|
6 | function atomized_put_contents($file, $data) { |
- | ||
7 | $fp = fopen($file, "w+"); |
- | ||
8 | if (flock($fp, LOCK_EX)) { |
- | ||
9 | fwrite($fp, $data); |
- | ||
10 | fflush($fp); |
- | ||
11 | flock($fp, LOCK_UN); |
- | ||
12 | } |
- | ||
13 | fclose($fp); |
- | ||
14 | } |
- | ||
15 | |
- | ||
16 | ########################################################################### |
- | ||
17 | ## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ## |
- | ||
18 | ########################################################################### |
- | ||
19 | function atomized_get_contents($file) { |
- | ||
20 | $fp = fopen($file, "r+"); |
- | ||
21 | $ct = ''; |
- | ||
22 | if (flock($fp, LOCK_SH)) { |
- | ||
23 | if (filesize($file)) { |
- | ||
24 | $ct = fread($fp, filesize($file)); |
- | ||
25 | } |
- | ||
26 | flock($fp, LOCK_UN); |
- | ||
27 | } |
- | ||
28 | fclose($fp); |
- | ||
29 | return $ct; |
- | ||
30 | } |
- | ||
31 | |
- | ||
32 | ########################################################################### |
- | ||
33 | ## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ## |
- | ||
34 | ########################################################################### |
- | ||
35 | function wasKeyValueGet($key, $data) { |
- | ||
36 | return array_reduce( |
- | ||
37 | explode( |
- | ||
38 | "&", |
- | ||
39 | $data |
- | ||
40 | ), |
- | ||
41 | function($o, $p) { |
- | ||
42 | $x = explode("=", $p); |
- | ||
43 | return array_shift($x) != $o ? $o : array_shift($x); |
- | ||
44 | }, |
- | ||
45 | $key |
- | ||
46 | ); |
- | ||
Line 47... | Line 3... | |||
47 | } |
3 | require_once('vendor/was/utilities/src/IO/IO.php'); |
|
48 | |
4 | |
|
49 | ########################################################################### |
5 | ########################################################################### |
|
50 | ## Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 ## |
6 | ## Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 ## |