-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.php
46 lines (38 loc) · 1.05 KB
/
config.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
40
41
42
43
44
45
46
<?php
/**
* App configuration
*
* @author Jared Howland <liveviewtech@jaredhowland.com>
* @version 2015-09-23
* @since 2015-09-18
*
*/
const CONFIG = 'config.ini';
class config {
private static $config;
public static function get($setting) {
if(self::$config === null) {
self::$config = parse_ini_file(CONFIG);
}
return self::setting_exists($setting);
}
private static function setting_exists($setting) {
if(isset(self::$config[$setting])) {
return self::$config[$setting];
} else {
throw new UnexpectedValueException("'$setting' is not a valid config setting. Please check your 'config.ini' file for valid config options.");
}
}
public static function set_error_reporting() {
if(self::get('development')) {
ini_set('display_errors', '1');
ini_set('error_reporting', E_ALL^E_NOTICE);
} else {
ini_set('display_errors', '0');
}
}
}
config::set_error_reporting();
require_once __DIR__ . '/vendor/autoload.php';
date_default_timezone_set(config::get('time_zone'));
?>