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


PHP Component::initialize方法代码示例

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


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

示例1: initialize

 /**
  * initialize
  *
  * @param array $config Config.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->setController($this->_registry->getController());
     // adding request handler
     $this->Controller->loadComponent('RequestHandler');
     // accepts json
     $this->Controller->RequestHandler->renderAs($this->Controller, 'json');
     // set the default modelName
     if (is_null($this->config('modelName'))) {
         $this->config('modelName', $this->Controller->name);
     }
     if (Configure::read('Api.JWT')) {
         if ($this->Controller->Auth) {
             $this->Controller->Auth->config('authenticate', ['ADmad/JwtAuth.Jwt' => ['parameter' => '_token', 'userModel' => 'Users.Users', 'scope' => ['Users.active' => 1], 'fields' => ['id' => 'id']]]);
         }
     }
 }
开发者ID:jxav,项目名称:cakephp-api,代码行数:24,代码来源:ApiBuilderComponent.php

示例2: initialize

 /**
  * initialize method
  * @param array $config The config data
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     if (Configure::read('Users.GoogleAuthenticator.login')) {
         $this->tfa = new TwoFactorAuth(Configure::read('Users.GoogleAuthenticator.issuer'), Configure::read('Users.GoogleAuthenticator.digits'), Configure::read('Users.GoogleAuthenticator.period'), Configure::read('Users.GoogleAuthenticator.algorithm'), Configure::read('Users.GoogleAuthenticator.qrcodeprovider'), Configure::read('Users.GoogleAuthenticator.rngprovider'), Configure::read('Users.GoogleAuthenticator.encryptionKey'));
     }
 }
开发者ID:CakeDC,项目名称:users,代码行数:12,代码来源:GoogleAuthenticatorComponent.php

示例3: initialize

 /**
  * initialize
  *
  * @param array $config Config.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->Controller = $this->_registry->getController();
     $this->Users = TableRegistry::get($this->config('userModel'));
     $this->Usermetas = TableRegistry::get($this->config('usermetasModel'));
 }
开发者ID:jxav,项目名称:cakephp-whosonline,代码行数:13,代码来源:WhosOnlineComponent.php

示例4: initialize

 /**
  * initialize
  *
  * Initialize callback for Components.
  *
  * @param array $config Configurations.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->Controller = $this->_registry->getController();
     // set up the default helper
     $this->Controller->helpers['Utils.Menu'] = [];
 }
开发者ID:eAliwei,项目名称:cakephp-utils,代码行数:15,代码来源:MenuComponent.php

示例5: initialize

 /**
  * Initialize config data and properties.
  *
  * @param array $config The config data.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->_cookieName = Configure::read('Users.RememberMe.Cookie.name');
     $this->_validateConfig();
     $this->setCookieOptions();
     $this->_attachEvents();
 }
开发者ID:OrigamiStructures,项目名称:users,代码行数:14,代码来源:RememberMeComponent.php

示例6: initialize

 /**
  * Initialize Callback
  *
  * @param array $config
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->Controller = $this->_registry->getController();
     if ($this->config('Auth')) {
         $this->Controller->loadComponent('Auth', $this->config('Auth'));
     }
     $this->Controller->loadComponent('Utils.Menu');
 }
开发者ID:Adnan0703,项目名称:cakephp-cakemanager,代码行数:14,代码来源:ManagerComponent.php

示例7: initialize

 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->uid = uniqid();
     $this->request_pg = new \PagSeguroPaymentRequest();
     $this->request_pg->setShippingType(self::NOT_SPECIFIED);
     $this->request_pg->setReference($this->uid);
     $this->request_pg->setCurrency('BRL');
 }
开发者ID:jorgejardim,项目名称:cakephp-3-utilities,代码行数:9,代码来源:PagseguroComponent.php

示例8: initialize

 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->_controller = $this->_registry->getController();
     $action = $this->_controller->request->param('action');
     if (in_array($action, ['edit', 'add'])) {
         $this->__setCurrentUserPermissions();
     }
 }
开发者ID:mohammadsaleh,项目名称:spider,代码行数:9,代码来源:UserPermissionComponent.php

示例9: initialize

 /**
  * Initialize method
  * @param  array  $config configuration array
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->_controller = $this->_registry->getController();
     $this->_user = $this->Auth->user();
     $this->_capabilitiesTable = TableRegistry::get('RolesCapabilities.Capabilities');
     $this->_capabilitiesTable->setCurrentRequest($config['currentRequest']);
     $this->_capabilitiesTable->setCurrentUser($this->Auth->user());
 }
开发者ID:QoboLtd,项目名称:cakephp-roles-capabilities,代码行数:14,代码来源:CapabilityComponent.php

示例10: initialize

 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->Controller = $this->_registry->getController();
     if ($this->request->is('service')) {
         $this->service = true;
         $this->Controller->viewClass = 'json';
         $this->data = [self::SUCCESS_KEY => false, self::CODE_KEY => 0, self::MESSAGE_KEY => 'Default message'];
     }
 }
开发者ID:ayman-alkom,项目名称:KMaras-FTP,代码行数:10,代码来源:ServiceComponent.php

示例11: initialize

 /**
  * Initialize method, setup Auth if not already done passing the $config provided and
  * setup the default table to Users.Users if not provided
  *
  * @param array $config config options
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->_validateConfig();
     $this->_initAuth();
     if (Configure::read('Users.Social.login')) {
         $this->_loadSocialLogin();
     }
     if (Configure::read('Users.RememberMe.active')) {
         $this->_loadRememberMe();
     }
     $this->_attachPermissionChecker();
 }
开发者ID:cakedc,项目名称:users,代码行数:20,代码来源:UsersAuthComponent.php

示例12: initialize

 public function initialize(array $config)
 {
     parent::initialize($config);
     $privatni = $config['privatni'];
     $verejny = $config['verejny'];
     $heslo = $config['heslo'];
     $fp = fopen($privatni, "r");
     $this->privatni = fread($fp, filesize($privatni));
     fclose($fp);
     $this->heslo = $heslo;
     $fp = fopen($verejny, "r");
     $this->verejny = fread($fp, filesize($verejny));
     fclose($fp);
 }
开发者ID:LubosCzech,项目名称:WiFiCisnik2,代码行数:14,代码来源:CSignatureComponent.php

示例13: initialize

 public function initialize(array $config)
 {
     parent::initialize($config);
     // if mode is not set in bootstrap, defaults to 'Test'
     $mode = Configure::read('Stripe.mode');
     if ($mode) {
         $this->mode = $mode;
     }
     // set the Stripe API key
     $this->key = Configure::read('Stripe.' . $this->mode . 'Secret');
     if (!$this->key) {
         throw new Exception('Stripe API Secret key is not set');
     }
     // if currency is not set, defaults to 'usd'
     $currency = Configure::read('Stripe.currency');
     if ($currency) {
         $this->currency = strtolower($currency);
     }
 }
开发者ID:hashmode,项目名称:cakephp-stripe,代码行数:19,代码来源:StripeComponent.php

示例14: initialize

 public function initialize(array $_defaultConfig)
 {
     parent::initialize($_defaultConfig);
     $this->OverviewModel = TableRegistry::get('Overview');
 }
开发者ID:borisknot,项目名称:cmanage,代码行数:5,代码来源:OverviewComponent.php

示例15: initialize

 /**
  * initialize
  *
  * @param array $config Config.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->Controller = $this->_registry->getController();
 }
开发者ID:bakkerij,项目名称:notifier,代码行数:11,代码来源:NotifierComponent.php


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