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