aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-04-14 17:59:37 +0200
committerArthurHoaro <arthur@hoa.ro>2016-05-31 09:09:32 +0200
commitb1eb5d1d31e3ea256501c08a3ed9aa7183b27466 (patch)
treeda39f2c91bf636ff7a9d0890ec70601b2ca92797 /application
parent11609d9fd8ba53f049e6c913d8e3affab6cfc9ce (diff)
downloadShaarli-b1eb5d1d31e3ea256501c08a3ed9aa7183b27466.tar.gz
Shaarli-b1eb5d1d31e3ea256501c08a3ed9aa7183b27466.tar.zst
Shaarli-b1eb5d1d31e3ea256501c08a3ed9aa7183b27466.zip
Fixes #497: ignore case difference between tags
While retrieving all tags, case differences will be ignored. This affects: * tag cloud * tag autocompletion
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 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)