mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
fix share url
This commit is contained in:
parent
75e0d7ca80
commit
ff541f7ac1
2 changed files with 13 additions and 3 deletions
|
@ -80,6 +80,16 @@ class Request
|
|||
return static::getHttpHeader('Host') ? rtrim(static::getHttpHeader('Host'), '.') : '';
|
||||
}
|
||||
|
||||
public static function getHostAndProto(): string
|
||||
{
|
||||
return (static::isSSL() ? 'https' : 'http') . '://' . static::getHost();
|
||||
}
|
||||
|
||||
public static function isSSL(): bool
|
||||
{
|
||||
return static::getHeader('HTTPS') || strtolower(static::getHttpHeader('X_FORWARDED_PROTO')) == 'https';
|
||||
}
|
||||
|
||||
public static function getServerName(): string
|
||||
{
|
||||
return static::getHeader('SERVER_NAME');
|
||||
|
@ -105,4 +115,4 @@ class Request
|
|||
|
||||
return preg_match('/(' . join('|', $bots) . ')/i', static::getUserAgent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php $url = urlencode(Request::getHost() . $post->getRelativeUrl()) ?>
|
||||
<?php $url = urlencode(Request::getHostAndProto() . '/' . $post->getRelativeUrl()) ?>
|
||||
<?php $title = urlencode($post->getTitle()) ?>
|
||||
<div class="social-share-buttons">
|
||||
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $url ?>&t=<?php echo $title ?>" title="Share on Facebook" target="_blank">
|
||||
|
@ -18,4 +18,4 @@
|
|||
title="Email a Friend">
|
||||
<span class="icon-fw icon-envelope"></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue