public function prepare(PaperList $pl, $visible) { $this->has_badges = $pl->contact->can_view_tags(null) && TagInfo::has_badges(); if ($this->has_badges) { $pl->qopts["tags"] = 1; } $this->highlight = get($pl->search->matchPreg, "title"); return true; }
public function unparse_badges_html($tags) { if (is_array($tags)) { $tags = join(" ", $tags); } if (!$tags || $tags === " " || !TagInfo::has_badges()) { return ""; } if (!preg_match_all(TagInfo::badge_regex(), $tags, $m, PREG_SET_ORDER)) { return false; } $dt = TagInfo::defined_tags(); $x = ""; foreach ($m as $mx) { if (($t = $dt->check($mx[1])) && $t->badges) { $tag = $this->unparse(trim($mx[0])); $b = '<span class="badge ' . $t->badges[0] . 'badge">#' . $tag . '</span>'; if ($link = $this->link($tag)) { $b = '<a class="qq" href="' . $link . '">' . $b . '</a>'; } $x .= $b; } } return $x; }