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


PHP Controller::initialize方法代码示例

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


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

示例1: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authenticate' => ['Form' => ['userModel' => 'Users']]]);
 }
开发者ID:mattford,项目名称:Coordino,代码行数:16,代码来源:AppController.php

示例2: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['loginRedirect' => '/admin', 'authError' => 'Você possivelmente digitou suas credenciais erradas!', 'logoutRedirect' => ['prefix' => false, 'controller' => 'Pages', 'action' => 'display', 'home']]);
 }
开发者ID:richellyitalo,项目名称:estudoscakephp,代码行数:16,代码来源:AppController.php

示例3: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->helpers[] = 'Shrink.Shrink';
     $this->loadComponent('Auth', ['authorize' => 'Controller', 'authenticate' => ['Form' => ['fields' => ['username' => 'email', 'password' => 'password']]], 'loginAction' => ['controller' => 'CustomStaticPages', 'action' => 'index'], 'logoutAction' => ['controller' => 'CustomStaticPages', 'action' => 'index']]);
     //$this->Auth->allow();
 }
开发者ID:ricardohenriq,项目名称:shooping,代码行数:14,代码来源:AppController.php

示例4: initialize

 /**
  * {@inheritDoc}
  */
 public function initialize()
 {
     parent::initialize();
     $this->_fileUploadsUtils = new FileUploadsUtils($this->{$this->name});
     $this->_authentication();
     $this->_acl();
 }
开发者ID:QoboLtd,项目名称:cakephp-csv-migrations,代码行数:10,代码来源:AppController.php

示例5: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'authenticate' => ['Form' => ['fields' => ['username' => 'username', 'password' => 'password']]], 'loginRedirect' => ['controller' => 'Projects', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'Projects', 'action' => 'index']]);
 }
开发者ID:Custodia,项目名称:caketickets,代码行数:16,代码来源:AppController.php

示例6: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     // $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'loginRedirect' => ['controller' => 'IndocreatorAdmin', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'IndocreatorAdmin', 'action' => 'display', 'home']]);
 }
开发者ID:portsign,项目名称:produksatu,代码行数:16,代码来源:AppController.php

示例7: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['loginRedirect' => ['controller' => 'Articles', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'Pages', 'action' => 'display', 'home']]);
 }
开发者ID:LoRayZm,项目名称:thevintagevault,代码行数:16,代码来源:AppController.php

示例8: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('Flash');
     // Charge le FlashComponent dans tout les Controller
     $this->loadComponent('Auth', ['loginRedirect' => ['controller' => 'Users', 'action' => 'home'], 'logoutRedirect' => ['controller' => 'Users', 'action' => 'login']]);
 }
开发者ID:yao-dev,项目名称:blog-mvc.github.io,代码行数:14,代码来源:AppController.php

示例9: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     date_default_timezone_set('Asia/Ho_Chi_Minh');
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $session = $this->request->session();
     $user = $session->read('authentication');
     $cart = $session->read('my_cart');
     // $session->delete('my_cart');
     // die;
     $categorys = TableRegistry::get('Categorys')->find('all');
     $this->set('categorys', $categorys);
     if (isset($cart)) {
         foreach ($cart as $key => $value) {
             $array_id[] = $value['product_id'];
         }
         if (isset($array_id)) {
             $array_id = array_merge($array_id);
             $products = TableRegistry::get('products')->find('all')->where(['product_id IN' => $array_id]);
             foreach ($cart as $key => $value) {
                 $session_cart[$value['product_id']] = $value['qty'];
             }
             $this->set('cart', $products);
             $this->set('session_cart', $session_cart);
         }
     }
     $this->set('user', $user);
 }
开发者ID:thanghexp,项目名称:project,代码行数:38,代码来源:AppController.php

示例10: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'loginRedirect' => ['controller' => 'Forms', 'action' => 'myForms'], 'logoutRedirect' => ['controller' => 'Users', 'action' => 'register']]);
 }
开发者ID:nerthux,项目名称:egresados,代码行数:16,代码来源:AppController.php

示例11: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['loginAction' => ['controller' => 'Usuario', 'action' => 'login'], 'loginRedirect' => ['controller' => 'Inicio', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'Usuario', 'action' => 'login', 'home'], 'authenticate' => ['Form' => ['fields' => ['username' => 'cedula'], 'userModel' => 'Usuario']]]);
 }
开发者ID:juandavidp,项目名称:sndp-www,代码行数:16,代码来源:AppController.php

示例12: initialize

 /**
  * Construtor.
  */
 public function initialize()
 {
     // Inicializa componentes do CakePHP
     parent::initialize();
     $this->loadComponent('Flash');
     $this->loadComponent('Upload');
     $this->loadComponent('Cookie');
     // Inicializa camada de Autenticação
     $this->loadComponent('Auth', ['loginAction' => ['controller' => 'Authentication', 'action' => 'login', 'plugin' => false], 'authError' => 'Você precisa de autorização para visualizar esta página.', 'authenticate' => ['Form' => ['finder' => 'auth']], 'storage' => 'Session', 'flash' => ['element' => 'error']]);
     // Envia as credenciais do usuário logado
     $this->userLogged = $this->Auth->user();
     if (!empty($this->userLogged['user_id'])) {
         $tmp = TableRegistry::get("Users");
         $this->userLogged['user'] = $tmp->get($this->userLogged['user_id']);
     }
     $this->set('userLogged', $this->userLogged);
     // Recupera todas as permissões
     $permissions = $this->getPermissions();
     // Roda o método de configuração de ACL
     $this->configAcl($permissions);
     $this->Auth->allow('reset_password');
     $this->Auth->allow('confirm_reset_password');
     $this->Auth->allow('visualizar');
     if ($this->request->params['controller'] == "Relatorio" || $this->request->params['controller'] == "Api") {
         $this->Auth->allow();
     }
     // Recupera os atores do usuário logado
     $get_atores = $this->getAtores();
     $this->set(compact("admin_logged", "get_atores", "permissions"));
 }
开发者ID:lhas,项目名称:pep,代码行数:33,代码来源:AppController.php

示例13: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['loginRedirect' => ['controller' => 'Tweets', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'Users', 'action' => 'login']]);
 }
开发者ID:AFPA-Dijon,项目名称:afpa,代码行数:16,代码来源:AppController.php

示例14: initialize

 /**
  * Initialization hook method.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     if (Configure::read('Swagger')) {
         $this->config = Hash::merge(static::$defaultConfig, Configure::read('Swagger'));
     }
 }
开发者ID:alt3,项目名称:cakephp-swagger,代码行数:12,代码来源:AppController.php

示例15: initialize

 public function initialize()
 {
     parent::initialize();
     $this->loadModel('PaypalIpn.InstantPaymentNotifications');
     $local_config = Configure::read('PayPalIpn.test_mode') ? Configure::read('PayPalIpn.test') : Configure::read('PayPalIpn.prod');
     $this->loadComponent('PaypalIpn.PaypalIpnRequest', $local_config);
 }
开发者ID:otoso,项目名称:cakephp-paypal-ipn,代码行数:7,代码来源:InstantPaymentNotificationsController.php


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