socleverloginsharing - Version 1.0.0

Version Notes

Released Stable Version 1.0.0

Download this release

Release Info

Developer Soclever Social
Extension socleverloginsharing
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (23) hide show
  1. app/code/local/Soclever/Socialloginsharing/Block/Scslhead.php +13 -0
  2. app/code/local/Soclever/Socialloginsharing/Block/Scslheadfb.php +13 -0
  3. app/code/local/Soclever/Socialloginsharing/Block/Scslshow.php +18 -0
  4. app/code/local/Soclever/Socialloginsharing/Block/Scsltrackpixel.php +13 -0
  5. app/code/local/Soclever/Socialloginsharing/Block/Scsshead.php +13 -0
  6. app/code/local/Soclever/Socialloginsharing/Block/Scsshow.php +13 -0
  7. app/code/local/Soclever/Socialloginsharing/Helper/Data.php +6 -0
  8. app/code/local/Soclever/Socialloginsharing/Model/Observer.php +33 -0
  9. app/code/local/Soclever/Socialloginsharing/Model/Providers.php +111 -0
  10. app/code/local/Soclever/Socialloginsharing/controllers/IndexController.php +437 -0
  11. app/code/local/Soclever/Socialloginsharing/controllers/openid.php +797 -0
  12. app/code/local/Soclever/Socialloginsharing/etc/config.xml +129 -0
  13. app/code/local/Soclever/Socialloginsharing/etc/system.xml +170 -0
  14. app/design/frontend/base/default/layout/socialloginsharing.xml +38 -0
  15. app/design/frontend/base/default/template/socialloginsharing/scsl_buttons.phtml +36 -0
  16. app/design/frontend/base/default/template/socialloginsharing/sociallogin_fb.phtml +2 -0
  17. app/design/frontend/base/default/template/socialloginsharing/sociallogin_head.phtml +15 -0
  18. app/design/frontend/base/default/template/socialloginsharing/sociallogin_trackpixel.phtml +11 -0
  19. app/design/frontend/base/default/template/socialloginsharing/socialshare_head.phtml +13 -0
  20. app/design/frontend/base/default/template/socialloginsharing/socialshare_product.phtml +305 -0
  21. app/design/frontend/base/default/template/socialloginsharing/socialshare_show.phtml +316 -0
  22. app/etc/modules/soclever_socialloginsharing.xml +9 -0
  23. package.xml +39 -0
app/code/local/Soclever/Socialloginsharing/Block/Scslhead.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Soclever_Socialloginsharing_Block_Scslhead extends Mage_Core_Block_Template
3
+ {
4
+ protected function _construct(){
5
+ parent::_construct();
6
+
7
+ }
8
+ public function _prepareLayout(){
9
+ return parent::_prepareLayout();
10
+ }
11
+ }
12
+
13
+ ?>
app/code/local/Soclever/Socialloginsharing/Block/Scslheadfb.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Soclever_Socialloginsharing_Block_Scslheadfb extends Mage_Core_Block_Template
3
+ {
4
+ protected function _construct(){
5
+ parent::_construct();
6
+
7
+ }
8
+ public function _prepareLayout(){
9
+ return parent::_prepareLayout();
10
+ }
11
+ }
12
+
13
+ ?>
app/code/local/Soclever/Socialloginsharing/Block/Scslshow.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Soclever_Socialloginsharing_Block_Scslshow extends Mage_Core_Block_Template
3
+ {
4
+ protected function _construct(){
5
+ parent::_construct();
6
+ $this->setTemplate('socialloginsharing/scsl_buttons.phtml');
7
+ }
8
+ public function setPlace($place) {
9
+ $this->place = $place;
10
+ return $this;
11
+ }
12
+
13
+ /*public function _prepareLayout(){
14
+ return parent::_prepareLayout();
15
+ }*/
16
+ }
17
+
18
+ ?>
app/code/local/Soclever/Socialloginsharing/Block/Scsltrackpixel.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Soclever_Socialloginsharing_Block_Scsltrackpixel extends Mage_Core_Block_Template
3
+ {
4
+ protected function _construct(){
5
+ parent::_construct();
6
+
7
+ }
8
+ public function _prepareLayout(){
9
+ return parent::_prepareLayout();
10
+ }
11
+ }
12
+
13
+ ?>
app/code/local/Soclever/Socialloginsharing/Block/Scsshead.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Soclever_Socialloginsharing_Block_Scsshead extends Mage_Core_Block_Template
3
+ {
4
+ protected function _construct(){
5
+ parent::_construct();
6
+
7
+ }
8
+ public function _prepareLayout(){
9
+ return parent::_prepareLayout();
10
+ }
11
+ }
12
+
13
+ ?>
app/code/local/Soclever/Socialloginsharing/Block/Scsshow.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Soclever_Socialloginsharing_Block_Scsshow extends Mage_Core_Block_Template
3
+ {
4
+ protected function _construct(){
5
+ parent::_construct();
6
+
7
+ }
8
+ public function _prepareLayout(){
9
+ return parent::_prepareLayout();
10
+ }
11
+ }
12
+
13
+ ?>
app/code/local/Soclever/Socialloginsharing/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class Soclever_Socialloginsharing_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ }
6
+ ?>
app/code/local/Soclever/Socialloginsharing/Model/Observer.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Soclever_Socialloginsharing_Model_Observer
3
+ {
4
+
5
+
6
+ public function writejs(Varien_Event_Observer $observer)
7
+ {
8
+
9
+ $site_id=Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid');
10
+ $api_secret=Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_appsecret');
11
+ $api_key=Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_appid');
12
+
13
+
14
+
15
+ $valid_data=file_get_contents("https://www.socleversocial.com/dashboard/mage_sharelogin_activate.php?site_id=".$site_id."&api_key=".$api_key."&api_secret=".$api_secret."&csplatform=magentologin&type=preview");
16
+ if($valid_data!='0')
17
+ {
18
+ Mage::getModel('core/config')->saveConfig('socialloginsharing_options/apisettings/scsl_validated',"1");
19
+ Mage::getModel('core/config')->saveConfig('socialloginsharing_options/apisettings/valid_networks',$valid_data);
20
+
21
+ }
22
+ else
23
+ {
24
+ Mage::getModel('core/config')->saveConfig('socialloginsharing_options/apisettings/scsl_validated',"0");
25
+ }
26
+
27
+
28
+ }
29
+
30
+ }
31
+
32
+
33
+ ?>
app/code/local/Soclever/Socialloginsharing/Model/Providers.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Soclever_Socialloginsharing_Model_Providers
4
+ {
5
+ public function getbuttonstyles()
6
+ {
7
+ $buttonstylesarray=array("ic"=>"Icons","fc"=>"Full Logos - Colored","fg"=>"Full Logos - Grey");
8
+ return $buttonstylesarray;
9
+
10
+ }
11
+ public function getsizes()
12
+ {
13
+
14
+ $buttonsizearray=array("30"=>"30px","40"=>"40px","50"=>"50px","60"=>"60px","65"=>"65px");
15
+ return $buttonsizearray;
16
+ }
17
+
18
+ public function getproviders()
19
+ {
20
+ return array(
21
+ array('value'=>0, 'label'=>'None'),
22
+ array('value'=>2, 'label'=>'Facebook'),
23
+ array('value'=>4, 'label'=>'Google+'),
24
+ array('value'=>7, 'label'=>'LinkedIN'),
25
+ array('value'=>13, 'label'=>'Twitter'),
26
+ array('value'=>17, 'label'=>'Pinterest'),
27
+ array('value'=>18, 'label'=>'Whatsapp'),
28
+ );
29
+ /*$providers=array("2"=>"Facebook","4"=>"Google+","7"=>"LinkedIN","13"=>"Twitter","17"=>"Pinterest");
30
+ return $providers;*/
31
+ }
32
+ public function getloginproviders()
33
+ {
34
+ return array(
35
+ array('value'=>0, 'label'=>'None'),
36
+ array('value'=>2, 'label'=>'Facebook'),
37
+ array('value'=>4, 'label'=>'Google+'),
38
+ array('value'=>7, 'label'=>'LinkedIN'),
39
+ array('value'=>13, 'label'=>'Yahoo!'),
40
+ array('value'=>16, 'label'=>'Paypal'),
41
+ array('value'=>8, 'label'=>'Microsoft'),
42
+ );
43
+ /*$providers=array("2"=>"Facebook","4"=>"Google+","7"=>"LinkedIN","13"=>"Twitter","17"=>"Pinterest");
44
+ return $providers;*/
45
+ }
46
+ public function getcounters()
47
+ {
48
+ /*return array(
49
+ array('value'=>2, 'label'=>'No Counter'),
50
+ array('value'=>1, 'label'=>'Vertical Counter'),
51
+ array('value'=>0, 'label'=>'Horizontal Counter'),
52
+ );*/
53
+ $countersarray=array("2"=>"No Conter","1"=>"Vertical Counter","0"=>"Horizontal Counter");
54
+ //$countersarray=array("2"=>"No Conter");
55
+ return $countersarray;
56
+ }
57
+ public function getgaps()
58
+ {
59
+ $gaparr=array();
60
+ for($i=0;$i<=20;$i++)
61
+ {
62
+ $gaparr[$i]=$i;
63
+ }
64
+ return $gaparr;
65
+
66
+ }
67
+ public function geticonsize()
68
+ {
69
+ $iconsize=array();
70
+ $iconsize=array("30x30"=>"30X30","32x32"=>"32X32","40x40"=>"40X40","50x50"=>"50X50","60x60"=>"60X60","70x70"=>"70X70","85x85"=>"85X85","100x100"=>"100X100");
71
+ return $iconsize;
72
+
73
+ }
74
+ public function displaystyle()
75
+ {
76
+ $displaysize=array();
77
+ $displaysize=array("0"=>"Horizontal","1"=>"Vertical Left","2"=>"Vertical Right");
78
+ return $displaysize;
79
+
80
+ }
81
+ public function yourstyle()
82
+ {
83
+ $yourstyle=array();
84
+ $yourstyle=array("2"=>'Rounded Corner',"3"=>'Transparent Grey',"4"=>'Rounded Black',"5"=>'Flower',
85
+ "6"=>'Glossy',"7"=>'Leaf',"8"=>'Polygon',"10"=>'Rectangular',"11"=>'Waterdrop');
86
+ return $yourstyle;
87
+
88
+ }
89
+ public function sharewithautho()
90
+ {
91
+ $sharewithautho=array();
92
+ $sharewithautho=array("0"=>"No","1"=>"Yes");
93
+ return $sharewithautho;
94
+
95
+ }
96
+ public function getpreview()
97
+ {
98
+ return array("0"=>"Good");
99
+ }
100
+ public function gethelphtml()
101
+ {
102
+ $help_date="<h1>Help..............</h1>";
103
+ return array("0"=>$help_date);
104
+ }
105
+
106
+
107
+
108
+ }
109
+
110
+
111
+ ?>
app/code/local/Soclever/Socialloginsharing/controllers/IndexController.php ADDED
@@ -0,0 +1,437 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Soclever_Socialloginsharing_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->renderLayout();
8
+ }
9
+ protected function getSession(){
10
+ return Mage::getSingleton('customer/session');
11
+ }
12
+ public function fbloginAction()
13
+ {
14
+
15
+ if(isset($_GET['lc']) && $_GET['lc']!='')
16
+ {
17
+ setcookie('lc',$_GET['lc'],time()+100,'/');
18
+ setcookie('lch',$_GET['lch'],time()-100,'/');
19
+
20
+ }
21
+ if(isset($_GET['lch']) && $_GET['lch']!='')
22
+ {
23
+ setcookie('lch',$_GET['lch'],time()+100,'/');
24
+ setcookie('lc',$_GET['lc'],time()-100,'/');
25
+
26
+ }
27
+ $get_fb=file_get_contents("https://www.socleversocial.com/dashboard/get_fb_data.php?siteid=".Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid')."");
28
+
29
+ if($get_fb!='0')
30
+ {
31
+ $app_arr=explode("~",$get_fb);
32
+ $app_id = $app_arr[0];
33
+ $my_url="".Mage::getBaseUrl()."soclever_socialloginsharing/index/fblogin";
34
+ $app_secret = $app_arr[1];
35
+ $code = $_REQUEST["code"];
36
+ if(isset($_REQUEST['error'])){
37
+ if(isset($_REQUEST['error_reason']) && $_REQUEST['error_reason']=='user_denied'){
38
+
39
+ echo $_REQUEST['error'];
40
+ echo"<br/><a href='".Mage::getBaseUrl()."'>Go to site</a>";
41
+ exit;
42
+ }
43
+ }
44
+
45
+ if(empty($code)) {
46
+ $dialog_url = "http://www.facebook.com/dialog/oauth?client_id="
47
+ . $app_id . "&redirect_uri=" . urlencode($my_url)."&scope=email,user_birthday,user_relationships,user_location,user_hometown,user_friends,user_likes";
48
+
49
+ echo("<script>top.location.href='".$dialog_url."'</script>");
50
+ }
51
+
52
+ $token_url = "https://graph.facebook.com/oauth/access_token?client_id="
53
+ . $app_id . "&redirect_uri=" . urlencode($my_url) . "&client_secret="
54
+ . $app_secret . "&code=" . $code;
55
+
56
+ $ch = curl_init();
57
+
58
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
59
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
60
+ curl_setopt($ch, CURLOPT_VERBOSE, 1);
61
+ curl_setopt($ch, CURLOPT_TIMEOUT, 30);
62
+ curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
63
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
64
+
65
+ //Get Access Token
66
+ curl_setopt($ch, CURLOPT_URL,$token_url);
67
+ $access_token = curl_exec($ch);
68
+
69
+ curl_close($ch);
70
+
71
+
72
+ $graph_url = "https://graph.facebook.com/v2.2/me?" . $access_token."&fields=id,name,first_name,last_name,timezone,email,picture,gender,locale,birthday,relationship_status,location,hometown,friends.limit%280%29,likes{id,name}";
73
+ $ch = curl_init();
74
+ curl_setopt($ch, CURLOPT_HEADER, 0);
75
+ curl_setopt($ch, CURLOPT_URL, $graph_url);
76
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
77
+ curl_setopt($ch, CURLOPT_TIMEOUT, 30);
78
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
79
+ $temp_user = curl_exec($ch);
80
+ curl_close($ch);
81
+ $fbuser_old = $temp_user;
82
+ $fbuser=json_decode($fbuser_old);
83
+
84
+ if($fbuser_old && $fbuser->email!="")
85
+ {
86
+ $request_url="https://www.socleversocial.com/dashboard/track_register_new.php?app_id=".$app_id."&is_fb=1&friend_data=".$fbuser->friends->summary->total_count."&siteid=".Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid')."&other=".urlencode($fbuser_old);
87
+ $resPonse=file_get_contents($request_url);
88
+ if($resPonse)
89
+ {
90
+ $fb_data=json_decode($resPonse);
91
+
92
+ $resource = Mage::getSingleton('core/resource');
93
+ $tableName = $resource->getTableName('customer_entity');
94
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
95
+ $sql = "Select entity_id from ".$tableName." where email='".$fb_data->email."' limit 1";
96
+ $rows= $connection->fetchAll($sql);
97
+
98
+ $customer = Mage::getModel("customer/customer");
99
+ if(count($rows) > 0)
100
+ {
101
+ $is_new='0';
102
+ $username=$fb_data->email;
103
+ $customer_id=$rows[0]['entity_id'];
104
+ }
105
+ else
106
+ {
107
+ $is_new='1';
108
+ $store = Mage::app()->getStore();
109
+
110
+ $customer->website_id = $websiteId;
111
+ $customer->setStore($store);
112
+ $password=rand("111111","9999999");
113
+ $customer->firstname = $fb_data->first_name;
114
+ $customer->lastname = $fb_data->last_name;
115
+ $customer->email =$fb_data->email;
116
+ $customer->password_hash = md5($password);
117
+ $customer->save();
118
+ $username=$fb_data->email;
119
+ $sql= "Select entity_id from ".$tableName." where email='".$fb_data->email."' limit 1";
120
+ $rows= $connection->fetchAll($sql);
121
+ $customer_id=$rows[0]['entity_id'];
122
+ }
123
+
124
+ file_get_contents("https://www.socleversocial.com/dashboard/track_register_new.php?is_from=1&siteUid=".$customer_id."&is_new=".$is_new."&member_id=".$fb_data->member_id."&siteid=".Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid')."&action=notifycs");
125
+ Mage::getModel('core/session', array('name' => 'frontend'));
126
+ $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
127
+ $customer->loadByEmail($username);
128
+
129
+ $redirect_location=($_COOKIE['lc']=='c')?Mage::getBaseUrl()."checkout/onepage/":Mage::getBaseUrl()."customer/account/";
130
+ if(isset($_COOKIE['lch']) && $_COOKIE['lch']!='')
131
+ {
132
+ $redirect_location=$_COOKIE['lch'];
133
+ }
134
+ $is_from='1';
135
+ Mage::getSingleton('core/session')->setSessionVariable($is_from);
136
+ ?>
137
+ <script type="text/javascript">
138
+
139
+ setTimeout(function(){
140
+
141
+
142
+ window.location.href="<?php echo $redirect_location;?>";
143
+
144
+ },1000);
145
+
146
+ /*setTimeout(function(){
147
+
148
+
149
+ window.close();
150
+ //window.opener.location = window.opener.window.location;
151
+
152
+ /*try{
153
+ if(parent.window.opener != null && ! parent.window.opener)
154
+ {
155
+ alert("good");
156
+ }
157
+
158
+ }catch(e){ alert("message="+e.description);}
159
+ */
160
+
161
+ //alert("called redirection=="+top.window.opener.document.URL+"=");
162
+ //top.window.location.assign("<?php echo Mage::getBaseUrl();?>customer/account/edit/");
163
+
164
+ // top.window.location.href="<?php echo Mage::getBaseUrl();?>customer/account/edit/";
165
+ //close();
166
+ //return false;
167
+ /*if(top.window.opener.document.URL.indexOf('login') > -1)
168
+ {
169
+ top.window.opener.location.href="<?php echo Mage::getBaseUrl();?>customer/account/edit/";
170
+ close();
171
+ }
172
+ else
173
+ {
174
+ top.window.opener.location.href="<?php echo Mage::getBaseUrl();?>checkout/onepage/";
175
+ close();
176
+
177
+ }*/
178
+
179
+ /*}, 3000);*/
180
+ </script>
181
+ <?php
182
+ //echo"<img src='https://www.socleversocial.com/dashboard/images/pw.gif' alt='wait!' title='wait!'>";
183
+ $this->getSession()->loginById($customer->getId());
184
+ exit;
185
+ }
186
+ }
187
+ }
188
+ else
189
+ {
190
+
191
+ echo"<h1>Login failed.</h1><a href='".Mage::getBaseUrl()."'>Go back to site.</a>";
192
+ }
193
+ }
194
+ public function pploginAction()
195
+ {
196
+ $paypal_data=json_decode($_GET['data']);
197
+
198
+ $resource = Mage::getSingleton('core/resource');
199
+ $tableName = $resource->getTableName('customer_entity');
200
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
201
+ $sql = "Select entity_id from ".$tableName." where email='".$paypal_data->email."' limit 1";
202
+ $rows= $connection->fetchAll($sql);
203
+
204
+ $customer = Mage::getModel("customer/customer");
205
+ if(count($rows) > 0)
206
+ {
207
+ $is_new='0';
208
+ $username=$paypal_data->email;
209
+ $customer_id=$rows[0]['entity_id'];
210
+ }
211
+ else
212
+ {
213
+ $is_new='1';
214
+ $store = Mage::app()->getStore();
215
+
216
+ $customer->website_id = $websiteId;
217
+ $customer->setStore($store);
218
+ $password=rand("111111","9999999");
219
+ $customer->firstname = $paypal_data->first_name;
220
+ $customer->lastname = $paypal_data->last_name;
221
+ $customer->email =$paypal_data->email;
222
+ $customer->password_hash = md5($password);
223
+ $customer->save();
224
+ $username=$paypal_data->email;
225
+ $sql= "Select entity_id from ".$tableName." where email='".$paypal_data->email."' limit 1";
226
+ $rows= $connection->fetchAll($sql);
227
+ $customer_id=$rows[0]['entity_id'];
228
+ }
229
+
230
+ file_get_contents("https://www.socleversocial.com/dashboard/track_register_new.php?is_from=7&siteUid=".$customer_id."&is_new=".$is_new."&member_id=".$paypal_data->member_id."&siteid=".Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid')."&action=notifycs");
231
+ Mage::getModel('core/session', array('name' => 'frontend'));
232
+ $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
233
+ $customer->loadByEmail($username);
234
+ $redirect_location=($_GET['lc']=='c')?Mage::getBaseUrl()."checkout/onepage/":Mage::getBaseUrl()."customer/account/";
235
+ $is_from='7';
236
+ Mage::getSingleton('core/session')->setSessionVariable($is_from);
237
+ ?>
238
+ <script type="text/javascript">
239
+ setTimeout(function(){ window.location.href="<?php echo $redirect_location; ?>"; },1000);
240
+ </script>
241
+ <?php
242
+ //echo"<img src='https://www.socleversocial.com/dashboard/images/pw.gif' alt='wait!' title='wait!'>";
243
+ $this->getSession()->loginById($customer->getId());
244
+ exit;
245
+ }
246
+
247
+
248
+ public function cs_redirect($red)
249
+ {
250
+ echo $red;
251
+ exit;
252
+ }
253
+ public function yahoologinAction()
254
+ {
255
+ require 'openid.php';
256
+
257
+ try
258
+ {
259
+
260
+
261
+ $openid = new LightOpenID($_SERVER['HTTP_HOST']);
262
+
263
+
264
+ if(!$openid->mode)
265
+ {
266
+
267
+ //do the login
268
+ if(isset($_GET['login']))
269
+ {
270
+ //The google openid url
271
+ $openid->identity = 'https://me.yahoo.com';
272
+
273
+ //Get additional google account information about the user , name , email , country
274
+ $openid->required = array('contact/email','person/guid','dob','birthDate','namePerson' , 'person/gender' , 'pref/language' , 'media/image/default','birthDate/birthday');
275
+
276
+ //start discovery
277
+
278
+
279
+ header('Location: ' . $openid->authUrl());
280
+ }
281
+
282
+
283
+ }
284
+
285
+ else if($openid->mode == 'cancel')
286
+ {
287
+ echo 'User has canceled authentication!';
288
+ //redirect back to login page ??
289
+ }
290
+
291
+ //Echo login information by default
292
+ else
293
+ {
294
+ if($openid->validate())
295
+ {
296
+ $is_from='5';
297
+ Mage::getSingleton('core/session')->setSessionVariable($is_from);
298
+ $d = $openid->getAttributes();
299
+ //echo "https://www.socleversocial.com/dashboard/track_register_new.php?is_yh=1&is_from=5&siteid=".Mage::getStoreConfig('socialloginsharing_options_options/apisettings/scsl_siteid')."&other=".json_encode($d)."";
300
+ /*$response_content=file_get_contents("https://www.socleversocial.com/dashboard/track_register_new.php?is_yh=1&is_from=5&siteid=".Mage::getStoreConfig('socialloginsharing_options_options/apisettings/scsl_siteid')."&other=".json_encode($d)."");
301
+ if($response_content)
302
+ {
303
+ $response_final=json_decode($response_content);
304
+ print_r($response_final);
305
+ exit;
306
+ }*/
307
+ ?>
308
+ <script src="//ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js"></script>
309
+ <script type="text/javascript">
310
+ var xmlhttp;
311
+ if(window.XMLHttpRequest)
312
+ {
313
+ xmlhttp=new XMLHttpRequest();
314
+ }
315
+ else
316
+ {
317
+ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
318
+ }
319
+ function track_info_yh(info)
320
+ {
321
+ xmlhttp.onreadystatechange=function()
322
+ {
323
+ if (xmlhttp.readyState==4 && xmlhttp.status==200)
324
+ {
325
+ var gobj=JSON.parse(xmlhttp.responseText);
326
+ var login_src='5';
327
+
328
+ var request = new Ajax.Request("<?php echo Mage::getBaseUrl();?>soclever_socialloginsharing/index/login",
329
+ {
330
+ method: 'post',
331
+ parameters: {member_id: gobj.member_id, email:gobj.email,first_name:gobj.first_name,last_name:gobj.last_name,site_id:<?php echo Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid'); ?>,is_from:login_src},
332
+ onSuccess: function(transport){
333
+ if(transport.responseText)
334
+ {
335
+
336
+ if(opener.document.URL.indexOf('checkout') > -1)
337
+ {
338
+ opener.location.href="<?php echo Mage::getBaseUrl();?>checkout/onepage/";
339
+ close();
340
+
341
+ }
342
+ else
343
+ {
344
+ opener.location.href="<?php echo Mage::getBaseUrl();?>customer/account/";
345
+ close();
346
+
347
+ }
348
+ }
349
+
350
+ }
351
+ });
352
+
353
+
354
+
355
+ }
356
+ }
357
+ xmlhttp.open("GET",'https://www.socleversocial.com/dashboard/track_register_new.php?is_yh=1&is_from=5&siteid=<?php echo Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid'); ?>&other='+encodeURIComponent(info),true);
358
+ xmlhttp.send();
359
+
360
+ }
361
+ track_info_yh('<?php echo json_encode($d); ?>');
362
+ </script>
363
+
364
+
365
+ <?php
366
+ exit;
367
+
368
+
369
+ }
370
+ else
371
+ {
372
+ //user is not logged in
373
+ }
374
+ }
375
+ }
376
+
377
+ catch(ErrorException $e)
378
+ {
379
+ echo $e->getMessage();
380
+ }
381
+
382
+ }
383
+ public function loginAction()
384
+ {
385
+
386
+ $resource = Mage::getSingleton('core/resource');
387
+ $tableName = $resource->getTableName('customer_entity');
388
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
389
+ $sql = "Select entity_id from ".$tableName." where email='{$_POST['email']}' limit 1";
390
+ $rows =$connection->fetchAll($sql);
391
+
392
+ $customer = Mage::getModel("customer/customer");
393
+ if(count($rows) > 0)
394
+ {
395
+ $is_new='0';
396
+ $username=$_POST['email'];
397
+ $customer_id=$rows[0]['entity_id'];
398
+ }
399
+ else
400
+ {
401
+ $is_new='1';
402
+ $store = Mage::app()->getStore();
403
+
404
+ $customer->website_id = $websiteId;
405
+ $customer->setStore($store);
406
+ $password=rand("111111","9999999");
407
+ $customer->firstname = $_POST['first_name'];
408
+ $customer->lastname = $_POST['last_name'];
409
+ $customer->email = $_POST['email'];
410
+ $customer->password_hash = md5($password);
411
+ $customer->save();
412
+ $username=$_POST['email'];
413
+ $sql = "Select entity_id from ".$tableName." where email='{$_POST['email']}' limit 1";
414
+ $rows= $connection->fetchAll($sql);
415
+ $customer_id=$rows[0]['entity_id'];
416
+ }
417
+
418
+ file_get_contents("https://www.socleversocial.com/dashboard/track_register_new.php?is_from=".$_POST['is_from']."&siteUid=".$customer_id."&is_new=".$is_new."&member_id=".$_POST['member_id']."&siteid=".$_POST['site_id']."&action=notifycs");
419
+
420
+ Mage::getModel('core/session', array('name' => 'frontend'));
421
+ $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
422
+ $customer->loadByEmail($username);
423
+ $this->getSession()->loginById($customer->getId());
424
+
425
+ if(Mage::getSingleton('customer/session')->isLoggedIn())
426
+ {
427
+ $is_from=$_POST['is_from'];
428
+ Mage::getSingleton('core/session')->setSessionVariable($is_from);
429
+ exit("1");
430
+ }
431
+
432
+
433
+
434
+ }
435
+
436
+ }
437
+ ?>
app/code/local/Soclever/Socialloginsharing/controllers/openid.php ADDED
@@ -0,0 +1,797 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class LightOpenID
3
+ {
4
+
5
+ public $returnUrl
6
+ , $required = array()
7
+ , $optional = array()
8
+ , $verify_peer = null
9
+ , $capath = null
10
+ , $cainfo = null
11
+ , $data,$clientSite;
12
+ private $identity, $claimed_id;
13
+ protected $server, $version, $trustRoot, $aliases, $identifier_select = false
14
+ , $ax = false, $sreg = false, $setup_url = null, $headers = array();
15
+ static protected $ax_to_sreg = array(
16
+ 'namePerson/friendly' => 'nickname',
17
+ 'contact/email' => 'email',
18
+ 'namePerson' => 'fullname',
19
+ 'birthDate' => 'dob',
20
+ 'person/gender' => 'gender',
21
+ 'contact/postalCode/home' => 'postcode',
22
+ 'contact/country/home' => 'country',
23
+ 'pref/language' => 'language',
24
+ 'pref/timezone' => 'timezone',
25
+ );
26
+
27
+
28
+ function __construct($host)
29
+ {
30
+
31
+ $this->trustRoot = (strpos($host, '://') ? $host : 'http://' . $host);
32
+ if ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')
33
+ || (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])
34
+ && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
35
+ ) {
36
+ $this->trustRoot = (strpos($host, '://') ? $host : 'https://' . $host);
37
+ }
38
+
39
+ if(($host_end = strpos($this->trustRoot, '/', 8)) !== false) {
40
+ $this->trustRoot = substr($this->trustRoot, 0, $host_end);
41
+ }
42
+
43
+ $uri = rtrim(preg_replace('#((?<=\?)|&)openid\.[^&]+#', '', $_SERVER['REQUEST_URI']), '?');
44
+ $this->returnUrl = $this->trustRoot . $uri;
45
+
46
+ $this->data = ($_SERVER['REQUEST_METHOD'] === 'POST') ? $_POST : $_GET;
47
+
48
+ if(!function_exists('curl_init') && !in_array('https', stream_get_wrappers())) {
49
+ throw new ErrorException('You must have either https wrappers or curl enabled.');
50
+ }
51
+ }
52
+
53
+ function __set($name, $value)
54
+ {
55
+ switch ($name) {
56
+ case 'identity':
57
+ if (strlen($value = trim((String) $value))) {
58
+ if (preg_match('#^xri:/*#i', $value, $m)) {
59
+ $value = substr($value, strlen($m[0]));
60
+ } elseif (!preg_match('/^(?:[=@+\$!\(]|https?:)/i', $value)) {
61
+ $value = "http://$value";
62
+ }
63
+ if (preg_match('#^https?://[^/]+$#i', $value, $m)) {
64
+ $value .= '/';
65
+ }
66
+ }
67
+ $this->$name = $this->claimed_id = $value;
68
+ break;
69
+ case 'trustRoot':
70
+ case 'realm':
71
+ $this->trustRoot = trim($value);
72
+ }
73
+ }
74
+
75
+ function __get($name)
76
+ {
77
+ switch ($name) {
78
+ case 'identity':
79
+ # We return claimed_id instead of identity,
80
+ # because the developer should see the claimed identifier,
81
+ # i.e. what he set as identity, not the op-local identifier (which is what we verify)
82
+ return $this->claimed_id;
83
+ case 'trustRoot':
84
+ case 'realm':
85
+ return $this->trustRoot;
86
+ case 'mode':
87
+ return empty($this->data['openid_mode']) ? null : $this->data['openid_mode'];
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Checks if the server specified in the url exists.
93
+ *
94
+ * @param $url url to check
95
+ * @return true, if the server exists; false otherwise
96
+ */
97
+ function hostExists($url)
98
+ {
99
+ if (strpos($url, '/') === false) {
100
+ $server = $url;
101
+ } else {
102
+ $server = @parse_url($url, PHP_URL_HOST);
103
+ }
104
+
105
+ if (!$server) {
106
+ return false;
107
+ }
108
+
109
+ return !!gethostbynamel($server);
110
+ }
111
+
112
+ protected function request_curl($url, $method='GET', $params=array(), $update_claimed_id)
113
+ {
114
+ $params = http_build_query($params, '', '&');
115
+ $curl = curl_init($url . ($method == 'GET' && $params ? '?' . $params : ''));
116
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
117
+ curl_setopt($curl, CURLOPT_HEADER, false);
118
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
119
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
120
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/xrds+xml, */*'));
121
+
122
+ if($this->verify_peer !== null) {
123
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
124
+ if($this->capath) {
125
+ curl_setopt($curl, CURLOPT_CAPATH, $this->capath);
126
+ }
127
+
128
+ if($this->cainfo) {
129
+ curl_setopt($curl, CURLOPT_CAINFO, $this->cainfo);
130
+ }
131
+ }
132
+
133
+ if ($method == 'POST') {
134
+ curl_setopt($curl, CURLOPT_POST, true);
135
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
136
+ } elseif ($method == 'HEAD') {
137
+ curl_setopt($curl, CURLOPT_HEADER, true);
138
+ curl_setopt($curl, CURLOPT_NOBODY, true);
139
+ } else {
140
+ curl_setopt($curl, CURLOPT_HEADER, true);
141
+ curl_setopt($curl, CURLOPT_HTTPGET, true);
142
+ }
143
+ $response = curl_exec($curl);
144
+
145
+ if($method == 'HEAD' && curl_getinfo($curl, CURLINFO_HTTP_CODE) == 405) {
146
+ curl_setopt($curl, CURLOPT_HTTPGET, true);
147
+ $response = curl_exec($curl);
148
+ $response = substr($response, 0, strpos($response, "\r\n\r\n"));
149
+ }
150
+
151
+ if($method == 'HEAD' || $method == 'GET') {
152
+ $header_response = $response;
153
+
154
+ # If it's a GET request, we want to only parse the header part.
155
+ if($method == 'GET') {
156
+ $header_response = substr($response, 0, strpos($response, "\r\n\r\n"));
157
+ }
158
+
159
+ $headers = array();
160
+ foreach(explode("\n", $header_response) as $header) {
161
+ $pos = strpos($header,':');
162
+ if ($pos !== false) {
163
+ $name = strtolower(trim(substr($header, 0, $pos)));
164
+ $headers[$name] = trim(substr($header, $pos+1));
165
+ }
166
+ }
167
+
168
+ if($update_claimed_id) {
169
+ # Updating claimed_id in case of redirections.
170
+ $effective_url = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
171
+ if($effective_url != $url) {
172
+ $this->identity = $this->claimed_id = $effective_url;
173
+ }
174
+ }
175
+
176
+ if($method == 'HEAD') {
177
+ return $headers;
178
+ } else {
179
+ $this->headers = $headers;
180
+ }
181
+ }
182
+
183
+ if (curl_errno($curl)) {
184
+ throw new ErrorException(curl_error($curl), curl_errno($curl));
185
+ }
186
+
187
+ return $response;
188
+ }
189
+
190
+ protected function parse_header_array($array, $update_claimed_id)
191
+ {
192
+ $headers = array();
193
+ foreach($array as $header) {
194
+ $pos = strpos($header,':');
195
+ if ($pos !== false) {
196
+ $name = strtolower(trim(substr($header, 0, $pos)));
197
+ $headers[$name] = trim(substr($header, $pos+1));
198
+
199
+ # Following possible redirections. The point is just to have
200
+ # claimed_id change with them, because the redirections
201
+ # are followed automatically.
202
+ # We ignore redirections with relative paths.
203
+ # If any known provider uses them, file a bug report.
204
+ if($name == 'location' && $update_claimed_id) {
205
+ if(strpos($headers[$name], 'http') === 0) {
206
+ $this->identity = $this->claimed_id = $headers[$name];
207
+ } elseif($headers[$name][0] == '/') {
208
+ $parsed_url = parse_url($this->claimed_id);
209
+ $this->identity =
210
+ $this->claimed_id = $parsed_url['scheme'] . '://'
211
+ . $parsed_url['host']
212
+ . $headers[$name];
213
+ }
214
+ }
215
+ }
216
+ }
217
+ return $headers;
218
+ }
219
+
220
+ protected function request_streams($url, $method='GET', $params=array(), $update_claimed_id)
221
+ {
222
+ if(!$this->hostExists($url)) {
223
+ throw new ErrorException("Could not connect to $url.", 404);
224
+ }
225
+
226
+ $params = http_build_query($params, '', '&');
227
+ switch($method) {
228
+ case 'GET':
229
+ $opts = array(
230
+ 'http' => array(
231
+ 'method' => 'GET',
232
+ 'header' => 'Accept: application/xrds+xml, */*',
233
+ 'ignore_errors' => true,
234
+ ), 'ssl' => array(
235
+ 'CN_match' => parse_url($url, PHP_URL_HOST),
236
+ ),
237
+ );
238
+ $url = $url . ($params ? '?' . $params : '');
239
+ break;
240
+ case 'POST':
241
+ $opts = array(
242
+ 'http' => array(
243
+ 'method' => 'POST',
244
+ 'header' => 'Content-type: application/x-www-form-urlencoded',
245
+ 'content' => $params,
246
+ 'ignore_errors' => true,
247
+ ), 'ssl' => array(
248
+ 'CN_match' => parse_url($url, PHP_URL_HOST),
249
+ ),
250
+ );
251
+ break;
252
+ case 'HEAD':
253
+ # We want to send a HEAD request,
254
+ # but since get_headers doesn't accept $context parameter,
255
+ # we have to change the defaults.
256
+ $default = stream_context_get_options(stream_context_get_default());
257
+ stream_context_get_default(
258
+ array(
259
+ 'http' => array(
260
+ 'method' => 'HEAD',
261
+ 'header' => 'Accept: application/xrds+xml, */*',
262
+ 'ignore_errors' => true,
263
+ ), 'ssl' => array(
264
+ 'CN_match' => parse_url($url, PHP_URL_HOST),
265
+ ),
266
+ )
267
+ );
268
+
269
+ $url = $url . ($params ? '?' . $params : '');
270
+ $headers = get_headers ($url);
271
+ if(!$headers) {
272
+ return array();
273
+ }
274
+
275
+ if(intval(substr($headers[0], strlen('HTTP/1.1 '))) == 405) {
276
+ # The server doesn't support HEAD, so let's emulate it with
277
+ # a GET.
278
+ $args = func_get_args();
279
+ $args[1] = 'GET';
280
+ call_user_func_array(array($this, 'request_streams'), $args);
281
+ return $this->headers;
282
+ }
283
+
284
+ $headers = $this->parse_header_array($headers, $update_claimed_id);
285
+
286
+ # And restore them.
287
+ stream_context_get_default($default);
288
+ return $headers;
289
+ }
290
+
291
+ if($this->verify_peer) {
292
+ $opts['ssl'] += array(
293
+ 'verify_peer' => true,
294
+ 'capath' => $this->capath,
295
+ 'cafile' => $this->cainfo,
296
+ );
297
+ }
298
+
299
+ $context = stream_context_create ($opts);
300
+ $data = file_get_contents($url, false, $context);
301
+ # This is a hack for providers who don't support HEAD requests.
302
+ # It just creates the headers array for the last request in $this->headers.
303
+ if(isset($http_response_header)) {
304
+ $this->headers = $this->parse_header_array($http_response_header, $update_claimed_id);
305
+ }
306
+
307
+ return $data;
308
+ }
309
+
310
+ protected function request($url, $method='GET', $params=array(), $update_claimed_id=false)
311
+ {
312
+ if (function_exists('curl_init')
313
+ && (!in_array('https', stream_get_wrappers()) || !ini_get('safe_mode') && !ini_get('open_basedir'))
314
+ ) {
315
+ return $this->request_curl($url, $method, $params, $update_claimed_id);
316
+ }
317
+ return $this->request_streams($url, $method, $params, $update_claimed_id);
318
+ }
319
+
320
+ protected function build_url($url, $parts)
321
+ {
322
+ if (isset($url['query'], $parts['query'])) {
323
+ $parts['query'] = $url['query'] . '&' . $parts['query'];
324
+ }
325
+
326
+ $url = $parts + $url;
327
+ $url = $url['scheme'] . '://'
328
+ . (empty($url['username'])?''
329
+ :(empty($url['password'])? "{$url['username']}@"
330
+ :"{$url['username']}:{$url['password']}@"))
331
+ . $url['host']
332
+ . (empty($url['port'])?'':":{$url['port']}")
333
+ . (empty($url['path'])?'':$url['path'])
334
+ . (empty($url['query'])?'':"?{$url['query']}")
335
+ . (empty($url['fragment'])?'':"#{$url['fragment']}");
336
+ return $url;
337
+ }
338
+
339
+ /**
340
+ * Helper function used to scan for <meta>/<link> tags and extract information
341
+ * from them
342
+ */
343
+ protected function htmlTag($content, $tag, $attrName, $attrValue, $valueName)
344
+ {
345
+ preg_match_all("#<{$tag}[^>]*$attrName=['\"].*?$attrValue.*?['\"][^>]*$valueName=['\"](.+?)['\"][^>]*/?>#i", $content, $matches1);
346
+ preg_match_all("#<{$tag}[^>]*$valueName=['\"](.+?)['\"][^>]*$attrName=['\"].*?$attrValue.*?['\"][^>]*/?>#i", $content, $matches2);
347
+
348
+ $result = array_merge($matches1[1], $matches2[1]);
349
+ return empty($result)?false:$result[0];
350
+ }
351
+
352
+ /**
353
+ * Performs Yadis and HTML discovery. Normally not used.
354
+ * @param $url Identity URL.
355
+ * @return String OP Endpoint (i.e. OpenID provider address).
356
+ * @throws ErrorException
357
+ */
358
+ function discover($url)
359
+ {
360
+ if (!$url) throw new ErrorException('No identity supplied.');
361
+ # Use xri.net proxy to resolve i-name identities
362
+ if (!preg_match('#^https?:#', $url)) {
363
+ $url = "https://xri.net/$url";
364
+ }
365
+
366
+ # We save the original url in case of Yadis discovery failure.
367
+ # It can happen when we'll be lead to an XRDS document
368
+ # which does not have any OpenID2 services.
369
+ $originalUrl = $url;
370
+
371
+ # A flag to disable yadis discovery in case of failure in headers.
372
+ $yadis = true;
373
+
374
+ # We'll jump a maximum of 5 times, to avoid endless redirections.
375
+ for ($i = 0; $i < 5; $i ++) {
376
+ if ($yadis) {
377
+ $headers = $this->request($url, 'HEAD', array(), true);
378
+
379
+ $next = false;
380
+ if (isset($headers['x-xrds-location'])) {
381
+ $url = $this->build_url(parse_url($url), parse_url(trim($headers['x-xrds-location'])));
382
+ $next = true;
383
+ }
384
+
385
+ if (isset($headers['content-type'])
386
+ && (strpos($headers['content-type'], 'application/xrds+xml') !== false
387
+ || strpos($headers['content-type'], 'text/xml') !== false)
388
+ ) {
389
+ # Apparently, some providers return XRDS documents as text/html.
390
+ # While it is against the spec, allowing this here shouldn't break
391
+ # compatibility with anything.
392
+ # ---
393
+ # Found an XRDS document, now let's find the server, and optionally delegate.
394
+ $content = $this->request($url, 'GET');
395
+
396
+ preg_match_all('#<Service.*?>(.*?)</Service>#s', $content, $m);
397
+ foreach($m[1] as $content) {
398
+ $content = ' ' . $content; # The space is added, so that strpos doesn't return 0.
399
+
400
+ # OpenID 2
401
+ $ns = preg_quote('http://specs.openid.net/auth/2.0/', '#');
402
+ if(preg_match('#<Type>\s*'.$ns.'(server|signon)\s*</Type>#s', $content, $type)) {
403
+ if ($type[1] == 'server') $this->identifier_select = true;
404
+
405
+ preg_match('#<URI.*?>(.*)</URI>#', $content, $server);
406
+ preg_match('#<(Local|Canonical)ID>(.*)</\1ID>#', $content, $delegate);
407
+ if (empty($server)) {
408
+ return false;
409
+ }
410
+ # Does the server advertise support for either AX or SREG?
411
+ $this->ax = (bool) strpos($content, '<Type>http://openid.net/srv/ax/1.0</Type>');
412
+ $this->sreg = strpos($content, '<Type>http://openid.net/sreg/1.0</Type>')
413
+ || strpos($content, '<Type>http://openid.net/extensions/sreg/1.1</Type>');
414
+
415
+ $server = $server[1];
416
+ if (isset($delegate[2])) $this->identity = trim($delegate[2]);
417
+ $this->version = 2;
418
+
419
+ $this->server = $server;
420
+ // exit($server);
421
+ return $server;
422
+ }
423
+
424
+ # OpenID 1.1
425
+ $ns = preg_quote('http://openid.net/signon/1.1', '#');
426
+ if (preg_match('#<Type>\s*'.$ns.'\s*</Type>#s', $content)) {
427
+
428
+ preg_match('#<URI.*?>(.*)</URI>#', $content, $server);
429
+ preg_match('#<.*?Delegate>(.*)</.*?Delegate>#', $content, $delegate);
430
+ if (empty($server)) {
431
+ return false;
432
+ }
433
+ # AX can be used only with OpenID 2.0, so checking only SREG
434
+ $this->sreg = strpos($content, '<Type>http://openid.net/sreg/1.0</Type>')
435
+ || strpos($content, '<Type>http://openid.net/extensions/sreg/1.1</Type>');
436
+
437
+ $server = $server[1];
438
+ if (isset($delegate[1])) $this->identity = $delegate[1];
439
+ $this->version = 1;
440
+
441
+ $this->server = $server;
442
+ return $server;
443
+ }
444
+ }
445
+
446
+ $next = true;
447
+ $yadis = false;
448
+ $url = $originalUrl;
449
+ $content = null;
450
+ break;
451
+ }
452
+ if ($next) continue;
453
+
454
+ # There are no relevant information in headers, so we search the body.
455
+ $content = $this->request($url, 'GET', array(), true);
456
+
457
+ if (isset($this->headers['x-xrds-location'])) {
458
+ $url = $this->build_url(parse_url($url), parse_url(trim($this->headers['x-xrds-location'])));
459
+ continue;
460
+ }
461
+
462
+ $location = $this->htmlTag($content, 'meta', 'http-equiv', 'X-XRDS-Location', 'content');
463
+ if ($location) {
464
+ $url = $this->build_url(parse_url($url), parse_url($location));
465
+ continue;
466
+ }
467
+ }
468
+
469
+ if (!$content) $content = $this->request($url, 'GET');
470
+
471
+ # At this point, the YADIS Discovery has failed, so we'll switch
472
+ # to openid2 HTML discovery, then fallback to openid 1.1 discovery.
473
+ $server = $this->htmlTag($content, 'link', 'rel', 'openid2.provider', 'href');
474
+ $delegate = $this->htmlTag($content, 'link', 'rel', 'openid2.local_id', 'href');
475
+ $this->version = 2;
476
+
477
+ if (!$server) {
478
+ # The same with openid 1.1
479
+ $server = $this->htmlTag($content, 'link', 'rel', 'openid.server', 'href');
480
+ $delegate = $this->htmlTag($content, 'link', 'rel', 'openid.delegate', 'href');
481
+ $this->version = 1;
482
+ }
483
+
484
+ if ($server) {
485
+ # We found an OpenID2 OP Endpoint
486
+ if ($delegate) {
487
+ # We have also found an OP-Local ID.
488
+ $this->identity = $delegate;
489
+ }
490
+ $this->server = $server;
491
+ return $server;
492
+ }
493
+
494
+ throw new ErrorException("No OpenID Server found at $url", 404);
495
+ }
496
+ throw new ErrorException('Endless redirection!', 500);
497
+ }
498
+
499
+ protected function sregParams()
500
+ {
501
+
502
+ $params = array();
503
+ # We always use SREG 1.1, even if the server is advertising only support for 1.0.
504
+ # That's because it's fully backwards compatibile with 1.0, and some providers
505
+ # advertise 1.0 even if they accept only 1.1. One such provider is myopenid.com
506
+ $params['openid.ns.sreg'] = 'http://openid.net/extensions/sreg/1.1';
507
+ if ($this->required) {
508
+ $params['openid.sreg.required'] = array();
509
+ foreach ($this->required as $required) {
510
+ if (!isset(self::$ax_to_sreg[$required])) continue;
511
+ $params['openid.sreg.required'][] = self::$ax_to_sreg[$required];
512
+ }
513
+ $params['openid.sreg.required'] = implode(',', $params['openid.sreg.required']);
514
+ }
515
+
516
+ if ($this->optional) {
517
+ $params['openid.sreg.optional'] = array();
518
+ foreach ($this->optional as $optional) {
519
+ if (!isset(self::$ax_to_sreg[$optional])) continue;
520
+ $params['openid.sreg.optional'][] = self::$ax_to_sreg[$optional];
521
+ }
522
+ $params['openid.sreg.optional'] = implode(',', $params['openid.sreg.optional']);
523
+ }
524
+
525
+
526
+ return $params;
527
+ }
528
+
529
+ protected function axParams()
530
+ {
531
+ $params = array();
532
+ if ($this->required || $this->optional) {
533
+ $params['openid.ns.ax'] = 'http://openid.net/srv/ax/1.0';
534
+ $params['openid.ax.mode'] = 'fetch_request';
535
+ $this->aliases = array();
536
+ $counts = array();
537
+ $required = array();
538
+ $optional = array();
539
+ foreach (array('required','optional') as $type) {
540
+ foreach ($this->$type as $alias => $field) {
541
+ if (is_int($alias)) $alias = strtr($field, '/', '_');
542
+ $this->aliases[$alias] = 'http://axschema.org/' . $field;
543
+ if (empty($counts[$alias])) $counts[$alias] = 0;
544
+ $counts[$alias] += 1;
545
+ ${$type}[] = $alias;
546
+ }
547
+ }
548
+ foreach ($this->aliases as $alias => $ns) {
549
+ $params['openid.ax.type.' . $alias] = $ns;
550
+ }
551
+ foreach ($counts as $alias => $count) {
552
+ if ($count == 1) continue;
553
+ $params['openid.ax.count.' . $alias] = $count;
554
+ }
555
+
556
+ # Don't send empty ax.requied and ax.if_available.
557
+ # Google and possibly other providers refuse to support ax when one of these is empty.
558
+ if($required) {
559
+ $params['openid.ax.required'] = implode(',', $required);
560
+ }
561
+ if($optional) {
562
+ $params['openid.ax.if_available'] = implode(',', $optional);
563
+ }
564
+ }
565
+ return $params;
566
+ }
567
+
568
+ protected function authUrl_v1($immediate)
569
+ {
570
+ $returnUrl = $this->returnUrl;
571
+ # If we have an openid.delegate that is different from our claimed id,
572
+ # we need to somehow preserve the claimed id between requests.
573
+ # The simplest way is to just send it along with the return_to url.
574
+ if($this->identity != $this->claimed_id) {
575
+ $returnUrl .= (strpos($returnUrl, '?') ? '&' : '?') . 'openid.claimed_id=' . $this->claimed_id;
576
+ }
577
+
578
+ $params = array(
579
+ 'openid.return_to' => $returnUrl,
580
+ 'openid.mode' => $immediate ? 'checkid_immediate' : 'checkid_setup',
581
+ 'openid.identity' => $this->identity,
582
+ 'openid.trust_root' => $this->trustRoot,
583
+ ) + $this->sregParams();
584
+
585
+ return $this->build_url(parse_url($this->server)
586
+ , array('query' => http_build_query($params, '', '&')));
587
+ }
588
+
589
+ function authUrl_v2($immediate=false)
590
+ {
591
+
592
+ $params = array(
593
+ 'openid.ns' => 'http://specs.openid.net/auth/2.0',
594
+ 'openid.mode' => $immediate ? 'checkid_immediate' : 'checkid_setup',
595
+ 'openid.return_to' => $this->returnUrl,
596
+ 'openid.realm' => $this->trustRoot,
597
+ );
598
+ if ($this->ax) {
599
+ $params += $this->axParams();
600
+ }
601
+ if ($this->sreg) {
602
+ $params += $this->sregParams();
603
+ }
604
+ if (!$this->ax && !$this->sreg) {
605
+ # If OP doesn't advertise either SREG, nor AX, let's send them both
606
+ # in worst case we don't get anything in return.
607
+ $params += $this->axParams() + $this->sregParams();
608
+ }
609
+
610
+ if ($this->identifier_select) {
611
+ $params['openid.identity'] = $params['openid.claimed_id']
612
+ = 'http://specs.openid.net/auth/2.0/identifier_select';
613
+ } else {
614
+ $params['openid.identity'] = $this->identity;
615
+ $params['openid.claimed_id'] = $this->claimed_id;
616
+ }
617
+
618
+
619
+ return $this->build_url(parse_url($this->server)
620
+ , array('query' => http_build_query($params, '', '&')));
621
+
622
+
623
+
624
+ }
625
+
626
+ /**
627
+ * Returns authentication url. Usually, you want to redirect your user to it.
628
+ * @return String The authentication url.
629
+ * @param String $select_identifier Whether to request OP to select identity for an user in OpenID 2. Does not affect OpenID 1.
630
+ * @throws ErrorException
631
+ */
632
+ function authUrl($immediate = false)
633
+ {
634
+
635
+
636
+ if ($this->setup_url && !$immediate) return $this->setup_url;
637
+ if (!$this->server) { $this->discover($this->identity); }
638
+
639
+ if ($this->version == 2) {
640
+ return $this->authUrl_v2($immediate);
641
+ }
642
+ return $this->authUrl_v1($immediate);
643
+ }
644
+
645
+ /**
646
+ * Performs OpenID verification with the OP.
647
+ * @return Bool Whether the verification was successful.
648
+ * @throws ErrorException
649
+ */
650
+ function validate()
651
+ {
652
+ # If the request was using immediate mode, a failure may be reported
653
+ # by presenting user_setup_url (for 1.1) or reporting
654
+ # mode 'setup_needed' (for 2.0). Also catching all modes other than
655
+ # id_res, in order to avoid throwing errors.
656
+ if(isset($this->data['openid_user_setup_url'])) {
657
+ $this->setup_url = $this->data['openid_user_setup_url'];
658
+ return false;
659
+ }
660
+ if($this->mode != 'id_res') {
661
+ return false;
662
+ }
663
+
664
+ $this->claimed_id = isset($this->data['openid_claimed_id'])?$this->data['openid_claimed_id']:$this->data['openid_identity'];
665
+ $params = array(
666
+ 'openid.assoc_handle' => $this->data['openid_assoc_handle'],
667
+ 'openid.signed' => $this->data['openid_signed'],
668
+ 'openid.sig' => $this->data['openid_sig'],
669
+ );
670
+
671
+ if (isset($this->data['openid_ns'])) {
672
+ # We're dealing with an OpenID 2.0 server, so let's set an ns
673
+ # Even though we should know location of the endpoint,
674
+ # we still need to verify it by discovery, so $server is not set here
675
+ $params['openid.ns'] = 'http://specs.openid.net/auth/2.0';
676
+ } elseif (isset($this->data['openid_claimed_id'])
677
+ && $this->data['openid_claimed_id'] != $this->data['openid_identity']
678
+ ) {
679
+ # If it's an OpenID 1 provider, and we've got claimed_id,
680
+ # we have to append it to the returnUrl, like authUrl_v1 does.
681
+ $this->returnUrl .= (strpos($this->returnUrl, '?') ? '&' : '?')
682
+ . 'openid.claimed_id=' . $this->claimed_id;
683
+ }
684
+
685
+ if ($this->data['openid_return_to'] != $this->returnUrl) {
686
+ # The return_to url must match the url of current request.
687
+ # I'm assuing that noone will set the returnUrl to something that doesn't make sense.
688
+ return false;
689
+ }
690
+
691
+ $server = $this->discover($this->claimed_id);
692
+
693
+ foreach (explode(',', $this->data['openid_signed']) as $item) {
694
+ # Checking whether magic_quotes_gpc is turned on, because
695
+ # the function may fail if it is. For example, when fetching
696
+ # AX namePerson, it might containg an apostrophe, which will be escaped.
697
+ # In such case, validation would fail, since we'd send different data than OP
698
+ # wants to verify. stripslashes() should solve that problem, but we can't
699
+ # use it when magic_quotes is off.
700
+ $value = $this->data['openid_' . str_replace('.','_',$item)];
701
+ $params['openid.' . $item] = function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() ? stripslashes($value) : $value;
702
+
703
+ }
704
+
705
+ $params['openid.mode'] = 'check_authentication';
706
+
707
+ $response = $this->request($server, 'POST', $params);
708
+
709
+ return preg_match('/is_valid\s*:\s*true/i', $response);
710
+ }
711
+
712
+ protected function getAxAttributes()
713
+ {
714
+ $alias = null;
715
+ if (isset($this->data['openid_ns_ax'])
716
+ && $this->data['openid_ns_ax'] != 'http://openid.net/srv/ax/1.0'
717
+ ) { # It's the most likely case, so we'll check it before
718
+ $alias = 'ax';
719
+ } else {
720
+ # 'ax' prefix is either undefined, or points to another extension,
721
+ # so we search for another prefix
722
+ foreach ($this->data as $key => $val) {
723
+ if (substr($key, 0, strlen('openid_ns_')) == 'openid_ns_'
724
+ && $val == 'http://openid.net/srv/ax/1.0'
725
+ ) {
726
+ $alias = substr($key, strlen('openid_ns_'));
727
+ break;
728
+ }
729
+ }
730
+ }
731
+ if (!$alias) {
732
+ # An alias for AX schema has not been found,
733
+ # so there is no AX data in the OP's response
734
+ return array();
735
+ }
736
+
737
+ $attributes = array();
738
+ foreach (explode(',', $this->data['openid_signed']) as $key) {
739
+ $keyMatch = $alias . '.value.';
740
+ if (substr($key, 0, strlen($keyMatch)) != $keyMatch) {
741
+ continue;
742
+ }
743
+ $key = substr($key, strlen($keyMatch));
744
+ if (!isset($this->data['openid_' . $alias . '_type_' . $key])) {
745
+ # OP is breaking the spec by returning a field without
746
+ # associated ns. This shouldn't happen, but it's better
747
+ # to check, than cause an E_NOTICE.
748
+ continue;
749
+ }
750
+ $value = $this->data['openid_' . $alias . '_value_' . $key];
751
+ $key = substr($this->data['openid_' . $alias . '_type_' . $key],
752
+ strlen('http://axschema.org/'));
753
+
754
+ $attributes[$key] = $value;
755
+ }
756
+ return $attributes;
757
+ }
758
+
759
+ protected function getSregAttributes()
760
+ {
761
+ $attributes = array();
762
+ $sreg_to_ax = array_flip(self::$ax_to_sreg);
763
+ foreach (explode(',', $this->data['openid_signed']) as $key) {
764
+ $keyMatch = 'sreg.';
765
+ if (substr($key, 0, strlen($keyMatch)) != $keyMatch) {
766
+ continue;
767
+ }
768
+ $key = substr($key, strlen($keyMatch));
769
+ if (!isset($sreg_to_ax[$key])) {
770
+ # The field name isn't part of the SREG spec, so we ignore it.
771
+ continue;
772
+ }
773
+ $attributes[$sreg_to_ax[$key]] = $this->data['openid_sreg_' . $key];
774
+ }
775
+ return $attributes;
776
+ }
777
+
778
+ /**
779
+ * Gets AX/SREG attributes provided by OP. should be used only after successful validaton.
780
+ * Note that it does not guarantee that any of the required/optional parameters will be present,
781
+ * or that there will be no other attributes besides those specified.
782
+ * In other words. OP may provide whatever information it wants to.
783
+ * * SREG names will be mapped to AX names.
784
+ * * @return Array Array of attributes with keys being the AX schema names, e.g. 'contact/email'
785
+ * @see http://www.axschema.org/types/
786
+ */
787
+ function getAttributes()
788
+ {
789
+ if (isset($this->data['openid_ns'])
790
+ && $this->data['openid_ns'] == 'http://specs.openid.net/auth/2.0'
791
+ ) { # OpenID 2.0
792
+ # We search for both AX and SREG attributes, with AX taking precedence.
793
+ return $this->getAxAttributes() + $this->getSregAttributes();
794
+ }
795
+ return $this->getSregAttributes();
796
+ }
797
+ }
app/code/local/Soclever/Socialloginsharing/etc/config.xml ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Soclever SocialLoginsharing Extension
5
+ *
6
+ * @category Extension
7
+ * @copyright Copyright (c) 2014 Soclever (https://www.socleversocial.com)
8
+ * @author Socleverteam
9
+ * @license GPL
10
+ * @terms of use https://www.socleversocial.com
11
+ * @version Release: 1.0
12
+ * @since Available since Release 1.0
13
+ */
14
+ -->
15
+
16
+ <config>
17
+ <modules>
18
+ <Soclever_Socialloginsharing>
19
+ <version>1.1.1</version>
20
+ </Soclever_Socialloginsharing>
21
+ </modules>
22
+ <default>
23
+ <socialloginsharing_options>
24
+ <displaysettings>
25
+ <buttonstyle>ic</buttonstyle>
26
+ </displaysettings>
27
+ </socialloginsharing_options>
28
+ </default>
29
+
30
+ <frontend>
31
+ <routers>
32
+ <soclever_socialloginsharing>
33
+ <use>standard</use>
34
+ <args>
35
+ <module>Soclever_Socialloginsharing</module>
36
+ <frontName>soclever_socialloginsharing</frontName>
37
+ </args>
38
+ </soclever_socialloginsharing>
39
+
40
+ </routers>
41
+ <layout>
42
+ <updates>
43
+ <Soclever_Socialloginsharing>
44
+ <file>socialloginsharing.xml</file>
45
+ </Soclever_Socialloginsharing>
46
+ </updates>
47
+ </layout>
48
+ </frontend>
49
+ <admin>
50
+ <routers>
51
+ <socialloginsharing>
52
+ <use>admin</use>
53
+ <args>
54
+ <module>Soclever_Socialloginsharing</module>
55
+ <frontName>Socialloginsharing admin</frontName>
56
+ </args>
57
+ </socialloginsharing>
58
+ </routers>
59
+ </admin>
60
+ <adminhtml>
61
+ <acl>
62
+ <resources>
63
+ <admin>
64
+ <children>
65
+ <system>
66
+ <children>
67
+ <config>
68
+ <children>
69
+ <socialloginsharing_options>
70
+ <title>Store Social Login Sharing Module Section</title>
71
+ </socialloginsharing_options>
72
+ </children>
73
+ </config>
74
+ </children>
75
+ </system>
76
+ </children>
77
+ </admin>
78
+ </resources>
79
+ </acl>
80
+ </adminhtml>
81
+ <global>
82
+ <models>
83
+ <socialloginsharing>
84
+ <class>Soclever_Socialloginsharing_Model</class>
85
+ </socialloginsharing>
86
+ </models>
87
+ <resources>
88
+ <soclever_socialloginsharing_setup>
89
+ <setup>
90
+ <module>Soclever_Socialloginsharing</module>
91
+ </setup>
92
+ <connection>
93
+ <use>core_setup</use>
94
+ </connection>
95
+ </soclever_socialloginsharing_setup>
96
+ <soclever_socialloginsharing_write>
97
+ <connection>
98
+ <use>core_write</use>
99
+ </connection>
100
+ </soclever_socialloginsharing_write>
101
+ <soclever_socialloginsharing_read>
102
+ <connection>
103
+ <use>core_read</use>
104
+ </connection>
105
+ </soclever_socialloginsharing_read>
106
+ </resources>
107
+ <blocks>
108
+ <socialloginsharing>
109
+ <class>Soclever_Socialloginsharing_Block</class>
110
+ </socialloginsharing>
111
+ </blocks>
112
+ <helpers>
113
+ <socialloginsharing>
114
+ <class>Soclever_Socialloginsharing_Helper</class>
115
+ </socialloginsharing>
116
+ </helpers>
117
+ <events>
118
+ <admin_system_config_changed_section_socialloginsharing_options>
119
+ <observers>
120
+ <myobserver>
121
+ <type>singleton</type>
122
+ <class>socialloginsharing/observer</class>
123
+ <method>writejs</method>
124
+ </myobserver>
125
+ </observers>
126
+ </admin_system_config_changed_section_socialloginsharing_options>
127
+ </events>
128
+ </global>
129
+ </config>
app/code/local/Soclever/Socialloginsharing/etc/system.xml ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <socialloginsharingsetting translate="label" module="socialloginsharing">
5
+ <label>SOCLEVER</label>
6
+ <sort_order>3</sort_order>
7
+ </socialloginsharingsetting>
8
+ </tabs>
9
+ <sections>
10
+ <socialloginsharing_options translate="label" module="socialloginsharing">
11
+ <label>Social Login &amp; Social Sharing</label>
12
+ <tab>socialloginsharingsetting</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>1020</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <apisettings translate="label">
20
+ <label>Soclever Social API Settings</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>1</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <scsl_appid translate="label">
28
+ <label>Soclever API Key</label>
29
+ <frontend_type>text</frontend_type>
30
+ <comment><![CDATA[ Socelver API ]]></comment>
31
+ <sort_order>15</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </scsl_appid>
36
+ <scsl_appsecret translate="label">
37
+ <label>Soclever API Secret</label>
38
+ <frontend_type>text</frontend_type>
39
+ <comment><![CDATA[ Socelver API Secret ]]></comment>
40
+ <sort_order>16</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ </scsl_appsecret>
45
+ <scsl_siteid translate="label">
46
+ <label>Soclever Client ID</label>
47
+ <frontend_type>text</frontend_type>
48
+ <comment><![CDATA[ Socelver Client ID ]]></comment>
49
+ <sort_order>17</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </scsl_siteid>
54
+ <scsl_validdomain translate="label">
55
+ <label>Soclever Valid Domain</label>
56
+ <frontend_type>text</frontend_type>
57
+ <comment><![CDATA[ Socelver Valid Domain ]]></comment>
58
+ <sort_order>18</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </scsl_validdomain>
63
+ </fields>
64
+ </apisettings>
65
+ <displaysettingshare translate="label">
66
+ <label>Social Sharing Settings</label>
67
+ <frontend_type>text</frontend_type>
68
+ <sort_order>2</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ <fields>
73
+ <socialproviders translate="label">
74
+ <label>Select Providers</label>
75
+ <frontend_type>multiselect</frontend_type>
76
+ <source_model>socialloginsharing/providers::getproviders</source_model>
77
+ <sort_order>201</sort_order>
78
+ <show_in_default>1</show_in_default>
79
+ <show_in_website>1</show_in_website>
80
+ <show_in_store>1</show_in_store>
81
+ </socialproviders>
82
+ <countersetting translate="label">
83
+ <label>Counter Display</label>
84
+ <frontend_type>select</frontend_type>
85
+ <source_model>socialloginsharing/providers::getcounters</source_model>
86
+ <sort_order>200</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>1</show_in_website>
89
+ <show_in_store>1</show_in_store>
90
+ </countersetting>
91
+ <gapsetting translate="label">
92
+ <label>Gap</label>
93
+ <frontend_type>select</frontend_type>
94
+ <source_model>socialloginsharing/providers::getgaps</source_model>
95
+ <sort_order>199</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ </gapsetting>
100
+ <iconsize translate="label">
101
+ <label>Icon Size</label>
102
+ <frontend_type>select</frontend_type>
103
+ <source_model>socialloginsharing/providers::geticonsize</source_model>
104
+ <sort_order>198</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ </iconsize>
109
+ <displaystyle translate="label">
110
+ <label>Display Style</label>
111
+ <frontend_type>select</frontend_type>
112
+ <source_model>socialloginsharing/providers::displaystyle</source_model>
113
+
114
+ <sort_order>197</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ </displaystyle>
119
+ <yourstyle translate="label">
120
+ <label>Button Style</label>
121
+ <frontend_type>select</frontend_type>
122
+ <source_model>socialloginsharing/providers::yourstyle</source_model>
123
+ <sort_order>197</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <show_in_store>1</show_in_store>
127
+ </yourstyle>
128
+ </fields>
129
+ </displaysettingshare>
130
+ <displaysettings translate="label">
131
+ <label>Social Login Settings</label>
132
+ <frontend_type>text</frontend_type>
133
+ <sort_order>3</sort_order>
134
+ <show_in_default>1</show_in_default>
135
+ <show_in_website>1</show_in_website>
136
+ <show_in_store>1</show_in_store>
137
+ <fields>
138
+ <buttonstyle translate="label">
139
+ <label>Select Button Style</label>
140
+ <frontend_type>select</frontend_type>
141
+ <source_model>socialloginsharing/providers::getbuttonstyles</source_model>
142
+ <sort_order>200</sort_order>
143
+ <show_in_default>1</show_in_default>
144
+ <show_in_website>1</show_in_website>
145
+ <show_in_store>1</show_in_store>
146
+ </buttonstyle>
147
+ <buttonsize translate="label">
148
+ <label>Button Size</label>
149
+ <frontend_type>select</frontend_type>
150
+ <source_model>socialloginsharing/providers::getsizes</source_model>
151
+ <sort_order>199</sort_order>
152
+ <show_in_default>1</show_in_default>
153
+ <show_in_website>1</show_in_website>
154
+ <show_in_store>1</show_in_store>
155
+ </buttonsize>
156
+ <socialloginproviders translate="label">
157
+ <label>Select Providers</label>
158
+ <frontend_type>multiselect</frontend_type>
159
+ <source_model>socialloginsharing/providers::getloginproviders</source_model>
160
+ <sort_order>201</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>1</show_in_website>
163
+ <show_in_store>1</show_in_store>
164
+ </socialloginproviders>
165
+ </fields>
166
+ </displaysettings>
167
+ </groups>
168
+ </socialloginsharing_options>
169
+ </sections>
170
+ </config>
app/design/frontend/base/default/layout/socialloginsharing.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="1.0.0">
3
+ <default>
4
+ <reference name="head">
5
+ <block type="socialloginsharing/scslhead" name="sociallogin_head" template="socialloginsharing/sociallogin_head.phtml" />
6
+ <block type="socialloginsharing/scslheadfb" name="sociallogin_headfb" template="socialloginsharing/sociallogin_fb.phtml" />
7
+ <block type="socialloginsharing/scsshead" name="socialshare_head" template="socialloginsharing/socialshare_head.phtml" />
8
+ </reference>
9
+ </default>
10
+ <catalog_product_view>
11
+ <reference name="product.info.extrahint">
12
+ <block type="socialloginsharing/scsshow" name="socialshare_product" template="socialloginsharing/socialshare_product.phtml" />
13
+ </reference>
14
+ </catalog_product_view>
15
+ <default>
16
+ <reference name="content">
17
+ <block type="socialloginsharing/scsshow" name="socialshare_show" template="socialloginsharing/socialshare_show.phtml" />
18
+ </reference>
19
+ </default>
20
+ <checkout_onepage_index>
21
+ <reference name="checkout.onepage.login.before">
22
+ <block type="socialloginsharing/scslshow" before="-" name="sociallogin_show">
23
+ </block>
24
+ </reference>
25
+ </checkout_onepage_index>
26
+ <customer_account_login>
27
+ <reference name="content">
28
+ <block type="socialloginsharing/scslshow" before="-" name="sociallogin_show">
29
+
30
+ </block>
31
+ </reference>
32
+ </customer_account_login>
33
+ <checkout_onepage_success>
34
+ <reference name="content">
35
+ <block type="socialloginsharing/scsltrackpixel" name="sociallogin_trackpixel" template="socialloginsharing/sociallogin_trackpixel.phtml" />
36
+ </reference>
37
+ </checkout_onepage_success>
38
+ </layout>
app/design/frontend/base/default/template/socialloginsharing/scsl_buttons.phtml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $site_id=Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid');
3
+ $api_secret=Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_appsecret');
4
+ $api_key=Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_appid');
5
+ $btn_style=Mage::getStoreConfig('socialloginsharing_options/displaysettings/buttonstyle');
6
+ $button_size=Mage::getStoreConfig('socialloginsharing_options/displaysettings/buttonsize');
7
+
8
+ $is_validated=Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_validated');
9
+
10
+ $selected_providers=Mage::getStoreConfig('socialloginsharing_options/displaysettings/socialloginproviders');
11
+
12
+ if($is_validated=='1' && $selected_providers!='' && $selected_providers!='0')
13
+ {
14
+
15
+ $valid_data=file_get_contents("https://www.socleversocial.com/dashboard/mage_login_buttons.php?site_id=".$site_id."&api_key=".$api_key."&api_secret=".$api_secret."&csplatform=magentologin&rt=gp&bstyle=".$btn_style."&bsize=".$button_size."&providers=".$selected_providers);
16
+
17
+ if($valid_data && $valid_data!='0~~0')
18
+ {
19
+ echo $valid_data;
20
+ }
21
+ else
22
+ {
23
+ echo"";
24
+ }
25
+ }
26
+ echo"";
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+ ?>
app/design/frontend/base/default/template/socialloginsharing/sociallogin_fb.phtml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ ?>
app/design/frontend/base/default/template/socialloginsharing/sociallogin_head.phtml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $is_validated=Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_validated');
3
+ if($is_validated=='1')
4
+ {
5
+ if(!Mage::getSingleton('customer/session')->isLoggedIn())
6
+ {
7
+ echo'<script type="text/javascript" src="https://www.socleversocial.com/dashboard/client_share_js/client_'.Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid').'_login.js"></script>'.PHP_EOL.
8
+ '<script type="text/javascript">'.PHP_EOL.
9
+ 'csloginjs.init([\''.Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_appid').'\', \''.Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid').'\',\''.Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_appsecret').'\',\''.Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_validdomain').'\']);'.PHP_EOL.
10
+ 'csloginjs.validateCsApi();'.PHP_EOL.
11
+ '</script>'.PHP_EOL;
12
+
13
+ }
14
+ }
15
+ ?>
app/design/frontend/base/default/template/socialloginsharing/sociallogin_trackpixel.phtml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $is_validated=Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_validated');
3
+ if($is_validated=='1')
4
+ {
5
+ $CsorderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
6
+ $Csorder = Mage::getModel('sales/order')->loadByIncrementId($CsorderId);
7
+ $sessionVariable = Mage::getSingleton('core/session')->getSessionVariable();
8
+ echo"<img src='https://www.socleversocial.com/dashboard/trackPixel.php?site_id=".Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid')."&order_id=".$CsorderId."&ord_amt=".$Csorder->getGrandTotal()."&ord_cur=".$Csorder->base_currency_code."&siteUid=".$Csorder->customer_id."&is_from=".$sessionVariable."' />";
9
+ }
10
+
11
+ ?>
app/design/frontend/base/default/template/socialloginsharing/socialshare_head.phtml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $is_validated=Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_validated');
3
+ if($is_validated=='1')
4
+ {
5
+ $js_code ='<script type="text/javascript" src="https://www.socleversocial.com/dashboard/client_share_js/client_'.Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid').'_share_noautho.js?v='.time().'"></script>'.PHP_EOL.
6
+ '<script>'.PHP_EOL.
7
+ 'csauthosharebarjs.init([\''.Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_appid').'\', \''.Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid').'\',\''.Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_appsecret').'\',\''.Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_validdomain').'\']);'.PHP_EOL.
8
+ 'csauthosharebarjs.validateCsApi();'.PHP_EOL.
9
+ '</script>'.PHP_EOL;
10
+
11
+ echo $js_code;
12
+ }
13
+ ?>
app/design/frontend/base/default/template/socialloginsharing/socialshare_product.phtml ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $is_validated=Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_validated');
3
+ if($is_validated=='1')
4
+ {
5
+ $display_style=Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/displaystyle');
6
+ if($display_style=='0')
7
+ {
8
+ if(!function_exists('cs_get_plusones'))
9
+ {
10
+
11
+ function cs_get_plusones($url) {
12
+ $curl = curl_init();
13
+ curl_setopt($curl, CURLOPT_URL, "https://clients6.google.com/rpc");
14
+ curl_setopt($curl, CURLOPT_POST, true);
15
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
16
+ curl_setopt($curl, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"'.rawurldecode($url).'","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]');
17
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
18
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
19
+ $curl_results = curl_exec ($curl);
20
+ curl_close ($curl);
21
+ $json = json_decode($curl_results, true);
22
+ return isset($json[0]['result']['metadata']['globalCounts']['count'])?intval( $json[0]['result']['metadata']['globalCounts']['count'] ):0;
23
+ }
24
+
25
+ }
26
+ if(!function_exists('cs_format_share_url'))
27
+ {
28
+ function cs_format_share_url($url,$source)
29
+ {
30
+
31
+ $name = "scsource";
32
+ $value = $source;
33
+
34
+
35
+ $separator = "?";
36
+ if (strpos($url,"?")!==false)
37
+ $separator = "&";
38
+
39
+
40
+ $insertPosition = strlen($url);
41
+ if (strpos($url,"#")!==false)
42
+ $insertPosition = strpos($url,"#");
43
+
44
+
45
+ $newUrl = substr_replace($url,"$separator$name=$value",$insertPosition,0);
46
+
47
+ return $newUrl;
48
+ }
49
+
50
+ }
51
+ $iwidth=explode("x",Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/iconsize'));
52
+ $button_style=Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/yourstyle');
53
+ $display_style=Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/displaystyle');
54
+ $gap=Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/gapsetting');
55
+ $counter_type=Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/countersetting');
56
+ $share_button=explode(",",Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/socialproviders'));
57
+
58
+ $vartical_top=$counter_position="";
59
+ $main_div='height:'.$iwidth[0].'px';
60
+ $cspageURL = 'http';
61
+ if($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
62
+ $cspageURL .= "://";
63
+ if ($_SERVER["SERVER_PORT"] != "80") {
64
+ $cspageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
65
+ } else {
66
+ $cspageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
67
+ }
68
+ $url=$cspageURL;
69
+ if($counter_type=='0' || $counter_type=='1')
70
+ {
71
+
72
+ $counter_position='.arrow_box:after, .arrow_box:before { top: 100%; left: 50%; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; pointer-events: none; } .arrow_box:after { border-color: rgba(255, 255, 255, 0); border-top-color: #fff; border-width: 6px; margin-left: -6px; } .arrow_box:before { border-color: rgba(204, 204, 203, 0); border-top-color: #cccccb; border-width: 7px; margin-left: -7px; }';
73
+ if($counter_type=='0')
74
+ {
75
+ $main_div='float:left;margin-top:0px;margin-left:8px;height:'.$iwidth[0].'px;margin-right:8px;';
76
+
77
+ $counter_position='.arrow_box:after, .arrow_box:before { right: 100%; top: 50%; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; pointer-events: none; } .arrow_box:after { border-color: rgba(255, 255, 255, 0); border-right-color: #fff; border-width: 6px; margin-top: -6px; } .arrow_box:before { border-color: rgba(204, 204, 203, 0); border-right-color: #cccccb; border-width: 7px; margin-top: -7px; }';
78
+ }
79
+ $js_code .='<style>'.PHP_EOL.
80
+ '.arrow_box { width: '.($iwidth[0]-5).'px; margin-bottom:8px;'.$main_div.' border-radius: 1px; position: relative; background: #fff; border: 1px solid #cccccb; }'.$counter_position.''.PHP_EOL.
81
+ '</style>'.PHP_EOL;
82
+ }
83
+ $useragent=$_SERVER['HTTP_USER_AGENT'];
84
+ $mobile_Display="display:none;";
85
+ $comon_counter_start='<div class="arrow_box" ><div style="color:#000;font-weight:bold;position: relative;width: 100%;text-align: center;'.$counter_top_margin.'">';
86
+ $comon_counter_start_18='<div class="arrow_box" style="display:none;"><div style="color:#000;font-weight:bold;position: relative;width: 100%;text-align: center;'.$counter_top_margin.'">';
87
+ if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4)))
88
+ {
89
+
90
+ $mobile_Display="display:inline-block;";
91
+ $comon_counter_start_18='<div class="arrow_box"><div style="color:#000;font-weight:bold;position: relative;width: 100%;text-align: center;'.$counter_top_margin.'">';
92
+ }
93
+
94
+ if($button_style=='1')
95
+ {
96
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/facebook_square.png"';
97
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/google_plus_square.png"';
98
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/rounded/linkedin_square.png\'';
99
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/twitter_square.png"';
100
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/pinterest_square.png"';
101
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/whatsapp_square.png"';
102
+
103
+ }
104
+ else if($button_style=='2')
105
+ {
106
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/facebook.png"';
107
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/google_plus.png"';
108
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/rounded/linkedin.png\'';
109
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/twitter.png"';
110
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/pinterest.png"';
111
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/whatsapp.png"';
112
+ }
113
+ else if($button_style=='3')
114
+ {
115
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/facebook_grey.png"';
116
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/google_plus_grey.png"';
117
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/rounded/linkedin_grey.png\'';
118
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/twitter_grey.png"';
119
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/pinterest_grey.png"';
120
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/whatsapp_grey.png"';
121
+ }
122
+ else if($button_style=='4')
123
+ {
124
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/facebook_grey_circle.png"';
125
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/google_plus_grey_circle.png"';
126
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/rounded/linkedin_grey_circle.png\'';
127
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/twitter_grey_circle.png"';
128
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/pinterest_grey_circle.png"';
129
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/whatsapp_grey_circle.png"';
130
+ }
131
+ else if($button_style=='5')
132
+ {
133
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/flower/facebook_flower.png"';
134
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/flower/google_flower.png"';
135
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/flower/linkedin_flower.png\'';
136
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/flower/twitter_flower.png"';
137
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/flower/pinterest_flower.png"';
138
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
139
+
140
+ }
141
+ else if($button_style=='6')
142
+ {
143
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/glossy/facebook_glossy.png"';
144
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/glossy/google_glossy.png"';
145
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/glossy/linkedin_glossy.png\'';
146
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/glossy/twitter_glossy.png"';
147
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/glossy/pinterest_glossy.png"';
148
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
149
+
150
+ }
151
+ else if($button_style=='7')
152
+ {
153
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/leaf/facebook_leaf.png"';
154
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/leaf/google_leaf.png"';
155
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/leaf/linkedin_leaf.png\'';
156
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/leaf/twitter_leaf.png"';
157
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/leaf/pinterest_leaf.png"';
158
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
159
+
160
+ }
161
+ else if($button_style=='8')
162
+ {
163
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/polygon/facebook_polygon.png"';
164
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/polygon/google_polygon.png"';
165
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/polygon/linkedin_polygon.png\'';
166
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/polygon/twitter_polygon.png"';
167
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/polygon/pinterest_polygon.png"';
168
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
169
+
170
+ }
171
+ else if($button_style=='9')
172
+ {
173
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rectangular/facebook_rectangular.png"';
174
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rectangular/google_rectangular.png"';
175
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/rectangular/linkedin_rectangular.png\'';
176
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rectangular/twitter_rectangular.png"';
177
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rectangular/pinterest_rectangular.png"';
178
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
179
+
180
+ }
181
+ else if($button_style=='10')
182
+ {
183
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded_corners/facebook_rounded_corners.png"';
184
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded_corners/google_rounded_corners.png"';
185
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/rounded_corners/linkedin_rounded_corners.png\'';
186
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded_corners/twitter_rounded_corners.png"';
187
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded_corners/pinterest_rounded_corners.png"';
188
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
189
+
190
+ }
191
+ else if($button_style=='11')
192
+ {
193
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/waterdrop/facebook_waterdrop.png"';
194
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/waterdrop/google_waterdrop.png"';
195
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/waterdrop/linkedin_waterdrop.png\'';
196
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/waterdrop/twitter_waterdrop.png"';
197
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/waterdrop/pinterest_waterdrop.png"';
198
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
199
+ }
200
+ if($display_style=='1')
201
+ {
202
+ $gap_string='<div style=\'float:left;height:'.$gap.'px;\'>&nbsp;</div>';
203
+ }
204
+ else
205
+ {
206
+ $gap_string='<div style=\'float:left;width:'.$gap.'px;\'>&nbsp;</div>';
207
+ }
208
+
209
+ if($counter_type=='0' || $counter_type=='1')
210
+ {
211
+
212
+
213
+
214
+ $fburl=$url.(parse_url($url, PHP_URL_QUERY) ? '&' : '?').'scsource=1';
215
+ $liurl=$url.(parse_url($url, PHP_URL_QUERY) ? '&' : '?').'scsource=2';
216
+ $gpurl=$url.(parse_url($url, PHP_URL_QUERY) ? '&' : '?').'scsource=3';
217
+ $twurl=$url.(parse_url($url, PHP_URL_QUERY) ? '&' : '?').'scsource=4';
218
+
219
+ $fb=json_decode(file_get_contents("http://graph.facebook.com/?ids=".$url.",".$fburl.""));
220
+ $tw=json_decode(file_get_contents("http://cdn.api.twitter.com/1/urls/count.json?url=".$url.""));
221
+ $tw2=json_decode(file_get_contents("http://cdn.api.twitter.com/1/urls/count.json?url=".$twurl.""));
222
+ $li=json_decode(file_get_contents("http://www.linkedin.com/countserv/count/share?url=".$url."&format=json"));
223
+ $li2=json_decode(file_get_contents("http://www.linkedin.com/countserv/count/share?url=".$liurl."&format=json"));
224
+ $pin_count=file_get_contents("http://api.pinterest.com/v1/urls/count.json?url=".$url."");
225
+
226
+ $whatsapp_count=file_get_contents("https://www.socleversocial.com/dashboard/whatsappcount.php?site_id=".Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid')."&url=".$url."");
227
+ $str=substr(substr($pin_count,0,-1),13);
228
+ $pin_arr=json_decode($str);
229
+
230
+
231
+ $fb=json_decode(file_get_contents("http://graph.facebook.com/?id=".$url.""));
232
+ $tw=json_decode(file_get_contents("http://cdn.api.twitter.com/1/urls/count.json?url=".$url.""));
233
+ $li=json_decode(file_get_contents("http://www.linkedin.com/countserv/count/share?url=".$url."&format=json"));
234
+ $pin_count=file_get_contents("http://api.pinterest.com/v1/urls/count.json?url=".$url."");
235
+
236
+ $str=substr(substr($pin_count,0,-1),13);
237
+ $pin_arr=json_decode($str);
238
+
239
+
240
+ $fb_shares="FB Shares=".$fb->shares."==Googleplus==".$count."==Twitter=".$tw->count."===Linked==".$li->count."==Pinterest==".$pin_arr->count;
241
+ $counter_top_margin='';
242
+ if($counter_type=='0')
243
+ {
244
+ $counter_top_margin='margin-top:'.intval($iwidth[0]/4).'px;';
245
+ }
246
+
247
+ $comon_counter_end='</div></div>';
248
+ $count2=$count4=$count7=$count13=$count17="";
249
+ $count2r=$count2=''.$comon_counter_start.''.intval($fb->$url->shares+$fb->$fburl->shares).''.$comon_counter_end.'';
250
+ $count4r=$count4=''.$comon_counter_start.''.intval(cs_get_plusones($url)+cs_get_plusones($gpurl)).''.$comon_counter_end.'';
251
+ $count7r=$count7=''.$comon_counter_start.''.intval($tw->count+$tw2->count).''.$comon_counter_end.'';
252
+ $count13r=$count13=''.$comon_counter_start.''.intval($li->count+$li2->count).''.$comon_counter_end.'';
253
+ $count17r=$count17=''.$comon_counter_start.''.intval($pin_arr->count).''.$comon_counter_end.'';
254
+ $count18r=$count18=''.$comon_counter_start_18.''.intval($whatsapp_count).''.$comon_counter_end.'';
255
+ }
256
+ if($counter_type=='0')
257
+ {
258
+ $count2=$count4=$count7=$count13=$count17=$count18="";
259
+ }
260
+ else
261
+ {
262
+ $count2r=$count4r=$count7r=$count13r=$count17r=$count18r="";
263
+ }
264
+
265
+ if($customer = Mage::getSingleton('customer/session')->isLoggedIn()) {
266
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
267
+
268
+ $user_ID=$customerData->getId();
269
+
270
+ }
271
+ $title=$this->getLayout()->getBlock('head')->getTitle();
272
+ $share_arr[2]='<div style="float:left;">'.$count2.'<img '.$src_style2.' onclick="share_on_cs(\'1\',\''.$user_ID.'\');window.open(\'http://www.facebook.com/sharer.php?u='.urlencode(cs_format_share_url($url,'1')).'&t='.urlencode($title).'\',\'_new\');" alt="Share on Facebook" ></div>'.$count2r.''.$gap_string.'';
273
+ $share_arr[4]='<div style=\'float:left;\'>'.$count4.'<img '.$src_style4.' onclick="share_on_cs(\'3\',\''.$user_ID.'\');window.open(\'https://plus.google.com/share?url='.urlencode(cs_format_share_url($url,'3')).'&title='.urlencode($title).'\',\'_new\');" alt="Share on Google+"></div>'.$count4r.''.$gap_string.'';
274
+ $share_arr[7]='<div style=\'float:left;\'>'.$count7.'<img '.$src_style7.' onclick="share_on_cs(\'2\',\''.$user_ID.'\');window.open(\'https://www.linkedin.com/cws/share?url='.urlencode(cs_format_share_url($url,'2')).'&title='.urlencode($title).'\',\'_new\');" alt="Share on LinkedIN" ></div>'.$count7r.''.$gap_string.'';
275
+ $share_arr[13]='<div style=\'float:left;\'>'.$count13.'<img '.$src_style13.' onclick="share_on_cs(\'4\',\''.$user_ID.'\');window.open(\'http://twitter.com/share?url='.urlencode(cs_format_share_url($url,'4')).'&text='.urlencode($title).'\',\'_new\');" alt="Share on Twitter"></div>'.$count13r.''.$gap_string.'';
276
+ $share_arr[17]='<div style=\'float:left;\'>'.$count17.'<img '.$src_style17.' onclick="share_on_cs(\'5\',\''.$user_ID.'\');" alt="Pin It"></div>'.$count17r.''.$gap_string.'';
277
+ $share_arr[18]='<div style=\'float:left;\'>'.$count18.'<img '.$src_style18.' onclick="share_on_cs(\'6\',\''.$user_ID.'\');" alt="Share on Whatsapp"></div>'.$count18r.''.$gap_string.'';
278
+ $start_div='<div id="scssdiv" style="clear:both;wdth:100%;height:100%;z-index:999;display:inline-block;">';
279
+ $end_div='</div>';
280
+ if($display_style=='1' || $display_style=='2' )
281
+ {
282
+
283
+ $left_right=($display_style=='2')?'right:0;':'left:0;';
284
+ $multiplier_div=($counter_type=='0')?'2':'1';
285
+ $add_extra=($counter_type=='0')?'20':'0';
286
+ $start_div='<div id="scssdiv" style="width:'.intval(($iwidth[0]*$multiplier_div)+$add_extra).'px;position:fixed;top:30%;'.$left_right.'display:inline-block;height:100%;z-index:999;display:inline-block;">';
287
+ $end_div='</div>';
288
+ }
289
+
290
+
291
+ $js_code .= PHP_EOL;
292
+ $js_code .=$start_div;
293
+ foreach($share_button as $key=>$val)
294
+ {
295
+
296
+ $js_code .=$share_arr[$val];
297
+ }
298
+ $js_code .=$end_div;
299
+
300
+
301
+
302
+ echo $js_code;
303
+ }
304
+ }
305
+ ?>
app/design/frontend/base/default/template/socialloginsharing/socialshare_show.phtml ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $is_validated=Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_validated');
3
+ if($is_validated=='1')
4
+ {
5
+ /*$scss_product_page=false;
6
+ if(Mage::registry('current_product')) {
7
+ $scss_product_page = true;
8
+ }
9
+ */
10
+ $display_style=Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/displaystyle');
11
+ if(!function_exists('cs_get_plusones'))
12
+ {
13
+
14
+ function cs_get_plusones($url) {
15
+ $curl = curl_init();
16
+ curl_setopt($curl, CURLOPT_URL, "https://clients6.google.com/rpc");
17
+ curl_setopt($curl, CURLOPT_POST, true);
18
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
19
+ curl_setopt($curl, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"'.rawurldecode($url).'","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]');
20
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
21
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
22
+ $curl_results = curl_exec ($curl);
23
+ curl_close ($curl);
24
+ $json = json_decode($curl_results, true);
25
+ return isset($json[0]['result']['metadata']['globalCounts']['count'])?intval( $json[0]['result']['metadata']['globalCounts']['count'] ):0;
26
+ }
27
+
28
+ }
29
+ if(!function_exists('cs_format_share_url'))
30
+ {
31
+ function cs_format_share_url($url,$source)
32
+ {
33
+
34
+ $name = "scsource";
35
+ $value = $source;
36
+
37
+
38
+ $separator = "?";
39
+ if (strpos($url,"?")!==false)
40
+ $separator = "&";
41
+
42
+
43
+ $insertPosition = strlen($url);
44
+ if (strpos($url,"#")!==false)
45
+ $insertPosition = strpos($url,"#");
46
+
47
+
48
+ $newUrl = substr_replace($url,"$separator$name=$value",$insertPosition,0);
49
+
50
+ return $newUrl;
51
+ }
52
+
53
+ }
54
+
55
+ if($display_style=='1' || $display_style=='2')
56
+ {
57
+
58
+ $iwidth=explode("x",Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/iconsize'));
59
+ $button_style=Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/yourstyle');
60
+ $display_style=Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/displaystyle');
61
+ $gap=Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/gapsetting');
62
+ $counter_type=Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/countersetting');
63
+ $share_button=explode(",",Mage::getStoreConfig('socialloginsharing_options/displaysettingshare/socialproviders'));
64
+
65
+ $vartical_top=$counter_position="";
66
+ $main_div='height:'.$iwidth[0].'px';
67
+ $cspageURL = 'http';
68
+ if($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
69
+ $cspageURL .= "://";
70
+ if ($_SERVER["SERVER_PORT"] != "80") {
71
+ $cspageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
72
+ } else {
73
+ $cspageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
74
+ }
75
+ $url=$cspageURL;
76
+ if($counter_type=='0' || $counter_type=='1')
77
+ {
78
+
79
+ $counter_position='.arrow_box:after, .arrow_box:before { top: 100%; left: 50%; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; pointer-events: none; } .arrow_box:after { border-color: rgba(255, 255, 255, 0); border-top-color: #fff; border-width: 6px; margin-left: -6px; } .arrow_box:before { border-color: rgba(204, 204, 203, 0); border-top-color: #cccccb; border-width: 7px; margin-left: -7px; }';
80
+ if($counter_type=='0')
81
+ {
82
+ $main_div='float:left;margin-top:0px;margin-left:8px;height:'.$iwidth[0].'px;margin-right:8px;';
83
+
84
+ $counter_position='.arrow_box:after, .arrow_box:before { right: 100%; top: 50%; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; pointer-events: none; } .arrow_box:after { border-color: rgba(255, 255, 255, 0); border-right-color: #fff; border-width: 6px; margin-top: -6px; } .arrow_box:before { border-color: rgba(204, 204, 203, 0); border-right-color: #cccccb; border-width: 7px; margin-top: -7px; }';
85
+ }
86
+ $js_code .='<style>'.PHP_EOL.
87
+ '.arrow_box { width: '.($iwidth[0]-5).'px; margin-bottom:8px;'.$main_div.' border-radius: 1px; position: relative; background: #fff; border: 1px solid #cccccb; }'.$counter_position.''.PHP_EOL.
88
+ '</style>'.PHP_EOL;
89
+ }
90
+ $useragent=$_SERVER['HTTP_USER_AGENT'];
91
+ $mobile_Display="display:none;";
92
+ $comon_counter_start='<div class="arrow_box" ><div style="color:#000;font-weight:bold;position: relative;width: 100%;text-align: center;'.$counter_top_margin.'">';
93
+ $comon_counter_start_18='<div class="arrow_box" style="display:none;"><div style="color:#000;font-weight:bold;position: relative;width: 100%;text-align: center;'.$counter_top_margin.'">';
94
+ if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4)))
95
+ {
96
+
97
+ $mobile_Display="display:inline-block;";
98
+ $comon_counter_start_18='<div class="arrow_box"><div style="color:#000;font-weight:bold;position: relative;width: 100%;text-align: center;'.$counter_top_margin.'">';
99
+ }
100
+
101
+ if($button_style=='1')
102
+ {
103
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/facebook_square.png"';
104
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/google_plus_square.png"';
105
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/rounded/linkedin_square.png\'';
106
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/twitter_square.png"';
107
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/pinterest_square.png"';
108
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/whatsapp_square.png"';
109
+
110
+ }
111
+ else if($button_style=='2')
112
+ {
113
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/facebook.png"';
114
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/google_plus.png"';
115
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/rounded/linkedin.png\'';
116
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/twitter.png"';
117
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/pinterest.png"';
118
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/whatsapp.png"';
119
+ }
120
+ else if($button_style=='3')
121
+ {
122
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/facebook_grey.png"';
123
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/google_plus_grey.png"';
124
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/rounded/linkedin_grey.png\'';
125
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/twitter_grey.png"';
126
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/pinterest_grey.png"';
127
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/whatsapp_grey.png"';
128
+ }
129
+ else if($button_style=='4')
130
+ {
131
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/facebook_grey_circle.png"';
132
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/google_plus_grey_circle.png"';
133
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/rounded/linkedin_grey_circle.png\'';
134
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/twitter_grey_circle.png"';
135
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/pinterest_grey_circle.png"';
136
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded/whatsapp_grey_circle.png"';
137
+ }
138
+ else if($button_style=='5')
139
+ {
140
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/flower/facebook_flower.png"';
141
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/flower/google_flower.png"';
142
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/flower/linkedin_flower.png\'';
143
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/flower/twitter_flower.png"';
144
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/flower/pinterest_flower.png"';
145
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
146
+
147
+ }
148
+ else if($button_style=='6')
149
+ {
150
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/glossy/facebook_glossy.png"';
151
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/glossy/google_glossy.png"';
152
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/glossy/linkedin_glossy.png\'';
153
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/glossy/twitter_glossy.png"';
154
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/glossy/pinterest_glossy.png"';
155
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
156
+
157
+ }
158
+ else if($button_style=='7')
159
+ {
160
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/leaf/facebook_leaf.png"';
161
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/leaf/google_leaf.png"';
162
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/leaf/linkedin_leaf.png\'';
163
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/leaf/twitter_leaf.png"';
164
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/leaf/pinterest_leaf.png"';
165
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
166
+
167
+ }
168
+ else if($button_style=='8')
169
+ {
170
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/polygon/facebook_polygon.png"';
171
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/polygon/google_polygon.png"';
172
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/polygon/linkedin_polygon.png\'';
173
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/polygon/twitter_polygon.png"';
174
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/polygon/pinterest_polygon.png"';
175
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
176
+
177
+ }
178
+ else if($button_style=='9')
179
+ {
180
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rectangular/facebook_rectangular.png"';
181
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rectangular/google_rectangular.png"';
182
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/rectangular/linkedin_rectangular.png\'';
183
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rectangular/twitter_rectangular.png"';
184
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rectangular/pinterest_rectangular.png"';
185
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
186
+
187
+ }
188
+ else if($button_style=='10')
189
+ {
190
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded_corners/facebook_rounded_corners.png"';
191
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded_corners/google_rounded_corners.png"';
192
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/rounded_corners/linkedin_rounded_corners.png\'';
193
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded_corners/twitter_rounded_corners.png"';
194
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/rounded_corners/pinterest_rounded_corners.png"';
195
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
196
+
197
+ }
198
+ else if($button_style=='11')
199
+ {
200
+ $src_style2='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/waterdrop/facebook_waterdrop.png"';
201
+ $src_style4='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/waterdrop/google_waterdrop.png"';
202
+ $src_style7='style=\'width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;\' src=\'https://www.socleversocial.com/dashboard/img/social_icon/waterdrop/linkedin_waterdrop.png\'';
203
+ $src_style13='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/waterdrop/twitter_waterdrop.png"';
204
+ $src_style17='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;" src="https://www.socleversocial.com/dashboard/img/social_icon/waterdrop/pinterest_waterdrop.png"';
205
+ $src_style18='style="width:'.$iwidth[0].'px;height:'.$iwidth[0].'px;cursor:pointer;'.$mobile_Display.'" src="https://www.socleversocial.com/dashboard/img/social_icon/square/whatsapp_square.png"';
206
+ }
207
+ if($display_style=='1')
208
+ {
209
+ $gap_string='<div style=\'float:left;height:'.$gap.'px;\'>&nbsp;</div>';
210
+ }
211
+ else
212
+ {
213
+ $gap_string='<div style=\'float:left;width:'.$gap.'px;\'>&nbsp;</div>';
214
+ }
215
+
216
+ if($counter_type=='0' || $counter_type=='1')
217
+ {
218
+ //$url=$this->helper('core/url')->getCurrentUrl();
219
+
220
+
221
+ $fburl=$url.(parse_url($url, PHP_URL_QUERY) ? '&' : '?').'scsource=1';
222
+ $liurl=$url.(parse_url($url, PHP_URL_QUERY) ? '&' : '?').'scsource=2';
223
+ $gpurl=$url.(parse_url($url, PHP_URL_QUERY) ? '&' : '?').'scsource=3';
224
+ $twurl=$url.(parse_url($url, PHP_URL_QUERY) ? '&' : '?').'scsource=4';
225
+
226
+ $fb=json_decode(file_get_contents("http://graph.facebook.com/?ids=".$url.",".$fburl.""));
227
+ $tw=json_decode(file_get_contents("http://cdn.api.twitter.com/1/urls/count.json?url=".$url.""));
228
+ $tw2=json_decode(file_get_contents("http://cdn.api.twitter.com/1/urls/count.json?url=".$twurl.""));
229
+ $li=json_decode(file_get_contents("http://www.linkedin.com/countserv/count/share?url=".$url."&format=json"));
230
+ $li2=json_decode(file_get_contents("http://www.linkedin.com/countserv/count/share?url=".$liurl."&format=json"));
231
+ $pin_count=file_get_contents("http://api.pinterest.com/v1/urls/count.json?url=".$url."");
232
+
233
+ $whatsapp_count=file_get_contents("https://www.socleversocial.com/dashboard/whatsappcount.php?site_id=".Mage::getStoreConfig('socialloginsharing_options/apisettings/scsl_siteid')."&url=".$url."");
234
+ $str=substr(substr($pin_count,0,-1),13);
235
+ $pin_arr=json_decode($str);
236
+
237
+
238
+ $fb=json_decode(file_get_contents("http://graph.facebook.com/?id=".$url.""));
239
+ $tw=json_decode(file_get_contents("http://cdn.api.twitter.com/1/urls/count.json?url=".$url.""));
240
+ $li=json_decode(file_get_contents("http://www.linkedin.com/countserv/count/share?url=".$url."&format=json"));
241
+ $pin_count=file_get_contents("http://api.pinterest.com/v1/urls/count.json?url=".$url."");
242
+
243
+ $str=substr(substr($pin_count,0,-1),13);
244
+ $pin_arr=json_decode($str);
245
+
246
+
247
+ $fb_shares="FB Shares=".$fb->shares."==Googleplus==".$count."==Twitter=".$tw->count."===Linked==".$li->count."==Pinterest==".$pin_arr->count;
248
+ $counter_top_margin='';
249
+ if($counter_type=='0')
250
+ {
251
+ $counter_top_margin='margin-top:'.intval($iwidth[0]/4).'px;';
252
+ }
253
+
254
+ $comon_counter_end='</div></div>';
255
+ $count2=$count4=$count7=$count13=$count17="";
256
+ $count2r=$count2=''.$comon_counter_start.''.intval($fb->$url->shares+$fb->$fburl->shares).''.$comon_counter_end.'';
257
+ $count4r=$count4=''.$comon_counter_start.''.intval(cs_get_plusones($url)+cs_get_plusones($gpurl)).''.$comon_counter_end.'';
258
+ $count7r=$count7=''.$comon_counter_start.''.intval($tw->count+$tw2->count).''.$comon_counter_end.'';
259
+ $count13r=$count13=''.$comon_counter_start.''.intval($li->count+$li2->count).''.$comon_counter_end.'';
260
+ $count17r=$count17=''.$comon_counter_start.''.intval($pin_arr->count).''.$comon_counter_end.'';
261
+ $count18r=$count18=''.$comon_counter_start_18.''.intval($whatsapp_count).''.$comon_counter_end.'';
262
+ }
263
+ if($counter_type=='0')
264
+ {
265
+ $count2=$count4=$count7=$count13=$count17=$count18="";
266
+ }
267
+ else
268
+ {
269
+ $count2r=$count4r=$count7r=$count13r=$count17r=$count18r="";
270
+ }
271
+
272
+ if($customer = Mage::getSingleton('customer/session')->isLoggedIn()) {
273
+
274
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
275
+ //$customerData = Mage::getModel('customer/customer')->load($customer->getId())->getData();
276
+
277
+ $user_ID=$customerData->getId();
278
+
279
+ }
280
+ $title=$this->getLayout()->getBlock('head')->getTitle();
281
+ $share_arr[2]='<div style="float:left;">'.$count2.'<img '.$src_style2.' onclick="share_on_cs(\'1\',\''.$user_ID.'\');window.open(\'http://www.facebook.com/sharer.php?u='.urlencode(cs_format_share_url($url,'1')).'&t='.urlencode($title).'\',\'_new\');" alt="Share on Facebook" ></div>'.$count2r.''.$gap_string.'';
282
+ $share_arr[4]='<div style=\'float:left;\'>'.$count4.'<img '.$src_style4.' onclick="share_on_cs(\'3\',\''.$user_ID.'\');window.open(\'https://plus.google.com/share?url='.urlencode(cs_format_share_url($url,'3')).'&title='.urlencode($title).'\',\'_new\');" alt="Share on Google+"></div>'.$count4r.''.$gap_string.'';
283
+ $share_arr[7]='<div style=\'float:left;\'>'.$count7.'<img '.$src_style7.' onclick="share_on_cs(\'2\',\''.$user_ID.'\');window.open(\'https://www.linkedin.com/cws/share?url='.urlencode(cs_format_share_url($url,'2')).'&title='.urlencode($title).'\',\'_new\');" alt="Share on LinkedIN" ></div>'.$count7r.''.$gap_string.'';
284
+ $share_arr[13]='<div style=\'float:left;\'>'.$count13.'<img '.$src_style13.' onclick="share_on_cs(\'4\',\''.$user_ID.'\');window.open(\'http://twitter.com/share?url='.urlencode(cs_format_share_url($url,'4')).'&text='.urlencode($title).'\',\'_new\');" alt="Share on Twitter"></div>'.$count13r.''.$gap_string.'';
285
+ $share_arr[17]='<div style=\'float:left;\'>'.$count17.'<img '.$src_style17.' onclick="share_on_cs(\'5\',\''.$user_ID.'\');" alt="Pin It"></div>'.$count17r.''.$gap_string.'';
286
+ $share_arr[18]='<div style=\'float:left;\'>'.$count18.'<img '.$src_style18.' onclick="share_on_cs(\'6\',\''.$user_ID.'\');" alt="Share on Whatsapp"></div>'.$count18r.''.$gap_string.'';
287
+
288
+
289
+ $start_div='<div id="scssdiv" style="clear:both;wdth:100%;height:100%;display:inline-block;z-index:999;">';
290
+ $end_div='</div>';
291
+ if($display_style=='1' || $display_style=='2' )
292
+ {
293
+
294
+ $left_right=($display_style=='2')?'right:0;':'left:0;';
295
+ $multiplier_div=($counter_type=='0')?'2':'1';
296
+ $add_extra=($counter_type=='0')?'20':'0';
297
+ $start_div='<div id="scssdiv" style="width:'.intval(($iwidth[0]*$multiplier_div)+$add_extra).'px;position:fixed;top:30%;'.$left_right.'display:inline-block;height:100%;z-index:999;">';
298
+ $end_div='</div>';
299
+ }
300
+
301
+
302
+ $js_code .= PHP_EOL;
303
+ $js_code .=$start_div;
304
+ foreach($share_button as $key=>$val)
305
+ {
306
+
307
+ $js_code .=$share_arr[$val];
308
+ }
309
+ $js_code .=$end_div;
310
+
311
+
312
+
313
+ echo $js_code;
314
+ }
315
+ }
316
+ ?>
app/etc/modules/soclever_socialloginsharing.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Soclever_Socialloginsharing>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Soclever_Socialloginsharing>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>socleverloginsharing</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This module enables Social Login (Facebook and more) social sharing with detail User Profile Data &amp; Social Analytics on your site</summary>
10
+ <description>&lt;p&gt;SoClevers provides FREE social login tools to help increase conversions, registration rates, increase comments by allowing easier registrations. Our Plugin works with Facebook, Google+ LinkedIn, PayPal, Yahoo! &amp; Instagram. Our JavaScript is asynchronous ensuring fast load time, and it is also dynamic so you can A-B test from our dashboard without needing to re-code.&lt;/p&gt;&#xD;
11
+ &lt;p&gt;SoClever social sharing use Industry leading Asynchronous JavaScript for fasted load speed, not affecting site speed what so ever.&lt;/p&gt;&#xD;
12
+ &lt;p&gt;Customizable designs, size, position and shape. Select ours or load your own logo designs.&lt;/p&gt;&#xD;
13
+ &lt;p&gt;Our social login icons are 100% customizable, size, shape and colour. Select ours or load your own logo icon designs. &#xD;
14
+ &lt;/p&gt;&#xD;
15
+ &lt;p&gt;You'll need a SoClever API to use it. API Keys are free; paid subscriptions are available for advanced reporting, analytics and demographic data. Download now, no lock in contracts or credit card required.&lt;/p&gt;&#xD;
16
+ &lt;p&gt;Thanks for choosing our plugin, feel free to leave a review or contact us for any feedback. If you want to know more about the features we offer, keep reading below.&lt;/p&gt;&#xD;
17
+ &lt;h3&gt;&lt;strong&gt;Features&lt;/strong&gt;&lt;/h3&gt;&#xD;
18
+ &lt;p&gt;&lt;strong&gt;Social Login&lt;/strong&gt;&lt;br /&gt;&#xD;
19
+ Eliminate registration forms and let your customer / visitors sign-up in few seconds using trusted IDs like Facebook, Twitter, Google, Yahoo, and more. Increase your sign-up rates and start building a loyal customer list today.&lt;/p&gt;&#xD;
20
+ &lt;p&gt;&lt;strong&gt;Social Sharing&lt;/strong&gt;&lt;br /&gt;&#xD;
21
+ Allow users to share your pages to famous social networks and get free traffic from social networks.&lt;/p&gt;&#xD;
22
+ &lt;p&gt;&lt;strong&gt;Track Revenue&lt;/strong&gt;&lt;br /&gt;&#xD;
23
+ Have an e-commerce site? Track revenue per social user, download customer segments to personalise your marketing messages. &lt;/p&gt;&#xD;
24
+ &lt;p&gt;&lt;strong&gt;Top Facebook likes&lt;/strong&gt;&lt;br /&gt;&#xD;
25
+ Download our reports on top Facebook Liked pages of your customers/visitors, filter to add top revenue customers and their top likes. Quick CSV upload of this data to Facebook, you can create a new and more targeted advertising campaigns. &lt;/p&gt;&#xD;
26
+ &lt;p&gt;&lt;strong&gt;User Profile Data &amp;amp; Social Analytics&lt;/strong&gt;&lt;br /&gt;&#xD;
27
+ Build a rich profile of your customers with our unique reporting dashboard. Get access to full name, email address, DOB, gender, relationship status, home town, place of birth, like, interests and much more with SoClever&#x2019;s social login.&lt;/p&gt;&#xD;
28
+ &lt;p&gt;&lt;strong&gt;Birthday Reports&lt;/strong&gt;&lt;br /&gt;&#xD;
29
+ Send personalised message to your visitors by using our birthday reports. &lt;/p&gt;&#xD;
30
+ &lt;p&gt;&lt;strong&gt;Dynamic JavaScript&lt;/strong&gt;&lt;br /&gt;&#xD;
31
+ Our asynchronous javascript loads faster without interfearing with the display or behaviour of the page. Dynamic JavaScript makes it easy to choose/sort social netork buttons for display.&lt;/p&gt;</description>
32
+ <notes>Released Stable Version 1.0.0</notes>
33
+ <authors><author><name>Soclever Social</name><user>Socleversocial</user><email>hemang@socleversocial.com</email></author></authors>
34
+ <date>2015-02-21</date>
35
+ <time>13:56:01</time>
36
+ <contents><target name="magelocal"><dir name="Soclever"><dir name="Socialloginsharing"><dir name="Model"><file name="Observer.php" hash="475751edc201b924a7d0f78eb34032f0"/><file name="Providers.php" hash="9839bd2b133cd6d788e312c7262711db"/></dir><dir name="Block"><file name="Scslhead.php" hash="219920fc652715e4383509b0ceedf82f"/><file name="Scslshow.php" hash="e979ec3119f18b8d0b8a2dc38b2d0341"/><file name="Scsltrackpixel.php" hash="dcb7add6ba6acd6cfd8080b40d2b0e24"/><file name="Scslheadfb.php" hash="4298e17782026f4003694ebcb1149376"/><file name="Scsshead.php" hash="173c515d7a83f8b42cd00d38bcd47a5e"/><file name="Scsshow.php" hash="392625a6c38bec962120fa40f0cf68ed"/></dir><dir name="controllers"><file name="IndexController.php" hash="8018f017f178bb4968268de4a74d7295"/><file name="openid.php" hash="421d5936957b8ddda543b679d1876f04"/></dir><dir name="etc"><file name="config.xml" hash="16f95dbbf39e055bacc289de3de754db"/><file name="system.xml" hash="11714ec8859aacefc045caf1410eecff"/></dir><dir name="Helper"><file name="Data.php" hash="035a7f9b50f1e92c9955e427d4e7a73e"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="socialloginsharing.xml" hash="4d3f31232917e026cc92b3dabaa5ac61"/></dir><dir name="template"><dir name="socialloginsharing"><file name="scsl_buttons.phtml" hash="cc15fbe26dfb2a0d54b3768c613a10c9"/><file name="sociallogin_fb.phtml" hash="718d8596a14d123d83afb0d5d6d6fd96"/><file name="sociallogin_head.phtml" hash="b184204ebae539cabc3f1d5bac63bd62"/><file name="sociallogin_trackpixel.phtml" hash="542ceb3ba7d5314f2f9aad416636d349"/><file name="socialshare_head.phtml" hash="f35a4bdaad57d1731be186f9e0ac612e"/><file name="socialshare_product.phtml" hash="2fbb95766a1675e69ef2b1f60db0457e"/><file name="socialshare_show.phtml" hash="0587dfce9e8c9a8049201e00ea7699b0"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="soclever_socialloginsharing.xml" hash="17a99813f44f3aa85a4781558133ac5c"/></dir></target></contents>
37
+ <compatible/>
38
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
39
+ </package>