forked from reasoncms/reasoncms
-
Notifications
You must be signed in to change notification settings - Fork 2
/
paths.php
70 lines (64 loc) · 2.51 KB
/
paths.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* This is the reason_package bootstrap file. It is required by the carl util utility package and reason.
*
* It must exist at a file system path ending with /reason_package/paths.php, and it must
* be in the php include path such that it is loadable by php with this simple statement:
*
* include_once('paths.php');
*
* paths.php file defines the minimal file system paths needed by the reason_package, namely:
*
* INCLUDE_PATH - the absolute file system path to the root of the reason_package directory
* SETTINGS_INC - the location of the settings directory that contains the reason_package settings
*
* paths.php additionally defines a method domain_define
*
* @package carl_util
*/
/**
* Defines a constant using the settings for the current domain, if available, or the provided default value.
*
* @param constant string name of the constant to define
* @param default string default value to set if there is not a value for $GLOBALS['_current_domain_settings[$constant]
* @return void
*/
function domain_define($constant, $default)
{
define ($constant, (isset($GLOBALS['_current_domain_settings'][$constant])) ? $GLOBALS['_current_domain_settings'][$constant] : $default);
$GLOBALS['_default_domain_settings'][$constant] = $default; // lets store the default in case something cares about the difference
}
/**
* The location of the reason_package folder - put this outside of the web tree
*/
define ('INCLUDE_PATH', dirname(__FILE__) . '/');
/**
* The location of the reason_package settings folder - this should be outside the web tree.
* It can be supplied by setting an environment variable to an absolute path.
* If the ENV var REASON_SETTINGS_PATH is set it will be used.
*
* By default, the constant will be set to settings_local if such a directory exists parallel to settings
*/
if ($settings_path = getenv('REASON_SETTINGS_PATH')) {
define('SETTINGS_INC', $settings_path);
} else {
define ('SETTINGS_INC',
(file_exists(INCLUDE_PATH . 'settings_local'))
? INCLUDE_PATH . 'settings_local/'
: INCLUDE_PATH . 'settings/');
}
/**
* Load in domain specific settings. Any setting defined with the domain_define will use domain specific settings when available
*/
include_once (SETTINGS_INC . 'domain_settings.php');
/**
* Load the package_settings for the reason_packge.
*/
require_once( SETTINGS_INC . 'package_settings.php');
/**
* Include Composer class autoloader, if it exists
*/
if (file_exists(INCLUDE_PATH . 'vendor/autoload.php')) {
include_once INCLUDE_PATH . 'vendor/autoload.php';
}
?>