diff options
-rw-r--r-- | include/functions_html.inc.php | 12 | ||||
-rw-r--r-- | tags.php | 7 |
2 files changed, 16 insertions, 3 deletions
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index e414c1c0c..ce327cc0c 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -294,7 +294,17 @@ function name_compare($a, $b) function tag_alpha_compare($a, $b) { - return strcmp(strtolower($a['url_name']), strtolower($b['url_name'])); + global $page; + + foreach (array($a, $b) as $tag) + { + if (!isset($page[__FUNCTION__.'_cache'][ $tag['name'] ])) + { + $page[__FUNCTION__.'_cache'][ $tag['name'] ] = strtolower(str2url($tag['name'])); + } + } + + return strcmp($page[__FUNCTION__.'_cache'][ $a['name'] ], $page[__FUNCTION__.'_cache'][ $b['name'] ]); } /** @@ -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) |