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


PHP Zend_Controller_Request_Abstract::getPathInfo方法代码示例

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


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

示例1: route

 /**
  * Find a matching route to the current PATH_INFO and inject
  * returning values to the Request object.
  * @param Zend_Controller_Request_Abstract $request
  * @return Zend_Controller_Request_Abstract
  * @throws Zend_Controller_Router_Exception
  */
 public function route(Zend_Controller_Request_Abstract $request)
 {
     if ($this->_useDefaultRoutes) {
         $this->addDefaultRoutes();
     }
     // Find the matching route
     $routeMatched = false;
     foreach (array_reverse($this->_routes, true) as $name => $route) {
         if (method_exists($route, 'isAbstract') && $route->isAbstract()) {
             continue;
         }
         if (!method_exists($route, 'getVersion') || $route->getVersion() == 1) {
             $match = $request->getPathInfo();
         } else {
             $match = $request;
         }
         if ($params = $route->match($match)) {
             $this->_setRequestParams($request, $params);
             $this->_currentRoute = $name;
             $routeMatched = true;
             break;
         }
     }
     if (!$routeMatched) {
         require_once 'Zend/Controller/Router/Exception.php';
         throw new Zend_Controller_Router_Exception('No route matched the request', 404);
     }
     if ($this->_useCurrentParamsAsGlobal) {
         $params = $request->getParams();
         foreach ($params as $param => $value) {
             $this->setGlobalParam($param, $value);
         }
     }
     return $request;
 }
开发者ID:uglide,项目名称:zfcore-transition,代码行数:42,代码来源:Cli.php

示例2: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     // Kiem tra neu chua dang nhap thi bo qua
     $identity = Digitalus_Auth::getIdentity();
     if (!$identity) {
         return;
     }
     ////////////////////////////////////////
     //    	$this->_cache = ZendX_Cache_Manager::getInstance();
     $this->_cache = Digitalus_Cache_Manager::getInstance();
     // La la cac phuong thuc khac get() no se khong lay tu content tu cache ra
     if (!$request->isGet()) {
         self::$doNotCache = true;
         return;
     }
     $module = $request->getModuleName();
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     $path = $request->getPathInfo();
     // co loi o day , xem link de biet cach sua
     $this->_key = md5($path);
     $this->_keyTags = array($module, "{$module}_{$controller}", "{$module}_{$controller}_{$action}");
     if (false !== ($data = $this->getCache())) {
         $response = $this->getResponse();
         $response->setBody($data['default']);
         $response->sendResponse();
         exit;
     }
 }
开发者ID:ngukho,项目名称:ducbui-cms,代码行数:29,代码来源:Caching.php

示例3: preDispatch

 public function preDispatch(AbstractRequest $request)
 {
     if ($request->module === 'default' && $request->controller === 'auth') {
         return;
     }
     $frontController = FrontController::getInstance();
     $bootstrap = $frontController->getParam('bootstrap');
     $serviceManager = $bootstrap->getResource('ServiceManager');
     $authService = $serviceManager->get('Zend\\Authentication\\AuthenticationService');
     if (!$authService->hasIdentity()) {
         $response = $this->getResponse();
         $currentUri = sprintf('%s://%s%s%s', $request->getScheme(), $request->getHttpHost(), $request->getBaseUrl(), $request->getPathInfo());
         $adapter = $authService->getAdapter();
         $adapter->setLoginParameters(array('service' => $currentUri));
         // Assume user is back here from a CAS authentication
         if ($request->getQuery('ticket')) {
             $adapter->setServiceValidateParameters(array('service' => $currentUri, 'ticket' => $request->getQuery('ticket')));
             // Validate the ticket
             $result = $authService->authenticate();
             if (!$result->isValid()) {
                 $response->setRedirect($adapter->createLoginUri());
             }
             // Assume the user just got here
         } else {
             $response->setRedirect($adapter->createLoginUri());
         }
     }
 }
开发者ID:tillikum,项目名称:tillikum-core-module,代码行数:28,代码来源:CasAuthentication.php

示例4: routeShutdown

 /**
  * routeShutdown
  * 在 路由器 完成请求的路由后被调用
  * @param Zend_Controller_Request_Abstract $request 
  * @return void
  */
 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     /**
      * 检测请求的Content-type类型
      */
     $pathinfo = $request->getPathInfo();
     if (!empty($pathinfo)) {
         if ($extension = pathinfo($pathinfo, PATHINFO_EXTENSION)) {
             if (preg_match('/^[-a-z0-9]+$/i', $extension)) {
                 $request->setParam(static::KEY_EXT, strtolower($extension));
             }
         }
     }
     /**
      * 检测是否支持json响应
      */
     if ($request->getParam(static::KEY_EXT) == '') {
         $accept = $request->getServer('HTTP_ACCEPT');
         if (!empty($accept)) {
             if (strpos($accept, 'json') !== false) {
                 $request->setParam(static::KEY_EXT, 'json');
             }
         }
     }
     /**
      * 格式化请求目标信息,不允许[-a-zA-Z0-9]以外的字符
      */
     $pattern = '/[^-a-zA-Z0-9].*/';
     $request->setModuleName(preg_replace($pattern, '', $request->getModuleName()));
     $request->setControllerName(preg_replace($pattern, '', $request->getControllerName()));
     $request->setActionName(preg_replace($pattern, '', $request->getActionName()));
 }
开发者ID:null-1,项目名称:fangtaitong,代码行数:38,代码来源:Router.php

示例5: routeStartup

 /**
  * routeStartup
  * 在 路由器 完成请求的路由前被调用
  * 
  * @param Zend_Controller_Request_Abstract $request 
  * @return void
  */
 public function routeStartup(Zend_Controller_Request_Abstract $request)
 {
     // Do nothing...
     return;
     $hostname = $request->getHttpHost();
     $pathinfo = $request->getPathInfo();
     /**
      * 根据二级域名检测请求的模块
      */
     if (!empty($hostname)) {
         $segments = explode('.', $hostname);
         if (isset($segments[2])) {
             $segmentNum = count($segments);
             $rootDomain = $segments[$segmentNum - 2] . '.' . $segments[$segmentNum - 1];
             if ($rootDomain === parse_url(URL_FTT, PHP_URL_HOST)) {
                 $subDomain2 = $segments[$segmentNum - 3];
                 if (array_key_exists($subDomain2, static::$_subDomain2ModuleMap)) {
                     $module = static::$_subDomain2ModuleMap[$subDomain2];
                     $hostel = explode('/', trim($pathinfo, '/'));
                     $hostel = trim(array_shift($hostel));
                     if ($hostel != '') {
                         $this->getResponse()->setRedirect(URL_FTT . '/' . $module . '/?' . static::KEY_INN . '=' . $hostel)->sendResponse();
                         exit;
                     }
                 }
             }
         }
     }
 }
开发者ID:null-1,项目名称:fangtaitong,代码行数:36,代码来源:Router.php

示例6: routeShutdown

 /**
  * Sets the application locale and translation based on the locale param, if
  * one is not provided it defaults to english
  *
  * @param Zend_Controller_Request_Abstract $request
  * @return Void
  */
 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     $config = Zend_Registry::get('config');
     $frontController = Zend_Controller_Front::getInstance();
     $params = $request->getParams();
     $registry = Zend_Registry::getInstance();
     // Steps setting the locale.
     // 1. Default language is set in config
     // 2. TLD in host header
     // 3. Locale params specified in request
     $locale = $registry->get('Zend_Locale');
     // Check host header TLD.
     $tld = preg_replace('/^.*\\./', '', $request->getHeader('Host'));
     // Provide a list of tld's and their corresponding default languages
     $tldLocales = $frontController->getParam('tldLocales');
     if (is_array($tldLocales) && array_key_exists($tld, $tldLocales)) {
         // The TLD in the request matches one of our specified TLD -> Locales
         $locale->setLocale(strtolower($tldLocales[$tld]));
     } elseif (isset($params['locale'])) {
         // There is a locale specified in the request params.
         $locale->setLocale(strtolower($params['locale']));
     }
     // Now that our locale is set, let's check which language has been selected
     // and try to load a translation file for it.
     $language = $locale->getLanguage();
     $translate = Garp_I18n::getTranslateByLocale($locale);
     Zend_Registry::set('Zend_Translate', $translate);
     Zend_Form::setDefaultTranslator($translate);
     if (!$config->resources->router->locale->enabled) {
         return;
     }
     $path = '/' . ltrim($request->getPathInfo(), '/\\');
     // If the language is in the path, then we will want to set the baseUrl
     // to the specified language.
     $langIsInUrl = preg_match('/^\\/' . $language . '\\/?/', $path);
     $uiDefaultLangIsInUrl = false;
     $uiDefaultLanguage = false;
     if (isset($config->resources->locale->uiDefault)) {
         $uiDefaultLanguage = $config->resources->locale->uiDefault;
         $uiDefaultLangIsInUrl = preg_match('/^\\/' . $uiDefaultLanguage . '\\/?/', $path);
     }
     if ($langIsInUrl || $uiDefaultLangIsInUrl) {
         if ($uiDefaultLangIsInUrl) {
             $frontController->setBaseUrl($frontController->getBaseUrl() . '/' . $uiDefaultLanguage);
         } else {
             $frontController->setBaseUrl($frontController->getBaseUrl() . '/' . $language);
         }
     } elseif (!empty($config->resources->router->locale->enabled) && $config->resources->router->locale->enabled) {
         $redirectUrl = '/' . $language . $path;
         if ($frontController->getRouter()->getCurrentRouteName() === 'admin' && !empty($config->resources->locale->adminDefault)) {
             $adminDefaultLanguage = $config->resources->locale->adminDefault;
             $redirectUrl = '/' . $adminDefaultLanguage . $path;
         } elseif ($uiDefaultLanguage) {
             $redirectUrl = '/' . $uiDefaultLanguage . $path;
         }
         $this->getResponse()->setRedirect($redirectUrl, 301);
     }
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:65,代码来源:I18n.php

示例7: routeStartup

 public function routeStartup(Zend_Controller_Request_Abstract $req)
 {
     $this->_time = microtime(true);
     if ($req instanceof Zend_Controller_Request_Http) {
         $this->_method = $req->getMethod();
         $this->_path = $req->getPathInfo();
     }
     $this->_request = $req;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:9,代码来源:AccessLog.php

示例8: routeStartup

 /**
  * @param \Zend_Controller_Request_Abstract $request
  */
 public function routeStartup(\Zend_Controller_Request_Abstract $request)
 {
     // this is a filter which checks for common used files (by browser, crawlers, ...) and prevent the default
     // error page, because this is more resource-intensive than exiting right here
     $found = false;
     foreach (self::$files as $pattern) {
         if (preg_match($pattern, $request->getPathInfo())) {
             $found = true;
             break;
         }
     }
     if ($found) {
         if ($request->getPathInfo() == "/robots.txt") {
             // check for site
             try {
                 $domain = Tool::getHostname();
                 $site = Site::getByDomain($domain);
             } catch (\Exception $e) {
             }
             $siteSuffix = "";
             if ($site instanceof Site) {
                 $siteSuffix = "-" . $site->getId();
             }
             // send correct headers
             header("Content-Type: text/plain; charset=utf8");
             while (@ob_end_flush()) {
             }
             // check for configured robots.txt in pimcore
             $robotsPath = PIMCORE_CONFIGURATION_DIRECTORY . "/robots" . $siteSuffix . ".txt";
             if (is_file($robotsPath)) {
                 readfile($robotsPath);
             } else {
                 echo "User-agent: *\nDisallow:";
                 // default behavior
             }
             exit;
         }
         // if no other rule matches, exit anyway with a 404, to prevent the error page to be shown
         header('HTTP/1.1 404 Not Found');
         echo "HTTP/1.1 404 Not Found\nFiltered by common files filter";
         exit;
     }
 }
开发者ID:solverat,项目名称:pimcore,代码行数:46,代码来源:CommonFilesFilter.php

示例9: _secureUrl

 /**
  * Check the request to see if it is secure.  If it isn't
  * rebuild a secure url, redirect and exit.
  *
  * @param Zend_Controller_Request_Abstract $request
  * @return void
  * @author Travis Boudreaux
  */
 protected function _secureUrl(Zend_Controller_Request_Abstract $request)
 {
     $server = $request->getServer();
     $hostname = $server['HTTP_HOST'];
     if (!$request->isSecure()) {
         //url scheme is not secure so we rebuild url with secureScheme
         $url = Zend_Controller_Request_Http::SCHEME_HTTPS . "://" . $hostname . $request->getPathInfo();
         $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
         $redirector->setGoToUrl($url);
         $redirector->redirectAndExit();
     }
 }
开发者ID:abtris,项目名称:zfcore,代码行数:20,代码来源:Ssl.php

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

示例11: dispatchLoopStartup

 public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
 {
     $response = $this->getResponse();
     $url = parse_url($_SERVER['REQUEST_URI']);
     $res = DOMAIN_PATH . $request->getPathInfo();
     if ($request->controller == 'categories' & $request->action == 'catlist' || $request->controller == 'search' & $request->action == 'beginsearch') {
         $s_url = DOMAIN_PATH . $url['path'] . (isset($url['query']) ? '?' . $url['query'] : '');
         $n_url = glob_makeUrlFromCookie(glob_makeBaseUrl(array('search', 'extended')));
         //   echo $n_url.'-'.$s_url; exit;
         if ($s_url !== $n_url) {
             $response->setRedirect($n_url);
         }
     }
 }
开发者ID:xent1986,项目名称:ychebgit,代码行数:14,代码来源:mystartup.php

示例12: 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)
 {
     // reset role & resource
     Zend_Registry::set('Role', 'guest');
     Zend_Registry::set('Resource', '');
     // check if ErrorHandler wasn't fired
     if ($request->getParam('error_handler')) {
         return;
     }
     $module = $request->getModuleName();
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     $pathInfo = $request->getPathInfo();
     $allow = false;
     if ($this->_auth->hasIdentity()) {
         $userId = $this->_auth->getIdentity();
         $roleId = $this->_auth->getRoleId();
         $rolesList = $this->_em->find('Roles', $roleId);
         $roleName = $rolesList->getRoleName();
         $role = new Zend_Acl_Role($roleName);
     } else {
         $roleName = 'guest';
         $role = new Zend_Acl_Role($roleName);
     }
     $resource = $action == '' ? trim($controller) . '/index' : trim($controller) . '/' . trim($action);
     $resource = $module == 'default' ? $resource : $module . "/" . $resource;
     // on main page resource might be empty
     if ($resource == '') {
         $resource = 'index/index';
     }
     // if resource not exist in db then check permission for controller
     if (!$this->_acl->has($resource) && $action != '') {
         $resource = trim($controller);
     }
     // check if user is allowed to see the page
     $allow = $this->_acl->isAllowed($role, $resource);
     if ($allow == false && $this->_auth->hasIdentity()) {
         // user logged in but denied permission
         $request->setModuleName('default');
         $request->setControllerName('error');
         $request->setActionName('forbidden');
         /* $this->_response->setHeader('Content-type', 'text/html');
                       $this->_response->setHttpResponseCode(403);
                       $this->_response->setBody('<h1>403 - Forbidden</h1>');
         
                       $this->_response->sendResponse(); */
     }
     Zend_Registry::set('Role', $role);
     Zend_Registry::set('Resource', $resource);
 }
开发者ID:uppaljs,项目名称:pakistan-vlmis-v2,代码行数:61,代码来源:Acl.php

示例13: route

 /**
  * Find a matching route to the current PATH_INFO and inject
  * returning values to the Request object.
  *
  * @throws Zend_Controller_Router_Exception
  * @return Zend_Controller_Request_Abstract Request object
  */
 public function route(Zend_Controller_Request_Abstract $request)
 {
     if (($curRouteName = $this->_currentRoute) != null) {
         $route = $this->getRoute($curRouteName);
         if (!method_exists($route, 'getVersion') || $route->getVersion() == 1) {
             $match = $request->getPathInfo();
         } else {
             $match = $request;
         }
         if ($params = $route->match($match)) {
             $this->_setRequestParams($request, $params);
             return $request;
         }
     }
     return parent::route($request);
 }
开发者ID:nstapelbroek,项目名称:Glitch_Lib,代码行数:23,代码来源:Rewrite.php

示例14: dispatchLoopStartup

 /**
  * Start caching
  *
  * Determine if we have a cache hit. If so, return the response; else,
  * start caching.
  *
  * @param  Zend_Controller_Request_Abstract $request
  * @return void
  */
 public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
 {
     if (!$request->isGet()) {
         self::$_disableCache = true;
         return;
     }
     $path = $request->getPathInfo();
     $this->_key = md5($path);
     $response = Zrt_Cache::load($this->_key);
     if (false !== $response) {
         $response->sendResponse();
         if (!$this->_suppressExit) {
             exit;
         }
     }
 }
开发者ID:luismayta,项目名称:zrt,代码行数:25,代码来源:Caching.php

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


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