aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-10-18 10:28:56 -0200
committerSilvio <silvio@devlet.com.br>2010-10-18 10:28:56 -0200
commit8b55b69339146f0b03b01dd1c12501754cbd9de0 (patch)
tree05849a7485ddc7209293d0961b708207701ba9df /index.php
parent568718854e0d53c0d07ce4097dc8af4ea280eaa6 (diff)
downloadcinisis-8b55b69339146f0b03b01dd1c12501754cbd9de0.tar.gz
cinisis-8b55b69339146f0b03b01dd1c12501754cbd9de0.tar.bz2
Enhancing autoloader
Diffstat (limited to 'index.php')
-rw-r--r--index.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/index.php b/index.php
index 392fa28..357d918 100644
--- a/index.php
+++ b/index.php
@@ -5,17 +5,23 @@
// Autoloader.
function cinisis_autoload($class) {
+ $base = dirname(__FILE__) .'/';
+
if (strstr($class, 'Db')) {
- require_once 'classes/backends/'. $class .'.php';
+ $file = 'classes/backends/'. $class .'.php';
}
elseif (strstr($class, 'Iterator')) {
- require_once 'classes/iterators/'. $class .'.php';
+ $file = 'classes/iterators/'. $class .'.php';
}
elseif (strstr($class, 'Helper')) {
- require_once 'classes/helpers/'. $class .'.php';
+ $file = 'classes/helpers/'. $class .'.php';
}
else {
- require_once 'classes/'. $class .'.php';
+ $file = 'classes/'. $class .'.php';
+ }
+
+ if (file_exists($base . $file)) {
+ require_once $base . $file;
}
}