diff --git a/sys/common.php b/sys/common.php index 7f767e3..3d9436c 100644 --- a/sys/common.php +++ b/sys/common.php @@ -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 */ @@ -57,6 +75,8 @@ function autoload($name) } } +// -------------------------------------------------------------------------- +// ! Error handling / messages // -------------------------------------------------------------------------- /** @@ -303,9 +323,7 @@ function init() // Load system libraries require_once(MM_SYS_PATH . 'core/traits.php'); - require_once(MM_SYS_PATH . 'core/MM.php'); - require_once(MM_SYS_PATH . 'core/miniMVC.php'); - array_map('do_include', glob(MM_SYS_PATH . 'core/*.php')); + spl_autoload_register('sys_autoload'); // Start the library autoloader spl_autoload_register('autoload'); diff --git a/sys/core/controller.php b/sys/core/MM_Controller.php similarity index 100% rename from sys/core/controller.php rename to sys/core/MM_Controller.php diff --git a/sys/core/model.php b/sys/core/MM_Model.php similarity index 100% rename from sys/core/model.php rename to sys/core/MM_Model.php diff --git a/sys/core/output.php b/sys/core/MM_Output.php similarity index 100% rename from sys/core/output.php rename to sys/core/MM_Output.php diff --git a/sys/core/page.php b/sys/core/MM_Page.php similarity index 100% rename from sys/core/page.php rename to sys/core/MM_Page.php