1 |
joko |
1.1 |
<? |
2 |
|
|
// --------------------------------------------------------------------------- |
3 |
|
|
// $Id: Config.php,v 1.1 2003/02/03 03:51:36 joko Exp $ |
4 |
|
|
// --------------------------------------------------------------------------- |
5 |
|
|
// $Log: Config.php,v $ |
6 |
|
|
// --------------------------------------------------------------------------- |
7 |
|
|
|
8 |
|
|
|
9 |
|
|
/* |
10 |
|
|
|
11 |
|
|
------------------------------------------------------------ |
12 |
|
|
How to use this? |
13 |
|
|
------------------------------------------------------------ |
14 |
|
|
|
15 |
|
|
require_once("../etc/defaults.php"); |
16 |
|
|
require_once("../etc/includes.php"); |
17 |
|
|
|
18 |
|
|
$init = |
19 |
|
|
array( |
20 |
|
|
'machine' => 'grasshopper', |
21 |
|
|
'appname' => 'pub', |
22 |
|
|
'resources' => array( |
23 |
|
|
'machines' => '../etc/machines.php', |
24 |
|
|
), |
25 |
|
|
'run' => array( |
26 |
|
|
'boot' => array( |
27 |
|
|
'scripts' => array( '../core/boot/boot.php' ), |
28 |
|
|
//'objects' => array(), |
29 |
|
|
'methods' => array( 'e_init', 'e_start', 'e_shutdown' ), |
30 |
|
|
), |
31 |
|
|
), |
32 |
|
|
); |
33 |
|
|
|
34 |
|
|
$appConfig = mkObject('Application::Config', $init); |
35 |
|
|
|
36 |
|
|
$app = mkObject('Application::Core', $appConfig); |
37 |
|
|
$app->run(); |
38 |
|
|
|
39 |
|
|
------------------------------------------------------------ |
40 |
|
|
|
41 |
|
|
*/ |
42 |
|
|
|
43 |
|
|
|
44 |
|
|
class Application_Core { |
45 |
|
|
|
46 |
|
|
var $_config; |
47 |
|
|
|
48 |
|
|
function Application_Core($initCfgObject = null) { |
49 |
|
|
$this->_config = $initCfgObject; |
50 |
|
|
} |
51 |
|
|
|
52 |
|
|
function run() { |
53 |
|
|
//print Dumper($this->_config); |
54 |
|
|
foreach ($this->_config->_store[run] as $key => $container) { |
55 |
|
|
|
56 |
|
|
// include files |
57 |
|
|
foreach ($container[scripts] as $script) { |
58 |
|
|
require_once($script); |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
// run procedural functions |
62 |
|
|
foreach ($container[methods] as $method) { |
63 |
|
|
call_user_func($method); |
64 |
|
|
} |
65 |
|
|
} |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
?> |