diff --git a/admin.php b/admin.php index 5df4990..6c2bd93 100644 --- a/admin.php +++ b/admin.php @@ -11,6 +11,7 @@ if (isset($_POST['submit'])) $conf['SocialButtons'] = array( 'position' => $_POST['position'], 'on_index' => get_boolean($_POST['on_index']), + 'light' => isset($_POST['light']), 'twitter' => array( 'enabled' => isset($_POST['twitter']['enabled']), 'size' => $_POST['twitter']['size'], diff --git a/include/install.inc.php b/include/install.inc.php index 49ae4f9..55196ca 100644 --- a/include/install.inc.php +++ b/include/install.inc.php @@ -10,6 +10,7 @@ function socialbutt_install() $default_config = array( 'position' => 'toolbar', 'on_index' => true, + 'light' => false, 'twitter' => array( 'enabled' => true, 'size' => 'small', @@ -41,21 +42,21 @@ function socialbutt_install() if (isset($conf['TumblrShare'])) { $temp = is_string($conf['TumblrShare']) ? unserialize($conf['TumblrShare']) : $conf['TumblrShare']; - $default_config['tumblr']['type'] = $temp['type']; - $default_config['tumblr']['img_size'] = $temp['img_size']; + if (!empty($temp['type'])) $default_config['tumblr']['type'] = $temp['type']; + if (!empty($temp['img_size'])) $default_config['tumblr']['img_size'] = $temp['img_size']; } if (isset($conf['TweetThis'])) { $temp = is_string($conf['TweetThis']) ? unserialize($conf['TweetThis']) : $conf['TweetThis']; - $default_config['twitter']['size'] = $temp['size']; - $default_config['twitter']['count'] = $temp['count'] ? 'bubble' : 'none'; - $default_config['twitter']['via'] = $temp['via']; + if (!empty($temp['type'])) $default_config['twitter']['size'] = $temp['size']; + if (!empty($temp['count'])) $default_config['twitter']['count'] = $temp['count'] ? 'bubble' : 'none'; + if (!empty($temp['via'])) $default_config['twitter']['via'] = $temp['via']; } if (isset($conf['GooglePlusOne'])) { $temp = is_string($conf['GooglePlusOne']) ? unserialize($conf['GooglePlusOne']) : $conf['GooglePlusOne']; - $default_config['google']['size'] = $temp['size']; - $default_config['google']['annotation'] = $temp['annotation']; + if (!empty($temp['size'])) $default_config['google']['size'] = $temp['size']; + if (!empty($temp['annotation'])) $default_config['google']['annotation'] = $temp['annotation']; } $conf['SocialButtons'] = serialize($default_config); @@ -63,7 +64,7 @@ function socialbutt_install() } else { - $new_conf = unserialize($conf['SocialButtons']); + $new_conf = is_string($conf['SocialButtons']) ? unserialize($conf['SocialButtons']) : $conf['SocialButtons']; if (empty($new_conf['pinterest'])) { @@ -73,6 +74,7 @@ function socialbutt_install() 'img_size' => 'Original', ); } + if (!isset($new_conf['on_index'])) { $new_conf['on_index'] = true; @@ -83,6 +85,11 @@ function socialbutt_install() $new_conf['facebook']['layout'] = 'button_count'; } + if (!isset($new_conf['light'])) + { + $new_conf['light'] = false; + } + $conf['SocialButtons'] = serialize($new_conf); conf_update_param('SocialButtons', $conf['SocialButtons']); } diff --git a/include/pinterest.inc.php b/include/pinterest.inc.php index d0b1f9e..b9a40e1 100644 --- a/include/pinterest.inc.php +++ b/include/pinterest.inc.php @@ -3,7 +3,7 @@ defined('SOCIALBUTT_PATH') or die('Hacking attempt!'); function socialbutt_pinterest($basename, $root_url, &$tpl_vars, &$buttons) { - // only on piture page + // only on picture page if ($basename != 'picture') { return; diff --git a/include/twitter.inc.php b/include/twitter.inc.php index af03b12..5f8134f 100644 --- a/include/twitter.inc.php +++ b/include/twitter.inc.php @@ -5,7 +5,7 @@ function socialbutt_twitter($basename, $root_url, &$tpl_vars, &$buttons) { global $conf, $template, $user; - $twitter_langs = array( + $twitter_langs = array( 'fr','en','ar','ja','es','de','it','id','pt','ko','tr','ru','nl','fil','msa','zh-tw', 'zh-cn','hi','no','sv','fi','da','pl','hu','fa','he','ur','th','uk','ca','el','eu','cs' ); diff --git a/language/en_UK/plugin.lang.php b/language/en_UK/plugin.lang.php index c215785..3c19e7b 100644 --- a/language/en_UK/plugin.lang.php +++ b/language/en_UK/plugin.lang.php @@ -12,4 +12,6 @@ $lang['Top bubble'] = 'Top bubble'; $lang['Display buttons'] = 'Display buttons'; $lang['on photo and album'] = 'on photo and album'; $lang['only on photo'] = 'only on photo'; +$lang['Light mode'] = 'Light mode'; +$lang['When light mode is activated no external script is loaded, it speeds up the load of the page and disables user tracking but also disables annotations and in-page popups.'] = 'When light mode is activated no external script is loaded, it speeds up the load of the page and disables user tracking but also disables annotations and in-page popups.'; ?> \ No newline at end of file diff --git a/language/fr_FR/plugin.lang.php b/language/fr_FR/plugin.lang.php index 75514fd..dc911fb 100644 --- a/language/fr_FR/plugin.lang.php +++ b/language/fr_FR/plugin.lang.php @@ -14,4 +14,6 @@ $lang['Top bubble'] = 'Bulle en haut'; $lang['Display buttons'] = 'Afficher les boutons'; $lang['on photo and album'] = 'sur les photos et les albums'; $lang['only on photo'] = 'uniquement sur les photos'; +$lang['Light mode'] = 'Mode léger'; +$lang['When light mode is activated no external script is loaded, it speeds up the load of the page and disables user tracking but also disables annotations and in-page popups.'] = 'Quand le mode léger est activé aucun script externe n\'est chargé, celà accélère le chargement de la page est désactive le tracking des utilisateurs mais désactive aussi les annotations et les popups détaillés.'; ?> \ No newline at end of file diff --git a/main.inc.php b/main.inc.php index 1716e90..f4d3ef7 100644 --- a/main.inc.php +++ b/main.inc.php @@ -118,10 +118,10 @@ function socialbutt_add_button() } - define('SOCIALBUTT_POSITION', $conf['SocialButtons']['position']); $tpl_vars = array( 'share_url' => $share_url, 'position' => $conf['SocialButtons']['position'], + 'light' => $conf['SocialButtons']['light'], 'copyright' => '(from '.$conf['gallery_title'].')', ); $buttons = array(); @@ -176,16 +176,19 @@ function socialbutt_add_button() switch ($conf['SocialButtons']['position']) { case 'index': - foreach ($buttons as $button) { - $template->add_index_button('
  • '.$button.'
  • ', 100); + foreach ($buttons as $button) + { + $template->add_index_button($button, 100); } break; case 'toolbar': - foreach ($buttons as $button) { + foreach ($buttons as $button) + { $template->add_picture_button($button, 100); } break; default; + define('SOCIALBUTT_POSITION', $conf['SocialButtons']['position']); $template->assign('SOCIALBUTT_BUTTONS', $buttons); $template->set_prefilter('picture', 'socialbutt_add_button_prefilter'); } @@ -197,12 +200,12 @@ function socialbutt_add_button_prefilter($content) { case 'top': $search = '
    '; - $add = '
    {foreach from=$SOCIALBUTT_BUTTONS item=BUTTON}{$BUTTON} {/foreach}
    '; + $add = '
    {foreach from=$SOCIALBUTT_BUTTONS item=BUTTON}{$BUTTON} {/foreach}
    '; break; case 'bottom': $search = '{$ELEMENT_CONTENT}'; - $add = '
    {foreach from=$SOCIALBUTT_BUTTONS item=BUTTON}{$BUTTON} {/foreach}
    '; + $add = '
    {foreach from=$SOCIALBUTT_BUTTONS item=BUTTON}{$BUTTON} {/foreach}
    '; break; } diff --git a/maintain.inc.php b/maintain.inc.php index e046803..32a5be1 100644 --- a/maintain.inc.php +++ b/maintain.inc.php @@ -23,7 +23,10 @@ function plugin_activate() function plugin_uninstall() { - pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "SocialButtons" LIMIT 1;'); + global $conf; + + pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "SocialButtons";'); + unset($conf['SocialButtons']); } ?> \ No newline at end of file diff --git a/template/admin.tpl b/template/admin.tpl index 639930a..ce95864 100644 --- a/template/admin.tpl +++ b/template/admin.tpl @@ -2,11 +2,15 @@ {html_style}{literal} .socialbutt.disabled thead img { + -webkit-filter: grayscale(100%); /* Chrome 19+ & Safari 6+ */ filter: url("data:image/svg+xml;utf8,#grayscale"); /* Firefox 10+ */ filter: gray; /* IE6-9 */ - -webkit-filter: grayscale(100%); /* Chrome 19+ & Safari 6+ */ } -{/literal}{/html_style} +{/literal} +{if $light} +.not-light {ldelim} display:none; } +{/if} +{/html_style} {footer_script}{literal} jQuery("input.enable").change(function() { @@ -22,6 +26,23 @@ jQuery("input.enable").change(function() { $parent.removeClass('disabled'); } }); + +jQuery("input#light_mode").on('change', function() { + if ($(this).is(":checked")) { + $('.not-light').hide(); + } + else { + $('.not-light').show(); + } +}); + +jQuery(".showInfo").tipTip({ + delay: 0, + fadeIn: 200, + fadeOut: 200, + maxWidth: '300px', + defaultPosition: 'bottom' +}); {/literal}{/footer_script} @@ -53,6 +74,15 @@ jQuery("input.enable").change(function() { + + + + + + + i + +
    @@ -86,7 +116,7 @@ jQuery("input.enable").change(function() { - + {'Annotation'|@translate} @@ -144,7 +174,7 @@ jQuery("input.enable").change(function() { - + {'Annotation'|@translate} @@ -179,7 +209,7 @@ jQuery("input.enable").change(function() { {html_options name="pinterest[img_size]" values=$img_sizes output=$img_sizes|translate selected=$pinterest.img_size} - + {'Annotation'|@translate} @@ -220,7 +250,7 @@ jQuery("input.enable").change(function() { - + {'Annotation'|@translate} diff --git a/template/facebook.tpl b/template/facebook.tpl index 94abd2f..2a4bf13 100644 --- a/template/facebook.tpl +++ b/template/facebook.tpl @@ -1,7 +1,12 @@ {strip} +{if $SOCIALBUTT.light} + + Share on Facebook +{else} {footer_script}jQuery('body').prepend('
    ');{/footer_script} {combine_script id='facebook_jssdk' load='footer' path='https://connect.facebook.net/'|cat:$SOCIALBUTT.FACEBOOK.lang|cat:'/all.js#xfbml=1'} -
    +{/if} {/strip} \ No newline at end of file diff --git a/template/google.tpl b/template/google.tpl index 2a8afe7..28a79bd 100644 --- a/template/google.tpl +++ b/template/google.tpl @@ -1,6 +1,11 @@ {strip} +{if $SOCIALBUTT.light} + + Share on Google+ +{else} {combine_script id='google_plusone' load='footer' path='https://apis.google.com/js/plusone.js'} -
    +{/if} {/strip} \ No newline at end of file diff --git a/template/images/facebook_light.png b/template/images/facebook_light.png index 5722afd..488b681 100644 Binary files a/template/images/facebook_light.png and b/template/images/facebook_light.png differ diff --git a/template/images/google_medium.png b/template/images/google_medium.png index 2e7422f..d35b716 100644 Binary files a/template/images/google_medium.png and b/template/images/google_medium.png differ diff --git a/template/images/google_small.png b/template/images/google_small.png index d5fb3b7..937c2ab 100644 Binary files a/template/images/google_small.png and b/template/images/google_small.png differ diff --git a/template/images/google_standard.png b/template/images/google_standard.png index c349469..1a24ab0 100644 Binary files a/template/images/google_standard.png and b/template/images/google_standard.png differ diff --git a/template/images/google_tall.png b/template/images/google_tall.png index 4003450..96b04b4 100644 Binary files a/template/images/google_tall.png and b/template/images/google_tall.png differ diff --git a/template/pinterest.tpl b/template/pinterest.tpl index 7db5708..d80f6f5 100644 --- a/template/pinterest.tpl +++ b/template/pinterest.tpl @@ -1,6 +1,10 @@ {strip} -{combine_script id='pinterest_pinit' load='footer' path='https://assets.pinterest.com/js/pinit.js'} - - + {/strip} \ No newline at end of file diff --git a/template/style.css b/template/style.css index 0afe336..70c9a55 100644 --- a/template/style.css +++ b/template/style.css @@ -115,4 +115,15 @@ } .socialbutt.enabled thead label:before { content:"\2611"; +} + + +.showInfo { + position:static; + display:inline-block; + padding:1px 6px; + width:4px; + height:14px; + line-height:14px; + font-size:0.8em; } \ No newline at end of file diff --git a/template/tumblr.tpl b/template/tumblr.tpl index 0a61f8e..d4e3ab1 100644 --- a/template/tumblr.tpl +++ b/template/tumblr.tpl @@ -1,11 +1,14 @@ {strip} -{combine_script id='tumblr_share' load='footer' path='http://platform.tumblr.com/v1/share.js'} - {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} -Share on Tumblr {/strip} \ No newline at end of file diff --git a/template/twitter.tpl b/template/twitter.tpl index 70f2174..3a36e75 100644 --- a/template/twitter.tpl +++ b/template/twitter.tpl @@ -1,8 +1,11 @@ {strip} -{combine_script id='twitter_widgets' load='footer' path='https://platform.twitter.com/widgets.js'} - - - Share on Twitter + data-size="{$SOCIALBUTT.TWITTER.size}" data-count="{$SOCIALBUTT.TWITTER.count}" class="twitter-share-button" + {combine_script id='twitter_widgets' load='footer' path='https://platform.twitter.com/widgets.js'} +{/if} +>Share on Twitter {/strip} \ No newline at end of file