663fde3909
Full source for loveandrosary.com: slide-based Rosary/novena/Divine Mercy Chaplet presentation tool with multi-user roles, SVG bead ring, audio uploads, donate strip, and public session profiles. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
49 lines
1.7 KiB
PHP
49 lines
1.7 KiB
PHP
<?php
|
|
/**
|
|
* includes/donate.php — Renders the public donate strip if enabled.
|
|
* Include on any public page: require_once __DIR__ . '/includes/donate.php';
|
|
* Then call: render_donate_strip();
|
|
*/
|
|
|
|
function render_donate_strip(): void {
|
|
if (!get_setting('donate_enabled', '0')) return;
|
|
|
|
$type = get_setting('donate_type', 'custom');
|
|
$handle = trim(get_setting('donate_handle', ''));
|
|
$label = trim(get_setting('donate_label', ''));
|
|
|
|
if ($handle === '') return;
|
|
|
|
// Build URL and default label by type
|
|
switch ($type) {
|
|
case 'paypal':
|
|
$url = 'https://paypal.me/' . rawurlencode(ltrim($handle, '@'));
|
|
$icon = '💛'; // 💛
|
|
$label = $label ?: 'Support via PayPal';
|
|
break;
|
|
case 'venmo':
|
|
$url = 'https://venmo.com/u/' . rawurlencode(ltrim($handle, '@'));
|
|
$icon = '💸'; // 💸
|
|
$label = $label ?: '@' . ltrim($handle, '@') . ' on Venmo';
|
|
break;
|
|
case 'buymeacoffee':
|
|
$url = 'https://buymeacoffee.com/' . rawurlencode(ltrim($handle, '@'));
|
|
$icon = '☕'; // ☕
|
|
$label = $label ?: 'Buy Me a Coffee';
|
|
break;
|
|
default: // custom
|
|
$url = $handle; // full URL stored in handle field for custom
|
|
$icon = '❤'; // ❤
|
|
$label = $label ?: 'Support This Ministry';
|
|
break;
|
|
}
|
|
?>
|
|
<div class="donate-strip">
|
|
<span class="donate-strip-text">Help keep this site running</span>
|
|
<a href="<?= htmlspecialchars($url) ?>" target="_blank" rel="noopener" class="donate-strip-link">
|
|
<?= $icon ?> <?= htmlspecialchars($label) ?>
|
|
</a>
|
|
</div>
|
|
<?php
|
|
}
|