summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJakob Sack <kde@jakobsack.de>2011-08-02 18:31:42 +0200
committerJakob Sack <kde@jakobsack.de>2011-08-02 18:31:42 +0200
commitc50a83cd8d9387aa221236aa261ebcc7e71bdd41 (patch)
tree429b5f240a73518b6af544fd14a0c8aafbd9a254 /lib
parent30ce4e5b6bae3b2551c071a218cdbaf2a3e49195 (diff)
downloadnextcloud-server-c50a83cd8d9387aa221236aa261ebcc7e71bdd41.tar.gz
nextcloud-server-c50a83cd8d9387aa221236aa261ebcc7e71bdd41.zip
Introducing a semiautoload. Enables autoload for classes that are not in lib/
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/base.php b/lib/base.php
index 98c6fbb8e33..d3097f7ee87 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -20,9 +20,22 @@
*
*/
+/**
+ * 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');
}
}