public function __construct($config = []) { parent::__construct($config); if (empty($this->siteLangs)) { $this->siteLangs = new Language(); } if (empty($this->siteMenu)) { $this->siteMenu = new Menu(); } }
public function __construct($config) { parent::__construct($config); // Set name from database if not set by config file. if (!isset($config['name'])) { if ($name = Config::setting('application.name')) { $this->name = $name; } } // Set email from database if not set by config file. if (!isset(Yii::$app->params['adminEmail'])) { Yii::$app->params['adminEmail'] = null; if ($email = Config::setting('application.admin.email')) { Yii::$app->params['adminEmail'] = $email; } } // Setup options for the user module. $user = Yii::$app->getModule('user'); $user->enableRegistration = Config::setting('user.registration.enabled'); $user->enableConfirmation = Config::setting('user.registration.confirmation'); $user->enableUnconfirmedLogin = Config::setting('user.registration.unconfirmed.login'); $user->enablePasswordRecovery = Config::setting('user.registration.password.recovery'); $user->rememberFor = Config::setting('user.login.remember.time'); $user->confirmWithin = Config::setting('user.registration.confirm.time'); $user->recoverWithin = Config::setting('user.registration.recover.time'); // Add some event listeners to the app user. $appUser = Yii::$app->user; $appUser->on($appUser::EVENT_AFTER_LOGIN, function ($e) use($appUser) { $class = $appUser->identityClass; $class::globalCookieSet($e->duration); }); $appUser->on($appUser::EVENT_AFTER_LOGOUT, function ($e) use($appUser) { $class = $appUser->identityClass; $class::globalCookieClear(); }); $appUserClass = $appUser->identityClass; if ($appUser->isGuest) { $appUserClass::globalCookieClear(); } else { $appUserClass::globalCookieSet(); } }
/** * @inheritdoc */ public function __construct($config = []) { $this->_modulesHash = md5(json_encode(ArrayHelper::getValue($config, 'modules', []))); parent::__construct($config); }
/** * @inheritdoc */ public function __construct($config = []) { $config = ArrayHelper::merge(['components' => ['urlManager' => ['enablePrettyUrl' => true, 'showScriptName' => false], 'user' => ['class' => 'gromver\\platform\\core\\components\\User'], 'errorHandler' => ['class' => 'yii\\web\\ErrorHandler', 'errorAction' => '/main/common/default/error'], 'authManager' => ['class' => 'yii\\rbac\\DbManager', 'itemTable' => '{{%core_auth_item}}', 'itemChildTable' => '{{%core_auth_item_child}}', 'assignmentTable' => '{{%core_auth_assignment}}', 'ruleTable' => '{{%core_auth_rule}}'], 'cache' => ['class' => 'yii\\caching\\FileCache'], 'elasticsearch' => ['class' => 'yii\\elasticsearch\\Connection'], 'assetManager' => ['bundles' => ['mihaildev\\ckeditor\\Assets' => ['sourcePath' => '@gromver/platform/core/assets/ckeditor']]], 'i18n' => ['translations' => ['*' => ['class' => 'yii\\i18n\\PhpMessageSource'], 'gromver.*' => ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => '@gromver/platform/core/messages']]], 'paramsManager' => ['class' => 'gromver\\platform\\core\\components\\ParamsManager']], 'modules' => ['main' => ['class' => 'gromver\\platform\\core\\modules\\main\\Module'], 'user' => ['class' => 'gromver\\platform\\core\\modules\\user\\Module'], 'auth' => ['class' => 'gromver\\platform\\core\\modules\\auth\\Module'], 'menu' => ['class' => 'gromver\\platform\\core\\modules\\menu\\Module'], 'widget' => ['class' => 'gromver\\platform\\core\\modules\\widget\\Module'], 'media' => ['class' => 'gromver\\platform\\core\\modules\\media\\Module'], 'page' => ['class' => 'gromver\\platform\\core\\modules\\page\\Module'], 'tag' => ['class' => 'gromver\\platform\\core\\modules\\tag\\Module'], 'version' => ['class' => 'gromver\\platform\\core\\modules\\version\\Module'], 'search' => ['class' => 'gromver\\platform\\core\\modules\\search\\Module', 'modules' => ['sql' => ['class' => 'gromver\\platform\\core\\modules\\search\\modules\\sql\\Module']]], 'gridview' => ['class' => 'kartik\\grid\\Module']]], $config); $this->_modulesHash = md5(json_encode(ArrayHelper::getValue($config, 'modules', []))); parent::__construct($config); }
public function __construct(array $config = []) { Yii::setAlias('system', __DIR__); Yii::setAlias('admin', dirname(__DIR__) . '/admin'); $this->initPluginManager($config); $haloConfig = (require __DIR__ . '/config/haloconfig.php'); $cfg = ArrayHelper::merge($haloConfig, $this->loadPluginConfigs('/config.php'), $config); $file = $cfg['vendorPath'] . '/yiisoft/extensions.php'; $extensions = is_file($file) ? include $file : []; if (isset($cfg['extensions']) && is_array($cfg['extensions'])) { $cfg['extensions'] = ArrayHelper::merge($extensions, $cfg['extensions']); } else { $cfg['extensions'] = $extensions; } parent::__construct($cfg); }