Example #1
0
 static function createRobotLoader($options)
 {
     $loader = new NRobotLoader();
     $loader->autoRebuild = isset($options['autoRebuild']) ? $options['autoRebuild'] : !NEnvironment::isProduction();
     $loader->setCacheStorage(NEnvironment::getService('Nette\\Caching\\ICacheStorage'));
     if (isset($options['directory'])) {
         $loader->addDirectory($options['directory']);
     } else {
         foreach (array('appDir', 'libsDir') as $var) {
             if ($dir = NEnvironment::getVariable($var, NULL)) {
                 $loader->addDirectory($dir);
             }
         }
     }
     $loader->register();
     return $loader;
 }
Example #2
0
<?php

function set_magic_quotes_runtime()
{
    return false;
}
require LIBS_DIR . '/nette.min.php';
require LIBS_DIR . '/SQLiteStorage.php';
$loader = new NRobotLoader();
$loader->setCacheStorage(new SQLiteStorage());
$loader->addDirectory(APP_DIR);
$loader->addDirectory(LIBS_DIR);
$loader->addDirectory(WWW_DIR . '/require_modules');
$loader->addDirectory(WWW_DIR . '/classes');
$loader->register();
$config = NEnvironment::loadConfig(APP_DIR . '/config/config.neon');
Example #3
0
<?php

function set_magic_quotes_runtime()
{
    return false;
}
// Step 1: Load Nette Framework
require LIBS_DIR . '/nette.min.php';
define('_NETTE_MODE', false);
NDebugger::$strictMode = TRUE;
NDebugger::enable(false, APP_NETTE_DIR . '/log');
//NEnvironment::setVariable ( "tempDir", "%appNetteDir%/temp" );
// 2c) enable RobotLoader - this allows load all classes automatically
$loader = new NRobotLoader();
$loader->setCacheStorage(new NFileStorage(TEMP_DIR));
$loader->addDirectory(APP_NETTE_DIR);
$loader->addDirectory(LIBS_DIR);
$loader->addDirectory(WWW_DIR . '/require_modules');
$loader->addDirectory(WWW_DIR . '/classes');
//$loader->addDirectory ( WWW_DIR.'/app/models' );
//$loader->addDirectory ( WWW_DIR.'/app/components' );
$loader->register();
// 2b) load configuration from config.ini file
$config = NEnvironment::loadConfig(APP_NETTE_DIR . '/config/config.neon');
$neon = new NConfigNeonAdapter();
$n = $neon->load(APP_NETTE_DIR . '/config/config.db.neon');
$database = $n['common']['parameters'];
foreach ($database as $k => $p) {
    NEnvironment::setVariable($k, $p);
}
//var_dump($d);exit;
Example #4
0
	/**
	 * @return NRobotLoader
	 */
	public function createRobotLoader()
	{
		if (!($cacheDir = $this->getCacheDirectory())) {
			throw new InvalidStateException("Set path to temporary directory using setTempDirectory().");
		}
		$loader = new NRobotLoader;
		$loader->setCacheStorage(new NFileStorage($cacheDir));
		$loader->autoRebuild = !$this->params['productionMode'];
		return $loader;
	}
Example #5
0
File: loader.php Project: GE3/GE3
 static function createRobotLoader($options)
 {
     $loader = new NRobotLoader();
     $loader->autoRebuild = !NEnvironment::isProduction();
     $dirs = isset($options['directory']) ? $options['directory'] : array(NEnvironment::getVariable('appDir'), NEnvironment::getVariable('libsDir'));
     $loader->addDirectory($dirs);
     $loader->register();
     return $loader;
 }