Social Login - Version 3.1

Version Description

  • SSL detection improved
  • Buddypress avatars improved
Download this release

Release Info

Developer ClaudeSchlesser
Plugin Icon 128x128 Social Login
Version 3.1
Comparing to
See all releases

Code changes from version 3.0 to 3.1

includes/toolbox.php CHANGED
@@ -37,22 +37,34 @@ function oa_social_login_add_site_css ()
37
 
38
 
39
  /**
40
- * Check if the current connection is over https
41
  */
42
  function oa_social_login_https_on()
43
  {
44
- if ( ! empty ($_SERVER ['SERVER_PORT']) AND $_SERVER ['SERVER_PORT'] == '443')
45
  {
46
- return true;
 
 
 
47
  }
48
- elseif ( ! empty ($_SERVER ['HTTP_X_FORWARDED_PROTO']) AND strtolower($_SERVER ['HTTP_X_FORWARDED_PROTO']) == 'https')
 
49
  {
50
- return true;
 
 
 
51
  }
52
- elseif ( ! empty ($_SERVER ['HTTPS']) AND strtolower($_SERVER ['HTTPS']) == 'on')
 
53
  {
54
- return true;
 
 
 
55
  }
 
56
  return false;
57
  }
58
 
37
 
38
 
39
  /**
40
+ * Check if the current connection is being made over https
41
  */
42
  function oa_social_login_https_on()
43
  {
44
+ if ( ! empty ($_SERVER ['SERVER_PORT']))
45
  {
46
+ if (trim($_SERVER ['SERVER_PORT']) == '443')
47
+ {
48
+ return true;
49
+ }
50
  }
51
+
52
+ if ( ! empty ($_SERVER ['HTTP_X_FORWARDED_PROTO']))
53
  {
54
+ if (strtolower(trim($_SERVER ['HTTP_X_FORWARDED_PROTO'])) == 'https')
55
+ {
56
+ return true;
57
+ }
58
  }
59
+
60
+ if ( ! empty ($_SERVER ['HTTPS']))
61
  {
62
+ if (strtolower(trim($_SERVER ['HTTPS'])) == 'on' OR trim($_SERVER ['HTTPS']) == '1')
63
+ {
64
+ return true;
65
+ }
66
  }
67
+
68
  return false;
69
  }
70
 
includes/user_interface.php CHANGED
@@ -32,6 +32,61 @@ function oa_social_login_shortcode_handler ($args)
32
  add_shortcode ('oa_social_login', 'oa_social_login_shortcode_handler');
33
 
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  /**
36
  * Hook to display custom avatars
37
  */
32
  add_shortcode ('oa_social_login', 'oa_social_login_shortcode_handler');
33
 
34
 
35
+ /**
36
+ * Hook to display custom avatars (Buddypress specific)
37
+ */
38
+ function oa_social_login_bp_custom_fetch_avatar($text, $args)
39
+ {
40
+ //The social login settings
41
+ static $oa_social_login_settings = null;
42
+ if (is_null ($oa_social_login_settings))
43
+ {
44
+ $oa_social_login_settings = get_option ('oa_social_login_settings');
45
+ }
46
+
47
+ //Check if avatars are enabled
48
+ if (isset ($oa_social_login_settings ['plugin_show_avatars_in_comments']) AND $oa_social_login_settings ['plugin_show_avatars_in_comments'] == '1')
49
+ {
50
+ //Check arguments
51
+ if (is_array ($args))
52
+ {
53
+ //User Object
54
+ if (! empty ($args['object']) AND strtolower ($args['object']) == 'user')
55
+ {
56
+ //User Identifier
57
+ if (! empty ($args['item_id']) AND is_numeric ($args['item_id']))
58
+ {
59
+ //Retrieve user
60
+ if (($user_data = get_userdata( $args['item_id'] )) !== false)
61
+ {
62
+ //Retrieve Avatar
63
+ if (($user_thumbnail = get_user_meta ($args['item_id'], 'oa_social_login_user_thumbnail', true)) !== false)
64
+ {
65
+ //Thumbnail retrieved
66
+ if (strlen (trim ($user_thumbnail)) > 0)
67
+ {
68
+ //Build Image tags
69
+ $img_alt = (! empty ($args['alt']) ? 'alt="'.oa_social_login_esc_attr($args['alt']).'" ' : '');
70
+ $img_alt = sprintf($img_alt, htmlspecialchars($user_data->user_login));
71
+
72
+ $img_class = ('class="'.(! empty ($args['class']) ? ($args['class'].' ') : '').'avatar-social-login" ');
73
+ $img_width = (! empty ($args['width']) ? 'width="'.$args['width'].'" ' : '');
74
+ $img_height = (! empty ($args['height']) ? 'height="'.$args['height'].'" ' : '');
75
+
76
+ //Replace
77
+ $text = preg_replace('#<img[^>]+>#i', '<img src="'.$user_thumbnail.'" '.$img_alt.$img_class.$img_height.$img_width.'/>', $text);
78
+ }
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+ return $text;
86
+ }
87
+ add_filter('bp_core_fetch_avatar', 'oa_social_login_bp_custom_fetch_avatar', 10, 2);
88
+
89
+
90
  /**
91
  * Hook to display custom avatars
92
  */
oa-social-login.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Social Login
4
  Plugin URI: http://www.oneall.com/
5
  Description: Allow your visitors to <strong>comment, login and register with 20+ social networks</strong> like Twitter, Facebook, LinkedIn, Hyves, Вконтакте, Google or Yahoo.
6
- Version: 3.0
7
  Author: Claude Schlesser
8
  Author URI: http://www.oneall.com/
9
  License: GPL2
3
  Plugin Name: Social Login
4
  Plugin URI: http://www.oneall.com/
5
  Description: Allow your visitors to <strong>comment, login and register with 20+ social networks</strong> like Twitter, Facebook, LinkedIn, Hyves, Вконтакте, Google or Yahoo.
6
+ Version: 3.1
7
  Author: Claude Schlesser
8
  Author URI: http://www.oneall.com/
9
  License: GPL2
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: ClaudeSchlesser
3
  Tags: social login, social connect, facebook login, linkedin, livejournal, google, yahoo, twitter login, openid, paypal, vkontakte, hyves, widget, plugin, social network login, comments
4
  Requires at least: 3.0
5
- Tested up to: 3.3.1
6
- Stable tag: 3.0
7
 
8
  Allow your visitors to comment and login with social networks like Twitter, Facebook, Paypal, LinkedIn, LiveJournal, OpenID, VKontakte, Google, Yahoo
9
 
@@ -39,6 +39,7 @@ login and register with social networks like Twitter, Facebook, LinkedIn, Paypal
39
  <li>Wordpress.com</li>
40
  <li>Windows Live</li>
41
  <li>StackExchange</li>
 
42
  <li>Hyves</li>
43
  <li>Mail.ru</li>
44
  <li>VKontakte (Вконтакте)</li>
@@ -112,6 +113,10 @@ http://docs.oneall.com/plugins/guide/social-login-wordpress/
112
 
113
  == Changelog ==
114
 
 
 
 
 
115
  = 3.0 =
116
  * SSL detection with nginx load-balancer fixed
117
  * CDN path bug fixed
2
  Contributors: ClaudeSchlesser
3
  Tags: social login, social connect, facebook login, linkedin, livejournal, google, yahoo, twitter login, openid, paypal, vkontakte, hyves, widget, plugin, social network login, comments
4
  Requires at least: 3.0
5
+ Tested up to: 3.3.2
6
+ Stable tag: 3.1
7
 
8
  Allow your visitors to comment and login with social networks like Twitter, Facebook, Paypal, LinkedIn, LiveJournal, OpenID, VKontakte, Google, Yahoo
9
 
39
  <li>Wordpress.com</li>
40
  <li>Windows Live</li>
41
  <li>StackExchange</li>
42
+ <li>Steam</li>
43
  <li>Hyves</li>
44
  <li>Mail.ru</li>
45
  <li>VKontakte (Вконтакте)</li>
113
 
114
  == Changelog ==
115
 
116
+ = 3.1 =
117
+ * SSL detection improved
118
+ * Buddypress avatars improved
119
+
120
  = 3.0 =
121
  * SSL detection with nginx load-balancer fixed
122
  * CDN path bug fixed