本文整理汇总了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']]]);
}
示例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']]);
}
示例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();
}
示例4: initialize
/**
* {@inheritDoc}
*/
public function initialize()
{
parent::initialize();
$this->_fileUploadsUtils = new FileUploadsUtils($this->{$this->name});
$this->_authentication();
$this->_acl();
}
示例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']]);
}
示例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']]);
}
示例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']]);
}
示例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']]);
}
示例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);
}
示例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']]);
}
示例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']]]);
}
示例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"));
}
示例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']]);
}
示例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'));
}
}
示例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);
}