diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/LinkDB.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php index a62341fc..4c1a45b5 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php | |||
@@ -417,11 +417,18 @@ You use the community supported version of the original Shaarli project, by Seba | |||
417 | public function allTags() | 417 | public function allTags() |
418 | { | 418 | { |
419 | $tags = array(); | 419 | $tags = array(); |
420 | $caseMapping = array(); | ||
420 | foreach ($this->_links as $link) { | 421 | foreach ($this->_links as $link) { |
421 | foreach (explode(' ', $link['tags']) as $tag) { | 422 | foreach (explode(' ', $link['tags']) as $tag) { |
422 | if (!empty($tag)) { | 423 | if (empty($tag)) { |
423 | $tags[$tag] = (empty($tags[$tag]) ? 1 : $tags[$tag] + 1); | 424 | continue; |
424 | } | 425 | } |
426 | // The first case found will be displayed. | ||
427 | if (!isset($caseMapping[strtolower($tag)])) { | ||
428 | $caseMapping[strtolower($tag)] = $tag; | ||
429 | $tags[$caseMapping[strtolower($tag)]] = 0; | ||
430 | } | ||
431 | $tags[$caseMapping[strtolower($tag)]]++; | ||
425 | } | 432 | } |
426 | } | 433 | } |
427 | // Sort tags by usage (most used tag first) | 434 | // Sort tags by usage (most used tag first) |