]> source.dussan.org Git - nextcloud-server.git/commitdiff
Introducing a semiautoload. Enables autoload for classes that are not in lib/
authorJakob Sack <kde@jakobsack.de>
Tue, 2 Aug 2011 16:31:42 +0000 (18:31 +0200)
committerJakob Sack <kde@jakobsack.de>
Tue, 2 Aug 2011 16:31:42 +0000 (18:31 +0200)
lib/base.php

index 98c6fbb8e33b25724d6fa6379faa0ca1d0bda839..d3097f7ee87f962ba80c8bd74b5416bf2443ccf2 100644 (file)
  *
  */
 
+/**
+ * Class that is a namespace for all global OC variables
+ */
+class OC{
+       /**
+        * Assoziative array for autoloading. classname => filename
+        */
+       public static $CLASSPATH = array();
+}
+
 // Get rid of this stupid require_once OC_...
-function OC_autoload($className) {
-       if(strpos($className,'OC_')===0) {
+function OC_autoload($className){
+       if(array_key_exists($className,OC::$CLASSPATH)){
+               require_once OC::$CLASSPATH[$className];
+       }
+       elseif(strpos($className,'OC_')===0){
                require_once strtolower(str_replace('_','/',substr($className,3)) . '.php');
        }
 }