2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Iris Studios Shared Object Framework [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # All parts of this file are ©2003-[#]year[#] Iris Studios, Inc. No # ||
7 || # part of this file may be reproduced in any way: part or whole. # ||
8 || # --------------------------------------------------------------- # ||
9 || # ©2003 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 define('ERR_FATAL', E_USER_ERROR
);
14 define('ERR_ERROR', E_USER_WARNING
);
15 define('ERR_WARNING', E_USER_NOTICE
);
18 * Iris Studios Shared Object Framework (ISSO)
20 * This framework allows a common backend to be used amongst all Iris
21 * Studios applications and can is built to be abstract and flexible.
22 * The base framework handles all loading and module management.
24 * @author Iris Studios, Inc.
25 * @copyright Copyright ©2003 - [#]year[#], Iris Studios, Inc.
29 class Shared_Object_Framework
32 * Global environment variables
34 * This is where we keep the global variables that are used within the shared framework
36 * @var version ISSO version
37 * @var sourcepath The location of the framework sources
38 * @var application The name of the application that is using the framework
39 * @var modules An array of loaded framework modules
41 var $version = '[#]version[#]';
43 var $application = '';
44 var $modules = array();
49 function Shared_Object_Framework()
51 set_error_handler(array(&$this, '_error_handler'));
52 $this->modules
[] = 'Shared Object Framework Core';
56 * Prepares a path for being set as the sourcepath
58 * @param str Source path or URL
60 * @return str Prepared source path
62 function fetch_sourcepath($source)
64 if (substr($source, strlen($source) - 1) == '/')
66 $source = substr($source, 0, strlen($source) - 1);
72 * Loads a framework extension
74 * @param str Name of the framework
76 function load($framework)
78 if (!in_array($framework, $this->modules
))
80 require_once($this->sourcepath
. $framework);
81 $this->modules
[] = $framework;
86 * Prints a list of all currently loaded framework modules
88 * @param bool Return the data as an array?
90 * @return mixed HTML output or an array of loaded modules
92 function show_modules($return = false
)
96 return $this->modules
;
100 $output = "\n\n<ul>\n\t<li>";
101 $output .= implode("</li>\n\t<li>", $this->modules
);
102 $output .= "</li>\n</ul>\n\n";
103 $this->_message('Loaded Modules', $output, 1);
108 * Prints an ISSO message
110 * @param str The title of the message
111 * @param str The content of the message
112 * @param int Type of message to be printed
113 * @param bool Return the output?
115 * @return mixed Output or null
117 function _message($title, $message, $type, $return = false
)
142 $output = "\n<br />\n<table cellpadding=\"4\" cellspacing=\"1\" border=\"0\" width=\"500\" style=\"background-color: $color\">";
143 $output .= "\n<tr style=\"color: $font\">\n\t<td><strong>$prefix: $title</strong></td>\n</tr>";
144 $output .= "\n<tr style=\"background-color: #FFFFFF\">\n\t<td>$message</td>\n</tr>\n</table>\n<br />\n";
157 * Custom error handler for ISSO
159 * @param int Error number
160 * @param str Error message string
161 * @param str File that contains the error
162 * @param str The line number of the error
163 * @param str The active symbol table at which point the error occurred
165 function _error_handler($errno, $errstr, $errfile, $errline)
186 $errstr .= " in <strong>$errfile</strong> on line <strong>$errline</strong>";
188 $this->_message($title, $errstr, 3);
192 /*=====================================================================*\
193 || ###################################################################
196 || ###################################################################
197 \*=====================================================================*/