read())) { switch($entry): case ".": case "..": break; case "Cache": case "Record": case "Collection": case "Table": case "Validator": case "Exception": case "Session": case "DQL": case "Sensei": case "Iterator": $a[] = self::$path.DIRECTORY_SEPARATOR.$entry; break; default: if(is_file(self::$path.DIRECTORY_SEPARATOR.$entry) && substr($entry,-4) == ".php") { require_once($entry); } endswitch; } foreach($a as $dirname) { $dir = dir($dirname); $path = $dirname.DIRECTORY_SEPARATOR; while (false !== ($entry = $dir->read())) { if(is_file($path.$entry) && substr($entry,-4) == ".php") { require_once($path.$entry); } } } } /** * simple autoload function * returns true if the class was loaded, otherwise false * * @param string $classname * @return boolean */ public static function autoload($classname) { if(! self::$path) self::$path = dirname(__FILE__); $class = self::$path.DIRECTORY_SEPARATOR.str_replace("_",DIRECTORY_SEPARATOR,$classname).".php"; $class = str_replace("Doctrine","classes",$class); if( ! file_exists($class)) return false; require_once($class); return true; } } ?>