Browse Source

Improve URL conversion

Sunny 2 years ago
parent
commit
e323483014
1 changed files with 11 additions and 11 deletions
  1. 11 11
      utilities/link.php

+ 11 - 11
utilities/link.php

@@ -22,38 +22,38 @@
 
     if ($host === "bandcamp.com" && $path === "search") {
       $file = "search";
-      $data = http_build_query([
+      $data = [
         "query" => $query["q"]
-      ]);
+      ];
     } elseif (str_ends_with($host, ".bandcamp.com") && !$path) {
       $file = "artist";
-      $data = http_build_query([
+      $data = [
         "name" => explode(".", $host)[0]
-      ]);
+      ];
     } elseif (str_ends_with($host, ".bandcamp.com")) {
       $file = "release";
-      $data = http_build_query([
+      $data = [
         "artist" => explode(".", $host)[0],
         "type" => explode("/", $path)[0],
         "name" => explode("/", $path)[1]
-      ]);
+      ];
     } elseif ($host === "f4.bcbits.com") {
       $file = "image";
-      $data = http_build_query([
+      $data = [
         "file" => basename($link)
-      ]);
+      ];
     } elseif ($host === "t4.bcbits.com") {
       $file = "audio";
-      $data = http_build_query([
+      $data = [
         "directory" => explode("/", $path)[1],
         "format" => explode("/", $path)[2],
         "file" => explode("/", $path)[3],
         "token" => $query["token"]
-      ]);
+      ];
     } else
       return $link;
 
-    return $base . $file . ".php?" . $data;
+    return $base . $file . ".php?" . http_build_query($data);
   };
 
   function prefix_link($link, $parameter) {