Completed
Push — master ( 83468c...9c5987 )
by Miled
01:58
created

wsl.providers.php ➔ wsl_get_provider_config()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 5
nc 3
nop 1
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 222 and the first side effect is on line 23.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/*!
3
* WordPress Social Login
4
*
5
* http://miled.github.io/wordpress-social-login/ | https://github.com/miled/wordpress-social-login
6
*  (c) 2011-2015 Mohamed Mrassi and contributors | http://wordpress.org/plugins/wordpress-social-login/
7
*/
8
9
/**
10
* List of supported providers by Hybridauth Library 
11
*
12
*   ARRAY( 
13
*      'provider_id'         : String  - Alphanumeric(a-zA-Z0-9) code/name of a provider
14
*      'provider_name'       : String  - Real provider name.
15
*      'require_client_id'   : Boolean - If a provider uses OAuth 2. Defaults to false.
16
*      'callback'            : Boolean - If the provide require to set a callback url. Defaults to false.
17
*      'new_app_link'        : String  - If the provide require to create a new application on his developer site.
18
*      'default_network'     : Boolean - If true, it will shows up by default on Admin > WordPress Social Login > Networks
19
*   )
20
*/
21
22
// Exit if accessed directly
23
if ( !defined( 'ABSPATH' ) ) exit;
24
25
// --------------------------------------------------------------------
26
27
$WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG = ARRAY(
28
	ARRAY( 
29
		"provider_id"       => "Facebook",
30
		"provider_name"     => "Facebook", 
31
		"require_client_id" => true, 
32
		"callback"          => true,
33
		"new_app_link"      => "https://developers.facebook.com/apps", 
34
35
		"default_network"   => true,
36
	),
37
	ARRAY(
38
		"provider_id"       => "Google",
39
		"provider_name"     => "Google",
40
		"callback"          => true,
41
		"require_client_id" => true,
42
		"new_app_link"      => "https://console.developers.google.com", 
43
44
		"default_network"   => true,
45
	),
46
	ARRAY( 
47
		"provider_id"       => "Twitter",
48
		"provider_name"     => "Twitter", 
49
		"callback"          => true,
50
		"new_app_link"      => "https://dev.twitter.com/apps", 
51
52
		"default_network"  => true,
53
	),
54
	ARRAY( 
55
		"provider_id"       => "WordPress",
56
		"provider_name"     => "WordPress", 
57
		"require_client_id" => true,
58
		"callback"          => true,
59
		"new_app_link"      => "https://developer.wordpress.com/apps/new/",
60
	),
61
	ARRAY( 
62
		"provider_id"       => "Yahoo",
63
		"provider_name"     => "Yahoo!",
64
		"require_client_id" => true,
65
		"callback"          => true,
66
		"new_app_link"      => "https://developer.yahoo.com/apps/create/", 
67
	),
68
	ARRAY( 
69
		"provider_id"       => "LinkedIn",
70
		"provider_name"     => "LinkedIn", 
71
		"new_app_link"      => "https://www.linkedin.com/secure/developer",
72
	),
73
	ARRAY( 
74
		"provider_id"       => "Disqus",
75
		"provider_name"     => "Disqus", 
76
		"require_client_id" => true,
77
		"callback"          => true,
78
		"new_app_link"      => "https://disqus.com/api/applications/", 
79
	),
80
	ARRAY( 
81
		"provider_id"       => "Instagram",
82
		"provider_name"     => "Instagram", 
83
		"callback"          => true,
84
		"require_client_id" => true,
85
		"new_app_link"      => "http://instagr.am/developer/clients/manage/", 
86
	),
87
	ARRAY( 
88
		"provider_id"       => "Reddit",
89
		"provider_name"     => "Reddit", 
90
		"require_client_id" => true,
91
		"callback"          => true,
92
		"new_app_link"      => "https://ssl.reddit.com/prefs/apps", 
93
	),
94
	ARRAY( 
95
		"provider_id"       => "Foursquare",
96
		"provider_name"     => "Foursquare",
97
		"callback"          => true,
98
		"require_client_id" => true, 
99
		"new_app_link"      => "https://www.foursquare.com/oauth/",
100
	),
101
	ARRAY( 
102
		"provider_id"       => "Tumblr",
103
		"provider_name"     => "Tumblr", 
104
		"new_app_link"      => "http://www.tumblr.com/oauth/apps", 
105
	),
106
	ARRAY( 
107
		"provider_id"       => "Stackoverflow",
108
		"provider_name"     => "Stackoverflow",
109
	),
110
	ARRAY( 
111
		"provider_id"       => "StackExchange",
112
		"provider_name"     => "StackExchange", 
113
		"callback"          => true,
114
		"require_client_id" => true, 
115
		"new_app_link"      => "https://stackapps.com/apps/oauth/register", 
116
	),
117
	ARRAY( 
118
		"provider_id"       => "GitHub",
119
		"provider_name"     => "GitHub", 
120
		"require_client_id" => true,
121
		"callback"          => true,
122
		"new_app_link"      => "https://github.com/settings/applications/new", 
123
	),
124
	ARRAY( 
125
		"provider_id"       => "Dribbble",
126
		"provider_name"     => "Dribbble", 
127
		"require_client_id" => true, 
128
		"custom_callback"   => true,
129
		"new_app_link"      => "https://dribbble.com/account/applications/new", 
130
	),
131
	ARRAY( 
132
		"provider_id"       => "Steam",
133
		"provider_name"     => "Steam",
134
		"new_app_link"      => "https://steamcommunity.com/dev/apikey",
135
		"require_api_key"   => true,
136
	),
137
	ARRAY( 
138
		"provider_id"       => "TwitchTV",
139
		"provider_name"     => "Twitch.tv", 
140
		"require_client_id" => true,
141
		"callback"          => true,
142
		"new_app_link"      => "http://www.twitch.tv/settings?section=applications",
143
	),
144
	ARRAY( 
145
		"provider_id"       => "Vkontakte",
146
		"provider_name"     => "ВКонтакте",
147
		"callback"          => true,
148
		"require_client_id" => true,
149
		"new_app_link"      => "http://vk.com/developers.php",
150
	),
151
	ARRAY( 
152
		"provider_id"       => "Mailru",
153
		"provider_name"     => "Mailru", 
154
		"require_client_id" => true,
155
		"callback"          => true,
156
		"new_app_link"      => "http://api.mail.ru/", 
157
	),
158
	ARRAY( 
159
		"provider_id"       => "Odnoklassniki",
160
		"provider_name"     => "Odnoklassniki", 
161
		"require_client_id" => true,
162
		"callback"          => true,
163
		"new_app_link"      => "http://dev.odnoklassniki.ru/",
164
	),
165
	ARRAY( 
166
		"provider_id"       => "WindowsLive",
167
		"provider_name"     => "Windows Live", 
168
		"require_client_id" => true,
169
		"new_app_link"      => "https://account.live.com/developers/applications/create", 
170
	),
171
	ARRAY(
172
		"provider_id"       => "Authentiq",
173
		"provider_name"     => "Authentiq",
174
		"require_client_id" => true,
175
		"callback"          => true,
176
		"new_app_link"      => "https://dashboard.authentiq.com/",
177
	),
178
	ARRAY(
179
		"provider_id"       => "EventBrite",
180
		"provider_name"     => "EventBrite",
181
		"require_client_id" => true,
182
		"callback"          => true,
183
		"new_app_link"      => "http://www.eventbrite.com/myaccount/apps/",
184
	),
185
	ARRAY(
186
		"provider_id"       => "Steemconnect",
187
		"provider_name"     => "Steemconnect",
188
		"require_client_id" => true,
189
		"callback"          => true,
190
		"new_app_link"      => "https://v2.steemconnect.com/dashboard",
191
	),
192
193
#- 
194
195
	// ARRAY( 
196
		// "provider_id"       => "AOL",
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
197
		// "provider_name"     => "AOL",
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
198
	// ),
199
	// ARRAY( 
200
		// "provider_id"       => "LastFM",
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
201
		// "provider_name"     => "LastFM",
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
202
		// "callback"          => true,
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
203
	// ),
204
	// ARRAY( 
205
		// "provider_id"       => "Goodreads",
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
206
		// "provider_name"     => "Goodreads", 
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
207
		// "callback"          => true,
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
208
		// "new_app_link"      => "http://www.goodreads.com/api",
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
209
	// ),
210
	// ARRAY( 
211
		// "provider_id"       => "Yandex",
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
212
		// "provider_name"     => "Yandex", 
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
213
		// "require_client_id" => true,
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
214
		// "callback"          => true,
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
215
		// "new_app_link"      => "https://oauth.yandex.ru",
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
216
	// ),
217
    
218
);
219
220
// --------------------------------------------------------------------
221
222
function wsl_get_provider_config($provider_id)
223
{
224
    global $WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
225
    
226
	foreach( $WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG AS $item )
227
	{
228
		if( $provider_id == $item["provider_id"] )
229
		{
230
			return $item;
231
		}
232
	}
233
}
234