Set up autoloader

This commit is contained in:
Timothy Warren 2012-05-21 16:18:24 -04:00
parent 9cb0406f28
commit ff0c76fac3
2 changed files with 25 additions and 6 deletions

View File

@ -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

@ -1 +1 @@
Subproject commit bf3b0721243c81674333361fff4edbbcdcfe0a61
Subproject commit 2c67dd03cc917bd0f83cfc53923f4e009edc39c5