WordPress Social Share, Social Login and Social Comments Plugin – Super Socializer - Version 7.13.38

Version Description

[25 August 2022] = * [Bugfix] "Allow cyrillic characters in the name" option was causing PHP error when all the checkboxes were unchecked * [Bugfix] Fixed the background-color and logo of Vkontakte icon in the "Super Socializer - Follow Icons" widget * [Bugfix] Line login was not working in the mobile devices * [Improvement] Performance improvement

Download this release

Release Info

Developer the_champ
Plugin Icon 128x128 WordPress Social Share, Social Login and Social Comments Plugin – Super Socializer
Version 7.13.38
Comparing to
See all releases

Code changes from version 7.13.37 to 7.13.38

admin/social_login.php CHANGED
@@ -1727,11 +1727,11 @@
1727
  <label><?php _e("Allow cyrillic characters in the name", 'super-socializer'); ?></label><img id="the_champ_sl_cyrillic_help" class="the_champ_help_bubble" src="<?php echo plugins_url('../images/info.png', __FILE__) ?>" />
1728
  </th>
1729
  <td>
1730
- <input id="the_champ_sl_cyrillic" name="the_champ_login[allow_cyrillic][]" type="checkbox" <?php echo in_array('cyrillic', $theChampLoginOptions['allow_cyrillic']) ? 'checked' : '';?> value="cyrillic" />
1731
  <label for="the_champ_sl_cyrillic"><?php _e('Allow cyrillic', 'super-socializer') ?></label><br/>
1732
- <input id="the_champ_sl_cyrillic_arabic" name="the_champ_login[allow_cyrillic][]" type="checkbox" <?php echo in_array('arabic', $theChampLoginOptions['allow_cyrillic']) ? 'checked' : ''; ?> value="arabic" />
1733
  <label for="the_champ_sl_cyrillic_arabic"><?php _e('Allow Arabic', 'super-socializer') ?></label><br/>
1734
- <input id="the_champ_sl_cyrillic_chinese" name="the_champ_login[allow_cyrillic][]" type="checkbox" <?php echo in_array('chinese', $theChampLoginOptions['allow_cyrillic']) ? 'checked' : '';?> value="chinese" />
1735
  <label for="the_champ_sl_cyrillic_chinese"><?php _e('Allow Chinese', 'super-socializer') ?></label>
1736
  </td>
1737
  </tr>
1727
  <label><?php _e("Allow cyrillic characters in the name", 'super-socializer'); ?></label><img id="the_champ_sl_cyrillic_help" class="the_champ_help_bubble" src="<?php echo plugins_url('../images/info.png', __FILE__) ?>" />
1728
  </th>
1729
  <td>
1730
+ <input id="the_champ_sl_cyrillic" name="the_champ_login[allow_cyrillic][]" type="checkbox" <?php echo isset($theChampLoginOptions['allow_cyrillic']) && is_array($theChampLoginOptions['allow_cyrillic']) && in_array('cyrillic', $theChampLoginOptions['allow_cyrillic']) ? 'checked' : '';?> value="cyrillic" />
1731
  <label for="the_champ_sl_cyrillic"><?php _e('Allow cyrillic', 'super-socializer') ?></label><br/>
1732
+ <input id="the_champ_sl_cyrillic_arabic" name="the_champ_login[allow_cyrillic][]" type="checkbox" <?php echo isset($theChampLoginOptions['allow_cyrillic']) && is_array($theChampLoginOptions['allow_cyrillic']) && in_array('arabic', $theChampLoginOptions['allow_cyrillic']) ? 'checked' : ''; ?> value="arabic" />
1733
  <label for="the_champ_sl_cyrillic_arabic"><?php _e('Allow Arabic', 'super-socializer') ?></label><br/>
1734
+ <input id="the_champ_sl_cyrillic_chinese" name="the_champ_login[allow_cyrillic][]" type="checkbox" <?php echo isset($theChampLoginOptions['allow_cyrillic']) && is_array($theChampLoginOptions['allow_cyrillic']) && in_array('chinese', $theChampLoginOptions['allow_cyrillic']) ? 'checked' : '';?> value="chinese" />
1735
  <label for="the_champ_sl_cyrillic_chinese"><?php _e('Allow Chinese', 'super-socializer') ?></label>
1736
  </td>
1737
  </tr>
helper.php CHANGED
@@ -916,11 +916,11 @@ function the_champ_social_avatar_options(){
916
  $dontUpdateAvatar = get_user_meta($user_ID, 'thechamp_dontupdate_avatar', true);
917
  }
918
  if(isset($_POST['ss_small_avatar']) && heateor_ss_validate_url($_POST['ss_small_avatar']) !== false){
919
- $updatedSmallAvatar = str_replace('http://', '//', sanitize_url(trim($_POST['ss_small_avatar'])));
920
  update_user_meta($user_ID, 'thechamp_avatar', $updatedSmallAvatar);
921
  }
922
  if(isset($_POST['ss_large_avatar']) && heateor_ss_validate_url($_POST['ss_large_avatar']) !== false){
923
- $updatedLargeAvatar = str_replace('http://', '//', sanitize_url(trim($_POST['ss_large_avatar'])));
924
  update_user_meta($user_ID, 'thechamp_large_avatar', $updatedLargeAvatar);
925
  }
926
  ?>
916
  $dontUpdateAvatar = get_user_meta($user_ID, 'thechamp_dontupdate_avatar', true);
917
  }
918
  if(isset($_POST['ss_small_avatar']) && heateor_ss_validate_url($_POST['ss_small_avatar']) !== false){
919
+ $updatedSmallAvatar = str_replace('http://', '//', esc_url_raw(trim($_POST['ss_small_avatar'])));
920
  update_user_meta($user_ID, 'thechamp_avatar', $updatedSmallAvatar);
921
  }
922
  if(isset($_POST['ss_large_avatar']) && heateor_ss_validate_url($_POST['ss_large_avatar']) !== false){
923
+ $updatedLargeAvatar = str_replace('http://', '//', esc_url_raw(trim($_POST['ss_large_avatar'])));
924
  update_user_meta($user_ID, 'thechamp_large_avatar', $updatedLargeAvatar);
925
  }
926
  ?>
inc/shortcode.php CHANGED
@@ -260,7 +260,7 @@ function the_champ_fb_commenting_shortcode($params){
260
  global $heateor_fcm_options;
261
  $html .= '<div class="heateor_ss_fb_comments_optin_container"><label><input type="checkbox" class="heateor_ss_fb_comments_optin" value="1" />'. str_replace($heateor_fcm_options['ppu_placeholder'], '<a href="'. $heateor_fcm_options['privacy_policy_url'] .'" target="_blank">'. $heateor_fcm_options['ppu_placeholder'] .'</a>', wp_strip_all_tags($heateor_fcm_options['privacy_policy_optin_text'])) .'</label></div>';
262
  }
263
- $html .= '<div class="fb-comments" data-href="' .($url == '' ? sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]) : $url). '"';
264
  $html .= ' data-numposts="' . $num_posts . '"';
265
  $html .= ' data-width="' . ($width == '' ? '100%' : $width) . '"';
266
  $html .= ' ></div></div><script type="text/javascript" src="//connect.facebook.net/' . $language . '/sdk.js
260
  global $heateor_fcm_options;
261
  $html .= '<div class="heateor_ss_fb_comments_optin_container"><label><input type="checkbox" class="heateor_ss_fb_comments_optin" value="1" />'. str_replace($heateor_fcm_options['ppu_placeholder'], '<a href="'. $heateor_fcm_options['privacy_policy_url'] .'" target="_blank">'. $heateor_fcm_options['ppu_placeholder'] .'</a>', wp_strip_all_tags($heateor_fcm_options['privacy_policy_optin_text'])) .'</label></div>';
262
  }
263
+ $html .= '<div class="fb-comments" data-href="' .($url == '' ? esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]) : $url). '"';
264
  $html .= ' data-numposts="' . $num_posts . '"';
265
  $html .= ' data-width="' . ($width == '' ? '100%' : $width) . '"';
266
  $html .= ' ></div></div><script type="text/javascript" src="//connect.facebook.net/' . $language . '/sdk.js
inc/social_sharing.php CHANGED
@@ -608,7 +608,7 @@ function the_champ_render_sharing($content){
608
  if($theChampCounterOptions['horizontal_target_url'] == 'default'){
609
  $counterPostUrl = get_permalink($post->ID);
610
  if((isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) || $counterPostUrl == ''){
611
- $counterPostUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
612
  }
613
  }elseif($theChampCounterOptions['horizontal_target_url'] == 'home'){
614
  $counterPostUrl = esc_url(home_url());
@@ -677,10 +677,10 @@ function the_champ_render_sharing($content){
677
  if($theChampCounterOptions['vertical_target_url'] == 'default'){
678
  $counterPostUrl = get_permalink($post->ID);
679
  if(!is_singular()){
680
- $counterPostUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
681
  $postId = 0;
682
  }elseif((isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) || $counterPostUrl == ''){
683
- $counterPostUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
684
  }
685
  }elseif($theChampCounterOptions['vertical_target_url'] == 'home'){
686
  $counterPostUrl = esc_url(home_url());
@@ -756,7 +756,7 @@ function the_champ_render_sharing($content){
756
  $postUrl = get_permalink($post->ID);
757
  $shareCountUrl = $postUrl;
758
  if((isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) || $postUrl == ''){
759
- $postUrl = sanitize_url(str_replace(array('%3Cscript%3E', '%3C/script%3E', '%2Fscript', '%3Bscript'), '', the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]));
760
  }
761
  if($shareCountUrl == ''){
762
  $shareCountUrl = $postUrl;
@@ -838,11 +838,11 @@ function the_champ_render_sharing($content){
838
  $postUrl = get_permalink($post->ID);
839
  $shareCountUrl = $postUrl;
840
  if(!is_singular()){
841
- $postUrl = sanitize_url(str_replace(array('%3Cscript%3E', '%3C/script%3E', '%2Fscript', '%3Bscript'), '', the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]));
842
  $postId = 0;
843
  $shareCountUrl = $postUrl;
844
  }elseif((isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) || $postUrl == ''){
845
- $postUrl = sanitize_url(str_replace(array('%3Cscript%3E', '%3C/script%3E', '%2Fscript', '%3Bscript'), '', the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]));
846
  }
847
  if($shareCountUrl == ''){
848
  $shareCountUrl = $postUrl;
@@ -949,7 +949,7 @@ if(isset($theChampSharingOptions['woocom_thankyou']) || isset($theChampCounterOp
949
  */
950
  function the_champ_sanitize_url_array($url){
951
  if(heateor_ss_validate_url($url) !== false){
952
- return sanitize_url($url);
953
  }
954
  }
955
 
608
  if($theChampCounterOptions['horizontal_target_url'] == 'default'){
609
  $counterPostUrl = get_permalink($post->ID);
610
  if((isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) || $counterPostUrl == ''){
611
+ $counterPostUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
612
  }
613
  }elseif($theChampCounterOptions['horizontal_target_url'] == 'home'){
614
  $counterPostUrl = esc_url(home_url());
677
  if($theChampCounterOptions['vertical_target_url'] == 'default'){
678
  $counterPostUrl = get_permalink($post->ID);
679
  if(!is_singular()){
680
+ $counterPostUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
681
  $postId = 0;
682
  }elseif((isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) || $counterPostUrl == ''){
683
+ $counterPostUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
684
  }
685
  }elseif($theChampCounterOptions['vertical_target_url'] == 'home'){
686
  $counterPostUrl = esc_url(home_url());
756
  $postUrl = get_permalink($post->ID);
757
  $shareCountUrl = $postUrl;
758
  if((isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) || $postUrl == ''){
759
+ $postUrl = esc_url_raw(str_replace(array('%3Cscript%3E', '%3C/script%3E', '%2Fscript', '%3Bscript'), '', the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]));
760
  }
761
  if($shareCountUrl == ''){
762
  $shareCountUrl = $postUrl;
838
  $postUrl = get_permalink($post->ID);
839
  $shareCountUrl = $postUrl;
840
  if(!is_singular()){
841
+ $postUrl = esc_url_raw(str_replace(array('%3Cscript%3E', '%3C/script%3E', '%2Fscript', '%3Bscript'), '', the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]));
842
  $postId = 0;
843
  $shareCountUrl = $postUrl;
844
  }elseif((isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) || $postUrl == ''){
845
+ $postUrl = esc_url_raw(str_replace(array('%3Cscript%3E', '%3C/script%3E', '%2Fscript', '%3Bscript'), '', the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]));
846
  }
847
  if($shareCountUrl == ''){
848
  $shareCountUrl = $postUrl;
949
  */
950
  function the_champ_sanitize_url_array($url){
951
  if(heateor_ss_validate_url($url) !== false){
952
+ return esc_url_raw($url);
953
  }
954
  }
955
 
inc/widget.php CHANGED
@@ -134,15 +134,15 @@ class TheChampSharingWidget extends WP_Widget {
134
  $postId = 0;
135
  }elseif(isset($instance['target_url'])){
136
  if($instance['target_url'] == 'default'){
137
- $sharingUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
138
  if(is_home()){
139
- $sharingUrl = sanitize_url(home_url());
140
  $postId = 0;
141
  }elseif(!is_singular()){
142
- $sharingUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
143
  $postId = 0;
144
  }elseif(isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']){
145
- $sharingUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
146
  }elseif(get_permalink($post->ID)){
147
  $sharingUrl = get_permalink($post->ID);
148
  }
@@ -313,15 +313,15 @@ class TheChampVerticalSharingWidget extends WP_Widget {
313
  $postId = 0;
314
  }elseif(isset($instance['target_url'])){
315
  if($instance['target_url'] == 'default'){
316
- $sharingUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
317
  if(is_home()){
318
  $sharingUrl = esc_url(home_url());
319
  $postId = 0;
320
  }elseif(!is_singular()){
321
- $sharingUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
322
  $postId = 0;
323
  }elseif(isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']){
324
- $sharingUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
325
  }elseif(get_permalink($post->ID)){
326
  $sharingUrl = get_permalink($post->ID);
327
  }
@@ -504,15 +504,15 @@ class TheChampCounterWidget extends WP_Widget {
504
  $postId = 0;
505
  }elseif(isset($instance['target_url'])){
506
  if($instance['target_url'] == 'default'){
507
- $counterUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
508
  if(is_home()){
509
  $counterUrl = esc_url(home_url());
510
  $postId = 0;
511
  }elseif(!is_singular()){
512
- $counterUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
513
  $postId = 0;
514
  }elseif(isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']){
515
- $counterUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
516
  }elseif(get_permalink($post->ID)){
517
  $counterUrl = get_permalink($post->ID);
518
  }
@@ -652,15 +652,15 @@ class TheChampVerticalCounterWidget extends WP_Widget {
652
  $postId = 0;
653
  }elseif(isset($instance['target_url'])){
654
  if($instance['target_url'] == 'default'){
655
- $counterUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
656
  if(is_home()){
657
  $counterUrl = esc_url(home_url());
658
  $postId = 0;
659
  }elseif(!is_singular()){
660
- $counterUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
661
  $postId = 0;
662
  }elseif(isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']){
663
- $counterUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
664
  }elseif(get_permalink($post->ID)){
665
  $counterUrl = get_permalink($post->ID);
666
  }
@@ -903,31 +903,31 @@ class TheChampFollowWidget extends WP_Widget {
903
  $html .= '<a class="the_champ_twitter" href="'. $instance['twitter'] .'" title="Twitter" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#55acee;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-4 -4 39 39"><path d="M28 8.557a9.913 9.913 0 0 1-2.828.775 4.93 4.93 0 0 0 2.166-2.725 9.738 9.738 0 0 1-3.13 1.194 4.92 4.92 0 0 0-3.593-1.55 4.924 4.924 0 0 0-4.794 6.049c-4.09-.21-7.72-2.17-10.15-5.15a4.942 4.942 0 0 0-.665 2.477c0 1.71.87 3.214 2.19 4.1a4.968 4.968 0 0 1-2.23-.616v.06c0 2.39 1.7 4.38 3.952 4.83-.414.115-.85.174-1.297.174-.318 0-.626-.03-.928-.086a4.935 4.935 0 0 0 4.6 3.42 9.893 9.893 0 0 1-6.114 2.107c-.398 0-.79-.023-1.175-.068a13.953 13.953 0 0 0 7.55 2.213c9.056 0 14.01-7.507 14.01-14.013 0-.213-.005-.426-.015-.637.96-.695 1.795-1.56 2.455-2.55z" fill="'. $logo_color .'"></path></svg></span></a>';
904
  }
905
  if(isset($instance['instagram']) && $instance['instagram']){
906
- $html .= '<a class="the_champ_instagram" href="'. $instance['instagram'] .'" title="Instagram" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#53beee;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg height="100%" width="100%" version="1.1" viewBox="-10 -10 148 148" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><g><path d="M86,112H42c-14.336,0-26-11.663-26-26V42c0-14.337,11.664-26,26-26h44c14.337,0,26,11.663,26,26v44 C112,100.337,100.337,112,86,112z M42,24c-9.925,0-18,8.074-18,18v44c0,9.925,8.075,18,18,18h44c9.926,0,18-8.075,18-18V42 c0-9.926-8.074-18-18-18H42z" fill="'. $logo_color .'"></path></g><g><path d="M64,88c-13.234,0-24-10.767-24-24c0-13.234,10.766-24,24-24s24,10.766,24,24C88,77.233,77.234,88,64,88z M64,48c-8.822,0-16,7.178-16,16s7.178,16,16,16c8.822,0,16-7.178,16-16S72.822,48,64,48z" fill="'. $logo_color .'"></path></g><g><circle cx="89.5" cy="38.5" fill="'. $logo_color .'" r="5.5"></circle></g></g></svg></span></a>';
907
  }
908
  if(isset($instance['parler']) && $instance['parler']){
909
- $html .= '<a class="the_champ_parler" href="'. $instance['parler'] .'" title="Parler" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#3c589a;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg xmlns="http://www.w3.org/2000/svg" height="100%" width="100%" viewBox="-24 -30 140 160"><g fill="'. $logo_color .'"><path d="M58.34 83.31h-25v-8.49c0-4.5 3.64-8.14 8.14-8.14h16.87c13.8 0 25.02-11.19 25.02-24.94 0-13.75-11.23-24.94-25.03-24.94h-.26l-5.3-.16H0C0 7.45 7.45 0 16.63 0h36.41l5.44.17C81.39.24 100 18.86 100 41.74c0 22.92-18.69 41.57-41.66 41.57z"></path><path d="M16.65 100C7.46 100 .02 92.55.02 83.37V49.49c0-8.92 7.23-16.16 16.16-16.16h42.19a8.32 8.32 0 010 16.64h-33.5c-4.53 0-8.21 3.67-8.21 8.21V100z"></path></g></svg></span></a>';
910
  }
911
  if(isset($instance['gab']) && $instance['gab']){
912
- $html .= '<a class="the_champ_gab" href="'. $instance['gab'] .'" title="Gab" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#25CC80;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg style="%inner_style%" version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-14.5 3.5 46 30" xml:space="preserve"><g><path fill="'. $logo_color .'" d="M13.8,7.6h-2.4v0.7V9l-0.4-0.3C10.2,7.8,9,7.2,7.7,7.2c-0.2,0-0.4,0-0.4,0c-0.1,0-0.3,0-0.5,0 c-5.6,0.3-8.7,7.2-5.4,12.1c2.3,3.4,7.1,4.1,9.7,1.5l0.3-0.3l0,0.7c0,1-0.1,1.5-0.4,2.2c-1,2.4-4.1,3-6.8,1.3 c-0.2-0.1-0.4-0.2-0.4-0.2c-0.1,0.1-1.9,3.5-1.9,3.6c0,0.1,0.5,0.4,0.8,0.6c2.2,1.4,5.6,1.7,8.3,0.8c2.7-0.9,4.5-3.2,5-6.4 c0.2-1.1,0.2-0.8,0.2-8.4l0-7.1H13.8z M9.7,17.6c-2.2,1.2-4.9-0.4-4.9-2.9C4.8,12.6,7,11,9,11.6C11.8,12.4,12.3,16.1,9.7,17.6z"></path></g></svg></span></a>';
913
  }
914
  if(isset($instance['gettr']) && $instance['gettr']){
915
- $html .= '<a class="the_champ_gettr" href="'. $instance['gettr'] .'" title="Gettr" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#E50000;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg width="100%" height="100%" viewBox="-8 -5 50 50" xmlns="http://www.w3.org/2000/svg"><path d="M24.528 7.9125C24.1467 8.22187 23.7874 8.3875 23.2655 8.39688C23.7249 7.94688 24.1405 7.43125 24.478 6.875C24.8155 6.31875 25.0717 5.71875 25.2624 5.09375C23.6436 6.32187 21.1561 6.64062 18.9186 7.55312C16.753 8.42812 14.8186 9.85312 14.5655 11.7312C14.3874 13.0781 15.0686 14.6531 16.0249 16.0063C16.1311 15.6469 16.303 15.2781 16.553 15.0125C17.0467 14.4906 17.853 14.3594 18.628 14.2344C19.7999 14.0469 20.8936 13.875 21.8561 13.3156C22.5342 12.9219 23.1436 12.3313 23.528 11.6281C23.7467 11.2344 23.8936 10.8031 23.9811 10.3656C23.7311 10.6 23.3405 10.7531 23.0155 10.6844C23.8186 9.9 24.3374 9.00625 24.528 7.9125Z" fill="'. $logo_color .'"/><path d="M16.0221 17.6094H8.7002V18.2969C8.7002 18.2969 12.1314 18.4781 12.6877 21.0938H16.0189H19.3502C19.9064 18.4781 23.3377 18.2969 23.3377 18.2969V17.6094H16.0221Z" fill="'. $logo_color .'"/><path d="M19.2221 21.6846C19.0033 21.6439 18.8002 21.7658 18.7627 21.9596L18.3689 24.4533C18.3658 24.4721 18.3627 24.4908 18.3627 24.5096H17.6346L17.9564 22.0721C17.9752 21.8752 17.8127 21.7033 17.5971 21.6814C17.3783 21.6596 17.1846 21.8033 17.1689 21.9971L17.0189 24.5064C17.0189 24.5096 17.0189 24.5096 17.0189 24.5127H16.3314L16.4221 22.0377C16.4221 21.8533 16.2627 21.7002 16.0658 21.6846C16.0533 21.6846 16.0408 21.6814 16.0252 21.6814C16.0127 21.6814 15.9971 21.6814 15.9846 21.6846C15.8377 21.6971 15.7127 21.7814 15.6596 21.9033C15.6377 21.9471 15.6283 21.9939 15.6283 22.0439L15.7189 24.5189H15.0314C15.0314 24.5158 15.0314 24.5158 15.0314 24.5127L14.8752 22.0002C14.8564 21.8033 14.6658 21.6627 14.4471 21.6846C14.2283 21.7064 14.0658 21.8814 14.0877 22.0752L14.4096 24.5127H13.6814C13.6783 24.4939 13.6752 24.4752 13.6752 24.4564L13.2814 21.9627C13.2439 21.7689 13.0377 21.6471 12.8221 21.6877C12.6033 21.7283 12.4627 21.9221 12.5002 22.1158L13.0564 24.5158H13.3846C13.4814 25.0502 13.5439 25.4252 13.5783 25.6283H14.1283C14.2314 26.6533 15.2189 36.1221 15.2189 36.1221C15.2189 36.1221 15.2846 36.9252 16.0221 36.9252C16.7564 36.9252 16.8252 36.1221 16.8252 36.1221C16.9908 34.7971 17.8064 26.5814 17.9158 25.6283H18.4689C18.5033 25.4252 18.5658 25.0502 18.6627 24.5158H18.9908L19.5471 22.1158C19.5814 21.9189 19.4377 21.7252 19.2221 21.6846Z" fill="'. $logo_color .'"/></svg></span></a>';
916
  }
917
  if(isset($instance['pinterest']) && $instance['pinterest']){
918
  $html .= '<a class="the_champ_pinterest" href="'. $instance['pinterest'] .'" title="Pinterest" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#cc2329;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-2 -2 35 35"><path fill="'. $logo_color .'" d="M16.539 4.5c-6.277 0-9.442 4.5-9.442 8.253 0 2.272.86 4.293 2.705 5.046.303.125.574.005.662-.33.061-.231.205-.816.27-1.06.088-.331.053-.447-.191-.736-.532-.627-.873-1.439-.873-2.591 0-3.338 2.498-6.327 6.505-6.327 3.548 0 5.497 2.168 5.497 5.062 0 3.81-1.686 7.025-4.188 7.025-1.382 0-2.416-1.142-2.085-2.545.397-1.674 1.166-3.48 1.166-4.689 0-1.081-.581-1.983-1.782-1.983-1.413 0-2.548 1.462-2.548 3.419 0 1.247.421 2.091.421 2.091l-1.699 7.199c-.505 2.137-.076 4.755-.039 5.019.021.158.223.196.314.077.13-.17 1.813-2.247 2.384-4.324.162-.587.929-3.631.929-3.631.46.876 1.801 1.646 3.227 1.646 4.247 0 7.128-3.871 7.128-9.053.003-3.918-3.317-7.568-8.361-7.568z"/></svg></span></a>';
919
  }
920
  if(isset($instance['behance']) && $instance['behance']){
921
- $html .= '<a class="the_champ_behance" href="'. $instance['behance'] .'" title="Behance" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#053eff;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 36 36"><path d="M3.862 8.136h5.66c1.377 0 3.19 0 4.13.566a3.705 3.705 0 0 1 1.837 3.26c0 1.66-.88 2.905-2.32 3.494v.042c1.924.397 2.97 1.838 2.97 3.76 0 2.297-1.636 4.483-4.743 4.483H3.86V8.14zm2.078 6.71h4.152c2.36 0 3.322-.856 3.322-2.493 0-2.16-1.53-2.468-3.322-2.468H5.94v4.96zm0 7.144h5.2c1.792 0 2.93-1.09 2.93-2.797 0-2.03-1.64-2.598-3.388-2.598H5.94v5.395zm22.017-1.833C27.453 22.65 25.663 24 23.127 24c-3.607 0-5.31-2.49-5.422-5.944 0-3.386 2.23-5.878 5.31-5.878 4 0 5.225 3.74 5.116 6.47h-8.455c-.067 1.966 1.05 3.716 3.52 3.716 1.53 0 2.6-.742 2.928-2.206h1.838zm-1.793-3.15c-.088-1.77-1.42-3.19-3.256-3.19-1.946 0-3.106 1.466-3.236 3.19h6.492zM20.614 8h4.935v1.68h-4.94z" fill="'. $logo_color .'"></path></svg></span></a>';
922
  }
923
  if(isset($instance['flickr']) && $instance['flickr']){
924
- $html .= '<a class="the_champ_flickr" href="'. $instance['flickr'] .'" title="Flickr" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#ff0084;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 36 36"><g fill="'. $logo_color .'"><circle cx="23" cy="16" r="6"></circle><circle cx="9" cy="16" r="6"></circle></g></svg></span></a>';
925
  }
926
  if(isset($instance['foursquare']) && $instance['foursquare']){
927
- $html .= '<a class="the_champ_foursquare" href="'. $instance['foursquare'] .'" title="Foursquare" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#f94877;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg xmlns="http://www.w3.org/2000/svg" viewBox="-4 -4 40 40"><path fill="'. $logo_color .'" d="M21.516 3H7.586C5.66 3 5 4.358 5 5.383v21.995c0 1.097.65 1.407.958 1.53.31.126 1.105.206 1.676-.36l6.72-7.455c.105-.12.49-.284.552-.284h4.184c1.79 0 1.81-1.45 1.997-2.206.157-.63 1.946-9.57 2.58-12.395.523-2.32-.104-3.21-2.15-3.21zM20.2 9.682c-.07.33-.368.66-.75.693h-5.44c-.61-.034-1.108.422-1.108 1.032v.665c0 .61.5 1.24 1.108 1.24h4.607c.43 0 .794.276.7.737-.093.46-.573 2.82-.627 3.07-.052.254-.282.764-.716.764h-3.62c-.682 0-1.36-.008-1.816.56-.458.573-4.534 5.293-4.534 5.293V6.403c0-.438.31-.746.715-.74h11.274c.41-.006.915.41.834 1L20.2 9.68z"></path></svg></span></a>';
928
  }
929
  if(isset($instance['github']) && $instance['github']){
930
- $html .= '<a class="the_champ_github" href="'. $instance['github'] .'" title="Github" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#2a2a2a;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 36 36"><path fill="'. $logo_color .'" d="M16 3.32c-7.182 0-13 5.82-13 13 0 5.754 3.72 10.612 8.89 12.335.65.114.893-.276.893-.617 0-.31-.016-1.333-.016-2.42-3.266.6-4.11-.797-4.37-1.53-.147-.373-.78-1.527-1.334-1.835-.455-.244-1.105-.845-.016-.86 1.024-.017 1.755.942 2 1.332 1.17 1.966 3.038 1.414 3.785 1.073.114-.845.455-1.414.83-1.74-2.893-.324-5.916-1.445-5.916-6.418 0-1.414.504-2.584 1.333-3.494-.13-.325-.59-1.657.13-3.445 0 0 1.085-.34 3.57 1.337 1.04-.293 2.146-.44 3.25-.44s2.21.147 3.25.44c2.49-1.69 3.58-1.337 3.58-1.337.714 1.79.26 3.12.13 3.446.828.91 1.332 2.064 1.332 3.494 0 4.99-3.04 6.094-5.93 6.42.47.405.876 1.185.876 2.404 0 1.74-.016 3.136-.016 3.575 0 .34.244.743.894.613C25.28 26.933 29 22.053 29 16.32c0-7.182-5.817-13-13-13z"></path></svg></span></a>';
931
  }
932
  if(isset($instance['linkedin']) && $instance['linkedin']){
933
  $html .= '<a class="the_champ_linkedin" href="'. $instance['linkedin'] .'" title="Linkedin" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#0077b5;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32"><path d="M6.227 12.61h4.19v13.48h-4.19V12.61zm2.095-6.7a2.43 2.43 0 0 1 0 4.86c-1.344 0-2.428-1.09-2.428-2.43s1.084-2.43 2.428-2.43m4.72 6.7h4.02v1.84h.058c.56-1.058 1.927-2.176 3.965-2.176 4.238 0 5.02 2.792 5.02 6.42v7.395h-4.183v-6.56c0-1.564-.03-3.574-2.178-3.574-2.18 0-2.514 1.7-2.514 3.46v6.668h-4.187V12.61z" fill="'. $logo_color .'"></path></svg></span></a>';
@@ -939,7 +939,7 @@ class TheChampFollowWidget extends WP_Widget {
939
  $html .= '<a class="the_champ_medium" href="'. $instance['medium'] .'" title="medium" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#2a2a2a;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 36 36"><path d="M7.8 11a.8.8 0 0 0-.27-.7l-2-2.42v-.41h6.23L16.57 18l4.24-10.53h5.94v.36L25 9.47a.5.5 0 0 0-.19.48v12.1a.5.5 0 0 0 .19.48l1.68 1.64v.36h-8.4v-.36L20 22.49c.18-.17.18-.22.18-.49v-9.77l-4.82 12.26h-.65L9.09 12.23v8.22a1.09 1.09 0 0 0 .31.94l2.25 2.74v.36h-6.4v-.36l2.26-2.74a1.09 1.09 0 0 0 .29-.94z" fill="'. $logo_color .'"></path></svg></span></a>';
940
  }
941
  if(isset($instance['mewe']) && $instance['mewe']){
942
- $html .= '<a class="the_champ_mewe" href="'. $instance['mewe'] .'" title="Mewe" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#007da1;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg xmlns="http://www.w3.org/2000/svg" viewBox="-3 -3 38 38"><g fill="'. $logo_color .'"><path d="M9.636 10.427a1.22 1.22 0 1 1-2.44 0 1.22 1.22 0 1 1 2.44 0zM15.574 10.431a1.22 1.22 0 0 1-2.438 0 1.22 1.22 0 1 1 2.438 0zM22.592 10.431a1.221 1.221 0 1 1-2.443 0 1.221 1.221 0 0 1 2.443 0zM29.605 10.431a1.221 1.221 0 1 1-2.442 0 1.221 1.221 0 0 1 2.442 0zM3.605 13.772c0-.471.374-.859.859-.859h.18c.374 0 .624.194.789.457l2.935 4.597 2.95-4.611c.18-.291.43-.443.774-.443h.18c.485 0 .859.387.859.859v8.113a.843.843 0 0 1-.859.845.857.857 0 0 1-.845-.845V16.07l-2.366 3.559c-.18.276-.402.443-.72.443-.304 0-.526-.167-.706-.443l-2.354-3.53V21.9c0 .471-.374.83-.845.83a.815.815 0 0 1-.83-.83v-8.128h-.001zM14.396 14.055a.9.9 0 0 1-.069-.333c0-.471.402-.83.872-.83.415 0 .735.263.845.624l2.23 6.66 2.187-6.632c.139-.402.428-.678.859-.678h.124c.428 0 .735.278.859.678l2.187 6.632 2.23-6.675c.126-.346.415-.609.83-.609.457 0 .845.361.845.817a.96.96 0 0 1-.083.346l-2.867 8.032c-.152.43-.471.706-.887.706h-.165c-.415 0-.721-.263-.872-.706l-2.161-6.328-2.16 6.328c-.152.443-.47.706-.887.706h-.165c-.415 0-.72-.263-.887-.706l-2.865-8.032z"></path></g></svg></span></a>';
943
  }
944
  if(isset($instance['odnoklassniki']) && $instance['odnoklassniki']){
945
  $html .= '<a class="the_champ_odnoklassniki" href="'. $instance['odnoklassniki'] .'" title="Odnoklassniki" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#f2720c;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32"><path fill="'. $logo_color .'" d="M16 16.16a6.579 6.579 0 0 1-6.58-6.58A6.578 6.578 0 0 1 16 3a6.58 6.58 0 1 1 .002 13.16zm0-9.817a3.235 3.235 0 0 0-3.236 3.237 3.234 3.234 0 0 0 3.237 3.236 3.236 3.236 0 1 0 .004-6.473zm7.586 10.62c.647 1.3-.084 1.93-1.735 2.99-1.395.9-3.313 1.238-4.564 1.368l1.048 1.05 3.877 3.88c.59.59.59 1.543 0 2.133l-.177.18c-.59.59-1.544.59-2.134 0l-3.88-3.88-3.877 3.88c-.59.59-1.543.59-2.135 0l-.176-.18a1.505 1.505 0 0 1 0-2.132l3.88-3.877 1.042-1.046c-1.25-.127-3.19-.465-4.6-1.37-1.65-1.062-2.38-1.69-1.733-2.99.37-.747 1.4-1.367 2.768-.29C13.035 18.13 16 18.13 16 18.13s2.968 0 4.818-1.456c1.368-1.077 2.4-.457 2.768.29z"></path></svg></span></a>';
@@ -951,16 +951,16 @@ class TheChampFollowWidget extends WP_Widget {
951
  $html .= '<a class="the_champ_tumblr" href="'. $instance['tumblr'] .'" title="Tumblr" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#29435d;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-2 -2 36 36"><path fill="'. $logo_color .'" d="M20.775 21.962c-.37.177-1.08.33-1.61.345-1.598.043-1.907-1.122-1.92-1.968v-6.217h4.007V11.1H17.26V6.02h-2.925s-.132.044-.144.15c-.17 1.556-.895 4.287-3.923 5.378v2.578h2.02v6.522c0 2.232 1.647 5.404 5.994 5.33 1.467-.025 3.096-.64 3.456-1.17l-.96-2.846z"/></svg></span></a>';
952
  }
953
  if(isset($instance['vimeo']) && $instance['vimeo']){
954
- $html .= '<a class="the_champ_vimeo" href="'. $instance['vimeo'] .'" title="Vimeo" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#1ab7ea;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 36 36"><path fill="'. $logo_color .'" d="M26.926 10.627c-.103 2.25-1.675 5.332-4.716 9.245C19.066 23.957 16.406 26 14.23 26c-1.348 0-2.49-1.244-3.42-3.732l-1.867-6.844C8.25 12.937 7.51 11.69 6.715 11.69c-.173 0-.778.365-1.815 1.09l-1.088-1.4a300.012 300.012 0 0 0 3.374-3.01c1.522-1.315 2.666-2.007 3.427-2.076 1.8-.173 2.907 1.057 3.322 3.69.45 2.84.76 4.608.935 5.3.52 2.356 1.09 3.534 1.713 3.534.483 0 1.21-.764 2.18-2.294.97-1.528 1.488-2.692 1.558-3.49.14-1.32-.38-1.98-1.553-1.98-.554 0-1.125.126-1.712.378 1.137-3.722 3.308-5.53 6.513-5.426 2.378.068 3.498 1.61 3.36 4.62z"></path></svg></span></a>';
955
  }
956
  if(isset($instance['vkontakte']) && $instance['vkontakte']){
957
- $html .= '<a class="the_champ_vkontakte" href="'. $instance['vkontakte'] .'" title="Vkontakte" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#cc2329;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-1 -2 34 34"><path fill-rule="evenodd" clip-rule="evenodd" fill="'. $logo_color .'" d="M15.764 22.223h1.315s.394-.044.6-.262c.184-.2.18-.574.18-.574s-.03-1.764.79-2.023c.81-.255 1.844 1.705 2.942 2.46.832.57 1.464.445 1.464.445l2.936-.04s1.538-.097.81-1.304c-.06-.1-.426-.894-2.186-2.526-1.843-1.71-1.594-1.434.624-4.39 1.353-1.804 1.893-2.902 1.724-3.374-.16-.45-1.153-.33-1.153-.33l-3.306.02s-.247-.034-.428.074c-.178.108-.293.356-.293.356s-.522 1.394-1.223 2.58c-1.47 2.5-2.06 2.633-2.3 2.476-.563-.36-.42-1.454-.42-2.23 0-2.423.365-3.435-.72-3.696-.357-.085-.623-.143-1.544-.15-1.182-.014-2.18.003-2.743.28-.378.185-.667.595-.49.62.218.027.713.13.975.49.34.46.33 1.496.33 1.496s.193 2.852-.46 3.206c-.442.245-1.056-.252-2.37-2.52-.67-1.163-1.18-2.446-1.18-2.446s-.1-.24-.273-.37c-.212-.155-.506-.204-.506-.204l-3.145.02s-.473.015-.647.22c-.154.183-.01.56-.01.56s2.46 5.757 5.245 8.657c2.553 2.66 5.454 2.485 5.454 2.485z"/></svg></span></a>';
958
  }
959
  if(isset($instance['whatsapp']) && $instance['whatsapp']){
960
  $html .= '<a class="the_champ_whatsapp" href="'. $instance['whatsapp'] .'" title="Whatsapp" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#55eb4c;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-5 -5 40 40"><path id="arc1" stroke="'. $logo_color .'" stroke-width="2" fill="none" d="M 11.579798566743314 24.396926207859085 A 10 10 0 1 0 6.808479557110079 20.73576436351046"></path><path d="M 7 19 l -1 6 l 6 -1" stroke="'. $logo_color .'" stroke-width="2" fill="none"></path><path d="M 10 10 q -1 8 8 11 c 5 -1 0 -6 -1 -3 q -4 -3 -5 -5 c 4 -2 -1 -5 -1 -4" fill="'. $logo_color .'"></path></svg></span></a>';
961
  }
962
  if(isset($instance['xing']) && $instance['xing']){
963
- $html .= '<a class="the_champ_xing" href="'. $instance['xing'] .'" title="Xing" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#00797d;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-6 -6 42 42"><path d="M 6 9 h 5 l 4 4 l -5 7 h -5 l 5 -7 z m 15 -4 h 5 l -9 13 l 4 8 h -5 l -4 -8 z" fill="'. $logo_color .'"></path></svg></span></a>';
964
  }
965
  if(isset($instance['youtube']) && $instance['youtube']){
966
  $html .= '<a class="the_champ_facebook" href="'. $instance['facebook'] .'" title="Facebook" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:red;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32"><path fill="'. $logo_color .'" d="M26.78 11.6s-.215-1.515-.875-2.183c-.837-.876-1.774-.88-2.204-.932-3.075-.222-7.693-.222-7.693-.222h-.01s-4.618 0-7.697.222c-.43.05-1.368.056-2.205.932-.66.668-.874 2.184-.874 2.184S5 13.386 5 15.166v1.67c0 1.78.22 3.56.22 3.56s.215 1.516.874 2.184c.837.875 1.936.85 2.426.94 1.76.17 7.48.22 7.48.22s4.623-.007 7.7-.23c.43-.05 1.37-.056 2.205-.932.66-.668.875-2.184.875-2.184s.22-1.78.22-3.56v-1.67c0-1.78-.22-3.56-.22-3.56zm-13.052 7.254v-6.18l5.944 3.1-5.944 3.08z"></path></svg></span></a>';
@@ -969,7 +969,7 @@ class TheChampFollowWidget extends WP_Widget {
969
  $html .= '<a class="the_champ_youtube_channel" href="'. $instance['youtube_channel'] .'" title="Youtubechannel" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:red;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32"><path fill="'. $logo_color .'" d="M26.78 11.6s-.215-1.515-.875-2.183c-.837-.876-1.774-.88-2.204-.932-3.075-.222-7.693-.222-7.693-.222h-.01s-4.618 0-7.697.222c-.43.05-1.368.056-2.205.932-.66.668-.874 2.184-.874 2.184S5 13.386 5 15.166v1.67c0 1.78.22 3.56.22 3.56s.215 1.516.874 2.184c.837.875 1.936.85 2.426.94 1.76.17 7.48.22 7.48.22s4.623-.007 7.7-.23c.43-.05 1.37-.056 2.205-.932.66-.668.875-2.184.875-2.184s.22-1.78.22-3.56v-1.67c0-1.78-.22-3.56-.22-3.56zm-13.052 7.254v-6.18l5.944 3.1-5.944 3.08z"></path></svg></span></a>';
970
  }
971
  if(isset($instance['rss_feed']) && $instance['rss_feed']){
972
- $html .= '<a class="the_champ_rss_feed" href="'. $instance['rss_feed'] .'" title="Rssfeed" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#e3702d;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg xmlns="http://www.w3.org/2000/svg" viewBox="-4 -4 40 40"><g fill="'. $logo_color .'"><ellipse cx="7.952" cy="24.056" rx="2.952" ry="2.944"></ellipse><path d="M5.153 16.625c2.73 0 5.295 1.064 7.22 2.996a10.2 10.2 0 0 1 2.996 7.255h4.2c0-7.962-6.47-14.44-14.42-14.44v4.193zm.007-7.432c9.724 0 17.636 7.932 17.636 17.682H27C27 14.812 17.203 5 5.16 5v4.193z"></path></g></svg></span></a>';
973
  }
974
  $html = apply_filters('the_champ_follow_icons', $html, $instance, $iconStyle);
975
  $html .= '</div>';
134
  $postId = 0;
135
  }elseif(isset($instance['target_url'])){
136
  if($instance['target_url'] == 'default'){
137
+ $sharingUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
138
  if(is_home()){
139
+ $sharingUrl = esc_url_raw(home_url());
140
  $postId = 0;
141
  }elseif(!is_singular()){
142
+ $sharingUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
143
  $postId = 0;
144
  }elseif(isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']){
145
+ $sharingUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
146
  }elseif(get_permalink($post->ID)){
147
  $sharingUrl = get_permalink($post->ID);
148
  }
313
  $postId = 0;
314
  }elseif(isset($instance['target_url'])){
315
  if($instance['target_url'] == 'default'){
316
+ $sharingUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
317
  if(is_home()){
318
  $sharingUrl = esc_url(home_url());
319
  $postId = 0;
320
  }elseif(!is_singular()){
321
+ $sharingUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
322
  $postId = 0;
323
  }elseif(isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']){
324
+ $sharingUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
325
  }elseif(get_permalink($post->ID)){
326
  $sharingUrl = get_permalink($post->ID);
327
  }
504
  $postId = 0;
505
  }elseif(isset($instance['target_url'])){
506
  if($instance['target_url'] == 'default'){
507
+ $counterUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
508
  if(is_home()){
509
  $counterUrl = esc_url(home_url());
510
  $postId = 0;
511
  }elseif(!is_singular()){
512
+ $counterUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
513
  $postId = 0;
514
  }elseif(isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']){
515
+ $counterUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
516
  }elseif(get_permalink($post->ID)){
517
  $counterUrl = get_permalink($post->ID);
518
  }
652
  $postId = 0;
653
  }elseif(isset($instance['target_url'])){
654
  if($instance['target_url'] == 'default'){
655
+ $counterUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
656
  if(is_home()){
657
  $counterUrl = esc_url(home_url());
658
  $postId = 0;
659
  }elseif(!is_singular()){
660
+ $counterUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
661
  $postId = 0;
662
  }elseif(isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']){
663
+ $counterUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
664
  }elseif(get_permalink($post->ID)){
665
  $counterUrl = get_permalink($post->ID);
666
  }
903
  $html .= '<a class="the_champ_twitter" href="'. $instance['twitter'] .'" title="Twitter" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#55acee;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-4 -4 39 39"><path d="M28 8.557a9.913 9.913 0 0 1-2.828.775 4.93 4.93 0 0 0 2.166-2.725 9.738 9.738 0 0 1-3.13 1.194 4.92 4.92 0 0 0-3.593-1.55 4.924 4.924 0 0 0-4.794 6.049c-4.09-.21-7.72-2.17-10.15-5.15a4.942 4.942 0 0 0-.665 2.477c0 1.71.87 3.214 2.19 4.1a4.968 4.968 0 0 1-2.23-.616v.06c0 2.39 1.7 4.38 3.952 4.83-.414.115-.85.174-1.297.174-.318 0-.626-.03-.928-.086a4.935 4.935 0 0 0 4.6 3.42 9.893 9.893 0 0 1-6.114 2.107c-.398 0-.79-.023-1.175-.068a13.953 13.953 0 0 0 7.55 2.213c9.056 0 14.01-7.507 14.01-14.013 0-.213-.005-.426-.015-.637.96-.695 1.795-1.56 2.455-2.55z" fill="'. $logo_color .'"></path></svg></span></a>';
904
  }
905
  if(isset($instance['instagram']) && $instance['instagram']){
906
+ $html .= '<a class="the_champ_instagram" href="'. $instance['instagram'] .'" title="Instagram" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#53beee;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" height="100%" width="100%" version="1.1" viewBox="-10 -10 148 148" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><g><path d="M86,112H42c-14.336,0-26-11.663-26-26V42c0-14.337,11.664-26,26-26h44c14.337,0,26,11.663,26,26v44 C112,100.337,100.337,112,86,112z M42,24c-9.925,0-18,8.074-18,18v44c0,9.925,8.075,18,18,18h44c9.926,0,18-8.075,18-18V42 c0-9.926-8.074-18-18-18H42z" fill="'. $logo_color .'"></path></g><g><path d="M64,88c-13.234,0-24-10.767-24-24c0-13.234,10.766-24,24-24s24,10.766,24,24C88,77.233,77.234,88,64,88z M64,48c-8.822,0-16,7.178-16,16s7.178,16,16,16c8.822,0,16-7.178,16-16S72.822,48,64,48z" fill="'. $logo_color .'"></path></g><g><circle cx="89.5" cy="38.5" fill="'. $logo_color .'" r="5.5"></circle></g></g></svg></span></a>';
907
  }
908
  if(isset($instance['parler']) && $instance['parler']){
909
+ $html .= '<a class="the_champ_parler" href="'. $instance['parler'] .'" title="Parler" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#3c589a;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" height="100%" width="100%" viewBox="-24 -30 140 160"><g fill="'. $logo_color .'"><path d="M58.34 83.31h-25v-8.49c0-4.5 3.64-8.14 8.14-8.14h16.87c13.8 0 25.02-11.19 25.02-24.94 0-13.75-11.23-24.94-25.03-24.94h-.26l-5.3-.16H0C0 7.45 7.45 0 16.63 0h36.41l5.44.17C81.39.24 100 18.86 100 41.74c0 22.92-18.69 41.57-41.66 41.57z"></path><path d="M16.65 100C7.46 100 .02 92.55.02 83.37V49.49c0-8.92 7.23-16.16 16.16-16.16h42.19a8.32 8.32 0 010 16.64h-33.5c-4.53 0-8.21 3.67-8.21 8.21V100z"></path></g></svg></span></a>';
910
  }
911
  if(isset($instance['gab']) && $instance['gab']){
912
+ $html .= '<a class="the_champ_gab" href="'. $instance['gab'] .'" title="Gab" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#25CC80;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" style="%inner_style%" version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-14.5 3.5 46 30" xml:space="preserve"><g><path fill="'. $logo_color .'" d="M13.8,7.6h-2.4v0.7V9l-0.4-0.3C10.2,7.8,9,7.2,7.7,7.2c-0.2,0-0.4,0-0.4,0c-0.1,0-0.3,0-0.5,0 c-5.6,0.3-8.7,7.2-5.4,12.1c2.3,3.4,7.1,4.1,9.7,1.5l0.3-0.3l0,0.7c0,1-0.1,1.5-0.4,2.2c-1,2.4-4.1,3-6.8,1.3 c-0.2-0.1-0.4-0.2-0.4-0.2c-0.1,0.1-1.9,3.5-1.9,3.6c0,0.1,0.5,0.4,0.8,0.6c2.2,1.4,5.6,1.7,8.3,0.8c2.7-0.9,4.5-3.2,5-6.4 c0.2-1.1,0.2-0.8,0.2-8.4l0-7.1H13.8z M9.7,17.6c-2.2,1.2-4.9-0.4-4.9-2.9C4.8,12.6,7,11,9,11.6C11.8,12.4,12.3,16.1,9.7,17.6z"></path></g></svg></span></a>';
913
  }
914
  if(isset($instance['gettr']) && $instance['gettr']){
915
+ $html .= '<a class="the_champ_gettr" href="'. $instance['gettr'] .'" title="Gettr" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#E50000;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" width="100%" height="100%" viewBox="-8 -5 50 50" xmlns="http://www.w3.org/2000/svg"><path d="M24.528 7.9125C24.1467 8.22187 23.7874 8.3875 23.2655 8.39688C23.7249 7.94688 24.1405 7.43125 24.478 6.875C24.8155 6.31875 25.0717 5.71875 25.2624 5.09375C23.6436 6.32187 21.1561 6.64062 18.9186 7.55312C16.753 8.42812 14.8186 9.85312 14.5655 11.7312C14.3874 13.0781 15.0686 14.6531 16.0249 16.0063C16.1311 15.6469 16.303 15.2781 16.553 15.0125C17.0467 14.4906 17.853 14.3594 18.628 14.2344C19.7999 14.0469 20.8936 13.875 21.8561 13.3156C22.5342 12.9219 23.1436 12.3313 23.528 11.6281C23.7467 11.2344 23.8936 10.8031 23.9811 10.3656C23.7311 10.6 23.3405 10.7531 23.0155 10.6844C23.8186 9.9 24.3374 9.00625 24.528 7.9125Z" fill="'. $logo_color .'"/><path d="M16.0221 17.6094H8.7002V18.2969C8.7002 18.2969 12.1314 18.4781 12.6877 21.0938H16.0189H19.3502C19.9064 18.4781 23.3377 18.2969 23.3377 18.2969V17.6094H16.0221Z" fill="'. $logo_color .'"/><path d="M19.2221 21.6846C19.0033 21.6439 18.8002 21.7658 18.7627 21.9596L18.3689 24.4533C18.3658 24.4721 18.3627 24.4908 18.3627 24.5096H17.6346L17.9564 22.0721C17.9752 21.8752 17.8127 21.7033 17.5971 21.6814C17.3783 21.6596 17.1846 21.8033 17.1689 21.9971L17.0189 24.5064C17.0189 24.5096 17.0189 24.5096 17.0189 24.5127H16.3314L16.4221 22.0377C16.4221 21.8533 16.2627 21.7002 16.0658 21.6846C16.0533 21.6846 16.0408 21.6814 16.0252 21.6814C16.0127 21.6814 15.9971 21.6814 15.9846 21.6846C15.8377 21.6971 15.7127 21.7814 15.6596 21.9033C15.6377 21.9471 15.6283 21.9939 15.6283 22.0439L15.7189 24.5189H15.0314C15.0314 24.5158 15.0314 24.5158 15.0314 24.5127L14.8752 22.0002C14.8564 21.8033 14.6658 21.6627 14.4471 21.6846C14.2283 21.7064 14.0658 21.8814 14.0877 22.0752L14.4096 24.5127H13.6814C13.6783 24.4939 13.6752 24.4752 13.6752 24.4564L13.2814 21.9627C13.2439 21.7689 13.0377 21.6471 12.8221 21.6877C12.6033 21.7283 12.4627 21.9221 12.5002 22.1158L13.0564 24.5158H13.3846C13.4814 25.0502 13.5439 25.4252 13.5783 25.6283H14.1283C14.2314 26.6533 15.2189 36.1221 15.2189 36.1221C15.2189 36.1221 15.2846 36.9252 16.0221 36.9252C16.7564 36.9252 16.8252 36.1221 16.8252 36.1221C16.9908 34.7971 17.8064 26.5814 17.9158 25.6283H18.4689C18.5033 25.4252 18.5658 25.0502 18.6627 24.5158H18.9908L19.5471 22.1158C19.5814 21.9189 19.4377 21.7252 19.2221 21.6846Z" fill="'. $logo_color .'"/></svg></span></a>';
916
  }
917
  if(isset($instance['pinterest']) && $instance['pinterest']){
918
  $html .= '<a class="the_champ_pinterest" href="'. $instance['pinterest'] .'" title="Pinterest" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#cc2329;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-2 -2 35 35"><path fill="'. $logo_color .'" d="M16.539 4.5c-6.277 0-9.442 4.5-9.442 8.253 0 2.272.86 4.293 2.705 5.046.303.125.574.005.662-.33.061-.231.205-.816.27-1.06.088-.331.053-.447-.191-.736-.532-.627-.873-1.439-.873-2.591 0-3.338 2.498-6.327 6.505-6.327 3.548 0 5.497 2.168 5.497 5.062 0 3.81-1.686 7.025-4.188 7.025-1.382 0-2.416-1.142-2.085-2.545.397-1.674 1.166-3.48 1.166-4.689 0-1.081-.581-1.983-1.782-1.983-1.413 0-2.548 1.462-2.548 3.419 0 1.247.421 2.091.421 2.091l-1.699 7.199c-.505 2.137-.076 4.755-.039 5.019.021.158.223.196.314.077.13-.17 1.813-2.247 2.384-4.324.162-.587.929-3.631.929-3.631.46.876 1.801 1.646 3.227 1.646 4.247 0 7.128-3.871 7.128-9.053.003-3.918-3.317-7.568-8.361-7.568z"/></svg></span></a>';
919
  }
920
  if(isset($instance['behance']) && $instance['behance']){
921
+ $html .= '<a class="the_champ_behance" href="'. $instance['behance'] .'" title="Behance" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#053eff;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 36 36"><path d="M3.862 8.136h5.66c1.377 0 3.19 0 4.13.566a3.705 3.705 0 0 1 1.837 3.26c0 1.66-.88 2.905-2.32 3.494v.042c1.924.397 2.97 1.838 2.97 3.76 0 2.297-1.636 4.483-4.743 4.483H3.86V8.14zm2.078 6.71h4.152c2.36 0 3.322-.856 3.322-2.493 0-2.16-1.53-2.468-3.322-2.468H5.94v4.96zm0 7.144h5.2c1.792 0 2.93-1.09 2.93-2.797 0-2.03-1.64-2.598-3.388-2.598H5.94v5.395zm22.017-1.833C27.453 22.65 25.663 24 23.127 24c-3.607 0-5.31-2.49-5.422-5.944 0-3.386 2.23-5.878 5.31-5.878 4 0 5.225 3.74 5.116 6.47h-8.455c-.067 1.966 1.05 3.716 3.52 3.716 1.53 0 2.6-.742 2.928-2.206h1.838zm-1.793-3.15c-.088-1.77-1.42-3.19-3.256-3.19-1.946 0-3.106 1.466-3.236 3.19h6.492zM20.614 8h4.935v1.68h-4.94z" fill="'. $logo_color .'"></path></svg></span></a>';
922
  }
923
  if(isset($instance['flickr']) && $instance['flickr']){
924
+ $html .= '<a class="the_champ_flickr" href="'. $instance['flickr'] .'" title="Flickr" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#ff0084;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 36 36"><g fill="'. $logo_color .'"><circle cx="23" cy="16" r="6"></circle><circle cx="9" cy="16" r="6"></circle></g></svg></span></a>';
925
  }
926
  if(isset($instance['foursquare']) && $instance['foursquare']){
927
+ $html .= '<a class="the_champ_foursquare" href="'. $instance['foursquare'] .'" title="Foursquare" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#f94877;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="-4 -4 40 40"><path fill="'. $logo_color .'" d="M21.516 3H7.586C5.66 3 5 4.358 5 5.383v21.995c0 1.097.65 1.407.958 1.53.31.126 1.105.206 1.676-.36l6.72-7.455c.105-.12.49-.284.552-.284h4.184c1.79 0 1.81-1.45 1.997-2.206.157-.63 1.946-9.57 2.58-12.395.523-2.32-.104-3.21-2.15-3.21zM20.2 9.682c-.07.33-.368.66-.75.693h-5.44c-.61-.034-1.108.422-1.108 1.032v.665c0 .61.5 1.24 1.108 1.24h4.607c.43 0 .794.276.7.737-.093.46-.573 2.82-.627 3.07-.052.254-.282.764-.716.764h-3.62c-.682 0-1.36-.008-1.816.56-.458.573-4.534 5.293-4.534 5.293V6.403c0-.438.31-.746.715-.74h11.274c.41-.006.915.41.834 1L20.2 9.68z"></path></svg></span></a>';
928
  }
929
  if(isset($instance['github']) && $instance['github']){
930
+ $html .= '<a class="the_champ_github" href="'. $instance['github'] .'" title="Github" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#2a2a2a;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 36 36"><path fill="'. $logo_color .'" d="M16 3.32c-7.182 0-13 5.82-13 13 0 5.754 3.72 10.612 8.89 12.335.65.114.893-.276.893-.617 0-.31-.016-1.333-.016-2.42-3.266.6-4.11-.797-4.37-1.53-.147-.373-.78-1.527-1.334-1.835-.455-.244-1.105-.845-.016-.86 1.024-.017 1.755.942 2 1.332 1.17 1.966 3.038 1.414 3.785 1.073.114-.845.455-1.414.83-1.74-2.893-.324-5.916-1.445-5.916-6.418 0-1.414.504-2.584 1.333-3.494-.13-.325-.59-1.657.13-3.445 0 0 1.085-.34 3.57 1.337 1.04-.293 2.146-.44 3.25-.44s2.21.147 3.25.44c2.49-1.69 3.58-1.337 3.58-1.337.714 1.79.26 3.12.13 3.446.828.91 1.332 2.064 1.332 3.494 0 4.99-3.04 6.094-5.93 6.42.47.405.876 1.185.876 2.404 0 1.74-.016 3.136-.016 3.575 0 .34.244.743.894.613C25.28 26.933 29 22.053 29 16.32c0-7.182-5.817-13-13-13z"></path></svg></span></a>';
931
  }
932
  if(isset($instance['linkedin']) && $instance['linkedin']){
933
  $html .= '<a class="the_champ_linkedin" href="'. $instance['linkedin'] .'" title="Linkedin" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#0077b5;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32"><path d="M6.227 12.61h4.19v13.48h-4.19V12.61zm2.095-6.7a2.43 2.43 0 0 1 0 4.86c-1.344 0-2.428-1.09-2.428-2.43s1.084-2.43 2.428-2.43m4.72 6.7h4.02v1.84h.058c.56-1.058 1.927-2.176 3.965-2.176 4.238 0 5.02 2.792 5.02 6.42v7.395h-4.183v-6.56c0-1.564-.03-3.574-2.178-3.574-2.18 0-2.514 1.7-2.514 3.46v6.668h-4.187V12.61z" fill="'. $logo_color .'"></path></svg></span></a>';
939
  $html .= '<a class="the_champ_medium" href="'. $instance['medium'] .'" title="medium" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#2a2a2a;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 36 36"><path d="M7.8 11a.8.8 0 0 0-.27-.7l-2-2.42v-.41h6.23L16.57 18l4.24-10.53h5.94v.36L25 9.47a.5.5 0 0 0-.19.48v12.1a.5.5 0 0 0 .19.48l1.68 1.64v.36h-8.4v-.36L20 22.49c.18-.17.18-.22.18-.49v-9.77l-4.82 12.26h-.65L9.09 12.23v8.22a1.09 1.09 0 0 0 .31.94l2.25 2.74v.36h-6.4v-.36l2.26-2.74a1.09 1.09 0 0 0 .29-.94z" fill="'. $logo_color .'"></path></svg></span></a>';
940
  }
941
  if(isset($instance['mewe']) && $instance['mewe']){
942
+ $html .= '<a class="the_champ_mewe" href="'. $instance['mewe'] .'" title="Mewe" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#007da1;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="-3 -3 38 38"><g fill="'. $logo_color .'"><path d="M9.636 10.427a1.22 1.22 0 1 1-2.44 0 1.22 1.22 0 1 1 2.44 0zM15.574 10.431a1.22 1.22 0 0 1-2.438 0 1.22 1.22 0 1 1 2.438 0zM22.592 10.431a1.221 1.221 0 1 1-2.443 0 1.221 1.221 0 0 1 2.443 0zM29.605 10.431a1.221 1.221 0 1 1-2.442 0 1.221 1.221 0 0 1 2.442 0zM3.605 13.772c0-.471.374-.859.859-.859h.18c.374 0 .624.194.789.457l2.935 4.597 2.95-4.611c.18-.291.43-.443.774-.443h.18c.485 0 .859.387.859.859v8.113a.843.843 0 0 1-.859.845.857.857 0 0 1-.845-.845V16.07l-2.366 3.559c-.18.276-.402.443-.72.443-.304 0-.526-.167-.706-.443l-2.354-3.53V21.9c0 .471-.374.83-.845.83a.815.815 0 0 1-.83-.83v-8.128h-.001zM14.396 14.055a.9.9 0 0 1-.069-.333c0-.471.402-.83.872-.83.415 0 .735.263.845.624l2.23 6.66 2.187-6.632c.139-.402.428-.678.859-.678h.124c.428 0 .735.278.859.678l2.187 6.632 2.23-6.675c.126-.346.415-.609.83-.609.457 0 .845.361.845.817a.96.96 0 0 1-.083.346l-2.867 8.032c-.152.43-.471.706-.887.706h-.165c-.415 0-.721-.263-.872-.706l-2.161-6.328-2.16 6.328c-.152.443-.47.706-.887.706h-.165c-.415 0-.72-.263-.887-.706l-2.865-8.032z"></path></g></svg></span></a>';
943
  }
944
  if(isset($instance['odnoklassniki']) && $instance['odnoklassniki']){
945
  $html .= '<a class="the_champ_odnoklassniki" href="'. $instance['odnoklassniki'] .'" title="Odnoklassniki" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#f2720c;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32"><path fill="'. $logo_color .'" d="M16 16.16a6.579 6.579 0 0 1-6.58-6.58A6.578 6.578 0 0 1 16 3a6.58 6.58 0 1 1 .002 13.16zm0-9.817a3.235 3.235 0 0 0-3.236 3.237 3.234 3.234 0 0 0 3.237 3.236 3.236 3.236 0 1 0 .004-6.473zm7.586 10.62c.647 1.3-.084 1.93-1.735 2.99-1.395.9-3.313 1.238-4.564 1.368l1.048 1.05 3.877 3.88c.59.59.59 1.543 0 2.133l-.177.18c-.59.59-1.544.59-2.134 0l-3.88-3.88-3.877 3.88c-.59.59-1.543.59-2.135 0l-.176-.18a1.505 1.505 0 0 1 0-2.132l3.88-3.877 1.042-1.046c-1.25-.127-3.19-.465-4.6-1.37-1.65-1.062-2.38-1.69-1.733-2.99.37-.747 1.4-1.367 2.768-.29C13.035 18.13 16 18.13 16 18.13s2.968 0 4.818-1.456c1.368-1.077 2.4-.457 2.768.29z"></path></svg></span></a>';
951
  $html .= '<a class="the_champ_tumblr" href="'. $instance['tumblr'] .'" title="Tumblr" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#29435d;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-2 -2 36 36"><path fill="'. $logo_color .'" d="M20.775 21.962c-.37.177-1.08.33-1.61.345-1.598.043-1.907-1.122-1.92-1.968v-6.217h4.007V11.1H17.26V6.02h-2.925s-.132.044-.144.15c-.17 1.556-.895 4.287-3.923 5.378v2.578h2.02v6.522c0 2.232 1.647 5.404 5.994 5.33 1.467-.025 3.096-.64 3.456-1.17l-.96-2.846z"/></svg></span></a>';
952
  }
953
  if(isset($instance['vimeo']) && $instance['vimeo']){
954
+ $html .= '<a class="the_champ_vimeo" href="'. $instance['vimeo'] .'" title="Vimeo" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#1ab7ea;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 36 36"><path fill="'. $logo_color .'" d="M26.926 10.627c-.103 2.25-1.675 5.332-4.716 9.245C19.066 23.957 16.406 26 14.23 26c-1.348 0-2.49-1.244-3.42-3.732l-1.867-6.844C8.25 12.937 7.51 11.69 6.715 11.69c-.173 0-.778.365-1.815 1.09l-1.088-1.4a300.012 300.012 0 0 0 3.374-3.01c1.522-1.315 2.666-2.007 3.427-2.076 1.8-.173 2.907 1.057 3.322 3.69.45 2.84.76 4.608.935 5.3.52 2.356 1.09 3.534 1.713 3.534.483 0 1.21-.764 2.18-2.294.97-1.528 1.488-2.692 1.558-3.49.14-1.32-.38-1.98-1.553-1.98-.554 0-1.125.126-1.712.378 1.137-3.722 3.308-5.53 6.513-5.426 2.378.068 3.498 1.61 3.36 4.62z"></path></svg></span></a>';
955
  }
956
  if(isset($instance['vkontakte']) && $instance['vkontakte']){
957
+ $html .= '<a class="the_champ_vkontakte" href="'. $instance['vkontakte'] .'" title="Vkontakte" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#0077FF;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" height="100%" width="100%" viewBox="0.75 12.5 46 22" xmlns="http://www.w3.org/2000/svg"><path d="M25.54 34.58c-10.94 0-17.18-7.5-17.44-19.98h5.48c.18 9.16 4.22 13.04 7.42 13.84V14.6h5.16v7.9c3.16-.34 6.48-3.94 7.6-7.9h5.16c-.86 4.88-4.46 8.48-7.02 9.96 2.56 1.2 6.66 4.34 8.22 10.02h-5.68c-1.22-3.8-4.26-6.74-8.28-7.14v7.14z" fill="'. $logo_color .'"></path></svg></span></a>';
958
  }
959
  if(isset($instance['whatsapp']) && $instance['whatsapp']){
960
  $html .= '<a class="the_champ_whatsapp" href="'. $instance['whatsapp'] .'" title="Whatsapp" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#55eb4c;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-5 -5 40 40"><path id="arc1" stroke="'. $logo_color .'" stroke-width="2" fill="none" d="M 11.579798566743314 24.396926207859085 A 10 10 0 1 0 6.808479557110079 20.73576436351046"></path><path d="M 7 19 l -1 6 l 6 -1" stroke="'. $logo_color .'" stroke-width="2" fill="none"></path><path d="M 10 10 q -1 8 8 11 c 5 -1 0 -6 -1 -3 q -4 -3 -5 -5 c 4 -2 -1 -5 -1 -4" fill="'. $logo_color .'"></path></svg></span></a>';
961
  }
962
  if(isset($instance['xing']) && $instance['xing']){
963
+ $html .= '<a class="the_champ_xing" href="'. $instance['xing'] .'" title="Xing" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#00797d;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="-6 -6 42 42"><path d="M 6 9 h 5 l 4 4 l -5 7 h -5 l 5 -7 z m 15 -4 h 5 l -9 13 l 4 8 h -5 l -4 -8 z" fill="'. $logo_color .'"></path></svg></span></a>';
964
  }
965
  if(isset($instance['youtube']) && $instance['youtube']){
966
  $html .= '<a class="the_champ_facebook" href="'. $instance['facebook'] .'" title="Facebook" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:red;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32"><path fill="'. $logo_color .'" d="M26.78 11.6s-.215-1.515-.875-2.183c-.837-.876-1.774-.88-2.204-.932-3.075-.222-7.693-.222-7.693-.222h-.01s-4.618 0-7.697.222c-.43.05-1.368.056-2.205.932-.66.668-.874 2.184-.874 2.184S5 13.386 5 15.166v1.67c0 1.78.22 3.56.22 3.56s.215 1.516.874 2.184c.837.875 1.936.85 2.426.94 1.76.17 7.48.22 7.48.22s4.623-.007 7.7-.23c.43-.05 1.37-.056 2.205-.932.66-.668.875-2.184.875-2.184s.22-1.78.22-3.56v-1.67c0-1.78-.22-3.56-.22-3.56zm-13.052 7.254v-6.18l5.944 3.1-5.944 3.08z"></path></svg></span></a>';
969
  $html .= '<a class="the_champ_youtube_channel" href="'. $instance['youtube_channel'] .'" title="Youtubechannel" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:red;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 32 32"><path fill="'. $logo_color .'" d="M26.78 11.6s-.215-1.515-.875-2.183c-.837-.876-1.774-.88-2.204-.932-3.075-.222-7.693-.222-7.693-.222h-.01s-4.618 0-7.697.222c-.43.05-1.368.056-2.205.932-.66.668-.874 2.184-.874 2.184S5 13.386 5 15.166v1.67c0 1.78.22 3.56.22 3.56s.215 1.516.874 2.184c.837.875 1.936.85 2.426.94 1.76.17 7.48.22 7.48.22s4.623-.007 7.7-.23c.43-.05 1.37-.056 2.205-.932.66-.668.875-2.184.875-2.184s.22-1.78.22-3.56v-1.67c0-1.78-.22-3.56-.22-3.56zm-13.052 7.254v-6.18l5.944 3.1-5.944 3.08z"></path></svg></span></a>';
970
  }
971
  if(isset($instance['rss_feed']) && $instance['rss_feed']){
972
+ $html .= '<a class="the_champ_rss_feed" href="'. $instance['rss_feed'] .'" title="Rssfeed" rel="nofollow noopener" target="_blank" style="font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle;"><span style="background-color:#e3702d;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;'. $iconStyle .'" class="the_champ_svg"><svg focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="-4 -4 40 40"><g fill="'. $logo_color .'"><ellipse cx="7.952" cy="24.056" rx="2.952" ry="2.944"></ellipse><path d="M5.153 16.625c2.73 0 5.295 1.064 7.22 2.996a10.2 10.2 0 0 1 2.996 7.255h4.2c0-7.962-6.47-14.44-14.42-14.44v4.193zm.007-7.432c9.724 0 17.636 7.932 17.636 17.682H27C27 14.812 17.203 5 5.16 5v4.193z"></path></g></svg></span></a>';
973
  }
974
  $html = apply_filters('the_champ_follow_icons', $html, $instance, $iconStyle);
975
  $html .= '</div>';
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Social Share, Social Login and Social Comments Plugin - Super Socializer ===
2
- Contributors: Heateor, farhan8heateor, jatin8heateor, the_champ, Hungarian Translator: László Tavaszi http://kerekmese.hu, Chinese Translator: CalmSmile calmsmile.org, Portuguese Translator: Paulo Purkyt https://www.linkedin.com/in/ppurkyt, Italian Translator: FG3D (Freedom's Gate) https://fg3d.net, Spanish translator: Ignacio Iglesias http://trespies.com, Arabic Translator: http://www.ArabsSM.com, Russian/Ukrainian Translator: Nicholas Lagunov
3
  Donate link: https://www.heateor.com/donate?action=Super+Socializer
4
  Tags: social login, social share, line login, social commenting, social comments, social plugin, profile data, social analytics, online identity, social profile storage, single sign-on, social media follow, facebook login, twitter login, linkedin login, google login, vkontakte login, Windows Live Login, Microsoft Login, Wordpress login, Yahoo login, Spotify login, Dribbble login, Kakao login, Github login, Twitch login, Instagram login, dropbox login, foursquare login, disqus login, reddit login, amazon login, stackoverflow login, stack overflow login, discord login, mail.ru login, mailru login, mail ru login, gettr share, parler share, odnoklassniki login, yandex login, odnoklassniki, yandex, odnoklassniki login button, yandex login button, Rutube, Rutube share, Rutube sharing
5
  Requires at least: 2.5.0
6
  Tested up to: 6.0.1
7
- Stable tag: 7.13.37
8
  License: GPLv2 or later
9
 
10
  The unique Social Plugin to let you integrate Social Login, Social Share, Social Comments and Social Media follow at your website
@@ -213,6 +213,12 @@ Yes, we can help you with it. Just drop an email at support[ at ]heateor[ dot ]c
213
  8. **Social Commenting**: Disqus Commenting selected
214
 
215
  == Changelog ==
 
 
 
 
 
 
216
  = 7.13.37 [10 August 2022] =
217
  * [New] Added Rutube in the Social Share networks
218
  * [New] Added an option in the Advanced Configuration section at the Social Login configuration page to allow cyrillic, Arabic and Chinese characters in the names of the new users registering via social login
@@ -2487,4 +2493,10 @@ Yes, we can help you with it. Just drop an email at support[ at ]heateor[ dot ]c
2487
  * [New] Added an option in the Advanced Configuration section at the Social Login configuration page to allow cyrillic, Arabic and Chinese characters in the names of the new users registering via social login
2488
  * [Bugfix] Standard Like buttons got stacked vertically after the last update
2489
  * [Improvement] Performance improvement for Line login
2490
- * [Improvement] Improved Vkontakte logo
 
 
 
 
 
 
1
  === Social Share, Social Login and Social Comments Plugin - Super Socializer ===
2
+ Contributors: Heateor, kamirkhan, mohammadfarhankhan, the_champ, Hungarian Translator: László Tavaszi http://kerekmese.hu, Chinese Translator: CalmSmile calmsmile.org, Portuguese Translator: Paulo Purkyt https://www.linkedin.com/in/ppurkyt, Italian Translator: FG3D (Freedom's Gate) https://fg3d.net, Spanish translator: Ignacio Iglesias http://trespies.com, Arabic Translator: http://www.ArabsSM.com, Russian/Ukrainian Translator: Nicholas Lagunov
3
  Donate link: https://www.heateor.com/donate?action=Super+Socializer
4
  Tags: social login, social share, line login, social commenting, social comments, social plugin, profile data, social analytics, online identity, social profile storage, single sign-on, social media follow, facebook login, twitter login, linkedin login, google login, vkontakte login, Windows Live Login, Microsoft Login, Wordpress login, Yahoo login, Spotify login, Dribbble login, Kakao login, Github login, Twitch login, Instagram login, dropbox login, foursquare login, disqus login, reddit login, amazon login, stackoverflow login, stack overflow login, discord login, mail.ru login, mailru login, mail ru login, gettr share, parler share, odnoklassniki login, yandex login, odnoklassniki, yandex, odnoklassniki login button, yandex login button, Rutube, Rutube share, Rutube sharing
5
  Requires at least: 2.5.0
6
  Tested up to: 6.0.1
7
+ Stable tag: 7.13.38
8
  License: GPLv2 or later
9
 
10
  The unique Social Plugin to let you integrate Social Login, Social Share, Social Comments and Social Media follow at your website
213
  8. **Social Commenting**: Disqus Commenting selected
214
 
215
  == Changelog ==
216
+ = 7.13.38 [25 August 2022] =
217
+ * [Bugfix] "Allow cyrillic characters in the name" option was causing PHP error when all the checkboxes were unchecked
218
+ * [Bugfix] Fixed the background-color and logo of Vkontakte icon in the "Super Socializer - Follow Icons" widget
219
+ * [Bugfix] Line login was not working in the mobile devices
220
+ * [Improvement] Performance improvement
221
+
222
  = 7.13.37 [10 August 2022] =
223
  * [New] Added Rutube in the Social Share networks
224
  * [New] Added an option in the Advanced Configuration section at the Social Login configuration page to allow cyrillic, Arabic and Chinese characters in the names of the new users registering via social login
2493
  * [New] Added an option in the Advanced Configuration section at the Social Login configuration page to allow cyrillic, Arabic and Chinese characters in the names of the new users registering via social login
2494
  * [Bugfix] Standard Like buttons got stacked vertically after the last update
2495
  * [Improvement] Performance improvement for Line login
2496
+ * [Improvement] Improved Vkontakte logo
2497
+
2498
+ = 7.13.38 [25 August 2022] =
2499
+ * [Bugfix] "Allow cyrillic characters in the name" option was causing PHP error when all the checkboxes were unchecked
2500
+ * [Bugfix] Fixed the background-color and logo of Vkontakte icon in the "Super Socializer - Follow Icons" widget
2501
+ * [Bugfix] Line login was not working in the mobile devices
2502
+ * [Improvement] Performance improvement
super_socializer.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Super Socializer
4
  Plugin URI: https://super-socializer-wordpress.heateor.com
5
  Description: A complete 360 degree solution to provide all the social features like Social Login, Social Commenting, Social Sharing, Social Media follow and more
6
- Version: 7.13.37
7
  Author: Team Heateor
8
  Author URI: https://www.heateor.com
9
  Text Domain: super-socializer
@@ -11,7 +11,7 @@ Domain Path: /languages
11
  License: GPL2+
12
  */
13
  defined('ABSPATH') or die("Cheating........Uh!!");
14
- define('THE_CHAMP_SS_VERSION', '7.13.37');
15
 
16
  // attributes to allow in the HTML of the social share and social media follow icons
17
  $heateorSsDefaultAttribs = array(
@@ -295,74 +295,452 @@ function the_champ_connect(){
295
  return;
296
  }
297
 
298
- // Instagram
299
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Instagram')){
300
- if(isset($theChampLoginOptions['providers']) && in_array('instagram', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['insta_id']) && $theChampLoginOptions['insta_id'] != '' && isset($theChampLoginOptions['insta_app_secret']) && $theChampLoginOptions['insta_app_secret'] != ''){
301
- $instagramLoginState = mt_rand();
302
- // save referrer url in state
303
- update_user_meta($instagramLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
304
- wp_redirect("https://api.instagram.com/oauth/authorize?client_id=".$theChampLoginOptions['insta_id']."&scope=user_profile,user_media&response_type=code&language=en-us&state=".$instagramLoginState."&redirect_uri=".urlencode(home_url()."/SuperSocializerAuth/Instagram"));
305
- die;
306
- }
307
- }
308
-
309
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false && remove_query_arg(array('code', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Instagram'){
310
- $postData = array(
311
- 'client_id' => $theChampLoginOptions['insta_id'],
312
- 'client_secret' => $theChampLoginOptions['insta_app_secret'],
313
- 'grant_type' => 'authorization_code',
314
- 'redirect_uri' => home_url().'/SuperSocializerAuth/Instagram',
315
- 'code' => sanitize_text_field($_GET['code'])
316
- );
317
- $response = wp_remote_post("https://api.instagram.com/oauth/access_token", array(
318
- 'method' => 'POST',
319
- 'timeout' => 15,
320
- 'redirection' => 5,
321
- 'httpversion' => '1.0',
322
- 'sslverify' => false,
323
- 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
324
- 'body' => http_build_query($postData)
325
- )
326
- );
327
 
328
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
329
- $body = json_decode(wp_remote_retrieve_body($response));
330
- if(isset($body->access_token)){
331
- $authorization = "Bearer ".$body->access_token;
332
- $response = wp_remote_get('https://graph.instagram.com/'.$body->user_id.'?fields=account_type,id,username&access_token='.$body->access_token, array('timeout' => 15));
333
-
334
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
335
- $profileData = json_decode(wp_remote_retrieve_body($response ));
336
-
337
- if(is_object($profileData) && isset($profileData->id)){
338
- $profileData = the_champ_sanitize_profile_data($profileData, 'instagram');
339
- $instagramLoginState = sanitize_text_field($_GET['state']);
340
- $instagramRedirectUrl = get_user_meta($instagramLoginState, 'super_socializer_redirect_to', true);
341
- $response = the_champ_user_auth($profileData, 'instagram', $instagramRedirectUrl);
342
- if($response == 'show form'){
343
- return;
344
- }
345
- delete_user_meta($instagramLoginState, 'super_socializer_redirect_to', true);
346
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
347
- $redirectTo = the_champ_get_login_redirection_url($instagramRedirectUrl, true);
348
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
349
- $redirectTo = $instagramRedirectUrl.(strpos($instagramRedirectUrl, '?') !== false ? '&' : '?').'linked=1';
350
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
351
- $redirectTo = $instagramRedirectUrl.(strpos($instagramRedirectUrl, '?') !== false ? '&' : '?').'linked=0';
352
- }elseif(isset($response['url']) && $response['url'] != ''){
353
- $redirectTo = $response['url'];
354
- }else{
355
- $redirectTo = the_champ_get_login_redirection_url($instagramRedirectUrl);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
356
  }
357
- the_champ_close_login_popup($redirectTo);
358
- }
359
  }
360
  }
361
- }
362
- }
363
-
364
- // Steam auth
365
- if(isset($_GET['SuperSocializerSteamAuth']) && trim($_GET['SuperSocializerSteamAuth']) != '' && isset($theChampLoginOptions['steam_api_key']) && $theChampLoginOptions['steam_api_key'] != ''){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  global $theChampSteamLogin;
367
  $theChampSteamId = $theChampSteamLogin->validate();
368
  $result = wp_remote_get("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=".$theChampLoginOptions['steam_api_key']."&steamids=".$theChampSteamId."/?xml=1", array('timeout' => 15));
@@ -395,341 +773,191 @@ function the_champ_connect(){
395
  }
396
  die;
397
  }
398
- // Linkedin login
399
- if(isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Linkedin'){
400
- if(isset($theChampLoginOptions['li_key']) && $theChampLoginOptions['li_key'] != '' && isset($theChampLoginOptions['li_secret']) && $theChampLoginOptions['li_secret'] != ''){
401
- if(!isset($_GET['code']) && !isset($_GET['state'])){
402
- $linkedinAuthState = mt_rand();
403
- // save referrer url in state
404
- update_user_meta($linkedinAuthState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url() );
405
- if(isset($_GET['heateorMSEnabled'])){
406
- update_user_meta($linkedinAuthState, 'heateor_ss_linkedin_mc_sub', 1);
407
- }
408
- $linkedinScope = 'r_liteprofile,r_emailaddress';
409
- wp_redirect('https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id='.$theChampLoginOptions['li_key'].'&redirect_uri='.urlencode(home_url().'/?SuperSocializerAuth=Linkedin').'&state='. $linkedinAuthState .'&scope='.$linkedinScope);
410
- die;
411
- }
412
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false){
413
- $url = 'https://www.linkedin.com/oauth/v2/accessToken';
414
- $data_access_token = array(
415
- 'grant_type' => 'authorization_code',
416
- 'code' => sanitize_text_field($_GET['code']),
417
- 'redirect_uri' => home_url().'/?SuperSocializerAuth=Linkedin',
418
- 'client_id' => $theChampLoginOptions['li_key'],
419
- 'client_secret' => $theChampLoginOptions['li_secret']
420
- );
421
- $response = wp_remote_post($url, array(
422
  'method' => 'POST',
423
  'timeout' => 15,
424
  'redirection' => 5,
425
  'httpversion' => '1.0',
426
  'sslverify' => false,
427
  'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
428
- 'body' => http_build_query($data_access_token)
429
- )
430
- );
431
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
432
- $body = json_decode(wp_remote_retrieve_body($response));
433
- if(is_object($body) && isset($body->access_token)){
434
- // fetch profile data
435
- $firstLastName = wp_remote_get('https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))', array(
436
- 'method' => 'GET',
437
- 'timeout' => 15,
438
- 'headers' => array('Authorization' => "Bearer ".$body->access_token),
439
- )
440
- );
441
- $email = wp_remote_get('https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))', array(
442
- 'method' => 'GET',
443
- 'timeout' => 15,
444
- 'headers' => array('Authorization' => "Bearer ".$body->access_token),
445
- )
446
- );
447
- if(!is_wp_error($firstLastName) && isset($firstLastName['response']['code']) && 200 === $firstLastName['response']['code'] && !is_wp_error($email) && isset($email['response']['code']) && 200 === $email['response']['code']){
448
- $firstLastNameBody = json_decode(wp_remote_retrieve_body($firstLastName));
449
- $emailBody = json_decode(wp_remote_retrieve_body($email));
450
- if(is_object($firstLastNameBody) && isset($firstLastNameBody->id) && $firstLastNameBody->id && is_object($emailBody) && isset($emailBody->elements)){
451
- $firstLastNameBody = json_decode(json_encode($firstLastNameBody), true);
452
- $emailBody = json_decode(json_encode($emailBody), true);
453
- $firstName = isset($firstLastNameBody['firstName']) && isset($firstLastNameBody['firstName']['localized']) && isset($firstLastNameBody['firstName']['preferredLocale']) && isset($firstLastNameBody['firstName']['preferredLocale']['language']) && isset($firstLastNameBody['firstName']['preferredLocale']['country']) ? $firstLastNameBody['firstName']['localized'][$firstLastNameBody['firstName']['preferredLocale']['language'].'_'.$firstLastNameBody['firstName']['preferredLocale']['country']] : '';
454
- $lastName = isset($firstLastNameBody['lastName']) && isset($firstLastNameBody['lastName']['localized']) && isset($firstLastNameBody['lastName']['preferredLocale']) && isset($firstLastNameBody['lastName']['preferredLocale']['language']) && isset($firstLastNameBody['lastName']['preferredLocale']['country']) ? $firstLastNameBody['lastName']['localized'][$firstLastNameBody['lastName']['preferredLocale']['language'].'_'.$firstLastNameBody['lastName']['preferredLocale']['country']] : '';
455
- $smallAvatar = isset($firstLastNameBody['profilePicture']) && isset($firstLastNameBody['profilePicture']['displayImage~']) && isset($firstLastNameBody['profilePicture']['displayImage~']['elements']) && is_array($firstLastNameBody['profilePicture']['displayImage~']['elements']) && isset($firstLastNameBody['profilePicture']['displayImage~']['elements'][0]['identifiers']) && is_array($firstLastNameBody['profilePicture']['displayImage~']['elements'][0]['identifiers'][0]) && isset($firstLastNameBody['profilePicture']['displayImage~']['elements'][0]['identifiers'][0]['identifier']) ? $firstLastNameBody['profilePicture']['displayImage~']['elements'][0]['identifiers'][0]['identifier'] : '';
456
- $largeAvatar = isset($firstLastNameBody['profilePicture']) && isset($firstLastNameBody['profilePicture']['displayImage~']) && isset($firstLastNameBody['profilePicture']['displayImage~']['elements']) && is_array($firstLastNameBody['profilePicture']['displayImage~']['elements']) && isset($firstLastNameBody['profilePicture']['displayImage~']['elements'][3]['identifiers']) && is_array($firstLastNameBody['profilePicture']['displayImage~']['elements'][3]['identifiers'][0]) && isset($firstLastNameBody['profilePicture']['displayImage~']['elements'][3]['identifiers'][0]['identifier']) ? $firstLastNameBody['profilePicture']['displayImage~']['elements'][3]['identifiers'][0]['identifier'] : '';
457
- $emailAddress = isset($emailBody['elements']) && is_array($emailBody['elements']) && isset($emailBody['elements'][0]['handle~']) && isset($emailBody['elements'][0]['handle~']['emailAddress']) ? $emailBody['elements'][0]['handle~']['emailAddress'] : '';
458
- $user = array(
459
- 'firstName' => $firstName,
460
- 'lastName' => $lastName,
461
- 'email' => $emailAddress,
462
- 'id' => $firstLastNameBody['id'],
463
- 'smallAvatar' => $smallAvatar,
464
- 'largeAvatar' => $largeAvatar
465
- );
466
-
467
- $profileData = the_champ_sanitize_profile_data($user, 'linkedin');
468
- $linkedinAuthState = sanitize_text_field($_GET['state']);
469
- if(get_user_meta($linkedinAuthState, 'heateor_ss_linkedin_mc_sub', true)){
470
- $profileData['mc_subscribe'] = 1;
471
- delete_user_meta($linkedinAuthState, 'heateor_ss_linkedin_mc_sub');
472
- }
473
- $linkedinRedirectUrl = get_user_meta($linkedinAuthState, 'super_socializer_redirect_to', true);
474
- $response = the_champ_user_auth($profileData, 'linkedin', $linkedinRedirectUrl);
475
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
476
- $redirectTo = the_champ_get_login_redirection_url($linkedinRedirectUrl, true);
477
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
478
- $redirectTo = $linkedinRedirectUrl.(strpos($linkedinRedirectUrl, '?') !== false ? '&' : '?').'linked=1';
479
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
480
- $redirectTo = $linkedinRedirectUrl.(strpos($linkedinRedirectUrl, '?') !== false ? '&' : '?').'linked=0';
481
- }elseif(isset($response['url']) && $response['url'] != ''){
482
- $redirectTo = $response['url'];
483
- }else{
484
- $redirectTo = the_champ_get_login_redirection_url($linkedinRedirectUrl);
485
- }
486
- the_champ_close_login_popup($redirectTo);
487
  }
488
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
489
  }
490
  }
491
- }
492
- }
493
- }
494
-
495
- // line
496
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Line')){
497
- if(isset($theChampLoginOptions['providers']) && in_array('line', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['line_channel_id']) && $theChampLoginOptions['line_channel_id'] != '' && isset($theChampLoginOptions['line_channel_secret']) && $theChampLoginOptions['line_channel_secret'] != ''){
498
- if(!isset($_GET['code'])){
499
- $lineLoginState = mt_rand();
500
- // save referrer url in state
501
- update_user_meta($lineLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
502
- }
503
- wp_redirect("https://access.line.me/oauth2/v2.1/authorize?client_id=".$theChampLoginOptions['line_channel_id']."&response_type=code&scope=openid%20profile%20email&state=". $lineLoginState ."&redirect_uri=".urlencode(home_url()."/SuperSocializerAuth/Line"));
504
- die;
505
  }
506
- }
507
 
508
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) && remove_query_arg(array('code','scope', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Line'){
509
- $postData = array(
510
- 'grant_type' => 'authorization_code',
511
- 'code' => sanitize_text_field($_GET['code']),
512
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Line",
513
- 'client_id' => $theChampLoginOptions['line_channel_id'],
514
- 'client_secret' => $theChampLoginOptions['line_channel_secret']
515
- );
516
- $response = wp_remote_post("https://api.line.me/oauth2/v2.1/token", array(
517
- 'method' => 'POST',
518
- 'timeout' => 15,
519
- 'redirection' => 5,
520
- 'httpversion' => '1.0',
521
- 'sslverify' => false,
522
- 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
523
- 'body' => http_build_query($postData)
524
- )
525
- );
526
-
527
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
528
- $body = json_decode(wp_remote_retrieve_body($response));
529
- $authorization = "Bearer ".$body->access_token;
530
 
531
- $response = wp_remote_get("https://api.line.me/v2/profile", array(
532
- 'timeout' => 15,
533
- 'headers' => array(
534
- 'Accept' => 'application/json',
535
- 'Authorization' => $authorization
536
- )
537
- ));
538
 
539
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
540
- $profileData = json_decode(wp_remote_retrieve_body($response));
541
- if(is_object($profileData) && isset($profileData->userId)){
542
- $profileData = the_champ_sanitize_profile_data($profileData, 'line');
543
- $lineLoginState = sanitize_text_field($_GET['state']);
544
- $lineRedirectUrl = get_user_meta($lineLoginState, 'super_socializer_redirect_to', true);
545
- $response = the_champ_user_auth($profileData, 'line', $lineRedirectUrl);
546
- if($response == 'show form'){
547
- return;
548
- }
549
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
550
- $redirectTo = the_champ_get_login_redirection_url($lineRedirectUrl, true);
551
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
552
- $redirectTo = $lineRedirectUrl . (strpos($lineRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
553
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
554
- $redirectTo = $lineRedirectUrl . (strpos($lineRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
555
- }elseif(isset($response['url']) && $response['url'] != ''){
556
- $redirectTo = $response['url'];
557
- }else{
558
- $redirectTo = the_champ_get_login_redirection_url($lineRedirectUrl);
559
- }
560
- the_champ_close_login_popup($redirectTo);
561
- }
562
- }
563
- }
564
- }
565
-
566
- // mail.ru
567
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Mailru')){
568
- if(isset($theChampLoginOptions['providers']) && in_array('mailru', $theChampLoginOptions['providers']) && $theChampLoginOptions['mailru_client_id'] && $theChampLoginOptions['mailru_client_secret']){
569
- if(!heateor_ss_is_curl_loaded()){
570
- _e('Enable CURL at your website server to use Mail.ru Social Login.', 'super-socializer');
571
- die;
572
- }
573
- if(!isset($_GET['code'])){
574
- $mailruLoginState = mt_rand();
575
- // save referrer url in state
576
- update_user_meta($mailruLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
577
- }
578
- wp_redirect("https://oauth.mail.ru/login?client_id=". $theChampLoginOptions['mailru_client_id'] ."&scope=userinfo&state=". $mailruLoginState ."&response_type=code&redirect_uri=". home_url() ."/SuperSocializerAuth/Mailru");
579
- die;
580
- }
581
- }
582
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) && remove_query_arg(array('code', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Mailru'){
583
- $postData = array(
584
- 'grant_type' => 'authorization_code',
585
- 'code' => sanitize_text_field($_GET['code']),
586
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Mailru"
587
- );
588
- $serviceUrl = 'https://oauth.mail.ru/token';
589
- $auth = base64_encode($theChampLoginOptions['mailru_client_id']. ":" .$theChampLoginOptions['mailru_client_secret']);
590
- $response = wp_remote_post($serviceUrl, array(
591
- 'method' => 'POST',
592
- 'timeout' => 15,
593
- 'redirection' => 5,
594
- 'httpversion' => '1.0',
595
- 'sslverify' => false,
596
- 'headers' => array(
597
- 'Content-Type' => "application/x-www-form-urlencoded",
598
- 'User-Agent' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36",
599
- 'Authorization' => "Basic $auth"
600
- ),
601
- 'body' => $postData
602
- )
603
- );
604
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
605
- $body = json_decode(wp_remote_retrieve_body($response));
606
- if(is_object($body) && isset($body->access_token)){
607
- $serviceUrl = 'https://oauth.mail.ru/userinfo?access_token=' .$body->access_token;
608
-
609
- $response = wp_remote_get($serviceUrl, array('timeout' => 15, 'headers' => array(
610
- 'Content-Type' => 'application/x-www-form-urlencoded',
611
- 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36',
612
- 'Authorization' => "Bearer ". $body->access_token
613
- )));
614
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
615
  $profileData = json_decode(wp_remote_retrieve_body($response));
616
-
617
- if(is_object($profileData) && isset($profileData->id)){
618
- $profileData = the_champ_sanitize_profile_data($profileData, 'mailru');
619
- $mailruLoginState = sanitize_text_field($_GET['state']);
620
- $mailruRedirectUrl = get_user_meta($mailruLoginState, 'super_socializer_redirect_to', true);
621
- $response = the_champ_user_auth($profileData, 'mailru', $mailruRedirectUrl);
622
  if($response == 'show form'){
623
  return;
624
  }
625
  if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
626
- $redirectTo = the_champ_get_login_redirection_url($mailruRedirectUrl, true);
627
  }elseif(isset($response['message']) && $response['message'] == 'linked'){
628
- $redirectTo = $mailruRedirectUrl . (strpos($mailruRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
629
  }elseif(isset($response['message']) && $response['message'] == 'not linked'){
630
- $redirectTo = $mailruRedirectUrl . (strpos($mailruRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
631
  }elseif(isset($response['url']) && $response['url'] != ''){
632
  $redirectTo = $response['url'];
633
  }else{
634
- $redirectTo = the_champ_get_login_redirection_url($mailruRedirectUrl);
635
  }
636
  the_champ_close_login_popup($redirectTo);
637
- }
638
  }
639
- }
640
- }
641
- }
642
-
643
- // yahoo
644
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Yahoo')){
645
- if(isset($theChampLoginOptions['providers']) && in_array('yahoo', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['yahoo_channel_id']) && $theChampLoginOptions['yahoo_channel_id'] != '' && isset($theChampLoginOptions['yahoo_channel_secret']) && $theChampLoginOptions['yahoo_channel_secret'] != ''){
646
- if(!isset($_GET['code'])){
647
- $yahooLoginState = mt_rand();
648
- // save referrer url in state
649
- update_user_meta($yahooLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
650
- }
651
- wp_redirect("https://api.login.yahoo.com/oauth2/request_auth?client_id=".$theChampLoginOptions['yahoo_channel_id']."&response_type=code&language=en-us&state=".$yahooLoginState."&redirect_uri=".home_url()."/SuperSocializerAuth/Yahoo");
652
- die;
653
  }
654
- }
655
-
656
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false && remove_query_arg(array('code', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Yahoo'){
657
- $postData = array(
658
- 'grant_type' => 'authorization_code',
659
- 'code' => sanitize_text_field($_GET['code']),
660
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Yahoo",
661
- 'client_id' => $theChampLoginOptions['yahoo_channel_id'],
662
- 'client_secret' => $theChampLoginOptions['yahoo_channel_secret']
663
- );
664
- $response = wp_remote_post("https://api.login.yahoo.com/oauth2/get_token", array(
665
- 'method' => 'POST',
666
- 'timeout' => 15,
667
- 'redirection' => 5,
668
- 'httpversion' => '1.0',
669
- 'sslverify' => false,
670
- 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
671
- 'body' => http_build_query($postData)
672
- )
673
- );
674
-
675
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
676
- $body = json_decode(wp_remote_retrieve_body($response));
677
- $authorization = "Bearer ".$body->access_token;
678
-
679
- $response = wp_remote_get("https://api.login.yahoo.com/openid/v1/userinfo", array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization )));
680
-
681
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
682
- $profileData = json_decode(wp_remote_retrieve_body($response));
683
-
684
- if(is_object($profileData) && isset($profileData->sub)){
685
- $profileData = the_champ_sanitize_profile_data($profileData, 'yahoo');
686
- $yahooLoginState = sanitize_text_field($_GET['state']);
687
- $yahooRedirectUrl = get_user_meta($yahooLoginState, 'super_socializer_redirect_to', true);
688
- $response = the_champ_user_auth($profileData, 'yahoo', $yahooRedirectUrl);
689
- if($response == 'show form'){
690
- return;
691
- }
692
- delete_user_meta($yahooLoginState, 'super_socializer_redirect_to', true);
693
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
694
- $redirectTo = the_champ_get_login_redirection_url($yahooRedirectUrl, true);
695
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
696
- $redirectTo = $yahooRedirectUrl . (strpos($yahooRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
697
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
698
- $redirectTo = $yahooRedirectUrl . (strpos($yahooRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
699
- }elseif(isset($response['url']) && $response['url'] != ''){
700
- $redirectTo = $response['url'];
701
- }else{
702
- $redirectTo = the_champ_get_login_redirection_url($yahooRedirectUrl);
 
 
 
 
 
 
 
 
 
 
 
 
703
  }
704
- the_champ_close_login_popup($redirectTo);
705
  }
706
  }
707
- }
708
- }
709
-
710
- // Discord
711
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Discord')){
712
- if(isset($theChampLoginOptions['providers']) && in_array('discord', $theChampLoginOptions['providers']) && $theChampLoginOptions['discord_channel_id'] && $theChampLoginOptions['discord_channel_secret']){
713
- if(!isset($_GET['code'])){
714
- $discordLoginState = mt_rand();
715
- // save referrer url in state
716
- update_user_meta($discordLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
717
- }
718
- wp_redirect("https://discord.com/oauth2/authorize/request_auth?client_id=".$theChampLoginOptions['discord_channel_id']."&response_type=code&state=".$discordLoginState."&scope=identify%20email&redirect_uri=".home_url()."/SuperSocializerAuth/Discord");
719
- die;
720
  }
721
- }
722
 
723
- if(isset($_GET['code']) && isset($_GET['state']) && remove_query_arg(array('code', 'scope', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Discord'){
724
- $postData = array(
725
- 'grant_type' => 'authorization_code',
726
- 'code' => sanitize_text_field($_GET['code']),
727
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Discord",
728
- 'client_id' => $theChampLoginOptions['discord_channel_id'],
729
- 'client_secret' => $theChampLoginOptions['discord_channel_secret'],
730
- 'scope' => 'identify%20email'
731
- );
732
- $response = wp_remote_post("https://discord.com/api/oauth2/token", array(
733
  'method' => 'POST',
734
  'timeout' => 15,
735
  'redirection' => 5,
@@ -737,535 +965,162 @@ function the_champ_connect(){
737
  'sslverify' => false,
738
  'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
739
  'body' => http_build_query($postData)
740
- )
741
- );
742
-
743
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
744
- $body = json_decode(wp_remote_retrieve_body($response));
745
- $authorization = "Bearer ".$body->access_token;
746
 
747
- $response = wp_remote_get("https://discordapp.com/api/users/@me", array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization )));
748
-
749
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
750
- $profileData = json_decode(wp_remote_retrieve_body($response));
751
- if(is_object($profileData) && isset($profileData->id) && isset($profileData->verified) && $profileData->verified == 1){
752
- $profileData = the_champ_sanitize_profile_data($profileData, 'discord');
753
- $discordLoginState = sanitize_text_field($_GET['state']);
754
- $discordRedirectUrl = get_user_meta($discordLoginState, 'super_socializer_redirect_to', true);
755
- $response = the_champ_user_auth($profileData, 'discord', $discordRedirectUrl);
756
- if($response == 'show form'){
757
- return;
758
- }
759
- delete_user_meta($discordLoginState, 'super_socializer_redirect_to', true);
760
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
761
- $redirectTo = the_champ_get_login_redirection_url($discordRedirectUrl, true);
762
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
763
- $redirectTo = $discordRedirectUrl . (strpos($discordRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
764
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
765
- $redirectTo = $discordRedirectUrl . (strpos($discordRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
766
- }elseif(isset($response['url']) && $response['url'] != ''){
767
- $redirectTo = $response['url'];
768
- }else{
769
- $redirectTo = the_champ_get_login_redirection_url($discordRedirectUrl);
 
 
 
 
 
 
 
 
 
770
  }
771
- the_champ_close_login_popup($redirectTo);
772
  }
773
- }
774
- }
775
- }
776
-
777
- // Wordpress
778
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Wordpress')){
779
- if(isset($theChampLoginOptions['providers']) && in_array('wordpress', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['wordpress_client_id']) && $theChampLoginOptions['wordpress_client_id'] != '' && isset($theChampLoginOptions['wordpress_client_secret']) && $theChampLoginOptions['wordpress_client_secret'] != ''){
780
- if(!isset($_GET['code'])){
781
- $wordpressLoginState = mt_rand();
782
- // save referrer url in state
783
- update_user_meta($wordpressLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
784
- }
785
- wp_redirect("https://public-api.wordpress.com/oauth2/authorize?client_id=".$theChampLoginOptions['wordpress_client_id']."&scope=auth&response_type=code&state=".$wordpressLoginState."&redirect_uri=".home_url()."/SuperSocializerAuth/Wordpress");
786
- die;
787
  }
788
- }
789
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false && remove_query_arg(array('code','state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Wordpress'){
790
- $postData = array(
791
- 'grant_type' => 'authorization_code',
792
- 'code' => sanitize_text_field($_GET['code']),
793
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Wordpress",
794
- 'client_id' => $theChampLoginOptions['wordpress_client_id'],
795
- 'client_secret' => $theChampLoginOptions['wordpress_client_secret']
796
- );
797
- $response = wp_remote_post("https://public-api.wordpress.com/oauth2/token", array(
798
- 'method' => 'POST',
799
- 'timeout' => 15,
800
- 'redirection' => 5,
801
- 'httpversion' => '1.0',
802
- 'sslverify' => false,
803
- 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
804
- 'body' => http_build_query($postData)
805
- )
806
- );
807
-
808
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
809
- $body = json_decode(wp_remote_retrieve_body($response));
810
- $authorization = "Bearer ".$body->access_token;
811
 
812
- $response = wp_remote_get("https://public-api.wordpress.com/rest/v1/me/", array('timeout' => 15, 'headers' => array('Accept' => 'application/json', 'Authorization' => $authorization )));
813
-
814
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
815
- $profileData = json_decode(wp_remote_retrieve_body($response));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
816
 
817
- if(is_object($profileData) && isset($profileData->ID)){
818
- $profileData = the_champ_sanitize_profile_data($profileData, 'wordpress');
819
- $wordpressLoginState = sanitize_text_field($_GET['state']);
820
- $wordpressRedirectUrl = get_user_meta($wordpressLoginState, 'super_socializer_redirect_to', true);
821
- $response = the_champ_user_auth($profileData, 'wordpress', $wordpressRedirectUrl);
822
- if($response == 'show form'){
823
- return;
824
- }
825
- delete_user_meta($wordpressLoginState, 'super_socializer_redirect_to', true);
826
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
827
- $redirectTo = the_champ_get_login_redirection_url($wordpressRedirectUrl, true);
828
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
829
- $redirectTo = $wordpressRedirectUrl.(strpos($wordpressRedirectUrl, '?') !== false ? '&' : '?').'linked=1';
830
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
831
- $redirectTo = $wordpressRedirectUrl.(strpos($wordpressRedirectUrl, '?') !== false ? '&' : '?').'linked=0';
832
- }elseif(isset($response['url']) && $response['url'] != ''){
833
- $redirectTo = $response['url'];
834
- }else{
835
- $redirectTo = the_champ_get_login_redirection_url($wordpressRedirectUrl);
836
- }
837
- the_champ_close_login_popup($redirectTo);
838
- }
839
-
840
- }
841
- }
842
- }
843
-
844
- // windows live
845
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Live')){
846
- if(isset($theChampLoginOptions['providers']) && in_array('microsoft', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['live_channel_id']) && $theChampLoginOptions['live_channel_id'] != '' && isset($theChampLoginOptions['live_channel_secret']) && $theChampLoginOptions['live_channel_secret'] != ''){
847
- $liveLoginState = mt_rand();
848
- // save referrer url in state
849
- update_user_meta($liveLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
850
- wp_redirect("https://login.live.com/oauth20_authorize.srf?client_id=".$theChampLoginOptions['live_channel_id']."&scope=wl.emails,wl.basic&response_type=code&state=".$liveLoginState."&redirect_uri=".home_url()."/SuperSocializerAuth/Live");
851
- die;
852
- }
853
- }
854
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false && remove_query_arg(array('code', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Live'){
855
- $postData = array(
856
- 'grant_type' => 'authorization_code',
857
- 'code' => sanitize_text_field($_GET['code']),
858
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Live",
859
- 'client_id' => $theChampLoginOptions['live_channel_id'],
860
- 'client_secret' => $theChampLoginOptions['live_channel_secret']
861
- );
862
- $response = wp_remote_post("https://login.live.com/oauth20_token.srf", array(
863
- 'method' => 'POST',
864
- 'timeout' => 15,
865
- 'redirection' => 5,
866
- 'httpversion' => '1.0',
867
- 'sslverify' => false,
868
- 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
869
- 'body' => http_build_query($postData)
870
- )
871
- );
872
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
873
- $body = json_decode(wp_remote_retrieve_body($response));
874
-
875
- $response = wp_remote_get("https://apis.live.net/v5.0/me?access_token=".$body->access_token, array('timeout' => 15));
876
-
877
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
878
- $profileData = json_decode(wp_remote_retrieve_body($response ));
879
-
880
- if(is_object($profileData) && isset($profileData->id)){
881
- $profileData = the_champ_sanitize_profile_data($profileData, 'microsoft');
882
- $liveLoginState = sanitize_text_field($_GET['state']);
883
- $liveRedirectUrl = get_user_meta($liveLoginState, 'super_socializer_redirect_to', true);
884
- $response = the_champ_user_auth($profileData, 'microsoft', $liveRedirectUrl);
885
- if($response == 'show form'){
886
- return;
887
- }
888
- delete_user_meta($liveLoginState, 'super_socializer_redirect_to');
889
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
890
- $redirectTo = the_champ_get_login_redirection_url($liveRedirectUrl, true);
891
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
892
- $redirectTo = $liveRedirectUrl.(strpos($liveRedirectUrl, '?') !== false ? '&' : '?').'linked=1';
893
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
894
- $redirectTo = $liveRedirectUrl.(strpos($liveRedirectUrl, '?') !== false ? '&' : '?').'linked=0';
895
- }elseif(isset($response['url']) && $response['url'] != ''){
896
- $redirectTo = $response['url'];
897
- }else{
898
- $redirectTo = the_champ_get_login_redirection_url($liveRedirectUrl);
 
 
 
 
 
 
 
899
  }
900
- the_champ_close_login_popup($redirectTo);
901
  }
902
-
903
- }
904
- }
905
- }
906
-
907
- // twitch
908
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Twitch')){
909
- if(isset($theChampLoginOptions['providers']) && in_array('twitch', $theChampLoginOptions['providers']) && $theChampLoginOptions['twitch_client_id'] && $theChampLoginOptions['twitch_client_secret']){
910
- if(!isset($_GET['code'])){
911
- $twitchLoginState = mt_rand();
912
- // save referrer url in state
913
- update_user_meta($twitchLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
914
- }
915
- wp_redirect("https://id.twitch.tv/oauth2/authorize?client_id=".$theChampLoginOptions['twitch_client_id']."&scope=user:read:email&response_type=code&state=".$twitchLoginState."&redirect_uri=".urlencode(home_url()."/SuperSocializerAuth/Twitch"));
916
- die;
917
  }
918
- }
919
-
920
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false && remove_query_arg(array('code', 'scope', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Twitch'){
921
- $postData = array(
922
- 'grant_type' => 'authorization_code',
923
- 'code' => sanitize_text_field($_GET['code']),
924
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Twitch",
925
- 'client_id' => $theChampLoginOptions['twitch_client_id'],
926
- 'client_secret' => $theChampLoginOptions['twitch_client_secret']
927
- );
928
- $response = wp_remote_post("https://id.twitch.tv/oauth2/token", array(
929
- 'method' => 'POST',
930
- 'timeout' => 15,
931
- 'redirection' => 5,
932
- 'httpversion' => '1.0',
933
- 'sslverify' => false,
934
- 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
935
- 'body' => http_build_query($postData)
936
- )
937
- );
938
-
939
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
940
- $body = json_decode(wp_remote_retrieve_body($response));
941
- $authorization = "Bearer ".$body->access_token;
942
 
943
- $response = wp_remote_get("https://api.twitch.tv/helix/users", array('timeout' => 15, 'headers' => array('Content-Type' => 'application/json' ,'Authorization' => 'Bearer ' . $body->access_token , 'Client-Id' => $theChampLoginOptions['twitch_client_id'])
944
- ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
945
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
946
- $profileData = json_decode(wp_remote_retrieve_body($response ));
 
 
 
 
 
 
947
 
948
- if(is_object($profileData) && isset($profileData->data) && is_array($profileData->data) && isset($profileData->data[0]) && isset($profileData->data[0]->id)){
949
- $profileData = the_champ_sanitize_profile_data($profileData->data[0], 'twitch');
950
- $twitchLoginState = sanitize_text_field($_GET['state']);
951
- $twitchRedirectUrl = get_user_meta($twitchLoginState, 'super_socializer_redirect_to', true);
952
- $response = the_champ_user_auth($profileData, 'twitch', $twitchRedirectUrl);
953
- if($response == 'show form'){
954
- return;
955
- }
956
- delete_user_meta($twitchLoginState, 'super_socializer_redirect_to', true);
957
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
958
- $redirectTo = the_champ_get_login_redirection_url($twitchRedirectUrl, true);
959
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
960
- $redirectTo = $twitchRedirectUrl . (strpos($twitchRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
961
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
962
- $redirectTo = $twitchRedirectUrl . (strpos($twitchRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
963
- }elseif(isset($response['url']) && $response['url'] != ''){
964
- $redirectTo = $response['url'];
965
- }else{
966
- $redirectTo = the_champ_get_login_redirection_url($twitchRedirectUrl);
 
 
967
  }
968
- the_champ_close_login_popup($redirectTo);
969
- }
970
- }
971
- }
972
- }
973
-
974
- // reddit
975
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Reddit')){
976
- if(isset($theChampLoginOptions['providers']) && in_array('reddit', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['reddit_client_id']) && $theChampLoginOptions['reddit_client_id'] != '' && isset($theChampLoginOptions['reddit_client_secret']) && $theChampLoginOptions['reddit_client_secret'] != ''){
977
- $redditLoginState = mt_rand();
978
- // save referrer url in state
979
- update_user_meta($redditLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
980
- wp_redirect("https://ssl.reddit.com/api/v1/authorize?client_id=" . $theChampLoginOptions['reddit_client_id'] . "&scope=identity&state=" . $redditLoginState . "&duration=temporary&response_type=code&redirect_uri=" . home_url() . "/SuperSocializerAuth/Reddit");
981
- die;
982
- }
983
- }
984
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false && remove_query_arg(array(
985
- 'code',
986
- 'state',
987
- 'scope'
988
- ), esc_url_raw(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])) == home_url() . '/SuperSocializerAuth/Reddit'){
989
- $postData = array(
990
- 'grant_type' => 'authorization_code',
991
- 'code' => sanitize_text_field($_GET['code']),
992
- 'redirect_uri' => home_url() . "/SuperSocializerAuth/Reddit",
993
- 'client_id' => $theChampLoginOptions['reddit_client_id'],
994
- 'client_secret' => $theChampLoginOptions['reddit_client_secret']
995
- );
996
- $response = wp_remote_post("https://www.reddit.com/api/v1/access_token", array(
997
- 'timeout' => 15,
998
- 'redirection' => 5,
999
- 'httpversion' => '1.0',
1000
- 'sslverify' => false,
1001
- 'headers' => array(
1002
- 'Content-Type' => 'application/x-www-form-urlencoded',
1003
- 'Authorization' => 'Basic ' . base64_encode($theChampLoginOptions['reddit_client_id'] . ':' . $theChampLoginOptions['reddit_client_secret'])
1004
- ),
1005
- 'body' => http_build_query($postData)
1006
- ));
1007
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1008
- $body = json_decode(wp_remote_retrieve_body($response));
1009
- $response = wp_remote_get("https://oauth.reddit.com/api/v1/me", array(
1010
- 'timeout' => 15,
1011
- 'headers' => array(
1012
- 'Authorization' => "Bearer " . $body->access_token
1013
- )
1014
- ));
1015
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1016
- $profileData = json_decode(wp_remote_retrieve_body($response));
1017
- if(is_object($profileData) && isset($profileData->id) && isset($profileData->verified) && $profileData->verified == 1){
1018
- $profileData = the_champ_sanitize_profile_data($profileData, 'reddit');
1019
- $redditLoginState = sanitize_text_field($_GET['state']);
1020
- $redditRedirectUrl = get_user_meta($redditLoginState, 'super_socializer_redirect_to', true);
1021
- $response = the_champ_user_auth($profileData, 'reddit', $redditRedirectUrl);
1022
- if($response == 'show form'){
1023
- return;
1024
- }
1025
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1026
- $redirectTo = the_champ_get_login_redirection_url($redditRedirectUrl, true);
1027
- } elseif(isset($response['message']) && $response['message'] == 'linked'){
1028
- $redirectTo = $redditRedirectUrl . (strpos($redditRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1029
- } elseif(isset($response['message']) && $response['message'] == 'not linked'){
1030
- $redirectTo = $redditRedirectUrl . (strpos($redditRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1031
- } elseif(isset($response['url']) && $response['url'] != ''){
1032
- $redirectTo = $response['url'];
1033
- } else {
1034
- $redirectTo = the_champ_get_login_redirection_url($redditRedirectUrl);
1035
- }
1036
- the_champ_close_login_popup($redirectTo);
1037
- }
1038
- }
1039
- }
1040
- }
1041
-
1042
- //disqus
1043
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Disqus')){
1044
- if(isset($theChampLoginOptions['providers']) && in_array('disqus', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['disqus_public_key']) && $theChampLoginOptions['disqus_public_key'] != '' && isset($theChampLoginOptions['disqus_secret_key']) && $theChampLoginOptions['disqus_secret_key'] != ''){
1045
- $disqusLoginState = mt_rand();
1046
- // save referrer url in state
1047
- update_user_meta($disqusLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
1048
- wp_redirect("https://disqus.com/api/oauth/2.0/authorize/?client_id=" . $theChampLoginOptions['disqus_public_key'] . "&scope=read,email&response_type=code&state=". $disqusLoginState ."&redirect_uri=" . home_url() . "/SuperSocializerAuth/Disqus");
1049
- die;
1050
- }
1051
- }
1052
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false && remove_query_arg(array(
1053
- 'code',
1054
- 'scope',
1055
- 'state'
1056
- ), esc_url_raw(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])) == home_url() . '/SuperSocializerAuth/Disqus'){
1057
- $postData = array(
1058
- 'grant_type' => 'authorization_code',
1059
- 'code' => sanitize_text_field($_GET['code']),
1060
- 'redirect_uri' => home_url() . "/SuperSocializerAuth/Disqus",
1061
- 'client_id' => $theChampLoginOptions['disqus_public_key'],
1062
- 'client_secret' => $theChampLoginOptions['disqus_secret_key']
1063
- );
1064
- $response = wp_remote_post("https://disqus.com/api/oauth/2.0/access_token/", array(
1065
- 'timeout' => 15,
1066
- 'redirection' => 5,
1067
- 'httpversion' => '1.0',
1068
- 'sslverify' => false,
1069
- 'headers' => array(
1070
- 'Content-Type' => 'application/x-www-form-urlencoded',
1071
- 'Authorization' => 'Basic ' . base64_encode($theChampLoginOptions['disqus_public_key'] . ':' . $theChampLoginOptions['disqus_secret_key'])
1072
- ),
1073
- 'body' => http_build_query($postData)
1074
- ));
1075
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1076
- $body = json_decode(wp_remote_retrieve_body($response));
1077
- $response = wp_remote_get("https://disqus.com/api/3.0/users/details.json?api_key=" . $theChampLoginOptions['disqus_public_key'], array(
1078
- 'timeout' => 15,
1079
- 'headers' => array(
1080
- 'Authorization' => "Bearer " . $body->access_token
1081
- )
1082
- ));
1083
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1084
- $profileData = json_decode(wp_remote_retrieve_body($response));
1085
- if(is_object($profileData) && isset($profileData->response->id)){
1086
- $profileData = the_champ_sanitize_profile_data($profileData, 'disqus');
1087
- $disqusLoginState = sanitize_text_field($_GET['state']);
1088
- $disqusRedirectUrl = get_user_meta($disqusLoginState, 'super_socializer_redirect_to', true);
1089
- $response = the_champ_user_auth($profileData, 'disqus', $disqusRedirectUrl);
1090
- if($response == 'show form'){
1091
- return;
1092
- }
1093
- delete_user_meta($disqusLoginState, 'super_socializer_redirect_to', true);
1094
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1095
- $redirectTo = the_champ_get_login_redirection_url($disqusRedirectUrl, true);
1096
- } elseif(isset($response['message']) && $response['message'] == 'linked'){
1097
- $redirectTo = $disqusRedirectUrl . (strpos($disqusRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1098
- } elseif(isset($response['message']) && $response['message'] == 'not linked'){
1099
- $redirectTo = $disqusRedirectUrl . (strpos($disqusRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1100
- } elseif(isset($response['url']) && $response['url'] != ''){
1101
- $redirectTo = $response['url'];
1102
- } else {
1103
- $redirectTo = the_champ_get_login_redirection_url($disqusRedirectUrl);
1104
- }
1105
- the_champ_close_login_popup($redirectTo);
1106
- }
1107
- }
1108
- }
1109
- }
1110
-
1111
- //dropbox
1112
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Dropbox')){
1113
- if(isset($theChampLoginOptions['providers']) && in_array('dropbox', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['dropbox_app_key']) && $theChampLoginOptions['dropbox_app_key'] != '' && isset($theChampLoginOptions['dropbox_app_secret']) && $theChampLoginOptions['dropbox_app_secret'] != ''){
1114
- $dropboxLoginState = mt_rand();
1115
- // save referrer url in state
1116
- update_user_meta($dropboxLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
1117
- wp_redirect("https://www.dropbox.com/1/oauth2/authorize?client_id=" . $theChampLoginOptions['dropbox_app_key'] . "&scope=account_info.read&state=" . $dropboxLoginState . "&response_type=code&redirect_uri=" . home_url() . "/SuperSocializerAuth/Dropbox");
1118
- die;
1119
- }
1120
- }
1121
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false && remove_query_arg(array(
1122
- 'code',
1123
- 'scope',
1124
- 'state'
1125
- ), esc_url_raw(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])) == home_url() . '/SuperSocializerAuth/Dropbox'){
1126
- $postData = array(
1127
- 'grant_type' => 'authorization_code',
1128
- 'code' => sanitize_text_field($_GET['code']),
1129
- 'redirect_uri' => home_url() . "/SuperSocializerAuth/Dropbox"
1130
- );
1131
- $response = wp_remote_post("https://api.dropbox.com/1/oauth2/token", array(
1132
- 'method' => 'POST',
1133
- 'timeout' => 15,
1134
- 'redirection' => 5,
1135
- 'httpversion' => '1.0',
1136
- 'sslverify' => false,
1137
- 'headers' => array(
1138
- 'Content-Type' => 'application/x-www-form-urlencoded',
1139
- 'Authorization' => 'Basic ' . base64_encode($theChampLoginOptions['dropbox_app_key'] . ':' . $theChampLoginOptions['dropbox_app_secret'])
1140
- ),
1141
- 'body' => http_build_query($postData)
1142
- ));
1143
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1144
- $body = json_decode(wp_remote_retrieve_body($response));
1145
- $response = wp_remote_post("https://api.dropbox.com/2/users/get_current_account", array(
1146
- 'timeout' => 15,
1147
- 'headers' => array(
1148
- 'content-type' => 'application/json',
1149
- 'Authorization' => "Bearer " . $body->access_token
1150
- ),
1151
- 'body' => "null"
1152
- ));
1153
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1154
- $profileData = json_decode(wp_remote_retrieve_body($response));
1155
- if(is_object($profileData) && isset($profileData->account_id)){
1156
- $profileData = the_champ_sanitize_profile_data($profileData, 'dropbox');
1157
- $dropboxLoginState = sanitize_text_field($_GET['state']);
1158
- $dropboxRedirectUrl = get_user_meta($dropboxLoginState, 'super_socializer_redirect_to', true);
1159
- $response = the_champ_user_auth($profileData, 'dropbox', $dropboxRedirectUrl);
1160
- if($response == 'show form'){
1161
- return;
1162
- }
1163
- delete_user_meta($dropboxLoginState, 'super_socializer_redirect_to', true);
1164
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1165
- $redirectTo = the_champ_get_login_redirection_url($dropboxRedirectUrl, true);
1166
- } elseif(isset($response['message']) && $response['message'] == 'linked'){
1167
- $redirectTo = $dropboxRedirectUrl . (strpos($dropboxRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1168
- } elseif(isset($response['message']) && $response['message'] == 'not linked'){
1169
- $redirectTo = $dropboxRedirectUrl . (strpos($dropboxRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1170
- } elseif(isset($response['url']) && $response['url'] != ''){
1171
- $redirectTo = $response['url'];
1172
- } else {
1173
- $redirectTo = the_champ_get_login_redirection_url($dropboxRedirectUrl);
1174
- }
1175
- the_champ_close_login_popup($redirectTo);
1176
- }
1177
- }
1178
- }
1179
- }
1180
-
1181
- // foursquare
1182
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Foursquare')){
1183
- if(isset($theChampLoginOptions['providers']) && in_array('foursquare', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['foursquare_client_id']) && $theChampLoginOptions['foursquare_client_id'] != '' && isset($theChampLoginOptions['foursquare_client_secret']) && $theChampLoginOptions['foursquare_client_secret'] != ''){
1184
- $foursquareLoginState = mt_rand();
1185
- // save referrer url in state
1186
- update_user_meta($foursquareLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
1187
- wp_redirect("https://foursquare.com/oauth2/authenticate/?client_id=" . $theChampLoginOptions['foursquare_client_id'] . "&response_type=code&state=". $foursquareLoginState ."&redirect_uri=" . home_url() . "/SuperSocializerAuth/Foursquare");
1188
- die;
1189
- }
1190
- }
1191
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) && remove_query_arg(array(
1192
- 'code', 'state'
1193
- ), esc_url_raw(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])) == home_url() . '/SuperSocializerAuth/Foursquare'){
1194
- $postData = array(
1195
- 'grant_type' => 'authorization_code',
1196
- 'code' => sanitize_text_field($_GET['code']),
1197
- 'redirect_uri' => home_url() . "/SuperSocializerAuth/Foursquare",
1198
- 'client_id' => $theChampLoginOptions['foursquare_client_id'],
1199
- 'client_secret' => $theChampLoginOptions['foursquare_client_secret']
1200
- );
1201
- $response = wp_remote_post("https://foursquare.com/oauth2/access_token", array(
1202
- 'timeout' => 15,
1203
- 'redirection' => 5,
1204
- 'httpversion' => '1.0',
1205
- 'sslverify' => false,
1206
- 'headers' => array(
1207
- 'Content-Type' => 'application/x-www-form-urlencoded',
1208
- 'Authorization' => 'Basic ' . base64_encode($theChampLoginOptions['foursquare_client_id'] . ':' . $theChampLoginOptions['foursquare_client_secret'])
1209
- ),
1210
- 'body' => http_build_query($postData)
1211
- ));
1212
-
1213
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1214
- $body = json_decode(wp_remote_retrieve_body($response));
1215
- $response = wp_remote_get("https://api.foursquare.com/v2/users/self?oauth_token=" . $body->access_token . "&v=" . rand(), array(
1216
- 'timeout' => 15,
1217
- 'headers' => array(
1218
- 'Authorization' => "Bearer " . $body->access_token
1219
- )
1220
- ));
1221
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1222
- $profileData = json_decode(wp_remote_retrieve_body($response));
1223
- if(is_object($profileData) && isset($profileData->response->user->id)){
1224
- $profileData = the_champ_sanitize_profile_data($profileData, 'foursquare');
1225
- $foursquareLoginState = sanitize_text_field($_GET['state']);
1226
- $foursquareRedirectUrl = get_user_meta($foursquareLoginState, 'super_socializer_redirect_to', true);
1227
- $response = the_champ_user_auth($profileData, 'foursquare', $foursquareRedirectUrl);
1228
- if($response == 'show form'){
1229
- return;
1230
- }
1231
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1232
- $redirectTo = the_champ_get_login_redirection_url($foursquareRedirectUrl, true);
1233
- } elseif(isset($response['message']) && $response['message'] == 'linked'){
1234
- $redirectTo = $foursquareRedirectUrl . (strpos($foursquareRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1235
- } elseif(isset($response['message']) && $response['message'] == 'not linked'){
1236
- $redirectTo = $foursquareRedirectUrl . (strpos($foursquareRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1237
- } elseif(isset($response['url']) && $response['url'] != ''){
1238
- $redirectTo = $response['url'];
1239
- } else {
1240
- $redirectTo = the_champ_get_login_redirection_url($foursquareRedirectUrl);
1241
- }
1242
- the_champ_close_login_popup($redirectTo);
1243
- }
1244
- }
1245
- }
1246
- }
1247
- // odnoklassniki
1248
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Odnoklassniki')){
1249
- if(isset($theChampLoginOptions['providers']) && in_array('odnoklassniki', $theChampLoginOptions['providers']) && $theChampLoginOptions['odnoklassniki_client_id'] && $theChampLoginOptions['odnoklassniki_client_secret']){
1250
- if(!isset($_GET['code'])){
1251
- $odnoklassnikiLoginState = mt_rand();
1252
- // save referrer url in state
1253
- update_user_meta($odnoklassnikiLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
1254
- }
1255
- wp_redirect("https://connect.ok.ru/oauth/authorize?client_id=" . $theChampLoginOptions['odnoklassniki_client_id'] . "&scope=GET_EMAIL%20PHOTO_CONTENT&response_type=code&state=" . $odnoklassnikiLoginState . "&redirect_uri=" . urlencode(home_url()."/SuperSocializerAuth/Odnoklassniki"));
1256
- die;
1257
  }
1258
- }
1259
 
1260
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) && remove_query_arg(array('code', 'scope', 'state'), esc_url_raw(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])) == home_url() . '/SuperSocializerAuth/Odnoklassniki'){
1261
- $postData = array(
1262
- 'grant_type' => 'authorization_code',
1263
- 'code' => sanitize_text_field($_GET['code']),
1264
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Odnoklassniki",
1265
- 'client_id' => $theChampLoginOptions['odnoklassniki_client_id'],
1266
- 'client_secret' => $theChampLoginOptions['odnoklassniki_client_secret']
1267
- );
1268
- $response = wp_remote_post("https://api.ok.ru/oauth/token.do", array(
1269
  'method' => 'POST',
1270
  'timeout' => 15,
1271
  'redirection' => 5,
@@ -1273,648 +1128,820 @@ function the_champ_connect(){
1273
  'sslverify' => false,
1274
  'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1275
  'body' => http_build_query($postData)
1276
- )
1277
- );
1278
-
1279
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1280
- $body = json_decode(wp_remote_retrieve_body($response));
1281
- $authorization = "Bearer " . $body->access_token;
1282
-
1283
- $response = wp_remote_get("https://api.ok.ru/fb.do?application_key=" . $theChampLoginOptions['odnoklassniki_public_key'] . "&format=json&method=users.getCurrentUser&sig=" . mt_rand() . "&access_token=" . $body->access_token, array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization)));
1284
-
1285
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1286
- $profileData = json_decode(wp_remote_retrieve_body($response));
1287
-
1288
- if(is_object($profileData) && isset($profileData->uid)){
1289
- $profileData = the_champ_sanitize_profile_data($profileData, 'odnoklassniki');
1290
- $odnoklassnikiLoginState = sanitize_text_field($_GET['state']);
1291
- $odnoklassnikiRedirectUrl = get_user_meta($odnoklassnikiLoginState, 'super_socializer_redirect_to', true);
1292
- $response = the_champ_user_auth($profileData, 'odnoklassniki', $odnoklassnikiRedirectUrl);
1293
- if($response == 'show form'){
1294
- return;
1295
- }
1296
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1297
- $redirectTo = the_champ_get_login_redirection_url($odnoklassnikiRedirectUrl, true);
1298
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
1299
- $redirectTo = $odnoklassnikiRedirectUrl . (strpos($odnoklassnikiRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1300
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1301
- $redirectTo = $odnoklassnikiRedirectUrl . (strpos($odnoklassnikiRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1302
- }elseif(isset($response['url']) && $response['url'] != ''){
1303
- $redirectTo = $response['url'];
1304
- }else{
1305
- $redirectTo = the_champ_get_login_redirection_url($odnoklassnikiRedirectUrl);
 
 
 
 
 
 
 
 
1306
  }
1307
- the_champ_close_login_popup($redirectTo);
1308
- }
1309
- }
1310
- }
1311
- }
1312
- // Dribbble
1313
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Dribbble')){
1314
- if(isset($theChampLoginOptions['providers']) && in_array('dribbble', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['dribbble_client_id']) && $theChampLoginOptions['dribbble_client_id'] != '' && isset($theChampLoginOptions['dribbble_client_secret']) && $theChampLoginOptions['dribbble_client_secret'] != ''){
1315
- if(!isset($_GET['code'])){
1316
- $dribbbleLoginState = mt_rand();
1317
- // save referrer url in state
1318
- update_user_meta($dribbbleLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
1319
- }
1320
- wp_redirect("https://dribbble.com/oauth/authorize?client_id=".$theChampLoginOptions['dribbble_client_id']."&scope=public&state=". $dribbbleLoginState ."&redirect_uri=".urlencode(home_url()."/SuperSocializerAuth/Dribbble"));
1321
- die;
1322
  }
1323
- }
1324
-
1325
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) && remove_query_arg(array('code','scope', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Dribbble'){
1326
- $postData = array(
1327
- 'grant_type' => 'authorization_code',
1328
- 'code' => sanitize_text_field($_GET['code']),
1329
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Dribbble",
1330
- 'client_id' => $theChampLoginOptions['dribbble_client_id'],
1331
- 'client_secret' => $theChampLoginOptions['dribbble_client_secret']
1332
- );
1333
- $response = wp_remote_post("https://dribbble.com/oauth/token", array(
1334
- 'method' => 'POST',
1335
- 'timeout' => 15,
1336
- 'redirection' => 5,
1337
- 'httpversion' => '1.0',
1338
- 'sslverify' => false,
1339
- 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1340
- 'body' => http_build_query($postData)
1341
- )
1342
- );
1343
-
1344
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1345
- $body = json_decode(wp_remote_retrieve_body($response));
1346
- $authorization = "Bearer ".$body->access_token;
1347
-
1348
- $response = wp_remote_get("https://api.dribbble.com/v2/user?access_token", array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization )));
1349
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1350
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1351
- $profileData = json_decode(wp_remote_retrieve_body($response));
1352
- if(is_object($profileData) && isset($profileData->id)){
1353
- $profileData = the_champ_sanitize_profile_data($profileData, 'dribbble');
1354
- $dribbbleLoginState = sanitize_text_field($_GET['state']);
1355
- $dribbbleRedirectUrl = get_user_meta($dribbbleLoginState, 'super_socializer_redirect_to', true);
1356
- $response = the_champ_user_auth($profileData, 'dribbble', $dribbbleRedirectUrl);
1357
- if($response == 'show form'){
1358
- return;
1359
- }
1360
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1361
- $redirectTo = the_champ_get_login_redirection_url($dribbbleRedirectUrl, true);
1362
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
1363
- $redirectTo = $dribbbleRedirectUrl . (strpos($dribbbleRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1364
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1365
- $redirectTo = $dribbbleRedirectUrl . (strpos($dribbbleRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1366
- }elseif(isset($response['url']) && $response['url'] != ''){
1367
- $redirectTo = $response['url'];
1368
- }else{
1369
- $redirectTo = the_champ_get_login_redirection_url($dribbbleRedirectUrl);
1370
- }
1371
- the_champ_close_login_popup($redirectTo);
1372
- }
1373
- }
1374
- }
1375
- }
1376
 
1377
- // yandex
1378
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Yandex')){
1379
- if(isset($theChampLoginOptions['providers']) && in_array('yandex', $theChampLoginOptions['providers']) && $theChampLoginOptions['yandex_client_id'] && $theChampLoginOptions['yandex_client_secret']){
1380
- if(!isset($_GET['code'])){
1381
- $yandexLoginState = mt_rand();
1382
- // save referrer url in state
1383
- update_user_meta($yandexLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
1384
- }
1385
- wp_redirect("https://oauth.yandex.com/authorize?client_id=" . $theChampLoginOptions['yandex_client_id'] . "&response_type=code&state=" . $yandexLoginState . "&redirect_uri=".urlencode(home_url() . "/SuperSocializerAuth/Yandex"));
1386
- die;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1387
  }
1388
- }
1389
 
1390
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) && remove_query_arg(array('code', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Yandex'){
1391
- $postData = array(
1392
- 'grant_type' => 'authorization_code',
1393
- 'code' => sanitize_text_field($_GET['code']),
1394
- 'state' => sanitize_text_field($_GET['state']),
1395
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Yandex",
1396
- 'client_id' => $theChampLoginOptions['yandex_client_id'],
1397
- 'client_secret' => $theChampLoginOptions['yandex_client_secret']
1398
- );
1399
- $response = wp_remote_post("https://oauth.yandex.com/token", array(
1400
- 'method' => 'POST',
1401
- 'timeout' => 15,
1402
- 'redirection' => 5,
1403
- 'httpversion' => '1.0',
1404
- 'sslverify' => false,
1405
- 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1406
- 'body' => http_build_query($postData)
1407
- )
1408
- );
1409
-
1410
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1411
- $body = json_decode(wp_remote_retrieve_body($response));
1412
- $authorization = "Bearer ".$body->access_token;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1413
 
1414
- $response = wp_remote_get("https://login.yandex.ru/info", array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization )));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1415
 
1416
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1417
- $profileData = json_decode(wp_remote_retrieve_body($response));
1418
- if(is_object($profileData) && isset($profileData->id)){
1419
- $profileData = the_champ_sanitize_profile_data($profileData, 'yandex');
1420
- $yandexLoginState = sanitize_text_field($_GET['state']);
1421
- $yandexRedirectUrl = get_user_meta($yandexLoginState, 'super_socializer_redirect_to', true);
1422
- $response = the_champ_user_auth($profileData, 'yandex', $yandexRedirectUrl);
1423
- if($response == 'show form'){
1424
- return;
1425
- }
1426
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1427
- $redirectTo = the_champ_get_login_redirection_url($yandexRedirectUrl, true);
1428
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
1429
- $redirectTo = $yandexRedirectUrl . (strpos($yandexRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1430
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1431
- $redirectTo = $yandexRedirectUrl . (strpos($yandexRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1432
- }elseif(isset($response['url']) && $response['url'] != ''){
1433
- $redirectTo = $response['url'];
1434
- }else{
1435
- $redirectTo = the_champ_get_login_redirection_url($yandexRedirectUrl);
1436
- }
1437
- the_champ_close_login_popup($redirectTo);
1438
- }
1439
- }
1440
- }
1441
- }
1442
 
 
1443
 
1444
- // Spotify
1445
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Spotify')){
1446
- if(isset($theChampLoginOptions['providers']) && in_array('spotify', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['spotify_client_id']) && $theChampLoginOptions['spotify_client_id'] != '' && isset($theChampLoginOptions['spotify_client_secret']) && $theChampLoginOptions['spotify_client_secret'] != ''){
1447
- if(!isset($_GET['code'])){
1448
- $spotifyLoginState = mt_rand();
1449
- // save referrer url in state
1450
- update_user_meta($spotifyLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
1451
- }
1452
- wp_redirect("https://accounts.spotify.com/authorize?client_id=".$theChampLoginOptions['spotify_client_id']."&scope=user-read-email&response_type=code&state=". $spotifyLoginState ."&redirect_uri=".home_url()."/SuperSocializerAuth/Spotify");
1453
- die;
1454
- }
1455
- }
1456
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) && remove_query_arg(array('code', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Spotify'){
1457
- $postData = array(
1458
- 'grant_type' => 'authorization_code',
1459
- 'code' => sanitize_text_field($_GET['code']),
1460
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Spotify",
1461
- 'client_id' => $theChampLoginOptions['spotify_client_id'],
1462
- 'client_secret' => $theChampLoginOptions['spotify_client_secret']
1463
- );
1464
- $response = wp_remote_post("https://accounts.spotify.com/api/token", array(
1465
- 'method' => 'POST',
1466
- 'timeout' => 15,
1467
- 'redirection' => 5,
1468
- 'httpversion' => '1.0',
1469
- 'sslverify' => false,
1470
- 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1471
- 'body' => http_build_query($postData)
1472
- )
1473
- );
1474
-
1475
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1476
- $body = json_decode(wp_remote_retrieve_body($response));
1477
- if(isset($body->access_token)){
1478
- $authorization = "Bearer ".$body->access_token;
1479
- $response = wp_remote_get('https://api.spotify.com/v1/me', array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization)));
1480
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1481
  $profileData = json_decode(wp_remote_retrieve_body($response));
1482
- if(is_object($profileData) && isset($profileData->id)){
1483
- $profileData = the_champ_sanitize_profile_data($profileData, 'spotify');
1484
- $spotifyLoginState = sanitize_text_field($_GET['state']);
1485
- $spotifyRedirectUrl = get_user_meta($spotifyLoginState, 'super_socializer_redirect_to', true);
1486
- $response = the_champ_user_auth($profileData, 'spotify', $spotifyRedirectUrl);
 
1487
  if($response == 'show form'){
1488
  return;
1489
  }
1490
  if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1491
- $redirectTo = the_champ_get_login_redirection_url($liveRedirectUrl, true);
1492
  }elseif(isset($response['message']) && $response['message'] == 'linked'){
1493
- $redirectTo = $spotifyRedirectUrl . (strpos($spotifyRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1494
  }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1495
- $redirectTo = $spotifyRedirectUrl . (strpos($spotifyRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1496
  }elseif(isset($response['url']) && $response['url'] != ''){
1497
  $redirectTo = $response['url'];
1498
  }else{
1499
- $redirectTo = the_champ_get_login_redirection_url($spotifyRedirectUrl);
1500
  }
1501
  the_champ_close_login_popup($redirectTo);
1502
- }
1503
  }
1504
  }
1505
  }
1506
- }
1507
 
1508
- //kakao
1509
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Kakao')){
1510
- if(isset($theChampLoginOptions['providers']) && in_array('kakao', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['kakao_client_id']) && $theChampLoginOptions['kakao_client_id'] != '' && isset($theChampLoginOptions['kakao_client_secret']) && $theChampLoginOptions['kakao_client_secret'] != ''){
1511
- if(!isset($_GET['code'])){
1512
- $kakaoLoginState = mt_rand();
1513
- // save referrer url in state
1514
- update_user_meta($kakaoLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
1515
- }
1516
- wp_redirect("https://kauth.kakao.com/oauth/authorize?client_id=".$theChampLoginOptions['kakao_client_id']."&response_type=code&state=". $kakaoLoginState ."&redirect_uri=".home_url()."/SuperSocializerAuth/Kakao");
1517
- die;
1518
- }
1519
- }
1520
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) && remove_query_arg(array('code','state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Kakao'){
1521
- $postData = array(
1522
- 'grant_type' => 'authorization_code',
1523
- 'code' => sanitize_text_field($_GET['code']),
1524
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Kakao",
1525
- 'client_id' => $theChampLoginOptions['kakao_client_id'],
1526
- 'client_secret' => $theChampLoginOptions['kakao_client_secret']
1527
- );
1528
- $response = wp_remote_post("https://kauth.kakao.com/oauth/token", array(
1529
- 'method' => 'POST',
1530
- 'timeout' => 15,
1531
- 'redirection' => 5,
1532
- 'httpversion' => '1.0',
1533
- 'sslverify' => false,
1534
- 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1535
- 'body' => http_build_query($postData)
1536
- )
1537
- );
1538
-
1539
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1540
- $body = json_decode(wp_remote_retrieve_body($response));
1541
- if(isset($body->access_token)){
1542
  $authorization = "Bearer ".$body->access_token;
1543
- $response = wp_remote_get('https://kapi.kakao.com/v2/user/me', array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization)));
 
 
1544
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1545
  $profileData = json_decode(wp_remote_retrieve_body($response));
1546
- if(is_object($profileData) && isset($profileData->id)){
1547
- $profileData = the_champ_sanitize_profile_data($profileData, 'kakao');
1548
- $kakaoLoginState = sanitize_text_field($_GET['state']);
1549
- $kakaoRedirectUrl = get_user_meta($kakaoLoginState, 'super_socializer_redirect_to', true);
1550
- $response = the_champ_user_auth($profileData, 'kakao', $kakaoRedirectUrl);
1551
  if($response == 'show form'){
1552
  return;
1553
  }
1554
  if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1555
- $redirectTo = the_champ_get_login_redirection_url($kakaoRedirectUrl, true);
1556
  }elseif(isset($response['message']) && $response['message'] == 'linked'){
1557
- $redirectTo = $kakaoRedirectUrl . (strpos($kakaoRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1558
  }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1559
- $redirectTo = $kakaoRedirectUrl . (strpos($kakaoRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1560
  }elseif(isset($response['url']) && $response['url'] != ''){
1561
  $redirectTo = $response['url'];
1562
  }else{
1563
- $redirectTo = the_champ_get_login_redirection_url($kakaoRedirectUrl);
1564
  }
1565
  the_champ_close_login_popup($redirectTo);
1566
- }
1567
  }
1568
  }
1569
  }
1570
- }
1571
 
1572
- // Github
1573
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Github')){
1574
- if(isset($theChampLoginOptions['providers']) && in_array('github', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['github_client_id']) && $theChampLoginOptions['github_client_id'] != '' && isset($theChampLoginOptions['github_client_secret']) && $theChampLoginOptions['github_client_secret'] != ''){
1575
- if(!isset($_GET['code'])){
1576
- $githubLoginState = mt_rand();
1577
- // save referrer url in state
1578
- update_user_meta($githubLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
1579
- }
1580
- wp_redirect("https://github.com/login/oauth/authorize?client_id=".$theChampLoginOptions['github_client_id']."&scope=read:user user:email&state=". $githubLoginState ."&response_type=code&redirect_uri=".home_url()."/SuperSocializerAuth/Github");
1581
- die;
1582
- }
1583
- }
1584
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) && remove_query_arg(array('code','state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Github'){
1585
- $postData = array(
1586
- 'state' => 'state',
1587
- 'code' => sanitize_text_field($_GET['code']),
1588
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Github",
1589
- 'client_id' => $theChampLoginOptions['github_client_id'],
1590
- 'client_secret' => $theChampLoginOptions['github_client_secret']
1591
- );
1592
- $response = wp_remote_post("https://github.com/login/oauth/access_token", array(
1593
- 'method' => 'POST',
1594
- 'timeout' => 15,
1595
- 'redirection' => 5,
1596
- 'httpversion' => '1.0',
1597
- 'sslverify' => false,
1598
- 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => 'Basic ' . base64_encode($theChampLoginOptions['github_client_id'] . ':' . $theChampLoginOptions['github_client_secret'])),
1599
- 'body' => $postData
1600
- )
1601
- );
1602
-
1603
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1604
- $body = wp_remote_retrieve_body($response);
1605
- $bodyParts = explode('&', $body);
1606
- $accessTokenParts = explode('=', $bodyParts[0]);
1607
 
1608
- if(count($accessTokenParts) == 2){
1609
- $authorization = "token ".$accessTokenParts[1];
1610
- $response = wp_remote_get('https://api.github.com/user', array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization)));
 
 
 
1611
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1612
  $profileData = json_decode(wp_remote_retrieve_body($response));
1613
  if(is_object($profileData) && isset($profileData->id)){
1614
- $emailsResponse = wp_remote_get('https://api.github.com/user/emails', array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization)));
1615
- if(!is_wp_error($emailsResponse) && isset($emailsResponse['response']['code']) && 200 === $emailsResponse['response']['code']){
1616
- $emails = json_decode(wp_remote_retrieve_body($emailsResponse ));
1617
- if(is_array($emails)){
1618
- foreach($emails as $email){
1619
- if(isset($email->primary) && isset($email->verified) && $email->primary == 1 && $email->verified == 1 && !empty($email->email)){
1620
- $profileData = (array)$profileData;
1621
- $profileData['email'] = $email->email;
1622
- $profileData = (object)$profileData;
1623
- break;
1624
- }
1625
- }
1626
- }
1627
- $profileData = the_champ_sanitize_profile_data($profileData, 'github');
1628
- $githubLoginState = sanitize_text_field($_GET['state']);
1629
- $githubRedirectUrl = get_user_meta($githubLoginState, 'super_socializer_redirect_to', true);
1630
- $response = the_champ_user_auth($profileData, 'github', $githubRedirectUrl);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1631
  if($response == 'show form'){
1632
  return;
1633
  }
1634
  if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1635
- $redirectTo = the_champ_get_login_redirection_url($githubRedirectUrl, true);
1636
  }elseif(isset($response['message']) && $response['message'] == 'linked'){
1637
- $redirectTo = $githubRedirectUrl . (strpos($githubRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1638
  }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1639
- $redirectTo = $githubRedirectUrl . (strpos($githublRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1640
  }elseif(isset($response['url']) && $response['url'] != ''){
1641
  $redirectTo = $response['url'];
1642
  }else{
1643
- $redirectTo = the_champ_get_login_redirection_url($githubRedirectUrl);
1644
  }
1645
  the_champ_close_login_popup($redirectTo);
1646
  }
1647
- }
1648
- }
1649
- }
1650
- }
1651
- }
1652
-
1653
- // Facebook
1654
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Facebook')){
1655
- if(isset($theChampLoginOptions['providers']) && in_array('facebook', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['fb_key']) && $theChampLoginOptions['fb_key'] != '' && isset($theChampLoginOptions['fb_secret']) && $theChampLoginOptions['fb_secret'] != ''){
1656
- if(!isset($_GET['code'])){
1657
- $facebookLoginState = mt_rand();
1658
- // save referrer url in state
1659
- update_user_meta($facebookLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
1660
- wp_redirect("https://www.facebook.com/v10.0/dialog/oauth?scope=email&client_id=" . $theChampLoginOptions['fb_key'] . "&state=" . $facebookLoginState . "&redirect_uri=" . home_url() . "/?SuperSocializerAuth=Facebook");
1661
- die;
1662
- }elseif(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false){
1663
- $postData = array(
1664
- 'code' => sanitize_text_field($_GET['code']),
1665
- 'redirect_uri' => home_url() . "/?SuperSocializerAuth=Facebook",
1666
- 'client_id' => $theChampLoginOptions['fb_key'],
1667
- 'client_secret' => $theChampLoginOptions['fb_secret']
1668
- );
1669
- $response = wp_remote_post("https://graph.facebook.com/v10.0/oauth/access_token", array(
1670
- 'method' => 'POST',
1671
- 'timeout' => 15,
1672
- 'redirection' => 5,
1673
- 'httpversion' => '1.0',
1674
- 'sslverify' => false,
1675
- 'headers' => array(
1676
- 'Content-Type' => 'application/x-www-form-urlencoded'
1677
- ),
1678
- 'body' => http_build_query($postData)
1679
- ));
1680
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1681
- $body = json_decode(wp_remote_retrieve_body($response));
1682
- if(!empty($body->access_token)){
1683
- $response = wp_remote_get("https://graph.facebook.com/me?fields=id,name,about,link,email,first_name,last_name,picture.width(60).height(60).as(picture_small),picture.width(320).height(320).as(picture_large)&access_token=" . $body->access_token, array(
1684
- 'timeout' => 15
1685
- ));
1686
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1687
- $profileData = json_decode(wp_remote_retrieve_body($response));
1688
- if(is_object($profileData) && isset($profileData->id)){
1689
- $profileData = the_champ_sanitize_profile_data($profileData, 'facebook');
1690
- $facebookLoginState = sanitize_text_field($_GET['state']);
1691
- $facebook_redirect_url = get_user_meta($facebookLoginState, 'super_socializer_redirect_to', true);
1692
- delete_user_meta($facebookLoginState, 'super_socializer_redirect_to');
1693
- $response = the_champ_user_auth($profileData, 'faceboook', $facebook_redirect_url);
1694
- if($response == 'show form'){
1695
- return;
1696
- }
1697
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1698
- $redirectTo = the_champ_get_login_redirection_url($facebook_redirect_url, true);
1699
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
1700
- $redirectTo = $facebook_redirect_url . (strpos($facebook_redirect_url, '?') !== false ? '&' : '?') . 'linked=1';
1701
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1702
- $redirectTo = $facebook_redirect_url . (strpos($facebook_redirect_url, '?') !== false ? '&' : '?') . 'linked=0';
1703
- }elseif(isset($response['url']) && $response['url'] != ''){
1704
- $redirectTo = $response['url'];
1705
- }else{
1706
- $redirectTo = the_champ_get_login_redirection_url($facebook_redirect_url);
1707
- }
1708
- the_champ_close_login_popup($redirectTo);
1709
- }
1710
- }
1711
- }
1712
- }
1713
- }
1714
- }
1715
- }
1716
-
1717
- //amazon
1718
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Amazon')){
1719
- if(isset($theChampLoginOptions['providers']) && in_array('amazon', $theChampLoginOptions['providers']) && $theChampLoginOptions['amazon_client_id'] && $theChampLoginOptions['amazon_client_secret']){
1720
- if(!isset($_GET['code'])){
1721
- $amazonLoginState = mt_rand();
1722
- // save referrer url in state
1723
- update_user_meta($amazonLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
1724
  }
1725
- wp_redirect("https://www.amazon.com/ap/oa?client_id=".$theChampLoginOptions['amazon_client_id']."&response_type=code&scope=profile&state=".$amazonLoginState."&redirect_uri=".urlencode(home_url()."/SuperSocializerAuth/Amazon"));
1726
- die;
1727
  }
1728
- }
1729
- if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) && remove_query_arg(array('code','scope', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Amazon'){
1730
- $postData = array(
1731
- 'grant_type' => 'authorization_code',
1732
- 'code' => sanitize_text_field($_GET['code']),
1733
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Amazon",
1734
- 'client_id' => $theChampLoginOptions['amazon_client_id'],
1735
- 'client_secret' => $theChampLoginOptions['amazon_client_secret']
1736
- );
1737
- $response = wp_remote_post("https://api.amazon.com/auth/o2/token", array(
1738
- 'method' => 'POST',
1739
- 'timeout' => 15,
1740
- 'redirection' => 5,
1741
- 'httpversion' => '1.0',
1742
- 'sslverify' => false,
1743
- 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1744
- 'body' => http_build_query($postData)
1745
- )
1746
- );
1747
-
1748
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1749
- $body = json_decode(wp_remote_retrieve_body($response));
1750
- $authorization = "Bearer ".$body->access_token;
1751
- $response = wp_remote_get("https://api.amazon.com/user/profile", array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization )));
1752
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1753
- $profileData = json_decode(wp_remote_retrieve_body($response));
1754
- if(is_object($profileData) && isset($profileData->user_id)){
1755
- $profileData = the_champ_sanitize_profile_data($profileData, 'amazon');
1756
- $amazonLoginState = sanitize_text_field($_GET['state']);
1757
- $amazonRedirectUrl = get_user_meta($amazonLoginState, 'super_socializer_redirect_to', true);
1758
- $response = the_champ_user_auth($profileData, 'amazon', $amazonRedirectUrl);
1759
- if($response == 'show form'){
1760
- return;
1761
- }
1762
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1763
- $redirectTo = the_champ_get_login_redirection_url($amazonRedirectUrl, true);
1764
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
1765
- $redirectTo = $amazonRedirectUrl . (strpos($amazonRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1766
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1767
- $redirectTo = $amazonRedirectUrl . (strpos($amazonRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1768
- }elseif(isset($response['url']) && $response['url'] != ''){
1769
- $redirectTo = $response['url'];
1770
- }else{
1771
- $redirectTo = the_champ_get_login_redirection_url($amazonRedirectUrl);
 
 
 
 
 
 
 
 
1772
  }
1773
- the_champ_close_login_popup($redirectTo);
1774
- }
1775
  }
1776
- }
1777
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1778
 
1779
- // Stack Overflow
1780
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Stackoverflow')){
1781
- if(isset($theChampLoginOptions['providers']) && in_array('stackoverflow', $theChampLoginOptions['providers']) && $theChampLoginOptions['stackoverflow_client_id'] && $theChampLoginOptions['stackoverflow_client_secret'] && $theChampLoginOptions['stackoverflow_key']){
1782
- if(!isset($_GET['code'])){
1783
- $stackoverflowLoginState = mt_rand();
1784
- // save referrer url in state
1785
- update_user_meta($stackoverflowLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1786
  }
1787
- wp_redirect("https://stackexchange.com/oauth?client_id=".$theChampLoginOptions['stackoverflow_client_id']."&response_type=code&scope=private_info&state=".$stackoverflowLoginState."&redirect_uri=".urlencode(home_url()."/SuperSocializerAuth/Stackoverflow"));
1788
- die;
1789
  }
1790
- }
1791
- if(isset($_GET['code']) && isset($_GET['state']) && remove_query_arg(array('code','scope','state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Stackoverflow'){
1792
- $postData = array(
1793
- 'grant_type' => 'authorization_code',
1794
- 'code' => sanitize_text_field($_GET['code']),
1795
- 'redirect_uri' => home_url()."/SuperSocializerAuth/Stackoverflow",
1796
- 'client_id' => $theChampLoginOptions['stackoverflow_client_id'],
1797
- 'client_secret' => $theChampLoginOptions['stackoverflow_client_secret']
1798
- );
1799
- $response = wp_remote_post("https://stackexchange.com/oauth/access_token", array(
1800
- 'method' => 'POST',
1801
- 'timeout' => 15,
1802
- 'redirection' => 5,
1803
- 'httpversion' => '1.0',
1804
- 'sslverify' => false,
1805
- 'headers' => array(
1806
- 'Content-Type' => 'application/x-www-form-urlencoded',
1807
- 'Authorization' => 'Basic ' .base64_encode($theChampLoginOptions['stackoverflow_client_id']. ':' .$theChampLoginOptions['stackoverflow_client_secret'])
1808
- ),
1809
- 'body' => http_build_query($postData)
1810
- ));
1811
-
1812
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1813
- $body = wp_remote_retrieve_body($response);
1814
- $k = explode('&', $body);
1815
- $r = explode('=', $k[0]);
1816
- $response = wp_remote_get("https://api.stackexchange.com/2.2/me?site=stackoverflow&access_token=".$r[1]."&key=".$theChampLoginOptions['stackoverflow_key'], array(
1817
- 'timeout' => 15,
1818
- 'headers' => array('content-type' =>'application/json')
1819
- ));
1820
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1821
- $profileData = json_decode(wp_remote_retrieve_body($response));
1822
- if(is_object($profileData) && isset($profileData->items[0]->account_id)){
1823
- $profileData = the_champ_sanitize_profile_data($profileData->items[0], 'stackoverflow');
1824
- $stackoverflowLoginState = sanitize_text_field($_GET['state']);
1825
- $stackoverflowRedirectUrl = get_user_meta($stackoverflowLoginState, 'super_socializer_redirect_to', true);
1826
- $response = the_champ_user_auth($profileData, 'stackoverflow', $stackoverflowRedirectUrl);
1827
- if($response == 'show form'){
1828
- return;
1829
- }
1830
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1831
- $redirectTo = the_champ_get_login_redirection_url($stackoverflowRedirectUrl, true);
1832
- }elseif(isset($response['message']) && $response['message'] == 'linked'){
1833
- $redirectTo = $stackoverflowRedirectUrl . (strpos($stackoverflowRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1834
- }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1835
- $redirectTo = $stackoverflowRedirectUrl . (strpos($stackoverflowRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1836
- }elseif(isset($response['url']) && $response['url'] != ''){
1837
- $redirectTo = $response['url'];
1838
- }else{
1839
- $redirectTo = the_champ_get_login_redirection_url($stackoverflowRedirectUrl);
1840
- }
1841
- the_champ_close_login_popup($redirectTo);
1842
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1843
  }
1844
  }
1845
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1846
 
1847
- // Google
1848
- if(isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Google'){
1849
- if(isset($theChampLoginOptions['providers']) && in_array('google', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['google_key']) && $theChampLoginOptions['google_key'] != '' && isset($theChampLoginOptions['google_secret']) && $theChampLoginOptions['google_secret'] != ''){
1850
- $googleLoginState = mt_rand();
1851
- // save referrer url in state
1852
- update_user_meta($googleLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url());
1853
- wp_redirect("https://accounts.google.com/o/oauth2/auth?client_id=" . $theChampLoginOptions['google_key'] . "&scope=https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile&state=". $googleLoginState ."&response_type=code&prompt=select_account&redirect_uri=" . home_url());
1854
- die;
1855
- }
1856
- }
1857
- if(isset($_GET['code']) && isset($_GET['state'])){
1858
- if(get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false){
1859
- $postData = array(
1860
- 'grant_type' => 'authorization_code',
1861
- 'code' => sanitize_text_field($_GET['code']),
1862
- 'redirect_uri' => home_url(),
1863
- 'client_id' => $theChampLoginOptions['google_key'],
1864
- 'client_secret' => $theChampLoginOptions['google_secret']
1865
- );
1866
- $response = wp_remote_post("https://accounts.google.com/o/oauth2/token", array(
1867
- 'method' => 'POST',
1868
- 'timeout' => 15,
1869
- 'redirection' => 5,
1870
- 'httpversion' => '1.0',
1871
- 'sslverify' => false,
1872
- 'headers' => array(
1873
- 'Content-Type' => 'application/x-www-form-urlencoded'
1874
- ),
1875
- 'body' => http_build_query($postData)
1876
- ));
1877
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1878
- $body = json_decode(wp_remote_retrieve_body($response));
1879
- if(isset($body->access_token)){
1880
- $authorization = "Bearer " . $body->access_token;
1881
- $response = wp_remote_get('https://www.googleapis.com/oauth2/v3/userinfo', array(
1882
- 'timeout' => 15,
1883
- 'headers' => array(
1884
- 'Accept' => 'application/json',
1885
- 'Authorization' => $authorization
1886
- )
1887
- ));
1888
- if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1889
- $profileData = json_decode(wp_remote_retrieve_body($response));
1890
- if(is_object($profileData) && isset($profileData->sub)){
1891
- $profileData = the_champ_sanitize_profile_data($profileData, 'google');
1892
- $googleLoginState = sanitize_text_field($_GET['state']);
1893
- $googleRedirectUrl = get_user_meta($googleLoginState, 'super_socializer_redirect_to', true);
1894
- $response = the_champ_user_auth($profileData, 'google', $googleRedirectUrl);
1895
- if($response == 'show form'){
1896
- return;
1897
- }
1898
- if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1899
- $redirectTo = the_champ_get_login_redirection_url($googleRedirectUrl, true);
1900
- } elseif(isset($response['message']) && $response['message'] == 'linked'){
1901
- $redirectTo = $googleRedirectUrl . (strpos($googleRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1902
- } elseif(isset($response['message']) && $response['message'] == 'not linked'){
1903
- $redirectTo = $googleRedirectUrl . (strpos($googleRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1904
- } elseif(isset($response['url']) && $response['url'] != ''){
1905
- $redirectTo = $response['url'];
1906
- } else {
1907
- $redirectTo = the_champ_get_login_redirection_url($googleRedirectUrl);
1908
- }
1909
- the_champ_close_login_popup($redirectTo);
1910
- }
1911
- }
1912
- }
1913
- }
1914
- }
1915
- }
1916
- // Vkontakte
1917
- if((isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Vkontakte') || (isset($_GET['code']) && !isset($_GET['SuperSocializerAuth']))){
1918
  if(function_exists('session_start')){
1919
  if(session_status() == PHP_SESSION_NONE){
1920
  session_start();
@@ -1927,20 +1954,6 @@ function the_champ_connect(){
1927
  'redirect_uri' => home_url()
1928
  ));
1929
  $heateorSsVkontakte->setScope(array('email'));
1930
- }
1931
- if(isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Vkontakte'){
1932
- if(isset($theChampLoginOptions['providers']) && in_array('vkontakte', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['vk_key']) && $theChampLoginOptions['vk_key'] != '' && isset($theChampLoginOptions['vk_secure_key']) && $theChampLoginOptions['vk_secure_key'] != ''){
1933
- if(function_exists('session_start')){
1934
- if(session_status() == PHP_SESSION_NONE){
1935
- session_start();
1936
- }
1937
- }
1938
- $_SESSION['super_socializer_vkontakte_redirect'] = isset($_GET['super_socializer_redirect_to']) ? sanitize_url($_GET['super_socializer_redirect_to']) : home_url();
1939
- wp_redirect($heateorSsVkontakte->getLoginUrl());
1940
- die;
1941
- }
1942
- }
1943
- if(isset($_GET['code']) && !isset($_GET['SuperSocializerAuth'])){
1944
  if(isset($heateorSsVkontakte)){
1945
  $heateorSsVkontakte->authenticate($_GET['code']);
1946
  $userId = $heateorSsVkontakte->getUserId();
@@ -1982,54 +1995,6 @@ function the_champ_connect(){
1982
  }
1983
  }
1984
  }
1985
- // send request to twitter
1986
- if(isset($_GET['SuperSocializerAuth']) && sanitize_text_field($_GET['SuperSocializerAuth']) == 'Twitter' && !isset($_REQUEST['oauth_token'])){
1987
- if(isset($theChampLoginOptions['twitter_key']) && $theChampLoginOptions['twitter_key'] != '' && isset($theChampLoginOptions['twitter_secret']) && $theChampLoginOptions['twitter_secret'] != ''){
1988
- if(!function_exists('curl_init')){
1989
- ?>
1990
- <div style="width: 500px; margin: 0 auto">
1991
- <?php _e('cURL is not enabled at your website server. Please contact your website server administrator to enable it.', 'super-socializer') ?>
1992
- </div>
1993
- <?php
1994
- die;
1995
- }
1996
- /* Build TwitterOAuth object with client credentials. */
1997
- $connection = new Abraham\TwitterOAuth\TwitterOAuth($theChampLoginOptions['twitter_key'], $theChampLoginOptions['twitter_secret']);
1998
- $requestToken = $connection->oauth('oauth/request_token', ['oauth_callback' => esc_url(home_url())]);
1999
- /* Get temporary credentials. */
2000
- //$requestToken = $connection->getRequestToken(esc_url(home_url()));
2001
- if($connection->getLastHttpCode() == 200){
2002
- // generate unique ID
2003
- $uniqueId = mt_rand();
2004
- // save oauth token and secret in db temporarily
2005
- update_user_meta($uniqueId, 'thechamp_twitter_oauthtoken', $requestToken['oauth_token']);
2006
- update_user_meta($uniqueId, 'thechamp_twitter_oauthtokensecret', $requestToken['oauth_token_secret']);
2007
- if(isset($_GET['heateorMSEnabled'])){
2008
- update_user_meta($uniqueId, 'thechamp_mc_subscribe', '1');
2009
- }
2010
- if(isset($_GET['super_socializer_redirect_to']) && heateor_ss_validate_url($_GET['super_socializer_redirect_to']) !== false){
2011
- update_user_meta($uniqueId, 'thechamp_twitter_redirect', sanitize_url($_GET['super_socializer_redirect_to']));
2012
- }
2013
- wp_redirect($connection->url('oauth/authorize', ['oauth_token' => $requestToken['oauth_token']]));
2014
- die;
2015
- }else{
2016
- ?>
2017
- <div style="width: 500px; margin: 0 auto">
2018
- <ol>
2019
- <li><?php echo sprintf(__('Enter exactly the following url in <strong>Website</strong> option in your Twitter app (see step 3 %s)', 'super-socializer'), '<a target="_blank" href="http://support.heateor.com/how-to-get-twitter-api-key-and-secret/">here</a>') ?><br/>
2020
- <?php echo esc_url(home_url()) ?>
2021
- </li>
2022
- <li><?php echo sprintf(__('Enter exactly the following url in <strong>Callback URLs</strong> option in your Twitter app (see step 3 %s)', 'super-socializer'), '<a target="_blank" href="http://support.heateor.com/how-to-get-twitter-api-key-and-secret/">here</a>') ?><br/>
2023
- <?php echo esc_url(home_url()); ?>
2024
- </li>
2025
- <li><?php _e('Make sure cURL is enabled at your website server. You may need to contact the server administrator of your website to verify this', 'super-socializer') ?></li>
2026
- </ol>
2027
- </div>
2028
- <?php
2029
- die;
2030
- }
2031
- }
2032
- }
2033
  // twitter authentication
2034
  if(isset($_REQUEST['oauth_token']) && isset($_REQUEST['oauth_verifier'])){
2035
  global $wpdb;
@@ -2272,7 +2237,7 @@ function the_champ_frontend_scripts(){
2272
  }elseif(isset($post->ID) && $post->ID){
2273
  $commentUrl = get_permalink($post->ID);
2274
  }else{
2275
- $commentUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
2276
  }
2277
 
2278
  $commentingTabsOrder = ($theChampFacebookOptions['commenting_order'] != '' ? $theChampFacebookOptions['commenting_order'] : 'wordpress,facebook,disqus');
@@ -2325,7 +2290,7 @@ function the_champ_frontend_scripts(){
2325
  <?php
2326
  if(isset($theChampSharingOptions['horizontal_re_providers']) && (isset($theChampSharingOptions['horizontal_more']) || in_array('Copy_Link', $theChampSharingOptions['horizontal_re_providers']))){
2327
  $postId = 0;
2328
- $postUrl = sanitize_url(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
2329
  if(isset($theChampSharingOptions['horizontal_target_url'])){
2330
  if($theChampSharingOptions['horizontal_target_url'] == 'default'){
2331
  if($post){
@@ -2693,7 +2658,7 @@ function the_champ_save_avatar($user_id){
2693
  update_user_meta($user_id, 'thechamp_avatar', esc_url(trim($_POST['the_champ_small_avatar'])));
2694
  }
2695
  if((!isset($_POST['heateor_ss_gdpr_consent']) || $_POST['heateor_ss_gdpr_consent'] == 'yes') && isset($_POST['the_champ_large_avatar'])){
2696
- update_user_meta($user_id, 'thechamp_large_avatar', sanitize_url($_POST['the_champ_large_avatar']));
2697
  }
2698
  if(isset($_POST['ss_dontupdate_avatar'])){
2699
  update_user_meta($user_id, 'thechamp_dontupdate_avatar', intval($_POST['ss_dontupdate_avatar']));
3
  Plugin Name: Super Socializer
4
  Plugin URI: https://super-socializer-wordpress.heateor.com
5
  Description: A complete 360 degree solution to provide all the social features like Social Login, Social Commenting, Social Sharing, Social Media follow and more
6
+ Version: 7.13.38
7
  Author: Team Heateor
8
  Author URI: https://www.heateor.com
9
  Text Domain: super-socializer
11
  License: GPL2+
12
  */
13
  defined('ABSPATH') or die("Cheating........Uh!!");
14
+ define('THE_CHAMP_SS_VERSION', '7.13.38');
15
 
16
  // attributes to allow in the HTML of the social share and social media follow icons
17
  $heateorSsDefaultAttribs = array(
295
  return;
296
  }
297
 
298
+ if(isset($_GET['SuperSocializerAuth'])){
299
+ if(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Vkontakte'){
300
+ if(isset($theChampLoginOptions['providers']) && in_array('vkontakte', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['vk_key']) && $theChampLoginOptions['vk_key'] != '' && isset($theChampLoginOptions['vk_secure_key']) && $theChampLoginOptions['vk_secure_key'] != ''){
301
+ if(function_exists('session_start')){
302
+ if(session_status() == PHP_SESSION_NONE){
303
+ session_start();
304
+ }
305
+ }
306
+ require 'library/Vkontakte/Vkontakte.php';
307
+ $heateorSsVkontakte = new Vkontakte(array(
308
+ 'client_id' => $theChampLoginOptions['vk_key'],
309
+ 'client_secret' => $theChampLoginOptions['vk_secure_key'],
310
+ 'redirect_uri' => home_url()
311
+ ));
312
+ $heateorSsVkontakte->setScope(array('email'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
 
314
+ $_SESSION['super_socializer_vkontakte_redirect'] = isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url();
315
+ wp_redirect($heateorSsVkontakte->getLoginUrl());
316
+ die;
317
+ }
318
+ // Instagram
319
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Instagram'){
320
+ if(isset($theChampLoginOptions['providers']) && in_array('instagram', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['insta_id']) && $theChampLoginOptions['insta_id'] != '' && isset($theChampLoginOptions['insta_app_secret']) && $theChampLoginOptions['insta_app_secret'] != ''){
321
+ $instagramLoginState = mt_rand();
322
+ // save referrer url in state
323
+ update_user_meta($instagramLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
324
+ wp_redirect("https://api.instagram.com/oauth/authorize?client_id=".$theChampLoginOptions['insta_id']."&scope=user_profile,user_media&response_type=code&language=en-us&state=".$instagramLoginState."&redirect_uri=".urlencode(home_url()."/SuperSocializerAuth/Instagram"));
325
+ die;
326
+ }
327
+ // Steam auth
328
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Linkedin'){
329
+ if(isset($theChampLoginOptions['li_key']) && $theChampLoginOptions['li_key'] != '' && isset($theChampLoginOptions['li_secret']) && $theChampLoginOptions['li_secret'] != ''){
330
+ if(!isset($_GET['code']) && !isset($_GET['state'])){
331
+ $linkedinAuthState = mt_rand();
332
+ // save referrer url in state
333
+ update_user_meta($linkedinAuthState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url() );
334
+ if(isset($_GET['heateorMSEnabled'])){
335
+ update_user_meta($linkedinAuthState, 'heateor_ss_linkedin_mc_sub', 1);
336
+ }
337
+ $linkedinScope = 'r_liteprofile,r_emailaddress';
338
+ wp_redirect('https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id='.$theChampLoginOptions['li_key'].'&redirect_uri='.urlencode(home_url().'/?SuperSocializerAuth=Linkedin').'&state='. $linkedinAuthState .'&scope='.$linkedinScope);
339
+ die;
340
+ }
341
+ if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false){
342
+ $url = 'https://www.linkedin.com/oauth/v2/accessToken';
343
+ $data_access_token = array(
344
+ 'grant_type' => 'authorization_code',
345
+ 'code' => sanitize_text_field($_GET['code']),
346
+ 'redirect_uri' => home_url().'/?SuperSocializerAuth=Linkedin',
347
+ 'client_id' => $theChampLoginOptions['li_key'],
348
+ 'client_secret' => $theChampLoginOptions['li_secret']
349
+ );
350
+ $response = wp_remote_post($url, array(
351
+ 'method' => 'POST',
352
+ 'timeout' => 15,
353
+ 'redirection' => 5,
354
+ 'httpversion' => '1.0',
355
+ 'sslverify' => false,
356
+ 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
357
+ 'body' => http_build_query($data_access_token)
358
+ )
359
+ );
360
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
361
+ $body = json_decode(wp_remote_retrieve_body($response));
362
+ if(is_object($body) && isset($body->access_token)){
363
+ // fetch profile data
364
+ $firstLastName = wp_remote_get('https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))', array(
365
+ 'method' => 'GET',
366
+ 'timeout' => 15,
367
+ 'headers' => array('Authorization' => "Bearer ".$body->access_token),
368
+ )
369
+ );
370
+ $email = wp_remote_get('https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))', array(
371
+ 'method' => 'GET',
372
+ 'timeout' => 15,
373
+ 'headers' => array('Authorization' => "Bearer ".$body->access_token),
374
+ )
375
+ );
376
+ if(!is_wp_error($firstLastName) && isset($firstLastName['response']['code']) && 200 === $firstLastName['response']['code'] && !is_wp_error($email) && isset($email['response']['code']) && 200 === $email['response']['code']){
377
+ $firstLastNameBody = json_decode(wp_remote_retrieve_body($firstLastName));
378
+ $emailBody = json_decode(wp_remote_retrieve_body($email));
379
+ if(is_object($firstLastNameBody) && isset($firstLastNameBody->id) && $firstLastNameBody->id && is_object($emailBody) && isset($emailBody->elements)){
380
+ $firstLastNameBody = json_decode(json_encode($firstLastNameBody), true);
381
+ $emailBody = json_decode(json_encode($emailBody), true);
382
+ $firstName = isset($firstLastNameBody['firstName']) && isset($firstLastNameBody['firstName']['localized']) && isset($firstLastNameBody['firstName']['preferredLocale']) && isset($firstLastNameBody['firstName']['preferredLocale']['language']) && isset($firstLastNameBody['firstName']['preferredLocale']['country']) ? $firstLastNameBody['firstName']['localized'][$firstLastNameBody['firstName']['preferredLocale']['language'].'_'.$firstLastNameBody['firstName']['preferredLocale']['country']] : '';
383
+ $lastName = isset($firstLastNameBody['lastName']) && isset($firstLastNameBody['lastName']['localized']) && isset($firstLastNameBody['lastName']['preferredLocale']) && isset($firstLastNameBody['lastName']['preferredLocale']['language']) && isset($firstLastNameBody['lastName']['preferredLocale']['country']) ? $firstLastNameBody['lastName']['localized'][$firstLastNameBody['lastName']['preferredLocale']['language'].'_'.$firstLastNameBody['lastName']['preferredLocale']['country']] : '';
384
+ $smallAvatar = isset($firstLastNameBody['profilePicture']) && isset($firstLastNameBody['profilePicture']['displayImage~']) && isset($firstLastNameBody['profilePicture']['displayImage~']['elements']) && is_array($firstLastNameBody['profilePicture']['displayImage~']['elements']) && isset($firstLastNameBody['profilePicture']['displayImage~']['elements'][0]['identifiers']) && is_array($firstLastNameBody['profilePicture']['displayImage~']['elements'][0]['identifiers'][0]) && isset($firstLastNameBody['profilePicture']['displayImage~']['elements'][0]['identifiers'][0]['identifier']) ? $firstLastNameBody['profilePicture']['displayImage~']['elements'][0]['identifiers'][0]['identifier'] : '';
385
+ $largeAvatar = isset($firstLastNameBody['profilePicture']) && isset($firstLastNameBody['profilePicture']['displayImage~']) && isset($firstLastNameBody['profilePicture']['displayImage~']['elements']) && is_array($firstLastNameBody['profilePicture']['displayImage~']['elements']) && isset($firstLastNameBody['profilePicture']['displayImage~']['elements'][3]['identifiers']) && is_array($firstLastNameBody['profilePicture']['displayImage~']['elements'][3]['identifiers'][0]) && isset($firstLastNameBody['profilePicture']['displayImage~']['elements'][3]['identifiers'][0]['identifier']) ? $firstLastNameBody['profilePicture']['displayImage~']['elements'][3]['identifiers'][0]['identifier'] : '';
386
+ $emailAddress = isset($emailBody['elements']) && is_array($emailBody['elements']) && isset($emailBody['elements'][0]['handle~']) && isset($emailBody['elements'][0]['handle~']['emailAddress']) ? $emailBody['elements'][0]['handle~']['emailAddress'] : '';
387
+ $user = array(
388
+ 'firstName' => $firstName,
389
+ 'lastName' => $lastName,
390
+ 'email' => $emailAddress,
391
+ 'id' => $firstLastNameBody['id'],
392
+ 'smallAvatar' => $smallAvatar,
393
+ 'largeAvatar' => $largeAvatar
394
+ );
395
+
396
+ $profileData = the_champ_sanitize_profile_data($user, 'linkedin');
397
+ $linkedinAuthState = sanitize_text_field($_GET['state']);
398
+ if(get_user_meta($linkedinAuthState, 'heateor_ss_linkedin_mc_sub', true)){
399
+ $profileData['mc_subscribe'] = 1;
400
+ delete_user_meta($linkedinAuthState, 'heateor_ss_linkedin_mc_sub');
401
+ }
402
+ $linkedinRedirectUrl = get_user_meta($linkedinAuthState, 'super_socializer_redirect_to', true);
403
+ $response = the_champ_user_auth($profileData, 'linkedin', $linkedinRedirectUrl);
404
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
405
+ $redirectTo = the_champ_get_login_redirection_url($linkedinRedirectUrl, true);
406
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
407
+ $redirectTo = $linkedinRedirectUrl.(strpos($linkedinRedirectUrl, '?') !== false ? '&' : '?').'linked=1';
408
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
409
+ $redirectTo = $linkedinRedirectUrl.(strpos($linkedinRedirectUrl, '?') !== false ? '&' : '?').'linked=0';
410
+ }elseif(isset($response['url']) && $response['url'] != ''){
411
+ $redirectTo = $response['url'];
412
+ }else{
413
+ $redirectTo = the_champ_get_login_redirection_url($linkedinRedirectUrl);
414
+ }
415
+ the_champ_close_login_popup($redirectTo);
416
+ }
417
+ }
418
  }
419
+ }
 
420
  }
421
  }
422
+ // line
423
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Line'){
424
+ if(isset($theChampLoginOptions['providers']) && in_array('line', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['line_channel_id']) && $theChampLoginOptions['line_channel_id'] != '' && isset($theChampLoginOptions['line_channel_secret']) && $theChampLoginOptions['line_channel_secret'] != ''){
425
+ if(!isset($_GET['code'])){
426
+ $lineLoginState = mt_rand();
427
+ // save referrer url in state
428
+ update_user_meta($lineLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
429
+ }
430
+ wp_redirect("https://access.line.me/oauth2/v2.1/authorize?client_id=".$theChampLoginOptions['line_channel_id']."&response_type=code&scope=openid%20profile%20email&state=". $lineLoginState ."&redirect_uri=".urlencode(home_url()."/SuperSocializerAuth/Line"));
431
+ die;
432
+ }
433
+ // mail.ru
434
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Mailru'){
435
+ if(isset($theChampLoginOptions['providers']) && in_array('mailru', $theChampLoginOptions['providers']) && $theChampLoginOptions['mailru_client_id'] && $theChampLoginOptions['mailru_client_secret']){
436
+ if(!heateor_ss_is_curl_loaded()){
437
+ _e('Enable CURL at your website server to use Mail.ru Social Login.', 'super-socializer');
438
+ die;
439
+ }
440
+ if(!isset($_GET['code'])){
441
+ $mailruLoginState = mt_rand();
442
+ // save referrer url in state
443
+ update_user_meta($mailruLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
444
+ }
445
+ wp_redirect("https://oauth.mail.ru/login?client_id=". $theChampLoginOptions['mailru_client_id'] ."&scope=userinfo&state=". $mailruLoginState ."&response_type=code&redirect_uri=". home_url() ."/SuperSocializerAuth/Mailru");
446
+ die;
447
+ }
448
+ // yahoo
449
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Yahoo'){
450
+ if(isset($theChampLoginOptions['providers']) && in_array('yahoo', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['yahoo_channel_id']) && $theChampLoginOptions['yahoo_channel_id'] != '' && isset($theChampLoginOptions['yahoo_channel_secret']) && $theChampLoginOptions['yahoo_channel_secret'] != ''){
451
+ if(!isset($_GET['code'])){
452
+ $yahooLoginState = mt_rand();
453
+ // save referrer url in state
454
+ update_user_meta($yahooLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
455
+ }
456
+ wp_redirect("https://api.login.yahoo.com/oauth2/request_auth?client_id=".$theChampLoginOptions['yahoo_channel_id']."&response_type=code&language=en-us&state=".$yahooLoginState."&redirect_uri=".home_url()."/SuperSocializerAuth/Yahoo");
457
+ die;
458
+ }
459
+ // Discord
460
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Discord'){
461
+ if(isset($theChampLoginOptions['providers']) && in_array('discord', $theChampLoginOptions['providers']) && $theChampLoginOptions['discord_channel_id'] && $theChampLoginOptions['discord_channel_secret']){
462
+ if(!isset($_GET['code'])){
463
+ $discordLoginState = mt_rand();
464
+ // save referrer url in state
465
+ update_user_meta($discordLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
466
+ }
467
+ wp_redirect("https://discord.com/oauth2/authorize/request_auth?client_id=".$theChampLoginOptions['discord_channel_id']."&response_type=code&state=".$discordLoginState."&scope=identify%20email&redirect_uri=".home_url()."/SuperSocializerAuth/Discord");
468
+ die;
469
+ }
470
+ // Wordpress
471
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Wordpress'){
472
+ if(isset($theChampLoginOptions['providers']) && in_array('wordpress', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['wordpress_client_id']) && $theChampLoginOptions['wordpress_client_id'] != '' && isset($theChampLoginOptions['wordpress_client_secret']) && $theChampLoginOptions['wordpress_client_secret'] != ''){
473
+ if(!isset($_GET['code'])){
474
+ $wordpressLoginState = mt_rand();
475
+ // save referrer url in state
476
+ update_user_meta($wordpressLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
477
+ }
478
+ wp_redirect("https://public-api.wordpress.com/oauth2/authorize?client_id=".$theChampLoginOptions['wordpress_client_id']."&scope=auth&response_type=code&state=".$wordpressLoginState."&redirect_uri=".home_url()."/SuperSocializerAuth/Wordpress");
479
+ die;
480
+ }
481
+ // windows live
482
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Live'){
483
+ if(isset($theChampLoginOptions['providers']) && in_array('microsoft', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['live_channel_id']) && $theChampLoginOptions['live_channel_id'] != '' && isset($theChampLoginOptions['live_channel_secret']) && $theChampLoginOptions['live_channel_secret'] != ''){
484
+ $liveLoginState = mt_rand();
485
+ // save referrer url in state
486
+ update_user_meta($liveLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
487
+ wp_redirect("https://login.live.com/oauth20_authorize.srf?client_id=".$theChampLoginOptions['live_channel_id']."&scope=wl.emails,wl.basic&response_type=code&state=".$liveLoginState."&redirect_uri=".home_url()."/SuperSocializerAuth/Live");
488
+ die;
489
+ }
490
+ // twitch
491
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Twitch'){
492
+ if(isset($theChampLoginOptions['providers']) && in_array('twitch', $theChampLoginOptions['providers']) && $theChampLoginOptions['twitch_client_id'] && $theChampLoginOptions['twitch_client_secret']){
493
+ if(!isset($_GET['code'])){
494
+ $twitchLoginState = mt_rand();
495
+ // save referrer url in state
496
+ update_user_meta($twitchLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
497
+ }
498
+ wp_redirect("https://id.twitch.tv/oauth2/authorize?client_id=".$theChampLoginOptions['twitch_client_id']."&scope=user:read:email&response_type=code&state=".$twitchLoginState."&redirect_uri=".urlencode(home_url()."/SuperSocializerAuth/Twitch"));
499
+ die;
500
+ }
501
+ // reddit
502
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Reddit'){
503
+ if(isset($theChampLoginOptions['providers']) && in_array('reddit', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['reddit_client_id']) && $theChampLoginOptions['reddit_client_id'] != '' && isset($theChampLoginOptions['reddit_client_secret']) && $theChampLoginOptions['reddit_client_secret'] != ''){
504
+ $redditLoginState = mt_rand();
505
+ // save referrer url in state
506
+ update_user_meta($redditLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
507
+ wp_redirect("https://ssl.reddit.com/api/v1/authorize?client_id=" . $theChampLoginOptions['reddit_client_id'] . "&scope=identity&state=" . $redditLoginState . "&duration=temporary&response_type=code&redirect_uri=" . home_url() . "/SuperSocializerAuth/Reddit");
508
+ die;
509
+ }
510
+ //disqus
511
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Disqus'){
512
+ if(isset($theChampLoginOptions['providers']) && in_array('disqus', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['disqus_public_key']) && $theChampLoginOptions['disqus_public_key'] != '' && isset($theChampLoginOptions['disqus_secret_key']) && $theChampLoginOptions['disqus_secret_key'] != ''){
513
+ $disqusLoginState = mt_rand();
514
+ // save referrer url in state
515
+ update_user_meta($disqusLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
516
+ wp_redirect("https://disqus.com/api/oauth/2.0/authorize/?client_id=" . $theChampLoginOptions['disqus_public_key'] . "&scope=read,email&response_type=code&state=". $disqusLoginState ."&redirect_uri=" . home_url() . "/SuperSocializerAuth/Disqus");
517
+ die;
518
+ }
519
+ // dropbox
520
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Dropbox'){
521
+ if(isset($theChampLoginOptions['providers']) && in_array('dropbox', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['dropbox_app_key']) && $theChampLoginOptions['dropbox_app_key'] != '' && isset($theChampLoginOptions['dropbox_app_secret']) && $theChampLoginOptions['dropbox_app_secret'] != ''){
522
+ $dropboxLoginState = mt_rand();
523
+ // save referrer url in state
524
+ update_user_meta($dropboxLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
525
+ wp_redirect("https://www.dropbox.com/1/oauth2/authorize?client_id=" . $theChampLoginOptions['dropbox_app_key'] . "&scope=account_info.read&state=" . $dropboxLoginState . "&response_type=code&redirect_uri=" . home_url() . "/SuperSocializerAuth/Dropbox");
526
+ die;
527
+ }
528
+ // foursquare
529
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Foursquare'){
530
+ if(isset($theChampLoginOptions['providers']) && in_array('foursquare', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['foursquare_client_id']) && $theChampLoginOptions['foursquare_client_id'] != '' && isset($theChampLoginOptions['foursquare_client_secret']) && $theChampLoginOptions['foursquare_client_secret'] != ''){
531
+ $foursquareLoginState = mt_rand();
532
+ // save referrer url in state
533
+ update_user_meta($foursquareLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
534
+ wp_redirect("https://foursquare.com/oauth2/authenticate/?client_id=" . $theChampLoginOptions['foursquare_client_id'] . "&response_type=code&state=". $foursquareLoginState ."&redirect_uri=" . home_url() . "/SuperSocializerAuth/Foursquare");
535
+ die;
536
+ }
537
+ // odnoklassniki
538
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Odnoklassniki'){
539
+ if(isset($theChampLoginOptions['providers']) && in_array('odnoklassniki', $theChampLoginOptions['providers']) && $theChampLoginOptions['odnoklassniki_client_id'] && $theChampLoginOptions['odnoklassniki_client_secret']){
540
+ if(!isset($_GET['code'])){
541
+ $odnoklassnikiLoginState = mt_rand();
542
+ // save referrer url in state
543
+ update_user_meta($odnoklassnikiLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
544
+ }
545
+ wp_redirect("https://connect.ok.ru/oauth/authorize?client_id=" . $theChampLoginOptions['odnoklassniki_client_id'] . "&scope=GET_EMAIL%20PHOTO_CONTENT&response_type=code&state=" . $odnoklassnikiLoginState . "&redirect_uri=" . urlencode(home_url()."/SuperSocializerAuth/Odnoklassniki"));
546
+ die;
547
+ }
548
+ // Dribbble
549
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Dribbble'){
550
+ if(isset($theChampLoginOptions['providers']) && in_array('dribbble', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['dribbble_client_id']) && $theChampLoginOptions['dribbble_client_id'] != '' && isset($theChampLoginOptions['dribbble_client_secret']) && $theChampLoginOptions['dribbble_client_secret'] != ''){
551
+ if(!isset($_GET['code'])){
552
+ $dribbbleLoginState = mt_rand();
553
+ // save referrer url in state
554
+ update_user_meta($dribbbleLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
555
+ }
556
+ wp_redirect("https://dribbble.com/oauth/authorize?client_id=".$theChampLoginOptions['dribbble_client_id']."&scope=public&state=". $dribbbleLoginState ."&redirect_uri=".urlencode(home_url()."/SuperSocializerAuth/Dribbble"));
557
+ die;
558
+ }
559
+ // Spotify
560
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Spotify'){
561
+ if(isset($theChampLoginOptions['providers']) && in_array('spotify', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['spotify_client_id']) && $theChampLoginOptions['spotify_client_id'] != '' && isset($theChampLoginOptions['spotify_client_secret']) && $theChampLoginOptions['spotify_client_secret'] != ''){
562
+ if(!isset($_GET['code'])){
563
+ $spotifyLoginState = mt_rand();
564
+ // save referrer url in state
565
+ update_user_meta($spotifyLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
566
+ }
567
+ wp_redirect("https://accounts.spotify.com/authorize?client_id=".$theChampLoginOptions['spotify_client_id']."&scope=user-read-email&response_type=code&state=". $spotifyLoginState ."&redirect_uri=".home_url()."/SuperSocializerAuth/Spotify");
568
+ die;
569
+ }
570
+ // kakao
571
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Kakao'){
572
+ if(isset($theChampLoginOptions['providers']) && in_array('kakao', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['kakao_client_id']) && $theChampLoginOptions['kakao_client_id'] != '' && isset($theChampLoginOptions['kakao_client_secret']) && $theChampLoginOptions['kakao_client_secret'] != ''){
573
+ if(!isset($_GET['code'])){
574
+ $kakaoLoginState = mt_rand();
575
+ // save referrer url in state
576
+ update_user_meta($kakaoLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
577
+ }
578
+ wp_redirect("https://kauth.kakao.com/oauth/authorize?client_id=".$theChampLoginOptions['kakao_client_id']."&response_type=code&state=". $kakaoLoginState ."&redirect_uri=".home_url()."/SuperSocializerAuth/Kakao");
579
+ die;
580
+ }
581
+ // yandex
582
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Yandex'){
583
+ if(isset($theChampLoginOptions['providers']) && in_array('yandex', $theChampLoginOptions['providers']) && $theChampLoginOptions['yandex_client_id'] && $theChampLoginOptions['yandex_client_secret']){
584
+ if(!isset($_GET['code'])){
585
+ $yandexLoginState = mt_rand();
586
+ // save referrer url in state
587
+ update_user_meta($yandexLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
588
+ }
589
+ wp_redirect("https://oauth.yandex.com/authorize?client_id=" . $theChampLoginOptions['yandex_client_id'] . "&response_type=code&state=" . $yandexLoginState . "&redirect_uri=".urlencode(home_url() . "/SuperSocializerAuth/Yandex"));
590
+ die;
591
+ }
592
+ // Github
593
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Github'){
594
+ if(isset($theChampLoginOptions['providers']) && in_array('github', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['github_client_id']) && $theChampLoginOptions['github_client_id'] != '' && isset($theChampLoginOptions['github_client_secret']) && $theChampLoginOptions['github_client_secret'] != ''){
595
+ if(!isset($_GET['code'])){
596
+ $githubLoginState = mt_rand();
597
+ // save referrer url in state
598
+ update_user_meta($githubLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
599
+ }
600
+ wp_redirect("https://github.com/login/oauth/authorize?client_id=".$theChampLoginOptions['github_client_id']."&scope=read:user user:email&state=". $githubLoginState ."&response_type=code&redirect_uri=".home_url()."/SuperSocializerAuth/Github");
601
+ die;
602
+ }
603
+ // amazon
604
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Amazon'){
605
+ if(isset($theChampLoginOptions['providers']) && in_array('amazon', $theChampLoginOptions['providers']) && $theChampLoginOptions['amazon_client_id'] && $theChampLoginOptions['amazon_client_secret']){
606
+ if(!isset($_GET['code'])){
607
+ $amazonLoginState = mt_rand();
608
+ // save referrer url in state
609
+ update_user_meta($amazonLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
610
+ }
611
+ wp_redirect("https://www.amazon.com/ap/oa?client_id=".$theChampLoginOptions['amazon_client_id']."&response_type=code&scope=profile&state=".$amazonLoginState."&redirect_uri=".urlencode(home_url()."/SuperSocializerAuth/Amazon"));
612
+ die;
613
+ }
614
+ // Stack Overflow
615
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Stackoverflow'){
616
+ if(isset($theChampLoginOptions['providers']) && in_array('stackoverflow', $theChampLoginOptions['providers']) && $theChampLoginOptions['stackoverflow_client_id'] && $theChampLoginOptions['stackoverflow_client_secret'] && $theChampLoginOptions['stackoverflow_key']){
617
+ if(!isset($_GET['code'])){
618
+ $stackoverflowLoginState = mt_rand();
619
+ // save referrer url in state
620
+ update_user_meta($stackoverflowLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
621
+ }
622
+ wp_redirect("https://stackexchange.com/oauth?client_id=".$theChampLoginOptions['stackoverflow_client_id']."&response_type=code&scope=private_info&state=".$stackoverflowLoginState."&redirect_uri=".urlencode(home_url()."/SuperSocializerAuth/Stackoverflow"));
623
+ die;
624
+ }
625
+ // Google
626
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Google'){
627
+ if(isset($theChampLoginOptions['providers']) && in_array('google', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['google_key']) && $theChampLoginOptions['google_key'] != '' && isset($theChampLoginOptions['google_secret']) && $theChampLoginOptions['google_secret'] != ''){
628
+ $googleLoginState = mt_rand();
629
+ // save referrer url in state
630
+ update_user_meta($googleLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
631
+ wp_redirect("https://accounts.google.com/o/oauth2/auth?client_id=" . $theChampLoginOptions['google_key'] . "&scope=https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile&state=". $googleLoginState ."&response_type=code&prompt=select_account&redirect_uri=" . home_url());
632
+ die;
633
+ }
634
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Twitter' && !isset($_REQUEST['oauth_token'])){
635
+ if(isset($theChampLoginOptions['twitter_key']) && $theChampLoginOptions['twitter_key'] != '' && isset($theChampLoginOptions['twitter_secret']) && $theChampLoginOptions['twitter_secret'] != ''){
636
+ if(!function_exists('curl_init')){
637
+ ?>
638
+ <div style="width: 500px; margin: 0 auto">
639
+ <?php _e('cURL is not enabled at your website server. Please contact your website server administrator to enable it.', 'super-socializer') ?>
640
+ </div>
641
+ <?php
642
+ die;
643
+ }
644
+ /* Build TwitterOAuth object with client credentials. */
645
+ $connection = new Abraham\TwitterOAuth\TwitterOAuth($theChampLoginOptions['twitter_key'], $theChampLoginOptions['twitter_secret']);
646
+ $requestToken = $connection->oauth('oauth/request_token', ['oauth_callback' => esc_url(home_url())]);
647
+ /* Get temporary credentials. */
648
+ //$requestToken = $connection->getRequestToken(esc_url(home_url()));
649
+ if($connection->getLastHttpCode() == 200){
650
+ // generate unique ID
651
+ $uniqueId = mt_rand();
652
+ // save oauth token and secret in db temporarily
653
+ update_user_meta($uniqueId, 'thechamp_twitter_oauthtoken', $requestToken['oauth_token']);
654
+ update_user_meta($uniqueId, 'thechamp_twitter_oauthtokensecret', $requestToken['oauth_token_secret']);
655
+ if(isset($_GET['heateorMSEnabled'])){
656
+ update_user_meta($uniqueId, 'thechamp_mc_subscribe', '1');
657
+ }
658
+ if(isset($_GET['super_socializer_redirect_to']) && heateor_ss_validate_url($_GET['super_socializer_redirect_to']) !== false){
659
+ update_user_meta($uniqueId, 'thechamp_twitter_redirect', esc_url_raw($_GET['super_socializer_redirect_to']));
660
+ }
661
+ wp_redirect($connection->url('oauth/authorize', ['oauth_token' => $requestToken['oauth_token']]));
662
+ die;
663
+ }else{
664
+ ?>
665
+ <div style="width: 500px; margin: 0 auto">
666
+ <ol>
667
+ <li><?php echo sprintf(__('Enter exactly the following url in <strong>Website</strong> option in your Twitter app (see step 3 %s)', 'super-socializer'), '<a target="_blank" href="http://support.heateor.com/how-to-get-twitter-api-key-and-secret/">here</a>') ?><br/>
668
+ <?php echo esc_url(home_url()) ?>
669
+ </li>
670
+ <li><?php echo sprintf(__('Enter exactly the following url in <strong>Callback URLs</strong> option in your Twitter app (see step 3 %s)', 'super-socializer'), '<a target="_blank" href="http://support.heateor.com/how-to-get-twitter-api-key-and-secret/">here</a>') ?><br/>
671
+ <?php echo esc_url(home_url()); ?>
672
+ </li>
673
+ <li><?php _e('Make sure cURL is enabled at your website server. You may need to contact the server administrator of your website to verify this', 'super-socializer') ?></li>
674
+ </ol>
675
+ </div>
676
+ <?php
677
+ die;
678
+ }
679
+ }
680
+ // Facebook
681
+ }elseif(sanitize_text_field($_GET['SuperSocializerAuth']) == 'Facebook'){
682
+ if(isset($theChampLoginOptions['providers']) && in_array('facebook', $theChampLoginOptions['providers']) && isset($theChampLoginOptions['fb_key']) && $theChampLoginOptions['fb_key'] != '' && isset($theChampLoginOptions['fb_secret']) && $theChampLoginOptions['fb_secret'] != ''){
683
+ if(!isset($_GET['code'])){
684
+ $facebookLoginState = mt_rand();
685
+ // save referrer url in state
686
+ update_user_meta($facebookLoginState, 'super_socializer_redirect_to', isset($_GET['super_socializer_redirect_to']) ? esc_url_raw($_GET['super_socializer_redirect_to']) : home_url());
687
+ wp_redirect("https://www.facebook.com/v10.0/dialog/oauth?scope=email&client_id=" . $theChampLoginOptions['fb_key'] . "&state=" . $facebookLoginState . "&redirect_uri=" . home_url() . "/?SuperSocializerAuth=Facebook");
688
+ die;
689
+ }elseif(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false){
690
+ $postData = array(
691
+ 'code' => sanitize_text_field($_GET['code']),
692
+ 'redirect_uri' => home_url() . "/?SuperSocializerAuth=Facebook",
693
+ 'client_id' => $theChampLoginOptions['fb_key'],
694
+ 'client_secret' => $theChampLoginOptions['fb_secret']
695
+ );
696
+ $response = wp_remote_post("https://graph.facebook.com/v10.0/oauth/access_token", array(
697
+ 'method' => 'POST',
698
+ 'timeout' => 15,
699
+ 'redirection' => 5,
700
+ 'httpversion' => '1.0',
701
+ 'sslverify' => false,
702
+ 'headers' => array(
703
+ 'Content-Type' => 'application/x-www-form-urlencoded'
704
+ ),
705
+ 'body' => http_build_query($postData)
706
+ ));
707
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
708
+ $body = json_decode(wp_remote_retrieve_body($response));
709
+ if(!empty($body->access_token)){
710
+ $response = wp_remote_get("https://graph.facebook.com/me?fields=id,name,about,link,email,first_name,last_name,picture.width(60).height(60).as(picture_small),picture.width(320).height(320).as(picture_large)&access_token=" . $body->access_token, array(
711
+ 'timeout' => 15
712
+ ));
713
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
714
+ $profileData = json_decode(wp_remote_retrieve_body($response));
715
+ if(is_object($profileData) && isset($profileData->id)){
716
+ $profileData = the_champ_sanitize_profile_data($profileData, 'facebook');
717
+ $facebookLoginState = sanitize_text_field($_GET['state']);
718
+ $facebook_redirect_url = get_user_meta($facebookLoginState, 'super_socializer_redirect_to', true);
719
+ delete_user_meta($facebookLoginState, 'super_socializer_redirect_to');
720
+ $response = the_champ_user_auth($profileData, 'faceboook', $facebook_redirect_url);
721
+ if($response == 'show form'){
722
+ return;
723
+ }
724
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
725
+ $redirectTo = the_champ_get_login_redirection_url($facebook_redirect_url, true);
726
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
727
+ $redirectTo = $facebook_redirect_url . (strpos($facebook_redirect_url, '?') !== false ? '&' : '?') . 'linked=1';
728
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
729
+ $redirectTo = $facebook_redirect_url . (strpos($facebook_redirect_url, '?') !== false ? '&' : '?') . 'linked=0';
730
+ }elseif(isset($response['url']) && $response['url'] != ''){
731
+ $redirectTo = $response['url'];
732
+ }else{
733
+ $redirectTo = the_champ_get_login_redirection_url($facebook_redirect_url);
734
+ }
735
+ the_champ_close_login_popup($redirectTo);
736
+ }
737
+ }
738
+ }
739
+ }
740
+ }
741
+ }
742
+ }
743
+ }elseif(isset($_GET['SuperSocializerSteamAuth']) && trim($_GET['SuperSocializerSteamAuth']) != '' && isset($theChampLoginOptions['steam_api_key']) && $theChampLoginOptions['steam_api_key'] != ''){
744
  global $theChampSteamLogin;
745
  $theChampSteamId = $theChampSteamLogin->validate();
746
  $result = wp_remote_get("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=".$theChampLoginOptions['steam_api_key']."&steamids=".$theChampSteamId."/?xml=1", array('timeout' => 15));
773
  }
774
  die;
775
  }
776
+
777
+ if(isset($_GET['code']) && isset($_GET['state']) && get_user_meta(sanitize_text_field($_GET['state']), 'super_socializer_redirect_to', true) !== false){
778
+ if(remove_query_arg(array('code', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Instagram'){
779
+ $postData = array(
780
+ 'client_id' => $theChampLoginOptions['insta_id'],
781
+ 'client_secret' => $theChampLoginOptions['insta_app_secret'],
782
+ 'grant_type' => 'authorization_code',
783
+ 'redirect_uri' => home_url().'/SuperSocializerAuth/Instagram',
784
+ 'code' => sanitize_text_field($_GET['code'])
785
+ );
786
+ $response = wp_remote_post("https://api.instagram.com/oauth/access_token", array(
 
 
 
 
 
 
 
 
 
 
 
 
 
787
  'method' => 'POST',
788
  'timeout' => 15,
789
  'redirection' => 5,
790
  'httpversion' => '1.0',
791
  'sslverify' => false,
792
  'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
793
+ 'body' => http_build_query($postData)
794
+ )
795
+ );
796
+
797
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
798
+ $body = json_decode(wp_remote_retrieve_body($response));
799
+ if(isset($body->access_token)){
800
+ $authorization = "Bearer ".$body->access_token;
801
+ $response = wp_remote_get('https://graph.instagram.com/'.$body->user_id.'?fields=account_type,id,username&access_token='.$body->access_token, array('timeout' => 15));
802
+
803
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
804
+ $profileData = json_decode(wp_remote_retrieve_body($response ));
805
+
806
+ if(is_object($profileData) && isset($profileData->id)){
807
+ $profileData = the_champ_sanitize_profile_data($profileData, 'instagram');
808
+ $instagramLoginState = sanitize_text_field($_GET['state']);
809
+ $instagramRedirectUrl = get_user_meta($instagramLoginState, 'super_socializer_redirect_to', true);
810
+ $response = the_champ_user_auth($profileData, 'instagram', $instagramRedirectUrl);
811
+ if($response == 'show form'){
812
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
813
  }
814
+ delete_user_meta($instagramLoginState, 'super_socializer_redirect_to', true);
815
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
816
+ $redirectTo = the_champ_get_login_redirection_url($instagramRedirectUrl, true);
817
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
818
+ $redirectTo = $instagramRedirectUrl.(strpos($instagramRedirectUrl, '?') !== false ? '&' : '?').'linked=1';
819
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
820
+ $redirectTo = $instagramRedirectUrl.(strpos($instagramRedirectUrl, '?') !== false ? '&' : '?').'linked=0';
821
+ }elseif(isset($response['url']) && $response['url'] != ''){
822
+ $redirectTo = $response['url'];
823
+ }else{
824
+ $redirectTo = the_champ_get_login_redirection_url($instagramRedirectUrl);
825
+ }
826
+ the_champ_close_login_popup($redirectTo);
827
+ }
828
  }
829
  }
830
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
831
  }
 
832
 
833
+ if(remove_query_arg(array('code','scope', 'state'), strtok(the_champ_get_http().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],'?')) == home_url().'/SuperSocializerAuth/Line'){
834
+ $postData = array(
835
+ 'grant_type' => 'authorization_code',
836
+ 'code' => sanitize_text_field($_GET['code']),
837
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Line",
838
+ 'client_id' => $theChampLoginOptions['line_channel_id'],
839
+ 'client_secret' => $theChampLoginOptions['line_channel_secret']
840
+ );
841
+ $response = wp_remote_post("https://api.line.me/oauth2/v2.1/token", array(
842
+ 'method' => 'POST',
843
+ 'timeout' => 15,
844
+ 'redirection' => 5,
845
+ 'httpversion' => '1.0',
846
+ 'sslverify' => false,
847
+ 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
848
+ 'body' => http_build_query($postData)
849
+ )
850
+ );
851
+
852
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
853
+ $body = json_decode(wp_remote_retrieve_body($response));
854
+ $authorization = "Bearer ".$body->access_token;
855
 
856
+ $response = wp_remote_get("https://api.line.me/v2/profile", array(
857
+ 'timeout' => 15,
858
+ 'headers' => array(
859
+ 'Accept' => 'application/json',
860
+ 'Authorization' => $authorization
861
+ )
862
+ ));
863
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
864
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
865
  $profileData = json_decode(wp_remote_retrieve_body($response));
866
+ if(is_object($profileData) && isset($profileData->userId)){
867
+ $profileData = the_champ_sanitize_profile_data($profileData, 'line');
868
+ $lineLoginState = sanitize_text_field($_GET['state']);
869
+ $lineRedirectUrl = get_user_meta($lineLoginState, 'super_socializer_redirect_to', true);
870
+ $response = the_champ_user_auth($profileData, 'line', $lineRedirectUrl);
 
871
  if($response == 'show form'){
872
  return;
873
  }
874
  if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
875
+ $redirectTo = the_champ_get_login_redirection_url($lineRedirectUrl, true);
876
  }elseif(isset($response['message']) && $response['message'] == 'linked'){
877
+ $redirectTo = $lineRedirectUrl . (strpos($lineRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
878
  }elseif(isset($response['message']) && $response['message'] == 'not linked'){
879
+ $redirectTo = $lineRedirectUrl . (strpos($lineRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
880
  }elseif(isset($response['url']) && $response['url'] != ''){
881
  $redirectTo = $response['url'];
882
  }else{
883
+ $redirectTo = the_champ_get_login_redirection_url($lineRedirectUrl);
884
  }
885
  the_champ_close_login_popup($redirectTo);
886
+ }
887
  }
888
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
889
  }
890
+
891
+ if(remove_query_arg(array('code', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Mailru'){
892
+ $postData = array(
893
+ 'grant_type' => 'authorization_code',
894
+ 'code' => sanitize_text_field($_GET['code']),
895
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Mailru"
896
+ );
897
+ $serviceUrl = 'https://oauth.mail.ru/token';
898
+ $auth = base64_encode($theChampLoginOptions['mailru_client_id']. ":" .$theChampLoginOptions['mailru_client_secret']);
899
+ $response = wp_remote_post($serviceUrl, array(
900
+ 'method' => 'POST',
901
+ 'timeout' => 15,
902
+ 'redirection' => 5,
903
+ 'httpversion' => '1.0',
904
+ 'sslverify' => false,
905
+ 'headers' => array(
906
+ 'Content-Type' => "application/x-www-form-urlencoded",
907
+ 'User-Agent' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36",
908
+ 'Authorization' => "Basic $auth"
909
+ ),
910
+ 'body' => $postData
911
+ )
912
+ );
 
 
 
 
913
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
914
+ $body = json_decode(wp_remote_retrieve_body($response));
915
+ if(is_object($body) && isset($body->access_token)){
916
+ $serviceUrl = 'https://oauth.mail.ru/userinfo?access_token=' .$body->access_token;
917
+
918
+ $response = wp_remote_get($serviceUrl, array('timeout' => 15, 'headers' => array(
919
+ 'Content-Type' => 'application/x-www-form-urlencoded',
920
+ 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36',
921
+ 'Authorization' => "Bearer ". $body->access_token
922
+ )));
923
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
924
+ $profileData = json_decode(wp_remote_retrieve_body($response));
925
+
926
+ if(is_object($profileData) && isset($profileData->id)){
927
+ $profileData = the_champ_sanitize_profile_data($profileData, 'mailru');
928
+ $mailruLoginState = sanitize_text_field($_GET['state']);
929
+ $mailruRedirectUrl = get_user_meta($mailruLoginState, 'super_socializer_redirect_to', true);
930
+ $response = the_champ_user_auth($profileData, 'mailru', $mailruRedirectUrl);
931
+ if($response == 'show form'){
932
+ return;
933
+ }
934
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
935
+ $redirectTo = the_champ_get_login_redirection_url($mailruRedirectUrl, true);
936
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
937
+ $redirectTo = $mailruRedirectUrl . (strpos($mailruRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
938
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
939
+ $redirectTo = $mailruRedirectUrl . (strpos($mailruRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
940
+ }elseif(isset($response['url']) && $response['url'] != ''){
941
+ $redirectTo = $response['url'];
942
+ }else{
943
+ $redirectTo = the_champ_get_login_redirection_url($mailruRedirectUrl);
944
+ }
945
+ the_champ_close_login_popup($redirectTo);
946
+ }
947
  }
 
948
  }
949
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
950
  }
 
951
 
952
+ if(remove_query_arg(array('code', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Yahoo'){
953
+ $postData = array(
954
+ 'grant_type' => 'authorization_code',
955
+ 'code' => sanitize_text_field($_GET['code']),
956
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Yahoo",
957
+ 'client_id' => $theChampLoginOptions['yahoo_channel_id'],
958
+ 'client_secret' => $theChampLoginOptions['yahoo_channel_secret']
959
+ );
960
+ $response = wp_remote_post("https://api.login.yahoo.com/oauth2/get_token", array(
 
961
  'method' => 'POST',
962
  'timeout' => 15,
963
  'redirection' => 5,
965
  'sslverify' => false,
966
  'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
967
  'body' => http_build_query($postData)
968
+ )
969
+ );
 
 
 
 
970
 
 
 
971
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
972
+ $body = json_decode(wp_remote_retrieve_body($response));
973
+ $authorization = "Bearer ".$body->access_token;
974
+
975
+ $response = wp_remote_get("https://api.login.yahoo.com/openid/v1/userinfo", array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization )));
976
+
977
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
978
+ $profileData = json_decode(wp_remote_retrieve_body($response));
979
+
980
+ if(is_object($profileData) && isset($profileData->sub)){
981
+ $profileData = the_champ_sanitize_profile_data($profileData, 'yahoo');
982
+ $yahooLoginState = sanitize_text_field($_GET['state']);
983
+ $yahooRedirectUrl = get_user_meta($yahooLoginState, 'super_socializer_redirect_to', true);
984
+ $response = the_champ_user_auth($profileData, 'yahoo', $yahooRedirectUrl);
985
+ if($response == 'show form'){
986
+ return;
987
+ }
988
+ delete_user_meta($yahooLoginState, 'super_socializer_redirect_to', true);
989
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
990
+ $redirectTo = the_champ_get_login_redirection_url($yahooRedirectUrl, true);
991
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
992
+ $redirectTo = $yahooRedirectUrl . (strpos($yahooRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
993
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
994
+ $redirectTo = $yahooRedirectUrl . (strpos($yahooRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
995
+ }elseif(isset($response['url']) && $response['url'] != ''){
996
+ $redirectTo = $response['url'];
997
+ }else{
998
+ $redirectTo = the_champ_get_login_redirection_url($yahooRedirectUrl);
999
+ }
1000
+ the_champ_close_login_popup($redirectTo);
1001
  }
 
1002
  }
1003
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
1004
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1005
 
1006
+ if(remove_query_arg(array('code', 'scope', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Discord'){
1007
+ $postData = array(
1008
+ 'grant_type' => 'authorization_code',
1009
+ 'code' => sanitize_text_field($_GET['code']),
1010
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Discord",
1011
+ 'client_id' => $theChampLoginOptions['discord_channel_id'],
1012
+ 'client_secret' => $theChampLoginOptions['discord_channel_secret'],
1013
+ 'scope' => 'identify%20email'
1014
+ );
1015
+ $response = wp_remote_post("https://discord.com/api/oauth2/token", array(
1016
+ 'method' => 'POST',
1017
+ 'timeout' => 15,
1018
+ 'redirection' => 5,
1019
+ 'httpversion' => '1.0',
1020
+ 'sslverify' => false,
1021
+ 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1022
+ 'body' => http_build_query($postData)
1023
+ )
1024
+ );
1025
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1026
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1027
+ $body = json_decode(wp_remote_retrieve_body($response));
1028
+ $authorization = "Bearer ".$body->access_token;
1029
+
1030
+ $response = wp_remote_get("https://discordapp.com/api/users/@me", array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization )));
1031
+
1032
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1033
+ $profileData = json_decode(wp_remote_retrieve_body($response));
1034
+ if(is_object($profileData) && isset($profileData->id) && isset($profileData->verified) && $profileData->verified == 1){
1035
+ $profileData = the_champ_sanitize_profile_data($profileData, 'discord');
1036
+ $discordLoginState = sanitize_text_field($_GET['state']);
1037
+ $discordRedirectUrl = get_user_meta($discordLoginState, 'super_socializer_redirect_to', true);
1038
+ $response = the_champ_user_auth($profileData, 'discord', $discordRedirectUrl);
1039
+ if($response == 'show form'){
1040
+ return;
1041
+ }
1042
+ delete_user_meta($discordLoginState, 'super_socializer_redirect_to', true);
1043
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1044
+ $redirectTo = the_champ_get_login_redirection_url($discordRedirectUrl, true);
1045
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1046
+ $redirectTo = $discordRedirectUrl . (strpos($discordRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1047
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1048
+ $redirectTo = $discordRedirectUrl . (strpos($discordRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1049
+ }elseif(isset($response['url']) && $response['url'] != ''){
1050
+ $redirectTo = $response['url'];
1051
+ }else{
1052
+ $redirectTo = the_champ_get_login_redirection_url($discordRedirectUrl);
1053
+ }
1054
+ the_champ_close_login_popup($redirectTo);
1055
  }
 
1056
  }
1057
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1058
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1059
 
1060
+ if(remove_query_arg(array('code','state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Wordpress'){
1061
+ $postData = array(
1062
+ 'grant_type' => 'authorization_code',
1063
+ 'code' => sanitize_text_field($_GET['code']),
1064
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Wordpress",
1065
+ 'client_id' => $theChampLoginOptions['wordpress_client_id'],
1066
+ 'client_secret' => $theChampLoginOptions['wordpress_client_secret']
1067
+ );
1068
+ $response = wp_remote_post("https://public-api.wordpress.com/oauth2/token", array(
1069
+ 'method' => 'POST',
1070
+ 'timeout' => 15,
1071
+ 'redirection' => 5,
1072
+ 'httpversion' => '1.0',
1073
+ 'sslverify' => false,
1074
+ 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1075
+ 'body' => http_build_query($postData)
1076
+ )
1077
+ );
1078
+
1079
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1080
+ $body = json_decode(wp_remote_retrieve_body($response));
1081
+ $authorization = "Bearer ".$body->access_token;
1082
+
1083
+ $response = wp_remote_get("https://public-api.wordpress.com/rest/v1/me/", array('timeout' => 15, 'headers' => array('Accept' => 'application/json', 'Authorization' => $authorization )));
1084
+
1085
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1086
+ $profileData = json_decode(wp_remote_retrieve_body($response));
1087
 
1088
+ if(is_object($profileData) && isset($profileData->ID)){
1089
+ $profileData = the_champ_sanitize_profile_data($profileData, 'wordpress');
1090
+ $wordpressLoginState = sanitize_text_field($_GET['state']);
1091
+ $wordpressRedirectUrl = get_user_meta($wordpressLoginState, 'super_socializer_redirect_to', true);
1092
+ $response = the_champ_user_auth($profileData, 'wordpress', $wordpressRedirectUrl);
1093
+ if($response == 'show form'){
1094
+ return;
1095
+ }
1096
+ delete_user_meta($wordpressLoginState, 'super_socializer_redirect_to', true);
1097
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1098
+ $redirectTo = the_champ_get_login_redirection_url($wordpressRedirectUrl, true);
1099
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1100
+ $redirectTo = $wordpressRedirectUrl.(strpos($wordpressRedirectUrl, '?') !== false ? '&' : '?').'linked=1';
1101
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1102
+ $redirectTo = $wordpressRedirectUrl.(strpos($wordpressRedirectUrl, '?') !== false ? '&' : '?').'linked=0';
1103
+ }elseif(isset($response['url']) && $response['url'] != ''){
1104
+ $redirectTo = $response['url'];
1105
+ }else{
1106
+ $redirectTo = the_champ_get_login_redirection_url($wordpressRedirectUrl);
1107
+ }
1108
+ the_champ_close_login_popup($redirectTo);
1109
  }
1110
+
1111
+ }
1112
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1113
  }
 
1114
 
1115
+ if(remove_query_arg(array('code', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Live'){
1116
+ $postData = array(
1117
+ 'grant_type' => 'authorization_code',
1118
+ 'code' => sanitize_text_field($_GET['code']),
1119
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Live",
1120
+ 'client_id' => $theChampLoginOptions['live_channel_id'],
1121
+ 'client_secret' => $theChampLoginOptions['live_channel_secret']
1122
+ );
1123
+ $response = wp_remote_post("https://login.live.com/oauth20_token.srf", array(
1124
  'method' => 'POST',
1125
  'timeout' => 15,
1126
  'redirection' => 5,
1128
  'sslverify' => false,
1129
  'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1130
  'body' => http_build_query($postData)
1131
+ )
1132
+ );
 
 
 
 
 
 
 
1133
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1134
+ $body = json_decode(wp_remote_retrieve_body($response));
1135
+
1136
+ $response = wp_remote_get("https://apis.live.net/v5.0/me?access_token=".$body->access_token, array('timeout' => 15));
1137
+
1138
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1139
+ $profileData = json_decode(wp_remote_retrieve_body($response ));
1140
+
1141
+ if(is_object($profileData) && isset($profileData->id)){
1142
+ $profileData = the_champ_sanitize_profile_data($profileData, 'microsoft');
1143
+ $liveLoginState = sanitize_text_field($_GET['state']);
1144
+ $liveRedirectUrl = get_user_meta($liveLoginState, 'super_socializer_redirect_to', true);
1145
+ $response = the_champ_user_auth($profileData, 'microsoft', $liveRedirectUrl);
1146
+ if($response == 'show form'){
1147
+ return;
1148
+ }
1149
+ delete_user_meta($liveLoginState, 'super_socializer_redirect_to');
1150
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1151
+ $redirectTo = the_champ_get_login_redirection_url($liveRedirectUrl, true);
1152
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1153
+ $redirectTo = $liveRedirectUrl.(strpos($liveRedirectUrl, '?') !== false ? '&' : '?').'linked=1';
1154
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1155
+ $redirectTo = $liveRedirectUrl.(strpos($liveRedirectUrl, '?') !== false ? '&' : '?').'linked=0';
1156
+ }elseif(isset($response['url']) && $response['url'] != ''){
1157
+ $redirectTo = $response['url'];
1158
+ }else{
1159
+ $redirectTo = the_champ_get_login_redirection_url($liveRedirectUrl);
1160
+ }
1161
+ the_champ_close_login_popup($redirectTo);
1162
  }
1163
+
1164
+ }
1165
+ }
 
 
 
 
 
 
 
 
 
 
 
 
1166
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1167
 
1168
+ if(remove_query_arg(array('code', 'scope', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Twitch'){
1169
+ $postData = array(
1170
+ 'grant_type' => 'authorization_code',
1171
+ 'code' => sanitize_text_field($_GET['code']),
1172
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Twitch",
1173
+ 'client_id' => $theChampLoginOptions['twitch_client_id'],
1174
+ 'client_secret' => $theChampLoginOptions['twitch_client_secret']
1175
+ );
1176
+ $response = wp_remote_post("https://id.twitch.tv/oauth2/token", array(
1177
+ 'method' => 'POST',
1178
+ 'timeout' => 15,
1179
+ 'redirection' => 5,
1180
+ 'httpversion' => '1.0',
1181
+ 'sslverify' => false,
1182
+ 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1183
+ 'body' => http_build_query($postData)
1184
+ )
1185
+ );
1186
+
1187
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1188
+ $body = json_decode(wp_remote_retrieve_body($response));
1189
+ $authorization = "Bearer ".$body->access_token;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1190
 
1191
+ $response = wp_remote_get("https://api.twitch.tv/helix/users", array('timeout' => 15, 'headers' => array('Content-Type' => 'application/json' ,'Authorization' => 'Bearer ' . $body->access_token , 'Client-Id' => $theChampLoginOptions['twitch_client_id'])
1192
+ ));
1193
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1194
+ $profileData = json_decode(wp_remote_retrieve_body($response ));
1195
+
1196
+ if(is_object($profileData) && isset($profileData->data) && is_array($profileData->data) && isset($profileData->data[0]) && isset($profileData->data[0]->id)){
1197
+ $profileData = the_champ_sanitize_profile_data($profileData->data[0], 'twitch');
1198
+ $twitchLoginState = sanitize_text_field($_GET['state']);
1199
+ $twitchRedirectUrl = get_user_meta($twitchLoginState, 'super_socializer_redirect_to', true);
1200
+ $response = the_champ_user_auth($profileData, 'twitch', $twitchRedirectUrl);
1201
+ if($response == 'show form'){
1202
+ return;
1203
+ }
1204
+ delete_user_meta($twitchLoginState, 'super_socializer_redirect_to', true);
1205
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1206
+ $redirectTo = the_champ_get_login_redirection_url($twitchRedirectUrl, true);
1207
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1208
+ $redirectTo = $twitchRedirectUrl . (strpos($twitchRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1209
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1210
+ $redirectTo = $twitchRedirectUrl . (strpos($twitchRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1211
+ }elseif(isset($response['url']) && $response['url'] != ''){
1212
+ $redirectTo = $response['url'];
1213
+ }else{
1214
+ $redirectTo = the_champ_get_login_redirection_url($twitchRedirectUrl);
1215
+ }
1216
+ the_champ_close_login_popup($redirectTo);
1217
+ }
1218
+ }
1219
+ }
1220
+ }
1221
+ if(remove_query_arg(array(
1222
+ 'code',
1223
+ 'state',
1224
+ 'scope'
1225
+ ), esc_url_raw(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])) == home_url() . '/SuperSocializerAuth/Reddit'){
1226
+ $postData = array(
1227
+ 'grant_type' => 'authorization_code',
1228
+ 'code' => sanitize_text_field($_GET['code']),
1229
+ 'redirect_uri' => home_url() . "/SuperSocializerAuth/Reddit",
1230
+ 'client_id' => $theChampLoginOptions['reddit_client_id'],
1231
+ 'client_secret' => $theChampLoginOptions['reddit_client_secret']
1232
+ );
1233
+ $response = wp_remote_post("https://www.reddit.com/api/v1/access_token", array(
1234
+ 'timeout' => 15,
1235
+ 'redirection' => 5,
1236
+ 'httpversion' => '1.0',
1237
+ 'sslverify' => false,
1238
+ 'headers' => array(
1239
+ 'Content-Type' => 'application/x-www-form-urlencoded',
1240
+ 'Authorization' => 'Basic ' . base64_encode($theChampLoginOptions['reddit_client_id'] . ':' . $theChampLoginOptions['reddit_client_secret'])
1241
+ ),
1242
+ 'body' => http_build_query($postData)
1243
+ ));
1244
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1245
+ $body = json_decode(wp_remote_retrieve_body($response));
1246
+ $response = wp_remote_get("https://oauth.reddit.com/api/v1/me", array(
1247
+ 'timeout' => 15,
1248
+ 'headers' => array(
1249
+ 'Authorization' => "Bearer " . $body->access_token
1250
+ )
1251
+ ));
1252
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1253
+ $profileData = json_decode(wp_remote_retrieve_body($response));
1254
+ if(is_object($profileData) && isset($profileData->id) && isset($profileData->verified) && $profileData->verified == 1){
1255
+ $profileData = the_champ_sanitize_profile_data($profileData, 'reddit');
1256
+ $redditLoginState = sanitize_text_field($_GET['state']);
1257
+ $redditRedirectUrl = get_user_meta($redditLoginState, 'super_socializer_redirect_to', true);
1258
+ $response = the_champ_user_auth($profileData, 'reddit', $redditRedirectUrl);
1259
+ if($response == 'show form'){
1260
+ return;
1261
+ }
1262
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1263
+ $redirectTo = the_champ_get_login_redirection_url($redditRedirectUrl, true);
1264
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1265
+ $redirectTo = $redditRedirectUrl . (strpos($redditRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1266
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1267
+ $redirectTo = $redditRedirectUrl . (strpos($redditRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1268
+ }elseif(isset($response['url']) && $response['url'] != ''){
1269
+ $redirectTo = $response['url'];
1270
+ } else {
1271
+ $redirectTo = the_champ_get_login_redirection_url($redditRedirectUrl);
1272
+ }
1273
+ the_champ_close_login_popup($redirectTo);
1274
+ }
1275
+ }
1276
+ }
1277
  }
 
1278
 
1279
+ if(remove_query_arg(array(
1280
+ 'code',
1281
+ 'scope',
1282
+ 'state'
1283
+ ), esc_url_raw(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])) == home_url() . '/SuperSocializerAuth/Disqus'){
1284
+ $postData = array(
1285
+ 'grant_type' => 'authorization_code',
1286
+ 'code' => sanitize_text_field($_GET['code']),
1287
+ 'redirect_uri' => home_url() . "/SuperSocializerAuth/Disqus",
1288
+ 'client_id' => $theChampLoginOptions['disqus_public_key'],
1289
+ 'client_secret' => $theChampLoginOptions['disqus_secret_key']
1290
+ );
1291
+ $response = wp_remote_post("https://disqus.com/api/oauth/2.0/access_token/", array(
1292
+ 'timeout' => 15,
1293
+ 'redirection' => 5,
1294
+ 'httpversion' => '1.0',
1295
+ 'sslverify' => false,
1296
+ 'headers' => array(
1297
+ 'Content-Type' => 'application/x-www-form-urlencoded',
1298
+ 'Authorization' => 'Basic ' . base64_encode($theChampLoginOptions['disqus_public_key'] . ':' . $theChampLoginOptions['disqus_secret_key'])
1299
+ ),
1300
+ 'body' => http_build_query($postData)
1301
+ ));
1302
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1303
+ $body = json_decode(wp_remote_retrieve_body($response));
1304
+ $response = wp_remote_get("https://disqus.com/api/3.0/users/details.json?api_key=" . $theChampLoginOptions['disqus_public_key'], array(
1305
+ 'timeout' => 15,
1306
+ 'headers' => array(
1307
+ 'Authorization' => "Bearer " . $body->access_token
1308
+ )
1309
+ ));
1310
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1311
+ $profileData = json_decode(wp_remote_retrieve_body($response));
1312
+ if(is_object($profileData) && isset($profileData->response->id)){
1313
+ $profileData = the_champ_sanitize_profile_data($profileData, 'disqus');
1314
+ $disqusLoginState = sanitize_text_field($_GET['state']);
1315
+ $disqusRedirectUrl = get_user_meta($disqusLoginState, 'super_socializer_redirect_to', true);
1316
+ $response = the_champ_user_auth($profileData, 'disqus', $disqusRedirectUrl);
1317
+ if($response == 'show form'){
1318
+ return;
1319
+ }
1320
+ delete_user_meta($disqusLoginState, 'super_socializer_redirect_to', true);
1321
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1322
+ $redirectTo = the_champ_get_login_redirection_url($disqusRedirectUrl, true);
1323
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1324
+ $redirectTo = $disqusRedirectUrl . (strpos($disqusRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1325
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1326
+ $redirectTo = $disqusRedirectUrl . (strpos($disqusRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1327
+ }elseif(isset($response['url']) && $response['url'] != ''){
1328
+ $redirectTo = $response['url'];
1329
+ } else {
1330
+ $redirectTo = the_champ_get_login_redirection_url($disqusRedirectUrl);
1331
+ }
1332
+ the_champ_close_login_popup($redirectTo);
1333
+ }
1334
+ }
1335
+ }
1336
+ }
1337
+ if(remove_query_arg(array(
1338
+ 'code',
1339
+ 'scope',
1340
+ 'state'
1341
+ ), esc_url_raw(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])) == home_url() . '/SuperSocializerAuth/Dropbox'){
1342
+ $postData = array(
1343
+ 'grant_type' => 'authorization_code',
1344
+ 'code' => sanitize_text_field($_GET['code']),
1345
+ 'redirect_uri' => home_url() . "/SuperSocializerAuth/Dropbox"
1346
+ );
1347
+ $response = wp_remote_post("https://api.dropbox.com/1/oauth2/token", array(
1348
+ 'method' => 'POST',
1349
+ 'timeout' => 15,
1350
+ 'redirection' => 5,
1351
+ 'httpversion' => '1.0',
1352
+ 'sslverify' => false,
1353
+ 'headers' => array(
1354
+ 'Content-Type' => 'application/x-www-form-urlencoded',
1355
+ 'Authorization' => 'Basic ' . base64_encode($theChampLoginOptions['dropbox_app_key'] . ':' . $theChampLoginOptions['dropbox_app_secret'])
1356
+ ),
1357
+ 'body' => http_build_query($postData)
1358
+ ));
1359
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1360
+ $body = json_decode(wp_remote_retrieve_body($response));
1361
+ $response = wp_remote_post("https://api.dropbox.com/2/users/get_current_account", array(
1362
+ 'timeout' => 15,
1363
+ 'headers' => array(
1364
+ 'content-type' => 'application/json',
1365
+ 'Authorization' => "Bearer " . $body->access_token
1366
+ ),
1367
+ 'body' => "null"
1368
+ ));
1369
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1370
+ $profileData = json_decode(wp_remote_retrieve_body($response));
1371
+ if(is_object($profileData) && isset($profileData->account_id)){
1372
+ $profileData = the_champ_sanitize_profile_data($profileData, 'dropbox');
1373
+ $dropboxLoginState = sanitize_text_field($_GET['state']);
1374
+ $dropboxRedirectUrl = get_user_meta($dropboxLoginState, 'super_socializer_redirect_to', true);
1375
+ $response = the_champ_user_auth($profileData, 'dropbox', $dropboxRedirectUrl);
1376
+ if($response == 'show form'){
1377
+ return;
1378
+ }
1379
+ delete_user_meta($dropboxLoginState, 'super_socializer_redirect_to', true);
1380
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1381
+ $redirectTo = the_champ_get_login_redirection_url($dropboxRedirectUrl, true);
1382
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1383
+ $redirectTo = $dropboxRedirectUrl . (strpos($dropboxRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1384
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1385
+ $redirectTo = $dropboxRedirectUrl . (strpos($dropboxRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1386
+ }elseif(isset($response['url']) && $response['url'] != ''){
1387
+ $redirectTo = $response['url'];
1388
+ } else {
1389
+ $redirectTo = the_champ_get_login_redirection_url($dropboxRedirectUrl);
1390
+ }
1391
+ the_champ_close_login_popup($redirectTo);
1392
+ }
1393
+ }
1394
+ }
1395
+ }
1396
+
1397
+ if(remove_query_arg(array(
1398
+ 'code', 'state'
1399
+ ), esc_url_raw(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])) == home_url() . '/SuperSocializerAuth/Foursquare'){
1400
+ $postData = array(
1401
+ 'grant_type' => 'authorization_code',
1402
+ 'code' => sanitize_text_field($_GET['code']),
1403
+ 'redirect_uri' => home_url() . "/SuperSocializerAuth/Foursquare",
1404
+ 'client_id' => $theChampLoginOptions['foursquare_client_id'],
1405
+ 'client_secret' => $theChampLoginOptions['foursquare_client_secret']
1406
+ );
1407
+ $response = wp_remote_post("https://foursquare.com/oauth2/access_token", array(
1408
+ 'timeout' => 15,
1409
+ 'redirection' => 5,
1410
+ 'httpversion' => '1.0',
1411
+ 'sslverify' => false,
1412
+ 'headers' => array(
1413
+ 'Content-Type' => 'application/x-www-form-urlencoded',
1414
+ 'Authorization' => 'Basic ' . base64_encode($theChampLoginOptions['foursquare_client_id'] . ':' . $theChampLoginOptions['foursquare_client_secret'])
1415
+ ),
1416
+ 'body' => http_build_query($postData)
1417
+ ));
1418
+
1419
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1420
+ $body = json_decode(wp_remote_retrieve_body($response));
1421
+ $response = wp_remote_get("https://api.foursquare.com/v2/users/self?oauth_token=" . $body->access_token . "&v=" . rand(), array(
1422
+ 'timeout' => 15,
1423
+ 'headers' => array(
1424
+ 'Authorization' => "Bearer " . $body->access_token
1425
+ )
1426
+ ));
1427
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1428
+ $profileData = json_decode(wp_remote_retrieve_body($response));
1429
+ if(is_object($profileData) && isset($profileData->response->user->id)){
1430
+ $profileData = the_champ_sanitize_profile_data($profileData, 'foursquare');
1431
+ $foursquareLoginState = sanitize_text_field($_GET['state']);
1432
+ $foursquareRedirectUrl = get_user_meta($foursquareLoginState, 'super_socializer_redirect_to', true);
1433
+ $response = the_champ_user_auth($profileData, 'foursquare', $foursquareRedirectUrl);
1434
+ if($response == 'show form'){
1435
+ return;
1436
+ }
1437
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1438
+ $redirectTo = the_champ_get_login_redirection_url($foursquareRedirectUrl, true);
1439
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1440
+ $redirectTo = $foursquareRedirectUrl . (strpos($foursquareRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1441
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1442
+ $redirectTo = $foursquareRedirectUrl . (strpos($foursquareRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1443
+ }elseif(isset($response['url']) && $response['url'] != ''){
1444
+ $redirectTo = $response['url'];
1445
+ } else {
1446
+ $redirectTo = the_champ_get_login_redirection_url($foursquareRedirectUrl);
1447
+ }
1448
+ the_champ_close_login_popup($redirectTo);
1449
+ }
1450
+ }
1451
+ }
1452
+ }
1453
 
1454
+ if(remove_query_arg(array('code', 'scope', 'state'), esc_url_raw(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"])) == home_url() . '/SuperSocializerAuth/Odnoklassniki'){
1455
+ $postData = array(
1456
+ 'grant_type' => 'authorization_code',
1457
+ 'code' => sanitize_text_field($_GET['code']),
1458
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Odnoklassniki",
1459
+ 'client_id' => $theChampLoginOptions['odnoklassniki_client_id'],
1460
+ 'client_secret' => $theChampLoginOptions['odnoklassniki_client_secret']
1461
+ );
1462
+ $response = wp_remote_post("https://api.ok.ru/oauth/token.do", array(
1463
+ 'method' => 'POST',
1464
+ 'timeout' => 15,
1465
+ 'redirection' => 5,
1466
+ 'httpversion' => '1.0',
1467
+ 'sslverify' => false,
1468
+ 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1469
+ 'body' => http_build_query($postData)
1470
+ )
1471
+ );
1472
 
1473
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1474
+ $body = json_decode(wp_remote_retrieve_body($response));
1475
+ $authorization = "Bearer " . $body->access_token;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1476
 
1477
+ $response = wp_remote_get("https://api.ok.ru/fb.do?application_key=" . $theChampLoginOptions['odnoklassniki_public_key'] . "&format=json&method=users.getCurrentUser&sig=" . mt_rand() . "&access_token=" . $body->access_token, array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization)));
1478
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1479
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1480
  $profileData = json_decode(wp_remote_retrieve_body($response));
1481
+
1482
+ if(is_object($profileData) && isset($profileData->uid)){
1483
+ $profileData = the_champ_sanitize_profile_data($profileData, 'odnoklassniki');
1484
+ $odnoklassnikiLoginState = sanitize_text_field($_GET['state']);
1485
+ $odnoklassnikiRedirectUrl = get_user_meta($odnoklassnikiLoginState, 'super_socializer_redirect_to', true);
1486
+ $response = the_champ_user_auth($profileData, 'odnoklassniki', $odnoklassnikiRedirectUrl);
1487
  if($response == 'show form'){
1488
  return;
1489
  }
1490
  if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1491
+ $redirectTo = the_champ_get_login_redirection_url($odnoklassnikiRedirectUrl, true);
1492
  }elseif(isset($response['message']) && $response['message'] == 'linked'){
1493
+ $redirectTo = $odnoklassnikiRedirectUrl . (strpos($odnoklassnikiRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1494
  }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1495
+ $redirectTo = $odnoklassnikiRedirectUrl . (strpos($odnoklassnikiRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1496
  }elseif(isset($response['url']) && $response['url'] != ''){
1497
  $redirectTo = $response['url'];
1498
  }else{
1499
+ $redirectTo = the_champ_get_login_redirection_url($odnoklassnikiRedirectUrl);
1500
  }
1501
  the_champ_close_login_popup($redirectTo);
1502
+ }
1503
  }
1504
  }
1505
  }
 
1506
 
1507
+ if(remove_query_arg(array('code','scope', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Dribbble'){
1508
+ $postData = array(
1509
+ 'grant_type' => 'authorization_code',
1510
+ 'code' => sanitize_text_field($_GET['code']),
1511
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Dribbble",
1512
+ 'client_id' => $theChampLoginOptions['dribbble_client_id'],
1513
+ 'client_secret' => $theChampLoginOptions['dribbble_client_secret']
1514
+ );
1515
+ $response = wp_remote_post("https://dribbble.com/oauth/token", array(
1516
+ 'method' => 'POST',
1517
+ 'timeout' => 15,
1518
+ 'redirection' => 5,
1519
+ 'httpversion' => '1.0',
1520
+ 'sslverify' => false,
1521
+ 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1522
+ 'body' => http_build_query($postData)
1523
+ )
1524
+ );
1525
+
1526
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1527
+ $body = json_decode(wp_remote_retrieve_body($response));
 
 
 
 
 
 
 
 
 
 
 
 
 
1528
  $authorization = "Bearer ".$body->access_token;
1529
+
1530
+ $response = wp_remote_get("https://api.dribbble.com/v2/user?access_token", array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization )));
1531
+
1532
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1533
  $profileData = json_decode(wp_remote_retrieve_body($response));
1534
+ if(is_object($profileData) && isset($profileData->id)){
1535
+ $profileData = the_champ_sanitize_profile_data($profileData, 'dribbble');
1536
+ $dribbbleLoginState = sanitize_text_field($_GET['state']);
1537
+ $dribbbleRedirectUrl = get_user_meta($dribbbleLoginState, 'super_socializer_redirect_to', true);
1538
+ $response = the_champ_user_auth($profileData, 'dribbble', $dribbbleRedirectUrl);
1539
  if($response == 'show form'){
1540
  return;
1541
  }
1542
  if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1543
+ $redirectTo = the_champ_get_login_redirection_url($dribbbleRedirectUrl, true);
1544
  }elseif(isset($response['message']) && $response['message'] == 'linked'){
1545
+ $redirectTo = $dribbbleRedirectUrl . (strpos($dribbbleRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1546
  }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1547
+ $redirectTo = $dribbbleRedirectUrl . (strpos($dribbbleRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1548
  }elseif(isset($response['url']) && $response['url'] != ''){
1549
  $redirectTo = $response['url'];
1550
  }else{
1551
+ $redirectTo = the_champ_get_login_redirection_url($dribbbleRedirectUrl);
1552
  }
1553
  the_champ_close_login_popup($redirectTo);
1554
+ }
1555
  }
1556
  }
1557
  }
 
1558
 
1559
+ if(remove_query_arg(array('code', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Yandex'){
1560
+ $postData = array(
1561
+ 'grant_type' => 'authorization_code',
1562
+ 'code' => sanitize_text_field($_GET['code']),
1563
+ 'state' => sanitize_text_field($_GET['state']),
1564
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Yandex",
1565
+ 'client_id' => $theChampLoginOptions['yandex_client_id'],
1566
+ 'client_secret' => $theChampLoginOptions['yandex_client_secret']
1567
+ );
1568
+ $response = wp_remote_post("https://oauth.yandex.com/token", array(
1569
+ 'method' => 'POST',
1570
+ 'timeout' => 15,
1571
+ 'redirection' => 5,
1572
+ 'httpversion' => '1.0',
1573
+ 'sslverify' => false,
1574
+ 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1575
+ 'body' => http_build_query($postData)
1576
+ )
1577
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1578
 
1579
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1580
+ $body = json_decode(wp_remote_retrieve_body($response));
1581
+ $authorization = "Bearer ".$body->access_token;
1582
+
1583
+ $response = wp_remote_get("https://login.yandex.ru/info", array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization )));
1584
+
1585
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1586
  $profileData = json_decode(wp_remote_retrieve_body($response));
1587
  if(is_object($profileData) && isset($profileData->id)){
1588
+ $profileData = the_champ_sanitize_profile_data($profileData, 'yandex');
1589
+ $yandexLoginState = sanitize_text_field($_GET['state']);
1590
+ $yandexRedirectUrl = get_user_meta($yandexLoginState, 'super_socializer_redirect_to', true);
1591
+ $response = the_champ_user_auth($profileData, 'yandex', $yandexRedirectUrl);
1592
+ if($response == 'show form'){
1593
+ return;
1594
+ }
1595
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1596
+ $redirectTo = the_champ_get_login_redirection_url($yandexRedirectUrl, true);
1597
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1598
+ $redirectTo = $yandexRedirectUrl . (strpos($yandexRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1599
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1600
+ $redirectTo = $yandexRedirectUrl . (strpos($yandexRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1601
+ }elseif(isset($response['url']) && $response['url'] != ''){
1602
+ $redirectTo = $response['url'];
1603
+ }else{
1604
+ $redirectTo = the_champ_get_login_redirection_url($yandexRedirectUrl);
1605
+ }
1606
+ the_champ_close_login_popup($redirectTo);
1607
+ }
1608
+ }
1609
+ }
1610
+ }
1611
+ if(remove_query_arg(array('code', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Spotify'){
1612
+ $postData = array(
1613
+ 'grant_type' => 'authorization_code',
1614
+ 'code' => sanitize_text_field($_GET['code']),
1615
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Spotify",
1616
+ 'client_id' => $theChampLoginOptions['spotify_client_id'],
1617
+ 'client_secret' => $theChampLoginOptions['spotify_client_secret']
1618
+ );
1619
+ $response = wp_remote_post("https://accounts.spotify.com/api/token", array(
1620
+ 'method' => 'POST',
1621
+ 'timeout' => 15,
1622
+ 'redirection' => 5,
1623
+ 'httpversion' => '1.0',
1624
+ 'sslverify' => false,
1625
+ 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1626
+ 'body' => http_build_query($postData)
1627
+ )
1628
+ );
1629
+
1630
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1631
+ $body = json_decode(wp_remote_retrieve_body($response));
1632
+ if(isset($body->access_token)){
1633
+ $authorization = "Bearer ".$body->access_token;
1634
+ $response = wp_remote_get('https://api.spotify.com/v1/me', array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization)));
1635
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1636
+ $profileData = json_decode(wp_remote_retrieve_body($response));
1637
+ if(is_object($profileData) && isset($profileData->id)){
1638
+ $profileData = the_champ_sanitize_profile_data($profileData, 'spotify');
1639
+ $spotifyLoginState = sanitize_text_field($_GET['state']);
1640
+ $spotifyRedirectUrl = get_user_meta($spotifyLoginState, 'super_socializer_redirect_to', true);
1641
+ $response = the_champ_user_auth($profileData, 'spotify', $spotifyRedirectUrl);
1642
  if($response == 'show form'){
1643
  return;
1644
  }
1645
  if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1646
+ $redirectTo = the_champ_get_login_redirection_url($liveRedirectUrl, true);
1647
  }elseif(isset($response['message']) && $response['message'] == 'linked'){
1648
+ $redirectTo = $spotifyRedirectUrl . (strpos($spotifyRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1649
  }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1650
+ $redirectTo = $spotifyRedirectUrl . (strpos($spotifyRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1651
  }elseif(isset($response['url']) && $response['url'] != ''){
1652
  $redirectTo = $response['url'];
1653
  }else{
1654
+ $redirectTo = the_champ_get_login_redirection_url($spotifyRedirectUrl);
1655
  }
1656
  the_champ_close_login_popup($redirectTo);
1657
  }
1658
+ }
1659
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1660
  }
 
 
1661
  }
1662
+ if(remove_query_arg(array('code','state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Kakao'){
1663
+ $postData = array(
1664
+ 'grant_type' => 'authorization_code',
1665
+ 'code' => sanitize_text_field($_GET['code']),
1666
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Kakao",
1667
+ 'client_id' => $theChampLoginOptions['kakao_client_id'],
1668
+ 'client_secret' => $theChampLoginOptions['kakao_client_secret']
1669
+ );
1670
+ $response = wp_remote_post("https://kauth.kakao.com/oauth/token", array(
1671
+ 'method' => 'POST',
1672
+ 'timeout' => 15,
1673
+ 'redirection' => 5,
1674
+ 'httpversion' => '1.0',
1675
+ 'sslverify' => false,
1676
+ 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1677
+ 'body' => http_build_query($postData)
1678
+ )
1679
+ );
1680
+
 
 
 
 
 
1681
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1682
+ $body = json_decode(wp_remote_retrieve_body($response));
1683
+ if(isset($body->access_token)){
1684
+ $authorization = "Bearer ".$body->access_token;
1685
+ $response = wp_remote_get('https://kapi.kakao.com/v2/user/me', array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization)));
1686
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1687
+ $profileData = json_decode(wp_remote_retrieve_body($response));
1688
+ if(is_object($profileData) && isset($profileData->id)){
1689
+ $profileData = the_champ_sanitize_profile_data($profileData, 'kakao');
1690
+ $kakaoLoginState = sanitize_text_field($_GET['state']);
1691
+ $kakaoRedirectUrl = get_user_meta($kakaoLoginState, 'super_socializer_redirect_to', true);
1692
+ $response = the_champ_user_auth($profileData, 'kakao', $kakaoRedirectUrl);
1693
+ if($response == 'show form'){
1694
+ return;
1695
+ }
1696
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1697
+ $redirectTo = the_champ_get_login_redirection_url($kakaoRedirectUrl, true);
1698
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1699
+ $redirectTo = $kakaoRedirectUrl . (strpos($kakaoRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1700
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1701
+ $redirectTo = $kakaoRedirectUrl . (strpos($kakaoRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1702
+ }elseif(isset($response['url']) && $response['url'] != ''){
1703
+ $redirectTo = $response['url'];
1704
+ }else{
1705
+ $redirectTo = the_champ_get_login_redirection_url($kakaoRedirectUrl);
1706
+ }
1707
+ the_champ_close_login_popup($redirectTo);
1708
+ }
1709
  }
1710
+ }
 
1711
  }
1712
+ }
1713
+ if(remove_query_arg(array('code','state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Github'){
1714
+ $postData = array(
1715
+ 'state' => 'state',
1716
+ 'code' => sanitize_text_field($_GET['code']),
1717
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Github",
1718
+ 'client_id' => $theChampLoginOptions['github_client_id'],
1719
+ 'client_secret' => $theChampLoginOptions['github_client_secret']
1720
+ );
1721
+ $response = wp_remote_post("https://github.com/login/oauth/access_token", array(
1722
+ 'method' => 'POST',
1723
+ 'timeout' => 15,
1724
+ 'redirection' => 5,
1725
+ 'httpversion' => '1.0',
1726
+ 'sslverify' => false,
1727
+ 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => 'Basic ' . base64_encode($theChampLoginOptions['github_client_id'] . ':' . $theChampLoginOptions['github_client_secret'])),
1728
+ 'body' => $postData
1729
+ )
1730
+ );
1731
 
1732
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1733
+ $body = wp_remote_retrieve_body($response);
1734
+ $bodyParts = explode('&', $body);
1735
+ $accessTokenParts = explode('=', $bodyParts[0]);
1736
+
1737
+ if(count($accessTokenParts) == 2){
1738
+ $authorization = "token ".$accessTokenParts[1];
1739
+ $response = wp_remote_get('https://api.github.com/user', array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization)));
1740
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1741
+ $profileData = json_decode(wp_remote_retrieve_body($response));
1742
+ if(is_object($profileData) && isset($profileData->id)){
1743
+ $emailsResponse = wp_remote_get('https://api.github.com/user/emails', array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization)));
1744
+ if(!is_wp_error($emailsResponse) && isset($emailsResponse['response']['code']) && 200 === $emailsResponse['response']['code']){
1745
+ $emails = json_decode(wp_remote_retrieve_body($emailsResponse ));
1746
+ if(is_array($emails)){
1747
+ foreach($emails as $email){
1748
+ if(isset($email->primary) && isset($email->verified) && $email->primary == 1 && $email->verified == 1 && !empty($email->email)){
1749
+ $profileData = (array)$profileData;
1750
+ $profileData['email'] = $email->email;
1751
+ $profileData = (object)$profileData;
1752
+ break;
1753
+ }
1754
+ }
1755
+ }
1756
+ $profileData = the_champ_sanitize_profile_data($profileData, 'github');
1757
+ $githubLoginState = sanitize_text_field($_GET['state']);
1758
+ $githubRedirectUrl = get_user_meta($githubLoginState, 'super_socializer_redirect_to', true);
1759
+ $response = the_champ_user_auth($profileData, 'github', $githubRedirectUrl);
1760
+ if($response == 'show form'){
1761
+ return;
1762
+ }
1763
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1764
+ $redirectTo = the_champ_get_login_redirection_url($githubRedirectUrl, true);
1765
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1766
+ $redirectTo = $githubRedirectUrl . (strpos($githubRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1767
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1768
+ $redirectTo = $githubRedirectUrl . (strpos($githublRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1769
+ }elseif(isset($response['url']) && $response['url'] != ''){
1770
+ $redirectTo = $response['url'];
1771
+ }else{
1772
+ $redirectTo = the_champ_get_login_redirection_url($githubRedirectUrl);
1773
+ }
1774
+ the_champ_close_login_popup($redirectTo);
1775
+ }
1776
+ }
1777
+ }
1778
+ }
1779
  }
 
 
1780
  }
1781
+ if(remove_query_arg(array('code','scope', 'state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Amazon'){
1782
+ $postData = array(
1783
+ 'grant_type' => 'authorization_code',
1784
+ 'code' => sanitize_text_field($_GET['code']),
1785
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Amazon",
1786
+ 'client_id' => $theChampLoginOptions['amazon_client_id'],
1787
+ 'client_secret' => $theChampLoginOptions['amazon_client_secret']
1788
+ );
1789
+ $response = wp_remote_post("https://api.amazon.com/auth/o2/token", array(
1790
+ 'method' => 'POST',
1791
+ 'timeout' => 15,
1792
+ 'redirection' => 5,
1793
+ 'httpversion' => '1.0',
1794
+ 'sslverify' => false,
1795
+ 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
1796
+ 'body' => http_build_query($postData)
1797
+ )
1798
+ );
1799
+
 
 
 
 
 
 
 
 
 
 
 
1800
  if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1801
+ $body = json_decode(wp_remote_retrieve_body($response));
1802
+ $authorization = "Bearer ".$body->access_token;
1803
+ $response = wp_remote_get("https://api.amazon.com/user/profile", array('timeout' => 15, 'headers' => array('Accept' => 'application/json' , 'Authorization' => $authorization )));
1804
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1805
+ $profileData = json_decode(wp_remote_retrieve_body($response));
1806
+ if(is_object($profileData) && isset($profileData->user_id)){
1807
+ $profileData = the_champ_sanitize_profile_data($profileData, 'amazon');
1808
+ $amazonLoginState = sanitize_text_field($_GET['state']);
1809
+ $amazonRedirectUrl = get_user_meta($amazonLoginState, 'super_socializer_redirect_to', true);
1810
+ $response = the_champ_user_auth($profileData, 'amazon', $amazonRedirectUrl);
1811
+ if($response == 'show form'){
1812
+ return;
1813
+ }
1814
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1815
+ $redirectTo = the_champ_get_login_redirection_url($amazonRedirectUrl, true);
1816
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1817
+ $redirectTo = $amazonRedirectUrl . (strpos($amazonRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1818
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1819
+ $redirectTo = $amazonRedirectUrl . (strpos($amazonRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1820
+ }elseif(isset($response['url']) && $response['url'] != ''){
1821
+ $redirectTo = $response['url'];
1822
+ }else{
1823
+ $redirectTo = the_champ_get_login_redirection_url($amazonRedirectUrl);
1824
+ }
1825
+ the_champ_close_login_popup($redirectTo);
1826
+ }
1827
+ }
1828
+ }
1829
+ }
1830
+ if(remove_query_arg(array('code','scope','state'), esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])) == home_url().'/SuperSocializerAuth/Stackoverflow'){
1831
+ $postData = array(
1832
+ 'grant_type' => 'authorization_code',
1833
+ 'code' => sanitize_text_field($_GET['code']),
1834
+ 'redirect_uri' => home_url()."/SuperSocializerAuth/Stackoverflow",
1835
+ 'client_id' => $theChampLoginOptions['stackoverflow_client_id'],
1836
+ 'client_secret' => $theChampLoginOptions['stackoverflow_client_secret']
1837
+ );
1838
+ $response = wp_remote_post("https://stackexchange.com/oauth/access_token", array(
1839
+ 'method' => 'POST',
1840
+ 'timeout' => 15,
1841
+ 'redirection' => 5,
1842
+ 'httpversion' => '1.0',
1843
+ 'sslverify' => false,
1844
+ 'headers' => array(
1845
+ 'Content-Type' => 'application/x-www-form-urlencoded',
1846
+ 'Authorization' => 'Basic ' .base64_encode($theChampLoginOptions['stackoverflow_client_id']. ':' .$theChampLoginOptions['stackoverflow_client_secret'])
1847
+ ),
1848
+ 'body' => http_build_query($postData)
1849
+ ));
1850
+
1851
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1852
+ $body = wp_remote_retrieve_body($response);
1853
+ $k = explode('&', $body);
1854
+ $r = explode('=', $k[0]);
1855
+ $response = wp_remote_get("https://api.stackexchange.com/2.2/me?site=stackoverflow&access_token=".$r[1]."&key=".$theChampLoginOptions['stackoverflow_key'], array(
1856
+ 'timeout' => 15,
1857
+ 'headers' => array('content-type' =>'application/json')
1858
+ ));
1859
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1860
+ $profileData = json_decode(wp_remote_retrieve_body($response));
1861
+ if(is_object($profileData) && isset($profileData->items[0]->account_id)){
1862
+ $profileData = the_champ_sanitize_profile_data($profileData->items[0], 'stackoverflow');
1863
+ $stackoverflowLoginState = sanitize_text_field($_GET['state']);
1864
+ $stackoverflowRedirectUrl = get_user_meta($stackoverflowLoginState, 'super_socializer_redirect_to', true);
1865
+ $response = the_champ_user_auth($profileData, 'stackoverflow', $stackoverflowRedirectUrl);
1866
+ if($response == 'show form'){
1867
+ return;
1868
+ }
1869
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1870
+ $redirectTo = the_champ_get_login_redirection_url($stackoverflowRedirectUrl, true);
1871
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1872
+ $redirectTo = $stackoverflowRedirectUrl . (strpos($stackoverflowRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1873
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1874
+ $redirectTo = $stackoverflowRedirectUrl . (strpos($stackoverflowRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1875
+ }elseif(isset($response['url']) && $response['url'] != ''){
1876
+ $redirectTo = $response['url'];
1877
+ }else{
1878
+ $redirectTo = the_champ_get_login_redirection_url($stackoverflowRedirectUrl);
1879
+ }
1880
+ the_champ_close_login_popup($redirectTo);
1881
+ }
1882
+ }
1883
  }
1884
  }
1885
+
1886
+ // Google
1887
+ $postData = array(
1888
+ 'grant_type' => 'authorization_code',
1889
+ 'code' => sanitize_text_field($_GET['code']),
1890
+ 'redirect_uri' => home_url(),
1891
+ 'client_id' => $theChampLoginOptions['google_key'],
1892
+ 'client_secret' => $theChampLoginOptions['google_secret']
1893
+ );
1894
+ $response = wp_remote_post("https://accounts.google.com/o/oauth2/token", array(
1895
+ 'method' => 'POST',
1896
+ 'timeout' => 15,
1897
+ 'redirection' => 5,
1898
+ 'httpversion' => '1.0',
1899
+ 'sslverify' => false,
1900
+ 'headers' => array(
1901
+ 'Content-Type' => 'application/x-www-form-urlencoded'
1902
+ ),
1903
+ 'body' => http_build_query($postData)
1904
+ ));
1905
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1906
+ $body = json_decode(wp_remote_retrieve_body($response));
1907
+ if(isset($body->access_token)){
1908
+ $authorization = "Bearer " . $body->access_token;
1909
+ $response = wp_remote_get('https://www.googleapis.com/oauth2/v3/userinfo', array(
1910
+ 'timeout' => 15,
1911
+ 'headers' => array(
1912
+ 'Accept' => 'application/json',
1913
+ 'Authorization' => $authorization
1914
+ )
1915
+ ));
1916
+ if(!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']){
1917
+ $profileData = json_decode(wp_remote_retrieve_body($response));
1918
+ if(is_object($profileData) && isset($profileData->sub)){
1919
+ $profileData = the_champ_sanitize_profile_data($profileData, 'google');
1920
+ $googleLoginState = sanitize_text_field($_GET['state']);
1921
+ $googleRedirectUrl = get_user_meta($googleLoginState, 'super_socializer_redirect_to', true);
1922
+ $response = the_champ_user_auth($profileData, 'google', $googleRedirectUrl);
1923
+ if($response == 'show form'){
1924
+ return;
1925
+ }
1926
+ if(is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')){
1927
+ $redirectTo = the_champ_get_login_redirection_url($googleRedirectUrl, true);
1928
+ }elseif(isset($response['message']) && $response['message'] == 'linked'){
1929
+ $redirectTo = $googleRedirectUrl . (strpos($googleRedirectUrl, '?') !== false ? '&' : '?') . 'linked=1';
1930
+ }elseif(isset($response['message']) && $response['message'] == 'not linked'){
1931
+ $redirectTo = $googleRedirectUrl . (strpos($googleRedirectUrl, '?') !== false ? '&' : '?') . 'linked=0';
1932
+ }elseif(isset($response['url']) && $response['url'] != ''){
1933
+ $redirectTo = $response['url'];
1934
+ } else {
1935
+ $redirectTo = the_champ_get_login_redirection_url($googleRedirectUrl);
1936
+ }
1937
+ the_champ_close_login_popup($redirectTo);
1938
+ }
1939
+ }
1940
+ }
1941
+ }
1942
+ }
1943
 
1944
+ if(isset($_GET['code']) && !isset($_GET['SuperSocializerAuth'])){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1945
  if(function_exists('session_start')){
1946
  if(session_status() == PHP_SESSION_NONE){
1947
  session_start();
1954
  'redirect_uri' => home_url()
1955
  ));
1956
  $heateorSsVkontakte->setScope(array('email'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1957
  if(isset($heateorSsVkontakte)){
1958
  $heateorSsVkontakte->authenticate($_GET['code']);
1959
  $userId = $heateorSsVkontakte->getUserId();
1995
  }
1996
  }
1997
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1998
  // twitter authentication
1999
  if(isset($_REQUEST['oauth_token']) && isset($_REQUEST['oauth_verifier'])){
2000
  global $wpdb;
2237
  }elseif(isset($post->ID) && $post->ID){
2238
  $commentUrl = get_permalink($post->ID);
2239
  }else{
2240
+ $commentUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
2241
  }
2242
 
2243
  $commentingTabsOrder = ($theChampFacebookOptions['commenting_order'] != '' ? $theChampFacebookOptions['commenting_order'] : 'wordpress,facebook,disqus');
2290
  <?php
2291
  if(isset($theChampSharingOptions['horizontal_re_providers']) && (isset($theChampSharingOptions['horizontal_more']) || in_array('Copy_Link', $theChampSharingOptions['horizontal_re_providers']))){
2292
  $postId = 0;
2293
+ $postUrl = esc_url_raw(the_champ_get_http().$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
2294
  if(isset($theChampSharingOptions['horizontal_target_url'])){
2295
  if($theChampSharingOptions['horizontal_target_url'] == 'default'){
2296
  if($post){
2658
  update_user_meta($user_id, 'thechamp_avatar', esc_url(trim($_POST['the_champ_small_avatar'])));
2659
  }
2660
  if((!isset($_POST['heateor_ss_gdpr_consent']) || $_POST['heateor_ss_gdpr_consent'] == 'yes') && isset($_POST['the_champ_large_avatar'])){
2661
+ update_user_meta($user_id, 'thechamp_large_avatar', esc_url_raw($_POST['the_champ_large_avatar']));
2662
  }
2663
  if(isset($_POST['ss_dontupdate_avatar'])){
2664
  update_user_meta($user_id, 'thechamp_dontupdate_avatar', intval($_POST['ss_dontupdate_avatar']));