Language updates. New upload form. new classes.

This commit is contained in:
Cody Cook 2025-02-22 00:20:39 -08:00
commit 8f3061ab99
62 changed files with 3107 additions and 1883 deletions

102
mix.php
View file

@ -13,9 +13,9 @@ $db = new Database($config);
$mixFound = false;
if (isset($_GET['mix']) && $_GET['mix'] != "") {
$mix = new Mix($_GET['mix'], $db);
if ($mix->get_name() != "") {
if ($mix->getName() != "") {
$mixFound = true;
$title = $mix->get_name();
$title = $mix->getName();
} else {
$title = $locale['notfound'];
}
@ -42,8 +42,8 @@ require_once 'includes/header.php'; ?>
<li class="breadcrumb-item"><?php echo $locale['mixes']; ?></li>
<li class="breadcrumb-item active"
aria-current="page"><?php
if (isset($mix) && $mix->get_name() != "") {
echo $mix->get_name();
if (isset($mix) && $mix->getName() != "") {
echo $mix->getName();
} else {
echo $locale['notfound'];
}
@ -59,14 +59,14 @@ require_once 'includes/header.php'; ?>
<div class="card mb-4">
<div class="card-body bg-body-secondary text-center">
<?php
if ($mix->get_img() != "") {
echo "<img src='" . $mix->get_img() . "' alt='avatar' class='img-fluid' style='width: 150px;'>";
if ($mix->getCover() != "") {
echo "<img src='" . $mix->getCover() . "' alt='avatar' class='img-fluid' style='width: 150px;'>";
} ?>
<h1 class="my-3 fs-4"><?php echo $mix->get_name();
<h1 class="my-3 fs-4"><?php echo $mix->getName();
?></h1>
<?php
if ($mix->get_description() != "") {
echo "<h2 class='text-muted mb-4 fs-6'>" . $mix->get_description() . "</h2>";
if ($mix->getDescription() != "") {
echo "<h2 class='text-muted mb-4 fs-6'>" . $mix->getDescription() . "</h2>";
}
?>
</p>
@ -75,12 +75,12 @@ require_once 'includes/header.php'; ?>
<div class="card mb-4">
<div class="card-body bg-body-secondary text-center">
<?php
if ($mix->is_download_only()) {
echo "<a href='/mix/" . $mix->get_slug() . "/download" . "' class='btn btn-primary w-100 mb-2'>" . $locale['download'] . "</a>";
if ($mix->isDownloadOnly()) {
echo "<a href='/mix/" . $mix->getSlug() . "/download" . "' class='btn btn-primary w-100 mb-2'>" . $locale['download'] . "</a>";
} else {
?>
<div id="audio-player">
<audio id="audio" src="<?php echo $mix->get_url(); ?>"></audio>
<audio id="audio" src="<?php echo $mix->getUrl(); ?>"></audio>
<div class="player-controls">
<button id="play-pause-btn">
<i class="fas fa-play" style="font-size: 12px;"></i>
@ -101,10 +101,10 @@ require_once 'includes/header.php'; ?>
<?php echo $locale['share']; ?>
</button>
<?php if (!$mix->is_download_only()) : ?>
<?php if (!$mix->isDownloadOnly()) : ?>
<a href="<?php
echo "/mix/" . $mix->get_slug() . "/download";
echo "/mix/" . $mix->getSlug() . "/download";
?>"
class="btn btn-primary w-100 mb-2"><?php echo $locale['download']; ?></a>
@ -121,7 +121,7 @@ require_once 'includes/header.php'; ?>
<p class="mb-0"><?php echo $locale['mixname'] ?></p>
</div>
<div class="col-sm-9">
<p class="text-muted mb-0"><?php echo $mix->get_name(); ?></p>
<p class="text-muted mb-0"><?php echo $mix->getName(); ?></p>
</div>
</div>
<hr>
@ -134,7 +134,7 @@ require_once 'includes/header.php'; ?>
<?php
// loop through the $mix['djs'] array and output them in comma separated format
$djs = $mix->get_djs();
$djs = $mix->getDJs();
$djCount = count($djs);
$i = 0;
foreach ($djs as $dj) {
@ -153,7 +153,7 @@ require_once 'includes/header.php'; ?>
</div>
</div>
<?php
$genres = $mix->get_genres();
$genres = $mix->getGenres();
$genreCount = count($genres);
if ($genreCount > 0) {
?>
@ -181,7 +181,7 @@ require_once 'includes/header.php'; ?>
</div><?php } ?>
<?php
$mixshows = $mix->get_mixshow();
$mixshows = $mix->getMixshow();
$mixshowsCount = count($mixshows);
if ($mixshowsCount > 0) {
?>
@ -215,7 +215,7 @@ require_once 'includes/header.php'; ?>
<div class="col-sm-9">
<p class="text-muted mb-0">
<?php
$time = $mix->get_duration();
$time = $mix->getDuration();
// Decide the correct singular or plural term
$hour_text = $time['h'] == 1 ? $locale['hour'] : $locale['hours'];
$minute_text = $time['m'] == 1 ? $locale['minute'] : $locale['minutes'];
@ -245,7 +245,7 @@ require_once 'includes/header.php'; ?>
</div>
</div>
<?php if ($mix->get_recorded() != ""): ?>
<?php if ($mix->getRecorded() != ""): ?>
<hr>
<div class="row">
<div class="col-sm-3">
@ -253,11 +253,11 @@ require_once 'includes/header.php'; ?>
</div>
<div class="col-sm-9">
<p class="text-muted mb-0">
<?php echo $mix->get_recorded(); ?>
<?php echo $mix->getRecorded(); ?>
</div>
</div>
<?php endif; ?>
<?php if ($mix->get_created() != ""): ?>
<?php if ($mix->getCreated() != ""): ?>
<hr>
<div class="row">
<div class="col-sm-3">
@ -265,7 +265,7 @@ require_once 'includes/header.php'; ?>
</div>
<div class="col-sm-9">
<p class="text-muted mb-0">
<?php echo $mix->get_created(); ?>
<?php echo $mix->getCreated(); ?>
</div>
</div>
<?php endif; ?>
@ -276,7 +276,7 @@ require_once 'includes/header.php'; ?>
</div>
<div class="col-sm-9">
<p class="text-muted mb-0">
<?php echo $mix->get_downloads(); ?>
<?php echo $mix->getDownloads(); ?>
</div>
</div>
<hr>
@ -286,10 +286,10 @@ require_once 'includes/header.php'; ?>
</div>
<div class="col-sm-9">
<p class="text-muted mb-0">
<?php echo $mix->get_plays(); ?>
<?php echo $mix->getPlaycount(); ?>
</div>
</div>
<?php if ($mix->get_updated() != ""): ?>
<?php if ($mix->getUpdated() != ""): ?>
<hr>
<div class="row">
<div class="col-sm-3">
@ -297,7 +297,7 @@ require_once 'includes/header.php'; ?>
</div>
<div class="col-sm-9">
<p class="text-muted mb-0">
<?php echo $mix->get_updated(); ?>
<?php echo $mix->getUpdated(); ?>
</div>
</div>
<script>
@ -307,9 +307,9 @@ require_once 'includes/header.php'; ?>
if ('mediaSession' in navigator) {
navigator.mediaSession.metadata = new MediaMetadata({
title: '<?php echo addslashes($mix->get_name()); ?>',
title: '<?php echo addslashes($mix->getName()); ?>',
artist: '<?php
$djs = $mix->get_djs();
$djs = $mix->getDJs();
$djCount = count($djs);
$i = 0;
$djnamelist = [];
@ -319,15 +319,15 @@ require_once 'includes/header.php'; ?>
}
echo addslashes(implode(", ", $djnamelist));?>',
album: '<?php echo addslashes($mix->get_name()); ?>',
album: '<?php echo addslashes($mix->getName()); ?>',
artwork: [
{
src: '<?php echo $mix->get_cover('small'); ?>',
src: '<?php echo $mix->getCover('small'); ?>',
sizes: '96x96',
type: 'image/jpeg'
},
{
src: '<?php echo $mix->get_cover('large'); ?>',
src: '<?php echo $mix->getCover('large'); ?>',
sizes: '128x128',
type: 'image/jpeg'
}
@ -359,12 +359,12 @@ require_once 'includes/header.php'; ?>
</div>
</div>
<?php
if ($mix->get_tracklist() != []) {
if ($mix->getTracklist() != []) {
echo "<div class='card mb-4 bg-body-secondary'>";
echo "<div class='card-body '>";
echo "<p class='mb-4'><span class='text-primary font-italic me-1'>" . $locale['tracklist'] . "</span></p>";
echo "<ul class='list-group list-group-flush rounded-3 bg-body-secondary'>";
$tracklist = $mix->get_tracklist();
$tracklist = $mix->getTracklist();
foreach ($tracklist as $track) {
echo "<li class='list-group-item bg-body-secondary d-flex justify-content-between align-items-center'>";
echo $track;
@ -443,7 +443,7 @@ require_once 'includes/header.php'; ?>
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({mix: '<?php echo $mix->get_id(); ?>'}),
body: JSON.stringify({mix: '<?php echo $mix->getId(); ?>'}),
})
.then(response => response.json())
.then(data => {
@ -461,52 +461,52 @@ require_once 'includes/header.php'; ?>
{
"@context": "https://schema.org",
"@type": "MusicRecording",
"name": "<?php echo $mix->get_name(); ?>",
"name": "<?php echo $mix->getName(); ?>",
"byArtist": {
"@type": "MusicGroup",
"name": "<?php
$djs = $mix->get_djs();
$djs = $mix->getDJs();
echo $djs[0]->getName();
?>",
"image": "<?php echo $djs[0]->getImg(); ?>"
},
"inAlbum": {
"@type": "MusicAlbum",
"name": "<?php echo $mix->get_name(); ?>"
"name": "<?php echo $mix->getName(); ?>"
},
"genre": "<?php
$genre = new Genre($mix->get_genres()[0], $db);
$genre = new Genre($mix->getGenres()[0], $db);
echo $genre->get_name();
?>",
"url": "<?php echo "https://utahsdjs.com/mix/" . $mix->get_slug(); ?>",
"image": "<?php echo $mix->get_cover(); ?>",
"url": "<?php echo "https://utahsdjs.com/mix/" . $mix->getSlug(); ?>",
"image": "<?php echo $mix->getCover(); ?>",
"duration": "<?php echo $mix->get_duration()['S']; ?>",
"duration": "<?php echo $mix->getDuration()['S']; ?>",
<?php
// if recorded is empty, use created; if created is empty, use 2008-01-01;
if (empty($mix->get_recorded())) {
if (empty($mix->get_created())) {
if (empty($mix->getRecorded())) {
if (empty($mix->getCreated())) {
$recorded = '2008-01-01 00:00:00';
} else {
$recorded = $mix->get_created();
$recorded = $mix->getCreated();
}
} else {
$recorded = $mix->get_recorded();
$recorded = $mix->getRecorded();
} ?>
"datePublished": "<?php echo $recorded; ?>",
"description": "<?php
if (empty($mix->get_description())) {
$description = 'Listen to ' . $mix->get_name() . ' on Utah\'s DJs.';
if (empty($mix->getDescription())) {
$description = 'Listen to ' . $mix->getName() . ' on Utah\'s DJs.';
}
echo $mix->get_description(); ?>",
echo $mix->getDescription(); ?>",
"interactionStatistic": {
"@type": "InteractionCounter",
"interactionType": "https://schema.org/ListenAction",
"userInteractionCount": "<?php echo $mix->get_plays() + $mix->get_downloads() ?>",
"url": "<?php echo "https://utahsdjs.com/mix/" . $mix->get_slug() . "/download"; ?>"
"userInteractionCount": "<?php echo $mix->getPlaycount() + $mix->getDownloads() ?>",
"url": "<?php echo "https://utahsdjs.com/mix/" . $mix->getSlug() . "/download"; ?>"
}
}