-
Notifications
You must be signed in to change notification settings - Fork 0
/
class.ST.php
75 lines (56 loc) · 1.44 KB
/
class.ST.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
71
72
73
74
75
<?php
/**
* Base class for STCLI and STWeb
*
* @package package_name
*/
/**
* Steroid root
*
* @var string
*/
require_once STROOT . '/storage/interface.IRBStorage.php';
require_once STROOT . '/log/class.Log.php';
require_once STROOT . '/util/class.ClassFinder.php';
require_once STROOT . '/cache/class.Cache.php';
/**
* Base class for STCLI and STWeb
*
* @package steroid
*/
class ST {
/** @var IRBStorage */
protected $storage;
/** @var Config */
protected $config;
/**
* Product string
*
* @var string
*/
const PRODUCT_NAME = 'Steroid';
const MODE_PRODUCTION = 'production';
const MODE_DEVELOPMENT = 'development';
protected static $mode;
public static function getMode() {
return self::$mode;
}
// FIXME: does not resolve '..' or symlinks correctly
public static function pathIsCore( $path ) {
return $path === STDIRNAME || strncmp( ltrim( $path, '/' ), STDIRNAME . '/', strlen( STDIRNAME ) + 1 ) === 0;
}
public function __construct( Config $conf, IRBStorage $storage ) {
$this->config = $conf;
$this->storage = $storage;
self::$mode = ( $modeConf = $this->config->getSection( 'mode' ) ) && ( $installationMode = $modeConf[ 'installation' ] ) ? $installationMode : self::MODE_PRODUCTION;
Cache::init( $storage );
}
public function __invoke() {
}
}
class InvalidClassConstantException extends Exception {
}
class NotImplementedException extends Exception {
}
class SecurityException extends Exception {
}