3 |
// $Id$ |
// $Id$ |
4 |
// --------------------------------------------------------------------------- |
// --------------------------------------------------------------------------- |
5 |
// $Log$ |
// $Log$ |
6 |
|
// Revision 1.2 2003/02/03 14:42:28 joko |
7 |
|
// + logging (LOG_DEBUG) |
8 |
|
// + methods for accessing configuration variables |
9 |
|
// |
10 |
// Revision 1.1 2003/02/03 05:00:01 joko |
// Revision 1.1 2003/02/03 05:00:01 joko |
11 |
// + initial commit |
// + initial commit |
12 |
// |
// |
48 |
*/ |
*/ |
49 |
|
|
50 |
|
|
51 |
class Application_Core { |
class Application_Core extends DesignPattern_Logger { |
52 |
|
|
53 |
var $_config; |
var $_config; |
54 |
|
|
58 |
|
|
59 |
function run() { |
function run() { |
60 |
//print Dumper($this->_config); |
//print Dumper($this->_config); |
61 |
foreach ($this->_config->_store[run] as $key => $container) { |
|
62 |
|
parent::constructor(); |
63 |
|
|
64 |
|
$this->log(get_class($this) . "->run: begin", LOG_INFO); |
65 |
|
|
66 |
|
$cfg = $this->getConfig(); |
67 |
|
|
68 |
|
//print Dumper($cfg); exit; |
69 |
|
|
70 |
|
if (!is_array($cfg[run])) { return; } |
71 |
|
|
72 |
|
foreach ($cfg[run] as $key => $container) { |
73 |
|
|
74 |
|
//print "key: $key<br>"; |
75 |
|
|
76 |
// include files |
// include files |
77 |
foreach ($container[scripts] as $script) { |
if (is_array($container[scripts])) { |
78 |
require_once($script); |
foreach ($container[scripts] as $script) { |
79 |
|
$this->_require_once_isolated($script); |
80 |
|
$this->_config->merge(); |
81 |
|
} |
82 |
} |
} |
83 |
|
|
84 |
// run procedural functions |
// run procedural functions |
85 |
foreach ($container[methods] as $method) { |
if (is_array($container[methods])) { |
86 |
call_user_func($method); |
foreach ($container[methods] as $method) { |
87 |
|
$this->log(get_class($this) . "->run: calling function in global namespace: '$method'", LOG_DEBUG); |
88 |
|
call_user_func($method); |
89 |
|
} |
90 |
} |
} |
91 |
|
|
92 |
} |
} |
93 |
|
|
94 |
|
$this->log(get_class($this) . "->run: end", LOG_INFO); |
95 |
|
|
96 |
} |
} |
97 |
|
|
98 |
|
function getConfig($var = null) { |
99 |
|
return $this->_config->getPart($var); |
100 |
|
} |
101 |
|
|
102 |
|
function _require_once_isolated($file) { |
103 |
|
$this->log(get_class($this) . "->_require_once_isolated: $file", LOG_DEBUG); |
104 |
|
if (require_once($file)) { |
105 |
|
return 1; |
106 |
|
} |
107 |
|
} |
108 |
|
|
109 |
|
function setConfigVar($var, $val) { |
110 |
|
//print "$var=$val<br>"; |
111 |
|
$this->_config->setVar($var, $val); |
112 |
|
} |
113 |
|
|
114 |
|
function getConfigVar($var) { |
115 |
|
return $this->_config->getVar($var); |
116 |
|
} |
117 |
|
|
118 |
} |
} |
119 |
|
|
120 |
?> |
?> |