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 0000000..b7eaec8 Binary files /dev/null and b/template/images/pinterest_logo.png differ diff --git a/template/pinterest.tpl b/template/pinterest.tpl new file mode 100644 index 0000000..9a77b88 --- /dev/null +++ b/template/pinterest.tpl @@ -0,0 +1,6 @@ +{strip} +{combine_script id='pinterest_pinit' path='http://assets.pinterest.com/js/pinit.js'} + + +{/strip} \ No newline at end of file