modules['kernel'] = 'Shared Object Framework Core'; } /** * Prepares a path for being set as the sourcepath * * @param str Source path or URL * * @return str Prepared source path */ function fetch_sourcepath($source) { if (substr($source, strlen($source) - 1) != '/') { $source .= '/'; } return $source; } /** * Loads a framework extension * * @param str Name of the framework */ function load($framework) { if (!$this->is_loaded($framework)) { $newobj = $this->locate($framework); $this->$newobj['OBJ'] = new $newobj['CLASS'](); $GLOBALS["$newobj[OBJ]"] =& $this->$newobj['OBJ']; $this->modules["$framework"] = $newobj['OBJECT']; } } /** * Includes a framework module. Module definitions need three variables: * class, object, and obj. Class is the name of the class, object is * the name human-readable name, and obj is the name that the module * should be initialized as; this is used in class extensions. * * @param str Name of the framework * * @return array List of initialization variables */ function locate($framework) { require_once($this->sourcepath . $framework . '.php'); return array('CLASS' => $CLASS, 'OBJECT' => $OBJECT, 'OBJ' => $OBJ); } /** * Prints a list of all currently loaded framework modules * * @param bool Return the data as an array? * * @return mixed HTML output or an array of loaded modules */ function show_modules($return = false) { if ($return) { return $this->modules; } else { $output = "\n\n\n\n"; $this->_message('Loaded Modules', $output, 1); } } /** * Verifies to see if a framework has been loaded * * @param str Framework name * * @return bool Whether or not the framework has been loaded */ function is_loaded($framework) { if (isset($this->modules["$framework"])) { return true; } else { return false; } } /** * Prints an ISSO message * * @param str The title of the message * @param str The content of the message * @param int Type of message to be printed * @param bool Return the output? * * @return mixed Output or null */ function _message($title, $message, $type, $return = false) { switch ($type) { // Message case 1: $prefix = 'Message'; $color = '#669900'; $font = '#000000'; break; // Warning case 2: $prefix = 'Warning'; $color = '#003399'; $font = '#FFFFFF'; break; case 3: $prefix = 'Error'; $color = '#990000'; $font = '#EFEFEF'; break; } $output = "\n
\n"; $output .= "\n\n\t\n"; $output .= "\n\n\t\n\n
$prefix: $title
$message
\n
\n"; if ($return) { return $output; } else { print($output); } } /** * Custom error handler for ISSO * * @param int Error number * @param str Error message string * @param str File that contains the error * @param str The line number of the error * @param str The active symbol table at which point the error occurred */ function _error_handler($errno, $errstr, $errfile, $errline) { switch ($errno) { // Fatal case ERR_FATAL: $title = 'Fatal'; break; // Error case ERR_ERROR: $title = 'Error'; break; // Warning case ERR_WARNING: default: $title = 'Warning'; break; } $errstr .= " in $errfile on line $errline"; $this->_message($title, $errstr, 3); } } $_isso = new Shared_Object_Framework(); /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>