PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / 2.2.4
Wp Social Login and Register Social Counter v2.2.4
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 5 years ago avatar.php 4 years ago counter-settings.php 5 years ago legacy.php 5 years ago login-settings.php 3 years ago providers.php 3 years ago route.php 4 years ago settings.php 5 years ago share-settings.php 4 years ago share.php 3 years ago
providers.php
487 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',
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',
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',
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',
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',
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',
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',
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',
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',
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',
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',
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',
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',
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',
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',
229 'label' => 'StumbleUpon',
230 ],
231 ],
232 ];
233
234 $providers_order = get_option(self::ORDER_LIST_PROVIDER_SHARE);
235
236 return self::providers_sort($providers_order, $share_links);
237 }
238
239 public static function get_core_providers_login() {
240
241 $login_providers = [
242 'facebook' => 'Facebook',
243 'google' => 'Google',
244 'linkedin' => 'LinkedIn',
245 'twitter' => 'Twitter',
246 'dribbble' => 'Dribbble',
247 'github' => 'GitHub',
248 'wordpress' => 'WordPress',
249 'vkontakte' => 'Vkontakte',
250 'reddit' => 'Reddit',
251 'lineapp' => 'LineApp'
252 ];
253
254 $providers_order = get_option(self::ORDER_LIST_PROVIDER_LOGIN);
255
256 return self::providers_sort($providers_order, $login_providers);
257 }
258
259 /**
260 * 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
261 *
262 */
263 public static function xs_login_service_provider_instruction($social) {
264
265 $doc_url = 'https://help.wpmet.com/docs-cat/wp-social/';
266
267 $tmp = [
268 'getting_txt' => '',
269 'doc_url' => $doc_url,
270 'local_ins' => '',
271 ];
272
273 $doc_arr['facebook'] = [
274 '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'),
275 'doc_url' => 'https://wpmet.com/doc/facebook-social-login-app/',
276 'local_ins' => __('For local development environment you do not need to add the redirect URI.', 'wp-social'),
277 ];
278
279 $doc_arr['google'] = [
280 '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'),
281 'doc_url' => 'https://help.wpmet.com/docs/wp-social-google-login-app/',
282 'local_ins' => '',
283 ];
284
285 $doc_arr['linkedin'] = [
286 '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'),
287 'doc_url' => 'https://help.wpmet.com/docs/wp-social-linkedin-login-app/',
288 'local_ins' => '',
289 ];
290
291 $doc_arr['twitter'] = [
292 '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'),
293 'doc_url' => 'https://help.wpmet.com/docs/wp-social-twitter-app/',
294 'local_ins' => '',
295 ];
296
297 $doc_arr['dribbble'] = [
298 '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'),
299 'doc_url' => 'https://help.wpmet.com/docs/wp-social-dribbble-app/',
300 'local_ins' => '',
301 ];
302
303 $doc_arr['github'] = [
304 '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'),
305 'doc_url' => 'https://help.wpmet.com/docs/wp-social-github-app/',
306 'local_ins' => '',
307 ];
308
309 $doc_arr['wordpress'] = [
310 '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'),
311 'doc_url' => 'https://help.wpmet.com/docs/wp-social-wordpress-app/',
312 'local_ins' => '',
313 ];
314
315 $doc_arr['reddit'] = [
316 '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'),
317 'doc_url' => 'https://help.wpmet.com/docs/wp-social-reddit-app/',
318 'local_ins' => '',
319 ];
320
321 $doc_arr['vkontakte'] = [
322 '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'),
323 'doc_url' => 'https://wpmet.com/doc/vkontakte-integration-for-wp-social/',
324 'local_ins' => '',
325 ];
326
327 $doc_arr['lineapp'] = [
328 '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'),
329 'doc_url' => 'https://wpmet.com/doc/wp-social-line-app-integration/',
330 'local_ins' => '',
331 ];
332
333
334 return isset($doc_arr[$social]) ? $doc_arr[$social] : $tmp;
335 }
336
337
338 public static function get_core_providers_count() {
339
340 $counter_providers = [
341 'facebook' => [
342 'label' => 'Facebook',
343 'data' => ['text' => __('Fans', 'wp-social'), 'url' => 'http://www.facebook.com/%s'],
344 'form' => [
345 'id' => ['type' => 'normal', 'label' => 'Page ID/Name', 'input' => 'text'],
346 ],
347 ],
348
349 'twitter' => [
350 'label' => 'Twitter',
351 'data' => ['text' => __('Followers', 'wp-social'), 'url' => 'http://twitter.com/%s'],
352 'form' => [
353 'id' => ['type' => 'normal', 'label' => 'Username', 'input' => 'text'],
354 'api' => [
355 'type' => 'access',
356 'label' => __('Access Token Key', 'wp-social'),
357 'input' => 'text',
358 'filed' => ['app_id' => 'Consumer key', 'app_secret' => 'Consumer secret'],
359 ],
360 ],
361 ],
362
363 'pinterest' => [
364 'label' => 'Pinterest',
365 'data' => ['text' => __('Followers', 'wp-social'), 'url' => 'http://www.pinterest.com/%s'],
366 'form' => [
367 'username' => [
368 'type' => 'normal',
369 'label' => 'Username',
370 'input' => 'text',
371 ],
372 ],
373 ],
374
375 'dribbble' => [
376 'label' => 'Dribbble',
377 'data' => ['text' => __('Followers', 'wp-social'), 'url' => 'http://dribbble.com/%s'],
378 'form' => [
379 'api' => [
380 'type' => 'access',
381 'label' => __('Access Token Key', 'wp-social'),
382 'input' => 'text',
383 'filed' => ['app_id' => 'Client ID', 'app_secret' => 'Client Secret'],
384 ],
385 ],
386 ],
387
388 'instagram' => [
389 'label' => 'Instagram',
390 'data' => ['text' => __('Followers', 'wp-social'), 'url' => 'http://instagram.com/%s'],
391 'form' => [
392 'id' => [
393 'type' => 'normal',
394 'label' => 'Username',
395 'input' => 'text',
396 ],
397 ],
398 ],
399
400 'youtube' => [
401 'label' => 'YouTube',
402 'data' => ['text' => __('Subscribers', 'wp-social'), 'url' => 'http://youtube.com/%s/%s'],
403 'form' => [
404 'type' => [
405 'type' => 'normal',
406 'label' => 'Account Type',
407 'input' => 'select',
408 'data' => ['Channel' => 'Channel', 'User' => 'User'],
409 ],
410 'id' => ['type' => 'normal', 'label' => 'Username or Channel ID', 'input' => 'text'],
411 'key' => ['type' => 'normal', 'label' => 'YouTube API Key', 'input' => 'text'],
412 ],
413 ],
414
415 'mailchimp' => [
416 'label' => 'Mailchimp',
417 'data' => ['text' => __('Subscribers', 'wp-social')],
418 'form' => [
419 'id' => ['type' => 'normal', 'label' => 'List ID (Optional)', 'input' => 'text'],
420 'api' => ['type' => 'normal', 'label' => 'API Key', 'input' => 'text'],
421 ],
422 ],
423
424 'comments' => [
425 'label' => 'Comments',
426 'data' => ['text' => __('Count', 'wp-social')],
427 ],
428
429 'posts' => [
430 'label' => 'Posts',
431 'data' => ['text' => __('Count', 'wp-social')],
432 ],
433
434 // 'vimeo' => [ 'label' => 'Vimeo', 'data' => ['text' => __( 'Subscribers', 'wp-social' ), 'url' => 'https://vimeo.com/channels/%s'] ],
435 // 'vkontakte' => [ 'label' => 'Vkontakte', 'data' => ['text' => __( 'Members', 'wp-social' ), 'url' => 'http://vk.com/%s'] ],
436 // 'linkedin' => [
437 // 'label' => 'LinkedIn',
438 // 'data' => ['text' => __( 'Followers', 'wp-social' ), 'url' => 'https://www.linkedin.com/%s/%s'],
439 // 'form' => [
440 // 'type' => [
441 // 'type' => 'normal',
442 // 'label' => 'Account Type',
443 // 'input' => 'select',
444 // 'data' => ['Company' => 'Company', 'Profile' => 'Profile'],
445 // ],
446 // 'id' => ['type' => 'normal', 'label' => 'Your ID', 'input' => 'text'],
447 // 'api' => [
448 // 'type' => 'access',
449 // 'label' => 'Access Token Key(optional)',
450 // 'input' => 'text',
451 // 'filed' => ['app_id' => 'API Key', 'app_secret' => 'Secret Key'],
452 // ],
453 // ],
454 // ],
455 ];
456
457 $providers_order = get_option(self::ORDER_LIST_PROVIDER_COUNTER);
458
459 return self::providers_sort($providers_order, $counter_providers);
460 }
461
462 public static function providers_sort($providers_order, $main_providers) {
463
464 if(empty($providers_order)) {
465 return $main_providers;
466 }
467
468 $providers_final_order = [];
469
470 foreach($providers_order as $provider) {
471 $providers_final_order[$provider] = $main_providers[$provider];
472
473 unset($main_providers[$provider]);
474 }
475
476 if(!empty($main_providers)) {
477
478 foreach($main_providers as $key => $val) {
479
480 $providers_final_order[$key] = $val;
481 }
482 }
483
484 return $providers_final_order;
485 }
486 }
487