modules[] = '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 = substr($source, 0, strlen($source) - 1);
}
return $source;
}
/**
* Loads a framework extension
*
* @param str Name of the framework
*/
function load($framework)
{
if (!in_array($framework, $this->modules))
{
require_once($this->sourcepath . $framework);
$this->modules[] = $framework;
}
}
/**
* 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\t- ";
$output .= implode("
\n\t- ", $this->modules);
$output .= "
\n
\n\n";
$this->_message('Loaded Modules', $output, 1);
}
}
/**
* 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$prefix: $title | \n
";
$output .= "\n\n\t$message | \n
\n
\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);
}
}
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>