Autoload system libraries

This commit is contained in:
Timothy Warren 2012-05-21 14:49:33 -04:00
parent e434c0d865
commit f5537bdea4
5 changed files with 23 additions and 5 deletions

View File

@ -21,11 +21,29 @@
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// ! Error handling / messages // ! Autoloading
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
* Function to autoload libraries * Function to autoload system libraries
*
* @param string
*/
function sys_autoload($name)
{
$path = MM_SYS_PATH . "/core/{$name}.php";
if (is_file($path))
{
require_once($path);
}
}
// --------------------------------------------------------------------------
/**
* Function to autoload libraries/classes
* *
* @param string * @param string
*/ */
@ -57,6 +75,8 @@ function autoload($name)
} }
} }
// --------------------------------------------------------------------------
// ! Error handling / messages
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
@ -303,9 +323,7 @@ function init()
// Load system libraries // Load system libraries
require_once(MM_SYS_PATH . 'core/traits.php'); require_once(MM_SYS_PATH . 'core/traits.php');
require_once(MM_SYS_PATH . 'core/MM.php'); spl_autoload_register('sys_autoload');
require_once(MM_SYS_PATH . 'core/miniMVC.php');
array_map('do_include', glob(MM_SYS_PATH . 'core/*.php'));
// Start the library autoloader // Start the library autoloader
spl_autoload_register('autoload'); spl_autoload_register('autoload');