[Scummvm-git-logs] scummvm-web master -> 54e15f90c26c4f01745f1c7878c1d9a00ac5c351
lotharsm
noreply at scummvm.org
Sun May 15 10:29:47 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-web' repo located at https://github.com/scummvm/scummvm-web .
Summary:
54e15f90c2 WEB: Adding "Available At" info to game compatibility pages
Commit: 54e15f90c26c4f01745f1c7878c1d9a00ac5c351
https://github.com/scummvm/scummvm-web/commit/54e15f90c26c4f01745f1c7878c1d9a00ac5c351
Author: Thunderforge (wjherrmann at gmail.com)
Date: 2022-05-15T12:29:44+02:00
Commit Message:
WEB: Adding "Available At" info to game compatibility pages
This provides GOG.com and Steam links. In the future, we can expand this to additional websites, including free downloads from the developer sites.
Changed paths:
include/Constants.php
include/OrmObjects/Compatibility.php
schema.xml
diff --git a/include/Constants.php b/include/Constants.php
index f70ed19d..fa8478a4 100644
--- a/include/Constants.php
+++ b/include/Constants.php
@@ -32,6 +32,12 @@ class Constants
}
define('URL_BASE', $url);
+ /* External URLs */
+ define('GOG_URL_PREFIX', "https://www.gog.com/game/");
+ // ScummVM affiliate id
+ define('GOG_URL_SUFFIX', '?pp=22d200f8670dbdb3e253a90eee5098477c95c23d');
+ define('STEAM_URL_PREFIX', 'https://store.steampowered.com/app/');
+
/* Paths */
define('DIR_BASE', __DIR__ . '/..');
define('DIR_DATA', DIR_BASE . '/data');
diff --git a/include/OrmObjects/Compatibility.php b/include/OrmObjects/Compatibility.php
index 91e31eed..93c922ed 100644
--- a/include/OrmObjects/Compatibility.php
+++ b/include/OrmObjects/Compatibility.php
@@ -69,6 +69,20 @@ class Compatibility extends BaseCompatibility
$notes .= join("\n", $links);
}
+ $availableSites = [];
+ $gogId = $this->getGame()->getGogId();
+ if ($gogId) {
+ $availableSites[] = "- [GOG.com](" . GOG_URL_PREFIX . $gogId . GOG_URL_SUFFIX . ") (affiliate link)";
+ }
+ $steamId = $this->getGame()->getSteamId();
+ if ($steamId) {
+ $availableSites[] = "- [Steam](" . STEAM_URL_PREFIX . $steamId. ")";
+ }
+ if ($availableSites) {
+ $notes .= "\n\n### Available At\n";
+ $notes .= join("\n", $availableSites);
+ }
+
$config = \HTMLPurifier_Config::createDefault();
$purifier = new \HTMLPurifier($config);
$parsedown = new \Parsedown();
diff --git a/schema.xml b/schema.xml
index cef08646..073feb6a 100644
--- a/schema.xml
+++ b/schema.xml
@@ -10,6 +10,8 @@
<column name="engine_id" type="varchar" size="24" required="true"/>
<column name="company_id" type="varchar" size="24" required="true"/>
<column name="moby_id" type="integer"/>
+ <column name="steam_id" type="integer"/>
+ <column name="gog_id" type="varchar"/>
<column name="wikipedia_page" type="varchar"/>
<column name="series_id" type="varchar"/>
<foreign-key foreignTable="engine" onDelete="CASCADE">
More information about the Scummvm-git-logs
mailing list