preBasePath = $strBasePath; } /** * Load class from path * @param string $strClassName Class name */ public function loadClass($strClassName) { $className = ltrim($strClassName, '\\'); $fileName = ''; $lastNsPos = strrpos($className, '\\'); if ($lastNsPos != 0) { $namespace = substr($className, 0, $lastNsPos); $className = substr($className, $lastNsPos + 1); $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; } $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; $strFilePath1 = $this->preBasePath.$fileName; $strFilePath2 = $this->preBasePath.'install/'.$fileName; if (file_exists($strFilePath1) && is_readable($strFilePath1)) { require_once $strFilePath1; } if (file_exists($strFilePath2) && is_readable($strFilePath2)) { require_once $strFilePath2; } } }