diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-09-29 15:31:17 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-09-29 15:31:17 +0000 |
commit | 598e739208de28182f3329a2c23511f5c27489e5 (patch) | |
tree | ac6fa5fce35f2d60896660297ef1be52f0df728e /includes/pager.inc | |
parent | cef10893892a1c40f73fd972969c3512b0983cd6 (diff) | |
download | brdo-598e739208de28182f3329a2c23511f5c27489e5.tar.gz brdo-598e739208de28182f3329a2c23511f5c27489e5.tar.bz2 |
- Patch #578520 by sun | c960657, mfb, Dries, catch, mattyoung: make in url() only accept an array. Another nice API clean-up!
Diffstat (limited to 'includes/pager.inc')
-rw-r--r-- | includes/pager.inc | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/includes/pager.inc b/includes/pager.inc index 554282b49..0bee418df 100644 --- a/includes/pager.inc +++ b/includes/pager.inc @@ -171,18 +171,18 @@ class PagerDefault extends SelectQueryExtender { } /** - * Compose a query string to append to pager requests. + * Compose a URL query parameter array for pager links. * * @return - * A query string that consists of all components of the current page request - * except for those pertaining to paging. + * A URL query parameter array that consists of all components of the current + * page request except for those pertaining to paging. */ -function pager_get_querystring() { - static $string = NULL; - if (!isset($string)) { - $string = drupal_query_string_encode($_REQUEST, array_merge(array('q', 'page'), array_keys($_COOKIE))); +function pager_get_query_parameters() { + $query = &drupal_static(__FUNCTION__); + if (!isset($query)) { + $query = drupal_get_query_parameters($_REQUEST, array_merge(array('q', 'page'), array_keys($_COOKIE))); } - return $string; + return $query; } /** @@ -465,11 +465,10 @@ function theme_pager_link($text, $page_new, $element, $parameters = array(), $at $query = array(); if (count($parameters)) { - $query[] = drupal_query_string_encode($parameters, array()); + $query = drupal_get_query_parameters($parameters, array()); } - $querystring = pager_get_querystring(); - if ($querystring != '') { - $query[] = $querystring; + if ($query_pager = pager_get_query_parameters()) { + $query = array_merge($query, $query_pager); } // Set each pager link title @@ -491,7 +490,7 @@ function theme_pager_link($text, $page_new, $element, $parameters = array(), $at } } - return l($text, $_GET['q'], array('attributes' => $attributes, 'query' => count($query) ? implode('&', $query) : NULL)); + return l($text, $_GET['q'], array('attributes' => $attributes, 'query' => $query)); } /** |