• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Controller\Component类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Component类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: __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


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


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


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


示例19: __construct

 /**
  * Constructor
  *
  * @param ComponentRegistry $registry A ComponentRegistry for this component
  * @param array $config Array of config.
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     $this->_session = $registry->getController()->request->session();
 }
开发者ID:hop1,项目名称:cakephp,代码行数:11,代码来源:FlashComponent.php


示例20: __construct

 public function __construct(ComponentRegistry $collection, array $config = array())
 {
     parent::__construct($collection, $config);
     $this->http = new Client();
 }
开发者ID:franky0930,项目名称:MarketingConnex,代码行数:5,代码来源:EmailverifierComponent.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Controller\Controller类代码示例发布时间:2022-05-23
下一篇:
PHP Console\Shell类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap