Removed error with test.com, added pinterest support and the support for only module and block page display.
This commit is contained in:
parent
6b4f1856a5
commit
1cd9f66665
@ -42,6 +42,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 +64,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 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);
|
||||||
@ -108,6 +116,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 +134,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);
|
||||||
|
@ -18,30 +18,37 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
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"));
|
||||||
|
|
||||||
$block = new Block();
|
if ($showblock){
|
||||||
$block->css_id = "g-social-share";
|
$block = new Block();
|
||||||
$block->title = 'Share With Friends';
|
$block->css_id = "g-social-share";
|
||||||
$block->content = '';
|
$block->title = 'Share With Friends';
|
||||||
if(module::get_var("social_share", "facebook_share_enabled")){
|
$block->content = '';
|
||||||
$block->content .= new View("facebook_share.html");
|
if(module::get_var("social_share", "facebook_share_enabled")){
|
||||||
}
|
$block->content .= new View("facebook_share.html");
|
||||||
if(module::get_var("social_share", "facebook_like_enabled")){
|
}
|
||||||
$block->content .= new View("facebook_like.html");
|
if(module::get_var("social_share", "facebook_like_enabled")){
|
||||||
}
|
$block->content .= new View("facebook_like.html");
|
||||||
if(module::get_var("social_share", "google_enabled")){
|
}
|
||||||
$block->content .= new View("google.html");
|
if(module::get_var("social_share", "google_enabled")){
|
||||||
}
|
$block->content .= new View("google.html");
|
||||||
if(module::get_var("social_share", "twitter_enabled")){
|
}
|
||||||
$block->content .= new View("twitter.html");
|
if(module::get_var("social_share", "pinterest_enabled")){
|
||||||
}
|
$block->content .= new View("pinterest.html");
|
||||||
|
}
|
||||||
|
if(module::get_var("social_share", "twitter_enabled")){
|
||||||
|
$block->content .= new View("twitter.html");
|
||||||
|
}
|
||||||
|
|
||||||
return $block;
|
return $block;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -18,39 +18,46 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class social_share_installer {
|
class social_share_installer {
|
||||||
static function deactivate() {
|
static function deactivate() {
|
||||||
module::clear_var("social_share", "facebook_share_enabled");
|
module::clear_var("social_share", "general_impage_only");
|
||||||
module::clear_var("social_share", "facebook_share_layout");
|
module::clear_var("social_share", "facebook_share_enabled");
|
||||||
module::clear_var("social_share", "facebook_share_link_text");
|
module::clear_var("social_share", "facebook_share_layout");
|
||||||
module::clear_var("social_share", "facebook_like_enabled");
|
module::clear_var("social_share", "facebook_share_link_text");
|
||||||
module::clear_var("social_share", "facebook_like_appId");
|
module::clear_var("social_share", "facebook_like_enabled");
|
||||||
module::clear_var("social_share", "facebook_like_adminId");
|
module::clear_var("social_share", "facebook_like_appId");
|
||||||
module::clear_var("social_share", "facebook_like_site_name");
|
module::clear_var("social_share", "facebook_like_adminId");
|
||||||
module::clear_var("social_share", "facebook_like_code_type");
|
module::clear_var("social_share", "facebook_like_site_name");
|
||||||
module::clear_var("social_share", "facebook_like_show_faces");
|
module::clear_var("social_share", "facebook_like_code_type");
|
||||||
module::clear_var("social_share", "facebook_like_send");
|
module::clear_var("social_share", "facebook_like_show_faces");
|
||||||
module::clear_var("social_share", "facebook_like_action");
|
module::clear_var("social_share", "facebook_like_send");
|
||||||
module::clear_var("social_share", "facebook_like_layout");
|
module::clear_var("social_share", "facebook_like_action");
|
||||||
module::clear_var("social_share", "google_enabled");
|
module::clear_var("social_share", "facebook_like_layout");
|
||||||
module::clear_var("social_share", "google_size");
|
module::clear_var("social_share", "google_enabled");
|
||||||
module::clear_var("social_share", "google_annotation");
|
module::clear_var("social_share", "google_size");
|
||||||
module::clear_var("social_share", "twitter_enabled");
|
module::clear_var("social_share", "google_annotation");
|
||||||
module::clear_var("social_share", "twitter_count_location");
|
module::clear_var("social_share", "pinterest_enabled");
|
||||||
module::clear_var("social_share", "twitter_size");
|
module::clear_var("social_share", "pinterest_count_location");
|
||||||
}
|
module::clear_var("social_share", "twitter_enabled");
|
||||||
static function upgrade($version) {
|
module::clear_var("social_share", "twitter_count_location");
|
||||||
if ($version < 1) {
|
module::clear_var("social_share", "twitter_size");
|
||||||
module::set_version("social_share", $version = 1);
|
|
||||||
}
|
}
|
||||||
|
static function upgrade($version) {
|
||||||
|
if ($version < 1) {
|
||||||
|
module::set_version("social_share", $version = 1);
|
||||||
|
}
|
||||||
|
|
||||||
if ($version < 2) {
|
if ($version < 2) {
|
||||||
module::set_var("social_share", "facebook_share_enabled", module::get_var("social_share", "facebook"));
|
module::set_var("social_share", "facebook_share_enabled", module::get_var("social_share", "facebook"));
|
||||||
module::clear_var("social_share", "facebook");
|
module::clear_var("social_share", "facebook");
|
||||||
module::set_var("social_share", "google_enabled", module::get_var("social_share", "google"));
|
module::set_var("social_share", "google_enabled", module::get_var("social_share", "google"));
|
||||||
module::clear_var("social_share", "google");
|
module::clear_var("social_share", "google");
|
||||||
module::set_var("social_share", "twitter_enabled", module::get_var("social_share", "twitter"));
|
module::set_var("social_share", "twitter_enabled", module::get_var("social_share", "twitter"));
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
@ -18,21 +18,24 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
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");
|
||||||
$item = $theme->item();
|
$showblock = !$impageonly || ($impageonly && ($theme->page_subtype == "photo") || ($theme->page_subtype == "movie"));
|
||||||
$url = $item->thumb_url(true);
|
|
||||||
$appId = module::get_var("social_share", "facebook_like_appId");
|
if ($showblock && $theme->item()) {
|
||||||
$adminId = module::get_var("social_share", "facebook_like_adminId");
|
$item = $theme->item();
|
||||||
$site_name = module::get_var("social_share", "facebook_like_site_name");
|
$url = $item->thumb_url(true);
|
||||||
$selfURL = url::abs_current(true);
|
$appId = module::get_var("social_share", "facebook_like_appId");
|
||||||
return "\t<meta property=\"og:image\" content=\"$url\"/>
|
$adminId = module::get_var("social_share", "facebook_like_adminId");
|
||||||
<meta property=\"og:title\" content=\"$item->title\"/>
|
$site_name = module::get_var("social_share", "facebook_like_site_name");
|
||||||
<meta property=\"og:type\" content=\"article\"/>
|
$selfURL = url::abs_current(true);
|
||||||
<meta property=\"og:url\" content=\"$selfURL\"/>
|
return "\t<meta property=\"og:image\" content=\"$url\"/>
|
||||||
<meta property=\"og:site_name\" content=\"$site_name\"/>
|
<meta property=\"og:title\" content=\"$item->title\"/>
|
||||||
<meta property=\"fb:app_id\" content=\"$appId\"/>
|
<meta property=\"og:type\" content=\"article\"/>
|
||||||
<meta property=\"fb:admins\" content=\"$adminId\"/>";
|
<meta property=\"og:url\" content=\"$selfURL\"/>
|
||||||
}
|
<meta property=\"og:site_name\" content=\"$site_name\"/>
|
||||||
}
|
<meta property=\"fb:app_id\" content=\"$appId\"/>
|
||||||
|
<meta property=\"fb:admins\" content=\"$adminId\"/>";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -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"
|
||||||
|
@ -46,7 +46,6 @@ 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="<?= $layout ?>"></fb:like>
|
||||||
<fb:like href="http://test.com" send="true" width="180" show_faces="false"></fb:like>
|
|
||||||
|
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
|
|
||||||
|
13
3.0/modules/social_share/views/pinterest.html.php
Normal file
13
3.0/modules/social_share/views/pinterest.html.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
|
||||||
|
$url = url::abs_current(true);
|
||||||
|
$description="need to find out how to get this";
|
||||||
|
if ($theme->item()) {
|
||||||
|
$item = $theme->item();
|
||||||
|
$media = $item->thumb_url(true);
|
||||||
|
?>
|
||||||
|
<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
|
||||||
|
<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>
|
||||||
|
<?php } ?>
|
Reference in New Issue
Block a user