aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/LinkDB.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php
index 1cb70de0..b1072e07 100644
--- a/application/LinkDB.php
+++ b/application/LinkDB.php
@@ -440,11 +440,18 @@ You use the community supported version of the original Shaarli project, by Seba
440 public function allTags() 440 public function allTags()
441 { 441 {
442 $tags = array(); 442 $tags = array();
443 $caseMapping = array();
443 foreach ($this->_links as $link) { 444 foreach ($this->_links as $link) {
444 foreach (explode(' ', $link['tags']) as $tag) { 445 foreach (explode(' ', $link['tags']) as $tag) {
445 if (!empty($tag)) { 446 if (empty($tag)) {
446 $tags[$tag] = (empty($tags[$tag]) ? 1 : $tags[$tag] + 1); 447 continue;
447 } 448 }
449 // The first case found will be displayed.
450 if (!isset($caseMapping[strtolower($tag)])) {
451 $caseMapping[strtolower($tag)] = $tag;
452 $tags[$caseMapping[strtolower($tag)]] = 0;
453 }
454 $tags[$caseMapping[strtolower($tag)]]++;
448 } 455 }
449 } 456 }
450 // Sort tags by usage (most used tag first) 457 // Sort tags by usage (most used tag first)