/** * @param NULL|array $params */ public function __construct(array $params = NULL) { parent::__construct(); $this->setTempDirectory(TEMP_DIR); $defaults = array_map('realpath', ['appDir' => APP_DIR, 'binDir' => BIN_DIR, 'libsDir' => LIBS_DIR, 'wwwDir' => WWW_DIR, 'logDir' => LOG_DIR, 'configDir' => CONFIG_DIR, 'testsDir' => TESTS_DIR, 'migrationsDir' => MIGRATIONS_DIR]); $defaults += ['testMode' => FALSE]; $this->addParameters((array) $params + $defaults); foreach (get_class_methods($this) as $name) { if ($pos = strpos($name, 'onInit') === 0 && $name !== 'onInitPackages') { $this->onInit[lcfirst(substr($name, $pos + 5))] = [$this, $name]; } } foreach (get_class_methods($this) as $name) { if ($pos = strpos($name, 'onAfter') === 0) { $this->onAfter[lcfirst(substr($name, $pos + 5))] = [$this, $name]; } } $this->createRobotLoader()->register(); }
/** * @param NULL|string null means autodetect * @param NULL|array $params */ public function __construct($tempDirectory = NULL, array $params = NULL) { parent::__construct(); $root = __DIR__ . '/../..'; VersionExtension::$samplePath = '%appDir%/config/stages/dev.neon'; $this->setTempDirectory(realpath("{$root}/temp")); $defaults = array_map('realpath', ['appDir' => "{$root}/app", 'backupDir' => "{$root}/backups", 'binDir' => "{$root}/bin", 'libsDir' => "{$root}/vendor", 'logDir' => "{$root}/log", 'migrationsDir' => "{$root}/migrations", 'testsDir' => "{$root}/tests", 'wwwDir' => "{$root}/www"]); $defaults += ['testMode' => FALSE]; $this->addParameters((array) $params + $defaults); foreach (get_class_methods($this) as $name) { if ($pos = strpos($name, 'onInit') === 0 && $name !== 'onInitPackages') { $this->onInit[lcfirst(substr($name, $pos + 5))] = [$this, $name]; } } foreach (get_class_methods($this) as $name) { if ($pos = strpos($name, 'onAfter') === 0) { $this->onAfter[lcfirst(substr($name, $pos + 5))] = [$this, $name]; } } }
public function __construct() { parent::__construct(); $this->parameters = $this->parameters(); $this->defaultExtensions += ['dirs' => 'Drago\\Directory\\DirsExtension']; }
/** * @param string */ public function __construct($containerClass = 'Nette\DI\Container') { parent::__construct($containerClass); $container = $this->getContainer(); // Back compatability Environment::setConfigurator($this); Environment::setContext($container); // Nella X-Powered @header("X-Powered-By: Nette Framework with Nella"); // @ - headers may have been sent // Upload dir (tmp files - Mupltiple File Uploader) if (isset($container->params['tempDir'])) { $container->params['uploadDir'] = $container->expand("%tempDir%/uploads"); } // File storage dirs (upoaded images and other files) if (defined('STORAGE_DIR')) { $container->params['storageDir'] = realpath(STORAGE_DIR); } else { $container->params['storageDir'] = $container->expand("%appDir%/storage"); } // Image cache dir (public folteder for images thumbnails and other formats) if (defined('IMAGE_CACHE_DIR')) { $container->params['imageCacheDir'] = realpath(IMAGE_CACHE_DIR); } else { $container->params['imageCacheDir'] = $container->expand("%wwwDir%/images"); } // Namespace prefixes $container->params['namespaces'] = array(0 => 'App', 9 => 'Nella'); // Templates dirs (application parts dirs) $container->params['templates'] = array(0 => $container->params['appDir'], 9 => NELLA_FRAMEWORK_DIR); // Flash message types $container->params['flashes'] = array( 'success' => "success", 'error' => "error", 'info' => "info", 'warning' => "warning", ); // Set file upload temp dir ini_set('upload_tmp_dir', $container->params['uploadDir']); // Set session dir ini_set('session.save_path', $container->expand("%tempDir%/sessions")); // Init multilple file upload listener Forms\Controls\MultipleFileUpload::register( $container->httpRequest, $container->params['uploadDir'] ); $this->onAfterLoadConfig[] = function(Container $container) { // Load panels if (!$container->params['consoleMode'] && !$container->params['productionMode']) { $container->callbackPanel; $container->versionPanel; $container->translatorPanel; $container->debugPanel; $container->userPanel; } }; }