summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-05-05 11:38:37 +0000
committerDries Buytaert <dries@buytaert.net>2006-05-05 11:38:37 +0000
commit340bb85c7f6a2637f94d7956fb4c2d8e15b6b601 (patch)
treecef5264769ffb58fe59067eca5583372c2035722
parentdcc64e37f013c14b82d6368999f98fc61ca5e5c8 (diff)
downloadbrdo-340bb85c7f6a2637f94d7956fb4c2d8e15b6b601.tar.gz
brdo-340bb85c7f6a2637f94d7956fb4c2d8e15b6b601.tar.bz2
- Patch #60910 by doq: clean up the statistics.module's link handling. Show clean URLs when available.
-rw-r--r--modules/statistics.module16
-rw-r--r--modules/statistics/statistics.module16
2 files changed, 18 insertions, 14 deletions
diff --git a/modules/statistics.module b/modules/statistics.module
index d01983bce..1869b5c0e 100644
--- a/modules/statistics.module
+++ b/modules/statistics.module
@@ -185,7 +185,7 @@ function statistics_node_tracker() {
while ($log = db_fetch_object($result)) {
$rows[] = array(
array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
- l(_statistics_column_width($log->url), $log->url),
+ _statistics_link($log->url),
theme('username', $log),
l(t('details'), "admin/logs/access/$log->aid"));
}
@@ -325,7 +325,7 @@ function statistics_top_referrers() {
$result = pager_query($query, 30, 0, $query_cnt, $_SERVER['HTTP_HOST']);
while ($referrer = db_fetch_object($result)) {
- $rows[] = array($referrer->hits, '<a href="'. check_url($referrer->url) .'">'. check_plain(_statistics_column_width($referrer->url)) .'</a>', t('%time ago', array('%time' => format_interval(time() - $referrer->last))));
+ $rows[] = array($referrer->hits, _statistics_link($referrer->url), t('%time ago', array('%time' => format_interval(time() - $referrer->last))));
}
$output = theme('table', $header, $rows);
@@ -468,14 +468,16 @@ function statistics_block($op = 'list', $delta = 0, $edit = array()) {
* It is possible to adjust the width of columns generated by the
* statistics module.
*/
-function _statistics_column_width($column, $width = 35) {
- return (strlen($column) > $width ? substr($column, 0, $width) . '...' : $column);
+function _statistics_link($path, $width = 35) {
+ $title = drupal_get_path_alias($path);
+ $title = truncate_utf8($title, $width, FALSE, TRUE);
+ return l($title, $path);
}
-function _statistics_format_item($title, $link) {
- $link = ($link ? $link : '/');
+function _statistics_format_item($title, $path) {
+ $path = ($path ? $path : '/');
$output = ($title ? "$title<br />" : '');
- $output .= l(_statistics_column_width($link), $link);
+ $output .= _statistics_link($path);
return $output;
}
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index d01983bce..1869b5c0e 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -185,7 +185,7 @@ function statistics_node_tracker() {
while ($log = db_fetch_object($result)) {
$rows[] = array(
array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
- l(_statistics_column_width($log->url), $log->url),
+ _statistics_link($log->url),
theme('username', $log),
l(t('details'), "admin/logs/access/$log->aid"));
}
@@ -325,7 +325,7 @@ function statistics_top_referrers() {
$result = pager_query($query, 30, 0, $query_cnt, $_SERVER['HTTP_HOST']);
while ($referrer = db_fetch_object($result)) {
- $rows[] = array($referrer->hits, '<a href="'. check_url($referrer->url) .'">'. check_plain(_statistics_column_width($referrer->url)) .'</a>', t('%time ago', array('%time' => format_interval(time() - $referrer->last))));
+ $rows[] = array($referrer->hits, _statistics_link($referrer->url), t('%time ago', array('%time' => format_interval(time() - $referrer->last))));
}
$output = theme('table', $header, $rows);
@@ -468,14 +468,16 @@ function statistics_block($op = 'list', $delta = 0, $edit = array()) {
* It is possible to adjust the width of columns generated by the
* statistics module.
*/
-function _statistics_column_width($column, $width = 35) {
- return (strlen($column) > $width ? substr($column, 0, $width) . '...' : $column);
+function _statistics_link($path, $width = 35) {
+ $title = drupal_get_path_alias($path);
+ $title = truncate_utf8($title, $width, FALSE, TRUE);
+ return l($title, $path);
}
-function _statistics_format_item($title, $link) {
- $link = ($link ? $link : '/');
+function _statistics_format_item($title, $path) {
+ $path = ($path ? $path : '/');
$output = ($title ? "$title<br />" : '');
- $output .= l(_statistics_column_width($link), $link);
+ $output .= _statistics_link($path);
return $output;
}