/** * Initializes this component. */ public function init() { parent::init(); if ($this->sourceLanguage === null) { $this->sourceLanguage = Leaps::$app->sourceLanguage; } }
/** * Initializes the component by configuring the default message categories. */ public function init() { parent::init(); if (!isset($this->translations['leaps']) && !isset($this->translations['leaps*'])) { $this->translations['leaps'] = ['className' => 'Leaps\\I18n\\PhpMessageSource', 'sourceLanguage' => 'en-US', 'basePath' => '@Leaps/Message']; } if (!isset($this->translations['app']) && !isset($this->translations['app*'])) { $this->translations['app'] = ['className' => 'Leaps\\I18n\\PhpMessageSource', 'sourceLanguage' => Leaps::$app->sourceLanguage, 'basePath' => '@app/Message']; } }
/** * Initializes the application component. * This method is required by IApplicationComponent and is invoked by application. */ public function init() { parent::init(); register_shutdown_function([$this, 'close']); }
/** * 初始化 * * @throws InvalidConfigException if [[basePath]] is invalid */ public function init() { parent::init(); $this->basePath = Leaps::getAlias($this->basePath); if (!is_dir($this->basePath)) { throw new InvalidConfigException("The directory does not exist: {$this->basePath}"); } elseif (!is_writable($this->basePath)) { throw new InvalidConfigException("The directory is not writable by the Web process: {$this->basePath}"); } else { $this->basePath = realpath($this->basePath); } $this->baseUrl = rtrim(Leaps::getAlias($this->baseUrl), '/'); }
/** * Initializes the migration. * This method will set [[db]] to be the 'db' application component, if it is `null`. */ public function init() { parent::init(); $this->db = Instance::ensure($this->db, Connection::className()); $this->db->getSchema()->refresh(); }
/** * Initializes UrlManager. */ public function init() { parent::init(); if (!$this->enablePrettyUrl || empty($this->rules)) { return; } if (is_string($this->cache)) { $this->cache = Leaps::$app->get($this->cache, false); } if ($this->cache instanceof Cache) { $cacheKey = __CLASS__; $hash = md5(json_encode($this->rules)); if (($data = $this->cache->get($cacheKey)) !== false && isset($data[1]) && $data[1] === $hash) { $this->rules = $data[0]; } else { $this->rules = $this->buildRules($this->rules); $this->cache->set($cacheKey, [$this->rules, $hash]); } } else { $this->rules = $this->buildRules($this->rules); } }
/** * 初始化 */ public function init() { parent::init(); if ($this->identityClass === null) { throw new InvalidConfigException('User::identityClass must be set.'); } if ($this->enableAutoLogin && !isset($this->identityCookie['name'])) { throw new InvalidConfigException('User::identityCookie must contain the "name" element.'); } }
/** * @inheritdoc */ public function init() { parent::init(); foreach ($this->targets as $name => $target) { if (!$target instanceof Target) { $this->targets[$name] = Leaps::createObject($target); } } }
/** * @inheritdoc */ public function init() { parent::init(); $this->attributes = (array) $this->attributes; $this->on = (array) $this->on; $this->except = (array) $this->except; }
/** * Initializes the logger by registering [[flush()]] as a shutdown function. */ public function init() { parent::init(); register_shutdown_function(function () { // make regular flush before other shutdown functions, which allows session data collection and so on $this->flush(); // make sure log entries written by shutdown functions are also flushed // ensure "flush()" is called last when there are multiple shutdown functions register_shutdown_function([$this, 'flush'], true); }); }
/** * Initializes the view component. */ public function init() { parent::init(); if (is_array($this->theme)) { if (!isset($this->theme['className'])) { $this->theme['className'] = 'Leaps\\Base\\Theme'; } $this->theme = Leaps::createObject($this->theme); } elseif (is_string($this->theme)) { $this->theme = Leaps::createObject($this->theme); } }