]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Fixes #526: bad font size separator in tagcloud with some locale 527/head
authorArthurHoaro <arthur@hoa.ro>
Tue, 29 Mar 2016 17:30:22 +0000 (19:30 +0200)
committerArthurHoaro <arthur@hoa.ro>
Thu, 31 Mar 2016 16:01:05 +0000 (18:01 +0200)
      * Force the number format with number_format().
      * Reduce the size deciment number to 2.

index.php
tpl/tagcloud.html

index dfc00fbd6c5d437ef8e074494e7443f7f0067673..735615ff7b084326aef7dc8dfee611021b73fe3a 100644 (file)
--- a/index.php
+++ b/index.php
@@ -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(
index 5891cd258498bd14b750940f868f8615842daa63..e449f2939fe095ca1138b4c4f02a6d64289ae83d 100644 (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}