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


PHP Component::initialize方法代码示例

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


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

示例1: initialize

 public function initialize(Controller $Controller)
 {
     parent::initialize($Controller);
     if (!self::_isSiftable($Controller)) {
         return;
     }
     if (empty($Controller->request->data['Sifter'])) {
         if (empty($Controller->request->params['named'])) {
             return true;
         }
         $Controller->request->params['named'] = Hash::expand($Controller->request->params['named']);
         return self::_sift($Controller);
     }
     $Model = $Controller->{$Controller->modelClass};
     $field = array_filter((array) $Model->sifterConfig('fields'));
     if (self::_isAjax($Controller)) {
         if (!array_key_exists($Controller->request->data['Sifter']['search_field'], $field) || empty($Controller->request->data['Sifter']['search_value'])) {
             return true;
         }
         return self::_setAutoComplete($Controller, array($Controller->request->data['Sifter']['search_field'] => $field[$Controller->request->data['Sifter']['search_field']]));
     } elseif ($Controller->request->is('post')) {
         unset($Controller->request->data['Sifter']);
         $url = array();
         foreach (Hash::filter($Controller->request->data) as $model => $fields) {
             foreach ($fields as $field => $data) {
                 $url[$model . '.' . $field] = $data;
             }
         }
         return $Controller->redirect(Hash::merge($url, array_diff_key($Controller->request->params, array('plugin' => null, 'controller' => null, 'action' => null, 'named' => null, 'pass' => null))));
     }
 }
开发者ID:dogmatic69,项目名称:cakephp-sifter,代码行数:31,代码来源:SifterComponent.php

示例2: initialize

 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     $this->WorkflowActions = ClassRegistry::init('SimpleWorkflow.WorkflowActions');
     $this->UserWorkflowActions = ClassRegistry::init('SimpleWorkflow.UserWorkflowActions');
     $this->MapUserActionWorkflow = ClassRegistry::init('SimpleWorkflow.MapUserActionWorkflow');
 }
开发者ID:walisc,项目名称:CakePhpSimpleWorkFlow,代码行数:7,代码来源:DALComponent.php

示例3: initialize

 /**
  * Initialize
  *
  * @since	0.1
  * @author	Anthony Putignano <anthony@wizehive.com>
  * @param	Controller	$controller	A reference to the instantiating controller object
  * @return	void
  */
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     if (!isset($this->Storage)) {
         $this->Storage = new OAuth2Storage($this->settings);
     }
     if (!isset($this->Server)) {
         $this->Server = new OAuth2_Server($this->Storage, $this->settings, array(new OAuth2_GrantType_AuthorizationCode($this->Storage), new OAuth2_GrantType_RefreshToken($this->Storage, array('always_issue_new_refresh_token' => false))));
     }
     if (!isset($this->Request)) {
         $this->Request = new OAuth2_Request($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
     }
     if (!isset($this->ServerReflection)) {
         $this->ServerReflection = new ReflectionClass('OAuth2_Server');
     }
     $methods = $this->ServerReflection->getMethods();
     foreach ($methods as $method) {
         $this->availableMethods[$method->name] = null;
         $MethodReflection = new ReflectionMethod('OAuth2_Server', $method->name);
         $params = $MethodReflection->getParameters();
         if (!empty($params) && !empty($params[0]->name) && $params[0]->name === 'request') {
             $this->availableMethods[$method->name] = 'request';
         }
     }
 }
开发者ID:manzapanza,项目名称:cakephp-api-utils,代码行数:33,代码来源:OAuth2Component.php

示例4: initialize

 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     if (count($controller->request->query) && !empty($this->settings)) {
         $conditions = array();
         foreach ($controller->request->query as $key => $value) {
             if (empty($this->settings[$key]) || empty($value) || empty($this->settings[$key]['field'])) {
                 continue;
             }
             if (empty($this->settings[$key]['type'])) {
                 $this->settings[$key]['type'] = 'default';
             }
             $controller->request->data($key, $value);
             switch ($this->settings[$key]['type']) {
                 case 'range':
                     list($key, $value) = $this->_range($this->settings[$key]['field'], $value);
                     $conditions[$key] = $value;
                     break;
                 case 'text':
                     list($key, $value) = $this->_text($this->settings[$key]['field'], $value);
                     $conditions[$key] = $value;
                     break;
                 default:
                     list($key, $value) = $this->_default($this->settings[$key]['field'], $value);
                     $conditions[$key] = $value;
                     break;
             }
             $conditions[$key] = $value;
         }
         $controller->request->filter = $conditions;
         $this->conditions = $conditions;
     }
 }
开发者ID:andrecavallari,项目名称:filter,代码行数:33,代码来源:FilterComponent.php

示例5: initialize

 /**
  * Called before the Controller::beforeFilter().
  * 
  * @param $controller 
  * @return void
  */
 public function initialize($controller)
 {
     parent::initialize($controller);
     $this->LightOpenID = new LightOpenID(env('SERVER_NAME'));
     $this->Controller =& $controller;
     $this->Controller->loadModel('AuthService.OpenidUser');
     $this->Controller->loadModel('User');
 }
开发者ID:sanyaade-machine-learning,项目名称:Catool,代码行数:14,代码来源:OpenidAuthServiceComponent.php

示例6: initialize

 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     $this->controller = $controller;
     foreach ($controller->uses as $model) {
         $this->{$model} = $controller->{$model};
     }
 }
开发者ID:sonnt1991,项目名称:Goikenban,代码行数:8,代码来源:MessageComponent.php

示例7: initialize

 /**
  * MobileComponent::initialize()
  *
  * @param Controller $Controller
  * @return void
  */
 public function initialize(Controller $Controller)
 {
     parent::initialize($Controller);
     $this->Controller = $Controller;
     if ($this->settings['on'] !== 'initialize') {
         return;
     }
     $this->_init();
 }
开发者ID:ByMyHandsOnly,项目名称:BMHO_Web,代码行数:15,代码来源:MobileComponent.php

示例8: initialize

 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     App::import('Vendor', 'PHPExcel', array('file' => 'PHPExcel/PHPExcel.php'));
     if (!class_exists('PHPExcel')) {
         throw new CakeException('Vendor class PHPExcel not found!');
     }
     $dataArray = array();
 }
开发者ID:noibilism,项目名称:nst_portal,代码行数:9,代码来源:ExcelReaderComponent.php

示例9: initialize

 /**
  * Initialize the component
  *
  * Setup properties and injects API methods to the controller
  * @return void
  */
 public function initialize(Controller $controller)
 {
     $this->_controller = $controller;
     parent::initialize($controller);
     $this->_apiVersionPrefix = str_replace('.', '_', $this->_apiVersion);
     $methods = $this->_apiMethods;
     foreach ($methods as &$method) {
         $method = $this->_apiVersionPrefix . '_' . $method;
     }
     $controller->methods = array_keys(array_flip($controller->methods) + array_flip($methods));
 }
开发者ID:saydulk,项目名称:croogo,代码行数:17,代码来源:BaseApiComponent.php

示例10: initialize

 /**
  * Initialize component
  *
  * @return array
  * @author Daniel Quappe
  */
 public function initialize(Controller $Controller)
 {
     $this->Controller = $Controller;
     //$res = App::import('Vendor', 'Payment.sofortlib/sofortLib');
     $res = App::import('Vendor', 'Payment.sofortlib/sofortLib_sofortueberweisung_classic');
     //$res2 = App::import('Vendor', 'Payment.sofortlib/sofortLib_classic_notification.inc');
     if (!$res) {
         trigger_error('sofortlib cannot be found');
     }
     parent::initialize($Controller);
 }
开发者ID:09060906,项目名称:CakePHP-Payment-Plugin,代码行数:17,代码来源:PaymentNetworkComponent.php

示例11: initialize

 /**
  * Controllers initialize function.
  */
 public function initialize($Controller)
 {
     parent::initialize($Controller);
     $this->Controller = $Controller;
     Configure::write('CORE.current_route', Router::currentRoute());
     $this->__registerPlugins();
     $this->__paginationRecall();
     if (Configure::read('Website.force_www')) {
         $this->forceWwwUrl();
     }
 }
开发者ID:nani8124,项目名称:infinitas,代码行数:14,代码来源:InfinitasComponent.php

示例12: initialize

 public function initialize(Controller $controller)
 {
     $this->Controller = $controller;
     $this->Status = ClassRegistry::init('Status');
     $this->Regulation = ClassRegistry::init('Regulation');
     $this->Code = ClassRegistry::init('Code');
     $this->Department = ClassRegistry::init('Department');
     $this->Chapter = ClassRegistry::init('Chapter');
     $this->CustomsDuty = ClassRegistry::init('CustomsDuty');
     $this->Country = ClassRegistry::init('Country');
     parent::initialize($controller);
 }
开发者ID:sianto1997,项目名称:XLabs,代码行数:12,代码来源:ImportComponent.php

示例13: initialize

 /**
  * Overrides initialize
  *
  * Overrides applied before the controller’s beforeFilter method.
  *
  * @param Controller $controller
  * @return boolean|void
  */
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     $settings = $this->settings;
     if (isset($settings['api_key'])) {
         $this->WakaTime->setApiKey($settings['api_key']);
     } elseif (Configure::check('wakatime.api_key')) {
         $this->WakaTime->setApiKey(Configure::read('wakatime.api_key'));
     } else {
         throw new InvalidArgumentException('WakaTime API key is required.');
     }
     return true;
 }
开发者ID:chrisvogt,项目名称:cakephp-wakatime,代码行数:21,代码来源:WakaTimeComponent.php

示例14: initialize

 /**
  * Controller名とAction名に大文字が含まれる場合に例外を投げる
  * [a-z][0-9][_]のみを有効とする
  * @throws BadRequestException
  * @param controller
  * @return void
  */
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     //requestのcontroller名とaction名を取得
     $reqController = $controller->request->controller;
     $reqAction = $controller->request->action;
     if ($reqController !== strtolower($reqController)) {
         // 大文字が含まれている
         throw new BadRequestException(__('This address is not valid'));
     }
     if ($reqAction !== strtolower($reqAction)) {
         // 大文字が含まれている
         throw new BadRequestException(__('This address is not valid'));
     }
 }
开发者ID:tutida,项目名称:reject-upper-case,代码行数:22,代码来源:RejectUpperCaseComponent.php

示例15: initialize

 public function initialize($controller, $settings = array())
 {
     if (Configure::read('debug') != 0) {
         ini_set('soap.wsdl_cache_enabled', false);
     }
     $this->controller = $controller;
     if (isset($settings['wsdl']) && !empty($settings['wsdl'])) {
         $this->__settings['wsdl'] = $settings['wsdl'];
     }
     if (isset($settings['prefix'])) {
         $this->__settings['prefix'] = $settings['prefix'];
     }
     if (isset($settings['action'])) {
         $this->__settings['action'] = is_array($settings['action']) ? $settings['action'] : array($settings['action']);
     }
     parent::initialize($controller);
 }
开发者ID:hobbysh,项目名称:seevia-opensource,代码行数:17,代码来源:soap.php


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