Issues (161)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

includes/admin/wsl.admin.ui.php (6 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*!
3
* WordPress Social Login
4
*
5
* https://miled.github.io/wordpress-social-login/ | https://github.com/miled/wordpress-social-login
6
*   (c) 2011-2020 Mohamed Mrassi and contributors | https://wordpress.org/plugins/wordpress-social-login/
7
*/
8
9
/**
10
* The LOC in charge of displaying WSL Admin GUInterfaces
11
*/
12
13
// Exit if accessed directly
14
if ( !defined( 'ABSPATH' ) ) exit;
15
16
// --------------------------------------------------------------------
17
18
/**
19
* Generate wsl admin pages
20
*
21
* wp-admin/options-general.php?page=wordpress-social-login&..
22
*/
23
function wsl_admin_main()
24
{
25
	// HOOKABLE:
26
	do_action( "wsl_admin_main_start" );
27
28
	if ( ! current_user_can('manage_options') )
29
	{
30
		wp_die( _wsl__( 'You do not have sufficient permissions to access this page.' , 'wordpress-social-login' ) );
31
	}
32
33
	if( ! wsl_check_requirements() )
34
	{
35
		wsl_admin_ui_fail();
36
37
		exit;
38
	}
39
40
	GLOBAL $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS;
41
	GLOBAL $WORDPRESS_SOCIAL_LOGIN_COMPONENTS;
42
	GLOBAL $WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG;
43
	GLOBAL $WORDPRESS_SOCIAL_LOGIN_VERSION;
44
45 View Code Duplication
	if( isset( $_REQUEST["enable"] ) && isset( $WORDPRESS_SOCIAL_LOGIN_COMPONENTS[ $_REQUEST["enable"] ] ) )
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46
	{
47
		$component = $_REQUEST["enable"];
48
49
		$WORDPRESS_SOCIAL_LOGIN_COMPONENTS[ $component ][ "enabled" ] = true;
50
51
		update_option( "wsl_components_" . $component . "_enabled", 1 );
52
53
		wsl_register_components();
54
	}
55
56 View Code Duplication
	if( isset( $_REQUEST["disable"] ) && isset( $WORDPRESS_SOCIAL_LOGIN_COMPONENTS[ $_REQUEST["disable"] ] ) )
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
57
	{
58
		$component = $_REQUEST["disable"];
59
60
		$WORDPRESS_SOCIAL_LOGIN_COMPONENTS[ $component ][ "enabled" ] = false;
61
62
		update_option( "wsl_components_" . $component . "_enabled", 2 );
63
64
		wsl_register_components();
65
	}
66
67
	$wslp            = "networks";
68
	$assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . 'assets/img/16x16/';
69
70
	if( isset( $_REQUEST["wslp"] ) )
71
	{
72
		$wslp = trim( strtolower( strip_tags( $_REQUEST["wslp"] ) ) );
73
	}
74
75
	wsl_admin_ui_header( $wslp );
76
77
	if( isset( $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp] ) && $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["enabled"] )
78
	{
79
		if( isset( $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["action"] ) && $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["action"] )
80
		{
81
			do_action( $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS[$wslp]["action"] );
82
		}
83
		else
84
		{
85
			include "components/$wslp/index.php";
86
		}
87
	}
88
	else
89
	{
90
		wsl_admin_ui_error();
91
	}
92
93
	wsl_admin_ui_footer();
94
95
	// HOOKABLE:
96
	do_action( "wsl_admin_main_end" );
97
}
98
99
// --------------------------------------------------------------------
100
101
/**
102
* Render wsl admin pages header (label and tabs)
103
*/
104
function wsl_admin_ui_header( $wslp = null )
105
{
106
	// HOOKABLE:
107
	do_action( "wsl_admin_ui_header_start" );
108
109
	GLOBAL $WORDPRESS_SOCIAL_LOGIN_VERSION;
110
	GLOBAL $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS;
111
112
    // Dismiss WSL migration notice
113
    if( isset( $_REQUEST["wsldmn"] ) && (int) $_REQUEST["wsldmn"] === 1 )
114
    {
115
        update_option( "wsl_settings_migration_notice_is_read", true );
116
    }
117
?>
118
<a name="wsltop"></a>
119
<div class="wsl-container">
120
121
	<?php
122
		// nag
123
124
		if( in_array( $wslp, array( 'networks', 'login-widget' ) ) and ( isset( $_REQUEST['settings-updated'] ) or isset( $_REQUEST['enable'] ) ) )
125
		{
126
			$active_plugins = implode('', (array) get_option('active_plugins') );
127
			$cache_enabled  =
128
				strpos( $active_plugins, "w3-total-cache"   ) !== false |
0 ignored issues
show
Comprehensibility introduced by
Consider adding parentheses for clarity. Current Interpretation: (strpos($active_plugins,...super-cache') !== false, Probably Intended Meaning: strpos($active_plugins, ...uper-cache') !== false)

When comparing the result of a bit operation, we suggest to add explicit parenthesis and not to rely on PHP’s built-in operator precedence to ensure the code behaves as intended and to make it more readable.

Let’s take a look at these examples:

// Returns always int(0).
return 0 === $foo & 4;
return (0 === $foo) & 4;

// More likely intended return: true/false
return 0 === ($foo & 4);
Loading history...
129
				strpos( $active_plugins, "wp-super-cache"   ) !== false |
130
				strpos( $active_plugins, "quick-cache"      ) !== false |
131
				strpos( $active_plugins, "wp-fastest-cache" ) !== false |
132
				strpos( $active_plugins, "wp-widget-cache"  ) !== false |
133
				strpos( $active_plugins, "hyper-cache"      ) !== false;
134
135
			if( $cache_enabled )
136
			{
137
				?>
138
					<div class="fade updated" style="margin: 4px 0 20px;">
139
						<p>
140
							<?php _wsl_e("<b>Note:</b> WSL has detected that you are using a caching plugin. If the saved changes didn't take effect immediately then you might need to empty the cache", 'wordpress-social-login') ?>.
141
						</p>
142
					</div>
143
				<?php
144
			}
145
		}
146
147
		if( get_option( 'wsl_settings_development_mode_enabled' ) )
148
		{
149
			?>
150
				<div class="fade error wsl-error-dev-mode-on" style="margin: 4px 0 20px;">
151
					<p>
152
						<?php _wsl_e('<b>Warning:</b> You are now running WordPress Social Login with DEVELOPMENT MODE enabled. This mode is not intended for live websites as it might raise serious security risks', 'wordpress-social-login') ?>.
153
					</p>
154
					<p>
155
						<a class="button-secondary" href="options-general.php?page=wordpress-social-login&wslp=tools#dev-mode"><?php _wsl_e('Change this mode', 'wordpress-social-login') ?></a>
156
						<a class="button-secondary" href="http://miled.github.io/wordpress-social-login/troubleshooting-advanced.html" target="_blank"><?php _wsl_e('Read about the development mode', 'wordpress-social-login') ?></a>
157
					</p>
158
				</div>
159
			<?php
160
		}
161
162
		if( get_option( 'wsl_settings_debug_mode_enabled' ) )
163
		{
164
			?>
165
				<div class="fade updated wsl-error-debug-mode-on" style="margin: 4px 0 20px;">
166
					<p>
167
						<?php _wsl_e('<b>Note:</b> You are now running WordPress Social Login with DEBUG MODE enabled. This mode is not intended for live websites as it might add to loading time and store unnecessary data on your server', 'wordpress-social-login') ?>.
168
					</p>
169
					<p>
170
						<a class="button-secondary" href="options-general.php?page=wordpress-social-login&wslp=tools#debug-mode"><?php _wsl_e('Change this mode', 'wordpress-social-login') ?></a>
171
						<a class="button-secondary" href="options-general.php?page=wordpress-social-login&wslp=watchdog"><?php _wsl_e('View WSL logs', 'wordpress-social-login') ?></a>
172
						<a class="button-secondary" href="http://miled.github.io/wordpress-social-login/troubleshooting-advanced.html" target="_blank"><?php _wsl_e('Read about the debug mode', 'wordpress-social-login') ?></a>
173
					</p>
174
				</div>
175
			<?php
176
		}
177
178
		if( ! get_option( 'wsl_settings_migration_notice_is_read' ) )
179
		{
180
			?>
181
                <div class="fade updated" style="margin: 4px 0 20px; border-left-color: #ffc107;">
182
                    <p><b><?php _wsl_e("Breaking changes notice", 'wordpress-social-login') ?>:</b></p>
183
184
                    <p><?php _wsl_e("In WordPress Social Login 3.0 we have reworked the identity provider's <b>Callback URLs</b>. To make sure the plugin will keep working correctly, you can either create a new application for each enabled provider, or simply update the already created application with the newly generated callback urls:", 'wordpress-social-login') ?></p>
185
186
                    <ol>
187
                        <li><?php _wsl_e("First, navigate to <b>WSL Settting > Networks</b> tab", 'wordpress-social-login') ?>,</li>
188
                        <li><?php _wsl_e("Next, refer to <b>Where do I get this info?</b> section for each enabled provider and copy its new auto generated callback url", 'wordpress-social-login') ?>,</li>
189
                        <li><?php _wsl_e("Finally, update that link on the provider developer website", 'wordpress-social-login') ?>.</li>
190
                    </ol>
191
192
                    <p><?php _wsl_e("It's also important to note that a number of providers are now made obsolete in WSL 3.0, while a few other were added, and cetain providers has changed their requirements", 'wordpress-social-login') ?>.</p>
193
194
					<p>
195
						<a class="button-secondary" style="background-color: #ffc107; border-color: #e3ab02; color: #fff;min-width: 95px;text-align: center;" href="options-general.php?page=wordpress-social-login&wslp=networks&wsldmn=1"><?php _wsl_e('Okey, dismiss this notice', 'wordpress-social-login') ?></a>
196
					</p>
197
				</div>
198
			<?php
199
		}
200
	?>
201
202
	<div class="alignright">
203
		<a style="font-size: 0.9em; text-decoration: none;" target="_blank" href="http://miled.github.io/wordpress-social-login/documentation.html"><?php _wsl_e('Docs', 'wordpress-social-login') ?></a> -
204
		<a style="font-size: 0.9em; text-decoration: none;" target="_blank" href="http://miled.github.io/wordpress-social-login/support.html"><?php _wsl_e('Support', 'wordpress-social-login') ?></a> -
205
		<a style="font-size: 0.9em; text-decoration: none;" target="_blank" href="https://github.com/miled/wordpress-social-login"><?php _wsl_e('Github', 'wordpress-social-login') ?></a>
206
	</div>
207
208
	<h1 <?php if( is_rtl() ) echo 'style="margin: 20px 0;"'; ?>>
209
		<?php _wsl_e( 'WordPress Social Login', 'wordpress-social-login' ) ?>
210
211
		<small><?php echo $WORDPRESS_SOCIAL_LOGIN_VERSION ?></small>
212
	</h1>
213
214
	<h2 class="nav-tab-wrapper">
215
		&nbsp;
216
		<?php
217
			$css_pull_right = "";
218
219
			foreach( $WORDPRESS_SOCIAL_LOGIN_ADMIN_TABS as $name => $settings )
220
			{
221
				if( $settings["enabled"] && ( $settings["visible"] || $wslp == $name ) )
222
				{
223
					if( isset( $settings["pull-right"] ) && $settings["pull-right"] )
224
					{
225
						$css_pull_right = "float:right";
226
227
						if( is_rtl() )
228
						{
229
							$css_pull_right = "float:left";
230
						}
231
					}
232
233
					?><a class="nav-tab <?php if( $wslp == $name ) echo "nav-tab-active"; ?>" style="<?php echo $css_pull_right; ?>" href="options-general.php?page=wordpress-social-login&wslp=<?php echo $name ?>"><?php if( isset( $settings["ico"] ) ) echo '<img style="margin: 0px; padding: 0px; border: 0px none;width: 16px; height: 16px;" src="' . WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . '/assets/img/' . $settings["ico"] . '" />'; else _wsl_e( $settings["label"], 'wordpress-social-login' ); ?></a><?php
234
				}
235
			}
236
		?>
237
	</h2>
238
239
	<div id="wsl_admin_tab_content">
240
<?php
241
	// HOOKABLE:
242
	do_action( "wsl_admin_ui_header_end" );
243
}
244
245
// --------------------------------------------------------------------
246
247
/**
248
* Renders wsl admin pages footer
249
*/
250
function wsl_admin_ui_footer()
251
{
252
	// HOOKABLE:
253
	do_action( "wsl_admin_ui_footer_start" );
254
255
	GLOBAL $WORDPRESS_SOCIAL_LOGIN_VERSION;
256
?>
257
	</div> <!-- ./wsl_admin_tab_content -->
258
259
<div class="clear"></div>
260
261
<?php
262
	wsl_admin_help_us_localize_note();
263
264
	// HOOKABLE:
265
	do_action( "wsl_admin_ui_footer_end" );
266
267
	if( get_option( 'wsl_settings_development_mode_enabled' ) )
268
	{
269
		wsl_display_dev_mode_debugging_area();
270
 	}
271
}
272
273
// --------------------------------------------------------------------
274
275
/**
276
* Renders wsl admin error page
277
*/
278 View Code Duplication
function wsl_admin_ui_error()
0 ignored issues
show
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
279
{
280
	// HOOKABLE:
281
	do_action( "wsl_admin_ui_error_start" );
282
?>
283
<div id="wsl_div_warn">
284
	<h3 style="margin:0px;"><?php _wsl_e('Oops! We ran into an issue.', 'wordpress-social-login') ?></h3>
285
286
	<hr />
287
288
	<p>
289
		<?php _wsl_e('Unknown or Disabled <b>Component</b>! Check the list of enabled components or the typed URL', 'wordpress-social-login') ?> .
290
	</p>
291
292
	<p>
293
		<?php _wsl_e("If you believe you've found a problem with <b>WordPress Social Login</b>, be sure to let us know so we can fix it", 'wordpress-social-login') ?>.
294
	</p>
295
296
	<hr />
297
298
	<div>
299
		<a class="button-secondary" href="http://miled.github.io/wordpress-social-login/support.html" target="_blank"><?php _wsl_e( "Report as bug", 'wordpress-social-login' ) ?></a>
300
		<a class="button-primary" href="options-general.php?page=wordpress-social-login&wslp=components" style="float:<?php if( is_rtl() ) echo 'left'; else echo 'right'; ?>"><?php _wsl_e( "Check enabled components", 'wordpress-social-login' ) ?></a>
301
	</div>
302
</div>
303
<?php
304
	// HOOKABLE:
305
	do_action( "wsl_admin_ui_error_end" );
306
}
307
308
// --------------------------------------------------------------------
309
310
/**
311
* Renders WSL #FAIL page
312
*/
313
function wsl_admin_ui_fail()
314
{
315
	// HOOKABLE:
316
	do_action( "wsl_admin_ui_fail_start" );
317
?>
318
<div class="wsl-container">
319
		<div style="background: none repeat scroll 0 0 #fff;border: 1px solid #e5e5e5;box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);padding:20px;">
320
			<h1><?php _e("WordPress Social Login - FAIL!", 'wordpress-social-login') ?></h1>
321
322
			<hr />
323
324
			<p>
325
				<?php _e('Despite the efforts, put into <b>WordPress Social Login</b> in terms of reliability, portability, and maintenance by the plugin <a href="http://profiles.wordpress.org/miled/" target="_blank">author</a> and <a href="https://github.com/hybridauth/WordPress-Social-Login/graphs/contributors" target="_blank">contributors</a>', 'wordpress-social-login') ?>.
326
				<b style="color:red;"><?php _e('Your server failed the requirements check for this plugin', 'wordpress-social-login') ?>:</b>
327
			</p>
328
329
			<p>
330
				<?php _e('These requirements are usually met by default by most "modern" web hosting providers, however some complications may occur with <b>shared hosting</b> and, or <b>custom wordpress installations</b>', 'wordpress-social-login') ?>.
331
			</p>
332
333
			<p>
334
				<?php _wsl_e("The minimum server requirements are", 'wordpress-social-login') ?>:
335
			</p>
336
337
			<ul style="margin-left:60px;">
338
				<li><?php _wsl_e("PHP >= 5.2.0 installed", 'wordpress-social-login') ?></li>
339
				<li><?php _wsl_e("WSL Endpoint URLs reachable", 'wordpress-social-login') ?></li>
340
				<li><?php _wsl_e("PHP's default SESSION handling", 'wordpress-social-login') ?></li>
341
				<li><?php _wsl_e("PHP/CURL/SSL Extension enabled", 'wordpress-social-login') ?></li>
342
				<li><?php _wsl_e("PHP/JSON Extension enabled", 'wordpress-social-login') ?></li>
343
				<li><?php _wsl_e("PHP/REGISTER_GLOBALS Off", 'wordpress-social-login') ?></li>
344
				<li><?php _wsl_e("jQuery installed on WordPress backoffice", 'wordpress-social-login') ?></li>
345
			</ul>
346
		</div>
347
348
<?php
349
	include_once( WORDPRESS_SOCIAL_LOGIN_ABS_PATH . 'includes/admin/components/tools/wsl.components.tools.actions.job.php' );
350
351
	wsl_component_tools_do_diagnostics();
352
?>
353
</div>
354
<style>.wsl-container .button-secondary { display:none; }</style>
355
<?php
356
	// HOOKABLE:
357
	do_action( "wsl_admin_ui_fail_end" );
358
}
359
360
// --------------------------------------------------------------------
361
362
/**
363
* Renders wsl admin welcome panel
364
*/
365
function wsl_admin_welcome_panel()
366
{
367
    // Dissmiss WSL Welcome pannel
368
	if( isset( $_REQUEST["wsldwp"] ) && (int) $_REQUEST["wsldwp"] === 1 )
369
	{
370
		update_option( "wsl_settings_welcome_panel_enabled", wsl_get_version() );
371
372
		return;
373
	}
374
375
	// if new user or wsl updated, then we display wsl welcome panel
376
	if( get_option( 'wsl_settings_welcome_panel_enabled' ) == wsl_get_version() )
377
	{
378
		return;
379
	}
380
381
	$wslp = "networks";
382
383
	if( isset( $_REQUEST["wslp"] ) )
384
	{
385
		$wslp = $_REQUEST["wslp"];
386
	}
387
?>
388
<!--
389
	if you want to know if a UI was made by developer, then here is a tip: he will always use tables
390
391
	//> wsl-w-panel is shamelessly borrowed and modified from wordpress welcome-panel
392
-->
393
<div id="wsl-w-panel">
394
	<a href="options-general.php?page=wordpress-social-login&wslp=<?php echo $wslp ?>&wsldwp=1" id="wsl-w-panel-dismiss" <?php if( is_rtl() ) echo 'style="left: 10px;right: auto;"'; ?>><?php _wsl_e("Dismiss", 'wordpress-social-login') ?></a>
395
396
	<table width="100%" border="0" style="margin:0;padding:0;">
397
		<tr>
398
			<td width="10" valign="top"></td>
399
			<td width="300" valign="top">
400
				<b style="font-size: 16px;"><?php _wsl_e("Welcome!", 'wordpress-social-login') ?></b>
401
				<p>
402
					<?php _wsl_e("If you are still new to WordPress Social Login, we have provided a few walkthroughs to get you started", 'wordpress-social-login') ?>.
403
				</p>
404
			</td>
405
			<td width="40" valign="top"></td>
406
			<td width="260" valign="top">
407
				<br />
408
				<p>
409
					<b><?php _wsl_e("Get Started", 'wordpress-social-login') ?></b>
410
				</p>
411
				<ul style="margin-left:25px;">
412
					<li><a href="http://miled.github.io/wordpress-social-login/overview.html" target="_blank"><?php _wsl_e('Plugin Overview', 'wordpress-social-login') ?></a></li>
413
					<li><a href="http://miled.github.io/wordpress-social-login/networks.html" target="_blank"><?php _wsl_e('Setup and Configuration', 'wordpress-social-login') ?></a></li>
414
					<li><a href="http://miled.github.io/wordpress-social-login/widget.html" target="_blank"><?php _wsl_e('Customize WSL Widgets', 'wordpress-social-login') ?></a></li>
415
					<li><a href="http://miled.github.io/wordpress-social-login/userdata.html" target="_blank"><?php _wsl_e('Manage users and contacts', 'wordpress-social-login') ?></a></li>
416
					<li><a href="http://miled.github.io/wordpress-social-login/documentation.html" target="_blank"><?php _wsl_e('WSL Developer API', 'wordpress-social-login') ?></a></li>
417
				</ul>
418
			</td>
419
			<td width="" valign="top">
420
				<br />
421
				<p>
422
					<b><?php echo sprintf( _wsl__( "What's new on WSL %s", 'wordpress-social-login'), wsl_get_version() ) ?></b>
423
				</p>
424
425
				<ul style="margin-left:25px;">
426
					<li><?php _wsl_e('WSL is now fully migrated to Hybridauth 3.5', 'wordpress-social-login') ?></li>
427
					<li><?php _wsl_e("Reworked providers Callback URLs and it's a breaking change! See up top notice", 'wordpress-social-login') ?></li>
428
					<li><?php _wsl_e('Added serval new providers: Amazon, Discord and Spotify to name a few', 'wordpress-social-login') ?></li>
429
					<li><?php _wsl_e('Removal of a number of currently defunct identity providers ', 'wordpress-social-login') ?></li>
430
					<li><?php _wsl_e('Authentication widgets and forms design overhall', 'wordpress-social-login') ?></li>
431
					<li><?php _wsl_e('Various fixes and improvements', 'wordpress-social-login') ?></li>
432
				</ul>
433
			</td>
434
		</tr>
435
		<tr id="wsl-w-panel-updates-tr">
436
			<td colspan="5" style="border-top:1px solid #ccc;" id="wsl-w-panel-updates-td">
437
				&nbsp;
438
			</td>
439
		</tr>
440
	</table>
441
</div>
442
<?php
443
}
444
445
// --------------------------------------------------------------------
446
447
/**
448
* Renders wsl localization note
449
*/
450
function wsl_admin_help_us_localize_note()
451
{
452
	return; // nothing, until I decide otherwise..
453
454
	$assets_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . 'assets/img/';
0 ignored issues
show
$assets_url = WORDPRESS_...IN_URL . 'assets/img/'; does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
455
456
	?>
457
		<div id="l10n-footer">
458
			<br /><br />
459
			<img src="<?php echo $assets_url ?>flags.png">
460
			<a href="https://www.transifex.com/projects/p/wordpress-social-login/" target="_blank"><?php _wsl_e( "Help us translate WordPress Social Login into your language", 'wordpress-social-login' ) ?></a>
461
		</div>
462
	<?php
463
}
464
465
// --------------------------------------------------------------------
466
467
/**
468
* Renders an editor in a page in the typical fashion used in Posts and Pages.
469
* wp_editor was implemented in wp 3.3. if not found we fallback to a regular textarea
470
*
471
* Utility.
472
*/
473
function wsl_render_wp_editor( $name, $content )
474
{
475
	if( ! function_exists( 'wp_editor' ) )
476
	{
477
		?>
478
			<textarea style="width:100%;height:100px;margin-top:6px;" name="<?php echo $name ?>"><?php echo htmlentities( $content ); ?></textarea>
479
		<?php
480
		return;
481
	}
482
?>
483
<div class="postbox">
484
	<div class="wp-editor-textarea" style="background-color: #FFFFFF;">
485
		<?php
486
			wp_editor(
487
				$content, $name,
488
				array( 'textarea_name' => $name, 'media_buttons' => true, 'tinymce' => array( 'theme_advanced_buttons1' => 'formatselect,forecolor,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink' ) )
489
			);
490
		?>
491
	</div>
492
</div>
493
<?php
494
}
495
496
// --------------------------------------------------------------------
497
498
/**
499
* Display WordPress Social Login on settings as submenu
500
*/
501
function wsl_admin_menu()
502
{
503
	add_options_page(
504
		_wsl__( 'WP Social Login', 'wordpress-social-login' ),
505
		_wsl__( 'WP Social Login', 'wordpress-social-login' ),
506
		'manage_options',
507
		'wordpress-social-login',
508
		'wsl_admin_main'
509
	);
510
511
	add_action( 'admin_init', 'wsl_register_setting' );
512
}
513
514
add_action('admin_menu', 'wsl_admin_menu' );
515
516
// --------------------------------------------------------------------
517
518
/**
519
* Enqueue WSL admin CSS file
520
*/
521 View Code Duplication
function wsl_add_admin_stylesheets()
0 ignored issues
show
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
522
{
523
	if( ! wp_style_is( 'wsl-admin', 'registered' ) )
524
	{
525
		wp_register_style( "wsl-admin", WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . "assets/css/admin.css" );
526
	}
527
528
	wp_enqueue_style( "wsl-admin" );
529
}
530
531
add_action( 'admin_enqueue_scripts', 'wsl_add_admin_stylesheets' );
532
533
// --------------------------------------------------------------------
534