Пример #1
0
 public static function register($dirPrepend = null)
 {
     // Dir prepend
     self::$dirPrepend = $dirPrepend;
     // Zend requires include path to be set to the LIB directory
     // Include config dir here to speed up requiring the config classes
     set_include_path(get_include_path() . PATH_SEPARATOR . LIB_DIR);
     // Get namespaces from Config
     $defaultNamespaces = array('Ajde', 'AjdeX', 'Zend', 'HTMLPurifier');
     if (!self::exists('Config')) {
         require_once CONFIG_DIR . 'Config.php';
     }
     // Try to use the Config object, and if it fails we have to redirect to
     // an error page to prevent calling the shutdown function with no Config
     // instance loaded
     try {
         $configNamespaces = Config::get('registerNamespaces');
     } catch (Exception $e) {
         error_log($e->getMessage());
         include 'errordocument.php';
         die;
     }
     self::$namespaces = array_merge($defaultNamespaces, $configNamespaces);
     // Configure autoloading
     spl_autoload_register(array("Ajde_Core_Autoloader", "autoload"));
     // Init dirs and files
     self::initDirs();
 }