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


PHP Zend_Controller_Request_Abstract::setDispatched方法代码示例

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


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

示例1: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     if ($request->getModuleName() === "admin" && !Zend_Auth::getInstance()->hasIdentity()) {
         $request->setModuleName("admin")->setControllerName("auth")->setActionName("login");
         $request->setDispatched();
     }
 }
开发者ID:nandorodpires2,项目名称:guiamais,代码行数:7,代码来源:Auth.php

示例2: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $dispatcher = Zend_Controller_Front::getInstance()->getDispatcher();
     $controllerName = $request->getControllerName();
     if (empty($controllerName)) {
         $controllerName = $dispatcher->getDefaultController();
     }
     $className = $dispatcher->formatControllerName($controllerName);
     if ($className) {
         try {
             // if this fails, an exception will be thrown and
             // caught below, indicating that the class can’t
             // be loaded.
             Zend_Loader::loadClass($className, $dispatcher->getControllerDirectory());
             $actionName = $request->getActionName();
             if (empty($actionName)) {
                 $actionName = $dispatcher->getDefaultAction();
             }
             $methodName = $dispatcher->formatActionName($actionName);
             $class = new ReflectionClass($className);
             if ($class->hasMethod($methodName)) {
                 // all is well - exit now
                 return;
             }
         } catch (Zend_Exception $e) {
             // Couldn’t load the class. No need to act yet,
             // just catch the exception and fall out of the
             // if
         }
     }
     // we only arrive here if can’t find controller or action
     $request->setControllerName('noroute');
     $request->setActionName('index');
     $request->setDispatched(false);
 }
开发者ID:nyeholt,项目名称:relapse,代码行数:35,代码来源:NoRoutePlugin.php

示例3: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     if ($request->getModuleName() == 'admin' && !($request->getControllerName() == 'index' && $request->getActionName() == 'login')) {
         $auth = Zend_Auth::getInstance();
         if (!$auth->hasIdentity() || $auth->getIdentity() != 'admin') {
             $request->setDispatched(true);
             $this->_response->setRedirect('/admin/index/login');
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:zfblank,代码行数:10,代码来源:AdminLogin.php

示例4: preDispatch

 public function preDispatch(\Zend_Controller_Request_Abstract $request)
 {
     $this->hasIdentity();
     if (!$this->_hasIdentity) {
         $request->setControllerName('auth');
         $request->setActionName('login');
         $request->setDispatched();
     }
     parent::preDispatch($request);
 }
开发者ID:nandorodpires2,项目名称:k-sys,代码行数:10,代码来源:Auth.php

示例5: dispatchLoopStartup

 /**
  * Called before Zend_Controller_Front enters its dispatch loop.
  *
  * During the dispatch loop, Zend_Controller_Front keeps a
  * Zend_Controller_Request_Abstract object, and uses
  * Zend_Controller_Dispatcher to dispatch the
  * Zend_Controller_Request_Abstract object to controllers/actions.
  *
  * @param  AbstractRequest $request
  * @return void
  */
 public function dispatchLoopStartup(AbstractRequest $request)
 {
     $newActionName = self::_camelize($request->getActionName());
     #$newControllerName = self::_camelize($request->getControllerName());
     #$newModuleName     = self::_camelize($request->getModuleName());
     $request->setActionName($newActionName);
     #$request->setControllerName($newControllerName);
     #$request->setModuleName($newModuleName);
     $request->setDispatched(false);
     FrontController::getInstance()->setRequest($request);
 }
开发者ID:rexmac,项目名称:zyndax,代码行数:22,代码来源:CamelCaseAction.php

示例6: preDispatch

 /**
  * Pre-dispatch, check acl.
  *
  * @param Zend_Controller_Request_Abstract $request
  */
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $resource = $request->getModuleName();
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     // Remember me for admin
     if ($resource == 'admin' && !Zend_Auth::getInstance()->hasIdentity()) {
         $r = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
         $r->gotoUrl('/login')->redirectAndExit();
     }
     $request->setDispatched(true);
 }
开发者ID:beesheer,项目名称:freehdfootage,代码行数:17,代码来源:Acl.php

示例7: _forwardLogin

 protected function _forwardLogin(Zend_Controller_Request_Abstract $request)
 {
     $request->setModuleName('kwf_controller_action_user');
     $request->setControllerName('login');
     $request->setDispatched(false);
     if (substr($request->getActionName(), 0, 4) == 'json') {
         $request->setActionName('json-login');
     } else {
         $params = array('location' => $request->getBaseUrl() . '/' . ltrim($request->getPathInfo(), '/'));
         $request->setParams($params);
         $request->setActionName('index');
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:13,代码来源:Abstract.php

示例8: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $controller = strtolower($request->getControllerName());
     $action = strtolower($request->getActionName());
     $route = $controller . '/' . $action;
     if (in_array($route, $this->_whitelist)) {
         return;
     }
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         return;
     }
     $request->setDispatched(false);
     $request->setControllerName('user');
     $request->setActionName('login');
     $request->setParam('next_uri', $request->getPathInfo());
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:17,代码来源:AuthPlugin.php

示例9: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $controller = strtolower($request->getControllerName());
     $action = strtolower($request->getActionName());
     $route = $controller . '/' . $action;
     if (in_array($route, self::$_whitelist)) {
         return;
     }
     $auth = Infra_AuthHelper::getAuthInstance();
     if ($auth->hasIdentity()) {
         return;
     }
     $request->setDispatched(false);
     $request->setControllerName(self::$defaultController);
     $request->setActionName(self::$defaultAction);
     $request->setParam('next_uri', $request->getPathInfo());
 }
开发者ID:DBezemer,项目名称:server,代码行数:17,代码来源:AuthPlugin.php

示例10: dispatch

 /**
  * Dispatch an HTTP request to a controller/action.
  *
  * @param Zend_Controller_Request_Abstract|null $request
  * @param Zend_Controller_Response_Abstract|null $response
  * @return void|Zend_Controller_Response_Abstract Returns response object if returnResponse() is true
  */
 public function dispatch(Zend_Controller_Request_Abstract $request = null, Zend_Controller_Response_Abstract $response = null)
 {
     if (!$this->getParam('noErrorHandler') && !$this->_plugins->hasPlugin('Zend_Controller_Plugin_ErrorHandler')) {
         // Register with stack index of 100
         #require_once 'Zend/Controller/Plugin/ErrorHandler.php';
         $this->_plugins->registerPlugin(new Zend_Controller_Plugin_ErrorHandler(), 100);
     }
     if (!$this->getParam('noViewRenderer') && !Zend_Controller_Action_HelperBroker::hasHelper('viewRenderer')) {
         #require_once 'Zend/Controller/Action/Helper/ViewRenderer.php';
         Zend_Controller_Action_HelperBroker::getStack()->offsetSet(-80, new Zend_Controller_Action_Helper_ViewRenderer());
     }
     /**
      * Instantiate default request object (HTTP version) if none provided
      */
     if (null !== $request) {
         $this->setRequest($request);
     } elseif (null === $request && null === ($request = $this->getRequest())) {
         #require_once 'Zend/Controller/Request/Http.php';
         $request = new Zend_Controller_Request_Http();
         $this->setRequest($request);
     }
     /**
      * Set base URL of request object, if available
      */
     if (is_callable(array($this->_request, 'setBaseUrl'))) {
         if (null !== $this->_baseUrl) {
             $this->_request->setBaseUrl($this->_baseUrl);
         }
     }
     /**
      * Instantiate default response object (HTTP version) if none provided
      */
     if (null !== $response) {
         $this->setResponse($response);
     } elseif (null === $this->_response && null === ($this->_response = $this->getResponse())) {
         #require_once 'Zend/Controller/Response/Http.php';
         $response = new Zend_Controller_Response_Http();
         $this->setResponse($response);
     }
     /**
      * Register request and response objects with plugin broker
      */
     $this->_plugins->setRequest($this->_request)->setResponse($this->_response);
     /**
      * Initialize router
      */
     $router = $this->getRouter();
     $router->setParams($this->getParams());
     /**
      * Initialize dispatcher
      */
     $dispatcher = $this->getDispatcher();
     $dispatcher->setParams($this->getParams())->setResponse($this->_response);
     // Begin dispatch
     try {
         /**
          * Route request to controller/action, if a router is provided
          */
         /**
          * Notify plugins of router startup
          */
         $this->_plugins->routeStartup($this->_request);
         $router->route($this->_request);
         /**
          * Notify plugins of router completion
          */
         $this->_plugins->routeShutdown($this->_request);
         /**
          * Notify plugins of dispatch loop startup
          */
         $this->_plugins->dispatchLoopStartup($this->_request);
         /**
          *  Attempt to dispatch the controller/action. If the $this->_request
          *  indicates that it needs to be dispatched, move to the next
          *  action in the request.
          */
         do {
             $this->_request->setDispatched(true);
             /**
              * Notify plugins of dispatch startup
              */
             $this->_plugins->preDispatch($this->_request);
             /**
              * Skip requested action if preDispatch() has reset it
              */
             if (!$this->_request->isDispatched()) {
                 continue;
             }
             /**
              * Dispatch request
              */
             try {
                 $dispatcher->dispatch($this->_request, $this->_response);
//.........这里部分代码省略.........
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:101,代码来源:Front.php

示例11: dispatch

 /**
  * Dispatch controller action
  *
  * @param string $action action name
  * @return void
  */
 public function dispatch($action)
 {
     $this->_request->setDispatched(false);
 }
开发者ID:nemphys,项目名称:magento2,代码行数:10,代码来源:Forward.php

示例12: postDispatch

 /**
  * Set the controllername if needed and re-dispatch
  *
  * @param $request
  * @return void
  */
 public function postDispatch(Zend_Controller_Request_Abstract $request)
 {
     //Check if the module is registered for HMVC
     if (!$this->isActiveModule($request->getModuleName())) {
         return;
     }
     ++$this->_pos;
     $dispatched = true;
     if (array_key_exists($this->_pos, $this->_controllers)) {
         //Whoa! New controller to serve!
         $dispatched = false;
         $request->setControllerName($this->_controllers[$this->_pos])->setParam('controller', $this->_controllers[$this->_pos]);
     }
     $request->setDispatched($dispatched);
 }
开发者ID:nstapelbroek,项目名称:Glitch_Lib,代码行数:21,代码来源:Hmvc.php


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