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


PHP Router::getParam方法代码示例

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


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

示例1: afterFind

 public function afterFind($results, $primary = false)
 {
     if (!in_array(Router::getParam('action'), ['editar'])) {
         $results = $this->formatDateFields($results, $this->datesToLoad, "%d/%m/%Y %H:%M");
     }
     return $results;
 }
开发者ID:AmmonMa,项目名称:cake_ERP,代码行数:7,代码来源:AcionamentoCampo_Relatorio.php

示例2: afterFind

 public function afterFind($results, $primary = false)
 {
     parent::afterFind($results, $primary);
     if (Router::getParam('action') !== 'editar') {
         return $this->formatDateFields($results, $this->datesToLoad, "%a - %d/%m/%Y %H:%M");
     }
 }
开发者ID:AmmonMa,项目名称:cake_ERP,代码行数:7,代码来源:GestaoEvento_Site_Fora.php

示例3: beforeFind

 /**
  * Adiciona sempre a condição excluído = false para todas as consultas
  * (non-PHPdoc)
  * @see Model::beforeFind()
  */
 public function beforeFind($queryData)
 {
     if (Router::getParam('controller') != 'autenticacao' && $this->name != "Conta" && $this->name != "Pessoa") {
         $queryData["conditions"][$this->name . ".conta_id = "] = CakeSession::read("Auth.Indicadores.Conta.id");
     }
     $queryData["conditions"][$this->name . ".status != "] = 0;
     return $queryData;
 }
开发者ID:tuliocrr,项目名称:indicadores,代码行数:13,代码来源:AppModel.php

示例4: checkAuthorization

 public final function checkAuthorization($user)
 {
     $controller = Inflector::camelize(Router::getParam());
     if (is_callable(array($this, 'check' . $controller . 'Authorization'))) {
         return $this->{'check' . $controller . 'Authorization'}($user);
     } else {
         return false;
     }
 }
开发者ID:hurad,项目名称:hurad,代码行数:9,代码来源:AuthorizationComponent.php

示例5: beforeValidate

 /**
  * Called during validation operations, before validation. Please note that custom
  * validation rules can be defined in $validate.
  *
  * @param array $options Options passed from Model::save().
  *
  * @return boolean True if validate operation should continue, false to abort
  * @see Model::save()
  */
 public function beforeValidate($options = [])
 {
     parent::beforeValidate($options);
     if (Router::getParam('action') == 'admin_profile') {
         if ($this->data['User']['password'] == "" && $this->data['User']['confirm_password'] == "") {
             unset($this->data['User']['password']);
             unset($this->data['User']['confirm_password']);
         }
     }
 }
开发者ID:hurad,项目名称:hurad,代码行数:19,代码来源:User.php

示例6: beforeSave

 function beforeSave($data)
 {
     /* caso a ação seja adicionar, aplica a criptografia a senha */
     if (Router::getParam('action') == 'adicionar') {
         if (!empty($this->data['Usuario']['senha'])) {
             $this->data['Usuario']['senha'] = AuthComponent::password($this->data['Usuario']['senha']);
         }
     }
     return true;
 }
开发者ID:ederdsr,项目名称:civisindicadores,代码行数:10,代码来源:Usuario.php

示例7: getListAccountOfCurrentUser

 /**
  * [getListAccountOfCurrentUser description]
  * @return [type] [description]
  */
 public function getListAccountOfCurrentUser()
 {
     $prefix = Router::getParam('prefix', true);
     if ($prefix === 'advisor') {
         $conditions = array('BankAccount.advisor_id' => AuthComponent::user('id'));
     } else {
         $conditions = array('BankAccount.user_id' => AuthComponent::user('id'));
     }
     return $this->find('all', array('recursive' => -1, 'conditions' => $conditions));
 }
开发者ID:sonnt1991,项目名称:Goikenban,代码行数:14,代码来源:BankAccount.php

示例8: beforeFilter

 public function beforeFilter()
 {
     parent::beforeFilter();
     if (Router::getParam('prefix', true) == 'api') {
         $this->Auth->allow('api_getTweets');
     }
     if ($this->Auth->user() != NULL) {
         $this->Auth->allow();
         $this->layout = "default_admin";
     }
 }
开发者ID:CHrycyna,项目名称:StMarysWebsite_2.0,代码行数:11,代码来源:TwitterController.php

示例9: __construct

 public function __construct($request = null, $response = null)
 {
     $page_title = Router::getParam('plugin');
     if (empty($page_title)) {
         $page_title = Router::getParam('controller');
     }
     $this->set('page_title', __(Inflector::humanize($page_title)));
     $this->set('meta_title', Configure::read('App.default_meta_title_prefix') . __(Inflector::humanize(Router::getParam('controller'))) . Configure::read('App.default_meta_title_surfix'));
     $this->set('meta_keywords', Configure::read('App.default_meta_keywords'));
     $this->set('meta_description', Configure::read('App.default_meta_description'));
     $this->set('plugin', Router::getParam('plugin'));
     $this->set('controller', Router::getParam('controller'));
     $this->set('action', Router::getParam('action'));
     return parent::__construct($request, $response);
 }
开发者ID:a0108393,项目名称:cms-system,代码行数:15,代码来源:AppController.php

示例10: afterFind

 public function afterFind($results, $primary = false)
 {
     array_walk($results, function (&$item) {
         if (isset($item[$this->alias])) {
             $item[$this->alias]['evento'] = html_entity_decode($item[$this->alias]['evento'], ENT_QUOTES, 'UTF-8');
         }
     });
     if (in_array(Router::getParam('action'), ['cadastrar', 'index'])) {
         return $this->formatDateFields($results, $this->datesToLoad, "%a - %d/%m/%Y %H:%M");
     }
     if (Router::getParam('action') === 'exportar') {
         return $this->formatDateFields($results, $this->datesToLoad, "%d/%m/%Y %H:%M:%S");
     }
     return $results;
 }
开发者ID:AmmonMa,项目名称:cake_ERP,代码行数:15,代码来源:AcionamentoNOC_Evento.php

示例11: __construct

 /**
  * Constructor method
  * 
  * @param [type] $route         [description]
  * @param [type] $module        [description]
  * @param [type] $adapter       [description]
  * @param [type] $method        [description]
  * @param [type] $requestMethod [description]
  * @param [type] $regEx         [description]
  */
 public final function __construct($route, $module, $adapter, $method, $requestMethod, $regEx = [])
 {
     $this->route = $route;
     $this->module = $module;
     $this->adapter = $adapter;
     $this->method = $method;
     $this->parts = Router::getURLParts($route);
     $this->requestMethods = $requestMethod;
     $this->requestMethod = $_SERVER['REQUEST_METHOD'];
     $this->params = [];
     foreach ($this->parts as $part) {
         if (Router::isParam($part)) {
             $param = Router::getParam($part);
             $this->regEx[$param] = isset($regEx[$param]) ? $regEx[$param] : NULL;
         }
     }
 }
开发者ID:jakewhiteley,项目名称:clearPHP,代码行数:27,代码来源:route.php

示例12: validates

 function validates($options = array())
 {
     // copy the data over from a custom var, otherwise
     $actionSet = 'validate' . Inflector::camelize(Router::getParam('action'));
     if (isset($this->validationSet)) {
         $temp = $this->validate;
         $param = 'validate' . $validationSet;
         $this->validate = $this->{$param};
     } elseif (isset($this->{$actionSet})) {
         $temp = $this->validate;
         $param = $actionSet;
         $this->validate = $this->{$param};
     }
     $errors = $this->invalidFields($options);
     // copy it back
     if (isset($temp)) {
         $this->validate = $temp;
         unset($this->validationSet);
     }
     if (is_array($errors)) {
         return count($errors) === 0;
     }
     return $errors;
 }
开发者ID:dipeshpatel306,项目名称:effective-adventure,代码行数:24,代码来源:AppModel.php

示例13: testGetParams

 /**
  * testGetParams
  *
  * @return void
  */
 public function testGetParams()
 {
     $paths = array('base' => '/', 'here' => '/products/display/5', 'webroot' => '/webroot');
     $params = array('param1' => '1', 'param2' => '2');
     Router::setRequestInfo(array($params, $paths));
     $expected = array('plugin' => null, 'controller' => false, 'action' => false, 'param1' => '1', 'param2' => '2');
     $this->assertEquals(Router::getParams(), $expected);
     $this->assertEquals(Router::getParam('controller'), false);
     $this->assertEquals(Router::getParam('param1'), '1');
     $this->assertEquals(Router::getParam('param2'), '2');
     Router::reload();
     $params = array('controller' => 'pages', 'action' => 'display');
     Router::setRequestInfo(array($params, $paths));
     $expected = array('plugin' => null, 'controller' => 'pages', 'action' => 'display');
     $this->assertEquals(Router::getParams(), $expected);
     $this->assertEquals(Router::getParams(true), $expected);
 }
开发者ID:nabeelio,项目名称:CakePHP-Base,代码行数:22,代码来源:RouterTest.php

示例14: allowAuth

 /**
  * Allow authorization
  *
  * @param null|array|string $methods
  *
  * @return bool
  */
 public static function allowAuth($methods = null)
 {
     if (is_null($methods)) {
         return true;
     }
     $methods = array($methods);
     if (is_array($methods)) {
         if (in_array(Router::getParam("action"), $methods)) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:hurad,项目名称:hurad,代码行数:23,代码来源:Hurad.php

示例15: handshake

 /**
  * Handshake, define relationship between chat resource_id and web authentication_id
  *
  */
 public function handshake()
 {
     $prefix = 'USER';
     if (Router::getParam('prefix', true) == 'advisor') {
         $prefix = 'ADVISOR';
     } else {
         if (Router::getParam('prefix', true) == 'admin') {
             $prefix = 'ADMIN';
         }
     }
     $authId = $prefix . '-' . AuthComponent::user('id');
     $success = $this->ChatResource->handshake($authId, $this->controller->request->data('resource_id'));
     if ($success) {
         return array('type' => 'handshake', 'resource_id' => $this->controller->request->data('resource_id'), 'auth_id' => $authId);
     }
     return array();
 }
开发者ID:sonnt1991,项目名称:Goikenban,代码行数:21,代码来源:MessageComponent.php


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