Merge pull request #120 from psychoph/master
Update to social_share module to fix issues
This commit is contained in:
commit
b58acc0729
@ -27,6 +27,7 @@ class Admin_Social_Share_Controller extends Admin_Controller {
|
|||||||
|
|
||||||
$form = $this->_get_form();
|
$form = $this->_get_form();
|
||||||
if ($form->validate()) {
|
if ($form->validate()) {
|
||||||
|
module::set_var("social_share", "general_impage_only", $form->general_settings->general_impage_only->value);
|
||||||
module::set_var("social_share", "facebook_share_enabled", $form->facebook_share_settings->facebook_share_enabled->value);
|
module::set_var("social_share", "facebook_share_enabled", $form->facebook_share_settings->facebook_share_enabled->value);
|
||||||
module::set_var("social_share", "facebook_share_layout", $form->facebook_share_settings->facebook_share_layout->value);
|
module::set_var("social_share", "facebook_share_layout", $form->facebook_share_settings->facebook_share_layout->value);
|
||||||
module::set_var("social_share", "facebook_share_link_text", $form->facebook_share_settings->facebook_share_link_text->value);
|
module::set_var("social_share", "facebook_share_link_text", $form->facebook_share_settings->facebook_share_link_text->value);
|
||||||
@ -42,6 +43,8 @@ class Admin_Social_Share_Controller extends Admin_Controller {
|
|||||||
module::set_var("social_share", "google_enabled", $form->google_settings->google_enabled->value);
|
module::set_var("social_share", "google_enabled", $form->google_settings->google_enabled->value);
|
||||||
module::set_var("social_share", "google_size", $form->google_settings->google_size->value);
|
module::set_var("social_share", "google_size", $form->google_settings->google_size->value);
|
||||||
module::set_var("social_share", "google_annotation", $form->google_settings->google_annotation->value);
|
module::set_var("social_share", "google_annotation", $form->google_settings->google_annotation->value);
|
||||||
|
module::set_var("social_share", "pinterest_enabled", $form->pinterest_settings->pinterest_enabled->value);
|
||||||
|
module::set_var("social_share", "pinterest_count_location", $form->pinterest_settings->pinterest_count_location->value);
|
||||||
module::set_var("social_share", "twitter_enabled", $form->twitter_settings->twitter_enabled->value);
|
module::set_var("social_share", "twitter_enabled", $form->twitter_settings->twitter_enabled->value);
|
||||||
module::set_var("social_share", "twitter_count_location", $form->twitter_settings->twitter_count_location->value);
|
module::set_var("social_share", "twitter_count_location", $form->twitter_settings->twitter_count_location->value);
|
||||||
module::set_var("social_share", "twitter_size", $form->twitter_settings->twitter_size->value);
|
module::set_var("social_share", "twitter_size", $form->twitter_settings->twitter_size->value);
|
||||||
@ -62,6 +65,12 @@ class Admin_Social_Share_Controller extends Admin_Controller {
|
|||||||
private function _get_form() {
|
private function _get_form() {
|
||||||
$form = new Forge("admin/social_share/handler", "", "post", array("id" => "g-admin-form"));
|
$form = new Forge("admin/social_share/handler", "", "post", array("id" => "g-admin-form"));
|
||||||
|
|
||||||
|
/// General Settings
|
||||||
|
$group_general = $form->group("general_settings")->label(t("General Settings"));
|
||||||
|
$group_general->checkbox("general_impage_only")->label(t("Display the enabled buttons on image and movie pages only"))
|
||||||
|
->checked(module::get_var("social_share", "general_impage_only", true) == 1);
|
||||||
|
|
||||||
|
/// Facebook share settings
|
||||||
$group_facebook_share = $form->group("facebook_share_settings")->label(t("Facebook Share Button Settings"));
|
$group_facebook_share = $form->group("facebook_share_settings")->label(t("Facebook Share Button Settings"));
|
||||||
$group_facebook_share->checkbox("facebook_share_enabled")->label(t("Display the button"))
|
$group_facebook_share->checkbox("facebook_share_enabled")->label(t("Display the button"))
|
||||||
->checked(module::get_var("social_share", "facebook_share_enabled", false) == 1);
|
->checked(module::get_var("social_share", "facebook_share_enabled", false) == 1);
|
||||||
@ -74,6 +83,7 @@ class Admin_Social_Share_Controller extends Admin_Controller {
|
|||||||
$group_facebook_share->input("facebook_share_link_text")->label(t('Enter the text to place next to the Facebook icon.'))
|
$group_facebook_share->input("facebook_share_link_text")->label(t('Enter the text to place next to the Facebook icon.'))
|
||||||
->value(module::get_var("social_share", "facebook_share_link_text", "Share"));
|
->value(module::get_var("social_share", "facebook_share_link_text", "Share"));
|
||||||
|
|
||||||
|
/// Facebook like settings
|
||||||
$group_facebook_like = $form->group("facebook_like_settings")->label(t("Facebook Like Button Settings"));
|
$group_facebook_like = $form->group("facebook_like_settings")->label(t("Facebook Like Button Settings"));
|
||||||
$group_facebook_like->checkbox("facebook_like_enabled")->label(t("Display the button"))
|
$group_facebook_like->checkbox("facebook_like_enabled")->label(t("Display the button"))
|
||||||
->checked(module::get_var("social_share", "facebook_like_enabled", false) == 1);
|
->checked(module::get_var("social_share", "facebook_like_enabled", false) == 1);
|
||||||
@ -108,6 +118,7 @@ class Admin_Social_Share_Controller extends Admin_Controller {
|
|||||||
"box_count" => t("Box count")))
|
"box_count" => t("Box count")))
|
||||||
->selected(module::get_var("social_share", "facebook_like_layout"));
|
->selected(module::get_var("social_share", "facebook_like_layout"));
|
||||||
|
|
||||||
|
/// Google settings
|
||||||
$group_google = $form->group("google_settings")->label(t("Google+ +1 Button Settings"));
|
$group_google = $form->group("google_settings")->label(t("Google+ +1 Button Settings"));
|
||||||
$group_google->checkbox("google_enabled")->label(t("Display the button"))
|
$group_google->checkbox("google_enabled")->label(t("Display the button"))
|
||||||
->checked(module::get_var("social_share", "google_enabled", false) == 1);
|
->checked(module::get_var("social_share", "google_enabled", false) == 1);
|
||||||
@ -125,6 +136,18 @@ class Admin_Social_Share_Controller extends Admin_Controller {
|
|||||||
"none" => t("None")))
|
"none" => t("None")))
|
||||||
->selected(module::get_var("social_share", "google_annotation"));
|
->selected(module::get_var("social_share", "google_annotation"));
|
||||||
|
|
||||||
|
/// Pinterest settings
|
||||||
|
$group_pinterest = $form->group("pinterest_settings")->label(t("Pinterest Pinit Settings"));
|
||||||
|
$group_pinterest->checkbox("pinterest_enabled")->label(t("Display the button"))
|
||||||
|
->checked(module::get_var("social_share", "pinterest_enabled", false) == 1);
|
||||||
|
$group_pinterest->dropdown("pinterest_count_location")
|
||||||
|
->label(t("Tweet count location"))
|
||||||
|
->options(array("horizontal" => t("Horizontal"),
|
||||||
|
"vertical" => t("Vertical"),
|
||||||
|
"none" => t("None")))
|
||||||
|
->selected(module::get_var("social_share", "pinterest_count_location"));
|
||||||
|
|
||||||
|
/// Twitter settings
|
||||||
$group_twitter = $form->group("twitter_settings")->label(t("Twitter Tweet Settings"));
|
$group_twitter = $form->group("twitter_settings")->label(t("Twitter Tweet Settings"));
|
||||||
$group_twitter->checkbox("twitter_enabled")->label(t("Display the button"))
|
$group_twitter->checkbox("twitter_enabled")->label(t("Display the button"))
|
||||||
->checked(module::get_var("social_share", "twitter_enabled", false) == 1);
|
->checked(module::get_var("social_share", "twitter_enabled", false) == 1);
|
||||||
|
@ -19,12 +19,15 @@
|
|||||||
*/
|
*/
|
||||||
class social_share_block_Core {
|
class social_share_block_Core {
|
||||||
static function get_site_list() {
|
static function get_site_list() {
|
||||||
return array(
|
return array("social_share" => t("Social Share"));
|
||||||
"social_share" => t("Social Share"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static function get($block_id, $theme) {
|
static function get($block_id, $theme) {
|
||||||
|
/// Check if the user wants to show the block on all pages or just the image and movie page types.
|
||||||
|
$impageonly = module::get_var("social_share", "general_impage_only");
|
||||||
|
$showblock = !$impageonly || ($impageonly && ($theme->page_subtype == "photo") || ($theme->page_subtype == "movie"));
|
||||||
|
|
||||||
|
if ($showblock){
|
||||||
$block = new Block();
|
$block = new Block();
|
||||||
$block->css_id = "g-social-share";
|
$block->css_id = "g-social-share";
|
||||||
$block->title = 'Share With Friends';
|
$block->title = 'Share With Friends';
|
||||||
@ -38,6 +41,9 @@ class social_share_block_Core {
|
|||||||
if(module::get_var("social_share", "google_enabled")){
|
if(module::get_var("social_share", "google_enabled")){
|
||||||
$block->content .= new View("google.html");
|
$block->content .= new View("google.html");
|
||||||
}
|
}
|
||||||
|
if(module::get_var("social_share", "pinterest_enabled")){
|
||||||
|
$block->content .= new View("pinterest.html");
|
||||||
|
}
|
||||||
if(module::get_var("social_share", "twitter_enabled")){
|
if(module::get_var("social_share", "twitter_enabled")){
|
||||||
$block->content .= new View("twitter.html");
|
$block->content .= new View("twitter.html");
|
||||||
}
|
}
|
||||||
@ -45,3 +51,4 @@ class social_share_block_Core {
|
|||||||
return $block;
|
return $block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
class social_share_installer {
|
class social_share_installer {
|
||||||
static function deactivate() {
|
static function deactivate() {
|
||||||
|
module::clear_var("social_share", "general_impage_only");
|
||||||
module::clear_var("social_share", "facebook_share_enabled");
|
module::clear_var("social_share", "facebook_share_enabled");
|
||||||
module::clear_var("social_share", "facebook_share_layout");
|
module::clear_var("social_share", "facebook_share_layout");
|
||||||
module::clear_var("social_share", "facebook_share_link_text");
|
module::clear_var("social_share", "facebook_share_link_text");
|
||||||
@ -34,6 +35,8 @@ class social_share_installer {
|
|||||||
module::clear_var("social_share", "google_enabled");
|
module::clear_var("social_share", "google_enabled");
|
||||||
module::clear_var("social_share", "google_size");
|
module::clear_var("social_share", "google_size");
|
||||||
module::clear_var("social_share", "google_annotation");
|
module::clear_var("social_share", "google_annotation");
|
||||||
|
module::clear_var("social_share", "pinterest_enabled");
|
||||||
|
module::clear_var("social_share", "pinterest_count_location");
|
||||||
module::clear_var("social_share", "twitter_enabled");
|
module::clear_var("social_share", "twitter_enabled");
|
||||||
module::clear_var("social_share", "twitter_count_location");
|
module::clear_var("social_share", "twitter_count_location");
|
||||||
module::clear_var("social_share", "twitter_size");
|
module::clear_var("social_share", "twitter_size");
|
||||||
@ -52,5 +55,9 @@ class social_share_installer {
|
|||||||
module::clear_var("social_share", "twitter");
|
module::clear_var("social_share", "twitter");
|
||||||
module::set_version("social_share", $version = 2);
|
module::set_version("social_share", $version = 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($version < 3) {
|
||||||
|
module::set_version("social_share", $version = 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,7 +19,10 @@
|
|||||||
*/
|
*/
|
||||||
class social_share_theme_Core {
|
class social_share_theme_Core {
|
||||||
static function head($theme) {
|
static function head($theme) {
|
||||||
if ($theme->item()) {
|
$impageonly = module::get_var("social_share", "general_impage_only");
|
||||||
|
$showblock = !$impageonly || ($impageonly && ($theme->page_subtype == "photo") || ($theme->page_subtype == "movie"));
|
||||||
|
|
||||||
|
if ($showblock && $theme->item()) {
|
||||||
$item = $theme->item();
|
$item = $theme->item();
|
||||||
$url = $item->thumb_url(true);
|
$url = $item->thumb_url(true);
|
||||||
$appId = module::get_var("social_share", "facebook_like_appId");
|
$appId = module::get_var("social_share", "facebook_like_appId");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name = "Social Share"
|
name = "Social Share"
|
||||||
description = "Adds links to share the page to social media sites in the sidebar."
|
description = "Adds links to share the page to social media sites in the sidebar."
|
||||||
version = 2
|
version = 3
|
||||||
author_name = "jasonhardin"
|
author_name = "jasonhardin"
|
||||||
author_url = "http://codex.gallery2.org/User:psychoph"
|
author_url = "http://codex.gallery2.org/User:psychoph"
|
||||||
info_url = "http://codex.gallery2.org/Gallery3:Modules:social_share"
|
info_url = "http://codex.gallery2.org/Gallery3:Modules:social_share"
|
||||||
|
@ -17,7 +17,6 @@ if (module::get_var("social_share", "facebook_like_send")) {
|
|||||||
$send = "false";
|
$send = "false";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="g-social_share-facebook_like">
|
<div class="g-social_share-facebook_like">
|
||||||
<?php if ($codeType == 'iframe'){ ?>
|
<?php if ($codeType == 'iframe'){ ?>
|
||||||
|
|
||||||
@ -28,14 +27,13 @@ if (module::get_var("social_share", "facebook_like_send")) {
|
|||||||
&show_faces=<?= $show_faces ?>
|
&show_faces=<?= $show_faces ?>
|
||||||
&width=180
|
&width=180
|
||||||
&locale=<?= locales::cookie_locale(); ?>
|
&locale=<?= locales::cookie_locale(); ?>
|
||||||
&action=<?= $layout ?>
|
&action=<?= $action ?>
|
||||||
&colorscheme=light&height=<?= $hite; ?>" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:180px; height:<?= $hite; ?>px;" allowTransparency="true">
|
&colorscheme=light&height=<?= $hite; ?>" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:180px; height:<?= $hite; ?>px;" allowTransparency="true">
|
||||||
</iframe>
|
</iframe>
|
||||||
|
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<div id="fb-root"></div>
|
<div id="fb-root"></div>
|
||||||
<script>(function(d, s, id) {
|
<script>(function(d, s, id) {
|
||||||
window.FB = null;FB=null;// this is needed for the facebook share button being on.
|
|
||||||
var js, fjs = d.getElementsByTagName(s)[0];
|
var js, fjs = d.getElementsByTagName(s)[0];
|
||||||
if (d.getElementById(id)) return;
|
if (d.getElementById(id)) return;
|
||||||
js = d.createElement(s); js.id = id;
|
js = d.createElement(s); js.id = id;
|
||||||
@ -45,12 +43,11 @@ if (module::get_var("social_share", "facebook_like_send")) {
|
|||||||
|
|
||||||
<?php if($codeType == 'xfbml'){?>
|
<?php if($codeType == 'xfbml'){?>
|
||||||
|
|
||||||
<fb:like href="<?= $selfURL; ?>" send="<?= $send ?>" width="180" show_faces="<?= $show_faces ?>" layout="<?= $layout?>" action="<?= $layout ?>"></fb:like>
|
<fb:like href="<?= $selfURL; ?>" send="<?= $send ?>" width="180" show_faces="<?= $show_faces ?>" layout="<?= $layout?>" action="<?= $action ?>"></fb:like>
|
||||||
<fb:like href="http://test.com" send="true" width="180" show_faces="false"></fb:like>
|
|
||||||
|
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
|
|
||||||
<div class="fb-like" data-href="<?= $selfURL; ?>" data-send="<?= $send ?>" data-layout="<?= $layout?>" data-width="180" data-show-faces="<?= $show_faces ?>" data-action="<?= $layout ?>"></div>
|
<div class="fb-like" data-href="<?= $selfURL; ?>" data-send="<?= $send ?>" data-layout="<?= $layout?>" data-width="180" data-show-faces="<?= $show_faces ?>" data-action="<?= $action ?>"></div>
|
||||||
|
|
||||||
<?php }
|
<?php }
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.")?>
|
<?php defined("SYSPATH") or die("No direct script access.")?>
|
||||||
<div class="g-social_share-facebook_share">
|
<div class="g-social_share-facebook_share">
|
||||||
<a id="facebookicon" name="fb_share" type="<?= module::get_var("social_share", "facebook_share_layout") ?>"><?= module::get_var("social_share", "facebook_share_link_text") ?></a>
|
<a id="facebookicon" name="fb_share" type="<?= module::get_var("social_share", "facebook_share_layout") ?>"></a>
|
||||||
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
|
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
|
||||||
</div>
|
</div>
|
@ -11,7 +11,7 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var po = document.createElement('script');
|
var po = document.createElement('script');
|
||||||
po.type = 'text/javascript';
|
po.type = 'text/javascript';
|
||||||
x2po.async = true;
|
po.async = true;
|
||||||
po.src = 'https://apis.google.com/js/plusone.js';
|
po.src = 'https://apis.google.com/js/plusone.js';
|
||||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
|
||||||
})();
|
})();
|
||||||
|
14
3.0/modules/social_share/views/pinterest.html.php
Normal file
14
3.0/modules/social_share/views/pinterest.html.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
if ($theme->item()) {
|
||||||
|
$url = urlencode(url::abs_current(true));
|
||||||
|
$item = $theme->item();
|
||||||
|
$media = urlencode($item->thumb_url(true));
|
||||||
|
$description=urlencode($item->description);
|
||||||
|
?>
|
||||||
|
<div class="g-social_share-pinterest_pinit">
|
||||||
|
<a href="http://pinterest.com/pin/create/button/?url=<?= $url; ?>&media=<?= $media; ?>&description=<?= $description; ?>" class="pin-it-button" count-layout="<?= module::get_var("social_share", "pinterest_count_location") ?>">
|
||||||
|
<img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" />
|
||||||
|
</a>
|
||||||
|
<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
Reference in New Issue
Block a user