当前位置: 首页>>代码示例>>PHP>>正文


PHP Component::init方法代码示例

本文整理汇总了PHP中yii\base\Component::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::init方法的具体用法?PHP Component::init怎么用?PHP Component::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\base\Component的用法示例。


在下文中一共展示了Component::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     parent::init();
     if (!$this->clientID || !$this->clientSecret) {
         throw new InvalidParamException();
     }
 }
开发者ID:euromd,项目名称:yii2-yandex-metrika,代码行数:7,代码来源:Client.php

示例2: init

 public function init()
 {
     parent::init();
     if (!in_array($this->defaultLocale, $this->enableLocales)) {
         throw new \yii\base\InvalidParamException('Default locale must be contained in the enable locales list.');
     }
 }
开发者ID:filsh,项目名称:yii2-platform,代码行数:7,代码来源:Locale.php

示例3: init

 public function init()
 {
     parent::init();
     if (Yii::$app->view !== null) {
         Yii::$app->view->on(yii\web\View::EVENT_BEGIN_PAGE, [$this, 'eventSetMeta']);
     }
 }
开发者ID:shershennm,项目名称:yii2-seo,代码行数:7,代码来源:Seo.php

示例4: init

 public function init()
 {
     parent::init();
     $this->module = \ebidlh\Module::getInstance();
     $this->pub = \Yii::createObject(['class' => \ebidlh\Redis::className(), 'hostname' => $this->module->redis_server]);
     $this->sub = \Yii::createObject(['class' => \ebidlh\Redis::className(), 'hostname' => $this->module->redis_server]);
 }
开发者ID:didwjdgks,项目名称:yii2-ebid-lh,代码行数:7,代码来源:SucWatcher.php

示例5: init

 /**
  * Initializes the object
  */
 public function init()
 {
     parent::init();
     if (substr($this->iniDirectory, 0, 1) === '@') {
         $this->iniDirectory = Yii::getAlias($this->iniDirectory);
     }
 }
开发者ID:pombredanne,项目名称:xunsearch,代码行数:10,代码来源:Connection.php

示例6: init

 public function init()
 {
     parent::init();
     if (empty($this->_list)) {
         $this->_list = ['@nullref/cms/views/layouts/clear' => Yii::t('cms', 'Base layout')];
     }
 }
开发者ID:NullRefExcep,项目名称:yii2-cms,代码行数:7,代码来源:PageLayoutManager.php

示例7: init

 public function init()
 {
     parent::init();
     if (!$this->executePath) {
         $this->executePath = \Yii::getAlias('@app');
     }
 }
开发者ID:nagser,项目名称:base,代码行数:7,代码来源:ConsoleManager.php

示例8: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!isset(Yii::$app->params['languages'])) {
         throw new \yii\base\InvalidConfigException("You must define Yii::\$app->params['languages'] array");
     }
     foreach (Yii::$app->params['languages'] as $code => $language) {
         if (is_array($language)) {
             $this->_languages[$code] = $language;
         } else {
             $this->_languages[$code] = ['queryValue' => $language, 'cookieValue' => $language, 'sessionValue' => $language];
         }
     }
     $queryValue = Yii::$app->request->get($this->queryParam);
     $cookieValue = Yii::$app->request->cookies->getValue($this->cookieParam);
     $sessionValue = Yii::$app->session->get($this->sessionParam);
     if ($queryValue !== null) {
         $code = $this->getCode('queryValue', $queryValue);
         $config = ['name' => $this->cookieParam, 'value' => $this->_languages[$code]['cookieValue'], 'expire' => time() + 365 * 24 * 60 * 60];
         $config = array_merge($config, $this->cookieParams);
         Yii::$app->response->cookies->add(new Cookie($config));
         Yii::$app->session->set($this->sessionParam, $this->_languages[$code]['sessionValue']);
         Yii::$app->language = $code;
     } elseif ($cookieValue !== null && $cookieValue !== $sessionValue) {
         $code = $this->getCode('cookieValue', $cookieValue);
         Yii::$app->session->set($this->sessionParam, $this->_languages[$code]['sessionValue']);
         Yii::$app->language = $code;
     } elseif ($sessionValue !== null) {
         $code = $this->getCode('sessionValue', $sessionValue);
         Yii::$app->language = $code;
     }
 }
开发者ID:best-nazar,项目名称:gb-yii2,代码行数:35,代码来源:languageSwitcher.php

示例9: init

 public function init()
 {
     parent::init();
     $this->module = \kepco\Module::getInstance();
     $this->client = new \GuzzleHttp\Client(['base_uri' => 'http://srm.kepco.net/', 'cookies' => true, 'allow_redirects' => false, 'headers' => ['User-Agent' => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36', 'Cookie' => $this->cookie, 'X-CSRF-TOKEN' => $this->token]]);
     $this->sub = \Yii::createObject(['class' => \kepco\Redis::className(), 'hostname' => $this->module->redis_server]);
 }
开发者ID:didwjdgks,项目名称:yii2-kepco,代码行数:7,代码来源:Http.php

示例10: init

 public function init()
 {
     parent::init();
     if ($this->key === null || $this->api === null || $this->appid === null) {
         throw new InvalidConfigException('UCenter Client appid、api地址、key必须设置,这些参数可以在Ucenter后台-应用设置中查找');
     }
 }
开发者ID:chenyuzou,项目名称:yii2-ucenter,代码行数:7,代码来源:Client.php

示例11: init

 /**
  * 
  * */
 public function init()
 {
     if ($this->OpcTabModelClass === null) {
         throw new InvalidConfigException('Orcsis::OpcTabModelClass must be set.');
     }
     parent::init();
 }
开发者ID:orcsis,项目名称:yii2-orcsis,代码行数:10,代码来源:Orcsis.php

示例12: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!isset($this->sourcePath) || !isset($this->sourceUrl)) {
         throw new \yii\base\InvalidConfigException('Invalid sourcePath/sourceUrl.');
     }
     if (!isset($this->thumbsPath) || !isset($this->thumbsUrl)) {
         $this->thumbsPath = '@app/web/thumbs';
         $this->thumbsUrl = '@web/thumbs';
     }
     if (isset($this->text)) {
         if (!isset($this->text['text']) || !isset($this->text['fontFile'])) {
             throw new \yii\base\InvalidConfigException('Invalid text.');
         }
     }
     $this->sourcePath = Yii::getAlias($this->sourcePath);
     $this->sourceUrl = Yii::getAlias($this->sourceUrl);
     $this->thumbsPath = Yii::getAlias($this->thumbsPath);
     $this->thumbsUrl = Yii::getAlias($this->thumbsUrl);
     $this->sourcePath = str_replace('\\', '/', $this->sourcePath);
     $this->thumbsPath = str_replace('\\', '/', $this->thumbsPath);
     if (!isset($this->resizeMode)) {
         $this->resizeMode = ManipulatorInterface::THUMBNAIL_OUTBOUND;
     }
 }
开发者ID:YiiVN,项目名称:Yii2-Image,代码行数:28,代码来源:ImageCache.php

示例13: init

 /**
  * Initializes the application component.
  * This method overrides the parent implementation by setting default cache key prefix.
  */
 public function init()
 {
     parent::init();
     if ($this->keyPrefix === null) {
         $this->keyPrefix = substr(md5(Yii::$app->id), 0, 5);
     }
 }
开发者ID:lianghongle,项目名称:yii2-zh-cn,代码行数:11,代码来源:Cache.php

示例14: init

 public function init()
 {
     parent::init();
     //Mandatory config parameters
     if (!$this->_projectId) {
         throw new InvalidConfigException('ProjectId cannot be empty!');
     } else {
         $this->configArray['project_id'] = $this->_projectId;
     }
     if (!$this->_token) {
         throw new InvalidConfigException('WriteKey cannot be empty!');
     } else {
         $this->configArray['token'] = $this->_token;
     }
     //Optional config parameters
     if ($this->_protocol !== null) {
         $this->configArray['protocol'] = $this->_protocol;
     }
     if ($this->_host !== null) {
         $this->configArray['host'] = $this->_host;
     }
     if ($this->_port !== null) {
         $this->configArray['port'] = $this->_port;
     }
     if ($this->_protocol !== null) {
         $this->configArray['api_version'] = $this->_apiVersion;
     }
     //Create a new IronMQ object if it hasn't already been created
     if ($this->_ironmq === null) {
         $this->_ironmq = new \IronMQ\IronMQ($this->configArray);
     }
 }
开发者ID:br0sk,项目名称:yii2-ironmq,代码行数:32,代码来源:IronMQ.php

示例15: init

 public function init()
 {
     parent::init();
     if ($this->modulename == null) {
         throw new InvalidParamException('modulename parameter for plathir\\settings\\components cannot set.');
     }
 }
开发者ID:plathir,项目名称:yii2-smart-settings,代码行数:7,代码来源:Settings.php


注:本文中的yii\base\Component::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。