You are here

function print_query_string_encode in Printer, email and PDF versions 7

Same name and namespace in other branches
  1. 5.4 print.module \print_query_string_encode()
  2. 5.3 print.module \print_query_string_encode()
  3. 6 print.module \print_query_string_encode()
  4. 5.x print.module \print_query_string_encode()

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

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

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

Return value

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

6 calls to print_query_string_encode()
print_insert_link in ./print.module
Auxiliary function to display a formatted Printer-friendly link
print_mail_insert_link in print_mail/print_mail.module
Auxiliary function to display a formatted send by email link
print_mail_node_view in print_mail/print_mail.module
Implements hook_node_view().
print_node_view in ./print.module
Implements hook_node_view().
print_pdf_insert_link in print_pdf/print_pdf.module
Auxiliary function to display a formatted PDF version link

... See full list

File

./print.module, line 905
Displays Printer-friendly versions of Drupal pages.

Code

function print_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_query_string_encode($value, $exclude, $key);
    }
    else {
      $params[$key] = $value;
    }
  }
  return empty($params) ? NULL : $params;
}