diff options
author | plegall <plg@piwigo.org> | 2011-12-17 22:51:20 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2011-12-17 22:51:20 +0000 |
commit | f2ebe2bb57f0976f676104005692ad7ec562cb7d (patch) | |
tree | f61361b8696341cab708df6781c98818b83fdd8b /include | |
parent | 7add07ee9fe2ba8273c5334090975d68b6706fce (diff) |
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/branches/2.3@12760 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r-- | include/functions_html.inc.php | 12 |
1 files changed, 11 insertions, 1 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'] ]); } /** |