Use developer URL in game details page and all games list
authorChristian Weiske <cweiske@cweiske.de>
Mon, 1 Jun 2020 19:54:04 +0000 (21:54 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 1 Jun 2020 19:54:04 +0000 (21:54 +0200)
bin/build-html.php
bin/import-game-data.php
data/templates/allgames.tpl.php
data/templates/game.tpl.php

index 18e25e5..c00f811 100755 (executable)
@@ -62,6 +62,7 @@ function renderAllGamesList($detailsFiles)
             'title'        => $json->title,
             'genres'       => $json->genres,
             'developer'    => $json->developer->name,
+            'developerUrl' => $json->stouyapi->{'developer-url'} ?? null,
             'suggestedAge' => $json->suggestedAge,
             'apkVersion'   => $json->version->number,
             'apkTimestamp' => $json->version->publishedAt,
@@ -168,6 +169,7 @@ function renderGameFile($gameDataFile)
     */
 
     $internetArchiveUrl = $json->stouyapi->{'internet-archive'} ?? null;
+    $developerUrl       = $json->stouyapi->{'developer-url'} ?? null;
 
     $pushUrl = $GLOBALS['pushToMyOuyaUrl']
         . '?game=' . urlencode($json->apk->package);
index cfd1630..e90ccc9 100755 (executable)
@@ -517,6 +517,7 @@ function buildDetails($game)
 
         'stouyapi' => [
             'internet-archive' => $iaUrl,
+            'developer-url'    => $game->developer->website ?? null,
         ]
     ];
 }
index 613caad..ded0ebd 100644 (file)
         <?= htmlspecialchars($game->title) ?>
        </a>
       </td>
-      <td><?= htmlspecialchars($game->developer) ?></td>
+      <td>
+       <?php if ($game->developerUrl): ?>
+        <a href="<?= htmlspecialchars($game->developerUrl) ?>"><?= htmlspecialchars($game->developer) ?></a>
+       <?php else: ?>
+        <?= htmlspecialchars($game->developer) ?>
+       <?php endif ?>
+      </td>
       <td><?= htmlspecialchars($game->suggestedAge) ?></td>
       <td><?= htmlspecialchars(implode(', ', $game->players)) ?></td>
       <td><?= htmlspecialchars(implode(', ', $game->genres)) ?></td>
index 621049c..4f7779e 100644 (file)
@@ -23,8 +23,8 @@
 
     <dt>Developer</dt>
     <dd class="company">
-     <?php if ($appsJson->app->website): ?>
-      <a href="<?= htmlspecialchars($appsJson->app->website) ?>"><?= htmlspecialchars($json->developer->name) ?></a>
+     <?php if ($developerUrl): ?>
+      <a href="<?= htmlspecialchars($developerUrl) ?>"><?= htmlspecialchars($json->developer->name) ?></a>
      <?php else: ?>
       <?= htmlspecialchars($json->developer->name) ?>
      <?php endif ?>
    <?php endif ?>
    <?php if ($internetArchiveUrl): ?>
    <div>
-    <a href="<?= $internetArchiveUrl ?>">Internet Archive page</a>
+    <a href="<?= $internetArchiveUrl ?>">Internet Archive</a>
+   </div>
+   <?php endif ?>
+   <?php if ($appsJson->app->website): ?>
+   <div>
+    <a href="<?= $appsJson->app->website ?>">Game website</a>
    </div>
    <?php endif ?>
    <div>