mirror of
https://github.com/Piwigo/Piwigo-Social-Buttons.git
synced 2026-03-28 17:42:48 +01:00
simplyfy code, add noscript fallback for twitter
git-svn-id: http://piwigo.org/svn/extensions/SocialButtons@20406 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -13,7 +13,6 @@ function socialbutt_pinterest($basename, $root_url, &$tpl_vars, &$buttons)
|
||||
|
||||
// config
|
||||
$tpl_vars['PINTEREST'] = $conf['SocialButtons']['pinterest'];
|
||||
$tpl_vars['PINTEREST']['copyright'] = ' (from <a href="'.$root_url.'">'.$conf['gallery_title'].'</a>)';
|
||||
$tpl_vars['PINTEREST']['title'] = $picture['current']['TITLE'];
|
||||
|
||||
if ($conf['SocialButtons']['pinterest']['img_size'] == 'Original')
|
||||
|
||||
@@ -5,22 +5,8 @@ function socialbutt_tumblr($basename, $root_url, &$tpl_vars, &$buttons)
|
||||
{
|
||||
global $conf, $template;
|
||||
|
||||
$tumblr_css = array(
|
||||
'share_1' => 'width:81px; height:20px;',
|
||||
'share_2' => 'width:61px; height:20px;',
|
||||
'share_3' => 'width:129px; height:20px;',
|
||||
'share_4' => 'width:20px; height:20px;',
|
||||
'share_1T' => 'width:81px; height:20px;',
|
||||
'share_2T' => 'width:61px; height:20px;',
|
||||
'share_3T' => 'width:129px; height:20px;',
|
||||
'share_4T' => 'width:20px; height:20px;',
|
||||
);
|
||||
|
||||
|
||||
// config
|
||||
$tpl_vars['TUMBLR'] = $conf['SocialButtons']['tumblr'];
|
||||
$tpl_vars['TUMBLR']['css'] = $tumblr_css[ $conf['SocialButtons']['tumblr']['type'] ];
|
||||
$tpl_vars['TUMBLR']['copyright'] = ' (from <a href="'.$root_url.'">'.$conf['gallery_title'].'</a>)';
|
||||
|
||||
// button on piture page
|
||||
if ($basename == 'picture')
|
||||
|
||||
@@ -117,6 +117,7 @@ function socialbutt_add_button()
|
||||
$tpl_vars = array(
|
||||
'share_url' => $share_url,
|
||||
'position' => $conf['SocialButtons']['position'],
|
||||
'copyright' => ' (from <a href="'.$root_url.'">'.$conf['gallery_title'].'</a>)',
|
||||
);
|
||||
$buttons = array();
|
||||
|
||||
@@ -153,7 +154,10 @@ function socialbutt_add_button()
|
||||
}
|
||||
|
||||
|
||||
$template->assign('SOCIALBUTT', $tpl_vars);
|
||||
$template->assign(array(
|
||||
'SOCIALBUTT' => $tpl_vars,
|
||||
'SOCIALBUTT_PATH' => SOCIALBUTT_PATH,
|
||||
));
|
||||
|
||||
// parse buttons
|
||||
foreach ($buttons as &$button)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{strip}
|
||||
{footer_script}jQuery('body').prepend('<div id="fb-root"></div>');{/footer_script}
|
||||
{combine_script id='facebook_jssdk' load='async' path='https://connect.facebook.net/'|cat:$SOCIALBUTT.FACEBOOK.lang|cat:'/all.js#xfbml=1'}
|
||||
{combine_script id='facebook_jssdk' load='footer' path='https://connect.facebook.net/'|cat:$SOCIALBUTT.FACEBOOK.lang|cat:'/all.js#xfbml=1'}
|
||||
|
||||
{if $SOCIALBUTT.FACEBOOK.layout=='none'}
|
||||
{html_style}{literal}
|
||||
.fb-like span { height: 22px !important; overflow: hidden; margin-right:10px; }
|
||||
.fb-like span { height: 22px !important; overflow: hidden !important; margin-right:10px; }
|
||||
.fb-like iframe { top: -41px; }
|
||||
{/literal}{/html_style}
|
||||
{assign var=facebook_layout value='box_count'}
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
{combine_script id='google_plusone' load='footer' path='https://apis.google.com/js/plusone.js'}
|
||||
|
||||
<script type="text/javascript">window.___gcfg = {ldelim}lang: '{$SOCIALBUTT.GOOGLE.lang}'};</script>
|
||||
<div class="g-plusone" data-size="{$SOCIALBUTT.GOOGLE.size}" data-annotation="{$SOCIALBUTT.GOOGLE.annotation}" data-href="{$SOCIALBUTT.share_url}"></div>
|
||||
<div style="display:inline-block;" class="g-plusone" data-size="{$SOCIALBUTT.GOOGLE.size}" data-annotation="{$SOCIALBUTT.GOOGLE.annotation}" data-href="{$SOCIALBUTT.share_url}"></div>
|
||||
{/strip}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -1,6 +1,6 @@
|
||||
{strip}
|
||||
{combine_script id='pinterest_pinit' path='http://assets.pinterest.com/js/pinit.js'}
|
||||
|
||||
<a href="http://pinterest.com/pin/create/button/?url={$SOCIALBUTT.share_url|urlencode}&media={$SOCIALBUTT.PINTEREST.source|urlencode}&description={$SOCIALBUTT.PINTEREST.title|urlencode}{$SOCIALBUTT.PINTEREST.copyright|urlencode}"
|
||||
<a href="http://pinterest.com/pin/create/button/?url={$SOCIALBUTT.share_url|urlencode}&media={$SOCIALBUTT.PINTEREST.source|urlencode}&description={$SOCIALBUTT.PINTEREST.title|cat:$SOCIALBUTT.copyright|urlencode}"
|
||||
class="pin-it-button" count-layout="{$SOCIALBUTT.PINTEREST.layout}"><img border="0" src="http://assets.pinterest.com/images/PinExt.png" title="Pin It"/></a>
|
||||
{/strip}
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
{if $SOCIALBUTT.TUMBLR.mode=='photo'}
|
||||
{capture assign="inline_tags"}{foreach from=$related_tags item=tag name=tag_loop}{if !$smarty.foreach.tag_loop.first},{/if}{$tag.name}{/foreach}{/capture}
|
||||
<a href="http://www.tumblr.com/share/photo?source={$SOCIALBUTT.TUMBLR.source|urlencode}&caption={$SOCIALBUTT.TUMBLR.title|urlencode}{$SOCIALBUTT.TUMBLR.copyright|urlencode}&clickthru={$SOCIALBUTT.share_url|urlencode}&tags={$inline_tags|urlencode}"
|
||||
<a href="http://www.tumblr.com/share/photo?source={$SOCIALBUTT.TUMBLR.source|urlencode}&caption={$SOCIALBUTT.TUMBLR.title|cat:$SOCIALBUTT.copyright|urlencode}&clickthru={$SOCIALBUTT.share_url|urlencode}&tags={$inline_tags|urlencode}"
|
||||
{else}
|
||||
<a href="http://www.tumblr.com/share/link?url={$SOCIALBUTT.share_url|urlencode}&name={$SOCIALBUTT.TUMBLR.title|urlencode}&description={$CONTENT_DESCRIPTION|urlencode}{$SOCIALBUTT.TUMBLR.copyright|urlencode}"
|
||||
<a href="http://www.tumblr.com/share/link?url={$SOCIALBUTT.share_url|urlencode}&name={$SOCIALBUTT.TUMBLR.title|urlencode}&description={$CONTENT_DESCRIPTION|cat:$SOCIALBUTT.copyright|urlencode}"
|
||||
{/if}
|
||||
style="display:inline-block;text-indent:-9999px;overflow:hidden;{$SOCIALBUTT.TUMBLR.css}background:url('http://platform.tumblr.com/v1/{$SOCIALBUTT.TUMBLR.type}.png') top left no-repeat transparent;">Tumblr</a>
|
||||
><img src="http://platform.tumblr.com/v1/{$SOCIALBUTT.TUMBLR.type}.png" alt="Share on Tumblr"></a>
|
||||
{/strip}
|
||||
@@ -1,7 +1,8 @@
|
||||
{strip}
|
||||
{combine_script id='twitter_widgets' load='footer' path='http://platform.twitter.com/widgets.js'}
|
||||
|
||||
<a href="https://twitter.com/share" class="twitter-share-button"
|
||||
<a href="https://twitter.com/share?url={$SOCIALBUTT.share_url}&text={$PAGE_TITLE|cat:' | '|cat:$GALLERY_TITLE}{if $SOCIALBUTT.TWITTER.via}&via={$SOCIALBUTT.TWITTER.via}{/if}"
|
||||
data-url="{$SOCIALBUTT.share_url}" data-lang="{$SOCIALBUTT.TWITTER.lang}" data-via="{$SOCIALBUTT.TWITTER.via}"
|
||||
data-size="{$SOCIALBUTT.TWITTER.size}" data-count="{$SOCIALBUTT.TWITTER.count}">Tweet</a>
|
||||
data-size="{$SOCIALBUTT.TWITTER.size}" data-count="{$SOCIALBUTT.TWITTER.count}" class="twitter-share-button">
|
||||
<img src="{$ROOT_PATH}{$SOCIALBUTT_PATH}template/images/twitter_{$SOCIALBUTT.TWITTER.size}.png" alt="Share on Twitter"></a>
|
||||
{/strip}
|
||||
Reference in New Issue
Block a user