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


PHP Zend_Controller_Request_Http::setParams方法代码示例

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


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

示例1: match

 public function match(Zend_Controller_Request_Http $request)
 {
     if (!Mage::app()->isInstalled()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
         exit;
     }
     $pathInfo = trim($request->getPathInfo(), '/');
     //echo $pathInfo;die();
     $pathInfoAr = explode('/', $pathInfo);
     if ($pathInfoAr[0] == Mage::getStoreConfig('vc_miniblog/blog/router')) {
         if (isset($pathInfoAr[1])) {
             switch ($pathInfoAr[1]) {
                 case 'tag':
                     $request->setModuleName('vc_miniblog')->setControllerName('index')->setActionName('index');
                     $request->setParams(array('tag' => $pathInfoAr[2]));
                     $request->setParams(array('tag' => $pathInfoAr[2]));
                     break;
                 case 'cat':
                     $request->setModuleName('vc_miniblog')->setControllerName('index')->setActionName('index');
                     $request->setParams(array('cat' => $pathInfoAr[2]));
                     break;
                 default:
                     $request->setModuleName('vc_miniblog')->setControllerName('index')->setActionName('postDetail');
                     $request->setParams(array('identifier' => $pathInfoAr[1]));
                     break;
             }
         } else {
             $request->setModuleName('vc_miniblog')->setControllerName('index')->setActionName('index');
         }
         return true;
     }
     return false;
 }
开发者ID:hoadaithieu,项目名称:mage-miniblog,代码行数:33,代码来源:Router.php

示例2: testSetGetParams

 public function testSetGetParams()
 {
     $params = array('foo' => 'bar', 'boo' => 'bah', 'fee' => 'fi');
     $this->_request->setParams($params);
     $received = $this->_request->getParams();
     $this->assertSame($params, array_intersect_assoc($params, $received));
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:7,代码来源:HttpTest.php

示例3: match

 /**
  * @see XenForo_Route_Interface::match()
  * @param $routePath
  * @param \Zend_Controller_Request_Http $request
  * @param \XenForo_Router $router
  * @return \XenForo_RouteMatch
  */
 public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
 {
     $customIndex = XenForo_Application::get('customIndex');
     if ($customIndex->params) {
         $request->setParams($customIndex->params->toArray());
     }
     return $router->getRouteMatch($customIndex->controllerClass, $routePath, $customIndex->majorSection, $customIndex->minorSection);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:15,代码来源:Index.php

示例4: testSelected

 function testSelected()
 {
     $vehicle = $this->createMMY('Honda', 'Civic', '2000');
     $request = new Zend_Controller_Request_Http();
     $request->setParams($vehicle->toTitleArray());
     $search = new VF_Search();
     $search->setRequest($request);
     $this->assertEquals($vehicle->getValue('model'), $search->getSelected('model'));
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:9,代码来源:SearchTest.php

示例5: testSetNullParamsUnsetsKeys

 public function testSetNullParamsUnsetsKeys()
 {
     $this->_request->setParams(array('foo' => 'bar', 'bar' => 'baz'));
     $this->assertEquals('bar', $this->_request->getParam('foo'));
     $this->assertEquals('baz', $this->_request->getParam('bar'));
     $this->_request->setParams(array('foo' => null));
     $params = $this->_request->getParams();
     $this->assertFalse(isset($params['foo']));
     $this->assertTrue(isset($params['bar']));
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:10,代码来源:HttpTest.php

示例6: testGetParamsWithGetAndPost

 public function testGetParamsWithGetAndPost()
 {
     $_GET = array('get' => true);
     $_POST = array('post' => true);
     $params = array('foo' => 'bar', 'boo' => 'bah', 'fee' => 'fi');
     $this->_request->setParams($params);
     $expected = $params + $_GET + $_POST;
     $received = $this->_request->getParams();
     $this->assertSame($params, array_intersect_assoc($params, $received));
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:10,代码来源:HttpTest.php

示例7: IsAllowed

 /**
  * Verifica se tem permissão de acordo com os parâmetros na 'acl avançada'
  * @param array $params
  * @param bool $forceParams
  * @param bool $isAcl
  * @param bool $onlyUserParam
  * @param array $request
  * @return bool
  */
 public function IsAllowed($params, $forceParams = true, $isAcl = true, $onlyUserParam = false, $request = [])
 {
     $this->_mdlParams = new Acl_Model_Params();
     // Pegando a 'MCA' de acordo com o request ou com os dados passados
     $dbMca = Acl_Model_DbTable_Actions::getMcaByRequest($request);
     $controllerId = $dbMca->controller_id;
     if ($forceParams) {
         $controlParams = array();
         $actions = $this->_mdlParams->getParamsByController($controllerId);
         foreach ($actions as $action) {
             $controlParams = array_merge($controlParams, $action['params']);
         }
         foreach ($params as $paramName => $paramValue) {
             $param_exists = false;
             foreach ($controlParams as $cparam) {
                 $param_exists = $cparam['name'] == $paramName ? true : false;
             }
             if (!$param_exists) {
                 // Criando o parâmetro no banco
                 $this->_mdlParams->createParam(['acl_action_id' => $dbMca->action_id, 'name' => $paramName, 'description' => 'create by ' . __CLASS__]);
             }
         }
     }
     /*
      * Rota
      */
     if ($isAcl) {
         $params['module'] = 'acl';
         $params['controller'] = 'params';
         $params['action'] = 'list';
         $params['control'] = $controllerId;
     } else {
         $params['module'] = $dbMca->module_name;
         $params['controller'] = $dbMca->controller_name;
         $params['action'] = $dbMca->action_name;
     }
     $control = Zend_Controller_Front::getInstance()->getPlugin('Acl_Plugin_Control');
     $control->setUserRole(Zend_Auth::getInstance()->getIdentity()->role_name);
     $access = $control->checkAccess($params['module'] . ':' . $params['controller'] . ':' . $params['action']);
     if ($onlyUserParam) {
         $request = new Zend_Controller_Request_Http();
         $request->setParams($params);
         $access = $control->isParamAllowed($request);
         return $access;
     } else {
         if ($access) {
             $request = new Zend_Controller_Request_Http();
             $request->setParams($params);
             $access = $control->isParamAllowed($request);
         }
     }
     return $access;
 }
开发者ID:Graphitec,项目名称:graphitec,代码行数:62,代码来源:IsAllowed.php

示例8:

 function testYearSelected_YearEnd()
 {
     $civic2000 = $this->createMMY('Honda', 'Civic', '2000');
     $civic2001 = $this->createMMY('Honda', 'Civic', '2001');
     $request = new Zend_Controller_Request_Http();
     $request->setParams(array('make' => $civic2000->getValue('make'), 'model' => $civic2000->getValue('model'), 'year_start' => $civic2000->getLevel('year')->getId(), 'year_end' => $civic2001->getLevel('year')->getId()));
     $search = new VF_Search();
     $search->setRequest($request);
     $searchlevel = new VF_SearchLevel_TestSub2();
     $searchlevel->display($search, 'year', null, null, 'year_end');
     $this->assertFalse($searchlevel->getSelected($civic2000->getLevel('year')));
     $this->assertTrue($searchlevel->getSelected($civic2001->getLevel('year')));
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:13,代码来源:SearchLevelYearRangeTest.php

示例9: match

 /**
  * Rewritten function of the standard controller. Tries to match the pathinfo on url parameters.
  *
  * @see Mage_Core_Controller_Varien_Router_Standard::match()
  *
  * @param Zend_Controller_Request_Http $request The http request object that needs to be mapped on Action
  *                                              Controllers.
  */
 public function match(Zend_Controller_Request_Http $request)
 {
     if (!Mage::isInstalled()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
         exit;
     }
     $identifier = trim($request->getPathInfo(), '/');
     //URL Search after habbeda
     $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     //$identifier = trim($request->getPathInfo(), '/');
     if (strpos($url, "/alle/") <= 0 && strpos($url, "/all/") <= 0) {
         return false;
     }
     // if successfully gained url parameters, use them and dispatch ActionController action
     $request->setRouteName('landingpagesaa')->setModuleName('landingpagesaa')->setControllerName('index')->setActionName('index');
     //->setParam('test', "test");
     $urlpara = explode("/filter/", $url);
     if (!empty($urlpara[1])) {
         $urlparas = explode("?", $urlpara[1]);
         // Parse url params
         $params = explode('/', trim($urlparas[0], '/'));
         $layerParams = array();
         $total = count($params);
         for ($i = 0; $i < $total - 1; $i++) {
             if (isset($params[$i + 1])) {
                 $layerParams[$params[$i]] = urldecode($params[$i + 1]);
                 ++$i;
             }
         }
         // Add post params to parsed ones from url
         // Usefull to easily override params
         $layerParams += $request->getPost();
         // Add params to request
         $request->setParams($layerParams);
         // Save params in registry - used later to generate links
         Mage::register('layer_params', $layerParams);
     }
     $request->setRequestUri($url);
     $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
     return true;
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:49,代码来源:Router.php

示例10: match

 public function match(Zend_Controller_Request_Http $request)
 {
     if (!Mage::app()->isInstalled()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
         exit;
     }
     $pathInfo = trim($request->getPathInfo(), '/');
     //echo $pathInfo;die();
     $pathInfoAr = explode('/', $pathInfo);
     //if ($pathInfoAr[0] == Mage::getStoreConfig('vc_shopbybrands/general/router')) {
     if ($pathInfoAr[0] == Mage::getStoreConfig('vc_shopbybrands/general/router')) {
         if (isset($pathInfoAr[1])) {
             $request->setModuleName('vc_shopbybrands')->setControllerName('brands')->setActionName('view');
             $request->setParams(array('identifier' => str_replace('.html', '', $pathInfoAr[1])));
         } else {
             $request->setModuleName('vc_shopbybrands')->setControllerName('brands')->setActionName('index');
         }
         return true;
     }
     return false;
 }
开发者ID:hoadaithieu,项目名称:Mage-ShopByBrands,代码行数:21,代码来源:Router.php

示例11: _rerouteNotFound

 /**
  * Returns information about how to reroute if a page not found error occurs.
  *
  * @param string Controller name
  * @param string Action
  *
  * @return array Reroute array
  */
 protected function _rerouteNotFound($controllerName, $action)
 {
     $this->_request->setParams(array('_controllerName' => $controllerName, '_action' => $action));
     list($controllerName, $action) = $this->_dependencies->getNotFoundErrorRoute();
     return array('controllerName' => $controllerName, 'action' => $action);
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:14,代码来源:FrontController.php

示例12: testSelected

 function testSelected()
 {
     $this->switchSchema('make,model,year');
     $vehicle = $this->createMMY('Honda', 'Civic', '2000');
     $request = new Zend_Controller_Request_Http();
     $request->setParams($vehicle->toTitleArray());
     $search = new VF_Search_Form();
     VF_Singleton::getInstance()->setRequest($request);
     $this->assertEquals($vehicle->getValue('model'), $search->getSelected('model'));
 }
开发者ID:vehiclefits,项目名称:library,代码行数:10,代码来源:FormTest.php

示例13: Dispatch

 /**
  * Allows the dispatching and processing of a separate 
  * controller request from inside an existing view. 
  * 
  * Should be used for read only stuff (please!)
  *
  * @param string $controller
  * @param string $action
  * @param array $params A list of parameters to bind into the new request
  * @param string $module
  * @param array $requestParams A list of parameters to pull from the current request
  */
 public function Dispatch($controller, $action, $params = array(), $module = null, $requestParams = array())
 {
     // If no module, use the current request module
     $oldRequest = null;
     $ctrl = Zend_Controller_Front::getInstance();
     $oldRequest = $ctrl->getRequest();
     if ($module == null) {
         /* @var $request Zend_Controller_Request_Abstract  */
         $name = null;
         if ($oldRequest) {
             $name = $oldRequest->getModuleName();
         }
         if ($name && $name != 'default') {
             $module = $name;
         }
     } else {
         if ($module == 'default') {
             $module = '';
         }
     }
     $key = $controller . '|' . $action . '|' . $module;
     if (isset(self::$__DISPATCHED[$key])) {
         za()->log("Recursive dispatch detected {$key} ", Zend_Log::ERR);
         return;
     }
     self::$__DISPATCHED[$key] = true;
     $request = new Zend_Controller_Request_Http();
     $response = new Zend_Controller_Response_Http();
     $request->setControllerName($controller);
     $request->setActionName($action);
     if ($params) {
         $request->setParams($params);
     }
     if (count($requestParams)) {
         foreach ($requestParams as $rp) {
             // get from the current request and stick into the new
             $value = $oldRequest->getParam($rp, '');
             $request->setParam($rp, $value);
         }
     }
     if ($module) {
         $request->setModuleName($module);
     }
     $oldView = Zend_Registry::get(NovemberApplication::$ZEND_VIEW);
     $allPaths = $oldView->getAllPaths();
     $newView = new CompositeView();
     foreach ($allPaths['script'] as $scriptPath) {
         $newView->addScriptPath($scriptPath);
     }
     foreach ($allPaths['helper'] as $prefix => $path) {
         $newView->addHelperPath($path, $prefix);
     }
     foreach ($allPaths['filter'] as $prefix => $path) {
         $newView->addFilterPath($path, $prefix);
     }
     Zend_Registry::set(NovemberApplication::$ZEND_VIEW, $newView);
     $dispatcher = new InjectingDispatcher();
     $dispatcher->addControllerDirectory('controllers', 'default');
     $dispatcher->setParams($params)->setResponse($response);
     $request->setDispatched(true);
     $dispatcher->dispatch($request, $response);
     $response->outputBody();
     Zend_Registry::set(NovemberApplication::$ZEND_VIEW, $oldView);
 }
开发者ID:nyeholt,项目名称:relapse,代码行数:76,代码来源:Dispatch.php


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