From a8938827898ed40d35f25b055a72a41a2c1567ef Mon Sep 17 00:00:00 2001 From: rvelices Date: Sat, 18 Feb 2012 20:46:46 +0000 Subject: - multisize thumb longest side can be smaller than the square size - remove unused css, shorten/optimize php called very often (at least theoretically should be faster) git-svn-id: http://piwigo.org/svn/trunk@13240 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions.inc.php | 59 ++++++++--------------------------------------- 1 file changed, 10 insertions(+), 49 deletions(-) (limited to 'include/functions.inc.php') diff --git a/include/functions.inc.php b/include/functions.inc.php index b977a6ef4..e1f74baf8 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -816,22 +816,6 @@ function get_element_path($element_info) } -/* Returns the PATH to the thumbnail to be displayed. If the element does not - * have a thumbnail, the default mime image path is returned. The PATH can be - * used in the php script, but not sent to the browser. - * @param array element_info assoc array containing element info from db - * at least 'path', 'tn_ext' and 'id' should be present - */ -function get_thumbnail_path($element_info) -{ - $path = get_thumbnail_location($element_info); - if ( !url_is_remote($path) ) - { - $path = PHPWG_ROOT_PATH.$path; - } - return $path; -} - /* Returns the URL of the thumbnail to be displayed. If the element does not * have a thumbnail, the default mime image url is returned. The URL can be * sent to the browser, but not used in the php script. @@ -843,32 +827,6 @@ function get_thumbnail_url($element_info) return DerivativeImage::thumb_url($element_info); } -/* returns the relative path of the thumnail with regards to to the root -of piwigo (not the current page!).This function is not intended to be -called directly from code.*/ -function get_thumbnail_location($element_info) -{ - global $conf; - if ( !empty( $element_info['tn_ext'] ) ) - { - $path = substr_replace( - get_filename_wo_extension($element_info['path']), - '/'.$conf['dir_thumbnail'].'/'.$conf['prefix_thumbnail'], - strrpos($element_info['path'],'/'), - 1 - ); - $path.= '.'.$element_info['tn_ext']; - } - else - { - $path = get_themeconf('mime_icon_dir') - .strtolower(get_extension($element_info['path'])).'.png'; - // plugins want another location ? - $path = trigger_event( 'get_thumbnail_location', $path, $element_info); - } - return $path; -} - /** * fill the current user caddie with given elements, if not already in * caddie @@ -920,16 +878,19 @@ function get_name_from_file($filename) * @param string key * @return string */ -function l10n($key, $textdomain='messages') +function l10n($key) { global $lang, $conf; - if ($conf['debug_l10n'] and !isset($lang[$key]) and !empty($key)) - { - trigger_error('[l10n] language key "'.$key.'" is not defined', E_USER_WARNING); - } - - return isset($lang[$key]) ? $lang[$key] : $key; + if ( ($val=@$lang[$key]) == null) + { + if ($conf['debug_l10n'] and !isset($lang[$key]) and !empty($key)) + { + trigger_error('[l10n] language key "'.$key.'" is not defined', E_USER_WARNING); + } + $val = $key; + } + return $val; } /** -- cgit v1.2.3