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


PHP Component::__construct方法代码示例

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


在下文中一共展示了Component::__construct方法的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: __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

示例3: __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

示例4: __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

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

 /**
  * 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

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

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

示例9: __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

示例10: __construct

 /**
  * Constructor. Will return an instance of the correct ACL class as defined in `Configure::read('Acl.classname')`
  *
  * @param ComponentRegistry $collection A ComponentRegistry
  * @param array $config Array of configuration settings
  * @throws \Cake\Error\Exception when Acl.classname could not be loaded.
  */
 public function __construct(ComponentRegistry $collection, array $config = array())
 {
     parent::__construct($collection, $config);
     $className = $name = Configure::read('Acl.classname');
     if (!class_exists($className)) {
         $className = App::className('Acl.' . $name, 'Adapter');
         if (!$className) {
             throw new Error\Exception(sprintf('Could not find %s.', $name));
         }
     }
     $this->adapter($className);
 }
开发者ID:ceeram,项目名称:acl,代码行数:19,代码来源:AclComponent.php

示例11: __construct

 public function __construct(&$controller, $settings = array())
 {
     parent::__construct($controller, $settings);
     if (isset($settings['skipAuthCheck'])) {
         $this->skipAuthCheck = $settings['skipAuthCheck'];
     }
     if (!empty($settings['exclude_check_on'])) {
         foreach ($settings['exclude_check_on'] as $exclude_check_on) {
             $this->_excludeCheckOnList[] = $exclude_check_on;
         }
     }
     $this->secret = Configure::read('shared_secret');
     $this->api_key = Configure::read('api_key');
     $this->scope = Configure::read('scope');
 }
开发者ID:takafumir,项目名称:cakephp-shopify-test,代码行数:15,代码来源:ShopifyAuthComponent.php

示例12: __construct

 public function __construct(ComponentRegistry $collection, array $config = array())
 {
     parent::__construct($collection, $config);
     // initialize callback urls
     $router = new Router();
     $baseurl = $router->url('/', true);
     $this->callback_url = $baseurl . 'external_apps/salesforce/callback';
     //end
     $this->controller = $collection->getController();
     $this->http = new Client();
     $this->controller->loadModel('Vendors');
     // prefetch vendor details
     $this->Vendors = $this->controller->Vendors;
     $this->vendor_id = $this->controller->Auth->user('vendor_id');
     $this->vendor = $this->Vendors->get($this->vendor_id);
     // end prefetch
 }
开发者ID:franky0930,项目名称:MarketingConnex,代码行数:17,代码来源:SalesforceComponent.php

示例13: __construct

 /**
  * Class constructor
  *
  * @param Cake\Controller\ComponentRegistry $collection ComponentRegistry instance.
  * @param array $config Configuration options
  * @return void
  */
 public function __construct(\Cake\Controller\ComponentRegistry $collection, array $config)
 {
     pr("AppPlusPlus __construct()");
     // make calling controller available
     $this->_controller = $collection->getController();
     // Enable Authentication if needed
     if ($this->Config('Authentication.enabled')) {
         $this->setupAuth();
     }
     // Load components for the calling calling controller
     $this->_controller->loadComponent('RequestHandler');
     $this->_controller->loadComponent('Flash');
     $this->_controller->loadComponent('Crud.Crud', ['actions' => ['Crud.Index', 'Crud.Add', 'Crud.Edit', 'Crud.View', 'Crud.Delete'], 'listeners' => ['Crud.Api', 'Crud.ApiPagination', 'Crud.ApiQueryLog']]);
     $this->_controller->loadComponent('Paginator', ['settings' => ['page' => 1, 'limit' => 25, 'maxLimit' => 100, 'whitelist' => ['limit', 'sort', 'page', 'direction']]]);
     //$this->_eventManager = $this->_controller->eventManager();
     parent::__construct($collection, $config);
 }
开发者ID:alt3,项目名称:cakephp-app-configurator,代码行数:24,代码来源:AppPlusPlusComponent.php

示例14: __construct

 public function __construct(ComponentRegistry $collection, array $config = array())
 {
     parent::__construct($collection, $config);
     // initialize callback urls
     $router = new Router();
     $baseurl = $router->url('/', true);
     $this->facebook['callback_url'] = $baseurl . 'social_apps/facebook/callback';
     $this->twitter['callback_url'] = $baseurl . 'social_apps/twitter/callback';
     $this->linkedin['callback_url'] = $baseurl . 'social_apps/linkedin/callback';
     //end
     $this->controller = $collection->getController();
     $this->http = new Client();
     FacebookSession::setDefaultApplication($this->facebook['appID'], $this->facebook['appSecret']);
     $this->controller->loadModel('Partners');
     // 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,代码行数:20,代码来源:SocialmediaComponent.php

示例15: __construct

 /**
  * Constructor
  *
  * @param \Cake\Controller\ComponentRegistry $collection A ComponentCollection this component
  *   can use to lazy load its components.
  * @param array $config Array of configuration settings.
  */
 public function __construct(ComponentRegistry $collection, $config = [])
 {
     $config += ['actions' => [], 'listeners' => []];
     $config['actions'] = $this->normalizeArray($config['actions']);
     $config['listeners'] = $this->normalizeArray($config['listeners']);
     $this->_controller = $collection->getController();
     $this->_eventManager = $this->_controller->eventManager();
     parent::__construct($collection, $config);
 }
开发者ID:i3i2ain,项目名称:crud,代码行数:16,代码来源:CrudComponent.php


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