You are here

function _print_ui_query_string_encode in Printer, email and PDF versions 7.2

Parse an array into a valid urlencoded query string.

Modified from drupal_query_string_encode to prevent re-encoding of encoded original. (see #301192)

Parameters

array $query: The array to be processed e.g. $_GET.

array $exclude: The array filled with keys to be excluded.

string $parent: The be used in recursive calls.

Return value

array urlencoded string which can be appended to/as the URL query string

2 calls to _print_ui_query_string_encode()
print_ui_insert_link in print_ui/print_ui.module
Auxiliary function to display a formatted Printer-friendly link.
print_ui_node_view in print_ui/print_ui.module
Implements hook_node_view().

File

print_ui/print_ui.module, line 795
Printer-friendly pages User Interface module.

Code

function _print_ui_query_string_encode($query, $exclude = array(), $parent = '') {
  $params = array();
  foreach ($query as $key => $value) {
    if (in_array($key, $exclude, TRUE)) {
      continue;
    }
    if (is_array($value)) {
      $params[$key] = _print_ui_query_string_encode($value, $exclude, $key);
    }
    else {
      $params[$key] = $value;
    }
  }
  return empty($params) ? NULL : $params;
}