Ejemplo n.º 1
0
    if (substr_count(WWW_DIR, '~') > 0) {
        throw new Fari_Exception('Apache user-directory ' . WWW_DIR . ' not supported by Fari Framework.');
    }
} catch (Fari_Exception $exception) {
    $exception->fire();
}
// autoload Model classes when needed (before exception is thrown)
function __autoload($className)
{
    // are we working with a Fari Helper?
    if (strpos($className, 'Fari_') === FALSE) {
        $modelFilePath = BASEPATH . '/' . APP_DIR . '/models/' . strtolower($className) . EXT;
    } else {
        // remove fari_ and build path
        $modelFilePath = BASEPATH . '/fari/helpers/' . substr($className, 5) . EXT;
    }
    try {
        // check that model class exists
        if (!file_exists($modelFilePath)) {
            throw new Fari_Exception('Missing Model Class: ' . $modelFilePath . '.');
        } else {
            include $modelFilePath;
        }
        // include file
    } catch (Fari_Exception $exception) {
        $exception->fire();
    }
}
// load Controller on static Router
Fari_Router::loadRoute();