instance) { $this->instance = self::__construct(); } return $this->instance; } // ################################################################### /** * Creates a new BSRegister instance and returns it. * * @return object New register */ public static function NewRegister() { require_once('ISSO/Register.php'); self::SharedInstance()->registers[] = new BSRegister(); return end(self::SharedInstance()->registers); } // ################################################################### /** * Returns the array of all the registers * * @return array The array of all the registers */ public static function GetAllRegisters() { return self::SharedInstance()->registers; } // ################################################################### /** * Sets the main register * * @param object New main register */ public static function SetRegister(BSRegister $newreg) { if (get_class($newreg) != 'BSRegister') { trigger_error('BSLoader::SetRegister() was not passed a BSRegister object', E_USER_ERROR); } self::SharedInstance()->main = $register; } // ################################################################### /** * Gets the main register if no argument is passed, or an arbitrary * one if the index of a register is passed. * * @param integer Register index * * @return object Specified register */ public static function &GetRegister($index = null) { if (is_null($index)) { if (!isset(self::SharedInstance()->main)) { trigger_error('Cannot fetch the main register because it has not been set with BSLoader::SetRegister()', E_USER_ERROR); } return self::SharedInstance()->main; } else { if (!isset(self::SharedInstance()->registers["$index"])) { trigger_error('Invalid register index passed to BSLoader::GetRegister()', E_USER_ERROR); } return self::SharedInstance()->registers["$index"]; } } // ################################################################### /** * Loads the specified module. * * @param string Module name * * @return object Instantiated module */ public static function LoadModule($name) { if (!file_exists("ISSO/$name.php")) { trigger_error('Specified module does not exist', E_USER_ERROR); } require_once("ISSO/$name.php"); $class = "BS$name"; if (!class_exists($class)) { trigger_error('Specifed module does not conform to the ISSO specification, or the class is missing', E_USER_ERROR); } return new $class; } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>