diff options
Diffstat (limited to '')
-rw-r--r-- | include/category_default.inc.php | 9 | ||||
-rw-r--r-- | include/functions.inc.php | 54 |
2 files changed, 51 insertions, 12 deletions
diff --git a/include/category_default.inc.php b/include/category_default.inc.php index 40e5b6814..1133c2b00 100644 --- a/include/category_default.inc.php +++ b/include/category_default.inc.php @@ -104,6 +104,11 @@ foreach ($pictures as $row) array('start') ); + if (isset($nb_comments_of) ) + { + $row['nb_comments'] = (int)@$nb_comments_of[$row['id']]; + } + $tpl_var = array( 'ID' => $row['id'], @@ -166,9 +171,9 @@ foreach ($pictures as $row) $tpl_var['NAME'] = $name; - if ( isset($nb_comments_of) ) + if (isset($row['nb_comments'])) { - $tpl_var['NB_COMMENTS'] = (int)@$nb_comments_of[$row['id']]; + $tpl_var['NB_COMMENTS'] = $row['nb_comments']; } $tpl_thumbnails_var[] = $tpl_var; 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 * |