Skip to content

Commit d4e676e

Browse files
committed
Change how donation info is shown
1 parent 508760c commit d4e676e

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

etc/config.sample.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
"vultr": ""
77
},
88
"donations": {
9-
"btc_address": "",
10-
"paypal_url": ""
9+
"btc_address": null,
10+
"email_address": null,
11+
"paypal_url": null,
12+
"user_id": null
1113
},
1214
"maintenance": [
1315
false,

src/templates/Donate.phtml

+25-4
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,45 @@ namespace BNETDocs\Templates;
55
use \CarlBennett\MVC\Libraries\Common;
66
use \CarlBennett\MVC\Libraries\Pair;
77

8+
use \BNETDocs\Libraries\User;
9+
810
$title = 'Donate';
911
$description = 'Donate to BNETDocs to show your support for this project!';
1012

1113
$this->opengraph->attach(new Pair('url', '/donate'));
1214
$this->opengraph->attach(new Pair('type', 'article'));
1315

14-
$btc_address = $this->getContext()->donations->btc_address;
15-
$paypal_url = $this->getContext()->donations->paypal_url;
16+
$btc_address = $this->getContext()->donations->btc_address;
17+
$email_address = $this->getContext()->donations->email_address;
18+
$paypal_url = $this->getContext()->donations->paypal_url;
19+
$user_id = $this->getContext()->donations->user_id;
20+
21+
if (!empty($user_id)) {
22+
$user = new User($user_id);
23+
}
1624

1725
require('./header.inc.phtml');
1826
?>
1927
<article>
2028
<header>Support Us</header>
2129
<section>
22-
<p><ul>
30+
<p>
31+
The following are the methods available for supporting us:
32+
<ul type="circle">
33+
<?php if ($user) { ?>
34+
<li>Contact: <a href="<?=$user->getURI()?>"><?=filter_var($user->getName(), FILTER_SANITIZE_FULL_SPECIAL_CHARS)?></a></li>
35+
<?php } ?>
36+
<?php if (!empty($paypal_url)) { ?>
2337
<li>PayPal: <a href="<?php echo filter_var($paypal_url, FILTER_SANITIZE_FULL_SPECIAL_CHARS); ?>"><?php echo filter_var($paypal_url, FILTER_SANITIZE_FULL_SPECIAL_CHARS); ?></a></li>
38+
<?php } ?>
39+
<?php if (!empty($btc_address)) { ?>
2440
<li>BTC: <code><?php echo $btc_address; ?></code></li>
25-
</ul></p>
41+
<?php } ?>
42+
<?php if (!empty($email_address)) { ?>
43+
<li>Email us: <a href="mailto:<?=rawurlencode($email_address)?>"><?=filter_var($email_address, FILTER_SANITIZE_FULL_SPECIAL_CHARS)?></a></li>
44+
<?php } ?>
45+
</ul>
46+
</p>
2647
</section>
2748
<header>Disclaimer</header>
2849
<section>

0 commit comments

Comments
 (0)