Ignore:
Timestamp:
Dec 17, 2011, 11:51:20 PM (9 years ago)
Author:
plg
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/include/functions_html.inc.php

    r12480 r12760  
    295295function tag_alpha_compare($a, $b)
    296296{
    297   return strcmp(strtolower($a['url_name']), strtolower($b['url_name']));
     297  global $page;
     298 
     299  foreach (array($a, $b) as $tag)
     300  {
     301    if (!isset($page[__FUNCTION__.'_cache'][ $tag['name'] ]))
     302    {
     303      $page[__FUNCTION__.'_cache'][ $tag['name'] ] = strtolower(str2url($tag['name']));
     304    }
     305  }
     306
     307  return strcmp($page[__FUNCTION__.'_cache'][ $a['name'] ], $page[__FUNCTION__.'_cache'][ $b['name'] ]);
    298308}
    299309
Note: See TracChangeset for help on using the changeset viewer.