1 |
joko |
1.1 |
<? |
2 |
|
|
// ------------------------------------------------------------------------- |
3 |
joko |
1.2 |
// $Id: Loader.php,v 1.1 2002/11/12 05:42:31 joko Exp $ |
4 |
joko |
1.1 |
// ------------------------------------------------------------------------- |
5 |
joko |
1.2 |
// $Log: Loader.php,v $ |
6 |
|
|
// Revision 1.1 2002/11/12 05:42:31 joko |
7 |
|
|
// + initial checkin |
8 |
|
|
// |
9 |
joko |
1.1 |
// ------------------------------------------------------------------------- |
10 |
|
|
|
11 |
|
|
|
12 |
|
|
class Site_Loader { |
13 |
|
|
|
14 |
|
|
var $site; |
15 |
|
|
|
16 |
|
|
function includeFile($filename) { |
17 |
|
|
|
18 |
|
|
// TODO: try to remove these globals! |
19 |
joko |
1.2 |
global $site; |
20 |
joko |
1.1 |
global $site_state; |
21 |
|
|
global $uservars; |
22 |
|
|
global $request; |
23 |
joko |
1.2 |
global $http_referer; |
24 |
joko |
1.1 |
|
25 |
|
|
$this->site->log( get_class($this) . "->includeFile( filename $filename )", LOG_DEBUG); |
26 |
|
|
$site = &$this->site; |
27 |
joko |
1.2 |
if (include($filename)) { |
28 |
|
|
return 1; |
29 |
|
|
} |
30 |
|
|
|
31 |
joko |
1.1 |
} |
32 |
|
|
|
33 |
|
|
function loadComponent($name, $type = "") { |
34 |
|
|
$prefix = ""; |
35 |
|
|
$postfix = ""; |
36 |
|
|
$this->site->log( get_class($this) . "->loadComponent( name $name, type $type )", LOG_DEBUG); |
37 |
|
|
switch ($type) { |
38 |
|
|
case "handler": |
39 |
|
|
$prefix = $this->site->config[path][base] . 'core/handler/'; |
40 |
joko |
1.2 |
//$postfix = ".handler.php"; |
41 |
|
|
$postfix = ".php"; |
42 |
joko |
1.1 |
break; |
43 |
|
|
case "page": |
44 |
|
|
$prefix = $this->site->config[path][base] . 'core/pages/'; |
45 |
|
|
$postfix = ".page"; |
46 |
|
|
break; |
47 |
|
|
} |
48 |
|
|
$includefile = "$prefix$name$postfix"; |
49 |
joko |
1.2 |
return $this->includeFile($includefile); |
50 |
joko |
1.1 |
} |
51 |
|
|
|
52 |
|
|
function loadHandler($name) { |
53 |
|
|
$this->site->log( get_class($this) . "->loadHandler( name $name )", LOG_DEBUG); |
54 |
joko |
1.2 |
return $this->loadComponent($name, "handler"); |
55 |
joko |
1.1 |
} |
56 |
|
|
|
57 |
|
|
function loadPage($name) { |
58 |
|
|
$this->site->log( get_class($this) . "->loadPage( name $name )", LOG_DEBUG); |
59 |
joko |
1.2 |
return $this->loadComponent($name, "page"); |
60 |
joko |
1.1 |
} |
61 |
|
|
|
62 |
|
|
|
63 |
|
|
function loadClass() { |
64 |
|
|
} |
65 |
|
|
|
66 |
|
|
function loadBusinessClass() { |
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
} |
72 |
|
|
?> |