Commit 340bb85c authored by Dries's avatar Dries

- Patch #60910 by doq: clean up the statistics.module's link handling. Show...

- Patch #60910 by doq: clean up the statistics.module's link handling.  Show clean URLs when available.
parent dcc64e37
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment