]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/LinkDB.php
Fixes #497: ignore case difference between tags
[github/shaarli/Shaarli.git] / application / LinkDB.php
index a62341fc638e2c078e401bdedb58e6aa635e990c..4c1a45b50891c0f865a57760297601396429a065 100644 (file)
@@ -417,11 +417,18 @@ You use the community supported version of the original Shaarli project, by Seba
     public function allTags()
     {
         $tags = array();
+        $caseMapping = array();
         foreach ($this->_links as $link) {
             foreach (explode(' ', $link['tags']) as $tag) {
-                if (!empty($tag)) {
-                    $tags[$tag] = (empty($tags[$tag]) ? 1 : $tags[$tag] + 1);
+                if (empty($tag)) {
+                    continue;
                 }
+                // The first case found will be displayed.
+                if (!isset($caseMapping[strtolower($tag)])) {
+                    $caseMapping[strtolower($tag)] = $tag;
+                    $tags[$caseMapping[strtolower($tag)]] = 0;
+                }
+                $tags[$caseMapping[strtolower($tag)]]++;
             }
         }
         // Sort tags by usage (most used tag first)