Merge pull request #527 from ArthurHoaro/hotfix/tagcloud-size

Fixes #526: bad font size separator in tagcloud with some locale
This commit is contained in:
Arthur 2016-04-09 16:35:14 +02:00
commit a1703c44c6
2 changed files with 12 additions and 7 deletions

View File

@ -1015,11 +1015,16 @@ function renderPage()
return strcasecmp($a, $b);
});
$tagList=array();
foreach($tags as $key=>$value)
// Tag font size scaling: default 15 and 30 logarithm bases affect scaling, 22 and 6 are arbitrary font sizes for max and min sizes.
{
$tagList[$key] = array('count'=>$value,'size'=>log($value, 15) / log($maxcount, 30) * (22-6) + 6);
$tagList = array();
foreach($tags as $key => $value) {
// Tag font size scaling:
// default 15 and 30 logarithm bases affect scaling,
// 22 and 6 are arbitrary font sizes for max and min sizes.
$size = log($value, 15) / log($maxcount, 30) * 2.2 + 0.8;
$tagList[$key] = array(
'count' => $value,
'size' => number_format($size, 2, '.', ''),
);
}
$data = array(

View File

@ -12,8 +12,8 @@
<div id="cloudtag">
{loop="tags"}
<span class="count">{$value.count}</span>
<a href="?searchtags={$key|urlencode}" style="font-size:{$value.size}pt;">{$key}</a>
<span class="count">{$value.count}</span><a
href="?searchtags={$key|urlencode}" style="font-size:{$value.size}em;">{$key}</a>
{loop="$value.tag_plugin"}
{$value}
{/loop}