當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。