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


PHP Zend_Controller_Request_Http::getControllerName方法代码示例

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


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

示例1: testSetGetControllerName

 public function testSetGetControllerName()
 {
     $this->_request->setControllerName('foo');
     $this->assertEquals('foo', $this->_request->getControllerName());
     $this->_request->setControllerName('bar');
     $this->assertEquals('bar', $this->_request->getControllerName());
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:7,代码来源:HttpTest.php

示例2: preDispatch

 /**
  * @param Zend_Controller_Request_Http $request
  */
 public function preDispatch($request)
 {
     // dont filter anything if a resident is logged in
     $session = new Zend_Session_Namespace();
     if ($session->currentResidentId) {
         $session->currentResident = Table_Residents::getInstance()->find($session->currentResidentId)->current();
         return;
     }
     // allow index and session controller to all
     if ($request->getControllerName() == 'index' || $request->getControllerName() == 'session') {
         return;
     }
     // Authenticate direct requests for non-html stuff
     if ($request->getParam('format') !== "html") {
         // The requestor provided a username
         if (isset($_SERVER['PHP_AUTH_USER'])) {
             $resident = Table_Residents::getInstance()->findResidentByEmailAndPasswordhash($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
             if ($resident) {
                 $session->currentResidentId = $resident->getId();
                 $session->currentResident = $resident;
                 return;
             }
         }
         header('WWW-Authenticate: Basic realm="WG-Organizer"');
         header('HTTP/1.0 401 Unauthorized');
         die;
     }
     // else redirect to frontpage
     $request->setControllerName('index');
     $request->setActionName('index');
 }
开发者ID:Velrok,项目名称:wg-organizer,代码行数:34,代码来源:AuthentificationPlugin.php

示例3: preDispatch

 /**
  * @param Zend_Controller_Request_Http $request
  */
 public function preDispatch($request)
 {
     if ($request->getControllerName() == 'setup' || $request->getControllerName() == 'error') {
         // allow all setup actions
         // and all error actions
         return;
     } else {
         // redirect other to setup install
         $request->setControllerName('setup');
         $request->setActionName('install');
     }
 }
开发者ID:Velrok,项目名称:wg-organizer,代码行数:15,代码来源:EnterSetupPlugin.php

示例4: testShouldAllowAccessForCorrectRole

 public function testShouldAllowAccessForCorrectRole()
 {
     $request = $this->request->setModuleName('admin')->setControllerName('index')->setActionName('index');
     $this->acl->addResource('admin_index');
     $this->acl->allow(Acl::ROLE_GUEST, 'admin_index');
     $plugin = new Acl($this->acl);
     $plugin->setRequest($this->request);
     $plugin->preDispatch();
     $this->assertEquals('admin', $this->request->getModuleName());
     $this->assertEquals('index', $this->request->getControllerName());
     $this->assertEquals('index', $this->request->getActionName());
 }
开发者ID:lukaszjankowski,项目名称:alchemy,代码行数:12,代码来源:AclTest.php

示例5: isActive

 /**
  * Checks if site is active for the current request
  * 
  * @param bool $checkSubs  [optional] whether site should be considered
  *                         active if a subsite is active, default is false
  * @return bool
  */
 public function isActive($checkSubs = false)
 {
     if (isset($this->uri)) {
         // when uri is set, it is considered to be off-site
         return false;
     }
     
     if (null == self::$_request) {
         self::$_request = Zend_Controller_Front::getInstance()->getRequest();
     }
     
     $reqModule = self::$_request->getModuleName();
     $reqController = self::$_request->getControllerName();
     $reqAction = self::$_request->getActionName();
     
     if ($this->module == $reqModule &&
         $this->controller == $reqController &&
         $this->action == $reqAction) {
             return true;
     }
     
     if ($checkSubs && $this->hasSubSites()) {
         foreach ($this->_subSites as $id => $subSite) {
             if ($subSite->isActive(true)) {
                 return true;
             }
         }
     }
     
     return false;
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:38,代码来源:Site.php

示例6: testPostDispatchWithoutException

 public function testPostDispatchWithoutException()
 {
     $this->request->setModuleName('foo')->setControllerName('bar')->setActionName('baz');
     $this->plugin->postDispatch($this->request);
     $this->assertEquals('baz', $this->request->getActionName());
     $this->assertEquals('bar', $this->request->getControllerName());
     $this->assertEquals('foo', $this->request->getModuleName());
 }
开发者ID:travisj,项目名称:zf,代码行数:8,代码来源:ErrorHandlerTest.php

示例7: testPreDispatchNonWhitelistedActionWithAuthenticatedSession

 public function testPreDispatchNonWhitelistedActionWithAuthenticatedSession()
 {
     $this->request->setModuleName('default')->setControllerName('foo')->setActionName('home');
     Zend_Auth::getInstance()->getStorage()->write(true);
     $this->plugin->preDispatch($this->request);
     $this->assertEquals('default', $this->request->getModuleName());
     $this->assertEquals('foo', $this->request->getControllerName());
     $this->assertEquals('home', $this->request->getActionName());
 }
开发者ID:rexmac,项目名称:zyndax,代码行数:9,代码来源:AuthTest.php

示例8: preDispatch

 /**
  * @param Zend_Controller_Request_Http $request
  */
 public function preDispatch($request)
 {
     // dont filter anything if a resident is logged in
     $session = new Zend_Session_Namespace();
     // Sets the resident id so the next if loads the user ;)
     if ($request->getParam('appauth_key')) {
         $session->currentResidentId = Table_Residents::getInstance()->findByAppAuthKey($request->getParam('appauth_key'));
     }
     if ($session->currentResidentId) {
         $session->currentResident = Table_Residents::getInstance()->find($session->currentResidentId)->current();
         return;
     }
     // allow index and session controller to all
     if ($request->getControllerName() == 'index' || $request->getControllerName() == 'session') {
         return;
     }
     // else redirect to frontpage
     $request->setControllerName('index');
     $request->setActionName('index');
 }
开发者ID:h-xx,项目名称:wg-organizer,代码行数:23,代码来源:AuthentificationPlugin.php

示例9: dispatchRequest

 protected function dispatchRequest(Zend_Controller_Request_Http $request, X_Page_ItemList_PItem $items, Zend_Controller_Action $controller)
 {
     /* @var $view Zend_Controller_Action_Helper_ViewRenderer */
     $view = $controller->getHelper('viewRenderer');
     /* @var $layout Zend_Layout_Controller_Action_Helper_Layout */
     $layout = $controller->getHelper('layout');
     try {
         $view->setNoRender(true);
         $layout->disableLayout();
     } catch (Exception $e) {
         X_Debug::e("Layout or View not enabled: " . $e->getMessage());
     }
     $result = array();
     $actionName = $request->getActionName();
     $controllerName = $request->getControllerName();
     $result['controller'] = $controllerName;
     $result['action'] = $actionName;
     $result['success'] = true;
     $result['items'] = array();
     /* @var $urlHelper Zend_Controller_Action_Helper_Url */
     $urlHelper = $controller->getHelper('url');
     $skipMethod = array('getCustom', 'getLinkParam', 'getLinkAction', 'getLinkController');
     foreach ($items->getItems() as $itemId => $item) {
         /* @var $item X_Page_Item_PItem */
         $aItem = array();
         $methods = get_class_methods(get_class($item));
         foreach ($methods as $method) {
             if (array_search($method, $skipMethod) !== false) {
                 continue;
             }
             if ($method == "getIcon") {
                 $aItem['icon'] = $request->getBaseUrl() . $item->getIcon();
             } elseif (X_Env::startWith($method, 'get')) {
                 $aItem[lcfirst(substr($method, 3))] = $item->{$method}();
             } elseif (X_Env::startWith($method, 'is')) {
                 $aItem[lcfirst(substr($method, 2))] = $item->{$method}();
             }
         }
         $result['items'][] = $aItem;
     }
     /* @var $jsonHelper Zend_Controller_Action_Helper_Json */
     $jsonHelper = $controller->getHelper('Json');
     $jsonHelper->direct($result, true, false);
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:44,代码来源:WebkitRenderer.php

示例10: match

 public function match(Zend_Controller_Request_Http $request)
 {
     $this->fetchDefault();
     $front = $this->getFront();
     $p = explode('/', trim($request->getPathInfo(), '/'));
     // get module name
     if ($request->getModuleName()) {
         $module = $request->getModuleName();
     } else {
         $p = explode('/', trim($request->getPathInfo(), '/'));
         $module = !empty($p[0]) ? $p[0] : $this->getFront()->getDefault('module');
     }
     if (!$module) {
         return false;
     }
     $realModule = $this->getModuleByFrontName($module);
     if (!$realModule) {
         if ($moduleFrontName = array_search($module, $this->_modules)) {
             $realModule = $module;
             $module = $moduleFrontName;
         } else {
             return false;
         }
     }
     if (!Mage::app()->isInstalled()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
         exit;
     }
     if (Mage::app()->isInstalled() && !$request->isPost()) {
         $shouldBeSecure = substr(Mage::getStoreConfig('web/unsecure/base_url'), 0, 5) === 'https' || Mage::getStoreConfigFlag('web/secure/use_in_adminhtml') && substr(Mage::getStoreConfig('web/secure/base_url'), 0, 5) === 'https';
         if ($shouldBeSecure && !Mage::app()->getStore()->isCurrentlySecure()) {
             $url = Mage::getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/');
             Mage::app()->getFrontController()->getResponse()->setRedirect($url)->sendResponse();
             exit;
         }
     }
     // get controller name
     if ($request->getControllerName()) {
         $controller = $request->getControllerName();
     } else {
         $controller = !empty($p[1]) ? $p[1] : $front->getDefault('controller');
     }
     $controllerFileName = $this->getControllerFileName($realModule, $controller);
     if (!$controllerFileName || !is_readable($controllerFileName)) {
         $controller = 'index';
         $action = 'noroute';
         $controllerFileName = $this->getControllerFileName($realModule, $controller);
     }
     $controllerClassName = $this->getControllerClassName($realModule, $controller);
     if (!$controllerClassName) {
         $controller = 'index';
         $action = 'noroute';
         $controllerFileName = $this->getControllerFileName($realModule, $controller);
     }
     // get action name
     if (empty($action)) {
         if ($request->getActionName()) {
             $action = $request->getActionName();
         } else {
             $action = !empty($p[2]) ? $p[2] : $front->getDefault('action');
         }
     }
     // include controller file if needed
     if (!class_exists($controllerClassName, false)) {
         include $controllerFileName;
         if (!class_exists($controllerClassName)) {
             throw Mage::exception('Mage_Core', Mage::helper('core')->__('Controller file was loaded but class does not exist'));
         }
     }
     // instantiate controller class
     $controllerInstance = new $controllerClassName($request, $front->getResponse());
     if (!$controllerInstance->hasAction($action)) {
         return false;
     }
     // set values only after all the checks are done
     $request->setModuleName($module);
     $request->setControllerName($controller);
     $request->setActionName($action);
     // set parameters from pathinfo
     for ($i = 3, $l = sizeof($p); $i < $l; $i += 2) {
         $request->setParam($p[$i], isset($p[$i + 1]) ? $p[$i + 1] : '');
     }
     // dispatch action
     $request->setDispatched(true);
     $controllerInstance->dispatch($action);
     return true;
     #$request->isDispatched();
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:88,代码来源:Admin.php

示例11: logReroute

 /**
  * Log a message showing a reroute.
  * 
  * @param  Zend_Controller_Request_Http  $request
  * @param  Zend_Config|array  $rerouteTo   where to reroute the request to
  * @return void
  */
 public static function logReroute(Zend_Controller_Request_Http $request, $rerouteTo, $reason)
 {
     if ($rerouteTo instanceof Zend_Config) {
         $reroute = $rerouteTo->toArray();
     } else {
         $reroute = $rerouteTo;
     }
     self::log('Reroute from URI: ' . $request->getRequestUri() . ' (' . $request->getModuleName() . '/' . $request->getControllerName() . '/' . $request->getActionName() . '/' . ') to: ' . $reroute['moduleName'] . '/' . $reroute['controllerName'] . '/' . $reroute['actionName'] . " Reason: {$reason}");
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:16,代码来源:bootstrap.php

示例12: _matchControllerName

 /**
  * Match controller name
  *
  * @param Zend_Controller_Request_Http $request
  * @param string $param
  * @return string
  */
 protected function _matchControllerName(Zend_Controller_Request_Http $request, $param)
 {
     if ($request->getControllerName()) {
         $controller = $request->getControllerName();
     } else {
         if (!empty($param)) {
             $controller = $param;
         } else {
             $controller = $this->getFront()->getDefault('controller');
             $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, ltrim($request->getOriginalPathInfo(), '/'));
         }
     }
     return $controller;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:21,代码来源:Base.php

示例13: parseHttpRequest

 /**
  * 根据Zend_Controller_Request_Http对象生成资源字符串
  * 
  * @param Zend_Controller_Request_Http $request
  * @return string
  */
 public static function parseHttpRequest(Zend_Controller_Request_Http $request)
 {
     return self::parsePageMvc($request->getActionName(), $request->getControllerName(), $request->getModuleName());
 }
开发者ID:starflash,项目名称:ZtChart-ZF1-Example,代码行数:10,代码来源:Resource.php

示例14: getRequestProcessor

 /**
  * Get specific request processor based on request parameters.
  *
  * @param Zend_Controller_Request_Http $request
  * @return Enterprise_PageCache_Model_Processor_Default
  */
 public function getRequestProcessor(Zend_Controller_Request_Http $request)
 {
     $processor = false;
     $configuration = Mage::getConfig()->getNode(self::XML_NODE_ALLOWED_CACHE);
     if ($configuration) {
         $configuration = $configuration->asArray();
     }
     $module = $request->getModuleName();
     if (isset($configuration[$module])) {
         $model = $configuration[$module];
         $controller = $request->getControllerName();
         if (is_array($configuration[$module]) && isset($configuration[$module][$controller])) {
             $model = $configuration[$module][$controller];
             $action = $request->getActionName();
             if (is_array($configuration[$module][$controller]) && isset($configuration[$module][$controller][$action])) {
                 $model = $configuration[$module][$controller][$action];
             }
         }
         if (is_string($model)) {
             $processor = Mage::getModel($model);
         }
     }
     return $processor;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:30,代码来源:Processor.php

示例15: match

 public function match(Zend_Controller_Request_Http $request)
 {
     //checkings before even try to findout that current module should use this router
     if (!$this->_beforeModuleMatch()) {
         return false;
     }
     $this->fetchDefault();
     $front = $this->getFront();
     $p = explode('/', trim($request->getPathInfo(), '/'));
     // get module name
     if ($request->getModuleName()) {
         $module = $request->getModuleName();
     } else {
         if (!empty($p[0])) {
             $module = $p[0];
         } else {
             $module = $this->getFront()->getDefault('module');
             $request->setAlias('rewrite_request_path', '');
         }
     }
     if (!$module) {
         if (App_Main::isAdmin()) {
             $module = 'admin';
         }
     }
     if (empty($module)) {
         return false;
     }
     // Searching router args by module name from route using it as key
     $modules = $this->getModuleByFrontName($module);
     // If we did not found anything  we searching exact this module name in array values
     if ($modules === false) {
         if ($moduleFrontName = $this->getModuleByName($module, $this->_modules)) {
             $modules = array($module);
             $module = $moduleFrontName;
         }
     }
     if (empty($modules)) {
         return false;
     }
     /**
      * Going through modules to find appropriate controller
      */
     $found = false;
     foreach ($modules as $realModule) {
         $request->setRouteName($this->getRouteByFrontName($module));
         // get controller name
         if ($request->getControllerName()) {
             $controller = $request->getControllerName();
         } else {
             if (!empty($p[1])) {
                 $controller = $p[1];
             } else {
                 $controller = $front->getDefault('controller');
                 $request->setAlias('rewrite_request_path', ltrim($request->getOriginalPathInfo(), '/'));
             }
         }
         // get action name
         if (empty($action)) {
             if ($request->getActionName()) {
                 $action = $request->getActionName();
             } else {
                 $action = !empty($p[2]) ? $p[2] : $front->getDefault('action');
             }
         }
         //checking if this place should be secure
         $this->_checkShouldBeSecure($request, '/' . $module . '/' . $controller . '/' . $action);
         $controllerClassName = $this->_validateControllerClassName($realModule, $controller);
         if (!$controllerClassName) {
             continue;
         }
         // instantiate controller class
         $controllerInstance = new $controllerClassName($request, $front->getResponse());
         if (!$controllerInstance->hasAction($action)) {
             continue;
         }
         $found = true;
         break;
     }
     /**
      * if we did not found any siutibul
      */
     if (!$found) {
         if ($this->_noRouteShouldBeApplied()) {
             $controller = 'index';
             $action = 'noroute';
             $controllerClassName = $this->_validateControllerClassName($realModule, $controller);
             if (!$controllerClassName) {
                 return false;
             }
             // instantiate controller class
             $controllerInstance = new $controllerClassName($request, $front->getResponse());
             if (!$controllerInstance->hasAction($action)) {
                 return false;
             }
         } else {
             return false;
         }
     }
     // set values only after all the checks are done
//.........这里部分代码省略.........
开发者ID:hettema,项目名称:Stages,代码行数:101,代码来源:Standard.php


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