mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-27 19:59:56 +03:00
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
This commit is contained in:
parent
b3ce83e9cb
commit
b581ba81b7
2 changed files with 16 additions and 3 deletions
|
@ -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'] ]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue