Exemple #1
0
 $autoloader = Hydrogen\Load\Autoloader::getInstance();
 $autoloader->attachCallback(array(Hydrogen\Load\Autoloader::CALLBACK_NS2PATH, Hydrogen\Load\Autoloader::CALLBACK_COMPOSER));
 $autoloader->attachNamespace('application', APPLICATION_PATH);
 $autoloader->attachNamespace('Psr', LIB_PATH . DIRECTORY_SEPARATOR . 'Psr', true);
 // include Framework constant
 Hydrogen\Load\Loader::getInstance()->import('lib/Hydrogen/Constant/Http.php');
 Hydrogen\Load\Loader::getInstance()->import('lib/Hydrogen/Include/Functions.php');
 // config
 $EXECUTOR = Hydrogen\Application\Execute\Executor::getInstance();
 $CONFIG = Hydrogen\Config\Config::getInstance();
 $CONFIG->mergeConfigFile(APPLICATION_PATH . DIRECTORY_SEPARATOR . $EXECUTOR->getApplicationConfigDir() . DIRECTORY_SEPARATOR . 'application.ini');
 $CONFIG->mergeConfigFile(APPLICATION_PATH . DIRECTORY_SEPARATOR . $EXECUTOR->getApplicationConfigDir() . DIRECTORY_SEPARATOR . ENV . DIRECTORY_SEPARATOR . 'application.ini');
 $CONFIG->mergeConfigFile(APPLICATION_PATH . DIRECTORY_SEPARATOR . $EXECUTOR->getApplicationConfigDir() . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . 'database.ini');
 $EXECUTOR->setModuleDir(APPLICATION_PATH . '/module');
 $EXECUTOR->setAvailableModules(array('admin'));
 require Hydrogen\Load\Loader::getInstance()->getAbsPath(APPLICATION_PATH . '/config/route.php');
 /*$router->addRule(new RulePostfix('.json', array(
         'header' => array(
             HTTP_HEADER_CONTENT_TYPE => 'application/json',
         ),
         'param' => array(
             'type' => 'JSON',
         ),
     )));
 
     $router->addRule(new RuleFixed('/simple/master', array(
         'module' => '',
         'ctrl' => 'branch',
         'act' => 'master'
     )));*/
 /*$router->addRule(new RuleParam('/simple/:id', array(
Exemple #2
0
array_shift($argv);
$base = __DIR__;
$vendor_path = $base . '/vendor';
$lib_path = $base . '/lib';
$application_path = $base . '/application';
$global_config_path = $base . '/config';
defined('APPLICATION_PATH') || define('APPLICATION_PATH', $application_path);
defined('VENDOR_PATH') || define('VENDOR_PATH', $vendor_path);
defined('LIB_PATH') || define('LIB_PATH', $lib_path);
defined('GLOBAL_CONFIG_PATH') || define('GLOBAL_CONFIG_PATH', $global_config_path);
defined('NAMESPACE_SEPARATOR') || define('NAMESPACE_SEPARATOR', '\\');
require LIB_PATH . '/Hydrogen/Load/Autoloader.php';
$autoloader = Hydrogen\Load\Autoloader::getInstance();
$autoloader->attachNamespace('application', $base . DIRECTORY_SEPARATOR . 'application');
$autoloader->attachCallback(array(Hydrogen\Load\Autoloader::CALLBACK_NS2PATH));
Hydrogen\Load\Loader::getInstance()->import(LIB_PATH . '/Hydrogen/Include/Functions.php');
static $_command_separatar = '::', $_baseNamespace = 'application\\console', $_cslPostFix = 'Csl', $_actionPostFix = 'Act';
global $consoleHelper;
/**
 * @return Hydrogen\Console\ConsoleHelper|null
 */
function instantiateConsoleHelper()
{
    global $consoleHelper;
    if (null != $consoleHelper && $consoleHelper instanceof Hydrogen\Console\ConsoleHelper) {
        return $consoleHelper;
    }
    global $_baseNamespace;
    $consoleHelper = new Hydrogen\Console\ConsoleHelper($_baseNamespace, APPLICATION_PATH . '/console');
    return $consoleHelper;
}