-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocations.php
39 lines (32 loc) · 1.21 KB
/
locations.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
32
33
34
35
36
37
38
39
<?php
/******************************************************************************
* This file handles the Location settings for various asset directories so *
* that most other files don't need to figure out where to find other things. *
* *
* Paths defined in the $values array can be relative *or* absolute. *
******************************************************************************/
require_once('settings.php');
class Location extends Settings
{
protected static $values = [
// Path to project's root directory.
'ROOT' => __DIR__,
// Path to public-facing files.
'HTTP' => 'Http',
// Path to template files.
'TEMPLATES' => 'Templates',
// Path to module files.
'MODULES' => 'Modules'
];
// Get the absolute path for the directory.
public static function __callstatic($name, $arguments)
{
if (!array_key_exists($name, static::$values)) {
throw new Exception(sprintf('Error: %s not found in %s.', $name, __CLASS__));
} elseif (static::$values[$name][0] == '/') {
return realpath(static::$values[$name]);
} else {
return sprintf("%s/%s", Location::ROOT(), static::$values[$name]);
}
}
}