本文整理汇总了PHP中Component::startup方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::startup方法的具体用法?PHP Component::startup怎么用?PHP Component::startup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component::startup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startup
public function startup()
{
if ($data = $this->Cookie->read($this->cookieVarname)) {
$this->data = $data;
}
return parent::startup();
}
示例2: startup
/**
* For this helper the controller has to be passed as reference
* for manual startup with $disableStartup = true (requires this to be called prior to any other method)
*
* @return void
*/
public function startup(Controller $Controller = null)
{
parent::startup($Controller);
// Data preparation
if (!empty($this->Controller->request->data) && !Configure::read('DataPreparation.notrim')) {
$this->Controller->request->data = $this->trimDeep($this->Controller->request->data);
}
if (!empty($this->Controller->request->query) && !Configure::read('DataPreparation.notrim')) {
$this->Controller->request->query = $this->trimDeep($this->Controller->request->query);
}
if (!empty($this->Controller->request->params['named']) && !Configure::read('DataPreparation.notrim')) {
$this->Controller->request->params['named'] = $this->trimDeep($this->Controller->request->params['named']);
}
if (!empty($this->Controller->request->params['pass']) && !Configure::read('DataPreparation.notrim')) {
$this->Controller->request->params['pass'] = $this->trimDeep($this->Controller->request->params['pass']);
}
// Information gathering
if (!Configure::read('App.disableMobileDetection') && ($mobile = $this->Session->read('Session.mobile')) === null) {
App::uses('UserAgentLib', 'Tools.Lib');
$UserAgentLib = new UserAgentLib();
$mobile = (int) $UserAgentLib->isMobile();
$this->Session->write('Session.mobile', $mobile);
}
// Auto layout switch
if ($this->Controller->request->is('ajax')) {
$this->Controller->layout = 'ajax';
}
}
示例3: startup
/**
* Take a comma seperated list of id's and save them in the matching order
*
* @param Controller $controller
*/
public function startup(Controller $controller)
{
parent::startup($controller);
$postedRanks = Hash::extract($controller->request->data, '{s}.updated-ranks');
if ($controller->request->is('post') && !empty($postedRanks)) {
$ranks = explode(',', $postedRanks[0]);
$i = 0;
foreach ($ranks as $order => $rowId) {
$data[$i][$this->settings['model']][$this->settings['field']] = $rowId;
$data[$i][$this->settings['model']][$this->settings['sortField']] = $order + 1;
// As arrays count from 0, but our ranks count from 1
$i++;
}
$element = 'default';
if ($this->settings['useNiceAdmin']) {
$element = 'NiceAdmin.alert-box';
}
$controller->loadModel($this->settings['model']);
if ($controller->{$this->settings['model']}->saveAll($data, array('validate' => false))) {
$controller->Session->setFlash($this->settings['model'] . ' order updated', $element, array('class' => 'alert-success'));
$controller->redirect($controller->referer());
} else {
$controller->Session->setFlash($this->settings['model'] . ' order could not be updated, please try again', $element, array('class' => 'alert-error'));
}
}
}
示例4: startup
/**
* MobileComponent::startup()
*
* @param Controller $Controller
* @return void
*/
public function startup(Controller $Controller)
{
parent::startup($Controller);
if ($this->settings['on'] !== 'startup') {
return;
}
$this->_init();
}
示例5: startup
/**
* Run after controller beforeFilter method
* @param Controller $controller
*/
public function startup(Controller $controller)
{
parent::startup($controller);
if (isset($controller->request->params['name'])) {
$this->__requestedModule = Inflector::camelize($controller->request->params['name']);
$this->__needInstall();
}
}
示例6: startup
public function startup($controller)
{
parent::startup($controller);
$collection = new ComponentCollection();
$this->Acl = new AclComponent($collection);
$controller = null;
$this->Acl->startup($controller);
$this->Aco = $this->Acl->Aco;
}
示例7: startup
public function startup(Controller $controller)
{
parent::startup($controller);
$this->Controller = $controller;
// コントローラがページネーションを使っているか確かめる
if (!isset($this->Controller->paginate)) {
$this->Controller->paginate = array();
}
}
示例8: startup
public function startup(\Controller $controller)
{
// definindo alguns dados padrões
$config = Configure::read('PagSeguro');
if ($config) {
$this->credenciais = new PagSeguroAccountCredentials($config['credenciais']['email'], $config['credenciais']['token']);
}
parent::startup($controller);
}
示例9: startup
/**
* perform needed initialization and cache the controller that called us
*/
public function startup($controller)
{
parent::startup($controller);
if (!defined('SESSION_UNSAFE')) {
define('SESSION_UNSAFE', false);
}
if (CLI) {
return;
}
}
示例10: startup
/**
*
* Setup menus at startup
* @param Controller $controller
*/
public function startup(Controller $controller)
{
parent::startup($controller);
/*
* only at module page
*/
if (isset($controller->request->params['name'])) {
$moduleName = Inflector::camelize($controller->request->params['name']);
$checkMenus = $this->isModuleHasMenus($moduleName);
if ($checkMenus) {
$this->parseModuleMenus($moduleName);
}
}
}
示例11: startup
/**
* called by controller after the component was instanciated first
* @param object $controller the calling controller
*/
public function startup($controller)
{
parent::startup($controller);
$this->setCode($this->findLanguage());
if (!defined('LANGUAGE_FALLBACK')) {
define('LANGUAGE_FALLBACK', false);
}
if (!defined('LANGUAGE_WARNEMPTY')) {
define('LANGUAGE_WARNEMPTY', true);
}
if (!defined('LANGUAGE_ESCAPE')) {
define('LANGUAGE_ESCAPE', false);
}
}
示例12: startup
/**
* Called after the Controller::beforeFilter() and before the controller action
*
* @param $controller Controller
* @return void
*/
public function startup($controller)
{
parent::startup($controller);
$this->_debug($this->Controller->request);
}
示例13: startup
/**
* Startup component
*
* @param object $controller Instantiating controller
* @access public
*/
public function startup(Controller $controller)
{
parent::startup($controller);
}
示例14: startup
/**
*
* @param Controller $controller
*/
public function startup(Controller $controller)
{
parent::startup($controller);
$this->Controller = $controller;
}
示例15: startup
/**
* Check module user access
* Only for checking module
* @param Controller $controller
*/
public function startup(Controller $controller)
{
parent::startup($controller);
/*
* only at requested module
*/
if (isset($this->__Controller->request->params['isCloggyModule']) && $this->__Controller->request->params['isCloggyModule'] == 1) {
//setup aro data
$this->generateAro();
//run acl for module
$this->proceedAcl('controller');
//get flag
$isAllowed = $this->isAroAllowed();
/*
* if not allowed proceed callback
*/
if (!$isAllowed) {
$this->proceedCallback();
}
}
}