fix: do not uppercase the tags, fix some other cosmetic issues.

This commit is contained in:
Floorb 2023-02-27 05:42:26 -05:00
parent 95885d6f5a
commit 547e0fb30b
2 changed files with 3 additions and 7 deletions

View file

@ -241,7 +241,7 @@ $site_info = getSiteInfo();
$global_site_info = $site_info['site_info']; $global_site_info = $site_info['site_info'];
$row = $site_info['site_info']; $row = $site_info['site_info'];
$title = trim($row['title']); $title = trim($row['title']);
$baseurl = trim($row['baseurl']); $baseurl = paste_protocol() . rtrim(trim($row['baseurl']), '/');
$site_name = trim($row['site_name']); $site_name = trim($row['site_name']);
$email = trim($row['email']); $email = trim($row['email']);
$additional_scripts = trim($row['additional_scripts']); $additional_scripts = trim($row['additional_scripts']);

View file

@ -8,17 +8,15 @@ function tagsToHtml(array | Collection $tags) : string {
$tag = $tagObj->name; $tag = $tagObj->name;
$tag_lower = strtolower($tag); $tag_lower = strtolower($tag);
if ($tag_lower === 'nsfw' || $tag_lower === 'explicit') { if ($tag_lower === 'nsfw' || $tag_lower === 'explicit') {
$tag = strtoupper($tag);
$tagcolor = "tag is-danger"; $tagcolor = "tag is-danger";
} elseif ($tag_lower === 'safe') { } elseif ($tag_lower === 'safe') {
$tag = strtoupper($tag);
$tagcolor = "tag is-success"; $tagcolor = "tag is-success";
} elseif ($tag[0] === '/' && $tag[-1] === '/') { } elseif ($tag[0] === '/' && $tag[-1] === '/') {
$tagcolor = "tag is-primary"; $tagcolor = "tag is-primary";
} else { } else {
$tagcolor = "tag is-info"; $tagcolor = "tag is-info";
} }
$output .= '<a href="/archive?q=' . urlencode($tag) . '"><span class="' . $tagcolor . '">' . pp_html_escape(ucfirst($tag)) . '</span></a>'; $output .= '<a href="/archive?q=' . urlencode($tag) . '"><span class="' . $tagcolor . '">' . pp_html_escape($tag) . '</span></a>';
} }
return $output; return $output;
} }
@ -43,17 +41,15 @@ function tagsToHtmlUser(string | array | Collection $tags, $profile_username) :
foreach ($tagsSplit as $tag) { foreach ($tagsSplit as $tag) {
$tag_lower = strtolower($tag); $tag_lower = strtolower($tag);
if ($tag_lower === 'nsfw' || $tag_lower === 'explicit') { if ($tag_lower === 'nsfw' || $tag_lower === 'explicit') {
$tag = strtoupper($tag);
$tagcolor = "tag is-danger"; $tagcolor = "tag is-danger";
} elseif ($tag_lower === 'safe') { } elseif ($tag_lower === 'safe') {
$tag = strtoupper($tag);
$tagcolor = "tag is-success"; $tagcolor = "tag is-success";
} elseif ($tag[0] === '/' && $tag[-1] === '/') { } elseif ($tag[0] === '/' && $tag[-1] === '/') {
$tagcolor = "tag is-primary"; $tagcolor = "tag is-primary";
} else { } else {
$tagcolor = "tag is-info"; $tagcolor = "tag is-info";
} }
$output .= '<a href="/user.php?user=' . $profile_username . '&q=' . urlencode($tag) . '"><span class="' . $tagcolor . '">' . pp_html_escape(ucfirst($tag)) . '</span></a>'; $output .= '<a href="/user.php?user=' . $profile_username . '&q=' . urlencode($tag) . '"><span class="' . $tagcolor . '">' . pp_html_escape($tag) . '</span></a>';
} }
return $output; return $output;
} }