Ignore:
Timestamp:
Jan 17, 2012, 10:58:18 PM (12 years ago)
Author:
rvelices
Message:

feature 2548 multisize - code cleanup + better usage in category_cats + i.php logs memory usage peak

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_html.inc.php

    r12761 r12920  
    33// | Piwigo - a PHP based photo gallery                                    |
    44// +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
     5// | Copyright(C) 2008-2012 Piwigo Team                  http://piwigo.org |
    66// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    77// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
     
    179179    }
    180180  }
    181  
     181
    182182  if ($single_link and isset($single_url))
    183183  {
     
    296296{
    297297  global $page;
    298  
     298
    299299  foreach (array($a, $b) as $tag)
    300300  {
     
    534534}
    535535
     536/**
     537 */
     538function render_element_name($info)
     539{
     540  $name = $info['name'];
     541  if (!empty($name))
     542  {
     543    $name = trigger_event('render_element_description', $name);
     544    return $name;
     545  }
     546
     547  return get_name_from_file($info['file']);
     548}
     549
     550function render_element_description($info)
     551{
     552  $comment = $info['comment'];
     553  if (!empty($comment))
     554  {
     555    $comment = trigger_event('render_element_description', $comment);
     556    return $comment;
     557  }
     558  return '';
     559}
     560
     561/**
     562 * returns the title of the thumbnail based on photo properties
     563 */
     564function get_thumbnail_title($info, $title, $comment)
     565{
     566  global $conf, $user;
     567
     568  $details = array();
     569
     570  if (!empty($info['hit']))
     571  {
     572    $details[] = $info['hit'].' '.strtolower(l10n('Visits'));
     573  }
     574
     575  if ($conf['rate'] and !empty($info['rating_score']))
     576  {
     577    $details[] = strtolower(l10n('Rating score')).' '.$info['rating_score'];
     578  }
     579
     580  if (isset($info['nb_comments']) and $info['nb_comments'] != 0)
     581  {
     582    $details[] = l10n_dec('%d comment', '%d comments', $info['nb_comments']);
     583  }
     584
     585  if (count($details) > 0)
     586  {
     587    $title.= ' ('.implode(', ', $details).')';
     588  }
     589
     590  if (!empty($comment))
     591  {
     592    $title.= ' '.substr($info['comment'], 0, 100).(strlen($info['comment']) > 100 ? '...' : '');
     593  }
     594
     595  $title = htmlspecialchars(strip_tags($title));
     596  $title = trigger_event('get_thumbnail_title', $title, $info);
     597  return $title;
     598}
     599
    536600?>
Note: See TracChangeset for help on using the changeset viewer.