[core] Support for bridge maintainers' donation URLs (#2102)

This commit is contained in:
Bockiii 2021-06-25 21:45:25 +02:00 committed by GitHub
parent 5598fef3cf
commit ecaae735d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 61 additions and 3 deletions

View file

@ -6,6 +6,8 @@ class HtmlFormat extends FormatAbstract {
$extraInfos = $this->getExtraInfos();
$title = htmlspecialchars($extraInfos['name']);
$uri = htmlspecialchars($extraInfos['uri']);
$donationUri = htmlspecialchars($extraInfos['donationUri']);
$donationsAllowed = Configuration::getConfig('admin', 'donations');
// Dynamically build buttons for all formats (except HTML)
$formatFac = new FormatFactory();
@ -26,6 +28,17 @@ class HtmlFormat extends FormatAbstract {
$links .= $this->buildLink($format, $query, $mime) . PHP_EOL;
}
if($donationUri !== '' && $donationsAllowed) {
$buttons .= '<a href="'
. $donationUri
. '" target="_blank"><button class="highlight">Donate to maintainer</button></a>'
. PHP_EOL;
$links .= '<link href="'
. $donationUri
. ' target="_blank"" title="Donate to Maintainer" rel="alternate">'
. PHP_EOL;
}
$entries = '';
foreach($this->getItems() as $item) {
$entryAuthor = $item->getAuthor() ? '<br /><p class="author">by: ' . $item->getAuthor() . '</p>' : '';