We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit ad5c6c39 authored by Daniel Watkins's avatar Daniel Watkins

Added URL methods for albums.

parent 413568c2
......@@ -81,4 +81,21 @@ class Album {
return $tracks;
}
/**
* Gives the URL for this album
*
* @return A string containing the URL of this album
*/
function getURL() {
global $friendly_urls, $base_url;
$artist_encoded = urlencode(stripslashes($this->artistname));
$album_encoded = urlencode(stripslashes($this->name));
if($friendly_urls) {
return $base_url . "/artist/" . $artist_encoded . "/album/" . $album_encoded;
} else {
return $base_url . "/artist.php?artist=" . $artist_encoded . "&album=" . $album_encoded;
}
}
}
......@@ -123,4 +123,14 @@ class Server {
}
}
static function getAlbumURL($artist, $album) {
global $friendly_urls, $base_url;
$artist_encoded = urlencode(stripslashes($artist));
$album_encoded = urlencode(stripslashes($album));
if($friendly_urls) {
return $base_url . "/artist/" . $artist_encoded . "/album/" . $album_encoded;
} else {
return $base_url . "/artist.php?artist=" . $artist_encoded . "&album=" . $album_encoded;
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment