diff options
author | plegall <plg@piwigo.org> | 2011-12-17 22:52:19 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2011-12-17 22:52:19 +0000 |
commit | b581ba81b7f92ce7ce1b9ade1d004f200a828e4e (patch) | |
tree | 44ff31e965dafee24fcc71dee1d52810ef7019e0 /tags.php | |
parent | b3ce83e9cb53ac9de13463f37645a01bad7ca9da (diff) |
merge r12760 from branch 2.3 to trunk
bug 2502 fixed: better handling of non-latin tags and multilanguage tags on
tags.php with mode letter.
We can't rely on url_name because it always start with "_" when the tag looks
like "[lang...". Instead we compute a str2url on the name, but once it has been
rendered by Extended Description. To avoid useless computations, I have added a
cache on the tag_alpha_compare function. Tested on a 175 tags set, speed is
good.
git-svn-id: http://piwigo.org/svn/trunk@12761 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'tags.php')
-rw-r--r-- | tags.php | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -99,7 +99,7 @@ if ($page['display_mode'] == 'letters') { foreach ($tags as $tag) { - $tag_letter = strtoupper(substr($tag['url_name'], 0, 1)); + $tag_letter = strtoupper(mb_substr(str2url($tag['name']), 0, 1, 'utf-8')); if ($current_tag_idx==0) { $current_letter = $tag_letter; @@ -171,7 +171,10 @@ $tags = array_slice($tags, 0, $conf['full_tag_cloud_items_number']); $tags = add_level_to_tags($tags); // we want tags diplayed in alphabetic order -usort($tags, 'tag_alpha_compare'); +if ('letters' != $page['display_mode']) +{ + usort($tags, 'tag_alpha_compare'); +} // display sorted tags foreach ($tags as $tag) |