Social Login - Version 2.5

Version Description

  • API Connection improved
  • API Connection function moved to separate file
  • Contact us link fixed
  • Social Network Avatars fixed
  • HTML for administration area fixed
  • FSOCKOPEN Handler Added
  • CURL/FSOCKOPEN selector added
  • Identity Provider "Steam Community" added
  • Identity Provider "StackExchange" added
  • CSS served from CDN
  • Optionally disable comment moderation
Download this release

Release Info

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

Code changes from version 2.0 to 2.5

assets/css/admin.css CHANGED
@@ -1,177 +1,213 @@
1
  .oa_container {
2
- border: 1px solid #ccc;
3
- padding: 10px;
4
- clear: both;
5
- margin-bottom: 10px;
6
- overflow: hidden;
7
- width: 628px;
8
  }
9
 
10
  .oa_container h3 {
11
- margin: 0 0 10px 0;
12
  }
13
 
14
  .oa_container ul {
15
- list-style-type: disc;
16
- padding-left: 20px;
17
  }
18
 
19
  .oa_container.oa_container_links {
20
- background-color: #FFFFE0;
21
- border-color: #E6DB55;
22
  }
23
 
24
  .oa_container.oa_container_links a {
25
- color: #111;
26
  }
27
 
28
  .oa_container.oa_container_links a:hover {
29
- color: #d54e21;
30
  }
31
 
32
  .oa_container.oa_container_welcome {
33
- background-color: #E1EDFF
34
  }
35
 
36
  .oa_container .oa_container_title {
37
- border-bottom: 1px solid #A8A8A8;
38
- clear: both;
39
- color: #000000;
40
- font-size: 16px;
41
- font-weight: bold;
42
- line-height: 26px;
43
- margin: 0 0 10px;
44
- padding-bottom: 5px;
45
  }
46
 
47
  .oa_form_table {
48
- background-color: #efefef;
49
- border: 1px solid #ccc;
50
- width: 650px;
51
- margin-bottom: 10px;
52
  }
53
 
54
  .oa_form_table input {
55
- border-color: #aaa;
56
  }
57
 
58
  .oa_form_table .head {
59
- font-weight: bold;
60
- font-size: 13px;
61
- font-weight: bold;
62
- background-color: #ddd;
63
  }
64
 
65
  .oa_form_table .foot td {
66
- height: 40px;
67
- background-color: #ddd;
68
- text-align: center;
69
  }
70
 
71
  .oa_form_table .foot .error_message {
72
- color: red;
73
- font-weight: bold;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
 
76
  .oa_form_table .foot .success_message {
77
- color: green;
78
- font-weight: bold;
 
 
79
  }
80
 
81
  .oa_form_table tr td.row {
82
- line-height: 36px;
83
  }
84
 
85
  .oa_form_table tr.description td {
86
- color: #0D5995;
87
  }
88
 
89
  .oa_form_table .row_even {
90
- background-color: #fff;
 
91
  }
92
 
93
  .oa_form_table .row_provider {
94
- line-height: 35px;
95
  }
96
 
97
  .oa_form_table .row_provider .oa_provider {
98
- margin: 0 10px 0 0
99
  }
100
 
101
  .oa_provider {
102
- background-image: url("../img/provider_sprite_35_35.png");
103
- text-indent: -9999px;
104
- height: 35px;
105
- width: 35px;
106
- display: inline-block;
107
  }
108
 
109
  .oa_provider.oa_provider_aol {
110
- background-position: -2px -1px;
111
  }
112
 
113
  .oa_provider.oa_provider_blogger {
114
- background-position: -39px -1px;
115
  }
116
 
117
  .oa_provider.oa_provider_facebook {
118
- background-position: -76px -1px;
119
  }
120
 
121
  .oa_provider.oa_provider_foursquare {
122
- background-position: -113px -1px;
123
  }
124
 
125
  .oa_provider.oa_provider_google {
126
- background-position: -150px -1px;
127
  }
128
 
129
  .oa_provider.oa_provider_hyves {
130
- background-position: -187px -1px;
131
  }
132
 
133
  .oa_provider.oa_provider_linkedin {
134
- background-position: -224px -1px;
135
  }
136
 
137
  .oa_provider.oa_provider_livejournal {
138
- background-position: -298px -1px;
139
  }
140
 
141
  .oa_provider.oa_provider_myspace {
142
- background-position: -372px -1px;
143
  }
144
 
145
  .oa_provider.oa_provider_openid {
146
- background-position: -409px -1px;
147
  }
148
 
149
  .oa_provider.oa_provider_twitter {
150
- background-position: -520px -1px;
151
  }
152
 
153
  .oa_provider.oa_provider_vkontakte {
154
- background-position: -631px -1px;
155
  }
156
 
157
  .oa_provider.oa_provider_wordpress {
158
- background-position: -668px -1px;
159
  }
160
 
161
  .oa_provider.oa_provider_yahoo {
162
- background-position: -705px -1px;
163
  }
164
 
165
  .oa_provider.oa_provider_paypal {
166
- background-position: -742px -1px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  }
168
 
169
  .oa_form_table_settings tr.row_odd,.oa_form_table_settings tr.row_odd td {
170
- background-color: #e7e7e7;
171
- color: #222;
172
- font-weight: bold;
173
  }
174
 
175
  .oa_form_table_settings .row_even {
176
- border-bottom: 1px dotted #BBBBBB;
177
  }
1
  .oa_container {
2
+ border: 1px solid #ccc;
3
+ padding: 10px;
4
+ clear: both;
5
+ margin-bottom: 10px;
6
+ overflow: hidden;
7
+ width: 628px;
8
  }
9
 
10
  .oa_container h3 {
11
+ margin: 0 0 10px 0;
12
  }
13
 
14
  .oa_container ul {
15
+ list-style-type: disc;
16
+ padding-left: 20px;
17
  }
18
 
19
  .oa_container.oa_container_links {
20
+ background-color: #FFFFE0;
21
+ border-color: #E6DB55;
22
  }
23
 
24
  .oa_container.oa_container_links a {
25
+ color: #111;
26
  }
27
 
28
  .oa_container.oa_container_links a:hover {
29
+ color: #d54e21;
30
  }
31
 
32
  .oa_container.oa_container_welcome {
33
+ background-color: #E1EDFF
34
  }
35
 
36
  .oa_container .oa_container_title {
37
+ border-bottom: 1px solid #A8A8A8;
38
+ clear: both;
39
+ color: #000000;
40
+ font-size: 16px;
41
+ font-weight: bold;
42
+ line-height: 26px;
43
+ margin: 0 0 10px;
44
+ padding-bottom: 5px;
45
  }
46
 
47
  .oa_form_table {
48
+ background-color: #efefef;
49
+ border: 1px solid #ccc;
50
+ width: 650px;
51
+ margin-bottom: 30px;
52
  }
53
 
54
  .oa_form_table input {
55
+ border-color: #aaa;
56
  }
57
 
58
  .oa_form_table .head {
59
+ font-weight: bold;
60
+ font-size: 13px;
61
+ font-weight: bold;
62
+ background-color: #ddd;
63
  }
64
 
65
  .oa_form_table .foot td {
66
+ height: 40px;
67
+ background-color: #ddd;
 
68
  }
69
 
70
  .oa_form_table .foot .error_message {
71
+ color: red;
72
+ background: url("../img/status_error.png") no-repeat scroll 0 50% #ddd;
73
+ padding-left: 25px;
74
+ font-weight: bold;
75
+ }
76
+
77
+ .oa_form_table .foot .error_message,.oa_form_table .foot .error_message a {
78
+ color: red;
79
+ font-weight: bold;
80
+ }
81
+
82
+ .oa_form_table .foot .working_message {
83
+ color: blue;
84
+ background: url("../img/status_loading.gif") no-repeat scroll 0 50% #ddd;
85
+ padding-left: 25px;
86
+ font-weight: bold;
87
+ }
88
+
89
+ .oa_form_table .foot .error_message a:hover {
90
+ color: #C70000;
91
  }
92
 
93
  .oa_form_table .foot .success_message {
94
+ color: green;
95
+ background: url("../img/status_ok.png") no-repeat scroll 0 50% #ddd;
96
+ padding-left: 25px;
97
+ font-weight: bold;
98
  }
99
 
100
  .oa_form_table tr td.row {
101
+ line-height: 36px;
102
  }
103
 
104
  .oa_form_table tr.description td {
105
+ color: #0D5995;
106
  }
107
 
108
  .oa_form_table .row_even {
109
+ background-color: #fff;
110
+ color: #333 !important;
111
  }
112
 
113
  .oa_form_table .row_provider {
114
+ line-height: 35px;
115
  }
116
 
117
  .oa_form_table .row_provider .oa_provider {
118
+ margin: 0 10px 0 0;
119
  }
120
 
121
  .oa_provider {
122
+ background-image: url("../img/provider_sprite_35_35.png");
123
+ text-indent: -9999px;
124
+ height: 35px;
125
+ width: 35px;
126
+ display: inline-block;
127
  }
128
 
129
  .oa_provider.oa_provider_aol {
130
+ background-position: -2px -1px;
131
  }
132
 
133
  .oa_provider.oa_provider_blogger {
134
+ background-position: -39px -1px;
135
  }
136
 
137
  .oa_provider.oa_provider_facebook {
138
+ background-position: -76px -1px;
139
  }
140
 
141
  .oa_provider.oa_provider_foursquare {
142
+ background-position: -113px -1px;
143
  }
144
 
145
  .oa_provider.oa_provider_google {
146
+ background-position: -150px -1px;
147
  }
148
 
149
  .oa_provider.oa_provider_hyves {
150
+ background-position: -187px -1px;
151
  }
152
 
153
  .oa_provider.oa_provider_linkedin {
154
+ background-position: -224px -1px;
155
  }
156
 
157
  .oa_provider.oa_provider_livejournal {
158
+ background-position: -298px -1px;
159
  }
160
 
161
  .oa_provider.oa_provider_myspace {
162
+ background-position: -372px -1px;
163
  }
164
 
165
  .oa_provider.oa_provider_openid {
166
+ background-position: -409px -1px;
167
  }
168
 
169
  .oa_provider.oa_provider_twitter {
170
+ background-position: -520px -1px;
171
  }
172
 
173
  .oa_provider.oa_provider_vkontakte {
174
+ background-position: -631px -1px;
175
  }
176
 
177
  .oa_provider.oa_provider_wordpress {
178
+ background-position: -668px -1px;
179
  }
180
 
181
  .oa_provider.oa_provider_yahoo {
182
+ background-position: -705px -1px;
183
  }
184
 
185
  .oa_provider.oa_provider_paypal {
186
+ background-position: -742px -1px;
187
+ }
188
+
189
+ .oa_provider.oa_provider_stackexchange {
190
+ background-position: -779px -1px;
191
+ }
192
+
193
+ .oa_provider.oa_provider_steam {
194
+ background-position: -816px -1px;
195
+ }
196
+
197
+ .oa_form_table_notice {
198
+ border-color: green;
199
+ }
200
+
201
+ .oa_form_table_notice th {
202
+ background-color: #B7EF6F !important;
203
  }
204
 
205
  .oa_form_table_settings tr.row_odd,.oa_form_table_settings tr.row_odd td {
206
+ background-color: #e7e7e7;
207
+ color: #222;
208
+ font-weight: bold;
209
  }
210
 
211
  .oa_form_table_settings .row_even {
212
+ border-bottom: 1px dotted #BBBBBB;
213
  }
assets/img/provider_sprite_35_35.png CHANGED
Binary file
assets/img/status_error.png ADDED
Binary file
assets/img/status_loading.gif ADDED
Binary file
assets/img/status_ok.png ADDED
Binary file
assets/js/admin.js CHANGED
@@ -1,58 +1,125 @@
1
  jQuery(document).ready(function($) {
2
 
3
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  $('#oa_social_login_test_api_settings').click(function(){
 
 
 
 
 
 
 
5
  var subdomain = jQuery('#oa_social_login_settings_api_subdomain').val();
6
  var key = jQuery('#oa_social_login_settings_api_key').val();
7
- var secret = jQuery('#oa_social_login_settings_api_secret').val();
 
8
 
9
  var data = {
10
- _ajax_nonce: oa_social_login_ajax_nonce.value,
11
  action: 'check_api_settings',
 
12
  api_subdomain: subdomain,
13
  api_key: key,
14
  api_secret: secret
15
  };
16
 
17
- jQuery.post(ajaxurl,data, function(response) {
18
- var message;
19
- var success;
20
-
 
21
  if (response == 'error_not_all_fields_filled_out'){
22
- success = false;
23
- message = objectL10n.oa_admin_js_1;
24
  }
25
  else if (response == 'error_subdomain_wrong'){
26
- success = false;
27
- message = objectL10n.oa_admin_js_2;
28
  }
29
  else if (response == 'error_subdomain_wrong_syntax'){
30
- success = false;
31
- message = objectL10n.oa_admin_js_3;
32
  }
33
  else if (response == 'error_communication'){
34
- success = false;
35
- message = objectL10n.oa_admin_js_4;
36
  }
37
  else if (response == 'error_authentication_credentials_wrong'){
38
- success = false;
39
- message = objectL10n.oa_admin_js_5;
40
  }
41
  else {
42
- success = true;
43
- message = objectL10n.oa_admin_js_6;
44
  }
45
 
46
- jQuery('#oa_social_login_api_test_result').html(message);
 
47
 
48
- if (success){
49
- jQuery('#oa_social_login_api_test_result').removeClass('error_message');
50
- jQuery('#oa_social_login_api_test_result').addClass('success_message');
51
  } else {
52
- jQuery('#oa_social_login_api_test_result').removeClass('success_message');
53
- jQuery('#oa_social_login_api_test_result').addClass('error_message');
54
- }
55
-
56
  });
57
  return false;
58
  });
1
  jQuery(document).ready(function($) {
2
 
3
+ /* Autodetect API Connection Handler */
4
+ $('#oa_social_login_autodetect_api_connection_handler').click(function(){
5
+ var message_string;
6
+ var message_container;
7
+ var is_success;
8
+
9
+ var data = {
10
+ _ajax_nonce: objectL10n.oa_social_login_ajax_nonce,
11
+ action: 'autodetect_api_connection_handler'
12
+ };
13
+
14
+ message_container = jQuery('#oa_social_login_api_connection_handler_result');
15
+ message_container.removeClass('success_message error_message').addClass('working_message');
16
+ message_container.html(objectL10n.oa_admin_js_1);
17
+
18
+ jQuery.post(ajaxurl,data, function(response) {
19
+
20
+ /* CURL/FSOCKOPEN Radio Boxs */
21
+ var radio_curl = jQuery("#oa_social_login_api_connection_handler_curl");
22
+ var radio_fsockopen = jQuery("#oa_social_login_api_connection_handler_fsockopen");
23
+ radio_curl.removeAttr("checked");
24
+ radio_fsockopen.removeAttr("checked");
25
+
26
+ /* CURL detected */
27
+ if (response == 'success_autodetect_api_curl')
28
+ {
29
+ is_success = true;
30
+ radio_curl.attr("checked", "checked");
31
+ message_string = objectL10n.oa_admin_js_201;
32
+ }
33
+ else
34
+ {
35
+ /* FSOCKOPEN detected */
36
+ if (response == 'success_autodetect_api_fsockopen')
37
+ {
38
+ is_success = true;
39
+ radio_fsockopen.attr("checked", "checked");
40
+ message_string = objectL10n.oa_admin_js_202;
41
+ }
42
+ /* No handler detected */
43
+ else
44
+ {
45
+ is_success = false;
46
+ radio_curl.attr("checked", "checked");
47
+ message_string = objectL10n.oa_admin_js_211;
48
+ }
49
+ }
50
+ message_container.removeClass('working_message');
51
+ message_container.html(message_string);
52
+
53
+ if (is_success){
54
+ message_container.addClass('success_message');
55
+ } else {
56
+ message_container.addClass('error_message');
57
+ }
58
+ });
59
+ return false;
60
+ });
61
+
62
+ /* Test API Settings */
63
  $('#oa_social_login_test_api_settings').click(function(){
64
+ var message_string;
65
+ var message_container;
66
+ var is_success;
67
+
68
+ var radio_curl_val = jQuery("#oa_social_login_api_connection_handler_curl:checked").val();
69
+ var radio_fsockopen_val = jQuery("#oa_social_login_api_connection_handler_fsockopen:checked").val();
70
+
71
  var subdomain = jQuery('#oa_social_login_settings_api_subdomain').val();
72
  var key = jQuery('#oa_social_login_settings_api_key').val();
73
+ var secret = jQuery('#oa_social_login_settings_api_secret').val();
74
+ var handler = (radio_fsockopen_val == 'fsockopen' ? 'fsockopen' : 'curl');
75
 
76
  var data = {
77
+ _ajax_nonce: objectL10n.oa_social_login_ajax_nonce,
78
  action: 'check_api_settings',
79
+ api_connection_handler: handler,
80
  api_subdomain: subdomain,
81
  api_key: key,
82
  api_secret: secret
83
  };
84
 
85
+ message_container = jQuery('#oa_social_login_api_test_result');
86
+ message_container.removeClass('success_message error_message').addClass('working_message');
87
+ message_container.html(objectL10n.oa_admin_js_1);
88
+
89
+ jQuery.post(ajaxurl,data, function(response) {
90
  if (response == 'error_not_all_fields_filled_out'){
91
+ is_success = false;
92
+ message_string = objectL10n.oa_admin_js_111;
93
  }
94
  else if (response == 'error_subdomain_wrong'){
95
+ is_success = false;
96
+ message_string = objectL10n.oa_admin_js_112;
97
  }
98
  else if (response == 'error_subdomain_wrong_syntax'){
99
+ is_success = false;
100
+ message_string = objectL10n.oa_admin_js_113;
101
  }
102
  else if (response == 'error_communication'){
103
+ is_success = false;
104
+ message_string = objectL10n.oa_admin_js_114;
105
  }
106
  else if (response == 'error_authentication_credentials_wrong'){
107
+ is_success = false;
108
+ message_string = objectL10n.oa_admin_js_115;
109
  }
110
  else {
111
+ is_success = true;
112
+ message_string = objectL10n.oa_admin_js_101;
113
  }
114
 
115
+ message_container.removeClass('working_message');
116
+ message_container.html(message_string);
117
 
118
+ if (is_success){
119
+ message_container.addClass('success_message');
 
120
  } else {
121
+ message_container.addClass('error_message');
122
+ }
 
 
123
  });
124
  return false;
125
  });
includes/admin.php CHANGED
@@ -14,6 +14,35 @@ function oa_social_login_admin_menu ()
14
  add_action ('admin_menu', 'oa_social_login_admin_menu');
15
 
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  /**
18
  * Add an activation message to be displayed once
19
  */
@@ -21,16 +50,48 @@ function oa_social_login_admin_message ()
21
  {
22
  if (get_option ('oa_social_login_activation_message') !== '1')
23
  {
24
- echo '<div class="updated"><p><strong>'.__('Thank you for using the Social Login Plugin!', 'oa_social_login').'</strong> '.sprintf(__('Please go to the <strong><a href="%s">Settings\Social Login</a></strong> page to setup the plugin.', 'oa_social_login'), 'options-general.php?page=oa_social_login').'</p></div>';
25
  update_option ('oa_social_login_activation_message', '1');
26
  }
27
  }
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  /**
31
- * Check API Settings trough an Ajax Call
32
  */
33
- function oa_social_login_check_api_settings ()
34
  {
35
  check_ajax_referer ('oa_social_login_ajax_nonce');
36
 
@@ -42,8 +103,11 @@ function oa_social_login_check_api_settings ()
42
  die ();
43
  }
44
 
45
- //Subdomain
 
46
  $api_subdomain = trim (strtolower ($_POST ['api_subdomain']));
 
 
47
 
48
  //Full domain entered
49
  if (preg_match ("/([a-z0-9\-]+)\.api\.oneall\.com/i", $api_subdomain, $matches))
@@ -62,57 +126,50 @@ function oa_social_login_check_api_settings ()
62
  //Domain
63
  $api_domain = $api_subdomain . '.api.oneall.com';
64
 
65
- //Key
66
- $api_key = $_POST ['api_key'];
67
 
68
- //Secret
69
- $api_secret = $_POST ['api_secret'];
70
 
71
- //Ping
72
- $curl = curl_init ();
73
- curl_setopt ($curl, CURLOPT_URL, 'https://' . $api_domain . '/tools/ping.json');
74
- curl_setopt ($curl, CURLOPT_HEADER, 0);
75
- curl_setopt ($curl, CURLOPT_USERPWD, $api_key . ":" . $api_secret);
76
- curl_setopt ($curl, CURLOPT_TIMEOUT, 15);
77
- curl_setopt ($curl, CURLOPT_VERBOSE, 0);
78
- curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
79
- curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0);
80
- curl_setopt ($curl, CURLOPT_FAILONERROR, 0);
81
-
82
- if (($json = curl_exec ($curl)) === false)
83
  {
84
- curl_close ($curl);
85
-
86
- echo 'error_communication';
87
- delete_option ('oa_social_login_api_settings_verified');
88
- die ();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  }
90
-
91
- //Success
92
- $http_code = curl_getinfo ($curl, CURLINFO_HTTP_CODE);
93
- curl_close ($curl);
94
-
95
- //Authentication Error
96
- if ($http_code == 401)
97
  {
98
- echo 'error_authentication_credentials_wrong';
99
  delete_option ('oa_social_login_api_settings_verified');
100
- die ();
101
- }
102
- elseif ($http_code == 404)
103
- {
104
- echo 'error_subdomain_wrong';
105
- delete_option ('oa_social_login_api_settings_verified');
106
- die ();
107
- }
108
- elseif ($http_code == 200)
109
- {
110
- echo 'success';
111
- update_option ('oa_social_login_api_settings_verified', '1');
112
- die ();
113
  }
 
114
  }
115
- add_action ('wp_ajax_check_api_settings', 'oa_social_login_check_api_settings');
116
 
117
 
118
  /**
@@ -127,25 +184,28 @@ function oa_social_login_admin_js ($hook)
127
  wp_register_script ('oa_social_login_admin_js', OA_SOCIAL_LOGIN_PLUGIN_URL . "/assets/js/admin.js");
128
  }
129
 
 
 
130
  wp_enqueue_script ('oa_social_login_admin_js');
131
  wp_enqueue_script ('jquery');
132
 
133
  wp_localize_script ('oa_social_login_admin_js', 'objectL10n', array (
134
- 'oa_admin_js_1' => __ ('Please fill out each of the fields above.', 'oa_social_login'),
135
- 'oa_admin_js_2' => __ ('The subdomain does not exist. Have you filled it out correctly?', 'oa_social_login'),
136
- 'oa_admin_js_3' => __ ('The subdomain has a wrong syntax!', 'oa_social_login'),
137
- 'oa_admin_js_4' => __ ('Could not contact API. Are outoing CURL requests allowed?', 'oa_social_login'),
138
- 'oa_admin_js_5' => __ ('The API credentials are wrong', 'oa_social_login'),
139
- 'oa_admin_js_6' => __ ('The settings are correct - do not forget to save your changes!', 'oa_social_login')
140
- ));
141
-
142
- $oa_social_login_ajax_nonce = wp_create_nonce ('oa_social_login_ajax_nonce');
143
- wp_localize_script ('oa_social_login_admin_js', 'oa_social_login_ajax_nonce', array (
144
- 'value' => $oa_social_login_ajax_nonce
145
  ));
146
  }
147
  }
148
 
 
149
  /**
150
  * Add Settings CSS
151
  **/
@@ -189,6 +249,7 @@ function oa_social_login_settings_validate ($settings)
189
 
190
  //Base Settings
191
  foreach (array (
 
192
  'api_subdomain',
193
  'api_key',
194
  'api_secret',
@@ -201,7 +262,9 @@ function oa_social_login_settings_validate ($settings)
201
  'plugin_login_form_redirect_custom_url',
202
  'plugin_display_in_registration_form',
203
  'plugin_registration_form_redirect',
204
- 'plugin_registration_form_redirect_custom_url'
 
 
205
  ) AS $key)
206
  {
207
  if (isset ($settings [$key]))
@@ -238,20 +301,15 @@ function oa_social_login_settings_validate ($settings)
238
  }
239
 
240
  //Flag settings
 
241
  $sanitzed_settings ['plugin_use_small_buttons'] == ((isset ($sanitzed_settings ['plugin_use_small_buttons']) AND $sanitzed_settings ['plugin_use_small_buttons'] == '1') ? 1 : 0);
242
  $sanitzed_settings ['plugin_show_avatars_in_comments'] == ((isset ($sanitzed_settings ['plugin_show_avatars_in_comments']) AND $sanitzed_settings ['plugin_show_avatars_in_comments'] == '1') ? 1 : 0);
243
  $sanitzed_settings ['plugin_link_verified_accounts'] == ((isset ($sanitzed_settings ['plugin_link_verified_accounts']) AND $sanitzed_settings ['plugin_link_verified_accounts'] == '0') ? 0 : 1);
244
- $sanitzed_settings ['plugin_login_form_redirect'] = ((isset ($sanitzed_settings ['plugin_login_form_redirect']) AND in_array ($sanitzed_settings ['plugin_login_form_redirect'], array (
245
- 'dashboard',
246
- 'homepage',
247
- 'custom'
248
- ))) ? $sanitzed_settings ['plugin_login_form_redirect'] : 'homepage');
249
- $sanitzed_settings ['plugin_registration_form_redirect'] = ((isset ($sanitzed_settings ['plugin_registration_form_redirect']) AND in_array ($sanitzed_settings ['plugin_registration_form_redirect'], array (
250
- 'dashboard',
251
- 'homepage',
252
- 'custom'
253
- ))) ? $sanitzed_settings ['plugin_registration_form_redirect'] : 'dashboard');
254
  $sanitzed_settings ['plugin_display_in_login_form'] == ((isset ($sanitzed_settings ['plugin_display_in_login_form']) AND $sanitzed_settings ['plugin_display_in_login_form'] == '0') ? 0 : 1);
 
 
255
 
256
  //Check Login Redirection Settings
257
  if ($sanitzed_settings ['plugin_login_form_redirect'] == 'custom')
@@ -285,6 +343,7 @@ function oa_social_login_settings_validate ($settings)
285
  }
286
 
287
 
 
288
  /**
289
  * Display Settings Page
290
  **/
@@ -292,13 +351,14 @@ function oa_display_social_login_settings ()
292
  {
293
  //Import providers
294
  GLOBAL $oa_social_login_providers;
295
- ?>
 
296
  <div class="wrap">
297
  <h2><?php _e ('Social Login Settings', 'oa_social_login'); ?></h2>
298
  <?php
299
  if (get_option ('oa_social_login_api_settings_verified') !== '1')
300
  {
301
- ?>
302
  <div class="oa_container oa_container_welcome">
303
  <h3>
304
  <?php _e ('Make your blog social!', 'oa_social_login'); ?>
@@ -347,9 +407,9 @@ function oa_display_social_login_settings ()
347
  <?php _e ('Help, Updates &amp; Documentation', 'oa_social_login'); ?>
348
  </h3>
349
  <ul>
350
- <li><?php printf (__('<a target="_blank" href="%s">Follow us on Twitter</a> to stay informed about updates', 'oa_social_login'), 'http://www.twitter.com/oneall');?>;</li>
351
- <li><?php printf (__('<a target="_blank" href="%s">Read the online documentation</a> for more information about this plugin', 'oa_social_login'), 'http://docs.oneall.com/plugins/guide/social-login-wordpress/');?>;</li>
352
- <li><?php printf (__('<a target="_blank" href="%a">Contact us</a> if you have feedback or need assistance', 'oa_social_login'), 'http://www.oneall.com/company/contact-us/');?></li>
353
  </ul>
354
  </div>
355
  <form method="post" action="options.php">
@@ -357,6 +417,41 @@ function oa_display_social_login_settings ()
357
  settings_fields ('oa_social_login_settings_group');
358
  $settings = get_option ('oa_social_login_settings');
359
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
  <table class="form-table oa_form_table">
361
  <tr>
362
  <th class="head">
@@ -368,26 +463,26 @@ function oa_display_social_login_settings ()
368
  </tr>
369
  <tr>
370
  <th scope="row">
371
- <label for="oneall_api_subdomain"><?php _e ('API Subdomain', 'oa_social_login'); ?>:</label>
372
  </th>
373
  <td>
374
- <input type="text" id="oa_social_login_settings_api_subdomain" name="oa_social_login_settings[api_subdomain]" size="60" value="<?php echo (isset ($settings ['api_subdomain']) ? htmlspecialchars ($settings ['api_subdomain']) : ''); ?>" />
375
  </td>
376
  </tr>
377
  <tr>
378
  <th scope="row">
379
- <label for="oneall_api_public_key"><?php _e ('API Public Key', 'oa_social_login'); ?>:</label>
380
  </th>
381
  <td>
382
- <input type="text" id="oa_social_login_settings_api_key" name="oa_social_login_settings[api_key]" size="60" value="<?php echo (isset ($settings ['api_key']) ? htmlspecialchars ($settings ['api_key']) : ''); ?>" />
383
  </td>
384
  </tr>
385
  <tr>
386
  <th scope="row">
387
- <label for="oneall_api_private_key"><?php _e ('API Private Key', 'oa_social_login'); ?>:</label>
388
  </th>
389
  <td>
390
- <input type="text" id="oa_social_login_settings_api_secret" name="oa_social_login_settings[api_secret]" size="60" value="<?php echo (isset ($settings ['api_secret']) ? htmlspecialchars ($settings ['api_secret']) : ''); ?>" />
391
  </td>
392
  </tr>
393
  <tr class="foot">
@@ -401,7 +496,7 @@ function oa_display_social_login_settings ()
401
  </table>
402
  <table class="form-table oa_form_table">
403
  <tr>
404
- <th class="head" colspan="2">
405
  <?php _e ('Enable the social networks/identity providers of your choice', 'oa_social_login'); ?>
406
  </th>
407
  </tr>
@@ -416,17 +511,31 @@ function oa_display_social_login_settings ()
416
  <input type="checkbox" id="oneall_social_login_provider_<?php echo $key; ?>" name="oa_social_login_settings[providers][<?php echo $key; ?>]" value="1" <?php checked ('1', $settings ['providers'] [$key]); ?> />
417
  <label for="oneall_social_login_provider_<?php echo $key; ?>"><?php echo htmlspecialchars ($provider_data ['name']); ?></label>
418
  <?php
419
- if ($key == 'vkontakte')
420
- {
421
- echo ' - '.sprintf (__('To enable cyrillic usernames, you might need <a target="_blank" href="%s">this plugin</a>', 'oa_social_login'), 'http://wordpress.org/extend/plugins/wordpress-special-characters-in-usernames/');
422
- }
423
- ?>
424
  </td>
425
  </tr>
426
  <?php
427
  }
428
  ?>
429
  </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
  <table class="form-table oa_form_table oa_form_table_settings">
431
  <tr>
432
  <th class="head">
@@ -445,7 +554,7 @@ function oa_display_social_login_settings ()
445
  </tr>
446
  <tr class="row_odd">
447
  <td>
448
- <?php _e ("If the user's social network profile has an avatar thumbnail, should we show it beside his comments?", 'oa_social_login'); ?>
449
  </td>
450
  </tr>
451
  <tr class="row_even">
@@ -472,6 +581,46 @@ function oa_display_social_login_settings ()
472
  </td>
473
  </tr>
474
  </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475
  <table class="form-table oa_form_table oa_form_table_settings">
476
  <tr>
477
  <th class="head">
@@ -500,11 +649,7 @@ function oa_display_social_login_settings ()
500
  <tr class="row_even">
501
  <td>
502
  <?php
503
- $plugin_login_form_redirect = ((!isset ($settings ['plugin_login_form_redirect']) OR !in_array ($settings ['plugin_login_form_redirect'], array (
504
- 'dashboard',
505
- 'homepage',
506
- 'custom'
507
- ))) ? 'homepage' : $settings ['plugin_login_form_redirect']);
508
  ?>
509
  <input type="radio" name="oa_social_login_settings[plugin_login_form_redirect]" value="homepage" <?php echo ($plugin_login_form_redirect == 'homepage' ? 'checked="checked"' : ''); ?> /> <?php _e ('Redirect users to the homepage of my blog', 'oa_social_login'); ?> <strong>(<?php _e ('Default', 'oa_social_login') ?>)</strong><br />
510
  <input type="radio" name="oa_social_login_settings[plugin_login_form_redirect]" value="dashboard" <?php echo ($plugin_login_form_redirect == 'dashboard' ? 'checked="checked"' : ''); ?> /> <?php _e ('Redirect users to their account dashboard', 'oa_social_login'); ?><br />
@@ -556,11 +701,7 @@ function oa_display_social_login_settings ()
556
  <tr class="row_even">
557
  <td>
558
  <?php
559
- $plugin_registration_form_redirect = ((!isset ($settings ['plugin_registration_form_redirect']) OR !in_array ($settings ['plugin_registration_form_redirect'], array (
560
- 'dashboard',
561
- 'homepage',
562
- 'custom'
563
- ))) ? 'dashboard' : $settings ['plugin_registration_form_redirect']);
564
  ?>
565
  <input type="radio" name="oa_social_login_settings[plugin_registration_form_redirect]" value="homepage" <?php echo ($plugin_registration_form_redirect == 'homepage' ? 'checked="checked"' : ''); ?> /> <?php _e ('Redirect users to the homepage of my blog', 'oa_social_login'); ?><br />
566
  <input type="radio" name="oa_social_login_settings[plugin_registration_form_redirect]" value="dashboard" <?php echo ($plugin_registration_form_redirect == 'dashboard' ? 'checked="checked"' : ''); ?> /> <?php _e ('Redirect users to their account dashboard', 'oa_social_login'); ?> <strong>(<?php _e ('Default', 'oa_social_login') ?>)</strong><br />
14
  add_action ('admin_menu', 'oa_social_login_admin_menu');
15
 
16
 
17
+ /**
18
+ * Automatically approve comments if set to do so
19
+ **/
20
+ function oa_social_login_admin_pre_comment_approved($approved)
21
+ {
22
+ // No need to do the check if the comment is already approved
23
+ if (empty($approved))
24
+ {
25
+ //Read settings
26
+ $settings = get_option ('oa_social_login_settings');
27
+
28
+ //Check if enabled
29
+ if (!empty ($settings ['plugin_comment_auto_approve']))
30
+ {
31
+ $user_id = get_current_user_id();
32
+ if ( is_numeric ($user_id))
33
+ {
34
+ if (get_user_meta ($user_id, 'oa_social_login_user_token', true) !== false)
35
+ {
36
+ $approved = 1;
37
+ }
38
+ }
39
+ }
40
+ }
41
+ return $approved;
42
+ }
43
+ add_action('pre_comment_approved', 'oa_social_login_admin_pre_comment_approved');
44
+
45
+
46
  /**
47
  * Add an activation message to be displayed once
48
  */
50
  {
51
  if (get_option ('oa_social_login_activation_message') !== '1')
52
  {
53
+ echo '<div class="updated"><p><strong>' . __ ('Thank you for using the Social Login Plugin!', 'oa_social_login') . '</strong> ' . sprintf (__ ('Please go to the <strong><a href="%s">Settings\Social Login</a></strong> page to setup the plugin.', 'oa_social_login'), 'options-general.php?page=oa_social_login') . '</p></div>';
54
  update_option ('oa_social_login_activation_message', '1');
55
  }
56
  }
57
 
58
+ /**
59
+ * Autodetect API Connection Handler
60
+ */
61
+ function oa_social_login_admin_autodetect_api_connection_handler ()
62
+ {
63
+ //Check AJAX Nonce
64
+ check_ajax_referer ('oa_social_login_ajax_nonce');
65
+
66
+ //CURL Works
67
+ if (oa_social_login_check_curl () === true)
68
+ {
69
+ echo 'success_autodetect_api_curl';
70
+ die ();
71
+ }
72
+ //CURL does not work
73
+ else
74
+ {
75
+ // FSOCKOPEN works
76
+ if (oa_social_login_check_fsockopen () == true)
77
+ {
78
+ echo 'success_autodetect_api_fsockopen';
79
+ die ();
80
+ }
81
+ }
82
+
83
+ //No working handler found
84
+ echo 'error_autodetect_api_no_handler';
85
+ die ();
86
+ }
87
+ add_action ('wp_ajax_autodetect_api_connection_handler', 'oa_social_login_admin_autodetect_api_connection_handler');
88
+
89
+
90
 
91
  /**
92
+ * Check API Settings through an Ajax Call
93
  */
94
+ function oa_social_login_admin_check_api_settings ()
95
  {
96
  check_ajax_referer ('oa_social_login_ajax_nonce');
97
 
103
  die ();
104
  }
105
 
106
+ //Sanitize data
107
+ $api_connection_handler = ((!empty ($_POST ['api_connection_handler']) AND $_POST ['api_connection_handler'] == 'fsockopen') ? 'fsockopen' : 'curl');
108
  $api_subdomain = trim (strtolower ($_POST ['api_subdomain']));
109
+ $api_key = trim($_POST ['api_key']);
110
+ $api_secret = trim($_POST ['api_secret']);
111
 
112
  //Full domain entered
113
  if (preg_match ("/([a-z0-9\-]+)\.api\.oneall\.com/i", $api_subdomain, $matches))
126
  //Domain
127
  $api_domain = $api_subdomain . '.api.oneall.com';
128
 
129
+ //Connection to
130
+ $api_resource_url = 'https://' . $api_domain . '/tools/ping.json';
131
 
132
+ //Get connection details
133
+ $result = oa_social_login_do_api_request ($api_connection_handler, $api_resource_url, array ('api_key' => $api_key, 'api_secret' => $api_secret), 15);
134
 
135
+ //Parse result
136
+ if (is_object ($result) AND property_exists ($result, 'http_code') AND property_exists ($result, 'http_data'))
 
 
 
 
 
 
 
 
 
 
137
  {
138
+ switch ($result->http_code)
139
+ {
140
+ //Success
141
+ case 200:
142
+ echo 'success';
143
+ update_option ('oa_social_login_api_settings_verified', '1');
144
+ break;
145
+
146
+ //Authentication Error
147
+ case 401:
148
+ echo 'error_authentication_credentials_wrong';
149
+ delete_option ('oa_social_login_api_settings_verified');
150
+ break;
151
+
152
+ //Wrong Subdomain
153
+ case 404:
154
+ echo 'error_subdomain_wrong';
155
+ delete_option ('oa_social_login_api_settings_verified');
156
+ break;
157
+
158
+ //Other error
159
+ default:
160
+ echo 'error_communication';
161
+ delete_option ('oa_social_login_api_settings_verified');
162
+ break;
163
+ }
164
  }
165
+ else
 
 
 
 
 
 
166
  {
167
+ echo 'error_communication';
168
  delete_option ('oa_social_login_api_settings_verified');
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  }
170
+ die();
171
  }
172
+ add_action ('wp_ajax_check_api_settings', 'oa_social_login_admin_check_api_settings');
173
 
174
 
175
  /**
184
  wp_register_script ('oa_social_login_admin_js', OA_SOCIAL_LOGIN_PLUGIN_URL . "/assets/js/admin.js");
185
  }
186
 
187
+ $oa_social_login_ajax_nonce = wp_create_nonce ('oa_social_login_ajax_nonce');
188
+
189
  wp_enqueue_script ('oa_social_login_admin_js');
190
  wp_enqueue_script ('jquery');
191
 
192
  wp_localize_script ('oa_social_login_admin_js', 'objectL10n', array (
193
+ 'oa_social_login_ajax_nonce' => $oa_social_login_ajax_nonce,
194
+ 'oa_admin_js_1' => __ ('Contacting API - please wait ...', 'oa_social_login'),
195
+ 'oa_admin_js_101' => __ ('The settings are correct - do not forget to save your changes!', 'oa_social_login'),
196
+ 'oa_admin_js_111' => __ ('Please fill out each of the fields above.', 'oa_social_login'),
197
+ 'oa_admin_js_112' => __ ('The subdomain does not exist. Have you filled it out correctly?', 'oa_social_login'),
198
+ 'oa_admin_js_113' => __ ('The subdomain has a wrong syntax!', 'oa_social_login'),
199
+ 'oa_admin_js_114' => __ ('Could not contact API. Are outoing CURL requests allowed?', 'oa_social_login'),
200
+ 'oa_admin_js_115' => __ ('The API credentials are wrong', 'oa_social_login'),
201
+ 'oa_admin_js_201' => __ ('Autodetected PHP CURL - do not forget to save your changes!', 'oa_social_login'),
202
+ 'oa_admin_js_202' => __ ('Autodetected PHP FSOCKOPEN - do not forget to save your changes!', 'oa_social_login'),
203
+ 'oa_admin_js_211' => sprintf(__ ('Autodetection Error - our <a href="%s" target="_blank">documentation</a> helps you fix this issue.', 'oa_social_login'), 'http://docs.oneall.com/plugins/guide/social-login-wordpress/#help')
204
  ));
205
  }
206
  }
207
 
208
+
209
  /**
210
  * Add Settings CSS
211
  **/
249
 
250
  //Base Settings
251
  foreach (array (
252
+ 'api_connection_handler',
253
  'api_subdomain',
254
  'api_key',
255
  'api_secret',
262
  'plugin_login_form_redirect_custom_url',
263
  'plugin_display_in_registration_form',
264
  'plugin_registration_form_redirect',
265
+ 'plugin_registration_form_redirect_custom_url',
266
+ 'plugin_comment_show_if_members_only',
267
+ 'plugin_comment_auto_approve'
268
  ) AS $key)
269
  {
270
  if (isset ($settings [$key]))
301
  }
302
 
303
  //Flag settings
304
+ $sanitzed_settings ['api_connection_handler'] = ((isset ($sanitzed_settings ['api_connection_handler']) AND in_array ($sanitzed_settings ['api_connection_handler'], array ('curl', 'fsockopen'))) ? $sanitzed_settings ['api_connection_handler'] : 'curl');
305
  $sanitzed_settings ['plugin_use_small_buttons'] == ((isset ($sanitzed_settings ['plugin_use_small_buttons']) AND $sanitzed_settings ['plugin_use_small_buttons'] == '1') ? 1 : 0);
306
  $sanitzed_settings ['plugin_show_avatars_in_comments'] == ((isset ($sanitzed_settings ['plugin_show_avatars_in_comments']) AND $sanitzed_settings ['plugin_show_avatars_in_comments'] == '1') ? 1 : 0);
307
  $sanitzed_settings ['plugin_link_verified_accounts'] == ((isset ($sanitzed_settings ['plugin_link_verified_accounts']) AND $sanitzed_settings ['plugin_link_verified_accounts'] == '0') ? 0 : 1);
308
+ $sanitzed_settings ['plugin_login_form_redirect'] = ((isset ($sanitzed_settings ['plugin_login_form_redirect']) AND in_array ($sanitzed_settings ['plugin_login_form_redirect'], array ('dashboard','homepage', 'custom'))) ? $sanitzed_settings ['plugin_login_form_redirect'] : 'homepage');
309
+ $sanitzed_settings ['plugin_registration_form_redirect'] = ((isset ($sanitzed_settings ['plugin_registration_form_redirect']) AND in_array ($sanitzed_settings ['plugin_registration_form_redirect'], array ('dashboard', 'homepage', 'custom'))) ? $sanitzed_settings ['plugin_registration_form_redirect'] : 'dashboard');
 
 
 
 
 
 
 
 
310
  $sanitzed_settings ['plugin_display_in_login_form'] == ((isset ($sanitzed_settings ['plugin_display_in_login_form']) AND $sanitzed_settings ['plugin_display_in_login_form'] == '0') ? 0 : 1);
311
+ $sanitzed_settings ['plugin_comment_show_if_members_only'] == ((isset ($sanitzed_settings ['plugin_comment_show_if_members_only']) AND $sanitzed_settings ['plugin_comment_show_if_members_only'] == '1') ? 1 : 0);
312
+ $sanitzed_settings ['plugin_comment_auto_approve'] == ((isset ($sanitzed_settings ['plugin_comment_auto_approve']) AND $sanitzed_settings ['plugin_comment_auto_approve'] == '1') ? 1 : 0);
313
 
314
  //Check Login Redirection Settings
315
  if ($sanitzed_settings ['plugin_login_form_redirect'] == 'custom')
343
  }
344
 
345
 
346
+
347
  /**
348
  * Display Settings Page
349
  **/
351
  {
352
  //Import providers
353
  GLOBAL $oa_social_login_providers;
354
+
355
+ ?>
356
  <div class="wrap">
357
  <h2><?php _e ('Social Login Settings', 'oa_social_login'); ?></h2>
358
  <?php
359
  if (get_option ('oa_social_login_api_settings_verified') !== '1')
360
  {
361
+ ?>
362
  <div class="oa_container oa_container_welcome">
363
  <h3>
364
  <?php _e ('Make your blog social!', 'oa_social_login'); ?>
407
  <?php _e ('Help, Updates &amp; Documentation', 'oa_social_login'); ?>
408
  </h3>
409
  <ul>
410
+ <li><?php printf (__ ('<a target="_blank" href="%s">Follow us on Twitter</a> to stay informed about updates', 'oa_social_login'), 'http://www.twitter.com/oneall'); ?>;</li>
411
+ <li><?php printf (__ ('<a target="_blank" href="%s">Read the online documentation</a> for more information about this plugin', 'oa_social_login'), 'http://docs.oneall.com/plugins/guide/social-login-wordpress/'); ?>;</li>
412
+ <li><?php printf (__ ('<a target="_blank" href="%s">Contact us</a> if you have feedback or need assistance', 'oa_social_login'), 'http://www.oneall.com/company/contact-us/'); ?></li>
413
  </ul>
414
  </div>
415
  <form method="post" action="options.php">
417
  settings_fields ('oa_social_login_settings_group');
418
  $settings = get_option ('oa_social_login_settings');
419
  ?>
420
+ <table class="form-table oa_form_table">
421
+ <tr>
422
+ <th class="head" colspan="2">
423
+ <?php _e ('API Connection Handler', 'oa_social_login'); ?>
424
+ </th>
425
+ </tr>
426
+ <?php
427
+ $api_connection_handler = ((empty ($settings ['api_connection_handler']) OR $settings ['api_connection_handler'] <> 'fsockopen') ? 'curl' : 'fsockopen');
428
+ ?>
429
+ <tr>
430
+ <th scope="row" rowspan="2">
431
+ <label><?php _e ('API Connection Handler', 'oa_social_login'); ?>:</label>
432
+ </th>
433
+ <td>
434
+ <input type="radio" id="oa_social_login_api_connection_handler_curl" name="oa_social_login_settings[api_connection_handler]" value="curl" <?php echo (($api_connection_handler <> 'fsockopen') ? 'checked="checked"' : ''); ?> />
435
+ <label for="oa_social_login_api_connection_handler_curl"><?php _e ('Use PHP CURL to communicate with the API', 'oa_social_login'); ?> <strong>(<?php _e ('Default', 'oa_social_login') ?>)</strong></label><br />
436
+ <span class="description"><?php _e ('Using CURL is recommended but it might be disabled on some servers.', 'oa_social_login'); ?></span>
437
+ </td>
438
+ </tr>
439
+ <tr>
440
+ <td>
441
+ <input type="radio" id="oa_social_login_api_connection_handler_fsockopen" name="oa_social_login_settings[api_connection_handler]" value="fsockopen" <?php echo (($api_connection_handler == 'fsockopen') ? 'checked="checked"' : ''); ?> />
442
+ <label for="oa_social_login_api_connection_handler_fsockopen"><?php _e ('Use PHP FSOCKOPEN to communicate with the API', 'oa_social_login'); ?></label><br />
443
+ <span class="description"><?php _e ('Try using FSOCKOPEN if you encounter any problems with CURL.', 'oa_social_login'); ?></span>
444
+ </td>
445
+ </tr>
446
+ <tr class="foot">
447
+ <td>
448
+ <a class="button-secondary" id="oa_social_login_autodetect_api_connection_handler" href="#"><?php _e ('Autodetect API Connection', 'oa_social_login'); ?></a>
449
+ </td>
450
+ <td>
451
+ <div id="oa_social_login_api_connection_handler_result"></div>
452
+ </td>
453
+ </tr>
454
+ </table>
455
  <table class="form-table oa_form_table">
456
  <tr>
457
  <th class="head">
463
  </tr>
464
  <tr>
465
  <th scope="row">
466
+ <label for="oa_social_login_settings_api_subdomain"><?php _e ('API Subdomain', 'oa_social_login'); ?>:</label>
467
  </th>
468
  <td>
469
+ <input type="text" id="oa_social_login_settings_api_subdomain" name="oa_social_login_settings[api_subdomain]" size="75" value="<?php echo (isset ($settings ['api_subdomain']) ? htmlspecialchars ($settings ['api_subdomain']) : ''); ?>" />
470
  </td>
471
  </tr>
472
  <tr>
473
  <th scope="row">
474
+ <label for="oa_social_login_settings_api_key"><?php _e ('API Public Key', 'oa_social_login'); ?>:</label>
475
  </th>
476
  <td>
477
+ <input type="text" id="oa_social_login_settings_api_key" name="oa_social_login_settings[api_key]" size="75" value="<?php echo (isset ($settings ['api_key']) ? htmlspecialchars ($settings ['api_key']) : ''); ?>" />
478
  </td>
479
  </tr>
480
  <tr>
481
  <th scope="row">
482
+ <label for="oa_social_login_settings_api_secret"><?php _e ('API Private Key', 'oa_social_login'); ?>:</label>
483
  </th>
484
  <td>
485
+ <input type="text" id="oa_social_login_settings_api_secret" name="oa_social_login_settings[api_secret]" size="75" value="<?php echo (isset ($settings ['api_secret']) ? htmlspecialchars ($settings ['api_secret']) : ''); ?>" />
486
  </td>
487
  </tr>
488
  <tr class="foot">
496
  </table>
497
  <table class="form-table oa_form_table">
498
  <tr>
499
+ <th class="head">
500
  <?php _e ('Enable the social networks/identity providers of your choice', 'oa_social_login'); ?>
501
  </th>
502
  </tr>
511
  <input type="checkbox" id="oneall_social_login_provider_<?php echo $key; ?>" name="oa_social_login_settings[providers][<?php echo $key; ?>]" value="1" <?php checked ('1', $settings ['providers'] [$key]); ?> />
512
  <label for="oneall_social_login_provider_<?php echo $key; ?>"><?php echo htmlspecialchars ($provider_data ['name']); ?></label>
513
  <?php
514
+ if ($key == 'vkontakte')
515
+ {
516
+ echo ' - ' . sprintf (__ ('To enable cyrillic usernames, you might need <a target="_blank" href="%s">this plugin</a>', 'oa_social_login'), 'http://wordpress.org/extend/plugins/wordpress-special-characters-in-usernames/');
517
+ }
518
+ ?>
519
  </td>
520
  </tr>
521
  <?php
522
  }
523
  ?>
524
  </table>
525
+ <table class="form-table oa_form_table oa_form_table_notice">
526
+ <tr>
527
+ <th class="head">
528
+ <?php _e ('Keep in mind when testing the plugin', 'oa_social_login'); ?>
529
+ </th>
530
+ </tr>
531
+ <tr class="row_even">
532
+ <td>
533
+ <?php _e ('Social Login is a plugin that allows your users to comment and login with social networks. If a user is already logged in, the plugin will not be displayed. There is in fact no need to give the user the possibilty to connect with a social network if he is already connected.'); ?>
534
+ <strong><?php _e ('You will therefore have to logout to see the plugin in action.');?></strong>
535
+ </td>
536
+ </tr>
537
+ </table>
538
+
539
  <table class="form-table oa_form_table oa_form_table_settings">
540
  <tr>
541
  <th class="head">
554
  </tr>
555
  <tr class="row_odd">
556
  <td>
557
+ <?php _e ("If the user's social network profile has an avatar thumbnail, should we show it as default avatar for the user?", 'oa_social_login'); ?>
558
  </td>
559
  </tr>
560
  <tr class="row_even">
581
  </td>
582
  </tr>
583
  </table>
584
+
585
+ <table class="form-table oa_form_table oa_form_table_settings">
586
+ <tr>
587
+ <th class="head">
588
+ <?php _e ('Comment Settings', 'oa_social_login'); ?>
589
+ </th>
590
+ </tr>
591
+ <tr class="row_odd">
592
+ <td>
593
+ <?php _e ("Show the Social Login buttons the comment area if comments are disabled for guests?", 'oa_social_login'); ?><br />
594
+
595
+ </td>
596
+ </tr>
597
+ <tr class="row_even">
598
+ <td>
599
+ <?php
600
+ $plugin_comment_show_if_members_only = (isset ($settings ['plugin_comment_show_if_members_only']) AND $settings ['plugin_comment_show_if_members_only'] == '1');
601
+ ?>
602
+ <input type="radio" name="oa_social_login_settings[plugin_comment_show_if_members_only]" value="0" <?php echo (!$plugin_comment_show_if_members_only ? 'checked="checked"' : ''); ?> /> <?php _e('No, do not show the social network buttons', 'oa_social_login'); ?> <strong>(<?php _e ('Default', 'oa_social_login') ?>)</strong><br />
603
+ <input type="radio" name="oa_social_login_settings[plugin_comment_show_if_members_only]" value="1" <?php echo ($plugin_comment_show_if_members_only ? 'checked="checked"' : ''); ?> /> <?php _e('Yes, show the social network buttons', 'oa_social_login'); ?><br />
604
+ <span class="description"><?php _e('The buttons will be displayed below the "You must be logged in to leave a comment" notice');?></span>
605
+ </td>
606
+ </tr>
607
+ <tr class="row_odd">
608
+ <td>
609
+ <?php _e ("Automatically approve comments left by users that connected with a social network?", 'oa_social_login'); ?><br />
610
+
611
+ </td>
612
+ </tr>
613
+ <tr class="row_even">
614
+ <td>
615
+ <?php
616
+ $plugin_comment_auto_approve = (isset ($settings ['plugin_comment_auto_approve']) AND $settings ['plugin_comment_auto_approve'] == '1');
617
+ ?>
618
+ <input type="radio" name="oa_social_login_settings[plugin_comment_auto_approve]" value="0" <?php echo (!$plugin_comment_auto_approve ? 'checked="checked"' : ''); ?> /> <?php _e('No, do not automatically approve', 'oa_social_login'); ?> <strong>(<?php _e ('Default', 'oa_social_login') ?>)</strong><br />
619
+ <input type="radio" name="oa_social_login_settings[plugin_comment_auto_approve]" value="1" <?php echo ($plugin_comment_auto_approve ? 'checked="checked"' : ''); ?> /> <?php _e('Yes, automatically approve comments made by users that connected with a social network', 'oa_social_login'); ?><br />
620
+ </td>
621
+ </tr>
622
+ </table>
623
+
624
  <table class="form-table oa_form_table oa_form_table_settings">
625
  <tr>
626
  <th class="head">
649
  <tr class="row_even">
650
  <td>
651
  <?php
652
+ $plugin_login_form_redirect = ((!isset ($settings ['plugin_login_form_redirect']) OR !in_array ($settings ['plugin_login_form_redirect'], array ('dashboard', 'homepage', 'custom'))) ? 'homepage' : $settings ['plugin_login_form_redirect']);
 
 
 
 
653
  ?>
654
  <input type="radio" name="oa_social_login_settings[plugin_login_form_redirect]" value="homepage" <?php echo ($plugin_login_form_redirect == 'homepage' ? 'checked="checked"' : ''); ?> /> <?php _e ('Redirect users to the homepage of my blog', 'oa_social_login'); ?> <strong>(<?php _e ('Default', 'oa_social_login') ?>)</strong><br />
655
  <input type="radio" name="oa_social_login_settings[plugin_login_form_redirect]" value="dashboard" <?php echo ($plugin_login_form_redirect == 'dashboard' ? 'checked="checked"' : ''); ?> /> <?php _e ('Redirect users to their account dashboard', 'oa_social_login'); ?><br />
701
  <tr class="row_even">
702
  <td>
703
  <?php
704
+ $plugin_registration_form_redirect = ((!isset ($settings ['plugin_registration_form_redirect']) OR !in_array ($settings ['plugin_registration_form_redirect'], array ('dashboard', 'homepage', 'custom'))) ? 'dashboard' : $settings ['plugin_registration_form_redirect']);
 
 
 
 
705
  ?>
706
  <input type="radio" name="oa_social_login_settings[plugin_registration_form_redirect]" value="homepage" <?php echo ($plugin_registration_form_redirect == 'homepage' ? 'checked="checked"' : ''); ?> /> <?php _e ('Redirect users to the homepage of my blog', 'oa_social_login'); ?><br />
707
  <input type="radio" name="oa_social_login_settings[plugin_registration_form_redirect]" value="dashboard" <?php echo ($plugin_registration_form_redirect == 'dashboard' ? 'checked="checked"' : ''); ?> /> <?php _e ('Redirect users to their account dashboard', 'oa_social_login'); ?> <strong>(<?php _e ('Default', 'oa_social_login') ?>)</strong><br />
includes/communication.php ADDED
@@ -0,0 +1,569 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Handle the callback
5
+ */
6
+ function oa_social_login_callback ()
7
+ {
8
+ //Callback Handler
9
+ if (isset ($_POST) AND !empty ($_POST ['oa_action']) AND $_POST ['oa_action'] == 'social_login' AND !empty ($_POST ['connection_token']))
10
+ {
11
+ //Read settings
12
+ $settings = get_option ('oa_social_login_settings');
13
+
14
+ //API Settings
15
+ $api_connection_handler = ((!empty ($settings ['api_connection_handler']) AND $settings ['api_connection_handler'] == 'fsockopen') ? 'fsockopen' : 'curl');
16
+ $api_subdomain = (!empty ($settings ['api_subdomain']) ? $settings ['api_subdomain'] : '');
17
+ $api_key = (!empty ($settings ['api_key']) ? $settings ['api_key'] : '');
18
+ $api_secret = (!empty ($settings ['api_secret']) ? $settings ['api_secret'] : '');
19
+ $api_resource_url = 'https://' . $api_subdomain . '.api.oneall.com/connections/' . $_POST ['connection_token'] . '.json';
20
+
21
+ //Get connection details
22
+ $result = oa_social_login_do_api_request ($api_connection_handler, $api_resource_url, array ('api_key' => $api_key, 'api_secret' => $api_secret), 15);
23
+
24
+ //Parse result
25
+ if (is_object ($result) AND property_exists ($result, 'http_code') AND $result->http_code == 200)
26
+ {
27
+ if (property_exists ($result, 'http_data'))
28
+ {
29
+ //Decode
30
+ $social_data = json_decode ($result->http_data);
31
+
32
+ //User Data
33
+ if (is_object ($social_data))
34
+ {
35
+ $identity = $social_data->response->result->data->user->identity;
36
+ $user_token = $social_data->response->result->data->user->user_token;
37
+
38
+ //Identity
39
+ $user_identity_id = $identity->id;
40
+ $user_identity_provider = $identity->source->name;
41
+
42
+ //Firstname
43
+ if (!empty ($identity->name->givenName))
44
+ {
45
+ $user_first_name = $identity->name->givenName;
46
+ }
47
+ else
48
+ {
49
+ $user_first_name = '';
50
+ }
51
+
52
+ //Lastname
53
+ if (!empty ($identity->name->familyName))
54
+ {
55
+ $user_last_name = $identity->name->familyName;
56
+ }
57
+ else
58
+ {
59
+ $user_last_name = '';
60
+ }
61
+
62
+ //Construct a full name from first and last names
63
+ $user_constructed_name = trim ($user_first_name . ' ' . $user_last_name);
64
+
65
+ //Fullname
66
+ if (!empty ($identity->name->formatted))
67
+ {
68
+ $user_full_name = $identity->name->formatted;
69
+ }
70
+ elseif (!empty ($identity->name->displayName))
71
+ {
72
+ $user_full_name = $identity->name->displayName;
73
+ }
74
+ else
75
+ {
76
+ $user_full_name = $user_constructed_name;
77
+ }
78
+
79
+ //Email
80
+ $user_email = '';
81
+ if (property_exists ($identity, 'emails') AND is_array ($identity->emails))
82
+ {
83
+ foreach ($identity->emails AS $email)
84
+ {
85
+ $user_email = $email->value;
86
+ $user_email_is_verified = ($email->is_verified == '1');
87
+ }
88
+ }
89
+
90
+ //Thumbnail
91
+ if (!empty ($identity->thumbnailUrl))
92
+ {
93
+ $user_thumbnail = trim ($identity->thumbnailUrl);
94
+ }
95
+ else
96
+ {
97
+ $user_thumbnail = '';
98
+ }
99
+
100
+ //User Website
101
+ if (!empty ($identity->profileUrl))
102
+ {
103
+ $user_website = $identity->profileUrl;
104
+ }
105
+ elseif (!empty ($identity->urls [0]->value))
106
+ {
107
+ $user_website = $identity->urls [0]->value;
108
+ }
109
+ else
110
+ {
111
+ $user_website = '';
112
+ }
113
+
114
+ //Preferred Username
115
+ if (!empty ($identity->preferredUsername))
116
+ {
117
+ $user_login = $identity->preferredUsername;
118
+ }
119
+ elseif (!empty ($identity->displayName))
120
+ {
121
+ $user_login = $identity->displayName;
122
+ }
123
+ else
124
+ {
125
+ $user_login = $user_full_name;
126
+ }
127
+
128
+ //Sanitize Login
129
+ $user_login = sanitize_user ($user_login, true);
130
+
131
+ // Get user by token
132
+ $user_id = oa_social_login_get_user_by_token ($user_token);
133
+
134
+ //Try to link to existing account
135
+ if (!is_numeric ($user_id))
136
+ {
137
+ //Linked enabled?
138
+ if (!isset ($settings ['plugin_link_verified_accounts']) OR $settings ['plugin_link_verified_accounts'] == '1')
139
+ {
140
+ //Only if email is verified
141
+ if (!empty ($user_email) AND $user_email_is_verified === true)
142
+ {
143
+ //Read existing user
144
+ if (($user_id_tmp = email_exists ($user_email)) !== false)
145
+ {
146
+ if (is_numeric ($user_id_tmp))
147
+ {
148
+ $user_id = $user_id_tmp;
149
+ delete_metadata ('user', null, 'oa_social_login_user_token', $user_token, true);
150
+ update_user_meta ($user_id, 'oa_social_login_user_token', $user_token);
151
+ update_user_meta ($user_id, 'oa_social_login_identity_id', $user_identity_id);
152
+ update_user_meta ($user_id, 'oa_social_login_identity_provider', $user_identity_provider);
153
+
154
+ if (!empty ($user_thumbnail))
155
+ {
156
+ update_user_meta ($user_id, 'oa_social_login_user_thumbnail', $user_thumbnail);
157
+ }
158
+ }
159
+ }
160
+ }
161
+ }
162
+ }
163
+
164
+
165
+ //New User
166
+ if (!is_numeric ($user_id))
167
+ {
168
+ //Username is mandatory
169
+ if (!isset ($user_login) OR strlen (trim ($user_login)) == 0)
170
+ {
171
+ $user_login = $user_identity_provider . 'User';
172
+ }
173
+
174
+ //Username must be unique
175
+ if (username_exists ($user_login))
176
+ {
177
+ $i = 1;
178
+ $user_login_tmp = $user_login;
179
+ do
180
+ {
181
+ $user_login_tmp = $user_login . ($i++);
182
+ }
183
+ while (username_exists ($user_login_tmp));
184
+ $user_login = $user_login_tmp;
185
+ }
186
+
187
+ //Email must be unique
188
+ if (!isset ($user_email) OR !is_email ($user_email) OR email_exists ($user_email))
189
+ {
190
+ $user_email = oa_social_login_create_rand_email ();
191
+ }
192
+
193
+ //Build user data
194
+ $user_data = array (
195
+ 'user_login' => $user_login,
196
+ 'display_name' => (!empty ($user_full_name) ? $user_full_name : $user_login),
197
+ 'user_email' => $user_email,
198
+ 'first_name' => $user_first_name,
199
+ 'last_name' => $user_last_name,
200
+ 'user_url' => $user_website,
201
+ 'user_pass' => wp_generate_password ()
202
+ );
203
+
204
+ // Create a new user
205
+ $user_id = wp_insert_user ($user_data);
206
+ if (is_numeric ($user_id))
207
+ {
208
+ delete_metadata ('user', null, 'oa_social_login_user_token', $user_token, true);
209
+ update_user_meta ($user_id, 'oa_social_login_user_token', $user_token);
210
+ update_user_meta ($user_id, 'oa_social_login_identity_id', $user_identity_id);
211
+ update_user_meta ($user_id, 'oa_social_login_identity_provider', $user_identity_provider);
212
+
213
+ if (!empty ($user_thumbnail))
214
+ {
215
+ update_user_meta ($user_id, 'oa_social_login_user_thumbnail', $user_thumbnail);
216
+ }
217
+ }
218
+ }
219
+
220
+ //Sucess
221
+ if (is_object (get_userdata ($user_id)))
222
+ {
223
+ //Setup Cookie
224
+ wp_set_auth_cookie ($user_id, true);
225
+
226
+ //Where did the user come from?
227
+ $oa_social_login_source = (!empty ($_REQUEST ['oa_social_login_source']) ? strtolower (trim ($_REQUEST ['oa_social_login_source'])) : '');
228
+
229
+ //Use safe redirection?
230
+ $redirect_to_safe = false;
231
+
232
+ //Build the url to redirect the user to
233
+ switch ($oa_social_login_source)
234
+ {
235
+ //*************** Registration ***************
236
+ case 'registration':
237
+ //Default redirection
238
+ $redirect_to = admin_url ();
239
+
240
+ //Redirection customized
241
+ if (isset ($settings ['plugin_registration_form_redirect']))
242
+ {
243
+ switch (strtolower ($settings ['plugin_registration_form_redirect']))
244
+ {
245
+ //Homepage
246
+ case 'homepage':
247
+ $redirect_to = site_url ();
248
+ break;
249
+
250
+ //Custom
251
+ case 'custom':
252
+ if (isset ($settings ['plugin_registration_form_redirect_custom_url']) AND strlen (trim ($settings ['plugin_registration_form_redirect_custom_url'])) > 0)
253
+ {
254
+ $redirect_to = trim ($settings ['plugin_registration_form_redirect_custom_url']);
255
+ }
256
+ break;
257
+
258
+ //Default/Dashboard
259
+ default:
260
+ case 'dashboard':
261
+ $redirect_to = admin_url ();
262
+ break;
263
+ }
264
+ }
265
+ break;
266
+
267
+
268
+ //*************** Login ***************
269
+ case 'login':
270
+ //Default redirection
271
+ $redirect_to = site_url ();
272
+
273
+ //Redirection in URL
274
+ if (!empty ($_GET ['redirect_to']))
275
+ {
276
+ $redirect_to = $_GET ['redirect_to'];
277
+ $redirect_to_safe = true;
278
+ }
279
+ else
280
+ {
281
+ //Redirection customized
282
+ if (isset ($settings ['plugin_login_form_redirect']))
283
+ {
284
+ switch (strtolower ($settings ['plugin_login_form_redirect']))
285
+ {
286
+ //Dashboard
287
+ case 'dashboard':
288
+ $redirect_to = admin_url ();
289
+ break;
290
+
291
+ //Custom
292
+ case 'custom':
293
+ if (isset ($settings ['plugin_login_form_redirect_custom_url']) AND strlen (trim ($settings ['plugin_login_form_redirect_custom_url'])) > 0)
294
+ {
295
+ $redirect_to = trim ($settings ['plugin_login_form_redirect_custom_url']);
296
+ }
297
+ break;
298
+
299
+ //Default/Homepage
300
+ default:
301
+ case 'homepage':
302
+ $redirect_to = site_url ();
303
+ break;
304
+ }
305
+ }
306
+ }
307
+ break;
308
+
309
+ // *************** Other ***************
310
+ default:
311
+ //Get request URI - Should work on Apache + IIS
312
+ $request_uri = ((!isset ($_SERVER ['REQUEST_URI'])) ? $_SERVER ['PHP_SELF'] : $_SERVER ['REQUEST_URI']);
313
+ $request_port = ((!empty ($_SERVER ['SERVER_PORT']) AND $_SERVER ['SERVER_PORT'] <> '80') ? (":" . $_SERVER ['SERVER_PORT']) : '');
314
+ $request_protocol = (is_ssl () ? 'https' : 'http') . "://";
315
+ $redirect_to = $request_protocol . $_SERVER ['SERVER_NAME'] . $request_port . $request_uri;
316
+
317
+ //Remove the oa_social_login_source argument
318
+ if (strpos ($redirect_to, 'oa_social_login_source') !== false)
319
+ {
320
+ //Break up url
321
+ list($url_part, $query_part) = array_pad (explode ('?', $redirect_to), 2, '');
322
+ parse_str ($query_part, $query_vars);
323
+
324
+ //Remove oa_social_login_source argument
325
+ if (is_array ($query_vars) AND isset ($query_vars ['oa_social_login_source']))
326
+ {
327
+ unset ($query_vars ['oa_social_login_source']);
328
+ }
329
+
330
+ //Build new url
331
+ $redirect_to = $url_part . ((is_array ($query_vars) AND count ($query_vars) > 0) ? ('?' . http_build_query ($query_vars)) : '');
332
+ }
333
+
334
+ //Anchor to #comments
335
+ if ($oa_social_login_source == 'comments')
336
+ {
337
+ $redirect_to .= '#comments';
338
+ }
339
+ break;
340
+ }
341
+
342
+ //Check if url set
343
+ if (!isset ($redirect_to_safe) OR strlen (trim ($redirect_to_safe)) == 0)
344
+ {
345
+ $redirect_to_safe = site_url ();
346
+ }
347
+
348
+ //Use safe redirection
349
+ if ($redirect_to_safe === true)
350
+ {
351
+ wp_safe_redirect ($redirect_to);
352
+ }
353
+ else
354
+ {
355
+ wp_redirect ($redirect_to);
356
+ }
357
+ exit ();
358
+ }
359
+ }
360
+ }
361
+ }
362
+ }
363
+ }
364
+
365
+
366
+ /**
367
+ * Send an API request by using the given handler
368
+ */
369
+ function oa_social_login_do_api_request ($handler, $url, $options = array (), $timeout = 15)
370
+ {
371
+ //FSOCKOPEN
372
+ if ($handler == 'fsockopen')
373
+ {
374
+ return oa_social_login_fsockopen_request ($url, $options, $timeout);
375
+ }
376
+ //CURL
377
+ else
378
+ {
379
+ return oa_social_login_curl_request ($url, $options, $timeout);
380
+ }
381
+ }
382
+
383
+
384
+ /**
385
+ * Check if fsockopen can be used
386
+ */
387
+ function oa_social_login_check_fsockopen ()
388
+ {
389
+ $result = oa_social_login_fsockopen_request ('https://www.oneall.com/ping.html');
390
+ if (is_object ($result) AND property_exists ($result, 'http_code') AND $result->http_code == 200)
391
+ {
392
+ if (property_exists ($result, 'http_data'))
393
+ {
394
+ if (strtolower ($result->http_data) == 'ok')
395
+ {
396
+ return true;
397
+ }
398
+ }
399
+ }
400
+ return false;
401
+ }
402
+
403
+
404
+ /**
405
+ * Check if CURL can be used
406
+ */
407
+ function oa_social_login_check_curl ()
408
+ {
409
+ if (in_array ('curl', get_loaded_extensions ()))
410
+ {
411
+ $result = oa_social_login_curl_request ('https://www.oneall.com/ping.html');
412
+ if (is_object ($result) AND property_exists ($result, 'http_code') AND $result->http_code == 200)
413
+ {
414
+ if (property_exists ($result, 'http_data'))
415
+ {
416
+ if (strtolower ($result->http_data) == 'ok')
417
+ {
418
+ return true;
419
+ }
420
+ }
421
+ }
422
+ }
423
+ return false;
424
+ }
425
+
426
+
427
+ /**
428
+ * Sends a CURL request
429
+ */
430
+ function oa_social_login_curl_request ($url, $options = array (), $timeout = 15)
431
+ {
432
+ //Store the result
433
+ $result = new stdClass ();
434
+
435
+ //Send request
436
+ $curl = curl_init ();
437
+ curl_setopt ($curl, CURLOPT_URL, $url);
438
+ curl_setopt ($curl, CURLOPT_HEADER, 0);
439
+ curl_setopt ($curl, CURLOPT_TIMEOUT, $timeout);
440
+ curl_setopt ($curl, CURLOPT_VERBOSE, 0);
441
+ curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
442
+ curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0);
443
+ curl_setopt ($curl, CURLOPT_SSL_VERIFYHOST, 0);
444
+
445
+ // BASIC AUTH?
446
+ if (isset ($options ['api_key']) AND isset ($options ['api_secret']))
447
+ {
448
+ curl_setopt ($curl, CURLOPT_USERPWD, $options ['api_key'] . ":" . $options ['api_secret']);
449
+ }
450
+
451
+ //Make request
452
+ if (($http_data = curl_exec ($curl)) !== false)
453
+ {
454
+ $result->http_code = curl_getinfo ($curl, CURLINFO_HTTP_CODE);
455
+ $result->http_data = $http_data;
456
+ $result->http_error = null;
457
+ }
458
+ else
459
+ {
460
+ $result->http_code = -1;
461
+ $result->http_data = null;
462
+ $result->http_error = curl_error ($curl);
463
+ }
464
+
465
+ //Done
466
+ return $result;
467
+ }
468
+
469
+
470
+ /**
471
+ * Sends an fsockopen request
472
+ */
473
+ function oa_social_login_fsockopen_request ($url, $options = array (), $timeout = 15)
474
+ {
475
+ //Store the result
476
+ $result = new stdClass ();
477
+
478
+ //Make that this is a valid URL
479
+ if (($uri = parse_url ($url)) == false)
480
+ {
481
+ $result->http_code = -1;
482
+ $result->http_data = null;
483
+ $result->http_error = 'invalid_uri';
484
+ return $result;
485
+ }
486
+
487
+ //Make sure we can handle the schema
488
+ switch ($uri ['scheme'])
489
+ {
490
+ case 'http':
491
+ $port = (isset ($uri ['port']) ? $uri ['port'] : 80);
492
+ $host = ($uri ['host'] . ($port != 80 ? ':' . $port : ''));
493
+ $fp = @fsockopen ($uri ['host'], $port, $errno, $errstr, $timeout);
494
+ break;
495
+
496
+ case 'https':
497
+ $port = (isset ($uri ['port']) ? $uri ['port'] : 443);
498
+ $host = ($uri ['host'] . ($port != 443 ? ':' . $port : ''));
499
+ $fp = @fsockopen ('ssl://' . $uri ['host'], $port, $errno, $errstr, $timeout);
500
+ break;
501
+
502
+ default:
503
+ $result->http_code = -1;
504
+ $result->http_data = null;
505
+ $result->http_error = 'invalid_schema';
506
+ return $result;
507
+ break;
508
+ }
509
+
510
+ //Make sure the socket opened properly
511
+ if (!$fp)
512
+ {
513
+ $result->http_code = -$errno;
514
+ $result->http_data = null;
515
+ $result->http_error = trim ($errstr);
516
+ return $result;
517
+ }
518
+
519
+ //Construct the path to act on
520
+ $path = (isset ($uri ['path']) ? $uri ['path'] : '/');
521
+ if (isset ($uri ['query']))
522
+ {
523
+ $path .= '?' . $uri ['query'];
524
+ }
525
+
526
+ //Create HTTP request
527
+ $defaults = array (
528
+ 'Host' => "Host: $host",
529
+ 'User-Agent' => 'User-Agent: OneAllSocialLogin (+http://www.oneall.com/)',
530
+ );
531
+
532
+ // BASIC AUTH?
533
+ if (isset ($options ['api_key']) AND isset ($options ['api_secret']))
534
+ {
535
+ $defaults ['Authorization'] = 'Authorization: Basic ' . base64_encode ($options ['api_key'] . ":" . $options ['api_secret']);
536
+ }
537
+
538
+ //Build and send request
539
+ $request = 'GET ' . $path . " HTTP/1.0\r\n";
540
+ $request .= implode ("\r\n", $defaults);
541
+ $request .= "\r\n\r\n";
542
+ fwrite ($fp, $request);
543
+
544
+ //Fetch response
545
+ $response = '';
546
+ while (!feof ($fp))
547
+ {
548
+ $response .= fread ($fp, 1024);
549
+ }
550
+
551
+ //Close connection
552
+ fclose ($fp);
553
+
554
+ //Parse response
555
+ list($response_header, $response_body) = explode ("\r\n\r\n", $response, 2);
556
+
557
+ //Parse header
558
+ $response_header = preg_split ("/\r\n|\n|\r/", $response_header);
559
+ list($header_protocol, $header_code, $header_status_message) = explode (' ', trim (array_shift ($response_header)), 3);
560
+
561
+ //Build result
562
+ $result->http_code = $header_code;
563
+ $result->http_data = $response_body;
564
+
565
+ //Done
566
+ return $result;
567
+ }
568
+
569
+
includes/settings.php CHANGED
@@ -34,6 +34,12 @@ $oa_social_login_providers = array (
34
  'livejournal' => array (
35
  'name' => 'LiveJournal'
36
  ),
 
 
 
 
 
 
37
  'vkontakte' => array (
38
  'name' => 'VKontakte (Вконтакте)'
39
  )
34
  'livejournal' => array (
35
  'name' => 'LiveJournal'
36
  ),
37
+ 'steam' => array (
38
+ 'name' => 'Steam'
39
+ ),
40
+ 'stackexchange' => array (
41
+ 'name' => 'StackExchange'
42
+ ),
43
  'vkontakte' => array (
44
  'name' => 'VKontakte (Вконтакте)'
45
  )
includes/toolbox.php CHANGED
@@ -1,5 +1,19 @@
1
  <?php
2
- require_once(dirname (dirname (dirname (dirname (dirname (__FILE__))))) . '/wp-load.php');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
 
5
  /**
@@ -12,6 +26,7 @@ function oa_social_login_get_user_by_token ($user_token)
12
  return $wpdb->get_var ($wpdb->prepare ($sql, $user_token));
13
  }
14
 
 
15
  /**
16
  * Create a random email
17
  */
@@ -26,371 +41,5 @@ function oa_social_login_create_rand_email ()
26
  return $email;
27
  }
28
 
29
- /**
30
- * Initialise
31
- */
32
- function oa_social_login_init ()
33
- {
34
- //Localization
35
- if (function_exists ('load_plugin_textdomain'))
36
- {
37
- load_plugin_textdomain ('oa_social_login', false, OA_SOCIAL_LOGIN_BASE_PATH . '/languages/');
38
- }
39
-
40
- //Callback Handler
41
- oa_social_login_callback ();
42
- }
43
-
44
- /**
45
- * Handle the callback
46
- */
47
- function oa_social_login_callback ()
48
- {
49
- //Callback Handler
50
- if (isset ($_POST) AND !empty ($_POST ['oa_action']) AND $_POST ['oa_action'] == 'social_login' AND !empty ($_POST ['connection_token']))
51
- {
52
- //Read settings
53
- $settings = get_option ('oa_social_login_settings');
54
-
55
- //API Settings
56
- $api_subdomain = (!empty ($settings ['api_subdomain']) ? $settings ['api_subdomain'] : '');
57
- $api_key = (!empty ($settings ['api_key']) ? $settings ['api_key'] : '');
58
- $api_secret = (!empty ($settings ['api_secret']) ? $settings ['api_secret'] : '');
59
-
60
- //Get user profile
61
- $curl = curl_init ();
62
- curl_setopt ($curl, CURLOPT_URL, 'https://' . $api_subdomain . '.api.oneall.com/connections/' . $_POST ['connection_token'] . '.json');
63
- curl_setopt ($curl, CURLOPT_HEADER, 0);
64
- curl_setopt ($curl, CURLOPT_USERPWD, $api_key . ":" . $api_secret);
65
- curl_setopt ($curl, CURLOPT_TIMEOUT, 15);
66
- curl_setopt ($curl, CURLOPT_VERBOSE, 0);
67
- curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
68
- curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0);
69
- curl_setopt ($curl, CURLOPT_FAILONERROR, 0);
70
-
71
- //Process
72
- if (($json = curl_exec ($curl)) !== false)
73
- {
74
- //Close connection
75
- curl_close ($curl);
76
-
77
- //Decode
78
- $social_data = json_decode ($json);
79
 
80
- //User Data
81
- if (is_object ($social_data) AND $social_data->response->result->status->code == 200)
82
- {
83
- $identity = $social_data->response->result->data->user->identity;
84
- $user_token = $social_data->response->result->data->user->user_token;
85
 
86
- //Identity
87
- $user_identity_id = $identity->id;
88
- $user_identity_provider = $identity->source->name;
89
-
90
- //Firstname
91
- $user_first_name = $identity->name->givenName;
92
-
93
- //Lastname
94
- $user_last_name = $identity->name->familyName;
95
-
96
- //Construct a full name from first and last names
97
- $user_constructed_name = trim ($user_first_name . ' ' . $user_last_name);
98
-
99
- //Fullname
100
- if (!empty ($identity->name->formatted))
101
- {
102
- $user_full_name = $identity->name->formatted;
103
- }
104
- elseif (!empty ($identity->name->displayName))
105
- {
106
- $user_full_name = $identity->name->displayName;
107
- }
108
- else
109
- {
110
- $user_full_name = $user_constructed_name;
111
- }
112
-
113
- //Email
114
- $user_email = '';
115
- if (property_exists ($identity, 'emails') AND is_array ($identity->emails))
116
- {
117
- foreach ($identity->emails AS $email)
118
- {
119
- $user_email = $email->value;
120
- $user_email_is_verified = ($email->is_verified == '1');
121
- }
122
- }
123
-
124
- //Thumbnail
125
- if (!empty ($identity->thumbnailUrl))
126
- {
127
- $user_thumbnail = trim ($identity->thumbnailUrl);
128
- }
129
- else
130
- {
131
- $user_thumbnail = '';
132
- }
133
-
134
- //User Website
135
- if (!empty ($identity->profileUrl))
136
- {
137
- $user_website = $identity->profileUrl;
138
- }
139
- elseif (!empty ($identity->urls [0]->value))
140
- {
141
- $user_website = $identity->urls [0]->value;
142
- }
143
- else
144
- {
145
- $user_website = '';
146
- }
147
-
148
- //Preferred Username
149
- if (!empty ($identity->preferredUsername))
150
- {
151
- $user_login = $identity->preferredUsername;
152
- }
153
- elseif (!empty ($identity->displayName))
154
- {
155
- $user_login = $identity->displayName;
156
- }
157
- else
158
- {
159
- $user_login = $user_full_name;
160
- }
161
-
162
- //Sanitize Login
163
- $user_login = sanitize_user ($user_login, true);
164
-
165
- // Get user by token
166
- $user_id = oa_social_login_get_user_by_token ($user_token);
167
-
168
- //Try to link to existing account
169
- if (!is_numeric ($user_id))
170
- {
171
- //Linked enabled?
172
- if (!isset ($settings ['plugin_link_verified_accounts']) OR $settings ['plugin_link_verified_accounts'] == '1')
173
- {
174
- //Only if email is verified
175
- if (!empty ($user_email) AND $user_email_is_verified === true)
176
- {
177
- //Read existing user
178
- if (($user_id_tmp = email_exists ($user_email)) !== false)
179
- {
180
- if (is_numeric ($user_id_tmp))
181
- {
182
- $user_id = $user_id_tmp;
183
- delete_metadata ('user', null, 'oa_social_login_user_token', $user_token, true);
184
- update_user_meta ($user_id, 'oa_social_login_user_token', $user_token);
185
- update_user_meta ($user_id, 'oa_social_login_identity_id', $user_identity_id);
186
- update_user_meta ($user_id, 'oa_social_login_identity_provider', $user_identity_provider);
187
-
188
- if (!empty ($user_thumbnail))
189
- {
190
- update_user_meta ($user_id, 'oa_social_login_user_thumbnail', $user_thumbnail);
191
- }
192
- }
193
- }
194
- }
195
- }
196
- }
197
-
198
-
199
- //New User
200
- if (!is_numeric ($user_id))
201
- {
202
- //Username is mandatory
203
- if (!isset ($user_login) OR strlen (trim ($user_login)) == 0)
204
- {
205
- $user_login = $user_identity_provider . 'User';
206
- }
207
-
208
- //Username must be unique
209
- if (username_exists ($user_login))
210
- {
211
- $i = 1;
212
- $user_login_tmp = $user_login;
213
- do
214
- {
215
- $user_login_tmp = $user_login . ($i++);
216
- }
217
- while (username_exists ($user_login_tmp));
218
- $user_login = $user_login_tmp;
219
- }
220
-
221
- //Email must be unique
222
- if (!isset ($user_email) OR !is_email ($user_email) OR email_exists ($user_email))
223
- {
224
- $user_email = oa_social_login_create_rand_email ();
225
- }
226
-
227
- //Build user data
228
- $user_data = array (
229
- 'user_login' => $user_login,
230
- 'display_name' => (!empty ($user_full_name) ? $user_full_name : $user_login),
231
- 'user_email' => $user_email,
232
- 'first_name' => $user_first_name,
233
- 'last_name' => $user_last_name,
234
- 'user_url' => $user_website,
235
- 'user_pass' => wp_generate_password ()
236
- );
237
-
238
- // Create a new user
239
- $user_id = wp_insert_user ($user_data);
240
- if (is_numeric ($user_id))
241
- {
242
- delete_metadata ('user', null, 'oa_social_login_user_token', $user_token, true);
243
- update_user_meta ($user_id, 'oa_social_login_user_token', $user_token);
244
- update_user_meta ($user_id, 'oa_social_login_identity_id', $user_identity_id);
245
- update_user_meta ($user_id, 'oa_social_login_identity_provider', $user_identity_provider);
246
-
247
- if (!empty ($user_thumbnail))
248
- {
249
- update_user_meta ($user_id, 'oa_social_login_user_thumbnail', $user_thumbnail);
250
- }
251
- }
252
- }
253
-
254
- //Sucess
255
- if (is_object (get_userdata ($user_id)))
256
- {
257
- //Setup Cookie
258
- wp_set_auth_cookie ($user_id, true);
259
-
260
- //Where did the user come from?
261
- $oa_social_login_source = (!empty ($_REQUEST ['oa_social_login_source']) ? strtolower (trim ($_REQUEST ['oa_social_login_source'])) : '');
262
-
263
- //Use safe redirection?
264
- $redirect_to_safe = false;
265
-
266
- //Build the url to redirect the user to
267
- switch ($oa_social_login_source)
268
- {
269
- //*************** Registration ***************
270
- case 'registration':
271
- //Default redirection
272
- $redirect_to = admin_url ();
273
-
274
- //Redirection customized
275
- if (isset ($settings ['plugin_registration_form_redirect']))
276
- {
277
- switch (strtolower ($settings ['plugin_registration_form_redirect']))
278
- {
279
- //Homepage
280
- case 'homepage':
281
- $redirect_to = site_url ();
282
- break;
283
-
284
- //Custom
285
- case 'custom':
286
- if (isset ($settings ['plugin_registration_form_redirect_custom_url']) AND strlen (trim ($settings ['plugin_registration_form_redirect_custom_url'])) > 0)
287
- {
288
- $redirect_to = trim ($settings ['plugin_registration_form_redirect_custom_url']);
289
- }
290
- break;
291
-
292
- //Default/Dashboard
293
- default:
294
- case 'dashboard':
295
- $redirect_to = admin_url ();
296
- break;
297
- }
298
- }
299
- break;
300
-
301
-
302
- //*************** Login ***************
303
- case 'login':
304
- //Default redirection
305
- $redirect_to = site_url ();
306
-
307
- //Redirection in URL
308
- if (!empty ($_GET ['redirect_to']))
309
- {
310
- $redirect_to = $_GET ['redirect_to'];
311
- $redirect_to_safe = true;
312
- }
313
- else
314
- {
315
- //Redirection customized
316
- if (isset ($settings ['plugin_login_form_redirect']))
317
- {
318
- switch (strtolower ($settings ['plugin_login_form_redirect']))
319
- {
320
- //Dashboard
321
- case 'dashboard':
322
- $redirect_to = admin_url ();
323
- break;
324
-
325
- //Custom
326
- case 'custom':
327
- if (isset ($settings ['plugin_login_form_redirect_custom_url']) AND strlen (trim ($settings ['plugin_login_form_redirect_custom_url'])) > 0)
328
- {
329
- $redirect_to = trim ($settings ['plugin_login_form_redirect_custom_url']);
330
- }
331
- break;
332
-
333
- //Default/Homepage
334
- default:
335
- case 'homepage':
336
- $redirect_to = site_url ();
337
- break;
338
- }
339
- }
340
- }
341
- break;
342
-
343
- // *************** Other ***************
344
- default:
345
- //Get request URI - Should work on Apache + IIS
346
- $request_uri = ((!isset ($_SERVER ['REQUEST_URI'])) ? $_SERVER ['PHP_SELF'] : $_SERVER ['REQUEST_URI']);
347
- $request_port = ((!empty ($_SERVER ['SERVER_PORT']) AND $_SERVER ['SERVER_PORT'] <> '80') ? (":" . $_SERVER ['SERVER_PORT']) : '');
348
- $request_protocol = (is_ssl () ? 'https' : 'http') . "://";
349
- $redirect_to = $request_protocol . $_SERVER ['SERVER_NAME'] . $request_port . $request_uri;
350
-
351
- //Remove the oa_social_login_source argument
352
- if (strpos ($redirect_to, 'oa_social_login_source') !== false)
353
- {
354
- //Break up url
355
- list($url_part, $query_part) = array_pad (explode ('?', $redirect_to), 2, '');
356
- parse_str ($query_part, $query_vars);
357
-
358
- //Remove oa_social_login_source argument
359
- if (is_array ($query_vars) AND isset ($query_vars ['oa_social_login_source']))
360
- {
361
- unset ($query_vars ['oa_social_login_source']);
362
- }
363
-
364
- //Build new url
365
- $redirect_to = $url_part . ((is_array ($query_vars) AND count ($query_vars) > 0) ? ('?' . http_build_query ($query_vars)) : '');
366
- }
367
-
368
- //Anchor to #comments
369
- if ($oa_social_login_source == 'comments')
370
- {
371
- $redirect_to .= '#comments';
372
- }
373
- break;
374
- }
375
-
376
- //Check if url set
377
- if (!isset ($redirect_to_safe) OR strlen (trim ($redirect_to_safe)) == 0)
378
- {
379
- $redirect_to_safe = site_url ();
380
- }
381
-
382
- //Use safe redirection
383
- if ($redirect_to_safe === true)
384
- {
385
- wp_safe_redirect ($redirect_to);
386
- }
387
- else
388
- {
389
- wp_redirect ($redirect_to);
390
- }
391
- exit ();
392
- }
393
- }
394
- }
395
- }
396
- }
1
  <?php
2
+
3
+ /**
4
+ * Initialise
5
+ */
6
+ function oa_social_login_init ()
7
+ {
8
+ //Localization
9
+ if (function_exists ('load_plugin_textdomain'))
10
+ {
11
+ load_plugin_textdomain ('oa_social_login', false, OA_SOCIAL_LOGIN_BASE_PATH . '/languages/');
12
+ }
13
+
14
+ //Callback Handler
15
+ oa_social_login_callback ();
16
+ }
17
 
18
 
19
  /**
26
  return $wpdb->get_var ($wpdb->prepare ($sql, $user_token));
27
  }
28
 
29
+
30
  /**
31
  * Create a random email
32
  */
41
  return $email;
42
  }
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
 
 
 
 
 
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/user_interface.php CHANGED
@@ -12,7 +12,7 @@ function oa_social_login_add_javascripts ()
12
 
13
  if (!empty ($settings ['api_subdomain']))
14
  {
15
- //Include in header, without version appended
16
  wp_register_script ("oa_social_library", ((is_ssl () ? 'https' : 'http') . '://' . $settings ['api_subdomain'] . '.api.oneall.com/socialize/library.js'), array (), null, false);
17
  }
18
  }
@@ -33,16 +33,10 @@ add_shortcode ('oa_social_login', 'oa_social_login_shortcode_handler');
33
 
34
 
35
  /**
36
- * Hook to display custom avatars in comments
37
  */
38
- function oa_social_login_custom_avatar ()
39
  {
40
- //The current comment
41
- global $comment;
42
-
43
- //Arguments passed to this function
44
- $args = func_get_args ();
45
-
46
  //The social login settings
47
  static $oa_social_login_settings = null;
48
  if (is_null ($oa_social_login_settings))
@@ -51,26 +45,70 @@ function oa_social_login_custom_avatar ()
51
  }
52
 
53
  //Check if we are in a comment
54
- if (!is_null ($comment) AND !empty ($comment->user_id) AND !empty ($args [0]))
55
  {
56
- if (isset ($oa_social_login_settings ['plugin_show_avatars_in_comments']) AND $oa_social_login_settings ['plugin_show_avatars_in_comments'] == '1')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  {
58
  //Read Thumbnail
59
- if (($user_thumbnail = get_user_meta ($comment->user_id, 'oa_social_login_user_thumbnail', true)) !== false)
60
  {
61
  if (strlen (trim ($user_thumbnail)) > 0)
62
  {
63
- $user_thumbnail = preg_replace ('#src=([\'"])([^\\1]+)\\1#Ui', "src=\\1" . $user_thumbnail . "\\1", $args [0]);
64
- $user_thumbnail = preg_replace ('#height=([\'"])([^\\1]+)\\1#Ui', "", $user_thumbnail);
65
- $user_thumbnail = preg_replace ('#width=([\'"])([^\\1]+)\\1#Ui', "", $user_thumbnail);
66
- return $user_thumbnail;
67
  }
68
  }
69
  }
70
  }
71
- return $args [0];
 
 
72
  }
73
- add_filter ('get_avatar', 'oa_social_login_custom_avatar');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
 
76
  /**
@@ -181,12 +219,12 @@ function oa_social_login_render_login_form ($source, $args = array())
181
  }
182
  }
183
 
184
- //Get the current protocoll
185
- $protocol = (is_ssl () ? 'https' : 'http');
186
 
187
  //Themes
188
- $css_theme_uri_small = $protocol . '://oneallcdn.com/css/api/socialize/themes/wordpress/small.css';
189
- $css_theme_uri_default = $protocol . '://oneallcdn.com/css/api/socialize/themes/wordpress/default.css';
190
 
191
  //Widget
192
  if ($source == 'widget')
@@ -210,7 +248,6 @@ function oa_social_login_render_login_form ($source, $args = array())
210
  $css_theme_uri = (!empty ($settings ['plugin_use_small_buttons']) ? $css_theme_uri_small : $css_theme_uri_default);
211
  }
212
 
213
-
214
  //Providers selected?
215
  if (count ($providers) > 0)
216
  {
@@ -236,6 +273,7 @@ function oa_social_login_render_login_form ($source, $args = array())
236
  $output [] = ' "css_theme_uri": "' . $css_theme_uri . '" ';
237
  $output [] = ' });';
238
  $output [] = ' </script>';
 
239
  $output [] = '</div>';
240
 
241
  //Done
12
 
13
  if (!empty ($settings ['api_subdomain']))
14
  {
15
+ //Include in header, without having the version appended
16
  wp_register_script ("oa_social_library", ((is_ssl () ? 'https' : 'http') . '://' . $settings ['api_subdomain'] . '.api.oneall.com/socialize/library.js'), array (), null, false);
17
  }
18
  }
33
 
34
 
35
  /**
36
+ * Hook to display custom avatars
37
  */
38
+ function oa_social_login_custom_avatar ($avatar, $mixed, $size, $default, $alt = '')
39
  {
 
 
 
 
 
 
40
  //The social login settings
41
  static $oa_social_login_settings = null;
42
  if (is_null ($oa_social_login_settings))
45
  }
46
 
47
  //Check if we are in a comment
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
+ //Chosen user
51
+ $user_id = null;
52
+
53
+ //Check if we have an user identifier
54
+ if (is_numeric($mixed))
55
+ {
56
+ if ($mixed > 0)
57
+ {
58
+ $user_id = $mixed;
59
+ }
60
+ }
61
+ //Check if we have an user object
62
+ else if(is_object($mixed))
63
+ {
64
+ if (property_exists ($mixed, 'user_id') AND is_numeric ($mixed->user_id))
65
+ {
66
+ $user_id = $mixed->user_id;
67
+ }
68
+ }
69
+
70
+ if ( ! empty ($user_id))
71
  {
72
  //Read Thumbnail
73
+ if (($user_thumbnail = get_user_meta ($user_id, 'oa_social_login_user_thumbnail', true)) !== false)
74
  {
75
  if (strlen (trim ($user_thumbnail)) > 0)
76
  {
77
+ return '<img alt="'. esc_attr($alt) .'" src="'.$user_thumbnail.'" class="avatar avatar-social-login avatar-'.$size.' photo" height="'.$size.'" width="'.$size.'" />';
 
 
 
78
  }
79
  }
80
  }
81
  }
82
+
83
+ //Default
84
+ return $avatar;
85
  }
86
+ add_filter ('get_avatar', 'oa_social_login_custom_avatar', 10, 5);
87
+
88
+
89
+ /**
90
+ * Show Social Login below "you must be logged in ..."
91
+ */
92
+ function oa_social_login_filter_comment_form_defaults($default_fields)
93
+ {
94
+ //No need to go further if comments disabled or user loggedin
95
+ if (is_array ($default_fields) AND comments_open () AND !is_user_logged_in ())
96
+ {
97
+ //Read settings
98
+ $settings = get_option ('oa_social_login_settings');
99
+ if ( ! empty($settings['plugin_comment_show_if_members_only']))
100
+ {
101
+ if ( ! isset ($default_fields['must_log_in']))
102
+ {
103
+ $default_fields['must_log_in'] = '';
104
+ }
105
+ $default_fields['must_log_in'] .= oa_social_login_render_login_form ('comments');
106
+ }
107
+ }
108
+ return $default_fields;
109
+ }
110
+ add_filter('comment_form_defaults', 'oa_social_login_filter_comment_form_defaults');
111
+
112
 
113
 
114
  /**
219
  }
220
  }
221
 
222
+ //Themes are served from the CDN
223
+ $theme_uri_prefix = (is_ssl () ? 'https://secure.oneallcdn.com' : 'http://public.oneallcdn.com');
224
 
225
  //Themes
226
+ $css_theme_uri_small = $theme_uri_prefix . './css/api/socialize/themes/wordpress/small.css';
227
+ $css_theme_uri_default = $theme_uri_prefix . '/css/api/socialize/themes/wordpress/default.css';
228
 
229
  //Widget
230
  if ($source == 'widget')
248
  $css_theme_uri = (!empty ($settings ['plugin_use_small_buttons']) ? $css_theme_uri_small : $css_theme_uri_default);
249
  }
250
 
 
251
  //Providers selected?
252
  if (count ($providers) > 0)
253
  {
273
  $output [] = ' "css_theme_uri": "' . $css_theme_uri . '" ';
274
  $output [] = ' });';
275
  $output [] = ' </script>';
276
+ $output [] = ' <!-- oneall.com / Social Login for Wordpress / v2.5 -->';
277
  $output [] = '</div>';
278
 
279
  //Done
languages/oa_social_login-de_DE.mo CHANGED
Binary file
languages/oa_social_login-de_DE.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Social Login\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2012-01-19 18:25+0100\n"
6
- "PO-Revision-Date: 2012-01-19 18:26+0100\n"
7
  "Last-Translator: Claude SCHLESSER <cschlesser@oneall.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
@@ -15,269 +15,355 @@ msgstr ""
15
  "X-Poedit-SourceCharset: utf-8\n"
16
  "X-Poedit-SearchPath-0: .\n"
17
 
18
- #: oa-social-login.php:24
19
  #, php-format
20
  msgid "This plugin requires WordPress %s or newer. Please update your WordPress installation to activate this plugin."
21
  msgstr "Dieses Plugin benötigt Wordpress %s oder höher. Bitte aktualisieren Sie Ihr Wordpress bevor Sie das Plugin installieren"
22
 
23
- #: oa-social-login.php:30
24
- msgid "This plugin requires the PHP libcurl extension be installed. Please contact your web host and request libcurl be <a href='http://www.php.net/manual/en/intro.curl.php'>installed</a>."
25
- msgstr "Im dieses Plugin zu nutzen benötigen Sie die PHP libcurl Erweiterung. Bitte kontaktieren Sie Ihren Server-Administrator um PHP libcurl zu <a href='http://www.php.net/manual/en/intro.curl.php'>installieren</a>."
26
-
27
- #: oa-social-login.php:52
28
  msgid "Settings"
29
  msgstr "Einstellungen"
30
 
31
- #: includes/admin.php:24
32
  msgid "Thank you for using the Social Login Plugin!"
33
  msgstr "Danke dass Sie Social Login installiert haben!"
34
 
35
- #: includes/admin.php:24
36
  #, php-format
37
  msgid "Please go to the <strong><a href=\"%s\">Settings\\Social Login</a></strong> page to setup the plugin."
38
  msgstr "Bitte rufen Sie die Seite <strong><a href=\"%s\">Einstellungen\\Social Login</a></strong> auf, um das Plugin zu konfigurieren."
39
 
40
- #: includes/admin.php:134
 
 
 
 
 
 
 
 
41
  msgid "Please fill out each of the fields above."
42
  msgstr "Bitte füllen Sie alle Felder aus"
43
 
44
- #: includes/admin.php:135
45
  msgid "The subdomain does not exist. Have you filled it out correctly?"
46
  msgstr "Subdomain wurde nicht gefunden. Haben Sie sie richtig ausgefüllt?"
47
 
48
- #: includes/admin.php:136
49
  msgid "The subdomain has a wrong syntax!"
50
  msgstr "Die Subdomain ist ungültig"
51
 
52
- #: includes/admin.php:137
53
  msgid "Could not contact API. Are outoing CURL requests allowed?"
54
  msgstr "Keine Verbindung zur API. Blockiert Ihr Firewall ausgehende Anfragen?"
55
 
56
- #: includes/admin.php:138
57
  msgid "The API credentials are wrong"
58
  msgstr "Die API-Nutzerdaten sind ungültig"
59
 
60
- #: includes/admin.php:139
61
- msgid "The settings are correct - do not forget to save your changes!"
62
- msgstr "Die Einstellungen sind korrekt! Vergessen Sie nicht abzuspeichern!"
 
 
 
 
 
 
 
 
 
63
 
64
- #: includes/admin.php:297
65
  msgid "Social Login Settings"
66
  msgstr "Social Login Einstellungen"
67
 
68
- #: includes/admin.php:304
69
  msgid "Make your blog social!"
70
  msgstr "Verbinden Sie Ihren Blog mit den sozialen Netzwerken!"
71
 
72
- #: includes/admin.php:308
73
  msgid "Allow your visitors to comment, login and register with social networks like Twitter, Facebook, LinkedIn, Hyves, VKontakte, Google or Yahoo."
74
  msgstr "Erlauben Sie Ihren Besuchern, sich mit sozialen Netzwerk wie z.B. Twitter, Facebook, LinkedIn, Hyves, VKontakte, Google oder Yahoo anzumelden, und Kommentare zu hinterlassen."
75
 
76
- #: includes/admin.php:309
77
  msgid "Draw a larger audience and increase user engagement in a few simple steps."
78
  msgstr "Steigern Sie die Beteilung Ihrer Nutzer auf einfachste Art und Weise."
79
 
80
- #: includes/admin.php:313
81
  #, php-format
82
  msgid "To be able to use this plugin you first of all need to create a free account at %s and setup a Site"
83
  msgstr "Um dieses Plugin nutzen zu können, müssen Sie sich zunächst kostenlos ein Konto bei %s anmelden."
84
 
85
- #: includes/admin.php:314
86
  msgid "After having created your account and setup your Site, please enter the Site settings in the form below."
87
  msgstr "Nachdem Sie Ihr Konto angemeldet haben, müssen Sie die API-Daten in nachfolgendes Formular eintragen."
88
 
89
- #: includes/admin.php:317
90
  #, php-format
91
  msgid "You are in good company! This plugin is used on more than %s websites!"
92
  msgstr "Mehr als %s Webseiten nutzen dieses Plugin. Seien Sie dabei!"
93
 
94
- #: includes/admin.php:319
95
  msgid "Setup my free account"
96
  msgstr "Kostenloses Konto anmelden"
97
 
98
- #: includes/admin.php:330
99
  msgid "Your API Account is setup correctly"
100
  msgstr "Die API-Daten sind korrekt"
101
 
102
- #: includes/admin.php:334
103
  msgid "Login to your account to manage your providers and access your Social Insights"
104
  msgstr "Loggen Sie sich in Ihr Konto ein, um Einstellungen vorzunehmen und Statistiken einzusehen"
105
 
106
- #: includes/admin.php:335
107
  msgid "Determine which social networks are popular amongst your users and tailor your registration experience to increase your users' engagement."
108
  msgstr "Finden Sie heraus, welche sozialen Netzwerke unter Ihren Besuchern beliebt sind, und steigern Sie die Beteilung Ihrer Besucher."
109
 
110
- #: includes/admin.php:338
111
  msgid "Login to my account"
112
  msgstr "In mein Konto einloggen"
113
 
114
- #: includes/admin.php:347
115
  msgid "Help, Updates &amp; Documentation"
116
  msgstr "Hilfe, Updates &amp; Dokumentation"
117
 
118
- #: includes/admin.php:350
119
  #, php-format
120
  msgid "<a target=\"_blank\" href=\"%s\">Follow us on Twitter</a> to stay informed about updates"
121
  msgstr "<a target=\"_blank\" href=\"%s\">Folgen Sie uns auf Twitter</a>, um auf dem Laufenden zu bleiben"
122
 
123
- #: includes/admin.php:351
124
  #, php-format
125
  msgid "<a target=\"_blank\" href=\"%s\">Read the online documentation</a> for more information about this plugin"
126
  msgstr "<a target=\"_blank\" href=\"%s\">Lesen Sie unsere Dokumentation</a> für zusätzliche Information"
127
 
128
- #: includes/admin.php:352
129
- msgid "<a target=\"_blank\" href=\"%a\">Contact us</a> if you have feedback or need assistance"
130
- msgstr "<a target=\"_blank\" href=\"%a\">Schreiben Sie uns</a>, falls Sie Hilfe benötigen"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
- #: includes/admin.php:363
 
 
 
 
 
 
 
 
133
  msgid "API Settings"
134
  msgstr "API Einstellungen"
135
 
136
- #: includes/admin.php:366
137
  msgid "Click here to create and view your API Credentials"
138
  msgstr "Klicken Sie hier, um Ihre API-Daten einzusehen"
139
 
140
- #: includes/admin.php:371
141
  msgid "API Subdomain"
142
  msgstr "API Subdomain"
143
 
144
- #: includes/admin.php:379
145
  msgid "API Public Key"
146
  msgstr "API Public Key"
147
 
148
- #: includes/admin.php:387
149
  msgid "API Private Key"
150
  msgstr "API Private Key"
151
 
152
- #: includes/admin.php:395
153
  msgid "Verify API Settings"
154
  msgstr "API-Einstellungen überprüfen"
155
 
156
- #: includes/admin.php:405
157
  msgid "Enable the social networks/identity providers of your choice"
158
  msgstr "Wählen Sie die sozialen Netzwerke aus:"
159
 
160
- #: includes/admin.php:421
161
  #, php-format
162
  msgid "To enable cyrillic usernames, you might need <a target=\"_blank\" href=\"%s\">this plugin</a>"
163
  msgstr "Um kyrillische Zeichen zu verwenden, brauchen Sie <a target=\"_blank\" href=\"%s\">dieses Plugin</a>"
164
 
165
- #: includes/admin.php:433
 
 
 
 
 
 
 
 
 
 
 
 
166
  msgid "Basic Settings"
167
  msgstr "Grundeinstellungen"
168
 
169
- #: includes/admin.php:438
170
  msgid "Enter the description to be displayed above the social network login buttons (leave empty for none):"
171
  msgstr "Welcher Text soll über den Icons der sozialen Netzwerk angezeigt werden (ggf. leer lassen) ?"
172
 
173
- #: includes/admin.php:443
174
  msgid "Connect with:"
175
  msgstr "Einloggen mit:"
176
 
177
- #: includes/admin.php:448
178
- msgid "If the user's social network profile has an avatar thumbnail, should we show it beside his comments?"
179
- msgstr "Wollen Sie die Nutzer-Avatare der sozialen Netwerke gegebenenfalls in den Kommentaren anzeigen?"
180
 
181
- #: includes/admin.php:456
182
  msgid "Yes, show user avatars from social networks if available"
183
  msgstr "Ja, zeige den sozialen Avatar des Benutzer in den Kommentaren dieses Benutzers an"
184
 
185
- #: includes/admin.php:457
186
  msgid "No, display the default avatars"
187
  msgstr "Nein, zeige die Standard-Avatare"
188
 
189
- #: includes/admin.php:457
190
- #: includes/admin.php:470
191
- #: includes/admin.php:491
192
- #: includes/admin.php:509
193
- #: includes/admin.php:532
194
- #: includes/admin.php:546
195
- #: includes/admin.php:566
196
- msgid "Default"
197
- msgstr "Standard"
198
-
199
- #: includes/admin.php:462
200
  msgid "Do you want to use the default or the small social network buttons?"
201
  msgstr "Wollen Sie die standard -oder kleinere Icons für soziale Netzwerke verwenden?"
202
 
203
- #: includes/admin.php:470
204
  #, php-format
205
  msgid "Use the default social network buttons (%s)"
206
  msgstr "Standard-Icons verwenden (%s)"
207
 
208
- #: includes/admin.php:471
209
  #, php-format
210
  msgid "Use the small social network buttons (%s)"
211
  msgstr "Kleine Icons verwenden (%s)"
212
 
213
- #: includes/admin.php:478
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  msgid "Login Settings"
215
  msgstr "Einstellungen: Einloggen"
216
 
217
- #: includes/admin.php:483
218
  msgid "Do you want to display the social network login buttons below the login form of your blog?"
219
  msgstr "Das Plugin auf der Login-Seite Ihres Blogs anzeigen?"
220
 
221
- #: includes/admin.php:491
222
  msgid "Yes, display the social network buttons below the login form"
223
  msgstr "Ja, die Icons der sozialen Netzwerke auf der Login-Seite anzeigen"
224
 
225
- #: includes/admin.php:492
226
  msgid "No, disable social network buttons in the login form"
227
  msgstr "Nein, keine Icons auf der Login-Seite anzeigen"
228
 
229
- #: includes/admin.php:497
230
  msgid "Where should existent users be redirected to after having logged in with their social network account?"
231
  msgstr "Wohin sollen Nutzer weitergeleitet werden, nachdem Sie sich mit einem sozialen Netzwerk eingeloggt haben?"
232
 
233
- #: includes/admin.php:509
234
- #: includes/admin.php:565
235
  msgid "Redirect users to the homepage of my blog"
236
  msgstr "Weiterleitung zur Hauptseite meines Blogs"
237
 
238
- #: includes/admin.php:510
239
- #: includes/admin.php:566
240
  msgid "Redirect users to their account dashboard"
241
  msgstr "Weiterleitung zur Profilseite des Nutzers"
242
 
243
- #: includes/admin.php:511
244
- #: includes/admin.php:567
245
  msgid "Redirect users to the following url"
246
  msgstr "Weiterleitung zu dieser URL"
247
 
248
- #: includes/admin.php:519
249
  msgid "Registration Settings"
250
  msgstr "Einstellungen: Anmeldung"
251
 
252
- #: includes/admin.php:524
253
  msgid "If the email address of the social network profile is verified, should we try to link it to an existing account?"
254
  msgstr "Sollen soziale Profile mit überprüfter Email mit vorhandenen Blog-Nutzern verknüpft werden?"
255
 
256
- #: includes/admin.php:532
257
  msgid "Yes, try to link verified social network profiles to existing blog accounts"
258
  msgstr "Ja, verknüpfe soziale Profile gegebenenfalls mit vorhanden Nutzern"
259
 
260
- #: includes/admin.php:533
261
  msgid "No, disable account linking"
262
  msgstr "Nein, keine Verknüpfung"
263
 
264
- #: includes/admin.php:538
265
  msgid "Do you want to display the social network login buttons below the registration form of your blog?"
266
  msgstr "Das Plugin auf der Anmelden-Seite Ihres Blogs anzeigen?"
267
 
268
- #: includes/admin.php:546
269
  msgid "Yes, display the social network buttons below the registration form"
270
  msgstr "Ja, die Icons der sozialen Netzwerke auf der Anmelden-Seite anzeigen"
271
 
272
- #: includes/admin.php:547
273
  msgid "No, disable social network buttons in the registration form"
274
  msgstr "Nein, keine Icons auf der Anmelden-Seite anzeigen"
275
 
276
- #: includes/admin.php:553
277
  msgid "Where should new users be redirected to after having registered with their social network account?"
278
  msgstr "Wohin sollen Nutzer weitergeleitet werden, nach sie ein Konto mit einem sozialen Netzwerk angelegt haben?"
279
 
280
- #: includes/admin.php:573
281
  msgid "Save Changes"
282
  msgstr "Einstellungen speichern"
283
 
@@ -309,3 +395,14 @@ msgstr "Widget verstecken bei eingeloggten Nutzern"
309
  msgid "Tick to use small buttons"
310
  msgstr "Kleine Icons verwenden"
311
 
 
 
 
 
 
 
 
 
 
 
 
2
  msgstr ""
3
  "Project-Id-Version: Social Login\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-03-02 15:16+0100\n"
6
+ "PO-Revision-Date: 2012-03-02 15:21+0100\n"
7
  "Last-Translator: Claude SCHLESSER <cschlesser@oneall.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
15
  "X-Poedit-SourceCharset: utf-8\n"
16
  "X-Poedit-SearchPath-0: .\n"
17
 
18
+ #: oa-social-login.php:23
19
  #, php-format
20
  msgid "This plugin requires WordPress %s or newer. Please update your WordPress installation to activate this plugin."
21
  msgstr "Dieses Plugin benötigt Wordpress %s oder höher. Bitte aktualisieren Sie Ihr Wordpress bevor Sie das Plugin installieren"
22
 
23
+ #: oa-social-login.php:45
 
 
 
 
24
  msgid "Settings"
25
  msgstr "Einstellungen"
26
 
27
+ #: includes/admin.php:53
28
  msgid "Thank you for using the Social Login Plugin!"
29
  msgstr "Danke dass Sie Social Login installiert haben!"
30
 
31
+ #: includes/admin.php:53
32
  #, php-format
33
  msgid "Please go to the <strong><a href=\"%s\">Settings\\Social Login</a></strong> page to setup the plugin."
34
  msgstr "Bitte rufen Sie die Seite <strong><a href=\"%s\">Einstellungen\\Social Login</a></strong> auf, um das Plugin zu konfigurieren."
35
 
36
+ #: includes/admin.php:191
37
+ msgid "Contacting API - please wait ..."
38
+ msgstr "Teste Einstellungen - bitte warten ..."
39
+
40
+ #: includes/admin.php:192
41
+ msgid "The settings are correct - do not forget to save your changes!"
42
+ msgstr "Die Einstellungen sind korrekt! Vergessen Sie nicht abzuspeichern!"
43
+
44
+ #: includes/admin.php:193
45
  msgid "Please fill out each of the fields above."
46
  msgstr "Bitte füllen Sie alle Felder aus"
47
 
48
+ #: includes/admin.php:194
49
  msgid "The subdomain does not exist. Have you filled it out correctly?"
50
  msgstr "Subdomain wurde nicht gefunden. Haben Sie sie richtig ausgefüllt?"
51
 
52
+ #: includes/admin.php:195
53
  msgid "The subdomain has a wrong syntax!"
54
  msgstr "Die Subdomain ist ungültig"
55
 
56
+ #: includes/admin.php:196
57
  msgid "Could not contact API. Are outoing CURL requests allowed?"
58
  msgstr "Keine Verbindung zur API. Blockiert Ihr Firewall ausgehende Anfragen?"
59
 
60
+ #: includes/admin.php:197
61
  msgid "The API credentials are wrong"
62
  msgstr "Die API-Nutzerdaten sind ungültig"
63
 
64
+ #: includes/admin.php:198
65
+ msgid "Autodetected PHP CURL - do not forget to save your changes!"
66
+ msgstr "PHP CURL gefunden! Vergessen Sie nicht abzuspeichern!"
67
+
68
+ #: includes/admin.php:199
69
+ msgid "Autodetected PHP FSOCKOPEN - do not forget to save your changes!"
70
+ msgstr "PHP FSOCKOPEN gefunden! Vergessen Sie nicht abzuspeichern!"
71
+
72
+ #: includes/admin.php:200
73
+ #, php-format
74
+ msgid "Autodetection Error - our <a href=\"%s\" target=\"_blank\">documentation</a> helps you fix this issue."
75
+ msgstr "Verbindungsfehler - in unserer <a href=\"%s\" target=\"_blank\">Dokumentation</a> finden Sie die Lösung."
76
 
77
+ #: includes/admin.php:359
78
  msgid "Social Login Settings"
79
  msgstr "Social Login Einstellungen"
80
 
81
+ #: includes/admin.php:366
82
  msgid "Make your blog social!"
83
  msgstr "Verbinden Sie Ihren Blog mit den sozialen Netzwerken!"
84
 
85
+ #: includes/admin.php:370
86
  msgid "Allow your visitors to comment, login and register with social networks like Twitter, Facebook, LinkedIn, Hyves, VKontakte, Google or Yahoo."
87
  msgstr "Erlauben Sie Ihren Besuchern, sich mit sozialen Netzwerk wie z.B. Twitter, Facebook, LinkedIn, Hyves, VKontakte, Google oder Yahoo anzumelden, und Kommentare zu hinterlassen."
88
 
89
+ #: includes/admin.php:371
90
  msgid "Draw a larger audience and increase user engagement in a few simple steps."
91
  msgstr "Steigern Sie die Beteilung Ihrer Nutzer auf einfachste Art und Weise."
92
 
93
+ #: includes/admin.php:375
94
  #, php-format
95
  msgid "To be able to use this plugin you first of all need to create a free account at %s and setup a Site"
96
  msgstr "Um dieses Plugin nutzen zu können, müssen Sie sich zunächst kostenlos ein Konto bei %s anmelden."
97
 
98
+ #: includes/admin.php:376
99
  msgid "After having created your account and setup your Site, please enter the Site settings in the form below."
100
  msgstr "Nachdem Sie Ihr Konto angemeldet haben, müssen Sie die API-Daten in nachfolgendes Formular eintragen."
101
 
102
+ #: includes/admin.php:379
103
  #, php-format
104
  msgid "You are in good company! This plugin is used on more than %s websites!"
105
  msgstr "Mehr als %s Webseiten nutzen dieses Plugin. Seien Sie dabei!"
106
 
107
+ #: includes/admin.php:381
108
  msgid "Setup my free account"
109
  msgstr "Kostenloses Konto anmelden"
110
 
111
+ #: includes/admin.php:392
112
  msgid "Your API Account is setup correctly"
113
  msgstr "Die API-Daten sind korrekt"
114
 
115
+ #: includes/admin.php:396
116
  msgid "Login to your account to manage your providers and access your Social Insights"
117
  msgstr "Loggen Sie sich in Ihr Konto ein, um Einstellungen vorzunehmen und Statistiken einzusehen"
118
 
119
+ #: includes/admin.php:397
120
  msgid "Determine which social networks are popular amongst your users and tailor your registration experience to increase your users' engagement."
121
  msgstr "Finden Sie heraus, welche sozialen Netzwerke unter Ihren Besuchern beliebt sind, und steigern Sie die Beteilung Ihrer Besucher."
122
 
123
+ #: includes/admin.php:400
124
  msgid "Login to my account"
125
  msgstr "In mein Konto einloggen"
126
 
127
+ #: includes/admin.php:409
128
  msgid "Help, Updates &amp; Documentation"
129
  msgstr "Hilfe, Updates &amp; Dokumentation"
130
 
131
+ #: includes/admin.php:412
132
  #, php-format
133
  msgid "<a target=\"_blank\" href=\"%s\">Follow us on Twitter</a> to stay informed about updates"
134
  msgstr "<a target=\"_blank\" href=\"%s\">Folgen Sie uns auf Twitter</a>, um auf dem Laufenden zu bleiben"
135
 
136
+ #: includes/admin.php:413
137
  #, php-format
138
  msgid "<a target=\"_blank\" href=\"%s\">Read the online documentation</a> for more information about this plugin"
139
  msgstr "<a target=\"_blank\" href=\"%s\">Lesen Sie unsere Dokumentation</a> für zusätzliche Information"
140
 
141
+ #: includes/admin.php:414
142
+ #, php-format
143
+ msgid "<a target=\"_blank\" href=\"%s\">Contact us</a> if you have feedback or need assistance"
144
+ msgstr "<a target=\"_blank\" href=\"%s\">Schreiben Sie uns</a>, falls Sie Hilfe benötigen"
145
+
146
+ #: includes/admin.php:425
147
+ #: includes/admin.php:433
148
+ msgid "API Connection Handler"
149
+ msgstr "API Kommunikation"
150
+
151
+ #: includes/admin.php:437
152
+ msgid "Use PHP CURL to communicate with the API"
153
+ msgstr "PHP CURL verwenden"
154
+
155
+ #: includes/admin.php:437
156
+ #: includes/admin.php:568
157
+ #: includes/admin.php:581
158
+ #: includes/admin.php:604
159
+ #: includes/admin.php:620
160
+ #: includes/admin.php:642
161
+ #: includes/admin.php:656
162
+ #: includes/admin.php:679
163
+ #: includes/admin.php:693
164
+ #: includes/admin.php:709
165
+ msgid "Default"
166
+ msgstr "Standard"
167
+
168
+ #: includes/admin.php:438
169
+ msgid "Using CURL is recommended but it might be disabled on some servers."
170
+ msgstr "Empfohlene Einstellung, auf manchen Serven aber deaktiviert."
171
+
172
+ #: includes/admin.php:444
173
+ msgid "Use PHP FSOCKOPEN to communicate with the API"
174
+ msgstr "PHP FSOCKOPEN verwenden"
175
 
176
+ #: includes/admin.php:445
177
+ msgid "Try using FSOCKOPEN if you encounter any problems with CURL."
178
+ msgstr "Verwenden Sie FSOCKEN wenn Probleme mit CURL auftreten sollten."
179
+
180
+ #: includes/admin.php:450
181
+ msgid "Autodetect API Connection"
182
+ msgstr "Automatisch erkennen"
183
+
184
+ #: includes/admin.php:460
185
  msgid "API Settings"
186
  msgstr "API Einstellungen"
187
 
188
+ #: includes/admin.php:463
189
  msgid "Click here to create and view your API Credentials"
190
  msgstr "Klicken Sie hier, um Ihre API-Daten einzusehen"
191
 
192
+ #: includes/admin.php:468
193
  msgid "API Subdomain"
194
  msgstr "API Subdomain"
195
 
196
+ #: includes/admin.php:476
197
  msgid "API Public Key"
198
  msgstr "API Public Key"
199
 
200
+ #: includes/admin.php:484
201
  msgid "API Private Key"
202
  msgstr "API Private Key"
203
 
204
+ #: includes/admin.php:492
205
  msgid "Verify API Settings"
206
  msgstr "API-Einstellungen überprüfen"
207
 
208
+ #: includes/admin.php:502
209
  msgid "Enable the social networks/identity providers of your choice"
210
  msgstr "Wählen Sie die sozialen Netzwerke aus:"
211
 
212
+ #: includes/admin.php:518
213
  #, php-format
214
  msgid "To enable cyrillic usernames, you might need <a target=\"_blank\" href=\"%s\">this plugin</a>"
215
  msgstr "Um kyrillische Zeichen zu verwenden, brauchen Sie <a target=\"_blank\" href=\"%s\">dieses Plugin</a>"
216
 
217
+ #: includes/admin.php:530
218
+ msgid "Keep in mind when testing the plugin"
219
+ msgstr "Bitte beim Testen beachten"
220
+
221
+ #: includes/admin.php:535
222
+ msgid "Social Login is a plugin that allows your users to comment and login with social networks. If a user is already logged in, the plugin will not be displayed. There is in fact no need to give the user the possibilty to connect with a social network if he is already connected."
223
+ msgstr "Social Login erlaubt es Ihren Benutzern, sich mit dem Konto eines sozialen Netzwerks anzumelden. Bei Benutzern die bereits eingeloggt sind wird das Plugin daher nicht angezeigt. Der Benutzer ist ja bereits angemeldet und benötigt keine weitere Anmeldenmöglichkeit. "
224
+
225
+ #: includes/admin.php:536
226
+ msgid "You will therefore have to logout to see the plugin in action."
227
+ msgstr "Sie müssen Sich aus diesem Grund ausloggen, um das Plugin testen zu können."
228
+
229
+ #: includes/admin.php:544
230
  msgid "Basic Settings"
231
  msgstr "Grundeinstellungen"
232
 
233
+ #: includes/admin.php:549
234
  msgid "Enter the description to be displayed above the social network login buttons (leave empty for none):"
235
  msgstr "Welcher Text soll über den Icons der sozialen Netzwerk angezeigt werden (ggf. leer lassen) ?"
236
 
237
+ #: includes/admin.php:554
238
  msgid "Connect with:"
239
  msgstr "Einloggen mit:"
240
 
241
+ #: includes/admin.php:559
242
+ msgid "If the user's social network profile has an avatar thumbnail, should we show it as default avatar for the user?"
243
+ msgstr "Wollen Sie die Nutzer-Avatare der sozialen Netwerke gegebenenfalls verwenden?"
244
 
245
+ #: includes/admin.php:567
246
  msgid "Yes, show user avatars from social networks if available"
247
  msgstr "Ja, zeige den sozialen Avatar des Benutzer in den Kommentaren dieses Benutzers an"
248
 
249
+ #: includes/admin.php:568
250
  msgid "No, display the default avatars"
251
  msgstr "Nein, zeige die Standard-Avatare"
252
 
253
+ #: includes/admin.php:573
 
 
 
 
 
 
 
 
 
 
254
  msgid "Do you want to use the default or the small social network buttons?"
255
  msgstr "Wollen Sie die standard -oder kleinere Icons für soziale Netzwerke verwenden?"
256
 
257
+ #: includes/admin.php:581
258
  #, php-format
259
  msgid "Use the default social network buttons (%s)"
260
  msgstr "Standard-Icons verwenden (%s)"
261
 
262
+ #: includes/admin.php:582
263
  #, php-format
264
  msgid "Use the small social network buttons (%s)"
265
  msgstr "Kleine Icons verwenden (%s)"
266
 
267
+ #: includes/admin.php:590
268
+ msgid "Comment Settings"
269
+ msgstr "Einstellungen: Kommentare"
270
+
271
+ #: includes/admin.php:595
272
+ msgid "Show the Social Login buttons the comment area if comments are disabled for guests?"
273
+ msgstr "Login mit einem sozialen Netzwerk anbieten falls Kommentare für Gäste deaktiviert sind?"
274
+
275
+ #: includes/admin.php:604
276
+ msgid "No, do not show the social network buttons"
277
+ msgstr "Nein, standard Avatar verwenden"
278
+
279
+ #: includes/admin.php:605
280
+ msgid "Yes, show the social network buttons"
281
+ msgstr "Ja, Avatare der sozialen Netzwerke verwenden"
282
+
283
+ #: includes/admin.php:606
284
+ msgid "The buttons will be displayed below the \"You must be logged in to leave a comment\" notice"
285
+ msgstr "Die Icons werden unter \"Du musst angemeldet sein, um einen Kommentar abzugeben\" angezeigt"
286
+
287
+ #: includes/admin.php:611
288
+ msgid "Automatically approve comments left by users that connected with a social network?"
289
+ msgstr "Kommentare automatisch freischalten wenn der Benutzer sich mit SocialLogin eingeloggt hat?"
290
+
291
+ #: includes/admin.php:620
292
+ msgid "No, do not automatically approve"
293
+ msgstr "Nein, Kommentare nicht automatisch freischalten"
294
+
295
+ #: includes/admin.php:621
296
+ msgid "Yes, automatically approve comments made by users that connected with a social network"
297
+ msgstr "Ja, Kommentare automatisch freischalten"
298
+
299
+ #: includes/admin.php:629
300
  msgid "Login Settings"
301
  msgstr "Einstellungen: Einloggen"
302
 
303
+ #: includes/admin.php:634
304
  msgid "Do you want to display the social network login buttons below the login form of your blog?"
305
  msgstr "Das Plugin auf der Login-Seite Ihres Blogs anzeigen?"
306
 
307
+ #: includes/admin.php:642
308
  msgid "Yes, display the social network buttons below the login form"
309
  msgstr "Ja, die Icons der sozialen Netzwerke auf der Login-Seite anzeigen"
310
 
311
+ #: includes/admin.php:643
312
  msgid "No, disable social network buttons in the login form"
313
  msgstr "Nein, keine Icons auf der Login-Seite anzeigen"
314
 
315
+ #: includes/admin.php:648
316
  msgid "Where should existent users be redirected to after having logged in with their social network account?"
317
  msgstr "Wohin sollen Nutzer weitergeleitet werden, nachdem Sie sich mit einem sozialen Netzwerk eingeloggt haben?"
318
 
319
+ #: includes/admin.php:656
320
+ #: includes/admin.php:708
321
  msgid "Redirect users to the homepage of my blog"
322
  msgstr "Weiterleitung zur Hauptseite meines Blogs"
323
 
324
+ #: includes/admin.php:657
325
+ #: includes/admin.php:709
326
  msgid "Redirect users to their account dashboard"
327
  msgstr "Weiterleitung zur Profilseite des Nutzers"
328
 
329
+ #: includes/admin.php:658
330
+ #: includes/admin.php:710
331
  msgid "Redirect users to the following url"
332
  msgstr "Weiterleitung zu dieser URL"
333
 
334
+ #: includes/admin.php:666
335
  msgid "Registration Settings"
336
  msgstr "Einstellungen: Anmeldung"
337
 
338
+ #: includes/admin.php:671
339
  msgid "If the email address of the social network profile is verified, should we try to link it to an existing account?"
340
  msgstr "Sollen soziale Profile mit überprüfter Email mit vorhandenen Blog-Nutzern verknüpft werden?"
341
 
342
+ #: includes/admin.php:679
343
  msgid "Yes, try to link verified social network profiles to existing blog accounts"
344
  msgstr "Ja, verknüpfe soziale Profile gegebenenfalls mit vorhanden Nutzern"
345
 
346
+ #: includes/admin.php:680
347
  msgid "No, disable account linking"
348
  msgstr "Nein, keine Verknüpfung"
349
 
350
+ #: includes/admin.php:685
351
  msgid "Do you want to display the social network login buttons below the registration form of your blog?"
352
  msgstr "Das Plugin auf der Anmelden-Seite Ihres Blogs anzeigen?"
353
 
354
+ #: includes/admin.php:693
355
  msgid "Yes, display the social network buttons below the registration form"
356
  msgstr "Ja, die Icons der sozialen Netzwerke auf der Anmelden-Seite anzeigen"
357
 
358
+ #: includes/admin.php:694
359
  msgid "No, disable social network buttons in the registration form"
360
  msgstr "Nein, keine Icons auf der Anmelden-Seite anzeigen"
361
 
362
+ #: includes/admin.php:700
363
  msgid "Where should new users be redirected to after having registered with their social network account?"
364
  msgstr "Wohin sollen Nutzer weitergeleitet werden, nach sie ein Konto mit einem sozialen Netzwerk angelegt haben?"
365
 
366
+ #: includes/admin.php:716
367
  msgid "Save Changes"
368
  msgstr "Einstellungen speichern"
369
 
395
  msgid "Tick to use small buttons"
396
  msgstr "Kleine Icons verwenden"
397
 
398
+ #~ msgid "Comment Form"
399
+ #~ msgstr "Kommentar Formular"
400
+
401
+ #~ msgid ""
402
+ #~ "This plugin requires the PHP libcurl extension be installed. Please "
403
+ #~ "contact your web host and request libcurl be <a href='http://www.php.net/"
404
+ #~ "manual/en/intro.curl.php'>installed</a>."
405
+ #~ msgstr ""
406
+ #~ "Im dieses Plugin zu nutzen benötigen Sie die PHP libcurl Erweiterung. "
407
+ #~ "Bitte kontaktieren Sie Ihren Server-Administrator um PHP libcurl zu <a "
408
+ #~ "href='http://www.php.net/manual/en/intro.curl.php'>installieren</a>."
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: 2.0
7
  Author: Claude Schlesser
8
  Author URI: http://www.oneall.com/
9
  License: GPL2
@@ -13,8 +13,7 @@ define ('OA_SOCIAL_LOGIN_PLUGIN_URL', plugins_url () . '/' . basename (dirname (
13
  define ('OA_SOCIAL_LOGIN_BASE_PATH', dirname (plugin_basename (__FILE__)));
14
 
15
  /**
16
- * Check technical requirements before activating the plugin.
17
- * Wordpress 3.0 or newer + CURL required
18
  */
19
  function oa_social_login_activate ()
20
  {
@@ -24,12 +23,6 @@ function oa_social_login_activate ()
24
  echo sprintf (__ ("This plugin requires WordPress %s or newer. Please update your WordPress installation to activate this plugin.", "3.0"));
25
  exit;
26
  }
27
- elseif (!function_exists ('curl_version'))
28
- {
29
- deactivate_plugins (basename (dirname (__FILE__)) . '/' . basename (__FILE__));
30
- echo sprintf (__ ("This plugin requires the PHP libcurl extension be installed. Please contact your web host and request libcurl be <a href='http://www.php.net/manual/en/intro.curl.php'>installed</a>."));
31
- exit;
32
- }
33
  update_option ('oa_social_login_activation_message', 0);
34
  }
35
  register_activation_hook (__FILE__, 'oa_social_login_activate');
@@ -71,6 +64,7 @@ if (!function_exists ('email_exists'))
71
  * Include required files
72
  */
73
  require_once(dirname (__FILE__) . '/includes/settings.php');
 
74
  require_once(dirname (__FILE__) . '/includes/toolbox.php');
75
  require_once(dirname (__FILE__) . '/includes/admin.php');
76
  require_once(dirname (__FILE__) . '/includes/user_interface.php');
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: 2.5
7
  Author: Claude Schlesser
8
  Author URI: http://www.oneall.com/
9
  License: GPL2
13
  define ('OA_SOCIAL_LOGIN_BASE_PATH', dirname (plugin_basename (__FILE__)));
14
 
15
  /**
16
+ * Check technical requirements before activating the plugin (Wordpress 3.0 or newer required)
 
17
  */
18
  function oa_social_login_activate ()
19
  {
23
  echo sprintf (__ ("This plugin requires WordPress %s or newer. Please update your WordPress installation to activate this plugin.", "3.0"));
24
  exit;
25
  }
 
 
 
 
 
 
26
  update_option ('oa_social_login_activation_message', 0);
27
  }
28
  register_activation_hook (__FILE__, 'oa_social_login_activate');
64
  * Include required files
65
  */
66
  require_once(dirname (__FILE__) . '/includes/settings.php');
67
+ require_once(dirname (__FILE__) . '/includes/communication.php');
68
  require_once(dirname (__FILE__) . '/includes/toolbox.php');
69
  require_once(dirname (__FILE__) . '/includes/admin.php');
70
  require_once(dirname (__FILE__) . '/includes/user_interface.php');
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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: 2.0
7
 
8
  Allow your visitors to comment and login with social networks like Twitter, Facebook, Paypal, LinkedIn, LiveJournal, OpenID, VKontakte, Google, Yahoo
9
 
@@ -109,6 +109,19 @@ http://docs.oneall.com/plugins/guide/social-login-wordpress/
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  = 2.0 =
113
  * WC3 Compliant callback uri
114
  * HTTP/HTTPS Check for CSS files
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: 2.5
7
 
8
  Allow your visitors to comment and login with social networks like Twitter, Facebook, Paypal, LinkedIn, LiveJournal, OpenID, VKontakte, Google, Yahoo
9
 
109
 
110
  == Changelog ==
111
 
112
+ = 2.5 =
113
+ * API Connection improved
114
+ * API Connection function moved to separate file
115
+ * Contact us link fixed
116
+ * Social Network Avatars fixed
117
+ * HTML for administration area fixed
118
+ * FSOCKOPEN Handler Added
119
+ * CURL/FSOCKOPEN selector added
120
+ * Identity Provider "Steam Community" added
121
+ * Identity Provider "StackExchange" added
122
+ * CSS served from CDN
123
+ * Optionally disable comment moderation
124
+
125
  = 2.0 =
126
  * WC3 Compliant callback uri
127
  * HTTP/HTTPS Check for CSS files