Set up autoloader
This commit is contained in:
parent
9cb0406f28
commit
ff0c76fac3
@ -114,16 +114,35 @@ if ( ! function_exists('do_include'))
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Load everything so that we don't have to do requires later
|
||||
/**
|
||||
* Autoloader for OpenSQLManager
|
||||
*
|
||||
* @param string $class
|
||||
*/
|
||||
function osm_autoload($class)
|
||||
{
|
||||
array_map('do_include', glob(BASE_DIR . "/common/*.php"));
|
||||
array_map('do_include', glob(BASE_DIR . "/db/*.php"));
|
||||
array_map('do_include', glob(BASE_DIR . "/widgets/*.php"));
|
||||
array_map('do_include', glob(BASE_DIR . "/windows/*.php"));
|
||||
$class = strtolower($class);
|
||||
$widget_path = BASE_DIR . "/widgets/{$class}.php";
|
||||
$window_path = BASE_DIR . "/windows/{$class}.php";
|
||||
|
||||
if (is_file($widget_path))
|
||||
{
|
||||
require_once($widget_path);
|
||||
}
|
||||
elseif (is_file($window_path))
|
||||
{
|
||||
require_once($window_path);
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Load everything so that we don't have to do requires later
|
||||
require_once(BASE_DIR . '/common/functions.php');
|
||||
spl_autoload_register('osm_autoload');
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
// Auto-load db drivers
|
||||
require_once(BASE_DIR . "/db/autoload.php");
|
||||
|
||||
|
2
sys/db
2
sys/db
@ -1 +1 @@
|
||||
Subproject commit bf3b0721243c81674333361fff4edbbcdcfe0a61
|
||||
Subproject commit 2c67dd03cc917bd0f83cfc53923f4e009edc39c5
|
Reference in New Issue
Block a user