From 27c869a7283d9df6265726adbb96ef3cb727997a Mon Sep 17 00:00:00 2001 From: doctrine Date: Tue, 30 May 2006 08:39:12 +0000 Subject: [PATCH] --- Doctrine.php | 286 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 286 insertions(+) create mode 100644 Doctrine.php diff --git a/Doctrine.php b/Doctrine.php new file mode 100644 index 000000000..98d43b654 --- /dev/null +++ b/Doctrine.php @@ -0,0 +1,286 @@ +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"; + print $class; + + if( ! file_exists($class)) + return false; + + + require_once($class); + return true; + } +} +?>