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


PHP Zend_Controller_Request_Abstract::setControllerName方法代码示例

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


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

示例1: preDispatch

 /**
  * Called before an action is dispatched by Zend_Controller_Dispatcher.
  *
  * This callback allows for proxy or filter behavior.  By altering the
  * request and resetting its dispatched flag (via
  * {@link Zend_Controller_Request_Abstract::setDispatched() setDispatched(false)}),
  * the current action may be skipped.
  *
  * @param  Zend_Controller_Request_Abstract $request
  * @return void
  */
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $oAuth = Zend_Auth::getInstance();
     $oAcl = $this->getAcl();
     // Default role
     $sRole = 'all';
     if ($oAuth->hasIdentity()) {
         $oIdentity = $oAuth->getIdentity();
         $sRole = isset($oIdentity->sRole) ? $oIdentity->sRole : 'identify';
     }
     $sModule = $request->module;
     $sController = $request->controller;
     $sAction = $request->action;
     $sResource = $sController . ':' . $sAction;
     if ($oAcl->has($sResource)) {
         if (!$oAcl->isAllowed('all', $sResource)) {
             // Access is not allowed
             if (!$oAcl->isAllowed($sRole, $sResource)) {
                 //$flashMessenger = new Zend_Controller_Action_Helper_FlashMessenger();
                 //$flashMessenger->addMessage('Acesso negado');
                 $request->setModuleName('default');
                 $request->setControllerName('index');
                 $request->setActionName('index');
             }
         }
     } else {
         $flashMessenger = new Zend_Controller_Action_Helper_FlashMessenger();
         $flashMessenger->addMessage('Acesso negado');
         $request->setModuleName('default');
         $request->setControllerName('index');
         $request->setActionName('index');
     }
 }
开发者ID:julioprotzek,项目名称:eventos,代码行数:44,代码来源:Acl.php

示例2: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $aNamespace = new Zend_Session_Namespace('userNs');
     if ($aNamespace->perfil != "") {
         $role = $aNamespace->perfil;
     } else {
         $role = 'guest';
     }
     $controller = strtolower($request->getControllerName());
     $action = strtolower($request->getActionName());
     $module = strtolower($request->getModuleName());
     $resource = $module . ':' . str_replace('-', '', $controller) . '.' . $action;
     //        $resource   = $module.':'.$controller.'.'.$action;
     if (!$this->_acl->isAllowed($role, $resource, $action)) {
         if ($this->_auth->hasIdentity()) {
             $request->setModuleName('default');
             $request->setControllerName('error');
             $request->setActionName('nopermission');
         } else {
             $this->_flashMessenger->addMessage(array('status' => 'error', 'message' => 'Favor logar novamente.'));
             $request->setModuleName('default');
             $request->setControllerName('login');
             $request->setActionName('index');
         }
     }
 }
开发者ID:marcelocaixeta,项目名称:zf1,代码行数:26,代码来源:Acl.php

示例3: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $auth = Zend_Auth::getInstance();
     $isAllowed = false;
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     // Generate the resource name
     $resourceName = $controller . '/' . $action;
     // Don't block errors
     if ($resourceName == 'error/error') {
         return;
     }
     $resources = $this->acl->getResources();
     if (!in_array($resourceName, $resources)) {
         $request->setControllerName('error')->setActionName('error')->setDispatched(true);
         throw new Zend_Controller_Action_Exception('This page does not exist', 404);
         return;
     }
     // Check if user can access this resource or not
     $isAllowed = $this->acl->isAllowed(Zend_Registry::get('role'), $resourceName);
     // Forward user to access denied or login page if this is guest
     if (!$isAllowed) {
         if (!Zend_Auth::getInstance()->hasIdentity()) {
             $forwardAction = 'login';
         } else {
             $forwardAction = 'deny';
         }
         $request->setControllerName('index')->setActionName($forwardAction)->setDispatched(true);
     }
 }
开发者ID:georgepaul,项目名称:socialstrap,代码行数:30,代码来源:AccessCheck.php

示例4: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     /**
      * Pegando o helper Redirector
      */
     $this->_redirect = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector');
     /*
      * Instanciando as variáveis de sessão do zend_auth
      */
     $authNamespace = new Zend_Session_Namespace('Zend_Auth');
     /**
      * Copiando em variáves o modulo, controlle e action
      */
     $module = strtolower($request->getModuleName());
     $controller = strtolower($request->getControllerName());
     $action = strtolower($request->getActionName());
     /**
      * Se o usuário estiver autenticado
      */
     if (Zend_Auth::getInstance()->hasIdentity()) {
         if (isset($authNamespace->timeout) && time() > $authNamespace->timeout) {
             /**
              * limpa a identidade do usuário que está um longo período sem acessar o controller
              */
             $request->setModuleName('default');
             $request->setControllerName('login');
             $request->setActionName('logout');
             $authNamespace->erro = 'Sua sessão expirou, favor logar novamente';
         } else {
             /**
              *  Usuário está ativo - atualizamos o time da sessão.
              */
             $authNamespace->timeout = strtotime(self::$_ZEND_SESSION_NAMESPACE_EXPIRATION_SECONDS . " seconds");
             /**
              * Renovando o timeout das variáves de sessão
              */
             $namesspaces = Zend_Session::getIterator();
             $namesspacesArrayCopy = $namesspaces->getArrayCopy();
             foreach ($namesspacesArrayCopy as $namesspace) {
                 $namesspace_each = new Zend_Session_Namespace($namesspace);
                 //$namesspace_each->setExpirationSeconds(self::$_ZEND_SESSION_NAMESPACE_EXPIRATION_SECONDS);
                 $namesspace_each->timeout = strtotime(self::$_ZEND_SESSION_NAMESPACE_EXPIRATION_SECONDS . " seconds");
                 $temp = $namesspace_each->timeout;
             }
         }
     }
     /** Se o usuário não possuir identidade ou a identidade foi removida devido ao timeout,
      * redirecionamos ele para a tela de login.
      */
     if (!Zend_Auth::getInstance()->hasIdentity()) {
         if (!($module == 'default' && $controller == 'login' && $action == 'index') && !($module == 'default' && $controller == 'login' && $action == 'ajaxbanco')) {
             $request->setModuleName('default');
             $request->setControllerName('login');
             $request->setActionName('index');
             $request->setParam('sessao', 'expirada');
         }
         return;
     }
 }
开发者ID:marcelocaixeta,项目名称:zf1,代码行数:59,代码来源:Timeout.php

示例5: preDispatch

 /**
  * checks whether a user needs a login and is loggedin
  * otherwise redirect to login page
  *
  * @return void
  */
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     // allways allow silent update (for easy cronjob)
     if ($request->getControllerName() == 'update' && $request->getActionName() == 'silent') {
         return;
     }
     // show login
     if ($request->getParam('login', false) !== false) {
         $request->setControllerName('index');
         $request->setActionName('login');
         return;
     }
     // logout?
     if ($request->getParam('logout', false) !== false) {
         Zend_Registry::get('session')->__unset('authenticated');
         $request->setControllerName('index');
         $request->setActionName('login');
         return;
     }
     // disallow readonly mode if user has option public not set
     if (Zend_Registry::get('session')->authenticated === 'readonly' && Zend_Registry::get('session')->public != 1) {
         Zend_Registry::get('session')->authenticated = false;
     }
     // check whether user loggedin or public access allowed
     if (Zend_Registry::get('session')->authenticated !== true && Zend_Registry::get('session')->authenticated !== 'readonly') {
         // no login required?
         $users = new application_models_users();
         if (!$users->getUsername()) {
             Zend_Registry::get('session')->authenticated = true;
             // public access allowed? start public mode
         } elseif (Zend_Registry::get('session')->public == 1) {
             Zend_Registry::get('session')->authenticated = 'readonly';
             // unallowed access -> show login window
         } else {
             $request->setControllerName('index');
             $request->setActionName('login');
             return;
         }
     }
     // load default values 4 readonly mode
     if (Zend_Registry::get('session')->authenticated === 'readonly') {
         $priorityStart = Zend_Registry::get('session')->priorityStart;
         $priorityEnd = Zend_Registry::get('session')->priorityEnd;
         // reset session with default config from config.ini
         Zend_Registry::get('bootstrap')->resetSession(false);
         // set priority slider
         Zend_Registry::get('session')->currentPriorityStart = $priorityStart;
         Zend_Registry::get('session')->currentPriorityEnd = $priorityEnd;
         Zend_Registry::get('session')->priorityStart = $priorityStart;
         Zend_Registry::get('session')->priorityEnd = $priorityEnd;
     }
     // don't allow any changings in readonly mode
     if (Zend_Registry::get('session')->authenticated !== true) {
         if ($request->getControllerName() != 'error' && $request->getControllerName() != 'index' && $request->getControllerName() != 'patch' && !($request->getControllerName() == 'item' && $request->getActionName() == 'list') && !($request->getControllerName() == 'item' && $request->getActionName() == 'listmore') && !($request->getControllerName() == 'update' && $request->getActionName() == 'silent')) {
             die('access denied');
         }
     }
 }
开发者ID:google-code-backups,项目名称:rsslounge,代码行数:64,代码来源:Authentication.php

示例6: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     try {
         $module = $request->getModuleName();
         if ($module == 'admin') {
             $moduleList = new Zend_Session_Namespace('moduleList');
             $userInfo = new Zend_Session_Namespace('userInfo');
             $module = $moduleList->module;
             $allowed_module = $userInfo->module_list;
             //generating all resources
             $acl = new Zend_Acl();
             //generating user permission
             $acl->addRole(new Zend_Acl_Role('admin'));
             $acl->addRole(new Zend_Acl_Role('anonymous'));
             $acl->add(new Zend_Acl_Resource('index'));
             $acl->add(new Zend_Acl_Resource('ajax'));
             $acl->allow('admin', 'index');
             $acl->allow('admin', 'ajax');
             if (!empty($module)) {
                 foreach ($module as $value) {
                     if (!$acl->has($value['controller'])) {
                         $acl->add(new Zend_Acl_Resource($value['controller']));
                     }
                     if (in_array($value['id'], $allowed_module)) {
                         if ($value['action'] != null) {
                             $acl->allow('admin', $value['controller'], $value['action']);
                         } else {
                             $acl->allow('admin', $value['controller']);
                         }
                     }
                 }
             }
             //allowing anonymous user to get into the login page
             $acl->allow('anonymous', 'index', 'index');
             $acl->allow('anonymous', 'index', 'login');
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $role = 'admin';
             } else {
                 $role = 'anonymous';
             }
             $controller = $request->controller;
             $action = $request->action;
             if (!$acl->isAllowed($role, $controller, $action)) {
                 $request->setModuleName('admin');
                 $request->setControllerName('error');
                 $request->setActionName('acl');
                 $request->setParam('type', 1);
             }
         }
     } catch (Zend_Acl_Exception $e) {
         $request->setModuleName('admin');
         $request->setControllerName('error');
         $request->setActionName('acl');
         $request->setParam('type', 2);
     }
 }
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:57,代码来源:AccessPlugin.php

示例7: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     if (PHP_SAPI == 'cli') {
         return;
     }
     $acl = new Zend_Acl();
     // add the roles
     $acl->addRole(new Zend_Acl_Role('guest'));
     $acl->addRole(new Zend_Acl_Role('user'), 'guest');
     $acl->addRole(new Zend_Acl_Role('admin'), 'user');
     // add the resources
     $acl->addResource(new Zend_Acl_Resource('index'));
     $acl->addResource(new Zend_Acl_Resource('error'));
     $acl->addResource(new Zend_Acl_Resource('user'));
     $acl->addResource(new Zend_Acl_Resource('profile'));
     $acl->addResource(new Zend_Acl_Resource('post'));
     $acl->addResource(new Zend_Acl_Resource('*'));
     // set up the access rules
     $acl->allow(null, array('index', 'error'));
     // a guest can only sign up content and login
     $acl->allow('guest', 'user', array('login', 'register', 'unique', 'search'));
     // user
     $acl->allow('user', 'user', array('edit', 'logout'));
     $acl->allow('user', 'profile', array('edit', 'profile', 'getxml', 'viewxml', 'more'));
     $acl->allow('user', 'post', array('new', 'postxml', 'getposts', 'like', 'share', 'comment', 'home', 'edit', 'allcomment', 'notification', 'report'));
     $acl->allow('admin', null);
     // Fetch the current user
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $id = get_user_id();
         $role = "user";
         if ($id == 2) {
             $role = "admin";
         }
     } else {
         $role = 'guest';
     }
     // Authorization
     $controller = $request->controller;
     $action = $request->action;
     try {
         if (!$acl->isAllowed($role, $controller, $action)) {
             if ($role == 'guest') {
                 $redirector = new Zend_Controller_Action_Helper_Redirector();
                 $redirector->gotoSimple('login', 'user');
             } else {
                 // User with role $role is not authorized for $controller/$action"
                 $request->setControllerName('error');
                 $request->setActionName('notauthorized');
             }
         }
     } catch (Exception $e) {
         $request->setControllerName('error');
         $request->setActionName('notfound');
     }
 }
开发者ID:sinaBaharlouei,项目名称:google_plus,代码行数:56,代码来源:Acl.php

示例8: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     // set up acl
     $acl = new Zend_Acl();
     // add the roles
     $acl->addRole(new Zend_Acl_Role('guest'));
     $acl->addRole(new Zend_Acl_Role('consumer'), 'guest');
     $acl->addRole(new Zend_Acl_Role('administrator'), 'consumer');
     $acl->addRole(new Zend_Acl_Role('client'));
     // add the resources
     $acl->add(new Zend_Acl_Resource('index'));
     $acl->add(new Zend_Acl_Resource('error'));
     $acl->add(new Zend_Acl_Resource('admin'));
     $acl->add(new Zend_Acl_Resource('campaign'));
     $acl->add(new Zend_Acl_Resource('campaigninvitation'));
     $acl->add(new Zend_Acl_Resource('campaignparticipation'));
     $acl->add(new Zend_Acl_Resource('client'));
     $acl->add(new Zend_Acl_Resource('consumer'));
     $acl->add(new Zend_Acl_Resource('conversation'));
     $acl->add(new Zend_Acl_Resource('dashboard'));
     $acl->add(new Zend_Acl_Resource('forgetpassword'));
     $acl->add(new Zend_Acl_Resource('gift'));
     $acl->add(new Zend_Acl_Resource('history'));
     $acl->add(new Zend_Acl_Resource('home'));
     $acl->add(new Zend_Acl_Resource('login'));
     // set up the access rules
     $acl->allow(null, array('index', 'error'));
     // a guest can only login
     $acl->allow('guest', 'index', array('index', 'loginfailed'));
     $acl->allow('guest', 'login', array('login'));
     $acl->allow('guest', 'forgetpassword', array('index', 'sendsms', 'sendemail'));
     // consumer
     $acl->allow('consumer', 'gift', array('list', 'addtocart', 'cart', 'listorder'));
     // administrators can do anything
     $acl->allow('administrator', null);
     // fetch the current user
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $authNamespace = new Zend_Session_Namespace('Zend_Auth');
         $role = $authNamespace->role;
     } else {
         $role = 'guest';
     }
     $controller = $request->controller;
     $action = $request->action;
     if (!$acl->isAllowed($role, $controller, $action)) {
         if ($role == 'guest') {
             $request->setControllerName('index');
             $request->setActionName('index');
         } else {
             $request->setControllerName('error');
             $request->setActionName('noauth');
         }
     }
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:55,代码来源:Acl.php

示例9: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     if (preg_match('/(.*)\\.popup$/', $request->getControllerName(), $matches)) {
         Zend_Layout::getMvcInstance()->setInflectorTarget('../../views/scripts/:script.popup.:suffix');
         $request->setControllerName($matches[1]);
     } else {
         if (preg_match('/(.*)\\.raw$/', $request->getControllerName(), $matches)) {
             Zend_Layout::getMvcInstance()->setInflectorTarget('../../views/scripts/:script.raw.:suffix');
             $request->setControllerName($matches[1]);
         }
     }
 }
开发者ID:psoas,项目名称:ch3-dev-preview,代码行数:12,代码来源:LayoutContext.php

示例10: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     // set up acl
     $acl = new Zend_Acl();
     // add the roles
     $acl->addRole(new Zend_Acl_Role('guest'));
     $acl->addRole(new Zend_Acl_Role('user'), 'guest');
     $acl->addRole(new Zend_Acl_Role('administrator'), 'user');
     // add the resources
     $acl->add(new Zend_Acl_Resource('index'));
     $acl->add(new Zend_Acl_Resource('error'));
     $acl->add(new Zend_Acl_Resource('page'));
     $acl->add(new Zend_Acl_Resource('menu'));
     $acl->add(new Zend_Acl_Resource('menuitem'));
     $acl->add(new Zend_Acl_Resource('user'));
     $acl->add(new Zend_Acl_Resource('search'));
     $acl->add(new Zend_Acl_Resource('feed'));
     // set up the access rules
     $acl->allow(null, array('index', 'error'));
     // a guest can only read content and login
     $acl->allow('guest', 'page', array('index', 'open'));
     $acl->allow('guest', 'menu', array('render'));
     $acl->allow('guest', 'user', array('login'));
     $acl->allow('guest', 'search', array('index', 'search'));
     $acl->allow('guest', 'feed');
     // cms users can also work with content
     $acl->allow('user', 'page', array('list', 'create', 'edit', 'delete'));
     // administrators can do anything
     $acl->allow('administrator', null);
     // fetch the current user
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $identity = $auth->getIdentity();
         $role = strtolower($identity->role);
     } else {
         $role = 'guest';
     }
     $controller = $request->controller;
     $action = $request->action;
     if (!$acl->isAllowed($role, $controller, $action)) {
         if ($role == 'guest') {
             $request->setControllerName('user');
             $request->setActionName('login');
         } else {
             $request->setControllerName('error');
             $request->setActionName('noauth');
         }
     }
 }
开发者ID:mtaha1990,项目名称:onlineDR,代码行数:49,代码来源:Acl.php

示例11: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $storage = new Zend_Auth_Storage_Session();
     $data = $storage->read();
     $role = $data['emprole'];
     if ($role == 1) {
         $role = 'admin';
     }
     $request->getModuleName();
     $request->getControllerName();
     $request->getActionName();
     $module = $request->getModuleName();
     $resource = $request->getControllerName();
     $privilege = $request->getActionName();
     $this->id_param = $request->getParam('id');
     $allowed = false;
     $acl = $this->_getAcl();
     $moduleResource = "{$module}:{$resource}";
     if ($resource == 'profile') {
         $role = 'viewer';
     }
     if ($resource == 'services') {
         $role = 'services';
     }
     if ($role != '') {
         if ($acl->has($moduleResource)) {
             $allowed = $acl->isAllowed($role, $moduleResource, $privilege);
         }
         if (!$allowed) {
             $request->setControllerName('error');
             $request->setActionName('error');
         }
     }
 }
开发者ID:sura2k,项目名称:sentrifugo,代码行数:34,代码来源:AccessControl.php

示例12: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     // инициилизация объектов
     $auth = Zend_Auth::getInstance();
     $acl = Zend_Registry::get('acl');
     // если есть залогиненый пользователь
     if ($auth->hasIdentity()) {
         $role = $auth->getIdentity()->role;
     } else {
         $role = 'guest';
     }
     // если нет вообще такой роли, то будет гость
     if (!$acl->hasRole($role)) {
         $role = 'guest';
     }
     // наши ресурсы
     $controller = $request->controller;
     $action = $request->action;
     // если контроллер не существует тогда нулл
     if (!$acl->has($controller)) {
         $controller = null;
     }
     // если не существует перенаправляем на ошибку
     if (!$acl->isAllowed($role, $controller, $action)) {
         $request->setControllerName($this->_controller['controller']);
         $request->setActionName($this->_controller['action']);
     }
 }
开发者ID:MichaelGogeshvili,项目名称:strap,代码行数:28,代码来源:Acl.php

示例13: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     if ($this->_auth->hasIdentity()) {
         $role = $this->_auth->getIdentity()->getUser()->role;
     } else {
         $role = 'guest';
     }
     $controller = $request->controller;
     $action = $request->action;
     $module = $request->module;
     $resource = $controller;
     if (!$this->_acl->has($resource)) {
         $resource = null;
     }
     if (!$this->_acl->isAllowed($role, $resource, $action)) {
         if (!$this->_auth->hasIdentity()) {
             $module = self::NO_AUTH_MODULE;
             $controller = self::NO_AUTH_CONTROLLER;
             $action = self::NO_AUTH_ACTION;
         } else {
             $module = self::NO_ACL_MODULE;
             $controller = self::NO_ACL_CONTROLLER;
             $action = self::NO_ACL_ACTION;
         }
     }
     $request->setModuleName($module);
     $request->setControllerName($controller);
     $request->setActionName($action);
 }
开发者ID:Neozeratul,项目名称:Intermodels,代码行数:29,代码来源:Auth.php

示例14: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $auth = Zend_Auth::getInstance();
     $acl = Zend_Registry::get('acl');
     if ($auth->hasIdentity()) {
         $role = $auth->getIdentity()->role;
     } else {
         $role = 'guest';
     }
     if (!$acl->hasRole($role)) {
         $role = 'guest';
     }
     $controller = $request->controller;
     $action = $request->action;
     if ($controller == 'admin' && $action == 'index') {
         $this->_controller['controller'] = 'admin';
         $this->_controller['action'] = 'login';
     }
     if (!$acl->has($controller)) {
         $controller = null;
     }
     if (!$acl->isAllowed($role, $controller, $action)) {
         $request->setControllerName($this->_controller['controller']);
         $request->setActionName($this->_controller['action']);
     }
 }
开发者ID:p-artem,项目名称:zend.site,代码行数:26,代码来源:Acl.php

示例15: 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


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