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


PHP Yii::configure方法代码示例

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


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

示例1: __construct

 /**
  * @param array $config
  * @throws \yii\base\InvalidConfigException
  * @internal param array $params
  */
 public function __construct($config = [])
 {
     $this->app = \Yii::$app;
     $this->language = $this->app->language;
     \Yii::configure($this, $config);
     $this->init();
 }
开发者ID:opus-online,项目名称:yii2-classifier,代码行数:12,代码来源:Classifier.php

示例2: __construct

 function __construct(array $config)
 {
     if (static::$_instance !== null) {
         throw new \Exception();
     }
     $providerOptions = ArrayHelper::getValue($config, 'server.provider', []);
     $internalOptions = ArrayHelper::getValue($config, 'server.internal', []);
     $cacheConfig = ArrayHelper::getValue($config, 'server.cache', []);
     $yiiAppClass = ArrayHelper::getValue($config, 'server.yiiAppClass', 'vitprog\\wamp\\server\\YiiWampApplication');
     $providerClass = ArrayHelper::getValue($providerOptions, 'class', '\\Thruway\\Transport\\RatchetTransportProvider');
     $internalClass = ArrayHelper::getValue($internalOptions, 'class', '\\vitprog\\wamp\\server\\InternalClient');
     $cacheClass = ArrayHelper::getValue($cacheConfig, 'class', '\\yii\\caching\\FileCache');
     $realm = ArrayHelper::getValue($config, 'server.realm', 'realm1');
     $basePath = ArrayHelper::getValue($config, 'yii.basePath', null);
     if ($basePath == null) {
         die('yii.basePath not set');
     }
     if (ArrayHelper::getValue($config, 'yii.vendorPath', null) == null) {
         $config['yii']['vendorPath'] = realpath($basePath . '/vendor');
     }
     if (ArrayHelper::getValue($config, 'yii.runtimePath', null) == null) {
         $config['yii']['runtimePath'] = realpath($basePath . '/runtime');
     }
     $app = new $yiiAppClass($config['yii']);
     $this->cache = \Yii::createObject($cacheClass, $cacheConfig);
     $this->router = new Router();
     $this->provider = new $providerClass(ArrayHelper::getValue($providerOptions, 'address', 'localhost'), ArrayHelper::getValue($providerOptions, 'port', '8080'));
     $this->router->addTransportProvider($this->provider);
     $this->internal = new $internalClass($realm);
     \Yii::configure($this->internal, $internalOptions);
     $this->router->addInternalClient($this->internal);
     \Yii::$app->setComponents(['wampDeamon' => $this, 'wampRouter' => $this->router, 'wampInternal' => $this->internal, 'wampCache' => $this->cache]);
     static::$_instance = $this;
 }
开发者ID:vitprog,项目名称:yii2-wamp-server,代码行数:34,代码来源:Daemon.php

示例3: init

 public function init()
 {
     parent::init();
     $request = AH::merge(['wrapper' => 'results', 'term' => 'search:term'], $this->uses);
     $requests = [];
     $back_request = [];
     foreach ($request as $k => $v) {
         if ($k === 'term') {
             $requests[] = $v;
         } elseif (is_array($v)) {
             $requests[] = "{$k}:" . json_encode($v);
             $back_request[] = "{$k}:" . json_encode($v);
         } else {
             $requests[] = "{$k}:'{$v}'";
             $back_request[] = "{$k}:'{$v}'";
         }
     }
     \Yii::configure($this, ['format' => 'html', 'filterInputOptions' => ['id' => 'id'], 'filter' => Select2::widget(['attribute' => 'id', 'model' => $this->grid->filterModel, 'url' => Url::toRoute(['list']), 'settings' => ['ajax' => ['data' => new JsExpression('function(term,page) { return {' . implode(', ', $requests) . '}; }')], 'initSelection' => new JsExpression('function (elem, callback) {
                     var id=$(elem).val();
                     $.ajax("' . Url::toRoute(['list']) . '?id=" + id, {
                         dataType: "json",
                         data : {' . implode(', ', $back_request) . '}
                     }).done(function(data) {
                         callback(data.results[0]);
                     });
                 }')]])]);
 }
开发者ID:hiqdev,项目名称:hipanel-core,代码行数:27,代码来源:CurrentColumn.php

示例4: init

 public function init()
 {
     parent::init();
     //$this->params['foo'] = 'bar';
     // ...  other initialization code ...
     \Yii::configure($this, require __DIR__ . '/config.php');
 }
开发者ID:rocketyang,项目名称:admap,代码行数:7,代码来源:Module.php

示例5: init

 public function init()
 {
     parent::init();
     \Yii::configure($this, ['attribute' => 'email', 'label' => \Yii::t('hipanel', 'Email'), 'format' => 'html', 'value' => function ($model) {
         return Html::a($model->client ?: $model->login, ['/client/contact/view', 'id' => $model->client ? $model->client_id : $model->id]);
     }, 'filterInputOptions' => ['email' => 'email'], 'filter' => Select2::widget(['attribute' => 'email', 'model' => $this->grid->filterModel, 'url' => Url::toRoute(['/client/contact/email-list'])])]);
 }
开发者ID:hiqdev,项目名称:hipanel-core,代码行数:7,代码来源:EmailColumn.php

示例6: run

 /**
  * @param array $config
  *
  * @since 1.0
  * @author Choate <choate.yao@gmail.com>
  * @return DepControl
  * @throws \yii\base\InvalidConfigException
  */
 public static function run(array $config = [])
 {
     $object = \Yii::createObject(array_merge($config, ['class' => DepControl::className()]));
     if (!empty($config)) {
         \Yii::configure($object, $config);
     }
     return $object;
 }
开发者ID:Choate,项目名称:coderelease,代码行数:16,代码来源:DepControl.php

示例7: init

 public function init()
 {
     parent::init();
     // custom initialization code goes here
     \Yii::configure($this, require __DIR__ . '/config/config.php');
     $this->modules = ['front' => ['class' => 'app\\modules\\post\\modules\\front\\Module'], 'admin' => ['class' => 'app\\modules\\post\\modules\\admin\\Module']];
     $this->registerTranslations();
 }
开发者ID:pham186,项目名称:yii2,代码行数:8,代码来源:Module.php

示例8: init

 public function init()
 {
     parent::init();
     if (\Yii::$app instanceof \yii\console\Application) {
         $this->controllerNamespace = 'app\\modules\\api\\commands';
     }
     \Yii::configure($this, require __DIR__ . '/config/config.php');
 }
开发者ID:m-zain,项目名称:firstphp,代码行数:8,代码来源:Module.php

示例9: loadConfig

 /**
  * @param string $path
  * @throws InvalidConfigException
  */
 public function loadConfig($path)
 {
     if (file_exists($path)) {
         $config = (require $path);
         \Yii::configure($this, $config);
     } else {
         throw new InvalidConfigException('installer', 'Конфигурационный файл не найден [{f}]', ['f' => $path]);
     }
 }
开发者ID:ekup,项目名称:yii2-installer,代码行数:13,代码来源:Configurator.php

示例10: load

 /**
  * Prepare and merge actions for particular object
  * @param array $value Items options
  * @return array List of prepared object for particular active object
  */
 public function load(array $newItems)
 {
     if (!$newItems || !is_array($newItems)) {
         return;
     }
     $collection = [];
     foreach ($newItems as $name => $item) {
         if ($item === '*') {
             // if exists char "*" than load previous steps
             if ($this->_collection) {
                 foreach ($this->_collection as $key => $existedItem) {
                     $collection[$key] = $existedItem;
                 }
             }
             //            } else if ($item === '-') {
             //                unset($this->_collection[$name]);
         } else {
             if (is_string($item) && is_int($name)) {
                 if (!preg_match('/^([\\w\\.]+)(:(\\w*))?(:(.*))?$/', $item, $matches)) {
                     throw new CException(Yii::t('zii', 'The column must be specified in the format of "Name:Type:Label", where "Type" and "Label" are optional.'));
                 }
                 $name = $matches[1];
                 $item = [];
                 if (isset($matches[3]) && $matches[3] !== '') {
                     $item['type'] = $matches[3];
                 }
                 if (isset($matches[5])) {
                     $item['text'] = $matches[5];
                 }
             }
         }
         if (is_array($item)) {
             // if only necessary to add params
             if (substr($name, 0, 1) === '+') {
                 $name = substr($name, 1, strlen($name) - 1);
                 $instance = $this->_collection[$name];
                 Yii::configure($instance, $item);
             } else {
                 // create new component
                 if (empty($item['name'])) {
                     $item['name'] = $name;
                 }
                 $instance = $this->createObject($item);
             }
             if ($instance) {
                 $collection[$name] = $instance;
             }
         }
         // Remove control if returns false
         if (!$item && $name && (isset($collection[$name]) || isset($this->_collection[$name]))) {
             unset($collection[$name]);
             unset($this->_collection[$name]);
         }
     }
     $this->_collection = $collection;
     return $this->_collection;
 }
开发者ID:yariksav,项目名称:yii2-actives,代码行数:62,代码来源:CollectionMgr.php

示例11: loadWithData

 /**
  * @inheritdoc
  */
 public function loadWithData($data, $fast = false)
 {
     $attributes = ['href' => ArrayHelper::getValue($data, 'href'), 'height' => ArrayHelper::getValue($data, 'height'), 'width' => ArrayHelper::getValue($data, 'width'), 'byteSize' => ArrayHelper::getValue($data, 'bytesize'), 'size' => ArrayHelper::getValue($data, 'size')];
     if ($fast) {
         \Yii::configure($this, $attributes);
     } else {
         $this->load([$this->formName() => $attributes]);
     }
     return $this;
 }
开发者ID:romka-chev,项目名称:yii2-yandex-fotki,代码行数:13,代码来源:Image.php

示例12: init

 public function init()
 {
     parent::init();
     $authManager = Yii::$app->getAuthManager();
     if (!$authManager instanceof DbManager) {
         throw new InvalidConfigException('You should configure "authManager" component of this Yii2 application to use this module.');
     }
     // initialize the module with the configuration loaded from config.php
     \Yii::configure($this, require __DIR__ . '/config/config.php');
 }
开发者ID:vfokov,项目名称:tims2,代码行数:10,代码来源:Module.php

示例13: loadWithData

 /**
  * @inheritdoc
  */
 public function loadWithData($data, $fast = false)
 {
     $attributes = ['name' => ArrayHelper::getValue($data, 'name'), 'uid' => ArrayHelper::getValue($data, $this->getUidParser())];
     if ($fast) {
         \Yii::configure($this, $attributes);
     } else {
         $this->load([$this->formName() => $attributes]);
     }
     return $this;
 }
开发者ID:romka-chev,项目名称:yii2-yandex-fotki,代码行数:13,代码来源:Author.php

示例14: loadWithData

 /**
  * @inheritdoc
  */
 public function loadWithData($data, $fast = false)
 {
     $attributes = ['zoomLevel' => ArrayHelper::getValue($data, 'zoomlevel'), 'type' => ArrayHelper::getValue($data, 'type'), 'mapType' => ArrayHelper::getValue($data, 'maptype'), 'coordinates' => ArrayHelper::getValue($data, $this->getCoordinatesParser('coordinates'))];
     if ($fast) {
         \Yii::configure($this, $attributes);
     } else {
         $this->load([$this->formName() => $attributes]);
     }
     return $this;
 }
开发者ID:romka-chev,项目名称:yii2-yandex-fotki,代码行数:13,代码来源:Point.php

示例15: init

 public function init()
 {
     parent::init();
     Event::on(Supervisor::className(), Supervisor::EVENT_CONFIG_CHANGED, function () {
         exec('supervisorctl update', $output, $status);
     });
     \Yii::configure($this, require __DIR__ . '/config.php');
     $this->params['supervisorConnection'] = array_merge($this->params['supervisorConnection'], $this->authData);
     $this->registerIoC();
 }
开发者ID:HEXA-UA,项目名称:supervisor-manager,代码行数:10,代码来源:Module.php


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