diff options
author | Lucas Cimon <lucas.cimon@gmail.com> | 2017-05-18 20:28:11 +0200 |
---|---|---|
committer | Lucas Cimon <lucas.cimon@gmail.com> | 2017-05-24 13:09:35 +0200 |
commit | 6ccd0b218fbd34de750f55b78f3dc43bb3d9fa8e (patch) | |
tree | ae99823d461435577abd25b8bb24ef07692b99a1 /application | |
parent | 61c15aa5554431893ea5ebe800a9a625dca5aff9 (diff) | |
download | Shaarli-6ccd0b218fbd34de750f55b78f3dc43bb3d9fa8e.tar.gz Shaarli-6ccd0b218fbd34de750f55b78f3dc43bb3d9fa8e.tar.zst Shaarli-6ccd0b218fbd34de750f55b78f3dc43bb3d9fa8e.zip |
Adding ability to display subtags in tagcloud
Diffstat (limited to 'application')
-rw-r--r-- | application/LinkDB.php | 11 | ||||
-rw-r--r-- | application/PageBuilder.php | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php index 0d3c85bd..7802cc8a 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php | |||
@@ -452,14 +452,17 @@ You use the community supported version of the original Shaarli project, by Seba | |||
452 | } | 452 | } |
453 | 453 | ||
454 | /** | 454 | /** |
455 | * Returns the list of all tags | 455 | * Returns the list tags appearing in the links with the given tags |
456 | * Output: associative array key=tags, value=0 | 456 | * @param $filteringTags: tags selecting the links to consider |
457 | * @param $visibility: process only all/private/public links | ||
458 | * @return: a tag=>linksCount array | ||
457 | */ | 459 | */ |
458 | public function allTags() | 460 | public function linksCountPerTag($filteringTags = [], $visibility = 'all') |
459 | { | 461 | { |
462 | $links = empty($filteringTags) ? $this->links : $this->filterSearch(['searchtags' => $filteringTags], false, $visibility); | ||
460 | $tags = array(); | 463 | $tags = array(); |
461 | $caseMapping = array(); | 464 | $caseMapping = array(); |
462 | foreach ($this->links as $link) { | 465 | foreach ($links as $link) { |
463 | foreach (preg_split('/\s+/', $link['tags'], 0, PREG_SPLIT_NO_EMPTY) as $tag) { | 466 | foreach (preg_split('/\s+/', $link['tags'], 0, PREG_SPLIT_NO_EMPTY) as $tag) { |
464 | if (empty($tag)) { | 467 | if (empty($tag)) { |
465 | continue; | 468 | continue; |
diff --git a/application/PageBuilder.php b/application/PageBuilder.php index 50e3f124..c86621a2 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php | |||
@@ -89,7 +89,7 @@ class PageBuilder | |||
89 | $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false)); | 89 | $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false)); |
90 | $this->tpl->assign('token', getToken($this->conf)); | 90 | $this->tpl->assign('token', getToken($this->conf)); |
91 | if ($this->linkDB !== null) { | 91 | if ($this->linkDB !== null) { |
92 | $this->tpl->assign('tags', $this->linkDB->allTags()); | 92 | $this->tpl->assign('tags', $this->linkDB->linksCountPerTag()); |
93 | } | 93 | } |
94 | // To be removed with a proper theme configuration. | 94 | // To be removed with a proper theme configuration. |
95 | $this->tpl->assign('conf', $this->conf); | 95 | $this->tpl->assign('conf', $this->conf); |