dj_mix_hosting_software/includes/globals.php
Cody Cook 70c8a87e15
All checks were successful
SonarQube Scan / SonarQube Trigger (push) Successful in 30s
Changes.
2024-05-19 20:01:13 -07:00

130 lines
4.0 KiB
PHP

<?php
// read toml config file
require_once 'vendor/autoload.php';
use Yosymfony\Toml\Toml;
$config = Toml::ParseFile('includes/config.toml');
require_once 'functions/i18n.php';
require_once 'includes/sessions.php';
require_once 'includes/lang_loader.php';
$mixshowsPages = ["/mixshows", "/mixshows/", "/mixshows.php"];
$djsPages = ["/djs", "/djs/", "/djs.php"];
$genrePages = ["/genres", "/genres/", "/genres.php"];
$specialStyle = array_merge($mixshowsPages, $djsPages, $genrePages);
/**
* @param int $count
* @param mixed $dj
* @param mixed $locale
* @return void
*/
function card_output(int $count, mixed $dj, mixed $locale): void
{
if ($count % 4 == 0) {
echo '<div class="row">';
}
echo '<div class="col-md-3">';
echo '<div class="card mb-4">';
echo '<div class="card-body bg-body-secondary">';
echo '<h5 class="card-title text-truncate" title="' . $dj['name'] . '">' . $dj['name'] . '</h5>';
echo '<p class="card-text">' . $dj['count'] . ' ';
if ($dj['count'] == 1) {
echo $locale['mix'];
} else {
echo $locale['mixes'];
}
echo '</p>';
}
function social_line($social, $value): string
{
$icon = "";
$url = "";
$color = "#000000";
switch ($social) {
case "facebook":
$icon = "fa-brands fa-facebook";
$url = "https://www.facebook.com/$value";
$color = "#3b5998";
$name = "Facebook";
break;
case "instagram":
$icon = "fa-brands fa-instagram";
$url = "https://www.instagram.com/$value";
$color = "#ac2bac";
$name = "Instagram";
break;
case "twitter":
$icon = "fa-brands fa-twitter";
$url = "https://www.twitter.com/$value";
$color = "#55acee";
$name = "Twitter";
break;
case "myspace":
$icon = "fa-brands fa-myspace";
$url = "https://www.myspace.com/$value";
$color = "#000000";
$name = "Myspace";
break;
case "soundcloud":
$icon = "fa-brands fa-soundcloud";
$url = "https://www.soundcloud.com/$value";
$color = "#ff8800";
$name = "Soundcloud";
break;
case "mixcloud":
$icon = "fa-brands fa-mixcloud";
$url = "https://www.mixcloud.com/$value";
$color = "#00c7f7";
$name = "Mixcloud";
break;
case "spotify":
$icon = "fa-brands fa-spotify";
$url = "https://www.spotify.com/$value";
$color = "#1DB954";
$name = "Spotify";
break;
case "linktree":
$icon = "fa-solid fa-link";
$url = "https://www.linktr.ee/$value";
$color = "#39E09B";
$name = "Linktree";
break;
default:
$icon = "fa-solid fa-link";
$url = $value;
$name = "Website";
break;
}
return "
<li class='list-group-item d-flex justify-content-between bg-body-secondary align-items-center p-3' title='$name'>
<i class='fa $icon fa-lg' style='color: $color;' title='$name'></i>
<p class='mb-0'><a href='$url' title='$name' >$value</a>
</p>
</li>";
}
function box_line($title, $value): string
{
return "<hr>
<div class='row'>
<div class='col-sm-3'>
<p class='mb-0'>$title</p>
</div>
<div class='col-sm-9'>
<p class='text-muted mb-0'>$value</p>
</div>
</div>";
}