From c6dfaa98778da236793d1a482cc3067a6ccb65cb Mon Sep 17 00:00:00 2001 From: mistic100 Date: Tue, 5 Mar 2013 23:51:44 +0000 Subject: [PATCH] use Piwigo 2.5 template methods, share complete link, option to disable on albums git-svn-id: http://piwigo.org/svn/extensions/SocialButtons@21232 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin.php | 1 + include/install.inc.php | 11 +++++++++-- language/en_UK/plugin.lang.php | 3 +++ language/fr_FR/plugin.lang.php | 3 +++ main.inc.php | 14 ++++++-------- template/admin.tpl | 9 +++++++++ template/facebook.tpl | 2 +- 7 files changed, 32 insertions(+), 11 deletions(-) diff --git a/admin.php b/admin.php index 9fb26e3..5df4990 100644 --- a/admin.php +++ b/admin.php @@ -10,6 +10,7 @@ if (isset($_POST['submit'])) { $conf['SocialButtons'] = array( 'position' => $_POST['position'], + 'on_index' => get_boolean($_POST['on_index']), 'twitter' => array( 'enabled' => isset($_POST['twitter']['enabled']), 'size' => $_POST['twitter']['size'], diff --git a/include/install.inc.php b/include/install.inc.php index ee737a0..6afebb0 100644 --- a/include/install.inc.php +++ b/include/install.inc.php @@ -9,6 +9,7 @@ function socialbutt_install() { $default_config = array( 'position' => 'toolbar', + 'on_index' => true, 'twitter' => array( 'enabled' => true, 'size' => 'small', @@ -63,6 +64,7 @@ function socialbutt_install() else { $new_conf = unserialize($conf['SocialButtons']); + if (empty($new_conf['pinterest'])) { $new_conf['pinterest'] = array( @@ -70,9 +72,14 @@ function socialbutt_install() 'layout' => 'horizontal', 'img_size' => 'Original', ); - $conf['SocialButtons'] = serialize($new_conf); - conf_update_param('SocialButtons', $conf['SocialButtons']); } + if (!isset($new_conf['on_index'])) + { + $new_conf['on_index'] = true; + } + + $conf['SocialButtons'] = serialize($new_conf); + conf_update_param('SocialButtons', $conf['SocialButtons']); } } diff --git a/language/en_UK/plugin.lang.php b/language/en_UK/plugin.lang.php index 8824b51..45fdbcc 100644 --- a/language/en_UK/plugin.lang.php +++ b/language/en_UK/plugin.lang.php @@ -9,4 +9,7 @@ $lang['Inline text'] = 'Inline text'; $lang['Button type'] = 'Button type'; $lang['Right bubble'] = 'Right bubble'; $lang['Top bubble'] = 'Top bubble'; +$lang['Display buttons'] = 'Display buttons'; +$lang['on photo and album pages'] = 'on photo and album pages'; +$lang['only on photo pages'] = 'only on photo pages'; ?> \ No newline at end of file diff --git a/language/fr_FR/plugin.lang.php b/language/fr_FR/plugin.lang.php index c353e3e..75514fd 100644 --- a/language/fr_FR/plugin.lang.php +++ b/language/fr_FR/plugin.lang.php @@ -11,4 +11,7 @@ $lang['Shared picture size'] = 'Taille des photos partagées'; $lang['Via'] = 'Via'; $lang['Right bubble'] = 'Bulle à droite'; $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'; ?> \ No newline at end of file diff --git a/main.inc.php b/main.inc.php index 1aed52f..e4e2c75 100644 --- a/main.inc.php +++ b/main.inc.php @@ -102,7 +102,7 @@ function socialbutt_add_button() { $share_url = $root_url.ltrim(duplicate_picture_url(), './'); } - else if ($basename == 'index') + else if ($basename == 'index' and $conf['SocialButtons']['on_index']) { $conf['SocialButtons']['position'] = 'index'; $share_url = $root_url.ltrim(duplicate_index_url(array(), array('start')), './'); @@ -117,7 +117,7 @@ function socialbutt_add_button() $tpl_vars = array( 'share_url' => $share_url, 'position' => $conf['SocialButtons']['position'], - 'copyright' => ' (from '.$conf['gallery_title'].')', + 'copyright' => ' (from '.$conf['gallery_title'].')', ); $buttons = array(); @@ -170,14 +170,12 @@ function socialbutt_add_button() { case 'index': foreach ($buttons as $button) { - // $template->add_index_button('
  • '.$button.'
  • ', 100); - $template->concat('PLUGIN_INDEX_ACTIONS', "\n
  • ".$button."
  • "); + $template->add_index_button('
  • '.$button.'
  • ', 100); } break; case 'toolbar': foreach ($buttons as $button) { - // $template->add_picture_button($button, 100); - $template->concat('PLUGIN_PICTURE_ACTIONS', "\n".$button); + $template->add_picture_button($button, 100); } break; default; @@ -192,12 +190,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/template/admin.tpl b/template/admin.tpl index 28ef4c4..92673d3 100644 --- a/template/admin.tpl +++ b/template/admin.tpl @@ -44,6 +44,15 @@ jQuery("input.enable").change(function() { + + + {'Display buttons'|@translate} + + +
    + + +
    diff --git a/template/facebook.tpl b/template/facebook.tpl index 968c5f9..d7d8f01 100644 --- a/template/facebook.tpl +++ b/template/facebook.tpl @@ -4,7 +4,7 @@ {if $SOCIALBUTT.FACEBOOK.layout=='none'} {html_style}{literal} -.fb-like span { height: 22px !important; overflow: hidden !important; margin-right:10px; } +.fb-like span { height: 22px !important; overflow: hidden !important; } .fb-like iframe { top: -41px; } {/literal}{/html_style} {assign var=facebook_layout value='box_count'}