/** * Default autoloading function for including class files * @param string $class */ function fabriq_default_autoload($class) { // include module install file if (strpos($class, '_install') !== FALSE) { $module = str_replace('_install', '', $class); // see if the site has a version of this module to use instead if (file_exists('sites/' . FabriqStack::site() . "/modules/{$module}/{$module}.install.php")) { require_once 'sites/' . FabriqStack::site() . "modules/{$module}/{$module}.install.php"; } else { require_once "modules/{$module}/{$module}.install.php"; } // initialize module core } else { if (trim($class) == 'FabriqModules') { Fabriq::init_module_core(); // autoload model } else { // see if the site had the model $model = "app/models/{$class}.model.php"; if (file_exists('sites/' . FabriqStack::site() . "/{$model}")) { require_once 'sites/' . FabriqStack::site() . "/{$model}"; } else { if (file_exists($model)) { require_once $model; } } } } }