Site Builder
Editing:
modules-social-linkkks.php
writable 0666
<?php /************************************************************************** * SOCIAL LINKS MODULE – Gold‑card, no external assets * ---------------------------------------------------------------------- * • Reads $profile (array) or falls back to ../../profile.json * • Renders three colour‑coded groups: Video, Podcasts, Social * • All icons are Unicode emoji so no CDN stylesheet is needed **************************************************************************/ /* 1) Load profile only if caller hasn’t passed it in */ if (!isset($profile) || !is_array($profile)) { $json = dirname(__DIR__, 2) . '/profile.json'; $profile = is_readable($json) ? json_decode(file_get_contents($json), true) : []; } /* 2) Vars */ $name = $profile['display_name'] ?? $profile['handle'] ?? 'Profile'; $channels = $profile['channels'] ?? []; /* 3) Nothing to show? */ if (!$channels) return; /* 4) Badge helper (emoji instead of Font‑Awesome) */ function sl_badge(string $label, string $url, string $cls): string { $icon = match (strtolower($label)) { /* video */ 'youtube' => '▶️', 'rumble' => '🎬', 'odysee' => '🎥', /* podcast */ 'spotify' => '🎧', 'apple' => '🍎', 'rss' => '📡', /* social */ 'twitter' => '🐦', 'tiktok' => '🎵', 'instagram' => '📸', 'facebook' => '📘', 'linkedin' => '💼', 'patreon' => '❤️', default => '🔗' }; $safe = htmlspecialchars($label); $href = htmlspecialchars($url); return "<a class=\"sl-badge $cls\" href=\"$href\" target=\"_blank\" rel=\"noopener\"> <span class=\"sl-ico\">$icon</span> $safe </a>"; } /* 5) Group helper */ function sl_group(string $title, array $arr, string $cls): string { if (!$arr) return ''; $html = "<h3 class=\"sl-sub\">$title</h3>\n"; foreach ($arr as $lbl => $u) { if (!$u) continue; $html .= sl_badge($lbl, $u, $cls) . "\n"; } return $html; } ?> <!-- ===== SOCIAL LINKS (gold‑outline card) ===== --> <section class="sl-shell"> <div class="sl-card"> <h2>Follow <?= htmlspecialchars($name) ?></h2> <?= sl_group('Video Channels', $channels['video'] ?? [], 'vid') ?> <?= sl_group('Podcasts', $channels['podcast'] ?? [], 'pod') ?> <?= sl_group('Social', $channels['social'] ?? [], 'soc') ?> </div> </section> <style> /* ---------- wrapper + card ---------- */ .sl-shell{ margin:2.6rem auto; max-width:clamp(280px,90vw,720px); /* same rule as other cards */ width:100%; font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif; } .sl-card{ background:#fff; padding:1.8rem 1.6rem; border:3.5px solid #ffb63b; /* gold outline */ border-radius:27px; box-shadow:0 8px 26px rgba(0,0,0,.06); text-align:left; } /* headings */ .sl-card h2{margin:0 0 1rem;font-size:1.35rem;font-weight:700;color:#102a66} .sl-sub {margin:1.1em 0 .4em;font-size:1.05rem;font-weight:600;color:#555} /* badges */ .sl-badge{ display:inline-flex;align-items:center;gap:.4em; margin:.25em .33em;padding:.34em .8em .28em; border-radius:16px;font-size:.88rem;font-weight:600; text-decoration:none;color:#fff; transition:opacity .15s;box-shadow:0 1px 4px rgba(0,0,0,.08) } .sl-ico{font-size:1em;line-height:1} /* colour coding */ .vid{background:#FF5252;} /* video → red */ .pod{background:#A259FF;} /* podcast → purple */ .soc{background:#4285F4;} /* social → blue */ .sl-badge:hover{opacity:.85} @media(max-width:480px){ .sl-badge{font-size:.9rem} } </style>
Save changes
Create folder
writable 0777
Create
Cancel