1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-16 03:34:33 +02:00

Merge branch 'feature-querystring-overrides' of https://github.com/teppokoivula/processwire-1 into teppokoivula-feature-querystring-overrides

This commit is contained in:
Ryan Cramer
2016-11-14 05:50:41 -05:00
2 changed files with 7 additions and 5 deletions

View File

@@ -558,15 +558,17 @@ class WireInput extends Wire {
* Return the unsanitized query string that was part of this request, or blank if none * Return the unsanitized query string that was part of this request, or blank if none
* *
* Note that the returned query string is not sanitized, so if you use it in any output * Note that the returned query string is not sanitized, so if you use it in any output
* be sure to run it through `$sanitizer->entities()` first. * be sure to run it through `$sanitizer->entities()` first. An optional assoc array
* param can be used to add new GET params or override existing ones.
* *
* #pw-group-URLs * #pw-group-URLs
* *
* @param array $overrides Optional assoc array for overriding or adding GET params
* @return string Returns the unsanitized query string * @return string Returns the unsanitized query string
* *
*/ */
public function queryString() { public function queryString($overrides = array()) {
return $this->get()->queryString(); return $this->get()->queryString($overrides);
} }
/** /**

View File

@@ -200,8 +200,8 @@ class WireInputData extends Wire implements \ArrayAccess, \IteratorAggregate, \C
$this->offsetUnset($key); $this->offsetUnset($key);
} }
public function queryString() { public function queryString($overrides = array()) {
return http_build_query($this->getArray()); return http_build_query(array_merge($this->getArray(), $overrides));
} }
/** /**