PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / 3.2.1
Wp Social Login and Register Social Counter v3.2.1
3.2.1 trunk 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.11 1.3.2 1.3.3 1.3.4 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.4 1.4.5 1.4.6 1.4.8 1.4.9 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.8.0 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.8 2.2.9 3.0.0 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0
wp-social / app / providers.php
wp-social / app Last commit date
api-routes.php 1 week ago avatar.php 5 years ago counter-settings.php 5 years ago legacy.php 5 years ago login-settings.php 1 week ago providers.php 1 week ago route.php 1 week ago settings.php 5 years ago share-settings.php 1 week ago share.php 3 years ago
providers.php
514 lines
1 <?php
2
3 namespace WP_Social\App;
4
5 class Providers {
6
7 const ORDER_LIST_PROVIDER_SHARE = 'xs_share_providers_order';
8 const ORDER_LIST_PROVIDER_LOGIN = 'xs_login_providers_order';
9 const ORDER_LIST_PROVIDER_COUNTER = 'xs_counter_providers_order';
10
11 public static function get_core_providers_share() {
12
13 $share_links = [
14 'facebook' => [
15 'label' => 'Facebook',
16 'url' => 'http://www.facebook.com/sharer.php',
17 'params' => [
18 'u' => '[%url%]',
19 't' => '[%title%]',
20 'v' => 3,
21 ],
22 'data' => [
23 'value' => 0,
24 'text' => __('Share', 'wp-social'),
25 'label' => 'Facebook',
26 ],
27 ],
28
29 'twitter' => [
30 'label' => 'Twitter',
31 'url' => 'https://twitter.com/intent/tweet',
32 'params' => [
33 'text' => '[%title%] [%url%]',
34 'original_referer' => '[%url%]',
35 'related' => '[%author%]',
36 ],
37 'data' => [
38 'value' => 0,
39 'text' => __('Share', 'wp-social'),
40 'label' => 'Twitter',
41 ],
42 ],
43
44 'linkedin' => [
45 'label' => 'LinkedIn',
46 'url' => 'https://www.linkedin.com/shareArticle',
47 'params' => [
48 'url' => '[%url%]',
49 'title' => '[%title%]',
50 'summary' => '[%details%]',
51 'source' => '[%source%]',
52 'mini' => true,
53 ],
54 'data' => [
55 'value' => 0,
56 'text' => __('Share', 'wp-social'),
57 'label' => 'LinkedIn',
58 ],
59 ],
60
61 'pinterest' => [
62 'label' => 'Pinterest',
63 'url' => 'https://pinterest.com/pin/create/button/',
64 'params' => [
65 'url' => '[%url%]',
66 'media' => '[%media%]',
67 'description' => '[%details%]',
68 ],
69 'data' => [
70 'value' => 0,
71 'text' => __('Share', 'wp-social'),
72 'label' => 'Pinterest',
73 ],
74 ],
75
76 'facebook-messenger' => [
77 'label' => 'Facebook Messenger',
78 'url' => 'https://www.facebook.com/dialog/send',
79 'params' => [
80 'link' => '[%url%]',
81 'redirect_uri' => '[%url%]',
82 'display' => 'popup',
83 'app_id' => '[%app_id%]',
84 ],
85 'data' => [
86 'value' => 0,
87 'text' => __('Share', 'wp-social'),
88 'label' => 'Facebook Messenger',
89 ],
90 ],
91
92 'kik' => [
93 'label' => 'Kik',
94 'url' => 'https://www.kik.com/send/article/',
95 'params' => [
96 'url' => '[%url%]',
97 'text' => '[%details%]',
98 'title' => '[%title%]',
99 ],
100 'data' => [
101 'value' => 0,
102 'text' => __('Share', 'wp-social'),
103 'label' => 'Kik',
104 ],
105 ],
106
107 'skype' => [
108 'label' => 'Skype',
109 'url' => 'https://web.skype.com/share',
110 'params' => [
111 'url' => '[%url%]',
112 ],
113 'data' => [
114 'value' => 0,
115 'text' => __('Share', 'wp-social'),
116 'label' => 'Skype',
117 ],
118 ],
119
120 'trello' => [
121 'label' => 'Trello',
122 'url' => 'https://trello.com/add-card',
123 'params' => [
124 'url' => '[%url%]',
125 'name' => '[%title%]',
126 'desc' => '[%details%]',
127 'mode' => 'popup',
128 ],
129 'data' => [
130 'value' => 0,
131 'text' => __('Share', 'wp-social'),
132 'label' => 'Trello',
133 ],
134 ],
135
136 'viber' => [
137 'label' => 'Viber',
138 'url' => 'viber://forward',
139 'params' => [
140 'text' => '[%title%] [%url%]',
141 ],
142 'data' => [
143 'value' => 0,
144 'text' => __('Share', 'wp-social'),
145 'label' => 'Viber',
146 ],
147 ],
148
149 'whatsapp' => [
150 'label' => 'WhatsApp',
151 'url' => 'whatsapp://send',
152 'params' => [
153 'text' => '[%title%] [%url%]',
154 ],
155 'data' => [
156 'value' => 0,
157 'text' => __('Share', 'wp-social'),
158 'label' => 'WhatsApp',
159 ],
160 ],
161
162 'telegram' => [
163 'label' => 'Telegram',
164 'url' => 'https://telegram.me/share/url',
165 'params' => [
166 'url' => '[%url%]',
167 'text' => '[%title%]',
168 ],
169 'data' => [
170 'value' => 0,
171 'text' => __('Share', 'wp-social'),
172 'label' => 'Telegram',
173 ],
174 ],
175
176 'email' => [
177 'label' => 'Email',
178 'url' => 'mailto:',
179 'params' => [
180 'body' => 'Title: [%title%] \n\n URL: [%url%]',
181 'subject' => '[%title%]',
182 ],
183 'data' => [
184 'value' => 0,
185 'text' => __('Share', 'wp-social'),
186 'label' => 'Email',
187 ],
188 ],
189
190 'reddit' => [
191 'label' => 'Reddit',
192 'url' => 'http://reddit.com/submit',
193 'params' => [
194 'url' => '[%url%]',
195 'title' => '[%title%]',
196 ],
197 'data' => [
198 'value' => 0,
199 'text' => __('Share', 'wp-social'),
200 'label' => 'Reddit',
201 ],
202 ],
203
204 'digg' => [
205 'label' => 'Digg',
206 'url' => 'http://digg.com/submit',
207 'params' => [
208 'url' => '[%url%]',
209 'title' => '[%title%]',
210 'phase' => 2,
211 ],
212 'data' => [
213 'value' => 0,
214 'text' => __('Share', 'wp-social'),
215 'label' => 'Digg',
216 ],
217 ],
218
219 'stumbleupon' => [
220 'label' => 'StumbleUpon',
221 'url' => 'http://www.stumbleupon.com/submit',
222 'params' => [
223 'url' => '[%url%]',
224 'title' => '[%title%]',
225 ],
226 'data' => [
227 'value' => 0,
228 'text' => __('Share', 'wp-social'),
229 'label' => 'StumbleUpon',
230 ],
231 ],
232
233 'lineapp' => [
234 'label' => 'LineApp',
235 'url' => 'https://lineit.line.me/share/ui',
236 'params' => [
237 'url' => '[%url%]',
238 'title' => '[%title%]',
239 ],
240 'data' => [
241 'value' => 0,
242 'text' => __('Share', 'wp-social'),
243 'label' => 'LineApp',
244 ],
245 ],
246 ];
247
248 $providers_order = get_option(self::ORDER_LIST_PROVIDER_SHARE);
249
250 return self::providers_sort($providers_order, $share_links);
251 }
252
253 public static function get_core_providers_login() {
254
255 $login_providers = [
256 'facebook' => 'Facebook',
257 'google' => 'Google',
258 'linkedin' => 'LinkedIn',
259 'twitter' => 'Twitter',
260 'dribbble' => 'Dribbble',
261 'github' => 'GitHub',
262 'wordpress' => 'WordPress',
263 'vkontakte' => 'Vkontakte',
264 'reddit' => 'Reddit',
265 'lineapp' => 'LineApp'
266 ];
267
268 $providers_order = get_option(self::ORDER_LIST_PROVIDER_LOGIN);
269
270 return self::providers_sort($providers_order, $login_providers);
271 }
272
273 /**
274 * todo - right now I am just collecting all functions used for providers here, once gathering is done then we can merge some methods into one
275 *
276 */
277 public static function xs_login_service_provider_instruction($social) {
278
279 $doc_url = 'https://help.wpmet.com/docs-cat/wp-social/';
280
281 $tmp = [
282 'getting_txt' => '',
283 'doc_url' => $doc_url,
284 'local_ins' => '',
285 ];
286
287 $doc_arr['facebook'] = [
288 'getting_txt' => __('To allow your visitors to log in with their Facebook account, first you must create a Facebook App. The following guide will help you through the Facebook App creation process. After you have created your Facebook App, head over to "Settings" and configure the given "App ID" and "App Secret" according to your Facebook App.', 'wp-social'),
289 'doc_url' => 'https://wpmet.com/doc/facebook-social-login-app/',
290 'local_ins' => __('For local development environment you do not need to add the redirect URI.', 'wp-social'),
291 ];
292
293 $doc_arr['google'] = [
294 'getting_txt' => __('To allow your visitors to log in with their Google account, first you must create a Google Project. The following guide will help you through the Google project creation process. After you have created your Google project, head over to "Settings" and configure the given "App ID" and "App Secret" according to your Google App.', 'wp-social'),
295 'doc_url' => 'https://help.wpmet.com/docs/wp-social-google-login-app/',
296 'local_ins' => '',
297 ];
298
299 $doc_arr['linkedin'] = [
300 'getting_txt' => __('To connect your Auth0 app to LinkedIn, you will need to generate a Client ID and Client Secret in a LinkedIn app, copy these keys into your Auth0 settings, and enable the connection', 'wp-social'),
301 'doc_url' => 'https://help.wpmet.com/docs/wp-social-linkedin-login-app/',
302 'local_ins' => '',
303 ];
304
305 $doc_arr['twitter'] = [
306 'getting_txt' => __('To allow your visitors to log in with their Twitter account, first you must create a Twitter App. The following guide will help you through the Twitter App creation process. After you have created your Twitter App, head over to "Settings" and configure the given "Consumer Key" and "Consumer Secret" according to your Twitter App.', 'wp-social'),
307 'doc_url' => 'https://help.wpmet.com/docs/wp-social-twitter-app/',
308 'local_ins' => '',
309 ];
310
311 $doc_arr['dribbble'] = [
312 'getting_txt' => __('To allow your visitors to log in with their Dribbble account, first you must create a Dribbble App. The following guide will help you through the Dribbble App creation process. After you have created your Dribbble App, head over to "Settings" and configure the given "App ID" and "App Secret" according to your Dribbble App.', 'wp-social'),
313 'doc_url' => 'https://help.wpmet.com/docs/wp-social-dribbble-app/',
314 'local_ins' => '',
315 ];
316
317 $doc_arr['github'] = [
318 'getting_txt' => __('To allow your visitors to log in with their GitHub account, first you must create a GitHub App. The following guide will help you through the GitHub App creation process. After you have created your GitHub App, head over to "Settings" and configure the given "App ID" and "App Secret" according to your GitHub App.', 'wp-social'),
319 'doc_url' => 'https://help.wpmet.com/docs/wp-social-github-app/',
320 'local_ins' => '',
321 ];
322
323 $doc_arr['wordpress'] = [
324 'getting_txt' => __('To allow your visitors to log in with their WordPress account, first you must create a WordPress App. The following guide will help you through the WordPress App creation process. After you have created your WordPress App, head over to "Settings" and configure the given "App ID" and "App Secret" according to your WordPress App.', 'wp-social'),
325 'doc_url' => 'https://help.wpmet.com/docs/wp-social-wordpress-app/',
326 'local_ins' => '',
327 ];
328
329 $doc_arr['reddit'] = [
330 'getting_txt' => __('To allow your visitors to log in with their Reddit account, first you must create a Reddit App. The following guide will help you through the Reddit App creation process. After you have created your Reddit App, head over to "Settings" and configure the given "App ID" and "App Secret" according to your Reddit App.', 'wp-social'),
331 'doc_url' => 'https://help.wpmet.com/docs/wp-social-reddit-app/',
332 'local_ins' => '',
333 ];
334
335 $doc_arr['vkontakte'] = [
336 'getting_txt' => __('To allow your visitors to log in with their Vkontakte account, first you must create a Vkontakte App. The following guide will help you through the Vkontakte App creation process. After you have created your Vkontakte App, head over to "Settings" and configure the given "App ID" and "App Secret" according to your Vkontakte App.', 'wp-social'),
337 'doc_url' => 'https://wpmet.com/doc/vkontakte-integration-for-wp-social/',
338 'local_ins' => '',
339 ];
340
341 $doc_arr['lineapp'] = [
342 'getting_txt' => __('To allow your visitors to log in with their LineApp account, first you must create a LineApp. The following guide will help you through the LineApp creation process. After you have created your LineApp, head over to "Settings" and configure the given "App ID" and "App Secret" according to your LineApp.', 'wp-social'),
343 'doc_url' => 'https://wpmet.com/doc/wp-social-line-app-integration/',
344 'local_ins' => '',
345 ];
346
347
348 return isset($doc_arr[$social]) ? $doc_arr[$social] : $tmp;
349 }
350
351
352 public static function get_core_providers_count() {
353
354 $counter_providers = [
355 'facebook' => [
356 'label' => 'Facebook',
357 'data' => ['text' => __('Fans', 'wp-social'), 'url' => 'http://www.facebook.com/%s'],
358 'form' => [
359 'id' => ['type' => 'normal', 'label' => __('Page ID/Name', 'wp-social'), 'input' => 'text'],
360 ],
361 ],
362
363 'twitter' => [
364 'label' => 'Twitter',
365 'data' => ['text' => __('Followers', 'wp-social'), 'url' => 'http://twitter.com/%s'],
366 'form' => [
367 'id' => ['type' => 'normal', 'label' => __('Username', 'wp-social'), 'input' => 'text'],
368 'api' => [
369 'type' => 'access',
370 'label' => __('Access Token Key', 'wp-social'),
371 'input' => 'text',
372 'filed' => ['app_id' => 'Consumer key', 'app_secret' => 'Consumer secret'],
373 ],
374 ],
375 ],
376
377 'pinterest' => [
378 'label' => 'Pinterest',
379 'data' => ['text' => __('Followers', 'wp-social'), 'url' => 'http://www.pinterest.com/%s'],
380 'form' => [
381 'username' => [
382 'type' => 'normal',
383 'label' => __('Username', 'wp-social'),
384 'input' => 'text',
385 ],
386 ],
387 ],
388
389 'dribbble' => [
390 'label' => 'Dribbble',
391 'data' => ['text' => __('Followers', 'wp-social'), 'url' => 'http://dribbble.com/%s'],
392 'form' => [
393 'api' => [
394 'type' => 'access',
395 'label' => __('Access Token Key', 'wp-social'),
396 'input' => 'text',
397 'filed' => ['app_id' => 'Client ID', 'app_secret' => 'Client Secret'],
398 ],
399 ],
400 ],
401
402 'instagram' => [
403 'label' => 'Instagram',
404 'data' => ['text' => __('Followers', 'wp-social'), 'url' => 'http://instagram.com/%s'],
405 'form' => [
406 'id' => [
407 'type' => 'normal',
408 'label' => __('Username', 'wp-social'),
409 'input' => 'text',
410 ],
411 ],
412 ],
413
414 'tiktok' => [
415 'label' => 'TikTok',
416 'data' => ['text' => __('Followers', 'wp-social'), 'url' => 'http://www.tiktok.com/%s'],
417 'form' => [
418 'id' => [
419 'type' => 'normal',
420 'label' => __('Username', 'wp-social'),
421 'input' => 'text',
422 ],
423 ],
424 ],
425
426 'youtube' => [
427 'label' => 'YouTube',
428 'data' => ['text' => __('Subscribers', 'wp-social'), 'url' => 'http://youtube.com/%s'],
429 'form' => [
430 'type' => [
431 'type' => 'normal',
432 'label' => __('Account Type', 'wp-social'),
433 'input' => 'select',
434 'data' => ['Channel' => 'Channel', 'User' => 'User'],
435 ],
436 'id' => ['type' => 'normal', 'label' => __('Username or Channel ID', 'wp-social'), 'input' => 'text'],
437 'key' => ['type' => 'normal', 'label' => __('YouTube API Key', 'wp-social'), 'input' => 'text'],
438 ],
439 ],
440
441 'mailchimp' => [
442 'label' => 'Mailchimp',
443 'data' => ['text' => __('Subscribers', 'wp-social')],
444 'form' => [
445 'id' => ['type' => 'normal', 'label' => __('List ID (Optional)', 'wp-social'), 'input' => 'text'],
446 'api' => ['type' => 'normal', 'label' => __('API Key', 'wp-social'), 'input' => 'text'],
447 ],
448 ],
449
450 'comments' => [
451 'label' => 'Comments',
452 'data' => ['text' => __('Count', 'wp-social')],
453 ],
454
455 'posts' => [
456 'label' => 'Posts',
457 'data' => ['text' => __('Count', 'wp-social')],
458 ],
459
460 // 'vimeo' => [ 'label' => 'Vimeo', 'data' => ['text' => __( 'Subscribers', 'wp-social' ), 'url' => 'https://vimeo.com/channels/%s'] ],
461 // 'vkontakte' => [ 'label' => 'Vkontakte', 'data' => ['text' => __( 'Members', 'wp-social' ), 'url' => 'http://vk.com/%s'] ],
462 // 'linkedin' => [
463 // 'label' => 'LinkedIn',
464 // 'data' => ['text' => __( 'Followers', 'wp-social' ), 'url' => 'https://www.linkedin.com/%s/%s'],
465 // 'form' => [
466 // 'type' => [
467 // 'type' => 'normal',
468 // 'label' => 'Account Type',
469 // 'input' => 'select',
470 // 'data' => ['Company' => 'Company', 'Profile' => 'Profile'],
471 // ],
472 // 'id' => ['type' => 'normal', 'label' => 'Your ID', 'input' => 'text'],
473 // 'api' => [
474 // 'type' => 'access',
475 // 'label' => 'Access Token Key(optional)',
476 // 'input' => 'text',
477 // 'filed' => ['app_id' => 'API Key', 'app_secret' => 'Secret Key'],
478 // ],
479 // ],
480 // ],
481 ];
482
483 $providers_order = get_option(self::ORDER_LIST_PROVIDER_COUNTER);
484
485 return self::providers_sort($providers_order, $counter_providers);
486 }
487
488 public static function providers_sort($providers_order, $main_providers) {
489
490 if(empty($providers_order)) {
491 return $main_providers;
492 }
493
494 $providers_final_order = [];
495
496 foreach($providers_order as $provider) {
497 if($provider == '' || $provider == 'linkedinopenid') continue; //for v2.2.8 legacy support
498 $providers_final_order[$provider] = $main_providers[$provider];
499
500 unset($main_providers[$provider]);
501 }
502
503 if(!empty($main_providers)) {
504
505 foreach($main_providers as $key => $val) {
506
507 $providers_final_order[$key] = $val;
508 }
509 }
510
511 return $providers_final_order;
512 }
513 }
514