diff --git a/ext/tag_categories/main.php b/ext/tag_categories/main.php
index 0ca1a7c9..f3ea8d4d 100644
--- a/ext/tag_categories/main.php
+++ b/ext/tag_categories/main.php
@@ -127,6 +127,27 @@ class TagCategories extends Extension
return $tc_keyed_dict;
}
+ public function getTagHtml(string $h_tag, $tag_category_dict, string $extra_text = '')
+ {
+ $h_tag_no_underscores = str_replace("_", " ", $h_tag);
+
+ // we found a tag, see if it's valid!
+ $h_tag_split = explode(':', $h_tag, 2);
+ if ((count($h_tag_split) > 1) and array_key_exists($h_tag_split[0], $tag_category_dict)) {
+ $category = $h_tag_split[0];
+ $h_tag = $h_tag_split[1];
+ $tag_category_css = ' tag_category_'.$category;
+ $tag_category_style = 'style="color:'.html_escape($tag_category_dict[$category]['color']).';" ';
+ $h_tag_no_underscores = str_replace("_", " ", $h_tag);
+
+ $h_tag_no_underscores = ''.$h_tag_no_underscores.$extra_text.'';
+ } else {
+ $h_tag_no_underscores .= $extra_text;
+ }
+
+ return $h_tag_no_underscores;
+ }
+
public function page_update()
{
global $user, $database;
diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php
index d692c5f7..538b027d 100644
--- a/ext/tag_list/main.php
+++ b/ext/tag_list/main.php
@@ -288,6 +288,10 @@ class TagList extends Extension
if ($config->get_bool(TagListConfig::PAGES)) {
$html .= $this->build_az();
}
+ if (class_exists('TagCategories')) {
+ $this->tagcategories = new TagCategories;
+ $tag_category_dict = $this->tagcategories->getKeyedDict();
+ }
foreach ($tag_data as $row) {
$h_tag = html_escape($row['tag']);
$size = sprintf("%.2f", (float)$row['scaled']);
@@ -296,6 +300,9 @@ class TagList extends Extension
$size = 0.5;
}
$h_tag_no_underscores = str_replace("_", " ", $h_tag);
+ if (class_exists('TagCategories')) {
+ $h_tag_no_underscores = $this->tagcategories->getTagHtml($h_tag, $tag_category_dict);
+ }
$html .= " $h_tag_no_underscores \n";
}
@@ -347,6 +354,11 @@ class TagList extends Extension
*/
mb_internal_encoding('UTF-8');
+ if (class_exists('TagCategories')) {
+ $this->tagcategories = new TagCategories;
+ $tag_category_dict = $this->tagcategories->getKeyedDict();
+ }
+
$lastLetter = "";
# postres utf8 string sort ignores punctuation, so we get "aza, a-zb, azc"
# which breaks down into "az, a-, az" :(
@@ -361,7 +373,10 @@ class TagList extends Extension
}
$link = $this->theme->tag_link($tag);
$h_tag = html_escape($tag);
- $html .= "$h_tag ($count)\n";
+ if (class_exists('TagCategories')) {
+ $h_tag = $this->tagcategories->getTagHtml($h_tag, $tag_category_dict, " ($count)");
+ }
+ $html .= "$h_tag\n";
}
if (SPEED_HAX) {