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

Commit dc1c777a authored by Mike Sheldon's avatar Mike Sheldon

Add function for creating tag urls based on url rewritting availability

parent ec8f6ea3
...@@ -105,8 +105,8 @@ class ArtistXML { ...@@ -105,8 +105,8 @@ class ArtistXML {
$tags = $artist->getTopTags(); $tags = $artist->getTopTags();
foreach($tags as $tag) { foreach($tags as $tag) {
$tag_node = $root->addChild('tag', null); $tag_node = $root->addChild('tag', null);
$tag_node->addChild('name', $tag); $tag_node->addChild('name', repamp($tag));
$tag_node->addChild('url', repamp($base_url . '/tag/' . $tag)); $tag_node->addChild('url', Server::getTagURL($tag));
} }
return $xml; return $xml;
......
...@@ -39,8 +39,8 @@ class TrackXML { ...@@ -39,8 +39,8 @@ class TrackXML {
foreach($tags as &$tag) { foreach($tags as &$tag) {
$tag_node = $root->addChild('tag', null); $tag_node = $root->addChild('tag', null);
$tag_node->addChild('name', repamp($tag['tag'])); $tag_node->addChild('name', repamp($tag['tag']));
$tag_node->addChild('count', repamp($tag['freq'])); $tag_node->addChild('count', $tag['freq']);
$tag_node->addChild('url', repamp($base_url . '/tag/' . $tag['tag'])); $tag_node->addChild('url', Server::getTagURL($row['tag']));
} }
return $xml; return $xml;
...@@ -61,7 +61,7 @@ class TrackXML { ...@@ -61,7 +61,7 @@ class TrackXML {
foreach($tags as $tag) { foreach($tags as $tag) {
$tag_node = $root->addChild('tag', null); $tag_node = $root->addChild('tag', null);
$tag_node->addChild('name', repamp($tag)); $tag_node->addChild('name', repamp($tag));
$tag_node->addChild('url', repamp($base_url . '/tag/' . $tag['tag'])); $tag_node->addChild('url', Server::getTagURL($row['tag']));
} }
return $xml; return $xml;
......
...@@ -157,7 +157,7 @@ class UserXML { ...@@ -157,7 +157,7 @@ class UserXML {
$tag = $root->addChild('tag', null); $tag = $root->addChild('tag', null);
$tag->addChild('name', repamp($row['tag'])); $tag->addChild('name', repamp($row['tag']));
$tag->addChild('count', repamp($row['freq'])); $tag->addChild('count', repamp($row['freq']));
$tag->addChild('url', repamp($base_url . '/tag/' . $row['tag'])); $tag->addChild('url', Server::getTagURL($row['tag']));
} }
return $xml; return $xml;
......
...@@ -349,6 +349,15 @@ class Server { ...@@ -349,6 +349,15 @@ class Server {
} }
} }
static function getTagURL($tag) {
global $friendly_urls, $base_url;
if ($friendly_urls) {
return $base_url . '/tag/' . rawurlencode($tag);
} else {
return $base_url . '/tag.php?tag=' . rawurlencode($tag);
}
}
static function getLocationDetails($name) { static function getLocationDetails($name) {
global $adodb; global $adodb;
......
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