Skip to content
Snippets Groups Projects
Commit c50a83cd authored by Jakob Sack's avatar Jakob Sack
Browse files

Introducing a semiautoload. Enables autoload for classes that are not in lib/

parent 30ce4e5b
Branches
No related tags found
No related merge requests found
...@@ -20,9 +20,22 @@ ...@@ -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_... // Get rid of this stupid require_once OC_...
function OC_autoload($className){ function OC_autoload($className){
if(strpos($className,'OC_')===0) { 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'); require_once strtolower(str_replace('_','/',substr($className,3)) . '.php');
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment