-
Notifications
You must be signed in to change notification settings - Fork 0
/
system.php
31 lines (23 loc) · 942 Bytes
/
system.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
class System {
private $plugins = array();
/* --------------------------------------------------------------
* Lazy load requested components
* -------------------------------------------------------------- */
function __get($key) {
if (array_key_exists($key, $this->plugins))
return $this->plugins[$key];
$directory = dirname(__FILE__) . '/components';
require($directory . '/' . strtolower($key) . '.php');
$name = ucfirst($key);
if (class_exists($name)) {
return $this->plugins[strtolower($name)] = new $name;
}
}
}
/* --------------------------------------------------------------
* Easy file read function
* -------------------------------------------------------------- */
function read($file) {
return !is_file($file) || !is_readable($file) || !($contents = @file_get_contents($file)) ? FALSE : trim($contents);
}