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


PHP Zend_Controller_Request_Http::setControllerName方法代码示例

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


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

示例1: setUp

    public function setUp()
    {
        $savePath = ini_get('session.save_path');
        if (strpos($savePath, ';')) {
            $savePath = explode(';', $savePath);
            $savePath = array_pop($savePath);
        }
        if (empty($savePath)) {
            $this->markTestSkipped('Cannot test FlashMessenger due to unavailable session save path');
        }

        if (headers_sent()) {
            $this->markTestSkipped('Cannot test FlashMessenger: cannot start session because headers already sent');
        }
        Zend_Session::start();

        $this->front      = Zend_Controller_Front::getInstance();
        $this->front->resetInstance();
        $this->front->setControllerDirectory(dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . '_files');
        $this->front->returnResponse(true);
        $this->request    = new Zend_Controller_Request_Http();
        $this->request->setControllerName('helper-flash-messenger');
        $this->response   = new Zend_Controller_Response_Cli();
        $this->controller = new HelperFlashMessengerController($this->request, $this->response, array());
        $this->helper     = new Zend_Controller_Action_Helper_FlashMessenger($this->controller);
    }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:26,代码来源:FlashMessengerTest.php

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

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

示例4: replaceAction

 /**
  * Test Function for replaceAction
  *
  * @return void
  */
 public function replaceAction()
 {
     $request = new Zend_Controller_Request_Http();
     $request->setControllerName('index')->setActionName('reset')->setDispatched(false);
     $response = new Zend_Controller_Response_Http();
     $front = Zend_Controller_Front::getInstance();
     $front->setRequest($request)->setResponse($response);
 }
开发者ID:jon9872,项目名称:zend-framework,代码行数:13,代码来源:IndexController.php

示例5: testCorrectViewHelperPathShouldBePropagatedWhenSubControllerInvokedInDefaultModule

 public function testCorrectViewHelperPathShouldBePropagatedWhenSubControllerInvokedInDefaultModule()
 {
     require_once $this->basePath . '/_files/modules/default/controllers/Admin/HelperController.php';
     $this->request->setControllerName('admin_helper')->setActionName('render');
     $controller = new Admin_HelperController($this->request, $this->response, array());
     $this->helper->render();
     $body = $this->response->getBody();
     $this->assertContains('SampleZfHelper invoked', $body, 'Received ' . $body);
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:9,代码来源:ViewRendererTest.php

示例6: testPreDispatch

 /**
  */
 public function testPreDispatch()
 {
     $this->acl->addRole('guest');
     $request = new Zend_Controller_Request_Http();
     $request->setModuleName('1');
     $request->setControllerName('2');
     $request->setActionName('3');
     $this->object->preDispatch($request);
     self::assertEquals('default', $request->getModuleName());
     self::assertEquals('error', $request->getControllerName());
     self::assertEquals('denied', $request->getActionName());
 }
开发者ID:kandy,项目名称:system,代码行数:14,代码来源:AclTest.php

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

示例8: match

 /**
  * Match the request
  *
  * @param Zend_Controller_Request_Http $request
  * @return boolean
  */
 public function match(Zend_Controller_Request_Http $request)
 {
     //checking before even try to find out that current module
     //should use this router
     if (!$this->_beforeModuleMatch()) {
         return false;
     }
     $front = $this->getFront();
     $path = trim($request->getPathInfo(), '/');
     $p = explode('/', $path);
     if (count($p) == 0 || !$this->_pluarizeName($p[0])) {
         return false;
     } else {
         $module = $this->_pluarizeName($p[0]);
         $modules = $this->getModuleByFrontName($module);
         if ($modules === false) {
             return false;
         }
         // checks after we found out that this router should be used for current module
         if (!$this->_afterModuleMatch()) {
             return false;
         }
         // set values only after all the checks are done
         $request->setModuleName($module);
         $request->setControllerName('index');
         $action = $this->_getActionFromPathInfo($p);
         $request->setActionName($action);
         $realModule = 'Zefir_Dealers';
         $request->setControllerModule($realModule);
         $request->setRouteName('dealers');
         // dispatch action
         $request->setDispatched(true);
         /**
          * Set params for the request
          */
         if ($action == 'view') {
             $request->setParam('dealer_code', $p[1]);
         } else {
             // set parameters from pathinfo
             for ($i = 3, $l = sizeof($p); $i < $l; $i += 2) {
                 $request->setParam($p[$i], isset($p[$i + 1]) ? urldecode($p[$i + 1]) : '');
             }
         }
         // instantiate controller class and dispatch action
         $controllerClassName = $this->_validateControllerClassName($realModule, 'index');
         $controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $front->getResponse());
         $controllerInstance->dispatch($action);
         return true;
     }
 }
开发者ID:kalburgimanjunath,项目名称:magento-dealers,代码行数:56,代码来源:Router.php

示例9: match

 /**
  * Validate and Match Cms Page and modify request
  *
  * @param Zend_Controller_Request_Http $request
  * @return bool
  */
 public function match(Zend_Controller_Request_Http $request)
 {
     if (Mage::app()->getStore()->isAdmin()) {
         return false;
     }
     $sellerAtttributeName = Mage::getConfig()->getNode('default/seller_page/attribute_name');
     $seoDisplay = Mage::getConfig()->getNode('default/seller_page/seo_display');
     if (empty($sellerAtttributeName)) {
         //Seller attribute not configured
         return false;
     }
     $pageId = $request->getPathInfo();
     $param = explode('/', $pageId);
     $seller = '';
     if (count($param) > 1 and strtolower($param[1]) == $seoDisplay and !empty($param[2])) {
         //Identify Seller
         $sellerPage = $param[2];
         if (strpos($sellerPage, '.') !== false) {
             $sellerPage = urldecode(substr($sellerPage, 0, -5));
             if ($sellerPage) {
                 $seller = str_replace('-', ' ', $sellerPage);
             } else {
                 return false;
             }
         } else {
             $seller = $sellerPage;
         }
     } else {
         return false;
     }
     if ($seller) {
         Mage::register('seller_company', $seller);
         $realModule = 'Cybage_Marketplace';
         $request->setModuleName('marketplace');
         $request->setRouteName('marketplace');
         $request->setControllerName('seller');
         $request->setActionName('sellerinfo');
         $request->setControllerModule($realModule);
         $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, ltrim($request->getRequestString(), '/'));
         $file = Mage::getModuleDir('controllers', $realModule) . DS . 'SellerController.php';
         include $file;
         //compatibility with 1.3
         $class = $realModule . '_SellerController';
         $controllerInstance = new $class($request, $this->getFront()->getResponse());
         $request->setDispatched(true);
         $controllerInstance->dispatch('sellerinfo');
     }
     return true;
 }
开发者ID:DeveshKumarThakur,项目名称:cosmetics,代码行数:55,代码来源:Router.php

示例10: forwardShopby

 protected function forwardShopby()
 {
     $reservedKey = Mage::getStoreConfig('amshopby/seo/key');
     $realModule = 'Amasty_Shopby';
     $this->request->setPathInfo($reservedKey);
     $this->request->setModuleName('amshopby');
     $this->request->setRouteName('amshopby');
     $this->request->setControllerName('index');
     $this->request->setActionName('index');
     $this->request->setControllerModule($realModule);
     $file = Mage::getModuleDir('controllers', $realModule) . DS . 'IndexController.php';
     include $file;
     //compatibility with 1.3
     $class = $realModule . '_IndexController';
     $controllerInstance = new $class($this->request, $this->getFront()->getResponse());
     $this->request->setDispatched(true);
     $controllerInstance->dispatch('index');
 }
开发者ID:victorkho,项目名称:telor,代码行数:18,代码来源:Router.php

示例11: testAuthorization

 public function testAuthorization()
 {
     $app = za();
     za()->setUser(new GuestUser());
     $pluginConf = $app->getConfig('plugins');
     $conf = array('default' => array('user' => array('edit' => 'User,Admin', 'list' => 'Admin')), 'login_controller' => 'testcontroller', 'login_action' => 'testaction');
     $plugin = new AuthorizationPlugin($conf);
     $action = new Zend_Controller_Request_Http();
     $action->setControllerName("user");
     $action->setActionName('edit');
     $action->setModuleName('default');
     $plugin->preDispatch($action);
     // Make sure it's redirected to the user / login controller
     $this->assertEqual($action->getControllerName(), 'testcontroller');
     $this->assertEqual($action->getActionName(), 'testaction');
     // Now test that a user with role User is fine
     $user = new User();
     za()->setUser($user);
     $user->role = 'User';
     $action->setControllerName("user");
     $action->setActionName('edit');
     $plugin->preDispatch($action);
     $this->assertEqual($action->getControllerName(), 'user');
     $this->assertEqual($action->getActionName(), 'edit');
     // Make sure they can't LIST
     $action->setControllerName('user');
     $action->setActionName('list');
     $plugin->preDispatch($action);
     $this->assertEqual($action->getControllerName(), 'testcontroller');
     $this->assertEqual($action->getActionName(), 'testaction');
     // Now make them an admin, make sure they can do both the above
     $user->role = 'Admin';
     $action->setControllerName("user");
     $action->setActionName('edit');
     $plugin->preDispatch($action);
     $this->assertEqual($action->getControllerName(), 'user');
     $this->assertEqual($action->getActionName(), 'edit');
     // Make sure they can't LIST
     $action->setControllerName('user');
     $action->setActionName('list');
     $plugin->preDispatch($action);
     $this->assertEqual($action->getControllerName(), 'user');
     $this->assertEqual($action->getActionName(), 'list');
 }
开发者ID:nyeholt,项目名称:relapse,代码行数:44,代码来源:TestAuthorizationPlugin.php

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

示例13: testDispatch4

 /**
  * Test valid action on valid controller; test pre/postDispatch
  */
 public function testDispatch4()
 {
     $request = new Zend_Controller_Request_Http();
     $request->setControllerName('foo');
     $request->setActionName('bar');
     $response = new Zend_Controller_Response_Cli();
     $this->_dispatcher->dispatch($request, $response);
     $body = $this->_dispatcher->getResponse()->getBody();
     $this->assertContains('Bar action called', $body);
     $this->assertContains('preDispatch called', $body);
     $this->assertContains('postDispatch called', $body);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:15,代码来源:DispatcherTest.php

示例14: match

 /**
  * Validate and Match shop view and modify request
  */
 public function match(Zend_Controller_Request_Http $request)
 {
     $front = $this->getFront();
     if (!Mage::isInstalled()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
         exit;
     }
     $routerConfig = Mage::getStoreConfig('shopbybrand/general/router');
     $_end = Mage::getStoreConfig(Magestore_Shopbybrand_Helper_Data::XML_FRONTEND_LINK);
     $_path = urldecode(trim($request->getPathInfo(), '/'));
     if (strpos($_path, $_end)) {
         $_link_params = explode('/', str_replace($_end, '/', $_path), -1);
     } else {
         $_link_params = explode('/', $_path . '/', -1);
     }
     $_count_params = count($_link_params);
     $found = false;
     if (isset($_link_params[0])) {
         $router = $_link_params[0];
         if ($router == $routerConfig) {
             $request->setRouteName('shopbybrand')->setControllerModule('Magestore_Shopbybrand')->setModuleName('brand');
             $module = 'shopbybrand';
             if (isset($_link_params[1]) && $_link_params[1]) {
                 $request->setControllerName($_link_params[1]);
             }
             if (isset($_link_params[2]) && $_link_params[2]) {
                 $request->setActionName($_link_params[2]);
             }
             // get controller name
             if ($request->getControllerName()) {
                 $controller = $request->getControllerName();
             } else {
                 if (!empty($_link_params[1])) {
                     $controller = $_link_params[1];
                 } else {
                     $controller = $front->getDefault('controller');
                     $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, ltrim($request->getOriginalPathInfo(), '/'));
                 }
             }
             // get action name
             if (empty($action)) {
                 if ($request->getActionName()) {
                     $action = $request->getActionName();
                 } else {
                     $action = !empty($_link_params[2]) ? $_link_params[2] : $front->getDefault('action');
                 }
             }
             //checking if this place should be secure
             $this->_checkShouldBeSecure($request, '/' . $module . '/' . $controller . '/' . $action);
             $controllerClassName = $this->_validateControllerClassName('Magestore_Shopbybrand', $controller);
             if (!$controllerClassName) {
                 return false;
             }
             $controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $front->getResponse());
             if (!$controllerInstance->hasAction($action)) {
                 return false;
             }
             $found = true;
         }
     }
     if (!$found) {
         if ($this->_noRouteShouldBeApplied()) {
             $controller = 'index';
             $action = 'noroute';
             $controllerClassName = $this->_validateControllerClassName($realModule, $controller);
             if (!$controllerClassName) {
                 return false;
             }
             // instantiate controller class
             $controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $front->getResponse());
             if (!$controllerInstance->hasAction($action)) {
                 return false;
             }
         } else {
             return false;
         }
     } else {
         return true;
     }
 }
开发者ID:santhosh400,项目名称:ecart,代码行数:83,代码来源:Router.php

示例15: defined

 */
use Pimcore\Model\Object;
use Pimcore\Model\Document;
// determines if we're in Pimcore\Console mode
$pimcoreConsole = defined('PIMCORE_CONSOLE') && true === PIMCORE_CONSOLE;
$workingDirectory = getcwd();
chdir(__DIR__);
include_once "../config/startup.php";
chdir($workingDirectory);
// CLI \Zend_Controller_Front Setup, this is required to make it possible to make use of all rendering features
// this includes $this->action() in templates, ...
$front = \Zend_Controller_Front::getInstance();
Pimcore::initControllerFront($front);
$request = new \Zend_Controller_Request_Http();
$request->setModuleName(PIMCORE_FRONTEND_MODULE);
$request->setControllerName("default");
$request->setActionName("default");
$front->setRequest($request);
$front->setResponse(new \Zend_Controller_Response_Cli());
// generic pimcore setup
\Pimcore::setSystemRequirements();
\Pimcore::initAutoloader();
\Pimcore::initConfiguration();
\Pimcore::setupFramework();
\Pimcore::initLogger();
\Pimcore::initModules();
\Pimcore::initPlugins();
//Activate Inheritance for cli-scripts
\Pimcore::unsetAdminMode();
Document::setHideUnpublished(true);
Object\AbstractObject::setHideUnpublished(true);
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:31,代码来源:startup.php


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