Jump to content

How to do the share extension to show the http shares and not the https?


Recommended Posts

I have two situations on Facebook Object Debugger, one for http and one for https (Please see attached images).

 

This one is if I input the http link

post-165920-0-25585100-1449563105_thumb.png

 

and this one for https link

post-165920-0-41049600-1449563283_thumb.png

 

The code of my joomla extension is:

<?php

/*------------------------------------------------------------------------
# mod_ofblikebutton - Optimized Facebook Like Button
# ------------------------------------------------------------------------

# author: Optimized Sense
# copyright: Copyright (C) 2013 http://www.o-sense.com. All Rights Reserved.
# @license: http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.o-sense.com
# Technical Support: http://www.o-sense.com/contact-us/support-inquiries.html
-------------------------------------------------------------------------*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
class oFBLikeButton{
function getData(&$params ){
$oFBLinkTitle = 'O-Sense';
$oFBLink = 'http://www.o-sense.com';
//$oFBLinkImg = 'http://www.o-sense.com/osensecopy.png';
//$oFlink = $params->get('olink');///
$oFBLink = JURI::current();
$oFshowSend = $params->get('oshowSend');///
$oFstyle = $params->get('ostyle');
$oFwidth = $params->get('owidth', '400');///
$oFfaces = $params->get('ofaces');/// 
$oFfont = $params->get('ofont');///
$oFcolor = $params->get('ocolor');///
$oFverb = $params->get('overb');///
$oFsource = $params->get('osource');///
$oFlang = $params->get('olang');///
if($oFfaces == '1'){
$oFfaces = 'true';
}else{
$oFfaces = 'false';
}
if($oFshowSend == '1'){
$oFshowSend = 'true';
}else{
$oFshowSend = 'false';
}
$data ='';
if($oFsource == '1'){
//HTML5 

$app = JFactory::getApplication();

$menu = $app->getMenu();

$lang = JFactory::getLanguage();
$fburl = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; 

if($fburl == 'https://www.atlantotec.com/de/' || $fburl == 'https://www.atlantotec.com' || $fburl == 'https://www.atlantotec.com/de')

{
$pageurl = 'http://www.atlantotec.com/de/';
$spageurl = 'https://www.atlantotec.com/de/';

} else {

$finalurls = explode('/',$_SERVER['REQUEST_URI']);
$urls = '';
foreach ($finalurls as $finalurl){

if($finalurl != ''){

$urls .= '/'.$finalurl;

}

}

if ($lang->getTag() == 'it-IT') {
$pageurl = 'http://'.$_SERVER['HTTP_HOST'].$urls;

$spageurl = 'https://'.$_SERVER['HTTP_HOST'].$urls;
} else {
$pageurl = 'http://'.$_SERVER['HTTP_HOST'].$urls;

$spageurl = 'https://'.$_SERVER['HTTP_HOST'].$urls;

}

}
$data = '<div id="fb-root"></div>

<script>(function(d, s, id) {

var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=541263185976160";

fjs.parentNode.insertBefore(js, fjs);
}(document, \'script\', \'facebook-jssdk\'));</script>';

$data = $data . '<div class="fb-like" data-href="'.$pageurl.'" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div>';

/*$url = 'http://api.facebook.com/restserver.php?method=links.getStats&urls='.$pageurl.','.$spageurl;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$retrun = curl_exec($ch);
curl_close($ch);
$oXML = new SimpleXMLElement($retrun);
$total_count=0;

foreach($oXML->link_stat as $link_stat){

//if($total_count != $link_stat->total_count || $total_count ==0)

$total_count += $link_stat->total_count;

}*/

/*$data = '<div class="fb-like" data-href="'.$spageurl.'" data-layout="button" data-action="like" data-show-faces="false" data-share="true"></div>';

$data = '<div id="fb-root"></div><script language="javascript" type="text/javascript">(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/'.$oFlang.'/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs);}(document, \'script\', \'facebook-jssdk\'));</script>';

$data = $data.'<script language="javascript" type="text/javascript">//<![CDATA[
document.write(\'<div class="fb-like" data-href="'.$pageurl.'" data-width="'.$oFwidth.'" data-colorscheme="'.$oFcolor.'" data-show-faces="'.$oFfaces.'" data-send="'.$oFshowSend.'" data-font="'.$oFfont.'" data-action="'.$oFverb.'" data-layout="button"></div><div class="pluginCountButton pluginCountNum"><div class="pluginCountButtonNub"><s></s><i></i></div><span id="fb-count">'.$total_count.'</span></div> \');
//]]>
</script> <div style="display:none; position: relative; height: 15px; width: 100%; font-size: 10px; color: #808080; font-weight: normal; font-family: \'lucida grande\',tahoma,verdana,arial,sans-serif; line-height: 1.28; text-align: right; direction: ltr;"><a href="'.$pageurl.'" target="_blank" style="color: #808080;"> <img alt="OSense" src="'.$oFBLinkImg.'" style="visibility:visible; zoom: 1; opacity: 1; vertical-align: text-top;" /> '.$oFBLinkTitle.'</a></div>';*/

/*$data = $data.'<script language="javascript" type="text/javascript">//<![CDATA[
document.write(\'<div class="fb-like" data-href="'.$spageurl.'" data-width="'.$oFwidth.'" data-colorscheme="'.$oFcolor.'" data-show-faces="'.$oFfaces.'" data-send="'.$oFshowSend.'" data-font="'.$oFfont.'" data-action="'.$oFverb.'" data-layout="'.$oFstyle.'"></div> \');

//]]>

</script> <div style="display:none; position: relative; height: 15px; width: 100%; font-size: 10px; color: #808080; font-weight: normal; font-family: \'lucida grande\',tahoma,verdana,arial,sans-serif; line-height: 1.28; text-align: right; direction: ltr;"><a href="'.$spageurl.'" target="_blank" style="color: #808080;"> <img alt="OSense" src="'.$oFBLinkImg.'" style="visibility:visible; zoom: 1; opacity: 1; vertical-align: text-top;" /> '.$oFBLinkTitle.'</a></div>';*/

}else if($oFsource == '2'){
//XFBML
$data = '<div id="fb-root"></div><script language="javascript" type="text/javascript">(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/'.$oFlang.'/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs);}(document, \'script\', \'facebook-jssdk\'));</script>';

$data = $data.'<script language="javascript" type="text/javascript">//<![CDATA[
document.write(\'<fb:like href="'.$oFlink.'" width="'.$oFwidth.'" colorscheme="'.$oFcolor.'" show_faces="'.$oFfaces.'" font="'.$oFfont.'" send="'.$oFshowSend.'" layout="'.$oFstyle.'" action="'.$oFverb.'"></fb:like> \');

//]]>
</script> <div style="display:none; position: relative; height: 15px; width: 100%; font-size: 10px; color: #808080; font-weight: normal; font-family: \'lucida grande\',tahoma,verdana,arial,sans-serif; line-height: 1.28; text-align: right; direction: ltr;"><a href="'.$oFBLink.'" target="_blank" style="color: #808080;"> <img alt="OSense" src="'.$oFBLinkImg.'" style="visibility:visible; zoom: 1; opacity: 1; vertical-align: text-top;" /> '.$oFBLinkTitle.'</a></div>';
}else { 
//iFrame 

$oFsource ="http://www.facebook.com/plugins/like.php?locale=".$oFlang."&href=".$oFlink."&width=".$oFwidth .
"&colorscheme=".$oFcolor."&show_faces=".$oFfaces .

"&send=".$oFshowSend."&layout=".$oFstyle."&font=".$oFfont."&action=".$oFverb."&height=26";

$data = '<iframe src="'.$oFsource.'" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:'.$oFwidth.'px; height:26px;" allowTransparency="true"></iframe> <div style="display:none; position: relative; height: 15px; width: 100%; font-size: 10px; color: #808080; font-weight: normal; font-family: \'lucida grande\',tahoma,verdana,arial,sans-serif; line-height: 1.28; text-align: right; direction: ltr;"><a href="'.$oFBLink.'" target="_blank" style="color: #808080;"> <img alt="OSense" src="'.$oFBLinkImg.'" style="visibility:visible; zoom: 1; opacity: 1; vertical-align: text-top;" /> '.$oFBLinkTitle.'</a></div>';

}


return $data;

}
}

What I want to do is to share http link and to show the shares from http link, in this moment I can share the http link, but I see the https shares.

 

In Facebook Object Debugger you can see if I check the http link I see the https shares, if I check the https link I see the http shares.

 

So how to share http and see http shares not https?

 

 

The op is calling the content being shared as shares.

 

see this area?

if ($lang->getTag() == 'it-IT') {
$pageurl = 'http://'.$_SERVER['HTTP_HOST'].$urls;

$spageurl = 'https://'.$_SERVER['HTTP_HOST'].$urls;
} else {
$pageurl = 'http://'.$_SERVER['HTTP_HOST'].$urls;

$spageurl = 'https://'.$_SERVER['HTTP_HOST'].$urls;

}

remove the links that have https, I'll comment them out

if ($lang->getTag() == 'it-IT') {
$pageurl = 'http://'.$_SERVER['HTTP_HOST'].$urls;

//$spageurl = 'https://'.$_SERVER['HTTP_HOST'].$urls;
} else {
$pageurl = 'http://'.$_SERVER['HTTP_HOST'].$urls;

//$spageurl = 'https://'.$_SERVER['HTTP_HOST'].$urls;

}
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.