/** * Automatic class loading handler. This automatically loads a class using the path * information that was registered using the ZoopLoader::class method * * @param string $className Name of the class to load */ static function autoload($className) { $classPath = ZincLoader::getClassPath($className); if ($classPath) { require_once $classPath; } if (substr($className, 0, 5) == 'Zend_') { // $parts = explode('_', $className); // $modName = $parts[1]; $shortPath = str_replace('_', '/', $className); require_once zoop_dir . "/vendor/zend/{$shortPath}.php"; } }
final function __construct($path, $lib) { // assign in the paramamters $this->path = $path; $this->lib = $lib; $this->name = strtolower(str_replace('Module', '', get_class($this))); // second stage (module specific) construction $this->init(); $classname = get_class($this); // load any dependant modules if ($this->getDepends()) { foreach ($this->getDepends() as $thisDepends) { $this->lib->loadMod($thisDepends); } } // include any normal files that need to be included if ($this->getIncludes()) { foreach ($this->getIncludes() as $thisInclude) { if ($thisInclude[0] == '/') { require $thisInclude; } else { require $this->path . '/' . $thisInclude; } } } // register any class files if ($classes = $this->getClasses()) { foreach ($classes as $className => $classPath) { ZincLoader::addClass($className, $this->path . '/' . $classPath); } } if ($this->hasConfig) { $this->loadConfig(); } // handle configuration $this->configure(); }
/** * static -- Register a class for auto-loading with the name of the class * and the full path of the file that contains it. * * @param string $className * @param string $fullPath */ public static function registerClass($className, $fullPath) { ZincLoader::addClass($className, $fullPath); }