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


PHP IRequest::getPost方法代码示例

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


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

示例1: parseData

 /**
  * Parse data for input
  * @return array
  *
  * @throws BadRequestException
  */
 protected function parseData()
 {
     $postQuery = (array) $this->httpRequest->getPost();
     $urlQuery = (array) $this->httpRequest->getQuery();
     $requestBody = $this->parseRequestBody();
     return array_merge($urlQuery, $requestBody, $postQuery);
 }
开发者ID:lucien144,项目名称:Restful,代码行数:13,代码来源:InputFactory.php

示例2: getPost

 /**
  * @inheritdoc
  */
 public function getPost($key = NULL, $default = NULL)
 {
     if (func_num_args() === 0) {
         return $this->current->getPost();
     }
     return $this->current->getPost($key, $default);
 }
开发者ID:Kdyby,项目名称:RequestStack,代码行数:10,代码来源:RequestStack.php

示例3: getRequestData

 protected function getRequestData()
 {
     $request_data = (array) $this->request->getPost(self::PARAMETER);
     $request_data += ['action' => null, 'key' => null, 'language' => null, 'texts' => []];
     if ($request_data['key'] && empty($request_data['id'])) {
         $request_data['id'] = $this->createHash($request_data['key']);
     }
     return $request_data;
 }
开发者ID:zemistr,项目名称:l10n-nette-translator,代码行数:9,代码来源:TranslatorProcessor.php

示例4: handleUpload

 public function handleUpload()
 {
     $file = $this->httpRequest->getFile('Filedata');
     if ($file->isOk()) {
         $this->onUpload($file, $this->httpRequest->getPost());
     } else {
         $this->onError($file->getError());
     }
     $this->presenter->terminate();
 }
开发者ID:peterzadori,项目名称:movi,代码行数:10,代码来源:Uploadify.php

示例5: getParameters

 /**
  * Get all parameters
  * @return array
  */
 public function getParameters()
 {
     if (!$this->data) {
         if ($this->request->getQuery()) {
             $this->data = $this->request->getQuery();
         } else {
             if ($this->request->getPost()) {
                 $this->data = $this->request->getPost();
             } else {
                 $this->data = $this->parseRequest(file_get_contents('php://input'));
             }
         }
     }
     return $this->data;
 }
开发者ID:drahak,项目名称:oauth2,代码行数:19,代码来源:Input.php

示例6: match

 /**
  * Maps HTTP request to a Request object.
  *
  * @param Nette\Http\IRequest $httpRequest
  * @return Request|NULL
  */
 public function match(Nette\Http\IRequest $httpRequest)
 {
     $relativeUrl = trim($httpRequest->getUrl()->relativeUrl, "/");
     $path = trim($httpRequest->getUrl()->path, "/");
     if ($relativeUrl == "") {
         $target = $this->defaultRoute;
         $this->currentTarget->setCurrentTarget($this->targetDao->findTarget($target->presenter, $target->action, $target->id));
     } elseif ($relativeUrl == "sitemap.xml") {
         $target = new Target("Seo:Meta", "sitemap");
     } elseif ($relativeUrl == "robots.txt") {
         $target = new Target("Seo:Meta", "robots");
     } elseif (substr($relativeUrl, 0, 6) == "google" && $this->settingsDao->getWebmasterToolsName() == $relativeUrl) {
         $target = new Target("Seo:Meta", "googleWebmasterTools");
     } else {
         $route = $this->routeDao->findRouteBySlug($relativeUrl, TRUE);
         if (!$route) {
             $route = $this->routeDao->findRouteBySlug($path, TRUE);
             if (!$route) {
                 return NULL;
             }
         }
         $this->currentTarget->setCurrentTarget($route->getTarget());
         $target = new Target($route->target->targetPresenter, $route->target->targetAction, $route->target->targetId);
     }
     $params = array();
     $params["action"] = $target->action;
     if ($target->id) {
         $params["id"] = $target->id;
     }
     $params += $httpRequest->getQuery();
     return new Request($target->presenter, $httpRequest->getMethod(), $params, $httpRequest->getPost(), $httpRequest->getFiles(), array(Request::SECURED => $httpRequest->isSecured()));
 }
开发者ID:brabijan,项目名称:nette-seo-components,代码行数:38,代码来源:DbRouter.php

示例7: match

	/**
	 * Maps HTTP request to a Request object.
	 * @return Nette\Application\Request|NULL
	 */
	public function match(Nette\Http\IRequest $httpRequest)
	{
		if ($httpRequest->getUrl()->getPathInfo() !== '') {
			return NULL;
		}
		// combine with precedence: get, (post,) defaults
		$params = $httpRequest->getQuery();
		$params += $this->defaults;

		if (!isset($params[self::PRESENTER_KEY]) || !is_string($params[self::PRESENTER_KEY])) {
			return NULL;
		}

		$presenter = $this->module . $params[self::PRESENTER_KEY];
		unset($params[self::PRESENTER_KEY]);

		return new Application\Request(
			$presenter,
			$httpRequest->getMethod(),
			$params,
			$httpRequest->getPost(),
			$httpRequest->getFiles(),
			array(Application\Request::SECURED => $httpRequest->isSecured())
		);
	}
开发者ID:nakoukal,项目名称:fakturace,代码行数:29,代码来源:SimpleRouter.php

示例8: setValue

	/**
	 * Sets control's value.
	 *
	 * @param  array|\Nette\Http\FileUpload
	 * @return MultipleFileUpload  provides a fluent interface
	 */
	public function setValue($value)
	{
		if (is_array($value) && is_array(reset($value))) {
			$this->value = array();
			foreach ($value as $key => $file) {
				$this->value[$key] = new FileUpload($file);
			}
		} elseif (is_array($value) && reset($value) instanceof FileUpload) {
			$this->value = $value;
		} else {
			$token = static::$httpRequest->getPost($this->name . static::MULTIPLE_FILE_UPLOAD_KEY);
			if ($token) {
				$this->value = array();
				$files = Finder::findFiles($token . "_*.tmp")->from(static::$storageDir);
				foreach ($files as $file) {
					$this->value[] = new FileUpload(array(
						'error' => UPLOAD_ERR_OK,
						'name' => substr($file->getBaseName(), 0, -4),
						'tmp_name' => $file->getRealPath(),
						'size' => $file->getSize(),
						'type' => $file->getType(),
					));
				}
			}
		}

		if (count($this->value) == 1 && !reset($this->value)->temporaryFile) {
			$this->value = array();
		}

		return $this;
	}
开发者ID:norbe,项目名称:framework,代码行数:38,代码来源:MultipleFileUpload.php

示例9: match

 /**
  * CLI commands run from app/console.php
  *
  * Maps HTTP request to a Request object.
  * @return Nette\Application\Request|NULL
  */
 public function match(Nette\Http\IRequest $httpRequest)
 {
     $this->loadLocales();
     $urlPath = new Services\UrlPath($httpRequest);
     $urlPath->setPredefinedLocales($this->locales);
     /** @var Url $urlEntity */
     $urlEntity = $this->loadUrlEntity($urlPath->getPath(true));
     if ($urlEntity === null) {
         // no route found
         $this->onUrlNotFound($urlPath);
         return null;
     }
     if ($urlEntity->getActualUrlToRedirect() === null) {
         $presenter = $urlEntity->getPresenter();
         $internal_id = $urlEntity->getInternalId();
         $action = $urlEntity->getAction();
     } else {
         $presenter = $urlEntity->getActualUrlToRedirect()->getPresenter();
         $internal_id = $urlEntity->getActualUrlToRedirect()->getInternalId();
         $action = $urlEntity->getActualUrlToRedirect()->getAction();
     }
     $params = $httpRequest->getQuery();
     $params['action'] = $action;
     $params['locale'] = $urlPath->getLocale();
     $this->urlParametersConverter->in($urlEntity, $params);
     // todo
     if ($internal_id !== null) {
         $params['internal_id'] = $internal_id;
     }
     return new Nette\Application\Request($presenter, $httpRequest->getMethod(), $params, $httpRequest->getPost(), $httpRequest->getFiles());
 }
开发者ID:blitzik,项目名称:CMS,代码行数:37,代码来源:Router.php

示例10: parse

 /**
  * @param Http\Request $request
  * @return array
  */
 private function parse(Http\IRequest $request)
 {
     $params = array_merge($request->getPost(), $request->getQuery());
     if ($this->parser !== null) {
         $parsed = $this->parser->parse($request->getRawBody());
         $params = array_merge($params, $parsed);
     }
     return $params;
 }
开发者ID:dzibma,项目名称:rest-api,代码行数:13,代码来源:Input.php

示例11: getRequest

 /**
  * @param string $key
  * @param mixed $default
  * @return mixed|null
  */
 protected function getRequest($key, $default = NULL)
 {
     if ($value = $this->httpRequest->getPost($key)) {
         return $value;
     }
     if ($value = $this->httpRequest->getQuery($key)) {
         return $value;
     }
     return $default;
 }
开发者ID:kdyby,项目名称:facebook,代码行数:15,代码来源:Facebook.php

示例12: handleResponse

 /**
  * Signal for receive a response from gateway.
  */
 public function handleResponse()
 {
     $data = $this->httpRequest->isMethod(IRequest::POST) ? $this->httpRequest->getPost() : $this->httpRequest->getQuery();
     $response = NULL;
     try {
         $response = $this->client->receiveResponse($data);
     } catch (Csob\Exception $e) {
         if ($response === NULL && $e instanceof Csob\ExceptionWithResponse) {
             $response = $e->getResponse();
         }
         $this->onError($this, $e, $response);
         return;
     }
     $this->onResponse($this, $response);
 }
开发者ID:jiripudil,项目名称:CsobPaygateNette,代码行数:18,代码来源:CsobControl.php

示例13: match

 /**
  * Match request
  * @param  IRequest $request 
  * @return Request            
  */
 public function match(Http\IRequest $request)
 {
     $path = $request->url->getPathInfo();
     if (!Strings::contains($path, $this->prefix)) {
         return NULL;
     }
     $path = Strings::substring($path, strlen($this->prefix) + 1);
     $pathParts = explode('/', $path);
     $pathArguments = array_slice($pathParts, 1);
     $action = $this->getActionName($request->getMethod(), $pathArguments);
     $params = $this->getPathParameters($pathArguments);
     $params[Route::MODULE_KEY] = $this->module;
     $params[Route::PRESENTER_KEY] = $pathParts[0];
     $params['action'] = $action;
     $presenter = ($this->module ? $this->module . ':' : '') . $params[Route::PRESENTER_KEY];
     $appRequest = new Application\Request($presenter, $request->getMethod(), $params, $request->getPost(), $request->getFiles());
     return $appRequest;
 }
开发者ID:marten-cz,项目名称:Restful,代码行数:23,代码来源:StrictRoute.php

示例14: match

 /**
  * Maps HTTP request to a Request object.
  *
  * @return AppRequest|NULL
  */
 public function match(HttpRequest $httpRequest)
 {
     $url = $httpRequest->getUrl();
     $slug = rtrim(substr($url->getPath(), strrpos($url->getScriptPath(), '/') + 1), '/');
     foreach ($this->tableOut as $destination2 => $slug2) {
         if ($slug === rtrim($slug2, '/')) {
             $destination = $destination2;
             break;
         }
     }
     if (!isset($destination)) {
         return NULL;
     }
     $params = $httpRequest->getQuery();
     $pos = strrpos($destination, ':');
     $presenter = substr($destination, 0, $pos);
     $params['action'] = substr($destination, $pos + 1);
     return new AppRequest($presenter, $httpRequest->getMethod(), $params, $httpRequest->getPost(), $httpRequest->getFiles(), array(AppRequest::SECURED => $httpRequest->isSecured()));
 }
开发者ID:VasekPurchart,项目名称:khanovaskola-v3,代码行数:24,代码来源:StaticRouter.php

示例15: match

 /**
  * Maps HTTP request to a Request object.
  * @return Nette\Application\Request|NULL
  */
 public function match(Nette\Http\IRequest $httpRequest)
 {
     // combine with precedence: mask (params in URL-path), fixity, query, (post,) defaults
     // 1) URL MASK
     $url = $httpRequest->getUrl();
     $re = $this->re;
     if ($this->type === self::HOST) {
         $host = $url->getHost();
         $path = '//' . $host . $url->getPath();
         $host = ip2long($host) ? array($host) : array_reverse(explode('.', $host));
         $re = strtr($re, array('/%basePath%/' => preg_quote($url->getBasePath(), '#'), '%tld%' => preg_quote($host[0], '#'), '%domain%' => preg_quote(isset($host[1]) ? "{$host['1']}.{$host['0']}" : $host[0], '#')));
     } elseif ($this->type === self::RELATIVE) {
         $basePath = $url->getBasePath();
         if (strncmp($url->getPath(), $basePath, strlen($basePath)) !== 0) {
             return NULL;
         }
         $path = (string) substr($url->getPath(), strlen($basePath));
     } else {
         $path = $url->getPath();
     }
     if ($path !== '') {
         $path = rtrim($path, '/') . '/';
     }
     if (!($matches = Strings::match($path, $re))) {
         // stop, not matched
         return NULL;
     }
     // deletes numeric keys, restore '-' chars
     $params = array();
     foreach ($matches as $k => $v) {
         if (is_string($k) && $v !== '') {
             $params[str_replace('___', '-', $k)] = $v;
             // trick
         }
     }
     // 2) CONSTANT FIXITY
     foreach ($this->metadata as $name => $meta) {
         if (isset($params[$name])) {
             //$params[$name] = $this->flags & self::CASE_SENSITIVE === 0 ? strtolower($params[$name]) : */$params[$name]; // strtolower damages UTF-8
         } elseif (isset($meta['fixity']) && $meta['fixity'] !== self::OPTIONAL) {
             $params[$name] = NULL;
             // cannot be overwriten in 3) and detected by isset() in 4)
         }
     }
     // 3) QUERY
     if ($this->xlat) {
         $params += self::renameKeys($httpRequest->getQuery(), array_flip($this->xlat));
     } else {
         $params += $httpRequest->getQuery();
     }
     // 4) APPLY FILTERS & FIXITY
     foreach ($this->metadata as $name => $meta) {
         if (isset($params[$name])) {
             if (!is_scalar($params[$name])) {
             } elseif (isset($meta[self::FILTER_TABLE][$params[$name]])) {
                 // applies filterTable only to scalar parameters
                 $params[$name] = $meta[self::FILTER_TABLE][$params[$name]];
             } elseif (isset($meta[self::FILTER_TABLE]) && !empty($meta[self::FILTER_STRICT])) {
                 return NULL;
                 // rejected by filterTable
             } elseif (isset($meta[self::FILTER_IN])) {
                 // applies filterIn only to scalar parameters
                 $params[$name] = call_user_func($meta[self::FILTER_IN], (string) $params[$name]);
                 if ($params[$name] === NULL && !isset($meta['fixity'])) {
                     return NULL;
                     // rejected by filter
                 }
             }
         } elseif (isset($meta['fixity'])) {
             $params[$name] = $meta[self::VALUE];
         }
     }
     if (isset($this->metadata[NULL][self::FILTER_IN])) {
         $params = call_user_func($this->metadata[NULL][self::FILTER_IN], $params);
         if ($params === NULL) {
             return NULL;
         }
     }
     // 5) BUILD Request
     if (!isset($params[self::PRESENTER_KEY])) {
         throw new Nette\InvalidStateException('Missing presenter in route definition.');
     } elseif (!is_string($params[self::PRESENTER_KEY])) {
         return NULL;
     }
     if (isset($this->metadata[self::MODULE_KEY])) {
         if (!isset($params[self::MODULE_KEY])) {
             throw new Nette\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]);
     }
     return new Application\Request($presenter, $httpRequest->getMethod(), $params, $httpRequest->getPost(), $httpRequest->getFiles(), array(Application\Request::SECURED => $httpRequest->isSecured()));
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:100,代码来源:Route.php


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