1 <?php
2
3 namespace Alo\FileSystem;
4
5 if(!defined('GEN_START')) {
6 http_response_code(404);
7 die();
8 }
9
10 /**
11 * The abstract file system class
12 *
13 * @author Art <a.molcanovas@gmail.com>
14 */
15 abstract class AbstractFileSystem {
16
17 /**
18 * Replacements for placeholders
19 *
20 * @var array
21 */
22 protected $replace;
23
24 /**
25 * Instantiates the class
26 *
27 * @author Art <a.molcanovas@gmail.com>
28 */
29 function __construct() {
30 $time = time();
31 $this->replace = [
32 'search' => [
33 '{timestamp}',
34 '{datetime}',
35 '{date}',
36 '{time}',
37 '{year}',
38 '{month}',
39 '{day}',
40 '{weekday}'
41 ],
42 'replace' => [
43 $time,
44 date('Y-m-d H.i.s', $time),
45 date('Y-m-d', $time),
46 date('H.i.s', $time),
47 date('Y', $time),
48 date('m', $time),
49 date('d', $time),
50 date('l', $time)
51 ]
52 ];
53 }
54
55 /**
56 * Perform placeholder replacement operations
57 *
58 * @author Art <a.molcanovas@gmail.com>
59 *
60 * @param string $subject The string to perform operations in
61 */
62 protected function replace(&$subject) {
63 $subject = str_ireplace($this->replace['search'], $this->replace['replace'], $subject);
64 }
65 }