Siteβ―Builder
Editing:
share.php
writable 0666
<?php /***************************************************************** * share_bar.php Β· BestDealOn Β· Augβ2025 * ------------------------------------------------------------- * Ultraβcompact share bar (26β―px tall) β 4 networks, no dupes. * Drop into your page with: * * <?php require_once $_SERVER['DOCUMENT_ROOT'].'/includes/share_bar.php'; ?> * *****************************************************************/ declare(strict_types=1); /* ---------- page URL + title ---------------------------------- */ $shareURL = urlencode( (($_SERVER['HTTPS']??'')==='on' ? 'https://' : 'http://'). $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] ); $shareTitle = urlencode( $_SERVER['PAGE_TITLE'] ?? 'BestDealOn' ); /* ---------- share button definitions -------------------------- */ $buttons = [ [ // Facebook 'url'=>"https://www.facebook.com/sharer/sharer.php?u={$shareURL}", 'aria'=>'Share on Facebook', 'svg'=>'<path d="M14 0h-4a6 6 0 0 0-6 6v4H0v4h4v10h4V14h4l1-4H8V6a2 2 0 0 1 2-2h4z"/>' ], [ // X / Twitter 'url'=>"https://twitter.com/intent/tweet?url={$shareURL}&text={$shareTitle}", 'aria'=>'Share on XΒ /Β Twitter', 'svg'=>'<path d="M24 4.6a9.7 9.7 0 0 1-2.8.8 4.9 4.9 0 0 0 2.1-2.7 9.8 9.8 0 0 1-3.1 1.2A4.8 4.8 0 0 0 11.7 8a13.7 13.7 0 0 1-10-5 4.8 4.8 0 0 0 1.5 6.4A4.8 4.8 0 0 1 .9 8v.1a4.8 4.8 0 0 0 3.8 4.7 4.8 4.8 0 0 1-2.2.1 4.8 4.8 0 0 0 4.5 3.4A9.7 9.7 0 0 1 0 19.5a13.7 13.7 0 0 0 7.4 2.2c8.9 0 13.8-7.4 13.8-13.8l-.1-.6A10 10 0 0 0 24 4.6z"/>' ], [ // LinkedIn 'url'=>"https://www.linkedin.com/sharing/share-offsite/?url={$shareURL}", 'aria'=>'Share on LinkedIn', 'svg'=>'<path d="M4.98 3.5A2.5 2.5 0 1 1 0 3.5a2.5 2.5 0 0 1 4.98 0zM.2 8.9h4.8V24H.2V8.9zM15.5 8.6c-2.3 0-3.3 1.3-3.8 2.2V8.9H7v15.1h4.8v-8c0-2.1.4-4.1 2.9-4.1 2.4 0 2.5 2.3 2.5 4.2V24H22V15c0-4.7-1-8.4-6.5-8.4z"/>' ], [ // Reddit 'url'=>"https://www.reddit.com/submit?url={$shareURL}&title={$shareTitle}", 'aria'=>'Share on Reddit', 'svg'=>'<circle cx="12" cy="12" r="11"/><circle cx="8.6" cy="12.3" r="2.1" fill="#fff"/><circle cx="15.4" cy="12.3" r="2.1" fill="#fff"/><path d="M8 16.9c1 .6 2.2.8 4 .8s3-.2 4-.8" fill="none" stroke="#fff" stroke-width="2"/><circle cx="19.4" cy="4.6" r="2.4"/><path d="M17 5l-3.1-.7-.8 3.8" fill="none" stroke="#fff" stroke-width="2"/>' ], /* ---------- OPTIONAL FOLLOW ICONS ----------- * Uncomment the three lines below if you also * want static βfollowβ links after the share * buttons. Replace the URLs as needed. ------------------------------------------------ ['url'=>'https://facebook.com/BestDealOn','aria'=>'Follow us on Facebook','svg'=>'<path d="M17 0h-3.3C9.6 0 7.4 2.3 7.4 6v3H5v4h2.4v11h4.3V13h3.1l.6-4h-3.7V6c0-1 .2-1.4 1.3-1.4H17V0z"/>'], ['url'=>'https://twitter.com/BestDealOn','aria'=>'Follow us on XΒ /Β Twitter','svg'=>'<path d="M24 4.6a9.7 9.7 0 0 1-2.8.8 4.9 4.9 0 0 0 2.1-2.7 9.8 9.8 0 0 1-3.1 1.2A4.8 4.8 0 0 0 11.7 8a13.7 13.7 0 0 1-10-5 4.8 4.8 0 0 0 1.5 6.4A4.8 4.8 0 0 1 .9 8v.1a4.8 4.8 0 0 0 3.8 4.7 4.8 4.8 0 0 1-2.2.1 4.8 4.8 0 0 0 4.5 3.4A9.7 9.7 0 0 1 0 19.5a13.7 13.7 0 0 0 7.4 2.2c8.9 0 13.8-7.4 13.8-13.8l-.1-.6A10 10 0 0 0 24 4.6z"/>'], ['url'=>'https://www.reddit.com/r/BestDealOn','aria'=>'Join us on Reddit','svg'=>'<circle cx="12" cy="12" r="11"/><circle cx="8.6" cy="12.3" r="2.1" fill="#fff"/><circle cx="15.4" cy="12.3" r="2.1" fill="#fff"/><path d="M8 16.9c1 .6 2.2.8 4 .8s3-.2 4-.8" fill="none" stroke="#fff" stroke-width="2"/><circle cx="19.4" cy="4.6" r="2.4"/><path d="M17 5l-3.1-.7-.8 3.8" fill="none" stroke="#fff" stroke-width="2"/>'], */ ]; ?> <!-- ============ SHARE BAR ============ --> <style> .share-bar { display: flex; justify-content: center; gap: .35rem; align-items: center; background: #f7f7f9; padding: 3px 6px; border: 1px solid #e2e4e9; border-radius: 8px; height: 26px; font-size: 0; } .share-bar a { display: inline-flex; width: 22px; height: 22px; justify-content: center; align-items: center; border-radius: 4px; text-decoration: none; } .share-bar a:hover { background: #e9ebf1; } .share-bar svg { width: 16px; height: 16px; fill: #444; } </style> <nav class="share-bar" role="navigation" aria-label="Share"> <?php foreach ($buttons as $b): ?> <a href="<?=htmlspecialchars($b['url'],ENT_QUOTES,'UTF-8')?>" target="_blank" rel="noopener" aria-label="<?=$b['aria']?>"> <svg viewBox="0 0 24 24"><?=$b['svg']?></svg> </a> <?php endforeach; ?> </nav> <!-- END share_bar.php -->
Save changes
Create folder
writable 0777
Create
Cancel