aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions.inc.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/functions.inc.php54
1 files changed, 44 insertions, 10 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 09ac3b668..ae29267d7 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -782,25 +782,47 @@ function get_thumbnail_location($element_info)
return $path;
}
-/* returns the title of the thumnail */
-function get_thumbnail_title($element_info)
+/**
+ * returns the title of the thumbnail based on photo properties
+ */
+function get_thumbnail_title($info)
{
- // message in title for the thumbnail
- if (isset($element_info['file']))
+ global $conf, $user;
+
+ $title = get_picture_title($info);
+
+ $details = array();
+
+ if ($info['hit'] != 0)
{
- $thumbnail_title = $element_info['file'];
+ $details[] = $info['hit'].' '.strtolower(l10n('Visits'));
}
- else
+
+ if ($conf['rate'] and !empty($info['rating_score']))
+ {
+ $details[] = strtolower(l10n('Rating score')).' '.$info['rating_score'];
+ }
+
+ if (isset($info['nb_comments']) and $info['nb_comments'] != 0)
{
- $thumbnail_title = '';
+ $details[] = l10n_dec('%d comment', '%d comments', $info['nb_comments']);
}
- if (!empty($element_info['filesize']))
+ if (count($details) > 0)
{
- $thumbnail_title .= ' : '.sprintf(l10n('%d Kb'), $element_info['filesize']);
+ $title.= ' ('.implode(', ', $details).')';
}
- return $thumbnail_title;
+ if (!empty($info['comment']))
+ {
+ $title.= ' '.$info['comment'];
+ }
+
+ $title = strip_tags($title);
+
+ $title = trigger_event('get_thumbnail_title', $title, $info);
+
+ return $title;
}
/**
@@ -848,6 +870,18 @@ function get_name_from_file($filename)
}
/**
+ */
+function get_picture_title($info)
+{
+ if (isset($info['name']) and !empty($info['name']))
+ {
+ return $info['name'];
+ }
+
+ return get_name_from_file($info['file']);
+}
+
+/**
* returns the corresponding value from $lang if existing. Else, the key is
* returned
*