https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_...
7 common.inc drupal_http_build_query(array $query, $parent = '')
Parses an array into a valid, rawurlencoded query string.
This differs from http_build_query() as we need to rawurlencode() (instead of urlencode()) all query parameters.
Parameters
$query: The query parameter array to be processed, e.g. $_GET.
$parent: Internal use only. Used to build the $query array key for nested items.
Return value
A rawurlencoded string which can be used as or appended to the URL query string.
See also
drupal_get_query_parameters()
Related topics
HTTP handling
Functions to properly handle HTTP responses.
PHP wrapper functions
Functions that are wrappers or custom implementations of PHP functions.
9 calls to drupal_http_build_query()
File
includes/common.inc, line 486
Common functions that many Drupal modules will need to reference.
function drupal_http_build_query(array $query, $parent = '') { $params = array(); foreach ($query as $key => $value) { $key = ($parent ? $parent . '[' . rawurlencode($key) . ']' : rawurlencode($key)); // Recurse into children. if (is_array($value)) { $params [] = drupal_http_build_query($value, $key); } // If a query parameter value is NULL, only append its key. elseif (!isset($value)) { $params [] = $key; } else { // For better readability of paths in query strings, we decode slashes. $params [] = $key . '=' . str_replace('%2F', '/', rawurlencode($value)); } } return implode('&', $params); }
function drupal_get_query_parameters
https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_...
7 common.inc drupal_get_query_parameters(array $query = NULL, array $exclude = array('q'), $parent = '')
Processes a URL query parameter array to remove unwanted elements.
Parameters
$query: (optional) An array to be processed. Defaults to $_GET.
$exclude: (optional) A list of $query array keys to remove. Use "parent[child]" to exclude nested items. Defaults to array('q').
$parent: Internal use only. Used to build the $query array key for nested items.
Return value
An array containing query parameters, which can be used for url().
Related topics
HTTP handling
Functions to properly handle HTTP responses.
11 calls to drupal_get_query_parameters()
File
includes/common.inc, line 417
Common functions that many Drupal modules will need to reference.
function drupal_get_query_parameters(array $query = NULL, array $exclude = array('q'), $parent = '') { // Set defaults, if none given. if (!isset($query)) { $query = $_GET; } // If $exclude is empty, there is nothing to filter. if (empty($exclude)) { return $query; } elseif (!$parent) { $exclude = array_flip($exclude); } $params = array(); foreach ($query as $key => $value) { $string_key = ($parent ? $parent . '[' . $key . ']' : $key); if (isset($exclude [$string_key])) { continue; } if (is_array($value)) { $params [$key] = drupal_get_query_parameters($value, $exclude, $string_key); } else { $params [$key] = $value; } } return $params; }