Example #1
0
function cogear()
{
    return Cogear::getInstance();
}
Example #2
0
 *
 * @param   $class  Class name.
 * @return  boolean
 */
function autoload($class)
{
    $filename = str_replace('_', DS, $class);
    if ($path = find($filename . EXT)) {
        include $path;
        return TRUE;
    }
    return FALSE;
}
// Register with autoload
spl_autoload_register('autoload');
$cogear = Cogear::getInstance();
// Some root classes are needed to be preloaded
$cogear->request = new Request();
// Set host
$host = $cogear->request->get('HTTP_HOST');
// Defince site folder
// Check if main
if (substr_count($host, '.') > 1) {
    if (!is_dir(SITES . DS . $host)) {
        list($subdomain, $host) = preg_split('#[\\.]+#', $host, 2, PREG_SPLIT_NO_EMPTY);
        define('SUBDOMAIN', $subdomain);
    }
}
defined('SITE') or is_dir(SITES . DS . $host) && define('SITE', SITES . DS . $host) or define('SITE', DEFAULT_SITE);
define('SITE_GEARS', SITE . DS . GEARS_FOLDER);
$cogear->config = new Config(SITE . DS . 'settings' . EXT);