You are here

public function FacetapiUrlProcessorStandard::fetchQueryParams in Facet API 6.3

1 call to FacetapiUrlProcessorStandard::fetchQueryParams()
FacetapiUrlProcessorStandard::normalizeParams in plugins/facetapi/url_processor_standard.inc
Implements FacetapiUrlProcessor::normalizeParams().

File

plugins/facetapi/url_processor_standard.inc, line 22
The standard URL processor.

Class

FacetapiUrlProcessorStandard
Extension of FacetapiUrlProcessor.

Code

public function fetchQueryParams(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] = $this
        ->fetchQueryParams($value, $exclude, $string_key);
    }
    else {
      $params[$key] = $value;
    }
  }
  return $params;
}