當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request::setPresenterName方法代碼示例

本文整理匯總了PHP中Nette\Application\Request::setPresenterName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::setPresenterName方法的具體用法?PHP Request::setPresenterName怎麽用?PHP Request::setPresenterName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nette\Application\Request的用法示例。


在下文中一共展示了Request::setPresenterName方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 public function run(Nette\Application\Request $request)
 {
     $exception = $request->getParameter('exception');
     if ($exception instanceof Nette\Application\BadRequestException) {
         return new Responses\ForwardResponse($request->setPresenterName('Error4xx'));
     }
     $this->logger->log($exception, ILogger::EXCEPTION);
     return new Responses\CallbackResponse(function () {
         require __DIR__ . '/templates/Error/500.phtml';
     });
 }
開發者ID:fuchcz,項目名稱:generator-myproject,代碼行數:11,代碼來源:ErrorPresenter.php

示例2: run

 /**
  * @return Nette\Application\IResponse
  */
 public function run(Nette\Application\Request $request)
 {
     $e = $request->getParameter('exception');
     if ($e instanceof Nette\Application\BadRequestException) {
         // $this->logger->log("HTTP code {$e->getCode()}: {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", 'access');
         return new Nette\Application\Responses\ForwardResponse($request->setPresenterName('Error4xx'));
     }
     $this->logger->log($e, ILogger::EXCEPTION);
     return new Nette\Application\Responses\CallbackResponse(function () {
         require __DIR__ . '/templates/Error/500.phtml';
     });
 }
開發者ID:TomasVotruba,項目名稱:lekarna-se-skoli,代碼行數:15,代碼來源:ErrorPresenter.php

示例3: constructUrl

 /**
  * @param \Nette\Application\Request $appRequest
  * @param \Nette\Http\Url $refUrl
  * @return string|null
  */
 public function constructUrl(Request $appRequest, Url $refUrl)
 {
     $presenter = $appRequest->getPresenterName();
     if (!Strings::startsWith($presenter, self::SUBMODULE_NAME . ':')) {
         return null;
     }
     if (Strings::endsWith($presenter, ':' . self::DEFAULT_PRESENTER)) {
         $presenter = substr($presenter, 0, -strlen(':' . self::DEFAULT_PRESENTER));
     }
     $appRequest->setPresenterName(substr($presenter, strlen(self::SUBMODULE_NAME . ':')));
     return parent::constructUrl($appRequest, $refUrl);
 }
開發者ID:venne,項目名稱:venne,代碼行數:17,代碼來源:AdminRoute.php

示例4: run

 /**
  * This method is usually implemented by the more complex UI\Presenter
  * But since an unhandled exception might have occurred,
  * it should be processed as simply as possible to avoid any further problems or even another exception.
  *
  * @param Nette\Application\Request $request
  * @return Responses\CallbackResponse|Responses\ForwardResponse
  */
 public function run(Nette\Application\Request $request)
 {
     $exception = $request->getParameter('exception');
     // if it's a simple BadRequestException, use the more powerful presenter
     if ($exception instanceof Nette\Application\BadRequestException) {
         return new Responses\ForwardResponse($request->setPresenterName('Error4xx'));
     }
     $this->logger->log($exception, ILogger::EXCEPTION);
     // the 500 means unhandled exception, which should translate to the simplest page possible
     return new Responses\CallbackResponse(function () {
         require __DIR__ . '/templates/Error/500.phtml';
     });
 }
開發者ID:martinmayer,項目名稱:notejam,代碼行數:21,代碼來源:ErrorPresenter.php

示例5: setRequestParams

 /**
  * @param \Nette\Application\Request
  * @param array
  * @return \Nette\Application\Request
  */
 private function setRequestParams(\Nette\Application\Request $appRequest, array $params)
 {
     $metadata = $this->getDefaults();
     if (!isset($params[self::PRESENTER_KEY])) {
         throw new \InvalidStateException('Missing presenter in route definition.');
     }
     if (isset($metadata[self::MODULE_KEY])) {
         if (!isset($params[self::MODULE_KEY])) {
             throw new \InvalidStateException('Missing module in route definition.');
         }
         $presenter = $params[self::MODULE_KEY] . ':' . $params[self::PRESENTER_KEY];
         unset($params[self::MODULE_KEY], $params[self::PRESENTER_KEY]);
     } else {
         $presenter = $params[self::PRESENTER_KEY];
         unset($params[self::PRESENTER_KEY]);
     }
     $appRequest->setPresenterName($presenter);
     $appRequest->setParameters($params);
     return $appRequest;
 }
開發者ID:jedenweb,項目名稱:framework,代碼行數:25,代碼來源:FilterRoute.php

示例6: modifyConstructRequest

 /**
  * Modify request by page
  *
  * @param \Nette\Application\Request $request
  * @param RouteEntity $route
  * @param $parameters
  * @param string $domain
  * @return \Nette\Application\Request
  */
 protected function modifyConstructRequest(Request $request, RouteEntity $route, $parameters, $domain)
 {
     $request->setPresenterName(self::DEFAULT_MODULE . ':' . self::DEFAULT_PRESENTER);
     $request->setParameters(array('module' => self::DEFAULT_MODULE, 'presenter' => self::DEFAULT_PRESENTER, 'action' => self::DEFAULT_ACTION, 'lang' => count($this->languages) > 1 ? isset($parameters['lang']) ? $parameters['lang'] : ($route->page->language ? $route->page->language->alias : $this->defaultLanguage) : NULL, 'slug' => $route->getUrl(), 'domain' => $route->domain ? $route->domain->domain : '') + $parameters);
     return $request;
 }
開發者ID:venne,項目名稱:cms-module,代碼行數:15,代碼來源:PageRoute.php


注:本文中的Nette\Application\Request::setPresenterName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。