From 6ccd0b218fbd34de750f55b78f3dc43bb3d9fa8e Mon Sep 17 00:00:00 2001 From: Lucas Cimon Date: Thu, 18 May 2017 20:28:11 +0200 Subject: Adding ability to display subtags in tagcloud --- index.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 468dd091..fb8b96b5 100644 --- a/index.php +++ b/index.php @@ -790,7 +790,9 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history) // -------- Tag cloud if ($targetPage == Router::$PAGE_TAGCLOUD) { - $tags= $LINKSDB->allTags(); + $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all'; + $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : array(); + $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); // We sort tags alphabetically, then choose a font size according to count. // First, find max value. @@ -824,6 +826,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history) } $data = array( + 'search_tags' => implode(' ', $filteringTags), 'tags' => $tagList, ); $pluginManager->executeHooks('render_tagcloud', $data, array('loggedin' => isLoggedIn())); @@ -1351,7 +1354,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history) 'link' => $link, 'link_is_new' => false, 'http_referer' => (isset($_SERVER['HTTP_REFERER']) ? escape($_SERVER['HTTP_REFERER']) : ''), - 'tags' => $LINKSDB->allTags(), + 'tags' => $LINKSDB->linksCountPerTag(), ); $pluginManager->executeHooks('render_editlink', $data); @@ -1420,7 +1423,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history) 'link_is_new' => $link_is_new, 'http_referer' => (isset($_SERVER['HTTP_REFERER']) ? escape($_SERVER['HTTP_REFERER']) : ''), 'source' => (isset($_GET['source']) ? $_GET['source'] : ''), - 'tags' => $LINKSDB->allTags(), + 'tags' => $LINKSDB->linksCountPerTag(), 'default_private_links' => $conf->get('privacy.default_private_links', false), ); $pluginManager->executeHooks('render_editlink', $data); -- cgit v1.2.3