| 1 |
<? |
| 2 |
// ------------------------------------------------------------------------- |
| 3 |
// $Id: Loader.php,v 1.1 2002/11/12 05:42:31 joko Exp $ |
| 4 |
// ------------------------------------------------------------------------- |
| 5 |
// $Log: Loader.php,v $ |
| 6 |
// Revision 1.1 2002/11/12 05:42:31 joko |
| 7 |
// + initial checkin |
| 8 |
// |
| 9 |
// ------------------------------------------------------------------------- |
| 10 |
|
| 11 |
|
| 12 |
class Site_Loader { |
| 13 |
|
| 14 |
var $site; |
| 15 |
|
| 16 |
function includeFile($filename) { |
| 17 |
|
| 18 |
// TODO: try to remove these globals! |
| 19 |
global $site; |
| 20 |
global $site_state; |
| 21 |
global $uservars; |
| 22 |
global $request; |
| 23 |
global $http_referer; |
| 24 |
|
| 25 |
$this->site->log( get_class($this) . "->includeFile( filename $filename )", LOG_DEBUG); |
| 26 |
$site = &$this->site; |
| 27 |
if (include($filename)) { |
| 28 |
return 1; |
| 29 |
} |
| 30 |
|
| 31 |
} |
| 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 |
//$postfix = ".handler.php"; |
| 41 |
$postfix = ".php"; |
| 42 |
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 |
return $this->includeFile($includefile); |
| 50 |
} |
| 51 |
|
| 52 |
function loadHandler($name) { |
| 53 |
$this->site->log( get_class($this) . "->loadHandler( name $name )", LOG_DEBUG); |
| 54 |
return $this->loadComponent($name, "handler"); |
| 55 |
} |
| 56 |
|
| 57 |
function loadPage($name) { |
| 58 |
$this->site->log( get_class($this) . "->loadPage( name $name )", LOG_DEBUG); |
| 59 |
return $this->loadComponent($name, "page"); |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
function loadClass() { |
| 64 |
} |
| 65 |
|
| 66 |
function loadBusinessClass() { |
| 67 |
} |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
} |
| 72 |
?> |