diff options
author | Arthur <arthur@hoa.ro> | 2016-06-03 18:30:19 +0200 |
---|---|---|
committer | Arthur <arthur@hoa.ro> | 2016-06-03 18:30:19 +0200 |
commit | 92a381f51737de1e4a03c482fe7c43da311ad556 (patch) | |
tree | 888228f4e9a4bca68bc86e78ed3cd6f4c3339e14 /application/LinkDB.php | |
parent | e8f6024400307cbf2b8293073d7ba8cba5caae7e (diff) | |
parent | b1eb5d1d31e3ea256501c08a3ed9aa7183b27466 (diff) | |
download | Shaarli-92a381f51737de1e4a03c482fe7c43da311ad556.tar.gz Shaarli-92a381f51737de1e4a03c482fe7c43da311ad556.tar.zst Shaarli-92a381f51737de1e4a03c482fe7c43da311ad556.zip |
Merge pull request #583 from ArthurHoaro/enhance/tag-case
Fixes #497: ignore case difference between tags
Diffstat (limited to 'application/LinkDB.php')
-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 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) |