From 3329ad927c93b86587ec6ef3b7804ddcf1948384 Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Sun, 15 Jan 2006 00:04:20 +0000 Subject: - #44498: Clean up pager / make more accessible --- includes/pager.inc | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'includes/pager.inc') diff --git a/includes/pager.inc b/includes/pager.inc index c5f10ffd3..186810fb7 100644 --- a/includes/pager.inc +++ b/includes/pager.inc @@ -108,11 +108,11 @@ function theme_pager($tags = array(), $limit = 10, $element = 0, $parameters = a if ($pager_total[$element] > 1) { $output .= '
'; - $output .= theme('pager_first', ($tags[0] ? $tags[0] : t('« first')), $limit, $element, $parameters); - $output .= theme('pager_previous', ($tags[1] ? $tags[1] : t('‹ previous')), $limit, $element, 1, $parameters); + $output .= theme('pager_first', ($tags[0] ? $tags[0] : t('« first')), $limit, $element, $parameters); + $output .= theme('pager_previous', ($tags[1] ? $tags[1] : t('‹ previous')), $limit, $element, 1, $parameters); $output .= theme('pager_list', $limit, $element, ($tags[2] ? $tags[2] : 9 ), '', $parameters); - $output .= theme('pager_next', ($tags[3] ? $tags[3] : t('next ›')), $limit, $element, 1, $parameters); - $output .= theme('pager_last', ($tags[4] ? $tags[4] : t('last »')), $limit, $element, $parameters); + $output .= theme('pager_next', ($tags[3] ? $tags[3] : t('next ›')), $limit, $element, 1, $parameters); + $output .= theme('pager_last', ($tags[4] ? $tags[4] : t('last »')), $limit, $element, $parameters); $output .= '
'; return $output; @@ -311,7 +311,7 @@ function theme_pager_list($limit, $element = 0, $quantity = 5, $text = '', $para if ($i != $pager_max) { $output .= $text; if ($i > 1) { - $output .= ''; + $output .= ''; } // Now generate the actual pager piece. @@ -328,7 +328,7 @@ function theme_pager_list($limit, $element = 0, $quantity = 5, $text = '', $para } if ($i < $pager_max) { - $output .= ''; + $output .= ''; } } $output .= ''; @@ -361,10 +361,26 @@ function theme_pager_link($text, $page_new, $element, $parameters = array(), $at $query[] = $key .'='. $value; } - // Set each pager link title with correct page number (clean out HTML entities, title doesn't like those) - $attributes['title'] = is_numeric($text) ? 'goto page ' . $text : 'goto ' . str_replace(array('« ', '‹ ', ' ›', ' »'), '', $text) . ' page'; + // Set each pager link title + if (!isset($attributes['title'])) { + static $titles = null; + if (!isset($titles)) { + $titles = array( + t('« first') => t('Go to first page'), + t('‹ previous') => t('Go to previous page'), + t('next ›') => t('Go to next page'), + t('last »') => t('Go to last page'), + ); + } + if (isset($titles[$text])) { + $attributes['title'] = $titles[$text]; + } + else if (is_numeric($text)) { + $attributes['title'] = t('Go to page %number', array('%number' => $text)); + } + } - return l($text, $_GET['q'], $attributes, count($query) ? implode('&', $query) : NULL, NULL, FALSE, TRUE); + return l($text, $_GET['q'], $attributes, count($query) ? implode('&', $query) : NULL); } /** -- cgit v1.2.3