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


PHP Request::getParameter方法代码示例

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


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

示例1: routeMatched

 /**
  * Event thatis firex when particular ApiRoute is matched
  * @param  ApiRoute $route
  * @param  Request  $request
  * @return void
  */
 public function routeMatched(ApiRoute $route, Request $request)
 {
     if (NULL !== ($format = $request->getParameter(self::API_DOCU_STARTER_QUERY_KEY_GENERATE))) {
         $this->generator->generateAll($this->router);
         exit(0);
     }
     if (NULL !== ($format = $request->getParameter(self::API_DOCU_STARTER_QUERY_KEY_TARGET))) {
         $this->generator->generateTarget($route, $request);
         exit(0);
     }
 }
开发者ID:ublaboo,项目名称:api-docu,代码行数:17,代码来源:Starter.php

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

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

示例4: constructUrl

 public function constructUrl(Application\Request $request, Http\Url $url)
 {
     if ($request->getPresenterName() !== 'Nette:Micro') {
         return;
     }
     // parameter "id" will be name in string or instance of ImageInfo
     $id = $request->getParameter('id');
     if ($id instanceof Imager\ImageInfo) {
         $id = $id->getFilename();
     }
     $parts = explode('.', $id);
     // extension is on last position
     $extension = '.' . array_pop($parts);
     // implode back for case that name contains dots
     $name = implode('.', $parts);
     $width = $request->getParameter('width');
     $height = $request->getParameter('height');
     $quality = $request->getParameter('quality');
     $dimension = Imager\Helpers::createDimensionName($width, $height, $quality);
     return $this->basePath . Imager\Helpers::getSubPath($id) . $name . $dimension . $extension;
 }
开发者ID:lawondyss,项目名称:imager,代码行数:21,代码来源:Route.php

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

示例6: run

 /**
  * @return Application\IResponse
  */
 public function run(Application\Request $request)
 {
     $e = $request->getParameter('exception');
     if ($e instanceof Application\BadRequestException) {
         $code = $e->getCode();
     } else {
         $code = 500;
         if ($this->logger) {
             $this->logger->log($e, ILogger::EXCEPTION);
         }
     }
     return new Application\Responses\CallbackResponse(function () use($code) {
         require __DIR__ . '/templates/error.phtml';
     });
 }
开发者ID:hrach,项目名称:nette-application,代码行数:18,代码来源:ErrorPresenter.php

示例7: run

 /**
  * @param Request $request
  * @return IResponse
  */
 public function run(Request $request)
 {
     $e = $request->getParameter('exception');
     if ($e instanceof BadRequestException) {
         $code = $e->getCode();
     } else {
         $code = 500;
         if ($this->logger) {
             try {
                 $this->logger->log($e, ILogger::EXCEPTION);
             } catch (\Exception $e) {
                 // logger may fail as well
             }
         }
     }
     if (isset(JsonResponse::$messages[$code])) {
         $message = JsonResponse::$messages[$code];
     } else {
         $message = 'Unknown error';
     }
     return $this->createResponse($message, $code);
 }
开发者ID:tripomatic,项目名称:nette-api,代码行数:26,代码来源:ErrorPresenter.php

示例8: createFromRequest

 /**
  * @param Request $request
  * @return PaymentResult
  */
 public static function createFromRequest(Request $request)
 {
     $paymentResult = new PaymentResult();
     $paymentResult->setAuthResult($request->getParameter('authResult'));
     $paymentResult->setPspReference($request->getParameter('pspReference'));
     $paymentResult->setMerchantReference($request->getParameter('merchantReference'));
     $paymentResult->setSkinCode($request->getParameter('skinCode'));
     $paymentResult->setMerchantReturnData($request->getParameter('merchantReturnData'));
     $paymentResult->setShopperLocale($request->getParameter('shopperLocale'));
     $paymentResult->setPaymentMethod($request->getParameter('paymentMethod'));
     return $paymentResult;
 }
开发者ID:metisfw,项目名称:adyen,代码行数:16,代码来源:PaymentResult.php

示例9: constructUrl

 /**
  * @param Request $appRequest
  * @param Url $refUrl
  * @return null|string
  */
 public function constructUrl(Request $appRequest, Url $refUrl)
 {
     // one way can't generate link
     if ($this->options['oneWay']) {
         return NULL;
     }
     $params = $this->clearParameters($appRequest->getParameters());
     $action = new Action($appRequest->getPresenterName() . ':' . $appRequest->getParameter('action'), $params);
     // ISource return NULL, not found url to generate
     if (($seoUrl = $this->source->toUrl($action)) === NULL) {
         return NULL;
     }
     if (!$seoUrl instanceof Url) {
         $seoUrl = new Url($seoUrl);
     }
     // host
     if ($seoUrl->getHost()) {
         $host = $refUrl->getHost();
         $parts = ip2long($host) ? [$host] : array_reverse(explode('.', $host));
         $host = strtr($seoUrl->getHost(), ['%tld%' => $parts[0], '%domain%' => isset($parts[1]) ? "{$parts['1']}.{$parts['0']}" : $parts[0], '%sld%' => isset($parts[1]) ? $parts[1] : '', '%host%' => $refUrl->getHost()]);
     } else {
         $host = $refUrl->getHost();
     }
     // path
     $path = $seoUrl->getPath();
     // query
     $query = $seoUrl->getQueryParameters() + $params;
     ksort($query);
     $seoUrl->setQuery($query);
     $query = $seoUrl->getQuery();
     // fragment
     $fragment = $seoUrl->getFragment();
     return ($this->options['secured'] ? 'https' : 'http') . '://' . $host . $refUrl->getBasePath() . ($path === '/' ? '' : $path) . ($query ? '?' . $query : '') . ($fragment ? '#' . $fragment : '');
 }
开发者ID:Myiyk,项目名称:seo-router,代码行数:39,代码来源:Router.php

示例10: constructUrl

 /**
  * Constructs absolute URL from Request object.
  * @return string|NULL
  */
 public function constructUrl(Nette\Application\Request $appRequest, Nette\Http\Url $refUrl)
 {
     $this->loadLocales();
     $appPath = $appRequest->getPresenterName() . ':' . $appRequest->getParameter('action') . ':' . $appRequest->getParameter('internal_id');
     /** @var Url $urlEntity */
     $cachedResult = $this->cache->load($appPath, function (&$dependencies) use($appRequest) {
         $presenter = $appRequest->getPresenterName();
         $action = $appRequest->getParameter('action');
         $internal_id = $appRequest->getParameter('internal_id');
         $fallback = false;
         if (isset($internal_id)) {
             /** @var Url $url */
             $urlEntity = $this->getUrlEntity($presenter, $action, $internal_id);
             if ($urlEntity === null) {
                 $fallback = true;
                 $urlEntity = $this->getUrlEntity($presenter, $action);
             }
         } else {
             $urlEntity = $this->getUrlEntity($presenter, $action);
         }
         if ($urlEntity === null) {
             $this->logger->addWarning(sprintf('No route found
                               | presenter: %s
                               | action: %s
                               | id %s', $presenter, $action, $internal_id));
             return null;
         }
         $dependencies = [Nette\Caching\Cache::TAGS => $urlEntity->getCacheKey()];
         return [$urlEntity, $fallback];
     });
     $urlEntity = $cachedResult[0];
     $fallback = $cachedResult[1];
     if ($urlEntity === null) {
         return null;
     }
     $baseUrl = 'http://' . $refUrl->getAuthority() . $refUrl->getBasePath();
     if ($urlEntity->getActualUrlToRedirect() === null) {
         $path = $urlEntity->getUrlPath();
     } else {
         $path = $urlEntity->getActualUrlToRedirect()->getUrlPath();
     }
     $params = $appRequest->getParameters();
     unset($params['action']);
     if ($fallback === false) {
         unset($params['internal_id']);
     }
     $defaultLocale = array_search(true, $this->locales);
     $locale = isset($params['locale']) ? $params['locale'] : $defaultLocale;
     unset($params['locale']);
     if ($defaultLocale === $locale) {
         $locale = '';
     } else {
         $locale .= '/';
     }
     $resultUrl = $baseUrl . $locale . Nette\Utils\Strings::webalize($path, '/.');
     $this->urlParametersConverter->out($urlEntity, $params);
     // todo
     $q = http_build_query($params, null, '&');
     if ($q != '') {
         $resultUrl .= '?' . $q;
     }
     return $resultUrl;
 }
开发者ID:blitzik,项目名称:CMS,代码行数:67,代码来源:Router.php

示例11: constructUrl

 /**
  * Constructs absolute URL from Request object.
  * @return string|NULL
  */
 public function constructUrl(Request $request, Nette\Http\Url $url)
 {
     if ($this->presenter != $request->getPresenterName()) {
         return NULL;
     }
     $base_url = $url->getBaseUrl();
     $action = $request->getParameter('action');
     $parameters = $request->getParameters();
     unset($parameters['action']);
     $path = ltrim($this->getPath(), '/');
     if (FALSE === array_search($action, $this->actions)) {
         return NULL;
     }
     foreach ($parameters as $name => $value) {
         if (strpos($path, "<{$name}>") !== FALSE && $value !== NULL) {
             $path = str_replace("<{$name}>", $value, $path);
             unset($parameters[$name]);
         }
     }
     $path = preg_replace_callback('/\\[.+?\\]/', function ($item) {
         if (strpos(end($item), '<')) {
             return '';
         }
         return end($item);
     }, $path);
     /**
      * There are still some required parameters in url mask
      */
     if (preg_match('/<\\w+>/', $path)) {
         return NULL;
     }
     $path = str_replace(['[', ']'], '', $path);
     $query = http_build_query($parameters);
     return $base_url . $path . ($query ? '?' . $query : '');
 }
开发者ID:ublaboo,项目名称:api-router,代码行数:39,代码来源:ApiRoute.php


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