From 5db6f56e94f50302dd1e82a4162000aeead1b75d Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 2 Apr 2020 23:45:57 +0100 Subject: [PATCH 1/3] make separator configurable add config option to show non grouped tags --- main.inc.php | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/main.inc.php b/main.inc.php index a8646a4..29d6130 100644 --- a/main.inc.php +++ b/main.inc.php @@ -1,13 +1,20 @@ true, 'local'=>true) ); @@ -84,15 +94,24 @@ function tg_groups_display() foreach ($tags as $tag) { - // if the tag belongs to no group, we don't show it on the "tag by - // group" display mode - if (strpos($tag['name'], ':') === false) + // any group present? + if (preg_match("/[".preg_quote($tag_group_sep,"/")."]/", $tag['name']) < 1) { - continue; + if ($tag_group_hide_nogroup) + { + // if the tag belongs to no group, we don't show it on the "tag by + // group" display mode + continue; + } + else + { + // no group specified so name = group + $tag['group']=$tag['name']; + } } else { - list($tag['group'], $tag['name']) = explode(':', $tag['name'], 2); + list($tag['group'], $tag['name']) = preg_split("/[".preg_quote($tag_group_sep,"/")."]+/", $tag['name'], 2); $tag['group'] = preg_replace('/^[^=]*=/', '', $tag['group']); } @@ -203,7 +222,7 @@ function tg_index_groups_display() $is_tag_group_selection = true; foreach ($page['tags'] as $tag) { - if (!preg_match('/:/', $tag['name'])) + if (preg_match("/[".preg_quote($tag_group_sep,"/")."]/", $tag['name']) < 1) { $is_tag_group_selection = false; } @@ -255,7 +274,7 @@ function tg_index_groups_display() $tag_groups = array(); foreach ($tags as $id => $tag) { - list($group, $name) = explode(':', $tag['name'], 2); + list($group, $name) = preg_split("/[".preg_quote($tag_group_sep,"/")."]+/", $tag['name'], 2); if (!isset($tag_groups[$group])) { From e0e65ac376dbb206649e84befa20f68df97743d0 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 2 Apr 2020 23:48:40 +0100 Subject: [PATCH 2/3] reset unintentional changes --- main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.inc.php b/main.inc.php index 29d6130..01631f6 100644 --- a/main.inc.php +++ b/main.inc.php @@ -1,9 +1,9 @@ Date: Thu, 2 Apr 2020 23:51:02 +0100 Subject: [PATCH 3/3] use same style as mainline tags page --- tags.tpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tags.tpl b/tags.tpl index 9d55b27..4920091 100644 --- a/tags.tpl +++ b/tags.tpl @@ -8,7 +8,8 @@ {foreach from=$tag_group.tags item=tag} - + + {/foreach}
{$tag.name} [{$tag.counter}]{$tag.name}{$tag.counter|@translate_dec:'%d photo':'%d photos'}