summaryrefslogtreecommitdiff
path: root/modules/statistics.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-11-29 09:31:28 +0000
committerDries Buytaert <dries@buytaert.net>2004-11-29 09:31:28 +0000
commitd8113fda7eb79ff4a5b5f7283974b66cf31db079 (patch)
tree05b0a69ede3321f4944a36a045d69f5e5e1d52bd /modules/statistics.module
parent254233da61a5cda69369f3eee846bd8ad4882066 (diff)
downloadbrdo-d8113fda7eb79ff4a5b5f7283974b66cf31db079.tar.gz
brdo-d8113fda7eb79ff4a5b5f7283974b66cf31db079.tar.bz2
- Small code improvements.
Diffstat (limited to 'modules/statistics.module')
-rw-r--r--modules/statistics.module28
1 files changed, 12 insertions, 16 deletions
diff --git a/modules/statistics.module b/modules/statistics.module
index 8c07e0a65..d5b9f1546 100644
--- a/modules/statistics.module
+++ b/modules/statistics.module
@@ -144,13 +144,6 @@ function statistics_menu($may_cache) {
return $items;
}
-function _statistics_format_item($title, $link) {
- $link = ($link ? $link : '/');
- $output = ($title ? "$title<br />" : '');
- $output .= l($link, $link);
- return $output;
-}
-
function statistics_access_log($aid) {
$result = db_query('SELECT a.*, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE aid = %d', $aid);
if ($access = db_fetch_object($result)) {
@@ -182,7 +175,7 @@ function statistics_node_tracker() {
while ($log = db_fetch_object($result)) {
$rows[] = array(
array('data' => format_date($log->timestamp, 'small'), 'nowrap' => 'nowrap'),
- l($log->url, $log->url),
+ l(_statistics_column_width($log->url), $log->url),
format_name($log),
l(t('details'), "admin/logs/access/$log->aid"));
}
@@ -322,7 +315,7 @@ function statistics_top_referrers() {
$result = pager_query($query, 30, 0, $query_cnt);
while ($referrer = db_fetch_object($result)) {
- $rows[] = array($referrer->hits, '<a href="'. $referrer->url .'">'. _statistics_column_width($referrer->url, '_refer', 65) .'</a>', t('%time ago', array('%time' => format_interval(time() - $referrer->last))));
+ $rows[] = array($referrer->hits, '<a href="'. $referrer->url .'">'. _statistics_column_width($referrer->url) .'</a>', t('%time ago', array('%time' => format_interval(time() - $referrer->last))));
}
if ($pager = theme('pager', NULL, 30, 0, tablesort_pager())) {
$rows[] = array(array('data' => $pager, 'colspan' => '3'));
@@ -471,14 +464,17 @@ function statistics_block($op = 'list', $delta = 0, $edit = array()) {
/**
* It is possible to adjust the width of columns generated by the
- * statistics module. Currently this has to be done manually, by
- * updating the appropriate variable. There are several recognized variables:
- * 'statistics_column_width', 'statistics_column_width_refer', and
- * 'statistics_column_width_title'
+ * statistics module.
*/
-function _statistics_column_width($column, $type = "", $default = 26) {
- $max_width = variable_get("statistics_column_width$type", $default);
- return (strlen($column) > $max_width ? substr($column, 0, $max_width) . '...' : $column);
+function _statistics_column_width($column, $width = 35) {
+ return (strlen($column) > $width ? substr($column, 0, $width) . '...' : $column);
+}
+
+function _statistics_format_item($title, $link) {
+ $link = ($link ? $link : '/');
+ $output = ($title ? "$title<br />" : '');
+ $output .= l($link, $link);
+ return $output;
}
/**