Exemple #1
0
<?php

// get the location of the init.php file according to the following rules
// 1. if there is one in the current directory then use it
// 2. check for a -D flag. If it is set then use that as the directory
// 3. check for a -I flag. If it is set then check for the user config to see if
//		there is an instance name and directory set up.  If so use that
// 4. if there is an environmental variable INSTANCE_DIR set then use that
// 2-4 above not done
// include the basic Zinc stuff
if (file_exists('./init.php')) {
    include 'init.php';
} else {
    include dirname(dirname(__DIR__)) . '/Zinc.php';
    Zinc::registerLib('core');
    Zinc::loadMod('cli');
}
// load the default zn config
Config::suggest(__DIR__ . '/config.yaml');
// process the command line args and determine which Command* class to use
$args = $argv;
array_shift($args);
$wordlist = Config::get('zn.commands');
$counts = array();
foreach (Config::get('zn.commands') as $commandName => $keywords) {
    $count = 0;
    foreach ($keywords as $word) {
        if (in_array($word, $args)) {
            $count++;
        }
    }
Exemple #2
0
    }
    public static function reg($className, $dirPath = null)
    {
        if ($dirPath) {
            if ($dirPath[0] == '/') {
                $fullPath = "{$dirPath}/{$className}.php";
            } else {
                $fullPath = app_dir . "/{$dirPath}/{$className}.php";
            }
        } else {
            $fullPath = app_dir . "/{$className}.php";
        }
        self::registerClass($className, $fullPath);
    }
    /**
     * Register a "domain" class for autoload (a domain class is a
     * class that is located in the "domains" directory under
     * the project root with the filename <classname>.php)
     *
     * @param unknown_type $className
     */
    public static function registerDomain($className)
    {
        self::registerClass($className, app_dir . '/domain/' . $className . '.php');
    }
}
Zinc::registerLib('boot');
Zinc::registerLib('core');
Zinc::registerLib('experimental');
Zinc::registerLib('vendor');
Zinc::loadLib('boot');