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


PHP Controller\Component类代码示例

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


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

示例1: __construct

 public function __construct(ComponentCollection $collection, $settings = array())
 {
     parent::__construct($collection, $settings);
     // initialize callback urls
     $router = new Router();
     $baseurl = $router->url('/', true);
     $this->controller = $collection->getController();
     $this->http = new Client();
     // Load in PHP extension ZIP...?
     if (extension_loaded('zip') == true) {
         $this->zip = new ZipArchive();
         $this->Controller = $collection->getController();
     } else {
         throw new MissingComponentException(__('Error: Not Load extension "ZIP" in PHP.INI!!'));
     }
     $this->controller->loadModel('EmailTemplates');
     $this->EmailTemplates = $this->controller->EmailTemplates;
     /*
     
      // prefetch partner details
      $this->Partners = $this->controller->Partners;        
      $this->partner_id = $this->controller->Auth->user('partner_id');
      $this->partner = $this->Partners->get($this->partner_id);
      // end prefetch
     */
 }
开发者ID:franky0930,项目名称:MarketingConnex,代码行数:26,代码来源:ExtractzipComponent.php

示例2: 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

示例3: initialize

 /**
  * Initialize method
  *
  * @param Component $component Component instance.
  * @return void
  */
 public function initialize(Component $component)
 {
     $adapter = $component->config('adapter');
     if (is_array($adapter)) {
         $this->options = $adapter + $this->options;
     }
     $engine = new IniConfig(dirname($this->options['config']) . DS);
     $this->options = $engine->read(basename($this->options['config']));
 }
开发者ID:edukondaluetg,项目名称:acl,代码行数:15,代码来源:IniAcl.php

示例4: initialize

 /**
  * Initialize method
  *
  * @param Component $Component Component instance
  * @return void
  */
 public function initialize(Component $Component)
 {
     $adapter = $Component->config('adapter');
     if (is_array($adapter)) {
         $this->options = $adapter + $this->options;
     }
     $engine = new PhpConfig(dirname($this->options['config']) . DS);
     $config = $engine->read(basename($this->options['config']));
     $this->build($config);
     $Component->Aco = $this->Aco;
     $Component->Aro = $this->Aro;
 }
开发者ID:edukondaluetg,项目名称:acl,代码行数:18,代码来源:PhpAcl.php

示例5: __construct

 /**
  * Constructor
  *
  * @param \Cake\Controller\ComponentRegistry $collection
  * @param array $config Config options array
  */
 public function __construct(ComponentRegistry $collection, $config = [])
 {
     parent::__construct($collection, $config);
     $Controller = $collection->getController();
     $this->request = $Controller->request;
     $this->response = $Controller->response;
 }
开发者ID:nielin,项目名称:cakephp-imagine-plugin,代码行数:13,代码来源:ImagineComponent.php

示例6: __construct

 /**
  * Constructor. Parses the accepted content types accepted by the client using HTTP_ACCEPT
  *
  * @param ComponentRegistry $registry ComponentRegistry object.
  * @param array $config Config options array
  */
 public function __construct(ComponentRegistry $registry, $config = [])
 {
     $this->_defaultConfig = Hash::merge($this->_defaultConfig, $this->_translateConfigMessages(), (array) Configure::read('UserTools.Component'));
     $this->_controller = $registry->getController();
     $this->response = $this->_controller->response;
     parent::__construct($registry, $config);
 }
开发者ID:nielin,项目名称:cakephp-user-tools,代码行数:13,代码来源:UserToolComponent.php

示例7: __construct

 /**
  * Constructor
  *
  * @param ComponentRegistry $registry A ComponentRegistry object.
  * @param array             $config   Array of configuration settings.
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     if ($registry->getController() instanceof \Cake\Controller\Controller) {
         $this->_controller = $registry->getController();
     }
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:13,代码来源:MaintenanceComponent.php

示例8: 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

示例9: __construct

 /**
  * Constructor
  *
  * @param \Cake\Controller\ComponentRegistry $collection Component Registry
  * @param array $config Array of configuration settings.
  */
 public function __construct(ComponentRegistry $collection, $config = [])
 {
     $this->_controller = $collection->getController();
     $this->_eventManager = $this->_controller->eventManager();
     parent::__construct($collection, $config);
     $this->_createCrudComponentInstance();
 }
开发者ID:cakeplugins,项目名称:api,代码行数:13,代码来源:ApiBuilderComponent.php

示例10: __construct

 /**
  * Component constructor.
  *
  * @param ComponentRegistry $registry
  * @param array $config
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     if ($controller = $registry->getController()) {
         $this->_controller = $controller;
     }
 }
开发者ID:Cheren,项目名称:union,代码行数:13,代码来源:UnionComponent.php

示例11: __construct

 /**
  * Constructor.
  *
  * @param \Cake\Controller\ComponentRegistry $collection
  * @param array $config
  */
 public function __construct(ComponentRegistry $collection, $config = [])
 {
     $this->Controller = $collection->getController();
     $defaults = (array) Configure::read('Ajax') + $this->_defaultConfig;
     $config += $defaults;
     parent::__construct($collection, $config);
 }
开发者ID:dereuromark,项目名称:cakephp-ajax,代码行数:13,代码来源:AjaxComponent.php

示例12: 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

示例13: __construct

 /**
  * Constructor
  *
  * @param ComponentRegistry $registry A ComponentRegistry object.
  * @param array             $config   Array of configuration settings.
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     if ($registry->getController() instanceof \Cake\Controller\Controller) {
         $this->_session = $registry->getController()->request->session();
     }
     $facebookConfig = Configure::read('Facebook');
     FacebookSession::setDefaultApplication($facebookConfig['app_id'], $facebookConfig['app_secret']);
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:15,代码来源:FacebookAuthComponent.php

示例14: __construct

 public function __construct(ComponentRegistry $collection, array $config = array())
 {
     parent::__construct($collection, $config);
     $this->controller = $collection->getController();
     /*
      * Register event listener in the constructor (and not in the startup() method)
      * to ensure the listener is set when code in Controller->beforeFilter() is executed
      * (startup() is called after Controller->beforeFilter())
      */
     $this->listenToModelBeforeSave();
 }
开发者ID:alaxos,项目名称:cakephp3-libs,代码行数:11,代码来源:UserLinkComponent.php

示例15: 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


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