From 8fc870d23f5aab62e01631f8f2ebca5781b3d5bd Mon Sep 17 00:00:00 2001 From: mistic100 Date: Fri, 25 Jan 2013 15:51:02 +0000 Subject: [PATCH] add pinterest, option to hide counter on facebook button git-svn-id: http://piwigo.org/svn/extensions/SocialButtons@20374 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin.php | 5 + include/facebook.inc.php | 4 +- include/google.inc.php | 4 +- include/install.inc.php | 20 +- include/pinterest.inc.php | 33 +++ include/tumblr.inc.php | 6 +- include/twitter.inc.php | 4 +- main.inc.php | 13 +- template/admin.tpl | 337 ++++++++++++++++------------- template/facebook.tpl | 12 +- template/images/pinterest_logo.png | Bin 0 -> 4456 bytes template/pinterest.tpl | 6 + 12 files changed, 279 insertions(+), 165 deletions(-) create mode 100644 include/pinterest.inc.php create mode 100644 template/images/pinterest_logo.png create mode 100644 template/pinterest.tpl diff --git a/admin.php b/admin.php index 822a307..9fb26e3 100644 --- a/admin.php +++ b/admin.php @@ -31,6 +31,11 @@ if (isset($_POST['submit'])) 'color' => $_POST['facebook']['color'], 'layout' => $_POST['facebook']['layout'], ), + 'pinterest' => array( + 'enabled' => isset($_POST['pinterest']['enabled']), + 'layout' => $_POST['pinterest']['layout'], + 'img_size' => $_POST['pinterest']['img_size'], + ), ); conf_update_param('SocialButtons', serialize($conf['SocialButtons'])); diff --git a/include/facebook.inc.php b/include/facebook.inc.php index 5b89826..272536b 100644 --- a/include/facebook.inc.php +++ b/include/facebook.inc.php @@ -1,7 +1,7 @@ set_filename('facebook_button', realpath(SOCIALBUTT_PATH .'template/facebook.tpl')); - return 'facebook_button'; + $buttons[] = 'facebook_button'; } ?> \ No newline at end of file diff --git a/include/google.inc.php b/include/google.inc.php index a67a9ba..f853d46 100644 --- a/include/google.inc.php +++ b/include/google.inc.php @@ -1,7 +1,7 @@ set_filename('google_button', realpath(SOCIALBUTT_PATH .'template/google.tpl')); - return 'google_button'; + $buttons[] = 'google_button'; } ?> \ No newline at end of file diff --git a/include/install.inc.php b/include/install.inc.php index 2fae8b9..ee737a0 100644 --- a/include/install.inc.php +++ b/include/install.inc.php @@ -30,6 +30,11 @@ function socialbutt_install() 'color' => 'light', 'layout' => 'button_count', ), + 'pinterest' => array( + 'enabled' => true, + 'layout' => 'horizontal', + 'img_size' => 'Original', + ), ); if (isset($conf['TumblrShare'])) @@ -52,10 +57,23 @@ function socialbutt_install() $default_config['google']['annotation'] = $temp['annotation']; } - $conf['SocialButtons'] = serialize($default_config); conf_update_param('SocialButtons', $conf['SocialButtons']); } + else + { + $new_conf = unserialize($conf['SocialButtons']); + if (empty($new_conf['pinterest'])) + { + $new_conf['pinterest'] = array( + 'enabled' => true, + 'layout' => 'horizontal', + 'img_size' => 'Original', + ); + $conf['SocialButtons'] = serialize($new_conf); + conf_update_param('SocialButtons', $conf['SocialButtons']); + } + } } ?> \ No newline at end of file diff --git a/include/pinterest.inc.php b/include/pinterest.inc.php new file mode 100644 index 0000000..db5e27e --- /dev/null +++ b/include/pinterest.inc.php @@ -0,0 +1,33 @@ +'.$conf['gallery_title'].')'; + $tpl_vars['PINTEREST']['title'] = $picture['current']['TITLE']; + + if ($conf['SocialButtons']['pinterest']['img_size'] == 'Original') + { + $tpl_vars['PINTEREST']['source'] = $root_url.ltrim($picture['current']['src_image']->get_url(), './'); + } + else + { + $tpl_vars['PINTEREST']['source'] = $root_url.ltrim(DerivativeImage::url($conf['SocialButtons']['pinterest']['img_size'], $picture['current']['src_image']), './'); + } + + + $template->set_filename('pinterest_button', realpath(SOCIALBUTT_PATH .'template/pinterest.tpl')); + $buttons[] = 'pinterest_button'; +} + +?> \ No newline at end of file diff --git a/include/tumblr.inc.php b/include/tumblr.inc.php index c9af3e7..bd03379 100644 --- a/include/tumblr.inc.php +++ b/include/tumblr.inc.php @@ -1,9 +1,9 @@ 'width:81px; height:20px;', @@ -50,7 +50,7 @@ function socialbutt_tumblr($basename, $root_url, &$tpl_vars) $template->set_filename('tumblr_button', realpath(SOCIALBUTT_PATH .'template/tumblr.tpl')); - return 'tumblr_button'; + $buttons[] = 'tumblr_button'; } ?> \ No newline at end of file diff --git a/include/twitter.inc.php b/include/twitter.inc.php index 83f0327..af03b12 100644 --- a/include/twitter.inc.php +++ b/include/twitter.inc.php @@ -1,7 +1,7 @@ set_filename('twitter_button', realpath(SOCIALBUTT_PATH .'template/twitter.tpl')); - return 'twitter_button'; + $buttons[] = 'twitter_button'; } ?> \ No newline at end of file diff --git a/main.inc.php b/main.inc.php index a7ebb54..6b1eb8f 100644 --- a/main.inc.php +++ b/main.inc.php @@ -124,22 +124,27 @@ function socialbutt_add_button() if ($conf['SocialButtons']['google']['enabled']) { include_once(SOCIALBUTT_PATH . 'include/google.inc.php'); - $buttons[] = socialbutt_google($basename, $root_url, $tpl_vars); + socialbutt_google($basename, $root_url, $tpl_vars, $buttons); } if ($conf['SocialButtons']['twitter']['enabled']) { include_once(SOCIALBUTT_PATH . 'include/twitter.inc.php'); - $buttons[] = socialbutt_twitter($basename, $root_url, $tpl_vars); + socialbutt_twitter($basename, $root_url, $tpl_vars, $buttons); } if ($conf['SocialButtons']['facebook']['enabled']) { include_once(SOCIALBUTT_PATH . 'include/facebook.inc.php'); - $buttons[] = socialbutt_facebook($basename, $root_url, $tpl_vars); + socialbutt_facebook($basename, $root_url, $tpl_vars, $buttons); } if ($conf['SocialButtons']['tumblr']['enabled']) { include_once(SOCIALBUTT_PATH . 'include/tumblr.inc.php'); - $buttons[] = socialbutt_tumblr($basename, $root_url, $tpl_vars); + socialbutt_tumblr($basename, $root_url, $tpl_vars, $buttons); + } + if ($conf['SocialButtons']['pinterest']['enabled'] and $basename=='picture') + { + include_once(SOCIALBUTT_PATH . 'include/pinterest.inc.php'); + socialbutt_pinterest($basename, $root_url, $tpl_vars, $buttons); } if (empty($buttons)) diff --git a/template/admin.tpl b/template/admin.tpl index c745770..5085be9 100644 --- a/template/admin.tpl +++ b/template/admin.tpl @@ -49,7 +49,192 @@ jQuery("input.enable").change(function() {
-
+ +
{* *} + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ {'Button type'|@translate} +
+ {'Annotation'|@translate} + +
+
+
+ + + @ +
+
{* *} + +
{* *} + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ {'Button type'|@translate} +
+ {'Annotation'|@translate} + +
+
+ +
+
{* *} + +
+ +
{* *} + + + + + + + + + + + + + + +
+ +
+ {'Shared picture size'|@translate} + + {html_options name="pinterest[img_size]" values=$img_sizes output=$img_sizes|translate selected=$pinterest.img_size} +
+ {'Annotation'|@translate} + +
+
+ +
+
{* *} + +
{* *} + + + + + + + + + + + + + + + + + + +
+ +
+ {'Button type'|@translate} +
+ {'Annotation'|@translate} + +
+
+
+ +
+
{* *} + +
+ +
{* *}
@@ -116,155 +301,7 @@ jQuery("input.enable").change(function() {
-
- -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- {'Button type'|@translate} -
- {'Annotation'|@translate} - -
-
- -
-
- -
- -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- {'Button type'|@translate} -
- {'Annotation'|@translate} - -
-
-
- - - @ -
-
- -
- - - - - - - - - - - - - - - - - - -
- -
- {'Button type'|@translate} -
- {'Annotation'|@translate} - -
-
- -
-
+
{* *}
diff --git a/template/facebook.tpl b/template/facebook.tpl index 7fe427f..299a9de 100644 --- a/template/facebook.tpl +++ b/template/facebook.tpl @@ -2,6 +2,16 @@ {footer_script}jQuery('body').prepend('
');{/footer_script} {combine_script id='facebook_jssdk' load='async' 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 iframe { top: -41px; } +{/literal}{/html_style} +{assign var=facebook_layout value='box_count'} +{else} +{assign var=facebook_layout value=$SOCIALBUTT.FACEBOOK.layout} +{/if} +
+ data-href="{$SOCIALBUTT.share_url}" data-layout="{$facebook_layout}" data-colorscheme="{$SOCIALBUTT.FACEBOOK.color}"> {/strip} \ No newline at end of file diff --git a/template/images/pinterest_logo.png b/template/images/pinterest_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..b7eaec8bb9054d2a104f53a8af197eea6f12abfa GIT binary patch literal 4456 zcmV-u5tr_XP) z+<#@>GUx2<-b)~H|L;2=kJ;VX*_k zDP@cl3hpwLA1b@V(5uQbGclKE8+s^ot)`)83|;M`K6Qp#BjJ5R{S1wc@j>jFy3x?@ zlzYBILsL~MMHrP0t#N1>Z^o$OJ<52g!eEcpV!I$ObVFT*A$CFk?--LI7%Q=iwKTL= zxThjko)js<2n*BKV=@HeHlh6ba6z7fn_T$TP(wq5vi!J7P?I(Z*IR?}QlzkPc?6UA zV1}Vpj`9u~Q#@#>hU1}au+-<|=mWo^Oq@f)lMxPpKp$j3b^QZ;F!R#+oHgpgFb*)w z(6WSeEp(I}ZK#}U&<-`!Td0VGBTIAqp_53CQIs`wm2i!tN$|NaWjvN(Pf09&e4wTNlRha6^BN(ZJsD z9=OoM&_IXO{RC>9jq?pXYUrl@Ja`<~9Pe1=%Fy1f!W90f;m|aa;!sB!yJWY9CmPe$ z!p+w!h7V7GD-AU@)XvbKV%i)m?Pm+u>O<<nTl{fL<8v_*oNX3ZBpv95=sAZujU}lyS+ra0R)ejS@63R%`2Tj%5B)xp&(EFnFg3 zS$2{Qx z7`WD{>aU%}3G7XGjC(&SyyZc1CUtO_4_|SX>==i>#goFd%Z{Va z7b_pd+x>2d!4&T+4d%`njK7Cs5W`?KN^;dcCafx)M$(fqNo5yCwC`TZ><|o4AqNt$ zq(iuLr_9#Mx}J6X!O)$;H7(1z2-FB>taeKM{RJB?Kxy>Nwd8i^hrxZu0pfwmJ-p|k zFS%2VBy5N3I>jox!O#=gE>ZIw<&DU_NoZW z!4Qo5L(YZPSu(`15JRws?E|bzbz{`iTT#uD?}({_98%h~{H#dU-NLAiW1r zCIBl5pCK_BB3M~Ip~9&kt+E`WXY&LVp#&s#7`zkj2ca@v9zTll^7`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